dsh-jiezi 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 (64) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE +21 -0
  3. package/README.md +122 -2
  4. package/cordis.patch.yml +164 -0
  5. package/docs/DETAIL.md +111 -0
  6. package/icon.svg +10 -0
  7. package/lib/bridge/bridge.js +1532 -0
  8. package/lib/bridge/build.js +318 -0
  9. package/lib/bridge/cli.js +213 -0
  10. package/lib/bridge/doctor.js +205 -0
  11. package/lib/bridge/package.json +16 -0
  12. package/lib/bridge/project-init.js +212 -0
  13. package/lib/bridge/protocol.js +316 -0
  14. package/lib/bridge/store.js +212 -0
  15. package/lib/bridge/templates/adapter/index.d.ts +238 -0
  16. package/lib/bridge/templates/adapter/index.js +5 -0
  17. package/lib/bridge/templates/adapter/package.json +13 -0
  18. package/lib/bridge/templates/adapter/runtime.js +37 -0
  19. package/lib/bridge/templates/basic/App.test.tsx +9 -0
  20. package/lib/bridge/templates/basic/App.tsx +37 -0
  21. package/lib/bridge/templates/basic/README.md +13 -0
  22. package/lib/bridge/templates/basic/gitignore.template +7 -0
  23. package/lib/bridge/tls.js +40 -0
  24. package/lib/bridge/version.js +19 -0
  25. package/lib/bridge/ws.js +290 -0
  26. package/lib/client.js +2466 -0
  27. package/lib/host/apple-device-host.js +307 -0
  28. package/lib/host/bridge-client.js +214 -0
  29. package/lib/host/bridge-supervisor.js +139 -0
  30. package/lib/host/index.js +162 -0
  31. package/lib/host/operations.js +681 -0
  32. package/lib/host/setup.js +217 -0
  33. package/lib/host/tools.js +531 -0
  34. package/lib/index.js +2 -0
  35. package/lib/shared/errors.js +118 -0
  36. package/lib/shared/protocol.js +538 -0
  37. package/lib/tools.js +2 -0
  38. package/locale/en.json +7 -0
  39. package/locale/zh.json +7 -0
  40. package/package.json +86 -4
  41. package/skills/jiezi-miniapp/SKILL.md +136 -0
  42. package/skills/jiezi-miniapp/api/README.md +49 -0
  43. package/skills/jiezi-miniapp/api/jiezi/native/README.md +22 -0
  44. package/skills/jiezi-miniapp/api/jiezi/native/index.d.ts +238 -0
  45. package/skills/jiezi-miniapp/api/jiezi/native/index.js +5 -0
  46. package/skills/jiezi-miniapp/api/jiezi/native/package.json +13 -0
  47. package/skills/jiezi-miniapp/api/jiezi/native/runtime.js +37 -0
  48. package/skills/jiezi-miniapp/api/nsh/assets.d.ts +121 -0
  49. package/skills/jiezi-miniapp/api/nsh/base/plot.d.ts +606 -0
  50. package/skills/jiezi-miniapp/api/nsh/base.d.ts +6535 -0
  51. package/skills/jiezi-miniapp/api/nsh/desktop.d.ts +630 -0
  52. package/skills/jiezi-miniapp/api/nsh/globals.d.ts +566 -0
  53. package/skills/jiezi-miniapp/api/nsh/i18n.d.ts +25 -0
  54. package/skills/jiezi-miniapp/api/nsh/index.d.ts +2139 -0
  55. package/skills/jiezi-miniapp/api/nsh/jsx-runtime.d.ts +3 -0
  56. package/skills/jiezi-miniapp/api/nsh/mobile.d.ts +156 -0
  57. package/skills/jiezi-miniapp/api/nsh/test.d.ts +647 -0
  58. package/skills/jiezi-miniapp/api/nsh/tokens.d.ts +39 -0
  59. package/skills/jiezi-miniapp/api/nsh/types.d.ts +1638 -0
  60. package/skills/jiezi-miniapp/api/nsh/updater.d.ts +97 -0
  61. package/skills/jiezi-miniapp/api/nsh/web.d.ts +40 -0
  62. package/skills/jiezi-miniapp/references/components.md +190 -0
  63. package/skills/jiezi-miniapp/references/device-verification-and-repair.md +98 -0
  64. package/skills/jiezi-miniapp/references/source-and-capabilities.md +108 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ 本文件记录每个公开发布版本的变更;格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),
4
+ 版本号遵循 [SemVer](https://semver.org/lang/zh-CN/)。
5
+
6
+ ## [1.0.0] - 2026-11-23
7
+
8
+ 首个公开发布。对应内部 `@local/jiezi-builder` 0.8.3 的能力,包名独立为 `dsh-jiezi`,
9
+ 并补齐公开分发需要的元数据与发布流程。
10
+
11
+ ### 新增
12
+
13
+ - `miniapp_init`:从空目录初始化 Native Shell TSX 项目,并在构建前预检开发证书对 `appId` 的覆盖范围
14
+ (结果里的 `signing` 与 `warnings`)。
15
+ - `projectLayout` 配置:默认 `working-directory`(会话工作目录本身就是项目根,目录必须为空);
16
+ `named-subdirectory` 时建 `<工作目录>/<projectId>`。
17
+ - 自带的 `jiezi-miniapp` skill、十二个 `miniapp_*` 工具、`芥子开发模式` 预设、侧栏配对面板。
18
+ - 随包桥接快照 `vendor/bridge`(`jiezi-bridge` 0.3.3),Host 按精确版本锁复用它。
19
+ - 可选依赖 `jiezi-nsh-darwin-arm64@0.6.0`:macOS arm64 上开箱可用 `nsh`。
20
+
21
+ ### 变更
22
+
23
+ - 包名 `@local/jiezi-builder` → `dsh-jiezi`;客户端模块 id、cordis 行名、skill 根解析同步更新。
24
+ - 声明 `engines.dsh`:`>=0.2.2-rc.1 <0.3.0`。
25
+
26
+ ### 未验证
27
+
28
+ - 真机部署/视觉验证需要已配对设备,本次发布未在有物理设备的环境里跑完整链路。
29
+
30
+ [1.0.0]: https://github.com/FengWuFei/dsh-jiezi/releases/tag/v1.0.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 FengWuFei
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,123 @@
1
- # Temporary Holding Version
1
+ # 芥子开发模式 · dsh-jiezi
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
+ [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 上的小程序开发插件:给 Agent 一套真正能用的
4
+ 「初始化 → 编写 → 构建 → 签名 → 真机验证 → 修」闭环,外加一个负责初始化、配对和交付记录的侧栏面板。
5
+
6
+ - **一个 Agent 预设**:`芥子开发模式`(官方标准 Agent 能力 + 芥子工具,不是封闭的小程序工具集)。
7
+ - **十二个 `miniapp_*` 工具**:初始化、构建、部署、状态、界面树、语义操作、截图、录屏、诊断、设备与自动化。
8
+ - **一个自带 skill**:`jiezi-miniapp`,讲清 Native Shell TSX、能力声明、真机验证与按诊断修复。
9
+ - **一个侧栏面板**:显示桥接状态、配对二维码、设备、最近交付与最近自动化。
10
+
11
+ ## 安装
12
+
13
+ 要求 DeepSeek Harness `0.2.2-rc.1` 及以上(`0.2.x`),macOS arm64 可直接使用;其他平台需要自备 Native Shell 工具链。
14
+
15
+ **方式一:插件索引(推荐)。** 在 DSH 的「插件 → 发现」里点「添加索引源」,填入:
16
+
17
+ ```
18
+ https://raw.githubusercontent.com/FengWuFei/dsh-jiezi/main/index.json
19
+ ```
20
+
21
+ GitHub 直连不畅时换成 jsDelivr 镜像(可能比最新发布晚最多 12 小时):
22
+
23
+ ```
24
+ https://cdn.jsdelivr.net/gh/FengWuFei/dsh-jiezi@main/index.json
25
+ ```
26
+
27
+ 列表里会出现「芥子开发模式」,点安装即可 —— 装的就是 npm 上的 `dsh-jiezi`,索引只是省掉手输包名。
28
+ 看不到「发现」时,先在「设置 → 实验性插件」里启用插件索引。
29
+
30
+ **方式二:直接装 npm 包。** 在「插件」页添加插件处输入包名 `dsh-jiezi`,或在终端:
31
+
32
+ ```sh
33
+ dsh plugin --profile desktop add dsh-jiezi
34
+ dsh plugin --profile web add dsh-jiezi
35
+ ```
36
+
37
+ 装好后按 DSH 的提示重启(替换已安装插件需要重启才能加载新的 Host 代码)。
38
+
39
+ 离线安装:到 [Releases](https://github.com/FengWuFei/dsh-jiezi/releases/latest) 下载
40
+ `dsh-jiezi-<版本>.tgz`,添加插件时填 `file:/绝对路径/dsh-jiezi-<版本>.tgz`。
41
+
42
+ ## 更新
43
+
44
+ 插件从 npm 安装后,DSH 的「插件」页会比较 npm 上的新版本:有更新时列表顶部显示「N 个插件可更新」,
45
+ 点进插件可以看到版本列表并一键升级,DSH 会自己下载、安装并提示重启 —— 不需要手动改任何文件。
46
+
47
+ 版本遵循 [SemVer](https://semver.org/lang/zh-CN/):补丁号修缺陷,次版本号加能力,主版本号做不兼容变更。
48
+ 每个版本的变更见 [CHANGELOG.md](CHANGELOG.md),每个版本也都在 GitHub Releases 里附了可直接离线安装的 tgz。
49
+
50
+ ## 第一次使用
51
+
52
+ 1. 装好重启后,侧栏出现「芥子」。打开面板,点「初始化开发环境」—— 它会在 `~/.jiezi` 创建开发密钥、
53
+ TLS 配置和桥接状态,只在你点击后执行,激活插件本身不会创建任何信任材料。
54
+ 2. 点面板里的配对二维码,用装了芥子宿主 App 的 iPhone 扫描,完成一次配对。
55
+ 3. 新建一个空目录作为会话工作目录,选「芥子开发模式」预设开始对话。对 Agent 说「用 miniapp_init 初始化一个
56
+ 叫 hello 的小程序」,之后 `miniapp_build` → `miniapp_deploy` → `miniapp_ui` / `miniapp_action` 验证。
57
+
58
+ `miniapp_init` 默认把**会话工作目录本身**当作项目根(目录必须为空);一个目录想放多个小程序时,把
59
+ `jiezi-tools` 行的配置改成 `projectLayout: named-subdirectory`,它会建 `<工作目录>/<projectId>`。
60
+
61
+ ## 工具
62
+
63
+ | 工具 | 作用 |
64
+ |---|---|
65
+ | `miniapp_init` | 从空目录初始化 Native Shell 项目,并预检签名证书覆盖范围 |
66
+ | `miniapp_build` | 构建并签名,返回不可变 release(含 sha256) |
67
+ | `miniapp_deploy` | 把已签名 release 安装到配对设备 |
68
+ | `miniapp_status` | 查看当前安装、运行时与桥接状态 |
69
+ | `miniapp_ui` | 读取语义界面树(testID、标签、值、层级) |
70
+ | `miniapp_action` | 点击、输入、滚动、断言(失败按数据返回,不会假装成功) |
71
+ | `miniapp_capture` / `miniapp_screen` | 截图与录屏 |
72
+ | `miniapp_diagnostics` | 取设备侧诊断事件 |
73
+ | `miniapp_device` / `miniapp_devices` | 选择、恢复与列出可部署目标 |
74
+ | `miniapp_open` | 重启宿主后直接打开已安装的小程序 |
75
+
76
+ ## 配置
77
+
78
+ 两行插件都接受 `{ socketPath, stateDir, bridgeCliPath, autoStart, timeoutMs }`;`jiezi-tools` 另接受
79
+ `projectLayout`。默认值:`socketPath` 为 `$JIEZI_BRIDGE_SOCKET` 或 `~/.jiezi/bridge.sock`,`stateDir` 取它的父目录,
80
+ `bridgeCliPath` 依次找 `$JIEZI_BRIDGE_CLI`、包内 `lib/bridge/cli.js`、仓库里的 `vendor/bridge/src/cli.js`。
81
+
82
+ ## 环境要求与边界
83
+
84
+ - **DSH**:`>=0.2.2-rc.1 <0.3.0`(写进 `engines.dsh`,不满足时插件管理器会拒绝安装)。
85
+ - **Native Shell 工具链**:macOS arm64 由可选依赖 `jiezi-nsh-darwin-arm64` 提供;其他平台需自己安装 `nsh`
86
+ 并通过 `NSH_TOOLCHAIN` 或 `PATH` 暴露。没有 `nsh` 时初始化/构建会失败,诊断里会说明。
87
+ - **设备**:部署、截图、语义验证需要装了芥子宿主 App 的模拟器或已配对 iPhone;纯构建签名不需要设备。
88
+ - **不包含**:芥子 iOS App、生产签名证书与 Linux 构建服务。插件只负责开发态的构建、调试与交付。
89
+ - 插件不会读取或转存模型供应商凭据;桥接子进程只继承 PATH、HOME、TMPDIR、`NSH*`、`DEVELOPER_DIR` 等最小环境。
90
+
91
+ ## 开发
92
+
93
+ ```sh
94
+ npm install
95
+ npm run typecheck # tsc --noEmit
96
+ npm run build # esbuild → lib/*.js,并把 vendor/bridge 复制进 lib/bridge
97
+ npm test # build + node --test test/*.test.js
98
+ npm run test:bridge # 桥接自身的测试
99
+ ```
100
+
101
+ `vendor/bridge/` 是芥子桥接的随包快照(版本写在 `vendor/bridge/package.json`,插件按它做精确版本锁)。
102
+ 它由主仓库同步而来,不在这里单独开发:
103
+
104
+ ```sh
105
+ node scripts/sync-bridge.mjs --from /path/to/JieZi/companion/bridge
106
+ ```
107
+
108
+ 发布流程:改版本号(`npm version patch|minor|major`)→ 推送提交与 tag。tag 触发
109
+ [Release 工作流](.github/workflows/release.yml):跑测试、发布到 npm、生成/更新 `index.json` 并提交回来、
110
+ 把 tgz 挂到 GitHub Release。首次发布前需要在仓库 Secrets 里配置 `NPM_TOKEN`。
111
+
112
+ `jiezi-nsh-darwin-arm64` 是单独发布的工具链包,源码见 `packages/nsh-darwin-arm64/`,产物由
113
+ `scripts/pack-nsh.mjs` 从本机 `NSH_TOOLCHAIN` 打出,二进制不进 git。
114
+
115
+ ## 数据与卸载
116
+
117
+ 桥接状态、开发密钥、项目与产物都在 `~/.jiezi`(或配置的 `stateDir`)里。卸载插件不会删除这些数据;
118
+ 需要清理时手动删除该目录即可。
119
+
120
+ ## 许可证
121
+
122
+ [MIT](LICENSE)。随包的可选工具链包 `jiezi-nsh-darwin-arm64` 附带
123
+ [Native Shell](https://github.com/longbridge/nsh) 的 Apache-2.0 许可证。
@@ -0,0 +1,164 @@
1
+ # JieZi Agent preset: one `@deepseek-ai/dsh-agent-preset` declaration inserted
2
+ # after the web patch. It intentionally mirrors the shipped `standard` preset
3
+ # entry list and appends the JieZi tools; keep it in sync when standard changes.
4
+ # The global Host row registers the sidebar panel's authenticated routes.
5
+ - insert:
6
+ # Global Host row: authenticated same-origin /api/jiezi/* routes for the
7
+ # sidebar panel. Registers no tools and no Client slot.
8
+ - id: jiezi-runtime
9
+ name: 'dsh-jiezi'
10
+ config:
11
+ autoStart: true
12
+
13
+ # Preset row: the official standard Agent composition plus the JieZi tools.
14
+ - id: preset-jiezi
15
+ name: '@deepseek-ai/dsh-agent-preset'
16
+ config:
17
+ id: jiezi
18
+ name: 芥子开发模式
19
+ description: 官方标准 Agent 能力 + 芥子小程序构建、交付与真机调试工具。
20
+ order: 20
21
+ plugins:
22
+ - id: persona
23
+ name: '@deepseek-ai/dsh-persona'
24
+ config:
25
+ prefix: You are a coding agent powered by the {{model}} model.
26
+ - id: agent-instructions
27
+ name: '@deepseek-ai/dsh-agent-instructions'
28
+ config:
29
+ maxBytes: 65536
30
+ - id: time-context
31
+ name: '@deepseek-ai/dsh-time-context'
32
+ - id: tool-bash
33
+ name: '@deepseek-ai/dsh-tool-bash'
34
+ disabled: !!js process.platform === 'win32'
35
+ - id: tool-pwsh
36
+ name: '@deepseek-ai/dsh-tool-pwsh'
37
+ disabled: !!js process.platform !== 'win32'
38
+ - id: tool-fs
39
+ name: '@deepseek-ai/dsh-tool-fs'
40
+ config:
41
+ # Set false to drop the apply_patch tool beside edit.
42
+ applyPatch: false
43
+ - id: tool-fs-search
44
+ name: '@deepseek-ai/dsh-tool-fs-search'
45
+ config:
46
+ sampleOverCapGlobResults: false
47
+ - id: tool-jobs
48
+ name: '@deepseek-ai/dsh-tool-jobs'
49
+ - id: tool-schedule
50
+ name: '@deepseek-ai/dsh-tool-schedule'
51
+ - id: skill-filesystem
52
+ name: '@deepseek-ai/dsh-skill-filesystem'
53
+ config:
54
+ customSkillDirs:
55
+ # Profile bundle: `baseUrl` does not resolve the installed package;
56
+ # anchor at DSH_INSTALL_DIR (Desktop: resourcesPath/app.asar) and
57
+ # use the .asar.unpacked physical twin, as the desktop presets do.
58
+ - !!js process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(process.getBuiltinModule('node:path').join(String(process.env.DSH_INSTALL_DIR || process.resourcesPath + '/app.asar'), 'package.json')).resolve('@deepseek-ai/dsh-agent-preset/package.json')), 'skills').replace(/\.asar(?=[\\/])/u, '.asar.unpacked')
59
+ # JieZi-only: resolve this bundle from the preset declaration's
60
+ # baseUrl, matching the official preset skill-root mechanism.
61
+ - !!js process.getBuiltinModule('node:path').join(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:path').dirname(process.getBuiltinModule('node:module').createRequire(baseUrl).resolve('dsh-jiezi'))), 'skills').replace(/\.asar(?=[\\/])/u, '.asar.unpacked')
62
+ - id: tool-skill
63
+ name: '@deepseek-ai/dsh-tool-skill'
64
+ - id: command-goal
65
+ name: '@deepseek-ai/dsh-command-goal'
66
+ - id: tool-goal
67
+ name: '@deepseek-ai/dsh-tool-goal'
68
+ - id: planning
69
+ name: cordis:group
70
+ group: true
71
+ isolate:
72
+ planMode: true
73
+ config:
74
+ - id: plan-mode
75
+ name: '@deepseek-ai/dsh-plan-mode'
76
+ config:
77
+ section: |
78
+ You are in plan mode. Stay in plan mode until the user approves your plan through exit_plan_mode or switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
79
+
80
+ Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
81
+
82
+ The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed to keep the tool catalog unchanged. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
83
+
84
+ Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
85
+
86
+ Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
87
+
88
+ When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.
89
+ - id: compaction
90
+ name: cordis:group
91
+ group: true
92
+ isolate:
93
+ compaction: true
94
+ toolResultPruner: true
95
+ config:
96
+ - id: compaction-basic
97
+ name: '@deepseek-ai/dsh-compaction-basic'
98
+ - id: command-compact
99
+ name: '@deepseek-ai/dsh-command-compact'
100
+ - id: tool-result-pruner
101
+ name: '@deepseek-ai/dsh-compaction-tool-result-pruner'
102
+ config:
103
+ thresholdChars: 8192
104
+ headChars: 4096
105
+ tailChars: 1024
106
+ - id: delegation
107
+ name: cordis:group
108
+ group: true
109
+ isolate:
110
+ workflowEngine: true
111
+ config:
112
+ - id: tool-subagent-control
113
+ name: '@deepseek-ai/dsh-tool-subagent-control'
114
+ config:
115
+ interrupt: false
116
+ - id: tool-subagent
117
+ name: '@deepseek-ai/dsh-tool-subagent'
118
+ config:
119
+ provider: spawn
120
+ toolName: subagent
121
+ modelSelection: true
122
+ modelDiscovery: true
123
+ - id: tool-subagent-fork
124
+ name: '@deepseek-ai/dsh-tool-subagent'
125
+ config:
126
+ provider: fork
127
+ toolName: subagent_fork
128
+ - id: workflow-ptc
129
+ name: '@deepseek-ai/dsh-workflow-ptc'
130
+ config:
131
+ provider: spawn
132
+ - id: tool-workflow
133
+ name: '@deepseek-ai/dsh-tool-workflow'
134
+ - id: tool-ask-user
135
+ name: '@deepseek-ai/dsh-tool-ask-user'
136
+ - id: tool-todo
137
+ name: '@deepseek-ai/dsh-tool-todo'
138
+ config:
139
+ allowParallelInProgress: true
140
+ - id: tool-web
141
+ name: '@deepseek-ai/dsh-tool-web'
142
+ config:
143
+ fetch: true
144
+ searchTimeoutMs: 60000
145
+ - id: present
146
+ name: '@deepseek-ai/dsh-tool-present'
147
+ - id: tool-office
148
+ name: '@deepseek-ai/dsh-tool-office'
149
+ - id: tool-plugin-manager
150
+ name: '@deepseek-ai/dsh-plugin-manager/tools'
151
+ disabled: !!js "!ctx.get('profileContext')"
152
+ - id: tool-plugin-market
153
+ name: '@deepseek-ai/dsh-plugin-market/tools'
154
+ disabled: true
155
+
156
+ # JieZi-only: mini-app delivery/automation tools and prompt section.
157
+ - id: jiezi-tools
158
+ name: 'dsh-jiezi/tools'
159
+ config:
160
+ autoStart: true
161
+ # working-directory: miniapp_init uses the Session working directory
162
+ # itself as the project (it must be empty). named-subdirectory:
163
+ # it creates <working directory>/<projectId> instead.
164
+ projectLayout: working-directory
package/docs/DETAIL.md ADDED
@@ -0,0 +1,111 @@
1
+ # 芥子开发模式(`dsh-jiezi`)
2
+
3
+ 给 DeepSeek Harness 装上「芥子」小程序开发闭环:一个 Agent 预设、十二个 `miniapp_*` 工具、一个自带
4
+ skill,以及一个侧栏面板。预设是**官方标准 Agent 能力 + 芥子工具**,不是封闭的小程序工具集;
5
+ 构建、签名与安装协议的实现仍在随包的 `jiezi-bridge` 里,插件只负责调用与监督。
6
+
7
+ ## 装上之后
8
+
9
+ 1. 侧栏出现「芥子」。首次打开面板时点「初始化开发环境」:插件用打包进来的 `lib/bridge/cli.js`
10
+ 在 `~/.jiezi` 创建开发密钥、TLS 配置与桥接状态。这一步只在点击后执行,插件激活时不会创建信任材料。
11
+ 2. 面板显示本地渲染的配对二维码;用装了芥子宿主 App 的 iPhone 扫描,完成一次配对。
12
+ 3. 新建空目录作为会话工作目录,选「芥子开发模式」预设,让 Agent 用 `miniapp_init` 开始。
13
+
14
+ 面板展示配对等待/成功/过期、在线设备、最近交付和最近的语义自动化;二维码在浏览器本地生成,
15
+ 不经过任何二维码服务。
16
+
17
+ ## 交付闭环
18
+
19
+ ```text
20
+ miniapp_init → 新的 TSX 项目 + 计数器测试 + 已放入的 jiezi/native 适配层(只写空目录)
21
+ miniapp_build → releaseId + sha256(或指向源码行的结构化编译错误)
22
+ miniapp_deploy → opId(pending)
23
+ 设备 → downloading / verifying / installing / launching
24
+ 设备 → 诊断证据 jiezi.diagnostics.v1
25
+ 设备 → running | failed(带 evidenceId)
26
+ Agent → miniapp_diagnostics → 改源码 → 再次 miniapp_build
27
+ ```
28
+
29
+ `miniapp_init` 用 Host 提供的会话工作目录作为调用根,具体位置由 `jiezi-tools` 行的
30
+ `projectLayout` 决定:默认 `working-directory` 直接把工作目录当成项目根(必须是空目录);
31
+ `named-subdirectory` 则建 `<工作目录>/<projectId>`,一个目录可以放多个小程序。桥接配置的
32
+ project root 只在没有会话工作目录时兜底。项目因此落在标准 `workspace-write` 沙箱内,
33
+ `nsh test` / `nsh check` 不需要额外授权。
34
+
35
+ 初始化结果带 `signing: { certificate, signable }` 与 `warnings`:开发证书只覆盖
36
+ `com.jiezi.*`,超出范围的 `appId` 在构建前就会被指出,而不是等到 `nsh publish` 才发现。
37
+
38
+ `miniapp_status` 传 `wait: true` 时会在工具内等终态;未被收集的终态会以 `jiezi-delivery`
39
+ 提示交回 Agent,携带操作 id、状态、失败层与 evidenceId,不会伪装成用户输入。
40
+
41
+ ## 配对与自动化
42
+
43
+ 配对载荷是固定的六字段 `{ schema: "jiezi.pairing.v1", sessionId, endpoint, code,
44
+ certificateFingerprint, expiresAt }`,由桥接产生、Host 原样返回、面板本地校验并渲染。
45
+
46
+ 语义自动化只在「设备在线 + 开发者模式 + 已确认的前台授权」时可用:
47
+
48
+ ```text
49
+ miniapp_ui → 观察:snapshotId + 紧凑界面树(testID/标签/角色/别名/路径)
50
+ includeFrames 可带 frame=x,y WxH 与 screen=WxH
51
+ 弹层/弹窗节点包含在内,被它遮住的页面不列出
52
+ miniapp_action → 点击唯一可见目标、向文本框输入、或滚动最近的滚动视图
53
+ → 返回新的界面树(聚焦中的非安全输入框带 value/focused),或桥接自己的
54
+ failed/timeout/unsupported 结果
55
+ miniapp_screen → 经 simctl/devicectl 截全屏 PNG(状态栏、弹层、宿主外壳)
56
+ miniapp_open → 宿主重启后直接打开已安装的小程序,不重新下载产物
57
+ ```
58
+
59
+ 自动化结果始终按数据返回,不会被包装成「成功」。Agent 必须先读状态与错误再声称操作生效;
60
+ 宿主弹窗会以 `HOST_ALERT_BLOCKING` 阻止点击/输入,它不属于小程序内容,也不会被列为可点节点。
61
+
62
+ `miniapp_device list` 显示已配对设备、Mac 可见的 CoreDevice/模拟器目标和绑定关系;
63
+ `ensure_ready` 启动已初始化的桥接、做一次无令牌的 `dev_* → UDID` 绑定、用固定 argv 拉起
64
+ 已安装宿主,并等待真实的「开发者模式 + 自动化」就绪。多个可疑目标时返回
65
+ `host_binding_required`,传一次 `hostDeviceId` 即可;`automation_disabled` 是用户明确撤销,
66
+ 不会被覆盖。设备锁定、宿主缺失、iOS 信任被撤销、设备离线都会如实报错。
67
+
68
+ ## 要求
69
+
70
+ - 已初始化的桥接状态目录(默认 `~/.jiezi`):Host 按需启动 `serve`,从不自动 `init`。
71
+ - 已配对设备(部署、截图、语义验证需要);纯构建签名不需要设备。
72
+ - 构建需要固定的 Native Shell `nsh`:macOS arm64 由可选依赖 `jiezi-nsh-darwin-arm64` 提供,
73
+ 其他平台通过 `NSH_TOOLCHAIN` 或 `PATH` 提供;Host 侧生命周期恢复需要 Xcode 的
74
+ `devicectl` / `simctl`(仅 macOS)。
75
+ - 本包不包含芥子 iOS App,也不包含生产签名证书与 Linux 构建服务。
76
+
77
+ ## 配置
78
+
79
+ 两行插件都接受 `{ socketPath, stateDir, bridgeCliPath, autoStart, timeoutMs }`,`jiezi-tools`
80
+ 另接受 `projectLayout`。`socketPath` 默认 `$JIEZI_BRIDGE_SOCKET` 或 `~/.jiezi/bridge.sock`;
81
+ `stateDir` 默认取它的父目录;`bridgeCliPath` 依次取 `$JIEZI_BRIDGE_CLI`、包内
82
+ `lib/bridge/cli.js`、仓库里的 `vendor/bridge/src/cli.js`;`timeoutMs` 默认 30000。
83
+ 随包 patch 在两行上开启 `autoStart`,让它们共用同一个被监督的 operations 实例。
84
+
85
+ supervisor 会把运行中的桥接版本与包内 `lib/bridge/package.json` 精确比较:自己拉起的进程版本不符会重启,
86
+ 别处启动的桥接不会被杀掉,而是返回 `bridge_version_mismatch`。
87
+
88
+ ## 限制(P0)
89
+
90
+ 这是开发态的交付/生命周期通路:不实现 APNs/后台唤醒、自动打包安装 IPA、设备解锁、生产信任分发,
91
+ 也没有 Linux 构建服务。桥接可以把设备端点绑到回环的 `ws://`;没有 TLS 证书时
92
+ `certificateFingerprint` 为 `null`,要求 `wss` 的物理 iPhone 构建会拒绝该端点。
93
+
94
+ 生命周期恢复不保证在途工作的持久性:部署状态/发件箱对账、自动化状态持久化、跨重启的 Agent 唤醒归属、
95
+ 精确的启动尝试身份、原生崩溃事件、不可变异步构建任务都仍是后续工作。标准预设同时包含通用 shell
96
+ 与文件工具,因此窄生命周期 API 不是包住整个 Agent 的沙箱。
97
+
98
+ ## 自检
99
+
100
+ ```sh
101
+ npm run typecheck
102
+ npm run build
103
+ npm test
104
+ ```
105
+
106
+ `npm test` 覆盖:协议与配对载荷校验、工具参数归一化、界面树边界、精确路由表、路由成功/失败 JSON、
107
+ 桥接停止时的状态、十二个工具注册、工具级桥接失败、devicectl 新旧格式解析、绑定/启动安全、
108
+ 离线自动恢复、真实桥接监督,以及在固定 `nsh` 存在时的实时构建验收。
109
+
110
+ 侧栏与主面板插槽(`sidebar.panellist` 的 `jiezi`、`main` 的 `jiezi`)通过 Client slot 服务注册,
111
+ 但它们的最终外观没有被单元测试渲染验证。
package/icon.svg ADDED
@@ -0,0 +1,10 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128" role="img" aria-label="JieZi mini-app delivery">
2
+ <rect x="4" y="4" width="120" height="120" rx="28" fill="#ffffff" stroke="#4d6bfe" stroke-width="4"/>
3
+ <g fill="#4d6bfe">
4
+ <rect x="26" y="26" width="30" height="30" rx="8"/>
5
+ <rect x="72" y="26" width="30" height="30" rx="8"/>
6
+ <rect x="26" y="72" width="30" height="30" rx="8"/>
7
+ </g>
8
+ <rect x="72" y="72" width="30" height="30" rx="8" fill="#ffffff" stroke="#4d6bfe" stroke-width="4"/>
9
+ <path d="M87 78l3.2 6.8 7.3 1-5.3 5.2 1.3 7.3-6.5-3.5-6.5 3.5 1.3-7.3-5.3-5.2 7.3-1z" fill="#4d6bfe"/>
10
+ </svg>