@mininglamp-oss/octo-runtime 1.1.3 → 1.1.5
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 +62 -38
- package/apps/cli/README.md +58 -22
- package/apps/cli/dist/build-info.json +2 -2
- package/apps/cli/dist/cli-entrypoint.d.ts +2 -0
- package/apps/cli/dist/cli-entrypoint.js +16 -0
- package/apps/cli/dist/command-tree.d.ts +20 -0
- package/apps/cli/dist/command-tree.js +402 -0
- package/apps/cli/dist/extra-command-config.d.ts +4 -0
- package/apps/cli/dist/extra-command-config.js +50 -0
- package/apps/cli/dist/extra-commands.d.ts +15 -0
- package/apps/cli/dist/extra-commands.js +275 -0
- package/apps/cli/dist/extras.js +14 -2
- package/apps/cli/dist/global-extras.d.ts +16 -0
- package/apps/cli/dist/global-extras.js +201 -0
- package/apps/cli/dist/help.d.ts +4 -1
- package/apps/cli/dist/help.js +31 -75
- package/apps/cli/dist/main.d.ts +2 -0
- package/apps/cli/dist/main.js +53 -63
- package/apps/cli/dist/manifest.json +53 -3
- package/apps/cli/dist/module-manifest.d.ts +1 -1
- package/apps/cli/dist/module-manifest.js +3 -2
- package/apps/cli/dist/openclaw.js +32 -8
- package/apps/cli/dist/output.js +16 -2
- package/apps/cli/dist/playboard.d.ts +5 -0
- package/apps/cli/dist/playboard.js +41 -13
- package/apps/cli/dist/service-control.js +2 -2
- package/apps/cli/dist/state.js +48 -19
- package/dist/public/channel-gateway-commands.d.ts +1 -0
- package/dist/public/channel-gateway-commands.js +1 -0
- package/dist/public/channel-wecom-commands.d.ts +1 -0
- package/dist/public/channel-wecom-commands.js +1 -0
- package/dist/public/dsh.d.ts +2 -0
- package/dist/public/dsh.js +1 -0
- package/dist/public/executor-kernel.d.ts +1 -1
- package/dist/public/executor-kernel.js +1 -1
- package/dist/public/extra.d.ts +1 -0
- package/dist/public/extra.js +1 -0
- package/dist/public/host.d.ts +2 -4
- package/dist/public/host.js +1 -2
- package/dist/public/webui-commands.d.ts +1 -0
- package/dist/public/webui-commands.js +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/dist/index.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +26 -2
- 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/index.js +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/chunk-DYOJCNWF.js +854 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/chunk-G5PWGRL5.js +209 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/chunk-UOQRXV3Q.js +340 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/desktop-entry.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/desktop-entry.js +16 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-NOTICE.txt +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-client-LICENSE.txt +21 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-protocol-LICENSE.txt +21 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.d.ts +35 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +14 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +52 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +306 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.d.ts +11 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +13 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.d.ts +12 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +15 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +2 -1
- 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 +10 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +214 -55
- 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 +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.js +24 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/hourly-log.js +11 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +12 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +30 -8
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/mcp.js +4 -3
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/module-manifest.d.ts +6 -0
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/module-manifest.js +16 -4
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.js +15 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log.js +29 -1
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/dist/index.js +5 -5
- package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/cli-entrypoint.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/cli-entrypoint.js +16 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.d.ts +20 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.js +402 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-command-config.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-command-config.js +50 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-commands.d.ts +15 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-commands.js +275 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extras.js +14 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/global-extras.d.ts +16 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/global-extras.js +201 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.d.ts +4 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.js +31 -75
- 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 +53 -63
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +53 -3
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.js +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/openclaw.js +32 -8
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +16 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +41 -13
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/service-control.js +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/state.js +48 -19
- package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +25 -23
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/common.d.ts +2 -2
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/common.js +16 -6
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/systemd.js +9 -7
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/windows-task.d.ts +4 -1
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/windows-task.js +36 -11
- package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +7 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-lifecycle.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.d.ts +16 -1
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.js +152 -21
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/serve.js +9 -2
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.d.ts +8 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.js +17 -0
- package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -4
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/config-schema.json +56 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +170 -28
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/session-store.d.ts +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/commands.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/commands.js +124 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +19 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.d.ts +23 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifact-policy.js +43 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.d.ts +15 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/artifacts.js +283 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js +15 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.d.ts +5 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.js +48 -13
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/tool-environment.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/tool-environment.js +5 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/lifecycle/configuration.js +26 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/cards.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.d.ts +1 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/client.js +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/conversations.js +3 -2
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/files.js +104 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/rules.js +4 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/url.d.ts +2 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/api/url.js +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/auth.d.ts +1 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/auth.js +4 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.d.ts +9 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +44 -13
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.d.ts +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.js +44 -3
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/image-input.js +2 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.d.ts +7 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.js +18 -12
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +10 -6
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.js +141 -16
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/session-store.d.ts +3 -1
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/commands.d.ts +4 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/commands.js +128 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +9 -5
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/commands.d.ts +3 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/commands.js +51 -0
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/index-CXTvRGim.js +74 -0
- 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 +7 -3
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-commands.d.ts +70 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-commands.js +16 -0
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-config.js +33 -9
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/home.js +9 -4
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.d.ts +1 -3
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.js +1 -2
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +8 -4
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +5 -0
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +39 -1
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +76 -7
- package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +1172 -0
- package/node_modules/commander/index.js +21 -0
- package/node_modules/commander/lib/argument.js +147 -0
- package/node_modules/commander/lib/command.js +2790 -0
- package/node_modules/commander/lib/error.js +36 -0
- package/node_modules/commander/lib/help.js +731 -0
- package/node_modules/commander/lib/option.js +377 -0
- package/node_modules/commander/lib/suggestSimilar.js +99 -0
- package/node_modules/commander/package-support.json +19 -0
- package/node_modules/commander/package.json +64 -0
- package/node_modules/commander/typings/index.d.ts +1113 -0
- package/package.json +49 -29
- package/packages/octo-runtime-extra-channel-gateway/config-schema.json +56 -0
- package/packages/octo-runtime-protocol/schema/kernel-ipc.schema.json +443 -56
- package/packages/octo-runtime-protocol/schema/protocol.schema.json +357 -37
- package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/index-DiPc-ipL.js +0 -74
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/launch.d.ts +0 -15
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/launch.js +0 -22
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/native.d.ts +0 -16
- package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/native.js +0 -160
|
@@ -21,78 +21,34 @@ const validBuildTime = typeof buildTime === "string" &&
|
|
|
21
21
|
(buildTime.includes(".") ? buildTime : buildTime.replace("Z", ".000Z"));
|
|
22
22
|
const cliBuildInfo = `build:${validBuildTime ? buildTime : "unknown"}`;
|
|
23
23
|
export const cliVersionInfo = `${cliVersion}\n${cliCommitInfo}\n${cliBuildInfo}`;
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
Usage: octo-runtime ${component} <command> [flags]
|
|
57
|
-
|
|
58
|
-
Commands:
|
|
59
|
-
install Register and enable this service (autostart on by default)
|
|
60
|
-
uninstall Remove this service, preserving configuration and data
|
|
61
|
-
start Install if needed, then start this service and wait for readiness
|
|
62
|
-
restart Restart this service and wait for local readiness
|
|
63
|
-
stop Stop this service, preserving its autostart setting
|
|
64
|
-
status Show native service, IPC and component status
|
|
65
|
-
run Run this component in the foreground
|
|
66
|
-
${component === "executor-kernel" ? "" : " logs Tail service status logs (no conversation content)\n"}
|
|
67
|
-
|
|
68
|
-
Flags: --home <path> --profile <name> --manifest <path> --json --help
|
|
69
|
-
Install: --autostart=true|false
|
|
70
|
-
${component === "executor-kernel" ? "" : "Logs: --lines <1..10000> (default 200) --follow --json (NDJSON)\n"}
|
|
71
|
-
Kernel and Extras have independent services and autostart settings.
|
|
72
|
-
An Extra may start before Kernel and connect when Kernel becomes available.`;
|
|
73
|
-
return `Octo Runtime CLI (${cliVersion})
|
|
74
|
-
${cliVersionInfo.split("\n").slice(1).join("\n")}
|
|
75
|
-
Manage the local Agent runtime and independent services.
|
|
76
|
-
|
|
77
|
-
Usage:
|
|
78
|
-
octo-runtime executor-kernel uninstall|install|start|restart|stop|status|run
|
|
79
|
-
octo-runtime <extra-name> uninstall|install|start|restart|stop|status|run
|
|
80
|
-
octo-runtime <extra-name> logs [--lines 200] [--follow] [--json]
|
|
81
|
-
octo-runtime status [--json]
|
|
82
|
-
octo-runtime adapter list
|
|
83
|
-
octo-runtime adapter probe <type>
|
|
84
|
-
octo-runtime doctor
|
|
85
|
-
octo-runtime extraset <name> < config.json
|
|
86
|
-
octo-runtime extraget <name>
|
|
87
|
-
octo-runtime playboard < request.json
|
|
88
|
-
|
|
89
|
-
Flags: --home <path> --profile <name> --manifest <path> --json
|
|
90
|
-
Install: --autostart=true|false (defaults to true)
|
|
91
|
-
Extras: channel-gateway, channel-wecom, webui, or a name saved by extraset.
|
|
92
|
-
Components:
|
|
93
|
-
executor-kernel Local Agent execution and worker supervision
|
|
94
|
-
channel-gateway Octo IM Bot messaging and Agent replies
|
|
95
|
-
channel-wecom WeCom Bot messaging and Agent replies
|
|
96
|
-
webui Local browser workspace for Agent conversations
|
|
97
|
-
Use octo-runtime <component> --help for component commands.`;
|
|
98
|
-
}
|
|
24
|
+
export const cliHelpHeader = `Octo Runtime CLI (${cliVersion})\n${cliCommitInfo}\n${cliBuildInfo}`;
|
|
25
|
+
// 产品指定的首页顺序只影响展示;缺席的 Extra 不补进有效命令目录。
|
|
26
|
+
export const preferredRootCommands = [
|
|
27
|
+
"executor-kernel",
|
|
28
|
+
"channel-gateway",
|
|
29
|
+
"channel-wecom",
|
|
30
|
+
"webui"
|
|
31
|
+
];
|
|
32
|
+
export const lifecycleCommands = new Map([
|
|
33
|
+
["install", "Register and enable this service (autostart on by default)"],
|
|
34
|
+
["uninstall", "Remove this service, preserving configuration and data"],
|
|
35
|
+
["start", "Install if needed, then start this service and wait for readiness"],
|
|
36
|
+
["stop", "Stop this service, preserving its autostart setting"],
|
|
37
|
+
["restart", "Restart this service and wait for readiness"],
|
|
38
|
+
["run", "Run this service in the foreground"],
|
|
39
|
+
["status", "Show service and runtime status"],
|
|
40
|
+
["logs", "Read service status logs (no conversation content)"],
|
|
41
|
+
["extraset", "Replace this service configuration from stdin JSON"],
|
|
42
|
+
["extraget", "Read this service configuration, including credentials"]
|
|
43
|
+
]);
|
|
44
|
+
export const rootCommands = new Map([
|
|
45
|
+
["adapter", "List and probe execution adapters"],
|
|
46
|
+
["doctor", "Diagnose the local runtime"],
|
|
47
|
+
["executor-kernel", "Manage local Agent execution and worker supervision"],
|
|
48
|
+
["extraget", "Read a complete service configuration (advanced)"],
|
|
49
|
+
["extraset", "Replace a complete service configuration from JSON (advanced)"],
|
|
50
|
+
["help", "Help about any command"],
|
|
51
|
+
["playboard", "Run an Agent request from stdin JSON"],
|
|
52
|
+
["status", "Show runtime and service status"],
|
|
53
|
+
["version", "Print version and build information"]
|
|
54
|
+
]);
|
|
@@ -8,5 +8,7 @@ export interface CliDependencies extends ServiceControlOptions {
|
|
|
8
8
|
/** CLI 入口选择前台组件的退出策略;仅确认命令类型,不表示服务 ready。 */
|
|
9
9
|
onComponentRun?: () => void;
|
|
10
10
|
logsSignal?: AbortSignal;
|
|
11
|
+
/** 自有命令的取消;不启动或停止任何服务。 */
|
|
12
|
+
commandSignal?: AbortSignal;
|
|
11
13
|
}
|
|
12
14
|
export declare function runCli(args: string[], dependencies?: CliDependencies): Promise<number>;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { runExtraCommand, commandError } from "./extra-commands.js";
|
|
1
2
|
import net from "node:net";
|
|
2
3
|
import { randomUUID } from "node:crypto";
|
|
3
4
|
import { once } from "node:events";
|
|
4
5
|
import { lstat, mkdir } from "node:fs/promises";
|
|
5
6
|
import { join, resolve } from "node:path";
|
|
6
7
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { attachKernel, createKernelService, readAdapterConfigurations } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
8
|
+
import { attachKernel, acknowledgeOrphanCleanup, inspectOrphanCleanup, createKernelService, readAdapterConfigurations } from "@mininglamp-oss/octo-runtime-executor-kernel";
|
|
8
9
|
import { componentEndpoint, createExtraService } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
9
10
|
import { getExtra, readExtra, setExtra } from "./extras.js";
|
|
10
|
-
import { cliVersionInfo
|
|
11
|
+
import { cliVersionInfo } from "./help.js";
|
|
12
|
+
import { parseCliCommand } from "./command-tree.js";
|
|
11
13
|
import { runForegroundService } from "./foreground.js";
|
|
12
14
|
import { showExtraLogs } from "./logs.js";
|
|
13
15
|
import { StatusOutput } from "./status-output.js";
|
|
@@ -21,12 +23,25 @@ const components = ["executor-kernel", "channel-gateway"];
|
|
|
21
23
|
const builtinComponents = [...components, "channel-wecom", "webui"];
|
|
22
24
|
export async function runCli(args, dependencies = {}) {
|
|
23
25
|
const output = dependencies.output ?? ((line) => process.stdout.write(`${line}\n`));
|
|
24
|
-
|
|
26
|
+
// 参数解析失败也按宿主布尔标记输出 JSON;-- 后的字面位置参数不选择输出格式。
|
|
27
|
+
const literalIndex = args.indexOf("--");
|
|
28
|
+
let json = (literalIndex < 0 ? args : args.slice(0, literalIndex)).some((arg) => arg === "--json" || arg.startsWith("--json="));
|
|
25
29
|
let context = {};
|
|
26
30
|
let runningComponent;
|
|
27
31
|
let statusOutput;
|
|
28
32
|
try {
|
|
29
|
-
const
|
|
33
|
+
const parsed = await parseCliCommand(args, dependencies);
|
|
34
|
+
if (parsed.help !== undefined) {
|
|
35
|
+
output(parsed.help);
|
|
36
|
+
return 0;
|
|
37
|
+
}
|
|
38
|
+
const { flags, positional } = parsed;
|
|
39
|
+
json = Boolean(flags.json);
|
|
40
|
+
if (parsed.extra)
|
|
41
|
+
return await runExtraCommand(parsed, dependencies);
|
|
42
|
+
if (flags["acknowledge-orphan-cleanup"] !== undefined &&
|
|
43
|
+
!(positional[0] === "executor-kernel" && positional[1] === "recover"))
|
|
44
|
+
throw new Error("INVALID_ARGUMENTS");
|
|
30
45
|
if ((flags.lines !== undefined || flags.follow !== undefined) && positional[1] !== "logs")
|
|
31
46
|
throw new Error("INVALID_ARGUMENTS");
|
|
32
47
|
json = Boolean(flags.json);
|
|
@@ -34,16 +49,26 @@ export async function runCli(args, dependencies = {}) {
|
|
|
34
49
|
output(cliVersionInfo);
|
|
35
50
|
return 0;
|
|
36
51
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
//
|
|
42
|
-
if (positional
|
|
43
|
-
|
|
52
|
+
const home = resolve(flags.home ?? defaultRuntimeHome(dependencies.env, dependencies.platform));
|
|
53
|
+
// 模块清单不决定运行状态位置;前台 Kernel、doctor 和恢复确认共用 Home 下的同一路径。
|
|
54
|
+
const kernelStateDirectory = join(home, "run");
|
|
55
|
+
const kernelInvocationManifest = join(kernelStateDirectory, "kernel-invocations.json");
|
|
56
|
+
// 恢复确认不加载 Provider 或访问服务管理器;原记录继续保留,下一次启动校验摘要后替换。
|
|
57
|
+
if (positional[0] === "executor-kernel" && positional[1] === "recover") {
|
|
58
|
+
context = { component: "executor-kernel", action: "recover", logs: join(home, "logs") };
|
|
59
|
+
if (positional.length !== 2 ||
|
|
60
|
+
flags["acknowledge-orphan-cleanup"] !== "true" ||
|
|
61
|
+
flags.autostart !== undefined)
|
|
62
|
+
throw new Error("INVALID_ARGUMENTS");
|
|
63
|
+
const recovery = await withSetupLock({
|
|
64
|
+
...runtimePaths(home, "default", dependencies.platform),
|
|
65
|
+
setupLock: join(kernelStateDirectory, "executor-kernel.setup.lock")
|
|
66
|
+
}, () => acknowledgeOrphanCleanup(kernelInvocationManifest));
|
|
67
|
+
output(json
|
|
68
|
+
? JSON.stringify(recovery)
|
|
69
|
+
: `Orphan cleanup acknowledged. Evidence: ${recovery.archivePath}\nStart executor-kernel again using the same --home.`);
|
|
44
70
|
return 0;
|
|
45
71
|
}
|
|
46
|
-
const home = resolve(flags.home ?? defaultRuntimeHome(dependencies.env, dependencies.platform));
|
|
47
72
|
// Route logs before config/module/manager access so offline failures remain diagnosable.
|
|
48
73
|
if (positional[1] === "logs") {
|
|
49
74
|
const extra = positional[0];
|
|
@@ -103,10 +128,6 @@ export async function runCli(args, dependencies = {}) {
|
|
|
103
128
|
const isComponent = (name) => builtinComponents.includes(name) ||
|
|
104
129
|
registrations.some((entry) => entry.name === name) ||
|
|
105
130
|
manifest?.extras.some((entry) => entry.name === name) === true;
|
|
106
|
-
if (positional.length === 1 && isComponent(positional[0])) {
|
|
107
|
-
output(helpText(positional[0]));
|
|
108
|
-
return 0;
|
|
109
|
-
}
|
|
110
131
|
const service = resolveServiceControl(dependencies);
|
|
111
132
|
const input = dependencies.input ?? process.stdin;
|
|
112
133
|
const publish = (value, human) => output(typeof value === "string" ? value : !json && human ? human : JSON.stringify(value, null, 2));
|
|
@@ -190,9 +211,10 @@ export async function runCli(args, dependencies = {}) {
|
|
|
190
211
|
const manager = await service.backend.probe();
|
|
191
212
|
const status = await snapshots(componentNames);
|
|
192
213
|
const checks = Object.entries(status).map(([component, value]) => ({ component, ...value }));
|
|
193
|
-
|
|
214
|
+
const recovery = await inspectOrphanCleanup(kernelInvocationManifest);
|
|
215
|
+
publish({ manager, checks, recovery }, `Manager: ${manager.manager} (${manager.supported ? "available" : "unavailable"})\n\n${Object.entries(status)
|
|
194
216
|
.map(([name, value]) => formatStatus(name, value))
|
|
195
|
-
.join("\n\n")}`);
|
|
217
|
+
.join("\n\n")}\n\nOrphan cleanup: ${recovery.state}\nManifest: ${recovery.manifestPath}${recovery.state === "cleanup_incomplete" ? "\nStop all orphan tools, then run executor-kernel recover --acknowledge-orphan-cleanup with the same --home." : ""}`);
|
|
196
218
|
return 0;
|
|
197
219
|
}
|
|
198
220
|
if (positional[0] === "status" && positional.length === 1) {
|
|
@@ -225,7 +247,7 @@ export async function runCli(args, dependencies = {}) {
|
|
|
225
247
|
const config = await readJsonFile(paths.profileConfig);
|
|
226
248
|
handle = createKernelService({
|
|
227
249
|
endpoint,
|
|
228
|
-
stateDirectory:
|
|
250
|
+
stateDirectory: kernelStateDirectory,
|
|
229
251
|
workerEntrypoint: fileURLToPath(new URL("./worker.js", import.meta.url)),
|
|
230
252
|
adapterModules: resolveAdapterModules(manifest),
|
|
231
253
|
adapterConfigurations: readAdapterConfigurations(paths.profileRoot, config?.adapters),
|
|
@@ -349,21 +371,23 @@ export async function runCli(args, dependencies = {}) {
|
|
|
349
371
|
catch (error) {
|
|
350
372
|
if (runningComponent && context.logs)
|
|
351
373
|
await recordStartupFailure(context.logs, runningComponent, error);
|
|
352
|
-
const failure = { ...describeError(error), ...context };
|
|
374
|
+
const failure = { ...(commandError(error) ?? describeError(error)), ...context };
|
|
353
375
|
const code = failure.code;
|
|
354
376
|
if (json)
|
|
355
377
|
output(JSON.stringify({ error: failure }, null, context.action === "logs" ? undefined : 2));
|
|
356
378
|
else
|
|
357
379
|
(dependencies.errorOutput ?? ((line) => process.stderr.write(`${line}\n`)))(`${[context.component, context.action].filter(Boolean).join(" ") || "octo-runtime"}: ${code}${failure.cause_code ? ` (${failure.cause_code})` : ""}\n${failure.message}${context.logs ? `\nLogs: ${context.logs}` : ""}`);
|
|
358
|
-
return
|
|
359
|
-
?
|
|
360
|
-
:
|
|
361
|
-
?
|
|
362
|
-
: /
|
|
363
|
-
?
|
|
364
|
-
: /
|
|
365
|
-
?
|
|
366
|
-
:
|
|
380
|
+
return code === "EXTRA_COMMAND_CANCELLED"
|
|
381
|
+
? 130
|
|
382
|
+
: ["SERVICE_NOT_INSTALLED", "NOT_INSTALLED"].includes(code)
|
|
383
|
+
? 3
|
|
384
|
+
: /INVALID|REQUIRED|COMMAND_NOT_FOUND/.test(code)
|
|
385
|
+
? 2
|
|
386
|
+
: /INCOMPLETE/.test(code)
|
|
387
|
+
? 5
|
|
388
|
+
: /UNAVAILABLE|SERVICE_PROCESS_EXITED/.test(code)
|
|
389
|
+
? 4
|
|
390
|
+
: 1;
|
|
367
391
|
}
|
|
368
392
|
finally {
|
|
369
393
|
statusOutput?.close();
|
|
@@ -425,37 +449,3 @@ async function componentStatus(home, component, platform, requireReady = false)
|
|
|
425
449
|
});
|
|
426
450
|
}
|
|
427
451
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
428
|
-
function parse(args) {
|
|
429
|
-
const flags = {}, positional = [];
|
|
430
|
-
for (let i = 0; i < args.length; i++) {
|
|
431
|
-
const arg = args[i] === "-h" ? "--help" : args[i] === "-v" ? "--version" : args[i];
|
|
432
|
-
if (!arg.startsWith("-")) {
|
|
433
|
-
positional.push(arg);
|
|
434
|
-
continue;
|
|
435
|
-
}
|
|
436
|
-
const match = /^--([a-z-]+)(?:=(.*))?$/.exec(arg);
|
|
437
|
-
if (!match ||
|
|
438
|
-
![
|
|
439
|
-
"home",
|
|
440
|
-
"profile",
|
|
441
|
-
"manifest",
|
|
442
|
-
"json",
|
|
443
|
-
"help",
|
|
444
|
-
"version",
|
|
445
|
-
"autostart",
|
|
446
|
-
"lines",
|
|
447
|
-
"follow"
|
|
448
|
-
].includes(match[1]) ||
|
|
449
|
-
Object.hasOwn(flags, match[1]))
|
|
450
|
-
throw new Error("INVALID_ARGUMENTS");
|
|
451
|
-
const key = match[1];
|
|
452
|
-
flags[key] = ["json", "help", "version", "follow"].includes(key)
|
|
453
|
-
? "true"
|
|
454
|
-
: (match[2] ?? args[++i]);
|
|
455
|
-
if (!flags[key] ||
|
|
456
|
-
flags[key].startsWith("--") ||
|
|
457
|
-
(key === "autostart" && !["true", "false"].includes(flags[key])))
|
|
458
|
-
throw new Error("INVALID_ARGUMENTS");
|
|
459
|
-
}
|
|
460
|
-
return { flags, positional };
|
|
461
|
-
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
3
|
"adapters": [
|
|
4
|
+
{
|
|
5
|
+
"type": "dsh",
|
|
6
|
+
"module": "@mininglamp-oss/octo-runtime-adapter-dsh",
|
|
7
|
+
"export": "dshAdapter"
|
|
8
|
+
},
|
|
4
9
|
{
|
|
5
10
|
"type": "codex",
|
|
6
11
|
"module": "@mininglamp-oss/octo-runtime-adapter-codex",
|
|
@@ -68,8 +73,53 @@
|
|
|
68
73
|
}
|
|
69
74
|
],
|
|
70
75
|
"extras": [
|
|
71
|
-
{
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
{
|
|
77
|
+
"name": "channel-gateway",
|
|
78
|
+
"description": "Connect Octo IM Bots to local Agent execution",
|
|
79
|
+
"configExample": {
|
|
80
|
+
"bots": [
|
|
81
|
+
{
|
|
82
|
+
"api_url": "https://im.example.com/api",
|
|
83
|
+
"bot_id": "<BOT_ID>",
|
|
84
|
+
"bf_token": "<BOT_TOKEN>",
|
|
85
|
+
"adapter": {
|
|
86
|
+
"adapter_type": "codex",
|
|
87
|
+
"workdir": "/absolute/workspace",
|
|
88
|
+
"model": "<MODEL_ID>",
|
|
89
|
+
"effort": "medium"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"module": "@mininglamp-oss/octo-runtime-extra-channel-gateway"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "channel-wecom",
|
|
98
|
+
"description": "Connect WeCom Bots to local Agent execution",
|
|
99
|
+
"configExample": {
|
|
100
|
+
"bots": [
|
|
101
|
+
{
|
|
102
|
+
"bot_id": "<BOT_ID>",
|
|
103
|
+
"app_secret": "<APP_SECRET>",
|
|
104
|
+
"adapter": {
|
|
105
|
+
"adapter_type": "codex",
|
|
106
|
+
"workdir": "/absolute/workspace",
|
|
107
|
+
"model": "<MODEL_ID>",
|
|
108
|
+
"effort": "medium"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
"module": "@mininglamp-oss/octo-runtime-extra-channel-wecom"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"name": "webui",
|
|
117
|
+
"description": "Open a local browser workspace for Agent conversations",
|
|
118
|
+
"configExample": {
|
|
119
|
+
"port": 13888,
|
|
120
|
+
"sessionStorePath": "/absolute/host-home/extras/webui/sessions.json"
|
|
121
|
+
},
|
|
122
|
+
"module": "@mininglamp-oss/octo-runtime-extra-webui"
|
|
123
|
+
}
|
|
74
124
|
]
|
|
75
125
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ModuleManifest } from "@mininglamp-oss/octo-runtime-adapter-sdk/module-manifest";
|
|
2
|
-
/** CLI
|
|
2
|
+
/** CLI 独占内置、Home 与全局 Extra 目录;SDK 不扫描,显式清单完全替换。 */
|
|
3
3
|
export declare function loadCliManifest(home: string, override?: string, report?: (message: string) => void): Promise<ModuleManifest>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { join, resolve } from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { mergeModuleManifests, readModuleManifest } from "@mininglamp-oss/octo-runtime-adapter-sdk/module-manifest";
|
|
4
|
-
|
|
4
|
+
import { discoverGlobalExtras, mergeGlobalExtras } from "./global-extras.js";
|
|
5
|
+
/** CLI 独占内置、Home 与全局 Extra 目录;SDK 不扫描,显式清单完全替换。 */
|
|
5
6
|
export async function loadCliManifest(home, override, report = (message) => console.error(message)) {
|
|
6
7
|
if (override)
|
|
7
8
|
return readModuleManifest(resolve(override), { legacy: true });
|
|
8
9
|
const builtin = await readModuleManifest(fileURLToPath(new URL("./manifest.json", import.meta.url)));
|
|
9
10
|
const extension = await readModuleManifest(join(home, "manifest.json"), { optional: true });
|
|
10
|
-
return mergeModuleManifests(builtin, extension, report);
|
|
11
|
+
return mergeGlobalExtras(mergeModuleManifests(builtin, extension, report), await discoverGlobalExtras(report), report);
|
|
11
12
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { constants } from "node:fs";
|
|
2
|
+
import { readFile, mkdir, writeFile, rename, lstat, open, rm } from "node:fs/promises";
|
|
2
3
|
import { parseEnv, promisify } from "node:util";
|
|
3
4
|
import { execFile } from "node:child_process";
|
|
4
5
|
import { randomUUID } from "node:crypto";
|
|
@@ -134,8 +135,19 @@ export async function syncCliOpenClawToolEnvironment(runtimeRoot, extras) {
|
|
|
134
135
|
(url.protocol !== "https:" &&
|
|
135
136
|
!(url.protocol === "http:" && ["127.0.0.1", "localhost", "[::1]"].includes(url.hostname))))
|
|
136
137
|
throw new Error("IM_API_URL_INVALID");
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
let end = url.pathname.length;
|
|
139
|
+
while (end > 0 && url.pathname[end - 1] === "/")
|
|
140
|
+
end--;
|
|
141
|
+
url.pathname = url.pathname.slice(0, end).replace(/\/api$/, "");
|
|
142
|
+
// 去掉 /api 后可能露出多重尾斜杠,仍需全部移除,并保留路径内部的分隔符。
|
|
143
|
+
const href = url.href;
|
|
144
|
+
end = href.length;
|
|
145
|
+
while (end > 0 && href[end - 1] === "/")
|
|
146
|
+
end--;
|
|
147
|
+
values = {
|
|
148
|
+
OCTO_BOT_TOKEN: token,
|
|
149
|
+
OCTO_API_BASE_URL: href.slice(0, end)
|
|
150
|
+
};
|
|
139
151
|
}
|
|
140
152
|
if (!values)
|
|
141
153
|
return { written: false, restartRequired: false };
|
|
@@ -149,10 +161,23 @@ export async function syncCliOpenClawToolEnvironment(runtimeRoot, extras) {
|
|
|
149
161
|
throw new Error("OPENCLAW_ENV_DIRECTORY_INVALID");
|
|
150
162
|
let previous = "";
|
|
151
163
|
try {
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
164
|
+
const handle = await open(file, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
|
|
165
|
+
try {
|
|
166
|
+
// 校验、读取和收紧权限绑定同一目标;拒绝链接,避免检查后重新按路径操作。
|
|
167
|
+
const info = await handle.stat();
|
|
168
|
+
if (!info.isFile())
|
|
169
|
+
throw new Error("OPENCLAW_ENV_FILE_INVALID");
|
|
170
|
+
if (!constants.O_NOFOLLOW) {
|
|
171
|
+
const entry = await lstat(file);
|
|
172
|
+
if (!entry.isFile() || entry.dev !== info.dev || entry.ino !== info.ino)
|
|
173
|
+
throw new Error("OPENCLAW_ENV_FILE_INVALID");
|
|
174
|
+
}
|
|
175
|
+
await handle.chmod(0o600);
|
|
176
|
+
previous = await handle.readFile("utf8");
|
|
177
|
+
}
|
|
178
|
+
finally {
|
|
179
|
+
await handle.close();
|
|
180
|
+
}
|
|
156
181
|
}
|
|
157
182
|
catch (error) {
|
|
158
183
|
if (error.code !== "ENOENT")
|
|
@@ -170,7 +195,6 @@ export async function syncCliOpenClawToolEnvironment(runtimeRoot, extras) {
|
|
|
170
195
|
Object.entries(values).some(([key, value]) => after[key] !== value))
|
|
171
196
|
throw new Error("OPENCLAW_ENV_UPDATE_INVALID");
|
|
172
197
|
if (content === previous) {
|
|
173
|
-
await chmod(file, 0o600);
|
|
174
198
|
return { file, written: false, restartRequired: true };
|
|
175
199
|
}
|
|
176
200
|
const temporary = join(origin.openclaw_home, `.octo-env-${randomUUID()}.tmp`);
|
|
@@ -99,10 +99,24 @@ export function describeError(error, fallback = "COMMAND_FAILED") {
|
|
|
99
99
|
KERNEL_UNAVAILABLE: "Kernel is unavailable. Check executor-kernel status; Extras can remain running.",
|
|
100
100
|
INVALID_ARGUMENTS: "Use --help to see the available commands and flags.",
|
|
101
101
|
SETUP_IN_PROGRESS: "Another component lifecycle operation is in progress. Wait for it to finish, then retry.",
|
|
102
|
+
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.",
|
|
103
|
+
ORPHAN_CLEANUP_OWNER_ALIVE: "The original Kernel or worker is still alive or its identity cannot be verified. Stop it safely before acknowledging cleanup.",
|
|
104
|
+
ORPHAN_CLEANUP_NOT_PENDING: "There is no valid incomplete orphan cleanup to acknowledge. Run doctor with the same --home.",
|
|
102
105
|
SERVICE_NOT_INSTALLED: "Run this component's install command, then start it.",
|
|
103
106
|
NOT_INSTALLED: "Run this component's install command, then start it.",
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
EXTRA_COMMAND_FAILED: "The Extra command failed. No private backend error is printed; check its input and configuration, then retry.",
|
|
108
|
+
EXTRA_CONFIG_CONFLICT: "Configuration changed after this command read it. Read the latest configuration and retry.",
|
|
109
|
+
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.",
|
|
110
|
+
EXTRA_COMMAND_API_UNSUPPORTED: "This CLI supports Extra command apiVersion 1. Install a compatible command extension.",
|
|
111
|
+
EXTRA_COMMAND_DEFINITION_INVALID: "Command definitions must have unique names and valid options; lifecycle and host option names are reserved.",
|
|
112
|
+
EXTRA_COMMAND_NAMESPACE_CONFLICT: "An Extra name conflicts with a Runtime command. Rename its manifest entry.",
|
|
113
|
+
EXTRA_COMMAND_NOT_FOUND: "Unknown command. Use --help on the service command to see available subcommands.",
|
|
114
|
+
EXTRA_COMMAND_CANCELLED: "The command was cancelled. Any save that already completed remains persisted.",
|
|
115
|
+
EXTRA_COMMAND_STDIN_REQUIRED: "Pipe the required input through stdin; do not put credentials in command arguments.",
|
|
116
|
+
EXTRA_NOT_REGISTERED: "Save the service configuration using its configure or extraset subcommand before starting it.",
|
|
117
|
+
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.",
|
|
118
|
+
EXTRA_NAME_MISMATCH: "The selected Extra must export the same name as its catalog entry. Check the reported package origin.",
|
|
119
|
+
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.",
|
|
106
120
|
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.",
|
|
107
121
|
MANIFEST_INVALID: "Check manifest.json: version must be 1 and adapters/extras must be valid arrays without duplicate keys.",
|
|
108
122
|
MANAGER_UNAVAILABLE: "Run doctor and check the current user's native service manager.",
|
|
@@ -6,4 +6,9 @@ export interface PlayboardOptions {
|
|
|
6
6
|
home?: string;
|
|
7
7
|
profile?: string;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* CLI 单次执行入口:读取一个 InvokeInput,原生构造并拥有本次临时 Kernel,消费源帧后关闭。
|
|
11
|
+
* 返回执行退出码;关闭失败仍拒绝,并保留已发生的执行错误或非零结果,不能假报清理成功。
|
|
12
|
+
* Home/profile 属于调用者,仅删除本次创建的临时目录,不改变公共 SDK 调用合同。
|
|
13
|
+
*/
|
|
9
14
|
export declare function runPlayboard(options: PlayboardOptions): Promise<number>;
|
|
@@ -9,6 +9,11 @@ import { tmpdir } from "node:os";
|
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { identifyInvokeInput, isHostTerminal, isTerminal } from "@mininglamp-oss/octo-runtime-protocol";
|
|
11
11
|
import { INVOKE_REQUEST_MAX_BYTES } from "@mininglamp-oss/octo-runtime-protocol";
|
|
12
|
+
/**
|
|
13
|
+
* CLI 单次执行入口:读取一个 InvokeInput,原生构造并拥有本次临时 Kernel,消费源帧后关闭。
|
|
14
|
+
* 返回执行退出码;关闭失败仍拒绝,并保留已发生的执行错误或非零结果,不能假报清理成功。
|
|
15
|
+
* Home/profile 属于调用者,仅删除本次创建的临时目录,不改变公共 SDK 调用合同。
|
|
16
|
+
*/
|
|
12
17
|
export async function runPlayboard(options) {
|
|
13
18
|
if (options.input.isTTY) {
|
|
14
19
|
throw new Error("playboard requires a JSON request on stdin; use <<< '...JSON...' or < request.json");
|
|
@@ -46,6 +51,9 @@ export async function runPlayboard(options) {
|
|
|
46
51
|
throw new Error("RUNTIME_CONFIGURATION_NOT_FOUND: request profile differs from --profile");
|
|
47
52
|
input.runMetadata = { ...input.runMetadata, profile };
|
|
48
53
|
const output = options.output ?? writeLine;
|
|
54
|
+
// Unix socket 的路径预算小于普通文件路径;固定短根,避免 TMPDIR 嵌套或中文路径超限。
|
|
55
|
+
// mkdtemp 创建本次独占的 0700 目录;常驻服务仍使用 Runtime Home,Windows 保留命名管道。
|
|
56
|
+
const temporary = await mkdtemp(join(process.platform === "win32" ? tmpdir() : "/tmp", "op-"));
|
|
49
57
|
const controller = new AbortController();
|
|
50
58
|
let interrupted = 0;
|
|
51
59
|
const onInterrupt = () => {
|
|
@@ -64,7 +72,9 @@ export async function runPlayboard(options) {
|
|
|
64
72
|
process.once("SIGINT", onInterrupt);
|
|
65
73
|
process.once("SIGTERM", onTerminate);
|
|
66
74
|
let kernel;
|
|
67
|
-
|
|
75
|
+
let outcome;
|
|
76
|
+
let primaryFailure;
|
|
77
|
+
let cleanupFailure;
|
|
68
78
|
try {
|
|
69
79
|
const paths = runtimePaths(home, profile);
|
|
70
80
|
const manifest = await loadCliManifest(home, options.manifest);
|
|
@@ -101,25 +111,43 @@ export async function runPlayboard(options) {
|
|
|
101
111
|
if (!("kind" in frame) && isTerminal(frame))
|
|
102
112
|
exitCode = frame.type === "run.completed" ? 0 : frame.type === "run.cancelled" ? 130 : 1;
|
|
103
113
|
}
|
|
104
|
-
|
|
114
|
+
outcome = interrupted || exitCode;
|
|
105
115
|
}
|
|
106
116
|
catch (error) {
|
|
107
117
|
if (interrupted)
|
|
108
|
-
|
|
109
|
-
|
|
118
|
+
outcome = interrupted;
|
|
119
|
+
else
|
|
120
|
+
primaryFailure = { error };
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
await closeKernel(kernel);
|
|
124
|
+
await rm(temporary, { recursive: true, force: true });
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
cleanupFailure = { error };
|
|
110
128
|
}
|
|
111
129
|
finally {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
130
|
+
if (!options.output)
|
|
131
|
+
process.stdout.removeListener("error", onOutputError);
|
|
132
|
+
process.removeListener("SIGINT", onInterrupt);
|
|
133
|
+
process.removeListener("SIGTERM", onTerminate);
|
|
134
|
+
}
|
|
135
|
+
// 清理之后统一选择结果,避免 finally 的拒绝覆盖主结果。保留两个原始异常对象;
|
|
136
|
+
// 取消/失败已有帧不改写,清理失败仍非零退出,不返回原来的成功码。
|
|
137
|
+
if (cleanupFailure) {
|
|
138
|
+
const cleanupError = cleanupFailure.error;
|
|
139
|
+
const cleanupMessage = cleanupError instanceof Error ? cleanupError.message : String(cleanupError);
|
|
140
|
+
if (primaryFailure) {
|
|
141
|
+
const primary = primaryFailure.error;
|
|
142
|
+
throw new AggregateError([primary, cleanupError], `${primary instanceof Error ? primary.message : String(primary)}; cleanup: ${cleanupMessage}`, { cause: cleanupError });
|
|
121
143
|
}
|
|
144
|
+
if (outcome !== undefined && outcome !== 0)
|
|
145
|
+
throw new AggregateError([cleanupError], `Playboard exited with code ${outcome}; cleanup: ${cleanupMessage}`, { cause: cleanupError });
|
|
146
|
+
throw cleanupError;
|
|
122
147
|
}
|
|
148
|
+
if (primaryFailure)
|
|
149
|
+
throw primaryFailure.error;
|
|
150
|
+
return outcome ?? 1;
|
|
123
151
|
}
|
|
124
152
|
function writeLine(line) {
|
|
125
153
|
return new Promise((resolve, reject) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { cliEntrypoint } from "./cli-entrypoint.js";
|
|
4
4
|
import { componentServiceId } from "@mininglamp-oss/octo-runtime-host-sdk";
|
|
5
5
|
import { createServiceBackend } from "@mininglamp-oss/octo-runtime-cross-service";
|
|
6
6
|
export function resolveServiceControl(options = {}) {
|
|
@@ -19,7 +19,7 @@ export function resolveServiceControl(options = {}) {
|
|
|
19
19
|
description: `Octo Runtime ${component}`,
|
|
20
20
|
command: resolve(options.nodeExecutable ?? process.execPath),
|
|
21
21
|
args: [
|
|
22
|
-
resolve(options.cliEntrypoint ??
|
|
22
|
+
resolve(options.cliEntrypoint ?? cliEntrypoint()),
|
|
23
23
|
component,
|
|
24
24
|
"run",
|
|
25
25
|
"--home",
|