@mininglamp-oss/octo-runtime 1.1.1 → 1.1.3

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 (59) hide show
  1. package/apps/cli/dist/build-info.json +2 -2
  2. package/apps/cli/dist/manifest.json +5 -0
  3. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
  4. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
  5. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
  6. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
  7. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
  8. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
  9. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.d.ts +54 -0
  10. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.js +399 -0
  11. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.d.ts +14 -0
  12. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +156 -0
  13. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.d.ts +29 -0
  14. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.js +273 -0
  15. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/interactions.d.ts +27 -0
  16. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/interactions.js +161 -0
  17. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +17 -0
  18. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
  19. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
  20. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
  21. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/compatibility.d.ts +24 -0
  22. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/compatibility.js +181 -0
  23. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/gateway.d.ts +9 -0
  24. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/gateway.js +24 -8
  25. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +229 -225
  26. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
  27. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
  28. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +2 -2
  29. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +2 -2
  30. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/approval.d.ts +4 -0
  31. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/approval.js +5 -6
  32. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
  33. package/node_modules/@mininglamp-oss/octo-runtime-adapter-zcode-gui/package.json +3 -3
  34. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
  35. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +5 -0
  36. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +23 -22
  37. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
  38. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-input.d.ts +1 -1
  39. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-input.js +13 -9
  40. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
  41. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/invocation-manifest.js +31 -8
  42. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +4 -4
  43. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/config-schema.json +1 -1
  44. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +2 -1
  45. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +2 -0
  46. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js +24 -0
  47. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/channel.js +5 -4
  48. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.js +2 -2
  49. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.d.ts +5 -2
  50. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.js +19 -5
  51. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/normalize.d.ts +1 -1
  52. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/normalize.js +5 -2
  53. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +6 -6
  54. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
  55. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
  56. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
  57. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  58. package/package.json +27 -25
  59. package/packages/octo-runtime-extra-channel-gateway/config-schema.json +1 -1
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-opencode",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
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.1",
9
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.1",
10
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.1"
8
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.3",
9
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.3",
10
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.3"
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.1",
3
+ "version": "1.1.3",
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.1"
12
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.3"
13
13
  }
14
14
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-qoderclicn",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
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.1"
12
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.3"
13
13
  }
14
14
  }
@@ -7,10 +7,14 @@ export declare class AcpApprovalBridge {
7
7
  readonly options: {
8
8
  providerDecisions?: boolean;
9
9
  providerManagedExpiry?: boolean;
10
+ /** 仅由 Adapter 在首个审批前设置,用于已授权的原生兼容回退;不改写请求策略与身份。 */
11
+ effectiveApprovalMode?: "ask" | "full_access";
10
12
  };
11
13
  constructor(request: InvokeRequest, timeoutMs?: number, options?: {
12
14
  providerDecisions?: boolean;
13
15
  providerManagedExpiry?: boolean;
16
+ /** 仅由 Adapter 在首个审批前设置,用于已授权的原生兼容回退;不改写请求策略与身份。 */
17
+ effectiveApprovalMode?: "ask" | "full_access";
14
18
  });
15
19
  requestPermission(params: RecordValue, providerExpiresAt?: number): Promise<RecordValue>;
16
20
  respond(response: InteractionResponse): Promise<void>;
@@ -24,6 +24,7 @@ export class AcpApprovalBridge {
24
24
  requestPermission(params, providerExpiresAt) {
25
25
  if (this.#closed || this.request.signal?.aborted)
26
26
  return Promise.reject(new Error("APPROVAL_WAIT_UNAVAILABLE"));
27
+ const automatic = (this.options.effectiveApprovalMode ?? this.request.approvalMode) === "full_access";
27
28
  const options = Array.isArray(params.options) ? params.options.filter(isObject) : [];
28
29
  const option = (kind) => {
29
30
  const candidate = options.find((value) => value.kind === kind);
@@ -34,7 +35,7 @@ export class AcpApprovalBridge {
34
35
  const allow = option("allow_once");
35
36
  const always = this.options.providerDecisions ? option("allow_always") : undefined;
36
37
  const decline = option("reject_once");
37
- if (!allow && !always && !decline && this.request.approvalMode !== "full_access")
38
+ if (!allow && !always && !decline && !automatic)
38
39
  return Promise.resolve(cancelled());
39
40
  if (this.#pending.size >= 16 || this.request.signal?.aborted)
40
41
  return Promise.reject(new Error("APPROVAL_WAIT_UNAVAILABLE"));
@@ -90,10 +91,8 @@ export class AcpApprovalBridge {
90
91
  written,
91
92
  confirm,
92
93
  fail,
93
- responding: this.request.approvalMode === "full_access",
94
- ...(this.request.approvalMode === "full_access"
95
- ? { automaticOutcome: allow ? "accepted" : "cancelled" }
96
- : {})
94
+ responding: automatic,
95
+ ...(automatic ? { automaticOutcome: allow ? "accepted" : "cancelled" } : {})
97
96
  });
98
97
  });
99
98
  const tool = isObject(params.toolCall)
@@ -140,7 +139,7 @@ export class AcpApprovalBridge {
140
139
  }
141
140
  }
142
141
  });
143
- if (this.request.approvalMode === "full_access")
142
+ if (automatic)
144
143
  this.#pending.get(interactionId).resolve(allow ? selected(allow) : cancelled());
145
144
  return result;
146
145
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -9,7 +9,7 @@
9
9
  "./module-manifest": "./dist/module-manifest.js"
10
10
  },
11
11
  "dependencies": {
12
- "@mininglamp-oss/octo-runtime-protocol": "1.1.1",
12
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.3",
13
13
  "import-meta-resolve": "4.2.0"
14
14
  },
15
15
  "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.1",
3
+ "version": "1.1.3",
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.1",
9
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.1"
8
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.3",
9
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.3"
10
10
  },
11
11
  "types": "./dist/index.d.ts",
12
12
  "files": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "commit": "20c377136288a55356300bd3d4a755d0f19a23ee",
2
+ "commit": "fe19d350431534da4ed3a76f3466add4ced86d81",
3
3
  "dirty": false,
4
- "buildTime": "2026-10-22T07:38:35.134Z"
4
+ "buildTime": "2026-10-22T15:06:34.025Z"
5
5
  }
@@ -16,6 +16,11 @@
16
16
  "module": "@mininglamp-oss/octo-runtime-adapter-codebuddy",
17
17
  "export": "codebuddyAdapter"
18
18
  },
19
+ {
20
+ "type": "grok-build",
21
+ "module": "@mininglamp-oss/octo-runtime-adapter-grok-build",
22
+ "export": "grokBuildAdapter"
23
+ },
19
24
  {
20
25
  "type": "hermes",
21
26
  "module": "@mininglamp-oss/octo-runtime-adapter-hermes",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-cli",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,27 +8,28 @@
8
8
  },
9
9
  "types": "./dist/index.d.ts",
10
10
  "dependencies": {
11
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.1",
11
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.3",
12
12
  "json5": "2.2.3",
13
- "@mininglamp-oss/octo-runtime-extra-channel-gateway": "1.1.1",
14
- "@mininglamp-oss/octo-runtime-host-sdk": "1.1.1",
15
- "@mininglamp-oss/octo-runtime-adapter-openclaw": "1.1.1",
16
- "@mininglamp-oss/octo-runtime-cross-service": "1.1.1",
17
- "@mininglamp-oss/octo-runtime-protocol": "1.1.1",
18
- "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.1",
19
- "@mininglamp-oss/octo-runtime-executor-core": "1.1.1",
20
- "@mininglamp-oss/octo-runtime-adapter-antigravity": "1.1.1",
21
- "@mininglamp-oss/octo-runtime-adapter-claude-code": "1.1.1",
22
- "@mininglamp-oss/octo-runtime-adapter-codebuddy": "1.1.1",
23
- "@mininglamp-oss/octo-runtime-adapter-codex": "1.1.1",
24
- "@mininglamp-oss/octo-runtime-adapter-hermes": "1.1.1",
25
- "@mininglamp-oss/octo-runtime-adapter-kimi-code": "1.1.1",
26
- "@mininglamp-oss/octo-runtime-adapter-mcode": "1.1.1",
27
- "@mininglamp-oss/octo-runtime-adapter-opencode": "1.1.1",
28
- "@mininglamp-oss/octo-runtime-adapter-qodercli": "1.1.1",
29
- "@mininglamp-oss/octo-runtime-adapter-qoderclicn": "1.1.1",
30
- "@mininglamp-oss/octo-runtime-adapter-zcode-gui": "1.1.1",
31
- "@mininglamp-oss/octo-runtime-extra-channel-wecom": "1.1.1",
32
- "@mininglamp-oss/octo-runtime-extra-webui": "1.1.1"
13
+ "@mininglamp-oss/octo-runtime-extra-channel-gateway": "1.1.3",
14
+ "@mininglamp-oss/octo-runtime-host-sdk": "1.1.3",
15
+ "@mininglamp-oss/octo-runtime-adapter-openclaw": "1.1.3",
16
+ "@mininglamp-oss/octo-runtime-cross-service": "1.1.3",
17
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.3",
18
+ "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.3",
19
+ "@mininglamp-oss/octo-runtime-executor-core": "1.1.3",
20
+ "@mininglamp-oss/octo-runtime-adapter-antigravity": "1.1.3",
21
+ "@mininglamp-oss/octo-runtime-adapter-claude-code": "1.1.3",
22
+ "@mininglamp-oss/octo-runtime-adapter-codebuddy": "1.1.3",
23
+ "@mininglamp-oss/octo-runtime-adapter-codex": "1.1.3",
24
+ "@mininglamp-oss/octo-runtime-adapter-hermes": "1.1.3",
25
+ "@mininglamp-oss/octo-runtime-adapter-grok-build": "1.1.3",
26
+ "@mininglamp-oss/octo-runtime-adapter-kimi-code": "1.1.3",
27
+ "@mininglamp-oss/octo-runtime-adapter-mcode": "1.1.3",
28
+ "@mininglamp-oss/octo-runtime-adapter-opencode": "1.1.3",
29
+ "@mininglamp-oss/octo-runtime-adapter-qodercli": "1.1.3",
30
+ "@mininglamp-oss/octo-runtime-adapter-qoderclicn": "1.1.3",
31
+ "@mininglamp-oss/octo-runtime-adapter-zcode-gui": "1.1.3",
32
+ "@mininglamp-oss/octo-runtime-extra-channel-wecom": "1.1.3",
33
+ "@mininglamp-oss/octo-runtime-extra-webui": "1.1.3"
33
34
  }
34
35
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-cross-service",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "private": true,
5
5
  "description": "Native user-service lifecycle backends for Octo Runtime",
6
6
  "type": "module",
@@ -1,5 +1,5 @@
1
1
  import type { ContextEnvelope, InvokeRequest } from "@mininglamp-oss/octo-runtime-protocol";
2
- /** 仅渲染允许进入模型的业务 Context;固定格式使用英文,业务内容保留原文,对象键排序使同一快照稳定。 */
2
+ /** 仅渲染允许进入模型的本轮业务 Context;Markdown 指引保留原文,排序后的 payload 用 CDATA 包裹,不修改输入。 */
3
3
  export declare function renderModelContexts(context: ContextEnvelope): string;
4
4
  /**
5
5
  * Core 冻结原请求后、派发 Adapter 前调用一次;接入方不应预先渲染而造成 Context 重复。
@@ -1,20 +1,24 @@
1
1
  const MODEL_CONTEXT_PATTERNS = [/^extra\.[^/]+\/[^/]+$/, /^octo\.content\/(inline|references)$/];
2
- /** 仅渲染允许进入模型的业务 Context;固定格式使用英文,业务内容保留原文,对象键排序使同一快照稳定。 */
2
+ /** 仅渲染允许进入模型的本轮业务 Context;Markdown 指引保留原文,排序后的 payload 用 CDATA 包裹,不修改输入。 */
3
3
  export function renderModelContexts(context) {
4
4
  const items = context.items.filter((item) => MODEL_CONTEXT_PATTERNS.some((pattern) => pattern.test(item.namespace + "/" + item.name)));
5
5
  if (!items.length)
6
6
  return "";
7
7
  return [
8
- "<--- Context information begins: the following is the current context --->",
8
+ "<!-- Context information begins: the following is the current context -->",
9
9
  "<contexts>",
10
- ...items.map((item) => [
11
- ` <context-item namespace="${item.namespace}" name="${item.name}">`,
12
- ...(item.guidance ? [` Guidance: ${item.guidance}`] : []),
13
- ` Data: ${JSON.stringify(sorted(item.payload))}`,
14
- " </context-item>"
15
- ].join("\n")),
10
+ ...items.map((item) => {
11
+ // 拆分 CDATA 终止符为相邻区段,避免材料中的标记提前结束数据边界;不解析内部内容。
12
+ const data = JSON.stringify(sorted(item.payload)).replaceAll("]]>", "]]]]><![CDATA[>");
13
+ return [
14
+ ` <context-item namespace="${item.namespace}" name="${item.name}">`,
15
+ ...(item.guidance ? [` <guidence>${item.guidance}</guidence>`] : []),
16
+ ` <data><![CDATA[${data}]]></data>`,
17
+ " </context-item>"
18
+ ].join("\n");
19
+ }),
16
20
  "</contexts>",
17
- "<--- Context information ends --->"
21
+ "<!-- Context information ends -->"
18
22
  ].join("\n");
19
23
  }
20
24
  function sorted(value) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-executor-core",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
7
7
  "dependencies": {
8
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.1",
9
- "@mininglamp-oss/octo-runtime-protocol": "1.1.1"
8
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.3",
9
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.3"
10
10
  },
11
11
  "types": "./dist/index.d.ts",
12
12
  "files": [
@@ -28,10 +28,15 @@ export class InvocationManifest {
28
28
  this.#worker = undefined;
29
29
  }
30
30
  else {
31
- const started = await processStartIdentity(pid);
32
- if (!started)
33
- throw new Error(`cannot identify worker process ${pid}`);
34
- this.#worker = { pid, started, entrypoint };
31
+ try {
32
+ const started = await queryProcessStartIdentity(pid);
33
+ if (!started)
34
+ throw new Error("system process start identity unavailable");
35
+ this.#worker = { pid, started, entrypoint };
36
+ }
37
+ catch (cause) {
38
+ throw new Error(`cannot identify worker process ${pid}`, { cause });
39
+ }
35
40
  }
36
41
  await this.#persist();
37
42
  }
@@ -112,6 +117,15 @@ export async function reapOrphanedInvocationManifest(path) {
112
117
  }
113
118
  /** 查询系统启动时间以区分 PID 复用;失败时不返回可用于回收的身份,绝不以 PID 本身兜底。 */
114
119
  export async function processStartIdentity(pid) {
120
+ try {
121
+ return await queryProcessStartIdentity(pid);
122
+ }
123
+ catch {
124
+ return undefined;
125
+ }
126
+ }
127
+ // 登记失败保留系统查询原因;公开探测与孤儿回收仍以 undefined 表示身份未知。
128
+ async function queryProcessStartIdentity(pid) {
115
129
  if (!Number.isSafeInteger(pid) || pid < 1)
116
130
  return undefined;
117
131
  if (process.platform === "linux") {
@@ -136,18 +150,27 @@ export async function processStartIdentity(pid) {
136
150
  });
137
151
  }
138
152
  if (process.platform === "win32") {
139
- return new Promise((resolve) => {
153
+ return new Promise((resolve, reject) => {
140
154
  execFile("powershell.exe", [
141
155
  "-NoLogo",
142
156
  "-NoProfile",
143
157
  "-NonInteractive",
144
158
  "-Command",
145
159
  // 直接调用系统进程对象,避免 Get-Process 的命令发现/模块自动加载占用身份查询预算。
146
- // 保持 UTC ticks 身份格式;不增加超时,也不缓存可能已经复用的 PID。
160
+ // 保持 UTC ticks 身份格式,不缓存可能已经复用的 PID。
147
161
  `$PSModuleAutoLoadingPreference='None'; $target=[System.Diagnostics.Process]::GetProcessById(${pid}); try { [Console]::Out.Write($target.StartTime.ToUniversalTime().Ticks.ToString([Globalization.CultureInfo]::InvariantCulture)) } finally { $target.Dispose() }`
148
- ], { encoding: "utf8", timeout: 10_000, windowsHide: true }, (error, stdout) => {
162
+ ],
163
+ // 冷启动 PowerShell/.NET 也占用查询期限;10 秒已在独立 Windows CI 中反复超时。
164
+ // 身份登记独立于后续 RPC 就绪与关闭预算,失败仍禁止使用未知 PID。
165
+ { encoding: "utf8", timeout: 30_000, windowsHide: true }, (error, stdout) => {
166
+ if (error) {
167
+ reject(error instanceof Error
168
+ ? error
169
+ : new Error("Windows process identity query failed", { cause: error }));
170
+ return;
171
+ }
149
172
  const value = stdout.trim();
150
- resolve(error || !/^\d+$/.test(value) ? undefined : `windows:${value}`);
173
+ resolve(!/^\d+$/.test(value) ? undefined : `windows:${value}`);
151
174
  });
152
175
  });
153
176
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-executor-kernel",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -18,9 +18,9 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "@mininglamp-oss/octo-runtime-executor-core": "1.1.1",
22
- "@mininglamp-oss/octo-runtime-protocol": "1.1.1",
23
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.1"
21
+ "@mininglamp-oss/octo-runtime-executor-core": "1.1.3",
22
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.3",
23
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.3"
24
24
  },
25
25
  "types": "./dist/index.d.ts",
26
26
  "files": [
@@ -210,7 +210,7 @@
210
210
  },
211
211
  "allowed_sender_ids": {
212
212
  "type": "array",
213
- "description": "可选。允许触发本 Bot 的真实 Octo 发送者 ID 白名单;省略时仅允许服务端注册返回的 owner,显式名单替代默认 owner 名单,空数组拒绝所有发送者。不能使用展示名称代替身份;群/话题仍须满足真实 mention 和平台范围准入。",
213
+ "description": "可选。允许触发本 Bot 的真实 Octo 发送者 ID 白名单;省略时 DM 沿用平台好友准入,群/话题不增加发送者限制。显式非空名单仅允许列出的发送者,owner 不隐式补入,空数组拒绝全部,null 非法。自消息始终拒绝;群/话题仍须满足真实 mention、Space、启停与父群范围准入。",
214
214
  "items": {
215
215
  "type": "string",
216
216
  "minLength": 1,
@@ -744,7 +744,8 @@ export class ImRuntime {
744
744
  ? undefined
745
745
  : await this.dependencies.prepareContexts?.(this.config, turnSignal),
746
746
  initialSession,
747
- mentionGuidance: initialSession || !executionSession.providerSession,
747
+ // 逐轮提醒让升级前的 Provider binding 也收到新 mention 规则,不隐式 reset。
748
+ mentionGuidance: true,
748
749
  ...(gapEnabled
749
750
  ? {
750
751
  historyGap: gapPlan,
@@ -35,6 +35,7 @@ export interface ImCommonConfig {
35
35
  initial_delay_ms?: number;
36
36
  max_delay_ms?: number;
37
37
  };
38
+ /** 省略沿用平台消息准入;显式名单限制所有频道,空数组拒绝全部发送者。 */
38
39
  allowed_sender_ids?: string[];
39
40
  }
40
41
  export interface OctoBotConfig extends ImCommonConfig {
@@ -57,6 +58,7 @@ export interface ImInboundMessage {
57
58
  position?: {
58
59
  messageSeq: number;
59
60
  };
61
+ /** 同代次卡片重试:buildContext 返回 Gateway 已组合的冻结快照,不再采集或追加默认项。 */
60
62
  historyRetry?: boolean;
61
63
  bindHistoryTurn?(token: ImGapTurnToken): void;
62
64
  markRead?(signal: AbortSignal): Promise<void>;
@@ -9,6 +9,7 @@ import { join } from "node:path";
9
9
  import { assertContextEnvelope, mergeContext } from "@mininglamp-oss/octo-runtime-protocol";
10
10
  import { validateImConfig } from "../lifecycle/configuration.js";
11
11
  import { compactHistoryGap, historyGapContext } from "../application/context-gap.js";
12
+ import { MENTION_GUIDANCE } from "../transport/mentions.js";
12
13
  export function createImInvocation(config, message, context, sessionKey, session, _signal, occurrenceId = message.messageId) {
13
14
  validateImConfig(config);
14
15
  assertContextEnvelope(context);
@@ -77,7 +78,30 @@ export function createImInvocation(config, message, context, sessionKey, session
77
78
  ]
78
79
  };
79
80
  // Channel 只组装公开 InvokeInput;执行解析和指令渲染统一交给 Host,避免再次拒绝业务 Context。
81
+ // 宿主已先解析静态/动态 Context;渠道默认指令只在本轮与有效 entries 保序组合一次。
82
+ // 不改变公共 mergeContext 或动态人设替换合同,也不把上一轮的组合结果累积回来。
80
83
  let submitted = context;
84
+ // 同代次卡片重试已从 occurrence 取得组合后的冻结快照,不能再次追加或按文本去重。
85
+ if (!message.historyRetry) {
86
+ const instructions = context.items.find((item) => item.namespace === "octo.control" && item.name === "instructions");
87
+ const channelInstructions = {
88
+ namespace: "octo.control",
89
+ name: "instructions",
90
+ payload: {
91
+ entries: [
92
+ ...(instructions?.payload
93
+ ?.entries ?? []),
94
+ { text: MENTION_GUIDANCE }
95
+ ]
96
+ }
97
+ };
98
+ submitted = {
99
+ schema: context.schema,
100
+ items: instructions
101
+ ? context.items.map((item) => (item === instructions ? channelInstructions : item))
102
+ : [...context.items, channelInstructions]
103
+ };
104
+ }
81
105
  let snapshot;
82
106
  // 执行默认项也占协议预算;只降级本渠道自动追加的辅助材料,不丢弃显式业务项。
83
107
  for (const optional of [
@@ -94,7 +94,7 @@ export class GatewayTransport {
94
94
  this.callbacks.onRulesChanged?.(change);
95
95
  return;
96
96
  }
97
- if (!acceptsImMessage(this.scopedConfig, registration.owner_uid, message))
97
+ if (!acceptsImMessage(this.scopedConfig, message))
98
98
  return;
99
99
  let finalReply;
100
100
  let historyTurn;
@@ -248,7 +248,7 @@ export class GatewayTransport {
248
248
  this.#bindings.delete(idle[0]);
249
249
  }
250
250
  if (!this.#polling)
251
- this.#polling = this.#pollActions(token, registration.owner_uid, signal);
251
+ this.#polling = this.#pollActions(token, signal);
252
252
  return {
253
253
  interaction: async (request) => {
254
254
  const document = interactionCard(request);
@@ -351,7 +351,7 @@ export class GatewayTransport {
351
351
  throw new ImConnectionError("IM_DISCONNECTED", true);
352
352
  this.#connected = true;
353
353
  }
354
- async #pollActions(token, owner, signal) {
354
+ async #pollActions(token, signal) {
355
355
  if (this.config.cards === false)
356
356
  return;
357
357
  let cursor = 0, failures = 0;
@@ -379,7 +379,8 @@ export class GatewayTransport {
379
379
  continue;
380
380
  }
381
381
  if (action.spaceId !== this.#spaceId ||
382
- !(this.config.allowed_sender_ids ?? [owner]).includes(action.operatorUid)) {
382
+ (this.config.allowed_sender_ids &&
383
+ !this.config.allowed_sender_ids.includes(action.operatorUid))) {
383
384
  cursor = event.event_id;
384
385
  continue;
385
386
  }
@@ -8,7 +8,7 @@ import { getGroupMd, getThreadMd } from "./api/rules.js";
8
8
  import { getChannelMessagePage } from "./api/conversations.js";
9
9
  import { compactHistoryGap, historyGapContext, IM_HISTORY_MESSAGE_LIMIT, planHistoryGap, validMessageSeq } from "../application/context-gap.js";
10
10
  import { OctoApiError } from "./api/errors.js";
11
- import { MENTION_GUIDANCE } from "./mentions.js";
11
+ import { MENTION_REMINDER } from "./mentions.js";
12
12
  import { messageContent } from "./message-content.js";
13
13
  export async function build_im_contexts(config, message, botToken, signal, options = { initialSession: false }) {
14
14
  const items = structuredClone([
@@ -108,7 +108,7 @@ export async function build_im_contexts(config, message, botToken, signal, optio
108
108
  const instructions = {
109
109
  namespace: "extra.im",
110
110
  name: "mention-instructions",
111
- guidance: MENTION_GUIDANCE,
111
+ guidance: MENTION_REMINDER,
112
112
  payload: {
113
113
  source,
114
114
  actorId: message.fromUid,
@@ -1,11 +1,14 @@
1
1
  import type { MentionEntity } from "./api/types.js";
2
2
  import type { GroupMember } from "./api/conversations.js";
3
- export declare const MENTION_GUIDANCE = "\u4F60\u6B63\u5728\u901A\u8FC7 Octo \u56DE\u590D\u5F53\u524D\u9891\u9053\u3002\u666E\u901A\u56DE\u590D\u4E0D\u8981\u81EA\u52A8 @ \u53D1\u8D77\u8005\u3002\u82E5\u5F53\u524D\u7528\u6237\u660E\u786E\u8981\u6C42\u5728\u4EFB\u52A1\u5B8C\u6210\u540E\u901A\u77E5\u67D0\u4F4D\u771F\u4EBA\uFF0C\u5148\u5B8C\u6210\u4EFB\u52A1\uFF1B\u5728\u6700\u7EC8\u56DE\u7B54\u524D\uFF0C\u786E\u8BA4\u5BF9\u65B9\u5728\u5F53\u524D\u9891\u9053\u4E2D\u7684\u771F\u5B9E UID \u548C\u663E\u793A\u540D\u3002\u4FE1\u606F\u4E0D\u8DB3\u65F6\u6309\u9700\u4F7F\u7528 octo-cli \u67E5\u8BE2\uFF1B\u540C\u540D\u3001\u67E5\u8BE2\u5931\u8D25\u6216\u627E\u4E0D\u5230\u5408\u9002\u76EE\u6807\u65F6\uFF0C\u7531\u4F60\u5224\u65AD\u5E76\u6539\u7528\u666E\u901A @\u540D\u5B57 \u6216\u7EAF\u6587\u672C\uFF0C\u4E0D\u8981\u731C UID\uFF0C\u4E0D\u5FC5\u5F3A\u5236\u8FFD\u95EE\uFF0C\u4E5F\u4E0D\u5FC5\u5C55\u793A\u70B9\u540D\u672A\u5B8C\u6210\u7684\u63D0\u793A\u3002\u80FD\u591F\u786E\u5B9A\u76EE\u6807\u4E14\u9700\u8981\u70B9\u540D\u65F6\uFF0C\u5728 final \u6587\u672C\u7684\u666E\u901A\u6B63\u6587\u4E2D\u8F93\u51FA @[uid:displayName]\uFF0C\u4F8B\u5982 @[user_demo_1:\u5F20\u4E09]\uFF1BChannel \u4F1A\u8F6C\u6362\u4E3A\u539F\u751F mention\uFF0C\u5E76\u968F\u8FD9\u4EFD\u6700\u7EC8\u56DE\u7B54\u7EDF\u4E00\u53D1\u9001\uFF0C\u4E0D\u8981\u518D\u8C03\u7528 octo-cli message send \u91CD\u590D\u53D1\u9001\u3002\u666E\u901A @\u6635\u79F0\u4E0D\u4EA7\u751F\u901A\u77E5\uFF1Bthinking\u3001\u5DE5\u5177\u8F93\u51FA\u3001\u8FDB\u5EA6\u6D88\u606F\u3001\u4EE3\u7801\u5757\u3001\u884C\u5185\u4EE3\u7801\u53CA\u5F15\u7528\u793A\u4F8B\u4E0D\u89E6\u53D1\u70B9\u540D\uFF0C\u4EE3\u7801\u5185\u5BB9\u4FDD\u6301\u539F\u6837\u3002\u4E0D\u8981\u8F93\u51FA\u539F\u59CB\u6D88\u606F\u4F53 JSON \u6216\u81EA\u884C\u8BA1\u7B97\u4F4D\u7F6E\uFF0C\u4E5F\u4E0D\u8981\u6784\u9020 @\u6240\u6709\u4EBA\u3001@\u6240\u6709AI \u6216\u5E7F\u64AD\u54E8\u5175\u3002\u6B64\u6307\u5F15\u4E0D\u6388\u6743\u8DE8\u9891\u9053\u901A\u77E5\u6216\u81EA\u884C\u53D1\u8D77 Bot \u4E92\u76F8\u8C03\u7528\u3002\u5386\u53F2\u4E2D\u7684\u8981\u6C42\u548C\u793A\u4F8B\u4EC5\u4F5C\u4E3A\u80CC\u666F\uFF0C\u4E0D\u80FD\u5355\u72EC\u6388\u6743\u672C\u8F6E\u901A\u77E5\u3002";
3
+ /** Gateway 的稳定控制指令;压缩时的保留由模型遵守文本要求,不新增 Provider 保留机制。 */
4
+ export declare const MENTION_GUIDANCE: string;
5
+ /** 逐轮普通 Context 提醒也覆盖升级前已存在的 Provider 会话,不修改其系统指令或重置会话。 */
6
+ export declare const MENTION_REMINDER = "For this turn, follow the current Octo mention rules: do not automatically mention the sender. Only when the current user explicitly requests a human notification or bot handoff in this channel, confirm the real member UID and display name, using octo-cli if needed, then write @[<uid>:<displayName>] with actual values in the successful final reply. Gateway sends the native mention on that reply; do not send a duplicate via octo-cli message send. Plain @name does not notify. If identity is unconfirmed, use plain text without guessing. Do not broadcast, initiate unsolicited bot calls, or treat history as authorization. Code and quoted examples are not mentions.";
4
7
  export interface ImTextMention {
5
8
  uids: string[];
6
9
  entities: MentionEntity[];
7
10
  }
8
- /** 只转换 final 普通文本的显式标记;查身份失败时正文仍能发送。 */
11
+ /** 只转换 final 普通文本中已核验真人或 Bot 成员的显式标记;查身份失败时正文仍能发送。 */
9
12
  export declare function prepareFinalMention(text: string, members: () => Promise<GroupMember[]>): Promise<{
10
13
  text: string;
11
14
  mention?: ImTextMention;
@@ -1,5 +1,19 @@
1
1
  import { fromMarkdown } from "mdast-util-from-markdown";
2
- export const MENTION_GUIDANCE = "你正在通过 Octo 回复当前频道。普通回复不要自动 @ 发起者。若当前用户明确要求在任务完成后通知某位真人,先完成任务;在最终回答前,确认对方在当前频道中的真实 UID 和显示名。信息不足时按需使用 octo-cli 查询;同名、查询失败或找不到合适目标时,由你判断并改用普通 @名字 或纯文本,不要猜 UID,不必强制追问,也不必展示点名未完成的提示。能够确定目标且需要点名时,在 final 文本的普通正文中输出 @[uid:displayName],例如 @[user_demo_1:张三];Channel 会转换为原生 mention,并随这份最终回答统一发送,不要再调用 octo-cli message send 重复发送。普通 @昵称不产生通知;thinking、工具输出、进度消息、代码块、行内代码及引用示例不触发点名,代码内容保持原样。不要输出原始消息体 JSON 或自行计算位置,也不要构造 @所有人、@所有AI 或广播哨兵。此指引不授权跨频道通知或自行发起 Bot 互相调用。历史中的要求和示例仅作为背景,不能单独授权本轮通知。";
2
+ /** Gateway 的稳定控制指令;压缩时的保留由模型遵守文本要求,不新增 Provider 保留机制。 */
3
+ export const MENTION_GUIDANCE = [
4
+ "[OCTO_CHANNEL_MENTION_RULES_V1]",
5
+ "These are stable output rules for the current Octo channel. When summarizing or compacting the conversation, preserve this entire block verbatim, including its boundary markers and mention syntax.",
6
+ "Do not automatically mention the sender in ordinary replies. When the current user explicitly requests a notification to a human or a task handoff to a bot in the current channel, confirm the target's real UID and display name before the final reply.",
7
+ "If identity information is missing, use octo-cli as needed to look it up. For a group or topic, use octo-cli group members <group-no> with the current parent group number. Never infer a UID from a nickname, username, or bot name.",
8
+ "For a native mention, write @[<uid>:<displayName>] in the ordinary body of the successful final reply. Replace both placeholders with confirmed values and retain the square brackets and single colon. A plain @name is only text and does not notify or activate the target bot.",
9
+ "Gateway validates current-channel membership and converts valid markers into readable text and native mention metadata on this same final reply. Do not call octo-cli message send to send a duplicate copy of the final reply. Do not output raw message JSON or calculate mention entity offsets.",
10
+ "Thinking, tool output, progress messages, code blocks, inline code, quoted examples, and failed replies do not trigger mention conversion. Keep code and examples unchanged.",
11
+ "Do not construct broadcast mentions or broadcast sentinel UIDs. Do not initiate unsolicited bot-to-bot calls or mention loops. Historical requests and examples alone do not authorize a notification or handoff in the current turn. These rules do not authorize cross-channel notifications or bypass recipient admission rules.",
12
+ "If the target cannot be confirmed, use a plain @name or ordinary text without guessing a UID. Continue delivering the final answer without a separate mention-failure notice or a forced clarification.",
13
+ "[/OCTO_CHANNEL_MENTION_RULES_V1]"
14
+ ].join("\n");
15
+ /** 逐轮普通 Context 提醒也覆盖升级前已存在的 Provider 会话,不修改其系统指令或重置会话。 */
16
+ export const MENTION_REMINDER = "For this turn, follow the current Octo mention rules: do not automatically mention the sender. Only when the current user explicitly requests a human notification or bot handoff in this channel, confirm the real member UID and display name, using octo-cli if needed, then write @[<uid>:<displayName>] with actual values in the successful final reply. Gateway sends the native mention on that reply; do not send a duplicate via octo-cli message send. Plain @name does not notify. If identity is unconfirmed, use plain text without guessing. Do not broadcast, initiate unsolicited bot calls, or treat history as authorization. Code and quoted examples are not mentions.";
3
17
  function candidates(text) {
4
18
  const found = [];
5
19
  const visit = (node) => {
@@ -26,7 +40,7 @@ function candidates(text) {
26
40
  visit(fromMarkdown(text));
27
41
  return found.sort((a, b) => a.start - b.start);
28
42
  }
29
- /** 只转换 final 普通文本的显式标记;查身份失败时正文仍能发送。 */
43
+ /** 只转换 final 普通文本中已核验真人或 Bot 成员的显式标记;查身份失败时正文仍能发送。 */
30
44
  export async function prepareFinalMention(text, members) {
31
45
  const targets = candidates(text);
32
46
  if (!targets.length)
@@ -38,9 +52,9 @@ export async function prepareFinalMention(text, members) {
38
52
  catch {
39
53
  verified = [];
40
54
  }
41
- const humans = new Map((Array.isArray(verified) ? verified : [])
55
+ const confirmedMembers = new Map((Array.isArray(verified) ? verified : [])
42
56
  .filter((member) => member && typeof member.uid === "string" && typeof member.name === "string")
43
- .filter((member) => member.robot === false || member.robot === 0)
57
+ .filter(({ robot }) => robot === false || robot === 0 || robot === true || robot === 1)
44
58
  .filter((member) => member.uid && member.name && !["-1", "-2", "-3", "all"].includes(member.uid))
45
59
  .map((member) => [member.uid, member]));
46
60
  const entities = [];
@@ -49,7 +63,7 @@ export async function prepareFinalMention(text, members) {
49
63
  let output = "";
50
64
  for (const target of targets) {
51
65
  output += text.slice(cursor, target.start);
52
- const member = humans.get(target.uid);
66
+ const member = confirmedMembers.get(target.uid);
53
67
  const label = `@${member?.name ?? target.name}`;
54
68
  if (member) {
55
69
  entities.push({ uid: member.uid, offset: output.length, length: label.length });
@@ -9,7 +9,7 @@ export declare function groupScope(channelId: string): {
9
9
  shortId?: string;
10
10
  };
11
11
  export declare function observesImScope(config: ScopedOctoBotConfig, channelId: string, channelType: number, spaceId?: unknown): boolean;
12
- export declare function acceptsImMessage(config: ScopedOctoBotConfig, owner: string, message: ImMessage): boolean;
12
+ export declare function acceptsImMessage(config: ScopedOctoBotConfig, message: ImMessage): boolean;
13
13
  export declare function isRulesNotification(message: ImMessage): boolean;
14
14
  /** 事件只使规则缓存失效,内容及版本仍由授权 API 核验,不产生执行授权。 */
15
15
  export declare function rulesChange(message: ImMessage): {