阿图因的新运行手册执行引擎
Atuin’s New Runbook Execution Engine

原始链接: https://blog.atuin.sh/introducing-the-new-runbook-execution-engine/

## Atuin Desktop v0.2.0:重新设计的运行手册引擎 Atuin Desktop 发布了重大更新,包含一个完全重新设计的运行手册执行引擎,标志着运行手册成为核心自动化工具迈出了重要一步。此次改进解决了之前执行不稳定、状态丢失和不一致的问题,确保运行手册现在能够**持久化状态**并**可预测地执行**,即使在应用程序重启和标签页关闭后也是如此。 **主要改进包括:** * **持久化状态:** 运行手册即使在关闭/重启应用程序后也能保留上下文(例如临时目录)。 * **可重现的结果:** 上下文流程可预测——在一个块中设置的变量不会追溯性地影响其上方的变量。 * **模板无处不在:** 模板现在在输入中普遍受支持,从而实现自引用变量。 * **两种上下文类型:** *被动上下文*(持久设置)和 *主动上下文*(运行时状态)提供精细的控制。 此更新还为**实时协作**和未来功能(如**CLI 运行器**、**密钥管理**和**基于 Markdown 的运行手册**)奠定了**基础**。 一些现有功能,如编辑器变量同步,已进行了调整以适应新的架构。 更新到 v0.2.0,体验 Atuin Desktop 运行手册的改进稳定性和强大功能!

Hacker News 新闻 | 过去 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 Atuin 的新 Runbook 执行引擎 (atuin.sh) 16 分,由 emschwartz 1 小时前发布 | 隐藏 | 过去 | 收藏 | 2 评论 piqufoh 15 分钟前 [–] 我喜欢 atuin -- 共享 shell 命令记忆功能解决了我的一个问题(回忆晦涩的 CLI 命令) 我会尝试 atuin desktop,并希望它成功,但我不能说它解决了任何我意识到的特定问题。回复 Ghoelian 4 分钟前 | 父评论 [–] 我也有同样的感觉。它看起来是一个非常棒的产品,我很想用它做点什么。我只是不知道做什么。回复 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

We're excited to announce a major architectural improvement to Atuin Desktop: a completely redesigned runbook execution engine.

This is a huge change, the first big step toward making runbooks a core automation primitive.

If you’ve ever hit flaky context, disappearing state, or inconsistent execution, this release fixes it. Runbooks now keep their state, behave predictably, and don’t require constant re-running just to get back to where you were. We're laying the foundation for enhanced real-time collaboration and CLI-based execution.

Zoooooooom

What's New?

Persistent

Runbooks stay how you left them. No rebuilds. No re-running blocks. No friction.

Previously, when you closed a tab or restarted Atuin Desktop, all execution state was lost. With the new execution engine, your runbook's context - which stores all of the execution-related state - now persists across app restarts and tab closures.

In practice, this means that if you run a command like mktemp -d to create a tempflorary directory and save it to a template variable, that output is now saved locally along with your runbook. Close the tab or restart the app, and the context is still there - no need to re-execute blocks to rebuild your working environment.

Reproducible

Runbooks behave the way you expect, every time.

The new engine establishes a clear, predictable flow of context through your runbooks. Each block in your document can only influence the blocks below it. This means that, for example, setting a template variable in a block will not affect that same variable's usage in any blocks above it.

A block’s context only affects blocks below it

With the fundamentals fixed, we pushed the template system further:

Templates Everywhere

We now run all user input through our template system. This means you can use templates in variable names, context blocks like directory and SSH, and any other block that accepts input.

If you find any input that doesn’t behave this way, it’s a bug and we’d love to know about it!

Self-Referential Variables

Since all inputs run through the template system and variables don’t affect context above them, it’s possible for a variable to refer to itself. For example, you could trim the newline off a variable named output by using {{ var.output | trim }} and assigning it back to output again. You can get as deep as you want with variable metaprogramming:

We heard you like variables

Two Types of Execution Context

The new engine introduces two types of context:

Passive Context is set automatically when your document updates. This includes:

  • Working directory changes
  • Environment variable definitions
  • SSH host connections
  • Explicit template variable assignments

This context persists even when you're not actively running blocks.

Active Context is set during block execution and represents the output and runtime state of actively running blocks. When you re-run a block, its active context is cleared and rebuilt.

The active context contains the data we store locally with your runbook, and persists across app restarts. A new button in the runbook header allows you to clear all active context for a runbook, in case you want to start with a clean slate.

Reset your runbook’s execution state at any time

Foundation for Future Collaboration

Atuin Desktop already supports real-time collaboration for editing runbook content, but the new architecture lays the groundwork to take this even further, setting us up for real collaborative execution. Imagine sharing not just the document, but the entire running environment - including environment setup, terminal output, and database query results - all in real time!

What's Changed?

No More Global Context

Because this update changes the way blocks can affect one another, you may need to adjust any runbooks that relied on the old, global context (for example, setting a template variable in a block and using that variable in a block above the block that set it).

Editor Variable Sync

In the old execution system, the editor block contained a toggle that kept the value in the editor in sync with a variable in the context. Whenever the variable changed anywhere in the document, the editor would update to reflect that change.

This behavior doesn't work well with the new architecture, where context is no longer global. For this reason, we've removed the toggle, and replaced it with a UI element that allows you to manually set the editor content to the value of any defined template variable.

Update an editor block's content to match the value of any available variable

No Standard Error in Script Variables

Script output variables now capture only stdout, not stderr. This prevents error messages and diagnostics from mixing with your actual output data, making variables cleaner and more reliable. You'll still see both stdout and stderr in the block's terminal output.

Under the Hood

For those interested in the technical details, this update involved rewriting our entire block execution system, migrating it from our old front-end system written in TypeScript to the existing Rust backend. We've migrated every block to the new system, making every block's execution more portable and reliable.

Each block implements a BlockBehavior trait, defining a couple key methods:

  • passive_context - returns any context that should be set passively any time the document changes
  • execute - executes the block, sending messages to the client to update active context and any other relevant data

There are other useful traits, such as QueryBlockBehavior, which allows quickly defining a block that queries a data source and returns a table of results.

Combined with traits like MessageChannel (to facilitate sending messages to the client) and BlockContextStorage (to save and load context data), the new architecture has allowed us to completely extract the runtime system from the desktop application, paving the way for executing runbooks in any environment.

For all the juicy details, check out the execution system docs in the repository.

What's Next?

CLI Runner

Run your runbooks from any terminal, even if Atuin Desktop isn't installed. The new runtime is designed to be environment-agnostic, making it possible to execute runbooks in CI/CD pipelines, deployment scripts, or automated workflows.

It’s shells all the way down

Improved Serial Execution

Running a runbook from top-to-bottom - which we call "serial execution" - currently depends on the runbook being open in your editor. Thanks to the new runtime, we'll be able to remove this constraint, and introduce improved tooling for monitoring and controlling runbook executions both inside and outside the app.

Secrets Management

Secrets are one of the most critical aspects of infrastructure management, and runbooks are no exception. We'll be adding first-class support for storing and retrieving secrets both locally and in the cloud, encrypted end-to-end.

Markdown-Based Runbooks

Markdown is ubiquitous in modern development. It's lightweight, easy to read, and can be edited in any text editor. We're working on storing runbooks as pure markdown files with embedded metadata, making them more portable and easier to write, review, and version control.

💬

Got thoughts about terminals or runbooks? Grab a slot here

Try It Out

The new execution engine is available now in v0.2.0. Update your Atuin Desktop installation and experience the difference yourself.

Discord: Discord

Forum: Forum

联系我们 contact @ memedata.com