@axlsdk/studio 0.23.2 → 0.23.3

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.
@@ -22,7 +22,7 @@
22
22
  }
23
23
  })();
24
24
  </script>
25
- <script type="module" crossorigin src="./assets/index-7nGvwNtb.js"></script>
25
+ <script type="module" crossorigin src="./assets/index-DIx_trGA.js"></script>
26
26
  <link rel="stylesheet" crossorigin href="./assets/index-Bc4iQdXy.css">
27
27
  </head>
28
28
  <body>
@@ -1373,21 +1373,32 @@ var executions_default = createExecutionRoutes();
1373
1373
 
1374
1374
  // src/server/routes/sessions.ts
1375
1375
  var import_hono4 = require("hono");
1376
+ function mediaFields(source) {
1377
+ const bytes = source.type === "bytes" ? source.data.byteLength : source.type === "base64" ? Math.floor(source.data.length * 3 / 4) - (source.data.endsWith("==") ? 2 : source.data.endsWith("=") ? 1 : 0) : void 0;
1378
+ return {
1379
+ source: source.type,
1380
+ ...source.mediaType ? { mediaType: source.mediaType } : {},
1381
+ ...bytes !== void 0 ? { bytes } : {}
1382
+ };
1383
+ }
1376
1384
  function describeStudioInput(content) {
1377
1385
  if (typeof content === "string") return void 0;
1378
1386
  return {
1379
1387
  parts: content.map((part) => {
1380
- if (part.type === "text") return { type: "text", characters: part.text.length };
1381
- const { source } = part;
1382
- const bytes = source.type === "bytes" ? source.data.byteLength : source.type === "base64" ? Math.floor(source.data.length * 3 / 4) - (source.data.endsWith("==") ? 2 : source.data.endsWith("=") ? 1 : 0) : void 0;
1383
- return {
1384
- type: "image",
1385
- source: source.type,
1386
- ...source.mediaType ? { mediaType: source.mediaType } : {},
1387
- ...bytes !== void 0 ? { bytes } : {}
1388
- // URLs, provider-file references, and labels are intentionally not
1389
- // included: this is a Studio-safe descriptor, not a replay payload.
1390
- };
1388
+ switch (part.type) {
1389
+ case "text":
1390
+ return { type: "text", characters: part.text.length };
1391
+ case "image":
1392
+ return { type: "image", ...mediaFields(part.source) };
1393
+ case "audio":
1394
+ return { type: "audio", ...mediaFields(part.source) };
1395
+ default: {
1396
+ const unreachable = part;
1397
+ throw new Error(
1398
+ `unsupported model input part: ${String(unreachable.type)}`
1399
+ );
1400
+ }
1401
+ }
1391
1402
  })
1392
1403
  };
1393
1404
  }