@mininglamp-oss/octo-runtime 1.1.1 → 1.1.2

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 (54) 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/package.json +4 -4
  42. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/application/im-channel.js +2 -1
  43. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/contracts.d.ts +1 -0
  44. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/execution/dispatcher.js +24 -0
  45. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/contexts.js +2 -2
  46. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.d.ts +5 -2
  47. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/mentions.js +19 -5
  48. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/dist/transport/normalize.js +1 -0
  49. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-gateway/package.json +6 -6
  50. package/node_modules/@mininglamp-oss/octo-runtime-extra-channel-wecom/package.json +5 -5
  51. package/node_modules/@mininglamp-oss/octo-runtime-extra-webui/package.json +2 -2
  52. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
  53. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  54. package/package.json +27 -25
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-opencode",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
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.2",
9
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.2",
10
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.2"
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.2",
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.2"
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.2",
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.2"
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.2",
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.2",
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.2",
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.2",
9
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.2"
10
10
  },
11
11
  "types": "./dist/index.d.ts",
12
12
  "files": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "commit": "20c377136288a55356300bd3d4a755d0f19a23ee",
2
+ "commit": "5c1921dced4b0852e41426f1c04582159082f482",
3
3
  "dirty": false,
4
- "buildTime": "2026-10-22T07:38:35.134Z"
4
+ "buildTime": "2026-10-22T12:44:46.791Z"
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.2",
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.2",
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.2",
14
+ "@mininglamp-oss/octo-runtime-host-sdk": "1.1.2",
15
+ "@mininglamp-oss/octo-runtime-adapter-openclaw": "1.1.2",
16
+ "@mininglamp-oss/octo-runtime-cross-service": "1.1.2",
17
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.2",
18
+ "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.2",
19
+ "@mininglamp-oss/octo-runtime-executor-core": "1.1.2",
20
+ "@mininglamp-oss/octo-runtime-adapter-antigravity": "1.1.2",
21
+ "@mininglamp-oss/octo-runtime-adapter-claude-code": "1.1.2",
22
+ "@mininglamp-oss/octo-runtime-adapter-codebuddy": "1.1.2",
23
+ "@mininglamp-oss/octo-runtime-adapter-codex": "1.1.2",
24
+ "@mininglamp-oss/octo-runtime-adapter-hermes": "1.1.2",
25
+ "@mininglamp-oss/octo-runtime-adapter-grok-build": "1.1.2",
26
+ "@mininglamp-oss/octo-runtime-adapter-kimi-code": "1.1.2",
27
+ "@mininglamp-oss/octo-runtime-adapter-mcode": "1.1.2",
28
+ "@mininglamp-oss/octo-runtime-adapter-opencode": "1.1.2",
29
+ "@mininglamp-oss/octo-runtime-adapter-qodercli": "1.1.2",
30
+ "@mininglamp-oss/octo-runtime-adapter-qoderclicn": "1.1.2",
31
+ "@mininglamp-oss/octo-runtime-adapter-zcode-gui": "1.1.2",
32
+ "@mininglamp-oss/octo-runtime-extra-channel-wecom": "1.1.2",
33
+ "@mininglamp-oss/octo-runtime-extra-webui": "1.1.2"
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.2",
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.2",
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.2",
9
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.2"
10
10
  },
11
11
  "types": "./dist/index.d.ts",
12
12
  "files": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-executor-kernel",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
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.2",
22
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.2",
23
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.2"
24
24
  },
25
25
  "types": "./dist/index.d.ts",
26
26
  "files": [
@@ -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,
@@ -57,6 +57,7 @@ export interface ImInboundMessage {
57
57
  position?: {
58
58
  messageSeq: number;
59
59
  };
60
+ /** 同代次卡片重试:buildContext 返回 Gateway 已组合的冻结快照,不再采集或追加默认项。 */
60
61
  historyRetry?: boolean;
61
62
  bindHistoryTurn?(token: ImGapTurnToken): void;
62
63
  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 [
@@ -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 });
@@ -15,6 +15,7 @@ export function observesImScope(config, channelId, channelType, spaceId) {
15
15
  config.group_ids.includes(groupScope(channelId).groupNo)));
16
16
  }
17
17
  export function acceptsImMessage(config, owner, message) {
18
+ // 自己发出的消息永不触发 AgentRun,即使真实 @ 自己、@所有AI 或显式列入发送者名单。
18
19
  if (message.fromUid === config.bot_id ||
19
20
  isRulesNotification(message) ||
20
21
  !message.messageId ||
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-extra-channel-gateway",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -18,11 +18,11 @@
18
18
  "docs"
19
19
  ],
20
20
  "dependencies": {
21
- "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.1",
22
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.1",
23
- "@mininglamp-oss/octo-runtime-executor-core": "1.1.1",
24
- "@mininglamp-oss/octo-runtime-host-sdk": "1.1.1",
25
- "@mininglamp-oss/octo-runtime-protocol": "1.1.1",
21
+ "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.2",
22
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.2",
23
+ "@mininglamp-oss/octo-runtime-executor-core": "1.1.2",
24
+ "@mininglamp-oss/octo-runtime-host-sdk": "1.1.2",
25
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.2",
26
26
  "mdast-util-from-markdown": "2.1.0",
27
27
  "ws": "8.22.0"
28
28
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-extra-channel-wecom",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -18,10 +18,10 @@
18
18
  "docs"
19
19
  ],
20
20
  "dependencies": {
21
- "@mininglamp-oss/octo-runtime-host-sdk": "1.1.1",
22
- "@mininglamp-oss/octo-runtime-executor-core": "1.1.1",
23
- "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.1",
21
+ "@mininglamp-oss/octo-runtime-host-sdk": "1.1.2",
22
+ "@mininglamp-oss/octo-runtime-executor-core": "1.1.2",
23
+ "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.2",
24
24
  "ws": "8.22.0",
25
- "@mininglamp-oss/octo-runtime-protocol": "1.1.1"
25
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.2"
26
26
  }
27
27
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-extra-webui",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "description": "Local Runtime workbench with canonical SSE presentation",
@@ -19,6 +19,6 @@
19
19
  "porting-map.md"
20
20
  ],
21
21
  "dependencies": {
22
- "@mininglamp-oss/octo-runtime-protocol": "1.1.1"
22
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.2"
23
23
  }
24
24
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-host-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,9 +19,9 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.1",
23
- "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.1",
24
- "@mininglamp-oss/octo-runtime-protocol": "1.1.1"
22
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.2",
23
+ "@mininglamp-oss/octo-runtime-executor-kernel": "1.1.2",
24
+ "@mininglamp-oss/octo-runtime-protocol": "1.1.2"
25
25
  },
26
26
  "types": "./dist/index.d.ts",
27
27
  "files": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-protocol",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": {