@loopingai/core 0.4.0 → 0.5.1

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 (289) hide show
  1. package/dist/a2a/agent-stub.d.ts +0 -1
  2. package/dist/a2a/agent-stub.js +0 -1
  3. package/dist/a2a/caller.d.ts +0 -1
  4. package/dist/a2a/caller.js +0 -1
  5. package/dist/a2a/card.d.ts +0 -1
  6. package/dist/a2a/card.js +0 -1
  7. package/dist/a2a/context.d.ts +0 -1
  8. package/dist/a2a/context.js +0 -1
  9. package/dist/a2a/executor.d.ts +0 -1
  10. package/dist/a2a/executor.js +0 -1
  11. package/dist/a2a/index.d.ts +0 -1
  12. package/dist/a2a/index.js +0 -1
  13. package/dist/a2a/notify.d.ts +0 -1
  14. package/dist/a2a/notify.js +0 -1
  15. package/dist/a2a/parts.d.ts +0 -1
  16. package/dist/a2a/parts.js +0 -1
  17. package/dist/a2a/push.d.ts +0 -1
  18. package/dist/a2a/push.js +0 -1
  19. package/dist/a2a/task-store.d.ts +0 -1
  20. package/dist/a2a/task-store.js +0 -1
  21. package/dist/a2a/task.d.ts +0 -1
  22. package/dist/a2a/task.js +0 -1
  23. package/dist/a2a/verify.d.ts +0 -1
  24. package/dist/a2a/verify.js +0 -1
  25. package/dist/agent/budget.d.ts +0 -1
  26. package/dist/agent/budget.js +0 -1
  27. package/dist/agent/control.d.ts +0 -1
  28. package/dist/agent/control.js +0 -1
  29. package/dist/agent/final-reply.d.ts +0 -1
  30. package/dist/agent/final-reply.js +0 -1
  31. package/dist/agent/history.d.ts +0 -1
  32. package/dist/agent/history.js +0 -1
  33. package/dist/agent/index.d.ts +0 -1
  34. package/dist/agent/index.js +0 -1
  35. package/dist/agent/inference.d.ts +0 -1
  36. package/dist/agent/inference.js +0 -1
  37. package/dist/agent/model.d.ts +0 -1
  38. package/dist/agent/model.js +0 -1
  39. package/dist/agent/session.d.ts +0 -1
  40. package/dist/agent/session.js +0 -1
  41. package/dist/config.d.ts +0 -1
  42. package/dist/config.js +0 -1
  43. package/dist/contract/index.d.ts +0 -1
  44. package/dist/contract/index.js +0 -1
  45. package/dist/contract/plugin.d.ts +0 -1
  46. package/dist/contract/plugin.js +0 -1
  47. package/dist/contract/recipe.d.ts +14 -3
  48. package/dist/contract/recipe.js +0 -1
  49. package/dist/contract/validation.d.ts +22 -19
  50. package/dist/contract/validation.js +19 -11
  51. package/dist/db/db.d.ts +0 -1
  52. package/dist/db/db.js +0 -1
  53. package/dist/db/index.d.ts +0 -1
  54. package/dist/db/index.js +0 -1
  55. package/dist/db/migrations/index.d.ts +0 -1
  56. package/dist/db/migrations/index.js +0 -1
  57. package/dist/db/models/subtasks.d.ts +0 -1
  58. package/dist/db/models/subtasks.js +0 -1
  59. package/dist/db/models/tasks.d.ts +0 -1
  60. package/dist/db/models/tasks.js +0 -1
  61. package/dist/db/schema.d.ts +0 -1
  62. package/dist/db/schema.js +0 -1
  63. package/dist/env.d.ts +0 -1
  64. package/dist/env.js +0 -1
  65. package/dist/host/agent.d.ts +3 -4
  66. package/dist/host/agent.js +3 -6
  67. package/dist/host/index.d.ts +0 -1
  68. package/dist/host/index.js +0 -1
  69. package/dist/host/plugin-host.d.ts +5 -10
  70. package/dist/host/plugin-host.js +0 -1
  71. package/dist/index.d.ts +0 -1
  72. package/dist/index.js +0 -1
  73. package/dist/platform.d.ts +0 -1
  74. package/dist/platform.js +0 -1
  75. package/dist/round/agent.d.ts +0 -1
  76. package/dist/round/agent.js +0 -1
  77. package/dist/round/index.d.ts +0 -1
  78. package/dist/round/index.js +0 -1
  79. package/dist/round/policy.d.ts +0 -1
  80. package/dist/round/policy.js +0 -1
  81. package/dist/round/subagent.d.ts +0 -1
  82. package/dist/round/subagent.js +0 -3
  83. package/dist/round/turn.d.ts +0 -1
  84. package/dist/round/turn.js +0 -1
  85. package/dist/round/workflow.d.ts +7 -2
  86. package/dist/round/workflow.js +22 -21
  87. package/dist/runtime/index.d.ts +0 -1
  88. package/dist/runtime/index.js +2 -7
  89. package/dist/runtime/tool-families.d.ts +0 -1
  90. package/dist/runtime/tool-families.js +0 -1
  91. package/dist/subagent/fingerprint.d.ts +0 -1
  92. package/dist/subagent/fingerprint.js +7 -3
  93. package/dist/subagent/index.d.ts +0 -1
  94. package/dist/subagent/index.js +0 -1
  95. package/dist/subagent/prompt.d.ts +0 -1
  96. package/dist/subagent/prompt.js +0 -1
  97. package/dist/subagent/run.d.ts +0 -1
  98. package/dist/subagent/run.js +0 -1
  99. package/dist/subagent/workspace.d.ts +0 -1
  100. package/dist/subagent/workspace.js +0 -1
  101. package/dist/subtasks/catalog.d.ts +0 -1
  102. package/dist/subtasks/catalog.js +0 -1
  103. package/dist/subtasks/decomposition.d.ts +0 -1
  104. package/dist/subtasks/decomposition.js +0 -1
  105. package/dist/subtasks/delegate.d.ts +0 -1
  106. package/dist/subtasks/delegate.js +0 -1
  107. package/dist/subtasks/index.d.ts +0 -1
  108. package/dist/subtasks/index.js +0 -1
  109. package/dist/subtasks/scheduler.d.ts +0 -1
  110. package/dist/subtasks/scheduler.js +0 -1
  111. package/dist/subtasks/subtask-types.d.ts +0 -1
  112. package/dist/subtasks/subtask-types.js +0 -1
  113. package/dist/subtasks/types.d.ts +0 -1
  114. package/dist/subtasks/types.js +0 -1
  115. package/dist/testing/auth.d.ts +0 -1
  116. package/dist/testing/auth.js +0 -1
  117. package/dist/testing/do.d.ts +0 -1
  118. package/dist/testing/do.js +0 -1
  119. package/dist/testing/fake-session.d.ts +0 -1
  120. package/dist/testing/fake-session.js +0 -1
  121. package/dist/testing/fixtures.d.ts +0 -1
  122. package/dist/testing/fixtures.js +0 -1
  123. package/dist/testing/harness.d.ts +0 -1
  124. package/dist/testing/harness.js +0 -1
  125. package/dist/testing/index.d.ts +0 -1
  126. package/dist/testing/index.js +0 -1
  127. package/dist/testing/mock-model.d.ts +0 -1
  128. package/dist/testing/mock-model.js +0 -1
  129. package/dist/testing/node.d.ts +0 -1
  130. package/dist/testing/node.js +0 -1
  131. package/dist/testing/vcr-global-setup.d.ts +0 -1
  132. package/dist/testing/vcr-global-setup.js +0 -1
  133. package/dist/testing/vcr-shared.d.ts +0 -1
  134. package/dist/testing/vcr-shared.js +0 -1
  135. package/dist/testing/vcr-spec.d.ts +0 -1
  136. package/dist/testing/vcr-spec.js +0 -1
  137. package/dist/testing/vcr-store.d.ts +0 -1
  138. package/dist/testing/vcr-store.js +0 -1
  139. package/dist/testing/vcr.d.ts +0 -1
  140. package/dist/testing/vcr.js +0 -1
  141. package/dist/worker/define-agent.d.ts +0 -1
  142. package/dist/worker/define-agent.js +0 -1
  143. package/dist/worker/index.d.ts +0 -1
  144. package/dist/worker/index.js +0 -1
  145. package/package.json +2 -2
  146. package/dist/a2a/agent-stub.d.ts.map +0 -1
  147. package/dist/a2a/agent-stub.js.map +0 -1
  148. package/dist/a2a/caller.d.ts.map +0 -1
  149. package/dist/a2a/caller.js.map +0 -1
  150. package/dist/a2a/card.d.ts.map +0 -1
  151. package/dist/a2a/card.js.map +0 -1
  152. package/dist/a2a/context.d.ts.map +0 -1
  153. package/dist/a2a/context.js.map +0 -1
  154. package/dist/a2a/executor.d.ts.map +0 -1
  155. package/dist/a2a/executor.js.map +0 -1
  156. package/dist/a2a/index.d.ts.map +0 -1
  157. package/dist/a2a/index.js.map +0 -1
  158. package/dist/a2a/notify.d.ts.map +0 -1
  159. package/dist/a2a/notify.js.map +0 -1
  160. package/dist/a2a/parts.d.ts.map +0 -1
  161. package/dist/a2a/parts.js.map +0 -1
  162. package/dist/a2a/push.d.ts.map +0 -1
  163. package/dist/a2a/push.js.map +0 -1
  164. package/dist/a2a/task-store.d.ts.map +0 -1
  165. package/dist/a2a/task-store.js.map +0 -1
  166. package/dist/a2a/task.d.ts.map +0 -1
  167. package/dist/a2a/task.js.map +0 -1
  168. package/dist/a2a/verify.d.ts.map +0 -1
  169. package/dist/a2a/verify.js.map +0 -1
  170. package/dist/agent/budget.d.ts.map +0 -1
  171. package/dist/agent/budget.js.map +0 -1
  172. package/dist/agent/control.d.ts.map +0 -1
  173. package/dist/agent/control.js.map +0 -1
  174. package/dist/agent/final-reply.d.ts.map +0 -1
  175. package/dist/agent/final-reply.js.map +0 -1
  176. package/dist/agent/history.d.ts.map +0 -1
  177. package/dist/agent/history.js.map +0 -1
  178. package/dist/agent/index.d.ts.map +0 -1
  179. package/dist/agent/index.js.map +0 -1
  180. package/dist/agent/inference.d.ts.map +0 -1
  181. package/dist/agent/inference.js.map +0 -1
  182. package/dist/agent/model.d.ts.map +0 -1
  183. package/dist/agent/model.js.map +0 -1
  184. package/dist/agent/session.d.ts.map +0 -1
  185. package/dist/agent/session.js.map +0 -1
  186. package/dist/config.d.ts.map +0 -1
  187. package/dist/config.js.map +0 -1
  188. package/dist/contract/index.d.ts.map +0 -1
  189. package/dist/contract/index.js.map +0 -1
  190. package/dist/contract/plugin.d.ts.map +0 -1
  191. package/dist/contract/plugin.js.map +0 -1
  192. package/dist/contract/recipe.d.ts.map +0 -1
  193. package/dist/contract/recipe.js.map +0 -1
  194. package/dist/contract/validation.d.ts.map +0 -1
  195. package/dist/contract/validation.js.map +0 -1
  196. package/dist/db/db.d.ts.map +0 -1
  197. package/dist/db/db.js.map +0 -1
  198. package/dist/db/index.d.ts.map +0 -1
  199. package/dist/db/index.js.map +0 -1
  200. package/dist/db/migrations/index.d.ts.map +0 -1
  201. package/dist/db/migrations/index.js.map +0 -1
  202. package/dist/db/models/subtasks.d.ts.map +0 -1
  203. package/dist/db/models/subtasks.js.map +0 -1
  204. package/dist/db/models/tasks.d.ts.map +0 -1
  205. package/dist/db/models/tasks.js.map +0 -1
  206. package/dist/db/schema.d.ts.map +0 -1
  207. package/dist/db/schema.js.map +0 -1
  208. package/dist/env.d.ts.map +0 -1
  209. package/dist/env.js.map +0 -1
  210. package/dist/host/agent.d.ts.map +0 -1
  211. package/dist/host/agent.js.map +0 -1
  212. package/dist/host/index.d.ts.map +0 -1
  213. package/dist/host/index.js.map +0 -1
  214. package/dist/host/plugin-host.d.ts.map +0 -1
  215. package/dist/host/plugin-host.js.map +0 -1
  216. package/dist/index.d.ts.map +0 -1
  217. package/dist/index.js.map +0 -1
  218. package/dist/platform.d.ts.map +0 -1
  219. package/dist/platform.js.map +0 -1
  220. package/dist/round/agent.d.ts.map +0 -1
  221. package/dist/round/agent.js.map +0 -1
  222. package/dist/round/index.d.ts.map +0 -1
  223. package/dist/round/index.js.map +0 -1
  224. package/dist/round/policy.d.ts.map +0 -1
  225. package/dist/round/policy.js.map +0 -1
  226. package/dist/round/subagent.d.ts.map +0 -1
  227. package/dist/round/subagent.js.map +0 -1
  228. package/dist/round/turn.d.ts.map +0 -1
  229. package/dist/round/turn.js.map +0 -1
  230. package/dist/round/workflow.d.ts.map +0 -1
  231. package/dist/round/workflow.js.map +0 -1
  232. package/dist/runtime/index.d.ts.map +0 -1
  233. package/dist/runtime/index.js.map +0 -1
  234. package/dist/runtime/tool-families.d.ts.map +0 -1
  235. package/dist/runtime/tool-families.js.map +0 -1
  236. package/dist/subagent/fingerprint.d.ts.map +0 -1
  237. package/dist/subagent/fingerprint.js.map +0 -1
  238. package/dist/subagent/index.d.ts.map +0 -1
  239. package/dist/subagent/index.js.map +0 -1
  240. package/dist/subagent/prompt.d.ts.map +0 -1
  241. package/dist/subagent/prompt.js.map +0 -1
  242. package/dist/subagent/run.d.ts.map +0 -1
  243. package/dist/subagent/run.js.map +0 -1
  244. package/dist/subagent/workspace.d.ts.map +0 -1
  245. package/dist/subagent/workspace.js.map +0 -1
  246. package/dist/subtasks/catalog.d.ts.map +0 -1
  247. package/dist/subtasks/catalog.js.map +0 -1
  248. package/dist/subtasks/decomposition.d.ts.map +0 -1
  249. package/dist/subtasks/decomposition.js.map +0 -1
  250. package/dist/subtasks/delegate.d.ts.map +0 -1
  251. package/dist/subtasks/delegate.js.map +0 -1
  252. package/dist/subtasks/index.d.ts.map +0 -1
  253. package/dist/subtasks/index.js.map +0 -1
  254. package/dist/subtasks/scheduler.d.ts.map +0 -1
  255. package/dist/subtasks/scheduler.js.map +0 -1
  256. package/dist/subtasks/subtask-types.d.ts.map +0 -1
  257. package/dist/subtasks/subtask-types.js.map +0 -1
  258. package/dist/subtasks/types.d.ts.map +0 -1
  259. package/dist/subtasks/types.js.map +0 -1
  260. package/dist/testing/auth.d.ts.map +0 -1
  261. package/dist/testing/auth.js.map +0 -1
  262. package/dist/testing/do.d.ts.map +0 -1
  263. package/dist/testing/do.js.map +0 -1
  264. package/dist/testing/fake-session.d.ts.map +0 -1
  265. package/dist/testing/fake-session.js.map +0 -1
  266. package/dist/testing/fixtures.d.ts.map +0 -1
  267. package/dist/testing/fixtures.js.map +0 -1
  268. package/dist/testing/harness.d.ts.map +0 -1
  269. package/dist/testing/harness.js.map +0 -1
  270. package/dist/testing/index.d.ts.map +0 -1
  271. package/dist/testing/index.js.map +0 -1
  272. package/dist/testing/mock-model.d.ts.map +0 -1
  273. package/dist/testing/mock-model.js.map +0 -1
  274. package/dist/testing/node.d.ts.map +0 -1
  275. package/dist/testing/node.js.map +0 -1
  276. package/dist/testing/vcr-global-setup.d.ts.map +0 -1
  277. package/dist/testing/vcr-global-setup.js.map +0 -1
  278. package/dist/testing/vcr-shared.d.ts.map +0 -1
  279. package/dist/testing/vcr-shared.js.map +0 -1
  280. package/dist/testing/vcr-spec.d.ts.map +0 -1
  281. package/dist/testing/vcr-spec.js.map +0 -1
  282. package/dist/testing/vcr-store.d.ts.map +0 -1
  283. package/dist/testing/vcr-store.js.map +0 -1
  284. package/dist/testing/vcr.d.ts.map +0 -1
  285. package/dist/testing/vcr.js.map +0 -1
  286. package/dist/worker/define-agent.d.ts.map +0 -1
  287. package/dist/worker/define-agent.js.map +0 -1
  288. package/dist/worker/index.d.ts.map +0 -1
  289. package/dist/worker/index.js.map +0 -1
@@ -23,25 +23,20 @@
23
23
  * known; a thunk is what lets the host supply it late while every hook reads
24
24
  * the same one. On a subagent facet there is no caller at all, and the honest
25
25
  * encoding is a thunk that throws.
26
- * - the model ids — what a locally-declared recipe runs on. A recipe may only
27
- * name models in the host's allowlist, so a plugin that ships one is handed the
28
- * host's pair rather than guessing.
29
26
  * - `aiGatewayId` — the **resolved** AI Gateway slug, so a plugin making its own
30
27
  * model calls is correlated with the agent's. Resolved, not read off the
31
28
  * overrides object: reaching into `MY_CONFIG.model?.aiGatewayId` at a call site
32
29
  * silently yields `undefined` the moment that override is dropped in favour of
33
- * core's default, and the plugin's calls quietly stop being correlated.
30
+ * core's baseline, and the plugin's calls quietly stop being correlated.
31
+ *
32
+ * Deliberately **not** here: the agent's model pair. See the note on the
33
+ * interface below.
34
34
  */
35
35
  export interface PluginHost<TEnv extends object = object> {
36
36
  env: TEnv;
37
37
  storage: DurableObjectStorage;
38
38
  /** The verified caller. A thunk — it does not exist when `onStart` runs. */
39
39
  callerKey: () => string;
40
- /** `config.model.chatModelId` what a locally-declared recipe runs on. */
41
- primaryModelId: string;
42
- /** `config.model.fallbackChatModelId`. */
43
- fallbackModelId: string;
44
- /** `config.model.aiGatewayId`, already resolved over core's defaults. */
40
+ /** `config.model.aiGatewayId`, already resolved over core's baseline. */
45
41
  aiGatewayId: string;
46
42
  }
47
- //# sourceMappingURL=plugin-host.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=plugin-host.js.map
package/dist/index.d.ts CHANGED
@@ -17,4 +17,3 @@ export { parseGatewayOrigins, type A2ASecretsEnv, type AiEnv, type CoreEnv } fro
17
17
  export { CHUNK_SOFT_MS, MAX_CHUNKS_PER_BRANCH, STEP_TIMEOUT_MS, STEPS_PER_INSTANCE } from "./platform.js";
18
18
  export type { PluginStore } from "./db/db.js";
19
19
  export { makeWorkspaceHandle, memoryWorkspaceBacking, WorkspaceLimitError, WORKSPACE_MAX_FILES, WORKSPACE_MAX_FILE_BYTES, type WorkspaceBacking, type WorkspaceEntry, type WorkspaceHandle } from "./subagent/workspace.js";
20
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -15,4 +15,3 @@ export { ConfigError, DEFAULT_CORE_CONFIG, resolveConfig } from "./config.js";
15
15
  export { parseGatewayOrigins } from "./env.js";
16
16
  export { CHUNK_SOFT_MS, MAX_CHUNKS_PER_BRANCH, STEP_TIMEOUT_MS, STEPS_PER_INSTANCE } from "./platform.js";
17
17
  export { makeWorkspaceHandle, memoryWorkspaceBacking, WorkspaceLimitError, WORKSPACE_MAX_FILES, WORKSPACE_MAX_FILE_BYTES } from "./subagent/workspace.js";
18
- //# sourceMappingURL=index.js.map
@@ -44,4 +44,3 @@ export declare const CHUNK_SOFT_MS: number;
44
44
  * 2. The worst-case step product stays under {@link STEPS_PER_INSTANCE}.
45
45
  */
46
46
  export declare const MAX_CHUNKS_PER_BRANCH = 40;
47
- //# sourceMappingURL=platform.d.ts.map
package/dist/platform.js CHANGED
@@ -44,4 +44,3 @@ export const CHUNK_SOFT_MS = 4 * 60_000;
44
44
  * 2. The worst-case step product stays under {@link STEPS_PER_INSTANCE}.
45
45
  */
46
46
  export const MAX_CHUNKS_PER_BRANCH = 40;
47
- //# sourceMappingURL=platform.js.map
@@ -264,4 +264,3 @@ export declare abstract class RoundAgentBase<TEnv extends Cloudflare.Env & AiEnv
264
264
  */
265
265
  protected onTaskCanceled(taskId: string): Promise<void>;
266
266
  }
267
- //# sourceMappingURL=agent.d.ts.map
@@ -688,4 +688,3 @@ function toSubtaskNode(s) {
688
688
  dependsOn: s.dependsOn
689
689
  };
690
690
  }
691
- //# sourceMappingURL=agent.js.map
@@ -22,4 +22,3 @@ export { RoundAgentBase } from "./agent.js";
22
22
  export { RecipeSubagentHost, type SubagentClass } from "./subagent.js";
23
23
  export { runHandleTask, type HandleTaskDeps, type HandleTaskParams } from "./workflow.js";
24
24
  export { buildTurnInstructions, joinSuccessfulBranches, renderTurnMessages, runTurn, type RoundMode, type RunTurnArgs, type RunTurnOutcome, type TurnInstructions } from "./turn.js";
25
- //# sourceMappingURL=index.d.ts.map
@@ -21,4 +21,3 @@ export { RoundAgentBase } from "./agent.js";
21
21
  export { RecipeSubagentHost } from "./subagent.js";
22
22
  export { runHandleTask } from "./workflow.js";
23
23
  export { buildTurnInstructions, joinSuccessfulBranches, renderTurnMessages, runTurn } from "./turn.js";
24
- //# sourceMappingURL=index.js.map
@@ -96,4 +96,3 @@ export interface RoundPolicy {
96
96
  partialNote: string;
97
97
  };
98
98
  }
99
- //# sourceMappingURL=policy.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=policy.js.map
@@ -64,4 +64,3 @@ export declare abstract class RecipeSubagentHost<TEnv extends Cloudflare.Env & A
64
64
  * typed as this: any named subclass below it.
65
65
  */
66
66
  export type SubagentClass = new (...args: ConstructorParameters<typeof RecipeSubagentBase>) => RecipeSubagentBase;
67
- //# sourceMappingURL=subagent.d.ts.map
@@ -66,8 +66,6 @@ export class RecipeSubagentHost extends RecipeSubagentBase {
66
66
  throw new Error("a subagent execution has no caller identity — this plugin reads " +
67
67
  "per-caller state on a path where none exists");
68
68
  },
69
- primaryModelId: config.model?.chatModelId ?? "",
70
- fallbackModelId: config.model?.fallbackChatModelId ?? "",
71
69
  aiGatewayId: config.model?.aiGatewayId ?? ""
72
70
  }),
73
71
  env: this.env
@@ -88,4 +86,3 @@ export class RecipeSubagentHost extends RecipeSubagentBase {
88
86
  };
89
87
  }
90
88
  }
91
- //# sourceMappingURL=subagent.js.map
@@ -228,4 +228,3 @@ export type RunTurnOutcome = {
228
228
  * completed branches; with nothing behind it, it resolves to `{ status: "failed" }`.
229
229
  */
230
230
  export declare function runTurn(args: RunTurnArgs): Promise<RunTurnOutcome>;
231
- //# sourceMappingURL=turn.d.ts.map
@@ -494,4 +494,3 @@ export async function runTurn(args) {
494
494
  }
495
495
  return { status: "failed", error: detail };
496
496
  }
497
- //# sourceMappingURL=turn.js.map
@@ -66,7 +66,13 @@ export interface HandleTaskParams {
66
66
  * 250-line orchestration.
67
67
  */
68
68
  export interface HandleTaskDeps {
69
- /** Route to the right DO class for the verified caller. */
69
+ /**
70
+ * Route to the right DO class for the verified caller.
71
+ *
72
+ * Called **once per step body**, not once per run, so it must stay a cheap
73
+ * pure lookup — a namespace `get`, nothing cached and nothing awaited. See
74
+ * {@link ResolveAgent} for why the result must never be hoisted.
75
+ */
70
76
  resolveAgent: (identity: GatewayIdentity) => AgentStub;
71
77
  /** Resolved config — the loop reads `mainAgentLimits` and `maxSubtasks`. */
72
78
  config: CoreConfig;
@@ -106,4 +112,3 @@ type AgentStub = DurableObjectStub<RoundAgentBase>;
106
112
  */
107
113
  export declare function runHandleTask(p: HandleTaskParams, step: WorkflowStep, deps: HandleTaskDeps): Promise<void>;
108
114
  export {};
109
- //# sourceMappingURL=workflow.d.ts.map
@@ -20,8 +20,10 @@ import { selectWave } from "../subtasks/scheduler.js";
20
20
  */
21
21
  export async function runHandleTask(p, step, deps) {
22
22
  const limits = deps.config.mainAgentLimits;
23
- // Pre-work. Routing is pure, so it needs no step of its own.
24
- const stub = deps.resolveAgent(p.identity);
23
+ // Pre-work. Routing is pure, so it needs no step of its own — but it is
24
+ // deliberately *not* resolved here into a value the steps below close over.
25
+ // See {@link ResolveAgent}.
26
+ const agent = () => deps.resolveAgent(p.identity);
25
27
  const push = {
26
28
  taskId: p.taskId,
27
29
  contextId: p.contextId,
@@ -29,7 +31,7 @@ export async function runHandleTask(p, step, deps) {
29
31
  pushToken: p.pushToken,
30
32
  jku: p.jku
31
33
  };
32
- const started = await step.do("working", async () => (await stub.markWorking(p.taskId)) === "ok");
34
+ const started = await step.do("working", async () => (await agent().markWorking(p.taskId)) === "ok");
33
35
  if (!started)
34
36
  return;
35
37
  // Main-agent turns spent so far, across every round. Summed from cached step
@@ -82,7 +84,7 @@ export async function runHandleTask(p, step, deps) {
82
84
  // Projected to a plain object: an RPC return carries a `Disposable` brand a
83
85
  // step result cannot serialize. Every branch must carry `turns` — a field
84
86
  // this projection drops is a field the budget never sees.
85
- const result = await stub.runTaskTurn({
87
+ const result = await agent().runTaskTurn({
86
88
  taskId: p.taskId,
87
89
  text: p.text,
88
90
  identity: p.identity,
@@ -114,19 +116,19 @@ export async function runHandleTask(p, step, deps) {
114
116
  round,
115
117
  error: turn.error
116
118
  });
117
- await deliver(p, step, stub, null, deps);
119
+ await deliver(p, step, agent, null, deps);
118
120
  return;
119
121
  }
120
122
  if (turn.status === "replied") {
121
- await deliver(p, step, stub, turn.reply, deps);
123
+ await deliver(p, step, agent, turn.reply, deps);
122
124
  return;
123
125
  }
124
126
  // Delegated: run this round's DAG, then loop and let the model decide again.
125
- const executed = await executeDag(p, step, stub, round, push, deps);
127
+ const executed = await executeDag(p, step, agent, round, push, deps);
126
128
  if (executed === "canceled")
127
129
  return;
128
130
  if (executed === "stuck") {
129
- await deliver(p, step, stub, null, deps);
131
+ await deliver(p, step, agent, null, deps);
130
132
  return;
131
133
  }
132
134
  }
@@ -136,7 +138,7 @@ export async function runHandleTask(p, step, deps) {
136
138
  console.error("[handle-task] round budget exhausted without a reply", {
137
139
  taskId: p.taskId
138
140
  });
139
- await deliver(p, step, stub, null, deps);
141
+ await deliver(p, step, agent, null, deps);
140
142
  }
141
143
  /**
142
144
  * Drive one round's Subtask DAG to termination, one wave at a time.
@@ -151,20 +153,20 @@ export async function runHandleTask(p, step, deps) {
151
153
  * two rounds of the same Task reusing `scan:0` would replay the first round's
152
154
  * cached answer into the second.
153
155
  */
154
- async function executeDag(p, step, stub, round, push, deps) {
156
+ async function executeDag(p, step, agent, round, push, deps) {
155
157
  for (let wave = 0; wave <= deps.config.maxSubtasks; wave++) {
156
158
  // One durable step per wave: `skipBlockedSubtasks` reports cancellation,
157
159
  // propagates skips past any branch that just failed, and returns the
158
160
  // refreshed DAG projection — one round trip, one consistent answer.
159
161
  const scan = await step.do(`scan:${round}:${wave}`, async () => {
160
- const result = await stub.skipBlockedSubtasks(p.taskId, round);
162
+ const result = await agent().skipBlockedSubtasks(p.taskId, round);
161
163
  return result.canceled
162
164
  ? { canceled: true, nodes: [] }
163
165
  : { canceled: false, nodes: result.nodes };
164
166
  });
165
167
  if (scan.canceled) {
166
168
  await step.do(`cancel:${round}:${wave}`, async () => {
167
- await stub.cancelPendingSubtasks(p.taskId);
169
+ await agent().cancelPendingSubtasks(p.taskId);
168
170
  });
169
171
  return "canceled";
170
172
  }
@@ -184,7 +186,7 @@ async function executeDag(p, step, stub, round, push, deps) {
184
186
  // maximum is the only fan-out bound. `runBranch` never rejects, so a single
185
187
  // branch cannot fast-fail `Promise.all` and strand its siblings' durable
186
188
  // results.
187
- await Promise.all(decision.ids.map((id) => runBranch(p, step, stub, id, push)));
189
+ await Promise.all(decision.ids.map((id) => runBranch(p, step, agent, id, push)));
188
190
  }
189
191
  console.error("[handle-task] subtask DAG exceeded its wave budget", {
190
192
  taskId: p.taskId,
@@ -218,7 +220,7 @@ async function executeDag(p, step, stub, round, push, deps) {
218
220
  * Step ids are unique across rounds (SQLite assigns them), so these names need no
219
221
  * round prefix.
220
222
  */
221
- async function runBranch(p, step, stub, id, push) {
223
+ async function runBranch(p, step, agent, id, push) {
222
224
  try {
223
225
  for (let chunk = 0; chunk < MAX_CHUNKS_PER_BRANCH; chunk++) {
224
226
  // Chunk 0 keeps the plain `execute:<id>` step name so single-chunk branches
@@ -226,7 +228,7 @@ async function runBranch(p, step, stub, id, push) {
226
228
  const stepName = chunk === 0 ? `execute:${id}` : `execute:${id}:chunk:${chunk}`;
227
229
  const done = await step.do(stepName, async () => {
228
230
  // The DO posts any progress itself; the step returns only the verdict.
229
- const outcome = await stub.executeSubtaskChunk(id, chunk, push);
231
+ const outcome = await agent().executeSubtaskChunk(id, chunk, push);
230
232
  return outcome.done;
231
233
  });
232
234
  if (done)
@@ -239,7 +241,7 @@ async function runBranch(p, step, stub, id, push) {
239
241
  subtaskId: id
240
242
  });
241
243
  await step.do(`fail:${id}`, async () => {
242
- await stub.failSubtask(id, `execution exceeded ${MAX_CHUNKS_PER_BRANCH} chunks`);
244
+ await agent().failSubtask(id, `execution exceeded ${MAX_CHUNKS_PER_BRANCH} chunks`);
243
245
  });
244
246
  }
245
247
  catch (err) {
@@ -249,7 +251,7 @@ async function runBranch(p, step, stub, id, push) {
249
251
  err: String(err)
250
252
  });
251
253
  await step.do(`fail:${id}`, async () => {
252
- await stub.failSubtask(id, `execution exhausted retries: ${String(err)}`);
254
+ await agent().failSubtask(id, `execution exhausted retries: ${String(err)}`);
253
255
  });
254
256
  }
255
257
  }
@@ -269,12 +271,12 @@ async function runBranch(p, step, stub, id, push) {
269
271
  * `notify` — in which a `tasks/cancel` lands and the gateway still receives a
270
272
  * `completed` callback. Keying the notify on "did the write apply" closes it.
271
273
  */
272
- async function deliver(p, step, stub, reply, deps) {
274
+ async function deliver(p, step, agent, reply, deps) {
273
275
  const task = await step.do("complete", async () => {
274
276
  const terminal = reply !== null
275
277
  ? buildCompletedTask(p.taskId, p.contextId, reply)
276
278
  : buildFailedTask(p.taskId, p.contextId, deps.policy.copy.taskFailed);
277
- return (await stub.saveTask(terminal)) ? terminal : null;
279
+ return (await agent().saveTask(terminal)) ? terminal : null;
278
280
  });
279
281
  if (!task)
280
282
  return;
@@ -290,7 +292,7 @@ async function deliver(p, step, stub, reply, deps) {
290
292
  // this Task's children were reclaimed.
291
293
  try {
292
294
  await step.do("sweep", async () => {
293
- await stub.sweepTaskChildren(p.taskId);
295
+ await agent().sweepTaskChildren(p.taskId);
294
296
  });
295
297
  }
296
298
  catch (err) {
@@ -313,4 +315,3 @@ async function deliver(p, step, stub, reply, deps) {
313
315
  }).deliver(task);
314
316
  });
315
317
  }
316
- //# sourceMappingURL=workflow.js.map
@@ -123,4 +123,3 @@ export declare class RuntimeSetupError extends Error {
123
123
  constructor(message: string);
124
124
  }
125
125
  export declare function createAgentRuntime(options: CreateAgentRuntimeOptions): AgentRuntime;
126
- //# sourceMappingURL=index.d.ts.map
@@ -79,12 +79,8 @@ export function createAgentRuntime(options) {
79
79
  }
80
80
  }
81
81
  const policy = {
82
- modelAllowlist: new Set([
83
- config.model.chatModelId,
84
- config.model.fallbackChatModelId
85
- ]),
86
- defaultPrimaryModelId: config.model.chatModelId,
87
- defaultFallbackModelId: config.model.fallbackChatModelId,
82
+ primaryModelId: config.model.chatModelId,
83
+ fallbackModelId: config.model.fallbackChatModelId,
88
84
  knownToolFamilies: new Set(toolFamilies.keys()),
89
85
  baselineLimits: config.subagentLimits
90
86
  };
@@ -182,4 +178,3 @@ export function createAgentRuntime(options) {
182
178
  }
183
179
  };
184
180
  }
185
- //# sourceMappingURL=index.js.map
@@ -30,4 +30,3 @@ export declare function collectToolFamilies<TRuntime = SubtaskRuntime>(plugins:
30
30
  key: string;
31
31
  toolFamilies?: Record<string, ToolFamilyBuilder<TRuntime>>;
32
32
  }[]): Map<string, ToolFamilyBuilder<TRuntime>>;
33
- //# sourceMappingURL=tool-families.d.ts.map
@@ -59,4 +59,3 @@ export function collectToolFamilies(plugins) {
59
59
  }
60
60
  return registry;
61
61
  }
62
- //# sourceMappingURL=tool-families.js.map
@@ -35,4 +35,3 @@ export declare function canonicalRequest(request: RecipeExecutionRequest): strin
35
35
  * fingerprinted, so the key matches exactly what the parent re-sends on retry.
36
36
  */
37
37
  export declare function fingerprintRequest(request: RecipeExecutionRequest): Promise<string>;
38
- //# sourceMappingURL=fingerprint.d.ts.map
@@ -36,8 +36,13 @@ export function canonicalRequest(request) {
36
36
  recipe: {
37
37
  key: request.recipe.key,
38
38
  version: request.recipe.version,
39
- primaryModelId: request.recipe.primaryModelId,
40
- fallbackModelId: request.recipe.fallbackModelId,
39
+ // No model ids. They used to be hashed because a recipe declared them;
40
+ // it no longer can, and their absence here is the same trade this file
41
+ // already makes for `limits`: the host's own configuration stays out of
42
+ // the fingerprint, so changing it does not invalidate every checkpoint at
43
+ // once and restart every in-flight run from turn zero with its budget
44
+ // already spent. A run that resumes on a newly configured model resumes
45
+ // from conversation state, which is model-independent.
41
46
  soul: request.recipe.soul,
42
47
  toolFamilies: request.recipe.toolFamilies,
43
48
  enabled: request.recipe.enabled,
@@ -94,4 +99,3 @@ export async function fingerprintRequest(request) {
94
99
  .map((b) => b.toString(16).padStart(2, "0"))
95
100
  .join("");
96
101
  }
97
- //# sourceMappingURL=fingerprint.js.map
@@ -144,4 +144,3 @@ export declare abstract class RecipeSubagentBase<TEnv extends Cloudflare.Env = C
144
144
  /** Persist the rolling run state (called after every model turn). */
145
145
  private saveRunState;
146
146
  }
147
- //# sourceMappingURL=index.d.ts.map
@@ -296,4 +296,3 @@ function mismatch(phase) {
296
296
  "different request; the parent must delete a stale child before starting a " +
297
297
  "genuinely new execution");
298
298
  }
299
- //# sourceMappingURL=index.js.map
@@ -31,4 +31,3 @@ export interface RenderedInvocation {
31
31
  * content are omitted entirely.
32
32
  */
33
33
  export declare function renderSubagentPrompt(request: RenderableExecution): RenderedInvocation;
34
- //# sourceMappingURL=prompt.d.ts.map
@@ -43,4 +43,3 @@ export function renderSubagentPrompt(request) {
43
43
  }
44
44
  return { system: request.recipe.soul, prompt: sections.join("\n\n") };
45
45
  }
46
- //# sourceMappingURL=prompt.js.map
@@ -148,4 +148,3 @@ export interface RecipeRunDeps {
148
148
  * Throws only on a transient platform fault (as {@link runResumableChunk} does).
149
149
  */
150
150
  export declare function runRecipeExecution(request: RecipeExecutionRequest, deps: RecipeRunDeps): Promise<RecipeExecutionResult>;
151
- //# sourceMappingURL=run.d.ts.map
@@ -488,4 +488,3 @@ export async function runRecipeExecution(request, deps) {
488
488
  modelId: null
489
489
  };
490
490
  }
491
- //# sourceMappingURL=run.js.map
@@ -83,4 +83,3 @@ export declare class WorkspaceLimitError extends Error {
83
83
  * fill storage.
84
84
  */
85
85
  export declare function makeWorkspaceHandle(ws: WorkspaceBacking): WorkspaceHandle;
86
- //# sourceMappingURL=workspace.d.ts.map
@@ -125,4 +125,3 @@ export function makeWorkspaceHandle(ws) {
125
125
  }
126
126
  };
127
127
  }
128
- //# sourceMappingURL=workspace.js.map
@@ -38,4 +38,3 @@ export interface ReferenceCatalogEntry extends SubtaskReference {
38
38
  * flight.
39
39
  */
40
40
  export declare function isCatalogEligible(message: SessionMessage): boolean;
41
- //# sourceMappingURL=catalog.d.ts.map
@@ -34,4 +34,3 @@ export function isCatalogEligible(message) {
34
34
  return false;
35
35
  return sessionText(message).trim().length > 0;
36
36
  }
37
- //# sourceMappingURL=catalog.js.map
@@ -87,4 +87,3 @@ export declare function resolveDecomposition(proposal: DecompositionProposal, ca
87
87
  reply: string;
88
88
  drafts: SubtaskDraft[];
89
89
  };
90
- //# sourceMappingURL=decomposition.d.ts.map
@@ -202,4 +202,3 @@ export function resolveDecomposition(proposal, catalog, types) {
202
202
  });
203
203
  return { reply: proposal.reply.trim(), drafts };
204
204
  }
205
- //# sourceMappingURL=decomposition.js.map
@@ -75,4 +75,3 @@ export type DelegateSubtaskOutcome = {
75
75
  export declare function delegateCallInput(reply: string, branches: CompositionBranch[]): DecompositionProposal;
76
76
  /** Rebuild one round's call result from its durable rows, in stable ordinal order. */
77
77
  export declare function delegateCallOutput(branches: CompositionBranch[]): DelegateSubtaskOutcome[];
78
- //# sourceMappingURL=delegate.d.ts.map
@@ -100,4 +100,3 @@ export function delegateCallOutput(branches) {
100
100
  : null
101
101
  }));
102
102
  }
103
- //# sourceMappingURL=delegate.js.map
@@ -8,4 +8,3 @@ export { DELEGATE_TOOL_NAME, makeDelegateTool, delegateToolCallId, delegateCallI
8
8
  export { selectWave, type WaveDecision } from "./scheduler.js";
9
9
  export { isCatalogEligible, type ReferenceCatalogEntry } from "./catalog.js";
10
10
  export * from "./types.js";
11
- //# sourceMappingURL=index.d.ts.map
@@ -8,4 +8,3 @@ export { DELEGATE_TOOL_NAME, makeDelegateTool, delegateToolCallId, delegateCallI
8
8
  export { selectWave } from "./scheduler.js";
9
9
  export { isCatalogEligible } from "./catalog.js";
10
10
  export * from "./types.js";
11
- //# sourceMappingURL=index.js.map
@@ -46,4 +46,3 @@ export type WaveDecision =
46
46
  * and not three detectors that can never fire.
47
47
  */
48
48
  export declare function selectWave(nodes: SubtaskNode[]): WaveDecision;
49
- //# sourceMappingURL=scheduler.d.ts.map
@@ -45,4 +45,3 @@ export function selectWave(nodes) {
45
45
  return { kind: "stuck", active: active.map((n) => n.id) };
46
46
  return { kind: "ready", ids: ready };
47
47
  }
48
- //# sourceMappingURL=scheduler.js.map
@@ -97,4 +97,3 @@ export interface SubtaskTypeRegistry {
97
97
  * routed to the wrong domain.
98
98
  */
99
99
  export declare function makeSubtaskTypes(specs: readonly SubtaskTypeSpec[]): SubtaskTypeRegistry;
100
- //# sourceMappingURL=subtask-types.d.ts.map
@@ -108,4 +108,3 @@ export function makeSubtaskTypes(specs) {
108
108
  }
109
109
  };
110
110
  }
111
- //# sourceMappingURL=subtask-types.js.map
@@ -318,4 +318,3 @@ export interface Subtask {
318
318
  completedAt: number | null;
319
319
  }
320
320
  export {};
321
- //# sourceMappingURL=types.d.ts.map
@@ -13,4 +13,3 @@
13
13
  export function runtimeAs(runtime) {
14
14
  return runtime;
15
15
  }
16
- //# sourceMappingURL=types.js.map
@@ -32,4 +32,3 @@ export interface GatewayTokenOptions {
32
32
  export declare const TEST_TENANT = "main";
33
33
  /** Sign a short-lived EdDSA gateway JWT using the test gateway key. */
34
34
  export declare function makeGatewayToken(options?: GatewayTokenOptions): Promise<string>;
35
- //# sourceMappingURL=auth.d.ts.map
@@ -33,4 +33,3 @@ export async function makeGatewayToken(options = {}) {
33
33
  .setExpirationTime(options.expiresIn ?? "5m")
34
34
  .sign(privateKey));
35
35
  }
36
- //# sourceMappingURL=auth.js.map
@@ -27,4 +27,3 @@ export declare function doStorage(instance: unknown): DurableObjectStorage;
27
27
  * ```
28
28
  */
29
29
  export declare function makeDoHelpers(ns: DurableObjectNamespace, defaults?: AgentDBOptions): DoTestHelpers;
30
- //# sourceMappingURL=do.d.ts.map
@@ -23,4 +23,3 @@ export function makeDoHelpers(ns, defaults = { maxSubtasks: 8 }) {
23
23
  }
24
24
  };
25
25
  }
26
- //# sourceMappingURL=do.js.map
@@ -24,4 +24,3 @@ export declare class FakeSession implements SessionLike {
24
24
  tools(): Promise<ToolSet>;
25
25
  getCompactions(): Promise<unknown[]>;
26
26
  }
27
- //# sourceMappingURL=fake-session.d.ts.map
@@ -35,4 +35,3 @@ export class FakeSession {
35
35
  return this.compactions;
36
36
  }
37
37
  }
38
- //# sourceMappingURL=fake-session.js.map
@@ -62,4 +62,3 @@ export declare function testStatus(state: TaskState, message?: Message): NonNull
62
62
  export declare function testAgentMessage(messageId: string, text: string, contextId?: string, taskId?: string): Message;
63
63
  /** A complete v1.0 `Task` in the given state. */
64
64
  export declare function testTask(id: string, contextId: string, state: TaskState, message?: Message): Task;
65
- //# sourceMappingURL=fixtures.d.ts.map
@@ -102,4 +102,3 @@ export function testTask(id, contextId, state, message) {
102
102
  metadata: undefined
103
103
  };
104
104
  }
105
- //# sourceMappingURL=fixtures.js.map
@@ -95,4 +95,3 @@ export interface AgentHarness {
95
95
  readonly callbacks: CapturedCallback[];
96
96
  }
97
97
  export declare function createAgentHarness<TEnv>(options: AgentHarnessOptions<TEnv>): AgentHarness;
98
- //# sourceMappingURL=harness.d.ts.map
@@ -136,4 +136,3 @@ export function createAgentHarness(options) {
136
136
  }
137
137
  };
138
138
  }
139
- //# sourceMappingURL=harness.js.map
@@ -29,4 +29,3 @@ export { makeGatewayToken, type GatewayTokenOptions } from "./auth.js";
29
29
  export { AGENT_ORIGIN, GATEWAY_ORIGIN, TEST_AGENT_PRIVATE_JWK, TEST_GATEWAY_PRIVATE_JWK, TEST_MODELS, gatewayPublicJwks, testAgentMessage, testStatus, testTask } from "./fixtures.js";
30
30
  export { doStorage, makeDoHelpers, type DoTestHelpers } from "./do.js";
31
31
  export { createAgentHarness, type AgentHarness, type AgentHarnessOptions, type CapturedCallback, type HarnessWorker } from "./harness.js";
32
- //# sourceMappingURL=index.d.ts.map
@@ -29,4 +29,3 @@ export { makeGatewayToken } from "./auth.js";
29
29
  export { AGENT_ORIGIN, GATEWAY_ORIGIN, TEST_AGENT_PRIVATE_JWK, TEST_GATEWAY_PRIVATE_JWK, TEST_MODELS, gatewayPublicJwks, testAgentMessage, testStatus, testTask } from "./fixtures.js";
30
30
  export { doStorage, makeDoHelpers } from "./do.js";
31
31
  export { createAgentHarness } from "./harness.js";
32
- //# sourceMappingURL=index.js.map
@@ -40,4 +40,3 @@ export declare function finalReply(text: string, opts?: {
40
40
  * last step.
41
41
  */
42
42
  export declare function mockModel(...steps: MockStep[]): MockLanguageModelV3;
43
- //# sourceMappingURL=mock-model.d.ts.map
@@ -59,4 +59,3 @@ export function mockModel(...steps) {
59
59
  doGenerate: async () => stepResult(steps[Math.min(i++, steps.length - 1)])
60
60
  });
61
61
  }
62
- //# sourceMappingURL=mock-model.js.map
@@ -54,4 +54,3 @@
54
54
  export { createVcr, recordFromEnv, closeVcr, type Vcr, type VcrOptions, type VcrRequest, type VcrRequestHeaders, type VcrOutboundService } from "./vcr.js";
55
55
  export { Cassette, requestKey, replayable, type CassetteEntry, type CassetteOptions, type RecordedRequest, type RecordedResponse, type ReplayableResponse } from "./vcr-store.js";
56
56
  export { VCR_CONTROL_ORIGIN, VCR_MARKER_HEADER, CASSETTE_NAME_RE, type VcrReleaseResult } from "./vcr-shared.js";
57
- //# sourceMappingURL=node.d.ts.map
@@ -54,4 +54,3 @@
54
54
  export { createVcr, recordFromEnv, closeVcr } from "./vcr.js";
55
55
  export { Cassette, requestKey, replayable } from "./vcr-store.js";
56
56
  export { VCR_CONTROL_ORIGIN, VCR_MARKER_HEADER, CASSETTE_NAME_RE } from "./vcr-shared.js";
57
- //# sourceMappingURL=node.js.map
@@ -12,4 +12,3 @@
12
12
  */
13
13
  export declare function setup(): void;
14
14
  export declare function teardown(): Promise<void>;
15
- //# sourceMappingURL=vcr-global-setup.d.ts.map