@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,57 @@
1
+ import { z } from 'zod';
2
+ const inputFieldSchema = z
3
+ .object({
4
+ name: z
5
+ .string()
6
+ .min(1)
7
+ .regex(/^[A-Za-z_][A-Za-z0-9_]*$/, 'name must be a valid identifier'),
8
+ label: z.string().optional(),
9
+ description: z.string().optional(),
10
+ type: z.enum(['string', 'text', 'number', 'boolean', 'enum']),
11
+ required: z.boolean().optional(),
12
+ default: z.union([z.string(), z.number(), z.boolean()]).optional(),
13
+ enum: z.array(z.string()).optional(),
14
+ placeholder: z.string().optional(),
15
+ })
16
+ .superRefine((field, context) => {
17
+ if (field.type === 'enum') {
18
+ if (field.enum === undefined || field.enum.length === 0) {
19
+ context.addIssue({
20
+ code: 'custom',
21
+ path: ['enum'],
22
+ message: 'enum fields require at least one option',
23
+ });
24
+ }
25
+ if (field.default !== undefined &&
26
+ (typeof field.default !== 'string' ||
27
+ !field.enum?.includes(field.default))) {
28
+ context.addIssue({
29
+ code: 'custom',
30
+ path: ['default'],
31
+ message: 'default must be one of the declared enum options',
32
+ });
33
+ }
34
+ return;
35
+ }
36
+ if (field.default === undefined)
37
+ return;
38
+ const expected = field.type === 'number'
39
+ ? 'number'
40
+ : field.type === 'boolean'
41
+ ? 'boolean'
42
+ : 'string';
43
+ if (typeof field.default !== expected) {
44
+ context.addIssue({
45
+ code: 'custom',
46
+ path: ['default'],
47
+ message: `default for ${field.type} fields must be a ${expected}`,
48
+ });
49
+ }
50
+ });
51
+ export const inputSchemaSchema = z
52
+ .object({ fields: z.array(inputFieldSchema) })
53
+ .refine((schema) => new Set(schema.fields.map((field) => field.name)).size ===
54
+ schema.fields.length, {
55
+ path: ['fields'],
56
+ message: 'fields[].name must be unique within an inputSchema',
57
+ });
@@ -0,0 +1,40 @@
1
+ import { z } from 'zod';
2
+ import { type VoiceScope } from './voice-common.js';
3
+ export declare const voiceParticipantPolicySchema: z.ZodObject<{
4
+ tenantId: z.ZodString;
5
+ environmentId: z.ZodString;
6
+ revision: z.ZodNumber;
7
+ participantPrincipalIds: z.ZodArray<z.ZodString>;
8
+ operatorPrincipalIds: z.ZodArray<z.ZodString>;
9
+ updatedByPrincipalId: z.ZodString;
10
+ updatedAt: z.ZodISODateTime;
11
+ }, z.core.$strict>;
12
+ export type VoiceParticipantPolicy = z.infer<typeof voiceParticipantPolicySchema>;
13
+ export declare function isVoiceContextEligible({ featureEnabled, scope, eligibleScope }: {
14
+ featureEnabled: boolean;
15
+ scope: VoiceScope;
16
+ eligibleScope: unknown;
17
+ }): boolean;
18
+ export declare const voiceOutboundDestinationSchema: z.ZodObject<{
19
+ tenantId: z.ZodString;
20
+ environmentId: z.ZodString;
21
+ destinationId: z.ZodString;
22
+ staffPrincipalId: z.ZodString;
23
+ phoneNumberE164: z.ZodString;
24
+ registeredByPrincipalId: z.ZodString;
25
+ verifiedAt: z.ZodISODateTime;
26
+ enabled: z.ZodBoolean;
27
+ }, z.core.$strict>;
28
+ export type VoiceOutboundDestination = z.infer<typeof voiceOutboundDestinationSchema>;
29
+ export declare const voiceEnvironmentBindingsSchema: z.ZodObject<{
30
+ tenantId: z.ZodString;
31
+ environmentId: z.ZodString;
32
+ runtimeAccountId: z.ZodString;
33
+ syntheticNamespaceRef: z.ZodString;
34
+ elevenLabsWorkspaceId: z.ZodString;
35
+ elevenLabsCredentialRef: z.ZodString;
36
+ twilioSubaccountSid: z.ZodString;
37
+ twilioCredentialRef: z.ZodString;
38
+ twilioRecordingEnabled: z.ZodLiteral<false>;
39
+ }, z.core.$strict>;
40
+ export type VoiceEnvironmentBindings = z.infer<typeof voiceEnvironmentBindingsSchema>;
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { voiceIdSchema, voiceRevisionSchema, voiceScopeSchema, voiceTimestampSchema } from './voice-common.js';
3
+ const principalIdsSchema = z.array(voiceIdSchema).max(200)
4
+ .refine((ids) => new Set(ids).size === ids.length, 'Duplicate principal ID');
5
+ export const voiceParticipantPolicySchema = voiceScopeSchema.extend({
6
+ revision: voiceRevisionSchema,
7
+ participantPrincipalIds: principalIdsSchema,
8
+ operatorPrincipalIds: principalIdsSchema,
9
+ updatedByPrincipalId: voiceIdSchema,
10
+ updatedAt: voiceTimestampSchema,
11
+ }).refine((policy) => policy.operatorPrincipalIds.every((id) => policy.participantPrincipalIds.includes(id)), { path: ['operatorPrincipalIds'], message: 'Operators must also be explicit participants' });
12
+ export function isVoiceContextEligible({ featureEnabled, scope, eligibleScope }) {
13
+ if (!featureEnabled)
14
+ return false;
15
+ const parsed = voiceScopeSchema.safeParse(eligibleScope);
16
+ return parsed.success && parsed.data.tenantId === scope.tenantId && parsed.data.environmentId === scope.environmentId;
17
+ }
18
+ export const voiceOutboundDestinationSchema = voiceScopeSchema.extend({
19
+ destinationId: voiceIdSchema,
20
+ staffPrincipalId: voiceIdSchema,
21
+ phoneNumberE164: z.string().regex(/^\+[1-9]\d{1,14}$/),
22
+ registeredByPrincipalId: voiceIdSchema,
23
+ verifiedAt: voiceTimestampSchema,
24
+ enabled: z.boolean(),
25
+ });
26
+ export const voiceEnvironmentBindingsSchema = voiceScopeSchema.extend({
27
+ runtimeAccountId: voiceIdSchema,
28
+ syntheticNamespaceRef: voiceIdSchema,
29
+ elevenLabsWorkspaceId: voiceIdSchema,
30
+ elevenLabsCredentialRef: voiceIdSchema,
31
+ twilioSubaccountSid: voiceIdSchema,
32
+ twilioCredentialRef: voiceIdSchema,
33
+ twilioRecordingEnabled: z.literal(false),
34
+ });
@@ -0,0 +1,423 @@
1
+ import { z } from 'zod';
2
+ export declare const voiceActionAuthoritySubjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ kind: z.ZodLiteral<"verified_resource">;
4
+ resource: z.ZodObject<{
5
+ kind: z.ZodString;
6
+ id: z.ZodString;
7
+ }, z.core.$strict>;
8
+ verificationId: z.ZodString;
9
+ }, z.core.$strict>, z.ZodObject<{
10
+ kind: z.ZodLiteral<"unverified">;
11
+ }, z.core.$strict>], "kind">;
12
+ export type VoiceActionAuthoritySubject = z.infer<typeof voiceActionAuthoritySubjectSchema>;
13
+ export declare const voiceActionIntentBindingSchema: z.ZodObject<{
14
+ intentId: z.ZodString;
15
+ subject: z.ZodObject<{
16
+ tenantId: z.ZodString;
17
+ environmentId: z.ZodString;
18
+ agentId: z.ZodString;
19
+ sessionId: z.ZodString;
20
+ releaseId: z.ZodString;
21
+ }, z.core.$strict>;
22
+ actionAlias: z.ZodString;
23
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
24
+ kind: z.ZodLiteral<"verified_resource">;
25
+ resource: z.ZodObject<{
26
+ kind: z.ZodString;
27
+ id: z.ZodString;
28
+ }, z.core.$strict>;
29
+ verificationId: z.ZodString;
30
+ }, z.core.$strict>, z.ZodObject<{
31
+ kind: z.ZodLiteral<"unverified">;
32
+ }, z.core.$strict>], "kind">;
33
+ argumentDigest: z.ZodString;
34
+ }, z.core.$strict>;
35
+ export type VoiceActionIntentBinding = z.infer<typeof voiceActionIntentBindingSchema>;
36
+ export declare const voicePrepareActionRequestSchema: z.ZodObject<{
37
+ binding: z.ZodObject<{
38
+ intentId: z.ZodString;
39
+ subject: z.ZodObject<{
40
+ tenantId: z.ZodString;
41
+ environmentId: z.ZodString;
42
+ agentId: z.ZodString;
43
+ sessionId: z.ZodString;
44
+ releaseId: z.ZodString;
45
+ }, z.core.$strict>;
46
+ actionAlias: z.ZodString;
47
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
48
+ kind: z.ZodLiteral<"verified_resource">;
49
+ resource: z.ZodObject<{
50
+ kind: z.ZodString;
51
+ id: z.ZodString;
52
+ }, z.core.$strict>;
53
+ verificationId: z.ZodString;
54
+ }, z.core.$strict>, z.ZodObject<{
55
+ kind: z.ZodLiteral<"unverified">;
56
+ }, z.core.$strict>], "kind">;
57
+ argumentDigest: z.ZodString;
58
+ }, z.core.$strict>;
59
+ confirmationSummary: z.ZodString;
60
+ preparedAt: z.ZodISODateTime;
61
+ expiresAt: z.ZodISODateTime;
62
+ }, z.core.$strict>;
63
+ export type VoicePrepareActionRequest = z.infer<typeof voicePrepareActionRequestSchema>;
64
+ export declare const voiceConfirmActionRequestSchema: z.ZodObject<{
65
+ binding: z.ZodObject<{
66
+ intentId: z.ZodString;
67
+ subject: z.ZodObject<{
68
+ tenantId: z.ZodString;
69
+ environmentId: z.ZodString;
70
+ agentId: z.ZodString;
71
+ sessionId: z.ZodString;
72
+ releaseId: z.ZodString;
73
+ }, z.core.$strict>;
74
+ actionAlias: z.ZodString;
75
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
76
+ kind: z.ZodLiteral<"verified_resource">;
77
+ resource: z.ZodObject<{
78
+ kind: z.ZodString;
79
+ id: z.ZodString;
80
+ }, z.core.$strict>;
81
+ verificationId: z.ZodString;
82
+ }, z.core.$strict>, z.ZodObject<{
83
+ kind: z.ZodLiteral<"unverified">;
84
+ }, z.core.$strict>], "kind">;
85
+ argumentDigest: z.ZodString;
86
+ }, z.core.$strict>;
87
+ requestedAt: z.ZodISODateTime;
88
+ }, z.core.$strict>;
89
+ export type VoiceConfirmActionRequest = z.infer<typeof voiceConfirmActionRequestSchema>;
90
+ export declare const voiceCancelActionRequestSchema: z.ZodObject<{
91
+ binding: z.ZodObject<{
92
+ intentId: z.ZodString;
93
+ subject: z.ZodObject<{
94
+ tenantId: z.ZodString;
95
+ environmentId: z.ZodString;
96
+ agentId: z.ZodString;
97
+ sessionId: z.ZodString;
98
+ releaseId: z.ZodString;
99
+ }, z.core.$strict>;
100
+ actionAlias: z.ZodString;
101
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
102
+ kind: z.ZodLiteral<"verified_resource">;
103
+ resource: z.ZodObject<{
104
+ kind: z.ZodString;
105
+ id: z.ZodString;
106
+ }, z.core.$strict>;
107
+ verificationId: z.ZodString;
108
+ }, z.core.$strict>, z.ZodObject<{
109
+ kind: z.ZodLiteral<"unverified">;
110
+ }, z.core.$strict>], "kind">;
111
+ argumentDigest: z.ZodString;
112
+ }, z.core.$strict>;
113
+ requestedAt: z.ZodISODateTime;
114
+ }, z.core.$strict>;
115
+ export type VoiceCancelActionRequest = z.infer<typeof voiceCancelActionRequestSchema>;
116
+ export declare const voicePreparedActionIntentSchema: z.ZodObject<{
117
+ intentId: z.ZodString;
118
+ subject: z.ZodObject<{
119
+ tenantId: z.ZodString;
120
+ environmentId: z.ZodString;
121
+ agentId: z.ZodString;
122
+ sessionId: z.ZodString;
123
+ releaseId: z.ZodString;
124
+ }, z.core.$strict>;
125
+ actionAlias: z.ZodString;
126
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
127
+ kind: z.ZodLiteral<"verified_resource">;
128
+ resource: z.ZodObject<{
129
+ kind: z.ZodString;
130
+ id: z.ZodString;
131
+ }, z.core.$strict>;
132
+ verificationId: z.ZodString;
133
+ }, z.core.$strict>, z.ZodObject<{
134
+ kind: z.ZodLiteral<"unverified">;
135
+ }, z.core.$strict>], "kind">;
136
+ argumentDigest: z.ZodString;
137
+ state: z.ZodLiteral<"prepared">;
138
+ confirmationSummary: z.ZodString;
139
+ preparedAt: z.ZodISODateTime;
140
+ expiresAt: z.ZodISODateTime;
141
+ }, z.core.$strict>;
142
+ export type VoicePreparedActionIntent = z.infer<typeof voicePreparedActionIntentSchema>;
143
+ export declare const voiceUncertainActionIntentSchema: z.ZodObject<{
144
+ intentId: z.ZodString;
145
+ subject: z.ZodObject<{
146
+ tenantId: z.ZodString;
147
+ environmentId: z.ZodString;
148
+ agentId: z.ZodString;
149
+ sessionId: z.ZodString;
150
+ releaseId: z.ZodString;
151
+ }, z.core.$strict>;
152
+ actionAlias: z.ZodString;
153
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
154
+ kind: z.ZodLiteral<"verified_resource">;
155
+ resource: z.ZodObject<{
156
+ kind: z.ZodString;
157
+ id: z.ZodString;
158
+ }, z.core.$strict>;
159
+ verificationId: z.ZodString;
160
+ }, z.core.$strict>, z.ZodObject<{
161
+ kind: z.ZodLiteral<"unverified">;
162
+ }, z.core.$strict>], "kind">;
163
+ argumentDigest: z.ZodString;
164
+ state: z.ZodLiteral<"uncertain">;
165
+ confirmationSummary: z.ZodString;
166
+ preparedAt: z.ZodISODateTime;
167
+ expiresAt: z.ZodISODateTime;
168
+ dispatchAttemptId: z.ZodString;
169
+ uncertainAt: z.ZodISODateTime;
170
+ }, z.core.$strict>;
171
+ export type VoiceUncertainActionIntent = z.infer<typeof voiceUncertainActionIntentSchema>;
172
+ export declare const voiceCommittedActionReceiptSchema: z.ZodObject<{
173
+ intentId: z.ZodString;
174
+ subject: z.ZodObject<{
175
+ tenantId: z.ZodString;
176
+ environmentId: z.ZodString;
177
+ agentId: z.ZodString;
178
+ sessionId: z.ZodString;
179
+ releaseId: z.ZodString;
180
+ }, z.core.$strict>;
181
+ actionAlias: z.ZodString;
182
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
183
+ kind: z.ZodLiteral<"verified_resource">;
184
+ resource: z.ZodObject<{
185
+ kind: z.ZodString;
186
+ id: z.ZodString;
187
+ }, z.core.$strict>;
188
+ verificationId: z.ZodString;
189
+ }, z.core.$strict>, z.ZodObject<{
190
+ kind: z.ZodLiteral<"unverified">;
191
+ }, z.core.$strict>], "kind">;
192
+ argumentDigest: z.ZodString;
193
+ state: z.ZodLiteral<"committed">;
194
+ receiptId: z.ZodString;
195
+ resultDigest: z.ZodString;
196
+ resultStatus: z.ZodString;
197
+ committedAt: z.ZodISODateTime;
198
+ }, z.core.$strict>;
199
+ export type VoiceCommittedActionReceipt = z.infer<typeof voiceCommittedActionReceiptSchema>;
200
+ export declare const voiceCancelledActionReceiptSchema: z.ZodObject<{
201
+ intentId: z.ZodString;
202
+ subject: z.ZodObject<{
203
+ tenantId: z.ZodString;
204
+ environmentId: z.ZodString;
205
+ agentId: z.ZodString;
206
+ sessionId: z.ZodString;
207
+ releaseId: z.ZodString;
208
+ }, z.core.$strict>;
209
+ actionAlias: z.ZodString;
210
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
211
+ kind: z.ZodLiteral<"verified_resource">;
212
+ resource: z.ZodObject<{
213
+ kind: z.ZodString;
214
+ id: z.ZodString;
215
+ }, z.core.$strict>;
216
+ verificationId: z.ZodString;
217
+ }, z.core.$strict>, z.ZodObject<{
218
+ kind: z.ZodLiteral<"unverified">;
219
+ }, z.core.$strict>], "kind">;
220
+ argumentDigest: z.ZodString;
221
+ state: z.ZodLiteral<"cancelled">;
222
+ cancellationReceiptId: z.ZodString;
223
+ cancellationResolution: z.ZodEnum<{
224
+ local_before_dispatch: "local_before_dispatch";
225
+ confirmed_not_committed: "confirmed_not_committed";
226
+ }>;
227
+ cancelledAt: z.ZodISODateTime;
228
+ }, z.core.$strict>;
229
+ export type VoiceCancelledActionReceipt = z.infer<typeof voiceCancelledActionReceiptSchema>;
230
+ export declare const voiceActionIntentStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
231
+ intentId: z.ZodString;
232
+ subject: z.ZodObject<{
233
+ tenantId: z.ZodString;
234
+ environmentId: z.ZodString;
235
+ agentId: z.ZodString;
236
+ sessionId: z.ZodString;
237
+ releaseId: z.ZodString;
238
+ }, z.core.$strict>;
239
+ actionAlias: z.ZodString;
240
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
241
+ kind: z.ZodLiteral<"verified_resource">;
242
+ resource: z.ZodObject<{
243
+ kind: z.ZodString;
244
+ id: z.ZodString;
245
+ }, z.core.$strict>;
246
+ verificationId: z.ZodString;
247
+ }, z.core.$strict>, z.ZodObject<{
248
+ kind: z.ZodLiteral<"unverified">;
249
+ }, z.core.$strict>], "kind">;
250
+ argumentDigest: z.ZodString;
251
+ state: z.ZodLiteral<"prepared">;
252
+ confirmationSummary: z.ZodString;
253
+ preparedAt: z.ZodISODateTime;
254
+ expiresAt: z.ZodISODateTime;
255
+ }, z.core.$strict>, z.ZodObject<{
256
+ intentId: z.ZodString;
257
+ subject: z.ZodObject<{
258
+ tenantId: z.ZodString;
259
+ environmentId: z.ZodString;
260
+ agentId: z.ZodString;
261
+ sessionId: z.ZodString;
262
+ releaseId: z.ZodString;
263
+ }, z.core.$strict>;
264
+ actionAlias: z.ZodString;
265
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
266
+ kind: z.ZodLiteral<"verified_resource">;
267
+ resource: z.ZodObject<{
268
+ kind: z.ZodString;
269
+ id: z.ZodString;
270
+ }, z.core.$strict>;
271
+ verificationId: z.ZodString;
272
+ }, z.core.$strict>, z.ZodObject<{
273
+ kind: z.ZodLiteral<"unverified">;
274
+ }, z.core.$strict>], "kind">;
275
+ argumentDigest: z.ZodString;
276
+ state: z.ZodLiteral<"uncertain">;
277
+ confirmationSummary: z.ZodString;
278
+ preparedAt: z.ZodISODateTime;
279
+ expiresAt: z.ZodISODateTime;
280
+ dispatchAttemptId: z.ZodString;
281
+ uncertainAt: z.ZodISODateTime;
282
+ }, z.core.$strict>, z.ZodObject<{
283
+ intentId: z.ZodString;
284
+ subject: z.ZodObject<{
285
+ tenantId: z.ZodString;
286
+ environmentId: z.ZodString;
287
+ agentId: z.ZodString;
288
+ sessionId: z.ZodString;
289
+ releaseId: z.ZodString;
290
+ }, z.core.$strict>;
291
+ actionAlias: z.ZodString;
292
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
293
+ kind: z.ZodLiteral<"verified_resource">;
294
+ resource: z.ZodObject<{
295
+ kind: z.ZodString;
296
+ id: z.ZodString;
297
+ }, z.core.$strict>;
298
+ verificationId: z.ZodString;
299
+ }, z.core.$strict>, z.ZodObject<{
300
+ kind: z.ZodLiteral<"unverified">;
301
+ }, z.core.$strict>], "kind">;
302
+ argumentDigest: z.ZodString;
303
+ state: z.ZodLiteral<"committed">;
304
+ receiptId: z.ZodString;
305
+ resultDigest: z.ZodString;
306
+ resultStatus: z.ZodString;
307
+ committedAt: z.ZodISODateTime;
308
+ }, z.core.$strict>, z.ZodObject<{
309
+ intentId: z.ZodString;
310
+ subject: z.ZodObject<{
311
+ tenantId: z.ZodString;
312
+ environmentId: z.ZodString;
313
+ agentId: z.ZodString;
314
+ sessionId: z.ZodString;
315
+ releaseId: z.ZodString;
316
+ }, z.core.$strict>;
317
+ actionAlias: z.ZodString;
318
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
319
+ kind: z.ZodLiteral<"verified_resource">;
320
+ resource: z.ZodObject<{
321
+ kind: z.ZodString;
322
+ id: z.ZodString;
323
+ }, z.core.$strict>;
324
+ verificationId: z.ZodString;
325
+ }, z.core.$strict>, z.ZodObject<{
326
+ kind: z.ZodLiteral<"unverified">;
327
+ }, z.core.$strict>], "kind">;
328
+ argumentDigest: z.ZodString;
329
+ state: z.ZodLiteral<"cancelled">;
330
+ cancellationReceiptId: z.ZodString;
331
+ cancellationResolution: z.ZodEnum<{
332
+ local_before_dispatch: "local_before_dispatch";
333
+ confirmed_not_committed: "confirmed_not_committed";
334
+ }>;
335
+ cancelledAt: z.ZodISODateTime;
336
+ }, z.core.$strict>], "state">;
337
+ export type VoiceActionIntentState = z.infer<typeof voiceActionIntentStateSchema>;
338
+ export declare const voiceActionIntentTransitionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
339
+ dispatchAttemptId: z.ZodString;
340
+ binding: z.ZodObject<{
341
+ intentId: z.ZodString;
342
+ subject: z.ZodObject<{
343
+ tenantId: z.ZodString;
344
+ environmentId: z.ZodString;
345
+ agentId: z.ZodString;
346
+ sessionId: z.ZodString;
347
+ releaseId: z.ZodString;
348
+ }, z.core.$strict>;
349
+ actionAlias: z.ZodString;
350
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
351
+ kind: z.ZodLiteral<"verified_resource">;
352
+ resource: z.ZodObject<{
353
+ kind: z.ZodString;
354
+ id: z.ZodString;
355
+ }, z.core.$strict>;
356
+ verificationId: z.ZodString;
357
+ }, z.core.$strict>, z.ZodObject<{
358
+ kind: z.ZodLiteral<"unverified">;
359
+ }, z.core.$strict>], "kind">;
360
+ argumentDigest: z.ZodString;
361
+ }, z.core.$strict>;
362
+ occurredAt: z.ZodISODateTime;
363
+ kind: z.ZodLiteral<"mark_uncertain">;
364
+ }, z.core.$strict>, z.ZodObject<{
365
+ receiptId: z.ZodString;
366
+ resultDigest: z.ZodString;
367
+ resultStatus: z.ZodString;
368
+ binding: z.ZodObject<{
369
+ intentId: z.ZodString;
370
+ subject: z.ZodObject<{
371
+ tenantId: z.ZodString;
372
+ environmentId: z.ZodString;
373
+ agentId: z.ZodString;
374
+ sessionId: z.ZodString;
375
+ releaseId: z.ZodString;
376
+ }, z.core.$strict>;
377
+ actionAlias: z.ZodString;
378
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
379
+ kind: z.ZodLiteral<"verified_resource">;
380
+ resource: z.ZodObject<{
381
+ kind: z.ZodString;
382
+ id: z.ZodString;
383
+ }, z.core.$strict>;
384
+ verificationId: z.ZodString;
385
+ }, z.core.$strict>, z.ZodObject<{
386
+ kind: z.ZodLiteral<"unverified">;
387
+ }, z.core.$strict>], "kind">;
388
+ argumentDigest: z.ZodString;
389
+ }, z.core.$strict>;
390
+ occurredAt: z.ZodISODateTime;
391
+ kind: z.ZodLiteral<"commit">;
392
+ }, z.core.$strict>, z.ZodObject<{
393
+ cancellationReceiptId: z.ZodString;
394
+ resolution: z.ZodEnum<{
395
+ local_before_dispatch: "local_before_dispatch";
396
+ confirmed_not_committed: "confirmed_not_committed";
397
+ }>;
398
+ binding: z.ZodObject<{
399
+ intentId: z.ZodString;
400
+ subject: z.ZodObject<{
401
+ tenantId: z.ZodString;
402
+ environmentId: z.ZodString;
403
+ agentId: z.ZodString;
404
+ sessionId: z.ZodString;
405
+ releaseId: z.ZodString;
406
+ }, z.core.$strict>;
407
+ actionAlias: z.ZodString;
408
+ authoritySubject: z.ZodDiscriminatedUnion<[z.ZodObject<{
409
+ kind: z.ZodLiteral<"verified_resource">;
410
+ resource: z.ZodObject<{
411
+ kind: z.ZodString;
412
+ id: z.ZodString;
413
+ }, z.core.$strict>;
414
+ verificationId: z.ZodString;
415
+ }, z.core.$strict>, z.ZodObject<{
416
+ kind: z.ZodLiteral<"unverified">;
417
+ }, z.core.$strict>], "kind">;
418
+ argumentDigest: z.ZodString;
419
+ }, z.core.$strict>;
420
+ occurredAt: z.ZodISODateTime;
421
+ kind: z.ZodLiteral<"cancel">;
422
+ }, z.core.$strict>], "kind">;
423
+ export type VoiceActionIntentTransition = z.infer<typeof voiceActionIntentTransitionSchema>;
@@ -0,0 +1,95 @@
1
+ import { z } from 'zod';
2
+ import { voiceHashSchema, voiceIdSchema, voiceLocalKeySchema, voiceTimestampSchema, } from './voice-common.js';
3
+ import { voiceCallSubjectSchema, voiceResourceReferenceSchema } from './voice-authority-contracts.js';
4
+ export const voiceActionAuthoritySubjectSchema = z.discriminatedUnion('kind', [
5
+ z.strictObject({
6
+ kind: z.literal('verified_resource'),
7
+ resource: voiceResourceReferenceSchema,
8
+ verificationId: voiceIdSchema,
9
+ }),
10
+ z.strictObject({ kind: z.literal('unverified') }),
11
+ ]);
12
+ export const voiceActionIntentBindingSchema = z.strictObject({
13
+ intentId: voiceIdSchema,
14
+ subject: voiceCallSubjectSchema,
15
+ actionAlias: voiceLocalKeySchema,
16
+ authoritySubject: voiceActionAuthoritySubjectSchema,
17
+ argumentDigest: voiceHashSchema,
18
+ });
19
+ export const voicePrepareActionRequestSchema = z
20
+ .strictObject({
21
+ binding: voiceActionIntentBindingSchema,
22
+ confirmationSummary: z.string().trim().min(1).max(2_000),
23
+ preparedAt: voiceTimestampSchema,
24
+ expiresAt: voiceTimestampSchema,
25
+ })
26
+ .superRefine((request, context) => {
27
+ if (Date.parse(request.expiresAt) <= Date.parse(request.preparedAt)) {
28
+ context.addIssue({
29
+ code: 'custom', path: ['expiresAt'],
30
+ message: 'action intent expiry must be after preparation',
31
+ });
32
+ }
33
+ });
34
+ export const voiceConfirmActionRequestSchema = z.strictObject({
35
+ binding: voiceActionIntentBindingSchema,
36
+ requestedAt: voiceTimestampSchema,
37
+ });
38
+ export const voiceCancelActionRequestSchema = z.strictObject({
39
+ binding: voiceActionIntentBindingSchema,
40
+ requestedAt: voiceTimestampSchema,
41
+ });
42
+ export const voicePreparedActionIntentSchema = voiceActionIntentBindingSchema.extend({
43
+ state: z.literal('prepared'),
44
+ confirmationSummary: z.string().trim().min(1).max(2_000),
45
+ preparedAt: voiceTimestampSchema,
46
+ expiresAt: voiceTimestampSchema,
47
+ });
48
+ export const voiceUncertainActionIntentSchema = voiceActionIntentBindingSchema.extend({
49
+ state: z.literal('uncertain'),
50
+ confirmationSummary: z.string().trim().min(1).max(2_000),
51
+ preparedAt: voiceTimestampSchema,
52
+ expiresAt: voiceTimestampSchema,
53
+ dispatchAttemptId: voiceIdSchema,
54
+ uncertainAt: voiceTimestampSchema,
55
+ });
56
+ export const voiceCommittedActionReceiptSchema = voiceActionIntentBindingSchema.extend({
57
+ state: z.literal('committed'),
58
+ receiptId: voiceIdSchema,
59
+ resultDigest: voiceHashSchema,
60
+ resultStatus: voiceIdSchema,
61
+ committedAt: voiceTimestampSchema,
62
+ });
63
+ export const voiceCancelledActionReceiptSchema = voiceActionIntentBindingSchema.extend({
64
+ state: z.literal('cancelled'),
65
+ cancellationReceiptId: voiceIdSchema,
66
+ cancellationResolution: z.enum(['local_before_dispatch', 'confirmed_not_committed']),
67
+ cancelledAt: voiceTimestampSchema,
68
+ });
69
+ export const voiceActionIntentStateSchema = z.discriminatedUnion('state', [
70
+ voicePreparedActionIntentSchema,
71
+ voiceUncertainActionIntentSchema,
72
+ voiceCommittedActionReceiptSchema,
73
+ voiceCancelledActionReceiptSchema,
74
+ ]);
75
+ const transitionBase = {
76
+ binding: voiceActionIntentBindingSchema,
77
+ occurredAt: voiceTimestampSchema,
78
+ };
79
+ export const voiceActionIntentTransitionSchema = z.discriminatedUnion('kind', [
80
+ z.strictObject({
81
+ kind: z.literal('mark_uncertain'), ...transitionBase,
82
+ dispatchAttemptId: voiceIdSchema,
83
+ }),
84
+ z.strictObject({
85
+ kind: z.literal('commit'), ...transitionBase,
86
+ receiptId: voiceIdSchema,
87
+ resultDigest: voiceHashSchema,
88
+ resultStatus: voiceIdSchema,
89
+ }),
90
+ z.strictObject({
91
+ kind: z.literal('cancel'), ...transitionBase,
92
+ cancellationReceiptId: voiceIdSchema,
93
+ resolution: z.enum(['local_before_dispatch', 'confirmed_not_committed']),
94
+ }),
95
+ ]);