@mininglamp-oss/octo-runtime 1.1.9 → 1.1.11
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 +2 -2
- package/apps/cli/README.md +1 -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 +77 -0
- package/apps/cli/dist/build-info.json +2 -2
- package/apps/cli/dist/command-tree.js +2 -3
- package/apps/cli/dist/extras.js +11 -1
- package/apps/cli/dist/help.js +1 -1
- package/apps/cli/dist/index.js +18 -1
- package/apps/cli/dist/main.d.ts +2 -0
- package/apps/cli/dist/main.js +67 -34
- package/apps/cli/dist/manifest.json +0 -5
- package/apps/cli/dist/module-manifest.js +21 -3
- package/apps/cli/dist/output.d.ts +19 -1
- package/apps/cli/dist/output.js +180 -33
- 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 +10 -11
- package/apps/cli/dist/state.d.ts +5 -2
- package/apps/cli/dist/state.js +48 -13
- package/dist/public/codex.d.ts +1 -0
- package/dist/public/codex.js +1 -0
- package/dist/public/executor-kernel.d.ts +4 -1
- package/dist/public/executor-kernel.js +2 -1
- package/dist/public/extra.d.ts +1 -1
- package/dist/public/host.d.ts +5 -0
- package/dist/public/host.js +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +20 -0
- 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 +6 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +68 -253
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +11 -6
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.js +198 -52
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.d.ts +58 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.js +650 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/stdin-writer.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/stdin-writer.js +15 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
- 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/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +2 -0
- 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/activity.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/execution-scope.d.ts +25 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +3 -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 +77 -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 +2 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extras.js +11 -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 +18 -1
- 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 +67 -34
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +0 -5
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.js +21 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.d.ts +19 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +180 -33
- 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 +10 -11
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/state.d.ts +5 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/state.js +48 -13
- package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +23 -24
- package/node_modules/@mininglamp-oss/octo-runtime-client/build-info.json +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/async-question-reply.d.ts +30 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/async-question-reply.js +199 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/browser.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/browser.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.d.ts +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.js +465 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/index.d.ts +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/index.js +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/internal.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/internal.js +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/invocation-lifecycle.d.ts +59 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/invocation-lifecycle.js +287 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/notification.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/notification.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/protocol.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/protocol.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/runtime-path.d.ts +21 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/runtime-path.js +138 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-catalog.d.ts +8 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-catalog.js +65 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-diagnostics.d.ts +82 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/startup-diagnostics.js +371 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/submission-error.d.ts +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/submission-error.js +23 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/types.d.ts +72 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/dist/types.js +10 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/package.json +54 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-configuration-fixtures.json +1219 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-fixtures.json +5988 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-client.behavior.json +56 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc-fixtures.json +53 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc.schema.json +538 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/native-invoke-fixtures.json +116 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/protocol.schema.json +4525 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/run-protocol-fixtures.json +761 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/runtime-selection-fixtures.json +663 -0
- package/node_modules/@mininglamp-oss/octo-runtime-client/schema/session-name-fixtures.json +191 -0
- 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 +29 -21
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +173 -14
- 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 +1 -30
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.js +2 -199
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/client.d.ts +1 -8
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/client.js +2 -444
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/endpoint.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 +11 -9
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/host-run-service.js +14 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +5 -7
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +6 -7
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-lifecycle.d.ts +1 -53
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-lifecycle.js +2 -280
- 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/lifecycle.d.ts +5 -10
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/lifecycle.js +4 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runtime-home.d.ts +20 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/runtime-home.js +180 -0
- 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 +75 -45
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.d.ts +9 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.js +60 -5
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-catalog.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-catalog.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-diagnostics.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-diagnostics.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-logging.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-logging.js +18 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.d.ts +1 -10
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.js +2 -23
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/types.d.ts +2 -72
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/types.js +2 -10
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +5 -12
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/extra.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/ports.d.ts +2 -2
- 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/extra.js +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/ports.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/index.js +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/{index-BVxePruX.js → index-BLMf2Etg.js} +1 -3
- 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/endpoint.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/endpoint.js +12 -5
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/errors.d.ts +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/errors.js +9 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/execution.d.ts +44 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/execution.js +207 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-config.js +23 -3
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-service.d.ts +27 -4
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-service.js +133 -25
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extras.d.ts +10 -3
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extras.js +18 -4
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/home.d.ts +5 -6
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/home.js +33 -45
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/identity.js +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.js +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +5 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/adapter-metadata.d.ts +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +19 -15
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.js +65 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
- package/package.json +33 -29
- package/packages/octo-runtime-protocol/schema/protocol.schema.json +42 -36
- 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.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 -64
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/rpc.js +0 -674
- 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
- /package/{apps/cli/dist/worker.d.ts → node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/execution-scope.js} +0 -0
- /package/node_modules/@mininglamp-oss/{octo-runtime-cli/dist/worker.d.ts → octo-runtime-protocol/dist/adapter-metadata.js} +0 -0
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import { assertStartupLogging } from "./startup-logging.js";
|
|
1
2
|
import net from "node:net";
|
|
2
3
|
import { randomUUID } from "node:crypto";
|
|
3
|
-
import { chmod,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { chmod, rm } from "node:fs/promises";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { assertIpcEndpoint, runtimePathFailure } from "./runtime-home.js";
|
|
7
|
+
import { readBoundedLines, RuntimeLogging } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
6
8
|
import { assertHostRunReceipt, createInputInvoke, contextItem, INVOKE_REQUEST_MAX_BYTES, HOST_RPC_MAX_LINE_BYTES, resolveStreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
|
|
7
9
|
import { HostRunService } from "./host-run-service.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
+
import { AgentExecutor } from "@mininglamp-oss/octo-runtime-executor-core";
|
|
11
|
+
import { beforeDeadline } from "./lifecycle.js";
|
|
12
|
+
import { withStartupContext } from "./startup-diagnostics.js";
|
|
13
|
+
import { probeOptions } from "./execution-source.js";
|
|
10
14
|
import { acquireEndpoint } from "./endpoint.js";
|
|
11
15
|
import { InvocationManifest } from "./invocation-manifest.js";
|
|
12
|
-
import { readModuleManifest, resolveAdapterModules } from "@mininglamp-oss/octo-runtime-adapter-sdk/module-manifest";
|
|
13
16
|
import { KernelError } from "./types.js";
|
|
14
17
|
function validateParams(method, params) {
|
|
15
18
|
const fields = {
|
|
@@ -69,21 +72,17 @@ function validateParams(method, params) {
|
|
|
69
72
|
throw new KernelError("INVALID_PARAMS");
|
|
70
73
|
}
|
|
71
74
|
/**
|
|
72
|
-
*
|
|
75
|
+
* 在宿主进程创建本地 RPC 端点,独占端点租约、Run 事件源和 AgentExecutor。
|
|
73
76
|
* 启动失败也执行回收;close 失败会保留所有权证据,客户端断开不等同于 owner 关闭。
|
|
74
77
|
*/
|
|
75
78
|
export async function startKernelServer(options, signal) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
throw new TypeError("manifest and adapterModules are mutually exclusive");
|
|
79
|
-
// 文件仅在服务启动时读取一次;worker 自动恢复沿用快照,不因磁盘改动改变加载集合。
|
|
80
|
-
const adapterModules = options.manifest
|
|
81
|
-
? resolveAdapterModules(await readModuleManifest(options.manifest, { legacy: true }))
|
|
82
|
-
: options.adapterModules;
|
|
79
|
+
assertIpcEndpoint(options.endpoint);
|
|
80
|
+
assertStartupLogging(options.logging, { component: "executor-kernel", phase: "initializing" });
|
|
83
81
|
const instance = randomUUID();
|
|
84
82
|
const logging = new RuntimeLogging(options.logging);
|
|
85
83
|
let manifest;
|
|
86
|
-
const
|
|
84
|
+
const executor = new AgentExecutor({ log: logging.kernel });
|
|
85
|
+
let ready = false;
|
|
87
86
|
// 每轮只读取一次宿主配置;复制后冻结自有快照,不冻结宿主持有的原对象。
|
|
88
87
|
const configure = (input) => {
|
|
89
88
|
const type = contextItem(input.contexts, "octo.execution", "adapter")?.payload.type;
|
|
@@ -95,13 +94,13 @@ export async function startKernelServer(options, signal) {
|
|
|
95
94
|
}));
|
|
96
95
|
};
|
|
97
96
|
const transport = {
|
|
98
|
-
list: (configs) =>
|
|
99
|
-
probe: (type, config) =>
|
|
100
|
-
cancel: (id, reason) =>
|
|
101
|
-
respondInteraction: (id, response) =>
|
|
102
|
-
respondNative: (id, response) =>
|
|
97
|
+
list: (configs) => executor.describe(configs ?? options.configurations?.() ?? options.adapterConfigurations),
|
|
98
|
+
probe: (type, config) => Promise.resolve().then(() => executor.probe(type, config)),
|
|
99
|
+
cancel: (id, reason) => Promise.resolve().then(() => ({ cancelled: executor.cancel(id, reason) })),
|
|
100
|
+
respondInteraction: (id, response) => executor.respondInteraction(id, response),
|
|
101
|
+
respondNative: (id, response) => executor.respondNative(id, response),
|
|
103
102
|
invoke: createInputInvoke((input, environment) => transport.invokeFrames(input, environment)),
|
|
104
|
-
invokeFrames: (input, environment) =>
|
|
103
|
+
invokeFrames: (input, environment) => executor.invokeFrames(input, environment)
|
|
105
104
|
};
|
|
106
105
|
const runs = new HostRunService(transport);
|
|
107
106
|
const sockets = new Set();
|
|
@@ -112,8 +111,8 @@ export async function startKernelServer(options, signal) {
|
|
|
112
111
|
ipc_version: 1,
|
|
113
112
|
kernel_instance_id: instance,
|
|
114
113
|
pid: process.pid,
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
execution_ready: !closing && ready,
|
|
115
|
+
service_processes: [...executor.processes()]
|
|
117
116
|
});
|
|
118
117
|
const snapshot = (key, expected) => {
|
|
119
118
|
if (expected !== undefined && expected !== instance)
|
|
@@ -184,12 +183,10 @@ export async function startKernelServer(options, signal) {
|
|
|
184
183
|
throw new KernelError("KERNEL_INSTANCE_CHANGED");
|
|
185
184
|
// 此处尚未调用执行源;专用证据只标记本次拒绝,不能推广到已接纳或 ACK 未知的请求。
|
|
186
185
|
if (!status().execution_ready)
|
|
187
|
-
throw new KernelError(
|
|
188
|
-
? "WORKER_RESTART_EXHAUSTED"
|
|
189
|
-
: "KERNEL_UNAVAILABLE", { invocation_not_submitted: true });
|
|
186
|
+
throw new KernelError("KERNEL_UNAVAILABLE", { invocation_not_submitted: true });
|
|
190
187
|
const input = params.input;
|
|
191
188
|
const config = configure(input);
|
|
192
|
-
// 选项先合并再进入 HostRunService 的整请求预算检查;策略沿同一调用传给
|
|
189
|
+
// 选项先合并再进入 HostRunService 的整请求预算检查;策略沿同一调用传给 Core 和重放窗口。
|
|
193
190
|
const configuredInput = config
|
|
194
191
|
? {
|
|
195
192
|
...input,
|
|
@@ -309,7 +306,7 @@ export async function startKernelServer(options, signal) {
|
|
|
309
306
|
message: "Kernel request failed",
|
|
310
307
|
data: {
|
|
311
308
|
code,
|
|
312
|
-
//
|
|
309
|
+
// Core 错误使用 camelCase 属性;此处转换为公开 socket 协议字段,client 保留整个 data。
|
|
313
310
|
...(code === "ASYNC_ANSWER_REJECTED" &&
|
|
314
311
|
record(error) &&
|
|
315
312
|
Number.isSafeInteger(error.providerRpcCode)
|
|
@@ -348,13 +345,15 @@ export async function startKernelServer(options, signal) {
|
|
|
348
345
|
});
|
|
349
346
|
});
|
|
350
347
|
const teardown = async (until = Date.now() + 5000) => {
|
|
348
|
+
ready = false;
|
|
349
|
+
logging.kernel("info", "kernel.closing", { pid: process.pid });
|
|
351
350
|
runs.beginDrain();
|
|
352
351
|
for (const socket of sockets)
|
|
353
352
|
socket.destroy();
|
|
354
353
|
const errors = [];
|
|
355
354
|
const attempt = async (operation) => {
|
|
356
355
|
try {
|
|
357
|
-
await operation();
|
|
356
|
+
await beforeDeadline(operation(), until);
|
|
358
357
|
return true;
|
|
359
358
|
}
|
|
360
359
|
catch (error) {
|
|
@@ -364,28 +363,42 @@ export async function startKernelServer(options, signal) {
|
|
|
364
363
|
};
|
|
365
364
|
if (listening)
|
|
366
365
|
await attempt(() => new Promise((resolve) => server.close(() => resolve())));
|
|
367
|
-
//
|
|
368
|
-
//
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
366
|
+
// 先停接纳,再取消 Core 并等待 Adapter finally;终态不代替资源释放确认。
|
|
367
|
+
// 同进程不能强杀阻塞的 JS。所有等待共享绝对期限,超时保留所有权证据。
|
|
368
|
+
const executorStopped = await attempt(async () => {
|
|
369
|
+
const result = await executor.shutdown("Kernel shutdown", Math.max(1, until - Date.now() - 1200));
|
|
370
|
+
if (result.cleanup !== "complete")
|
|
371
|
+
throw new Error("EXECUTOR_CLEANUP_INCOMPLETE");
|
|
372
|
+
});
|
|
373
|
+
await attempt(() => beforeDeadline(runs.close(), until - 1000));
|
|
374
|
+
// 原生日志由同一 owner 持有:Core/finally 排空后才关闭,且仍只用原截止时间。
|
|
375
|
+
logging.kernel(errors.length ? "error" : "info", errors.length ? "kernel.cleanup_incomplete" : "kernel.execution_drained", errors.length ? { code: "KERNEL_CLEANUP_INCOMPLETE" } : { pid: process.pid });
|
|
376
|
+
await attempt(() => logging.close());
|
|
377
|
+
if (executorStopped && !errors.length) {
|
|
376
378
|
await attempt(() => manifest?.close() ?? Promise.resolve());
|
|
377
379
|
if (listening && process.platform !== "win32")
|
|
378
380
|
await attempt(() => rm(options.endpoint, { force: true }));
|
|
379
381
|
if (!errors.length)
|
|
380
382
|
await attempt(() => releaseEndpoint?.() ?? Promise.resolve());
|
|
381
383
|
}
|
|
382
|
-
if (errors.length)
|
|
384
|
+
if (errors.length) {
|
|
385
|
+
// 原生宿主仍存活时也必须暴露真实关闭失败;持久化失败不能覆盖原清理原因。
|
|
386
|
+
await attempt(() => manifest?.markCleanupIncomplete() ?? Promise.resolve());
|
|
383
387
|
throw new AggregateError(errors, "KERNEL_CLEANUP_INCOMPLETE");
|
|
388
|
+
}
|
|
384
389
|
};
|
|
390
|
+
let startupContext = { operation: "register-adapters", configKey: "adapters" };
|
|
385
391
|
try {
|
|
386
392
|
signal?.throwIfAborted();
|
|
387
|
-
|
|
388
|
-
|
|
393
|
+
for (const adapter of options.adapters) {
|
|
394
|
+
executor.register(adapter);
|
|
395
|
+
logging.kernel("info", "adapter.registered", { adapter_type: adapter.metadata.type });
|
|
396
|
+
}
|
|
397
|
+
startupContext = {
|
|
398
|
+
resource: "ipc-endpoint",
|
|
399
|
+
endpoint: options.endpoint,
|
|
400
|
+
operation: "acquire-endpoint"
|
|
401
|
+
};
|
|
389
402
|
signal?.throwIfAborted();
|
|
390
403
|
releaseEndpoint = await acquireEndpoint(options.endpoint);
|
|
391
404
|
signal?.throwIfAborted();
|
|
@@ -394,9 +407,13 @@ export async function startKernelServer(options, signal) {
|
|
|
394
407
|
: process.platform !== "win32"
|
|
395
408
|
? `${options.endpoint}.runs`
|
|
396
409
|
: undefined;
|
|
397
|
-
if (statePath)
|
|
410
|
+
if (statePath) {
|
|
411
|
+
startupContext = { resource: "kernel-state", path: statePath, operation: "open-manifest" };
|
|
398
412
|
manifest = (await InvocationManifest.open(statePath)).manifest;
|
|
413
|
+
await manifest.markNativeOwner();
|
|
414
|
+
}
|
|
399
415
|
signal?.throwIfAborted();
|
|
416
|
+
startupContext = { resource: "ipc-endpoint", endpoint: options.endpoint, operation: "listen" };
|
|
400
417
|
await new Promise((resolve, reject) => {
|
|
401
418
|
server.once("error", reject);
|
|
402
419
|
server.listen(options.endpoint, () => {
|
|
@@ -408,10 +425,23 @@ export async function startKernelServer(options, signal) {
|
|
|
408
425
|
if (process.platform !== "win32")
|
|
409
426
|
await chmod(options.endpoint, 0o600);
|
|
410
427
|
signal?.throwIfAborted();
|
|
411
|
-
|
|
412
|
-
|
|
428
|
+
ready = true;
|
|
429
|
+
logging.kernel("info", "kernel.ready", { pid: process.pid });
|
|
413
430
|
}
|
|
414
|
-
catch (
|
|
431
|
+
catch (cause) {
|
|
432
|
+
const io = cause;
|
|
433
|
+
const error = startupContext.resource &&
|
|
434
|
+
["ipc-endpoint", "kernel-state"].includes(startupContext.resource) &&
|
|
435
|
+
["ENOENT", "ENOTDIR", "EACCES", "EPERM", "EROFS", "ENAMETOOLONG"].includes(io?.code ?? "")
|
|
436
|
+
? runtimePathFailure(cause, typeof io.path === "string" ? io.path : (startupContext.path ?? options.endpoint), startupContext.resource, typeof io.syscall === "string" ? io.syscall : "listen")
|
|
437
|
+
: cause;
|
|
438
|
+
// 附加已确认的启动步骤,不改变原错误类型、公共码或底层 cause。
|
|
439
|
+
withStartupContext(error, {
|
|
440
|
+
component: "executor-kernel",
|
|
441
|
+
phase: "initializing",
|
|
442
|
+
context: startupContext
|
|
443
|
+
});
|
|
444
|
+
logging.kernel("error", "kernel.start_failed", { code: safeCode(error) });
|
|
415
445
|
try {
|
|
416
446
|
await teardown();
|
|
417
447
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { type KernelServerOptions } from "./server.js";
|
|
2
2
|
import type { KernelClient, KernelStatus } from "./types.js";
|
|
3
3
|
import { type ServiceLifecycle, type ServicePhase } from "./lifecycle.js";
|
|
4
|
-
export
|
|
4
|
+
export interface KernelServiceOptions extends KernelServerOptions {
|
|
5
|
+
/** 宿主选择并预先准备的绝对目录;SDK 不选择默认 Home 或创建根。 */
|
|
6
|
+
home: string;
|
|
7
|
+
}
|
|
5
8
|
export interface KernelServiceStatus {
|
|
6
9
|
phase: ServicePhase;
|
|
7
10
|
endpoint: string;
|
|
@@ -11,5 +14,9 @@ export interface KernelServiceStatus {
|
|
|
11
14
|
export interface KernelService extends ServiceLifecycle<KernelServiceStatus> {
|
|
12
15
|
readonly client: KernelClient;
|
|
13
16
|
}
|
|
14
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* 宿主传入已存在的 Home、本地 RPC 地址和已装配的 Adapter;initialize 校验后启动并开放 client。
|
|
19
|
+
* socket、Core 和本服务创建的日志由 close 回收;宿主依赖仍由宿主拥有。
|
|
20
|
+
* 即使与调用方同进程,client 也始终通过 RPC,不能绕过 Run 接纳和观察管理。
|
|
21
|
+
*/
|
|
15
22
|
export declare function createKernelService(options: KernelServiceOptions): KernelService;
|
|
@@ -1,13 +1,40 @@
|
|
|
1
|
+
import { assertStartupLogging } from "./startup-logging.js";
|
|
1
2
|
import { attachKernel } from "./client.js";
|
|
3
|
+
import { dirname } from "node:path";
|
|
4
|
+
import { assertIpcEndpoint, kernelStartupPaths, validateRuntimeHome, prepareHomeDirectory } from "./runtime-home.js";
|
|
5
|
+
import { describeStartupError } from "./startup-diagnostics.js";
|
|
2
6
|
import { startKernelServer } from "./server.js";
|
|
3
7
|
import { beforeDeadline, ServiceInitializationError } from "./lifecycle.js";
|
|
4
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* 宿主传入已存在的 Home、本地 RPC 地址和已装配的 Adapter;initialize 校验后启动并开放 client。
|
|
10
|
+
* socket、Core 和本服务创建的日志由 close 回收;宿主依赖仍由宿主拥有。
|
|
11
|
+
* 即使与调用方同进程,client 也始终通过 RPC,不能绕过 Run 接纳和观察管理。
|
|
12
|
+
*/
|
|
5
13
|
export function createKernelService(options) {
|
|
14
|
+
const invalid = (message, configKey) => {
|
|
15
|
+
const error = new TypeError(message);
|
|
16
|
+
Object.defineProperty(error, "diagnostic", {
|
|
17
|
+
value: describeStartupError({ code: "KERNEL_CONFIGURATION_INVALID" }, {
|
|
18
|
+
component: "executor-kernel",
|
|
19
|
+
phase: "created",
|
|
20
|
+
context: { configKey, operation: "validate-options" }
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
return error;
|
|
24
|
+
};
|
|
25
|
+
if (!options ||
|
|
26
|
+
typeof options.endpoint !== "string" ||
|
|
27
|
+
!options.endpoint ||
|
|
28
|
+
!Array.isArray(options.adapters))
|
|
29
|
+
throw invalid("Kernel requires endpoint and adapters", "endpoint/adapters");
|
|
30
|
+
// 旧 JS 接入不能静默退回文件加载或忽略 worker 环境;模块装配完全归宿主。
|
|
31
|
+
for (const field of ["workerEntrypoint", "manifest", "adapterModules", "env"])
|
|
32
|
+
if (field in options)
|
|
33
|
+
throw invalid(`Kernel does not accept ${field}; compose adapters in the host`, field);
|
|
6
34
|
const configuration = {
|
|
7
35
|
...options,
|
|
8
|
-
|
|
36
|
+
adapters: [...options.adapters],
|
|
9
37
|
adapterConfigurations: options.adapterConfigurations && structuredClone(options.adapterConfigurations),
|
|
10
|
-
env: options.env && { ...options.env },
|
|
11
38
|
logging: options.logging && { ...options.logging }
|
|
12
39
|
};
|
|
13
40
|
const owner = new AbortController();
|
|
@@ -75,7 +102,22 @@ export function createKernelService(options) {
|
|
|
75
102
|
onAbort();
|
|
76
103
|
});
|
|
77
104
|
// 原 server 负责部分启动的回滚;初始化失败后仍保留其清理事实。
|
|
78
|
-
starting =
|
|
105
|
+
starting = Promise.resolve()
|
|
106
|
+
.then(async () => {
|
|
107
|
+
combined.throwIfAborted();
|
|
108
|
+
assertStartupLogging(configuration.logging, {
|
|
109
|
+
component: "executor-kernel",
|
|
110
|
+
phase: "initializing"
|
|
111
|
+
});
|
|
112
|
+
const home = validateRuntimeHome(configuration.home, kernelStartupPaths(configuration.endpoint, configuration.stateDirectory, configuration.logging?.directory));
|
|
113
|
+
assertIpcEndpoint(configuration.endpoint);
|
|
114
|
+
if (process.platform !== "win32") {
|
|
115
|
+
// 只为 Home 内的端点准备内部目录;自选外部 endpoint 的父目录由高级宿主准备。
|
|
116
|
+
// helper 按完整 .. 路径分量判断边界,合法的 ..hidden 子目录仍属于 Home。
|
|
117
|
+
prepareHomeDirectory(home, dirname(configuration.endpoint));
|
|
118
|
+
}
|
|
119
|
+
return startKernelServer(configuration, combined);
|
|
120
|
+
})
|
|
79
121
|
.then((value) => {
|
|
80
122
|
server = value;
|
|
81
123
|
combined.throwIfAborted();
|
|
@@ -90,7 +132,20 @@ export function createKernelService(options) {
|
|
|
90
132
|
});
|
|
91
133
|
initialized = Promise.race([starting, cancelled])
|
|
92
134
|
.catch(async (error) => {
|
|
93
|
-
|
|
135
|
+
const cleanup = await close();
|
|
136
|
+
// 取消可能先赢得 race,而实际启动回滚随后失败;等待 close 后再合并已确认的错误。
|
|
137
|
+
// 保留最初取消原因和 server 的完整清理链,不把 incomplete 简化成只有取消原因。
|
|
138
|
+
// 截止时仍未结束的回滚继续由 starting 观察,不改写已经返回的清理结果。
|
|
139
|
+
const cause = startupFailure instanceof AggregateError && startupFailure !== error
|
|
140
|
+
? new AggregateError([error, startupFailure], "KERNEL_START_CLEANUP_INCOMPLETE", {
|
|
141
|
+
cause: error
|
|
142
|
+
})
|
|
143
|
+
: error;
|
|
144
|
+
throw new ServiceInitializationError(cause, cleanup, {
|
|
145
|
+
component: "executor-kernel",
|
|
146
|
+
phase: "initializing",
|
|
147
|
+
context: { endpoint: configuration.endpoint }
|
|
148
|
+
});
|
|
94
149
|
})
|
|
95
150
|
.finally(() => combined.removeEventListener("abort", onAbort));
|
|
96
151
|
return initialized;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { STARTUP_CATALOG, type StartupCatalogEntry } from "@mininglamp-oss/octo-runtime-client/internal";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { STARTUP_CATALOG } from "@mininglamp-oss/octo-runtime-client/internal";
|
package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/startup-diagnostics.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { STARTUP_CATALOG, StartupError, describeStartupError, formatStartupDiagnostic, restoreStartupDiagnostic, safeStartupValue, startupPathDiagnostic, withStartupContext, type StartupCatalogEntry, type StartupCause, type StartupContext, type StartupDiagnostic, type StartupLocation, type StartupPathDiagnostic } from "@mininglamp-oss/octo-runtime-client/internal";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { STARTUP_CATALOG, StartupError, describeStartupError, formatStartupDiagnostic, restoreStartupDiagnostic, safeStartupValue, startupPathDiagnostic, withStartupContext } from "@mininglamp-oss/octo-runtime-client/internal";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type RuntimeLoggingOptions } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
|
+
import { type StartupLocation } from "./startup-diagnostics.js";
|
|
3
|
+
/** 先验证纯配置再启动资源;各宿主保留原错误类型及调用阶段。 */
|
|
4
|
+
export declare function assertStartupLogging(logging: RuntimeLoggingOptions | undefined, location: StartupLocation): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { assertRuntimeLogging } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
2
|
+
import { withStartupContext } from "./startup-diagnostics.js";
|
|
3
|
+
/** 先验证纯配置再启动资源;各宿主保留原错误类型及调用阶段。 */
|
|
4
|
+
export function assertStartupLogging(logging, location) {
|
|
5
|
+
try {
|
|
6
|
+
assertRuntimeLogging(logging);
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
throw withStartupContext(error, {
|
|
10
|
+
...location,
|
|
11
|
+
context: {
|
|
12
|
+
resource: "logging",
|
|
13
|
+
operation: "validate-logging",
|
|
14
|
+
...(typeof logging?.directory === "string" ? { path: logging.directory } : {})
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.d.ts
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/** 包内接纳检查专用;当前 client 在请求写出前拒绝时创建证据。 */
|
|
3
|
-
export declare function admissionClosedError(): KernelError;
|
|
4
|
-
/** 仅实际 invoke RPC 的拒绝响应、且实例和专用证据均匹配,才标记未进入执行源。 */
|
|
5
|
-
export declare function markSubmissionRejected(error: unknown, instance: string): void;
|
|
6
|
-
/**
|
|
7
|
-
* 判断本模块验证的未执行拒绝;包装、序列化及同名错误均返回 false。
|
|
8
|
-
* 只证明本次未进入执行源,不证明此前业务尝试没有执行,也不授权自动重放。
|
|
9
|
-
*/
|
|
10
|
-
export declare function isInvocationNotSubmitted(error: unknown): boolean;
|
|
1
|
+
export { admissionClosedError, markSubmissionRejected, isInvocationNotSubmitted } from "@mininglamp-oss/octo-runtime-client/internal";
|
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/** 包内接纳检查专用;当前 client 在请求写出前拒绝时创建证据。 */
|
|
4
|
-
export function admissionClosedError() {
|
|
5
|
-
const error = new KernelError("CLIENT_INVOCATION_ADMISSION_CLOSED");
|
|
6
|
-
notSubmitted.add(error);
|
|
7
|
-
return error;
|
|
8
|
-
}
|
|
9
|
-
/** 仅实际 invoke RPC 的拒绝响应、且实例和专用证据均匹配,才标记未进入执行源。 */
|
|
10
|
-
export function markSubmissionRejected(error, instance) {
|
|
11
|
-
if (error instanceof KernelError &&
|
|
12
|
-
["KERNEL_UNAVAILABLE", "WORKER_RESTART_EXHAUSTED"].includes(error.code) &&
|
|
13
|
-
error.data?.invocation_not_submitted === true &&
|
|
14
|
-
error.data.kernel_instance_id === instance)
|
|
15
|
-
notSubmitted.add(error);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* 判断本模块验证的未执行拒绝;包装、序列化及同名错误均返回 false。
|
|
19
|
-
* 只证明本次未进入执行源,不证明此前业务尝试没有执行,也不授权自动重放。
|
|
20
|
-
*/
|
|
21
|
-
export function isInvocationNotSubmitted(error) {
|
|
22
|
-
return error instanceof KernelError && notSubmitted.has(error);
|
|
23
|
-
}
|
|
1
|
+
// 兼容旧入口;客户端状态、错误身份和恢复实现由独立包统一持有。
|
|
2
|
+
export { admissionClosedError, markSubmissionRejected, isInvocationNotSubmitted } from "@mininglamp-oss/octo-runtime-client/internal";
|
|
@@ -1,72 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type LookupKey = KernelLookupKey;
|
|
4
|
-
export type RunRef = KernelRunRef;
|
|
5
|
-
export type RunSnapshot = KernelRunSnapshot;
|
|
6
|
-
export type { KernelStatus };
|
|
7
|
-
export interface KernelInvocationRecord {
|
|
8
|
-
readonly key: LookupKey;
|
|
9
|
-
readonly ref?: RunRef;
|
|
10
|
-
readonly phase: "admitting" | "accepted" | "acceptance_unknown" | "unobserved";
|
|
11
|
-
readonly cancellation: "none" | "requested" | "acknowledged" | "unknown";
|
|
12
|
-
readonly lastSeq: number;
|
|
13
|
-
readonly observationError?: string;
|
|
14
|
-
}
|
|
15
|
-
/** 只确认本 client 登记的执行是否排空;不代表卡片投递或业务 dispose 已完成。 */
|
|
16
|
-
export interface KernelInvocationDrainResult {
|
|
17
|
-
readonly complete: boolean;
|
|
18
|
-
readonly unresolved: readonly KernelInvocationRecord[];
|
|
19
|
-
}
|
|
20
|
-
export interface KernelInvocationLifecycle {
|
|
21
|
-
/** 身份与观察状态的副本,不缓存消息正文;结果未知的执行仍保留在列表中。 */
|
|
22
|
-
snapshot(): readonly KernelInvocationRecord[];
|
|
23
|
-
/** 同步关闭 invoke 接纳;已有执行仍可取消、查询和消费尾流。 */
|
|
24
|
-
stopAdmission(): void;
|
|
25
|
-
/** 共享 Date.now() 毫秒绝对期限;首次调用确定预算,后续调用复用同一排空结果。 */
|
|
26
|
-
drain(options: {
|
|
27
|
-
deadline: number;
|
|
28
|
-
reason: string;
|
|
29
|
-
}): Promise<KernelInvocationDrainResult>;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* 附着到独立 Kernel 的客户端,不拥有 Kernel 进程。
|
|
33
|
-
* 常规接入使用 invoke;owner 退出时先 stopAdmission,再并行 drain 与业务收尾,最后 close。
|
|
34
|
-
* submit/subscribe 是低层入口,调用方自行保存 RunRef、管理取消与尾流,不自动登记为 invoke。
|
|
35
|
-
*/
|
|
36
|
-
export interface KernelClient {
|
|
37
|
-
readonly topology: "kernel-ipc";
|
|
38
|
-
readonly ownership: "attached";
|
|
39
|
-
/** 开始消费才提交;signal 请求取消但保留尾流,提前结束迭代则仅停止观察。 */
|
|
40
|
-
readonly invoke: InputInvoke;
|
|
41
|
-
readonly invocations: KernelInvocationLifecycle;
|
|
42
|
-
/** 仅操作当前 client 的 invoke 登记;accepted 是取消受理,不是终态或清理完成。 */
|
|
43
|
-
cancelInvocation(invocationId: string, reason?: string): Promise<{
|
|
44
|
-
accepted: boolean;
|
|
45
|
-
}>;
|
|
46
|
-
respondInteraction(invocationId: string, response: InteractionResponse): Promise<void>;
|
|
47
|
-
respondNativeInteraction(invocationId: string, response: NativeInteractionResponse): Promise<void>;
|
|
48
|
-
status(): Promise<KernelStatus>;
|
|
49
|
-
list(): Promise<HostedAdapterMetadata[]>;
|
|
50
|
-
/** 接纳后由 Kernel 持续驱动执行;ACK 丢失只查原身份,不重复执行。 */
|
|
51
|
-
submit(input: InvokeInput, environment?: InvokeEnvironment): Promise<{
|
|
52
|
-
ref: RunRef;
|
|
53
|
-
}>;
|
|
54
|
-
/** 按完整 LookupKey 查询原执行;指定 expectedInstance 可拒绝服务重启后的同名身份。 */
|
|
55
|
-
get(key: LookupKey, expectedInstance?: string): Promise<RunSnapshot>;
|
|
56
|
-
/** 从 afterSeq 之后观察同一执行;signal 只关闭订阅,游标过期/身份变化须交给调用方处理。 */
|
|
57
|
-
subscribe(ref: RunRef, afterSeq?: number, signal?: AbortSignal): AsyncGenerator<HostFrame>;
|
|
58
|
-
/** 显式控制原 RunRef;ACK 丢失报结果未知,不能自动重试可能已受理的控制动作。 */
|
|
59
|
-
cancel(ref: RunRef, reason?: string): Promise<{
|
|
60
|
-
accepted: boolean;
|
|
61
|
-
}>;
|
|
62
|
-
/** 交互响应必须匹配原引用和协议模式,过期/未知的响应不能改投其他 Run。 */
|
|
63
|
-
respond(ref: RunRef, response: InteractionResponse): Promise<void>;
|
|
64
|
-
respondNative(ref: RunRef, response: NativeInteractionResponse): Promise<void>;
|
|
65
|
-
/** 释放本 client 的连接和控制请求,不取消已接纳 Run,也不关闭共享 Kernel。 */
|
|
66
|
-
close(): void;
|
|
67
|
-
}
|
|
68
|
-
export declare class KernelError extends Error {
|
|
69
|
-
readonly code: string;
|
|
70
|
-
readonly data?: Record<string, unknown> | undefined;
|
|
71
|
-
constructor(code: string, data?: Record<string, unknown> | undefined);
|
|
72
|
-
}
|
|
1
|
+
export { KernelError } from "@mininglamp-oss/octo-runtime-client";
|
|
2
|
+
export type { LookupKey, RunRef, RunSnapshot, KernelStatus, KernelClient, KernelInvocationRecord, KernelInvocationDrainResult, KernelInvocationLifecycle } from "@mininglamp-oss/octo-runtime-client";
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
data;
|
|
4
|
-
constructor(code, data) {
|
|
5
|
-
super(code);
|
|
6
|
-
this.code = code;
|
|
7
|
-
this.data = data;
|
|
8
|
-
this.name = "KernelError";
|
|
9
|
-
}
|
|
10
|
-
}
|
|
1
|
+
// 兼容旧入口;客户端状态、错误身份和恢复实现由独立包统一持有。
|
|
2
|
+
export { KernelError } from "@mininglamp-oss/octo-runtime-client";
|
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-executor-kernel",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"import": "./dist/index.js"
|
|
10
|
-
},
|
|
11
|
-
"./manifest-adapters": {
|
|
12
|
-
"types": "./dist/manifest-adapters.d.ts",
|
|
13
|
-
"import": "./dist/manifest-adapters.js"
|
|
14
|
-
},
|
|
15
|
-
"./runner": {
|
|
16
|
-
"types": "./dist/runner.d.ts",
|
|
17
|
-
"import": "./dist/runner.js"
|
|
18
10
|
}
|
|
19
11
|
},
|
|
20
12
|
"dependencies": {
|
|
21
|
-
"@mininglamp-oss/octo-runtime-
|
|
22
|
-
"@mininglamp-oss/octo-runtime-
|
|
23
|
-
"@mininglamp-oss/octo-runtime-
|
|
13
|
+
"@mininglamp-oss/octo-runtime-client": "1.1.11",
|
|
14
|
+
"@mininglamp-oss/octo-runtime-executor-core": "1.1.11",
|
|
15
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.11",
|
|
16
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.11"
|
|
24
17
|
},
|
|
25
18
|
"types": "./dist/index.d.ts",
|
|
26
19
|
"files": [
|
|
@@ -28,7 +28,7 @@ async function initialize(context, config, dependencies) {
|
|
|
28
28
|
}
|
|
29
29
|
const allowed = spaces;
|
|
30
30
|
channels = new ImChannelManager({
|
|
31
|
-
kernel: context.
|
|
31
|
+
kernel: context.execution,
|
|
32
32
|
signal: context.signal,
|
|
33
33
|
log: context.log,
|
|
34
34
|
createSessionStore: dependencies.createSessionStore,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 宿主依赖入口:注入执行能力、凭据来源和脱敏诊断。
|
|
3
3
|
* SDK 应用自行决定账号目录和凭据生命周期,通道无需依赖 CLI 或具体 Provider。
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { ExtraExecutionContext } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
6
6
|
import type { ImBotConfig } from "./contracts.js";
|
|
7
7
|
import type { ImSessionStore } from "./application/session-store.js";
|
|
8
8
|
import type { RuntimeLog, JsonObject, ChannelDependencies } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
@@ -21,7 +21,7 @@ export interface ImChannelManagerDependencies extends ImModuleDependencies {
|
|
|
21
21
|
export interface ImModuleDependencies {
|
|
22
22
|
prepareContexts?: (config: JsonObject, signal: AbortSignal) => Promise<ContextItem[]>;
|
|
23
23
|
log?: RuntimeLog;
|
|
24
|
-
kernel: Pick<
|
|
24
|
+
kernel: Pick<ExtraExecutionContext, "invoke" | "cancelInvocation" | "respondInteraction">;
|
|
25
25
|
/** Owning Extra/manager lifetime; aborts connections, execution and delivery. */
|
|
26
26
|
signal?: AbortSignal;
|
|
27
27
|
authorizeSpace?: (spaceId: string) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-extra-channel-gateway",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"docs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.
|
|
26
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
27
|
-
"@mininglamp-oss/octo-runtime-executor-core": "1.1.
|
|
28
|
-
"@mininglamp-oss/octo-runtime-host-sdk": "1.1.
|
|
29
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
25
|
+
"@mininglamp-oss/octo-runtime-executor-kernel": "1.1.11",
|
|
26
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.11",
|
|
27
|
+
"@mininglamp-oss/octo-runtime-executor-core": "1.1.11",
|
|
28
|
+
"@mininglamp-oss/octo-runtime-host-sdk": "1.1.11",
|
|
29
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.11",
|
|
30
30
|
"mdast-util-from-markdown": "2.1.0",
|
|
31
31
|
"ws": "8.22.0"
|
|
32
32
|
}
|
|
@@ -27,7 +27,7 @@ async function initialize(context, config, dependencies) {
|
|
|
27
27
|
}
|
|
28
28
|
const allowed = spaces;
|
|
29
29
|
channels = new ImChannelManager({
|
|
30
|
-
kernel: context.
|
|
30
|
+
kernel: context.execution,
|
|
31
31
|
signal: context.signal,
|
|
32
32
|
log: context.log,
|
|
33
33
|
// 与 Gateway 共用逐轮合同:宿主数据可变,连接与 manager 仍由 Extra 整体封装。
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 宿主依赖入口:注入执行能力、凭据来源和脱敏诊断。
|
|
3
3
|
* SDK 应用自行决定账号目录和凭据生命周期,通道无需依赖 CLI 或具体 Provider。
|
|
4
4
|
*/
|
|
5
|
-
import type {
|
|
5
|
+
import type { ExtraExecutionContext } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
6
6
|
import type { ImBotConfig } from "./contracts.js";
|
|
7
7
|
import type { ImSessionStore } from "./application/session-store.js";
|
|
8
8
|
import type { RuntimeLog, JsonObject } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
@@ -11,7 +11,7 @@ export type ImCredentialSource = (config: ImBotConfig, signal: AbortSignal) => P
|
|
|
11
11
|
export interface ImModuleDependencies {
|
|
12
12
|
prepareContexts?: (config: JsonObject, signal: AbortSignal) => Promise<ContextItem[]>;
|
|
13
13
|
log?: RuntimeLog;
|
|
14
|
-
kernel: Pick<
|
|
14
|
+
kernel: Pick<ExtraExecutionContext, "invoke" | "cancelInvocation" | "respondInteraction">;
|
|
15
15
|
/** Owning Extra/manager lifetime; aborts connections, execution and delivery. */
|
|
16
16
|
signal?: AbortSignal;
|
|
17
17
|
authorizeSpace?: (spaceId: string) => void;
|