dsh-plugin-prompt-tool 0.7.2 → 0.8.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.
- package/README.md +185 -46
- package/engine/THIRD_PARTY_LICENSES +25 -0
- package/engine/actions.mjs +931 -0
- package/engine/anchor-match.mjs +6 -3
- package/engine/character-tools.mjs +11 -0
- package/engine/classify-task.mjs +18 -0
- package/engine/compaction-epoch.mjs +41 -20
- package/engine/compositions/library/agent-instructions.yml +9 -0
- package/engine/compositions/library/command-goal.yml +2 -6
- package/engine/compositions/library/compaction.yml +2 -32
- package/engine/compositions/library/delegation-ptc.yml +58 -0
- package/engine/compositions/library/delegation.yml +5 -38
- package/engine/compositions/library/persistent-shell.yml +4 -13
- package/engine/compositions/library/planning.yml +8 -23
- package/engine/compositions/library/skill-filesystem-cordis.yml +10 -0
- package/engine/compositions/library/skill-filesystem.yml +2 -8
- package/engine/compositions/library/tool-ask-user.yml +2 -3
- package/engine/compositions/library/tool-bash.yml +4 -12
- package/engine/compositions/library/tool-cordis.yml +7 -0
- package/engine/compositions/library/tool-fs-search.yml +2 -11
- package/engine/compositions/library/tool-fs.yml +2 -5
- package/engine/compositions/library/tool-goal.yml +2 -6
- package/engine/compositions/library/tool-jobs.yml +2 -18
- package/engine/compositions/library/tool-plugin-manager-disabled.yml +8 -0
- package/engine/compositions/library/tool-plugin-manager.yml +8 -0
- package/engine/compositions/library/tool-present.yml +7 -0
- package/engine/compositions/library/tool-presentation.yml +9 -0
- package/engine/compositions/library/tool-pwsh.yml +2 -6
- package/engine/compositions/library/tool-skill.yml +7 -0
- package/engine/compositions/library/tool-todo.yml +2 -4
- package/engine/compositions/library/tool-web.yml +2 -1
- package/engine/compositions/source/local/character-tools.yml +5 -0
- package/engine/compositions/source/local/declared-triggers.yml +12 -0
- package/engine/compositions/source/local/filesystem-editor.yml +30 -0
- package/engine/compositions/source/local/instruction-hint.yml +15 -0
- package/engine/compositions/{library/official-persistent-shell.yml → source/local/persistent-shell-posix.yml} +10 -8
- package/engine/compositions/source/local/prompt-config-engine.yml +3 -9
- package/engine/compositions/source/local/run-code-env.yml +4 -7
- package/engine/compositions/source/local/session-var-tools.yml +5 -0
- package/engine/compositions/source/local/skill-search.yml +3 -9
- package/engine/compositions/source/local/subagent-tool-policy.yml +21 -0
- package/engine/compositions/source/local/tool-bash-disabled.yml +9 -0
- package/engine/compositions/source/local/tool-config-engine.yml +8 -0
- package/engine/compositions/source/local/tool-git-bash.yml +15 -0
- package/engine/compositions/source/local/world-book-tools.yml +5 -0
- package/engine/condition.mjs +83 -0
- package/engine/declared-triggers.mjs +93 -0
- package/engine/executor.mjs +364 -185
- package/engine/fields.mjs +219 -0
- package/engine/fillers.mjs +12 -141
- package/engine/host-package.mjs +51 -0
- package/engine/instruction-hint.mjs +285 -0
- package/engine/interpolate.mjs +157 -29
- package/engine/layers.mjs +495 -75
- package/engine/predicates.mjs +753 -0
- package/engine/prompt-config-engine.mjs +63 -8
- package/engine/run-code-env.mjs +48 -31
- package/engine/schema.mjs +444 -103
- package/engine/sdk-strip.mjs +365 -0
- package/engine/session-var-tools.mjs +11 -0
- package/engine/session-vars.mjs +8 -6
- package/engine/shared.mjs +137 -0
- package/engine/skill-search.mjs +34 -21
- package/engine/st-macros.d.mts +22 -0
- package/engine/st-macros.mjs +208 -0
- package/engine/st-render.mjs +105 -0
- package/engine/st-world-book.d.mts +10 -0
- package/engine/st-world-book.mjs +259 -0
- package/engine/strategies.mjs +31 -20
- package/engine/subagent-tool-policy-core.mjs +400 -0
- package/engine/subagent-tool-policy.mjs +327 -0
- package/engine/tool-config-engine.mjs +207 -145
- package/engine/tool-definition.mjs +143 -0
- package/engine/{custom-bash.mjs → tool-git-bash.mjs} +38 -13
- package/engine/trigger-editor-meta.mjs +48 -0
- package/engine/trigger-spec.mjs +257 -0
- package/engine/trigger.mjs +304 -0
- package/engine/world-book-tools.mjs +11 -0
- package/lib/client.js +16495 -5456
- package/lib/client.js.map +1 -1
- package/lib/index.d.mts +628 -382
- package/lib/index.mjs +5391 -2942
- package/lib/paths-CY5psBqE.d.mts +1233 -0
- package/lib/preset-package-BnJqrU4R.mjs +16792 -0
- package/lib/preset-transfer.d.mts +2 -0
- package/lib/preset-transfer.mjs +2 -0
- package/package.json +91 -49
- package/preset/pt-cordis/preset.yml +43 -0
- package/preset/pt-cordis/skills/cordis-composition-reference/SKILL.md +29 -0
- package/preset/pt-cordis/skills/cordis-composition-reference/references/packages.md +501 -0
- package/preset/pt-cordis/skills/cordis-plugin-development/SKILL.md +38 -0
- package/preset/pt-cordis/skills/cordis-plugin-development/references/host-plugin.md +60 -0
- package/preset/pt-cordis/skills/cordis-plugin-development/references/mcp-bundle.md +5 -0
- package/preset/pt-cordis/skills/cordis-plugin-development/references/ui-plugin.md +13 -0
- package/preset/pt-cordis/skills/cordis-plugin-development/references/verification.md +5 -0
- package/preset/pt-cordis/skills/cordis-plugin-development/templates/decoration/client.js +22 -0
- package/preset/pt-cordis/skills/cordis-plugin-development/templates/decoration/cordis.patch.yml +3 -0
- package/preset/pt-cordis/skills/cordis-plugin-development/templates/decoration/index.js +2 -0
- package/preset/pt-cordis/skills/cordis-plugin-development/templates/decoration/package.json +15 -0
- package/preset/pt-cordis/skills/cordis-plugin-development/templates/mcp/cordis.patch.yml +8 -0
- package/preset/pt-cordis/skills/cordis-plugin-development/templates/mcp/package.json +7 -0
- package/preset/pt-cordis/skills/editing-cordis-compositions/SKILL.md +84 -0
- package/preset/pt-custom/preset.yml +15 -0
- package/preset/pt-minimal/preset.yml +27 -0
- package/preset/pt-ptc/preset.yml +45 -0
- package/preset/pt-standard/preset.yml +43 -0
- package/templates/14-first-turn-anchor.yml +4 -4
- package/templates/15-guide-auto.yml +3 -3
- package/templates/16-custom-fallback.yml +1 -0
- package/templates/18-placeholder-env-facts.yml +3 -3
- package/templates/20-system-section.yml +3 -2
- package/templates/65-turn-stop.yml +18 -0
- package/templates/66-subagent-start.yml +14 -0
- package/templates/75-subagent-end.yml +15 -0
- package/templates/tools/10-shell-command.yml +1 -1
- package/templates/tools/40-delegate-character.yml +1 -1
- package/templates/tools/50-delegate-worldbook.yml +1 -1
- package/templates/tools/60-delegate-session-var.yml +1 -1
- package/templates/tools/70-delegate-worldbook-upsert.yml +1 -1
- package/engine/anchor-turn.mjs +0 -68
- package/engine/code-presentation.mjs +0 -103
- package/engine/compositions/library/anchor-turn.yml +0 -10
- package/engine/compositions/library/bootstrap-filesystem.yml +0 -19
- package/engine/compositions/library/code-presentation.yml +0 -8
- package/engine/compositions/library/context-gate.yml +0 -39
- package/engine/compositions/library/cot-drip.yml +0 -11
- package/engine/compositions/library/custom-bash.yml +0 -14
- package/engine/compositions/library/deliberation-gate.yml +0 -11
- package/engine/compositions/library/official-agent-instructions.yml +0 -17
- package/engine/compositions/library/official-skill-filesystem-cordis.yml +0 -10
- package/engine/compositions/library/official-tool-bash.yml +0 -6
- package/engine/compositions/library/official-tool-cordis.yml +0 -13
- package/engine/compositions/library/official-tool-presentation.yml +0 -7
- package/engine/compositions/library/official-tool-skill.yml +0 -14
- package/engine/compositions/library/persona.yml +0 -13
- package/engine/compositions/library/prompt-config-engine.yml +0 -16
- package/engine/compositions/library/run-code-env.yml +0 -15
- package/engine/compositions/library/skill-search.yml +0 -14
- package/engine/compositions/library/str-replace-editor.yml +0 -10
- package/engine/compositions/library/tool-bootstrap.yml +0 -14
- package/engine/compositions/library/tool-config-engine.yml +0 -9
- package/engine/compositions/library/tool-filter.yml +0 -8
- package/engine/compositions/source/local/code-presentation.yml +0 -8
- package/engine/compositions/source/local/context-gate.yml +0 -36
- package/engine/compositions/source/local/custom-bash.yml +0 -11
- package/engine/compositions/source/local/str-replace-editor.yml +0 -10
- package/engine/compositions/source/local/tool-bootstrap.yml +0 -11
- package/engine/compositions/source/local/tool-filter.yml +0 -8
- package/engine/context-gate.mjs +0 -305
- package/engine/cot-drip.mjs +0 -137
- package/engine/deliberation-gate.mjs +0 -127
- package/engine/tool-bootstrap.mjs +0 -476
- package/engine/tool-filter.mjs +0 -80
- package/lib/preset-core.d.mts +0 -10
- package/lib/preset-core.mjs +0 -77
- package/lib/prompt-configs-BnQKRHVb.mjs +0 -884
- package/lib/prompt-configs-CN0sJTUL.d.mts +0 -193
- package/preset/anchored/preset.yml +0 -296
- package/preset/creative/preset.yml +0 -67
- package/preset/creative/skills/cordis-plugin-development/SKILL.md +0 -420
- package/preset/creative/skills/editing-cordis-compositions/SKILL.md +0 -165
- package/preset/custom/preset.yml +0 -12
- package/preset/liangshen/preset.yml +0 -75
- package/preset/minimal/preset.yml +0 -45
- package/preset/ptc/preset.yml +0 -58
- package/preset/standard/preset.yml +0 -57
- package/skills/manifest.json +0 -7
- package/skills/sandboxmod/SKILL.md +0 -49
- package/skills/web ui/SKILL.md +0 -42
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Verify in the available environment
|
|
2
|
+
|
|
3
|
+
Prefer the authenticated page already connected to Harness. Do not launch a separate browser from shell commands, change `HOME`, inspect personal browser profiles, search for authentication tokens, or alter keychains to obtain a screenshot. For a visual-only request without browser control, limit verification to JavaScript syntax, manifest validation, and the live Client slot, then report that visual verification remains unavailable. Before or after installation, do not search for rasterizers, invoke Quick Look, extract SVG into preview files, emulate React/DOM, or implement a custom renderer to compensate for missing browser control. A screenshot of a mock page is not verification of the running plugin.
|
|
4
|
+
|
|
5
|
+
For any test subprocess or temporary resource, use a unique owned directory, bound execution, and await cleanup. A failed optional preview must not turn into environment repair or block installation.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: '@local/my-decoration',
|
|
3
|
+
factory(require) {
|
|
4
|
+
const React = require('react');
|
|
5
|
+
const h = React.createElement;
|
|
6
|
+
function Decoration() {
|
|
7
|
+
return h('svg', {
|
|
8
|
+
viewBox: '0 0 64 64', width: 48, height: 48,
|
|
9
|
+
'aria-hidden': true,
|
|
10
|
+
style: { display: 'block', pointerEvents: 'none' },
|
|
11
|
+
}, h('circle', { cx: 32, cy: 32, r: 24, fill: '#247bbf' }));
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
inject: ['slots'],
|
|
15
|
+
apply(ctx) {
|
|
16
|
+
ctx.slots.inject('conversation.composer.dock', () => ctx.slots.register({
|
|
17
|
+
name: 'conversation.composer.dock', id: 'my-decoration', order: 5,
|
|
18
|
+
}, Decoration));
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@local/my-decoration",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": { ".": "./index.js", "./client": "./client.js" },
|
|
7
|
+
"dsh": {
|
|
8
|
+
"bundle": { "patch": "./cordis.patch.yml" },
|
|
9
|
+
"client": {
|
|
10
|
+
"platform": "web",
|
|
11
|
+
"immediately": true,
|
|
12
|
+
"inject": ["@deepseek-ai/dsh-client-ui-conversation"]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: editing-cordis-compositions
|
|
3
|
+
description: Use when creating, changing, or validating an agent preset or other Cordis composition for this harness, including deciding host versus preset placement and checking that an authored preset mounts.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Editing Cordis compositions
|
|
7
|
+
|
|
8
|
+
Agent presets are ordinary `@deepseek-ai/dsh-agent-preset` declarations carried by bundle patches. Nothing edits a declaration in place: a preset is created or changed by installing a bundle whose patch declares or overrides it. This file states the declaration format; when it leaves a question open, read the `@deepseek-ai/dsh-agent-preset` README and `lib/types` declarations under the `packageDir` that `cordis_inspect_query` `Config.listConfigs` returns when queried with a `preset-<id>` row's `entry` id, or `packages/preset/agent-preset/src` in a source checkout.
|
|
9
|
+
|
|
10
|
+
## Where declarations live
|
|
11
|
+
|
|
12
|
+
The shipped Web presets are `presets/<id>.patch.yml` files of the `@deepseek-ai/dsh-web-app` bundle, ids `standard`, `ptc`, `minimal` and `cordis`. Installed, the bundle resolves from the dsh installation, not the profile; querying `Config.listConfigs` with the `entry` id of any `preset-<id>` row it declares returns that `packageDir`. In a source checkout of DSH it is `packages/bundle/web-app/`. Read one file with the file-read tool when you need a template; `minimal.patch.yml` is the shortest. In Desktop the bundle sits inside `app.asar`, which shell commands cannot open. Load `cordis-composition-reference` for the patch dialect and the list of plugin packages a preset can mount.
|
|
13
|
+
|
|
14
|
+
A declaration row has these `config` fields: `id` (required, lowercase letters, digits and hyphens), `plugins` (required Cordis entry list), and optional `name`, `description` and `order` (roster position). The Loader row `id` is `preset-<id>` by convention.
|
|
15
|
+
|
|
16
|
+
## Create a preset
|
|
17
|
+
|
|
18
|
+
Write a bundle directory in the workspace with exactly two files, then install it.
|
|
19
|
+
|
|
20
|
+
`review-preset/package.json`:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"name": "@local/dsh-review-preset",
|
|
25
|
+
"version": "1.0.0",
|
|
26
|
+
"private": true,
|
|
27
|
+
"type": "module",
|
|
28
|
+
"dsh": { "bundle": { "patch": "./cordis.patch.yml" } }
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`review-preset/cordis.patch.yml`:
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
- insert:
|
|
36
|
+
- id: preset-review
|
|
37
|
+
name: '@deepseek-ai/dsh-agent-preset'
|
|
38
|
+
config:
|
|
39
|
+
id: review
|
|
40
|
+
name: Review
|
|
41
|
+
description: Reviews changes with the shell only.
|
|
42
|
+
order: 10
|
|
43
|
+
plugins:
|
|
44
|
+
- id: persona
|
|
45
|
+
name: '@deepseek-ai/dsh-persona'
|
|
46
|
+
config:
|
|
47
|
+
prefix: You review software changes.
|
|
48
|
+
- id: tool-bash
|
|
49
|
+
name: '@deepseek-ai/dsh-tool-bash'
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Install with `plugin_manager`, `action: install_bundle`, `target` set to the absolute bundle directory. It runs package installation and bundle selection itself; do not reproduce those steps with shell commands.
|
|
53
|
+
|
|
54
|
+
## Change a shipped preset
|
|
55
|
+
|
|
56
|
+
Override the declaration by its Loader row id instead of inserting. The override replaces the complete `config`, so restate `id`, `plugins` and every other field the shipped file carries:
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
- id: preset-standard
|
|
60
|
+
name: '@deepseek-ai/dsh-agent-preset'
|
|
61
|
+
config:
|
|
62
|
+
id: standard
|
|
63
|
+
order: 1
|
|
64
|
+
plugins:
|
|
65
|
+
# the shipped list with your changes
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Migrate a legacy preset
|
|
69
|
+
|
|
70
|
+
Before declaration rows, a user preset was a directory `$DSH_HOME/.agent-presets/<id>/` holding `preset.yml` (display `name`, `description`, `order`) and `agent.cordis.yml` (the plugin entry list). Nothing reads that directory any more. To migrate one, create a bundle as above whose declaration takes `id` from the directory name, `name`, `description`, and `order` from `preset.yml`, and `plugins` from `agent.cordis.yml` verbatim; check each plugin name against `cordis-composition-reference` because packages renamed since the preset was written fail at activation. Install it, verify the row, then delete the legacy directory.
|
|
71
|
+
|
|
72
|
+
## Verify
|
|
73
|
+
|
|
74
|
+
`plugin_manager` `list_bundles` lists the installed bundle; `list_plugins` shows the `preset-<id>` row with its activation state. A declaration whose activation fails stays on the roster with its diagnostic and cannot compose a session until the bundle is fixed and reinstalled. Existing sessions and their children keep the plugin revision they started with; validate changed behavior in a new session. Installing a bundle executes plugin code in the Host process, so it requires Full access or approval.
|
|
75
|
+
|
|
76
|
+
## Choose plugin placement
|
|
77
|
+
|
|
78
|
+
Host plugins supply shared services: tools and prompt registries, the Agent loop, sessions, persistence, settings, sandbox policy, model routes, and subagent backends. Preset plugins contribute scoped tools, persona, prompt sections, and policies to those registries. Preset revisions are eagerly activated once and shared by their selecting Agents.
|
|
79
|
+
|
|
80
|
+
A preset plugin that supplies a service must isolate the provider and all its consumers in the same realm. A service consumed by Host plugins belongs in the Host configuration. Scope controls contributions and event visibility; `isolate` controls service instances. Use ordinary Cordis groups for nested plugin lists. Keep `!!js` expressions only in plugin configuration or `disabled`; the Loader evaluates them when activating the child plugin. Resolve assets from installed packages rather than a preset directory.
|
|
81
|
+
|
|
82
|
+
## Extend the Host
|
|
83
|
+
|
|
84
|
+
For new plugin code or profile-wide capabilities, load `cordis-plugin-development`, author a workspace bundle, and install it with `plugin_manager`. Inspect available APIs through `cordis_inspect_list` and `cordis_inspect_query`, including a mounted plugin's Config schema through the Host `Config` provider; those tools do not invoke Remote methods. Verify the installed capability before reporting completion.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# 自定义预设:空白起点(所有参数为空,由引擎与 UI 默认值兜底)。
|
|
2
|
+
# 新建时选择本模板得到一份可自由配置的用户预设;空模块清单生成空组合,
|
|
3
|
+
# 参数、模块和提示词配置都由用户从 UI 按需添加。
|
|
4
|
+
id: pt-custom
|
|
5
|
+
name: 自定义预设
|
|
6
|
+
description: 空白起点:所有参数为空,按需从 UI 配置。
|
|
7
|
+
version: 1.0.0
|
|
8
|
+
engineCompat: ">=0.4.2"
|
|
9
|
+
modules: []
|
|
10
|
+
layerSettings: {}
|
|
11
|
+
# 空白起点不隐式装配任何提示词卡:需要时从 UI 添加。
|
|
12
|
+
# 指令文件正文由独立指令来源(pre-step 协调器 + $DSH_HOME/.prompt-tool/instructions.yml)
|
|
13
|
+
# 按会话现场解析,预设侧不再有 agentsHints 开关。
|
|
14
|
+
promptConfigs: []
|
|
15
|
+
legacyCleanup: []
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
id: pt-minimal
|
|
2
|
+
name: 极简模式
|
|
3
|
+
description: 仅提供持久 shell 的单工具编码 Agent。
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
engineCompat: ">=0.4.2"
|
|
6
|
+
modules:
|
|
7
|
+
- persistent-shell
|
|
8
|
+
- prompt-config-engine
|
|
9
|
+
persona:
|
|
10
|
+
prefix: You are a helpful software engineer assistant.
|
|
11
|
+
complete: true
|
|
12
|
+
includeRuntimeContext: false
|
|
13
|
+
promptConfigs: []
|
|
14
|
+
layerSettings:
|
|
15
|
+
agent-request:
|
|
16
|
+
modelProvider: ""
|
|
17
|
+
modelName: ""
|
|
18
|
+
modelReasoningEffort: ""
|
|
19
|
+
modelTemperature: ""
|
|
20
|
+
modelMaxTokens: ""
|
|
21
|
+
subagent-start:
|
|
22
|
+
subagentModelProvider: ""
|
|
23
|
+
subagentModelName: ""
|
|
24
|
+
subagentReasoningEffort: ""
|
|
25
|
+
subagentTemperature: ""
|
|
26
|
+
subagentMaxTokens: ""
|
|
27
|
+
maxDepth: ""
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
id: pt-ptc
|
|
2
|
+
name: PTC 模式
|
|
3
|
+
description: 功能完整的编码 Agent,但默认不提供 workflow 工具;其他工具通过 PTC 模式 SDK 呈现,让模型用一个
|
|
4
|
+
TypeScript 程序组合多步操作。
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
engineCompat: ">=0.4.2"
|
|
7
|
+
modules:
|
|
8
|
+
- agent-instructions
|
|
9
|
+
- tool-bash
|
|
10
|
+
- tool-pwsh
|
|
11
|
+
- tool-fs
|
|
12
|
+
- tool-fs-search
|
|
13
|
+
- tool-jobs
|
|
14
|
+
- skill-filesystem
|
|
15
|
+
- tool-skill
|
|
16
|
+
- command-goal
|
|
17
|
+
- tool-goal
|
|
18
|
+
- planning
|
|
19
|
+
- compaction
|
|
20
|
+
- delegation-ptc
|
|
21
|
+
- tool-ask-user
|
|
22
|
+
- tool-todo
|
|
23
|
+
- tool-web
|
|
24
|
+
- tool-presentation
|
|
25
|
+
- tool-present
|
|
26
|
+
- tool-plugin-manager-disabled
|
|
27
|
+
- prompt-config-engine
|
|
28
|
+
persona:
|
|
29
|
+
suffix: Your working directory is {{cwd}}.
|
|
30
|
+
prefix: You are a coding agent powered by the {{model}} model.
|
|
31
|
+
promptConfigs: []
|
|
32
|
+
layerSettings:
|
|
33
|
+
agent-request:
|
|
34
|
+
modelProvider: ""
|
|
35
|
+
modelName: ""
|
|
36
|
+
modelReasoningEffort: ""
|
|
37
|
+
modelTemperature: ""
|
|
38
|
+
modelMaxTokens: ""
|
|
39
|
+
subagent-start:
|
|
40
|
+
subagentModelProvider: ""
|
|
41
|
+
subagentModelName: ""
|
|
42
|
+
subagentReasoningEffort: ""
|
|
43
|
+
subagentTemperature: ""
|
|
44
|
+
subagentMaxTokens: ""
|
|
45
|
+
maxDepth: ""
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
id: pt-standard
|
|
2
|
+
name: 标准模式
|
|
3
|
+
description: 功能完整的编码 Agent,支持文件编辑、Shell、文件与网页检索、Skills、计划、目标、子代理和工作流。
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
engineCompat: ">=0.4.2"
|
|
6
|
+
modules:
|
|
7
|
+
- agent-instructions
|
|
8
|
+
- tool-bash
|
|
9
|
+
- tool-pwsh
|
|
10
|
+
- tool-fs
|
|
11
|
+
- tool-fs-search
|
|
12
|
+
- tool-jobs
|
|
13
|
+
- skill-filesystem
|
|
14
|
+
- tool-skill
|
|
15
|
+
- command-goal
|
|
16
|
+
- tool-goal
|
|
17
|
+
- planning
|
|
18
|
+
- compaction
|
|
19
|
+
- delegation
|
|
20
|
+
- tool-ask-user
|
|
21
|
+
- tool-todo
|
|
22
|
+
- tool-web
|
|
23
|
+
- tool-present
|
|
24
|
+
- tool-plugin-manager-disabled
|
|
25
|
+
- prompt-config-engine
|
|
26
|
+
persona:
|
|
27
|
+
suffix: Your working directory is {{cwd}}.
|
|
28
|
+
prefix: You are a coding agent powered by the {{model}} model.
|
|
29
|
+
promptConfigs: []
|
|
30
|
+
layerSettings:
|
|
31
|
+
agent-request:
|
|
32
|
+
modelProvider: ""
|
|
33
|
+
modelName: ""
|
|
34
|
+
modelReasoningEffort: ""
|
|
35
|
+
modelTemperature: ""
|
|
36
|
+
modelMaxTokens: ""
|
|
37
|
+
subagent-start:
|
|
38
|
+
subagentModelProvider: ""
|
|
39
|
+
subagentModelName: ""
|
|
40
|
+
subagentReasoningEffort: ""
|
|
41
|
+
subagentTemperature: ""
|
|
42
|
+
subagentMaxTokens: ""
|
|
43
|
+
maxDepth: ""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 模板:首句锚点(strategy=first-turn-anchor)
|
|
2
2
|
# 首条真实用户消息后按任务类型(build / inspect / deep)注入锚句,每会话一次。
|
|
3
|
-
#
|
|
3
|
+
# 纯净模板:参数全部留空,由用户自定义;默认锚句与正则见引擎内置策略默认值。
|
|
4
4
|
# 提示:把本文件放入 promptConfigsDir 目录,或把对象写入 settings.promptConfigs 数组。
|
|
5
5
|
id: example-first-turn-anchor
|
|
6
6
|
name: 示例:首句锚点
|
|
@@ -22,6 +22,6 @@ params:
|
|
|
22
22
|
text: "" # 自定义锚文本(useCustom=true 时固定注入)
|
|
23
23
|
buildPattern: "" # 构建任务正则;留空 = 该分类不生效
|
|
24
24
|
complexPattern: "" # 复杂任务正则;留空 = 该分类不生效
|
|
25
|
-
firstTurnBuild: "" #
|
|
26
|
-
firstTurnInspect: "" #
|
|
27
|
-
firstTurnDeep: "" #
|
|
25
|
+
firstTurnBuild: "" # 构建任务锚句(留空 = 引擎内置默认锚句)
|
|
26
|
+
firstTurnInspect: "" # 排查任务锚句(留空 = 引擎内置默认锚句)
|
|
27
|
+
firstTurnDeep: "" # 复杂设计锚句(留空 = 引擎内置默认锚句)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 模板:每轮引导(strategy=guide-auto)
|
|
2
2
|
# 晋升后每轮用户消息后按复杂度注入弱/深度引导;modelScope=flash 表示仅 flash 模型会话注入。
|
|
3
|
-
#
|
|
3
|
+
# 纯净模板:参数全部留空,由用户自定义;默认引导句文本见引擎内置策略默认值。
|
|
4
4
|
# 提示:把本文件放入 promptConfigsDir 目录,或把对象写入 settings.promptConfigs 数组。
|
|
5
5
|
id: example-guide-auto
|
|
6
6
|
name: 示例:每轮引导
|
|
@@ -21,5 +21,5 @@ params:
|
|
|
21
21
|
useCustom: false
|
|
22
22
|
text: ""
|
|
23
23
|
# 复杂任务判定 fallback 复用锚定卡的 complexPattern;留空 = 仅按文本长度 120 判定深/弱
|
|
24
|
-
guideWeak: "" #
|
|
25
|
-
guideDeep: "" #
|
|
24
|
+
guideWeak: "" # 简单任务自动引导句(留空 = 引擎内置默认引导句)
|
|
25
|
+
guideDeep: "" # 复杂任务自动引导句(留空 = 引擎内置默认引导句)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# 模板:自定义锚词兜底注入(strategy=custom-fallback)
|
|
2
2
|
# 首轮推理命中锚定确认词后注入一次;未命中最多两轮兜底。确认词集合 anchorWords 由
|
|
3
3
|
# writePreset 从锚句自动派生(firstTurnWord 空时);显式 firstTurnWord 覆盖派生。
|
|
4
|
+
# 两者都为空 = 不做词确认,只走未命中兜底注入(引擎不内置确认词)。
|
|
4
5
|
# 提示:把本文件放入 promptConfigsDir 目录,或把对象写入 settings.promptConfigs 数组。
|
|
5
6
|
id: example-custom-fallback
|
|
6
7
|
name: 示例:自定义锚词兜底注入
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# 模板:placeholder 动态填充位(fill 下拉可切换三种数据源)
|
|
2
2
|
# - env-facts(机器事实):默认输出 Environment facts 列表;envKeys 白名单
|
|
3
3
|
# - skill-catalog(技能目录):宿主 skills 服务(按 skillSwitches 过滤);limit/fields/providers
|
|
4
|
-
# - instruction-hint
|
|
4
|
+
# - instruction-hint(指令文件提示):fill=instruction-hint;
|
|
5
5
|
# promotion=include-subagents 子代理晋升后同样注入;sourceKind=instruction-hint + form=hint
|
|
6
6
|
# 可用 text 模板 + {{变量}} 完全自定义。
|
|
7
7
|
id: example-placeholder
|
|
@@ -14,9 +14,9 @@ promotion: include-subagents
|
|
|
14
14
|
text: |-
|
|
15
15
|
|
|
16
16
|
params:
|
|
17
|
-
envKeys:
|
|
17
|
+
envKeys: DSH_HOME,DSH_WORKSPACE # 环境变量白名单(逗号分隔);留空 = 只输出 CWD/WORKSPACE
|
|
18
18
|
limit: 20 # skill-catalog:条目数上限
|
|
19
19
|
fields: name,description # skill-catalog:输出字段
|
|
20
20
|
providers: '' # skill-catalog:提供方过滤
|
|
21
21
|
emptyBehavior: skip # skill-catalog:空结果行为
|
|
22
|
-
emptyText:
|
|
22
|
+
emptyText: 当前没有可用技能。 # skill-catalog:emptyBehavior=text 时的提示;留空 = 不注入
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# 模板:system-section 静态 system 段(缓存友好,静态内容优先放这里)
|
|
2
|
-
# order 参考:-100 身份 / 0 persona / 100-199
|
|
3
|
-
# 人设用法:params.sectionName = deployment:persona
|
|
2
|
+
# order 参考:-100 身份 / 0 persona-prefix / 100-199 工具引导 / 10200 persona-suffix。
|
|
3
|
+
# 人设用法:params.sectionName = deployment:persona-prefix(第一方指导之前)或
|
|
4
|
+
# deployment:persona-suffix(第一方指导之后)时注册为人设段
|
|
4
5
|
# (同名 shadow 全局 persona,模块列表显示「人设」徽标;子代理经 scope 链继承)。
|
|
5
6
|
# - complete: true 独占整个 system prompt(预设内互斥,UI 自动收敛,手写冲突官方 fail loud)
|
|
6
7
|
# - suppressRuntimeContext: true 抑制动态运行时快照(等价官方 includeRuntimeContext:false)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# 模板:turn-stop 轮次停止层(命中条件时阻止本轮停止,强制模型续跑一步)
|
|
2
|
+
# 接入:subject 缺省 assistantText(匹配最后一条 assistant 消息文本);不写 match
|
|
3
|
+
# 即无条件续跑。续跑上限固定在引擎内——每轮 1 次、每会话 3 次,配置关不掉。
|
|
4
|
+
id: example-turn-stop
|
|
5
|
+
name: 未完成时强制续跑
|
|
6
|
+
layer: turn-stop
|
|
7
|
+
strategy: static
|
|
8
|
+
order: 0
|
|
9
|
+
modelScope: all
|
|
10
|
+
text: |-
|
|
11
|
+
上一轮还没有给出完整交付。请继续把当前任务做完:不要停在中途,
|
|
12
|
+
也不要用「接下来我会…」的计划代替实际执行。
|
|
13
|
+
match:
|
|
14
|
+
keys:
|
|
15
|
+
- 接下来我会
|
|
16
|
+
- 稍后继续
|
|
17
|
+
- 待办如下
|
|
18
|
+
params: {}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# 模板:subagent-start 子代理启动层(向该子代理注入一条上下文)
|
|
2
|
+
# 接入:subject 缺省 subagentInfo(事件载荷序列化文本,含子代理 id/runId);不写
|
|
3
|
+
# match 即每个子代理都注入。载荷里没有稳定的角色名,按 id 筛选通常不实用——
|
|
4
|
+
# 需要筛的时候再按实际 runId 补 match。
|
|
5
|
+
id: example-subagent-start
|
|
6
|
+
name: 子代理通用守则
|
|
7
|
+
layer: subagent-start
|
|
8
|
+
strategy: static
|
|
9
|
+
order: 0
|
|
10
|
+
modelScope: all
|
|
11
|
+
text: |-
|
|
12
|
+
开始编辑之前,先确认你改的这条路径在运行时会真的被执行:查调用链,
|
|
13
|
+
或用探针跑一次看它动。找不到证据就继续查,不要凭「看起来像」就动手。
|
|
14
|
+
params: {}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# 模板:subagent-end 子代理结束层
|
|
2
|
+
# 默认仅记录。将 params.action 改为 inject-main 并填写 text,
|
|
3
|
+
# 通过官方 Agent.inject 向所属主会话投递上下文;不改写子代理结果、不唤醒空闲主会话。
|
|
4
|
+
# 接入:subject 缺省 subagentInfo(事件载荷序列化文本,含子代理 id/runId);不写 match
|
|
5
|
+
# 即每个子代理结束都记录。载荷里没有稳定角色名,需要筛的时候按实际 runId 补 match。
|
|
6
|
+
# 默认关闭:它只写日志,需要审计子代理收尾时再打开。
|
|
7
|
+
id: example-subagent-end
|
|
8
|
+
name: 子代理结束记录(只观察)
|
|
9
|
+
enabled: false
|
|
10
|
+
layer: subagent-end
|
|
11
|
+
strategy: static
|
|
12
|
+
order: 0
|
|
13
|
+
modelScope: all
|
|
14
|
+
params:
|
|
15
|
+
action: observe
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# 自定义工具模板:委托内置 world_book_upsert(有参包装示例)。
|
|
2
2
|
# 模型只见本模板声明的参数(name/content/keys),其余字段走 execute.args 固定映射:
|
|
3
3
|
# constant/order/layer/position 由模板锁定——参数面 = 官方工具定义的 parameters 定制。
|
|
4
|
-
#
|
|
4
|
+
# 保存该模板时自动装配 world-book-tools,原工具仍可用(delegate 仅自定义名称/描述/参数面)。
|
|
5
5
|
id: delegate-worldbook-upsert
|
|
6
6
|
name: my_worldbook_upsert
|
|
7
7
|
description: 新增/更新一条世界书条目(委托内置工具,常驻注入)
|
package/engine/anchor-turn.mjs
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* anchor-turn — 在用户首条真实消息之前播种一个合成锚定轮(前置锚定)。
|
|
3
|
-
*
|
|
4
|
-
* 移植自 upstream dsh-anchored-standard shared/anchor-turn.mjs (MIT):
|
|
5
|
-
* 锚定消息 PREPEND 进 `next-turn` inbox 队列、排在真实消息之前;dsh 每轮
|
|
6
|
-
* 只 claim 一条 next-turn 消息,所以首条模型请求 = 固定锚定提示(配合
|
|
7
|
-
* 零工具模式时 = 空工具面上的 "we" 锚定),用户真实消息由下一轮 claim——
|
|
8
|
-
* 彼时 bootstrap 已晋升、目录已开放。
|
|
9
|
-
*
|
|
10
|
-
* 与 near-anchor(first-turn-anchor 策略,消息级追加)正交:本模块是轮级
|
|
11
|
-
* 前置(真实消息延后一轮),near-anchor 是首条真实用户消息后的同轮追加。
|
|
12
|
-
*
|
|
13
|
-
* 在首条消息前(而非会话创建时)锚定,保持空白会话的预设切换器可用。
|
|
14
|
-
* 子代理默认跳过(其 brief 即计划);includeSubagents: true 让子代理也
|
|
15
|
-
* 走锚定轮。
|
|
16
|
-
*
|
|
17
|
-
* Durability 免费:prepend 经 `agent/inbox/spliced` 事件持久化,崩溃后
|
|
18
|
-
* 队列按序恢复;inbox replay 不触发 `inserted` 通知,锚定永不重注入。
|
|
19
|
-
*
|
|
20
|
-
* Robustness:插件来源消息(含自身锚定)永不再次锚定。
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
import { booleanOption, validateConfig } from './shared.mjs'
|
|
24
|
-
|
|
25
|
-
/** Cordis plugin name used by loader diagnostics. */
|
|
26
|
-
export const name = 'anchor-turn'
|
|
27
|
-
|
|
28
|
-
/** 默认锚定文本(合成首轮展示给模型)。 */
|
|
29
|
-
export const ANCHOR_TEXT = 'This round is a test. Tools are not open yet; all tools will open next round.'
|
|
30
|
-
|
|
31
|
-
/** Every config key this plugin accepts — anything else is a typo. */
|
|
32
|
-
const ALLOWED_KEYS = new Set(['enabled', 'text', 'includeSubagents'])
|
|
33
|
-
|
|
34
|
-
/** 全新会话(无任何历史 user/message)才锚定。 */
|
|
35
|
-
function isFreshSession(agent, includeSubagents = false) {
|
|
36
|
-
if (!includeSubagents && (agent.session.header.delegationDepth ?? 0) > 0) return false
|
|
37
|
-
return !agent.session.events.some((event) => event.type === 'user/message')
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** 注册首消息锚定注入。 */
|
|
41
|
-
export function apply(ctx, config) {
|
|
42
|
-
const source = validateConfig(name, config, ALLOWED_KEYS)
|
|
43
|
-
if (source.enabled === false) return
|
|
44
|
-
const text = typeof source.text === 'string' && source.text.length > 0
|
|
45
|
-
? source.text
|
|
46
|
-
: ANCHOR_TEXT
|
|
47
|
-
const includeSubagents = booleanOption(name, source.includeSubagents, 'includeSubagents', false)
|
|
48
|
-
|
|
49
|
-
ctx.on('agent/inbox/inserted', ({ agent, message }) => {
|
|
50
|
-
if (agent?.session === undefined || agent?.inbox?.prepend === undefined) return
|
|
51
|
-
if (!isFreshSession(agent, includeSubagents)) return
|
|
52
|
-
// 插件来源消息(包括我们自己的锚定)永不再次锚定。
|
|
53
|
-
if (message?.source?.kind === 'plugin') return
|
|
54
|
-
agent.inbox.prepend('next-turn', {
|
|
55
|
-
id: typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function'
|
|
56
|
-
? crypto.randomUUID()
|
|
57
|
-
: `anchor-turn-${Date.now()}-${Math.random().toString(36).slice(2)}`,
|
|
58
|
-
role: 'user',
|
|
59
|
-
content: [{ type: 'text', text }],
|
|
60
|
-
source: {
|
|
61
|
-
kind: 'plugin',
|
|
62
|
-
plugin: name,
|
|
63
|
-
form: 'notice',
|
|
64
|
-
summary: 'zero-tool anchor turn',
|
|
65
|
-
},
|
|
66
|
-
})
|
|
67
|
-
})
|
|
68
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* code-presentation - 晋升后 PTC mode wire 呈现。
|
|
3
|
-
*
|
|
4
|
-
* 从 tool-bootstrap 拆出的独立关注点:bootstrap 负责首轮工具目录窄化,
|
|
5
|
-
* 本模块只负责晋升后把工具呈现切换为 PTC mode(单 run_code,由
|
|
6
|
-
* tools.presentAs('ptc') 提供)。"只要 PTC 不要 bootstrap" = 组合只挂本行;
|
|
7
|
-
* PTC+bootstrap = 同时挂两行(行序:tool-bootstrap 在前,本行在后)。
|
|
8
|
-
*
|
|
9
|
-
* 相位与 tool-bootstrap / context-gate 同源:epoch-aware promotion
|
|
10
|
-
* (compaction-epoch.mjs)。晋升后(tool/call 或 assistant/message,按
|
|
11
|
-
* promoteOn,默认 either)应用 PTC mode;compaction/end 释放(压缩后回到
|
|
12
|
-
* 受控相位,重新晋升再应用)。
|
|
13
|
-
*
|
|
14
|
-
* SUBAGENTS: includeSubagents=false(默认)时子代理(delegationDepth > 0)
|
|
15
|
-
* 首次请求即应用呈现(继承完整目录语义);true 时子代理跟随主会话相位。
|
|
16
|
-
*
|
|
17
|
-
* Robustness: 应用/释放失败降级(绝不 brick 会话);invalid config fail at
|
|
18
|
-
* apply time,即 preset 挂载处可见可修。
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
import { createEpochPromotion } from './compaction-epoch.mjs'
|
|
22
|
-
import { booleanOption, parsePromoteOn, validateConfig } from './shared.mjs'
|
|
23
|
-
|
|
24
|
-
/** Cordis plugin name used by loader diagnostics. */
|
|
25
|
-
export const name = 'code-presentation'
|
|
26
|
-
|
|
27
|
-
/** 无 inject:监听器只在使用时触碰 ctx 服务(同 tool-bootstrap 纪律)。 */
|
|
28
|
-
export const inject = []
|
|
29
|
-
|
|
30
|
-
/** Every config key this plugin accepts — anything else is a typo. */
|
|
31
|
-
const ALLOWED_KEYS = new Set(['usePtcMode', 'includeSubagents', 'promoteOn'])
|
|
32
|
-
|
|
33
|
-
/** Register the post-promotion Code Mode presentation. */
|
|
34
|
-
export function apply(ctx, config) {
|
|
35
|
-
const source = validateConfig(name, config, ALLOWED_KEYS)
|
|
36
|
-
// 默认 false:PTC mode 呈现是 opt-in,未声明 = 原生完整工具目录。
|
|
37
|
-
const usePtcMode = booleanOption(name, source.usePtcMode, 'usePtcMode', false)
|
|
38
|
-
if (!usePtcMode) return
|
|
39
|
-
const includeSubagents = booleanOption(name, source.includeSubagents, 'includeSubagents', false)
|
|
40
|
-
const promoteEvents = parsePromoteOn(name, source.promoteOn)
|
|
41
|
-
const promotion = createEpochPromotion(promoteEvents, { includeSubagents })
|
|
42
|
-
|
|
43
|
-
const presentationBySession = new WeakMap()
|
|
44
|
-
const agentBySession = new WeakMap()
|
|
45
|
-
const presentationState = (session) => {
|
|
46
|
-
let state = presentationBySession.get(session)
|
|
47
|
-
if (state === undefined) {
|
|
48
|
-
state = { applied: false, disposer: undefined }
|
|
49
|
-
presentationBySession.set(session, state)
|
|
50
|
-
}
|
|
51
|
-
return state
|
|
52
|
-
}
|
|
53
|
-
const applyCodePresentation = (agent) => {
|
|
54
|
-
const session = agent?.session
|
|
55
|
-
if (session === undefined) return
|
|
56
|
-
const state = presentationState(session)
|
|
57
|
-
if (state.applied) return
|
|
58
|
-
const tools = agent.ctx?.tools
|
|
59
|
-
if (tools === undefined || typeof tools.presentAs !== 'function') return
|
|
60
|
-
state.disposer = tools.presentAs('ptc')
|
|
61
|
-
state.applied = true
|
|
62
|
-
}
|
|
63
|
-
const releaseCodePresentation = (session) => {
|
|
64
|
-
const state = presentationBySession.get(session)
|
|
65
|
-
if (state === undefined) return
|
|
66
|
-
if (typeof state.disposer === 'function') {
|
|
67
|
-
try { state.disposer() } catch { /* never brick the session */ }
|
|
68
|
-
}
|
|
69
|
-
state.disposer = undefined
|
|
70
|
-
state.applied = false
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
ctx.on('session/event', (session, event) => promotion.observe(session, event))
|
|
74
|
-
ctx.on('session/event', (session, event) => {
|
|
75
|
-
if (event.type === 'compaction/end') {
|
|
76
|
-
releaseCodePresentation(session)
|
|
77
|
-
return
|
|
78
|
-
}
|
|
79
|
-
if (event.type !== 'step/end' && event.type !== 'turn/end') return
|
|
80
|
-
const agent = agentBySession.get(session)
|
|
81
|
-
if (agent !== undefined && promotion.status(agent).promoted) applyCodePresentation(agent)
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
ctx.on('system-prompt/assemble', async (_assembly, context, next) => {
|
|
85
|
-
// Downstream errors propagate untouched; only this filter's own logic is guarded.
|
|
86
|
-
const assembled = await next()
|
|
87
|
-
try {
|
|
88
|
-
const agent = context.agent
|
|
89
|
-
if (agent === undefined || agent.session === undefined) return assembled
|
|
90
|
-
agentBySession.set(agent.session, agent)
|
|
91
|
-
if ((agent.session?.header?.delegationDepth ?? 0) > 0 && !includeSubagents) {
|
|
92
|
-
// 默认:子代理继承完整目录 → 直接应用呈现。
|
|
93
|
-
applyCodePresentation(agent)
|
|
94
|
-
return assembled
|
|
95
|
-
}
|
|
96
|
-
if (promotion.status(agent).promoted) applyCodePresentation(agent)
|
|
97
|
-
return assembled
|
|
98
|
-
} catch {
|
|
99
|
-
// 呈现失败不阻断会话:保持原样。
|
|
100
|
-
return assembled
|
|
101
|
-
}
|
|
102
|
-
})
|
|
103
|
-
}
|