@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 +164 -0
- package/dist/index.d.cts +695 -2
- package/dist/index.d.mts +695 -2
- package/dist/index.mjs +149 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
+
import { z as z$1 } from 'zod';
|
|
2
3
|
import { isCuid, createId } from '@paralleldrive/cuid2';
|
|
3
4
|
|
|
4
5
|
const sessionRoleSchema = z.enum(["user", "agent"]);
|
|
@@ -301,4 +302,151 @@ function toWireMetadata(value) {
|
|
|
301
302
|
return result;
|
|
302
303
|
}
|
|
303
304
|
|
|
304
|
-
|
|
305
|
+
const UsageProviderSchema = z.enum(["codex", "claude"]);
|
|
306
|
+
const ProviderUsageRequestSchema = z.object({
|
|
307
|
+
provider: UsageProviderSchema,
|
|
308
|
+
refresh: z.boolean().optional()
|
|
309
|
+
});
|
|
310
|
+
const ProviderUsageWindowSchema = z.object({
|
|
311
|
+
id: z.string(),
|
|
312
|
+
label: z.string(),
|
|
313
|
+
scope: z.string().optional(),
|
|
314
|
+
usedPercent: z.number().finite().nullable(),
|
|
315
|
+
remainingPercent: z.number().finite().nullable(),
|
|
316
|
+
resetsAt: z.number().finite().nullable(),
|
|
317
|
+
durationSeconds: z.number().finite().nullable()
|
|
318
|
+
});
|
|
319
|
+
const ProviderUsageBalanceSchema = z.object({
|
|
320
|
+
id: z.string(),
|
|
321
|
+
label: z.string(),
|
|
322
|
+
kind: z.enum(["credits", "spend_limit", "resets"]),
|
|
323
|
+
unit: z.enum(["credits", "currency", "count"]),
|
|
324
|
+
currency: z.string().optional(),
|
|
325
|
+
used: z.number().finite().nullable(),
|
|
326
|
+
limit: z.number().finite().nullable(),
|
|
327
|
+
remaining: z.number().finite().nullable(),
|
|
328
|
+
usedPercent: z.number().finite().nullable(),
|
|
329
|
+
unlimited: z.boolean().optional(),
|
|
330
|
+
enabled: z.boolean().optional(),
|
|
331
|
+
disabledReason: z.enum(["out_of_credits", "spend_limit_reached", "user_disabled", "unavailable"]).optional(),
|
|
332
|
+
resetsAt: z.number().finite().nullable(),
|
|
333
|
+
expiresAt: z.number().finite().nullable()
|
|
334
|
+
});
|
|
335
|
+
const ProviderUsageSnapshotSchema = z.object({
|
|
336
|
+
provider: UsageProviderSchema,
|
|
337
|
+
status: z.enum(["ok", "unauthenticated", "unsupported", "unavailable", "error"]),
|
|
338
|
+
account: z.object({ id: z.string().optional(), label: z.string(), plan: z.string().optional() }).nullable(),
|
|
339
|
+
checkedAt: z.number().finite(),
|
|
340
|
+
/** A successful check can return provider-cached data with an unknown age. */
|
|
341
|
+
dataAsOf: z.number().finite().nullable(),
|
|
342
|
+
freshness: z.enum(["live", "provider_cache_possible", "cached", "stale", "unknown"]),
|
|
343
|
+
windows: z.array(ProviderUsageWindowSchema),
|
|
344
|
+
balances: z.array(ProviderUsageBalanceSchema),
|
|
345
|
+
message: z.string().optional(),
|
|
346
|
+
retryAt: z.number().finite().optional()
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
const text = z$1.string().trim().min(1).max(24e3);
|
|
350
|
+
const WorkflowAgentSchema = z$1.object({
|
|
351
|
+
id: z$1.string().min(1).max(100),
|
|
352
|
+
revision: z$1.number().int().positive(),
|
|
353
|
+
name: z$1.string().min(1).max(60),
|
|
354
|
+
description: z$1.string().max(300),
|
|
355
|
+
provider: z$1.literal("codex"),
|
|
356
|
+
model: z$1.string().min(1).max(200),
|
|
357
|
+
effort: z$1.string().max(30).nullable(),
|
|
358
|
+
permissionMode: z$1.enum(["default", "read-only"]),
|
|
359
|
+
instructions: text,
|
|
360
|
+
documents: z$1.array(z$1.object({ name: z$1.string().max(120), content: z$1.string().max(16e3) })).max(5)
|
|
361
|
+
});
|
|
362
|
+
const WorkflowSlotSchema = z$1.object({ agent: WorkflowAgentSchema, assignment: text });
|
|
363
|
+
const WorkflowDefinitionSchema = z$1.object({
|
|
364
|
+
id: z$1.string().uuid(),
|
|
365
|
+
revision: z$1.number().int().positive(),
|
|
366
|
+
name: z$1.string().trim().min(1).max(80),
|
|
367
|
+
description: z$1.string().max(1e3),
|
|
368
|
+
planners: z$1.array(WorkflowSlotSchema).min(2).max(4),
|
|
369
|
+
executor: WorkflowSlotSchema,
|
|
370
|
+
reviewers: z$1.array(WorkflowSlotSchema).min(2).max(4),
|
|
371
|
+
criteria: text,
|
|
372
|
+
checks: z$1.array(z$1.object({ name: z$1.string().trim().min(1).max(100), command: z$1.string().trim().min(1).max(2e3) })).min(1).max(8),
|
|
373
|
+
planningRounds: z$1.number().int().min(1).max(5),
|
|
374
|
+
reviewRounds: z$1.number().int().min(1).max(5),
|
|
375
|
+
turnMinutes: z$1.number().int().min(1).max(30),
|
|
376
|
+
maxTurns: z$1.number().int().min(8).max(100),
|
|
377
|
+
approvePlan: z$1.boolean(),
|
|
378
|
+
updatedAt: z$1.number()
|
|
379
|
+
}).superRefine((d, ctx) => {
|
|
380
|
+
if (new TextEncoder().encode(JSON.stringify(d)).length > 64e3) ctx.addIssue({ code: "custom", message: "Workflow definition exceeds 64 KB. Shorten instructions or documents." });
|
|
381
|
+
const ids = [...d.planners, d.executor, ...d.reviewers].map((s) => s.agent.id);
|
|
382
|
+
if (new Set(ids).size !== ids.length) ctx.addIssue({ code: "custom", message: "Each workflow participant must be a different saved agent." });
|
|
383
|
+
if (d.executor.agent.permissionMode === "read-only") ctx.addIssue({ code: "custom", message: "The executor must allow workspace edits." });
|
|
384
|
+
});
|
|
385
|
+
const WorkflowLibrarySchema = z$1.array(WorkflowDefinitionSchema).max(20).refine((x) => JSON.stringify(x).length < 128e3, "Workflow library is too large.");
|
|
386
|
+
const WorkflowStageSchema = z$1.enum(["propose", "consolidate", "plan_vote", "execute", "review", "verify"]);
|
|
387
|
+
const WorkflowDecisionSchema = z$1.object({
|
|
388
|
+
decision: z$1.enum(["approve", "changes", "information", "replan"]),
|
|
389
|
+
summary: text,
|
|
390
|
+
document: z$1.string().max(24e3),
|
|
391
|
+
findings: z$1.array(z$1.object({ title: z$1.string().min(1).max(300), evidence: text, correction: text, blocking: z$1.boolean() })).max(20)
|
|
392
|
+
});
|
|
393
|
+
const WorkflowTaskSchema = z$1.object({
|
|
394
|
+
id: z$1.string(),
|
|
395
|
+
stage: WorkflowStageSchema,
|
|
396
|
+
round: z$1.number(),
|
|
397
|
+
agentId: z$1.string(),
|
|
398
|
+
agentName: z$1.string(),
|
|
399
|
+
clarifications: z$1.number().int().optional(),
|
|
400
|
+
assignment: z$1.string(),
|
|
401
|
+
version: z$1.string(),
|
|
402
|
+
status: z$1.enum(["running", "done", "interrupted"]),
|
|
403
|
+
startedAt: z$1.number(),
|
|
404
|
+
completedAt: z$1.number().optional(),
|
|
405
|
+
sessionId: z$1.string().optional(),
|
|
406
|
+
threadId: z$1.string().optional(),
|
|
407
|
+
prompt: z$1.string(),
|
|
408
|
+
result: WorkflowDecisionSchema.optional(),
|
|
409
|
+
error: z$1.string().optional()
|
|
410
|
+
});
|
|
411
|
+
const WorkflowRunSchema = z$1.object({
|
|
412
|
+
id: z$1.string().uuid(),
|
|
413
|
+
revision: z$1.number().int(),
|
|
414
|
+
definition: WorkflowDefinitionSchema,
|
|
415
|
+
machineId: z$1.string(),
|
|
416
|
+
task: text,
|
|
417
|
+
requestedDirectory: z$1.string().optional(),
|
|
418
|
+
sourceDirectory: z$1.string(),
|
|
419
|
+
directory: z$1.string(),
|
|
420
|
+
branch: z$1.string(),
|
|
421
|
+
baseCommit: z$1.string(),
|
|
422
|
+
status: z$1.enum(["running", "paused", "needs_input", "complete", "cancelled"]),
|
|
423
|
+
stage: WorkflowStageSchema,
|
|
424
|
+
planningRound: z$1.number().int(),
|
|
425
|
+
reviewRound: z$1.number().int(),
|
|
426
|
+
planVersion: z$1.number().int(),
|
|
427
|
+
plan: z$1.string(),
|
|
428
|
+
artifactVersion: z$1.string(),
|
|
429
|
+
reason: z$1.string(),
|
|
430
|
+
tasks: z$1.array(WorkflowTaskSchema).max(200),
|
|
431
|
+
checks: z$1.array(z$1.object({ name: z$1.string(), exitCode: z$1.number().nullable(), output: z$1.string(), version: z$1.string() })),
|
|
432
|
+
events: z$1.array(z$1.object({ at: z$1.number(), text: z$1.string() })).max(500),
|
|
433
|
+
notes: z$1.array(z$1.string()).max(30),
|
|
434
|
+
approvedPlanVersion: z$1.number().nullable(),
|
|
435
|
+
createdAt: z$1.number(),
|
|
436
|
+
updatedAt: z$1.number()
|
|
437
|
+
});
|
|
438
|
+
const WorkflowStartSchema = z$1.object({ id: z$1.string().uuid(), definition: WorkflowDefinitionSchema, task: text, directory: z$1.string().min(1).max(4e3) });
|
|
439
|
+
const WorkflowActionSchema = z$1.object({
|
|
440
|
+
id: z$1.string().uuid(),
|
|
441
|
+
expectedRevision: z$1.number().int(),
|
|
442
|
+
action: z$1.enum(["pause", "resume", "cancel", "approve_plan", "revise_plan", "retry_review", "replace_agent"]),
|
|
443
|
+
note: z$1.string().trim().max(24e3).default(""),
|
|
444
|
+
agentId: z$1.string().optional(),
|
|
445
|
+
replacement: WorkflowAgentSchema.optional()
|
|
446
|
+
});
|
|
447
|
+
function workflowEnabled(s) {
|
|
448
|
+
return s.experiments === true && s.expWorkflows === true;
|
|
449
|
+
}
|
|
450
|
+
const workflowStageLabel = { propose: "Independent proposals", consolidate: "Consolidating plan", plan_vote: "Planning consensus", execute: "Executing", review: "Independent review", verify: "Completion checks" };
|
|
451
|
+
|
|
452
|
+
export { AgentMessageSchema, ApiMessageSchema, ApiUpdateMachineStateSchema, ApiUpdateNewMessageSchema, ApiUpdateSessionStateSchema, CoreUpdateBodySchema, CoreUpdateContainerSchema, LegacyMessageContentSchema, MessageContentSchema, MessageMetaSchema, ProviderUsageBalanceSchema, ProviderUsageRequestSchema, ProviderUsageSnapshotSchema, ProviderUsageWindowSchema, SessionMessageContentSchema, SessionMessageSchema, SessionProtocolMessageSchema, UpdateBodySchema, UpdateMachineBodySchema, UpdateNewMessageBodySchema, UpdateSchema, UpdateSessionBodySchema, UsageProviderSchema, UserMessageSchema, VersionedEncryptedValueSchema, VersionedMachineEncryptedValueSchema, VersionedNullableEncryptedValueSchema, VoiceConversationDeniedSchema, VoiceConversationGrantedSchema, VoiceConversationResponseSchema, VoiceUsageResponseSchema, WorkflowActionSchema, WorkflowAgentSchema, WorkflowDecisionSchema, WorkflowDefinitionSchema, WorkflowLibrarySchema, WorkflowRunSchema, WorkflowSlotSchema, WorkflowStageSchema, WorkflowStartSchema, WorkflowTaskSchema, authenticationContexts, createEnvelope, encryptionContexts, legacyInstallation, legacyServerBanner, normalizeMetadata, rpcMethods, sessionEnvelopeSchema, sessionEventSchema, sessionFileEventSchema, sessionRoleSchema, sessionServiceMessageEventSchema, sessionStartEventSchema, sessionStopEventSchema, sessionTextEventSchema, sessionToolCallEndEventSchema, sessionToolCallStartEventSchema, sessionTurnEndEventSchema, sessionTurnEndStatusSchema, sessionTurnStartEventSchema, toWireMetadata, workflowEnabled, workflowStageLabel };
|