@mininglamp-oss/octo-runtime 1.1.12 → 1.1.14

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 (195) 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 +154 -28
  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 +2 -2
  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 +26 -10
  25. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +44 -53
  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 +21 -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/agent-env.d.ts +3 -0
  31. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/agent-env.js +10 -0
  32. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.d.ts +14 -68
  33. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.js +77 -61
  34. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
  35. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.d.ts +19 -31
  36. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.js +28 -18
  37. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
  38. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/agent-env.d.ts +3 -0
  39. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/agent-env.js +10 -0
  40. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.d.ts +6 -5
  41. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +55 -54
  42. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/engine.d.ts +54 -0
  43. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/engine.js +147 -0
  44. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/environment.js +4 -8
  45. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +20 -92
  46. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.js +103 -217
  47. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/mcp.d.ts +2 -2
  48. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/mcp.js +4 -11
  49. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.d.ts +9 -5
  50. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.js +77 -81
  51. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
  52. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-SMTJTIN7.js → chunk-AE3OJBDS.js} +1 -1
  53. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-H3S6WM37.js → chunk-NGR74QLF.js} +0 -1
  54. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/{chunk-RISQ6NGV.js → chunk-XIUZ6GXG.js} +1 -1
  55. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.d.ts +0 -1
  56. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/errors.js +1 -1
  57. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +6 -8
  58. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +16 -21
  59. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/launch.js +2 -2
  60. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/trajectory.js +2 -2
  61. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +3 -3
  62. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.d.ts +14 -16
  63. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.js +29 -46
  64. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/agent-env.d.ts +3 -0
  65. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/agent-env.js +10 -0
  66. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +4 -7
  67. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.d.ts +13 -21
  68. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.js +47 -36
  69. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
  70. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.d.ts +24 -8
  71. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.js +14 -7
  72. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
  73. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.d.ts +24 -8
  74. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.js +13 -6
  75. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
  76. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.d.ts +24 -8
  77. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.js +14 -7
  78. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
  79. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.d.ts +7 -7
  80. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +28 -31
  81. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
  82. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +16 -25
  83. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +113 -179
  84. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
  85. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.d.ts +24 -8
  86. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.js +14 -6
  87. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +3 -2
  88. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.d.ts +24 -8
  89. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.js +14 -6
  90. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +3 -2
  91. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/activity.d.ts +5 -1
  92. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.d.ts +48 -0
  93. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.js +234 -0
  94. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/approval.js +7 -2
  95. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.js +1 -1
  96. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/execution-scope.d.ts +5 -1
  97. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +25 -14
  98. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +112 -59
  99. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/mcp.js +1 -1
  100. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.d.ts +11 -1
  101. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.js +89 -8
  102. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/provider-launch.d.ts +10 -0
  103. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/provider-launch.js +25 -0
  104. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.js +10 -3
  105. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
  106. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.d.ts +19 -1
  107. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.js +154 -28
  108. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
  109. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/codex.d.ts +5 -0
  110. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/codex.js +36 -0
  111. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/kernel.d.ts +4 -0
  112. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/kernel.js +84 -0
  113. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +8 -7
  114. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +33 -22
  115. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.d.ts +1 -0
  116. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +8 -4
  117. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +21 -12
  118. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/provider-launch.d.ts +28 -0
  119. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/provider-launch.js +52 -0
  120. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/providers.d.ts +182 -0
  121. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/providers.js +34 -0
  122. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +20 -20
  123. package/node_modules/@mininglamp-oss/octo-runtime-client/build-info.json +2 -2
  124. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.js +2 -2
  125. package/node_modules/@mininglamp-oss/octo-runtime-client/package.json +5 -5
  126. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc.schema.json +3 -104
  127. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/protocol.schema.json +166 -1870
  128. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
  129. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +0 -2
  130. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +122 -65
  131. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.d.ts +2 -2
  132. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +13 -85
  133. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-output-silence.d.ts +21 -0
  134. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/model-output-silence.js +176 -0
  135. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.d.ts +3 -2
  136. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +8 -4
  137. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
  138. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +1 -1
  139. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +1 -1
  140. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.d.ts +5 -0
  141. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +17 -20
  142. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +5 -5
  143. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
  144. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/adapter-metadata.d.ts +1 -1
  145. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.d.ts +0 -2
  146. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.js +0 -2
  147. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-catalog.d.ts +0 -1
  148. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-catalog.js +3 -9
  149. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-configuration.js +1 -8
  150. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.d.ts +1 -5
  151. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +3 -292
  152. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/experience.js +7 -0
  153. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +2 -0
  154. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +18 -13
  155. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +90 -608
  156. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.js +32 -1
  157. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +7 -18
  158. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +34 -189
  159. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.d.ts +11 -22
  160. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +38 -78
  161. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/multimodal.js +6 -0
  162. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.d.ts +2 -1
  163. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.js +5 -40
  164. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.js +2 -1
  165. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  166. package/package.json +34 -37
  167. package/packages/octo-runtime-protocol/schema/kernel-ipc.schema.json +3 -104
  168. package/packages/octo-runtime-protocol/schema/protocol.schema.json +166 -1870
  169. package/dist/public/codex.d.ts +0 -1
  170. package/dist/public/codex.js +0 -1
  171. package/dist/public/dsh.d.ts +0 -2
  172. package/dist/public/dsh.js +0 -1
  173. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/actmode.d.ts +0 -5
  174. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/actmode.js +0 -8
  175. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-configuration-fixtures.json +0 -1219
  176. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-fixtures.json +0 -5988
  177. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-client.behavior.json +0 -56
  178. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/native-invoke-fixtures.json +0 -116
  179. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/run-protocol-fixtures.json +0 -761
  180. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/runtime-selection-fixtures.json +0 -663
  181. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/session-name-fixtures.json +0 -191
  182. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/context.d.ts +0 -12
  183. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/context.js +0 -89
  184. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/execution-preparation.d.ts +0 -33
  185. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/execution-preparation.js +0 -93
  186. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/actmode.d.ts +0 -4
  187. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/actmode.js +0 -36
  188. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/execution-plan.d.ts +0 -3
  189. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/execution-plan.js +0 -80
  190. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/model-context.d.ts +0 -3
  191. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/model-context.js +0 -9
  192. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/runtime-selection.d.ts +0 -3
  193. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/runtime-selection.js +0 -68
  194. /package/node_modules/@mininglamp-oss/octo-runtime-client/{schema → fixtures}/kernel-ipc-fixtures.json +0 -0
  195. /package/packages/octo-runtime-protocol/{schema → test/fixtures}/kernel-ipc-fixtures.json +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mininglamp-oss/octo-runtime-cross-service",
3
- "version": "1.1.12",
3
+ "version": "1.1.14",
4
4
  "private": true,
5
5
  "description": "Native user-service lifecycle backends for Octo Runtime",
6
6
  "type": "module",
@@ -1,6 +1,4 @@
1
1
  export { prepareInvokeInput } from "./invoke-input.js";
2
- export { resolveLocalContext, localRuntimeLimits } from "./context.js";
3
- export { prepareRunContext, type PreparedRunContext, type WorkspaceAssignments } from "./execution-preparation.js";
4
2
  import type { AdapterInvocationContext, AdapterProbeOptions, AdapterOutput, CreateAdapterExecutionScope, ServiceProcessSnapshot } from "@mininglamp-oss/octo-runtime-adapter-sdk";
5
3
  import { type InvokeInput, type InvokeEnvironment, type HostRunReceipt, type HostFrame, type NativeInteractionResponse, type InteractionResponse, type InvokeRequest } from "@mininglamp-oss/octo-runtime-protocol";
6
4
  import { type RuntimeLog } from "@mininglamp-oss/octo-runtime-adapter-sdk";
@@ -1,13 +1,10 @@
1
1
  import { prepareInvokeInput } from "./invoke-input.js";
2
2
  import { randomUUID } from "node:crypto";
3
- import { constants } from "node:fs";
4
- import { access, stat } from "node:fs/promises";
5
- import { sanitizePublicValue } from "@mininglamp-oss/octo-runtime-adapter-sdk";
3
+ import { sanitizePublicValue, isAdapterPreparationFailure } from "@mininglamp-oss/octo-runtime-adapter-sdk";
6
4
  export { prepareInvokeInput } from "./invoke-input.js";
7
- export { resolveLocalContext, localRuntimeLimits } from "./context.js";
8
- export { prepareRunContext } from "./execution-preparation.js";
9
5
  import { createInputInvoke, assertInvokeRequestSize, assertServiceProcessSnapshot, assertProtocolSupport, assertAdapterProtocolSupport, assertHostFrame, assertHostFrameIdentity, assertNativeInteractionResponse, resolveHostInvokeOptions, protocolError, assertCanonicalEvent, assertInteractionResponse, assertInvokeRequest, failurePayload, isCodexLocalFailure, isStreamCapacityReason, resolveStreamLimitPolicy, streamCapacityError, isTerminal } from "@mininglamp-oss/octo-runtime-protocol";
10
6
  import { InvocationExperience } from "./experience.js";
7
+ import { ModelOutputSilence } from "./model-output-silence.js";
11
8
  import { noopRuntimeLog } from "@mininglamp-oss/octo-runtime-adapter-sdk";
12
9
  import { AdapterWatchdogTimeoutError, InvocationWatchdog } from "./watchdog.js";
13
10
  /**
@@ -187,14 +184,6 @@ export class AgentExecutor {
187
184
  throw new Error(`unknown adapter: ${adapterType}`);
188
185
  const support = this.#support(registered);
189
186
  assertProtocolSupport(support, resolved);
190
- if (request.approvalMode !== "full_access" &&
191
- (resolved.protocolMode === "native"
192
- ? typeof registered.respondNative !== "function"
193
- : typeof registered.respondInteraction !== "function")) {
194
- throw new Error(`APPROVAL_MODE_UNSUPPORTED: ${adapterType} does not implement execution-time approval responses`);
195
- }
196
- if (!registered?.metadata.agentSources.includes(request.agentSource))
197
- throw new Error("AGENT_SOURCE_UNSUPPORTED: " + adapterType);
198
187
  if (this.#runs.has(request.invocationId))
199
188
  throw protocolError("EXECUTION_IDENTITY_CONFLICT", "EXECUTION_IDENTITY_CONFLICT: Invocation already executed");
200
189
  for (const [id, run] of this.#runs) {
@@ -253,7 +242,7 @@ export class AgentExecutor {
253
242
  const streamLimits = resolveStreamLimitPolicy(environment.streamLimits);
254
243
  const { signal, ...wire } = request;
255
244
  const frozenRequest = { ...structuredClone(wire), signal };
256
- return this.#admit(adapterType, frozenRequest, protocolMode, streamLimits, received);
245
+ return this.#admit(adapterType, frozenRequest, protocolMode, streamLimits, received, environment.providerOptions && structuredClone(environment.providerOptions));
257
246
  }
258
247
  catch (error) {
259
248
  this.#log("warn", "invoke.rejected", {
@@ -267,7 +256,7 @@ export class AgentExecutor {
267
256
  if (this.#state !== "open")
268
257
  throw new Error("EXECUTOR_CLOSED");
269
258
  }
270
- async *#admit(adapterType, request, protocolMode, streamLimits, received) {
259
+ async *#admit(adapterType, request, protocolMode, streamLimits, received, providerOptions) {
271
260
  // 延迟到消费时再次检查关闭/取消,防止创建生成器后、开始迭代前 shutdown 的竞态。
272
261
  this.#assertOpen();
273
262
  request.signal?.throwIfAborted();
@@ -281,6 +270,7 @@ export class AgentExecutor {
281
270
  };
282
271
  const owner = {
283
272
  streamId: receipt.stream_id,
273
+ providerOptions,
284
274
  controller,
285
275
  detach: () => {
286
276
  signal?.removeEventListener("abort", callerAbort);
@@ -299,7 +289,6 @@ export class AgentExecutor {
299
289
  invocation_id: request.invocationId,
300
290
  session_id: request.agentSessionId,
301
291
  adapter_type: adapterType,
302
- model: request.agentConfig?.model,
303
292
  duration_ms: Date.now() - received
304
293
  });
305
294
  yield* this.#streamInvocation(adapterType, request, receipt, streamLimits, owner);
@@ -588,7 +577,9 @@ export class AgentExecutor {
588
577
  session_id: request.agentSessionId,
589
578
  adapter_type: adapterType
590
579
  };
591
- const watchdog = new InvocationWatchdog(request.runtimeLimits, controller, (diagnostic) => this.#log("warn", "invoke.watchdog", {
580
+ // 静默事实只属于 canonical;native 不实例化观察器、不新增控制帧。
581
+ const silence = protocolMode === "canonical" ? new ModelOutputSilence() : undefined;
582
+ const watchdog = new InvocationWatchdog(undefined, controller, (diagnostic) => this.#log("warn", "invoke.watchdog", {
592
583
  ...identity,
593
584
  code: diagnostic.event
594
585
  }));
@@ -598,6 +589,7 @@ export class AgentExecutor {
598
589
  let cleanupWait;
599
590
  let cleanupDeadline;
600
591
  let completedBeforeCleanup = false;
592
+ let preparedNext;
601
593
  const beginCleanup = () => (cleanupDeadline ??= performance.now() + watchdog.limits.cancelGraceMs);
602
594
  const remainingCleanup = () => Math.max(0, beginCleanup() - performance.now());
603
595
  owner.close = async () => {
@@ -615,14 +607,49 @@ export class AgentExecutor {
615
607
  throw new Error("EXECUTOR_CLEANUP_UNVERIFIED");
616
608
  };
617
609
  const readNext = async (source) => {
610
+ let result;
618
611
  try {
619
- const result = await source.next();
620
- if (result.done)
612
+ result = await source.next();
613
+ }
614
+ catch (error) {
615
+ silence?.dispose();
616
+ if (!terminal && !nativeTerminal)
617
+ watchdog.terminal();
618
+ // 只有源 next 本身拒绝才使其 finally 清理存疑;校验错误不冒充清理失败。
619
+ nextFailed = !isAdapterPreparationFailure(error, context);
620
+ throw error;
621
+ }
622
+ try {
623
+ if (result.done) {
621
624
  iteratorDone = true;
625
+ silence?.dispose();
626
+ if (!terminal && !nativeTerminal)
627
+ watchdog.terminal();
628
+ }
629
+ else if (silence) {
630
+ // 在源结果就绪时刷新,避免消费者停在 notice 的 yield 时继续累计旧区间。
631
+ assertCanonicalEvent(result.value);
632
+ const event = result.value;
633
+ // notice 让 next 保持在途;背压期间到达的进展/等待/终态也必须立即生效,
634
+ // 不能由消费者恢复读取的时刻决定超时或让晚到取消覆盖已到达的终态。
635
+ watchdog.canonical(event);
636
+ if (isTerminal(event) && !controller.signal.aborted)
637
+ this.#acceptedTerminals.add(request.invocationId);
638
+ // 无身份的空占位/全局关闭补丁仍按原分支处理,不能凭空创建消息。
639
+ if (!(!event.payload.messageId &&
640
+ !event.payload.text &&
641
+ (event.type === "message.create" ||
642
+ (event.type === "message.update" &&
643
+ ["completed", "failed", "cancelled", "canceled", "stopped"].includes(String(event.payload.status))))))
644
+ preparedNext = prepareMessage(event);
645
+ silence.canonical(preparedNext?.event ?? event, preparedNext?.hasOutput ?? false);
646
+ }
622
647
  return result;
623
648
  }
624
649
  catch (error) {
625
- nextFailed = true;
650
+ silence?.dispose();
651
+ if (!terminal && !nativeTerminal)
652
+ watchdog.terminal();
626
653
  throw error;
627
654
  }
628
655
  };
@@ -633,6 +660,7 @@ export class AgentExecutor {
633
660
  const waitCleanup = () => (cleanupWait ??= boundedCleanup(closeIterator(), remainingCleanup()));
634
661
  // The timer can fire while a consumer is paused at yield.
635
662
  const onAbort = () => {
663
+ silence?.dispose();
636
664
  void waitCleanup().catch(() => undefined);
637
665
  };
638
666
  controller.signal.addEventListener("abort", onAbort, { once: true });
@@ -642,13 +670,18 @@ export class AgentExecutor {
642
670
  const context = {
643
671
  protocolMode,
644
672
  streamLimits,
673
+ providerOptions: owner.providerOptions,
674
+ configureRuntimeLimits: (limits) => watchdog.configure(limits),
645
675
  log: this.#log,
646
676
  reportConversion: () => {
647
677
  if (protocolMode === "native")
648
678
  throw protocolError("EXECUTION_PROTOCOL_MISMATCH", "Native execution invoked a canonical converter");
649
679
  conversions++;
650
680
  },
651
- reportActivity: (activity) => watchdog.activity(activity),
681
+ reportActivity: (activity) => {
682
+ watchdog.activity(activity);
683
+ silence?.activity(activity);
684
+ },
652
685
  reportExecutionResult: (result) => {
653
686
  if (result.status === "completed" &&
654
687
  result.basis === "final_answer_cleanup_fallback" &&
@@ -662,7 +695,7 @@ export class AgentExecutor {
662
695
  event.type === "message.delta" ||
663
696
  event.type === "message.update";
664
697
  if (!isMessage)
665
- return { prefix: [], event };
698
+ return { prefix: [], event, hasOutput: false };
666
699
  const previous = event.payload.messageId ? messages.get(event.payload.messageId) : undefined;
667
700
  const channel = event.payload.channel ?? previous?.channel ?? "final";
668
701
  const segmentKey = `${channel}:${event.payload.stepId ?? ""}`;
@@ -706,14 +739,27 @@ export class AgentExecutor {
706
739
  : [];
707
740
  const closed = event.type === "message.update" &&
708
741
  ["completed", "failed", "cancelled", "canceled", "stopped"].includes(String(event.payload.status));
742
+ const role = event.payload.role ?? state?.role ?? "assistant";
743
+ const text = event.payload.text ?? "";
744
+ // 状态补丁、空快照及回退快照不能降低长度,否则旧快照会冒充新增输出。
745
+ const textLength = event.type === "message.delta"
746
+ ? (state?.textLength ?? 0) + text.length
747
+ : Math.max(state?.textLength ?? 0, text.length);
748
+ const hasOutput = role === "assistant" &&
749
+ (channel !== "analysis" ||
750
+ ["public_reasoning", "public_summary", "public_plan"].includes(prepared.payload.exposure ?? "")) &&
751
+ text.trim().length > 0 &&
752
+ (event.type === "message.delta" || textLength > (state?.textLength ?? 0));
709
753
  messages.set(messageId, {
710
754
  messageId,
711
755
  channel,
756
+ role,
757
+ textLength,
712
758
  open: !closed,
713
759
  ...(stepId ? { stepId } : {}),
714
760
  ...analysisMetadata
715
761
  });
716
- return { prefix, event: prepared };
762
+ return { prefix, event: prepared, hasOutput };
717
763
  };
718
764
  const closeMessages = (status, stepId, onlyAnonymous = false) => {
719
765
  const closed = [];
@@ -743,17 +789,31 @@ export class AgentExecutor {
743
789
  controller.signal.throwIfAborted();
744
790
  const invocation = adapter.invoke({ ...request, signal: controller.signal }, context);
745
791
  iterator = invocation[Symbol.asyncIterator]();
792
+ let pendingNext;
746
793
  while (true) {
747
794
  if (controller.signal.aborted)
748
795
  throw controller.signal.reason;
749
- const pendingNext = readNext(iterator);
796
+ // notice 不消费 Provider 结果;复用同一个 next,绝不并发拉取或丢弃结果。
797
+ pendingNext ??= readNext(iterator);
750
798
  const next = terminal || nativeTerminal
751
799
  ? await withCleanupDeadline(pendingNext, beginCleanup(), watchdog.limits.cancelGraceMs, controller)
752
- : await waitForNext(pendingNext, controller.signal);
800
+ : await waitForProviderOutput(pendingNext, controller.signal, silence);
801
+ if (controller.signal.aborted)
802
+ throw controller.signal.reason;
803
+ // 普通源结果和通知可以同时就绪;先交付已生成的事实,不依赖 race 的赢家。
804
+ // yield 期间源 next 仍保持唯一在途;恢复后再次核对取消,不消费已取消的结果。
805
+ const notice = silence?.take();
806
+ if (notice)
807
+ yield notice;
753
808
  if (controller.signal.aborted)
754
809
  throw controller.signal.reason;
810
+ if (next === "notice")
811
+ continue;
812
+ pendingNext = undefined;
755
813
  if (next.done)
756
814
  break;
815
+ const prepared = preparedNext;
816
+ preparedNext = undefined;
757
817
  const adapterEvent = next.value;
758
818
  if (protocolMode === "native") {
759
819
  if (!("kind" in adapterEvent))
@@ -779,7 +839,7 @@ export class AgentExecutor {
779
839
  ? {
780
840
  protocolVersion: 2,
781
841
  type: "run.failed",
782
- payload: await adapterFailurePayload(adapterEvent.payload, request.workdir, {
842
+ payload: adapterFailurePayload(adapterEvent.payload, {
783
843
  stage: "provider.invoke",
784
844
  defaultDomain: "provider",
785
845
  runId: request.runId,
@@ -787,7 +847,6 @@ export class AgentExecutor {
787
847
  })
788
848
  }
789
849
  : adapterEvent;
790
- watchdog.canonical(event);
791
850
  if (terminal)
792
851
  throw new Error(`${adapterType} emitted after terminal event`);
793
852
  if (isTerminal(event)) {
@@ -817,10 +876,10 @@ export class AgentExecutor {
817
876
  for (const closed of closeMessages(event.payload.status, event.payload.stepId))
818
877
  yield closed;
819
878
  }
820
- const prepared = prepareMessage(event);
821
- for (const prefix of prepared.prefix)
879
+ const output = prepared ?? prepareMessage(event);
880
+ for (const prefix of output.prefix)
822
881
  yield prefix;
823
- yield prepared.event;
882
+ yield output.event;
824
883
  }
825
884
  }
826
885
  await withCleanupDeadline(closeIterator(), beginCleanup(), watchdog.limits.cancelGraceMs, controller);
@@ -847,13 +906,13 @@ export class AgentExecutor {
847
906
  const error = controller.signal.reason instanceof AdapterWatchdogTimeoutError
848
907
  ? controller.signal.reason
849
908
  : caught;
850
- const failure = await adapterFailurePayload({
909
+ const failure = adapterFailurePayload({
851
910
  message: errorMessage(error),
852
911
  adapterType,
853
912
  ...(errorCode(error) ? { code: errorCode(error) } : {}),
854
913
  ...capacityFailureDetails(error),
855
914
  ...watchdogFailureDetails(error)
856
- }, request.workdir, {
915
+ }, {
857
916
  stage: "adapter.invoke",
858
917
  defaultDomain: "adapter",
859
918
  runId: request.runId,
@@ -900,11 +959,12 @@ export class AgentExecutor {
900
959
  type: "error",
901
960
  code: nativeFailureCode === "HOST_ENDED_WITHOUT_TERMINAL"
902
961
  ? "HOST_ENDED_WITHOUT_TERMINAL"
903
- : isStreamCapacityReason(nativeFailureCode)
962
+ : isStreamCapacityReason(nativeFailureCode) || isWorkdirFailure(nativeFailureCode)
904
963
  ? nativeFailureCode
905
964
  : "HOST_EXECUTION_FAILED",
906
965
  message: String(failure.message),
907
966
  ...(isStreamCapacityReason(nativeFailureCode) ||
967
+ isWorkdirFailure(nativeFailureCode) ||
908
968
  (adapterType === "codex" && isCodexLocalFailure(failure.failure))
909
969
  ? { failure: failure.failure }
910
970
  : {})
@@ -937,6 +997,7 @@ export class AgentExecutor {
937
997
  }
938
998
  }
939
999
  finally {
1000
+ silence?.dispose();
940
1001
  watchdog.finish(outcome);
941
1002
  this.#log("info", "invoke.conversion", {
942
1003
  run_id: request.runId,
@@ -1092,39 +1153,20 @@ export class AgentExecutor {
1092
1153
  function errorMessage(error) {
1093
1154
  return error instanceof Error ? error.message : String(error);
1094
1155
  }
1156
+ const WORKDIR_FAILURE_MESSAGES = {
1157
+ WORKDIR_REQUIRED: "A prepared working directory is required; create it and provide its absolute path.",
1158
+ WORKDIR_INVALID: "Working directory must be an absolute path without NUL characters.",
1159
+ WORKDIR_NOT_FOUND: "Working directory does not exist; create it before invoking Runtime.",
1160
+ WORKDIR_NOT_DIRECTORY: "Working directory must point to an existing directory.",
1161
+ WORKDIR_UNAVAILABLE: "Working directory is not accessible; check directory access permissions."
1162
+ };
1163
+ function isWorkdirFailure(code) {
1164
+ return typeof code === "string" && Object.hasOwn(WORKDIR_FAILURE_MESSAGES, code);
1165
+ }
1095
1166
  /** Keep the Adapter's failure detail; catalog normalization only adds classification. */
1096
- async function adapterFailurePayload(input, workdir, context) {
1097
- let detail = input;
1098
- // Node reports the same spawn errno for a missing command and a missing cwd.
1099
- if (["ENOENT", "ENOTDIR", "EACCES", "EPERM"].includes(String(input.code)) && workdir) {
1100
- let problem;
1101
- try {
1102
- if (!(await stat(workdir)).isDirectory())
1103
- problem = "配置的工作目录不是文件夹";
1104
- else
1105
- await access(workdir, constants.X_OK);
1106
- }
1107
- catch (error) {
1108
- const code = errorCode(error);
1109
- if (code === "ENOENT")
1110
- problem = "配置的工作目录不存在";
1111
- else if (code === "ENOTDIR")
1112
- problem = "配置的工作目录路径中包含非文件夹项";
1113
- else if (code === "EACCES" || code === "EPERM")
1114
- problem = "没有进入配置工作目录的权限";
1115
- }
1116
- if (problem)
1117
- detail = {
1118
- ...input,
1119
- code: "ADAPTER_INVOCATION_FAILED",
1120
- message: `${problem}(adapter.workdir=${workdir})。${typeof input.message === "string" ? input.message : ""}`,
1121
- error: input.error ?? { code: input.code, message: input.message }
1122
- };
1123
- }
1124
- const normalized = failurePayload(detail, {
1125
- ...context,
1126
- ...(detail !== input ? { defaultDomain: "adapter" } : {})
1127
- });
1167
+ function adapterFailurePayload(input, context) {
1168
+ const detail = input;
1169
+ const normalized = failurePayload(detail, context);
1128
1170
  // 仅 ACP 消息保留原始 _meta;外层字段仍按公共错误规则脱敏,不能凭错误码整体绕过。
1129
1171
  const { message: originalMessage, ...outerDetail } = detail;
1130
1172
  const safe = sanitizePublicValue(outerDetail);
@@ -1160,6 +1202,21 @@ function capacityFailureDetails(error) {
1160
1202
  .filter((key) => Object.hasOwn(input, key))
1161
1203
  .map((key) => [key, input[key]]));
1162
1204
  }
1205
+ /** 等待真实源输出或一个静默事实;每次退出释放唯一 notice 监听与 timer。 */
1206
+ async function waitForProviderOutput(pending, signal, silence) {
1207
+ if (!silence)
1208
+ return waitForNext(pending, signal);
1209
+ let detach;
1210
+ try {
1211
+ const notice = new Promise((resolve) => {
1212
+ detach = silence.listen(() => resolve("notice"));
1213
+ });
1214
+ return await waitForNext(Promise.race([pending, notice]), signal);
1215
+ }
1216
+ finally {
1217
+ detach?.();
1218
+ }
1219
+ }
1163
1220
  async function waitForNext(pending, signal) {
1164
1221
  let onAbort = () => { };
1165
1222
  try {
@@ -1,8 +1,8 @@
1
1
  import { type InvokeRequest } from "@mininglamp-oss/octo-runtime-protocol";
2
2
  /**
3
- * 将调用方本轮 JSON 快照解析为执行计划与内部请求,不读取持久会话或创建 Provider。
3
+ * 将调用方本轮 JSON 快照包装为内部请求,不读取持久会话或创建 Provider。
4
4
  * sessionId 只标识业务会话;续接必须显式携带 providerSession,不能由同名会话推断。
5
- * 仅解析执行设置;inputs 由业务方准备,原样进入 Adapter。
5
+ * 仅读取 Adapter 路由;agentEnv 与业务方准备的 inputs 保序交给 Adapter。
6
6
  */
7
7
  export declare function prepareInvokeInput(value: unknown): {
8
8
  adapterType: string;
@@ -1,52 +1,21 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import { localRuntimeLimits, resolveLocalContext } from "./context.js";
3
- import { CONTEXT_SCHEMA, DEFAULT_RUN_TIMEOUT_MS, assertAgentSource, assertContextEnvelope, assertInvokeRequest, contextControlInstructions, contextItem, InvokeInput } from "@mininglamp-oss/octo-runtime-protocol";
4
- /** CLI shorthand resolves execution defaults before entering the strict Context contract. */
5
- function inputContext(value) {
6
- if (isRecord(value) && Array.isArray(value.items)) {
7
- value = {
8
- ...value,
9
- items: value.items.map((item) => {
10
- if (isRecord(item) &&
11
- item.namespace === "octo.execution" &&
12
- item.name === "adapter" &&
13
- isRecord(item.payload) &&
14
- item.payload.type === "openclaw" &&
15
- !Object.hasOwn(item.payload, "provider_agent_id")) {
16
- return { ...item, payload: { ...item.payload, provider_agent_id: "main" } };
17
- }
18
- return item;
19
- })
20
- };
21
- }
22
- const envelope = {
23
- schema: value.schema,
24
- items: value.items
25
- };
26
- assertContextEnvelope(envelope);
27
- return envelope;
28
- }
2
+ import { assertInvokeRequest, contextItem, InvokeInput } from "@mininglamp-oss/octo-runtime-protocol";
29
3
  /**
30
- * 将调用方本轮 JSON 快照解析为执行计划与内部请求,不读取持久会话或创建 Provider。
4
+ * 将调用方本轮 JSON 快照包装为内部请求,不读取持久会话或创建 Provider。
31
5
  * sessionId 只标识业务会话;续接必须显式携带 providerSession,不能由同名会话推断。
32
- * 仅解析执行设置;inputs 由业务方准备,原样进入 Adapter。
6
+ * 仅读取 Adapter 路由;agentEnv 与业务方准备的 inputs 保序交给 Adapter。
33
7
  */
34
8
  export function prepareInvokeInput(value) {
35
9
  if (!isRecord(value))
36
10
  throw new TypeError("invoke input must be a JSON object");
37
- const input = InvokeInput.check({
38
- ...value,
39
- agentEnv: { ...value.agentEnv, ...inputContext(value.agentEnv) }
40
- });
41
- const contexts = inputContext(value.agentEnv);
42
- const env = input.agentEnv;
11
+ const input = InvokeInput.check(value);
43
12
  const protocolMode = value.protocol_mode ?? "native";
44
13
  if (protocolMode !== "native" && protocolMode !== "canonical") {
45
14
  throw new TypeError("protocol_mode must be native or canonical");
46
15
  }
47
- const adapterType = contextItem(contexts, "octo.execution", "adapter")?.payload.type;
48
- const agentSource = env.agentSource ?? (adapterType === "openclaw" ? "preset" : "provisioned");
49
- assertAgentSource(agentSource);
16
+ const adapterType = contextItem(input.agentEnv, "octo.execution", "adapter")?.payload.type ?? "codex";
17
+ if (typeof adapterType !== "string" || !adapterType)
18
+ throw new TypeError("ADAPTER_TYPE_INVALID");
50
19
  if (value.sessionId !== undefined &&
51
20
  (typeof value.sessionId !== "string" || !value.sessionId.trim())) {
52
21
  throw new TypeError("sessionId must be a non-empty string");
@@ -75,38 +44,6 @@ export function prepareInvokeInput(value) {
75
44
  throw new TypeError("fresh execution cannot carry providerSession");
76
45
  if (continuityMode === "continue" && !providerSession)
77
46
  throw new TypeError("continue requires providerSession; sessionId alone cannot resume a provider");
78
- const defaults = {
79
- schema: CONTEXT_SCHEMA,
80
- items: [
81
- { namespace: "octo.execution", name: "adapter", payload: { type: "codex" } },
82
- ...(agentSource === "provisioned"
83
- ? [
84
- {
85
- namespace: "octo.execution",
86
- name: "workspace",
87
- payload: { mode: "fixed", path: env.workdir ?? process.cwd() }
88
- }
89
- ]
90
- : []),
91
- {
92
- namespace: "octo.security",
93
- name: "approval_policy",
94
- payload: { mode: env.approvalMode ?? "ask" }
95
- },
96
- {
97
- namespace: "octo.execution",
98
- name: "limits",
99
- payload: { run_timeout_ms: DEFAULT_RUN_TIMEOUT_MS }
100
- }
101
- ]
102
- };
103
- // 解析固定执行配置;没有业务 Context 渲染阶段。
104
- const { resolvedExecutionPlan: plan } = resolveLocalContext(defaults, {
105
- schema: CONTEXT_SCHEMA,
106
- items: contexts.items.filter((item) => item.namespace === "octo.execution" ||
107
- (item.namespace === "octo.security" && item.name === "approval_policy"))
108
- }, agentSource);
109
- const context = structuredClone(contexts);
110
47
  const prompt = input.inputs
111
48
  .map((part) => (part.type === "text" ? part.text : "[Image]"))
112
49
  .join("\n\n");
@@ -119,7 +56,6 @@ export function prepareInvokeInput(value) {
119
56
  agentSessionId: value.sessionId ?? `session_${randomUUID()}`,
120
57
  // 名称默认值只在此归一化;Host SDK/Adapter 不猜业务策略或据此决定恢复。
121
58
  sessionName: input.sessionName ?? randomUUID(),
122
- agentSource,
123
59
  continuityMode,
124
60
  ...(providerSession ? { providerSession } : {}),
125
61
  ...(input.sessionGeneration !== undefined
@@ -138,22 +74,14 @@ export function prepareInvokeInput(value) {
138
74
  : {}),
139
75
  prompt: input.prompt ?? prompt,
140
76
  modelInput: input.modelInput ?? prompt,
141
- modelInputParts: structuredClone(input.inputs),
142
- context,
143
- controlInstructions: env.controlInstructions ?? contextControlInstructions(context),
144
- workdir: env.workdir ?? plan.workdir,
145
- approvalMode: env.approvalMode ?? plan.approval_mode,
146
- runtimeLimits: env.runtimeLimits ?? localRuntimeLimits(plan),
147
- agentConfig: {
148
- workdir: plan.workdir,
149
- ...(plan.model ? { model: plan.model } : {}),
150
- ...(plan.effort ? { effort: plan.effort } : {}),
151
- ...(plan.provider_agent_id ? { providerAgentId: plan.provider_agent_id } : {}),
152
- ...env.agentConfig
153
- }
77
+ // 高级调用显式选择的纯文本作为普通内容提交;有图片时始终保留完整有序 parts。
78
+ modelInputParts: input.modelInput !== undefined && input.inputs.every((part) => part.type === "text")
79
+ ? [{ type: "text", text: input.modelInput }]
80
+ : structuredClone(input.inputs),
81
+ agentEnv: structuredClone(input.agentEnv)
154
82
  };
155
83
  assertInvokeRequest(request);
156
- return { adapterType: plan.adapter_type, protocolMode, request };
84
+ return { adapterType, protocolMode, request };
157
85
  }
158
86
  function isRecord(value) {
159
87
  return value !== null && typeof value === "object" && !Array.isArray(value);
@@ -0,0 +1,21 @@
1
+ import type { ProviderActivity } from "@mininglamp-oss/octo-runtime-adapter-sdk";
2
+ import { type CanonicalEvent } from "@mininglamp-oss/octo-runtime-protocol";
3
+ import type { WatchdogClock } from "./watchdog.js";
4
+ /**
5
+ * 每轮 canonical 执行独占的模型输出观察器;不改变 watchdog 预算或 Provider。
6
+ * Core 在源 next 完成时交入事实,在等待下一个结果时订阅通知;只保留一个待发槽。
7
+ * 消息身份、公开性和文本增量由 Core 已有的消息准备步骤判断,不再维护第二套消息缓存。
8
+ */
9
+ export declare class ModelOutputSilence {
10
+ #private;
11
+ readonly time: WatchdogClock;
12
+ constructor(time?: WatchdogClock);
13
+ /** 唯一等待者;解除监听同时释放 timer,避免输出密集时累积 Promise 监听。 */
14
+ listen(wake: () => void): () => void;
15
+ take(): CanonicalEvent | undefined;
16
+ /** 原生侧工具事实补充 canonical;usage、传输心跳及一般进展均不算模型文本。 */
17
+ activity(activity: ProviderActivity): void;
18
+ /** 输入须先通过 canonical 校验;hasOutput 只接受 Core 准备后的公开新增文本事实。 */
19
+ canonical(event: CanonicalEvent, hasOutput?: boolean): void;
20
+ dispose(): void;
21
+ }