@inspecto-dev/types 0.3.8 → 0.3.10
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 +16 -19
- package/dist/index.d.cts +85 -25
- package/dist/index.d.ts +85 -25
- package/dist/index.js +16 -19
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -103,10 +103,17 @@ var INSPECTO_API_PATHS = {
|
|
|
103
103
|
CLIENT_CONFIG: "/inspecto/api/v1/client/config",
|
|
104
104
|
IDE_INFO: "/inspecto/api/v1/ide/info",
|
|
105
105
|
IDE_OPEN: "/inspecto/api/v1/ide/open",
|
|
106
|
+
SOURCE_OPEN: "/inspecto/api/v1/source/open",
|
|
106
107
|
PROJECT_SNIPPET: "/inspecto/api/v1/project/snippet",
|
|
107
108
|
AI_DISPATCH: "/inspecto/api/v1/ai/dispatch",
|
|
108
109
|
AI_BATCH_DISPATCH: "/inspecto/api/v1/ai/dispatch/annotations",
|
|
109
|
-
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"
|
|
110
117
|
};
|
|
111
118
|
|
|
112
119
|
// src/intents.ts
|
|
@@ -115,43 +122,33 @@ var DEFAULT_INTENTS = [
|
|
|
115
122
|
id: "explain",
|
|
116
123
|
label: "Explain",
|
|
117
124
|
aiIntent: "ask",
|
|
118
|
-
prompt: `Explain
|
|
125
|
+
prompt: `Explain this {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
119
126
|
|
|
120
|
-
|
|
121
|
-
- its UI responsibility
|
|
122
|
-
- key props, state, or side effects
|
|
123
|
-
- any non-obvious logic worth noticing`
|
|
127
|
+
Cover its UI role, key props/state/side effects, and any non-obvious logic.`
|
|
124
128
|
},
|
|
125
129
|
{
|
|
126
130
|
id: "fix-bug",
|
|
127
131
|
label: "Fix Bug",
|
|
128
132
|
aiIntent: "fix",
|
|
129
|
-
prompt: `
|
|
133
|
+
prompt: `Fix the bug in this {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
130
134
|
|
|
131
|
-
|
|
132
|
-
- identify the most likely root cause
|
|
133
|
-
- explain why it happens
|
|
134
|
-
- suggest the smallest safe fix
|
|
135
|
-
|
|
136
|
-
If important context is missing, ask for it before proposing broader changes.`
|
|
135
|
+
Identify the likely root cause and propose the smallest safe fix.`
|
|
137
136
|
},
|
|
138
137
|
{
|
|
139
138
|
id: "fix-ui",
|
|
140
139
|
label: "Fix UI",
|
|
141
140
|
aiIntent: "fix",
|
|
142
|
-
prompt: `
|
|
141
|
+
prompt: `Fix the UI issue in this {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
143
142
|
|
|
144
|
-
|
|
145
|
-
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.`
|
|
146
144
|
},
|
|
147
145
|
{
|
|
148
146
|
id: "improve",
|
|
149
147
|
label: "Improve",
|
|
150
148
|
aiIntent: "review",
|
|
151
|
-
prompt: `Review this {{framework}} component from \`{{file}}\` (line {{line}})
|
|
149
|
+
prompt: `Review this {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
152
150
|
|
|
153
|
-
|
|
154
|
-
Keep behavior unchanged unless a change is clearly justified.`
|
|
151
|
+
Suggest practical readability, maintainability, and small structural improvements. Keep behavior unchanged unless clearly justified.`
|
|
155
152
|
}
|
|
156
153
|
];
|
|
157
154
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.d.cts
CHANGED
|
@@ -19,17 +19,18 @@ 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
|
-
'
|
|
29
|
+
'annotate.deliveryMode'?: 'ide' | 'agent' | 'both';
|
|
30
|
+
'server.host'?: string;
|
|
31
|
+
'server.publicUrl'?: string;
|
|
30
32
|
'prompt.includeSnippet'?: boolean;
|
|
31
33
|
'prompt.autoSend'?: boolean;
|
|
32
|
-
'prompt.annotationResponseMode'?: 'unified' | 'per-annotation';
|
|
33
34
|
}
|
|
34
35
|
declare const HOST_IDE_IDS: readonly ["vscode", "cursor", "trae", "trae-cn", "codebuddy", "codebuddy-cn"];
|
|
35
36
|
type SupportedHostIde = (typeof HOST_IDE_IDS)[number];
|
|
@@ -85,7 +86,6 @@ interface AiPayload {
|
|
|
85
86
|
line?: number;
|
|
86
87
|
column?: number;
|
|
87
88
|
snippet?: string;
|
|
88
|
-
screenshotContext?: ScreenshotContext;
|
|
89
89
|
overrides?: ToolOverrides;
|
|
90
90
|
autoSend?: boolean;
|
|
91
91
|
ticket?: string;
|
|
@@ -110,10 +110,9 @@ interface InspectoConfig {
|
|
|
110
110
|
prompts?: IntentConfig[];
|
|
111
111
|
hotKeys?: HotKeys;
|
|
112
112
|
theme?: 'light' | 'dark' | 'auto';
|
|
113
|
+
annotateDeliveryMode?: 'ide' | 'agent' | 'both';
|
|
113
114
|
includeSnippet?: boolean;
|
|
114
|
-
annotationResponseMode?: 'unified' | 'per-annotation';
|
|
115
115
|
runtimeContext?: RuntimeContextConfig;
|
|
116
|
-
screenshotContext?: ScreenshotContextConfig;
|
|
117
116
|
}
|
|
118
117
|
interface ServerState {
|
|
119
118
|
port: number | null;
|
|
@@ -126,7 +125,6 @@ interface ServerState {
|
|
|
126
125
|
|
|
127
126
|
type AiIntent = 'ask' | 'fix' | 'review' | 'redesign';
|
|
128
127
|
type AnnotationIntent = AiIntent;
|
|
129
|
-
type IntentLabels = Partial<Record<Provider | 'clipboard', string>>;
|
|
130
128
|
interface IntentConfigBase {
|
|
131
129
|
id: string;
|
|
132
130
|
label?: string;
|
|
@@ -143,18 +141,19 @@ type InspectoPromptsConfig = (string | IntentConfig)[] | {
|
|
|
143
141
|
$replace: true;
|
|
144
142
|
items: (string | IntentConfig)[];
|
|
145
143
|
};
|
|
144
|
+
type InspectoLocale = 'en' | 'zh-CN' | (string & {});
|
|
145
|
+
type InspectoMessages = Partial<Record<string, string>>;
|
|
146
146
|
interface InspectorOptions {
|
|
147
|
+
locale?: InspectoLocale;
|
|
148
|
+
messages?: InspectoMessages;
|
|
147
149
|
hotKeys?: HotKeys;
|
|
148
|
-
labels?: IntentLabels;
|
|
149
150
|
askPlaceholder?: string;
|
|
150
151
|
serverUrl?: string;
|
|
151
152
|
maxSnippetLines?: number;
|
|
152
153
|
defaultActive?: boolean;
|
|
153
154
|
theme?: 'light' | 'dark' | 'auto';
|
|
154
155
|
includeSnippet?: boolean;
|
|
155
|
-
annotationResponseMode?: 'unified' | 'per-annotation';
|
|
156
156
|
runtimeContext?: RuntimeContextConfig;
|
|
157
|
-
screenshotContext?: ScreenshotContextConfig;
|
|
158
157
|
}
|
|
159
158
|
interface SendToAiRequest {
|
|
160
159
|
location: SourceLocation;
|
|
@@ -162,7 +161,6 @@ interface SendToAiRequest {
|
|
|
162
161
|
prompt?: string;
|
|
163
162
|
target?: Provider;
|
|
164
163
|
runtimeContext?: RuntimeContextEnvelope;
|
|
165
|
-
screenshotContext?: ScreenshotContext;
|
|
166
164
|
}
|
|
167
165
|
interface SendToAiResponse {
|
|
168
166
|
success: boolean;
|
|
@@ -224,16 +222,6 @@ interface RuntimeContextConfig {
|
|
|
224
222
|
maxRuntimeErrors?: number;
|
|
225
223
|
maxFailedRequests?: number;
|
|
226
224
|
}
|
|
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
225
|
interface OpenFileRequest {
|
|
238
226
|
file: string;
|
|
239
227
|
line: number;
|
|
@@ -294,6 +282,65 @@ interface AnnotationSession {
|
|
|
294
282
|
current: Annotation | null;
|
|
295
283
|
queue: Annotation[];
|
|
296
284
|
}
|
|
285
|
+
type AnnotationSessionStatus = 'pending' | 'acknowledged' | 'in_progress' | 'resolved' | 'dismissed';
|
|
286
|
+
type AnnotationThreadRole = 'user' | 'agent' | 'system';
|
|
287
|
+
interface AnnotationThreadMessage {
|
|
288
|
+
id: string;
|
|
289
|
+
role: AnnotationThreadRole;
|
|
290
|
+
text: string;
|
|
291
|
+
createdAt: number;
|
|
292
|
+
}
|
|
293
|
+
interface AnnotationWorkSession {
|
|
294
|
+
id: string;
|
|
295
|
+
instruction: string;
|
|
296
|
+
annotations: Annotation[];
|
|
297
|
+
deliveryMode?: AnnotationDeliveryMode;
|
|
298
|
+
runtimeContext?: RuntimeContextEnvelope;
|
|
299
|
+
cssContextPrompt?: string;
|
|
300
|
+
pageUrl?: string;
|
|
301
|
+
route?: string;
|
|
302
|
+
status: AnnotationSessionStatus;
|
|
303
|
+
messages: AnnotationThreadMessage[];
|
|
304
|
+
createdAt: number;
|
|
305
|
+
updatedAt: number;
|
|
306
|
+
acknowledgedAt?: number;
|
|
307
|
+
resolvedAt?: number;
|
|
308
|
+
}
|
|
309
|
+
interface AnnotationWorkSessionSummary {
|
|
310
|
+
id: string;
|
|
311
|
+
status: AnnotationSessionStatus;
|
|
312
|
+
createdAt: number;
|
|
313
|
+
updatedAt: number;
|
|
314
|
+
}
|
|
315
|
+
interface CreateAnnotationWorkSessionInput {
|
|
316
|
+
instruction?: string;
|
|
317
|
+
annotations: Annotation[];
|
|
318
|
+
deliveryMode?: AnnotationDeliveryMode;
|
|
319
|
+
runtimeContext?: RuntimeContextEnvelope;
|
|
320
|
+
cssContextPrompt?: string;
|
|
321
|
+
pageUrl?: string;
|
|
322
|
+
route?: string;
|
|
323
|
+
messages?: AnnotationThreadMessage[];
|
|
324
|
+
}
|
|
325
|
+
interface AppendAnnotationThreadMessageInput {
|
|
326
|
+
role: AnnotationThreadRole;
|
|
327
|
+
text: string;
|
|
328
|
+
}
|
|
329
|
+
interface AnnotationSessionReplyRequest {
|
|
330
|
+
role: AnnotationThreadRole;
|
|
331
|
+
text: string;
|
|
332
|
+
}
|
|
333
|
+
interface AnnotationSessionResolveRequest {
|
|
334
|
+
message?: string;
|
|
335
|
+
}
|
|
336
|
+
interface AnnotationSessionClaimRequest {
|
|
337
|
+
timeoutMs?: number;
|
|
338
|
+
}
|
|
339
|
+
type AnnotationSessionEventType = 'session-created' | 'session-message-appended' | 'session-status-updated';
|
|
340
|
+
interface AnnotationSessionEvent {
|
|
341
|
+
type: AnnotationSessionEventType;
|
|
342
|
+
session: AnnotationWorkSession;
|
|
343
|
+
}
|
|
297
344
|
interface AnnotationTransportTarget {
|
|
298
345
|
location: SourceLocation;
|
|
299
346
|
label?: string;
|
|
@@ -305,33 +352,46 @@ interface AnnotationTransport {
|
|
|
305
352
|
intent: AnnotationIntent;
|
|
306
353
|
targets: AnnotationTransportTarget[];
|
|
307
354
|
}
|
|
355
|
+
type AnnotationDeliveryMode = 'ide' | 'agent';
|
|
308
356
|
interface SendAnnotationsToAiRequest {
|
|
309
357
|
instruction?: string;
|
|
310
358
|
annotations: AnnotationTransport[];
|
|
311
|
-
responseMode?: 'unified' | 'per-annotation';
|
|
312
359
|
runtimeContext?: RuntimeContextEnvelope;
|
|
313
|
-
screenshotContext?: ScreenshotContext;
|
|
314
360
|
cssContextPrompt?: string;
|
|
361
|
+
deliveryMode?: AnnotationDeliveryMode;
|
|
315
362
|
}
|
|
316
363
|
interface SendAnnotationsToAiResponse {
|
|
317
364
|
success: boolean;
|
|
318
365
|
error?: string;
|
|
319
366
|
errorCode?: AiErrorCode;
|
|
367
|
+
session?: AnnotationWorkSessionSummary;
|
|
320
368
|
fallbackPayload?: {
|
|
321
369
|
prompt: string;
|
|
322
370
|
};
|
|
323
371
|
}
|
|
324
|
-
|
|
372
|
+
interface AnnotationSessionMutationResponse {
|
|
373
|
+
success: boolean;
|
|
374
|
+
error?: string;
|
|
375
|
+
session?: AnnotationWorkSession;
|
|
376
|
+
}
|
|
377
|
+
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
378
|
|
|
326
379
|
declare const INSPECTO_API_PATHS: {
|
|
327
380
|
readonly HEALTH: "/inspecto/api/v1/health";
|
|
328
381
|
readonly CLIENT_CONFIG: "/inspecto/api/v1/client/config";
|
|
329
382
|
readonly IDE_INFO: "/inspecto/api/v1/ide/info";
|
|
330
383
|
readonly IDE_OPEN: "/inspecto/api/v1/ide/open";
|
|
384
|
+
readonly SOURCE_OPEN: "/inspecto/api/v1/source/open";
|
|
331
385
|
readonly PROJECT_SNIPPET: "/inspecto/api/v1/project/snippet";
|
|
332
386
|
readonly AI_DISPATCH: "/inspecto/api/v1/ai/dispatch";
|
|
333
387
|
readonly AI_BATCH_DISPATCH: "/inspecto/api/v1/ai/dispatch/annotations";
|
|
334
388
|
readonly AI_TICKET: "/inspecto/api/v1/ai/ticket";
|
|
389
|
+
readonly SESSIONS: "/inspecto/api/v1/sessions";
|
|
390
|
+
readonly SESSION_CLAIM_NEXT: "/inspecto/api/v1/sessions/claim";
|
|
391
|
+
readonly SESSION_EVENTS: "/inspecto/api/v1/sessions/events";
|
|
392
|
+
readonly SESSION_REPLY_SUFFIX: "/reply";
|
|
393
|
+
readonly SESSION_RESOLVE_SUFFIX: "/resolve";
|
|
394
|
+
readonly SESSION_DISMISS_SUFFIX: "/dismiss";
|
|
335
395
|
};
|
|
336
396
|
|
|
337
397
|
declare const DEFAULT_INTENTS: {
|
|
@@ -341,4 +401,4 @@ declare const DEFAULT_INTENTS: {
|
|
|
341
401
|
prompt: string;
|
|
342
402
|
}[];
|
|
343
403
|
|
|
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
|
|
404
|
+
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,18 @@ 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
|
-
'
|
|
29
|
+
'annotate.deliveryMode'?: 'ide' | 'agent' | 'both';
|
|
30
|
+
'server.host'?: string;
|
|
31
|
+
'server.publicUrl'?: string;
|
|
30
32
|
'prompt.includeSnippet'?: boolean;
|
|
31
33
|
'prompt.autoSend'?: boolean;
|
|
32
|
-
'prompt.annotationResponseMode'?: 'unified' | 'per-annotation';
|
|
33
34
|
}
|
|
34
35
|
declare const HOST_IDE_IDS: readonly ["vscode", "cursor", "trae", "trae-cn", "codebuddy", "codebuddy-cn"];
|
|
35
36
|
type SupportedHostIde = (typeof HOST_IDE_IDS)[number];
|
|
@@ -85,7 +86,6 @@ interface AiPayload {
|
|
|
85
86
|
line?: number;
|
|
86
87
|
column?: number;
|
|
87
88
|
snippet?: string;
|
|
88
|
-
screenshotContext?: ScreenshotContext;
|
|
89
89
|
overrides?: ToolOverrides;
|
|
90
90
|
autoSend?: boolean;
|
|
91
91
|
ticket?: string;
|
|
@@ -110,10 +110,9 @@ interface InspectoConfig {
|
|
|
110
110
|
prompts?: IntentConfig[];
|
|
111
111
|
hotKeys?: HotKeys;
|
|
112
112
|
theme?: 'light' | 'dark' | 'auto';
|
|
113
|
+
annotateDeliveryMode?: 'ide' | 'agent' | 'both';
|
|
113
114
|
includeSnippet?: boolean;
|
|
114
|
-
annotationResponseMode?: 'unified' | 'per-annotation';
|
|
115
115
|
runtimeContext?: RuntimeContextConfig;
|
|
116
|
-
screenshotContext?: ScreenshotContextConfig;
|
|
117
116
|
}
|
|
118
117
|
interface ServerState {
|
|
119
118
|
port: number | null;
|
|
@@ -126,7 +125,6 @@ interface ServerState {
|
|
|
126
125
|
|
|
127
126
|
type AiIntent = 'ask' | 'fix' | 'review' | 'redesign';
|
|
128
127
|
type AnnotationIntent = AiIntent;
|
|
129
|
-
type IntentLabels = Partial<Record<Provider | 'clipboard', string>>;
|
|
130
128
|
interface IntentConfigBase {
|
|
131
129
|
id: string;
|
|
132
130
|
label?: string;
|
|
@@ -143,18 +141,19 @@ type InspectoPromptsConfig = (string | IntentConfig)[] | {
|
|
|
143
141
|
$replace: true;
|
|
144
142
|
items: (string | IntentConfig)[];
|
|
145
143
|
};
|
|
144
|
+
type InspectoLocale = 'en' | 'zh-CN' | (string & {});
|
|
145
|
+
type InspectoMessages = Partial<Record<string, string>>;
|
|
146
146
|
interface InspectorOptions {
|
|
147
|
+
locale?: InspectoLocale;
|
|
148
|
+
messages?: InspectoMessages;
|
|
147
149
|
hotKeys?: HotKeys;
|
|
148
|
-
labels?: IntentLabels;
|
|
149
150
|
askPlaceholder?: string;
|
|
150
151
|
serverUrl?: string;
|
|
151
152
|
maxSnippetLines?: number;
|
|
152
153
|
defaultActive?: boolean;
|
|
153
154
|
theme?: 'light' | 'dark' | 'auto';
|
|
154
155
|
includeSnippet?: boolean;
|
|
155
|
-
annotationResponseMode?: 'unified' | 'per-annotation';
|
|
156
156
|
runtimeContext?: RuntimeContextConfig;
|
|
157
|
-
screenshotContext?: ScreenshotContextConfig;
|
|
158
157
|
}
|
|
159
158
|
interface SendToAiRequest {
|
|
160
159
|
location: SourceLocation;
|
|
@@ -162,7 +161,6 @@ interface SendToAiRequest {
|
|
|
162
161
|
prompt?: string;
|
|
163
162
|
target?: Provider;
|
|
164
163
|
runtimeContext?: RuntimeContextEnvelope;
|
|
165
|
-
screenshotContext?: ScreenshotContext;
|
|
166
164
|
}
|
|
167
165
|
interface SendToAiResponse {
|
|
168
166
|
success: boolean;
|
|
@@ -224,16 +222,6 @@ interface RuntimeContextConfig {
|
|
|
224
222
|
maxRuntimeErrors?: number;
|
|
225
223
|
maxFailedRequests?: number;
|
|
226
224
|
}
|
|
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
225
|
interface OpenFileRequest {
|
|
238
226
|
file: string;
|
|
239
227
|
line: number;
|
|
@@ -294,6 +282,65 @@ interface AnnotationSession {
|
|
|
294
282
|
current: Annotation | null;
|
|
295
283
|
queue: Annotation[];
|
|
296
284
|
}
|
|
285
|
+
type AnnotationSessionStatus = 'pending' | 'acknowledged' | 'in_progress' | 'resolved' | 'dismissed';
|
|
286
|
+
type AnnotationThreadRole = 'user' | 'agent' | 'system';
|
|
287
|
+
interface AnnotationThreadMessage {
|
|
288
|
+
id: string;
|
|
289
|
+
role: AnnotationThreadRole;
|
|
290
|
+
text: string;
|
|
291
|
+
createdAt: number;
|
|
292
|
+
}
|
|
293
|
+
interface AnnotationWorkSession {
|
|
294
|
+
id: string;
|
|
295
|
+
instruction: string;
|
|
296
|
+
annotations: Annotation[];
|
|
297
|
+
deliveryMode?: AnnotationDeliveryMode;
|
|
298
|
+
runtimeContext?: RuntimeContextEnvelope;
|
|
299
|
+
cssContextPrompt?: string;
|
|
300
|
+
pageUrl?: string;
|
|
301
|
+
route?: string;
|
|
302
|
+
status: AnnotationSessionStatus;
|
|
303
|
+
messages: AnnotationThreadMessage[];
|
|
304
|
+
createdAt: number;
|
|
305
|
+
updatedAt: number;
|
|
306
|
+
acknowledgedAt?: number;
|
|
307
|
+
resolvedAt?: number;
|
|
308
|
+
}
|
|
309
|
+
interface AnnotationWorkSessionSummary {
|
|
310
|
+
id: string;
|
|
311
|
+
status: AnnotationSessionStatus;
|
|
312
|
+
createdAt: number;
|
|
313
|
+
updatedAt: number;
|
|
314
|
+
}
|
|
315
|
+
interface CreateAnnotationWorkSessionInput {
|
|
316
|
+
instruction?: string;
|
|
317
|
+
annotations: Annotation[];
|
|
318
|
+
deliveryMode?: AnnotationDeliveryMode;
|
|
319
|
+
runtimeContext?: RuntimeContextEnvelope;
|
|
320
|
+
cssContextPrompt?: string;
|
|
321
|
+
pageUrl?: string;
|
|
322
|
+
route?: string;
|
|
323
|
+
messages?: AnnotationThreadMessage[];
|
|
324
|
+
}
|
|
325
|
+
interface AppendAnnotationThreadMessageInput {
|
|
326
|
+
role: AnnotationThreadRole;
|
|
327
|
+
text: string;
|
|
328
|
+
}
|
|
329
|
+
interface AnnotationSessionReplyRequest {
|
|
330
|
+
role: AnnotationThreadRole;
|
|
331
|
+
text: string;
|
|
332
|
+
}
|
|
333
|
+
interface AnnotationSessionResolveRequest {
|
|
334
|
+
message?: string;
|
|
335
|
+
}
|
|
336
|
+
interface AnnotationSessionClaimRequest {
|
|
337
|
+
timeoutMs?: number;
|
|
338
|
+
}
|
|
339
|
+
type AnnotationSessionEventType = 'session-created' | 'session-message-appended' | 'session-status-updated';
|
|
340
|
+
interface AnnotationSessionEvent {
|
|
341
|
+
type: AnnotationSessionEventType;
|
|
342
|
+
session: AnnotationWorkSession;
|
|
343
|
+
}
|
|
297
344
|
interface AnnotationTransportTarget {
|
|
298
345
|
location: SourceLocation;
|
|
299
346
|
label?: string;
|
|
@@ -305,33 +352,46 @@ interface AnnotationTransport {
|
|
|
305
352
|
intent: AnnotationIntent;
|
|
306
353
|
targets: AnnotationTransportTarget[];
|
|
307
354
|
}
|
|
355
|
+
type AnnotationDeliveryMode = 'ide' | 'agent';
|
|
308
356
|
interface SendAnnotationsToAiRequest {
|
|
309
357
|
instruction?: string;
|
|
310
358
|
annotations: AnnotationTransport[];
|
|
311
|
-
responseMode?: 'unified' | 'per-annotation';
|
|
312
359
|
runtimeContext?: RuntimeContextEnvelope;
|
|
313
|
-
screenshotContext?: ScreenshotContext;
|
|
314
360
|
cssContextPrompt?: string;
|
|
361
|
+
deliveryMode?: AnnotationDeliveryMode;
|
|
315
362
|
}
|
|
316
363
|
interface SendAnnotationsToAiResponse {
|
|
317
364
|
success: boolean;
|
|
318
365
|
error?: string;
|
|
319
366
|
errorCode?: AiErrorCode;
|
|
367
|
+
session?: AnnotationWorkSessionSummary;
|
|
320
368
|
fallbackPayload?: {
|
|
321
369
|
prompt: string;
|
|
322
370
|
};
|
|
323
371
|
}
|
|
324
|
-
|
|
372
|
+
interface AnnotationSessionMutationResponse {
|
|
373
|
+
success: boolean;
|
|
374
|
+
error?: string;
|
|
375
|
+
session?: AnnotationWorkSession;
|
|
376
|
+
}
|
|
377
|
+
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
378
|
|
|
326
379
|
declare const INSPECTO_API_PATHS: {
|
|
327
380
|
readonly HEALTH: "/inspecto/api/v1/health";
|
|
328
381
|
readonly CLIENT_CONFIG: "/inspecto/api/v1/client/config";
|
|
329
382
|
readonly IDE_INFO: "/inspecto/api/v1/ide/info";
|
|
330
383
|
readonly IDE_OPEN: "/inspecto/api/v1/ide/open";
|
|
384
|
+
readonly SOURCE_OPEN: "/inspecto/api/v1/source/open";
|
|
331
385
|
readonly PROJECT_SNIPPET: "/inspecto/api/v1/project/snippet";
|
|
332
386
|
readonly AI_DISPATCH: "/inspecto/api/v1/ai/dispatch";
|
|
333
387
|
readonly AI_BATCH_DISPATCH: "/inspecto/api/v1/ai/dispatch/annotations";
|
|
334
388
|
readonly AI_TICKET: "/inspecto/api/v1/ai/ticket";
|
|
389
|
+
readonly SESSIONS: "/inspecto/api/v1/sessions";
|
|
390
|
+
readonly SESSION_CLAIM_NEXT: "/inspecto/api/v1/sessions/claim";
|
|
391
|
+
readonly SESSION_EVENTS: "/inspecto/api/v1/sessions/events";
|
|
392
|
+
readonly SESSION_REPLY_SUFFIX: "/reply";
|
|
393
|
+
readonly SESSION_RESOLVE_SUFFIX: "/resolve";
|
|
394
|
+
readonly SESSION_DISMISS_SUFFIX: "/dismiss";
|
|
335
395
|
};
|
|
336
396
|
|
|
337
397
|
declare const DEFAULT_INTENTS: {
|
|
@@ -341,4 +401,4 @@ declare const DEFAULT_INTENTS: {
|
|
|
341
401
|
prompt: string;
|
|
342
402
|
}[];
|
|
343
403
|
|
|
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
|
|
404
|
+
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
|
@@ -68,10 +68,17 @@ var INSPECTO_API_PATHS = {
|
|
|
68
68
|
CLIENT_CONFIG: "/inspecto/api/v1/client/config",
|
|
69
69
|
IDE_INFO: "/inspecto/api/v1/ide/info",
|
|
70
70
|
IDE_OPEN: "/inspecto/api/v1/ide/open",
|
|
71
|
+
SOURCE_OPEN: "/inspecto/api/v1/source/open",
|
|
71
72
|
PROJECT_SNIPPET: "/inspecto/api/v1/project/snippet",
|
|
72
73
|
AI_DISPATCH: "/inspecto/api/v1/ai/dispatch",
|
|
73
74
|
AI_BATCH_DISPATCH: "/inspecto/api/v1/ai/dispatch/annotations",
|
|
74
|
-
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"
|
|
75
82
|
};
|
|
76
83
|
|
|
77
84
|
// src/intents.ts
|
|
@@ -80,43 +87,33 @@ var DEFAULT_INTENTS = [
|
|
|
80
87
|
id: "explain",
|
|
81
88
|
label: "Explain",
|
|
82
89
|
aiIntent: "ask",
|
|
83
|
-
prompt: `Explain
|
|
90
|
+
prompt: `Explain this {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
84
91
|
|
|
85
|
-
|
|
86
|
-
- its UI responsibility
|
|
87
|
-
- key props, state, or side effects
|
|
88
|
-
- any non-obvious logic worth noticing`
|
|
92
|
+
Cover its UI role, key props/state/side effects, and any non-obvious logic.`
|
|
89
93
|
},
|
|
90
94
|
{
|
|
91
95
|
id: "fix-bug",
|
|
92
96
|
label: "Fix Bug",
|
|
93
97
|
aiIntent: "fix",
|
|
94
|
-
prompt: `
|
|
98
|
+
prompt: `Fix the bug in this {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
95
99
|
|
|
96
|
-
|
|
97
|
-
- identify the most likely root cause
|
|
98
|
-
- explain why it happens
|
|
99
|
-
- suggest the smallest safe fix
|
|
100
|
-
|
|
101
|
-
If important context is missing, ask for it before proposing broader changes.`
|
|
100
|
+
Identify the likely root cause and propose the smallest safe fix.`
|
|
102
101
|
},
|
|
103
102
|
{
|
|
104
103
|
id: "fix-ui",
|
|
105
104
|
label: "Fix UI",
|
|
106
105
|
aiIntent: "fix",
|
|
107
|
-
prompt: `
|
|
106
|
+
prompt: `Fix the UI issue in this {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
108
107
|
|
|
109
|
-
|
|
110
|
-
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.`
|
|
111
109
|
},
|
|
112
110
|
{
|
|
113
111
|
id: "improve",
|
|
114
112
|
label: "Improve",
|
|
115
113
|
aiIntent: "review",
|
|
116
|
-
prompt: `Review this {{framework}} component from \`{{file}}\` (line {{line}})
|
|
114
|
+
prompt: `Review this {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
117
115
|
|
|
118
|
-
|
|
119
|
-
Keep behavior unchanged unless a change is clearly justified.`
|
|
116
|
+
Suggest practical readability, maintainability, and small structural improvements. Keep behavior unchanged unless clearly justified.`
|
|
120
117
|
}
|
|
121
118
|
];
|
|
122
119
|
export {
|