@sequenceholdings/agent-spec 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +93 -0
  2. package/dist/agent-definition.d.ts +616 -0
  3. package/dist/agent-definition.js +240 -0
  4. package/dist/canonical-json.d.ts +2 -0
  5. package/dist/canonical-json.js +13 -0
  6. package/dist/index.d.ts +2 -117
  7. package/dist/index.js +2 -248
  8. package/dist/input-schema.d.ts +19 -0
  9. package/dist/input-schema.js +57 -0
  10. package/dist/voice-access.d.ts +40 -0
  11. package/dist/voice-access.js +34 -0
  12. package/dist/voice-actions-contracts.d.ts +423 -0
  13. package/dist/voice-actions-contracts.js +95 -0
  14. package/dist/voice-actions-transitions.d.ts +52 -0
  15. package/dist/voice-actions-transitions.js +170 -0
  16. package/dist/voice-actions.d.ts +2 -0
  17. package/dist/voice-actions.js +2 -0
  18. package/dist/voice-api.d.ts +1102 -0
  19. package/dist/voice-api.js +164 -0
  20. package/dist/voice-authoring.d.ts +463 -0
  21. package/dist/voice-authoring.js +132 -0
  22. package/dist/voice-authority-contracts.d.ts +247 -0
  23. package/dist/voice-authority-contracts.js +177 -0
  24. package/dist/voice-authority-evaluation.d.ts +29 -0
  25. package/dist/voice-authority-evaluation.js +80 -0
  26. package/dist/voice-authority-verification.d.ts +47 -0
  27. package/dist/voice-authority-verification.js +184 -0
  28. package/dist/voice-authority.d.ts +3 -0
  29. package/dist/voice-authority.js +3 -0
  30. package/dist/voice-common.d.ts +21 -0
  31. package/dist/voice-common.js +23 -0
  32. package/dist/voice-drafts.d.ts +441 -0
  33. package/dist/voice-drafts.js +75 -0
  34. package/dist/voice-grant.d.ts +19 -0
  35. package/dist/voice-grant.js +21 -0
  36. package/dist/voice-lifecycle-control.d.ts +130 -0
  37. package/dist/voice-lifecycle-control.js +138 -0
  38. package/dist/voice-lifecycle-session.d.ts +168 -0
  39. package/dist/voice-lifecycle-session.js +114 -0
  40. package/dist/voice-lifecycle-states.d.ts +96 -0
  41. package/dist/voice-lifecycle-states.js +139 -0
  42. package/dist/voice-lifecycle.d.ts +3 -0
  43. package/dist/voice-lifecycle.js +3 -0
  44. package/dist/voice-policy-duration.d.ts +46 -0
  45. package/dist/voice-policy-duration.js +166 -0
  46. package/dist/voice-policy-limits.d.ts +174 -0
  47. package/dist/voice-policy-limits.js +188 -0
  48. package/dist/voice-policy.d.ts +2 -0
  49. package/dist/voice-policy.js +2 -0
  50. package/dist/voice-provider-evidence.d.ts +80 -0
  51. package/dist/voice-provider-evidence.js +115 -0
  52. package/dist/voice-provider-publication.d.ts +319 -0
  53. package/dist/voice-provider-publication.js +117 -0
  54. package/dist/voice-provider-release.d.ts +386 -0
  55. package/dist/voice-provider-release.js +154 -0
  56. package/dist/voice-provider.d.ts +3 -0
  57. package/dist/voice-provider.js +3 -0
  58. package/dist/voice-release.d.ts +808 -0
  59. package/dist/voice-release.js +110 -0
  60. package/dist/voice-runs-audio.d.ts +157 -0
  61. package/dist/voice-runs-audio.js +85 -0
  62. package/dist/voice-runs-evidence.d.ts +183 -0
  63. package/dist/voice-runs-evidence.js +154 -0
  64. package/dist/voice-runs-model.d.ts +967 -0
  65. package/dist/voice-runs-model.js +199 -0
  66. package/dist/voice-runs-tooling.d.ts +88 -0
  67. package/dist/voice-runs-tooling.js +100 -0
  68. package/dist/voice-runs.d.ts +4 -0
  69. package/dist/voice-runs.js +4 -0
  70. package/dist/voice.d.ts +13 -0
  71. package/dist/voice.js +13 -0
  72. package/package.json +8 -3
@@ -0,0 +1,110 @@
1
+ import { z } from 'zod';
2
+ import { hashAgentBundle, voiceAgentDefinitionSchema } from './agent-definition.js';
3
+ import { voiceHashSchema, voiceIdSchema } from './voice-common.js';
4
+ import { voicePublicationToolReviewSchema } from './voice-authority.js';
5
+ import { voiceReleaseLifecycleSchema, voiceRuntimeBindingSchema } from './voice-lifecycle.js';
6
+ import { evaluateVoiceProviderReleaseReadiness, voiceProviderReleaseEvidenceSchema } from './voice-provider.js';
7
+ export const voiceDefinitionSnapshotSchema = z.strictObject({
8
+ agentVersionId: voiceIdSchema,
9
+ definition: voiceAgentDefinitionSchema,
10
+ authoredDefinitionHash: voiceHashSchema,
11
+ }).refine((snapshot) => snapshot.authoredDefinitionHash === hashAgentBundle({ definitions: [snapshot.definition] }), { path: ['authoredDefinitionHash'], message: 'Snapshot hash must include the exact captured authored definition' });
12
+ const voiceReleaseRecordBaseSchema = z.strictObject({
13
+ lifecycle: voiceReleaseLifecycleSchema,
14
+ snapshot: voiceDefinitionSnapshotSchema.nullable(),
15
+ runtimeBinding: voiceRuntimeBindingSchema.nullable(),
16
+ toolReviews: z.array(voicePublicationToolReviewSchema).max(64),
17
+ providerEvidence: voiceProviderReleaseEvidenceSchema.nullable(),
18
+ });
19
+ export const voiceReleaseRecordSchema = voiceReleaseRecordBaseSchema.superRefine((release, context) => {
20
+ const { lifecycle, snapshot, runtimeBinding, providerEvidence } = release;
21
+ const readyOrLater = ['READY', 'ACTIVE', 'RETIRED'].includes(lifecycle.state);
22
+ if (readyOrLater && (snapshot === null || runtimeBinding === null || providerEvidence === null)) {
23
+ context.addIssue({ code: 'custom', message: 'Prepared release state requires complete snapshot, runtime and provider evidence' });
24
+ }
25
+ if (readyOrLater && runtimeBinding?.accountStatus === 'DISABLED') {
26
+ context.addIssue({ code: 'custom', path: ['runtimeBinding', 'accountStatus'],
27
+ message: 'Prepared release must capture an active runtime account; current status is rechecked at execution' });
28
+ }
29
+ if (readyOrLater && providerEvidence !== null) {
30
+ const readiness = evaluateVoiceProviderReleaseReadiness({ release: providerEvidence });
31
+ if (!readiness.ready)
32
+ context.addIssue({ code: 'custom', path: ['providerEvidence'],
33
+ message: `Prepared release provider evidence is not ready: ${readiness.blockers.join(', ')}` });
34
+ validateAuthoredProviderReferences({ release, context });
35
+ }
36
+ if (snapshot !== null && snapshot.definition.id !== lifecycle.agentId) {
37
+ context.addIssue({ code: 'custom', path: ['snapshot'], message: 'Snapshot Agent identity mismatch' });
38
+ }
39
+ if (runtimeBinding !== null && (runtimeBinding.tenantId !== lifecycle.tenantId || runtimeBinding.environmentId !== lifecycle.environmentId)) {
40
+ context.addIssue({ code: 'custom', path: ['runtimeBinding'], message: 'Runtime binding scope mismatch' });
41
+ }
42
+ validateProviderLinks({ release, context });
43
+ validateReviewLinks({ release, context });
44
+ });
45
+ function sameReferences({ actual, expected }) {
46
+ const declared = new Set(expected);
47
+ return actual.length === declared.size && new Set(actual).size === actual.length && actual.every((key) => declared.has(key));
48
+ }
49
+ function validateAuthoredProviderReferences({ release, context }) {
50
+ const { snapshot, providerEvidence } = release;
51
+ if (snapshot === null || providerEvidence === null)
52
+ return;
53
+ const { voice } = snapshot.definition;
54
+ const declaredProcedureKeys = voice.procedures.map((procedure) => procedure.key);
55
+ const configuration = providerEvidence.desiredConfiguration.configuration;
56
+ if (!sameReferences({ actual: providerEvidence.procedureMappings.map((mapping) => mapping.localProcedureKey), expected: declaredProcedureKeys }) ||
57
+ !sameReferences({ actual: configuration.toolAliases, expected: voice.tools.map((tool) => tool.alias) })) {
58
+ context.addIssue({ code: 'custom', path: ['providerEvidence'],
59
+ message: 'Prepared provider references must match exactly the captured procedures and authored tools' });
60
+ }
61
+ const providerIds = new Map(providerEvidence.procedureMappings.map((mapping) => [mapping.localProcedureKey, mapping.providerProcedureId]));
62
+ for (const generated of providerEvidence.generatedWorkflow.normalized.procedures) {
63
+ const authored = voice.procedures.find((procedure) => procedure.key === generated.localProcedureKey);
64
+ if (authored === undefined)
65
+ continue;
66
+ const expectedProviderIds = authored.subprocedures.flatMap((key) => {
67
+ const id = providerIds.get(key);
68
+ return id === undefined ? [] : [id];
69
+ });
70
+ if (!sameReferences({ actual: generated.toolAliases, expected: authored.toolAliases }) ||
71
+ !sameReferences({ actual: generated.referencedProviderProcedureIds, expected: expectedProviderIds })) {
72
+ context.addIssue({ code: 'custom', path: ['providerEvidence', 'generatedWorkflow'],
73
+ message: `Generated procedure ${authored.key} dependencies must match its captured declaration` });
74
+ }
75
+ }
76
+ }
77
+ function validateProviderLinks({ release, context }) {
78
+ const { lifecycle, snapshot, providerEvidence } = release;
79
+ if (providerEvidence !== null && (providerEvidence.releaseId !== lifecycle.releaseId ||
80
+ providerEvidence.publicationOperationId !== lifecycle.publicationOperationId ||
81
+ providerEvidence.scope.agentId !== lifecycle.agentId || providerEvidence.scope.tenantId !== lifecycle.tenantId ||
82
+ providerEvidence.scope.environmentId !== lifecycle.environmentId ||
83
+ providerEvidence.agentVersionId !== snapshot?.agentVersionId ||
84
+ providerEvidence.inputEvidence.authoredDefinitionHash !== snapshot?.authoredDefinitionHash)) {
85
+ context.addIssue({ code: 'custom', path: ['providerEvidence'], message: 'Provider evidence must bind this release, scope and exact Agent version' });
86
+ }
87
+ }
88
+ function validateReviewLinks({ release, context }) {
89
+ const { lifecycle, snapshot, runtimeBinding, toolReviews } = release;
90
+ const readyOrLater = ['READY', 'ACTIVE', 'RETIRED'].includes(lifecycle.state);
91
+ for (const [index, review] of toolReviews.entries()) {
92
+ if (review.releaseId !== lifecycle.releaseId || review.scope.agentId !== lifecycle.agentId ||
93
+ review.scope.tenantId !== lifecycle.tenantId || review.scope.environmentId !== lifecycle.environmentId ||
94
+ review.binding.runtimeBinding.runtimeAccountId !== runtimeBinding?.runtimeAccountId) {
95
+ context.addIssue({ code: 'custom', path: ['toolReviews', index], message: 'Tool review release or runtime scope mismatch' });
96
+ }
97
+ const authored = snapshot?.definition.voice.tools.find((tool) => tool.alias === review.binding.toolAlias);
98
+ if (authored !== undefined && authored.managedFunction.operation !== review.binding.operation) {
99
+ context.addIssue({ code: 'custom', path: ['toolReviews', index, 'binding', 'operation'],
100
+ message: 'Reviewed operation must match the authored operation for this alias' });
101
+ }
102
+ }
103
+ const reviewedAliases = new Set(toolReviews.map((review) => review.binding.toolAlias));
104
+ if (reviewedAliases.size !== toolReviews.length)
105
+ context.addIssue({ code: 'custom', path: ['toolReviews'], message: 'Duplicate tool review alias' });
106
+ if (readyOrLater && snapshot !== null && (snapshot.definition.voice.tools.length !== reviewedAliases.size ||
107
+ snapshot.definition.voice.tools.some((tool) => !reviewedAliases.has(tool.alias)))) {
108
+ context.addIssue({ code: 'custom', path: ['toolReviews'], message: 'Prepared release requires reviews for exactly the authored tools' });
109
+ }
110
+ }
@@ -0,0 +1,157 @@
1
+ import { z } from 'zod';
2
+ export declare const voiceAudioCapabilitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ status: z.ZodLiteral<"LIVE_PROOF_PENDING">;
4
+ evidenceRef: z.ZodNull;
5
+ sanitizedReason: z.ZodString;
6
+ }, z.core.$strict>, z.ZodObject<{
7
+ status: z.ZodLiteral<"SUPPORTED">;
8
+ verifiedAt: z.ZodISODateTime;
9
+ evidenceRef: z.ZodString;
10
+ byteRangeSupport: z.ZodEnum<{
11
+ LIVE_PROOF_PENDING: "LIVE_PROOF_PENDING";
12
+ VERIFIED_SUPPORTED: "VERIFIED_SUPPORTED";
13
+ VERIFIED_UNSUPPORTED: "VERIFIED_UNSUPPORTED";
14
+ }>;
15
+ }, z.core.$strict>, z.ZodObject<{
16
+ status: z.ZodLiteral<"DEFERRED">;
17
+ decidedAt: z.ZodISODateTime;
18
+ evidenceRef: z.ZodString;
19
+ sanitizedReason: z.ZodString;
20
+ }, z.core.$strict>], "status">;
21
+ export type VoiceAudioCapability = z.infer<typeof voiceAudioCapabilitySchema>;
22
+ export declare const voiceAudioReadRequestSchema: z.ZodObject<{
23
+ scope: z.ZodObject<{
24
+ tenantId: z.ZodString;
25
+ environmentId: z.ZodString;
26
+ agentId: z.ZodString;
27
+ }, z.core.$strict>;
28
+ runId: z.ZodString;
29
+ expectedSessionId: z.ZodString;
30
+ byteRange: z.ZodNullable<z.ZodObject<{
31
+ startByte: z.ZodNumber;
32
+ endByte: z.ZodNullable<z.ZodNumber>;
33
+ }, z.core.$strict>>;
34
+ }, z.core.$strict>;
35
+ export type VoiceAudioReadRequest = z.infer<typeof voiceAudioReadRequestSchema>;
36
+ export declare const voiceAudioReadResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
37
+ status: z.ZodLiteral<"AVAILABLE">;
38
+ runId: z.ZodString;
39
+ sessionId: z.ZodString;
40
+ capability: z.ZodObject<{
41
+ status: z.ZodLiteral<"SUPPORTED">;
42
+ verifiedAt: z.ZodISODateTime;
43
+ evidenceRef: z.ZodString;
44
+ byteRangeSupport: z.ZodEnum<{
45
+ LIVE_PROOF_PENDING: "LIVE_PROOF_PENDING";
46
+ VERIFIED_SUPPORTED: "VERIFIED_SUPPORTED";
47
+ VERIFIED_UNSUPPORTED: "VERIFIED_UNSUPPORTED";
48
+ }>;
49
+ }, z.core.$strict>;
50
+ delivery: z.ZodLiteral<"ATLAS_AUTHORIZED_STREAM">;
51
+ contentType: z.ZodEnum<{
52
+ "audio/mpeg": "audio/mpeg";
53
+ "audio/wav": "audio/wav";
54
+ "audio/ogg": "audio/ogg";
55
+ "audio/webm": "audio/webm";
56
+ }>;
57
+ contentLengthBytes: z.ZodNumber;
58
+ deliveryPolicy: z.ZodObject<{
59
+ cacheControl: z.ZodLiteral<"private, no-store">;
60
+ maxBytes: z.ZodNumber;
61
+ timeoutMilliseconds: z.ZodNumber;
62
+ }, z.core.$strict>;
63
+ }, z.core.$strict>, z.ZodObject<{
64
+ status: z.ZodLiteral<"PENDING">;
65
+ runId: z.ZodString;
66
+ sessionId: z.ZodString;
67
+ capability: z.ZodObject<{
68
+ status: z.ZodLiteral<"SUPPORTED">;
69
+ verifiedAt: z.ZodISODateTime;
70
+ evidenceRef: z.ZodString;
71
+ byteRangeSupport: z.ZodEnum<{
72
+ LIVE_PROOF_PENDING: "LIVE_PROOF_PENDING";
73
+ VERIFIED_SUPPORTED: "VERIFIED_SUPPORTED";
74
+ VERIFIED_UNSUPPORTED: "VERIFIED_UNSUPPORTED";
75
+ }>;
76
+ }, z.core.$strict>;
77
+ retryAfterSeconds: z.ZodNumber;
78
+ sanitizedDetail: z.ZodString;
79
+ deliveryPolicy: z.ZodObject<{
80
+ cacheControl: z.ZodLiteral<"private, no-store">;
81
+ maxBytes: z.ZodNumber;
82
+ timeoutMilliseconds: z.ZodNumber;
83
+ }, z.core.$strict>;
84
+ }, z.core.$strict>, z.ZodObject<{
85
+ status: z.ZodLiteral<"DISABLED">;
86
+ runId: z.ZodString;
87
+ sessionId: z.ZodString;
88
+ capability: z.ZodDiscriminatedUnion<[z.ZodObject<{
89
+ status: z.ZodLiteral<"LIVE_PROOF_PENDING">;
90
+ evidenceRef: z.ZodNull;
91
+ sanitizedReason: z.ZodString;
92
+ }, z.core.$strict>, z.ZodObject<{
93
+ status: z.ZodLiteral<"SUPPORTED">;
94
+ verifiedAt: z.ZodISODateTime;
95
+ evidenceRef: z.ZodString;
96
+ byteRangeSupport: z.ZodEnum<{
97
+ LIVE_PROOF_PENDING: "LIVE_PROOF_PENDING";
98
+ VERIFIED_SUPPORTED: "VERIFIED_SUPPORTED";
99
+ VERIFIED_UNSUPPORTED: "VERIFIED_UNSUPPORTED";
100
+ }>;
101
+ }, z.core.$strict>, z.ZodObject<{
102
+ status: z.ZodLiteral<"DEFERRED">;
103
+ decidedAt: z.ZodISODateTime;
104
+ evidenceRef: z.ZodString;
105
+ sanitizedReason: z.ZodString;
106
+ }, z.core.$strict>], "status">;
107
+ sanitizedDetail: z.ZodString;
108
+ deliveryPolicy: z.ZodObject<{
109
+ cacheControl: z.ZodLiteral<"private, no-store">;
110
+ maxBytes: z.ZodNumber;
111
+ timeoutMilliseconds: z.ZodNumber;
112
+ }, z.core.$strict>;
113
+ }, z.core.$strict>, z.ZodObject<{
114
+ status: z.ZodLiteral<"UNAVAILABLE">;
115
+ runId: z.ZodString;
116
+ sessionId: z.ZodString;
117
+ capability: z.ZodObject<{
118
+ status: z.ZodLiteral<"SUPPORTED">;
119
+ verifiedAt: z.ZodISODateTime;
120
+ evidenceRef: z.ZodString;
121
+ byteRangeSupport: z.ZodEnum<{
122
+ LIVE_PROOF_PENDING: "LIVE_PROOF_PENDING";
123
+ VERIFIED_SUPPORTED: "VERIFIED_SUPPORTED";
124
+ VERIFIED_UNSUPPORTED: "VERIFIED_UNSUPPORTED";
125
+ }>;
126
+ }, z.core.$strict>;
127
+ reason: z.ZodEnum<{
128
+ PROVIDER_OUTAGE: "PROVIDER_OUTAGE";
129
+ NOT_FOUND: "NOT_FOUND";
130
+ UNVERIFIED_BINDING: "UNVERIFIED_BINDING";
131
+ TOO_LARGE: "TOO_LARGE";
132
+ UNSUPPORTED_CONTENT_TYPE: "UNSUPPORTED_CONTENT_TYPE";
133
+ TEMPORARY_FAILURE: "TEMPORARY_FAILURE";
134
+ }>;
135
+ sanitizedDetail: z.ZodString;
136
+ deliveryPolicy: z.ZodObject<{
137
+ cacheControl: z.ZodLiteral<"private, no-store">;
138
+ maxBytes: z.ZodNumber;
139
+ timeoutMilliseconds: z.ZodNumber;
140
+ }, z.core.$strict>;
141
+ }, z.core.$strict>, z.ZodObject<{
142
+ status: z.ZodLiteral<"DEFERRED">;
143
+ runId: z.ZodString;
144
+ sessionId: z.ZodString;
145
+ capability: z.ZodObject<{
146
+ status: z.ZodLiteral<"DEFERRED">;
147
+ decidedAt: z.ZodISODateTime;
148
+ evidenceRef: z.ZodString;
149
+ sanitizedReason: z.ZodString;
150
+ }, z.core.$strict>;
151
+ deliveryPolicy: z.ZodObject<{
152
+ cacheControl: z.ZodLiteral<"private, no-store">;
153
+ maxBytes: z.ZodNumber;
154
+ timeoutMilliseconds: z.ZodNumber;
155
+ }, z.core.$strict>;
156
+ }, z.core.$strict>], "status">;
157
+ export type VoiceAudioReadResponse = z.infer<typeof voiceAudioReadResponseSchema>;
@@ -0,0 +1,85 @@
1
+ import { z } from 'zod';
2
+ import { voiceAgentScopeSchema, voiceIdSchema, voiceTimestampSchema } from './voice-common.js';
3
+ import { voiceRunSanitizedTextSchema } from './voice-runs-evidence.js';
4
+ const deliveryPolicySchema = z.strictObject({
5
+ cacheControl: z.literal('private, no-store'),
6
+ maxBytes: z.number().int().positive().max(100_000_000).safe(),
7
+ timeoutMilliseconds: z.number().int().positive().max(60_000).safe(),
8
+ });
9
+ const supportedCapability = z.strictObject({
10
+ status: z.literal('SUPPORTED'),
11
+ verifiedAt: voiceTimestampSchema,
12
+ evidenceRef: z.string().trim().min(1).max(500),
13
+ byteRangeSupport: z.enum([
14
+ 'LIVE_PROOF_PENDING', 'VERIFIED_SUPPORTED', 'VERIFIED_UNSUPPORTED',
15
+ ]),
16
+ });
17
+ const deferredCapability = z.strictObject({
18
+ status: z.literal('DEFERRED'),
19
+ decidedAt: voiceTimestampSchema,
20
+ evidenceRef: z.string().trim().min(1).max(500),
21
+ sanitizedReason: voiceRunSanitizedTextSchema,
22
+ });
23
+ export const voiceAudioCapabilitySchema = z.discriminatedUnion('status', [
24
+ z.strictObject({
25
+ status: z.literal('LIVE_PROOF_PENDING'), evidenceRef: z.null(),
26
+ sanitizedReason: voiceRunSanitizedTextSchema,
27
+ }),
28
+ supportedCapability,
29
+ deferredCapability,
30
+ ]);
31
+ const byteRangeSchema = z.strictObject({
32
+ startByte: z.number().int().nonnegative().safe(),
33
+ endByte: z.number().int().nonnegative().safe().nullable(),
34
+ }).refine((value) => value.endByte === null || value.endByte >= value.startByte, {
35
+ message: 'endByte cannot precede startByte',
36
+ });
37
+ export const voiceAudioReadRequestSchema = z.strictObject({
38
+ scope: voiceAgentScopeSchema,
39
+ runId: voiceIdSchema,
40
+ expectedSessionId: voiceIdSchema,
41
+ byteRange: byteRangeSchema.nullable(),
42
+ });
43
+ export const voiceAudioReadResponseSchema = z.discriminatedUnion('status', [
44
+ z.strictObject({
45
+ status: z.literal('AVAILABLE'), runId: voiceIdSchema, sessionId: voiceIdSchema,
46
+ capability: supportedCapability, delivery: z.literal('ATLAS_AUTHORIZED_STREAM'),
47
+ contentType: z.enum(['audio/mpeg', 'audio/wav', 'audio/ogg', 'audio/webm']),
48
+ contentLengthBytes: z.number().int().nonnegative().safe(),
49
+ deliveryPolicy: deliveryPolicySchema,
50
+ }),
51
+ z.strictObject({
52
+ status: z.literal('PENDING'), runId: voiceIdSchema, sessionId: voiceIdSchema,
53
+ capability: supportedCapability,
54
+ retryAfterSeconds: z.number().int().positive().max(60).safe(),
55
+ sanitizedDetail: voiceRunSanitizedTextSchema,
56
+ deliveryPolicy: deliveryPolicySchema,
57
+ }),
58
+ z.strictObject({
59
+ status: z.literal('DISABLED'), runId: voiceIdSchema, sessionId: voiceIdSchema,
60
+ capability: voiceAudioCapabilitySchema, sanitizedDetail: voiceRunSanitizedTextSchema,
61
+ deliveryPolicy: deliveryPolicySchema,
62
+ }),
63
+ z.strictObject({
64
+ status: z.literal('UNAVAILABLE'), runId: voiceIdSchema, sessionId: voiceIdSchema,
65
+ capability: supportedCapability,
66
+ reason: z.enum([
67
+ 'PROVIDER_OUTAGE', 'NOT_FOUND', 'UNVERIFIED_BINDING', 'TOO_LARGE',
68
+ 'UNSUPPORTED_CONTENT_TYPE', 'TEMPORARY_FAILURE',
69
+ ]),
70
+ sanitizedDetail: voiceRunSanitizedTextSchema,
71
+ deliveryPolicy: deliveryPolicySchema,
72
+ }),
73
+ z.strictObject({
74
+ status: z.literal('DEFERRED'), runId: voiceIdSchema, sessionId: voiceIdSchema,
75
+ capability: deferredCapability, deliveryPolicy: deliveryPolicySchema,
76
+ }),
77
+ ]).superRefine((value, context) => {
78
+ if (value.status === 'AVAILABLE' &&
79
+ value.contentLengthBytes > value.deliveryPolicy.maxBytes) {
80
+ context.addIssue({
81
+ code: 'custom', path: ['contentLengthBytes'],
82
+ message: 'audio content exceeds the authorized response bound',
83
+ });
84
+ }
85
+ });
@@ -0,0 +1,183 @@
1
+ import { z } from 'zod';
2
+ export declare const voiceRunSanitizedTextSchema: z.ZodString;
3
+ export declare const voiceBoundedRunEvidenceValueSchema: z.ZodJSONSchema;
4
+ export declare const voiceDetailedRunEvidenceValueSchema: z.ZodJSONSchema;
5
+ export declare const voiceTranscriptEntrySchema: z.ZodObject<{
6
+ sequence: z.ZodNumber;
7
+ speaker: z.ZodEnum<{
8
+ AGENT: "AGENT";
9
+ CALLER: "CALLER";
10
+ TOOL: "TOOL";
11
+ SYSTEM: "SYSTEM";
12
+ }>;
13
+ text: z.ZodString;
14
+ startedAt: z.ZodNullable<z.ZodISODateTime>;
15
+ endedAt: z.ZodNullable<z.ZodISODateTime>;
16
+ }, z.core.$strict>;
17
+ export declare const voiceTranscriptSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
18
+ status: z.ZodLiteral<"AVAILABLE">;
19
+ transcriptReferenceId: z.ZodString;
20
+ capturedAt: z.ZodISODateTime;
21
+ entries: z.ZodArray<z.ZodObject<{
22
+ sequence: z.ZodNumber;
23
+ speaker: z.ZodEnum<{
24
+ AGENT: "AGENT";
25
+ CALLER: "CALLER";
26
+ TOOL: "TOOL";
27
+ SYSTEM: "SYSTEM";
28
+ }>;
29
+ text: z.ZodString;
30
+ startedAt: z.ZodNullable<z.ZodISODateTime>;
31
+ endedAt: z.ZodNullable<z.ZodISODateTime>;
32
+ }, z.core.$strict>>;
33
+ sanitizedDetail: z.ZodNull;
34
+ }, z.core.$strict>, z.ZodObject<{
35
+ status: z.ZodEnum<{
36
+ MISSING: "MISSING";
37
+ PENDING: "PENDING";
38
+ }>;
39
+ transcriptReferenceId: z.ZodNull;
40
+ capturedAt: z.ZodNullable<z.ZodISODateTime>;
41
+ entries: z.ZodArray<z.ZodObject<{
42
+ sequence: z.ZodNumber;
43
+ speaker: z.ZodEnum<{
44
+ AGENT: "AGENT";
45
+ CALLER: "CALLER";
46
+ TOOL: "TOOL";
47
+ SYSTEM: "SYSTEM";
48
+ }>;
49
+ text: z.ZodString;
50
+ startedAt: z.ZodNullable<z.ZodISODateTime>;
51
+ endedAt: z.ZodNullable<z.ZodISODateTime>;
52
+ }, z.core.$strict>>;
53
+ sanitizedDetail: z.ZodString;
54
+ }, z.core.$strict>, z.ZodObject<{
55
+ status: z.ZodLiteral<"CONTRADICTORY">;
56
+ transcriptReferenceId: z.ZodNullable<z.ZodString>;
57
+ capturedAt: z.ZodNullable<z.ZodISODateTime>;
58
+ entries: z.ZodArray<z.ZodObject<{
59
+ sequence: z.ZodNumber;
60
+ speaker: z.ZodEnum<{
61
+ AGENT: "AGENT";
62
+ CALLER: "CALLER";
63
+ TOOL: "TOOL";
64
+ SYSTEM: "SYSTEM";
65
+ }>;
66
+ text: z.ZodString;
67
+ startedAt: z.ZodNullable<z.ZodISODateTime>;
68
+ endedAt: z.ZodNullable<z.ZodISODateTime>;
69
+ }, z.core.$strict>>;
70
+ sanitizedDetail: z.ZodString;
71
+ }, z.core.$strict>], "status">;
72
+ export type VoiceTranscript = z.infer<typeof voiceTranscriptSchema>;
73
+ export declare const voiceCompletionEventKindSchema: z.ZodLiteral<"CALL_COMPLETED">;
74
+ export type VoiceCompletionEventKind = z.infer<typeof voiceCompletionEventKindSchema>;
75
+ export declare const voiceLogicalCompletionEventIdentitySchema: z.ZodObject<{
76
+ sessionId: z.ZodString;
77
+ kind: z.ZodLiteral<"CALL_COMPLETED">;
78
+ }, z.core.$strict>;
79
+ export type VoiceLogicalCompletionEventIdentity = z.infer<typeof voiceLogicalCompletionEventIdentitySchema>;
80
+ export declare function voiceLogicalCompletionEventKey({ sessionId, kind }: VoiceLogicalCompletionEventIdentity): string;
81
+ export declare const voiceCompletionEventSchema: z.ZodObject<{
82
+ eventId: z.ZodString;
83
+ logicalIdentity: z.ZodObject<{
84
+ sessionId: z.ZodString;
85
+ kind: z.ZodLiteral<"CALL_COMPLETED">;
86
+ }, z.core.$strict>;
87
+ providerDeliveryIds: z.ZodArray<z.ZodString>;
88
+ evidenceStatus: z.ZodEnum<{
89
+ CONTRADICTORY: "CONTRADICTORY";
90
+ PENDING: "PENDING";
91
+ CONFIRMED: "CONFIRMED";
92
+ }>;
93
+ persistedAt: z.ZodISODateTime;
94
+ providerConversationId: z.ZodNullable<z.ZodString>;
95
+ }, z.core.$strict>;
96
+ export type VoiceCompletionEvent = z.infer<typeof voiceCompletionEventSchema>;
97
+ export declare const voiceTelephoneOutcomeSchema: z.ZodEnum<{
98
+ FAILED: "FAILED";
99
+ COMPLETED: "COMPLETED";
100
+ UNKNOWN: "UNKNOWN";
101
+ CANCELLED: "CANCELLED";
102
+ }>;
103
+ export declare const voiceBusinessOutcomeSchema: z.ZodEnum<{
104
+ FAILED: "FAILED";
105
+ SUCCEEDED: "SUCCEEDED";
106
+ UNKNOWN: "UNKNOWN";
107
+ PARTIAL: "PARTIAL";
108
+ NOT_REQUESTED: "NOT_REQUESTED";
109
+ }>;
110
+ export declare const voiceRunWritebackStatusSchema: z.ZodEnum<{
111
+ FAILED: "FAILED";
112
+ RECONCILIATION_REQUIRED: "RECONCILIATION_REQUIRED";
113
+ COMPLETE: "COMPLETE";
114
+ PENDING: "PENDING";
115
+ }>;
116
+ export declare const voiceRunEvidenceStatusSchema: z.ZodEnum<{
117
+ COMPLETE: "COMPLETE";
118
+ INCOMPLETE: "INCOMPLETE";
119
+ CONTRADICTORY: "CONTRADICTORY";
120
+ PENDING: "PENDING";
121
+ }>;
122
+ export declare const voiceSyntheticResourceEvidenceSchema: z.ZodObject<{
123
+ candidate: z.ZodNullable<z.ZodObject<{
124
+ fixtureId: z.ZodString;
125
+ syntheticResource: z.ZodObject<{
126
+ kind: z.ZodString;
127
+ id: z.ZodString;
128
+ }, z.core.$strict>;
129
+ }, z.core.$strict>>;
130
+ verifiedResource: z.ZodNullable<z.ZodObject<{
131
+ kind: z.ZodString;
132
+ id: z.ZodString;
133
+ }, z.core.$strict>>;
134
+ verificationStatus: z.ZodEnum<{
135
+ FAILED: "FAILED";
136
+ UNKNOWN: "UNKNOWN";
137
+ VERIFIED: "VERIFIED";
138
+ NOT_VERIFIED: "NOT_VERIFIED";
139
+ LOCKED: "LOCKED";
140
+ EXPIRED: "EXPIRED";
141
+ REVOKED: "REVOKED";
142
+ }>;
143
+ }, z.core.$strict>;
144
+ export declare const voiceRunEvidenceRetentionSchema: z.ZodObject<{
145
+ policy: z.ZodLiteral<"UNLIMITED">;
146
+ ageBasedExpiry: z.ZodLiteral<false>;
147
+ appliesTo: z.ZodTuple<[z.ZodLiteral<"TRANSCRIPT">, z.ZodLiteral<"TOOL_EVIDENCE">, z.ZodLiteral<"COMPLETION_EVENT">, z.ZodLiteral<"RUN_METADATA">, z.ZodLiteral<"RECORDING">], null>;
148
+ }, z.core.$strict>;
149
+ export type VoiceRunEvidenceRetention = z.infer<typeof voiceRunEvidenceRetentionSchema>;
150
+ export declare const voiceRunRecordingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
151
+ status: z.ZodLiteral<"DISABLED">;
152
+ enabled: z.ZodLiteral<false>;
153
+ providerRetention: z.ZodNull;
154
+ sanitizedDetail: z.ZodString;
155
+ }, z.core.$strict>, z.ZodObject<{
156
+ status: z.ZodLiteral<"PENDING">;
157
+ enabled: z.ZodLiteral<true>;
158
+ providerRetention: z.ZodObject<{
159
+ policy: z.ZodLiteral<"UNLIMITED">;
160
+ providerRetentionDays: z.ZodLiteral<-1>;
161
+ evidenceRef: z.ZodString;
162
+ }, z.core.$strict>;
163
+ sanitizedDetail: z.ZodNullable<z.ZodString>;
164
+ }, z.core.$strict>, z.ZodObject<{
165
+ status: z.ZodLiteral<"AVAILABLE">;
166
+ enabled: z.ZodLiteral<true>;
167
+ providerRetention: z.ZodObject<{
168
+ policy: z.ZodLiteral<"UNLIMITED">;
169
+ providerRetentionDays: z.ZodLiteral<-1>;
170
+ evidenceRef: z.ZodString;
171
+ }, z.core.$strict>;
172
+ sanitizedDetail: z.ZodNull;
173
+ }, z.core.$strict>, z.ZodObject<{
174
+ status: z.ZodLiteral<"UNAVAILABLE">;
175
+ enabled: z.ZodLiteral<true>;
176
+ providerRetention: z.ZodObject<{
177
+ policy: z.ZodLiteral<"UNLIMITED">;
178
+ providerRetentionDays: z.ZodLiteral<-1>;
179
+ evidenceRef: z.ZodString;
180
+ }, z.core.$strict>;
181
+ sanitizedDetail: z.ZodString;
182
+ }, z.core.$strict>], "status">;
183
+ export type VoiceRunRecording = z.infer<typeof voiceRunRecordingSchema>;