@tangle-network/agent-app 0.14.0 → 0.16.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/dist/{DesignCanvas-3JEEIT6Y.js → DesignCanvas-JTSAL6KX.js} +2 -2
- package/dist/DesignCanvasEditor-YPVETLZG.js +9 -0
- package/dist/{chunk-F5KTWRO7.js → chunk-2W4YCAFH.js} +5 -1
- package/dist/chunk-2W4YCAFH.js.map +1 -0
- package/dist/{chunk-4NXVI7PW.js → chunk-FA4XR66Y.js} +2 -2
- package/dist/chunk-FA4XR66Y.js.map +1 -0
- package/dist/{chunk-QAQBR6KQ.js → chunk-JZZ6AWF4.js} +3 -2
- package/dist/{chunk-QAQBR6KQ.js.map → chunk-JZZ6AWF4.js.map} +1 -1
- package/dist/{chunk-ETX4O4BB.js → chunk-LUE4HO5C.js} +95 -177
- package/dist/chunk-LUE4HO5C.js.map +1 -0
- package/dist/{chunk-SSX2A6XX.js → chunk-MH6AVXQ7.js} +2 -2
- package/dist/{chunk-2Q73HGDI.js → chunk-NSKJFV4Y.js} +17 -5
- package/dist/chunk-NSKJFV4Y.js.map +1 -0
- package/dist/design-canvas/index.d.ts +2 -2
- package/dist/design-canvas-react/index.d.ts +16 -2
- package/dist/design-canvas-react/index.js +4 -4
- package/dist/eval/index.d.ts +1 -1
- package/dist/eval/index.js +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +10 -8
- package/dist/{mcp-CIupfjxV.d.ts → mcp-eZCmkgCF.d.ts} +1 -1
- package/dist/preset-cloudflare/index.d.ts +1 -1
- package/dist/runtime/index.d.ts +94 -161
- package/dist/runtime/index.js +8 -6
- package/dist/sequences/index.d.ts +2 -2
- package/dist/tools/index.d.ts +4 -4
- package/dist/tools/index.js +2 -2
- package/dist/{types-By4B3K37.d.ts → types-2rOJo8Hc.d.ts} +6 -3
- package/package.json +5 -4
- package/dist/DesignCanvasEditor-37LPJIIR.js +0 -9
- package/dist/chunk-2Q73HGDI.js.map +0 -1
- package/dist/chunk-4NXVI7PW.js.map +0 -1
- package/dist/chunk-ETX4O4BB.js.map +0 -1
- package/dist/chunk-F5KTWRO7.js.map +0 -1
- /package/dist/{DesignCanvas-3JEEIT6Y.js.map → DesignCanvas-JTSAL6KX.js.map} +0 -0
- /package/dist/{DesignCanvasEditor-37LPJIIR.js.map → DesignCanvasEditor-YPVETLZG.js.map} +0 -0
- /package/dist/{chunk-SSX2A6XX.js.map → chunk-MH6AVXQ7.js.map} +0 -0
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import * as _tangle_network_agent_runtime from '@tangle-network/agent-runtime';
|
|
2
|
+
import { ToolLoopMessage, ToolLoopResult, StreamToolLoopYield, ToolLoopCall } from '@tangle-network/agent-runtime';
|
|
3
|
+
export { RunToolLoopOptions as AppToolLoopOptions, ToolLoopAssistantToolCall as LoopAssistantToolCall, ToolLoopMessage as LoopMessage, ToolLoopCall as LoopToolCall, StreamToolLoopOptions as StreamAppToolLoopOptions, StreamToolLoopYield as StreamLoopYield, ToolLoopEvent, ToolLoopResult, ToolLoopStopReason, runToolLoop as runAppToolLoop, streamToolLoop as streamAppToolLoop } from '@tangle-network/agent-runtime';
|
|
1
4
|
export { C as CatalogModel, M as ModelCatalog, R as RouterModel, _ as __resetCatalogCache, b as buildCatalog, f as fetchModelCatalog, n as normalizeModelId } from '../model-catalog-BEAEVDaa.js';
|
|
2
5
|
export { C as CreateTangleRouterModelConfigOptions, D as DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR, a as DEFAULT_TANGLE_ROUTER_BASE_URL, R as ResolveModelOptions, b as ResolveUserTangleExecutionKeyForUserOptions, c as ResolveUserTangleExecutionKeyOptions, d as ResolvedTangleExecutionKey, T as TangleBillingEnforcementOptions, e as TangleExecutionEnvironment, f as TangleExecutionKeyError, g as TangleExecutionKeyErrorCode, h as TangleExecutionKeyHttpError, i as TangleExecutionKeySource, j as TangleModelConfig, k as createTangleRouterModelConfig, l as isTangleBillingEnforcementDisabled, m as isTangleExecutionKeyError, r as resolveTangleExecutionEnvironment, n as resolveTangleModelConfig, o as resolveUserTangleExecutionKey, p as resolveUserTangleExecutionKeyForUser, t as tangleExecutionKeyHttpError } from '../model-CKzniMMr.js';
|
|
3
|
-
import { b as AppToolContext, e as AppToolProducedEvent, f as AppToolTaxonomy, c as AppToolHandlers, d as AppToolOutcome } from '../types-
|
|
4
|
-
import {
|
|
6
|
+
import { b as AppToolContext, e as AppToolProducedEvent, f as AppToolTaxonomy, c as AppToolHandlers, d as AppToolOutcome } from '../types-2rOJo8Hc.js';
|
|
7
|
+
import { CertifiedProfile } from '@tangle-network/agent-runtime/intelligence';
|
|
8
|
+
import { a as AppToolMcpServer } from '../mcp-eZCmkgCF.js';
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* OpenAI-compatible stream → `LoopEvent` adapter, for NON-sandbox copilots.
|
|
@@ -75,7 +79,7 @@ interface OpenAICompatStreamTurnOptions {
|
|
|
75
79
|
* const cfg = resolveTangleModelConfig() // or { baseUrl, apiKey, model }
|
|
76
80
|
* streamAppToolLoop({ streamTurn: createOpenAICompatStreamTurn({ ...cfg, tools }), executeToolCall, ... })
|
|
77
81
|
*/
|
|
78
|
-
declare function createOpenAICompatStreamTurn(opts: OpenAICompatStreamTurnOptions): (messages:
|
|
82
|
+
declare function createOpenAICompatStreamTurn(opts: OpenAICompatStreamTurnOptions): (messages: ToolLoopMessage[]) => AsyncIterable<LoopEvent>;
|
|
79
83
|
|
|
80
84
|
/**
|
|
81
85
|
* `createAgentRuntime` — the in-process agent core, assembled.
|
|
@@ -120,9 +124,28 @@ interface AgentRuntimeModelConfig {
|
|
|
120
124
|
/** Extra request-body fields (e.g. `max_tokens`, a `reasoning` block). */
|
|
121
125
|
extraBody?: Record<string, unknown>;
|
|
122
126
|
}
|
|
127
|
+
/** The agent's resolved profile surfaces for one turn — the things a delivered
|
|
128
|
+
* / certified `AgentProfile` can change. Profile-WIDE on purpose: certified
|
|
129
|
+
* delivery folds prompt-surface + skills into `systemPrompt` AND can add
|
|
130
|
+
* certified `tool` artifacts to `extraTools` (the model's advertised tools is
|
|
131
|
+
* rebuilt when these change). MCP servers / memory / RAG that materialize as
|
|
132
|
+
* files or servers deliver through the sandbox-provisioning seam, not here. */
|
|
133
|
+
interface ResolvedAgentProfile {
|
|
134
|
+
systemPrompt: string;
|
|
135
|
+
extraTools: unknown[];
|
|
136
|
+
}
|
|
123
137
|
interface CreateAgentRuntimeOptions {
|
|
124
138
|
/** The model endpoint the turns stream from. */
|
|
125
139
|
model: AgentRuntimeModelConfig;
|
|
140
|
+
/**
|
|
141
|
+
* Optional transform applied to the resolved profile surfaces each turn —
|
|
142
|
+
* the seam for certified-artifact delivery (`createCertifiedDelivery`). It is
|
|
143
|
+
* profile-WIDE (not prompt-only): it returns the effective `systemPrompt` +
|
|
144
|
+
* advertised `extraTools`. Kept generic + injected so this substrate-free core
|
|
145
|
+
* never imports `@tangle-network/agent-runtime`. Fail-closed by contract: an
|
|
146
|
+
* impl that can't reach the plane returns the base surfaces unchanged.
|
|
147
|
+
*/
|
|
148
|
+
composeProfile?: (base: ResolvedAgentProfile) => ResolvedAgentProfile | Promise<ResolvedAgentProfile>;
|
|
126
149
|
/** The product's proposal taxonomy — advertises `submit_proposal`'s `type`
|
|
127
150
|
* enum to the model and labels the regulated subset on the result. */
|
|
128
151
|
taxonomy: AppToolTaxonomy;
|
|
@@ -138,7 +161,7 @@ interface CreateAgentRuntimeOptions {
|
|
|
138
161
|
extraTools?: unknown[];
|
|
139
162
|
/** Execute a tool that is NOT one of the four app tools (e.g. an integration
|
|
140
163
|
* action). Only consulted for names {@link isOtherExecutableTool} accepts. */
|
|
141
|
-
executeOtherTool?: (call:
|
|
164
|
+
executeOtherTool?: (call: ToolLoopCall, ctx: AppToolContext) => Promise<AppToolOutcome>;
|
|
142
165
|
/** Which non-app tool names are executable here. Required if {@link executeOtherTool} is set. */
|
|
143
166
|
isOtherExecutableTool?: (toolName: string) => boolean;
|
|
144
167
|
}
|
|
@@ -161,7 +184,7 @@ interface AgentRuntime {
|
|
|
161
184
|
run(userMessage: string, turn: AgentTurnOptions): Promise<ToolLoopResult>;
|
|
162
185
|
/** Stream the bounded tool loop: yields each raw model event and each executed
|
|
163
186
|
* tool result as it happens (for SSE re-emission + telemetry). */
|
|
164
|
-
stream(userMessage: string, turn: AgentTurnOptions): AsyncGenerator<
|
|
187
|
+
stream(userMessage: string, turn: AgentTurnOptions): AsyncGenerator<StreamToolLoopYield<LoopEvent>, void, unknown>;
|
|
165
188
|
}
|
|
166
189
|
/**
|
|
167
190
|
* Create an in-process agent runtime for one agent. See the module doc for the
|
|
@@ -171,6 +194,61 @@ interface AgentRuntime {
|
|
|
171
194
|
*/
|
|
172
195
|
declare function createAgentRuntime(opts: CreateAgentRuntimeOptions): AgentRuntime;
|
|
173
196
|
|
|
197
|
+
/**
|
|
198
|
+
* `createCertifiedDelivery` — the delivery truck for Tangle Intelligence.
|
|
199
|
+
*
|
|
200
|
+
* Pulls a tenant's CERTIFIED `AgentProfile` from the deployed plane
|
|
201
|
+
* (`GET /v1/profiles/:target/composed`) and applies it to the agent's resolved
|
|
202
|
+
* surfaces each turn, so an approved improvement reaches the running agent with
|
|
203
|
+
* NO redeploy. This is the `composeProfile` transform `createAgentRuntime`
|
|
204
|
+
* accepts — opt-in per product, fail-closed, cached + refreshed.
|
|
205
|
+
*
|
|
206
|
+
* Profile-WIDE by design (not prompt-only): the composed profile carries every
|
|
207
|
+
* promoted artifact type keyed by kind. What's folded where:
|
|
208
|
+
* - `prompt-surface` + `skill` → the system prompt (via `composeCertifiedPrompt`).
|
|
209
|
+
* - `tool` artifacts that carry an OpenAI tool definition → `extraTools`
|
|
210
|
+
* (advertised to the model; the matching executor is supplied by the product
|
|
211
|
+
* via `executeOtherTool`). Until a `tool` artifact carries a runnable def,
|
|
212
|
+
* it is surfaced (see `current()`) but not advertised — advertising a tool
|
|
213
|
+
* with no executor would make the model call into a dead end.
|
|
214
|
+
* - `mcp` / `memory` / `rag` artifacts materialize as servers/files and deliver
|
|
215
|
+
* through the SANDBOX-provisioning seam, not this in-process one. The full
|
|
216
|
+
* certified profile is exposed via `current()` so that seam can consume it.
|
|
217
|
+
*
|
|
218
|
+
* Substrate boundary: THIS module imports `@tangle-network/agent-runtime`; the
|
|
219
|
+
* `createAgentRuntime` core does not (it only consumes the generic transform).
|
|
220
|
+
*/
|
|
221
|
+
|
|
222
|
+
interface CertifiedDeliveryConfig {
|
|
223
|
+
/** The tenant target whose certified artifacts to deliver (the agent id). */
|
|
224
|
+
target: string;
|
|
225
|
+
/** Bearer for the plane. Reads `TANGLE_API_KEY` when omitted. */
|
|
226
|
+
apiKey?: string;
|
|
227
|
+
/** Plane base URL. Reads `TANGLE_INTELLIGENCE_URL` then the public plane. */
|
|
228
|
+
baseUrl?: string;
|
|
229
|
+
/** Min interval between certified-profile pulls. Default 5m. */
|
|
230
|
+
refreshMs?: number;
|
|
231
|
+
/** fetch impl (tests / non-global-fetch runtimes). */
|
|
232
|
+
fetchImpl?: typeof fetch;
|
|
233
|
+
}
|
|
234
|
+
interface CertifiedDelivery {
|
|
235
|
+
/** The `composeProfile` transform to pass to `createAgentRuntime`. Applies the
|
|
236
|
+
* cached certified profile to the base surfaces; refreshes on the cadence. */
|
|
237
|
+
composeProfile(base: ResolvedAgentProfile): Promise<ResolvedAgentProfile>;
|
|
238
|
+
/** Force a pull now (ignores the refresh window). Best-effort. */
|
|
239
|
+
refresh(): Promise<void>;
|
|
240
|
+
/** The certified profile currently in effect (null = none promoted / pull
|
|
241
|
+
* failed). Lets the sandbox-provisioning seam deliver the file/server
|
|
242
|
+
* artifact types this in-process seam doesn't. */
|
|
243
|
+
current(): CertifiedProfile | null;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Build a certified-delivery transform for one agent target. Fail-closed: a pull
|
|
247
|
+
* error or 404 keeps the last-known certified profile (or null), and the agent
|
|
248
|
+
* runs on its base surfaces — it never breaks because Intelligence is down.
|
|
249
|
+
*/
|
|
250
|
+
declare function createCertifiedDelivery(config: CertifiedDeliveryConfig): CertifiedDelivery;
|
|
251
|
+
|
|
174
252
|
/**
|
|
175
253
|
* Surface-scoped profile overlay — the seam letting any product page (a
|
|
176
254
|
* sequence editor, a brief composer, a dataset view) add MCP servers, a prompt
|
|
@@ -277,46 +355,17 @@ interface SurfaceMergeBase {
|
|
|
277
355
|
*/
|
|
278
356
|
declare function mergeSurfaceOverlay<TBase extends SurfaceMergeBase>(base: TBase, overlay: SurfaceOverlay): TBase & SurfaceMergeBase;
|
|
279
357
|
|
|
280
|
-
interface LoopToolCall {
|
|
281
|
-
toolCallId?: string;
|
|
282
|
-
toolName: string;
|
|
283
|
-
args: Record<string, unknown>;
|
|
284
|
-
}
|
|
285
|
-
/** One OpenAI-shaped tool-call entry on an assistant message. */
|
|
286
|
-
interface LoopAssistantToolCall {
|
|
287
|
-
id: string;
|
|
288
|
-
type: 'function';
|
|
289
|
-
function: {
|
|
290
|
-
name: string;
|
|
291
|
-
arguments: string;
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
358
|
/**
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
* The base `{ role, content }` covers `system` / `user` / plain `assistant`
|
|
298
|
-
* turns. Two optional fields carry the OpenAI function-calling contract so the
|
|
299
|
-
* model reads its own tool use back correctly instead of re-issuing it:
|
|
359
|
+
* Events the app's OpenAI-compat stream adapter ({@link toLoopEvents}) yields.
|
|
300
360
|
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
|
|
309
|
-
interface LoopMessage {
|
|
310
|
-
role: string;
|
|
311
|
-
content: string | null;
|
|
312
|
-
tool_calls?: LoopAssistantToolCall[];
|
|
313
|
-
tool_call_id?: string;
|
|
314
|
-
}
|
|
315
|
-
/** Events a turn stream yields. `text` accumulates into the final answer;
|
|
316
|
-
* `tool_call` is collected for dispatch; `reasoning` and `usage` pass through
|
|
317
|
-
* for UIs that render thinking sections and per-message token/cost metrics.
|
|
318
|
-
* Extra event types pass through untouched (the caller re-emits them to its
|
|
319
|
-
* own UI stream). */
|
|
361
|
+
* This is the app's own `Raw` event type for the streaming loop — the canonical
|
|
362
|
+
* `streamToolLoop<Raw>` is generic over it. It widens the substrate's
|
|
363
|
+
* tool-loop event with `reasoning` (DeepSeek/router `reasoning_content` /
|
|
364
|
+
* `thinking` deltas, rendered as thinking sections) and `usage` (per-message
|
|
365
|
+
* token accounting) — neither belongs in the substrate's loop contract, so they
|
|
366
|
+
* stay here. The adapter maps each into the `streamTurn` seam; `text` and
|
|
367
|
+
* `tool_call` drive the loop, `reasoning` / `usage` pass through to the UI.
|
|
368
|
+
*/
|
|
320
369
|
type LoopEvent = {
|
|
321
370
|
type: 'text';
|
|
322
371
|
text: string;
|
|
@@ -325,7 +374,7 @@ type LoopEvent = {
|
|
|
325
374
|
text: string;
|
|
326
375
|
} | {
|
|
327
376
|
type: 'tool_call';
|
|
328
|
-
call:
|
|
377
|
+
call: _tangle_network_agent_runtime.ToolLoopCall;
|
|
329
378
|
} | {
|
|
330
379
|
type: 'usage';
|
|
331
380
|
usage: {
|
|
@@ -336,121 +385,5 @@ type LoopEvent = {
|
|
|
336
385
|
type: 'other';
|
|
337
386
|
event: unknown;
|
|
338
387
|
};
|
|
339
|
-
/** Why the loop stopped. `completed` = model finished naturally; `stuck-loop` =
|
|
340
|
-
* ≥3 consecutive identical tool calls (same tool + args); `backstop` = hit the
|
|
341
|
-
* runaway-backstop cap (200 by default); `deadline` = wall-clock deadlineMs
|
|
342
|
-
* exceeded; `budget` = maxCostUsd exhausted. Non-`completed` stops are infra /
|
|
343
|
-
* resource outcomes — eval scoring must distinguish them from capability failure. */
|
|
344
|
-
type ToolLoopStopReason = 'completed' | 'stuck-loop' | 'backstop' | 'deadline' | 'budget';
|
|
345
|
-
interface ToolLoopResult {
|
|
346
|
-
/** The model's final text across the loop. */
|
|
347
|
-
finalText: string;
|
|
348
|
-
/** Every tool call executed, with its outcome, in order. */
|
|
349
|
-
toolResults: Array<{
|
|
350
|
-
call: LoopToolCall;
|
|
351
|
-
label: string;
|
|
352
|
-
outcome: AppToolOutcome;
|
|
353
|
-
}>;
|
|
354
|
-
/** Number of model turns run (1 + tool-driven re-runs). */
|
|
355
|
-
turns: number;
|
|
356
|
-
/** Why the loop stopped. */
|
|
357
|
-
stopReason: ToolLoopStopReason;
|
|
358
|
-
/** @deprecated Use `stopReason !== 'completed'` instead. */
|
|
359
|
-
cappedOut: boolean;
|
|
360
|
-
}
|
|
361
|
-
interface AppToolLoopOptions {
|
|
362
|
-
systemPrompt: string;
|
|
363
|
-
userMessage: string;
|
|
364
|
-
priorMessages?: Array<{
|
|
365
|
-
role: string;
|
|
366
|
-
content: string;
|
|
367
|
-
}>;
|
|
368
|
-
/** Stream one model turn over the running message list. The app wraps its
|
|
369
|
-
* backend here. Messages follow {@link LoopMessage}: a tool-calling assistant
|
|
370
|
-
* turn carries `tool_calls`, and each tool result is a `role: 'tool'` message.
|
|
371
|
-
* A backend that reads only `role` + `content` is unaffected. */
|
|
372
|
-
streamTurn: (messages: LoopMessage[]) => AsyncIterable<LoopEvent>;
|
|
373
|
-
/** Execute one tool call. The app routes to its integration executor / app-tool
|
|
374
|
-
* executor and returns the outcome. */
|
|
375
|
-
executeToolCall: (call: LoopToolCall) => Promise<AppToolOutcome>;
|
|
376
|
-
/** Which emitted tool names are executable (others are ignored — e.g. a UI-only
|
|
377
|
-
* tool the app renders but doesn't run here). */
|
|
378
|
-
isExecutableTool: (toolName: string) => boolean;
|
|
379
|
-
/** Runaway-backstop cap. Default 200 — set far above any legitimate workflow.
|
|
380
|
-
* For per-workflow limits use `maxCostUsd` or `deadlineMs` instead. */
|
|
381
|
-
maxToolTurns?: number;
|
|
382
|
-
/** Wall-clock deadline in ms since epoch (Date.now()-based). When exceeded the
|
|
383
|
-
* loop stops with stopReason `deadline`. */
|
|
384
|
-
deadlineMs?: number;
|
|
385
|
-
/** Maximum total cost in USD. Requires `costOf` to meter each tool call. */
|
|
386
|
-
maxCostUsd?: number;
|
|
387
|
-
/** Return the USD cost of one outcome. Required for `maxCostUsd` to work. */
|
|
388
|
-
costOf?: (call: LoopToolCall, outcome: AppToolOutcome) => number;
|
|
389
|
-
/** Render one tool outcome as the `content` of its `role: 'tool'` message.
|
|
390
|
-
* Default is a compact `<label> → ok/failed: …`. */
|
|
391
|
-
renderResult?: (label: string, outcome: AppToolOutcome) => string;
|
|
392
|
-
/** Map a tool call to the label its result is keyed under (default: toolName). */
|
|
393
|
-
labelFor?: (call: LoopToolCall) => string;
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Run the bounded tool loop and return the final text + every executed tool
|
|
397
|
-
* outcome. Yields nothing — it's an awaitable driver; callers that need to
|
|
398
|
-
* re-emit events to a UI stream should do so inside `streamTurn`. (A streaming
|
|
399
|
-
* variant can wrap this later; keeping the core awaitable makes it trivially
|
|
400
|
-
* testable.)
|
|
401
|
-
*/
|
|
402
|
-
declare function runAppToolLoop(opts: AppToolLoopOptions): Promise<ToolLoopResult>;
|
|
403
|
-
type StreamLoopYield<Raw> = {
|
|
404
|
-
kind: 'event';
|
|
405
|
-
event: Raw;
|
|
406
|
-
} | {
|
|
407
|
-
kind: 'tool_result';
|
|
408
|
-
toolName: string;
|
|
409
|
-
toolCallId?: string;
|
|
410
|
-
label: string;
|
|
411
|
-
outcome: AppToolOutcome;
|
|
412
|
-
} | {
|
|
413
|
-
kind: 'capped';
|
|
414
|
-
pending: number;
|
|
415
|
-
stopReason: Exclude<ToolLoopStopReason, 'completed'>;
|
|
416
|
-
};
|
|
417
|
-
interface StreamAppToolLoopOptions<Raw> {
|
|
418
|
-
systemPrompt: string;
|
|
419
|
-
userMessage: string;
|
|
420
|
-
priorMessages?: Array<{
|
|
421
|
-
role: string;
|
|
422
|
-
content: string;
|
|
423
|
-
}>;
|
|
424
|
-
/** Stream one model turn (the app wraps its backend / runAgentTaskStream).
|
|
425
|
-
* Messages follow {@link LoopMessage}: a tool-calling assistant turn carries
|
|
426
|
-
* `tool_calls`, and each tool result is a `role: 'tool'` message. */
|
|
427
|
-
streamTurn: (messages: LoopMessage[]) => AsyncIterable<Raw>;
|
|
428
|
-
/** Text contribution of a raw event, '' if none — used to record the
|
|
429
|
-
* assistant's turn so the next turn has its context. */
|
|
430
|
-
extractText: (event: Raw) => string;
|
|
431
|
-
/** The tool call a raw event represents, or null. */
|
|
432
|
-
extractToolCall: (event: Raw) => LoopToolCall | null;
|
|
433
|
-
/** Which tool names are executable here (others pass through, unexecuted). */
|
|
434
|
-
isExecutableTool: (toolName: string) => boolean;
|
|
435
|
-
/** Execute one call — the app routes to its integration / app-tool executor. */
|
|
436
|
-
executeToolCall: (call: LoopToolCall) => Promise<AppToolOutcome>;
|
|
437
|
-
/** Runaway-backstop cap. Default 200 — set far above any legitimate workflow. */
|
|
438
|
-
maxToolTurns?: number;
|
|
439
|
-
/** Wall-clock deadline in ms since epoch (Date.now()-based). */
|
|
440
|
-
deadlineMs?: number;
|
|
441
|
-
/** Maximum total cost in USD. Requires `costOf` to meter each tool call. */
|
|
442
|
-
maxCostUsd?: number;
|
|
443
|
-
/** Return the USD cost of one outcome. Required for `maxCostUsd` to work. */
|
|
444
|
-
costOf?: (call: LoopToolCall, outcome: AppToolOutcome) => number;
|
|
445
|
-
renderResult?: (label: string, outcome: AppToolOutcome) => string;
|
|
446
|
-
labelFor?: (call: LoopToolCall) => string;
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* The streaming bounded tool loop. Yields `event` for each raw turn event and
|
|
450
|
-
* `tool_result` for each executed tool; emits a single `capped` (with stopReason)
|
|
451
|
-
* when it stops for any non-completed reason. The app drives telemetry + UI
|
|
452
|
-
* emission off the yielded items.
|
|
453
|
-
*/
|
|
454
|
-
declare function streamAppToolLoop<Raw>(opts: StreamAppToolLoopOptions<Raw>): AsyncGenerator<StreamLoopYield<Raw>, void, unknown>;
|
|
455
388
|
|
|
456
|
-
export { type AgentRuntime, type AgentRuntimeModelConfig, type AgentTurnOptions, type AnySurfaceKind, type
|
|
389
|
+
export { type AgentRuntime, type AgentRuntimeModelConfig, type AgentTurnOptions, type AnySurfaceKind, type CertifiedDelivery, type CertifiedDeliveryConfig, type CreateAgentRuntimeOptions, type LoopEvent, type OpenAICompatStreamTurnOptions, type OpenAIStreamChunk, type ResolvedAgentProfile, type SurfaceKindDefinition, type SurfaceMcpServer, type SurfaceMergeBase, type SurfaceOverlay, type SurfacePermissionValue, type SurfaceRegistry, createAgentRuntime, createCertifiedDelivery, createOpenAICompatStreamTurn, createSurfaceRegistry, defineSurfaceKind, mergeSurfaceOverlay, toLoopEvents };
|
package/dist/runtime/index.js
CHANGED
|
@@ -2,16 +2,17 @@ import {
|
|
|
2
2
|
__resetCatalogCache,
|
|
3
3
|
buildCatalog,
|
|
4
4
|
createAgentRuntime,
|
|
5
|
+
createCertifiedDelivery,
|
|
5
6
|
createOpenAICompatStreamTurn,
|
|
6
7
|
createSurfaceRegistry,
|
|
7
8
|
defineSurfaceKind,
|
|
8
9
|
fetchModelCatalog,
|
|
9
10
|
mergeSurfaceOverlay,
|
|
10
11
|
normalizeModelId,
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
runToolLoop,
|
|
13
|
+
streamToolLoop,
|
|
13
14
|
toLoopEvents
|
|
14
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-LUE4HO5C.js";
|
|
15
16
|
import {
|
|
16
17
|
DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR,
|
|
17
18
|
DEFAULT_TANGLE_ROUTER_BASE_URL,
|
|
@@ -25,7 +26,7 @@ import {
|
|
|
25
26
|
resolveUserTangleExecutionKeyForUser,
|
|
26
27
|
tangleExecutionKeyHttpError
|
|
27
28
|
} from "../chunk-EHPK7GKR.js";
|
|
28
|
-
import "../chunk-
|
|
29
|
+
import "../chunk-JZZ6AWF4.js";
|
|
29
30
|
export {
|
|
30
31
|
DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR,
|
|
31
32
|
DEFAULT_TANGLE_ROUTER_BASE_URL,
|
|
@@ -33,6 +34,7 @@ export {
|
|
|
33
34
|
__resetCatalogCache,
|
|
34
35
|
buildCatalog,
|
|
35
36
|
createAgentRuntime,
|
|
37
|
+
createCertifiedDelivery,
|
|
36
38
|
createOpenAICompatStreamTurn,
|
|
37
39
|
createSurfaceRegistry,
|
|
38
40
|
createTangleRouterModelConfig,
|
|
@@ -46,8 +48,8 @@ export {
|
|
|
46
48
|
resolveTangleModelConfig,
|
|
47
49
|
resolveUserTangleExecutionKey,
|
|
48
50
|
resolveUserTangleExecutionKeyForUser,
|
|
49
|
-
runAppToolLoop,
|
|
50
|
-
streamAppToolLoop,
|
|
51
|
+
runToolLoop as runAppToolLoop,
|
|
52
|
+
streamToolLoop as streamAppToolLoop,
|
|
51
53
|
tangleExecutionKeyHttpError,
|
|
52
54
|
toLoopEvents
|
|
53
55
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as SequenceMediaKind, o as SequenceTimeline, r as TimelineInterval, m as SequenceStore } from '../store-gckrNq-g.js';
|
|
2
2
|
export { M as MIN_SEQUENCE_CLIP_FRAMES, N as NewSequenceClip, a as NewSequenceDecision, b as NewSequenceTrack, S as SequenceClip, c as SequenceClipMedia, d as SequenceClipPatch, e as SequenceDecision, f as SequenceExportFormat, g as SequenceExportRecord, h as SequenceExportStatus, i as SequenceFrameSnapshot, k as SequenceMeta, l as SequenceStatus, n as SequenceStoreScope, p as SequenceTrack, q as SequenceTrackKind, T as TimelineClipBounds, s as assertClipFitsSequence, t as chooseCaptionPlacement, u as clampClipDuration, v as clampClipStart, w as formatSeconds, x as formatTimecode, y as framesToSeconds, z as secondsToFrames, A as snapshotFrame, B as trackIntervals } from '../store-gckrNq-g.js';
|
|
3
3
|
export { A as AddCaptionOperation, C as CaptionTargetResolution, a as CreateTrackOperation, D as DeleteClipOperation, E as ExtendSequenceOperation, M as MoveClipOperation, P as PlaceClipOperation, Q as QueueExportOperation, S as SEQUENCE_OPERATION_TYPES, b as SequenceApplyResult, c as SequenceOperation, d as SequenceOperationContext, e as SequenceOperationType, f as SequencePlan, g as SetClipDisabledOperation, h as SetClipTextOperation, i as SplitClipOperation, T as TrimClipOperation, j as applySequenceOperation, k as applySequenceOperations, l as assertSequenceMediaUrl, m as captionTrackNameForLanguage, n as lastClipEndFrame, p as parseSequenceOperations, r as resolveCaptionPlacement, o as resolveCaptionTarget, q as resolvePlaceClipTrack, v as validateAddCaption, s as validateCreateTrack, t as validateDeleteClip, u as validateExtendSequence, w as validateMoveClip, x as validatePlaceClip, y as validateQueueExport, z as validateSequenceOperation, B as validateSequenceOperations, F as validateSetClipDisabled, G as validateSetClipText, H as validateSplitClip, I as validateTrimClip } from '../apply-Cp8c3K9D.js';
|
|
4
|
-
import { f as ToolHeaderNames, a as AppToolMcpServer } from '../mcp-
|
|
5
|
-
import { b as AppToolContext } from '../types-
|
|
4
|
+
import { f as ToolHeaderNames, a as AppToolMcpServer } from '../mcp-eZCmkgCF.js';
|
|
5
|
+
import { b as AppToolContext } from '../types-2rOJo8Hc.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Pure interchange-format builders over `SequenceTimeline` — SRT, WebVTT,
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b as AppToolName, f as ToolHeaderNames } from '../mcp-
|
|
2
|
-
export { A as APP_TOOL_NAMES, a as AppToolMcpServer, c as AuthenticateOptions, B as BuildHttpMcpServerOptions, d as BuildMcpServerOptions, D as DEFAULT_APP_TOOL_PATHS, e as DEFAULT_HEADER_NAMES, O as OpenAIFunctionTool, T as ToolAuthResult, g as authenticateToolRequest, h as buildAppToolMcpServer, i as buildAppToolOpenAITools, j as buildHttpMcpServer, k as isAppToolName, r as readToolArgs } from '../mcp-
|
|
3
|
-
import { f as AppToolTaxonomy, c as AppToolHandlers, b as AppToolContext, e as AppToolProducedEvent, d as AppToolOutcome } from '../types-
|
|
4
|
-
export { A as AddCitationArgs, a as AddCitationResult, R as RenderUiArgs, g as RenderUiResult, S as ScheduleFollowupArgs, h as ScheduleFollowupResult, i as SubmitProposalArgs, j as SubmitProposalResult } from '../types-
|
|
1
|
+
import { b as AppToolName, f as ToolHeaderNames } from '../mcp-eZCmkgCF.js';
|
|
2
|
+
export { A as APP_TOOL_NAMES, a as AppToolMcpServer, c as AuthenticateOptions, B as BuildHttpMcpServerOptions, d as BuildMcpServerOptions, D as DEFAULT_APP_TOOL_PATHS, e as DEFAULT_HEADER_NAMES, O as OpenAIFunctionTool, T as ToolAuthResult, g as authenticateToolRequest, h as buildAppToolMcpServer, i as buildAppToolOpenAITools, j as buildHttpMcpServer, k as isAppToolName, r as readToolArgs } from '../mcp-eZCmkgCF.js';
|
|
3
|
+
import { f as AppToolTaxonomy, c as AppToolHandlers, b as AppToolContext, e as AppToolProducedEvent, d as AppToolOutcome } from '../types-2rOJo8Hc.js';
|
|
4
|
+
export { A as AddCitationArgs, a as AddCitationResult, R as RenderUiArgs, g as RenderUiResult, S as ScheduleFollowupArgs, h as ScheduleFollowupResult, i as SubmitProposalArgs, j as SubmitProposalResult } from '../types-2rOJo8Hc.js';
|
|
5
5
|
export { C as CreateMcpToolHandlerOptions, M as MCP_PROTOCOL_VERSIONS, a as McpProtocolVersion, b as McpServerInfo, c as McpToolDefinition, d as createMcpToolHandler } from '../mcp-rpc-DLw_r9PQ.js';
|
|
6
6
|
|
|
7
7
|
/** A correctable bad-input error a tool handler throws; the HTTP layer maps it
|
package/dist/tools/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
restrictTaxonomy,
|
|
7
7
|
verifyCapabilityToken,
|
|
8
8
|
verifyExpiringCapabilityToken
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-MH6AVXQ7.js";
|
|
10
10
|
import {
|
|
11
11
|
DEFAULT_APP_TOOL_PATHS,
|
|
12
12
|
DEFAULT_HEADER_NAMES,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
dispatchAppTool,
|
|
26
26
|
isAppToolName,
|
|
27
27
|
outcomeStatus
|
|
28
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-JZZ6AWF4.js";
|
|
29
29
|
export {
|
|
30
30
|
APP_TOOL_NAMES,
|
|
31
31
|
DEFAULT_APP_TOOL_PATHS,
|
|
@@ -110,14 +110,17 @@ type AppToolProducedEvent = {
|
|
|
110
110
|
proposalId: string;
|
|
111
111
|
title: string;
|
|
112
112
|
status: 'pending' | 'executed';
|
|
113
|
+
content?: string;
|
|
113
114
|
} | {
|
|
114
115
|
type: 'artifact';
|
|
115
116
|
path: string;
|
|
116
117
|
content: string;
|
|
117
118
|
};
|
|
118
|
-
/** Outcome of one tool dispatch — structurally
|
|
119
|
-
* tool-
|
|
120
|
-
*
|
|
119
|
+
/** Outcome of one tool dispatch — structurally identical to the agent-runtime
|
|
120
|
+
* tool-loop's `ToolCallOutcome`, so a dispatched outcome folds straight into
|
|
121
|
+
* the loop's `role: 'tool'` result message. Defined here (not imported) to keep
|
|
122
|
+
* the `tools/` module substrate-free: it depends only on Web `Request`/
|
|
123
|
+
* `Response`, never on the agent runtime. */
|
|
121
124
|
type AppToolOutcome = {
|
|
122
125
|
ok: true;
|
|
123
126
|
result: unknown;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"packageManager": "pnpm@10.33.4",
|
|
5
5
|
"description": "Application-shell framework for Tangle agent products: a bounded tool loop, the structured agent\u2192app tool side channel, integration-hub client, per-workspace billing, and crypto \u2014 composed over the Tangle agent substrate through typed seams.",
|
|
6
6
|
"keywords": [
|
|
@@ -192,8 +192,9 @@
|
|
|
192
192
|
"typecheck": "tsc --noEmit"
|
|
193
193
|
},
|
|
194
194
|
"devDependencies": {
|
|
195
|
-
"@tangle-network/agent-eval": "^0.
|
|
195
|
+
"@tangle-network/agent-eval": "^0.83.0",
|
|
196
196
|
"@tangle-network/agent-integrations": "^0.32.0",
|
|
197
|
+
"@tangle-network/agent-runtime": "^0.52.0",
|
|
197
198
|
"@tangle-network/agent-knowledge": "^1.5.2",
|
|
198
199
|
"@testing-library/dom": "^10.4.1",
|
|
199
200
|
"@testing-library/react": "^16.3.2",
|
|
@@ -214,10 +215,10 @@
|
|
|
214
215
|
},
|
|
215
216
|
"peerDependencies": {
|
|
216
217
|
"@huggingface/transformers": ">=3",
|
|
217
|
-
"@tangle-network/agent-eval": ">=0.
|
|
218
|
+
"@tangle-network/agent-eval": ">=0.83.0",
|
|
218
219
|
"@tangle-network/agent-integrations": ">=0.32.0",
|
|
219
220
|
"@tangle-network/agent-knowledge": ">=1.5.0",
|
|
220
|
-
"@tangle-network/agent-runtime": ">=0.
|
|
221
|
+
"@tangle-network/agent-runtime": ">=0.52.0",
|
|
221
222
|
"drizzle-orm": ">=0.36",
|
|
222
223
|
"react": ">=18",
|
|
223
224
|
"konva": ">=9",
|