@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.
- package/dist/angular/index.js +265 -0
- package/dist/client/htmxBootstrap.js +330 -7
- package/dist/client/index.js +265 -0
- package/dist/generated/htmxBootstrapBundle.d.ts +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +591 -50
- package/dist/mediaPipelineRoutes.d.ts +55 -1
- package/dist/mediaPipelineSurfaces.d.ts +48 -0
- package/dist/react/index.js +265 -0
- package/dist/svelte/index.js +265 -0
- package/dist/testing/index.js +265 -0
- package/dist/vue/index.js +265 -0
- package/package.json +2 -2
package/dist/testing/index.js
CHANGED
|
@@ -2160,6 +2160,8 @@ var serverMessageToAction = (message) => {
|
|
|
2160
2160
|
};
|
|
2161
2161
|
|
|
2162
2162
|
// node_modules/@absolutejs/media/dist/index.js
|
|
2163
|
+
import { mkdir, writeFile } from "fs/promises";
|
|
2164
|
+
import { join } from "path";
|
|
2163
2165
|
var formatLabel = (format) => `${format.container}/${format.encoding}/${String(format.sampleRateHz)}hz/${String(format.channels)}ch`;
|
|
2164
2166
|
var formatMatches = (actual, expected) => actual.container === expected.container && actual.encoding === expected.encoding && actual.sampleRateHz === expected.sampleRateHz && actual.channels === expected.channels;
|
|
2165
2167
|
var pushIssue = (issues, severity, code, message) => {
|
|
@@ -2820,6 +2822,269 @@ var buildMediaPipelineCalibrationReport = (input = {}) => {
|
|
|
2820
2822
|
turnCommitFrames: turnCommitFrames.length
|
|
2821
2823
|
};
|
|
2822
2824
|
};
|
|
2825
|
+
var DEFAULT_METADATA_DENY = [
|
|
2826
|
+
"audioPayload",
|
|
2827
|
+
"auth",
|
|
2828
|
+
"authorization",
|
|
2829
|
+
"cookie",
|
|
2830
|
+
"email",
|
|
2831
|
+
"phone",
|
|
2832
|
+
"phoneNumber",
|
|
2833
|
+
"rawPayload",
|
|
2834
|
+
"secret",
|
|
2835
|
+
"token",
|
|
2836
|
+
"transcript",
|
|
2837
|
+
"utterance"
|
|
2838
|
+
];
|
|
2839
|
+
var DEFAULT_TRUNCATE = 8;
|
|
2840
|
+
var issueCodes = (issues) => Array.from(new Set(issues.map((issue) => issue.code)));
|
|
2841
|
+
var lastEventKind = (events) => events[events.length - 1]?.kind;
|
|
2842
|
+
var formatOptionalMs = (value) => value === undefined ? "n/a" : `${String(Math.round(value))}ms`;
|
|
2843
|
+
var formatRatio = (value) => `${(value * 100).toFixed(1)}%`;
|
|
2844
|
+
var escapeMarkdownCell = (value) => value.replace(/\|/g, "\\|").replace(/\n/g, " ");
|
|
2845
|
+
var renderIssuesTable = (issues) => {
|
|
2846
|
+
if (issues.length === 0) {
|
|
2847
|
+
return `- No issues.
|
|
2848
|
+
`;
|
|
2849
|
+
}
|
|
2850
|
+
const rows = issues.map((issue) => `| ${issue.severity} | ${escapeMarkdownCell(issue.code)} | ${escapeMarkdownCell(issue.message)} |`).join(`
|
|
2851
|
+
`);
|
|
2852
|
+
return `| Severity | Code | Message |
|
|
2853
|
+
| --- | --- | --- |
|
|
2854
|
+
${rows}
|
|
2855
|
+
`;
|
|
2856
|
+
};
|
|
2857
|
+
var summarizeMediaQualityReport = (report) => ({
|
|
2858
|
+
backpressureEvents: report.backpressureEvents,
|
|
2859
|
+
description: `${report.totalFrames} frame(s), ${report.gapCount} gap(s), speech ${formatRatio(report.speechRatio)}, status ${report.status}.`,
|
|
2860
|
+
driftMs: report.timestampDriftMs,
|
|
2861
|
+
frameCount: report.totalFrames,
|
|
2862
|
+
gapCount: report.gapCount,
|
|
2863
|
+
issueCodes: issueCodes(report.issues),
|
|
2864
|
+
issueCount: report.issues.length,
|
|
2865
|
+
jitterMs: report.jitterMs,
|
|
2866
|
+
silenceRatio: report.silenceRatio,
|
|
2867
|
+
speechRatio: report.speechRatio,
|
|
2868
|
+
status: report.status
|
|
2869
|
+
});
|
|
2870
|
+
var summarizeMediaTransportReport = (report) => ({
|
|
2871
|
+
backpressureEvents: report.backpressureEvents,
|
|
2872
|
+
description: `${report.name}: ${report.state}, in ${report.inputFrames}, out ${report.outputFrames}, backpressure ${report.backpressureEvents}.`,
|
|
2873
|
+
errors: report.events.filter((event) => event.kind === "error").length,
|
|
2874
|
+
inputFrames: report.inputFrames,
|
|
2875
|
+
lastEventKind: lastEventKind(report.events),
|
|
2876
|
+
name: report.name,
|
|
2877
|
+
outputFrames: report.outputFrames,
|
|
2878
|
+
state: report.state,
|
|
2879
|
+
status: report.status
|
|
2880
|
+
});
|
|
2881
|
+
var summarizeMediaProcessorGraphReport = (report) => {
|
|
2882
|
+
const errorIssueCodes = Array.from(new Set(report.errors.map((event) => event.kind)));
|
|
2883
|
+
return {
|
|
2884
|
+
backpressureEvents: report.backpressure.events.length,
|
|
2885
|
+
description: `${report.name}: ${report.state}, ${report.nodes.length} node(s), in ${report.inputFrames}, out ${report.emittedFrames}, dropped ${report.droppedFrames}.`,
|
|
2886
|
+
droppedFrames: report.droppedFrames,
|
|
2887
|
+
edgeCount: report.edges.length,
|
|
2888
|
+
edgeEventCount: report.edgeEvents.length,
|
|
2889
|
+
emittedFrames: report.emittedFrames,
|
|
2890
|
+
errorCount: report.errors.length,
|
|
2891
|
+
inputFrames: report.inputFrames,
|
|
2892
|
+
issueCodes: errorIssueCodes,
|
|
2893
|
+
lifecycleEventCount: report.lifecycleEvents.length,
|
|
2894
|
+
name: report.name,
|
|
2895
|
+
nodeCount: report.nodes.length,
|
|
2896
|
+
state: report.state,
|
|
2897
|
+
status: report.status,
|
|
2898
|
+
timingMaxMs: report.timing.maxNodeMs
|
|
2899
|
+
};
|
|
2900
|
+
};
|
|
2901
|
+
var renderMediaQualityMarkdown = (report, options = {}) => {
|
|
2902
|
+
const title = options.title ?? "Media Quality Report";
|
|
2903
|
+
const lines = [
|
|
2904
|
+
`# ${title}`,
|
|
2905
|
+
"",
|
|
2906
|
+
`Status: **${report.status}**`,
|
|
2907
|
+
"",
|
|
2908
|
+
"| Metric | Value |",
|
|
2909
|
+
"| --- | ---: |",
|
|
2910
|
+
`| Total frames | ${report.totalFrames} |`,
|
|
2911
|
+
`| Input audio | ${report.inputAudioFrames} |`,
|
|
2912
|
+
`| Assistant audio | ${report.assistantAudioFrames} |`,
|
|
2913
|
+
`| Gaps | ${report.gapCount} |`,
|
|
2914
|
+
`| Jitter | ${formatOptionalMs(report.jitterMs)} |`,
|
|
2915
|
+
`| Timestamp drift | ${formatOptionalMs(report.timestampDriftMs)} |`,
|
|
2916
|
+
`| Speech ratio | ${formatRatio(report.speechRatio)} |`,
|
|
2917
|
+
`| Silence ratio | ${formatRatio(report.silenceRatio)} |`,
|
|
2918
|
+
`| Backpressure events | ${report.backpressureEvents} |`,
|
|
2919
|
+
"",
|
|
2920
|
+
"## Issues",
|
|
2921
|
+
"",
|
|
2922
|
+
renderIssuesTable(report.issues).trimEnd()
|
|
2923
|
+
];
|
|
2924
|
+
return `${lines.join(`
|
|
2925
|
+
`)}
|
|
2926
|
+
`;
|
|
2927
|
+
};
|
|
2928
|
+
var renderMediaTransportMarkdown = (report, options = {}) => {
|
|
2929
|
+
const title = options.title ?? `Media Transport: ${report.name}`;
|
|
2930
|
+
const limit = options.redact?.truncateArraysAt ?? DEFAULT_TRUNCATE;
|
|
2931
|
+
const events = report.events.slice(-limit);
|
|
2932
|
+
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(`
|
|
2933
|
+
`);
|
|
2934
|
+
const lines = [
|
|
2935
|
+
`# ${title}`,
|
|
2936
|
+
"",
|
|
2937
|
+
`Status: **${report.status}** \xB7 State: **${report.state}**`,
|
|
2938
|
+
"",
|
|
2939
|
+
"| Metric | Value |",
|
|
2940
|
+
"| --- | ---: |",
|
|
2941
|
+
`| Input frames | ${report.inputFrames} |`,
|
|
2942
|
+
`| Output frames | ${report.outputFrames} |`,
|
|
2943
|
+
`| Backpressure events | ${report.backpressureEvents} |`,
|
|
2944
|
+
`| Connected | ${report.connected ? "yes" : "no"} |`,
|
|
2945
|
+
`| Closed | ${report.closed ? "yes" : "no"} |`,
|
|
2946
|
+
`| Failed | ${report.failed ? "yes" : "no"} |`,
|
|
2947
|
+
"",
|
|
2948
|
+
`## Last ${events.length} event(s)`,
|
|
2949
|
+
"",
|
|
2950
|
+
eventRows
|
|
2951
|
+
];
|
|
2952
|
+
return `${lines.join(`
|
|
2953
|
+
`)}
|
|
2954
|
+
`;
|
|
2955
|
+
};
|
|
2956
|
+
var renderMediaProcessorGraphMarkdown = (report, options = {}) => {
|
|
2957
|
+
const title = options.title ?? `Media Processor Graph: ${report.name}`;
|
|
2958
|
+
const limit = options.redact?.truncateArraysAt ?? DEFAULT_TRUNCATE;
|
|
2959
|
+
const nodeRows = report.nodes.map((node) => `| ${escapeMarkdownCell(node.name)} | ${node.kind} | ${node.status} | ${node.inputFrames} | ${node.emittedFrames} | ${node.droppedFrames} | ${node.errors.length} |`).join(`
|
|
2960
|
+
`);
|
|
2961
|
+
const edgeRows = report.edges.slice(0, limit).map((edge) => `| ${escapeMarkdownCell(edge.from)} | ${escapeMarkdownCell(edge.to)} | ${edge.status} | ${edge.emittedFrames} |`).join(`
|
|
2962
|
+
`);
|
|
2963
|
+
const issues = report.errors.map((event) => ({
|
|
2964
|
+
code: event.kind,
|
|
2965
|
+
message: event.error ?? `Processor graph ${event.kind} (state ${event.state}).`,
|
|
2966
|
+
severity: "error"
|
|
2967
|
+
}));
|
|
2968
|
+
const lines = [
|
|
2969
|
+
`# ${title}`,
|
|
2970
|
+
"",
|
|
2971
|
+
`Status: **${report.status}** \xB7 State: **${report.state}**`,
|
|
2972
|
+
"",
|
|
2973
|
+
"| Metric | Value |",
|
|
2974
|
+
"| --- | ---: |",
|
|
2975
|
+
`| Nodes | ${report.nodes.length} |`,
|
|
2976
|
+
`| Input frames | ${report.inputFrames} |`,
|
|
2977
|
+
`| Emitted frames | ${report.emittedFrames} |`,
|
|
2978
|
+
`| Dropped frames | ${report.droppedFrames} |`,
|
|
2979
|
+
`| Lifecycle events | ${report.lifecycleEvents.length} |`,
|
|
2980
|
+
`| Edge events | ${report.edgeEvents.length} |`,
|
|
2981
|
+
`| Backpressure events | ${report.backpressure.events.length} |`,
|
|
2982
|
+
`| Timing max | ${formatOptionalMs(report.timing.maxNodeMs)} |`,
|
|
2983
|
+
`| Timing average | ${formatOptionalMs(report.timing.averageNodeMs)} |`,
|
|
2984
|
+
"",
|
|
2985
|
+
"## Nodes",
|
|
2986
|
+
"",
|
|
2987
|
+
nodeRows ? `| Node | Kind | Status | In | Out | Dropped | Errors |
|
|
2988
|
+
| --- | --- | --- | ---: | ---: | ---: | ---: |
|
|
2989
|
+
${nodeRows}` : "- No nodes.",
|
|
2990
|
+
"",
|
|
2991
|
+
`## Edges (showing up to ${limit})`,
|
|
2992
|
+
"",
|
|
2993
|
+
edgeRows ? `| From | To | Status | Frames |
|
|
2994
|
+
| --- | --- | --- | ---: |
|
|
2995
|
+
${edgeRows}` : "- No edges.",
|
|
2996
|
+
"",
|
|
2997
|
+
"## Errors",
|
|
2998
|
+
"",
|
|
2999
|
+
renderIssuesTable(issues).trimEnd()
|
|
3000
|
+
];
|
|
3001
|
+
return `${lines.join(`
|
|
3002
|
+
`)}
|
|
3003
|
+
`;
|
|
3004
|
+
};
|
|
3005
|
+
var truncateArrays = (value, limit, seen) => {
|
|
3006
|
+
if (Array.isArray(value)) {
|
|
3007
|
+
const head = value.slice(0, limit).map((entry) => truncateArrays(entry, limit, seen));
|
|
3008
|
+
if (value.length > limit) {
|
|
3009
|
+
return [...head, { truncated: value.length - limit }];
|
|
3010
|
+
}
|
|
3011
|
+
return head;
|
|
3012
|
+
}
|
|
3013
|
+
if (value && typeof value === "object") {
|
|
3014
|
+
if (seen.has(value))
|
|
3015
|
+
return value;
|
|
3016
|
+
seen.add(value);
|
|
3017
|
+
const next = {};
|
|
3018
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
3019
|
+
next[key] = truncateArrays(entry, limit, seen);
|
|
3020
|
+
}
|
|
3021
|
+
return next;
|
|
3022
|
+
}
|
|
3023
|
+
return value;
|
|
3024
|
+
};
|
|
3025
|
+
var applyRedaction = (value, options, seen) => {
|
|
3026
|
+
const mode = options.mode ?? "omit";
|
|
3027
|
+
const maskValue = options.maskValue ?? "[redacted]";
|
|
3028
|
+
const allow = new Set(options.metadataAllow ?? []);
|
|
3029
|
+
const deny = new Set(options.metadataDeny ?? DEFAULT_METADATA_DENY);
|
|
3030
|
+
const walk = (input) => {
|
|
3031
|
+
if (Array.isArray(input)) {
|
|
3032
|
+
return input.map((entry) => walk(entry));
|
|
3033
|
+
}
|
|
3034
|
+
if (input && typeof input === "object") {
|
|
3035
|
+
if (seen.has(input))
|
|
3036
|
+
return input;
|
|
3037
|
+
seen.add(input);
|
|
3038
|
+
const next = {};
|
|
3039
|
+
for (const [key, entry] of Object.entries(input)) {
|
|
3040
|
+
if (allow.has(key)) {
|
|
3041
|
+
next[key] = entry;
|
|
3042
|
+
continue;
|
|
3043
|
+
}
|
|
3044
|
+
if (deny.has(key)) {
|
|
3045
|
+
if (mode === "mask")
|
|
3046
|
+
next[key] = maskValue;
|
|
3047
|
+
continue;
|
|
3048
|
+
}
|
|
3049
|
+
next[key] = walk(entry);
|
|
3050
|
+
}
|
|
3051
|
+
return next;
|
|
3052
|
+
}
|
|
3053
|
+
return input;
|
|
3054
|
+
};
|
|
3055
|
+
return walk(value);
|
|
3056
|
+
};
|
|
3057
|
+
var redactMediaReport = (report, options = {}) => {
|
|
3058
|
+
const limit = options.truncateArraysAt ?? DEFAULT_TRUNCATE;
|
|
3059
|
+
const truncated = truncateArrays(report, limit, new WeakSet);
|
|
3060
|
+
return applyRedaction(truncated, options, new WeakSet);
|
|
3061
|
+
};
|
|
3062
|
+
var buildArtifactPair = (report, summary, markdown, options) => {
|
|
3063
|
+
const jsonValue = options.redact ? redactMediaReport(report, options.redact) : report;
|
|
3064
|
+
return {
|
|
3065
|
+
json: JSON.stringify(jsonValue, null, 2),
|
|
3066
|
+
jsonValue,
|
|
3067
|
+
markdown,
|
|
3068
|
+
summary
|
|
3069
|
+
};
|
|
3070
|
+
};
|
|
3071
|
+
var buildMediaQualityArtifact = (report, options = {}) => buildArtifactPair(report, summarizeMediaQualityReport(report), renderMediaQualityMarkdown(report, options), options);
|
|
3072
|
+
var buildMediaTransportArtifact = (report, options = {}) => buildArtifactPair(report, summarizeMediaTransportReport(report), renderMediaTransportMarkdown(report, options), options);
|
|
3073
|
+
var buildMediaProcessorGraphArtifact = (report, options = {}) => buildArtifactPair(report, summarizeMediaProcessorGraphReport(report), renderMediaProcessorGraphMarkdown(report, options), options);
|
|
3074
|
+
var writeMediaArtifact = async (input) => {
|
|
3075
|
+
await mkdir(input.dir, { recursive: true });
|
|
3076
|
+
const jsonPath = join(input.dir, `${input.slug}.json`);
|
|
3077
|
+
const markdownPath = join(input.dir, `${input.slug}.md`);
|
|
3078
|
+
await Promise.all([
|
|
3079
|
+
writeFile(jsonPath, input.json, "utf8"),
|
|
3080
|
+
writeFile(markdownPath, input.markdown, "utf8")
|
|
3081
|
+
]);
|
|
3082
|
+
return {
|
|
3083
|
+
jsonPath,
|
|
3084
|
+
markdownPath,
|
|
3085
|
+
summary: input.summary
|
|
3086
|
+
};
|
|
3087
|
+
};
|
|
2823
3088
|
|
|
2824
3089
|
// src/client/browserMedia.ts
|
|
2825
3090
|
var DEFAULT_BROWSER_MEDIA_PATH = "/api/voice/browser-media";
|
package/dist/vue/index.js
CHANGED
|
@@ -10470,6 +10470,8 @@ var serverMessageToAction = (message) => {
|
|
|
10470
10470
|
};
|
|
10471
10471
|
|
|
10472
10472
|
// node_modules/@absolutejs/media/dist/index.js
|
|
10473
|
+
import { mkdir, writeFile } from "fs/promises";
|
|
10474
|
+
import { join } from "path";
|
|
10473
10475
|
var formatLabel = (format) => `${format.container}/${format.encoding}/${String(format.sampleRateHz)}hz/${String(format.channels)}ch`;
|
|
10474
10476
|
var formatMatches = (actual, expected) => actual.container === expected.container && actual.encoding === expected.encoding && actual.sampleRateHz === expected.sampleRateHz && actual.channels === expected.channels;
|
|
10475
10477
|
var pushIssue = (issues, severity, code, message) => {
|
|
@@ -11130,6 +11132,269 @@ var buildMediaPipelineCalibrationReport = (input = {}) => {
|
|
|
11130
11132
|
turnCommitFrames: turnCommitFrames.length
|
|
11131
11133
|
};
|
|
11132
11134
|
};
|
|
11135
|
+
var DEFAULT_METADATA_DENY = [
|
|
11136
|
+
"audioPayload",
|
|
11137
|
+
"auth",
|
|
11138
|
+
"authorization",
|
|
11139
|
+
"cookie",
|
|
11140
|
+
"email",
|
|
11141
|
+
"phone",
|
|
11142
|
+
"phoneNumber",
|
|
11143
|
+
"rawPayload",
|
|
11144
|
+
"secret",
|
|
11145
|
+
"token",
|
|
11146
|
+
"transcript",
|
|
11147
|
+
"utterance"
|
|
11148
|
+
];
|
|
11149
|
+
var DEFAULT_TRUNCATE = 8;
|
|
11150
|
+
var issueCodes = (issues) => Array.from(new Set(issues.map((issue) => issue.code)));
|
|
11151
|
+
var lastEventKind = (events) => events[events.length - 1]?.kind;
|
|
11152
|
+
var formatOptionalMs = (value) => value === undefined ? "n/a" : `${String(Math.round(value))}ms`;
|
|
11153
|
+
var formatRatio = (value) => `${(value * 100).toFixed(1)}%`;
|
|
11154
|
+
var escapeMarkdownCell = (value) => value.replace(/\|/g, "\\|").replace(/\n/g, " ");
|
|
11155
|
+
var renderIssuesTable = (issues) => {
|
|
11156
|
+
if (issues.length === 0) {
|
|
11157
|
+
return `- No issues.
|
|
11158
|
+
`;
|
|
11159
|
+
}
|
|
11160
|
+
const rows = issues.map((issue) => `| ${issue.severity} | ${escapeMarkdownCell(issue.code)} | ${escapeMarkdownCell(issue.message)} |`).join(`
|
|
11161
|
+
`);
|
|
11162
|
+
return `| Severity | Code | Message |
|
|
11163
|
+
| --- | --- | --- |
|
|
11164
|
+
${rows}
|
|
11165
|
+
`;
|
|
11166
|
+
};
|
|
11167
|
+
var summarizeMediaQualityReport = (report) => ({
|
|
11168
|
+
backpressureEvents: report.backpressureEvents,
|
|
11169
|
+
description: `${report.totalFrames} frame(s), ${report.gapCount} gap(s), speech ${formatRatio(report.speechRatio)}, status ${report.status}.`,
|
|
11170
|
+
driftMs: report.timestampDriftMs,
|
|
11171
|
+
frameCount: report.totalFrames,
|
|
11172
|
+
gapCount: report.gapCount,
|
|
11173
|
+
issueCodes: issueCodes(report.issues),
|
|
11174
|
+
issueCount: report.issues.length,
|
|
11175
|
+
jitterMs: report.jitterMs,
|
|
11176
|
+
silenceRatio: report.silenceRatio,
|
|
11177
|
+
speechRatio: report.speechRatio,
|
|
11178
|
+
status: report.status
|
|
11179
|
+
});
|
|
11180
|
+
var summarizeMediaTransportReport = (report) => ({
|
|
11181
|
+
backpressureEvents: report.backpressureEvents,
|
|
11182
|
+
description: `${report.name}: ${report.state}, in ${report.inputFrames}, out ${report.outputFrames}, backpressure ${report.backpressureEvents}.`,
|
|
11183
|
+
errors: report.events.filter((event) => event.kind === "error").length,
|
|
11184
|
+
inputFrames: report.inputFrames,
|
|
11185
|
+
lastEventKind: lastEventKind(report.events),
|
|
11186
|
+
name: report.name,
|
|
11187
|
+
outputFrames: report.outputFrames,
|
|
11188
|
+
state: report.state,
|
|
11189
|
+
status: report.status
|
|
11190
|
+
});
|
|
11191
|
+
var summarizeMediaProcessorGraphReport = (report) => {
|
|
11192
|
+
const errorIssueCodes = Array.from(new Set(report.errors.map((event) => event.kind)));
|
|
11193
|
+
return {
|
|
11194
|
+
backpressureEvents: report.backpressure.events.length,
|
|
11195
|
+
description: `${report.name}: ${report.state}, ${report.nodes.length} node(s), in ${report.inputFrames}, out ${report.emittedFrames}, dropped ${report.droppedFrames}.`,
|
|
11196
|
+
droppedFrames: report.droppedFrames,
|
|
11197
|
+
edgeCount: report.edges.length,
|
|
11198
|
+
edgeEventCount: report.edgeEvents.length,
|
|
11199
|
+
emittedFrames: report.emittedFrames,
|
|
11200
|
+
errorCount: report.errors.length,
|
|
11201
|
+
inputFrames: report.inputFrames,
|
|
11202
|
+
issueCodes: errorIssueCodes,
|
|
11203
|
+
lifecycleEventCount: report.lifecycleEvents.length,
|
|
11204
|
+
name: report.name,
|
|
11205
|
+
nodeCount: report.nodes.length,
|
|
11206
|
+
state: report.state,
|
|
11207
|
+
status: report.status,
|
|
11208
|
+
timingMaxMs: report.timing.maxNodeMs
|
|
11209
|
+
};
|
|
11210
|
+
};
|
|
11211
|
+
var renderMediaQualityMarkdown = (report, options = {}) => {
|
|
11212
|
+
const title = options.title ?? "Media Quality Report";
|
|
11213
|
+
const lines = [
|
|
11214
|
+
`# ${title}`,
|
|
11215
|
+
"",
|
|
11216
|
+
`Status: **${report.status}**`,
|
|
11217
|
+
"",
|
|
11218
|
+
"| Metric | Value |",
|
|
11219
|
+
"| --- | ---: |",
|
|
11220
|
+
`| Total frames | ${report.totalFrames} |`,
|
|
11221
|
+
`| Input audio | ${report.inputAudioFrames} |`,
|
|
11222
|
+
`| Assistant audio | ${report.assistantAudioFrames} |`,
|
|
11223
|
+
`| Gaps | ${report.gapCount} |`,
|
|
11224
|
+
`| Jitter | ${formatOptionalMs(report.jitterMs)} |`,
|
|
11225
|
+
`| Timestamp drift | ${formatOptionalMs(report.timestampDriftMs)} |`,
|
|
11226
|
+
`| Speech ratio | ${formatRatio(report.speechRatio)} |`,
|
|
11227
|
+
`| Silence ratio | ${formatRatio(report.silenceRatio)} |`,
|
|
11228
|
+
`| Backpressure events | ${report.backpressureEvents} |`,
|
|
11229
|
+
"",
|
|
11230
|
+
"## Issues",
|
|
11231
|
+
"",
|
|
11232
|
+
renderIssuesTable(report.issues).trimEnd()
|
|
11233
|
+
];
|
|
11234
|
+
return `${lines.join(`
|
|
11235
|
+
`)}
|
|
11236
|
+
`;
|
|
11237
|
+
};
|
|
11238
|
+
var renderMediaTransportMarkdown = (report, options = {}) => {
|
|
11239
|
+
const title = options.title ?? `Media Transport: ${report.name}`;
|
|
11240
|
+
const limit = options.redact?.truncateArraysAt ?? DEFAULT_TRUNCATE;
|
|
11241
|
+
const events = report.events.slice(-limit);
|
|
11242
|
+
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(`
|
|
11243
|
+
`);
|
|
11244
|
+
const lines = [
|
|
11245
|
+
`# ${title}`,
|
|
11246
|
+
"",
|
|
11247
|
+
`Status: **${report.status}** \xB7 State: **${report.state}**`,
|
|
11248
|
+
"",
|
|
11249
|
+
"| Metric | Value |",
|
|
11250
|
+
"| --- | ---: |",
|
|
11251
|
+
`| Input frames | ${report.inputFrames} |`,
|
|
11252
|
+
`| Output frames | ${report.outputFrames} |`,
|
|
11253
|
+
`| Backpressure events | ${report.backpressureEvents} |`,
|
|
11254
|
+
`| Connected | ${report.connected ? "yes" : "no"} |`,
|
|
11255
|
+
`| Closed | ${report.closed ? "yes" : "no"} |`,
|
|
11256
|
+
`| Failed | ${report.failed ? "yes" : "no"} |`,
|
|
11257
|
+
"",
|
|
11258
|
+
`## Last ${events.length} event(s)`,
|
|
11259
|
+
"",
|
|
11260
|
+
eventRows
|
|
11261
|
+
];
|
|
11262
|
+
return `${lines.join(`
|
|
11263
|
+
`)}
|
|
11264
|
+
`;
|
|
11265
|
+
};
|
|
11266
|
+
var renderMediaProcessorGraphMarkdown = (report, options = {}) => {
|
|
11267
|
+
const title = options.title ?? `Media Processor Graph: ${report.name}`;
|
|
11268
|
+
const limit = options.redact?.truncateArraysAt ?? DEFAULT_TRUNCATE;
|
|
11269
|
+
const nodeRows = report.nodes.map((node) => `| ${escapeMarkdownCell(node.name)} | ${node.kind} | ${node.status} | ${node.inputFrames} | ${node.emittedFrames} | ${node.droppedFrames} | ${node.errors.length} |`).join(`
|
|
11270
|
+
`);
|
|
11271
|
+
const edgeRows = report.edges.slice(0, limit).map((edge) => `| ${escapeMarkdownCell(edge.from)} | ${escapeMarkdownCell(edge.to)} | ${edge.status} | ${edge.emittedFrames} |`).join(`
|
|
11272
|
+
`);
|
|
11273
|
+
const issues = report.errors.map((event) => ({
|
|
11274
|
+
code: event.kind,
|
|
11275
|
+
message: event.error ?? `Processor graph ${event.kind} (state ${event.state}).`,
|
|
11276
|
+
severity: "error"
|
|
11277
|
+
}));
|
|
11278
|
+
const lines = [
|
|
11279
|
+
`# ${title}`,
|
|
11280
|
+
"",
|
|
11281
|
+
`Status: **${report.status}** \xB7 State: **${report.state}**`,
|
|
11282
|
+
"",
|
|
11283
|
+
"| Metric | Value |",
|
|
11284
|
+
"| --- | ---: |",
|
|
11285
|
+
`| Nodes | ${report.nodes.length} |`,
|
|
11286
|
+
`| Input frames | ${report.inputFrames} |`,
|
|
11287
|
+
`| Emitted frames | ${report.emittedFrames} |`,
|
|
11288
|
+
`| Dropped frames | ${report.droppedFrames} |`,
|
|
11289
|
+
`| Lifecycle events | ${report.lifecycleEvents.length} |`,
|
|
11290
|
+
`| Edge events | ${report.edgeEvents.length} |`,
|
|
11291
|
+
`| Backpressure events | ${report.backpressure.events.length} |`,
|
|
11292
|
+
`| Timing max | ${formatOptionalMs(report.timing.maxNodeMs)} |`,
|
|
11293
|
+
`| Timing average | ${formatOptionalMs(report.timing.averageNodeMs)} |`,
|
|
11294
|
+
"",
|
|
11295
|
+
"## Nodes",
|
|
11296
|
+
"",
|
|
11297
|
+
nodeRows ? `| Node | Kind | Status | In | Out | Dropped | Errors |
|
|
11298
|
+
| --- | --- | --- | ---: | ---: | ---: | ---: |
|
|
11299
|
+
${nodeRows}` : "- No nodes.",
|
|
11300
|
+
"",
|
|
11301
|
+
`## Edges (showing up to ${limit})`,
|
|
11302
|
+
"",
|
|
11303
|
+
edgeRows ? `| From | To | Status | Frames |
|
|
11304
|
+
| --- | --- | --- | ---: |
|
|
11305
|
+
${edgeRows}` : "- No edges.",
|
|
11306
|
+
"",
|
|
11307
|
+
"## Errors",
|
|
11308
|
+
"",
|
|
11309
|
+
renderIssuesTable(issues).trimEnd()
|
|
11310
|
+
];
|
|
11311
|
+
return `${lines.join(`
|
|
11312
|
+
`)}
|
|
11313
|
+
`;
|
|
11314
|
+
};
|
|
11315
|
+
var truncateArrays = (value, limit, seen) => {
|
|
11316
|
+
if (Array.isArray(value)) {
|
|
11317
|
+
const head = value.slice(0, limit).map((entry) => truncateArrays(entry, limit, seen));
|
|
11318
|
+
if (value.length > limit) {
|
|
11319
|
+
return [...head, { truncated: value.length - limit }];
|
|
11320
|
+
}
|
|
11321
|
+
return head;
|
|
11322
|
+
}
|
|
11323
|
+
if (value && typeof value === "object") {
|
|
11324
|
+
if (seen.has(value))
|
|
11325
|
+
return value;
|
|
11326
|
+
seen.add(value);
|
|
11327
|
+
const next = {};
|
|
11328
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
11329
|
+
next[key] = truncateArrays(entry, limit, seen);
|
|
11330
|
+
}
|
|
11331
|
+
return next;
|
|
11332
|
+
}
|
|
11333
|
+
return value;
|
|
11334
|
+
};
|
|
11335
|
+
var applyRedaction = (value, options, seen) => {
|
|
11336
|
+
const mode = options.mode ?? "omit";
|
|
11337
|
+
const maskValue = options.maskValue ?? "[redacted]";
|
|
11338
|
+
const allow = new Set(options.metadataAllow ?? []);
|
|
11339
|
+
const deny = new Set(options.metadataDeny ?? DEFAULT_METADATA_DENY);
|
|
11340
|
+
const walk = (input) => {
|
|
11341
|
+
if (Array.isArray(input)) {
|
|
11342
|
+
return input.map((entry) => walk(entry));
|
|
11343
|
+
}
|
|
11344
|
+
if (input && typeof input === "object") {
|
|
11345
|
+
if (seen.has(input))
|
|
11346
|
+
return input;
|
|
11347
|
+
seen.add(input);
|
|
11348
|
+
const next = {};
|
|
11349
|
+
for (const [key, entry] of Object.entries(input)) {
|
|
11350
|
+
if (allow.has(key)) {
|
|
11351
|
+
next[key] = entry;
|
|
11352
|
+
continue;
|
|
11353
|
+
}
|
|
11354
|
+
if (deny.has(key)) {
|
|
11355
|
+
if (mode === "mask")
|
|
11356
|
+
next[key] = maskValue;
|
|
11357
|
+
continue;
|
|
11358
|
+
}
|
|
11359
|
+
next[key] = walk(entry);
|
|
11360
|
+
}
|
|
11361
|
+
return next;
|
|
11362
|
+
}
|
|
11363
|
+
return input;
|
|
11364
|
+
};
|
|
11365
|
+
return walk(value);
|
|
11366
|
+
};
|
|
11367
|
+
var redactMediaReport = (report, options = {}) => {
|
|
11368
|
+
const limit = options.truncateArraysAt ?? DEFAULT_TRUNCATE;
|
|
11369
|
+
const truncated = truncateArrays(report, limit, new WeakSet);
|
|
11370
|
+
return applyRedaction(truncated, options, new WeakSet);
|
|
11371
|
+
};
|
|
11372
|
+
var buildArtifactPair = (report, summary, markdown, options) => {
|
|
11373
|
+
const jsonValue = options.redact ? redactMediaReport(report, options.redact) : report;
|
|
11374
|
+
return {
|
|
11375
|
+
json: JSON.stringify(jsonValue, null, 2),
|
|
11376
|
+
jsonValue,
|
|
11377
|
+
markdown,
|
|
11378
|
+
summary
|
|
11379
|
+
};
|
|
11380
|
+
};
|
|
11381
|
+
var buildMediaQualityArtifact = (report, options = {}) => buildArtifactPair(report, summarizeMediaQualityReport(report), renderMediaQualityMarkdown(report, options), options);
|
|
11382
|
+
var buildMediaTransportArtifact = (report, options = {}) => buildArtifactPair(report, summarizeMediaTransportReport(report), renderMediaTransportMarkdown(report, options), options);
|
|
11383
|
+
var buildMediaProcessorGraphArtifact = (report, options = {}) => buildArtifactPair(report, summarizeMediaProcessorGraphReport(report), renderMediaProcessorGraphMarkdown(report, options), options);
|
|
11384
|
+
var writeMediaArtifact = async (input) => {
|
|
11385
|
+
await mkdir(input.dir, { recursive: true });
|
|
11386
|
+
const jsonPath = join(input.dir, `${input.slug}.json`);
|
|
11387
|
+
const markdownPath = join(input.dir, `${input.slug}.md`);
|
|
11388
|
+
await Promise.all([
|
|
11389
|
+
writeFile(jsonPath, input.json, "utf8"),
|
|
11390
|
+
writeFile(markdownPath, input.markdown, "utf8")
|
|
11391
|
+
]);
|
|
11392
|
+
return {
|
|
11393
|
+
jsonPath,
|
|
11394
|
+
markdownPath,
|
|
11395
|
+
summary: input.summary
|
|
11396
|
+
};
|
|
11397
|
+
};
|
|
11133
11398
|
|
|
11134
11399
|
// src/client/browserMedia.ts
|
|
11135
11400
|
var DEFAULT_BROWSER_MEDIA_PATH = "/api/voice/browser-media";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absolutejs/voice",
|
|
3
|
-
"version": "0.0.22-beta.
|
|
3
|
+
"version": "0.0.22-beta.464",
|
|
4
4
|
"description": "Voice primitives and Elysia plugin for AbsoluteJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
}
|
|
247
247
|
},
|
|
248
248
|
"dependencies": {
|
|
249
|
-
"@absolutejs/media": "0.0.1-beta.
|
|
249
|
+
"@absolutejs/media": "0.0.1-beta.15"
|
|
250
250
|
},
|
|
251
251
|
"devDependencies": {
|
|
252
252
|
"@absolutejs/absolute": "0.19.0-beta.646",
|