@kb-labs/agent-contracts 2.118.2 → 2.119.0-canary.cee505c72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +74 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -715,8 +715,47 @@ interface Turn {
|
|
|
715
715
|
runId?: string;
|
|
716
716
|
/** Summary of files changed during this turn (populated on run completion) */
|
|
717
717
|
fileChanges?: FileChangeSummary[];
|
|
718
|
+
/**
|
|
719
|
+
* Client-generated id echoed back on user turns, so the frontend can
|
|
720
|
+
* reconcile its optimistic message by id instead of fuzzy text-matching.
|
|
721
|
+
*/
|
|
722
|
+
clientId?: string;
|
|
718
723
|
};
|
|
719
724
|
}
|
|
725
|
+
/**
|
|
726
|
+
* Incremental change to a Turn, addressed by the session's monotonic `seq`.
|
|
727
|
+
* The server emits these instead of resending the full Turn on every event —
|
|
728
|
+
* the client applies them as ordered patches against its local turn map.
|
|
729
|
+
* `turn:created` carries the turn WITHOUT steps; steps arrive via their own
|
|
730
|
+
* `turn:step:appended` deltas (including any present at creation time).
|
|
731
|
+
*/
|
|
732
|
+
type TurnDelta = {
|
|
733
|
+
kind: 'turn:created';
|
|
734
|
+
seq: number;
|
|
735
|
+
turn: Turn;
|
|
736
|
+
} | {
|
|
737
|
+
kind: 'turn:step:appended';
|
|
738
|
+
seq: number;
|
|
739
|
+
turnId: string;
|
|
740
|
+
step: TurnStep;
|
|
741
|
+
} | {
|
|
742
|
+
kind: 'turn:step:updated';
|
|
743
|
+
seq: number;
|
|
744
|
+
turnId: string;
|
|
745
|
+
step: TurnStep;
|
|
746
|
+
} | {
|
|
747
|
+
kind: 'turn:status';
|
|
748
|
+
seq: number;
|
|
749
|
+
turnId: string;
|
|
750
|
+
status: Turn['status'];
|
|
751
|
+
completedAt: string | null;
|
|
752
|
+
error?: Turn['error'];
|
|
753
|
+
} | {
|
|
754
|
+
kind: 'turn:metadata';
|
|
755
|
+
seq: number;
|
|
756
|
+
turnId: string;
|
|
757
|
+
patch: Partial<Turn['metadata']>;
|
|
758
|
+
};
|
|
720
759
|
/**
|
|
721
760
|
* A step is a single action within a turn.
|
|
722
761
|
* Maps to event types from the event stream.
|
|
@@ -2435,6 +2474,14 @@ interface RunCompletedMessage {
|
|
|
2435
2474
|
success: boolean;
|
|
2436
2475
|
summary: string;
|
|
2437
2476
|
durationMs: number;
|
|
2477
|
+
/** Session-wide cursor value for this event, for gap detection. */
|
|
2478
|
+
seq: number;
|
|
2479
|
+
/**
|
|
2480
|
+
* Final state of the assistant turn this run produced, if any. Carried
|
|
2481
|
+
* here so the client has a guaranteed-fresh terminal state without
|
|
2482
|
+
* depending on the ordering of a separate delta message arriving first.
|
|
2483
|
+
*/
|
|
2484
|
+
turn?: Turn;
|
|
2438
2485
|
};
|
|
2439
2486
|
timestamp: number;
|
|
2440
2487
|
}
|
|
@@ -2463,32 +2510,37 @@ interface CorrectionAckMessage {
|
|
|
2463
2510
|
timestamp: number;
|
|
2464
2511
|
}
|
|
2465
2512
|
/**
|
|
2466
|
-
* Turn
|
|
2467
|
-
* Sent
|
|
2513
|
+
* Turn delta message (server → client)
|
|
2514
|
+
* Sent for every incremental change to a turn's projection. This is the
|
|
2515
|
+
* SOLE live-update channel — the client applies deltas as ordered patches
|
|
2516
|
+
* against its local turn map, gated by `delta.seq`. Replaces the previous
|
|
2517
|
+
* full-Turn-per-event `turn:snapshot` message.
|
|
2468
2518
|
*/
|
|
2469
|
-
interface
|
|
2470
|
-
type: 'turn:
|
|
2519
|
+
interface TurnDeltaMessage {
|
|
2520
|
+
type: 'turn:delta';
|
|
2471
2521
|
payload: {
|
|
2472
2522
|
sessionId: string;
|
|
2473
|
-
|
|
2474
|
-
sequenceNumber: number;
|
|
2523
|
+
delta: TurnDelta;
|
|
2475
2524
|
};
|
|
2476
2525
|
timestamp: number;
|
|
2477
2526
|
}
|
|
2478
2527
|
/**
|
|
2479
2528
|
* Conversation snapshot message (server → client)
|
|
2480
|
-
* Sent on initial WebSocket connection
|
|
2529
|
+
* Sent on initial WebSocket connection (or reconnect without a resume
|
|
2530
|
+
* cursor) to provide the full current projection as a cold-start baseline.
|
|
2481
2531
|
*/
|
|
2482
2532
|
interface ConversationSnapshotMessage {
|
|
2483
2533
|
type: 'conversation:snapshot';
|
|
2484
2534
|
payload: {
|
|
2485
2535
|
sessionId: string;
|
|
2486
|
-
/** Recent completed turns
|
|
2536
|
+
/** Recent completed turns */
|
|
2487
2537
|
completedTurns: Turn[];
|
|
2488
2538
|
/** Currently streaming turns */
|
|
2489
2539
|
activeTurns: Turn[];
|
|
2490
2540
|
/** Total turns in session */
|
|
2491
2541
|
totalTurns: number;
|
|
2542
|
+
/** Session-wide cursor value this snapshot was taken at. */
|
|
2543
|
+
seq: number;
|
|
2492
2544
|
/** Snapshot timestamp */
|
|
2493
2545
|
timestamp: string;
|
|
2494
2546
|
};
|
|
@@ -2497,7 +2549,7 @@ interface ConversationSnapshotMessage {
|
|
|
2497
2549
|
/**
|
|
2498
2550
|
* Union of all server → client messages
|
|
2499
2551
|
*/
|
|
2500
|
-
type ServerMessage = ConnectionReadyMessage | RunCompletedMessage | ErrorMessage | CorrectionAckMessage |
|
|
2552
|
+
type ServerMessage = ConnectionReadyMessage | RunCompletedMessage | ErrorMessage | CorrectionAckMessage | TurnDeltaMessage | ConversationSnapshotMessage;
|
|
2501
2553
|
/**
|
|
2502
2554
|
* User correction message (client → server)
|
|
2503
2555
|
* User sends a correction/feedback to the orchestrator
|
|
@@ -2558,6 +2610,12 @@ interface RunRequest {
|
|
|
2558
2610
|
smartTiering?: AgentSmartTieringConfig;
|
|
2559
2611
|
/** Answer style depth (auto/brief/deep) */
|
|
2560
2612
|
responseMode?: AgentResponseMode;
|
|
2613
|
+
/**
|
|
2614
|
+
* Client-generated id for the optimistic user message this run represents.
|
|
2615
|
+
* Echoed back on `RunResponse.userTurn.metadata.clientId` so the frontend
|
|
2616
|
+
* can reconcile its optimistic turn by id instead of text-matching.
|
|
2617
|
+
*/
|
|
2618
|
+
clientId?: string;
|
|
2561
2619
|
}
|
|
2562
2620
|
/**
|
|
2563
2621
|
* Response for POST /run
|
|
@@ -2576,6 +2634,12 @@ interface RunResponse {
|
|
|
2576
2634
|
status: 'started' | 'queued';
|
|
2577
2635
|
/** Timestamp */
|
|
2578
2636
|
startedAt: string;
|
|
2637
|
+
/**
|
|
2638
|
+
* The persisted user turn this run created, returned synchronously so the
|
|
2639
|
+
* frontend can reconcile its optimistic message immediately by id/clientId
|
|
2640
|
+
* without waiting on a WS round-trip.
|
|
2641
|
+
*/
|
|
2642
|
+
userTurn: Turn;
|
|
2579
2643
|
}
|
|
2580
2644
|
/**
|
|
2581
2645
|
* Request body for POST /run/:runId/correct
|
|
@@ -3652,4 +3716,4 @@ interface SpawnAgentResult {
|
|
|
3652
3716
|
preset: SubAgentPreset;
|
|
3653
3717
|
}
|
|
3654
3718
|
|
|
3655
|
-
export { AGENTS_BASE_PATH, AGENTS_ROUTES, AGENTS_WS_BASE_PATH, AGENTS_WS_CHANNELS, AGENT_ANALYTICS_EVENTS, AGENT_MODES, type AgentAnalyticsEvent, type AgentConfig, type AgentEndEvent, type AgentErrorEvent, type AgentEvent, type AgentEventBase, type AgentEventCallback, type AgentEventEmitter, type AgentEventType, type AgentMemory, type AgentMode, type AgentResponseMode, type AgentSession, type AgentSessionInfo, type AgentSmartTieringConfig, type AgentSpecBudgetConfig, type AgentSpecification, type AgentStartEvent, type AgentTokenBudgetConfig, type AgentsPluginConfig, type AnalyzeResponse, type ApproveSessionPlanRequest, type ApproveSessionPlanResponse, type ArchiveEntry, type ArchiveStoreEvent, type AssumptionRecord, type AsyncTask, type AsyncTaskStatus, type BaseTraceEntry, type ClaimVerificationResult, type ClientMessage, type CompareResponse, type ConflictInfo, type ConflictResolutionConfig, type ConnectionReadyMessage, type ContextSnapshotEvent, type ContextTrimEvent, type ControlAction, type ConversationSnapshotMessage, type CorrectionAckMessage, type CorrectionRecord, type CorrectionRequest, type CorrectionResponse, type CreateSessionRequest, type CreateSessionResponse, DEFAULT_AGENT_TOKEN_BUDGET_CONFIG, DEFAULT_FEATURE_FLAGS, DEFAULT_FILE_HISTORY_CONFIG, DEFAULT_VERIFICATION_THRESHOLDS, type DebugContext, type DecisionPointEvent, type DecisionRecord, type DecompositionDecision, type DecompositionTaskType, type DetailedTraceEntry, type EditContext, type ErrorCapturedEvent, type ErrorMessage, type ErrorStep, type EscalationLevelConfig, type EscalationPolicy, type EvidenceRecord, type EvidenceRequirements, type ExecuteContext, type ExecuteSessionPlanRequest, type ExecuteSessionPlanResponse, type ExecutionMode, type ExecutionPlan, type ExportResponse, type FactAddedEvent, type FactCategory, type FactSheetEntry, type FeatureFlags, type FileChangeSummary, type FileHistoryConfig, type FileHistoryStorageConfig, type FilterResponse, type GenerateSpecRequest, type GenerateSpecResponse, type GetSessionPlanResponse, type GetSessionRequest, type GetSessionResponse, type GetSpecResponse, type HumanEscalationConfig, type IterationDetailEvent, type IterationEndEvent, type IterationResponse, type IterationSnapshot, type IterationStartEvent, type KernelEntryKind, type KernelMemoryState, type KernelState, type LLMCallEvent, type LLMChunkEvent, type LLMDebugEvent, type LLMEndEvent, type LLMStartEvent, type LLMStreamEvent, type LLMTier, type LLMValidationEvent, type ListAgentsResponse, type ListSessionsRequest, type ListSessionsResponse, type LoopResult, type MemoryCategory, type MemoryConfig, type MemoryEntry, type MemoryReadEvent, type MemoryRollup, type MemorySnapshotEvent, type MemorySummary, type MemoryWriteEvent, type MiddlewareConfig, type MiddlewareDecisionEvent, type MiddlewareFailPolicy, type ModeConfig, type ModeContext, type OpenQuestionRecord, type PackedTool, type PendingActionRecord, type PersistentMemory, type Phase, type PingMessage, type PlanContext, type PlanUpdate, type PlanUpdateAction, type ProgressUpdateEvent, type ProjectContext, type PromptContextSelection, type PromptDiffEvent, type QualityMetrics, type ReflectionResult, type ReplayResponse, type RepositoryConventions, type RepositoryFingerprints, type RepositoryModel, type RepositorySignal, type RepositoryStack, type RepositoryTopology, type RepositoryWorkspaceLayout, type ResolvedTool, type ResultProcessor, type RollbackResult, type RoutingHints, type RunCompletedMessage, type RunEvaluation, type RunEvaluationRecommendation, type RunHandoff, type RunRequest, type RunResponse, type RunStatusResponse, type RuntimeTurnRecord, type ServerMessage, type SessionEntry, type SessionProgress, type SessionSnapshot, type SnapshotResponse, type SpawnAgentRequest, type SpawnAgentResult, type SpecChange, type SpecSection, type StatsResponse, type StatusChangeEvent, type Step, type StopConditionResult, StopPriority, type StopRequest, type StopRequestMessage, type StopResponse, type StoppingAnalysisEvent, type SubAgentPreset, type SubAgentStep, type Subtask, type SubtaskEndEvent, type SubtaskStartEvent, type SummarizationLLMCallEvent, type SummarizationResultEvent, type SynthesisCompleteEvent, type SynthesisForcedEvent, type SynthesisForcedTraceEvent, type SynthesisStartEvent, TASK_STATUSES, TODO_PRIORITIES, TODO_STATUSES, type TailResponse, type TaskEndEvent, type TaskPlan, type TaskResult, type TaskSpec, type TaskStartEvent, type TaskStatus, type TextStep, type ThinkingChunkEvent, type ThinkingEndEvent, type ThinkingStartEvent, type ThinkingStep, type TodoItem, type TodoList, type TodoPriority, type TodoStatus, type ToolCall, type ToolCallRecord, type ToolCapability, type ToolConflictPolicy, type ToolDefinition, type ToolEndEvent, type ToolErrorEvent, type ToolEventMetadata, type ToolExecutionEvent, type ToolFilter, type ToolFilterEvent, type ToolPack, type ToolPermissions, type ToolResult, type ToolResultArtifact, type ToolResultRecord, type ToolResultStep, type ToolResultsSummary, type ToolStartEvent, type ToolUseStep, type TraceCommandResponse, type TraceEntry, type TraceErrorCode, TraceErrorCodes, type TraceEventType, type Tracer, type Turn, type
|
|
3719
|
+
export { AGENTS_BASE_PATH, AGENTS_ROUTES, AGENTS_WS_BASE_PATH, AGENTS_WS_CHANNELS, AGENT_ANALYTICS_EVENTS, AGENT_MODES, type AgentAnalyticsEvent, type AgentConfig, type AgentEndEvent, type AgentErrorEvent, type AgentEvent, type AgentEventBase, type AgentEventCallback, type AgentEventEmitter, type AgentEventType, type AgentMemory, type AgentMode, type AgentResponseMode, type AgentSession, type AgentSessionInfo, type AgentSmartTieringConfig, type AgentSpecBudgetConfig, type AgentSpecification, type AgentStartEvent, type AgentTokenBudgetConfig, type AgentsPluginConfig, type AnalyzeResponse, type ApproveSessionPlanRequest, type ApproveSessionPlanResponse, type ArchiveEntry, type ArchiveStoreEvent, type AssumptionRecord, type AsyncTask, type AsyncTaskStatus, type BaseTraceEntry, type ClaimVerificationResult, type ClientMessage, type CompareResponse, type ConflictInfo, type ConflictResolutionConfig, type ConnectionReadyMessage, type ContextSnapshotEvent, type ContextTrimEvent, type ControlAction, type ConversationSnapshotMessage, type CorrectionAckMessage, type CorrectionRecord, type CorrectionRequest, type CorrectionResponse, type CreateSessionRequest, type CreateSessionResponse, DEFAULT_AGENT_TOKEN_BUDGET_CONFIG, DEFAULT_FEATURE_FLAGS, DEFAULT_FILE_HISTORY_CONFIG, DEFAULT_VERIFICATION_THRESHOLDS, type DebugContext, type DecisionPointEvent, type DecisionRecord, type DecompositionDecision, type DecompositionTaskType, type DetailedTraceEntry, type EditContext, type ErrorCapturedEvent, type ErrorMessage, type ErrorStep, type EscalationLevelConfig, type EscalationPolicy, type EvidenceRecord, type EvidenceRequirements, type ExecuteContext, type ExecuteSessionPlanRequest, type ExecuteSessionPlanResponse, type ExecutionMode, type ExecutionPlan, type ExportResponse, type FactAddedEvent, type FactCategory, type FactSheetEntry, type FeatureFlags, type FileChangeSummary, type FileHistoryConfig, type FileHistoryStorageConfig, type FilterResponse, type GenerateSpecRequest, type GenerateSpecResponse, type GetSessionPlanResponse, type GetSessionRequest, type GetSessionResponse, type GetSpecResponse, type HumanEscalationConfig, type IterationDetailEvent, type IterationEndEvent, type IterationResponse, type IterationSnapshot, type IterationStartEvent, type KernelEntryKind, type KernelMemoryState, type KernelState, type LLMCallEvent, type LLMChunkEvent, type LLMDebugEvent, type LLMEndEvent, type LLMStartEvent, type LLMStreamEvent, type LLMTier, type LLMValidationEvent, type ListAgentsResponse, type ListSessionsRequest, type ListSessionsResponse, type LoopResult, type MemoryCategory, type MemoryConfig, type MemoryEntry, type MemoryReadEvent, type MemoryRollup, type MemorySnapshotEvent, type MemorySummary, type MemoryWriteEvent, type MiddlewareConfig, type MiddlewareDecisionEvent, type MiddlewareFailPolicy, type ModeConfig, type ModeContext, type OpenQuestionRecord, type PackedTool, type PendingActionRecord, type PersistentMemory, type Phase, type PingMessage, type PlanContext, type PlanUpdate, type PlanUpdateAction, type ProgressUpdateEvent, type ProjectContext, type PromptContextSelection, type PromptDiffEvent, type QualityMetrics, type ReflectionResult, type ReplayResponse, type RepositoryConventions, type RepositoryFingerprints, type RepositoryModel, type RepositorySignal, type RepositoryStack, type RepositoryTopology, type RepositoryWorkspaceLayout, type ResolvedTool, type ResultProcessor, type RollbackResult, type RoutingHints, type RunCompletedMessage, type RunEvaluation, type RunEvaluationRecommendation, type RunHandoff, type RunRequest, type RunResponse, type RunStatusResponse, type RuntimeTurnRecord, type ServerMessage, type SessionEntry, type SessionProgress, type SessionSnapshot, type SnapshotResponse, type SpawnAgentRequest, type SpawnAgentResult, type SpecChange, type SpecSection, type StatsResponse, type StatusChangeEvent, type Step, type StopConditionResult, StopPriority, type StopRequest, type StopRequestMessage, type StopResponse, type StoppingAnalysisEvent, type SubAgentPreset, type SubAgentStep, type Subtask, type SubtaskEndEvent, type SubtaskStartEvent, type SummarizationLLMCallEvent, type SummarizationResultEvent, type SynthesisCompleteEvent, type SynthesisForcedEvent, type SynthesisForcedTraceEvent, type SynthesisStartEvent, TASK_STATUSES, TODO_PRIORITIES, TODO_STATUSES, type TailResponse, type TaskEndEvent, type TaskPlan, type TaskResult, type TaskSpec, type TaskStartEvent, type TaskStatus, type TextStep, type ThinkingChunkEvent, type ThinkingEndEvent, type ThinkingStartEvent, type ThinkingStep, type TodoItem, type TodoList, type TodoPriority, type TodoStatus, type ToolCall, type ToolCallRecord, type ToolCapability, type ToolConflictPolicy, type ToolDefinition, type ToolEndEvent, type ToolErrorEvent, type ToolEventMetadata, type ToolExecutionEvent, type ToolFilter, type ToolFilterEvent, type ToolPack, type ToolPermissions, type ToolResult, type ToolResultArtifact, type ToolResultRecord, type ToolResultStep, type ToolResultsSummary, type ToolStartEvent, type ToolUseStep, type TraceCommandResponse, type TraceEntry, type TraceErrorCode, TraceErrorCodes, type TraceEventType, type Tracer, type Turn, type TurnDelta, type TurnDeltaMessage, type TurnInterpretation, type TurnKind, type TurnStep, type TwoTierMemoryConfig, type UserCorrectionMessage, type VerificationCompleteEvent, type VerificationEventData, type VerificationInput, type VerificationOutput, type VerificationResult, type VerificationStartEvent, type VerificationThresholds, type VerificationWarning, type VerificationWarningCode, buildRestRoute, buildWsChannel, schemas };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kb-labs/agent-contracts",
|
|
3
3
|
"description": "Type definitions and contracts for KB Labs Agents. IDs, Session, Specification, Gates, Multi-Agent types.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.119.0-canary.cee505c72",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|