@mininglamp-oss/octo-runtime 1.1.12 → 1.1.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 +1 -1
- package/apps/cli/dist/adapters.d.ts +19 -1
- package/apps/cli/dist/adapters.js +153 -23
- 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 +1 -1
- 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 +15 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +24 -28
- 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 +22 -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/index.d.ts +14 -68
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.js +60 -43
- 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 +29 -18
- 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 +6 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +32 -26
- 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 +104 -216
- 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/index.d.ts +4 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +12 -14
- 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 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.js +23 -30
- 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 +48 -26
- 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 +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.js +15 -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 +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.js +14 -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 +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.js +15 -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 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +27 -29
- 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 +109 -178
- 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 +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.js +15 -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 +16 -14
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.js +15 -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 +49 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.js +256 -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 -12
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +116 -58
- 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 +153 -23
- 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 +173 -1295
- 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 +26 -54
- 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/watchdog.d.ts +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +5 -0
- 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/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 -5
- 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 -2
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +3 -267
- 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 +17 -3
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +102 -396
- 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 +6 -15
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +33 -178
- 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 -28
- 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 +173 -1295
- 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-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/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-client/{schema → fixtures}/kernel-ipc-fixtures.json +0 -0
- /package/packages/octo-runtime-protocol/{schema → test/fixtures}/kernel-ipc-fixtures.json +0 -0
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export { prepareInvokeInput } from "./invoke-input.js";
|
|
2
|
-
export { resolveLocalContext, localRuntimeLimits } from "./context.js";
|
|
3
|
-
export { prepareRunContext, type PreparedRunContext, type WorkspaceAssignments } from "./execution-preparation.js";
|
|
4
2
|
import type { AdapterInvocationContext, AdapterProbeOptions, AdapterOutput, CreateAdapterExecutionScope, ServiceProcessSnapshot } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
5
3
|
import { type InvokeInput, type InvokeEnvironment, type HostRunReceipt, type HostFrame, type NativeInteractionResponse, type InteractionResponse, type InvokeRequest } from "@mininglamp-oss/octo-runtime-protocol";
|
|
6
4
|
import { type RuntimeLog } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { prepareInvokeInput } from "./invoke-input.js";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
|
-
import {
|
|
4
|
-
import { access, stat } from "node:fs/promises";
|
|
5
|
-
import { sanitizePublicValue } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
3
|
+
import { sanitizePublicValue, isAdapterPreparationFailure } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
6
4
|
export { prepareInvokeInput } from "./invoke-input.js";
|
|
7
|
-
export { resolveLocalContext, localRuntimeLimits } from "./context.js";
|
|
8
|
-
export { prepareRunContext } from "./execution-preparation.js";
|
|
9
5
|
import { createInputInvoke, assertInvokeRequestSize, assertServiceProcessSnapshot, assertProtocolSupport, assertAdapterProtocolSupport, assertHostFrame, assertHostFrameIdentity, assertNativeInteractionResponse, resolveHostInvokeOptions, protocolError, assertCanonicalEvent, assertInteractionResponse, assertInvokeRequest, failurePayload, isCodexLocalFailure, isStreamCapacityReason, resolveStreamLimitPolicy, streamCapacityError, isTerminal } from "@mininglamp-oss/octo-runtime-protocol";
|
|
10
6
|
import { InvocationExperience } from "./experience.js";
|
|
11
7
|
import { noopRuntimeLog } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
@@ -187,14 +183,6 @@ export class AgentExecutor {
|
|
|
187
183
|
throw new Error(`unknown adapter: ${adapterType}`);
|
|
188
184
|
const support = this.#support(registered);
|
|
189
185
|
assertProtocolSupport(support, resolved);
|
|
190
|
-
if (request.approvalMode !== "full_access" &&
|
|
191
|
-
(resolved.protocolMode === "native"
|
|
192
|
-
? typeof registered.respondNative !== "function"
|
|
193
|
-
: typeof registered.respondInteraction !== "function")) {
|
|
194
|
-
throw new Error(`APPROVAL_MODE_UNSUPPORTED: ${adapterType} does not implement execution-time approval responses`);
|
|
195
|
-
}
|
|
196
|
-
if (!registered?.metadata.agentSources.includes(request.agentSource))
|
|
197
|
-
throw new Error("AGENT_SOURCE_UNSUPPORTED: " + adapterType);
|
|
198
186
|
if (this.#runs.has(request.invocationId))
|
|
199
187
|
throw protocolError("EXECUTION_IDENTITY_CONFLICT", "EXECUTION_IDENTITY_CONFLICT: Invocation already executed");
|
|
200
188
|
for (const [id, run] of this.#runs) {
|
|
@@ -253,7 +241,7 @@ export class AgentExecutor {
|
|
|
253
241
|
const streamLimits = resolveStreamLimitPolicy(environment.streamLimits);
|
|
254
242
|
const { signal, ...wire } = request;
|
|
255
243
|
const frozenRequest = { ...structuredClone(wire), signal };
|
|
256
|
-
return this.#admit(adapterType, frozenRequest, protocolMode, streamLimits, received);
|
|
244
|
+
return this.#admit(adapterType, frozenRequest, protocolMode, streamLimits, received, environment.providerOptions && structuredClone(environment.providerOptions));
|
|
257
245
|
}
|
|
258
246
|
catch (error) {
|
|
259
247
|
this.#log("warn", "invoke.rejected", {
|
|
@@ -267,7 +255,7 @@ export class AgentExecutor {
|
|
|
267
255
|
if (this.#state !== "open")
|
|
268
256
|
throw new Error("EXECUTOR_CLOSED");
|
|
269
257
|
}
|
|
270
|
-
async *#admit(adapterType, request, protocolMode, streamLimits, received) {
|
|
258
|
+
async *#admit(adapterType, request, protocolMode, streamLimits, received, providerOptions) {
|
|
271
259
|
// 延迟到消费时再次检查关闭/取消,防止创建生成器后、开始迭代前 shutdown 的竞态。
|
|
272
260
|
this.#assertOpen();
|
|
273
261
|
request.signal?.throwIfAborted();
|
|
@@ -281,6 +269,7 @@ export class AgentExecutor {
|
|
|
281
269
|
};
|
|
282
270
|
const owner = {
|
|
283
271
|
streamId: receipt.stream_id,
|
|
272
|
+
providerOptions,
|
|
284
273
|
controller,
|
|
285
274
|
detach: () => {
|
|
286
275
|
signal?.removeEventListener("abort", callerAbort);
|
|
@@ -299,7 +288,6 @@ export class AgentExecutor {
|
|
|
299
288
|
invocation_id: request.invocationId,
|
|
300
289
|
session_id: request.agentSessionId,
|
|
301
290
|
adapter_type: adapterType,
|
|
302
|
-
model: request.agentConfig?.model,
|
|
303
291
|
duration_ms: Date.now() - received
|
|
304
292
|
});
|
|
305
293
|
yield* this.#streamInvocation(adapterType, request, receipt, streamLimits, owner);
|
|
@@ -588,7 +576,7 @@ export class AgentExecutor {
|
|
|
588
576
|
session_id: request.agentSessionId,
|
|
589
577
|
adapter_type: adapterType
|
|
590
578
|
};
|
|
591
|
-
const watchdog = new InvocationWatchdog(
|
|
579
|
+
const watchdog = new InvocationWatchdog(undefined, controller, (diagnostic) => this.#log("warn", "invoke.watchdog", {
|
|
592
580
|
...identity,
|
|
593
581
|
code: diagnostic.event
|
|
594
582
|
}));
|
|
@@ -622,7 +610,7 @@ export class AgentExecutor {
|
|
|
622
610
|
return result;
|
|
623
611
|
}
|
|
624
612
|
catch (error) {
|
|
625
|
-
nextFailed =
|
|
613
|
+
nextFailed = !isAdapterPreparationFailure(error, context);
|
|
626
614
|
throw error;
|
|
627
615
|
}
|
|
628
616
|
};
|
|
@@ -642,6 +630,8 @@ export class AgentExecutor {
|
|
|
642
630
|
const context = {
|
|
643
631
|
protocolMode,
|
|
644
632
|
streamLimits,
|
|
633
|
+
providerOptions: owner.providerOptions,
|
|
634
|
+
configureRuntimeLimits: (limits) => watchdog.configure(limits),
|
|
645
635
|
log: this.#log,
|
|
646
636
|
reportConversion: () => {
|
|
647
637
|
if (protocolMode === "native")
|
|
@@ -779,7 +769,7 @@ export class AgentExecutor {
|
|
|
779
769
|
? {
|
|
780
770
|
protocolVersion: 2,
|
|
781
771
|
type: "run.failed",
|
|
782
|
-
payload:
|
|
772
|
+
payload: adapterFailurePayload(adapterEvent.payload, {
|
|
783
773
|
stage: "provider.invoke",
|
|
784
774
|
defaultDomain: "provider",
|
|
785
775
|
runId: request.runId,
|
|
@@ -847,13 +837,13 @@ export class AgentExecutor {
|
|
|
847
837
|
const error = controller.signal.reason instanceof AdapterWatchdogTimeoutError
|
|
848
838
|
? controller.signal.reason
|
|
849
839
|
: caught;
|
|
850
|
-
const failure =
|
|
840
|
+
const failure = adapterFailurePayload({
|
|
851
841
|
message: errorMessage(error),
|
|
852
842
|
adapterType,
|
|
853
843
|
...(errorCode(error) ? { code: errorCode(error) } : {}),
|
|
854
844
|
...capacityFailureDetails(error),
|
|
855
845
|
...watchdogFailureDetails(error)
|
|
856
|
-
},
|
|
846
|
+
}, {
|
|
857
847
|
stage: "adapter.invoke",
|
|
858
848
|
defaultDomain: "adapter",
|
|
859
849
|
runId: request.runId,
|
|
@@ -900,11 +890,12 @@ export class AgentExecutor {
|
|
|
900
890
|
type: "error",
|
|
901
891
|
code: nativeFailureCode === "HOST_ENDED_WITHOUT_TERMINAL"
|
|
902
892
|
? "HOST_ENDED_WITHOUT_TERMINAL"
|
|
903
|
-
: isStreamCapacityReason(nativeFailureCode)
|
|
893
|
+
: isStreamCapacityReason(nativeFailureCode) || isWorkdirFailure(nativeFailureCode)
|
|
904
894
|
? nativeFailureCode
|
|
905
895
|
: "HOST_EXECUTION_FAILED",
|
|
906
896
|
message: String(failure.message),
|
|
907
897
|
...(isStreamCapacityReason(nativeFailureCode) ||
|
|
898
|
+
isWorkdirFailure(nativeFailureCode) ||
|
|
908
899
|
(adapterType === "codex" && isCodexLocalFailure(failure.failure))
|
|
909
900
|
? { failure: failure.failure }
|
|
910
901
|
: {})
|
|
@@ -1092,39 +1083,20 @@ export class AgentExecutor {
|
|
|
1092
1083
|
function errorMessage(error) {
|
|
1093
1084
|
return error instanceof Error ? error.message : String(error);
|
|
1094
1085
|
}
|
|
1086
|
+
const WORKDIR_FAILURE_MESSAGES = {
|
|
1087
|
+
WORKDIR_REQUIRED: "A prepared working directory is required; create it and provide its absolute path.",
|
|
1088
|
+
WORKDIR_INVALID: "Working directory must be an absolute path without NUL characters.",
|
|
1089
|
+
WORKDIR_NOT_FOUND: "Working directory does not exist; create it before invoking Runtime.",
|
|
1090
|
+
WORKDIR_NOT_DIRECTORY: "Working directory must point to an existing directory.",
|
|
1091
|
+
WORKDIR_UNAVAILABLE: "Working directory is not accessible; check directory access permissions."
|
|
1092
|
+
};
|
|
1093
|
+
function isWorkdirFailure(code) {
|
|
1094
|
+
return typeof code === "string" && Object.hasOwn(WORKDIR_FAILURE_MESSAGES, code);
|
|
1095
|
+
}
|
|
1095
1096
|
/** Keep the Adapter's failure detail; catalog normalization only adds classification. */
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
if (["ENOENT", "ENOTDIR", "EACCES", "EPERM"].includes(String(input.code)) && workdir) {
|
|
1100
|
-
let problem;
|
|
1101
|
-
try {
|
|
1102
|
-
if (!(await stat(workdir)).isDirectory())
|
|
1103
|
-
problem = "配置的工作目录不是文件夹";
|
|
1104
|
-
else
|
|
1105
|
-
await access(workdir, constants.X_OK);
|
|
1106
|
-
}
|
|
1107
|
-
catch (error) {
|
|
1108
|
-
const code = errorCode(error);
|
|
1109
|
-
if (code === "ENOENT")
|
|
1110
|
-
problem = "配置的工作目录不存在";
|
|
1111
|
-
else if (code === "ENOTDIR")
|
|
1112
|
-
problem = "配置的工作目录路径中包含非文件夹项";
|
|
1113
|
-
else if (code === "EACCES" || code === "EPERM")
|
|
1114
|
-
problem = "没有进入配置工作目录的权限";
|
|
1115
|
-
}
|
|
1116
|
-
if (problem)
|
|
1117
|
-
detail = {
|
|
1118
|
-
...input,
|
|
1119
|
-
code: "ADAPTER_INVOCATION_FAILED",
|
|
1120
|
-
message: `${problem}(adapter.workdir=${workdir})。${typeof input.message === "string" ? input.message : ""}`,
|
|
1121
|
-
error: input.error ?? { code: input.code, message: input.message }
|
|
1122
|
-
};
|
|
1123
|
-
}
|
|
1124
|
-
const normalized = failurePayload(detail, {
|
|
1125
|
-
...context,
|
|
1126
|
-
...(detail !== input ? { defaultDomain: "adapter" } : {})
|
|
1127
|
-
});
|
|
1097
|
+
function adapterFailurePayload(input, context) {
|
|
1098
|
+
const detail = input;
|
|
1099
|
+
const normalized = failurePayload(detail, context);
|
|
1128
1100
|
// 仅 ACP 消息保留原始 _meta;外层字段仍按公共错误规则脱敏,不能凭错误码整体绕过。
|
|
1129
1101
|
const { message: originalMessage, ...outerDetail } = detail;
|
|
1130
1102
|
const safe = sanitizePublicValue(outerDetail);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type InvokeRequest } from "@mininglamp-oss/octo-runtime-protocol";
|
|
2
2
|
/**
|
|
3
|
-
* 将调用方本轮 JSON
|
|
3
|
+
* 将调用方本轮 JSON 快照包装为内部请求,不读取持久会话或创建 Provider。
|
|
4
4
|
* sessionId 只标识业务会话;续接必须显式携带 providerSession,不能由同名会话推断。
|
|
5
|
-
*
|
|
5
|
+
* 仅读取 Adapter 路由;agentEnv 与业务方准备的 inputs 保序交给 Adapter。
|
|
6
6
|
*/
|
|
7
7
|
export declare function prepareInvokeInput(value: unknown): {
|
|
8
8
|
adapterType: string;
|
|
@@ -1,52 +1,21 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import {
|
|
3
|
-
import { CONTEXT_SCHEMA, DEFAULT_RUN_TIMEOUT_MS, assertAgentSource, assertContextEnvelope, assertInvokeRequest, contextControlInstructions, contextItem, InvokeInput } from "@mininglamp-oss/octo-runtime-protocol";
|
|
4
|
-
/** CLI shorthand resolves execution defaults before entering the strict Context contract. */
|
|
5
|
-
function inputContext(value) {
|
|
6
|
-
if (isRecord(value) && Array.isArray(value.items)) {
|
|
7
|
-
value = {
|
|
8
|
-
...value,
|
|
9
|
-
items: value.items.map((item) => {
|
|
10
|
-
if (isRecord(item) &&
|
|
11
|
-
item.namespace === "octo.execution" &&
|
|
12
|
-
item.name === "adapter" &&
|
|
13
|
-
isRecord(item.payload) &&
|
|
14
|
-
item.payload.type === "openclaw" &&
|
|
15
|
-
!Object.hasOwn(item.payload, "provider_agent_id")) {
|
|
16
|
-
return { ...item, payload: { ...item.payload, provider_agent_id: "main" } };
|
|
17
|
-
}
|
|
18
|
-
return item;
|
|
19
|
-
})
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
const envelope = {
|
|
23
|
-
schema: value.schema,
|
|
24
|
-
items: value.items
|
|
25
|
-
};
|
|
26
|
-
assertContextEnvelope(envelope);
|
|
27
|
-
return envelope;
|
|
28
|
-
}
|
|
2
|
+
import { assertInvokeRequest, contextItem, InvokeInput } from "@mininglamp-oss/octo-runtime-protocol";
|
|
29
3
|
/**
|
|
30
|
-
* 将调用方本轮 JSON
|
|
4
|
+
* 将调用方本轮 JSON 快照包装为内部请求,不读取持久会话或创建 Provider。
|
|
31
5
|
* sessionId 只标识业务会话;续接必须显式携带 providerSession,不能由同名会话推断。
|
|
32
|
-
*
|
|
6
|
+
* 仅读取 Adapter 路由;agentEnv 与业务方准备的 inputs 保序交给 Adapter。
|
|
33
7
|
*/
|
|
34
8
|
export function prepareInvokeInput(value) {
|
|
35
9
|
if (!isRecord(value))
|
|
36
10
|
throw new TypeError("invoke input must be a JSON object");
|
|
37
|
-
const input = InvokeInput.check(
|
|
38
|
-
...value,
|
|
39
|
-
agentEnv: { ...value.agentEnv, ...inputContext(value.agentEnv) }
|
|
40
|
-
});
|
|
41
|
-
const contexts = inputContext(value.agentEnv);
|
|
42
|
-
const env = input.agentEnv;
|
|
11
|
+
const input = InvokeInput.check(value);
|
|
43
12
|
const protocolMode = value.protocol_mode ?? "native";
|
|
44
13
|
if (protocolMode !== "native" && protocolMode !== "canonical") {
|
|
45
14
|
throw new TypeError("protocol_mode must be native or canonical");
|
|
46
15
|
}
|
|
47
|
-
const adapterType = contextItem(
|
|
48
|
-
|
|
49
|
-
|
|
16
|
+
const adapterType = contextItem(input.agentEnv, "octo.execution", "adapter")?.payload.type ?? "codex";
|
|
17
|
+
if (typeof adapterType !== "string" || !adapterType)
|
|
18
|
+
throw new TypeError("ADAPTER_TYPE_INVALID");
|
|
50
19
|
if (value.sessionId !== undefined &&
|
|
51
20
|
(typeof value.sessionId !== "string" || !value.sessionId.trim())) {
|
|
52
21
|
throw new TypeError("sessionId must be a non-empty string");
|
|
@@ -75,38 +44,6 @@ export function prepareInvokeInput(value) {
|
|
|
75
44
|
throw new TypeError("fresh execution cannot carry providerSession");
|
|
76
45
|
if (continuityMode === "continue" && !providerSession)
|
|
77
46
|
throw new TypeError("continue requires providerSession; sessionId alone cannot resume a provider");
|
|
78
|
-
const defaults = {
|
|
79
|
-
schema: CONTEXT_SCHEMA,
|
|
80
|
-
items: [
|
|
81
|
-
{ namespace: "octo.execution", name: "adapter", payload: { type: "codex" } },
|
|
82
|
-
...(agentSource === "provisioned"
|
|
83
|
-
? [
|
|
84
|
-
{
|
|
85
|
-
namespace: "octo.execution",
|
|
86
|
-
name: "workspace",
|
|
87
|
-
payload: { mode: "fixed", path: env.workdir ?? process.cwd() }
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
: []),
|
|
91
|
-
{
|
|
92
|
-
namespace: "octo.security",
|
|
93
|
-
name: "approval_policy",
|
|
94
|
-
payload: { mode: env.approvalMode ?? "ask" }
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
namespace: "octo.execution",
|
|
98
|
-
name: "limits",
|
|
99
|
-
payload: { run_timeout_ms: DEFAULT_RUN_TIMEOUT_MS }
|
|
100
|
-
}
|
|
101
|
-
]
|
|
102
|
-
};
|
|
103
|
-
// 解析固定执行配置;没有业务 Context 渲染阶段。
|
|
104
|
-
const { resolvedExecutionPlan: plan } = resolveLocalContext(defaults, {
|
|
105
|
-
schema: CONTEXT_SCHEMA,
|
|
106
|
-
items: contexts.items.filter((item) => item.namespace === "octo.execution" ||
|
|
107
|
-
(item.namespace === "octo.security" && item.name === "approval_policy"))
|
|
108
|
-
}, agentSource);
|
|
109
|
-
const context = structuredClone(contexts);
|
|
110
47
|
const prompt = input.inputs
|
|
111
48
|
.map((part) => (part.type === "text" ? part.text : "[Image]"))
|
|
112
49
|
.join("\n\n");
|
|
@@ -119,7 +56,6 @@ export function prepareInvokeInput(value) {
|
|
|
119
56
|
agentSessionId: value.sessionId ?? `session_${randomUUID()}`,
|
|
120
57
|
// 名称默认值只在此归一化;Host SDK/Adapter 不猜业务策略或据此决定恢复。
|
|
121
58
|
sessionName: input.sessionName ?? randomUUID(),
|
|
122
|
-
agentSource,
|
|
123
59
|
continuityMode,
|
|
124
60
|
...(providerSession ? { providerSession } : {}),
|
|
125
61
|
...(input.sessionGeneration !== undefined
|
|
@@ -138,22 +74,14 @@ export function prepareInvokeInput(value) {
|
|
|
138
74
|
: {}),
|
|
139
75
|
prompt: input.prompt ?? prompt,
|
|
140
76
|
modelInput: input.modelInput ?? prompt,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
runtimeLimits: env.runtimeLimits ?? localRuntimeLimits(plan),
|
|
147
|
-
agentConfig: {
|
|
148
|
-
workdir: plan.workdir,
|
|
149
|
-
...(plan.model ? { model: plan.model } : {}),
|
|
150
|
-
...(plan.effort ? { effort: plan.effort } : {}),
|
|
151
|
-
...(plan.provider_agent_id ? { providerAgentId: plan.provider_agent_id } : {}),
|
|
152
|
-
...env.agentConfig
|
|
153
|
-
}
|
|
77
|
+
// 高级调用显式选择的纯文本作为普通内容提交;有图片时始终保留完整有序 parts。
|
|
78
|
+
modelInputParts: input.modelInput !== undefined && input.inputs.every((part) => part.type === "text")
|
|
79
|
+
? [{ type: "text", text: input.modelInput }]
|
|
80
|
+
: structuredClone(input.inputs),
|
|
81
|
+
agentEnv: structuredClone(input.agentEnv)
|
|
154
82
|
};
|
|
155
83
|
assertInvokeRequest(request);
|
|
156
|
-
return { adapterType
|
|
84
|
+
return { adapterType, protocolMode, request };
|
|
157
85
|
}
|
|
158
86
|
function isRecord(value) {
|
|
159
87
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -31,8 +31,10 @@ export declare class InvocationWatchdog {
|
|
|
31
31
|
readonly controller: AbortController;
|
|
32
32
|
readonly diagnostic: (value: WatchdogDiagnostic) => void;
|
|
33
33
|
readonly time: WatchdogClock;
|
|
34
|
-
|
|
34
|
+
limits: EffectiveLimits;
|
|
35
35
|
constructor(limits: RuntimeLimits | undefined, controller: AbortController, diagnostic?: (value: WatchdogDiagnostic) => void, time?: WatchdogClock);
|
|
36
|
+
/** Adapter 开始执行前解释本轮预算,计时起点保持本次执行,不重置已有进度。 */
|
|
37
|
+
configure(limits: RuntimeLimits | undefined): void;
|
|
36
38
|
activity(activity: ProviderActivity): void;
|
|
37
39
|
canonical(event: CanonicalEvent): void;
|
|
38
40
|
/** Lifetime evidence is independent of provider payload conversion. */
|
|
@@ -75,6 +75,11 @@ export class InvocationWatchdog {
|
|
|
75
75
|
});
|
|
76
76
|
this.#arm();
|
|
77
77
|
}
|
|
78
|
+
/** Adapter 开始执行前解释本轮预算,计时起点保持本次执行,不重置已有进度。 */
|
|
79
|
+
configure(limits) {
|
|
80
|
+
this.limits = normalizeRuntimeLimits(limits);
|
|
81
|
+
this.#arm();
|
|
82
|
+
}
|
|
78
83
|
activity(activity) {
|
|
79
84
|
if (!this.#active())
|
|
80
85
|
return;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-executor-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
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.13",
|
|
9
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.13"
|
|
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.13",
|
|
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.13",
|
|
14
|
+
"@mininglamp-oss/octo-runtime-executor-core": "1.1.13",
|
|
15
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.13",
|
|
16
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.13"
|
|
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.13",
|
|
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.13",
|
|
14
|
+
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.13",
|
|
15
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.13"
|
|
16
16
|
},
|
|
17
17
|
"types": "./dist/index.d.ts",
|
|
18
18
|
"files": [
|
|
@@ -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,10 +1,9 @@
|
|
|
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. */
|
|
@@ -19,8 +18,7 @@ export const CONTEXT_TYPE_CATALOG = Object.freeze([
|
|
|
19
18
|
entry("octo.runtime", "selection", "ContextRuntimeSelectionPayload", true),
|
|
20
19
|
entry("octo.security", "approval_policy", "ContextApprovalPolicyPayload", true),
|
|
21
20
|
entry("octo.content", "inline", "ContextInlinePayload", false),
|
|
22
|
-
entry("octo.content", "references", "ContextReferencesPayload", false)
|
|
23
|
-
entry("octo.control", "instructions", "ContextInstructionsPayload", true, true)
|
|
21
|
+
entry("octo.content", "references", "ContextReferencesPayload", false)
|
|
24
22
|
]);
|
|
25
23
|
export function contextTypeDefinition(namespace, name) {
|
|
26
24
|
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,4 +1,4 @@
|
|
|
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;
|
|
@@ -17,7 +17,6 @@ export declare function assertContextEnvelope(value: unknown): asserts value is
|
|
|
17
17
|
export declare function contextItem(context: ContextEnvelope, namespace: string, name: string): ContextItem | undefined;
|
|
18
18
|
export declare function canonicalContext(context: ContextEnvelope): string;
|
|
19
19
|
export declare function mergeContext(defaults: ContextEnvelope, overrides: ContextEnvelope): ContextEnvelope;
|
|
20
|
-
export declare function assertResolvedExecutionPlan(value: unknown): asserts value is ResolvedExecutionPlan;
|
|
21
20
|
export declare function assertContextMcp(value: unknown): asserts value is {
|
|
22
21
|
mcpServers: McpServers;
|
|
23
22
|
};
|