From e6575c41491c001f08c8bd9424dc71aa1e89c103 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 5 Mar 2026 17:41:27 -0800 Subject: [PATCH] Prune internal contract exports and remove checkpoint RPC schemas - Stop exporting internal-only schema constants/types across contracts modules - Remove unused provider checkpoint list/revert/diff RPC contract schemas - Keep public contract surface focused on externally consumed types --- packages/contracts/src/git.ts | 17 +- packages/contracts/src/keybindings.ts | 12 +- packages/contracts/src/orchestration.ts | 72 ++--- packages/contracts/src/project.ts | 6 +- packages/contracts/src/provider.ts | 71 +---- packages/contracts/src/providerRuntime.ts | 320 +++++++++++----------- packages/contracts/src/server.ts | 12 +- packages/contracts/src/terminal.ts | 18 +- packages/contracts/src/ws.ts | 2 +- 9 files changed, 230 insertions(+), 300 deletions(-) diff --git a/packages/contracts/src/git.ts b/packages/contracts/src/git.ts index 99738b7ac0d0a0071f94ba8f27b1822ca3f7fd98..80ede248e6859f81c2afed686299e4c71aa8fc75 100644 --- a/packages/contracts/src/git.ts +++ b/packages/contracts/src/git.ts @@ -7,20 +7,19 @@ const TrimmedNonEmptyStringSchema = TrimmedNonEmptyString; export const GitStackedAction = Schema.Literals(["commit", "commit_push", "commit_push_pr"]); export type GitStackedAction = typeof GitStackedAction.Type; -export const GitCommitStepStatus = Schema.Literals(["created", "skipped_no_changes"]); -export const GitPushStepStatus = Schema.Literals([ +const GitCommitStepStatus = Schema.Literals(["created", "skipped_no_changes"]); +const GitPushStepStatus = Schema.Literals([ "pushed", "skipped_not_requested", "skipped_up_to_date", ]); -export const GitBranchStepStatus = Schema.Literals(["created", "skipped_not_requested"]); -export const GitPrStepStatus = Schema.Literals([ +const GitBranchStepStatus = Schema.Literals(["created", "skipped_not_requested"]); +const GitPrStepStatus = Schema.Literals([ "created", "opened_existing", "skipped_not_requested", ]); -export const GitStatusPrState = Schema.Literals(["open", "closed", "merged"]); -export type GitStatusPrState = typeof GitStatusPrState.Type; +const GitStatusPrState = Schema.Literals(["open", "closed", "merged"]); export const GitBranch = Schema.Struct({ name: TrimmedNonEmptyStringSchema, @@ -32,11 +31,10 @@ export const GitBranch = Schema.Struct({ }); export type GitBranch = typeof GitBranch.Type; -export const GitWorktree = Schema.Struct({ +const GitWorktree = Schema.Struct({ path: TrimmedNonEmptyStringSchema, branch: TrimmedNonEmptyStringSchema, }); -export type GitWorktree = typeof GitWorktree.Type; // RPC Inputs @@ -97,7 +95,7 @@ export type GitInitInput = typeof GitInitInput.Type; // RPC Results -export const GitStatusPr = Schema.Struct({ +const GitStatusPr = Schema.Struct({ number: PositiveInt, title: TrimmedNonEmptyStringSchema, url: Schema.String, @@ -105,7 +103,6 @@ export const GitStatusPr = Schema.Struct({ headBranch: TrimmedNonEmptyStringSchema, state: GitStatusPrState, }); -export type GitStatusPr = typeof GitStatusPr.Type; export const GitStatusResult = Schema.Struct({ branch: TrimmedNonEmptyStringSchema.pipe(Schema.NullOr), diff --git a/packages/contracts/src/keybindings.ts b/packages/contracts/src/keybindings.ts index a6e7e9bdeb9f5523a2cc3d31c145f36ea2294de4..48821b182410195a6f964eb602e0d8bfb9f65cd9 100644 --- a/packages/contracts/src/keybindings.ts +++ b/packages/contracts/src/keybindings.ts @@ -1,15 +1,13 @@ import { Schema } from "effect"; import { TrimmedString } from "./baseSchemas"; -export const MAX_KEYBINDING_COMMAND_LENGTH = 96; export const MAX_KEYBINDING_VALUE_LENGTH = 64; -export const MAX_KEYBINDING_WHEN_LENGTH = 256; +const MAX_KEYBINDING_WHEN_LENGTH = 256; export const MAX_WHEN_EXPRESSION_DEPTH = 64; export const MAX_SCRIPT_ID_LENGTH = 24; -export const MAX_SCRIPT_RUN_COMMAND_LENGTH = 96; export const MAX_KEYBINDINGS_COUNT = 256; -export const STATIC_KEYBINDING_COMMANDS = [ +const STATIC_KEYBINDING_COMMANDS = [ "terminal.toggle", "terminal.split", "terminal.new", @@ -35,17 +33,15 @@ export const KeybindingCommand = Schema.Union([ ]); export type KeybindingCommand = typeof KeybindingCommand.Type; -export const KeybindingValue = TrimmedString.check( +const KeybindingValue = TrimmedString.check( Schema.isMinLength(1), Schema.isMaxLength(MAX_KEYBINDING_VALUE_LENGTH), ); -export type KeybindingValue = typeof KeybindingValue.Type; -export const KeybindingWhen = TrimmedString.check( +const KeybindingWhen = TrimmedString.check( Schema.isMinLength(1), Schema.isMaxLength(MAX_KEYBINDING_WHEN_LENGTH), ); -export type KeybindingWhen = typeof KeybindingWhen.Type; export const KeybindingRule = Schema.Struct({ key: KeybindingValue, command: KeybindingCommand, diff --git a/packages/contracts/src/orchestration.ts b/packages/contracts/src/orchestration.ts index 57ac2e6f10844081777dd3db644ee0d68db9b920..6201ec72d0b7e6ef77d5992825d1d2971685e678 100644 --- a/packages/contracts/src/orchestration.ts +++ b/packages/contracts/src/orchestration.ts @@ -52,14 +52,14 @@ export type ProviderUserInputAnswers = typeof ProviderUserInputAnswers.Type; export const PROVIDER_SEND_TURN_MAX_INPUT_CHARS = 120_000; export const PROVIDER_SEND_TURN_MAX_ATTACHMENTS = 8; export const PROVIDER_SEND_TURN_MAX_IMAGE_BYTES = 10 * 1024 * 1024; -export const PROVIDER_SEND_TURN_MAX_IMAGE_DATA_URL_CHARS = 14_000_000; -export const CHAT_ATTACHMENT_ID_MAX_CHARS = 128; +const PROVIDER_SEND_TURN_MAX_IMAGE_DATA_URL_CHARS = 14_000_000; +const CHAT_ATTACHMENT_ID_MAX_CHARS = 128; // Correlation id is command id by design in this model. export const CorrelationId = CommandId; export type CorrelationId = typeof CorrelationId.Type; -export const ChatAttachmentId = TrimmedNonEmptyString.check( +const ChatAttachmentId = TrimmedNonEmptyString.check( Schema.isMaxLength(CHAT_ATTACHMENT_ID_MAX_CHARS), Schema.isPattern(/^[a-z0-9_-]+$/i), ); @@ -74,7 +74,7 @@ export const ChatImageAttachment = Schema.Struct({ }); export type ChatImageAttachment = typeof ChatImageAttachment.Type; -export const UploadChatImageAttachment = Schema.Struct({ +const UploadChatImageAttachment = Schema.Struct({ type: Schema.Literal("image"), name: TrimmedNonEmptyString.check(Schema.isMaxLength(255)), mimeType: TrimmedNonEmptyString.check(Schema.isMaxLength(100), Schema.isPattern(/^image\//i)), @@ -87,7 +87,7 @@ export type UploadChatImageAttachment = typeof UploadChatImageAttachment.Type; export const ChatAttachment = Schema.Union([ChatImageAttachment]); export type ChatAttachment = typeof ChatAttachment.Type; -export const UploadChatAttachment = Schema.Union([UploadChatImageAttachment]); +const UploadChatAttachment = Schema.Union([UploadChatImageAttachment]); export type UploadChatAttachment = typeof UploadChatAttachment.Type; export const ProjectScriptIcon = Schema.Literals([ @@ -212,7 +212,7 @@ export const OrchestrationThreadActivity = Schema.Struct({ }); export type OrchestrationThreadActivity = typeof OrchestrationThreadActivity.Type; -export const OrchestrationLatestTurnState = Schema.Literals([ +const OrchestrationLatestTurnState = Schema.Literals([ "running", "interrupted", "completed", @@ -263,7 +263,7 @@ export const OrchestrationReadModel = Schema.Struct({ }); export type OrchestrationReadModel = typeof OrchestrationReadModel.Type; -export const ProjectCreateCommand = Schema.Struct({ +const ProjectCreateCommand = Schema.Struct({ type: Schema.Literal("project.create"), commandId: CommandId, projectId: ProjectId, @@ -273,7 +273,7 @@ export const ProjectCreateCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ProjectMetaUpdateCommand = Schema.Struct({ +const ProjectMetaUpdateCommand = Schema.Struct({ type: Schema.Literal("project.meta.update"), commandId: CommandId, projectId: ProjectId, @@ -283,13 +283,13 @@ export const ProjectMetaUpdateCommand = Schema.Struct({ scripts: Schema.optional(Schema.Array(ProjectScript)), }); -export const ProjectDeleteCommand = Schema.Struct({ +const ProjectDeleteCommand = Schema.Struct({ type: Schema.Literal("project.delete"), commandId: CommandId, projectId: ProjectId, }); -export const ThreadCreateCommand = Schema.Struct({ +const ThreadCreateCommand = Schema.Struct({ type: Schema.Literal("thread.create"), commandId: CommandId, threadId: ThreadId, @@ -305,13 +305,13 @@ export const ThreadCreateCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadDeleteCommand = Schema.Struct({ +const ThreadDeleteCommand = Schema.Struct({ type: Schema.Literal("thread.delete"), commandId: CommandId, threadId: ThreadId, }); -export const ThreadMetaUpdateCommand = Schema.Struct({ +const ThreadMetaUpdateCommand = Schema.Struct({ type: Schema.Literal("thread.meta.update"), commandId: CommandId, threadId: ThreadId, @@ -321,7 +321,7 @@ export const ThreadMetaUpdateCommand = Schema.Struct({ worktreePath: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)), }); -export const ThreadRuntimeModeSetCommand = Schema.Struct({ +const ThreadRuntimeModeSetCommand = Schema.Struct({ type: Schema.Literal("thread.runtime-mode.set"), commandId: CommandId, threadId: ThreadId, @@ -329,7 +329,7 @@ export const ThreadRuntimeModeSetCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadInteractionModeSetCommand = Schema.Struct({ +const ThreadInteractionModeSetCommand = Schema.Struct({ type: Schema.Literal("thread.interaction-mode.set"), commandId: CommandId, threadId: ThreadId, @@ -337,7 +337,7 @@ export const ThreadInteractionModeSetCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadTurnStartCommand = Schema.Struct({ +const ThreadTurnStartCommand = Schema.Struct({ type: Schema.Literal("thread.turn.start"), commandId: CommandId, threadId: ThreadId, @@ -358,7 +358,7 @@ export const ThreadTurnStartCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ClientThreadTurnStartCommand = Schema.Struct({ +const ClientThreadTurnStartCommand = Schema.Struct({ type: Schema.Literal("thread.turn.start"), commandId: CommandId, threadId: ThreadId, @@ -377,7 +377,7 @@ export const ClientThreadTurnStartCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadTurnInterruptCommand = Schema.Struct({ +const ThreadTurnInterruptCommand = Schema.Struct({ type: Schema.Literal("thread.turn.interrupt"), commandId: CommandId, threadId: ThreadId, @@ -385,7 +385,7 @@ export const ThreadTurnInterruptCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadApprovalRespondCommand = Schema.Struct({ +const ThreadApprovalRespondCommand = Schema.Struct({ type: Schema.Literal("thread.approval.respond"), commandId: CommandId, threadId: ThreadId, @@ -394,7 +394,7 @@ export const ThreadApprovalRespondCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadUserInputRespondCommand = Schema.Struct({ +const ThreadUserInputRespondCommand = Schema.Struct({ type: Schema.Literal("thread.user-input.respond"), commandId: CommandId, threadId: ThreadId, @@ -403,7 +403,7 @@ export const ThreadUserInputRespondCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadCheckpointRevertCommand = Schema.Struct({ +const ThreadCheckpointRevertCommand = Schema.Struct({ type: Schema.Literal("thread.checkpoint.revert"), commandId: CommandId, threadId: ThreadId, @@ -411,14 +411,14 @@ export const ThreadCheckpointRevertCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadSessionStopCommand = Schema.Struct({ +const ThreadSessionStopCommand = Schema.Struct({ type: Schema.Literal("thread.session.stop"), commandId: CommandId, threadId: ThreadId, createdAt: IsoDateTime, }); -export const DispatchableClientOrchestrationCommand = Schema.Union([ +const DispatchableClientOrchestrationCommand = Schema.Union([ ProjectCreateCommand, ProjectMetaUpdateCommand, ProjectDeleteCommand, @@ -455,7 +455,7 @@ export const ClientOrchestrationCommand = Schema.Union([ ]); export type ClientOrchestrationCommand = typeof ClientOrchestrationCommand.Type; -export const ThreadSessionSetCommand = Schema.Struct({ +const ThreadSessionSetCommand = Schema.Struct({ type: Schema.Literal("thread.session.set"), commandId: CommandId, threadId: ThreadId, @@ -463,7 +463,7 @@ export const ThreadSessionSetCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadMessageAssistantDeltaCommand = Schema.Struct({ +const ThreadMessageAssistantDeltaCommand = Schema.Struct({ type: Schema.Literal("thread.message.assistant.delta"), commandId: CommandId, threadId: ThreadId, @@ -473,7 +473,7 @@ export const ThreadMessageAssistantDeltaCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadMessageAssistantCompleteCommand = Schema.Struct({ +const ThreadMessageAssistantCompleteCommand = Schema.Struct({ type: Schema.Literal("thread.message.assistant.complete"), commandId: CommandId, threadId: ThreadId, @@ -482,7 +482,7 @@ export const ThreadMessageAssistantCompleteCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadProposedPlanUpsertCommand = Schema.Struct({ +const ThreadProposedPlanUpsertCommand = Schema.Struct({ type: Schema.Literal("thread.proposed-plan.upsert"), commandId: CommandId, threadId: ThreadId, @@ -490,7 +490,7 @@ export const ThreadProposedPlanUpsertCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadTurnDiffCompleteCommand = Schema.Struct({ +const ThreadTurnDiffCompleteCommand = Schema.Struct({ type: Schema.Literal("thread.turn.diff.complete"), commandId: CommandId, threadId: ThreadId, @@ -504,7 +504,7 @@ export const ThreadTurnDiffCompleteCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadActivityAppendCommand = Schema.Struct({ +const ThreadActivityAppendCommand = Schema.Struct({ type: Schema.Literal("thread.activity.append"), commandId: CommandId, threadId: ThreadId, @@ -512,7 +512,7 @@ export const ThreadActivityAppendCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadRevertCompleteCommand = Schema.Struct({ +const ThreadRevertCompleteCommand = Schema.Struct({ type: Schema.Literal("thread.revert.complete"), commandId: CommandId, threadId: ThreadId, @@ -520,7 +520,7 @@ export const ThreadRevertCompleteCommand = Schema.Struct({ createdAt: IsoDateTime, }); -export const InternalOrchestrationCommand = Schema.Union([ +const InternalOrchestrationCommand = Schema.Union([ ThreadSessionSetCommand, ThreadMessageAssistantDeltaCommand, ThreadMessageAssistantCompleteCommand, @@ -671,7 +671,7 @@ export const ThreadApprovalResponseRequestedPayload = Schema.Struct({ createdAt: IsoDateTime, }); -export const ThreadUserInputResponseRequestedPayload = Schema.Struct({ +const ThreadUserInputResponseRequestedPayload = Schema.Struct({ threadId: ThreadId, requestId: ApprovalRequestId, answers: ProviderUserInputAnswers, @@ -980,7 +980,7 @@ export const TurnCountRange = Schema.Struct({ ), ); -export const ThreadTurnDiff = TurnCountRange.mapFields( +const ThreadTurnDiff = TurnCountRange.mapFields( Struct.assign({ threadId: ThreadId, diff: Schema.String, @@ -996,7 +996,7 @@ export const ProviderSessionRuntimeStatus = Schema.Literals([ ]); export type ProviderSessionRuntimeStatus = typeof ProviderSessionRuntimeStatus.Type; -export const ProjectionThreadTurnStatus = Schema.Literals([ +const ProjectionThreadTurnStatus = Schema.Literals([ "running", "completed", "interrupted", @@ -1004,7 +1004,7 @@ export const ProjectionThreadTurnStatus = Schema.Literals([ ]); export type ProjectionThreadTurnStatus = typeof ProjectionThreadTurnStatus.Type; -export const ProjectionCheckpointRow = Schema.Struct({ +const ProjectionCheckpointRow = Schema.Struct({ threadId: ThreadId, turnId: TurnId, checkpointTurnCount: NonNegativeInt, @@ -1029,7 +1029,7 @@ export type DispatchResult = typeof DispatchResult.Type; export const OrchestrationGetSnapshotInput = Schema.Struct({}); export type OrchestrationGetSnapshotInput = typeof OrchestrationGetSnapshotInput.Type; -export const OrchestrationGetSnapshotResult = OrchestrationReadModel; +const OrchestrationGetSnapshotResult = OrchestrationReadModel; export type OrchestrationGetSnapshotResult = typeof OrchestrationGetSnapshotResult.Type; export const OrchestrationGetTurnDiffInput = TurnCountRange.mapFields( @@ -1055,7 +1055,7 @@ export const OrchestrationReplayEventsInput = Schema.Struct({ }); export type OrchestrationReplayEventsInput = typeof OrchestrationReplayEventsInput.Type; -export const OrchestrationReplayEventsResult = Schema.Array(OrchestrationEvent); +const OrchestrationReplayEventsResult = Schema.Array(OrchestrationEvent); export type OrchestrationReplayEventsResult = typeof OrchestrationReplayEventsResult.Type; export const OrchestrationRpcSchemas = { diff --git a/packages/contracts/src/project.ts b/packages/contracts/src/project.ts index 7a1b2d01ba606e88d02849437bd02cf466fffd1a..4d1450bacfa327d7ff0adf55e6f94bdb4a6564bb 100644 --- a/packages/contracts/src/project.ts +++ b/packages/contracts/src/project.ts @@ -1,8 +1,8 @@ import { Schema } from "effect"; import { PositiveInt, TrimmedNonEmptyString } from "./baseSchemas"; -export const PROJECT_SEARCH_ENTRIES_MAX_LIMIT = 200; -export const PROJECT_WRITE_FILE_PATH_MAX_LENGTH = 512; +const PROJECT_SEARCH_ENTRIES_MAX_LIMIT = 200; +const PROJECT_WRITE_FILE_PATH_MAX_LENGTH = 512; export const ProjectSearchEntriesInput = Schema.Struct({ cwd: TrimmedNonEmptyString, @@ -11,7 +11,7 @@ export const ProjectSearchEntriesInput = Schema.Struct({ }); export type ProjectSearchEntriesInput = typeof ProjectSearchEntriesInput.Type; -export const ProjectEntryKind = Schema.Literals(["file", "directory"]); +const ProjectEntryKind = Schema.Literals(["file", "directory"]); export const ProjectEntry = Schema.Struct({ path: TrimmedNonEmptyString, diff --git a/packages/contracts/src/provider.ts b/packages/contracts/src/provider.ts index 2dd1dca94a4ab73e1b140061d169755ecf9ab97a..bae169ce1f97ff2a99d90168a55173b9f18261f8 100644 --- a/packages/contracts/src/provider.ts +++ b/packages/contracts/src/provider.ts @@ -19,19 +19,17 @@ import { ProviderRequestKind, ProviderUserInputAnswers, RuntimeMode, - TurnCountRange, } from "./orchestration"; const TrimmedNonEmptyStringSchema = TrimmedNonEmptyString; -export const ProviderSessionStatus = Schema.Literals([ +const ProviderSessionStatus = Schema.Literals([ "connecting", "ready", "running", "error", "closed", ]); -export type ProviderSessionStatus = typeof ProviderSessionStatus.Type; export const ProviderSession = Schema.Struct({ provider: ProviderKind, @@ -48,30 +46,26 @@ export const ProviderSession = Schema.Struct({ }); export type ProviderSession = typeof ProviderSession.Type; -export const CodexProviderStartOptions = Schema.Struct({ +const CodexProviderStartOptions = Schema.Struct({ binaryPath: Schema.optional(TrimmedNonEmptyStringSchema), homePath: Schema.optional(TrimmedNonEmptyStringSchema), }); -export type CodexProviderStartOptions = typeof CodexProviderStartOptions.Type; -export const ClaudeCodeProviderStartOptions = Schema.Struct({ +const ClaudeCodeProviderStartOptions = Schema.Struct({ binaryPath: Schema.optional(TrimmedNonEmptyStringSchema), permissionMode: Schema.optional(TrimmedNonEmptyStringSchema), maxThinkingTokens: Schema.optional(NonNegativeInt), }); -export type ClaudeCodeProviderStartOptions = typeof ClaudeCodeProviderStartOptions.Type; -export const CursorProviderStartOptions = Schema.Struct({ +const CursorProviderStartOptions = Schema.Struct({ binaryPath: Schema.optional(TrimmedNonEmptyStringSchema), }); -export type CursorProviderStartOptions = typeof CursorProviderStartOptions.Type; -export const ProviderStartOptions = Schema.Struct({ +const ProviderStartOptions = Schema.Struct({ codex: Schema.optional(CodexProviderStartOptions), claudeCode: Schema.optional(ClaudeCodeProviderStartOptions), cursor: Schema.optional(CursorProviderStartOptions), }); -export type ProviderStartOptions = typeof ProviderStartOptions.Type; export const ProviderSessionStartInput = Schema.Struct({ threadId: ThreadId, @@ -116,55 +110,6 @@ export const ProviderStopSessionInput = Schema.Struct({ }); export type ProviderStopSessionInput = typeof ProviderStopSessionInput.Type; -export const ProviderListCheckpointsInput = Schema.Struct({ - threadId: ThreadId, -}); -export type ProviderListCheckpointsInput = typeof ProviderListCheckpointsInput.Type; - -export const ProviderCheckpoint = Schema.Struct({ - id: TrimmedNonEmptyStringSchema, - turnCount: NonNegativeInt, - messageCount: NonNegativeInt, - label: TrimmedNonEmptyStringSchema, - preview: Schema.optional(TrimmedNonEmptyStringSchema), - isCurrent: Schema.Boolean, -}); -export type ProviderCheckpoint = typeof ProviderCheckpoint.Type; - -export const ProviderListCheckpointsResult = Schema.Struct({ - threadId: ThreadId, - checkpoints: Schema.Array(ProviderCheckpoint), -}); -export type ProviderListCheckpointsResult = typeof ProviderListCheckpointsResult.Type; - -export const ProviderRevertToCheckpointInput = Schema.Struct({ - threadId: ThreadId, - turnCount: NonNegativeInt, -}); -export type ProviderRevertToCheckpointInput = typeof ProviderRevertToCheckpointInput.Type; - -export const ProviderRevertToCheckpointResult = Schema.Struct({ - threadId: ThreadId, - turnCount: NonNegativeInt, - messageCount: NonNegativeInt, - rolledBackTurns: NonNegativeInt, - checkpoints: Schema.Array(ProviderCheckpoint), -}); -export type ProviderRevertToCheckpointResult = typeof ProviderRevertToCheckpointResult.Type; - -export const ProviderGetCheckpointDiffInput = Schema.Struct({ - threadId: ThreadId, - ...TurnCountRange.fields, -}); -export type ProviderGetCheckpointDiffInput = typeof ProviderGetCheckpointDiffInput.Type; - -export const ProviderGetCheckpointDiffResult = Schema.Struct({ - threadId: ThreadId, - ...TurnCountRange.fields, - diff: Schema.String, -}); -export type ProviderGetCheckpointDiffResult = typeof ProviderGetCheckpointDiffResult.Type; - export const ProviderRespondToRequestInput = Schema.Struct({ threadId: ThreadId, requestId: ApprovalRequestId, @@ -179,8 +124,7 @@ export const ProviderRespondToUserInputInput = Schema.Struct({ }); export type ProviderRespondToUserInputInput = typeof ProviderRespondToUserInputInput.Type; -export const ProviderEventKind = Schema.Literals(["session", "notification", "request", "error"]); -export type ProviderEventKind = typeof ProviderEventKind.Type; +const ProviderEventKind = Schema.Literals(["session", "notification", "request", "error"]); export const ProviderEvent = Schema.Struct({ id: EventId, @@ -198,6 +142,3 @@ export const ProviderEvent = Schema.Struct({ payload: Schema.optional(Schema.Unknown), }); export type ProviderEvent = typeof ProviderEvent.Type; - -export type ProviderSendTurnAttachment = typeof ChatAttachment.Type; -export type ProviderSendTurnAttachmentInput = typeof ChatAttachment.Type; diff --git a/packages/contracts/src/providerRuntime.ts b/packages/contracts/src/providerRuntime.ts index 4ef6e62cf053b5ccbff58d03bc3deee52a3a6696..66bd61fba9ec9d240858d536df4142bc186a8f04 100644 --- a/packages/contracts/src/providerRuntime.ts +++ b/packages/contracts/src/providerRuntime.ts @@ -15,7 +15,7 @@ import { ProviderKind } from "./orchestration"; const TrimmedNonEmptyStringSchema = TrimmedNonEmptyString; const UnknownRecordSchema = Schema.Record(Schema.String, Schema.Unknown); -export const RuntimeEventRawSource = Schema.Literals([ +const RuntimeEventRawSource = Schema.Literals([ "codex.app-server.notification", "codex.app-server.request", "codex.eventmsg", @@ -36,17 +36,17 @@ export const RuntimeEventRaw = Schema.Struct({ }); export type RuntimeEventRaw = typeof RuntimeEventRaw.Type; -export const ProviderRequestId = TrimmedNonEmptyStringSchema; +const ProviderRequestId = TrimmedNonEmptyStringSchema; export type ProviderRequestId = typeof ProviderRequestId.Type; -export const ProviderRefs = Schema.Struct({ +const ProviderRefs = Schema.Struct({ providerTurnId: Schema.optional(TrimmedNonEmptyStringSchema), providerItemId: Schema.optional(ProviderItemId), providerRequestId: Schema.optional(ProviderRequestId), }); export type ProviderRefs = typeof ProviderRefs.Type; -export const RuntimeSessionState = Schema.Literals([ +const RuntimeSessionState = Schema.Literals([ "starting", "ready", "running", @@ -56,7 +56,7 @@ export const RuntimeSessionState = Schema.Literals([ ]); export type RuntimeSessionState = typeof RuntimeSessionState.Type; -export const RuntimeThreadState = Schema.Literals([ +const RuntimeThreadState = Schema.Literals([ "active", "idle", "archived", @@ -66,7 +66,7 @@ export const RuntimeThreadState = Schema.Literals([ ]); export type RuntimeThreadState = typeof RuntimeThreadState.Type; -export const RuntimeTurnState = Schema.Literals([ +const RuntimeTurnState = Schema.Literals([ "completed", "failed", "interrupted", @@ -74,13 +74,13 @@ export const RuntimeTurnState = Schema.Literals([ ]); export type RuntimeTurnState = typeof RuntimeTurnState.Type; -export const RuntimePlanStepStatus = Schema.Literals(["pending", "inProgress", "completed"]); +const RuntimePlanStepStatus = Schema.Literals(["pending", "inProgress", "completed"]); export type RuntimePlanStepStatus = typeof RuntimePlanStepStatus.Type; -export const RuntimeItemStatus = Schema.Literals(["inProgress", "completed", "failed", "declined"]); +const RuntimeItemStatus = Schema.Literals(["inProgress", "completed", "failed", "declined"]); export type RuntimeItemStatus = typeof RuntimeItemStatus.Type; -export const RuntimeContentStreamKind = Schema.Literals([ +const RuntimeContentStreamKind = Schema.Literals([ "assistant_text", "reasoning_text", "reasoning_summary_text", @@ -91,10 +91,10 @@ export const RuntimeContentStreamKind = Schema.Literals([ ]); export type RuntimeContentStreamKind = typeof RuntimeContentStreamKind.Type; -export const RuntimeSessionExitKind = Schema.Literals(["graceful", "error"]); +const RuntimeSessionExitKind = Schema.Literals(["graceful", "error"]); export type RuntimeSessionExitKind = typeof RuntimeSessionExitKind.Type; -export const RuntimeErrorClass = Schema.Literals([ +const RuntimeErrorClass = Schema.Literals([ "provider_error", "transport_error", "permission_error", @@ -136,7 +136,7 @@ export const CanonicalRequestType = Schema.Literals([ ]); export type CanonicalRequestType = typeof CanonicalRequestType.Type; -export const ProviderRuntimeEventType = Schema.Literals([ +const ProviderRuntimeEventType = Schema.Literals([ "session.started", "session.configured", "session.state.changed", @@ -187,55 +187,55 @@ export const ProviderRuntimeEventType = Schema.Literals([ ]); export type ProviderRuntimeEventType = typeof ProviderRuntimeEventType.Type; -export const SessionStartedType = Schema.Literal("session.started"); -export const SessionConfiguredType = Schema.Literal("session.configured"); -export const SessionStateChangedType = Schema.Literal("session.state.changed"); -export const SessionExitedType = Schema.Literal("session.exited"); -export const ThreadStartedType = Schema.Literal("thread.started"); -export const ThreadStateChangedType = Schema.Literal("thread.state.changed"); -export const ThreadMetadataUpdatedType = Schema.Literal("thread.metadata.updated"); -export const ThreadTokenUsageUpdatedType = Schema.Literal("thread.token-usage.updated"); -export const ThreadRealtimeStartedType = Schema.Literal("thread.realtime.started"); -export const ThreadRealtimeItemAddedType = Schema.Literal("thread.realtime.item-added"); -export const ThreadRealtimeAudioDeltaType = Schema.Literal("thread.realtime.audio.delta"); -export const ThreadRealtimeErrorType = Schema.Literal("thread.realtime.error"); -export const ThreadRealtimeClosedType = Schema.Literal("thread.realtime.closed"); -export const TurnStartedType = Schema.Literal("turn.started"); -export const TurnCompletedType = Schema.Literal("turn.completed"); -export const TurnAbortedType = Schema.Literal("turn.aborted"); -export const TurnPlanUpdatedType = Schema.Literal("turn.plan.updated"); -export const TurnProposedDeltaType = Schema.Literal("turn.proposed.delta"); -export const TurnProposedCompletedType = Schema.Literal("turn.proposed.completed"); -export const TurnDiffUpdatedType = Schema.Literal("turn.diff.updated"); -export const ItemStartedType = Schema.Literal("item.started"); -export const ItemUpdatedType = Schema.Literal("item.updated"); -export const ItemCompletedType = Schema.Literal("item.completed"); -export const ContentDeltaType = Schema.Literal("content.delta"); -export const RequestOpenedType = Schema.Literal("request.opened"); -export const RequestResolvedType = Schema.Literal("request.resolved"); -export const UserInputRequestedType = Schema.Literal("user-input.requested"); -export const UserInputResolvedType = Schema.Literal("user-input.resolved"); -export const TaskStartedType = Schema.Literal("task.started"); -export const TaskProgressType = Schema.Literal("task.progress"); -export const TaskCompletedType = Schema.Literal("task.completed"); -export const HookStartedType = Schema.Literal("hook.started"); -export const HookProgressType = Schema.Literal("hook.progress"); -export const HookCompletedType = Schema.Literal("hook.completed"); -export const ToolProgressType = Schema.Literal("tool.progress"); -export const ToolSummaryType = Schema.Literal("tool.summary"); -export const AuthStatusType = Schema.Literal("auth.status"); -export const AccountUpdatedType = Schema.Literal("account.updated"); -export const AccountRateLimitsUpdatedType = Schema.Literal("account.rate-limits.updated"); -export const McpStatusUpdatedType = Schema.Literal("mcp.status.updated"); -export const McpOauthCompletedType = Schema.Literal("mcp.oauth.completed"); -export const ModelReroutedType = Schema.Literal("model.rerouted"); -export const ConfigWarningType = Schema.Literal("config.warning"); -export const DeprecationNoticeType = Schema.Literal("deprecation.notice"); -export const FilesPersistedType = Schema.Literal("files.persisted"); -export const RuntimeWarningType = Schema.Literal("runtime.warning"); -export const RuntimeErrorType = Schema.Literal("runtime.error"); +const SessionStartedType = Schema.Literal("session.started"); +const SessionConfiguredType = Schema.Literal("session.configured"); +const SessionStateChangedType = Schema.Literal("session.state.changed"); +const SessionExitedType = Schema.Literal("session.exited"); +const ThreadStartedType = Schema.Literal("thread.started"); +const ThreadStateChangedType = Schema.Literal("thread.state.changed"); +const ThreadMetadataUpdatedType = Schema.Literal("thread.metadata.updated"); +const ThreadTokenUsageUpdatedType = Schema.Literal("thread.token-usage.updated"); +const ThreadRealtimeStartedType = Schema.Literal("thread.realtime.started"); +const ThreadRealtimeItemAddedType = Schema.Literal("thread.realtime.item-added"); +const ThreadRealtimeAudioDeltaType = Schema.Literal("thread.realtime.audio.delta"); +const ThreadRealtimeErrorType = Schema.Literal("thread.realtime.error"); +const ThreadRealtimeClosedType = Schema.Literal("thread.realtime.closed"); +const TurnStartedType = Schema.Literal("turn.started"); +const TurnCompletedType = Schema.Literal("turn.completed"); +const TurnAbortedType = Schema.Literal("turn.aborted"); +const TurnPlanUpdatedType = Schema.Literal("turn.plan.updated"); +const TurnProposedDeltaType = Schema.Literal("turn.proposed.delta"); +const TurnProposedCompletedType = Schema.Literal("turn.proposed.completed"); +const TurnDiffUpdatedType = Schema.Literal("turn.diff.updated"); +const ItemStartedType = Schema.Literal("item.started"); +const ItemUpdatedType = Schema.Literal("item.updated"); +const ItemCompletedType = Schema.Literal("item.completed"); +const ContentDeltaType = Schema.Literal("content.delta"); +const RequestOpenedType = Schema.Literal("request.opened"); +const RequestResolvedType = Schema.Literal("request.resolved"); +const UserInputRequestedType = Schema.Literal("user-input.requested"); +const UserInputResolvedType = Schema.Literal("user-input.resolved"); +const TaskStartedType = Schema.Literal("task.started"); +const TaskProgressType = Schema.Literal("task.progress"); +const TaskCompletedType = Schema.Literal("task.completed"); +const HookStartedType = Schema.Literal("hook.started"); +const HookProgressType = Schema.Literal("hook.progress"); +const HookCompletedType = Schema.Literal("hook.completed"); +const ToolProgressType = Schema.Literal("tool.progress"); +const ToolSummaryType = Schema.Literal("tool.summary"); +const AuthStatusType = Schema.Literal("auth.status"); +const AccountUpdatedType = Schema.Literal("account.updated"); +const AccountRateLimitsUpdatedType = Schema.Literal("account.rate-limits.updated"); +const McpStatusUpdatedType = Schema.Literal("mcp.status.updated"); +const McpOauthCompletedType = Schema.Literal("mcp.oauth.completed"); +const ModelReroutedType = Schema.Literal("model.rerouted"); +const ConfigWarningType = Schema.Literal("config.warning"); +const DeprecationNoticeType = Schema.Literal("deprecation.notice"); +const FilesPersistedType = Schema.Literal("files.persisted"); +const RuntimeWarningType = Schema.Literal("runtime.warning"); +const RuntimeErrorType = Schema.Literal("runtime.error"); -export const ProviderRuntimeEventBase = Schema.Struct({ +const ProviderRuntimeEventBase = Schema.Struct({ eventId: EventId, provider: ProviderKind, threadId: ThreadId, @@ -248,85 +248,85 @@ export const ProviderRuntimeEventBase = Schema.Struct({ }); export type ProviderRuntimeEventBase = typeof ProviderRuntimeEventBase.Type; -export const SessionStartedPayload = Schema.Struct({ +const SessionStartedPayload = Schema.Struct({ message: Schema.optional(TrimmedNonEmptyStringSchema), resume: Schema.optional(Schema.Unknown), }); export type SessionStartedPayload = typeof SessionStartedPayload.Type; -export const SessionConfiguredPayload = Schema.Struct({ +const SessionConfiguredPayload = Schema.Struct({ config: UnknownRecordSchema, }); export type SessionConfiguredPayload = typeof SessionConfiguredPayload.Type; -export const SessionStateChangedPayload = Schema.Struct({ +const SessionStateChangedPayload = Schema.Struct({ state: RuntimeSessionState, reason: Schema.optional(TrimmedNonEmptyStringSchema), detail: Schema.optional(Schema.Unknown), }); export type SessionStateChangedPayload = typeof SessionStateChangedPayload.Type; -export const SessionExitedPayload = Schema.Struct({ +const SessionExitedPayload = Schema.Struct({ reason: Schema.optional(TrimmedNonEmptyStringSchema), recoverable: Schema.optional(Schema.Boolean), exitKind: Schema.optional(RuntimeSessionExitKind), }); export type SessionExitedPayload = typeof SessionExitedPayload.Type; -export const ThreadStartedPayload = Schema.Struct({ +const ThreadStartedPayload = Schema.Struct({ providerThreadId: Schema.optional(TrimmedNonEmptyStringSchema), }); export type ThreadStartedPayload = typeof ThreadStartedPayload.Type; -export const ThreadStateChangedPayload = Schema.Struct({ +const ThreadStateChangedPayload = Schema.Struct({ state: RuntimeThreadState, detail: Schema.optional(Schema.Unknown), }); export type ThreadStateChangedPayload = typeof ThreadStateChangedPayload.Type; -export const ThreadMetadataUpdatedPayload = Schema.Struct({ +const ThreadMetadataUpdatedPayload = Schema.Struct({ name: Schema.optional(TrimmedNonEmptyStringSchema), metadata: Schema.optional(UnknownRecordSchema), }); export type ThreadMetadataUpdatedPayload = typeof ThreadMetadataUpdatedPayload.Type; -export const ThreadTokenUsageUpdatedPayload = Schema.Struct({ +const ThreadTokenUsageUpdatedPayload = Schema.Struct({ usage: Schema.Unknown, }); export type ThreadTokenUsageUpdatedPayload = typeof ThreadTokenUsageUpdatedPayload.Type; -export const ThreadRealtimeStartedPayload = Schema.Struct({ +const ThreadRealtimeStartedPayload = Schema.Struct({ realtimeSessionId: Schema.optional(TrimmedNonEmptyStringSchema), }); export type ThreadRealtimeStartedPayload = typeof ThreadRealtimeStartedPayload.Type; -export const ThreadRealtimeItemAddedPayload = Schema.Struct({ +const ThreadRealtimeItemAddedPayload = Schema.Struct({ item: Schema.Unknown, }); export type ThreadRealtimeItemAddedPayload = typeof ThreadRealtimeItemAddedPayload.Type; -export const ThreadRealtimeAudioDeltaPayload = Schema.Struct({ +const ThreadRealtimeAudioDeltaPayload = Schema.Struct({ audio: Schema.Unknown, }); export type ThreadRealtimeAudioDeltaPayload = typeof ThreadRealtimeAudioDeltaPayload.Type; -export const ThreadRealtimeErrorPayload = Schema.Struct({ +const ThreadRealtimeErrorPayload = Schema.Struct({ message: TrimmedNonEmptyStringSchema, }); export type ThreadRealtimeErrorPayload = typeof ThreadRealtimeErrorPayload.Type; -export const ThreadRealtimeClosedPayload = Schema.Struct({ +const ThreadRealtimeClosedPayload = Schema.Struct({ reason: Schema.optional(TrimmedNonEmptyStringSchema), }); export type ThreadRealtimeClosedPayload = typeof ThreadRealtimeClosedPayload.Type; -export const TurnStartedPayload = Schema.Struct({ +const TurnStartedPayload = Schema.Struct({ model: Schema.optional(TrimmedNonEmptyStringSchema), effort: Schema.optional(TrimmedNonEmptyStringSchema), }); export type TurnStartedPayload = typeof TurnStartedPayload.Type; -export const TurnCompletedPayload = Schema.Struct({ +const TurnCompletedPayload = Schema.Struct({ state: RuntimeTurnState, stopReason: Schema.optional(Schema.NullOr(TrimmedNonEmptyStringSchema)), usage: Schema.optional(Schema.Unknown), @@ -336,34 +336,34 @@ export const TurnCompletedPayload = Schema.Struct({ }); export type TurnCompletedPayload = typeof TurnCompletedPayload.Type; -export const TurnAbortedPayload = Schema.Struct({ +const TurnAbortedPayload = Schema.Struct({ reason: TrimmedNonEmptyStringSchema, }); export type TurnAbortedPayload = typeof TurnAbortedPayload.Type; -export const RuntimePlanStep = Schema.Struct({ +const RuntimePlanStep = Schema.Struct({ step: TrimmedNonEmptyStringSchema, status: RuntimePlanStepStatus, }); export type RuntimePlanStep = typeof RuntimePlanStep.Type; -export const TurnPlanUpdatedPayload = Schema.Struct({ +const TurnPlanUpdatedPayload = Schema.Struct({ explanation: Schema.optional(Schema.NullOr(TrimmedNonEmptyStringSchema)), plan: Schema.Array(RuntimePlanStep), }); export type TurnPlanUpdatedPayload = typeof TurnPlanUpdatedPayload.Type; -export const TurnProposedDeltaPayload = Schema.Struct({ +const TurnProposedDeltaPayload = Schema.Struct({ delta: Schema.String, }); export type TurnProposedDeltaPayload = typeof TurnProposedDeltaPayload.Type; -export const TurnProposedCompletedPayload = Schema.Struct({ +const TurnProposedCompletedPayload = Schema.Struct({ planMarkdown: TrimmedNonEmptyStringSchema, }); export type TurnProposedCompletedPayload = typeof TurnProposedCompletedPayload.Type; -export const TurnDiffUpdatedPayload = Schema.Struct({ +const TurnDiffUpdatedPayload = Schema.Struct({ unifiedDiff: Schema.String, }); export type TurnDiffUpdatedPayload = typeof TurnDiffUpdatedPayload.Type; @@ -377,7 +377,7 @@ export const ItemLifecyclePayload = Schema.Struct({ }); export type ItemLifecyclePayload = typeof ItemLifecyclePayload.Type; -export const ContentDeltaPayload = Schema.Struct({ +const ContentDeltaPayload = Schema.Struct({ streamKind: RuntimeContentStreamKind, delta: Schema.String, contentIndex: Schema.optional(Schema.Int), @@ -385,21 +385,21 @@ export const ContentDeltaPayload = Schema.Struct({ }); export type ContentDeltaPayload = typeof ContentDeltaPayload.Type; -export const RequestOpenedPayload = Schema.Struct({ +const RequestOpenedPayload = Schema.Struct({ requestType: CanonicalRequestType, detail: Schema.optional(TrimmedNonEmptyStringSchema), args: Schema.optional(Schema.Unknown), }); export type RequestOpenedPayload = typeof RequestOpenedPayload.Type; -export const RequestResolvedPayload = Schema.Struct({ +const RequestResolvedPayload = Schema.Struct({ requestType: CanonicalRequestType, decision: Schema.optional(TrimmedNonEmptyStringSchema), resolution: Schema.optional(Schema.Unknown), }); export type RequestResolvedPayload = typeof RequestResolvedPayload.Type; -export const UserInputQuestionOption = Schema.Struct({ +const UserInputQuestionOption = Schema.Struct({ label: TrimmedNonEmptyStringSchema, description: TrimmedNonEmptyStringSchema, }); @@ -413,24 +413,24 @@ export const UserInputQuestion = Schema.Struct({ }); export type UserInputQuestion = typeof UserInputQuestion.Type; -export const UserInputRequestedPayload = Schema.Struct({ +const UserInputRequestedPayload = Schema.Struct({ questions: Schema.Array(UserInputQuestion), }); export type UserInputRequestedPayload = typeof UserInputRequestedPayload.Type; -export const UserInputResolvedPayload = Schema.Struct({ +const UserInputResolvedPayload = Schema.Struct({ answers: UnknownRecordSchema, }); export type UserInputResolvedPayload = typeof UserInputResolvedPayload.Type; -export const TaskStartedPayload = Schema.Struct({ +const TaskStartedPayload = Schema.Struct({ taskId: RuntimeTaskId, description: Schema.optional(TrimmedNonEmptyStringSchema), taskType: Schema.optional(TrimmedNonEmptyStringSchema), }); export type TaskStartedPayload = typeof TaskStartedPayload.Type; -export const TaskProgressPayload = Schema.Struct({ +const TaskProgressPayload = Schema.Struct({ taskId: RuntimeTaskId, description: TrimmedNonEmptyStringSchema, usage: Schema.optional(Schema.Unknown), @@ -438,7 +438,7 @@ export const TaskProgressPayload = Schema.Struct({ }); export type TaskProgressPayload = typeof TaskProgressPayload.Type; -export const TaskCompletedPayload = Schema.Struct({ +const TaskCompletedPayload = Schema.Struct({ taskId: RuntimeTaskId, status: Schema.Literals(["completed", "failed", "stopped"]), summary: Schema.optional(TrimmedNonEmptyStringSchema), @@ -446,14 +446,14 @@ export const TaskCompletedPayload = Schema.Struct({ }); export type TaskCompletedPayload = typeof TaskCompletedPayload.Type; -export const HookStartedPayload = Schema.Struct({ +const HookStartedPayload = Schema.Struct({ hookId: TrimmedNonEmptyStringSchema, hookName: TrimmedNonEmptyStringSchema, hookEvent: TrimmedNonEmptyStringSchema, }); export type HookStartedPayload = typeof HookStartedPayload.Type; -export const HookProgressPayload = Schema.Struct({ +const HookProgressPayload = Schema.Struct({ hookId: TrimmedNonEmptyStringSchema, output: Schema.optional(Schema.String), stdout: Schema.optional(Schema.String), @@ -461,7 +461,7 @@ export const HookProgressPayload = Schema.Struct({ }); export type HookProgressPayload = typeof HookProgressPayload.Type; -export const HookCompletedPayload = Schema.Struct({ +const HookCompletedPayload = Schema.Struct({ hookId: TrimmedNonEmptyStringSchema, outcome: Schema.Literals(["success", "error", "cancelled"]), output: Schema.optional(Schema.String), @@ -471,7 +471,7 @@ export const HookCompletedPayload = Schema.Struct({ }); export type HookCompletedPayload = typeof HookCompletedPayload.Type; -export const ToolProgressPayload = Schema.Struct({ +const ToolProgressPayload = Schema.Struct({ toolUseId: Schema.optional(TrimmedNonEmptyStringSchema), toolName: Schema.optional(TrimmedNonEmptyStringSchema), summary: Schema.optional(TrimmedNonEmptyStringSchema), @@ -479,49 +479,49 @@ export const ToolProgressPayload = Schema.Struct({ }); export type ToolProgressPayload = typeof ToolProgressPayload.Type; -export const ToolSummaryPayload = Schema.Struct({ +const ToolSummaryPayload = Schema.Struct({ summary: TrimmedNonEmptyStringSchema, precedingToolUseIds: Schema.optional(Schema.Array(TrimmedNonEmptyStringSchema)), }); export type ToolSummaryPayload = typeof ToolSummaryPayload.Type; -export const AuthStatusPayload = Schema.Struct({ +const AuthStatusPayload = Schema.Struct({ isAuthenticating: Schema.optional(Schema.Boolean), output: Schema.optional(Schema.Array(Schema.String)), error: Schema.optional(TrimmedNonEmptyStringSchema), }); export type AuthStatusPayload = typeof AuthStatusPayload.Type; -export const AccountUpdatedPayload = Schema.Struct({ +const AccountUpdatedPayload = Schema.Struct({ account: Schema.Unknown, }); export type AccountUpdatedPayload = typeof AccountUpdatedPayload.Type; -export const AccountRateLimitsUpdatedPayload = Schema.Struct({ +const AccountRateLimitsUpdatedPayload = Schema.Struct({ rateLimits: Schema.Unknown, }); export type AccountRateLimitsUpdatedPayload = typeof AccountRateLimitsUpdatedPayload.Type; -export const McpStatusUpdatedPayload = Schema.Struct({ +const McpStatusUpdatedPayload = Schema.Struct({ status: Schema.Unknown, }); export type McpStatusUpdatedPayload = typeof McpStatusUpdatedPayload.Type; -export const McpOauthCompletedPayload = Schema.Struct({ +const McpOauthCompletedPayload = Schema.Struct({ success: Schema.Boolean, name: Schema.optional(TrimmedNonEmptyStringSchema), error: Schema.optional(TrimmedNonEmptyStringSchema), }); export type McpOauthCompletedPayload = typeof McpOauthCompletedPayload.Type; -export const ModelReroutedPayload = Schema.Struct({ +const ModelReroutedPayload = Schema.Struct({ fromModel: TrimmedNonEmptyStringSchema, toModel: TrimmedNonEmptyStringSchema, reason: TrimmedNonEmptyStringSchema, }); export type ModelReroutedPayload = typeof ModelReroutedPayload.Type; -export const ConfigWarningPayload = Schema.Struct({ +const ConfigWarningPayload = Schema.Struct({ summary: TrimmedNonEmptyStringSchema, details: Schema.optional(TrimmedNonEmptyStringSchema), path: Schema.optional(TrimmedNonEmptyStringSchema), @@ -529,13 +529,13 @@ export const ConfigWarningPayload = Schema.Struct({ }); export type ConfigWarningPayload = typeof ConfigWarningPayload.Type; -export const DeprecationNoticePayload = Schema.Struct({ +const DeprecationNoticePayload = Schema.Struct({ summary: TrimmedNonEmptyStringSchema, details: Schema.optional(TrimmedNonEmptyStringSchema), }); export type DeprecationNoticePayload = typeof DeprecationNoticePayload.Type; -export const FilesPersistedPayload = Schema.Struct({ +const FilesPersistedPayload = Schema.Struct({ files: Schema.Array( Schema.Struct({ filename: TrimmedNonEmptyStringSchema, @@ -553,69 +553,69 @@ export const FilesPersistedPayload = Schema.Struct({ }); export type FilesPersistedPayload = typeof FilesPersistedPayload.Type; -export const RuntimeWarningPayload = Schema.Struct({ +const RuntimeWarningPayload = Schema.Struct({ message: TrimmedNonEmptyStringSchema, detail: Schema.optional(Schema.Unknown), }); export type RuntimeWarningPayload = typeof RuntimeWarningPayload.Type; -export const RuntimeErrorPayload = Schema.Struct({ +const RuntimeErrorPayload = Schema.Struct({ message: TrimmedNonEmptyStringSchema, class: Schema.optional(RuntimeErrorClass), detail: Schema.optional(Schema.Unknown), }); export type RuntimeErrorPayload = typeof RuntimeErrorPayload.Type; -export const ProviderRuntimeSessionStartedEvent = Schema.Struct({ +const ProviderRuntimeSessionStartedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: SessionStartedType, payload: SessionStartedPayload, }); export type ProviderRuntimeSessionStartedEvent = typeof ProviderRuntimeSessionStartedEvent.Type; -export const ProviderRuntimeSessionConfiguredEvent = Schema.Struct({ +const ProviderRuntimeSessionConfiguredEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: SessionConfiguredType, payload: SessionConfiguredPayload, }); export type ProviderRuntimeSessionConfiguredEvent = typeof ProviderRuntimeSessionConfiguredEvent.Type; -export const ProviderRuntimeSessionStateChangedEvent = Schema.Struct({ +const ProviderRuntimeSessionStateChangedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: SessionStateChangedType, payload: SessionStateChangedPayload, }); export type ProviderRuntimeSessionStateChangedEvent = typeof ProviderRuntimeSessionStateChangedEvent.Type; -export const ProviderRuntimeSessionExitedEvent = Schema.Struct({ +const ProviderRuntimeSessionExitedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: SessionExitedType, payload: SessionExitedPayload, }); export type ProviderRuntimeSessionExitedEvent = typeof ProviderRuntimeSessionExitedEvent.Type; -export const ProviderRuntimeThreadStartedEvent = Schema.Struct({ +const ProviderRuntimeThreadStartedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ThreadStartedType, payload: ThreadStartedPayload, }); export type ProviderRuntimeThreadStartedEvent = typeof ProviderRuntimeThreadStartedEvent.Type; -export const ProviderRuntimeThreadStateChangedEvent = Schema.Struct({ +const ProviderRuntimeThreadStateChangedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ThreadStateChangedType, payload: ThreadStateChangedPayload, }); export type ProviderRuntimeThreadStateChangedEvent = typeof ProviderRuntimeThreadStateChangedEvent.Type; -export const ProviderRuntimeThreadMetadataUpdatedEvent = Schema.Struct({ +const ProviderRuntimeThreadMetadataUpdatedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ThreadMetadataUpdatedType, payload: ThreadMetadataUpdatedPayload, }); export type ProviderRuntimeThreadMetadataUpdatedEvent = typeof ProviderRuntimeThreadMetadataUpdatedEvent.Type; -export const ProviderRuntimeThreadTokenUsageUpdatedEvent = Schema.Struct({ +const ProviderRuntimeThreadTokenUsageUpdatedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ThreadTokenUsageUpdatedType, payload: ThreadTokenUsageUpdatedPayload, @@ -623,7 +623,7 @@ export const ProviderRuntimeThreadTokenUsageUpdatedEvent = Schema.Struct({ export type ProviderRuntimeThreadTokenUsageUpdatedEvent = typeof ProviderRuntimeThreadTokenUsageUpdatedEvent.Type; -export const ProviderRuntimeThreadRealtimeStartedEvent = Schema.Struct({ +const ProviderRuntimeThreadRealtimeStartedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ThreadRealtimeStartedType, payload: ThreadRealtimeStartedPayload, @@ -631,7 +631,7 @@ export const ProviderRuntimeThreadRealtimeStartedEvent = Schema.Struct({ export type ProviderRuntimeThreadRealtimeStartedEvent = typeof ProviderRuntimeThreadRealtimeStartedEvent.Type; -export const ProviderRuntimeThreadRealtimeItemAddedEvent = Schema.Struct({ +const ProviderRuntimeThreadRealtimeItemAddedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ThreadRealtimeItemAddedType, payload: ThreadRealtimeItemAddedPayload, @@ -639,7 +639,7 @@ export const ProviderRuntimeThreadRealtimeItemAddedEvent = Schema.Struct({ export type ProviderRuntimeThreadRealtimeItemAddedEvent = typeof ProviderRuntimeThreadRealtimeItemAddedEvent.Type; -export const ProviderRuntimeThreadRealtimeAudioDeltaEvent = Schema.Struct({ +const ProviderRuntimeThreadRealtimeAudioDeltaEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ThreadRealtimeAudioDeltaType, payload: ThreadRealtimeAudioDeltaPayload, @@ -647,7 +647,7 @@ export const ProviderRuntimeThreadRealtimeAudioDeltaEvent = Schema.Struct({ export type ProviderRuntimeThreadRealtimeAudioDeltaEvent = typeof ProviderRuntimeThreadRealtimeAudioDeltaEvent.Type; -export const ProviderRuntimeThreadRealtimeErrorEvent = Schema.Struct({ +const ProviderRuntimeThreadRealtimeErrorEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ThreadRealtimeErrorType, payload: ThreadRealtimeErrorPayload, @@ -655,7 +655,7 @@ export const ProviderRuntimeThreadRealtimeErrorEvent = Schema.Struct({ export type ProviderRuntimeThreadRealtimeErrorEvent = typeof ProviderRuntimeThreadRealtimeErrorEvent.Type; -export const ProviderRuntimeThreadRealtimeClosedEvent = Schema.Struct({ +const ProviderRuntimeThreadRealtimeClosedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ThreadRealtimeClosedType, payload: ThreadRealtimeClosedPayload, @@ -663,35 +663,35 @@ export const ProviderRuntimeThreadRealtimeClosedEvent = Schema.Struct({ export type ProviderRuntimeThreadRealtimeClosedEvent = typeof ProviderRuntimeThreadRealtimeClosedEvent.Type; -export const ProviderRuntimeTurnStartedEvent = Schema.Struct({ +const ProviderRuntimeTurnStartedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: TurnStartedType, payload: TurnStartedPayload, }); export type ProviderRuntimeTurnStartedEvent = typeof ProviderRuntimeTurnStartedEvent.Type; -export const ProviderRuntimeTurnCompletedEvent = Schema.Struct({ +const ProviderRuntimeTurnCompletedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: TurnCompletedType, payload: TurnCompletedPayload, }); export type ProviderRuntimeTurnCompletedEvent = typeof ProviderRuntimeTurnCompletedEvent.Type; -export const ProviderRuntimeTurnAbortedEvent = Schema.Struct({ +const ProviderRuntimeTurnAbortedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: TurnAbortedType, payload: TurnAbortedPayload, }); export type ProviderRuntimeTurnAbortedEvent = typeof ProviderRuntimeTurnAbortedEvent.Type; -export const ProviderRuntimeTurnPlanUpdatedEvent = Schema.Struct({ +const ProviderRuntimeTurnPlanUpdatedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: TurnPlanUpdatedType, payload: TurnPlanUpdatedPayload, }); export type ProviderRuntimeTurnPlanUpdatedEvent = typeof ProviderRuntimeTurnPlanUpdatedEvent.Type; -export const ProviderRuntimeTurnProposedDeltaEvent = Schema.Struct({ +const ProviderRuntimeTurnProposedDeltaEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: TurnProposedDeltaType, payload: TurnProposedDeltaPayload, @@ -699,7 +699,7 @@ export const ProviderRuntimeTurnProposedDeltaEvent = Schema.Struct({ export type ProviderRuntimeTurnProposedDeltaEvent = typeof ProviderRuntimeTurnProposedDeltaEvent.Type; -export const ProviderRuntimeTurnProposedCompletedEvent = Schema.Struct({ +const ProviderRuntimeTurnProposedCompletedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: TurnProposedCompletedType, payload: TurnProposedCompletedPayload, @@ -707,56 +707,56 @@ export const ProviderRuntimeTurnProposedCompletedEvent = Schema.Struct({ export type ProviderRuntimeTurnProposedCompletedEvent = typeof ProviderRuntimeTurnProposedCompletedEvent.Type; -export const ProviderRuntimeTurnDiffUpdatedEvent = Schema.Struct({ +const ProviderRuntimeTurnDiffUpdatedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: TurnDiffUpdatedType, payload: TurnDiffUpdatedPayload, }); export type ProviderRuntimeTurnDiffUpdatedEvent = typeof ProviderRuntimeTurnDiffUpdatedEvent.Type; -export const ProviderRuntimeItemStartedEvent = Schema.Struct({ +const ProviderRuntimeItemStartedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ItemStartedType, payload: ItemLifecyclePayload, }); export type ProviderRuntimeItemStartedEvent = typeof ProviderRuntimeItemStartedEvent.Type; -export const ProviderRuntimeItemUpdatedEvent = Schema.Struct({ +const ProviderRuntimeItemUpdatedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ItemUpdatedType, payload: ItemLifecyclePayload, }); export type ProviderRuntimeItemUpdatedEvent = typeof ProviderRuntimeItemUpdatedEvent.Type; -export const ProviderRuntimeItemCompletedEvent = Schema.Struct({ +const ProviderRuntimeItemCompletedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ItemCompletedType, payload: ItemLifecyclePayload, }); export type ProviderRuntimeItemCompletedEvent = typeof ProviderRuntimeItemCompletedEvent.Type; -export const ProviderRuntimeContentDeltaEvent = Schema.Struct({ +const ProviderRuntimeContentDeltaEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ContentDeltaType, payload: ContentDeltaPayload, }); export type ProviderRuntimeContentDeltaEvent = typeof ProviderRuntimeContentDeltaEvent.Type; -export const ProviderRuntimeRequestOpenedEvent = Schema.Struct({ +const ProviderRuntimeRequestOpenedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: RequestOpenedType, payload: RequestOpenedPayload, }); export type ProviderRuntimeRequestOpenedEvent = typeof ProviderRuntimeRequestOpenedEvent.Type; -export const ProviderRuntimeRequestResolvedEvent = Schema.Struct({ +const ProviderRuntimeRequestResolvedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: RequestResolvedType, payload: RequestResolvedPayload, }); export type ProviderRuntimeRequestResolvedEvent = typeof ProviderRuntimeRequestResolvedEvent.Type; -export const ProviderRuntimeUserInputRequestedEvent = Schema.Struct({ +const ProviderRuntimeUserInputRequestedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: UserInputRequestedType, payload: UserInputRequestedPayload, @@ -764,84 +764,84 @@ export const ProviderRuntimeUserInputRequestedEvent = Schema.Struct({ export type ProviderRuntimeUserInputRequestedEvent = typeof ProviderRuntimeUserInputRequestedEvent.Type; -export const ProviderRuntimeUserInputResolvedEvent = Schema.Struct({ +const ProviderRuntimeUserInputResolvedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: UserInputResolvedType, payload: UserInputResolvedPayload, }); export type ProviderRuntimeUserInputResolvedEvent = typeof ProviderRuntimeUserInputResolvedEvent.Type; -export const ProviderRuntimeTaskStartedEvent = Schema.Struct({ +const ProviderRuntimeTaskStartedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: TaskStartedType, payload: TaskStartedPayload, }); export type ProviderRuntimeTaskStartedEvent = typeof ProviderRuntimeTaskStartedEvent.Type; -export const ProviderRuntimeTaskProgressEvent = Schema.Struct({ +const ProviderRuntimeTaskProgressEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: TaskProgressType, payload: TaskProgressPayload, }); export type ProviderRuntimeTaskProgressEvent = typeof ProviderRuntimeTaskProgressEvent.Type; -export const ProviderRuntimeTaskCompletedEvent = Schema.Struct({ +const ProviderRuntimeTaskCompletedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: TaskCompletedType, payload: TaskCompletedPayload, }); export type ProviderRuntimeTaskCompletedEvent = typeof ProviderRuntimeTaskCompletedEvent.Type; -export const ProviderRuntimeHookStartedEvent = Schema.Struct({ +const ProviderRuntimeHookStartedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: HookStartedType, payload: HookStartedPayload, }); export type ProviderRuntimeHookStartedEvent = typeof ProviderRuntimeHookStartedEvent.Type; -export const ProviderRuntimeHookProgressEvent = Schema.Struct({ +const ProviderRuntimeHookProgressEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: HookProgressType, payload: HookProgressPayload, }); export type ProviderRuntimeHookProgressEvent = typeof ProviderRuntimeHookProgressEvent.Type; -export const ProviderRuntimeHookCompletedEvent = Schema.Struct({ +const ProviderRuntimeHookCompletedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: HookCompletedType, payload: HookCompletedPayload, }); export type ProviderRuntimeHookCompletedEvent = typeof ProviderRuntimeHookCompletedEvent.Type; -export const ProviderRuntimeToolProgressEvent = Schema.Struct({ +const ProviderRuntimeToolProgressEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ToolProgressType, payload: ToolProgressPayload, }); export type ProviderRuntimeToolProgressEvent = typeof ProviderRuntimeToolProgressEvent.Type; -export const ProviderRuntimeToolSummaryEvent = Schema.Struct({ +const ProviderRuntimeToolSummaryEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ToolSummaryType, payload: ToolSummaryPayload, }); export type ProviderRuntimeToolSummaryEvent = typeof ProviderRuntimeToolSummaryEvent.Type; -export const ProviderRuntimeAuthStatusEvent = Schema.Struct({ +const ProviderRuntimeAuthStatusEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: AuthStatusType, payload: AuthStatusPayload, }); export type ProviderRuntimeAuthStatusEvent = typeof ProviderRuntimeAuthStatusEvent.Type; -export const ProviderRuntimeAccountUpdatedEvent = Schema.Struct({ +const ProviderRuntimeAccountUpdatedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: AccountUpdatedType, payload: AccountUpdatedPayload, }); export type ProviderRuntimeAccountUpdatedEvent = typeof ProviderRuntimeAccountUpdatedEvent.Type; -export const ProviderRuntimeAccountRateLimitsUpdatedEvent = Schema.Struct({ +const ProviderRuntimeAccountRateLimitsUpdatedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: AccountRateLimitsUpdatedType, payload: AccountRateLimitsUpdatedPayload, @@ -849,56 +849,56 @@ export const ProviderRuntimeAccountRateLimitsUpdatedEvent = Schema.Struct({ export type ProviderRuntimeAccountRateLimitsUpdatedEvent = typeof ProviderRuntimeAccountRateLimitsUpdatedEvent.Type; -export const ProviderRuntimeMcpStatusUpdatedEvent = Schema.Struct({ +const ProviderRuntimeMcpStatusUpdatedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: McpStatusUpdatedType, payload: McpStatusUpdatedPayload, }); export type ProviderRuntimeMcpStatusUpdatedEvent = typeof ProviderRuntimeMcpStatusUpdatedEvent.Type; -export const ProviderRuntimeMcpOauthCompletedEvent = Schema.Struct({ +const ProviderRuntimeMcpOauthCompletedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: McpOauthCompletedType, payload: McpOauthCompletedPayload, }); export type ProviderRuntimeMcpOauthCompletedEvent = typeof ProviderRuntimeMcpOauthCompletedEvent.Type; -export const ProviderRuntimeModelReroutedEvent = Schema.Struct({ +const ProviderRuntimeModelReroutedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ModelReroutedType, payload: ModelReroutedPayload, }); export type ProviderRuntimeModelReroutedEvent = typeof ProviderRuntimeModelReroutedEvent.Type; -export const ProviderRuntimeConfigWarningEvent = Schema.Struct({ +const ProviderRuntimeConfigWarningEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: ConfigWarningType, payload: ConfigWarningPayload, }); export type ProviderRuntimeConfigWarningEvent = typeof ProviderRuntimeConfigWarningEvent.Type; -export const ProviderRuntimeDeprecationNoticeEvent = Schema.Struct({ +const ProviderRuntimeDeprecationNoticeEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: DeprecationNoticeType, payload: DeprecationNoticePayload, }); export type ProviderRuntimeDeprecationNoticeEvent = typeof ProviderRuntimeDeprecationNoticeEvent.Type; -export const ProviderRuntimeFilesPersistedEvent = Schema.Struct({ +const ProviderRuntimeFilesPersistedEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: FilesPersistedType, payload: FilesPersistedPayload, }); export type ProviderRuntimeFilesPersistedEvent = typeof ProviderRuntimeFilesPersistedEvent.Type; -export const ProviderRuntimeWarningEvent = Schema.Struct({ +const ProviderRuntimeWarningEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: RuntimeWarningType, payload: RuntimeWarningPayload, }); export type ProviderRuntimeWarningEvent = typeof ProviderRuntimeWarningEvent.Type; -export const ProviderRuntimeErrorEvent = Schema.Struct({ +const ProviderRuntimeErrorEvent = Schema.Struct({ ...ProviderRuntimeEventBase.fields, type: RuntimeErrorType, payload: RuntimeErrorPayload, @@ -960,21 +960,21 @@ export const ProviderRuntimeEvent = ProviderRuntimeEventV2; export type ProviderRuntimeEvent = ProviderRuntimeEventV2; // Compatibility aliases for call sites still importing legacy names. -export const ProviderRuntimeMessageDeltaEvent = ProviderRuntimeContentDeltaEvent; +const ProviderRuntimeMessageDeltaEvent = ProviderRuntimeContentDeltaEvent; export type ProviderRuntimeMessageDeltaEvent = ProviderRuntimeContentDeltaEvent; -export const ProviderRuntimeMessageCompletedEvent = ProviderRuntimeItemCompletedEvent; +const ProviderRuntimeMessageCompletedEvent = ProviderRuntimeItemCompletedEvent; export type ProviderRuntimeMessageCompletedEvent = ProviderRuntimeItemCompletedEvent; -export const ProviderRuntimeToolStartedEvent = ProviderRuntimeItemStartedEvent; +const ProviderRuntimeToolStartedEvent = ProviderRuntimeItemStartedEvent; export type ProviderRuntimeToolStartedEvent = ProviderRuntimeItemStartedEvent; -export const ProviderRuntimeToolCompletedEvent = ProviderRuntimeItemCompletedEvent; +const ProviderRuntimeToolCompletedEvent = ProviderRuntimeItemCompletedEvent; export type ProviderRuntimeToolCompletedEvent = ProviderRuntimeItemCompletedEvent; -export const ProviderRuntimeApprovalRequestedEvent = ProviderRuntimeRequestOpenedEvent; +const ProviderRuntimeApprovalRequestedEvent = ProviderRuntimeRequestOpenedEvent; export type ProviderRuntimeApprovalRequestedEvent = ProviderRuntimeRequestOpenedEvent; -export const ProviderRuntimeApprovalResolvedEvent = ProviderRuntimeRequestResolvedEvent; +const ProviderRuntimeApprovalResolvedEvent = ProviderRuntimeRequestResolvedEvent; export type ProviderRuntimeApprovalResolvedEvent = ProviderRuntimeRequestResolvedEvent; // Legacy helper aliases retained for adapters/tests. -export const ProviderRuntimeToolKind = Schema.Literals([ +const ProviderRuntimeToolKind = Schema.Literals([ "command", "file-read", "file-change", diff --git a/packages/contracts/src/server.ts b/packages/contracts/src/server.ts index 5607be35c4ffd7660fffb1ecccef2ac84fc679d8..96ea90c1f54cb5d86a243527f8ab9d031a5c70a6 100644 --- a/packages/contracts/src/server.ts +++ b/packages/contracts/src/server.ts @@ -4,18 +4,16 @@ import { KeybindingRule, ResolvedKeybindingsConfig } from "./keybindings"; import { EditorId } from "./editor"; import { ProviderKind } from "./orchestration"; -export const KeybindingsMalformedConfigIssue = Schema.Struct({ +const KeybindingsMalformedConfigIssue = Schema.Struct({ kind: Schema.Literal("keybindings.malformed-config"), message: TrimmedNonEmptyString, }); -export type KeybindingsMalformedConfigIssue = typeof KeybindingsMalformedConfigIssue.Type; -export const KeybindingsInvalidEntryIssue = Schema.Struct({ +const KeybindingsInvalidEntryIssue = Schema.Struct({ kind: Schema.Literal("keybindings.invalid-entry"), message: TrimmedNonEmptyString, index: Schema.Number, }); -export type KeybindingsInvalidEntryIssue = typeof KeybindingsInvalidEntryIssue.Type; export const ServerConfigIssue = Schema.Union([ KeybindingsMalformedConfigIssue, @@ -23,8 +21,7 @@ export const ServerConfigIssue = Schema.Union([ ]); export type ServerConfigIssue = typeof ServerConfigIssue.Type; -export const ServerConfigIssues = Schema.Array(ServerConfigIssue); -export type ServerConfigIssues = typeof ServerConfigIssues.Type; +const ServerConfigIssues = Schema.Array(ServerConfigIssue); export const ServerProviderStatusState = Schema.Literals(["ready", "warning", "error"]); export type ServerProviderStatusState = typeof ServerProviderStatusState.Type; @@ -46,8 +43,7 @@ export const ServerProviderStatus = Schema.Struct({ }); export type ServerProviderStatus = typeof ServerProviderStatus.Type; -export const ServerProviderStatuses = Schema.Array(ServerProviderStatus); -export type ServerProviderStatuses = typeof ServerProviderStatuses.Type; +const ServerProviderStatuses = Schema.Array(ServerProviderStatus); export const ServerConfig = Schema.Struct({ cwd: TrimmedNonEmptyString, diff --git a/packages/contracts/src/terminal.ts b/packages/contracts/src/terminal.ts index 1dea8963ec7d892e6d6be51d4d65589131ff88c7..088e87e027f93616363641e170096fb64c321153 100644 --- a/packages/contracts/src/terminal.ts +++ b/packages/contracts/src/terminal.ts @@ -23,12 +23,12 @@ const TerminalIdWithDefaultSchema = TerminalIdSchema.pipe( Schema.withDecodingDefault(() => DEFAULT_TERMINAL_ID), ); -export const TerminalThreadInput = Schema.Struct({ +const TerminalThreadInput = Schema.Struct({ threadId: TrimmedNonEmptyStringSchema, }); export type TerminalThreadInput = Schema.Codec.Encoded; -export const TerminalSessionInput = Schema.Struct({ +const TerminalSessionInput = Schema.Struct({ ...TerminalThreadInput.fields, terminalId: TerminalIdWithDefaultSchema, }); @@ -96,43 +96,43 @@ const TerminalEventBaseSchema = Schema.Struct({ createdAt: Schema.String, }); -export const TerminalStartedEvent = Schema.Struct({ +const TerminalStartedEvent = Schema.Struct({ ...TerminalEventBaseSchema.fields, type: Schema.Literal("started"), snapshot: TerminalSessionSnapshot, }); -export const TerminalOutputEvent = Schema.Struct({ +const TerminalOutputEvent = Schema.Struct({ ...TerminalEventBaseSchema.fields, type: Schema.Literal("output"), data: Schema.String, }); -export const TerminalExitedEvent = Schema.Struct({ +const TerminalExitedEvent = Schema.Struct({ ...TerminalEventBaseSchema.fields, type: Schema.Literal("exited"), exitCode: Schema.NullOr(Schema.Int), exitSignal: Schema.NullOr(Schema.Int), }); -export const TerminalErrorEvent = Schema.Struct({ +const TerminalErrorEvent = Schema.Struct({ ...TerminalEventBaseSchema.fields, type: Schema.Literal("error"), message: Schema.String.check(Schema.isNonEmpty()), }); -export const TerminalClearedEvent = Schema.Struct({ +const TerminalClearedEvent = Schema.Struct({ ...TerminalEventBaseSchema.fields, type: Schema.Literal("cleared"), }); -export const TerminalRestartedEvent = Schema.Struct({ +const TerminalRestartedEvent = Schema.Struct({ ...TerminalEventBaseSchema.fields, type: Schema.Literal("restarted"), snapshot: TerminalSessionSnapshot, }); -export const TerminalActivityEvent = Schema.Struct({ +const TerminalActivityEvent = Schema.Struct({ ...TerminalEventBaseSchema.fields, type: Schema.Literal("activity"), hasRunningSubprocess: Schema.Boolean, diff --git a/packages/contracts/src/ws.ts b/packages/contracts/src/ws.ts index 61319981bdbd7758dd652962919168a6379cef59..1100b4f9df5aea7cde5435f451d60a7b7d2eb66e 100644 --- a/packages/contracts/src/ws.ts +++ b/packages/contracts/src/ws.ts @@ -89,7 +89,7 @@ const tagRequestBody =