@mininglamp-oss/octo-runtime 1.1.12 → 1.1.13

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 (172) hide show
  1. package/README.md +1 -1
  2. package/apps/cli/dist/adapters.d.ts +19 -1
  3. package/apps/cli/dist/adapters.js +153 -23
  4. package/apps/cli/dist/build-info.json +2 -2
  5. package/apps/cli/dist/codex.d.ts +5 -0
  6. package/apps/cli/dist/codex.js +36 -0
  7. package/apps/cli/dist/kernel.d.ts +4 -0
  8. package/apps/cli/dist/kernel.js +84 -0
  9. package/apps/cli/dist/main.js +8 -7
  10. package/apps/cli/dist/manifest.json +33 -22
  11. package/apps/cli/dist/output.d.ts +1 -0
  12. package/apps/cli/dist/output.js +8 -4
  13. package/apps/cli/dist/playboard.js +21 -12
  14. package/apps/cli/dist/provider-launch.d.ts +28 -0
  15. package/apps/cli/dist/provider-launch.js +52 -0
  16. package/apps/cli/dist/providers.d.ts +182 -0
  17. package/apps/cli/dist/providers.js +34 -0
  18. package/dist/public/adapter-sdk.d.ts +2 -0
  19. package/dist/public/adapter-sdk.js +2 -0
  20. package/dist/public/protocol.d.ts +1 -1
  21. package/dist/public/protocol.js +1 -1
  22. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/dist/index.js +4 -4
  23. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
  24. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.d.ts +15 -14
  25. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +24 -28
  26. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
  27. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.d.ts +10 -35
  28. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.js +22 -29
  29. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
  30. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.d.ts +14 -68
  31. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.js +60 -43
  32. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
  33. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.d.ts +19 -31
  34. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.js +29 -18
  35. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
  36. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.d.ts +6 -5
  37. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +32 -26
  38. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/engine.d.ts +54 -0
  39. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/engine.js +147 -0
  40. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/environment.js +4 -8
  41. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +20 -92
  42. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.js +104 -216
  43. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/mcp.d.ts +2 -2
  44. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/mcp.js +4 -11
  45. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.d.ts +9 -5
  46. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.js +77 -81
  47. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
  48. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +4 -2
  49. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +12 -14
  50. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +3 -3
  51. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.d.ts +14 -14
  52. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.js +23 -30
  53. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +4 -7
  54. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.d.ts +13 -21
  55. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.js +48 -26
  56. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
  57. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.d.ts +16 -14
  58. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.js +15 -7
  59. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
  60. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.d.ts +16 -14
  61. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.js +14 -6
  62. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
  63. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.d.ts +16 -14
  64. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.js +15 -7
  65. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
  66. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.d.ts +7 -3
  67. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +27 -29
  68. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
  69. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +16 -25
  70. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +109 -178
  71. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
  72. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.d.ts +16 -14
  73. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.js +15 -6
  74. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +3 -2
  75. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.d.ts +16 -14
  76. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.js +15 -6
  77. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +3 -2
  78. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/activity.d.ts +5 -1
  79. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.d.ts +49 -0
  80. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.js +256 -0
  81. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/approval.js +7 -2
  82. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.js +1 -1
  83. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/execution-scope.d.ts +5 -1
  84. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +25 -12
  85. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +116 -58
  86. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/mcp.js +1 -1
  87. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.d.ts +11 -1
  88. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.js +89 -8
  89. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/provider-launch.d.ts +10 -0
  90. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/provider-launch.js +25 -0
  91. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.js +10 -3
  92. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
  93. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.d.ts +19 -1
  94. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.js +153 -23
  95. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
  96. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/codex.d.ts +5 -0
  97. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/codex.js +36 -0
  98. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/kernel.d.ts +4 -0
  99. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/kernel.js +84 -0
  100. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +8 -7
  101. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +33 -22
  102. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.d.ts +1 -0
  103. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +8 -4
  104. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +21 -12
  105. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/provider-launch.d.ts +28 -0
  106. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/provider-launch.js +52 -0
  107. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/providers.d.ts +182 -0
  108. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/providers.js +34 -0
  109. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +20 -20
  110. package/node_modules/@mininglamp-oss/octo-runtime-client/build-info.json +2 -2
  111. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.js +2 -2
  112. package/node_modules/@mininglamp-oss/octo-runtime-client/package.json +5 -5
  113. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc.schema.json +3 -104
  114. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/protocol.schema.json +173 -1295
  115. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
  116. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +0 -2
  117. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +26 -54
  118. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.d.ts +2 -2
  119. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +13 -85
  120. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.d.ts +3 -1
  121. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +5 -0
  122. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
  123. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +1 -1
  124. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +1 -1
  125. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.d.ts +5 -0
  126. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +17 -20
  127. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +5 -5
  128. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
  129. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.d.ts +0 -2
  130. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.js +0 -2
  131. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-catalog.d.ts +0 -1
  132. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-catalog.js +3 -5
  133. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-configuration.js +1 -8
  134. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.d.ts +1 -2
  135. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +3 -267
  136. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +2 -0
  137. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +17 -3
  138. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +102 -396
  139. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.js +32 -1
  140. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +6 -15
  141. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +33 -178
  142. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.d.ts +11 -22
  143. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +38 -78
  144. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/multimodal.js +6 -0
  145. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.d.ts +2 -1
  146. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.js +5 -28
  147. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.js +2 -1
  148. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  149. package/package.json +34 -37
  150. package/packages/octo-runtime-protocol/schema/kernel-ipc.schema.json +3 -104
  151. package/packages/octo-runtime-protocol/schema/protocol.schema.json +173 -1295
  152. package/dist/public/codex.d.ts +0 -1
  153. package/dist/public/codex.js +0 -1
  154. package/dist/public/dsh.d.ts +0 -2
  155. package/dist/public/dsh.js +0 -1
  156. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-configuration-fixtures.json +0 -1219
  157. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-fixtures.json +0 -5988
  158. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-client.behavior.json +0 -56
  159. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/native-invoke-fixtures.json +0 -116
  160. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/run-protocol-fixtures.json +0 -761
  161. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/runtime-selection-fixtures.json +0 -663
  162. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/session-name-fixtures.json +0 -191
  163. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/context.d.ts +0 -12
  164. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/context.js +0 -89
  165. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/execution-preparation.d.ts +0 -33
  166. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/execution-preparation.js +0 -93
  167. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/execution-plan.d.ts +0 -3
  168. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/execution-plan.js +0 -80
  169. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/model-context.d.ts +0 -3
  170. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/model-context.js +0 -9
  171. /package/node_modules/@mininglamp-oss/octo-runtime-client/{schema → fixtures}/kernel-ipc-fixtures.json +0 -0
  172. /package/packages/octo-runtime-protocol/{schema → test/fixtures}/kernel-ipc-fixtures.json +0 -0
@@ -1,3 +1,5 @@
1
+ import type { AdapterMetadata } from "@mininglamp-oss/octo-runtime-adapter-sdk";
2
+ import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
1
3
  /**
2
4
  * Qoder CLI ACP adapter. Launches `qodercli --acp` and speaks the Agent
3
5
  * Client Protocol through the shared ACP adapter, which reconstructs model
@@ -10,22 +12,22 @@
10
12
  * fallback. Per-session model selection follows the standard ACP path when the
11
13
  * runtime configures a model that Qoder advertises.
12
14
  */
13
- export declare const qoderCliAdapter: Readonly<Omit<{
14
- metadata: {
15
- mcp: true;
16
- type: string;
17
- agentSources: "provisioned"[];
18
- };
19
- probe: () => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>;
15
+ export declare const qoderCliMetadata: AdapterMetadata;
16
+ /** 宿主交付所选命令或 client factory;本模块仅维护 ACP 协议要求。 */
17
+ export declare function createQoderCliAdapter(options: NonNullable<Parameters<typeof createAcpAdapter>[1]> & {
18
+ command: string;
19
+ }): Readonly<Omit<{
20
+ metadata: AdapterMetadata;
21
+ probe: (() => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>) | (() => Promise<{
22
+ available: false;
23
+ command: string;
24
+ reason: string;
25
+ }>);
20
26
  respondInteraction(invocationId: string, response: import("@mininglamp-oss/octo-runtime-protocol").InteractionResponse): Promise<void>;
21
27
  invoke(request: import("@mininglamp-oss/octo-runtime-protocol").InvokeRequest, context?: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterInvocationContext): AsyncGenerator<import("@mininglamp-oss/octo-runtime-protocol").CanonicalEvent>;
22
- }, "metadata"> & {
23
- metadata: Omit<{
24
- mcp: true;
25
- type: string;
26
- agentSources: "provisioned"[];
27
- }, "protocolSupport"> & {
28
+ }, "metadata" | "defaultAgentEnv"> & {
29
+ readonly defaultAgentEnv: import("@mininglamp-oss/octo-runtime-protocol").AgentEnv;
30
+ metadata: Omit<AdapterMetadata, "protocolSupport"> & {
28
31
  protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
29
32
  };
30
33
  }>;
31
- export default qoderCliAdapter;
@@ -1,3 +1,4 @@
1
+ import { invocationApprovalMode } from "@mininglamp-oss/octo-runtime-adapter-sdk";
1
2
  import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
2
3
  /**
3
4
  * Qoder CLI ACP adapter. Launches `qodercli --acp` and speaks the Agent
@@ -11,10 +12,18 @@ import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
11
12
  * fallback. Per-session model selection follows the standard ACP path when the
12
13
  * runtime configures a model that Qoder advertises.
13
14
  */
14
- export const qoderCliAdapter = createAcpAdapter({
15
+ export const qoderCliMetadata = {
15
16
  type: "qodercli",
16
- provider: "qodercli",
17
- command: "qodercli",
18
- args: (request) => (request.approvalMode === "full_access" ? ["--yolo", "--acp"] : ["--acp"])
19
- });
20
- export default qoderCliAdapter;
17
+ mcp: true,
18
+ agentSources: ["provisioned"]
19
+ };
20
+ /** 宿主交付所选命令或 client factory;本模块仅维护 ACP 协议要求。 */
21
+ export function createQoderCliAdapter(options) {
22
+ return createAcpAdapter({
23
+ metadata: qoderCliMetadata,
24
+ type: "qodercli",
25
+ provider: "qodercli",
26
+ command: options.command,
27
+ args: (request) => invocationApprovalMode(request) === "full_access" ? ["--yolo", "--acp"] : ["--acp"]
28
+ }, options);
29
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-qodercli",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -9,6 +9,7 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.12"
12
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.13",
13
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.13"
13
14
  }
14
15
  }
@@ -1,3 +1,5 @@
1
+ import type { AdapterMetadata } from "@mininglamp-oss/octo-runtime-adapter-sdk";
2
+ import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
1
3
  /**
2
4
  * Qoder CN CLI ACP adapter. Launches `qoderclicn --acp` and speaks the
3
5
  * Agent Client Protocol through the shared ACP adapter, which reconstructs
@@ -10,22 +12,22 @@
10
12
  * binary and is registered as its own adapter type so a runtime can pick the CN
11
13
  * build explicitly.
12
14
  */
13
- export declare const qoderCliCnAdapter: Readonly<Omit<{
14
- metadata: {
15
- mcp: true;
16
- type: string;
17
- agentSources: "provisioned"[];
18
- };
19
- probe: () => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>;
15
+ export declare const qoderCliCnMetadata: AdapterMetadata;
16
+ /** 宿主交付所选命令或 client factory;本模块仅维护 ACP 协议要求。 */
17
+ export declare function createQoderCliCnAdapter(options: NonNullable<Parameters<typeof createAcpAdapter>[1]> & {
18
+ command: string;
19
+ }): Readonly<Omit<{
20
+ metadata: AdapterMetadata;
21
+ probe: (() => Promise<import("@mininglamp-oss/octo-runtime-adapter-sdk").ProbeResult>) | (() => Promise<{
22
+ available: false;
23
+ command: string;
24
+ reason: string;
25
+ }>);
20
26
  respondInteraction(invocationId: string, response: import("@mininglamp-oss/octo-runtime-protocol").InteractionResponse): Promise<void>;
21
27
  invoke(request: import("@mininglamp-oss/octo-runtime-protocol").InvokeRequest, context?: import("@mininglamp-oss/octo-runtime-adapter-sdk").AdapterInvocationContext): AsyncGenerator<import("@mininglamp-oss/octo-runtime-protocol").CanonicalEvent>;
22
- }, "metadata"> & {
23
- metadata: Omit<{
24
- mcp: true;
25
- type: string;
26
- agentSources: "provisioned"[];
27
- }, "protocolSupport"> & {
28
+ }, "metadata" | "defaultAgentEnv"> & {
29
+ readonly defaultAgentEnv: import("@mininglamp-oss/octo-runtime-protocol").AgentEnv;
30
+ metadata: Omit<AdapterMetadata, "protocolSupport"> & {
28
31
  protocolSupport: import("@mininglamp-oss/octo-runtime-protocol").AdapterProtocolSupport;
29
32
  };
30
33
  }>;
31
- export default qoderCliCnAdapter;
@@ -1,3 +1,4 @@
1
+ import { invocationApprovalMode } from "@mininglamp-oss/octo-runtime-adapter-sdk";
1
2
  import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
2
3
  /**
3
4
  * Qoder CN CLI ACP adapter. Launches `qoderclicn --acp` and speaks the
@@ -11,10 +12,18 @@ import { createAcpAdapter } from "@mininglamp-oss/octo-runtime-adapter-acp";
11
12
  * binary and is registered as its own adapter type so a runtime can pick the CN
12
13
  * build explicitly.
13
14
  */
14
- export const qoderCliCnAdapter = createAcpAdapter({
15
+ export const qoderCliCnMetadata = {
15
16
  type: "qoderclicn",
16
- provider: "qoderclicn",
17
- command: "qoderclicn",
18
- args: (request) => (request.approvalMode === "full_access" ? ["--yolo", "--acp"] : ["--acp"])
19
- });
20
- export default qoderCliCnAdapter;
17
+ mcp: true,
18
+ agentSources: ["provisioned"]
19
+ };
20
+ /** 宿主交付所选命令或 client factory;本模块仅维护 ACP 协议要求。 */
21
+ export function createQoderCliCnAdapter(options) {
22
+ return createAcpAdapter({
23
+ metadata: qoderCliCnMetadata,
24
+ type: "qoderclicn",
25
+ provider: "qoderclicn",
26
+ command: options.command,
27
+ args: (request) => invocationApprovalMode(request) === "full_access" ? ["--yolo", "--acp"] : ["--acp"]
28
+ }, options);
29
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-adapter-qoderclicn",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -9,6 +9,7 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.12"
12
+ "@mininglamp-oss/octo-runtime-adapter-sdk": "1.1.13",
13
+ "@mininglamp-oss/octo-runtime-adapter-acp": "1.1.13"
13
14
  }
14
15
  }
@@ -1,4 +1,4 @@
1
- import type { ProtocolMode, StreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
1
+ import type { ProtocolMode, RuntimeLimits, StreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
2
2
  import type { RuntimeLog } from "./runtime-log.js";
3
3
  /** Provider progress used by the host watchdog to enforce execution deadlines. */
4
4
  export interface ProviderActivity {
@@ -8,6 +8,10 @@ export interface ProviderActivity {
8
8
  toolState?: "started" | "completed";
9
9
  }
10
10
  export interface AdapterInvocationContext {
11
+ /** 宿主可信连接设置不改写调用方 AgentEnv。 */
12
+ providerOptions?: Record<string, string>;
13
+ /** Adapter 解释预算后配置本次 Core 看门狗;不传 Provider 配置副本。 */
14
+ configureRuntimeLimits?(limits: RuntimeLimits | undefined): void;
11
15
  protocolMode?: ProtocolMode;
12
16
  streamLimits?: Readonly<StreamLimitPolicy>;
13
17
  /** Existing host metadata sink; never serialize or log provider bodies. */
@@ -0,0 +1,49 @@
1
+ import { type AgentEnv, type ContextItem, type AgentSource, type ApprovalMode, type InvokeRequest, type RuntimeLimits } from "@mininglamp-oss/octo-runtime-protocol";
2
+ /**
3
+ * 在 Adapter 消费本轮 AgentEnv 时,按 namespace/name 精确读取 bean 的 payload;不存在则返回 undefined。
4
+ * 公共与私有 bean 都可读取。私有名称、字段和类型由宿主与对应 Adapter 约定,无须公共 schema 注册。
5
+ * T 仅提供编译期类型提示,不做运行时校验;必填检查、默认值及 Provider 原生映射由消费方负责。
6
+ * 返回原 payload 引用,不复制或修改信封;调用方应只读使用,不写回默认值或跨调用保存配置。
7
+ *
8
+ * @example
9
+ * const options = agentEnvItem<{ agentId: string }>(req.agentEnv, "adapter.my-adapter", "options");
10
+ * if (!options || typeof options.agentId !== "string" || !options.agentId.trim())
11
+ * throw new TypeError("MY_ADAPTER_AGENT_ID_REQUIRED");
12
+ *
13
+ * @see https://github.com/Mininglamp-OSS/octo-runtime/blob/main/docs/zh-CN/getting-started/sdk.md
14
+ * @see https://github.com/Mininglamp-OSS/octo-runtime/blob/main/docs/en/getting-started/sdk.md
15
+ */
16
+ export declare function agentEnvItem<T extends object = Record<string, unknown>>(env: AgentEnv, namespace: string, name: string): T | undefined;
17
+ /**
18
+ * Adapter 读取公共 octo.execution/model bean 的 selection.id,取得本轮显式选择的 Provider 模型标识。
19
+ * 条目或 id 缺失时返回 undefined;不补默认模型、不查询模型目录,也不读取私有 options 中的同名字段。
20
+ * 本函数只读不改写 AgentEnv;字段类型、可用性检查及 Provider 原生参数映射仍由 Adapter 负责。
21
+ * 私有配置使用 agentEnvItem<T>(request.agentEnv, namespace, name),不扩展公共 model bean。
22
+ *
23
+ * @see https://github.com/Mininglamp-OSS/octo-runtime/blob/main/docs/zh-CN/getting-started/sdk.md
24
+ * @see https://github.com/Mininglamp-OSS/octo-runtime/blob/main/docs/en/getting-started/sdk.md
25
+ */
26
+ export declare function invocationModel(request: InvokeRequest): string | undefined;
27
+ export declare function invocationEffort(request: InvokeRequest): string | undefined;
28
+ export declare function invocationWorkdir(request: InvokeRequest): string;
29
+ export declare function invocationApprovalMode(request: InvokeRequest): ApprovalMode;
30
+ export declare function invocationAgentSource(request: InvokeRequest): AgentSource;
31
+ /** Harness 私有选项仍是原始 payload;不生成公共配置副本。 */
32
+ export declare function invocationOptions(request: InvokeRequest, adapterType?: string): Record<string, unknown>;
33
+ /** 可信连接选项只绑定本次 Adapter 调用,不写回调用方信封。 */
34
+ export declare function bindInvocationConnection(request: InvokeRequest, options?: Record<string, string>): void;
35
+ export declare function invocationProviderOptions(request: InvokeRequest, adapterType?: string): Record<string, unknown>;
36
+ export declare function invocationOption(request: InvokeRequest, key: string, adapterType?: string): string | undefined;
37
+ export declare function invocationTimeoutSeconds(request: InvokeRequest, adapterType?: string): number | undefined;
38
+ /** Adapter 解释预算,Core 仅按本地回调执行计时,不解析配置条目。 */
39
+ export declare function invocationRuntimeLimits(request: InvokeRequest): RuntimeLimits | undefined;
40
+ /** 每个 Harness 拥有自己的默认信封;不包含隐式 cwd、模型或业务材料。 */
41
+ export declare function defaultAgentEnv(type: string, source?: AgentSource): AgentEnv;
42
+ /** 调用方显式补缺省条目,保留已提交条目的顺序和值,返回独立副本。 */
43
+ export declare function withAgentEnvDefaults(submitted: AgentEnv, defaults: AgentEnv): AgentEnv;
44
+ /** 调用方显式替换同名 bean;不解释 payload,不改变其他条目的相对顺序。 */
45
+ export declare function withAgentEnvItems(env: AgentEnv | undefined, items: ContextItem[]): AgentEnv;
46
+ /** 公共 bean 的消费校验;未消费的私有扩展不参与,也不需要中央注册。 */
47
+ export declare function assertAdapterAgentEnv(request: InvokeRequest): void;
48
+ /** 调用方准备目录;Adapter 在启动 Provider 前检查,不创建或替换路径。 */
49
+ export declare function assertAdapterWorkdir(request: InvokeRequest, workspace?: boolean): Promise<void>;
@@ -0,0 +1,256 @@
1
+ import { constants } from "node:fs";
2
+ import { access, stat } from "node:fs/promises";
3
+ import { isAbsolute } from "node:path";
4
+ import { assertAgentEnv, assertApprovalMode, assertAgentSource, assertContextEnvs, assertContextMcp, assertRuntimeLimits, contextItem, CONTEXT_SCHEMA, DEFAULT_RUN_TIMEOUT_MS } from "@mininglamp-oss/octo-runtime-protocol";
5
+ /**
6
+ * 在 Adapter 消费本轮 AgentEnv 时,按 namespace/name 精确读取 bean 的 payload;不存在则返回 undefined。
7
+ * 公共与私有 bean 都可读取。私有名称、字段和类型由宿主与对应 Adapter 约定,无须公共 schema 注册。
8
+ * T 仅提供编译期类型提示,不做运行时校验;必填检查、默认值及 Provider 原生映射由消费方负责。
9
+ * 返回原 payload 引用,不复制或修改信封;调用方应只读使用,不写回默认值或跨调用保存配置。
10
+ *
11
+ * @example
12
+ * const options = agentEnvItem<{ agentId: string }>(req.agentEnv, "adapter.my-adapter", "options");
13
+ * if (!options || typeof options.agentId !== "string" || !options.agentId.trim())
14
+ * throw new TypeError("MY_ADAPTER_AGENT_ID_REQUIRED");
15
+ *
16
+ * @see https://github.com/Mininglamp-OSS/octo-runtime/blob/main/docs/zh-CN/getting-started/sdk.md
17
+ * @see https://github.com/Mininglamp-OSS/octo-runtime/blob/main/docs/en/getting-started/sdk.md
18
+ */
19
+ export function agentEnvItem(env, namespace, name) {
20
+ return contextItem(env, namespace, name)?.payload;
21
+ }
22
+ /**
23
+ * Adapter 读取公共 octo.execution/model bean 的 selection.id,取得本轮显式选择的 Provider 模型标识。
24
+ * 条目或 id 缺失时返回 undefined;不补默认模型、不查询模型目录,也不读取私有 options 中的同名字段。
25
+ * 本函数只读不改写 AgentEnv;字段类型、可用性检查及 Provider 原生参数映射仍由 Adapter 负责。
26
+ * 私有配置使用 agentEnvItem<T>(request.agentEnv, namespace, name),不扩展公共 model bean。
27
+ *
28
+ * @see https://github.com/Mininglamp-OSS/octo-runtime/blob/main/docs/zh-CN/getting-started/sdk.md
29
+ * @see https://github.com/Mininglamp-OSS/octo-runtime/blob/main/docs/en/getting-started/sdk.md
30
+ */
31
+ export function invocationModel(request) {
32
+ return agentEnvItem(request.agentEnv, "octo.execution", "model")
33
+ ?.selection?.id;
34
+ }
35
+ export function invocationEffort(request) {
36
+ return agentEnvItem(request.agentEnv, "octo.execution", "model")?.reasoning?.effort;
37
+ }
38
+ export function invocationWorkdir(request) {
39
+ return (agentEnvItem(request.agentEnv, "octo.execution", "workspace")?.path ?? "");
40
+ }
41
+ export function invocationApprovalMode(request) {
42
+ const mode = agentEnvItem(request.agentEnv, "octo.security", "approval_policy")
43
+ ?.mode ?? "ask";
44
+ assertApprovalMode(mode);
45
+ return mode;
46
+ }
47
+ export function invocationAgentSource(request) {
48
+ const source = agentEnvItem(request.agentEnv, "octo.execution", "agent")?.source ??
49
+ "provisioned";
50
+ assertAgentSource(source);
51
+ return source;
52
+ }
53
+ /** Harness 私有选项仍是原始 payload;不生成公共配置副本。 */
54
+ export function invocationOptions(request, adapterType) {
55
+ const type = adapterType ??
56
+ agentEnvItem(request.agentEnv, "octo.execution", "adapter")?.type;
57
+ return agentEnvItem(request.agentEnv, `adapter.${type}`, "options") ?? {};
58
+ }
59
+ const connections = new WeakMap();
60
+ /** 可信连接选项只绑定本次 Adapter 调用,不写回调用方信封。 */
61
+ export function bindInvocationConnection(request, options) {
62
+ if (options)
63
+ connections.set(request, { ...options });
64
+ else
65
+ connections.delete(request);
66
+ }
67
+ export function invocationProviderOptions(request, adapterType) {
68
+ return { ...invocationOptions(request, adapterType), ...connections.get(request) };
69
+ }
70
+ export function invocationOption(request, key, adapterType) {
71
+ const value = invocationProviderOptions(request, adapterType)[key];
72
+ if (value !== undefined && typeof value !== "string")
73
+ throw new TypeError(`ADAPTER_OPTION_INVALID: ${key}`);
74
+ return value;
75
+ }
76
+ export function invocationTimeoutSeconds(request, adapterType) {
77
+ const value = invocationOptions(request, adapterType).timeoutSeconds;
78
+ if (value !== undefined && (typeof value !== "number" || !Number.isFinite(value) || value <= 0))
79
+ throw new TypeError("ADAPTER_OPTION_INVALID: timeoutSeconds");
80
+ return value;
81
+ }
82
+ const LIMIT_NAMES = {
83
+ first_frame_timeout_ms: "firstFrameTimeoutMs",
84
+ model_idle_timeout_ms: "modelIdleTimeoutMs",
85
+ model_idle_warning_ms: "modelIdleWarningMs",
86
+ model_idle_policy: "modelIdlePolicy",
87
+ tool_timeout_ms: "toolTimeoutMs",
88
+ tool_wall_timeout_ms: "toolWallTimeoutMs",
89
+ run_timeout_ms: "runTimeoutMs",
90
+ cancel_grace_ms: "cancelGraceMs",
91
+ enforcement: "enforcement"
92
+ };
93
+ /** Adapter 解释预算,Core 仅按本地回调执行计时,不解析配置条目。 */
94
+ export function invocationRuntimeLimits(request) {
95
+ const payload = agentEnvItem(request.agentEnv, "octo.execution", "limits");
96
+ if (!payload)
97
+ return undefined;
98
+ const result = {};
99
+ for (const [key, value] of Object.entries(payload)) {
100
+ if (!Object.hasOwn(LIMIT_NAMES, key))
101
+ throw new TypeError("ADAPTER_LIMIT_UNSUPPORTED");
102
+ result[LIMIT_NAMES[key]] = value;
103
+ }
104
+ assertRuntimeLimits(result);
105
+ return result;
106
+ }
107
+ /** 每个 Harness 拥有自己的默认信封;不包含隐式 cwd、模型或业务材料。 */
108
+ export function defaultAgentEnv(type, source = "provisioned") {
109
+ return {
110
+ schema: CONTEXT_SCHEMA,
111
+ items: [
112
+ { namespace: "octo.execution", name: "adapter", payload: { type } },
113
+ { namespace: "octo.execution", name: "agent", payload: { source } },
114
+ { namespace: "octo.security", name: "approval_policy", payload: { mode: "ask" } },
115
+ {
116
+ namespace: "octo.execution",
117
+ name: "limits",
118
+ payload: { run_timeout_ms: DEFAULT_RUN_TIMEOUT_MS }
119
+ }
120
+ ]
121
+ };
122
+ }
123
+ /** 调用方显式补缺省条目,保留已提交条目的顺序和值,返回独立副本。 */
124
+ export function withAgentEnvDefaults(submitted, defaults) {
125
+ assertAgentEnv(submitted);
126
+ assertAgentEnv(defaults);
127
+ const keys = new Set(submitted.items.map((item) => `${item.namespace}/${item.name}`));
128
+ const result = structuredClone({
129
+ schema: submitted.schema,
130
+ items: [
131
+ ...submitted.items,
132
+ ...defaults.items.filter((item) => !keys.has(`${item.namespace}/${item.name}`))
133
+ ]
134
+ });
135
+ assertAgentEnv(result);
136
+ return result;
137
+ }
138
+ /** 调用方显式替换同名 bean;不解释 payload,不改变其他条目的相对顺序。 */
139
+ export function withAgentEnvItems(env, items) {
140
+ const base = env ?? { schema: CONTEXT_SCHEMA, items: [] };
141
+ assertAgentEnv(base);
142
+ // 先校验覆盖信封,避免 Map 将调用方重复键静默折叠。
143
+ assertAgentEnv({ schema: CONTEXT_SCHEMA, items });
144
+ const overrides = new Map(items.map((item) => [`${item.namespace}/${item.name}`, item]));
145
+ const merged = base.items.map((item) => {
146
+ const key = `${item.namespace}/${item.name}`;
147
+ const next = overrides.get(key) ?? item;
148
+ overrides.delete(key);
149
+ return next;
150
+ });
151
+ const result = structuredClone({
152
+ schema: CONTEXT_SCHEMA,
153
+ items: [...merged, ...overrides.values()]
154
+ });
155
+ assertAgentEnv(result);
156
+ return result;
157
+ }
158
+ /** 公共 bean 的消费校验;未消费的私有扩展不参与,也不需要中央注册。 */
159
+ export function assertAdapterAgentEnv(request) {
160
+ assertAgentEnv(request.agentEnv);
161
+ invocationApprovalMode(request);
162
+ invocationAgentSource(request);
163
+ invocationRuntimeLimits(request);
164
+ for (const item of request.agentEnv.items) {
165
+ if (item.namespace === "octo.security" && item.name === "approval_policy") {
166
+ assertFields(item.payload, ["mode"]);
167
+ assertApprovalMode(item.payload.mode);
168
+ }
169
+ if (item.namespace !== "octo.execution")
170
+ continue;
171
+ const value = item.payload;
172
+ if (item.name === "adapter") {
173
+ assertFields(value, ["type"]);
174
+ if (typeof value.type !== "string" || !value.type)
175
+ throw new TypeError("ADAPTER_TYPE_INVALID");
176
+ }
177
+ if (item.name === "agent") {
178
+ assertFields(value, ["source"]);
179
+ assertAgentSource(value.source);
180
+ }
181
+ if (item.name === "workspace" &&
182
+ (Object.keys(value).some((k) => k !== "path") || typeof value.path !== "string"))
183
+ throw new TypeError("WORKDIR_INVALID");
184
+ if (item.name === "actmode") {
185
+ assertFields(value, ["mode"]);
186
+ if (!["plan", "default"].includes(String(value.mode)))
187
+ throw new TypeError("CONTEXT_SCHEMA_INVALID: actmode");
188
+ }
189
+ if (item.name === "model") {
190
+ assertFields(value, ["selection", "reasoning"]);
191
+ if (!Object.keys(value).length)
192
+ throw new TypeError("CONTEXT_SCHEMA_INVALID: model");
193
+ for (const [field, property] of [
194
+ ["selection", "id"],
195
+ ["reasoning", "effort"]
196
+ ]) {
197
+ const bean = value[field];
198
+ if (bean === undefined)
199
+ continue;
200
+ if (!bean || typeof bean !== "object" || Array.isArray(bean))
201
+ throw new TypeError("CONTEXT_SCHEMA_INVALID: model");
202
+ const setting = bean;
203
+ assertFields(setting, [property, "use_provider_default"]);
204
+ if (setting.use_provider_default === true && setting[property] === undefined)
205
+ continue;
206
+ if (typeof setting[property] !== "string" ||
207
+ !setting[property] ||
208
+ setting.use_provider_default !== undefined)
209
+ throw new TypeError("CONTEXT_SCHEMA_INVALID: model");
210
+ }
211
+ }
212
+ if (item.name === "envs")
213
+ assertContextEnvs(value);
214
+ if (item.name === "mcp")
215
+ assertContextMcp(value);
216
+ }
217
+ }
218
+ function assertFields(value, allowed) {
219
+ if (Object.keys(value).some((key) => !allowed.includes(key)))
220
+ throw new TypeError("CONTEXT_SCHEMA_INVALID");
221
+ }
222
+ /** 调用方准备目录;Adapter 在启动 Provider 前检查,不创建或替换路径。 */
223
+ export async function assertAdapterWorkdir(request, workspace = true) {
224
+ const path = invocationWorkdir(request);
225
+ if (!workspace || (invocationAgentSource(request) === "preset" && !path))
226
+ return;
227
+ const messages = {
228
+ WORKDIR_REQUIRED: "A prepared working directory is required; create it and provide its absolute path.",
229
+ WORKDIR_INVALID: "Working directory must be an absolute path without NUL characters.",
230
+ WORKDIR_NOT_FOUND: "Working directory does not exist; create it before invoking Runtime.",
231
+ WORKDIR_NOT_DIRECTORY: "Working directory must point to an existing directory.",
232
+ WORKDIR_UNAVAILABLE: "Working directory is not accessible; check directory access permissions."
233
+ };
234
+ const fail = (code) => {
235
+ throw Object.assign(new TypeError(messages[code]), { code });
236
+ };
237
+ if (!path)
238
+ fail("WORKDIR_REQUIRED");
239
+ if (!isAbsolute(path) || path.includes("\0"))
240
+ fail("WORKDIR_INVALID");
241
+ try {
242
+ if (!(await stat(path)).isDirectory())
243
+ fail("WORKDIR_NOT_DIRECTORY");
244
+ await access(path, constants.X_OK);
245
+ }
246
+ catch (error) {
247
+ const code = error && typeof error === "object" && "code" in error ? String(error.code) : "";
248
+ if (code.startsWith("WORKDIR_"))
249
+ throw error;
250
+ fail(code === "ENOENT"
251
+ ? "WORKDIR_NOT_FOUND"
252
+ : code === "ENOTDIR"
253
+ ? "WORKDIR_NOT_DIRECTORY"
254
+ : "WORKDIR_UNAVAILABLE");
255
+ }
256
+ }
@@ -1,3 +1,4 @@
1
+ import { invocationApprovalMode } from "./agent-env.js";
1
2
  import { randomUUID } from "node:crypto";
2
3
  import { sanitizePublicValue } from "./public-display.js";
3
4
  import { contextHash } from "@mininglamp-oss/octo-runtime-protocol";
@@ -24,7 +25,8 @@ export class AcpApprovalBridge {
24
25
  requestPermission(params, providerExpiresAt) {
25
26
  if (this.#closed || this.request.signal?.aborted)
26
27
  return Promise.reject(new Error("APPROVAL_WAIT_UNAVAILABLE"));
27
- const automatic = (this.options.effectiveApprovalMode ?? this.request.approvalMode) === "full_access";
28
+ const automatic = (this.options.effectiveApprovalMode ?? invocationApprovalMode(this.request)) ===
29
+ "full_access";
28
30
  const options = Array.isArray(params.options) ? params.options.filter(isObject) : [];
29
31
  const option = (kind) => {
30
32
  const candidate = options.find((value) => value.kind === kind);
@@ -118,7 +120,10 @@ export class AcpApprovalBridge {
118
120
  expiresAt: new Date(expiresAt).toISOString(),
119
121
  request: {
120
122
  schema: "octo.approval-request/v1",
121
- policy: { mode: this.request.approvalMode, hash: contextHash(this.request.context) },
123
+ policy: {
124
+ mode: invocationApprovalMode(this.request),
125
+ hash: contextHash(this.request.agentEnv)
126
+ },
122
127
  operation: {
123
128
  kind: "tool_execution",
124
129
  summary: typeof tool.title === "string" && tool.title
@@ -1,7 +1,7 @@
1
1
  import { assertContextEnvs, contextItem } from "@mininglamp-oss/octo-runtime-protocol";
2
2
  /** Read only the frozen execution context; never expose its values as model input. */
3
3
  export function invocationEnvs(request) {
4
- const envs = contextItem(request.context, "octo.execution", "envs")?.payload ?? {
4
+ const envs = contextItem(request.agentEnv, "octo.execution", "envs")?.payload ?? {
5
5
  env_variables: []
6
6
  };
7
7
  assertContextEnvs(envs);
@@ -9,7 +9,11 @@ export interface AdapterScopeCleanup {
9
9
  unresolvedServiceIds: readonly string[];
10
10
  failedCleanupServiceIds: readonly string[];
11
11
  }
12
- /** Core 每次注册独占一个作用域;构造不得启动进程,关闭后不可重新接纳或恢复。 */
12
+ /**
13
+ * Core 每次注册独占本地调用作用域;构造不得启动进程,关闭后不再接纳。
14
+ * close 回收本 scope 的调用/订阅/租约,不隐含获得宿主注入 Engine 或共享连接的销毁权。
15
+ * Adapter 构造方法和参数由实现者决定;统一的是注册后的执行合同。
16
+ */
13
17
  export interface AdapterExecutionScope {
14
18
  invoke(request: InvokeRequest, context?: AdapterInvocationContext): AsyncIterable<AdapterOutput>;
15
19
  respondInteraction?(invocationId: string, response: InteractionResponse): Promise<void>;
@@ -1,13 +1,15 @@
1
1
  import type { AdapterInvocationContext } from "./activity.js";
2
2
  import type { CreateAdapterExecutionScope } from "./execution-scope.js";
3
3
  export type { AdapterExecutionScope, AdapterScopeCleanup, CreateAdapterExecutionScope, ServiceProcessSnapshot } from "./execution-scope.js";
4
+ export * from "./agent-env.js";
5
+ export { snapshotProviderLaunch, assertProviderCommand, type ProviderLaunch } from "./provider-launch.js";
4
6
  import { type ReasoningLevelMap } from "./reasoning.js";
5
7
  export type { AdapterInvocationContext, ProviderActivity } from "./activity.js";
6
8
  export { invocationEnvironment, invocationEnvs, mergeProcessEnvironment, processEnvironmentValue } from "./environment.js";
7
9
  export { invocationMcpServers, expandMcpValue, assertMcpOptions } from "./mcp.js";
8
10
  export { actmodeEvidence } from "./actmode.js";
9
- import { type CanonicalEvent, type AdapterProtocolSupport, type HostControl, type NativeHostFrame, type InvokeRequest, type StreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
10
- export { freshFallbackInputText, initialControlInstructions, hasImageInput, providerInputParts, providerInputText } from "@mininglamp-oss/octo-runtime-protocol";
11
+ import { type CanonicalEvent, type AdapterProtocolSupport, type HostControl, type NativeHostFrame, type InvokeRequest, type AgentEnv, type InteractionResponse, type NativeInteractionResponse, type StreamLimitPolicy } from "@mininglamp-oss/octo-runtime-protocol";
12
+ export { freshFallbackInputText, hasImageInput, providerInputParts, providerInputText } from "@mininglamp-oss/octo-runtime-protocol";
11
13
  export type { CanonicalEvent, InvokeRequest, MessageChannel, MessageExposure, MessageProvenance } from "@mininglamp-oss/octo-runtime-protocol";
12
14
  export { acpToolTerminalStatus, normalizeAcpToolUpdate } from "./acp-tool.js";
13
15
  export { AcpTurnNormalizer } from "./acp-turn.js";
@@ -47,14 +49,16 @@ export interface ProbeResult {
47
49
  /** 工厂的编写输入;直接交给 Core 注册时须满足完整的 HostedAdapter 合同。 */
48
50
  export interface Adapter<TOutput extends AdapterOutput = AdapterOutput> {
49
51
  metadata: AdapterMetadata;
52
+ defaultAgentEnv?: AgentEnv;
53
+ respondInteraction?(invocationId: string, response: InteractionResponse): Promise<void>;
54
+ respondNative?(invocationId: string, response: NativeInteractionResponse): Promise<void>;
50
55
  createExecutionScope?: CreateAdapterExecutionScope;
51
56
  probe?: (options?: AdapterProbeOptions) => Promise<ProbeResult>;
52
57
  /**
53
- * Execute one provider turn, optionally reporting watchdog progress.
54
- * Iteration may throw on contract rejection (including defineAdapter's protocol/MCP checks).
55
- * Core rejects unsupported approval/protocol before admission; after admission it converts
56
- * iteration errors to failure events and independently verifies cleanup. Canonical adapters
57
- * should yield a failure terminal after confirmed cleanup for expected execution failures.
58
+ * 消费本轮请求并输出 Provider 事件,可通过 context 报告 watchdog 进度。
59
+ * Core 在受理前核对传输模式,配置校验由 Adapter 负责,拒绝时迭代可抛错。
60
+ * 受理后 Core 将异常转换为失败事件,并独立核实资源回收;预期执行失败应在
61
+ * Adapter 确认清理完成后输出失败终态,不能把执行终态当成清理完成的证明。
58
62
  */
59
63
  invoke(request: InvokeRequest, context?: AdapterInvocationContext): AsyncIterable<TOutput>;
60
64
  }
@@ -62,7 +66,8 @@ export interface Adapter<TOutput extends AdapterOutput = AdapterOutput> {
62
66
  * 工厂输出必须表达已补齐的协议声明,供宿主直接注册;保留作者扩展的字段和方法。
63
67
  * 禁止与允许省略字段的编写输入混用,否则会把注册前的类型错误推迟到运行时。
64
68
  */
65
- export type DefinedAdapter<TAdapter extends Adapter = Adapter> = Readonly<Omit<TAdapter, "metadata"> & {
69
+ export type DefinedAdapter<TAdapter extends Adapter = Adapter> = Readonly<Omit<TAdapter, "metadata" | "defaultAgentEnv"> & {
70
+ readonly defaultAgentEnv: AgentEnv;
66
71
  metadata: Omit<TAdapter["metadata"], "protocolSupport"> & {
67
72
  protocolSupport: AdapterProtocolSupport;
68
73
  };
@@ -73,6 +78,13 @@ export type DriverFrame = Pick<NativeHostFrame, "kind" | "messageKind" | "payloa
73
78
  control: HostControl;
74
79
  };
75
80
  export type AdapterOutput = CanonicalEvent | DriverFrame;
81
+ /**
82
+ * 执行尚未启动 Provider 的纯配置/目录校验;返回后才能开始探针或执行。
83
+ * 回调不得创建 Provider 资源。失败证据只绑定本次 context,供 Core 核对清理责任。
84
+ */
85
+ export declare function runAdapterPreparation(context: AdapterInvocationContext | undefined, prepare: () => void | Promise<void>): Promise<void>;
86
+ /** SDK 尚未调用 Provider 的准备失败;Core 可确认此路径没有 Provider 资源待回收。 */
87
+ export declare function isAdapterPreparationFailure(error: unknown, context: AdapterInvocationContext): boolean;
76
88
  /** The fully materialized subprocess contract produced immediately before spawn. */
77
89
  export interface CommandSpec {
78
90
  command: string;
@@ -141,11 +153,12 @@ export declare function parseJsonLine(line: string): Record<string, unknown> | n
141
153
  */
142
154
  export declare function createJsonCliAdapter<TNative = Record<string, unknown>>(options: JsonCliAdapterOptions<TNative>): DefinedAdapter<Adapter<CanonicalEvent>>;
143
155
  /**
144
- * Resolve whether a command is runnable. A path-qualified command is checked
145
- * directly; a bare name is searched across `PATH` (`;`-separated on Windows).
146
- * Returns the first executable match, else `command_not_found`.
156
+ * 探测宿主已绑定的绝对启动链;不搜索安装,版本参数接在宿主前缀参数之后。
157
+ * 返回目标可执行性和可选版本;版本命令失败不等于目标不可用,版本门禁由 Provider 决定。
158
+ * 文件缺失与权限不足分别报告,失败不选择其他安装,也不解释前缀参数中的入口。
147
159
  */
148
- export declare function probeCommand(command: string, { env, cwd }?: {
160
+ export declare function probeCommand(command: string, { env, cwd, args }?: {
149
161
  env?: NodeJS.ProcessEnv;
150
162
  cwd?: string;
163
+ args?: readonly string[];
151
164
  }): Promise<ProbeResult>;