@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.
package/dist/cli.cjs CHANGED
@@ -1366,21 +1366,32 @@ var executions_default = createExecutionRoutes();
1366
1366
 
1367
1367
  // src/server/routes/sessions.ts
1368
1368
  var import_hono4 = require("hono");
1369
+ function mediaFields(source) {
1370
+ 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;
1371
+ return {
1372
+ source: source.type,
1373
+ ...source.mediaType ? { mediaType: source.mediaType } : {},
1374
+ ...bytes !== void 0 ? { bytes } : {}
1375
+ };
1376
+ }
1369
1377
  function describeStudioInput(content) {
1370
1378
  if (typeof content === "string") return void 0;
1371
1379
  return {
1372
1380
  parts: content.map((part) => {
1373
- if (part.type === "text") return { type: "text", characters: part.text.length };
1374
- const { source } = part;
1375
- 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;
1376
- return {
1377
- type: "image",
1378
- source: source.type,
1379
- ...source.mediaType ? { mediaType: source.mediaType } : {},
1380
- ...bytes !== void 0 ? { bytes } : {}
1381
- // URLs, provider-file references, and labels are intentionally not
1382
- // included: this is a Studio-safe descriptor, not a replay payload.
1383
- };
1381
+ switch (part.type) {
1382
+ case "text":
1383
+ return { type: "text", characters: part.text.length };
1384
+ case "image":
1385
+ return { type: "image", ...mediaFields(part.source) };
1386
+ case "audio":
1387
+ return { type: "audio", ...mediaFields(part.source) };
1388
+ default: {
1389
+ const unreachable = part;
1390
+ throw new Error(
1391
+ `unsupported model input part: ${String(unreachable.type)}`
1392
+ );
1393
+ }
1394
+ }
1384
1395
  })
1385
1396
  };
1386
1397
  }