@spottoai/types-package 1.0.2-beta.155 → 1.0.2-beta.157

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.
@@ -1,27 +1,26 @@
1
1
  /** Common AI interfaces shared between frontend and backend */
2
- export type AIResponseStatus = 'complete' | 'needs_clarification' | 'needs_more_metrics';
2
+ export type AIResponseStatus = 'complete' | 'needsClarification' | 'needsMoreMetrics';
3
3
  export type RecommendationPillar = 'Cost Optimization' | 'Performance Efficiency' | 'Security' | 'Reliability' | 'Operational Excellence';
4
- export type RecommendationType = 'advisor' | 'custom' | 'ai_generated';
4
+ export type RecommendationType = 'advisor' | 'custom' | 'aiGenerated';
5
5
  export interface RecommendationAction {
6
6
  action: 'fix';
7
- recommendation_id: string;
7
+ recommendationId: string;
8
8
  }
9
9
  export interface AIRecommendation {
10
- priority_rank: number;
10
+ priorityRank: number;
11
11
  pillar: RecommendationPillar;
12
12
  description: string;
13
13
  type: RecommendationType;
14
- reference_ids: string[];
14
+ referenceIds: string[];
15
15
  actions: RecommendationAction[];
16
16
  }
17
17
  export interface StructuredAIResponse {
18
18
  status: AIResponseStatus;
19
- clarification_request: string | null;
20
- metrics_request: string[];
21
- friendly_message: string;
19
+ clarificationRequest: string | null;
20
+ metricsRequest: string[];
21
+ friendlyMessage: string;
22
22
  recommendations: AIRecommendation[];
23
23
  }
24
- /** Common PageContext interface - unified version */
25
24
  export interface PageContext {
26
25
  pageType: 'resource-detail' | 'recommendation-detail' | 'dashboard' | string;
27
26
  pageId?: string;
@@ -32,23 +31,20 @@ export interface PageContext {
32
31
  resourceId?: string;
33
32
  recommendationId?: string;
34
33
  pageUrl?: string;
35
- ui_state?: Record<string, unknown>;
34
+ uiState?: Record<string, unknown>;
36
35
  contextHash?: string;
37
36
  }
38
- /** Common message interface for AI conversations */
39
37
  export interface AIMessage {
40
38
  role: 'user' | 'assistant';
41
39
  content: string;
42
- /** Date for backend, string for frontend */
43
40
  timestamp: Date | string;
44
41
  structuredResponse?: StructuredAIResponse;
45
- /** Response ID for continuity */
46
42
  responseId?: string;
47
43
  }
48
44
  export type AIChatMode = 'page' | 'workspace';
49
45
  type AIWorkspaceScopePolicyOutcome = 'accepted' | 'intersected' | 'rejected';
50
46
  interface AIWorkspaceScopeAllAuthorizedRequest {
51
- mode: 'all_authorized';
47
+ mode: 'allAuthorized';
52
48
  companyIds?: never;
53
49
  subscriptionIds?: never;
54
50
  resourceIds?: never;
@@ -82,299 +78,610 @@ export interface AIResolvedWorkspaceScope {
82
78
  rejectedResourceIds?: string[];
83
79
  }
84
80
  export type AIChatSkillId = string;
85
- type AIChatDomain = 'cost' | 'performance' | 'security' | 'reliability' | 'governance' | 'operations' | 'general';
86
- type AIChatIntentLabel = 'ask_summary' | 'investigate_cost' | 'investigate_security' | 'investigate_reliability' | 'investigate_governance' | 'execute_action' | 'explain_recommendation' | 'unknown';
87
- type AIChatComplexity = 'simple' | 'standard' | 'complex';
88
- interface AIChatClassificationIntent {
81
+ export type AIChatDomain = 'cost' | 'performance' | 'security' | 'reliability' | 'governance' | 'operations' | 'general';
82
+ export type AIChatIntentLabel = 'askSummary' | 'investigateCost' | 'investigateSecurity' | 'investigateReliability' | 'investigateGovernance' | 'executeAction' | 'explainRecommendation' | 'unknown';
83
+ export type AIChatComplexity = 'simple' | 'standard' | 'complex';
84
+ export interface AIChatClassificationIntent {
89
85
  label: AIChatIntentLabel;
90
86
  confidence: number;
91
87
  }
92
- interface AIChatClassificationResult {
88
+ export interface AIChatClassificationResult {
93
89
  version: string;
94
90
  intents: AIChatClassificationIntent[];
95
91
  complexity: AIChatComplexity;
96
92
  requiresTools: boolean;
97
- suggestedSkillIds: AIChatSkillId[];
93
+ suggestedSkillPackIds: AIChatSkillId[];
98
94
  }
99
- interface AIChatSkillClassificationResult {
95
+ type AIChatRoutingReasonCode = 'AI_SKILL_EXPLICIT_ACCEPTED' | 'AI_SKILL_EXPLICIT_REJECTED_MODE' | 'AI_SKILL_EXPLICIT_REJECTED_POLICY' | 'AI_SKILL_CLASSIFIER_SELECTED' | 'AI_SKILL_CLASSIFIER_LOW_CONFIDENCE' | 'AI_SKILL_FALLBACK_DEFAULT';
96
+ type AIChatScopeReasonCode = 'AI_SCOPE_EMPTY_REQUEST' | 'AI_SCOPE_EMPTY_EFFECTIVE' | 'AI_SCOPE_REDUCED_UNAUTHORIZED_MEMBERS' | 'AI_SCOPE_INVALID';
97
+ type AIChatApprovalReasonCode = 'AI_MUTATION_CONFIRMATION_REQUIRED' | 'AI_MUTATION_CONFIRMATION_EXPIRED' | 'AI_MUTATION_CONFIRMATION_REJECTED';
98
+ type AIChatDegradedReasonCode = 'AI_LEARN_MCP_UNAVAILABLE' | 'AI_LEARN_MCP_TIMEOUT' | 'AI_TOOL_TIMEOUT' | 'AI_TOOL_PARTIAL_FAILURE' | 'AI_DEGRADED_NO_PATH';
99
+ type AIChatOrchestrationReasonCode = 'AI_ROUTE_GENERIC' | 'AI_ROUTE_ANALYSIS' | 'AI_ROUTE_GENERIC_FALLBACK_MEDIUM_CONFIDENCE' | 'AI_ROUTE_CLARIFY_LOW_CONFIDENCE' | 'AI_PLAN_CREATED' | 'AI_PLAN_NO_ELIGIBLE_SPECIALISTS' | 'AI_SPECIALIST_STARTED' | 'AI_SPECIALIST_COMPLETED' | 'AI_SPECIALIST_FAILED' | 'AI_SYNTHESIS_COMPLETED' | 'AI_SYNTHESIS_CONFLICT_DETECTED' | 'AI_CRITIC_SKIPPED' | 'AI_CRITIC_PASS' | 'AI_CRITIC_REVISE' | 'AI_REVISION_LOOP_LIMIT_REACHED';
100
+ export type AIChatReasonCode = AIChatRoutingReasonCode | AIChatScopeReasonCode | AIChatApprovalReasonCode | AIChatDegradedReasonCode | AIChatOrchestrationReasonCode;
101
+ export type AIRouteReasonCode = 'route.low_confidence' | 'route.page_context_sufficient' | 'route.cross_domain_analysis_required' | 'route.retrieval_required' | 'route.missing_required_inputs' | `route.${string}`;
102
+ export type AIToolReasonCode = 'tool.not_authorized' | 'tool.out_of_scope' | 'tool.missing_required_arguments' | 'tool.requires_confirmation' | 'tool.not_applicable_to_page' | `tool.${string}`;
103
+ export type AIFreshnessReasonCode = 'freshness.current' | 'freshness.stale_source' | 'freshness.partial_data' | 'freshness.refresh_in_progress' | `freshness.${string}`;
104
+ export type AISchemaReasonCode = 'schema.parse_failed' | 'schema.validation_failed' | 'schema.missing_required_field' | 'schema.invalid_enum_value' | `schema.${string}`;
105
+ export type AIReasonCode = AIRouteReasonCode | AIToolReasonCode | AIFreshnessReasonCode | AISchemaReasonCode;
106
+ export interface AISchemaIssue {
107
+ reasonCode: AISchemaReasonCode;
108
+ fieldPath?: string;
109
+ detail?: string;
110
+ }
111
+ export interface AIChatSkillClassificationCandidate {
112
+ skillId: AIChatSkillId;
113
+ score: number;
114
+ reasonCodes: AIChatReasonCode[];
115
+ }
116
+ export interface AIChatSkillClassificationResult {
100
117
  classifierVersion: string;
101
- requestedSkillId?: AIChatSkillId;
102
- selectedSkillId?: AIChatSkillId;
118
+ requestedSkillPackId?: AIChatSkillId;
119
+ selectedSkillPackId?: AIChatSkillId;
103
120
  candidates: AIChatSkillClassificationCandidate[];
104
121
  reasonCodes?: AIChatReasonCode[];
105
122
  }
106
- type AIChatRoutingStrategy = 'single_agent' | 'fanout';
107
- interface AIChatRoutingSubtaskPlan {
123
+ export type AIChatRoutingStrategy = 'singleAgent' | 'fanout';
124
+ export interface AIChatRoutingSubtaskPlan {
108
125
  subtaskId: string;
109
126
  domain: AIChatDomain;
110
127
  title: string;
111
- skillId?: AIChatSkillId;
128
+ skillPackId?: AIChatSkillId;
112
129
  }
113
- interface AIChatRoutingDecision {
130
+ export interface AIChatRoutingDecision {
114
131
  strategy: AIChatRoutingStrategy;
115
132
  selectedMode: AIChatMode;
116
- selectedSkillIds: AIChatSkillId[];
133
+ selectedSkillPackIds: AIChatSkillId[];
117
134
  reasonCodes: AIChatReasonCode[];
118
135
  subtasks?: AIChatRoutingSubtaskPlan[];
119
136
  }
120
- interface AIChatSkillRouteTarget {
121
- skillId: AIChatSkillId;
122
- skillVersion: string;
137
+ export type AIChatSkillRouteSource = 'auto' | 'explicit' | 'default';
138
+ export type AIChatSkillRoutePolicyOutcome = 'accepted' | 'fallback' | 'rejected';
139
+ export interface AIChatSkillRouteTarget {
140
+ skillPackId: AIChatSkillId;
141
+ skillPackVersion: string;
123
142
  routeSource: AIChatSkillRouteSource;
124
143
  policyOutcome: AIChatSkillRoutePolicyOutcome;
125
144
  }
126
- interface AIChatSkillRoutingFallback {
127
- fromSkillId?: AIChatSkillId;
145
+ export interface AIChatSkillRoutingFallback {
146
+ fromSkillPackId?: AIChatSkillId;
128
147
  toRoute: AIChatSkillRouteTarget;
129
148
  reasonCode: AIChatReasonCode;
130
149
  }
131
- interface AIChatSkillRoutingDecision {
132
- requestedSkillId?: AIChatSkillId;
133
- selectedSkillId?: AIChatSkillId;
150
+ export interface AIChatSkillRoutingDecision {
151
+ requestedSkillPackId?: AIChatSkillId;
152
+ selectedSkillPackId?: AIChatSkillId;
134
153
  route: AIChatSkillRouteTarget;
135
154
  reasonCodes: AIChatReasonCode[];
136
155
  fallback?: AIChatSkillRoutingFallback;
137
156
  }
138
- type AIChatClassificationMetadata = AIChatClassificationResult | AIChatSkillClassificationResult;
139
- type AIChatRoutingMetadata = AIChatRoutingDecision | AIChatSkillRoutingDecision;
140
- type AIChatRoutingReasonCode = 'AI_SKILL_EXPLICIT_ACCEPTED' | 'AI_SKILL_EXPLICIT_REJECTED_MODE' | 'AI_SKILL_EXPLICIT_REJECTED_POLICY' | 'AI_SKILL_CLASSIFIER_SELECTED' | 'AI_SKILL_CLASSIFIER_LOW_CONFIDENCE' | 'AI_SKILL_FALLBACK_DEFAULT';
141
- type AIChatScopeReasonCode = 'AI_SCOPE_EMPTY_REQUEST' | 'AI_SCOPE_EMPTY_EFFECTIVE' | 'AI_SCOPE_REDUCED_UNAUTHORIZED_MEMBERS' | 'AI_SCOPE_INVALID';
142
- type AIChatConfirmationReasonCode = 'AI_MUTATION_CONFIRMATION_REQUIRED' | 'AI_MUTATION_CONFIRMATION_EXPIRED' | 'AI_MUTATION_CONFIRMATION_REJECTED';
143
- type AIChatDegradedReasonCode = 'AI_LEARN_MCP_UNAVAILABLE' | 'AI_LEARN_MCP_TIMEOUT' | 'AI_TOOL_TIMEOUT' | 'AI_TOOL_PARTIAL_FAILURE' | 'AI_DEGRADED_NO_PATH';
144
- type AIChatOrchestrationReasonCode = 'AI_ROUTE_GENERIC' | 'AI_ROUTE_ANALYSIS' | 'AI_ROUTE_GENERIC_FALLBACK_MEDIUM_CONFIDENCE' | 'AI_ROUTE_CLARIFY_LOW_CONFIDENCE' | 'AI_PLAN_CREATED' | 'AI_PLAN_NO_ELIGIBLE_SPECIALISTS' | 'AI_SPECIALIST_STARTED' | 'AI_SPECIALIST_COMPLETED' | 'AI_SPECIALIST_FAILED' | 'AI_SYNTHESIS_COMPLETED' | 'AI_SYNTHESIS_CONFLICT_DETECTED' | 'AI_CRITIC_SKIPPED' | 'AI_CRITIC_PASS' | 'AI_CRITIC_REVISE' | 'AI_REVISION_LOOP_LIMIT_REACHED';
145
- export type AIChatReasonCode = AIChatRoutingReasonCode | AIChatScopeReasonCode | AIChatConfirmationReasonCode | AIChatDegradedReasonCode | AIChatOrchestrationReasonCode;
146
- type AIChatConfirmationDecisionValue = 'approve' | 'reject';
147
- export interface AIChatConfirmationResponse {
148
- challengeId: string;
149
- decision: AIChatConfirmationDecisionValue;
150
- idempotencyKey: string;
157
+ export type AIChatClassificationMetadata = AIChatClassificationResult | AIChatSkillClassificationResult;
158
+ export type AIChatRoutingMetadata = AIChatRoutingDecision | AIChatSkillRoutingDecision;
159
+ export type AIEntityType = 'company' | 'subscription' | 'resource' | 'recommendation' | string;
160
+ export interface AIEntityRef {
161
+ id: string;
162
+ label?: string;
163
+ type: AIEntityType;
164
+ }
165
+ export type AIPageIntentHint = 'thisPage' | 'theseRows' | 'thisResource' | 'crossPage';
166
+ export interface AIPageFreshness {
167
+ capturedAt: string;
168
+ dataAsOf?: string;
169
+ isStale?: boolean;
170
+ stalenessReason?: string;
171
+ reasonCode?: AIFreshnessReasonCode;
172
+ }
173
+ export interface AIChatPageSnapshot {
174
+ pageType: string;
175
+ pageId?: string;
176
+ pageUrl?: string;
177
+ companyId?: string;
178
+ title?: string;
179
+ summary?: string;
180
+ routePath?: string;
181
+ tab?: string;
182
+ view?: string;
183
+ selectedEntities: AIEntityRef[];
184
+ scopeLabels: {
185
+ company?: string;
186
+ subscriptions?: string[];
187
+ resources?: string[];
188
+ };
189
+ uiState?: Record<string, unknown>;
190
+ loadedDataHints?: string[];
191
+ intentHints?: AIPageIntentHint[];
192
+ freshness?: AIPageFreshness;
193
+ }
194
+ export type AIChatMutationMode = 'read' | 'writeRequiresApproval' | 'writeBlocked';
195
+ export interface AIChatToolAffordanceEntry {
196
+ toolName: string;
197
+ title?: string;
198
+ reasonCode?: AIReasonCode;
199
+ reason?: string;
200
+ missingArgs?: string[];
201
+ requiresApproval?: boolean;
202
+ }
203
+ export interface AIChatBlockedToolAffordanceEntry extends AIChatToolAffordanceEntry {
204
+ blockReasonCode?: AIReasonCode;
205
+ blockReason?: string;
206
+ }
207
+ export interface AIChatToolAffordanceSnapshot {
208
+ availableTools: AIChatToolAffordanceEntry[];
209
+ applicableTools: AIChatToolAffordanceEntry[];
210
+ deferredTools: AIChatToolAffordanceEntry[];
211
+ writeTools: AIChatToolAffordanceEntry[];
212
+ blockedTools: AIChatBlockedToolAffordanceEntry[];
213
+ }
214
+ export type AIOrchestrationPath = 'clarify' | 'pageAnswer' | 'genericToolLoop' | 'analysisWithRetrieval';
215
+ export interface AIRouterDomainScore {
216
+ name: 'cost' | 'performance' | 'reliability' | 'security' | 'operations' | string;
217
+ confidence: number;
151
218
  }
152
- /**
153
- * Normalized confidence score in the range [0..1].
154
- */
155
- type AIAnalysisConfidence = number;
156
- type AIChatOrchestrationRoute = 'generic' | 'analysis';
157
- type AIChatEffectivePath = AIChatOrchestrationRoute | 'clarify';
158
- type AIChatCriticOutcome = 'skipped' | 'pass' | 'revise';
159
- type AIChatSpecialistCompletionStatus = 'completed' | 'failed';
160
- type AIChatAnalysisConfidenceSource = 'routing' | 'planner' | 'specialist' | 'synthesis' | 'critic' | 'final';
161
- interface AIChatRoutingDomainScore {
162
- name: string;
219
+ export interface AIRouterOutput {
220
+ path: AIOrchestrationPath;
163
221
  confidence: number;
222
+ entitiesInFocus: string[];
223
+ domains: AIRouterDomainScore[];
224
+ needsRetrieval: boolean;
225
+ missingInputs: string[];
226
+ reasonCode?: AIRouteReasonCode;
227
+ whyThisPath?: string;
228
+ complexity?: AIChatComplexity;
229
+ }
230
+ export type AIPlannerPriority = 'P1' | 'P2' | 'P3';
231
+ export interface AIPlannerWorkItem {
232
+ workItemId: string;
233
+ domain: string;
234
+ task: string;
235
+ priority: AIPlannerPriority;
164
236
  }
165
- interface AIChatRoutingStartedPayload {
166
- requestedMode?: AIChatMode;
167
- requestedSkillIds?: AIChatSkillId[];
168
- /**
169
- * Runtime alias used by current API emitter.
170
- */
171
- chatMode?: AIChatMode;
237
+ export interface AIPlannerRetrievalStep {
238
+ retrievalId: string;
239
+ toolName: string;
240
+ purpose: string;
241
+ arguments: Record<string, unknown>;
242
+ required: boolean;
172
243
  }
173
- interface AIChatRoutingCompletedPayload {
174
- route: AIChatOrchestrationRoute;
175
- effectivePath?: AIChatEffectivePath;
176
- confidence?: number;
177
- domains?: AIChatRoutingDomainScore[];
178
- reasonCodes: AIChatReasonCode[];
179
- analysisConfidence?: AIAnalysisConfidence;
180
- selectedSkillIds?: AIChatSkillId[];
181
- decision?: AIChatRoutingDecision;
244
+ export interface AIPlannerOutput {
245
+ investigationGoal: string;
246
+ decisionToSupport: string;
247
+ workItems: AIPlannerWorkItem[];
248
+ retrievalPlan: AIPlannerRetrievalStep[];
249
+ successCriteria: string[];
182
250
  }
183
- interface AIChatGenericStartedPayload {
184
- reasonCode?: AIChatReasonCode;
185
- reasonCodes?: AIChatReasonCode[];
251
+ export type AICitationSourceType = 'toolResult' | 'pageData' | 'document' | 'metric' | 'log' | string;
252
+ export interface AIChatCitation {
253
+ citationId: string;
254
+ sourceType: AICitationSourceType;
255
+ title: string;
256
+ locator: string;
257
+ snippet?: string;
258
+ toolName?: string;
259
+ retrievedAt: string;
186
260
  }
187
- interface AIChatGenericCompletedPayload {
188
- reasonCode?: AIChatReasonCode;
189
- reasonCodes?: AIChatReasonCode[];
190
- responseStatus?: AIResponseStatus;
191
- responseId?: string;
261
+ export interface AIChatToolExecutionError {
262
+ message: string;
263
+ reasonCode?: AIReasonCode;
264
+ retryable?: boolean;
265
+ details?: unknown;
192
266
  }
193
- interface AIChatPlannerStartedPayload {
194
- route?: 'analysis';
195
- domains?: AIChatRoutingDomainScore[];
267
+ export interface AIChatToolExecutionResult {
268
+ ok: boolean;
269
+ data?: unknown;
270
+ error?: AIChatToolExecutionError;
271
+ truncated?: boolean;
196
272
  }
197
- interface AIChatPlannerCompletedPayload {
198
- planCreated?: boolean;
199
- reasonCodes?: AIChatReasonCode[];
200
- subtasks?: AIChatRoutingSubtaskPlan[];
201
- note?: string;
202
- domains?: string[];
203
- tasks?: string[];
204
- selectedSpecialists?: string[];
273
+ export interface AIToolError extends AIChatToolExecutionError {
274
+ code: string;
205
275
  }
206
- interface AIChatSpecialistStartedPayload {
207
- specialistId: string;
208
- domain: AIChatDomain;
209
- skillId?: AIChatSkillId;
210
- title?: string;
211
- reasonCode?: AIChatReasonCode;
212
- revisionLoop?: number;
276
+ export interface AIToolResult extends AIChatToolExecutionResult {
277
+ toolName: string;
278
+ error?: AIToolError;
213
279
  }
214
- interface AIChatSpecialistProgressPayload {
215
- specialistId: string;
216
- domain: AIChatDomain;
217
- message: string;
218
- progressPercent?: number;
219
- revisionLoop?: number;
280
+ export interface AIToolCall {
281
+ callId: string;
282
+ toolName: string;
283
+ arguments: Record<string, unknown>;
220
284
  }
221
- interface AIChatSpecialistCompletedPayload {
222
- specialistId: string;
223
- domain: AIChatDomain;
224
- status: AIChatSpecialistCompletionStatus;
225
- confidence?: number;
285
+ export interface AIRetrievalExecutionStep {
286
+ retrievalId: string;
287
+ toolName: string;
288
+ argsHash: string;
289
+ startedAt: string;
290
+ endedAt?: string;
291
+ status: 'ok' | 'error' | 'skipped';
226
292
  summary?: string;
227
- reasonCode?: AIChatReasonCode;
293
+ callId?: string;
228
294
  error?: AIToolError;
229
- revisionLoop?: number;
230
- }
231
- interface AIChatSynthesisStartedPayload {
232
- specialistCount?: number;
233
- specialists?: string[];
234
- revisionLoop?: number;
235
- }
236
- interface AIChatSynthesisCompletedPayload {
237
- confidence?: number;
238
- /**
239
- * Canonical field name for UI consumers.
240
- */
295
+ citationIds: string[];
296
+ rawHandle?: string;
297
+ }
298
+ export interface AIEvidenceEntry {
299
+ evidenceId: string;
300
+ sourceTool: string;
301
+ argsHash: string;
302
+ timestamp: string;
303
+ status: 'ok' | 'error' | 'partial';
304
+ summary: string;
305
+ rawHandle?: string;
306
+ citationIds: string[];
307
+ domains?: string[];
308
+ }
309
+ export interface AIEvidenceGap {
310
+ gapId: string;
311
+ description: string;
312
+ blocking: boolean;
313
+ suggestedFollowup?: string;
314
+ }
315
+ export interface AIEvidenceLabelMap {
316
+ companies?: Record<string, string>;
317
+ subscriptions?: Record<string, string>;
318
+ resources?: Record<string, string>;
319
+ recommendations?: Record<string, string>;
320
+ }
321
+ export interface AIEvidenceBundle {
322
+ bundleId: string;
323
+ entries: AIEvidenceEntry[];
324
+ citations: AIChatCitation[];
325
+ labelMap: AIEvidenceLabelMap;
326
+ gaps: AIEvidenceGap[];
327
+ createdAt: string;
328
+ }
329
+ export interface AIRetrievalExecution {
330
+ retrievalPlan: AIPlannerRetrievalStep[];
331
+ executionSteps: AIRetrievalExecutionStep[];
332
+ followupPassExecuted: boolean;
333
+ evidenceBundle: AIEvidenceBundle;
334
+ }
335
+ export interface AISpecialistAction {
336
+ title: string;
337
+ risk: 'low' | 'medium' | 'high';
338
+ effort: 'low' | 'medium' | 'high';
339
+ }
340
+ export interface AISpecialistTradeoff {
341
+ withDomain: string;
342
+ summary: string;
343
+ }
344
+ export interface AISpecialistOutput {
345
+ specialistId: string;
346
+ domain: string;
347
+ topFindings: string[];
348
+ evidence: string[];
349
+ actions: AISpecialistAction[];
350
+ tradeoffs: AISpecialistTradeoff[];
351
+ assumptions: string[];
352
+ dataGaps: string[];
353
+ followupRetrieval: AIPlannerRetrievalStep[];
354
+ confidence: number;
355
+ }
356
+ export interface AISynthesisOutput {
357
+ recommendedPlan: string;
358
+ alternatives: string[];
359
+ keyActions: string[];
360
+ risks: string[];
361
+ evidenceTrace: string[];
362
+ unresolvedGaps: string[];
363
+ confidence: number;
364
+ disagreement: boolean;
365
+ }
366
+ export interface AICriticOutput {
367
+ verdict: 'PASS' | 'REVISE';
368
+ confidence: number;
369
+ reason: string;
370
+ issues: string[];
371
+ rerunAgents: string[];
372
+ }
373
+ export type AIHtmlLitePolicy = 'htmlLite';
374
+ export interface AIFormatterOutput {
375
+ policy: AIHtmlLitePolicy;
376
+ answerHtml: string;
377
+ answerText: string;
378
+ citations: AIChatCitation[];
379
+ labelFirstApplied: boolean;
380
+ normalizationHash: string;
381
+ }
382
+ export type AIChatTurnPhase = 'intake' | 'contextResolved' | 'skillResolved' | 'planning' | 'executing' | 'awaitingApproval' | 'formatting' | 'finalizing' | 'completed' | 'errored' | 'cancelled';
383
+ export type AIChatTurnStatus = 'running' | 'waiting' | 'completed' | 'errored' | 'cancelled';
384
+ export interface AIChatTurnState {
385
+ turnId: string;
386
+ phase: AIChatTurnPhase;
387
+ status: AIChatTurnStatus;
388
+ updatedAt: string;
389
+ path?: AIOrchestrationPath;
390
+ analysisConfidence?: number;
391
+ selectedSkillPackId?: AIChatSkillId;
392
+ }
393
+ export type AIChatCommentaryKind = 'preamble' | 'progress' | 'finding' | 'handoff';
394
+ export interface AIChatCommentaryEntry {
395
+ commentaryId: string;
396
+ kind: AIChatCommentaryKind;
397
+ text: string;
398
+ timestamp: string;
399
+ phase?: AIChatTurnPhase;
400
+ progressId?: string;
401
+ }
402
+ export type AIChatPlanStepStatus = 'pending' | 'running' | 'completed' | 'blocked';
403
+ export interface AIChatPlanStep {
404
+ stepId: string;
405
+ label: string;
406
+ status: AIChatPlanStepStatus;
241
407
  summary?: string;
242
- /**
243
- * Canonical field name for UI consumers.
244
- */
245
- conflictDetected?: boolean;
246
- /**
247
- * Runtime alias used by current API emitter.
248
- */
249
- disagreement?: boolean;
250
- reasonCode?: AIChatReasonCode;
251
- reasonCodes?: AIChatReasonCode[];
252
- revisionLoop?: number;
253
- }
254
- interface AIChatCriticStartedPayload {
255
- revisionAttempt?: number;
256
- revisionLoop?: number;
257
- trigger?: {
258
- disagreement?: boolean;
259
- synthesisConfidence?: number;
408
+ domain?: AIChatDomain;
409
+ }
410
+ export interface AIChatPlanSnapshot {
411
+ planId: string;
412
+ goal?: string;
413
+ updatedAt: string;
414
+ steps: AIChatPlanStep[];
415
+ }
416
+ export type AIChatProgressCategory = 'context' | 'routing' | 'planning' | 'retrieval' | 'toolExecution' | 'subtask' | 'approval' | 'formatting' | 'finalization';
417
+ export type AIChatProgressStatus = 'pending' | 'running' | 'completed' | 'blocked' | 'failed' | 'skipped';
418
+ export interface AIChatProgressEntry {
419
+ progressId: string;
420
+ category: AIChatProgressCategory;
421
+ status: AIChatProgressStatus;
422
+ title: string;
423
+ detail?: string;
424
+ timestamp: string;
425
+ phase?: AIChatTurnPhase;
426
+ stepId?: string;
427
+ callId?: string;
428
+ subtaskId?: string;
429
+ reasonCode?: AIReasonCode;
430
+ }
431
+ export type AIChatApprovalState = 'pending' | 'approved' | 'rejected' | 'consumed' | 'expired' | 'completed' | 'failed';
432
+ export interface AIChatApprovalRecord {
433
+ challengeId: string;
434
+ state: AIChatApprovalState;
435
+ actionSummary: string;
436
+ actionType?: string;
437
+ requiredRole: string;
438
+ riskLevel: 'low' | 'medium' | 'high';
439
+ idempotencyKey: string;
440
+ createdAt: string;
441
+ decidedAt?: string;
442
+ expiresAt?: string;
443
+ }
444
+ export interface AIChatSkillPackDescriptor {
445
+ skillId: AIChatSkillId;
446
+ version: string;
447
+ title: string;
448
+ description?: string;
449
+ domains: AIChatDomain[];
450
+ supportedModes: AIChatMode[];
451
+ intentSignals: string[];
452
+ toolPolicy: {
453
+ allowedToolNames?: string[];
454
+ blockedToolNames?: string[];
455
+ allowLearnMcp?: boolean;
456
+ allowMutations: boolean;
457
+ };
458
+ approvalPolicy: {
459
+ required: boolean;
460
+ requiredRole?: string;
461
+ defaultRiskLevel?: 'low' | 'medium' | 'high';
462
+ };
463
+ uxHints?: {
464
+ commentaryStyle?: 'compact' | 'standard';
465
+ showPlanByDefault?: boolean;
466
+ preferredProgressCategories?: AIChatProgressCategory[];
260
467
  };
468
+ fallbackPath?: AIOrchestrationPath;
469
+ enabled: boolean;
261
470
  }
262
- interface AIChatCriticCompletedPayload {
263
- outcome?: AIChatCriticOutcome;
264
- /**
265
- * Runtime alias used by current API emitter.
266
- */
267
- verdict?: 'PASS' | 'REVISE';
268
- confidence?: number;
269
- reason?: string;
270
- rerunAgents?: string[];
271
- summary?: string;
272
- reasonCode?: AIChatReasonCode;
273
- reasonCodes?: AIChatReasonCode[];
471
+ export interface AIChatToolDescriptor {
472
+ toolName: string;
473
+ source: 'internal' | 'learnMcp' | string;
474
+ title: string;
475
+ description: string;
476
+ domains?: AIChatDomain[];
477
+ mutationMode: AIChatMutationMode;
478
+ approvalRequirement?: {
479
+ required: boolean;
480
+ requiredRole?: string;
481
+ riskLevel?: 'low' | 'medium' | 'high';
482
+ };
483
+ scopeHints?: {
484
+ chatModes?: AIChatMode[];
485
+ requiresWorkspaceScope?: boolean;
486
+ pageTypes?: string[];
487
+ };
488
+ evidenceKinds?: string[];
489
+ resultShape?: string;
490
+ usageHints?: string[];
491
+ avoidWhen?: string[];
492
+ }
493
+ export interface AIChatTurnSnapshot {
494
+ turn: AIChatTurnState;
495
+ selectedSkillPack?: AIChatSkillPackDescriptor;
496
+ plan?: AIChatPlanSnapshot;
497
+ commentaryEntries?: AIChatCommentaryEntry[];
498
+ progressEntries?: AIChatProgressEntry[];
499
+ approvalRecords?: AIChatApprovalRecord[];
500
+ toolDescriptors?: AIChatToolDescriptor[];
501
+ }
502
+ export interface AIChatFinalSnapshot {
503
+ turnSnapshot: AIChatTurnSnapshot;
504
+ pageSnapshot?: AIChatPageSnapshot;
505
+ toolAffordanceSnapshot?: AIChatToolAffordanceSnapshot;
506
+ router?: AIRouterOutput;
507
+ planner?: AIPlannerOutput;
508
+ retrieval?: AIRetrievalExecution;
509
+ specialistOutputs?: AISpecialistOutput[];
510
+ synthesis?: AISynthesisOutput;
511
+ critic?: AICriticOutput;
512
+ formatter?: AIFormatterOutput;
513
+ }
514
+ export interface AIChatAuditArtifact {
515
+ conversationId: string;
516
+ turnId: string;
517
+ createdAt: string;
518
+ turnSnapshot: AIChatTurnSnapshot;
519
+ snapshots?: {
520
+ pageSnapshot?: AIChatPageSnapshot;
521
+ toolAffordanceSnapshot?: AIChatToolAffordanceSnapshot;
522
+ };
523
+ router?: AIRouterOutput;
524
+ planner?: AIPlannerOutput;
525
+ retrieval?: AIRetrievalExecution;
526
+ specialists?: AISpecialistOutput[];
527
+ synthesis?: AISynthesisOutput;
528
+ critic?: AICriticOutput;
529
+ formatter?: AIFormatterOutput;
530
+ analysisConfidence?: number;
531
+ }
532
+ export interface AIChatConfirmationResponse {
533
+ challengeId: string;
534
+ decision: 'approve' | 'reject';
535
+ idempotencyKey: string;
536
+ }
537
+ export interface AIChatRoutingHints {
538
+ preferredMode?: AIChatMode;
539
+ preferredSkillPackIds?: AIChatSkillId[];
540
+ forceSkillPackIds?: AIChatSkillId[];
541
+ allowFanout?: boolean;
274
542
  }
275
- interface AIChatRevisionStartedPayload {
276
- attempt?: number;
277
- /**
278
- * Runtime alias used by current API emitter.
279
- */
280
- loop?: number;
281
- targetedSpecialists?: string[];
282
- reasonCode?: AIChatReasonCode;
283
- }
284
- interface AIChatRevisionCompletedPayload {
285
- attempt?: number;
286
- applied?: boolean;
287
- /**
288
- * Runtime alias used by current API emitter.
289
- */
290
- loop?: number;
291
- targetedSpecialists?: string[];
292
- reasonCode?: AIChatReasonCode;
293
- }
294
- interface AIChatAnalysisConfidencePayload {
295
- analysisConfidence: AIAnalysisConfidence;
296
- source?: AIChatAnalysisConfidenceSource;
297
- }
298
- interface AIChatOrchestrationSummary {
299
- routing?: AIChatRoutingCompletedPayload;
300
- generic?: AIChatGenericCompletedPayload;
301
- planner?: AIChatPlannerCompletedPayload;
302
- specialists?: AIChatSpecialistCompletedPayload[];
303
- synthesis?: AIChatSynthesisCompletedPayload;
304
- critic?: AIChatCriticCompletedPayload;
305
- revision?: AIChatRevisionCompletedPayload;
306
- revisions?: AIChatRevisionCompletedPayload[];
307
- }
308
- interface AIChatFinalSnapshot {
543
+ interface AIChatRequestBase {
544
+ conversationId?: string;
545
+ previousResponseId?: string;
546
+ contextHash?: string;
547
+ confirmationResponse?: AIChatConfirmationResponse;
548
+ routingHints?: AIChatRoutingHints;
549
+ stream?: true;
550
+ }
551
+ interface AIChatRequestPage extends AIChatRequestBase {
552
+ chatMode: 'page';
553
+ pageContext: PageContext;
554
+ workspaceScope?: never;
555
+ }
556
+ interface AIChatRequestWorkspace extends AIChatRequestBase {
557
+ chatMode: 'workspace';
558
+ pageContext?: PageContext;
559
+ workspaceScope: AIWorkspaceScopeRequest;
560
+ }
561
+ export type AIChatRequest = (AIChatRequestPage & {
562
+ input: string;
563
+ }) | (AIChatRequestWorkspace & {
564
+ input: string;
565
+ });
566
+ export interface AIConversationScopeMetadata {
309
567
  chatMode?: AIChatMode;
310
- resolvedScope?: AIResolvedWorkspaceScope;
568
+ resolvedWorkspaceScope?: AIResolvedWorkspaceScope;
569
+ selectedSkillPackIds?: AIChatSkillId[];
570
+ }
571
+ export interface AIConversationRoutingMetadata extends AIConversationScopeMetadata {
311
572
  classification?: AIChatClassificationMetadata;
312
573
  routing?: AIChatRoutingMetadata;
313
- selectedSkillIds?: AIChatSkillId[];
314
- analysisConfidence?: AIAnalysisConfidence;
315
- orchestration?: AIChatOrchestrationSummary;
574
+ }
575
+ export interface AIConversationListItem extends AIConversationRoutingMetadata {
576
+ id: string;
577
+ summary?: string;
578
+ messageCount: number;
579
+ lastResponseTime?: Date | string;
580
+ pageUrl?: string;
581
+ pageType?: string;
316
582
  }
317
583
  export interface AIChatUsage {
318
584
  promptTokens: number;
319
585
  completionTokens: number;
320
586
  totalTokens: number;
321
587
  }
322
- interface AIToolError {
323
- code: string;
324
- message: string;
325
- retryable?: boolean;
326
- details?: unknown;
327
- }
328
- export interface AIToolResult {
329
- tool: string;
330
- ok: boolean;
331
- data?: unknown;
332
- error?: AIToolError;
333
- truncated?: boolean;
334
- }
335
- export interface AIToolCall {
336
- id: string;
337
- name: string;
338
- arguments: Record<string, unknown>;
339
- }
340
- type AIChatStreamEventType = 'message' | 'reasoning' | 'tool_call' | 'tool_result' | 'tool_error' | 'status' | 'citation' | 'subtask_start' | 'subtask_done' | 'scope_resolved' | 'skill_classified' | 'skill_routed' | 'skill_fallback' | 'routing_started' | 'routing_completed' | 'generic_started' | 'generic_completed' | 'planner_started' | 'planner_completed' | 'specialist_started' | 'specialist_progress' | 'specialist_completed' | 'synthesis_started' | 'synthesis_completed' | 'critic_started' | 'critic_completed' | 'revision_started' | 'revision_completed' | 'analysis_confidence' | 'confirmation_required' | 'done' | 'error' | 'ping';
341
- interface AIChatStreamEventBase {
342
- event: AIChatStreamEventType;
588
+ export type AIChatStreamEventName = 'scopeResolved' | 'pageSnapshotBuilt' | 'toolAffordanceBuilt' | 'routingStarted' | 'routingCompleted' | 'planCreated' | 'planUpdated' | 'commentary' | 'progressUpdate' | 'toolCall' | 'toolResult' | 'toolError' | 'approvalRequired' | 'approvalStateChanged' | 'formatterStarted' | 'formatterCompleted' | 'message' | 'citation' | 'done' | 'error' | 'ping';
589
+ export interface AIChatStreamEventBase {
590
+ event: AIChatStreamEventName;
343
591
  sequence: number;
344
592
  conversationId: string;
593
+ turnId: string;
345
594
  timestamp: string;
346
595
  }
347
- export interface AIChatMessageEvent extends AIChatStreamEventBase {
348
- event: 'message';
349
- delta: string;
596
+ export interface AIChatScopeResolvedEvent extends AIChatStreamEventBase {
597
+ event: 'scopeResolved';
598
+ chatMode: AIChatMode;
599
+ requestedScope?: AIWorkspaceScopeRequest;
600
+ resolvedScope: AIResolvedWorkspaceScope;
350
601
  }
351
- interface AIChatReasoningEvent extends AIChatStreamEventBase {
352
- event: 'reasoning';
353
- delta: string;
602
+ export interface AIChatPageSnapshotBuiltEvent extends AIChatStreamEventBase {
603
+ event: 'pageSnapshotBuilt';
604
+ snapshot: AIChatPageSnapshot;
354
605
  }
355
- interface AIChatCitation {
356
- citationId?: string;
357
- sourceType: string;
358
- title: string;
359
- locator: string;
606
+ export interface AIChatToolAffordanceBuiltEvent extends AIChatStreamEventBase {
607
+ event: 'toolAffordanceBuilt';
608
+ toolAffordanceSnapshot: AIChatToolAffordanceSnapshot;
360
609
  }
361
- interface AIChatToolCallEvent extends AIChatStreamEventBase {
362
- event: 'tool_call';
610
+ export interface AIChatRoutingStartedEvent extends AIChatStreamEventBase {
611
+ event: 'routingStarted';
612
+ requestedMode?: AIChatMode;
613
+ requestedSkillPackIds?: AIChatSkillId[];
614
+ }
615
+ export interface AIChatRoutingCompletedEvent extends AIChatStreamEventBase {
616
+ event: 'routingCompleted';
617
+ path: AIOrchestrationPath;
618
+ confidence: number;
619
+ domains?: AIRouterDomainScore[];
620
+ missingInputs: string[];
621
+ reasonCode?: AIReasonCode;
622
+ whyThisPath?: string;
623
+ analysisConfidence?: number;
624
+ needsRetrieval?: boolean;
625
+ selectedSkillPackIds?: AIChatSkillId[];
626
+ complexity?: AIChatComplexity;
627
+ }
628
+ export interface AIChatPlanCreatedEvent extends AIChatStreamEventBase {
629
+ event: 'planCreated';
630
+ plan: AIChatPlanSnapshot;
631
+ }
632
+ export interface AIChatPlanUpdatedEvent extends AIChatStreamEventBase {
633
+ event: 'planUpdated';
634
+ plan: AIChatPlanSnapshot;
635
+ }
636
+ export interface AIChatCommentaryEvent extends AIChatStreamEventBase {
637
+ event: 'commentary';
638
+ entry: AIChatCommentaryEntry;
639
+ }
640
+ export interface AIChatProgressUpdateEvent extends AIChatStreamEventBase {
641
+ event: 'progressUpdate';
642
+ progress: AIChatProgressEntry;
643
+ }
644
+ export interface AIChatToolCallEvent extends AIChatStreamEventBase {
645
+ event: 'toolCall';
363
646
  callId: string;
364
- tool: string;
647
+ toolName: string;
365
648
  arguments: Record<string, unknown>;
366
649
  }
367
- interface AIChatToolResultEvent extends AIChatStreamEventBase {
368
- event: 'tool_result';
369
- tool: string;
370
- callId?: string;
371
- result: AIToolResult;
650
+ export interface AIChatToolResultEvent extends AIChatStreamEventBase {
651
+ event: 'toolResult';
652
+ callId: string;
653
+ toolName: string;
654
+ result: AIChatToolExecutionResult;
372
655
  }
373
- interface AIChatToolErrorEvent extends AIChatStreamEventBase {
374
- event: 'tool_error';
375
- tool: string;
376
- callId?: string;
377
- error: AIToolError;
656
+ export interface AIChatToolErrorEvent extends AIChatStreamEventBase {
657
+ event: 'toolError';
658
+ callId: string;
659
+ toolName: string;
660
+ error: AIChatToolExecutionError;
661
+ }
662
+ export interface AIChatApprovalRequiredEvent extends AIChatStreamEventBase {
663
+ event: 'approvalRequired';
664
+ approval: AIChatApprovalRecord;
665
+ }
666
+ export interface AIChatApprovalStateChangedEvent extends AIChatStreamEventBase {
667
+ event: 'approvalStateChanged';
668
+ approval: AIChatApprovalRecord;
669
+ }
670
+ export interface AIChatFormatterStartedEvent extends AIChatStreamEventBase {
671
+ event: 'formatterStarted';
672
+ policy?: AIHtmlLitePolicy;
673
+ }
674
+ export interface AIChatFormatterCompletedEvent extends AIChatStreamEventBase {
675
+ event: 'formatterCompleted';
676
+ formatter?: AIFormatterOutput;
677
+ }
678
+ export interface AIChatMessageEvent extends AIChatStreamEventBase {
679
+ event: 'message';
680
+ delta: string;
681
+ }
682
+ export interface AIChatCitationEvent extends AIChatStreamEventBase {
683
+ event: 'citation';
684
+ citation: AIChatCitation;
378
685
  }
379
686
  export interface AIChatDoneEvent extends AIChatStreamEventBase {
380
687
  event: 'done';
@@ -384,20 +691,14 @@ export interface AIChatDoneEvent extends AIChatStreamEventBase {
384
691
  resolvedScope?: AIResolvedWorkspaceScope;
385
692
  classification?: AIChatClassificationMetadata;
386
693
  routing?: AIChatRoutingMetadata;
387
- selectedSkillIds?: AIChatSkillId[];
388
- finalSnapshot?: AIChatFinalSnapshot;
389
694
  structuredResponse?: StructuredAIResponse;
390
695
  usage?: AIChatUsage;
391
696
  answer?: string;
392
697
  completionReason?: string;
393
- reasoningSummary?: string;
394
698
  citations?: AIChatCitation[];
395
- analysisConfidence?: AIAnalysisConfidence;
396
- orchestration?: AIChatOrchestrationSummary;
397
- planner?: AIChatPlannerCompletedPayload;
398
- specialists?: AIChatSpecialistCompletedPayload[];
399
- synthesis?: AIChatSynthesisCompletedPayload;
400
- critic?: AIChatCriticCompletedPayload;
699
+ turnSnapshot: AIChatTurnSnapshot;
700
+ finalSnapshot?: AIChatFinalSnapshot;
701
+ auditArtifact?: AIChatAuditArtifact;
401
702
  }
402
703
  export interface AIChatErrorEvent extends AIChatStreamEventBase {
403
704
  event: 'error';
@@ -405,132 +706,9 @@ export interface AIChatErrorEvent extends AIChatStreamEventBase {
405
706
  message: string;
406
707
  retryable: boolean;
407
708
  }
408
- interface AIChatPingEvent extends AIChatStreamEventBase {
709
+ export interface AIChatPingEvent extends AIChatStreamEventBase {
409
710
  event: 'ping';
410
711
  }
411
- interface AIChatStatusEvent extends AIChatStreamEventBase {
412
- event: 'status';
413
- message: string;
414
- reasonCode?: AIChatReasonCode;
415
- }
416
- interface AIChatCitationEvent extends AIChatStreamEventBase {
417
- event: 'citation';
418
- citationId: string;
419
- sourceType: string;
420
- title: string;
421
- locator: string;
422
- }
423
- interface AIChatSubtaskStartEvent extends AIChatStreamEventBase {
424
- event: 'subtask_start';
425
- subtaskId: string;
426
- domain: string;
427
- title: string;
428
- }
429
- interface AIChatSubtaskDoneEvent extends AIChatStreamEventBase {
430
- event: 'subtask_done';
431
- subtaskId: string;
432
- domain: string;
433
- summary: string;
434
- }
435
- interface AIChatScopeResolvedEvent extends AIChatStreamEventBase {
436
- event: 'scope_resolved';
437
- chatMode: AIChatMode;
438
- requestedScope?: AIWorkspaceScopeRequest;
439
- resolvedScope: AIResolvedWorkspaceScope;
440
- }
441
- export interface AIChatSkillClassificationCandidate {
442
- skillId: AIChatSkillId;
443
- score: number;
444
- reasonCodes: AIChatReasonCode[];
445
- }
446
- interface AIChatSkillClassifiedEvent extends AIChatStreamEventBase {
447
- event: 'skill_classified';
448
- requestedSkillId?: AIChatSkillId;
449
- selectedSkillId?: AIChatSkillId;
450
- classifierVersion: string;
451
- candidates: AIChatSkillClassificationCandidate[];
452
- reasonCodes?: AIChatReasonCode[];
453
- }
454
- export type AIChatSkillRouteSource = 'auto' | 'explicit' | 'default';
455
- export type AIChatSkillRoutePolicyOutcome = 'accepted' | 'fallback' | 'rejected';
456
- interface AIChatSkillRoutedEvent extends AIChatStreamEventBase {
457
- event: 'skill_routed';
458
- skillId: AIChatSkillId;
459
- skillVersion: string;
460
- routeSource: AIChatSkillRouteSource;
461
- policyOutcome: AIChatSkillRoutePolicyOutcome;
462
- reasonCodes?: AIChatReasonCode[];
463
- }
464
- interface AIChatSkillFallbackEvent extends AIChatStreamEventBase {
465
- event: 'skill_fallback';
466
- fromSkillId?: AIChatSkillId;
467
- toRoute: string;
468
- reasonCode: AIChatReasonCode;
469
- reasonCodes?: AIChatReasonCode[];
470
- }
471
- interface AIChatRoutingStartedEvent extends AIChatStreamEventBase, AIChatRoutingStartedPayload {
472
- event: 'routing_started';
473
- }
474
- interface AIChatRoutingCompletedEvent extends AIChatStreamEventBase, AIChatRoutingCompletedPayload {
475
- event: 'routing_completed';
476
- }
477
- interface AIChatGenericStartedEvent extends AIChatStreamEventBase, AIChatGenericStartedPayload {
478
- event: 'generic_started';
479
- }
480
- interface AIChatGenericCompletedEvent extends AIChatStreamEventBase, AIChatGenericCompletedPayload {
481
- event: 'generic_completed';
482
- }
483
- interface AIChatPlannerStartedEvent extends AIChatStreamEventBase, AIChatPlannerStartedPayload {
484
- event: 'planner_started';
485
- }
486
- interface AIChatPlannerCompletedEvent extends AIChatStreamEventBase, AIChatPlannerCompletedPayload {
487
- event: 'planner_completed';
488
- }
489
- interface AIChatSpecialistStartedEvent extends AIChatStreamEventBase, AIChatSpecialistStartedPayload {
490
- event: 'specialist_started';
491
- }
492
- interface AIChatSpecialistProgressEvent extends AIChatStreamEventBase, AIChatSpecialistProgressPayload {
493
- event: 'specialist_progress';
494
- }
495
- interface AIChatSpecialistCompletedEvent extends AIChatStreamEventBase, AIChatSpecialistCompletedPayload {
496
- event: 'specialist_completed';
497
- }
498
- interface AIChatSynthesisStartedEvent extends AIChatStreamEventBase, AIChatSynthesisStartedPayload {
499
- event: 'synthesis_started';
500
- }
501
- interface AIChatSynthesisCompletedEvent extends AIChatStreamEventBase, AIChatSynthesisCompletedPayload {
502
- event: 'synthesis_completed';
503
- }
504
- interface AIChatCriticStartedEvent extends AIChatStreamEventBase, AIChatCriticStartedPayload {
505
- event: 'critic_started';
506
- }
507
- interface AIChatCriticCompletedEvent extends AIChatStreamEventBase, AIChatCriticCompletedPayload {
508
- event: 'critic_completed';
509
- }
510
- interface AIChatRevisionStartedEvent extends AIChatStreamEventBase, AIChatRevisionStartedPayload {
511
- event: 'revision_started';
512
- }
513
- interface AIChatRevisionCompletedEvent extends AIChatStreamEventBase, AIChatRevisionCompletedPayload {
514
- event: 'revision_completed';
515
- }
516
- interface AIChatAnalysisConfidenceEvent extends AIChatStreamEventBase, AIChatAnalysisConfidencePayload {
517
- event: 'analysis_confidence';
518
- }
519
- interface AIChatConfirmationRequiredEvent extends AIChatStreamEventBase {
520
- event: 'confirmation_required';
521
- challengeId: string;
522
- actionSummary: string;
523
- requiredRole: string;
524
- riskLevel: 'low' | 'medium' | 'high';
525
- expiresAt: string;
526
- idempotencyKey: string;
527
- /**
528
- * Legacy alias fields retained for current API/UI consumers.
529
- */
530
- actionId?: string;
531
- actionType?: string;
532
- summary?: string;
533
- }
534
- export type AIChatStreamEvent = AIChatMessageEvent | AIChatReasoningEvent | AIChatToolCallEvent | AIChatToolResultEvent | AIChatToolErrorEvent | AIChatStatusEvent | AIChatCitationEvent | AIChatSubtaskStartEvent | AIChatSubtaskDoneEvent | AIChatScopeResolvedEvent | AIChatSkillClassifiedEvent | AIChatSkillRoutedEvent | AIChatSkillFallbackEvent | AIChatRoutingStartedEvent | AIChatRoutingCompletedEvent | AIChatGenericStartedEvent | AIChatGenericCompletedEvent | AIChatPlannerStartedEvent | AIChatPlannerCompletedEvent | AIChatSpecialistStartedEvent | AIChatSpecialistProgressEvent | AIChatSpecialistCompletedEvent | AIChatSynthesisStartedEvent | AIChatSynthesisCompletedEvent | AIChatCriticStartedEvent | AIChatCriticCompletedEvent | AIChatRevisionStartedEvent | AIChatRevisionCompletedEvent | AIChatAnalysisConfidenceEvent | AIChatConfirmationRequiredEvent | AIChatDoneEvent | AIChatErrorEvent | AIChatPingEvent;
712
+ export type AIChatStreamEvent = AIChatScopeResolvedEvent | AIChatPageSnapshotBuiltEvent | AIChatToolAffordanceBuiltEvent | AIChatRoutingStartedEvent | AIChatRoutingCompletedEvent | AIChatPlanCreatedEvent | AIChatPlanUpdatedEvent | AIChatCommentaryEvent | AIChatProgressUpdateEvent | AIChatToolCallEvent | AIChatToolResultEvent | AIChatToolErrorEvent | AIChatApprovalRequiredEvent | AIChatApprovalStateChangedEvent | AIChatFormatterStartedEvent | AIChatFormatterCompletedEvent | AIChatMessageEvent | AIChatCitationEvent | AIChatDoneEvent | AIChatErrorEvent | AIChatPingEvent;
535
713
  export {};
536
714
  //# sourceMappingURL=index.d.ts.map