@ahmadposten/talos-wire 0.1.0 → 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
@@ -322,6 +322,153 @@ function toWireMetadata(value) {
322
322
  return result;
323
323
  }
324
324
 
325
+ const UsageProviderSchema = z__namespace.enum(["codex", "claude"]);
326
+ const ProviderUsageRequestSchema = z__namespace.object({
327
+ provider: UsageProviderSchema,
328
+ refresh: z__namespace.boolean().optional()
329
+ });
330
+ const ProviderUsageWindowSchema = z__namespace.object({
331
+ id: z__namespace.string(),
332
+ label: z__namespace.string(),
333
+ scope: z__namespace.string().optional(),
334
+ usedPercent: z__namespace.number().finite().nullable(),
335
+ remainingPercent: z__namespace.number().finite().nullable(),
336
+ resetsAt: z__namespace.number().finite().nullable(),
337
+ durationSeconds: z__namespace.number().finite().nullable()
338
+ });
339
+ const ProviderUsageBalanceSchema = z__namespace.object({
340
+ id: z__namespace.string(),
341
+ label: z__namespace.string(),
342
+ kind: z__namespace.enum(["credits", "spend_limit", "resets"]),
343
+ unit: z__namespace.enum(["credits", "currency", "count"]),
344
+ currency: z__namespace.string().optional(),
345
+ used: z__namespace.number().finite().nullable(),
346
+ limit: z__namespace.number().finite().nullable(),
347
+ remaining: z__namespace.number().finite().nullable(),
348
+ usedPercent: z__namespace.number().finite().nullable(),
349
+ unlimited: z__namespace.boolean().optional(),
350
+ enabled: z__namespace.boolean().optional(),
351
+ disabledReason: z__namespace.enum(["out_of_credits", "spend_limit_reached", "user_disabled", "unavailable"]).optional(),
352
+ resetsAt: z__namespace.number().finite().nullable(),
353
+ expiresAt: z__namespace.number().finite().nullable()
354
+ });
355
+ const ProviderUsageSnapshotSchema = z__namespace.object({
356
+ provider: UsageProviderSchema,
357
+ status: z__namespace.enum(["ok", "unauthenticated", "unsupported", "unavailable", "error"]),
358
+ account: z__namespace.object({ id: z__namespace.string().optional(), label: z__namespace.string(), plan: z__namespace.string().optional() }).nullable(),
359
+ checkedAt: z__namespace.number().finite(),
360
+ /** A successful check can return provider-cached data with an unknown age. */
361
+ dataAsOf: z__namespace.number().finite().nullable(),
362
+ freshness: z__namespace.enum(["live", "provider_cache_possible", "cached", "stale", "unknown"]),
363
+ windows: z__namespace.array(ProviderUsageWindowSchema),
364
+ balances: z__namespace.array(ProviderUsageBalanceSchema),
365
+ message: z__namespace.string().optional(),
366
+ retryAt: z__namespace.number().finite().optional()
367
+ });
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
+
325
472
  exports.AgentMessageSchema = AgentMessageSchema;
326
473
  exports.ApiMessageSchema = ApiMessageSchema;
327
474
  exports.ApiUpdateMachineStateSchema = ApiUpdateMachineStateSchema;
@@ -332,6 +479,10 @@ exports.CoreUpdateContainerSchema = CoreUpdateContainerSchema;
332
479
  exports.LegacyMessageContentSchema = LegacyMessageContentSchema;
333
480
  exports.MessageContentSchema = MessageContentSchema;
334
481
  exports.MessageMetaSchema = MessageMetaSchema;
482
+ exports.ProviderUsageBalanceSchema = ProviderUsageBalanceSchema;
483
+ exports.ProviderUsageRequestSchema = ProviderUsageRequestSchema;
484
+ exports.ProviderUsageSnapshotSchema = ProviderUsageSnapshotSchema;
485
+ exports.ProviderUsageWindowSchema = ProviderUsageWindowSchema;
335
486
  exports.SessionMessageContentSchema = SessionMessageContentSchema;
336
487
  exports.SessionMessageSchema = SessionMessageSchema;
337
488
  exports.SessionProtocolMessageSchema = SessionProtocolMessageSchema;
@@ -340,6 +491,7 @@ exports.UpdateMachineBodySchema = UpdateMachineBodySchema;
340
491
  exports.UpdateNewMessageBodySchema = UpdateNewMessageBodySchema;
341
492
  exports.UpdateSchema = UpdateSchema;
342
493
  exports.UpdateSessionBodySchema = UpdateSessionBodySchema;
494
+ exports.UsageProviderSchema = UsageProviderSchema;
343
495
  exports.UserMessageSchema = UserMessageSchema;
344
496
  exports.VersionedEncryptedValueSchema = VersionedEncryptedValueSchema;
345
497
  exports.VersionedMachineEncryptedValueSchema = VersionedMachineEncryptedValueSchema;
@@ -348,6 +500,16 @@ exports.VoiceConversationDeniedSchema = VoiceConversationDeniedSchema;
348
500
  exports.VoiceConversationGrantedSchema = VoiceConversationGrantedSchema;
349
501
  exports.VoiceConversationResponseSchema = VoiceConversationResponseSchema;
350
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;
351
513
  exports.authenticationContexts = authenticationContexts;
352
514
  exports.createEnvelope = createEnvelope;
353
515
  exports.encryptionContexts = encryptionContexts;
@@ -369,3 +531,5 @@ exports.sessionTurnEndEventSchema = sessionTurnEndEventSchema;
369
531
  exports.sessionTurnEndStatusSchema = sessionTurnEndStatusSchema;
370
532
  exports.sessionTurnStartEventSchema = sessionTurnStartEventSchema;
371
533
  exports.toWireMetadata = toWireMetadata;
534
+ exports.workflowEnabled = workflowEnabled;
535
+ exports.workflowStageLabel = workflowStageLabel;