@zq-silk/yui 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +27 -9
  2. package/dist/cli/commandCatalog.js +7 -5
  3. package/dist/cli/invocationAuthority.js +4 -0
  4. package/dist/cli.js +130 -5
  5. package/dist/commands/releaseCommands.js +33 -24
  6. package/dist/commands/taskCommands.js +18 -28
  7. package/dist/commands/taskFactCommands.js +6 -2
  8. package/dist/controller/clientRuntime.js +7 -2
  9. package/dist/controller/domainIdentity.js +7 -7
  10. package/dist/controller/handoverCandidate.js +2 -5
  11. package/dist/controller/jobSupervisor.js +4 -4
  12. package/dist/controller/resourceCleanupLinux.js +35 -19
  13. package/dist/controller/resourceInventoryLinux.js +104 -7
  14. package/dist/controller/runtime.js +4 -13
  15. package/dist/controller/runtimeLaunchCoordinator.js +2 -4
  16. package/dist/controller/sessionOwnerReconciliation.js +40 -16
  17. package/dist/core/controllerClient.js +44 -16
  18. package/dist/core/controllerEndpoint.js +4 -3
  19. package/dist/core/controllerProcessIdentity.js +54 -0
  20. package/dist/core/controllerServer.js +16 -11
  21. package/dist/core/fileLockOwner.js +53 -12
  22. package/dist/doctor/doctor.js +230 -12
  23. package/dist/execution/workItemMainRun.js +1 -1
  24. package/dist/executor/agentAdapter.js +0 -8
  25. package/dist/executor/agentExecutor.js +4 -1
  26. package/dist/executor/fileRoleLaunchPlanner.js +15 -25
  27. package/dist/message/messageContinuation.js +1 -1
  28. package/dist/release/releaseHandover.js +77 -25
  29. package/dist/release/runtimeRelease.js +7 -7
  30. package/dist/repository/gitWorkspace.js +9 -8
  31. package/dist/repository/taskWorkspacePreparer.js +15 -57
  32. package/dist/resources/liveReferences.js +64 -7
  33. package/dist/runtime/agentEndpointIdentity.js +4 -1
  34. package/dist/runtime/agentHost.js +13 -9
  35. package/dist/runtime/codexInteractiveHost.js +1 -1
  36. package/dist/runtime/codexSharedDaemon.js +211 -0
  37. package/dist/runtime/index.js +1 -1
  38. package/dist/runtime/jsonLineChannel.js +6 -1
  39. package/dist/runtime/localStartup.js +65 -0
  40. package/dist/runtime/native/darwin-arm64/claude-process-owner +0 -0
  41. package/dist/runtime/native/darwin-arm64/process-identity +0 -0
  42. package/dist/runtime/native/darwin-x64/claude-process-owner +0 -0
  43. package/dist/runtime/native/darwin-x64/process-identity +0 -0
  44. package/dist/runtime/{claude-process-owner → native/linux-x64/claude-process-owner} +0 -0
  45. package/dist/runtime/nativeExecutable.js +10 -0
  46. package/dist/runtime/runtimeCoherence.js +10 -3
  47. package/dist/runtime/sessionOwnerIdentity.js +19 -0
  48. package/dist/runtime/sessionTerminationGuard.js +10 -3
  49. package/dist/runtime/sessionTitle.js +15 -0
  50. package/dist/runtime/structuredProviderHost.js +94 -29
  51. package/dist/scheduler/activeRoleRunDelivery.js +2 -11
  52. package/dist/scheduler/leaderWakeupProcessor.js +1 -2
  53. package/dist/scheduler/ports.js +1 -8
  54. package/dist/scheduler/taskExecutionProjection.js +1 -6
  55. package/dist/storage/sqliteSchema.js +15 -3
  56. package/dist/storage/storageVersions.js +1 -1
  57. package/dist/storage/taskCatalog.js +10 -2
  58. package/dist/storage/upgrade/taskMainWorkspaceMigration.js +83 -0
  59. package/dist/storage/upgrade/upgradeOrchestrator.js +25 -6
  60. package/dist/task/task.js +0 -12
  61. package/dist/tmux/tmuxManager.js +8 -2
  62. package/dist/tmux/tmuxSocketEndpoint.js +23 -1
  63. package/dist/web/assets/client/app.js +131 -11
  64. package/dist/web/assets/client/i18n.js +18 -0
  65. package/dist/web/assets/client/taskSummary.js +7 -2
  66. package/dist/web/assets/client/taskSurface.js +54 -5
  67. package/dist/web/assets/client/view.js +7 -2
  68. package/dist/web/assets/shell.js +21 -11
  69. package/dist/web/assets/styles/layout.js +33 -6
  70. package/dist/web/assets/styles/responsive.js +18 -5
  71. package/dist/web/assets/styles/tokens.js +1 -1
  72. package/dist/web/assets/styles/widgets.js +5 -0
  73. package/docs/managed-turn-and-session-runtime.md +7 -0
  74. package/docs/managed-turn-and-session-runtime.zh-CN.md +5 -0
  75. package/docs/provider-runtime.md +7 -0
  76. package/docs/provider-runtime.zh-CN.md +5 -0
  77. package/docs/release-workflow.md +7 -1
  78. package/docs/task-delivery.md +5 -4
  79. package/docs/testing/verification-levels.md +9 -7
  80. package/i18n/README.zh-CN.md +19 -6
  81. package/package.json +5 -6
  82. package/skills/yui-leader/SKILL.md +8 -0
  83. package/skills/yui-leader/references/execution.md +4 -1
  84. package/skills/yui-operator/SKILL.md +35 -15
@@ -8,6 +8,11 @@ Provider binding,再结算执行占用。Global 停止证据保存为仅记录
8
8
  不触发新的原生输入。待投递通知不能重启已明确停止的 Session;普通 Host 脱离仍
9
9
  保留 active Session,可正常重连。部分切换失败后,仍须先结算旧输入再选择新会话。
10
10
 
11
+ 新建 global Operator 对话会按 Yui 当前配置时区请求原生标题
12
+ `Yui · Operator · MMdd`。只有 Provider 返回新对话的确切身份后才执行该请求;
13
+ 恢复与重连路径不会重放。若 Provider 不支持创建后改名,已创建的 Session 仍保持
14
+ 可用,并留下诊断,而不会把元数据失败冒充为 Session 创建失败。
15
+
11
16
  ## 权威
12
17
 
13
18
  Task、WorkItem、Message、Decision、Artifact 和 Project Knowledge 保存持久工作。
@@ -143,6 +143,13 @@ Failure to drain remains a live ownership dependency, not false quiescence.
143
143
  This is OS process custody, not a Task workflow or a claim about unrelated
144
144
  external services.
145
145
 
146
+ macOS has no child subreaper. The owner stops descendants it can still prove
147
+ through ancestry or the original process group. If the Claude root forks,
148
+ `setsid` and reparenting can hide a child from both checks; the owner therefore
149
+ reports cleanup as unconfirmed instead of returning a successful exit. This
150
+ also covers ordinary forked tools whose exit cannot be proven after the root
151
+ is gone. A detached child may still need explicit inspection and termination.
152
+
146
153
  The dedicated process's PID/start identity is retained as engineering control
147
154
  data independently of AgentHost. Recovery never needs the old Host's in-memory
148
155
  connection. For Codex, a separate metadata/control client can inspect and stop
@@ -117,6 +117,11 @@ Task Session 终止首先取消其确切的未结算输入,并在向 Host 发
117
117
  一个活的所有权依赖,而不是虚假静止。这是 OS 进程托管,不是 Task 工作流,也不是关于
118
118
  无关外部服务的断言。
119
119
 
120
+ macOS 没有子进程 subreaper。owner 会停止仍能通过父子关系或原进程组确认的后代。
121
+ 若 Claude 根进程曾 fork,子进程再执行 `setsid` 并被重新托管,就可能避开这两种检查;
122
+ 此时 owner 会报告清理未确认,而不会返回成功;普通工具进程曾 fork、但根进程退出后
123
+ 无法证明它们都已结束时,也适用这一保守结果。脱离的子进程可能仍需单独检查和终止。
124
+
120
125
  专用进程的 PID/start 身份作为工程控制数据独立于 AgentHost 保留。恢复从不需要旧 Host
121
126
  的内存连接。对 Codex,一个单独的元数据/控制客户端可以在不提交另一个 prompt 的情况下
122
127
  检查并停止已记录的原生执行;未知接受可以在实际原生静止之后被放弃,而不编造原生 Turn
@@ -45,10 +45,16 @@ protection and valid exact-identity caches remain normal runtime behavior.
45
45
 
46
46
  Stable releases use npm `latest`; prereleases use `next`, never the stable
47
47
  default. The release workflow builds one runtime archive, verifies it across
48
- supported Node versions, publishes that exact archive to npm, then creates the
48
+ supported Node versions on Linux x64, macOS x64 and macOS arm64, publishes that exact archive to npm, then creates the
49
49
  matching GitHub Release. Every release carries the runtime archive, checksum and
50
50
  provenance. A stable tag becomes GitHub latest; a prerelease does not.
51
51
 
52
+ Platform jobs compile Yui's native helpers from the same source commit.
53
+ The archive includes every supported helper under `dist/runtime/native/`;
54
+ runtime selection uses the exact OS and architecture, without install scripts
55
+ or downloading executable code on first use. Dependencies such as SQLite
56
+ remain ordinary npm dependencies installed for the consumer's platform.
57
+
52
58
  The GitHub Release job uploads only missing assets to a draft, downloads and
53
59
  compares every asset against the tested artifact, and never overwrites a
54
60
  published asset. A retry accepts only byte-identical existing evidence. If npm
@@ -35,9 +35,10 @@ isolation and acceptance checks remain enforced independently.
35
35
 
36
36
  Stable Project checkouts are read-only references. Task main is a logical
37
37
  multi-Project root with independent per-Project Git clones; WorkItem, Review and
38
- Integration worktrees belong to those Task repositories. For one Project, the Agent's
39
- normal cwd is its managed Git root; for multiple Projects, the root and native
40
- additional-directory mechanism expose the explicit Project set.
38
+ Integration worktrees belong to those Task repositories. By default, a Task's native cwd is
39
+ its managed root with zero, one, or multiple Projects. The native
40
+ additional-directory mechanism exposes each bound Project. Binding another
41
+ Project while the Task is active does not move the Task cwd.
41
42
 
42
43
  An isolated WorkItem has independent worktrees for writable Projects and
43
44
  Task-main context for the others. Write scope is explicit and can only be
@@ -367,7 +368,7 @@ This adds neither a retry worker nor another persistent ownership protocol.
367
368
  Current Resource records are read strictly: required safety fields, enum values,
368
369
  and every active reference must be valid. A malformed record or mismatched
369
370
  SQLite/payload identity is reported without supplying defaults, dropping refs,
370
- or rewriting stored evidence. This enforces the current storage 1.0 record contract.
371
+ or rewriting stored evidence. This enforces the current storage 1.1 record contract.
371
372
 
372
373
  Failed preparation compensates only its unadopted resources. Standalone Task
373
374
  clones use exact clone identity/cleanliness checks before direct deletion;
@@ -50,13 +50,12 @@ is required.
50
50
  ## Permanent core smoke
51
51
 
52
52
  `npm test` and `npm run test:core` build the checkout and run the maintained suite.
53
- The stable suite owns only current storage 1.0 and future declared minor
54
- transitions. It contains no historical conversion implementation, fixture or
55
- compatibility test.
53
+ The stable suite owns current storage 1.1 and its declared 1.0 minor
54
+ transition. It contains no undeclared historical format compatibility path.
56
55
 
57
56
  Current coverage includes:
58
57
 
59
- 1. Fresh storage 1.0, exact schema/record validation, no initialization over
58
+ 1. Fresh storage 1.1, exact schema/record validation, no initialization over
60
59
  unknown data, and rejection of old integer formats without mutation.
61
60
  2. Exact-version staging, mismatched-target refusal, same-major contiguous
62
61
  minor preflight, explicit maintenance-owner identity across handover, and
@@ -99,8 +98,9 @@ do not add prose-matching tests or claim model validation from static checks.
99
98
 
100
99
  ## CI and release
101
100
 
102
- `ci.yml` builds once and runs core plus one assembled-package normal-path smoke
103
- on every PR, without another lint or broad regression suite.
101
+ `ci.yml` runs core plus one assembled-package normal-path smoke per supported
102
+ platform (Linux x64, Mac Intel and Apple Silicon) on every PR, without another
103
+ lint or broad regression suite.
104
104
  `node scripts/smoke-runtime-package.mjs --assembled .release-stage` exercises
105
105
  the actual CLI/Controller/Host/SQLite and isolated tmux, replacing only the
106
106
  external Provider with a deterministic fixture. It covers setup, durable input
@@ -111,7 +111,9 @@ and grouped viewers without affecting a similarly named neighboring session.
111
111
  The fixture owns a fresh Home and its PATH, installs cleanup before setup,
112
112
  and never calls an installed model Agent.
113
113
 
114
- `publish.yml` runs the same smoke against the freshly installed package through
114
+ `publish.yml` builds one archive containing all three native targets and runs
115
+ the same smoke on each platform and supported Node version against that exact
116
+ freshly installed package through
115
117
  `YUI_INSTALLED_ROOT`, adding actual npm-bin, dependency, supported Node version,
116
118
  artifact and provenance boundaries. This validates runtime integration, not
117
119
  real-model behavior. Pure contract and safety tests remain in `test/core`;
@@ -5,7 +5,7 @@
5
5
  [![Core CI](https://github.com/zhangqian-silk/yui/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/zhangqian-silk/yui/actions/workflows/ci.yml)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](../LICENSE)
7
7
  ![Node](https://img.shields.io/badge/node-20%20%7C%2022%20%7C%2024-brightgreen.svg)
8
- ![Platform](https://img.shields.io/badge/platform-Linux%20x64%20%28glibc%29-blue.svg)
8
+ ![Platform](https://img.shields.io/badge/platform-Linux%20x64%20%28glibc%29%20%7C%20macOS%20x64%2Farm64-blue.svg)
9
9
  [![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](#参与开发)
10
10
 
11
11
  让 Agent 持续推进你的任务,而不只是回答一轮对话。
@@ -30,16 +30,21 @@ Yui 是面向编程 Agent 的本地控制面。你只需用自然语言把目标
30
30
  Web 仅本地回环,包含只读视图和经认证的用户控制。
31
31
  - **默认隔离** —— 仓库改动发生在受管 Git worktree 中,稳定 checkout 保持只读。
32
32
 
33
- > **状态:** 1.0.0,采用纯净的存储 1.0 基线。默认更新只执行同一存储
33
+ > **状态:** 1.1.0,当前存储版本为 1.1,已声明从 1.0 基线升级。默认更新只执行同一存储
34
34
  > 主版本内已声明的小版本升级;其他存储身份会在不修改 Home 的前提下被拒绝。
35
35
 
36
36
  [快速开始](#快速开始) · [通过对话管理工作](#通过对话管理工作) · [架构](#架构) · [设计原则](#设计原则)
37
37
 
38
38
  ## 快速开始
39
39
 
40
- 需要 Linux x64 / glibc、Git、tmux,以及 Node.js `^20.17.0`、`^22.9.0` 或
41
- `^24.0.0`。最简单的方式是先安装 Codex CLI 或 Claude Code CLI,并确保它
42
- 已经可以使用你自己的账号正常工作。Yui 负责协调 Agent,不提供模型访问额度。
40
+ npm 包包含 Linux x64、Mac Intel 和 Apple Silicon 的 Yui 预编译程序。
41
+ 同一份包在三个平台验证后发布,运行时只选择对应平台的程序。
42
+
43
+ 需要 Linux x64 / glibc 或 macOS(x64 或 Apple Silicon)、Git、tmux,以及
44
+ Node.js `^20.17.0`、`^22.9.0` 或 `^24.0.0`。macOS 上可用
45
+ `brew install tmux` 安装 tmux。最简单的方式是先安装 Codex CLI 或 Claude
46
+ Code CLI,并确保它已经可以使用你自己的账号正常工作。Yui 负责协调 Agent,
47
+ 不提供模型访问额度。
43
48
 
44
49
  Yui 传递 Claude 的认证环境并保留原生配置目录,由 Claude 自身按本地配置
45
50
  选择 API key 或登录方式。更换 Session 不会重置登录或初始化记录。首次运行时,
@@ -64,10 +69,18 @@ yui setup
64
69
  > 我已经安装了 Yui。请在交互式终端中帮我执行 `yui setup`,选择可用的
65
70
  > Agent,并用 `yui doctor` 检查结果。遇到账号或需要我决定的配置时问我。
66
71
 
67
- Setup 会配置与你对话的 Operator 和默认任务 Leader,并启动本地 Controller。
72
+ Setup 会配置与你对话的 Operator 和默认任务 Leader,并启动本地 Controller,
73
+ 以及这些活跃 Role 需要的 Codex 共享 daemon。
68
74
  先用这两个角色即可开始,Worker、Reviewer 可以之后再配置。如果 Agent
69
75
  没有操作交互式终端的能力,就自己运行 setup;它只负责初始配置。
70
76
 
77
+ 之后启动时运行 `yui start`。它会按需启动 Controller;只有活跃 Role 使用
78
+ Codex 时才会启动 Codex 共享 daemon。在 macOS 上,如果安装了 Codex App,
79
+ 它还会配置 App 下次启动时连接该 daemon。先运行 `yui start` 再打开 App;
80
+ 如果 App 已经打开,按 Yui 的提示退出并重新打开。`yui doctor` 可以检查
81
+ 实时连接。`yui controller start` 只启动 Controller。Linux 不需要 App 配置;
82
+ 没有活跃 Codex Role 时不会启动 Codex daemon。
83
+
71
84
  ### 3. 开始对话
72
85
 
73
86
  ```sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zq-silk/yui",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Local control plane for long-running native agent CLI sessions backed by tmux.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -22,13 +22,12 @@
22
22
  "node": "^20.17.0 || ^22.9.0 || ^24.0.0"
23
23
  },
24
24
  "os": [
25
- "linux"
25
+ "linux",
26
+ "darwin"
26
27
  ],
27
28
  "cpu": [
28
- "x64"
29
- ],
30
- "libc": [
31
- "glibc"
29
+ "x64",
30
+ "arm64"
32
31
  ],
33
32
  "keywords": [
34
33
  "yui",
@@ -69,6 +69,14 @@ The DB Brief is the current summary, not a full plan or a history of messages.
69
69
  After meaningful progress, use `task brief update` with only intended fields;
70
70
  read `task event list` before deliberately restoring an older value. Keep
71
71
  references to substantial plans, prototypes and reports in that summary.
72
+ When a delivered correction resolves a recorded blocker or changes the next
73
+ action, update the Brief's focus and Leader summary while the Task is still
74
+ open. Before completing a Task, reread its Brief: if it still describes a
75
+ resolved blocker, superseded plan, or waiting state, correct those fields
76
+ before `task complete`. The completion summary is the terminal conclusion;
77
+ do not copy it into Brief merely to create a second completion record. Brief
78
+ maintenance is not a new completion gate, and routine unchanged steps do not
79
+ need an update.
72
80
  Decisions contain the actual decision, reason and necessary boundaries, not
73
81
  the entire proposal. Label recommendations as recommendations, not user
74
82
  decisions.
@@ -409,7 +409,10 @@ Before ending authorized execution:
409
409
  with `yui task run show`, read each original result in full, and make the
410
410
  next decision.
411
411
  2. Persist actual WorkItem lifecycle and material Brief, Decision, Milestone,
412
- Message, or Knowledge changes.
412
+ Message, or Knowledge changes. If an accepted result or authorized
413
+ correction has cleared a blocker still stated as current in Brief, update
414
+ that working summary before completing or yielding. Keep the original
415
+ failure and correction in their durable records.
413
416
  3. Choose one truthful outcome: continue through an owned native child, complete
414
417
  the Task, create a justified InputRequest, or leave the active Task waiting
415
418
  for a real durable event.
@@ -74,13 +74,30 @@ determine Task identity. They also do not determine WorkItem count. Let
74
74
  isolated workspaces and Integration handle independent Git changes.
75
75
 
76
76
  Keep the Task title concise and put detailed intent, constraints, and evidence
77
- in its description or routed Message. The examples below are separate
78
- operations, not an automatic create/submit/activate sequence. For creation-only
79
- intent, save the Task without starting planning. Discussion does not authorize
80
- delivery; follow the Leader's [planning and activation boundary](../yui-leader/references/planning.md)
81
- before activation. Queries, record-only input and discussion do not authorize
82
- reopening. An explicit request to continue the same completed result can authorize
83
- the necessary reopening; follow the delivery guidance below.
77
+ in its description or routed Message.
78
+
79
+ Treat Task creation and Task submission as separate user-authorized actions.
80
+ When the user asks only to add, create, register, or record a Task, create the
81
+ Draft and write all known requirements into its metadata, then stop. Do not
82
+ submit a `discuss` or `develop` Message, request activation, start a Leader
83
+ Session, or create execution resources. A detailed or immediately actionable
84
+ requirement, or the user's desire for its eventual completion, is not permission
85
+ to start it. Report that the Task is a Draft and has not started, and explain
86
+ that the user can explicitly ask to discuss/plan it or to develop/implement it.
87
+
88
+ Start the corresponding route only when the user's current request contains
89
+ that additional intent: discussion or planning authorizes `discuss`;
90
+ development, implementation, fixing, continuing execution, or immediate
91
+ progress authorizes `develop` or the applicable lifecycle continuation. Do not
92
+ weaken explicit intent merely because the request also says “create a Task.”
93
+ The examples below are separate operations, never an automatic
94
+ create/submit/activate sequence.
95
+
96
+ Discussion does not authorize delivery; follow the Leader's
97
+ [planning and activation boundary](../yui-leader/references/planning.md) before
98
+ activation. Queries, record-only input and discussion do not authorize
99
+ reopening. An explicit request to continue the same completed result can
100
+ authorize the necessary reopening; follow the delivery guidance below.
84
101
 
85
102
  ```sh
86
103
  yui operator submit "<related request and delta>" --task <task-id> --intent discuss
@@ -94,14 +111,17 @@ Inspect an existing request before creating another. `task activate <task-id>`
94
111
  can adopt an eligible request in the foreground; it never activates a Draft
95
112
  without a recorded request and environment plan.
96
113
 
97
- Choose the submission intent explicitly; it is never inferred from the message
98
- text. `discuss` (the default) routes the Draft to
99
- planning; `record` saves the message without waking the Leader; `develop` asks an
100
- unplanned Draft to activate now, and reports the exact next step when it cannot
101
- (already planned → request activation explicitly; execution stopped → start it first). Pass
102
- `--request-id <key>` to make a submission idempotent: retrying the same key
103
- returns the original message and routing instead of creating a duplicate, and the
104
- same key with different text is refused as a conflict.
114
+ After the user has authorized a submission, choose its intent explicitly; it is
115
+ never inferred by the CLI from the message text. `discuss` (the CLI default when
116
+ `operator submit` is already being invoked) routes the Draft to planning;
117
+ `record` saves the message without waking the Leader; `develop` asks an unplanned
118
+ Draft to activate now, and reports the exact next step when it cannot (already
119
+ planned → request activation explicitly; execution stopped → start it first).
120
+ The CLI default is not permission for the Operator to invoke submission after a
121
+ creation-only request. Pass `--request-id <key>` to make a submission idempotent:
122
+ retrying the same key returns the original message and routing instead of
123
+ creating a duplicate, and the same key with different text is refused as a
124
+ conflict.
105
125
 
106
126
  Resolve all known Projects before repository-backed execution. A stable Project
107
127
  checkout is read-only reference state, not the Task base authority. Yui records