tencil 0.8.0 → 0.9.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/README.md +23 -5
- package/dist/cli.mjs +33 -5
- package/dist/{cloud-DPNrsIER.d.mts → cloud-dXtv3DCr.d.mts} +1 -1
- package/dist/{index-C4SmNUQW.d.mts → index-CexSk5_J.d.mts} +7 -0
- package/dist/index.d.mts +26 -5
- package/dist/index.mjs +1 -1
- package/dist/next.d.mts +1 -1
- package/dist/overlay.global.js +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/{server-Cbvie3Om.mjs → server-4YposP38.mjs} +920 -60
- package/dist/vite.d.mts +1 -1
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -22,15 +22,17 @@ Think Vercel Comments, except the reviewer on the other side is an agent.
|
|
|
22
22
|
└─────────────┘
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Tencil works with
|
|
25
|
+
Tencil works with three agents. With **T3 Code**, every pin is a real T3 Code thread
|
|
26
26
|
in the project that matches your dev site's folder, so you can continue any
|
|
27
27
|
conversation there. With **Claude Code**, the daemon runs Claude Code itself and
|
|
28
|
-
every pin is a Claude Code session you can resume in a terminal.
|
|
28
|
+
every pin is a Claude Code session you can resume in a terminal. With **Ensemble**,
|
|
29
|
+
every pin is a chat on the Ensemble thread serving your page.
|
|
29
30
|
|
|
30
31
|
## Quick start
|
|
31
32
|
|
|
32
|
-
You need [T3 Code](https://github.com/pingdotgg/t3code) (the desktop app, running)
|
|
33
|
-
[Claude Code](https://docs.claude.com/en/docs/claude-code) (installed and logged in)
|
|
33
|
+
You need [T3 Code](https://github.com/pingdotgg/t3code) (the desktop app, running),
|
|
34
|
+
[Claude Code](https://docs.claude.com/en/docs/claude-code) (installed and logged in) or
|
|
35
|
+
[Ensemble](https://tryensemble.co) (the desktop app, running).
|
|
34
36
|
|
|
35
37
|
```sh
|
|
36
38
|
cd your-app
|
|
@@ -121,6 +123,22 @@ repository root. Each pin is a Claude Code session you can also pick up in a
|
|
|
121
123
|
terminal with `claude --resume <id>`. The first time, Tencil installs the Claude
|
|
122
124
|
Agent SDK into its config folder (it brings Claude Code along, about 250 MB).
|
|
123
125
|
|
|
126
|
+
### Ensemble
|
|
127
|
+
|
|
128
|
+
With `--provider ensemble` (or Ensemble picked in a project's settings), keep the
|
|
129
|
+
[Ensemble](https://tryensemble.co) app running. Pair from the overlay or during
|
|
130
|
+
setup and allow “Tencil” once in Ensemble. Tencil stores the token privately;
|
|
131
|
+
if you remove Tencil in Ensemble › Settings › Ensemble API, pair again.
|
|
132
|
+
|
|
133
|
+
Tencil uses the page's dev server port to find its Ensemble thread, including ports
|
|
134
|
+
forwarded from another machine. Each pin creates a separate chat on that thread's
|
|
135
|
+
checkout, so changes reload in the page. A dev server you run yourself, from a folder
|
|
136
|
+
of an Ensemble project (or a worktree of its repository), starts a new Ensemble
|
|
137
|
+
thread per pin instead; that thread works on its own branch, so its changes don't
|
|
138
|
+
reach your page until you merge them. Resolving or deleting the pin archives that
|
|
139
|
+
thread, and reopening the pin or replying to it brings it back. Threads you started
|
|
140
|
+
yourself stay open, and so does one you've added a chat to. If the folder isn't in Ensemble, the overlay names the repository to add.
|
|
141
|
+
|
|
124
142
|
Nobody is at a terminal to approve tool calls, so `--runtime-mode` decides up front:
|
|
125
143
|
`full-access` (the default) lets Claude Code run anything; with the stricter modes,
|
|
126
144
|
tools that would need approval are refused and Claude Code is told why. A turn that
|
|
@@ -159,7 +177,7 @@ tencil service uninstall Remove the login service
|
|
|
159
177
|
tencil connect [pairing-link] Pair with T3 Code (automatic for a local T3 Code)
|
|
160
178
|
|
|
161
179
|
--port <n> Port (default 4747, env TENCIL_PORT)
|
|
162
|
-
--provider <name> Agent for projects without their own: t3code (default) | claude-code
|
|
180
|
+
--provider <name> Agent for projects without their own: t3code (default) | claude-code | ensemble
|
|
163
181
|
--t3-url <url> T3 Code server (default: last paired, then http://127.0.0.1:3773)
|
|
164
182
|
--model <model> T3 Code: instance:model, e.g. claudeAgent:claude-fable-5-1
|
|
165
183
|
Claude Code: a model, e.g. claude-opus-5-5 (default: its default)
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as withoutNpmEnv, D as createLocalPairingCode, E as DEFAULT_T3_URL, O as exchangePairingCredential, S as defaultDataDir, T as CredentialStore, _ as detectAgents, a as readPlan, b as savedProvider, c as runtimeDir, d as uninstallService, f as startInBackground, g as PROVIDERS, h as updateNotice, i as finishUpdate, j as loadAgentSdk, k as parsePairingInput, l as isServiceInstalled, m as isNewerThanThis, n as probeDaemon, o as enableAutostart, p as stopDaemon, r as startDaemon, s as ensureDaemon, t as DEFAULT_PORT, u as stopService, v as providerLabel, w as VERSION, y as saveProvider } from "./server-
|
|
2
|
+
import { A as withoutNpmEnv, D as createLocalPairingCode, E as DEFAULT_T3_URL, F as EnsembleClient, O as exchangePairingCredential, P as EnsembleCredentialStore, S as defaultDataDir, T as CredentialStore, _ as detectAgents, a as readPlan, b as savedProvider, c as runtimeDir, d as uninstallService, f as startInBackground, g as PROVIDERS, h as updateNotice, i as finishUpdate, j as loadAgentSdk, k as parsePairingInput, l as isServiceInstalled, m as isNewerThanThis, n as probeDaemon, o as enableAutostart, p as stopDaemon, r as startDaemon, s as ensureDaemon, t as DEFAULT_PORT, u as stopService, v as providerLabel, w as VERSION, y as saveProvider } from "./server-4YposP38.mjs";
|
|
3
3
|
import { t as DEFAULT_CLOUD_URL } from "./cloud-CiwIrP1h.mjs";
|
|
4
4
|
import { spawnSync } from "node:child_process";
|
|
5
5
|
import { existsSync, rmSync } from "node:fs";
|
|
@@ -48,14 +48,14 @@ async function chooseProvider(options) {
|
|
|
48
48
|
return provider;
|
|
49
49
|
}
|
|
50
50
|
if (options.yes || !process.stdin.isTTY) return "t3code";
|
|
51
|
-
const provider = await ask(installed
|
|
51
|
+
const provider = await ask(installed, options.log);
|
|
52
52
|
await saveProvider(provider);
|
|
53
53
|
options.log(` ${pc.green("✓")} Pins go to ${providerLabel(provider)}.`);
|
|
54
54
|
hint();
|
|
55
55
|
return provider;
|
|
56
56
|
}
|
|
57
|
-
async function ask(
|
|
58
|
-
log(
|
|
57
|
+
async function ask(installed, log) {
|
|
58
|
+
log(installed.length === 0 ? ` None of ${listOf(PROVIDERS)} was found. Which one will you use?` : ` ${listOf(installed)} are here. Which agent should pins go to?`);
|
|
59
59
|
PROVIDERS.forEach((id, index) => {
|
|
60
60
|
log(` ${pc.cyan(String(index + 1))} ${providerLabel(id)}`);
|
|
61
61
|
});
|
|
@@ -68,11 +68,16 @@ async function ask(noneFound, log) {
|
|
|
68
68
|
const index = Number.parseInt(answer.trim(), 10) - 1;
|
|
69
69
|
return PROVIDERS[index] ?? PROVIDERS[0];
|
|
70
70
|
}
|
|
71
|
+
function listOf(ids) {
|
|
72
|
+
const labels = ids.map(providerLabel);
|
|
73
|
+
return labels.length > 1 ? `${labels.slice(0, -1).join(", ")} and ${labels.at(-1)}` : labels[0] ?? "";
|
|
74
|
+
}
|
|
71
75
|
//#endregion
|
|
72
76
|
//#region src/service/pairing.ts
|
|
73
77
|
/** Get the agent ready now, so the first page load is ready to go. */
|
|
74
78
|
async function prepareProvider(provider, t3Url, log) {
|
|
75
79
|
if (provider === "claude-code") return prepareClaudeCode(log);
|
|
80
|
+
if (provider === "ensemble") return checkEnsemble(log);
|
|
76
81
|
return pairWithLocalT3(t3Url, log);
|
|
77
82
|
}
|
|
78
83
|
/** Pair with the local T3 Code. */
|
|
@@ -107,6 +112,29 @@ async function prepareClaudeCode(log) {
|
|
|
107
112
|
log(` ${pc.yellow("!")} ${error instanceof Error ? error.message : String(error)}`);
|
|
108
113
|
}
|
|
109
114
|
}
|
|
115
|
+
/** Ask the user once to allow Tencil in Ensemble, unless Tencil's token still works. */
|
|
116
|
+
async function checkEnsemble(log) {
|
|
117
|
+
const client = new EnsembleClient();
|
|
118
|
+
if (!await client.isRunning()) {
|
|
119
|
+
log(` ${pc.yellow("!")} Ensemble isn't running. Open the Ensemble app, then press Pair in the overlay.`);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const credentials = new EnsembleCredentialStore();
|
|
123
|
+
const token = await credentials.get(client.baseUrl);
|
|
124
|
+
const allowed = token !== void 0 && await new EnsembleClient({
|
|
125
|
+
baseUrl: client.baseUrl,
|
|
126
|
+
token
|
|
127
|
+
}).threads().then(() => true, () => false);
|
|
128
|
+
try {
|
|
129
|
+
if (!allowed) {
|
|
130
|
+
log(" Allow Tencil in the Ensemble app (one time)…");
|
|
131
|
+
await credentials.set(client.baseUrl, await client.connect());
|
|
132
|
+
}
|
|
133
|
+
log(` ${pc.green("✓")} Connected to Ensemble. Pins go to the Ensemble thread serving each page.`);
|
|
134
|
+
} catch (error) {
|
|
135
|
+
log(` ${pc.yellow("!")} ${error instanceof Error ? error.message : String(error)}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
110
138
|
//#endregion
|
|
111
139
|
//#region src/init/codemods.ts
|
|
112
140
|
function detectStyle(source) {
|
|
@@ -835,7 +863,7 @@ ${pc.dim("Usage")}
|
|
|
835
863
|
|
|
836
864
|
${pc.dim("Daemon options")}
|
|
837
865
|
--port <n> Port (default ${DEFAULT_PORT}, env TENCIL_PORT)
|
|
838
|
-
--provider <name> t3code | claude-code: this machine's agent (setup asks when unset)
|
|
866
|
+
--provider <name> t3code | claude-code | ensemble: this machine's agent (setup asks when unset)
|
|
839
867
|
--t3-url <url> T3 Code server (default ${DEFAULT_T3_URL}, env TENCIL_T3_URL)
|
|
840
868
|
--model <model> T3 Code: instance:model, e.g. claudeAgent:claude-fable-5-1
|
|
841
869
|
Claude Code: a model, e.g. claude-opus-5-5 (default: its default)
|
|
@@ -216,6 +216,7 @@ declare const Thread: z.ZodObject<{
|
|
|
216
216
|
id: z.ZodString;
|
|
217
217
|
threadId: z.ZodOptional<z.ZodString>;
|
|
218
218
|
url: z.ZodOptional<z.ZodString>;
|
|
219
|
+
archivable: z.ZodOptional<z.ZodBoolean>;
|
|
219
220
|
}, z.core.$strip>;
|
|
220
221
|
delivery: z.ZodOptional<z.ZodObject<{
|
|
221
222
|
status: z.ZodEnum<{
|
|
@@ -461,6 +462,10 @@ interface Provider {
|
|
|
461
462
|
createThread(input: CreateThreadInput): Promise<CreatedThread>;
|
|
462
463
|
sendMessage(input: SendMessageInput): Promise<void>;
|
|
463
464
|
interrupt(providerThreadId: string): Promise<void>;
|
|
465
|
+
/** Archive a thread `createThread` marked `archivable`, once its pins are resolved. Optional. */
|
|
466
|
+
archive?(providerThreadId: string): Promise<void>;
|
|
467
|
+
/** Bring an archived thread back, for a pin reopened or replied to. */
|
|
468
|
+
reopen?(providerThreadId: string): Promise<void>;
|
|
464
469
|
/**
|
|
465
470
|
* Stream updates for a thread. Called right after `createThread` and again
|
|
466
471
|
* for every persisted thread when the bridge restarts. The provider should
|
|
@@ -484,6 +489,8 @@ interface ProviderModels {
|
|
|
484
489
|
interface CreatedThread {
|
|
485
490
|
providerThreadId: string;
|
|
486
491
|
url?: string;
|
|
492
|
+
/** The provider started this thread for the pin alone, so resolving the pin may archive it. */
|
|
493
|
+
archivable?: boolean;
|
|
487
494
|
}
|
|
488
495
|
interface SendMessageInput {
|
|
489
496
|
providerThreadId: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Viewer, i as UpdateStatus, n as ProviderOption, o as Thread, r as ServerMessage, s as ElementContext, t as Provider } from "./index-
|
|
1
|
+
import { a as Viewer, i as UpdateStatus, n as ProviderOption, o as Thread, r as ServerMessage, s as ElementContext, t as Provider } from "./index-CexSk5_J.mjs";
|
|
2
2
|
//#region ../bridge/src/project-providers.d.ts
|
|
3
3
|
/** What a project picked in the overlay's settings. */
|
|
4
4
|
interface SavedProjectSettings {
|
|
@@ -131,12 +131,17 @@ export declare function stripContext(text: string): string;
|
|
|
131
131
|
//#region src/daemon/project-resolver.d.ts
|
|
132
132
|
/** Runs a command and returns stdout; injectable so tests don't depend on the OS. */
|
|
133
133
|
type Exec = (command: string, args: string[]) => Promise<string>;
|
|
134
|
+
/** The `ensemble://thread/<id>` root of the Ensemble thread whose dev server listens on `port`. */
|
|
135
|
+
type EnsembleForPort = (port: number) => Promise<string | undefined>;
|
|
134
136
|
/**
|
|
135
137
|
* Works out which project folder a page belongs to:
|
|
136
|
-
* 1.
|
|
138
|
+
* 1. the Ensemble thread whose dev server listens on the port,
|
|
137
139
|
* 2. the repository root the Vite or Next loader sent, if it's a git checkout,
|
|
138
|
-
* 3. the dev server's working directory, found from the port it listens on
|
|
139
|
-
*
|
|
140
|
+
* 3. the dev server's working directory, found from the port it listens on,
|
|
141
|
+
* 4. what the user picked for this address before (a folder or an Ensemble thread).
|
|
142
|
+
* Picks come last: ports get reused (5173 is every Vite app's default), so a pick
|
|
143
|
+
* only stands in for what can't be detected. Returns undefined when nothing works;
|
|
144
|
+
* the overlay then asks.
|
|
140
145
|
*/
|
|
141
146
|
export declare class ProjectResolver {
|
|
142
147
|
#private;
|
|
@@ -144,6 +149,7 @@ export declare class ProjectResolver {
|
|
|
144
149
|
dataDir: string;
|
|
145
150
|
exec?: Exec;
|
|
146
151
|
platform?: NodeJS.Platform;
|
|
152
|
+
ensembleForPort?: EnsembleForPort;
|
|
147
153
|
});
|
|
148
154
|
resolve(pageUrl: string, claimedRoot?: string): Promise<string | undefined>;
|
|
149
155
|
/** Remember the user's choice for an address (from the overlay's project picker). */
|
|
@@ -161,6 +167,16 @@ export declare function projectRoot(folder: string): string;
|
|
|
161
167
|
/** The permission modes that work without anyone at a terminal to answer prompts. */
|
|
162
168
|
type PermissionMode = 'default' | 'acceptEdits' | 'auto' | 'bypassPermissions';
|
|
163
169
|
//#endregion
|
|
170
|
+
//#region ../provider-ensemble/src/auth.d.ts
|
|
171
|
+
/** The tokens Ensemble gave Tencil, per Ensemble URL, readable only by this user. */
|
|
172
|
+
declare class EnsembleCredentialStore {
|
|
173
|
+
#private;
|
|
174
|
+
readonly path: string;
|
|
175
|
+
constructor(path?: string);
|
|
176
|
+
get(baseUrl: string): Promise<string | undefined>;
|
|
177
|
+
set(baseUrl: string, token: string): Promise<void>;
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
164
180
|
//#region ../provider-t3code/src/auth.d.ts
|
|
165
181
|
interface StoredCredential {
|
|
166
182
|
token: string;
|
|
@@ -214,7 +230,7 @@ interface T3CodeProviderOptions {
|
|
|
214
230
|
}
|
|
215
231
|
//#endregion
|
|
216
232
|
//#region src/daemon/agents.d.ts
|
|
217
|
-
declare const PROVIDERS: readonly ["t3code", "claude-code"];
|
|
233
|
+
declare const PROVIDERS: readonly ["t3code", "claude-code", "ensemble"];
|
|
218
234
|
type ProviderName = (typeof PROVIDERS)[number];
|
|
219
235
|
//#endregion
|
|
220
236
|
//#region src/service/self-update.d.ts
|
|
@@ -271,6 +287,11 @@ interface DaemonOptions {
|
|
|
271
287
|
model?: string;
|
|
272
288
|
permissionMode?: PermissionMode;
|
|
273
289
|
};
|
|
290
|
+
/** Ensemble's public local API. */
|
|
291
|
+
ensemble?: {
|
|
292
|
+
url?: string;
|
|
293
|
+
credentials?: EnsembleCredentialStore;
|
|
294
|
+
};
|
|
274
295
|
t3?: Pick<T3CodeProviderOptions, 'autoPair' | 'createPairingCode' | 'timeouts'> & {
|
|
275
296
|
url?: string;
|
|
276
297
|
token?: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as projectStorePath,
|
|
1
|
+
import { C as projectStorePath, I as Bridge, L as renderPrompt, M as ProjectResolver, N as projectRoot, R as stripContext, S as defaultDataDir, n as probeDaemon, r as startDaemon, t as DEFAULT_PORT, x as FileThreadStore } from "./server-4YposP38.mjs";
|
|
2
2
|
export { Bridge, DEFAULT_PORT, ProjectResolver, FileThreadStore as ThreadStore, defaultDataDir, probeDaemon, projectRoot, projectStorePath, renderPrompt, startDaemon, stripContext };
|
package/dist/next.d.mts
CHANGED
package/dist/overlay.global.js
CHANGED
|
@@ -66,7 +66,7 @@ let ui=/^[a-zA-Z][a-zA-Z\d+\-.]*:/,di=[`rsc://`,`file:///`,`webpack-internal://`
|
|
|
66
66
|
`)} {
|
|
67
67
|
${n}
|
|
68
68
|
}
|
|
69
|
-
`}),o.appendChild(r.createTextNode(e))}i.timeEnd(`clone node`),await f?.(h),l!==!1&&Z(h)&&(i.time(`embed web font`),await Al(h,n),i.timeEnd(`embed web font`)),i.time(`embed node`),kl(h,n);let g=a.length,_=0,v=async()=>{for(;;){let e=a.pop();if(!e)break;try{await e}catch(e){n.log.warn(`Failed to run task`,e)}u?.(++_,g)}};u?.(_,g),await Promise.all([...Array.from({length:4})].map(v)),i.timeEnd(`embed node`),await p?.(h);let y=Vl(h,n);return s&&y.insertBefore(s,y.children[0]),o&&y.insertBefore(o,y.children[0]),d&&_l(n),await m?.(y),y}function Vl(e,t){let{width:n,height:r}=t,i=jc(n,r,e.ownerDocument),a=i.ownerDocument.createElementNS(i.namespaceURI,`foreignObject`);return a.setAttributeNS(null,`x`,`0%`),a.setAttributeNS(null,`y`,`0%`),a.setAttributeNS(null,`width`,`100%`),a.setAttributeNS(null,`height`,`100%`),a.append(e),i.appendChild(a),i}async function Hl(e,t){let n=await Uc(e,t),r=await Bl(n),i=Mc(r,n.isEnable(`removeControlCharacter`));return n.autoDestruct||(n.svgStyleElement=Gc(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(Ac,`defs`),n.svgStyles.clear()),await qc(Fc(i,r.ownerDocument),n)}async function Ul(e,t){let n=await Uc(e,t),{log:r,quality:i,type:a,dpi:o}=n,s=await Hl(n);r.time(`canvas to data url`);let c=s.toDataURL(a,i);if([`image/png`,`image/jpeg`].includes(a)&&o&&$s&&ec){let[e,t]=c.split(`,`),n=0,r=!1;if(a===`image/png`){let e=Ys(t);e>=0?(n=Math.ceil((e+28)/3)*4,r=!0):n=44}else a===`image/jpeg`&&(n=24);let i=t.substring(0,n),s=t.substring(n),l=window.atob(i),u=new Uint8Array(l.length);for(let e=0;e<u.length;e++)u[e]=l.charCodeAt(e);let d=a===`image/png`?Js(u,o,r):Us(u,o);c=[e,`,`,window.btoa(String.fromCharCode(...d)),s].join(``)}return r.timeEnd(`canvas to data url`),c}async function Wl(e,t){return Ul(await Uc(e,{...t,type:`image/jpeg`}))}async function Gl(e,t){let n=e.getBoundingClientRect(),r=n.width*n.height<4800&&e.parentElement?e.parentElement:e,i=r.getBoundingClientRect(),a=Math.min(window.devicePixelRatio||1,1600/Math.max(i.width+48,i.height+48,1));try{let e=await Wl(r,{scale:a,quality:.85,backgroundColor:Kl(r),filter:e=>e!==t,timeout:4e3});return e.startsWith(`data:image/jpeg`)?{name:`tencil-element.jpg`,mimeType:`image/jpeg`,dataUrl:e}:null}catch(e){return console.warn(`[tencil] screenshot failed`,e),null}}function Kl(e){let t=e;for(;t;){let e=getComputedStyle(t).backgroundColor;if(e&&e!==`transparent`&&!/rgba\(.*,\s*0\)$/.test(e))return e;t=t.parentElement}return`#ffffff`}var ql=0;Array.isArray;function Q(e,t,r,i,a,o){t||={};var s,c,l=t;if(`ref`in l&&typeof e!=`function`)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ql,__i:-1,__u:0};return(a||o)&&(u.__source=a,u.__self=o),n.vnode&&n.vnode(u),u}let Jl={t3code:{viewBox:`15.5309 37 94.3941 56.96`,path:`M33.4509 93V47.56H15.5309V37H64.3309V47.56H46.4109V93H33.4509ZM86.7253 93.96C82.832 93.96 78.9653 93.4533 75.1253 92.44C71.2853 91.3733 68.032 89.88 65.3653 87.96L70.4053 78.04C72.5386 79.5867 75.0186 80.8133 77.8453 81.72C80.672 82.6267 83.5253 83.08 86.4053 83.08C89.6586 83.08 92.2186 82.44 94.0853 81.16C95.952 79.88 96.8853 78.12 96.8853 75.88C96.8853 73.7467 96.0586 72.0667 94.4053 70.84C92.752 69.6133 90.0853 69 86.4053 69H80.4853V60.44L96.0853 42.76L97.5253 47.4H68.1653V37H107.365V45.4L91.8453 63.08L85.2853 59.32H89.0453C95.9253 59.32 101.125 60.8667 104.645 63.96C108.165 67.0533 109.925 71.0267 109.925 75.88C109.925 79.0267 109.099 81.9867 107.445 84.76C105.792 87.48 103.259 89.6933 99.8453 91.4C96.432 93.1067 92.0586 93.96 86.7253 93.96Z`,className:`agent-mono`,label:`T3 Code`},codex:{viewBox:`0 0 256 260`,path:`M239.184 106.203a64.716 64.716 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.716 64.716 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.665 64.665 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.767 64.767 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483Zm-97.56 136.338a48.397 48.397 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.595 8.595 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601Zm-104.466-44.61a48.345 48.345 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.339 8.339 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803ZM23.549 85.38a48.499 48.499 0 0 1 25.58-21.333v61.39a8.288 8.288 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.819.819 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466 41.695-63.08-36.63L161.73 77.86a.819.819 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.544 8.544 0 0 0-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.716.716 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391v.205ZM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.595 8.595 0 0 0-4.246 7.367l-.051 72.697Zm11.868-25.58 28.138-16.217 28.188 16.218v32.434l-28.086 16.218-28.188-16.218-.052-32.434Z`,className:`agent-mono`,label:`Codex`},claudeAgent:{viewBox:`0 0 256 257`,path:`m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z`,className:`agent-claude`,label:`Claude`},cursor:{viewBox:`0 0 466.73 532.09`,path:`M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z`,className:`agent-mono`,label:`Cursor`}};function Yl(e){if(Jl[e])return Jl[e];let t=e.toLowerCase();if(t.includes(`claude`))return Jl.claudeAgent;if(t.includes(`codex`)||t.includes(`openai`))return Jl.codex;if(t.includes(`cursor`))return Jl.cursor}function Xl({agent:e,size:t=13,decorative:n=!1}){if(!e)return null;let r=Yl(e);return r?/* @__PURE__ */ Q(`svg`,{class:`agent-icon ${r.className}`,width:t,height:t,viewBox:r.viewBox,role:n?void 0:`img`,"aria-label":n?void 0:r.label,"aria-hidden":n?`true`:void 0,children:/* @__PURE__ */ Q(`path`,{d:r.path})}):null}function $({children:e,size:t=16}){return/* @__PURE__ */ Q(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:e})}let Zl=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`}),/* @__PURE__ */ Q(`path`,{d:`M12 8v8M8 12h8`})]}),Ql=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M22 12h-6l-2 3h-4l-2-3H2`}),/* @__PURE__ */ Q(`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`})]}),$l=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M10.7 5.1A10.8 10.8 0 0 1 12 5c7 0 10 7 10 7a13.2 13.2 0 0 1-1.7 2.7`}),/* @__PURE__ */ Q(`path`,{d:`M6.6 6.6A13.5 13.5 0 0 0 2 12s3 7 10 7a9.7 9.7 0 0 0 5.4-1.6`}),/* @__PURE__ */ Q(`path`,{d:`M9.9 9.9a3 3 0 1 0 4.2 4.2M2 2l20 20`})]}),eu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),tu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`m5 12 7-7 7 7M12 19V5`})}),nu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`rect`,{x:`5`,y:`5`,width:`14`,height:`14`,rx:`2`,fill:`currentColor`})}),ru=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M20 6 9 17l-5-5`})}),iu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M9 14 4 9l5-5`}),/* @__PURE__ */ Q(`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 0 11H11`})]}),au=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})}),ou=()=>/* @__PURE__ */ Q($,{size:14,children:/* @__PURE__ */ Q(`path`,{d:`M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`})}),su=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M18 6 6 18M6 6l12 12`})}),cu=()=>/* @__PURE__ */ Q($,{size:14,children:[/* @__PURE__ */ Q(`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`13`,r:`3`})]}),lu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`path`,{d:`m16 18 6-6-6-6M8 6l-6 6 6 6`})}),uu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),du=({size:e=16})=>/* @__PURE__ */ Q(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,class:`tencil-logo`,children:[/* @__PURE__ */ Q(`path`,{d:`M3 21V9a6 6 0 0 1 6-6h6a6 6 0 0 1 6 6v6a6 6 0 0 1-6 6Z`,fill:`#3b8dff`}),/* @__PURE__ */ Q(`path`,{d:`M9.25 7.5 16.5 12.6l-3.55.75-1.75 3.4Z`,fill:`#fff`,stroke:`#fff`,"stroke-linejoin":`round`})]}),fu=()=>/* @__PURE__ */ Q($,{size:14,children:[/* @__PURE__ */ Q(`path`,{d:`m12 2 10 5-10 5L2 7Z`}),/* @__PURE__ */ Q(`path`,{d:`m2 17 10 5 10-5M2 12l10 5 10-5`})]}),pu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ Q(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4`})]}),mu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ Q(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4M3 3l18 18`})]}),hu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`path`,{d:`m6 9 6 6 6-6`})}),gu=F(()=>{let e=/* @__PURE__ */ new Map,t=[...jn.value].reverse().filter(e=>e.anchor);for(let[n,r]of t.entries())e.set(r.id,n+1);return e});function _u(){let e=Pn.value.flatMap(e=>{let t=gu.value.get(e.id);return t?[{threadId:e.id,number:t}]:[]});e.length!==0&&H({type:`drafts.send`,drafts:e})&&(q.value=e[0]?.threadId??null)}function vu(){let e=yu();if(hn.value)return null;let t=K.value;return/* @__PURE__ */ Q(S,{children:[Mn.value.map(e=>/* @__PURE__ */ Q(xu,{thread:e},e.id)),e.map(e=>/* @__PURE__ */ Q(bu,{pin:e},`leaving:${e.thread.id}`)),t&&/* @__PURE__ */ Q(Ou,{})]})}function yu(){let e=Mn.value,t=kn.value,n=j({page:t,pins:[]}),[r,i]=A([]);return Ne(()=>{let r=n.current;n.current={page:t,pins:e.map(e=>({thread:e,number:gu.value.get(e.id),variant:ku(e),resolved:!1}))};let a=new Set(e.map(e=>e.id)),o=r.page===t?r.pins.filter(e=>!a.has(e.thread.id)).map(e=>({...e,resolved:B.value.get(e.thread.id)?.resolved===!0})):[];i(e=>{let t=e.filter(e=>!a.has(e.thread.id)&&!o.some(t=>t.thread.id===e.thread.id));return t.length===e.length&&o.length===0?e:[...t,...o]});for(let e of o)setTimeout(()=>i(t=>t.filter(t=>t!==e)),1e3)},[e,t]),r}function bu({pin:e}){On.value;let t=e.thread.anchor?Rs(e.thread.anchor):null;return t?/* @__PURE__ */ Q(`div`,{class:`pin pin-${e.variant} pin-leaving${e.resolved?` pin-resolving`:``}`,style:{transform:`translate(${t.x}px, ${t.y}px)`},"aria-hidden":`true`,children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:[/* @__PURE__ */ Q(`span`,{class:`pin-glyph`,children:e.number??`•`}),e.resolved&&/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`span`,{class:`pin-glyph pin-check`,children:/* @__PURE__ */ Q(ru,{})}),/* @__PURE__ */ Q(`span`,{class:`pin-shine`})]})]})}):null}function xu({thread:e}){if(On.value,!e.anchor)return null;let t=Dn.value,n=t?.threadId===e.id,r=n?t.point:Rs(e.anchor);if(!r)return null;let i=q.value===e.id;return/* @__PURE__ */ Q(`button`,{type:`button`,class:`pin pin-${ku(e)}${i?` pin-open`:``}${n?` pin-dragging`:``}`,style:{transform:`translate(${r.x}px, ${r.y}px)`},title:e.title,onPointerDown:t=>Cu(t,e,r),onClick:()=>{if(Su===e.id){Su=null;return}K.value=null,q.value=i?null:e.id},children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:gu.value.get(e.id)??`•`})})}let Su=null;function Cu(e,t,n){if(e.button!==0)return;e.preventDefault();let r=e.currentTarget;try{r.setPointerCapture(e.pointerId)}catch{}Su=null;let i=e.clientX,a=e.clientY,o=e=>{let r=e.clientX-i,o=e.clientY-a;!Dn.value&&Math.hypot(r,o)<4||(Dn.value={threadId:t.id,point:wu({x:n.x+r,y:n.y+o})})},s=e=>{r.removeEventListener(`pointermove`,o),r.removeEventListener(`pointerup`,s),r.removeEventListener(`pointercancel`,s),r.removeEventListener(`lostpointercapture`,s),window.removeEventListener(`dragstart`,Tu,!0);let n=Dn.value;n&&(Dn.value=null,Su=t.id,e.type===`pointerup`&&Eu(t,n.point))};r.addEventListener(`pointermove`,o),r.addEventListener(`pointerup`,s),r.addEventListener(`pointercancel`,s),r.addEventListener(`lostpointercapture`,s),window.addEventListener(`dragstart`,Tu,!0)}function wu(e){let{clientWidth:t,clientHeight:n}=document.documentElement;return{x:Math.max(0,Math.min(e.x,t-1)),y:Math.max(0,Math.min(e.y,n-1))}}function Tu(e){e.preventDefault()}function Eu(e,t){let n=Du(t);if(!n)return;let r={selector:ps(n),...zs(n,t)};H({type:`thread.move`,threadId:e.id,anchor:r})&&an({...e,anchor:r})}function Du(e){let t=Is();return document.elementsFromPoint(e.x,e.y).find(e=>e!==t&&e!==document.documentElement)??document.body}function Ou(){On.value;let e=K.value,t=Rs(e.anchor,e.element);return t?/* @__PURE__ */ Q(`div`,{class:`pin pin-draft pin-open`,style:{transform:`translate(${t.x}px, ${t.y}px)`},children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:`+`})}):null}function ku(e){if(e.resolved)return`resolved`;let t=e.delivery?.status;if(t&&(e.status===`idle`||e.status===`error`))return t===`queued`||t===`deploying`?`working`:t===`failed`||t===`deploy-failed`?`error`:`done`;switch(e.status){case`draft`:return`queued`;case`starting`:case`working`:return`working`;case`waiting`:return`waiting`;case`error`:return`error`;default:return`done`}}let Au=`tencil:open`;function ju(){let[e,t]=A(`page`),n=R.value?.label??`Agent`,r=L.value===`open`&&R.value?.state===`ready`,i=R.value?.id;return Me(()=>{r&&J.value&&e===`provider`&&ln()},[e,J.value,r,i]),J.value?/* @__PURE__ */ Q(`aside`,{class:`inbox`,children:[/* @__PURE__ */ Q(`header`,{class:`inbox-header`,children:[/* @__PURE__ */ Q(`div`,{class:`segmented`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`page`?`active`:``,onClick:()=>t(`page`),children:`This page`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`all`?`active`:``,onClick:()=>t(`all`),children:`All pins`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`provider`?`active`:``,onClick:()=>t(`provider`),children:n})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Close`,onClick:()=>{J.value=!1},children:/* @__PURE__ */ Q(su,{})})]}),e===`provider`?/* @__PURE__ */ Q(Nu,{label:n}):/* @__PURE__ */ Q(Mu,{scope:e})]}):null}function Mu({scope:e}){let t=jn.value.filter(e=>mn.value||!e.resolved).filter(t=>e===`all`||t.anchor&&t.pageUrl&&An(t.pageUrl)===kn.value);return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`label`,{class:`inbox-filter`,children:[/* @__PURE__ */ Q(`span`,{class:`checkbox`,children:[/* @__PURE__ */ Q(`input`,{type:`checkbox`,class:`checkbox-input`,checked:mn.value,onChange:e=>{mn.value=e.target.checked}}),/* @__PURE__ */ Q(ru,{})]}),`Show resolved`]}),/* @__PURE__ */ Q(`div`,{class:`inbox-list`,children:t.length===0?/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`No pins yet. Press `,/* @__PURE__ */ Q(`kbd`,{children:`C`}),` and click anything on the page.`]}):t.map(e=>/* @__PURE__ */ Q(Iu,{thread:e},e.id))})]})}function Nu({label:e}){let t=Ht.value;return t?t.length===0?/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`No `,e,` threads in this project yet.`]}):/* @__PURE__ */ Q(`div`,{class:`inbox-list inbox-list-provider`,children:t.map(e=>/* @__PURE__ */ Q(Pu,{summary:e},e.id))}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`Loading `,e,` threads…`]})}function Pu({summary:e}){let t=Ut.value,n=[...B.value.values()].filter(t=>t.provider.threadId===e.id&&t.anchor).length;return/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-item provider-item`,onClick:()=>{let t=dn(e);t&&(q.value=t)},children:[/* @__PURE__ */ Q(`span`,{class:`provider-item-project`,children:[t&&/* @__PURE__ */ Q(Fu,{project:t}),/* @__PURE__ */ Q(`span`,{class:`provider-item-project-name`,children:t?.name}),e.status===`working`||e.status===`waiting`?/* @__PURE__ */ Q(`span`,{class:`provider-item-state state-${e.status}`,children:zu(e.status)}):e.background===`monitoring`?/* @__PURE__ */ Q(`span`,{class:`provider-item-state state-monitoring`,children:`Monitoring`}):/* @__PURE__ */ Q(`span`,{class:`provider-item-time`,children:Bu(e.updatedAt)})]}),/* @__PURE__ */ Q(`span`,{class:`provider-item-title`,children:e.title}),(e.branch||e.pullRequest||e.agent||n>0)&&/* @__PURE__ */ Q(`span`,{class:`provider-item-meta`,children:[e.branch&&/* @__PURE__ */ Q(`span`,{class:`provider-item-branch`,children:e.branch}),e.pullRequest&&/* @__PURE__ */ Q(`span`,{class:`provider-item-pr`,children:[`#`,e.pullRequest.number]}),n>0&&/* @__PURE__ */ Q(`span`,{class:`provider-item-pins`,children:[n,` pin`,n===1?``:`s`]}),/* @__PURE__ */ Q(Xl,{agent:e.agent})]})]})}function Fu({project:e}){return e.emoji?/* @__PURE__ */ Q(`span`,{class:`project-icon project-icon-emoji`,children:e.emoji}):e.iconUrl?/* @__PURE__ */ Q(`img`,{class:`project-icon`,src:e.iconUrl,alt:``}):/* @__PURE__ */ Q(`span`,{class:`project-icon project-icon-letter`,children:e.name.slice(0,1)})}function Iu({thread:e}){let t=!!(e.anchor&&e.pageUrl),n=!t||An(e.pageUrl)===kn.value,r=[...e.messages].reverse().find(e=>e.role===`assistant`);return/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-item${q.value===e.id?` active`:``}`,onClick:()=>{if(!n){sessionStorage.setItem(Au,e.id),location.href=e.pageUrl;return}q.value=e.id,Lu(e)},children:[t?/* @__PURE__ */ Q(`span`,{class:`pin pin-static pin-${ku(e)}`,children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:gu.value.get(e.id)})}):/* @__PURE__ */ Q(`span`,{class:`thread-dot thread-dot-${e.status}`}),/* @__PURE__ */ Q(`span`,{class:`inbox-item-body`,children:[/* @__PURE__ */ Q(`span`,{class:`inbox-item-title`,children:e.title}),/* @__PURE__ */ Q(`span`,{class:`inbox-item-meta`,children:[!t&&/* @__PURE__ */ Q(`span`,{children:`Not pinned · `}),t&&!n&&/* @__PURE__ */ Q(`span`,{children:[new URL(e.pageUrl).pathname,` · `]}),Ru(e),` · `,Bu(e.updatedAt)]}),r&&/* @__PURE__ */ Q(`span`,{class:`inbox-item-preview`,children:r.text.slice(0,140)})]})]})}function Lu(e){if(e.anchor)try{document.querySelector(e.anchor.selector)?.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}}function Ru(e){if(e.resolved)return`Resolved`;switch(e.status){case`draft`:return`Queued`;case`starting`:return`Starting`;case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Done`}}function zu(e){switch(e){case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Idle`}}function Bu(e){let t=Math.max(0,(Date.now()-Date.parse(e))/1e3);return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Vu({placeholder:e,initialText:t=``,autoFocus:n,disabled:r,busy:i,onSubmit:a,onCancel:o,children:s}){let[c,l]=A(t),u=j(null);Me(()=>{n&&u.current?.focus({preventScroll:!0})},[n]),Me(()=>{let e=u.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[c]);let d=c.trim().length>0&&!r&&!i,f=async()=>{d&&(await a(c.trim()),l(``))};return/* @__PURE__ */ Q(`div`,{class:`prompt-input`,children:[/* @__PURE__ */ Q(`textarea`,{ref:u,rows:1,value:c,placeholder:e,disabled:r,onInput:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&!e.shiftKey&&!e.isComposing?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),o?.())}}),/* @__PURE__ */ Q(`div`,{class:`prompt-actions`,children:[/* @__PURE__ */ Q(`div`,{class:`prompt-extras`,children:s}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`send`,disabled:!d,onClick:()=>void f(),"aria-label":`Send`,title:`Send (Enter)`,children:i?/* @__PURE__ */ Q(`span`,{class:`spinner`}):/* @__PURE__ */ Q(tu,{})})]})]})}let Hu=P(null);function Uu(){On.value;let e=K.value,t=j(null),[n,r]=A(140),[i,a]=A(!1),[o,s]=A(!1),[c,l]=A(null),u=R.value?.state===`ready`,d=R.value?.id;if(Me(()=>{e&&u&&(ln(),un())},[e,u,d]),Me(()=>{Hu.value=null},[d]),Ne(()=>{t.current&&r(t.current.offsetHeight)}),!e)return null;let f=Rs(e.anchor,e.element);if(!f)return null;let{left:p,top:m,origin:h}=Vs(f,{width:340,height:n}),g=R.value,_=g?.state===`ready`,v=vn.value,y=v?null:Hu.value,b=y?void 0:Ju(g?.id);return/* @__PURE__ */ Q(`div`,{ref:t,class:`popover composer`,style:{left:`${p}px`,top:`${m}px`,width:`340px`,transformOrigin:h},children:[/* @__PURE__ */ Q(`div`,{class:`composer-target`,children:[/* @__PURE__ */ Q(`span`,{class:`chip`,children:[/* @__PURE__ */ Q(lu,{}),e.label]}),g&&v&&/* @__PURE__ */ Q(`span`,{class:`composer-provider composer-batch`,children:[`→ Batch · `,Pn.value.length,` queued`]}),g&&!v&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`composer-provider${c===`target`?` open`:``}`,onClick:()=>l(c===`target`?null:`target`),title:`Send to a new thread or continue an existing one`,children:[/* @__PURE__ */ Q(`span`,{class:`composer-provider-label`,children:[`→ `,y?y.title:`New ${g.label} thread`]}),/* @__PURE__ */ Q(hu,{})]})]}),e.measuredTo&&Cn.value&&/* @__PURE__ */ Q(Gu,{pending:e}),c===`target`&&!v&&/* @__PURE__ */ Q(Xu,{onPick:e=>{Hu.value=e,l(null)}}),c===`model`&&b&&/* @__PURE__ */ Q(Yu,{choices:b,onPick:e=>{H({type:`model.select`,model:e}),l(null)}}),/* @__PURE__ */ Q(Vu,{placeholder:v?`Add a comment to the batch…`:_?y?`Continue the thread with this element…`:`What should change here?`:`Waiting for the agent connection…`,autoFocus:!0,busy:o,disabled:!_&&!v,onSubmit:async t=>{s(!0);try{let n=qu(await e.context,e),r=[];if(i){let t=await Gl(e.element,Is());t&&r.push(t)}let a=Lt(),o={...e.anchor,selector:n.selector};if(!H({type:`thread.create`,id:a,pageUrl:location.href,prompt:t,anchor:o,context:n,attachments:r,...y?{providerThreadId:y.id}:{},...v?{draft:!0}:{}}))return;let s=(/* @__PURE__ */ new Date()).toISOString();an({id:a,title:t,pageUrl:location.href,anchor:o,context:n,status:v?`draft`:y?`working`:`starting`,resolved:!1,messages:[{id:`local:${a}`,role:`user`,text:t,streaming:!1,createdAt:s}],provider:{id:g?.id??`unknown`,...y?{threadId:y.id,url:y.url}:{}},createdAt:s,updatedAt:s}),K.value=null,v?In():q.value=a}finally{s(!1)}},onCancel:()=>{K.value=null},children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle${i?` toggle-on`:``}`,onClick:()=>a(!i),title:i?`Screenshot attached`:`No screenshot`,"aria-pressed":i,children:/* @__PURE__ */ Q(cu,{})}),gn.value&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle${v?` toggle-on`:``}`,onClick:()=>{_n.value=!v,l(null)},title:v?`Batch on: comments are queued and sent together`:`Queue comments and send them together`,"aria-label":`Batch`,"aria-pressed":v,children:/* @__PURE__ */ Q(fu,{})}),b&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle model-toggle${c===`model`?` open`:``}`,onClick:()=>l(c===`model`?null:`model`),title:`Agent and model for the new thread`,children:[/* @__PURE__ */ Q(Xl,{agent:b.current?.agent,size:12}),/* @__PURE__ */ Q(`span`,{class:`model-toggle-label`,children:b.current?.label??`Default model`}),/* @__PURE__ */ Q(hu,{})]})]}),!_&&g?.detail&&/* @__PURE__ */ Q(`p`,{class:`hint`,children:g.detail})]})}let Wu={top:`above`,right:`right`,bottom:`below`,left:`left`};function Gu({pending:e}){let t=e.measuredTo,n=Ku(e),r=[`top`,`right`,`bottom`,`left`].filter(e=>n?.[e]!==void 0).map(e=>`${n[e]} ${Wu[e]}`);return/* @__PURE__ */ Q(`div`,{class:`composer-measure`,children:[/* @__PURE__ */ Q(`span`,{class:`composer-measure-label`,title:`Spacing to ${t.label}: ${r.join(`, `)||`none`}`,children:[`↔ `,t.parent?`Parent `:``,/* @__PURE__ */ Q(`span`,{class:`composer-measure-target`,children:t.label}),r.length>0&&` · ${r.join(`, `)}`]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Don't send the spacing`,"aria-label":`Remove spacing`,onClick:()=>{K.value&&={...K.value,measuredTo:void 0}},children:/* @__PURE__ */ Q(su,{})})]})}function Ku(e){let t=e.measuredTo;return!t||!Cn.value||!e.element.isConnected||!t.element.isConnected?void 0:$o(Qo(Xo(e.element.getBoundingClientRect()),Xo(t.element.getBoundingClientRect())),{to:t.label,selector:ps(t.element),...t.parent?{parent:!0}:{}})}function qu(e,t){let n=Ku(t);return n?{...e,spacing:n}:e}function Ju(e){let t=Wt.value;if(!t||t.provider!==e||t.models.length===0)return;let n=e=>t.models.find(t=>t.id===e),r=n(z.value?.model),i=n(t.defaultModel);return{models:t.models,current:r??i,picked:r?.id??null,fallback:i}}function Yu({choices:e,onPick:t}){let n=/* @__PURE__ */ new Map;for(let t of e.models)n.set(t.group,[...n.get(t.group)??[],t]);return/* @__PURE__ */ Q(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===null,class:`target-option${e.picked===null?` selected`:``}`,onClick:()=>t(null),children:[/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:`Default`}),e.fallback&&/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:e.fallback.label})]}),[...n].map(([n,r])=>/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`p`,{class:`menu-group`,children:[/* @__PURE__ */ Q(Xl,{agent:r[0]?.agent,size:11}),n]}),r.map(n=>/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===n.id,class:`target-option${e.picked===n.id?` selected`:``}`,onClick:()=>t(n.id),children:/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:n.label})},n.id))]},n))]})}function Xu({onPick:e}){let t=Ht.value,n=Hu.value?.id??null;return/* @__PURE__ */ Q(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":n===null,class:`target-option${n===null?` selected`:``}`,onClick:()=>e(null),children:/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:`New thread`})}),t===null&&/* @__PURE__ */ Q(`p`,{class:`target-empty`,children:`Loading threads…`}),t?.map(t=>/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":n===t.id,class:`target-option${n===t.id?` selected`:``}`,onClick:()=>e(t),children:[/* @__PURE__ */ Q(`span`,{class:`thread-dot thread-dot-${t.status}`}),/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:t.title}),/* @__PURE__ */ Q(Xl,{agent:t.agent,size:12}),/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:Bu(t.updatedAt)})]},t.id))]})}function Zu(){On.value;let e=fn.value;if(!e)return null;let t=U.value===`picking`,n=!t&&!K.value&&Cn.value&&W.value&&!G.value;if(!t&&!n)return null;let r=Xo(e.getBoundingClientRect());return/* @__PURE__ */ Q(S,{children:[Cn.value&&(n||!W.value)&&/* @__PURE__ */ Q($u,{element:e,box:r}),/* @__PURE__ */ Q(`div`,{class:`highlight`,style:id(r)}),/* @__PURE__ */ Q(Qu,{element:e,box:r})]})}function Qu({element:e,box:t}){let n=t.top<28;return/* @__PURE__ */ Q(`div`,{class:`highlight-label`,style:{transform:`translate(${Math.max(4,t.left)}px, ${n?t.bottom+6:t.top-26}px)`},children:[fs(e),/* @__PURE__ */ Q(`span`,{class:`highlight-size`,children:[Zo(t.right-t.left),`×`,Zo(t.bottom-t.top)]})]})}function $u({element:e,box:t}){let n=rs(e),r=[...ed(e,t,n),...td(e,t,n),...rd(e,t,n)];return/* @__PURE__ */ Q(S,{children:[r.map((e,t)=>/* @__PURE__ */ Q(`div`,{class:`band band-${e.kind}`,style:id(e.box)},`band-${t}`)),r.filter(e=>e.labelled).map((e,t)=>/* @__PURE__ */ Q(`span`,{class:`band-value band-value-${e.kind}`,style:{transform:ad(e.box)},children:[e.value,e.utility&&/* @__PURE__ */ Q(`span`,{class:`band-utility`,children:e.utility})]},`value-${t}`))]})}function ed(e,t,{margin:n}){let[r,i,a,o]=n.map(e=>Math.max(0,e)),s={left:t.left-o,top:t.top-r,right:t.right+i,bottom:t.bottom+a};return nd(e,`margin`,[[`top`,r,{...s,bottom:t.top}],[`right`,i,{left:t.right,right:s.right,top:t.top,bottom:t.bottom}],[`bottom`,a,{...s,top:t.bottom}],[`left`,o,{left:s.left,right:t.left,top:t.top,bottom:t.bottom}]])}function td(e,t,{padding:n,border:r}){let[i,a,o,s]=n,c={left:t.left+r[3],top:t.top+r[0],right:t.right-r[1],bottom:t.bottom-r[2]},l={top:c.top+i,bottom:c.bottom-o};return nd(e,`padding`,[[`top`,i,{...c,bottom:l.top}],[`right`,a,{...l,left:c.right-a,right:c.right}],[`bottom`,o,{...c,top:l.bottom}],[`left`,s,{...l,left:c.left,right:c.left+s}]])}function nd(e,t,n){return n.filter(([,e,t])=>e>0&&t.right>t.left&&t.bottom>t.top).map(([n,r,i])=>({kind:t,box:i,value:r,labelled:!0,utility:cs(e,t,n,r)}))}function rd(e,t,{gap:n,padding:r,border:i}){if(!n)return[];let a={left:t.left+i[3]+r[3],top:t.top+i[0]+r[0],right:t.right-i[1]-r[1],bottom:t.bottom-i[2]-r[2]},o=/* @__PURE__ */ new Set;return is(e,n,a).map(t=>{let{axis:r,...i}=t,a=!o.has(r);return o.add(r),{kind:`gap`,box:i,value:n[r],labelled:a,utility:a?cs(e,`gap`,r,n[r]):void 0}})}function id(e){return{transform:`translate(${e.left}px, ${e.top}px)`,width:`${e.right-e.left}px`,height:`${e.bottom-e.top}px`}}function ad(e){return`translate(${(e.left+e.right)/2}px, ${(e.top+e.bottom)/2}px) translate(-50%, -50%)`}function od(){if(On.value,!Cn.value)return null;let e=U.value===`idle`&&!K.value?G.value?.element:void 0,t=cd(e),n=e?.isConnected?Xo(e.getBoundingClientRect()):null;return/* @__PURE__ */ Q(S,{children:[e&&n&&/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`measure-box`,style:id(n)}),/* @__PURE__ */ Q(Qu,{element:e,box:n})]}),t&&/* @__PURE__ */ Q(sd,{pair:t})]})}function sd({pair:[e,t]}){if(!e.isConnected||!t.isConnected)return null;let n=Xo(e.getBoundingClientRect()),r=Xo(t.getBoundingClientRect()),i=K.value;return/* @__PURE__ */ Q(S,{children:[i?.element===e&&/* @__PURE__ */ Q(`div`,{class:`measure-box`,style:id(n)}),/* @__PURE__ */ Q(`div`,{class:`measure-target`,style:id(r)}),Qo(n,r).map(e=>/* @__PURE__ */ Q(ld,{guide:e},e.side))]})}function cd(e){let t=fn.value,n=K.value;if(U.value===`picking`||!n&&!e){let e=t?.parentElement;return!W.value||!t||!e||e===document.documentElement?null:[t,e]}return e?W.value&&t&&t!==e?[e,t]:null:n?W.value&&t&&t!==n.element?[n.element,t]:n.measuredTo?[n.element,n.measuredTo.element]:null:null}function ld({guide:e}){return/* @__PURE__ */ Q(S,{children:[e.extension&&/* @__PURE__ */ Q(`div`,{class:`guide guide-extension`,style:ud(e.extension)}),/* @__PURE__ */ Q(`div`,{class:`guide`,style:ud(e)}),/* @__PURE__ */ Q(`span`,{class:`guide-value`,style:{transform:ad(dd(e))},children:e.value})]})}function ud(e){let t=dd(e);return id(t.left===t.right?{...t,left:t.left-.5,right:t.left+.5}:{...t,top:t.top-.5,bottom:t.top+.5})}function dd({from:e,to:t}){return{left:Math.min(e.x,t.x),right:Math.max(e.x,t.x),top:Math.min(e.y,t.y),bottom:Math.max(e.y,t.y)}}function fd({text:e,animate:t=!1}){let n=t?_d(e):0;return/* @__PURE__ */ Q(`div`,{class:`md`,children:pd(e,{index:0,animateFrom:t?n-48:1/0})})}function pd(e,t){let n=[],r=e.replace(/\r\n/g,`
|
|
69
|
+
`}),o.appendChild(r.createTextNode(e))}i.timeEnd(`clone node`),await f?.(h),l!==!1&&Z(h)&&(i.time(`embed web font`),await Al(h,n),i.timeEnd(`embed web font`)),i.time(`embed node`),kl(h,n);let g=a.length,_=0,v=async()=>{for(;;){let e=a.pop();if(!e)break;try{await e}catch(e){n.log.warn(`Failed to run task`,e)}u?.(++_,g)}};u?.(_,g),await Promise.all([...Array.from({length:4})].map(v)),i.timeEnd(`embed node`),await p?.(h);let y=Vl(h,n);return s&&y.insertBefore(s,y.children[0]),o&&y.insertBefore(o,y.children[0]),d&&_l(n),await m?.(y),y}function Vl(e,t){let{width:n,height:r}=t,i=jc(n,r,e.ownerDocument),a=i.ownerDocument.createElementNS(i.namespaceURI,`foreignObject`);return a.setAttributeNS(null,`x`,`0%`),a.setAttributeNS(null,`y`,`0%`),a.setAttributeNS(null,`width`,`100%`),a.setAttributeNS(null,`height`,`100%`),a.append(e),i.appendChild(a),i}async function Hl(e,t){let n=await Uc(e,t),r=await Bl(n),i=Mc(r,n.isEnable(`removeControlCharacter`));return n.autoDestruct||(n.svgStyleElement=Gc(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(Ac,`defs`),n.svgStyles.clear()),await qc(Fc(i,r.ownerDocument),n)}async function Ul(e,t){let n=await Uc(e,t),{log:r,quality:i,type:a,dpi:o}=n,s=await Hl(n);r.time(`canvas to data url`);let c=s.toDataURL(a,i);if([`image/png`,`image/jpeg`].includes(a)&&o&&$s&&ec){let[e,t]=c.split(`,`),n=0,r=!1;if(a===`image/png`){let e=Ys(t);e>=0?(n=Math.ceil((e+28)/3)*4,r=!0):n=44}else a===`image/jpeg`&&(n=24);let i=t.substring(0,n),s=t.substring(n),l=window.atob(i),u=new Uint8Array(l.length);for(let e=0;e<u.length;e++)u[e]=l.charCodeAt(e);let d=a===`image/png`?Js(u,o,r):Us(u,o);c=[e,`,`,window.btoa(String.fromCharCode(...d)),s].join(``)}return r.timeEnd(`canvas to data url`),c}async function Wl(e,t){return Ul(await Uc(e,{...t,type:`image/jpeg`}))}async function Gl(e,t){let n=e.getBoundingClientRect(),r=n.width*n.height<4800&&e.parentElement?e.parentElement:e,i=r.getBoundingClientRect(),a=Math.min(window.devicePixelRatio||1,1600/Math.max(i.width+48,i.height+48,1));try{let e=await Wl(r,{scale:a,quality:.85,backgroundColor:Kl(r),filter:e=>e!==t,timeout:4e3});return e.startsWith(`data:image/jpeg`)?{name:`tencil-element.jpg`,mimeType:`image/jpeg`,dataUrl:e}:null}catch(e){return console.warn(`[tencil] screenshot failed`,e),null}}function Kl(e){let t=e;for(;t;){let e=getComputedStyle(t).backgroundColor;if(e&&e!==`transparent`&&!/rgba\(.*,\s*0\)$/.test(e))return e;t=t.parentElement}return`#ffffff`}var ql=0;Array.isArray;function Q(e,t,r,i,a,o){t||={};var s,c,l=t;if(`ref`in l&&typeof e!=`function`)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ql,__i:-1,__u:0};return(a||o)&&(u.__source=a,u.__self=o),n.vnode&&n.vnode(u),u}let Jl={t3code:{viewBox:`15.5309 37 94.3941 56.96`,path:`M33.4509 93V47.56H15.5309V37H64.3309V47.56H46.4109V93H33.4509ZM86.7253 93.96C82.832 93.96 78.9653 93.4533 75.1253 92.44C71.2853 91.3733 68.032 89.88 65.3653 87.96L70.4053 78.04C72.5386 79.5867 75.0186 80.8133 77.8453 81.72C80.672 82.6267 83.5253 83.08 86.4053 83.08C89.6586 83.08 92.2186 82.44 94.0853 81.16C95.952 79.88 96.8853 78.12 96.8853 75.88C96.8853 73.7467 96.0586 72.0667 94.4053 70.84C92.752 69.6133 90.0853 69 86.4053 69H80.4853V60.44L96.0853 42.76L97.5253 47.4H68.1653V37H107.365V45.4L91.8453 63.08L85.2853 59.32H89.0453C95.9253 59.32 101.125 60.8667 104.645 63.96C108.165 67.0533 109.925 71.0267 109.925 75.88C109.925 79.0267 109.099 81.9867 107.445 84.76C105.792 87.48 103.259 89.6933 99.8453 91.4C96.432 93.1067 92.0586 93.96 86.7253 93.96Z`,className:`agent-mono`,label:`T3 Code`},codex:{viewBox:`0 0 256 260`,path:`M239.184 106.203a64.716 64.716 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.716 64.716 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.665 64.665 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.767 64.767 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483Zm-97.56 136.338a48.397 48.397 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.595 8.595 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601Zm-104.466-44.61a48.345 48.345 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.339 8.339 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803ZM23.549 85.38a48.499 48.499 0 0 1 25.58-21.333v61.39a8.288 8.288 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.819.819 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466 41.695-63.08-36.63L161.73 77.86a.819.819 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.544 8.544 0 0 0-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.716.716 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391v.205ZM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.595 8.595 0 0 0-4.246 7.367l-.051 72.697Zm11.868-25.58 28.138-16.217 28.188 16.218v32.434l-28.086 16.218-28.188-16.218-.052-32.434Z`,className:`agent-mono`,label:`Codex`},claudeAgent:{viewBox:`0 0 256 257`,path:`m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z`,className:`agent-claude`,label:`Claude`},cursor:{viewBox:`0 0 466.73 532.09`,path:`M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z`,className:`agent-mono`,label:`Cursor`},ensemble:{viewBox:`2 2 16 16`,path:[{x:2.5,y:3.25,height:13.5,opacity:.6},{x:6.5,y:2,height:16,opacity:1},{x:10.5,y:2.75,height:14.5,opacity:.8},{x:14.5,y:4.25,height:11.5,opacity:.5}],className:`agent-mono`,label:`Ensemble`}};function Yl(e){if(Jl[e])return Jl[e];let t=e.toLowerCase();if(t.includes(`claude`))return Jl.claudeAgent;if(t.includes(`codex`)||t.includes(`openai`))return Jl.codex;if(t.includes(`cursor`))return Jl.cursor;if(t.includes(`ensemble`))return Jl.ensemble}function Xl({agent:e,size:t=13,decorative:n=!1}){if(!e)return null;let r=Yl(e);return r?/* @__PURE__ */ Q(`svg`,{class:`agent-icon ${r.className}`,width:t,height:t,viewBox:r.viewBox,role:n?void 0:`img`,"aria-label":n?void 0:r.label,"aria-hidden":n?`true`:void 0,children:typeof r.path==`string`?/* @__PURE__ */ Q(`path`,{d:r.path}):r.path.map(e=>/* @__PURE__ */ Q(`rect`,{x:e.x,y:e.y,width:`3`,height:e.height,rx:`0.15`,"fill-opacity":e.opacity},e.x))}):null}function $({children:e,size:t=16}){return/* @__PURE__ */ Q(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,children:e})}let Zl=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`}),/* @__PURE__ */ Q(`path`,{d:`M12 8v8M8 12h8`})]}),Ql=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M22 12h-6l-2 3h-4l-2-3H2`}),/* @__PURE__ */ Q(`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`})]}),$l=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M10.7 5.1A10.8 10.8 0 0 1 12 5c7 0 10 7 10 7a13.2 13.2 0 0 1-1.7 2.7`}),/* @__PURE__ */ Q(`path`,{d:`M6.6 6.6A13.5 13.5 0 0 0 2 12s3 7 10 7a9.7 9.7 0 0 0 5.4-1.6`}),/* @__PURE__ */ Q(`path`,{d:`M9.9 9.9a3 3 0 1 0 4.2 4.2M2 2l20 20`})]}),eu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),tu=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`m5 12 7-7 7 7M12 19V5`})}),nu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`rect`,{x:`5`,y:`5`,width:`14`,height:`14`,rx:`2`,fill:`currentColor`})}),ru=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M20 6 9 17l-5-5`})}),iu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M9 14 4 9l5-5`}),/* @__PURE__ */ Q(`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 0 11H11`})]}),au=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})}),ou=()=>/* @__PURE__ */ Q($,{size:14,children:/* @__PURE__ */ Q(`path`,{d:`M15 3h6v6M10 14 21 3M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`})}),su=()=>/* @__PURE__ */ Q($,{children:/* @__PURE__ */ Q(`path`,{d:`M18 6 6 18M6 6l12 12`})}),cu=()=>/* @__PURE__ */ Q($,{size:14,children:[/* @__PURE__ */ Q(`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`13`,r:`3`})]}),lu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`path`,{d:`m16 18 6-6-6-6M8 6l-6 6 6 6`})}),uu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`}),/* @__PURE__ */ Q(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),du=({size:e=16})=>/* @__PURE__ */ Q(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,class:`tencil-logo`,children:[/* @__PURE__ */ Q(`path`,{d:`M3 21V9a6 6 0 0 1 6-6h6a6 6 0 0 1 6 6v6a6 6 0 0 1-6 6Z`,fill:`#3b8dff`}),/* @__PURE__ */ Q(`path`,{d:`M9.25 7.5 16.5 12.6l-3.55.75-1.75 3.4Z`,fill:`#fff`,stroke:`#fff`,"stroke-linejoin":`round`})]}),fu=()=>/* @__PURE__ */ Q($,{size:14,children:[/* @__PURE__ */ Q(`path`,{d:`m12 2 10 5-10 5L2 7Z`}),/* @__PURE__ */ Q(`path`,{d:`m2 17 10 5 10-5M2 12l10 5 10-5`})]}),pu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ Q(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4`})]}),mu=()=>/* @__PURE__ */ Q($,{children:[/* @__PURE__ */ Q(`rect`,{x:`2`,y:`7`,width:`20`,height:`10`,rx:`2`}),/* @__PURE__ */ Q(`path`,{d:`M6 7v3M10 7v4M14 7v3M18 7v4M3 3l18 18`})]}),hu=()=>/* @__PURE__ */ Q($,{size:12,children:/* @__PURE__ */ Q(`path`,{d:`m6 9 6 6 6-6`})}),gu=F(()=>{let e=/* @__PURE__ */ new Map,t=[...jn.value].reverse().filter(e=>e.anchor);for(let[n,r]of t.entries())e.set(r.id,n+1);return e});function _u(){let e=Pn.value.flatMap(e=>{let t=gu.value.get(e.id);return t?[{threadId:e.id,number:t}]:[]});e.length!==0&&H({type:`drafts.send`,drafts:e})&&(q.value=e[0]?.threadId??null)}function vu(){let e=yu();if(hn.value)return null;let t=K.value;return/* @__PURE__ */ Q(S,{children:[Mn.value.map(e=>/* @__PURE__ */ Q(xu,{thread:e},e.id)),e.map(e=>/* @__PURE__ */ Q(bu,{pin:e},`leaving:${e.thread.id}`)),t&&/* @__PURE__ */ Q(Ou,{})]})}function yu(){let e=Mn.value,t=kn.value,n=j({page:t,pins:[]}),[r,i]=A([]);return Ne(()=>{let r=n.current;n.current={page:t,pins:e.map(e=>({thread:e,number:gu.value.get(e.id),variant:ku(e),resolved:!1}))};let a=new Set(e.map(e=>e.id)),o=r.page===t?r.pins.filter(e=>!a.has(e.thread.id)).map(e=>({...e,resolved:B.value.get(e.thread.id)?.resolved===!0})):[];i(e=>{let t=e.filter(e=>!a.has(e.thread.id)&&!o.some(t=>t.thread.id===e.thread.id));return t.length===e.length&&o.length===0?e:[...t,...o]});for(let e of o)setTimeout(()=>i(t=>t.filter(t=>t!==e)),1e3)},[e,t]),r}function bu({pin:e}){On.value;let t=e.thread.anchor?Rs(e.thread.anchor):null;return t?/* @__PURE__ */ Q(`div`,{class:`pin pin-${e.variant} pin-leaving${e.resolved?` pin-resolving`:``}`,style:{transform:`translate(${t.x}px, ${t.y}px)`},"aria-hidden":`true`,children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:[/* @__PURE__ */ Q(`span`,{class:`pin-glyph`,children:e.number??`•`}),e.resolved&&/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`span`,{class:`pin-glyph pin-check`,children:/* @__PURE__ */ Q(ru,{})}),/* @__PURE__ */ Q(`span`,{class:`pin-shine`})]})]})}):null}function xu({thread:e}){if(On.value,!e.anchor)return null;let t=Dn.value,n=t?.threadId===e.id,r=n?t.point:Rs(e.anchor);if(!r)return null;let i=q.value===e.id;return/* @__PURE__ */ Q(`button`,{type:`button`,class:`pin pin-${ku(e)}${i?` pin-open`:``}${n?` pin-dragging`:``}`,style:{transform:`translate(${r.x}px, ${r.y}px)`},title:e.title,onPointerDown:t=>Cu(t,e,r),onClick:()=>{if(Su===e.id){Su=null;return}K.value=null,q.value=i?null:e.id},children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:gu.value.get(e.id)??`•`})})}let Su=null;function Cu(e,t,n){if(e.button!==0)return;e.preventDefault();let r=e.currentTarget;try{r.setPointerCapture(e.pointerId)}catch{}Su=null;let i=e.clientX,a=e.clientY,o=e=>{let r=e.clientX-i,o=e.clientY-a;!Dn.value&&Math.hypot(r,o)<4||(Dn.value={threadId:t.id,point:wu({x:n.x+r,y:n.y+o})})},s=e=>{r.removeEventListener(`pointermove`,o),r.removeEventListener(`pointerup`,s),r.removeEventListener(`pointercancel`,s),r.removeEventListener(`lostpointercapture`,s),window.removeEventListener(`dragstart`,Tu,!0);let n=Dn.value;n&&(Dn.value=null,Su=t.id,e.type===`pointerup`&&Eu(t,n.point))};r.addEventListener(`pointermove`,o),r.addEventListener(`pointerup`,s),r.addEventListener(`pointercancel`,s),r.addEventListener(`lostpointercapture`,s),window.addEventListener(`dragstart`,Tu,!0)}function wu(e){let{clientWidth:t,clientHeight:n}=document.documentElement;return{x:Math.max(0,Math.min(e.x,t-1)),y:Math.max(0,Math.min(e.y,n-1))}}function Tu(e){e.preventDefault()}function Eu(e,t){let n=Du(t);if(!n)return;let r={selector:ps(n),...zs(n,t)};H({type:`thread.move`,threadId:e.id,anchor:r})&&an({...e,anchor:r})}function Du(e){let t=Is();return document.elementsFromPoint(e.x,e.y).find(e=>e!==t&&e!==document.documentElement)??document.body}function Ou(){On.value;let e=K.value,t=Rs(e.anchor,e.element);return t?/* @__PURE__ */ Q(`div`,{class:`pin pin-draft pin-open`,style:{transform:`translate(${t.x}px, ${t.y}px)`},children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:`+`})}):null}function ku(e){if(e.resolved)return`resolved`;let t=e.delivery?.status;if(t&&(e.status===`idle`||e.status===`error`))return t===`queued`||t===`deploying`?`working`:t===`failed`||t===`deploy-failed`?`error`:`done`;switch(e.status){case`draft`:return`queued`;case`starting`:case`working`:return`working`;case`waiting`:return`waiting`;case`error`:return`error`;default:return`done`}}let Au=`tencil:open`;function ju(){let[e,t]=A(`page`),n=R.value?.label??`Agent`,r=L.value===`open`&&R.value?.state===`ready`,i=R.value?.id;return Me(()=>{r&&J.value&&e===`provider`&&ln()},[e,J.value,r,i]),J.value?/* @__PURE__ */ Q(`aside`,{class:`inbox`,children:[/* @__PURE__ */ Q(`header`,{class:`inbox-header`,children:[/* @__PURE__ */ Q(`div`,{class:`segmented`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`page`?`active`:``,onClick:()=>t(`page`),children:`This page`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`all`?`active`:``,onClick:()=>t(`all`),children:`All pins`}),/* @__PURE__ */ Q(`button`,{type:`button`,class:e===`provider`?`active`:``,onClick:()=>t(`provider`),children:n})]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Close`,onClick:()=>{J.value=!1},children:/* @__PURE__ */ Q(su,{})})]}),e===`provider`?/* @__PURE__ */ Q(Nu,{label:n}):/* @__PURE__ */ Q(Mu,{scope:e})]}):null}function Mu({scope:e}){let t=jn.value.filter(e=>mn.value||!e.resolved).filter(t=>e===`all`||t.anchor&&t.pageUrl&&An(t.pageUrl)===kn.value);return/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`label`,{class:`inbox-filter`,children:[/* @__PURE__ */ Q(`span`,{class:`checkbox`,children:[/* @__PURE__ */ Q(`input`,{type:`checkbox`,class:`checkbox-input`,checked:mn.value,onChange:e=>{mn.value=e.target.checked}}),/* @__PURE__ */ Q(ru,{})]}),`Show resolved`]}),/* @__PURE__ */ Q(`div`,{class:`inbox-list`,children:t.length===0?/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`No pins yet. Press `,/* @__PURE__ */ Q(`kbd`,{children:`C`}),` and click anything on the page.`]}):t.map(e=>/* @__PURE__ */ Q(Iu,{thread:e},e.id))})]})}function Nu({label:e}){let t=Ht.value;return t?t.length===0?/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`No `,e,` threads in this project yet.`]}):/* @__PURE__ */ Q(`div`,{class:`inbox-list inbox-list-provider`,children:t.map(e=>/* @__PURE__ */ Q(Pu,{summary:e},e.id))}):/* @__PURE__ */ Q(`p`,{class:`empty`,children:[`Loading `,e,` threads…`]})}function Pu({summary:e}){let t=Ut.value,n=[...B.value.values()].filter(t=>t.provider.threadId===e.id&&t.anchor).length;return/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-item provider-item`,onClick:()=>{let t=dn(e);t&&(q.value=t)},children:[/* @__PURE__ */ Q(`span`,{class:`provider-item-project`,children:[t&&/* @__PURE__ */ Q(Fu,{project:t}),/* @__PURE__ */ Q(`span`,{class:`provider-item-project-name`,children:t?.name}),e.status===`working`||e.status===`waiting`?/* @__PURE__ */ Q(`span`,{class:`provider-item-state state-${e.status}`,children:zu(e.status)}):e.background===`monitoring`?/* @__PURE__ */ Q(`span`,{class:`provider-item-state state-monitoring`,children:`Monitoring`}):/* @__PURE__ */ Q(`span`,{class:`provider-item-time`,children:Bu(e.updatedAt)})]}),/* @__PURE__ */ Q(`span`,{class:`provider-item-title`,children:e.title}),(e.branch||e.pullRequest||e.agent||n>0)&&/* @__PURE__ */ Q(`span`,{class:`provider-item-meta`,children:[e.branch&&/* @__PURE__ */ Q(`span`,{class:`provider-item-branch`,children:e.branch}),e.pullRequest&&/* @__PURE__ */ Q(`span`,{class:`provider-item-pr`,children:[`#`,e.pullRequest.number]}),n>0&&/* @__PURE__ */ Q(`span`,{class:`provider-item-pins`,children:[n,` pin`,n===1?``:`s`]}),/* @__PURE__ */ Q(Xl,{agent:e.agent})]})]})}function Fu({project:e}){return e.emoji?/* @__PURE__ */ Q(`span`,{class:`project-icon project-icon-emoji`,children:e.emoji}):e.iconUrl?/* @__PURE__ */ Q(`img`,{class:`project-icon`,src:e.iconUrl,alt:``}):/* @__PURE__ */ Q(`span`,{class:`project-icon project-icon-letter`,children:e.name.slice(0,1)})}function Iu({thread:e}){let t=!!(e.anchor&&e.pageUrl),n=!t||An(e.pageUrl)===kn.value,r=[...e.messages].reverse().find(e=>e.role===`assistant`);return/* @__PURE__ */ Q(`button`,{type:`button`,class:`inbox-item${q.value===e.id?` active`:``}`,onClick:()=>{if(!n){sessionStorage.setItem(Au,e.id),location.href=e.pageUrl;return}q.value=e.id,Lu(e)},children:[t?/* @__PURE__ */ Q(`span`,{class:`pin pin-static pin-${ku(e)}`,children:/* @__PURE__ */ Q(`span`,{class:`pin-body`,children:gu.value.get(e.id)})}):/* @__PURE__ */ Q(`span`,{class:`thread-dot thread-dot-${e.status}`}),/* @__PURE__ */ Q(`span`,{class:`inbox-item-body`,children:[/* @__PURE__ */ Q(`span`,{class:`inbox-item-title`,children:e.title}),/* @__PURE__ */ Q(`span`,{class:`inbox-item-meta`,children:[!t&&/* @__PURE__ */ Q(`span`,{children:`Not pinned · `}),t&&!n&&/* @__PURE__ */ Q(`span`,{children:[new URL(e.pageUrl).pathname,` · `]}),Ru(e),` · `,Bu(e.updatedAt)]}),r&&/* @__PURE__ */ Q(`span`,{class:`inbox-item-preview`,children:r.text.slice(0,140)})]})]})}function Lu(e){if(e.anchor)try{document.querySelector(e.anchor.selector)?.scrollIntoView({block:`center`,behavior:`smooth`})}catch{}}function Ru(e){if(e.resolved)return`Resolved`;switch(e.status){case`draft`:return`Queued`;case`starting`:return`Starting`;case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Done`}}function zu(e){switch(e){case`working`:return`Working`;case`waiting`:return`Needs input`;case`error`:return`Error`;default:return`Idle`}}function Bu(e){let t=Math.max(0,(Date.now()-Date.parse(e))/1e3);return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Vu({placeholder:e,initialText:t=``,autoFocus:n,disabled:r,busy:i,onSubmit:a,onCancel:o,children:s}){let[c,l]=A(t),u=j(null);Me(()=>{n&&u.current?.focus({preventScroll:!0})},[n]),Me(()=>{let e=u.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[c]);let d=c.trim().length>0&&!r&&!i,f=async()=>{d&&(await a(c.trim()),l(``))};return/* @__PURE__ */ Q(`div`,{class:`prompt-input`,children:[/* @__PURE__ */ Q(`textarea`,{ref:u,rows:1,value:c,placeholder:e,disabled:r,onInput:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&!e.shiftKey&&!e.isComposing?(e.preventDefault(),f()):e.key===`Escape`&&(e.preventDefault(),o?.())}}),/* @__PURE__ */ Q(`div`,{class:`prompt-actions`,children:[/* @__PURE__ */ Q(`div`,{class:`prompt-extras`,children:s}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`send`,disabled:!d,onClick:()=>void f(),"aria-label":`Send`,title:`Send (Enter)`,children:i?/* @__PURE__ */ Q(`span`,{class:`spinner`}):/* @__PURE__ */ Q(tu,{})})]})]})}let Hu=P(null);function Uu(){On.value;let e=K.value,t=j(null),[n,r]=A(140),[i,a]=A(!1),[o,s]=A(!1),[c,l]=A(null),u=R.value?.state===`ready`,d=R.value?.id;if(Me(()=>{e&&u&&(ln(),un())},[e,u,d]),Me(()=>{Hu.value=null},[d]),Ne(()=>{t.current&&r(t.current.offsetHeight)}),!e)return null;let f=Rs(e.anchor,e.element);if(!f)return null;let{left:p,top:m,origin:h}=Vs(f,{width:340,height:n}),g=R.value,_=g?.state===`ready`,v=vn.value,y=v?null:Hu.value,b=y?void 0:Ju(g?.id);return/* @__PURE__ */ Q(`div`,{ref:t,class:`popover composer`,style:{left:`${p}px`,top:`${m}px`,width:`340px`,transformOrigin:h},children:[/* @__PURE__ */ Q(`div`,{class:`composer-target`,children:[/* @__PURE__ */ Q(`span`,{class:`chip`,children:[/* @__PURE__ */ Q(lu,{}),e.label]}),g&&v&&/* @__PURE__ */ Q(`span`,{class:`composer-provider composer-batch`,children:[`→ Batch · `,Pn.value.length,` queued`]}),g&&!v&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`composer-provider${c===`target`?` open`:``}`,onClick:()=>l(c===`target`?null:`target`),title:`Send to a new thread or continue an existing one`,children:[/* @__PURE__ */ Q(`span`,{class:`composer-provider-label`,children:[`→ `,y?y.title:`New ${g.label} thread`]}),/* @__PURE__ */ Q(hu,{})]})]}),e.measuredTo&&Cn.value&&/* @__PURE__ */ Q(Gu,{pending:e}),c===`target`&&!v&&/* @__PURE__ */ Q(Xu,{onPick:e=>{Hu.value=e,l(null)}}),c===`model`&&b&&/* @__PURE__ */ Q(Yu,{choices:b,onPick:e=>{H({type:`model.select`,model:e}),l(null)}}),/* @__PURE__ */ Q(Vu,{placeholder:v?`Add a comment to the batch…`:_?y?`Continue the thread with this element…`:`What should change here?`:`Waiting for the agent connection…`,autoFocus:!0,busy:o,disabled:!_&&!v,onSubmit:async t=>{s(!0);try{let n=qu(await e.context,e),r=[];if(i){let t=await Gl(e.element,Is());t&&r.push(t)}let a=Lt(),o={...e.anchor,selector:n.selector};if(!H({type:`thread.create`,id:a,pageUrl:location.href,prompt:t,anchor:o,context:n,attachments:r,...y?{providerThreadId:y.id}:{},...v?{draft:!0}:{}}))return;let s=(/* @__PURE__ */ new Date()).toISOString();an({id:a,title:t,pageUrl:location.href,anchor:o,context:n,status:v?`draft`:y?`working`:`starting`,resolved:!1,messages:[{id:`local:${a}`,role:`user`,text:t,streaming:!1,createdAt:s}],provider:{id:g?.id??`unknown`,...y?{threadId:y.id,url:y.url}:{}},createdAt:s,updatedAt:s}),K.value=null,v?In():q.value=a}finally{s(!1)}},onCancel:()=>{K.value=null},children:[/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle${i?` toggle-on`:``}`,onClick:()=>a(!i),title:i?`Screenshot attached`:`No screenshot`,"aria-pressed":i,children:/* @__PURE__ */ Q(cu,{})}),gn.value&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle${v?` toggle-on`:``}`,onClick:()=>{_n.value=!v,l(null)},title:v?`Batch on: comments are queued and sent together`:`Queue comments and send them together`,"aria-label":`Batch`,"aria-pressed":v,children:/* @__PURE__ */ Q(fu,{})}),b&&/* @__PURE__ */ Q(`button`,{type:`button`,class:`toggle model-toggle${c===`model`?` open`:``}`,onClick:()=>l(c===`model`?null:`model`),title:`Agent and model for the new thread`,children:[/* @__PURE__ */ Q(Xl,{agent:b.current?.agent,size:12}),/* @__PURE__ */ Q(`span`,{class:`model-toggle-label`,children:b.current?.label??`Default model`}),/* @__PURE__ */ Q(hu,{})]})]}),!_&&g?.detail&&/* @__PURE__ */ Q(`p`,{class:`hint`,children:g.detail})]})}let Wu={top:`above`,right:`right`,bottom:`below`,left:`left`};function Gu({pending:e}){let t=e.measuredTo,n=Ku(e),r=[`top`,`right`,`bottom`,`left`].filter(e=>n?.[e]!==void 0).map(e=>`${n[e]} ${Wu[e]}`);return/* @__PURE__ */ Q(`div`,{class:`composer-measure`,children:[/* @__PURE__ */ Q(`span`,{class:`composer-measure-label`,title:`Spacing to ${t.label}: ${r.join(`, `)||`none`}`,children:[`↔ `,t.parent?`Parent `:``,/* @__PURE__ */ Q(`span`,{class:`composer-measure-target`,children:t.label}),r.length>0&&` · ${r.join(`, `)}`]}),/* @__PURE__ */ Q(`button`,{type:`button`,class:`icon-button`,title:`Don't send the spacing`,"aria-label":`Remove spacing`,onClick:()=>{K.value&&={...K.value,measuredTo:void 0}},children:/* @__PURE__ */ Q(su,{})})]})}function Ku(e){let t=e.measuredTo;return!t||!Cn.value||!e.element.isConnected||!t.element.isConnected?void 0:$o(Qo(Xo(e.element.getBoundingClientRect()),Xo(t.element.getBoundingClientRect())),{to:t.label,selector:ps(t.element),...t.parent?{parent:!0}:{}})}function qu(e,t){let n=Ku(t);return n?{...e,spacing:n}:e}function Ju(e){let t=Wt.value;if(!t||t.provider!==e||t.models.length===0)return;let n=e=>t.models.find(t=>t.id===e),r=n(z.value?.model),i=n(t.defaultModel);return{models:t.models,current:r??i,picked:r?.id??null,fallback:i}}function Yu({choices:e,onPick:t}){let n=/* @__PURE__ */ new Map;for(let t of e.models)n.set(t.group,[...n.get(t.group)??[],t]);return/* @__PURE__ */ Q(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===null,class:`target-option${e.picked===null?` selected`:``}`,onClick:()=>t(null),children:[/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:`Default`}),e.fallback&&/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:e.fallback.label})]}),[...n].map(([n,r])=>/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`p`,{class:`menu-group`,children:[/* @__PURE__ */ Q(Xl,{agent:r[0]?.agent,size:11}),n]}),r.map(n=>/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":e.picked===n.id,class:`target-option${e.picked===n.id?` selected`:``}`,onClick:()=>t(n.id),children:/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:n.label})},n.id))]},n))]})}function Xu({onPick:e}){let t=Ht.value,n=Hu.value?.id??null;return/* @__PURE__ */ Q(`div`,{class:`target-menu`,role:`listbox`,children:[/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":n===null,class:`target-option${n===null?` selected`:``}`,onClick:()=>e(null),children:/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:`New thread`})}),t===null&&/* @__PURE__ */ Q(`p`,{class:`target-empty`,children:`Loading threads…`}),t?.map(t=>/* @__PURE__ */ Q(`button`,{type:`button`,role:`option`,"aria-selected":n===t.id,class:`target-option${n===t.id?` selected`:``}`,onClick:()=>e(t),children:[/* @__PURE__ */ Q(`span`,{class:`thread-dot thread-dot-${t.status}`}),/* @__PURE__ */ Q(`span`,{class:`target-option-title`,children:t.title}),/* @__PURE__ */ Q(Xl,{agent:t.agent,size:12}),/* @__PURE__ */ Q(`span`,{class:`target-option-meta`,children:Bu(t.updatedAt)})]},t.id))]})}function Zu(){On.value;let e=fn.value;if(!e)return null;let t=U.value===`picking`,n=!t&&!K.value&&Cn.value&&W.value&&!G.value;if(!t&&!n)return null;let r=Xo(e.getBoundingClientRect());return/* @__PURE__ */ Q(S,{children:[Cn.value&&(n||!W.value)&&/* @__PURE__ */ Q($u,{element:e,box:r}),/* @__PURE__ */ Q(`div`,{class:`highlight`,style:id(r)}),/* @__PURE__ */ Q(Qu,{element:e,box:r})]})}function Qu({element:e,box:t}){let n=t.top<28;return/* @__PURE__ */ Q(`div`,{class:`highlight-label`,style:{transform:`translate(${Math.max(4,t.left)}px, ${n?t.bottom+6:t.top-26}px)`},children:[fs(e),/* @__PURE__ */ Q(`span`,{class:`highlight-size`,children:[Zo(t.right-t.left),`×`,Zo(t.bottom-t.top)]})]})}function $u({element:e,box:t}){let n=rs(e),r=[...ed(e,t,n),...td(e,t,n),...rd(e,t,n)];return/* @__PURE__ */ Q(S,{children:[r.map((e,t)=>/* @__PURE__ */ Q(`div`,{class:`band band-${e.kind}`,style:id(e.box)},`band-${t}`)),r.filter(e=>e.labelled).map((e,t)=>/* @__PURE__ */ Q(`span`,{class:`band-value band-value-${e.kind}`,style:{transform:ad(e.box)},children:[e.value,e.utility&&/* @__PURE__ */ Q(`span`,{class:`band-utility`,children:e.utility})]},`value-${t}`))]})}function ed(e,t,{margin:n}){let[r,i,a,o]=n.map(e=>Math.max(0,e)),s={left:t.left-o,top:t.top-r,right:t.right+i,bottom:t.bottom+a};return nd(e,`margin`,[[`top`,r,{...s,bottom:t.top}],[`right`,i,{left:t.right,right:s.right,top:t.top,bottom:t.bottom}],[`bottom`,a,{...s,top:t.bottom}],[`left`,o,{left:s.left,right:t.left,top:t.top,bottom:t.bottom}]])}function td(e,t,{padding:n,border:r}){let[i,a,o,s]=n,c={left:t.left+r[3],top:t.top+r[0],right:t.right-r[1],bottom:t.bottom-r[2]},l={top:c.top+i,bottom:c.bottom-o};return nd(e,`padding`,[[`top`,i,{...c,bottom:l.top}],[`right`,a,{...l,left:c.right-a,right:c.right}],[`bottom`,o,{...c,top:l.bottom}],[`left`,s,{...l,left:c.left,right:c.left+s}]])}function nd(e,t,n){return n.filter(([,e,t])=>e>0&&t.right>t.left&&t.bottom>t.top).map(([n,r,i])=>({kind:t,box:i,value:r,labelled:!0,utility:cs(e,t,n,r)}))}function rd(e,t,{gap:n,padding:r,border:i}){if(!n)return[];let a={left:t.left+i[3]+r[3],top:t.top+i[0]+r[0],right:t.right-i[1]-r[1],bottom:t.bottom-i[2]-r[2]},o=/* @__PURE__ */ new Set;return is(e,n,a).map(t=>{let{axis:r,...i}=t,a=!o.has(r);return o.add(r),{kind:`gap`,box:i,value:n[r],labelled:a,utility:a?cs(e,`gap`,r,n[r]):void 0}})}function id(e){return{transform:`translate(${e.left}px, ${e.top}px)`,width:`${e.right-e.left}px`,height:`${e.bottom-e.top}px`}}function ad(e){return`translate(${(e.left+e.right)/2}px, ${(e.top+e.bottom)/2}px) translate(-50%, -50%)`}function od(){if(On.value,!Cn.value)return null;let e=U.value===`idle`&&!K.value?G.value?.element:void 0,t=cd(e),n=e?.isConnected?Xo(e.getBoundingClientRect()):null;return/* @__PURE__ */ Q(S,{children:[e&&n&&/* @__PURE__ */ Q(S,{children:[/* @__PURE__ */ Q(`div`,{class:`measure-box`,style:id(n)}),/* @__PURE__ */ Q(Qu,{element:e,box:n})]}),t&&/* @__PURE__ */ Q(sd,{pair:t})]})}function sd({pair:[e,t]}){if(!e.isConnected||!t.isConnected)return null;let n=Xo(e.getBoundingClientRect()),r=Xo(t.getBoundingClientRect()),i=K.value;return/* @__PURE__ */ Q(S,{children:[i?.element===e&&/* @__PURE__ */ Q(`div`,{class:`measure-box`,style:id(n)}),/* @__PURE__ */ Q(`div`,{class:`measure-target`,style:id(r)}),Qo(n,r).map(e=>/* @__PURE__ */ Q(ld,{guide:e},e.side))]})}function cd(e){let t=fn.value,n=K.value;if(U.value===`picking`||!n&&!e){let e=t?.parentElement;return!W.value||!t||!e||e===document.documentElement?null:[t,e]}return e?W.value&&t&&t!==e?[e,t]:null:n?W.value&&t&&t!==n.element?[n.element,t]:n.measuredTo?[n.element,n.measuredTo.element]:null:null}function ld({guide:e}){return/* @__PURE__ */ Q(S,{children:[e.extension&&/* @__PURE__ */ Q(`div`,{class:`guide guide-extension`,style:ud(e.extension)}),/* @__PURE__ */ Q(`div`,{class:`guide`,style:ud(e)}),/* @__PURE__ */ Q(`span`,{class:`guide-value`,style:{transform:ad(dd(e))},children:e.value})]})}function ud(e){let t=dd(e);return id(t.left===t.right?{...t,left:t.left-.5,right:t.left+.5}:{...t,top:t.top-.5,bottom:t.top+.5})}function dd({from:e,to:t}){return{left:Math.min(e.x,t.x),right:Math.max(e.x,t.x),top:Math.min(e.y,t.y),bottom:Math.max(e.y,t.y)}}function fd({text:e,animate:t=!1}){let n=t?_d(e):0;return/* @__PURE__ */ Q(`div`,{class:`md`,children:pd(e,{index:0,animateFrom:t?n-48:1/0})})}function pd(e,t){let n=[],r=e.replace(/\r\n/g,`
|
|
70
70
|
`).split(`
|
|
71
71
|
`),i=0,a=0;for(;i<r.length;){let e=r[i];if(e.match(/^\s*```(\w*)/)){let e=[];for(i++;i<r.length&&!/^\s*```/.test(r[i]);)e.push(r[i++]);i++,t.index+=_d(e.join(`
|
|
72
72
|
`)),n.push(/* @__PURE__ */ Q(`pre`,{children:/* @__PURE__ */ Q(`code`,{children:e.join(`
|
package/dist/react.d.mts
CHANGED