SDK Types
SDK Types
Section titled “SDK Types”Squad Federation provides TypeScript interfaces and types in sdk/types.ts. These define the contracts between core and archetypes.
Core Interfaces
Section titled “Core Interfaces”TeamPlacement
Section titled “TeamPlacement”Abstracts where team files live—handles file I/O and workspace location.
export interface TeamPlacement { readFile(teamId: string, filePath: string): Promise<string | null>; writeFile(teamId: string, filePath: string, content: string): Promise<void>; exists(teamId: string, filePath: string): Promise<boolean>; stat?(teamId: string, filePath: string): Promise<{ isDirectory: boolean; size: number } | null>; getLocation(teamId: string): Promise<string>; listFiles(teamId: string, directory?: string): Promise<string[]>; bootstrap(teamId: string, archetypeId: string, config: Record<string, unknown>): Promise<void>; workspaceExists(teamId: string): Promise<boolean>;}What it does:
readFile/writeFile— File operations scoped to team workspaceexists/stat— Check file existence and metadatagetLocation— Get workspace path or URLlistFiles— Enumerate workspace contentsbootstrap— Initialize new team workspaceworkspaceExists— Check if workspace is set up
TeamCommunication
Section titled “TeamCommunication”Abstracts how teams exchange signals and status—separated from placement to allow different communication protocols with unified file operations.
export interface TeamCommunication { readStatus(teamId: string): Promise<ScanStatus | null>; readInboxSignals(teamId: string): Promise<SignalMessage[]>; writeInboxSignal(teamId: string, signal: SignalMessage): Promise<void>; readOutboxSignals(teamId: string): Promise<SignalMessage[]>; listSignals( teamId: string, direction: 'inbox' | 'outbox', filter?: { type?: string; since?: string; from?: string } ): Promise<SignalMessage[]>; readLearningLog(teamId: string): Promise<LearningEntry[]>; appendLearning(teamId: string, entry: LearningEntry): Promise<void>; watchSignals?( teamId: string, direction: 'inbox' | 'outbox', callback: (signal: SignalMessage) => void ): () => void;}What it does:
readStatus— Get team’s current state (scanning, complete, etc.)readInboxSignals/writeInboxSignal— Messages sent TO the teamreadOutboxSignals— Messages sent FROM the teamlistSignals— Query signals with filtersreadLearningLog/appendLearning— Team knowledge capturewatchSignals(optional) — Real-time signal notifications for push-based transports
TeamContext
Section titled “TeamContext”Combines placement and communication for convenient team interactions.
export interface TeamContext { domain: string; domainId: string; location: string; archetypeId: string; placement: TeamPlacement; communication: TeamCommunication;}What it does: Encapsulates everything needed to work with a team—domain identity, workspace location, archetype type, and the adapters for file/signal operations.
TeamEntry
Section titled “TeamEntry”Registry entry. Status field (v0.5.0+): active (default) | paused | retired.
Lifecycle: active → paused ⇄ active, active|paused → retired (terminal).
Data Schemas
Section titled “Data Schemas”ScanStatus
Section titled “ScanStatus”Represents a team’s current state.
interface ScanStatus { domain: string; domain_id: string; state: 'initializing' | 'scanning' | 'distilling' | 'complete' | 'failed' | 'paused'; step: string; started_at: string; updated_at: string; completed_at?: string; progress_pct?: number; error?: string; agent_active?: string;}Fields:
state— Current lifecycle phasestep— Human-readable current taskprogress_pct— Estimated completion (0-100)error— Error message ifstateisfailedagent_active— Which agent is currently running
SignalMessage
Section titled “SignalMessage”Inter-team communication message.
interface SignalMessage { id: string; timestamp: string; from: string; to: string; type: 'directive' | 'question' | 'report' | 'alert'; subject: string; body: string; protocol: string; acknowledged?: boolean; acknowledged_at?: string;}Types:
directive— Tell a team what to doquestion— Request informationreport— Share findings or statusalert— Raise error or blocking issue
Protocol values: file-signal-v1
LearningEntry
Section titled “LearningEntry”Captured knowledge from team work.
interface LearningEntry { id: string; timestamp: string; domain: 'generalizable' | string; category: 'pattern' | 'discovery' | 'convention' | 'gotcha'; content: string; tags: string[]; confidence: 'high' | 'medium' | 'low'; graduated?: boolean; relatedSkill?: string; context?: string;}Fields:
domain—generalizablefor cross-team learnings, or team-specificcategory— Type of insightconfidence— How sure the team is about this learninggraduated— Whether this became a skillrelatedSkill— Skill file this came from or created
Communication Implementations
Section titled “Communication Implementations”FileSignalCommunication
Section titled “FileSignalCommunication”File-based signals (JSON inbox/outbox).
Location: .squad/signals/inbox/ and .squad/signals/outbox/
Signal format: JSON files named {timestamp}-{type}-{subject}.json
How it works:
- Writes signals as JSON files
- Reads by parsing directory contents
- Acknowledgment via
.ackfiles