@zq-silk/yui 1.0.1 → 1.1.2

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 (83) 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 +16 -25
  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 +232 -12
  23. package/dist/doctor/ptyProbe.js +74 -0
  24. package/dist/doctor/ptyProbeChild.js +90 -0
  25. package/dist/execution/workItemMainRun.js +1 -1
  26. package/dist/executor/agentAdapter.js +0 -8
  27. package/dist/executor/agentExecutor.js +4 -1
  28. package/dist/executor/fileRoleLaunchPlanner.js +3 -22
  29. package/dist/message/messageContinuation.js +1 -1
  30. package/dist/release/releaseHandover.js +77 -25
  31. package/dist/release/runtimeRelease.js +7 -7
  32. package/dist/repository/gitWorkspace.js +9 -8
  33. package/dist/repository/taskWorkspacePreparer.js +15 -57
  34. package/dist/resources/liveReferences.js +64 -7
  35. package/dist/runtime/agentEndpointIdentity.js +4 -1
  36. package/dist/runtime/agentHost.js +8 -9
  37. package/dist/runtime/codexInteractiveHost.js +1 -1
  38. package/dist/runtime/codexSharedDaemon.js +211 -0
  39. package/dist/runtime/index.js +1 -1
  40. package/dist/runtime/jsonLineChannel.js +6 -1
  41. package/dist/runtime/localStartup.js +65 -0
  42. package/dist/runtime/native/darwin-arm64/claude-process-owner +0 -0
  43. package/dist/runtime/native/darwin-arm64/process-identity +0 -0
  44. package/dist/runtime/native/darwin-x64/claude-process-owner +0 -0
  45. package/dist/runtime/native/darwin-x64/process-identity +0 -0
  46. package/dist/runtime/{claude-process-owner → native/linux-x64/claude-process-owner} +0 -0
  47. package/dist/runtime/nativeExecutable.js +10 -0
  48. package/dist/runtime/runtimeCoherence.js +10 -3
  49. package/dist/runtime/sessionOwnerIdentity.js +19 -0
  50. package/dist/runtime/sessionTerminationGuard.js +10 -3
  51. package/dist/runtime/structuredProviderHost.js +51 -26
  52. package/dist/scheduler/activeRoleRunDelivery.js +2 -11
  53. package/dist/scheduler/leaderWakeupProcessor.js +1 -2
  54. package/dist/scheduler/ports.js +1 -8
  55. package/dist/scheduler/taskExecutionProjection.js +1 -6
  56. package/dist/storage/sqliteSchema.js +15 -3
  57. package/dist/storage/storageVersions.js +1 -1
  58. package/dist/storage/taskCatalog.js +10 -2
  59. package/dist/storage/upgrade/taskMainWorkspaceMigration.js +83 -0
  60. package/dist/storage/upgrade/upgradeOrchestrator.js +25 -6
  61. package/dist/task/task.js +0 -12
  62. package/dist/tmux/tmuxManager.js +8 -2
  63. package/dist/tmux/tmuxSocketEndpoint.js +23 -1
  64. package/dist/web/assets/client/app.js +131 -11
  65. package/dist/web/assets/client/i18n.js +18 -0
  66. package/dist/web/assets/client/taskSummary.js +7 -2
  67. package/dist/web/assets/client/taskSurface.js +54 -5
  68. package/dist/web/assets/client/view.js +7 -2
  69. package/dist/web/assets/shell.js +21 -11
  70. package/dist/web/assets/styles/layout.js +33 -6
  71. package/dist/web/assets/styles/responsive.js +18 -5
  72. package/dist/web/assets/styles/tokens.js +1 -1
  73. package/dist/web/assets/styles/widgets.js +5 -0
  74. package/docs/provider-runtime.md +7 -0
  75. package/docs/provider-runtime.zh-CN.md +5 -0
  76. package/docs/release-workflow.md +7 -1
  77. package/docs/task-delivery.md +5 -4
  78. package/docs/testing/verification-levels.md +19 -7
  79. package/docs/testing/verification-levels.zh-CN.md +8 -0
  80. package/i18n/README.zh-CN.md +19 -6
  81. package/package.json +7 -8
  82. package/skills/yui-leader/SKILL.md +8 -0
  83. package/skills/yui-leader/references/execution.md +4 -1
@@ -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,11 @@ 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
+ Linux runs on Node 24 and 26; release fresh-install smoke covers Node 20, 22,
105
+ 24 and 26 on all three platforms.
104
106
  `node scripts/smoke-runtime-package.mjs --assembled .release-stage` exercises
105
107
  the actual CLI/Controller/Host/SQLite and isolated tmux, replacing only the
106
108
  external Provider with a deterministic fixture. It covers setup, durable input
@@ -111,11 +113,21 @@ and grouped viewers without affecting a similarly named neighboring session.
111
113
  The fixture owns a fresh Home and its PATH, installs cleanup before setup,
112
114
  and never calls an installed model Agent.
113
115
 
114
- `publish.yml` runs the same smoke against the freshly installed package through
116
+ `publish.yml` builds one archive containing all three native targets and runs
117
+ the same smoke on each platform and supported Node version against that exact
118
+ freshly installed package through
115
119
  `YUI_INSTALLED_ROOT`, adding actual npm-bin, dependency, supported Node version,
116
120
  artifact and provenance boundaries. This validates runtime integration, not
117
121
  real-model behavior. Pure contract and safety tests remain in `test/core`;
118
122
  production wiring is exercised here rather than only through mocked ports.
123
+ The native dependency check launches a fixed local program through PTY and
124
+ requires its output and normal exit. Installed-package smoke explicitly checks
125
+ default Doctor's PTY results using dependencies resolved from the consumer.
126
+ On macOS it also tests a disposable copy with a non-executable spawn-helper:
127
+ Doctor must report the selected helper path and permissions without repairing it.
128
+ Doctor's isolated PTY probe waits up to 750 ms for output/exit, with a 1.5-second
129
+ outer native-process limit, and reports elapsed time. Existing Agent/Controller
130
+ diagnostics have their own costs; this is not a one-second whole-Doctor guarantee.
119
131
  The package smoke also checks unconditional status identity and update-owned
120
132
  resource/identity capture through the assembled package. Real lifecycle children
121
133
  stop the exact Controller and restore its captured launch identity while their
@@ -74,6 +74,8 @@ package-start 检查跟随已安装树中的本地 Skill 引用,包括跨 Role
74
74
 
75
75
  `ci.yml` 在每个 PR 上构建一次,运行 core 及一个组装包正常链路检查,不重复 lint,
76
76
  也不增加宽泛回归套件。
77
+ Linux CI 在 Node 24 和 26 上运行;发布时的全新安装 smoke 覆盖三个平台上的
78
+ Node 20、22、24 和 26。
77
79
  `node scripts/smoke-runtime-package.mjs --assembled .release-stage` 经过真实
78
80
  CLI/Controller/Host/SQLite 与隔离 tmux,仅用确定性夹具替换外部 Provider。它验证
79
81
  setup、输入跨重启持久化及幂等、scratch 激活、原生结果入库、完成后保留会话、
@@ -85,6 +87,12 @@ setup、输入跨重启持久化及幂等、scratch 激活、原生结果入库
85
87
  npm bin、依赖、受支持 Node 版本、产物和 provenance 边界。这证明运行时集成,不证明
86
88
  真实模型行为。纯契约与安全检查保留在 `test/core`,生产组件组装在这里验证,
87
89
  不只依赖模拟端口。
90
+ 原生依赖检查必须通过 PTY 启动固定本地程序,确认输出和正常退出。安装包 smoke
91
+ 明确断言默认 Doctor 的 PTY 检查成功,并从消费者安装目录解析依赖。macOS 还会
92
+ 在可丢弃的依赖副本中移除 spawn-helper 执行权限,验证 Doctor 报出实际 helper
93
+ 路径和权限原因且不自动修复。Doctor 的隔离 PTY 探针等待输出/退出最多 750 ms,
94
+ 外层原生进程限制为 1.5 秒,并报告耗时;原有 Agent/Controller 检查另有成本,
95
+ 这不是整个 Doctor 一秒内返回的保证。
88
96
  组装包检查还验证固定身份输出,以及升级侧通过组装包采集资源和精确 Controller 身份,
89
97
  并在父进程持有交接锁时,通过真实生命周期子进程停止精确 Controller、恢复其已捕获的
90
98
  启动身份。无关调用仍被锁阻止,锁保持由父进程持有,持久输入不变;
@@ -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` 或 `^26.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.1",
3
+ "version": "1.1.2",
4
4
  "description": "Local control plane for long-running native agent CLI sessions backed by tmux.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -19,16 +19,15 @@
19
19
  "LICENSE"
20
20
  ],
21
21
  "engines": {
22
- "node": "^20.17.0 || ^22.9.0 || ^24.0.0"
22
+ "node": "^20.17.0 || ^22.9.0 || ^24.0.0 || ^26.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",
@@ -50,7 +49,7 @@
50
49
  "@xterm/addon-fit": "^0.11.0",
51
50
  "@xterm/xterm": "^6.0.0",
52
51
  "better-sqlite3": "^12.11.1",
53
- "node-pty": "^1.1.0",
52
+ "node-pty": "1.2.0-beta.15",
54
53
  "smol-toml": "1.8.0",
55
54
  "ws": "^8.21.1"
56
55
  }
@@ -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.