@mininglamp-oss/octo-runtime 1.1.7 → 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 (124) 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/dist/index.d.ts +1 -1
  45. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +1 -1
  46. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.d.ts +2 -0
  47. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.js +22 -0
  48. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/runtime-log.js +20 -0
  49. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/service-status.js +14 -1
  50. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
  51. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
  52. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
  53. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/command-tree.js +3 -1
  54. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +5 -2
  55. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +11 -2
  56. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +24 -24
  57. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/launchd.d.ts +2 -2
  58. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/dist/launchd.js +12 -11
  59. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
  60. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/experience.js +2 -1
  61. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +5 -4
  62. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +7 -4
  63. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +9 -2
  64. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +6 -3
  65. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
  66. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.d.ts +30 -0
  67. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/async-question-reply.js +199 -0
  68. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/host-run-service.js +2 -2
  69. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +1 -0
  70. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +1 -0
  71. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/rpc.d.ts +2 -0
  72. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/rpc.js +16 -3
  73. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +36 -19
  74. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -4
  75. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +27 -35
  76. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +5 -4
  77. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/dispatcher.d.ts +4 -0
  78. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/dispatcher.js +29 -6
  79. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/identity.d.ts +1 -1
  80. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/identity.js +2 -2
  81. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/send-error.d.ts +6 -0
  82. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/send-error.js +10 -0
  83. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/task.js +14 -0
  84. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-session.d.ts +3 -2
  85. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/card-session.js +54 -10
  86. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.d.ts +4 -2
  87. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +77 -109
  88. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connector.d.ts +3 -5
  89. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/connector.js +27 -40
  90. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/interaction-card.js +2 -1
  91. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/reasoning-frame.js +42 -7
  92. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/session-command.d.ts +9 -0
  93. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/session-command.js +71 -0
  94. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.d.ts +1 -12
  95. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/wukong.js +6 -126
  96. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +6 -6
  97. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/dist/application/im-channel.js +14 -0
  98. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
  99. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/assets/{index-CXTvRGim.js → index-BVxePruX.js} +11 -10
  100. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/dist/web/index.html +1 -1
  101. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
  102. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/dist/context-loader.js +1 -1
  103. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
  104. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.d.ts +1 -0
  105. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.js +1 -0
  106. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.d.ts +2 -0
  107. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +4 -1
  108. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +3 -0
  109. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +63 -12
  110. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +110 -5
  111. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +7 -4
  112. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +28 -6
  113. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +2 -0
  114. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/questions.d.ts +9 -0
  115. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/questions.js +84 -0
  116. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.d.ts +1 -1
  117. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.js +11 -5
  118. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  119. package/package.json +27 -27
  120. package/packages/octo-runtime-protocol/schema/protocol.schema.json +156 -4
  121. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/text-send.d.ts +0 -19
  122. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/delivery/text-send.js +0 -86
  123. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/delivery-notice.d.ts +0 -5
  124. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/presentation/delivery-notice.js +0 -35
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-mcode",
3
- "version": "1.1.7",
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.7"
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.7",
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.7",
9
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.7",
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.7",
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.7",
9
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.7",
10
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.7"
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.7",
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.7"
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.7",
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.7"
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: {
@@ -16,7 +16,7 @@ export { readBoundedLines } from "./bounded-lines.js";
16
16
  export { HourlyLogWriter, HOURLY_LOG_MAX_BYTES } from "./hourly-log.js";
17
17
  export { RuntimeLogging, assertRuntimeLogging, noopRuntimeLog, type RuntimeLog, type RuntimeLogLevel, type RuntimeLoggingOptions } from "./runtime-log.js";
18
18
  export { extraStatusRecord, kernelStatusRecord, type ExtraStatusRecord, type KernelStatusRecord } from "./service-status.js";
19
- export { sanitizePublicValue } from "./public-display.js";
19
+ export { sanitizePublicValue, sanitizeDiagnosticBody } from "./public-display.js";
20
20
  export { DEFAULT_REASONING_LEVEL_MAPS, OMNI_REASONING_LEVELS, mapReasoningEffort, reasoningLevelMap, type OmniReasoningLevel, type ReasoningLevelMap } from "./reasoning.js";
21
21
  /** Adapter 的编写输入;defineAdapter 在省略协议声明时补 canonical-only 默认值。 */
22
22
  export interface AdapterMetadata {
@@ -23,7 +23,7 @@ export { readBoundedLines } from "./bounded-lines.js";
23
23
  export { HourlyLogWriter, HOURLY_LOG_MAX_BYTES } from "./hourly-log.js";
24
24
  export { RuntimeLogging, assertRuntimeLogging, noopRuntimeLog } from "./runtime-log.js";
25
25
  export { extraStatusRecord, kernelStatusRecord } from "./service-status.js";
26
- export { sanitizePublicValue } from "./public-display.js";
26
+ export { sanitizePublicValue, sanitizeDiagnosticBody } from "./public-display.js";
27
27
  export { DEFAULT_REASONING_LEVEL_MAPS, OMNI_REASONING_LEVELS, mapReasoningEffort, reasoningLevelMap } from "./reasoning.js";
28
28
  /**
29
29
  * 接收编写输入并返回可注册的 Adapter,省略协议时仅补 canonical-only 声明。
@@ -1 +1,3 @@
1
1
  export declare function sanitizePublicValue(value: unknown, key?: string, depth?: number): unknown;
2
+ /** Response summaries parse JSON before redaction; truncated credentials must also stay private. */
3
+ export declare function sanitizeDiagnosticBody(body: string): string;
@@ -17,6 +17,28 @@ export function sanitizePublicValue(value, key = "", depth = 0) {
17
17
  sanitizePublicValue(childValue, childKey, depth + 1)
18
18
  ]));
19
19
  }
20
+ /** Response summaries parse JSON before redaction; truncated credentials must also stay private. */
21
+ export function sanitizeDiagnosticBody(body) {
22
+ let safe;
23
+ try {
24
+ safe = JSON.stringify(sanitizePublicValue(JSON.parse(body)));
25
+ }
26
+ catch {
27
+ safe = String(sanitizePublicValue(body));
28
+ }
29
+ if (/\\u[0-9a-f]{0,4}/i.test(safe))
30
+ safe = "[REDACTED]";
31
+ // Headers can occur inside a JSON message too. Drop the entire suffix at the first
32
+ // sensitive key instead of guessing where a spaced or truncated credential ends.
33
+ const keys = /["']?([\w-]+)[\\"']*\s*[:=]/g;
34
+ for (const match of safe.matchAll(keys)) {
35
+ if (SENSITIVE_OUTPUT_KEY.test(match[1])) {
36
+ safe = `${safe.slice(0, match.index)}[REDACTED]`;
37
+ break;
38
+ }
39
+ }
40
+ return Array.from(safe).slice(0, 200).join("");
41
+ }
20
42
  function redactCredentialText(value) {
21
43
  // 单向扫描 PEM,避免多个未闭合 BEGIN 反复扫描后缀;截断的私钥同样不能公开。
22
44
  const begin = /-----BEGIN [^-]*PRIVATE KEY-----/gi;
@@ -2,6 +2,7 @@
2
2
  import { isAbsolute } from "node:path";
3
3
  import { Worker } from "node:worker_threads";
4
4
  import { extraStatusRecord, kernelStatusRecord } from "./service-status.js";
5
+ import { sanitizeDiagnosticBody } from "./public-display.js";
5
6
  export const noopRuntimeLog = () => { };
6
7
  const strings = new Set([
7
8
  "run_id",
@@ -168,6 +169,25 @@ export class RuntimeLogging {
168
169
  Number.isFinite(Date.parse(occurredAt)) &&
169
170
  new Date(occurredAt).toISOString() === occurredAt)
170
171
  safe.occurred_at = occurredAt;
172
+ // 仅放行 Gateway 卡片投递诊断;响应摘要不进入状态镜像,且不得携带请求或鉴权信息。
173
+ if (source === "extra" &&
174
+ extra === "channel-gateway" &&
175
+ event === "channel.diagnostic" &&
176
+ typeof safe.code === "string" &&
177
+ /^IM_CARD_(?:SEND|EDIT)_\d{3}$/.test(safe.code)) {
178
+ const path = data?.path;
179
+ if (path === "/v1/bot/sendMessage" || path === "/v1/bot/message/edit")
180
+ safe.path = path;
181
+ const status = data?.http_status;
182
+ if (typeof status === "number" &&
183
+ Number.isInteger(status) &&
184
+ status >= 100 &&
185
+ status <= 599)
186
+ safe.http_status = status;
187
+ const body = data?.response_body;
188
+ if (typeof body === "string")
189
+ safe.response_body = sanitizeDiagnosticBody(body);
190
+ }
171
191
  const record = {
172
192
  time: new Date().toISOString(),
173
193
  level,
@@ -80,7 +80,14 @@ export function extraStatusRecord(extra, level, event, data, time = new Date().t
80
80
  if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(time) ||
81
81
  !Number.isFinite(Date.parse(time)))
82
82
  return;
83
- if (event === "channel.diagnostic" && data?.code !== "IM_DISPOSE_FAILED")
83
+ // Gateway 投递失败须能由 channel-gateway logs 查询;不放开执行正文或其他诊断。
84
+ const deliveryDiagnostic = extra === "channel-gateway" &&
85
+ event === "channel.diagnostic" &&
86
+ typeof data?.code === "string" &&
87
+ (/^(?:IM_DELIVERY_|IM_CARD_|IM_HTTP_)[A-Z0-9_]+$/.test(data.code) ||
88
+ data.code === "IM_CREDENTIALS_REQUIRED" ||
89
+ data.code === "IM_BOT_TOKEN_INVALID");
90
+ if (event === "channel.diagnostic" && data?.code !== "IM_DISPOSE_FAILED" && !deliveryDiagnostic)
84
91
  return;
85
92
  const safe = {};
86
93
  for (const key of ["state", "code", "endpoint_id"]) {
@@ -99,6 +106,12 @@ export function extraStatusRecord(extra, level, event, data, time = new Date().t
99
106
  if (typeof value === "number" && Number.isSafeInteger(value) && value >= 0)
100
107
  safe[key] = value;
101
108
  }
109
+ const runId = data?.run_id;
110
+ if (deliveryDiagnostic &&
111
+ typeof runId === "string" &&
112
+ /^[A-Za-z0-9][A-Za-z0-9_.:@+-]{0,127}$/.test(runId) &&
113
+ !/^(?:bf_|sk-|Bearer)/i.test(runId))
114
+ safe.run_id = runId;
102
115
  return Object.freeze({
103
116
  time,
104
117
  level,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-sdk",
3
- "version": "1.1.7",
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.7",
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.7",
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.7",
9
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.7"
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": "ed7a4c899e5666238bc67e6a8418e3805ac924da",
2
+ "commit": "58332b3bcf5651f58e674fa236184dc6a0d927ca",
3
3
  "dirty": false,
4
- "buildTime": "2026-10-30T03:47:52.513Z"
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.7",
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.7",
13
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.7",
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.7",
16
- "@mininglamp-oss/octo-runtime-host-sdk": "1.1.7",
17
- "@mininglamp-oss/octo-runtime-adapter-openclaw": "1.1.7",
18
- "@mininglamp-oss/octo-runtime-cross-service": "1.1.7",
19
- "@mininglamp-oss/octo-runtime-protocol": "1.1.7",
20
- "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.7",
21
- "@mininglamp-oss/octo-runtime-executor-core": "1.1.7",
22
- "@mininglamp-oss/octo-runtime-adapter-antigravity": "1.1.7",
23
- "@mininglamp-oss/octo-runtime-adapter-claude-code": "1.1.7",
24
- "@mininglamp-oss/octo-runtime-adapter-codebuddy": "1.1.7",
25
- "@mininglamp-oss/octo-runtime-adapter-codex": "1.1.7",
26
- "@mininglamp-oss/octo-runtime-adapter-hermes": "1.1.7",
27
- "@mininglamp-oss/octo-runtime-adapter-grok-build": "1.1.7",
28
- "@mininglamp-oss/octo-runtime-adapter-kimi-code": "1.1.7",
29
- "@mininglamp-oss/octo-runtime-adapter-mcode": "1.1.7",
30
- "@mininglamp-oss/octo-runtime-adapter-opencode": "1.1.7",
31
- "@mininglamp-oss/octo-runtime-adapter-qodercli": "1.1.7",
32
- "@mininglamp-oss/octo-runtime-adapter-qoderclicn": "1.1.7",
33
- "@mininglamp-oss/octo-runtime-adapter-zcode-gui": "1.1.7",
34
- "@mininglamp-oss/octo-runtime-extra-channel-wecom": "1.1.7",
35
- "@mininglamp-oss/octo-runtime-extra-webui": "1.1.7"
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;