@tangle-network/agent-app 0.1.2 → 0.1.4
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/dist/billing/index.d.ts +94 -1
- package/dist/billing/index.js +3 -1
- package/dist/chunk-5RV6CAHZ.js +137 -0
- package/dist/chunk-5RV6CAHZ.js.map +1 -0
- package/dist/{chunk-7P6VIHI4.js → chunk-AQ2BOPOQ.js} +8 -2
- package/dist/{chunk-7P6VIHI4.js.map → chunk-AQ2BOPOQ.js.map} +1 -1
- package/dist/{chunk-45MYQ3GD.js → chunk-EAJSWUU5.js} +56 -1
- package/dist/chunk-EAJSWUU5.js.map +1 -0
- package/dist/chunk-EEPJGZJW.js +102 -0
- package/dist/chunk-EEPJGZJW.js.map +1 -0
- package/dist/chunk-EZXN67KE.js +318 -0
- package/dist/chunk-EZXN67KE.js.map +1 -0
- package/dist/{chunk-SIDR6BH3.js → chunk-ZJGY7OMZ.js} +47 -2
- package/dist/chunk-ZJGY7OMZ.js.map +1 -0
- package/dist/chunk-ZXNXAQAH.js +69 -0
- package/dist/chunk-ZXNXAQAH.js.map +1 -0
- package/dist/config/index.d.ts +367 -0
- package/dist/config/index.js +9 -0
- package/dist/config/index.js.map +1 -0
- package/dist/crypto/index.d.ts +36 -1
- package/dist/crypto/index.js +13 -3
- package/dist/delegation/index.d.ts +16 -1
- package/dist/delegation/index.js +5 -3
- package/dist/index.d.ts +10 -4
- package/dist/index.js +61 -9
- package/dist/knowledge/index.d.ts +90 -0
- package/dist/knowledge/index.js +9 -0
- package/dist/knowledge/index.js.map +1 -0
- package/dist/knowledge-loop/index.d.ts +208 -0
- package/dist/knowledge-loop/index.js +11 -0
- package/dist/knowledge-loop/index.js.map +1 -0
- package/dist/model-BOP69mVu.d.ts +35 -0
- package/dist/preset-cloudflare/index.d.ts +244 -0
- package/dist/preset-cloudflare/index.js +23 -0
- package/dist/preset-cloudflare/index.js.map +1 -0
- package/dist/runtime/index.d.ts +2 -35
- package/package.json +36 -5
- package/dist/chunk-45MYQ3GD.js.map +0 -1
- package/dist/chunk-SIDR6BH3.js.map +0 -1
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { KnowledgeRequirementSpec } from '../knowledge/index.js';
|
|
2
|
+
export { SatisfiedByRule } from '../knowledge/index.js';
|
|
3
|
+
import { T as TangleModelConfig } from '../model-BOP69mVu.js';
|
|
4
|
+
import '@tangle-network/agent-eval';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `@tangle-network/agent-app/config` — the typed `AgentAppConfig` contract.
|
|
8
|
+
*
|
|
9
|
+
* This is the single declarative DATA surface a coding agent fills to stand up a
|
|
10
|
+
* new agent product. Everything an agent product otherwise hand-rolls as
|
|
11
|
+
* imperative wiring — who the agent is, which proposal types exist and which are
|
|
12
|
+
* approval-gated, what knowledge the control loop requires, which integrations
|
|
13
|
+
* are connectable, how the model resolves — is expressed here as plain data the
|
|
14
|
+
* rest of agent-app's modules consume through their typed seams:
|
|
15
|
+
*
|
|
16
|
+
* - `identity` → the system-prompt + disclaimer surface the chat pipeline reads.
|
|
17
|
+
* - `taxonomy` → which `submit_proposal` types the `./tools` side channel
|
|
18
|
+
* accepts, and which the approval queue treats as regulated
|
|
19
|
+
* (certified-human-gated).
|
|
20
|
+
* - `knowledge` → the `./knowledge` requirement specs that gate the loop, plus
|
|
21
|
+
* the acquisition-loop goal/threshold the researcher pursues.
|
|
22
|
+
* - `integrations` → which `@tangle-network/agent-integrations` catalog kinds the
|
|
23
|
+
* product enables.
|
|
24
|
+
* - `ui` → whether the agent may emit generated UI (`render_ui`).
|
|
25
|
+
* - `model` → the `./runtime` `TangleModelConfig` (or null to resolve from env).
|
|
26
|
+
*
|
|
27
|
+
* Layering: this module is the CONTRACT only — pure types + an identity helper.
|
|
28
|
+
* It introduces no behavior and no engine dependency; it REUSES the existing
|
|
29
|
+
* `KnowledgeRequirementSpec`/`SatisfiedByRule` (from `../knowledge`) and
|
|
30
|
+
* `TangleModelConfig` (from `../runtime`) rather than redefining them, so the
|
|
31
|
+
* config a product authors is the exact shape those modules already consume.
|
|
32
|
+
* Steps that build the composer/loader read this file as the schema floor.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Who the agent is, as data. Composed into the chat pipeline's system prompt;
|
|
37
|
+
* never baked into agent-app (a domain value, per the layering contract).
|
|
38
|
+
*/
|
|
39
|
+
interface AgentIdentityConfig {
|
|
40
|
+
/** Product/agent name, e.g. `"WinFinance Ops Partner"`. Shown to the user and
|
|
41
|
+
* available to the system-prompt builder. */
|
|
42
|
+
name: string;
|
|
43
|
+
/** One-paragraph persona statement — the agent's role, voice, and remit. The
|
|
44
|
+
* spine of the system prompt. */
|
|
45
|
+
persona: string;
|
|
46
|
+
/** Additional system-prompt fragments appended verbatim after the persona
|
|
47
|
+
* (standing workflows, hard rules, tone). Order is preserved. Optional. */
|
|
48
|
+
systemPromptFragments?: string[];
|
|
49
|
+
/** Named disclaimers the product surfaces (e.g. a regulatory human-in-the-loop
|
|
50
|
+
* notice). Keyed by a stable id (`compliance`, `not-advice`, …) so the chat
|
|
51
|
+
* pipeline / UI can select one by name. Values are the literal text. Optional. */
|
|
52
|
+
disclaimers?: Record<string, string>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The proposal taxonomy, as data. `proposalTypes` is the closed set of
|
|
56
|
+
* `submit_proposal` types the `./tools` side channel accepts; `regulatedTypes`
|
|
57
|
+
* is the subset that is approval-gated — the executor refuses to run one without
|
|
58
|
+
* a certified human approver. `regulatedTypes` MUST be a subset of
|
|
59
|
+
* `proposalTypes` (validated by the loader step; not enforced at the type level).
|
|
60
|
+
*/
|
|
61
|
+
interface AgentTaxonomyConfig {
|
|
62
|
+
/** Every proposal type this product can emit, e.g.
|
|
63
|
+
* `['propose_swap', 'contact_lead', 'policy_change']`. The closed allow-list
|
|
64
|
+
* the tool layer validates a `submit_proposal` call against. */
|
|
65
|
+
proposalTypes: string[];
|
|
66
|
+
/** The subset of `proposalTypes` that is regulated → cannot execute without a
|
|
67
|
+
* certified-human approver. The approval executor reads this to decide which
|
|
68
|
+
* proposals are fail-loud certified-gated. */
|
|
69
|
+
regulatedTypes: string[];
|
|
70
|
+
}
|
|
71
|
+
/** A knowledge source the acquisition loop / researcher may draw on. */
|
|
72
|
+
interface KnowledgeSourceSpec {
|
|
73
|
+
/** Where the source lives — a URL, a `vault://` path, an integration ref, etc.
|
|
74
|
+
* Opaque to agent-app; the consumer's loader resolves it. */
|
|
75
|
+
uri: string;
|
|
76
|
+
/** Optional source classifier the researcher uses to pick a fetch strategy,
|
|
77
|
+
* e.g. `'web'`, `'vault'`, `'regulation'`, `'integration'`. Free-form. */
|
|
78
|
+
kind?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The knowledge-acquisition loop config — the goal the researcher pursues and
|
|
82
|
+
* the gate it must clear before the loop is considered satisfied. All optional;
|
|
83
|
+
* a product with only static requirement specs omits it.
|
|
84
|
+
*/
|
|
85
|
+
interface KnowledgeLoopConfig {
|
|
86
|
+
/** The acquisition goal in natural language, e.g.
|
|
87
|
+
* `"ground every quoted premium against a real policy record"`. */
|
|
88
|
+
goal?: string;
|
|
89
|
+
/** The minimum aggregate confidence [0, 1] the loop must reach to pass its
|
|
90
|
+
* gate. The runtime control loop blocks below this. Default decided by the
|
|
91
|
+
* consumer's loop wiring when omitted. */
|
|
92
|
+
minConfidence?: number;
|
|
93
|
+
/** How fresh acquired knowledge must be, e.g. `'static'`, `'7d'`, `'session'`.
|
|
94
|
+
* Free-form; the consumer's loop interprets it. */
|
|
95
|
+
freshness?: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The knowledge surface, as data. `sources` are what the researcher may read;
|
|
99
|
+
* `requirements` are the declarative `./knowledge` specs that gate the control
|
|
100
|
+
* loop (reused verbatim — the same `KnowledgeRequirementSpec` the gate scores);
|
|
101
|
+
* `loop` configures the acquisition pass.
|
|
102
|
+
*/
|
|
103
|
+
interface AgentKnowledgeConfig {
|
|
104
|
+
/** Sources the acquisition loop / researcher may draw on. */
|
|
105
|
+
sources: KnowledgeSourceSpec[];
|
|
106
|
+
/** The declarative requirement specs that gate the loop. Reuses
|
|
107
|
+
* `KnowledgeRequirementSpec` from `../knowledge` — `buildKnowledgeRequirements`
|
|
108
|
+
* + `deriveSignals` consume these directly. */
|
|
109
|
+
requirements: KnowledgeRequirementSpec[];
|
|
110
|
+
/** Optional acquisition-loop config (goal + confidence gate + freshness). */
|
|
111
|
+
loop?: KnowledgeLoopConfig;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Which integrations the product enables, as data. `enabled` lists
|
|
115
|
+
* `@tangle-network/agent-integrations` catalog kinds the product connects
|
|
116
|
+
* (e.g. `['shurens', 'lead-crm', 'whatsapp']`); the integration hub resolves
|
|
117
|
+
* each to a connector. Strings, not connector objects — agent-app bakes no
|
|
118
|
+
* catalog value.
|
|
119
|
+
*/
|
|
120
|
+
interface AgentIntegrationsConfig {
|
|
121
|
+
/** Catalog kinds this product enables. */
|
|
122
|
+
enabled: string[];
|
|
123
|
+
}
|
|
124
|
+
/** UI capability flags, as data. */
|
|
125
|
+
interface AgentUiConfig {
|
|
126
|
+
/** Whether the agent may emit generated UI (the `render_ui` / OpenUI side
|
|
127
|
+
* channel). When false/omitted, the tool layer can omit/refuse the tool.
|
|
128
|
+
* Default behavior decided by the consumer; omit to leave unset. */
|
|
129
|
+
generatedUi?: boolean;
|
|
130
|
+
}
|
|
131
|
+
/** Background-agent / delegated-loop capability, as data. */
|
|
132
|
+
interface AgentDelegationConfig {
|
|
133
|
+
/** When true, the app's own agent may spawn `delegate_research` /
|
|
134
|
+
* `delegate_code` loops that run to completion in their OWN sandbox and
|
|
135
|
+
* return the artifact (the `../delegation` driven-loop MCP). Sandbox-path
|
|
136
|
+
* ONLY — the browser/edge path ignores it. Wired via the existing
|
|
137
|
+
* `buildDelegationMcpServer`; never reimplemented. */
|
|
138
|
+
enabled?: boolean;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The declarative domain surface of a Tangle agent product.
|
|
142
|
+
*
|
|
143
|
+
* A coding agent fills THIS object and nothing else to define a product's
|
|
144
|
+
* identity, proposal taxonomy, knowledge gate, integrations, UI capability, and
|
|
145
|
+
* model. Every field is DATA consumed by an agent-app module through its typed
|
|
146
|
+
* seam — no field is behavior. Author it through {@link defineAgentApp} for
|
|
147
|
+
* autocomplete and a single import.
|
|
148
|
+
*/
|
|
149
|
+
interface AgentAppConfig {
|
|
150
|
+
/** Who the agent is — name, persona, system-prompt fragments, disclaimers. */
|
|
151
|
+
identity: AgentIdentityConfig;
|
|
152
|
+
/** Proposal types + which are regulated/approval-gated. */
|
|
153
|
+
taxonomy: AgentTaxonomyConfig;
|
|
154
|
+
/** Knowledge sources, requirement specs (the loop gate), and loop config. */
|
|
155
|
+
knowledge: AgentKnowledgeConfig;
|
|
156
|
+
/** Enabled integration catalog kinds. */
|
|
157
|
+
integrations: AgentIntegrationsConfig;
|
|
158
|
+
/** UI capability flags. Optional. */
|
|
159
|
+
ui?: AgentUiConfig;
|
|
160
|
+
/** Background-agent / delegated-loop capability (sandbox path). Optional. */
|
|
161
|
+
delegation?: AgentDelegationConfig;
|
|
162
|
+
/** The resolved model config (`../runtime`'s `TangleModelConfig`). Omit to
|
|
163
|
+
* resolve from env at boot via `resolveTangleModelConfig`. */
|
|
164
|
+
model?: TangleModelConfig;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Identity helper: returns its argument unchanged, but anchors inference so a
|
|
168
|
+
* coding agent authoring a config gets full autocomplete + type-checking from a
|
|
169
|
+
* single import. The canonical way to declare a product config:
|
|
170
|
+
*
|
|
171
|
+
* ```ts
|
|
172
|
+
* import { defineAgentApp } from '@tangle-network/agent-app/config'
|
|
173
|
+
*
|
|
174
|
+
* export const config = defineAgentApp({
|
|
175
|
+
* identity: { name: 'WinFinance', persona: '…' },
|
|
176
|
+
* taxonomy: { proposalTypes: ['propose_swap'], regulatedTypes: ['propose_swap'] },
|
|
177
|
+
* knowledge: { sources: [], requirements: [] },
|
|
178
|
+
* integrations: { enabled: ['shurens'] },
|
|
179
|
+
* })
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
declare function defineAgentApp<const T extends AgentAppConfig>(config: T): T;
|
|
183
|
+
/**
|
|
184
|
+
* Machine-readable JSON Schema (draft 2020-12) for {@link AgentAppConfig}.
|
|
185
|
+
*
|
|
186
|
+
* The schema FLOOR a non-TypeScript coding agent (or a config validator/UI) reads
|
|
187
|
+
* to know the shape without parsing the `.d.ts`. Kept in lockstep with the
|
|
188
|
+
* interfaces above by the config test, which asserts the documented fields are
|
|
189
|
+
* present. `KnowledgeRequirementSpec`'s full sub-shape is intentionally left
|
|
190
|
+
* `additionalProperties: true` here — its authoritative definition lives in
|
|
191
|
+
* `../knowledge`; this floor pins only the fields the config contract owns.
|
|
192
|
+
*/
|
|
193
|
+
declare const agentAppConfigJsonSchema: {
|
|
194
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
195
|
+
readonly $id: "https://tangle.tools/schemas/agent-app-config.json";
|
|
196
|
+
readonly title: "AgentAppConfig";
|
|
197
|
+
readonly description: "The declarative domain surface of a Tangle agent product.";
|
|
198
|
+
readonly type: "object";
|
|
199
|
+
readonly additionalProperties: false;
|
|
200
|
+
readonly required: readonly ["identity", "taxonomy", "knowledge", "integrations"];
|
|
201
|
+
readonly properties: {
|
|
202
|
+
readonly identity: {
|
|
203
|
+
readonly type: "object";
|
|
204
|
+
readonly additionalProperties: false;
|
|
205
|
+
readonly required: readonly ["name", "persona"];
|
|
206
|
+
readonly properties: {
|
|
207
|
+
readonly name: {
|
|
208
|
+
readonly type: "string";
|
|
209
|
+
readonly description: "Product/agent name.";
|
|
210
|
+
};
|
|
211
|
+
readonly persona: {
|
|
212
|
+
readonly type: "string";
|
|
213
|
+
readonly description: "One-paragraph persona — the system-prompt spine.";
|
|
214
|
+
};
|
|
215
|
+
readonly systemPromptFragments: {
|
|
216
|
+
readonly type: "array";
|
|
217
|
+
readonly items: {
|
|
218
|
+
readonly type: "string";
|
|
219
|
+
};
|
|
220
|
+
readonly description: "Verbatim system-prompt fragments appended after the persona, in order.";
|
|
221
|
+
};
|
|
222
|
+
readonly disclaimers: {
|
|
223
|
+
readonly type: "object";
|
|
224
|
+
readonly additionalProperties: {
|
|
225
|
+
readonly type: "string";
|
|
226
|
+
};
|
|
227
|
+
readonly description: "Named disclaimers keyed by stable id; values are literal text.";
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
readonly taxonomy: {
|
|
232
|
+
readonly type: "object";
|
|
233
|
+
readonly additionalProperties: false;
|
|
234
|
+
readonly required: readonly ["proposalTypes", "regulatedTypes"];
|
|
235
|
+
readonly properties: {
|
|
236
|
+
readonly proposalTypes: {
|
|
237
|
+
readonly type: "array";
|
|
238
|
+
readonly items: {
|
|
239
|
+
readonly type: "string";
|
|
240
|
+
};
|
|
241
|
+
readonly description: "Closed allow-list of proposal types the product can emit.";
|
|
242
|
+
};
|
|
243
|
+
readonly regulatedTypes: {
|
|
244
|
+
readonly type: "array";
|
|
245
|
+
readonly items: {
|
|
246
|
+
readonly type: "string";
|
|
247
|
+
};
|
|
248
|
+
readonly description: "Subset of proposalTypes that is approval-gated (certified-human required).";
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
readonly knowledge: {
|
|
253
|
+
readonly type: "object";
|
|
254
|
+
readonly additionalProperties: false;
|
|
255
|
+
readonly required: readonly ["sources", "requirements"];
|
|
256
|
+
readonly properties: {
|
|
257
|
+
readonly sources: {
|
|
258
|
+
readonly type: "array";
|
|
259
|
+
readonly description: "Sources the acquisition loop may draw on.";
|
|
260
|
+
readonly items: {
|
|
261
|
+
readonly type: "object";
|
|
262
|
+
readonly additionalProperties: false;
|
|
263
|
+
readonly required: readonly ["uri"];
|
|
264
|
+
readonly properties: {
|
|
265
|
+
readonly uri: {
|
|
266
|
+
readonly type: "string";
|
|
267
|
+
readonly description: "Where the source lives (opaque to agent-app).";
|
|
268
|
+
};
|
|
269
|
+
readonly kind: {
|
|
270
|
+
readonly type: "string";
|
|
271
|
+
readonly description: "Optional source classifier (web/vault/regulation/…).";
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
readonly requirements: {
|
|
277
|
+
readonly type: "array";
|
|
278
|
+
readonly description: "Declarative KnowledgeRequirementSpec[] (../knowledge) that gate the loop.";
|
|
279
|
+
readonly items: {
|
|
280
|
+
readonly type: "object";
|
|
281
|
+
readonly additionalProperties: true;
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
readonly loop: {
|
|
285
|
+
readonly type: "object";
|
|
286
|
+
readonly additionalProperties: false;
|
|
287
|
+
readonly description: "Acquisition-loop config.";
|
|
288
|
+
readonly properties: {
|
|
289
|
+
readonly goal: {
|
|
290
|
+
readonly type: "string";
|
|
291
|
+
readonly description: "Acquisition goal in natural language.";
|
|
292
|
+
};
|
|
293
|
+
readonly minConfidence: {
|
|
294
|
+
readonly type: "number";
|
|
295
|
+
readonly minimum: 0;
|
|
296
|
+
readonly maximum: 1;
|
|
297
|
+
readonly description: "Minimum aggregate confidence the loop must reach.";
|
|
298
|
+
};
|
|
299
|
+
readonly freshness: {
|
|
300
|
+
readonly type: "string";
|
|
301
|
+
readonly description: "How fresh acquired knowledge must be.";
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
readonly integrations: {
|
|
308
|
+
readonly type: "object";
|
|
309
|
+
readonly additionalProperties: false;
|
|
310
|
+
readonly required: readonly ["enabled"];
|
|
311
|
+
readonly properties: {
|
|
312
|
+
readonly enabled: {
|
|
313
|
+
readonly type: "array";
|
|
314
|
+
readonly items: {
|
|
315
|
+
readonly type: "string";
|
|
316
|
+
};
|
|
317
|
+
readonly description: "Enabled agent-integrations catalog kinds.";
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
readonly ui: {
|
|
322
|
+
readonly type: "object";
|
|
323
|
+
readonly additionalProperties: false;
|
|
324
|
+
readonly description: "UI capability flags.";
|
|
325
|
+
readonly properties: {
|
|
326
|
+
readonly generatedUi: {
|
|
327
|
+
readonly type: "boolean";
|
|
328
|
+
readonly description: "Whether the agent may emit generated UI.";
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
};
|
|
332
|
+
readonly delegation: {
|
|
333
|
+
readonly type: "object";
|
|
334
|
+
readonly additionalProperties: false;
|
|
335
|
+
readonly description: "Background-agent / delegated-loop capability (sandbox path).";
|
|
336
|
+
readonly properties: {
|
|
337
|
+
readonly enabled: {
|
|
338
|
+
readonly type: "boolean";
|
|
339
|
+
readonly description: "Whether the agent may spawn delegate_research/delegate_code loops.";
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
readonly model: {
|
|
344
|
+
readonly type: "object";
|
|
345
|
+
readonly additionalProperties: false;
|
|
346
|
+
readonly description: "Resolved TangleModelConfig (../runtime). Omit to resolve from env.";
|
|
347
|
+
readonly required: readonly ["provider", "model", "apiKey", "baseUrl"];
|
|
348
|
+
readonly properties: {
|
|
349
|
+
readonly provider: {
|
|
350
|
+
readonly type: "string";
|
|
351
|
+
readonly enum: readonly ["openai-compat", "anthropic"];
|
|
352
|
+
};
|
|
353
|
+
readonly model: {
|
|
354
|
+
readonly type: "string";
|
|
355
|
+
};
|
|
356
|
+
readonly apiKey: {
|
|
357
|
+
readonly type: "string";
|
|
358
|
+
};
|
|
359
|
+
readonly baseUrl: {
|
|
360
|
+
readonly type: "string";
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
export { type AgentAppConfig, type AgentDelegationConfig, type AgentIdentityConfig, type AgentIntegrationsConfig, type AgentKnowledgeConfig, type AgentTaxonomyConfig, type AgentUiConfig, type KnowledgeLoopConfig, KnowledgeRequirementSpec, type KnowledgeSourceSpec, TangleModelConfig, agentAppConfigJsonSchema, defineAgentApp };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/crypto/index.d.ts
CHANGED
|
@@ -23,5 +23,40 @@ declare function createFieldCrypto(key: string | (() => string)): {
|
|
|
23
23
|
encrypt(s: string): Promise<string>;
|
|
24
24
|
decrypt(s: string): Promise<string>;
|
|
25
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* --- Passphrase-derived key path (PBKDF2 → AES-256-GCM CryptoKey) ---
|
|
28
|
+
*
|
|
29
|
+
* The `encryptAesGcm`/`decryptAesGcm` path takes a raw 64-char-hex key. Some
|
|
30
|
+
* products instead bind a SECRET STRING (not a hex key) and derive the AES key
|
|
31
|
+
* with PBKDF2 — and need a BINARY path (encrypting document bytes, not just
|
|
32
|
+
* strings). Both are exposed here so a product never hand-rolls WebCrypto.
|
|
33
|
+
*
|
|
34
|
+
* The derivation parameters (salt, iterations) are PARAMETERS — a product pins
|
|
35
|
+
* its own so the derived key bytes stay stable for data already at rest. The
|
|
36
|
+
* default salt/iterations match the historical tax-agent contract, but any
|
|
37
|
+
* product supplies its own via {@link DeriveKeyOptions}.
|
|
38
|
+
*/
|
|
39
|
+
interface DeriveKeyOptions {
|
|
40
|
+
/** PBKDF2 salt. A product MUST pin this — changing it changes the derived key
|
|
41
|
+
* bytes and orphans every value already encrypted at rest. */
|
|
42
|
+
salt: Uint8Array | string;
|
|
43
|
+
/** PBKDF2 iteration count. Pin it for the same reason as `salt`. */
|
|
44
|
+
iterations: number;
|
|
45
|
+
/** PBKDF2 hash. Default `'SHA-256'`. */
|
|
46
|
+
hash?: 'SHA-256' | 'SHA-384' | 'SHA-512';
|
|
47
|
+
}
|
|
48
|
+
/** Derive an AES-256-GCM `CryptoKey` from a secret string via PBKDF2. The key is
|
|
49
|
+
* non-extractable and usable only for encrypt/decrypt. */
|
|
50
|
+
declare function deriveKey(secret: string, opts: DeriveKeyOptions): Promise<CryptoKey>;
|
|
51
|
+
/** Encrypt `plaintext` under a derived `CryptoKey`. Returns base64(iv ‖ ct ‖ tag). */
|
|
52
|
+
declare function encryptWithKey(plaintext: string, key: CryptoKey): Promise<string>;
|
|
53
|
+
/** Decrypt a base64(iv ‖ ct ‖ tag) string under a derived `CryptoKey`. */
|
|
54
|
+
declare function decryptWithKey(encoded: string, key: CryptoKey): Promise<string>;
|
|
55
|
+
/** Encrypt binary data under a derived `CryptoKey`. Returns an ArrayBuffer:
|
|
56
|
+
* 12-byte IV ‖ ciphertext ‖ 16-byte GCM tag (same wire layout as the string
|
|
57
|
+
* path, raw bytes instead of base64). */
|
|
58
|
+
declare function encryptBytes(data: ArrayBuffer, key: CryptoKey): Promise<ArrayBuffer>;
|
|
59
|
+
/** Decrypt binary data (IV ‖ ciphertext ‖ tag) under a derived `CryptoKey`. */
|
|
60
|
+
declare function decryptBytes(data: ArrayBuffer, key: CryptoKey): Promise<ArrayBuffer>;
|
|
26
61
|
|
|
27
|
-
export { createFieldCrypto, decodeHexKey, decryptAesGcm, encryptAesGcm };
|
|
62
|
+
export { type DeriveKeyOptions, createFieldCrypto, decodeHexKey, decryptAesGcm, decryptBytes, decryptWithKey, deriveKey, encryptAesGcm, encryptBytes, encryptWithKey };
|
package/dist/crypto/index.js
CHANGED
|
@@ -2,12 +2,22 @@ import {
|
|
|
2
2
|
createFieldCrypto,
|
|
3
3
|
decodeHexKey,
|
|
4
4
|
decryptAesGcm,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
decryptBytes,
|
|
6
|
+
decryptWithKey,
|
|
7
|
+
deriveKey,
|
|
8
|
+
encryptAesGcm,
|
|
9
|
+
encryptBytes,
|
|
10
|
+
encryptWithKey
|
|
11
|
+
} from "../chunk-ZJGY7OMZ.js";
|
|
7
12
|
export {
|
|
8
13
|
createFieldCrypto,
|
|
9
14
|
decodeHexKey,
|
|
10
15
|
decryptAesGcm,
|
|
11
|
-
|
|
16
|
+
decryptBytes,
|
|
17
|
+
decryptWithKey,
|
|
18
|
+
deriveKey,
|
|
19
|
+
encryptAesGcm,
|
|
20
|
+
encryptBytes,
|
|
21
|
+
encryptWithKey
|
|
12
22
|
};
|
|
13
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -46,5 +46,20 @@ interface BuildDelegationOptions {
|
|
|
46
46
|
* const mcp = { ...(delegation ? { [DELEGATION_MCP_SERVER_KEY]: delegation } : {}) }
|
|
47
47
|
*/
|
|
48
48
|
declare function buildDelegationMcpServer(opts: BuildDelegationOptions): DelegationMcpServer | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Config-driven wiring: returns the delegation MCP entry keyed under
|
|
51
|
+
* {@link DELEGATION_MCP_SERVER_KEY} when the product's `config.delegation.enabled`
|
|
52
|
+
* is true (and a platform key is available), else an empty object. Spread the
|
|
53
|
+
* result directly into the sandbox profile's `mcp` map — this is the seam
|
|
54
|
+
* `agent.config.delegation` flows through, so a coding agent toggles background
|
|
55
|
+
* agents/loops by flipping one boolean, never by wiring the MCP by hand.
|
|
56
|
+
*
|
|
57
|
+
* const mcp = { ...rest, ...delegationMcpForConfig(config, { apiKey: env.TANGLE_API_KEY, forwardEnv: env }) }
|
|
58
|
+
*/
|
|
59
|
+
declare function delegationMcpForConfig(config: {
|
|
60
|
+
delegation?: {
|
|
61
|
+
enabled?: boolean;
|
|
62
|
+
};
|
|
63
|
+
}, opts: BuildDelegationOptions): Record<string, DelegationMcpServer>;
|
|
49
64
|
|
|
50
|
-
export { type BuildDelegationOptions, DELEGATION_MCP_SERVER_KEY, DELEGATION_TOOLS, type DelegationMcpServer, buildDelegationMcpServer };
|
|
65
|
+
export { type BuildDelegationOptions, DELEGATION_MCP_SERVER_KEY, DELEGATION_TOOLS, type DelegationMcpServer, buildDelegationMcpServer, delegationMcpForConfig };
|
package/dist/delegation/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DELEGATION_MCP_SERVER_KEY,
|
|
3
3
|
DELEGATION_TOOLS,
|
|
4
|
-
buildDelegationMcpServer
|
|
5
|
-
|
|
4
|
+
buildDelegationMcpServer,
|
|
5
|
+
delegationMcpForConfig
|
|
6
|
+
} from "../chunk-AQ2BOPOQ.js";
|
|
6
7
|
export {
|
|
7
8
|
DELEGATION_MCP_SERVER_KEY,
|
|
8
9
|
DELEGATION_TOOLS,
|
|
9
|
-
buildDelegationMcpServer
|
|
10
|
+
buildDelegationMcpServer,
|
|
11
|
+
delegationMcpForConfig
|
|
10
12
|
};
|
|
11
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
export { APP_TOOL_NAMES, AppToolMcpServer, AppToolName, AppToolRuntimeExecutor, AuthenticateOptions, BuildHttpMcpServerOptions, BuildMcpServerOptions, CapabilityTokenOptions, DEFAULT_APP_TOOL_PATHS, DEFAULT_HEADER_NAMES, DispatchOptions, HandleToolRequestOptions, OpenAIFunctionTool, RuntimeExecutorOptions, ToolAuthResult, ToolHeaderNames, ToolInputError, authenticateToolRequest, buildAppToolMcpServer, buildAppToolOpenAITools, buildHttpMcpServer, createAppToolRuntimeExecutor, createCapabilityToken, dispatchAppTool, handleAppToolRequest, isAppToolName, outcomeStatus, readToolArgs, verifyCapabilityToken } from './tools/index.js';
|
|
2
2
|
export { A as AddCitationArgs, a as AddCitationResult, b as AppToolContext, c as AppToolHandlers, d as AppToolOutcome, e as AppToolProducedEvent, f as AppToolTaxonomy, R as RenderUiArgs, g as RenderUiResult, S as ScheduleFollowupArgs, h as ScheduleFollowupResult, i as SubmitProposalArgs, j as SubmitProposalResult } from './types-CeWor4bQ.js';
|
|
3
|
-
export { BuildDelegationOptions, DELEGATION_MCP_SERVER_KEY, DELEGATION_TOOLS, DelegationMcpServer, buildDelegationMcpServer } from './delegation/index.js';
|
|
3
|
+
export { BuildDelegationOptions, DELEGATION_MCP_SERVER_KEY, DELEGATION_TOOLS, DelegationMcpServer, buildDelegationMcpServer, delegationMcpForConfig } from './delegation/index.js';
|
|
4
4
|
export { BrokerToken, BrokerTokenMinter, BrokerTokenProvider, BrokerTokenProviderOptions, ConsentUrlInput, buildConsentUrl, createBrokerTokenProvider } from './tangle/index.js';
|
|
5
|
-
export { AppToolLoopOptions,
|
|
5
|
+
export { AppToolLoopOptions, LoopEvent, LoopToolCall, OpenAICompatStreamTurnOptions, OpenAIStreamChunk, StreamAppToolLoopOptions, StreamLoopYield, ToolLoopResult, createOpenAICompatStreamTurn, runAppToolLoop, streamAppToolLoop, toLoopEvents } from './runtime/index.js';
|
|
6
6
|
export { createTokenRecallChecker, producedFromToolEvents } from './eval/index.js';
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
7
|
+
export { KnowledgeRequirementSpec, KnowledgeSignal, KnowledgeStateAccessor, SatisfiedByRule, buildKnowledgeRequirements, deriveSignals } from './knowledge/index.js';
|
|
8
|
+
export { CreateKnowledgeLoopDeps, KnowledgeCandidate, KnowledgeDecider, KnowledgeDeciderInput, KnowledgeDecision, KnowledgeGateVerdict, KnowledgeLoop, KnowledgeLoopDriver, createKnowledgeLoop, createReviewerDecider, reviewCandidate } from './knowledge-loop/index.js';
|
|
9
|
+
export { AgentAppConfig, AgentDelegationConfig, AgentIdentityConfig, AgentIntegrationsConfig, AgentKnowledgeConfig, AgentTaxonomyConfig, AgentUiConfig, KnowledgeLoopConfig, KnowledgeSourceSpec, agentAppConfigJsonSchema, defineAgentApp } from './config/index.js';
|
|
10
|
+
export { D1Like, D1PreparedLike, DrizzleColumnLike, DrizzleSqliteCoreLike, PRESET_MIGRATION_SQL, PRESET_TABLES, PresetBillingOptions, PresetKnowledgeAccessorOptions, PresetToolHandlerOptions, VaultKv, createD1KnowledgeStateAccessor, createPresetDrizzleSchema, createPresetFieldCrypto, createPresetToolHandlers, createPresetWorkspaceKeyManager, createPresetWorkspaceKeyStore } from './preset-cloudflare/index.js';
|
|
11
|
+
export { KeyCrypto, KeyProvisioner, PlanLimit, PlatformBalanceInfo, PlatformBalanceManager, PlatformBalanceManagerOptions, PlatformBillingClient, PlatformIdentity, PlatformProductUsage, SharedBillingState, WorkspaceKeyManager, WorkspaceKeyManagerOptions, WorkspaceKeyRecord, WorkspaceKeyStore, WorkspaceModelKeyUsage, createPlatformBalanceManager, createWorkspaceKeyManager } from './billing/index.js';
|
|
12
|
+
export { DeriveKeyOptions, createFieldCrypto, decodeHexKey, decryptAesGcm, decryptBytes, decryptWithKey, deriveKey, encryptAesGcm, encryptBytes, encryptWithKey } from './crypto/index.js';
|
|
9
13
|
export { JsonRecord, PersistedChatMessageForTurn, ResolvedChatTurn, StreamEvent, asRecord, asString, buildUserTextParts, encodeEvent, finalizeAssistantParts, getPartKey, mergePersistedPart, messageHasTurnId, normalizeClientTurnId, normalizePersistedPart, normalizeTime, normalizeToolEvent, resolveChatTurn, resolveToolId, resolveToolName } from './stream/index.js';
|
|
10
14
|
export { HubExecClient, HubExecClientOptions, HubExecErrorCode, HubExecResult, HubInvokeDeps, HubInvokeInput, HubInvokeOutcome, ParsedIntegrationAction, invokeIntegrationHub, resolveIntegrationAction } from './integrations/index.js';
|
|
11
15
|
export { JsonObject, KvLike, RateLimitResult, RequestContext, SecurityHeaderOptions, addSecurityHeaders, checkRateLimit, extractRequestContext, parseJsonObjectBody, requireString } from './web/index.js';
|
|
12
16
|
export { redactForIngestion } from './redact/index.js';
|
|
13
17
|
export { CompletionRequirement, CompletionVerdict, CorrectnessChecker, ProducedState, RuntimeEventLike, SatisfiedBy, TaskGold, createLlmCorrectnessChecker, extractProducedState, verifyCompletion, weightedComposite } from '@tangle-network/agent-eval';
|
|
18
|
+
export { D as DEFAULT_TANGLE_ROUTER_BASE_URL, R as ResolveModelOptions, T as TangleModelConfig, r as resolveTangleModelConfig } from './model-BOP69mVu.js';
|
|
19
|
+
import '@tangle-network/agent-knowledge';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
agentAppConfigJsonSchema,
|
|
3
|
+
defineAgentApp
|
|
4
|
+
} from "./chunk-5RV6CAHZ.js";
|
|
5
|
+
import {
|
|
6
|
+
PRESET_MIGRATION_SQL,
|
|
7
|
+
PRESET_TABLES,
|
|
8
|
+
createD1KnowledgeStateAccessor,
|
|
9
|
+
createPresetDrizzleSchema,
|
|
10
|
+
createPresetFieldCrypto,
|
|
11
|
+
createPresetToolHandlers,
|
|
12
|
+
createPresetWorkspaceKeyManager,
|
|
13
|
+
createPresetWorkspaceKeyStore
|
|
14
|
+
} from "./chunk-EZXN67KE.js";
|
|
15
|
+
import {
|
|
16
|
+
createPlatformBalanceManager,
|
|
17
|
+
createWorkspaceKeyManager
|
|
18
|
+
} from "./chunk-EAJSWUU5.js";
|
|
19
|
+
import {
|
|
20
|
+
createFieldCrypto,
|
|
21
|
+
decodeHexKey,
|
|
22
|
+
decryptAesGcm,
|
|
23
|
+
decryptBytes,
|
|
24
|
+
decryptWithKey,
|
|
25
|
+
deriveKey,
|
|
26
|
+
encryptAesGcm,
|
|
27
|
+
encryptBytes,
|
|
28
|
+
encryptWithKey
|
|
29
|
+
} from "./chunk-ZJGY7OMZ.js";
|
|
1
30
|
import {
|
|
2
31
|
asRecord,
|
|
3
32
|
asString,
|
|
@@ -51,8 +80,9 @@ import {
|
|
|
51
80
|
import {
|
|
52
81
|
DELEGATION_MCP_SERVER_KEY,
|
|
53
82
|
DELEGATION_TOOLS,
|
|
54
|
-
buildDelegationMcpServer
|
|
55
|
-
|
|
83
|
+
buildDelegationMcpServer,
|
|
84
|
+
delegationMcpForConfig
|
|
85
|
+
} from "./chunk-AQ2BOPOQ.js";
|
|
56
86
|
import {
|
|
57
87
|
buildConsentUrl,
|
|
58
88
|
createBrokerTokenProvider
|
|
@@ -74,14 +104,14 @@ import {
|
|
|
74
104
|
weightedComposite
|
|
75
105
|
} from "./chunk-4NXVI7PW.js";
|
|
76
106
|
import {
|
|
77
|
-
|
|
78
|
-
|
|
107
|
+
buildKnowledgeRequirements,
|
|
108
|
+
deriveSignals
|
|
109
|
+
} from "./chunk-ZXNXAQAH.js";
|
|
79
110
|
import {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
} from "./chunk-SIDR6BH3.js";
|
|
111
|
+
createKnowledgeLoop,
|
|
112
|
+
createReviewerDecider,
|
|
113
|
+
reviewCandidate
|
|
114
|
+
} from "./chunk-EEPJGZJW.js";
|
|
85
115
|
export {
|
|
86
116
|
APP_TOOL_NAMES,
|
|
87
117
|
DEFAULT_APP_TOOL_PATHS,
|
|
@@ -90,8 +120,11 @@ export {
|
|
|
90
120
|
DELEGATION_MCP_SERVER_KEY,
|
|
91
121
|
DELEGATION_TOOLS,
|
|
92
122
|
HubExecClient,
|
|
123
|
+
PRESET_MIGRATION_SQL,
|
|
124
|
+
PRESET_TABLES,
|
|
93
125
|
ToolInputError,
|
|
94
126
|
addSecurityHeaders,
|
|
127
|
+
agentAppConfigJsonSchema,
|
|
95
128
|
asRecord,
|
|
96
129
|
asString,
|
|
97
130
|
authenticateToolRequest,
|
|
@@ -100,21 +133,39 @@ export {
|
|
|
100
133
|
buildConsentUrl,
|
|
101
134
|
buildDelegationMcpServer,
|
|
102
135
|
buildHttpMcpServer,
|
|
136
|
+
buildKnowledgeRequirements,
|
|
103
137
|
buildUserTextParts,
|
|
104
138
|
checkRateLimit,
|
|
105
139
|
createAppToolRuntimeExecutor,
|
|
106
140
|
createBrokerTokenProvider,
|
|
107
141
|
createCapabilityToken,
|
|
142
|
+
createD1KnowledgeStateAccessor,
|
|
108
143
|
createFieldCrypto,
|
|
144
|
+
createKnowledgeLoop,
|
|
109
145
|
createLlmCorrectnessChecker,
|
|
110
146
|
createOpenAICompatStreamTurn,
|
|
147
|
+
createPlatformBalanceManager,
|
|
148
|
+
createPresetDrizzleSchema,
|
|
149
|
+
createPresetFieldCrypto,
|
|
150
|
+
createPresetToolHandlers,
|
|
151
|
+
createPresetWorkspaceKeyManager,
|
|
152
|
+
createPresetWorkspaceKeyStore,
|
|
153
|
+
createReviewerDecider,
|
|
111
154
|
createTokenRecallChecker,
|
|
112
155
|
createWorkspaceKeyManager,
|
|
113
156
|
decodeHexKey,
|
|
114
157
|
decryptAesGcm,
|
|
158
|
+
decryptBytes,
|
|
159
|
+
decryptWithKey,
|
|
160
|
+
defineAgentApp,
|
|
161
|
+
delegationMcpForConfig,
|
|
162
|
+
deriveKey,
|
|
163
|
+
deriveSignals,
|
|
115
164
|
dispatchAppTool,
|
|
116
165
|
encodeEvent,
|
|
117
166
|
encryptAesGcm,
|
|
167
|
+
encryptBytes,
|
|
168
|
+
encryptWithKey,
|
|
118
169
|
extractProducedState,
|
|
119
170
|
extractRequestContext,
|
|
120
171
|
finalizeAssistantParts,
|
|
@@ -139,6 +190,7 @@ export {
|
|
|
139
190
|
resolveTangleModelConfig,
|
|
140
191
|
resolveToolId,
|
|
141
192
|
resolveToolName,
|
|
193
|
+
reviewCandidate,
|
|
142
194
|
runAppToolLoop,
|
|
143
195
|
streamAppToolLoop,
|
|
144
196
|
toLoopEvents,
|