@mininglamp-oss/octo-runtime 1.1.12 → 1.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/README.md +1 -1
  2. package/apps/cli/dist/adapters.d.ts +19 -1
  3. package/apps/cli/dist/adapters.js +153 -23
  4. package/apps/cli/dist/build-info.json +2 -2
  5. package/apps/cli/dist/codex.d.ts +5 -0
  6. package/apps/cli/dist/codex.js +36 -0
  7. package/apps/cli/dist/kernel.d.ts +4 -0
  8. package/apps/cli/dist/kernel.js +84 -0
  9. package/apps/cli/dist/main.js +8 -7
  10. package/apps/cli/dist/manifest.json +33 -22
  11. package/apps/cli/dist/output.d.ts +1 -0
  12. package/apps/cli/dist/output.js +8 -4
  13. package/apps/cli/dist/playboard.js +21 -12
  14. package/apps/cli/dist/provider-launch.d.ts +28 -0
  15. package/apps/cli/dist/provider-launch.js +52 -0
  16. package/apps/cli/dist/providers.d.ts +182 -0
  17. package/apps/cli/dist/providers.js +34 -0
  18. package/dist/public/adapter-sdk.d.ts +2 -0
  19. package/dist/public/adapter-sdk.js +2 -0
  20. package/dist/public/protocol.d.ts +1 -1
  21. package/dist/public/protocol.js +1 -1
  22. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/dist/index.js +4 -4
  23. package/node_modules/@mininglamp-oss/octo-runtime-acp-client/package.json +3 -3
  24. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.d.ts +15 -14
  25. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/dist/index.js +24 -28
  26. package/node_modules/@mininglamp-oss/octo-runtime-adapter-acp/package.json +4 -4
  27. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.d.ts +10 -35
  28. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/dist/index.js +22 -29
  29. package/node_modules/@mininglamp-oss/octo-runtime-adapter-antigravity/package.json +3 -3
  30. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.d.ts +14 -68
  31. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/dist/index.js +60 -43
  32. package/node_modules/@mininglamp-oss/octo-runtime-adapter-claude-code/package.json +3 -3
  33. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.d.ts +19 -31
  34. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/dist/index.js +29 -18
  35. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codebuddy/package.json +4 -4
  36. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.d.ts +6 -5
  37. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/app-server.js +32 -26
  38. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/engine.d.ts +54 -0
  39. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/engine.js +147 -0
  40. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/environment.js +4 -8
  41. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.d.ts +20 -92
  42. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/index.js +104 -216
  43. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/mcp.d.ts +2 -2
  44. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/mcp.js +4 -11
  45. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.d.ts +9 -5
  46. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/dist/service.js +77 -81
  47. package/node_modules/@mininglamp-oss/octo-runtime-adapter-codex/package.json +3 -3
  48. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.d.ts +4 -2
  49. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/dist/index.js +12 -14
  50. package/node_modules/@mininglamp-oss/octo-runtime-adapter-dsh/package.json +3 -3
  51. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.d.ts +14 -14
  52. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/adapter.js +23 -30
  53. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/client.js +4 -7
  54. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.d.ts +13 -21
  55. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/dist/index.js +48 -26
  56. package/node_modules/@mininglamp-oss/octo-runtime-adapter-grok-build/package.json +5 -5
  57. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.d.ts +16 -14
  58. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/dist/index.js +15 -7
  59. package/node_modules/@mininglamp-oss/octo-runtime-adapter-hermes/package.json +2 -2
  60. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.d.ts +16 -14
  61. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/dist/index.js +14 -6
  62. package/node_modules/@mininglamp-oss/octo-runtime-adapter-kimi-code/package.json +2 -2
  63. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.d.ts +16 -14
  64. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/dist/index.js +15 -7
  65. package/node_modules/@mininglamp-oss/octo-runtime-adapter-mcode/package.json +2 -2
  66. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.d.ts +7 -3
  67. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/dist/index.js +27 -29
  68. package/node_modules/@mininglamp-oss/octo-runtime-adapter-openclaw/package.json +3 -3
  69. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.d.ts +16 -25
  70. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/dist/index.js +109 -178
  71. package/node_modules/@mininglamp-oss/octo-runtime-adapter-opencode/package.json +4 -4
  72. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.d.ts +16 -14
  73. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/dist/index.js +15 -6
  74. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qodercli/package.json +3 -2
  75. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.d.ts +16 -14
  76. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/dist/index.js +15 -6
  77. package/node_modules/@mininglamp-oss/octo-runtime-adapter-qoderclicn/package.json +3 -2
  78. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/activity.d.ts +5 -1
  79. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.d.ts +49 -0
  80. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/agent-env.js +256 -0
  81. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/approval.js +7 -2
  82. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/environment.js +1 -1
  83. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/execution-scope.d.ts +5 -1
  84. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.d.ts +25 -12
  85. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/index.js +116 -58
  86. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/mcp.js +1 -1
  87. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.d.ts +11 -1
  88. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/process-launch.js +89 -8
  89. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/provider-launch.d.ts +10 -0
  90. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/provider-launch.js +25 -0
  91. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/dist/public-display.js +10 -3
  92. package/node_modules/@mininglamp-oss/octo-runtime-adapter-sdk/package.json +2 -2
  93. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.d.ts +19 -1
  94. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/adapters.js +153 -23
  95. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/build-info.json +2 -2
  96. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/codex.d.ts +5 -0
  97. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/codex.js +36 -0
  98. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/kernel.d.ts +4 -0
  99. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/kernel.js +84 -0
  100. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/main.js +8 -7
  101. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/manifest.json +33 -22
  102. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.d.ts +1 -0
  103. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/output.js +8 -4
  104. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/playboard.js +21 -12
  105. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/provider-launch.d.ts +28 -0
  106. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/provider-launch.js +52 -0
  107. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/providers.d.ts +182 -0
  108. package/node_modules/@mininglamp-oss/octo-runtime-cli/dist/providers.js +34 -0
  109. package/node_modules/@mininglamp-oss/octo-runtime-cli/package.json +20 -20
  110. package/node_modules/@mininglamp-oss/octo-runtime-client/build-info.json +2 -2
  111. package/node_modules/@mininglamp-oss/octo-runtime-client/dist/client.js +2 -2
  112. package/node_modules/@mininglamp-oss/octo-runtime-client/package.json +5 -5
  113. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-ipc.schema.json +3 -104
  114. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/protocol.schema.json +173 -1295
  115. package/node_modules/@mininglamp-oss/octo-runtime-cross-service/package.json +1 -1
  116. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.d.ts +0 -2
  117. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/index.js +26 -54
  118. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.d.ts +2 -2
  119. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/invoke-input.js +13 -85
  120. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.d.ts +3 -1
  121. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/watchdog.js +5 -0
  122. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/package.json +3 -3
  123. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.d.ts +1 -1
  124. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/index.js +1 -1
  125. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.d.ts +5 -0
  126. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/dist/server.js +17 -20
  127. package/node_modules/@mininglamp-oss/octo-runtime-executor-kernel/package.json +5 -5
  128. package/node_modules/@mininglamp-oss/octo-runtime-host-sdk/package.json +4 -4
  129. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.d.ts +0 -2
  130. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/browser.js +0 -2
  131. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-catalog.d.ts +0 -1
  132. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-catalog.js +3 -5
  133. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context-configuration.js +1 -8
  134. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.d.ts +1 -2
  135. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/context.js +3 -267
  136. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.d.ts +2 -0
  137. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/failure.js +17 -3
  138. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.d.ts +102 -396
  139. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/generated/protocol-types.js +32 -1
  140. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.d.ts +6 -15
  141. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/index.js +33 -178
  142. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.d.ts +11 -22
  143. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/invoke-input.js +38 -78
  144. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/multimodal.js +6 -0
  145. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.d.ts +2 -1
  146. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/run-protocol.js +5 -28
  147. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/service-processes.js +2 -1
  148. package/node_modules/@mininglamp-oss/octo-runtime-protocol/package.json +1 -1
  149. package/package.json +34 -37
  150. package/packages/octo-runtime-protocol/schema/kernel-ipc.schema.json +3 -104
  151. package/packages/octo-runtime-protocol/schema/protocol.schema.json +173 -1295
  152. package/dist/public/codex.d.ts +0 -1
  153. package/dist/public/codex.js +0 -1
  154. package/dist/public/dsh.d.ts +0 -2
  155. package/dist/public/dsh.js +0 -1
  156. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-configuration-fixtures.json +0 -1219
  157. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/context-fixtures.json +0 -5988
  158. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/kernel-client.behavior.json +0 -56
  159. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/native-invoke-fixtures.json +0 -116
  160. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/run-protocol-fixtures.json +0 -761
  161. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/runtime-selection-fixtures.json +0 -663
  162. package/node_modules/@mininglamp-oss/octo-runtime-client/schema/session-name-fixtures.json +0 -191
  163. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/context.d.ts +0 -12
  164. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/context.js +0 -89
  165. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/execution-preparation.d.ts +0 -33
  166. package/node_modules/@mininglamp-oss/octo-runtime-executor-core/dist/execution-preparation.js +0 -93
  167. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/execution-plan.d.ts +0 -3
  168. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/execution-plan.js +0 -80
  169. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/model-context.d.ts +0 -3
  170. package/node_modules/@mininglamp-oss/octo-runtime-protocol/dist/model-context.js +0 -9
  171. /package/node_modules/@mininglamp-oss/octo-runtime-client/{schema → fixtures}/kernel-ipc-fixtures.json +0 -0
  172. /package/packages/octo-runtime-protocol/{schema → test/fixtures}/kernel-ipc-fixtures.json +0 -0
@@ -31,6 +31,8 @@ export function assertContextEnvelope(value) {
31
31
  const keys = new Set();
32
32
  for (const item of value.items) {
33
33
  object(item, "CONTEXT_SCHEMA_INVALID");
34
+ if (item.namespace === "octo.control" && item.name === "instructions")
35
+ throw new TypeError("CONTROL_INSTRUCTIONS_REMOVED: controlInstructions was removed; provide application prompts in inputs.parts");
34
36
  fields(item, ["namespace", "name", "guidance", "data_format", "payload"]);
35
37
  for (const property of ["namespace", "name"]) {
36
38
  const text = item[property];
@@ -44,18 +46,12 @@ export function assertContextEnvelope(value) {
44
46
  if (item.guidance !== undefined) {
45
47
  if (typeof item.guidance !== "string")
46
48
  throw new TypeError("CONTEXT_SCHEMA_INVALID");
47
- if (["octo.execution", "octo.runtime", "octo.security", "octo.control"].includes(String(item.namespace)))
48
- throw new TypeError("CONTEXT_GUIDANCE_FORBIDDEN");
49
49
  }
50
50
  object(item.payload, "CONTEXT_SCHEMA_INVALID");
51
51
  if (item.data_format !== undefined) {
52
- if (item.data_format !== "text" || !String(item.namespace).startsWith("extra."))
53
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
54
- fields(item.payload, ["text"]);
55
- if (typeof item.payload.text !== "string")
52
+ if (item.data_format !== "text")
56
53
  throw new TypeError("CONTEXT_SCHEMA_INVALID");
57
54
  }
58
- publicPayload(item.namespace, item.name, item.payload);
59
55
  }
60
56
  if (new TextEncoder().encode(JSON.stringify(value)).length > CONTEXT_MAX_BYTES)
61
57
  throw new TypeError("CONTEXT_BUDGET_EXCEEDED");
@@ -105,57 +101,6 @@ export function mergeContext(defaults, overrides) {
105
101
  assertContextEnvelope(result);
106
102
  return JSON.parse(canonicalContext(result));
107
103
  }
108
- export function assertResolvedExecutionPlan(value) {
109
- object(value, "RESOLVED_EXECUTION_PLAN_REQUIRED");
110
- assertJsonValue(value);
111
- fields(value, [
112
- "agent_source",
113
- "adapter_type",
114
- "provider_agent_id",
115
- "workdir",
116
- "workspace",
117
- "approval_mode",
118
- "model",
119
- "effort",
120
- "actmode",
121
- "runtime_limits",
122
- "envs",
123
- "mcp"
124
- ]);
125
- if (value.envs !== undefined)
126
- assertContextEnvs(value.envs);
127
- if (value.mcp !== undefined)
128
- assertContextMcp(value.mcp);
129
- assertAgentSource(value.agent_source);
130
- if (value.actmode !== undefined && value.actmode !== "default" && value.actmode !== "plan")
131
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
132
- text(value.adapter_type);
133
- assertProviderAgent(value.adapter_type, value.provider_agent_id);
134
- if (typeof value.workdir !== "string")
135
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
136
- if (value.workspace !== undefined) {
137
- object(value.workspace, "RESOLVED_EXECUTION_PLAN_INVALID");
138
- executionField("octo.execution", "workspace", value.workspace);
139
- }
140
- if (!value.workdir &&
141
- value.agent_source !== "preset" &&
142
- (!isObject(value.workspace) || value.workspace.mode !== "random"))
143
- throw new TypeError("RESOLVED_EXECUTION_PLAN_INVALID");
144
- if (isObject(value.workspace) &&
145
- value.workspace.mode === "none" &&
146
- (value.agent_source !== "preset" || value.workdir !== ""))
147
- throw new TypeError("RESOLVED_EXECUTION_PLAN_INVALID");
148
- if (value.agent_source === "preset" && typeof value.provider_agent_id !== "string")
149
- throw new TypeError("PRESET_AGENT_TARGET_REQUIRED");
150
- assertApprovalMode(value.approval_mode);
151
- for (const property of ["model", "effort"])
152
- if (value[property] !== undefined)
153
- text(value[property]);
154
- if (value.runtime_limits !== undefined) {
155
- object(value.runtime_limits, "RESOLVED_EXECUTION_PLAN_INVALID");
156
- limits(value.runtime_limits);
157
- }
158
- }
159
104
  export function assertContextMcp(value) {
160
105
  object(value, "CONTEXT_SCHEMA_INVALID");
161
106
  fields(value, ["mcpServers"]);
@@ -280,219 +225,10 @@ export function mergeReferences(base, next) {
280
225
  const entries = new Map([...base, ...next].map((entry) => [String(entry.resource_ref), structuredClone(entry)]));
281
226
  return [...entries].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)).map(([, entry]) => entry);
282
227
  }
283
- function publicPayload(namespace, name, value) {
284
- if (namespace === "octo.execution" && name === "actmode") {
285
- fields(value, ["mode"]);
286
- if (value.mode !== "default" && value.mode !== "plan")
287
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
288
- return;
289
- }
290
- if (namespace === "octo.execution" && name === "mcp") {
291
- assertContextMcp(value);
292
- return;
293
- }
294
- if (namespace === "octo.execution" && name === "envs") {
295
- assertContextEnvs(value);
296
- return;
297
- }
298
- if (namespace === "octo.resources")
299
- throw new TypeError("CONTEXT_TYPE_REMOVED");
300
- if (namespace === "octo.execution" && name === "model") {
301
- fields(value, ["selection", "reasoning"]);
302
- if (!Object.keys(value).length)
303
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
304
- for (const [key, setting] of Object.entries(value)) {
305
- object(setting, "CONTEXT_SCHEMA_INVALID");
306
- executionField("octo.execution", key === "selection" ? "model" : "reasoning", setting);
307
- }
308
- return;
309
- }
310
- if ((namespace === "octo.execution" && ["adapter", "workspace", "limits"].includes(name)) ||
311
- (namespace === "octo.runtime" && name === "selection") ||
312
- (namespace === "octo.security" && name === "approval_policy")) {
313
- executionField(namespace, name, value);
314
- return;
315
- }
316
- if ((namespace === "octo.content" && ["inline", "references"].includes(name)) ||
317
- (namespace === "octo.control" && name === "instructions")) {
318
- fields(value, ["entries"]);
319
- if (!Array.isArray(value.entries) || (name !== "instructions" && value.entries.length === 0))
320
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
321
- const refs = new Set();
322
- for (const entry of value.entries) {
323
- object(entry, "CONTEXT_SCHEMA_INVALID");
324
- if (name === "instructions") {
325
- fields(entry, ["text"]);
326
- text(entry.text);
327
- }
328
- else if (name === "references") {
329
- resource(entry);
330
- const ref = String(entry.resource_ref);
331
- if (refs.has(ref))
332
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
333
- refs.add(ref);
334
- }
335
- else if (name === "inline") {
336
- fields(entry, ["text", "resource_ref", "source", "summary"]);
337
- text(entry.text);
338
- if (entry.resource_ref !== undefined)
339
- text(entry.resource_ref);
340
- if (entry.source !== undefined &&
341
- typeof entry.source !== "string" &&
342
- !isObject(entry.source))
343
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
344
- if (entry.summary !== undefined && typeof entry.summary !== "string")
345
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
346
- }
347
- else
348
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
349
- }
350
- return;
351
- }
352
- // Unknown optional types remain opaque until a consumer explicitly supports them.
353
- }
354
- function executionField(namespace, name, value) {
355
- if (namespace === "octo.execution") {
356
- if (name === "adapter") {
357
- fields(value, ["type", "provider_agent_id"]);
358
- text(value.type);
359
- assertProviderAgent(value.type, value.provider_agent_id);
360
- return;
361
- }
362
- if (name === "model" || name === "reasoning") {
363
- const property = name === "model" ? "id" : "effort";
364
- fields(value, [property, "use_provider_default"]);
365
- if (value.use_provider_default === true && value[property] === undefined)
366
- return;
367
- if (value.use_provider_default !== undefined)
368
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
369
- text(value[property]);
370
- return;
371
- }
372
- if (name === "workspace") {
373
- fields(value, ["mode", "path"]);
374
- if (value.mode === "none" && value.path === undefined)
375
- return;
376
- if (value.mode === "fixed") {
377
- text(value.path);
378
- return;
379
- }
380
- if (value.mode === "random" && value.path === undefined)
381
- return;
382
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
383
- }
384
- if (name === "limits") {
385
- limits(value);
386
- return;
387
- }
388
- }
389
- if (namespace === "octo.runtime" && name === "selection") {
390
- fields(value, [
391
- "mode",
392
- "runtime_id",
393
- "runtime_ids",
394
- "strategy",
395
- "offline_behavior",
396
- "failover"
397
- ]);
398
- if (value.offline_behavior !== undefined &&
399
- value.offline_behavior !== "wait" &&
400
- value.offline_behavior !== "fail")
401
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
402
- if (value.failover !== undefined &&
403
- value.failover !== "none" &&
404
- value.failover !== "candidates")
405
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
406
- if (value.mode === "explicit" && value.failover !== undefined && value.failover !== "none")
407
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
408
- if (value.mode === "explicit" &&
409
- value.runtime_ids === undefined &&
410
- value.strategy === undefined) {
411
- text(value.runtime_id);
412
- return;
413
- }
414
- if (value.mode === "candidates" &&
415
- value.runtime_id === undefined &&
416
- value.strategy === "preferred_failover") {
417
- stringList(value.runtime_ids, 64, 1);
418
- return;
419
- }
420
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
421
- }
422
- if (namespace === "octo.security" && name === "approval_policy") {
423
- fields(value, ["mode"]);
424
- assertApprovalMode(value.mode);
425
- return;
426
- }
427
- throw new TypeError("CONTEXT_TYPE_UNSUPPORTED");
428
- }
429
- function limits(value) {
430
- const bounds = {
431
- first_frame_timeout_ms: 1_800_000,
432
- model_idle_timeout_ms: 3_600_000,
433
- model_idle_warning_ms: 3_600_000,
434
- tool_timeout_ms: 86_400_000,
435
- tool_wall_timeout_ms: 86_400_000,
436
- run_timeout_ms: MAX_RUN_TIMEOUT_MS,
437
- cancel_grace_ms: 60_000
438
- };
439
- fields(value, [...Object.keys(bounds), "model_idle_policy", "enforcement"]);
440
- for (const [key, setting] of Object.entries(value)) {
441
- if (key === "model_idle_policy" || key === "enforcement") {
442
- if (setting !== "enforce" && setting !== "observe")
443
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
444
- }
445
- else
446
- integer(setting, 100, bounds[key]);
447
- }
448
- if (value.enforcement === "observe" &&
449
- ["model_idle_policy", "model_idle_warning_ms", "tool_wall_timeout_ms"].some((key) => key in value))
450
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
451
- }
452
- function resource(value) {
453
- fields(value, ["resource_ref", "resolver", "locator", "params", "authorization_ref", "revision"]);
454
- text(value.resource_ref);
455
- for (const property of ["authorization_ref", "revision"])
456
- if (value[property] !== undefined)
457
- text(value[property]);
458
- if (value.params !== undefined)
459
- object(value.params, "CONTEXT_SCHEMA_INVALID");
460
- const locator = value.locator;
461
- object(locator, "CONTEXT_SCHEMA_INVALID");
462
- if (value.resolver !== "mcp")
463
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
464
- fields(locator, ["server_ref", "tool"]);
465
- text(locator.server_ref);
466
- text(locator.tool);
467
- }
468
- function integer(value, minimum, maximum = Number.MAX_SAFE_INTEGER) {
469
- if (!Number.isSafeInteger(value) || Number(value) < minimum || Number(value) > maximum)
470
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
471
- }
472
- function stringList(value, maximum, minimum = 0) {
473
- if (!Array.isArray(value) ||
474
- value.length < minimum ||
475
- value.length > maximum ||
476
- value.some((item) => typeof item !== "string" || !item) ||
477
- new Set(value).size !== value.length)
478
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
479
- }
480
- function assertProviderAgent(type, id) {
481
- if (type === "openclaw") {
482
- if (typeof id !== "string" || !/^[a-z0-9_][a-z0-9_-]{0,63}$/.test(id))
483
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
484
- }
485
- else if (id !== undefined)
486
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
487
- }
488
228
  function fields(value, allowed) {
489
229
  if (Object.keys(value).some((key) => !allowed.includes(key)))
490
230
  throw new TypeError("CONTEXT_SCHEMA_INVALID");
491
231
  }
492
- function text(value) {
493
- if (typeof value !== "string" || value.length === 0)
494
- throw new TypeError("CONTEXT_SCHEMA_INVALID");
495
- }
496
232
  function isObject(value) {
497
233
  return value !== null && typeof value === "object" && !Array.isArray(value);
498
234
  }
@@ -65,6 +65,8 @@ export declare const FAILURE_CATALOG: Readonly<{
65
65
  }>;
66
66
  export type PublicFailureCode = keyof typeof FAILURE_CATALOG;
67
67
  export declare function isCodexLocalFailureReason(value: unknown): value is string;
68
+ /** 执行目录检查的封闭原因码;native 帧与公开失败分类共用。 */
69
+ export declare function isWorkdirFailureReason(value: unknown): value is "WORKDIR_REQUIRED" | "WORKDIR_INVALID" | "WORKDIR_NOT_FOUND" | "WORKDIR_NOT_DIRECTORY" | "WORKDIR_UNAVAILABLE";
68
70
  /** native 仅允许中央目录的本地失败;不开放任意 params 或 Provider 自报错误提升。 */
69
71
  export declare function isCodexLocalFailure(failure: FailureEnvelope): boolean;
70
72
  /** Classify untrusted adapter/provider error data without copying raw messages or secrets into the result. */
@@ -60,6 +60,17 @@ const CODEX_LOCAL_FAILURES = Object.freeze({
60
60
  export function isCodexLocalFailureReason(value) {
61
61
  return typeof value === "string" && Object.hasOwn(CODEX_LOCAL_FAILURES, value);
62
62
  }
63
+ /** 执行目录检查的封闭原因码;native 帧与公开失败分类共用。 */
64
+ export function isWorkdirFailureReason(value) {
65
+ return (typeof value === "string" &&
66
+ [
67
+ "WORKDIR_REQUIRED",
68
+ "WORKDIR_INVALID",
69
+ "WORKDIR_NOT_FOUND",
70
+ "WORKDIR_NOT_DIRECTORY",
71
+ "WORKDIR_UNAVAILABLE"
72
+ ].includes(value));
73
+ }
63
74
  /** native 仅允许中央目录的本地失败;不开放任意 params 或 Provider 自报错误提升。 */
64
75
  export function isCodexLocalFailure(failure) {
65
76
  const reason = failure.reasonCode;
@@ -113,7 +124,7 @@ export function classifyFailure(input, context) {
113
124
  ? {}
114
125
  : classification.reasonCode === "CODEX_FINALIZATION_TIMEOUT"
115
126
  ? {
116
- configParameter: "execution_profile.agent_config.providerOptions.finalizationTimeoutMs"
127
+ configParameter: "adapter.codex/options.finalizationTimeoutMs"
117
128
  }
118
129
  : timeoutConfiguration(classification.code, context.source?.adapter),
119
130
  retryable: codexLocal || classification.reasonCode === "CODEX_FINALIZATION_TIMEOUT"
@@ -215,10 +226,10 @@ function timeoutConfiguration(code, adapter) {
215
226
  "OH-ADP-3012": "cancel_grace_ms"
216
227
  };
217
228
  if (fields[code])
218
- return { configParameter: `execution_profile.runtime_limits.${fields[code]}` };
229
+ return { configParameter: `octo.execution/limits.${fields[code]}` };
219
230
  if (code === "OH-ADP-3013" && adapter === "codex")
220
231
  return {
221
- configParameter: "execution_profile.agent_config.providerOptions.appServerRequestTimeoutMs"
232
+ configParameter: "adapter.codex/options.appServerRequestTimeoutMs"
222
233
  };
223
234
  return {};
224
235
  }
@@ -366,6 +377,9 @@ function classify(evidence, defaultDomain, adapter) {
366
377
  // ACP 已明确声明失败;meta 仅作诊断,不从其中的状态码或文字猜测其他类别。
367
378
  if (explicit === "ACP_MODEL_REQUEST_FAILED")
368
379
  return result("OH-PRV-4010", explicit);
380
+ // 目录失败属于既有调用配置分类,具体原因先于 errno/正文启发式保留。
381
+ if (isWorkdirFailureReason(explicit))
382
+ return result("OH-ADP-3004", explicit);
369
383
  for (const [reason, code] of Object.entries({
370
384
  UNSUPPORTED_INPUT_MODALITY: "OH-INP-5001",
371
385
  IMAGE_RECOVERY_INPUT_REQUIRED: "OH-INP-5001",