#!/usr/bin/env node import { AdvisorInfluenceLifecycle, HostedContextControlSource, HostedContextControlPlan, HostedContextControlApplyReceipt, ProjectIntentDetectionResult, ProjectPolicyDecision, ProjectRealityCheckResult, ContextMutationPlan, ContextMutationApplyReceipt, ProjectContextValidationReport, ProjectDriftReport, AgentContextResolution, AgentContextValidationReport, AgentContextEvidenceReceipt, AgentContextEvidenceReport, ProjectIntelligenceEngineeringLeadPlanSummary, ProjectPolicyRule, AdvisorInfluenceLifecycleState, DecisionRequest, OutcomeIntelligenceCalibration, OutcomeIntelligenceReceipt, OutcomeIntelligenceEvidence, ControlledWorkerExecutionMode, WorkerTrustCategory, ControlledWorkerExecutionReceipt, UnifiedReceiptEnvelope, WorkerTrustCandidate, WorkerProfile, WorkerTrustEvent } from '@snipara/project-intelligence-contracts'; declare function resolveQueryFromToolInput(toolInput?: string, tool?: string): string | null; /** * Return the only extra metadata allowed for a successful commit-like result. * * The command is used only as a local classification hint and is never copied * into this metadata. Git is invoked without a shell, the reflog must confirm * the requested operation, the current result must contain HEAD's SHA prefix, * and the emitted SHA must be a full commit object id. */ declare function buildCommitResultMetadata(options: { tool?: string; toolInput?: string; result?: string; exitCode?: number; status?: string; cwd?: string; }): { commitSha?: string; }; declare function extractFilesFromToolInput(toolInput?: string): string[]; interface RLMConfig { apiKey?: string; projectId?: string; apiUrl: string; sessionId?: string; client?: string; } type ConfigScope = "auto" | "workspace" | "global"; interface ConfigResolutionOptions { cwd?: string; scope?: ConfigScope; } /** * Load configuration from disk */ declare function loadConfig(options?: ConfigResolutionOptions): RLMConfig; /** * Save configuration to disk */ declare function saveConfig(config: Partial, options?: ConfigResolutionOptions): void; /** * Get config file path (for display purposes) */ declare function getConfigPath(options?: ConfigResolutionOptions): string; interface SessionCheckpoint { sessionId: string; summary: string; files: string[]; } interface ContextQueryResult { sections: Array<{ title: string; content: string; file: string; lines: [number, number]; relevance_score: number; token_count: number; truncated: boolean; quality_score?: number | null; quality_flags?: string[]; }>; total_tokens: number; max_tokens: number; query: string; suggestions?: string[]; answer_pack?: AnswerPack | null; answer_pack_included?: boolean; answer_pack_tokens?: number; routing_recommendation?: "direct" | "rlm"; routing_confidence?: number; routing_reason?: string; query_complexity?: "simple" | "moderate" | "complex"; recommended_tool?: string; recommended_tool_arguments?: Record; graph_hybrid_used?: boolean; graph_context_tool?: string; graph_context_summary?: string; search_mode?: ContextQuerySearchMode; timing?: Record; retrieval_diagnostics?: Record; index_state?: { status: "empty" | "ready"; indexed_documents: number; files_loaded: number; message?: string; recommended_command?: string; recommended_tool?: string; }; } type ContextQuerySearchMode = "keyword" | "semantic" | "hybrid"; type MinimumChangeMode = "off" | "review"; type MinimumChangeEvidenceStatus = "asserted" | "confirmed" | "candidate" | "unknown" | "not_applicable" | "needs_review"; interface MinimumChangeEvidenceCheck { status: MinimumChangeEvidenceStatus; source?: "code_impact" | "git_diff" | "lockfile" | "manifest" | "runtime" | "test_runner" | "caller_assertion"; evidence?: Array>; scope?: string; observed_at?: string; confidence?: number; adapter_receipt?: MinimumChangeAdapterReceipt; } interface MinimumChangeAdapterReceipt { name: string; version: string; status: "verified"; claim: string; fingerprint: string; } interface MinimumChangeEvidence { existing_capability?: MinimumChangeEvidenceCheck; stdlib_or_native?: MinimumChangeEvidenceCheck; installed_dependency?: MinimumChangeEvidenceCheck; smallest_safe_diff?: MinimumChangeEvidenceCheck; validation_surface?: MinimumChangeEvidenceCheck; preservation?: { validation?: MinimumChangeEvidenceCheck; error_contract?: MinimumChangeEvidenceCheck; security_auth?: MinimumChangeEvidenceCheck; accessibility?: MinimumChangeEvidenceCheck; public_contract?: MinimumChangeEvidenceCheck; tests?: MinimumChangeEvidenceCheck; }; } interface ContextQueryOptions { searchMode?: ContextQuerySearchMode; includeMetadata?: boolean; includeAnswerPack?: boolean; autoDecompose?: boolean; includeSharedContext?: boolean; includeAllTiers?: boolean; returnReferences?: boolean; minimumChangeMode?: MinimumChangeMode; minimumChangeEvidence?: MinimumChangeEvidence; } interface AnswerPackSource { title?: string; file?: string; lines?: [number, number] | number[]; relevance_score?: number; quality_score?: number | null; } interface AnswerPackClaim { claim: string; source?: AnswerPackSource; score?: number; } interface AnswerPack { version?: string; query_intent?: string; source_facts?: AnswerPackClaim[]; source_map?: AnswerPackSource[]; caveats?: AnswerPackClaim[]; what_not_to_claim?: string[]; verification_checklist?: string[]; low_confidence?: boolean; code_context?: { recommended_tool?: string | null; recommended_tool_arguments?: Record; graph_context_included?: boolean; impact_hint?: string | null; }; minimum_safe_change?: Record; token_count?: number; } interface HostedContextControlDiffResponse { project: { id: string; name: string; slug: string; }; plan: HostedContextControlPlan; } interface HostedContextControlApplyResponse { project: { id: string; name: string; slug: string; }; receipt: HostedContextControlApplyReceipt; } interface CodeGraphNodeResult { symbol_key: string; qualified_name: string; local_name: string; kind: string; language: string; module_path: string; file_path: string; start_line: number; end_line: number; signature?: string | null; depth?: number; } interface CodeGraphEdgeResult { from_symbol_key: string; to_symbol_key: string; from_qualified_name?: string | null; to_qualified_name?: string | null; kind: string; source: string; confidence: number; } interface CodeCallersResult { matched_targets: CodeGraphNodeResult[]; callers: CodeGraphNodeResult[]; depth: number; total_callers: number; } interface CodeImportsResult { matched_targets: CodeGraphNodeResult[]; direction: "in" | "out"; compacted: boolean; matched_target_count: number; scanned_target_count: number; imports: CodeGraphNodeResult[]; total_imports: number; } interface CodeNeighborsResult { matched_targets: CodeGraphNodeResult[]; nodes: CodeGraphNodeResult[]; edges: CodeGraphEdgeResult[]; depth: number; } interface CodeShortestPathResult { matched_sources: CodeGraphNodeResult[]; matched_targets: CodeGraphNodeResult[]; found: boolean; path: CodeGraphNodeResult[]; edges: CodeGraphEdgeResult[]; hops: number; } interface SharedContextDocumentResult { id: string; title: string; category: string; is_mandatory?: boolean; token_count: number; collection_name: string; source_type: "TEAM_CONTEXT" | "LINKED_COLLECTION" | string; tags: string[]; } interface SharedContextResult { documents: SharedContextDocumentResult[]; merged_content?: string | null; total_tokens: number; collections_loaded: number; linked_collections_loaded?: number; team_context_documents_loaded?: number; linked_collection_documents_loaded?: number; context_hash: string; } interface SyncDocumentInput { path: string; content: string; kind?: "DOC" | "BINARY"; format?: string; language?: string | null; metadata?: Record; } type ProjectPolicyLedgerSyncArtifactKind = "decision_request" | "decision_resolution" | "apply_receipt" | "policy_draft"; type ProjectPolicyLedgerSyncStatus = "pending" | "approved" | "refused" | "superseded" | "modified"; type ProjectPolicyLedgerSyncApplyState = "needs_apply" | "applied" | "manual_follow_up_required" | "no_apply"; interface ProjectPolicyLedgerSyncArtifactInput { kind: ProjectPolicyLedgerSyncArtifactKind; requestId: string; fingerprint?: string; title?: string; status?: ProjectPolicyLedgerSyncStatus; applyState?: ProjectPolicyLedgerSyncApplyState; humanChoice?: string; summary?: string; sourcePath?: string; updatedAt?: string; payload: Record; } type BusinessCollectionPreset = "business_response_playbook" | "business_library" | "offer_templates" | "company_presentations" | "reference_diagrams"; interface UploadDocumentOptions { kind?: "DOC" | "BINARY"; format?: string; language?: string | null; metadata?: Record; } interface ListBusinessCollectionsOptions { includeCustom?: boolean; includeMissingPresets?: boolean; } interface EnsureBusinessCollectionOptions { preset?: BusinessCollectionPreset; name?: string; slug?: string; description?: string; } interface UploadBusinessDocumentOptions { collectionId?: string; preset?: BusinessCollectionPreset; collectionSlug?: string; title: string; content: string; category?: "MANDATORY" | "BEST_PRACTICES" | "GUIDELINES" | "REFERENCE"; tags?: string[]; priority?: number; allowCustomCollection?: boolean; } interface ListClientProjectsOptions { includeInternal?: boolean; limit?: number; } interface CreateClientProjectOptions { name: string; slug?: string; description?: string; externalClientId?: string; } interface TrackFileResult { success: boolean; files_tracked: number; } interface SessionPersistResult { success: boolean; session_id: string; files_tracked: number; status: "saved" | "skipped"; entry_id?: string; date?: string; } type WhyCaptureSourceKind = "commit" | "phase_commit" | "final_commit" | "handoff"; interface WhyCaptureInput { decision?: string; why?: string; rationale?: string; sourceText?: string; sourceKind: WhyCaptureSourceKind; sourceSessionId?: string; task?: string; changedFiles?: string[]; commands?: string[]; commitSha?: string; confirmed?: boolean; previewOnly?: boolean; } interface WhyCaptureResult { previewOnly: boolean; confirmed: boolean; candidateCount: number; capturedCount?: number; candidates?: Array<{ content?: string; type?: string; category?: string; reviewNotes?: string; whyFields?: { decision?: string | null; why?: string | null; outcome?: string | null; }; }>; memories?: Array<{ id?: string; memory_id?: string; content?: string; type?: string; category?: string; reviewStatus?: string; review_status?: string; }>; decisionCapture?: { createdCount?: number; duplicateCount?: number; failedCount?: number; created?: Array>; duplicates?: Array>; failed?: Array>; }; } interface EndOfTaskCommitWhyInput { decision?: string; rationale?: string; alternatives?: string[]; constraints?: string[]; observedOutcome?: string; } interface JournalAppendResult { success?: boolean; entry_id?: string; date?: string; message?: string; } interface ConnectionProbeResult { connected: boolean; statusCode?: number; detail: string; tool?: string; } type MemoryType = "fact" | "decision" | "learning" | "preference" | "todo" | "context"; type MemoryScope = "agent" | "project" | "team" | "user"; type MemoryStatus = "ACTIVE" | "INVALIDATED" | "SUPERSEDED"; interface RecalledMemory { memory_id: string; content: string; type: MemoryType; scope: MemoryScope; category?: string; status: MemoryStatus; relevance: number; confidence: number; created_at: string; last_accessed_at?: string; access_count: number; invalidated_reason?: string; superseded_by_memory_id?: string; } interface RecallWarning { memory_id: string; status: MemoryStatus; content: string; category?: string; reason?: string; superseded_by_memory_id?: string; relevance: number; created_at: string; } interface RecallResult { memories: RecalledMemory[]; warnings: RecallWarning[]; total_searched: number; query: string; timing_ms: number; } interface SessionMemoryEntry extends Record { id?: string; memory_id?: string; text?: string; content?: string; summary?: string; title?: string; type?: string; category?: string; confidence?: number; created_at?: string | null; } interface SessionMemoryTier { memories: SessionMemoryEntry[]; count: number; tokens: number; } interface SessionMemoryProfiles extends Record { project_memory_id?: string | null; owner_memory_id?: string | null; tokens?: number; precedence?: string[]; } interface SessionMemoriesResult extends Record { critical: SessionMemoryTier; daily: SessionMemoryTier; profiles?: SessionMemoryProfiles; total_tokens?: number; message?: string; } interface StoredMemory { memory_id: string; content: string; type: MemoryType; scope: MemoryScope; category?: string; status: MemoryStatus; confidence: number; source?: string; created_at: string; expires_at?: string; invalidated_at?: string; invalidated_reason?: string; superseded_by_memory_id?: string; access_count: number; } interface MemoriesResult { memories: StoredMemory[]; total_count: number; has_more: boolean; } interface RememberMemoryResult { memory_id?: string; stored?: boolean; message?: string; [key: string]: unknown; } interface MemoryInvalidateResult { memory_id: string; status?: MemoryStatus; invalidated?: boolean; invalidated_at: string; reason?: string; message: string; error?: string; } interface MemorySupersedeResult { old_memory_id: string; new_memory_id: string; superseded?: boolean; superseded_at?: string; reason?: string; message: string; error?: string; } interface AutomationCheckpointSummary { id: string; sessionId: string; createdAt: string; task?: string; source?: string; } interface CanonicalAutomationEvent { type: string; client?: string; workspace?: string; session_id?: string; agent_id?: string; timestamp?: string; privacy_level?: string; payload?: Record; } interface EmitEventResult { accepted: number; sessionIds: string[]; events: AutomationCheckpointSummary[]; } type AdvisorInfluenceAgentDecision = "accepted" | "modified" | "ignored" | "blocked"; type AdvisorInfluenceReceiptCreationOutcomeLinkStatus = "pending"; interface AdvisorInfluenceRecommendationInput { id: string; version?: "advisor-recommendation-v0"; source: string; severity: string; title: string; rationale: string; reasonCodes: string[]; historicalImpactSummary?: string | null; reasonCodeReliability?: number | null; recommendedVerification: string[]; expectedBehaviorChange: string; evidence?: unknown[]; caveats?: string[]; } interface RecordAdvisorInfluenceReceiptInput { servedJudgmentId: string; judgmentSnapshotId?: string; judgmentExposureId?: string; runId?: string; recommendation: AdvisorInfluenceRecommendationInput; agentDecision: AdvisorInfluenceAgentDecision; behaviorChange: string; verificationExecuted: string[]; outcomeLinkStatus?: AdvisorInfluenceReceiptCreationOutcomeLinkStatus; metadata?: AdvisorInfluenceReceiptMetadataInput; } interface AdvisorInfluenceReceiptMetadataInput extends Record { source?: string; firstParty?: boolean; planBefore?: string | null; planAfter?: string | null; changedBecauseOfRecommendation?: boolean | null; advisorInfluenceLifecycle?: AdvisorInfluenceLifecycle; filesAffected?: string[]; toolActions?: string[]; humanOverride?: string | null; task?: string | null; branch?: string | null; runId?: string | null; generatedAt?: string | null; } interface RecordAdvisorInfluenceReceiptResult { project: { id: string; name: string; slug: string; }; receipt: Record; advisorInfluence: Record; } interface ProjectIntelligenceBriefRequest { task?: string; diffSummary?: string; changedFiles?: string[]; symbols?: string[]; routes?: string[]; codeContext?: { localHeadSha?: string; branch?: string; workingTreeDirty?: boolean; }; correlation?: { surface?: "companion"; runId?: string; sessionId?: string; }; } interface HostedProjectIntelligenceBriefResult { project: { id: string; name: string; slug: string; }; servedJudgmentId: string | null; judgmentSnapshotId: string | null; judgmentExposureId: string | null; persistedShadowSignalCount: number; brief: { version: string; task?: string | null; judgment?: { advisorRecommendations?: unknown[]; }; }; } interface AutomationConfigFile { path: string; content: string; } interface AutomationConfigBundle { client?: string; files: AutomationConfigFile[]; instructions: string[]; } interface ProjectAutomationSettings { automationClient?: string; autoInjectContext?: boolean; trackAccessedFiles?: boolean; preserveOnCompaction?: boolean; restoreOnSessionStart?: boolean; enrichPrompts?: boolean; maxTokensPerQuery?: number; searchMode?: string; includeSummaries?: boolean; adaptiveRoutingMode?: string; adaptiveRoutingRequireApproval?: boolean; adaptiveRoutingPlannerRetainsReasoning?: boolean; adaptiveRoutingPreferLocalWorkers?: boolean; adaptiveRoutingAllowedEndpointTypes?: string[]; adaptiveRoutingPreferredEndpointTypes?: string[]; adaptiveRoutingAllowedWorkerClasses?: string[]; adaptiveRoutingFallback?: string; adaptiveRoutingDailyBudgetCents?: number; adaptiveRoutingMonthlyBudgetCents?: number; adaptiveRoutingCatalogLimit?: number; } interface ProjectAutomationSettingsResult { settings: ProjectAutomationSettings; plan?: string; featureAvailability?: Record; } interface RecentAutomationEvent { id: string; sessionId: string; createdAt: string; event: CanonicalAutomationEvent; } interface RecentAutomationEventsResult { events: RecentAutomationEvent[]; count: number; } type StuckGuardAction = "none" | "observe" | "inject" | "enforce"; interface StuckGuardReason { code: string; message: string; weight: number; evidence?: string; } interface StuckGuardRescuePack { marker: string; title: string; instructions: string[]; recall: { tool: "snipara_recall"; arguments: { query: string; scope: "project"; limit: number; min_relevance: number; }; }; contextQuery: { tool: "snipara_context_query"; arguments: { query: string; max_tokens: number; search_mode: "keyword"; return_references: true; auto_decompose: false; include_all_tiers: false; }; }; injectionText: string; } interface StuckGuardDecision { enabled: boolean; triggered: boolean; configuredMode: "observe" | "inject" | "enforce"; action: StuckGuardAction; score: number; reasons: StuckGuardReason[]; riskKeywords: string[]; memoryCheckedRecently: boolean; cooldownActive: boolean; eventCount: number; sessionId?: string; evaluatedAt: string; recallQuery?: string; contextQuery?: string; rescuePack?: StuckGuardRescuePack; } interface StuckGuardEvaluationResult { project: { id: string; slug: string; name: string; }; decision: StuckGuardDecision; eventsEvaluated: number; } interface EvaluateStuckGuardArgs { sessionId?: string; event?: CanonicalAutomationEvent; events?: CanonicalAutomationEvent[]; includeRecent?: boolean; limit?: number; } interface TeamSyncProjectSummary { id: string; name: string; slug: string; githubRepo?: string | null; githubBranch?: string | null; githubSyncEnabled?: boolean; githubPrAnswerPacksEnabled?: boolean; } interface TeamSyncCandidateFile { path: string; score: number; reason: string; } interface TeamSyncCandidateSymbol { qualifiedName: string; filePath: string; score: number; reason: string; } interface TeamSyncDecisionSignal { id: string; title: string; status: string; impact: string | null; updatedAt: string; summary: string; tags: string[]; recommendedAction: string; } interface TeamSyncOverlapSignal { path: string; workItemIds: string[]; workItemTitles: string[]; severity: string; } interface TeamSyncSessionCheckpoint { id: string; sessionId: string; task: string | null; source: string; filesTracked: string[]; commands: string[]; createdAt: string; expiresAt?: string | null; } interface TeamSyncSessionContext { sessionId: string | null; latestAt: string | null; files: string[]; commands: string[]; tasks: string[]; checkpoints: TeamSyncSessionCheckpoint[]; contexts: Array<{ id: string; key: string; valuePreview: string; updatedAt: string; expiresAt?: string | null; }>; runtime: { eventCount: number; latestEventAt: string | null; activeSessionCount: number; latestSessionId: string | null; clients: string[]; agents: string[]; invalidEventCount: number; eventTypes: Array<{ type: string; count: number; }>; } | null; caveats: string[]; } interface TeamSyncFreshness { index: { healthStatus: string; healthScore: number | null; coveragePercent: number | null; staleCount: number; unindexedDocuments: number; lastIndexAt: string | null; lastIndexStatus: string | null; businessContextNeedsAttention: number | null; } | null; codeGraph: { status: string | null; sourceCommitSha: string | null; sourceBranch: string | null; indexedAt: string | null; ageHours: number | null; coveragePercent: number | null; indexedCodeDocumentCount: number | null; codeDocumentCount: number | null; warningCount: number | null; errorMessage: string | null; } | null; caveats: string[]; } interface TeamSyncWorkBrief { id: string; generatedAt: string; task: string; evidenceLevel: string; summary: string; likelyFiles: TeamSyncCandidateFile[]; likelySymbols: TeamSyncCandidateSymbol[]; activeCollisions: TeamSyncOverlapSignal[]; relevantDecisions: TeamSyncDecisionSignal[]; recommendedReads: Array<{ type: string; label: string; target: string; reason: string; }>; recommendedTests: string[]; recommendedTools: Array<{ tool: string; reason: string; target?: string; }>; packageSurfaces: string[]; releaseSurfaces: string[]; sourceFacts: string[]; freshness: TeamSyncFreshness | null; sessionContext: TeamSyncSessionContext | null; recommendedActions: string[]; caveats: string[]; target: { repository: string | null; branch: string | null; baseSha: string | null; projectDefaultBranch: string | null; sessionId: string | null; client: string | null; }; } interface TeamSyncWhatChangedSummary { changeCount: number; directChanges: number; nearbyChanges: number; projectChanges: number; criticalSurfaceChanges: number; failedPacks: number; weakAuthorityChanges: number; branchFiltered: boolean; branchMatches: number; sessionSignals: number; executionSessions: number; executionEvents: number; decisionChanges: number; staleAssumptions: number; overlapClusters: number; failedJobs: number; recommendedActions: number; latestChangedAt: string | null; } interface TeamSyncWhatChangedResult { version: string; generatedAt: string; scope: { mode: string; paths: string[]; explicitPaths: string[]; recentFiles: string[]; branch: string | null; projectDefaultBranch: string | null; sessionId: string | null; since: string | null; }; summary: TeamSyncWhatChangedSummary; changes: Array<{ id: string; title: string; repository: string; pullNumber: number; sourceUrl: string | null; status: string; updatedAt: string; headSha: string; branch: string | null; relevance: string; changedFiles: string[]; matchedFiles: string[]; impactedSymbols: string[]; recommendedAction: string; }>; decisions: TeamSyncDecisionSignal[]; staleAssumptions: Array<{ id: string; severity: string; reason: string; observedAt: string | null; recommendedAction: string; }>; failedJobs: Array<{ id: string; type: string; status: string; message: string | null; updatedAt: string; sourceUrl?: string | null; recommendedAction: string; }>; freshness: TeamSyncFreshness | null; sessionContext: TeamSyncSessionContext | null; nextActions?: Array<{ id: string; label: string; source: string; severity: string; kind?: string; priority?: string; reason: string | null; }>; recommendedActions: string[]; caveats: string[]; } interface TeamSyncExecutionMemoryResult { sessions?: unknown[]; events?: unknown[]; caveats: string[]; [key: string]: unknown; } interface TeamSyncHandoff { id: string; summary: string; task: string | null; branch: string | null; baseSha: string | null; headSha: string | null; sessionId: string | null; client: string | null; files: string[]; commands: string[]; tests: string[]; blocker: string | null; assumptions: string[]; nextStep: string | null; attention: string; durable: boolean; createdAt: string; expiresAt: string | null; source: string | null; createdBy: string | null; caveats: string[]; } interface TeamSyncWorkBriefResponse { project: TeamSyncProjectSummary; brief: TeamSyncWorkBrief; whatChanged: TeamSyncWhatChangedResult; } interface TeamSyncChangesResponse { project: TeamSyncProjectSummary; limit: number; whatChanged: TeamSyncWhatChangedResult; changes: TeamSyncWhatChangedResult["changes"]; } interface TeamSyncHandoffResponse { project: TeamSyncProjectSummary; handoff: TeamSyncHandoff; } interface TeamSyncResumeResponse { project: TeamSyncProjectSummary; handoff: TeamSyncHandoff | null; match: { score: number; reasons: string[]; }; sessionContext: TeamSyncSessionContext | null; executionMemory: TeamSyncExecutionMemoryResult; recommendedActions: string[]; caveats: string[]; } type CollaborationActorType = "HUMAN" | "AGENT" | "SYSTEM"; type CollaborationResourceKind = "FILE" | "ROUTE" | "SYMBOL" | "SCHEMA" | "PACKAGE" | "DEPLOY" | "SURFACE" | "CUSTOM"; type CollaborationLeaseMode = "WATCH" | "ADVISORY" | "REQUIRES_ACK" | "EXCLUSIVE" | "HARD_BLOCK"; type CollaborationLeaseStatus = "ACTIVE" | "RELEASED" | "EXPIRED" | "OVERRIDDEN"; type CollaborationConflictSeverity = "INFO" | "WATCH" | "WARNING" | "CRITICAL"; type CollaborationGuardDecision = "CLEAR" | "WATCH" | "REVIEW_REQUIRED" | "REQUIRES_ACK" | "BLOCKED"; interface CollaborationResource { kind: CollaborationResourceKind; id: string; label?: string; sourcePath?: string; } interface CollaborationActorPayload { actorId?: string; actorType?: CollaborationActorType; actorLabel?: string; sessionId?: string; } interface CollaborationSessionSummary { id: string; actorId: string; actorType: CollaborationActorType; actorLabel?: string | null; sessionId?: string | null; swarmId?: string | null; client?: string | null; repository?: string | null; branch?: string | null; worktree?: string | null; task?: string | null; status: string; dirtyFiles?: string[]; startedAt?: string; lastHeartbeatAt?: string; heartbeatTtlSeconds?: number | null; [key: string]: unknown; } interface CollaborationLeaseSummary { id: string; workSessionId?: string | null; swarmId?: string | null; resourceKind: CollaborationResourceKind; resourceId: string; resourceLabel?: string | null; mode: CollaborationLeaseMode; status: CollaborationLeaseStatus; claimedByActorId: string; claimedByActorType: CollaborationActorType; claimedByLabel?: string | null; reason?: string | null; claimedAt?: string; heartbeatAt?: string; expiresAt?: string | null; [key: string]: unknown; } interface CollaborationConflict { code: string; decision: CollaborationGuardDecision; severity: CollaborationConflictSeverity; resource: CollaborationResource; conflictingActor: { actorId: string; actorType: CollaborationActorType; actorLabel?: string | null; sessionId?: string | null; }; reason: string; recommendedAction: string; leaseId?: string | null; workSessionId?: string | null; } interface CollaborationGuardEvaluation { decision: CollaborationGuardDecision; severity: CollaborationConflictSeverity; evaluatedAt: string; resources: CollaborationResource[]; conflicts: CollaborationConflict[]; recommendedActions: string[]; } interface CollaborationStateResponse { project: TeamSyncProjectSummary; sessions: CollaborationSessionSummary[]; leases: CollaborationLeaseSummary[]; events?: Array>; sessionSnapshots: unknown[]; leaseSnapshots: unknown[]; } interface CollaborationSessionResponse { project: TeamSyncProjectSummary; session: CollaborationSessionSummary; resources: CollaborationResource[]; } interface CollaborationLeaseResponse { project: TeamSyncProjectSummary; resources: CollaborationResource[]; leases: CollaborationLeaseSummary[]; } interface CollaborationLeaseUpdateResponse { project: TeamSyncProjectSummary; lease: CollaborationLeaseSummary; } interface CollaborationGuardResponse { project: TeamSyncProjectSummary; resources: CollaborationResource[]; evaluation: CollaborationGuardEvaluation; guardEvent: Record | null; } interface ApiKeyProjectSummary { id: string; name: string; slug: string; githubRepo?: string | null; teamName?: string | null; teamSlug?: string | null; automationClient?: string | null; } /** * Snipara API Client - Uses MCP JSON-RPC protocol */ declare class RLMClient { private config; private timeout; private cwd; constructor(timeout?: number, options?: ConfigResolutionOptions); private resolveProjectIdentifier; private dashboardApiUrl; private fetchWithApiKeyRetry; private dashboardProjectRequest; /** * Make an MCP JSON-RPC request */ private mcpCall; callTool(toolName: string, args: Record): Promise; /** * Query for optimized context using snipara_context_query */ queryContext(query: string, maxTokens?: number, options?: ContextQueryOptions): Promise; sharedContext(options?: { maxTokens?: number; categories?: string[]; includeContent?: boolean; }): Promise; codeCallers(qualifiedName: string, options?: { symbolKey?: string; depth?: number; limit?: number; }): Promise; codeImports(options: { qualifiedName?: string; symbolKey?: string; filePath?: string; direction?: "in" | "out"; includeFileNodes?: boolean; limit?: number; }): Promise; codeNeighbors(qualifiedName: string, options?: { symbolKey?: string; depth?: number; edgeKinds?: string[]; limit?: number; }): Promise; codeShortestPath(fromQualifiedName: string, toQualifiedName: string, options?: { fromSymbolKey?: string; toSymbolKey?: string; edgeKinds?: string[]; maxHops?: number; }): Promise; codeSymbolCard(options: { qualifiedName?: string; symbolKey?: string; limit?: number; }): Promise>; codeImpact(options: { qualifiedName?: string; symbolKey?: string; filePath?: string; changedFiles?: string[]; diffSummary?: string; depth?: number; direction?: "in" | "out" | "both"; edgeKinds?: string[]; limit?: number; minimumChangeMode?: MinimumChangeMode; minimumChangeEvidence?: MinimumChangeEvidence; }): Promise>; /** * Track accessed files using snipara_remember */ trackFiles(files: string[]): Promise; /** * Persist an explicit bounded checkpoint to the hosted journal. An event * acknowledgement is not a persistence receipt. */ persistSession(input?: Partial): Promise; /** * Recall memories with optional lifecycle warnings. */ recallMemories(query: string, options?: { type?: MemoryType; scope?: MemoryScope; category?: string; limit?: number; minRelevance?: number; includeInactive?: boolean; warningThreshold?: number; }): Promise; rememberMemory(args: { text: string; type?: MemoryType; scope?: MemoryScope; category?: string; ttlDays?: number; source?: string; }): Promise; /** * List stored memories with lifecycle filters. */ listMemories(options?: { type?: MemoryType; scope?: MemoryScope; category?: string; status?: MemoryStatus; search?: string; limit?: number; offset?: number; includeInactive?: boolean; }): Promise; /** * Invalidate a memory without deleting it. */ invalidateMemory(memoryId: string, reason?: string): Promise; /** * Mark an existing memory as superseded by another memory. */ supersedeMemory(oldMemoryId: string, newMemoryId: string, reason?: string): Promise; /** * Get session status (recall recent memories) */ getSession(): Promise<{ session_id: string; files_tracked: number; }>; /** * Test API connection with a lightweight MCP tool before falling back to stats. */ probeConnection(): Promise; testConnection(): Promise; emitEvent(event: { type: string; client: string; workspace: string; session_id: string; agent_id: string; timestamp: string; privacy_level: "standard" | "sensitive" | "restricted"; payload?: Record; }): Promise; recordAdvisorInfluenceReceipt(input: RecordAdvisorInfluenceReceiptInput): Promise; createProjectIntelligenceBrief(input: ProjectIntelligenceBriefRequest): Promise; captureWhy(input: WhyCaptureInput): Promise; getAutomationEvents(args?: { sessionId?: string; limit?: number; }): Promise; getAutomationConfigBundle(client: string): Promise; getAutomationSettings(): Promise; evaluateStuckGuard(args?: EvaluateStuckGuardArgs): Promise; getStuckGuardStatus(args?: { sessionId?: string; limit?: number; }): Promise; createTeamSyncWorkBrief(args: { task: string; branch?: string; baseSha?: string; sessionId?: string; client?: string; changedFiles?: string[]; recentFiles?: string[]; limit?: number; }): Promise; getTeamSyncWhatChanged(args: { limit?: number; since?: string; branch?: string; sessionId?: string; paths?: string[]; recentFiles?: string[]; }): Promise; createTeamSyncHandoff(args: { summary: string; task?: string; branch?: string; baseSha?: string; headSha?: string; sessionId?: string; client?: string; files?: string[]; commands?: string[]; tests?: string[]; blocker?: string; assumptions?: string[]; nextStep?: string; relatedLinks?: Array<{ label: string; url: string; }>; attention?: "clear" | "watch" | "review" | "proof_required"; durable?: boolean; }): Promise; getLatestTeamSyncHandoff(args?: { sessionId?: string; branch?: string; task?: string; recentFiles?: string[]; }): Promise; getCollaborationState(): Promise; startCollaborationSession(args: CollaborationActorPayload & { workSessionId?: string; swarmId?: string; client?: string; repository?: string; branch?: string; worktree?: string; task?: string; heartbeatTtlSeconds?: number; files?: string[]; dirtyFiles?: string[]; resources?: CollaborationResource[]; metadata?: Record; }): Promise; updateCollaborationSession(workSessionId: string, args: CollaborationActorPayload & { status?: "ACTIVE" | "STALE" | "COMPLETED" | "ABANDONED"; swarmId?: string; client?: string; repository?: string; branch?: string; worktree?: string; task?: string; heartbeatTtlSeconds?: number; files?: string[]; dirtyFiles?: string[]; resources?: CollaborationResource[]; metadata?: Record; }): Promise; createCollaborationLeases(args: CollaborationActorPayload & { workSessionId?: string; swarmId?: string; mode?: CollaborationLeaseMode; reason?: string; ttlSeconds?: number; files?: string[]; resources?: CollaborationResource[]; metadata?: Record; }): Promise; updateCollaborationLease(leaseId: string, args: CollaborationActorPayload & { action?: "heartbeat" | "release" | "override"; reason?: string; }): Promise; evaluateCollaborationGuard(args: CollaborationActorPayload & { workSessionId?: string; action?: string; files?: string[]; resources?: CollaborationResource[]; persist?: boolean; metadata?: Record; }): Promise; plan(query: string, maxTokens?: number): Promise>; uploadDocument(path: string, content: string, options?: UploadDocumentOptions): Promise>; listBusinessCollections(options?: ListBusinessCollectionsOptions): Promise>; ensureBusinessCollection(options: EnsureBusinessCollectionOptions): Promise>; uploadBusinessDocument(options: UploadBusinessDocumentOptions): Promise>; listClientProjects(options?: ListClientProjectsOptions): Promise>; createClientProject(options: CreateClientProjectOptions): Promise>; syncDocuments(documents: SyncDocumentInput[], deleteMissing?: boolean): Promise>; syncProjectPolicyLedger(artifacts: ProjectPolicyLedgerSyncArtifactInput[]): Promise>; diffHostedContextControl(input: { manifestHash: string; sources: HostedContextControlSource[]; }): Promise; applyHostedContextControl(input: { plan: HostedContextControlPlan; approval?: unknown; }): Promise; reindex(options: { kind?: "doc" | "code"; mode?: "incremental" | "full"; jobId?: string; }): Promise>; indexHealth(staleThresholdDays?: number): Promise>; getChunk(chunkId: string): Promise>; multiQuery(queries: Array<{ query: string; maxTokens?: number; }>, maxTokens?: number): Promise>; orchestrate(query: string, maxTokens?: number): Promise>; loadDocument(path: string): Promise>; getSessionMemories(maxCriticalTokens?: number, maxDailyTokens?: number, includeYesterday?: boolean): Promise; endOfTaskCommit(args: { summary: string; task?: string; why?: EndOfTaskCommitWhyInput; category?: string; outcome?: "completed" | "partial" | "blocked" | "abandoned"; filesTouched?: string[]; persistTypes?: string[]; handoffOnly?: boolean; }): Promise>; journalAppend(text: string, tags?: string[]): Promise; } declare function listProjectsForApiKey(apiKey: string, apiUrl?: string, timeout?: number): Promise; /** * Create a default client instance */ declare function createClient(timeout?: number, options?: ConfigResolutionOptions): RLMClient; interface CompanionWhyCaptureCandidate { text: string; type?: string; category?: string; decision?: string; rationale?: string; } interface CompanionWhyCaptureMemory { memoryId?: string; text: string; type?: string; category?: string; reviewStatus?: string; } interface CompanionWhyCaptureIssue { text: string; reason?: string; } interface CompanionWhyCaptureReceipt { status: "captured" | "no_candidates" | "skipped" | "error"; sourceKind: WhyCaptureSourceKind; previewCandidateCount: number; capturedCount: number; previewCandidates: CompanionWhyCaptureCandidate[]; pendingMemories: CompanionWhyCaptureMemory[]; duplicates: CompanionWhyCaptureIssue[]; failed: CompanionWhyCaptureIssue[]; commitSha?: string; error?: string; } interface StandaloneCommitEvidence { commitSha: string; summary: string; files: string[]; } declare function hasActiveManagedWorkflow(cwd: string): boolean; declare function readStandaloneCommitEvidence(cwd: string, commitSha: string, additionalFiles?: string[]): StandaloneCommitEvidence | undefined; declare function captureStandaloneCommitWhy(input: { cwd: string; commitSha: string; files?: string[]; }): Promise; type ContextPackKind = "tool_output" | "log" | "diff" | "file" | "text" | "note"; interface ContextPackRecord { version: "snipara.context_pack.v1"; id: string; createdAt: string; updatedAt: string; kind: ContextPackKind; label: string | null; source: string | null; tags: string[]; repoRoot: string; sha256: string; bytes: number; lineCount: number; contentType: "text/plain"; contentEncoding: "utf8"; preview: string; expiresAt: string | null; sensitive: boolean; warnings: Array<{ code: string; message: string; }>; storage: { baseRelativePath: string; manifestRelativePath: string; blobRelativePath: string; }; } interface PackContextOptions { cwd?: string; content: string; label?: string; source?: string; kind?: string; tags?: string[]; ttlDays?: number; maxBytes?: number; allowSensitive?: boolean; now?: Date; } interface ContextPackPackCommandOptions { cwd?: string; text?: string; file?: string; input?: string; label?: string; source?: string; kind?: string; tags?: string[]; ttlDays?: number; maxBytes?: number; allowSensitive?: boolean; json?: boolean; } interface ContextPackRetrieveCommandOptions { cwd?: string; output?: string; metadataOnly?: boolean; json?: boolean; } interface ContextPackStatsCommandOptions { cwd?: string; json?: boolean; } interface ContextPackCleanCommandOptions { cwd?: string; all?: boolean; expired?: boolean; olderThanDays?: number; dryRun?: boolean; json?: boolean; now?: Date; } interface ContextPackStoragePaths { repoRoot: string; baseDir: string; blobsDir: string; manifestsDir: string; latestPath: string; } interface PackContextResult { record: ContextPackRecord; created: boolean; baseDir: string; manifestPath: string; blobPath: string; } interface RetrieveContextPackResult { record: ContextPackRecord; content: string; baseDir: string; manifestPath: string; blobPath: string; } interface ContextPackStats { version: "snipara.context_pack.stats.v1"; baseDir: string; totalPacks: number; totalBytes: number; sensitivePacks: number; expiredPacks: number; kinds: Record; oldestCreatedAt: string | null; newestCreatedAt: string | null; latestId: string | null; } interface ContextPackCleanResult { version: "snipara.context_pack.clean.v1"; baseDir: string; dryRun: boolean; selected: number; deleted: number; deletedIds: string[]; } declare function getContextPackStoragePaths(cwd?: string): ContextPackStoragePaths; declare function packContext(options: PackContextOptions): PackContextResult; declare function resolveContextPackRecord(idOrRef: string, cwd?: string): { paths: ContextPackStoragePaths; record: ContextPackRecord; manifestPath: string; }; declare function retrieveContextPack(idOrRef: string, cwd?: string): RetrieveContextPackResult; declare function buildContextPackStats(options?: ContextPackStatsCommandOptions): ContextPackStats; declare function cleanContextPacks(options?: ContextPackCleanCommandOptions): ContextPackCleanResult; declare function contextPackPackCommand(options: ContextPackPackCommandOptions): Promise; declare function contextPackRetrieveCommand(idOrRef: string, options?: ContextPackRetrieveCommandOptions): Promise; declare function contextPackStatsCommand(options?: ContextPackStatsCommandOptions): Promise; declare function contextPackCleanCommand(options?: ContextPackCleanCommandOptions): Promise; type PrivacyLevel = "standard" | "sensitive" | "restricted"; type CanonicalEventType = "session_start" | "session_end" | "compact" | "message_user" | "message_assistant" | "tool_call" | "tool_result" | "file_changed" | "error_observed"; interface CanonicalEventOptions { eventType: CanonicalEventType; client?: string; workspace?: string; sessionId?: string; agentId?: string; privacyLevel?: PrivacyLevel; payload?: Record; contextPackReceipts?: LocalContextPackReceiptPayload[]; } type LocalContextPackReceiptOperation = "pack" | "retrieve" | "reference"; interface LocalContextPackReceiptPayload { version: "snipara.context_pack.receipt.v1"; receipt_id: string; pack_id: string; operation: LocalContextPackReceiptOperation; content_uploaded: false; policy_decision: "local_only" | "blocked" | "metadata_only"; privacy_level: PrivacyLevel; kind: ContextPackRecord["kind"]; label?: string | null; source?: string | null; tags: string[]; bytes: number; line_count: number; baseline_tokens?: number; packed_tokens?: number; retrieved_tokens?: number; saved_tokens?: number; payload_digest?: string; sensitive: boolean; created_at: string; expires_at?: string | null; local_ref: { base_relative_path: string; manifest_relative_path: string; }; } declare function buildLocalContextPackReceipt(record: ContextPackRecord, options?: { operation?: LocalContextPackReceiptOperation; privacyLevel?: PrivacyLevel; policyDecision?: LocalContextPackReceiptPayload["policy_decision"]; }): LocalContextPackReceiptPayload; declare function buildLocalContextPackReceipts(options: { ids: string[]; cwd?: string; operation?: LocalContextPackReceiptOperation; privacyLevel?: PrivacyLevel; }): LocalContextPackReceiptPayload[]; declare function attachLocalContextPackReceipts(payload: Record, receipts: LocalContextPackReceiptPayload[]): Record; declare function buildCanonicalEvent(options: CanonicalEventOptions): { type: CanonicalEventType; client: string; workspace: string; session_id: string; agent_id: string; timestamp: string; privacy_level: PrivacyLevel; payload: Record; }; type ToolResultClassification = "success" | "failure" | "empty_result" | "timeout"; interface ToolResultPayloadOptions { tool?: string; toolInput?: string; result?: string; exitCode?: number; status?: string; files?: string[]; hook?: string; } interface ToolCallPayloadOptions { tool?: string; toolInput?: string; query?: string | null; hook?: string; } declare function extractCommandFromToolInput(toolInput?: string): string | undefined; declare function classifyToolResult(options: { tool?: string; command?: string; result?: string; exitCode?: number; status?: string; }): ToolResultClassification; declare function buildToolCallPayload(options: ToolCallPayloadOptions): Record; declare function buildToolResultPayload(options: ToolResultPayloadOptions): Record; declare function getStuckGuardInjection(decision: StuckGuardDecision): string | null; declare function formatStuckGuardDecision(result: StuckGuardEvaluationResult): string; type MemoryGuardTrigger = "failure" | "pre-commit" | "commit" | "pre-final" | "manual"; interface ReleaseSurface { ecosystem: "npm" | "pypi"; name: string; version?: string; manifestPath: string; } interface MemoryGuardFinding { code: "recent_failure" | "release_surface" | "manual" | "destructive_intent" | "contradiction"; message: string; } declare const MEMORY_GUARD_RECALL_TIMEOUT_MS = 15000; declare const MEMORY_GUARD_CONTEXT_TIMEOUT_MS = 30000; type MemoryGuardBlockReason = "confirmation_required" | "guidance_unavailable"; interface MemoryGuardContradiction { source: "memory" | "context"; reason: string; excerpt: string; memoryId?: string; category?: string; title?: string; file?: string; } interface MemoryGuardCheckOptions { trigger?: MemoryGuardTrigger; files?: string[]; staged?: boolean; command?: string; intent?: string; result?: string; exitCode?: number; status?: string; destructive?: boolean; requireConfirmation?: boolean; confirmedByUser?: string; strict?: boolean; json?: boolean; verbose?: boolean; limit?: number; categories?: string[]; includeContext?: boolean; recentFailures?: boolean; } interface MemoryGuardConfirmation { required: boolean; confirmed: boolean; note?: string; overridesDestructive: boolean; overridesContradictions: boolean; } interface MemoryGuardCheckResult { triggered: boolean; shouldBlock: boolean; blockReason?: MemoryGuardBlockReason; exitCode: number; trigger: MemoryGuardTrigger; findings: MemoryGuardFinding[]; files: string[]; releaseSurfaces: ReleaseSurface[]; recentFailures: Array<{ createdAt: string; command?: string; classification?: string; exitCode?: number; status?: string; }>; query: string; categories: string[]; intent?: string; destructive: boolean; contradictions: MemoryGuardContradiction[]; requiresConfirmation: boolean; confirmation: MemoryGuardConfirmation; confirmationPrompt?: string; memoryAvailable: boolean; contextAvailable: boolean; memories: RecalledMemory[]; contextSections: Array<{ title: string; file: string; relevanceScore: number; preview: string; }>; warnings: string[]; } declare function normalizeGuardTag(tag: string): string; declare function categoryFromGuardTag(tag: string): string; declare function detectReleaseSurfacesFromFiles(root: string, files: string[]): ReleaseSurface[]; declare function getStagedFiles(root: string): string[]; /** * Recall and evaluate guard guidance before a risky action. * * Given a trigger (failure | pre-commit | commit | pre-final | manual) and * optional touched files (or `--staged`), it detects release surfaces and * destructive/contradictory intent, recalls tagged memory and source context, * and returns findings plus whether the caller must stop or confirm. Honors an * explicit `confirmedByUser` override so a reviewed destructive action can * proceed. Backs the strict-mode exit codes used by Git hooks. * * @returns Findings, warnings, and a decision the caller can act on. */ declare function runMemoryGuardCheck(options?: MemoryGuardCheckOptions): Promise; declare const ACTIVITY_TIMELINE_VERSION: "snipara.activity_timeline.v0"; declare const SESSION_SNAPSHOT_VERSION: "snipara.session_snapshot.v0"; type ActivityEventSource = "workflow" | "tool" | "team-sync" | "decision" | "producer-loop" | "journal" | "orchestrator"; interface ActivityTimelineEvent { schemaVersion: typeof ACTIVITY_TIMELINE_VERSION; eventId: string; timestamp: string; source: ActivityEventSource; kind: string; title: string; summary?: string; workflowId?: string; phaseId?: string; actor?: string; outcome?: string; files: string[]; refs: string[]; metadata: Record; } interface SessionSnapshot { schemaVersion: typeof SESSION_SNAPSHOT_VERSION; generatedAt: string; source: { cwd: string; timelinePath: string; snapshotPath: string; }; workflow: { id?: string; goal?: string; status?: string; currentPhaseId?: string; currentPhaseTitle?: string; } | null; activity: { totalEvents: number; latestEventAt?: string; latestEvents: ActivityTimelineEvent[]; countsBySource: Record; countsByKind: Record; }; decisions: { pendingCount: number; resolvedCount: number; recurringResolvedFingerprintCount: number; }; producerLoop: { artifactCount: number; reviewedCount: number; rejectedCount: number; unreviewedCount: number; hardGateReady: false; }; teamSync: { activeWorkCount: number; handoffCount: number; latestHandoffAt?: string; }; summary: { latestActivityAt?: string; latestActivityTitle?: string; latestActivityKind?: string; risk: "none" | "watch" | "risk"; riskReasons: string[]; touchedFiles: string[]; recommendedNextAction: string; }; intentDetection: ProjectIntentDetectionResult; routing: { hardRoutingAllowed: false; reason: string; }; performance: { buildMs: number; }; caveats: string[]; } interface AppendActivityInput { source: ActivityEventSource; kind: string; title: string; summary?: string; workflowId?: string; phaseId?: string; actor?: string; outcome?: string; files?: string[]; refs?: string[]; metadata?: Record; timestamp?: string; cwd?: string; } declare function appendActivityEvent(input: AppendActivityInput): ActivityTimelineEvent; declare function readActivityTimeline(options?: { cwd?: string; limit?: number; }): ActivityTimelineEvent[]; declare function buildSessionSnapshot(options?: { cwd?: string; limit?: number; }): SessionSnapshot; declare function writeSessionSnapshot(options?: { cwd?: string; limit?: number; }): SessionSnapshot; declare function readSessionSnapshot(cwd?: string): SessionSnapshot | null; declare function buildSmallestSafeDiffEvidence(cwd: string, changedFiles?: string[], impact?: unknown): MinimumChangeEvidenceCheck; declare function buildInstalledDependencyEvidence(cwd: string, dependencyName: string): MinimumChangeEvidenceCheck; type LocalCodeOverlayMode = "working_tree" | "local_commit"; type LocalCodeOverlayKind = "none" | "local_commit" | "working_tree" | "mixed"; interface LocalCodeOverlayOptions { cwd?: string; mode?: LocalCodeOverlayMode; commit?: string; maxFiles?: number; maxFileBytes?: number; } interface LocalCodeOverlayFile { path: string; language: "typescript" | "python" | "go"; sizeBytes: number; sha256: string; symbolCount: number; importCount: number; referenceCount: number; edgeCount: number; } interface LocalCodeOverlaySymbol { name: string; kind: "function" | "class" | "interface" | "type" | "variable" | "method"; filePath: string; line: number; endLine?: number; qualifiedName: string; localKey: string; exported?: boolean; defaultExport?: boolean; } type LocalSemanticPredicate = "public_api" | "implicit_contract" | "architecture_role" | "dependency_criticality"; interface LocalSemanticEvidence { kind: string; detail: string; filePath?: string; line?: number; edgeKind?: LocalCodeOverlayEdge["kind"]; } interface LocalSemanticAssertion { id: string; subject: string; predicate: LocalSemanticPredicate; value: string | boolean; confidence: number; scoreKind: "heuristic_prior"; calibrated: false; source: "typescript-compiler-api" | "language-parser" | "architecture-pattern-rules" | "criticality-rules" | "graph-criticality-rules"; extractorVersion: 1; evidence: LocalSemanticEvidence[]; } interface LocalSemanticModel { version: "snipara.semantic.v1"; extractorVersion: 1; source: "deterministic-graph-inference"; modelType: "rule-based-heuristic"; scoreContract: { kind: "heuristic_prior"; calibrated: false; probability: false; comparableAcrossProjects: false; basis: "hand-tuned-v1"; rulesetVersion: 1; interpretation: string; }; ruleConfig: { version: "snipara.semantic.rules.v1"; source: "defaults" | "project-file"; path: ".snipara/semantic-rules.json"; replaceDefaults: boolean; sensitivePathTermCount: number; contractPathTermCount: number; testPathTermCount: number; architectureRoleTermCount: number; configuredRoles: string[]; configHash: string; warnings: string[]; }; scope: "repository" | "impact"; assertions: LocalSemanticAssertion[]; publicContracts: LocalSemanticAssertion[]; architectureRoles: LocalSemanticAssertion[]; dependencyCriticality: LocalSemanticAssertion[]; truncation: { truncated: boolean; totalAssertionCount: number; returnedAssertionCount: number; assertionLimit: number; }; historicalRegression: { mode: "shadow"; sampleThreshold: 3; failureEventCount: 0; associations: []; riskContributionEnabled: false; suggestedRiskDelta: 0; caveat: string; }; summary: { assertionCount: number; publicContractCount: number; architectureRoleCount: number; criticalDependencyCount: number; criticalEdgeCount: number; incidentalDependencyCount: number; historicalAssociationCount: 0; }; caveats: string[]; } interface LocalCodeOverlayImportBinding { localName: string; importedName: string; kind: "named" | "default" | "namespace"; } interface LocalCodeOverlayImport { filePath: string; specifier: string; line: number; bindings?: LocalCodeOverlayImportBinding[]; } interface LocalCodeOverlayReference { filePath: string; from: string; name: string; kind: "CALLS" | "REFERENCES"; line: number; confidence: number; } interface LocalCodeOverlayEdge { from: string; to: string; kind: "IMPORTS" | "CALLS" | "REFERENCES" | "CONTAINS"; filePath: string; line: number; confidence: number; source: "typescript-compiler-api" | "language-parser" | "import-resolver"; evidence: { filePath: string; line: number; }; } interface LocalCodeOverlayWarning { code: string; severity: "info" | "warning"; message: string; [key: string]: unknown; } interface LocalCodeOverlayExcludedFile { path: string; reason: "ignored" | "unsupported_language" | "too_large" | "secret_pattern" | "read_error"; line?: number; } interface LocalCodeOverlayManifest { version: "snipara.local_code_overlay.v2"; extractorVersion: 2 | 3; generatedAt: string; indexedAt: string; repoRoot: string; repositoryId: string; branch: string | null; baseSha: string | null; localHeadSha: string | null; commit: string | null; dirtyTreeHash: string | null; overlayKind: LocalCodeOverlayKind; canonicalIndexedSha: null; currentWorkingTreeVisible: boolean; canonical: false; mode: LocalCodeOverlayMode; files: LocalCodeOverlayFile[]; symbols: LocalCodeOverlaySymbol[]; imports: LocalCodeOverlayImport[]; references: LocalCodeOverlayReference[]; edges: LocalCodeOverlayEdge[]; semantic?: LocalSemanticModel; incremental: { reusedFiles: number; parsedFiles: number; deletedFiles: number; }; excluded: { total: number; byReason: Record; samples: LocalCodeOverlayExcludedFile[]; }; warnings: LocalCodeOverlayWarning[]; } interface CodeStatusCommandOptions { dir?: string; maxFiles?: number; includeGraph?: boolean; json?: boolean; } interface CodeSyncCommandOptions extends CodeStatusCommandOptions { commit?: string; workingTree?: boolean; onlyIfHead?: string; } interface CodeUploadCommandOptions extends CodeStatusCommandOptions { cached?: boolean; ttlHours?: number; sourceClient?: string; sessionId?: string; retirePrevious?: boolean; } interface LocalCodeQueryCommandOptions extends CodeStatusCommandOptions { cached?: boolean; mode?: LocalCodeOverlayMode; commit?: string; qualifiedName?: string; symbolKey?: string; filePath?: string; changedFiles?: string[]; from?: string; to?: string; maxHops?: number; depth?: number; direction?: "in" | "out" | "both"; edgeKinds?: string[]; maxNodes?: number; transitive?: boolean; } type CodeGraphSource = "auto" | "hosted" | "local" | "hybrid"; type ResolvedCodeGraphSource = "hosted_graph" | "local_overlay" | "hybrid_graph"; type CodeGraphVerb = "callers" | "imports" | "neighbors" | "shortest-path" | "impact"; interface CodeGraphSourceSelection { requested: CodeGraphSource; selected: ResolvedCodeGraphSource; reason: string; guidance: string[]; repositoryId: string; branch: string | null; localHeadSha: string | null; baseSha: string | null; aheadCount: number | null; dirtyFileCount: number; dirtyFilesSample: string[]; localOverlay?: { indexedAt: string; overlayKind: LocalCodeOverlayKind; dirtyTreeHash: string | null; currentWorkingTreeVisible: boolean; fileCount: number; symbolCount: number; importCount: number; edgeCount: number; warnings: LocalCodeOverlayManifest["warnings"]; }; hosted?: { configured: boolean; indexFreshness?: unknown; contextScope?: unknown; error?: string; }; limitations: string[]; } interface CodeHooksInstallCommandOptions { dir?: string; maxFiles?: number; requestReindex?: boolean; reindexDelaySeconds?: number; synchronous?: boolean; dryRun?: boolean; json?: boolean; } interface CodePromoteCommandOptions extends CodeStatusCommandOptions { pushedSha?: string; indexedSha?: string; requestReindex?: boolean; fromHook?: "pre-push"; strict?: boolean; } interface LocalCodePromotionState { version: "snipara.local_code_promotion.v1"; updatedAt: string; repoRoot: string; repositoryId: string; branch: string | null; pushedSha: string | null; localHeadSha: string | null; indexedSha: string | null; overlayCachePath: string; status: "local_commit_cached" | "reindex_requested" | "reindex_skipped_unconfigured" | "reindex_failed" | "superseded_by_hosted_index"; canonical: false; hostedCanonicalVisible: boolean; reindexRequestedAt: string | null; reindexResult?: Record; warnings: LocalCodeOverlayManifest["warnings"]; } interface LocalCodeOverlaySummary { version: LocalCodeOverlayManifest["version"]; generatedAt: string; indexedAt: string; repoRoot: string; repositoryId: string; branch: string | null; baseSha: string | null; localHeadSha: string | null; commit: string | null; dirtyTreeHash: string | null; overlayKind: LocalCodeOverlayKind; canonicalIndexedSha: null; currentWorkingTreeVisible: boolean; canonical: false; mode: LocalCodeOverlayMode; counts: { files: number; symbols: number; imports: number; references: number; edges: number; semanticAssertions: number; excluded: number; }; incremental: LocalCodeOverlayManifest["incremental"]; excludedByReason: Record; fileSamples: string[]; warnings: LocalCodeOverlayManifest["warnings"]; } interface HostedCodeOverlayUploadPayload { manifest: LocalCodeOverlayManifest; cachePath: string; request: { overlay: LocalCodeOverlayManifest; source_client: string; ttl_hours: number; retire_previous: boolean; session_id?: string; }; } declare function getLocalCodeOverlayCachePath(cwd?: string): string; declare function getLocalCodePromotionStatePath(cwd?: string): string; /** * Build a local code graph overlay over the working tree or a local commit. * * Walks candidate files (working tree, or a commit when `mode` is * "local_commit"), parses supported languages into files/symbols/imports, and * records why files were excluded (ignored, unsupported language, too large, * secret pattern, read error). Honors `.sniparaignore`, per-file size and file * count caps (`maxFiles`, `maxFileBytes`), and adds warnings when limits are * hit. This overlay backs the offline impact/callers/imports queries for the * current checkout. * * @returns A `LocalCodeOverlayManifest` with files, symbols, imports, excluded * samples, and warnings. */ declare function buildLocalCodeOverlay(options?: LocalCodeOverlayOptions): LocalCodeOverlayManifest; declare function summarizeLocalCodeOverlay(manifest: LocalCodeOverlayManifest): LocalCodeOverlaySummary; declare function writeLocalCodeOverlayCache(manifest: LocalCodeOverlayManifest): string; declare function readLocalCodeOverlayCache(cwd?: string): LocalCodeOverlayManifest | null; declare function writeLocalCodePromotionState(state: LocalCodePromotionState): string; declare function readLocalCodePromotionState(cwd?: string): LocalCodePromotionState | null; declare function resolveMinimumChangeMode(value: unknown): MinimumChangeMode; declare function resolveCodeGraphMode(args: { requested: CodeGraphSource; dirtyFiles: string[]; aheadCount: number | null; hostedConfigured: boolean; fallbackHosted: boolean; }): { selected: ResolvedCodeGraphSource; reason: string; }; declare function mergeHybridCodeResults(verb: CodeGraphVerb, localResult: unknown, hostedResult: unknown, hostedError?: string): Record; declare function buildCodeStatusResult(options: CodeStatusCommandOptions): Record; declare function buildCodeSyncResult(options: CodeSyncCommandOptions): Record; declare function buildHostedCodeOverlayUploadPayload(options?: CodeUploadCommandOptions): HostedCodeOverlayUploadPayload; declare function buildLocalImportsResult(options: LocalCodeQueryCommandOptions): Record; declare function buildLocalCallersResult(options: LocalCodeQueryCommandOptions): Record; declare function buildLocalNeighborsResult(options: LocalCodeQueryCommandOptions): Record; declare function buildLocalShortestPathResult(options: LocalCodeQueryCommandOptions): Record; declare function buildLocalImpactResult(options: LocalCodeQueryCommandOptions): Record; declare function buildCodeHooksInstallPlan(options?: CodeHooksInstallCommandOptions): Record; declare function buildCodePromotionResult(options?: CodePromoteCommandOptions): Promise>; /** * Project Intelligence Judgment Card. * * Pure scoring and explanation layer for agent-facing "can I proceed?" * decisions. It intentionally consumes already-fetched surfaces instead of * adding network calls, so commands can use it in production paths without * changing hosted behavior. */ type ProjectJudgmentCanProceed = "yes" | "review" | "block"; type ProjectJudgmentState = "ready" | "watch" | "review" | "proof_required" | "blocked"; type ProjectJudgmentSeverity = "info" | "low" | "medium" | "high" | "critical"; type ProjectAdvisorRecommendationSeverity = "info" | "watch" | "risk" | "block"; type ProjectJudgmentActionType = "run_check" | "inspect" | "handoff" | "acknowledge" | "package_review" | "deploy_review" | "resolve_blocker"; interface ProjectJudgmentReason { code: string; severity: ProjectJudgmentSeverity; message: string; points: number; source: string; } interface ProjectJudgmentAction { type: ProjectJudgmentActionType; title: string; command?: string; reason?: string; severity: ProjectJudgmentSeverity; safeToAck?: boolean; } interface ProjectJudgmentEvidence { source: string; label: string; detail?: string; } interface ProjectAdvisorRecommendationCard { id: string; source: string; severity: ProjectAdvisorRecommendationSeverity; title: string; rationale?: string; reasonCodes: string[]; historicalImpactSummary?: string; reasonCodeReliability?: number; recommendedVerification: string[]; expectedBehaviorChange?: string; } interface ProjectIntelligenceJudgmentCard { version: "project-intelligence.judgment-card.v1"; generatedAt: string; task?: string; target: { branch?: string; changedFiles: string[]; }; score: number; band: "high" | "medium" | "low" | "blocked"; state: ProjectJudgmentState; canProceed: ProjectJudgmentCanProceed; summary: string; reasons: ProjectJudgmentReason[]; requiredActions: ProjectJudgmentAction[]; advisories: ProjectJudgmentAction[]; advisorRecommendations: ProjectAdvisorRecommendationCard[]; evidence: ProjectJudgmentEvidence[]; caveats: string[]; } interface BuildProjectJudgmentCardInput { task?: string; branch?: string; changedFiles?: string[]; resumeContext?: Record; memoryHealth?: Record; codeImpact?: Record; verificationPlan?: Record; guard?: Record; packageReview?: Record; advisoryObservability?: Record; advisorRecommendations?: unknown[]; teamSyncReadiness?: Record; errors?: Array<{ surface: string; message: string; }>; } declare function buildProjectJudgmentCard(input: BuildProjectJudgmentCardInput): ProjectIntelligenceJudgmentCard; declare function formatProjectJudgmentCard(card: ProjectIntelligenceJudgmentCard): string[]; interface VerifyCommandOptions { task?: string; qualifiedName?: string; symbolKey?: string; filePath?: string; changedFiles?: string[]; diffSummary?: string; limit?: number; skipImpact?: boolean; json?: boolean; } interface VerificationCheck { kind: "test" | "lint" | "type-check" | "build" | "inspection" | "command"; title: string; command?: string; file?: string; source: "code-impact" | "package-script" | "fallback"; reason?: string; } interface VerificationGap { code: string; severity: "low" | "medium" | "high"; message: string; } interface VerificationRisk { level: string; score?: number; source: "code-impact" | "fallback"; } interface VerificationPlan { version: "snipara.verification_plan.v1"; generatedAt: string; task?: string; target: { qualifiedName?: string; symbolKey?: string; filePath?: string; changedFiles: string[]; }; impactedFiles: string[]; recommendedChecks: VerificationCheck[]; risk: VerificationRisk; missingChecks: VerificationGap[]; caveats: string[]; suggestedCommands: string[]; codeImpact?: Record; codeImpactSourceSelection?: CodeGraphSourceSelection; judgmentCard?: ProjectIntelligenceJudgmentCard; errors: Array<{ surface: string; message: string; }>; } interface BuildVerificationPlanOptions extends VerifyCommandOptions { cwd?: string; codeImpact?: Record; codeImpactSourceSelection?: CodeGraphSourceSelection; errors?: Array<{ surface: string; message: string; }>; } /** * Build a transparent verification plan for the current change. * * Combines code-impact signals (direct related tests, action checks, coverage * gaps) with package scripts inferred from the impacted files, dedupes the * resulting checks, and records explicit gaps (impact unavailable/skipped, no * direct tests, no impacted files) so the plan is honest about what it can and * cannot verify. Pure: it returns a plan and never executes any check. * * @param options Changed files / file path, optional code impact, cwd, and * `skipImpact`. * @returns A plan of recommended checks plus a list of coverage gaps. */ declare function buildVerificationPlan(options: BuildVerificationPlanOptions): VerificationPlan; declare function verifyCommand(options: VerifyCommandOptions): Promise; interface ProjectIntelligenceBriefOptions { task?: string; branch?: string; changedFiles?: string[]; recentFiles?: string[]; diffSummary?: string; maxTokens?: number; skipImpact?: boolean; skipMemoryHealth?: boolean; json?: boolean; } interface ProjectIntelligenceBrief { version: "project-intelligence-brief-v1"; generatedAt: string; servedJudgmentId?: string; branch?: string; task?: string; changedFiles: string[]; recentFiles: string[]; resumeContext?: Record; memoryHealth?: Record; codeImpact?: Record; codeImpactSourceSelection?: CodeGraphSourceSelection; localSessionSnapshot?: SessionSnapshot; projectPolicyDecision?: ProjectPolicyDecision; verificationPlan?: VerificationPlan; judgmentCard?: ProjectIntelligenceJudgmentCard; errors: Array<{ surface: string; message: string; }>; suggestedCommands: string[]; } /** * Build a Project Intelligence continuity brief for the current task. * * Gathers three best-effort signals through the hosted client — resume context * (`snipara_resume_context`), memory health, and local code impact — and merges * them with the changed/recent files and a list of suggested next commands. * Each source is wrapped independently: a failure is recorded in `brief.errors` * rather than thrown, so callers always receive a usable (possibly partial) * brief. * * @param options Task, branch, changed/recent files, token budget, and skip * flags (`skipImpact`, `skipMemoryHealth`). * @returns A `project-intelligence-brief-v1` document. */ declare function buildProjectIntelligenceBrief(options: ProjectIntelligenceBriefOptions): Promise; declare function projectIntelligenceBriefCommand(options: ProjectIntelligenceBriefOptions): Promise; interface RealityCheckCommandOptions { task?: string; branch?: string; base?: string; changedFiles?: string[]; diffSummary?: string; decision?: string[]; document?: string[]; verification?: string[]; autoContext?: boolean; autoContextTimeoutMs?: number; includeDirty?: boolean; enforce?: boolean; dir?: string; json?: boolean; } interface RealityCheckAutoContextClient { queryContext(query: string, maxTokens?: number, options?: ContextQueryOptions): Promise; getTeamSyncWhatChanged(args: { limit?: number; branch?: string; paths?: string[]; recentFiles?: string[]; }): Promise; } declare function buildLocalProjectRealityCheck(options: RealityCheckCommandOptions): ProjectRealityCheckResult; declare function buildLocalProjectRealityCheckWithAutoContext(options: RealityCheckCommandOptions, clientOverride?: RealityCheckAutoContextClient): Promise; declare function realityCheckCommand(options: RealityCheckCommandOptions): Promise; interface DecisionRequestWriteResult { status: "written" | "duplicate_pending" | "duplicate_resolved"; requestId: string; fingerprint: string; path?: string; relativePath?: string; } interface ContextControlPlanCommandOptions { summary?: string; target?: string; manifest?: string; output?: string; projectId?: string; expiresAt?: string; approvalRequired?: boolean; json?: boolean; } interface ContextControlApplyCommandOptions { plan: string; allowStaleBase?: boolean; approved?: boolean; json?: boolean; } interface ContextControlHostedDiffCommandOptions { manifest?: string; output?: string; emitDecisionRequest?: boolean; json?: boolean; } interface ContextControlHostedApplyCommandOptions { plan: string; approval?: string; output?: string; json?: boolean; } interface ContextControlDriftCommandOptions { json?: boolean; } interface ContextControlValidateCommandOptions { manifest?: string; json?: boolean; } interface LocalContextMutationPlanResult { plan: ContextMutationPlan; planPath?: string; } interface LocalContextMutationApplyResult { plan: ContextMutationPlan; receipt: ContextMutationApplyReceipt; receiptPath?: string; writtenFiles: string[]; } declare function buildLocalProjectContextValidationReport(options?: ContextControlValidateCommandOptions & { cwd?: string; now?: Date; }): ProjectContextValidationReport; declare function buildLocalContextMutationPlan(options?: ContextControlPlanCommandOptions & { cwd?: string; now?: Date; }): LocalContextMutationPlanResult; declare function applyLocalContextMutationPlan(options: ContextControlApplyCommandOptions & { cwd?: string; now?: Date; }): LocalContextMutationApplyResult; declare function buildLocalProjectDriftReport(options?: ContextControlDriftCommandOptions & { cwd?: string; now?: Date; }): ProjectDriftReport; declare function contextControlPlanCommand(options: ContextControlPlanCommandOptions): Promise; declare function contextControlApplyCommand(options: ContextControlApplyCommandOptions): Promise; declare function contextControlDriftCommand(options: ContextControlDriftCommandOptions): Promise; declare function contextControlValidateCommand(options: ContextControlValidateCommandOptions): Promise; declare function contextControlHostedDiffCommand(options: ContextControlHostedDiffCommandOptions): Promise; declare function contextControlHostedApplyCommand(options: ContextControlHostedApplyCommandOptions): Promise; interface AgentContextValidateCommandOptions { manifest?: string; json?: boolean; cwd?: string; } interface AgentContextResolveCommandOptions { manifest?: string; agent: string; task: string; json?: boolean; cwd?: string; } declare function buildLocalAgentContextValidationReport(options: { cwd?: string; manifest: unknown; generatedAt?: string | Date; }): AgentContextValidationReport; declare function formatAgentContextResolution(resolution: AgentContextResolution): string; declare function agentContextValidateCommand(options?: AgentContextValidateCommandOptions): Promise; declare function agentContextResolveCommand(options: AgentContextResolveCommandOptions): Promise; declare const AGENT_CONTEXT_EVIDENCE_DEFAULT_LEDGER: string; interface AgentContextEvidenceTemplateCommandOptions { agent: string; task: string; manifest?: string; output?: string; force?: boolean; json?: boolean; cwd?: string; } interface AgentContextEvidenceCollectCommandOptions { agent: string; task?: string; workflow?: string; manifest?: string; output?: string; force?: boolean; json?: boolean; cwd?: string; } interface AgentContextEvidenceRecordCommandOptions { from: string; manifest?: string; ledger?: string; json?: boolean; cwd?: string; } interface AgentContextEvidenceStatusCommandOptions { manifest?: string; ledger?: string; enforce?: boolean; json?: boolean; cwd?: string; } declare function readAgentContextEvidenceLedger(ledgerPath: string): AgentContextEvidenceReceipt[]; declare function agentContextEvidenceTemplateCommand(options: AgentContextEvidenceTemplateCommandOptions): Promise; declare function agentContextEvidenceCollectCommand(options: AgentContextEvidenceCollectCommandOptions): Promise; declare function agentContextEvidenceRecordCommand(options: AgentContextEvidenceRecordCommandOptions): Promise; declare function agentContextEvidenceStatusCommand(options?: AgentContextEvidenceStatusCommandOptions): Promise; interface MemoryHealthCommandOptions { scope?: MemoryScope; includeInactive?: boolean; sampleLimit?: number; json?: boolean; } interface MemoryCleanCandidatesCommandOptions { scope?: MemoryScope; includeInactive?: boolean; limitPerBucket?: number; json?: boolean; } interface MemoryCompactCommandOptions { scope?: MemoryScope; deduplicate?: boolean; promoteThreshold?: number; archiveOlderThanDays?: number; json?: boolean; } interface MemoryAuditCommandOptions extends MemoryHealthCommandOptions, MemoryCleanCandidatesCommandOptions, MemoryCompactCommandOptions { } interface MemoryReviewsCommandOptions { scope?: MemoryScope; status?: string; type?: string; category?: string; search?: string; limit?: number; offset?: number; includeEvidence?: boolean; includeCleanCandidates?: boolean; includeDuplicates?: boolean; includeInactive?: boolean; minSimilarity?: number; emitDecisions?: boolean; json?: boolean; } interface MemoryAuditResult { version: "snipara.memory_audit.v1"; generatedAt: string; scope?: MemoryScope; summary?: MemoryAuditSummary; health?: Record; cleanCandidates?: Record; compactDryRun?: Record; errors: Array<{ surface: string; message: string; }>; } interface MemoryAuditSummary { totalScanned?: number; activeCount?: number; autoCompactThreshold?: number; autoCompactWouldTrigger?: boolean; cleanupCandidateCounts: Record; compactDryRunMutated?: boolean; compactDryRunPlannedActions?: number; recommendedActions: string[]; } declare function memoryHealthCommand(options: MemoryHealthCommandOptions): Promise; declare function memoryCleanCandidatesCommand(options: MemoryCleanCandidatesCommandOptions): Promise; declare function memoryReviewsCommand(options: MemoryReviewsCommandOptions): Promise; declare function memoryCompactCommand(options: MemoryCompactCommandOptions): Promise; declare function buildMemoryAudit(options: MemoryAuditCommandOptions): Promise; declare function memoryAuditCommand(options: MemoryAuditCommandOptions): Promise; type ExpectedSectionName = "context" | "decisions" | "impact" | "verification" | "continuity"; interface LocalMemoryCommandOptions { binary?: string; args?: string[]; } interface EvalExportOptions { id?: string; name?: string; description?: string; summary?: string; context?: string[]; decision?: string[]; impact?: string[]; verification?: string[]; continuity?: string[]; files?: string[]; commandRun?: string[]; output?: string; dir?: string; json?: boolean; } interface EvalRunOptions { cases: string[]; runner?: string; packageSpec?: string; json?: boolean; strict?: boolean; } interface EvalCaseArtifact { id: string; name?: string; description?: string; tags: string[]; expected: Partial>>; observed: { answer: string; filesChanged: string[]; commandsRun: string[]; artifacts: Array<{ path: string; content: string; }>; }; thresholds: { overall: number; }; } declare function buildEvalCaseArtifact(options?: EvalExportOptions): EvalCaseArtifact; declare function memoryLocalCommand(options: LocalMemoryCommandOptions): Promise; declare function evalExportCommand(options: EvalExportOptions): Promise; declare function evalRunCommand(options: EvalRunOptions): Promise; type AgentReadinessTarget = "codex" | "claude-code" | "cursor" | "orca" | "kimi" | "custom"; type AgentReadinessCheckStatus = "pass" | "warning" | "fail" | "manual"; type AgentReadinessGapSeverity = "low" | "medium" | "high" | "blocker"; type AgentReadinessScoreBand = "ready" | "mostly_ready" | "needs_hardening" | "blocked"; type AgentReadinessServiceTier = "launch_review" | "enablement_pack" | "hardening_sprint"; interface AgentReadinessAuditCommandOptions { target?: string; task?: string; changedFiles?: string[]; context?: string[]; proof?: string[]; acceptance?: string[]; risk?: string[]; dir?: string; output?: string; json?: boolean; } interface AgentReadinessWorkflowState { present: boolean; path: string; status?: string; workflowId?: string; currentPhaseId?: string; completedPhases: number; pendingPhases: number; } interface AgentReadinessTeamSyncState { present: boolean; path: string; activeWorkCount: number; handoffCount: number; latestActiveSummary?: string; latestHandoffSummary?: string; } interface AgentReadinessProjectInstructions { present: boolean; path: string; } interface AgentReadinessLocalSignals { workflow: AgentReadinessWorkflowState; teamSync: AgentReadinessTeamSyncState; projectInstructions: AgentReadinessProjectInstructions; } interface AgentReadinessCheck { id: string; title: string; status: AgentReadinessCheckStatus; severity: AgentReadinessGapSeverity; score: number; maxScore: number; evidence: string[]; action: string; } interface AgentReadinessGap { checkId: string; severity: AgentReadinessGapSeverity; message: string; action: string; } interface AgentReadinessRecommendedServicePack { id: AgentReadinessServiceTier; name: string; duration: string; fit: string; deliverables: string[]; exitCriteria: string[]; } interface AgentReadinessAuditReport { version: "snipara.agent_readiness_audit.v1"; generatedAt: string; target: { id: AgentReadinessTarget; label: string; posture: string; }; task?: string; score: { total: number; band: AgentReadinessScoreBand; max: 100; summary: string; }; checks: AgentReadinessCheck[]; gaps: AgentReadinessGap[]; explicitInputs: { changedFiles: string[]; contextRefs: string[]; proofGates: string[]; acceptanceCriteria: string[]; declaredRisks: string[]; }; localSignals: AgentReadinessLocalSignals; recommendedServicePack: AgentReadinessRecommendedServicePack; suggestedCommands: string[]; caveats: string[]; } interface BuildAgentReadinessAuditOptions extends AgentReadinessAuditCommandOptions { cwd?: string; now?: Date; localSignals?: AgentReadinessLocalSignals; } declare function collectAgentReadinessLocalSignals(rootDir?: string): AgentReadinessLocalSignals; declare function buildAgentReadinessAuditReport(options?: BuildAgentReadinessAuditOptions): AgentReadinessAuditReport; declare function formatAgentReadinessAuditReport(report: AgentReadinessAuditReport): string; declare function agentReadinessAuditCommand(options: AgentReadinessAuditCommandOptions): Promise; declare const ENGINEERING_LEAD_STATUSES: readonly ["healthy", "watch", "risk", "unknown"]; declare const ENGINEERING_LEAD_POSTURES: readonly ["lead_ready", "lead_watch", "lead_blocked", "lead_cold_start"]; declare const ENGINEERING_LEAD_WORKER_ROLES: readonly ["main_agent", "coding_worker", "test_worker", "reviewer", "documentation_worker", "human_approver"]; declare const ENGINEERING_LEAD_ROUTING_MODES: readonly ["hold", "main_agent_execute", "explicit_handoff_ready", "needs_contract"]; declare const ENGINEERING_LEAD_WORK_PACKAGE_STATUSES: readonly ["contracting", "ready_for_handoff", "executing", "verifying", "blocked", "closed", "unknown"]; declare const ENGINEERING_LEAD_SUPERVISION_STATUSES: readonly ["on_track", "needs_review", "needs_replan", "blocked", "cold_start", "unknown"]; declare const ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES: readonly ["pending_handoff", "handoff_ready", "executing", "verification_required", "blocked", "closed", "unknown"]; declare const ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES: readonly ["handoff", "claim", "approval", "proof", "outcome", "brain_update"]; declare const ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES: readonly ["declared", "provided", "verified", "rejected", "unknown"]; declare const ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES: readonly ["agent_report", "companion_handoff", "local_command", "ci", "htask", "manual", "unknown"]; type EngineeringLeadPlanSummary = ProjectIntelligenceEngineeringLeadPlanSummary; interface CompanionEngineeringLeadReconciliation { status: "on_track" | "needs_review" | "needs_replan" | "blocked"; summary: string; replanRequired: boolean; reviewRequired: boolean; changedSignals: string[]; recommendedActions: string[]; reasonCodes: string[]; } interface CompanionEngineeringLeadPlanReport { version: "snipara.companion_engineering_lead_plan.v1"; generatedAt: string; source: "local_companion_inputs" | "project_health_cockpit"; target: { id: AgentReadinessTarget; label: string; }; task?: string; engineeringLeadPlan: EngineeringLeadPlanSummary; explicitInputs: { changedFiles: string[]; contextRefs: string[]; proofGates: string[]; acceptanceCriteria: string[]; declaredRisks: string[]; }; localSignals: AgentReadinessLocalSignals; reconciliation?: CompanionEngineeringLeadReconciliation; suggestedCommands: string[]; caveats: string[]; } interface LeadPlanCommandOptions { task?: string; target?: string; changedFiles?: string[]; context?: string[]; proof?: string[]; acceptance?: string[]; risk?: string[]; fromCockpit?: string; fromPlan?: string; reconcile?: boolean; dir?: string; output?: string; json?: boolean; } interface BuildCompanionEngineeringLeadPlanOptions extends LeadPlanCommandOptions { cwd?: string; now?: Date; localSignals?: AgentReadinessLocalSignals; cockpit?: Record; } declare function buildCompanionEngineeringLeadPlanReport(options?: BuildCompanionEngineeringLeadPlanOptions): CompanionEngineeringLeadPlanReport; declare function formatCompanionEngineeringLeadPlanReport(report: CompanionEngineeringLeadPlanReport): string; declare function leadPlanCommand(options: LeadPlanCommandOptions): Promise; type ProjectPolicyGateSeverity = "advisory" | "required_action" | "block"; type ProjectPolicyGateSurface = "release" | "schema" | "auth" | "billing" | "deploy" | "package_surface" | "project_policy"; type ProjectPolicyGateSampleMode = "not_applicable" | "structural" | "explicit_contract" | "sample_gated"; interface ProjectPolicyGateSampleGate { mode: ProjectPolicyGateSampleMode; satisfied: boolean; observedSamples: number; requiredSamples: number; rationale: string; } interface ProjectPolicyGateAudit { registryVersion: "project-intelligence.policy-gates.registry.v1"; source: string; reasonCodes: string[]; humanOverrideAllowed: boolean; humanOverrideRequiresReason: boolean; } interface ProjectPolicyGateDecision { id: string; surface: ProjectPolicyGateSurface; severity: ProjectPolicyGateSeverity; title: string; rationale: string; evidence: string[]; requiredActions: string[]; suggestedCommands: string[]; sampleGate: ProjectPolicyGateSampleGate; audit: ProjectPolicyGateAudit; } interface ProjectPolicyGatesSummary { advisory: number; requiredAction: number; block: number; strongestSeverity: ProjectPolicyGateSeverity; affectedSurfaces: ProjectPolicyGateSurface[]; } interface ProjectPolicyGatesResult { version: "project-intelligence.policy-gates.v1"; generatedAt: string; registryVersion: "project-intelligence.policy-gates.registry.v1"; release: boolean; summary: ProjectPolicyGatesSummary; gates: ProjectPolicyGateDecision[]; projectPolicyDecision?: ProjectPolicyDecision; suggestedCommands: string[]; } interface EvaluateProjectPolicyGatesInput { task?: string; release?: boolean; changedFiles?: string[]; diffSummary?: string; skipGuard?: boolean; skipPackageReview?: boolean; guard?: { status?: number | null; payload?: Record; error?: string; stderr?: string; }; packageReview?: { status?: string; error?: string; command?: string; }; judgmentCard?: ProjectIntelligenceJudgmentCard; projectPolicy?: { rules?: ProjectPolicyRule[]; decision?: ProjectPolicyDecision; }; } declare function evaluateProjectPolicyGates(input: EvaluateProjectPolicyGatesInput): ProjectPolicyGatesResult; declare function formatPolicyGateDecision(gateDecision: ProjectPolicyGateDecision): string[]; interface ProjectRunCommandOptions { task?: string; branch?: string; changedFiles?: string[]; recentFiles?: string[]; diffSummary?: string; maxTokens?: number; release?: boolean; skipImpact?: boolean; skipMemoryHealth?: boolean; skipGuard?: boolean; skipPackageReview?: boolean; servedJudgmentId?: string; skipAdvisorReceipts?: boolean; advisorPlanBefore?: string; advisorPlanAfter?: string; advisorRecommendationId?: string; advisorDecision?: AdvisorInfluenceAgentDecision; advisorReceiptScope?: "all" | "selected"; advisorReceiptSource?: string; advisorReceiptTrigger?: string; outcomeReceiptFiles?: string[]; emitPolicyDecisions?: boolean; json?: boolean; } interface ProjectRunGuardResult { command: string; status: number | null; stdout: string; stderr: string; payload?: Record; error?: string; } interface ProjectRunPackageReview { command: string; status: "skipped" | "ok" | "error"; packageName: "snipara-companion"; data?: unknown; error?: string; } interface ProjectRunAdvisorReceiptWrite { advisorRecommendationId: string; status: "recorded" | "skipped" | "error"; agentDecision?: AdvisorInfluenceAgentDecision; changedBecauseOfRecommendation?: boolean; lifecycleState?: AdvisorInfluenceLifecycleState; measurementState?: ProjectRunAdvisorMeasurementState; targeted?: boolean; result?: RecordAdvisorInfluenceReceiptResult; reason?: ProjectRunAdvisorReceiptSkipReason; error?: string; } type ProjectRunAdvisorMeasurementState = "unmeasured" | "acknowledged_unscoped" | "acknowledged" | "applied" | "verified" | "blocked"; interface ProjectRunAdvisorMeasurementCoverage { version: "project-intelligence.advisor-measurement-coverage.v1"; identityStatus: "linked" | "missing"; recommendationCount: number; recordedCount: number; targetedCount: number; unscopedCount: number; acknowledgedCount: number; appliedCount: number; verifiedCount: number; blockedCount: number; unmeasuredCount: number; receiptCoverage: number | null; } type ProjectRunAdvisorReceiptSkipReason = "explicitly_skipped" | "no_advisor_recommendations" | "missing_served_judgment_id" | "no_plan_adaptation" | "write_limit_exceeded"; interface ProjectRunAdvisorReceiptCapture { status: "skipped" | "recorded" | "partial" | "error"; servedJudgmentId?: string; totalRecommendationCount: number; eligibleCount: number; attemptedCount: number; recordedCount: number; skippedCount: number; writes: ProjectRunAdvisorReceiptWrite[]; measurement: ProjectRunAdvisorMeasurementCoverage; reason?: ProjectRunAdvisorReceiptSkipReason; } interface ProjectRunHostedJudgmentLink { version: "project-intelligence.hosted-judgment-link.v1"; status: "linked" | "unlinked" | "unavailable"; timeoutMs: number; servedJudgmentId?: string; judgmentSnapshotId?: string; judgmentExposureId?: string; error?: string; } interface ProjectIntelligenceRunResult { version: "project-intelligence.production-run.v1"; generatedAt: string; runEnvelope: ProjectIntelligenceRunEnvelope; release: boolean; brief: ProjectIntelligenceBrief; hostedJudgment: ProjectRunHostedJudgmentLink; guard?: ProjectRunGuardResult; packageReview?: ProjectRunPackageReview; policyGates: ProjectPolicyGatesResult; policyDecisionRequests?: ProjectRunPolicyDecisionRequests; advisorReceiptCapture?: ProjectRunAdvisorReceiptCapture; outcomeCalibration?: OutcomeIntelligenceCalibration; judgmentCard: ProjectIntelligenceJudgmentCard; suggestedCommands: string[]; } interface ProjectIntelligenceRunEnvelope { version: "project-intelligence.judgment-run-envelope.v1"; runId: string; identitySource: "snipara_session" | "codex_session" | "generated"; startedAt: string; } interface ProjectRunPolicyDecisionRequests { version: "project-intelligence.policy-decision-requests.v1"; emitted: boolean; requestCount: number; requests: DecisionRequest[]; writes: DecisionRequestWriteResult[]; caveats: string[]; } declare function buildProjectIntelligenceRun(options: ProjectRunCommandOptions): Promise; declare function projectIntelligenceRunCommand(options: ProjectRunCommandOptions): Promise; declare const WHY_OUTCOME_CAPTURE_VERSION: "snipara.why_outcome_capture.v1"; type WhyOutcomeCaptureEventKind = "commit" | "pull_request" | "phase_commit" | "handoff" | "final_commit" | "guard_decision" | "test_result" | "deploy_health" | "review_result" | "feedback"; type WhyOutcomeCandidateKind = "decision" | "outcome"; type WhyOutcomeCandidateOutcomeStatus = "positive" | "negative" | "blocked" | "neutral" | "unknown"; interface WhyOutcomeCaptureEvent { kind?: WhyOutcomeCaptureEventKind | string; event?: WhyOutcomeCaptureEventKind | string; summary?: string; reason?: string | string[]; outcome?: string; status?: string; feedback?: string; sourceRef?: string; actor?: string; files?: string[]; evidence?: string[]; commands?: string[]; reviewResult?: string; observedAt?: string; metadata?: Record; } interface WhyOutcomeCaptureCandidate { id: string; kind: WhyOutcomeCandidateKind; reviewStatus: "review_pending"; authorityStatus: "candidate"; content: string; confidence: number; source: { kind: WhyOutcomeCaptureEventKind; ref: string | null; actor: string | null; observedAt: string; }; outcome?: { status: WhyOutcomeCandidateOutcomeStatus; label: string; }; provenance: { files: string[]; evidence: string[]; commands: string[]; reasonCodes: string[]; dedupeKey: string; }; redaction: { redacted: boolean; patterns: string[]; }; } interface WhyOutcomeCaptureReport { version: typeof WHY_OUTCOME_CAPTURE_VERSION; generatedAt: string; reviewStatus: "review_pending"; eventCount: number; candidateCount: number; skippedDuplicateCount: number; candidates: WhyOutcomeCaptureCandidate[]; caveats: string[]; } interface WhyOutcomeCaptureOptions { events: WhyOutcomeCaptureEvent[]; now?: Date; maxCandidates?: number; } interface OutcomeCapturePreviewCommandOptions { fromFile?: string; fromWorkflow?: string | boolean; event?: string; summary?: string; outcome?: string; status?: string; sourceRef?: string; actor?: string; files?: string[]; evidence?: string[]; command?: string[]; reason?: string[]; feedback?: string; maxCandidates?: string; emitDecisions?: boolean; emitOutcomeReceipt?: boolean; taskKind?: string; risk?: string; surface?: string[]; workflowFingerprint?: string; sessionId?: string; dir?: string; json?: boolean; } declare function buildWhyOutcomeCaptureReport(options: WhyOutcomeCaptureOptions): WhyOutcomeCaptureReport; declare function outcomeCapturePreviewCommand(options: OutcomeCapturePreviewCommandOptions): Promise; declare const CODING_INTELLIGENCE_LEDGER_VERSION: "snipara.coding_intelligence_ledger.v0"; type CodingLedgerSectionName = "served_context" | "plans" | "diffs" | "tests" | "ci" | "reviews" | "outcomes" | "influence_receipts"; type CodingLedgerConfidenceBand = "high" | "medium" | "low" | "unknown"; interface CodingLedgerEvidenceItem { id: string; kind: CodingLedgerSectionName; title?: string; summary: string; sourceRef?: string; status?: string; confidence?: number; reasonCodes: string[]; files: string[]; commands: string[]; observedAt?: string; } interface CodingLedgerPrompt { task?: string; prompt?: string; sourceRef?: string; } interface CodingLedgerRepoState { branch?: string; commit?: string; dirty?: boolean; stagedFileCount?: number; unstagedFileCount?: number; changedFiles: string[]; recentFiles: string[]; diffSummary?: string; } interface CodingLedgerConfidence { score?: number; band: CodingLedgerConfidenceBand; rationale?: string; } interface CodingLedgerCalibrationMetadata { sampleSize?: number; reliability?: number; status?: string; notes: string[]; caveats: string[]; } interface CodingLedgerRedactionSummary { redacted: boolean; redactedValueCount: number; patterns: string[]; } interface CodingIntelligenceLedger { version: typeof CODING_INTELLIGENCE_LEDGER_VERSION; generatedAt: string; portability: { format: "json"; schema: typeof CODING_INTELLIGENCE_LEDGER_VERSION; generatedBy: "snipara-companion"; contentModel: "structured_redacted_ledger"; }; prompt: CodingLedgerPrompt; repoState: CodingLedgerRepoState; servedContext: CodingLedgerEvidenceItem[]; plans: CodingLedgerEvidenceItem[]; diffs: CodingLedgerEvidenceItem[]; tests: CodingLedgerEvidenceItem[]; ci: CodingLedgerEvidenceItem[]; reviews: CodingLedgerEvidenceItem[]; outcomes: CodingLedgerEvidenceItem[]; influenceReceipts: CodingLedgerEvidenceItem[]; reasonCodes: string[]; confidence: CodingLedgerConfidence; calibrationMetadata: CodingLedgerCalibrationMetadata; redaction: CodingLedgerRedactionSummary; caveats: string[]; } interface CodingLedgerBuildOptions { input?: unknown; fromFile?: string; dir?: string; now?: Date; task?: string; prompt?: string; sourceRef?: string; branch?: string; commit?: string; changedFiles?: string[]; recentFiles?: string[]; diffSummary?: string; servedContext?: string[]; plan?: string[]; diff?: string[]; test?: string[]; ci?: string[]; review?: string[]; outcome?: string[]; influenceReceipt?: string[]; reasonCode?: string[]; confidence?: string; calibration?: string[]; } interface CodingLedgerExportCommandOptions extends CodingLedgerBuildOptions { output?: string; json?: boolean; } declare function buildCodingIntelligenceLedger(options?: CodingLedgerBuildOptions): CodingIntelligenceLedger; declare function codingLedgerExportCommand(options: CodingLedgerExportCommandOptions): Promise; declare const COLLABORATION_STATE_RELATIVE_PATH: string; type CollaborationGuardProfile = "edit" | "pre-commit" | "pre-push" | "pre-deploy" | "migration" | "schema" | "release-package"; type CollaborationGuardActionKind = "safe_to_ack" | "needs_handoff" | "needs_test" | "needs_package_review" | "blocking_conflict" | "guard_unavailable"; interface CollaborationGuardActionCard { kind: CollaborationGuardActionKind; title: string; reason: string; severity: "info" | "watch" | "warning" | "critical"; safeToAck: boolean; command?: string; conflictCode?: string; resource?: string; } interface HostedAttempt$1 { status: "skipped" | "ok" | "error"; data?: T; error?: string; } interface WorkflowCollaborationReceipt { workSessionId?: string; hostedSessionStatus: HostedAttempt$1["status"]; hostedClaimStatus?: HostedAttempt$1["status"]; hostedReleaseStatus?: HostedAttempt$1>["status"]; hostedError?: string; files: string[]; resourceCount: number; leaseCount: number; statePath: string; recordedAt: string; } interface CollaborationCommandOptions { summary?: string; files?: string[]; resources?: string[]; actor?: string; actorId?: string; actorType?: string; sessionId?: string; workSessionId?: string; swarmId?: string; client?: string; repository?: string; branch?: string; worktree?: string; action?: string; profile?: string; mode?: string; reason?: string; ttlSeconds?: string; heartbeatTtlSeconds?: string; intervalSeconds?: string; maxFiles?: string; leaseId?: string; all?: boolean; once?: boolean; autoClaim?: boolean; releaseStale?: boolean; persist?: boolean; enforce?: boolean; ackReviewOnly?: boolean; dir?: string; json?: boolean; verbose?: boolean; } interface CollaborationHooksInstallOptions { dir?: string; dryRun?: boolean; json?: boolean; } interface CollaborationLocalLeaseRecord { id: string; mode: CollaborationLeaseMode; status: CollaborationLeaseStatus; resources: CollaborationResource[]; reason?: string; claimedAt?: string; expiresAt?: string | null; workSessionId?: string; } interface CollaborationReviewOnlyAcknowledgement { profile: CollaborationGuardProfile; action: string; findingFingerprint: string; acknowledgedAt: string; expiresAt: string; } interface CollaborationLocalState { schemaVersion: "snipara.collaboration.v1"; updatedAt: string; workSessionId?: string; sessionId?: string; actorId?: string; actorType?: CollaborationActorType; actorLabel?: string; client?: string; repository?: string; branch?: string; worktree?: string; task?: string; files: string[]; resources: CollaborationResource[]; leases: CollaborationLocalLeaseRecord[]; reviewOnlyAcknowledgements: CollaborationReviewOnlyAcknowledgement[]; lastGuard?: { decision: CollaborationGuardDecision; severity: string; checkedAt: string; action: string; resources: CollaborationResource[]; conflictCount: number; }; } interface ResolvedCollaborationContext { rootDir: string; config: RLMConfig; actor: Required> & { sessionId?: string; }; client: string; branch?: string; repository?: string; worktree?: string; } declare function createEmptyCollaborationState(now?: Date): CollaborationLocalState; declare function getCollaborationStatePath(rootDir?: string): string; declare function loadCollaborationState(rootDir?: string): CollaborationLocalState; declare function saveCollaborationState(state: CollaborationLocalState, rootDir?: string): void; declare function buildCollaborationActor(options: Pick, config: RLMConfig): ResolvedCollaborationContext["actor"]; declare function normalizeCollaborationFiles(files: string[] | undefined): string[]; declare function parseCollaborationResources(values: string[] | undefined): CollaborationResource[]; declare function deriveLocalCollaborationResourcesFromFiles(files: string[] | undefined, rootDir?: string, maxFiles?: number): CollaborationResource[]; declare function buildCollaborationHooksInstallPlan(options?: CollaborationHooksInstallOptions): Record; declare function collaborationIdeStatusCommand(options: CollaborationCommandOptions): Promise; declare function buildCollaborationGuardActionCards(evaluation: CollaborationGuardEvaluation | undefined, context?: { profile?: string; enforced?: boolean; ackReviewOnly?: boolean; reviewOnlyAcknowledged?: boolean; }): CollaborationGuardActionCard[]; interface HostedGuardPayload { files: string[]; resources: CollaborationResource[]; fileCount: number; resourceCount: number; filesTruncated: boolean; resourcesTruncated: boolean; } declare function buildHostedGuardPayload(files: string[], resources: CollaborationResource[]): HostedGuardPayload; declare function compactHostedGuardResources(resources: CollaborationResource[]): CollaborationResource[]; declare function shouldFailCollaborationGuard(input: { hostedStatus: HostedAttempt$1["status"]; evaluation: CollaborationGuardEvaluation | undefined; enforce: boolean; ackReviewOnly: boolean; }): boolean; type RuntimeEnvironment = Record; type ProviderKeySource = "environment" | "env-file"; type OrchestratorRecommendationLevel = "suggest" | "confirm" | "auto"; type OrchestratorRecommendationReason = "workflow_mode_orchestrate" | "production_validation_intent" | "proof_gate_intent" | "htask_or_swarm_intent" | "multi_agent_intent" | "parallel_worker_intent" | "changed_files_threshold" | "team_sync_collision" | "policy_auto_route"; interface OrchestratorRecommendation { level: OrchestratorRecommendationLevel; reasons: OrchestratorRecommendationReason[]; score: number; orchestratorRequired: boolean; policySource?: string; } interface OrchestratorRecommendationOptions { changedFilesCount?: number; hasActiveCollisions?: boolean; policyAutoRoute?: boolean; policySource?: string; adaptiveRoutingDryRun?: boolean; } interface RuntimeDetectionReport { cwd: string; workspaceRoot: string | null; companion: { configured: boolean; configPath: string; }; runtime: { cliAvailable: boolean; command?: string; legacyCommand?: boolean; version?: string; cliVersion?: string; installedPackageVersion?: string; versionMismatch?: boolean; mcpConfigured: boolean; mcpConfigPaths: string[]; }; orchestrator: { cliAvailable: boolean; command?: string; version?: string; source?: "path" | "workspace_venv"; workspacePackageVersion?: string; versionMismatch?: boolean; }; providerKeys: { openai: boolean; anthropic: boolean; any: boolean; sources: { openai?: ProviderKeySource; anthropic?: ProviderKeySource; }; envFilesLoaded: string[]; }; docker: { available: boolean; }; } declare function detectRuntimeEnvironment(cwd?: string, env?: RuntimeEnvironment): RuntimeDetectionReport; declare function shouldSuggestRuntimeForWorkflow(query: string, mode: WorkflowMode): boolean; /** * Recommend whether work should be routed to snipara-orchestrator. * * Scores intent signals from the query and workflow mode (orchestrate mode, * production / proof / htask / multi-agent / parallel patterns) plus contextual * signals (changed-file count, active Team Sync collisions, policy auto-route). * The returned recommendation's level escalates with the accumulated score * (suggest → confirm → auto). * * @returns A recommendation with its reasons, or `null` when no signal fires. */ declare function getOrchestratorRecommendation(query: string, mode: WorkflowMode, options?: OrchestratorRecommendationOptions): OrchestratorRecommendation | null; declare function formatOrchestratorRecommendationReason(reason: OrchestratorRecommendationReason): string; declare function shouldSuggestOrchestratorForWorkflow(query: string, mode: WorkflowMode): boolean; declare const ORCHESTRATOR_HANDOFF_RELATIVE_PATH: string; interface OrchestratorHandoffWorkflowPhase { id: string; title: string; query: string; status: string; acceptance?: string; files: string[]; gates: string[]; needsRuntime: boolean; } interface OrchestratorHandoffRuntimeSandboxPhase { phaseId: string; title: string; bootstrapQuery: string; files: string[]; artifacts: string[]; contextPacks: string[]; sessionId: string | null; environment: string | null; profile: string | null; hasCheckpoint: boolean; checkpointSummary: string | null; checkpointCapturedAt: string | null; } interface AdaptiveWorkProfile { taskType: string; risk: string; scope: string[]; contextBudget: string; reasoningDepth: string; evidenceRequirements?: string[]; preferredProfileStrengths?: string[]; notes?: string[]; } interface AdaptiveModelRequirements { workerRole: string; reasoning: string; plannerRetainsReasoning: boolean; speed: string; cost: string; contextBudget: string; capabilities: string[]; forbiddenCapabilities: string[]; writeScope: string[]; structuredOutputRequired?: boolean; preferredEndpointTypes?: string[]; allowedEndpointTypes?: string[]; catalogLimit?: number; dailyBudgetCents?: number; monthlyBudgetCents?: number; fallback: "main_agent"; } interface AdaptiveRoutingCostEstimate { currency: "USD"; confidence: "low" | "medium" | "high"; } interface AdaptiveRoutingCard { mode: "dry_run"; workProfile: AdaptiveWorkProfile; requirements: AdaptiveModelRequirements; recommendedWorkerClass: string; costEstimate: AdaptiveRoutingCostEstimate; humanApprovalRequired: boolean; fallback: "main_agent"; rejectedReasons?: Record; reasons: string[]; warnings: string[]; } interface AdaptiveRoutingGatewayStatus { source: "hosted_mcp" | "local_orchestrator"; success: boolean; resolutionStatus?: string; candidateCount: number; fallback?: string; warnings: string[]; } interface AdaptiveRoutingRuntimeCatalog { version?: string; source?: string; provider?: string; baseUrl?: string; models?: string[]; apiPaths?: Record; workerEndpoints?: Record>; workerProfiles?: Record>; candidates: Array>; } interface AdaptiveRoutingResolution { status?: string; selected?: Record; policyDecision?: Record; evaluatedCount?: number; rejectedCount?: number; fallback?: string; reasons?: string[]; warnings?: string[]; rejectedReasons?: Record; } interface AdaptiveStrongRepairContract { enabled: boolean; maxAttempts: 1; finalAuthority: "strong_adapter"; proofRequired: true; scopePreserved: true; fallback: "main_agent"; } interface AdaptiveWorkRoutingRecommendation { workProfile: AdaptiveWorkProfile; requirements: AdaptiveModelRequirements; routingCard: AdaptiveRoutingCard; gateway?: AdaptiveRoutingGatewayStatus; runtimeCatalog?: AdaptiveRoutingRuntimeCatalog; resolution?: AdaptiveRoutingResolution; strongRepair?: AdaptiveStrongRepairContract; } interface AdaptiveWorkRoutingOptions { query: string; mode?: string; changedFiles?: string[]; preferredEndpointTypes?: string[]; allowedEndpointTypes?: string[]; workerRole?: string; plannerRetainsReasoning?: boolean; preferredProfileStrengths?: string[]; structuredOutputRequired?: boolean; catalogLimit?: number; dailyBudgetCents?: number; monthlyBudgetCents?: number; strongRepair?: boolean; } interface OrchestratorHandoffArtifact { schemaVersion: "snipara.orchestrator.handoff.v1"; source: { client: "snipara-companion"; command: string; generatedAt: string; }; workflow: { mode: string; workflowId: string | null; currentPhaseId: string | null; phases: OrchestratorHandoffWorkflowPhase[]; }; runtime: { sandbox: { provider: "snipara-sandbox"; phases: OrchestratorHandoffRuntimeSandboxPhase[]; } | null; }; routing: { level: OrchestratorRecommendation["level"]; reasons: OrchestratorRecommendation["reasons"]; policySource: string | null; workProfile?: AdaptiveWorkProfile; requirements?: AdaptiveModelRequirements; routingCard?: AdaptiveRoutingCard; gateway?: AdaptiveRoutingGatewayStatus; runtimeCatalog?: AdaptiveRoutingRuntimeCatalog; resolution?: AdaptiveRoutingResolution; strongRepair?: AdaptiveStrongRepairContract; }; task: { title: string; query: string; summary: string; }; repo: { root: string; branch: string | null; headSha: string | null; changedFiles: string[]; }; coordination: { swarmId: string | null; claimScope: { files: string[]; symbols: string[]; }; htask: { featureTitle: string | null; workstreams: string[]; }; }; validation: { requiresProofGate: boolean; requiresDriftCheck: boolean; liveChecks: string[]; requiredEvidence: Array<{ type: string; description: string; }>; }; memory: { decisionIds: string[]; contextRefs: string[]; resumeSummary: string | null; }; } interface OrchestratorHandoffOptions { sourceCommand: string; recommendation: OrchestratorRecommendation; query: string; summary: string; title?: string; mode?: string; rootDir?: string; changedFiles?: string[]; contextRefs?: string[]; decisionIds?: string[]; resumeSummary?: string; featureTitle?: string; workstreams?: string[]; adaptiveRouting?: AdaptiveWorkRoutingRecommendation | null; } interface WrittenOrchestratorHandoff { handoff: OrchestratorHandoffArtifact; path: string; relativePath: string; command: string; } declare function buildOrchestratorHandoff(options: OrchestratorHandoffOptions): OrchestratorHandoffArtifact; declare function buildAdaptiveWorkRoutingRecommendation(options: AdaptiveWorkRoutingOptions): AdaptiveWorkRoutingRecommendation; declare function writeOrchestratorHandoff(options: OrchestratorHandoffOptions): WrittenOrchestratorHandoff; interface JournalCheckpointPayload { action: string; summary: string; outcome?: string; workflowId?: string; phaseId?: string; phaseTitle?: string; branch?: string; actor?: string; next?: string; attention?: string; files?: string[]; cwd?: string; } declare function buildJournalCheckpointEntry(payload: JournalCheckpointPayload): { text: string; tags: string[]; }; declare const TEAM_SYNC_STATE_RELATIVE_PATH: string; type TeamSyncAttention = "note" | "watch" | "review" | "proof"; type TeamSyncWorkStatus = "active" | "completed" | "archived"; interface TeamSyncRecordInput { summary: string; files?: string[]; branch?: string; actor?: string; next?: string; attention?: string; risk?: string; now?: Date; } interface TeamSyncWorkRecord { id: string; type: "work"; summary: string; files: string[]; branch?: string; actor?: string; status: TeamSyncWorkStatus; createdAt: string; updatedAt: string; completedAt?: string; completionReason?: string; archivedAt?: string; archiveReason?: string; } interface TeamSyncHandoffRecord { id: string; type: "handoff"; summary: string; files: string[]; next?: string; attention?: TeamSyncAttention; actor?: string; createdAt: string; } interface TeamSyncState { schemaVersion: "snipara.team-sync.v1"; updatedAt: string; work: TeamSyncWorkRecord[]; handoffs: TeamSyncHandoffRecord[]; } interface TeamSyncSummary { activeWorkCount: number; staleWorkCount: number; completedWorkCount: number; archivedWorkCount: number; handoffCount: number; files: string[]; staleWorkExplanation: TeamSyncStaleWorkExplanation; hygieneActions: TeamSyncHygieneAction[]; latestActiveWork?: TeamSyncWorkRecord; latestStaleWork?: TeamSyncWorkRecord; latestCompletedWork?: TeamSyncWorkRecord; latestArchivedWork?: TeamSyncWorkRecord; latestHandoff?: TeamSyncHandoffRecord; } interface TeamSyncStaleWorkExplanation { staleAfterHours: number; autoArchiveAfterDays: number; activeStaleCount: number; autoArchivableCount: number; completedIgnoredCount: number; archivedIgnoredCount: number; latestStaleWorkAgeHours?: number; message: string; } interface TeamSyncHygieneAction { kind: "sweep-preview" | "sweep-archive" | "complete-work" | "handoff"; command: string; reason: string; mutates: boolean; } interface TeamSyncCommandOptions { id?: string; summary?: string; files?: string[]; branch?: string; actor?: string; next?: string; attention?: string; risk?: string; adapterPack?: boolean; adapterTarget?: string; context?: string[]; proof?: string[]; acceptance?: string[]; conflictPosture?: string; since?: string; dir?: string; includeSessionContext?: boolean; emitOrchestratorHandoff?: boolean; autoRouteOrchestrator?: boolean; orchestratorPolicySource?: string; output?: string; days?: string; dryRun?: boolean; json?: boolean; } interface HostedAttempt { status: "skipped" | "ok" | "error"; data?: T; error?: string; } interface TeamSyncSweepResult { action: "sweep"; statePath: string; dryRun: boolean; thresholdDays: number; thresholdMs: number; archivedCount: number; archivedWork: TeamSyncWorkRecord[]; explanation: TeamSyncSweepExplanation; summary: TeamSyncSummary; } interface TeamSyncSweepExplanation { mode: "preview" | "archive"; candidateCount: number; archivedCount: number; remainingStaleCount: number; message: string; } type AgenticHandoffAdapterTarget = "codex" | "claude-code" | "cursor" | "orca" | "kimi" | "custom"; type AgenticHandoffConflictPosture = "continue" | "wait" | "split_work" | "review_only" | "handoff"; interface AgenticHandoffAdapterPack { version: "snipara.ade_adapter_pack.v1"; target: { id: AgenticHandoffAdapterTarget; label: string; profile: string; instruction: string; runtimeControl: "handoff_only"; }; contextPack: { summary: string; files: string[]; contextRefs: string[]; workflow?: { goal?: string; status?: string; currentPhaseId?: string; currentPhaseTitle?: string; }; resumeCommands: string[]; constraints: string[]; }; conflictPosture: AgenticHandoffConflictPosture; proofGates: string[]; acceptanceCriteria: string[]; receiptExpectation: { required: boolean; command: string; requiredFields: string[]; }; prompt: string; caveats: string[]; } interface TeamSyncCompletionEvidenceOptions { summary?: string; workflowGoal?: string; files?: string[]; reason?: string; now?: Date; dryRun?: boolean; } interface AgenticHandoffArtifact { version: "snipara.agentic_handoff.v1"; generatedAt: string; command: "snipara-companion handoff"; record: TeamSyncHandoffRecord; statePath: string; hosted: { status: HostedAttempt["status"]; handoffId?: string; error?: string; }; sections: { whatChanged: string[]; verified: string[]; risky: string[]; remains: string[]; whereToResume: string[]; }; suggestedCommands: string[]; adapter?: AgenticHandoffAdapterPack; } declare function buildTeamSyncStartWorkRecord(input: TeamSyncRecordInput): TeamSyncWorkRecord; declare function buildTeamSyncHandoffRecord(input: TeamSyncRecordInput): TeamSyncHandoffRecord; declare function createEmptyTeamSyncState(now?: Date): TeamSyncState; declare function buildTeamSyncSummary(state: TeamSyncState, since?: Date, now?: Date): TeamSyncSummary; declare function archiveInactiveTeamSyncWork(state: TeamSyncState, options?: { now?: Date; thresholdMs?: number; dryRun?: boolean; }): TeamSyncSweepResult["archivedWork"]; declare function completeTeamSyncWorkFromEvidence(state: TeamSyncState, options?: TeamSyncCompletionEvidenceOptions): TeamSyncWorkRecord[]; declare function completeTeamSyncStateFromEvidence(rootDir?: string, options?: TeamSyncCompletionEvidenceOptions): TeamSyncWorkRecord[]; declare function autoArchiveTeamSyncState(rootDir?: string, now?: Date): TeamSyncSweepResult["archivedWork"]; declare function loadTeamSyncState(rootDir?: string): TeamSyncState; declare function saveTeamSyncState(state: TeamSyncState, rootDir?: string): void; declare function getTeamSyncStatePath(rootDir?: string): string; declare function buildAgenticHandoffMarkdown(artifact: AgenticHandoffArtifact): string; declare function teamSyncSweepCommand(options: TeamSyncCommandOptions): Promise; declare const FINAL_COMMIT_REPORT_VERSION: "snipara.final_commit_report.v1"; declare const FINAL_COMMIT_REPORT_RELATIVE_PATH: string; type FinalCommitOutcome = "completed" | "partial" | "blocked" | "abandoned"; type FinalCommitEvidenceStatus = "passed" | "failed" | "not_run" | "unknown"; interface FinalCommitMemoryItem { memoryId?: string; text: string; type?: string; category?: string; reason?: string; reviewStatus?: string; source: "phase_commit" | "why_capture"; phaseId?: string; } interface WorkflowPhaseCommitReceipt { phaseId: string; capturedAt: string; category: string; outcome: FinalCommitOutcome; hostedStatus: "processed" | "local_fallback"; stored: FinalCommitMemoryItem[]; skipped: FinalCommitMemoryItem[]; whyCapture?: CompanionWhyCaptureReceipt; } interface FinalCommitReportPhase { id: string; title: string; status: string; summary?: string; outcome?: string; files: string[]; } interface FinalCommitReportWorkflowState { workflowId: string; goal: string; status: string; createdAt: string; phases: Array<{ id: string; title: string; status: string; summary?: string; outcome?: string; files?: string[]; }>; phaseCommitReceipts?: WorkflowPhaseCommitReceipt[]; runtime?: { sandbox?: { bindings?: Array<{ lastCheckpoint?: { commands?: string[]; }; }>; }; }; } interface FinalCommitEvidenceItem { status: FinalCommitEvidenceStatus; text: string; source: "explicit" | "runtime_checkpoint"; } interface FinalCommitNotPersistedItem { text: string; reason: string; source: "phase_commit" | "why_capture" | "final_commit"; } interface FinalCommitReportV1 { version: typeof FINAL_COMMIT_REPORT_VERSION; generatedAt: string; workflowId?: string; outcome: FinalCommitOutcome; changed: { summary: string; files: string[]; phases: FinalCommitReportPhase[]; repository: { branch?: string; head?: string; dirty: boolean; dirtyFiles: string[]; }; }; rationale: { status: "provided" | "captured" | "missing"; text?: string; source: "explicit" | "why_capture" | "none"; }; evidence: { items: FinalCommitEvidenceItem[]; counts: Record; }; retainedDecisions: { status: "confirmed" | "none" | "unavailable"; items: FinalCommitMemoryItem[]; note?: string; }; pendingDecisions: { status: "pending_review" | "none" | "unavailable"; items: FinalCommitMemoryItem[]; note?: string; }; notPersisted: { items: FinalCommitNotPersistedItem[]; }; closeout: { risks: string[]; nextStep: string; }; caveats: string[]; } interface FinalCommitReportArtifact { status: "written" | "error"; version: typeof FINAL_COMMIT_REPORT_VERSION; path?: string; relativePath: typeof FINAL_COMMIT_REPORT_RELATIVE_PATH; hash?: string; error?: string; } interface BuildFinalCommitReportInput { state?: FinalCommitReportWorkflowState; summary: string; why?: string; outcome: FinalCommitOutcome; files?: string[]; evidence?: string[]; risks?: string[]; nextStep?: string; whyCapture: CompanionWhyCaptureReceipt; finalCommitResult: Record; cwd?: string; now?: Date; } declare function buildWorkflowPhaseCommitReceipt(input: { phaseId: string; category: string; outcome: FinalCommitOutcome; result: Record; capturedAt?: string; }): WorkflowPhaseCommitReceipt; declare function buildFinalCommitReport(input: BuildFinalCommitReportInput): FinalCommitReportV1; declare function writeFinalCommitReport(report: FinalCommitReportV1, cwd?: string): FinalCommitReportArtifact; declare function formatFinalCommitReport(report: FinalCommitReportV1): string; type SyncDocumentKind = "DOC" | "BINARY"; type WorkflowMode = "lite" | "standard" | "auto" | "full" | "orchestrate"; type AutomaticMemorySetup = "none" | "hosted"; type AutomaticOrchestratorSetup = "none" | "available" | "required"; type AutomaticWorkerSetup = "none" | "policy_gated"; interface AutomaticSetupSelection { requestedMode: WorkflowMode; effectiveMode: Exclude; companion: "active"; memory: AutomaticMemorySetup; orchestrator: AutomaticOrchestratorSetup; workers: AutomaticWorkerSetup; standaloneMemory: "not_selected"; tokenStrategy: "minimal" | "budgeted"; reasons: string[]; } type OnboardFolderMode = "auto" | "business_context" | "code_project" | "mixed"; type DetectedOnboardFolderMode = "business_context" | "code_project" | "mixed" | "unknown"; type ManagedWorkflowStatus = "active" | "completed" | "blocked"; type ManagedWorkflowPhaseStatus = "pending" | "in_progress" | "completed" | "blocked" | "skipped"; type ManagedWorkflowTaskStatus = ManagedWorkflowPhaseStatus; type ReindexKind = "doc" | "code"; type ReindexMode = "incremental" | "full"; type ManagedWorkflowPlanSource = "file" | "inline"; type TaskCommitOutcome = "completed" | "partial" | "blocked" | "abandoned"; type ManagedWorkflowSchemaVersion = "snipara.workflow.v1" | "snipara.workflow.v2"; declare const WORKFLOW_STATE_RELATIVE_PATH: string; declare const WORKFLOW_PLANS_RELATIVE_DIR: string; declare const PRODUCER_LOOP_ARTIFACT_VERSION: "snipara.producer_loop_artifact.v0"; declare const PRODUCER_LOOP_REPORT_VERSION: "snipara.producer_loop_report.v0"; declare const PRODUCER_LOOP_RELATIVE_DIR: string; type ProducerLoopProducerKind = "workflow_phase_commit" | "workflow_final_commit" | "pr_answer_pack_decision_capture"; type ProducerLoopSampleReviewStatus = "sample_unreviewed" | "sample_reviewed" | "sample_rejected"; interface ProducerLoopArtifactWriteResult { status: "written" | "error"; schemaVersion: typeof PRODUCER_LOOP_ARTIFACT_VERSION; artifactId?: string; path?: string; relativePath?: string; artifactHash?: string; ledgerHash?: string; error?: string; caveats: string[]; } interface ProducerLoopArtifactReportSummary { artifactId: string; generatedAt: string; producerKind: ProducerLoopProducerKind; workflowId?: string; phaseId?: string; phaseTitle?: string; outcome?: TaskCommitOutcome; summary?: string; path: string; relativePath: string; artifactHash: string; ledgerHash?: string; reasonCodes: string[]; files: string[]; calibrationStatus?: string; reviewStatus: ProducerLoopSampleReviewStatus; reviewOutcome?: string; reviewedAt?: string; reviewer?: string; } interface WorkerExecutionReceiptReportSummary { receiptId: string; schemaVersion: string; recordedAt?: string; workerId: string; workCategory: string; routingCardRef?: string; workflowFingerprint?: string; executionActor: string; status?: string; reviewStatus: "review_pending" | "accepted" | "blocked"; executed: boolean; receiptFamilyComplete: boolean; missingReceiptFamilies: string[]; path: string; relativePath: string; reviewPath?: string; reviewRelativePath?: string; } interface WorkerTrustReportRow { workerId: string; workCategory: string; state: "probation_supervised"; sampleSize: number; executedSampleSize: number; reviewedSampleSize: number; verifiedSampleSize: number; blockedSampleSize: number; incompleteReceiptSampleSize: number; workflowFingerprints: string[]; hardGateReady: false; nextRequired: string[]; } interface ProducerLoopReport { version: typeof PRODUCER_LOOP_REPORT_VERSION; generatedAt: string; source: { directory: string; localOnly: true; }; adoption: { status: "missing" | "active"; artifactCount: number; producerKinds: ProducerLoopProducerKind[]; workflowIds: string[]; }; artifacts: ProducerLoopArtifactReportSummary[]; latestArtifact?: ProducerLoopArtifactReportSummary; invalidArtifacts: Array<{ path: string; relativePath: string; error: string; }>; reasonCodes: { counts: Record; }; workerReceipts: { sourceDirectories: string[]; sampleSize: number; samples: WorkerExecutionReceiptReportSummary[]; invalidArtifacts: Array<{ path: string; relativePath: string; error: string; }>; }; workerTrust: WorkerTrustReportRow[]; calibration: { status: "no_samples" | "insufficient_samples" | "reviewable_sample_set"; sampleSize: number; reviewedSampleSize: number; rejectedSampleSize: number; unreviewedSampleSize: number; minReviewSampleSize: number; reviewOutcomes: Record; hardGateReady: false; notes: string[]; }; recommendedActions: string[]; caveats: string[]; } type WorkflowPlanPreset = "memory-backend-unification" | "project-intelligence-continuity-layer"; interface WorkflowPlanScaffoldDocument { preset: WorkflowPlanPreset; mode: "full"; goal: string; steps: Array<{ id: string; title: string; query: string; acceptance?: string; files?: string[]; gates?: string[]; needs_runtime?: boolean; }>; } interface ManagedWorkflowRuntimeCheckpoint { summary: string; capturedAt: string; automationSessionId?: string; hostedEventId?: string; hostedRecordedAt?: string; environment?: string; profile?: string; bootstrapQuery?: string; files?: string[]; commands?: string[]; artifacts?: string[]; contextPackReceipts?: LocalContextPackReceiptPayload[]; rehydratableState?: Record; } interface ManagedWorkflowSandboxRuntimeBinding { phaseId: string; sessionId: string; automationSessionId?: string; boundAt: string; bootstrapQuery: string; environment?: string; profile?: string; artifacts?: string[]; lastCheckpoint?: ManagedWorkflowRuntimeCheckpoint; } interface ManagedWorkflowRuntimeState { sandbox?: { provider: "snipara-sandbox"; bindings: ManagedWorkflowSandboxRuntimeBinding[]; }; } type ManagedWorkflowCoordinationMode = "standard" | "full" | "orchestrate"; interface ManagedWorkflowCoordinationState { mode: ManagedWorkflowCoordinationMode; autoPublish: boolean; startedAt?: string; lastUpdatedAt?: string; workSessionId?: string; startReceipt?: WorkflowCollaborationReceipt; teamSyncReceipt?: Record; releaseReceipt?: WorkflowCollaborationReceipt; } interface ManagedWorkflowPhase { id: string; title: string; query: string; status: ManagedWorkflowPhaseStatus; acceptance?: string; files?: string[]; gates?: string[]; needsRuntime?: boolean; dependsOn?: string[]; parallelGroup?: string; tasks?: ManagedWorkflowTask[]; currentTaskId?: string; startedAt?: string; completedAt?: string; summary?: string; outcome?: TaskCommitOutcome; } interface ManagedWorkflowTask { id: string; title: string; query: string; status: ManagedWorkflowTaskStatus; acceptance?: string; files?: string[]; verification?: string[]; commit?: string; dependsOn?: string[]; parallelGroup?: string; attempt: number; maxAttempts: number; recoveryTaskId?: string; startedAt?: string; completedAt?: string; summary?: string; outcome?: TaskCommitOutcome; lastError?: string; evidence?: string[]; contextEnvelope?: ManagedWorkflowTaskContextEnvelope; } interface ManagedWorkflowAgentContextConfig { agentId: string; manifest: string; } interface ManagedWorkflowAgentContext { agentId: string; displayName: string; roles: string[]; manifest: string; manifestHash: string; sources: Array<{ id: string; path: string; authority: string; tier: string; includedBy: string[]; }>; excludedRoleSourceIds: string[]; memory: { recall: Array<{ scope: string; category: string; agentId?: string; }>; defaultWrite: { scope: string; category: string; agentId: string; reviewRequired: boolean; }; promotion: Array<{ scope: string; category: string; reviewRequired: boolean; reason: string; }>; }; boundaries: string[]; queryHints: string[]; caveats: string[]; } interface ManagedWorkflowTaskContextEnvelope { version: "snipara.workflow.task-context.v1"; workflowId: string; phaseId: string; taskId: string; attempt: number; maxAttempts: number; contextPolicy: "bounded-task-context-no-raw-transcript"; scope: { title: string; query: string; acceptance?: string; files: string[]; verification: string[]; dependencies: string[]; parallelGroup?: string; }; agentContext?: ManagedWorkflowAgentContext; commands: { bootstrap: string; resume: string; impact: string; commit: string; agentContext?: string; hostedRecall?: string; hostedContextQuery?: string; }; } interface ManagedWorkflowJudgmentBrief { version: "project-intelligence-brief-v1"; generatedAt: string; servedJudgmentId?: string; branch?: string; task?: string; changedFiles: string[]; recentFiles: string[]; errors: Array<{ surface: string; message: string; }>; suggestedCommands: string[]; } interface ManagedWorkflowJudgmentResponse { recommendationId: string; decision: AdvisorInfluenceAgentDecision; respondedAt: string; source: "explicit" | "policy_auto"; policyVersion?: "snipara.workflow.judgment-autonomy.v1"; reasonCodes: string[]; planBefore?: string; planAfter?: string; initialReceipt?: ProjectRunAdvisorReceiptCapture; closeoutReceipt?: ProjectRunAdvisorReceiptCapture; outcomeReceipts?: OutcomeIntelligenceReceipt[]; } interface ManagedWorkflowJudgmentResolution { version: "snipara.workflow.judgment-resolution.v1"; evaluatedAt: string; state: ProjectJudgmentState; canProceed: ProjectJudgmentCanProceed; originalCard: { generatedAt: string; state: ProjectJudgmentState; canProceed: ProjectJudgmentCanProceed; score: number; }; reasonCodes: string[]; hardBlockerCodes: string[]; pendingExplicitRecommendationIds: string[]; autoResponseCount: number; evidence: { passedCount: number; failedCount: number; skippedCount: number; requiredActionCount: number; satisfiedRequiredActionCount: number; unsatisfiedRequiredActions: string[]; }; } interface ManagedWorkflowJudgmentState { version: "snipara.workflow.judgment.v1"; generatedAt: string; runEnvelope: ProjectIntelligenceRunEnvelope; brief: ManagedWorkflowJudgmentBrief; card: ProjectIntelligenceJudgmentCard; responses: ManagedWorkflowJudgmentResponse[]; responseHistory?: ManagedWorkflowJudgmentResponse[]; resolution?: ManagedWorkflowJudgmentResolution; } interface ManagedWorkflowState { schemaVersion: ManagedWorkflowSchemaVersion; workflowId: string; goal: string; status: ManagedWorkflowStatus; currentPhaseId?: string; planSource: ManagedWorkflowPlanSource; planFile?: string; createdAt: string; updatedAt: string; phases: ManagedWorkflowPhase[]; agentContext?: ManagedWorkflowAgentContextConfig; runtime?: ManagedWorkflowRuntimeState; coordination?: ManagedWorkflowCoordinationState; judgment?: ManagedWorkflowJudgmentState; judgmentHistory?: ManagedWorkflowJudgmentState[]; phaseCommitReceipts?: WorkflowPhaseCommitReceipt[]; finalReport?: FinalCommitReportArtifact; lastCommit?: { category: string; outcome: TaskCommitOutcome; summary: string; committedAt: string; }; } interface AgenticWorkStatus { version: "snipara.agentic_status.v1"; generatedAt: string; branch?: string; git: { head?: string; dirtyFileCount: number; statusLines: string[]; error?: string; }; workflow: { id: string; goal: string; status: ManagedWorkflowStatus; currentPhase?: { id: string; title: string; status: ManagedWorkflowPhaseStatus; }; lastPhaseCommit?: { phaseId: string; title: string; summary?: string; outcome?: TaskCommitOutcome; completedAt?: string; }; resumeCommand: string; } | null; teamSync: { activeWorkCount: number; staleWorkCount: number; staleWorkExplanation: TeamSyncStaleWorkExplanation; archivedWorkCount: number; handoffCount: number; latestHandoff?: { summary: string; next?: string; attention?: string; createdAt: string; }; }; risks: string[]; openDecisions: { count?: number; note: string; }; operationalLoop: { status: "clear" | "attention" | "blocked"; decisionRequestCount: number; receiptGapCount: number; nextActions: string[]; receiptActions: string[]; caveats: string[]; }; suggestedNextAction: string; } interface AgenticTimelineEvent { time: string; kind: string; title: string; detail?: string; source: ActivityEventSource; files?: string[]; } interface AgenticTimeline { version: "snipara.agentic_timeline.v1"; generatedAt: string; events: AgenticTimelineEvent[]; limit: number; } interface WorkflowImpactGateCommit { sha: string; shortSha: string; subject: string; author?: string; authoredAt?: string; } interface WorkflowImpactGatePhase { id: string; title: string; summary?: string; outcome?: TaskCommitOutcome; completedAt?: string; files: string[]; filesInUnpushedDiff: string[]; } interface WorkflowImpactGateResult { version: "snipara.workflow_impact_gate.v1"; generatedAt: string; gate: { status: "pass" | "attention"; reasonCodes: string[]; }; repo: { root: string; branch?: string; upstream: string; baseSha?: string; headSha?: string; }; unpushed: { commitCount: number; commits: WorkflowImpactGateCommit[]; changedFiles: string[]; codeChangedFiles: string[]; nonCodeChangedFiles: string[]; }; dirtyWorkingTree: { fileCount: number; statusLines: string[]; files: string[]; includedInLocalImpact: false; }; workflow: { id?: string; goal?: string; status?: ManagedWorkflowStatus; completedPhases: WorkflowImpactGatePhase[]; changedFilesWithoutPhase: string[]; phaseFilesOutsideUnpushedDiff: string[]; }; localImpact: Record | null; recommendedActions: string[]; caveats: string[]; hostedFollowUpCommand?: string; } interface WorkflowPlanScaffoldResult { preset: WorkflowPlanPreset; goal: string; outputPath: string; relativeOutputPath: string; plan: WorkflowPlanScaffoldDocument; } interface SyncDocumentsManifestOptions { metadataDefaults: Record; deleteMissing?: boolean; dryRun?: boolean; reindex?: boolean; reindexKind?: ReindexKind; reindexMode?: ReindexMode; } interface CollectedSyncDocuments { documents: SyncDocumentInput[]; manifestOptions: SyncDocumentsManifestOptions; } interface SyncDocumentsDryRunItem { path: string; status: "valid" | "invalid_metadata"; recommended_action: "none" | "reupload" | "review_source_metadata"; reasons: string[]; kind?: SyncDocumentKind; format?: string; size_bytes: number; content_hash: string; assetClass?: string; usageMode?: string; sourceKind?: string; } interface SyncDocumentsDryRunSummary { dry_run: true; remote_diff_available: false; total: number; would_sync: number; invalid_metadata: number; stale: number; needs_reupload: number; needs_metadata_review: number; delete_missing: boolean; reindex_requested: boolean; reindex_kind: ReindexKind; reindex_mode: ReindexMode; created: null; updated: null; unchanged: null; missing_from_manifest: null; note: string; documents: SyncDocumentsDryRunItem[]; } interface OnboardFolderScannedFile { path: string; size_bytes: number; supported: boolean; kind?: SyncDocumentKind; format?: string; } interface OnboardFolderClassification { mode: DetectedOnboardFolderMode; detected_mode: DetectedOnboardFolderMode; confidence: number; code_score: number; business_score: number; signals: { code: string[]; business: string[]; }; } interface OnboardFolderManifest { schemaVersion: "snipara.onboard-folder.v1"; source: { root: string; sourceKind: string; sourceProvider: string; sourceUri?: string; snapshotAt: string; recursive: boolean; }; classification: OnboardFolderClassification; summary: { total_files: number; supported_documents: number; ignored_files: number; unsupported_business_files: number; }; warnings: string[]; ignored: OnboardFolderScannedFile[]; sync: { dryRun: boolean; reindex: boolean; reindexKind: ReindexKind; reindexMode: ReindexMode; deleteMissing: boolean; metadata: Record; documents: SyncDocumentInput[]; }; dryRun: SyncDocumentsDryRunSummary; } declare function getPlanStepDisplayTitle(step: unknown, index?: number): string; interface PlanQualityReport { valid: boolean; issues: string[]; warnings: string[]; stepCount: number; actions: string[]; planId?: string; } interface WorkflowTokenBudgetReport { requested_max_tokens: number; allocations: { critical_memory_tokens: number; session_context_tokens: number; context_query_tokens: number; shared_context_tokens: number; plan_tokens: number; }; estimated_max_tokens: number; include_session_context: boolean; explicit: { max_critical_tokens: boolean; max_context_tokens: boolean; }; warnings: string[]; } interface SessionBootstrapQualityReport { warnings: string[]; counts: { critical_memories: number; session_context_memories: number; low_confidence_memories: number; stale_memories: number; test_memories: number; }; total_tokens?: number; oldest_memory_age_days?: number; } interface SessionBootstrapBrief { entries: SessionMemoryEntry[]; availableCount: number; hiddenCount: number; estimatedTokens: number; budgetTokens: number; } interface GeneratedWorkflowPlanDocument { mode: "full"; goal: string; source: "snipara_plan" | "local_plan"; plan_id?: string; generatedAt: string; steps: Array<{ id: string; title: string; query: string; acceptance?: string; files?: string[]; needs_runtime?: boolean; verify?: string[]; commit?: string; depends_on?: string[]; parallel_group?: string; max_attempts?: number; recovery_task_id?: string; tasks?: GeneratedWorkflowTaskDocument[]; }>; } interface GeneratedWorkflowTaskDocument { id: string; title: string; query: string; acceptance?: string; files?: string[]; verify?: string[]; commit?: string; depends_on?: string[]; parallel_group?: string; max_attempts?: number; recovery_task_id?: string; } declare function resolveFullWorkflowTokenBudget(options: { maxTokens?: number; includeSessionContext?: boolean; includeSharedContext?: boolean; maxCriticalTokens?: number; maxContextTokens?: number; }): WorkflowTokenBudgetReport; declare function validatePlanResult(plan: unknown, options?: { query?: string; cwd?: string; }): PlanQualityReport; declare function buildSessionBootstrapBrief(result: SessionMemoriesResult, options: { includeSessionContext: boolean; maxTokens?: number; maxEntries?: number; now?: Date; }): SessionBootstrapBrief; declare function buildSessionBootstrapQuality(result: SessionMemoriesResult, options?: { expectedMaxTokens?: number; now?: Date; }): SessionBootstrapQualityReport; declare function buildGeneratedWorkflowPlanDocument(plan: Record, fallbackGoal: string): GeneratedWorkflowPlanDocument; declare function normalizeWorkflowPlanInput(input: unknown, fallbackGoal: string): ManagedWorkflowPhase[]; declare function buildWorkflowPlanScaffold(preset: WorkflowPlanPreset, options?: { goal?: string; outputPath?: string; cwd?: string; }): WorkflowPlanScaffoldResult; declare function writeProducerLoopArtifact(options: { kind: ProducerLoopProducerKind; command: "workflow phase-commit" | "workflow final-commit"; state?: ManagedWorkflowState; phase?: ManagedWorkflowPhase; category: string; outcome: TaskCommitOutcome; summary: string; files?: string[]; journalAttempted: boolean; teamSyncCompletionAttempted: boolean; }): ProducerLoopArtifactWriteResult; declare function buildProducerLoopReport(options?: { cwd?: string; minReviewSampleSize?: number; }): ProducerLoopReport; declare function buildWorkflowPhaseCommitSummary(args: { workflowId: string; phase: Pick; summary: string; }): string; declare function resolveAutoWorkflowMode(query: string): Exclude; /** * Describe the smallest effective Snipara setup selected for a task. * This is deliberately a decision card: it never enables standalone memory * or executes a worker by itself. Worker execution remains policy-gated and * requires an explicit orchestrator path or project policy. */ declare function resolveAutomaticSetup(query: string, requestedMode: WorkflowMode, options?: { hostedConfigured?: boolean; }): AutomaticSetupSelection; /** * Compute the impact gate for committed-but-unpushed workflow phases. * * Compares `upstream..HEAD`, separates unpushed code changes from non-code and * dirty working-tree files, runs local code-overlay impact on the committed * code files, and maps the result back to completed workflow phases. Surfaces * reason codes such as `dirty_working_tree_not_included` and phase files that * fall outside the unpushed diff, so a phase is not treated as verified on * stale or partial evidence. * * @returns A `WorkflowImpactGateResult` with changed files, local impact, * matched phases, and reason codes. */ declare function buildWorkflowImpactGate(options?: { cwd?: string; base?: string; maxFiles?: number; }): WorkflowImpactGateResult; declare function collectSyncDocuments(options: { file?: string; dir?: string; prefix?: string; recursive?: boolean; }): SyncDocumentInput[]; declare function collectSyncDocumentsInput(options: { file?: string; dir?: string; prefix?: string; recursive?: boolean; }): CollectedSyncDocuments; interface OnboardFolderOptions { dir: string; recursive?: boolean; mode?: OnboardFolderMode; prefix?: string; usageMode?: string; sourceKind?: string; sourceProvider?: string; sourceUri?: string; clientId?: string; snapshotAt?: string; deleteMissing?: boolean; reindex?: boolean; reindexKind?: ReindexKind; reindexMode?: ReindexMode; } declare function buildOnboardFolderManifest(options: OnboardFolderOptions): OnboardFolderManifest; declare function buildSyncDocumentsDryRun(documents: SyncDocumentInput[], options?: { deleteMissing?: boolean; reindex?: boolean; reindexKind?: ReindexKind; reindexMode?: ReindexMode; now?: Date; }): SyncDocumentsDryRunSummary; declare function applyManagedWorkflowPolicyAutoResponses(judgment: ManagedWorkflowJudgmentState, respondedAt?: string): ManagedWorkflowJudgmentResponse[]; declare function deriveManagedWorkflowJudgmentResolution(judgment: ManagedWorkflowJudgmentState, options?: { evidence?: OutcomeIntelligenceEvidence[]; outcome?: TaskCommitOutcome; evaluatedAt?: string; }): ManagedWorkflowJudgmentResolution; declare function buildAgenticWorkStatus(cwd?: string): AgenticWorkStatus; declare function buildAgenticTimeline(options?: { limit?: number; cwd?: string; }): AgenticTimeline; type LocalSourceProvider = "local_folder"; type LocalSourceFileKind = "DOC" | "BINARY" | "CODE" | "CONFIG" | "OTHER"; type LocalSourceSkippedReason = "ignored" | "too_large" | "read_error"; type LocalSourceReindexKind = "doc" | "code"; type LocalSourceReindexMode = "incremental" | "full"; interface LocalSourceFile { path: string; kind: LocalSourceFileKind; format: string | null; sizeBytes: number; modifiedAt: string; sha256: string; } interface LocalSourceSkippedFile { path: string; reason: LocalSourceSkippedReason; sizeBytes?: number; } interface LocalSourceSummary { totalFiles: number; totalBytes: number; byKind: Record; skipped: number; } interface LocalSourceSnapshot { version: "snipara.local_source_snapshot.v1"; generatedAt: string; root: string; provider: LocalSourceProvider; revision: string; recursive: boolean; maxFiles: number; maxFileBytes: number; summary: LocalSourceSummary; files: LocalSourceFile[]; skipped: { total: number; byReason: Record; samples: LocalSourceSkippedFile[]; }; warnings: string[]; } interface LocalSourceSnapshotOptions { dir?: string; recursive?: boolean; maxFiles?: number; maxFileBytes?: number; } interface LocalSourceComparison { added: string[]; modified: string[]; deleted: string[]; unchanged: number; } interface LocalSourceStatusResult { root: string; snapshotPath: string; previous: LocalSourceSnapshot | null; current: LocalSourceSnapshot; comparison: LocalSourceComparison; } interface LocalSourceSyncOptions extends LocalSourceSnapshotOptions { prefix?: string; mode?: OnboardFolderMode; deleteMissing?: boolean; apply?: boolean; reindex?: boolean; reindexKind?: LocalSourceReindexKind; reindexMode?: LocalSourceReindexMode; includeGraph?: boolean; json?: boolean; } interface LocalSourceSyncResult { root: string; snapshotPath: string; snapshot: LocalSourceSnapshot; comparison: LocalSourceComparison; documents: { onboarding: Pick; dryRun: OnboardFolderManifest["dryRun"]; }; codeOverlay: { cachePath: string; summary: LocalCodeOverlaySummary; }; apply: null | { sync: Record; reindex?: Record; }; warnings: string[]; } declare function getLocalSourceSnapshotPath(cwd?: string): string; declare function buildLocalSourceSnapshot(options?: LocalSourceSnapshotOptions): LocalSourceSnapshot; declare function writeLocalSourceSnapshot(snapshot: LocalSourceSnapshot): string; declare function readLocalSourceSnapshot(cwd?: string): LocalSourceSnapshot | null; declare function compareLocalSourceSnapshots(previous: LocalSourceSnapshot | null, current: LocalSourceSnapshot): LocalSourceComparison; declare function buildLocalSourceStatus(options?: LocalSourceSnapshotOptions): LocalSourceStatusResult; declare function buildLocalSourceSyncResult(options?: LocalSourceSyncOptions): Promise; declare const DOCS_BOOTSTRAP_VERSION: "snipara.docs_bootstrap.v1"; declare const DEFAULT_DOCS_BOOTSTRAP_OUTPUT: string; interface DocsBootstrapOptions { dir?: string; output?: string; apply?: boolean; force?: boolean; preview?: boolean; maxFiles?: number; maxFileBytes?: number; json?: boolean; } interface DocsBootstrapResult { version: typeof DOCS_BOOTSTRAP_VERSION; root: string; outputPath: string; relativeOutputPath: string; applied: boolean; overwritten: boolean; sourceRevision: string; generatedAt: string; source: { totalFiles: number; totalBytes: number; docs: number; code: number; config: number; binary: number; other: number; skipped: number; }; documentation: { existingFiles: string[]; outputPath: string; }; content: string; warnings: string[]; } declare function buildProjectBriefMarkdown(snapshot: LocalSourceSnapshot, options?: { relativeOutputPath?: string; }): string; declare function buildDocsBootstrapResult(options?: DocsBootstrapOptions): DocsBootstrapResult; declare function docsBootstrapCommand(options?: DocsBootstrapOptions): Promise; interface LocalWorkerDeclaration { id: string; workerRole: string; endpointType: "local"; provider: string; baseUrl: string; apiKeyEnv?: string; apiKeyHeader?: "authorization" | "x-api-key"; command?: string; model?: string; preferModel?: string; capabilities: string[]; reasoning: "low" | "medium" | "high"; writeScope: string[]; createdAt: string; updatedAt: string; } interface LocalWorkersConfig { schemaVersion: "snipara.local_workers.v1"; updatedAt: string; defaultWorkerId: string; workers: LocalWorkerDeclaration[]; } interface LocalWorkerRoutingDefaults { worker: LocalWorkerDeclaration; routeLocalWorkers: true; routingLocalTransport: "openai_http" | "cli"; routingLocalAdapter?: "codex_app_server" | "claude_cli"; routingLocalCommand?: string; routingWorkerRole: string; routingLocalBaseUrl: string; routingLocalModel?: string; routingLocalPreferModel?: string; routingLocalProvider: string; routingLocalApiKeyEnv?: string; routingLocalApiKeyHeader?: "authorization" | "x-api-key"; routingPreferredEndpoints: string[]; routingAllowedEndpoints: string[]; plannerRetainsReasoning: true; } interface LocalWorkerAddOptions { id?: string; role?: string; provider?: string; baseUrl?: string; model?: string; preferModel?: string; capabilities?: string[]; writeScope?: string[]; contextWindow?: number; reasoning?: "low" | "medium" | "high"; default?: boolean; json?: boolean; transport?: "openai_http" | "cli"; command?: string; apiKeyEnv?: string; apiKeyHeader?: "authorization" | "x-api-key"; } interface LocalWorkerStatusOptions { json?: boolean; } interface LocalWorkerListOptions { json?: boolean; } interface LocalWorkerRemoveOptions { id: string; json?: boolean; } interface LocalWorkerProbeOptions { baseUrl?: string; provider?: string; model?: string; preferModel?: string; role?: string; workerId?: string; capabilities?: string[]; writeScope?: string[]; reasoning?: "low" | "medium" | "high"; contextWindow?: number; apiKeyEnv?: string; apiKeyHeader?: "authorization" | "x-api-key"; json?: boolean; } declare function workersLocalAddCommand(options: LocalWorkerAddOptions): void; declare function workersLocalStatusCommand(options?: LocalWorkerStatusOptions): void; declare function workersLocalListCommand(options?: LocalWorkerListOptions): void; declare function workersLocalRemoveCommand(options: LocalWorkerRemoveOptions): void; declare function workersLocalProbePrintCommand(options: LocalWorkerProbeOptions): void; declare function addLocalWorker(options: LocalWorkerAddOptions): { worker: LocalWorkerDeclaration; config: LocalWorkersConfig; workerConfigPath: string; policyPath: string; }; declare function resolveLocalWorkerRoutingDefaults(options?: { workerId?: string; workerRole?: string; }): LocalWorkerRoutingDefaults | null; declare function readLocalWorkersConfig(): LocalWorkersConfig | null; interface ControlledWorkerExecuteOptions { task: string; workerId?: string; workerRole?: string; endpointType?: "local" | "cloud" | "self_hosted" | "unknown"; mode?: ControlledWorkerExecutionMode; command?: string; commandArgs?: string[]; execute?: boolean; approvalReceipt?: string; outcomeReceipt?: string; writeScope?: string[]; acceptance?: string[]; proof?: string[]; outputFragments?: string[]; workCategory?: WorkerTrustCategory; trustEvent?: string; profileHash?: string; provider?: string; model?: string; output?: string; projectId?: string; unifiedOutput?: string; dir?: string; json?: boolean; } interface ControlledWorkerExecuteResult { executed: boolean; blocked: boolean; receiptPath: string; unifiedReceiptPath: string | null; receipt: ControlledWorkerExecutionReceipt; unifiedReceipt: UnifiedReceiptEnvelope | null; } declare function controlledWorkerExecuteCommand(options: ControlledWorkerExecuteOptions): ControlledWorkerExecuteResult; interface WorkerTrustCandidateOptions { workerId?: string; workCategory?: string; emitDecisionRequests?: boolean; dir?: string; json?: boolean; } interface WorkerTrustReviewOptions { requestId: string; choice: "approve" | "keep_supervised" | "demote"; reviewer: string; note?: string; expiresInDays?: number; dir?: string; json?: boolean; } interface WorkerTrustStatusOptions { workerId?: string; workCategory?: string; dir?: string; json?: boolean; } declare function workerTrustCandidateCommand(options?: WorkerTrustCandidateOptions): unknown; declare function workerTrustReviewCommand(options: WorkerTrustReviewOptions): unknown; declare function workerTrustStatusCommand(options?: WorkerTrustStatusOptions): unknown; declare function buildWorkerTrustCandidates(cwd: string): WorkerTrustCandidate[]; declare function readWorkerTrustEvent(cwd: string, workerId: string, workCategory: WorkerTrustCategory): WorkerTrustEvent | null; declare function hashWorkerProfile(profile: WorkerProfile): string; declare const FEATURE_WORK_ITEM_VERSION: "snipara.feature_work_item.v1"; declare const FEATURE_DEFAULT_OUTPUT_DIR: string; interface FeatureWorkItemManifest { schemaVersion: typeof FEATURE_WORK_ITEM_VERSION; source: "snipara-companion"; slug: string; goal: string; why?: string; users: string[]; constraints: string[]; nonGoals: string[]; acceptanceCriteria: string[]; createdAt: string; updatedAt: string; artifacts: { spec: "spec.md"; plan: "plan.md"; tasks: "tasks.md"; workflowPlan: "workflow-plan.json"; }; status: { spec: "draft" | "ready"; plan: "missing" | "ready"; tasks: "missing" | "ready"; }; } interface FeatureArtifactPaths { root: string; manifest: string; spec: string; plan: string; tasks: string; workflowPlan: string; } interface FeatureSpecifyOptions { slug: string; goal?: string; why?: string; users?: string[]; constraints?: string[]; nonGoals?: string[]; acceptanceCriteria?: string[]; outputDir?: string; force?: boolean; cwd?: string; json?: boolean; } interface FeatureCommandOptions { slug: string; force?: boolean; cwd?: string; outputDir?: string; maxTokens?: number; fromPlan?: boolean; json?: boolean; } interface FeatureStartOptions { slug: string; workflowId?: string; force?: boolean; json?: boolean; cwd?: string; outputDir?: string; } declare function normalizeFeatureSlug(value: string): string; declare function resolveFeatureArtifactPaths(slug: string, options?: { cwd?: string; outputDir?: string; }): FeatureArtifactPaths; declare function buildFeatureSpecMarkdown(manifest: FeatureWorkItemManifest): string; declare function buildFeaturePlanMarkdown(manifest: FeatureWorkItemManifest, plan: GeneratedWorkflowPlanDocument): string; declare function buildFeatureTasksMarkdown(manifest: FeatureWorkItemManifest, plan: GeneratedWorkflowPlanDocument): string; declare function featureInitCommand(options: FeatureSpecifyOptions): void; declare function featureSpecifyCommand(options: FeatureSpecifyOptions): void; declare function featurePlanCommand(options: FeatureCommandOptions): Promise; declare function featureTasksCommand(options: FeatureCommandOptions): void; declare function featureStartCommand(options: FeatureStartOptions): Promise; declare function featureStatusCommand(options: FeatureCommandOptions): void; declare const MANIFEST_VERSION = "snipara.references.v1"; type ReferenceStatus = "allowed" | "pending" | "denied" | "unsupported"; interface ReferenceOccurrence { file: string; line: number; label?: string; } interface ReferenceManifestItem { id: string; url: string; normalizedUrl: string; domain: string; status: ReferenceStatus; reason: string; discoveredAt: string; occurrences: ReferenceOccurrence[]; latestSnapshotPath?: string; latestFetchStatus?: number; latestFetchAt?: string; latestContentHash?: string; latestError?: string; } interface ReferenceManifest { version: typeof MANIFEST_VERSION; generatedAt: string; root: string; allowDomains: string[]; denyDomains: string[]; items: ReferenceManifestItem[]; } interface ScanReferencesOptions { root?: string; output?: string; allowDomain?: string[]; denyDomain?: string[]; extensions?: string[]; maxFiles?: number; json?: boolean; } interface IngestReferencesOptions { manifest?: string; outputDir?: string; allowDomain?: string[]; ids?: string[]; max?: number; timeoutMs?: number; maxBytes?: number; destinationPrefix?: string; upload?: boolean; reindex?: boolean; dryRun?: boolean; json?: boolean; } interface ScanSummary { manifest: ReferenceManifest; outputPath: string; scannedFiles: number; foundUrls: number; allowed: number; pending: number; denied: number; unsupported: number; } interface IngestSummary { manifestPath: string; selected: number; fetched: number; uploaded: number; failed: number; dryRun: boolean; snapshots: Array<{ id: string; url: string; snapshotPath?: string; destinationPath?: string; status?: number; uploaded?: boolean; error?: string; }>; } declare function scanReferences(options?: ScanReferencesOptions): ScanSummary; declare function ingestReferences(options?: IngestReferencesOptions): Promise; declare function referencesScanCommand(options: ScanReferencesOptions): Promise; declare function referencesIngestCommand(options: IngestReferencesOptions): Promise; declare const POLICY_LEDGER_SYNC_REPORT_VERSION: "snipara.workflow_policy_ledger_sync.v0"; interface PolicyLedgerSyncSummary { total: number; pendingRequests: number; resolvedDecisions: number; applyReceipts: number; policyDrafts: number; } interface PolicyLedgerSyncReport { version: typeof POLICY_LEDGER_SYNC_REPORT_VERSION; generatedAt: string; dryRun: boolean; summary: PolicyLedgerSyncSummary; artifacts: ProjectPolicyLedgerSyncArtifactInput[]; hosted?: Record; caveats: string[]; } declare function buildPolicyLedgerSyncReport(options?: { cwd?: string; dryRun?: boolean; }): PolicyLedgerSyncReport; declare function workflowSyncPolicyLedgerCommand(options: { dryRun?: boolean; json?: boolean; }): Promise; declare function collectPolicyLedgerSyncArtifacts(cwd?: string): ProjectPolicyLedgerSyncArtifactInput[]; type CacheStrategy = "exact" | "nearby" | "warm"; interface QueryCacheScope { cwd?: string; projectId?: string; sessionId?: string; } interface QueryCacheLookup { query: string; maxTokens: number; } interface QueryCacheHit { strategy: CacheStrategy; result: ContextQueryResult; sourceQuery: string; similarity?: number; } interface WarmSnapshotResult { storedEntries: number; fileName?: string; } declare class LocalQueryCache { private readonly scope; private readonly ttlMs; private readonly warmTtlMs; private readonly maxEntries; private readonly maxBytes; constructor(scope?: QueryCacheScope); lookup(options: QueryCacheLookup): QueryCacheHit | null; save(options: QueryCacheLookup, result: ContextQueryResult): void; storeWarmSnapshot(result: SessionMemoriesResult): WarmSnapshotResult; clear(): number; private loadIndex; private persistIndex; private pruneIndex; private readEntry; private findNearbyEntry; private lookupWarmSnapshot; } declare function createLocalQueryCache(scope?: QueryCacheScope): LocalQueryCache; declare const AUTOMATION_MANIFEST_RELATIVE_PATH = ".snipara/automations/manifest.json"; type AutomationFileState = "create" | "update" | "unchanged" | "conflict"; interface AutomationManifestFile { path: string; sha256: string; } interface AutomationManifest { version: number; client: string; projectId?: string; apiUrl?: string; installedAt: string; files: AutomationManifestFile[]; } interface AutomationFilePlan { path: string; targetPath: string; state: AutomationFileState; reason: string; currentSha256?: string; previousSha256?: string; nextSha256: string; writeContent?: string; } interface AutomationInstallResult { manifest: AutomationManifest; plan: AutomationFilePlan[]; written: number; unchanged: number; dryRun: boolean; } interface AutomationStatusResult { manifest: AutomationManifest | null; files: Array<{ path: string; targetPath: string; state: "up-to-date" | "modified" | "missing"; expectedSha256: string; currentSha256?: string; }>; } declare class AutomationInstallConflictError extends Error { conflicts: AutomationFilePlan[]; constructor(conflicts: AutomationFilePlan[]); } declare class AutomationUnsupportedHookBundleError extends Error { client: string; files: string[]; constructor(client: string, files: string[]); } declare function getAutomationManifestPath(projectDir?: string): string; declare function loadAutomationManifest(projectDir?: string): AutomationManifest | null; declare function buildAutomationInstallPlan(args: { projectDir: string; bundle: AutomationConfigBundle; manifest?: AutomationManifest | null; force?: boolean; }): AutomationFilePlan[]; declare function installAutomationBundle(args: { client: string; projectDir?: string; bundle?: AutomationConfigBundle; force?: boolean; dryRun?: boolean; }): Promise; declare function getAutomationStatus(projectDir?: string): AutomationStatusResult; export { AGENT_CONTEXT_EVIDENCE_DEFAULT_LEDGER, AUTOMATION_MANIFEST_RELATIVE_PATH, type AutomaticMemorySetup, type AutomaticOrchestratorSetup, type AutomaticSetupSelection, type AutomaticWorkerSetup, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, CODING_INTELLIGENCE_LEDGER_VERSION, COLLABORATION_STATE_RELATIVE_PATH, DEFAULT_DOCS_BOOTSTRAP_OUTPUT, DOCS_BOOTSTRAP_VERSION, ENGINEERING_LEAD_EXECUTION_RECEIPT_STAGES, ENGINEERING_LEAD_EXECUTION_RECEIPT_STATUSES, ENGINEERING_LEAD_POSTURES, ENGINEERING_LEAD_PROOF_VERIFICATION_SOURCES, ENGINEERING_LEAD_PROOF_VERIFICATION_STATUSES, ENGINEERING_LEAD_ROUTING_MODES, ENGINEERING_LEAD_STATUSES, ENGINEERING_LEAD_SUPERVISION_STATUSES, ENGINEERING_LEAD_WORKER_ROLES, ENGINEERING_LEAD_WORK_PACKAGE_STATUSES, FEATURE_DEFAULT_OUTPUT_DIR, FEATURE_WORK_ITEM_VERSION, FINAL_COMMIT_REPORT_RELATIVE_PATH, FINAL_COMMIT_REPORT_VERSION, type GeneratedWorkflowTaskDocument, MEMORY_GUARD_CONTEXT_TIMEOUT_MS, MEMORY_GUARD_RECALL_TIMEOUT_MS, type ManagedWorkflowTask, type ManagedWorkflowTaskContextEnvelope, type ManagedWorkflowTaskStatus, ORCHESTRATOR_HANDOFF_RELATIVE_PATH, POLICY_LEDGER_SYNC_REPORT_VERSION, PRODUCER_LOOP_ARTIFACT_VERSION, PRODUCER_LOOP_RELATIVE_DIR, PRODUCER_LOOP_REPORT_VERSION, TEAM_SYNC_STATE_RELATIVE_PATH, WHY_OUTCOME_CAPTURE_VERSION, WORKFLOW_PLANS_RELATIVE_DIR, WORKFLOW_STATE_RELATIVE_PATH, addLocalWorker, agentContextEvidenceCollectCommand, agentContextEvidenceRecordCommand, agentContextEvidenceStatusCommand, agentContextEvidenceTemplateCommand, agentContextResolveCommand, agentContextValidateCommand, agentReadinessAuditCommand, appendActivityEvent, applyLocalContextMutationPlan, applyManagedWorkflowPolicyAutoResponses, archiveInactiveTeamSyncWork, attachLocalContextPackReceipts, autoArchiveTeamSyncState, buildAdaptiveWorkRoutingRecommendation, buildAgentReadinessAuditReport, buildAgenticHandoffMarkdown, buildAgenticTimeline, buildAgenticWorkStatus, buildAutomationInstallPlan, buildCanonicalEvent, buildCodeHooksInstallPlan, buildCodePromotionResult, buildCodeStatusResult, buildCodeSyncResult, buildCodingIntelligenceLedger, buildCollaborationActor, buildCollaborationGuardActionCards, buildCollaborationHooksInstallPlan, buildCommitResultMetadata, buildCompanionEngineeringLeadPlanReport, buildContextPackStats, buildDocsBootstrapResult, buildEvalCaseArtifact, buildFeaturePlanMarkdown, buildFeatureSpecMarkdown, buildFeatureTasksMarkdown, buildFinalCommitReport, buildGeneratedWorkflowPlanDocument, buildHostedCodeOverlayUploadPayload, buildHostedGuardPayload, buildInstalledDependencyEvidence, buildJournalCheckpointEntry, buildLocalAgentContextValidationReport, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalContextMutationPlan, buildLocalContextPackReceipt, buildLocalContextPackReceipts, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalProjectContextValidationReport, buildLocalProjectDriftReport, buildLocalProjectRealityCheck, buildLocalProjectRealityCheckWithAutoContext, buildLocalShortestPathResult, buildLocalSourceSnapshot, buildLocalSourceStatus, buildLocalSourceSyncResult, buildMemoryAudit, buildOnboardFolderManifest, buildOrchestratorHandoff, buildPolicyLedgerSyncReport, buildProducerLoopReport, buildProjectBriefMarkdown, buildProjectIntelligenceBrief, buildProjectIntelligenceRun, buildProjectJudgmentCard, buildSessionBootstrapBrief, buildSessionBootstrapQuality, buildSessionSnapshot, buildSmallestSafeDiffEvidence, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWhyOutcomeCaptureReport, buildWorkerTrustCandidates, buildWorkflowImpactGate, buildWorkflowPhaseCommitReceipt, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, captureStandaloneCommitWhy, categoryFromGuardTag, classifyToolResult, cleanContextPacks, codingLedgerExportCommand, collaborationIdeStatusCommand, collectAgentReadinessLocalSignals, collectPolicyLedgerSyncArtifacts, collectSyncDocuments, collectSyncDocumentsInput, compactHostedGuardResources, compareLocalSourceSnapshots, completeTeamSyncStateFromEvidence, completeTeamSyncWorkFromEvidence, contextControlApplyCommand, contextControlDriftCommand, contextControlHostedApplyCommand, contextControlHostedDiffCommand, contextControlPlanCommand, contextControlValidateCommand, contextPackCleanCommand, contextPackPackCommand, contextPackRetrieveCommand, contextPackStatsCommand, controlledWorkerExecuteCommand, createClient, createEmptyCollaborationState, createEmptyTeamSyncState, createLocalQueryCache, deriveLocalCollaborationResourcesFromFiles, deriveManagedWorkflowJudgmentResolution, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, docsBootstrapCommand, evalExportCommand, evalRunCommand, evaluateProjectPolicyGates, extractCommandFromToolInput, extractFilesFromToolInput, featureInitCommand, featurePlanCommand, featureSpecifyCommand, featureStartCommand, featureStatusCommand, featureTasksCommand, formatAgentContextResolution, formatAgentReadinessAuditReport, formatCompanionEngineeringLeadPlanReport, formatFinalCommitReport, formatOrchestratorRecommendationReason, formatPolicyGateDecision, formatProjectJudgmentCard, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getCollaborationStatePath, getConfigPath, getContextPackStoragePaths, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getLocalSourceSnapshotPath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, hasActiveManagedWorkflow, hashWorkerProfile, ingestReferences, installAutomationBundle, leadPlanCommand, listProjectsForApiKey, loadAutomationManifest, loadCollaborationState, loadConfig, loadTeamSyncState, memoryAuditCommand, memoryCleanCandidatesCommand, memoryCompactCommand, memoryHealthCommand, memoryLocalCommand, memoryReviewsCommand, mergeHybridCodeResults, normalizeCollaborationFiles, normalizeFeatureSlug, normalizeGuardTag, normalizeWorkflowPlanInput, outcomeCapturePreviewCommand, packContext, parseCollaborationResources, projectIntelligenceBriefCommand, projectIntelligenceRunCommand, readActivityTimeline, readAgentContextEvidenceLedger, readLocalCodeOverlayCache, readLocalCodePromotionState, readLocalSourceSnapshot, readLocalWorkersConfig, readSessionSnapshot, readStandaloneCommitEvidence, readWorkerTrustEvent, realityCheckCommand, referencesIngestCommand, referencesScanCommand, resolveAutoWorkflowMode, resolveAutomaticSetup, resolveCodeGraphMode, resolveContextPackRecord, resolveFeatureArtifactPaths, resolveFullWorkflowTokenBudget, resolveLocalWorkerRoutingDefaults, resolveMinimumChangeMode, resolveQueryFromToolInput, retrieveContextPack, runMemoryGuardCheck, saveCollaborationState, saveConfig, saveTeamSyncState, scanReferences, shouldFailCollaborationGuard, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, validatePlanResult, verifyCommand, workerTrustCandidateCommand, workerTrustReviewCommand, workerTrustStatusCommand, workersLocalAddCommand, workersLocalListCommand, workersLocalProbePrintCommand, workersLocalRemoveCommand, workersLocalStatusCommand, workflowSyncPolicyLedgerCommand, writeFinalCommitReport, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeLocalSourceSnapshot, writeOrchestratorHandoff, writeProducerLoopArtifact, writeSessionSnapshot };