tencil 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +69 -103
- package/dist/cloud-CIAGUsk2.d.mts +14 -0
- package/dist/cloud-CiwIrP1h.mjs +104 -0
- package/dist/index-B0phpEz9.d.mts +454 -0
- package/dist/index.d.mts +3 -340
- package/dist/index.mjs +1 -1
- package/dist/next-loader.cjs +163 -0
- package/dist/next.d.mts +14 -0
- package/dist/next.mjs +45 -0
- package/dist/overlay.global.js +53 -26
- package/dist/react.d.mts +10 -3
- package/dist/react.mjs +20 -5
- package/dist/{server-9m0nvaLs.mjs → server-COf9gtqR.mjs} +117 -8
- package/dist/vite.d.mts +23 -4
- package/dist/vite.mjs +178 -4
- package/package.json +13 -6
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region ../protocol/src/context.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Everything the overlay knows about the picked element. Captured once when
|
|
5
|
+
* the pin is placed and forwarded to the agent as context.
|
|
6
|
+
*/
|
|
7
|
+
declare const ElementContext: z.ZodObject<{
|
|
8
|
+
tagName: z.ZodString;
|
|
9
|
+
selector: z.ZodString;
|
|
10
|
+
html: z.ZodString;
|
|
11
|
+
text: z.ZodOptional<z.ZodString>;
|
|
12
|
+
components: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
file: z.ZodString;
|
|
16
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
library: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>>>;
|
|
21
|
+
rect: z.ZodObject<{
|
|
22
|
+
x: z.ZodNumber;
|
|
23
|
+
y: z.ZodNumber;
|
|
24
|
+
width: z.ZodNumber;
|
|
25
|
+
height: z.ZodNumber;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
viewport: z.ZodObject<{
|
|
28
|
+
width: z.ZodNumber;
|
|
29
|
+
height: z.ZodNumber;
|
|
30
|
+
dpr: z.ZodNumber;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
selection: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
type ElementContext = z.infer<typeof ElementContext>;
|
|
35
|
+
declare const ImageAttachment: z.ZodObject<{
|
|
36
|
+
name: z.ZodString;
|
|
37
|
+
mimeType: z.ZodEnum<{
|
|
38
|
+
"image/png": "image/png";
|
|
39
|
+
"image/jpeg": "image/jpeg";
|
|
40
|
+
"image/webp": "image/webp";
|
|
41
|
+
}>;
|
|
42
|
+
dataUrl: z.ZodString;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
type ImageAttachment = z.infer<typeof ImageAttachment>;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region ../protocol/src/thread.d.ts
|
|
47
|
+
/**
|
|
48
|
+
* Provider-agnostic run state.
|
|
49
|
+
* - `draft`: a comment queued in a batch, not sent to the agent yet
|
|
50
|
+
* - `starting`: thread is being created on the provider
|
|
51
|
+
* - `working`: the agent is producing a turn
|
|
52
|
+
* - `waiting`: the agent needs approval/input inside the provider UI
|
|
53
|
+
* - `idle`: last turn finished, ready for a follow-up
|
|
54
|
+
* - `error`: last turn or the thread itself failed
|
|
55
|
+
*/
|
|
56
|
+
declare const ThreadStatus: z.ZodEnum<{
|
|
57
|
+
error: "error";
|
|
58
|
+
draft: "draft";
|
|
59
|
+
starting: "starting";
|
|
60
|
+
working: "working";
|
|
61
|
+
waiting: "waiting";
|
|
62
|
+
idle: "idle";
|
|
63
|
+
}>;
|
|
64
|
+
type ThreadStatus = z.infer<typeof ThreadStatus>;
|
|
65
|
+
declare const MessageRole: z.ZodEnum<{
|
|
66
|
+
user: "user";
|
|
67
|
+
assistant: "assistant";
|
|
68
|
+
system: "system";
|
|
69
|
+
}>;
|
|
70
|
+
type MessageRole = z.infer<typeof MessageRole>;
|
|
71
|
+
declare const Delivery: z.ZodObject<{
|
|
72
|
+
status: z.ZodEnum<{
|
|
73
|
+
queued: "queued";
|
|
74
|
+
pushed: "pushed";
|
|
75
|
+
deploying: "deploying";
|
|
76
|
+
live: "live";
|
|
77
|
+
"deploy-failed": "deploy-failed";
|
|
78
|
+
"no-changes": "no-changes";
|
|
79
|
+
failed: "failed";
|
|
80
|
+
}>;
|
|
81
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
82
|
+
queuePosition: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
commit: z.ZodOptional<z.ZodObject<{
|
|
84
|
+
sha: z.ZodString;
|
|
85
|
+
url: z.ZodString;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
pullRequest: z.ZodOptional<z.ZodObject<{
|
|
88
|
+
number: z.ZodNumber;
|
|
89
|
+
url: z.ZodString;
|
|
90
|
+
opened: z.ZodDefault<z.ZodBoolean>;
|
|
91
|
+
}, z.core.$strip>>;
|
|
92
|
+
previewUrl: z.ZodOptional<z.ZodString>;
|
|
93
|
+
logsUrl: z.ZodOptional<z.ZodString>;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
type Delivery = z.infer<typeof Delivery>;
|
|
96
|
+
/**
|
|
97
|
+
* One thing a provider did during the current turn, for the overlay to show
|
|
98
|
+
* under "Working…": Tencil Cloud starting a sandbox, cloning, installing, then
|
|
99
|
+
* the agent's tool calls (nested under the agent step through `parentId`).
|
|
100
|
+
*/
|
|
101
|
+
declare const ThreadStep: z.ZodObject<{
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
label: z.ZodString;
|
|
104
|
+
status: z.ZodEnum<{
|
|
105
|
+
failed: "failed";
|
|
106
|
+
running: "running";
|
|
107
|
+
done: "done";
|
|
108
|
+
skipped: "skipped";
|
|
109
|
+
}>;
|
|
110
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
111
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
112
|
+
startedAt: z.ZodString;
|
|
113
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
114
|
+
}, z.core.$strip>;
|
|
115
|
+
type ThreadStep = z.infer<typeof ThreadStep>;
|
|
116
|
+
/**
|
|
117
|
+
* A conversation Tencil tracks, backed by one provider thread. Owned and
|
|
118
|
+
* persisted by the bridge. Pinned threads sit on an element of a page;
|
|
119
|
+
* threads opened from the provider's list have no anchor and live in the dock.
|
|
120
|
+
* Several pins may continue the same provider thread.
|
|
121
|
+
*/
|
|
122
|
+
declare const Thread: z.ZodObject<{
|
|
123
|
+
id: z.ZodString;
|
|
124
|
+
title: z.ZodString;
|
|
125
|
+
pageUrl: z.ZodOptional<z.ZodString>;
|
|
126
|
+
anchor: z.ZodOptional<z.ZodObject<{
|
|
127
|
+
selector: z.ZodString;
|
|
128
|
+
offsetX: z.ZodNumber;
|
|
129
|
+
offsetY: z.ZodNumber;
|
|
130
|
+
}, z.core.$strip>>;
|
|
131
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
132
|
+
tagName: z.ZodString;
|
|
133
|
+
selector: z.ZodString;
|
|
134
|
+
html: z.ZodString;
|
|
135
|
+
text: z.ZodOptional<z.ZodString>;
|
|
136
|
+
components: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
137
|
+
name: z.ZodString;
|
|
138
|
+
source: z.ZodOptional<z.ZodObject<{
|
|
139
|
+
file: z.ZodString;
|
|
140
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
141
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
142
|
+
}, z.core.$strip>>;
|
|
143
|
+
library: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, z.core.$strip>>>;
|
|
145
|
+
rect: z.ZodObject<{
|
|
146
|
+
x: z.ZodNumber;
|
|
147
|
+
y: z.ZodNumber;
|
|
148
|
+
width: z.ZodNumber;
|
|
149
|
+
height: z.ZodNumber;
|
|
150
|
+
}, z.core.$strip>;
|
|
151
|
+
viewport: z.ZodObject<{
|
|
152
|
+
width: z.ZodNumber;
|
|
153
|
+
height: z.ZodNumber;
|
|
154
|
+
dpr: z.ZodNumber;
|
|
155
|
+
}, z.core.$strip>;
|
|
156
|
+
selection: z.ZodOptional<z.ZodString>;
|
|
157
|
+
}, z.core.$strip>>;
|
|
158
|
+
status: z.ZodEnum<{
|
|
159
|
+
error: "error";
|
|
160
|
+
draft: "draft";
|
|
161
|
+
starting: "starting";
|
|
162
|
+
working: "working";
|
|
163
|
+
waiting: "waiting";
|
|
164
|
+
idle: "idle";
|
|
165
|
+
}>;
|
|
166
|
+
statusDetail: z.ZodOptional<z.ZodString>;
|
|
167
|
+
resolved: z.ZodDefault<z.ZodBoolean>;
|
|
168
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
169
|
+
id: z.ZodString;
|
|
170
|
+
role: z.ZodEnum<{
|
|
171
|
+
user: "user";
|
|
172
|
+
assistant: "assistant";
|
|
173
|
+
system: "system";
|
|
174
|
+
}>;
|
|
175
|
+
text: z.ZodString;
|
|
176
|
+
streaming: z.ZodDefault<z.ZodBoolean>;
|
|
177
|
+
createdAt: z.ZodString;
|
|
178
|
+
}, z.core.$strip>>;
|
|
179
|
+
provider: z.ZodObject<{
|
|
180
|
+
id: z.ZodString;
|
|
181
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
182
|
+
url: z.ZodOptional<z.ZodString>;
|
|
183
|
+
}, z.core.$strip>;
|
|
184
|
+
delivery: z.ZodOptional<z.ZodObject<{
|
|
185
|
+
status: z.ZodEnum<{
|
|
186
|
+
queued: "queued";
|
|
187
|
+
pushed: "pushed";
|
|
188
|
+
deploying: "deploying";
|
|
189
|
+
live: "live";
|
|
190
|
+
"deploy-failed": "deploy-failed";
|
|
191
|
+
"no-changes": "no-changes";
|
|
192
|
+
failed: "failed";
|
|
193
|
+
}>;
|
|
194
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
195
|
+
queuePosition: z.ZodOptional<z.ZodNumber>;
|
|
196
|
+
commit: z.ZodOptional<z.ZodObject<{
|
|
197
|
+
sha: z.ZodString;
|
|
198
|
+
url: z.ZodString;
|
|
199
|
+
}, z.core.$strip>>;
|
|
200
|
+
pullRequest: z.ZodOptional<z.ZodObject<{
|
|
201
|
+
number: z.ZodNumber;
|
|
202
|
+
url: z.ZodString;
|
|
203
|
+
opened: z.ZodDefault<z.ZodBoolean>;
|
|
204
|
+
}, z.core.$strip>>;
|
|
205
|
+
previewUrl: z.ZodOptional<z.ZodString>;
|
|
206
|
+
logsUrl: z.ZodOptional<z.ZodString>;
|
|
207
|
+
}, z.core.$strip>>;
|
|
208
|
+
steps: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
209
|
+
id: z.ZodString;
|
|
210
|
+
label: z.ZodString;
|
|
211
|
+
status: z.ZodEnum<{
|
|
212
|
+
failed: "failed";
|
|
213
|
+
running: "running";
|
|
214
|
+
done: "done";
|
|
215
|
+
skipped: "skipped";
|
|
216
|
+
}>;
|
|
217
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
218
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
219
|
+
startedAt: z.ZodString;
|
|
220
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
221
|
+
}, z.core.$strip>>>;
|
|
222
|
+
createdAt: z.ZodString;
|
|
223
|
+
updatedAt: z.ZodString;
|
|
224
|
+
}, z.core.$strip>;
|
|
225
|
+
type Thread = z.infer<typeof Thread>;
|
|
226
|
+
/** A thread as listed by the provider (e.g. every T3 Code thread in the project). */
|
|
227
|
+
declare const ProviderThreadSummary: z.ZodObject<{
|
|
228
|
+
id: z.ZodString;
|
|
229
|
+
title: z.ZodString;
|
|
230
|
+
status: z.ZodEnum<{
|
|
231
|
+
error: "error";
|
|
232
|
+
working: "working";
|
|
233
|
+
waiting: "waiting";
|
|
234
|
+
idle: "idle";
|
|
235
|
+
}>;
|
|
236
|
+
updatedAt: z.ZodString;
|
|
237
|
+
url: z.ZodOptional<z.ZodString>;
|
|
238
|
+
branch: z.ZodOptional<z.ZodString>;
|
|
239
|
+
pullRequest: z.ZodOptional<z.ZodObject<{
|
|
240
|
+
number: z.ZodNumber;
|
|
241
|
+
url: z.ZodString;
|
|
242
|
+
}, z.core.$strip>>;
|
|
243
|
+
background: z.ZodOptional<z.ZodEnum<{
|
|
244
|
+
working: "working";
|
|
245
|
+
monitoring: "monitoring";
|
|
246
|
+
}>>;
|
|
247
|
+
agent: z.ZodOptional<z.ZodString>;
|
|
248
|
+
}, z.core.$strip>;
|
|
249
|
+
type ProviderThreadSummary = z.infer<typeof ProviderThreadSummary>;
|
|
250
|
+
/** A model a provider can start threads on, e.g. T3 Code's Claude Opus. */
|
|
251
|
+
declare const ProviderModel: z.ZodObject<{
|
|
252
|
+
id: z.ZodString;
|
|
253
|
+
label: z.ZodString;
|
|
254
|
+
group: z.ZodString;
|
|
255
|
+
agent: z.ZodOptional<z.ZodString>;
|
|
256
|
+
}, z.core.$strip>;
|
|
257
|
+
type ProviderModel = z.infer<typeof ProviderModel>;
|
|
258
|
+
/** How the provider presents the project the threads belong to. */
|
|
259
|
+
declare const ProviderProject: z.ZodObject<{
|
|
260
|
+
name: z.ZodString;
|
|
261
|
+
iconUrl: z.ZodOptional<z.ZodString>;
|
|
262
|
+
emoji: z.ZodOptional<z.ZodString>;
|
|
263
|
+
}, z.core.$strip>;
|
|
264
|
+
type ProviderProject = z.infer<typeof ProviderProject>;
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region ../protocol/src/messages.d.ts
|
|
267
|
+
declare const PROTOCOL_VERSION = 1;
|
|
268
|
+
/** How the overlay signs in to Tencil Cloud: OAuth 2.1 authorization code with PKCE. */
|
|
269
|
+
interface CloudSignIn {
|
|
270
|
+
authorizeUrl: string;
|
|
271
|
+
tokenUrl: string;
|
|
272
|
+
clientId: string;
|
|
273
|
+
/** A Tencil Cloud page that posts the code back to the overlay (`tencil:oauth`). */
|
|
274
|
+
redirectUri: string;
|
|
275
|
+
scope?: string;
|
|
276
|
+
}
|
|
277
|
+
/** Who is signed in to Tencil Cloud, and what they may do on this project. */
|
|
278
|
+
interface Viewer {
|
|
279
|
+
name: string;
|
|
280
|
+
/** GitHub login. */
|
|
281
|
+
login?: string;
|
|
282
|
+
avatarUrl?: string;
|
|
283
|
+
/** `read`: can see pins, not make or answer them (no write access to the repository). */
|
|
284
|
+
access: 'write' | 'read';
|
|
285
|
+
}
|
|
286
|
+
declare const ProviderInfo: z.ZodObject<{
|
|
287
|
+
id: z.ZodString;
|
|
288
|
+
label: z.ZodString;
|
|
289
|
+
state: z.ZodEnum<{
|
|
290
|
+
connecting: "connecting";
|
|
291
|
+
ready: "ready";
|
|
292
|
+
unauthorized: "unauthorized";
|
|
293
|
+
unavailable: "unavailable";
|
|
294
|
+
}>;
|
|
295
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
296
|
+
target: z.ZodOptional<z.ZodString>;
|
|
297
|
+
canPair: z.ZodOptional<z.ZodBoolean>;
|
|
298
|
+
}, z.core.$strip>;
|
|
299
|
+
type ProviderInfo = z.infer<typeof ProviderInfo>;
|
|
300
|
+
/** A provider the project can send pins to. */
|
|
301
|
+
declare const ProviderOption: z.ZodObject<{
|
|
302
|
+
id: z.ZodString;
|
|
303
|
+
label: z.ZodString;
|
|
304
|
+
}, z.core.$strip>;
|
|
305
|
+
type ProviderOption = z.infer<typeof ProviderOption>;
|
|
306
|
+
/** Per-project settings, as the overlay shows them. */
|
|
307
|
+
declare const ProjectSettings: z.ZodObject<{
|
|
308
|
+
provider: z.ZodString;
|
|
309
|
+
providers: z.ZodArray<z.ZodObject<{
|
|
310
|
+
id: z.ZodString;
|
|
311
|
+
label: z.ZodString;
|
|
312
|
+
}, z.core.$strip>>;
|
|
313
|
+
model: z.ZodOptional<z.ZodString>;
|
|
314
|
+
batch: z.ZodBoolean;
|
|
315
|
+
}, z.core.$strip>;
|
|
316
|
+
type ProjectSettings = z.infer<typeof ProjectSettings>;
|
|
317
|
+
type ServerMessage = {
|
|
318
|
+
type: 'ready';
|
|
319
|
+
protocol: typeof PROTOCOL_VERSION;
|
|
320
|
+
version: string;
|
|
321
|
+
project: {
|
|
322
|
+
name: string;
|
|
323
|
+
root: string;
|
|
324
|
+
};
|
|
325
|
+
/** The provider new pins go to. */
|
|
326
|
+
provider: ProviderInfo;
|
|
327
|
+
settings: ProjectSettings;
|
|
328
|
+
threads: Thread[];
|
|
329
|
+
/** Tencil Cloud only: who is signed in. */
|
|
330
|
+
viewer?: Viewer;
|
|
331
|
+
} |
|
|
332
|
+
/** Tencil Cloud: sign in first (no token, or one it no longer accepts). */
|
|
333
|
+
{
|
|
334
|
+
type: 'auth.required';
|
|
335
|
+
signIn: CloudSignIn;
|
|
336
|
+
reason?: string;
|
|
337
|
+
} | {
|
|
338
|
+
type: 'provider.status';
|
|
339
|
+
provider: ProviderInfo;
|
|
340
|
+
} | {
|
|
341
|
+
type: 'settings';
|
|
342
|
+
settings: ProjectSettings;
|
|
343
|
+
} |
|
|
344
|
+
/** The daemon couldn't tell which project this page belongs to; the overlay asks. */
|
|
345
|
+
{
|
|
346
|
+
type: 'project.unknown';
|
|
347
|
+
pageUrl: string;
|
|
348
|
+
choices: Array<{
|
|
349
|
+
root: string;
|
|
350
|
+
title: string;
|
|
351
|
+
}>;
|
|
352
|
+
/** What to do when there are no choices. */
|
|
353
|
+
emptyHint?: string;
|
|
354
|
+
} | {
|
|
355
|
+
type: 'thread.upsert';
|
|
356
|
+
thread: Thread;
|
|
357
|
+
} | {
|
|
358
|
+
type: 'thread.removed';
|
|
359
|
+
threadId: string;
|
|
360
|
+
} | {
|
|
361
|
+
type: 'provider.threads';
|
|
362
|
+
project: ProviderProject;
|
|
363
|
+
threads: ProviderThreadSummary[];
|
|
364
|
+
} | {
|
|
365
|
+
type: 'provider.models';
|
|
366
|
+
provider: string;
|
|
367
|
+
models: ProviderModel[];
|
|
368
|
+
/** What new threads run on when no model is picked. */
|
|
369
|
+
defaultModel?: string;
|
|
370
|
+
} | {
|
|
371
|
+
type: 'error';
|
|
372
|
+
message: string;
|
|
373
|
+
threadId?: string;
|
|
374
|
+
};
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region ../protocol/src/provider.d.ts
|
|
377
|
+
/**
|
|
378
|
+
* A provider is the agent backend a pin is delegated to (T3 Code, Claude Code,
|
|
379
|
+
* …). The bridge owns pins and talks to exactly one provider per process; the
|
|
380
|
+
* provider owns the conversation.
|
|
381
|
+
*
|
|
382
|
+
* Providers only ever see plain text + images: the bridge renders element
|
|
383
|
+
* context into the prompt so every provider gets identical input.
|
|
384
|
+
*/
|
|
385
|
+
interface Provider {
|
|
386
|
+
readonly id: string;
|
|
387
|
+
readonly label: string;
|
|
388
|
+
/** Connect/authenticate. Must not throw; report problems through `info()`. */
|
|
389
|
+
start(): Promise<void>;
|
|
390
|
+
info(): ProviderInfo;
|
|
391
|
+
onInfoChange(listener: (info: ProviderInfo) => void): () => void;
|
|
392
|
+
/** Authorize against the provider (e.g. pair with T3 Code). Optional. */
|
|
393
|
+
pair?(): Promise<void>;
|
|
394
|
+
/** Threads that already exist for this project, newest first. */
|
|
395
|
+
listThreads(): Promise<{
|
|
396
|
+
project: ProviderProject;
|
|
397
|
+
threads: ProviderThreadSummary[];
|
|
398
|
+
}>;
|
|
399
|
+
/** Models new threads can run on, and the one they use by default. Optional. */
|
|
400
|
+
listModels?(): Promise<ProviderModels>;
|
|
401
|
+
/** Deep link into the provider UI for a thread, when it has one. */
|
|
402
|
+
threadUrl(providerThreadId: string): string | undefined;
|
|
403
|
+
createThread(input: CreateThreadInput): Promise<CreatedThread>;
|
|
404
|
+
sendMessage(input: SendMessageInput): Promise<void>;
|
|
405
|
+
interrupt(providerThreadId: string): Promise<void>;
|
|
406
|
+
/**
|
|
407
|
+
* Stream updates for a thread. Called right after `createThread` and again
|
|
408
|
+
* for every persisted thread when the bridge restarts. The provider should
|
|
409
|
+
* replay current state first, then live updates.
|
|
410
|
+
*/
|
|
411
|
+
watch(providerThreadId: string, sink: ThreadSink): () => void;
|
|
412
|
+
dispose(): Promise<void>;
|
|
413
|
+
}
|
|
414
|
+
interface CreateThreadInput {
|
|
415
|
+
title: string;
|
|
416
|
+
text: string;
|
|
417
|
+
attachments: ImageAttachment[];
|
|
418
|
+
/** A `ProviderModel.id` the user picked; the provider's default when absent or unknown. */
|
|
419
|
+
model?: string;
|
|
420
|
+
}
|
|
421
|
+
interface ProviderModels {
|
|
422
|
+
models: ProviderModel[];
|
|
423
|
+
/** `ProviderModel.id` new threads use when none is picked. */
|
|
424
|
+
defaultModel?: string;
|
|
425
|
+
}
|
|
426
|
+
interface CreatedThread {
|
|
427
|
+
providerThreadId: string;
|
|
428
|
+
url?: string;
|
|
429
|
+
}
|
|
430
|
+
interface SendMessageInput {
|
|
431
|
+
providerThreadId: string;
|
|
432
|
+
text: string;
|
|
433
|
+
attachments: ImageAttachment[];
|
|
434
|
+
}
|
|
435
|
+
interface ProviderMessage {
|
|
436
|
+
id: string;
|
|
437
|
+
role: MessageRole;
|
|
438
|
+
text: string;
|
|
439
|
+
streaming: boolean;
|
|
440
|
+
createdAt: string;
|
|
441
|
+
}
|
|
442
|
+
interface ThreadSink {
|
|
443
|
+
/** Upsert by `id`; `text` is cumulative. */
|
|
444
|
+
message(message: ProviderMessage): void;
|
|
445
|
+
status(status: Exclude<ThreadStatus, 'starting' | 'draft'>, detail?: string): void;
|
|
446
|
+
/** Provider no longer has this thread (deleted/archived on its side). */
|
|
447
|
+
gone(): void;
|
|
448
|
+
/** Tencil Cloud: where the run's commit is (pushed, deploying, live, …). */
|
|
449
|
+
delivery?(delivery: Delivery): void;
|
|
450
|
+
/** A step of the current turn (sandbox, clone, a tool call…); upsert by `id`. */
|
|
451
|
+
step?(step: ThreadStep): void;
|
|
452
|
+
}
|
|
453
|
+
//#endregion
|
|
454
|
+
export { Thread as a, Viewer as i, ProviderOption as n, ElementContext as o, ServerMessage as r, Provider as t };
|