tencil 0.8.0 → 0.10.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 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 two agents. With **T3 Code**, every pin is a real T3 Code thread
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) or
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-Cbvie3Om.mjs";
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-C-Udis96.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.length === 0, options.log);
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(noneFound, log) {
58
- log(noneFound ? " Neither T3 Code nor Claude Code was found. Which one will you use?" : " T3 Code and Claude Code are both here. Which agent should pins go to?");
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)
@@ -1,4 +1,4 @@
1
- import "./index-C4SmNUQW.mjs";
1
+ import "./index-BSKV-nDI.mjs";
2
2
  //#region src/integrations/cloud.d.ts
3
3
  interface TencilCloudOptions {
4
4
  /** Project key from the Tencil Cloud dashboard. Defaults to TENCIL_CLOUD. */
@@ -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<{
@@ -333,6 +334,58 @@ interface UpdateStatus {
333
334
  /** `failed`: what went wrong. */
334
335
  error?: string;
335
336
  }
337
+ /**
338
+ * The person's own overlay settings, the same in every project on the machine.
339
+ * Saved by the local daemon; unset ones fall back to the overlay's defaults.
340
+ */
341
+ declare const Preferences: z.ZodObject<{
342
+ theme: z.ZodOptional<z.ZodEnum<{
343
+ system: "system";
344
+ dark: "dark";
345
+ light: "light";
346
+ }>>;
347
+ shortcuts: z.ZodOptional<z.ZodObject<{
348
+ comment: z.ZodNullable<z.ZodObject<{
349
+ code: z.ZodString;
350
+ key: z.ZodString;
351
+ alt: z.ZodBoolean;
352
+ ctrl: z.ZodBoolean;
353
+ meta: z.ZodBoolean;
354
+ shift: z.ZodBoolean;
355
+ }, z.core.$strip>>;
356
+ ruler: z.ZodNullable<z.ZodObject<{
357
+ code: z.ZodString;
358
+ key: z.ZodString;
359
+ alt: z.ZodBoolean;
360
+ ctrl: z.ZodBoolean;
361
+ meta: z.ZodBoolean;
362
+ shift: z.ZodBoolean;
363
+ }, z.core.$strip>>;
364
+ hidePins: z.ZodNullable<z.ZodObject<{
365
+ code: z.ZodString;
366
+ key: z.ZodString;
367
+ alt: z.ZodBoolean;
368
+ ctrl: z.ZodBoolean;
369
+ meta: z.ZodBoolean;
370
+ shift: z.ZodBoolean;
371
+ }, z.core.$strip>>;
372
+ hideDock: z.ZodObject<{
373
+ code: z.ZodString;
374
+ key: z.ZodString;
375
+ alt: z.ZodBoolean;
376
+ ctrl: z.ZodBoolean;
377
+ meta: z.ZodBoolean;
378
+ shift: z.ZodBoolean;
379
+ }, z.core.$strip>;
380
+ measure: z.ZodNullable<z.ZodEnum<{
381
+ Alt: "Alt";
382
+ Control: "Control";
383
+ Meta: "Meta";
384
+ Shift: "Shift";
385
+ }>>;
386
+ }, z.core.$strip>>;
387
+ }, z.core.$strip>;
388
+ type Preferences = z.infer<typeof Preferences>;
336
389
  declare const ProviderInfo: z.ZodObject<{
337
390
  id: z.ZodString;
338
391
  label: z.ZodString;
@@ -365,6 +418,27 @@ declare const ProjectSettings: z.ZodObject<{
365
418
  ruler: z.ZodBoolean;
366
419
  }, z.core.$strip>;
367
420
  type ProjectSettings = z.infer<typeof ProjectSettings>;
421
+ declare const ProjectSource: z.ZodObject<{
422
+ via: z.ZodEnum<{
423
+ port: "port";
424
+ ensemble: "ensemble";
425
+ plugin: "plugin";
426
+ docker: "docker";
427
+ picked: "picked";
428
+ }>;
429
+ port: z.ZodOptional<z.ZodNumber>;
430
+ detected: z.ZodOptional<z.ZodObject<{
431
+ root: z.ZodString;
432
+ via: z.ZodEnum<{
433
+ port: "port";
434
+ ensemble: "ensemble";
435
+ plugin: "plugin";
436
+ docker: "docker";
437
+ }>;
438
+ port: z.ZodOptional<z.ZodNumber>;
439
+ }, z.core.$strip>>;
440
+ }, z.core.$strip>;
441
+ type ProjectSource = z.infer<typeof ProjectSource>;
368
442
  type ServerMessage = {
369
443
  type: 'ready';
370
444
  protocol: typeof PROTOCOL_VERSION;
@@ -387,6 +461,24 @@ type ServerMessage = {
387
461
  type: 'update';
388
462
  update: UpdateStatus;
389
463
  } |
464
+ /** Local daemon only: the answer to `project.choices`. */
465
+ {
466
+ type: 'project.choices';
467
+ choices: Array<{
468
+ root: string;
469
+ title: string;
470
+ }>;
471
+ } |
472
+ /** Local daemon only: how this page's project was found, after it attaches. */
473
+ {
474
+ type: 'project.source';
475
+ source: ProjectSource;
476
+ } |
477
+ /** Local daemon only: the saved preferences, on connect and whenever they change. */
478
+ {
479
+ type: 'preferences';
480
+ preferences: Preferences;
481
+ } |
390
482
  /** Tencil Cloud: sign in first (no token, or one it no longer accepts). */
391
483
  {
392
484
  type: 'auth.required';
@@ -461,6 +553,10 @@ interface Provider {
461
553
  createThread(input: CreateThreadInput): Promise<CreatedThread>;
462
554
  sendMessage(input: SendMessageInput): Promise<void>;
463
555
  interrupt(providerThreadId: string): Promise<void>;
556
+ /** Archive a thread `createThread` marked `archivable`, once its pins are resolved. Optional. */
557
+ archive?(providerThreadId: string): Promise<void>;
558
+ /** Bring an archived thread back, for a pin reopened or replied to. */
559
+ reopen?(providerThreadId: string): Promise<void>;
464
560
  /**
465
561
  * Stream updates for a thread. Called right after `createThread` and again
466
562
  * for every persisted thread when the bridge restarts. The provider should
@@ -484,6 +580,8 @@ interface ProviderModels {
484
580
  interface CreatedThread {
485
581
  providerThreadId: string;
486
582
  url?: string;
583
+ /** The provider started this thread for the pin alone, so resolving the pin may archive it. */
584
+ archivable?: boolean;
487
585
  }
488
586
  interface SendMessageInput {
489
587
  providerThreadId: string;
@@ -509,4 +607,4 @@ interface ThreadSink {
509
607
  step?(step: ThreadStep): void;
510
608
  }
511
609
  //#endregion
512
- export { Viewer as a, UpdateStatus as i, ProviderOption as n, Thread as o, ServerMessage as r, ElementContext as s, Provider as t };
610
+ export { UpdateStatus as a, ElementContext as c, ServerMessage as i, ProjectSource as n, Viewer as o, ProviderOption as r, Thread as s, Provider as t };
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-C4SmNUQW.mjs";
1
+ import { a as UpdateStatus, c as ElementContext, i as ServerMessage, n as ProjectSource, o as Viewer, r as ProviderOption, s as Thread, t as Provider } from "./index-BSKV-nDI.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,21 +131,43 @@ 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. what the user picked for this address before,
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
- * Returns undefined when neither works; the overlay then asks.
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
  */
146
+ /** A page's project, and how it was found. */
147
+ interface Detected {
148
+ root: string;
149
+ source: ProjectSource;
150
+ }
141
151
  export declare class ProjectResolver {
142
152
  #private;
143
153
  constructor(options: {
144
154
  dataDir: string;
145
155
  exec?: Exec;
146
156
  platform?: NodeJS.Platform;
157
+ ensembleForPort?: EnsembleForPort;
147
158
  });
148
159
  resolve(pageUrl: string, claimedRoot?: string): Promise<string | undefined>;
160
+ /**
161
+ * The page's project and how it was found. A pick made over a detected
162
+ * project only holds while that same project is detected on the address:
163
+ * when another app takes the port, detection wins again.
164
+ */
165
+ detect(pageUrl: string, claimedRoot?: string): Promise<Detected | undefined>;
166
+ /**
167
+ * Use `root` for this address while `detected` is what Tencil finds there
168
+ * (the overlay's Change). Picking the detected project itself undoes it.
169
+ */
170
+ pick(pageUrl: string, detected: string, root: string): Promise<void>;
149
171
  /** Remember the user's choice for an address (from the overlay's project picker). */
150
172
  remember(pageUrl: string, root: string): Promise<void>;
151
173
  /**
@@ -161,6 +183,16 @@ export declare function projectRoot(folder: string): string;
161
183
  /** The permission modes that work without anyone at a terminal to answer prompts. */
162
184
  type PermissionMode = 'default' | 'acceptEdits' | 'auto' | 'bypassPermissions';
163
185
  //#endregion
186
+ //#region ../provider-ensemble/src/auth.d.ts
187
+ /** The tokens Ensemble gave Tencil, per Ensemble URL, readable only by this user. */
188
+ declare class EnsembleCredentialStore {
189
+ #private;
190
+ readonly path: string;
191
+ constructor(path?: string);
192
+ get(baseUrl: string): Promise<string | undefined>;
193
+ set(baseUrl: string, token: string): Promise<void>;
194
+ }
195
+ //#endregion
164
196
  //#region ../provider-t3code/src/auth.d.ts
165
197
  interface StoredCredential {
166
198
  token: string;
@@ -214,7 +246,7 @@ interface T3CodeProviderOptions {
214
246
  }
215
247
  //#endregion
216
248
  //#region src/daemon/agents.d.ts
217
- declare const PROVIDERS: readonly ["t3code", "claude-code"];
249
+ declare const PROVIDERS: readonly ["t3code", "claude-code", "ensemble"];
218
250
  type ProviderName = (typeof PROVIDERS)[number];
219
251
  //#endregion
220
252
  //#region src/service/self-update.d.ts
@@ -271,6 +303,11 @@ interface DaemonOptions {
271
303
  model?: string;
272
304
  permissionMode?: PermissionMode;
273
305
  };
306
+ /** Ensemble's public local API. */
307
+ ensemble?: {
308
+ url?: string;
309
+ credentials?: EnsembleCredentialStore;
310
+ };
274
311
  t3?: Pick<T3CodeProviderOptions, 'autoPair' | 'createPairingCode' | 'timeouts'> & {
275
312
  url?: string;
276
313
  token?: string;
@@ -308,12 +345,6 @@ interface Daemon {
308
345
  checkForUpdates(): Promise<void>;
309
346
  close(): Promise<void>;
310
347
  }
311
- /**
312
- * One Tencil daemon per machine. Pages load `/tencil.js` from it; each
313
- * page's WebSocket is attached to the project it belongs to (worked out from
314
- * the dev server's port, or picked by the user), and every project gets its
315
- * own bridge, provider connection and pin store, created on first use.
316
- */
317
348
  export declare function startDaemon(options?: DaemonOptions): Promise<Daemon>;
318
349
  /** Is a Tencil daemon answering on this port? Returns its health report. */
319
350
  export declare function probeDaemon(port?: number, host?: string): Promise<{
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { C as projectStorePath, F as renderPrompt, I as stripContext, M as ProjectResolver, N as projectRoot, P as Bridge, S as defaultDataDir, n as probeDaemon, r as startDaemon, t as DEFAULT_PORT, x as FileThreadStore } from "./server-Cbvie3Om.mjs";
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-C-Udis96.mjs";
2
2
  export { Bridge, DEFAULT_PORT, ProjectResolver, FileThreadStore as ThreadStore, defaultDataDir, probeDaemon, projectRoot, projectStorePath, renderPrompt, startDaemon, stripContext };
package/dist/next.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as TencilCloudOptions } from "./cloud-DPNrsIER.mjs";
1
+ import { t as TencilCloudOptions } from "./cloud-DKtU6lcZ.mjs";
2
2
  //#region src/integrations/next.d.ts
3
3
  /**
4
4
  * Wrap `next.config` for Tencil Cloud preview builds: every element gets a