@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,96 +0,0 @@
|
|
|
1
|
-
import { AgentExecutor } from "@mininglamp-oss/octo-runtime-executor-core";
|
|
2
|
-
import { WorkerRpcServer } from "./rpc.js";
|
|
3
|
-
import { RuntimeLogging } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
4
|
-
/**
|
|
5
|
-
* 在当前独立 worker 子进程中提供 Core 执行服务。调用方已经决定加载集合:
|
|
6
|
-
* CLI 可从自己的 JSON 动态加载,SDK 可直接 import;这里不扫描或补齐任何 Adapter。
|
|
7
|
-
* 该函数只在 worker 入口调用;宿主 App 和 Kernel 监督进程通过客户端接入,不直接调用。
|
|
8
|
-
*/
|
|
9
|
-
export function serveWorker(adapters, options = {}) {
|
|
10
|
-
const logging = new RuntimeLogging(options.logging ??
|
|
11
|
-
(process.env.OCTO_RUNTIME_LOGS_DIRECTORY
|
|
12
|
-
? { directory: process.env.OCTO_RUNTIME_LOGS_DIRECTORY }
|
|
13
|
-
: undefined));
|
|
14
|
-
process.on("uncaughtExceptionMonitor", () => logging.kernel("error", "host.uncaught", { code: "HOST_UNCAUGHT_EXCEPTION" }));
|
|
15
|
-
const host = new AgentExecutor({ log: logging.kernel });
|
|
16
|
-
for (const adapter of adapters) {
|
|
17
|
-
// 注册阶段保留协议校验和重复类型检查,失败时不建立就绪的 RPC 服务。
|
|
18
|
-
host.register(adapter);
|
|
19
|
-
logging.kernel("info", "adapter.registered", { adapter_type: adapter.metadata.type });
|
|
20
|
-
}
|
|
21
|
-
// 仅服务已注册集合;Kernel 监督器通过首次 list 握手确认 worker 就绪。
|
|
22
|
-
// 注册不代表 Provider 已安装或认证,实际可用性由 probe 和调用结果说明。
|
|
23
|
-
new WorkerRpcServer({
|
|
24
|
-
host,
|
|
25
|
-
output: process.stdout,
|
|
26
|
-
log: logging.kernel
|
|
27
|
-
}).listen(process.stdin);
|
|
28
|
-
logging.kernel("info", "host.ready");
|
|
29
|
-
// 父 Kernel 断开或停止时等待 Core 取消和清理;需要替换时由 Kernel 监督器重启相同入口。
|
|
30
|
-
let stopping = false;
|
|
31
|
-
let drainedExitCode;
|
|
32
|
-
const stop = (holdForParent = false) => {
|
|
33
|
-
if (stopping)
|
|
34
|
-
return;
|
|
35
|
-
stopping = true;
|
|
36
|
-
// Let the launcher reserve the full bounded drain only for a worker that handles EOF.
|
|
37
|
-
if (holdForParent && process.connected)
|
|
38
|
-
process.send?.({ type: "worker.stopping" }, () => { });
|
|
39
|
-
const finish = async (code) => {
|
|
40
|
-
await logging.close();
|
|
41
|
-
drainedExitCode = code;
|
|
42
|
-
if (holdForParent && process.connected) {
|
|
43
|
-
// Windows 的树清理需要 leader 仍存活。通知只表示排空完成,不代表后代已回收。
|
|
44
|
-
// IPC 保持引用直到 launcher 执行 taskkill;owner 断连仍走下方既有退出收尾。
|
|
45
|
-
process.channel?.ref();
|
|
46
|
-
process.send?.({ type: "worker.drained", cleanup: code === 0 ? "complete" : "incomplete" }, (error) => {
|
|
47
|
-
if (error)
|
|
48
|
-
process.exit(code || 1);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
else
|
|
52
|
-
process.exit(code);
|
|
53
|
-
};
|
|
54
|
-
void host.shutdown().then(async (result) => {
|
|
55
|
-
if (result.cleanup === "incomplete") {
|
|
56
|
-
logging.kernel("error", "host.cleanup_incomplete", {
|
|
57
|
-
code: "EXECUTOR_CLEANUP_INCOMPLETE",
|
|
58
|
-
unresolved_count: result.unresolvedInvocationIds.length
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
await finish(result.cleanup === "complete" ? 0 : 1);
|
|
62
|
-
}, async () => {
|
|
63
|
-
await finish(1);
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
const onSignal = () => {
|
|
67
|
-
// Windows 控制台事件也会送达 worker;父 Kernel 须先经 RPC 取消并消费终态,再以 EOF 关闭。
|
|
68
|
-
// 抢先退出会丢失终态及树回收所需的 leader。父 IPC 已断开或独立运行时仍自行收尾。
|
|
69
|
-
if (process.platform !== "win32" || !process.connected)
|
|
70
|
-
stop();
|
|
71
|
-
};
|
|
72
|
-
// 保持监听到父进程关闭,避免重复控制台事件恢复默认的立即退出行为。
|
|
73
|
-
process.on("SIGINT", onSignal);
|
|
74
|
-
process.on("SIGTERM", onSignal);
|
|
75
|
-
process.once("SIGHUP", () => stop());
|
|
76
|
-
process.stdin.once("end", () => stop(process.platform === "win32"));
|
|
77
|
-
process.stdin.once("close", () => stop(process.platform === "win32"));
|
|
78
|
-
// 心跳必须由执行进程主事件循环处理;独立线程应答会掩盖执行线程阻塞。
|
|
79
|
-
process.on("message", (message) => {
|
|
80
|
-
if (message &&
|
|
81
|
-
typeof message === "object" &&
|
|
82
|
-
"type" in message &&
|
|
83
|
-
message.type === "kernel.ping" &&
|
|
84
|
-
"probe" in message &&
|
|
85
|
-
Number.isSafeInteger(message.probe) &&
|
|
86
|
-
process.connected) {
|
|
87
|
-
process.send?.({ type: "worker.pong", probe: message.probe });
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
process.once("disconnect", () => {
|
|
91
|
-
if (drainedExitCode !== undefined)
|
|
92
|
-
process.exit(drainedExitCode);
|
|
93
|
-
else
|
|
94
|
-
stop();
|
|
95
|
-
});
|
|
96
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type SpawnWorkerOptions } from "./process.js";
|
|
2
|
-
import { type RuntimeLog } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
3
|
-
import type { KernelStatus } from "./types.js";
|
|
4
|
-
/** 监督所属 worker;清理阻塞持续重试,只恢复新请求,不重新执行已丢失的 Run。 */
|
|
5
|
-
export declare class WorkerSupervisor {
|
|
6
|
-
#private;
|
|
7
|
-
private readonly options;
|
|
8
|
-
private readonly recordWorker?;
|
|
9
|
-
private readonly log;
|
|
10
|
-
constructor(options: SpawnWorkerOptions, recordWorker?: ((pid: number | undefined) => Promise<void>) | undefined, log?: RuntimeLog);
|
|
11
|
-
get status(): KernelStatus["worker"];
|
|
12
|
-
get client(): import("./rpc.js").WorkerRpcClient;
|
|
13
|
-
start(signal?: AbortSignal): Promise<void>;
|
|
14
|
-
close(until?: number): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import { closeWorker, spawnWorker, WorkerCleanupError } from "./process.js";
|
|
2
|
-
import { noopRuntimeLog } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
3
|
-
import { KernelError } from "./types.js";
|
|
4
|
-
import { WorkerHeartbeat } from "./heartbeat.js";
|
|
5
|
-
/** 监督所属 worker;清理阻塞持续重试,只恢复新请求,不重新执行已丢失的 Run。 */
|
|
6
|
-
export class WorkerSupervisor {
|
|
7
|
-
options;
|
|
8
|
-
recordWorker;
|
|
9
|
-
log;
|
|
10
|
-
#worker;
|
|
11
|
-
#generation = 0;
|
|
12
|
-
#attempt = 0;
|
|
13
|
-
#state = "starting";
|
|
14
|
-
#closing = false;
|
|
15
|
-
#recovery;
|
|
16
|
-
#timer;
|
|
17
|
-
#heartbeat;
|
|
18
|
-
#activeTime = 0;
|
|
19
|
-
#attempts = [];
|
|
20
|
-
#slowRecovery = false;
|
|
21
|
-
#abort = new AbortController();
|
|
22
|
-
#cleanupFailure;
|
|
23
|
-
#closeUntil;
|
|
24
|
-
#diagnostic;
|
|
25
|
-
constructor(options, recordWorker, log = noopRuntimeLog) {
|
|
26
|
-
this.options = options;
|
|
27
|
-
this.recordWorker = recordWorker;
|
|
28
|
-
this.log = log;
|
|
29
|
-
}
|
|
30
|
-
get status() {
|
|
31
|
-
return {
|
|
32
|
-
pid: this.#worker?.child.pid,
|
|
33
|
-
generation: this.#generation,
|
|
34
|
-
state: this.#state,
|
|
35
|
-
restart_attempt: this.#attempt,
|
|
36
|
-
...(this.#diagnostic ? { recovery: { ...this.#diagnostic } } : {})
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
get client() {
|
|
40
|
-
if (this.#state !== "ready" || !this.#worker)
|
|
41
|
-
throw new KernelError("KERNEL_UNAVAILABLE");
|
|
42
|
-
return this.#worker.client;
|
|
43
|
-
}
|
|
44
|
-
async start(signal) {
|
|
45
|
-
signal?.throwIfAborted();
|
|
46
|
-
const abort = () => this.#abort.abort();
|
|
47
|
-
signal?.addEventListener("abort", abort, { once: true });
|
|
48
|
-
try {
|
|
49
|
-
await this.#spawn();
|
|
50
|
-
signal?.throwIfAborted();
|
|
51
|
-
}
|
|
52
|
-
finally {
|
|
53
|
-
signal?.removeEventListener("abort", abort);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
#emit(event, data = {}) {
|
|
57
|
-
// 宿主日志异常不得终止监督循环,错误正文和 worker stderr 不进入状态日志。
|
|
58
|
-
try {
|
|
59
|
-
this.log(event === "worker.ready" ? "info" : "warn", event, {
|
|
60
|
-
pid: this.#worker?.child.pid,
|
|
61
|
-
generation: this.#generation,
|
|
62
|
-
attempt: this.#attempt,
|
|
63
|
-
...data
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
/* 日志不是恢复前置条件。 */
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
async #spawn() {
|
|
71
|
-
let worker;
|
|
72
|
-
try {
|
|
73
|
-
worker = await spawnWorker({
|
|
74
|
-
...this.options,
|
|
75
|
-
signal: this.#abort.signal,
|
|
76
|
-
onSpawn: async (child) => {
|
|
77
|
-
await this.recordWorker?.(child.pid);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
if (error instanceof WorkerCleanupError)
|
|
83
|
-
this.#cleanupFailure = error;
|
|
84
|
-
throw error;
|
|
85
|
-
}
|
|
86
|
-
if (this.#closing) {
|
|
87
|
-
try {
|
|
88
|
-
await closeWorker(worker, this.#closeUntil ?? Date.now() + 5000, true);
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
throw (this.#cleanupFailure = new AggregateError([error], "WORKER_CLEANUP_INCOMPLETE"));
|
|
92
|
-
}
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
this.#worker = worker;
|
|
96
|
-
this.#generation++;
|
|
97
|
-
this.#state = "ready";
|
|
98
|
-
this.#diagnostic = undefined;
|
|
99
|
-
this.#emit("worker.ready");
|
|
100
|
-
const heartbeat = new WorkerHeartbeat();
|
|
101
|
-
this.#heartbeat = heartbeat;
|
|
102
|
-
let elapsed = 0;
|
|
103
|
-
worker.child.on("message", (message) => {
|
|
104
|
-
if (this.#worker === worker &&
|
|
105
|
-
message &&
|
|
106
|
-
typeof message === "object" &&
|
|
107
|
-
"type" in message &&
|
|
108
|
-
message.type === "worker.pong")
|
|
109
|
-
heartbeat.pong("probe" in message ? message.probe : undefined);
|
|
110
|
-
});
|
|
111
|
-
worker.child.once("exit", () => this.#failed(worker, "exit"));
|
|
112
|
-
worker.child.once("error", () => this.#failed(worker, "error"));
|
|
113
|
-
this.#timer = setInterval(() => {
|
|
114
|
-
if (this.#closing || this.#worker !== worker || this.#state !== "ready")
|
|
115
|
-
return;
|
|
116
|
-
const probe = heartbeat.tick();
|
|
117
|
-
this.#activeTime += heartbeat.activeMs - elapsed;
|
|
118
|
-
elapsed = heartbeat.activeMs;
|
|
119
|
-
if (probe.type === "expired") {
|
|
120
|
-
this.#failed(worker, "heartbeat");
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (probe.type === "ping" && worker.child.connected)
|
|
124
|
-
worker.child.send({ type: "kernel.ping", probe: probe.id }, (error) => {
|
|
125
|
-
if (error)
|
|
126
|
-
this.#failed(worker, "ipc");
|
|
127
|
-
});
|
|
128
|
-
}, 1000);
|
|
129
|
-
this.#timer.unref();
|
|
130
|
-
if (worker.child.exitCode !== null || worker.child.signalCode !== null)
|
|
131
|
-
this.#failed(worker, "exit");
|
|
132
|
-
}
|
|
133
|
-
#failed(worker, trigger) {
|
|
134
|
-
if (this.#closing || this.#worker !== worker || this.#state !== "ready")
|
|
135
|
-
return;
|
|
136
|
-
clearInterval(this.#timer);
|
|
137
|
-
this.#state = "recovering";
|
|
138
|
-
this.#diagnostic = {
|
|
139
|
-
trigger,
|
|
140
|
-
stage: "cleanup",
|
|
141
|
-
code: "WORKER_LOST",
|
|
142
|
-
occurred_at: new Date().toISOString(),
|
|
143
|
-
...(worker.child.exitCode !== null ? { exit_code: worker.child.exitCode } : {}),
|
|
144
|
-
...(worker.child.signalCode !== null ? { signal: worker.child.signalCode } : {})
|
|
145
|
-
};
|
|
146
|
-
this.#emit("worker.lost", this.#diagnostic);
|
|
147
|
-
worker.client.close(new KernelError("WORKER_LOST"));
|
|
148
|
-
// 连续健康运行才重置快速恢复预算;睡眠或仅仅等待不能洗掉连续故障。
|
|
149
|
-
if ((this.#heartbeat?.healthyMs ?? 0) >= 60_000) {
|
|
150
|
-
this.#attempts = [];
|
|
151
|
-
this.#attempt = 0;
|
|
152
|
-
this.#slowRecovery = false;
|
|
153
|
-
}
|
|
154
|
-
this.#recovery = this.#recover(worker).catch((error) => {
|
|
155
|
-
this.#cleanupFailure = new AggregateError([error], "WORKER_RECOVERY_BLOCKED");
|
|
156
|
-
if (!this.#closing)
|
|
157
|
-
this.#state = "exhausted";
|
|
158
|
-
this.#emit("worker.recovery_blocked", { code: failureCode(error) });
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
async #wait(delay) {
|
|
162
|
-
if (this.#abort.signal.aborted)
|
|
163
|
-
return;
|
|
164
|
-
await new Promise((resolve) => {
|
|
165
|
-
const finish = () => {
|
|
166
|
-
clearTimeout(timer);
|
|
167
|
-
this.#abort.signal.removeEventListener("abort", finish);
|
|
168
|
-
resolve();
|
|
169
|
-
};
|
|
170
|
-
const timer = setTimeout(finish, delay);
|
|
171
|
-
this.#abort.signal.addEventListener("abort", finish, { once: true });
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
/** 阻塞时单路按 1/2/5 秒重新确认;失败不洗掉记录,关闭会取消等待并保留未清理事实。 */
|
|
175
|
-
async #retry(stage, operation) {
|
|
176
|
-
let retry = operation;
|
|
177
|
-
let attempt = 0;
|
|
178
|
-
while (!this.#closing) {
|
|
179
|
-
try {
|
|
180
|
-
await retry();
|
|
181
|
-
this.#cleanupFailure = undefined;
|
|
182
|
-
this.#state = "recovering";
|
|
183
|
-
return true;
|
|
184
|
-
}
|
|
185
|
-
catch (error) {
|
|
186
|
-
if (error instanceof WorkerCleanupError)
|
|
187
|
-
retry = () => error.retryCleanup(Date.now() + 4800);
|
|
188
|
-
this.#cleanupFailure =
|
|
189
|
-
error instanceof AggregateError
|
|
190
|
-
? error
|
|
191
|
-
: new AggregateError([error], "WORKER_RECOVERY_BLOCKED");
|
|
192
|
-
if (this.#closing)
|
|
193
|
-
return false;
|
|
194
|
-
const delay = [1000, 2000, 5000][Math.min(attempt++, 2)];
|
|
195
|
-
this.#state = "exhausted";
|
|
196
|
-
this.#diagnostic = {
|
|
197
|
-
...this.#diagnostic,
|
|
198
|
-
stage,
|
|
199
|
-
code: failureCode(error),
|
|
200
|
-
retry_at: new Date(Date.now() + delay).toISOString()
|
|
201
|
-
};
|
|
202
|
-
this.#emit("worker.recovery_blocked", { ...this.#diagnostic, delay_ms: delay });
|
|
203
|
-
await this.#wait(delay);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
async #recover(worker) {
|
|
209
|
-
// 只在真实回收和清单写入都成功后放行替代;任何旧 Run 都不会重新 invoke。
|
|
210
|
-
// Windows 在首次清理前已退出时沿用 skipped 路径;仍存活的故障 worker 不等待正常排空。
|
|
211
|
-
// 已发生的清理失败继续由原 close Promise 和重试入口保留,不能因稍后退出而放行。
|
|
212
|
-
if (!(await this.#retry("cleanup", () => closeWorker(worker, Date.now() + 4800, worker.child.exitCode === null && worker.child.signalCode === null))))
|
|
213
|
-
return;
|
|
214
|
-
if (!(await this.#retry("manifest", () => this.recordWorker?.(undefined) ?? Promise.resolve())))
|
|
215
|
-
return;
|
|
216
|
-
this.#worker = undefined;
|
|
217
|
-
while (!this.#closing) {
|
|
218
|
-
this.#attempts = this.#attempts.filter((at) => this.#activeTime - at < 60_000);
|
|
219
|
-
if (this.#attempts.length >= 3)
|
|
220
|
-
this.#slowRecovery = true;
|
|
221
|
-
const delay = this.#slowRecovery ? 15_000 : [250, 1000, 4000][this.#attempts.length];
|
|
222
|
-
this.#diagnostic = {
|
|
223
|
-
...this.#diagnostic,
|
|
224
|
-
stage: "backoff",
|
|
225
|
-
retry_at: new Date(Date.now() + delay).toISOString()
|
|
226
|
-
};
|
|
227
|
-
this.#emit("worker.retry_scheduled", { ...this.#diagnostic, delay_ms: delay });
|
|
228
|
-
await this.#wait(delay);
|
|
229
|
-
if (this.#closing)
|
|
230
|
-
return;
|
|
231
|
-
if (!this.#slowRecovery)
|
|
232
|
-
this.#attempts.push(this.#activeTime);
|
|
233
|
-
this.#attempt = Math.min(Number.MAX_SAFE_INTEGER, this.#attempt + 1);
|
|
234
|
-
this.#diagnostic = { ...this.#diagnostic, stage: "starting" };
|
|
235
|
-
delete this.#diagnostic.retry_at;
|
|
236
|
-
try {
|
|
237
|
-
await this.#spawn();
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
catch (error) {
|
|
241
|
-
this.#diagnostic = { ...this.#diagnostic, code: failureCode(error) };
|
|
242
|
-
this.#emit("worker.start_failed", {
|
|
243
|
-
...this.#diagnostic,
|
|
244
|
-
...(error instanceof WorkerCleanupError ? { pid: error.pid } : {})
|
|
245
|
-
});
|
|
246
|
-
if (error instanceof WorkerCleanupError) {
|
|
247
|
-
if (!(await this.#retry("cleanup", () => Promise.reject(error))))
|
|
248
|
-
return;
|
|
249
|
-
if (!(await this.#retry("manifest", () => this.recordWorker?.(undefined) ?? Promise.resolve())))
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
async close(until = Date.now() + 5000) {
|
|
256
|
-
this.#closing = true;
|
|
257
|
-
this.#closeUntil ??= until;
|
|
258
|
-
this.#abort.abort();
|
|
259
|
-
clearInterval(this.#timer);
|
|
260
|
-
await this.#recovery;
|
|
261
|
-
if (this.#worker)
|
|
262
|
-
await closeWorker(this.#worker, this.#closeUntil);
|
|
263
|
-
if (this.#cleanupFailure)
|
|
264
|
-
throw this.#cleanupFailure;
|
|
265
|
-
await this.recordWorker?.(undefined);
|
|
266
|
-
this.#state = "stopped";
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
function failureCode(error) {
|
|
270
|
-
// 聚合回收错误取其真实 cause;只输出稳定错误码,禁止输出异常正文或 stderr。
|
|
271
|
-
for (let depth = 0; depth < 5 && error instanceof Error; depth++, error = error.cause) {
|
|
272
|
-
const code = "code" in error ? error.code : undefined;
|
|
273
|
-
if (typeof code === "string" && /^[A-Z][A-Z0-9_]{0,95}$/.test(code))
|
|
274
|
-
return code;
|
|
275
|
-
if (!error.cause && /^[A-Z][A-Z0-9_]{0,95}$/.test(error.message))
|
|
276
|
-
return error.message;
|
|
277
|
-
}
|
|
278
|
-
return "WORKER_RECOVERY_FAILED";
|
|
279
|
-
}
|
|
File without changes
|