@inspecto-dev/types 0.3.7 → 0.3.9

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.cjs CHANGED
@@ -34,7 +34,14 @@ __export(index_exports, {
34
34
  module.exports = __toCommonJS(index_exports);
35
35
 
36
36
  // src/providers.ts
37
- var HOST_IDE_IDS = ["vscode", "cursor", "trae", "trae-cn", "codebuddy", "codebuddy-cn"];
37
+ var HOST_IDE_IDS = [
38
+ "vscode",
39
+ "cursor",
40
+ "trae",
41
+ "trae-cn",
42
+ "codebuddy",
43
+ "codebuddy-cn"
44
+ ];
38
45
  var HOST_IDE_LABELS = {
39
46
  vscode: "VS Code",
40
47
  cursor: "Cursor",
@@ -96,10 +103,17 @@ var INSPECTO_API_PATHS = {
96
103
  CLIENT_CONFIG: "/inspecto/api/v1/client/config",
97
104
  IDE_INFO: "/inspecto/api/v1/ide/info",
98
105
  IDE_OPEN: "/inspecto/api/v1/ide/open",
106
+ SOURCE_OPEN: "/inspecto/api/v1/source/open",
99
107
  PROJECT_SNIPPET: "/inspecto/api/v1/project/snippet",
100
108
  AI_DISPATCH: "/inspecto/api/v1/ai/dispatch",
101
109
  AI_BATCH_DISPATCH: "/inspecto/api/v1/ai/dispatch/annotations",
102
- AI_TICKET: "/inspecto/api/v1/ai/ticket"
110
+ AI_TICKET: "/inspecto/api/v1/ai/ticket",
111
+ SESSIONS: "/inspecto/api/v1/sessions",
112
+ SESSION_CLAIM_NEXT: "/inspecto/api/v1/sessions/claim",
113
+ SESSION_EVENTS: "/inspecto/api/v1/sessions/events",
114
+ SESSION_REPLY_SUFFIX: "/reply",
115
+ SESSION_RESOLVE_SUFFIX: "/resolve",
116
+ SESSION_DISMISS_SUFFIX: "/dismiss"
103
117
  };
104
118
 
105
119
  // src/intents.ts
@@ -108,43 +122,33 @@ var DEFAULT_INTENTS = [
108
122
  id: "explain",
109
123
  label: "Explain",
110
124
  aiIntent: "ask",
111
- prompt: `Explain what this {{framework}} component from \`{{file}}\` (line {{line}}) does.
125
+ prompt: `Explain this {{framework}} component from \`{{file}}\` (line {{line}}).
112
126
 
113
- Focus on:
114
- - its UI responsibility
115
- - key props, state, or side effects
116
- - any non-obvious logic worth noticing`
127
+ Cover its UI role, key props/state/side effects, and any non-obvious logic.`
117
128
  },
118
129
  {
119
130
  id: "fix-bug",
120
131
  label: "Fix Bug",
121
132
  aiIntent: "fix",
122
- prompt: `Help fix a bug in this {{framework}} component from \`{{file}}\` (line {{line}}).
123
-
124
- Please:
125
- - identify the most likely root cause
126
- - explain why it happens
127
- - suggest the smallest safe fix
133
+ prompt: `Fix the bug in this {{framework}} component from \`{{file}}\` (line {{line}}).
128
134
 
129
- If important context is missing, ask for it before proposing broader changes.`
135
+ Identify the likely root cause and propose the smallest safe fix.`
130
136
  },
131
137
  {
132
138
  id: "fix-ui",
133
139
  label: "Fix UI",
134
140
  aiIntent: "fix",
135
- prompt: `Help fix a UI issue in this {{framework}} component from \`{{file}}\` (line {{line}}).
141
+ prompt: `Fix the UI issue in this {{framework}} component from \`{{file}}\` (line {{line}}).
136
142
 
137
- Please review layout, spacing, overflow, alignment, layering, and visual consistency,
138
- then suggest fixes using the same styling approach already used in this codebase.`
143
+ Check layout, spacing, overflow, alignment, layering, and visual consistency. Use the existing styling approach.`
139
144
  },
140
145
  {
141
146
  id: "improve",
142
147
  label: "Improve",
143
148
  aiIntent: "review",
144
- prompt: `Review this {{framework}} component from \`{{file}}\` (line {{line}}) and suggest practical improvements.
149
+ prompt: `Review this {{framework}} component from \`{{file}}\` (line {{line}}).
145
150
 
146
- Focus on readability, maintainability, and small structural cleanups.
147
- Keep behavior unchanged unless a change is clearly justified.`
151
+ Suggest practical readability, maintainability, and small structural improvements. Keep behavior unchanged unless clearly justified.`
148
152
  }
149
153
  ];
150
154
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.d.cts CHANGED
@@ -19,17 +19,16 @@ interface UnpluginOptions {
19
19
  logLevel?: LogLevel;
20
20
  }
21
21
 
22
- type IdeType = 'vscode' | 'trae' | 'trae-cn' | 'cursor' | 'codebuddy' | 'codebuddy-cn' | 'unknown';
22
+ type IdeType = 'vscode' | 'trae' | 'trae-cn' | 'cursor' | 'codebuddy' | 'codebuddy-cn' | 'unknown' | 'none';
23
23
  type Provider = 'copilot' | 'claude-code' | 'gemini' | 'codex' | 'coco' | 'trae' | 'cursor' | 'codebuddy';
24
24
  type ProviderMode = 'extension' | 'cli' | 'clipboard' | 'builtin';
25
25
  interface InspectoSettings {
26
26
  ide?: IdeType;
27
27
  [key: `provider.${string}`]: string | string[] | boolean | undefined;
28
28
  'inspector.hotKey'?: HotKeys;
29
- 'inspector.theme'?: 'light' | 'dark' | 'auto';
29
+ 'annotate.deliveryMode'?: 'ide' | 'agent' | 'both';
30
30
  'prompt.includeSnippet'?: boolean;
31
31
  'prompt.autoSend'?: boolean;
32
- 'prompt.annotationResponseMode'?: 'unified' | 'per-annotation';
33
32
  }
34
33
  declare const HOST_IDE_IDS: readonly ["vscode", "cursor", "trae", "trae-cn", "codebuddy", "codebuddy-cn"];
35
34
  type SupportedHostIde = (typeof HOST_IDE_IDS)[number];
@@ -85,7 +84,6 @@ interface AiPayload {
85
84
  line?: number;
86
85
  column?: number;
87
86
  snippet?: string;
88
- screenshotContext?: ScreenshotContext;
89
87
  overrides?: ToolOverrides;
90
88
  autoSend?: boolean;
91
89
  ticket?: string;
@@ -110,10 +108,9 @@ interface InspectoConfig {
110
108
  prompts?: IntentConfig[];
111
109
  hotKeys?: HotKeys;
112
110
  theme?: 'light' | 'dark' | 'auto';
111
+ annotateDeliveryMode?: 'ide' | 'agent' | 'both';
113
112
  includeSnippet?: boolean;
114
- annotationResponseMode?: 'unified' | 'per-annotation';
115
113
  runtimeContext?: RuntimeContextConfig;
116
- screenshotContext?: ScreenshotContextConfig;
117
114
  }
118
115
  interface ServerState {
119
116
  port: number | null;
@@ -126,7 +123,6 @@ interface ServerState {
126
123
 
127
124
  type AiIntent = 'ask' | 'fix' | 'review' | 'redesign';
128
125
  type AnnotationIntent = AiIntent;
129
- type IntentLabels = Partial<Record<Provider | 'clipboard', string>>;
130
126
  interface IntentConfigBase {
131
127
  id: string;
132
128
  label?: string;
@@ -143,18 +139,19 @@ type InspectoPromptsConfig = (string | IntentConfig)[] | {
143
139
  $replace: true;
144
140
  items: (string | IntentConfig)[];
145
141
  };
142
+ type InspectoLocale = 'en' | 'zh-CN' | (string & {});
143
+ type InspectoMessages = Partial<Record<string, string>>;
146
144
  interface InspectorOptions {
145
+ locale?: InspectoLocale;
146
+ messages?: InspectoMessages;
147
147
  hotKeys?: HotKeys;
148
- labels?: IntentLabels;
149
148
  askPlaceholder?: string;
150
149
  serverUrl?: string;
151
150
  maxSnippetLines?: number;
152
151
  defaultActive?: boolean;
153
152
  theme?: 'light' | 'dark' | 'auto';
154
153
  includeSnippet?: boolean;
155
- annotationResponseMode?: 'unified' | 'per-annotation';
156
154
  runtimeContext?: RuntimeContextConfig;
157
- screenshotContext?: ScreenshotContextConfig;
158
155
  }
159
156
  interface SendToAiRequest {
160
157
  location: SourceLocation;
@@ -162,7 +159,6 @@ interface SendToAiRequest {
162
159
  prompt?: string;
163
160
  target?: Provider;
164
161
  runtimeContext?: RuntimeContextEnvelope;
165
- screenshotContext?: ScreenshotContext;
166
162
  }
167
163
  interface SendToAiResponse {
168
164
  success: boolean;
@@ -224,16 +220,6 @@ interface RuntimeContextConfig {
224
220
  maxRuntimeErrors?: number;
225
221
  maxFailedRequests?: number;
226
222
  }
227
- interface ScreenshotContext {
228
- enabled: boolean;
229
- capturedAt: string;
230
- mimeType: string;
231
- imageDataUrl?: string;
232
- imageAssetId?: string;
233
- }
234
- interface ScreenshotContextConfig {
235
- enabled?: boolean;
236
- }
237
223
  interface OpenFileRequest {
238
224
  file: string;
239
225
  line: number;
@@ -294,6 +280,65 @@ interface AnnotationSession {
294
280
  current: Annotation | null;
295
281
  queue: Annotation[];
296
282
  }
283
+ type AnnotationSessionStatus = 'pending' | 'acknowledged' | 'in_progress' | 'resolved' | 'dismissed';
284
+ type AnnotationThreadRole = 'user' | 'agent' | 'system';
285
+ interface AnnotationThreadMessage {
286
+ id: string;
287
+ role: AnnotationThreadRole;
288
+ text: string;
289
+ createdAt: number;
290
+ }
291
+ interface AnnotationWorkSession {
292
+ id: string;
293
+ instruction: string;
294
+ annotations: Annotation[];
295
+ deliveryMode?: AnnotationDeliveryMode;
296
+ runtimeContext?: RuntimeContextEnvelope;
297
+ cssContextPrompt?: string;
298
+ pageUrl?: string;
299
+ route?: string;
300
+ status: AnnotationSessionStatus;
301
+ messages: AnnotationThreadMessage[];
302
+ createdAt: number;
303
+ updatedAt: number;
304
+ acknowledgedAt?: number;
305
+ resolvedAt?: number;
306
+ }
307
+ interface AnnotationWorkSessionSummary {
308
+ id: string;
309
+ status: AnnotationSessionStatus;
310
+ createdAt: number;
311
+ updatedAt: number;
312
+ }
313
+ interface CreateAnnotationWorkSessionInput {
314
+ instruction?: string;
315
+ annotations: Annotation[];
316
+ deliveryMode?: AnnotationDeliveryMode;
317
+ runtimeContext?: RuntimeContextEnvelope;
318
+ cssContextPrompt?: string;
319
+ pageUrl?: string;
320
+ route?: string;
321
+ messages?: AnnotationThreadMessage[];
322
+ }
323
+ interface AppendAnnotationThreadMessageInput {
324
+ role: AnnotationThreadRole;
325
+ text: string;
326
+ }
327
+ interface AnnotationSessionReplyRequest {
328
+ role: AnnotationThreadRole;
329
+ text: string;
330
+ }
331
+ interface AnnotationSessionResolveRequest {
332
+ message?: string;
333
+ }
334
+ interface AnnotationSessionClaimRequest {
335
+ timeoutMs?: number;
336
+ }
337
+ type AnnotationSessionEventType = 'session-created' | 'session-message-appended' | 'session-status-updated';
338
+ interface AnnotationSessionEvent {
339
+ type: AnnotationSessionEventType;
340
+ session: AnnotationWorkSession;
341
+ }
297
342
  interface AnnotationTransportTarget {
298
343
  location: SourceLocation;
299
344
  label?: string;
@@ -305,33 +350,46 @@ interface AnnotationTransport {
305
350
  intent: AnnotationIntent;
306
351
  targets: AnnotationTransportTarget[];
307
352
  }
353
+ type AnnotationDeliveryMode = 'ide' | 'agent';
308
354
  interface SendAnnotationsToAiRequest {
309
355
  instruction?: string;
310
356
  annotations: AnnotationTransport[];
311
- responseMode?: 'unified' | 'per-annotation';
312
357
  runtimeContext?: RuntimeContextEnvelope;
313
- screenshotContext?: ScreenshotContext;
314
358
  cssContextPrompt?: string;
359
+ deliveryMode?: AnnotationDeliveryMode;
315
360
  }
316
361
  interface SendAnnotationsToAiResponse {
317
362
  success: boolean;
318
363
  error?: string;
319
364
  errorCode?: AiErrorCode;
365
+ session?: AnnotationWorkSessionSummary;
320
366
  fallbackPayload?: {
321
367
  prompt: string;
322
368
  };
323
369
  }
324
- type AiErrorCode = 'INVALID_REQUEST' | 'FORBIDDEN_PATH' | 'IDE_NOT_FOUND' | 'EXTENSION_NOT_INSTALLED' | 'CLIPBOARD_WRITE_FAILED' | 'SNIPPET_TOO_LARGE' | 'FILE_NOT_FOUND' | 'UNKNOWN';
370
+ interface AnnotationSessionMutationResponse {
371
+ success: boolean;
372
+ error?: string;
373
+ session?: AnnotationWorkSession;
374
+ }
375
+ type AiErrorCode = 'INVALID_REQUEST' | 'FORBIDDEN_PATH' | 'IDE_UNAVAILABLE' | 'IDE_NOT_FOUND' | 'EXTENSION_NOT_INSTALLED' | 'CLIPBOARD_WRITE_FAILED' | 'SNIPPET_TOO_LARGE' | 'FILE_NOT_FOUND' | 'SERVER_UNAVAILABLE' | 'UNKNOWN';
325
376
 
326
377
  declare const INSPECTO_API_PATHS: {
327
378
  readonly HEALTH: "/inspecto/api/v1/health";
328
379
  readonly CLIENT_CONFIG: "/inspecto/api/v1/client/config";
329
380
  readonly IDE_INFO: "/inspecto/api/v1/ide/info";
330
381
  readonly IDE_OPEN: "/inspecto/api/v1/ide/open";
382
+ readonly SOURCE_OPEN: "/inspecto/api/v1/source/open";
331
383
  readonly PROJECT_SNIPPET: "/inspecto/api/v1/project/snippet";
332
384
  readonly AI_DISPATCH: "/inspecto/api/v1/ai/dispatch";
333
385
  readonly AI_BATCH_DISPATCH: "/inspecto/api/v1/ai/dispatch/annotations";
334
386
  readonly AI_TICKET: "/inspecto/api/v1/ai/ticket";
387
+ readonly SESSIONS: "/inspecto/api/v1/sessions";
388
+ readonly SESSION_CLAIM_NEXT: "/inspecto/api/v1/sessions/claim";
389
+ readonly SESSION_EVENTS: "/inspecto/api/v1/sessions/events";
390
+ readonly SESSION_REPLY_SUFFIX: "/reply";
391
+ readonly SESSION_RESOLVE_SUFFIX: "/resolve";
392
+ readonly SESSION_DISMISS_SUFFIX: "/dismiss";
335
393
  };
336
394
 
337
395
  declare const DEFAULT_INTENTS: {
@@ -341,4 +399,4 @@ declare const DEFAULT_INTENTS: {
341
399
  prompt: string;
342
400
  }[];
343
401
 
344
- export { type AiErrorCode, type AiIntent, type AiIntentConfig, type AiPayload, type AiStrategyContext, type AiStrategyResult, type Annotation, type AnnotationIntent, type AnnotationSession, type AnnotationTarget, type AnnotationTransport, type AnnotationTransportTarget, type ChannelDef, DEFAULT_INTENTS, DEFAULT_PROVIDER_MODE, DUAL_MODE_PROVIDER_CAPABILITIES, type DualModeProvider, type FeedbackRecord, type FeedbackRecordDraft, type FeedbackRecordSession, HOST_IDE_IDS, HOST_IDE_LABELS, type HotKey, type HotKeyString, type HotKeys, INSPECTO_API_PATHS, type IdeInfo, type IdeType, type InspectoConfig, type InspectoPromptsConfig, type InspectoSettings, type InspectorOptions, type IntentConfig, type IntentConfigBase, type IntentLabels, type LogLevel, type OpenFileRequest, type PathType, type Provider, type ProviderInfo, type ProviderMode, type RuntimeContextConfig, type RuntimeContextEnvelope, type RuntimeContextSummary, type RuntimeEvidenceKind, type RuntimeEvidenceLevel, type RuntimeEvidenceRecord, type ScreenshotContext, type ScreenshotContextConfig, type SendAnnotationsToAiRequest, type SendAnnotationsToAiResponse, type SendToAiRequest, type SendToAiResponse, type ServerState, type SnippetRequest, type SnippetResponse, type SourceAttrValue, type SourceLocation, type SupportedHostIde, type ToolOverrides, type UnpluginOptions, VALID_MODES, getDualModeProviderCapability, getHostIdeLabel, isSupportedHostIde };
402
+ export { type AiErrorCode, type AiIntent, type AiIntentConfig, type AiPayload, type AiStrategyContext, type AiStrategyResult, type Annotation, type AnnotationDeliveryMode, type AnnotationIntent, type AnnotationSession, type AnnotationSessionClaimRequest, type AnnotationSessionEvent, type AnnotationSessionEventType, type AnnotationSessionMutationResponse, type AnnotationSessionReplyRequest, type AnnotationSessionResolveRequest, type AnnotationSessionStatus, type AnnotationTarget, type AnnotationThreadMessage, type AnnotationThreadRole, type AnnotationTransport, type AnnotationTransportTarget, type AnnotationWorkSession, type AnnotationWorkSessionSummary, type AppendAnnotationThreadMessageInput, type ChannelDef, type CreateAnnotationWorkSessionInput, DEFAULT_INTENTS, DEFAULT_PROVIDER_MODE, DUAL_MODE_PROVIDER_CAPABILITIES, type DualModeProvider, type FeedbackRecord, type FeedbackRecordDraft, type FeedbackRecordSession, HOST_IDE_IDS, HOST_IDE_LABELS, type HotKey, type HotKeyString, type HotKeys, INSPECTO_API_PATHS, type IdeInfo, type IdeType, type InspectoConfig, type InspectoLocale, type InspectoMessages, type InspectoPromptsConfig, type InspectoSettings, type InspectorOptions, type IntentConfig, type IntentConfigBase, type LogLevel, type OpenFileRequest, type PathType, type Provider, type ProviderInfo, type ProviderMode, type RuntimeContextConfig, type RuntimeContextEnvelope, type RuntimeContextSummary, type RuntimeEvidenceKind, type RuntimeEvidenceLevel, type RuntimeEvidenceRecord, type SendAnnotationsToAiRequest, type SendAnnotationsToAiResponse, type SendToAiRequest, type SendToAiResponse, type ServerState, type SnippetRequest, type SnippetResponse, type SourceAttrValue, type SourceLocation, type SupportedHostIde, type ToolOverrides, type UnpluginOptions, VALID_MODES, getDualModeProviderCapability, getHostIdeLabel, isSupportedHostIde };
package/dist/index.d.ts CHANGED
@@ -19,17 +19,16 @@ interface UnpluginOptions {
19
19
  logLevel?: LogLevel;
20
20
  }
21
21
 
22
- type IdeType = 'vscode' | 'trae' | 'trae-cn' | 'cursor' | 'codebuddy' | 'codebuddy-cn' | 'unknown';
22
+ type IdeType = 'vscode' | 'trae' | 'trae-cn' | 'cursor' | 'codebuddy' | 'codebuddy-cn' | 'unknown' | 'none';
23
23
  type Provider = 'copilot' | 'claude-code' | 'gemini' | 'codex' | 'coco' | 'trae' | 'cursor' | 'codebuddy';
24
24
  type ProviderMode = 'extension' | 'cli' | 'clipboard' | 'builtin';
25
25
  interface InspectoSettings {
26
26
  ide?: IdeType;
27
27
  [key: `provider.${string}`]: string | string[] | boolean | undefined;
28
28
  'inspector.hotKey'?: HotKeys;
29
- 'inspector.theme'?: 'light' | 'dark' | 'auto';
29
+ 'annotate.deliveryMode'?: 'ide' | 'agent' | 'both';
30
30
  'prompt.includeSnippet'?: boolean;
31
31
  'prompt.autoSend'?: boolean;
32
- 'prompt.annotationResponseMode'?: 'unified' | 'per-annotation';
33
32
  }
34
33
  declare const HOST_IDE_IDS: readonly ["vscode", "cursor", "trae", "trae-cn", "codebuddy", "codebuddy-cn"];
35
34
  type SupportedHostIde = (typeof HOST_IDE_IDS)[number];
@@ -85,7 +84,6 @@ interface AiPayload {
85
84
  line?: number;
86
85
  column?: number;
87
86
  snippet?: string;
88
- screenshotContext?: ScreenshotContext;
89
87
  overrides?: ToolOverrides;
90
88
  autoSend?: boolean;
91
89
  ticket?: string;
@@ -110,10 +108,9 @@ interface InspectoConfig {
110
108
  prompts?: IntentConfig[];
111
109
  hotKeys?: HotKeys;
112
110
  theme?: 'light' | 'dark' | 'auto';
111
+ annotateDeliveryMode?: 'ide' | 'agent' | 'both';
113
112
  includeSnippet?: boolean;
114
- annotationResponseMode?: 'unified' | 'per-annotation';
115
113
  runtimeContext?: RuntimeContextConfig;
116
- screenshotContext?: ScreenshotContextConfig;
117
114
  }
118
115
  interface ServerState {
119
116
  port: number | null;
@@ -126,7 +123,6 @@ interface ServerState {
126
123
 
127
124
  type AiIntent = 'ask' | 'fix' | 'review' | 'redesign';
128
125
  type AnnotationIntent = AiIntent;
129
- type IntentLabels = Partial<Record<Provider | 'clipboard', string>>;
130
126
  interface IntentConfigBase {
131
127
  id: string;
132
128
  label?: string;
@@ -143,18 +139,19 @@ type InspectoPromptsConfig = (string | IntentConfig)[] | {
143
139
  $replace: true;
144
140
  items: (string | IntentConfig)[];
145
141
  };
142
+ type InspectoLocale = 'en' | 'zh-CN' | (string & {});
143
+ type InspectoMessages = Partial<Record<string, string>>;
146
144
  interface InspectorOptions {
145
+ locale?: InspectoLocale;
146
+ messages?: InspectoMessages;
147
147
  hotKeys?: HotKeys;
148
- labels?: IntentLabels;
149
148
  askPlaceholder?: string;
150
149
  serverUrl?: string;
151
150
  maxSnippetLines?: number;
152
151
  defaultActive?: boolean;
153
152
  theme?: 'light' | 'dark' | 'auto';
154
153
  includeSnippet?: boolean;
155
- annotationResponseMode?: 'unified' | 'per-annotation';
156
154
  runtimeContext?: RuntimeContextConfig;
157
- screenshotContext?: ScreenshotContextConfig;
158
155
  }
159
156
  interface SendToAiRequest {
160
157
  location: SourceLocation;
@@ -162,7 +159,6 @@ interface SendToAiRequest {
162
159
  prompt?: string;
163
160
  target?: Provider;
164
161
  runtimeContext?: RuntimeContextEnvelope;
165
- screenshotContext?: ScreenshotContext;
166
162
  }
167
163
  interface SendToAiResponse {
168
164
  success: boolean;
@@ -224,16 +220,6 @@ interface RuntimeContextConfig {
224
220
  maxRuntimeErrors?: number;
225
221
  maxFailedRequests?: number;
226
222
  }
227
- interface ScreenshotContext {
228
- enabled: boolean;
229
- capturedAt: string;
230
- mimeType: string;
231
- imageDataUrl?: string;
232
- imageAssetId?: string;
233
- }
234
- interface ScreenshotContextConfig {
235
- enabled?: boolean;
236
- }
237
223
  interface OpenFileRequest {
238
224
  file: string;
239
225
  line: number;
@@ -294,6 +280,65 @@ interface AnnotationSession {
294
280
  current: Annotation | null;
295
281
  queue: Annotation[];
296
282
  }
283
+ type AnnotationSessionStatus = 'pending' | 'acknowledged' | 'in_progress' | 'resolved' | 'dismissed';
284
+ type AnnotationThreadRole = 'user' | 'agent' | 'system';
285
+ interface AnnotationThreadMessage {
286
+ id: string;
287
+ role: AnnotationThreadRole;
288
+ text: string;
289
+ createdAt: number;
290
+ }
291
+ interface AnnotationWorkSession {
292
+ id: string;
293
+ instruction: string;
294
+ annotations: Annotation[];
295
+ deliveryMode?: AnnotationDeliveryMode;
296
+ runtimeContext?: RuntimeContextEnvelope;
297
+ cssContextPrompt?: string;
298
+ pageUrl?: string;
299
+ route?: string;
300
+ status: AnnotationSessionStatus;
301
+ messages: AnnotationThreadMessage[];
302
+ createdAt: number;
303
+ updatedAt: number;
304
+ acknowledgedAt?: number;
305
+ resolvedAt?: number;
306
+ }
307
+ interface AnnotationWorkSessionSummary {
308
+ id: string;
309
+ status: AnnotationSessionStatus;
310
+ createdAt: number;
311
+ updatedAt: number;
312
+ }
313
+ interface CreateAnnotationWorkSessionInput {
314
+ instruction?: string;
315
+ annotations: Annotation[];
316
+ deliveryMode?: AnnotationDeliveryMode;
317
+ runtimeContext?: RuntimeContextEnvelope;
318
+ cssContextPrompt?: string;
319
+ pageUrl?: string;
320
+ route?: string;
321
+ messages?: AnnotationThreadMessage[];
322
+ }
323
+ interface AppendAnnotationThreadMessageInput {
324
+ role: AnnotationThreadRole;
325
+ text: string;
326
+ }
327
+ interface AnnotationSessionReplyRequest {
328
+ role: AnnotationThreadRole;
329
+ text: string;
330
+ }
331
+ interface AnnotationSessionResolveRequest {
332
+ message?: string;
333
+ }
334
+ interface AnnotationSessionClaimRequest {
335
+ timeoutMs?: number;
336
+ }
337
+ type AnnotationSessionEventType = 'session-created' | 'session-message-appended' | 'session-status-updated';
338
+ interface AnnotationSessionEvent {
339
+ type: AnnotationSessionEventType;
340
+ session: AnnotationWorkSession;
341
+ }
297
342
  interface AnnotationTransportTarget {
298
343
  location: SourceLocation;
299
344
  label?: string;
@@ -305,33 +350,46 @@ interface AnnotationTransport {
305
350
  intent: AnnotationIntent;
306
351
  targets: AnnotationTransportTarget[];
307
352
  }
353
+ type AnnotationDeliveryMode = 'ide' | 'agent';
308
354
  interface SendAnnotationsToAiRequest {
309
355
  instruction?: string;
310
356
  annotations: AnnotationTransport[];
311
- responseMode?: 'unified' | 'per-annotation';
312
357
  runtimeContext?: RuntimeContextEnvelope;
313
- screenshotContext?: ScreenshotContext;
314
358
  cssContextPrompt?: string;
359
+ deliveryMode?: AnnotationDeliveryMode;
315
360
  }
316
361
  interface SendAnnotationsToAiResponse {
317
362
  success: boolean;
318
363
  error?: string;
319
364
  errorCode?: AiErrorCode;
365
+ session?: AnnotationWorkSessionSummary;
320
366
  fallbackPayload?: {
321
367
  prompt: string;
322
368
  };
323
369
  }
324
- type AiErrorCode = 'INVALID_REQUEST' | 'FORBIDDEN_PATH' | 'IDE_NOT_FOUND' | 'EXTENSION_NOT_INSTALLED' | 'CLIPBOARD_WRITE_FAILED' | 'SNIPPET_TOO_LARGE' | 'FILE_NOT_FOUND' | 'UNKNOWN';
370
+ interface AnnotationSessionMutationResponse {
371
+ success: boolean;
372
+ error?: string;
373
+ session?: AnnotationWorkSession;
374
+ }
375
+ type AiErrorCode = 'INVALID_REQUEST' | 'FORBIDDEN_PATH' | 'IDE_UNAVAILABLE' | 'IDE_NOT_FOUND' | 'EXTENSION_NOT_INSTALLED' | 'CLIPBOARD_WRITE_FAILED' | 'SNIPPET_TOO_LARGE' | 'FILE_NOT_FOUND' | 'SERVER_UNAVAILABLE' | 'UNKNOWN';
325
376
 
326
377
  declare const INSPECTO_API_PATHS: {
327
378
  readonly HEALTH: "/inspecto/api/v1/health";
328
379
  readonly CLIENT_CONFIG: "/inspecto/api/v1/client/config";
329
380
  readonly IDE_INFO: "/inspecto/api/v1/ide/info";
330
381
  readonly IDE_OPEN: "/inspecto/api/v1/ide/open";
382
+ readonly SOURCE_OPEN: "/inspecto/api/v1/source/open";
331
383
  readonly PROJECT_SNIPPET: "/inspecto/api/v1/project/snippet";
332
384
  readonly AI_DISPATCH: "/inspecto/api/v1/ai/dispatch";
333
385
  readonly AI_BATCH_DISPATCH: "/inspecto/api/v1/ai/dispatch/annotations";
334
386
  readonly AI_TICKET: "/inspecto/api/v1/ai/ticket";
387
+ readonly SESSIONS: "/inspecto/api/v1/sessions";
388
+ readonly SESSION_CLAIM_NEXT: "/inspecto/api/v1/sessions/claim";
389
+ readonly SESSION_EVENTS: "/inspecto/api/v1/sessions/events";
390
+ readonly SESSION_REPLY_SUFFIX: "/reply";
391
+ readonly SESSION_RESOLVE_SUFFIX: "/resolve";
392
+ readonly SESSION_DISMISS_SUFFIX: "/dismiss";
335
393
  };
336
394
 
337
395
  declare const DEFAULT_INTENTS: {
@@ -341,4 +399,4 @@ declare const DEFAULT_INTENTS: {
341
399
  prompt: string;
342
400
  }[];
343
401
 
344
- export { type AiErrorCode, type AiIntent, type AiIntentConfig, type AiPayload, type AiStrategyContext, type AiStrategyResult, type Annotation, type AnnotationIntent, type AnnotationSession, type AnnotationTarget, type AnnotationTransport, type AnnotationTransportTarget, type ChannelDef, DEFAULT_INTENTS, DEFAULT_PROVIDER_MODE, DUAL_MODE_PROVIDER_CAPABILITIES, type DualModeProvider, type FeedbackRecord, type FeedbackRecordDraft, type FeedbackRecordSession, HOST_IDE_IDS, HOST_IDE_LABELS, type HotKey, type HotKeyString, type HotKeys, INSPECTO_API_PATHS, type IdeInfo, type IdeType, type InspectoConfig, type InspectoPromptsConfig, type InspectoSettings, type InspectorOptions, type IntentConfig, type IntentConfigBase, type IntentLabels, type LogLevel, type OpenFileRequest, type PathType, type Provider, type ProviderInfo, type ProviderMode, type RuntimeContextConfig, type RuntimeContextEnvelope, type RuntimeContextSummary, type RuntimeEvidenceKind, type RuntimeEvidenceLevel, type RuntimeEvidenceRecord, type ScreenshotContext, type ScreenshotContextConfig, type SendAnnotationsToAiRequest, type SendAnnotationsToAiResponse, type SendToAiRequest, type SendToAiResponse, type ServerState, type SnippetRequest, type SnippetResponse, type SourceAttrValue, type SourceLocation, type SupportedHostIde, type ToolOverrides, type UnpluginOptions, VALID_MODES, getDualModeProviderCapability, getHostIdeLabel, isSupportedHostIde };
402
+ export { type AiErrorCode, type AiIntent, type AiIntentConfig, type AiPayload, type AiStrategyContext, type AiStrategyResult, type Annotation, type AnnotationDeliveryMode, type AnnotationIntent, type AnnotationSession, type AnnotationSessionClaimRequest, type AnnotationSessionEvent, type AnnotationSessionEventType, type AnnotationSessionMutationResponse, type AnnotationSessionReplyRequest, type AnnotationSessionResolveRequest, type AnnotationSessionStatus, type AnnotationTarget, type AnnotationThreadMessage, type AnnotationThreadRole, type AnnotationTransport, type AnnotationTransportTarget, type AnnotationWorkSession, type AnnotationWorkSessionSummary, type AppendAnnotationThreadMessageInput, type ChannelDef, type CreateAnnotationWorkSessionInput, DEFAULT_INTENTS, DEFAULT_PROVIDER_MODE, DUAL_MODE_PROVIDER_CAPABILITIES, type DualModeProvider, type FeedbackRecord, type FeedbackRecordDraft, type FeedbackRecordSession, HOST_IDE_IDS, HOST_IDE_LABELS, type HotKey, type HotKeyString, type HotKeys, INSPECTO_API_PATHS, type IdeInfo, type IdeType, type InspectoConfig, type InspectoLocale, type InspectoMessages, type InspectoPromptsConfig, type InspectoSettings, type InspectorOptions, type IntentConfig, type IntentConfigBase, type LogLevel, type OpenFileRequest, type PathType, type Provider, type ProviderInfo, type ProviderMode, type RuntimeContextConfig, type RuntimeContextEnvelope, type RuntimeContextSummary, type RuntimeEvidenceKind, type RuntimeEvidenceLevel, type RuntimeEvidenceRecord, type SendAnnotationsToAiRequest, type SendAnnotationsToAiResponse, type SendToAiRequest, type SendToAiResponse, type ServerState, type SnippetRequest, type SnippetResponse, type SourceAttrValue, type SourceLocation, type SupportedHostIde, type ToolOverrides, type UnpluginOptions, VALID_MODES, getDualModeProviderCapability, getHostIdeLabel, isSupportedHostIde };
package/dist/index.js CHANGED
@@ -1,5 +1,12 @@
1
1
  // src/providers.ts
2
- var HOST_IDE_IDS = ["vscode", "cursor", "trae", "trae-cn", "codebuddy", "codebuddy-cn"];
2
+ var HOST_IDE_IDS = [
3
+ "vscode",
4
+ "cursor",
5
+ "trae",
6
+ "trae-cn",
7
+ "codebuddy",
8
+ "codebuddy-cn"
9
+ ];
3
10
  var HOST_IDE_LABELS = {
4
11
  vscode: "VS Code",
5
12
  cursor: "Cursor",
@@ -61,10 +68,17 @@ var INSPECTO_API_PATHS = {
61
68
  CLIENT_CONFIG: "/inspecto/api/v1/client/config",
62
69
  IDE_INFO: "/inspecto/api/v1/ide/info",
63
70
  IDE_OPEN: "/inspecto/api/v1/ide/open",
71
+ SOURCE_OPEN: "/inspecto/api/v1/source/open",
64
72
  PROJECT_SNIPPET: "/inspecto/api/v1/project/snippet",
65
73
  AI_DISPATCH: "/inspecto/api/v1/ai/dispatch",
66
74
  AI_BATCH_DISPATCH: "/inspecto/api/v1/ai/dispatch/annotations",
67
- AI_TICKET: "/inspecto/api/v1/ai/ticket"
75
+ AI_TICKET: "/inspecto/api/v1/ai/ticket",
76
+ SESSIONS: "/inspecto/api/v1/sessions",
77
+ SESSION_CLAIM_NEXT: "/inspecto/api/v1/sessions/claim",
78
+ SESSION_EVENTS: "/inspecto/api/v1/sessions/events",
79
+ SESSION_REPLY_SUFFIX: "/reply",
80
+ SESSION_RESOLVE_SUFFIX: "/resolve",
81
+ SESSION_DISMISS_SUFFIX: "/dismiss"
68
82
  };
69
83
 
70
84
  // src/intents.ts
@@ -73,43 +87,33 @@ var DEFAULT_INTENTS = [
73
87
  id: "explain",
74
88
  label: "Explain",
75
89
  aiIntent: "ask",
76
- prompt: `Explain what this {{framework}} component from \`{{file}}\` (line {{line}}) does.
90
+ prompt: `Explain this {{framework}} component from \`{{file}}\` (line {{line}}).
77
91
 
78
- Focus on:
79
- - its UI responsibility
80
- - key props, state, or side effects
81
- - any non-obvious logic worth noticing`
92
+ Cover its UI role, key props/state/side effects, and any non-obvious logic.`
82
93
  },
83
94
  {
84
95
  id: "fix-bug",
85
96
  label: "Fix Bug",
86
97
  aiIntent: "fix",
87
- prompt: `Help fix a bug in this {{framework}} component from \`{{file}}\` (line {{line}}).
88
-
89
- Please:
90
- - identify the most likely root cause
91
- - explain why it happens
92
- - suggest the smallest safe fix
98
+ prompt: `Fix the bug in this {{framework}} component from \`{{file}}\` (line {{line}}).
93
99
 
94
- If important context is missing, ask for it before proposing broader changes.`
100
+ Identify the likely root cause and propose the smallest safe fix.`
95
101
  },
96
102
  {
97
103
  id: "fix-ui",
98
104
  label: "Fix UI",
99
105
  aiIntent: "fix",
100
- prompt: `Help fix a UI issue in this {{framework}} component from \`{{file}}\` (line {{line}}).
106
+ prompt: `Fix the UI issue in this {{framework}} component from \`{{file}}\` (line {{line}}).
101
107
 
102
- Please review layout, spacing, overflow, alignment, layering, and visual consistency,
103
- then suggest fixes using the same styling approach already used in this codebase.`
108
+ Check layout, spacing, overflow, alignment, layering, and visual consistency. Use the existing styling approach.`
104
109
  },
105
110
  {
106
111
  id: "improve",
107
112
  label: "Improve",
108
113
  aiIntent: "review",
109
- prompt: `Review this {{framework}} component from \`{{file}}\` (line {{line}}) and suggest practical improvements.
114
+ prompt: `Review this {{framework}} component from \`{{file}}\` (line {{line}}).
110
115
 
111
- Focus on readability, maintainability, and small structural cleanups.
112
- Keep behavior unchanged unless a change is clearly justified.`
116
+ Suggest practical readability, maintainability, and small structural improvements. Keep behavior unchanged unless clearly justified.`
113
117
  }
114
118
  ];
115
119
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inspecto-dev/types",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "Shared TypeScript definitions for the Inspecto monorepo",
5
5
  "license": "MIT",
6
6
  "type": "module",