@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
@@ -3,4 +3,35 @@
3
3
  * Generated by scripts/gen-types.mjs from schema/protocol.schema.json.
4
4
  * Do not edit directly; update the schema and run `pnpm gen`.
5
5
  */
6
- export {};
6
+ export const KERNEL_IPC_VERSION = 2;
7
+ export const RUN_PROTOCOL_ERRORS = [
8
+ "PROTOCOL_MODE_INVALID",
9
+ "PROTOCOL_MODE_UNSUPPORTED",
10
+ "EXECUTION_PROTOCOL_MISMATCH",
11
+ "EXECUTION_IDENTITY_CONFLICT",
12
+ "NATIVE_METHOD_UNSUPPORTED",
13
+ "NATIVE_RESPONSE_INVALID",
14
+ "INTERACTION_NOT_ACTIVE",
15
+ "INVALID_QUESTION_RESPONSE",
16
+ "ASYNC_ANSWER_REJECTED",
17
+ "OPERATION_OUTCOME_UNKNOWN",
18
+ "HOST_EXECUTION_FAILED",
19
+ "HOST_ENDED_WITHOUT_TERMINAL",
20
+ "WORKDIR_REQUIRED",
21
+ "WORKDIR_INVALID",
22
+ "WORKDIR_NOT_FOUND",
23
+ "WORKDIR_NOT_DIRECTORY",
24
+ "WORKDIR_UNAVAILABLE",
25
+ "PROVIDER_MESSAGE_TOO_LARGE",
26
+ "HOST_FRAME_TOO_LARGE",
27
+ "STREAM_QUEUE_ITEM_TOO_LARGE",
28
+ "STREAM_QUEUE_BYTES_EXCEEDED",
29
+ "STREAM_QUEUE_ITEMS_EXCEEDED",
30
+ "STREAM_GAP",
31
+ "STREAM_EXPIRED",
32
+ "REMOTE_NATIVE_UNSUPPORTED",
33
+ "HOST_FRAME_INVALID",
34
+ "HOST_CONTROL_INVALID",
35
+ "HOST_RECEIPT_INVALID",
36
+ "PROTOCOL_SUPPORT_INVALID"
37
+ ];
@@ -1,3 +1,4 @@
1
+ export { KERNEL_IPC_VERSION } from "./generated/protocol-types.js";
1
2
  export type { HostedAdapterMetadata } from "./adapter-metadata.js";
2
3
  export { assertAsyncQuestions, assertQuestionRequest, assertQuestionResponse, questionAnswerText } from "./questions.js";
3
4
  export type { AsyncUserInputQuestion, AsyncQuestionReplySnapshot, QuestionRequest, QuestionResponse } from "./generated/protocol-types.js";
@@ -8,21 +9,18 @@ export { assertKernelStatus, assertServiceProcessSnapshot } from "./service-proc
8
9
  export * from "./run-protocol.js";
9
10
  export type { KernelLookupKey, KernelRunRef, KernelRunSnapshot, KernelStatus, ServiceProcessSnapshot } from "./generated/protocol-types.js";
10
11
  export * from "./invoke-input.js";
11
- export * from "./model-context.js";
12
- export * from "./execution-plan.js";
13
12
  export { contextHash } from "./context-hash.js";
14
13
  export { assertJsonValue } from "./context.js";
15
14
  export type { ToolAuthorization, IssuedToolAuthorization } from "./generated/protocol-types.js";
16
15
  export { PROVIDER_DIAGNOSTIC_MAX_BYTES } from "./experience.js";
17
16
  export { IMAGE_INPUT_LIMITS, IMAGE_INPUT_MIME_TYPES, assertModelInputParts, providerInputParts, hasImageInput, modelPartsFromInput } from "./multimodal.js";
18
- export { APPROVAL_MODES, CONTEXT_SCHEMA, CONTEXT_MAX_BYTES, CONTEXT_MAX_ITEMS, DEFAULT_RUN_TIMEOUT_MS, MAX_RUN_TIMEOUT_MS, RUNTIME_RUN_CONTRACT, assertAgentSource, assertApprovalMode, assertContextEnvelope, assertContextEnvs, assertMcpServers, assertContextMcp, assertResolvedExecutionPlan, canonicalContext, contextItem, mergeContext } from "./context.js";
19
- export { RUNTIME_SELECTION_SCHEMA, assertResolvedRuntimeSelection } from "./runtime-selection.js";
17
+ export { APPROVAL_MODES, CONTEXT_SCHEMA, CONTEXT_MAX_BYTES, CONTEXT_MAX_ITEMS, DEFAULT_RUN_TIMEOUT_MS, MAX_RUN_TIMEOUT_MS, RUNTIME_RUN_CONTRACT, assertApprovalMode, assertContextEnvelope, assertContextEnvs, assertMcpServers, assertContextMcp, canonicalContext, contextItem, mergeContext } from "./context.js";
20
18
  export { CONTEXT_TYPE_CATALOG, contextTypeDefinition, findContextTypeDefinition } from "./context-catalog.js";
21
19
  export type { ContextTypeDefinition } from "./context-catalog.js";
22
20
  export { assertContextConfiguration, resolveContextConfiguration } from "./context-configuration.js";
23
21
  export { assertNotificationMessage } from "./notification.js";
24
- import type { ActivityStartedPayload, ActivityUpdatedPayload, ActivityFinishedPayload, PlanUpdatedPayload, ToolProgressPayload, RunNoticePayload, CanonicalEventPayload, ChannelContextAppend, ChannelContextDescriptor, ChannelMessageFact, ChannelScope, ContextSyncResult, InvokeRequestWire, RuntimeLimits, MessageChannel, MessageExposure, InteractionRequestedPayload, InteractionResolvedPayload, ModelStepFinishedPayload, ModelStepStartedPayload, ToolCallCreatePayload, ToolCallDeltaPayload, ToolCallUpdatePayload, FailureEnvelope } from "./generated/protocol-types.js";
25
- export type { AgentSource, NotificationMessage, ModelInputPart, ApprovalMode, ApprovalRequest, ApprovalOperation, ApprovalDisplayDetails, ContextItem, ContextInlinePayload, ContextReferencesPayload, ContextInlineEntry, ContextReferenceEntry, ContextEnvelope, ContextConfiguration, ContextPreparationReceipt, RunContextProjection, ContextAdapterPayload, ContextModelPayload, ContextActmodePayload, ExecutionEvidence, ContextReasoningPayload, ContextWorkspacePayload, ContextLimitsPayload, ContextEnvsPayload, ContextRuntimeSelectionPayload, ContextApprovalPolicyPayload, ContextSelectionEntry, ContextResourceEntry, ContextInstructionEntry, ContextInstructionsPayload, ContextContinuityPayload, ResolvedExecutionPlan, ResolvedRuntimeSelection, MessageChannel, MessageExposure, MessageProvenance, ProviderSession, AgentConfig, RuntimeLimits, ActivityInfo, ActivitySubject, ActivityStartedPayload, ActivityUpdatedPayload, ActivityFinishedPayload, PlanUpdatedPayload, ToolProgressPayload, RunNoticePayload, CanonicalEventPayload, InteractionRequestedPayload, InteractionResolvedPayload, ModelStepStartedPayload, ModelStepFinishedPayload, ToolCallCreatePayload, ToolCallDeltaPayload, ToolCallUpdatePayload, FailureAction, FailureSource, FailureCause, FailureEnvelope, ChannelScope, ChannelMessagePart, ChannelMessageSender, ChannelMessageFlags, ChannelMessageFact, ChannelContextAppend, ContextSyncRequest, ContextSyncResult, ChannelContextDescriptor, ContextCommitResult, McpStdioServer, McpStreamableHttpServer, McpServer, McpServers, RunIdentity, InvokeRequestWire } from "./generated/protocol-types.js";
22
+ import type { ActivityStartedPayload, ActivityUpdatedPayload, ActivityFinishedPayload, PlanUpdatedPayload, ToolProgressPayload, RunNoticePayload, CanonicalEventPayload, InvokeRequestWire, RuntimeLimits, MessageChannel, MessageExposure, InteractionRequestedPayload, InteractionResolvedPayload, ModelStepFinishedPayload, ModelStepStartedPayload, ToolCallCreatePayload, ToolCallDeltaPayload, ToolCallUpdatePayload, FailureEnvelope } from "./generated/protocol-types.js";
23
+ export type { NotificationMessage, ModelInputPart, ApprovalMode, ApprovalRequest, ApprovalOperation, ApprovalDisplayDetails, ContextItem, ContextEnvelope, ContextConfiguration, ContextAdapterPayload, ContextModelPayload, ContextReasoningPayload, ContextWorkspacePayload, ContextLimitsPayload, ContextEnvsPayload, ContextApprovalPolicyPayload, MessageChannel, MessageExposure, MessageProvenance, ProviderSession, RuntimeLimits, ActivityInfo, ActivitySubject, ActivityStartedPayload, ActivityUpdatedPayload, ActivityFinishedPayload, PlanUpdatedPayload, ToolProgressPayload, RunNoticePayload, CanonicalEventPayload, InteractionRequestedPayload, InteractionResolvedPayload, ModelStepStartedPayload, ModelStepFinishedPayload, ToolCallCreatePayload, ToolCallDeltaPayload, ToolCallUpdatePayload, FailureAction, FailureSource, FailureCause, FailureEnvelope, McpStdioServer, McpStreamableHttpServer, McpServer, McpServers, RunIdentity, InvokeRequestWire } from "./generated/protocol-types.js";
26
24
  export { FAILURE_CATALOG, classifyFailure, isCodexLocalFailureReason, isCodexLocalFailure, failureMessage, failurePayload, isFailureEnvelope, type FailureClassificationContext, type FailureDomain, type PublicFailureCode } from "./failure.js";
27
25
  import type { RunIdentity } from "./generated/protocol-types.js";
28
26
  /**
@@ -43,8 +41,7 @@ export type TerminalEventType = (typeof TERMINAL_EVENT_TYPES)[number];
43
41
  * updates -> a Run terminal. Provider-native event names must be translated
44
42
  * inside the adapter and must never leak through to this level.
45
43
  */
46
- export { contextActmode, assertExecutionEvidence } from "./actmode.js";
47
- export declare const CANONICAL_EVENT_TYPES: readonly ["session.update", "execution.update", "usage.update", "model_step.started", "model_step.finished", "message.create", "message.delta", "message.update", "tool_call.create", "tool_call.delta", "tool_call.update", "activity.started", "activity.updated", "activity.finished", "plan.updated", "tool_call.progress", "run.notice", "interaction.requested", "interaction.resolved", "run.queued", "run.started", "run.completed", "run.failed", "run.cancelled"];
44
+ export declare const CANONICAL_EVENT_TYPES: readonly ["session.update", "usage.update", "model_step.started", "model_step.finished", "message.create", "message.delta", "message.update", "tool_call.create", "tool_call.delta", "tool_call.update", "activity.started", "activity.updated", "activity.finished", "plan.updated", "tool_call.progress", "run.notice", "interaction.requested", "interaction.resolved", "run.queued", "run.started", "run.completed", "run.failed", "run.cancelled"];
48
45
  /** canonical 模式下的统一事件类型;native-only Adapter 无须转换原生事件。 */
49
46
  export type CanonicalEventType = (typeof CANONICAL_EVENT_TYPES)[number];
50
47
  export type CanonicalPayloadFor<TType extends CanonicalEventType> = TType extends "activity.started" ? CanonicalEventPayload & ActivityStartedPayload : TType extends "activity.updated" ? CanonicalEventPayload & ActivityUpdatedPayload : TType extends "activity.finished" ? CanonicalEventPayload & ActivityFinishedPayload : TType extends "plan.updated" ? CanonicalEventPayload & PlanUpdatedPayload : TType extends "tool_call.progress" ? CanonicalEventPayload & ToolProgressPayload : TType extends "run.notice" ? CanonicalEventPayload & RunNoticePayload : TType extends "model_step.started" ? CanonicalEventPayload & ModelStepStartedPayload : TType extends "model_step.finished" ? CanonicalEventPayload & ModelStepFinishedPayload : TType extends "interaction.requested" ? CanonicalEventPayload & InteractionRequestedPayload : TType extends "interaction.resolved" ? CanonicalEventPayload & InteractionResolvedPayload : TType extends "tool_call.create" ? CanonicalEventPayload & ToolCallCreatePayload : TType extends "tool_call.delta" ? CanonicalEventPayload & ToolCallDeltaPayload : TType extends "tool_call.update" ? CanonicalEventPayload & ToolCallUpdatePayload : CanonicalEventPayload;
@@ -73,18 +70,10 @@ export interface InteractionResponse {
73
70
  outcome: InteractionResponseOutcome;
74
71
  value?: unknown;
75
72
  }
76
- /** Provider adapters must use this accessor so hidden context is sent exactly once when present. */
73
+ /** Exact caller-provided text for the provider turn. */
77
74
  export declare function providerInputText(request: InvokeRequest): string;
78
- /** Inject trusted instructions only when starting a provider session, including a fresh restart. */
79
- export declare function initialControlInstructions(request: InvokeRequest, freshSession?: boolean): string;
80
75
  /** Exact alternate input for a provider that could not resume its session. */
81
76
  export declare function freshFallbackInputText(request: InvokeRequest): string;
82
- /** Runtime validation at the Agent Work plugin boundary; JSON schema remains the wire source of truth. */
83
- export declare function assertChannelScope(value: unknown): asserts value is ChannelScope;
84
- export declare function assertChannelMessageFact(value: unknown): asserts value is ChannelMessageFact;
85
- export declare function assertChannelContextAppend(value: unknown): asserts value is ChannelContextAppend;
86
- export declare function assertContextSyncResult(value: unknown): asserts value is ContextSyncResult;
87
- export declare function assertChannelContextDescriptor(value: unknown): asserts value is ChannelContextDescriptor;
88
77
  /**
89
78
  * The event record written to the Store.
90
79
  * `seq` is monotonic only within a single run; consumers should order and
@@ -115,7 +104,7 @@ export declare function assertApprovalRequest(value: unknown): asserts value is
115
104
  export declare function assertInteractionResponse(value: unknown): asserts value is InteractionResponse;
116
105
  /** Validate a structured failure at the dynamic adapter boundary. */
117
106
  export declare function assertFailureEnvelope(value: unknown): asserts value is FailureEnvelope;
118
- /** Assert the execution identifiers and path fields that must be present before the Host calls an adapter. */
107
+ /** 校验内部调用的身份、内容与信封结构;不改写输入,配置和目录语义由消费它的 Adapter 校验。 */
119
108
  export declare function assertInvokeRequest(request: unknown): asserts request is InvokeRequest;
120
109
  export declare function assertRuntimeLimits(value: unknown): asserts value is RuntimeLimits;
121
110
  /** Type guard: whether an event ends the current Run. */
@@ -1,24 +1,22 @@
1
1
  import { randomUUID } from "node:crypto";
2
+ export { KERNEL_IPC_VERSION } from "./generated/protocol-types.js";
2
3
  import { assertAsyncQuestions, assertQuestionRequest } from "./questions.js";
3
4
  export { assertAsyncQuestions, assertQuestionRequest, assertQuestionResponse, questionAnswerText } from "./questions.js";
4
- import { assertSessionName } from "./invoke-input.js";
5
+ import { assertAgentEnv, assertSessionName } from "./invoke-input.js";
5
6
  export { assertJsonByteLimit } from "./json-size.js";
6
7
  export { INVOKE_REQUEST_MAX_BYTES, assertInvokeRequestSize } from "./invoke-size.js";
7
8
  export * from "./stream-limits.js";
8
9
  export { assertKernelStatus, assertServiceProcessSnapshot } from "./service-processes.js";
9
10
  export * from "./run-protocol.js";
10
11
  export * from "./invoke-input.js";
11
- export * from "./model-context.js";
12
- export * from "./execution-plan.js";
13
12
  export { contextHash } from "./context-hash.js";
14
13
  export { assertJsonValue } from "./context.js";
15
14
  import { assertExperiencePayload } from "./experience.js";
16
15
  export { PROVIDER_DIAGNOSTIC_MAX_BYTES } from "./experience.js";
17
16
  import { assertModelInputParts, assertImageRecoveryParts, hasImageInput } from "./multimodal.js";
18
17
  export { IMAGE_INPUT_LIMITS, IMAGE_INPUT_MIME_TYPES, assertModelInputParts, providerInputParts, hasImageInput, modelPartsFromInput } from "./multimodal.js";
19
- import { assertAgentSource, assertApprovalMode, assertContextEnvelope, assertContextEnvs, assertJsonValue, MAX_RUN_TIMEOUT_MS, contextItem } from "./context.js";
20
- export { APPROVAL_MODES, CONTEXT_SCHEMA, CONTEXT_MAX_BYTES, CONTEXT_MAX_ITEMS, DEFAULT_RUN_TIMEOUT_MS, MAX_RUN_TIMEOUT_MS, RUNTIME_RUN_CONTRACT, assertAgentSource, assertApprovalMode, assertContextEnvelope, assertContextEnvs, assertMcpServers, assertContextMcp, assertResolvedExecutionPlan, canonicalContext, contextItem, mergeContext } from "./context.js";
21
- export { RUNTIME_SELECTION_SCHEMA, assertResolvedRuntimeSelection } from "./runtime-selection.js";
18
+ import { assertApprovalMode, assertContextEnvs, assertJsonValue, MAX_RUN_TIMEOUT_MS } from "./context.js";
19
+ export { APPROVAL_MODES, CONTEXT_SCHEMA, CONTEXT_MAX_BYTES, CONTEXT_MAX_ITEMS, DEFAULT_RUN_TIMEOUT_MS, MAX_RUN_TIMEOUT_MS, RUNTIME_RUN_CONTRACT, assertApprovalMode, assertContextEnvelope, assertContextEnvs, assertMcpServers, assertContextMcp, canonicalContext, contextItem, mergeContext } from "./context.js";
22
20
  export { CONTEXT_TYPE_CATALOG, contextTypeDefinition, findContextTypeDefinition } from "./context-catalog.js";
23
21
  export { assertContextConfiguration, resolveContextConfiguration } from "./context-configuration.js";
24
22
  export { assertNotificationMessage } from "./notification.js";
@@ -53,11 +51,8 @@ export const TERMINAL_EVENT_TYPES = ["run.completed", "run.failed", "run.cancell
53
51
  * updates -> a Run terminal. Provider-native event names must be translated
54
52
  * inside the adapter and must never leak through to this level.
55
53
  */
56
- export { contextActmode, assertExecutionEvidence } from "./actmode.js";
57
- import { assertExecutionEvidence } from "./actmode.js";
58
54
  export const CANONICAL_EVENT_TYPES = [
59
55
  "session.update",
60
- "execution.update",
61
56
  "usage.update",
62
57
  "model_step.started",
63
58
  "model_step.finished",
@@ -85,146 +80,16 @@ export const INTERACTION_RESPONSE_OUTCOMES = [
85
80
  "answered",
86
81
  "cancelled"
87
82
  ];
88
- /** Provider adapters must use this accessor so hidden context is sent exactly once when present. */
83
+ /** Exact caller-provided text for the provider turn. */
89
84
  export function providerInputText(request) {
90
85
  return request.modelInput;
91
86
  }
92
- /** Inject trusted instructions only when starting a provider session, including a fresh restart. */
93
- export function initialControlInstructions(request, freshSession = !request.providerSession?.sessionId) {
94
- return freshSession ? request.controlInstructions : "";
95
- }
96
87
  /** Exact alternate input for a provider that could not resume its session. */
97
88
  export function freshFallbackInputText(request) {
98
89
  if (request.freshFallbackImagesUnavailable)
99
90
  throw new TypeError("ARTIFACT_UNAVAILABLE: historical images cannot be restored");
100
91
  return request.freshFallbackModelInput ?? providerInputText(request);
101
92
  }
102
- /** Runtime validation at the Agent Work plugin boundary; JSON schema remains the wire source of truth. */
103
- export function assertChannelScope(value) {
104
- if (!isRecord(value))
105
- throw new TypeError("channel context scope must be an object");
106
- for (const key of ["tenant_id", "endpoint_id", "channel", "bot_id", "conversation_id"]) {
107
- if (typeof value[key] !== "string" || value[key].length === 0) {
108
- throw new TypeError(`channel context scope.${key} must be a non-empty string`);
109
- }
110
- }
111
- if (!(typeof value.account_id === "string" || value.account_id === null)) {
112
- throw new TypeError("channel context scope.account_id must be a string or null");
113
- }
114
- if (value.thread_id !== undefined &&
115
- value.thread_id !== null &&
116
- typeof value.thread_id !== "string") {
117
- throw new TypeError("channel context scope.thread_id must be a string, null, or omitted");
118
- }
119
- }
120
- export function assertChannelMessageFact(value) {
121
- if (!isRecord(value))
122
- throw new TypeError("channel context fact must be an object");
123
- if (typeof value.message_id !== "string" || value.message_id.length === 0) {
124
- throw new TypeError("channel context fact.message_id must be a non-empty string");
125
- }
126
- if (value.message_seq !== undefined &&
127
- (!Number.isSafeInteger(value.message_seq) || Number(value.message_seq) < 0)) {
128
- throw new TypeError("channel context fact.message_seq must be a non-negative safe integer when present");
129
- }
130
- const sender = value.sender;
131
- if (!isRecord(sender) || typeof sender.id !== "string" || sender.id.length === 0) {
132
- throw new TypeError("channel context fact.sender.id must be a non-empty string");
133
- }
134
- if (typeof sender.kind !== "string" || sender.kind.length === 0) {
135
- throw new TypeError("channel context fact.sender.kind must be a non-empty string");
136
- }
137
- if (sender.label !== undefined && typeof sender.label !== "string") {
138
- throw new TypeError("channel context fact.sender.label must be a string when present");
139
- }
140
- if (!Number.isSafeInteger(value.occurred_at_ms) || Number(value.occurred_at_ms) <= 0) {
141
- throw new TypeError("channel context fact.occurred_at_ms must be a positive safe integer");
142
- }
143
- if (!Array.isArray(value.parts) ||
144
- value.parts.length === 0 ||
145
- value.parts.some((part) => !isRecord(part) ||
146
- typeof part.type !== "string" ||
147
- part.type.length === 0 ||
148
- (part.text !== undefined && typeof part.text !== "string"))) {
149
- throw new TypeError("channel context fact.parts must contain at least one typed object");
150
- }
151
- if (value.flags !== undefined &&
152
- (!isRecord(value.flags) ||
153
- (value.flags.self !== undefined && typeof value.flags.self !== "boolean") ||
154
- (value.flags.control !== undefined && typeof value.flags.control !== "boolean"))) {
155
- throw new TypeError("channel context fact.flags must contain optional boolean self/control values");
156
- }
157
- }
158
- export function assertChannelContextAppend(value) {
159
- if (!isRecord(value))
160
- throw new TypeError("channel context append must be an object");
161
- if (typeof value.agent_id !== "string" ||
162
- value.agent_id.length < 1 ||
163
- value.agent_id.length > 96) {
164
- throw new TypeError("channel context append.agent_id must contain 1..96 characters");
165
- }
166
- assertChannelScope(value.scope);
167
- if (!Array.isArray(value.facts) || value.facts.length < 1 || value.facts.length > 100) {
168
- throw new TypeError("channel context append.facts must contain 1..100 facts");
169
- }
170
- for (const fact of value.facts)
171
- assertChannelMessageFact(fact);
172
- if (value.gap_after_seq !== undefined &&
173
- (!Number.isSafeInteger(value.gap_after_seq) || Number(value.gap_after_seq) < 0)) {
174
- throw new TypeError("channel context append.gap_after_seq must be a non-negative safe integer when present");
175
- }
176
- }
177
- export function assertContextSyncResult(value) {
178
- if (!isRecord(value))
179
- throw new TypeError("context sync result must be an object");
180
- assertChannelScope(value.scope);
181
- if (!Array.isArray(value.facts) || value.facts.length > 100) {
182
- throw new TypeError("context sync result.facts must contain at most 100 facts");
183
- }
184
- for (const fact of value.facts)
185
- assertChannelMessageFact(fact);
186
- const result = value;
187
- if (typeof result.request_id !== "string" || result.request_id.length === 0) {
188
- throw new TypeError("context sync result.request_id must be a non-empty string");
189
- }
190
- if (!["complete", "partial", "unavailable"].includes(result.completeness)) {
191
- throw new TypeError("context sync result.completeness is invalid");
192
- }
193
- if (result.completeness === "unavailable" && result.facts.length !== 0) {
194
- throw new TypeError("unavailable context sync result must not contain facts");
195
- }
196
- if (result.through_seq !== undefined &&
197
- (!Number.isSafeInteger(result.through_seq) || Number(result.through_seq) < 0)) {
198
- throw new TypeError("context sync result.through_seq must be a non-negative safe integer when present");
199
- }
200
- }
201
- export function assertChannelContextDescriptor(value) {
202
- if (!isRecord(value))
203
- throw new TypeError("channel context descriptor must be an object");
204
- assertChannelScope(value.scope);
205
- if (typeof value.consumer_key !== "string" || value.consumer_key.length === 0) {
206
- throw new TypeError("channel context descriptor.consumer_key must be a non-empty string");
207
- }
208
- if (!Number.isSafeInteger(value.session_generation) || Number(value.session_generation) < 1) {
209
- throw new TypeError("channel context descriptor.session_generation must be a positive safe integer");
210
- }
211
- if (typeof value.trigger_message_id !== "string" || value.trigger_message_id.length === 0) {
212
- throw new TypeError("channel context descriptor.trigger_message_id must be a non-empty string");
213
- }
214
- assertChannelMessageFact(value.trigger_fact);
215
- if (value.trigger_fact.message_id !== value.trigger_message_id) {
216
- throw new TypeError("channel context descriptor trigger_fact.message_id must match trigger_message_id");
217
- }
218
- if (value.trigger_seq !== undefined &&
219
- (!Number.isSafeInteger(value.trigger_seq) || Number(value.trigger_seq) < 0)) {
220
- throw new TypeError("channel context descriptor.trigger_seq must be a non-negative safe integer when present");
221
- }
222
- const hasTriggerSeq = value.trigger_seq !== undefined;
223
- const factHasTriggerSeq = value.trigger_fact.message_seq !== undefined;
224
- if (hasTriggerSeq !== factHasTriggerSeq || value.trigger_fact.message_seq !== value.trigger_seq) {
225
- throw new TypeError("channel context descriptor trigger_fact.message_seq must match trigger_seq");
226
- }
227
- }
228
93
  export const TERMINAL_EVENTS = new Set(TERMINAL_EVENT_TYPES);
229
94
  export const EVENT_TYPES = new Set(CANONICAL_EVENT_TYPES);
230
95
  export const MESSAGE_EXPOSURES = new Set([
@@ -282,8 +147,6 @@ export function assertCanonicalEvent(event) {
282
147
  assertAsyncQuestions(payload.questions);
283
148
  }
284
149
  }
285
- if (event.type === "execution.update")
286
- assertExecutionEvidence(payload);
287
150
  assertExperiencePayload(event.type, payload);
288
151
  if (event.type === "run.failed" && payload.failure !== undefined) {
289
152
  assertFailureEnvelope(payload.failure);
@@ -552,63 +415,49 @@ export function assertFailureEnvelope(value) {
552
415
  throw new TypeError("failure.cause must contain reasonCode");
553
416
  }
554
417
  }
555
- /** Assert the execution identifiers and path fields that must be present before the Host calls an adapter. */
418
+ /** 校验内部调用的身份、内容与信封结构;不改写输入,配置和目录语义由消费它的 Adapter 校验。 */
556
419
  export function assertInvokeRequest(request) {
557
420
  if (!isRecord(request))
558
421
  throw new TypeError("InvokeRequest must be an object");
422
+ if ("controlInstructions" in request)
423
+ throw new TypeError("CONTROL_INSTRUCTIONS_REMOVED: controlInstructions was removed; provide application prompts in inputs.parts");
559
424
  if (request.sessionName !== undefined)
560
425
  assertSessionName(request.sessionName);
561
426
  if (request.protocolVersion !== PROTOCOL_VERSION)
562
427
  throw new TypeError("InvokeRequest.protocolVersion must be 2");
563
428
  if ("appendInstructions" in request)
564
429
  throw new TypeError("LEGACY_RUN_CONTRACT_REJECTED");
565
- assertAgentSource(request.agentSource);
566
- assertContextEnvelope(request.context);
567
- if (request.executionEnvOverrides !== undefined) {
430
+ const allowed = new Set([
431
+ "protocolVersion",
432
+ "invocationId",
433
+ "agentSessionId",
434
+ "runId",
435
+ "sessionName",
436
+ "sessionGeneration",
437
+ "providerEpoch",
438
+ "continuityMode",
439
+ "prompt",
440
+ "modelInput",
441
+ "modelInputParts",
442
+ "freshFallbackModelInput",
443
+ "freshFallbackModelInputParts",
444
+ "freshFallbackImagesUnavailable",
445
+ "runMetadata",
446
+ "agentEnv",
447
+ "providerSession",
448
+ "signal",
449
+ "executionEnvOverrides"
450
+ ]);
451
+ if (Object.keys(request).some((key) => !allowed.has(key)))
452
+ throw new TypeError("InvokeRequest contains an unknown field");
453
+ assertAgentEnv(request.agentEnv);
454
+ if (request.executionEnvOverrides !== undefined)
568
455
  assertContextEnvs(request.executionEnvOverrides);
569
- if (Buffer.byteLength(JSON.stringify(request.executionEnvOverrides)) > 65_536)
570
- throw new TypeError("EXECUTION_ENV_TOO_LARGE");
571
- }
572
- assertApprovalMode(request.approvalMode);
573
- const modelChoices = contextItem(request.context, "octo.execution", "model")?.payload;
574
- const approvalPolicy = contextItem(request.context, "octo.security", "approval_policy")?.payload;
575
- if (approvalPolicy && approvalPolicy.mode !== request.approvalMode)
576
- throw new TypeError("CONTEXT_PLAN_MISMATCH");
577
- const agentConfig = request.agentConfig;
578
- if (isRecord(agentConfig) &&
579
- ["autoApprove", "dangerouslyBypassPermissions", "permissionMode"].some((key) => key in agentConfig)) {
580
- throw new TypeError("LEGACY_PERMISSION_CONFIG_REJECTED");
581
- }
582
- if (isRecord(agentConfig) && "thinking" in agentConfig)
583
- throw new TypeError("LEGACY_REASONING_CONFIG_REJECTED");
584
- for (const selection of [
585
- { name: "selection", property: "id", config: "model" },
586
- { name: "reasoning", property: "effort", config: "effort" }
587
- ]) {
588
- const selected = modelChoices?.[selection.name];
589
- if (selected &&
590
- selected[selection.property] !==
591
- (isRecord(agentConfig) ? agentConfig[selection.config] : undefined))
592
- throw new TypeError("CONTEXT_PLAN_MISMATCH");
593
- }
594
- const workspace = contextItem(request.context, "octo.execution", "workspace")?.payload;
595
- if (workspace?.mode === "fixed" && workspace.path !== request.workdir)
596
- throw new TypeError("CONTEXT_PLAN_MISMATCH");
597
- if (["skills", "skillRoots", "providerStateDir", "mcpServers"].some((key) => Object.hasOwn(request, key)))
598
- throw new TypeError("LOCAL_PLUGIN_CONFIGURATION_REQUIRED");
599
- if (typeof request.controlInstructions !== "string")
600
- throw new TypeError("InvokeRequest.controlInstructions must be a string");
601
- if (request.runtimeLimits !== undefined)
602
- assertRuntimeLimits(request.runtimeLimits);
603
456
  for (const key of ["invocationId", "agentSessionId", "runId", "prompt"]) {
604
457
  if (typeof request[key] !== "string" || request[key].length === 0) {
605
458
  throw new TypeError(`InvokeRequest.${key} must be a non-empty string`);
606
459
  }
607
460
  }
608
- const providerWorkspace = contextItem(request.context, "octo.execution", "adapter")?.payload.type === "openclaw";
609
- if (typeof request.workdir !== "string" ||
610
- (!request.workdir && request.agentSource !== "preset" && !providerWorkspace))
611
- throw new TypeError("InvokeRequest.workdir is required for provisioned execution");
612
461
  if (typeof request.modelInput !== "string" || request.modelInput.length === 0) {
613
462
  throw new TypeError("InvokeRequest.modelInput must be a non-empty string");
614
463
  }
@@ -651,7 +500,7 @@ export function assertRuntimeLimits(value) {
651
500
  cancelGraceMs: 60_000
652
501
  };
653
502
  for (const [key, setting] of Object.entries(value)) {
654
- if (key === "enforcement" || key === "modelIdlePolicy") {
503
+ if (key === "modelIdlePolicy") {
655
504
  if (setting !== "enforce" && setting !== "observe")
656
505
  throw new TypeError(`invalid runtimeLimits.${key}`);
657
506
  }
@@ -663,10 +512,6 @@ export function assertRuntimeLimits(value) {
663
512
  throw new TypeError(`invalid runtimeLimits.${key}`);
664
513
  }
665
514
  }
666
- if (value.enforcement === "observe" &&
667
- ["modelIdlePolicy", "modelIdleWarningMs", "toolWallTimeoutMs"].some((key) => value[key] !== undefined)) {
668
- throw new TypeError("legacy enforcement=observe cannot be combined with watchdog v2 settings; use modelIdlePolicy=observe with enforcement=enforce");
669
- }
670
515
  }
671
516
  /** Type guard: whether an event ends the current Run. */
672
517
  export function isTerminal(event) {
@@ -1,4 +1,4 @@
1
- import { type AgentConfig, type AgentSource, type ApprovalMode, type CanonicalEvent, type ContextEnvelope, type ContextEnvsPayload, type HostFrame, type InvokeRequest, type ModelInputPart, type ProviderSession, type RuntimeLimits } from "./index.js";
1
+ import { type CanonicalEvent, type ContextEnvelope, type ContextEnvsPayload, type HostFrame, type InvokeRequest, type ModelInputPart, type ProviderSession } from "./index.js";
2
2
  import type { StreamLimitPolicy } from "./stream-limits.js";
3
3
  /**
4
4
  * Public JSON invocation contract shared by CLI, SDK and channels.
@@ -27,7 +27,7 @@ export declare class InvokeInput {
27
27
  providerEpoch?: number;
28
28
  /** Display-safe description; defaults to the textual summary of inputs. */
29
29
  prompt?: string;
30
- /** Exact textual provider turn when distinct from the multipart inputs summary. */
30
+ /** 显式值替换纯文本 inputs 的 Provider 正文;有图片时保留原有有序 parts。 */
31
31
  modelInput?: string;
32
32
  /** JSON metadata for tracing/business identity; not model text or authorization evidence. */
33
33
  runMetadata?: Record<string, unknown>;
@@ -35,9 +35,9 @@ export declare class InvokeInput {
35
35
  providerSession?: ProviderSession;
36
36
  /** Fresh/continue intent; defaults to continue with providerSession, fresh otherwise. */
37
37
  continuityMode?: "fresh" | "continue";
38
- /** Caller-provided exact recovery text; no automatic history reconstruction. */
38
+ /** 调用方完整恢复文本;无显式恢复 parts 时优先于主输入,不自动补历史。 */
39
39
  freshFallbackModelInput?: string;
40
- /** Caller-provided recovery text/image parts; recovery images must be supplied explicitly. */
40
+ /** 显式恢复 parts 优先于恢复文本和主输入;须保留当前图片及其顺序。 */
41
41
  freshFallbackModelInputParts?: ModelInputPart[];
42
42
  /** Explicitly fail fresh fallback when historical image bytes cannot be supplied. */
43
43
  freshFallbackImagesUnavailable?: boolean;
@@ -45,20 +45,7 @@ export declare class InvokeInput {
45
45
  static check(value: unknown): InvokeInput;
46
46
  }
47
47
  /** 可复用执行配置;信封格式保持 v3,业务材料必须由调用方放入 inputs。 */
48
- export interface AgentEnv extends ContextEnvelope {
49
- /** Agent ownership: preset for OpenClaw by default, provisioned otherwise. */
50
- agentSource?: AgentSource;
51
- /** Provider cwd; defaults to the resolved workspace (local cwd when omitted). */
52
- workdir?: string;
53
- /** Trusted instructions, separate from model business context; derived if omitted. */
54
- controlInstructions?: string;
55
- /** Execution approval policy, normally resolved from contexts; defaults to ask. */
56
- approvalMode?: ApprovalMode;
57
- /** Full provider configuration, including providerOptions; context selections must agree. */
58
- agentConfig?: AgentConfig;
59
- /** Complete timeout/enforcement settings; execution defaults apply when omitted. */
60
- runtimeLimits?: RuntimeLimits;
61
- }
48
+ export type AgentEnv = ContextEnvelope;
62
49
  /** 高级调用的内容与追踪信息;不包含执行环境、会话参数或本地 signal。 */
63
50
  export type InvocationContent = Omit<InvokeInput, "inputs" | "agentEnv" | "sessionId" | "providerSession"> & {
64
51
  parts: ModelInputPart[];
@@ -67,6 +54,8 @@ export type InvocationInputs = ModelInputPart[] | InvocationContent;
67
54
  /** Local ingress execution settings, outside caller-owned JSON and Context. */
68
55
  export interface InvokeEnvironment {
69
56
  signal?: AbortSignal;
57
+ /** 宿主连接配置独立于调用方信封,仅由目标 Adapter 消费。 */
58
+ providerOptions?: Record<string, string>;
70
59
  /** Trusted per-invocation values; forwarded privately across the Host process boundary. */
71
60
  executionEnvOverrides?: ContextEnvsPayload;
72
61
  /** Trusted transport and replay budgets; never sourced from caller Context. */
@@ -92,7 +81,7 @@ export declare function identifyInvokeInput(input: InvokeInput): {
92
81
  providerEpoch?: number;
93
82
  /** Display-safe description; defaults to the textual summary of inputs. */
94
83
  prompt?: string;
95
- /** Exact textual provider turn when distinct from the multipart inputs summary. */
84
+ /** 显式值替换纯文本 inputs 的 Provider 正文;有图片时保留原有有序 parts。 */
96
85
  modelInput?: string;
97
86
  /** JSON metadata for tracing/business identity; not model text or authorization evidence. */
98
87
  runMetadata?: Record<string, unknown>;
@@ -100,9 +89,9 @@ export declare function identifyInvokeInput(input: InvokeInput): {
100
89
  providerSession?: ProviderSession;
101
90
  /** Fresh/continue intent; defaults to continue with providerSession, fresh otherwise. */
102
91
  continuityMode?: "fresh" | "continue";
103
- /** Caller-provided exact recovery text; no automatic history reconstruction. */
92
+ /** 调用方完整恢复文本;无显式恢复 parts 时优先于主输入,不自动补历史。 */
104
93
  freshFallbackModelInput?: string;
105
- /** Caller-provided recovery text/image parts; recovery images must be supplied explicitly. */
94
+ /** 显式恢复 parts 优先于恢复文本和主输入;须保留当前图片及其顺序。 */
106
95
  freshFallbackModelInputParts?: ModelInputPart[];
107
96
  /** Explicitly fail fresh fallback when historical image bytes cannot be supplied. */
108
97
  freshFallbackImagesUnavailable?: boolean;
@@ -123,5 +112,5 @@ export declare function assertInvokeInput(value: unknown): asserts value is Invo
123
112
  export declare function assertSessionName(value: unknown): asserts value is string;
124
113
  /** Lossless field reorganization of a validated prepared execution, excluding its local signal. */
125
114
  export declare function invocationInput(request: InvokeRequest, protocol_mode?: "native" | "canonical", adapterType?: string): InvokeInput;
126
- /** 执行环境只接受执行/审批/受信指令,绝不解释业务命名空间或将其渲染成提示词。 */
115
+ /** 公共层只校验信封;共性与私有 payload 由消费它的 Adapter 校验。 */
127
116
  export declare function assertAgentEnv(value: unknown): asserts value is AgentEnv;