@mininglamp-oss/octo-runtime 1.1.12 → 1.1.14
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 +1 -1
- package/apps/cli/dist/adapters.d.ts +19 -1
- package/apps/cli/dist/adapters.js +154 -28
- package/apps/cli/dist/build-info.json +2 -2
- package/apps/cli/dist/codex.d.ts +5 -0
- package/apps/cli/dist/codex.js +36 -0
- package/apps/cli/dist/kernel.d.ts +4 -0
- package/apps/cli/dist/kernel.js +84 -0
- package/apps/cli/dist/main.js +8 -7
- package/apps/cli/dist/manifest.json +33 -22
- package/apps/cli/dist/output.d.ts +1 -0
- package/apps/cli/dist/output.js +8 -4
- package/apps/cli/dist/playboard.js +21 -12
- package/apps/cli/dist/provider-launch.d.ts +28 -0
- package/apps/cli/dist/provider-launch.js +52 -0
- package/apps/cli/dist/providers.d.ts +182 -0
- package/apps/cli/dist/providers.js +34 -0
- package/dist/public/adapter-sdk.d.ts +2 -0
- package/dist/public/adapter-sdk.js +2 -0
- package/dist/public/protocol.d.ts +2 -2
- package/dist/public/protocol.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/dist/index.js +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.d.ts +26 -10
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +44 -53
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.d.ts +10 -35
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.js +21 -29
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/agent-env.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/agent-env.js +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.d.ts +14 -68
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.js +77 -61
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.d.ts +19 -31
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.js +28 -18
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/agent-env.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/agent-env.js +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.d.ts +6 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +55 -54
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/engine.d.ts +54 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/engine.js +147 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/environment.js +4 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +20 -92
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.js +103 -217
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/mcp.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/mcp.js +4 -11
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.d.ts +9 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.js +77 -81
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-SMTJTIN7.js → chunk-AE3OJBDS.js} +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-H3S6WM37.js → chunk-NGR74QLF.js} +0 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-RISQ6NGV.js → chunk-XIUZ6GXG.js} +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.d.ts +0 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +6 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +16 -21
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.d.ts +14 -16
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.js +29 -46
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/agent-env.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/agent-env.js +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +4 -7
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.d.ts +13 -21
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.js +47 -36
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.d.ts +24 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.js +14 -7
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.d.ts +24 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.js +13 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.d.ts +24 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.js +14 -7
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.d.ts +7 -7
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +28 -31
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +16 -25
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +113 -179
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.d.ts +24 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.js +14 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.d.ts +24 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.js +14 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/activity.d.ts +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.d.ts +48 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.js +234 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/approval.js +7 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/execution-scope.d.ts +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +25 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +112 -59
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/mcp.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.d.ts +11 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.js +89 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/provider-launch.d.ts +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/provider-launch.js +25 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.js +10 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.d.ts +19 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.js +154 -28
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/codex.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/codex.js +36 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/kernel.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/kernel.js +84 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +8 -7
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +33 -22
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +8 -4
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +21 -12
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/provider-launch.d.ts +28 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/provider-launch.js +52 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/providers.d.ts +182 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/providers.js +34 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +20 -20
- package/node_modules/@mininglamp-oss/octo-runtime-client/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-client/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc.schema.json +3 -104
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/protocol.schema.json +166 -1870
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +122 -65
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +13 -85
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-output-silence.d.ts +21 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-output-silence.js +176 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.d.ts +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +8 -4
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +17 -20
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/adapter-metadata.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.d.ts +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.js +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-catalog.d.ts +0 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-catalog.js +3 -9
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-configuration.js +1 -8
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.d.ts +1 -5
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +3 -292
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/experience.js +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +18 -13
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +90 -608
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.js +32 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +7 -18
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +34 -189
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.d.ts +11 -22
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +38 -78
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/multimodal.js +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.d.ts +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.js +5 -40
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
- package/package.json +34 -37
- package/packages/octo-runtime-protocol/schema/kernel-ipc.schema.json +3 -104
- package/packages/octo-runtime-protocol/schema/protocol.schema.json +166 -1870
- package/dist/public/codex.d.ts +0 -1
- package/dist/public/codex.js +0 -1
- package/dist/public/dsh.d.ts +0 -2
- package/dist/public/dsh.js +0 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/actmode.d.ts +0 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/actmode.js +0 -8
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-configuration-fixtures.json +0 -1219
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-fixtures.json +0 -5988
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-client.behavior.json +0 -56
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/native-invoke-fixtures.json +0 -116
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/run-protocol-fixtures.json +0 -761
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/runtime-selection-fixtures.json +0 -663
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/session-name-fixtures.json +0 -191
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/context.d.ts +0 -12
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/context.js +0 -89
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/execution-preparation.d.ts +0 -33
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/execution-preparation.js +0 -93
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/actmode.d.ts +0 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/actmode.js +0 -36
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/execution-plan.d.ts +0 -3
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/execution-plan.js +0 -80
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/model-context.d.ts +0 -3
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/model-context.js +0 -9
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/runtime-selection.d.ts +0 -3
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/runtime-selection.js +0 -68
- /package/node_modules/@mininglamp-oss/octo-runtime-client/{schema → fixtures}/kernel-ipc-fixtures.json +0 -0
- /package/packages/octo-runtime-protocol/{schema → test/fixtures}/kernel-ipc-fixtures.json +0 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { performance } from "node:perf_hooks";
|
|
3
|
+
import { isTerminal } from "@mininglamp-oss/octo-runtime-protocol";
|
|
4
|
+
const THRESHOLD_MS = 60_000;
|
|
5
|
+
const clock = {
|
|
6
|
+
now: () => performance.now(),
|
|
7
|
+
schedule(callback, delay) {
|
|
8
|
+
const timer = setTimeout(callback, delay);
|
|
9
|
+
timer.unref?.();
|
|
10
|
+
return () => clearTimeout(timer);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 每轮 canonical 执行独占的模型输出观察器;不改变 watchdog 预算或 Provider。
|
|
15
|
+
* Core 在源 next 完成时交入事实,在等待下一个结果时订阅通知;只保留一个待发槽。
|
|
16
|
+
* 消息身份、公开性和文本增量由 Core 已有的消息准备步骤判断,不再维护第二套消息缓存。
|
|
17
|
+
*/
|
|
18
|
+
export class ModelOutputSilence {
|
|
19
|
+
time;
|
|
20
|
+
#tools = new Set();
|
|
21
|
+
#interactions = new Set();
|
|
22
|
+
#activities = new Map();
|
|
23
|
+
#queued = false;
|
|
24
|
+
#since;
|
|
25
|
+
#reported = false;
|
|
26
|
+
#disposed = false;
|
|
27
|
+
#pending;
|
|
28
|
+
#wake;
|
|
29
|
+
#cancelTimer;
|
|
30
|
+
constructor(time = clock) {
|
|
31
|
+
this.time = time;
|
|
32
|
+
this.#since = time.now();
|
|
33
|
+
}
|
|
34
|
+
/** 唯一等待者;解除监听同时释放 timer,避免输出密集时累积 Promise 监听。 */
|
|
35
|
+
listen(wake) {
|
|
36
|
+
this.#wake = wake;
|
|
37
|
+
if (this.#pending)
|
|
38
|
+
wake();
|
|
39
|
+
else
|
|
40
|
+
this.#arm();
|
|
41
|
+
return () => {
|
|
42
|
+
if (this.#wake !== wake)
|
|
43
|
+
return;
|
|
44
|
+
this.#wake = undefined;
|
|
45
|
+
this.#cancelTimer?.();
|
|
46
|
+
this.#cancelTimer = undefined;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
take() {
|
|
50
|
+
const notice = this.#pending;
|
|
51
|
+
this.#pending = undefined;
|
|
52
|
+
// 槽交付后才允许新区间计时;使用真实输出更新的 since,不从交付时刻重算。
|
|
53
|
+
this.#arm();
|
|
54
|
+
return notice;
|
|
55
|
+
}
|
|
56
|
+
/** 原生侧工具事实补充 canonical;usage、传输心跳及一般进展均不算模型文本。 */
|
|
57
|
+
activity(activity) {
|
|
58
|
+
if (this.#disposed)
|
|
59
|
+
return;
|
|
60
|
+
if (activity.kind !== "turn_progress" ||
|
|
61
|
+
activity.method !== "item_lifecycle" ||
|
|
62
|
+
!activity.toolCallId)
|
|
63
|
+
return;
|
|
64
|
+
if (activity.toolState === "started")
|
|
65
|
+
this.#tools.add(activity.toolCallId);
|
|
66
|
+
else if (activity.toolState === "completed")
|
|
67
|
+
this.#finishTool(activity.toolCallId);
|
|
68
|
+
this.#sync();
|
|
69
|
+
}
|
|
70
|
+
/** 输入须先通过 canonical 校验;hasOutput 只接受 Core 准备后的公开新增文本事实。 */
|
|
71
|
+
canonical(event, hasOutput = false) {
|
|
72
|
+
if (this.#disposed)
|
|
73
|
+
return;
|
|
74
|
+
if (isTerminal(event)) {
|
|
75
|
+
this.dispose();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const p = event.payload;
|
|
79
|
+
if (event.type === "run.queued")
|
|
80
|
+
this.#queued = true;
|
|
81
|
+
if (event.type === "run.started" || event.type === "model_step.started")
|
|
82
|
+
this.#queued = false;
|
|
83
|
+
if (event.type === "tool_call.create")
|
|
84
|
+
this.#tools.add(String(p.id));
|
|
85
|
+
if (event.type === "tool_call.update" &&
|
|
86
|
+
["completed", "failed", "cancelled", "stopped"].includes(String(p.status)))
|
|
87
|
+
this.#finishTool(String(p.id));
|
|
88
|
+
if (event.type === "interaction.requested" && p.delivery !== "async")
|
|
89
|
+
this.#interactions.add(String(p.interactionId));
|
|
90
|
+
if (event.type === "interaction.resolved") {
|
|
91
|
+
const id = String(p.interactionId);
|
|
92
|
+
this.#interactions.delete(id);
|
|
93
|
+
for (const [key, subject] of this.#activities)
|
|
94
|
+
if (subject.type === "interaction" && subject.id === id)
|
|
95
|
+
this.#activities.delete(key);
|
|
96
|
+
}
|
|
97
|
+
if (event.type === "activity.started") {
|
|
98
|
+
this.#queued = false;
|
|
99
|
+
if (["executing_tool", "waiting_input", "waiting_approval"].includes(event.payload.kind))
|
|
100
|
+
this.#activities.set(event.payload.activityId, event.payload.subject);
|
|
101
|
+
}
|
|
102
|
+
if (event.type === "activity.finished")
|
|
103
|
+
this.#activities.delete(event.payload.activityId);
|
|
104
|
+
if (hasOutput)
|
|
105
|
+
this.#reset();
|
|
106
|
+
this.#sync();
|
|
107
|
+
}
|
|
108
|
+
dispose() {
|
|
109
|
+
this.#disposed = true;
|
|
110
|
+
this.#reset();
|
|
111
|
+
this.#pending = undefined;
|
|
112
|
+
this.#since = undefined;
|
|
113
|
+
this.#wake = undefined;
|
|
114
|
+
this.#tools.clear();
|
|
115
|
+
this.#interactions.clear();
|
|
116
|
+
this.#activities.clear();
|
|
117
|
+
}
|
|
118
|
+
#finishTool(id) {
|
|
119
|
+
this.#tools.delete(id);
|
|
120
|
+
for (const [key, subject] of this.#activities)
|
|
121
|
+
if (subject.type === "tool" && subject.id === id)
|
|
122
|
+
this.#activities.delete(key);
|
|
123
|
+
}
|
|
124
|
+
#reset() {
|
|
125
|
+
this.#cancelTimer?.();
|
|
126
|
+
this.#cancelTimer = undefined;
|
|
127
|
+
// 重置未来静默区间,不撤回已达到阈值、尚未被 Core 取走的通知事实。
|
|
128
|
+
this.#reported = false;
|
|
129
|
+
this.#since = this.time.now();
|
|
130
|
+
}
|
|
131
|
+
#sync() {
|
|
132
|
+
if (this.#queued || this.#tools.size || this.#interactions.size || this.#activities.size) {
|
|
133
|
+
this.#reset();
|
|
134
|
+
this.#since = undefined;
|
|
135
|
+
}
|
|
136
|
+
else if (this.#since === undefined)
|
|
137
|
+
this.#reset();
|
|
138
|
+
this.#arm();
|
|
139
|
+
}
|
|
140
|
+
#arm() {
|
|
141
|
+
this.#cancelTimer?.();
|
|
142
|
+
this.#cancelTimer = undefined;
|
|
143
|
+
if (this.#disposed ||
|
|
144
|
+
!this.#wake ||
|
|
145
|
+
this.#since === undefined ||
|
|
146
|
+
this.#reported ||
|
|
147
|
+
this.#pending)
|
|
148
|
+
return;
|
|
149
|
+
const since = this.#since;
|
|
150
|
+
this.#cancelTimer = this.time.schedule(() => {
|
|
151
|
+
if (this.#disposed ||
|
|
152
|
+
this.#since !== since ||
|
|
153
|
+
!this.#wake ||
|
|
154
|
+
this.#reported ||
|
|
155
|
+
this.#pending)
|
|
156
|
+
return;
|
|
157
|
+
const silenceMs = Math.max(0, Math.floor(this.time.now() - since));
|
|
158
|
+
if (silenceMs < THRESHOLD_MS) {
|
|
159
|
+
this.#arm();
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this.#reported = true;
|
|
163
|
+
this.#pending = {
|
|
164
|
+
protocolVersion: 2,
|
|
165
|
+
type: "run.notice",
|
|
166
|
+
payload: {
|
|
167
|
+
noticeId: randomUUID(),
|
|
168
|
+
code: "model_output_idle",
|
|
169
|
+
severity: "info",
|
|
170
|
+
params: { silenceMs, message: `${Math.floor(silenceMs / 1000)}s no LLM output` }
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
this.#wake();
|
|
174
|
+
}, Math.max(1, THRESHOLD_MS - (this.time.now() - since)));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -8,7 +8,6 @@ export declare const DEFAULT_RUNTIME_LIMITS: {
|
|
|
8
8
|
toolTimeoutMs: number;
|
|
9
9
|
runTimeoutMs: number;
|
|
10
10
|
cancelGraceMs: number;
|
|
11
|
-
enforcement: "enforce";
|
|
12
11
|
};
|
|
13
12
|
export type EffectiveLimits = Required<Omit<RuntimeLimits, "toolWallTimeoutMs">> & Pick<RuntimeLimits, "toolWallTimeoutMs">;
|
|
14
13
|
export declare function normalizeRuntimeLimits(value: RuntimeLimits | undefined): EffectiveLimits;
|
|
@@ -31,8 +30,10 @@ export declare class InvocationWatchdog {
|
|
|
31
30
|
readonly controller: AbortController;
|
|
32
31
|
readonly diagnostic: (value: WatchdogDiagnostic) => void;
|
|
33
32
|
readonly time: WatchdogClock;
|
|
34
|
-
|
|
33
|
+
limits: EffectiveLimits;
|
|
35
34
|
constructor(limits: RuntimeLimits | undefined, controller: AbortController, diagnostic?: (value: WatchdogDiagnostic) => void, time?: WatchdogClock);
|
|
35
|
+
/** Adapter 开始执行前解释本轮预算,计时起点保持本次执行,不重置已有进度。 */
|
|
36
|
+
configure(limits: RuntimeLimits | undefined): void;
|
|
36
37
|
activity(activity: ProviderActivity): void;
|
|
37
38
|
canonical(event: CanonicalEvent): void;
|
|
38
39
|
/** Lifetime evidence is independent of provider payload conversion. */
|
|
@@ -7,8 +7,7 @@ export const DEFAULT_RUNTIME_LIMITS = {
|
|
|
7
7
|
modelIdlePolicy: "enforce",
|
|
8
8
|
toolTimeoutMs: 600_000,
|
|
9
9
|
runTimeoutMs: DEFAULT_RUN_TIMEOUT_MS,
|
|
10
|
-
cancelGraceMs: 1_000
|
|
11
|
-
enforcement: "enforce"
|
|
10
|
+
cancelGraceMs: 1_000
|
|
12
11
|
};
|
|
13
12
|
export function normalizeRuntimeLimits(value) {
|
|
14
13
|
return { ...DEFAULT_RUNTIME_LIMITS, ...value };
|
|
@@ -75,6 +74,11 @@ export class InvocationWatchdog {
|
|
|
75
74
|
});
|
|
76
75
|
this.#arm();
|
|
77
76
|
}
|
|
77
|
+
/** Adapter 开始执行前解释本轮预算,计时起点保持本次执行,不重置已有进度。 */
|
|
78
|
+
configure(limits) {
|
|
79
|
+
this.limits = normalizeRuntimeLimits(limits);
|
|
80
|
+
this.#arm();
|
|
81
|
+
}
|
|
78
82
|
activity(activity) {
|
|
79
83
|
if (!this.#active())
|
|
80
84
|
return;
|
|
@@ -317,8 +321,8 @@ export class InvocationWatchdog {
|
|
|
317
321
|
}
|
|
318
322
|
#arm() {
|
|
319
323
|
this.#cancelTimer?.();
|
|
320
|
-
if (!this.#active()
|
|
321
|
-
return;
|
|
324
|
+
if (!this.#active())
|
|
325
|
+
return;
|
|
322
326
|
const now = this.time.now();
|
|
323
327
|
const deadlines = [
|
|
324
328
|
{
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-executor-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
9
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
8
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.14",
|
|
9
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.14"
|
|
10
10
|
},
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"files": [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type HostedAdapter, type HostedAdapterMetadata, DEFAULT_RUNTIME_LIMITS
|
|
1
|
+
export { type HostedAdapter, type HostedAdapterMetadata, DEFAULT_RUNTIME_LIMITS } from "@mininglamp-oss/octo-runtime-executor-core";
|
|
2
2
|
export { HostRunService } from "./host-run-service.js";
|
|
3
3
|
export { createKernelService, type KernelService, type KernelServiceOptions, type KernelServiceStatus } from "./service.js";
|
|
4
4
|
export * from "./lifecycle.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Kernel 在宿主进程拥有 Core 与 Run 管理;所有业务调用统一经过本地 RPC。
|
|
2
|
-
export { DEFAULT_RUNTIME_LIMITS
|
|
2
|
+
export { DEFAULT_RUNTIME_LIMITS } from "@mininglamp-oss/octo-runtime-executor-core";
|
|
3
3
|
export { HostRunService } from "./host-run-service.js";
|
|
4
4
|
export { createKernelService } from "./service.js";
|
|
5
5
|
export * from "./lifecycle.js";
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { type RuntimeLoggingOptions, type AdapterProbeOptions } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
|
+
import { type ServiceProcessSnapshot } from "@mininglamp-oss/octo-runtime-protocol";
|
|
2
3
|
import { type HostedAdapter } from "@mininglamp-oss/octo-runtime-executor-core";
|
|
3
4
|
import { type KernelStatus } from "./types.js";
|
|
4
5
|
export interface KernelServerOptions {
|
|
5
6
|
endpoint: string;
|
|
6
7
|
/** 宿主已 import/构造的实例;保留对象身份,不跨进程序列化。 */
|
|
7
8
|
adapters: readonly HostedAdapter[];
|
|
9
|
+
/** 宿主拥有的服务只读快照;Kernel 不因此获得关闭或恢复权。 */
|
|
10
|
+
serviceProcesses?: () => readonly ServiceProcessSnapshot[];
|
|
11
|
+
/** 宿主显式收尾回调:Core 排空后、所有权证据释放前调用;失败须抛出。deadline 为 performance.now() 绝对毫秒。 */
|
|
12
|
+
finalizeHostResources?: (deadline: number) => Promise<void>;
|
|
8
13
|
adapterConfigurations?: Record<string, AdapterProbeOptions>;
|
|
9
14
|
stateDirectory?: string;
|
|
10
15
|
/** 记录 Kernel/Core 的生命周期;调用方选择日志目录。 */
|
|
@@ -5,7 +5,7 @@ import { chmod, rm } from "node:fs/promises";
|
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { assertIpcEndpoint, runtimePathFailure } from "./runtime-home.js";
|
|
7
7
|
import { readBoundedLines, RuntimeLogging } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
8
|
-
import { assertHostRunReceipt, createInputInvoke, contextItem, INVOKE_REQUEST_MAX_BYTES, HOST_RPC_MAX_LINE_BYTES, resolveStreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
|
|
8
|
+
import { assertHostRunReceipt, assertServiceProcessSnapshot, createInputInvoke, contextItem, INVOKE_REQUEST_MAX_BYTES, HOST_RPC_MAX_LINE_BYTES, KERNEL_IPC_VERSION, resolveStreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
|
|
9
9
|
import { HostRunService } from "./host-run-service.js";
|
|
10
10
|
import { AgentExecutor } from "@mininglamp-oss/octo-runtime-executor-core";
|
|
11
11
|
import { beforeDeadline } from "./lifecycle.js";
|
|
@@ -107,12 +107,21 @@ export async function startKernelServer(options, signal) {
|
|
|
107
107
|
let closing;
|
|
108
108
|
let listening = false;
|
|
109
109
|
let releaseEndpoint;
|
|
110
|
+
// 宿主快照只参与诊断;校验并复制,绝不把可变对象或控制句柄交给 IPC。
|
|
111
|
+
const serviceProcesses = () => {
|
|
112
|
+
const snapshots = [...executor.processes(), ...(options.serviceProcesses?.() ?? [])];
|
|
113
|
+
if (snapshots.length > 256)
|
|
114
|
+
throw new Error("SERVICE_PROCESS_SNAPSHOT_LIMIT");
|
|
115
|
+
for (const snapshot of snapshots)
|
|
116
|
+
assertServiceProcessSnapshot(snapshot);
|
|
117
|
+
return snapshots.map((snapshot) => ({ ...snapshot }));
|
|
118
|
+
};
|
|
110
119
|
const status = () => ({
|
|
111
|
-
ipc_version:
|
|
120
|
+
ipc_version: KERNEL_IPC_VERSION,
|
|
112
121
|
kernel_instance_id: instance,
|
|
113
122
|
pid: process.pid,
|
|
114
123
|
execution_ready: !closing && ready,
|
|
115
|
-
service_processes:
|
|
124
|
+
service_processes: serviceProcesses()
|
|
116
125
|
});
|
|
117
126
|
const snapshot = (key, expected) => {
|
|
118
127
|
if (expected !== undefined && expected !== instance)
|
|
@@ -186,23 +195,9 @@ export async function startKernelServer(options, signal) {
|
|
|
186
195
|
throw new KernelError("KERNEL_UNAVAILABLE", { invocation_not_submitted: true });
|
|
187
196
|
const input = params.input;
|
|
188
197
|
const config = configure(input);
|
|
189
|
-
//
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
...input,
|
|
193
|
-
agentEnv: {
|
|
194
|
-
...input.agentEnv,
|
|
195
|
-
agentConfig: {
|
|
196
|
-
...input.agentEnv.agentConfig,
|
|
197
|
-
providerOptions: {
|
|
198
|
-
...input.agentEnv.agentConfig?.providerOptions,
|
|
199
|
-
...config.providerOptions
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
: input;
|
|
205
|
-
const receipt = await runs.submit(configuredInput, {
|
|
198
|
+
// 连接选项走本地调用环境;调用方的 AgentEnv 保序透传。
|
|
199
|
+
const receipt = await runs.submit(input, {
|
|
200
|
+
providerOptions: config?.providerOptions,
|
|
206
201
|
streamLimits: config?.streamLimits,
|
|
207
202
|
executionEnvOverrides: params.executionEnvOverrides
|
|
208
203
|
});
|
|
@@ -374,6 +369,8 @@ export async function startKernelServer(options, signal) {
|
|
|
374
369
|
throw new Error("EXECUTOR_CLEANUP_INCOMPLETE");
|
|
375
370
|
});
|
|
376
371
|
await attempt(() => beforeDeadline(runs.close(), until - 1000));
|
|
372
|
+
await attempt(() => options.finalizeHostResources?.(performance.now() + Math.max(0, until - Date.now())) ??
|
|
373
|
+
Promise.resolve());
|
|
377
374
|
// 原生日志由同一 owner 持有:Core/finally 排空后才关闭,且仍只用原截止时间。
|
|
378
375
|
logging.kernel(errors.length ? "error" : "info", errors.length ? "kernel.cleanup_incomplete" : "kernel.execution_drained", errors.length ? { code: "KERNEL_CLEANUP_INCOMPLETE" } : { pid: process.pid });
|
|
379
376
|
await attempt(() => logging.close());
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-executor-kernel",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@mininglamp-oss/octo-runtime-client": "1.1.
|
|
14
|
-
"@mininglamp-oss/octo-runtime-executor-core": "1.1.
|
|
15
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
16
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
13
|
+
"@mininglamp-oss/octo-runtime-client": "1.1.14",
|
|
14
|
+
"@mininglamp-oss/octo-runtime-executor-core": "1.1.14",
|
|
15
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.14",
|
|
16
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.14"
|
|
17
17
|
},
|
|
18
18
|
"types": "./dist/index.d.ts",
|
|
19
19
|
"files": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-host-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
14
|
-
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.
|
|
15
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
13
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.14",
|
|
14
|
+
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.14",
|
|
15
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.14"
|
|
16
16
|
},
|
|
17
17
|
"types": "./dist/index.d.ts",
|
|
18
18
|
"files": [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AdapterProtocolSupport } from "./run-protocol.js";
|
|
2
2
|
import type { HostedAdapterMetadataWire } from "./generated/protocol-types.js";
|
|
3
3
|
/** 宿主注册及执行时使用的完整元数据;编写时的可选默认值须由 Adapter 工厂先补齐。 */
|
|
4
|
-
export type HostedAdapterMetadata = Pick<HostedAdapterMetadataWire, "workspace" | "type" | "
|
|
4
|
+
export type HostedAdapterMetadata = Pick<HostedAdapterMetadataWire, "workspace" | "type" | "processModel" | "transport" | "providerVersion" | "providerPath" | "available" | "unavailableReason"> & {
|
|
5
5
|
/** wire 可省略的编写输入不能放宽 Core 注册合同。 */
|
|
6
6
|
protocolSupport: AdapterProtocolSupport;
|
|
7
7
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export type * from "./generated/protocol-types.js";
|
|
2
2
|
export * from "./questions.js";
|
|
3
3
|
export * from "./context.js";
|
|
4
|
-
export * from "./model-context.js";
|
|
5
|
-
export * from "./execution-plan.js";
|
|
6
4
|
export * from "./context-configuration.js";
|
|
7
5
|
export * from "./context-catalog.js";
|
|
8
6
|
export * from "./image-input.js";
|
|
@@ -3,7 +3,6 @@ export interface ContextTypeDefinition {
|
|
|
3
3
|
readonly name: string;
|
|
4
4
|
readonly schemaRef: string;
|
|
5
5
|
readonly persistent: boolean;
|
|
6
|
-
readonly trustedOnly: boolean;
|
|
7
6
|
}
|
|
8
7
|
/** Built-in schema and execution-configuration classification; no processing stages. */
|
|
9
8
|
export declare const CONTEXT_TYPE_CATALOG: readonly ContextTypeDefinition[];
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
function entry(namespace, name, schema, persistent
|
|
1
|
+
function entry(namespace, name, schema, persistent) {
|
|
2
2
|
return Object.freeze({
|
|
3
3
|
namespace,
|
|
4
4
|
name,
|
|
5
5
|
schemaRef: `#/definitions/${schema}`,
|
|
6
|
-
persistent
|
|
7
|
-
trustedOnly
|
|
6
|
+
persistent
|
|
8
7
|
});
|
|
9
8
|
}
|
|
10
9
|
/** Built-in schema and execution-configuration classification; no processing stages. */
|
|
11
10
|
export const CONTEXT_TYPE_CATALOG = Object.freeze([
|
|
12
11
|
entry("octo.execution", "adapter", "ContextAdapterPayload", true),
|
|
13
12
|
entry("octo.execution", "model", "ContextModelPayload", true),
|
|
14
|
-
entry("octo.execution", "actmode", "ContextActmodePayload", true),
|
|
15
13
|
entry("octo.execution", "workspace", "ContextWorkspacePayload", true),
|
|
16
14
|
entry("octo.execution", "envs", "ContextEnvsPayload", true),
|
|
17
15
|
entry("octo.execution", "mcp", "ContextMcpPayload", true),
|
|
18
16
|
entry("octo.execution", "limits", "ContextLimitsPayload", true),
|
|
19
|
-
entry("octo.
|
|
20
|
-
entry("octo.security", "approval_policy", "ContextApprovalPolicyPayload", true),
|
|
21
|
-
entry("octo.content", "inline", "ContextInlinePayload", false),
|
|
22
|
-
entry("octo.content", "references", "ContextReferencesPayload", false),
|
|
23
|
-
entry("octo.control", "instructions", "ContextInstructionsPayload", true, true)
|
|
17
|
+
entry("octo.security", "approval_policy", "ContextApprovalPolicyPayload", true)
|
|
24
18
|
]);
|
|
25
19
|
export function contextTypeDefinition(namespace, name) {
|
|
26
20
|
const definition = findContextTypeDefinition(namespace, name);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { assertContextEnvelope, canonicalContext, mergeContext, mergeContextEnvs, assertContextEnvs, assertContextMcp, CONTEXT_SCHEMA } from "./context.js";
|
|
2
|
-
import { findContextTypeDefinition } from "./context-catalog.js";
|
|
3
2
|
const empty = () => ({ schema: CONTEXT_SCHEMA, items: [] });
|
|
4
3
|
const keyOf = (item) => `${item.namespace}/${item.name}`;
|
|
5
4
|
/** 校验可持久化配置;身份、资源权限和强制来源仍由 Worker 验证。 */
|
|
@@ -12,14 +11,8 @@ export function assertContextConfiguration(value) {
|
|
|
12
11
|
resolveContextConfiguration(value, empty());
|
|
13
12
|
}
|
|
14
13
|
function validateLayers(configuration) {
|
|
15
|
-
for (const
|
|
14
|
+
for (const envelope of [configuration.defaults, configuration.mandatory]) {
|
|
16
15
|
assertContextEnvelope(envelope);
|
|
17
|
-
for (const item of envelope.items) {
|
|
18
|
-
if (!findContextTypeDefinition(item.namespace, item.name)?.persistent)
|
|
19
|
-
throw new TypeError("CONTEXT_CONFIGURATION_TYPE_FORBIDDEN");
|
|
20
|
-
if (item.namespace === "octo.control" && layer === 0)
|
|
21
|
-
throw new TypeError("CONTEXT_CONFIGURATION_TYPE_FORBIDDEN");
|
|
22
|
-
}
|
|
23
16
|
}
|
|
24
17
|
}
|
|
25
18
|
/** Agent mandatory values are authoritative; request differences are overwritten. */
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { ApprovalMode, ContextEnvsPayload, ContextEnvelope, ContextItem, McpServers
|
|
1
|
+
import type { ApprovalMode, ContextEnvsPayload, ContextEnvelope, ContextItem, McpServers } from "./generated/protocol-types.js";
|
|
2
2
|
export declare const CONTEXT_SCHEMA: "octo.context-envelope/v3";
|
|
3
3
|
export declare const RUNTIME_RUN_CONTRACT: Readonly<{
|
|
4
4
|
readonly schema_version: 7;
|
|
5
|
-
readonly routing_schema: "octo.runtime-selection/v2";
|
|
6
5
|
readonly context_schema: "octo.context-envelope/v3";
|
|
7
6
|
readonly approval_schema: "octo.approval-request/v1";
|
|
8
7
|
}>;
|
|
@@ -11,19 +10,16 @@ export declare const CONTEXT_MAX_ITEMS = 32;
|
|
|
11
10
|
export declare const DEFAULT_RUN_TIMEOUT_MS = 86400000;
|
|
12
11
|
export declare const MAX_RUN_TIMEOUT_MS = 604800000;
|
|
13
12
|
export declare const APPROVAL_MODES: readonly ApprovalMode[];
|
|
14
|
-
export declare function assertAgentSource(value: unknown): asserts value is "preset" | "provisioned";
|
|
15
13
|
export declare function assertApprovalMode(value: unknown): asserts value is ApprovalMode;
|
|
16
14
|
export declare function assertContextEnvelope(value: unknown): asserts value is ContextEnvelope;
|
|
17
15
|
export declare function contextItem(context: ContextEnvelope, namespace: string, name: string): ContextItem | undefined;
|
|
18
16
|
export declare function canonicalContext(context: ContextEnvelope): string;
|
|
19
17
|
export declare function mergeContext(defaults: ContextEnvelope, overrides: ContextEnvelope): ContextEnvelope;
|
|
20
|
-
export declare function assertResolvedExecutionPlan(value: unknown): asserts value is ResolvedExecutionPlan;
|
|
21
18
|
export declare function assertContextMcp(value: unknown): asserts value is {
|
|
22
19
|
mcpServers: McpServers;
|
|
23
20
|
};
|
|
24
21
|
export declare function assertMcpServers(value: unknown, templates?: boolean): asserts value is McpServers;
|
|
25
22
|
export declare function assertJsonValue(value: unknown): void;
|
|
26
|
-
export declare function mergeReferences(base: Record<string, unknown>[], next: Record<string, unknown>[]): Record<string, unknown>[];
|
|
27
23
|
/** Environment names are values in a list, never dynamic protocol object keys. */
|
|
28
24
|
export declare function assertContextEnvs(value: unknown): asserts value is ContextEnvsPayload;
|
|
29
25
|
export declare function mergeContextEnvs(base: unknown, overrides: unknown): ContextEnvsPayload;
|