dsh-aiterm 0.5.12 → 0.5.13
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 +4 -0
- package/lib/host/prompt.js +6 -23
- package/lib/host/tools.js +13 -2
- package/lib/index.js +4 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -199,6 +199,10 @@ owner 绑定和权限判定都不变;唯一的注册差异是它们会额外
|
|
|
199
199
|
但附带一个**步骤级**条件:只有当前模型步骤的 Agent 已展开对应分组时才进入该步骤的
|
|
200
200
|
工具快照。发现入口本身不接受任何终端操作,也不改变权限。
|
|
201
201
|
|
|
202
|
+
> `progressive` 下**不再注入独立的系统提示段**:权限模型、控制权释放、先读屏再发命令等规则
|
|
203
|
+
> 全部写在 `aiterm_discover` 的工具描述里(`DISCOVER_TOOL_DESCRIPTION`),每轮只出现一次。
|
|
204
|
+
> `full` 模式仍然注入 `tool:aiterm` 提示段。
|
|
205
|
+
|
|
202
206
|
| 分组 | 成员 | 何时可用 |
|
|
203
207
|
| --- | --- | --- |
|
|
204
208
|
| `session` | `list` / `status` / `read` / `screen` / `screenshot` / `wait` / `send` / `release_control` | 展开 `session` 后的**下一个**模型步骤 |
|
package/lib/host/prompt.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Registered once the `systemPrompt` service exists, at the terminal-tool order
|
|
5
5
|
* so it sits next to the other terminal guidance. Kept short: it ships with
|
|
6
|
-
* every request
|
|
7
|
-
* the
|
|
8
|
-
*
|
|
6
|
+
* every request, so it is registered only in `full` mode. `progressive` mode
|
|
7
|
+
* folds the same rules into the always-resident `aiterm_discover` description
|
|
8
|
+
* (`DISCOVER_TOOL_DESCRIPTION` in `./tools.js`): a separate section there would
|
|
9
|
+
* duplicate guidance the model already receives with the tool schema.
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
/** Stable prompt section name. */
|
|
@@ -20,37 +21,19 @@ export const PROMPT_TEXT = [
|
|
|
20
21
|
'Prefer reading the screen before and after a command, send a newline with a trailing "\\r" (or enter:true), and never assume a command finished without checking its output.',
|
|
21
22
|
].join(' ')
|
|
22
23
|
|
|
23
|
-
/**
|
|
24
|
-
* Guidance text shown to the model in `progressive` mode.
|
|
25
|
-
*
|
|
26
|
-
* Only the always-resident discovery entry is named: naming any other tool
|
|
27
|
-
* could disclose one that another restriction hides from this Agent.
|
|
28
|
-
*/
|
|
29
|
-
export const PROGRESSIVE_PROMPT_TEXT = [
|
|
30
|
-
'SSH/Telnet tools are disclosed progressively. Only the discovery entry `aiterm_discover` is available at first: call it with no arguments to list the available groups (session, history, automation, management), the tools this Agent may see, and the groups already expanded; call it again with one group to expand it.',
|
|
31
|
-
'Expansion affects the next model step only: a tool expanded during this step is not callable until the next step, so expand first and call the tool afterwards.',
|
|
32
|
-
'Expansion never grants permission. Each session keeps its own AI permission: read-only (只读) lets you read output but never send input; write-only (只写) lets you send input but never read output; read-write (读写) allows both. Only the user can change it — a refusal is a policy decision, so report it instead of retrying or working around it.',
|
|
33
|
-
'Start with the session group and list sessions: the other groups need an existing session id. While you send input, you hold control of the session and the user\'s typing is blocked until you go idle or use the release-control tool; call it as soon as you finish a multi-step operation so the user can type again.',
|
|
34
|
-
'If the user takes over control, your writes are refused until they release it. Use the status tool to see the current owner and the read/screen tools to inspect the screen before acting.',
|
|
35
|
-
'Prefer reading the screen before and after a command, send a newline with a trailing "\\r" (or enter:true), and never assume a command finished without checking its output.',
|
|
36
|
-
].join(' ')
|
|
37
|
-
|
|
38
24
|
/**
|
|
39
25
|
* Register the prompt section once the systemPrompt service exists.
|
|
40
26
|
* @param {any} ctx plugin context.
|
|
41
|
-
* @param {unknown} [toolDisclosure] configured `toolDisclosure` value; only the
|
|
42
|
-
* exact `progressive` string selects the progressive guidance.
|
|
43
27
|
* @returns {void}
|
|
44
28
|
*/
|
|
45
|
-
export function registerPrompt(ctx
|
|
46
|
-
const text = toolDisclosure === 'progressive' ? PROGRESSIVE_PROMPT_TEXT : PROMPT_TEXT
|
|
29
|
+
export function registerPrompt(ctx) {
|
|
47
30
|
ctx.inject(['systemPrompt'], (promptCtx) => {
|
|
48
31
|
promptCtx.effect(
|
|
49
32
|
() =>
|
|
50
33
|
promptCtx.systemPrompt.section({
|
|
51
34
|
name: PROMPT_SECTION_NAME,
|
|
52
35
|
order: promptCtx.systemPrompt.getSectionOrder('TOOL_PTY'),
|
|
53
|
-
text,
|
|
36
|
+
text: PROMPT_TEXT,
|
|
54
37
|
}),
|
|
55
38
|
'aiterm: prompt section',
|
|
56
39
|
)
|
package/lib/host/tools.js
CHANGED
|
@@ -154,6 +154,18 @@ const AUDIT_ENTRY_SCHEMA = {
|
|
|
154
154
|
/** Name of the always-resident progressive-mode discovery entry. */
|
|
155
155
|
export const DISCOVER_TOOL_NAME = 'aiterm_discover'
|
|
156
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Model-facing description of the discovery entry.
|
|
159
|
+
*
|
|
160
|
+
* In `progressive` mode this description is the single resident home of the
|
|
161
|
+
* disclosure and session-control rules (`lib/host/prompt.js` registers no
|
|
162
|
+
* system-prompt section there), so the request carries that guidance once
|
|
163
|
+
* instead of twice. It names only groups, never another tool: a tool this
|
|
164
|
+
* Agent cannot see must not be leaked here.
|
|
165
|
+
*/
|
|
166
|
+
export const DISCOVER_TOOL_DESCRIPTION =
|
|
167
|
+
'Discover the SSH/Telnet toolset. Call with no arguments to list the available groups, the tools this Agent may see, and the groups already expanded; call again with one group (session, history, automation, management) to expand it. Begin with the session group: the other groups need an existing session id. Expansion only reveals schemas, takes effect on the next model step, and never grants permission. Each session keeps its own AI permission - read-only (只读) never sends input, write-only (只写) never reads output, read-write (读写) allows both - and only the user can change it, so report a refusal instead of retrying or working around it. While you send input you hold control of the session and the user cannot type; release control as soon as a multi-step operation ends. Read the screen before and after a command, send a newline with a trailing "\\r" (or enter:true), and never assume a command finished without checking its output.'
|
|
168
|
+
|
|
157
169
|
/** Group names accepted by the discovery entry. */
|
|
158
170
|
const DISCLOSURE_GROUP_NAMES = Object.freeze(Object.keys(DISCLOSURE_GROUPS))
|
|
159
171
|
|
|
@@ -1478,8 +1490,7 @@ export function registerTools(ctx, plugin) {
|
|
|
1478
1490
|
if (progressive) {
|
|
1479
1491
|
const discoveryDefinition = {
|
|
1480
1492
|
name: DISCOVER_TOOL_NAME,
|
|
1481
|
-
description:
|
|
1482
|
-
'Discover the SSH/Telnet toolset. Call with no arguments to list the available groups, the tools this Agent may see, and the groups already expanded; call again with one group (session, history, automation, management) to expand it. Expansion only reveals schemas: it takes effect on the next model step, never grants permission, and existing read-only/write-only AI modes and human control still refuse calls. Begin with the session group.',
|
|
1493
|
+
description: DISCOVER_TOOL_DESCRIPTION,
|
|
1483
1494
|
parameters: {
|
|
1484
1495
|
type: 'object',
|
|
1485
1496
|
additionalProperties: false,
|
package/lib/index.js
CHANGED
|
@@ -115,8 +115,10 @@ export function apply(ctx, config) {
|
|
|
115
115
|
// 1) Model-facing tools (`tools` is guaranteed by `inject`).
|
|
116
116
|
registerTools(ctx, plugin)
|
|
117
117
|
|
|
118
|
-
// 2) System-prompt guidance
|
|
119
|
-
|
|
118
|
+
// 2) System-prompt guidance. `progressive` mode carries these rules in the
|
|
119
|
+
// always-resident `aiterm_discover` description instead, so registering a
|
|
120
|
+
// section there would duplicate them on every request.
|
|
121
|
+
if (resolved.toolDisclosure !== 'progressive') registerPrompt(ctx)
|
|
120
122
|
|
|
121
123
|
// 3) HTTP RPC + SSE, only when the Web composition provides both services.
|
|
122
124
|
// `ctx.inject` never fires in a headless composition, which is exactly the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-aiterm",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.13",
|
|
4
4
|
"description": "SSH and Telnet terminals for DeepSeek Harness: one real terminal shared by you and the AI, with per-session AI permissions and token-cheap delta reads.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|