@mininglamp-oss/octo-runtime 1.1.8 → 1.1.9

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 (100) hide show
  1. package/apps/cli/README.md +3 -1
  2. package/apps/cli/dist/build-info.json +2 -2
  3. package/apps/cli/dist/command-tree.js +3 -1
  4. package/apps/cli/dist/output.js +5 -2
  5. package/apps/cli/dist/playboard.js +11 -2
  6. package/dist/public/executor-kernel.d.ts +2 -2
  7. package/dist/public/executor-kernel.js +1 -1
  8. package/dist/public/protocol.d.ts +1 -1
  9. package/dist/public/protocol.js +1 -1
  10. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
  11. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
  12. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
  13. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
  14. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
  15. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.d.ts +1 -0
  16. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +200 -106
  17. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/async-questions.d.ts +27 -0
  18. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/async-questions.js +205 -0
  19. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/stdin-writer.d.ts +30 -0
  20. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/stdin-writer.js +223 -0
  21. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
  22. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-V5W6ZTYC.js → chunk-FGFEM7JP.js} +1 -1
  23. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-CFKMMCO6.js → chunk-R3PDZLX5.js} +3 -3
  24. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-LO34KB7D.js → chunk-TSRZVLIG.js} +1 -1
  25. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/dsh-sdk-NOTICE.txt +2 -2
  26. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +1 -1
  27. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +5 -5
  28. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +2 -2
  29. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +2 -2
  30. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +3 -3
  31. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
  32. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
  33. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
  34. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
  35. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/gateway.d.ts +3 -0
  36. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/gateway.js +57 -13
  37. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.d.ts +3 -2
  38. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +4 -2
  39. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
  40. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
  41. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
  42. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
  43. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/approval.js +2 -0
  44. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
  45. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
  46. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
  47. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.js +3 -1
  48. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +5 -2
  49. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +11 -2
  50. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +24 -24
  51. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/launchd.d.ts +2 -2
  52. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/launchd.js +12 -11
  53. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
  54. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/experience.js +2 -1
  55. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +5 -4
  56. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +7 -4
  57. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +9 -2
  58. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +6 -3
  59. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
  60. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.d.ts +30 -0
  61. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.js +199 -0
  62. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/host-run-service.js +2 -2
  63. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +1 -0
  64. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +1 -0
  65. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/rpc.d.ts +2 -0
  66. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/rpc.js +16 -3
  67. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +36 -19
  68. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -4
  69. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +6 -2
  70. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +2 -0
  71. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.js +14 -0
  72. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +4 -0
  73. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/interaction-card.js +2 -1
  74. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/session-command.d.ts +9 -0
  75. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/session-command.js +71 -0
  76. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +6 -6
  77. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.js +14 -0
  78. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
  79. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/{index-B127MhT-.js → index-BVxePruX.js} +1 -1
  80. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/index.html +1 -1
  81. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
  82. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/context-loader.js +1 -1
  83. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
  84. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.d.ts +1 -0
  85. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.js +1 -0
  86. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.d.ts +2 -0
  87. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +4 -1
  88. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +3 -0
  89. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +63 -12
  90. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +110 -5
  91. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +7 -4
  92. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +28 -6
  93. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +2 -0
  94. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/questions.d.ts +9 -0
  95. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/questions.js +84 -0
  96. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.d.ts +1 -1
  97. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.js +11 -5
  98. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  99. package/package.json +27 -27
  100. package/packages/octo-runtime-protocol/schema/protocol.schema.json +156 -4
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-mcode",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -9,6 +9,6 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.8"
12
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.9"
13
13
  }
14
14
  }
@@ -1,3 +1,4 @@
1
+ import type { RuntimeLog } from "@mininglamp-oss/octo-runtime-adapter-sdk";
1
2
  export interface OpenClawDeviceIdentity {
2
3
  deviceId: string;
3
4
  publicKey: string;
@@ -9,6 +10,8 @@ export interface OpenClawGatewayOptions {
9
10
  device: OpenClawDeviceIdentity;
10
11
  connectTimeoutMs?: number;
11
12
  requestTimeoutMs?: number;
13
+ /** 元数据诊断 sink;缺省写 stderr,不写 worker 的 stdout RPC 通道。 */
14
+ log?: RuntimeLog;
12
15
  }
13
16
  export interface OpenClawGatewayEvent {
14
17
  event: string;
@@ -1,4 +1,5 @@
1
1
  import { createHash, generateKeyPairSync, randomUUID, sign } from "node:crypto";
2
+ import { writeSync } from "node:fs";
2
3
  import WebSocket from "ws";
3
4
  import { isGatewayRunPending } from "./compatibility.js";
4
5
  const PROTOCOL_VERSION = 4;
@@ -93,7 +94,7 @@ export class OpenClawGatewayClient {
93
94
  #socket;
94
95
  #hello;
95
96
  #connectPromise;
96
- #connectionRequestId;
97
+ #invalidFrameCount = 0;
97
98
  constructor(options) {
98
99
  this.#options = options;
99
100
  }
@@ -110,13 +111,12 @@ export class OpenClawGatewayClient {
110
111
  }
111
112
  async #open() {
112
113
  const requestId = `req_${randomUUID().replaceAll("-", "")}`;
113
- this.#connectionRequestId = requestId;
114
114
  const socket = new WebSocket(this.#options.url, {
115
115
  headers: { [REQUEST_ID_HEADER]: requestId },
116
116
  maxPayload: 25 * 1024 * 1024
117
117
  });
118
118
  this.#socket = socket;
119
- socket.on("message", (data) => this.#onMessage(messageText(data)));
119
+ socket.on("message", (data) => this.#onMessage(data));
120
120
  socket.on("close", (code, reason) => this.#failPending(withRequestId(new Error(`OpenClaw Gateway closed (${code}): ${reason.toString()}`), requestId)));
121
121
  socket.on("error", (error) => this.#failPending(withRequestId(error, requestId)));
122
122
  const timeoutMs = this.#options.connectTimeoutMs ?? 10_000;
@@ -270,26 +270,70 @@ export class OpenClawGatewayClient {
270
270
  timer.unref?.();
271
271
  });
272
272
  }
273
- #onMessage(text) {
274
- let frame;
273
+ /** 跳过坏消息不改变连接、pending 或原期限;仅诊断采样,不能当作执行进度。 */
274
+ #ignoreFrame(reason) {
275
+ if (this.#invalidFrameCount === Number.MAX_SAFE_INTEGER)
276
+ return;
277
+ const count = ++this.#invalidFrameCount;
278
+ if (count > 10 && count % 100 !== 0)
279
+ return;
280
+ const data = { adapter_type: "openclaw", reason_code: reason, frame_count: count };
281
+ try {
282
+ if (this.#options.log) {
283
+ const result = this.#options.log("warn", "openclaw.gateway.invalid_frame", data);
284
+ // void sink 也可由 async 函数实现;只观察拒绝,不等待、不重试日志。
285
+ if (result && typeof result.then === "function")
286
+ void Promise.resolve(result).catch(() => undefined);
287
+ }
288
+ else {
289
+ // 固定、小于 512 字节的元数据;同步写避免后台排队,EPIPE 等仅丢失本条诊断。
290
+ writeSync(2, `${JSON.stringify({ level: "warn", event: "openclaw.gateway.invalid_frame", ...data })}\n`);
291
+ }
292
+ }
293
+ catch {
294
+ /* 日志失败不影响本消息的跳过,更不能打断下一条合法消息。 */
295
+ }
296
+ }
297
+ #onMessage(data) {
298
+ let text;
299
+ try {
300
+ text = messageText(data);
301
+ }
302
+ catch {
303
+ this.#ignoreFrame("invalid_message");
304
+ return;
305
+ }
306
+ let value;
275
307
  try {
276
- frame = JSON.parse(text);
308
+ value = JSON.parse(text);
277
309
  }
278
310
  catch {
279
- const error = this.#connectionRequestId
280
- ? withRequestId(new Error("OpenClaw Gateway sent malformed JSON"), this.#connectionRequestId)
281
- : new Error("OpenClaw Gateway sent malformed JSON");
282
- this.#failPending(error);
283
- this.#socket?.close(1002, "malformed JSON");
311
+ this.#ignoreFrame("invalid_json");
312
+ return;
313
+ }
314
+ const frame = record(value);
315
+ if (!frame || typeof frame.type !== "string") {
316
+ this.#ignoreFrame("invalid_shape");
284
317
  return;
285
318
  }
286
- if (frame.type === "event" && typeof frame.event === "string") {
319
+ // 只验证路由字段,扩展字段与 payload 保持原生合同;业务回调不在解析 catch 内。
320
+ if (frame.type === "event") {
321
+ if (typeof frame.event !== "string" || !frame.event) {
322
+ this.#ignoreFrame("invalid_event");
323
+ return;
324
+ }
287
325
  for (const listener of this.#listeners)
288
326
  listener({ event: frame.event, payload: frame.payload });
289
327
  return;
290
328
  }
291
- if (frame.type !== "res" || typeof frame.id !== "string")
329
+ if (frame.type !== "res") {
330
+ this.#ignoreFrame("unknown_type");
292
331
  return;
332
+ }
333
+ if (typeof frame.id !== "string" || !frame.id || typeof frame.ok !== "boolean") {
334
+ this.#ignoreFrame("invalid_response");
335
+ return;
336
+ }
293
337
  const pending = this.#pending.get(frame.id);
294
338
  if (!pending)
295
339
  return;
@@ -1,4 +1,4 @@
1
- import { type AdapterInvocationContext, type AdapterProbeOptions, type CanonicalEvent, type InvokeRequest } from "@mininglamp-oss/octo-runtime-adapter-sdk";
1
+ import { type AdapterInvocationContext, type AdapterProbeOptions, type CanonicalEvent, type InvokeRequest, type RuntimeLog } from "@mininglamp-oss/octo-runtime-adapter-sdk";
2
2
  import { type InteractionResponse } from "@mininglamp-oss/octo-runtime-protocol";
3
3
  import { type OpenClawGatewayEvent, type OpenClawGatewayOptions } from "./gateway.js";
4
4
  type JsonRecord = Record<string, unknown>;
@@ -33,8 +33,9 @@ export interface OpenClawGatewayClientLike {
33
33
  close(): Promise<void>;
34
34
  }
35
35
  type GatewayClientFactory = (options: OpenClawGatewayOptions) => OpenClawGatewayClientLike;
36
- export declare function createOpenClawAdapter({ clientFactory }?: {
36
+ export declare function createOpenClawAdapter({ clientFactory, log }?: {
37
37
  clientFactory?: GatewayClientFactory;
38
+ log?: RuntimeLog;
38
39
  }): Readonly<Omit<{
39
40
  metadata: {
40
41
  type: string;
@@ -1185,12 +1185,12 @@ async function* invokeOpenClawGateway(req, invocation, context, clientFactory, p
1185
1185
  await stop(!terminal);
1186
1186
  }
1187
1187
  }
1188
- export function createOpenClawAdapter({ clientFactory = (options) => new OpenClawGatewayClient(options) } = {}) {
1188
+ export function createOpenClawAdapter({ clientFactory = (options) => new OpenClawGatewayClient(options), log } = {}) {
1189
1189
  const responders = new Map();
1190
1190
  const probeGateway = async (options) => {
1191
1191
  let client;
1192
1192
  try {
1193
- client = clientFactory(await resolveOpenClawGateway(options?.providerOptions));
1193
+ client = clientFactory({ ...(await resolveOpenClawGateway(options?.providerOptions)), log });
1194
1194
  resolveGatewayContract(await client.connect());
1195
1195
  await client.request("agents.list", {});
1196
1196
  return { available: true, command: "openclaw-gateway" };
@@ -1240,6 +1240,8 @@ export function createOpenClawAdapter({ clientFactory = (options) => new OpenCla
1240
1240
  }
1241
1241
  };
1242
1242
  const invocation = buildOpenClawGatewayInvocation(req);
1243
+ // 本轮及其对账/取消恢复连接共用本轮 sink;probe 则只使用工厂 sink。
1244
+ invocation.gateway.log = context?.log ?? log;
1243
1245
  const bridge = new AcpApprovalBridge(req, 600_000, {
1244
1246
  providerDecisions: true,
1245
1247
  providerManagedExpiry: true
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-openclaw",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
7
7
  "dependencies": {
8
- "@mininglamp-oss/octo-runtime-protocol": "1.1.8",
9
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.8",
8
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.9",
9
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.9",
10
10
  "ws": "8.22.0"
11
11
  },
12
12
  "types": "./dist/index.d.ts",
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-opencode",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
7
7
  "dependencies": {
8
- "@mininglamp-oss/octo-runtime-protocol": "1.1.8",
9
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.8",
10
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.8"
8
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.9",
9
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.9",
10
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.9"
11
11
  },
12
12
  "types": "./dist/index.d.ts",
13
13
  "files": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-qodercli",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -9,6 +9,6 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.8"
12
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.9"
13
13
  }
14
14
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-qoderclicn",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -9,6 +9,6 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.8"
12
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.9"
13
13
  }
14
14
  }
@@ -112,6 +112,8 @@ export class AcpApprovalBridge {
112
112
  payload: {
113
113
  interactionId,
114
114
  kind: "approval",
115
+ // 自动响应仍须等待 responseWritten 确认;此字段只说明回答的所有者。
116
+ responseRequired: !automatic,
115
117
  executionInstanceId: this.request.invocationId,
116
118
  expiresAt: new Date(expiresAt).toISOString(),
117
119
  request: {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-sdk",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -10,7 +10,7 @@
10
10
  "./module-manifest": "./dist/module-manifest.js"
11
11
  },
12
12
  "dependencies": {
13
- "@mininglamp-oss/octo-runtime-protocol": "1.1.8",
13
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.9",
14
14
  "import-meta-resolve": "4.2.0"
15
15
  },
16
16
  "types": "./dist/index.d.ts",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-zcode-gui",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
7
7
  "dependencies": {
8
- "@mininglamp-oss/octo-runtime-protocol": "1.1.8",
9
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.8"
8
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.9",
9
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.9"
10
10
  },
11
11
  "types": "./dist/index.d.ts",
12
12
  "files": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "commit": "d0e34377a62fde503529cb3d2464a7575a5abdb0",
2
+ "commit": "58332b3bcf5651f58e674fa236184dc6a0d927ca",
3
3
  "dirty": false,
4
- "buildTime": "2026-10-31T05:37:41.031Z"
4
+ "buildTime": "2026-11-01T12:55:39.653Z"
5
5
  }
@@ -230,7 +230,9 @@ export async function parseCliCommand(raw, dependencies) {
230
230
  }
231
231
  entries.push(metadata ?? { name, module: "", sourceManifest: "" });
232
232
  }
233
- const root = command("octo-runtime", "Manage the local Octo Agent runtime and independent services.");
233
+ const root = command("octo-runtime", "Manage the local Octo Agent runtime and independent services.\n\n" +
234
+ "Octo Runtime by Mininglamp Technology\n" +
235
+ "Open source on GitHub: https://github.com/Mininglamp-OSS/octo-runtime");
234
236
  addHostOptions(root, args, !isExtra || (offline && !["extraset", "extraget"].includes(operands[1])));
235
237
  option(root, "-v, --version", "Print version and build information", args);
236
238
  // 旧服务参数可位于组件之前;根仅隐藏解析,所属动作仍在本层帮助展示。
@@ -14,8 +14,11 @@ export function formatStatus(name, snapshot) {
14
14
  const runtime = record(snapshot.runtime);
15
15
  const business = record(runtime.status);
16
16
  const ipc = runtime.available === false ? "unavailable" : "ready";
17
+ // 查询失败的 enabled=false 只是兼容占位值,不代表已确认关闭自启。
18
+ const managerQueryFailed = service.state === "unknown" && service.detail && /^[A-Z][A-Z0-9_]+$/.test(service.detail);
19
+ const autostart = managerQueryFailed ? "unknown" : service.enabled ? "on" : "off";
17
20
  const lines = [
18
- `${name} service: ${service.state} autostart: ${service.enabled ? "on" : "off"} IPC: ${ipc}`,
21
+ `${name} service: ${service.state} autostart: ${autostart} IPC: ${ipc}`,
19
22
  ` Manager: ${service.manager}${service.pid ? ` PID: ${service.pid}` : runtime.pid ? ` PID: ${text(runtime.pid)}` : ""}`
20
23
  ];
21
24
  if (runtime.execution_ready !== undefined)
@@ -31,7 +34,7 @@ export function formatStatus(name, snapshot) {
31
34
  lines.push(` Last exit: ${service.lastExitCode}`);
32
35
  if (service.definitionPath)
33
36
  lines.push(` Definition: ${service.definitionPath}`);
34
- if (service.state === "unknown" && service.detail && /^[A-Z][A-Z0-9_]+$/.test(service.detail))
37
+ if (managerQueryFailed)
35
38
  lines.push(` Manager status: ${service.detail}`);
36
39
  const summarize = (value, depth = 0) => {
37
40
  if (Array.isArray(value))
@@ -45,6 +45,12 @@ export async function runPlayboard(options) {
45
45
  if (!value || typeof value !== "object" || Array.isArray(value))
46
46
  throw new TypeError("playboard stdin must contain one JSON input object");
47
47
  const input = identifyInvokeInput(value);
48
+ // full_access 是本 CLI 宿主的缺省策略;显式策略(包括非法值)交给共享入口校验,
49
+ // 不覆盖 Context,也不改变 SDK 的 ask 默认值。
50
+ if (!Object.hasOwn(input, "approvalMode") &&
51
+ !(Array.isArray(input.contexts?.items) &&
52
+ input.contexts.items.some((item) => item?.namespace === "octo.security" && item.name === "approval_policy")))
53
+ input.approvalMode = "full_access";
48
54
  const profile = options.profile ?? "default";
49
55
  const home = options.home ?? defaultRuntimeHome(options.env);
50
56
  runtimePaths(home, profile); // Validate the selected profile before starting resources.
@@ -98,8 +104,11 @@ export async function runPlayboard(options) {
98
104
  if (("kind" in frame &&
99
105
  frame.kind === "control" &&
100
106
  frame.control.type === "interaction" &&
101
- frame.control.status === "pending") ||
102
- (!("kind" in frame) && frame.type === "interaction.requested")) {
107
+ frame.control.status === "pending" &&
108
+ frame.control.responseRequired !== false) ||
109
+ (!("kind" in frame) &&
110
+ frame.type === "interaction.requested" &&
111
+ frame.payload.responseRequired !== false)) {
103
112
  throw new Error("PLAYBOARD_INTERACTION_REQUIRED: one-shot stdin cannot answer provider interactions");
104
113
  }
105
114
  if ("kind" in frame &&
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-cli",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,29 +9,29 @@
9
9
  "types": "./dist/index.d.ts",
10
10
  "dependencies": {
11
11
  "commander": "15.0.0",
12
- "@mininglamp-oss/octo-runtime-adapter-dsh": "1.1.8",
13
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.8",
12
+ "@mininglamp-oss/octo-runtime-adapter-dsh": "1.1.9",
13
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.9",
14
14
  "json5": "2.2.3",
15
- "@mininglamp-oss/octo-runtime-extra-channel-gateway": "1.1.8",
16
- "@mininglamp-oss/octo-runtime-host-sdk": "1.1.8",
17
- "@mininglamp-oss/octo-runtime-adapter-openclaw": "1.1.8",
18
- "@mininglamp-oss/octo-runtime-cross-service": "1.1.8",
19
- "@mininglamp-oss/octo-runtime-protocol": "1.1.8",
20
- "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.8",
21
- "@mininglamp-oss/octo-runtime-executor-core": "1.1.8",
22
- "@mininglamp-oss/octo-runtime-adapter-antigravity": "1.1.8",
23
- "@mininglamp-oss/octo-runtime-adapter-claude-code": "1.1.8",
24
- "@mininglamp-oss/octo-runtime-adapter-codebuddy": "1.1.8",
25
- "@mininglamp-oss/octo-runtime-adapter-codex": "1.1.8",
26
- "@mininglamp-oss/octo-runtime-adapter-hermes": "1.1.8",
27
- "@mininglamp-oss/octo-runtime-adapter-grok-build": "1.1.8",
28
- "@mininglamp-oss/octo-runtime-adapter-kimi-code": "1.1.8",
29
- "@mininglamp-oss/octo-runtime-adapter-mcode": "1.1.8",
30
- "@mininglamp-oss/octo-runtime-adapter-opencode": "1.1.8",
31
- "@mininglamp-oss/octo-runtime-adapter-qodercli": "1.1.8",
32
- "@mininglamp-oss/octo-runtime-adapter-qoderclicn": "1.1.8",
33
- "@mininglamp-oss/octo-runtime-adapter-zcode-gui": "1.1.8",
34
- "@mininglamp-oss/octo-runtime-extra-channel-wecom": "1.1.8",
35
- "@mininglamp-oss/octo-runtime-extra-webui": "1.1.8"
15
+ "@mininglamp-oss/octo-runtime-extra-channel-gateway": "1.1.9",
16
+ "@mininglamp-oss/octo-runtime-host-sdk": "1.1.9",
17
+ "@mininglamp-oss/octo-runtime-adapter-openclaw": "1.1.9",
18
+ "@mininglamp-oss/octo-runtime-cross-service": "1.1.9",
19
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.9",
20
+ "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.9",
21
+ "@mininglamp-oss/octo-runtime-executor-core": "1.1.9",
22
+ "@mininglamp-oss/octo-runtime-adapter-antigravity": "1.1.9",
23
+ "@mininglamp-oss/octo-runtime-adapter-claude-code": "1.1.9",
24
+ "@mininglamp-oss/octo-runtime-adapter-codebuddy": "1.1.9",
25
+ "@mininglamp-oss/octo-runtime-adapter-codex": "1.1.9",
26
+ "@mininglamp-oss/octo-runtime-adapter-hermes": "1.1.9",
27
+ "@mininglamp-oss/octo-runtime-adapter-grok-build": "1.1.9",
28
+ "@mininglamp-oss/octo-runtime-adapter-kimi-code": "1.1.9",
29
+ "@mininglamp-oss/octo-runtime-adapter-mcode": "1.1.9",
30
+ "@mininglamp-oss/octo-runtime-adapter-opencode": "1.1.9",
31
+ "@mininglamp-oss/octo-runtime-adapter-qodercli": "1.1.9",
32
+ "@mininglamp-oss/octo-runtime-adapter-qoderclicn": "1.1.9",
33
+ "@mininglamp-oss/octo-runtime-adapter-zcode-gui": "1.1.9",
34
+ "@mininglamp-oss/octo-runtime-extra-channel-wecom": "1.1.9",
35
+ "@mininglamp-oss/octo-runtime-extra-webui": "1.1.9"
36
36
  }
37
37
  }
@@ -13,14 +13,14 @@ export declare class LaunchdUserBackend implements ServiceBackend {
13
13
  constructor(options?: ServiceBackendOptions);
14
14
  /** Report whether `launchctl` can address this user's `gui/<uid>` domain; no plist is written. */
15
15
  probe(): Promise<ServiceProbe>;
16
- /** Return what launchd is actually using plus whether the installed plist differs from `spec`. */
16
+ /** 只返回已确认的原生状态与定义漂移;查询失败抛错,调用方不得视为停止或已启用。 */
17
17
  inspect(spec: ServiceSpec): Promise<ServiceStatus>;
18
18
  /**
19
19
  * Leave the LaunchAgent plist and disabled override matching `spec`.
20
20
  * A stopped job stays stopped; a loaded job is reloaded only when plist content changed.
21
21
  */
22
22
  install(spec: ServiceSpec): Promise<void>;
23
- /** Finish with no loaded LaunchAgent and no plist; Runtime home data remains untouched. */
23
+ /** 确认 job 消失后才删除 plist;查询或停止失败保留定义供重试,不修改 Home 数据。 */
24
24
  uninstall(spec: ServiceSpec): Promise<void>;
25
25
  /** Clear launchd's disabled override; this affects future activation but does not bootstrap now. */
26
26
  enable(spec: ServiceSpec): Promise<void>;
@@ -2,7 +2,7 @@
2
2
  import { mkdir } from "node:fs/promises";
3
3
  import { dirname, join } from "node:path";
4
4
  import { setTimeout as sleep } from "node:timers/promises";
5
- import { definitionDrift, escapeXml, normalizeServiceSpec, readDefinition, removeDefinition, runCommand, writeDefinition } from "./common.js";
5
+ import { assertCommandSucceeded, definitionDrift, escapeXml, normalizeServiceSpec, readDefinition, removeDefinition, runCommand, writeDefinition } from "./common.js";
6
6
  import { ServiceError } from "./errors.js";
7
7
  import { NodeCommandRunner } from "./runner.js";
8
8
  const LABEL = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
@@ -62,7 +62,7 @@ export class LaunchdUserBackend {
62
62
  };
63
63
  }
64
64
  }
65
- /** Return what launchd is actually using plus whether the installed plist differs from `spec`. */
65
+ /** 只返回已确认的原生状态与定义漂移;查询失败抛错,调用方不得视为停止或已启用。 */
66
66
  async inspect(spec) {
67
67
  const normalized = this.#normalize(spec);
68
68
  const label = launchdLabel(normalized);
@@ -112,7 +112,7 @@ export class LaunchdUserBackend {
112
112
  await this.#bootstrap(definitionPath);
113
113
  }
114
114
  }
115
- /** Finish with no loaded LaunchAgent and no plist; Runtime home data remains untouched. */
115
+ /** 确认 job 消失后才删除 plist;查询或停止失败保留定义供重试,不修改 Home 数据。 */
116
116
  async uninstall(spec) {
117
117
  const normalized = this.#normalize(spec);
118
118
  const label = launchdLabel(normalized);
@@ -191,19 +191,19 @@ export class LaunchdUserBackend {
191
191
  #target(label) {
192
192
  return `${this.#domain()}/${label}`;
193
193
  }
194
- #print(label) {
195
- return runCommand(this.#runner, this.kind, this.#launchctl, ["print", this.#target(label)], {
196
- checked: false,
197
- env: this.#environment
198
- });
194
+ /** 仅接受目标服务的明确缺失;域、权限和超时错误不能释放管理器所有权。 */
195
+ async #print(label) {
196
+ const result = await runCommand(this.#runner, this.kind, this.#launchctl, ["print", this.#target(label)], { checked: false, env: this.#environment });
197
+ const missing = new RegExp(`^Could not find service "${escapeRegExp(label)}" in domain for user gui: ${this.#uid}\\r?$`, "m");
198
+ if (result.exitCode !== 113 || !missing.test(result.stderr || result.stdout)) {
199
+ assertCommandSucceeded(result, this.kind);
200
+ }
201
+ return result;
199
202
  }
200
203
  async #disabled(label) {
201
204
  const result = await runCommand(this.#runner, this.kind, this.#launchctl, ["print-disabled", this.#domain()], {
202
- checked: false,
203
205
  env: this.#environment
204
206
  });
205
- if (result.exitCode !== 0)
206
- return false;
207
207
  const match = result.stdout.match(new RegExp(`["']?${escapeRegExp(label)}["']?\\s*=>\\s*(true|false|enabled|disabled)`));
208
208
  return match?.[1] === "true" || match?.[1] === "disabled";
209
209
  }
@@ -217,6 +217,7 @@ export class LaunchdUserBackend {
217
217
  env: this.#environment
218
218
  });
219
219
  }
220
+ /** 首次查询与停止后轮询均须确认缺失;任何查询失败都保留 plist 并传播。 */
220
221
  async #bootout(label, timeoutSeconds) {
221
222
  if ((await this.#print(label)).exitCode !== 0)
222
223
  return;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-cross-service",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "private": true,
5
5
  "description": "Native user-service lifecycle backends for Octo Runtime",
6
6
  "type": "module",
@@ -90,7 +90,8 @@ export class InvocationExperience {
90
90
  }
91
91
  if (event.type === "tool_call.update")
92
92
  output.push(...this.#finish(`tool:${event.payload.id}`, canonicalTerminalStatus(payload.status)));
93
- if (event.type === "interaction.requested")
93
+ // 异步问题等待的是用户回答,不表示 Provider 暂停执行。
94
+ if (event.type === "interaction.requested" && event.payload.delivery !== "async")
94
95
  output.push(...this.#begin(`interaction:${event.payload.interactionId}`, payload.kind === "approval" ? "waiting_approval" : "waiting_input", { type: "interaction", id: String(payload.interactionId) }));
95
96
  if (event.type === "interaction.resolved")
96
97
  output.push(...this.#finish(`interaction:${String(payload.interactionId)}`, payload.status === "resolved" ? "completed" : "cancelled"));
@@ -21,9 +21,10 @@ export interface HostedAdapterMetadata {
21
21
  unavailableReason?: string | null;
22
22
  }
23
23
  /**
24
- * The minimal contract any Octo Runtime adapter must implement.
25
- * invoke may wrap a CLI subprocess, ACP, WebSocket or an in-process
26
- * implementation, as long as it emits a canonical event stream.
24
+ * Adapter 的最小注册合同;必须声明实际支持的输出模式。
25
+ * invoke 可封装子进程、ACP、WebSocket 或进程内实现,按 context.protocolMode
26
+ * 返回 canonical 事件或 native/控制输出;native-only 不要求生成 canonical 事件。
27
+ * Adapter 负责本轮取消和资源清理,Core 在清理结束后发布执行终态。
27
28
  */
28
29
  export interface HostedAdapter {
29
30
  metadata: HostedAdapterMetadata;
@@ -71,7 +72,7 @@ export declare class AgentExecutor {
71
72
  probe(adapterType: string, options?: AdapterProbeOptions): unknown;
72
73
  /** 请求取消活动执行;true 仅表示已触发 abort,仍须消费终态并等待 Adapter 清理。 */
73
74
  cancel(invocationId: string, reason?: string): boolean;
74
- /** Route an answer only to the adapter instance that owns the active invocation. */
75
+ /** 仅将回答路由到原活动调用;终态后返回稳定失效码,不转交其他 Adapter 或轮次。 */
75
76
  respondInteraction(invocationId: string, response: InteractionResponse): Promise<void>;
76
77
  respondNative(invocationId: string, response: NativeInteractionResponse): Promise<void>;
77
78
  /**
@@ -6,7 +6,7 @@ import { sanitizePublicValue } from "@mininglamp-oss/octo-runtime-adapter-sdk";
6
6
  export { prepareInvokeInput } from "./invoke-input.js";
7
7
  export { resolveLocalContext, localRuntimeLimits } from "./context.js";
8
8
  export { prepareRunContext } from "./execution-preparation.js";
9
- import { createInputInvoke, assertInvokeRequestSize, assertProtocolSupport, assertAdapterProtocolSupport, assertHostFrame, assertHostFrameIdentity, assertNativeInteractionResponse, resolveHostInvokeOptions, protocolError, assertCanonicalEvent, assertInteractionResponse, assertInvokeRequest, failurePayload, isStreamCapacityReason, resolveStreamLimitPolicy, streamCapacityError, isTerminal } from "@mininglamp-oss/octo-runtime-protocol";
9
+ import { createInputInvoke, assertInvokeRequestSize, assertProtocolSupport, assertAdapterProtocolSupport, assertHostFrame, assertHostFrameIdentity, assertNativeInteractionResponse, resolveHostInvokeOptions, protocolError, assertCanonicalEvent, assertInteractionResponse, assertInvokeRequest, failurePayload, isCodexLocalFailure, isStreamCapacityReason, resolveStreamLimitPolicy, streamCapacityError, isTerminal } from "@mininglamp-oss/octo-runtime-protocol";
10
10
  import { InvocationExperience } from "./experience.js";
11
11
  import { withModelContexts } from "./model-input.js";
12
12
  import { noopRuntimeLog } from "@mininglamp-oss/octo-runtime-adapter-sdk";
@@ -803,7 +803,10 @@ export class AgentExecutor {
803
803
  ? nativeFailureCode
804
804
  : "HOST_EXECUTION_FAILED",
805
805
  message: String(failure.message),
806
- ...(isStreamCapacityReason(nativeFailureCode) ? { failure: failure.failure } : {})
806
+ ...(isStreamCapacityReason(nativeFailureCode) ||
807
+ (adapterType === "codex" && isCodexLocalFailure(failure.failure))
808
+ ? { failure: failure.failure }
809
+ : {})
807
810
  }
808
811
  };
809
812
  yield {
@@ -870,12 +873,12 @@ export class AgentExecutor {
870
873
  this.#log("info", "invoke.cancel_accepted", { invocation_id: invocationId });
871
874
  return true;
872
875
  }
873
- /** Route an answer only to the adapter instance that owns the active invocation. */
876
+ /** 仅将回答路由到原活动调用;终态后返回稳定失效码,不转交其他 Adapter 或轮次。 */
874
877
  async respondInteraction(invocationId, response) {
875
878
  assertInteractionResponse(response);
876
879
  const adapter = this.#activeAdapters.get(invocationId);
877
880
  if (!adapter || this.#acceptedTerminals.has(invocationId)) {
878
- throw new Error(`invocation is not active: ${invocationId}`);
881
+ throw protocolError("INTERACTION_NOT_ACTIVE", `invocation is not active: ${invocationId}`);
879
882
  }
880
883
  if (this.#modes.get(invocationId) !== "canonical")
881
884
  throw protocolError("EXECUTION_PROTOCOL_MISMATCH");
@@ -1,6 +1,6 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { localRuntimeLimits, resolveLocalContext } from "./context.js";
3
- import { CONTEXT_SCHEMA, assertAgentSource, assertContextEnvelope, assertInvokeRequest, contextControlInstructions, contextItem, InvokeInput } from "@mininglamp-oss/octo-runtime-protocol";
3
+ import { CONTEXT_SCHEMA, DEFAULT_RUN_TIMEOUT_MS, assertAgentSource, assertContextEnvelope, assertInvokeRequest, contextControlInstructions, contextItem, InvokeInput } from "@mininglamp-oss/octo-runtime-protocol";
4
4
  /** CLI shorthand resolves execution defaults before entering the strict Context contract. */
5
5
  function inputContext(value) {
6
6
  if (isRecord(value) && Array.isArray(value.items)) {
@@ -58,6 +58,9 @@ export function prepareInvokeInput(value) {
58
58
  typeof value.providerSession.resumable !== "boolean") {
59
59
  throw new TypeError("providerSession.resumable must be a boolean");
60
60
  }
61
+ if (value.providerSession.requireResume !== undefined &&
62
+ typeof value.providerSession.requireResume !== "boolean")
63
+ throw new TypeError("providerSession.requireResume must be a boolean");
61
64
  providerSession = structuredClone(value.providerSession);
62
65
  }
63
66
  if (continuityMode === "fresh" && providerSession)
@@ -82,7 +85,11 @@ export function prepareInvokeInput(value) {
82
85
  name: "approval_policy",
83
86
  payload: { mode: input.approvalMode ?? "ask" }
84
87
  },
85
- { namespace: "octo.execution", name: "limits", payload: { run_timeout_ms: 120_000 } }
88
+ {
89
+ namespace: "octo.execution",
90
+ name: "limits",
91
+ payload: { run_timeout_ms: DEFAULT_RUN_TIMEOUT_MS }
92
+ }
86
93
  ]
87
94
  };
88
95
  // Resolve only execution settings here. Business items and control instructions