@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
package/apps/cli/dist/output.js
CHANGED
|
@@ -1,13 +1,72 @@
|
|
|
1
1
|
import { ServiceError } from "@mininglamp-oss/octo-runtime-cross-service";
|
|
2
2
|
import { RuntimeLogging } from "@mininglamp-oss/octo-runtime-adapter-sdk";
|
|
3
|
-
import {
|
|
3
|
+
import { describeStartupError, formatStartupDiagnostic, restoreStartupDiagnostic, safeStartupValue, startupPathDiagnostic, STARTUP_CATALOG } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
4
|
+
import { constants } from "node:fs";
|
|
5
|
+
import { randomUUID } from "node:crypto";
|
|
6
|
+
import { open, readdir, mkdir, rename, rm, lstat } from "node:fs/promises";
|
|
4
7
|
import { join } from "node:path";
|
|
8
|
+
/** doctor 仅投影已取得的常驻快照;同 PID 合并角色,层级表示所有权而非猜测 OS PPID。 */
|
|
9
|
+
export function residentProcesses(snapshots) {
|
|
10
|
+
const processes = [];
|
|
11
|
+
const pid = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : undefined;
|
|
12
|
+
const add = (entry) => {
|
|
13
|
+
const existing = entry.pid &&
|
|
14
|
+
processes.find((value) => value.pid === entry.pid &&
|
|
15
|
+
value.observation === "alive" &&
|
|
16
|
+
entry.observation === "alive" &&
|
|
17
|
+
value.owner_pid === entry.owner_pid &&
|
|
18
|
+
value.service_id === entry.service_id &&
|
|
19
|
+
value.incarnation === entry.incarnation);
|
|
20
|
+
if (existing)
|
|
21
|
+
existing.roles.push(...entry.roles.filter((role) => !existing.roles.includes(role)));
|
|
22
|
+
else
|
|
23
|
+
processes.push(entry);
|
|
24
|
+
};
|
|
25
|
+
for (const [name, snapshot] of Object.entries(snapshots)) {
|
|
26
|
+
const runtime = record(snapshot.runtime);
|
|
27
|
+
const actualPid = pid(runtime.pid);
|
|
28
|
+
const managedPid = pid(snapshot.service.pid);
|
|
29
|
+
add({
|
|
30
|
+
...(actualPid || managedPid ? { pid: actualPid ?? managedPid } : {}),
|
|
31
|
+
roles: [name === "executor-kernel" ? "Host/Kernel" : `Extra:${name}`],
|
|
32
|
+
state: actualPid ? "running" : snapshot.service.state,
|
|
33
|
+
observation: actualPid ? "alive" : "unknown"
|
|
34
|
+
});
|
|
35
|
+
if (!Array.isArray(runtime.service_processes))
|
|
36
|
+
continue;
|
|
37
|
+
for (const value of runtime.service_processes.slice(0, 256)) {
|
|
38
|
+
const service = record(value);
|
|
39
|
+
add({
|
|
40
|
+
...(pid(service.pid) ? { pid: pid(service.pid) } : {}),
|
|
41
|
+
owner_pid: pid(service.owner_pid),
|
|
42
|
+
roles: [`${text(service.provider)} app-server`],
|
|
43
|
+
state: text(service.state),
|
|
44
|
+
observation: text(service.observation),
|
|
45
|
+
service_id: text(service.service_id),
|
|
46
|
+
incarnation: typeof service.incarnation === "number" ? service.incarnation : undefined
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return processes;
|
|
51
|
+
}
|
|
52
|
+
export function formatResidentProcesses(processes) {
|
|
53
|
+
const lines = ["Resident processes (ownership):"];
|
|
54
|
+
for (const entry of processes.filter((value) => !value.owner_pid)) {
|
|
55
|
+
lines.push(` ${entry.roles.join(", ")} PID ${entry.pid ?? "unknown"} ${entry.state} (${entry.observation})`);
|
|
56
|
+
for (const child of processes.filter((value) => entry.pid && value.owner_pid === entry.pid))
|
|
57
|
+
lines.push(` +-- ${child.roles.join(", ")} PID ${child.pid ?? "-"} ${child.state} (${child.observation}) incarnation ${child.incarnation ?? "-"} service ${child.service_id ?? "-"}`);
|
|
58
|
+
}
|
|
59
|
+
for (const entry of processes.filter((value) => value.owner_pid && !processes.some((parent) => parent.pid === value.owner_pid)))
|
|
60
|
+
lines.push(` ${entry.roles.join(", ")} PID ${entry.pid ?? "-"} ${entry.state} (${entry.observation}) owner PID ${entry.owner_pid}`);
|
|
61
|
+
return lines.join("\n");
|
|
62
|
+
}
|
|
5
63
|
const record = (value) => value !== null && typeof value === "object" && !Array.isArray(value)
|
|
6
64
|
? value
|
|
7
65
|
: {};
|
|
8
66
|
const text = (value) => String(value)
|
|
9
67
|
.replace(/\p{Cc}/gu, " ")
|
|
10
68
|
.slice(0, 200);
|
|
69
|
+
const stableCode = (value) => typeof value === "string" && /^[A-Z][A-Z0-9_]{1,100}$/.test(value) ? value : undefined;
|
|
11
70
|
/** 展示公开状态的摘要,不为输出克隆完整 session/delivery 集合。JSON 模式保留原结果。 */
|
|
12
71
|
export function formatStatus(name, snapshot) {
|
|
13
72
|
const service = snapshot.service;
|
|
@@ -22,12 +81,7 @@ export function formatStatus(name, snapshot) {
|
|
|
22
81
|
` Manager: ${service.manager}${service.pid ? ` PID: ${service.pid}` : runtime.pid ? ` PID: ${text(runtime.pid)}` : ""}`
|
|
23
82
|
];
|
|
24
83
|
if (runtime.execution_ready !== undefined)
|
|
25
|
-
lines.push(`
|
|
26
|
-
const recovery = record(record(runtime.worker).recovery);
|
|
27
|
-
if (recovery.code) {
|
|
28
|
-
lines.push(` Recovery: ${text(recovery.stage)} (${text(recovery.code)})${recovery.retry_at ? ` Next retry: ${text(recovery.retry_at)}` : ""}`);
|
|
29
|
-
lines.push(" Diagnostics: octo-runtime executor-kernel logs --follow (use the same --home)");
|
|
30
|
-
}
|
|
84
|
+
lines.push(` Execution: ${runtime.execution_ready ? "ready" : "unavailable"}`);
|
|
31
85
|
if (runtime.available === false)
|
|
32
86
|
lines.push(` Reason: ${text(record(runtime.error).code ?? "COMPONENT_UNAVAILABLE")}`);
|
|
33
87
|
if (service.lastExitCode !== undefined && service.lastExitCode !== 0)
|
|
@@ -92,26 +146,36 @@ export function formatStatus(name, snapshot) {
|
|
|
92
146
|
return lines.join("\n");
|
|
93
147
|
}
|
|
94
148
|
/** 只保留受控错误码和管理器元信息;异常正文及任意 stderr 可能含凭据,不能直出。 */
|
|
95
|
-
export function describeError(error, fallback = "COMMAND_FAILED") {
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
149
|
+
export function describeError(error, fallback = "COMMAND_FAILED", startup) {
|
|
150
|
+
const field = (value, key) => {
|
|
151
|
+
try {
|
|
152
|
+
return value !== null && typeof value === "object"
|
|
153
|
+
? Object.getOwnPropertyDescriptor(value, key)?.value
|
|
154
|
+
: undefined;
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const code = stableCode(field(error, "code")) ??
|
|
161
|
+
(error instanceof Error ? stableCode(field(error, "message")) : undefined) ??
|
|
100
162
|
fallback;
|
|
101
|
-
const cause =
|
|
102
|
-
const causeCode = stableCode(cause
|
|
163
|
+
const cause = field(error, "cause");
|
|
164
|
+
const causeCode = stableCode(field(cause, "code")) ?? stableCode(field(cause, "message"));
|
|
165
|
+
const projection = describeStartupError(error, startup);
|
|
166
|
+
const pathDiagnostic = startupPathDiagnostic(projection);
|
|
167
|
+
const diagnostic = startup ||
|
|
168
|
+
pathDiagnostic ||
|
|
169
|
+
field(field(error, "diagnostic"), "domain") === "startup" ||
|
|
170
|
+
projection.causes.some((cause) => cause.component && cause.phase)
|
|
171
|
+
? projection
|
|
172
|
+
: undefined;
|
|
103
173
|
const hints = {
|
|
104
174
|
COMMAND_FAILED: "The command failed. Check the native manager, configuration and service logs.",
|
|
105
|
-
ENOENT: "The component endpoint or required file does not exist. Check installation and service status.",
|
|
106
|
-
ECONNREFUSED: "The component is not accepting IPC connections. Check its process and logs.",
|
|
107
175
|
KERNEL_UNAVAILABLE: "Kernel is unavailable. Check executor-kernel status; Extras can remain running.",
|
|
108
176
|
INVALID_ARGUMENTS: "Use --help to see the available commands and flags.",
|
|
109
|
-
SETUP_IN_PROGRESS: "Another component lifecycle operation is in progress. Wait for it to finish, then retry.",
|
|
110
|
-
ORPHAN_CLEANUP_INCOMPLETE: "Run doctor with the same --home to inspect the manifest. After stopping all orphan tools, run executor-kernel recover --acknowledge-orphan-cleanup, then start again.",
|
|
111
177
|
ORPHAN_CLEANUP_OWNER_ALIVE: "The original Kernel or worker is still alive or its identity cannot be verified. Stop it safely before acknowledging cleanup.",
|
|
112
178
|
ORPHAN_CLEANUP_NOT_PENDING: "There is no valid incomplete orphan cleanup to acknowledge. Run doctor with the same --home.",
|
|
113
|
-
SERVICE_NOT_INSTALLED: "Run this component's install command, then start it.",
|
|
114
|
-
NOT_INSTALLED: "Run this component's install command, then start it.",
|
|
115
179
|
EXTRA_COMMAND_FAILED: "The Extra command failed. No private backend error is printed; check its input and configuration, then retry.",
|
|
116
180
|
EXTRA_CONFIG_CONFLICT: "Configuration changed after this command read it. Read the latest configuration and retry.",
|
|
117
181
|
EXTRA_COMMAND_LOAD_FAILED: "The selected Extra command module or one of its dependencies is broken. Check its package and commands export; lifecycle commands remain available.",
|
|
@@ -121,33 +185,75 @@ export function describeError(error, fallback = "COMMAND_FAILED") {
|
|
|
121
185
|
EXTRA_COMMAND_NOT_FOUND: "Unknown command. Use --help on the service command to see available subcommands.",
|
|
122
186
|
EXTRA_COMMAND_CANCELLED: "The command was cancelled. Any save that already completed remains persisted.",
|
|
123
187
|
EXTRA_COMMAND_STDIN_REQUIRED: "Pipe the required input through stdin; do not put credentials in command arguments.",
|
|
124
|
-
EXTRA_NOT_REGISTERED: "Save the service configuration using its configure or extraset subcommand before starting it.",
|
|
125
188
|
EXTRA_MANIFEST_DECLARATION_REQUIRED: "Install this Extra alongside the global Runtime, or add its name and module to the selected Home manifest.json (extras array), then retry.",
|
|
126
|
-
|
|
127
|
-
EXTRA_MODULE_LOAD_FAILED: "Check the selected catalog declaration, discovery diagnostics, installation and ESM exports; reinstall it or select a valid Home manifest entry, then retry.",
|
|
128
|
-
EXTRA_MODULE_MIGRATION_REQUIRED: "The saved module differs from manifest.json. Review both declarations, then save matching module text or omit module from the Extra configuration.",
|
|
129
|
-
MANIFEST_INVALID: "Check manifest.json: version must be 1 and adapters/extras must be valid arrays without duplicate keys.",
|
|
130
|
-
MANAGER_UNAVAILABLE: "Run doctor and check the current user's native service manager.",
|
|
131
|
-
COMPONENT_UNAVAILABLE: "Check component status and the service logs; the IPC or worker is not ready.",
|
|
132
|
-
SERVICE_PROCESS_EXITED: "The service exited unexpectedly. Check its logs and configuration.",
|
|
133
|
-
SERVICE_INITIALIZATION_FAILED: "Check the component configuration, manifest and service logs.",
|
|
134
|
-
SERVICE_DISABLED: "Enable this component with install --autostart=true, then start it."
|
|
189
|
+
EXTRA_MODULE_MIGRATION_REQUIRED: "The saved module differs from manifest.json. Review both declarations, then save matching module text or omit module from the Extra configuration."
|
|
135
190
|
};
|
|
136
191
|
return {
|
|
137
192
|
code,
|
|
138
|
-
message:
|
|
193
|
+
message: diagnostic?.explanation ??
|
|
194
|
+
STARTUP_CATALOG[code]?.action ??
|
|
195
|
+
hints[code] ??
|
|
196
|
+
"Check --help, component status and service logs for this operation.",
|
|
139
197
|
...(causeCode ? { cause_code: causeCode } : {}),
|
|
198
|
+
...(diagnostic ? { diagnostic } : {}),
|
|
199
|
+
...(pathDiagnostic
|
|
200
|
+
? { startup: pathDiagnostic, ...(diagnostic?.cleanup ? { cleanup: diagnostic.cleanup } : {}) }
|
|
201
|
+
: {}),
|
|
140
202
|
...(error instanceof ServiceError
|
|
141
|
-
? {
|
|
203
|
+
? {
|
|
204
|
+
backend: error.backend,
|
|
205
|
+
command: typeof error.command === "string" ? safeStartupValue(error.command) : undefined,
|
|
206
|
+
exit_code: error.exitCode
|
|
207
|
+
}
|
|
142
208
|
: {})
|
|
143
209
|
};
|
|
144
210
|
}
|
|
211
|
+
/** 保留兼容 code/cause_code;共享启动结构决定动态解释与下一步。 */
|
|
212
|
+
export function formatErrorDetails(failure) {
|
|
213
|
+
return failure.diagnostic ? formatStartupDiagnostic(failure.diagnostic) : failure.message;
|
|
214
|
+
}
|
|
145
215
|
/** 前台启动失败沿既有白名单和小时轮转落盘;不捕获任意进程 stdout/stderr。 */
|
|
146
216
|
export async function recordStartupFailure(directory, component, error) {
|
|
217
|
+
if (!/^[a-z][a-z0-9-]{0,63}$/.test(component))
|
|
218
|
+
return;
|
|
219
|
+
// Home 校验失败不得由诊断日志递归补建根目录(#306)。
|
|
220
|
+
if (startupPathDiagnostic(describeStartupError(error)))
|
|
221
|
+
return;
|
|
147
222
|
const logging = new RuntimeLogging({ directory });
|
|
148
223
|
try {
|
|
149
|
-
|
|
224
|
+
// 单份最近失败记录拥有独立有界文件;不放宽通用日志的配置/异常白名单。
|
|
225
|
+
const diagnostic = describeStartupError(error, { component, phase: "initializing" });
|
|
150
226
|
const failure = describeError(error, "SERVICE_INITIALIZATION_FAILED");
|
|
227
|
+
const file = join(directory, `startup-${component}.json`);
|
|
228
|
+
const temporary = `${file}.${randomUUID()}.tmp`;
|
|
229
|
+
try {
|
|
230
|
+
const line = JSON.stringify({
|
|
231
|
+
schema_version: 1,
|
|
232
|
+
time: new Date().toISOString(),
|
|
233
|
+
component,
|
|
234
|
+
code: failure.code,
|
|
235
|
+
...(failure.cause_code ? { cause_code: failure.cause_code } : {}),
|
|
236
|
+
diagnostic
|
|
237
|
+
});
|
|
238
|
+
if (Buffer.byteLength(line) <= 262144) {
|
|
239
|
+
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
240
|
+
const handle = await open(temporary, "wx", 0o600);
|
|
241
|
+
try {
|
|
242
|
+
await handle.writeFile(line);
|
|
243
|
+
}
|
|
244
|
+
finally {
|
|
245
|
+
await handle.close();
|
|
246
|
+
}
|
|
247
|
+
await rename(temporary, file);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
// 诊断落盘失败不能覆盖原始启动/清理错误,调用方仍持有完整安全投影。
|
|
252
|
+
}
|
|
253
|
+
finally {
|
|
254
|
+
await rm(temporary, { force: true }).catch(() => undefined);
|
|
255
|
+
}
|
|
256
|
+
const log = component === "executor-kernel" ? logging.kernel : logging.extra(component);
|
|
151
257
|
if (failure.cause_code)
|
|
152
258
|
log("error", "cli.initialization_cause", { code: failure.cause_code });
|
|
153
259
|
log("error", "cli.initialization_failed", { code: failure.code });
|
|
@@ -158,6 +264,47 @@ export async function recordStartupFailure(directory, component, error) {
|
|
|
158
264
|
}
|
|
159
265
|
/** 只读本次 start 后的白名单失败事件;每个轮转文件最多读取末尾 64 KiB。 */
|
|
160
266
|
export async function readStartupFailure(directory, component, since) {
|
|
267
|
+
if (!/^[a-z][a-z0-9-]{0,63}$/.test(component))
|
|
268
|
+
return undefined;
|
|
269
|
+
try {
|
|
270
|
+
const file = await open(join(directory, `startup-${component}.json`), constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
|
|
271
|
+
try {
|
|
272
|
+
const stat = await file.stat();
|
|
273
|
+
if (!constants.O_NOFOLLOW) {
|
|
274
|
+
const entry = await lstat(join(directory, `startup-${component}.json`));
|
|
275
|
+
if (!entry.isFile() || entry.dev !== stat.dev || entry.ino !== stat.ino)
|
|
276
|
+
return undefined;
|
|
277
|
+
}
|
|
278
|
+
if (stat.isFile() && stat.size <= 262144) {
|
|
279
|
+
const bytes = Buffer.alloc(262145);
|
|
280
|
+
let length = 0;
|
|
281
|
+
while (length < bytes.length) {
|
|
282
|
+
const { bytesRead } = await file.read(bytes, length, bytes.length - length, null);
|
|
283
|
+
if (!bytesRead)
|
|
284
|
+
break;
|
|
285
|
+
length += bytesRead;
|
|
286
|
+
}
|
|
287
|
+
if (length > 262144)
|
|
288
|
+
return undefined;
|
|
289
|
+
const row = record(JSON.parse(bytes.subarray(0, length).toString("utf8")));
|
|
290
|
+
if (row.schema_version === 1 &&
|
|
291
|
+
row.component === component &&
|
|
292
|
+
typeof row.time === "string" &&
|
|
293
|
+
Date.parse(row.time) >= since) {
|
|
294
|
+
const diagnostic = restoreStartupDiagnostic(row.diagnostic);
|
|
295
|
+
const code = stableCode(row.code), causeCode = stableCode(row.cause_code);
|
|
296
|
+
if (diagnostic && code)
|
|
297
|
+
return Object.assign(new Error(code, causeCode ? { cause: new Error(causeCode) } : undefined), { diagnostic });
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
finally {
|
|
302
|
+
await file.close();
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
catch {
|
|
306
|
+
// 缺失、损坏或旧版本记录继续走既有白名单日志,不影响真实就绪等待。
|
|
307
|
+
}
|
|
161
308
|
const root = component === "executor-kernel" ? directory : join(directory, "extras");
|
|
162
309
|
const prefix = component === "executor-kernel" ? "kernel-" : `${component}-`;
|
|
163
310
|
try {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { writeSync } from "node:fs";
|
|
3
|
+
/**
|
|
4
|
+
* 仅 CLI 可执行入口在确认 playboard 命令后安装,监听持续到本进程退出。
|
|
5
|
+
* 人工停止不等待 import、Run 终态或 Kernel close;SDK 不使用此策略。
|
|
6
|
+
* 命令返回但清理失败时仍须能停止残留进程树;信号监听本身不维持事件循环。
|
|
7
|
+
*/
|
|
8
|
+
export function installPlayboardInterrupt() {
|
|
9
|
+
let stopping = false;
|
|
10
|
+
const stop = (code) => {
|
|
11
|
+
if (stopping)
|
|
12
|
+
return;
|
|
13
|
+
stopping = true;
|
|
14
|
+
diagnostic("PLAYBOARD_FORCE_STOP: execution and cleanup are unconfirmed");
|
|
15
|
+
try {
|
|
16
|
+
if (process.platform === "win32") {
|
|
17
|
+
// 保持 leader 存活,由系统按 PID 回收树;不能先退出再查找后代。
|
|
18
|
+
execFileSync("taskkill.exe", ["/PID", String(process.pid), "/T", "/F"], {
|
|
19
|
+
stdio: "ignore",
|
|
20
|
+
windowsHide: true,
|
|
21
|
+
timeout: 2000
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
// Adapter 可创建独立组,不能只杀当前组,更不能按 node/应用名匹配。
|
|
26
|
+
// 选择本次 CLI 的可识别后代,先杀最深层再退出自身,不触及兄弟服务。
|
|
27
|
+
const listing = execFileSync("/bin/ps", ["-axo", "pid=,ppid="], {
|
|
28
|
+
encoding: "utf8",
|
|
29
|
+
timeout: 2000,
|
|
30
|
+
maxBuffer: 8 * 1024 * 1024
|
|
31
|
+
});
|
|
32
|
+
const children = new Map();
|
|
33
|
+
for (const line of listing.split("\n")) {
|
|
34
|
+
const match = /^\s*(\d+)\s+(\d+)\s*$/.exec(line);
|
|
35
|
+
if (!match)
|
|
36
|
+
continue;
|
|
37
|
+
const pid = Number(match[1]), parent = Number(match[2]);
|
|
38
|
+
if (pid <= 1 || pid === process.pid)
|
|
39
|
+
continue;
|
|
40
|
+
const group = children.get(parent) ?? [];
|
|
41
|
+
group.push(pid);
|
|
42
|
+
children.set(parent, group);
|
|
43
|
+
}
|
|
44
|
+
const owned = [process.pid];
|
|
45
|
+
const seen = new Set(owned);
|
|
46
|
+
for (let i = 0; i < owned.length; i++)
|
|
47
|
+
for (const pid of children.get(owned[i]) ?? [])
|
|
48
|
+
if (!seen.has(pid)) {
|
|
49
|
+
seen.add(pid);
|
|
50
|
+
owned.push(pid);
|
|
51
|
+
}
|
|
52
|
+
let failed = false;
|
|
53
|
+
for (const pid of owned.slice(1).reverse()) {
|
|
54
|
+
try {
|
|
55
|
+
process.kill(pid, "SIGKILL");
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
if (error.code !== "ESRCH")
|
|
59
|
+
failed = true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (failed)
|
|
63
|
+
diagnostic("PLAYBOARD_TREE_STOP_UNCONFIRMED");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// 查询/终止失败不能继续吞掉人工退出;不声称未知或已重新归属的后代已停止。
|
|
68
|
+
diagnostic("PLAYBOARD_TREE_STOP_UNCONFIRMED");
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
process.exit(code);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const interrupt = () => stop(130);
|
|
75
|
+
const terminate = () => stop(143);
|
|
76
|
+
process.on("SIGINT", interrupt);
|
|
77
|
+
process.on("SIGTERM", terminate);
|
|
78
|
+
}
|
|
79
|
+
function diagnostic(message) {
|
|
80
|
+
try {
|
|
81
|
+
writeSync(2, `${message}\n`);
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// stderr 已关闭时仍执行定向强退。
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { loadCliAdapters } from "./adapters.js";
|
|
1
2
|
import { defaultRuntimeHome, runtimePaths, readJsonFile } from "./state.js";
|
|
2
3
|
import { loadCliManifest } from "./module-manifest.js";
|
|
3
4
|
import { readCliAdapterConfigurations } from "./adapter-configurations.js";
|
|
4
|
-
import { resolveAdapterModules } from "@mininglamp-oss/octo-runtime-adapter-sdk/module-manifest";
|
|
5
5
|
import { createKernelService } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
6
|
import { componentEndpoint } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
8
7
|
import { mkdtemp, rm } from "node:fs/promises";
|
|
9
8
|
import { tmpdir } from "node:os";
|
|
@@ -76,8 +75,10 @@ export async function runPlayboard(options) {
|
|
|
76
75
|
};
|
|
77
76
|
if (!options.output)
|
|
78
77
|
process.stdout.on("error", onOutputError);
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
if (options.handleSignals !== false) {
|
|
79
|
+
process.once("SIGINT", onInterrupt);
|
|
80
|
+
process.once("SIGTERM", onTerminate);
|
|
81
|
+
}
|
|
81
82
|
let kernel;
|
|
82
83
|
let outcome;
|
|
83
84
|
let primaryFailure;
|
|
@@ -87,14 +88,12 @@ export async function runPlayboard(options) {
|
|
|
87
88
|
const manifest = await loadCliManifest(home, options.manifest);
|
|
88
89
|
const configuration = await readJsonFile(paths.profileConfig);
|
|
89
90
|
kernel = createKernelService({
|
|
91
|
+
home: temporary,
|
|
90
92
|
endpoint: process.platform === "win32" ? componentEndpoint(temporary) : join(temporary, "k.sock"),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
OCTO_RUNTIME_CLI_PROFILE_ROOT: paths.profileRoot,
|
|
96
|
-
OCTO_RUNTIME_CLI_SYNC_OPENCLAW_TOOLS: "0"
|
|
97
|
-
},
|
|
93
|
+
adapters: await loadCliAdapters(manifest.adapters, {
|
|
94
|
+
profileRoot: paths.profileRoot,
|
|
95
|
+
syncOpenClawTools: false
|
|
96
|
+
}),
|
|
98
97
|
adapterConfigurations: await readCliAdapterConfigurations(paths.profileRoot, configuration?.adapters, manifest, options.env ?? process.env)
|
|
99
98
|
});
|
|
100
99
|
await kernel.initialize({ signal: controller.signal });
|
package/apps/cli/dist/state.d.ts
CHANGED
|
@@ -49,10 +49,13 @@ export interface RuntimePaths {
|
|
|
49
49
|
openclawRoot: string;
|
|
50
50
|
setupLock: string;
|
|
51
51
|
pid: string;
|
|
52
|
-
socket: string;
|
|
53
52
|
logs: string;
|
|
54
53
|
}
|
|
55
|
-
export declare function defaultRuntimeHome(env?: NodeJS.ProcessEnv
|
|
54
|
+
export declare function defaultRuntimeHome(env?: NodeJS.ProcessEnv): string;
|
|
55
|
+
/** CLI 明确接受相对 --home 并转为绝对路径;不展开 ~,空值必须失败。 */
|
|
56
|
+
export declare function selectRuntimeHome(input: string | undefined, env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string;
|
|
57
|
+
/** 根目录只由 CLI 准备;先检查完整预算,创建失败保留原 path/errno,不换根。 */
|
|
58
|
+
export declare function prepareRuntimeHome(home: string): Promise<void>;
|
|
56
59
|
export declare function runtimePaths(home: string, profile: string, platform?: NodeJS.Platform): RuntimePaths;
|
|
57
60
|
/** Call under the Home setup lock; this label is shared by all profiles, not an authentication key. */
|
|
58
61
|
export declare function ensureMachineIdentity(paths: RuntimePaths): Promise<MachineIdentity>;
|
package/apps/cli/dist/state.js
CHANGED
|
@@ -2,12 +2,17 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
2
2
|
import { access, chmod, link, mkdir, open, readFile, rename, rm, rmdir } from "node:fs/promises";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { basename, dirname, join, resolve } from "node:path";
|
|
5
|
-
import { componentEndpoint } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
5
|
+
import { componentEndpoint, normalizeRuntimeHome, assertRuntimePath, runtimePathFailure, validateRuntimeHome } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
6
|
+
import { withStartupContext } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
6
7
|
const PROFILE_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
7
8
|
const RESERVED_PROFILE_NAMES = new Set([
|
|
8
9
|
"config.json",
|
|
9
10
|
"credentials",
|
|
10
11
|
"extras",
|
|
12
|
+
"executor-kernel.sock",
|
|
13
|
+
"executor-kernel.sock.owner",
|
|
14
|
+
"executor-kernel.sock.owner.recovery",
|
|
15
|
+
"executor-kernel.sock.runs",
|
|
11
16
|
"identity",
|
|
12
17
|
"machine.json",
|
|
13
18
|
"logs",
|
|
@@ -18,20 +23,43 @@ const RESERVED_PROFILE_NAMES = new Set([
|
|
|
18
23
|
"sockets",
|
|
19
24
|
"state.db"
|
|
20
25
|
]);
|
|
21
|
-
export function defaultRuntimeHome(env = process.env
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
export function defaultRuntimeHome(env = process.env) {
|
|
27
|
+
return normalizeRuntimeHome(join(env.HOME?.trim() || homedir(), ".octo-runtime"));
|
|
28
|
+
}
|
|
29
|
+
/** CLI 明确接受相对 --home 并转为绝对路径;不展开 ~,空值必须失败。 */
|
|
30
|
+
export function selectRuntimeHome(input, env, platform = process.platform) {
|
|
31
|
+
if (input === undefined)
|
|
32
|
+
return normalizeRuntimeHome(defaultRuntimeHome(env), platform);
|
|
33
|
+
if (typeof input !== "string" || !input.trim() || input.startsWith("~"))
|
|
34
|
+
return normalizeRuntimeHome(input, platform);
|
|
35
|
+
return normalizeRuntimeHome(resolve(input), platform);
|
|
36
|
+
}
|
|
37
|
+
/** 根目录只由 CLI 准备;先检查完整预算,创建失败保留原 path/errno,不换根。 */
|
|
38
|
+
export async function prepareRuntimeHome(home) {
|
|
39
|
+
const selected = normalizeRuntimeHome(home);
|
|
40
|
+
componentEndpoint(selected);
|
|
41
|
+
assertRuntimePath(join(selected, "run", `kernel-invocations.json.acknowledged.${"0".repeat(36)}.json`), "kernel-state");
|
|
42
|
+
try {
|
|
43
|
+
await mkdir(selected, { recursive: true, mode: 0o700 });
|
|
28
44
|
}
|
|
29
|
-
|
|
45
|
+
catch (error) {
|
|
46
|
+
if (isNodeError(error, "EEXIST"))
|
|
47
|
+
validateRuntimeHome(selected);
|
|
48
|
+
throw runtimePathFailure(error, selected, "home", "mkdir");
|
|
49
|
+
}
|
|
50
|
+
validateRuntimeHome(selected);
|
|
30
51
|
}
|
|
31
52
|
export function runtimePaths(home, profile, platform = process.platform) {
|
|
32
53
|
assertProfileName(profile);
|
|
33
|
-
const absoluteHome =
|
|
54
|
+
const absoluteHome = normalizeRuntimeHome(home, platform);
|
|
34
55
|
const profileRoot = join(absoluteHome, profile);
|
|
56
|
+
// CLI 的身份/锁原子写另有后缀,不可只检查 Home 或 hash pipe 的短地址。
|
|
57
|
+
for (const path of [
|
|
58
|
+
join(profileRoot, "credentials", `runtime-token.json.${"0".repeat(10)}.${"0".repeat(36)}.tmp`),
|
|
59
|
+
join(absoluteHome, "run", `kernel-invocations.json.acknowledged.${"0".repeat(36)}.json`),
|
|
60
|
+
join(absoluteHome, "run", `.reclaim-${"0".repeat(64)}.${"0".repeat(10)}.${"0".repeat(36)}.tmp`)
|
|
61
|
+
])
|
|
62
|
+
assertRuntimePath(path, "cli-state", platform);
|
|
35
63
|
return {
|
|
36
64
|
home: absoluteHome,
|
|
37
65
|
rootConfig: join(absoluteHome, "config.json"),
|
|
@@ -43,7 +71,6 @@ export function runtimePaths(home, profile, platform = process.platform) {
|
|
|
43
71
|
openclawRoot: join(profileRoot, "adapters", "openclaw"),
|
|
44
72
|
setupLock: join(absoluteHome, "run", "setup.lock"),
|
|
45
73
|
pid: join(absoluteHome, "run", "executor-kernel.pid"),
|
|
46
|
-
socket: componentEndpoint(absoluteHome, "executor-kernel", platform),
|
|
47
74
|
logs: join(absoluteHome, "logs")
|
|
48
75
|
};
|
|
49
76
|
}
|
|
@@ -141,8 +168,16 @@ export async function readJsonFile(path) {
|
|
|
141
168
|
if (isNodeError(error, "ENOENT"))
|
|
142
169
|
return undefined;
|
|
143
170
|
if (error instanceof SyntaxError)
|
|
144
|
-
throw new Error(`invalid JSON file: ${path}`, { cause: error })
|
|
145
|
-
|
|
171
|
+
throw withStartupContext(new Error(`invalid JSON file: ${path}`, { cause: error }), {
|
|
172
|
+
component: "cli",
|
|
173
|
+
phase: "created",
|
|
174
|
+
context: { path, resource: "configuration", operation: "read-json" }
|
|
175
|
+
}, "LOCAL_STATE_INVALID");
|
|
176
|
+
throw withStartupContext(error, {
|
|
177
|
+
component: "cli",
|
|
178
|
+
phase: "created",
|
|
179
|
+
context: { path, resource: "configuration", operation: "read" }
|
|
180
|
+
});
|
|
146
181
|
}
|
|
147
182
|
}
|
|
148
183
|
export async function writeJsonAtomic(path, value) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { codexAdapter, createCodexAdapter } from "@mininglamp-oss/octo-runtime-adapter-codex";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { codexAdapter, createCodexAdapter } from "@mininglamp-oss/octo-runtime-adapter-codex";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { attachKernel, AsyncQuestionReply, KernelError, isInvocationNotSubmitted, createKernelService, ServiceInitializationError } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
2
|
-
export { serveWorker } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
3
2
|
export type { HostedAdapter } from "@mininglamp-oss/octo-runtime-executor-core";
|
|
3
|
+
export { STARTUP_CATALOG, describeStartupError, formatStartupDiagnostic, restoreStartupDiagnostic, StartupError } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
4
|
+
export type { StartupCatalogEntry, StartupDiagnostic, StartupContext, StartupCause, StartupLocation } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
4
5
|
export type { KernelClient, AsyncQuestionReplyResult, KernelInvocationRecord, KernelInvocationDrainResult, KernelInvocationLifecycle, KernelService, KernelServiceOptions, KernelServiceStatus, ServiceCleanupResult, ServiceLifecycle, ServicePhase, KernelStatus, LookupKey, RunRef, RunSnapshot } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
6
|
+
export { RuntimeHomeError, normalizeRuntimeHome, validateRuntimeHome, assertRuntimePath, assertIpcEndpoint } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
7
|
+
export type { StartupPathDiagnostic } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { attachKernel, AsyncQuestionReply, KernelError, isInvocationNotSubmitted, createKernelService, ServiceInitializationError } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
2
|
-
export {
|
|
2
|
+
export { STARTUP_CATALOG, describeStartupError, formatStartupDiagnostic, restoreStartupDiagnostic, StartupError } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
3
|
+
export { RuntimeHomeError, normalizeRuntimeHome, validateRuntimeHome, assertRuntimePath, assertIpcEndpoint } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
package/dist/public/extra.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./protocol.js";
|
|
2
|
-
export type { ExtraContext, RuntimeLog, RuntimeLogLevel, ExtraDisposer, ExtraInitializer, ExtraPlugin, ExtraPluginModule, ExtraRegistration, ExtraStatus, ExtraStatusHandler, JsonObject, JsonValue } from "@mininglamp-oss/octo-runtime-host-sdk/extra";
|
|
2
|
+
export type { ExtraContext, ExtraExecution, ExtraExecutionContext, RuntimeLog, RuntimeLogLevel, ExtraDisposer, ExtraInitializer, ExtraPlugin, ExtraPluginModule, ExtraRegistration, ExtraStatus, ExtraStatusHandler, JsonObject, JsonValue } from "@mininglamp-oss/octo-runtime-host-sdk/extra";
|
|
3
3
|
export { ExtraPlugins } from "@mininglamp-oss/octo-runtime-host-sdk/extra";
|
|
4
4
|
export type { ExtraDescriptor, StoredExtra } from "@mininglamp-oss/octo-runtime-host-sdk/extra-config";
|
|
5
5
|
export * from "@mininglamp-oss/octo-runtime-host-sdk/extra-commands";
|
package/dist/public/host.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export { createExtraService, componentEndpoint, componentServiceId, homeHash, normalizedHome } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
2
2
|
export type { ExtraService, ExtraServiceOptions, ExtraServiceStatus } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
3
|
+
export type { ExtraExecution, ExtraExecutionContext } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
3
4
|
export type { RuntimeLoggingOptions, ExtraStatusRecord } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
4
5
|
export { createKernelService, ServiceInitializationError } from "./executor-kernel.js";
|
|
6
|
+
export { STARTUP_CATALOG, describeStartupError, formatStartupDiagnostic, restoreStartupDiagnostic, StartupError } from "./executor-kernel.js";
|
|
7
|
+
export type { StartupCatalogEntry, StartupDiagnostic, StartupContext, StartupCause, StartupLocation } from "./executor-kernel.js";
|
|
5
8
|
export type { KernelService, KernelServiceOptions, KernelServiceStatus, ServiceCleanupResult, ServiceLifecycle, ServicePhase } from "./executor-kernel.js";
|
|
9
|
+
export { RuntimeHomeError, normalizeRuntimeHome, validateRuntimeHome, assertRuntimePath, assertIpcEndpoint } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
10
|
+
export type { StartupPathDiagnostic } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
package/dist/public/host.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { createExtraService, componentEndpoint, componentServiceId, homeHash, normalizedHome } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
2
2
|
export { createKernelService, ServiceInitializationError } from "./executor-kernel.js";
|
|
3
|
+
export { STARTUP_CATALOG, describeStartupError, formatStartupDiagnostic, restoreStartupDiagnostic, StartupError } from "./executor-kernel.js";
|
|
4
|
+
export { RuntimeHomeError, normalizeRuntimeHome, validateRuntimeHome, assertRuntimePath, assertIpcEndpoint } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mininglamp-oss/octo-runtime-acp-client",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./dist/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.
|
|
13
|
-
"@mininglamp-oss/octo-runtime-protocol": "1.1.
|
|
12
|
+
"@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.11",
|
|
13
|
+
"@mininglamp-oss/octo-runtime-protocol": "1.1.11"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -475,6 +475,26 @@ export function createAcpAdapter(definition, { acpClientFactory = spawnAcpClient
|
|
|
475
475
|
await client.close();
|
|
476
476
|
}
|
|
477
477
|
if (invocationFailed) {
|
|
478
|
+
// 原生 spawn 拒绝属于启动失败;只有上面的 close 成功后才发布失败终态。
|
|
479
|
+
// 若继续抛出,Core 无法区分执行错误与生成器 finally 失败,会保留未确认 owner。
|
|
480
|
+
// 不推广到任意迭代错误:清理异常仍从 finally 抛出,容量等错误仍保留原对象。
|
|
481
|
+
if (invocationError instanceof Error &&
|
|
482
|
+
"code" in invocationError &&
|
|
483
|
+
typeof invocationError.code === "string" &&
|
|
484
|
+
"syscall" in invocationError &&
|
|
485
|
+
typeof invocationError.syscall === "string" &&
|
|
486
|
+
invocationError.syscall.startsWith("spawn ")) {
|
|
487
|
+
yield {
|
|
488
|
+
protocolVersion: 2,
|
|
489
|
+
type: "run.failed",
|
|
490
|
+
payload: {
|
|
491
|
+
code: invocationError.code,
|
|
492
|
+
message: invocationError.message,
|
|
493
|
+
adapterType: definition.type
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
478
498
|
// 有明确错误码的容量等结构化错误保留原对象;普通内建子类仍交给适配器归一化。
|
|
479
499
|
if (invocationError instanceof Error &&
|
|
480
500
|
"code" in invocationError &&
|