@getmateo/plugin 0.0.0-stage → 0.17.1
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/LICENSE +211 -0
- package/dist/attachments.d.ts +26 -0
- package/dist/attachments.js +17 -0
- package/dist/client/buttons.d.ts +64 -0
- package/dist/client/buttons.js +2 -0
- package/dist/client/client-state.d.ts +15 -0
- package/dist/client/client-state.js +32 -0
- package/dist/client/contracts.d.ts +295 -0
- package/dist/client/contracts.js +2 -0
- package/dist/client/host.d.ts +19 -0
- package/dist/client/host.js +12 -0
- package/dist/client/index.d.ts +38 -0
- package/dist/client/index.js +4 -0
- package/dist/client/mateo-context.d.ts +9 -0
- package/dist/client/mateo-context.js +16 -0
- package/dist/client/menu.d.ts +45 -0
- package/dist/client/menu.js +2 -0
- package/dist/client/react-native.d.ts +53 -0
- package/dist/client/react-native.js +2 -0
- package/dist/client/rpc-context.d.ts +13 -0
- package/dist/client/rpc-context.js +18 -0
- package/dist/client/runtime-context-bridge.d.ts +5 -0
- package/dist/client/runtime-context-bridge.js +19 -0
- package/dist/client/settings-sections.d.ts +12 -0
- package/dist/client/settings-sections.js +2 -0
- package/dist/client/shallow.d.ts +2 -0
- package/dist/client/shallow.js +45 -0
- package/dist/client/sidebar-projects.d.ts +110 -0
- package/dist/client/sidebar-projects.js +2 -0
- package/dist/client/sidebar-workspaces.d.ts +17 -0
- package/dist/client/sidebar-workspaces.js +2 -0
- package/dist/client/storage.d.ts +12 -0
- package/dist/client/storage.js +2 -0
- package/dist/client/terminal-themes.d.ts +33 -0
- package/dist/client/terminal-themes.js +2 -0
- package/dist/client/ui.d.ts +161 -0
- package/dist/client/ui.js +2 -0
- package/dist/contracts.d.ts +90 -0
- package/dist/contracts.js +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +5 -0
- package/dist/rpc.d.ts +17 -0
- package/dist/rpc.js +12 -0
- package/dist/server/acp-internal/connection.d.ts +4 -0
- package/dist/server/acp-internal/connection.js +1301 -0
- package/dist/server/acp.d.ts +112 -0
- package/dist/server/acp.js +22 -0
- package/dist/server/contracts.d.ts +57 -0
- package/dist/server/contracts.js +2 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +2 -0
- package/dist/server/lifecycle.d.ts +99 -0
- package/dist/server/lifecycle.js +2 -0
- package/dist/server/models.d.ts +55 -0
- package/dist/server/models.js +2 -0
- package/dist/server/process-internal/windows-command.d.ts +15 -0
- package/dist/server/process-internal/windows-command.js +41 -0
- package/dist/server/process.d.ts +25 -0
- package/dist/server/process.js +71 -0
- package/dist/server/provider.d.ts +735 -0
- package/dist/server/provider.js +871 -0
- package/dist/server/usage.d.ts +149 -0
- package/dist/server/usage.js +134 -0
- package/dist/settings.d.ts +70 -0
- package/dist/settings.js +40 -0
- package/package.json +94 -4
- package/README.md +0 -3
|
@@ -0,0 +1,735 @@
|
|
|
1
|
+
import type { JsonValue } from "@getmateo/protocol/agent-types";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const PROVIDER_PROTOCOL_VERSION: 1;
|
|
4
|
+
export declare const PROVIDER_CAPABILITIES: readonly ["prompt.message", "prompt.command", "prompt.image", "prompt.output_schema", "prompt.steer", "session.archive", "session.configure", "session.list", "session.persistence", "session.revert.both", "session.revert.conversation", "session.revert.files", "session.subsession", "session.unarchive", "permission", "permission.tool_policy", "timeline.plugin"];
|
|
5
|
+
export type ProviderCapability = (typeof PROVIDER_CAPABILITIES)[number];
|
|
6
|
+
export interface ProviderRegistration {
|
|
7
|
+
/** Equal keys share discovery within this provider. Include effective configuration and execution environment. */
|
|
8
|
+
getCatalogCacheKey?(options: ProviderCatalogOptions): Promise<string | undefined>;
|
|
9
|
+
/** Search persisted user/assistant text without connecting, opening a session, or starting the CLI. */
|
|
10
|
+
searchConversations?(request: ProviderConversationSearchRequest): Promise<ProviderConversationSearchPage>;
|
|
11
|
+
/** Default executable and arguments; the daemon resolves overrides before status/connect. */
|
|
12
|
+
command?: readonly [string, ...string[]];
|
|
13
|
+
status?(request: ProviderStatusRequest): Promise<ProviderStatus>;
|
|
14
|
+
id: string;
|
|
15
|
+
label: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
/** Optional independent execution owner; default export a zero-argument ProviderRuntimeFactory. */
|
|
18
|
+
runtime?: {
|
|
19
|
+
entry: string;
|
|
20
|
+
};
|
|
21
|
+
/** Plugin-directory-relative path to a self-contained SVG file. */
|
|
22
|
+
icon?: string;
|
|
23
|
+
connect(request: ProviderConnectRequest): Promise<ProviderConnection>;
|
|
24
|
+
}
|
|
25
|
+
/** Creates a self-contained provider without daemon contribution state or callbacks. */
|
|
26
|
+
export type ProviderRuntimeFactory = () => ProviderRegistration;
|
|
27
|
+
export type ProviderCatalogOptions = {
|
|
28
|
+
scope: "global";
|
|
29
|
+
force?: boolean;
|
|
30
|
+
launch?: ProviderLaunch;
|
|
31
|
+
} | {
|
|
32
|
+
scope: "workspace";
|
|
33
|
+
cwd: string;
|
|
34
|
+
force?: boolean;
|
|
35
|
+
launch?: ProviderLaunch;
|
|
36
|
+
};
|
|
37
|
+
export declare const ProviderLaunchSchema: z.ZodObject<{
|
|
38
|
+
command: z.ZodString;
|
|
39
|
+
args: z.ZodArray<z.ZodString>;
|
|
40
|
+
env: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export type ProviderLaunch = z.infer<typeof ProviderLaunchSchema>;
|
|
43
|
+
export interface ProviderStatusRequest {
|
|
44
|
+
launch?: ProviderLaunch;
|
|
45
|
+
}
|
|
46
|
+
export declare const ProviderStatusSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
47
|
+
available: z.ZodLiteral<true>;
|
|
48
|
+
diagnostic: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
50
|
+
available: z.ZodLiteral<false>;
|
|
51
|
+
diagnostic: z.ZodString;
|
|
52
|
+
}, z.core.$strip>], "available">;
|
|
53
|
+
export type ProviderStatus = z.infer<typeof ProviderStatusSchema>;
|
|
54
|
+
export interface ProviderConnectRequest {
|
|
55
|
+
launch?: ProviderLaunch;
|
|
56
|
+
versions: readonly number[];
|
|
57
|
+
capabilities: readonly string[];
|
|
58
|
+
}
|
|
59
|
+
export interface ProviderConnection {
|
|
60
|
+
readonly version: number;
|
|
61
|
+
readonly capabilities: readonly string[];
|
|
62
|
+
send(input: ProviderInput): Promise<void>;
|
|
63
|
+
onEvent(listener: (event: ProviderEvent) => void): () => void;
|
|
64
|
+
close(): Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
export declare const ProviderPersistenceSchema: z.ZodObject<{
|
|
67
|
+
version: z.ZodNumber;
|
|
68
|
+
data: z.ZodJSONSchema;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export type ProviderPersistence = z.infer<typeof ProviderPersistenceSchema>;
|
|
71
|
+
export declare const ConversationSearchRequestSchema: z.ZodObject<{
|
|
72
|
+
query: z.ZodString;
|
|
73
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
74
|
+
limit: z.ZodNumber;
|
|
75
|
+
candidates: z.ZodArray<z.ZodObject<{
|
|
76
|
+
agentId: z.ZodString;
|
|
77
|
+
sessionId: z.ZodString;
|
|
78
|
+
cwd: z.ZodString;
|
|
79
|
+
}, z.core.$strip>>;
|
|
80
|
+
external: z.ZodOptional<z.ZodObject<{
|
|
81
|
+
providers: z.ZodArray<z.ZodString>;
|
|
82
|
+
excludedSessionIds: z.ZodArray<z.ZodString>;
|
|
83
|
+
excludedCwds: z.ZodArray<z.ZodString>;
|
|
84
|
+
}, z.core.$strip>>;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
export type ConversationSearchRequest = z.infer<typeof ConversationSearchRequestSchema>;
|
|
87
|
+
export declare const ConversationSearchPageSchema: z.ZodObject<{
|
|
88
|
+
hits: z.ZodArray<z.ZodObject<{
|
|
89
|
+
role: z.ZodEnum<{
|
|
90
|
+
user: "user";
|
|
91
|
+
assistant: "assistant";
|
|
92
|
+
}>;
|
|
93
|
+
snippet: z.ZodString;
|
|
94
|
+
agentId: z.ZodString;
|
|
95
|
+
}, z.core.$strip>>;
|
|
96
|
+
externalHits: z.ZodArray<z.ZodObject<{
|
|
97
|
+
role: z.ZodEnum<{
|
|
98
|
+
user: "user";
|
|
99
|
+
assistant: "assistant";
|
|
100
|
+
}>;
|
|
101
|
+
snippet: z.ZodString;
|
|
102
|
+
provider: z.ZodString;
|
|
103
|
+
sessionId: z.ZodString;
|
|
104
|
+
cwd: z.ZodString;
|
|
105
|
+
title: z.ZodNullable<z.ZodString>;
|
|
106
|
+
updatedAt: z.ZodISODateTime;
|
|
107
|
+
}, z.core.$strip>>;
|
|
108
|
+
unavailableCount: z.ZodNumber;
|
|
109
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
export type ConversationSearchPage = z.infer<typeof ConversationSearchPageSchema>;
|
|
112
|
+
export declare const ProviderConversationSearchRequestSchema: z.ZodObject<{
|
|
113
|
+
query: z.ZodString;
|
|
114
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
115
|
+
limit: z.ZodNumber;
|
|
116
|
+
env: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
117
|
+
candidates: z.ZodArray<z.ZodObject<{
|
|
118
|
+
agentId: z.ZodString;
|
|
119
|
+
cwd: z.ZodString;
|
|
120
|
+
persistence: z.ZodObject<{
|
|
121
|
+
version: z.ZodNumber;
|
|
122
|
+
data: z.ZodJSONSchema;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
external: z.ZodOptional<z.ZodObject<{
|
|
126
|
+
excludedCwds: z.ZodArray<z.ZodString>;
|
|
127
|
+
excludedPersistence: z.ZodArray<z.ZodObject<{
|
|
128
|
+
version: z.ZodNumber;
|
|
129
|
+
data: z.ZodJSONSchema;
|
|
130
|
+
}, z.core.$strip>>;
|
|
131
|
+
}, z.core.$strip>>;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
export type ProviderConversationSearchRequest = z.infer<typeof ProviderConversationSearchRequestSchema>;
|
|
134
|
+
export declare const ProviderConversationSearchPageSchema: z.ZodObject<{
|
|
135
|
+
hits: z.ZodArray<z.ZodObject<{
|
|
136
|
+
role: z.ZodEnum<{
|
|
137
|
+
user: "user";
|
|
138
|
+
assistant: "assistant";
|
|
139
|
+
}>;
|
|
140
|
+
snippet: z.ZodString;
|
|
141
|
+
agentId: z.ZodString;
|
|
142
|
+
}, z.core.$strip>>;
|
|
143
|
+
unavailableCount: z.ZodNumber;
|
|
144
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
145
|
+
externalHits: z.ZodArray<z.ZodObject<{
|
|
146
|
+
title: z.ZodNullable<z.ZodString>;
|
|
147
|
+
cwd: z.ZodString;
|
|
148
|
+
role: z.ZodEnum<{
|
|
149
|
+
user: "user";
|
|
150
|
+
assistant: "assistant";
|
|
151
|
+
}>;
|
|
152
|
+
snippet: z.ZodString;
|
|
153
|
+
updatedAt: z.ZodISODateTime;
|
|
154
|
+
persistence: z.ZodObject<{
|
|
155
|
+
version: z.ZodNumber;
|
|
156
|
+
data: z.ZodJSONSchema;
|
|
157
|
+
}, z.core.$strip>;
|
|
158
|
+
}, z.core.$strip>>;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
export type ProviderConversationSearchPage = z.infer<typeof ProviderConversationSearchPageSchema>;
|
|
161
|
+
export type ProviderMcpServerConfig = {
|
|
162
|
+
type: "stdio";
|
|
163
|
+
command: string;
|
|
164
|
+
args?: string[];
|
|
165
|
+
env?: Record<string, string>;
|
|
166
|
+
alwaysLoad?: boolean;
|
|
167
|
+
} | {
|
|
168
|
+
type: "http" | "sse";
|
|
169
|
+
url: string;
|
|
170
|
+
headers?: Record<string, string>;
|
|
171
|
+
alwaysLoad?: boolean;
|
|
172
|
+
};
|
|
173
|
+
export interface ProviderToolPolicy {
|
|
174
|
+
preapproved: Array<{
|
|
175
|
+
kind: "mcp";
|
|
176
|
+
server: string;
|
|
177
|
+
tool: string;
|
|
178
|
+
}>;
|
|
179
|
+
}
|
|
180
|
+
export interface ProviderSessionConfig {
|
|
181
|
+
cwd: string;
|
|
182
|
+
env: Readonly<Record<string, string>>;
|
|
183
|
+
systemPrompt?: string;
|
|
184
|
+
mcpServers: Readonly<Record<string, ProviderMcpServerConfig>>;
|
|
185
|
+
toolPolicy?: ProviderToolPolicy;
|
|
186
|
+
model?: string;
|
|
187
|
+
mode?: string;
|
|
188
|
+
thinkingOption?: string;
|
|
189
|
+
settings: Readonly<Record<string, JsonValue>>;
|
|
190
|
+
providerOptions?: Readonly<Record<string, unknown>>;
|
|
191
|
+
title?: string;
|
|
192
|
+
persist: boolean;
|
|
193
|
+
}
|
|
194
|
+
export interface ProviderConfigChanges {
|
|
195
|
+
model?: string | null;
|
|
196
|
+
mode?: string | null;
|
|
197
|
+
thinkingOption?: string | null;
|
|
198
|
+
settings?: Readonly<Record<string, JsonValue>>;
|
|
199
|
+
}
|
|
200
|
+
export interface ProviderPrompt {
|
|
201
|
+
clientMessageId: string;
|
|
202
|
+
delivery: "auto" | "steer";
|
|
203
|
+
input: {
|
|
204
|
+
type: "message";
|
|
205
|
+
content: ProviderContent[];
|
|
206
|
+
} | {
|
|
207
|
+
type: "command";
|
|
208
|
+
name: string;
|
|
209
|
+
arguments: string;
|
|
210
|
+
};
|
|
211
|
+
outputSchema?: JsonValue;
|
|
212
|
+
clearPendingPermissions?: boolean;
|
|
213
|
+
}
|
|
214
|
+
interface ProviderForgeChangeRequestAttachment {
|
|
215
|
+
type: "forge_change_request";
|
|
216
|
+
mimeType: "application/mateo-forge-change-request";
|
|
217
|
+
forge?: string;
|
|
218
|
+
number: number;
|
|
219
|
+
title: string;
|
|
220
|
+
url: string;
|
|
221
|
+
body?: string | null;
|
|
222
|
+
projectPath?: string;
|
|
223
|
+
baseRefName?: string | null;
|
|
224
|
+
headRefName?: string | null;
|
|
225
|
+
}
|
|
226
|
+
interface ProviderForgeIssueAttachment {
|
|
227
|
+
type: "forge_issue";
|
|
228
|
+
mimeType: "application/mateo-forge-issue";
|
|
229
|
+
forge?: string;
|
|
230
|
+
number: number;
|
|
231
|
+
title: string;
|
|
232
|
+
url: string;
|
|
233
|
+
body?: string | null;
|
|
234
|
+
projectPath?: string;
|
|
235
|
+
}
|
|
236
|
+
interface ProviderGitHubPrAttachment {
|
|
237
|
+
type: "github_pr";
|
|
238
|
+
mimeType: "application/github-pr";
|
|
239
|
+
number: number;
|
|
240
|
+
title: string;
|
|
241
|
+
url: string;
|
|
242
|
+
body?: string | null;
|
|
243
|
+
baseRefName?: string | null;
|
|
244
|
+
headRefName?: string | null;
|
|
245
|
+
}
|
|
246
|
+
interface ProviderGitHubIssueAttachment {
|
|
247
|
+
type: "github_issue";
|
|
248
|
+
mimeType: "application/github-issue";
|
|
249
|
+
number: number;
|
|
250
|
+
title: string;
|
|
251
|
+
url: string;
|
|
252
|
+
body?: string | null;
|
|
253
|
+
}
|
|
254
|
+
interface ProviderTextAttachment {
|
|
255
|
+
type: "text";
|
|
256
|
+
mimeType: "text/plain";
|
|
257
|
+
contextKind?: string;
|
|
258
|
+
title?: string | null;
|
|
259
|
+
text: string;
|
|
260
|
+
externalResource?: {
|
|
261
|
+
provider: string;
|
|
262
|
+
providerLabel: string;
|
|
263
|
+
resourceType: string;
|
|
264
|
+
id: string;
|
|
265
|
+
identifier: string;
|
|
266
|
+
title: string;
|
|
267
|
+
url: string;
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
interface ProviderReviewAttachment {
|
|
271
|
+
type: "review";
|
|
272
|
+
mimeType: "application/mateo-review";
|
|
273
|
+
cwd: string;
|
|
274
|
+
mode: "uncommitted" | "base" | "all";
|
|
275
|
+
baseRef?: string | null;
|
|
276
|
+
comments: Array<{
|
|
277
|
+
filePath: string;
|
|
278
|
+
side: "old" | "new";
|
|
279
|
+
lineNumber: number;
|
|
280
|
+
body: string;
|
|
281
|
+
context: {
|
|
282
|
+
hunkHeader: string;
|
|
283
|
+
targetLine: ProviderReviewContextLine;
|
|
284
|
+
lines: ProviderReviewContextLine[];
|
|
285
|
+
};
|
|
286
|
+
}>;
|
|
287
|
+
}
|
|
288
|
+
interface ProviderReviewContextLine {
|
|
289
|
+
oldLineNumber: number | null;
|
|
290
|
+
newLineNumber: number | null;
|
|
291
|
+
type: "add" | "remove" | "context";
|
|
292
|
+
content: string;
|
|
293
|
+
}
|
|
294
|
+
export type ProviderContent = {
|
|
295
|
+
type: "text";
|
|
296
|
+
text: string;
|
|
297
|
+
} | {
|
|
298
|
+
type: "image";
|
|
299
|
+
data: string;
|
|
300
|
+
mimeType: string;
|
|
301
|
+
} | ProviderForgeChangeRequestAttachment | ProviderForgeIssueAttachment | ProviderGitHubPrAttachment | ProviderGitHubIssueAttachment | ProviderTextAttachment | ProviderReviewAttachment | {
|
|
302
|
+
type: "uploaded_file";
|
|
303
|
+
id: string;
|
|
304
|
+
fileName: string;
|
|
305
|
+
mimeType: string;
|
|
306
|
+
size: number;
|
|
307
|
+
path: string;
|
|
308
|
+
};
|
|
309
|
+
export type ProviderInput = {
|
|
310
|
+
type: "catalog";
|
|
311
|
+
requestId: string;
|
|
312
|
+
cwd?: string;
|
|
313
|
+
} | {
|
|
314
|
+
type: "sessions";
|
|
315
|
+
requestId: string;
|
|
316
|
+
query?: string;
|
|
317
|
+
cwd?: string;
|
|
318
|
+
limit?: number;
|
|
319
|
+
} | {
|
|
320
|
+
type: "session.open";
|
|
321
|
+
requestId: string;
|
|
322
|
+
sessionId: string;
|
|
323
|
+
config: ProviderSessionConfig;
|
|
324
|
+
persistence?: ProviderPersistence;
|
|
325
|
+
history: "replay" | "skip";
|
|
326
|
+
} | {
|
|
327
|
+
type: "session.prompt";
|
|
328
|
+
sessionId: string;
|
|
329
|
+
prompt: ProviderPrompt;
|
|
330
|
+
} | {
|
|
331
|
+
type: "session.interrupt";
|
|
332
|
+
requestId: string;
|
|
333
|
+
sessionId: string;
|
|
334
|
+
} | {
|
|
335
|
+
type: "session.permission";
|
|
336
|
+
sessionId: string;
|
|
337
|
+
permissionId: string;
|
|
338
|
+
response: ProviderPermissionResponse;
|
|
339
|
+
} | {
|
|
340
|
+
type: "session.configure";
|
|
341
|
+
requestId: string;
|
|
342
|
+
sessionId: string;
|
|
343
|
+
changes: ProviderConfigChanges;
|
|
344
|
+
} | {
|
|
345
|
+
type: "session.revert";
|
|
346
|
+
requestId: string;
|
|
347
|
+
sessionId: string;
|
|
348
|
+
token: JsonValue;
|
|
349
|
+
scope: "conversation" | "files" | "both";
|
|
350
|
+
} | {
|
|
351
|
+
type: "session.archive";
|
|
352
|
+
requestId: string;
|
|
353
|
+
persistence: ProviderPersistence;
|
|
354
|
+
} | {
|
|
355
|
+
type: "session.unarchive";
|
|
356
|
+
requestId: string;
|
|
357
|
+
persistence: ProviderPersistence;
|
|
358
|
+
} | {
|
|
359
|
+
type: "session.close";
|
|
360
|
+
requestId: string;
|
|
361
|
+
sessionId: string;
|
|
362
|
+
};
|
|
363
|
+
export interface ProviderThinkingOption {
|
|
364
|
+
id: string;
|
|
365
|
+
label: string;
|
|
366
|
+
description?: string;
|
|
367
|
+
isDefault?: boolean;
|
|
368
|
+
metadata?: Readonly<Record<string, JsonValue>>;
|
|
369
|
+
}
|
|
370
|
+
export interface ProviderModel {
|
|
371
|
+
id: string;
|
|
372
|
+
aliases?: string[];
|
|
373
|
+
isSelectable?: boolean;
|
|
374
|
+
label: string;
|
|
375
|
+
description?: string;
|
|
376
|
+
isDefault?: boolean;
|
|
377
|
+
metadata?: Readonly<Record<string, JsonValue>>;
|
|
378
|
+
contextWindowMaxTokens?: number;
|
|
379
|
+
thinkingOptions?: ProviderThinkingOption[];
|
|
380
|
+
defaultThinkingOptionId?: string;
|
|
381
|
+
}
|
|
382
|
+
export interface ProviderMode {
|
|
383
|
+
id: string;
|
|
384
|
+
label: string;
|
|
385
|
+
description?: string;
|
|
386
|
+
icon?: string;
|
|
387
|
+
colorTier?: string;
|
|
388
|
+
isUnattended?: boolean;
|
|
389
|
+
}
|
|
390
|
+
export type ProviderSetting = {
|
|
391
|
+
type: "toggle";
|
|
392
|
+
id: string;
|
|
393
|
+
label: string;
|
|
394
|
+
description?: string;
|
|
395
|
+
value: boolean;
|
|
396
|
+
} | {
|
|
397
|
+
type: "select";
|
|
398
|
+
id: string;
|
|
399
|
+
label: string;
|
|
400
|
+
description?: string;
|
|
401
|
+
value: string | null;
|
|
402
|
+
options: ReadonlyArray<{
|
|
403
|
+
label: string;
|
|
404
|
+
value: string;
|
|
405
|
+
}>;
|
|
406
|
+
};
|
|
407
|
+
export interface ProviderConfigState {
|
|
408
|
+
model?: string;
|
|
409
|
+
mode?: string;
|
|
410
|
+
thinkingOption?: string;
|
|
411
|
+
models: readonly ProviderModel[];
|
|
412
|
+
modes: readonly ProviderMode[];
|
|
413
|
+
thinkingOptions: readonly ProviderThinkingOption[];
|
|
414
|
+
settings: readonly ProviderSetting[];
|
|
415
|
+
}
|
|
416
|
+
export interface ProviderCatalog {
|
|
417
|
+
models: readonly ProviderModel[];
|
|
418
|
+
modes: readonly ProviderMode[];
|
|
419
|
+
thinkingOptions?: readonly ProviderThinkingOption[];
|
|
420
|
+
defaultModel?: string;
|
|
421
|
+
defaultMode?: string;
|
|
422
|
+
defaultThinkingOption?: string;
|
|
423
|
+
}
|
|
424
|
+
export interface ProviderSessionSummary {
|
|
425
|
+
persistence: ProviderPersistence;
|
|
426
|
+
cwd: string;
|
|
427
|
+
title?: string;
|
|
428
|
+
description?: string;
|
|
429
|
+
updatedAt?: string;
|
|
430
|
+
}
|
|
431
|
+
export interface ProviderCommand {
|
|
432
|
+
name: string;
|
|
433
|
+
description: string;
|
|
434
|
+
argumentHint?: string;
|
|
435
|
+
}
|
|
436
|
+
export interface ProviderError {
|
|
437
|
+
message: string;
|
|
438
|
+
code?: string;
|
|
439
|
+
diagnostic?: string;
|
|
440
|
+
}
|
|
441
|
+
export interface ProviderNotice {
|
|
442
|
+
id: string;
|
|
443
|
+
severity: "info" | "warning" | "error";
|
|
444
|
+
title: string;
|
|
445
|
+
description?: string;
|
|
446
|
+
dismissed?: boolean;
|
|
447
|
+
}
|
|
448
|
+
export interface ProviderPermissionAction {
|
|
449
|
+
id: string;
|
|
450
|
+
label: string;
|
|
451
|
+
behavior: "allow" | "deny";
|
|
452
|
+
variant?: "primary" | "secondary" | "danger";
|
|
453
|
+
intent?: "implement" | "implement_resume" | "dismiss";
|
|
454
|
+
}
|
|
455
|
+
export interface ProviderPermissionRequest {
|
|
456
|
+
id: string;
|
|
457
|
+
name: string;
|
|
458
|
+
kind: "tool" | "plan" | "question" | "mode" | "other";
|
|
459
|
+
title?: string;
|
|
460
|
+
description?: string;
|
|
461
|
+
input?: Readonly<Record<string, JsonValue>>;
|
|
462
|
+
detail?: ProviderToolCallDetail;
|
|
463
|
+
suggestions?: Array<Record<string, JsonValue>>;
|
|
464
|
+
actions?: ProviderPermissionAction[];
|
|
465
|
+
metadata?: Readonly<Record<string, JsonValue>>;
|
|
466
|
+
}
|
|
467
|
+
export type ProviderPermissionResponse = {
|
|
468
|
+
behavior: "allow";
|
|
469
|
+
selectedActionId?: string;
|
|
470
|
+
updatedInput?: Record<string, JsonValue>;
|
|
471
|
+
updatedPermissions?: Array<Record<string, JsonValue>>;
|
|
472
|
+
} | {
|
|
473
|
+
behavior: "deny";
|
|
474
|
+
selectedActionId?: string;
|
|
475
|
+
message?: string;
|
|
476
|
+
interrupt?: boolean;
|
|
477
|
+
};
|
|
478
|
+
export interface ProviderUsage {
|
|
479
|
+
inputTokens?: number;
|
|
480
|
+
cachedInputTokens?: number;
|
|
481
|
+
outputTokens?: number;
|
|
482
|
+
totalCostUsd?: number;
|
|
483
|
+
contextWindowMaxTokens?: number;
|
|
484
|
+
contextWindowUsedTokens?: number;
|
|
485
|
+
}
|
|
486
|
+
interface ProviderTimelineIdentity {
|
|
487
|
+
id: string;
|
|
488
|
+
revertToken?: JsonValue;
|
|
489
|
+
}
|
|
490
|
+
export type ProviderToolCallDetail = {
|
|
491
|
+
type: "shell";
|
|
492
|
+
command: string;
|
|
493
|
+
cwd?: string;
|
|
494
|
+
output?: string;
|
|
495
|
+
exitCode?: number | null;
|
|
496
|
+
} | {
|
|
497
|
+
type: "read";
|
|
498
|
+
filePath: string;
|
|
499
|
+
content?: string;
|
|
500
|
+
offset?: number;
|
|
501
|
+
limit?: number;
|
|
502
|
+
} | {
|
|
503
|
+
type: "edit";
|
|
504
|
+
filePath: string;
|
|
505
|
+
oldString?: string;
|
|
506
|
+
newString?: string;
|
|
507
|
+
unifiedDiff?: string;
|
|
508
|
+
} | {
|
|
509
|
+
type: "write";
|
|
510
|
+
filePath: string;
|
|
511
|
+
content?: string;
|
|
512
|
+
} | {
|
|
513
|
+
type: "search";
|
|
514
|
+
query: string;
|
|
515
|
+
toolName?: "search" | "grep" | "glob" | "web_search";
|
|
516
|
+
content?: string;
|
|
517
|
+
filePaths?: string[];
|
|
518
|
+
webResults?: Array<{
|
|
519
|
+
title: string;
|
|
520
|
+
url: string;
|
|
521
|
+
}>;
|
|
522
|
+
annotations?: string[];
|
|
523
|
+
numFiles?: number;
|
|
524
|
+
numMatches?: number;
|
|
525
|
+
durationMs?: number;
|
|
526
|
+
durationSeconds?: number;
|
|
527
|
+
truncated?: boolean;
|
|
528
|
+
mode?: "content" | "files_with_matches" | "count";
|
|
529
|
+
} | {
|
|
530
|
+
type: "fetch";
|
|
531
|
+
url: string;
|
|
532
|
+
prompt?: string;
|
|
533
|
+
result?: string;
|
|
534
|
+
code?: number;
|
|
535
|
+
codeText?: string;
|
|
536
|
+
bytes?: number;
|
|
537
|
+
durationMs?: number;
|
|
538
|
+
} | {
|
|
539
|
+
type: "worktree_setup";
|
|
540
|
+
worktreePath: string;
|
|
541
|
+
branchName: string;
|
|
542
|
+
log: string;
|
|
543
|
+
commands: Array<{
|
|
544
|
+
index: number;
|
|
545
|
+
command: string;
|
|
546
|
+
cwd: string;
|
|
547
|
+
log: string;
|
|
548
|
+
status: "running" | "completed" | "failed";
|
|
549
|
+
exitCode: number | null;
|
|
550
|
+
durationMs?: number;
|
|
551
|
+
}>;
|
|
552
|
+
truncated?: boolean;
|
|
553
|
+
} | {
|
|
554
|
+
type: "sub_agent";
|
|
555
|
+
subAgentType?: string;
|
|
556
|
+
description?: string;
|
|
557
|
+
childSessionId?: string;
|
|
558
|
+
log: string;
|
|
559
|
+
actions?: Array<{
|
|
560
|
+
index: number;
|
|
561
|
+
toolName: string;
|
|
562
|
+
summary?: string;
|
|
563
|
+
}>;
|
|
564
|
+
} | {
|
|
565
|
+
type: "plain_text";
|
|
566
|
+
label?: string;
|
|
567
|
+
text?: string;
|
|
568
|
+
icon?: "wrench" | "square_terminal" | "eye" | "pencil" | "search" | "bot" | "sparkles" | "brain" | "mic_vocal";
|
|
569
|
+
} | {
|
|
570
|
+
type: "plan";
|
|
571
|
+
text: string;
|
|
572
|
+
} | {
|
|
573
|
+
type: "unknown";
|
|
574
|
+
input: JsonValue;
|
|
575
|
+
output: JsonValue;
|
|
576
|
+
};
|
|
577
|
+
type ProviderToolCallItem = ProviderTimelineIdentity & {
|
|
578
|
+
type: "tool_call";
|
|
579
|
+
callId: string;
|
|
580
|
+
name: string;
|
|
581
|
+
detail: ProviderToolCallDetail;
|
|
582
|
+
metadata?: Readonly<Record<string, JsonValue>>;
|
|
583
|
+
} & ({
|
|
584
|
+
status: "running" | "completed" | "canceled";
|
|
585
|
+
error: null;
|
|
586
|
+
} | {
|
|
587
|
+
status: "failed";
|
|
588
|
+
error: JsonValue;
|
|
589
|
+
});
|
|
590
|
+
export type ProviderTimelineItem = (ProviderTimelineIdentity & {
|
|
591
|
+
type: "user_message";
|
|
592
|
+
text: string;
|
|
593
|
+
messageId?: string;
|
|
594
|
+
clientMessageId?: string;
|
|
595
|
+
}) | (ProviderTimelineIdentity & {
|
|
596
|
+
type: "assistant_message";
|
|
597
|
+
text: string;
|
|
598
|
+
messageId?: string;
|
|
599
|
+
}) | (ProviderTimelineIdentity & {
|
|
600
|
+
type: "reasoning";
|
|
601
|
+
text: string;
|
|
602
|
+
}) | ProviderToolCallItem | (ProviderTimelineIdentity & {
|
|
603
|
+
type: "todo";
|
|
604
|
+
items: Array<{
|
|
605
|
+
text: string;
|
|
606
|
+
completed: boolean;
|
|
607
|
+
id?: string;
|
|
608
|
+
status?: "pending" | "in_progress" | "completed";
|
|
609
|
+
activeForm?: string;
|
|
610
|
+
}>;
|
|
611
|
+
}) | (ProviderTimelineIdentity & {
|
|
612
|
+
type: "error";
|
|
613
|
+
message: string;
|
|
614
|
+
}) | (ProviderTimelineIdentity & {
|
|
615
|
+
type: "notification";
|
|
616
|
+
level: "info" | "warning" | "error";
|
|
617
|
+
message: string;
|
|
618
|
+
}) | (ProviderTimelineIdentity & {
|
|
619
|
+
type: "compaction";
|
|
620
|
+
status: "loading" | "completed";
|
|
621
|
+
trigger?: "auto" | "manual";
|
|
622
|
+
preTokens?: number;
|
|
623
|
+
}) | (ProviderTimelineIdentity & {
|
|
624
|
+
type: "plugin";
|
|
625
|
+
pluginId: string;
|
|
626
|
+
kind: string;
|
|
627
|
+
version: number;
|
|
628
|
+
data: JsonValue;
|
|
629
|
+
});
|
|
630
|
+
export type ProviderEvent = {
|
|
631
|
+
type: "catalog";
|
|
632
|
+
requestId: string;
|
|
633
|
+
catalog: ProviderCatalog;
|
|
634
|
+
} | {
|
|
635
|
+
type: "sessions";
|
|
636
|
+
requestId: string;
|
|
637
|
+
sessions: ProviderSessionSummary[];
|
|
638
|
+
} | {
|
|
639
|
+
type: "request.completed";
|
|
640
|
+
requestId: string;
|
|
641
|
+
} | {
|
|
642
|
+
type: "request.failed";
|
|
643
|
+
requestId: string;
|
|
644
|
+
error: ProviderError;
|
|
645
|
+
} | {
|
|
646
|
+
type: "session.opened";
|
|
647
|
+
requestId?: string;
|
|
648
|
+
sessionId: string;
|
|
649
|
+
/** Direct parent in the provider session ID namespace. */
|
|
650
|
+
parentSessionId?: string;
|
|
651
|
+
/** ID of the spawning tool call in the direct parent's timeline. */
|
|
652
|
+
toolCallId?: string;
|
|
653
|
+
capabilities: readonly string[];
|
|
654
|
+
restoration: "core" | "parent";
|
|
655
|
+
persistence?: ProviderPersistence;
|
|
656
|
+
title?: string;
|
|
657
|
+
description?: string;
|
|
658
|
+
cwd: string;
|
|
659
|
+
} | {
|
|
660
|
+
type: "session.ready";
|
|
661
|
+
requestId?: string;
|
|
662
|
+
sessionId: string;
|
|
663
|
+
} | {
|
|
664
|
+
type: "session.closed";
|
|
665
|
+
sessionId: string;
|
|
666
|
+
error?: ProviderError;
|
|
667
|
+
} | {
|
|
668
|
+
type: "session.runtime_failed";
|
|
669
|
+
sessionId: string;
|
|
670
|
+
error: ProviderError;
|
|
671
|
+
} | {
|
|
672
|
+
type: "session.persistence";
|
|
673
|
+
sessionId: string;
|
|
674
|
+
persistence: ProviderPersistence;
|
|
675
|
+
} | {
|
|
676
|
+
type: "session.prompt_result";
|
|
677
|
+
sessionId: string;
|
|
678
|
+
clientMessageId: string;
|
|
679
|
+
result: {
|
|
680
|
+
type: "turn";
|
|
681
|
+
turnId: string;
|
|
682
|
+
} | {
|
|
683
|
+
type: "steer";
|
|
684
|
+
turnId: string;
|
|
685
|
+
} | {
|
|
686
|
+
type: "completed";
|
|
687
|
+
} | {
|
|
688
|
+
type: "failed";
|
|
689
|
+
error: ProviderError;
|
|
690
|
+
};
|
|
691
|
+
} | {
|
|
692
|
+
type: "session.turn";
|
|
693
|
+
sessionId: string;
|
|
694
|
+
turnId: string;
|
|
695
|
+
state: "started" | "completed" | "failed" | "canceled";
|
|
696
|
+
error?: ProviderError;
|
|
697
|
+
} | {
|
|
698
|
+
type: "session.usage";
|
|
699
|
+
sessionId: string;
|
|
700
|
+
turnId?: string;
|
|
701
|
+
usage: ProviderUsage;
|
|
702
|
+
} | {
|
|
703
|
+
type: "session.config";
|
|
704
|
+
sessionId: string;
|
|
705
|
+
config: ProviderConfigState;
|
|
706
|
+
} | {
|
|
707
|
+
type: "session.commands";
|
|
708
|
+
sessionId: string;
|
|
709
|
+
commands: ProviderCommand[];
|
|
710
|
+
} | {
|
|
711
|
+
type: "session.permission";
|
|
712
|
+
sessionId: string;
|
|
713
|
+
request: ProviderPermissionRequest;
|
|
714
|
+
} | {
|
|
715
|
+
type: "session.permission_resolved";
|
|
716
|
+
sessionId: string;
|
|
717
|
+
permissionId: string;
|
|
718
|
+
} | {
|
|
719
|
+
type: "session.notice";
|
|
720
|
+
sessionId: string;
|
|
721
|
+
notice: ProviderNotice;
|
|
722
|
+
} | {
|
|
723
|
+
type: "timeline.item";
|
|
724
|
+
sessionId: string;
|
|
725
|
+
item: ProviderTimelineItem;
|
|
726
|
+
timestamp?: string;
|
|
727
|
+
};
|
|
728
|
+
export declare function negotiateProviderCapabilities(offered: readonly string[], supported: readonly string[]): readonly ProviderCapability[];
|
|
729
|
+
export declare function isProviderCapability(capability: string): capability is ProviderCapability;
|
|
730
|
+
export declare function requiredProviderCapabilities(input: ProviderInput): readonly ProviderCapability[];
|
|
731
|
+
export declare function requireProviderCapabilities(capabilities: readonly string[], input: ProviderInput): void;
|
|
732
|
+
export declare const ProviderInputSchema: z.ZodType<ProviderInput>;
|
|
733
|
+
export declare const ProviderEventSchema: z.ZodType<ProviderEvent>;
|
|
734
|
+
export {};
|
|
735
|
+
//# sourceMappingURL=provider.d.ts.map
|