@tangle-network/agent-app 0.11.0 → 0.12.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/TimelineEditor-OXPJZDP2.js +12 -0
- package/dist/TimelineEditor-OXPJZDP2.js.map +1 -0
- package/dist/apply-Cp8c3K9D.d.ts +249 -0
- package/dist/billing/index.js +1 -1
- package/dist/chunk-3WAJWYKD.js +1730 -0
- package/dist/chunk-3WAJWYKD.js.map +1 -0
- package/dist/chunk-CF5DZELC.js +111 -0
- package/dist/chunk-CF5DZELC.js.map +1 -0
- package/dist/{chunk-4YTWB5MG.js → chunk-ETX4O4BB.js} +98 -1
- package/dist/chunk-ETX4O4BB.js.map +1 -0
- package/dist/{chunk-YS6A6G57.js → chunk-G3HCU7TA.js} +37 -4
- package/dist/chunk-G3HCU7TA.js.map +1 -0
- package/dist/chunk-IHR6K3GF.js +2367 -0
- package/dist/chunk-IHR6K3GF.js.map +1 -0
- package/dist/{chunk-OLCVUGGI.js → chunk-IJZJWKUK.js} +1 -61
- package/dist/chunk-IJZJWKUK.js.map +1 -0
- package/dist/{chunk-EYXTDVDY.js → chunk-SAOAAA3S.js} +2 -2
- package/dist/chunk-ZYBWGSAZ.js +130 -0
- package/dist/chunk-ZYBWGSAZ.js.map +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +130 -8
- package/dist/mcp-CIupfjxV.d.ts +112 -0
- package/dist/preset-cloudflare/index.js +2 -2
- package/dist/runtime/index.d.ts +108 -1
- package/dist/runtime/index.js +7 -1
- package/dist/sequences/drizzle.d.ts +1244 -0
- package/dist/sequences/drizzle.js +368 -0
- package/dist/sequences/drizzle.js.map +1 -0
- package/dist/sequences/index.d.ts +327 -0
- package/dist/sequences/index.js +114 -0
- package/dist/sequences/index.js.map +1 -0
- package/dist/sequences-react/index.d.ts +752 -0
- package/dist/sequences-react/index.js +241 -0
- package/dist/sequences-react/index.js.map +1 -0
- package/dist/store-gckrNq-g.d.ts +242 -0
- package/dist/tools/index.d.ts +24 -108
- package/dist/tools/index.js +12 -6
- package/package.json +37 -2
- package/dist/chunk-4YTWB5MG.js.map +0 -1
- package/dist/chunk-OLCVUGGI.js.map +0 -1
- package/dist/chunk-YS6A6G57.js.map +0 -1
- /package/dist/{chunk-EYXTDVDY.js.map → chunk-SAOAAA3S.js.map} +0 -0
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
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
2
|
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
3
|
import { b as AppToolContext, e as AppToolProducedEvent, f as AppToolTaxonomy, c as AppToolHandlers, d as AppToolOutcome } from '../types-By4B3K37.js';
|
|
4
|
+
import { a as AppToolMcpServer } from '../mcp-CIupfjxV.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* OpenAI-compatible stream → `LoopEvent` adapter, for NON-sandbox copilots.
|
|
@@ -170,6 +171,112 @@ interface AgentRuntime {
|
|
|
170
171
|
*/
|
|
171
172
|
declare function createAgentRuntime(opts: CreateAgentRuntimeOptions): AgentRuntime;
|
|
172
173
|
|
|
174
|
+
/**
|
|
175
|
+
* Surface-scoped profile overlay — the seam letting any product page (a
|
|
176
|
+
* sequence editor, a brief composer, a dataset view) add MCP servers, a prompt
|
|
177
|
+
* addendum, and permission tightening to the workspace agent profile for turns
|
|
178
|
+
* initiated FROM that surface, without the chat orchestrator knowing any
|
|
179
|
+
* surface's specifics. The orchestrator resolves `(kind, ctx)` through a
|
|
180
|
+
* registry the REQUEST HANDLER constructs per request (construction is a Map
|
|
181
|
+
* build — cheap) and merges the result into the base profile it was about to
|
|
182
|
+
* send to the sandbox. Per-request construction is the trust mechanism, not an
|
|
183
|
+
* optimization target: each `build()` closes over server-trusted request state
|
|
184
|
+
* (env bindings, secrets, the AUTHENTICATED user/workspace), which on Workers
|
|
185
|
+
* exists only per request — a startup-built registry would force identity
|
|
186
|
+
* through the untrusted client `ctx`.
|
|
187
|
+
*
|
|
188
|
+
* SECURITY INVARIANT: the surface `kind` and the ids inside `ctx` arrive on
|
|
189
|
+
* the client request and are pure ROUTING data — never trusted content, never
|
|
190
|
+
* identity. Identity comes from the closure (see above). The registered
|
|
191
|
+
* `build()` runs server-side only: it validates the routing ids against the
|
|
192
|
+
* product's access control, then mints its own URLs and capability tokens from
|
|
193
|
+
* server configuration (`buildHttpMcpServer` + `createCapabilityToken` in
|
|
194
|
+
* ../tools). A client can therefore never inject an arbitrary MCP url, header,
|
|
195
|
+
* or token into the agent profile: the overlay's `mcp` values are typed as
|
|
196
|
+
* {@link SurfaceMcpServer} (= the server-built `AppToolMcpServer` entry shape),
|
|
197
|
+
* and only build() constructs them.
|
|
198
|
+
*/
|
|
199
|
+
|
|
200
|
+
/** Sandbox permission posture values, ranked deny > ask > allow for merging. */
|
|
201
|
+
type SurfacePermissionValue = 'allow' | 'ask' | 'deny';
|
|
202
|
+
/** The only MCP entry shape an overlay may carry: the server-built bridge
|
|
203
|
+
* entry from ../tools/mcp (transport, url, headers, and capability token all
|
|
204
|
+
* assembled server-side). The alias exists so overlay authors reach for the
|
|
205
|
+
* builders in ../tools rather than hand-rolling `{ url: ctx.url }` shapes
|
|
206
|
+
* that would let request data become a dialable endpoint. */
|
|
207
|
+
type SurfaceMcpServer = AppToolMcpServer;
|
|
208
|
+
/** What one surface contributes to the agent profile for a single turn. */
|
|
209
|
+
interface SurfaceOverlay {
|
|
210
|
+
/** MCP servers to mount for this turn, keyed by tool-routing name. Names
|
|
211
|
+
* must not collide with the base profile's — see {@link mergeSurfaceOverlay}. */
|
|
212
|
+
mcp?: Record<string, SurfaceMcpServer>;
|
|
213
|
+
/** Appended to the base system-prompt addendum with a blank-line separator. */
|
|
214
|
+
promptAddendum?: string;
|
|
215
|
+
/** Per-key posture the surface wants for its turns. Merging is monotone
|
|
216
|
+
* fail-closed: the stricter of base/overlay wins, so a surface can tighten
|
|
217
|
+
* the workspace posture but never relax it. */
|
|
218
|
+
permissions?: Record<string, SurfacePermissionValue>;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* One registered surface kind. `TCtx` is the shape build() expects — a CLAIM
|
|
222
|
+
* about the client payload, not a guarantee: the registry hands build() the
|
|
223
|
+
* request's `ctx` unvalidated, so build() must treat every field as an
|
|
224
|
+
* untrusted id (resolve it through access control that throws on a bad or
|
|
225
|
+
* foreign id) before minting anything from it.
|
|
226
|
+
*/
|
|
227
|
+
interface SurfaceKindDefinition<TCtx> {
|
|
228
|
+
kind: string;
|
|
229
|
+
build: (ctx: TCtx) => SurfaceOverlay | Promise<SurfaceOverlay>;
|
|
230
|
+
}
|
|
231
|
+
/** The variance-erased form a registry accepts (`build` is contravariant in
|
|
232
|
+
* `TCtx`, so every concrete definition is assignable to this). */
|
|
233
|
+
type AnySurfaceKind = SurfaceKindDefinition<never>;
|
|
234
|
+
/**
|
|
235
|
+
* Declare one surface kind. The `kind` string is the client-visible routing
|
|
236
|
+
* key (e.g. `'sequences'`); `build` is the server-side factory that turns a
|
|
237
|
+
* validated ctx into the overlay for one turn.
|
|
238
|
+
*/
|
|
239
|
+
declare function defineSurfaceKind<TCtx>(opts: {
|
|
240
|
+
kind: string;
|
|
241
|
+
build: (ctx: TCtx) => SurfaceOverlay | Promise<SurfaceOverlay>;
|
|
242
|
+
}): SurfaceKindDefinition<TCtx>;
|
|
243
|
+
interface SurfaceRegistry {
|
|
244
|
+
/** Build the overlay for one turn. Throws on an unknown kind — an unknown
|
|
245
|
+
* surface is a routing bug (client and server registries drifted), and
|
|
246
|
+
* silently returning an empty overlay would strip the surface's tools from
|
|
247
|
+
* the turn with no signal anywhere. Build errors propagate unwrapped. */
|
|
248
|
+
resolve(kind: string, ctx: unknown): Promise<SurfaceOverlay>;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Assemble the product's surface registry from its registered kinds. Duplicate
|
|
252
|
+
* kinds throw at construction: two builders behind one routing key would make
|
|
253
|
+
* the mounted toolset depend on registration order.
|
|
254
|
+
*/
|
|
255
|
+
declare function createSurfaceRegistry(kinds: readonly AnySurfaceKind[]): SurfaceRegistry;
|
|
256
|
+
/** Base-profile slice the merge reads/writes. Real callers pass their full
|
|
257
|
+
* profile object; every field outside this slice passes through untouched. */
|
|
258
|
+
interface SurfaceMergeBase {
|
|
259
|
+
mcp?: Record<string, unknown>;
|
|
260
|
+
systemPromptAddendum?: string;
|
|
261
|
+
permissions?: Record<string, SurfacePermissionValue>;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Merge one surface overlay into a base profile, returning a new object
|
|
265
|
+
* (the base is never mutated; untouched nested records are shared by
|
|
266
|
+
* reference).
|
|
267
|
+
*
|
|
268
|
+
* - `mcp`: overlay servers are added under their own names. A name already
|
|
269
|
+
* present on the base THROWS — a collision is two servers claiming one
|
|
270
|
+
* routing name, and renaming either silently would corrupt tool routing for
|
|
271
|
+
* whichever caller expected the original binding.
|
|
272
|
+
* - `systemPromptAddendum`: the overlay's `promptAddendum` appends after a
|
|
273
|
+
* blank-line separator (no separator when the base has no addendum).
|
|
274
|
+
* - `permissions`: per key the STRICTER value wins (deny > ask > allow). A
|
|
275
|
+
* surface can tighten the base posture for its turns; a base 'deny' survives
|
|
276
|
+
* any overlay.
|
|
277
|
+
*/
|
|
278
|
+
declare function mergeSurfaceOverlay<TBase extends SurfaceMergeBase>(base: TBase, overlay: SurfaceOverlay): TBase & SurfaceMergeBase;
|
|
279
|
+
|
|
173
280
|
interface LoopToolCall {
|
|
174
281
|
toolCallId?: string;
|
|
175
282
|
toolName: string;
|
|
@@ -346,4 +453,4 @@ interface StreamAppToolLoopOptions<Raw> {
|
|
|
346
453
|
*/
|
|
347
454
|
declare function streamAppToolLoop<Raw>(opts: StreamAppToolLoopOptions<Raw>): AsyncGenerator<StreamLoopYield<Raw>, void, unknown>;
|
|
348
455
|
|
|
349
|
-
export { type AgentRuntime, type AgentRuntimeModelConfig, type AgentTurnOptions, type AppToolLoopOptions, type CreateAgentRuntimeOptions, type LoopAssistantToolCall, type LoopEvent, type LoopMessage, type LoopToolCall, type OpenAICompatStreamTurnOptions, type OpenAIStreamChunk, type StreamAppToolLoopOptions, type StreamLoopYield, type ToolLoopResult, type ToolLoopStopReason, createAgentRuntime, createOpenAICompatStreamTurn, runAppToolLoop, streamAppToolLoop, toLoopEvents };
|
|
456
|
+
export { type AgentRuntime, type AgentRuntimeModelConfig, type AgentTurnOptions, type AnySurfaceKind, type AppToolLoopOptions, type CreateAgentRuntimeOptions, type LoopAssistantToolCall, type LoopEvent, type LoopMessage, type LoopToolCall, type OpenAICompatStreamTurnOptions, type OpenAIStreamChunk, type StreamAppToolLoopOptions, type StreamLoopYield, type SurfaceKindDefinition, type SurfaceMcpServer, type SurfaceMergeBase, type SurfaceOverlay, type SurfacePermissionValue, type SurfaceRegistry, type ToolLoopResult, type ToolLoopStopReason, createAgentRuntime, createOpenAICompatStreamTurn, createSurfaceRegistry, defineSurfaceKind, mergeSurfaceOverlay, runAppToolLoop, streamAppToolLoop, toLoopEvents };
|
package/dist/runtime/index.js
CHANGED
|
@@ -3,12 +3,15 @@ import {
|
|
|
3
3
|
buildCatalog,
|
|
4
4
|
createAgentRuntime,
|
|
5
5
|
createOpenAICompatStreamTurn,
|
|
6
|
+
createSurfaceRegistry,
|
|
7
|
+
defineSurfaceKind,
|
|
6
8
|
fetchModelCatalog,
|
|
9
|
+
mergeSurfaceOverlay,
|
|
7
10
|
normalizeModelId,
|
|
8
11
|
runAppToolLoop,
|
|
9
12
|
streamAppToolLoop,
|
|
10
13
|
toLoopEvents
|
|
11
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-ETX4O4BB.js";
|
|
12
15
|
import {
|
|
13
16
|
DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR,
|
|
14
17
|
DEFAULT_TANGLE_ROUTER_BASE_URL,
|
|
@@ -31,10 +34,13 @@ export {
|
|
|
31
34
|
buildCatalog,
|
|
32
35
|
createAgentRuntime,
|
|
33
36
|
createOpenAICompatStreamTurn,
|
|
37
|
+
createSurfaceRegistry,
|
|
34
38
|
createTangleRouterModelConfig,
|
|
39
|
+
defineSurfaceKind,
|
|
35
40
|
fetchModelCatalog,
|
|
36
41
|
isTangleBillingEnforcementDisabled,
|
|
37
42
|
isTangleExecutionKeyError,
|
|
43
|
+
mergeSurfaceOverlay,
|
|
38
44
|
normalizeModelId,
|
|
39
45
|
resolveTangleExecutionEnvironment,
|
|
40
46
|
resolveTangleModelConfig,
|