@bizagent/dsh 0.0.0-stage → 1.0.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 (181) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/LICENSE +21 -0
  3. package/README.md +61 -2
  4. package/cordis.patch.yml +14 -0
  5. package/docs/README.md +23 -0
  6. package/docs/architecture.md +154 -0
  7. package/docs/concepts.md +192 -0
  8. package/docs/configuration.md +154 -0
  9. package/docs/quickstart.md +103 -0
  10. package/docs/quickstart.zh-CN.md +86 -0
  11. package/docs/tools.md +607 -0
  12. package/docs/user-guide.zh-CN.md +132 -0
  13. package/docs/verification.md +69 -0
  14. package/examples/README.md +64 -0
  15. package/examples/demo-runtime.mjs +71 -0
  16. package/examples/learning-lab.mjs +263 -0
  17. package/examples/scenarios.mjs +45 -0
  18. package/lib/agent-preset.d.ts +20 -0
  19. package/lib/agent-preset.js +46 -0
  20. package/lib/agent-session-address.d.ts +14 -0
  21. package/lib/agent-session-address.js +15 -0
  22. package/lib/agent-session-coordinator.d.ts +24 -0
  23. package/lib/agent-session-coordinator.js +101 -0
  24. package/lib/cli.d.ts +3 -0
  25. package/lib/cli.js +142 -0
  26. package/lib/client-types/agent-session-address.d.ts +13 -0
  27. package/lib/client-types/client/agent-mentions.d.ts +3 -0
  28. package/lib/client-types/client/api.d.ts +180 -0
  29. package/lib/client-types/client/components.d.ts +22 -0
  30. package/lib/client-types/client/controller.d.ts +23 -0
  31. package/lib/client-types/client/frame-participants.d.ts +5 -0
  32. package/lib/client-types/client/home-name.d.ts +9 -0
  33. package/lib/client-types/client/human-inbox.d.ts +8 -0
  34. package/lib/client-types/client/index.d.ts +13 -0
  35. package/lib/client-types/client/locales.d.ts +796 -0
  36. package/lib/client-types/client/markdown.d.ts +12 -0
  37. package/lib/client-types/client/project-artifact-link.d.ts +10 -0
  38. package/lib/client-types/client/project-outcome-review-inbox.d.ts +13 -0
  39. package/lib/client-types/client/projects.d.ts +11 -0
  40. package/lib/client-types/client/sample-guide.d.ts +9 -0
  41. package/lib/client-types/client/session-resource.d.ts +34 -0
  42. package/lib/client-types/client/session-surfaces.d.ts +24 -0
  43. package/lib/client-types/client/styles.d.ts +1 -0
  44. package/lib/client-types/config.d.ts +55 -0
  45. package/lib/client-types/cron.d.ts +8 -0
  46. package/lib/client-types/domain.d.ts +818 -0
  47. package/lib/client-types/frame-reference.d.ts +4 -0
  48. package/lib/client-types/home-directory.d.ts +5 -0
  49. package/lib/client-types/home-space.d.ts +49 -0
  50. package/lib/client-types/home-store.d.ts +125 -0
  51. package/lib/client-types/inbox-stalled-topic.d.ts +15 -0
  52. package/lib/client-types/inbox-wake-policy.d.ts +18 -0
  53. package/lib/client-types/known-format.d.ts +2 -0
  54. package/lib/client-types/learning-scheduler.d.ts +36 -0
  55. package/lib/client-types/learning-session-runner.d.ts +49 -0
  56. package/lib/client-types/learning-trigger.d.ts +17 -0
  57. package/lib/client-types/learning-usage.d.ts +17 -0
  58. package/lib/client-types/ledger.d.ts +190 -0
  59. package/lib/client-types/local-owner.d.ts +7 -0
  60. package/lib/client-types/message-source.d.ts +9 -0
  61. package/lib/client-types/organization-location.d.ts +19 -0
  62. package/lib/client-types/project-ledger.d.ts +182 -0
  63. package/lib/client-types/project-seat-context.d.ts +17 -0
  64. package/lib/client-types/safe-file.d.ts +23 -0
  65. package/lib/client-types/sample-organization.d.ts +9 -0
  66. package/lib/client-types/service.d.ts +596 -0
  67. package/lib/client-types/shared-knowledge.d.ts +116 -0
  68. package/lib/client-types/ui-contract.d.ts +276 -0
  69. package/lib/client-types/untrusted-text.d.ts +15 -0
  70. package/lib/client-types/work-ledger.d.ts +108 -0
  71. package/lib/client-types/work-output-eval.d.ts +15 -0
  72. package/lib/client-types/worklog-ledger.d.ts +88 -0
  73. package/lib/client-types/worklog-snapshot.d.ts +33 -0
  74. package/lib/client.js +5463 -0
  75. package/lib/config.d.ts +56 -0
  76. package/lib/config.js +115 -0
  77. package/lib/cron.d.ts +9 -0
  78. package/lib/cron.js +127 -0
  79. package/lib/domain.d.ts +819 -0
  80. package/lib/domain.js +662 -0
  81. package/lib/frame-admission.d.ts +6 -0
  82. package/lib/frame-admission.js +39 -0
  83. package/lib/frame-reference.d.ts +5 -0
  84. package/lib/frame-reference.js +12 -0
  85. package/lib/home-archive.d.ts +17 -0
  86. package/lib/home-archive.js +177 -0
  87. package/lib/home-directory.d.ts +6 -0
  88. package/lib/home-directory.js +38 -0
  89. package/lib/home-space.d.ts +50 -0
  90. package/lib/home-space.js +120 -0
  91. package/lib/home-store.d.ts +126 -0
  92. package/lib/home-store.js +837 -0
  93. package/lib/host.d.ts +22 -0
  94. package/lib/host.js +15 -0
  95. package/lib/human-inbox-transport.d.ts +23 -0
  96. package/lib/human-inbox-transport.js +105 -0
  97. package/lib/human-notification-runner.d.ts +83 -0
  98. package/lib/human-notification-runner.js +138 -0
  99. package/lib/human-notification-webhook.d.ts +18 -0
  100. package/lib/human-notification-webhook.js +102 -0
  101. package/lib/human-turn-completion.d.ts +61 -0
  102. package/lib/human-turn-completion.js +157 -0
  103. package/lib/inbox-return-notifier.d.ts +46 -0
  104. package/lib/inbox-return-notifier.js +279 -0
  105. package/lib/inbox-stalled-escalation-runner.d.ts +31 -0
  106. package/lib/inbox-stalled-escalation-runner.js +68 -0
  107. package/lib/inbox-stalled-topic.d.ts +16 -0
  108. package/lib/inbox-stalled-topic.js +44 -0
  109. package/lib/inbox-wake-policy.d.ts +19 -0
  110. package/lib/inbox-wake-policy.js +28 -0
  111. package/lib/inbox-wake-runner.d.ts +45 -0
  112. package/lib/inbox-wake-runner.js +481 -0
  113. package/lib/index.d.ts +29 -0
  114. package/lib/index.js +480 -0
  115. package/lib/known-format.d.ts +3 -0
  116. package/lib/known-format.js +8 -0
  117. package/lib/learning-scheduler.d.ts +37 -0
  118. package/lib/learning-scheduler.js +182 -0
  119. package/lib/learning-session-runner.d.ts +50 -0
  120. package/lib/learning-session-runner.js +435 -0
  121. package/lib/learning-trigger.d.ts +18 -0
  122. package/lib/learning-trigger.js +92 -0
  123. package/lib/learning-usage.d.ts +18 -0
  124. package/lib/learning-usage.js +49 -0
  125. package/lib/ledger.d.ts +191 -0
  126. package/lib/ledger.js +752 -0
  127. package/lib/local-human-host.d.ts +11 -0
  128. package/lib/local-human-host.js +191 -0
  129. package/lib/local-human-token.d.ts +9 -0
  130. package/lib/local-human-token.js +32 -0
  131. package/lib/local-owner.d.ts +8 -0
  132. package/lib/local-owner.js +26 -0
  133. package/lib/message-source.d.ts +10 -0
  134. package/lib/message-source.js +2 -0
  135. package/lib/organization-location.d.ts +20 -0
  136. package/lib/organization-location.js +80 -0
  137. package/lib/organization-workspace.d.ts +22 -0
  138. package/lib/organization-workspace.js +32 -0
  139. package/lib/project-ledger.d.ts +183 -0
  140. package/lib/project-ledger.js +189 -0
  141. package/lib/project-review-transport.d.ts +23 -0
  142. package/lib/project-review-transport.js +155 -0
  143. package/lib/project-seat-context.d.ts +18 -0
  144. package/lib/project-seat-context.js +34 -0
  145. package/lib/proposal-review-transport.d.ts +26 -0
  146. package/lib/proposal-review-transport.js +104 -0
  147. package/lib/route-guard.d.ts +31 -0
  148. package/lib/route-guard.js +80 -0
  149. package/lib/safe-file.d.ts +24 -0
  150. package/lib/safe-file.js +93 -0
  151. package/lib/sample-organization.d.ts +10 -0
  152. package/lib/sample-organization.js +46 -0
  153. package/lib/service.d.ts +597 -0
  154. package/lib/service.js +4076 -0
  155. package/lib/session-surface.d.ts +11 -0
  156. package/lib/session-surface.js +109 -0
  157. package/lib/shared-knowledge-review-transport.d.ts +28 -0
  158. package/lib/shared-knowledge-review-transport.js +85 -0
  159. package/lib/shared-knowledge.d.ts +117 -0
  160. package/lib/shared-knowledge.js +240 -0
  161. package/lib/tools.d.ts +7 -0
  162. package/lib/tools.js +955 -0
  163. package/lib/ui-contract.d.ts +277 -0
  164. package/lib/ui-contract.js +12 -0
  165. package/lib/ui-host.d.ts +24 -0
  166. package/lib/ui-host.js +471 -0
  167. package/lib/untrusted-text.d.ts +16 -0
  168. package/lib/untrusted-text.js +50 -0
  169. package/lib/work-ledger.d.ts +109 -0
  170. package/lib/work-ledger.js +107 -0
  171. package/lib/work-output-eval.d.ts +16 -0
  172. package/lib/work-output-eval.js +58 -0
  173. package/lib/work-runner.d.ts +47 -0
  174. package/lib/work-runner.js +352 -0
  175. package/lib/worklog-ledger.d.ts +89 -0
  176. package/lib/worklog-ledger.js +91 -0
  177. package/lib/worklog-snapshot.d.ts +34 -0
  178. package/lib/worklog-snapshot.js +100 -0
  179. package/lib/writer-guard.d.ts +11 -0
  180. package/lib/writer-guard.js +207 -0
  181. package/package.json +172 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,124 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 — 2026-10-20
4
+
5
+ The first stable release: everything since `0.1.0-alpha.2`.
6
+
7
+ ### Native DSH integration and onboarding
8
+
9
+ - Reorganize the READMEs around installation, first success, daily use, and references. Add a
10
+ concise Chinese install guide and a six-step delivery walkthrough, with UI locations, success
11
+ checks, and separate examples for the 300 and 400.50 GMV datasets. Record the tested DSH
12
+ version and verification scope.
13
+ - Move the organization workbench into DSH's native sidebar/main-panel navigation. Home,
14
+ Project, and memory links open the corresponding record and preserve the Session context.
15
+ - Add Session Home actions, an unread Inbox count, sidebar Session identities and Home actions,
16
+ a **Work & learning** conversation view, and completed-turn receipts backed by successful
17
+ durable tool results. Show live Agent runtime separately from recorded Work status.
18
+ - Resolve selected `@Agent` Homes at DSH's pre-step admission boundary and log their bounded
19
+ snapshots before model calls. Loading failures are explicit; cancelled admission can be retried
20
+ without assuming an unlogged snapshot was delivered. Hide transport markers from user text.
21
+ - Share browser requests across Session surfaces and cancel abandoned loads.
22
+
23
+ ### Runs on DSH 0.2
24
+
25
+ - Installation, development dependencies, and runtime CI pin DSH `0.2.1-rc.2`. DSH peers require
26
+ `^0.2.1-rc.2`. CI also checks selected Frame admission and Session Work/result surfaces.
27
+ DSH 0.2 skips plugins whose DSH peers
28
+ name another line, so 0.1 builds no longer load.
29
+ - Sessions that BizAgent starts (Principals, Project Mains, Work workers, Inbox wake-ups, learning
30
+ reviews) join DSH's default agent preset and use the host's default model. Without the model,
31
+ resumed sessions failed every turn on DSH 0.2.
32
+ - Chats opened from the panel are attached to a workspace named after their Home and appear in the
33
+ DSH sidebar.
34
+
35
+ ### Organization folders and the personal Home
36
+
37
+ - BizAgent keeps its data in `~/BizAgent` (or `$BIZAGENT_HOME`) instead of `$DSH_HOME/bizagent`.
38
+ Your personal Homes live there; each organization gets its own folder, `orgs/<id>/`, which BizAgent
39
+ adds to the top of the DSH sidebar. Setup no longer asks for a DSH workspace. Data at the old
40
+ default place keeps being used until you move it, and organizations already created inside a
41
+ workspace keep working where they are (`active-organization.yaml` format 1 still loads; new ones
42
+ are format 2).
43
+ - Sessions outside the organization folder belong to your personal Home (`personal:default`), which
44
+ now exists with or without an organization. Before, they fell back to the organization's business
45
+ Home, so unrelated work (coding in your own repositories) was saved into the organization's
46
+ memory. Such bindings from earlier versions are released at startup.
47
+ - File copies kept for Worklogs, Work, Projects, and learning reviews go to the data folder of the
48
+ Home they belong to, so personal work never lands in the organization folder.
49
+ - The panel shows which Home the current chat belongs to, offers **New chat in organization** for
50
+ personal chats, groups the Home list into your Homes and the organization's, and shows the
51
+ Learning view even before an organization exists.
52
+ - Your personal Home shows as *My personal Home* in the panel instead of its address.
53
+
54
+ ### Works out of the box
55
+
56
+ - **Create sample team** in first-time setup builds *Sample Shop* (a growth lead, a data analyst,
57
+ a metric capability, and a small `orders.csv`) with a five-minute guide on the Organization page.
58
+ - The local person owns the Homes BizAgent creates (`owner` option; defaults to
59
+ `BIZAGENT_LOCAL_HUMAN_ID` or the OS user name). Before, the default Home had no owner and
60
+ onboarding organizations were owned by member ids, so nobody could accept their results.
61
+ - In DSH Web the person signed in to DSH is the reviewer: accepting a Project, deciding proposals,
62
+ and reading My Inbox need no BizAgent token. A Bearer token file remains for scripts.
63
+ - Formal Work and Inbox wake-ups start in the assignee Home's own folder when no `workspaceHomes`
64
+ mapping exists, so teammates created in the UI pick up handed-off work.
65
+ - `timeZone` option for cron schedules and daily limits (default: the host time zone) instead of
66
+ fixed Asia/Shanghai time.
67
+ - Project results, assets, proposals, Worklogs, and mail in the panel are rendered as Markdown
68
+ with DSH's own renderer instead of raw text.
69
+ - A Work result or reply that reaches a Session still working is read at its next step. Before, it
70
+ waited for the next turn, so a Project chat that had already handled the result ran one more turn.
71
+
72
+ ### Safer
73
+
74
+ - Every BizAgent HTTP route requires DSH Web's login when DSH provides it, in addition to the
75
+ loopback, cross-site, and same-origin checks. Cross-owner Work never starts on its own.
76
+ - Text from other Homes reaches the model fenced as data. Evidence reads stay within the
77
+ session's own Home. Snapshots of files are read without following symlinks.
78
+ - Session and record ids are scoped to the session and its tool call, so parallel and replayed
79
+ calls cannot collide. One damaged record or Home file is isolated instead of stopping startup.
80
+
81
+ ### Smaller and clearer
82
+
83
+ - The package keeps the learning core, Inbox, formal Work, and a narrowed Project loop (create,
84
+ invite, join, submit, rework, human acceptance). Internal integrations from earlier development
85
+ were removed; 59 Agent tools remain.
86
+ - The main entry exports only the DSH plugin and its types. Building blocks for hosts with their
87
+ own login moved to `@bizagent/dsh/host`.
88
+ - Tool results are compact JSON, and Project and Work reads return summaries.
89
+ - English documentation: quick start, concepts, configuration, architecture, and a tool
90
+ reference generated from the code. License changed to MIT.
91
+
92
+ ## 0.1.0-alpha.2
93
+
94
+ - 新增首次组织设置:使命、团队模板、成员/角色与共享能力可在一个流程中确认并批量创建;
95
+ - 新增 `organization.yaml` 关系清单和组织图,Organization 作为四类 Home 之上的容器,而不是第五类 Home;
96
+ - UI 重构为“组织 / 学习”双视图,组织图可直接进入各责任主体的学习账本;
97
+ - Home 创建改为临时目录完整写入后原子 rename;组织清单只在全部引用 Home 存在后提交,失败可幂等重试;
98
+ - Home Context 改为 `agent.inject()` 持久 Snapshot,同一 Session/Revision 不重复注入,支持重启与 replay;
99
+ - 新增只针对明确纠正的有界 Learning Checkpoint,普通 Turn 不增加模型调用;
100
+ - Checkpoint 以 `Session + Turn` 确定性编号并幂等结算,复用现有 metadata 表而不改变 Storage Domain 版本;
101
+ - 新增 `bizagent_evidence_read`,可以回读资产引用的有界 DSH Session 事件;
102
+ - 调整 Fitness:retrieved/applied 不自证有效,两次 contradicted/failed 后提示人工复查;
103
+ - 保持 Learning Trigger 接口独立,后续业务插件可增加自己的强信号检测器。
104
+
105
+ ## 0.1.0-alpha.1
106
+
107
+ - 新增 DSH 原生 Web Client 插件,通过 sidebar 与 shell overlay slot 挂载组织记忆台;
108
+ - 新增 Home directory、Memory strata、Learning ledger、证据详情和 Proposal inbox;
109
+ - 新增创建 Home 与目标 owner proposal 裁决交互,不开放无 evidence 的直接 Memory 写入;
110
+ - UI Host adapter 作为独立 Cordis row,通过有 body 上限、no-store 和同源 mutation 检查的 HTTP API 提供数据;
111
+ - Client bundle 与 learning kernel 完全分离,核心代码不依赖 React;
112
+ - 在 DSH `0.1.1-rc.2` 中验证 Client 启动图、bundle serving、API 读取、同源写入和跨源拒绝。
113
+
114
+ ## 0.1.0-alpha.0
115
+
116
+ 首个可运行版本:
117
+
118
+ - 作为 DSH Cordis Bundle 安装,不 fork DSH、不另起 daemon;
119
+ - 实现 Personal、Business、Role、Capability 四类 Agent Home;
120
+ - 实现有界 Home Context、多级学习资产与跨 Session 持久化;
121
+ - 实现带当前 DSH turn 证据的 Memory 写入、更新、检索和 fitness feedback;
122
+ - 实现跨 Home proposal、owner 审批、幂等接受/拒绝和恢复对账;
123
+ - 提供 10 个 DSH tools 以及 `init`、`home`、`doctor`、`reindex` CLI;
124
+ - 通过单元、插件集成、tarball 安装及 DSH `0.1.1-rc.2` Web profile 启动验证。
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 BizAgent contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,62 @@
1
- # Temporary Holding Version
1
+ # @bizagent/dsh
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Long-term memory and teamwork for agents on [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness).
4
+
5
+ BizAgent adds lasting Homes, evidence-backed learning, governed sharing, Inbox messages, formal
6
+ Work, and Projects with human acceptance. DSH runs the models, tools, and sessions.
7
+
8
+ ## Start here
9
+
10
+ - **Install:** [English quick start](docs/quickstart.md) / [中文安装指南](docs/quickstart.zh-CN.md).
11
+ - **Already installed:** [use BizAgent](docs/quickstart.md#use-bizagent) / [中文用户指南](docs/user-guide.zh-CN.md).
12
+ - **Look up a feature:** [documentation map](docs/README.md), [concepts](docs/concepts.md),
13
+ [configuration](docs/configuration.md), [59 Agent tools](docs/tools.md).
14
+ - **Check versions and evidence:** [verification and compatibility](docs/verification.md).
15
+
16
+ Start with one saved rule in your personal Home. An organization is optional for that first step;
17
+ existing organizations can use separate practice Homes without resetting data.
18
+
19
+ ## In DSH Web
20
+
21
+ | Surface | Use |
22
+ | --- | --- |
23
+ | BizAgent organization panel | Organize Homes; inspect learning; review proposals and Projects |
24
+ | Session Home button | Check which Home owns the conversation and open its learning |
25
+ | Work & learning tab | Inspect this session's Work, worker/result links, and related Projects |
26
+ | Turn receipts | Open the successful records saved in a completed turn |
27
+ | Composer `@` and Frame bar | Load shared Home context in the current session |
28
+ | My Inbox | Read agent messages and reply to the originating session |
29
+
30
+ Formal Work starts in an independent worker when both Homes share an owner. A Frame provides
31
+ read-only context in the current session. Only a person can accept a submitted Project result.
32
+
33
+ ## Package entry points
34
+
35
+ | Import | Use |
36
+ | --- | --- |
37
+ | `@bizagent/dsh` | Core plugin and types (`name`, `inject`, `Config`, `apply`) |
38
+ | `@bizagent/dsh/ui-host` | Authenticated panel HTTP routes |
39
+ | `@bizagent/dsh/local-human-host` | Local owner's review and Inbox routes |
40
+ | `@bizagent/dsh/client` | Browser bundle loaded by DSH Web |
41
+ | `@bizagent/dsh/host` | Building blocks for hosts with their own authentication |
42
+
43
+ The package also installs `bizagent` for Home files: `init`, `home create|list`, `doctor`,
44
+ `reindex`, and `archive export|verify|import`. Run `bizagent --help` for usage.
45
+
46
+ ## Development
47
+
48
+ ```sh
49
+ npm ci
50
+ npm test # builds and runs automated tests
51
+ npm run typecheck
52
+ npm run examples # service scenarios without a model
53
+ npm run smoke:local-human
54
+ npm run smoke:session-ui
55
+ npm run pack:check
56
+ ```
57
+
58
+ Runtime smokes use isolated profiles and a local fake model. See [verification](docs/verification.md)
59
+ for the distinction between service tests, runtime integration, and real-model browser acceptance.
60
+ For user-visible changes, update the [changelog](CHANGELOG.md).
61
+
62
+ [MIT](LICENSE)
@@ -0,0 +1,14 @@
1
+ # BizAgent v0.1 requires the DSH Web profile's ctx.storageDomain service.
2
+ # The row is inserted after the standard bundles and remains user-patchable.
3
+ - insert:
4
+ - id: bizagent
5
+ name: '@bizagent/dsh'
6
+ config:
7
+ defaultHome: 'personal:default'
8
+ autoCreateDefaultHome: true
9
+ identityMaxBytes: 6144
10
+ indexMaxBytes: 16384
11
+ - id: bizagent-ui
12
+ name: '@bizagent/dsh/ui-host'
13
+ - id: bizagent-local-human
14
+ name: '@bizagent/dsh/local-human-host'
package/docs/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # 文档导航 / Documentation
2
+
3
+ 按当前任务选择一页即可,不需要从头读完所有文档。
4
+ Choose the page for your task; the reference pages are optional.
5
+
6
+ | 任务 / Task | 中文 | English |
7
+ | --- | --- | --- |
8
+ | 安装插件,确认第一次成功 / Install and verify | [快速开始](quickstart.zh-CN.md) | [Quick start](quickstart.md) |
9
+ | 使用界面,完成记忆、派工和验收 / Use the product | [用户指南](user-guide.zh-CN.md) | [Quick start: use BizAgent](quickstart.md#use-bizagent) |
10
+ | 理解 Home、Frame、Inbox、Work、Project / Understand the model | [用户指南中的选择表](user-guide.zh-CN.md#该用哪种协作方式) | [Concepts](concepts.md) |
11
+ | 核对版本与已验证范围 / Check compatibility and evidence | [版本说明](quickstart.zh-CN.md#安装) | [Verification](verification.md) |
12
+ | 调整模型、目录或计划 / Configure | [模型入口](quickstart.zh-CN.md#连接模型并启动) | [Configuration](configuration.md) |
13
+ | 研究接入和权限边界 / Integrate | — | [Architecture](architecture.md) |
14
+ | 查询具体工具参数 / Look up a tool | — | [Generated tool reference](tools.md) |
15
+
16
+ **建议路线**:安装 → 保存一条规则 → 新会话读取 → 独立派工 → 人工验收。
17
+ **Suggested route**: install → save a rule → recall in another session → dispatch Work → accept the Project.
18
+
19
+ 已有 DSH 时跳过安装 DSH;已有组织时跳过首次组织设置。
20
+ 问题排查放在[快速开始](quickstart.zh-CN.md#遇到问题时)末尾;数据目录和备份边界见[配置](configuration.md#data-and-backups)。
21
+
22
+ For contributors: [development and checks](../../../CONTRIBUTING.md),
23
+ [Learning Lab](../examples/README.md), [changelog](../CHANGELOG.md).
@@ -0,0 +1,154 @@
1
+ # Architecture and trust model
2
+
3
+ BizAgent is a set of DSH plugins. It does not run its own agent loop, server, or database: DSH runs
4
+ every session, calls the model, executes tools, and stores conversations; BizAgent adds Homes,
5
+ learning, and the records that connect agents.
6
+
7
+ ## Components
8
+
9
+ | Plugin row | Module | Does |
10
+ | --- | --- | --- |
11
+ | `bizagent` | `@bizagent/dsh` | The core: binds sessions to Homes, adds the system prompt section, the Home snapshot, and the Agent tools, and runs Work, Inbox wake-ups, and learning reviews. |
12
+ | `bizagent-ui` | `@bizagent/dsh/ui-host` | HTTP routes for the BizAgent panel. |
13
+ | `bizagent-local-human` | `@bizagent/dsh/local-human-host` | Review routes for the local owner: Project acceptance, proposal decisions, My Inbox. |
14
+ | (browser) | `@bizagent/dsh/client` | Native organization panel, Session Home actions, Work & learning view, sidebar decorations, turn receipts, `@` references, and the Frame bar. |
15
+
16
+ The core needs these DSH services: `agents`, `tools`, `systemPrompt`, `storageDomain`,
17
+ `sessionQuery`, and `agentDefaultModel`. See [Verification](verification.md) for the development
18
+ baseline and separately tested DSH Web runtime.
19
+
20
+ ```mermaid
21
+ flowchart LR
22
+ DSH[DSH sessions and tools] --> Core[bizagent core]
23
+ Core --> Files[Home folders: identity and assets]
24
+ Core --> Ledgers[DSH storageDomain: bindings, proposals, Inbox, Work, Projects, Worklogs]
25
+ Sessions[DSH sessionQuery: conversations] --> Core
26
+ Core --> Snapshot[Home snapshot at session start]
27
+ Snapshot --> DSH
28
+ Panel[BizAgent panel] --> Routes[ui-host and local-human-host routes]
29
+ Routes --> Core
30
+ ```
31
+
32
+ ## Where data lives
33
+
34
+ | Data | Stored in | Notes |
35
+ | --- | --- | --- |
36
+ | Homes: identity, assets, revisions | Home folders, as Markdown and YAML | Organization Homes inside `~/BizAgent/orgs/<id>/`, personal Homes in `~/BizAgent` (`homeRoot`). Written atomically; one bad file isolates its Home instead of stopping startup. |
37
+ | Organization structure | `organization.yaml`, `directory.yaml` | `directory.yaml` records each Home's owner, so editing `home.yaml` cannot change ownership. |
38
+ | Which organization is active | `homeRoot` | `active-organization.yaml`, naming the organization folder. |
39
+ | Session bindings, Frames, proposals, receipts, Inbox, learning reviews | DSH `storageDomain`, domain `bizagent` | Versioned records validated on read. |
40
+ | Formal Work, Projects, Worklogs | DSH `storageDomain`, their own domains | Frozen copies of their files are kept in the data folder of the Home they belong to: the organization folder, or `homeRoot` for personal Homes. |
41
+ | Conversations | DSH sessions | Assets point at session events as evidence. |
42
+
43
+ Only one DSH process may run BizAgent against the same data: startup takes a writer lock on
44
+ `$DSH_HOME`, `homeRoot`, and the organization folder, and a second process skips BizAgent with
45
+ "BizAgent writer is already reserved". A lock left by a crashed process is recovered on the next
46
+ start.
47
+
48
+ Backups need both halves: the Home folders (`bizagent archive export`, which records a digest of
49
+ every file) and DSH's own data directory.
50
+
51
+ ## A session, step by step
52
+
53
+ 1. DSH creates or resumes a session. BizAgent resolves its Home from the working directory and
54
+ records the binding once.
55
+ 2. BizAgent adds a Home snapshot (identity plus the index of active assets) and, if mail is
56
+ waiting, an Inbox digest. Both are skipped when the session already holds the current version.
57
+ A failure here never blocks the session; it is reported in the panel's health status.
58
+ 3. At DSH's `agent/pre-step` boundary, selected `@Agent` references are revalidated and resolved
59
+ into logged, bounded Home snapshots before the model request. Transport markers are removed
60
+ from the admitted user text. A failed load produces an explicit notice. A retry loads a full
61
+ snapshot again so cancelled admission cannot leave the model relying on an unlogged copy.
62
+ 4. The agent works. BizAgent tools read and write only the bound Home, except through proposals,
63
+ Inbox messages, Work, and Projects.
64
+ 5. At the end of a turn with an explicit correction, BizAgent asks the agent once to decide
65
+ whether to keep it.
66
+ 6. When the turn is saved, BizAgent records a Worklog for turns that used tools.
67
+
68
+ ## Native DSH surfaces
69
+
70
+ The organization workbench occupies DSH's keyed `main` panel and has a `sidebar.panellist`
71
+ entry. It shares navigation with the host instead of covering it with an application-wide modal.
72
+ The current Session remains available when returning to the conversation.
73
+
74
+ Session headers expose the bound Home, candidate/proposal counts, and My Inbox. The
75
+ `conversation.view` entry **Work & learning** shows Work directly dispatched from or assigned to
76
+ this exact Session, related Projects, and successful BizAgent tool results. Sidebar row decorations,
77
+ hover details, and a context-menu action identify Principals, Project Mains, workers, Inbox wakes,
78
+ and learning reviews. `conversation.chat.turnTail` shows receipts from the original completed turn.
79
+ An unfinished or failed tool call cannot produce a success receipt. Historical receipt status is
80
+ labelled separately from the current Work record. Runtime status is read from live DSH Agents;
81
+ an accepted Work does not imply a running worker.
82
+
83
+ Authenticated `/api/bizagent/v1/sessions` supplies a lightweight catalog without opening Session
84
+ logs or creating bindings. `/api/bizagent/v1/session-context` resolves one existing Session using
85
+ the same live/persisted lookup and trust checks as the Frame API. Browser readers share requests,
86
+ abort abandoned loads, stop polling when unobserved, and pause polling in hidden tabs. The Work
87
+ view shows the latest 20 Work records and the latest 100 successful activity records.
88
+
89
+ Sessions that BizAgent starts itself (Work workers, Inbox wake-ups, learning reviews, Principals,
90
+ Project Mains) join DSH's default agent preset, so they have the same built-in tools as sessions
91
+ you open, and use the host's current default model.
92
+
93
+ Opening a worker from the Work view uses the authenticated agent-session route to reveal an
94
+ already bound, locally owned Session in its Home Workspace. It does not recreate or start its
95
+ Agent, and ordinary conversations keep their existing Workspace. For the user path, see the
96
+ [quick start](quickstart.md#use-bizagent) or [Chinese user guide](user-guide.zh-CN.md).
97
+
98
+ ## Trust model
99
+
100
+ BizAgent is built for **one person on one machine**. It keeps agents honest about whose Home they
101
+ write to; it is not a sandbox.
102
+
103
+ What BizAgent enforces:
104
+
105
+ - **Tools act as the session's Home.** No tool writes another Home's assets, and an agent cannot
106
+ accept a proposal, review shared Knowledge, or accept a Project result.
107
+ - **People decide in the browser.** Acceptance and review routes require DSH's own web login
108
+ (the cookie DSH issues from the URL it prints), or a Bearer token from a private file that
109
+ scripts can use. Every BizAgent route also checks that the request comes from the loopback
110
+ address and the same origin, which blocks other websites and DNS rebinding.
111
+ - **The BizAgent API needs the DSH login too.** Other local programs cannot list or change Homes
112
+ through it without the login cookie.
113
+ - **Other Homes' text is fenced.** Messages, proposals, and Frame content from other Homes reach
114
+ the model marked as untrusted data, not instructions.
115
+ - **Work and wake-ups start only between Homes with the same owner.** Work for someone else's Home
116
+ waits until that Home picks it up itself.
117
+
118
+ What it does not do:
119
+
120
+ - **Agents can reach the files.** A Home's folder is also its working directory, and DSH agents
121
+ have shell and file tools. An agent can read or edit its own Home files directly, read other
122
+ folders your user can read, and could find a token file. BizAgent's rules rely on the agent
123
+ using BizAgent's tools. Ownership is checked against `directory.yaml`, and `bizagent doctor`
124
+ reports Home files that no longer load or no longer match their recorded owner.
125
+ - **No multiple users.** Everyone signed in to DSH acts as the owner. Hosts that need accounts
126
+ should mount the routes from `@bizagent/dsh/host` behind their own login.
127
+ - **No sandbox.** Use DSH's permission modes and sandbox settings to limit what agents may do on
128
+ your machine.
129
+
130
+ ## Compatibility
131
+
132
+ `@bizagent/dsh` declares its DSH packages as peer dependencies at `^0.2.1-rc.2`; its development
133
+ dependencies, installation guide, and runtime CI pin `0.2.1-rc.2`, also used for manual Web
134
+ acceptance. See [Verification](verification.md). DSH validates activation compatibility at startup.
135
+ BizAgent records
136
+ `schemaVersion` on every stored record and refuses records it does not understand rather than
137
+ guessing.
138
+
139
+ ## Source map
140
+
141
+ | File | Responsibility |
142
+ | --- | --- |
143
+ | [index.ts](../src/index.ts) | Plugin entry: wiring, DSH event hooks, system prompt section |
144
+ | [service.ts](../src/service.ts) | BizAgent operations behind the tools and routes |
145
+ | [home-store.ts](../src/home-store.ts) | Home folders, organizations, assets, doctor checks |
146
+ | [ledger.ts](../src/ledger.ts), [work-ledger.ts](../src/work-ledger.ts), [project-ledger.ts](../src/project-ledger.ts), [worklog-ledger.ts](../src/worklog-ledger.ts) | Records in DSH storage |
147
+ | [tools.ts](../src/tools.ts) | Agent tool definitions |
148
+ | [agent-preset.ts](../src/agent-preset.ts) | Sessions BizAgent starts join a preset and get a model |
149
+ | [work-runner.ts](../src/work-runner.ts), [inbox-wake-runner.ts](../src/inbox-wake-runner.ts), [learning-session-runner.ts](../src/learning-session-runner.ts) | Sessions started for Work, mail, and learning reviews |
150
+ | [ui-host.ts](../src/ui-host.ts), [local-human-host.ts](../src/local-human-host.ts) | HTTP routes for the panel and local reviews |
151
+ | [route-guard.ts](../src/route-guard.ts) | Loopback, origin, and DSH login checks for every route |
152
+ | [client/](../src/client/) | Browser panel |
153
+ | [session-surface.ts](../src/session-surface.ts) | Session catalog, current Work and Project summaries, durable tool-result receipts |
154
+ | [frame-admission.ts](../src/frame-admission.ts) | Selected Home snapshots at the DSH step admission boundary |
@@ -0,0 +1,192 @@
1
+ # Concepts
2
+
3
+ DSH runs sessions: one conversation with one model, tools, and a working directory. BizAgent adds
4
+ what lasts across sessions: who an agent is, what it has learned, and the work it shares with other
5
+ agents. This page explains each piece and where you see it in the DSH web app.
6
+
7
+ Start with the [quick start](quickstart.md) if you have not used the product yet.
8
+ Use the [documentation map](README.md) for configuration and developer references.
9
+
10
+ ## Homes
11
+
12
+ A **Home** is one long-running agent's identity and memory. It is a folder:
13
+
14
+ ```text
15
+ homes/personal--data-analyst-b3a9d31a/
16
+ home.yaml address, display name, owner, revision
17
+ identity.md who this agent is and what it is responsible for
18
+ memory/ insight/ knowledge/ method/ one Markdown file per learned asset
19
+ orders.csv files the agent works on (the folder is its working directory)
20
+ ```
21
+
22
+ Every Home has an **address** of the form `type:id`:
23
+
24
+ | Type | Use |
25
+ | --- | --- |
26
+ | `personal` | One member of the team: a person's own agent |
27
+ | `role` | A role several members can fill, such as Analytics |
28
+ | `capability` | A reusable skill or body of knowledge shared across roles |
29
+ | `business` | The organization's own Home: shared goals and decisions |
30
+ | `line` | The organization's product line, which coordinates its Projects |
31
+
32
+ Each Home has an **owner**, the person allowed to change it from outside: accept proposals into
33
+ it, accept the Projects it leads, and let other Homes start work in it. In the local setup you own
34
+ every Home BizAgent creates.
35
+
36
+ An **organization** is a set of Homes created together in their own folder,
37
+ `~/BizAgent/orgs/<organization-id>/`. That folder is also a DSH workspace: BizAgent adds it to the
38
+ top of the sidebar, named after the organization.
39
+
40
+ Your **personal Home**, `personal:default`, lives next to organizations in `~/BizAgent`, not inside
41
+ one. It is there whether or not an organization exists, and organization agents cannot read it.
42
+ An organization's members can also have `personal:` addresses. Home type and storage scope are
43
+ different: Learning groups your outside personal Home separately from organization Homes.
44
+
45
+ ## Sessions and Homes
46
+
47
+ Each DSH session is bound to exactly one Home, once, when it starts. The binding follows the
48
+ session's working directory:
49
+
50
+ 1. In a Home's folder (or a folder mapped with `workspaceHomes`): that Home.
51
+ 2. Anywhere else in the organization folder: the organization's business Home.
52
+ 3. Anywhere else, such as your own code repositories: your personal Home. Work outside the
53
+ organization never lands in the organization's memory.
54
+
55
+ **Chat** on a Home in the BizAgent panel opens that Home's long-term chat, its *Principal*.
56
+
57
+ From your personal Home you can still use the organization: open a read-only Frame on one of its
58
+ shared Homes, propose a lesson to it (the organization reviews it), or hand it a task by mail,
59
+ formal Work, or a Project you lead.
60
+
61
+ At the start of a session the agent receives:
62
+
63
+ - BizAgent's working rules, as part of the system prompt;
64
+ - a **Home snapshot**: the identity and a short index of active assets (descriptions only; the
65
+ agent reads full bodies on demand);
66
+ - a digest of unhandled Inbox messages, if any.
67
+
68
+ ## What a Home learns
69
+
70
+ The agent saves learning with `bizagent_memory_remember`. Each saved item is an **asset** of one
71
+ kind:
72
+
73
+ | Kind | Holds |
74
+ | --- | --- |
75
+ | `memory` | An observation in its context ("the March export had duplicate rows") |
76
+ | `insight` | An inference supported by observations |
77
+ | `knowledge` | An established fact or rule ("GMV excludes cancelled and refunded orders") |
78
+ | `method` | A repeatable procedure |
79
+
80
+ Every asset records its **evidence**: references to the session events it came from, which the
81
+ agent (and you) can read back. An asset has a status:
82
+
83
+ - `active`: in the Home's index; future sessions see it.
84
+ - `candidate`: saved but not yet trusted. The agent uses candidates when it still needs to check
85
+ something, then publishes the exact revision it reviewed.
86
+ - `superseded`, `retired`: kept for history, no longer used.
87
+
88
+ Edits create new revisions and refuse to overwrite a revision someone else changed in the
89
+ meantime.
90
+
91
+ When a later task uses an asset, the agent records whether it was **confirmed**, **contradicted**,
92
+ or **failed**. These receipts are the asset's track record (its *fitness*) and flag assets that
93
+ need review.
94
+
95
+ ### Corrections stick
96
+
97
+ When you explicitly correct an agent ("that's wrong, retention cohorts use first-active date"),
98
+ BizAgent notices at the end of the turn and asks the agent, once, to decide whether the
99
+ correction is worth keeping. Ordinary turns cost no extra model call.
100
+
101
+ ### Looking back
102
+
103
+ - **Worklogs** are short, searchable summaries tied to a session: BizAgent writes one for turns
104
+ that used tools, and agents write their own for results worth finding later. A Worklog can keep
105
+ exact copies of the files it mentions.
106
+ - **Learning reviews** let an agent go through earlier sessions and Worklogs it has not reviewed
107
+ yet, decide what (if anything) to keep, and record that each item was reviewed. A host can run
108
+ these reviews on a schedule in a separate session.
109
+
110
+ You see all of this under **Learning**: the memory strata, Worklogs, and the asset ledger with
111
+ each asset's revisions, evidence, and receipts.
112
+
113
+ ## Sharing between Homes
114
+
115
+ A session writes only to its own Home. Other Homes are reached in three governed ways:
116
+
117
+ - **Frames.** An agent can open a read-only Frame on another shared Home (not a personal one) to
118
+ search and read its active assets for the current conversation. Typing `@` in the DSH composer
119
+ offers shared Homes to select. A selected reference is loaded before the model request and its
120
+ state appears in the Frame bar. A Frame does not launch another agent or change the author Home.
121
+ - **Proposals.** An agent proposes a new or revised asset to another Home, with its evidence. The
122
+ target Home's owner accepts or rejects it under **Learning → (Home) → Proposal inbox**. An
123
+ accepted proposal becomes a new revision of the target Home.
124
+ - **Shared Knowledge.** For rules that belong to a whole product line or platform, agents propose
125
+ documents to a shared Knowledge store that every Home can search. The line Home's owner reviews
126
+ them in the BizAgent panel.
127
+
128
+ ## Working together
129
+
130
+ ### Inbox
131
+
132
+ Homes send each other **Inbox messages**: to and cc recipients, an optional deadline, normal or
133
+ urgent priority. The recipient handles a message from its own session; replies go back to the
134
+ session that asked when it is still around. Messages do not create obligations: a reply or a
135
+ "handled" mark is not completed work.
136
+
137
+ When the recipient Home has the same owner, BizAgent can start a session in it to read new mail.
138
+ Each Home's `inbox.json` sets when: `immediate`, `batch` (every 15 minutes, the default),
139
+ `scheduled` (a cron expression), or `carried` (only shown at the start of its next session).
140
+ Urgent messages always start one. Unanswered messages are nudged once. A conversation that reaches
141
+ 6 hops or 12 messages has to be closed with a conclusion message.
142
+
143
+ People have an Inbox too: messages to `user:<id>` appear under **My Inbox**.
144
+
145
+ ### Formal Work
146
+
147
+ When another Home must own a deliverable, an agent dispatches **formal Work**: a goal, acceptance
148
+ criteria, and an idempotency key. If both Homes have the same owner, BizAgent starts a worker
149
+ session in the assignee Home right away. The worker accepts the Work in that session and completes
150
+ it with one result, optionally freezing files from its `artifacts/` folder so the requester reads
151
+ exactly the delivered bytes. The result returns to the session that dispatched the Work. The
152
+ requester can cancel Work until a result is reserved.
153
+
154
+ Work statuses: `open` → `accepted` → `completing` → `completed`, or `cancelled`.
155
+
156
+ ### Projects
157
+
158
+ A **Project** is a longer goal with a written "done when" standard. Its lead Home creates it; the
159
+ Project gets its own chat (the *Project Main*), separate from the lead's Principal.
160
+
161
+ 1. The lead may invite shared Homes, such as roles and capabilities, as **Seats**, each with a
162
+ responsibility. Personal Homes cannot hold Seats; they take part through Work.
163
+ 2. It dispatches formal Work with the Project id to any Home; each assignee works in its own Home.
164
+ 3. When the linked Work is finished, it **submits** a result claim, with frozen files or a
165
+ delivered Work result as evidence.
166
+ 4. A person accepts the claim under **Projects**, or the lead or the person sends it back for
167
+ rework. An agent can never accept a Project result.
168
+
169
+ Project statuses: `open` → `awaiting_acceptance` → `accepted`.
170
+
171
+ ## Find the outcome
172
+
173
+ | Question | Where to look |
174
+ | --- | --- |
175
+ | Did the lesson save? | Session Home button → Learning; expand the body, evidence, and status |
176
+ | Did another Home take the task? | Work & learning → Work card → View worker Session |
177
+ | What did it deliver? | Expand the Work result; inspect the submitted Project files |
178
+ | Where can I accept it? | Project link → claim and review reason → Accept result; or Projects → My review queue |
179
+ | Where did the agent leave me a message? | My Inbox; reply there to return to the original session |
180
+
181
+ Agent runtime (`running`, `idle`, `unloaded`), Work delivery status, and Project acceptance are
182
+ separate facts. A worker can be idle after delivery while its Project still awaits human review.
183
+ The Work view is specific to the current session; Projects are scoped to the Home's participation.
184
+ Use the lead/project session or your review queue when a Project is not visible from a worker.
185
+ Turn receipts describe what was recorded then; read the current card/detail for its latest status.
186
+
187
+ ## You, the owner
188
+
189
+ BizAgent treats the person signed in to the DSH web app as the local owner. That person reviews
190
+ proposals, accepts Project results, and reads **My Inbox**. Agents cannot do any of these, even for
191
+ Homes they belong to. See [Architecture](architecture.md#trust-model) for what this protects
192
+ against and what it does not.