@mininglamp-oss/octo-runtime 1.1.8 → 1.1.10
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/README.md +3 -1
- package/{node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runtime-configuration.d.ts → apps/cli/dist/adapter-configuration.d.ts} +1 -0
- package/{node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runtime-configuration.js → apps/cli/dist/adapter-configuration.js} +1 -0
- package/apps/cli/dist/adapter-configurations.d.ts +1 -1
- package/apps/cli/dist/adapter-configurations.js +1 -1
- package/apps/cli/dist/adapters.d.ts +7 -0
- package/apps/cli/dist/adapters.js +51 -0
- package/apps/cli/dist/build-info.json +2 -2
- package/apps/cli/dist/command-tree.js +3 -1
- package/apps/cli/dist/help.js +1 -1
- package/apps/cli/dist/index.js +4 -0
- package/apps/cli/dist/main.d.ts +2 -0
- package/apps/cli/dist/main.js +10 -12
- package/apps/cli/dist/manifest.json +0 -5
- package/apps/cli/dist/output.js +7 -9
- package/apps/cli/dist/playboard-interrupt.d.ts +6 -0
- package/apps/cli/dist/playboard-interrupt.js +86 -0
- package/apps/cli/dist/playboard.d.ts +2 -0
- package/apps/cli/dist/playboard.js +20 -12
- package/dist/public/executor-kernel.d.ts +2 -3
- package/dist/public/executor-kernel.js +1 -2
- package/dist/public/protocol.d.ts +1 -1
- package/dist/public/protocol.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +200 -106
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/async-questions.d.ts +27 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/async-questions.js +205 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/stdin-writer.d.ts +30 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/stdin-writer.js +223 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-V5W6ZTYC.js → chunk-FGFEM7JP.js} +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-CFKMMCO6.js → chunk-R3PDZLX5.js} +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-LO34KB7D.js → chunk-TSRZVLIG.js} +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-NOTICE.txt +2 -2
- 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.js +5 -5
- 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/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/gateway.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/gateway.js +57 -13
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.d.ts +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +4 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/approval.js +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/reasoning.js +1 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.js +12 -30
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configuration.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configuration.js +125 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configurations.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configurations.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.d.ts +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.js +51 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.js +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/index.js +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +10 -12
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +0 -5
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +7 -9
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard-interrupt.d.ts +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard-interrupt.js +86 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +20 -12
- package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +23 -24
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/launchd.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/launchd.js +12 -11
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/experience.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +8 -7
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +33 -11
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +9 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +6 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.d.ts +30 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.js +199 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/client.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/client.js +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/execution-source.d.ts +17 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/execution-source.js +21 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/host-run-service.d.ts +9 -9
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/host-run-service.js +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +2 -6
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +3 -6
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.d.ts +14 -13
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.js +84 -187
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.d.ts +5 -8
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +77 -53
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.d.ts +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.js +15 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -12
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +6 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.js +14 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/interaction-card.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/session-command.d.ts +9 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/session-command.js +71 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +6 -6
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.js +14 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/{index-B127MhT-.js → index-BLMf2Etg.js} +2 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/index.html +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/context-loader.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +4 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +63 -12
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +110 -20
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +7 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +28 -6
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/questions.d.ts +9 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/questions.js +84 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.js +11 -5
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
- package/package.json +26 -28
- package/packages/octo-runtime-protocol/schema/protocol.schema.json +157 -41
- package/apps/cli/dist/worker.d.ts +0 -1
- package/apps/cli/dist/worker.js +0 -18
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/app-server.d.ts +0 -63
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/app-server.js +0 -846
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/index.d.ts +0 -54
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/index.js +0 -154
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +0 -15
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/worker.d.ts +0 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/worker.js +0 -18
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/heartbeat.d.ts +0 -16
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/heartbeat.js +0 -59
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/manifest-adapters.d.ts +0 -6
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/manifest-adapters.js +0 -88
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/module-specifier.d.ts +0 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/module-specifier.js +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/process.d.ts +0 -42
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/process.js +0 -292
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/rpc.d.ts +0 -62
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/rpc.js +0 -661
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runner.d.ts +0 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runner.js +0 -5
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/serve.d.ts +0 -10
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/serve.js +0 -96
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/supervisor.d.ts +0 -15
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/supervisor.js +0 -279
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
2
|
import { localRuntimeLimits, resolveLocalContext } from "./context.js";
|
|
3
|
-
import { CONTEXT_SCHEMA, assertAgentSource, assertContextEnvelope, assertInvokeRequest, contextControlInstructions, contextItem, InvokeInput } from "@mininglamp-oss/octo-runtime-protocol";
|
|
3
|
+
import { CONTEXT_SCHEMA, DEFAULT_RUN_TIMEOUT_MS, assertAgentSource, assertContextEnvelope, assertInvokeRequest, contextControlInstructions, contextItem, InvokeInput } from "@mininglamp-oss/octo-runtime-protocol";
|
|
4
4
|
/** CLI shorthand resolves execution defaults before entering the strict Context contract. */
|
|
5
5
|
function inputContext(value) {
|
|
6
6
|
if (isRecord(value) && Array.isArray(value.items)) {
|
|
@@ -58,6 +58,9 @@ export function prepareInvokeInput(value) {
|
|
|
58
58
|
typeof value.providerSession.resumable !== "boolean") {
|
|
59
59
|
throw new TypeError("providerSession.resumable must be a boolean");
|
|
60
60
|
}
|
|
61
|
+
if (value.providerSession.requireResume !== undefined &&
|
|
62
|
+
typeof value.providerSession.requireResume !== "boolean")
|
|
63
|
+
throw new TypeError("providerSession.requireResume must be a boolean");
|
|
61
64
|
providerSession = structuredClone(value.providerSession);
|
|
62
65
|
}
|
|
63
66
|
if (continuityMode === "fresh" && providerSession)
|
|
@@ -82,7 +85,11 @@ export function prepareInvokeInput(value) {
|
|
|
82
85
|
name: "approval_policy",
|
|
83
86
|
payload: { mode: input.approvalMode ?? "ask" }
|
|
84
87
|
},
|
|
85
|
-
{
|
|
88
|
+
{
|
|
89
|
+
namespace: "octo.execution",
|
|
90
|
+
name: "limits",
|
|
91
|
+
payload: { run_timeout_ms: DEFAULT_RUN_TIMEOUT_MS }
|
|
92
|
+
}
|
|
86
93
|
]
|
|
87
94
|
};
|
|
88
95
|
// Resolve only execution settings here. Business items and control instructions
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isTerminal } from "@mininglamp-oss/octo-runtime-protocol";
|
|
1
|
+
import { isTerminal, DEFAULT_RUN_TIMEOUT_MS } from "@mininglamp-oss/octo-runtime-protocol";
|
|
2
2
|
import { performance } from "node:perf_hooks";
|
|
3
3
|
export const DEFAULT_RUNTIME_LIMITS = {
|
|
4
4
|
firstFrameTimeoutMs: 60_000,
|
|
@@ -6,7 +6,7 @@ export const DEFAULT_RUNTIME_LIMITS = {
|
|
|
6
6
|
modelIdleWarningMs: 120_000,
|
|
7
7
|
modelIdlePolicy: "enforce",
|
|
8
8
|
toolTimeoutMs: 600_000,
|
|
9
|
-
runTimeoutMs:
|
|
9
|
+
runTimeoutMs: DEFAULT_RUN_TIMEOUT_MS,
|
|
10
10
|
cancelGraceMs: 1_000,
|
|
11
11
|
enforcement: "enforce"
|
|
12
12
|
};
|
|
@@ -162,7 +162,10 @@ export class InvocationWatchdog {
|
|
|
162
162
|
toolChanged = this.#tools.delete(id);
|
|
163
163
|
this.#finishSubjectActivities("tool", id);
|
|
164
164
|
}
|
|
165
|
-
|
|
165
|
+
// 非阻塞问题不授予等待豁免;原模型/工具仍按真实进度计时。
|
|
166
|
+
if (event.type === "interaction.requested" &&
|
|
167
|
+
event.payload.delivery !== "async" &&
|
|
168
|
+
typeof event.payload.interactionId === "string") {
|
|
166
169
|
this.#interaction(event.payload.interactionId, true);
|
|
167
170
|
}
|
|
168
171
|
if (event.type === "interaction.resolved" && typeof event.payload.interactionId === "string") {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-executor-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
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.10",
|
|
9
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.10"
|
|
10
10
|
},
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"files": [
|
package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type AsyncQuestionReplySnapshot, type CanonicalEvent, type HostFrame, type InvokeEnvironment, type InvokeInput } from "@mininglamp-oss/octo-runtime-protocol";
|
|
2
|
+
import { type KernelClient } from "./types.js";
|
|
3
|
+
export type AsyncQuestionReplyResult = {
|
|
4
|
+
route: "steer";
|
|
5
|
+
acceptance: "provider_accepted";
|
|
6
|
+
} | {
|
|
7
|
+
route: "new_run";
|
|
8
|
+
input: InvokeInput;
|
|
9
|
+
events: AsyncGenerator<CanonicalEvent>;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* 宿主持有的一份旁路问题控制者,不拥有 Kernel 或数据库。
|
|
13
|
+
* 活动时 steer,确认正常完成后复用 invoke;宿主须串行管理同会话、
|
|
14
|
+
* 保存提交状态并消费新 Run 尾流。新流返回不代表 Provider 接纳。
|
|
15
|
+
*/
|
|
16
|
+
export declare class AsyncQuestionReply {
|
|
17
|
+
#private;
|
|
18
|
+
readonly client: KernelClient;
|
|
19
|
+
readonly continuation: () => InvokeInput;
|
|
20
|
+
readonly environment?: InvokeEnvironment | undefined;
|
|
21
|
+
constructor(client: KernelClient, snapshot: AsyncQuestionReplySnapshot, continuation: () => InvokeInput, environment?: InvokeEnvironment | undefined);
|
|
22
|
+
/** 独立 JSON 副本供宿主保存;恢复 submitting/unknown 不会再次投递。 */
|
|
23
|
+
snapshot(): AsyncQuestionReplySnapshot;
|
|
24
|
+
/** 只接受原源流事实;消息 final 或查不到 Run 不能证明正常完成。 */
|
|
25
|
+
observe(frame: HostFrame): void;
|
|
26
|
+
/** 关闭旁路,不中断模型;原活动交互同步关闭,未知响应不重试。 */
|
|
27
|
+
cancel(): Promise<void>;
|
|
28
|
+
/** 整批一次。steer 等待 Provider ACK;new_run 必须消费返回流,沿原 invoke 管理执行。 */
|
|
29
|
+
respond(value: unknown): Promise<AsyncQuestionReplyResult>;
|
|
30
|
+
}
|
package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.js
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { assertCanonicalEvent, assertHostFrame, assertHostFrameIdentity, assertHostRunReceipt, assertInvokeInput, assertJsonValue, assertQuestionRequest, assertQuestionResponse, questionAnswerText } from "@mininglamp-oss/octo-runtime-protocol";
|
|
3
|
+
import { KernelError } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* 宿主持有的一份旁路问题控制者,不拥有 Kernel 或数据库。
|
|
6
|
+
* 活动时 steer,确认正常完成后复用 invoke;宿主须串行管理同会话、
|
|
7
|
+
* 保存提交状态并消费新 Run 尾流。新流返回不代表 Provider 接纳。
|
|
8
|
+
*/
|
|
9
|
+
export class AsyncQuestionReply {
|
|
10
|
+
client;
|
|
11
|
+
continuation;
|
|
12
|
+
environment;
|
|
13
|
+
#snapshot;
|
|
14
|
+
constructor(client, snapshot, continuation, environment) {
|
|
15
|
+
this.client = client;
|
|
16
|
+
this.continuation = continuation;
|
|
17
|
+
this.environment = environment;
|
|
18
|
+
assertJsonValue(snapshot);
|
|
19
|
+
if (snapshot.schema !== "octo.async-question-reply/v1" ||
|
|
20
|
+
!["pending", "submitting", "answered", "cancelled", "invalidated", "unknown"].includes(snapshot.phase) ||
|
|
21
|
+
typeof snapshot.completed !== "boolean" ||
|
|
22
|
+
snapshot.ref.protocol_mode !== "canonical" ||
|
|
23
|
+
snapshot.ref.protocol !== "codex.app-server" ||
|
|
24
|
+
snapshot.question.delivery !== "async" ||
|
|
25
|
+
snapshot.question.kind !== "question" ||
|
|
26
|
+
snapshot.question.executionInstanceId !== snapshot.ref.invocation_id ||
|
|
27
|
+
!snapshot.providerSession.sessionId ||
|
|
28
|
+
snapshot.providerSession.resumable === false)
|
|
29
|
+
throw new KernelError("INVALID_ASYNC_QUESTION_SNAPSHOT");
|
|
30
|
+
const { kernel_instance_id, ...receipt } = snapshot.ref;
|
|
31
|
+
if (!kernel_instance_id)
|
|
32
|
+
throw new KernelError("INVALID_ASYNC_QUESTION_SNAPSHOT");
|
|
33
|
+
assertHostRunReceipt(receipt);
|
|
34
|
+
assertCanonicalEvent({
|
|
35
|
+
protocolVersion: 2,
|
|
36
|
+
type: "interaction.requested",
|
|
37
|
+
payload: snapshot.question
|
|
38
|
+
});
|
|
39
|
+
assertQuestionRequest(snapshot.question.request);
|
|
40
|
+
this.#snapshot = structuredClone(snapshot);
|
|
41
|
+
}
|
|
42
|
+
/** 独立 JSON 副本供宿主保存;恢复 submitting/unknown 不会再次投递。 */
|
|
43
|
+
snapshot() {
|
|
44
|
+
return structuredClone(this.#snapshot);
|
|
45
|
+
}
|
|
46
|
+
/** 只接受原源流事实;消息 final 或查不到 Run 不能证明正常完成。 */
|
|
47
|
+
observe(frame) {
|
|
48
|
+
assertHostFrame(frame);
|
|
49
|
+
const { kernel_instance_id: _instance, ...receipt } = this.#snapshot.ref;
|
|
50
|
+
void _instance;
|
|
51
|
+
assertHostFrameIdentity(frame, receipt);
|
|
52
|
+
if (frame.kind === "control" && frame.control.type === "state") {
|
|
53
|
+
if (frame.control.state === "completed")
|
|
54
|
+
this.#snapshot.completed = true;
|
|
55
|
+
else if (["failed", "cancelled", "lost"].includes(frame.control.state))
|
|
56
|
+
this.#snapshot.phase = "invalidated";
|
|
57
|
+
}
|
|
58
|
+
if (frame.kind === "canonical" &&
|
|
59
|
+
frame.event.type === "interaction.resolved" &&
|
|
60
|
+
frame.event.payload.interactionId === this.#snapshot.question.interactionId) {
|
|
61
|
+
const payload = frame.event.payload;
|
|
62
|
+
this.#snapshot.phase =
|
|
63
|
+
payload.reasonCode === "provider_accepted"
|
|
64
|
+
? "answered"
|
|
65
|
+
: payload.reasonCode === "submission_outcome_unknown"
|
|
66
|
+
? "unknown"
|
|
67
|
+
: "invalidated";
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** 关闭旁路,不中断模型;原活动交互同步关闭,未知响应不重试。 */
|
|
71
|
+
async cancel() {
|
|
72
|
+
this.#assertPending();
|
|
73
|
+
this.#snapshot.phase = "cancelled";
|
|
74
|
+
if (!this.#snapshot.completed) {
|
|
75
|
+
try {
|
|
76
|
+
await this.client.respond(this.#snapshot.ref, {
|
|
77
|
+
interactionId: this.#snapshot.question.interactionId,
|
|
78
|
+
outcome: "cancelled"
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
if (!(error instanceof KernelError) || error.code !== "INTERACTION_NOT_ACTIVE")
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** 整批一次。steer 等待 Provider ACK;new_run 必须消费返回流,沿原 invoke 管理执行。 */
|
|
88
|
+
async respond(value) {
|
|
89
|
+
this.#assertPending();
|
|
90
|
+
const original = this.#snapshot;
|
|
91
|
+
assertQuestionRequest(original.question.request);
|
|
92
|
+
const answer = structuredClone(value);
|
|
93
|
+
assertQuestionResponse(answer);
|
|
94
|
+
const text = questionAnswerText(original.question.request, answer);
|
|
95
|
+
const next = structuredClone(this.continuation());
|
|
96
|
+
assertInvokeInput(next);
|
|
97
|
+
// 现有会话由宿主显式提供,旧题不能跨 reset 或 Provider binding 改投。
|
|
98
|
+
if (next.sessionId !== original.ref.agent_session_id ||
|
|
99
|
+
(next.sessionGeneration ?? 0) !== original.ref.session_generation ||
|
|
100
|
+
next.providerSession?.sessionId !== original.providerSession.sessionId ||
|
|
101
|
+
next.providerSession?.resumable === false ||
|
|
102
|
+
next.providerEpoch !== original.providerEpoch)
|
|
103
|
+
throw new KernelError("ASYNC_QUESTION_SESSION_STALE");
|
|
104
|
+
original.phase = "submitting";
|
|
105
|
+
let attempted = false;
|
|
106
|
+
try {
|
|
107
|
+
if (!original.completed) {
|
|
108
|
+
const current = await this.client.get(original.ref, original.ref.kernel_instance_id);
|
|
109
|
+
if (current.terminal)
|
|
110
|
+
this.observe(current.terminal);
|
|
111
|
+
if (this.snapshot().phase === "invalidated")
|
|
112
|
+
throw new KernelError("INTERACTION_NOT_ACTIVE");
|
|
113
|
+
}
|
|
114
|
+
if (!original.completed) {
|
|
115
|
+
attempted = true;
|
|
116
|
+
try {
|
|
117
|
+
this.#assertNotExpired();
|
|
118
|
+
await this.client.respond(original.ref, {
|
|
119
|
+
interactionId: original.question.interactionId,
|
|
120
|
+
outcome: "answered",
|
|
121
|
+
value: answer
|
|
122
|
+
});
|
|
123
|
+
original.phase = "answered";
|
|
124
|
+
return { route: "steer", acceptance: "provider_accepted" };
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
if (!(error instanceof KernelError) ||
|
|
128
|
+
!["INTERACTION_NOT_ACTIVE", "ASYNC_ANSWER_REJECTED"].includes(error.code))
|
|
129
|
+
throw error;
|
|
130
|
+
// 仅明确未接纳才可在正常终态之后续跑;ACK 丢失和写后失联绝不进入此分支。
|
|
131
|
+
attempted = false;
|
|
132
|
+
const current = await this.client.get(original.ref, original.ref.kernel_instance_id);
|
|
133
|
+
if (current.terminal)
|
|
134
|
+
this.observe(current.terminal);
|
|
135
|
+
if (!original.completed) {
|
|
136
|
+
original.phase = "invalidated";
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const input = {
|
|
142
|
+
...next,
|
|
143
|
+
runId: randomUUID(),
|
|
144
|
+
invocationId: randomUUID(),
|
|
145
|
+
protocol_mode: "canonical",
|
|
146
|
+
continuityMode: "continue",
|
|
147
|
+
inputs: [{ type: "text", text }],
|
|
148
|
+
prompt: text,
|
|
149
|
+
modelInput: text,
|
|
150
|
+
providerSession: { ...original.providerSession, requireResume: true },
|
|
151
|
+
freshFallbackModelInput: text,
|
|
152
|
+
freshFallbackModelInputParts: [{ type: "text", text }]
|
|
153
|
+
};
|
|
154
|
+
const client = this.client, environment = this.environment;
|
|
155
|
+
const beforeInvoke = () => {
|
|
156
|
+
this.#assertNotExpired();
|
|
157
|
+
const currentInput = this.continuation();
|
|
158
|
+
if (currentInput.sessionId !== input.sessionId ||
|
|
159
|
+
(currentInput.sessionGeneration ?? 0) !== original.ref.session_generation ||
|
|
160
|
+
currentInput.providerSession?.sessionId !== original.providerSession.sessionId ||
|
|
161
|
+
currentInput.providerEpoch !== original.providerEpoch)
|
|
162
|
+
throw new KernelError("ASYNC_QUESTION_SESSION_STALE");
|
|
163
|
+
};
|
|
164
|
+
const events = (async function* () {
|
|
165
|
+
try {
|
|
166
|
+
beforeInvoke();
|
|
167
|
+
for await (const event of client.invoke(input, environment)) {
|
|
168
|
+
if (event.type === "session.update" &&
|
|
169
|
+
event.payload.providerSession?.sessionId === original.providerSession.sessionId &&
|
|
170
|
+
event.payload.providerSession.resumeOutcome === "resumed")
|
|
171
|
+
original.phase = "answered";
|
|
172
|
+
yield event;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
finally {
|
|
176
|
+
if (original.phase === "submitting")
|
|
177
|
+
original.phase = "unknown";
|
|
178
|
+
}
|
|
179
|
+
})();
|
|
180
|
+
return { route: "new_run", input: structuredClone(input), events };
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
if (original.phase === "submitting")
|
|
184
|
+
original.phase = attempted ? "unknown" : "pending";
|
|
185
|
+
throw error;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
#assertPending() {
|
|
189
|
+
const snapshot = this.#snapshot;
|
|
190
|
+
if (snapshot.phase !== "pending")
|
|
191
|
+
throw new KernelError("INTERACTION_NOT_ACTIVE");
|
|
192
|
+
this.#assertNotExpired();
|
|
193
|
+
}
|
|
194
|
+
#assertNotExpired() {
|
|
195
|
+
const expiresAt = this.#snapshot.question.expiresAt;
|
|
196
|
+
if (expiresAt !== undefined && Date.parse(expiresAt) <= Date.now())
|
|
197
|
+
throw new KernelError("INTERACTION_NOT_ACTIVE");
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type KernelClient } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* 连接本机 socket/Windows Pipe,返回不拥有 Kernel 进程的客户端。
|
|
4
|
+
* 宿主接入层只在 CLI 模式跨进程连接已有服务时显式调用;原生 SDK 使用 kernel.client。
|
|
5
|
+
* Kernel/Extra 服务内部也复用本函数构造 RPC 客户端,不要求 SDK 调用方额外 attach。
|
|
4
6
|
* invoke 提供登记、取消和尾流观察;关闭连接或迭代器不会隐式取消已接纳 Run。
|
|
5
7
|
*/
|
|
6
8
|
export declare function attachKernel(options: {
|
|
@@ -6,6 +6,8 @@ import { InvocationRegistry } from "./invocation-lifecycle.js";
|
|
|
6
6
|
import { markSubmissionRejected } from "./submission-error.js";
|
|
7
7
|
/**
|
|
8
8
|
* 连接本机 socket/Windows Pipe,返回不拥有 Kernel 进程的客户端。
|
|
9
|
+
* 宿主接入层只在 CLI 模式跨进程连接已有服务时显式调用;原生 SDK 使用 kernel.client。
|
|
10
|
+
* Kernel/Extra 服务内部也复用本函数构造 RPC 客户端,不要求 SDK 调用方额外 attach。
|
|
9
11
|
* invoke 提供登记、取消和尾流观察;关闭连接或迭代器不会隐式取消已接纳 Run。
|
|
10
12
|
*/
|
|
11
13
|
export function attachKernel(options) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AdapterProbeOptions } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
|
+
import type { HostedAdapterMetadata } from "@mininglamp-oss/octo-runtime-executor-core";
|
|
3
|
+
import { type InputInvoke, type InputFrames, type InteractionResponse, type NativeInteractionResponse } from "@mininglamp-oss/octo-runtime-protocol";
|
|
4
|
+
/** Kernel 内部的原生执行源;不是另一条传输协议,公共调用始终经过 KernelClient RPC。 */
|
|
5
|
+
export interface ExecutionSource {
|
|
6
|
+
list(configurations?: Record<string, AdapterProbeOptions>): Promise<HostedAdapterMetadata[]>;
|
|
7
|
+
probe(adapterType: string, options?: AdapterProbeOptions): Promise<unknown>;
|
|
8
|
+
cancel(invocationId: string, reason?: string): Promise<{
|
|
9
|
+
cancelled: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
respondInteraction(invocationId: string, response: InteractionResponse): Promise<void>;
|
|
12
|
+
respondNative(invocationId: string, response: NativeInteractionResponse): Promise<void>;
|
|
13
|
+
invoke: InputInvoke;
|
|
14
|
+
invokeFrames: InputFrames;
|
|
15
|
+
}
|
|
16
|
+
/** 校验宿主提供的配置值,不读取文件或修改原对象。 */
|
|
17
|
+
export declare function probeOptions(value: unknown): AdapterProbeOptions | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { resolveStreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
|
|
2
|
+
/** 校验宿主提供的配置值,不读取文件或修改原对象。 */
|
|
3
|
+
export function probeOptions(value) {
|
|
4
|
+
if (value === undefined)
|
|
5
|
+
return undefined;
|
|
6
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
7
|
+
throw new TypeError("invalid probe options");
|
|
8
|
+
const options = value;
|
|
9
|
+
if (options.providerOptions !== undefined &&
|
|
10
|
+
(!options.providerOptions ||
|
|
11
|
+
typeof options.providerOptions !== "object" ||
|
|
12
|
+
Array.isArray(options.providerOptions) ||
|
|
13
|
+
Object.values(options.providerOptions).some((v) => typeof v !== "string")))
|
|
14
|
+
throw new TypeError("invalid probe provider options");
|
|
15
|
+
return {
|
|
16
|
+
...options,
|
|
17
|
+
...(options.streamLimits === undefined
|
|
18
|
+
? {}
|
|
19
|
+
: { streamLimits: resolveStreamLimitPolicy(options.streamLimits) })
|
|
20
|
+
};
|
|
21
|
+
}
|
package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/host-run-service.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ExecutionSource } from "./execution-source.js";
|
|
2
2
|
import { type HostFrame, type HostRunReceipt, type InvokeInput, type InvokeEnvironment, type NativeInteractionResponse, type InteractionResponse } from "@mininglamp-oss/octo-runtime-protocol";
|
|
3
3
|
export interface SourceEvent {
|
|
4
4
|
seq: number;
|
|
@@ -7,23 +7,23 @@ export interface SourceEvent {
|
|
|
7
7
|
at: number;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* Kernel 内唯一的 Run
|
|
10
|
+
* Kernel 内唯一的 Run 事件源:从同进程 Core 消费一次,按原 stream/seq 有界缓存供多个订阅观察。
|
|
11
11
|
* 接纳、执行与观察分离;订阅退出不取消源执行,缓存过期只报告缺口,不重跑 Provider。
|
|
12
12
|
*/
|
|
13
|
-
export declare class HostRunService implements
|
|
13
|
+
export declare class HostRunService implements ExecutionSource {
|
|
14
14
|
#private;
|
|
15
|
-
readonly transport:
|
|
15
|
+
readonly transport: ExecutionSource;
|
|
16
16
|
private readonly resolveStreamLimits?;
|
|
17
17
|
readonly invoke: import("@mininglamp-oss/octo-runtime-protocol").InputInvoke;
|
|
18
|
-
constructor(transport:
|
|
18
|
+
constructor(transport: ExecutionSource, resolveStreamLimits?: ((input: InvokeInput) => InvokeEnvironment["streamLimits"]) | undefined);
|
|
19
19
|
get status(): {
|
|
20
20
|
draining: boolean;
|
|
21
21
|
activeRuns: number;
|
|
22
22
|
admittingRuns: number;
|
|
23
23
|
};
|
|
24
|
-
list(...args: Parameters<
|
|
25
|
-
probe(...args: Parameters<
|
|
26
|
-
cancel(invocationId: string, reason?: string): ReturnType<
|
|
24
|
+
list(...args: Parameters<ExecutionSource["list"]>): ReturnType<ExecutionSource["list"]>;
|
|
25
|
+
probe(...args: Parameters<ExecutionSource["probe"]>): Promise<unknown>;
|
|
26
|
+
cancel(invocationId: string, reason?: string): ReturnType<ExecutionSource["cancel"]>;
|
|
27
27
|
respondInteraction(invocationId: string, response: InteractionResponse): Promise<void>;
|
|
28
28
|
respondNative(invocationId: string, response: NativeInteractionResponse): Promise<void>;
|
|
29
29
|
invokeFrames(input: InvokeInput, environment?: InvokeEnvironment): AsyncGenerator<HostFrame>;
|
|
@@ -38,7 +38,7 @@ export declare class HostRunService implements WorkerRpc {
|
|
|
38
38
|
read(runId: string, streamId: string | undefined, after: number): ReturnType<HostRunService["get"]> & {
|
|
39
39
|
events: SourceEvent[];
|
|
40
40
|
};
|
|
41
|
-
cancelRun(runId: string, reason?: string): ReturnType<
|
|
41
|
+
cancelRun(runId: string, reason?: string): ReturnType<ExecutionSource["cancel"]>;
|
|
42
42
|
respond(runId: string, response: InteractionResponse): Promise<void>;
|
|
43
43
|
respondNativeRun(runId: string, response: NativeInteractionResponse): Promise<void>;
|
|
44
44
|
acquireSubscription(): () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createInputInvoke, assertInvokeRequestSize, identifyInvokeInput, assertHostFrameIdentity, isHostTerminal, isStreamCapacityReason, resolveStreamLimitPolicy, streamCapacityError } from "@mininglamp-oss/octo-runtime-protocol";
|
|
1
|
+
import { createInputInvoke, assertInvokeRequestSize, identifyInvokeInput, assertHostFrameIdentity, isHostTerminal, isStreamCapacityReason, resolveStreamLimitPolicy, streamCapacityError, protocolError } from "@mininglamp-oss/octo-runtime-protocol";
|
|
2
2
|
const TTL = 120_000;
|
|
3
3
|
/**
|
|
4
|
-
* Kernel 内唯一的 Run
|
|
4
|
+
* Kernel 内唯一的 Run 事件源:从同进程 Core 消费一次,按原 stream/seq 有界缓存供多个订阅观察。
|
|
5
5
|
* 接纳、执行与观察分离;订阅退出不取消源执行,缓存过期只报告缺口,不重跑 Provider。
|
|
6
6
|
*/
|
|
7
7
|
export class HostRunService {
|
|
@@ -261,7 +261,7 @@ export class HostRunService {
|
|
|
261
261
|
respond(runId, response) {
|
|
262
262
|
const run = this.#get(runId);
|
|
263
263
|
if (run.terminal)
|
|
264
|
-
throw
|
|
264
|
+
throw protocolError("INTERACTION_NOT_ACTIVE", "INTERACTION_EXPIRED");
|
|
265
265
|
return this.respondInteraction(run.invocationId, response);
|
|
266
266
|
}
|
|
267
267
|
respondNativeRun(runId, response) {
|
|
@@ -3,12 +3,8 @@ 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";
|
|
5
5
|
export { attachKernel } from "./client.js";
|
|
6
|
+
export { AsyncQuestionReply, type AsyncQuestionReplyResult } from "./async-question-reply.js";
|
|
6
7
|
export { isInvocationNotSubmitted } from "./submission-error.js";
|
|
7
8
|
export * from "./types.js";
|
|
8
|
-
export { InvocationManifest, acknowledgeOrphanCleanup, inspectOrphanCleanup,
|
|
9
|
-
export { readAdapterConfigurations } from "./runtime-configuration.js";
|
|
10
|
-
export { spawnWorker } from "./process.js";
|
|
11
|
-
export { serveWorker } from "./serve.js";
|
|
12
|
-
export type { WorkerProcess, SpawnWorkerOptions } from "./process.js";
|
|
13
|
-
export { WorkerRpcClient, WorkerRpcServer, type WorkerRpc, type RpcTrace, type RpcTraceDirection } from "./rpc.js";
|
|
9
|
+
export { InvocationManifest, acknowledgeOrphanCleanup, inspectOrphanCleanup, reapOrphanedInvocationManifest } from "./invocation-manifest.js";
|
|
14
10
|
export { acquireEndpoint } from "./endpoint.js";
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
// Kernel
|
|
1
|
+
// Kernel 在宿主进程拥有 Core 与 Run 管理;所有业务调用统一经过本地 RPC。
|
|
2
2
|
export { DEFAULT_RUNTIME_LIMITS, prepareRunContext } 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";
|
|
6
6
|
export { attachKernel } from "./client.js";
|
|
7
|
+
export { AsyncQuestionReply } from "./async-question-reply.js";
|
|
7
8
|
export { isInvocationNotSubmitted } from "./submission-error.js";
|
|
8
9
|
export * from "./types.js";
|
|
9
|
-
export { InvocationManifest, acknowledgeOrphanCleanup, inspectOrphanCleanup,
|
|
10
|
-
export { readAdapterConfigurations } from "./runtime-configuration.js";
|
|
11
|
-
export { spawnWorker } from "./process.js";
|
|
12
|
-
export { serveWorker } from "./serve.js";
|
|
13
|
-
export { WorkerRpcClient, WorkerRpcServer } from "./rpc.js";
|
|
10
|
+
export { InvocationManifest, acknowledgeOrphanCleanup, inspectOrphanCleanup, reapOrphanedInvocationManifest } from "./invocation-manifest.js";
|
|
14
11
|
export { acquireEndpoint } from "./endpoint.js";
|
package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.d.ts
CHANGED
|
@@ -6,13 +6,14 @@ export interface InvocationManifestEntry {
|
|
|
6
6
|
}
|
|
7
7
|
export interface OrphanReapResult {
|
|
8
8
|
found: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
reason?: "kernel_alive" | "
|
|
9
|
+
/** 原生恢复不终止任何进程;人工确认也不表示自动回收。 */
|
|
10
|
+
reaped: false;
|
|
11
|
+
reason?: "kernel_alive" | "cleanup_incomplete" | "cleanup_acknowledged";
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* 持久化原生 Kernel 所有权与在途执行事实,不保存业务历史,不迁移旧执行架构。
|
|
15
|
+
* 这是资源恢复记录,不是模块 manifest。写入串行化并通过 rename 替换;
|
|
16
|
+
* 只有 owner 确认 Core/Adapter 资源回收后才能 close 删除记录。
|
|
16
17
|
*/
|
|
17
18
|
export declare class InvocationManifest {
|
|
18
19
|
#private;
|
|
@@ -21,30 +22,30 @@ export declare class InvocationManifest {
|
|
|
21
22
|
manifest: InvocationManifest;
|
|
22
23
|
reap: OrphanReapResult;
|
|
23
24
|
}>;
|
|
24
|
-
|
|
25
|
+
/** 原生服务异常退出无法证明 Adapter 资源已清空;正常 close 才删除所有权证据。 */
|
|
26
|
+
markNativeOwner(): Promise<void>;
|
|
27
|
+
/** owner 关闭未完成时登记实际失败;宿主继续存活也不能将诊断恢复为 available。 */
|
|
28
|
+
markCleanupIncomplete(): Promise<void>;
|
|
25
29
|
begin(entry: Omit<InvocationManifestEntry, "startedAt">): Promise<void>;
|
|
26
30
|
end(invocationId: string): Promise<void>;
|
|
27
31
|
close(): Promise<void>;
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
34
|
+
* 检查原生 owner 的遗留记录,不终止宿主或 Provider 进程。
|
|
35
|
+
* 仅文件不存在或该原文已获人工确认才允许 open;损坏及旧 worker 记录保留并明确拒绝。
|
|
32
36
|
*/
|
|
33
37
|
export declare function reapOrphanedInvocationManifest(path: string): Promise<OrphanReapResult>;
|
|
34
38
|
/** 只读恢复诊断,不回收进程、不改写清单;用于 doctor 及 SDK 运维界面。 */
|
|
35
39
|
export declare function inspectOrphanCleanup(path: string): Promise<{
|
|
36
40
|
manifestPath: string;
|
|
37
|
-
state: "missing" | "available" | "cleanup_incomplete" | "acknowledged" | "unreadable";
|
|
38
|
-
workerPid?: number;
|
|
41
|
+
state: "missing" | "available" | "cleanup_incomplete" | "acknowledged" | "unsupported" | "unreadable";
|
|
39
42
|
}>;
|
|
40
43
|
/**
|
|
41
44
|
* 操作者已停止未知后代后显式确认当前失败记录;不终止进程、不声称整树回收已验证。
|
|
42
|
-
*
|
|
45
|
+
* 仅接受有效原生记录,仍存活的原 Kernel 不能放行。备份保留,确认仅匹配原文摘要,
|
|
43
46
|
* 所以并发启动、后续调用或另一份清单不会复用旧确认;下一次 open 才替换失败记录。
|
|
44
47
|
*/
|
|
45
48
|
export declare function acknowledgeOrphanCleanup(path: string): Promise<{
|
|
46
49
|
manifestPath: string;
|
|
47
50
|
archivePath: string;
|
|
48
51
|
}>;
|
|
49
|
-
/** 查询系统启动时间以区分 PID 复用;失败时不返回可用于回收的身份,绝不以 PID 本身兜底。 */
|
|
50
|
-
export declare function processStartIdentity(pid: number): Promise<string | undefined>;
|