@xiangyixie/dsh-superagent 0.12.1 → 0.14.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.
package/bin/doctor.js CHANGED
@@ -15,7 +15,7 @@ Check that this copy of dsh-superagent can actually run:
15
15
  - every file the code imports is shipped by package.json "files" and exists
16
16
  - the installed copy matches the version package.json claims
17
17
  - the installed files match the published tarball (skipped when offline)
18
- - the DSH profile mounts the bundle patch and the eleven tools are registered
18
+ - the DSH profile mounts the bundle patch and the twelve tools are registered
19
19
  - the running Node satisfies "engines"
20
20
 
21
21
  Nothing is installed or modified; the only network access is one public
package/cordis.patch.yml CHANGED
@@ -1,9 +1,9 @@
1
- # dsh-superagent bundle layer.
2
- #
3
- # Inserts one tools-only plugin row at PROFILE scope, so every session in the
4
- # profile can start a run. The package never edits the profile's `bundles`
5
- # list — that entry is the operator's action (`dsh plugin --profile <name> add
6
- # @xiangyixie/dsh-superagent`).
7
- - insert:
8
- - id: superagent
9
- name: '@xiangyixie/dsh-superagent'
1
+ # dsh-superagent bundle layer.
2
+ #
3
+ # Inserts one tools-only plugin row at PROFILE scope, so every session in the
4
+ # profile can start a run. The package never edits the profile's `bundles`
5
+ # list — that entry is the operator's action (`dsh plugin --profile <name> add
6
+ # @xiangyixie/dsh-superagent`).
7
+ - insert:
8
+ - id: superagent
9
+ name: '@xiangyixie/dsh-superagent'
package/docs/DETAIL.md ADDED
@@ -0,0 +1,37 @@
1
+ # Superagent
2
+
3
+ Long-horizon autonomous runs: give it one goal and it plans parallel subtasks, runs them in workers, and merges the outcome into one report. A restart does not throw the work away.
4
+
5
+ ## What it solves
6
+
7
+ - **A goal that does not fit one step.** The goal is planned into dependent subtasks and advanced step by step instead of being crammed into one conversation.
8
+ - **Work that runs too slowly in sequence.** Independent subtasks run in parallel, each in its own worktree, without overwriting one another.
9
+ - **Runs that get interrupted.** The plan, progress, and produced files are durable; a host restart or a closed conversation does not reset the run.
10
+ - **Results that need checking.** Every subtask keeps its status, usage, and cost, and the merged report states failures and gaps instead of hiding them.
11
+
12
+ ## Install
13
+
14
+ The desktop app's Add plugin dialog accepts any of these three inputs:
15
+
16
+ 1. **Package name**: `@xiangyixie/dsh-superagent@0.14.1`
17
+ 2. **GitHub repository**: `https://github.com/LittleChenLiya/dsh-superagent`
18
+ 3. **Local directory**: `file:` followed by the absolute path of the checkout
19
+
20
+ You can also add the plugin index on the Discover page and install from there:
21
+
22
+ ```
23
+ https://raw.githubusercontent.com/LittleChenLiya/dsh-superagent/main/plugin-index.json
24
+ ```
25
+
26
+ Upgrading is **remove-then-add**. Any other plugin in the same profile must also be removed before its new version is added; do not expect the dialog to replace it in place.
27
+
28
+ ## When commands are needed
29
+
30
+ Workers plan and read/write files by default. Enable `commandWorkerPermission` when they must run commands, builds, or tests. Without it the plugin still works, but command steps are refused.
31
+
32
+ ## Safety and cost
33
+
34
+ - Irreversible actions, uploads, and network destinations are policed, and a run can be stopped.
35
+ - Cost is estimated from the configured price table. A model without a price is reported as `unpriced`, never as zero, and currencies are totalled separately rather than added together.
36
+
37
+ The full commands, configuration, and design notes are in the [README](https://github.com/LittleChenLiya/dsh-superagent#readme).
@@ -0,0 +1,37 @@
1
+ # 超级智能体
2
+
3
+ 长周期自主执行插件:给出一个目标,它把目标拆成可并行的子任务,交给 worker 执行,最后合并成一份报告。进程重启后仍能从断点继续,不必从头再来。
4
+
5
+ ## 它解决什么问题
6
+
7
+ - **目标大,一步做不完。** 把一句话目标拆成有依赖关系的子任务,按计划推进,而不是把所有事塞进一次对话。
8
+ - **串行太慢。** 互不依赖的子任务并行执行,各自在自己的工作区里干活,互不覆盖。
9
+ - **中途会断。** 计划、进度和已产出的文件都落盘;宿主重启或对话结束之后可以继续。
10
+ - **结果要能核对。** 每个子任务都留下状态、用量和成本,最后合并成一份可读的报告,失败和遗漏不会被悄悄吞掉。
11
+
12
+ ## 安装
13
+
14
+ 桌面应用的「添加插件」对话框接受三种输入,任选一种:
15
+
16
+ 1. **包名**:`@xiangyixie/dsh-superagent@0.14.1`
17
+ 2. **GitHub 仓库**:`https://github.com/LittleChenLiya/dsh-superagent`
18
+ 3. **本地目录**:`file:` 加上插件目录的绝对路径
19
+
20
+ 也可以从「发现」页添加插件索引,然后一键安装:
21
+
22
+ ```
23
+ https://raw.githubusercontent.com/LittleChenLiya/dsh-superagent/main/plugin-index.json
24
+ ```
25
+
26
+ 升级时是**先卸载再装新版**。同一个 profile 里的其他插件也要先卸载,再装它们的新版;不要让对话框直接覆盖。
27
+
28
+ ## 需要命令执行能力时
29
+
30
+ worker 默认只做规划与读写;如果要让它运行命令、构建或测试,请开启 `commandWorkerPermission`。不开也能用,但涉及命令的步骤会被拦下。
31
+
32
+ ## 安全与成本
33
+
34
+ - 不可逆操作、文件上传和域名访问都受策略约束,可随时停止。
35
+ - 成本按配置的价目表估算;没有价目的模型明确标成 `unpriced`,不会显示成 0。多币种分别合计,不跨币种相加。
36
+
37
+ 完整的命令、配置和设计说明见 [README](https://github.com/LittleChenLiya/dsh-superagent#readme)。
package/icon.svg ADDED
@@ -0,0 +1,10 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" role="img" aria-label="Superagent">
2
+ <rect x="16" y="16" width="480" height="480" rx="112" fill="#0f766e"/>
3
+ <rect x="16" y="16" width="480" height="480" rx="112" fill="none" stroke="#99f6e4" stroke-width="16"/>
4
+ <path d="M256 148v44M256 192H144v56M256 192h112v56M256 192v56" fill="none" stroke="#f0fdfa" stroke-width="24" stroke-linecap="round"/>
5
+ <circle cx="256" cy="116" r="40" fill="#f0fdfa"/>
6
+ <circle cx="144" cy="280" r="34" fill="#f0fdfa"/>
7
+ <circle cx="256" cy="280" r="34" fill="#f0fdfa"/>
8
+ <circle cx="368" cy="280" r="34" fill="#f0fdfa"/>
9
+ <rect x="144" y="352" width="224" height="44" rx="22" fill="#f0fdfa"/>
10
+ </svg>
package/lib/audit.js CHANGED
@@ -66,6 +66,13 @@ const MAX_META_BYTES = 4000
66
66
 
67
67
  const RANK = { allow: 0, confirm: 1, deny: 2 }
68
68
 
69
+ /**
70
+ * Decisions an event may carry. Policy levels plus `attention`, which records a
71
+ * hand-off to a person for an action that was stopped short rather than run.
72
+ * Guard merging below still uses LEVELS only.
73
+ */
74
+ const RECORDED_DECISIONS = [...LEVELS, 'attention']
75
+
69
76
  const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))
70
77
 
71
78
  function clip(value, limit) {
@@ -103,7 +110,7 @@ export function normalizeEvent(input, { now = () => Date.now() } = {}) {
103
110
  kind: clip(input?.kind, 64) ?? 'unknown',
104
111
  action: clip(input?.action, 64),
105
112
  target: clip(input?.target, MAX_TARGET),
106
- decision: LEVELS.includes(input?.decision) ? input.decision : null,
113
+ decision: RECORDED_DECISIONS.includes(input?.decision) ? input.decision : null,
107
114
  result: clip(input?.result, 32),
108
115
  durationMs: Number.isFinite(input?.durationMs) ? Math.max(0, Math.round(input.durationMs)) : null,
109
116
  rule: clip(input?.rule, MAX_TEXT),