@axlsdk/studio 0.23.1 → 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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createServer,
3
3
  handleWsMessage
4
- } from "./chunk-Z374DI7D.js";
4
+ } from "./chunk-XK2DRXKB.js";
5
5
 
6
6
  // src/middleware.ts
7
7
  import { resolve as resolve2, dirname } from "path";
@@ -1369,21 +1369,32 @@ var executions_default = createExecutionRoutes();
1369
1369
 
1370
1370
  // src/server/routes/sessions.ts
1371
1371
  var import_hono4 = require("hono");
1372
+ function mediaFields(source) {
1373
+ 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;
1374
+ return {
1375
+ source: source.type,
1376
+ ...source.mediaType ? { mediaType: source.mediaType } : {},
1377
+ ...bytes !== void 0 ? { bytes } : {}
1378
+ };
1379
+ }
1372
1380
  function describeStudioInput(content) {
1373
1381
  if (typeof content === "string") return void 0;
1374
1382
  return {
1375
1383
  parts: content.map((part) => {
1376
- if (part.type === "text") return { type: "text", characters: part.text.length };
1377
- const { source } = part;
1378
- 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;
1379
- return {
1380
- type: "image",
1381
- source: source.type,
1382
- ...source.mediaType ? { mediaType: source.mediaType } : {},
1383
- ...bytes !== void 0 ? { bytes } : {}
1384
- // URLs, provider-file references, and labels are intentionally not
1385
- // included: this is a Studio-safe descriptor, not a replay payload.
1386
- };
1384
+ switch (part.type) {
1385
+ case "text":
1386
+ return { type: "text", characters: part.text.length };
1387
+ case "image":
1388
+ return { type: "image", ...mediaFields(part.source) };
1389
+ case "audio":
1390
+ return { type: "audio", ...mediaFields(part.source) };
1391
+ default: {
1392
+ const unreachable = part;
1393
+ throw new Error(
1394
+ `unsupported model input part: ${String(unreachable.type)}`
1395
+ );
1396
+ }
1397
+ }
1387
1398
  })
1388
1399
  };
1389
1400
  }