@zonease/aiworker-cli 0.12.2 → 0.13.1

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 (117) hide show
  1. package/README.md +158 -350
  2. package/aiworker-bun.js +614 -694
  3. package/drizzle/worker/0000_polite_stellaris.sql +219 -0
  4. package/drizzle/worker/0001_red_lady_mastermind.sql +29 -0
  5. package/drizzle/worker/0002_concerned_slyde.sql +45 -0
  6. package/drizzle/worker/meta/0000_snapshot.json +1055 -194
  7. package/drizzle/worker/meta/0001_snapshot.json +1244 -222
  8. package/drizzle/worker/meta/0002_snapshot.json +1557 -273
  9. package/drizzle/worker/meta/_journal.json +6 -48
  10. package/official-apps/aiworker-hr/README.md +16 -0
  11. package/official-apps/aiworker-hr/capabilities/candidate-screen/prompt.md +3 -0
  12. package/official-apps/aiworker-hr/capabilities/candidate-screen/review.md +5 -0
  13. package/official-apps/aiworker-hr/capabilities/person-profile/prompt.md +3 -0
  14. package/official-apps/aiworker-hr/capabilities/person-profile/review.md +5 -0
  15. package/official-apps/aiworker-hr/dist/host-mounted.js +15677 -0
  16. package/official-apps/aiworker-hr/dist/index.js +15411 -0
  17. package/official-apps/aiworker-hr/dist/standalone.js +15451 -0
  18. package/official-apps/aiworker-hr/migrations/0001_hr.sql +2 -0
  19. package/official-apps/aiworker-hr/package.json +31 -0
  20. package/official-apps/aiworker-hr/packs/hr-recruiting/SOUL.md +7 -0
  21. package/official-apps/aiworker-hr/review/candidate-screen.md +5 -0
  22. package/official-apps/aiworker-hr/review/person-profile.md +5 -0
  23. package/official-apps/aiworker-hr/schemas/candidate-screen.schema.json +50 -0
  24. package/official-apps/aiworker-hr/schemas/person-profile.schema.json +50 -0
  25. package/official-apps/aiworker-hr/soul-app.manifest.json +374 -0
  26. package/official-apps/aiworker-hr/src/api.ts +1 -0
  27. package/official-apps/aiworker-hr/src/host-mounted.ts +308 -0
  28. package/official-apps/aiworker-hr/src/index.ts +152 -0
  29. package/official-apps/aiworker-hr/src/protocol/artifact.ts +2 -0
  30. package/official-apps/aiworker-hr/src/protocol/connectors.ts +2 -0
  31. package/official-apps/aiworker-hr/src/protocol/lifecycle.ts +2 -0
  32. package/official-apps/aiworker-hr/src/protocol/review.ts +2 -0
  33. package/official-apps/aiworker-hr/src/protocol/runtime.ts +2 -0
  34. package/official-apps/aiworker-hr/src/protocol/ui.ts +2 -0
  35. package/official-apps/aiworker-hr/src/standalone.ts +43 -0
  36. package/official-apps/aiworker-hr/src/ui/candidate-screen-preview.tsx +2 -0
  37. package/official-apps/aiworker-hr/src/ui/hr-route.tsx +1 -0
  38. package/official-apps/aiworker-hr/src/ui/people-widget.tsx +1 -0
  39. package/official-apps/aiworker-hr/src/ui/person-profile-preview.tsx +2 -0
  40. package/official-apps/aiworker-hr/src/ui/profile-panel.tsx +1 -0
  41. package/official-apps/aiworker-hr/src/ui/review-panel.tsx +1 -0
  42. package/official-apps/aiworker-hr/tsconfig.json +20 -0
  43. package/official-apps/aiworker-qa/README.md +14 -0
  44. package/official-apps/aiworker-qa/capabilities/regression-matrix/prompt.md +3 -0
  45. package/official-apps/aiworker-qa/capabilities/regression-matrix/review.md +5 -0
  46. package/official-apps/aiworker-qa/capabilities/release-gate/prompt.md +3 -0
  47. package/official-apps/aiworker-qa/capabilities/release-gate/review.md +5 -0
  48. package/official-apps/aiworker-qa/dist/host-mounted.js +15655 -0
  49. package/official-apps/aiworker-qa/dist/index.js +15395 -0
  50. package/official-apps/aiworker-qa/dist/standalone.js +15435 -0
  51. package/official-apps/aiworker-qa/migrations/0001_qa.sql +2 -0
  52. package/official-apps/aiworker-qa/package.json +31 -0
  53. package/official-apps/aiworker-qa/packs/qa-reviewer/SOUL.md +7 -0
  54. package/official-apps/aiworker-qa/review/regression-matrix.md +5 -0
  55. package/official-apps/aiworker-qa/review/release-gate.md +5 -0
  56. package/official-apps/aiworker-qa/schemas/regression-matrix.schema.json +50 -0
  57. package/official-apps/aiworker-qa/schemas/release-gate.schema.json +50 -0
  58. package/official-apps/aiworker-qa/soul-app.manifest.json +356 -0
  59. package/official-apps/aiworker-qa/src/api.ts +1 -0
  60. package/official-apps/aiworker-qa/src/host-mounted.ts +302 -0
  61. package/official-apps/aiworker-qa/src/index.ts +152 -0
  62. package/official-apps/aiworker-qa/src/protocol/artifact.ts +2 -0
  63. package/official-apps/aiworker-qa/src/protocol/connectors.ts +2 -0
  64. package/official-apps/aiworker-qa/src/protocol/lifecycle.ts +2 -0
  65. package/official-apps/aiworker-qa/src/protocol/review.ts +2 -0
  66. package/official-apps/aiworker-qa/src/protocol/runtime.ts +2 -0
  67. package/official-apps/aiworker-qa/src/protocol/ui.ts +2 -0
  68. package/official-apps/aiworker-qa/src/standalone.ts +43 -0
  69. package/official-apps/aiworker-qa/src/ui/qa-route.tsx +1 -0
  70. package/official-apps/aiworker-qa/src/ui/regression-matrix-preview.tsx +2 -0
  71. package/official-apps/aiworker-qa/src/ui/release-gate-preview.tsx +2 -0
  72. package/official-apps/aiworker-qa/src/ui/release-panel.tsx +1 -0
  73. package/official-apps/aiworker-qa/src/ui/release-review-panel.tsx +1 -0
  74. package/official-apps/aiworker-qa/src/ui/release-widget.tsx +1 -0
  75. package/official-apps/aiworker-qa/src/ui/review-panel.tsx +1 -0
  76. package/official-apps/aiworker-qa/tsconfig.json +20 -0
  77. package/package.json +5 -4
  78. package/web/worker/assets/index-K-y56wrL.css +2 -0
  79. package/web/worker/assets/index-YNnnk64n.js +18 -0
  80. package/web/worker/assets/markdown-preview-DFe-rfff.js +29 -0
  81. package/web/worker/assets/people-workbench-BzWwSc2I.js +1 -0
  82. package/web/worker/engine-icons/claude.svg +1 -0
  83. package/web/worker/engine-icons/cursor.svg +1 -0
  84. package/web/worker/engine-icons/gemini.svg +1 -0
  85. package/web/worker/engine-icons/hermesagent.svg +1 -0
  86. package/web/worker/engine-icons/openai.svg +1 -0
  87. package/web/worker/engine-icons/opencode.svg +1 -0
  88. package/web/worker/engine-icons/qwen.svg +1 -0
  89. package/web/worker/fonts/inter-latin-wght-normal.woff2 +0 -0
  90. package/web/worker/fonts/jetbrains-mono-latin-wght-normal.woff2 +0 -0
  91. package/web/worker/fonts/nunito-latin-wght-normal.woff2 +0 -0
  92. package/web/worker/index.html +8 -4
  93. package/web/worker/logo.svg +8 -0
  94. package/drizzle/fleet/0000_fine_havok.sql +0 -23
  95. package/drizzle/fleet/meta/0000_snapshot.json +0 -165
  96. package/drizzle/fleet/meta/_journal.json +0 -13
  97. package/drizzle/worker/0000_spooky_kat_farrell.sql +0 -112
  98. package/drizzle/worker/0001_secret_dagger.sql +0 -1
  99. package/drizzle/worker/0002_jazzy_moondragon.sql +0 -13
  100. package/drizzle/worker/0003_rare_cloak.sql +0 -7
  101. package/drizzle/worker/0004_daffy_thing.sql +0 -26
  102. package/drizzle/worker/0005_worthless_whiplash.sql +0 -20
  103. package/drizzle/worker/0006_fair_jetstream.sql +0 -34
  104. package/drizzle/worker/0007_solid_bromley.sql +0 -11
  105. package/drizzle/worker/0008_peaceful_titanium_man.sql +0 -14
  106. package/drizzle/worker/meta/0003_snapshot.json +0 -873
  107. package/drizzle/worker/meta/0004_snapshot.json +0 -1058
  108. package/drizzle/worker/meta/0005_snapshot.json +0 -1192
  109. package/drizzle/worker/meta/0006_snapshot.json +0 -1420
  110. package/drizzle/worker/meta/0007_snapshot.json +0 -1489
  111. package/drizzle/worker/meta/0008_snapshot.json +0 -1593
  112. package/web/fleet/assets/index-BTknRPEg.js +0 -1372
  113. package/web/fleet/assets/index-lu-9OhC0.css +0 -2
  114. package/web/fleet/favicon.svg +0 -4
  115. package/web/fleet/index.html +0 -14
  116. package/web/worker/assets/index-DuxsPbd7.js +0 -1382
  117. package/web/worker/assets/index-lu-9OhC0.css +0 -2
package/README.md CHANGED
@@ -1,411 +1,219 @@
1
1
  # AIWorker
2
2
 
3
- **English** · [简体中文](./README.zh-CN.md)
4
-
5
- Self-hosted, lightweight **Project Brain + Worker/Fleet aggregation runtime**.
6
-
7
- - **Worker** owns the Project Brain (filesystem is the source of truth), worker.db, and conversations. External executors (Codex / Claude Code / Hermes / OpenClaw / Cursor, etc.) are invoked through a thin adapter only.
8
- - **Gateway is an optional control plane**: a single worker runs without one. With multiple workers, the gateway aggregates presence, routing, and audit — it never holds brain or conversation data.
9
-
10
- ## Why AIWorker exists
11
-
12
- AIWorker is not trying to be a smarter coding assistant or a new executor
13
- platform. If all you need is a better one-off chat or coding agent, use Codex,
14
- Claude Code, Cursor, Hermes, OpenClaw, or another executor directly.
15
-
16
- Use AIWorker when you already trust external executors, but need to run them as
17
- durable, governed workers bound to a real business scope:
18
-
19
- - **Project Brain as an owned asset**: each worker has a filesystem-first,
20
- reviewable, portable brain for scope identity, persona, policy, memories,
21
- rollups, and brain skills.
22
- - **Governed self-iteration**: an executor can propose durable brain changes,
23
- but memory and brain-skill writes must pass admission, approval,
24
- secret-scan, provenance, and audit.
25
- - **Bring your own executor**: AIWorker does not replace the executor's tool
26
- loop, MCP, plugins, sandbox, native sessions, auth, or model routing. It
27
- wraps them with scope context, persistence, observation, and governance.
28
- - **Worker/Fleet operations**: one worker can run alone; many workers can be
29
- aggregated by a gateway for presence, routing, logs, approvals, cron, and
30
- audit without copying brain, conversations, or secrets into fleet.db.
31
-
32
- In short: AIWorker turns existing AI agents into self-hosted, scope-bound,
33
- auditable business workers. The competitive edge is not "better model output";
34
- it is durable Project Brain plus governance and fleet operations around the
35
- executors customers already use.
36
-
37
- ## Who needs AIWorker
38
-
39
- AIWorker is a good fit when you want AI agents to behave less like disposable
40
- chat windows and more like managed workers tied to real work.
41
-
42
- - **Teams that already use AI executors** and want durable scope memory,
43
- policy, persona, and reviewable brain files around them.
44
- - **Operators running agents for business scopes**, such as a code repository,
45
- hiring pipeline, finance period, support queue, compliance folder, or
46
- operational runbook.
47
- - **Organizations that need governance before self-learning**, where memory or
48
- brain-skill changes can be proposed by an agent but must be reviewed,
49
- approved, and audited.
50
- - **People running more than one worker**, where presence, routing, logs,
51
- approvals, schedules, and enrollment need one control plane without moving
52
- private brain or conversation data into that control plane.
53
- - **Customers who need to keep their own data local**, while still using the
54
- executor, model, auth, and tool ecosystem they already trust.
55
-
56
- If you only need a one-off coding session, a single chat, or a better model
57
- answer, AIWorker is probably more infrastructure than you need.
58
-
59
- ## Topology
3
+ AIWorker 正在重构为面向 team/org 的 **local-first vertical Soul App host**。
60
4
 
61
- ```text
62
- Operator / Admin
63
- runs `aiworker fleet ...`
64
- |
65
- | WebSocket control traffic
66
- | basicauth + device token
67
- v
68
- +--------------------------------------------------------------------------------+
69
- | AIWorker Gateway (optional control plane) |
70
- | |
71
- | fleet.db stores: worker pointers, presence, enrollment state, audit events |
72
- | fleet.db does not store: Project Brain, conversations, worker secrets |
73
- +---------------------------+----------------------------+-----------------------+
74
- | |
75
- | WS relay / routing | WS relay / routing
76
- v v
77
- +----------------------+ +----------------------+
78
- | Worker A | | Worker B ... N |
79
- | owns its own data | | owns its own data |
80
- +----------------------+ +----------------------+
81
-
82
- A single worker can also run without the gateway:
83
-
84
- +--------------------------------------------------------------------------------+
85
- | One worker data plane |
86
- | |
87
- | Project Brain (filesystem) worker.db |
88
- | - SOUL / USER / MEMORY - identity and config |
89
- | - memories and governance - conversations and messages |
90
- | - managed native skill - encrypted local state |
91
- | projection manifest |
92
- | - native skill files in |
93
- | .agents / .claude |
94
- | - policy and capabilities |
95
- | - admission proposals |
96
- | |
97
- | AIWorker thin adapter |
98
- | - adds scope context and governance |
99
- | - observes run / stream / cancel / resume |
100
- | - does not replace the executor tool loop |
101
- | |
102
- | External executor |
103
- | - Codex / Claude Code / Hermes / OpenClaw / Cursor / ACP / MCP / HTTP |
104
- | - keeps its own MCP, skills, plugins, auth, sandbox, and native sessions |
105
- +--------------------------------------------------------------------------------+
106
- ```
107
-
108
- A single worker can run standalone — the gateway is needed only when you want to aggregate multiple workers. The control plane and the data plane are physically isolated: fleet.db never stores brain / conversations / secrets, and worker.db is never reverse-fetched by the gateway. Full architecture and dual-view diagrams: [`docs/architecture.md`](docs/architecture.md). Production-readiness notes and remaining boundaries: [`docs/governance-node-status.md`](docs/governance-node-status.md).
5
+ 它不做另一个 developer engine、admin dashboard 或通用 agent runtime。当前架构以 Host /
6
+ Soul App 双自治为中心:Host 提供本地 daemon、安装启用、鉴权安全、平台设置、能力 broker、
7
+ 统一 shell 与协议定位;Soul App 提供垂直领域产品逻辑、standalone 体验、Host mounted 体验、
8
+ 领域 UI/API,以及 artifact/profile/review/lesson 的领域语义。
109
9
 
110
- ---
111
-
112
- ## Install
113
-
114
- ```sh
115
- bun install -g @zonease/aiworker-cli
116
- # or `bunx @zonease/aiworker-cli --help` (when Bun is already installed)
117
- # or `npx` / `npm install -g` (Bun is still required at runtime)
10
+ ```text
11
+ Host -> install/enable Soul App -> Soul worker -> workspace -> session
12
+ -> Soul App exposed views/actions -> business artifact/profile/review/lesson
118
13
  ```
119
14
 
120
- The CLI is Bun-native. The first worker initialization mints a master key and writes it to the worker-local `.env` (project workers use `<project>/.aiworker/local/.env`; explicit/user homes use `<AIWORKER_HOME>/.env`). **The master key must be backed up offline at the org level** — if it is lost, worker.db / fleet.db cannot be decrypted and every worker must re-enroll.
15
+ 当前架构合同见 `docs/architecture.md`,其中 `Constraint Registry` Host / Soul App /
16
+ protocol / data / broker / documentation 的硬约束源头。旧北极星文档已经移除,避免开发入口
17
+ 被拆成多套叙事。
121
18
 
122
- Full install and per-platform binaries: [`docs/deployment.md`](docs/deployment.md).
19
+ ## 文档地图
123
20
 
124
- ---
21
+ - `docs/architecture.md`:当前架构合同。
22
+ - `docs/cli.md`:当前 CLI 命令参考。
23
+ - `docs/deployment.md`:local daemon、packaged CLI 和 operator 运行手册。
24
+ - `docs/executor-engines.md`:外部 engine 安装、登录和 readiness 说明。
25
+ - `docs/soul-app-developer.md`:Soul App authoring workflow。
125
26
 
126
- ## CLI discovery
27
+ ## Developer Route
127
28
 
128
- `aiworker --help` is intentionally short and shows the first-run path. Use
129
- `aiworker commands` for the complete command index, or scoped help for a role:
29
+ | 我要修改 | 从这里开始 |
30
+ | --- | --- |
31
+ | Host daemon/API、registry、broker、auth/security、storage metadata | `docs/architecture.md` + `.agents/skills/aiworker-host-dev/SKILL.md` |
32
+ | Host Web Shell、Settings、worker/workspace/session workbench | `docs/architecture.md` + `.agents/skills/aiworker-host-dev/SKILL.md`,前端实现再用 `/pma-web` |
33
+ | CLI lifecycle、daemon/app/worker/workspace/session 命令 | `docs/cli.md` + `.agents/skills/aiworker-host-dev/SKILL.md` |
34
+ | 官方 HR/QA Soul App、manifest、standalone、Host mounted、artifact/profile/review/lesson | `docs/soul-app-developer.md` + `.agents/skills/aiworker-soul-app-dev/SKILL.md` |
35
+ | 新第三方 Soul App | `aiworker app create` + `docs/soul-app-developer.md` + `.agents/skills/aiworker-soul-app-dev/SKILL.md` |
36
+ | Host/Soul App 边界、shared protocol、broker grant | 先读 `docs/architecture.md#constraint-registry`,判断 ownership 后进入 Host 或 Soul App skill |
130
37
 
131
- ```sh
132
- aiworker --help
133
- aiworker commands
134
- aiworker worker --help
135
- aiworker fleet --help
136
- aiworker gateway --help
137
- ```
38
+ ## 为什么改成这个形态
138
39
 
139
- ---
40
+ 开发领域已经有成熟的一线 engine。AIWorker 不应该默认以 developer 为中心,更不应该把自己
41
+ 做成完整开发平台。Developer Soul 可以存在,但它应服务 code review、release evidence、
42
+ repo report、handoff、risk audit 等 supporting workflows。
140
43
 
141
- ## Start a worker (single host, no gateway)
44
+ AIWorker 的主要价值在更需要组织沉淀的垂直职能:
142
45
 
143
- The most common path: turn the current business directory into a worker scope, start a local server + admin UI, and chat through the CLI. **No fleet credentials required.**
46
+ - HR:candidate screen、interview brief、role rubric、people profile、hiring risk;
47
+ - PM:PRD、decision record、roadmap slice、status report;
48
+ - QA:test plan、regression matrix、defect evidence、release gate;
49
+ - DevOps:deployment checklist、incident review、runbook update、capacity summary;
50
+ - finance/legal/ops:各自领域的审查、模板化输出、证据链和复用经验。
144
51
 
145
- ```sh
146
- cd ~/code/my-project
147
- aiworker up --soul developer # one shot: init + doctor + executor readiness + serve
148
- ```
52
+ ## Soul App 模型
149
53
 
150
- `aiworker up` lays down the Project Brain layout under `<cwd>/.aiworker/` (worker.db, master key, persona, policy, memories, native skill projection manifest) and projects managed `aiworker-*` executor-native skills under `.agents/skills` and `.claude/skills`. It then runs preflight checks, reports executor readiness, and starts the worker HTTP/admin server (default `:9217`). It does not choose an executor for you; use `aiworker executor select --engine <id> --apply` for that. Pick a Soul from `developer` / `hr-recruiting` / `finance-ops` / `qa-reviewer` / `general-assistant` — Souls shape persona / risk preferences / default brief sections; governance kernel behavior is the same across all Souls.
54
+ Soul App 是可独立部署、也可挂载到 AIWorker Host 的垂直产品单元。例如 `aiworker-hr`
55
+ 可以作为 HR-first 本地应用独立运行,也可以被 Host 挂载,与 `aiworker-qa` 等其他 Soul App
56
+ 共存在同一个 local daemon 中。
151
57
 
152
- Step-by-step alternative:
58
+ ```text
59
+ Standalone:
60
+ aiworker-hr -> app-local runtime/settings/storage -> HR workspace/session
153
61
 
154
- ```sh
155
- aiworker init --soul developer # only lay out files
156
- aiworker executor select --engine claude-code --apply # pick executor (see "Configure the LLM" below)
157
- aiworker executor doctor --engine claude-code # check engine CLI + project overlay
158
- aiworker doctor # overall diagnostics (PASS / WARN / INFO)
159
- aiworker brain status # inspect brain assets
160
- aiworker serve --port 9217 --host 127.0.0.1 # start the server
161
- aiworker run --message 'hello' --chat-id demo # one-shot CLI turn (no server)
62
+ Host mounted:
63
+ aiworker-host -> app registry -> manifest/protocol -> aiworker-hr / aiworker-qa
162
64
  ```
163
65
 
164
- After it is running:
66
+ 两种模式应复用同一份 manifest、domain logic、artifact schema、review policy 和权限声明。
67
+ Host 不 import 垂直 app 内部源码;Soul App 不直接控制 Host engine、connector、secret、DB 或
68
+ 全局 memory。
165
69
 
166
- - Admin UI: `http://127.0.0.1:9217/admin/` (loopback by default; public hosts must front it with external auth — see below)
167
- - Bearer token: `<scope>/.aiworker/local/bootstrap-token.txt`. REST calls must include `Authorization: Bearer <token>`.
168
- - Brain and conversations stay local. The only outbound traffic is whatever the external executor itself talks to (its own LLM provider).
70
+ ## Host 的职责
169
71
 
170
- New worker-local `.env` files reserve commented gateway enrollment examples.
171
- `aiworker doctor` also reports gateway enrollment as standalone/configured and
172
- prints the exact `aiworker env ...` commands when enrollment is optional but not
173
- yet configured.
72
+ Host 是平台定位与能力壳,负责:
174
73
 
175
- Full CLI reference: [`docs/cli.md`](docs/cli.md).
74
+ - local daemon API 和 Web shell;
75
+ - Soul App registry、install、enable、disable、route 和 mounted launch;
76
+ - Host auth、安全层、session 安全和 grant enforcement;
77
+ - appearance、language、default engine、local MCP、connector、BYOK、autosave 等横向设置;
78
+ - storage、connector evidence、secret reference、log、search、audit 等 broker;
79
+ - worker/workspace/session locator;
80
+ - Host shell layout 和 optional header contract;
81
+ - app protocol discovery、health、descriptor cache 和平台审计。
176
82
 
177
- ---
83
+ Host 不负责解释 HR profile、QA release verdict、artifact 内容、review verdict 或 lesson/memory
84
+ 的领域意义。它只能消费 Soul App 通过协议和 grant 暴露的 view、action、status、descriptor、
85
+ search、review summary、memory summary 或 audit event。
178
86
 
179
- ## Developer repo proof loop
87
+ ## Soul App 的职责
180
88
 
181
- For a repo-scoped developer worker, AIWorker adds a reviewable proof loop around
182
- the executor:
89
+ Soul App 是领域主权方,负责:
183
90
 
184
- 1. The external executor still performs the work.
185
- 2. Brain Journal records task intent, selected context, executor events, tool
186
- signals, authority preflight, Gate verdict, and outcome.
187
- 3. Brain Gate separates hard invariants from Brain Engine review and heuristic
188
- quality signals.
189
- 4. Failed or incomplete work can be held or rerun with parent/child lineage.
190
- 5. Useful lessons become Brain Inbox candidates first; canonical memory writes
191
- still go through admission approval and apply.
91
+ - 垂直领域 UI/API;
92
+ - workspace type session workflow;
93
+ - capability prompt;
94
+ - artifact schema、内容、生命周期与含义;
95
+ - profile 组合;
96
+ - review rubric verdict 语义;
97
+ - lesson/memory promotion 语义;
98
+ - app-scoped storage content;
99
+ - standalone shell;
100
+ - Host mounted service entrypoints。
192
101
 
193
- Useful local commands:
102
+ 例如 HR People Profile 应由 HR App 从候选人 artifact、面试 evidence、人工 review 和业务规则
103
+ 组合而成。Host 可以定位并展示 HR App 暴露的 profile view,但不应该知道 profile 如何合成。
194
104
 
195
- ```sh
196
- aiworker run --message "review this change"
197
- aiworker brain journal show <taskId>
198
- aiworker brain inbox propose <taskId>
199
- ```
200
-
201
- When running the worker HTTP API, operator-triggered reruns are available at:
105
+ ## 基础设施模型
202
106
 
203
- ```sh
204
- curl -X POST \
205
- -H "Authorization: Bearer $(cat .aiworker/local/bootstrap-token.txt)" \
206
- http://127.0.0.1:9217/api/worker/orchestrator/tasks/<taskId>/rerun
107
+ ```text
108
+ 1 Host
109
+ -> 1 local daemon
110
+ -> N installed/enabled Soul Apps
111
+ -> N Soul workers
112
+ -> N workspaces/projects
113
+ -> N sessions
114
+ -> protocol-exposed views/actions/descriptors
207
115
  ```
208
116
 
209
- Authority preflight is a truthfulness surface, not a sandbox claim. High-risk
210
- ambient executor work is marked as observe-only unless the capability is
211
- explicitly brokered by AIWorker.
117
+ - Host 是承载环境,不是垂直产品对象。
118
+ - Local daemon 是唯一的本地控制面,负责 Web/API、SQLite、engine inventory、BYOK、
119
+ connectors、MCP、settings app registry。
120
+ - Worker 绑定一个 Soul App,并拥有该 app 的 capabilities、domain system、review policy 和
121
+ app-scoped namespaces。
122
+ - Workspace/project 是某个 worker 下的业务作用域,例如候选人、需求、release、incident 或
123
+ runbook。
124
+ - Session 是 workspace 内持续上下文,也是 engine native session 的绑定点和接管点。
125
+ - Engine invocation 只是内部审计对象;用户不创建、不维护 run。
212
126
 
213
- ---
127
+ ## Quickstart
214
128
 
215
- ## Start a fleet (multiple workers + gateway)
129
+ 目标 operator 路径应是一个本地 daemon 生命周期和一个 Web URL,而不是要求用户分别理解 API
130
+ dev server 与 Web dev server。
216
131
 
217
- The gateway aggregates multiple workers into a fleet: one operator CLI controls all of them, while each worker keeps owning its own brain, conversations, and secrets.
132
+ 目标 source-checkout 调试入口:
218
133
 
219
- ### 1) Start the gateway
220
-
221
- ```sh
222
- # Dev / single host: foreground
223
- aiworker gateway start --host 127.0.0.1 --port 9218
224
-
225
- # Server long-run: systemd
226
- aiworker gateway install systemd --user
227
- systemctl --user start aiworker-gateway
134
+ ```bash
135
+ aiworker dev
228
136
  ```
229
137
 
230
- When binding to a non-loopback host you must set:
138
+ 目标 packaged/npm preview 入口:
231
139
 
232
- ```sh
233
- export INTERNAL_SHARED_SECRET='<≥16 chars>' # bearer for remote operators
234
- # Front /ws and /admin/* with Caddy / Cloudflare Access / Logto / etc. (fail-closed)
140
+ ```bash
141
+ bunx @zonease/aiworker-cli daemon foreground --port 9217
142
+ # or, if Bun is already available for the shim:
143
+ npx @zonease/aiworker-cli daemon foreground --port 9217
235
144
  ```
236
145
 
237
- Public deployment + Caddy basicauth template: [`docs/deployment-public-https.md`](docs/deployment-public-https.md).
238
-
239
- ### 2) Enroll a worker (OTP recommended)
240
-
241
- The most common path — the worker side carries no fleet credentials, the operator approves an 8-character OTP:
242
-
243
- ```sh
244
- # Worker side:
245
- aiworker init --soul developer
246
- aiworker env gateway-url wss://your-gateway.example/
247
- aiworker env display-name my-laptop
248
- aiworker serve
249
- # stdout prints an OTP, e.g. YDCR-ZD8M
250
- ```
146
+ 这是 `0.x preview`:Host Web/API 启动、worker DB migrations,以及官方 HR/QA Soul App
147
+ bootstrap 需要能从 npm package 直接工作。HR/QA 业务 workflow、第三方 Soul App authoring、
148
+ standalone SDK/runtime npm publication 仍是 preview surface,不是 1.0 承诺。
251
149
 
252
- `aiworker init` also leaves commented `AIWORKER_GATEWAY_URL` /
253
- `AIWORKER_DISPLAY_NAME` examples in the worker-local `.env`; keep them
254
- commented unless you intentionally configure gateway enrollment.
150
+ Source checkout 调试也走同一个 daemon;先构建一次 Web 静态资源,然后以前台 daemon 托管 Web/API:
255
151
 
256
- ```sh
257
- # Operator side:
258
- aiworker fleet enroll list # see pending OTPs
259
- aiworker fleet enroll approve YDCR-ZD8M # approve
260
- aiworker fleet list # the worker is now visible
152
+ ```bash
153
+ bun run --filter '@zonease/aiworker-web' build
154
+ bun apps/cli/src/aiworker.ts dev --port 9217
261
155
  ```
262
156
 
263
- The other three enrollment paths (self-enroll for unattended batch setups / manual pair for high-security single-worker / docker auto-launch): [`docs/gateway.md`](docs/gateway.md).
157
+ 打开 Web 后,首屏应帮助用户 install/enable 官方或第三方 Soul App,再创建 Soul worker
158
+ workspace/session。Settings 由明确 settings button 打开,支持 Local CLI / BYOK、engine
159
+ scan/test、connectors、MCP、language、appearance、autosave 和 Soul App 管理。
264
160
 
265
- ### 3) Operator gateway config
161
+ ## 仓库结构
266
162
 
267
- The operator side needs `~/.aiworker/aiworker.json` on first use:
268
-
269
- ```sh
270
- mkdir -p ~/.aiworker && chmod 700 ~/.aiworker
271
- cat > ~/.aiworker/aiworker.json <<EOF
272
- {
273
- "gatewayUrl": "wss://operator:<basicauth-pwd>@your-gateway.example/ws",
274
- "deviceId": "op-$(uuidgen)",
275
- "deviceToken": "<INTERNAL_SHARED_SECRET>"
276
- }
277
- EOF
278
- chmod 600 ~/.aiworker/aiworker.json
163
+ ```text
164
+ apps/
165
+ api/ local daemon API and Worker Web host
166
+ cli/ aiworker CLI and packaged local daemon entry
167
+ web/ Host Web Shell and worker workbench
168
+ aiworker-hr/ official HR Soul App
169
+ aiworker-qa/ official QA Soul App
170
+ packages/
171
+ core/ local runtime, Host services and engine adapters
172
+ storage-sqlite/ worker.db schema, migrations and repositories
173
+ fs-layout/ AIWORKER_HOME, worker and workspace path helpers
174
+ shared/ shared schemas, Host/Soul App protocol and utilities
175
+ component/ shared React UI primitives and patterns
176
+ soul-app-sdk/ public SDK for Soul App authors
177
+ soul-app-runtime/ standalone/mounted Soul App runtime harness
279
178
  ```
280
179
 
281
- > Same-host loopback skips basicauth and the token: just use `ws://127.0.0.1:9218/ws`.
282
-
283
- ### 4) Common operator commands
180
+ ## 开发命令
284
181
 
285
- ```sh
286
- # State
287
- aiworker fleet list
288
- aiworker fleet remove <workerId>
182
+ 安装依赖:
289
183
 
290
- # Chat (streaming NDJSON)
291
- aiworker fleet chat <workerId> 'hello'
292
- aiworker fleet chat <workerId> 'continue' --conversation-id <prev-id>
293
-
294
- # Worker config (optimistic-locked)
295
- aiworker fleet config get <workerId> # returns version + config
296
- aiworker fleet config set <workerId> "$NEW_CFG" --if-match <version>
297
-
298
- # Token rotation / logs / cron / per-tool approvals
299
- aiworker fleet token rotate <workerId>
300
- aiworker fleet logs <workerId> --follow --tail 200
301
- aiworker fleet schedule list <workerId>
302
- aiworker fleet schedule add <workerId> --expression '0 9 * * *' --prompt 'morning brief' --channel web --chat-id daily
303
- aiworker fleet approvals list
304
- aiworker fleet approvals grant <workerId> <taskId> <toolCallId> # allow
305
- aiworker fleet approvals grant <workerId> <taskId> <toolCallId> --deny
184
+ ```bash
185
+ bun install
306
186
  ```
307
187
 
308
- ---
309
-
310
- ## Configure the LLM executor
188
+ 常用检查:
311
189
 
312
- A new worker defaults to `executor: { engine: 'http', variant: 'default' }` and must be switched to a real LLM before it can do anything.
313
-
314
- ```sh
315
- # Local:
316
- aiworker executor select --engine claude-code --variant default --timeout-ms 240000 --apply
317
- aiworker executor doctor --engine claude-code
318
-
319
- # Remote, for a worker in the fleet:
320
- aiworker fleet config get <workerId> # grab version + current config
321
- aiworker fleet config set <workerId> "$NEW" --if-match <version>
190
+ ```bash
191
+ bun run typecheck
192
+ bun run lint
193
+ bun run test
194
+ bun run check
195
+ bun run build
322
196
  ```
323
197
 
324
- Supported engines: `http` (OpenAI / DeepSeek / SiliconFlow / any chat-completions-compatible API), `claude-code`, `codex`, `acp` (gemini / qwen), `cursor`, `mcp`.
325
-
326
- Per-engine install / auth recipes (including `claude login`, `codex auth`, secret vault writes, ACP CLI installs): [`docs/executor-engines.md`](docs/executor-engines.md).
327
-
328
- `--timeout-ms` on `executor select` sets the executor adapter's per-turn hard
329
- timeout. `aiworker run --timeout-ms` only controls how long the CLI waits for
330
- the worker turn to finish.
331
-
332
- ---
333
-
334
- ## Deployment shapes
335
-
336
- | Shape | When | Entry |
337
- |---|---|---|
338
- | Bare-process | dev / CI | `aiworker gateway start` / `aiworker serve` in the foreground |
339
- | systemd (Linux preferred) | server long-run | `aiworker {gateway,worker} install systemd [--user\|--system]` |
340
- | docker compose | no Bun on host / per-worker isolation | `ops/compose/docker-compose.yml` (GHCR images) |
341
-
342
- See [`docs/deployment.md`](docs/deployment.md).
343
-
344
- ---
345
-
346
- ## Key environment variables
347
-
348
- | Variable | Purpose |
349
- |---|---|
350
- | `AIWORKER_MASTER_KEY` | 64 hex; AES master key for worker / gateway databases; **must be backed up offline** |
351
- | `INTERNAL_SHARED_SECRET` | Remote-operator bearer when the gateway is exposed publicly or off loopback (≥16 chars) |
352
- | `AIWORKER_GATEWAY_URL` | Optional worker-side gateway URL (path + basicauth); set with `aiworker env gateway-url <url>` |
353
- | `AIWORKER_DISPLAY_NAME` | Optional worker label in the fleet list (defaults to hostname / worker id); set with `aiworker env display-name <name>` |
354
- | `AIWORKER_HOME` | Explicit worker state root; project scope auto-resolves to `<project>/.aiworker/local` |
355
- | `AIWORKER_ADMIN_EXTERNAL_AUTH` | Set to `1` if `/admin/*` is fronted by Caddy / Cloudflare Access / Logto / etc. |
356
-
357
- Full list: `apps/api/.env.example` + `ops/compose/.env.example`, or [`docs/architecture.md` § Environment](docs/architecture.md).
198
+ 聚焦命令:
358
199
 
359
- ---
360
-
361
- ## More
362
-
363
- - [`docs/architecture.md`](docs/architecture.md) system layout, data flow, security model, Brain governance boundary, full env table
364
- - [`docs/governance-node-status.md`](docs/governance-node-status.md) — production-readiness checklist and remaining boundaries
365
- - [`docs/gateway.md`](docs/gateway.md) — WS protocol (METHODS / EVENTS) and the four enrollment paths
366
- - [`docs/deployment.md`](docs/deployment.md) — three deployment shapes runbook + troubleshooting + backup checklist
367
- - [`docs/deployment-public-https.md`](docs/deployment-public-https.md) — public-internet Cloudflare + Caddy overlay (including the BUG-007 fail-closed fix)
368
- - [`docs/executor-engines.md`](docs/executor-engines.md) — per-engine auth/install
369
- - [`docs/cli.md`](docs/cli.md) — full CLI reference
370
- - [`docs/changelog.md`](docs/changelog.md) — release history and end-to-end test notes
371
-
372
- ---
373
-
374
- ## Development
375
-
376
- ```sh
377
- git clone https://github.com/ZonEaseTech/aiworker
378
- cd aiworker && bun install
379
- bun run typecheck && bun run lint && bun run test
200
+ ```bash
201
+ bun run --filter '@zonease/aiworker-core' test
202
+ bun run --filter '@zonease/aiworker-api' build
203
+ bun run --filter '@zonease/aiworker-web' build
204
+ bun run --filter '@zonease/aiworker-cli' build:bundle
380
205
  ```
381
206
 
382
- For local development, run focused package checks while iterating and the full
383
- gate before publishing or merging. Planning notes, implementation history, and
384
- release records live in [`docs/plan/`](docs/plan/), [`docs/task/`](docs/task/),
385
- and [`docs/changelog.md`](docs/changelog.md).
386
-
387
- ---
388
-
389
- ## Status
390
-
391
- > Before going to production, read the readiness table and remaining-boundary
392
- > section in [`docs/governance-node-status.md`](docs/governance-node-status.md).
393
- > Before 1.0.0, CLI / API / config shapes may still change.
394
-
395
- CLI npm latest: **0.12.0**.
396
-
397
- | Module | Status |
398
- |---|---|
399
- | Worker and Fleet operations: control plane, enrollment, executor adapters, webhooks, schedules, per-tool approvals, hot reload | ✅ Production |
400
- | Project Brain governance: reviewed memory changes, secret scanning, provenance events, canonical memory boundary, bypass checks | ✅ GA |
401
- | Governance regression coverage: 800+ checks across source and packaged CLI, plus long-running worker REST regression | ✅ GA |
402
- | Memory-write automation | ✅ MVP (`memory-add` is available; other proposal types are rejected until implemented) |
403
- | Optional LLM-backed Brain reviewer | 🔜 opt-in; default is observe-only heuristic review |
404
- | Cross-scope runtime isolation | 🔜 currently convention / filesystem only |
405
- | Web SPA pending UI / Multi-host HA | 🔜 Stage-2 |
406
-
407
- ---
207
+ ## 当前路线
408
208
 
409
- ## License
209
+ 当前重构阶段重新排优先级:
410
210
 
411
- [MIT](LICENSE) © 2026 ZonEase Tech
211
+ 1. 架构入口收敛为 `AGENTS.md` + `docs/architecture.md`;
212
+ 2. Host 作为平台定位、能力壳、安装启用、安全设置和 shell contract;
213
+ 3. Soul App 作为 app-level standalone + Host mounted 垂直产品;
214
+ 4. 官方 HR/QA Soul App 通过快捷 install/enable 进入 Host,而不是被 Host 内置;
215
+ 5. Worker Web 首屏围绕 Soul App、worker、workspace、session 和 app-owned workbench;
216
+ 6. Settings 管理 Local CLI / BYOK、engine scan/test、connectors、MCP、language、
217
+ appearance、autosave 和 installed Soul Apps;
218
+ 7. Host/Soul protocol 继续收敛 view、action、status、descriptor、broker 和 mount mode;
219
+ 8. Developer onboarding、验证、发布证据和第三方 app authoring 继续完善。