@loopingai/core 0.5.0 → 0.6.0

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 (304) hide show
  1. package/README.md +6 -4
  2. package/dist/a2a/agent-stub.d.ts +0 -1
  3. package/dist/a2a/agent-stub.js +0 -1
  4. package/dist/a2a/caller.d.ts +0 -1
  5. package/dist/a2a/caller.js +0 -1
  6. package/dist/a2a/card.d.ts +0 -1
  7. package/dist/a2a/card.js +0 -1
  8. package/dist/a2a/context.d.ts +0 -1
  9. package/dist/a2a/context.js +0 -1
  10. package/dist/a2a/executor.d.ts +0 -1
  11. package/dist/a2a/executor.js +0 -1
  12. package/dist/a2a/index.d.ts +0 -1
  13. package/dist/a2a/index.js +0 -1
  14. package/dist/a2a/notify.d.ts +4 -4
  15. package/dist/a2a/notify.js +4 -4
  16. package/dist/a2a/parts.d.ts +0 -1
  17. package/dist/a2a/parts.js +0 -1
  18. package/dist/a2a/push.d.ts +0 -1
  19. package/dist/a2a/push.js +0 -1
  20. package/dist/a2a/task-store.d.ts +0 -1
  21. package/dist/a2a/task-store.js +0 -1
  22. package/dist/a2a/task.d.ts +0 -1
  23. package/dist/a2a/task.js +0 -1
  24. package/dist/a2a/verify.d.ts +0 -1
  25. package/dist/a2a/verify.js +0 -1
  26. package/dist/agent/anthropic/index.d.ts +15 -0
  27. package/dist/agent/anthropic/index.js +19 -0
  28. package/dist/agent/anthropic/language-model.d.ts +59 -0
  29. package/dist/agent/anthropic/language-model.js +442 -0
  30. package/dist/agent/anthropic/prompt.d.ts +84 -0
  31. package/dist/agent/anthropic/prompt.js +541 -0
  32. package/dist/agent/anthropic/runtime.d.ts +79 -0
  33. package/dist/agent/anthropic/runtime.js +130 -0
  34. package/dist/agent/budget.d.ts +0 -1
  35. package/dist/agent/budget.js +0 -1
  36. package/dist/agent/control.d.ts +0 -1
  37. package/dist/agent/control.js +10 -10
  38. package/dist/agent/errors.d.ts +85 -0
  39. package/dist/agent/errors.js +64 -0
  40. package/dist/agent/final-reply.d.ts +14 -14
  41. package/dist/agent/final-reply.js +28 -12
  42. package/dist/agent/history.d.ts +3 -4
  43. package/dist/agent/history.js +2 -3
  44. package/dist/agent/index.d.ts +4 -3
  45. package/dist/agent/index.js +4 -3
  46. package/dist/agent/inference.d.ts +58 -2
  47. package/dist/agent/inference.js +44 -1
  48. package/dist/agent/model.d.ts +42 -26
  49. package/dist/agent/model.js +1 -49
  50. package/dist/agent/session.d.ts +6 -8
  51. package/dist/agent/session.js +3 -4
  52. package/dist/agent/workers-ai/index.d.ts +23 -0
  53. package/dist/agent/workers-ai/index.js +23 -0
  54. package/dist/agent/workers-ai/runtime.d.ts +42 -0
  55. package/dist/agent/workers-ai/runtime.js +63 -0
  56. package/dist/config.d.ts +49 -16
  57. package/dist/config.js +30 -2
  58. package/dist/contract/index.d.ts +0 -1
  59. package/dist/contract/index.js +0 -1
  60. package/dist/contract/plugin.d.ts +63 -4
  61. package/dist/contract/plugin.js +76 -1
  62. package/dist/contract/recipe.d.ts +16 -18
  63. package/dist/contract/recipe.js +0 -1
  64. package/dist/contract/validation.d.ts +0 -1
  65. package/dist/contract/validation.js +0 -1
  66. package/dist/db/db.d.ts +0 -2
  67. package/dist/db/db.js +0 -1
  68. package/dist/db/index.d.ts +0 -1
  69. package/dist/db/index.js +0 -1
  70. package/dist/db/migrations/index.d.ts +0 -1
  71. package/dist/db/migrations/index.js +8 -2
  72. package/dist/db/models/subtasks.d.ts +24 -26
  73. package/dist/db/models/subtasks.js +33 -77
  74. package/dist/db/models/tasks.d.ts +0 -1
  75. package/dist/db/models/tasks.js +0 -1
  76. package/dist/db/schema.d.ts +2 -22
  77. package/dist/db/schema.js +2 -5
  78. package/dist/env.d.ts +0 -1
  79. package/dist/env.js +0 -1
  80. package/dist/host/agent.d.ts +58 -5
  81. package/dist/host/agent.js +63 -10
  82. package/dist/host/index.d.ts +0 -1
  83. package/dist/host/index.js +0 -1
  84. package/dist/host/plugin-host.d.ts +0 -1
  85. package/dist/host/plugin-host.js +0 -1
  86. package/dist/index.d.ts +2 -3
  87. package/dist/index.js +2 -3
  88. package/dist/platform.d.ts +74 -12
  89. package/dist/platform.js +76 -14
  90. package/dist/round/agent.d.ts +36 -32
  91. package/dist/round/agent.js +61 -90
  92. package/dist/round/index.d.ts +3 -3
  93. package/dist/round/index.js +2 -3
  94. package/dist/round/policy.d.ts +2 -3
  95. package/dist/round/policy.js +0 -1
  96. package/dist/round/subagent.d.ts +19 -2
  97. package/dist/round/subagent.js +22 -6
  98. package/dist/round/turn.d.ts +32 -14
  99. package/dist/round/turn.js +83 -17
  100. package/dist/round/workflow.d.ts +30 -9
  101. package/dist/round/workflow.js +146 -78
  102. package/dist/runtime/index.d.ts +4 -3
  103. package/dist/runtime/index.js +6 -1
  104. package/dist/runtime/tool-families.d.ts +0 -1
  105. package/dist/runtime/tool-families.js +0 -1
  106. package/dist/subagent/fingerprint.d.ts +2 -3
  107. package/dist/subagent/fingerprint.js +8 -18
  108. package/dist/subagent/index.d.ts +6 -5
  109. package/dist/subagent/index.js +8 -7
  110. package/dist/subagent/prompt.d.ts +4 -6
  111. package/dist/subagent/prompt.js +0 -9
  112. package/dist/subagent/run.d.ts +8 -2
  113. package/dist/subagent/run.js +59 -10
  114. package/dist/subagent/workspace.d.ts +0 -1
  115. package/dist/subagent/workspace.js +0 -1
  116. package/dist/subtasks/catalog.d.ts +1 -2
  117. package/dist/subtasks/catalog.js +1 -2
  118. package/dist/subtasks/decomposition.d.ts +16 -21
  119. package/dist/subtasks/decomposition.js +27 -76
  120. package/dist/subtasks/delegate.d.ts +20 -2
  121. package/dist/subtasks/delegate.js +21 -17
  122. package/dist/subtasks/index.d.ts +1 -3
  123. package/dist/subtasks/index.js +1 -3
  124. package/dist/subtasks/subtask-types.d.ts +0 -9
  125. package/dist/subtasks/subtask-types.js +0 -8
  126. package/dist/subtasks/types.d.ts +45 -71
  127. package/dist/subtasks/types.js +0 -1
  128. package/dist/testing/auth.d.ts +0 -1
  129. package/dist/testing/auth.js +0 -1
  130. package/dist/testing/do.d.ts +0 -1
  131. package/dist/testing/do.js +0 -1
  132. package/dist/testing/fake-session.d.ts +0 -1
  133. package/dist/testing/fake-session.js +0 -1
  134. package/dist/testing/fixtures.d.ts +0 -1
  135. package/dist/testing/fixtures.js +0 -1
  136. package/dist/testing/harness.d.ts +0 -1
  137. package/dist/testing/harness.js +0 -1
  138. package/dist/testing/index.d.ts +0 -1
  139. package/dist/testing/index.js +0 -1
  140. package/dist/testing/mock-model.d.ts +35 -1
  141. package/dist/testing/mock-model.js +75 -1
  142. package/dist/testing/node.d.ts +0 -1
  143. package/dist/testing/node.js +0 -1
  144. package/dist/testing/vcr-global-setup.d.ts +1 -4
  145. package/dist/testing/vcr-global-setup.js +1 -4
  146. package/dist/testing/vcr-shared.d.ts +0 -1
  147. package/dist/testing/vcr-shared.js +0 -1
  148. package/dist/testing/vcr-spec.d.ts +0 -1
  149. package/dist/testing/vcr-spec.js +0 -1
  150. package/dist/testing/vcr-store.d.ts +0 -1
  151. package/dist/testing/vcr-store.js +0 -1
  152. package/dist/testing/vcr.d.ts +0 -1
  153. package/dist/testing/vcr.js +0 -1
  154. package/dist/worker/define-agent.d.ts +0 -1
  155. package/dist/worker/define-agent.js +0 -1
  156. package/dist/worker/index.d.ts +5 -13
  157. package/dist/worker/index.js +5 -13
  158. package/package.json +20 -2
  159. package/dist/a2a/agent-stub.d.ts.map +0 -1
  160. package/dist/a2a/agent-stub.js.map +0 -1
  161. package/dist/a2a/caller.d.ts.map +0 -1
  162. package/dist/a2a/caller.js.map +0 -1
  163. package/dist/a2a/card.d.ts.map +0 -1
  164. package/dist/a2a/card.js.map +0 -1
  165. package/dist/a2a/context.d.ts.map +0 -1
  166. package/dist/a2a/context.js.map +0 -1
  167. package/dist/a2a/executor.d.ts.map +0 -1
  168. package/dist/a2a/executor.js.map +0 -1
  169. package/dist/a2a/index.d.ts.map +0 -1
  170. package/dist/a2a/index.js.map +0 -1
  171. package/dist/a2a/notify.d.ts.map +0 -1
  172. package/dist/a2a/notify.js.map +0 -1
  173. package/dist/a2a/parts.d.ts.map +0 -1
  174. package/dist/a2a/parts.js.map +0 -1
  175. package/dist/a2a/push.d.ts.map +0 -1
  176. package/dist/a2a/push.js.map +0 -1
  177. package/dist/a2a/task-store.d.ts.map +0 -1
  178. package/dist/a2a/task-store.js.map +0 -1
  179. package/dist/a2a/task.d.ts.map +0 -1
  180. package/dist/a2a/task.js.map +0 -1
  181. package/dist/a2a/verify.d.ts.map +0 -1
  182. package/dist/a2a/verify.js.map +0 -1
  183. package/dist/agent/budget.d.ts.map +0 -1
  184. package/dist/agent/budget.js.map +0 -1
  185. package/dist/agent/control.d.ts.map +0 -1
  186. package/dist/agent/control.js.map +0 -1
  187. package/dist/agent/final-reply.d.ts.map +0 -1
  188. package/dist/agent/final-reply.js.map +0 -1
  189. package/dist/agent/history.d.ts.map +0 -1
  190. package/dist/agent/history.js.map +0 -1
  191. package/dist/agent/index.d.ts.map +0 -1
  192. package/dist/agent/index.js.map +0 -1
  193. package/dist/agent/inference.d.ts.map +0 -1
  194. package/dist/agent/inference.js.map +0 -1
  195. package/dist/agent/model.d.ts.map +0 -1
  196. package/dist/agent/model.js.map +0 -1
  197. package/dist/agent/session.d.ts.map +0 -1
  198. package/dist/agent/session.js.map +0 -1
  199. package/dist/config.d.ts.map +0 -1
  200. package/dist/config.js.map +0 -1
  201. package/dist/contract/index.d.ts.map +0 -1
  202. package/dist/contract/index.js.map +0 -1
  203. package/dist/contract/plugin.d.ts.map +0 -1
  204. package/dist/contract/plugin.js.map +0 -1
  205. package/dist/contract/recipe.d.ts.map +0 -1
  206. package/dist/contract/recipe.js.map +0 -1
  207. package/dist/contract/validation.d.ts.map +0 -1
  208. package/dist/contract/validation.js.map +0 -1
  209. package/dist/db/db.d.ts.map +0 -1
  210. package/dist/db/db.js.map +0 -1
  211. package/dist/db/index.d.ts.map +0 -1
  212. package/dist/db/index.js.map +0 -1
  213. package/dist/db/migrations/index.d.ts.map +0 -1
  214. package/dist/db/migrations/index.js.map +0 -1
  215. package/dist/db/models/subtasks.d.ts.map +0 -1
  216. package/dist/db/models/subtasks.js.map +0 -1
  217. package/dist/db/models/tasks.d.ts.map +0 -1
  218. package/dist/db/models/tasks.js.map +0 -1
  219. package/dist/db/schema.d.ts.map +0 -1
  220. package/dist/db/schema.js.map +0 -1
  221. package/dist/env.d.ts.map +0 -1
  222. package/dist/env.js.map +0 -1
  223. package/dist/host/agent.d.ts.map +0 -1
  224. package/dist/host/agent.js.map +0 -1
  225. package/dist/host/index.d.ts.map +0 -1
  226. package/dist/host/index.js.map +0 -1
  227. package/dist/host/plugin-host.d.ts.map +0 -1
  228. package/dist/host/plugin-host.js.map +0 -1
  229. package/dist/index.d.ts.map +0 -1
  230. package/dist/index.js.map +0 -1
  231. package/dist/platform.d.ts.map +0 -1
  232. package/dist/platform.js.map +0 -1
  233. package/dist/round/agent.d.ts.map +0 -1
  234. package/dist/round/agent.js.map +0 -1
  235. package/dist/round/index.d.ts.map +0 -1
  236. package/dist/round/index.js.map +0 -1
  237. package/dist/round/policy.d.ts.map +0 -1
  238. package/dist/round/policy.js.map +0 -1
  239. package/dist/round/subagent.d.ts.map +0 -1
  240. package/dist/round/subagent.js.map +0 -1
  241. package/dist/round/turn.d.ts.map +0 -1
  242. package/dist/round/turn.js.map +0 -1
  243. package/dist/round/workflow.d.ts.map +0 -1
  244. package/dist/round/workflow.js.map +0 -1
  245. package/dist/runtime/index.d.ts.map +0 -1
  246. package/dist/runtime/index.js.map +0 -1
  247. package/dist/runtime/tool-families.d.ts.map +0 -1
  248. package/dist/runtime/tool-families.js.map +0 -1
  249. package/dist/subagent/fingerprint.d.ts.map +0 -1
  250. package/dist/subagent/fingerprint.js.map +0 -1
  251. package/dist/subagent/index.d.ts.map +0 -1
  252. package/dist/subagent/index.js.map +0 -1
  253. package/dist/subagent/prompt.d.ts.map +0 -1
  254. package/dist/subagent/prompt.js.map +0 -1
  255. package/dist/subagent/run.d.ts.map +0 -1
  256. package/dist/subagent/run.js.map +0 -1
  257. package/dist/subagent/workspace.d.ts.map +0 -1
  258. package/dist/subagent/workspace.js.map +0 -1
  259. package/dist/subtasks/catalog.d.ts.map +0 -1
  260. package/dist/subtasks/catalog.js.map +0 -1
  261. package/dist/subtasks/decomposition.d.ts.map +0 -1
  262. package/dist/subtasks/decomposition.js.map +0 -1
  263. package/dist/subtasks/delegate.d.ts.map +0 -1
  264. package/dist/subtasks/delegate.js.map +0 -1
  265. package/dist/subtasks/index.d.ts.map +0 -1
  266. package/dist/subtasks/index.js.map +0 -1
  267. package/dist/subtasks/scheduler.d.ts +0 -49
  268. package/dist/subtasks/scheduler.d.ts.map +0 -1
  269. package/dist/subtasks/scheduler.js +0 -48
  270. package/dist/subtasks/scheduler.js.map +0 -1
  271. package/dist/subtasks/subtask-types.d.ts.map +0 -1
  272. package/dist/subtasks/subtask-types.js.map +0 -1
  273. package/dist/subtasks/types.d.ts.map +0 -1
  274. package/dist/subtasks/types.js.map +0 -1
  275. package/dist/testing/auth.d.ts.map +0 -1
  276. package/dist/testing/auth.js.map +0 -1
  277. package/dist/testing/do.d.ts.map +0 -1
  278. package/dist/testing/do.js.map +0 -1
  279. package/dist/testing/fake-session.d.ts.map +0 -1
  280. package/dist/testing/fake-session.js.map +0 -1
  281. package/dist/testing/fixtures.d.ts.map +0 -1
  282. package/dist/testing/fixtures.js.map +0 -1
  283. package/dist/testing/harness.d.ts.map +0 -1
  284. package/dist/testing/harness.js.map +0 -1
  285. package/dist/testing/index.d.ts.map +0 -1
  286. package/dist/testing/index.js.map +0 -1
  287. package/dist/testing/mock-model.d.ts.map +0 -1
  288. package/dist/testing/mock-model.js.map +0 -1
  289. package/dist/testing/node.d.ts.map +0 -1
  290. package/dist/testing/node.js.map +0 -1
  291. package/dist/testing/vcr-global-setup.d.ts.map +0 -1
  292. package/dist/testing/vcr-global-setup.js.map +0 -1
  293. package/dist/testing/vcr-shared.d.ts.map +0 -1
  294. package/dist/testing/vcr-shared.js.map +0 -1
  295. package/dist/testing/vcr-spec.d.ts.map +0 -1
  296. package/dist/testing/vcr-spec.js.map +0 -1
  297. package/dist/testing/vcr-store.d.ts.map +0 -1
  298. package/dist/testing/vcr-store.js.map +0 -1
  299. package/dist/testing/vcr.d.ts.map +0 -1
  300. package/dist/testing/vcr.js.map +0 -1
  301. package/dist/worker/define-agent.d.ts.map +0 -1
  302. package/dist/worker/define-agent.js.map +0 -1
  303. package/dist/worker/index.d.ts.map +0 -1
  304. package/dist/worker/index.js.map +0 -1
package/README.md CHANGED
@@ -188,8 +188,8 @@ probed for), and hand-rolling it is how two agents in one repo drift apart.
188
188
 
189
189
  ### 4. Delegate, if your agent delegates
190
190
 
191
- `@loopingai/core/round` adds the other half: a durable Subtask DAG, wave
192
- scheduling, isolated subagent execution, and the round loop over them.
191
+ `@loopingai/core/round` adds the other half: durable Subtasks, concurrent
192
+ execution, isolated subagents, and the round loop over them.
193
193
 
194
194
  ```ts
195
195
  import { RoundAgentBase, type RoundPolicy } from "@loopingai/core/round";
@@ -225,10 +225,11 @@ not drag in the A2A adapter, and the test harness cannot reach a production bund
225
225
  | `@loopingai/core` | `createAgentRuntime`, the plugin contract, config shapes, platform facts |
226
226
  | `@loopingai/core/a2a` | card signing, JWKS, gateway-JWT verify, push notify, task store, executor |
227
227
  | `@loopingai/core/worker` | `createA2AWorker()` — the whole zero-trust edge |
228
- | `@loopingai/core/agent` | session, history, model runtime, inference, budget, control tools |
228
+ | `@loopingai/core/agent` | session, history, models + Workers AI, inference, budget, control tools |
229
229
  | `@loopingai/core/host` | `LoopingAgent` — the Durable Object body — and `PluginHost` |
230
230
  | `@loopingai/core/round` | the delegating round loop: `RoundAgentBase`, `runHandleTask`, `runTurn` |
231
- | `@loopingai/core/subtasks` | delegation types, decomposition, the `delegate` tool, wave scheduler |
231
+ | `@loopingai/core/anthropic` | Claude as a second provider _optional peer on `@anthropic-ai/sdk`_ |
232
+ | `@loopingai/core/subtasks` | delegation types, decomposition, the `delegate` tool |
232
233
  | `@loopingai/core/subagent` | `RecipeSubagentBase`, resumable runs, fingerprinting, workspace |
233
234
  | `@loopingai/core/db` | `AgentDB`, `notify_tasks` + `subtasks` schema, migrations, `PluginStore` |
234
235
  | `@loopingai/core/testing` | VCR, `FakeSession`, `mockModel`, DO helpers, JWK fixtures — _workerd realm_ |
@@ -465,6 +466,7 @@ await withDb("accepts a turn once", async (db) => {
465
466
  - **Bindings:** `AI`, one Durable Object, one Workflow
466
467
  - **Secrets:** `A2A_SIGNING_KEY`, `GATEWAY_ORIGINS`
467
468
  - **Peers, never bundled:** `agents`, `ai`, `workers-ai-provider`
469
+ - **Optional peer:** `@anthropic-ai/sdk`, needed only by `@loopingai/core/anthropic`
468
470
 
469
471
  That last point is not stylistic: two copies of `agents` in one Worker breaks the
470
472
  `Session` / `SessionMessage` types and every `instanceof`. For local development
@@ -58,4 +58,3 @@ export interface TaskListPage {
58
58
  * what makes a task unreachable from any other caller by construction.
59
59
  */
60
60
  export type AgentResolver = (identity: GatewayIdentity) => TaskAgent;
61
- //# sourceMappingURL=agent-stub.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=agent-stub.js.map
@@ -21,4 +21,3 @@ import type { GatewayIdentity } from "./verify.js";
21
21
  * wants to name it.
22
22
  */
23
23
  export declare function callerContext(identity: GatewayIdentity): string;
24
- //# sourceMappingURL=caller.d.ts.map
@@ -31,4 +31,3 @@ export function callerContext(identity) {
31
31
  }
32
32
  return lines.join("\n");
33
33
  }
34
- //# sourceMappingURL=caller.js.map
@@ -156,4 +156,3 @@ export declare function publicCardJwks(privateJwk: JWK & {
156
156
  }): {
157
157
  keys: JWK[];
158
158
  };
159
- //# sourceMappingURL=card.d.ts.map
package/dist/a2a/card.js CHANGED
@@ -159,4 +159,3 @@ export function publicCardJwks(privateJwk) {
159
159
  void _d;
160
160
  return { keys: [{ ...pub, use: "sig", alg: A2A_JWS_ALG }] };
161
161
  }
162
- //# sourceMappingURL=card.js.map
@@ -17,4 +17,3 @@ import type { GatewayIdentity } from "./verify.js";
17
17
  export declare function buildCallContext(request: Request, identity: GatewayIdentity, tenant: string): ServerCallContext;
18
18
  /** Echo back the extensions the handler actually activated (spec §14.2.2). */
19
19
  export declare function extensionHeaders(context: ServerCallContext): HeadersInit;
20
- //# sourceMappingURL=context.d.ts.map
@@ -59,4 +59,3 @@ export function extensionHeaders(context) {
59
59
  return {};
60
60
  return { [HTTP_EXTENSION_HEADER]: Extensions.toServiceParameter(activated) };
61
61
  }
62
- //# sourceMappingURL=context.js.map
@@ -82,4 +82,3 @@ export declare class A2AExecutor implements AgentExecutor {
82
82
  */
83
83
  cancelTask: (taskId: string, eventBus: ExecutionEventBus) => Promise<void>;
84
84
  }
85
- //# sourceMappingURL=executor.d.ts.map
@@ -104,4 +104,3 @@ export class A2AExecutor {
104
104
  eventBus.finished();
105
105
  };
106
106
  }
107
- //# sourceMappingURL=executor.js.map
@@ -30,4 +30,3 @@ export { buildCallContext, extensionHeaders } from "./context.js";
30
30
  export { DurableTaskStore } from "./task-store.js";
31
31
  export { A2AExecutor, workflowIdForMessage, ignoreAlreadyExists, type AcceptedTurn, type ExecutorConfig, type TurnStarter } from "./executor.js";
32
32
  export type { AgentResolver, TaskAgent, TaskListPage, TaskListQuery } from "./agent-stub.js";
33
- //# sourceMappingURL=index.d.ts.map
package/dist/a2a/index.js CHANGED
@@ -29,4 +29,3 @@ export { textPart, partsText, textOf, agentTextMessage, inboundText, InboundPart
29
29
  export { buildCallContext, extensionHeaders } from "./context.js";
30
30
  export { DurableTaskStore } from "./task-store.js";
31
31
  export { A2AExecutor, workflowIdForMessage, ignoreAlreadyExists } from "./executor.js";
32
- //# sourceMappingURL=index.js.map
@@ -37,9 +37,10 @@ export { NOTIFICATION_TOKEN_HEADER } from "@loopingai/a2a-protocol";
37
37
  */
38
38
  export declare function buildSubmittedTask(taskId: string, contextId: string): PlainTask;
39
39
  /**
40
- * The terminal `completed` Task for a turn the agent deliberately did not answer
41
- * (it called the `no_reply` tool see the agent loop). Same
42
- * shape as {@link buildSubmittedTask}: **no `status.message` at all**.
40
+ * The terminal `completed` Task for a turn the agent deliberately did not
41
+ * answer a turn an `AgentPlugin.shouldHandleTurn` gate declined, or whatever
42
+ * else a host treats as "nothing to say". Same shape as
43
+ * {@link buildSubmittedTask}: **no `status.message` at all**.
43
44
  *
44
45
  * The callback is still POSTed. The gateway's pending row has to resolve — we
45
46
  * simply hand it nothing to post to Slack. There is no `messageId` because there
@@ -103,4 +104,3 @@ export declare function signCallbackJwt(privateJwk: JWK & {
103
104
  * workflow's `notify` step) can decide whether a non-2xx warrants a retry.
104
105
  */
105
106
  export declare function postNotification(url: string, token: string, jwt: string, task: Task): Promise<Response>;
106
- //# sourceMappingURL=notify.d.ts.map
@@ -69,9 +69,10 @@ export function buildSubmittedTask(taskId, contextId) {
69
69
  return buildBareTask(taskId, contextId, TaskState.TASK_STATE_SUBMITTED);
70
70
  }
71
71
  /**
72
- * The terminal `completed` Task for a turn the agent deliberately did not answer
73
- * (it called the `no_reply` tool see the agent loop). Same
74
- * shape as {@link buildSubmittedTask}: **no `status.message` at all**.
72
+ * The terminal `completed` Task for a turn the agent deliberately did not
73
+ * answer a turn an `AgentPlugin.shouldHandleTurn` gate declined, or whatever
74
+ * else a host treats as "nothing to say". Same shape as
75
+ * {@link buildSubmittedTask}: **no `status.message` at all**.
75
76
  *
76
77
  * The callback is still POSTed. The gateway's pending row has to resolve — we
77
78
  * simply hand it nothing to post to Slack. There is no `messageId` because there
@@ -177,4 +178,3 @@ export async function postNotification(url, token, jwt, task) {
177
178
  body
178
179
  });
179
180
  }
180
- //# sourceMappingURL=notify.js.map
@@ -43,4 +43,3 @@ export declare function agentTextMessage(input: {
43
43
  contextId: string;
44
44
  taskId: string;
45
45
  }): PlainMessage;
46
- //# sourceMappingURL=parts.d.ts.map
package/dist/a2a/parts.js CHANGED
@@ -92,4 +92,3 @@ export function agentTextMessage(input) {
92
92
  referenceTaskIds: []
93
93
  };
94
94
  }
95
- //# sourceMappingURL=parts.js.map
@@ -68,4 +68,3 @@ export interface PushChannel {
68
68
  * one card and the gateway pins one key for every agent on it.
69
69
  */
70
70
  export declare function createPushChannel(signingKey: string, push: TurnPushContext): PushChannel;
71
- //# sourceMappingURL=push.d.ts.map
package/dist/a2a/push.js CHANGED
@@ -51,4 +51,3 @@ export function createPushChannel(signingKey, push) {
51
51
  }
52
52
  };
53
53
  }
54
- //# sourceMappingURL=push.js.map
@@ -42,4 +42,3 @@ export declare class DurableTaskStore implements TaskStore {
42
42
  */
43
43
  list(params: ListTasksRequest): Promise<ListTasksResponse>;
44
44
  }
45
- //# sourceMappingURL=task-store.d.ts.map
@@ -97,4 +97,3 @@ function parseTimestamp(iso) {
97
97
  const ms = Date.parse(iso);
98
98
  return Number.isNaN(ms) ? undefined : ms;
99
99
  }
100
- //# sourceMappingURL=task-store.js.map
@@ -83,4 +83,3 @@ export interface PlainTask {
83
83
  */
84
84
  export declare function taskStateLabel(state: TaskState): string;
85
85
  export {};
86
- //# sourceMappingURL=task.d.ts.map
package/dist/a2a/task.js CHANGED
@@ -13,4 +13,3 @@ export function taskStateLabel(state) {
13
13
  .toLowerCase()
14
14
  .replace(/_/g, "-");
15
15
  }
16
- //# sourceMappingURL=task.js.map
@@ -74,4 +74,3 @@ export declare function verifyGatewayToken(token: string, opts: VerifyOptions):
74
74
  identity: GatewayIdentity;
75
75
  tenant: string;
76
76
  }>;
77
- //# sourceMappingURL=verify.d.ts.map
@@ -137,4 +137,3 @@ export async function verifyGatewayToken(token, opts) {
137
137
  throw new GatewayAuthError(err.message);
138
138
  }
139
139
  }
140
- //# sourceMappingURL=verify.js.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `@loopingai/core/anthropic` — Claude as a second model provider.
3
+ *
4
+ * Its own subpath, and an **optional** peer dependency on `@anthropic-ai/sdk`,
5
+ * for the same reason `/round` is not re-exported from the root barrel: an agent
6
+ * that runs on Workers AI should not pay — in install size, in bundle bytes, or
7
+ * in a dependency it must keep current — for a provider it never calls.
8
+ *
9
+ * What lives here is a provider, not a capability. It ships no tools, no prompt
10
+ * copy and no policy; it satisfies {@link ModelRuntime} and stops.
11
+ */
12
+ export { CredentialRejectedError, type CredentialRejectedBy } from "../errors.js";
13
+ export { createAnthropicLanguageModel, type AnthropicModelDeps } from "./language-model.js";
14
+ export { createAnthropicModelRuntime, type AnthropicRuntimeDeps } from "./runtime.js";
15
+ export { ANTHROPIC_PROVIDER, type CacheTtl } from "./prompt.js";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * `@loopingai/core/anthropic` — Claude as a second model provider.
3
+ *
4
+ * Its own subpath, and an **optional** peer dependency on `@anthropic-ai/sdk`,
5
+ * for the same reason `/round` is not re-exported from the root barrel: an agent
6
+ * that runs on Workers AI should not pay — in install size, in bundle bytes, or
7
+ * in a dependency it must keep current — for a provider it never calls.
8
+ *
9
+ * What lives here is a provider, not a capability. It ships no tools, no prompt
10
+ * copy and no policy; it satisfies {@link ModelRuntime} and stops.
11
+ */
12
+ // Re-exported, not owned: a rejected credential is a fact about the path to a
13
+ // model, not about Anthropic, so the error lives with the rest of the provider
14
+ // contract in {@link file://../errors.ts}. An agent that only imports this
15
+ // subpath still gets it from one place.
16
+ export { CredentialRejectedError } from "../errors.js";
17
+ export { createAnthropicLanguageModel } from "./language-model.js";
18
+ export { createAnthropicModelRuntime } from "./runtime.js";
19
+ export { ANTHROPIC_PROVIDER } from "./prompt.js";
@@ -0,0 +1,59 @@
1
+ import type Anthropic from "@anthropic-ai/sdk";
2
+ import type { LanguageModelV4 } from "@ai-sdk/provider";
3
+ import { type CredentialRejectedBy } from "../errors.js";
4
+ import { type CacheTtl } from "./prompt.js";
5
+ /**
6
+ * A `LanguageModelV4` over `@anthropic-ai/sdk`, so core's loops can call Claude
7
+ * without knowing they are.
8
+ *
9
+ * Every loop in core is written against `generateText` from `ai` and a
10
+ * `LanguageModel` — {@link file://../../round/turn.ts turn.ts},
11
+ * {@link file://../../subagent/run.ts run.ts} and
12
+ * {@link file://../session.ts session.ts}. Satisfying that interface is what
13
+ * keeps the round loop, the control-tool repair ladder, subtask execution and
14
+ * the Workflow untouched by a second provider. The alternative — a bespoke
15
+ * Messages-API loop for one agent — would have given all of that up.
16
+ *
17
+ * `ai@7` accepts `LanguageModelV2 | V3 | V4`; this targets **v4**, the newest
18
+ * the installed `@ai-sdk/provider` defines.
19
+ */
20
+ /** How the adapter reaches the API. Everything is injected so nothing reads env. */
21
+ export interface AnthropicModelDeps {
22
+ /**
23
+ * Constructed lazily by the runtime — see the note in
24
+ * {@link file://./runtime.ts}. Awaited, because building it has to resolve
25
+ * `env.AI.gateway(id).getUrl()`, which is async.
26
+ */
27
+ client: () => Anthropic | Promise<Anthropic>;
28
+ /** Anthropic model id, e.g. `claude-opus-5`. */
29
+ modelId: string;
30
+ /** `max_tokens` when a caller supplies none. Anthropic requires the field. */
31
+ defaultMaxTokens: number;
32
+ /** Prompt-cache TTL, or `false` to place no breakpoints. Defaults to `"5m"`. */
33
+ cache?: CacheTtl | false;
34
+ /**
35
+ * Reasoning effort, when the caller does not set one per-call.
36
+ *
37
+ * Maps to `output_config.effort`. Coding and agentic work wants `"xhigh"`;
38
+ * `"high"` is the API default. Core never picks this — an agent does.
39
+ */
40
+ effort?: "low" | "medium" | "high" | "xhigh" | "max";
41
+ /** Extra headers merged into every request (AI Gateway metadata lives here). */
42
+ headers?: Record<string, string>;
43
+ /**
44
+ * Recognise a deployment-specific authority in a `401`/`403` body.
45
+ *
46
+ * Consulted before the built-in shapes; return `undefined` to fall through to
47
+ * them. It exists because a deployment may put an authenticated intermediary
48
+ * between the gateway and Anthropic, and only that deployment knows what its
49
+ * refusal looks like — core recognising one particular proxy's error body
50
+ * would be exactly the deployment policy this package does not ship.
51
+ *
52
+ * The remedy is what makes it worth distinguishing at all: a proxy that mints
53
+ * its caller credential per request has no secret to rotate, so reporting its
54
+ * `401` as `credential` sends an operator to replace a working token. See
55
+ * {@link file://../errors.ts CredentialRejectedBy}.
56
+ */
57
+ classifyAuthFailure?: (body: unknown) => CredentialRejectedBy | undefined;
58
+ }
59
+ export declare function createAnthropicLanguageModel(deps: AnthropicModelDeps): LanguageModelV4;