@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.
- package/README.md +6 -4
- package/dist/a2a/agent-stub.d.ts +0 -1
- package/dist/a2a/agent-stub.js +0 -1
- package/dist/a2a/caller.d.ts +0 -1
- package/dist/a2a/caller.js +0 -1
- package/dist/a2a/card.d.ts +0 -1
- package/dist/a2a/card.js +0 -1
- package/dist/a2a/context.d.ts +0 -1
- package/dist/a2a/context.js +0 -1
- package/dist/a2a/executor.d.ts +0 -1
- package/dist/a2a/executor.js +0 -1
- package/dist/a2a/index.d.ts +0 -1
- package/dist/a2a/index.js +0 -1
- package/dist/a2a/notify.d.ts +4 -4
- package/dist/a2a/notify.js +4 -4
- package/dist/a2a/parts.d.ts +0 -1
- package/dist/a2a/parts.js +0 -1
- package/dist/a2a/push.d.ts +0 -1
- package/dist/a2a/push.js +0 -1
- package/dist/a2a/task-store.d.ts +0 -1
- package/dist/a2a/task-store.js +0 -1
- package/dist/a2a/task.d.ts +0 -1
- package/dist/a2a/task.js +0 -1
- package/dist/a2a/verify.d.ts +0 -1
- package/dist/a2a/verify.js +0 -1
- package/dist/agent/anthropic/index.d.ts +15 -0
- package/dist/agent/anthropic/index.js +19 -0
- package/dist/agent/anthropic/language-model.d.ts +59 -0
- package/dist/agent/anthropic/language-model.js +442 -0
- package/dist/agent/anthropic/prompt.d.ts +84 -0
- package/dist/agent/anthropic/prompt.js +541 -0
- package/dist/agent/anthropic/runtime.d.ts +79 -0
- package/dist/agent/anthropic/runtime.js +130 -0
- package/dist/agent/budget.d.ts +0 -1
- package/dist/agent/budget.js +0 -1
- package/dist/agent/control.d.ts +0 -1
- package/dist/agent/control.js +10 -10
- package/dist/agent/errors.d.ts +85 -0
- package/dist/agent/errors.js +64 -0
- package/dist/agent/final-reply.d.ts +14 -14
- package/dist/agent/final-reply.js +28 -12
- package/dist/agent/history.d.ts +3 -4
- package/dist/agent/history.js +2 -3
- package/dist/agent/index.d.ts +4 -3
- package/dist/agent/index.js +4 -3
- package/dist/agent/inference.d.ts +58 -2
- package/dist/agent/inference.js +44 -1
- package/dist/agent/model.d.ts +42 -26
- package/dist/agent/model.js +1 -49
- package/dist/agent/session.d.ts +6 -8
- package/dist/agent/session.js +3 -4
- package/dist/agent/workers-ai/index.d.ts +23 -0
- package/dist/agent/workers-ai/index.js +23 -0
- package/dist/agent/workers-ai/runtime.d.ts +42 -0
- package/dist/agent/workers-ai/runtime.js +63 -0
- package/dist/config.d.ts +49 -16
- package/dist/config.js +30 -2
- package/dist/contract/index.d.ts +0 -1
- package/dist/contract/index.js +0 -1
- package/dist/contract/plugin.d.ts +63 -4
- package/dist/contract/plugin.js +76 -1
- package/dist/contract/recipe.d.ts +16 -18
- package/dist/contract/recipe.js +0 -1
- package/dist/contract/validation.d.ts +0 -1
- package/dist/contract/validation.js +0 -1
- package/dist/db/db.d.ts +0 -2
- package/dist/db/db.js +0 -1
- package/dist/db/index.d.ts +0 -1
- package/dist/db/index.js +0 -1
- package/dist/db/migrations/index.d.ts +0 -1
- package/dist/db/migrations/index.js +8 -2
- package/dist/db/models/subtasks.d.ts +24 -26
- package/dist/db/models/subtasks.js +33 -77
- package/dist/db/models/tasks.d.ts +0 -1
- package/dist/db/models/tasks.js +0 -1
- package/dist/db/schema.d.ts +2 -22
- package/dist/db/schema.js +2 -5
- package/dist/env.d.ts +0 -1
- package/dist/env.js +0 -1
- package/dist/host/agent.d.ts +58 -5
- package/dist/host/agent.js +63 -10
- package/dist/host/index.d.ts +0 -1
- package/dist/host/index.js +0 -1
- package/dist/host/plugin-host.d.ts +0 -1
- package/dist/host/plugin-host.js +0 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -3
- package/dist/platform.d.ts +74 -12
- package/dist/platform.js +76 -14
- package/dist/round/agent.d.ts +36 -32
- package/dist/round/agent.js +61 -90
- package/dist/round/index.d.ts +3 -3
- package/dist/round/index.js +2 -3
- package/dist/round/policy.d.ts +2 -3
- package/dist/round/policy.js +0 -1
- package/dist/round/subagent.d.ts +19 -2
- package/dist/round/subagent.js +22 -6
- package/dist/round/turn.d.ts +32 -14
- package/dist/round/turn.js +83 -17
- package/dist/round/workflow.d.ts +30 -9
- package/dist/round/workflow.js +146 -78
- package/dist/runtime/index.d.ts +4 -3
- package/dist/runtime/index.js +6 -1
- package/dist/runtime/tool-families.d.ts +0 -1
- package/dist/runtime/tool-families.js +0 -1
- package/dist/subagent/fingerprint.d.ts +2 -3
- package/dist/subagent/fingerprint.js +8 -18
- package/dist/subagent/index.d.ts +6 -5
- package/dist/subagent/index.js +8 -7
- package/dist/subagent/prompt.d.ts +4 -6
- package/dist/subagent/prompt.js +0 -9
- package/dist/subagent/run.d.ts +8 -2
- package/dist/subagent/run.js +59 -10
- package/dist/subagent/workspace.d.ts +0 -1
- package/dist/subagent/workspace.js +0 -1
- package/dist/subtasks/catalog.d.ts +1 -2
- package/dist/subtasks/catalog.js +1 -2
- package/dist/subtasks/decomposition.d.ts +16 -21
- package/dist/subtasks/decomposition.js +27 -76
- package/dist/subtasks/delegate.d.ts +20 -2
- package/dist/subtasks/delegate.js +21 -17
- package/dist/subtasks/index.d.ts +1 -3
- package/dist/subtasks/index.js +1 -3
- package/dist/subtasks/subtask-types.d.ts +0 -9
- package/dist/subtasks/subtask-types.js +0 -8
- package/dist/subtasks/types.d.ts +45 -71
- package/dist/subtasks/types.js +0 -1
- package/dist/testing/auth.d.ts +0 -1
- package/dist/testing/auth.js +0 -1
- package/dist/testing/do.d.ts +0 -1
- package/dist/testing/do.js +0 -1
- package/dist/testing/fake-session.d.ts +0 -1
- package/dist/testing/fake-session.js +0 -1
- package/dist/testing/fixtures.d.ts +0 -1
- package/dist/testing/fixtures.js +0 -1
- package/dist/testing/harness.d.ts +0 -1
- package/dist/testing/harness.js +0 -1
- package/dist/testing/index.d.ts +0 -1
- package/dist/testing/index.js +0 -1
- package/dist/testing/mock-model.d.ts +35 -1
- package/dist/testing/mock-model.js +75 -1
- package/dist/testing/node.d.ts +0 -1
- package/dist/testing/node.js +0 -1
- package/dist/testing/vcr-global-setup.d.ts +1 -4
- package/dist/testing/vcr-global-setup.js +1 -4
- package/dist/testing/vcr-shared.d.ts +0 -1
- package/dist/testing/vcr-shared.js +0 -1
- package/dist/testing/vcr-spec.d.ts +0 -1
- package/dist/testing/vcr-spec.js +0 -1
- package/dist/testing/vcr-store.d.ts +0 -1
- package/dist/testing/vcr-store.js +0 -1
- package/dist/testing/vcr.d.ts +0 -1
- package/dist/testing/vcr.js +0 -1
- package/dist/worker/define-agent.d.ts +0 -1
- package/dist/worker/define-agent.js +0 -1
- package/dist/worker/index.d.ts +5 -13
- package/dist/worker/index.js +5 -13
- package/package.json +20 -2
- package/dist/a2a/agent-stub.d.ts.map +0 -1
- package/dist/a2a/agent-stub.js.map +0 -1
- package/dist/a2a/caller.d.ts.map +0 -1
- package/dist/a2a/caller.js.map +0 -1
- package/dist/a2a/card.d.ts.map +0 -1
- package/dist/a2a/card.js.map +0 -1
- package/dist/a2a/context.d.ts.map +0 -1
- package/dist/a2a/context.js.map +0 -1
- package/dist/a2a/executor.d.ts.map +0 -1
- package/dist/a2a/executor.js.map +0 -1
- package/dist/a2a/index.d.ts.map +0 -1
- package/dist/a2a/index.js.map +0 -1
- package/dist/a2a/notify.d.ts.map +0 -1
- package/dist/a2a/notify.js.map +0 -1
- package/dist/a2a/parts.d.ts.map +0 -1
- package/dist/a2a/parts.js.map +0 -1
- package/dist/a2a/push.d.ts.map +0 -1
- package/dist/a2a/push.js.map +0 -1
- package/dist/a2a/task-store.d.ts.map +0 -1
- package/dist/a2a/task-store.js.map +0 -1
- package/dist/a2a/task.d.ts.map +0 -1
- package/dist/a2a/task.js.map +0 -1
- package/dist/a2a/verify.d.ts.map +0 -1
- package/dist/a2a/verify.js.map +0 -1
- package/dist/agent/budget.d.ts.map +0 -1
- package/dist/agent/budget.js.map +0 -1
- package/dist/agent/control.d.ts.map +0 -1
- package/dist/agent/control.js.map +0 -1
- package/dist/agent/final-reply.d.ts.map +0 -1
- package/dist/agent/final-reply.js.map +0 -1
- package/dist/agent/history.d.ts.map +0 -1
- package/dist/agent/history.js.map +0 -1
- package/dist/agent/index.d.ts.map +0 -1
- package/dist/agent/index.js.map +0 -1
- package/dist/agent/inference.d.ts.map +0 -1
- package/dist/agent/inference.js.map +0 -1
- package/dist/agent/model.d.ts.map +0 -1
- package/dist/agent/model.js.map +0 -1
- package/dist/agent/session.d.ts.map +0 -1
- package/dist/agent/session.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/contract/index.d.ts.map +0 -1
- package/dist/contract/index.js.map +0 -1
- package/dist/contract/plugin.d.ts.map +0 -1
- package/dist/contract/plugin.js.map +0 -1
- package/dist/contract/recipe.d.ts.map +0 -1
- package/dist/contract/recipe.js.map +0 -1
- package/dist/contract/validation.d.ts.map +0 -1
- package/dist/contract/validation.js.map +0 -1
- package/dist/db/db.d.ts.map +0 -1
- package/dist/db/db.js.map +0 -1
- package/dist/db/index.d.ts.map +0 -1
- package/dist/db/index.js.map +0 -1
- package/dist/db/migrations/index.d.ts.map +0 -1
- package/dist/db/migrations/index.js.map +0 -1
- package/dist/db/models/subtasks.d.ts.map +0 -1
- package/dist/db/models/subtasks.js.map +0 -1
- package/dist/db/models/tasks.d.ts.map +0 -1
- package/dist/db/models/tasks.js.map +0 -1
- package/dist/db/schema.d.ts.map +0 -1
- package/dist/db/schema.js.map +0 -1
- package/dist/env.d.ts.map +0 -1
- package/dist/env.js.map +0 -1
- package/dist/host/agent.d.ts.map +0 -1
- package/dist/host/agent.js.map +0 -1
- package/dist/host/index.d.ts.map +0 -1
- package/dist/host/index.js.map +0 -1
- package/dist/host/plugin-host.d.ts.map +0 -1
- package/dist/host/plugin-host.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/platform.d.ts.map +0 -1
- package/dist/platform.js.map +0 -1
- package/dist/round/agent.d.ts.map +0 -1
- package/dist/round/agent.js.map +0 -1
- package/dist/round/index.d.ts.map +0 -1
- package/dist/round/index.js.map +0 -1
- package/dist/round/policy.d.ts.map +0 -1
- package/dist/round/policy.js.map +0 -1
- package/dist/round/subagent.d.ts.map +0 -1
- package/dist/round/subagent.js.map +0 -1
- package/dist/round/turn.d.ts.map +0 -1
- package/dist/round/turn.js.map +0 -1
- package/dist/round/workflow.d.ts.map +0 -1
- package/dist/round/workflow.js.map +0 -1
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/index.js.map +0 -1
- package/dist/runtime/tool-families.d.ts.map +0 -1
- package/dist/runtime/tool-families.js.map +0 -1
- package/dist/subagent/fingerprint.d.ts.map +0 -1
- package/dist/subagent/fingerprint.js.map +0 -1
- package/dist/subagent/index.d.ts.map +0 -1
- package/dist/subagent/index.js.map +0 -1
- package/dist/subagent/prompt.d.ts.map +0 -1
- package/dist/subagent/prompt.js.map +0 -1
- package/dist/subagent/run.d.ts.map +0 -1
- package/dist/subagent/run.js.map +0 -1
- package/dist/subagent/workspace.d.ts.map +0 -1
- package/dist/subagent/workspace.js.map +0 -1
- package/dist/subtasks/catalog.d.ts.map +0 -1
- package/dist/subtasks/catalog.js.map +0 -1
- package/dist/subtasks/decomposition.d.ts.map +0 -1
- package/dist/subtasks/decomposition.js.map +0 -1
- package/dist/subtasks/delegate.d.ts.map +0 -1
- package/dist/subtasks/delegate.js.map +0 -1
- package/dist/subtasks/index.d.ts.map +0 -1
- package/dist/subtasks/index.js.map +0 -1
- package/dist/subtasks/scheduler.d.ts +0 -49
- package/dist/subtasks/scheduler.d.ts.map +0 -1
- package/dist/subtasks/scheduler.js +0 -48
- package/dist/subtasks/scheduler.js.map +0 -1
- package/dist/subtasks/subtask-types.d.ts.map +0 -1
- package/dist/subtasks/subtask-types.js.map +0 -1
- package/dist/subtasks/types.d.ts.map +0 -1
- package/dist/subtasks/types.js.map +0 -1
- package/dist/testing/auth.d.ts.map +0 -1
- package/dist/testing/auth.js.map +0 -1
- package/dist/testing/do.d.ts.map +0 -1
- package/dist/testing/do.js.map +0 -1
- package/dist/testing/fake-session.d.ts.map +0 -1
- package/dist/testing/fake-session.js.map +0 -1
- package/dist/testing/fixtures.d.ts.map +0 -1
- package/dist/testing/fixtures.js.map +0 -1
- package/dist/testing/harness.d.ts.map +0 -1
- package/dist/testing/harness.js.map +0 -1
- package/dist/testing/index.d.ts.map +0 -1
- package/dist/testing/index.js.map +0 -1
- package/dist/testing/mock-model.d.ts.map +0 -1
- package/dist/testing/mock-model.js.map +0 -1
- package/dist/testing/node.d.ts.map +0 -1
- package/dist/testing/node.js.map +0 -1
- package/dist/testing/vcr-global-setup.d.ts.map +0 -1
- package/dist/testing/vcr-global-setup.js.map +0 -1
- package/dist/testing/vcr-shared.d.ts.map +0 -1
- package/dist/testing/vcr-shared.js.map +0 -1
- package/dist/testing/vcr-spec.d.ts.map +0 -1
- package/dist/testing/vcr-spec.js.map +0 -1
- package/dist/testing/vcr-store.d.ts.map +0 -1
- package/dist/testing/vcr-store.js.map +0 -1
- package/dist/testing/vcr.d.ts.map +0 -1
- package/dist/testing/vcr.js.map +0 -1
- package/dist/worker/define-agent.d.ts.map +0 -1
- package/dist/worker/define-agent.js.map +0 -1
- package/dist/worker/index.d.ts.map +0 -1
- 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:
|
|
192
|
-
|
|
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,
|
|
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/
|
|
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
|
package/dist/a2a/agent-stub.d.ts
CHANGED
package/dist/a2a/agent-stub.js
CHANGED
package/dist/a2a/caller.d.ts
CHANGED
package/dist/a2a/caller.js
CHANGED
package/dist/a2a/card.d.ts
CHANGED
package/dist/a2a/card.js
CHANGED
package/dist/a2a/context.d.ts
CHANGED
|
@@ -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
|
package/dist/a2a/context.js
CHANGED
package/dist/a2a/executor.d.ts
CHANGED
package/dist/a2a/executor.js
CHANGED
package/dist/a2a/index.d.ts
CHANGED
|
@@ -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
|
package/dist/a2a/notify.d.ts
CHANGED
|
@@ -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
|
|
41
|
-
*
|
|
42
|
-
*
|
|
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
|
package/dist/a2a/notify.js
CHANGED
|
@@ -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
|
|
73
|
-
*
|
|
74
|
-
*
|
|
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
|
package/dist/a2a/parts.d.ts
CHANGED
package/dist/a2a/parts.js
CHANGED
package/dist/a2a/push.d.ts
CHANGED
package/dist/a2a/push.js
CHANGED
package/dist/a2a/task-store.d.ts
CHANGED
package/dist/a2a/task-store.js
CHANGED
package/dist/a2a/task.d.ts
CHANGED
package/dist/a2a/task.js
CHANGED
package/dist/a2a/verify.d.ts
CHANGED
package/dist/a2a/verify.js
CHANGED
|
@@ -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;
|