@absolutejs/voice 0.0.22-beta.463 → 0.0.22-beta.464

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.
@@ -2009,6 +2009,8 @@ var serverMessageToAction = (message) => {
2009
2009
  };
2010
2010
 
2011
2011
  // node_modules/@absolutejs/media/dist/index.js
2012
+ import { mkdir, writeFile } from "fs/promises";
2013
+ import { join } from "path";
2012
2014
  var formatLabel = (format) => `${format.container}/${format.encoding}/${String(format.sampleRateHz)}hz/${String(format.channels)}ch`;
2013
2015
  var formatMatches = (actual, expected) => actual.container === expected.container && actual.encoding === expected.encoding && actual.sampleRateHz === expected.sampleRateHz && actual.channels === expected.channels;
2014
2016
  var pushIssue = (issues, severity, code, message) => {
@@ -2669,6 +2671,269 @@ var buildMediaPipelineCalibrationReport = (input = {}) => {
2669
2671
  turnCommitFrames: turnCommitFrames.length
2670
2672
  };
2671
2673
  };
2674
+ var DEFAULT_METADATA_DENY = [
2675
+ "audioPayload",
2676
+ "auth",
2677
+ "authorization",
2678
+ "cookie",
2679
+ "email",
2680
+ "phone",
2681
+ "phoneNumber",
2682
+ "rawPayload",
2683
+ "secret",
2684
+ "token",
2685
+ "transcript",
2686
+ "utterance"
2687
+ ];
2688
+ var DEFAULT_TRUNCATE = 8;
2689
+ var issueCodes = (issues) => Array.from(new Set(issues.map((issue) => issue.code)));
2690
+ var lastEventKind = (events) => events[events.length - 1]?.kind;
2691
+ var formatOptionalMs = (value) => value === undefined ? "n/a" : `${String(Math.round(value))}ms`;
2692
+ var formatRatio = (value) => `${(value * 100).toFixed(1)}%`;
2693
+ var escapeMarkdownCell = (value) => value.replace(/\|/g, "\\|").replace(/\n/g, " ");
2694
+ var renderIssuesTable = (issues) => {
2695
+ if (issues.length === 0) {
2696
+ return `- No issues.
2697
+ `;
2698
+ }
2699
+ const rows = issues.map((issue) => `| ${issue.severity} | ${escapeMarkdownCell(issue.code)} | ${escapeMarkdownCell(issue.message)} |`).join(`
2700
+ `);
2701
+ return `| Severity | Code | Message |
2702
+ | --- | --- | --- |
2703
+ ${rows}
2704
+ `;
2705
+ };
2706
+ var summarizeMediaQualityReport = (report) => ({
2707
+ backpressureEvents: report.backpressureEvents,
2708
+ description: `${report.totalFrames} frame(s), ${report.gapCount} gap(s), speech ${formatRatio(report.speechRatio)}, status ${report.status}.`,
2709
+ driftMs: report.timestampDriftMs,
2710
+ frameCount: report.totalFrames,
2711
+ gapCount: report.gapCount,
2712
+ issueCodes: issueCodes(report.issues),
2713
+ issueCount: report.issues.length,
2714
+ jitterMs: report.jitterMs,
2715
+ silenceRatio: report.silenceRatio,
2716
+ speechRatio: report.speechRatio,
2717
+ status: report.status
2718
+ });
2719
+ var summarizeMediaTransportReport = (report) => ({
2720
+ backpressureEvents: report.backpressureEvents,
2721
+ description: `${report.name}: ${report.state}, in ${report.inputFrames}, out ${report.outputFrames}, backpressure ${report.backpressureEvents}.`,
2722
+ errors: report.events.filter((event) => event.kind === "error").length,
2723
+ inputFrames: report.inputFrames,
2724
+ lastEventKind: lastEventKind(report.events),
2725
+ name: report.name,
2726
+ outputFrames: report.outputFrames,
2727
+ state: report.state,
2728
+ status: report.status
2729
+ });
2730
+ var summarizeMediaProcessorGraphReport = (report) => {
2731
+ const errorIssueCodes = Array.from(new Set(report.errors.map((event) => event.kind)));
2732
+ return {
2733
+ backpressureEvents: report.backpressure.events.length,
2734
+ description: `${report.name}: ${report.state}, ${report.nodes.length} node(s), in ${report.inputFrames}, out ${report.emittedFrames}, dropped ${report.droppedFrames}.`,
2735
+ droppedFrames: report.droppedFrames,
2736
+ edgeCount: report.edges.length,
2737
+ edgeEventCount: report.edgeEvents.length,
2738
+ emittedFrames: report.emittedFrames,
2739
+ errorCount: report.errors.length,
2740
+ inputFrames: report.inputFrames,
2741
+ issueCodes: errorIssueCodes,
2742
+ lifecycleEventCount: report.lifecycleEvents.length,
2743
+ name: report.name,
2744
+ nodeCount: report.nodes.length,
2745
+ state: report.state,
2746
+ status: report.status,
2747
+ timingMaxMs: report.timing.maxNodeMs
2748
+ };
2749
+ };
2750
+ var renderMediaQualityMarkdown = (report, options = {}) => {
2751
+ const title = options.title ?? "Media Quality Report";
2752
+ const lines = [
2753
+ `# ${title}`,
2754
+ "",
2755
+ `Status: **${report.status}**`,
2756
+ "",
2757
+ "| Metric | Value |",
2758
+ "| --- | ---: |",
2759
+ `| Total frames | ${report.totalFrames} |`,
2760
+ `| Input audio | ${report.inputAudioFrames} |`,
2761
+ `| Assistant audio | ${report.assistantAudioFrames} |`,
2762
+ `| Gaps | ${report.gapCount} |`,
2763
+ `| Jitter | ${formatOptionalMs(report.jitterMs)} |`,
2764
+ `| Timestamp drift | ${formatOptionalMs(report.timestampDriftMs)} |`,
2765
+ `| Speech ratio | ${formatRatio(report.speechRatio)} |`,
2766
+ `| Silence ratio | ${formatRatio(report.silenceRatio)} |`,
2767
+ `| Backpressure events | ${report.backpressureEvents} |`,
2768
+ "",
2769
+ "## Issues",
2770
+ "",
2771
+ renderIssuesTable(report.issues).trimEnd()
2772
+ ];
2773
+ return `${lines.join(`
2774
+ `)}
2775
+ `;
2776
+ };
2777
+ var renderMediaTransportMarkdown = (report, options = {}) => {
2778
+ const title = options.title ?? `Media Transport: ${report.name}`;
2779
+ const limit = options.redact?.truncateArraysAt ?? DEFAULT_TRUNCATE;
2780
+ const events = report.events.slice(-limit);
2781
+ const eventRows = events.length === 0 ? "- No transport events recorded." : ["| At | Kind | State | Buffered | Error |", "| --- | --- | --- | ---: | --- |"].concat(events.map((event) => `| ${event.at} | ${event.kind} | ${event.state} | ${event.bufferedFrames ?? ""} | ${escapeMarkdownCell(event.error ?? "")} |`)).join(`
2782
+ `);
2783
+ const lines = [
2784
+ `# ${title}`,
2785
+ "",
2786
+ `Status: **${report.status}** \xB7 State: **${report.state}**`,
2787
+ "",
2788
+ "| Metric | Value |",
2789
+ "| --- | ---: |",
2790
+ `| Input frames | ${report.inputFrames} |`,
2791
+ `| Output frames | ${report.outputFrames} |`,
2792
+ `| Backpressure events | ${report.backpressureEvents} |`,
2793
+ `| Connected | ${report.connected ? "yes" : "no"} |`,
2794
+ `| Closed | ${report.closed ? "yes" : "no"} |`,
2795
+ `| Failed | ${report.failed ? "yes" : "no"} |`,
2796
+ "",
2797
+ `## Last ${events.length} event(s)`,
2798
+ "",
2799
+ eventRows
2800
+ ];
2801
+ return `${lines.join(`
2802
+ `)}
2803
+ `;
2804
+ };
2805
+ var renderMediaProcessorGraphMarkdown = (report, options = {}) => {
2806
+ const title = options.title ?? `Media Processor Graph: ${report.name}`;
2807
+ const limit = options.redact?.truncateArraysAt ?? DEFAULT_TRUNCATE;
2808
+ const nodeRows = report.nodes.map((node) => `| ${escapeMarkdownCell(node.name)} | ${node.kind} | ${node.status} | ${node.inputFrames} | ${node.emittedFrames} | ${node.droppedFrames} | ${node.errors.length} |`).join(`
2809
+ `);
2810
+ const edgeRows = report.edges.slice(0, limit).map((edge) => `| ${escapeMarkdownCell(edge.from)} | ${escapeMarkdownCell(edge.to)} | ${edge.status} | ${edge.emittedFrames} |`).join(`
2811
+ `);
2812
+ const issues = report.errors.map((event) => ({
2813
+ code: event.kind,
2814
+ message: event.error ?? `Processor graph ${event.kind} (state ${event.state}).`,
2815
+ severity: "error"
2816
+ }));
2817
+ const lines = [
2818
+ `# ${title}`,
2819
+ "",
2820
+ `Status: **${report.status}** \xB7 State: **${report.state}**`,
2821
+ "",
2822
+ "| Metric | Value |",
2823
+ "| --- | ---: |",
2824
+ `| Nodes | ${report.nodes.length} |`,
2825
+ `| Input frames | ${report.inputFrames} |`,
2826
+ `| Emitted frames | ${report.emittedFrames} |`,
2827
+ `| Dropped frames | ${report.droppedFrames} |`,
2828
+ `| Lifecycle events | ${report.lifecycleEvents.length} |`,
2829
+ `| Edge events | ${report.edgeEvents.length} |`,
2830
+ `| Backpressure events | ${report.backpressure.events.length} |`,
2831
+ `| Timing max | ${formatOptionalMs(report.timing.maxNodeMs)} |`,
2832
+ `| Timing average | ${formatOptionalMs(report.timing.averageNodeMs)} |`,
2833
+ "",
2834
+ "## Nodes",
2835
+ "",
2836
+ nodeRows ? `| Node | Kind | Status | In | Out | Dropped | Errors |
2837
+ | --- | --- | --- | ---: | ---: | ---: | ---: |
2838
+ ${nodeRows}` : "- No nodes.",
2839
+ "",
2840
+ `## Edges (showing up to ${limit})`,
2841
+ "",
2842
+ edgeRows ? `| From | To | Status | Frames |
2843
+ | --- | --- | --- | ---: |
2844
+ ${edgeRows}` : "- No edges.",
2845
+ "",
2846
+ "## Errors",
2847
+ "",
2848
+ renderIssuesTable(issues).trimEnd()
2849
+ ];
2850
+ return `${lines.join(`
2851
+ `)}
2852
+ `;
2853
+ };
2854
+ var truncateArrays = (value, limit, seen) => {
2855
+ if (Array.isArray(value)) {
2856
+ const head = value.slice(0, limit).map((entry) => truncateArrays(entry, limit, seen));
2857
+ if (value.length > limit) {
2858
+ return [...head, { truncated: value.length - limit }];
2859
+ }
2860
+ return head;
2861
+ }
2862
+ if (value && typeof value === "object") {
2863
+ if (seen.has(value))
2864
+ return value;
2865
+ seen.add(value);
2866
+ const next = {};
2867
+ for (const [key, entry] of Object.entries(value)) {
2868
+ next[key] = truncateArrays(entry, limit, seen);
2869
+ }
2870
+ return next;
2871
+ }
2872
+ return value;
2873
+ };
2874
+ var applyRedaction = (value, options, seen) => {
2875
+ const mode = options.mode ?? "omit";
2876
+ const maskValue = options.maskValue ?? "[redacted]";
2877
+ const allow = new Set(options.metadataAllow ?? []);
2878
+ const deny = new Set(options.metadataDeny ?? DEFAULT_METADATA_DENY);
2879
+ const walk = (input) => {
2880
+ if (Array.isArray(input)) {
2881
+ return input.map((entry) => walk(entry));
2882
+ }
2883
+ if (input && typeof input === "object") {
2884
+ if (seen.has(input))
2885
+ return input;
2886
+ seen.add(input);
2887
+ const next = {};
2888
+ for (const [key, entry] of Object.entries(input)) {
2889
+ if (allow.has(key)) {
2890
+ next[key] = entry;
2891
+ continue;
2892
+ }
2893
+ if (deny.has(key)) {
2894
+ if (mode === "mask")
2895
+ next[key] = maskValue;
2896
+ continue;
2897
+ }
2898
+ next[key] = walk(entry);
2899
+ }
2900
+ return next;
2901
+ }
2902
+ return input;
2903
+ };
2904
+ return walk(value);
2905
+ };
2906
+ var redactMediaReport = (report, options = {}) => {
2907
+ const limit = options.truncateArraysAt ?? DEFAULT_TRUNCATE;
2908
+ const truncated = truncateArrays(report, limit, new WeakSet);
2909
+ return applyRedaction(truncated, options, new WeakSet);
2910
+ };
2911
+ var buildArtifactPair = (report, summary, markdown, options) => {
2912
+ const jsonValue = options.redact ? redactMediaReport(report, options.redact) : report;
2913
+ return {
2914
+ json: JSON.stringify(jsonValue, null, 2),
2915
+ jsonValue,
2916
+ markdown,
2917
+ summary
2918
+ };
2919
+ };
2920
+ var buildMediaQualityArtifact = (report, options = {}) => buildArtifactPair(report, summarizeMediaQualityReport(report), renderMediaQualityMarkdown(report, options), options);
2921
+ var buildMediaTransportArtifact = (report, options = {}) => buildArtifactPair(report, summarizeMediaTransportReport(report), renderMediaTransportMarkdown(report, options), options);
2922
+ var buildMediaProcessorGraphArtifact = (report, options = {}) => buildArtifactPair(report, summarizeMediaProcessorGraphReport(report), renderMediaProcessorGraphMarkdown(report, options), options);
2923
+ var writeMediaArtifact = async (input) => {
2924
+ await mkdir(input.dir, { recursive: true });
2925
+ const jsonPath = join(input.dir, `${input.slug}.json`);
2926
+ const markdownPath = join(input.dir, `${input.slug}.md`);
2927
+ await Promise.all([
2928
+ writeFile(jsonPath, input.json, "utf8"),
2929
+ writeFile(markdownPath, input.markdown, "utf8")
2930
+ ]);
2931
+ return {
2932
+ jsonPath,
2933
+ markdownPath,
2934
+ summary: input.summary
2935
+ };
2936
+ };
2672
2937
 
2673
2938
  // src/client/browserMedia.ts
2674
2939
  var DEFAULT_BROWSER_MEDIA_PATH = "/api/voice/browser-media";
@@ -244,6 +244,329 @@ var serverMessageToAction = (message) => {
244
244
  }
245
245
  };
246
246
 
247
+ // node_modules/@absolutejs/media/dist/index.js
248
+ var {mkdir, writeFile} = (() => ({}));
249
+
250
+ // node:path
251
+ function assertPath(path) {
252
+ if (typeof path !== "string")
253
+ throw TypeError("Path must be a string. Received " + JSON.stringify(path));
254
+ }
255
+ function normalizeStringPosix(path, allowAboveRoot) {
256
+ var res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, code;
257
+ for (var i = 0;i <= path.length; ++i) {
258
+ if (i < path.length)
259
+ code = path.charCodeAt(i);
260
+ else if (code === 47)
261
+ break;
262
+ else
263
+ code = 47;
264
+ if (code === 47) {
265
+ if (lastSlash === i - 1 || dots === 1)
266
+ ;
267
+ else if (lastSlash !== i - 1 && dots === 2) {
268
+ if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 || res.charCodeAt(res.length - 2) !== 46) {
269
+ if (res.length > 2) {
270
+ var lastSlashIndex = res.lastIndexOf("/");
271
+ if (lastSlashIndex !== res.length - 1) {
272
+ if (lastSlashIndex === -1)
273
+ res = "", lastSegmentLength = 0;
274
+ else
275
+ res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
276
+ lastSlash = i, dots = 0;
277
+ continue;
278
+ }
279
+ } else if (res.length === 2 || res.length === 1) {
280
+ res = "", lastSegmentLength = 0, lastSlash = i, dots = 0;
281
+ continue;
282
+ }
283
+ }
284
+ if (allowAboveRoot) {
285
+ if (res.length > 0)
286
+ res += "/..";
287
+ else
288
+ res = "..";
289
+ lastSegmentLength = 2;
290
+ }
291
+ } else {
292
+ if (res.length > 0)
293
+ res += "/" + path.slice(lastSlash + 1, i);
294
+ else
295
+ res = path.slice(lastSlash + 1, i);
296
+ lastSegmentLength = i - lastSlash - 1;
297
+ }
298
+ lastSlash = i, dots = 0;
299
+ } else if (code === 46 && dots !== -1)
300
+ ++dots;
301
+ else
302
+ dots = -1;
303
+ }
304
+ return res;
305
+ }
306
+ function _format(sep, pathObject) {
307
+ var dir = pathObject.dir || pathObject.root, base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
308
+ if (!dir)
309
+ return base;
310
+ if (dir === pathObject.root)
311
+ return dir + base;
312
+ return dir + sep + base;
313
+ }
314
+ function resolve() {
315
+ var resolvedPath = "", resolvedAbsolute = false, cwd;
316
+ for (var i = arguments.length - 1;i >= -1 && !resolvedAbsolute; i--) {
317
+ var path;
318
+ if (i >= 0)
319
+ path = arguments[i];
320
+ else {
321
+ if (cwd === undefined)
322
+ cwd = process.cwd();
323
+ path = cwd;
324
+ }
325
+ if (assertPath(path), path.length === 0)
326
+ continue;
327
+ resolvedPath = path + "/" + resolvedPath, resolvedAbsolute = path.charCodeAt(0) === 47;
328
+ }
329
+ if (resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute), resolvedAbsolute)
330
+ if (resolvedPath.length > 0)
331
+ return "/" + resolvedPath;
332
+ else
333
+ return "/";
334
+ else if (resolvedPath.length > 0)
335
+ return resolvedPath;
336
+ else
337
+ return ".";
338
+ }
339
+ function normalize(path) {
340
+ if (assertPath(path), path.length === 0)
341
+ return ".";
342
+ var isAbsolute = path.charCodeAt(0) === 47, trailingSeparator = path.charCodeAt(path.length - 1) === 47;
343
+ if (path = normalizeStringPosix(path, !isAbsolute), path.length === 0 && !isAbsolute)
344
+ path = ".";
345
+ if (path.length > 0 && trailingSeparator)
346
+ path += "/";
347
+ if (isAbsolute)
348
+ return "/" + path;
349
+ return path;
350
+ }
351
+ function isAbsolute(path) {
352
+ return assertPath(path), path.length > 0 && path.charCodeAt(0) === 47;
353
+ }
354
+ function join() {
355
+ if (arguments.length === 0)
356
+ return ".";
357
+ var joined;
358
+ for (var i = 0;i < arguments.length; ++i) {
359
+ var arg = arguments[i];
360
+ if (assertPath(arg), arg.length > 0)
361
+ if (joined === undefined)
362
+ joined = arg;
363
+ else
364
+ joined += "/" + arg;
365
+ }
366
+ if (joined === undefined)
367
+ return ".";
368
+ return normalize(joined);
369
+ }
370
+ function relative(from, to) {
371
+ if (assertPath(from), assertPath(to), from === to)
372
+ return "";
373
+ if (from = resolve(from), to = resolve(to), from === to)
374
+ return "";
375
+ var fromStart = 1;
376
+ for (;fromStart < from.length; ++fromStart)
377
+ if (from.charCodeAt(fromStart) !== 47)
378
+ break;
379
+ var fromEnd = from.length, fromLen = fromEnd - fromStart, toStart = 1;
380
+ for (;toStart < to.length; ++toStart)
381
+ if (to.charCodeAt(toStart) !== 47)
382
+ break;
383
+ var toEnd = to.length, toLen = toEnd - toStart, length = fromLen < toLen ? fromLen : toLen, lastCommonSep = -1, i = 0;
384
+ for (;i <= length; ++i) {
385
+ if (i === length) {
386
+ if (toLen > length) {
387
+ if (to.charCodeAt(toStart + i) === 47)
388
+ return to.slice(toStart + i + 1);
389
+ else if (i === 0)
390
+ return to.slice(toStart + i);
391
+ } else if (fromLen > length) {
392
+ if (from.charCodeAt(fromStart + i) === 47)
393
+ lastCommonSep = i;
394
+ else if (i === 0)
395
+ lastCommonSep = 0;
396
+ }
397
+ break;
398
+ }
399
+ var fromCode = from.charCodeAt(fromStart + i), toCode = to.charCodeAt(toStart + i);
400
+ if (fromCode !== toCode)
401
+ break;
402
+ else if (fromCode === 47)
403
+ lastCommonSep = i;
404
+ }
405
+ var out = "";
406
+ for (i = fromStart + lastCommonSep + 1;i <= fromEnd; ++i)
407
+ if (i === fromEnd || from.charCodeAt(i) === 47)
408
+ if (out.length === 0)
409
+ out += "..";
410
+ else
411
+ out += "/..";
412
+ if (out.length > 0)
413
+ return out + to.slice(toStart + lastCommonSep);
414
+ else {
415
+ if (toStart += lastCommonSep, to.charCodeAt(toStart) === 47)
416
+ ++toStart;
417
+ return to.slice(toStart);
418
+ }
419
+ }
420
+ function _makeLong(path) {
421
+ return path;
422
+ }
423
+ function dirname(path) {
424
+ if (assertPath(path), path.length === 0)
425
+ return ".";
426
+ var code = path.charCodeAt(0), hasRoot = code === 47, end = -1, matchedSlash = true;
427
+ for (var i = path.length - 1;i >= 1; --i)
428
+ if (code = path.charCodeAt(i), code === 47) {
429
+ if (!matchedSlash) {
430
+ end = i;
431
+ break;
432
+ }
433
+ } else
434
+ matchedSlash = false;
435
+ if (end === -1)
436
+ return hasRoot ? "/" : ".";
437
+ if (hasRoot && end === 1)
438
+ return "//";
439
+ return path.slice(0, end);
440
+ }
441
+ function basename(path, ext) {
442
+ if (ext !== undefined && typeof ext !== "string")
443
+ throw TypeError('"ext" argument must be a string');
444
+ assertPath(path);
445
+ var start = 0, end = -1, matchedSlash = true, i;
446
+ if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
447
+ if (ext.length === path.length && ext === path)
448
+ return "";
449
+ var extIdx = ext.length - 1, firstNonSlashEnd = -1;
450
+ for (i = path.length - 1;i >= 0; --i) {
451
+ var code = path.charCodeAt(i);
452
+ if (code === 47) {
453
+ if (!matchedSlash) {
454
+ start = i + 1;
455
+ break;
456
+ }
457
+ } else {
458
+ if (firstNonSlashEnd === -1)
459
+ matchedSlash = false, firstNonSlashEnd = i + 1;
460
+ if (extIdx >= 0)
461
+ if (code === ext.charCodeAt(extIdx)) {
462
+ if (--extIdx === -1)
463
+ end = i;
464
+ } else
465
+ extIdx = -1, end = firstNonSlashEnd;
466
+ }
467
+ }
468
+ if (start === end)
469
+ end = firstNonSlashEnd;
470
+ else if (end === -1)
471
+ end = path.length;
472
+ return path.slice(start, end);
473
+ } else {
474
+ for (i = path.length - 1;i >= 0; --i)
475
+ if (path.charCodeAt(i) === 47) {
476
+ if (!matchedSlash) {
477
+ start = i + 1;
478
+ break;
479
+ }
480
+ } else if (end === -1)
481
+ matchedSlash = false, end = i + 1;
482
+ if (end === -1)
483
+ return "";
484
+ return path.slice(start, end);
485
+ }
486
+ }
487
+ function extname(path) {
488
+ assertPath(path);
489
+ var startDot = -1, startPart = 0, end = -1, matchedSlash = true, preDotState = 0;
490
+ for (var i = path.length - 1;i >= 0; --i) {
491
+ var code = path.charCodeAt(i);
492
+ if (code === 47) {
493
+ if (!matchedSlash) {
494
+ startPart = i + 1;
495
+ break;
496
+ }
497
+ continue;
498
+ }
499
+ if (end === -1)
500
+ matchedSlash = false, end = i + 1;
501
+ if (code === 46) {
502
+ if (startDot === -1)
503
+ startDot = i;
504
+ else if (preDotState !== 1)
505
+ preDotState = 1;
506
+ } else if (startDot !== -1)
507
+ preDotState = -1;
508
+ }
509
+ if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)
510
+ return "";
511
+ return path.slice(startDot, end);
512
+ }
513
+ function format(pathObject) {
514
+ if (pathObject === null || typeof pathObject !== "object")
515
+ throw TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
516
+ return _format("/", pathObject);
517
+ }
518
+ function parse(path) {
519
+ assertPath(path);
520
+ var ret = { root: "", dir: "", base: "", ext: "", name: "" };
521
+ if (path.length === 0)
522
+ return ret;
523
+ var code = path.charCodeAt(0), isAbsolute2 = code === 47, start;
524
+ if (isAbsolute2)
525
+ ret.root = "/", start = 1;
526
+ else
527
+ start = 0;
528
+ var startDot = -1, startPart = 0, end = -1, matchedSlash = true, i = path.length - 1, preDotState = 0;
529
+ for (;i >= start; --i) {
530
+ if (code = path.charCodeAt(i), code === 47) {
531
+ if (!matchedSlash) {
532
+ startPart = i + 1;
533
+ break;
534
+ }
535
+ continue;
536
+ }
537
+ if (end === -1)
538
+ matchedSlash = false, end = i + 1;
539
+ if (code === 46) {
540
+ if (startDot === -1)
541
+ startDot = i;
542
+ else if (preDotState !== 1)
543
+ preDotState = 1;
544
+ } else if (startDot !== -1)
545
+ preDotState = -1;
546
+ }
547
+ if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
548
+ if (end !== -1)
549
+ if (startPart === 0 && isAbsolute2)
550
+ ret.base = ret.name = path.slice(1, end);
551
+ else
552
+ ret.base = ret.name = path.slice(startPart, end);
553
+ } else {
554
+ if (startPart === 0 && isAbsolute2)
555
+ ret.name = path.slice(1, startDot), ret.base = path.slice(1, end);
556
+ else
557
+ ret.name = path.slice(startPart, startDot), ret.base = path.slice(startPart, end);
558
+ ret.ext = path.slice(startDot, end);
559
+ }
560
+ if (startPart > 0)
561
+ ret.dir = path.slice(0, startPart - 1);
562
+ else if (isAbsolute2)
563
+ ret.dir = "/";
564
+ return ret;
565
+ }
566
+ var sep = "/";
567
+ var delimiter = ":";
568
+ var posix = ((p) => (p.posix = p, p))({ resolve, normalize, isAbsolute, join, relative, _makeLong, dirname, basename, extname, format, parse, sep, delimiter, win32: null, posix: null });
569
+
247
570
  // node_modules/@absolutejs/media/dist/index.js
248
571
  var pushIssue = (issues, severity, code, message) => {
249
572
  issues.push({ code, message, severity });
@@ -1518,15 +1841,15 @@ var getAudioContextCtor = () => {
1518
1841
  return window.AudioContext ?? window.webkitAudioContext;
1519
1842
  };
1520
1843
  var decodePCM16LEChunk = (audioContext, chunk) => {
1521
- const format = chunk.format;
1522
- if (format.container !== "raw" || format.encoding !== "pcm_s16le") {
1523
- throw new Error(`Unsupported assistant audio format: ${format.container}/${format.encoding}`);
1844
+ const format2 = chunk.format;
1845
+ if (format2.container !== "raw" || format2.encoding !== "pcm_s16le") {
1846
+ throw new Error(`Unsupported assistant audio format: ${format2.container}/${format2.encoding}`);
1524
1847
  }
1525
1848
  const bytes = chunk.chunk;
1526
- const channels = Math.max(1, format.channels);
1849
+ const channels = Math.max(1, format2.channels);
1527
1850
  const sampleCount = Math.floor(bytes.byteLength / 2);
1528
1851
  const frameCount = Math.max(1, Math.floor(sampleCount / channels));
1529
- const audioBuffer = audioContext.createBuffer(channels, frameCount, format.sampleRateHz);
1852
+ const audioBuffer = audioContext.createBuffer(channels, frameCount, format2.sampleRateHz);
1530
1853
  const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
1531
1854
  for (let channelIndex = 0;channelIndex < channels; channelIndex += 1) {
1532
1855
  const channelData = audioBuffer.getChannelData(channelIndex);
@@ -1769,8 +2092,8 @@ var createVoiceAudioPlayer = (source, options = {}) => {
1769
2092
  return;
1770
2093
  }
1771
2094
  if (!interruptPromise) {
1772
- interruptPromise = new Promise((resolve) => {
1773
- resolveInterruptPromise = resolve;
2095
+ interruptPromise = new Promise((resolve2) => {
2096
+ resolveInterruptPromise = resolve2;
1774
2097
  });
1775
2098
  }
1776
2099
  clearInterruptTimer();