@epoch-agent/plugin-terminal 0.8.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/dist/index.d.ts +22 -2
- package/dist/index.js +5 -0
- package/package.json +3 -3
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
|
}
|
|
@@ -1459,6 +1463,7 @@ export {
|
|
|
1459
1463
|
describeTask,
|
|
1460
1464
|
listShells,
|
|
1461
1465
|
listTasks,
|
|
1466
|
+
observeTasks,
|
|
1462
1467
|
openShell,
|
|
1463
1468
|
readShell,
|
|
1464
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",
|