@tangle-network/agent-app 0.12.0 → 0.13.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.
Files changed (40) hide show
  1. package/dist/DesignCanvas-3JEEIT6Y.js +10 -0
  2. package/dist/DesignCanvas-3JEEIT6Y.js.map +1 -0
  3. package/dist/DesignCanvasEditor-37LPJIIR.js +9 -0
  4. package/dist/DesignCanvasEditor-37LPJIIR.js.map +1 -0
  5. package/dist/chunk-2Q73HGDI.js +1743 -0
  6. package/dist/chunk-2Q73HGDI.js.map +1 -0
  7. package/dist/{chunk-3WAJWYKD.js → chunk-6UOE5CTA.js} +9 -92
  8. package/dist/{chunk-3WAJWYKD.js.map → chunk-6UOE5CTA.js.map} +1 -1
  9. package/dist/chunk-7QCIYDGC.js +1119 -0
  10. package/dist/chunk-7QCIYDGC.js.map +1 -0
  11. package/dist/chunk-A76ZHWNF.js +194 -0
  12. package/dist/chunk-A76ZHWNF.js.map +1 -0
  13. package/dist/{chunk-CF5DZELC.js → chunk-ABGSFUJQ.js} +2 -2
  14. package/dist/chunk-F5KTWRO7.js +2276 -0
  15. package/dist/chunk-F5KTWRO7.js.map +1 -0
  16. package/dist/chunk-JZAJE3JL.js +990 -0
  17. package/dist/chunk-JZAJE3JL.js.map +1 -0
  18. package/dist/design-canvas/drizzle.d.ts +569 -0
  19. package/dist/design-canvas/drizzle.js +183 -0
  20. package/dist/design-canvas/drizzle.js.map +1 -0
  21. package/dist/design-canvas/index.d.ts +261 -0
  22. package/dist/design-canvas/index.js +96 -0
  23. package/dist/design-canvas/index.js.map +1 -0
  24. package/dist/design-canvas-react/index.d.ts +916 -0
  25. package/dist/design-canvas-react/index.js +423 -0
  26. package/dist/design-canvas-react/index.js.map +1 -0
  27. package/dist/export-presets-Dl5Aa5xj.d.ts +284 -0
  28. package/dist/index.d.ts +5 -0
  29. package/dist/index.js +99 -3
  30. package/dist/mcp-rpc-DLw_r9PQ.d.ts +55 -0
  31. package/dist/model-BHLN208Z.d.ts +183 -0
  32. package/dist/sequences/index.d.ts +4 -0
  33. package/dist/sequences/index.js +2 -2
  34. package/dist/store-CUStmtdH.d.ts +64 -0
  35. package/dist/tools/index.d.ts +1 -0
  36. package/dist/tools/index.js +6 -2
  37. package/package.json +28 -3
  38. package/dist/chunk-IJZJWKUK.js +0 -77
  39. package/dist/chunk-IJZJWKUK.js.map +0 -1
  40. /package/dist/{chunk-CF5DZELC.js.map → chunk-ABGSFUJQ.js.map} +0 -0
@@ -0,0 +1,284 @@
1
+ import { d as SceneElement, N as NewPageOptions, P as PageBleed, a as PageGuides, g as ScenePage, B as Bounds } from './model-BHLN208Z.js';
2
+
3
+ /**
4
+ * The design-canvas operation union — the ONE mutation vocabulary shared by
5
+ * the editor's command stack (human edits, undo/redo), the MCP tool
6
+ * dispatcher (agent edits), and programmatic automation (template
7
+ * instantiation, data sync). Every state change the editor can express is an
8
+ * operation here; anything not expressible here does not happen to a
9
+ * document. That closure is the automation contract: replaying a decision
10
+ * log reproduces the document.
11
+ *
12
+ * Attribute patches are validated per element kind in ./validate before
13
+ * ./apply mutates the document; both run server-side on every path.
14
+ */
15
+
16
+ /** Per-kind attribute patch. `kind` is immutable after creation; ids are
17
+ * immutable always. Validation rejects attrs foreign to the target's kind. */
18
+ type SceneAttrsPatch = Partial<Omit<SceneElement, 'id' | 'kind' | 'children'>> & {
19
+ text?: string;
20
+ width?: number;
21
+ height?: number;
22
+ points?: number[];
23
+ fill?: string;
24
+ stroke?: string;
25
+ strokeWidth?: number;
26
+ cornerRadius?: number;
27
+ dash?: number[];
28
+ fontFamily?: string;
29
+ fontSize?: number;
30
+ fontStyle?: 'normal' | 'bold' | 'italic' | 'bold italic';
31
+ align?: 'left' | 'center' | 'right';
32
+ lineHeight?: number;
33
+ letterSpacing?: number;
34
+ src?: string;
35
+ posterSrc?: string;
36
+ fit?: 'fill' | 'cover' | 'contain';
37
+ };
38
+ interface AddElementOperation {
39
+ type: 'add_element';
40
+ pageId: string;
41
+ /** Complete element including caller-minted id (reconciled like sequences
42
+ * clips when the server re-mints). */
43
+ element: SceneElement;
44
+ /** Insertion z-index; omitted → top. */
45
+ index?: number;
46
+ /** Parent group; omitted → page root. */
47
+ parentGroupId?: string;
48
+ }
49
+ interface SetAttrsOperation {
50
+ type: 'set_attrs';
51
+ pageId: string;
52
+ elementId: string;
53
+ attrs: SceneAttrsPatch;
54
+ }
55
+ interface ReorderElementOperation {
56
+ type: 'reorder_element';
57
+ pageId: string;
58
+ elementId: string;
59
+ /** Target index within the element's CURRENT owner (page root or group). */
60
+ toIndex: number;
61
+ }
62
+ interface DeleteElementOperation {
63
+ type: 'delete_element';
64
+ pageId: string;
65
+ elementId: string;
66
+ }
67
+ interface GroupElementsOperation {
68
+ type: 'group_elements';
69
+ pageId: string;
70
+ /** ≥ 2 sibling elements (same owner); grouped in their current z-order. */
71
+ elementIds: string[];
72
+ /** Caller-minted id for the new group. */
73
+ groupId: string;
74
+ name?: string;
75
+ }
76
+ interface UngroupElementOperation {
77
+ type: 'ungroup_element';
78
+ pageId: string;
79
+ groupId: string;
80
+ }
81
+ interface AddPageOperation {
82
+ type: 'add_page';
83
+ /** Caller-minted page id. */
84
+ pageId: string;
85
+ options?: NewPageOptions;
86
+ /** Position in the page list; omitted → end. */
87
+ index?: number;
88
+ }
89
+ interface DuplicatePageOperation {
90
+ type: 'duplicate_page';
91
+ sourcePageId: string;
92
+ /** Caller-minted id for the copy; element ids are re-minted server-side. */
93
+ pageId: string;
94
+ }
95
+ interface DeletePageOperation {
96
+ type: 'delete_page';
97
+ pageId: string;
98
+ }
99
+ interface ReorderPageOperation {
100
+ type: 'reorder_page';
101
+ pageId: string;
102
+ toIndex: number;
103
+ }
104
+ interface SetPagePropsOperation {
105
+ type: 'set_page_props';
106
+ pageId: string;
107
+ name?: string;
108
+ width?: number;
109
+ height?: number;
110
+ background?: string;
111
+ /** null clears bleed; omitted leaves unchanged. */
112
+ bleed?: PageBleed | null;
113
+ }
114
+ interface SetPageGuidesOperation {
115
+ type: 'set_page_guides';
116
+ pageId: string;
117
+ guides: PageGuides;
118
+ }
119
+ interface BindSlotOperation {
120
+ type: 'bind_slot';
121
+ pageId: string;
122
+ elementId: string;
123
+ /** null unbinds. Slot names are unique document-wide. */
124
+ slot: string | null;
125
+ }
126
+ /** Fill slots with data — text slots take strings, image/video slots take
127
+ * src URLs. Unknown slot names throw; partial application is allowed. */
128
+ interface ApplyDataOperation {
129
+ type: 'apply_data';
130
+ bindings: Record<string, string>;
131
+ }
132
+ interface SetDocumentTitleOperation {
133
+ type: 'set_document_title';
134
+ title: string;
135
+ }
136
+ type SceneOperation = AddElementOperation | SetAttrsOperation | ReorderElementOperation | DeleteElementOperation | GroupElementsOperation | UngroupElementOperation | AddPageOperation | DuplicatePageOperation | DeletePageOperation | ReorderPageOperation | SetPagePropsOperation | SetPageGuidesOperation | BindSlotOperation | ApplyDataOperation | SetDocumentTitleOperation;
137
+ interface ScenePlan {
138
+ summary: string;
139
+ operations: SceneOperation[];
140
+ }
141
+ type SceneOperationType = SceneOperation['type'];
142
+ declare const SCENE_OPERATION_TYPES: readonly SceneOperationType[];
143
+
144
+ /**
145
+ * Page size presets, channel-size output presets, and export math for the
146
+ * design canvas.
147
+ *
148
+ * Size presets (SizePreset / SIZE_PRESETS) describe page dimensions for the
149
+ * new-page dialog. Export presets (ExportPreset / EXPORT_PRESETS) pin pixel
150
+ * ratio, output dimensions, bleed, and format for the export dialog and the
151
+ * MCP export tool. Channel presets (ChannelPreset / CHANNEL_PRESETS) are the
152
+ * fixed output resolutions the export UI offers; `scaleForPreset` + the
153
+ * letterbox helper derive Konva stage parameters from them.
154
+ *
155
+ * All dimensions are CSS pixels at 96 DPI unless noted otherwise.
156
+ */
157
+
158
+ interface SizePreset {
159
+ id: string;
160
+ label: string;
161
+ category: 'social' | 'print' | 'presentation' | 'custom';
162
+ width: number;
163
+ height: number;
164
+ }
165
+ declare const SIZE_PRESETS: readonly SizePreset[];
166
+ declare function findPreset(id: string): SizePreset | null;
167
+ /** Match a (width, height) pair against the preset table. Returns the first
168
+ * exact match or null — used to drive the dropdown selection indicator. */
169
+ declare function matchPreset(width: number, height: number): SizePreset | null;
170
+ type ExportFormat = 'png' | 'jpeg';
171
+ /**
172
+ * Export quality preset — pins pixel density, optional output dimensions,
173
+ * bleed inclusion, and raster format so callers pass a preset id rather than
174
+ * a full parameter bag.
175
+ *
176
+ * `outputWidth` / `outputHeight`: when non-null, the pixel ratio is derived
177
+ * from the crop rect width (see `scaleForPreset`) so the output is exactly
178
+ * this many pixels wide. When null, `pixelRatio` applies directly.
179
+ */
180
+ interface ExportPreset {
181
+ name: string;
182
+ /** Target pixels-per-document-px for stage.toDataURL. */
183
+ pixelRatio: number;
184
+ outputWidth: number | null;
185
+ outputHeight: number | null;
186
+ /** Whether bleed margins are included in the crop rect. */
187
+ includeBleed: boolean;
188
+ format: ExportFormat;
189
+ }
190
+ declare const EXPORT_PRESETS: Record<string, ExportPreset>;
191
+ interface ExportCropRect {
192
+ /** Page-coordinate origin. Negative when bleed extends outside page bounds. */
193
+ x: number;
194
+ y: number;
195
+ width: number;
196
+ height: number;
197
+ }
198
+ /**
199
+ * Crop rectangle in page coordinates for a given page, optionally expanded to
200
+ * include bleed margins. Bleed extends OUTSIDE the page bounds, so the origin
201
+ * goes negative when bleed is included.
202
+ *
203
+ * When `includeBleed` is true but `page.bleed` is null, the page rect is
204
+ * returned unchanged — the caller must not assume symmetric expansion.
205
+ */
206
+ declare function bleedAwareExportBounds(page: ScenePage, includeBleed: boolean): ExportCropRect;
207
+ /**
208
+ * Pixel ratio for stage.toDataURL given a crop rect and an export preset.
209
+ *
210
+ * When the preset pins `outputWidth`, the ratio is derived from the crop rect
211
+ * width so the final raster is exactly that many pixels wide. When there is no
212
+ * output pin, the preset's declared `pixelRatio` is returned directly.
213
+ *
214
+ * The crop rect must already account for bleed inclusion before this call.
215
+ */
216
+ declare function scaleForPreset(preset: ExportPreset, cropRect: ExportCropRect): number;
217
+ interface ChannelPreset {
218
+ id: string;
219
+ label: string;
220
+ width: number;
221
+ height: number;
222
+ }
223
+ /**
224
+ * Fixed output resolution presets for the channel/platform export dialog.
225
+ * Width × height are OUTPUT pixels (the raster the export produces), not page
226
+ * CSS px — they describe the target delivery format, not the canvas layout.
227
+ * The a4_print_2480x3508 preset corresponds to A4 at 300 dpi.
228
+ */
229
+ declare const CHANNEL_PRESETS: readonly ChannelPreset[];
230
+ type ChannelPresetId = (typeof CHANNEL_PRESETS)[number]['id'];
231
+ /** Throws when the id is unknown — callers should only pass ids sourced from
232
+ * `CHANNEL_PRESETS`. */
233
+ declare function requireChannelPreset(id: string): ChannelPreset;
234
+ interface ChannelScaleResult {
235
+ /**
236
+ * Konva stage pixelRatio: the stage logical size stays at page dimensions;
237
+ * the backing canvas renders at `pixelRatio × page` px. Setting Konva's
238
+ * pixelRatio to this value yields an output canvas exactly
239
+ * `channelPreset.width × channelPreset.height` pixels.
240
+ */
241
+ pixelRatio: number;
242
+ /**
243
+ * Horizontal letterbox offset in PAGE-coordinate px. Add to the stage x
244
+ * translation so the page is centered horizontally in the output frame.
245
+ * Zero when the page fills the full width after scaling.
246
+ */
247
+ offsetX: number;
248
+ /**
249
+ * Vertical letterbox offset in PAGE-coordinate px. Add to the stage y
250
+ * translation. Zero when the page fills the full height.
251
+ */
252
+ offsetY: number;
253
+ fit: 'contain';
254
+ }
255
+ /**
256
+ * Computes the Konva stage parameters to render `page` centered inside
257
+ * `channelPreset` without cropping (contain / letterbox).
258
+ *
259
+ * Exact-ratio fast path: when page and preset share the same aspect ratio
260
+ * (within 1e-9 floating-point tolerance) both offsets are 0 and pixelRatio
261
+ * is exact.
262
+ *
263
+ * Example — 1080×1080 page into 1920×1080 preset:
264
+ * scaleX = 1920/1080 ≈ 1.7778, scaleY = 1080/1080 = 1.0
265
+ * pixelRatio = 1.0, rendered page = 1080×1080 px
266
+ * offsetX = (1920 − 1080) / 2 / 1.0 = 420 page-px, offsetY = 0
267
+ */
268
+ declare function scalePageForChannelPreset(page: Pick<ScenePage, 'width' | 'height'>, channelPreset: ChannelPreset): ChannelScaleResult;
269
+ /**
270
+ * Export rectangle in page coordinates that includes bleed margins when
271
+ * present. When `page.bleed` is null, returns the trim rectangle (origin 0,0;
272
+ * size = page dimensions).
273
+ *
274
+ * The bleed rectangle extends OUTSIDE the page: x and y are negative (bleed
275
+ * bleeds off the left/top edge), width and height exceed the page by the
276
+ * combined bleed on each axis. Pass into Konva's clip/export bounds to
277
+ * include the bleed zone in the render.
278
+ *
279
+ * Named `bleedAwareExportRect` to avoid collision with the two-arg
280
+ * `bleedAwareExportBounds(page, includeBleed)` above.
281
+ */
282
+ declare function bleedAwareExportRect(page: Pick<ScenePage, 'width' | 'height' | 'bleed'>): Bounds;
283
+
284
+ export { type AddElementOperation as A, type BindSlotOperation as B, CHANNEL_PRESETS as C, type DeleteElementOperation as D, EXPORT_PRESETS as E, scaleForPreset as F, type GroupElementsOperation as G, scalePageForChannelPreset as H, type ReorderElementOperation as R, SCENE_OPERATION_TYPES as S, type UngroupElementOperation as U, type AddPageOperation as a, type ApplyDataOperation as b, type ChannelPreset as c, type ChannelPresetId as d, type ChannelScaleResult as e, type DeletePageOperation as f, type DuplicatePageOperation as g, type ExportCropRect as h, type ExportFormat as i, type ExportPreset as j, type ReorderPageOperation as k, SIZE_PRESETS as l, type SceneAttrsPatch as m, type SceneOperation as n, type SceneOperationType as o, type ScenePlan as p, type SetAttrsOperation as q, type SetDocumentTitleOperation as r, type SetPageGuidesOperation as s, type SetPagePropsOperation as t, type SizePreset as u, bleedAwareExportBounds as v, bleedAwareExportRect as w, findPreset as x, matchPreset as y, requireChannelPreset as z };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { AppToolRuntimeExecutor, CapabilityTokenOptions, DispatchOptions, ExpiringCapabilityTokenOptions, HandleToolRequestOptions, RuntimeExecutorOptions, ToolInputError, createAppToolRuntimeExecutor, createCapabilityToken, createExpiringCapabilityToken, dispatchAppTool, handleAppToolRequest, outcomeStatus, verifyCapabilityToken, verifyExpiringCapabilityToken } from './tools/index.js';
2
2
  export { A as APP_TOOL_NAMES, a as AppToolMcpServer, b as AppToolName, 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, f as ToolHeaderNames, g as authenticateToolRequest, h as buildAppToolMcpServer, i as buildAppToolOpenAITools, j as buildHttpMcpServer, k as isAppToolName, r as readToolArgs } from './mcp-CIupfjxV.js';
3
+ 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';
3
4
  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-By4B3K37.js';
4
5
  export { BuildDelegationOptions, DELEGATION_MCP_SERVER_KEY, DELEGATION_TOOLS, DelegationMcpServer, buildDelegationMcpServer, delegationMcpForConfig } from './delegation/index.js';
5
6
  export { BrokerToken, BrokerTokenMinter, BrokerTokenProvider, BrokerTokenProviderOptions, ConsentUrlInput, buildConsentUrl, createBrokerTokenProvider } from './tangle/index.js';
@@ -23,6 +24,10 @@ export { DistributionSummary, FlowSpan, FlowTrace, LoopTraceEventLike, MissionFl
23
24
  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, j as SequenceMediaKind, k as SequenceMeta, l as SequenceStatus, m as SequenceStore, n as SequenceStoreScope, o as SequenceTimeline, p as SequenceTrack, q as SequenceTrackKind, T as TimelineClipBounds, r as TimelineInterval, 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';
24
25
  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';
25
26
  export { BuildCaptionChunksOptions, BuildSequencesMcpServerEntryOptions, CaptionChunk, CaptionCoverageEntry, CaptionExportOptions, ContactSheetEntry, ContactSheetManifest, CreateSequencesMcpHandlerOptions, DEFAULT_SEQUENCES_MCP_DESCRIPTION, LanguageFanoutOptions, MAX_CAPTION_BATCH, OtioClip, OtioExternalReference, OtioGap, OtioMissingReference, OtioRationalTime, OtioStack, OtioTimeRange, OtioTimeline, OtioTrack, SEQUENCES_MCP_PROTOCOL_VERSIONS, SEQUENCE_EXPORT_FORMATS, SEQUENCE_MCP_TOOLS, SEQUENCE_MEDIA_KINDS, SEQUENCE_TRACK_KINDS, SequenceMcpToolDefinition, SequenceMcpToolEnv, SequencesMcpServerInfo, TranscriptSegment, buildCaptionChunks, buildContactSheetManifest, buildEdl, buildOtio, buildSequencesMcpServerEntry, buildSrt, buildVtt, captionCoverage, createSequencesMcpHandler, findSequenceMcpTool, normalizeLanguageTag, planLanguageFanout } from './sequences/index.js';
27
+ export { B as Bounds, E as EllipseElement, G as GroupElement, I as ImageElement, L as LineElement, N as NewPageOptions, P as PageBleed, a as PageGuides, R as RectElement, S as SCENE_ELEMENT_KINDS, b as SCENE_SCHEMA_VERSION, c as SceneDocument, d as SceneElement, e as SceneElementBase, f as SceneElementKind, g as ScenePage, h as SceneSettings, T as TextElement, V as VideoElement, i as assertColor, j as assertFinite, k as assertPositiveFinite, l as assertSceneMediaSrc, m as boundsIntersect, n as collectSlots, o as createEmptyDocument, p as createPage, q as elementAabb, r as elementExtent, s as estimateTextHeight, t as findElement, u as requireElement, v as requirePage } from './model-BHLN208Z.js';
28
+ export { A as AddElementOperation, a as AddPageOperation, b as ApplyDataOperation, B as BindSlotOperation, C as CHANNEL_PRESETS, c as ChannelPreset, d as ChannelPresetId, e as ChannelScaleResult, D as DeleteElementOperation, f as DeletePageOperation, g as DuplicatePageOperation, E as EXPORT_PRESETS, h as ExportCropRect, i as ExportFormat, j as ExportPreset, G as GroupElementsOperation, R as ReorderElementOperation, k as ReorderPageOperation, S as SCENE_OPERATION_TYPES, l as SIZE_PRESETS, m as SceneAttrsPatch, n as SceneOperation, o as SceneOperationType, p as ScenePlan, q as SetAttrsOperation, r as SetDocumentTitleOperation, s as SetPageGuidesOperation, t as SetPagePropsOperation, u as SizePreset, U as UngroupElementOperation, v as bleedAwareExportBounds, w as bleedAwareExportRect, x as findPreset, y as matchPreset, z as requireChannelPreset, F as scaleForPreset, H as scalePageForChannelPreset } from './export-presets-Dl5Aa5xj.js';
29
+ export { N as NewSceneDecision, S as SceneDecision, a as SceneDocumentRecord, b as SceneExportFormat, c as SceneExportRecord, d as SceneStore, e as SceneStoreScope } from './store-CUStmtdH.js';
30
+ export { ApplySceneOptions, BuildDesignCanvasMcpServerEntryOptions, CANVAS_ELEMENT_KINDS, CANVAS_MCP_TOOLS, CANVAS_MCP_TOOL_NAMES, CreateDesignCanvasMcpHandlerOptions, DEFAULT_DESIGN_CANVAS_MCP_DESCRIPTION, DesignCanvasMcpServerInfo, DesignCanvasMcpToolEnv, InstantiateOptions, SceneApplyResult, SlotFillKind, TemplateSlot, applyBindingsToDocument, applySceneOperation, applySceneOperations, buildDesignCanvasMcpServerEntry, createDesignCanvasMcpHandler, findCanvasMcpTool, instantiateTemplate, listTemplateSlots, storeApplyScenePlan, validateBindings, validateSceneOperation, validateSceneOperations, validateSlotValue } from './design-canvas/index.js';
26
31
  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';
27
32
  export { CompletionRequirement, CompletionVerdict, CorrectnessChecker, ProducedState, RuntimeEventLike, SatisfiedBy, TaskGold, createLlmCorrectnessChecker, extractProducedState, verifyCompletion, weightedComposite } from '@tangle-network/agent-eval';
28
33
  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';
package/dist/index.js CHANGED
@@ -41,7 +41,21 @@ import {
41
41
  validateSetClipText,
42
42
  validateSplitClip,
43
43
  validateTrimClip
44
- } from "./chunk-3WAJWYKD.js";
44
+ } from "./chunk-6UOE5CTA.js";
45
+ import {
46
+ CANVAS_ELEMENT_KINDS,
47
+ CANVAS_MCP_TOOLS,
48
+ CANVAS_MCP_TOOL_NAMES,
49
+ DEFAULT_DESIGN_CANVAS_MCP_DESCRIPTION,
50
+ SCENE_OPERATION_TYPES,
51
+ applyBindingsToDocument,
52
+ buildDesignCanvasMcpServerEntry,
53
+ createDesignCanvasMcpHandler,
54
+ findCanvasMcpTool,
55
+ instantiateTemplate,
56
+ listTemplateSlots,
57
+ validateBindings
58
+ } from "./chunk-7QCIYDGC.js";
45
59
  import {
46
60
  MIN_SEQUENCE_CLIP_FRAMES,
47
61
  assertClipFitsSequence,
@@ -55,6 +69,40 @@ import {
55
69
  snapshotFrame,
56
70
  trackIntervals
57
71
  } from "./chunk-ZYBWGSAZ.js";
72
+ import {
73
+ CHANNEL_PRESETS,
74
+ EXPORT_PRESETS,
75
+ SCENE_ELEMENT_KINDS,
76
+ SCENE_SCHEMA_VERSION,
77
+ SIZE_PRESETS,
78
+ applySceneOperation,
79
+ applySceneOperations,
80
+ assertColor,
81
+ assertFinite,
82
+ assertPositiveFinite,
83
+ assertSceneMediaSrc,
84
+ bleedAwareExportBounds,
85
+ bleedAwareExportRect,
86
+ boundsIntersect,
87
+ collectSlots,
88
+ createEmptyDocument,
89
+ createPage,
90
+ elementAabb,
91
+ elementExtent,
92
+ estimateTextHeight,
93
+ findElement,
94
+ findPreset,
95
+ matchPreset,
96
+ requireChannelPreset,
97
+ requireElement,
98
+ requirePage,
99
+ scaleForPreset,
100
+ scalePageForChannelPreset,
101
+ storeApplyScenePlan,
102
+ validateSceneOperation,
103
+ validateSceneOperations,
104
+ validateSlotValue
105
+ } from "./chunk-JZAJE3JL.js";
58
106
  import {
59
107
  DEFAULT_MISSION_STEP_KINDS,
60
108
  MISSION_CONTROL_CHANNEL_ID,
@@ -199,15 +247,17 @@ import {
199
247
  handleAppToolRequest,
200
248
  verifyCapabilityToken,
201
249
  verifyExpiringCapabilityToken
202
- } from "./chunk-CF5DZELC.js";
250
+ } from "./chunk-ABGSFUJQ.js";
203
251
  import {
204
252
  DEFAULT_APP_TOOL_PATHS,
205
253
  DEFAULT_HEADER_NAMES,
254
+ MCP_PROTOCOL_VERSIONS,
206
255
  authenticateToolRequest,
207
256
  buildAppToolMcpServer,
208
257
  buildHttpMcpServer,
258
+ createMcpToolHandler,
209
259
  readToolArgs
210
- } from "./chunk-IJZJWKUK.js";
260
+ } from "./chunk-A76ZHWNF.js";
211
261
  import {
212
262
  DELEGATION_MCP_SERVER_KEY,
213
263
  DELEGATION_TOOLS,
@@ -270,9 +320,14 @@ export {
270
320
  APP_TOOL_NAMES,
271
321
  ApprovalEventSchema,
272
322
  BrandTokensSchema,
323
+ CANVAS_ELEMENT_KINDS,
324
+ CANVAS_MCP_TOOLS,
325
+ CANVAS_MCP_TOOL_NAMES,
326
+ CHANNEL_PRESETS,
273
327
  ConversionMetricsSchema,
274
328
  CopyContentSchema,
275
329
  DEFAULT_APP_TOOL_PATHS,
330
+ DEFAULT_DESIGN_CANVAS_MCP_DESCRIPTION,
276
331
  DEFAULT_HARNESS,
277
332
  DEFAULT_HEADER_NAMES,
278
333
  DEFAULT_MISSION_STEP_KINDS,
@@ -282,23 +337,29 @@ export {
282
337
  DEFAULT_TANGLE_ROUTER_BASE_URL,
283
338
  DELEGATION_MCP_SERVER_KEY,
284
339
  DELEGATION_TOOLS,
340
+ EXPORT_PRESETS,
285
341
  EmailContentSchema,
286
342
  HubExecClient,
287
343
  ImageContentSchema,
288
344
  KNOWN_HARNESSES,
289
345
  MAX_CAPTION_BATCH,
346
+ MCP_PROTOCOL_VERSIONS,
290
347
  MIN_SEQUENCE_CLIP_FRAMES,
291
348
  MISSION_CONTROL_CHANNEL_ID,
292
349
  MissionConcurrencyError,
293
350
  PRESET_MIGRATION_SQL,
294
351
  PRESET_TABLES,
295
352
  RetryableStepError,
353
+ SCENE_ELEMENT_KINDS,
354
+ SCENE_OPERATION_TYPES,
355
+ SCENE_SCHEMA_VERSION,
296
356
  SEQUENCES_MCP_PROTOCOL_VERSIONS,
297
357
  SEQUENCE_EXPORT_FORMATS,
298
358
  SEQUENCE_MCP_TOOLS,
299
359
  SEQUENCE_MEDIA_KINDS,
300
360
  SEQUENCE_OPERATION_TYPES,
301
361
  SEQUENCE_TRACK_KINDS,
362
+ SIZE_PRESETS,
302
363
  TURN_EVENTS_MIGRATION_SQL,
303
364
  TangleExecutionKeyError,
304
365
  ToolInputError,
@@ -306,15 +367,25 @@ export {
306
367
  __resetCatalogCache,
307
368
  addSecurityHeaders,
308
369
  agentAppConfigJsonSchema,
370
+ applyBindingsToDocument,
309
371
  applyMissionEvent,
372
+ applySceneOperation,
373
+ applySceneOperations,
310
374
  applySequenceOperation,
311
375
  applySequenceOperations,
312
376
  asMissionStreamEvent,
313
377
  asRecord,
314
378
  asString,
315
379
  assertClipFitsSequence,
380
+ assertColor,
381
+ assertFinite,
382
+ assertPositiveFinite,
383
+ assertSceneMediaSrc,
316
384
  assertSequenceMediaUrl,
317
385
  authenticateToolRequest,
386
+ bleedAwareExportBounds,
387
+ bleedAwareExportRect,
388
+ boundsIntersect,
318
389
  budgetGateProposalId,
319
390
  buildAgentMissionPlan,
320
391
  buildAppToolMcpServer,
@@ -324,6 +395,7 @@ export {
324
395
  buildConsentUrl,
325
396
  buildContactSheetManifest,
326
397
  buildDelegationMcpServer,
398
+ buildDesignCanvasMcpServerEntry,
327
399
  buildEdl,
328
400
  buildFlowTrace,
329
401
  buildHttpMcpServer,
@@ -344,6 +416,7 @@ export {
344
416
  clearCookieHeader,
345
417
  coalesceDeltas,
346
418
  coerceHarness,
419
+ collectSlots,
347
420
  composeMissionFlowTrace,
348
421
  createAgentRuntime,
349
422
  createAppToolRuntimeExecutor,
@@ -351,16 +424,20 @@ export {
351
424
  createCapabilityToken,
352
425
  createD1KnowledgeStateAccessor,
353
426
  createD1TurnEventStore,
427
+ createDesignCanvasMcpHandler,
428
+ createEmptyDocument,
354
429
  createExpiringCapabilityToken,
355
430
  createFieldCrypto,
356
431
  createInMemoryMissionStore,
357
432
  createKnowledgeLoop,
358
433
  createLlmCorrectnessChecker,
434
+ createMcpToolHandler,
359
435
  createMemoryTurnEventStore,
360
436
  createMissionEngine,
361
437
  createMissionService,
362
438
  createMissionTraceContext,
363
439
  createOpenAICompatStreamTurn,
440
+ createPage,
364
441
  createPlatformBalanceManager,
365
442
  createPresetDrizzleSchema,
366
443
  createPresetFieldCrypto,
@@ -386,20 +463,27 @@ export {
386
463
  deriveSignals,
387
464
  detectSpans,
388
465
  dispatchAppTool,
466
+ elementAabb,
467
+ elementExtent,
389
468
  encodeEvent,
390
469
  encryptAesGcm,
391
470
  encryptBytes,
392
471
  encryptWithKey,
472
+ estimateTextHeight,
393
473
  extractProducedState,
394
474
  extractRequestContext,
395
475
  fetchModelCatalog,
396
476
  finalizeAssistantParts,
477
+ findCanvasMcpTool,
478
+ findElement,
479
+ findPreset,
397
480
  findSequenceMcpTool,
398
481
  formatSeconds,
399
482
  formatTimecode,
400
483
  framesToSeconds,
401
484
  getPartKey,
402
485
  handleAppToolRequest,
486
+ instantiateTemplate,
403
487
  invokeIntegrationHub,
404
488
  isAppToolName,
405
489
  isHarness,
@@ -408,8 +492,10 @@ export {
408
492
  isTangleBillingEnforcementDisabled,
409
493
  isTangleExecutionKeyError,
410
494
  lastClipEndFrame,
495
+ listTemplateSlots,
411
496
  loopTraceEventsToFlowSpans,
412
497
  maskSpans,
498
+ matchPreset,
413
499
  mergeMissionState,
414
500
  mergePersistedPart,
415
501
  mergeSurfaceOverlay,
@@ -437,6 +523,9 @@ export {
437
523
  renderHistogram,
438
524
  renderWaterfall,
439
525
  replayTurnEvents,
526
+ requireChannelPreset,
527
+ requireElement,
528
+ requirePage,
440
529
  requireString,
441
530
  resolveCaptionPlacement,
442
531
  resolveCaptionTarget,
@@ -454,12 +543,15 @@ export {
454
543
  reviewCandidate,
455
544
  runAppToolLoop,
456
545
  safeParseAssetSpec,
546
+ scaleForPreset,
547
+ scalePageForChannelPreset,
457
548
  secondsToFrames,
458
549
  serializeCookie,
459
550
  snapshotFrame,
460
551
  stepActivityFlowTrace,
461
552
  stepAgentActivity,
462
553
  stepGateProposalId,
554
+ storeApplyScenePlan,
463
555
  streamAppToolLoop,
464
556
  summarize,
465
557
  tangleExecutionKeyHttpError,
@@ -468,16 +560,20 @@ export {
468
560
  traceEnv,
469
561
  trackIntervals,
470
562
  validateAddCaption,
563
+ validateBindings,
471
564
  validateCreateTrack,
472
565
  validateDeleteClip,
473
566
  validateExtendSequence,
474
567
  validateMoveClip,
475
568
  validatePlaceClip,
476
569
  validateQueueExport,
570
+ validateSceneOperation,
571
+ validateSceneOperations,
477
572
  validateSequenceOperation,
478
573
  validateSequenceOperations,
479
574
  validateSetClipDisabled,
480
575
  validateSetClipText,
576
+ validateSlotValue,
481
577
  validateSplitClip,
482
578
  validateTrimClip,
483
579
  verifyCapabilityToken,
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Generic streamable-HTTP JSON-RPC 2.0 envelope for a tools-only MCP server.
3
+ * Stateless, Workers-compatible: no session table, no SSE — every request gets
4
+ * a single `application/json` response, which the streamable-HTTP transport
5
+ * explicitly permits for tools-only servers.
6
+ *
7
+ * Protocol surface:
8
+ * initialize → echo client's protocolVersion if supported, else latest
9
+ * ping → empty result {}
10
+ * notifications/* (no `id`) → 202 with no body
11
+ * tools/list → tool manifest
12
+ * tools/call → run + surface execution failures as isError text results
13
+ * anything else → -32601
14
+ *
15
+ * Execution failures (argument shape, validation, store throws) become `isError`
16
+ * tool results carrying the thrown message verbatim — the model reads WHY and
17
+ * retries. Protocol misuse becomes a JSON-RPC error object.
18
+ */
19
+ declare const MCP_PROTOCOL_VERSIONS: readonly ["2025-06-18", "2025-03-26", "2024-11-05"];
20
+ type McpProtocolVersion = (typeof MCP_PROTOCOL_VERSIONS)[number];
21
+ interface McpServerInfo {
22
+ name: string;
23
+ version: string;
24
+ }
25
+ /** One tool entry in the registry the handler owns. */
26
+ interface McpToolDefinition<TEnv = Record<string, never>> {
27
+ name: string;
28
+ description: string;
29
+ /** JSON Schema for the `params.arguments` object. */
30
+ inputSchema: Record<string, unknown>;
31
+ /** Receive validated (Record) args + the env the handler threaded; throw to
32
+ * surface an isError result — never throw for protocol/framing issues. */
33
+ run(args: Record<string, unknown>, env: TEnv): Promise<unknown>;
34
+ }
35
+ interface CreateMcpToolHandlerOptions<TEnv = Record<string, never>> {
36
+ serverInfo: McpServerInfo;
37
+ /** Full tool list; order IS the tools/list order. */
38
+ tools: McpToolDefinition<TEnv>[];
39
+ /** Per-request environment threaded into every `run` call. If your tools are
40
+ * stateless (or carry state through closure) pass an empty builder:
41
+ * `() => ({} as TEnv)`. */
42
+ buildEnv(request: Request): TEnv | Promise<TEnv>;
43
+ }
44
+ /**
45
+ * Build a request handler for a tools-only MCP server. The returned function
46
+ * accepts a standard `Request` and resolves to a `Response` — mount it on any
47
+ * Cloudflare Worker route or Remix `loader`.
48
+ *
49
+ * The handler calls `buildEnv` exactly ONCE per `tools/call` request (after
50
+ * the tool is found, before `run`) — non-`tools/call` paths skip it entirely
51
+ * so metadata requests do not pay env-build cost.
52
+ */
53
+ declare function createMcpToolHandler<TEnv = Record<string, never>>(opts: CreateMcpToolHandlerOptions<TEnv>): (request: Request) => Promise<Response>;
54
+
55
+ export { type CreateMcpToolHandlerOptions as C, MCP_PROTOCOL_VERSIONS as M, type McpProtocolVersion as a, type McpServerInfo as b, type McpToolDefinition as c, createMcpToolHandler as d };