Overview
The contracts package provides foundational TypeScript types and Effect schemas used throughout T3 Code. These types ensure type safety and validation across the client-server boundary.Base Schemas
String Types
TrimmedString
A string that has leading and trailing whitespace removed.TrimmedNonEmptyString
A trimmed string that must contain at least one character.Numeric Types
NonNegativeInt
An integer greater than or equal to zero.PositiveInt
An integer greater than or equal to one.DateTime Types
IsoDateTime
An ISO 8601 formatted datetime string.Branded Identifiers
Branded types provide type-safe identifiers that prevent mixing different ID types.Entity IDs
ThreadId
Unique identifier for a conversation thread.ProjectId
Unique identifier for a workspace project.CommandId
Unique identifier for a command in the event-sourced system.EventId
Unique identifier for a domain event.MessageId
Unique identifier for a message in a thread.TurnId
Unique identifier for a turn (user input + assistant response cycle).Provider Runtime IDs
ProviderItemId
Identifier for a provider-specific item (e.g., a Codex conversation item).RuntimeSessionId
Identifier for a runtime session.RuntimeItemId
Identifier for a runtime item.RuntimeRequestId
Identifier for a runtime request.RuntimeTaskId
Identifier for a runtime task.ApprovalRequestId
Identifier for an approval request.CheckpointRef
Reference to a git checkpoint for rollback.Provider Types
ProviderKind
Supported AI provider types.Currently, only Codex is supported. Additional providers may be added in the future.
Runtime Modes
RuntimeMode
Controls the level of access the provider has to the system.approval-required- User must approve each tool callfull-access- Provider can execute tools without approval
ProviderApprovalPolicy
Detailed approval policy configuration.ProviderSandboxMode
File system access level for the provider.Interaction Modes
ProviderInteractionMode
Controls how the provider interacts with the user.default- Standard conversational modeplan- Provider proposes a plan before execution
Service Tiers
ProviderServiceTier
Service tier for API requests.Approval Types
ProviderApprovalDecision
User’s decision on an approval request.accept- Approve this specific requestacceptForSession- Approve this and future similar requests in the sessiondecline- Reject this requestcancel- Cancel the entire turn
ProviderRequestKind
Type of request requiring approval.Message Delivery
AssistantDeliveryMode
How assistant messages are delivered to the client.Chat Attachments
ChatImageAttachment
An image attached to a chat message.Attachment type discriminator
Unique attachment ID (max 128 chars, alphanumeric with dashes/underscores)
File name (max 255 chars)
MIME type starting with “image/” (max 100 chars)
File size in bytes (max 10MB)
ChatAttachment
Union of all attachment types.Git Types
GitBranch
Represents a git branch with metadata.Branch name
Whether this is a remote branch
Name of the remote (e.g., “origin”)
Whether this is the currently checked out branch
Whether this is the default branch (main/master)
Path to the worktree if this branch has one
GitStackedAction
Git actions that can be performed in sequence.commit- Create a commitcommit_push- Create a commit and pushcommit_push_pr- Create a commit, push, and open a PR
Project Types
ProjectEntry
Represents a file or directory in a project.Relative path from project root
Entry type
Parent directory path
Editor Types
EditorId
Supported code editors.Editor Configuration
Usage Examples
Creating Branded IDs
Validating with Effect Schema
Working with Chat Attachments
Using Git Types
Type Guards
Effect Schema provides runtime type guards:Related Types
See also:- Model Contracts - Model configuration types
- Orchestration Schemas - Domain models and events
