@kya-os/contracts 1.7.24 → 1.7.26

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.
@@ -0,0 +1,723 @@
1
+ /**
2
+ * Managed Agent Deployment Contracts
3
+ *
4
+ * Schemas for the managed hosting tier where agents run on Fly.io
5
+ * instead of user-managed Cloudflare Workers.
6
+ *
7
+ * @package @kya-os/contracts/agent-deployment
8
+ */
9
+ import { z } from "zod";
10
+ /**
11
+ * Validated DID string schema.
12
+ * Reusable across all contract files that reference agent DIDs.
13
+ *
14
+ * Format: `did:<method>:<method-specific-id>`
15
+ * - method: 1+ lowercase alphanumeric chars
16
+ * - method-specific-id: 1+ non-whitespace chars
17
+ *
18
+ * Examples: `did:key:z6Mk...`, `did:web:example.com`
19
+ */
20
+ export declare const DidStringSchema: z.ZodString;
21
+ /**
22
+ * Fly.io deployment regions.
23
+ * Enumerated to prevent arbitrary strings from being accepted.
24
+ * @see https://fly.io/docs/reference/regions/
25
+ */
26
+ export declare const FlyRegionSchema: z.ZodEnum<["ams", "arn", "atl", "bog", "bos", "cdg", "den", "dfw", "ewr", "eze", "fra", "gdl", "gig", "gru", "hkg", "iad", "jnb", "lax", "lhr", "mad", "mia", "nrt", "ord", "otp", "phx", "qro", "scl", "sea", "sin", "sjc", "syd", "waw", "yul", "yyz"]>;
27
+ export type FlyRegion = z.infer<typeof FlyRegionSchema>;
28
+ /**
29
+ * Agent lifecycle status — tracks the full state machine
30
+ * from initial provisioning through running to permanent revocation.
31
+ */
32
+ export declare const AgentStatusSchema: z.ZodEnum<["provisioning", "starting", "running", "stopping", "stopped", "error", "revoked"]>;
33
+ export type AgentStatus = z.infer<typeof AgentStatusSchema>;
34
+ /**
35
+ * Hosting mode discriminator — differentiates between
36
+ * self-managed BYOK deploys and platform-managed deploys.
37
+ */
38
+ export declare const HostingModeSchema: z.ZodEnum<["byok", "managed"]>;
39
+ export type HostingMode = z.infer<typeof HostingModeSchema>;
40
+ /**
41
+ * Request body for POST /api/v1/molti/deploy/managed/fly
42
+ *
43
+ * Validated server-side before any resources are created.
44
+ * The name field becomes the agent's subdomain: {name}.agents.kya-os.ai
45
+ */
46
+ export declare const ManagedDeployRequestSchema: z.ZodObject<{
47
+ /** Agent name — becomes DNS subdomain. Must be DNS-safe. */
48
+ name: z.ZodString;
49
+ /** AI provider for inference */
50
+ aiProvider: z.ZodEnum<["anthropic", "openai"]>;
51
+ /** User's AI API key — encrypted before storage */
52
+ aiApiKey: z.ZodString;
53
+ /** Fly.io deployment region */
54
+ region: z.ZodDefault<z.ZodEnum<["ams", "arn", "atl", "bog", "bos", "cdg", "den", "dfw", "ewr", "eze", "fra", "gdl", "gig", "gru", "hkg", "iad", "jnb", "lax", "lhr", "mad", "mia", "nrt", "ord", "otp", "phx", "qro", "scl", "sea", "sin", "sjc", "syd", "waw", "yul", "yyz"]>>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ name: string;
57
+ aiProvider: "anthropic" | "openai";
58
+ aiApiKey: string;
59
+ region: "ams" | "arn" | "atl" | "bog" | "bos" | "cdg" | "den" | "dfw" | "ewr" | "eze" | "fra" | "gdl" | "gig" | "gru" | "hkg" | "iad" | "jnb" | "lax" | "lhr" | "mad" | "mia" | "nrt" | "ord" | "otp" | "phx" | "qro" | "scl" | "sea" | "sin" | "sjc" | "syd" | "waw" | "yul" | "yyz";
60
+ }, {
61
+ name: string;
62
+ aiProvider: "anthropic" | "openai";
63
+ aiApiKey: string;
64
+ region?: "ams" | "arn" | "atl" | "bog" | "bos" | "cdg" | "den" | "dfw" | "ewr" | "eze" | "fra" | "gdl" | "gig" | "gru" | "hkg" | "iad" | "jnb" | "lax" | "lhr" | "mad" | "mia" | "nrt" | "ord" | "otp" | "phx" | "qro" | "scl" | "sea" | "sin" | "sjc" | "syd" | "waw" | "yul" | "yyz" | undefined;
65
+ }>;
66
+ export type ManagedDeployRequest = z.infer<typeof ManagedDeployRequestSchema>;
67
+ /**
68
+ * Successful managed deployment result.
69
+ * Returned at the end of the SSE stream as the "complete" event data.
70
+ */
71
+ export declare const ManagedDeployResultSchema: z.ZodObject<{
72
+ /** Agent DID — the primary identifier */
73
+ agentDid: z.ZodString;
74
+ /** Live agent URL (e.g., https://my-agent.agents.kya-os.ai) */
75
+ agentUrl: z.ZodString;
76
+ /** Current agent status */
77
+ status: z.ZodEnum<["provisioning", "starting", "running", "stopping", "stopped", "error", "revoked"]>;
78
+ /** AgentShield project ID */
79
+ projectId: z.ZodString;
80
+ /** AgentShield project friendly ID */
81
+ friendlyId: z.ZodString;
82
+ }, "strip", z.ZodTypeAny, {
83
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
84
+ agentDid: string;
85
+ agentUrl: string;
86
+ projectId: string;
87
+ friendlyId: string;
88
+ }, {
89
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
90
+ agentDid: string;
91
+ agentUrl: string;
92
+ projectId: string;
93
+ friendlyId: string;
94
+ }>;
95
+ export type ManagedDeployResult = z.infer<typeof ManagedDeployResultSchema>;
96
+ /**
97
+ * Steps in the managed deploy pipeline.
98
+ * Different from BYOK steps — no GitHub, no Cloudflare.
99
+ */
100
+ export declare const ManagedDeployStepIdSchema: z.ZodEnum<["identity_create", "project_create", "kta_register", "fly_provision", "compute_boot", "health_check"]>;
101
+ export type ManagedDeployStepId = z.infer<typeof ManagedDeployStepIdSchema>;
102
+ /**
103
+ * Human-readable names for each managed deploy step.
104
+ * Used by the frontend progress UI.
105
+ */
106
+ export declare const MANAGED_DEPLOY_STEP_NAMES: Record<ManagedDeployStepId, string>;
107
+ /**
108
+ * Deploy step status — reuses same status enum as BYOK.
109
+ */
110
+ export declare const ManagedDeployStepStatusSchema: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
111
+ /**
112
+ * Individual managed deploy step with timing.
113
+ */
114
+ export declare const ManagedDeployStepSchema: z.ZodObject<{
115
+ id: z.ZodEnum<["identity_create", "project_create", "kta_register", "fly_provision", "compute_boot", "health_check"]>;
116
+ name: z.ZodString;
117
+ status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
118
+ message: z.ZodOptional<z.ZodString>;
119
+ startedAt: z.ZodOptional<z.ZodString>;
120
+ completedAt: z.ZodOptional<z.ZodString>;
121
+ }, "strip", z.ZodTypeAny, {
122
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
123
+ name: string;
124
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
125
+ message?: string | undefined;
126
+ startedAt?: string | undefined;
127
+ completedAt?: string | undefined;
128
+ }, {
129
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
130
+ name: string;
131
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
132
+ message?: string | undefined;
133
+ startedAt?: string | undefined;
134
+ completedAt?: string | undefined;
135
+ }>;
136
+ /**
137
+ * Overall managed deployment progress — sent via SSE "progress" events.
138
+ */
139
+ export declare const ManagedDeployProgressSchema: z.ZodObject<{
140
+ deploymentId: z.ZodString;
141
+ steps: z.ZodArray<z.ZodObject<{
142
+ id: z.ZodEnum<["identity_create", "project_create", "kta_register", "fly_provision", "compute_boot", "health_check"]>;
143
+ name: z.ZodString;
144
+ status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
145
+ message: z.ZodOptional<z.ZodString>;
146
+ startedAt: z.ZodOptional<z.ZodString>;
147
+ completedAt: z.ZodOptional<z.ZodString>;
148
+ }, "strip", z.ZodTypeAny, {
149
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
150
+ name: string;
151
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
152
+ message?: string | undefined;
153
+ startedAt?: string | undefined;
154
+ completedAt?: string | undefined;
155
+ }, {
156
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
157
+ name: string;
158
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
159
+ message?: string | undefined;
160
+ startedAt?: string | undefined;
161
+ completedAt?: string | undefined;
162
+ }>, "many">;
163
+ currentStep: z.ZodNumber;
164
+ totalSteps: z.ZodNumber;
165
+ overallStatus: z.ZodEnum<["pending", "in_progress", "completed", "failed"]>;
166
+ }, "strip", z.ZodTypeAny, {
167
+ deploymentId: string;
168
+ steps: {
169
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
170
+ name: string;
171
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
172
+ message?: string | undefined;
173
+ startedAt?: string | undefined;
174
+ completedAt?: string | undefined;
175
+ }[];
176
+ currentStep: number;
177
+ totalSteps: number;
178
+ overallStatus: "pending" | "in_progress" | "completed" | "failed";
179
+ }, {
180
+ deploymentId: string;
181
+ steps: {
182
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
183
+ name: string;
184
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
185
+ message?: string | undefined;
186
+ startedAt?: string | undefined;
187
+ completedAt?: string | undefined;
188
+ }[];
189
+ currentStep: number;
190
+ totalSteps: number;
191
+ overallStatus: "pending" | "in_progress" | "completed" | "failed";
192
+ }>;
193
+ export type ManagedDeployProgress = z.infer<typeof ManagedDeployProgressSchema>;
194
+ /**
195
+ * Error codes specific to managed deployment failures.
196
+ */
197
+ export declare const ManagedDeployErrorCodeSchema: z.ZodEnum<["IDENTITY_ERROR", "PROJECT_CREATION_ERROR", "KTA_REGISTRATION_ERROR", "FLY_PROVISION_FAILED", "COMPUTE_BOOT_TIMEOUT", "HEALTH_CHECK_FAILED", "RATE_LIMIT_EXCEEDED", "NAME_TAKEN", "INTERNAL_ERROR"]>;
198
+ export type ManagedDeployErrorCode = z.infer<typeof ManagedDeployErrorCodeSchema>;
199
+ /**
200
+ * Managed deploy error response.
201
+ */
202
+ export declare const ManagedDeployErrorResponseSchema: z.ZodObject<{
203
+ success: z.ZodLiteral<false>;
204
+ error: z.ZodObject<{
205
+ code: z.ZodEnum<["IDENTITY_ERROR", "PROJECT_CREATION_ERROR", "KTA_REGISTRATION_ERROR", "FLY_PROVISION_FAILED", "COMPUTE_BOOT_TIMEOUT", "HEALTH_CHECK_FAILED", "RATE_LIMIT_EXCEEDED", "NAME_TAKEN", "INTERNAL_ERROR"]>;
206
+ message: z.ZodString;
207
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
208
+ }, "strip", z.ZodTypeAny, {
209
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
210
+ message: string;
211
+ details?: Record<string, unknown> | undefined;
212
+ }, {
213
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
214
+ message: string;
215
+ details?: Record<string, unknown> | undefined;
216
+ }>;
217
+ }, "strip", z.ZodTypeAny, {
218
+ error: {
219
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
220
+ message: string;
221
+ details?: Record<string, unknown> | undefined;
222
+ };
223
+ success: false;
224
+ }, {
225
+ error: {
226
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
227
+ message: string;
228
+ details?: Record<string, unknown> | undefined;
229
+ };
230
+ success: false;
231
+ }>;
232
+ /**
233
+ * Managed deploy success response.
234
+ */
235
+ export declare const ManagedDeploySuccessResponseSchema: z.ZodObject<{
236
+ success: z.ZodLiteral<true>;
237
+ data: z.ZodObject<{
238
+ /** Agent DID — the primary identifier */
239
+ agentDid: z.ZodString;
240
+ /** Live agent URL (e.g., https://my-agent.agents.kya-os.ai) */
241
+ agentUrl: z.ZodString;
242
+ /** Current agent status */
243
+ status: z.ZodEnum<["provisioning", "starting", "running", "stopping", "stopped", "error", "revoked"]>;
244
+ /** AgentShield project ID */
245
+ projectId: z.ZodString;
246
+ /** AgentShield project friendly ID */
247
+ friendlyId: z.ZodString;
248
+ }, "strip", z.ZodTypeAny, {
249
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
250
+ agentDid: string;
251
+ agentUrl: string;
252
+ projectId: string;
253
+ friendlyId: string;
254
+ }, {
255
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
256
+ agentDid: string;
257
+ agentUrl: string;
258
+ projectId: string;
259
+ friendlyId: string;
260
+ }>;
261
+ }, "strip", z.ZodTypeAny, {
262
+ success: true;
263
+ data: {
264
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
265
+ agentDid: string;
266
+ agentUrl: string;
267
+ projectId: string;
268
+ friendlyId: string;
269
+ };
270
+ }, {
271
+ success: true;
272
+ data: {
273
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
274
+ agentDid: string;
275
+ agentUrl: string;
276
+ projectId: string;
277
+ friendlyId: string;
278
+ };
279
+ }>;
280
+ /**
281
+ * Union response type for managed deploy endpoint.
282
+ */
283
+ export declare const ManagedDeployResponseSchema: z.ZodDiscriminatedUnion<"success", [z.ZodObject<{
284
+ success: z.ZodLiteral<true>;
285
+ data: z.ZodObject<{
286
+ /** Agent DID — the primary identifier */
287
+ agentDid: z.ZodString;
288
+ /** Live agent URL (e.g., https://my-agent.agents.kya-os.ai) */
289
+ agentUrl: z.ZodString;
290
+ /** Current agent status */
291
+ status: z.ZodEnum<["provisioning", "starting", "running", "stopping", "stopped", "error", "revoked"]>;
292
+ /** AgentShield project ID */
293
+ projectId: z.ZodString;
294
+ /** AgentShield project friendly ID */
295
+ friendlyId: z.ZodString;
296
+ }, "strip", z.ZodTypeAny, {
297
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
298
+ agentDid: string;
299
+ agentUrl: string;
300
+ projectId: string;
301
+ friendlyId: string;
302
+ }, {
303
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
304
+ agentDid: string;
305
+ agentUrl: string;
306
+ projectId: string;
307
+ friendlyId: string;
308
+ }>;
309
+ }, "strip", z.ZodTypeAny, {
310
+ success: true;
311
+ data: {
312
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
313
+ agentDid: string;
314
+ agentUrl: string;
315
+ projectId: string;
316
+ friendlyId: string;
317
+ };
318
+ }, {
319
+ success: true;
320
+ data: {
321
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
322
+ agentDid: string;
323
+ agentUrl: string;
324
+ projectId: string;
325
+ friendlyId: string;
326
+ };
327
+ }>, z.ZodObject<{
328
+ success: z.ZodLiteral<false>;
329
+ error: z.ZodObject<{
330
+ code: z.ZodEnum<["IDENTITY_ERROR", "PROJECT_CREATION_ERROR", "KTA_REGISTRATION_ERROR", "FLY_PROVISION_FAILED", "COMPUTE_BOOT_TIMEOUT", "HEALTH_CHECK_FAILED", "RATE_LIMIT_EXCEEDED", "NAME_TAKEN", "INTERNAL_ERROR"]>;
331
+ message: z.ZodString;
332
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
333
+ }, "strip", z.ZodTypeAny, {
334
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
335
+ message: string;
336
+ details?: Record<string, unknown> | undefined;
337
+ }, {
338
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
339
+ message: string;
340
+ details?: Record<string, unknown> | undefined;
341
+ }>;
342
+ }, "strip", z.ZodTypeAny, {
343
+ error: {
344
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
345
+ message: string;
346
+ details?: Record<string, unknown> | undefined;
347
+ };
348
+ success: false;
349
+ }, {
350
+ error: {
351
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
352
+ message: string;
353
+ details?: Record<string, unknown> | undefined;
354
+ };
355
+ success: false;
356
+ }>]>;
357
+ export declare const ManagedSSEProgressEventSchema: z.ZodObject<{
358
+ type: z.ZodLiteral<"progress">;
359
+ data: z.ZodObject<{
360
+ deploymentId: z.ZodString;
361
+ steps: z.ZodArray<z.ZodObject<{
362
+ id: z.ZodEnum<["identity_create", "project_create", "kta_register", "fly_provision", "compute_boot", "health_check"]>;
363
+ name: z.ZodString;
364
+ status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
365
+ message: z.ZodOptional<z.ZodString>;
366
+ startedAt: z.ZodOptional<z.ZodString>;
367
+ completedAt: z.ZodOptional<z.ZodString>;
368
+ }, "strip", z.ZodTypeAny, {
369
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
370
+ name: string;
371
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
372
+ message?: string | undefined;
373
+ startedAt?: string | undefined;
374
+ completedAt?: string | undefined;
375
+ }, {
376
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
377
+ name: string;
378
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
379
+ message?: string | undefined;
380
+ startedAt?: string | undefined;
381
+ completedAt?: string | undefined;
382
+ }>, "many">;
383
+ currentStep: z.ZodNumber;
384
+ totalSteps: z.ZodNumber;
385
+ overallStatus: z.ZodEnum<["pending", "in_progress", "completed", "failed"]>;
386
+ }, "strip", z.ZodTypeAny, {
387
+ deploymentId: string;
388
+ steps: {
389
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
390
+ name: string;
391
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
392
+ message?: string | undefined;
393
+ startedAt?: string | undefined;
394
+ completedAt?: string | undefined;
395
+ }[];
396
+ currentStep: number;
397
+ totalSteps: number;
398
+ overallStatus: "pending" | "in_progress" | "completed" | "failed";
399
+ }, {
400
+ deploymentId: string;
401
+ steps: {
402
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
403
+ name: string;
404
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
405
+ message?: string | undefined;
406
+ startedAt?: string | undefined;
407
+ completedAt?: string | undefined;
408
+ }[];
409
+ currentStep: number;
410
+ totalSteps: number;
411
+ overallStatus: "pending" | "in_progress" | "completed" | "failed";
412
+ }>;
413
+ }, "strip", z.ZodTypeAny, {
414
+ type: "progress";
415
+ data: {
416
+ deploymentId: string;
417
+ steps: {
418
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
419
+ name: string;
420
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
421
+ message?: string | undefined;
422
+ startedAt?: string | undefined;
423
+ completedAt?: string | undefined;
424
+ }[];
425
+ currentStep: number;
426
+ totalSteps: number;
427
+ overallStatus: "pending" | "in_progress" | "completed" | "failed";
428
+ };
429
+ }, {
430
+ type: "progress";
431
+ data: {
432
+ deploymentId: string;
433
+ steps: {
434
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
435
+ name: string;
436
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
437
+ message?: string | undefined;
438
+ startedAt?: string | undefined;
439
+ completedAt?: string | undefined;
440
+ }[];
441
+ currentStep: number;
442
+ totalSteps: number;
443
+ overallStatus: "pending" | "in_progress" | "completed" | "failed";
444
+ };
445
+ }>;
446
+ export declare const ManagedSSECompleteEventSchema: z.ZodObject<{
447
+ type: z.ZodLiteral<"complete">;
448
+ data: z.ZodObject<{
449
+ /** Agent DID — the primary identifier */
450
+ agentDid: z.ZodString;
451
+ /** Live agent URL (e.g., https://my-agent.agents.kya-os.ai) */
452
+ agentUrl: z.ZodString;
453
+ /** Current agent status */
454
+ status: z.ZodEnum<["provisioning", "starting", "running", "stopping", "stopped", "error", "revoked"]>;
455
+ /** AgentShield project ID */
456
+ projectId: z.ZodString;
457
+ /** AgentShield project friendly ID */
458
+ friendlyId: z.ZodString;
459
+ }, "strip", z.ZodTypeAny, {
460
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
461
+ agentDid: string;
462
+ agentUrl: string;
463
+ projectId: string;
464
+ friendlyId: string;
465
+ }, {
466
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
467
+ agentDid: string;
468
+ agentUrl: string;
469
+ projectId: string;
470
+ friendlyId: string;
471
+ }>;
472
+ }, "strip", z.ZodTypeAny, {
473
+ type: "complete";
474
+ data: {
475
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
476
+ agentDid: string;
477
+ agentUrl: string;
478
+ projectId: string;
479
+ friendlyId: string;
480
+ };
481
+ }, {
482
+ type: "complete";
483
+ data: {
484
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
485
+ agentDid: string;
486
+ agentUrl: string;
487
+ projectId: string;
488
+ friendlyId: string;
489
+ };
490
+ }>;
491
+ export declare const ManagedSSEErrorEventSchema: z.ZodObject<{
492
+ type: z.ZodLiteral<"error">;
493
+ data: z.ZodObject<{
494
+ code: z.ZodEnum<["IDENTITY_ERROR", "PROJECT_CREATION_ERROR", "KTA_REGISTRATION_ERROR", "FLY_PROVISION_FAILED", "COMPUTE_BOOT_TIMEOUT", "HEALTH_CHECK_FAILED", "RATE_LIMIT_EXCEEDED", "NAME_TAKEN", "INTERNAL_ERROR"]>;
495
+ message: z.ZodString;
496
+ step: z.ZodOptional<z.ZodEnum<["identity_create", "project_create", "kta_register", "fly_provision", "compute_boot", "health_check"]>>;
497
+ }, "strip", z.ZodTypeAny, {
498
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
499
+ message: string;
500
+ step?: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check" | undefined;
501
+ }, {
502
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
503
+ message: string;
504
+ step?: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check" | undefined;
505
+ }>;
506
+ }, "strip", z.ZodTypeAny, {
507
+ type: "error";
508
+ data: {
509
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
510
+ message: string;
511
+ step?: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check" | undefined;
512
+ };
513
+ }, {
514
+ type: "error";
515
+ data: {
516
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
517
+ message: string;
518
+ step?: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check" | undefined;
519
+ };
520
+ }>;
521
+ export declare const ManagedSSEKeepaliveEventSchema: z.ZodObject<{
522
+ type: z.ZodLiteral<"keepalive">;
523
+ data: z.ZodObject<{
524
+ timestamp: z.ZodString;
525
+ }, "strip", z.ZodTypeAny, {
526
+ timestamp: string;
527
+ }, {
528
+ timestamp: string;
529
+ }>;
530
+ }, "strip", z.ZodTypeAny, {
531
+ type: "keepalive";
532
+ data: {
533
+ timestamp: string;
534
+ };
535
+ }, {
536
+ type: "keepalive";
537
+ data: {
538
+ timestamp: string;
539
+ };
540
+ }>;
541
+ export declare const ManagedSSEEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
542
+ type: z.ZodLiteral<"progress">;
543
+ data: z.ZodObject<{
544
+ deploymentId: z.ZodString;
545
+ steps: z.ZodArray<z.ZodObject<{
546
+ id: z.ZodEnum<["identity_create", "project_create", "kta_register", "fly_provision", "compute_boot", "health_check"]>;
547
+ name: z.ZodString;
548
+ status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
549
+ message: z.ZodOptional<z.ZodString>;
550
+ startedAt: z.ZodOptional<z.ZodString>;
551
+ completedAt: z.ZodOptional<z.ZodString>;
552
+ }, "strip", z.ZodTypeAny, {
553
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
554
+ name: string;
555
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
556
+ message?: string | undefined;
557
+ startedAt?: string | undefined;
558
+ completedAt?: string | undefined;
559
+ }, {
560
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
561
+ name: string;
562
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
563
+ message?: string | undefined;
564
+ startedAt?: string | undefined;
565
+ completedAt?: string | undefined;
566
+ }>, "many">;
567
+ currentStep: z.ZodNumber;
568
+ totalSteps: z.ZodNumber;
569
+ overallStatus: z.ZodEnum<["pending", "in_progress", "completed", "failed"]>;
570
+ }, "strip", z.ZodTypeAny, {
571
+ deploymentId: string;
572
+ steps: {
573
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
574
+ name: string;
575
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
576
+ message?: string | undefined;
577
+ startedAt?: string | undefined;
578
+ completedAt?: string | undefined;
579
+ }[];
580
+ currentStep: number;
581
+ totalSteps: number;
582
+ overallStatus: "pending" | "in_progress" | "completed" | "failed";
583
+ }, {
584
+ deploymentId: string;
585
+ steps: {
586
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
587
+ name: string;
588
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
589
+ message?: string | undefined;
590
+ startedAt?: string | undefined;
591
+ completedAt?: string | undefined;
592
+ }[];
593
+ currentStep: number;
594
+ totalSteps: number;
595
+ overallStatus: "pending" | "in_progress" | "completed" | "failed";
596
+ }>;
597
+ }, "strip", z.ZodTypeAny, {
598
+ type: "progress";
599
+ data: {
600
+ deploymentId: string;
601
+ steps: {
602
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
603
+ name: string;
604
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
605
+ message?: string | undefined;
606
+ startedAt?: string | undefined;
607
+ completedAt?: string | undefined;
608
+ }[];
609
+ currentStep: number;
610
+ totalSteps: number;
611
+ overallStatus: "pending" | "in_progress" | "completed" | "failed";
612
+ };
613
+ }, {
614
+ type: "progress";
615
+ data: {
616
+ deploymentId: string;
617
+ steps: {
618
+ status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
619
+ name: string;
620
+ id: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check";
621
+ message?: string | undefined;
622
+ startedAt?: string | undefined;
623
+ completedAt?: string | undefined;
624
+ }[];
625
+ currentStep: number;
626
+ totalSteps: number;
627
+ overallStatus: "pending" | "in_progress" | "completed" | "failed";
628
+ };
629
+ }>, z.ZodObject<{
630
+ type: z.ZodLiteral<"complete">;
631
+ data: z.ZodObject<{
632
+ /** Agent DID — the primary identifier */
633
+ agentDid: z.ZodString;
634
+ /** Live agent URL (e.g., https://my-agent.agents.kya-os.ai) */
635
+ agentUrl: z.ZodString;
636
+ /** Current agent status */
637
+ status: z.ZodEnum<["provisioning", "starting", "running", "stopping", "stopped", "error", "revoked"]>;
638
+ /** AgentShield project ID */
639
+ projectId: z.ZodString;
640
+ /** AgentShield project friendly ID */
641
+ friendlyId: z.ZodString;
642
+ }, "strip", z.ZodTypeAny, {
643
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
644
+ agentDid: string;
645
+ agentUrl: string;
646
+ projectId: string;
647
+ friendlyId: string;
648
+ }, {
649
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
650
+ agentDid: string;
651
+ agentUrl: string;
652
+ projectId: string;
653
+ friendlyId: string;
654
+ }>;
655
+ }, "strip", z.ZodTypeAny, {
656
+ type: "complete";
657
+ data: {
658
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
659
+ agentDid: string;
660
+ agentUrl: string;
661
+ projectId: string;
662
+ friendlyId: string;
663
+ };
664
+ }, {
665
+ type: "complete";
666
+ data: {
667
+ status: "provisioning" | "starting" | "running" | "stopping" | "stopped" | "error" | "revoked";
668
+ agentDid: string;
669
+ agentUrl: string;
670
+ projectId: string;
671
+ friendlyId: string;
672
+ };
673
+ }>, z.ZodObject<{
674
+ type: z.ZodLiteral<"error">;
675
+ data: z.ZodObject<{
676
+ code: z.ZodEnum<["IDENTITY_ERROR", "PROJECT_CREATION_ERROR", "KTA_REGISTRATION_ERROR", "FLY_PROVISION_FAILED", "COMPUTE_BOOT_TIMEOUT", "HEALTH_CHECK_FAILED", "RATE_LIMIT_EXCEEDED", "NAME_TAKEN", "INTERNAL_ERROR"]>;
677
+ message: z.ZodString;
678
+ step: z.ZodOptional<z.ZodEnum<["identity_create", "project_create", "kta_register", "fly_provision", "compute_boot", "health_check"]>>;
679
+ }, "strip", z.ZodTypeAny, {
680
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
681
+ message: string;
682
+ step?: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check" | undefined;
683
+ }, {
684
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
685
+ message: string;
686
+ step?: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check" | undefined;
687
+ }>;
688
+ }, "strip", z.ZodTypeAny, {
689
+ type: "error";
690
+ data: {
691
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
692
+ message: string;
693
+ step?: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check" | undefined;
694
+ };
695
+ }, {
696
+ type: "error";
697
+ data: {
698
+ code: "IDENTITY_ERROR" | "PROJECT_CREATION_ERROR" | "KTA_REGISTRATION_ERROR" | "FLY_PROVISION_FAILED" | "COMPUTE_BOOT_TIMEOUT" | "HEALTH_CHECK_FAILED" | "RATE_LIMIT_EXCEEDED" | "NAME_TAKEN" | "INTERNAL_ERROR";
699
+ message: string;
700
+ step?: "identity_create" | "project_create" | "kta_register" | "fly_provision" | "compute_boot" | "health_check" | undefined;
701
+ };
702
+ }>, z.ZodObject<{
703
+ type: z.ZodLiteral<"keepalive">;
704
+ data: z.ZodObject<{
705
+ timestamp: z.ZodString;
706
+ }, "strip", z.ZodTypeAny, {
707
+ timestamp: string;
708
+ }, {
709
+ timestamp: string;
710
+ }>;
711
+ }, "strip", z.ZodTypeAny, {
712
+ type: "keepalive";
713
+ data: {
714
+ timestamp: string;
715
+ };
716
+ }, {
717
+ type: "keepalive";
718
+ data: {
719
+ timestamp: string;
720
+ };
721
+ }>]>;
722
+ export type ManagedSSEEvent = z.infer<typeof ManagedSSEEventSchema>;
723
+ export { didToSlug, didToFlyApp } from "./agent-deployment-utils.js";