@cueframe/kernel 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/_members/authoring/agent/errors.d.ts +8 -0
  2. package/dist/_members/authoring/index.d.ts +1 -1
  3. package/dist/_members/authoring/motion/materializeMotionPresetOps.d.ts +4 -0
  4. package/dist/_members/authoring/prompts/index.d.ts +0 -1
  5. package/dist/_members/authoring/types.d.ts +1 -1
  6. package/dist/_members/cloud-import/CloudImportService.d.ts +3 -4
  7. package/dist/_members/cloud-import/ImportProvider.d.ts +3 -7
  8. package/dist/_members/cloud-import/cloudConfig.d.ts +0 -6
  9. package/dist/_members/cloud-import/index.d.ts +2 -4
  10. package/dist/_members/composition/graphics-plan/schemas.d.ts +20 -20
  11. package/dist/_members/composition/primitive-catalog/projection.d.ts +2 -1
  12. package/dist/_members/composition/projection/behind-readiness.d.ts +4 -2
  13. package/dist/_members/composition/validators/brandKit.d.ts +54 -94
  14. package/dist/_members/composition/validators/composePlan.d.ts +52 -52
  15. package/dist/_members/composition/validators/composition.d.ts +213 -253
  16. package/dist/_members/composition/validators/font.d.ts +2 -2
  17. package/dist/_members/composition/validators/index.d.ts +1 -0
  18. package/dist/_members/composition/validators/opaqueId.d.ts +13 -0
  19. package/dist/_members/composition/validators/project.d.ts +11 -15
  20. package/dist/_members/composition/validators/render.d.ts +372 -534
  21. package/dist/_members/composition/validators/session.d.ts +19 -39
  22. package/dist/_members/composition/validators/webhook.d.ts +8 -16
  23. package/dist/_members/composition-ops/index.d.ts +192 -228
  24. package/dist/_members/director/ai-sdk/messages.d.ts +2 -2
  25. package/dist/_members/director/domain/chat.d.ts +4 -4
  26. package/dist/_members/director/testing/contract.d.ts +1 -1
  27. package/dist/_members/errors/registry.d.ts +115 -1
  28. package/dist/_members/mcp/adapter.d.ts +19 -0
  29. package/dist/_members/mcp/core.d.ts +1 -1
  30. package/dist/_members/mcp/curation.d.ts +4 -0
  31. package/dist/_members/mcp/generated/harness.d.ts +1 -1
  32. package/dist/_members/mcp/generated/operations.d.ts +12 -0
  33. package/dist/_members/mcp/wait.d.ts +1 -1
  34. package/dist/_members/media-model/api.d.ts +53 -109
  35. package/dist/_members/media-model/generation.d.ts +2 -2
  36. package/dist/_members/media-model/index.d.ts +1 -0
  37. package/dist/_members/media-model/opaqueId.d.ts +10 -0
  38. package/dist/_members/render-harness/localRender.d.ts +3 -0
  39. package/dist/_members/render-harness/localRender.d.ts.map +1 -1
  40. package/dist/_members/render-harness/remotion-runtime.d.ts +53 -0
  41. package/dist/authoring/build-tools.js +6 -6
  42. package/dist/authoring/context.js +4 -4
  43. package/dist/authoring/prompts.js +1 -5
  44. package/dist/authoring/tools.js +5 -5
  45. package/dist/authoring.js +40 -27
  46. package/dist/chunk-2SNY75AR.js +498 -0
  47. package/dist/{chunk-XQ72DZKJ.js → chunk-7TQCR7AB.js} +1 -1
  48. package/dist/{chunk-QETYXKQQ.js → chunk-7V3F5HO4.js} +97 -14
  49. package/dist/{chunk-BZZTVOGG.js → chunk-D2EGO543.js} +5 -5
  50. package/dist/{chunk-ZPLJ24OV.js → chunk-D6S3ZKIY.js} +1 -1
  51. package/dist/{chunk-K2IUBCND.js → chunk-HFC3MKXA.js} +0 -51
  52. package/dist/{chunk-ICSZF37W.js → chunk-JRIPQ7DN.js} +1 -1
  53. package/dist/{chunk-TFGKUWHY.js → chunk-JTVFIN6H.js} +15 -19
  54. package/dist/{chunk-DCVJWGIA.js → chunk-JY26PIRP.js} +2 -2
  55. package/dist/{chunk-DWLNPNC4.js → chunk-LSP4HN5N.js} +1 -1
  56. package/dist/{chunk-AO744WIK.js → chunk-PJ4R4N4Q.js} +123 -38
  57. package/dist/{chunk-VFMW3JUY.js → chunk-QSDFTYKV.js} +1 -1
  58. package/dist/{chunk-LLUW26BS.js → chunk-R5BMJ2NX.js} +38 -2
  59. package/dist/{chunk-W3SIWT7J.js → chunk-RQ2G4DXI.js} +406 -174
  60. package/dist/{chunk-VHF66LCQ.js → chunk-RXCEPCAQ.js} +102 -41
  61. package/dist/{chunk-LJ5W4ZBU.js → chunk-TLVPDT4R.js} +1 -1
  62. package/dist/{chunk-PIURX6IZ.js → chunk-WTT3GGCA.js} +9 -4
  63. package/dist/{chunk-CAJQ7H5A.js → chunk-YE3F4LNJ.js} +17 -17
  64. package/dist/{chunk-TD347SSX.js → chunk-YXEZ75MB.js} +31 -20
  65. package/dist/{chunk-TPA6PYN2.js → chunk-ZBRPF6GV.js} +25 -10
  66. package/dist/cloud-import.js +20 -116
  67. package/dist/compose/renderer.js +17 -17
  68. package/dist/compose.js +18 -18
  69. package/dist/composition/graphics-plan.js +1 -1
  70. package/dist/composition/ops.js +3 -3
  71. package/dist/composition/primitive-catalog.js +1 -1
  72. package/dist/composition/projection.js +2 -2
  73. package/dist/composition/validators.js +4 -2
  74. package/dist/composition-ops.js +6 -6
  75. package/dist/composition.js +6 -4
  76. package/dist/{context-JLLU3MYD.js → context-XWNT6QZH.js} +4 -4
  77. package/dist/core/render.js +3 -3
  78. package/dist/core/select.js +2 -2
  79. package/dist/core.js +3 -3
  80. package/dist/director/ai-sdk.js +3 -3
  81. package/dist/director/domain.js +2 -2
  82. package/dist/director.js +3 -3
  83. package/dist/errors.js +1 -1
  84. package/dist/mcp/adapter.js +59 -22
  85. package/dist/mcp/core.js +1 -1
  86. package/dist/mcp/curation.js +5 -1
  87. package/dist/mcp/server.js +4 -4
  88. package/dist/mcp.js +4 -4
  89. package/dist/media-model/media-kind.js +98 -9
  90. package/dist/media-model/testing.js +6 -6
  91. package/dist/media-model.js +83 -77
  92. package/dist/nle-export.js +18 -18
  93. package/dist/primitives/backgrounds.js +2 -2
  94. package/dist/primitives/captions.js +3 -3
  95. package/dist/primitives/effects.js +2 -2
  96. package/dist/primitives/hero-text.js +2 -2
  97. package/dist/primitives/layouts.js +2 -2
  98. package/dist/primitives/lib/index.js +12 -12
  99. package/dist/primitives/lib.js +12 -12
  100. package/dist/primitives/scenes.js +2 -2
  101. package/dist/primitives/text.js +2 -2
  102. package/dist/primitives/ui-blocks.js +2 -2
  103. package/dist/primitives.js +19 -19
  104. package/dist/render-harness.js +4 -2
  105. package/package.json +13 -37
  106. package/dist/_members/authoring/prompts/designReviewerPrompt.d.ts +0 -2
  107. package/dist/_members/cloud-import/MediaItemPreprocessor.d.ts +0 -18
  108. package/dist/_members/cloud-import/multipartUpload.d.ts +0 -12
  109. package/dist/_members/convex-api/api.d.ts +0 -2
  110. package/dist/_members/convex-api/dataModel.d.ts +0 -4
  111. package/dist/chunk-6IU2UQI5.js +0 -107
  112. package/dist/chunk-EP2Y6M2J.js +0 -64
  113. package/dist/chunk-WZH57M53.js +0 -494
  114. package/dist/cloud-import/multipart.d.ts +0 -1
  115. package/dist/cloud-import/multipart.js +0 -8
  116. package/dist/convex-api/dataModel.d.ts +0 -1
  117. package/dist/convex-api/dataModel.js +0 -0
  118. package/dist/convex-api.d.ts +0 -1
  119. package/dist/convex-api.js +0 -8
  120. package/dist/{chunk-RP4SXXLJ.js → chunk-3PM6VICZ.js} +3 -3
  121. package/dist/{chunk-UQSOS726.js → chunk-6ABIXGLO.js} +4 -4
  122. package/dist/{chunk-SAMQUUO5.js → chunk-BIBYZJL3.js} +3 -3
  123. package/dist/{chunk-GMD33ZD7.js → chunk-O7GNE4BQ.js} +3 -3
  124. package/dist/{chunk-BKHGL4MB.js → chunk-THJAY7QS.js} +4 -4
  125. package/dist/{chunk-DYZE7JZA.js → chunk-TMIBBD5E.js} +3 -3
  126. package/dist/{chunk-G5BFI32U.js → chunk-XATRRDVG.js} +3 -3
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  waitForJob
3
- } from "../chunk-QETYXKQQ.js";
3
+ } from "../chunk-7V3F5HO4.js";
4
+ import {
5
+ CURATED_TOOLS
6
+ } from "../chunk-PJ4R4N4Q.js";
4
7
  import {
5
8
  apiErrorFrom,
6
9
  bodySchemaFor,
@@ -11,10 +14,7 @@ import {
11
14
  opById,
12
15
  safeParse,
13
16
  sniffImageMediaType
14
- } from "../chunk-W3SIWT7J.js";
15
- import {
16
- CURATED_TOOLS
17
- } from "../chunk-AO744WIK.js";
17
+ } from "../chunk-RQ2G4DXI.js";
18
18
  import "../chunk-2ESYSVXG.js";
19
19
 
20
20
  // ../mcp/src/adapter.ts
@@ -25,9 +25,9 @@ import { tool } from "ai";
25
25
  var INTERNAL_LOOP_TOOLS = [
26
26
  {
27
27
  name: "render_frame",
28
- operationId: "previewFrame",
28
+ operationId: "previewFrameJob",
29
29
  pathArgs: { projectId: "id" },
30
- description: "Render still(s) of the WHOLE composition at the given timestamps, returning presigned image(s) \u2014 the in-loop full-composition preview. `body.timestamps` is an array of clip-relative SECONDS: pass EVERY beat you want to inspect in ONE call \u2014 a call is flat-cost and one budget unit however many timestamps it carries, and all render in a single pass (a contact sheet), so never spend calls one frame at a time. Stills are content-addressed: re-rendering an unchanged composition is free, and the judge grades the EXACT frames you looked at. (One component instead of the whole composition? use preview_component.)",
30
+ description: "Queue durable stills of the WHOLE composition, then wait for the job and return the images. `body.timestamps` is an array of clip-relative SECONDS: pass EVERY beat you want to inspect in ONE call \u2014 a call is flat-cost and one budget unit however many timestamps it carries. Stills are content-addressed and retries reattach to the same execution. (One component instead of the whole composition? use preview_component.)",
31
31
  annotations: { readOnlyHint: true }
32
32
  },
33
33
  {
@@ -41,7 +41,7 @@ var INTERNAL_LOOP_TOOLS = [
41
41
  name: "preview_component",
42
42
  operationId: "previewComponent",
43
43
  pathArgs: { projectId: "id" },
44
- description: "Queue a MOTION-clip render of ONE org-installed component \u2014 ASYNC; the in-loop wrapper blocks until terminal and returns the clip. It is the SAME content-addressed bake the production render composites, so what you preview is literally the object that ships, and previewing an unchanged component is free. Failures carry typed codes (component_does_not_compile / component_runtime_error) with the sanitized author-fixable message \u2014 read it, fix the tsxSource via create_component, and re-preview. Idempotent per (componentId, params, dims).",
44
+ description: "Queue a preview of ONE org-installed component \u2014 ASYNC; the in-loop wrapper blocks until terminal. Live mode returns an image still; baked mode returns the same content-addressed VP9-alpha motion artifact the production render composites. Failures carry typed codes (component_does_not_compile / component_runtime_error) with the sanitized author-fixable message \u2014 read it, fix the tsxSource via create_component, and re-preview. Idempotent per (componentId, params, dims, executionMode).",
45
45
  annotations: { idempotentHint: true }
46
46
  },
47
47
  {
@@ -82,7 +82,7 @@ var INTERNAL_LOOP_TOOLS = [
82
82
  name: "wait_job",
83
83
  operationId: "getJob",
84
84
  title: "Wait for Job",
85
- description: "Wait for a long-running job and return the resolved result \u2014 a BOUNDED long-poll. Polls the job status (render / compose / consult / clip-suggestions / verify / preview / brand-kit extract) and blocks up to the caller's window; if the job is still running when the window closes it returns a `Still running` continuation \u2014 call wait_job again with the SAME arguments to keep waiting (the job keeps executing server-side; nothing is lost between calls). Call this right after create_render / compose / consult / suggest_briefs / score_composition / preview_component \u2014 the enqueue call returns only a receipt, and the RESULT (download URL, scores, critique) arrives here.",
85
+ description: "Wait for a long-running job and return the resolved result \u2014 a BOUNDED long-poll. Polls the job status (media / render / compose / consult / clip-suggestions / verify / preview / brand-kit extract) and blocks up to the caller's window; if the job is still running when the window closes it returns a `Still running` continuation \u2014 call wait_job again with the SAME arguments to keep waiting (the job keeps executing server-side; nothing is lost between calls). Call this right after import_media / generate_media / create_render / compose / consult / suggest_briefs / score_composition / preview_component \u2014 the enqueue call returns only a receipt, and the RESULT arrives here.",
86
86
  annotations: { readOnlyHint: true }
87
87
  }
88
88
  ];
@@ -137,6 +137,7 @@ async function pollJobToTerminal(ex, jobId, jobPoll) {
137
137
  const s = String(job?.status ?? "");
138
138
  if (s === "succeeded") return { outcome: "succeeded", job };
139
139
  if (s === "failed") return { outcome: "failed", job };
140
+ if (s === "cancelled") return { outcome: "cancelled", job };
140
141
  }
141
142
  if (Date.now() + pollMs >= deadline) return { outcome: "timeout" };
142
143
  await sleep(pollMs);
@@ -225,7 +226,9 @@ function previewVisionModelOutput({ output }) {
225
226
  };
226
227
  }
227
228
  function buildRenderFrameTool(spec, ex, budget, opts) {
228
- const op = opById(spec.operationId);
229
+ const canonicalOp = opById(spec.operationId);
230
+ const transport = opts?.transportOverrides?.[spec.name];
231
+ const op = transport ? { ...canonicalOp, ...transport } : canonicalOp;
229
232
  const fetchImage = opts?.fetchImage ?? defaultFetchImage;
230
233
  const reverse = {};
231
234
  for (const [friendly, opParam] of Object.entries(spec.pathArgs ?? {})) {
@@ -252,9 +255,23 @@ function buildRenderFrameTool(spec, ex, budget, opts) {
252
255
  const infra = infraToolErrorFromResponse(res);
253
256
  if (infra) throw infra;
254
257
  if (!isOk(res.status)) return JSON.stringify({ error: fmtErr(apiErrorFrom(res)) });
255
- const json = safeParse(res.text);
258
+ const receipt = safeParse(res.text);
259
+ if (!receipt?.jobId) return JSON.stringify({ error: "preview-frame enqueue returned no jobId" });
260
+ const done = await pollJobToTerminal(ex, receipt.jobId, opts?.jobPoll);
261
+ if (done.outcome === "failed" || done.outcome === "cancelled") {
262
+ return JSON.stringify({
263
+ error: done.outcome === "cancelled" ? "preview-frame job cancelled" : done.pollError ?? done.job?.error ?? "preview-frame job failed"
264
+ });
265
+ }
266
+ if (done.outcome === "timeout") {
267
+ return JSON.stringify({
268
+ note: `preview-frame still rendering after ${Math.round((opts?.jobPoll?.timeoutMs ?? JOB_TIMEOUT_MS) / 1e3)}s; call preview_frame again to reattach`,
269
+ jobId: receipt.jobId
270
+ });
271
+ }
272
+ const json = done.job?.result;
256
273
  return inlineStillsOrNote(
257
- (json?.stills ?? []).map((s) => s.url),
274
+ (json?.artifacts ?? []).map((artifact) => artifact.url),
258
275
  fetchImage,
259
276
  "no stills returned for the requested timestamps"
260
277
  );
@@ -263,7 +280,9 @@ function buildRenderFrameTool(spec, ex, budget, opts) {
263
280
  });
264
281
  }
265
282
  function buildPreviewComponentTool(spec, ex, opts) {
266
- const op = opById(spec.operationId);
283
+ const canonicalOp = opById(spec.operationId);
284
+ const transport = opts?.transportOverrides?.[spec.name];
285
+ const op = transport ? { ...canonicalOp, ...transport } : canonicalOp;
267
286
  const fetchImage = opts?.fetchImage ?? defaultFetchImage;
268
287
  const reverse = {};
269
288
  for (const [friendly, opParam] of Object.entries(spec.pathArgs ?? {})) {
@@ -293,10 +312,12 @@ function buildPreviewComponentTool(spec, ex, opts) {
293
312
  if (!isOk(res.status)) return JSON.stringify({ error: fmtErr(apiErrorFrom(res)) });
294
313
  const json = safeParse(res.text);
295
314
  let url = json?.url;
315
+ let artifactKind = json?.artifactKind;
316
+ let contentType = json?.contentType;
296
317
  if (!url && json?.jobId) {
297
318
  const done = await pollJobToTerminal(ex, json.jobId, opts?.jobPoll);
298
- if (done.outcome === "failed") {
299
- const err = done.pollError ?? (done.job?.error ? `${done.job.error.code ?? "preview_failed"}: ${done.job.error.message ?? ""}` : "preview job failed");
319
+ if (done.outcome === "failed" || done.outcome === "cancelled") {
320
+ const err = done.outcome === "cancelled" ? "preview job cancelled" : done.pollError ?? (done.job?.error ? `${done.job.error.code ?? "preview_failed"}: ${done.job.error.message ?? ""}` : "preview job failed");
300
321
  return JSON.stringify({ error: err });
301
322
  }
302
323
  if (done.outcome === "timeout") {
@@ -304,7 +325,19 @@ function buildPreviewComponentTool(spec, ex, opts) {
304
325
  note: `component preview still rendering after ${Math.round((opts?.jobPoll?.timeoutMs ?? JOB_TIMEOUT_MS) / 1e3)}s \u2014 proceed, or re-preview later`
305
326
  });
306
327
  }
307
- url = done.job?.result?.url;
328
+ const result = done.job?.result;
329
+ url = result?.url;
330
+ artifactKind = result?.artifactKind;
331
+ contentType = result?.contentType;
332
+ }
333
+ const isImage = artifactKind === "image" || contentType?.startsWith("image/") === true || !artifactKind && !contentType && /\.(?:png|jpe?g|webp)(?:\?|$)/i.test(url ?? "");
334
+ if (url && !isImage) {
335
+ return JSON.stringify({
336
+ artifactKind: artifactKind ?? "motion",
337
+ contentType: contentType ?? "video/webm",
338
+ url,
339
+ note: "Motion previews are returned as URLs; they are not attached as image blocks."
340
+ });
308
341
  }
309
342
  return inlineStillsOrNote(
310
343
  [url],
@@ -386,7 +419,7 @@ function buildVerifyCompositionTool(spec, ex, budget, opts) {
386
419
  false
387
420
  );
388
421
  }
389
- const err = done.pollError ?? (done.job?.error ? `${done.job.error.code ?? "verify_failed"}: ${done.job.error.message ?? ""}` : "verify job failed");
422
+ const err = done.outcome === "cancelled" ? "verify job cancelled" : done.pollError ?? (done.job?.error ? `${done.job.error.code ?? "verify_failed"}: ${done.job.error.message ?? ""}` : "verify job failed");
390
423
  return finish(JSON.stringify({ error: err }), false);
391
424
  }
392
425
  });
@@ -432,6 +465,7 @@ var WAIT_KINDS = [
432
465
  "compose",
433
466
  "suggestions",
434
467
  "verify",
468
+ "preview_frame",
435
469
  "preview",
436
470
  "brand_kit_extract",
437
471
  "consult"
@@ -444,7 +478,7 @@ function buildWaitJobTool(spec, ex, opts) {
444
478
  description: spec.description,
445
479
  inputSchema: z.object({
446
480
  kind: z.enum(WAIT_KINDS).describe(
447
- "What to wait on: a render job, a compose job, a consult advisory, AI clip-suggestion analysis, or a generic async job (verify / preview / brand_kit_extract \u2014 the kind is named in the enqueue receipt)."
481
+ "What to wait on: a render job, compose job, consult advisory, AI clip-suggestion analysis, or a generic async job (verify / preview_frame / preview / brand_kit_extract \u2014 use the kind in the enqueue receipt)."
448
482
  ),
449
483
  id: z.string().describe("The job id from the enqueue call (renderId / composeJobId / jobId / mediaItemId for suggestions)."),
450
484
  projectId: z.string().optional().describe("Required for render / compose / consult (their status routes are project-scoped)."),
@@ -509,7 +543,9 @@ function buildOneTool(spec, ex, budget, opts) {
509
543
  if (spec.name === "preview_component") return buildPreviewComponentTool(spec, ex, opts);
510
544
  if (spec.name === "verify_composition") return buildVerifyCompositionTool(spec, ex, budget, opts);
511
545
  if (spec.name === "view_style_reference") return buildViewStyleReferenceTool(spec, ex, budget, opts);
512
- const op = opById(spec.operationId);
546
+ const canonicalOp = opById(spec.operationId);
547
+ const transport = opts?.transportOverrides?.[spec.name];
548
+ const op = transport ? { ...canonicalOp, ...transport } : canonicalOp;
513
549
  const onProgress = opts?.onProgress;
514
550
  const reverse = {};
515
551
  for (const [friendly, opParam] of Object.entries(spec.pathArgs ?? {})) {
@@ -590,9 +626,10 @@ function buildCuratedToolSet(ex, opts) {
590
626
  used: { captures: 0, verifies: 0, styleViews: 0 }
591
627
  };
592
628
  const tools = {};
593
- for (const spec of [...INTERNAL_LOOP_TOOLS, ...CURATED_TOOLS]) {
594
- if (!allowed.has(spec.name)) continue;
595
- if (tools[spec.name]) continue;
629
+ for (const canonicalSpec of [...INTERNAL_LOOP_TOOLS, ...CURATED_TOOLS]) {
630
+ if (!allowed.has(canonicalSpec.name)) continue;
631
+ if (tools[canonicalSpec.name]) continue;
632
+ const spec = opts.specOverrides?.[canonicalSpec.name] ? { ...canonicalSpec, ...opts.specOverrides[canonicalSpec.name], name: canonicalSpec.name } : canonicalSpec;
596
633
  tools[spec.name] = buildOneTool(spec, ex, budget, opts);
597
634
  }
598
635
  return tools;
package/dist/mcp/core.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  sniffImageMediaType,
18
18
  text,
19
19
  withMedia
20
- } from "../chunk-W3SIWT7J.js";
20
+ } from "../chunk-RQ2G4DXI.js";
21
21
  import "../chunk-2ESYSVXG.js";
22
22
  export {
23
23
  __resetPreviewCache,
@@ -5,10 +5,12 @@ import {
5
5
  KNOWN_BACKEND_GAPS,
6
6
  formatComponentList,
7
7
  formatComposition,
8
+ formatMediaContext,
8
9
  formatMediaList,
9
10
  formatResourceCandidates,
11
+ formatTranscriptPage,
10
12
  formatWarnings
11
- } from "../chunk-AO744WIK.js";
13
+ } from "../chunk-PJ4R4N4Q.js";
12
14
  import "../chunk-2ESYSVXG.js";
13
15
  export {
14
16
  CRUD_COVERAGE,
@@ -17,7 +19,9 @@ export {
17
19
  KNOWN_BACKEND_GAPS,
18
20
  formatComponentList,
19
21
  formatComposition,
22
+ formatMediaContext,
20
23
  formatMediaList,
21
24
  formatResourceCandidates,
25
+ formatTranscriptPage,
22
26
  formatWarnings
23
27
  };
@@ -8,10 +8,10 @@ import {
8
8
  registerRawTools,
9
9
  registerSkillPrompts,
10
10
  titleCase
11
- } from "../chunk-TD347SSX.js";
12
- import "../chunk-QETYXKQQ.js";
13
- import "../chunk-W3SIWT7J.js";
14
- import "../chunk-AO744WIK.js";
11
+ } from "../chunk-YXEZ75MB.js";
12
+ import "../chunk-7V3F5HO4.js";
13
+ import "../chunk-PJ4R4N4Q.js";
14
+ import "../chunk-RQ2G4DXI.js";
15
15
  import "../chunk-2ESYSVXG.js";
16
16
  export {
17
17
  RAW_EXCLUDED_OPERATION_IDS,
package/dist/mcp.js CHANGED
@@ -9,10 +9,10 @@ import {
9
9
  registerCuratedTools,
10
10
  registerRawTools,
11
11
  registerSkillPrompts
12
- } from "./chunk-TD347SSX.js";
13
- import "./chunk-QETYXKQQ.js";
14
- import "./chunk-W3SIWT7J.js";
15
- import "./chunk-AO744WIK.js";
12
+ } from "./chunk-YXEZ75MB.js";
13
+ import "./chunk-7V3F5HO4.js";
14
+ import "./chunk-PJ4R4N4Q.js";
15
+ import "./chunk-RQ2G4DXI.js";
16
16
  import "./chunk-2ESYSVXG.js";
17
17
 
18
18
  // ../mcp/src/index.ts
@@ -1,13 +1,102 @@
1
- import {
2
- ALLOWED_CONTENT_TYPES,
3
- IMAGE_CONTENT_TYPES,
4
- POOL_EXTENSIONS,
5
- contentTypeForUpload,
6
- extensionForContentType,
7
- mediaKind,
8
- mediaKindForFilename
9
- } from "../chunk-6IU2UQI5.js";
10
1
  import "../chunk-2ESYSVXG.js";
2
+
3
+ // ../data-models/media-model/src/media-kind.ts
4
+ var IMAGE_CONTENT_TYPES = ["image/png", "image/jpeg", "image/webp"];
5
+ var ALLOWED_CONTENT_TYPES = [
6
+ "video/mp4",
7
+ "video/quicktime",
8
+ "video/x-matroska",
9
+ "video/webm",
10
+ "audio/mpeg",
11
+ "audio/wav",
12
+ "audio/x-wav",
13
+ "audio/mp4",
14
+ "audio/aac",
15
+ "image/png",
16
+ "image/jpeg",
17
+ "image/webp",
18
+ "image/gif",
19
+ "image/svg+xml",
20
+ "application/json",
21
+ "font/ttf",
22
+ "font/otf",
23
+ "font/woff",
24
+ "font/woff2"
25
+ ];
26
+ function mediaKind(contentType) {
27
+ const ct = (contentType || "").toLowerCase();
28
+ if (ct.startsWith("video/")) return "video";
29
+ if (ct.startsWith("audio/")) return "audio";
30
+ if (IMAGE_CONTENT_TYPES.includes(ct)) return "image";
31
+ return "opaque";
32
+ }
33
+ var EXT = {
34
+ "video/mp4": "mp4",
35
+ "audio/mp4": "mp4",
36
+ "video/quicktime": "mov",
37
+ "video/x-matroska": "mkv",
38
+ "video/webm": "webm",
39
+ "video/x-msvideo": "avi",
40
+ "audio/mpeg": "mp3",
41
+ "audio/wav": "wav",
42
+ "audio/x-wav": "wav",
43
+ "audio/aac": "aac",
44
+ "audio/ogg": "ogg",
45
+ "audio/flac": "flac",
46
+ "image/png": "png",
47
+ "image/jpeg": "jpg",
48
+ "image/webp": "webp",
49
+ "font/ttf": "ttf",
50
+ "font/otf": "otf",
51
+ "font/woff": "woff",
52
+ "font/woff2": "woff2",
53
+ "application/json": "json",
54
+ "image/svg+xml": "svg",
55
+ "image/gif": "gif"
56
+ };
57
+ function extensionForContentType(contentType) {
58
+ return EXT[(contentType || "").toLowerCase()] ?? "bin";
59
+ }
60
+ var CONTENT_TYPE_ALIASES = {
61
+ "audio/mp3": "audio/mpeg",
62
+ "audio/x-mp3": "audio/mpeg",
63
+ "audio/x-mpeg": "audio/mpeg",
64
+ "audio/mpeg3": "audio/mpeg",
65
+ "audio/x-mpeg-3": "audio/mpeg",
66
+ "audio/x-m4a": "audio/mp4",
67
+ "audio/m4a": "audio/mp4",
68
+ "audio/wave": "audio/wav",
69
+ "audio/vnd.wave": "audio/wav",
70
+ "audio/x-aac": "audio/aac",
71
+ "image/jpg": "image/jpeg",
72
+ "video/x-quicktime": "video/quicktime",
73
+ "video/mov": "video/quicktime",
74
+ "video/x-m4v": "video/mp4",
75
+ "video/mkv": "video/x-matroska"
76
+ };
77
+ var TYPE_BY_EXTENSION = Object.entries(EXT).reduce(
78
+ (acc, [contentType, ext]) => {
79
+ if (!(ext in acc)) acc[ext] = contentType;
80
+ return acc;
81
+ },
82
+ {}
83
+ );
84
+ TYPE_BY_EXTENSION["jpeg"] = "image/jpeg";
85
+ TYPE_BY_EXTENSION["m4a"] = "audio/mp4";
86
+ function mediaKindForFilename(filename) {
87
+ return mediaKind(contentTypeForUpload(filename, null));
88
+ }
89
+ var POOL_EXTENSIONS = Object.entries(TYPE_BY_EXTENSION).filter(([, contentType]) => mediaKind(contentType) !== "opaque").map(([ext]) => ext);
90
+ function contentTypeForUpload(filename, claimed) {
91
+ const ct = (claimed ?? "").trim().toLowerCase();
92
+ const allowed = ALLOWED_CONTENT_TYPES;
93
+ if (ct && allowed.includes(ct)) return ct;
94
+ if (ct && CONTENT_TYPE_ALIASES[ct]) return CONTENT_TYPE_ALIASES[ct];
95
+ const ext = filename.toLowerCase().split(".").pop() ?? "";
96
+ const byExt = TYPE_BY_EXTENSION[ext];
97
+ if (byExt) return byExt;
98
+ return ct;
99
+ }
11
100
  export {
12
101
  ALLOWED_CONTENT_TYPES,
13
102
  IMAGE_CONTENT_TYPES,
@@ -6032,7 +6032,7 @@ function manageArtifactAttachment(attachment) {
6032
6032
  }
6033
6033
  }
6034
6034
 
6035
- // ../../node_modules/.pnpm/vitest@4.1.11_@opentelemetry+api@1.9.1_@types+node@22.20.1_@vitest+coverage-v8@4.1.11_j_92db6a7db25e6e55d70dc5d47c837999/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js
6035
+ // ../../node_modules/.pnpm/vitest@4.1.11_@opentelemetry+api@1.9.1_@types+node@24.13.3_@vitest+coverage-v8@4.1.11_j_c9dcd8e1465939ba296830f01bf940ab/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js
6036
6036
  var NAME_WORKER_STATE = "__vitest_worker__";
6037
6037
  function getWorkerState() {
6038
6038
  const workerState = globalThis[NAME_WORKER_STATE];
@@ -12432,10 +12432,10 @@ function offsetToLineNumber(source, offset) {
12432
12432
  return line + 1;
12433
12433
  }
12434
12434
 
12435
- // ../../node_modules/.pnpm/vitest@4.1.11_@opentelemetry+api@1.9.1_@types+node@22.20.1_@vitest+coverage-v8@4.1.11_j_92db6a7db25e6e55d70dc5d47c837999/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js
12435
+ // ../../node_modules/.pnpm/vitest@4.1.11_@opentelemetry+api@1.9.1_@types+node@24.13.3_@vitest+coverage-v8@4.1.11_j_c9dcd8e1465939ba296830f01bf940ab/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.js
12436
12436
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
12437
12437
 
12438
- // ../../node_modules/.pnpm/vitest@4.1.11_@opentelemetry+api@1.9.1_@types+node@22.20.1_@vitest+coverage-v8@4.1.11_j_92db6a7db25e6e55d70dc5d47c837999/node_modules/vitest/dist/chunks/rpc.MzXet3jl.js
12438
+ // ../../node_modules/.pnpm/vitest@4.1.11_@opentelemetry+api@1.9.1_@types+node@24.13.3_@vitest+coverage-v8@4.1.11_j_c9dcd8e1465939ba296830f01bf940ab/node_modules/vitest/dist/chunks/rpc.MzXet3jl.js
12439
12439
  var RealDate = Date;
12440
12440
  var now2 = null;
12441
12441
  var MockDate = class _MockDate extends RealDate {
@@ -13535,7 +13535,7 @@ function raceWith(promise, other) {
13535
13535
  }))]);
13536
13536
  }
13537
13537
 
13538
- // ../../node_modules/.pnpm/vitest@4.1.11_@opentelemetry+api@1.9.1_@types+node@22.20.1_@vitest+coverage-v8@4.1.11_j_92db6a7db25e6e55d70dc5d47c837999/node_modules/vitest/dist/chunks/test.DNmyFkvJ.js
13538
+ // ../../node_modules/.pnpm/vitest@4.1.11_@opentelemetry+api@1.9.1_@types+node@24.13.3_@vitest+coverage-v8@4.1.11_j_c9dcd8e1465939ba296830f01bf940ab/node_modules/vitest/dist/chunks/test.DNmyFkvJ.js
13539
13539
  var fakeTimersSrc = {};
13540
13540
  var global2;
13541
13541
  var hasRequiredGlobal;
@@ -16238,7 +16238,7 @@ Object.defineProperty(globalThis, GLOBAL_EXPECT, {
16238
16238
  var assert4 = chai_exports.assert;
16239
16239
  var should2 = chai_exports.should;
16240
16240
 
16241
- // ../../node_modules/.pnpm/vite@7.3.6_@types+node@22.20.1_jiti@2.7.0_lightningcss@1.33.0_terser@5.51.0_tsx@4.23.12_yaml@2.9.0/node_modules/vite/dist/node/module-runner.js
16241
+ // ../../node_modules/.pnpm/vite@7.3.6_@types+node@24.13.3_jiti@2.7.0_lightningcss@1.33.0_terser@5.51.0_tsx@4.23.12_yaml@2.9.0/node_modules/vite/dist/node/module-runner.js
16242
16242
  var SOURCEMAPPING_URL = "sourceMa";
16243
16243
  SOURCEMAPPING_URL += "ppingURL";
16244
16244
  var isWindows = typeof process < "u" && process.platform === "win32";
@@ -16283,7 +16283,7 @@ var envProxy = new Proxy({}, { get(_, p) {
16283
16283
  throw Error(`[module runner] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p)}" instead.`);
16284
16284
  } });
16285
16285
 
16286
- // ../../node_modules/.pnpm/vitest@4.1.11_@opentelemetry+api@1.9.1_@types+node@22.20.1_@vitest+coverage-v8@4.1.11_j_92db6a7db25e6e55d70dc5d47c837999/node_modules/vitest/dist/index.js
16286
+ // ../../node_modules/.pnpm/vitest@4.1.11_@opentelemetry+api@1.9.1_@types+node@24.13.3_@vitest+coverage-v8@4.1.11_j_c9dcd8e1465939ba296830f01bf940ab/node_modules/vitest/dist/index.js
16287
16287
  var import_expect_type = __toESM(require_dist(), 1);
16288
16288
 
16289
16289
  // ../data-models/media-model/src/testing/mediaStoreContract.ts
@@ -22,9 +22,14 @@ import "./chunk-XELS2BGA.js";
22
22
  import "./chunk-2ESYSVXG.js";
23
23
 
24
24
  // ../data-models/media-model/src/api.ts
25
+ import { z as z2 } from "zod";
26
+
27
+ // ../data-models/media-model/src/opaqueId.ts
25
28
  import { z } from "zod";
26
- import { zid } from "convex-helpers/server/zod3";
27
- var MediaProcessingPhase = z.enum([
29
+ var OpaqueId = z.string();
30
+
31
+ // ../data-models/media-model/src/api.ts
32
+ var MediaProcessingPhase = z2.enum([
28
33
  "idle",
29
34
  "pending_import",
30
35
  "pending_upload",
@@ -43,114 +48,114 @@ var MediaProcessingPhase = z.enum([
43
48
  "error",
44
49
  "cancelled"
45
50
  ]);
46
- var ProxyStatus = z.enum([
51
+ var ProxyStatus = z2.enum([
47
52
  "none",
48
53
  "generating",
49
54
  "ready",
50
55
  "failed"
51
56
  ]);
52
- var MediaProcessingStatus = z.object({
57
+ var MediaProcessingStatus = z2.object({
53
58
  phase: MediaProcessingPhase,
54
- percent: z.number().nullable().optional(),
55
- message: z.string().nullable().optional(),
56
- error: z.string().nullable().optional()
59
+ percent: z2.number().nullable().optional(),
60
+ message: z2.string().nullable().optional(),
61
+ error: z2.string().nullable().optional()
57
62
  });
58
- var MediaUnderstanding = z.object({
59
- summary: z.string().optional(),
60
- topics: z.array(z.string()).optional(),
61
- language: z.string().optional(),
62
- notes: z.string().optional(),
63
- extra: z.record(z.string(), z.unknown()).optional()
63
+ var MediaUnderstanding = z2.object({
64
+ summary: z2.string().optional(),
65
+ topics: z2.array(z2.string()).optional(),
66
+ language: z2.string().optional(),
67
+ notes: z2.string().optional(),
68
+ extra: z2.record(z2.string(), z2.unknown()).optional()
64
69
  });
65
- var TextToSpeechGeneration = z.object({
66
- kind: z.literal("text-to-speech"),
67
- provider: z.string().min(1),
68
- text: z.string().min(1),
69
- voice: z.string().min(1),
70
- params: z.record(z.string(), z.unknown()).optional()
70
+ var TextToSpeechGeneration = z2.object({
71
+ kind: z2.literal("text-to-speech"),
72
+ provider: z2.string().min(1),
73
+ text: z2.string().min(1),
74
+ voice: z2.string().min(1),
75
+ params: z2.record(z2.string(), z2.unknown()).optional()
71
76
  });
72
- var TextToImageGeneration = z.object({
73
- kind: z.literal("text-to-image"),
74
- provider: z.string().min(1),
75
- prompt: z.string().min(1),
76
- params: z.record(z.string(), z.unknown()).optional()
77
+ var TextToImageGeneration = z2.object({
78
+ kind: z2.literal("text-to-image"),
79
+ provider: z2.string().min(1),
80
+ prompt: z2.string().min(1),
81
+ params: z2.record(z2.string(), z2.unknown()).optional()
77
82
  });
78
- var ImageToVideoGeneration = z.object({
79
- kind: z.literal("image-to-video"),
80
- provider: z.string().min(1),
81
- sourceMediaId: zid("mediaItems"),
82
- prompt: z.string().optional(),
83
- params: z.record(z.string(), z.unknown()).optional()
83
+ var ImageToVideoGeneration = z2.object({
84
+ kind: z2.literal("image-to-video"),
85
+ provider: z2.string().min(1),
86
+ sourceMediaId: OpaqueId,
87
+ prompt: z2.string().optional(),
88
+ params: z2.record(z2.string(), z2.unknown()).optional()
84
89
  });
85
- var ManimGeneration = z.object({
86
- kind: z.literal("manim"),
87
- scriptId: z.string().optional(),
88
- inlineScript: z.string().optional(),
89
- params: z.record(z.string(), z.unknown()).optional()
90
+ var ManimGeneration = z2.object({
91
+ kind: z2.literal("manim"),
92
+ scriptId: z2.string().optional(),
93
+ inlineScript: z2.string().optional(),
94
+ params: z2.record(z2.string(), z2.unknown()).optional()
90
95
  });
91
- var Generation = z.discriminatedUnion("kind", [
96
+ var Generation = z2.discriminatedUnion("kind", [
92
97
  TextToSpeechGeneration,
93
98
  TextToImageGeneration,
94
99
  ImageToVideoGeneration,
95
100
  ManimGeneration
96
101
  ]);
97
- var TranscriptRef = z.object({
98
- id: z.string().min(1),
99
- ready: z.boolean()
102
+ var TranscriptRef = z2.object({
103
+ id: z2.string().min(1),
104
+ ready: z2.boolean()
100
105
  });
101
- var FrameAnalysis = z.object({
102
- t: z.number().nonnegative(),
103
- faces: z.array(
104
- z.object({
105
- bbox: z.tuple([z.number(), z.number(), z.number(), z.number()]),
106
- confidence: z.number().min(0).max(1).optional()
106
+ var FrameAnalysis = z2.object({
107
+ t: z2.number().nonnegative(),
108
+ faces: z2.array(
109
+ z2.object({
110
+ bbox: z2.tuple([z2.number(), z2.number(), z2.number(), z2.number()]),
111
+ confidence: z2.number().min(0).max(1).optional()
107
112
  })
108
113
  ).optional(),
109
- primarySubject: z.object({
110
- bbox: z.tuple([z.number(), z.number(), z.number(), z.number()])
114
+ primarySubject: z2.object({
115
+ bbox: z2.tuple([z2.number(), z2.number(), z2.number(), z2.number()])
111
116
  }).optional(),
112
- safeRegions: z.array(
113
- z.object({
114
- bbox: z.tuple([z.number(), z.number(), z.number(), z.number()]),
115
- kind: z.string().optional()
117
+ safeRegions: z2.array(
118
+ z2.object({
119
+ bbox: z2.tuple([z2.number(), z2.number(), z2.number(), z2.number()]),
120
+ kind: z2.string().optional()
116
121
  })
117
122
  ).optional(),
118
- dominantColors: z.array(z.string()).optional()
123
+ dominantColors: z2.array(z2.string()).optional()
119
124
  });
120
- var Filmstrip = z.object({
121
- mediaId: zid("mediaItems"),
122
- sheetUrl: z.string().url(),
123
- frameCount: z.number().int().positive(),
124
- frameInterval: z.number().positive(),
125
- frameWidth: z.number().int().positive(),
126
- frameHeight: z.number().int().positive(),
127
- columns: z.number().int().positive()
125
+ var Filmstrip = z2.object({
126
+ mediaId: OpaqueId,
127
+ sheetUrl: z2.string().url(),
128
+ frameCount: z2.number().int().positive(),
129
+ frameInterval: z2.number().positive(),
130
+ frameWidth: z2.number().int().positive(),
131
+ frameHeight: z2.number().int().positive(),
132
+ columns: z2.number().int().positive()
128
133
  });
129
- var Perception = z.object({
130
- mediaId: zid("mediaItems"),
134
+ var Perception = z2.object({
135
+ mediaId: OpaqueId,
131
136
  filmstrip: Filmstrip.optional(),
132
- frameAnalysis: z.array(FrameAnalysis).optional()
137
+ frameAnalysis: z2.array(FrameAnalysis).optional()
133
138
  });
134
- var MediaItem = z.object({
135
- id: zid("mediaItems"),
136
- kind: z.enum(["video", "audio", "image"]),
137
- filename: z.string().min(1),
138
- mimeType: z.string().min(1),
139
- size: z.number().int().nonnegative(),
140
- duration: z.number().nonnegative().optional(),
139
+ var MediaItem = z2.object({
140
+ id: OpaqueId,
141
+ kind: z2.enum(["video", "audio", "image"]),
142
+ filename: z2.string().min(1),
143
+ mimeType: z2.string().min(1),
144
+ size: z2.number().int().nonnegative(),
145
+ duration: z2.number().nonnegative().optional(),
141
146
  // seconds; populated post-transcode
142
- width: z.number().int().positive().optional(),
143
- height: z.number().int().positive().optional(),
144
- fps: z.number().positive().optional(),
147
+ width: z2.number().int().positive().optional(),
148
+ height: z2.number().int().positive().optional(),
149
+ fps: z2.number().positive().optional(),
145
150
  status: MediaProcessingPhase,
146
- source: z.enum(["upload", "generated"]).optional(),
151
+ source: z2.enum(["upload", "generated"]).optional(),
147
152
  generation: Generation.optional(),
148
153
  transcript: TranscriptRef.optional(),
149
154
  mediaUnderstanding: MediaUnderstanding.optional(),
150
155
  perception: Perception.optional(),
151
- createdAt: z.number(),
152
- updatedAt: z.number(),
153
- ownerOrgId: z.string().optional()
156
+ createdAt: z2.number(),
157
+ updatedAt: z2.number(),
158
+ ownerOrgId: z2.string().optional()
154
159
  });
155
160
  export {
156
161
  ClientRequestId,
@@ -176,6 +181,7 @@ export {
176
181
  MediaProcessingPhase,
177
182
  MediaProcessingStatus,
178
183
  MediaUnderstanding,
184
+ OpaqueId,
179
185
  Perception,
180
186
  ProjectHome,
181
187
  ProxyStatus,