@bobannomi/app-host 0.0.0-stage → 0.1.0-next.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 +21 -0
- package/README.md +91 -3
- package/dist/index.d.ts +2041 -0
- package/dist/index.js +2554 -0
- package/dist/index.js.map +6 -0
- package/dist/node/service-host.d.ts +1669 -0
- package/dist/node/service-host.js +1473 -0
- package/dist/node/service-host.js.map +6 -0
- package/dist/protocol.d.ts +2392 -0
- package/dist/protocol.js +1830 -0
- package/dist/protocol.js.map +6 -0
- package/package.json +46 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2041 @@
|
|
|
1
|
+
/** Public values only. No filesystem paths, service addresses or credentials belong here. */
|
|
2
|
+
type JsonValue$1 = null | boolean | number | string | JsonValue$1[] | {
|
|
3
|
+
[key: string]: JsonValue$1;
|
|
4
|
+
};
|
|
5
|
+
declare const APP_HOST_ERROR_RETRY: {
|
|
6
|
+
readonly incompatible: "never";
|
|
7
|
+
readonly permission_denied: "never";
|
|
8
|
+
readonly origin_denied: "never";
|
|
9
|
+
readonly connection_revoked: "safe";
|
|
10
|
+
readonly storage_full: "never";
|
|
11
|
+
readonly invalid_request: "never";
|
|
12
|
+
readonly host_unavailable: "never";
|
|
13
|
+
readonly dependency_missing: "never";
|
|
14
|
+
readonly service_start_failed: "safe";
|
|
15
|
+
readonly service_unavailable: "safe";
|
|
16
|
+
readonly activity_conflict: "query";
|
|
17
|
+
readonly result_unknown: "query";
|
|
18
|
+
readonly resource_unavailable: "never";
|
|
19
|
+
readonly missing_source_evidence: "never";
|
|
20
|
+
readonly control_conflict: "query";
|
|
21
|
+
readonly configuration_changed: "query";
|
|
22
|
+
readonly root_changed: "never";
|
|
23
|
+
readonly resource_revision_conflict: "query";
|
|
24
|
+
readonly request_conflict: "never";
|
|
25
|
+
readonly cursor_stale: "query";
|
|
26
|
+
};
|
|
27
|
+
type AppHostErrorCode = keyof typeof APP_HOST_ERROR_RETRY;
|
|
28
|
+
type AppHostRetry = "safe" | "never" | "query";
|
|
29
|
+
interface AppHostErrorInfo {
|
|
30
|
+
code: AppHostErrorCode;
|
|
31
|
+
message: string;
|
|
32
|
+
retry?: AppHostRetry;
|
|
33
|
+
requestId?: string;
|
|
34
|
+
details?: JsonValue$1;
|
|
35
|
+
}
|
|
36
|
+
type ServiceWorkState = "not_accepted" | "accepted" | "running" | "completed" | "failed" | "interrupted" | "unknown";
|
|
37
|
+
declare class AppHostError extends Error {
|
|
38
|
+
readonly code: AppHostErrorCode;
|
|
39
|
+
readonly retry: AppHostRetry;
|
|
40
|
+
readonly requestId?: string;
|
|
41
|
+
readonly details?: JsonValue$1;
|
|
42
|
+
constructor(code: AppHostErrorCode, message?: string, options?: {
|
|
43
|
+
requestId?: string;
|
|
44
|
+
details?: JsonValue$1;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** How an agent explains findings and delivers results, independently of update timing. */
|
|
49
|
+
type ReplyStyle = "collaborative" | "direct" | "explanatory";
|
|
50
|
+
|
|
51
|
+
/** Application choices; none of these fields grants access to a resource. */
|
|
52
|
+
interface SessionConfigurationInput {
|
|
53
|
+
model?: {
|
|
54
|
+
provider: string;
|
|
55
|
+
model: string;
|
|
56
|
+
};
|
|
57
|
+
roleId?: string | null;
|
|
58
|
+
systemPrompt?: string | null;
|
|
59
|
+
executionInstructions?: {
|
|
60
|
+
revision: number;
|
|
61
|
+
content: string;
|
|
62
|
+
} | null;
|
|
63
|
+
effort?: string | null;
|
|
64
|
+
workMode?: "execute" | "plan";
|
|
65
|
+
maxTurns?: number;
|
|
66
|
+
sessionMode?: "direct" | "coordinator";
|
|
67
|
+
replyStyle?: ReplyStyle;
|
|
68
|
+
approvalMode?: "ask" | "auto_review" | "full_access";
|
|
69
|
+
tools?: {
|
|
70
|
+
allowed?: string[];
|
|
71
|
+
denied?: string[];
|
|
72
|
+
};
|
|
73
|
+
pluginsEnabled?: boolean;
|
|
74
|
+
pluginAutoSelectionEnabled?: boolean;
|
|
75
|
+
activePluginId?: string | null;
|
|
76
|
+
pluginIds?: string[];
|
|
77
|
+
serviceBindings?: string[];
|
|
78
|
+
memory?: {
|
|
79
|
+
enabled: boolean;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
interface ResolvedSessionConfiguration extends Required<Omit<SessionConfigurationInput, "tools">> {
|
|
83
|
+
tools: {
|
|
84
|
+
allowed: string[];
|
|
85
|
+
denied: string[];
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
interface SessionConfigurationSnapshot {
|
|
89
|
+
revision: number;
|
|
90
|
+
configuration: ResolvedSessionConfiguration;
|
|
91
|
+
configurationRoot: {
|
|
92
|
+
cwd: string;
|
|
93
|
+
settingsRoot: string;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
interface SessionCreationReceipt {
|
|
97
|
+
dataScopeId: string;
|
|
98
|
+
sessionId: string;
|
|
99
|
+
requestId: string;
|
|
100
|
+
action: "create-session";
|
|
101
|
+
state: "prepared" | "completed" | "unknown";
|
|
102
|
+
revision?: number;
|
|
103
|
+
configuration?: SessionConfigurationSnapshot;
|
|
104
|
+
}
|
|
105
|
+
interface SessionConfigurationBinding {
|
|
106
|
+
revision: number;
|
|
107
|
+
/** Explicit creation choices plus subsequent editor deltas; never accepted as public metadata. */
|
|
108
|
+
configurationInput?: SessionConfigurationInput;
|
|
109
|
+
/** Original non-role defaults for fields that role selection can replace. */
|
|
110
|
+
roleBaseConfiguration?: SessionConfigurationInput;
|
|
111
|
+
effectiveConfiguration: ResolvedSessionConfiguration;
|
|
112
|
+
resolvedResources: (ConfigurationResourceRef & {
|
|
113
|
+
revision: string;
|
|
114
|
+
})[];
|
|
115
|
+
defaultsRevision: string;
|
|
116
|
+
configurationRoot: {
|
|
117
|
+
cwd: string;
|
|
118
|
+
settingsRoot: string;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
interface ConfigurationResourceRef {
|
|
122
|
+
kind: "model" | "role" | "tool" | "plugin" | "service" | "skill" | "mcp";
|
|
123
|
+
id: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** A directory's actual filesystem identity, captured by trusted execution code. */
|
|
127
|
+
interface SessionExecutionRoot {
|
|
128
|
+
readonly canonicalRoot: string;
|
|
129
|
+
readonly rootIdentity: {
|
|
130
|
+
readonly dev: string;
|
|
131
|
+
readonly ino: string;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
/** Execution provenance describes a business relationship; it grants no access. */
|
|
135
|
+
type SessionExecutionSource = {
|
|
136
|
+
readonly kind: "interactive";
|
|
137
|
+
} | {
|
|
138
|
+
readonly kind: "channel";
|
|
139
|
+
readonly conversationId: string;
|
|
140
|
+
} | {
|
|
141
|
+
readonly kind: "automation";
|
|
142
|
+
readonly service: string;
|
|
143
|
+
readonly sourceId: string;
|
|
144
|
+
} | {
|
|
145
|
+
readonly kind: "child";
|
|
146
|
+
readonly sessionId: string;
|
|
147
|
+
readonly runId: string;
|
|
148
|
+
readonly childId: string;
|
|
149
|
+
readonly postRunPurpose?: "review" | "maintenance";
|
|
150
|
+
} | {
|
|
151
|
+
readonly kind: "fork";
|
|
152
|
+
readonly sessionId: string;
|
|
153
|
+
readonly requestId: string;
|
|
154
|
+
};
|
|
155
|
+
/** Frozen alongside configuration when work is accepted, then copied to Input/Run. */
|
|
156
|
+
interface SessionExecutionBinding {
|
|
157
|
+
readonly version: 1;
|
|
158
|
+
readonly cwd: SessionExecutionRoot;
|
|
159
|
+
readonly settingsRoot: SessionExecutionRoot;
|
|
160
|
+
readonly source: SessionExecutionSource;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* `closing` 表示 Session 正在停止当前工作并等待资源释放,此时不再接收新工作。
|
|
165
|
+
* 等待结束后,Session 会进入不可逆的 archived 状态。
|
|
166
|
+
*/
|
|
167
|
+
type SessionStatus = "idle" | "running" | "closing" | "archived" | "error";
|
|
168
|
+
type SessionStorage = "sqlite" | "memory";
|
|
169
|
+
interface SessionRecord {
|
|
170
|
+
id: string;
|
|
171
|
+
storage?: SessionStorage;
|
|
172
|
+
parentId?: string;
|
|
173
|
+
projectId?: string;
|
|
174
|
+
cwd: string;
|
|
175
|
+
cwdRelative?: string;
|
|
176
|
+
title: string;
|
|
177
|
+
model: string;
|
|
178
|
+
agent?: string;
|
|
179
|
+
status: SessionStatus;
|
|
180
|
+
metadata: Record<string, unknown> & {
|
|
181
|
+
configurationBinding?: SessionConfigurationBinding;
|
|
182
|
+
executionBinding?: SessionExecutionBinding;
|
|
183
|
+
};
|
|
184
|
+
createdAt: number;
|
|
185
|
+
updatedAt: number;
|
|
186
|
+
archivedAt?: number;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
type Check = (v: unknown) => boolean;
|
|
190
|
+
declare function validConnection(v: unknown): v is {
|
|
191
|
+
connectionId: string;
|
|
192
|
+
baseUrl: string;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
interface WorkspaceConversationCreation {
|
|
196
|
+
dataScopeId: string;
|
|
197
|
+
requestId: string;
|
|
198
|
+
sessionId: string;
|
|
199
|
+
workspaceId?: string;
|
|
200
|
+
outsideProject?: boolean;
|
|
201
|
+
taskLocation: "current" | "worktree";
|
|
202
|
+
configuration: SessionConfigurationInput;
|
|
203
|
+
preparationRevision?: string;
|
|
204
|
+
}
|
|
205
|
+
interface WorkspaceConversationResult extends SessionCreationReceipt {
|
|
206
|
+
session?: SessionRecord;
|
|
207
|
+
operationState?: "prepared" | "running" | "completed" | "failed" | "unknown";
|
|
208
|
+
indexBindingPending?: true;
|
|
209
|
+
workspaceId?: string;
|
|
210
|
+
executionRoot?: string;
|
|
211
|
+
privateSessionId?: string;
|
|
212
|
+
worktree?: {
|
|
213
|
+
id: string;
|
|
214
|
+
path: string;
|
|
215
|
+
branch: string;
|
|
216
|
+
sourceHead: string;
|
|
217
|
+
projectId: string;
|
|
218
|
+
projectPath: string;
|
|
219
|
+
configDir: string;
|
|
220
|
+
environment: "native" | "wsl";
|
|
221
|
+
distribution?: string;
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
type SessionControlOriginal = {
|
|
226
|
+
action: "compact";
|
|
227
|
+
body: {
|
|
228
|
+
requestId: string;
|
|
229
|
+
expectedRevision: number;
|
|
230
|
+
};
|
|
231
|
+
} | {
|
|
232
|
+
action: "fork";
|
|
233
|
+
body: {
|
|
234
|
+
requestId: string;
|
|
235
|
+
id: string;
|
|
236
|
+
copyHistory?: boolean;
|
|
237
|
+
beforeMessageId?: string;
|
|
238
|
+
afterMessageId?: string;
|
|
239
|
+
storage?: "sqlite";
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
interface ServiceStatus {
|
|
244
|
+
state: "absent" | "unauthorized" | "stopped" | "starting" | "recovering" | "ready" | "failed";
|
|
245
|
+
reason?: "dependency_missing" | "service_start_failed" | "service_unavailable" | "result_unknown" | "incompatible" | "revoked";
|
|
246
|
+
instanceId?: string;
|
|
247
|
+
apiVersion?: string;
|
|
248
|
+
}
|
|
249
|
+
interface ServiceWork {
|
|
250
|
+
requestId: string;
|
|
251
|
+
state: ServiceWorkState;
|
|
252
|
+
updatedAt: string;
|
|
253
|
+
result?: JsonValue$1;
|
|
254
|
+
error?: JsonValue$1;
|
|
255
|
+
}
|
|
256
|
+
interface ServiceConnectionDescriptor {
|
|
257
|
+
connectionId: string;
|
|
258
|
+
baseUrl: string;
|
|
259
|
+
apiVersion: string;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
declare const APP_HOST_FEATURES: readonly ["fetch-v2", "fetch-inline-body-v1", "fetch-target-close-v1", "service-v1", "extended-errors-v1", "workspace-v1", "session-resources-v1", "session-controls-v1", "conversation-creation-session-v1", "trusted-desktop-v1", "attachments-v1", "auxiliary-sessions-v1", "system-ui-v1", "lifecycle-v1", "commands-v1", "resource-catalog-v1", "file-content-v1", "window-chrome-v1", "embedded-browser-v1", "browser-binding-invalidation-v1", "browser-capture-preview-v1"];
|
|
263
|
+
type AppHostFeature = typeof APP_HOST_FEATURES[number];
|
|
264
|
+
type FetchDirection = "upload" | "download";
|
|
265
|
+
type PageFetchFrame = {
|
|
266
|
+
protocol: 2;
|
|
267
|
+
} & ({
|
|
268
|
+
type: "fetch-open";
|
|
269
|
+
id: string;
|
|
270
|
+
connectionId: string;
|
|
271
|
+
url: string;
|
|
272
|
+
method: string;
|
|
273
|
+
headers: [string, string][];
|
|
274
|
+
hasBody: boolean;
|
|
275
|
+
inlineBody?: string;
|
|
276
|
+
} | {
|
|
277
|
+
type: "fetch-headers";
|
|
278
|
+
id: string;
|
|
279
|
+
status: number;
|
|
280
|
+
statusText: string;
|
|
281
|
+
headers: [string, string][];
|
|
282
|
+
hasBody: boolean;
|
|
283
|
+
} | {
|
|
284
|
+
type: "fetch-credit";
|
|
285
|
+
id: string;
|
|
286
|
+
direction: FetchDirection;
|
|
287
|
+
sequence: number;
|
|
288
|
+
chunks: number;
|
|
289
|
+
bytes: number;
|
|
290
|
+
} | {
|
|
291
|
+
type: "fetch-chunk";
|
|
292
|
+
id: string;
|
|
293
|
+
direction: FetchDirection;
|
|
294
|
+
sequence: number;
|
|
295
|
+
bytes: Uint8Array;
|
|
296
|
+
} | {
|
|
297
|
+
type: "fetch-end";
|
|
298
|
+
id: string;
|
|
299
|
+
direction: FetchDirection;
|
|
300
|
+
sequence: number;
|
|
301
|
+
} | {
|
|
302
|
+
type: "fetch-consumed";
|
|
303
|
+
id: string;
|
|
304
|
+
direction: "download";
|
|
305
|
+
sequence: number;
|
|
306
|
+
} | {
|
|
307
|
+
type: "fetch-cancel";
|
|
308
|
+
id: string;
|
|
309
|
+
} | {
|
|
310
|
+
type: "fetch-error";
|
|
311
|
+
id: string;
|
|
312
|
+
error: AppHostErrorInfo;
|
|
313
|
+
} | {
|
|
314
|
+
type: "fetch-close";
|
|
315
|
+
connectionId: string;
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
interface WorkspaceRef {
|
|
319
|
+
id: string;
|
|
320
|
+
displayName: string;
|
|
321
|
+
}
|
|
322
|
+
type WorkspaceSelection = {
|
|
323
|
+
requestId: string;
|
|
324
|
+
status: "pending" | "cancelled" | "expired" | "failed" | "unknown";
|
|
325
|
+
} | {
|
|
326
|
+
requestId: string;
|
|
327
|
+
status: "completed";
|
|
328
|
+
workspace: WorkspaceRef;
|
|
329
|
+
} | {
|
|
330
|
+
requestId: string;
|
|
331
|
+
status: "completed";
|
|
332
|
+
unavailable: true;
|
|
333
|
+
};
|
|
334
|
+
interface WorkspaceFilePage {
|
|
335
|
+
entries: {
|
|
336
|
+
path: string;
|
|
337
|
+
name: string;
|
|
338
|
+
kind: "file" | "directory";
|
|
339
|
+
}[];
|
|
340
|
+
nextCursor?: string;
|
|
341
|
+
}
|
|
342
|
+
interface WorkspaceText {
|
|
343
|
+
path: string;
|
|
344
|
+
text: string;
|
|
345
|
+
revision: string;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
interface ConversationPreparation {
|
|
349
|
+
createConversation(input: WorkspaceConversationCreation): Promise<WorkspaceConversationResult>;
|
|
350
|
+
bindConversationIndex(input: {
|
|
351
|
+
original: WorkspaceConversationCreation;
|
|
352
|
+
dataScopeId: string;
|
|
353
|
+
}): Promise<WorkspaceConversationResult>;
|
|
354
|
+
getConversationCreationResult(input: WorkspaceConversationCreation): Promise<WorkspaceConversationResult | null>;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
interface AppCommandSnapshot {
|
|
358
|
+
commands: {
|
|
359
|
+
id: string;
|
|
360
|
+
label: string;
|
|
361
|
+
enabled?: boolean;
|
|
362
|
+
checked?: boolean;
|
|
363
|
+
shortcuts?: {
|
|
364
|
+
code: string;
|
|
365
|
+
modifiers: ("Primary" | "Control" | "Meta" | "Alt" | "Shift")[];
|
|
366
|
+
scope?: "application" | "global";
|
|
367
|
+
}[];
|
|
368
|
+
}[];
|
|
369
|
+
menus: {
|
|
370
|
+
id: string;
|
|
371
|
+
label: string;
|
|
372
|
+
items: ({
|
|
373
|
+
command: string;
|
|
374
|
+
} | {
|
|
375
|
+
separator: true;
|
|
376
|
+
})[];
|
|
377
|
+
}[];
|
|
378
|
+
toolbar?: Partial<Record<"back" | "forward" | "sidebar", string>>;
|
|
379
|
+
}
|
|
380
|
+
interface AppCommandRegistration {
|
|
381
|
+
readonly shortcutConflicts?: readonly string[];
|
|
382
|
+
update(snapshot: AppCommandSnapshot): Promise<void>;
|
|
383
|
+
dispose(): Promise<void>;
|
|
384
|
+
}
|
|
385
|
+
interface AppHostCommands {
|
|
386
|
+
register(snapshot: AppCommandSnapshot, invoke: (id: string) => void | Promise<void>): Promise<AppCommandRegistration>;
|
|
387
|
+
}
|
|
388
|
+
interface CommandReceipt {
|
|
389
|
+
registrationId: string;
|
|
390
|
+
revision: number;
|
|
391
|
+
shortcutConflicts?: string[];
|
|
392
|
+
}
|
|
393
|
+
type CommandInvocation = {
|
|
394
|
+
type: "command-invoked";
|
|
395
|
+
registrationId: string;
|
|
396
|
+
revision: number;
|
|
397
|
+
commandId: string;
|
|
398
|
+
};
|
|
399
|
+
interface CommandsMethodMap {
|
|
400
|
+
"commands.register": {
|
|
401
|
+
params: CommandReceipt & {
|
|
402
|
+
snapshot: AppCommandSnapshot;
|
|
403
|
+
};
|
|
404
|
+
result: CommandReceipt;
|
|
405
|
+
};
|
|
406
|
+
"commands.update": {
|
|
407
|
+
params: CommandReceipt & {
|
|
408
|
+
snapshot: AppCommandSnapshot;
|
|
409
|
+
};
|
|
410
|
+
result: CommandReceipt;
|
|
411
|
+
};
|
|
412
|
+
"commands.dispose": {
|
|
413
|
+
params: CommandReceipt;
|
|
414
|
+
result: CommandReceipt;
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
type CommandsMethod = keyof CommandsMethodMap;
|
|
418
|
+
declare const COMMANDS_METHODS: readonly ["commands.register", "commands.update", "commands.dispose"];
|
|
419
|
+
declare const isCommandsMethod: (method: string) => method is CommandsMethod;
|
|
420
|
+
declare function validAppCommandSnapshot(value: unknown): value is AppCommandSnapshot;
|
|
421
|
+
declare const validCommandReceipt: Check;
|
|
422
|
+
declare const validCommandInvocation: (v: unknown) => v is CommandInvocation;
|
|
423
|
+
declare function validCommandsInput(method: CommandsMethod, v: unknown): boolean;
|
|
424
|
+
declare function createAppCommandsApi(rpc: {
|
|
425
|
+
requireFeature(): void;
|
|
426
|
+
request<M extends CommandsMethod>(method: M, params: CommandsMethodMap[M]["params"]): Promise<CommandsMethodMap[M]["result"]>;
|
|
427
|
+
onInvoke(listener: (event: CommandInvocation) => void): () => void;
|
|
428
|
+
onClose(listener: () => void): () => void;
|
|
429
|
+
}): AppHostCommands;
|
|
430
|
+
|
|
431
|
+
type ClientConnection = AgentConnection;
|
|
432
|
+
interface ConnectionStreams {
|
|
433
|
+
fetchFor(id: string, base: string): typeof fetch;
|
|
434
|
+
close(id: string): void;
|
|
435
|
+
isClosed?(id: string): boolean;
|
|
436
|
+
}
|
|
437
|
+
interface AgentConnection {
|
|
438
|
+
/** Optional location hint. Execution always uses the Session/Run's persisted root. */
|
|
439
|
+
readonly cwd?: string;
|
|
440
|
+
readonly defaultTaskLocation?: "current" | "worktree";
|
|
441
|
+
readonly clientOptions: {
|
|
442
|
+
readonly baseUrl: string;
|
|
443
|
+
readonly fetch: typeof fetch;
|
|
444
|
+
};
|
|
445
|
+
/** True once this target or its document transport has closed. */
|
|
446
|
+
isClosed?(): boolean;
|
|
447
|
+
close(): void;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/** Standalone SDK mirror of the services desktop contracts. */
|
|
451
|
+
interface DesktopRoot {
|
|
452
|
+
path: string;
|
|
453
|
+
identity: {
|
|
454
|
+
dev: string;
|
|
455
|
+
ino: string;
|
|
456
|
+
};
|
|
457
|
+
workspaceId?: string;
|
|
458
|
+
}
|
|
459
|
+
interface DesktopTarget {
|
|
460
|
+
id: string;
|
|
461
|
+
dataScopeId: string;
|
|
462
|
+
draftId: string;
|
|
463
|
+
draftRevision: number;
|
|
464
|
+
root?: DesktopRoot;
|
|
465
|
+
sessionId?: string;
|
|
466
|
+
}
|
|
467
|
+
type WorkspaceOperationKind = "files.writeText" | "git.switchBranch" | "git.createBranch" | "git.createTaskWorktree";
|
|
468
|
+
interface WorkspaceOperation {
|
|
469
|
+
requestId: string;
|
|
470
|
+
kind: WorkspaceOperationKind;
|
|
471
|
+
state: "prepared" | "running" | "completed" | "failed" | "unknown";
|
|
472
|
+
result?: JsonValue$1;
|
|
473
|
+
error?: {
|
|
474
|
+
code: string;
|
|
475
|
+
};
|
|
476
|
+
createdAt: number;
|
|
477
|
+
updatedAt: number;
|
|
478
|
+
}
|
|
479
|
+
interface WorkspaceOperationOriginal {
|
|
480
|
+
kind: WorkspaceOperationKind;
|
|
481
|
+
body: JsonValue$1;
|
|
482
|
+
}
|
|
483
|
+
interface BindDesktopTarget {
|
|
484
|
+
directory?: string;
|
|
485
|
+
workspaceId?: string;
|
|
486
|
+
connection?: AgentConnection;
|
|
487
|
+
sessionId?: string;
|
|
488
|
+
draftId: string;
|
|
489
|
+
draftRevision: number;
|
|
490
|
+
}
|
|
491
|
+
interface DesktopText {
|
|
492
|
+
path: string;
|
|
493
|
+
text: string;
|
|
494
|
+
sha256: string;
|
|
495
|
+
byteLength: number;
|
|
496
|
+
encoding: "utf-8";
|
|
497
|
+
truncated: boolean;
|
|
498
|
+
}
|
|
499
|
+
interface DesktopSearch {
|
|
500
|
+
matches: {
|
|
501
|
+
path: string;
|
|
502
|
+
line: number;
|
|
503
|
+
text: string;
|
|
504
|
+
}[];
|
|
505
|
+
truncated: boolean;
|
|
506
|
+
}
|
|
507
|
+
interface DesktopOpener {
|
|
508
|
+
id: string;
|
|
509
|
+
label: string;
|
|
510
|
+
kind: "editor" | "folder" | "terminal";
|
|
511
|
+
iconDataUrl: string | null;
|
|
512
|
+
readonly isDefault?: boolean;
|
|
513
|
+
}
|
|
514
|
+
interface DesktopGitChange {
|
|
515
|
+
path: string;
|
|
516
|
+
oldPath?: string;
|
|
517
|
+
status: "added" | "modified" | "deleted" | "renamed" | "copied" | "untracked";
|
|
518
|
+
additions: number | null;
|
|
519
|
+
deletions: number | null;
|
|
520
|
+
binary: boolean;
|
|
521
|
+
}
|
|
522
|
+
interface DesktopTerminal {
|
|
523
|
+
resourceId: string;
|
|
524
|
+
terminalId: string;
|
|
525
|
+
cwd: string;
|
|
526
|
+
status: "running" | "exited";
|
|
527
|
+
}
|
|
528
|
+
type DesktopTerminalRequestOriginal = {
|
|
529
|
+
kind: "create";
|
|
530
|
+
cols: number;
|
|
531
|
+
rows: number;
|
|
532
|
+
name?: string;
|
|
533
|
+
} | {
|
|
534
|
+
kind: "restart";
|
|
535
|
+
terminalId: string;
|
|
536
|
+
};
|
|
537
|
+
interface DesktopTerminalRequestReceipt {
|
|
538
|
+
requestId: string;
|
|
539
|
+
state: "pending" | "completed" | "failed" | "unknown" | "closed";
|
|
540
|
+
terminal?: DesktopTerminal;
|
|
541
|
+
error?: {
|
|
542
|
+
code: string;
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
interface DesktopTerminalInfo {
|
|
546
|
+
id: string;
|
|
547
|
+
name: string;
|
|
548
|
+
scope: {
|
|
549
|
+
kind: "project";
|
|
550
|
+
projectId: string;
|
|
551
|
+
} | {
|
|
552
|
+
kind: "session";
|
|
553
|
+
sessionId: string;
|
|
554
|
+
};
|
|
555
|
+
projectId?: string;
|
|
556
|
+
runtime: "local" | "environment";
|
|
557
|
+
environmentKind?: "native" | "wsl";
|
|
558
|
+
distribution?: string;
|
|
559
|
+
source: "user" | "agent";
|
|
560
|
+
sessionId?: string;
|
|
561
|
+
status: "running" | "stopping" | "completed" | "killed" | "failed";
|
|
562
|
+
cwd: string;
|
|
563
|
+
shell: string;
|
|
564
|
+
command?: string;
|
|
565
|
+
cols: number;
|
|
566
|
+
rows: number;
|
|
567
|
+
createdAt: string;
|
|
568
|
+
exitedAt?: string;
|
|
569
|
+
exitCode?: number | null;
|
|
570
|
+
}
|
|
571
|
+
interface DesktopTerminalSnapshot {
|
|
572
|
+
terminalId: string;
|
|
573
|
+
data: string;
|
|
574
|
+
sequence: number;
|
|
575
|
+
truncated: boolean;
|
|
576
|
+
}
|
|
577
|
+
interface DesktopWindow {
|
|
578
|
+
requestId: string;
|
|
579
|
+
targetId: string;
|
|
580
|
+
state: "opening" | "open" | "closing" | "closed";
|
|
581
|
+
windowId?: number;
|
|
582
|
+
}
|
|
583
|
+
type AnnotationMode = "off" | "pick" | "review";
|
|
584
|
+
interface AnnotationRect {
|
|
585
|
+
x: number;
|
|
586
|
+
y: number;
|
|
587
|
+
width: number;
|
|
588
|
+
height: number;
|
|
589
|
+
}
|
|
590
|
+
interface AnnotationTarget {
|
|
591
|
+
target: string;
|
|
592
|
+
selector: string;
|
|
593
|
+
locatorKind: "unique-id" | "semantic" | "path";
|
|
594
|
+
tagName: string;
|
|
595
|
+
role: string;
|
|
596
|
+
name: string;
|
|
597
|
+
}
|
|
598
|
+
interface BrowserAnnotationRecord extends AnnotationTarget {
|
|
599
|
+
id: string;
|
|
600
|
+
pageUrl: string;
|
|
601
|
+
comment: string;
|
|
602
|
+
}
|
|
603
|
+
interface BrowserAnnotationSnapshot {
|
|
604
|
+
pageUrl: string;
|
|
605
|
+
pageRevision: number;
|
|
606
|
+
ready: boolean;
|
|
607
|
+
mode: AnnotationMode;
|
|
608
|
+
interactionVersion: number;
|
|
609
|
+
eventSequence: number;
|
|
610
|
+
selection: {
|
|
611
|
+
selectionId: string;
|
|
612
|
+
target: AnnotationTarget;
|
|
613
|
+
rect: AnnotationRect;
|
|
614
|
+
} | null;
|
|
615
|
+
focusedAnnotationId: string | null;
|
|
616
|
+
viewport: {
|
|
617
|
+
width: number;
|
|
618
|
+
height: number;
|
|
619
|
+
} | null;
|
|
620
|
+
annotations: {
|
|
621
|
+
record: BrowserAnnotationRecord;
|
|
622
|
+
status: "visible" | "offscreen" | "missing";
|
|
623
|
+
rect: AnnotationRect | null;
|
|
624
|
+
}[];
|
|
625
|
+
}
|
|
626
|
+
interface BrowserPage {
|
|
627
|
+
targetId: string;
|
|
628
|
+
tabId: string;
|
|
629
|
+
pageRevision: number;
|
|
630
|
+
}
|
|
631
|
+
declare const BROWSER_CAPTURE_PREVIEW_MAX_BYTES: number;
|
|
632
|
+
interface PluginAppSource$1 {
|
|
633
|
+
sessionId: string;
|
|
634
|
+
appId: string;
|
|
635
|
+
}
|
|
636
|
+
interface PluginAppRecord {
|
|
637
|
+
id: string;
|
|
638
|
+
sessionId: string;
|
|
639
|
+
pluginId: string;
|
|
640
|
+
pluginVersion: string;
|
|
641
|
+
pluginDigest: string;
|
|
642
|
+
definitionDigest: string;
|
|
643
|
+
backendId: string;
|
|
644
|
+
backendKind: "native-tools" | "mcp-server";
|
|
645
|
+
resourceUri: string;
|
|
646
|
+
origin: {
|
|
647
|
+
kind: "surface";
|
|
648
|
+
surfaceId: string;
|
|
649
|
+
} | {
|
|
650
|
+
kind: "tool-result";
|
|
651
|
+
sourcePartId: string;
|
|
652
|
+
};
|
|
653
|
+
logicalKey: string;
|
|
654
|
+
status: "open" | "closed" | "revoked";
|
|
655
|
+
controlRevision: number;
|
|
656
|
+
activeActionRunId?: string;
|
|
657
|
+
lastActionRunId?: string;
|
|
658
|
+
createdAt: number;
|
|
659
|
+
updatedAt: number;
|
|
660
|
+
}
|
|
661
|
+
interface PluginAppToolPolicy {
|
|
662
|
+
confirmation: "required" | "granted";
|
|
663
|
+
maxArgumentsBytes: number;
|
|
664
|
+
authorization?: "plugin-data-write";
|
|
665
|
+
}
|
|
666
|
+
interface PluginAppHostState {
|
|
667
|
+
source: PluginAppSource$1;
|
|
668
|
+
app: PluginAppRecord;
|
|
669
|
+
availability: {
|
|
670
|
+
canReadResource: boolean;
|
|
671
|
+
canInvokeTools: boolean;
|
|
672
|
+
canMessage: boolean;
|
|
673
|
+
reason?: string;
|
|
674
|
+
};
|
|
675
|
+
tools?: {
|
|
676
|
+
name: string;
|
|
677
|
+
description: string;
|
|
678
|
+
inputSchema: Record<string, JsonValue$1>;
|
|
679
|
+
policy?: PluginAppToolPolicy;
|
|
680
|
+
}[];
|
|
681
|
+
online: boolean;
|
|
682
|
+
}
|
|
683
|
+
interface PluginAppMount {
|
|
684
|
+
mountId: string;
|
|
685
|
+
url: string;
|
|
686
|
+
state: PluginAppHostState;
|
|
687
|
+
}
|
|
688
|
+
interface PluginAppPreparedTool {
|
|
689
|
+
requestId: string;
|
|
690
|
+
toolName: string;
|
|
691
|
+
args: Record<string, JsonValue$1>;
|
|
692
|
+
expectedRevision: number;
|
|
693
|
+
policy?: PluginAppToolPolicy;
|
|
694
|
+
}
|
|
695
|
+
interface PluginAppPreparedMessage {
|
|
696
|
+
pluginId: string;
|
|
697
|
+
source: PluginAppSource$1;
|
|
698
|
+
requestId: string;
|
|
699
|
+
text: string;
|
|
700
|
+
data: JsonValue$1;
|
|
701
|
+
expectedRevision: number;
|
|
702
|
+
}
|
|
703
|
+
interface PluginAppModelContext {
|
|
704
|
+
id: string;
|
|
705
|
+
source: PluginAppSource$1;
|
|
706
|
+
pluginId: string;
|
|
707
|
+
text: string;
|
|
708
|
+
data: JsonValue$1;
|
|
709
|
+
}
|
|
710
|
+
interface PluginAppComposerContext {
|
|
711
|
+
source: PluginAppSource$1;
|
|
712
|
+
lease: {
|
|
713
|
+
token: string;
|
|
714
|
+
backendGeneration: string;
|
|
715
|
+
};
|
|
716
|
+
requestId: string;
|
|
717
|
+
expectedRevision: number;
|
|
718
|
+
text: string;
|
|
719
|
+
data: JsonValue$1;
|
|
720
|
+
}
|
|
721
|
+
interface PluginAppActionReceipt {
|
|
722
|
+
source: PluginAppSource$1;
|
|
723
|
+
requestId: string;
|
|
724
|
+
runId: string;
|
|
725
|
+
expectedRevision: number;
|
|
726
|
+
acceptedRevision: number;
|
|
727
|
+
status: string;
|
|
728
|
+
executionState: "not_started" | "completed" | "unknown";
|
|
729
|
+
}
|
|
730
|
+
interface PluginAppActionResponse {
|
|
731
|
+
receipt: PluginAppActionReceipt;
|
|
732
|
+
result?: {
|
|
733
|
+
content: JsonValue$1[];
|
|
734
|
+
structuredContent?: Record<string, JsonValue$1>;
|
|
735
|
+
isError?: boolean;
|
|
736
|
+
};
|
|
737
|
+
dataError?: string;
|
|
738
|
+
}
|
|
739
|
+
interface PluginAppSubmissionReceipt {
|
|
740
|
+
source: PluginAppSource$1;
|
|
741
|
+
requestId: string;
|
|
742
|
+
inputId: string;
|
|
743
|
+
runId: string;
|
|
744
|
+
expectedRevision: number;
|
|
745
|
+
status: string;
|
|
746
|
+
}
|
|
747
|
+
interface PluginAppCatalog {
|
|
748
|
+
backends: {
|
|
749
|
+
pluginId: string;
|
|
750
|
+
pluginVersion: string;
|
|
751
|
+
pluginDigest: string;
|
|
752
|
+
definitionDigest: string;
|
|
753
|
+
backendId: string;
|
|
754
|
+
backendKind: "native-tools" | "mcp-server";
|
|
755
|
+
surfaces: {
|
|
756
|
+
id: string;
|
|
757
|
+
title: string;
|
|
758
|
+
backend: string;
|
|
759
|
+
resourceUri: string;
|
|
760
|
+
availability: "session";
|
|
761
|
+
}[];
|
|
762
|
+
}[];
|
|
763
|
+
}
|
|
764
|
+
type Entry<P, R> = {
|
|
765
|
+
params: P;
|
|
766
|
+
result: R;
|
|
767
|
+
};
|
|
768
|
+
type Target = {
|
|
769
|
+
targetId: string;
|
|
770
|
+
};
|
|
771
|
+
type Mount = Target & {
|
|
772
|
+
mountId: string;
|
|
773
|
+
};
|
|
774
|
+
type Action = Mount & {
|
|
775
|
+
requestId: string;
|
|
776
|
+
expectedRevision: number;
|
|
777
|
+
source: PluginAppSource$1;
|
|
778
|
+
};
|
|
779
|
+
interface DesktopMethodMap {
|
|
780
|
+
"desktop.bindTarget": Entry<Omit<BindDesktopTarget, "connection"> & {
|
|
781
|
+
connectionId?: string;
|
|
782
|
+
}, DesktopTarget>;
|
|
783
|
+
"desktop.releaseTarget": Entry<Target, void>;
|
|
784
|
+
"desktop.files.listFiles": Entry<Target & {
|
|
785
|
+
directory?: string;
|
|
786
|
+
recursive?: boolean;
|
|
787
|
+
}, {
|
|
788
|
+
entries: {
|
|
789
|
+
path: string;
|
|
790
|
+
name: string;
|
|
791
|
+
kind: "file" | "directory";
|
|
792
|
+
}[];
|
|
793
|
+
}>;
|
|
794
|
+
"desktop.files.search": Entry<Target & {
|
|
795
|
+
query: string;
|
|
796
|
+
directory?: string;
|
|
797
|
+
limit?: number;
|
|
798
|
+
}, DesktopSearch>;
|
|
799
|
+
"desktop.files.openRead": Entry<Target & {
|
|
800
|
+
path: string;
|
|
801
|
+
}, {
|
|
802
|
+
connectionId: string;
|
|
803
|
+
baseUrl: string;
|
|
804
|
+
}>;
|
|
805
|
+
"desktop.files.readText": Entry<Target & {
|
|
806
|
+
path: string;
|
|
807
|
+
}, DesktopText>;
|
|
808
|
+
"desktop.files.writeText": Entry<Target & {
|
|
809
|
+
requestId: string;
|
|
810
|
+
path: string;
|
|
811
|
+
expectedSha256: string;
|
|
812
|
+
text: string;
|
|
813
|
+
}, WorkspaceOperation>;
|
|
814
|
+
"desktop.files.getOperation": Entry<Target & {
|
|
815
|
+
requestId: string;
|
|
816
|
+
original: WorkspaceOperationOriginal;
|
|
817
|
+
}, WorkspaceOperation | null>;
|
|
818
|
+
"desktop.files.revealPath": Entry<Target & {
|
|
819
|
+
path: string;
|
|
820
|
+
}, void>;
|
|
821
|
+
"desktop.files.listOpeners": Entry<Target, DesktopOpener[]>;
|
|
822
|
+
"desktop.files.openWith": Entry<Target & {
|
|
823
|
+
path: string;
|
|
824
|
+
openerId: string;
|
|
825
|
+
}, void>;
|
|
826
|
+
"desktop.clipboard.readText": Entry<Target, string>;
|
|
827
|
+
"desktop.clipboard.writeText": Entry<Target & {
|
|
828
|
+
text: string;
|
|
829
|
+
}, void>;
|
|
830
|
+
"desktop.clipboard.showTextMenu": Entry<Target & {
|
|
831
|
+
editable: boolean;
|
|
832
|
+
hasSelection: boolean;
|
|
833
|
+
}, "copy" | "select-all" | null>;
|
|
834
|
+
"desktop.windows.openExternal": Entry<Target & {
|
|
835
|
+
url: string;
|
|
836
|
+
}, void>;
|
|
837
|
+
"desktop.windows.getZoom": Entry<Target, {
|
|
838
|
+
factor: number;
|
|
839
|
+
}>;
|
|
840
|
+
"desktop.windows.setZoom": Entry<Target & {
|
|
841
|
+
factor: number;
|
|
842
|
+
}, {
|
|
843
|
+
factor: number;
|
|
844
|
+
}>;
|
|
845
|
+
"desktop.windows.edit": Entry<Target & {
|
|
846
|
+
action: "undo" | "redo" | "cut" | "copy" | "paste" | "selectAll";
|
|
847
|
+
}, void>;
|
|
848
|
+
"desktop.git.status": Entry<Target, {
|
|
849
|
+
root: string;
|
|
850
|
+
commonDir: string;
|
|
851
|
+
head: string;
|
|
852
|
+
branch: string;
|
|
853
|
+
changes: string[];
|
|
854
|
+
}>;
|
|
855
|
+
"desktop.git.listBranches": Entry<Target, {
|
|
856
|
+
branches: string[];
|
|
857
|
+
}>;
|
|
858
|
+
"desktop.git.changes": Entry<Target & {
|
|
859
|
+
range?: "uncommitted" | "working" | "staged";
|
|
860
|
+
ignoreWhitespace?: boolean;
|
|
861
|
+
}, {
|
|
862
|
+
files: DesktopGitChange[];
|
|
863
|
+
totalAdditions: number;
|
|
864
|
+
totalDeletions: number;
|
|
865
|
+
}>;
|
|
866
|
+
"desktop.git.diff": Entry<Target & {
|
|
867
|
+
path?: string;
|
|
868
|
+
base?: string;
|
|
869
|
+
head?: string;
|
|
870
|
+
range?: "uncommitted" | "working" | "staged";
|
|
871
|
+
ignoreWhitespace?: boolean;
|
|
872
|
+
}, {
|
|
873
|
+
text: string;
|
|
874
|
+
truncated: boolean;
|
|
875
|
+
}>;
|
|
876
|
+
"desktop.git.switchBranch": Entry<Target & {
|
|
877
|
+
requestId: string;
|
|
878
|
+
expectedHead: string;
|
|
879
|
+
branch: string;
|
|
880
|
+
}, WorkspaceOperation>;
|
|
881
|
+
"desktop.git.createBranch": Entry<Target & {
|
|
882
|
+
requestId: string;
|
|
883
|
+
expectedHead: string;
|
|
884
|
+
branch: string;
|
|
885
|
+
}, WorkspaceOperation>;
|
|
886
|
+
"desktop.git.createTaskWorktree": Entry<Target & {
|
|
887
|
+
requestId: string;
|
|
888
|
+
expectedHead: string;
|
|
889
|
+
branch: string;
|
|
890
|
+
}, WorkspaceOperation>;
|
|
891
|
+
"desktop.terminals.create": Entry<Target & {
|
|
892
|
+
requestId: string;
|
|
893
|
+
cols: number;
|
|
894
|
+
rows: number;
|
|
895
|
+
name?: string;
|
|
896
|
+
}, DesktopTerminal>;
|
|
897
|
+
"desktop.terminals.list": Entry<Target, DesktopTerminalInfo[]>;
|
|
898
|
+
"desktop.terminals.restart": Entry<Target & {
|
|
899
|
+
terminalId: string;
|
|
900
|
+
requestId: string;
|
|
901
|
+
}, DesktopTerminal>;
|
|
902
|
+
"desktop.terminals.getRequest": Entry<Target & {
|
|
903
|
+
requestId: string;
|
|
904
|
+
original: DesktopTerminalRequestOriginal;
|
|
905
|
+
}, DesktopTerminalRequestReceipt>;
|
|
906
|
+
"desktop.terminals.snapshot": Entry<Target & {
|
|
907
|
+
terminalId: string;
|
|
908
|
+
after?: number;
|
|
909
|
+
maxChars?: number;
|
|
910
|
+
}, DesktopTerminalSnapshot>;
|
|
911
|
+
"desktop.terminals.subscribe": Entry<Target & {
|
|
912
|
+
terminalId: string;
|
|
913
|
+
}, void>;
|
|
914
|
+
"desktop.terminals.write": Entry<Target & {
|
|
915
|
+
terminalId: string;
|
|
916
|
+
data: string;
|
|
917
|
+
}, void>;
|
|
918
|
+
"desktop.terminals.resize": Entry<Target & {
|
|
919
|
+
terminalId: string;
|
|
920
|
+
cols: number;
|
|
921
|
+
rows: number;
|
|
922
|
+
}, void>;
|
|
923
|
+
"desktop.terminals.close": Entry<Target & {
|
|
924
|
+
terminalId?: string;
|
|
925
|
+
requestId?: string;
|
|
926
|
+
}, void>;
|
|
927
|
+
"desktop.windows.open": Entry<Target & {
|
|
928
|
+
requestId: string;
|
|
929
|
+
mode: "application" | "content";
|
|
930
|
+
url: string;
|
|
931
|
+
}, DesktopWindow>;
|
|
932
|
+
"desktop.windows.adopt": Entry<Target & {
|
|
933
|
+
requestId: string;
|
|
934
|
+
windowId: number;
|
|
935
|
+
}, DesktopWindow>;
|
|
936
|
+
"desktop.windows.get": Entry<Target & {
|
|
937
|
+
requestId: string;
|
|
938
|
+
}, DesktopWindow | null>;
|
|
939
|
+
"desktop.windows.close": Entry<Target & {
|
|
940
|
+
requestId: string;
|
|
941
|
+
}, DesktopWindow>;
|
|
942
|
+
"desktop.windows.setAlwaysOnTop": Entry<Target & {
|
|
943
|
+
requestId?: string;
|
|
944
|
+
alwaysOnTop: boolean;
|
|
945
|
+
}, {
|
|
946
|
+
alwaysOnTop: boolean;
|
|
947
|
+
}>;
|
|
948
|
+
"desktop.windows.focus": Entry<Target & {
|
|
949
|
+
requestId?: string;
|
|
950
|
+
}, {
|
|
951
|
+
focused: boolean;
|
|
952
|
+
visible: boolean;
|
|
953
|
+
minimized: boolean;
|
|
954
|
+
}>;
|
|
955
|
+
"desktop.browser.register": Entry<Target & {
|
|
956
|
+
tabId: string;
|
|
957
|
+
guestId: number;
|
|
958
|
+
}, BrowserAnnotationSnapshot>;
|
|
959
|
+
"desktop.browser.openLocalFile": Entry<Target & {
|
|
960
|
+
path: string;
|
|
961
|
+
}, {
|
|
962
|
+
url: string;
|
|
963
|
+
}>;
|
|
964
|
+
"desktop.browser.unregister": Entry<Target & {
|
|
965
|
+
tabId: string;
|
|
966
|
+
}, void>;
|
|
967
|
+
"desktop.browser.setActive": Entry<Target & {
|
|
968
|
+
tabId: string;
|
|
969
|
+
}, void>;
|
|
970
|
+
"desktop.browser.readAnnotations": Entry<BrowserPage, BrowserAnnotationSnapshot>;
|
|
971
|
+
"desktop.browser.setAnnotationMode": Entry<BrowserPage & {
|
|
972
|
+
mode: AnnotationMode;
|
|
973
|
+
}, BrowserAnnotationSnapshot>;
|
|
974
|
+
"desktop.browser.addAnnotation": Entry<BrowserPage & {
|
|
975
|
+
selectionId: string;
|
|
976
|
+
comment: string;
|
|
977
|
+
}, BrowserAnnotationSnapshot>;
|
|
978
|
+
"desktop.browser.focusAnnotation": Entry<BrowserPage & {
|
|
979
|
+
annotationId: string;
|
|
980
|
+
}, BrowserAnnotationSnapshot>;
|
|
981
|
+
"desktop.browser.removeAnnotation": Entry<BrowserPage & {
|
|
982
|
+
annotationId: string;
|
|
983
|
+
}, BrowserAnnotationSnapshot>;
|
|
984
|
+
"desktop.browser.capture": Entry<BrowserPage, {
|
|
985
|
+
assetId: string;
|
|
986
|
+
sha256: string;
|
|
987
|
+
mediaType: string;
|
|
988
|
+
byteLength: number;
|
|
989
|
+
width: number;
|
|
990
|
+
height: number;
|
|
991
|
+
}>;
|
|
992
|
+
"desktop.browser.capturePreview": Entry<BrowserPage, {
|
|
993
|
+
bytes: Uint8Array<ArrayBuffer>;
|
|
994
|
+
width: number;
|
|
995
|
+
height: number;
|
|
996
|
+
}>;
|
|
997
|
+
"desktop.pluginApps.catalog": Entry<Target, PluginAppCatalog>;
|
|
998
|
+
"desktop.pluginApps.composerContext": Entry<Target & {
|
|
999
|
+
contextIds: string[];
|
|
1000
|
+
}, PluginAppComposerContext[]>;
|
|
1001
|
+
"desktop.pluginApps.open": Entry<Target & {
|
|
1002
|
+
requestId: string;
|
|
1003
|
+
pluginId: string;
|
|
1004
|
+
surfaceId: string;
|
|
1005
|
+
expectedRevision?: number;
|
|
1006
|
+
}, PluginAppMount>;
|
|
1007
|
+
"desktop.pluginApps.openToolResult": Entry<Target & {
|
|
1008
|
+
sourcePartId: string;
|
|
1009
|
+
}, {
|
|
1010
|
+
mounted: PluginAppMount;
|
|
1011
|
+
initial: {
|
|
1012
|
+
sourcePartId: string;
|
|
1013
|
+
arguments: Record<string, JsonValue$1>;
|
|
1014
|
+
result: JsonValue$1;
|
|
1015
|
+
dataError?: string;
|
|
1016
|
+
};
|
|
1017
|
+
}>;
|
|
1018
|
+
"desktop.pluginApps.mount": Entry<Target & {
|
|
1019
|
+
source: PluginAppSource$1;
|
|
1020
|
+
}, PluginAppMount>;
|
|
1021
|
+
"desktop.pluginApps.refresh": Entry<Mount, PluginAppHostState>;
|
|
1022
|
+
"desktop.pluginApps.rejectMenuOpen": Entry<Mount & {
|
|
1023
|
+
requestId: string;
|
|
1024
|
+
menuOpeningRevision: number;
|
|
1025
|
+
}, {
|
|
1026
|
+
closed: boolean;
|
|
1027
|
+
}>;
|
|
1028
|
+
"desktop.pluginApps.prepareTool": Entry<Mount & {
|
|
1029
|
+
source: PluginAppSource$1;
|
|
1030
|
+
requestId: string;
|
|
1031
|
+
expectedRevision: number;
|
|
1032
|
+
name: string;
|
|
1033
|
+
arguments: Record<string, JsonValue$1>;
|
|
1034
|
+
}, PluginAppPreparedTool>;
|
|
1035
|
+
"desktop.pluginApps.invokeTool": Entry<Action, PluginAppActionResponse | {
|
|
1036
|
+
code: "plugin_app_busy";
|
|
1037
|
+
notAccepted: true;
|
|
1038
|
+
requestId: string;
|
|
1039
|
+
}>;
|
|
1040
|
+
"desktop.pluginApps.getAction": Entry<Action | Target & {
|
|
1041
|
+
source: PluginAppSource$1;
|
|
1042
|
+
requestId: string;
|
|
1043
|
+
expectedRevision: number;
|
|
1044
|
+
original: {
|
|
1045
|
+
toolName: string;
|
|
1046
|
+
args: Record<string, JsonValue$1>;
|
|
1047
|
+
};
|
|
1048
|
+
}, PluginAppActionResponse>;
|
|
1049
|
+
"desktop.pluginApps.cancelTool": Entry<Action, void>;
|
|
1050
|
+
"desktop.pluginApps.readResource": Entry<Mount & {
|
|
1051
|
+
source: PluginAppSource$1;
|
|
1052
|
+
uri: string;
|
|
1053
|
+
}, {
|
|
1054
|
+
contents: JsonValue$1[];
|
|
1055
|
+
}>;
|
|
1056
|
+
"desktop.pluginApps.listResources": Entry<Mount & {
|
|
1057
|
+
source: PluginAppSource$1;
|
|
1058
|
+
cursor?: string;
|
|
1059
|
+
}, {
|
|
1060
|
+
resources: JsonValue$1[];
|
|
1061
|
+
nextCursor?: string;
|
|
1062
|
+
}>;
|
|
1063
|
+
"desktop.pluginApps.listResourceTemplates": Entry<Mount & {
|
|
1064
|
+
source: PluginAppSource$1;
|
|
1065
|
+
cursor?: string;
|
|
1066
|
+
}, {
|
|
1067
|
+
resourceTemplates: JsonValue$1[];
|
|
1068
|
+
nextCursor?: string;
|
|
1069
|
+
}>;
|
|
1070
|
+
"desktop.pluginApps.prepareMessage": Entry<Action & {
|
|
1071
|
+
content: JsonValue$1;
|
|
1072
|
+
role: JsonValue$1;
|
|
1073
|
+
}, PluginAppPreparedMessage>;
|
|
1074
|
+
"desktop.pluginApps.submitMessage": Entry<Action, PluginAppSubmissionReceipt>;
|
|
1075
|
+
"desktop.pluginApps.getMessageSubmission": Entry<Action, PluginAppSubmissionReceipt>;
|
|
1076
|
+
"desktop.pluginApps.cancelMessage": Entry<Action, void>;
|
|
1077
|
+
"desktop.pluginApps.updateModelContext": Entry<Action & {
|
|
1078
|
+
content?: JsonValue$1;
|
|
1079
|
+
structuredContent?: JsonValue$1;
|
|
1080
|
+
}, PluginAppModelContext>;
|
|
1081
|
+
"desktop.pluginApps.release": Entry<Mount, void>;
|
|
1082
|
+
"desktop.pluginApps.closePanel": Entry<Mount, void>;
|
|
1083
|
+
"desktop.pluginApps.closeApp": Entry<Action, {
|
|
1084
|
+
app: PluginAppRecord;
|
|
1085
|
+
}>;
|
|
1086
|
+
}
|
|
1087
|
+
type DesktopMethod = keyof DesktopMethodMap;
|
|
1088
|
+
type ApiGroup<G extends string> = {
|
|
1089
|
+
[M in DesktopMethod as M extends `desktop.${G}.${infer N}` ? N : never]: (input: DesktopMethodMap[M]["params"]) => Promise<DesktopMethodMap[M]["result"]>;
|
|
1090
|
+
};
|
|
1091
|
+
interface AppHostDesktop {
|
|
1092
|
+
bindTarget(input: BindDesktopTarget): Promise<DesktopTarget>;
|
|
1093
|
+
releaseTarget(input: Target): Promise<void>;
|
|
1094
|
+
files: Omit<ApiGroup<"files">, "openRead"> & {
|
|
1095
|
+
readFile(input: {
|
|
1096
|
+
targetId: string;
|
|
1097
|
+
path: string;
|
|
1098
|
+
range?: {
|
|
1099
|
+
start: number;
|
|
1100
|
+
end?: number;
|
|
1101
|
+
};
|
|
1102
|
+
}, options?: {
|
|
1103
|
+
signal?: AbortSignal;
|
|
1104
|
+
}): Promise<Response>;
|
|
1105
|
+
};
|
|
1106
|
+
clipboard: ApiGroup<"clipboard">;
|
|
1107
|
+
git: ApiGroup<"git">;
|
|
1108
|
+
terminals: ApiGroup<"terminals">;
|
|
1109
|
+
windows: ApiGroup<"windows">;
|
|
1110
|
+
browser: ApiGroup<"browser">;
|
|
1111
|
+
pluginApps: ApiGroup<"pluginApps">;
|
|
1112
|
+
}
|
|
1113
|
+
declare const validBrowserSnapshot: Check;
|
|
1114
|
+
declare const validDesktopTarget: Check;
|
|
1115
|
+
declare const validWorkspaceOperation: Check;
|
|
1116
|
+
declare const DESKTOP_METHODS: DesktopMethod[];
|
|
1117
|
+
declare function isDesktopMethod(method: string): method is DesktopMethod;
|
|
1118
|
+
declare function validDesktopInput(method: DesktopMethod, v: unknown): boolean;
|
|
1119
|
+
declare function validDesktopResult(method: DesktopMethod, v: unknown): boolean;
|
|
1120
|
+
/** Validate correlation as well as shape; a late result cannot settle another object/request. */
|
|
1121
|
+
declare function validDesktopResultForInput(method: DesktopMethod, input: DesktopMethodMap[DesktopMethod]["params"], result: unknown): boolean;
|
|
1122
|
+
type DesktopToolEvent = {
|
|
1123
|
+
type: "browser-changed";
|
|
1124
|
+
targetId: string;
|
|
1125
|
+
tabId: string;
|
|
1126
|
+
pageRevision: number;
|
|
1127
|
+
snapshot: BrowserAnnotationSnapshot;
|
|
1128
|
+
invalidated?: true;
|
|
1129
|
+
} | {
|
|
1130
|
+
type: "browser-open-requested";
|
|
1131
|
+
sessionId: string;
|
|
1132
|
+
} | {
|
|
1133
|
+
type: "plugin-app-resources-changed" | "plugin-app-revoked";
|
|
1134
|
+
targetId: string;
|
|
1135
|
+
mountId: string;
|
|
1136
|
+
} | {
|
|
1137
|
+
type: "terminal-event";
|
|
1138
|
+
targetId: string;
|
|
1139
|
+
event: {
|
|
1140
|
+
type: "data";
|
|
1141
|
+
terminalId: string;
|
|
1142
|
+
data: string;
|
|
1143
|
+
sequence: number;
|
|
1144
|
+
} | {
|
|
1145
|
+
type: "exit";
|
|
1146
|
+
terminalId: string;
|
|
1147
|
+
exitCode: number | null;
|
|
1148
|
+
} | {
|
|
1149
|
+
type: "status";
|
|
1150
|
+
terminalId: string;
|
|
1151
|
+
status: "stopping" | "killed";
|
|
1152
|
+
} | {
|
|
1153
|
+
type: "title";
|
|
1154
|
+
terminalId: string;
|
|
1155
|
+
title: string;
|
|
1156
|
+
} | {
|
|
1157
|
+
type: "error";
|
|
1158
|
+
terminalId: string;
|
|
1159
|
+
message: string;
|
|
1160
|
+
};
|
|
1161
|
+
};
|
|
1162
|
+
declare function validDesktopEvent(v: unknown): v is DesktopToolEvent;
|
|
1163
|
+
declare function createAppDesktopApi(rpc: {
|
|
1164
|
+
requireFeature(method: DesktopMethod): void;
|
|
1165
|
+
request<M extends DesktopMethod>(method: M, params: DesktopMethodMap[M]["params"]): Promise<DesktopMethodMap[M]["result"]>;
|
|
1166
|
+
}, owner: ConnectionStreams, filesFeature?: () => void): AppHostDesktop;
|
|
1167
|
+
/** Persist this normalized original alongside a request ID; recovery sends exactly that request. */
|
|
1168
|
+
declare function canonicalDesktopRequest(value: unknown): string;
|
|
1169
|
+
|
|
1170
|
+
/** The original extension manager's finite operations; never an IPC channel or arbitrary service method. */
|
|
1171
|
+
declare const EXTENSION_INPUTS: {
|
|
1172
|
+
context: Check;
|
|
1173
|
+
"plugins.loadIcon": Check;
|
|
1174
|
+
"plugins.snapshot": Check;
|
|
1175
|
+
"plugins.enable": Check;
|
|
1176
|
+
"plugins.disable": Check;
|
|
1177
|
+
"plugins.uninstall": Check;
|
|
1178
|
+
"plugins.reload": Check;
|
|
1179
|
+
"plugins.importArchive": Check;
|
|
1180
|
+
"plugins.confirmArchive": Check;
|
|
1181
|
+
"plugins.cancelArchive": Check;
|
|
1182
|
+
"plugins.importGit": Check;
|
|
1183
|
+
"plugins.confirmGit": Check;
|
|
1184
|
+
"plugins.cancelGit": Check;
|
|
1185
|
+
"plugins.marketplaceCatalog": Check;
|
|
1186
|
+
"plugins.marketplaceAddSource": Check;
|
|
1187
|
+
"plugins.marketplaceSetSourceEnabled": Check;
|
|
1188
|
+
"plugins.marketplaceRemoveSource": Check;
|
|
1189
|
+
"plugins.marketplacePreview": Check;
|
|
1190
|
+
"plugins.marketplaceConfirm": Check;
|
|
1191
|
+
"plugins.marketplaceCancel": Check;
|
|
1192
|
+
"plugins.marketplaceOperation": Check;
|
|
1193
|
+
"skills.snapshot": Check;
|
|
1194
|
+
"skills.remove": Check;
|
|
1195
|
+
"mcp.snapshot": Check;
|
|
1196
|
+
"mcp.exportConfig": Check;
|
|
1197
|
+
"mcp.getConfig": Check;
|
|
1198
|
+
"mcp.add": Check;
|
|
1199
|
+
"mcp.update": Check;
|
|
1200
|
+
"mcp.remove": Check;
|
|
1201
|
+
"mcp.setEnabled": Check;
|
|
1202
|
+
"mcp.login": Check;
|
|
1203
|
+
"mcp.loginStatus": Check;
|
|
1204
|
+
"mcp.cancelLogin": Check;
|
|
1205
|
+
"mcp.logout": Check;
|
|
1206
|
+
};
|
|
1207
|
+
type ExtensionOperation = keyof typeof EXTENSION_INPUTS;
|
|
1208
|
+
interface ExtensionRequest {
|
|
1209
|
+
operation: ExtensionOperation;
|
|
1210
|
+
input: Record<string, unknown>;
|
|
1211
|
+
}
|
|
1212
|
+
declare function validExtensionRequest(value: unknown): value is ExtensionRequest;
|
|
1213
|
+
declare const validExtensionResult: (value: unknown) => boolean;
|
|
1214
|
+
|
|
1215
|
+
/** Project records and filesystem locations have separate business identities. */
|
|
1216
|
+
interface SystemProject {
|
|
1217
|
+
workspaceId: string;
|
|
1218
|
+
projectId?: string;
|
|
1219
|
+
name: string;
|
|
1220
|
+
path: string;
|
|
1221
|
+
available: boolean;
|
|
1222
|
+
lastOpenedAt: number;
|
|
1223
|
+
defaultShell?: string;
|
|
1224
|
+
}
|
|
1225
|
+
interface ProjectSnapshot {
|
|
1226
|
+
dataScopeId: string;
|
|
1227
|
+
projects: SystemProject[];
|
|
1228
|
+
}
|
|
1229
|
+
type Scope = {
|
|
1230
|
+
dataScopeId: string;
|
|
1231
|
+
};
|
|
1232
|
+
type Project = Scope & {
|
|
1233
|
+
projectId: string;
|
|
1234
|
+
workspaceId: string;
|
|
1235
|
+
};
|
|
1236
|
+
type ProjectRequest = {
|
|
1237
|
+
action: "list";
|
|
1238
|
+
} | Scope & {
|
|
1239
|
+
action: "register";
|
|
1240
|
+
workspaceId: string;
|
|
1241
|
+
} | Project & {
|
|
1242
|
+
action: "setDefaultShell";
|
|
1243
|
+
shell: string | null;
|
|
1244
|
+
} | Project & {
|
|
1245
|
+
action: "archive";
|
|
1246
|
+
} | Scope & {
|
|
1247
|
+
action: "rebind";
|
|
1248
|
+
projectId?: string;
|
|
1249
|
+
workspaceId: string;
|
|
1250
|
+
previousWorkspaceId: string;
|
|
1251
|
+
previousPath?: string;
|
|
1252
|
+
};
|
|
1253
|
+
declare function validProjectRequest(value: unknown): value is ProjectRequest;
|
|
1254
|
+
declare const validProjectSnapshot: (value: unknown) => value is ProjectSnapshot;
|
|
1255
|
+
|
|
1256
|
+
interface CustomModelProviderInput {
|
|
1257
|
+
id: string;
|
|
1258
|
+
displayName: string;
|
|
1259
|
+
baseUrl: string;
|
|
1260
|
+
apiFormat: "openai";
|
|
1261
|
+
apiKey?: string;
|
|
1262
|
+
models: {
|
|
1263
|
+
id: string;
|
|
1264
|
+
displayName: string;
|
|
1265
|
+
imageInputSupport?: "native" | "unsupported" | "unknown";
|
|
1266
|
+
contextWindow?: number;
|
|
1267
|
+
maxOutputTokens?: number;
|
|
1268
|
+
}[];
|
|
1269
|
+
headers?: Record<string, string>;
|
|
1270
|
+
secretHeaders?: Record<string, string | null>;
|
|
1271
|
+
}
|
|
1272
|
+
type Removal = {
|
|
1273
|
+
provider: string;
|
|
1274
|
+
disableDefault?: boolean;
|
|
1275
|
+
replacement?: {
|
|
1276
|
+
provider: string;
|
|
1277
|
+
model: string;
|
|
1278
|
+
};
|
|
1279
|
+
};
|
|
1280
|
+
type ModelProviderRequest = {
|
|
1281
|
+
action: "list";
|
|
1282
|
+
} | {
|
|
1283
|
+
action: "refresh";
|
|
1284
|
+
} | {
|
|
1285
|
+
action: "connect";
|
|
1286
|
+
provider: string;
|
|
1287
|
+
apiKey: string;
|
|
1288
|
+
headers?: Record<string, string>;
|
|
1289
|
+
secretHeaders?: Record<string, string | null>;
|
|
1290
|
+
} | {
|
|
1291
|
+
action: "updateHeaders";
|
|
1292
|
+
provider: string;
|
|
1293
|
+
headers: Record<string, string>;
|
|
1294
|
+
secretHeaders?: Record<string, string | null>;
|
|
1295
|
+
} | {
|
|
1296
|
+
action: "createCustom";
|
|
1297
|
+
value: CustomModelProviderInput;
|
|
1298
|
+
} | {
|
|
1299
|
+
action: "updateCustom";
|
|
1300
|
+
provider: string;
|
|
1301
|
+
value: CustomModelProviderInput;
|
|
1302
|
+
} | ({
|
|
1303
|
+
action: "disconnect";
|
|
1304
|
+
} & Removal) | ({
|
|
1305
|
+
action: "removeCustom";
|
|
1306
|
+
} & Removal);
|
|
1307
|
+
interface ModelProviderConnection {
|
|
1308
|
+
name: string;
|
|
1309
|
+
displayName: string;
|
|
1310
|
+
connected: boolean;
|
|
1311
|
+
active: boolean;
|
|
1312
|
+
custom?: boolean;
|
|
1313
|
+
credentialLabel?: string;
|
|
1314
|
+
credentialSource: "credentials" | "environment" | "subscription" | "local" | "configured" | "none";
|
|
1315
|
+
source?: "builtin" | "catalog" | "custom" | "subscription";
|
|
1316
|
+
baseUrl?: string;
|
|
1317
|
+
headers?: Record<string, string>;
|
|
1318
|
+
secretHeaderNames?: string[];
|
|
1319
|
+
models: {
|
|
1320
|
+
id: string;
|
|
1321
|
+
label: string;
|
|
1322
|
+
imageInputSupport?: "native" | "unsupported" | "unknown";
|
|
1323
|
+
declaredLimits?: {
|
|
1324
|
+
contextWindow?: number;
|
|
1325
|
+
maxOutputTokens?: number;
|
|
1326
|
+
};
|
|
1327
|
+
}[];
|
|
1328
|
+
}
|
|
1329
|
+
interface ProviderDefaultsSnapshot {
|
|
1330
|
+
models: {
|
|
1331
|
+
id: string;
|
|
1332
|
+
label: string;
|
|
1333
|
+
provider: string;
|
|
1334
|
+
providerName: string;
|
|
1335
|
+
reasoningEfforts?: string[];
|
|
1336
|
+
contextWindow?: number;
|
|
1337
|
+
inputModalities?: string[];
|
|
1338
|
+
inputCapabilities?: {
|
|
1339
|
+
image: "native" | "unsupported" | "unknown";
|
|
1340
|
+
};
|
|
1341
|
+
}[];
|
|
1342
|
+
provider: string | null;
|
|
1343
|
+
model: string | null;
|
|
1344
|
+
effort: string | null;
|
|
1345
|
+
disabled: boolean;
|
|
1346
|
+
revision: string;
|
|
1347
|
+
verified: Record<string, {
|
|
1348
|
+
model: string;
|
|
1349
|
+
checkedAt: number;
|
|
1350
|
+
}>;
|
|
1351
|
+
fastModeAvailable: false;
|
|
1352
|
+
fastModeReason: string;
|
|
1353
|
+
}
|
|
1354
|
+
interface ProviderConnectionTestResult {
|
|
1355
|
+
status: "verified" | "failed";
|
|
1356
|
+
category?: "authentication" | "address" | "network" | "model" | "unsupported" | "service";
|
|
1357
|
+
detail: string;
|
|
1358
|
+
checkedAt: number;
|
|
1359
|
+
}
|
|
1360
|
+
type ProviderDefaultsRequest = {
|
|
1361
|
+
action: "snapshot";
|
|
1362
|
+
} | {
|
|
1363
|
+
action: "updateModel";
|
|
1364
|
+
provider?: string;
|
|
1365
|
+
model: string;
|
|
1366
|
+
effort?: string | null;
|
|
1367
|
+
expectedRevision?: string;
|
|
1368
|
+
} | {
|
|
1369
|
+
action: "updateEffort";
|
|
1370
|
+
effort: string | null;
|
|
1371
|
+
expectedRevision: string;
|
|
1372
|
+
} | {
|
|
1373
|
+
action: "test";
|
|
1374
|
+
provider: string;
|
|
1375
|
+
model: string;
|
|
1376
|
+
};
|
|
1377
|
+
|
|
1378
|
+
declare const SYSTEM_SETTINGS_SECTIONS: readonly ["general", "notifications", "profile", "appearance", "keyboard", "providers", "permissions", "personalization", "billing", "connections", "terminal", "git", "runtime", "storage", "diagnostics"];
|
|
1379
|
+
type SessionSettingsOriginal = Extract<SessionControlOriginal, {
|
|
1380
|
+
action: "fork";
|
|
1381
|
+
}>;
|
|
1382
|
+
type SessionSettingsTarget = {
|
|
1383
|
+
kind: "connection";
|
|
1384
|
+
connection: AgentConnection;
|
|
1385
|
+
sessionId: string;
|
|
1386
|
+
} | {
|
|
1387
|
+
kind: "fork";
|
|
1388
|
+
connection: AgentConnection;
|
|
1389
|
+
requestId: string;
|
|
1390
|
+
sessionId: string;
|
|
1391
|
+
original: Extract<SessionSettingsOriginal, {
|
|
1392
|
+
action: "fork";
|
|
1393
|
+
}>;
|
|
1394
|
+
};
|
|
1395
|
+
type SessionSettingsWireTarget = {
|
|
1396
|
+
kind: "connection";
|
|
1397
|
+
connectionId: string;
|
|
1398
|
+
sessionId: string;
|
|
1399
|
+
} | {
|
|
1400
|
+
kind: "fork";
|
|
1401
|
+
connectionId: string;
|
|
1402
|
+
requestId: string;
|
|
1403
|
+
sessionId: string;
|
|
1404
|
+
original: Extract<SessionSettingsOriginal, {
|
|
1405
|
+
action: "fork";
|
|
1406
|
+
}>;
|
|
1407
|
+
};
|
|
1408
|
+
type SystemSimpleOpenInput = {
|
|
1409
|
+
page: "notes";
|
|
1410
|
+
noteId?: string;
|
|
1411
|
+
} | {
|
|
1412
|
+
page: "scheduled";
|
|
1413
|
+
taskId?: string;
|
|
1414
|
+
scheduledRunId?: string;
|
|
1415
|
+
} | {
|
|
1416
|
+
page: "extensions";
|
|
1417
|
+
tab?: "plugins" | "skills" | "mcp";
|
|
1418
|
+
} | {
|
|
1419
|
+
page: "settings";
|
|
1420
|
+
section?: (typeof SYSTEM_SETTINGS_SECTIONS)[number];
|
|
1421
|
+
} | {
|
|
1422
|
+
page: "pet";
|
|
1423
|
+
} | {
|
|
1424
|
+
page: "search";
|
|
1425
|
+
query?: string;
|
|
1426
|
+
};
|
|
1427
|
+
type SystemOpenInput = SystemSimpleOpenInput | {
|
|
1428
|
+
page: "session-settings";
|
|
1429
|
+
target: SessionSettingsTarget;
|
|
1430
|
+
};
|
|
1431
|
+
type SystemOpenWireInput = SystemSimpleOpenInput | {
|
|
1432
|
+
page: "session-settings";
|
|
1433
|
+
target: SessionSettingsWireTarget;
|
|
1434
|
+
};
|
|
1435
|
+
type DesktopNavigationTarget = {
|
|
1436
|
+
id: string;
|
|
1437
|
+
dataScopeId: string;
|
|
1438
|
+
} & ({
|
|
1439
|
+
kind: "session";
|
|
1440
|
+
sessionId: string;
|
|
1441
|
+
messageId?: string;
|
|
1442
|
+
permissionId?: string;
|
|
1443
|
+
attentionId?: string;
|
|
1444
|
+
} | {
|
|
1445
|
+
kind: "scheduled";
|
|
1446
|
+
taskId: string;
|
|
1447
|
+
scheduledRunId: string;
|
|
1448
|
+
sessionId?: string;
|
|
1449
|
+
});
|
|
1450
|
+
type NavigationCompletionStatus = "opened" | "unavailable" | "permission_required" | "cancelled";
|
|
1451
|
+
interface AppearancePreferences {
|
|
1452
|
+
version: 1;
|
|
1453
|
+
theme: "system" | "light" | "dark";
|
|
1454
|
+
accent: {
|
|
1455
|
+
kind: "preset";
|
|
1456
|
+
id: "neutral" | "blue" | "violet" | "terracotta" | "green";
|
|
1457
|
+
} | {
|
|
1458
|
+
kind: "custom";
|
|
1459
|
+
value: `#${string}`;
|
|
1460
|
+
};
|
|
1461
|
+
colors: Record<"light" | "dark", {
|
|
1462
|
+
background: `#${string}` | null;
|
|
1463
|
+
foreground: `#${string}` | null;
|
|
1464
|
+
}>;
|
|
1465
|
+
uiFont: "system" | "segoe-ui" | "inter";
|
|
1466
|
+
codeFont: "system" | "cascadia-code" | "cascadia-mono" | "geist-mono" | "consolas";
|
|
1467
|
+
uiFontSize: number;
|
|
1468
|
+
codeFontSize: number;
|
|
1469
|
+
reducedMotion: "system" | "on" | "off";
|
|
1470
|
+
streamingTextAnimation: boolean;
|
|
1471
|
+
glassStrength: number;
|
|
1472
|
+
}
|
|
1473
|
+
declare const SYSTEM_SHORTCUT_IDS: readonly ["searchChats", "newConversation", "chooseProject", "closeConversation", "quit", "toggleSidebar", "togglePanel", "openBrowser", "openFiles", "openTerminal", "previousSession", "nextSession", "goBack", "goForward", "zoomIn", "zoomOut", "resetZoom", "showShortcuts"];
|
|
1474
|
+
type SystemShortcutId = (typeof SYSTEM_SHORTCUT_IDS)[number];
|
|
1475
|
+
interface PresentationSnapshot {
|
|
1476
|
+
revision: number;
|
|
1477
|
+
appearance: AppearancePreferences;
|
|
1478
|
+
editor: {
|
|
1479
|
+
readOnly: boolean;
|
|
1480
|
+
wordWrap: boolean;
|
|
1481
|
+
tabSize: 2 | 4;
|
|
1482
|
+
};
|
|
1483
|
+
shortcutOverrides: Partial<Record<SystemShortcutId, {
|
|
1484
|
+
binding: string;
|
|
1485
|
+
keys: string;
|
|
1486
|
+
}>>;
|
|
1487
|
+
}
|
|
1488
|
+
type SystemEvent = {
|
|
1489
|
+
type: "system-navigation-requested";
|
|
1490
|
+
viewEpoch: number;
|
|
1491
|
+
target: DesktopNavigationTarget;
|
|
1492
|
+
} | {
|
|
1493
|
+
type: "presentation-preferences-changed";
|
|
1494
|
+
revision: number;
|
|
1495
|
+
} | {
|
|
1496
|
+
type: "git-preferences-changed";
|
|
1497
|
+
defaultTaskLocation: "current" | "worktree";
|
|
1498
|
+
};
|
|
1499
|
+
declare const SYSTEM_METHODS: readonly ["system.projects", "system.extensions", "system.modelProviders", "system.providerDefaults", "system.open", "system.getPresentationPreferences", "system.setTheme", "system.setWindowMaterial", "system.copyText", "system.openExternal", "system.markSessionRead", "system.navigationReady", "system.completeNavigation"];
|
|
1500
|
+
interface SystemMethodMap {
|
|
1501
|
+
"system.projects": {
|
|
1502
|
+
params: ProjectRequest;
|
|
1503
|
+
result: ProjectSnapshot;
|
|
1504
|
+
};
|
|
1505
|
+
"system.extensions": {
|
|
1506
|
+
params: ExtensionRequest;
|
|
1507
|
+
result: unknown;
|
|
1508
|
+
};
|
|
1509
|
+
"system.modelProviders": {
|
|
1510
|
+
params: ModelProviderRequest;
|
|
1511
|
+
result: ModelProviderConnection[];
|
|
1512
|
+
};
|
|
1513
|
+
"system.providerDefaults": {
|
|
1514
|
+
params: ProviderDefaultsRequest;
|
|
1515
|
+
result: ProviderDefaultsSnapshot | ProviderConnectionTestResult;
|
|
1516
|
+
};
|
|
1517
|
+
"system.open": {
|
|
1518
|
+
params: SystemOpenWireInput;
|
|
1519
|
+
result: {
|
|
1520
|
+
opened: true;
|
|
1521
|
+
};
|
|
1522
|
+
};
|
|
1523
|
+
"system.getPresentationPreferences": {
|
|
1524
|
+
params: Record<string, never>;
|
|
1525
|
+
result: PresentationSnapshot;
|
|
1526
|
+
};
|
|
1527
|
+
"system.setTheme": {
|
|
1528
|
+
params: {
|
|
1529
|
+
theme: AppearancePreferences["theme"];
|
|
1530
|
+
};
|
|
1531
|
+
result: PresentationSnapshot;
|
|
1532
|
+
};
|
|
1533
|
+
"system.setWindowMaterial": {
|
|
1534
|
+
params: {
|
|
1535
|
+
preference: "glass" | "opaque";
|
|
1536
|
+
};
|
|
1537
|
+
result: void;
|
|
1538
|
+
};
|
|
1539
|
+
"system.copyText": {
|
|
1540
|
+
params: {
|
|
1541
|
+
text: string;
|
|
1542
|
+
};
|
|
1543
|
+
result: void;
|
|
1544
|
+
};
|
|
1545
|
+
"system.openExternal": {
|
|
1546
|
+
params: {
|
|
1547
|
+
url: string;
|
|
1548
|
+
};
|
|
1549
|
+
result: void;
|
|
1550
|
+
};
|
|
1551
|
+
"system.markSessionRead": {
|
|
1552
|
+
params: {
|
|
1553
|
+
connectionId: string;
|
|
1554
|
+
sessionId: string;
|
|
1555
|
+
throughSeq: number;
|
|
1556
|
+
};
|
|
1557
|
+
result: void;
|
|
1558
|
+
};
|
|
1559
|
+
"system.navigationReady": {
|
|
1560
|
+
params: Record<string, never>;
|
|
1561
|
+
result: {
|
|
1562
|
+
pending: DesktopNavigationTarget | null;
|
|
1563
|
+
};
|
|
1564
|
+
};
|
|
1565
|
+
"system.completeNavigation": {
|
|
1566
|
+
params: {
|
|
1567
|
+
id: string;
|
|
1568
|
+
status: NavigationCompletionStatus;
|
|
1569
|
+
};
|
|
1570
|
+
result: void;
|
|
1571
|
+
};
|
|
1572
|
+
}
|
|
1573
|
+
type SystemMethod = keyof SystemMethodMap;
|
|
1574
|
+
declare const validPresentationSnapshot: (v: unknown) => v is PresentationSnapshot;
|
|
1575
|
+
declare const validDesktopNavigationTarget: (v: unknown) => v is DesktopNavigationTarget;
|
|
1576
|
+
declare function isSystemMethod(v: string): v is SystemMethod;
|
|
1577
|
+
declare function validSessionSettingsTarget(value: unknown): value is SessionSettingsWireTarget;
|
|
1578
|
+
declare function validSystemInput(method: SystemMethod, value: unknown): boolean;
|
|
1579
|
+
declare function validSystemResult(method: SystemMethod, value: unknown): boolean;
|
|
1580
|
+
declare function validSystemEvent(value: unknown): value is SystemEvent;
|
|
1581
|
+
interface AppHostSystem {
|
|
1582
|
+
projects(input: ProjectRequest): Promise<ProjectSnapshot>;
|
|
1583
|
+
/** Requires the explicit extensions.manage installation capability. */
|
|
1584
|
+
extensions(input: ExtensionRequest): Promise<unknown>;
|
|
1585
|
+
/** Manages connections for the active built-in workbench. */
|
|
1586
|
+
modelProviders(input: ModelProviderRequest): Promise<ModelProviderConnection[]>;
|
|
1587
|
+
providerDefaults(input: Extract<ProviderDefaultsRequest, {
|
|
1588
|
+
action: "test";
|
|
1589
|
+
}>): Promise<ProviderConnectionTestResult>;
|
|
1590
|
+
providerDefaults(input: Exclude<ProviderDefaultsRequest, {
|
|
1591
|
+
action: "test";
|
|
1592
|
+
}>): Promise<ProviderDefaultsSnapshot>;
|
|
1593
|
+
open(input: SystemOpenInput): Promise<{
|
|
1594
|
+
opened: true;
|
|
1595
|
+
}>;
|
|
1596
|
+
getPresentationPreferences(): Promise<PresentationSnapshot>;
|
|
1597
|
+
/** Changes the global theme. Only the active built-in workbench may write it. */
|
|
1598
|
+
setTheme(theme: AppearancePreferences["theme"]): Promise<PresentationSnapshot>;
|
|
1599
|
+
/** Changes the platform window material. Only the active built-in workbench may write it. */
|
|
1600
|
+
setWindowMaterial(preference: "glass" | "opaque"): Promise<void>;
|
|
1601
|
+
/** Writes plain text from the current application document. */
|
|
1602
|
+
copyText(text: string): Promise<void>;
|
|
1603
|
+
/** Opens an HTTP(S) URL without credentials in the default browser. */
|
|
1604
|
+
openExternal(url: string): Promise<void>;
|
|
1605
|
+
markSessionRead(input: {
|
|
1606
|
+
connection: AgentConnection;
|
|
1607
|
+
sessionId: string;
|
|
1608
|
+
throughSeq: number;
|
|
1609
|
+
}): Promise<void>;
|
|
1610
|
+
navigationReady(): Promise<{
|
|
1611
|
+
pending: DesktopNavigationTarget | null;
|
|
1612
|
+
}>;
|
|
1613
|
+
completeNavigation(input: {
|
|
1614
|
+
id: string;
|
|
1615
|
+
status: NavigationCompletionStatus;
|
|
1616
|
+
}): Promise<void>;
|
|
1617
|
+
}
|
|
1618
|
+
interface SystemRequester {
|
|
1619
|
+
requireFeature(): void;
|
|
1620
|
+
request<M extends SystemMethod>(method: M, params: SystemMethodMap[M]["params"]): Promise<SystemMethodMap[M]["result"]>;
|
|
1621
|
+
}
|
|
1622
|
+
declare function createAppSystemApi(requester: SystemRequester, connectionOwner: object): AppHostSystem;
|
|
1623
|
+
|
|
1624
|
+
interface AppHostWorkspace {
|
|
1625
|
+
list(input?: {
|
|
1626
|
+
cursor?: string;
|
|
1627
|
+
}): Promise<WorkspaceDirectoryPage>;
|
|
1628
|
+
select(input: {
|
|
1629
|
+
requestId: string;
|
|
1630
|
+
}): Promise<WorkspaceRef | null>;
|
|
1631
|
+
getSelection(input: {
|
|
1632
|
+
requestId: string;
|
|
1633
|
+
}): Promise<WorkspaceSelection>;
|
|
1634
|
+
get(id: string): Promise<WorkspaceRef>;
|
|
1635
|
+
listFiles(input: {
|
|
1636
|
+
workspaceId: string;
|
|
1637
|
+
directory: string;
|
|
1638
|
+
cursor?: string;
|
|
1639
|
+
}): Promise<WorkspaceFilePage>;
|
|
1640
|
+
readText(input: {
|
|
1641
|
+
workspaceId: string;
|
|
1642
|
+
path: string;
|
|
1643
|
+
}): Promise<WorkspaceText>;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
interface WorkspaceDirectoryPage {
|
|
1647
|
+
entries: WorkspaceRef[];
|
|
1648
|
+
nextCursor?: string;
|
|
1649
|
+
revision: string;
|
|
1650
|
+
}
|
|
1651
|
+
type ResourceChanged = {
|
|
1652
|
+
type: "resources-changed";
|
|
1653
|
+
directory: "workspaces";
|
|
1654
|
+
revision: string;
|
|
1655
|
+
};
|
|
1656
|
+
interface ResourceCatalogMethodMap {
|
|
1657
|
+
"workspace.list": {
|
|
1658
|
+
params: {
|
|
1659
|
+
cursor?: string;
|
|
1660
|
+
};
|
|
1661
|
+
result: WorkspaceDirectoryPage;
|
|
1662
|
+
};
|
|
1663
|
+
}
|
|
1664
|
+
type ResourceCatalogMethod = keyof ResourceCatalogMethodMap;
|
|
1665
|
+
declare const RESOURCE_CATALOG_METHODS: readonly ["workspace.list"];
|
|
1666
|
+
declare const isResourceCatalogMethod: (m: string) => m is ResourceCatalogMethod;
|
|
1667
|
+
declare const validResourceChanged: (v: unknown) => v is ResourceChanged;
|
|
1668
|
+
declare function validResourceCatalogInput(_method: ResourceCatalogMethod, v: unknown): boolean;
|
|
1669
|
+
declare function validResourceCatalogResult(method: ResourceCatalogMethod, v: unknown): boolean;
|
|
1670
|
+
declare function createResourceCatalogApi(rpc: {
|
|
1671
|
+
requireFeature(): void;
|
|
1672
|
+
request<M extends ResourceCatalogMethod>(method: M, params: ResourceCatalogMethodMap[M]["params"]): Promise<ResourceCatalogMethodMap[M]["result"]>;
|
|
1673
|
+
}): {
|
|
1674
|
+
list: (input?: {
|
|
1675
|
+
cursor?: string;
|
|
1676
|
+
}) => Promise<WorkspaceDirectoryPage>;
|
|
1677
|
+
};
|
|
1678
|
+
|
|
1679
|
+
interface AttachmentsMethodMap {
|
|
1680
|
+
"attachments.getConnection": {
|
|
1681
|
+
params: {
|
|
1682
|
+
targetId: string;
|
|
1683
|
+
};
|
|
1684
|
+
result: {
|
|
1685
|
+
connectionId: string;
|
|
1686
|
+
baseUrl: string;
|
|
1687
|
+
};
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
type AttachmentsMethod = keyof AttachmentsMethodMap;
|
|
1691
|
+
interface AppHostAttachments {
|
|
1692
|
+
getConnection(input: {
|
|
1693
|
+
targetId: string;
|
|
1694
|
+
}): Promise<AgentConnection>;
|
|
1695
|
+
}
|
|
1696
|
+
declare const ATTACHMENTS_METHODS: readonly ["attachments.getConnection"];
|
|
1697
|
+
declare function validAttachmentsInput(v: unknown): boolean;
|
|
1698
|
+
declare const validAttachmentsResult: typeof validConnection;
|
|
1699
|
+
declare function createAppAttachmentsApi(rpc: {
|
|
1700
|
+
requireFeature(): void;
|
|
1701
|
+
request(method: AttachmentsMethod, params: {
|
|
1702
|
+
targetId: string;
|
|
1703
|
+
}): Promise<{
|
|
1704
|
+
connectionId: string;
|
|
1705
|
+
baseUrl: string;
|
|
1706
|
+
}>;
|
|
1707
|
+
}, streams: ConnectionStreams): AppHostAttachments;
|
|
1708
|
+
|
|
1709
|
+
interface AuxiliarySelection {
|
|
1710
|
+
optionsRevision: string;
|
|
1711
|
+
model: string;
|
|
1712
|
+
workMode: string;
|
|
1713
|
+
effort: string;
|
|
1714
|
+
}
|
|
1715
|
+
interface AuxiliaryOptions {
|
|
1716
|
+
optionsRevision: string;
|
|
1717
|
+
models: {
|
|
1718
|
+
id: string;
|
|
1719
|
+
name: string;
|
|
1720
|
+
}[];
|
|
1721
|
+
workModes: {
|
|
1722
|
+
id: string;
|
|
1723
|
+
name: string;
|
|
1724
|
+
}[];
|
|
1725
|
+
efforts: {
|
|
1726
|
+
id: string;
|
|
1727
|
+
name: string;
|
|
1728
|
+
}[];
|
|
1729
|
+
}
|
|
1730
|
+
interface AuxiliaryRequest {
|
|
1731
|
+
connection: AgentConnection;
|
|
1732
|
+
sessionId: string;
|
|
1733
|
+
requestId: string;
|
|
1734
|
+
id: string;
|
|
1735
|
+
selection: AuxiliarySelection;
|
|
1736
|
+
}
|
|
1737
|
+
interface AuxiliaryReceipt {
|
|
1738
|
+
requestId: string;
|
|
1739
|
+
id: string;
|
|
1740
|
+
state: "opening" | "open" | "closing" | "closed";
|
|
1741
|
+
leaseId?: string;
|
|
1742
|
+
sessionId?: string;
|
|
1743
|
+
}
|
|
1744
|
+
type AuxiliaryWireRequest = Omit<AuxiliaryRequest, "connection"> & {
|
|
1745
|
+
connectionId: string;
|
|
1746
|
+
};
|
|
1747
|
+
interface AuxiliaryMethodMap {
|
|
1748
|
+
"sessions.getAuxiliaryOptions": {
|
|
1749
|
+
params: {
|
|
1750
|
+
connectionId: string;
|
|
1751
|
+
sessionId: string;
|
|
1752
|
+
};
|
|
1753
|
+
result: AuxiliaryOptions;
|
|
1754
|
+
};
|
|
1755
|
+
"sessions.openAuxiliary": {
|
|
1756
|
+
params: AuxiliaryWireRequest;
|
|
1757
|
+
result: {
|
|
1758
|
+
receipt: AuxiliaryReceipt;
|
|
1759
|
+
connectionId: string;
|
|
1760
|
+
baseUrl: string;
|
|
1761
|
+
};
|
|
1762
|
+
};
|
|
1763
|
+
"sessions.getAuxiliary": {
|
|
1764
|
+
params: AuxiliaryWireRequest;
|
|
1765
|
+
result: AuxiliaryReceipt | null;
|
|
1766
|
+
};
|
|
1767
|
+
"sessions.closeAuxiliary": {
|
|
1768
|
+
params: AuxiliaryWireRequest;
|
|
1769
|
+
result: AuxiliaryReceipt;
|
|
1770
|
+
};
|
|
1771
|
+
}
|
|
1772
|
+
type AuxiliaryMethod = keyof AuxiliaryMethodMap;
|
|
1773
|
+
declare const AUXILIARY_METHODS: readonly ["sessions.getAuxiliaryOptions", "sessions.openAuxiliary", "sessions.getAuxiliary", "sessions.closeAuxiliary"];
|
|
1774
|
+
interface AppHostAuxiliarySessions {
|
|
1775
|
+
getAuxiliaryOptions(input: {
|
|
1776
|
+
connection: AgentConnection;
|
|
1777
|
+
sessionId: string;
|
|
1778
|
+
}): Promise<AuxiliaryOptions>;
|
|
1779
|
+
openAuxiliary(input: AuxiliaryRequest): Promise<{
|
|
1780
|
+
leaseId: string;
|
|
1781
|
+
sessionId: string;
|
|
1782
|
+
connection: AgentConnection;
|
|
1783
|
+
}>;
|
|
1784
|
+
getAuxiliary(input: AuxiliaryRequest): Promise<AuxiliaryReceipt | null>;
|
|
1785
|
+
closeAuxiliary(input: AuxiliaryRequest): Promise<AuxiliaryReceipt>;
|
|
1786
|
+
}
|
|
1787
|
+
declare function isAuxiliaryMethod(method: string): method is AuxiliaryMethod;
|
|
1788
|
+
declare function validAuxiliaryInput(method: AuxiliaryMethod, v: unknown): boolean;
|
|
1789
|
+
declare function validAuxiliaryResult(method: AuxiliaryMethod, v: unknown): boolean;
|
|
1790
|
+
declare function createAppAuxiliarySessionsApi(rpc: {
|
|
1791
|
+
requireFeature(): void;
|
|
1792
|
+
request<M extends AuxiliaryMethod>(method: M, params: AuxiliaryMethodMap[M]["params"]): Promise<AuxiliaryMethodMap[M]["result"]>;
|
|
1793
|
+
}, streams: ConnectionStreams): AppHostAuxiliarySessions;
|
|
1794
|
+
|
|
1795
|
+
interface SessionTarget {
|
|
1796
|
+
dataScopeId: string;
|
|
1797
|
+
sessionId: string;
|
|
1798
|
+
}
|
|
1799
|
+
type SessionConnectionTarget = SessionTarget | Record<string, never>;
|
|
1800
|
+
interface AppHostSessions {
|
|
1801
|
+
/** Without a target, handles share the page's default connection. Closing any
|
|
1802
|
+
* of those handles ends that connection and all its in-flight requests. */
|
|
1803
|
+
getConnection(input?: SessionConnectionTarget): Promise<AgentConnection>;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
interface ServiceConnection {
|
|
1807
|
+
readonly baseUrl: string;
|
|
1808
|
+
readonly apiVersion: string;
|
|
1809
|
+
fetch: typeof fetch;
|
|
1810
|
+
isClosed(): boolean;
|
|
1811
|
+
close(): void;
|
|
1812
|
+
}
|
|
1813
|
+
interface AppHostService {
|
|
1814
|
+
getStatus(): Promise<ServiceStatus>;
|
|
1815
|
+
getConnection(input: {
|
|
1816
|
+
apiRange: string;
|
|
1817
|
+
}): Promise<ServiceConnection>;
|
|
1818
|
+
listWork(): Promise<ServiceWork[]>;
|
|
1819
|
+
getWork(requestId: string): Promise<ServiceWork>;
|
|
1820
|
+
interruptWork(requestId: string): Promise<{
|
|
1821
|
+
requested: boolean;
|
|
1822
|
+
}>;
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
type AppUnloadReason = "switch" | "reload" | "disable" | "quit";
|
|
1826
|
+
interface AppUnloadRequest {
|
|
1827
|
+
id: string;
|
|
1828
|
+
reason: AppUnloadReason;
|
|
1829
|
+
signal: AbortSignal;
|
|
1830
|
+
}
|
|
1831
|
+
type AppUnloadHandler = (request: AppUnloadRequest) => Promise<boolean> | boolean;
|
|
1832
|
+
interface AppHostLifecycle {
|
|
1833
|
+
/** Freeze editing and save/read back current work. Abort restores editing after cancellation. */
|
|
1834
|
+
onPrepareUnload(handler: AppUnloadHandler): () => void;
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
interface AppContext {
|
|
1838
|
+
readonly appId: string;
|
|
1839
|
+
readonly appVersion: string;
|
|
1840
|
+
readonly installationId: string;
|
|
1841
|
+
readonly hostVersion: string;
|
|
1842
|
+
readonly hostApiVersion: string;
|
|
1843
|
+
readonly uiType: "bundled" | "remote";
|
|
1844
|
+
readonly theme: "light" | "dark";
|
|
1845
|
+
readonly locale: string;
|
|
1846
|
+
readonly capabilities: Readonly<Record<string, {
|
|
1847
|
+
readonly granted: boolean;
|
|
1848
|
+
readonly reason?: string;
|
|
1849
|
+
}>>;
|
|
1850
|
+
readonly storageQuotaBytes: number;
|
|
1851
|
+
}
|
|
1852
|
+
type AppHostEvent = DesktopToolEvent | SystemEvent | CommandInvocation | ResourceChanged | WindowStateChanged | {
|
|
1853
|
+
type: "service-changed";
|
|
1854
|
+
service: ServiceStatus;
|
|
1855
|
+
} | {
|
|
1856
|
+
type: "visibility";
|
|
1857
|
+
visible: boolean;
|
|
1858
|
+
} | {
|
|
1859
|
+
type: "context-changed";
|
|
1860
|
+
context: AppContext;
|
|
1861
|
+
} | {
|
|
1862
|
+
type: "connection-revoked";
|
|
1863
|
+
reason: string;
|
|
1864
|
+
} | {
|
|
1865
|
+
type: "before-unload";
|
|
1866
|
+
reason: "switch" | "reload" | "disable" | "quit";
|
|
1867
|
+
};
|
|
1868
|
+
interface StoredFile {
|
|
1869
|
+
id: string;
|
|
1870
|
+
name: string;
|
|
1871
|
+
size: number;
|
|
1872
|
+
}
|
|
1873
|
+
type StorageGetResult = {
|
|
1874
|
+
found: false;
|
|
1875
|
+
} | {
|
|
1876
|
+
found: true;
|
|
1877
|
+
value: JsonValue$1;
|
|
1878
|
+
};
|
|
1879
|
+
type LoginResult = {
|
|
1880
|
+
status: "completed";
|
|
1881
|
+
callbackUrl: string;
|
|
1882
|
+
} | {
|
|
1883
|
+
status: "cancelled";
|
|
1884
|
+
};
|
|
1885
|
+
interface ConnectParams {
|
|
1886
|
+
hostApi: string;
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
/** Pure window facts; these values match the host's native material contract. */
|
|
1890
|
+
interface AppWindowMaterialState {
|
|
1891
|
+
preference: "glass" | "opaque";
|
|
1892
|
+
active: "glass" | "opaque";
|
|
1893
|
+
shell: "solid" | "translucent" | "transparent";
|
|
1894
|
+
unavailableReason: "unsupported-platform" | "unsupported-system" | "reduced-transparency" | "material-error" | null;
|
|
1895
|
+
}
|
|
1896
|
+
interface AppWindowState {
|
|
1897
|
+
platform: "win32" | "darwin" | "linux";
|
|
1898
|
+
maximized: boolean;
|
|
1899
|
+
titleBar: "host" | "custom" | "native";
|
|
1900
|
+
/** Horizontal space to reserve inside the application's title bar, in page coordinates. */
|
|
1901
|
+
trafficLightInset: number;
|
|
1902
|
+
material: AppWindowMaterialState;
|
|
1903
|
+
}
|
|
1904
|
+
interface AppWindowOpenHostInput {
|
|
1905
|
+
page: "manage" | "settings" | "about" | "recovery";
|
|
1906
|
+
}
|
|
1907
|
+
type AppWindowStartupResult = {
|
|
1908
|
+
status: "ready";
|
|
1909
|
+
} | {
|
|
1910
|
+
status: "failed";
|
|
1911
|
+
message: string;
|
|
1912
|
+
};
|
|
1913
|
+
interface WindowStateChanged {
|
|
1914
|
+
type: "window-state-changed";
|
|
1915
|
+
state: AppWindowState;
|
|
1916
|
+
}
|
|
1917
|
+
declare const WINDOW_METHODS: readonly ["window.getState", "window.minimize", "window.toggleMaximize", "window.requestClose", "window.openHost", "window.reportStartup"];
|
|
1918
|
+
interface WindowMethodMap {
|
|
1919
|
+
"window.getState": {
|
|
1920
|
+
params: Record<string, never>;
|
|
1921
|
+
result: AppWindowState;
|
|
1922
|
+
};
|
|
1923
|
+
"window.minimize": {
|
|
1924
|
+
params: Record<string, never>;
|
|
1925
|
+
result: void;
|
|
1926
|
+
};
|
|
1927
|
+
"window.toggleMaximize": {
|
|
1928
|
+
params: Record<string, never>;
|
|
1929
|
+
result: void;
|
|
1930
|
+
};
|
|
1931
|
+
"window.requestClose": {
|
|
1932
|
+
params: Record<string, never>;
|
|
1933
|
+
result: void;
|
|
1934
|
+
};
|
|
1935
|
+
"window.openHost": {
|
|
1936
|
+
params: AppWindowOpenHostInput;
|
|
1937
|
+
result: void;
|
|
1938
|
+
};
|
|
1939
|
+
"window.reportStartup": {
|
|
1940
|
+
params: AppWindowStartupResult;
|
|
1941
|
+
result: void;
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1944
|
+
type WindowMethod = keyof WindowMethodMap;
|
|
1945
|
+
declare const validAppWindowState: (value: unknown) => value is AppWindowState;
|
|
1946
|
+
declare function isWindowMethod(value: string): value is WindowMethod;
|
|
1947
|
+
declare function validWindowInput(method: WindowMethod, value: unknown): boolean;
|
|
1948
|
+
declare function validWindowResult(method: WindowMethod, value: unknown): boolean;
|
|
1949
|
+
declare function validWindowEvent(value: unknown): value is WindowStateChanged;
|
|
1950
|
+
interface AppHostWindow {
|
|
1951
|
+
getState(): Promise<AppWindowState>;
|
|
1952
|
+
onStateChanged(listener: (state: AppWindowState) => void): () => void;
|
|
1953
|
+
minimize(): Promise<void>;
|
|
1954
|
+
toggleMaximize(): Promise<void>;
|
|
1955
|
+
requestClose(): Promise<void>;
|
|
1956
|
+
openHost(input: AppWindowOpenHostInput): Promise<void>;
|
|
1957
|
+
/** Report first-screen completion or startup failure for this document only. */
|
|
1958
|
+
reportStartup(input: AppWindowStartupResult): Promise<void>;
|
|
1959
|
+
}
|
|
1960
|
+
interface WindowRequester {
|
|
1961
|
+
requireFeature(): void;
|
|
1962
|
+
request<M extends WindowMethod>(method: M, params: WindowMethodMap[M]["params"]): Promise<WindowMethodMap[M]["result"]>;
|
|
1963
|
+
onEvent(listener: (event: AppHostEvent) => void): () => void;
|
|
1964
|
+
}
|
|
1965
|
+
declare function createAppWindowApi(requester: WindowRequester): AppHostWindow;
|
|
1966
|
+
|
|
1967
|
+
interface AppHostStorage {
|
|
1968
|
+
get(key: string): Promise<StorageGetResult>;
|
|
1969
|
+
set(key: string, value: JsonValue$1): Promise<void>;
|
|
1970
|
+
delete(key: string): Promise<void>;
|
|
1971
|
+
putFile(name: string, data: Blob): Promise<StoredFile>;
|
|
1972
|
+
readFile(id: string): Promise<Response>;
|
|
1973
|
+
deleteFile(id: string): Promise<void>;
|
|
1974
|
+
}
|
|
1975
|
+
interface AppHost {
|
|
1976
|
+
hasFeature(feature: AppHostFeature): boolean;
|
|
1977
|
+
commands: AppHostCommands;
|
|
1978
|
+
lifecycle: AppHostLifecycle;
|
|
1979
|
+
system: AppHostSystem;
|
|
1980
|
+
window: AppHostWindow;
|
|
1981
|
+
sessions: AppHostSessions & AppHostAuxiliarySessions & ConversationPreparation;
|
|
1982
|
+
desktop: AppHostDesktop;
|
|
1983
|
+
attachments: AppHostAttachments;
|
|
1984
|
+
workspace: AppHostWorkspace;
|
|
1985
|
+
service: AppHostService;
|
|
1986
|
+
getContext(): Promise<AppContext>;
|
|
1987
|
+
onEvent(listener: (event: AppHostEvent) => void): () => void;
|
|
1988
|
+
storage: AppHostStorage;
|
|
1989
|
+
auth: {
|
|
1990
|
+
openLogin(input: {
|
|
1991
|
+
url: string;
|
|
1992
|
+
}): Promise<LoginResult>;
|
|
1993
|
+
};
|
|
1994
|
+
}
|
|
1995
|
+
declare function connectAppHost(options: ConnectParams): Promise<AppHost>;
|
|
1996
|
+
|
|
1997
|
+
interface PageFetchClientOptions {
|
|
1998
|
+
allowsInlineBody?(): boolean;
|
|
1999
|
+
allowsTargetClose?(): boolean;
|
|
2000
|
+
send(message: PageFetchFrame): void;
|
|
2001
|
+
onMessage(listener: (message: unknown) => void): () => void;
|
|
2002
|
+
onClose(listener: () => void): () => void;
|
|
2003
|
+
}
|
|
2004
|
+
/** Owns only this document's streams. Closing a connection ends observation, never business work. */
|
|
2005
|
+
declare function createPageFetchClient(options: PageFetchClientOptions): {
|
|
2006
|
+
fetchFor(connectionId: string, baseUrl: string): typeof fetch;
|
|
2007
|
+
isClosed(connectionId: string): boolean;
|
|
2008
|
+
close(connectionId: string): void;
|
|
2009
|
+
};
|
|
2010
|
+
|
|
2011
|
+
type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
2012
|
+
[key: string]: JsonValue;
|
|
2013
|
+
};
|
|
2014
|
+
|
|
2015
|
+
type PluginAppJson = JsonValue;
|
|
2016
|
+
|
|
2017
|
+
interface PluginAppSource {
|
|
2018
|
+
sessionId: string;
|
|
2019
|
+
appId: string;
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
interface PluginAppRuntimeLease {
|
|
2023
|
+
token: string;
|
|
2024
|
+
backendGeneration: string;
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
interface PluginAppConversationInput {
|
|
2028
|
+
source: PluginAppSource;
|
|
2029
|
+
lease: PluginAppRuntimeLease;
|
|
2030
|
+
requestId: string;
|
|
2031
|
+
expectedRevision: number;
|
|
2032
|
+
text: string;
|
|
2033
|
+
data: PluginAppJson;
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
/** Read persisted display data through the shared, browser-safe contracts. */
|
|
2037
|
+
|
|
2038
|
+
declare function parsePluginAppComposerContexts(value: unknown): PluginAppConversationInput[];
|
|
2039
|
+
|
|
2040
|
+
export { ATTACHMENTS_METHODS, AUXILIARY_METHODS, AppHostError, BROWSER_CAPTURE_PREVIEW_MAX_BYTES, COMMANDS_METHODS, DESKTOP_METHODS, EXTENSION_INPUTS, RESOURCE_CATALOG_METHODS, SYSTEM_METHODS, SYSTEM_SETTINGS_SECTIONS, SYSTEM_SHORTCUT_IDS, WINDOW_METHODS, canonicalDesktopRequest, connectAppHost, createAppAttachmentsApi, createAppAuxiliarySessionsApi, createAppCommandsApi, createAppDesktopApi, createAppSystemApi, createAppWindowApi, createPageFetchClient, createResourceCatalogApi, isAuxiliaryMethod, isCommandsMethod, isDesktopMethod, isResourceCatalogMethod, isSystemMethod, isWindowMethod, parsePluginAppComposerContexts, validAppCommandSnapshot, validAppWindowState, validAttachmentsInput, validAttachmentsResult, validAuxiliaryInput, validAuxiliaryResult, validBrowserSnapshot, validCommandInvocation, validCommandReceipt, validCommandsInput, validDesktopEvent, validDesktopInput, validDesktopNavigationTarget, validDesktopResult, validDesktopResultForInput, validDesktopTarget, validExtensionRequest, validExtensionResult, validPresentationSnapshot, validProjectRequest, validProjectSnapshot, validResourceCatalogInput, validResourceCatalogResult, validResourceChanged, validSessionSettingsTarget, validSystemEvent, validSystemInput, validSystemResult, validWindowEvent, validWindowInput, validWindowResult, validWorkspaceOperation };
|
|
2041
|
+
export type { AgentConnection, AnnotationMode, AnnotationRect, AnnotationTarget, AppCommandRegistration, AppCommandSnapshot, AppContext, AppHost, AppHostAttachments, AppHostAuxiliarySessions, AppHostCommands, AppHostDesktop, AppHostErrorCode, AppHostErrorInfo, AppHostEvent, AppHostLifecycle, AppHostRetry, AppHostService, AppHostSessions, AppHostStorage, AppHostSystem, AppHostWindow, AppHostWorkspace, AppUnloadHandler, AppUnloadReason, AppUnloadRequest, AppWindowMaterialState, AppWindowOpenHostInput, AppWindowStartupResult, AppWindowState, AppearancePreferences, AttachmentsMethod, AttachmentsMethodMap, AuxiliaryMethod, AuxiliaryMethodMap, AuxiliaryOptions, AuxiliaryReceipt, AuxiliaryRequest, AuxiliarySelection, AuxiliaryWireRequest, BindDesktopTarget, BrowserAnnotationRecord, BrowserAnnotationSnapshot, BrowserPage, ClientConnection, CommandInvocation, CommandReceipt, CommandsMethod, CommandsMethodMap, ConnectParams, ConversationPreparation, DesktopGitChange, DesktopMethod, DesktopMethodMap, DesktopNavigationTarget, DesktopOpener, DesktopRoot, DesktopSearch, DesktopTarget, DesktopTerminal, DesktopTerminalInfo, DesktopTerminalRequestOriginal, DesktopTerminalRequestReceipt, DesktopTerminalSnapshot, DesktopText, DesktopToolEvent, DesktopWindow, ExtensionOperation, ExtensionRequest, JsonValue$1 as JsonValue, LoginResult, ModelProviderConnection, ModelProviderRequest, NavigationCompletionStatus, PluginAppActionReceipt, PluginAppActionResponse, PluginAppCatalog, PluginAppComposerContext, PluginAppHostState, PluginAppModelContext, PluginAppMount, PluginAppPreparedMessage, PluginAppPreparedTool, PluginAppRecord, PluginAppSource$1 as PluginAppSource, PluginAppSubmissionReceipt, PluginAppToolPolicy, PresentationSnapshot, ProjectRequest, ProjectSnapshot, ProviderConnectionTestResult, ProviderDefaultsRequest, ProviderDefaultsSnapshot, ResourceCatalogMethod, ResourceCatalogMethodMap, ResourceChanged, ServiceConnection, ServiceConnectionDescriptor, ServiceStatus, ServiceWork, ServiceWorkState, SessionSettingsTarget, SessionSettingsWireTarget, SessionTarget, StorageGetResult, StoredFile, SystemEvent, SystemMethod, SystemMethodMap, SystemOpenInput, SystemOpenWireInput, SystemProject, SystemRequester, SystemShortcutId, WindowMethod, WindowMethodMap, WindowRequester, WindowStateChanged, WorkspaceConversationCreation, WorkspaceConversationResult, WorkspaceDirectoryPage, WorkspaceFilePage, WorkspaceOperation, WorkspaceOperationKind, WorkspaceOperationOriginal, WorkspaceRef, WorkspaceSelection, WorkspaceText };
|