dsh-agent-lines 0.0.0-stage → 0.3.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.
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ English | [中文](CHANGELOG.md)
4
+
5
+ ## 0.3.1 (2026-11-04)
6
+
7
+ - README is now user-first: scenarios and install come first; technical details are later.
8
+ - Added install.sh, which picks the DSH Web profile automatically and verifies agent-lines.
9
+ - The npm 0.3.1 package now carries the same bilingual README and install docs as the public repo.
10
+ - No runtime behavior change; schema remains v6.
11
+
12
+ ## 0.3.0 (2026-11-04)
13
+
14
+ - Transport seam (`transport: sqlite` default).
15
+ - `line_create` resolves the manager workspace and passes `workspaceId`, so created lines are attached to the workspace instead of "Ungrouped"; optional `workspace` argument for an existing workspace.
16
+ - `line_move_workspace` attaches an existing line Session to a workspace whose path matches its cwd.
17
+ - Echo guards: self-send disabled by default, 5s default dedupe window, `maxReplyDepth` (default 8), `noReply` messages, and hop/root metadata.
18
+
19
+ - Read-only `line_status` visible to every Session, including unbound ones.
20
+ - `dsh-agent-lines claim --line manager --session <id>`: writes a durable claim request; the running plugin rebinds the manager line without a restart.
21
+ - `manager_bindings` persistence: the claimed manager Session survives a restart even when the profile config still names an older Session.
22
+ - Startup validates configured Sessions via `sessionPersistence.stat`; missing Sessions stay unbound instead of appearing online.
23
+ - `line_claim_manager` global tool: a live root Session can bind itself with `confirm: "bind-manager"`; CLI claim remains the fallback.
24
+ - `allowClaim` config gates claim polling (default false).
25
+ - Schema v6: `claim_requests`, `manager_bindings`, and message `hop`/`no_reply`/`root_message_id`.
26
+
27
+ ## 0.2.0 (2026-11-04)
28
+
29
+ - Multi-line support in one DSH process: `lines[]` config, Session→line mapping, per-line delivery loops and per-agent prompt sections.
30
+ - `line_create` for the configured manager line (`allowCreate`, `createFrom`): creates an ordinary DSH Session in the manager's cwd and registers it as a line.
31
+ - Idempotent creation by label (`created:false`) and `maxLines` bound (default 16).
32
+ - `role` and `created_by` columns with automatic migration; managers restore their created lines on startup.
33
+ - Legacy single-line config (`line`/`sessionId`) remains supported.
34
+ - Line tools are scoped to bound Sessions; unbound chats no longer see them.
35
+ - Process-exit lease release reduces `LINE_LEASE_HELD` after a fast restart.
36
+
37
+ ## 0.1.0 (2026-11-04)
38
+
39
+ - First MVP: local SQLite line registry and durable message queue.
40
+ - Owner-process delivery through `ctx.sessionController.prompt` with `requestId` idempotency.
41
+ - Leases, heartbeats, stale-claim recovery, exponential retry, TTL.
42
+ - Tools: `line_list`, `line_send`, `line_inbox`, `line_ack`.
43
+ - CLI: `list`, `send`, `inbox`, `ack`, `doctor`, `tail`.
44
+ - Explicit `delivered` vs `acked`; at-least-once with effectively-once Session log semantics.
45
+ - Local filesystem check (NFS/CIFS/SMB/FUSE refused).
46
+
47
+ Not included: HTTP transport, Web UI, Postgres adapter, automatic process wake.
package/CHANGELOG.md ADDED
@@ -0,0 +1,46 @@
1
+ # 更新记录
2
+
3
+ [English](CHANGELOG.en.md) | 中文
4
+
5
+ ## 0.3.1 (2026-11-04)
6
+
7
+ - README 改为用户优先:先场景、安装和首次使用,技术细节后置;安装/快速开始不再要求手填 profile。
8
+ - 新增 install.sh,自动选择 DSH Web profile,并检查 agent-lines 是否可用。
9
+ - 同步最新双语 README、Pages、安装说明;0.3.1 的 npm 包内文档与公开仓库一致。
10
+ - 无运行时行为变更;schema 仍为 v6。
11
+
12
+ ## 0.3.0 (2026-11-04)
13
+
14
+ - Transport 接缝(transport: sqlite 默认)。
15
+ - line_create 解析管理线工作区并传 workspaceId,新建线挂到工作区而不是“未分组”;可用 workspace 参数指定已有工作区。
16
+ - line_move_workspace 把已有线 Session 挂到 cwd 匹配的工作区。
17
+ - 回声保护:默认禁止 self-send、默认 5 秒去重窗口、maxReplyDepth(默认 8)、noReply 消息,以及 hop/root 元数据。
18
+ - 只读 line_status 对所有 Session 可见,包括未绑定 Session。
19
+ - line_claim_manager 全局工具:live 根 Session 可用 confirm: "bind-manager" 绑定为管理线;CLI claim 仍是兜底。
20
+ - dsh-agent-lines claim --agent ... --line manager --session ...:写入持久 claim 请求;运行中的插件无需重启即可重绑管理线。
21
+ - manager_bindings 持久化:已 claim 的管理 Session 跨重启保留,即使 profile 仍指向旧 Session。
22
+ - 启动时用 sessionPersistence.stat 校验配置的 Session;缺失的 Session 保持未绑定,不显示 online。
23
+ - allowClaim 控制 claim 轮询(默认 false)。
24
+ - Schema v6:claim_requests、manager_bindings,以及消息 hop/no_reply/root_message_id。
25
+
26
+ ## 0.2.0 (2026-11-04)
27
+
28
+ - 单 DSH 进程多线:lines[] 配置、Session→line 映射、每线投递循环和每 agent prompt section。
29
+ - line_create 面向配置的管理线(allowCreate、createFrom):在管理线 cwd 创建普通 DSH Session 并注册为线。
30
+ - 按 label 幂等创建(created:false)和 maxLines 限制(默认 16)。
31
+ - role 和 created_by 列及自动迁移;管理线启动时恢复自己创建的线。
32
+ - 兼容旧的单线配置(line/sessionId)。
33
+ - line 工具只对已绑定 Session 生效;未绑定聊天不再看到它们。
34
+ - 进程退出释放租约,减少快速重启后的 LINE_LEASE_HELD。
35
+
36
+ ## 0.1.0 (2026-11-04)
37
+
38
+ - 首个 MVP:本地 SQLite 线注册表和持久消息队列。
39
+ - owner 进程通过 ctx.sessionController.prompt + requestId 幂等投递。
40
+ - 租约、心跳、过期 claim 回收、指数重试、TTL。
41
+ - 工具:line_list、line_send、line_inbox、line_ack。
42
+ - CLI:list、send、inbox、ack、doctor、tail。
43
+ - 显式区分 delivered 和 acked;至少一次投递,Session 日志有效一次。
44
+ - 本地文件系统检查(拒绝 NFS/CIFS/SMB/FUSE)。
45
+
46
+ 未包含:HTTP transport、Web UI、Postgres adapter、自动拉起进程。
@@ -0,0 +1,31 @@
1
+ # Code of Conduct
2
+
3
+ English | [中文](CODE_OF_CONDUCT.md)
4
+
5
+ ## Our pledge
6
+
7
+ We pledge to make participation in this community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
8
+
9
+ ## Expected behavior
10
+
11
+ - Use welcoming and inclusive language.
12
+ - Respect differing viewpoints and experiences.
13
+ - Accept constructive criticism gracefully.
14
+ - Focus on what is best for the community.
15
+ - Show empathy toward other community members.
16
+
17
+ ## Unacceptable behavior
18
+
19
+ - Sexualized language or imagery, or unwelcome sexual attention.
20
+ - Trolling, insults, derogatory comments, or personal attacks.
21
+ - Public or private harassment.
22
+ - Publishing others' private information without permission.
23
+ - Other conduct that would be inappropriate in a professional setting.
24
+
25
+ ## Enforcement
26
+
27
+ Maintainers may remove, edit, or reject comments, commits, issues, pull requests, or other contributions that do not follow this code, and may temporarily or permanently ban violators.
28
+
29
+ Report violations through the repository owner's public contact. Do not expose personal information in a public issue.
30
+
31
+ This code follows the spirit of Contributor Covenant 2.1 and applies to project spaces and public spaces where someone represents the project.
@@ -0,0 +1,31 @@
1
+ # 行为准则
2
+
3
+ [English](CODE_OF_CONDUCT.en.md) | 中文
4
+
5
+ ## 我们的承诺
6
+
7
+ 为了让社区对所有人开放、友好,我们承诺不因年龄、体型、残障、 ethnicity、性别认同与表达、经验水平、国籍、外貌、种族、宗教或性取向而区别对待。
8
+
9
+ ## 期望行为
10
+
11
+ - 使用欢迎、包容的语言;
12
+ - 尊重不同观点和经验;
13
+ - 理性接受建设性批评;
14
+ - 关注对社区最好的结果;
15
+ - 对其他社区成员保持同理心。
16
+
17
+ ## 不可接受行为
18
+
19
+ - 性化语言或图像、不受欢迎的性关注;
20
+ - 挑衅、侮辱、贬损、人身攻击;
21
+ - 公开或私下骚扰;
22
+ - 未经许可发布他人隐私信息;
23
+ - 其他在专业环境中不合适的行为。
24
+
25
+ ## 执行
26
+
27
+ 维护者可以删除、编辑或拒绝不符合本准则的评论、提交、issue、PR 或其他贡献,并可临时或永久禁止违规者。
28
+
29
+ 请通过仓库 owner 的公开联系方式报告违规;不要在公开 issue 中暴露个人信息。
30
+
31
+ 本准则参考 Contributor Covenant 2.1 的精神,适用于项目空间和代表项目的公开场合。
@@ -0,0 +1,54 @@
1
+ # Contributing
2
+
3
+ English | [中文](CONTRIBUTING.md)
4
+
5
+ Thanks for contributing. This is a DSH community plugin, not an official DeepSeek product.
6
+
7
+ ## What to contribute
8
+
9
+ - New transports (SQLite is current; HTTP is a future direction).
10
+ - New tools/CLI capabilities that preserve the 0.3 single-writer and manager model.
11
+ - Docs, examples, integration reports.
12
+ - Reproducible bugs and minimal fixes.
13
+ - Tests and protocol consistency.
14
+
15
+ ## Development
16
+
17
+ - Node.js ^22.19.0 or >=24.
18
+ - DSH >=0.2.1-rc.5 <0.3.0.
19
+ - Local filesystem only (SQLite refuses NFS/CIFS/SMB/FUSE).
20
+
21
+ git clone https://github.com/Lencen/dsh-agent-lines.git
22
+ cd dsh-agent-lines
23
+ npm install
24
+ npm test
25
+
26
+ ## Before a PR
27
+
28
+ npm test
29
+ npm pack --dry-run
30
+
31
+ Rules:
32
+
33
+ - Tests pass.
34
+ - The package has no test fixtures, temporary DBs, local paths, or credentials.
35
+ - Document compatibility when changing public APIs.
36
+ - Do not commit node_modules, *.tgz, .env, or lines.db.
37
+ - Do not post real Session content, tokens, or customer data in logs/issues.
38
+
39
+ ## PR rules
40
+
41
+ 1. One concern per PR.
42
+ 2. Include the reproduction/verification command and result.
43
+ 3. Protocol/state changes update docs/PROTOCOL.en.md and docs/ARCHITECTURE.en.md.
44
+ 4. Install/upgrade changes update docs/DEPLOY.en.md.
45
+ 5. Add tests for new behavior; explain any untested fix.
46
+ 6. Follow CODE_OF_CONDUCT.md.
47
+
48
+ ## Security
49
+
50
+ Do not open a public issue for vulnerabilities. See SECURITY.md.
51
+
52
+ ## License
53
+
54
+ Contributions are Apache-2.0 (inbound = outbound).
@@ -0,0 +1,54 @@
1
+ # 贡献指南
2
+
3
+ [English](CONTRIBUTING.en.md) | 中文
4
+
5
+ 感谢你愿意贡献。这个项目是 DSH 社区插件,不是 DeepSeek 官方产品。
6
+
7
+ ## 适合贡献什么
8
+
9
+ - 新 transport(当前只有 SQLite,HTTP 是未来方向);
10
+ - 新 tool / CLI 能力,但不要改变 0.3 的单 writer 和 manager 模型;
11
+ - 文档、示例、集成报告;
12
+ - 可复现的 bug 和最小修复;
13
+ - 测试和协议一致性改进。
14
+
15
+ ## 开发环境
16
+
17
+ - Node.js ^22.19.0 或 >=24;
18
+ - DSH >=0.2.1-rc.5 <0.3.0;
19
+ - 本地文件系统(SQLite 不支持 NFS/CIFS/SMB/FUSE)。
20
+
21
+ git clone https://github.com/Lencen/dsh-agent-lines.git
22
+ cd dsh-agent-lines
23
+ npm install
24
+ npm test
25
+
26
+ ## 提交前检查
27
+
28
+ npm test
29
+ npm pack --dry-run
30
+
31
+ 要求:
32
+
33
+ - 测试通过;
34
+ - pack 不包含 test、临时 DB、本地路径、凭据;
35
+ - 不改变公开 API 时,说明兼容性;
36
+ - 不提交 node_modules、*.tgz、.env、lines.db;
37
+ - 不在日志或 issue 中放真实 Session 内容、token、客户数据。
38
+
39
+ ## PR 约定
40
+
41
+ 1. 一个 PR 只做一件事;
42
+ 2. 写清复现/验证命令和结果;
43
+ 3. 涉及协议/状态的改动要同步 docs/PROTOCOL.md 和 docs/ARCHITECTURE.md;
44
+ 4. 涉及安装/升级的改动要同步 docs/DEPLOY.md;
45
+ 5. 新增行为要有测试;没有测试的修复请说明原因;
46
+ 6. 遵守 [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)。
47
+
48
+ ## 安全
49
+
50
+ 漏洞不要开公开 issue,按 [SECURITY.md](SECURITY.md) 报告。
51
+
52
+ ## 许可
53
+
54
+ 贡献按 Apache-2.0 授权(inbound = outbound)。
package/LICENSE ADDED
@@ -0,0 +1,55 @@
1
+ Apache License
2
+
3
+ Version 2.0, January 2004
4
+
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
16
+
17
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
18
+
19
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
20
+
21
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
22
+
23
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
24
+
25
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
26
+
27
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
28
+
29
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
30
+
31
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
32
+
33
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
34
+
35
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
36
+
37
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
38
+
39
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
40
+
41
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
42
+
43
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ dsh-agent-lines
2
+ Copyright 2026 Lencen and dsh-agent-lines contributors
3
+
4
+ This package is designed for DeepSeek Harness (MIT). No DeepSeek Harness source code is copied into this package.
package/README.en.md ADDED
@@ -0,0 +1,267 @@
1
+ # dsh-agent-lines
2
+
3
+ English | [中文](README.md)
4
+
5
+ > Community plugin for DeepSeek Harness. Not an official DeepSeek product.
6
+
7
+ > **100% Vibe Coding.** The architecture, code, tests, and docs were produced in AI agent sessions. It is experimental: review the code and run an integration test before production use.
8
+
9
+ A drop-in super-agent alternative for DSH.
10
+
11
+ Stop reopening sessions and copying context by hand. Give one lead agent a long-lived team: each member has a name and a role, messages survive restarts, and the lead collects and reports the results.
12
+
13
+ ## When to use it
14
+
15
+ Use it when:
16
+
17
+ - You have a long-running project and do not want to re-explain the background every time.
18
+ - You want several agents to keep stable roles: research, architecture, UI/UX, development, testing, release, and operations.
19
+ - You need a fixed name for each role, so you can assign work directly.
20
+ - Work must survive closing a window or restarting DSH: messages and context should still be there.
21
+ - You want one lead agent to decompose work, create the team, track progress, collect results, and report back.
22
+
23
+ If you only need temporary child tasks inside one session, use DSH subagents / Agent Teams; you do not need this plugin.
24
+
25
+ ## Install
26
+
27
+ One-command install (recommended; no need to find a profile):
28
+
29
+ curl -fsSL https://raw.githubusercontent.com/Lencen/dsh-agent-lines/main/install.sh -o install.sh
30
+ bash install.sh
31
+
32
+ The script picks the DSH Web profile, installs the plugin, and verifies agent-lines. If it cannot decide, it lists existing profiles and tells you how to specify one.
33
+
34
+ Offline or when npm is unavailable, use the local tarball:
35
+
36
+ bash install.sh ./dsh-agent-lines-0.3.1.tgz
37
+
38
+ When it finishes, the script prints the path to the manager config file. Paste the "Manager config" block below into that file once.
39
+
40
+ ### Manager config
41
+
42
+ ```yaml
43
+ - id: agent-lines
44
+ name: dsh-agent-lines
45
+ config:
46
+ agentId: agent-demo
47
+ dbPath: /home/me/.dsh/agent-lines/lines.db
48
+ allowCreate: true
49
+ allowClaim: true
50
+ allowSelfSend: false
51
+ dedupeWindowMs: 5000
52
+ maxReplyDepth: 8
53
+ createFrom: manager-line
54
+ maxLines: 16
55
+ childPreset: standard
56
+ lines:
57
+ - label: manager-line
58
+ sessionId: session-lines-manager
59
+ role: 任务对接、拆解与调度
60
+ ```
61
+
62
+ Only `createFrom` may call `line_create`. Worker profiles should leave `allowCreate` false.
63
+
64
+ ## Quick start
65
+
66
+ 1. Run the installer above.
67
+ 2. Open the config file printed by the installer and paste the "Manager config" block once.
68
+ 3. Start DSH Web and open any root Session.
69
+ 4. Call line_status; if the Session is not bound, call line_claim_manager({ confirm: "bind-manager" }).
70
+ 5. Say "create the first-use team"; wait for the member lines, then send the first task separately.
71
+
72
+ ## First use: build a development team
73
+
74
+ Copy this into a new root Session. The prompt starts with binding, then creates one team. Replace the task later; do not let the manager execute the work.
75
+
76
+ > Use dsh-agent-lines. If this Session is not yet bound, call line_claim_manager with confirm "bind-manager". You are the development team lead: own task decomposition, assignment, communication, progress tracking, result collection, summary, and reporting. You only manage and coordinate; do not execute specific development tasks.
77
+ >
78
+ > Create these member lines with line_create. Use ASCII labels and Chinese roles:
79
+ > research (调研), architecture (架构), uiux (UIUX), dev (开发), test (测试), acceptance (验收), release (发布), ops (运维).
80
+ >
81
+ > After creation, call line_list to confirm, then wait for my first task. Do not start work by yourself.
82
+
83
+ Why ASCII labels: line labels are identifiers such as <code>research</code>; Chinese is the <code>role</code> text, not the label. This prompt creates one team. Version 0.3 does not support multiple simultaneous teams in one plugin instance.
84
+
85
+ Copyable calls (the manager Session runs these):
86
+
87
+ ~~~js
88
+ line_create({ label: "research", role: "调研" })
89
+ line_create({ label: "architecture", role: "架构" })
90
+ line_create({ label: "uiux", role: "UIUX" })
91
+ line_create({ label: "dev", role: "开发" })
92
+ line_create({ label: "test", role: "测试" })
93
+ line_create({ label: "acceptance", role: "验收" })
94
+ line_create({ label: "release", role: "发布" })
95
+ line_create({ label: "ops", role: "运维" })
96
+ ~~~
97
+
98
+ After creation, call line_list to confirm.
99
+
100
+ ![First use: bind manager, create 8 member lines, list them](docs/assets/first-use.gif)
101
+
102
+ Actual DSH Web demo profile, generic labels; no internal data.
103
+
104
+ ## Scenario: one manager, several execution lines
105
+
106
+ The lead creates the team first; the work comes next.
107
+
108
+ 1. The lead creates members by role: research, architecture, UI/UX, development, testing, acceptance, release, operations.
109
+ 2. You give the lead one concrete task, for example "add CSV export to the reports page, with tests and a one-page runbook."
110
+ 3. The lead decomposes it and sends each part to the right member; every message stays local.
111
+ 4. Members receive the task, execute it, acknowledge it, and reply to the lead when needed.
112
+ 5. The lead collects results, resolves disagreements, and aligns the answer.
113
+ 6. You see the lead's summary; each member keeps its own context and message history.
114
+
115
+ This is a prompt-driven team pattern, not a built-in org chart: the lead model decides how to split work. Technical details are in "Use" and "Delivery semantics" below.
116
+
117
+ ## Use
118
+
119
+ A manager can be driven entirely by conversation:
120
+
121
+ > You are the manager line. Create frontend-line, backend-line and ops-line with `line_create`, then list them with `line_list`.
122
+
123
+ Tools:
124
+
125
+ | Tool | Purpose |
126
+ |---|---|
127
+ | `line_status` | Read-only: current Session binding, manager Session live/persisted, lines, repair command; visible even when unbound |
128
+ | `line_claim_manager` | Bind this live root Session as manager; requires `allowClaim: true` and `confirm: "bind-manager"`; global, no shell needed |
129
+ | `line_list` | List lines, status, unread counts, current line and role |
130
+ | `line_create` | Manager only: create a DSH Session in the manager workspace (or a named existing workspace) and register it as a line; same label is idempotent |
131
+ | `line_move_workspace` | Manager only: attach an existing line Session to a workspace whose path exactly matches the Session cwd |
132
+ | `line_send` | Send to `line` or `agent#line`; optional `idempotencyKey`, `replyTo`, `noReply`, `forceDistinct`, `ttlMs` |
133
+ | `line_inbox` | Read delivered messages for the current line |
134
+ | `line_ack` | Acknowledge a delivered message |
135
+
136
+ Line tools other than `line_status` and `line_claim_manager` are registered only on Sessions bound to a line. Both control tools are global: `line_status` is read-only, and `line_claim_manager` is root-only and gated by `allowClaim`.
137
+
138
+ `line_create` creates an ordinary DSH Session in the manager workspace (or in the manager cwd when no workspace exists). It does **not** create a separate OS process, profile, or port; all lines in that call share the DSH process. It also does not transfer an existing Session.
139
+
140
+ Created lines are recorded with `created_by` and restored by the manager on process startup. line_create uses the manager's workspace (workspaceId, so DSH attaches the Session) when one exists; otherwise it falls back to the manager cwd and the line is ungrouped. Pass `workspace` (existing path or id) to create in another workspace. A line whose Session was never materialized may fail on first delivery with `session/not-found`; send it a task (or recreate it) to persist the Session.
141
+
142
+ CLI:
143
+
144
+ ```bash
145
+ dsh-agent-lines list
146
+ dsh-agent-lines send --from frontend-line --to backend-line --text "hi"
147
+ dsh-agent-lines inbox --line backend-line
148
+ dsh-agent-lines ack --line backend-line --id msg_...
149
+ dsh-agent-lines claim --agent agent-demo --line manager --session "$DSH_SESSION_ID"
150
+ dsh-agent-lines doctor
151
+ ```
152
+
153
+ Use `--db` or `DSH_AGENT_LINES_DB` to point the CLI at the plugin's database.
154
+
155
+ ## Transports
156
+
157
+ `transport` defaults to `sqlite` (local-first) and is the only transport shipped in 0.3. Installing the plugin never requires Postgres or a Python service.
158
+
159
+ ## Architecture
160
+
161
+ ~~~mermaid
162
+ flowchart LR
163
+ U[User] --> M[Manager DSH Session]
164
+ M -->|line_create / line_send| P[dsh-agent-lines]
165
+ P --> Q[(SQLite lines.db)]
166
+ P -->|prompt requestId| W1[Worker line Session A]
167
+ P -->|prompt requestId| W2[Worker line Session B]
168
+ W1 -->|line_inbox / line_ack| P
169
+ W2 -->|line_inbox / line_ack| P
170
+ ~~~
171
+
172
+ The DSH adapter owns line identity and delivery into a Session; the transport owns durable messages and cross-process storage. The default transport is local SQLite. Public architecture: [English](docs/ARCHITECTURE.en.md) | [中文](docs/ARCHITECTURE.md).
173
+
174
+ ## Requirements
175
+
176
+ - DSH `>=0.2.1-rc.5 <0.3.0`
177
+ - Node.js `^22.19.0 || >=24.0.0`
178
+ - A local filesystem for the SQLite database (NFS/CIFS/SMB/FUSE are refused)
179
+
180
+ ## Workspaces
181
+
182
+ DSH groups Sessions by workspace membership, not by cwd. line_create resolves the
183
+ manager's workspace with workspaceRegistry.resolveByPath and passes workspaceId,
184
+ so the new Session is attached and appears under that workspace instead of
185
+ "Ungrouped". If the manager has no workspace, the plugin falls back to cwd; the
186
+ line remains ungrouped until a workspace is created/attached.
187
+
188
+ line_move_workspace attaches an existing line to a target workspace. DSH itself
189
+ only allows attachment when the Session cwd exactly equals the workspace path;
190
+ the plugin returns WORKSPACE_ATTACH_FAILED otherwise. It does not move a Session
191
+ between different directories (that would require a new Session/handover).
192
+
193
+ ## Manager binding and claim
194
+
195
+ The manager line is a real DSH Session. If you open a different Session, it is not the manager and the line tools are intentionally absent. Use `line_status` to see the configured manager and repair instructions.
196
+
197
+ A root Session can bind itself without a shell:
198
+
199
+ ```json
200
+ line_claim_manager({ "confirm": "bind-manager" })
201
+ ```
202
+
203
+ The tool validates that the caller is a live root, releases the old manager lease, rebinds the manager line, and persists the choice in `manager_bindings`. No profile edit or restart is needed. It requires `allowClaim: true`.
204
+
205
+ An operator can still use the CLI:
206
+
207
+ ```bash
208
+ dsh-agent-lines claim --agent agent-demo --line manager --session "$DSH_SESSION_ID"
209
+ ```
210
+
211
+ Claim is never automatic for every new Session: it needs an explicit user request or an explicit CLI call.
212
+
213
+ ## Echo and duplicate protection
214
+
215
+ - Same `idempotencyKey` returns the existing message.
216
+ - Without a key, identical sends within `dedupeWindowMs` (default 5s) collapse to one; use `forceDistinct: true` for two intentional identical messages.
217
+ - `replyTo` increments `hop`; over `maxReplyDepth` (default 8) is rejected with `LINE_REPLY_DEPTH_EXCEEDED`.
218
+ - A `noReply: true` message cannot be replied to; attempts fail with `LINE_NO_REPLY`.
219
+ - Self-send is rejected by default (`LINE_SELF_SEND_FORBIDDEN`); set `allowSelfSend: true` only for deliberate notes.
220
+
221
+ This is transport-level protection. It does not guarantee that two agents will not choose to keep chatting; use `noReply` and reply depth for that.
222
+
223
+ ## Delivery semantics
224
+
225
+ `queued → claimed → delivered → acked`
226
+
227
+ - `delivered` means the target DSH Session accepted the prompt.
228
+ - `acked` means an agent explicitly called `line_ack`.
229
+ - Delivery is **at-least-once**; DSH's `requestId` idempotency makes retries effectively-once in the Session log. It is not a distributed exactly-once guarantee.
230
+ - An offline receiver keeps messages queued; 0.3 has no automatic process wake.
231
+ - **One Session, one writer.** Do not open a line's Session in another DSH process (for example the main Web UI). DSH rejects delivery with `session/writer-held`; close the other view or use a dedicated Session.
232
+
233
+ ## Security
234
+
235
+ - The plugin runs in the DSH Host process with host permissions. Install only packages you trust.
236
+ - Default transport is local SQLite; no network listener in 0.3.
237
+ - Only the configured manager line can create lines; `maxLines` bounds growth.
238
+ - Peer messages are marked as peer content, not user instructions.
239
+ - See [docs/SECURITY.en.md](docs/SECURITY.en.md).
240
+
241
+ ## Limitations
242
+
243
+ - No handover; no move of a Session between different directories.
244
+ - Same-process multi-line, not process isolation.
245
+ - One manager/team per plugin instance. Simultaneous teams (for example development and novel) in one DSH process are not supported; separate profile/DB is only a workaround, not the product model.
246
+ - No `line_delete`; a created line is durable, so testing creates real rows.
247
+ - A blank line Session may need its first task before it is persisted.
248
+ - DSH allows one writer per Session; do not open a line Session from another DSH process.
249
+
250
+ ## Status
251
+
252
+ Experimental `0.3.x`. DSH is in developer preview and its APIs can change. Pin both the DSH version and this plugin's version.
253
+
254
+ ## Credits
255
+
256
+ - Human vibecoding: **Lencen**
257
+ - Development agent: **DeepSeek Harness agent (DSH)**
258
+ - Model: **deepseek v4.1 flash 1017**
259
+ - Contact: [iamlencen@qq.com](mailto:iamlencen@qq.com)
260
+
261
+ ## Contributing
262
+
263
+ See [CONTRIBUTING.en.md](CONTRIBUTING.en.md); code of conduct [CODE_OF_CONDUCT.en.md](CODE_OF_CONDUCT.en.md); docs site [lencen.github.io/dsh-agent-lines](https://lencen.github.io/dsh-agent-lines/).
264
+
265
+ ## License
266
+
267
+ Apache-2.0. See [LICENSE](LICENSE).