Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

orchestration.ts

1,214 lines38.9 KB

1import { Effect, Option, Schema, SchemaIssue, Struct } from "effect";
2import { ClaudeModelOptions, CodexModelOptions } from "./model";
3import { RepositoryIdentity } from "./environment";
4import {
5 ApprovalRequestId,
6 CheckpointRef,
7 CommandId,
8 EventId,
9 IsoDateTime,
10 MessageId,
11 NonNegativeInt,
12 ProjectId,
13 ProviderItemId,
14 ThreadId,
15 TrimmedNonEmptyString,
16 TurnId,
17} from "./baseSchemas";
18​
19export const ORCHESTRATION_WS_METHODS = {
20 dispatchCommand: "orchestration.dispatchCommand",
21 getTurnDiff: "orchestration.getTurnDiff",
22 getFullThreadDiff: "orchestration.getFullThreadDiff",
23 replayEvents: "orchestration.replayEvents",
24 subscribeShell: "orchestration.subscribeShell",
25 subscribeThread: "orchestration.subscribeThread",
26} as const;
27​
28export const ProviderKind = Schema.Literals(["codex", "claudeAgent"]);
29export type ProviderKind = typeof ProviderKind.Type;
30export const ProviderApprovalPolicy = Schema.Literals([
31 "untrusted",
32 "on-failure",
33 "on-request",
34 "never",
35]);
36export type ProviderApprovalPolicy = typeof ProviderApprovalPolicy.Type;
37export const ProviderSandboxMode = Schema.Literals([
38 "read-only",
39 "workspace-write",
40 "danger-full-access",
41]);
42export type ProviderSandboxMode = typeof ProviderSandboxMode.Type;
43​
44export const DEFAULT_PROVIDER_KIND: ProviderKind = "codex";
45​
46export const CodexModelSelection = Schema.Struct({
47 provider: Schema.Literal("codex"),
48 model: TrimmedNonEmptyString,
49 options: Schema.optionalKey(CodexModelOptions),
50});
51export type CodexModelSelection = typeof CodexModelSelection.Type;
52​
53export const ClaudeModelSelection = Schema.Struct({
54 provider: Schema.Literal("claudeAgent"),
55 model: TrimmedNonEmptyString,
56 options: Schema.optionalKey(ClaudeModelOptions),
57});
58export type ClaudeModelSelection = typeof ClaudeModelSelection.Type;
59​
60export const ModelSelection = Schema.Union([CodexModelSelection, ClaudeModelSelection]);
61export type ModelSelection = typeof ModelSelection.Type;
62​
63export const RuntimeMode = Schema.Literals([
64 "approval-required",
65 "auto-accept-edits",
66 "full-access",
67]);
68export type RuntimeMode = typeof RuntimeMode.Type;
69export const DEFAULT_RUNTIME_MODE: RuntimeMode = "full-access";
70export const ProviderInteractionMode = Schema.Literals(["default", "plan"]);
71export type ProviderInteractionMode = typeof ProviderInteractionMode.Type;
72export const DEFAULT_PROVIDER_INTERACTION_MODE: ProviderInteractionMode = "default";
73export const ProviderRequestKind = Schema.Literals(["command", "file-read", "file-change"]);
74export type ProviderRequestKind = typeof ProviderRequestKind.Type;
75export const AssistantDeliveryMode = Schema.Literals(["buffered", "streaming"]);
76export type AssistantDeliveryMode = typeof AssistantDeliveryMode.Type;
77export const ProviderApprovalDecision = Schema.Literals([
78 "accept",
79 "acceptForSession",
80 "decline",
81 "cancel",
82]);
83export type ProviderApprovalDecision = typeof ProviderApprovalDecision.Type;
84export const ProviderUserInputAnswers = Schema.Record(Schema.String, Schema.Unknown);
85export type ProviderUserInputAnswers = typeof ProviderUserInputAnswers.Type;
86​
87export const PROVIDER_SEND_TURN_MAX_INPUT_CHARS = 120_000;
88export const PROVIDER_SEND_TURN_MAX_ATTACHMENTS = 8;
89export const PROVIDER_SEND_TURN_MAX_IMAGE_BYTES = 10 * 1024 * 1024;
90const PROVIDER_SEND_TURN_MAX_IMAGE_DATA_URL_CHARS = 14_000_000;
91const CHAT_ATTACHMENT_ID_MAX_CHARS = 128;
92// Correlation id is command id by design in this model.
93export const CorrelationId = CommandId;
94export type CorrelationId = typeof CorrelationId.Type;
95​
96const ChatAttachmentId = TrimmedNonEmptyString.check(
97 Schema.isMaxLength(CHAT_ATTACHMENT_ID_MAX_CHARS),
98 Schema.isPattern(/^[a-z0-9_-]+$/i),
99);
100export type ChatAttachmentId = typeof ChatAttachmentId.Type;
101​
102export const ChatImageAttachment = Schema.Struct({
103 type: Schema.Literal("image"),
104 id: ChatAttachmentId,
105 name: TrimmedNonEmptyString.check(Schema.isMaxLength(255)),
106 mimeType: TrimmedNonEmptyString.check(Schema.isMaxLength(100), Schema.isPattern(/^image\//i)),
107 sizeBytes: NonNegativeInt.check(Schema.isLessThanOrEqualTo(PROVIDER_SEND_TURN_MAX_IMAGE_BYTES)),
108});
109export type ChatImageAttachment = typeof ChatImageAttachment.Type;
110​
111const UploadChatImageAttachment = Schema.Struct({
112 type: Schema.Literal("image"),
113 name: TrimmedNonEmptyString.check(Schema.isMaxLength(255)),
114 mimeType: TrimmedNonEmptyString.check(Schema.isMaxLength(100), Schema.isPattern(/^image\//i)),
115 sizeBytes: NonNegativeInt.check(Schema.isLessThanOrEqualTo(PROVIDER_SEND_TURN_MAX_IMAGE_BYTES)),
116 dataUrl: TrimmedNonEmptyString.check(
117 Schema.isMaxLength(PROVIDER_SEND_TURN_MAX_IMAGE_DATA_URL_CHARS),
118 ),
119});
120export type UploadChatImageAttachment = typeof UploadChatImageAttachment.Type;
121​
122export const ChatAttachment = Schema.Union([ChatImageAttachment]);
123export type ChatAttachment = typeof ChatAttachment.Type;
124const UploadChatAttachment = Schema.Union([UploadChatImageAttachment]);
125export type UploadChatAttachment = typeof UploadChatAttachment.Type;
126​
127export const ProjectScriptIcon = Schema.Literals([
128 "play",
129 "test",
130 "lint",
131 "configure",
132 "build",
133 "debug",
134]);
135export type ProjectScriptIcon = typeof ProjectScriptIcon.Type;
136​
137export const ProjectScript = Schema.Struct({
138 id: TrimmedNonEmptyString,
139 name: TrimmedNonEmptyString,
140 command: TrimmedNonEmptyString,
141 icon: ProjectScriptIcon,
142 runOnWorktreeCreate: Schema.Boolean,
143});
144export type ProjectScript = typeof ProjectScript.Type;
145​
146export const OrchestrationProject = Schema.Struct({
147 id: ProjectId,
148 title: TrimmedNonEmptyString,
149 workspaceRoot: TrimmedNonEmptyString,
150 repositoryIdentity: Schema.optional(Schema.NullOr(RepositoryIdentity)),
151 defaultModelSelection: Schema.NullOr(ModelSelection),
152 scripts: Schema.Array(ProjectScript),
153 createdAt: IsoDateTime,
154 updatedAt: IsoDateTime,
155 deletedAt: Schema.NullOr(IsoDateTime),
156});
157export type OrchestrationProject = typeof OrchestrationProject.Type;
158​
159export const OrchestrationMessageRole = Schema.Literals(["user", "assistant", "system"]);
160export type OrchestrationMessageRole = typeof OrchestrationMessageRole.Type;
161​
162export const OrchestrationMessage = Schema.Struct({
163 id: MessageId,
164 role: OrchestrationMessageRole,
165 text: Schema.String,
166 attachments: Schema.optional(Schema.Array(ChatAttachment)),
167 turnId: Schema.NullOr(TurnId),
168 streaming: Schema.Boolean,
169 createdAt: IsoDateTime,
170 updatedAt: IsoDateTime,
171});
172export type OrchestrationMessage = typeof OrchestrationMessage.Type;
173​
174export const OrchestrationProposedPlanId = TrimmedNonEmptyString;
175export type OrchestrationProposedPlanId = typeof OrchestrationProposedPlanId.Type;
176​
177export const OrchestrationProposedPlan = Schema.Struct({
178 id: OrchestrationProposedPlanId,
179 turnId: Schema.NullOr(TurnId),
180 planMarkdown: TrimmedNonEmptyString,
181 implementedAt: Schema.NullOr(IsoDateTime).pipe(Schema.withDecodingDefault(Effect.succeed(null))),
182 implementationThreadId: Schema.NullOr(ThreadId).pipe(
183 Schema.withDecodingDefault(Effect.succeed(null)),
184 ),
185 createdAt: IsoDateTime,
186 updatedAt: IsoDateTime,
187});
188export type OrchestrationProposedPlan = typeof OrchestrationProposedPlan.Type;
189​
190const SourceProposedPlanReference = Schema.Struct({
191 threadId: ThreadId,
192 planId: OrchestrationProposedPlanId,
193});
194​
195export const OrchestrationSessionStatus = Schema.Literals([
196 "idle",
197 "starting",
198 "running",
199 "ready",
200 "interrupted",
201 "stopped",
202 "error",
203]);
204export type OrchestrationSessionStatus = typeof OrchestrationSessionStatus.Type;
205​
206export const OrchestrationSession = Schema.Struct({
207 threadId: ThreadId,
208 status: OrchestrationSessionStatus,
209 providerName: Schema.NullOr(TrimmedNonEmptyString),
210 runtimeMode: RuntimeMode.pipe(Schema.withDecodingDefault(Effect.succeed(DEFAULT_RUNTIME_MODE))),
211 activeTurnId: Schema.NullOr(TurnId),
212 lastError: Schema.NullOr(TrimmedNonEmptyString),
213 updatedAt: IsoDateTime,
214});
215export type OrchestrationSession = typeof OrchestrationSession.Type;
216​
217export const OrchestrationCheckpointFile = Schema.Struct({
218 path: TrimmedNonEmptyString,
219 kind: TrimmedNonEmptyString,
220 additions: NonNegativeInt,
221 deletions: NonNegativeInt,
222});
223export type OrchestrationCheckpointFile = typeof OrchestrationCheckpointFile.Type;
224​
225export const OrchestrationCheckpointStatus = Schema.Literals(["ready", "missing", "error"]);
226export type OrchestrationCheckpointStatus = typeof OrchestrationCheckpointStatus.Type;
227​
228export const OrchestrationCheckpointSummary = Schema.Struct({
229 turnId: TurnId,
230 checkpointTurnCount: NonNegativeInt,
231 checkpointRef: CheckpointRef,
232 status: OrchestrationCheckpointStatus,
233 files: Schema.Array(OrchestrationCheckpointFile),
234 assistantMessageId: Schema.NullOr(MessageId),
235 completedAt: IsoDateTime,
236});
237export type OrchestrationCheckpointSummary = typeof OrchestrationCheckpointSummary.Type;
238​
239export const OrchestrationThreadActivityTone = Schema.Literals([
240 "info",
241 "tool",
242 "approval",
243 "error",
244]);
245export type OrchestrationThreadActivityTone = typeof OrchestrationThreadActivityTone.Type;
246​
247export const OrchestrationThreadActivity = Schema.Struct({
248 id: EventId,
249 tone: OrchestrationThreadActivityTone,
250 kind: TrimmedNonEmptyString,
251 summary: TrimmedNonEmptyString,
252 payload: Schema.Unknown,
253 turnId: Schema.NullOr(TurnId),
254 sequence: Schema.optional(NonNegativeInt),
255 createdAt: IsoDateTime,
256});
257export type OrchestrationThreadActivity = typeof OrchestrationThreadActivity.Type;
258​
259const OrchestrationLatestTurnState = Schema.Literals([
260 "running",
261 "interrupted",
262 "completed",
263 "error",
264]);
265export type OrchestrationLatestTurnState = typeof OrchestrationLatestTurnState.Type;
266​
267export const OrchestrationLatestTurn = Schema.Struct({
268 turnId: TurnId,
269 state: OrchestrationLatestTurnState,
270 requestedAt: IsoDateTime,
271 startedAt: Schema.NullOr(IsoDateTime),
272 completedAt: Schema.NullOr(IsoDateTime),
273 assistantMessageId: Schema.NullOr(MessageId),
274 sourceProposedPlan: Schema.optional(SourceProposedPlanReference),
275});
276export type OrchestrationLatestTurn = typeof OrchestrationLatestTurn.Type;
277​
278export const OrchestrationThread = Schema.Struct({
279 id: ThreadId,
280 projectId: ProjectId,
281 title: TrimmedNonEmptyString,
282 modelSelection: ModelSelection,
283 runtimeMode: RuntimeMode,
284 interactionMode: ProviderInteractionMode.pipe(
285 Schema.withDecodingDefault(Effect.succeed(DEFAULT_PROVIDER_INTERACTION_MODE)),
286 ),
287 branch: Schema.NullOr(TrimmedNonEmptyString),
288 worktreePath: Schema.NullOr(TrimmedNonEmptyString),
289 latestTurn: Schema.NullOr(OrchestrationLatestTurn),
290 createdAt: IsoDateTime,
291 updatedAt: IsoDateTime,
292 archivedAt: Schema.NullOr(IsoDateTime).pipe(Schema.withDecodingDefault(Effect.succeed(null))),
293 deletedAt: Schema.NullOr(IsoDateTime),
294 messages: Schema.Array(OrchestrationMessage),
295 proposedPlans: Schema.Array(OrchestrationProposedPlan).pipe(
296 Schema.withDecodingDefault(Effect.succeed([])),
297 ),
298 activities: Schema.Array(OrchestrationThreadActivity),
299 checkpoints: Schema.Array(OrchestrationCheckpointSummary),
300 session: Schema.NullOr(OrchestrationSession),
301});
302export type OrchestrationThread = typeof OrchestrationThread.Type;
303​
304export const OrchestrationReadModel = Schema.Struct({
305 snapshotSequence: NonNegativeInt,
306 projects: Schema.Array(OrchestrationProject),
307 threads: Schema.Array(OrchestrationThread),
308 updatedAt: IsoDateTime,
309});
310export type OrchestrationReadModel = typeof OrchestrationReadModel.Type;
311​
312export const OrchestrationProjectShell = Schema.Struct({
313 id: ProjectId,
314 title: TrimmedNonEmptyString,
315 workspaceRoot: TrimmedNonEmptyString,
316 repositoryIdentity: Schema.optional(Schema.NullOr(RepositoryIdentity)),
317 defaultModelSelection: Schema.NullOr(ModelSelection),
318 scripts: Schema.Array(ProjectScript),
319 createdAt: IsoDateTime,
320 updatedAt: IsoDateTime,
321});
322export type OrchestrationProjectShell = typeof OrchestrationProjectShell.Type;
323​
324export const OrchestrationThreadShell = Schema.Struct({
325 id: ThreadId,
326 projectId: ProjectId,
327 title: TrimmedNonEmptyString,
328 modelSelection: ModelSelection,
329 runtimeMode: RuntimeMode,
330 interactionMode: ProviderInteractionMode.pipe(
331 Schema.withDecodingDefault(Effect.succeed(DEFAULT_PROVIDER_INTERACTION_MODE)),
332 ),
333 branch: Schema.NullOr(TrimmedNonEmptyString),
334 worktreePath: Schema.NullOr(TrimmedNonEmptyString),
335 latestTurn: Schema.NullOr(OrchestrationLatestTurn),
336 createdAt: IsoDateTime,
337 updatedAt: IsoDateTime,
338 archivedAt: Schema.NullOr(IsoDateTime).pipe(Schema.withDecodingDefault(Effect.succeed(null))),
339 session: Schema.NullOr(OrchestrationSession),
340 latestUserMessageAt: Schema.NullOr(IsoDateTime),
341 hasPendingApprovals: Schema.Boolean,
342 hasPendingUserInput: Schema.Boolean,
343 hasActionableProposedPlan: Schema.Boolean,
344});
345export type OrchestrationThreadShell = typeof OrchestrationThreadShell.Type;
346​
347export const OrchestrationShellSnapshot = Schema.Struct({
348 snapshotSequence: NonNegativeInt,
349 projects: Schema.Array(OrchestrationProjectShell),
350 threads: Schema.Array(OrchestrationThreadShell),
351 updatedAt: IsoDateTime,
352});
353export type OrchestrationShellSnapshot = typeof OrchestrationShellSnapshot.Type;
354​
355export const OrchestrationShellStreamEvent = Schema.Union([
356 Schema.Struct({
357 kind: Schema.Literal("project-upserted"),
358 sequence: NonNegativeInt,
359 project: OrchestrationProjectShell,
360 }),
361 Schema.Struct({
362 kind: Schema.Literal("project-removed"),
363 sequence: NonNegativeInt,
364 projectId: ProjectId,
365 }),
366 Schema.Struct({
367 kind: Schema.Literal("thread-upserted"),
368 sequence: NonNegativeInt,
369 thread: OrchestrationThreadShell,
370 }),
371 Schema.Struct({
372 kind: Schema.Literal("thread-removed"),
373 sequence: NonNegativeInt,
374 threadId: ThreadId,
375 }),
376]);
377export type OrchestrationShellStreamEvent = typeof OrchestrationShellStreamEvent.Type;
378​
379export const OrchestrationShellStreamItem = Schema.Union([
380 Schema.Struct({
381 kind: Schema.Literal("snapshot"),
382 snapshot: OrchestrationShellSnapshot,
383 }),
384 OrchestrationShellStreamEvent,
385]);
386export type OrchestrationShellStreamItem = typeof OrchestrationShellStreamItem.Type;
387​
388export const OrchestrationSubscribeThreadInput = Schema.Struct({
389 threadId: ThreadId,
390});
391export type OrchestrationSubscribeThreadInput = typeof OrchestrationSubscribeThreadInput.Type;
392​
393export const OrchestrationThreadDetailSnapshot = Schema.Struct({
394 snapshotSequence: NonNegativeInt,
395 thread: OrchestrationThread,
396});
397export type OrchestrationThreadDetailSnapshot = typeof OrchestrationThreadDetailSnapshot.Type;
398​
399export const ProjectCreateCommand = Schema.Struct({
400 type: Schema.Literal("project.create"),
401 commandId: CommandId,
402 projectId: ProjectId,
403 title: TrimmedNonEmptyString,
404 workspaceRoot: TrimmedNonEmptyString,
405 createWorkspaceRootIfMissing: Schema.optional(Schema.Boolean),
406 defaultModelSelection: Schema.optional(Schema.NullOr(ModelSelection)),
407 createdAt: IsoDateTime,
408});
409​
410const ProjectMetaUpdateCommand = Schema.Struct({
411 type: Schema.Literal("project.meta.update"),
412 commandId: CommandId,
413 projectId: ProjectId,
414 title: Schema.optional(TrimmedNonEmptyString),
415 workspaceRoot: Schema.optional(TrimmedNonEmptyString),
416 defaultModelSelection: Schema.optional(Schema.NullOr(ModelSelection)),
417 scripts: Schema.optional(Schema.Array(ProjectScript)),
418});
419​
420const ProjectDeleteCommand = Schema.Struct({
421 type: Schema.Literal("project.delete"),
422 commandId: CommandId,
423 projectId: ProjectId,
424});
425​
426const ThreadCreateCommand = Schema.Struct({
427 type: Schema.Literal("thread.create"),
428 commandId: CommandId,
429 threadId: ThreadId,
430 projectId: ProjectId,
431 title: TrimmedNonEmptyString,
432 modelSelection: ModelSelection,
433 runtimeMode: RuntimeMode,
434 interactionMode: ProviderInteractionMode.pipe(
435 Schema.withDecodingDefault(Effect.succeed(DEFAULT_PROVIDER_INTERACTION_MODE)),
436 ),
437 branch: Schema.NullOr(TrimmedNonEmptyString),
438 worktreePath: Schema.NullOr(TrimmedNonEmptyString),
439 createdAt: IsoDateTime,
440});
441​
442const ThreadDeleteCommand = Schema.Struct({
443 type: Schema.Literal("thread.delete"),
444 commandId: CommandId,
445 threadId: ThreadId,
446});
447​
448const ThreadArchiveCommand = Schema.Struct({
449 type: Schema.Literal("thread.archive"),
450 commandId: CommandId,
451 threadId: ThreadId,
452});
453​
454const ThreadUnarchiveCommand = Schema.Struct({
455 type: Schema.Literal("thread.unarchive"),
456 commandId: CommandId,
457 threadId: ThreadId,
458});
459​
460const ThreadMetaUpdateCommand = Schema.Struct({
461 type: Schema.Literal("thread.meta.update"),
462 commandId: CommandId,
463 threadId: ThreadId,
464 title: Schema.optional(TrimmedNonEmptyString),
465 modelSelection: Schema.optional(ModelSelection),
466 branch: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)),
467 worktreePath: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)),
468});
469​
470const ThreadRuntimeModeSetCommand = Schema.Struct({
471 type: Schema.Literal("thread.runtime-mode.set"),
472 commandId: CommandId,
473 threadId: ThreadId,
474 runtimeMode: RuntimeMode,
475 createdAt: IsoDateTime,
476});
477​
478const ThreadInteractionModeSetCommand = Schema.Struct({
479 type: Schema.Literal("thread.interaction-mode.set"),
480 commandId: CommandId,
481 threadId: ThreadId,
482 interactionMode: ProviderInteractionMode,
483 createdAt: IsoDateTime,
484});
485​
486const ThreadTurnStartBootstrapCreateThread = Schema.Struct({
487 projectId: ProjectId,
488 title: TrimmedNonEmptyString,
489 modelSelection: ModelSelection,
490 runtimeMode: RuntimeMode,
491 interactionMode: ProviderInteractionMode,
492 branch: Schema.NullOr(TrimmedNonEmptyString),
493 worktreePath: Schema.NullOr(TrimmedNonEmptyString),
494 createdAt: IsoDateTime,
495});
496​
497const ThreadTurnStartBootstrapPrepareWorktree = Schema.Struct({
498 projectCwd: TrimmedNonEmptyString,
499 baseBranch: TrimmedNonEmptyString,
500 branch: Schema.optional(TrimmedNonEmptyString),
501});
502​
503const ThreadTurnStartBootstrap = Schema.Struct({
504 createThread: Schema.optional(ThreadTurnStartBootstrapCreateThread),
505 prepareWorktree: Schema.optional(ThreadTurnStartBootstrapPrepareWorktree),
506 runSetupScript: Schema.optional(Schema.Boolean),
507});
508​
509export type ThreadTurnStartBootstrap = typeof ThreadTurnStartBootstrap.Type;
510​
511export const ThreadTurnStartCommand = Schema.Struct({
512 type: Schema.Literal("thread.turn.start"),
513 commandId: CommandId,
514 threadId: ThreadId,
515 message: Schema.Struct({
516 messageId: MessageId,
517 role: Schema.Literal("user"),
518 text: Schema.String,
519 attachments: Schema.Array(ChatAttachment),
520 }),
521 modelSelection: Schema.optional(ModelSelection),
522 titleSeed: Schema.optional(TrimmedNonEmptyString),
523 runtimeMode: RuntimeMode.pipe(Schema.withDecodingDefault(Effect.succeed(DEFAULT_RUNTIME_MODE))),
524 interactionMode: ProviderInteractionMode.pipe(
525 Schema.withDecodingDefault(Effect.succeed(DEFAULT_PROVIDER_INTERACTION_MODE)),
526 ),
527 bootstrap: Schema.optional(ThreadTurnStartBootstrap),
528 sourceProposedPlan: Schema.optional(SourceProposedPlanReference),
529 createdAt: IsoDateTime,
530});
531​
532const ClientThreadTurnStartCommand = Schema.Struct({
533 type: Schema.Literal("thread.turn.start"),
534 commandId: CommandId,
535 threadId: ThreadId,
536 message: Schema.Struct({
537 messageId: MessageId,
538 role: Schema.Literal("user"),
539 text: Schema.String,
540 attachments: Schema.Array(UploadChatAttachment),
541 }),
542 modelSelection: Schema.optional(ModelSelection),
543 titleSeed: Schema.optional(TrimmedNonEmptyString),
544 runtimeMode: RuntimeMode,
545 interactionMode: ProviderInteractionMode,
546 bootstrap: Schema.optional(ThreadTurnStartBootstrap),
547 sourceProposedPlan: Schema.optional(SourceProposedPlanReference),
548 createdAt: IsoDateTime,
549});
550​
551const ThreadTurnInterruptCommand = Schema.Struct({
552 type: Schema.Literal("thread.turn.interrupt"),
553 commandId: CommandId,
554 threadId: ThreadId,
555 turnId: Schema.optional(TurnId),
556 createdAt: IsoDateTime,
557});
558​
559const ThreadApprovalRespondCommand = Schema.Struct({
560 type: Schema.Literal("thread.approval.respond"),
561 commandId: CommandId,
562 threadId: ThreadId,
563 requestId: ApprovalRequestId,
564 decision: ProviderApprovalDecision,
565 createdAt: IsoDateTime,
566});
567​
568const ThreadUserInputRespondCommand = Schema.Struct({
569 type: Schema.Literal("thread.user-input.respond"),
570 commandId: CommandId,
571 threadId: ThreadId,
572 requestId: ApprovalRequestId,
573 answers: ProviderUserInputAnswers,
574 createdAt: IsoDateTime,
575});
576​
577const ThreadCheckpointRevertCommand = Schema.Struct({
578 type: Schema.Literal("thread.checkpoint.revert"),
579 commandId: CommandId,
580 threadId: ThreadId,
581 turnCount: NonNegativeInt,
582 createdAt: IsoDateTime,
583});
584​
585const ThreadSessionStopCommand = Schema.Struct({
586 type: Schema.Literal("thread.session.stop"),
587 commandId: CommandId,
588 threadId: ThreadId,
589 createdAt: IsoDateTime,
590});
591​
592const DispatchableClientOrchestrationCommand = Schema.Union([
593 ProjectCreateCommand,
594 ProjectMetaUpdateCommand,
595 ProjectDeleteCommand,
596 ThreadCreateCommand,
597 ThreadDeleteCommand,
598 ThreadArchiveCommand,
599 ThreadUnarchiveCommand,
600 ThreadMetaUpdateCommand,
601 ThreadRuntimeModeSetCommand,
602 ThreadInteractionModeSetCommand,
603 ThreadTurnStartCommand,
604 ThreadTurnInterruptCommand,
605 ThreadApprovalRespondCommand,
606 ThreadUserInputRespondCommand,
607 ThreadCheckpointRevertCommand,
608 ThreadSessionStopCommand,
609]);
610export type DispatchableClientOrchestrationCommand =
611 typeof DispatchableClientOrchestrationCommand.Type;
612​
613export const ClientOrchestrationCommand = Schema.Union([
614 ProjectCreateCommand,
615 ProjectMetaUpdateCommand,
616 ProjectDeleteCommand,
617 ThreadCreateCommand,
618 ThreadDeleteCommand,
619 ThreadArchiveCommand,
620 ThreadUnarchiveCommand,
621 ThreadMetaUpdateCommand,
622 ThreadRuntimeModeSetCommand,
623 ThreadInteractionModeSetCommand,
624 ClientThreadTurnStartCommand,
625 ThreadTurnInterruptCommand,
626 ThreadApprovalRespondCommand,
627 ThreadUserInputRespondCommand,
628 ThreadCheckpointRevertCommand,
629 ThreadSessionStopCommand,
630]);
631export type ClientOrchestrationCommand = typeof ClientOrchestrationCommand.Type;
632​
633const ThreadSessionSetCommand = Schema.Struct({
634 type: Schema.Literal("thread.session.set"),
635 commandId: CommandId,
636 threadId: ThreadId,
637 session: OrchestrationSession,
638 createdAt: IsoDateTime,
639});
640​
641const ThreadMessageAssistantDeltaCommand = Schema.Struct({
642 type: Schema.Literal("thread.message.assistant.delta"),
643 commandId: CommandId,
644 threadId: ThreadId,
645 messageId: MessageId,
646 delta: Schema.String,
647 turnId: Schema.optional(TurnId),
648 createdAt: IsoDateTime,
649});
650​
651const ThreadMessageAssistantCompleteCommand = Schema.Struct({
652 type: Schema.Literal("thread.message.assistant.complete"),
653 commandId: CommandId,
654 threadId: ThreadId,
655 messageId: MessageId,
656 turnId: Schema.optional(TurnId),
657 createdAt: IsoDateTime,
658});
659​
660const ThreadProposedPlanUpsertCommand = Schema.Struct({
661 type: Schema.Literal("thread.proposed-plan.upsert"),
662 commandId: CommandId,
663 threadId: ThreadId,
664 proposedPlan: OrchestrationProposedPlan,
665 createdAt: IsoDateTime,
666});
667​
668const ThreadTurnDiffCompleteCommand = Schema.Struct({
669 type: Schema.Literal("thread.turn.diff.complete"),
670 commandId: CommandId,
671 threadId: ThreadId,
672 turnId: TurnId,
673 completedAt: IsoDateTime,
674 checkpointRef: CheckpointRef,
675 status: OrchestrationCheckpointStatus,
676 files: Schema.Array(OrchestrationCheckpointFile),
677 assistantMessageId: Schema.optional(MessageId),
678 checkpointTurnCount: NonNegativeInt,
679 createdAt: IsoDateTime,
680});
681​
682const ThreadActivityAppendCommand = Schema.Struct({
683 type: Schema.Literal("thread.activity.append"),
684 commandId: CommandId,
685 threadId: ThreadId,
686 activity: OrchestrationThreadActivity,
687 createdAt: IsoDateTime,
688});
689​
690const ThreadRevertCompleteCommand = Schema.Struct({
691 type: Schema.Literal("thread.revert.complete"),
692 commandId: CommandId,
693 threadId: ThreadId,
694 turnCount: NonNegativeInt,
695 createdAt: IsoDateTime,
696});
697​
698const InternalOrchestrationCommand = Schema.Union([
699 ThreadSessionSetCommand,
700 ThreadMessageAssistantDeltaCommand,
701 ThreadMessageAssistantCompleteCommand,
702 ThreadProposedPlanUpsertCommand,
703 ThreadTurnDiffCompleteCommand,
704 ThreadActivityAppendCommand,
705 ThreadRevertCompleteCommand,
706]);
707export type InternalOrchestrationCommand = typeof InternalOrchestrationCommand.Type;
708​
709export const OrchestrationCommand = Schema.Union([
710 DispatchableClientOrchestrationCommand,
711 InternalOrchestrationCommand,
712]);
713export type OrchestrationCommand = typeof OrchestrationCommand.Type;
714​
715export const OrchestrationEventType = Schema.Literals([
716 "project.created",
717 "project.meta-updated",
718 "project.deleted",
719 "thread.created",
720 "thread.deleted",
721 "thread.archived",
722 "thread.unarchived",
723 "thread.meta-updated",
724 "thread.runtime-mode-set",
725 "thread.interaction-mode-set",
726 "thread.message-sent",
727 "thread.turn-start-requested",
728 "thread.turn-interrupt-requested",
729 "thread.approval-response-requested",
730 "thread.user-input-response-requested",
731 "thread.checkpoint-revert-requested",
732 "thread.reverted",
733 "thread.session-stop-requested",
734 "thread.session-set",
735 "thread.proposed-plan-upserted",
736 "thread.turn-diff-completed",
737 "thread.activity-appended",
738]);
739export type OrchestrationEventType = typeof OrchestrationEventType.Type;
740​
741export const OrchestrationAggregateKind = Schema.Literals(["project", "thread"]);
742export type OrchestrationAggregateKind = typeof OrchestrationAggregateKind.Type;
743export const OrchestrationActorKind = Schema.Literals(["client", "server", "provider"]);
744​
745export const ProjectCreatedPayload = Schema.Struct({
746 projectId: ProjectId,
747 title: TrimmedNonEmptyString,
748 workspaceRoot: TrimmedNonEmptyString,
749 repositoryIdentity: Schema.optional(Schema.NullOr(RepositoryIdentity)),
750 defaultModelSelection: Schema.NullOr(ModelSelection),
751 scripts: Schema.Array(ProjectScript),
752 createdAt: IsoDateTime,
753 updatedAt: IsoDateTime,
754});
755​
756export const ProjectMetaUpdatedPayload = Schema.Struct({
757 projectId: ProjectId,
758 title: Schema.optional(TrimmedNonEmptyString),
759 workspaceRoot: Schema.optional(TrimmedNonEmptyString),
760 repositoryIdentity: Schema.optional(Schema.NullOr(RepositoryIdentity)),
761 defaultModelSelection: Schema.optional(Schema.NullOr(ModelSelection)),
762 scripts: Schema.optional(Schema.Array(ProjectScript)),
763 updatedAt: IsoDateTime,
764});
765​
766export const ProjectDeletedPayload = Schema.Struct({
767 projectId: ProjectId,
768 deletedAt: IsoDateTime,
769});
770​
771export const ThreadCreatedPayload = Schema.Struct({
772 threadId: ThreadId,
773 projectId: ProjectId,
774 title: TrimmedNonEmptyString,
775 modelSelection: ModelSelection,
776 runtimeMode: RuntimeMode.pipe(Schema.withDecodingDefault(Effect.succeed(DEFAULT_RUNTIME_MODE))),
777 interactionMode: ProviderInteractionMode.pipe(
778 Schema.withDecodingDefault(Effect.succeed(DEFAULT_PROVIDER_INTERACTION_MODE)),
779 ),
780 branch: Schema.NullOr(TrimmedNonEmptyString),
781 worktreePath: Schema.NullOr(TrimmedNonEmptyString),
782 createdAt: IsoDateTime,
783 updatedAt: IsoDateTime,
784});
785​
786export const ThreadDeletedPayload = Schema.Struct({
787 threadId: ThreadId,
788 deletedAt: IsoDateTime,
789});
790​
791export const ThreadArchivedPayload = Schema.Struct({
792 threadId: ThreadId,
793 archivedAt: IsoDateTime,
794 updatedAt: IsoDateTime,
795});
796​
797export const ThreadUnarchivedPayload = Schema.Struct({
798 threadId: ThreadId,
799 updatedAt: IsoDateTime,
800});
801​
802export const ThreadMetaUpdatedPayload = Schema.Struct({
803 threadId: ThreadId,
804 title: Schema.optional(TrimmedNonEmptyString),
805 modelSelection: Schema.optional(ModelSelection),
806 branch: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)),
807 worktreePath: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)),
808 updatedAt: IsoDateTime,
809});
810​
811export const ThreadRuntimeModeSetPayload = Schema.Struct({
812 threadId: ThreadId,
813 runtimeMode: RuntimeMode,
814 updatedAt: IsoDateTime,
815});
816​
817export const ThreadInteractionModeSetPayload = Schema.Struct({
818 threadId: ThreadId,
819 interactionMode: ProviderInteractionMode.pipe(
820 Schema.withDecodingDefault(Effect.succeed(DEFAULT_PROVIDER_INTERACTION_MODE)),
821 ),
822 updatedAt: IsoDateTime,
823});
824​
825export const ThreadMessageSentPayload = Schema.Struct({
826 threadId: ThreadId,
827 messageId: MessageId,
828 role: OrchestrationMessageRole,
829 text: Schema.String,
830 attachments: Schema.optional(Schema.Array(ChatAttachment)),
831 turnId: Schema.NullOr(TurnId),
832 streaming: Schema.Boolean,
833 createdAt: IsoDateTime,
834 updatedAt: IsoDateTime,
835});
836​
837export const ThreadTurnStartRequestedPayload = Schema.Struct({
838 threadId: ThreadId,
839 messageId: MessageId,
840 modelSelection: Schema.optional(ModelSelection),
841 titleSeed: Schema.optional(TrimmedNonEmptyString),
842 runtimeMode: RuntimeMode.pipe(Schema.withDecodingDefault(Effect.succeed(DEFAULT_RUNTIME_MODE))),
843 interactionMode: ProviderInteractionMode.pipe(
844 Schema.withDecodingDefault(Effect.succeed(DEFAULT_PROVIDER_INTERACTION_MODE)),
845 ),
846 sourceProposedPlan: Schema.optional(SourceProposedPlanReference),
847 createdAt: IsoDateTime,
848});
849​
850export const ThreadTurnInterruptRequestedPayload = Schema.Struct({
851 threadId: ThreadId,
852 turnId: Schema.optional(TurnId),
853 createdAt: IsoDateTime,
854});
855​
856export const ThreadApprovalResponseRequestedPayload = Schema.Struct({
857 threadId: ThreadId,
858 requestId: ApprovalRequestId,
859 decision: ProviderApprovalDecision,
860 createdAt: IsoDateTime,
861});
862​
863const ThreadUserInputResponseRequestedPayload = Schema.Struct({
864 threadId: ThreadId,
865 requestId: ApprovalRequestId,
866 answers: ProviderUserInputAnswers,
867 createdAt: IsoDateTime,
868});
869​
870export const ThreadCheckpointRevertRequestedPayload = Schema.Struct({
871 threadId: ThreadId,
872 turnCount: NonNegativeInt,
873 createdAt: IsoDateTime,
874});
875​
876export const ThreadRevertedPayload = Schema.Struct({
877 threadId: ThreadId,
878 turnCount: NonNegativeInt,
879});
880​
881export const ThreadSessionStopRequestedPayload = Schema.Struct({
882 threadId: ThreadId,
883 createdAt: IsoDateTime,
884});
885​
886export const ThreadSessionSetPayload = Schema.Struct({
887 threadId: ThreadId,
888 session: OrchestrationSession,
889});
890​
891export const ThreadProposedPlanUpsertedPayload = Schema.Struct({
892 threadId: ThreadId,
893 proposedPlan: OrchestrationProposedPlan,
894});
895​
896export const ThreadTurnDiffCompletedPayload = Schema.Struct({
897 threadId: ThreadId,
898 turnId: TurnId,
899 checkpointTurnCount: NonNegativeInt,
900 checkpointRef: CheckpointRef,
901 status: OrchestrationCheckpointStatus,
902 files: Schema.Array(OrchestrationCheckpointFile),
903 assistantMessageId: Schema.NullOr(MessageId),
904 completedAt: IsoDateTime,
905});
906​
907export const ThreadActivityAppendedPayload = Schema.Struct({
908 threadId: ThreadId,
909 activity: OrchestrationThreadActivity,
910});
911​
912export const OrchestrationEventMetadata = Schema.Struct({
913 providerTurnId: Schema.optional(TrimmedNonEmptyString),
914 providerItemId: Schema.optional(ProviderItemId),
915 adapterKey: Schema.optional(TrimmedNonEmptyString),
916 requestId: Schema.optional(ApprovalRequestId),
917 ingestedAt: Schema.optional(IsoDateTime),
918});
919export type OrchestrationEventMetadata = typeof OrchestrationEventMetadata.Type;
920​
921const EventBaseFields = {
922 sequence: NonNegativeInt,
923 eventId: EventId,
924 aggregateKind: OrchestrationAggregateKind,
925 aggregateId: Schema.Union([ProjectId, ThreadId]),
926 occurredAt: IsoDateTime,
927 commandId: Schema.NullOr(CommandId),
928 causationEventId: Schema.NullOr(EventId),
929 correlationId: Schema.NullOr(CommandId),
930 metadata: OrchestrationEventMetadata,
931} as const;
932​
933export const OrchestrationEvent = Schema.Union([
934 Schema.Struct({
935 ...EventBaseFields,
936 type: Schema.Literal("project.created"),
937 payload: ProjectCreatedPayload,
938 }),
939 Schema.Struct({
940 ...EventBaseFields,
941 type: Schema.Literal("project.meta-updated"),
942 payload: ProjectMetaUpdatedPayload,
943 }),
944 Schema.Struct({
945 ...EventBaseFields,
946 type: Schema.Literal("project.deleted"),
947 payload: ProjectDeletedPayload,
948 }),
949 Schema.Struct({
950 ...EventBaseFields,
951 type: Schema.Literal("thread.created"),
952 payload: ThreadCreatedPayload,
953 }),
954 Schema.Struct({
955 ...EventBaseFields,
956 type: Schema.Literal("thread.deleted"),
957 payload: ThreadDeletedPayload,
958 }),
959 Schema.Struct({
960 ...EventBaseFields,
961 type: Schema.Literal("thread.archived"),
962 payload: ThreadArchivedPayload,
963 }),
964 Schema.Struct({
965 ...EventBaseFields,
966 type: Schema.Literal("thread.unarchived"),
967 payload: ThreadUnarchivedPayload,
968 }),
969 Schema.Struct({
970 ...EventBaseFields,
971 type: Schema.Literal("thread.meta-updated"),
972 payload: ThreadMetaUpdatedPayload,
973 }),
974 Schema.Struct({
975 ...EventBaseFields,
976 type: Schema.Literal("thread.runtime-mode-set"),
977 payload: ThreadRuntimeModeSetPayload,
978 }),
979 Schema.Struct({
980 ...EventBaseFields,
981 type: Schema.Literal("thread.interaction-mode-set"),
982 payload: ThreadInteractionModeSetPayload,
983 }),
984 Schema.Struct({
985 ...EventBaseFields,
986 type: Schema.Literal("thread.message-sent"),
987 payload: ThreadMessageSentPayload,
988 }),
989 Schema.Struct({
990 ...EventBaseFields,
991 type: Schema.Literal("thread.turn-start-requested"),
992 payload: ThreadTurnStartRequestedPayload,
993 }),
994 Schema.Struct({
995 ...EventBaseFields,
996 type: Schema.Literal("thread.turn-interrupt-requested"),
997 payload: ThreadTurnInterruptRequestedPayload,
998 }),
999 Schema.Struct({
1000 ...EventBaseFields,
1001 type: Schema.Literal("thread.approval-response-requested"),
1002 payload: ThreadApprovalResponseRequestedPayload,
1003 }),
1004 Schema.Struct({
1005 ...EventBaseFields,
1006 type: Schema.Literal("thread.user-input-response-requested"),
1007 payload: ThreadUserInputResponseRequestedPayload,
1008 }),
1009 Schema.Struct({
1010 ...EventBaseFields,
1011 type: Schema.Literal("thread.checkpoint-revert-requested"),
1012 payload: ThreadCheckpointRevertRequestedPayload,
1013 }),
1014 Schema.Struct({
1015 ...EventBaseFields,
1016 type: Schema.Literal("thread.reverted"),
1017 payload: ThreadRevertedPayload,
1018 }),
1019 Schema.Struct({
1020 ...EventBaseFields,
1021 type: Schema.Literal("thread.session-stop-requested"),
1022 payload: ThreadSessionStopRequestedPayload,
1023 }),
1024 Schema.Struct({
1025 ...EventBaseFields,
1026 type: Schema.Literal("thread.session-set"),
1027 payload: ThreadSessionSetPayload,
1028 }),
1029 Schema.Struct({
1030 ...EventBaseFields,
1031 type: Schema.Literal("thread.proposed-plan-upserted"),
1032 payload: ThreadProposedPlanUpsertedPayload,
1033 }),
1034 Schema.Struct({
1035 ...EventBaseFields,
1036 type: Schema.Literal("thread.turn-diff-completed"),
1037 payload: ThreadTurnDiffCompletedPayload,
1038 }),
1039 Schema.Struct({
1040 ...EventBaseFields,
1041 type: Schema.Literal("thread.activity-appended"),
1042 payload: ThreadActivityAppendedPayload,
1043 }),
1044]);
1045export type OrchestrationEvent = typeof OrchestrationEvent.Type;
1046​
1047export const OrchestrationThreadStreamItem = Schema.Union([
1048 Schema.Struct({
1049 kind: Schema.Literal("snapshot"),
1050 snapshot: OrchestrationThreadDetailSnapshot,
1051 }),
1052 Schema.Struct({
1053 kind: Schema.Literal("event"),
1054 event: OrchestrationEvent,
1055 }),
1056]);
1057export type OrchestrationThreadStreamItem = typeof OrchestrationThreadStreamItem.Type;
1058​
1059export const OrchestrationCommandReceiptStatus = Schema.Literals(["accepted", "rejected"]);
1060export type OrchestrationCommandReceiptStatus = typeof OrchestrationCommandReceiptStatus.Type;
1061​
1062export const TurnCountRange = Schema.Struct({
1063 fromTurnCount: NonNegativeInt,
1064 toTurnCount: NonNegativeInt,
1065}).check(
1066 Schema.makeFilter(
1067 (input) =>
1068 input.fromTurnCount <= input.toTurnCount ||
1069 new SchemaIssue.InvalidValue(Option.some(input.fromTurnCount), {
1070 message: "fromTurnCount must be less than or equal to toTurnCount",
1071 }),
1072 { identifier: "OrchestrationTurnDiffRange" },
1073 ),
1075​
1076export const ThreadTurnDiff = TurnCountRange.mapFields(
1077 Struct.assign({
1078 threadId: ThreadId,
1079 diff: Schema.String,
1080 }),
1081 { unsafePreserveChecks: true },
1083​
1084export const ProviderSessionRuntimeStatus = Schema.Literals([
1085 "starting",
1086 "running",
1087 "stopped",
1088 "error",
1089]);
1090export type ProviderSessionRuntimeStatus = typeof ProviderSessionRuntimeStatus.Type;
1091​
1092const ProjectionThreadTurnStatus = Schema.Literals([
1093 "running",
1094 "completed",
1095 "interrupted",
1096 "error",
1097]);
1098export type ProjectionThreadTurnStatus = typeof ProjectionThreadTurnStatus.Type;
1099​
1100const ProjectionCheckpointRow = Schema.Struct({
1101 threadId: ThreadId,
1102 turnId: TurnId,
1103 checkpointTurnCount: NonNegativeInt,
1104 checkpointRef: CheckpointRef,
1105 status: OrchestrationCheckpointStatus,
1106 files: Schema.Array(OrchestrationCheckpointFile),
1107 assistantMessageId: Schema.NullOr(MessageId),
1108 completedAt: IsoDateTime,
1109});
1110export type ProjectionCheckpointRow = typeof ProjectionCheckpointRow.Type;
1111​
1112export const ProjectionPendingApprovalStatus = Schema.Literals(["pending", "resolved"]);
1113export type ProjectionPendingApprovalStatus = typeof ProjectionPendingApprovalStatus.Type;
1114​
1115export const ProjectionPendingApprovalDecision = Schema.NullOr(ProviderApprovalDecision);
1116export type ProjectionPendingApprovalDecision = typeof ProjectionPendingApprovalDecision.Type;
1117​
1118export const DispatchResult = Schema.Struct({
1119 sequence: NonNegativeInt,
1120});
1121export type DispatchResult = typeof DispatchResult.Type;
1122​
1123export const OrchestrationGetTurnDiffInput = TurnCountRange.mapFields(
1124 Struct.assign({ threadId: ThreadId }),
1125 { unsafePreserveChecks: true },
1127export type OrchestrationGetTurnDiffInput = typeof OrchestrationGetTurnDiffInput.Type;
1128​
1129export const OrchestrationGetTurnDiffResult = ThreadTurnDiff;
1130export type OrchestrationGetTurnDiffResult = typeof OrchestrationGetTurnDiffResult.Type;
1131​
1132export const OrchestrationGetFullThreadDiffInput = Schema.Struct({
1133 threadId: ThreadId,
1134 toTurnCount: NonNegativeInt,
1135});
1136export type OrchestrationGetFullThreadDiffInput = typeof OrchestrationGetFullThreadDiffInput.Type;
1137​
1138export const OrchestrationGetFullThreadDiffResult = ThreadTurnDiff;
1139export type OrchestrationGetFullThreadDiffResult = typeof OrchestrationGetFullThreadDiffResult.Type;
1140​
1141export const OrchestrationReplayEventsInput = Schema.Struct({
1142 fromSequenceExclusive: NonNegativeInt,
1143});
1144export type OrchestrationReplayEventsInput = typeof OrchestrationReplayEventsInput.Type;
1145​
1146const OrchestrationReplayEventsResult = Schema.Array(OrchestrationEvent);
1147export type OrchestrationReplayEventsResult = typeof OrchestrationReplayEventsResult.Type;
1148​
1149export const OrchestrationRpcSchemas = {
1150 dispatchCommand: {
1151 input: ClientOrchestrationCommand,
1152 output: DispatchResult,
1153 },
1154 getTurnDiff: {
1155 input: OrchestrationGetTurnDiffInput,
1156 output: OrchestrationGetTurnDiffResult,
1157 },
1158 getFullThreadDiff: {
1159 input: OrchestrationGetFullThreadDiffInput,
1160 output: OrchestrationGetFullThreadDiffResult,
1161 },
1162 replayEvents: {
1163 input: OrchestrationReplayEventsInput,
1164 output: OrchestrationReplayEventsResult,
1165 },
1166 subscribeThread: {
1167 input: OrchestrationSubscribeThreadInput,
1168 output: OrchestrationThreadStreamItem,
1169 },
1170 subscribeShell: {
1171 input: Schema.Struct({}),
1172 output: OrchestrationShellStreamItem,
1173 },
1174} as const;
1175​
1176export class OrchestrationGetSnapshotError extends Schema.TaggedErrorClass<OrchestrationGetSnapshotError>()(
1177 "OrchestrationGetSnapshotError",
1179 message: TrimmedNonEmptyString,
1180 cause: Schema.optional(Schema.Defect),
1181 },
1182) {}
1183​
1184export class OrchestrationDispatchCommandError extends Schema.TaggedErrorClass<OrchestrationDispatchCommandError>()(
1185 "OrchestrationDispatchCommandError",
1187 message: TrimmedNonEmptyString,
1188 cause: Schema.optional(Schema.Defect),
1189 },
1190) {}
1191​
1192export class OrchestrationGetTurnDiffError extends Schema.TaggedErrorClass<OrchestrationGetTurnDiffError>()(
1193 "OrchestrationGetTurnDiffError",
1195 message: TrimmedNonEmptyString,
1196 cause: Schema.optional(Schema.Defect),
1197 },
1198) {}
1199​
1200export class OrchestrationGetFullThreadDiffError extends Schema.TaggedErrorClass<OrchestrationGetFullThreadDiffError>()(
1201 "OrchestrationGetFullThreadDiffError",
1203 message: TrimmedNonEmptyString,
1204 cause: Schema.optional(Schema.Defect),
1205 },
1206) {}
1207​
1208export class OrchestrationReplayEventsError extends Schema.TaggedErrorClass<OrchestrationReplayEventsError>()(
1209 "OrchestrationReplayEventsError",
1211 message: TrimmedNonEmptyString,
1212 cause: Schema.optional(Schema.Defect),
1213 },
1214) {}