@epoch-agent/plugin-terminal 0.7.1 → 0.9.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 +7 -0
- package/dist/index.d.ts +22 -2
- package/dist/index.js +6 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -287,6 +287,13 @@ per-call 覆盖等于让「哪个 shell 在跑」有第二个说了算的地方
|
|
|
287
287
|
还剩一条 **10 MB** 的硬上限,超了才恢复截断 + 杀进程 —— 一条命令吐 10 MB 到 stdout
|
|
288
288
|
不是一次正常的命令输出。三条路径共用同一句措辞(`OVER_CAPTURE_NOTICE`)。
|
|
289
289
|
|
|
290
|
+
⚠️ **这一整套要成立,`terminal` 必须声明 `governsOwnOutput: true`**(2026-09-08 补的
|
|
291
|
+
一格,在 [index.ts](./src/index.ts) 的工具定义上)。少了它,引擎的输出预算会落在
|
|
292
|
+
`spillOutput()` **之后**:刚拼好的「头 2000 + 省略标记 + 尾 2000 + 落盘路径」被按
|
|
293
|
+
预算再切一遍,省略标记、尾部和那条取回路径一起没了 —— 而上面那句「最需要看最后几行」
|
|
294
|
+
正是这一整套的动机。判据在 `EpochTool.governsOwnOutput` 的 JSDoc 上;
|
|
295
|
+
⚠️ **失败路径不吃这个豁免**(那条路上 `spillOutput()` 一次都没被调到)。
|
|
296
|
+
|
|
290
297
|
落盘一律 **best-effort**:写不进去就退回纯截断、如实说明,**不把一次成功的调用变成
|
|
291
298
|
失败**。真正写盘的那几行在 [infra 的 artifact-store](../../infra/src/artifact-store.ts)
|
|
292
299
|
(`0700` 目录、`0600` 文件、`open(path,'wx')` 独占写,所以预埋 symlink
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BackgroundTaskInfo, EpochTool, EpochPlugin } from '@epoch-agent/protocol';
|
|
2
|
-
import { SandboxMode, IsolationBackend, SandboxEnforcement, FailureVerdict, ProcessTable, SandboxPolicy } from '@epoch-agent/infra';
|
|
2
|
+
import { SandboxMode, IsolationBackend, SandboxEnforcement, FailureVerdict, ProcessTable, JobsListener, SandboxPolicy } from '@epoch-agent/infra';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 把一次 shell 调用包进沙箱,并算出这一次要**如实上报**的东西(方案 46 §四)。
|
|
@@ -311,6 +311,26 @@ declare function waitTask(sessionId: string, id: string, timeoutMs: number): Pro
|
|
|
311
311
|
* 不点名的话它会在这一轮被静默改掉。
|
|
312
312
|
*/
|
|
313
313
|
declare function rekeyTasks(from: string, to: string): void;
|
|
314
|
+
/**
|
|
315
|
+
* 订阅「哪个会话的任务清单变了」(方案 36 PR-3)。回传退订函数。
|
|
316
|
+
*
|
|
317
|
+
* 宿主要的第三个口子 —— 前两个({@link listTasks} / {@link taskOutput})答的是
|
|
318
|
+
* 「现在是什么样」,这一个答的是「什么时候该再问一遍」。少了它,`epoch web`
|
|
319
|
+
* 侧栏那行「N 在跑 / M」只在回合状态跃迁时才重取,于是一个会话空闲着的时候,
|
|
320
|
+
* 一条自己跑完(或者崩了)的构建会**无限期**停在「在跑」上。
|
|
321
|
+
*
|
|
322
|
+
* ## ⚠️ 这一个**不过 {@link isCommandJob} 那道闸**
|
|
323
|
+
*
|
|
324
|
+
* 和上面三个读的口子同一条判据(方案 62 §五:可见性和生命周期是两件事)——
|
|
325
|
+
* 检视面板列得出持久会话,那么持久会话的增删也得让面板知道。而且这里也**没法**
|
|
326
|
+
* 过:载荷只有 `sessionId`,到这一层已经不知道是哪一格变的了(判据见 infra 的
|
|
327
|
+
* `JobsListener`)。要过就得把 kind 带上来,而那是在这条通道上开一个只有这一处
|
|
328
|
+
* 用得上的载荷。
|
|
329
|
+
*
|
|
330
|
+
* 代价是一次多余的重取:只起过持久会话、没起过后台命令的会话上,`shell_send`
|
|
331
|
+
* 会让宿主重取一次任务清单。那一发本来就要发(面板里那一格是持久会话自己的)。
|
|
332
|
+
*/
|
|
333
|
+
declare function observeTasks(listener: JobsListener): () => void;
|
|
314
334
|
/**
|
|
315
335
|
* 忘掉**所有**会话的后台命令记录(**不杀进程**)。只给用例用。
|
|
316
336
|
*
|
|
@@ -719,4 +739,4 @@ declare const TASK_TOOLS: readonly EpochTool[];
|
|
|
719
739
|
|
|
720
740
|
declare const terminalPlugin: EpochPlugin;
|
|
721
741
|
|
|
722
|
-
export { MAX_SHELLS, MAX_SHELL_CHUNK, MAX_SHELL_OUTPUT, MAX_TASKS, SHELL_IDLE_MS, SHELL_SWEEP_MS, SHELL_TOOLS, type ShellInfo, type ShellStatus, TASK_TOOLS, cleanupBackgroundProcesses, clearAllShells, clearAllTasks, closeShell, describeShell, describeTask, listShells, listTasks, openShell, readShell, rekeyTasks, sendToShell, startTask, stopTask, sweepIdleShells, taskOutput, taskSandbox, terminalPlugin, waitTask };
|
|
742
|
+
export { MAX_SHELLS, MAX_SHELL_CHUNK, MAX_SHELL_OUTPUT, MAX_TASKS, SHELL_IDLE_MS, SHELL_SWEEP_MS, SHELL_TOOLS, type ShellInfo, type ShellStatus, TASK_TOOLS, cleanupBackgroundProcesses, clearAllShells, clearAllTasks, closeShell, describeShell, describeTask, listShells, listTasks, observeTasks, openShell, readShell, rekeyTasks, sendToShell, startTask, stopTask, sweepIdleShells, taskOutput, taskSandbox, terminalPlugin, waitTask };
|
package/dist/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
rekeyJobs,
|
|
16
16
|
shellSpawnArgs,
|
|
17
17
|
stopJob,
|
|
18
|
+
subscribeJobs,
|
|
18
19
|
waitJob
|
|
19
20
|
} from "@epoch-agent/infra";
|
|
20
21
|
// src/sandbox.ts
|
|
@@ -153,6 +154,9 @@ async function waitTask(sessionId, id, timeoutMs) {
|
|
|
153
154
|
function rekeyTasks(from, to) {
|
|
154
155
|
rekeyJobs(from, to, ["command"]);
|
|
155
156
|
}
|
|
157
|
+
function observeTasks(listener) {
|
|
158
|
+
return subscribeJobs(listener);
|
|
159
|
+
}
|
|
156
160
|
function clearAllTasks() {
|
|
157
161
|
clearAllJobs(["command"]);
|
|
158
162
|
}
|
|
@@ -1252,6 +1256,7 @@ var terminalTool = {
|
|
|
1252
1256
|
},
|
|
1253
1257
|
operation: "command",
|
|
1254
1258
|
describeTarget: (args) => String(args["command"] ?? ""),
|
|
1259
|
+
governsOwnOutput: true,
|
|
1255
1260
|
async execute(args, ctx) {
|
|
1256
1261
|
const command = String(args["command"] ?? "");
|
|
1257
1262
|
const isBackground = Boolean(args["background"]);
|
|
@@ -1458,6 +1463,7 @@ export {
|
|
|
1458
1463
|
describeTask,
|
|
1459
1464
|
listShells,
|
|
1460
1465
|
listTasks,
|
|
1466
|
+
observeTasks,
|
|
1461
1467
|
openShell,
|
|
1462
1468
|
readShell,
|
|
1463
1469
|
rekeyTasks,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epoch-agent/plugin-terminal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "epoch-agent 终端命令执行插件",
|
|
6
6
|
"repository": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"node-pty": "^1.1.0",
|
|
25
|
-
"@epoch-agent/infra": "0.
|
|
26
|
-
"@epoch-agent/protocol": "0.
|
|
25
|
+
"@epoch-agent/infra": "0.9.0",
|
|
26
|
+
"@epoch-agent/protocol": "0.9.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^26.1.2",
|