@loopingai/core 0.1.1 → 0.2.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 +131 -15
- package/dist/a2a/card.d.ts +35 -0
- package/dist/a2a/card.d.ts.map +1 -1
- package/dist/a2a/card.js +41 -3
- package/dist/a2a/card.js.map +1 -1
- package/dist/a2a/context.d.ts +9 -3
- package/dist/a2a/context.d.ts.map +1 -1
- package/dist/a2a/context.js +11 -4
- package/dist/a2a/context.js.map +1 -1
- package/dist/a2a/index.d.ts +1 -1
- package/dist/a2a/index.d.ts.map +1 -1
- package/dist/a2a/index.js +1 -1
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/notify.d.ts +11 -2
- package/dist/a2a/notify.d.ts.map +1 -1
- package/dist/a2a/notify.js +12 -3
- package/dist/a2a/notify.js.map +1 -1
- package/dist/a2a/verify.d.ts +23 -2
- package/dist/a2a/verify.d.ts.map +1 -1
- package/dist/a2a/verify.js +26 -3
- package/dist/a2a/verify.js.map +1 -1
- package/dist/agent/history.d.ts +15 -0
- package/dist/agent/history.d.ts.map +1 -1
- package/dist/agent/history.js +17 -0
- package/dist/agent/history.js.map +1 -1
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +1 -1
- package/dist/agent/index.js.map +1 -1
- package/dist/contract/index.d.ts +1 -1
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/contract/index.js.map +1 -1
- package/dist/contract/plugin.d.ts +86 -3
- package/dist/contract/plugin.d.ts.map +1 -1
- package/dist/contract/plugin.js.map +1 -1
- package/dist/db/db.d.ts +32 -14
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/db.js.map +1 -1
- package/dist/env.d.ts +10 -2
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +10 -2
- package/dist/env.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime/index.d.ts +28 -3
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +39 -3
- package/dist/runtime/index.js.map +1 -1
- package/dist/subagent/workspace.d.ts +21 -0
- package/dist/subagent/workspace.d.ts.map +1 -1
- package/dist/subagent/workspace.js +80 -5
- package/dist/subagent/workspace.js.map +1 -1
- package/dist/testing/auth.d.ts +23 -0
- package/dist/testing/auth.d.ts.map +1 -1
- package/dist/testing/auth.js +11 -3
- package/dist/testing/auth.js.map +1 -1
- package/dist/testing/fixtures.d.ts +21 -0
- package/dist/testing/fixtures.d.ts.map +1 -1
- package/dist/testing/fixtures.js +21 -0
- package/dist/testing/fixtures.js.map +1 -1
- package/dist/testing/node.d.ts +23 -0
- package/dist/testing/node.d.ts.map +1 -1
- package/dist/testing/node.js +23 -0
- package/dist/testing/node.js.map +1 -1
- package/dist/testing/vcr-spec.d.ts +4 -4
- package/dist/testing/vcr-spec.d.ts.map +1 -1
- package/dist/testing/vcr-spec.js +32 -11
- package/dist/testing/vcr-spec.js.map +1 -1
- package/dist/worker/index.d.ts +142 -3
- package/dist/worker/index.d.ts.map +1 -1
- package/dist/worker/index.js +152 -29
- package/dist/worker/index.js.map +1 -1
- package/package.json +12 -4
package/dist/agent/history.d.ts
CHANGED
|
@@ -76,6 +76,21 @@ export declare function parseRoundAckMessageId(id: string): {
|
|
|
76
76
|
export declare function finalReplyMessageId(taskId: string): string;
|
|
77
77
|
/** A Sessions-store message with a caller-chosen (deterministic) id. */
|
|
78
78
|
export declare function deterministicSessionMessage(id: string, role: "user" | "assistant", text: string): SessionMessage;
|
|
79
|
+
/**
|
|
80
|
+
* A Sessions-store message with a fresh random id.
|
|
81
|
+
*
|
|
82
|
+
* The counterpart to {@link deterministicSessionMessage}, and choosing between
|
|
83
|
+
* them is a real decision rather than a style one. A deterministic id makes an
|
|
84
|
+
* append **idempotent**, which is what a durable-Workflow agent needs: its round
|
|
85
|
+
* can re-run after a crash, and the id is what stops the retry from duplicating a
|
|
86
|
+
* turn or rewriting a reply the user already received.
|
|
87
|
+
*
|
|
88
|
+
* A conversational agent that answers inline has no such replay to defend
|
|
89
|
+
* against — every turn is a new message and there is no step to re-enter — so a
|
|
90
|
+
* random id is correct and a synthesized deterministic one would be a lie about
|
|
91
|
+
* what is being deduplicated.
|
|
92
|
+
*/
|
|
93
|
+
export declare function sessionMessage(role: "user" | "assistant", text: string): SessionMessage;
|
|
79
94
|
/** Concatenate the text parts of a stored session message. */
|
|
80
95
|
export declare function sessionText(m: SessionMessage): string;
|
|
81
96
|
/** Convert stored history to AI-SDK model messages (user/assistant text only). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/agent/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;;;;;;;;;;;;;GAcG;AAEH,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd;AAyBD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAYzD;AAED;;;;;;;;;;;;;;GAcG;AAEH,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvE;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,EAAE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,MAAM,CAEvE;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,MAAM,GACT;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAG1C;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wEAAwE;AACxE,wBAAgB,2BAA2B,CACzC,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,GAAG,WAAW,EAC1B,IAAI,EAAE,MAAM,GACX,cAAc,CAOhB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,GAAG,WAAW,EAC1B,IAAI,EAAE,MAAM,GACX,cAAc,CAEhB;AAED,8DAA8D;AAC9D,wBAAgB,WAAW,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,CAKrD;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,YAAY,EAAE,CAOzE"}
|
package/dist/agent/history.js
CHANGED
|
@@ -98,6 +98,23 @@ export function deterministicSessionMessage(id, role, text) {
|
|
|
98
98
|
parts: [{ type: "text", text }]
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* A Sessions-store message with a fresh random id.
|
|
103
|
+
*
|
|
104
|
+
* The counterpart to {@link deterministicSessionMessage}, and choosing between
|
|
105
|
+
* them is a real decision rather than a style one. A deterministic id makes an
|
|
106
|
+
* append **idempotent**, which is what a durable-Workflow agent needs: its round
|
|
107
|
+
* can re-run after a crash, and the id is what stops the retry from duplicating a
|
|
108
|
+
* turn or rewriting a reply the user already received.
|
|
109
|
+
*
|
|
110
|
+
* A conversational agent that answers inline has no such replay to defend
|
|
111
|
+
* against — every turn is a new message and there is no step to re-enter — so a
|
|
112
|
+
* random id is correct and a synthesized deterministic one would be a lie about
|
|
113
|
+
* what is being deduplicated.
|
|
114
|
+
*/
|
|
115
|
+
export function sessionMessage(role, text) {
|
|
116
|
+
return deterministicSessionMessage(crypto.randomUUID(), role, text);
|
|
117
|
+
}
|
|
101
118
|
/** Concatenate the text parts of a stored session message. */
|
|
102
119
|
export function sessionText(m) {
|
|
103
120
|
return m.parts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/agent/history.ts"],"names":[],"mappings":"AA+BA,MAAM,WAAW,GAAG,oCAAoC,CAAC;AACzD,MAAM,OAAO,GAAG,kBAAkB,CAAC;AAEnC,SAAS,UAAU,CAAC,GAAW;IAC7B,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,IAAI,CAAyB,CAAC;IAC9B,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC;IACtB,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI;QAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,cAAc,GAA2B;IAC7C,GAAG,EAAE,GAAG;IACR,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,IAAI,EAAE,GAAG;CACV,CAAC;AAEF,qFAAqF;AACrF,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,MAAM,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,MAAM,KAAK,GAAG,UAAU,C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,IAAI,KAAK,MAAM,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;SAC9D,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAc,CAAC;SAC5B,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,eAAe,CAAC,OAAyB;IACvD,OAAO,OAAO;SACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC;SAC1D,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,IAAI,EAAE,CAAC,CAAC,IAA4B;QACpC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC;KACxB,CAAC,CAAC,CAAC;AACR,CAAC"}
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
export { newTurnBudget, stepAllowance, type TurnBudget } from "./budget.js";
|
|
11
11
|
export { createModelRuntime, type GatewayMetadata, type ModelOverrides, type ModelPair, type ModelRuntime, type ModelRuntimeDeps } from "./model.js";
|
|
12
12
|
export { appendOnce, buildAgentSession, notifyingCompaction, type AgentSessionOptions, type SessionHost, type SessionLike } from "./session.js";
|
|
13
|
-
export { deterministicSessionMessage, finalReplyMessageId, parseRoundAckMessageId, parseTurn, roundAckMessageId, sessionText, taskUserMessageId, toModelMessages, type ParsedTurn } from "./history.js";
|
|
13
|
+
export { deterministicSessionMessage, finalReplyMessageId, parseRoundAckMessageId, parseTurn, roundAckMessageId, sessionMessage, sessionText, taskUserMessageId, toModelMessages, type ParsedTurn } from "./history.js";
|
|
14
14
|
export { buildIntermediateContentHandler, isTransientAiError, type OnContent } from "./inference.js";
|
|
15
15
|
export { ControlCallError, controlTools, controlToolSet, type ControlTool, type TurnDecision } from "./control.js";
|
|
16
16
|
export { FINAL_REPLY_TOOL_NAME, finalReplyInputSchema, finalReplyTool } from "./final-reply.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE5E,OAAO,EACL,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,EACtB,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,KAAK,UAAU,EAChB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,+BAA+B,EAC/B,kBAAkB,EAClB,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACf,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE5E,OAAO,EACL,kBAAkB,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,EACtB,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,KAAK,UAAU,EAChB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,+BAA+B,EAC/B,kBAAkB,EAClB,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACf,MAAM,kBAAkB,CAAC"}
|
package/dist/agent/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
export { newTurnBudget, stepAllowance } from "./budget.js";
|
|
11
11
|
export { createModelRuntime } from "./model.js";
|
|
12
12
|
export { appendOnce, buildAgentSession, notifyingCompaction } from "./session.js";
|
|
13
|
-
export { deterministicSessionMessage, finalReplyMessageId, parseRoundAckMessageId, parseTurn, roundAckMessageId, sessionText, taskUserMessageId, toModelMessages } from "./history.js";
|
|
13
|
+
export { deterministicSessionMessage, finalReplyMessageId, parseRoundAckMessageId, parseTurn, roundAckMessageId, sessionMessage, sessionText, taskUserMessageId, toModelMessages } from "./history.js";
|
|
14
14
|
export { buildIntermediateContentHandler, isTransientAiError } from "./inference.js";
|
|
15
15
|
export { ControlCallError, controlTools, controlToolSet } from "./control.js";
|
|
16
16
|
export { FINAL_REPLY_TOOL_NAME, finalReplyInputSchema, finalReplyTool } from "./final-reply.js";
|
package/dist/agent/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAmB,MAAM,aAAa,CAAC;AAE5E,OAAO,EACL,kBAAkB,EAMnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EAIpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,EACtB,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,EAEhB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,+BAA+B,EAC/B,kBAAkB,EAEnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,EAGf,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACf,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAmB,MAAM,aAAa,CAAC;AAE5E,OAAO,EACL,kBAAkB,EAMnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EAIpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,EACtB,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,eAAe,EAEhB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,+BAA+B,EAC/B,kBAAkB,EAEnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,cAAc,EAGf,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACf,MAAM,kBAAkB,CAAC"}
|
package/dist/contract/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Re-exported from the package root as well, so a plugin author writes
|
|
5
5
|
* `import { definePlugin } from "@loopingai/core"` and nothing else.
|
|
6
6
|
*/
|
|
7
|
-
export { PLUGIN_CONTRACT_VERSION, definePlugin, type AgentPlugin, type EmitProgress, type EnrichResultContext, type PluginRequirements, type RecipeToolSet, type ResolveRuntimeContext, type ToolFamilyBuilder, type ToolFamilyContext } from "./plugin.js";
|
|
7
|
+
export { PLUGIN_CONTRACT_VERSION, definePlugin, type AgentPlugin, type EmitProgress, type EnrichResultContext, type MainAgentToolContext, type PluginRequirements, type RecipeToolSet, type ResolveRuntimeContext, type ToolFamilyBuilder, type ToolFamilyContext, type TurnGateContext } from "./plugin.js";
|
|
8
8
|
export type { DelegationNames, RecipeLimits, ResolvedRecipe, SubtaskParams, SubtaskParamsSchema, SubtaskParamsShape, SubtaskTypeSpec, ValidatedRecipe } from "./recipe.js";
|
|
9
9
|
export { RecipeValidationError, resolveLimits, validateRecipe, type RecipePolicy } from "./validation.js";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,uBAAuB,EACvB,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,uBAAuB,EACvB,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,eAAe,EACf,YAAY,EACZ,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,eAAe,EAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,uBAAuB,EACvB,YAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,uBAAuB,EACvB,YAAY,EAWb,MAAM,aAAa,CAAC;AAarB,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,cAAc,EAEf,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ToolSet } from "ai";
|
|
2
2
|
import type { SessionMessage } from "agents/experimental/memory/session";
|
|
3
|
+
import type { SessionLike } from "../agent/session.js";
|
|
3
4
|
import type { PluginStore } from "../db/db.js";
|
|
4
|
-
import type { WorkspaceHandle } from "../subagent/workspace.js";
|
|
5
|
+
import type { WorkspaceBacking, WorkspaceHandle } from "../subagent/workspace.js";
|
|
5
6
|
import type { ProgressEvent, RecipeExecutionRequest, RecipeExecutionResult, SubtaskRuntime } from "../subtasks/types.js";
|
|
6
7
|
import type { SubtaskParams, SubtaskTypeSpec } from "./recipe.js";
|
|
7
8
|
/**
|
|
@@ -88,6 +89,34 @@ export interface EnrichResultContext<TRuntime = SubtaskRuntime> {
|
|
|
88
89
|
request: RecipeExecutionRequest;
|
|
89
90
|
runtime: TRuntime;
|
|
90
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* What a plugin knows when it builds the *main* agent's tools.
|
|
94
|
+
*
|
|
95
|
+
* Deliberately just the session, and deliberately not the caller's identity. A
|
|
96
|
+
* plugin that needs a per-caller value takes it as config at instantiation, like
|
|
97
|
+
* every other config value — the Durable Object is keyed 1:1 by the verified
|
|
98
|
+
* caller, so that value is constant for its life. Putting it here as well would
|
|
99
|
+
* give a plugin two ways to reach one fact, and the *other* hook that needs it
|
|
100
|
+
* ({@link AgentPlugin.onMessagesDisplaced}) has no context to read it from
|
|
101
|
+
* anyway.
|
|
102
|
+
*
|
|
103
|
+
* What the session gives that config cannot is **durable state the tool surface
|
|
104
|
+
* depends on** — whether history has ever been compacted, how many contexts are
|
|
105
|
+
* set. That is a question only the session can answer, and only at call time.
|
|
106
|
+
*/
|
|
107
|
+
export interface MainAgentToolContext {
|
|
108
|
+
session: SessionLike;
|
|
109
|
+
}
|
|
110
|
+
/** What a plugin knows when deciding whether a turn should run at all. */
|
|
111
|
+
export interface TurnGateContext {
|
|
112
|
+
/**
|
|
113
|
+
* The conversation so far, **including the message being judged** — which is
|
|
114
|
+
* already appended when a gate runs, so the agent reads a message it declines.
|
|
115
|
+
* A bare message is frequently unclassifiable ("yes", "thanks", "and the
|
|
116
|
+
* second one?"), so the tail is what makes the judgement possible at all.
|
|
117
|
+
*/
|
|
118
|
+
history: SessionMessage[];
|
|
119
|
+
}
|
|
91
120
|
/** Bindings and secrets a plugin needs the *host* to provide in `wrangler.jsonc`. */
|
|
92
121
|
export interface PluginRequirements {
|
|
93
122
|
/** Secret names, e.g. `["ARC_API_KEY"]`. */
|
|
@@ -115,11 +144,25 @@ export interface AgentPlugin<TRuntime = SubtaskRuntime> {
|
|
|
115
144
|
* `validateRecipe`, so the legal set is exactly what is installed.
|
|
116
145
|
*/
|
|
117
146
|
toolFamilies?: Record<string, ToolFamilyBuilder<TRuntime>>;
|
|
118
|
-
/**
|
|
119
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Tools offered to the *main* agent (e.g. a catalogue lookup before
|
|
149
|
+
* delegating).
|
|
150
|
+
*
|
|
151
|
+
* May return a promise, so a plugin can shape its tool surface from durable
|
|
152
|
+
* state — offering a search tool only once there is something to search, say.
|
|
153
|
+
* A tool that can only ever return "nothing here yet" costs the model a call to
|
|
154
|
+
* find that out, and costs every round the tokens to describe it.
|
|
155
|
+
*/
|
|
156
|
+
mainAgentTools?: (ctx: MainAgentToolContext) => ToolSet | Promise<ToolSet>;
|
|
120
157
|
/**
|
|
121
158
|
* What the main agent is told it can do with this domain, rendered into its
|
|
122
159
|
* soul alongside the other capability blocks.
|
|
160
|
+
*
|
|
161
|
+
* A plugin that declares a {@link subtaskType} should put its capability block
|
|
162
|
+
* on the *type* instead ({@link SubtaskTypeSpec.capability}) and leave this
|
|
163
|
+
* unset — the two are rendered by different call sites, so declaring both
|
|
164
|
+
* makes the main agent read the same advice twice per round. Which is the
|
|
165
|
+
* exact failure the type's own prompt fields were introduced to end.
|
|
123
166
|
*/
|
|
124
167
|
capability?: string;
|
|
125
168
|
/**
|
|
@@ -138,6 +181,28 @@ export interface AgentPlugin<TRuntime = SubtaskRuntime> {
|
|
|
138
181
|
enrichResult?: (ctx: EnrichResultContext<TRuntime>, result: RecipeExecutionResult) => Promise<RecipeExecutionResult>;
|
|
139
182
|
/** Release anything {@link resolveRuntime} acquired, when an execution is canceled. */
|
|
140
183
|
onAbort?: (ctx: ResolveRuntimeContext) => Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* Decide whether a turn should run at all, before the loop builds or calls
|
|
186
|
+
* anything.
|
|
187
|
+
*
|
|
188
|
+
* An agent that sees every message in its channels is mostly seeing messages
|
|
189
|
+
* that are not for it. Left to the main loop that judgement is made by a model
|
|
190
|
+
* simultaneously trying to be helpful, with history and half a dozen tools in
|
|
191
|
+
* view, and it degrades exactly there — *invisibly*, because failing to call a
|
|
192
|
+
* decline-tool looks identical to deciding not to. A gate moves the decision
|
|
193
|
+
* somewhere it cannot be skipped.
|
|
194
|
+
*
|
|
195
|
+
* **Fails open, and the asymmetry is the whole design.** A gate that throws is
|
|
196
|
+
* counted as `true`, so an outage degrades to the previous behaviour (run the
|
|
197
|
+
* turn) and never to a silent agent: a wrong reply is noise the user can see
|
|
198
|
+
* and ignore, while a wrong silence is invisible — the person who needed the
|
|
199
|
+
* agent simply never hears back. Failing *synchronously* is as safe as
|
|
200
|
+
* rejecting.
|
|
201
|
+
*
|
|
202
|
+
* Every declaring plugin is consulted and the results are AND-ed: any one gate
|
|
203
|
+
* may decline the turn. Returning `true` is always valid.
|
|
204
|
+
*/
|
|
205
|
+
shouldHandleTurn?: (ctx: TurnGateContext) => Promise<boolean>;
|
|
141
206
|
/**
|
|
142
207
|
* The raw messages a compaction is about to fold into a summary, handed over
|
|
143
208
|
* before they stop being readable as history.
|
|
@@ -158,6 +223,24 @@ export interface AgentPlugin<TRuntime = SubtaskRuntime> {
|
|
|
158
223
|
onMessagesDisplaced?: (messages: SessionMessage[]) => Promise<void>;
|
|
159
224
|
/** Tables this plugin owns, outside core's migration journal. See {@link PluginStore}. */
|
|
160
225
|
store?: PluginStore;
|
|
226
|
+
/**
|
|
227
|
+
* The durable file store a subagent execution's workspace is built over.
|
|
228
|
+
*
|
|
229
|
+
* Core declares the {@link WorkspaceBacking} shape and enforces the caps, but
|
|
230
|
+
* ships no backend: the predecessor's was `@cloudflare/shell`, which is
|
|
231
|
+
* experimental ("expect breaking changes"), and an agent that never delegates
|
|
232
|
+
* file work should not carry it. So the backend arrives here, from a plugin,
|
|
233
|
+
* and an agent that installs none falls back to an in-memory one.
|
|
234
|
+
*
|
|
235
|
+
* At most one installed plugin may declare this — two backends would mean two
|
|
236
|
+
* answers to "where did that file go", and the file would be in whichever the
|
|
237
|
+
* runtime happened to pick.
|
|
238
|
+
*
|
|
239
|
+
* `sql` is the executing facet's own SQLite, so isolation per execution is
|
|
240
|
+
* free and deleting the child wipes the workspace with it. `name` is lazy
|
|
241
|
+
* because a facet's name is set after construction.
|
|
242
|
+
*/
|
|
243
|
+
workspaceBacking?: (sql: SqlStorage, name: () => string | undefined) => WorkspaceBacking;
|
|
161
244
|
/**
|
|
162
245
|
* Bindings and secrets the host must declare in `wrangler.jsonc`. A plugin
|
|
163
246
|
* cannot add its own binding, so declaring them lets startup fail with a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/contract/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/contract/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAElE;;;;;;;;GAQG;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEz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,CAAC,CAAC;IAIpE,0FAA0F;IAC1F,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;;;;;;;;;;;;;;OAgBG;IACH,gBAAgB,CAAC,EAAE,CACjB,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,MAAM,MAAM,GAAG,SAAS,KAC3B,gBAAgB,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,QAAQ,GAAG,cAAc,EACpD,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC,GAAG;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GACA,WAAW,CAAC,QAAQ,CAAC,CAKvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/contract/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/contract/plugin.ts"],"names":[],"mappings":"AAgBA;;;;;;;;GAQG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAkQzC;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAC1B,MAEC;IAED,OAAO;QACL,GAAG,MAAM;QACT,eAAe,EAAE,MAAM,CAAC,eAAe,IAAI,uBAAuB;KACnE,CAAC;AACJ,CAAC"}
|
package/dist/db/db.d.ts
CHANGED
|
@@ -4,23 +4,37 @@ export type DB = DrizzleSqliteDODatabase<typeof schema>;
|
|
|
4
4
|
/**
|
|
5
5
|
* A table owner outside core's migration journal.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* diff at all.
|
|
7
|
+
* What a plugin cannot share is the **migrator**. `drizzle-orm/durable-sqlite/
|
|
8
|
+
* migrator` keeps one flat integer journal and one global
|
|
9
|
+
* `__drizzle_migrations` table, and two independently-versioned npm packages
|
|
10
|
+
* cannot share that index space — not hypothetically: the two predecessor
|
|
11
|
+
* agents, both consuming the same `notify_tasks` module, had already forked the
|
|
12
|
+
* journal at index 1 (`0001_unusual_nova` vs `0001_great_goliath`). Worse,
|
|
13
|
+
* `drizzle-kit generate` diffs against a snapshot in one output directory, so a
|
|
14
|
+
* plugin shipping from its own repo cannot produce a correct diff at all.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* **The query builder is a different thing entirely, and a plugin should use
|
|
17
|
+
* it.** `drizzle(storage, { schema })` is a typed wrapper over the same
|
|
18
|
+
* `DurableObjectStorage`; it holds no journal, no connection, and no state that
|
|
19
|
+
* a second handle could disturb. So the rule is narrow — *never import the
|
|
20
|
+
* migrator* — rather than "no drizzle".
|
|
21
|
+
*
|
|
22
|
+
* A plugin therefore does three things: declares its tables with `sqliteTable`
|
|
23
|
+
* as usual, emits idempotent DDL here, and queries through its own drizzle
|
|
24
|
+
* handle. Version bookkeeping lives in the {@link PLUGIN_MIGRATIONS_TABLE} row
|
|
25
|
+
* this class manages for it. Only the DDL is hand-written, and that pattern is
|
|
26
|
+
* not novel here — it is what the subagent facet already does for its own two
|
|
27
|
+
* tables.
|
|
21
28
|
*
|
|
22
29
|
* ```ts
|
|
23
|
-
*
|
|
30
|
+
* // schema.ts — an ordinary drizzle table, under the plugin's own prefix.
|
|
31
|
+
* export const arcScorecards = sqliteTable("arc_scorecards", {
|
|
32
|
+
* cardId: text("card_id").primaryKey(),
|
|
33
|
+
* lastUsedAt: integer("last_used_at").notNull()
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // The DDL half: idempotent, re-run on every hibernation wake-up.
|
|
37
|
+
* const store: PluginStore = {
|
|
24
38
|
* plugin: "arc-agi",
|
|
25
39
|
* version: 2,
|
|
26
40
|
* ensureTables(sql, from) {
|
|
@@ -28,6 +42,10 @@ export type DB = DrizzleSqliteDODatabase<typeof schema>;
|
|
|
28
42
|
* if (from < 2) sql.exec(`ALTER TABLE arc_scorecards ADD COLUMN …`);
|
|
29
43
|
* }
|
|
30
44
|
* };
|
|
45
|
+
*
|
|
46
|
+
* // The query half: drizzle, over the plugin's own handle.
|
|
47
|
+
* const db = drizzle(storage, { schema: { arcScorecards } });
|
|
48
|
+
* db.select().from(arcScorecards).where(gte(arcScorecards.lastUsedAt, since));
|
|
31
49
|
* ```
|
|
32
50
|
*/
|
|
33
51
|
export interface PluginStore {
|
package/dist/db/db.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/db/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAKtC,MAAM,MAAM,EAAE,GAAG,uBAAuB,CAAC,OAAO,MAAM,CAAC,CAAC;AAExD
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/db/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAKtC,MAAM,MAAM,EAAE,GAAG,uBAAuB,CAAC,OAAO,MAAM,CAAC,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,WAAW,WAAW;IAC1B,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,YAAY,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACnD;AAED,iGAAiG;AACjG,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAE3D,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAChC;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,OAAO;IAOhB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAP1B,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAK;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IACvC,OAAO,CAAC,MAAM,CAAC,CAA+B;IAC9C,OAAO,CAAC,SAAS,CAAC,CAAkC;gBAGjC,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,cAAc;IAQ1C,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,IAAI,KAAK;;;;;;;;;;;;;;;MAER;IAED,IAAI,QAAQ;;;;;;;;;;;;;;;MAIX;IAED;;;;;;;;OAQG;IACH,OAAO,CAAC,WAAW;CAsDpB"}
|
package/dist/db/db.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/db/db.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAER,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/db/db.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO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AE9B,IAAI,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;gBAC3B,GAAG,CAAC,IAAI,CACN,eAAe,uBAAuB;;4GAE4D,EAClG,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,OAAO,EACb,IAAI,CAAC,GAAG,EAAE,CACX,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
package/dist/env.d.ts
CHANGED
|
@@ -9,8 +9,16 @@
|
|
|
9
9
|
* with no cast.
|
|
10
10
|
*
|
|
11
11
|
* The two secrets are the zero-trust contract and are the only names core
|
|
12
|
-
* insists on; everything else is passed in.
|
|
13
|
-
*
|
|
12
|
+
* insists on; everything else is passed in. Even these are only a *default*:
|
|
13
|
+
* `createA2AWorker`'s `secrets` option reads them from wherever a consumer keeps
|
|
14
|
+
* them, so a Worker whose bindings are already named something else does not
|
|
15
|
+
* have to rename them.
|
|
16
|
+
*
|
|
17
|
+
* That is *all* it does. The secrets are read once per request and belong to the
|
|
18
|
+
* deployment, not to an agent: several agents share one Worker as tenants of one
|
|
19
|
+
* origin, and they share this one signing identity with it. What separates them
|
|
20
|
+
* is the tenant claim on the gateway token, not a key apiece. See
|
|
21
|
+
* {@link file://./worker/index.ts}.
|
|
14
22
|
*/
|
|
15
23
|
/** Workers AI, backing the chat loop (and whatever a plugin runs on it). */
|
|
16
24
|
export interface AiEnv {
|
package/dist/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,4EAA4E;AAC5E,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,EAAE,CAAC;CACR;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,kEAAkE;AAClE,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,aAAa,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBzD"}
|
package/dist/env.js
CHANGED
|
@@ -9,8 +9,16 @@
|
|
|
9
9
|
* with no cast.
|
|
10
10
|
*
|
|
11
11
|
* The two secrets are the zero-trust contract and are the only names core
|
|
12
|
-
* insists on; everything else is passed in.
|
|
13
|
-
*
|
|
12
|
+
* insists on; everything else is passed in. Even these are only a *default*:
|
|
13
|
+
* `createA2AWorker`'s `secrets` option reads them from wherever a consumer keeps
|
|
14
|
+
* them, so a Worker whose bindings are already named something else does not
|
|
15
|
+
* have to rename them.
|
|
16
|
+
*
|
|
17
|
+
* That is *all* it does. The secrets are read once per request and belong to the
|
|
18
|
+
* deployment, not to an agent: several agents share one Worker as tenants of one
|
|
19
|
+
* origin, and they share this one signing identity with it. What separates them
|
|
20
|
+
* is the tenant claim on the gateway token, not a key apiece. See
|
|
21
|
+
* {@link file://./worker/index.ts}.
|
|
14
22
|
*/
|
|
15
23
|
/**
|
|
16
24
|
* Parse `GATEWAY_ORIGINS`. Accepts a JSON array (the documented form) or a
|
package/dist/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AA8BH;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC1D,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,sCAAuC,GAAa,CAAC,OAAO,EAAE,CAC/D,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACrE,OAAO,MAAkB,CAAC;AAC5B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
* production bundle.
|
|
10
10
|
*/
|
|
11
11
|
export { createAgentRuntime, RuntimeSetupError, buildRecipeTools, collectToolFamilies, type AgentRuntime, type CreateAgentRuntimeOptions } from "./runtime/index.js";
|
|
12
|
-
export { PLUGIN_CONTRACT_VERSION, definePlugin, type AgentPlugin, type EmitProgress, type EnrichResultContext, type PluginRequirements, type RecipeToolSet, type ResolveRuntimeContext, type ToolFamilyBuilder, type ToolFamilyContext } from "./contract/plugin.js";
|
|
12
|
+
export { PLUGIN_CONTRACT_VERSION, definePlugin, type AgentPlugin, type EmitProgress, type EnrichResultContext, type MainAgentToolContext, type PluginRequirements, type RecipeToolSet, type ResolveRuntimeContext, type ToolFamilyBuilder, type ToolFamilyContext, type TurnGateContext } from "./contract/plugin.js";
|
|
13
13
|
export type { DelegationNames, RecipeLimits, ResolvedRecipe, SubtaskParams, SubtaskParamsSchema, SubtaskParamsShape, SubtaskTypeSpec, ValidatedRecipe } from "./contract/recipe.js";
|
|
14
14
|
export { RecipeValidationError, resolveLimits, validateRecipe, type RecipePolicy } from "./contract/validation.js";
|
|
15
15
|
export { ConfigError, DEFAULT_CORE_CONFIG, resolveConfig, type AgentLimits, type CoreConfig, type CoreConfigOverrides, type ModelConfig, type SessionConfig } from "./config.js";
|
|
16
16
|
export { parseGatewayOrigins, type A2ASecretsEnv, type AiEnv, type CoreEnv } from "./env.js";
|
|
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
|
-
export { makeWorkspaceHandle, WorkspaceLimitError, WORKSPACE_MAX_FILES, WORKSPACE_MAX_FILE_BYTES, type WorkspaceBacking, type WorkspaceEntry, type WorkspaceHandle } from "./subagent/workspace.js";
|
|
19
|
+
export { makeWorkspaceHandle, memoryWorkspaceBacking, WorkspaceLimitError, WORKSPACE_MAX_FILES, WORKSPACE_MAX_FILE_BYTES, type WorkspaceBacking, type WorkspaceEntry, type WorkspaceHandle } from "./subagent/workspace.js";
|
|
20
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC/B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,uBAAuB,EACvB,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC/B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,uBAAuB,EACvB,YAAY,EACZ,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EACV,eAAe,EACf,YAAY,EACZ,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,KAAK,YAAY,EAClB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,OAAO,EACb,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,5 +14,5 @@ export { RecipeValidationError, resolveLimits, validateRecipe } from "./contract
|
|
|
14
14
|
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
|
-
export { makeWorkspaceHandle, WorkspaceLimitError, WORKSPACE_MAX_FILES, WORKSPACE_MAX_FILE_BYTES } from "./subagent/workspace.js";
|
|
17
|
+
export { makeWorkspaceHandle, memoryWorkspaceBacking, WorkspaceLimitError, WORKSPACE_MAX_FILES, WORKSPACE_MAX_FILE_BYTES } from "./subagent/workspace.js";
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EAGpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,uBAAuB,EACvB,YAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EAGpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,uBAAuB,EACvB,YAAY,EAWb,MAAM,sBAAsB,CAAC;AAa9B,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,cAAc,EAEf,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,aAAa,EAMd,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,mBAAmB,EAIpB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EAIzB,MAAM,yBAAyB,CAAC"}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ToolSet } from "ai";
|
|
2
2
|
import type { SessionMessage } from "agents/experimental/memory/session";
|
|
3
3
|
import { type CoreConfig, type CoreConfigOverrides } from "../config.js";
|
|
4
|
-
import { type AgentPlugin, type EnrichResultContext, type ResolveRuntimeContext, type ToolFamilyBuilder } from "../contract/plugin.js";
|
|
4
|
+
import { type AgentPlugin, type EnrichResultContext, type MainAgentToolContext, type ResolveRuntimeContext, type ToolFamilyBuilder, type TurnGateContext } from "../contract/plugin.js";
|
|
5
5
|
import type { PluginStore } from "../db/db.js";
|
|
6
|
+
import { type WorkspaceBacking } from "../subagent/workspace.js";
|
|
6
7
|
import type { RecipePolicy } from "../contract/validation.js";
|
|
7
8
|
import { type SubtaskTypeRegistry } from "../subtasks/subtask-types.js";
|
|
8
9
|
import type { RecipeExecutionResult, SubtaskRuntime } from "../subtasks/types.js";
|
|
@@ -46,15 +47,32 @@ export interface AgentRuntime {
|
|
|
46
47
|
secrets: string[];
|
|
47
48
|
bindings: string[];
|
|
48
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* The subagent workspace backend — the one plugin that declared it, or an
|
|
52
|
+
* in-memory fallback when none did. Always defined, so a host writes
|
|
53
|
+
* `workspaceBacking: runtime.workspaceBacking` into its `SubagentRuntime`
|
|
54
|
+
* unconditionally.
|
|
55
|
+
*/
|
|
56
|
+
workspaceBacking: (sql: SqlStorage, name: () => string | undefined) => WorkspaceBacking;
|
|
49
57
|
/** The plugin that declared a subtask type, or null. */
|
|
50
58
|
pluginForType(type: string): AgentPlugin | null;
|
|
51
59
|
/** Tools the installed plugins offer the *main* agent, merged. */
|
|
52
|
-
mainAgentTools(): ToolSet
|
|
60
|
+
mainAgentTools(ctx: MainAgentToolContext): Promise<ToolSet>;
|
|
53
61
|
/**
|
|
54
62
|
* Every plugin's `capability` block, for the main agent's soul. Returns `""`
|
|
55
63
|
* when none declares one, so a call site can append unconditionally.
|
|
56
64
|
*/
|
|
57
65
|
renderCapabilities(): string;
|
|
66
|
+
/**
|
|
67
|
+
* Ask every plugin declaring {@link AgentPlugin.shouldHandleTurn} whether this
|
|
68
|
+
* turn should run. `true` when none declares one, and `false` if any single
|
|
69
|
+
* gate declines.
|
|
70
|
+
*
|
|
71
|
+
* Never rejects: a gate that fails is logged against its plugin key and
|
|
72
|
+
* counted as `true`, because the failure mode of a broken gate must be a noisy
|
|
73
|
+
* agent, never a silent one.
|
|
74
|
+
*/
|
|
75
|
+
shouldHandleTurn(ctx: TurnGateContext): Promise<boolean>;
|
|
58
76
|
/**
|
|
59
77
|
* Announce the messages a compaction is folding into a summary to every plugin
|
|
60
78
|
* declaring {@link AgentPlugin.onMessagesDisplaced}. Pass it straight to
|
|
@@ -83,8 +101,15 @@ export interface CreateAgentRuntimeOptions {
|
|
|
83
101
|
* Verify that every secret and binding the plugins declared is actually
|
|
84
102
|
* present, given the Worker `env`. Off by default because core cannot know
|
|
85
103
|
* which of a consumer's bindings are optional; pass `env` to switch it on.
|
|
104
|
+
*
|
|
105
|
+
* Typed `object`, not `Record<string, unknown>`, and that is not looseness.
|
|
106
|
+
* `Env` is the ambient interface `wrangler types` generates into a consumer's
|
|
107
|
+
* `worker-configuration.d.ts`; an interface has no index signature, so it does
|
|
108
|
+
* not satisfy `Record<string, unknown>` and every consumer would have to cast
|
|
109
|
+
* their own `this.env` to pass it. Requiring a cast to opt into a *check* is
|
|
110
|
+
* how the check goes unused.
|
|
86
111
|
*/
|
|
87
|
-
env?:
|
|
112
|
+
env?: object;
|
|
88
113
|
}
|
|
89
114
|
/**
|
|
90
115
|
* Thrown when the installed plugins and the host disagree — a contract-version
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EACV,qBAAqB,EACrB,cAAc,EACf,MAAM,sBAA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