@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.
Files changed (42) hide show
  1. package/dist/TimelineEditor-OXPJZDP2.js +12 -0
  2. package/dist/TimelineEditor-OXPJZDP2.js.map +1 -0
  3. package/dist/apply-Cp8c3K9D.d.ts +249 -0
  4. package/dist/billing/index.js +1 -1
  5. package/dist/chunk-3WAJWYKD.js +1730 -0
  6. package/dist/chunk-3WAJWYKD.js.map +1 -0
  7. package/dist/chunk-CF5DZELC.js +111 -0
  8. package/dist/chunk-CF5DZELC.js.map +1 -0
  9. package/dist/{chunk-4YTWB5MG.js → chunk-ETX4O4BB.js} +98 -1
  10. package/dist/chunk-ETX4O4BB.js.map +1 -0
  11. package/dist/{chunk-YS6A6G57.js → chunk-G3HCU7TA.js} +37 -4
  12. package/dist/chunk-G3HCU7TA.js.map +1 -0
  13. package/dist/chunk-IHR6K3GF.js +2367 -0
  14. package/dist/chunk-IHR6K3GF.js.map +1 -0
  15. package/dist/{chunk-OLCVUGGI.js → chunk-IJZJWKUK.js} +1 -61
  16. package/dist/chunk-IJZJWKUK.js.map +1 -0
  17. package/dist/{chunk-EYXTDVDY.js → chunk-SAOAAA3S.js} +2 -2
  18. package/dist/chunk-ZYBWGSAZ.js +130 -0
  19. package/dist/chunk-ZYBWGSAZ.js.map +1 -0
  20. package/dist/index.d.ts +6 -2
  21. package/dist/index.js +130 -8
  22. package/dist/mcp-CIupfjxV.d.ts +112 -0
  23. package/dist/preset-cloudflare/index.js +2 -2
  24. package/dist/runtime/index.d.ts +108 -1
  25. package/dist/runtime/index.js +7 -1
  26. package/dist/sequences/drizzle.d.ts +1244 -0
  27. package/dist/sequences/drizzle.js +368 -0
  28. package/dist/sequences/drizzle.js.map +1 -0
  29. package/dist/sequences/index.d.ts +327 -0
  30. package/dist/sequences/index.js +114 -0
  31. package/dist/sequences/index.js.map +1 -0
  32. package/dist/sequences-react/index.d.ts +752 -0
  33. package/dist/sequences-react/index.js +241 -0
  34. package/dist/sequences-react/index.js.map +1 -0
  35. package/dist/store-gckrNq-g.d.ts +242 -0
  36. package/dist/tools/index.d.ts +24 -108
  37. package/dist/tools/index.js +12 -6
  38. package/package.json +37 -2
  39. package/dist/chunk-4YTWB5MG.js.map +0 -1
  40. package/dist/chunk-OLCVUGGI.js.map +0 -1
  41. package/dist/chunk-YS6A6G57.js.map +0 -1
  42. /package/dist/{chunk-EYXTDVDY.js.map → chunk-SAOAAA3S.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createWorkspaceKeyManager
3
- } from "./chunk-YS6A6G57.js";
3
+ } from "./chunk-G3HCU7TA.js";
4
4
  import {
5
5
  createFieldCrypto
6
6
  } from "./chunk-TA5Q4I2K.js";
@@ -315,4 +315,4 @@ export {
315
315
  createPresetWorkspaceKeyStore,
316
316
  createPresetWorkspaceKeyManager
317
317
  };
318
- //# sourceMappingURL=chunk-EYXTDVDY.js.map
318
+ //# sourceMappingURL=chunk-SAOAAA3S.js.map
@@ -0,0 +1,130 @@
1
+ // src/sequences/model.ts
2
+ var MIN_SEQUENCE_CLIP_FRAMES = 1;
3
+ function secondsToFrames(seconds, fps) {
4
+ if (!Number.isFinite(seconds) || seconds < 0) throw new Error("seconds must be a non-negative finite number");
5
+ assertFps(fps);
6
+ return Math.round(seconds * fps);
7
+ }
8
+ function framesToSeconds(frames, fps) {
9
+ if (!Number.isInteger(frames) || frames < 0) throw new Error("frames must be a non-negative integer");
10
+ assertFps(fps);
11
+ return frames / fps;
12
+ }
13
+ function formatSeconds(seconds) {
14
+ return Number.isInteger(seconds) ? `${seconds}s` : `${seconds.toFixed(2)}s`;
15
+ }
16
+ function formatTimecode(frames, fps) {
17
+ assertFps(fps);
18
+ if (!Number.isInteger(frames) || frames < 0) throw new Error("frames must be a non-negative integer");
19
+ const totalSeconds = Math.floor(frames / fps);
20
+ const minutes = Math.floor(totalSeconds / 60);
21
+ const seconds = totalSeconds % 60;
22
+ const residualFrames = frames % fps;
23
+ return `${minutes}:${String(seconds).padStart(2, "0")}.${String(residualFrames).padStart(2, "0")}`;
24
+ }
25
+ function clampClipStart(input) {
26
+ assertSequenceDuration(input.sequenceDurationFrames);
27
+ assertClipDuration(input.durationFrames);
28
+ return Math.max(0, Math.min(input.sequenceDurationFrames - input.durationFrames, input.startFrame));
29
+ }
30
+ function clampClipDuration(input) {
31
+ assertSequenceDuration(input.sequenceDurationFrames);
32
+ if (input.startFrame < 0 || input.startFrame >= input.sequenceDurationFrames) {
33
+ throw new Error("startFrame must be inside the sequence");
34
+ }
35
+ return Math.max(MIN_SEQUENCE_CLIP_FRAMES, Math.min(input.durationFrames, input.sequenceDurationFrames - input.startFrame));
36
+ }
37
+ function assertClipFitsSequence(input) {
38
+ assertSequenceDuration(input.sequenceDurationFrames);
39
+ assertClipDuration(input.durationFrames);
40
+ if (!Number.isInteger(input.startFrame) || input.startFrame < 0) {
41
+ throw new Error(`${input.label} startFrame must be a non-negative integer`);
42
+ }
43
+ if (input.startFrame + input.durationFrames > input.sequenceDurationFrames) {
44
+ throw new Error(`${input.label} extends beyond the sequence duration`);
45
+ }
46
+ }
47
+ function chooseCaptionPlacement(input) {
48
+ const preferredDurationFrames = Math.min(input.fps * 3, input.sequenceDurationFrames);
49
+ const minimumDurationFrames = Math.min(input.fps, preferredDurationFrames);
50
+ const occupied = input.occupiedIntervals.map((interval) => ({
51
+ startFrame: Math.max(0, interval.startFrame),
52
+ endFrame: Math.min(input.sequenceDurationFrames, interval.endFrame)
53
+ })).filter((interval) => interval.endFrame > interval.startFrame).sort((a, b) => a.startFrame - b.startFrame);
54
+ const merged = [];
55
+ for (const interval of occupied) {
56
+ const last = merged[merged.length - 1];
57
+ if (last && interval.startFrame <= last.endFrame) last.endFrame = Math.max(last.endFrame, interval.endFrame);
58
+ else merged.push({ ...interval });
59
+ }
60
+ const gaps = [];
61
+ let cursor = 0;
62
+ for (const interval of merged) {
63
+ if (interval.startFrame > cursor) gaps.push({ startFrame: cursor, endFrame: interval.startFrame });
64
+ cursor = interval.endFrame;
65
+ }
66
+ if (cursor < input.sequenceDurationFrames) gaps.push({ startFrame: cursor, endFrame: input.sequenceDurationFrames });
67
+ const usable = gaps.filter((gap2) => gap2.endFrame - gap2.startFrame >= minimumDurationFrames);
68
+ const latestUsable = usable[usable.length - 1];
69
+ if (latestUsable === void 0) {
70
+ throw new Error(
71
+ `no free gap of at least ${minimumDurationFrames} frames on the caption track \u2014 pass explicit startFrame/durationFrames or clear space first`
72
+ );
73
+ }
74
+ const gap = usable.find((candidate) => candidate.endFrame > input.playheadFrame) ?? latestUsable;
75
+ const durationFrames = Math.min(preferredDurationFrames, gap.endFrame - gap.startFrame);
76
+ const startFrame = Math.max(gap.startFrame, Math.min(input.playheadFrame, gap.endFrame - durationFrames));
77
+ return { startFrame, durationFrames };
78
+ }
79
+ function snapshotFrame(timeline, frame) {
80
+ if (!Number.isInteger(frame) || frame < 0) throw new Error("frame must be a non-negative integer");
81
+ if (frame >= timeline.sequence.durationFrames) {
82
+ throw new Error(`frame ${frame} is beyond the sequence (${timeline.sequence.durationFrames} frames)`);
83
+ }
84
+ const trackById = new Map(timeline.tracks.map((track) => [track.id, track]));
85
+ const sortedTracks = [...timeline.tracks].sort((a, b) => a.sortOrder - b.sortOrder);
86
+ const trackOrder = new Map(sortedTracks.map((track, index) => [track.id, index]));
87
+ const active = timeline.clips.filter((clip) => !clip.disabled && clip.startFrame <= frame && frame < clip.startFrame + clip.durationFrames).map((clip) => {
88
+ const track = trackById.get(clip.trackId);
89
+ if (!track) throw new Error(`clip ${clip.id} references unknown track ${clip.trackId}`);
90
+ return { track, clip };
91
+ }).sort((a, b) => (trackOrder.get(a.track.id) ?? 0) - (trackOrder.get(b.track.id) ?? 0));
92
+ const captions = active.filter(({ track, clip }) => track.kind === "caption" && typeof clip.text === "string" && clip.text.length > 0).map(({ clip }) => ({ text: clip.text, language: clip.language, clipId: clip.id }));
93
+ return {
94
+ frame,
95
+ seconds: framesToSeconds(frame, timeline.sequence.fps),
96
+ active,
97
+ captions
98
+ };
99
+ }
100
+ function trackIntervals(timeline, trackId) {
101
+ return timeline.clips.filter((clip) => clip.trackId === trackId && !clip.disabled).map((clip) => ({ startFrame: clip.startFrame, endFrame: clip.startFrame + clip.durationFrames })).sort((a, b) => a.startFrame - b.startFrame);
102
+ }
103
+ function assertFps(fps) {
104
+ if (!Number.isInteger(fps) || fps <= 0) throw new Error("fps must be a positive integer");
105
+ }
106
+ function assertSequenceDuration(sequenceDurationFrames) {
107
+ if (!Number.isInteger(sequenceDurationFrames) || sequenceDurationFrames < MIN_SEQUENCE_CLIP_FRAMES) {
108
+ throw new Error("sequenceDurationFrames must be a positive integer");
109
+ }
110
+ }
111
+ function assertClipDuration(durationFrames) {
112
+ if (!Number.isInteger(durationFrames) || durationFrames < MIN_SEQUENCE_CLIP_FRAMES) {
113
+ throw new Error("durationFrames must be a positive integer");
114
+ }
115
+ }
116
+
117
+ export {
118
+ MIN_SEQUENCE_CLIP_FRAMES,
119
+ secondsToFrames,
120
+ framesToSeconds,
121
+ formatSeconds,
122
+ formatTimecode,
123
+ clampClipStart,
124
+ clampClipDuration,
125
+ assertClipFitsSequence,
126
+ chooseCaptionPlacement,
127
+ snapshotFrame,
128
+ trackIntervals
129
+ };
130
+ //# sourceMappingURL=chunk-ZYBWGSAZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/sequences/model.ts"],"sourcesContent":["/**\n * Frame-accurate sequence timeline model — the product-agnostic spine of the\n * sequences surface. A sequence is a fixed-fps, fixed-duration timeline of\n * tracks; clips sit on tracks at integer frame positions with non-destructive\n * source in/out points. Products bind this model to their own storage through\n * `SequenceStore` (./store) and surface it to agents through the MCP toolset\n * (./mcp).\n *\n * All positions and durations are integer FRAMES at the sequence's fps.\n * Seconds appear only at the API edge (agent tools speak seconds; the\n * dispatcher converts exactly once). Nothing here touches a database, the DOM,\n * or React.\n */\n\nexport const MIN_SEQUENCE_CLIP_FRAMES = 1\n\n/** Track kinds. `reference` holds non-rendered guide media; `agent` holds the\n * agent-decision lane rendered as markers, never as media. */\nexport type SequenceTrackKind = 'video' | 'audio' | 'caption' | 'reference' | 'agent'\n\nexport type SequenceStatus = 'draft' | 'active' | 'exporting' | 'archived'\n\nexport type SequenceExportFormat = 'mp4' | 'otio' | 'xml' | 'edl' | 'vtt' | 'srt' | 'contact_sheet'\n\nexport type SequenceExportStatus = 'queued' | 'processing' | 'completed' | 'failed' | 'cancelled'\n\nexport type SequenceMediaKind = 'video' | 'image' | 'audio'\n\nexport interface SequenceMeta {\n id: string\n title: string\n fps: number\n width: number\n height: number\n aspectRatio: string\n durationFrames: number\n status: SequenceStatus\n metadata: Record<string, unknown>\n}\n\nexport interface SequenceTrack {\n id: string\n kind: SequenceTrackKind\n name: string\n sortOrder: number\n locked: boolean\n muted: boolean\n metadata: Record<string, unknown>\n}\n\n/** Resolved playable media behind a clip. The store resolves product-specific\n * references (generation rows, asset rows) into this shape; the core model\n * never sees the product's tables. */\nexport interface SequenceClipMedia {\n url: string\n kind: SequenceMediaKind\n /** Natural duration of the source media when known. */\n durationSeconds?: number\n /** Provider job state for media still rendering upstream. */\n providerStatus?: 'queued' | 'processing' | 'completed' | 'failed'\n}\n\nexport interface SequenceClip {\n id: string\n trackId: string\n label: string\n startFrame: number\n durationFrames: number\n /** Source-relative in point (frames into the source media). */\n sourceInFrame: number\n /** Source-relative out point; null = natural end of the source. */\n sourceOutFrame: number | null\n disabled: boolean\n /** Caption/text body for clips on caption tracks. */\n text?: string\n /** BCP-47 language tag for caption clips (e.g. 'en', 'es', 'ja'). */\n language?: string\n /** Opaque product reference to a generation row, when the clip came from one. */\n generationId?: string\n /** Opaque product reference to an asset row, when the clip came from one. */\n assetId?: string\n media?: SequenceClipMedia\n metadata: Record<string, unknown>\n}\n\n/** One entry in the sequence's decision log — human edits, agent proposals,\n * agent edits, exports, and notes all land here so the edit history is a\n * single auditable lane. */\nexport interface SequenceDecision {\n id: string\n clipId: string | null\n kind: 'human_edit' | 'agent_proposal' | 'agent_edit' | 'export' | 'note'\n instruction: string\n reasoningSummary: string | null\n accepted: boolean | null\n metadata: Record<string, unknown>\n createdAt: Date\n}\n\nexport interface SequenceExportRecord {\n id: string\n format: SequenceExportFormat\n status: SequenceExportStatus\n resultUrl: string | null\n metadata: Record<string, unknown>\n createdAt: Date\n}\n\n/** The full timeline aggregate — what `get_timeline_state` returns and what\n * every operation validates against. */\nexport interface SequenceTimeline {\n sequence: SequenceMeta\n tracks: SequenceTrack[]\n clips: SequenceClip[]\n}\n\n/** What is on screen/audible at a single frame — the answer shape for\n * \"what is happening at 0:34\". */\nexport interface SequenceFrameSnapshot {\n frame: number\n seconds: number\n /** Active (enabled, in-range) clips at this frame, with their track. */\n active: Array<{ track: SequenceTrack; clip: SequenceClip }>\n /** Caption text visible at this frame, in track sort order. */\n captions: Array<{ text: string; language?: string; clipId: string }>\n}\n\n// ---------------------------------------------------------------------------\n// Frame math\n// ---------------------------------------------------------------------------\n\nexport function secondsToFrames(seconds: number, fps: number): number {\n if (!Number.isFinite(seconds) || seconds < 0) throw new Error('seconds must be a non-negative finite number')\n assertFps(fps)\n return Math.round(seconds * fps)\n}\n\nexport function framesToSeconds(frames: number, fps: number): number {\n if (!Number.isInteger(frames) || frames < 0) throw new Error('frames must be a non-negative integer')\n assertFps(fps)\n return frames / fps\n}\n\nexport function formatSeconds(seconds: number): string {\n return Number.isInteger(seconds) ? `${seconds}s` : `${seconds.toFixed(2)}s`\n}\n\n/** `m:ss.ff` timecode for UI and agent-readable frame references. */\nexport function formatTimecode(frames: number, fps: number): string {\n assertFps(fps)\n if (!Number.isInteger(frames) || frames < 0) throw new Error('frames must be a non-negative integer')\n const totalSeconds = Math.floor(frames / fps)\n const minutes = Math.floor(totalSeconds / 60)\n const seconds = totalSeconds % 60\n const residualFrames = frames % fps\n return `${minutes}:${String(seconds).padStart(2, '0')}.${String(residualFrames).padStart(2, '0')}`\n}\n\nexport interface TimelineClipBounds {\n startFrame: number\n durationFrames: number\n}\n\nexport interface TimelineInterval {\n startFrame: number\n endFrame: number\n}\n\nexport function clampClipStart(input: {\n startFrame: number\n durationFrames: number\n sequenceDurationFrames: number\n}): number {\n assertSequenceDuration(input.sequenceDurationFrames)\n assertClipDuration(input.durationFrames)\n return Math.max(0, Math.min(input.sequenceDurationFrames - input.durationFrames, input.startFrame))\n}\n\nexport function clampClipDuration(input: {\n startFrame: number\n durationFrames: number\n sequenceDurationFrames: number\n}): number {\n assertSequenceDuration(input.sequenceDurationFrames)\n if (input.startFrame < 0 || input.startFrame >= input.sequenceDurationFrames) {\n throw new Error('startFrame must be inside the sequence')\n }\n return Math.max(MIN_SEQUENCE_CLIP_FRAMES, Math.min(input.durationFrames, input.sequenceDurationFrames - input.startFrame))\n}\n\nexport function assertClipFitsSequence(input: {\n startFrame: number\n durationFrames: number\n sequenceDurationFrames: number\n label: string\n}): void {\n assertSequenceDuration(input.sequenceDurationFrames)\n assertClipDuration(input.durationFrames)\n if (!Number.isInteger(input.startFrame) || input.startFrame < 0) {\n throw new Error(`${input.label} startFrame must be a non-negative integer`)\n }\n if (input.startFrame + input.durationFrames > input.sequenceDurationFrames) {\n throw new Error(`${input.label} extends beyond the sequence duration`)\n }\n}\n\n/** Place a caption near the playhead inside FREE space only — the caption\n * track never double-books. Prefers fps*3 frames, floors at fps. The gap\n * holding (or first after) the playhead wins; with everything ahead occupied\n * the latest earlier gap is used instead. Throws when no gap can hold the\n * minimum — the caller must supply explicit bounds or clear space. */\nexport function chooseCaptionPlacement(input: {\n playheadFrame: number\n fps: number\n sequenceDurationFrames: number\n occupiedIntervals: TimelineInterval[]\n}): TimelineClipBounds {\n const preferredDurationFrames = Math.min(input.fps * 3, input.sequenceDurationFrames)\n const minimumDurationFrames = Math.min(input.fps, preferredDurationFrames)\n const occupied = input.occupiedIntervals\n .map((interval) => ({\n startFrame: Math.max(0, interval.startFrame),\n endFrame: Math.min(input.sequenceDurationFrames, interval.endFrame),\n }))\n .filter((interval) => interval.endFrame > interval.startFrame)\n .sort((a, b) => a.startFrame - b.startFrame)\n\n // Merge overlaps so the gap walk sees each free run exactly once.\n const merged: TimelineInterval[] = []\n for (const interval of occupied) {\n const last = merged[merged.length - 1]\n if (last && interval.startFrame <= last.endFrame) last.endFrame = Math.max(last.endFrame, interval.endFrame)\n else merged.push({ ...interval })\n }\n\n const gaps: TimelineInterval[] = []\n let cursor = 0\n for (const interval of merged) {\n if (interval.startFrame > cursor) gaps.push({ startFrame: cursor, endFrame: interval.startFrame })\n cursor = interval.endFrame\n }\n if (cursor < input.sequenceDurationFrames) gaps.push({ startFrame: cursor, endFrame: input.sequenceDurationFrames })\n\n const usable = gaps.filter((gap) => gap.endFrame - gap.startFrame >= minimumDurationFrames)\n const latestUsable = usable[usable.length - 1]\n if (latestUsable === undefined) {\n throw new Error(\n `no free gap of at least ${minimumDurationFrames} frames on the caption track — pass explicit startFrame/durationFrames or clear space first`,\n )\n }\n const gap = usable.find((candidate) => candidate.endFrame > input.playheadFrame) ?? latestUsable\n const durationFrames = Math.min(preferredDurationFrames, gap.endFrame - gap.startFrame)\n const startFrame = Math.max(gap.startFrame, Math.min(input.playheadFrame, gap.endFrame - durationFrames))\n return { startFrame, durationFrames }\n}\n\n/** Resolve everything active at one frame — the core of `get_frame_at_time`. */\nexport function snapshotFrame(timeline: SequenceTimeline, frame: number): SequenceFrameSnapshot {\n if (!Number.isInteger(frame) || frame < 0) throw new Error('frame must be a non-negative integer')\n if (frame >= timeline.sequence.durationFrames) {\n throw new Error(`frame ${frame} is beyond the sequence (${timeline.sequence.durationFrames} frames)`)\n }\n const trackById = new Map(timeline.tracks.map((track) => [track.id, track]))\n const sortedTracks = [...timeline.tracks].sort((a, b) => a.sortOrder - b.sortOrder)\n const trackOrder = new Map(sortedTracks.map((track, index) => [track.id, index]))\n\n const active = timeline.clips\n .filter((clip) => !clip.disabled && clip.startFrame <= frame && frame < clip.startFrame + clip.durationFrames)\n .map((clip) => {\n const track = trackById.get(clip.trackId)\n if (!track) throw new Error(`clip ${clip.id} references unknown track ${clip.trackId}`)\n return { track, clip }\n })\n .sort((a, b) => (trackOrder.get(a.track.id) ?? 0) - (trackOrder.get(b.track.id) ?? 0))\n\n const captions = active\n .filter(({ track, clip }) => track.kind === 'caption' && typeof clip.text === 'string' && clip.text.length > 0)\n .map(({ clip }) => ({ text: clip.text as string, language: clip.language, clipId: clip.id }))\n\n return {\n frame,\n seconds: framesToSeconds(frame, timeline.sequence.fps),\n active,\n captions,\n }\n}\n\n/** Occupied intervals on one track, for placement collision checks. */\nexport function trackIntervals(timeline: SequenceTimeline, trackId: string): TimelineInterval[] {\n return timeline.clips\n .filter((clip) => clip.trackId === trackId && !clip.disabled)\n .map((clip) => ({ startFrame: clip.startFrame, endFrame: clip.startFrame + clip.durationFrames }))\n .sort((a, b) => a.startFrame - b.startFrame)\n}\n\nfunction assertFps(fps: number): void {\n if (!Number.isInteger(fps) || fps <= 0) throw new Error('fps must be a positive integer')\n}\n\nfunction assertSequenceDuration(sequenceDurationFrames: number): void {\n if (!Number.isInteger(sequenceDurationFrames) || sequenceDurationFrames < MIN_SEQUENCE_CLIP_FRAMES) {\n throw new Error('sequenceDurationFrames must be a positive integer')\n }\n}\n\nfunction assertClipDuration(durationFrames: number): void {\n if (!Number.isInteger(durationFrames) || durationFrames < MIN_SEQUENCE_CLIP_FRAMES) {\n throw new Error('durationFrames must be a positive integer')\n }\n}\n"],"mappings":";AAcO,IAAM,2BAA2B;AAqHjC,SAAS,gBAAgB,SAAiB,KAAqB;AACpE,MAAI,CAAC,OAAO,SAAS,OAAO,KAAK,UAAU,EAAG,OAAM,IAAI,MAAM,8CAA8C;AAC5G,YAAU,GAAG;AACb,SAAO,KAAK,MAAM,UAAU,GAAG;AACjC;AAEO,SAAS,gBAAgB,QAAgB,KAAqB;AACnE,MAAI,CAAC,OAAO,UAAU,MAAM,KAAK,SAAS,EAAG,OAAM,IAAI,MAAM,uCAAuC;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AAE;AAEvF,QAAM,WAAW,OACd,OAAO,CAAC,EAAE,OAAO,KAAK,MAAM,MAAM,SAAS,aAAa,OAAO,KAAK,SAAS,YAAY,KAAK,KAAK,SAAS,CAAC,EAC7G,IAAI,CAAC,EAAE,KAAK,OAAO,EAAE,MAAM,KAAK,MAAgB,UAAU,KAAK,UAAU,QAAQ,KAAK,GAAG,EAAE;AAE9F,SAAO;AAAA,IACL;AAAA,IACA,SAAS,gBAAgB,OAAO,SAAS,SAAS,GAAG;AAAA,IACrD;AAAA,IACA;AAAA,EACF;AACF;AAGO,SAAS,eAAe,UAA4B,SAAqC;AAC9F,SAAO,SAAS,MACb,OAAO,CAAC,SAAS,KAAK,YAAY,WAAW,CAAC,KAAK,QAAQ,EAC3D,IAAI,CAAC,UAAU,EAAE,YAAY,KAAK,YAAY,UAAU,KAAK,aAAa,KAAK,eAAe,EAAE,EAChG,KAAK,CAAC,GAAG,MAAM,EAAE,aAAa,EAAE,UAAU;AAC/C;AAEA,SAAS,UAAU,KAAmB;AACpC,MAAI,CAAC,OAAO,UAAU,GAAG,KAAK,OAAO,EAAG,OAAM,IAAI,MAAM,gCAAgC;AAC1F;AAEA,SAAS,uBAAuB,wBAAsC;AACpE,MAAI,CAAC,OAAO,UAAU,sBAAsB,KAAK,yBAAyB,0BAA0B;AAClG,UAAM,IAAI,MAAM,mDAAmD;AAAA,EACrE;AACF;AAEA,SAAS,mBAAmB,gBAA8B;AACxD,MAAI,CAAC,OAAO,UAAU,cAAc,KAAK,iBAAiB,0BAA0B;AAClF,UAAM,IAAI,MAAM,2CAA2C;AAAA,EAC7D;AACF;","names":["gap"]}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
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';
1
+ export { AppToolRuntimeExecutor, CapabilityTokenOptions, DispatchOptions, ExpiringCapabilityTokenOptions, HandleToolRequestOptions, RuntimeExecutorOptions, ToolInputError, createAppToolRuntimeExecutor, createCapabilityToken, createExpiringCapabilityToken, dispatchAppTool, handleAppToolRequest, outcomeStatus, verifyCapabilityToken, verifyExpiringCapabilityToken } from './tools/index.js';
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';
2
3
  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';
3
4
  export { BuildDelegationOptions, DELEGATION_MCP_SERVER_KEY, DELEGATION_TOOLS, DelegationMcpServer, buildDelegationMcpServer, delegationMcpForConfig } from './delegation/index.js';
4
5
  export { BrokerToken, BrokerTokenMinter, BrokerTokenProvider, BrokerTokenProviderOptions, ConsentUrlInput, buildConsentUrl, createBrokerTokenProvider } from './tangle/index.js';
5
- export { AgentRuntime, AgentRuntimeModelConfig, AgentTurnOptions, AppToolLoopOptions, CreateAgentRuntimeOptions, LoopAssistantToolCall, LoopEvent, LoopMessage, LoopToolCall, OpenAICompatStreamTurnOptions, OpenAIStreamChunk, StreamAppToolLoopOptions, StreamLoopYield, ToolLoopResult, ToolLoopStopReason, createAgentRuntime, createOpenAICompatStreamTurn, runAppToolLoop, streamAppToolLoop, toLoopEvents } from './runtime/index.js';
6
+ export { AgentRuntime, AgentRuntimeModelConfig, AgentTurnOptions, AnySurfaceKind, AppToolLoopOptions, CreateAgentRuntimeOptions, LoopAssistantToolCall, LoopEvent, LoopMessage, LoopToolCall, OpenAICompatStreamTurnOptions, OpenAIStreamChunk, StreamAppToolLoopOptions, StreamLoopYield, SurfaceKindDefinition, SurfaceMcpServer, SurfaceMergeBase, SurfaceOverlay, SurfacePermissionValue, SurfaceRegistry, ToolLoopResult, ToolLoopStopReason, createAgentRuntime, createOpenAICompatStreamTurn, createSurfaceRegistry, defineSurfaceKind, mergeSurfaceOverlay, runAppToolLoop, streamAppToolLoop, toLoopEvents } from './runtime/index.js';
6
7
  export { createTokenRecallChecker, producedFromToolEvents } from './eval/index.js';
7
8
  export { KnowledgeRequirementSpec, KnowledgeSignal, KnowledgeStateAccessor, SatisfiedByRule, buildKnowledgeRequirements, deriveSignals } from './knowledge/index.js';
8
9
  export { CreateKnowledgeLoopDeps, KnowledgeCandidate, KnowledgeDecider, KnowledgeDeciderInput, KnowledgeDecision, KnowledgeGateVerdict, KnowledgeLoop, KnowledgeLoopDriver, createKnowledgeLoop, createReviewerDecider, reviewCandidate } from './knowledge-loop/index.js';
@@ -19,6 +20,9 @@ export { CookieOptions, JsonObject, KvLike, RateLimitResult, RequestContext, Sec
19
20
  export { BuildRedactedDocumentOptions, DEFAULT_REDACTION_PATTERNS, RedactForIngestionOptions, RedactedDocSegment, RedactedDocument, RedactionPattern, RedactionSpan, RevealResult, RevealSpanOptions, buildRedactedDocument, detectSpans, maskSpans, redactForIngestion, revealSpan } from './redact/index.js';
20
21
  export { ApprovalEvent, ApprovalEventSchema, AssetContentMap, AssetFormat, AssetSpec, AssetStatus, AssetVariant, BrandTokens, BrandTokensSchema, ConversionMetrics, ConversionMetricsSchema, CopyContent, CopyContentSchema, CopyPlatform, EmailBodySection, EmailContent, EmailContentSchema, EmailCtaSection, EmailDividerSection, EmailFeatureSection, EmailHeroSection, EmailSection, EmailTestimonialSection, ImageBackground, ImageContent, ImageContentSchema, ImageImageLayer, ImageLayer, ImageLayerType, ImageLogoLayer, ImageShapeLayer, ImageSlide, ImageTextLayer, VideoCaption, VideoContent, VideoContentSchema, VideoCountdownScene, VideoImageRevealScene, VideoScene, VideoSlideScene, VideoTextAnimationScene, parseAssetSpec, safeParseAssetSpec } from './assets/index.js';
21
22
  export { DistributionSummary, FlowSpan, FlowTrace, LoopTraceEventLike, MissionFlowStep, MissionTraceContext, StepSpanContext, TimedEvent, buildFlowTrace, childSpanContext, composeMissionFlowTrace, createMissionTraceContext, delegationActivityToFlowSpans, loopTraceEventsToFlowSpans, renderHistogram, renderWaterfall, stepActivityFlowTrace, summarize, timedEventsFromLines, traceEnv } from './trace/index.js';
23
+ 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
+ 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
+ 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';
22
26
  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';
23
27
  export { CompletionRequirement, CompletionVerdict, CorrectnessChecker, ProducedState, RuntimeEventLike, SatisfiedBy, TaskGold, createLlmCorrectnessChecker, extractProducedState, verifyCompletion, weightedComposite } from '@tangle-network/agent-eval';
24
28
  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
@@ -1,3 +1,60 @@
1
+ import {
2
+ DEFAULT_SEQUENCES_MCP_DESCRIPTION,
3
+ MAX_CAPTION_BATCH,
4
+ SEQUENCES_MCP_PROTOCOL_VERSIONS,
5
+ SEQUENCE_EXPORT_FORMATS,
6
+ SEQUENCE_MCP_TOOLS,
7
+ SEQUENCE_MEDIA_KINDS,
8
+ SEQUENCE_OPERATION_TYPES,
9
+ SEQUENCE_TRACK_KINDS,
10
+ applySequenceOperation,
11
+ applySequenceOperations,
12
+ assertSequenceMediaUrl,
13
+ buildCaptionChunks,
14
+ buildContactSheetManifest,
15
+ buildEdl,
16
+ buildOtio,
17
+ buildSequencesMcpServerEntry,
18
+ buildSrt,
19
+ buildVtt,
20
+ captionCoverage,
21
+ captionTrackNameForLanguage,
22
+ createSequencesMcpHandler,
23
+ findSequenceMcpTool,
24
+ lastClipEndFrame,
25
+ normalizeLanguageTag,
26
+ parseSequenceOperations,
27
+ planLanguageFanout,
28
+ resolveCaptionPlacement,
29
+ resolveCaptionTarget,
30
+ resolvePlaceClipTrack,
31
+ validateAddCaption,
32
+ validateCreateTrack,
33
+ validateDeleteClip,
34
+ validateExtendSequence,
35
+ validateMoveClip,
36
+ validatePlaceClip,
37
+ validateQueueExport,
38
+ validateSequenceOperation,
39
+ validateSequenceOperations,
40
+ validateSetClipDisabled,
41
+ validateSetClipText,
42
+ validateSplitClip,
43
+ validateTrimClip
44
+ } from "./chunk-3WAJWYKD.js";
45
+ import {
46
+ MIN_SEQUENCE_CLIP_FRAMES,
47
+ assertClipFitsSequence,
48
+ chooseCaptionPlacement,
49
+ clampClipDuration,
50
+ clampClipStart,
51
+ formatSeconds,
52
+ formatTimecode,
53
+ framesToSeconds,
54
+ secondsToFrames,
55
+ snapshotFrame,
56
+ trackIntervals
57
+ } from "./chunk-ZYBWGSAZ.js";
1
58
  import {
2
59
  DEFAULT_MISSION_STEP_KINDS,
3
60
  MISSION_CONTROL_CHANNEL_ID,
@@ -91,12 +148,12 @@ import {
91
148
  createPresetToolHandlers,
92
149
  createPresetWorkspaceKeyManager,
93
150
  createPresetWorkspaceKeyStore
94
- } from "./chunk-EYXTDVDY.js";
151
+ } from "./chunk-SAOAAA3S.js";
95
152
  import {
96
153
  createPlatformBalanceManager,
97
154
  createTcloudKeyProvisioner,
98
155
  createWorkspaceKeyManager
99
- } from "./chunk-YS6A6G57.js";
156
+ } from "./chunk-G3HCU7TA.js";
100
157
  import {
101
158
  createFieldCrypto,
102
159
  decodeHexKey,
@@ -136,17 +193,21 @@ import {
136
193
  invokeIntegrationHub,
137
194
  resolveIntegrationAction
138
195
  } from "./chunk-L2TG5DBW.js";
196
+ import {
197
+ createCapabilityToken,
198
+ createExpiringCapabilityToken,
199
+ handleAppToolRequest,
200
+ verifyCapabilityToken,
201
+ verifyExpiringCapabilityToken
202
+ } from "./chunk-CF5DZELC.js";
139
203
  import {
140
204
  DEFAULT_APP_TOOL_PATHS,
141
205
  DEFAULT_HEADER_NAMES,
142
206
  authenticateToolRequest,
143
207
  buildAppToolMcpServer,
144
208
  buildHttpMcpServer,
145
- createCapabilityToken,
146
- handleAppToolRequest,
147
- readToolArgs,
148
- verifyCapabilityToken
149
- } from "./chunk-OLCVUGGI.js";
209
+ readToolArgs
210
+ } from "./chunk-IJZJWKUK.js";
150
211
  import {
151
212
  DELEGATION_MCP_SERVER_KEY,
152
213
  DELEGATION_TOOLS,
@@ -162,12 +223,15 @@ import {
162
223
  buildCatalog,
163
224
  createAgentRuntime,
164
225
  createOpenAICompatStreamTurn,
226
+ createSurfaceRegistry,
227
+ defineSurfaceKind,
165
228
  fetchModelCatalog,
229
+ mergeSurfaceOverlay,
166
230
  normalizeModelId,
167
231
  runAppToolLoop,
168
232
  streamAppToolLoop,
169
233
  toLoopEvents
170
- } from "./chunk-4YTWB5MG.js";
234
+ } from "./chunk-ETX4O4BB.js";
171
235
  import {
172
236
  DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR,
173
237
  DEFAULT_TANGLE_ROUTER_BASE_URL,
@@ -213,6 +277,7 @@ export {
213
277
  DEFAULT_HEADER_NAMES,
214
278
  DEFAULT_MISSION_STEP_KINDS,
215
279
  DEFAULT_REDACTION_PATTERNS,
280
+ DEFAULT_SEQUENCES_MCP_DESCRIPTION,
216
281
  DEFAULT_TANGLE_BILLING_ENFORCEMENT_ENV_VAR,
217
282
  DEFAULT_TANGLE_ROUTER_BASE_URL,
218
283
  DELEGATION_MCP_SERVER_KEY,
@@ -221,11 +286,19 @@ export {
221
286
  HubExecClient,
222
287
  ImageContentSchema,
223
288
  KNOWN_HARNESSES,
289
+ MAX_CAPTION_BATCH,
290
+ MIN_SEQUENCE_CLIP_FRAMES,
224
291
  MISSION_CONTROL_CHANNEL_ID,
225
292
  MissionConcurrencyError,
226
293
  PRESET_MIGRATION_SQL,
227
294
  PRESET_TABLES,
228
295
  RetryableStepError,
296
+ SEQUENCES_MCP_PROTOCOL_VERSIONS,
297
+ SEQUENCE_EXPORT_FORMATS,
298
+ SEQUENCE_MCP_TOOLS,
299
+ SEQUENCE_MEDIA_KINDS,
300
+ SEQUENCE_OPERATION_TYPES,
301
+ SEQUENCE_TRACK_KINDS,
229
302
  TURN_EVENTS_MIGRATION_SQL,
230
303
  TangleExecutionKeyError,
231
304
  ToolInputError,
@@ -234,24 +307,40 @@ export {
234
307
  addSecurityHeaders,
235
308
  agentAppConfigJsonSchema,
236
309
  applyMissionEvent,
310
+ applySequenceOperation,
311
+ applySequenceOperations,
237
312
  asMissionStreamEvent,
238
313
  asRecord,
239
314
  asString,
315
+ assertClipFitsSequence,
316
+ assertSequenceMediaUrl,
240
317
  authenticateToolRequest,
241
318
  budgetGateProposalId,
242
319
  buildAgentMissionPlan,
243
320
  buildAppToolMcpServer,
244
321
  buildAppToolOpenAITools,
322
+ buildCaptionChunks,
245
323
  buildCatalog,
246
324
  buildConsentUrl,
325
+ buildContactSheetManifest,
247
326
  buildDelegationMcpServer,
327
+ buildEdl,
248
328
  buildFlowTrace,
249
329
  buildHttpMcpServer,
250
330
  buildKnowledgeRequirements,
331
+ buildOtio,
251
332
  buildRedactedDocument,
333
+ buildSequencesMcpServerEntry,
334
+ buildSrt,
252
335
  buildUserTextParts,
336
+ buildVtt,
337
+ captionCoverage,
338
+ captionTrackNameForLanguage,
253
339
  checkRateLimit,
254
340
  childSpanContext,
341
+ chooseCaptionPlacement,
342
+ clampClipDuration,
343
+ clampClipStart,
255
344
  clearCookieHeader,
256
345
  coalesceDeltas,
257
346
  coerceHarness,
@@ -262,6 +351,7 @@ export {
262
351
  createCapabilityToken,
263
352
  createD1KnowledgeStateAccessor,
264
353
  createD1TurnEventStore,
354
+ createExpiringCapabilityToken,
265
355
  createFieldCrypto,
266
356
  createInMemoryMissionStore,
267
357
  createKnowledgeLoop,
@@ -278,6 +368,8 @@ export {
278
368
  createPresetWorkspaceKeyManager,
279
369
  createPresetWorkspaceKeyStore,
280
370
  createReviewerDecider,
371
+ createSequencesMcpHandler,
372
+ createSurfaceRegistry,
281
373
  createTangleRouterModelConfig,
282
374
  createTcloudKeyProvisioner,
283
375
  createTokenRecallChecker,
@@ -287,6 +379,7 @@ export {
287
379
  decryptBytes,
288
380
  decryptWithKey,
289
381
  defineAgentApp,
382
+ defineSurfaceKind,
290
383
  delegationActivityToFlowSpans,
291
384
  delegationMcpForConfig,
292
385
  deriveKey,
@@ -301,6 +394,10 @@ export {
301
394
  extractRequestContext,
302
395
  fetchModelCatalog,
303
396
  finalizeAssistantParts,
397
+ findSequenceMcpTool,
398
+ formatSeconds,
399
+ formatTimecode,
400
+ framesToSeconds,
304
401
  getPartKey,
305
402
  handleAppToolRequest,
306
403
  invokeIntegrationHub,
@@ -310,13 +407,16 @@ export {
310
407
  isMissionTerminal,
311
408
  isTangleBillingEnforcementDisabled,
312
409
  isTangleExecutionKeyError,
410
+ lastClipEndFrame,
313
411
  loopTraceEventsToFlowSpans,
314
412
  maskSpans,
315
413
  mergeMissionState,
316
414
  mergePersistedPart,
415
+ mergeSurfaceOverlay,
317
416
  messageHasTurnId,
318
417
  noopEventSink,
319
418
  normalizeClientTurnId,
419
+ normalizeLanguageTag,
320
420
  normalizeModelId,
321
421
  normalizePersistedPart,
322
422
  normalizeTime,
@@ -325,7 +425,9 @@ export {
325
425
  parseAssetSpec,
326
426
  parseJsonObjectBody,
327
427
  parseMissionBlocks,
428
+ parseSequenceOperations,
328
429
  parseSessionStreamEnvelope,
430
+ planLanguageFanout,
329
431
  producedFromToolEvents,
330
432
  pumpBufferedTurn,
331
433
  readCookieValue,
@@ -336,8 +438,11 @@ export {
336
438
  renderWaterfall,
337
439
  replayTurnEvents,
338
440
  requireString,
441
+ resolveCaptionPlacement,
442
+ resolveCaptionTarget,
339
443
  resolveChatTurn,
340
444
  resolveIntegrationAction,
445
+ resolvePlaceClipTrack,
341
446
  resolveSessionHarness,
342
447
  resolveTangleExecutionEnvironment,
343
448
  resolveTangleModelConfig,
@@ -349,7 +454,9 @@ export {
349
454
  reviewCandidate,
350
455
  runAppToolLoop,
351
456
  safeParseAssetSpec,
457
+ secondsToFrames,
352
458
  serializeCookie,
459
+ snapshotFrame,
353
460
  stepActivityFlowTrace,
354
461
  stepAgentActivity,
355
462
  stepGateProposalId,
@@ -359,8 +466,23 @@ export {
359
466
  timedEventsFromLines,
360
467
  toLoopEvents,
361
468
  traceEnv,
469
+ trackIntervals,
470
+ validateAddCaption,
471
+ validateCreateTrack,
472
+ validateDeleteClip,
473
+ validateExtendSequence,
474
+ validateMoveClip,
475
+ validatePlaceClip,
476
+ validateQueueExport,
477
+ validateSequenceOperation,
478
+ validateSequenceOperations,
479
+ validateSetClipDisabled,
480
+ validateSetClipText,
481
+ validateSplitClip,
482
+ validateTrimClip,
362
483
  verifyCapabilityToken,
363
484
  verifyCompletion,
485
+ verifyExpiringCapabilityToken,
364
486
  volumeGateProposalId,
365
487
  weightedComposite
366
488
  };
@@ -0,0 +1,112 @@
1
+ import { f as AppToolTaxonomy, b as AppToolContext } from './types-By4B3K37.js';
2
+
3
+ /** The four canonical app-tool names. Stable identifiers the model calls in
4
+ * both the sandbox (MCP server name) and runtime (function-tool name) paths. */
5
+ declare const APP_TOOL_NAMES: readonly ["submit_proposal", "schedule_followup", "render_ui", "add_citation"];
6
+ type AppToolName = (typeof APP_TOOL_NAMES)[number];
7
+ declare function isAppToolName(name: string): name is AppToolName;
8
+ /** A minimal OpenAI Chat Completions function-tool shape — structurally
9
+ * compatible with `@tangle-network/agent-runtime`'s `OpenAIChatTool` without
10
+ * importing it (keeps this package runtime-free). */
11
+ interface OpenAIFunctionTool {
12
+ type: 'function';
13
+ function: {
14
+ name: string;
15
+ description: string;
16
+ parameters: Record<string, unknown>;
17
+ };
18
+ }
19
+ /**
20
+ * Build the four app tools in OpenAI function-tool shape. `submit_proposal`'s
21
+ * `type` enum is the product's {@link AppToolTaxonomy.proposalTypes}; the other
22
+ * three are fixed. Pass the result to the agent-runtime backend's `tools`.
23
+ */
24
+ declare function buildAppToolOpenAITools(taxonomy: AppToolTaxonomy): OpenAIFunctionTool[];
25
+
26
+ /**
27
+ * Header names carrying the server-set per-turn context + the capability token.
28
+ * Defaults are product-neutral (`X-Agent-App-*`); a product that already ships
29
+ * a header convention (e.g. `X-Acme-User-Id`) passes its own.
30
+ */
31
+ interface ToolHeaderNames {
32
+ userId: string;
33
+ workspaceId: string;
34
+ threadId: string;
35
+ }
36
+ declare const DEFAULT_HEADER_NAMES: ToolHeaderNames;
37
+ interface AuthenticateOptions {
38
+ /** Verify the bearer capability token belongs to `userId`. The product's
39
+ * HMAC/JWT impl — the seam that keeps token crypto out of this package. */
40
+ verifyToken: (userId: string, bearer: string) => Promise<boolean>;
41
+ headerNames?: ToolHeaderNames;
42
+ }
43
+ type ToolAuthResult = {
44
+ ok: true;
45
+ ctx: AppToolContext;
46
+ } | {
47
+ ok: false;
48
+ response: Response;
49
+ };
50
+ /**
51
+ * Recover + verify the trusted context for a tool request. The user comes from
52
+ * a server-set header and the bearer token MUST verify against THAT user; the
53
+ * workspace comes from a header too — never from tool args — so the model can
54
+ * neither forge identity nor target another workspace. Fail-closed: any missing
55
+ * credential or a token minted for another user yields a 401/400 Response.
56
+ */
57
+ declare function authenticateToolRequest(request: Request, opts: AuthenticateOptions): Promise<ToolAuthResult>;
58
+ /** Read a tool's argument object from the request body, tolerant of MCP host
59
+ * aliases (`args` / `arguments`) or a bare body. Returns null on non-JSON. */
60
+ declare function readToolArgs<T>(request: Request): Promise<T | null>;
61
+
62
+ /** Default route path each app tool is served at. A product mounts its routes
63
+ * at these paths (or supplies its own via {@link BuildMcpServerOptions.paths}). */
64
+ declare const DEFAULT_APP_TOOL_PATHS: Record<AppToolName, string>;
65
+ /** The portable MCP server entry the sandbox SDK accepts (transport + url +
66
+ * headers). Matches `AgentProfileMcpServer` structurally without importing the
67
+ * sandbox SDK — products spread it into their profile's `mcp` map. */
68
+ interface AppToolMcpServer {
69
+ transport: 'http';
70
+ url: string;
71
+ headers: Record<string, string>;
72
+ enabled: true;
73
+ metadata: {
74
+ description: string;
75
+ };
76
+ }
77
+ interface BuildHttpMcpServerOptions {
78
+ /** Route path on the app the sandbox POSTs to (e.g. `/api/tools/propose`). */
79
+ path: string;
80
+ /** App base URL the sandbox reaches back to (no trailing slash required). */
81
+ baseUrl: string;
82
+ /** Per-user capability token, baked into the Authorization header. */
83
+ token: string;
84
+ ctx: AppToolContext;
85
+ /** Tool description the model sees. */
86
+ description: string;
87
+ headerNames?: ToolHeaderNames;
88
+ }
89
+ /**
90
+ * Build ONE HTTP MCP server entry — the generic agent→app bridge. The
91
+ * capability token + the user/workspace/thread ids ride in server-set headers
92
+ * (never tool args), so the model can't forge identity or target another
93
+ * workspace. Workspace/thread headers are omitted when their `ctx` value is
94
+ * empty/null (e.g. an integration-invoke bridge that's user-scoped only). Used
95
+ * directly for non-app-tool bridges (integration_invoke) and via
96
+ * {@link buildAppToolMcpServer} for the four app tools.
97
+ */
98
+ declare function buildHttpMcpServer(opts: BuildHttpMcpServerOptions): AppToolMcpServer;
99
+ interface BuildMcpServerOptions {
100
+ tool: AppToolName;
101
+ baseUrl: string;
102
+ token: string;
103
+ ctx: AppToolContext;
104
+ description: string;
105
+ headerNames?: ToolHeaderNames;
106
+ paths?: Partial<Record<AppToolName, string>>;
107
+ }
108
+ /** Build one of the four app-tool MCP servers — a thin wrapper over
109
+ * {@link buildHttpMcpServer} that maps the tool name to its route path. */
110
+ declare function buildAppToolMcpServer(opts: BuildMcpServerOptions): AppToolMcpServer;
111
+
112
+ export { APP_TOOL_NAMES as A, type BuildHttpMcpServerOptions as B, DEFAULT_APP_TOOL_PATHS as D, type OpenAIFunctionTool as O, type ToolAuthResult as T, type AppToolMcpServer as a, type AppToolName as b, type AuthenticateOptions as c, type BuildMcpServerOptions as d, DEFAULT_HEADER_NAMES as e, type ToolHeaderNames as f, authenticateToolRequest as g, buildAppToolMcpServer as h, buildAppToolOpenAITools as i, buildHttpMcpServer as j, isAppToolName as k, readToolArgs as r };
@@ -7,8 +7,8 @@ import {
7
7
  createPresetToolHandlers,
8
8
  createPresetWorkspaceKeyManager,
9
9
  createPresetWorkspaceKeyStore
10
- } from "../chunk-EYXTDVDY.js";
11
- import "../chunk-YS6A6G57.js";
10
+ } from "../chunk-SAOAAA3S.js";
11
+ import "../chunk-G3HCU7TA.js";
12
12
  import "../chunk-TA5Q4I2K.js";
13
13
  export {
14
14
  PRESET_MIGRATION_SQL,