@mininglamp-oss/octo-runtime 1.1.4 → 1.1.6

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.
Files changed (177) hide show
  1. package/README.md +61 -37
  2. package/apps/cli/README.md +58 -22
  3. package/apps/cli/dist/adapter-configurations.d.ts +4 -0
  4. package/apps/cli/dist/adapter-configurations.js +102 -0
  5. package/apps/cli/dist/build-info.json +2 -2
  6. package/apps/cli/dist/cli-entrypoint.d.ts +2 -0
  7. package/apps/cli/dist/cli-entrypoint.js +16 -0
  8. package/apps/cli/dist/command-tree.d.ts +20 -0
  9. package/apps/cli/dist/command-tree.js +402 -0
  10. package/apps/cli/dist/extra-command-config.d.ts +4 -0
  11. package/apps/cli/dist/extra-command-config.js +50 -0
  12. package/apps/cli/dist/extra-commands.d.ts +15 -0
  13. package/apps/cli/dist/extra-commands.js +275 -0
  14. package/apps/cli/dist/extras.js +14 -2
  15. package/apps/cli/dist/global-extras.d.ts +16 -0
  16. package/apps/cli/dist/global-extras.js +201 -0
  17. package/apps/cli/dist/help.d.ts +4 -1
  18. package/apps/cli/dist/help.js +31 -79
  19. package/apps/cli/dist/logs.js +8 -4
  20. package/apps/cli/dist/main.d.ts +2 -0
  21. package/apps/cli/dist/main.js +38 -68
  22. package/apps/cli/dist/manifest.json +48 -3
  23. package/apps/cli/dist/module-manifest.d.ts +1 -1
  24. package/apps/cli/dist/module-manifest.js +3 -2
  25. package/apps/cli/dist/output.js +18 -2
  26. package/apps/cli/dist/playboard.js +3 -2
  27. package/apps/cli/dist/service-control.js +2 -2
  28. package/apps/cli/dist/state.js +48 -19
  29. package/dist/public/channel-gateway-commands.d.ts +1 -0
  30. package/dist/public/channel-gateway-commands.js +1 -0
  31. package/dist/public/channel-wecom-commands.d.ts +1 -0
  32. package/dist/public/channel-wecom-commands.js +1 -0
  33. package/dist/public/extra.d.ts +1 -0
  34. package/dist/public/extra.js +1 -0
  35. package/dist/public/host.d.ts +2 -4
  36. package/dist/public/host.js +1 -2
  37. package/dist/public/webui-commands.d.ts +1 -0
  38. package/dist/public/webui-commands.js +1 -0
  39. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/dist/index.js +5 -2
  40. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
  41. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
  42. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
  43. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
  44. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.d.ts +3 -4
  45. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.js +161 -26
  46. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
  47. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +3 -1
  48. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
  49. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-G5PWGRL5.js → chunk-3GXX5VD5.js} +24 -90
  50. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-UOQRXV3Q.js → chunk-FWAPYRV2.js} +1 -1
  51. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-DYOJCNWF.js → chunk-IW62UM3C.js} +1 -1
  52. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.d.ts +1 -1
  53. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +1 -1
  54. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +3 -3
  55. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.d.ts +1 -1
  56. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +2 -2
  57. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +2 -2
  58. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +3 -3
  59. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +8 -2
  60. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
  61. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
  62. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
  63. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
  64. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
  65. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
  66. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
  67. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
  68. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +1 -1
  69. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +8 -4
  70. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/module-manifest.d.ts +6 -0
  71. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/module-manifest.js +16 -4
  72. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.d.ts +12 -0
  73. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.js +91 -0
  74. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log-worker.js +2 -2
  75. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log.js +13 -1
  76. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.d.ts +9 -0
  77. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.js +40 -0
  78. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +3 -2
  79. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
  80. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configurations.d.ts +4 -0
  81. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapter-configurations.js +102 -0
  82. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
  83. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/cli-entrypoint.d.ts +2 -0
  84. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/cli-entrypoint.js +16 -0
  85. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.d.ts +20 -0
  86. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.js +402 -0
  87. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-command-config.d.ts +4 -0
  88. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-command-config.js +50 -0
  89. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-commands.d.ts +15 -0
  90. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extra-commands.js +275 -0
  91. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/extras.js +14 -2
  92. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/global-extras.d.ts +16 -0
  93. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/global-extras.js +201 -0
  94. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.d.ts +4 -1
  95. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/help.js +31 -79
  96. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/logs.js +8 -4
  97. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.d.ts +2 -0
  98. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +38 -68
  99. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +48 -3
  100. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.d.ts +1 -1
  101. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/module-manifest.js +3 -2
  102. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +18 -2
  103. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +3 -2
  104. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/service-control.js +2 -2
  105. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/state.js +48 -19
  106. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +25 -24
  107. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
  108. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +8 -3
  109. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +47 -4
  110. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
  111. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/client.js +2 -0
  112. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.js +4 -1
  113. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/process.d.ts +7 -0
  114. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/process.js +79 -5
  115. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.d.ts +3 -1
  116. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +22 -6
  117. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/service.js +2 -1
  118. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.d.ts +5 -3
  119. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/submission-error.js +12 -6
  120. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/supervisor.d.ts +4 -2
  121. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/supervisor.js +131 -43
  122. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -4
  123. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/context-gap.js +2 -2
  124. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +36 -20
  125. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/commands.d.ts +4 -0
  126. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/commands.js +124 -0
  127. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js +3 -0
  128. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/model-wait.d.ts +29 -0
  129. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/model-wait.js +171 -0
  130. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.d.ts +4 -1
  131. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.js +48 -6
  132. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/run-projector.d.ts +2 -0
  133. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/auth.d.ts +1 -1
  134. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/auth.js +2 -2
  135. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.d.ts +7 -0
  136. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connection-error.js +44 -3
  137. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.js +1 -1
  138. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/reasoning-frame.js +37 -0
  139. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.js +8 -5
  140. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +10 -6
  141. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/commands.d.ts +4 -0
  142. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/commands.js +128 -0
  143. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +9 -5
  144. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/commands.d.ts +3 -0
  145. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/commands.js +51 -0
  146. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +7 -3
  147. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/endpoint.d.ts +2 -0
  148. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/endpoint.js +5 -3
  149. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-commands.d.ts +70 -0
  150. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/extra-commands.js +16 -0
  151. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.d.ts +1 -3
  152. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/index.js +1 -2
  153. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +8 -4
  154. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +2 -1
  155. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +9 -1
  156. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +9 -0
  157. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  158. package/node_modules/commander/LICENSE +22 -0
  159. package/node_modules/commander/Readme.md +1172 -0
  160. package/node_modules/commander/index.js +21 -0
  161. package/node_modules/commander/lib/argument.js +147 -0
  162. package/node_modules/commander/lib/command.js +2790 -0
  163. package/node_modules/commander/lib/error.js +36 -0
  164. package/node_modules/commander/lib/help.js +731 -0
  165. package/node_modules/commander/lib/option.js +377 -0
  166. package/node_modules/commander/lib/suggestSimilar.js +99 -0
  167. package/node_modules/commander/package-support.json +19 -0
  168. package/node_modules/commander/package.json +64 -0
  169. package/node_modules/commander/typings/index.d.ts +1113 -0
  170. package/package.json +41 -27
  171. package/packages/octo-runtime-protocol/schema/protocol.schema.json +14 -0
  172. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/desktop-entry.d.ts +0 -1
  173. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/desktop-entry.js +0 -16
  174. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/launch.d.ts +0 -15
  175. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/launch.js +0 -22
  176. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/native.d.ts +0 -16
  177. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/native.js +0 -160
@@ -0,0 +1,275 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { fileURLToPath } from "node:url";
3
+ import { describeError } from "./output.js";
4
+ import { dirname, isAbsolute, join } from "node:path";
5
+ import { createInterface } from "node:readline/promises";
6
+ import { ExtraCommandError } from "@mininglamp-oss/octo-runtime-host-sdk";
7
+ import { resolveModuleSpecifier } from "@mininglamp-oss/octo-runtime-adapter-sdk/module-manifest";
8
+ import { commandConfig } from "./extra-command-config.js";
9
+ import { runtimePaths } from "./state.js";
10
+ import { resolveExtraModule } from "./global-extras.js";
11
+ import { lifecycleCommands } from "./help.js";
12
+ const reservedOptions = new Set([
13
+ "home",
14
+ "manifest",
15
+ "profile",
16
+ "json",
17
+ "help",
18
+ "version",
19
+ "autostart",
20
+ "lines",
21
+ "follow",
22
+ "acknowledge-orphan-cleanup"
23
+ ]);
24
+ const validName = /^[a-z][a-z0-9-]{0,63}$/;
25
+ const validOptionName = /^[a-z][a-z0-9_-]{0,63}$/;
26
+ /** 仅执行已解析的自有命令;CLI 持有 IO、取消与配置锁,业务 handler 不管理宿主服务。 */
27
+ export async function runExtraCommand(parsed, dependencies) {
28
+ const { entry, command, input: commandInput, home: commandHome } = parsed.extra;
29
+ const { flags } = parsed;
30
+ const name = entry.name;
31
+ const output = dependencies.output ??
32
+ ((line) => {
33
+ process.stdout.write(`${line}\n`);
34
+ });
35
+ const controller = new AbortController();
36
+ const cancel = () => controller.abort();
37
+ const externalCancel = () => controller.abort();
38
+ process.once("SIGINT", cancel);
39
+ process.once("SIGTERM", cancel);
40
+ dependencies.commandSignal?.addEventListener("abort", externalCancel, { once: true });
41
+ if (dependencies.commandSignal?.aborted)
42
+ controller.abort();
43
+ const input = dependencies.input ?? process.stdin;
44
+ let stdinRead = false;
45
+ const context = {
46
+ name,
47
+ home: commandHome,
48
+ signal: controller.signal,
49
+ interactive: Boolean(input.isTTY),
50
+ ...commandConfig(runtimePaths(commandHome, "default", dependencies.platform), name, entry.module, controller.signal),
51
+ output,
52
+ async readStdin() {
53
+ if (stdinRead || input.isTTY)
54
+ throw new Error("EXTRA_COMMAND_STDIN_REQUIRED");
55
+ stdinRead = true;
56
+ return readInput(input, controller.signal);
57
+ },
58
+ async prompt(question) {
59
+ if (!input.isTTY)
60
+ throw new Error("EXTRA_COMMAND_INTERACTIVE_REQUIRED");
61
+ const terminal = createInterface({ input, output: process.stderr });
62
+ try {
63
+ return await terminal.question(question, { signal: controller.signal });
64
+ }
65
+ finally {
66
+ terminal.close();
67
+ }
68
+ }
69
+ };
70
+ try {
71
+ controller.signal.throwIfAborted();
72
+ const result = await command.run(context, commandInput);
73
+ if (result?.exitCode !== undefined &&
74
+ (!Number.isInteger(result.exitCode) || result.exitCode < 0 || result.exitCode > 255))
75
+ throw new Error("EXTRA_COMMAND_RESULT_INVALID");
76
+ if (result?.message !== undefined && typeof result.message !== "string")
77
+ throw new Error("EXTRA_COMMAND_RESULT_INVALID");
78
+ if (!flags.json && result?.message !== undefined)
79
+ output(result.message);
80
+ else if (result?.value !== undefined)
81
+ output(JSON.stringify(result.value, null, 2));
82
+ return result?.exitCode ?? 0;
83
+ }
84
+ catch (error) {
85
+ if (controller.signal.aborted)
86
+ throw new Error("EXTRA_COMMAND_CANCELLED", { cause: error });
87
+ // 第三方异常可能直接包含凭据;只透出显式安全诊断和宿主固定错误集合。
88
+ if (error instanceof ExtraCommandError)
89
+ throw error;
90
+ const safe = new Set([
91
+ "EXTRA_CONFIG_CONFLICT",
92
+ "EXTRA_CONFIG_TOO_LARGE",
93
+ "EXTRA_CONFIG_OBJECT_REQUIRED",
94
+ "EXTRA_CONFIG_JSON_REQUIRED",
95
+ "EXTRA_CONFIG_FIELD_INVALID",
96
+ "EXTRA_CONFIG_PERMISSIONS_INVALID",
97
+ "EXTRA_CONFIG_FILE_INVALID",
98
+ "EXTRA_MODULE_MIGRATION_REQUIRED",
99
+ "SETUP_IN_PROGRESS",
100
+ "EXTRA_COMMAND_STDIN_REQUIRED",
101
+ "EXTRA_COMMAND_STDIN_CLOSED",
102
+ "EXTRA_COMMAND_INTERACTIVE_REQUIRED",
103
+ "EXTRA_COMMAND_RESULT_INVALID"
104
+ ]);
105
+ if (error instanceof Error && safe.has(error.message))
106
+ throw new Error(error.message, { cause: error });
107
+ throw new Error("EXTRA_COMMAND_FAILED", { cause: error });
108
+ }
109
+ finally {
110
+ process.removeListener("SIGINT", cancel);
111
+ process.removeListener("SIGTERM", cancel);
112
+ dependencies.commandSignal?.removeEventListener("abort", externalCancel);
113
+ }
114
+ }
115
+ /** 仅解析选中模块的可选导出;解析不存在与导入后依赖损坏严格分开。 */
116
+ export async function loadExtraCommands(entry) {
117
+ let specifier;
118
+ if (entry.commands)
119
+ specifier = resolveModuleSpecifier(entry.commands, entry.sourceManifest);
120
+ else {
121
+ if (entry.module.startsWith(".") ||
122
+ isAbsolute(entry.module) ||
123
+ /^[a-z][a-z0-9+.-]*:/i.test(entry.module))
124
+ return undefined;
125
+ try {
126
+ if (!(await declaresExports(entry)))
127
+ return undefined;
128
+ specifier = resolveModuleSpecifier(`${entry.module}/commands`, entry.sourceManifest);
129
+ }
130
+ catch (error) {
131
+ if (error.code === "ERR_PACKAGE_PATH_NOT_EXPORTED")
132
+ return undefined;
133
+ throw new Error("EXTRA_COMMAND_LOAD_FAILED", { cause: error });
134
+ }
135
+ }
136
+ try {
137
+ const module = (await import(specifier));
138
+ if (!module.default || module.default.apiVersion !== 1)
139
+ throw new Error("EXTRA_COMMAND_API_UNSUPPORTED");
140
+ return module.default;
141
+ }
142
+ catch (error) {
143
+ if (error instanceof Error && error.message === "EXTRA_COMMAND_API_UNSUPPORTED")
144
+ throw error;
145
+ throw new Error("EXTRA_COMMAND_LOAD_FAILED", { cause: error });
146
+ }
147
+ }
148
+ /** 从选中服务的真实位置查所属包元数据;旧包未声明 exports 就没有可选命令入口。 */
149
+ async function declaresExports(entry) {
150
+ // 全局来源复用服务的安装身份检查;包被移除或替换后不能回退到祖先同名包。
151
+ // 这里只解析服务地址用于查元数据,不 import 或启动服务。
152
+ const service = await resolveExtraModule(entry);
153
+ const parts = entry.module.split("/");
154
+ const packageName = entry.module.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
155
+ let directory = dirname(fileURLToPath(service));
156
+ while (true) {
157
+ try {
158
+ const value = JSON.parse(await readFile(join(directory, "package.json"), "utf8"));
159
+ if (value && typeof value === "object" && "name" in value && value.name === packageName)
160
+ return "exports" in value && value.exports !== null;
161
+ }
162
+ catch (error) {
163
+ if (error.code !== "ENOENT")
164
+ throw error;
165
+ }
166
+ const parent = dirname(directory);
167
+ if (parent === directory)
168
+ throw new Error("EXTRA_COMMAND_LOAD_FAILED");
169
+ directory = parent;
170
+ }
171
+ }
172
+ function isCommandArray(value) {
173
+ return Array.isArray(value);
174
+ }
175
+ export function validateCommands(extension) {
176
+ let count = 0;
177
+ const walk = (commands, depth) => {
178
+ if (!isCommandArray(commands) || depth > 8 || commands.length === 0)
179
+ throw new Error("EXTRA_COMMAND_DEFINITION_INVALID");
180
+ const names = new Set();
181
+ for (const command of commands) {
182
+ if (++count > 128 ||
183
+ !command ||
184
+ !validName.test(command.name) ||
185
+ names.has(command.name) ||
186
+ lifecycleCommands.has(command.name) ||
187
+ !command.description ||
188
+ typeof command.description !== "string")
189
+ throw new Error("EXTRA_COMMAND_DEFINITION_INVALID");
190
+ names.add(command.name);
191
+ if (Boolean(command.commands) === Boolean(command.run) ||
192
+ (command.run !== undefined && typeof command.run !== "function"))
193
+ throw new Error("EXTRA_COMMAND_DEFINITION_INVALID");
194
+ const options = new Set();
195
+ if (command.options !== undefined && !isCommandArray(command.options))
196
+ throw new Error("EXTRA_COMMAND_DEFINITION_INVALID");
197
+ for (const option of command.options ?? []) {
198
+ if (!option ||
199
+ !validOptionName.test(option.name) ||
200
+ options.has(option.name) ||
201
+ reservedOptions.has(option.name) ||
202
+ !["string", "boolean"].includes(option.type) ||
203
+ typeof option.description !== "string")
204
+ throw new Error("EXTRA_COMMAND_DEFINITION_INVALID");
205
+ options.add(option.name);
206
+ }
207
+ if (command.arguments !== undefined &&
208
+ (!Array.isArray(command.arguments) ||
209
+ command.arguments.some((arg) => !arg || !validName.test(arg.name))))
210
+ throw new Error("EXTRA_COMMAND_DEFINITION_INVALID");
211
+ if (command.examples !== undefined &&
212
+ (!Array.isArray(command.examples) ||
213
+ command.examples.some((example) => typeof example !== "string")))
214
+ throw new Error("EXTRA_COMMAND_DEFINITION_INVALID");
215
+ if (command.commands) {
216
+ if (command.options?.length || command.arguments?.length)
217
+ throw new Error("EXTRA_COMMAND_DEFINITION_INVALID");
218
+ walk(command.commands, depth + 1);
219
+ }
220
+ }
221
+ };
222
+ walk(extension.commands, 0);
223
+ }
224
+ /** 有界 stdin 读取;取消解除监听且不等待对端 EOF,不接管调用方 stream 的生命周期。 */
225
+ function readInput(input, signal) {
226
+ return new Promise((accept, reject) => {
227
+ const chunks = [];
228
+ let size = 0;
229
+ const cleanup = () => {
230
+ input.removeListener("data", data);
231
+ input.removeListener("end", end);
232
+ input.removeListener("error", fail);
233
+ input.removeListener("close", closed);
234
+ signal.removeEventListener("abort", abort);
235
+ input.pause();
236
+ };
237
+ const fail = (error) => {
238
+ cleanup();
239
+ reject(error);
240
+ };
241
+ const abort = () => fail(new Error("EXTRA_COMMAND_CANCELLED"));
242
+ const data = (chunk) => {
243
+ const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
244
+ size += bytes.length;
245
+ if (size > 1024 * 1024)
246
+ fail(new Error("EXTRA_CONFIG_TOO_LARGE"));
247
+ else
248
+ chunks.push(bytes);
249
+ };
250
+ const end = () => {
251
+ cleanup();
252
+ accept(Buffer.concat(chunks).toString("utf8"));
253
+ };
254
+ const closed = () => fail(new Error("EXTRA_COMMAND_STDIN_CLOSED"));
255
+ input.on("data", data);
256
+ input.once("end", end);
257
+ input.once("error", fail);
258
+ input.once("close", closed);
259
+ signal.addEventListener("abort", abort, { once: true });
260
+ if (signal.aborted)
261
+ abort();
262
+ else if (input.readableEnded)
263
+ end();
264
+ });
265
+ }
266
+ /** 只允许插件显式构造的安全诊断进入文本输出;任意异常仍沿宿主白名单处理。 */
267
+ export function commandError(error) {
268
+ if (error instanceof Error && /^EXTRA_COMMAND_[A-Z_]+$/.test(error.message)) {
269
+ const failure = describeError(error);
270
+ return { code: failure.code, message: failure.message };
271
+ }
272
+ if (error instanceof ExtraCommandError && /^[A-Z][A-Z0-9_]{1,100}$/.test(error.code))
273
+ return { code: error.code, message: error.message };
274
+ return undefined;
275
+ }
@@ -1,7 +1,7 @@
1
1
  import { join } from "node:path";
2
+ import { resolveExtraModule } from "./global-extras.js";
2
3
  import { assertExtraName, assertStoredExtra, readStoredExtra } from "@mininglamp-oss/octo-runtime-host-sdk";
3
4
  import { withSetupLock, writeJsonAtomic } from "./state.js";
4
- import { resolveModuleSpecifier } from "@mininglamp-oss/octo-runtime-adapter-sdk/module-manifest";
5
5
  /** Generic full replacement: no platform-specific CLI fields or validation. */
6
6
  export async function setExtra(paths, name, input) {
7
7
  assertExtraName(name);
@@ -44,7 +44,19 @@ export async function readExtra(paths, name, manifest) {
44
44
  module: entry.module,
45
45
  config: stored.config,
46
46
  enabled: stored.enabled,
47
- load: () => import(resolveModuleSpecifier(entry.module, entry.sourceManifest))
47
+ load: async () => {
48
+ try {
49
+ const plugin = (await import(await resolveExtraModule(entry)));
50
+ if (plugin.name !== name)
51
+ throw new Error("EXTRA_NAME_MISMATCH");
52
+ return plugin;
53
+ }
54
+ catch (error) {
55
+ if (error instanceof Error && error.message === "EXTRA_NAME_MISMATCH")
56
+ throw error;
57
+ throw new Error("EXTRA_MODULE_LOAD_FAILED", { cause: error });
58
+ }
59
+ }
48
60
  };
49
61
  }
50
62
  export async function getExtra(paths, name) {
@@ -0,0 +1,16 @@
1
+ import { type ExtraModuleEntry, type ModuleManifest } from "@mininglamp-oss/octo-runtime-adapter-sdk/module-manifest";
2
+ type Report = (message: string) => void;
3
+ interface Installation {
4
+ kind: "npm" | "pnpm" | "pnpm-isolated";
5
+ root: string;
6
+ modules: string;
7
+ }
8
+ /** 纯路径分类不证明安装身份;调用方还须核对包名、全局 bin 或有效安装组。 */
9
+ export declare function installationLayout(entry: string, platform?: NodeJS.Platform): Installation | undefined;
10
+ /** 每次只读当前 CLI 对应环境的顶层包元数据;不可用的可选目录不阻止 Kernel/manifest 使用。 */
11
+ export declare function discoverGlobalExtras(report: Report, entry?: string): Promise<ExtraModuleEntry[]>;
12
+ /** 两份清单已完成自身校验;全局候选排序后按逻辑名补缺,决胜之前不解析 exports。 */
13
+ export declare function mergeGlobalExtras(manifest: ModuleManifest, candidates: ExtraModuleEntry[], report: Report): ModuleManifest;
14
+ /** 仅在启用的 Extra 真正加载时解析入口;移除/替换后拒绝沿祖先目录加载另一份同名包。 */
15
+ export declare function resolveExtraModule(entry: ExtraModuleEntry): Promise<string>;
16
+ export {};
@@ -0,0 +1,201 @@
1
+ import { readFile, readdir, realpath } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { assertExtraName } from "@mininglamp-oss/octo-runtime-host-sdk";
4
+ import { resolveModuleSpecifier } from "@mininglamp-oss/octo-runtime-adapter-sdk/module-manifest";
5
+ import { cliEntrypoint } from "./cli-entrypoint.js";
6
+ const runtimePackage = "@mininglamp-oss/octo-runtime";
7
+ /** 纯路径分类不证明安装身份;调用方还须核对包名、全局 bin 或有效安装组。 */
8
+ export function installationLayout(entry, platform = process.platform) {
9
+ const p = platform === "win32" ? path.win32 : path.posix;
10
+ const suffix = p.join("node_modules", "@mininglamp-oss", "octo-runtime", "apps", "cli", "dist", "index.js");
11
+ if (!entry.endsWith(p.sep + suffix))
12
+ return;
13
+ const modules = entry.slice(0, -p.join("@mininglamp-oss", "octo-runtime", "apps", "cli", "dist", "index.js").length - 1);
14
+ const parent = p.dirname(modules);
15
+ if (p.basename(p.dirname(parent)) === "v11")
16
+ return { kind: "pnpm-isolated", root: p.dirname(parent), modules };
17
+ if (p.basename(parent) === "5")
18
+ return { kind: "pnpm", root: parent, modules };
19
+ if (platform === "win32")
20
+ return { kind: "npm", root: parent, modules };
21
+ if (p.basename(parent) === "lib")
22
+ return { kind: "npm", root: p.dirname(parent), modules };
23
+ }
24
+ function errorCode(error) {
25
+ return error?.code ?? "INVALID_METADATA";
26
+ }
27
+ async function metadata(file) {
28
+ const value = JSON.parse(await readFile(file, "utf8"));
29
+ if (!value || typeof value !== "object" || Array.isArray(value))
30
+ throw new Error("INVALID_METADATA");
31
+ return value;
32
+ }
33
+ async function entries(directory, report) {
34
+ try {
35
+ return await readdir(directory, { withFileTypes: true });
36
+ }
37
+ catch (error) {
38
+ report(`Global Extra discovery cannot read ${JSON.stringify(directory)} (${errorCode(error)}); manifests remain available.`);
39
+ return [];
40
+ }
41
+ }
42
+ async function installationRoots(entry, report) {
43
+ let actual;
44
+ try {
45
+ actual = await realpath(entry);
46
+ }
47
+ catch (error) {
48
+ report(`Global Extra discovery cannot locate CLI ${JSON.stringify(entry)} (${errorCode(error)}); use a Home manifest.`);
49
+ return [];
50
+ }
51
+ // pnpm argv 保留组内链接,realpath 则可能已进入共享 store;不能从共享 store 反查其他环境。
52
+ for (const candidate of new Set([path.resolve(entry), actual])) {
53
+ const layout = installationLayout(candidate);
54
+ if (!layout)
55
+ continue;
56
+ try {
57
+ const runtime = path.join(layout.modules, runtimePackage);
58
+ if ((await metadata(path.join(runtime, "package.json"))).name !== runtimePackage)
59
+ continue;
60
+ if ((await realpath(path.join(runtime, "apps/cli/dist/index.js"))) !== actual)
61
+ continue;
62
+ if (layout.kind === "pnpm-isolated") {
63
+ const roots = [];
64
+ let ownsRuntime = false;
65
+ const group = await realpath(path.dirname(layout.modules));
66
+ for (const item of await entries(layout.root, report)) {
67
+ // 只接受活动索引链接;pnpm 保留的旧 target 目录不是已安装包。
68
+ if (!item.isSymbolicLink())
69
+ continue;
70
+ const install = path.join(layout.root, item.name);
71
+ try {
72
+ const target = await realpath(install);
73
+ const data = await metadata(path.join(install, "package.json"));
74
+ if (!data.dependencies || typeof data.dependencies !== "object")
75
+ continue;
76
+ roots.push({
77
+ directory: path.join(install, "node_modules"),
78
+ directPackages: new Set(Object.keys(data.dependencies))
79
+ });
80
+ if (target === group && Object.hasOwn(data.dependencies, runtimePackage))
81
+ ownsRuntime = true;
82
+ }
83
+ catch (error) {
84
+ report(`Ignoring global install ${JSON.stringify(install)} (${errorCode(error)}).`);
85
+ }
86
+ }
87
+ if (ownsRuntime)
88
+ return roots.sort((a, b) => compare(a.directory, b.directory));
89
+ }
90
+ else if (layout.kind === "pnpm") {
91
+ const data = await metadata(path.join(layout.root, "package.json"));
92
+ await readFile(path.join(layout.modules, ".modules.yaml"));
93
+ if (data.dependencies &&
94
+ typeof data.dependencies === "object" &&
95
+ Object.hasOwn(data.dependencies, runtimePackage))
96
+ return [
97
+ { directory: layout.modules, directPackages: new Set(Object.keys(data.dependencies)) }
98
+ ];
99
+ }
100
+ else if (process.platform === "win32") {
101
+ const shim = await readFile(path.join(layout.root, "octo-runtime.cmd"), "utf8");
102
+ if (shim
103
+ .replaceAll("\\", "/")
104
+ .includes("node_modules/@mininglamp-oss/octo-runtime/apps/cli/dist/index.js"))
105
+ return [{ directory: layout.modules }];
106
+ }
107
+ else if ((await realpath(path.join(layout.root, "bin/octo-runtime"))) === actual) {
108
+ return [{ directory: layout.modules }];
109
+ }
110
+ }
111
+ catch (error) {
112
+ report(`Global Extra discovery could not verify ${JSON.stringify(layout.root)} (${errorCode(error)}).`);
113
+ }
114
+ }
115
+ report("Global Extra discovery unavailable for this CLI installation; use <Home>/manifest.json or --manifest (no PATH-based fallback).");
116
+ return [];
117
+ }
118
+ /** 每次只读当前 CLI 对应环境的顶层包元数据;不可用的可选目录不阻止 Kernel/manifest 使用。 */
119
+ export async function discoverGlobalExtras(report, entry = cliEntrypoint()) {
120
+ const found = [];
121
+ for (const root of await installationRoots(entry, report)) {
122
+ const modules = root.directory;
123
+ const packages = [];
124
+ for (const item of await entries(modules, report)) {
125
+ if (!item.isDirectory() && !item.isSymbolicLink())
126
+ continue;
127
+ if (item.name.startsWith("@")) {
128
+ for (const child of await entries(path.join(modules, item.name), report))
129
+ if (child.isDirectory() || child.isSymbolicLink())
130
+ packages.push(`${item.name}/${child.name}`);
131
+ }
132
+ else if (!item.name.startsWith("."))
133
+ packages.push(item.name);
134
+ }
135
+ for (const module of packages.sort(compare)) {
136
+ if (root.directPackages && !root.directPackages.has(module))
137
+ continue;
138
+ const match = /^(?:@[^/]+\/)?octo-runtime-extra-(.+)$/.exec(module);
139
+ if (!match)
140
+ continue;
141
+ const directory = path.join(modules, module);
142
+ try {
143
+ const name = match[1];
144
+ assertExtraName(name);
145
+ const packageInfo = await metadata(path.join(directory, "package.json"));
146
+ if (packageInfo.name !== module)
147
+ throw new Error("PACKAGE_NAME_MISMATCH");
148
+ found.push({
149
+ name,
150
+ ...(typeof packageInfo.description === "string" && packageInfo.description.trim()
151
+ ? { description: packageInfo.description }
152
+ : {}),
153
+ module,
154
+ sourceManifest: path.join(path.dirname(modules), "package.json"),
155
+ installation: { directory, realDirectory: await realpath(directory) }
156
+ });
157
+ }
158
+ catch (error) {
159
+ report(`Ignoring global Extra ${JSON.stringify(directory)} (${errorCode(error)}; check package.json name and Extra suffix).`);
160
+ }
161
+ }
162
+ }
163
+ return found.sort((a, b) => compare(a.module, b.module) || compare(a.installation.directory, b.installation.directory));
164
+ }
165
+ function compare(a, b) {
166
+ return a < b ? -1 : a > b ? 1 : 0;
167
+ }
168
+ function origin(entry) {
169
+ return JSON.stringify({
170
+ module: entry.module,
171
+ source: isDiscovered(entry) ? entry.installation.directory : entry.sourceManifest
172
+ });
173
+ }
174
+ function isDiscovered(entry) {
175
+ return "installation" in entry;
176
+ }
177
+ /** 两份清单已完成自身校验;全局候选排序后按逻辑名补缺,决胜之前不解析 exports。 */
178
+ export function mergeGlobalExtras(manifest, candidates, report) {
179
+ const selected = new Map(manifest.extras.map((entry) => [entry.name, entry]));
180
+ for (const entry of candidates) {
181
+ const previous = selected.get(entry.name);
182
+ if (previous)
183
+ report(`Ignoring global Extra "${entry.name}": selected ${origin(previous)}; ignored ${origin(entry)}.`);
184
+ else {
185
+ selected.set(entry.name, entry);
186
+ report(`Discovered global Extra "${entry.name}": selected ${origin(entry)}; configure with "octo-runtime ${entry.name} extraset", then start explicitly.`);
187
+ }
188
+ }
189
+ return { ...manifest, extras: [...selected.values()] };
190
+ }
191
+ /** 仅在启用的 Extra 真正加载时解析入口;移除/替换后拒绝沿祖先目录加载另一份同名包。 */
192
+ export async function resolveExtraModule(entry) {
193
+ if (isDiscovered(entry)) {
194
+ if ((await realpath(entry.installation.directory)) !== entry.installation.realDirectory)
195
+ throw new Error("GLOBAL_EXTRA_INSTALLATION_CHANGED");
196
+ if ((await metadata(path.join(entry.installation.directory, "package.json"))).name !==
197
+ entry.module)
198
+ throw new Error("GLOBAL_EXTRA_INSTALLATION_CHANGED");
199
+ }
200
+ return resolveModuleSpecifier(entry.module, entry.sourceManifest);
201
+ }
@@ -1,3 +1,6 @@
1
1
  export declare const cliVersion: string;
2
2
  export declare const cliVersionInfo: string;
3
- export declare function helpText(component?: string): string;
3
+ export declare const cliHelpHeader: string;
4
+ export declare const preferredRootCommands: string[];
5
+ export declare const lifecycleCommands: Map<string, string>;
6
+ export declare const rootCommands: Map<string, string>;
@@ -21,82 +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 componentDescriptions = {
25
- "executor-kernel": `Local Agent execution service. Runs requests through Provider adapters and
26
- supervises the execution worker used by Gateway, WeCom, WebUI and SDK clients.
27
- Install and authenticate your chosen Provider before running Agent tasks.
28
-
29
- Get started: octo-runtime executor-kernel start
30
- Check readiness: octo-runtime executor-kernel status`,
31
- "channel-gateway": `Connects Octo IM Bots to local Agent execution. Receives messages, invokes
32
- the Executor Kernel and sends Agent replies back to Octo IM.
33
-
34
- Configure Bots: octo-runtime extraset channel-gateway < gateway.json
35
- Start: octo-runtime channel-gateway start
36
- Agent tasks also need: octo-runtime executor-kernel start`,
37
- "channel-wecom": `Connects WeCom Bots to local Agent execution. Receives WeCom messages,
38
- invokes the Executor Kernel and sends Agent replies back to WeCom.
39
-
40
- Configure Bots: octo-runtime extraset channel-wecom < wecom.json
41
- Start: octo-runtime channel-wecom start
42
- Agent tasks also need: octo-runtime executor-kernel start`,
43
- webui: `Local browser workspace for Agent conversations and projects.
44
- Uses the Executor Kernel for Agent execution; default URL: http://127.0.0.1:13888/.
45
-
46
- Configure port and sessionStorePath: octo-runtime extraset webui < webui.json
47
- Start: octo-runtime webui start
48
- Agent tasks also need: octo-runtime executor-kernel start`
49
- };
50
- export function helpText(component) {
51
- if (component)
52
- return `Octo Runtime: ${component}
53
-
54
- ${componentDescriptions[component] ?? `Configured Extra service "${component}". Runs its registered module independently.\nConfiguration: octo-runtime extraget ${component}`}
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" ? " recover Acknowledge a blocked orphan cleanup after stopping all orphan tools\n" : " logs Tail service status logs (no conversation content)\n"}
67
-
68
- Flags: --home <path> --profile <name> --manifest <path> --json --help
69
- --manifest selects Provider/Extra modules; invocation state stays in --home/run.
70
- Install: --autostart=true|false
71
- ${component === "executor-kernel" ? "Recover: --acknowledge-orphan-cleanup (retains evidence; refuses a live owner)\n" : ""}
72
- ${component === "executor-kernel" ? "" : "Logs: --lines <1..10000> (default 200) --follow --json (NDJSON)\n"}
73
- Kernel and Extras have independent services and autostart settings.
74
- An Extra may start before Kernel and connect when Kernel becomes available.`;
75
- return `Octo Runtime CLI (${cliVersion})
76
- ${cliVersionInfo.split("\n").slice(1).join("\n")}
77
- Manage the local Agent runtime and independent services.
78
-
79
- Usage:
80
- octo-runtime executor-kernel uninstall|install|start|restart|stop|status|run
81
- octo-runtime executor-kernel recover --acknowledge-orphan-cleanup
82
- octo-runtime <extra-name> uninstall|install|start|restart|stop|status|run
83
- octo-runtime <extra-name> logs [--lines 200] [--follow] [--json]
84
- octo-runtime status [--json]
85
- octo-runtime adapter list
86
- octo-runtime adapter probe <type>
87
- octo-runtime doctor
88
- octo-runtime extraset <name> < config.json
89
- octo-runtime extraget <name>
90
- octo-runtime playboard < request.json
91
-
92
- Flags: --home <path> --profile <name> --manifest <path> --json
93
- --manifest selects Provider/Extra modules; invocation state stays in --home/run.
94
- Install: --autostart=true|false (defaults to true)
95
- Extras: channel-gateway, channel-wecom, webui, or a name saved by extraset.
96
- Components:
97
- executor-kernel Local Agent execution and worker supervision
98
- channel-gateway Octo IM Bot messaging and Agent replies
99
- channel-wecom WeCom Bot messaging and Agent replies
100
- webui Local browser workspace for Agent conversations
101
- Use octo-runtime <component> --help for component commands.`;
102
- }
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
+ ]);