@inspecto-dev/types 0.3.8 → 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 +16 -19
- package/dist/index.d.cts +83 -25
- package/dist/index.d.ts +83 -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,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
|
-
'
|
|
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
|
-
|
|
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
|
|
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
|
-
'
|
|
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
|
-
|
|
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
|
|
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
|
@@ -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 {
|