@ahmadposten/talos-wire 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -366,6 +366,109 @@ const ProviderUsageSnapshotSchema = z__namespace.object({
366
366
  retryAt: z__namespace.number().finite().optional()
367
367
  });
368
368
 
369
+ const text = z.z.string().trim().min(1).max(24e3);
370
+ const WorkflowAgentSchema = z.z.object({
371
+ id: z.z.string().min(1).max(100),
372
+ revision: z.z.number().int().positive(),
373
+ name: z.z.string().min(1).max(60),
374
+ description: z.z.string().max(300),
375
+ provider: z.z.literal("codex"),
376
+ model: z.z.string().min(1).max(200),
377
+ effort: z.z.string().max(30).nullable(),
378
+ permissionMode: z.z.enum(["default", "read-only"]),
379
+ instructions: text,
380
+ documents: z.z.array(z.z.object({ name: z.z.string().max(120), content: z.z.string().max(16e3) })).max(5)
381
+ });
382
+ const WorkflowSlotSchema = z.z.object({ agent: WorkflowAgentSchema, assignment: text });
383
+ const WorkflowDefinitionSchema = z.z.object({
384
+ id: z.z.string().uuid(),
385
+ revision: z.z.number().int().positive(),
386
+ name: z.z.string().trim().min(1).max(80),
387
+ description: z.z.string().max(1e3),
388
+ planners: z.z.array(WorkflowSlotSchema).min(2).max(4),
389
+ executor: WorkflowSlotSchema,
390
+ reviewers: z.z.array(WorkflowSlotSchema).min(2).max(4),
391
+ criteria: text,
392
+ checks: z.z.array(z.z.object({ name: z.z.string().trim().min(1).max(100), command: z.z.string().trim().min(1).max(2e3) })).min(1).max(8),
393
+ planningRounds: z.z.number().int().min(1).max(5),
394
+ reviewRounds: z.z.number().int().min(1).max(5),
395
+ turnMinutes: z.z.number().int().min(1).max(30),
396
+ maxTurns: z.z.number().int().min(8).max(100),
397
+ approvePlan: z.z.boolean(),
398
+ updatedAt: z.z.number()
399
+ }).superRefine((d, ctx) => {
400
+ if (new TextEncoder().encode(JSON.stringify(d)).length > 64e3) ctx.addIssue({ code: "custom", message: "Workflow definition exceeds 64 KB. Shorten instructions or documents." });
401
+ const ids = [...d.planners, d.executor, ...d.reviewers].map((s) => s.agent.id);
402
+ if (new Set(ids).size !== ids.length) ctx.addIssue({ code: "custom", message: "Each workflow participant must be a different saved agent." });
403
+ if (d.executor.agent.permissionMode === "read-only") ctx.addIssue({ code: "custom", message: "The executor must allow workspace edits." });
404
+ });
405
+ const WorkflowLibrarySchema = z.z.array(WorkflowDefinitionSchema).max(20).refine((x) => JSON.stringify(x).length < 128e3, "Workflow library is too large.");
406
+ const WorkflowStageSchema = z.z.enum(["propose", "consolidate", "plan_vote", "execute", "review", "verify"]);
407
+ const WorkflowDecisionSchema = z.z.object({
408
+ decision: z.z.enum(["approve", "changes", "information", "replan"]),
409
+ summary: text,
410
+ document: z.z.string().max(24e3),
411
+ findings: z.z.array(z.z.object({ title: z.z.string().min(1).max(300), evidence: text, correction: text, blocking: z.z.boolean() })).max(20)
412
+ });
413
+ const WorkflowTaskSchema = z.z.object({
414
+ id: z.z.string(),
415
+ stage: WorkflowStageSchema,
416
+ round: z.z.number(),
417
+ agentId: z.z.string(),
418
+ agentName: z.z.string(),
419
+ clarifications: z.z.number().int().optional(),
420
+ assignment: z.z.string(),
421
+ version: z.z.string(),
422
+ status: z.z.enum(["running", "done", "interrupted"]),
423
+ startedAt: z.z.number(),
424
+ completedAt: z.z.number().optional(),
425
+ sessionId: z.z.string().optional(),
426
+ threadId: z.z.string().optional(),
427
+ prompt: z.z.string(),
428
+ result: WorkflowDecisionSchema.optional(),
429
+ error: z.z.string().optional()
430
+ });
431
+ const WorkflowRunSchema = z.z.object({
432
+ id: z.z.string().uuid(),
433
+ revision: z.z.number().int(),
434
+ definition: WorkflowDefinitionSchema,
435
+ machineId: z.z.string(),
436
+ task: text,
437
+ requestedDirectory: z.z.string().optional(),
438
+ sourceDirectory: z.z.string(),
439
+ directory: z.z.string(),
440
+ branch: z.z.string(),
441
+ baseCommit: z.z.string(),
442
+ status: z.z.enum(["running", "paused", "needs_input", "complete", "cancelled"]),
443
+ stage: WorkflowStageSchema,
444
+ planningRound: z.z.number().int(),
445
+ reviewRound: z.z.number().int(),
446
+ planVersion: z.z.number().int(),
447
+ plan: z.z.string(),
448
+ artifactVersion: z.z.string(),
449
+ reason: z.z.string(),
450
+ tasks: z.z.array(WorkflowTaskSchema).max(200),
451
+ checks: z.z.array(z.z.object({ name: z.z.string(), exitCode: z.z.number().nullable(), output: z.z.string(), version: z.z.string() })),
452
+ events: z.z.array(z.z.object({ at: z.z.number(), text: z.z.string() })).max(500),
453
+ notes: z.z.array(z.z.string()).max(30),
454
+ approvedPlanVersion: z.z.number().nullable(),
455
+ createdAt: z.z.number(),
456
+ updatedAt: z.z.number()
457
+ });
458
+ const WorkflowStartSchema = z.z.object({ id: z.z.string().uuid(), definition: WorkflowDefinitionSchema, task: text, directory: z.z.string().min(1).max(4e3) });
459
+ const WorkflowActionSchema = z.z.object({
460
+ id: z.z.string().uuid(),
461
+ expectedRevision: z.z.number().int(),
462
+ action: z.z.enum(["pause", "resume", "cancel", "approve_plan", "revise_plan", "retry_review", "replace_agent"]),
463
+ note: z.z.string().trim().max(24e3).default(""),
464
+ agentId: z.z.string().optional(),
465
+ replacement: WorkflowAgentSchema.optional()
466
+ });
467
+ function workflowEnabled(s) {
468
+ return s.experiments === true && s.expWorkflows === true;
469
+ }
470
+ const workflowStageLabel = { propose: "Independent proposals", consolidate: "Consolidating plan", plan_vote: "Planning consensus", execute: "Executing", review: "Independent review", verify: "Completion checks" };
471
+
369
472
  exports.AgentMessageSchema = AgentMessageSchema;
370
473
  exports.ApiMessageSchema = ApiMessageSchema;
371
474
  exports.ApiUpdateMachineStateSchema = ApiUpdateMachineStateSchema;
@@ -397,6 +500,16 @@ exports.VoiceConversationDeniedSchema = VoiceConversationDeniedSchema;
397
500
  exports.VoiceConversationGrantedSchema = VoiceConversationGrantedSchema;
398
501
  exports.VoiceConversationResponseSchema = VoiceConversationResponseSchema;
399
502
  exports.VoiceUsageResponseSchema = VoiceUsageResponseSchema;
503
+ exports.WorkflowActionSchema = WorkflowActionSchema;
504
+ exports.WorkflowAgentSchema = WorkflowAgentSchema;
505
+ exports.WorkflowDecisionSchema = WorkflowDecisionSchema;
506
+ exports.WorkflowDefinitionSchema = WorkflowDefinitionSchema;
507
+ exports.WorkflowLibrarySchema = WorkflowLibrarySchema;
508
+ exports.WorkflowRunSchema = WorkflowRunSchema;
509
+ exports.WorkflowSlotSchema = WorkflowSlotSchema;
510
+ exports.WorkflowStageSchema = WorkflowStageSchema;
511
+ exports.WorkflowStartSchema = WorkflowStartSchema;
512
+ exports.WorkflowTaskSchema = WorkflowTaskSchema;
400
513
  exports.authenticationContexts = authenticationContexts;
401
514
  exports.createEnvelope = createEnvelope;
402
515
  exports.encryptionContexts = encryptionContexts;
@@ -418,3 +531,5 @@ exports.sessionTurnEndEventSchema = sessionTurnEndEventSchema;
418
531
  exports.sessionTurnEndStatusSchema = sessionTurnEndStatusSchema;
419
532
  exports.sessionTurnStartEventSchema = sessionTurnStartEventSchema;
420
533
  exports.toWireMetadata = toWireMetadata;
534
+ exports.workflowEnabled = workflowEnabled;
535
+ exports.workflowStageLabel = workflowStageLabel;