@absolutejs/voice 0.0.22-beta.381 → 0.0.22-beta.383

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.
@@ -4668,7 +4668,7 @@ var buildRealCallProfileReadinessIssues = (report, options) => {
4668
4668
  var uniqueRealCallProfileActions = (actions) => {
4669
4669
  const seen = new Set;
4670
4670
  return actions.filter((action) => {
4671
- const key = `${action.method ?? "GET"}:${action.href}:${action.label}`;
4671
+ const key = `${action.method ?? "GET"}:${action.href}:${action.label}:${action.profileId ?? ""}`;
4672
4672
  if (seen.has(key)) {
4673
4673
  return false;
4674
4674
  }
@@ -4676,6 +4676,16 @@ var uniqueRealCallProfileActions = (actions) => {
4676
4676
  return true;
4677
4677
  });
4678
4678
  };
4679
+ var appendRealCallRecoveryActionQuery = (href, query) => {
4680
+ const entries = Object.entries(query).filter((entry) => entry[1] !== undefined);
4681
+ if (entries.length === 0) {
4682
+ return href;
4683
+ }
4684
+ const [base = href, hash = ""] = href.split("#");
4685
+ const separator = base.includes("?") ? "&" : "?";
4686
+ const search = new URLSearchParams(entries).toString();
4687
+ return `${base}${separator}${search}${hash ? `#${hash}` : ""}`;
4688
+ };
4679
4689
  var buildVoiceRealCallProfileRecoveryActions = (report, options = {}) => {
4680
4690
  const actions = [
4681
4691
  {
@@ -4711,26 +4721,36 @@ var buildVoiceRealCallProfileRecoveryActions = (report, options = {}) => {
4711
4721
  return requiredSurfaces.some((surface) => !observedSurfaces.has(surface));
4712
4722
  });
4713
4723
  const ageMs = report.trend.ageMs ?? (report.generatedAt ? Date.now() - new Date(report.generatedAt).getTime() : undefined);
4714
- if (missingProfiles.length > 0 || warningProfiles.length > 0 || missingRoleProfiles.length > 0 || missingDepthProfiles.length > 0 || options.minCycles !== undefined && (report.summary.cycles ?? 0) < options.minCycles || options.minActionableProfiles !== undefined && report.defaults.summary.actionableProfiles < options.minActionableProfiles) {
4715
- actions.push({
4716
- description: "Run browser profile proof to collect microphone, WebSocket, live-latency, and provider traces for missing profiles.",
4717
- href: options.browserProofHref ?? "/voice/browser-call-profiles",
4718
- id: "collect-browser-proof",
4719
- label: "Run browser profile proof"
4720
- });
4721
- actions.push({
4722
- description: "Run phone profile proof when required profiles depend on carrier, telephony media, or noisy-call evidence.",
4723
- href: options.phoneProofHref ?? "/api/voice/phone/smoke",
4724
- id: "collect-phone-proof",
4725
- label: "Run phone profile proof"
4726
- });
4724
+ const needsProfileProof = missingProfiles.length > 0 || warningProfiles.length > 0 || missingRoleProfiles.length > 0 || missingDepthProfiles.length > 0 || options.minCycles !== undefined && (report.summary.cycles ?? 0) < options.minCycles || options.minActionableProfiles !== undefined && report.defaults.summary.actionableProfiles < options.minActionableProfiles;
4725
+ if (needsProfileProof) {
4726
+ const targetProfileIds = missingProfiles.length > 0 || missingDepthProfiles.length > 0 ? [...new Set([...missingProfiles, ...missingDepthProfiles])] : [...requiredProfiles];
4727
+ const targets = targetProfileIds.length > 0 ? targetProfileIds : [undefined];
4728
+ for (const profileId of targets) {
4729
+ actions.push({
4730
+ description: profileId ? `Run browser profile proof for ${profileId} to collect microphone, WebSocket, live-latency, and provider traces.` : "Run browser profile proof to collect microphone, WebSocket, live-latency, and provider traces for missing profiles.",
4731
+ href: appendRealCallRecoveryActionQuery(options.browserProofHref ?? "/voice/browser-call-profiles", { profileId }),
4732
+ id: "collect-browser-proof",
4733
+ label: profileId ? `Run browser profile proof for ${profileId}` : "Run browser profile proof",
4734
+ method: "POST",
4735
+ profileId
4736
+ });
4737
+ actions.push({
4738
+ description: profileId ? `Run phone profile proof for ${profileId} when the profile depends on carrier, telephony media, or noisy-call evidence.` : "Run phone profile proof when required profiles depend on carrier, telephony media, or noisy-call evidence.",
4739
+ href: appendRealCallRecoveryActionQuery(options.phoneProofHref ?? "/api/voice/phone/smoke", { profileId }),
4740
+ id: "collect-phone-proof",
4741
+ label: profileId ? `Run phone profile proof for ${profileId}` : "Run phone profile proof",
4742
+ method: "POST",
4743
+ profileId
4744
+ });
4745
+ }
4727
4746
  }
4728
4747
  if (options.maxAgeMs !== undefined && (ageMs === undefined || ageMs > options.maxAgeMs)) {
4729
4748
  actions.push({
4730
4749
  description: "Collect fresh real-call profile traces because the current history artifact is stale.",
4731
4750
  href: options.browserProofHref ?? "/voice/browser-call-profiles",
4732
4751
  id: "collect-browser-proof",
4733
- label: "Collect fresh profile evidence"
4752
+ label: "Collect fresh profile evidence",
4753
+ method: "POST"
4734
4754
  });
4735
4755
  }
4736
4756
  if (missingRoleProfiles.length > 0 || report.defaults.summary.actionableProfiles < (options.minActionableProfiles ?? 1)) {
@@ -5573,22 +5593,22 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
5573
5593
  productionReadinessHref: options.productionReadinessHref ?? actionPath("refresh")
5574
5594
  }).map((action) => ({
5575
5595
  ...action,
5576
- href: action.id === "collect-browser-proof" ? actionPath("collect-browser-proof") : action.id === "collect-phone-proof" ? actionPath("collect-phone-proof") : action.id === "collect-provider-role-evidence" ? actionPath("collect-provider-role-evidence") : action.href,
5596
+ href: action.id === "collect-browser-proof" ? appendRealCallRecoveryActionQuery(actionPath("collect-browser-proof"), { profileId: action.profileId }) : action.id === "collect-phone-proof" ? appendRealCallRecoveryActionQuery(actionPath("collect-phone-proof"), { profileId: action.profileId }) : action.id === "collect-provider-role-evidence" ? actionPath("collect-provider-role-evidence") : action.href,
5577
5597
  method: action.id === "refresh" && (action.label === "Open real-call profile history" || action.label === "Open operations records") ? "GET" : "POST"
5578
5598
  }));
5579
5599
  return { actions, generatedAt: new Date().toISOString(), report };
5580
5600
  };
5581
- const runActionHandler = async (actionId, report) => {
5601
+ const runActionHandler = async (actionId, report, profileId) => {
5582
5602
  const handler = options.handlers?.[actionId];
5583
5603
  if (!handler) {
5584
5604
  return;
5585
5605
  }
5586
- return await handler({ actionId, report });
5606
+ return await handler({ actionId, profileId, report });
5587
5607
  };
5588
- const runActionAsJob = async (actionId, report) => {
5608
+ const runActionAsJob = async (actionId, report, profileId) => {
5589
5609
  const job = await options.jobStore?.create({
5590
5610
  actionId,
5591
- message: `Queued real-call profile recovery action: ${actionId}.`,
5611
+ message: `Queued real-call profile recovery action: ${actionId}${profileId ? ` for ${profileId}` : ""}.`,
5592
5612
  status: "queued"
5593
5613
  });
5594
5614
  if (!job) {
@@ -5604,7 +5624,7 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
5604
5624
  updatedAt: startedAt
5605
5625
  });
5606
5626
  try {
5607
- const result = await runActionHandler(actionId, report);
5627
+ const result = await runActionHandler(actionId, report, profileId);
5608
5628
  const completedAt = new Date().toISOString();
5609
5629
  const ok = result?.ok ?? true;
5610
5630
  const status = result?.jobStatus ?? (result?.status === "fail" || ok === false ? "fail" : "pass");
@@ -5639,7 +5659,7 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
5639
5659
  status: "pass"
5640
5660
  };
5641
5661
  };
5642
- const runAction = async (actionId) => {
5662
+ const runAction = async (actionId, profileId) => {
5643
5663
  const report = await loadReport();
5644
5664
  const handler = options.handlers?.[actionId];
5645
5665
  if (!handler) {
@@ -5652,12 +5672,12 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
5652
5672
  };
5653
5673
  }
5654
5674
  if (options.jobStore && asyncActionIds.has(actionId)) {
5655
- const queued = await runActionAsJob(actionId, report);
5675
+ const queued = await runActionAsJob(actionId, report, profileId);
5656
5676
  if (queued) {
5657
5677
  return queued;
5658
5678
  }
5659
5679
  }
5660
- const result = await runActionHandler(actionId, report);
5680
+ const result = await runActionHandler(actionId, report, profileId);
5661
5681
  return {
5662
5682
  actionId,
5663
5683
  generatedAt: new Date().toISOString(),
@@ -5716,8 +5736,12 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
5716
5736
  });
5717
5737
  });
5718
5738
  for (const actionId of Object.keys(realCallProfileActionPaths)) {
5719
- routes.post(actionPath(actionId), async ({ set }) => {
5720
- const result = await runAction(actionId);
5739
+ routes.post(actionPath(actionId), async ({
5740
+ query,
5741
+ set
5742
+ }) => {
5743
+ const profileId = query.profileId?.trim() || undefined;
5744
+ const result = await runAction(actionId, profileId);
5721
5745
  if (!result.ok) {
5722
5746
  set.status = 501;
5723
5747
  }
package/dist/index.js CHANGED
@@ -16137,7 +16137,7 @@ var buildRealCallProfileReadinessIssues = (report, options) => {
16137
16137
  var uniqueRealCallProfileActions = (actions) => {
16138
16138
  const seen = new Set;
16139
16139
  return actions.filter((action) => {
16140
- const key = `${action.method ?? "GET"}:${action.href}:${action.label}`;
16140
+ const key = `${action.method ?? "GET"}:${action.href}:${action.label}:${action.profileId ?? ""}`;
16141
16141
  if (seen.has(key)) {
16142
16142
  return false;
16143
16143
  }
@@ -16145,6 +16145,16 @@ var uniqueRealCallProfileActions = (actions) => {
16145
16145
  return true;
16146
16146
  });
16147
16147
  };
16148
+ var appendRealCallRecoveryActionQuery = (href, query) => {
16149
+ const entries = Object.entries(query).filter((entry) => entry[1] !== undefined);
16150
+ if (entries.length === 0) {
16151
+ return href;
16152
+ }
16153
+ const [base = href, hash = ""] = href.split("#");
16154
+ const separator = base.includes("?") ? "&" : "?";
16155
+ const search = new URLSearchParams(entries).toString();
16156
+ return `${base}${separator}${search}${hash ? `#${hash}` : ""}`;
16157
+ };
16148
16158
  var buildVoiceRealCallProfileRecoveryActions = (report, options = {}) => {
16149
16159
  const actions = [
16150
16160
  {
@@ -16180,26 +16190,36 @@ var buildVoiceRealCallProfileRecoveryActions = (report, options = {}) => {
16180
16190
  return requiredSurfaces.some((surface) => !observedSurfaces.has(surface));
16181
16191
  });
16182
16192
  const ageMs = report.trend.ageMs ?? (report.generatedAt ? Date.now() - new Date(report.generatedAt).getTime() : undefined);
16183
- if (missingProfiles.length > 0 || warningProfiles.length > 0 || missingRoleProfiles.length > 0 || missingDepthProfiles.length > 0 || options.minCycles !== undefined && (report.summary.cycles ?? 0) < options.minCycles || options.minActionableProfiles !== undefined && report.defaults.summary.actionableProfiles < options.minActionableProfiles) {
16184
- actions.push({
16185
- description: "Run browser profile proof to collect microphone, WebSocket, live-latency, and provider traces for missing profiles.",
16186
- href: options.browserProofHref ?? "/voice/browser-call-profiles",
16187
- id: "collect-browser-proof",
16188
- label: "Run browser profile proof"
16189
- });
16190
- actions.push({
16191
- description: "Run phone profile proof when required profiles depend on carrier, telephony media, or noisy-call evidence.",
16192
- href: options.phoneProofHref ?? "/api/voice/phone/smoke",
16193
- id: "collect-phone-proof",
16194
- label: "Run phone profile proof"
16195
- });
16193
+ const needsProfileProof = missingProfiles.length > 0 || warningProfiles.length > 0 || missingRoleProfiles.length > 0 || missingDepthProfiles.length > 0 || options.minCycles !== undefined && (report.summary.cycles ?? 0) < options.minCycles || options.minActionableProfiles !== undefined && report.defaults.summary.actionableProfiles < options.minActionableProfiles;
16194
+ if (needsProfileProof) {
16195
+ const targetProfileIds = missingProfiles.length > 0 || missingDepthProfiles.length > 0 ? [...new Set([...missingProfiles, ...missingDepthProfiles])] : [...requiredProfiles];
16196
+ const targets = targetProfileIds.length > 0 ? targetProfileIds : [undefined];
16197
+ for (const profileId of targets) {
16198
+ actions.push({
16199
+ description: profileId ? `Run browser profile proof for ${profileId} to collect microphone, WebSocket, live-latency, and provider traces.` : "Run browser profile proof to collect microphone, WebSocket, live-latency, and provider traces for missing profiles.",
16200
+ href: appendRealCallRecoveryActionQuery(options.browserProofHref ?? "/voice/browser-call-profiles", { profileId }),
16201
+ id: "collect-browser-proof",
16202
+ label: profileId ? `Run browser profile proof for ${profileId}` : "Run browser profile proof",
16203
+ method: "POST",
16204
+ profileId
16205
+ });
16206
+ actions.push({
16207
+ description: profileId ? `Run phone profile proof for ${profileId} when the profile depends on carrier, telephony media, or noisy-call evidence.` : "Run phone profile proof when required profiles depend on carrier, telephony media, or noisy-call evidence.",
16208
+ href: appendRealCallRecoveryActionQuery(options.phoneProofHref ?? "/api/voice/phone/smoke", { profileId }),
16209
+ id: "collect-phone-proof",
16210
+ label: profileId ? `Run phone profile proof for ${profileId}` : "Run phone profile proof",
16211
+ method: "POST",
16212
+ profileId
16213
+ });
16214
+ }
16196
16215
  }
16197
16216
  if (options.maxAgeMs !== undefined && (ageMs === undefined || ageMs > options.maxAgeMs)) {
16198
16217
  actions.push({
16199
16218
  description: "Collect fresh real-call profile traces because the current history artifact is stale.",
16200
16219
  href: options.browserProofHref ?? "/voice/browser-call-profiles",
16201
16220
  id: "collect-browser-proof",
16202
- label: "Collect fresh profile evidence"
16221
+ label: "Collect fresh profile evidence",
16222
+ method: "POST"
16203
16223
  });
16204
16224
  }
16205
16225
  if (missingRoleProfiles.length > 0 || report.defaults.summary.actionableProfiles < (options.minActionableProfiles ?? 1)) {
@@ -17042,22 +17062,22 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
17042
17062
  productionReadinessHref: options.productionReadinessHref ?? actionPath("refresh")
17043
17063
  }).map((action) => ({
17044
17064
  ...action,
17045
- href: action.id === "collect-browser-proof" ? actionPath("collect-browser-proof") : action.id === "collect-phone-proof" ? actionPath("collect-phone-proof") : action.id === "collect-provider-role-evidence" ? actionPath("collect-provider-role-evidence") : action.href,
17065
+ href: action.id === "collect-browser-proof" ? appendRealCallRecoveryActionQuery(actionPath("collect-browser-proof"), { profileId: action.profileId }) : action.id === "collect-phone-proof" ? appendRealCallRecoveryActionQuery(actionPath("collect-phone-proof"), { profileId: action.profileId }) : action.id === "collect-provider-role-evidence" ? actionPath("collect-provider-role-evidence") : action.href,
17046
17066
  method: action.id === "refresh" && (action.label === "Open real-call profile history" || action.label === "Open operations records") ? "GET" : "POST"
17047
17067
  }));
17048
17068
  return { actions, generatedAt: new Date().toISOString(), report };
17049
17069
  };
17050
- const runActionHandler = async (actionId, report) => {
17070
+ const runActionHandler = async (actionId, report, profileId) => {
17051
17071
  const handler = options.handlers?.[actionId];
17052
17072
  if (!handler) {
17053
17073
  return;
17054
17074
  }
17055
- return await handler({ actionId, report });
17075
+ return await handler({ actionId, profileId, report });
17056
17076
  };
17057
- const runActionAsJob = async (actionId, report) => {
17077
+ const runActionAsJob = async (actionId, report, profileId) => {
17058
17078
  const job = await options.jobStore?.create({
17059
17079
  actionId,
17060
- message: `Queued real-call profile recovery action: ${actionId}.`,
17080
+ message: `Queued real-call profile recovery action: ${actionId}${profileId ? ` for ${profileId}` : ""}.`,
17061
17081
  status: "queued"
17062
17082
  });
17063
17083
  if (!job) {
@@ -17073,7 +17093,7 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
17073
17093
  updatedAt: startedAt
17074
17094
  });
17075
17095
  try {
17076
- const result = await runActionHandler(actionId, report);
17096
+ const result = await runActionHandler(actionId, report, profileId);
17077
17097
  const completedAt = new Date().toISOString();
17078
17098
  const ok = result?.ok ?? true;
17079
17099
  const status = result?.jobStatus ?? (result?.status === "fail" || ok === false ? "fail" : "pass");
@@ -17108,7 +17128,7 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
17108
17128
  status: "pass"
17109
17129
  };
17110
17130
  };
17111
- const runAction = async (actionId) => {
17131
+ const runAction = async (actionId, profileId) => {
17112
17132
  const report = await loadReport();
17113
17133
  const handler = options.handlers?.[actionId];
17114
17134
  if (!handler) {
@@ -17121,12 +17141,12 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
17121
17141
  };
17122
17142
  }
17123
17143
  if (options.jobStore && asyncActionIds.has(actionId)) {
17124
- const queued = await runActionAsJob(actionId, report);
17144
+ const queued = await runActionAsJob(actionId, report, profileId);
17125
17145
  if (queued) {
17126
17146
  return queued;
17127
17147
  }
17128
17148
  }
17129
- const result = await runActionHandler(actionId, report);
17149
+ const result = await runActionHandler(actionId, report, profileId);
17130
17150
  return {
17131
17151
  actionId,
17132
17152
  generatedAt: new Date().toISOString(),
@@ -17185,8 +17205,12 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
17185
17205
  });
17186
17206
  });
17187
17207
  for (const actionId of Object.keys(realCallProfileActionPaths)) {
17188
- routes.post(actionPath(actionId), async ({ set }) => {
17189
- const result = await runAction(actionId);
17208
+ routes.post(actionPath(actionId), async ({
17209
+ query,
17210
+ set
17211
+ }) => {
17212
+ const profileId = query.profileId?.trim() || undefined;
17213
+ const result = await runAction(actionId, profileId);
17190
17214
  if (!result.ok) {
17191
17215
  set.status = 501;
17192
17216
  }
@@ -377,6 +377,7 @@ export type VoiceRealCallProfileHistoryRoutesOptions = Omit<VoiceRealCallProfile
377
377
  export type VoiceRealCallProfileRecoveryActionId = 'collect-browser-proof' | 'collect-phone-proof' | 'collect-provider-role-evidence' | 'refresh';
378
378
  export type VoiceRealCallProfileRecoveryAction = VoiceProductionReadinessAction & {
379
379
  id: VoiceRealCallProfileRecoveryActionId;
380
+ profileId?: string;
380
381
  };
381
382
  export type VoiceRealCallProfileReadinessCheckOptions = {
382
383
  browserProofHref?: string;
@@ -409,6 +410,7 @@ export type VoiceRealCallProfileRecoveryJobHistoryCheckOptions = {
409
410
  };
410
411
  export type VoiceRealCallProfileRecoveryActionHandlerInput = {
411
412
  actionId: VoiceRealCallProfileRecoveryActionId;
413
+ profileId?: string;
412
414
  report: VoiceRealCallProfileHistoryReport;
413
415
  };
414
416
  export type VoiceRealCallProfileRecoveryActionResult = {
@@ -2255,7 +2255,7 @@ var buildRealCallProfileReadinessIssues = (report, options) => {
2255
2255
  var uniqueRealCallProfileActions = (actions) => {
2256
2256
  const seen = new Set;
2257
2257
  return actions.filter((action) => {
2258
- const key = `${action.method ?? "GET"}:${action.href}:${action.label}`;
2258
+ const key = `${action.method ?? "GET"}:${action.href}:${action.label}:${action.profileId ?? ""}`;
2259
2259
  if (seen.has(key)) {
2260
2260
  return false;
2261
2261
  }
@@ -2263,6 +2263,16 @@ var uniqueRealCallProfileActions = (actions) => {
2263
2263
  return true;
2264
2264
  });
2265
2265
  };
2266
+ var appendRealCallRecoveryActionQuery = (href, query) => {
2267
+ const entries = Object.entries(query).filter((entry) => entry[1] !== undefined);
2268
+ if (entries.length === 0) {
2269
+ return href;
2270
+ }
2271
+ const [base = href, hash = ""] = href.split("#");
2272
+ const separator = base.includes("?") ? "&" : "?";
2273
+ const search = new URLSearchParams(entries).toString();
2274
+ return `${base}${separator}${search}${hash ? `#${hash}` : ""}`;
2275
+ };
2266
2276
  var buildVoiceRealCallProfileRecoveryActions = (report, options = {}) => {
2267
2277
  const actions = [
2268
2278
  {
@@ -2298,26 +2308,36 @@ var buildVoiceRealCallProfileRecoveryActions = (report, options = {}) => {
2298
2308
  return requiredSurfaces.some((surface) => !observedSurfaces.has(surface));
2299
2309
  });
2300
2310
  const ageMs = report.trend.ageMs ?? (report.generatedAt ? Date.now() - new Date(report.generatedAt).getTime() : undefined);
2301
- if (missingProfiles.length > 0 || warningProfiles.length > 0 || missingRoleProfiles.length > 0 || missingDepthProfiles.length > 0 || options.minCycles !== undefined && (report.summary.cycles ?? 0) < options.minCycles || options.minActionableProfiles !== undefined && report.defaults.summary.actionableProfiles < options.minActionableProfiles) {
2302
- actions.push({
2303
- description: "Run browser profile proof to collect microphone, WebSocket, live-latency, and provider traces for missing profiles.",
2304
- href: options.browserProofHref ?? "/voice/browser-call-profiles",
2305
- id: "collect-browser-proof",
2306
- label: "Run browser profile proof"
2307
- });
2308
- actions.push({
2309
- description: "Run phone profile proof when required profiles depend on carrier, telephony media, or noisy-call evidence.",
2310
- href: options.phoneProofHref ?? "/api/voice/phone/smoke",
2311
- id: "collect-phone-proof",
2312
- label: "Run phone profile proof"
2313
- });
2311
+ const needsProfileProof = missingProfiles.length > 0 || warningProfiles.length > 0 || missingRoleProfiles.length > 0 || missingDepthProfiles.length > 0 || options.minCycles !== undefined && (report.summary.cycles ?? 0) < options.minCycles || options.minActionableProfiles !== undefined && report.defaults.summary.actionableProfiles < options.minActionableProfiles;
2312
+ if (needsProfileProof) {
2313
+ const targetProfileIds = missingProfiles.length > 0 || missingDepthProfiles.length > 0 ? [...new Set([...missingProfiles, ...missingDepthProfiles])] : [...requiredProfiles];
2314
+ const targets = targetProfileIds.length > 0 ? targetProfileIds : [undefined];
2315
+ for (const profileId of targets) {
2316
+ actions.push({
2317
+ description: profileId ? `Run browser profile proof for ${profileId} to collect microphone, WebSocket, live-latency, and provider traces.` : "Run browser profile proof to collect microphone, WebSocket, live-latency, and provider traces for missing profiles.",
2318
+ href: appendRealCallRecoveryActionQuery(options.browserProofHref ?? "/voice/browser-call-profiles", { profileId }),
2319
+ id: "collect-browser-proof",
2320
+ label: profileId ? `Run browser profile proof for ${profileId}` : "Run browser profile proof",
2321
+ method: "POST",
2322
+ profileId
2323
+ });
2324
+ actions.push({
2325
+ description: profileId ? `Run phone profile proof for ${profileId} when the profile depends on carrier, telephony media, or noisy-call evidence.` : "Run phone profile proof when required profiles depend on carrier, telephony media, or noisy-call evidence.",
2326
+ href: appendRealCallRecoveryActionQuery(options.phoneProofHref ?? "/api/voice/phone/smoke", { profileId }),
2327
+ id: "collect-phone-proof",
2328
+ label: profileId ? `Run phone profile proof for ${profileId}` : "Run phone profile proof",
2329
+ method: "POST",
2330
+ profileId
2331
+ });
2332
+ }
2314
2333
  }
2315
2334
  if (options.maxAgeMs !== undefined && (ageMs === undefined || ageMs > options.maxAgeMs)) {
2316
2335
  actions.push({
2317
2336
  description: "Collect fresh real-call profile traces because the current history artifact is stale.",
2318
2337
  href: options.browserProofHref ?? "/voice/browser-call-profiles",
2319
2338
  id: "collect-browser-proof",
2320
- label: "Collect fresh profile evidence"
2339
+ label: "Collect fresh profile evidence",
2340
+ method: "POST"
2321
2341
  });
2322
2342
  }
2323
2343
  if (missingRoleProfiles.length > 0 || report.defaults.summary.actionableProfiles < (options.minActionableProfiles ?? 1)) {
@@ -3160,22 +3180,22 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
3160
3180
  productionReadinessHref: options.productionReadinessHref ?? actionPath("refresh")
3161
3181
  }).map((action) => ({
3162
3182
  ...action,
3163
- href: action.id === "collect-browser-proof" ? actionPath("collect-browser-proof") : action.id === "collect-phone-proof" ? actionPath("collect-phone-proof") : action.id === "collect-provider-role-evidence" ? actionPath("collect-provider-role-evidence") : action.href,
3183
+ href: action.id === "collect-browser-proof" ? appendRealCallRecoveryActionQuery(actionPath("collect-browser-proof"), { profileId: action.profileId }) : action.id === "collect-phone-proof" ? appendRealCallRecoveryActionQuery(actionPath("collect-phone-proof"), { profileId: action.profileId }) : action.id === "collect-provider-role-evidence" ? actionPath("collect-provider-role-evidence") : action.href,
3164
3184
  method: action.id === "refresh" && (action.label === "Open real-call profile history" || action.label === "Open operations records") ? "GET" : "POST"
3165
3185
  }));
3166
3186
  return { actions, generatedAt: new Date().toISOString(), report };
3167
3187
  };
3168
- const runActionHandler = async (actionId, report) => {
3188
+ const runActionHandler = async (actionId, report, profileId) => {
3169
3189
  const handler = options.handlers?.[actionId];
3170
3190
  if (!handler) {
3171
3191
  return;
3172
3192
  }
3173
- return await handler({ actionId, report });
3193
+ return await handler({ actionId, profileId, report });
3174
3194
  };
3175
- const runActionAsJob = async (actionId, report) => {
3195
+ const runActionAsJob = async (actionId, report, profileId) => {
3176
3196
  const job = await options.jobStore?.create({
3177
3197
  actionId,
3178
- message: `Queued real-call profile recovery action: ${actionId}.`,
3198
+ message: `Queued real-call profile recovery action: ${actionId}${profileId ? ` for ${profileId}` : ""}.`,
3179
3199
  status: "queued"
3180
3200
  });
3181
3201
  if (!job) {
@@ -3191,7 +3211,7 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
3191
3211
  updatedAt: startedAt
3192
3212
  });
3193
3213
  try {
3194
- const result = await runActionHandler(actionId, report);
3214
+ const result = await runActionHandler(actionId, report, profileId);
3195
3215
  const completedAt = new Date().toISOString();
3196
3216
  const ok = result?.ok ?? true;
3197
3217
  const status = result?.jobStatus ?? (result?.status === "fail" || ok === false ? "fail" : "pass");
@@ -3226,7 +3246,7 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
3226
3246
  status: "pass"
3227
3247
  };
3228
3248
  };
3229
- const runAction = async (actionId) => {
3249
+ const runAction = async (actionId, profileId) => {
3230
3250
  const report = await loadReport();
3231
3251
  const handler = options.handlers?.[actionId];
3232
3252
  if (!handler) {
@@ -3239,12 +3259,12 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
3239
3259
  };
3240
3260
  }
3241
3261
  if (options.jobStore && asyncActionIds.has(actionId)) {
3242
- const queued = await runActionAsJob(actionId, report);
3262
+ const queued = await runActionAsJob(actionId, report, profileId);
3243
3263
  if (queued) {
3244
3264
  return queued;
3245
3265
  }
3246
3266
  }
3247
- const result = await runActionHandler(actionId, report);
3267
+ const result = await runActionHandler(actionId, report, profileId);
3248
3268
  return {
3249
3269
  actionId,
3250
3270
  generatedAt: new Date().toISOString(),
@@ -3303,8 +3323,12 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
3303
3323
  });
3304
3324
  });
3305
3325
  for (const actionId of Object.keys(realCallProfileActionPaths)) {
3306
- routes.post(actionPath(actionId), async ({ set }) => {
3307
- const result = await runAction(actionId);
3326
+ routes.post(actionPath(actionId), async ({
3327
+ query,
3328
+ set
3329
+ }) => {
3330
+ const profileId = query.profileId?.trim() || undefined;
3331
+ const result = await runAction(actionId, profileId);
3308
3332
  if (!result.ok) {
3309
3333
  set.status = 501;
3310
3334
  }
package/dist/vue/index.js CHANGED
@@ -2176,7 +2176,7 @@ var buildRealCallProfileReadinessIssues = (report, options) => {
2176
2176
  var uniqueRealCallProfileActions = (actions) => {
2177
2177
  const seen = new Set;
2178
2178
  return actions.filter((action) => {
2179
- const key = `${action.method ?? "GET"}:${action.href}:${action.label}`;
2179
+ const key = `${action.method ?? "GET"}:${action.href}:${action.label}:${action.profileId ?? ""}`;
2180
2180
  if (seen.has(key)) {
2181
2181
  return false;
2182
2182
  }
@@ -2184,6 +2184,16 @@ var uniqueRealCallProfileActions = (actions) => {
2184
2184
  return true;
2185
2185
  });
2186
2186
  };
2187
+ var appendRealCallRecoveryActionQuery = (href, query) => {
2188
+ const entries = Object.entries(query).filter((entry) => entry[1] !== undefined);
2189
+ if (entries.length === 0) {
2190
+ return href;
2191
+ }
2192
+ const [base = href, hash = ""] = href.split("#");
2193
+ const separator = base.includes("?") ? "&" : "?";
2194
+ const search = new URLSearchParams(entries).toString();
2195
+ return `${base}${separator}${search}${hash ? `#${hash}` : ""}`;
2196
+ };
2187
2197
  var buildVoiceRealCallProfileRecoveryActions = (report, options = {}) => {
2188
2198
  const actions = [
2189
2199
  {
@@ -2219,26 +2229,36 @@ var buildVoiceRealCallProfileRecoveryActions = (report, options = {}) => {
2219
2229
  return requiredSurfaces.some((surface) => !observedSurfaces.has(surface));
2220
2230
  });
2221
2231
  const ageMs = report.trend.ageMs ?? (report.generatedAt ? Date.now() - new Date(report.generatedAt).getTime() : undefined);
2222
- if (missingProfiles.length > 0 || warningProfiles.length > 0 || missingRoleProfiles.length > 0 || missingDepthProfiles.length > 0 || options.minCycles !== undefined && (report.summary.cycles ?? 0) < options.minCycles || options.minActionableProfiles !== undefined && report.defaults.summary.actionableProfiles < options.minActionableProfiles) {
2223
- actions.push({
2224
- description: "Run browser profile proof to collect microphone, WebSocket, live-latency, and provider traces for missing profiles.",
2225
- href: options.browserProofHref ?? "/voice/browser-call-profiles",
2226
- id: "collect-browser-proof",
2227
- label: "Run browser profile proof"
2228
- });
2229
- actions.push({
2230
- description: "Run phone profile proof when required profiles depend on carrier, telephony media, or noisy-call evidence.",
2231
- href: options.phoneProofHref ?? "/api/voice/phone/smoke",
2232
- id: "collect-phone-proof",
2233
- label: "Run phone profile proof"
2234
- });
2232
+ const needsProfileProof = missingProfiles.length > 0 || warningProfiles.length > 0 || missingRoleProfiles.length > 0 || missingDepthProfiles.length > 0 || options.minCycles !== undefined && (report.summary.cycles ?? 0) < options.minCycles || options.minActionableProfiles !== undefined && report.defaults.summary.actionableProfiles < options.minActionableProfiles;
2233
+ if (needsProfileProof) {
2234
+ const targetProfileIds = missingProfiles.length > 0 || missingDepthProfiles.length > 0 ? [...new Set([...missingProfiles, ...missingDepthProfiles])] : [...requiredProfiles];
2235
+ const targets = targetProfileIds.length > 0 ? targetProfileIds : [undefined];
2236
+ for (const profileId of targets) {
2237
+ actions.push({
2238
+ description: profileId ? `Run browser profile proof for ${profileId} to collect microphone, WebSocket, live-latency, and provider traces.` : "Run browser profile proof to collect microphone, WebSocket, live-latency, and provider traces for missing profiles.",
2239
+ href: appendRealCallRecoveryActionQuery(options.browserProofHref ?? "/voice/browser-call-profiles", { profileId }),
2240
+ id: "collect-browser-proof",
2241
+ label: profileId ? `Run browser profile proof for ${profileId}` : "Run browser profile proof",
2242
+ method: "POST",
2243
+ profileId
2244
+ });
2245
+ actions.push({
2246
+ description: profileId ? `Run phone profile proof for ${profileId} when the profile depends on carrier, telephony media, or noisy-call evidence.` : "Run phone profile proof when required profiles depend on carrier, telephony media, or noisy-call evidence.",
2247
+ href: appendRealCallRecoveryActionQuery(options.phoneProofHref ?? "/api/voice/phone/smoke", { profileId }),
2248
+ id: "collect-phone-proof",
2249
+ label: profileId ? `Run phone profile proof for ${profileId}` : "Run phone profile proof",
2250
+ method: "POST",
2251
+ profileId
2252
+ });
2253
+ }
2235
2254
  }
2236
2255
  if (options.maxAgeMs !== undefined && (ageMs === undefined || ageMs > options.maxAgeMs)) {
2237
2256
  actions.push({
2238
2257
  description: "Collect fresh real-call profile traces because the current history artifact is stale.",
2239
2258
  href: options.browserProofHref ?? "/voice/browser-call-profiles",
2240
2259
  id: "collect-browser-proof",
2241
- label: "Collect fresh profile evidence"
2260
+ label: "Collect fresh profile evidence",
2261
+ method: "POST"
2242
2262
  });
2243
2263
  }
2244
2264
  if (missingRoleProfiles.length > 0 || report.defaults.summary.actionableProfiles < (options.minActionableProfiles ?? 1)) {
@@ -3081,22 +3101,22 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
3081
3101
  productionReadinessHref: options.productionReadinessHref ?? actionPath("refresh")
3082
3102
  }).map((action) => ({
3083
3103
  ...action,
3084
- href: action.id === "collect-browser-proof" ? actionPath("collect-browser-proof") : action.id === "collect-phone-proof" ? actionPath("collect-phone-proof") : action.id === "collect-provider-role-evidence" ? actionPath("collect-provider-role-evidence") : action.href,
3104
+ href: action.id === "collect-browser-proof" ? appendRealCallRecoveryActionQuery(actionPath("collect-browser-proof"), { profileId: action.profileId }) : action.id === "collect-phone-proof" ? appendRealCallRecoveryActionQuery(actionPath("collect-phone-proof"), { profileId: action.profileId }) : action.id === "collect-provider-role-evidence" ? actionPath("collect-provider-role-evidence") : action.href,
3085
3105
  method: action.id === "refresh" && (action.label === "Open real-call profile history" || action.label === "Open operations records") ? "GET" : "POST"
3086
3106
  }));
3087
3107
  return { actions, generatedAt: new Date().toISOString(), report };
3088
3108
  };
3089
- const runActionHandler = async (actionId, report) => {
3109
+ const runActionHandler = async (actionId, report, profileId) => {
3090
3110
  const handler = options.handlers?.[actionId];
3091
3111
  if (!handler) {
3092
3112
  return;
3093
3113
  }
3094
- return await handler({ actionId, report });
3114
+ return await handler({ actionId, profileId, report });
3095
3115
  };
3096
- const runActionAsJob = async (actionId, report) => {
3116
+ const runActionAsJob = async (actionId, report, profileId) => {
3097
3117
  const job = await options.jobStore?.create({
3098
3118
  actionId,
3099
- message: `Queued real-call profile recovery action: ${actionId}.`,
3119
+ message: `Queued real-call profile recovery action: ${actionId}${profileId ? ` for ${profileId}` : ""}.`,
3100
3120
  status: "queued"
3101
3121
  });
3102
3122
  if (!job) {
@@ -3112,7 +3132,7 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
3112
3132
  updatedAt: startedAt
3113
3133
  });
3114
3134
  try {
3115
- const result = await runActionHandler(actionId, report);
3135
+ const result = await runActionHandler(actionId, report, profileId);
3116
3136
  const completedAt = new Date().toISOString();
3117
3137
  const ok = result?.ok ?? true;
3118
3138
  const status = result?.jobStatus ?? (result?.status === "fail" || ok === false ? "fail" : "pass");
@@ -3147,7 +3167,7 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
3147
3167
  status: "pass"
3148
3168
  };
3149
3169
  };
3150
- const runAction = async (actionId) => {
3170
+ const runAction = async (actionId, profileId) => {
3151
3171
  const report = await loadReport();
3152
3172
  const handler = options.handlers?.[actionId];
3153
3173
  if (!handler) {
@@ -3160,12 +3180,12 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
3160
3180
  };
3161
3181
  }
3162
3182
  if (options.jobStore && asyncActionIds.has(actionId)) {
3163
- const queued = await runActionAsJob(actionId, report);
3183
+ const queued = await runActionAsJob(actionId, report, profileId);
3164
3184
  if (queued) {
3165
3185
  return queued;
3166
3186
  }
3167
3187
  }
3168
- const result = await runActionHandler(actionId, report);
3188
+ const result = await runActionHandler(actionId, report, profileId);
3169
3189
  return {
3170
3190
  actionId,
3171
3191
  generatedAt: new Date().toISOString(),
@@ -3224,8 +3244,12 @@ var createVoiceRealCallProfileRecoveryActionRoutes = (options = {}) => {
3224
3244
  });
3225
3245
  });
3226
3246
  for (const actionId of Object.keys(realCallProfileActionPaths)) {
3227
- routes.post(actionPath(actionId), async ({ set }) => {
3228
- const result = await runAction(actionId);
3247
+ routes.post(actionPath(actionId), async ({
3248
+ query,
3249
+ set
3250
+ }) => {
3251
+ const profileId = query.profileId?.trim() || undefined;
3252
+ const result = await runAction(actionId, profileId);
3229
3253
  if (!result.ok) {
3230
3254
  set.status = 501;
3231
3255
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.381",
3
+ "version": "0.0.22-beta.383",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",