@bendyline/gezel-cli 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tui/index.js CHANGED
@@ -24,6 +24,7 @@ import {
24
24
  import {
25
25
  GezelApiError,
26
26
  GezelClient,
27
+ LiveDaemonUnhealthyError,
27
28
  createTrustingFetch,
28
29
  discoverOrSpawn,
29
30
  electronNativeBinCandidates,
@@ -198,6 +199,236 @@ function useBufferedState(initial, intervalMs) {
198
199
  return [rendered, setImmediate, setBuffered];
199
200
  }
200
201
 
202
+ // src/tui/managed-apps.ts
203
+ var MANAGED_APP_TARGETS = [
204
+ {
205
+ id: "vscode",
206
+ label: "VS Code",
207
+ aliases: ["vscode", "code", "vs-code"],
208
+ description: "add Gezel to VS Code\u2019s built-in model picker"
209
+ },
210
+ {
211
+ id: "pi",
212
+ label: "pi",
213
+ aliases: ["pi"],
214
+ description: "add Gezel models and the managed pi extension"
215
+ },
216
+ {
217
+ id: "opencode",
218
+ label: "OpenCode",
219
+ aliases: ["opencode", "open-code"],
220
+ description: "add Gezel settings and the managed OpenCode plugin"
221
+ },
222
+ {
223
+ id: "codex",
224
+ label: "Codex",
225
+ aliases: ["codex"],
226
+ description: "add a managed Gezel profile to Codex"
227
+ }
228
+ ];
229
+ var ManagedAppCommandError = class extends Error {
230
+ constructor(message) {
231
+ super(message);
232
+ this.name = "ManagedAppCommandError";
233
+ }
234
+ };
235
+ function resolveManagedApp(value) {
236
+ const normalized = value.trim().toLowerCase();
237
+ return MANAGED_APP_TARGETS.find((target) => target.aliases.includes(normalized))?.id ?? null;
238
+ }
239
+ function managedAppUsage(command) {
240
+ return `usage: /${command} ${MANAGED_APP_TARGETS.map((target) => target.id).join("|")}`;
241
+ }
242
+ async function connectManagedApp(client, app) {
243
+ switch (app) {
244
+ case "vscode":
245
+ return connectVSCode(client);
246
+ case "pi":
247
+ return connectPi(client);
248
+ case "opencode":
249
+ return connectOpenCode(client);
250
+ case "codex":
251
+ return connectCodex(client);
252
+ }
253
+ }
254
+ async function disconnectManagedApp(client, app) {
255
+ switch (app) {
256
+ case "vscode": {
257
+ const status = await client.getVSCodeSetupStatus();
258
+ if (!status.canRemove) return { app, message: "VS Code is not connected to Gezel." };
259
+ await client.removeVSCodeSetup();
260
+ return { app, message: "disconnected VS Code; other providers and conversations were kept." };
261
+ }
262
+ case "pi": {
263
+ const status = await client.getPiSetupStatus();
264
+ if (!status.canRemove && !status.extension.canRemove) {
265
+ return { app, message: "pi is not connected to Gezel." };
266
+ }
267
+ await client.removePiSetup();
268
+ return {
269
+ app,
270
+ message: "disconnected pi; its Gezel roster, credential, and managed extension were removed."
271
+ };
272
+ }
273
+ case "opencode": {
274
+ const status = await client.getOpenCodeSetupStatus();
275
+ if (!status.canRemove && !status.plugin.canRemove) {
276
+ return { app, message: "OpenCode is not connected to Gezel." };
277
+ }
278
+ await client.removeOpenCodeSetup();
279
+ return {
280
+ app,
281
+ message: "disconnected OpenCode; Gezel\u2019s settings, credential, and managed plugin were removed."
282
+ };
283
+ }
284
+ case "codex": {
285
+ const status = await client.getCodexSetupStatus();
286
+ if (!status.canRemove) return { app, message: "Codex is not connected to Gezel." };
287
+ await client.removeCodexSetup();
288
+ return {
289
+ app,
290
+ message: "disconnected Codex; other profiles, settings, and conversations were kept."
291
+ };
292
+ }
293
+ }
294
+ }
295
+ async function listConnectedManagedApps(client) {
296
+ const [vscode, pi, opencode, codex] = await Promise.all([
297
+ client.getVSCodeSetupStatus(),
298
+ client.getPiSetupStatus(),
299
+ client.getOpenCodeSetupStatus(),
300
+ client.getCodexSetupStatus()
301
+ ]);
302
+ return [
303
+ ...vscode.canRemove ? ["vscode"] : [],
304
+ ...pi.canRemove || pi.extension.canRemove ? ["pi"] : [],
305
+ ...opencode.canRemove || opencode.plugin.canRemove ? ["opencode"] : [],
306
+ ...codex.canRemove ? ["codex"] : []
307
+ ];
308
+ }
309
+ async function connectVSCode(client) {
310
+ let status = await client.getVSCodeSetupStatus();
311
+ const enabled = await enableConnectedAppsIfNeeded(client, status.endpointsEnabled);
312
+ if (enabled) status = await client.getVSCodeSetupStatus();
313
+ if (status.state !== "configured") {
314
+ assertSafeToConfigure(status, "VS Code");
315
+ const profile2 = status.profiles.find((candidate) => candidate.id === status.configuredProfileId) ?? status.profiles[0];
316
+ if (!profile2) throw new ManagedAppCommandError("VS Code has no profile Gezel can configure.");
317
+ status = await client.configureVSCode({ profileId: profile2.id });
318
+ }
319
+ const profile = status.profiles.find((candidate) => candidate.id === status.configuredProfileId) ?? status.profiles[0];
320
+ return {
321
+ app: "vscode",
322
+ message: [
323
+ `connected VS Code${profile ? ` (${profile.label})` : ""} to Gezel at ${status.bridge.baseUrl}.`,
324
+ enabled ? "Connected Apps serving was enabled." : "",
325
+ "If VS Code is open, run \u201CDeveloper: Reload Window\u201D once to load the provider."
326
+ ].filter(Boolean).join(" ")
327
+ };
328
+ }
329
+ async function connectPi(client) {
330
+ let status = await client.getPiSetupStatus();
331
+ const enabled = await enableConnectedAppsIfNeeded(client, status.endpointsEnabled);
332
+ if (enabled) status = await client.getPiSetupStatus();
333
+ if (status.state !== "configured") {
334
+ assertSafeToConfigure(status, "pi");
335
+ const model = preferredModel(status);
336
+ status = await client.configurePi({ model: model.id });
337
+ }
338
+ let extensionNote = "";
339
+ if (status.extension.canInstall && !status.extension.canReplace) {
340
+ status = await client.installPiExtension();
341
+ extensionNote = "The managed pi extension was installed.";
342
+ } else if (status.extension.canReplace) {
343
+ extensionNote = "A conflicting pi extension was preserved; use the desktop Settings flow to review it.";
344
+ } else if (status.extension.state === "unsupported") {
345
+ extensionNote = "pi was not found, so use the launch command after installing it.";
346
+ }
347
+ return {
348
+ app: "pi",
349
+ message: integrationSuccessMessage("pi", status, enabled, extensionNote)
350
+ };
351
+ }
352
+ async function connectOpenCode(client) {
353
+ let status = await client.getOpenCodeSetupStatus();
354
+ const enabled = await enableConnectedAppsIfNeeded(client, status.endpointsEnabled);
355
+ if (enabled) status = await client.getOpenCodeSetupStatus();
356
+ if (status.state !== "configured") {
357
+ assertSafeToConfigure(status, "OpenCode");
358
+ const model = preferredModel(status);
359
+ status = await client.configureOpenCode({ model: model.id });
360
+ }
361
+ let pluginNote = "";
362
+ if (status.plugin.canInstall && !status.plugin.canReplace) {
363
+ status = await client.installOpenCodePlugin();
364
+ pluginNote = "The managed OpenCode plugin was installed.";
365
+ } else if (status.plugin.canReplace) {
366
+ pluginNote = "A conflicting OpenCode plugin was preserved; use the desktop Settings flow to review it.";
367
+ } else if (status.plugin.state === "unsupported") {
368
+ pluginNote = "OpenCode was not found, so use the launch command after installing it.";
369
+ }
370
+ return {
371
+ app: "opencode",
372
+ message: integrationSuccessMessage("OpenCode", status, enabled, pluginNote)
373
+ };
374
+ }
375
+ async function connectCodex(client) {
376
+ let status = await client.getCodexSetupStatus();
377
+ const enabled = await enableConnectedAppsIfNeeded(client, status.endpointsEnabled);
378
+ if (enabled) status = await client.getCodexSetupStatus();
379
+ if (status.state !== "configured") {
380
+ assertSafeToConfigure(status, "Codex");
381
+ const model = preferredModel(status);
382
+ status = await client.configureCodex({ model: model.id });
383
+ }
384
+ return {
385
+ app: "codex",
386
+ message: integrationSuccessMessage("Codex", status, enabled)
387
+ };
388
+ }
389
+ async function enableConnectedAppsIfNeeded(client, endpointsEnabled) {
390
+ if (endpointsEnabled) return false;
391
+ const config = await client.getConfig();
392
+ await client.updateConfig({
393
+ openaiEndpoints: {
394
+ ...config.openaiEndpoints,
395
+ enabled: true
396
+ }
397
+ });
398
+ return true;
399
+ }
400
+ function preferredModel(status) {
401
+ const model = status.models.find((candidate) => candidate.id === status.configuredModel) ?? status.models.find((candidate) => candidate.id === status.recommendedModel) ?? status.models[0];
402
+ if (!model) {
403
+ throw new ManagedAppCommandError(
404
+ "No compatible local gezel or tool-capable model is available for this integration."
405
+ );
406
+ }
407
+ return model;
408
+ }
409
+ function assertSafeToConfigure(status, label) {
410
+ if (status.state === "conflict") {
411
+ throw new ManagedAppCommandError(
412
+ `${label} setup has a conflict${status.message ? `: ${status.message}` : "."} Nothing was overwritten; use Settings \u2192 Connected Apps to review and repair it.`
413
+ );
414
+ }
415
+ if (status.state === "unavailable" || !status.canConfigure) {
416
+ const reason = status.message ?? status.reasons[0];
417
+ throw new ManagedAppCommandError(
418
+ reason ? `${label} cannot be connected: ${reason}` : `${label} cannot be connected right now.`
419
+ );
420
+ }
421
+ }
422
+ function integrationSuccessMessage(label, status, enabled, extra = "") {
423
+ const selected = status.models.find((candidate) => candidate.id === status.configuredModel);
424
+ return [
425
+ `connected ${label} to Gezel at ${status.bridge.baseUrl}${selected ? `; default ${selected.label}` : ""}.`,
426
+ enabled ? "Connected Apps serving was enabled." : "",
427
+ extra,
428
+ `Start it with: ${status.launchCommand}`
429
+ ].filter(Boolean).join(" ");
430
+ }
431
+
201
432
  // src/tui/open-command.ts
202
433
  var MAX_RECENT_REFERENCES = 12;
203
434
  function rememberCliOpenReferences(current, observed, max = MAX_RECENT_REFERENCES) {
@@ -325,6 +556,8 @@ var SLASH_COMMANDS = [
325
556
  { name: "do", description: "do a task from a craftbook" },
326
557
  { name: "continue", description: "process due and active project tasks" },
327
558
  { name: "nightshift", description: "start, stop, or list night-shift work" },
559
+ { name: "connect", description: "connect a local app to Gezel" },
560
+ { name: "disconnect", description: "remove Gezel from a connected local app" },
328
561
  { name: "focus", description: "send into another active chat" },
329
562
  { name: "cli", description: "make bare input run shell commands" },
330
563
  { name: "chat", description: "make bare input message your gezel" },
@@ -381,6 +614,20 @@ function parseProjectPermissionName(input) {
381
614
  return PROJECT_PERMISSIONS.find((permission) => permission.name === normalized)?.name;
382
615
  }
383
616
  function suggestSlashWordwheel(input, craftbooks, recentReferences = []) {
617
+ const appMatch = input.match(/^\/(connect|disconnect)\s+(.*)$/i);
618
+ if (appMatch) {
619
+ const command = (appMatch[1] ?? "").toLowerCase();
620
+ const query = (appMatch[2] ?? "").trim().toLowerCase();
621
+ return MANAGED_APP_TARGETS.filter(
622
+ (target) => target.id.startsWith(query) || target.aliases.some((alias) => alias.startsWith(query))
623
+ ).map((target) => ({
624
+ key: `${command}:${target.id}`,
625
+ label: `/${command} ${target.id}`,
626
+ description: command === "connect" ? target.description : `remove Gezel\u2019s managed ${target.label} setup`,
627
+ submit: `/${command} ${target.id}`,
628
+ completion: `/${command} ${target.id}`
629
+ }));
630
+ }
384
631
  const openMatch = input.match(/^\/open\s+(.*)$/i);
385
632
  if (openMatch) {
386
633
  const query = normalizeCliOpenLookup(openMatch[1] ?? "");
@@ -1260,57 +1507,62 @@ var TABLE_LOGO = [
1260
1507
  " | /|____________|\\",
1261
1508
  " o /_| |_\\"
1262
1509
  ].join("\n");
1263
- var KIND_COLOR = {
1264
- user: "white",
1265
- pending: "yellow",
1266
- assistant: "cyan",
1267
- thinking: "magenta",
1268
- write: "yellow",
1269
- tool: "yellow",
1270
- note: "magenta",
1271
- error: "red",
1272
- shell: void 0
1510
+ var CHAT_FEED_ROW_STYLES = {
1511
+ user: { color: "white", dimColor: false },
1512
+ pending: { color: "yellow", dimColor: true },
1513
+ assistant: { color: "cyan", dimColor: false },
1514
+ thinking: { color: "magentaBright", dimColor: false },
1515
+ write: { color: "yellow", dimColor: true },
1516
+ tool: { color: "yellow", dimColor: false },
1517
+ note: { color: "magenta", dimColor: false },
1518
+ error: { color: "red", dimColor: false },
1519
+ shell: { color: void 0, dimColor: false }
1273
1520
  };
1274
1521
  function ChatFeed(props) {
1275
1522
  const { rows, gezels, boring, focusedSessionId, visible = 16 } = props;
1276
1523
  const visibleRows = rows.filter((row) => row.kind !== "write" || row.text.length > 0);
1277
1524
  const shown = visibleRows.slice(Math.max(0, visibleRows.length - visible));
1278
- return /* @__PURE__ */ jsx(Box, { flexDirection: "column", flexGrow: 1, marginBottom: 1, children: shown.length === 0 ? /* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
1279
- /* @__PURE__ */ jsx(Text, { color: "yellow", children: TABLE_LOGO }),
1280
- /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginLeft: 3, children: [
1281
- /* @__PURE__ */ jsxs(Text, { children: [
1282
- "gezel ",
1283
- GEZEL_VERSION
1284
- ] }),
1285
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Type a message to begin" }),
1286
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "/help for commands" })
1287
- ] })
1288
- ] }) : shown.map((row) => {
1289
- if (row.kind === "shell" && row.sessionId.startsWith("term-")) {
1290
- return /* @__PURE__ */ jsx(Text, { wrap: "wrap", children: clip(row.text) }, row.key);
1291
- }
1292
- const who = row.kind === "user" ? "you" : row.kind === "pending" ? "pending" : row.kind === "thinking" ? "thinking" : row.kind === "write" ? "writing" : row.gezelId ? gezelLabel(row.gezelId, gezels, boring) : row.kind === "tool" ? "tool" : row.kind === "shell" ? "shell" : row.kind === "error" ? "error" : "system";
1293
- const isFocused = focusedSessionId && row.sessionId === focusedSessionId;
1294
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
1295
- /* @__PURE__ */ jsx(Text, { dimColor: !isFocused, color: isFocused ? "green" : void 0, children: isFocused ? "\u258E" : " " }),
1296
- /* @__PURE__ */ jsxs(Text, { wrap: "wrap", children: [
1297
- /* @__PURE__ */ jsxs(Text, { bold: true, color: KIND_COLOR[row.kind], children: [
1298
- who,
1299
- ": "
1300
- ] }),
1301
- /* @__PURE__ */ jsx(
1302
- Text,
1303
- {
1304
- color: KIND_COLOR[row.kind],
1305
- dimColor: row.kind === "pending" || row.kind === "thinking" || row.kind === "write",
1306
- children: clip(
1525
+ return /* @__PURE__ */ jsx(
1526
+ Box,
1527
+ {
1528
+ flexDirection: "column",
1529
+ flexGrow: 1,
1530
+ maxHeight: visible,
1531
+ overflowY: "hidden",
1532
+ justifyContent: "flex-end",
1533
+ marginBottom: 1,
1534
+ children: shown.length === 0 ? /* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
1535
+ /* @__PURE__ */ jsx(Text, { color: "yellow", children: TABLE_LOGO }),
1536
+ /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginLeft: 3, children: [
1537
+ /* @__PURE__ */ jsxs(Text, { children: [
1538
+ "gezel ",
1539
+ GEZEL_VERSION
1540
+ ] }),
1541
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Type a message to begin" }),
1542
+ /* @__PURE__ */ jsx(Text, { dimColor: true, children: "/help for commands" })
1543
+ ] })
1544
+ ] }) : shown.map((row) => {
1545
+ const rowStyle = CHAT_FEED_ROW_STYLES[row.kind];
1546
+ if (row.kind === "shell" && row.sessionId.startsWith("term-")) {
1547
+ return /* @__PURE__ */ jsx(Box, { flexShrink: 0, children: /* @__PURE__ */ jsx(Text, { wrap: "wrap", children: clip(row.text) }) }, row.key);
1548
+ }
1549
+ const who = row.kind === "user" ? "you" : row.kind === "pending" ? "pending" : row.kind === "thinking" ? "thinking" : row.kind === "write" ? "writing" : row.gezelId ? gezelLabel(row.gezelId, gezels, boring) : row.kind === "tool" ? "tool" : row.kind === "shell" ? "shell" : row.kind === "error" ? "error" : "system";
1550
+ const isFocused = focusedSessionId && row.sessionId === focusedSessionId;
1551
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", flexShrink: 0, children: [
1552
+ /* @__PURE__ */ jsx(Text, { dimColor: !isFocused, color: isFocused ? "green" : void 0, children: isFocused ? "\u258E" : " " }),
1553
+ /* @__PURE__ */ jsxs(Text, { wrap: "wrap", children: [
1554
+ /* @__PURE__ */ jsxs(Text, { bold: true, color: rowStyle.color, children: [
1555
+ who,
1556
+ ": "
1557
+ ] }),
1558
+ /* @__PURE__ */ jsx(Text, { color: rowStyle.color, dimColor: rowStyle.dimColor, children: clip(
1307
1559
  row.taskEvent ? taskEventText(row, gezels, boring) : row.kind === "assistant" ? humanizeToolMarkup(row.text) : row.text
1308
- )
1309
- }
1310
- )
1311
- ] })
1312
- ] }, row.key);
1313
- }) });
1560
+ ) })
1561
+ ] })
1562
+ ] }, row.key);
1563
+ })
1564
+ }
1565
+ );
1314
1566
  }
1315
1567
  function taskEventText(row, gezels, boring) {
1316
1568
  const event = row.taskEvent;
@@ -1696,7 +1948,7 @@ function StandardQuestionPrompt(props) {
1696
1948
  const visibleOptions = options.slice(windowStart, windowStart + QUESTION_OPTION_WINDOW_SIZE);
1697
1949
  const submit = async (body) => {
1698
1950
  if (submitting) return;
1699
- if (!body.writeIn && (!body.selectedChoices || body.selectedChoices.length === 0)) {
1951
+ if (!body.writeIn && (!body.selectedChoices || body.selectedChoices.length === 0) && body.declined !== true && body.silentSkip !== true) {
1700
1952
  setError("Choose an option or supply your own response.");
1701
1953
  return;
1702
1954
  }
@@ -1724,12 +1976,20 @@ function StandardQuestionPrompt(props) {
1724
1976
  (input, key) => {
1725
1977
  if (submitting) return;
1726
1978
  if (writing) {
1727
- if (key.escape && choices.length > 0) {
1728
- setWriting(false);
1729
- setError(null);
1979
+ if (key.escape) {
1980
+ if (choices.length > 0) {
1981
+ setWriting(false);
1982
+ setError(null);
1983
+ } else {
1984
+ void submit({ silentSkip: true });
1985
+ }
1730
1986
  }
1731
1987
  return;
1732
1988
  }
1989
+ if (key.escape) {
1990
+ void submit({ silentSkip: true });
1991
+ return;
1992
+ }
1733
1993
  if (key.upArrow) {
1734
1994
  setOptionIndex((index) => index <= 0 ? Math.max(0, options.length - 1) : index - 1);
1735
1995
  return;
@@ -1777,7 +2037,7 @@ function StandardQuestionPrompt(props) {
1777
2037
  ] }),
1778
2038
  /* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
1779
2039
  "Enter submit",
1780
- choices.length > 0 ? " \xB7 Esc return to choices" : ""
2040
+ choices.length > 0 ? " \xB7 Esc return to choices" : " \xB7 Esc skip"
1781
2041
  ] })
1782
2042
  ] }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
1783
2043
  visibleOptions.map((option, visibleIndex) => {
@@ -1794,7 +2054,8 @@ function StandardQuestionPrompt(props) {
1794
2054
  "\u2191/\u2193 choose \xB7 Enter ",
1795
2055
  multiSelect ? "toggle/submit" : "answer",
1796
2056
  multiSelect ? " \xB7 Space toggle" : "",
1797
- options.length > QUESTION_OPTION_WINDOW_SIZE ? ` \xB7 ${activeOptionIndex + 1}/${options.length}` : ""
2057
+ options.length > QUESTION_OPTION_WINDOW_SIZE ? ` \xB7 ${activeOptionIndex + 1}/${options.length}` : "",
2058
+ " \xB7 Esc skip"
1798
2059
  ] })
1799
2060
  ] }),
1800
2061
  submitting ? /* @__PURE__ */ jsx4(Text5, { color: "yellow", children: "Submitting\u2026" }) : null,
@@ -1817,10 +2078,18 @@ function NpmInstallApprovalPrompt(props) {
1817
2078
  const [submitting, setSubmitting] = useState4(false);
1818
2079
  const [error, setError] = useState4(null);
1819
2080
  const currentPackage = packages[packageIndex];
1820
- const submit = async (nextDecisions) => {
2081
+ const answer = async (body) => {
1821
2082
  if (submitting) return;
1822
2083
  setError(null);
1823
2084
  setSubmitting(true);
2085
+ try {
2086
+ onAnswered(await client.answerQuestion(question.id, body));
2087
+ } catch (err) {
2088
+ setError(err instanceof Error ? err.message : String(err));
2089
+ setSubmitting(false);
2090
+ }
2091
+ };
2092
+ const submit = (nextDecisions) => {
1824
2093
  const body = packages.length === 0 ? { declined: true } : {
1825
2094
  npmInstallDecisions: packages.map((entry, index) => ({
1826
2095
  package: entry.package,
@@ -1828,18 +2097,17 @@ function NpmInstallApprovalPrompt(props) {
1828
2097
  decision: nextDecisions[index] ?? "decline"
1829
2098
  }))
1830
2099
  };
1831
- try {
1832
- onAnswered(await client.answerQuestion(question.id, body));
1833
- } catch (err) {
1834
- setError(err instanceof Error ? err.message : String(err));
1835
- setSubmitting(false);
1836
- }
2100
+ void answer(body);
1837
2101
  };
1838
2102
  useInput3(
1839
2103
  (_input, key) => {
1840
2104
  if (submitting) return;
2105
+ if (key.escape) {
2106
+ void answer({ silentSkip: true });
2107
+ return;
2108
+ }
1841
2109
  if (!currentPackage) {
1842
- if (key.return) void submit([]);
2110
+ if (key.return) submit([]);
1843
2111
  return;
1844
2112
  }
1845
2113
  if (key.upArrow) {
@@ -1869,7 +2137,7 @@ function NpmInstallApprovalPrompt(props) {
1869
2137
  nextDecisions[packageIndex] = decision;
1870
2138
  setDecisions(nextDecisions);
1871
2139
  if (packageIndex >= packages.length - 1) {
1872
- void submit(nextDecisions);
2140
+ submit(nextDecisions);
1873
2141
  return;
1874
2142
  }
1875
2143
  const nextPackageIndex = packageIndex + 1;
@@ -1912,12 +2180,13 @@ function NpmInstallApprovalPrompt(props) {
1912
2180
  }),
1913
2181
  /* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
1914
2182
  "\u2191/\u2193 choose \xB7 Enter answer",
1915
- packageIndex > 0 ? " \xB7 \u2190 previous package" : ""
2183
+ packageIndex > 0 ? " \xB7 \u2190 previous package" : "",
2184
+ " \xB7 Esc skip"
1916
2185
  ] })
1917
2186
  ] }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
1918
2187
  /* @__PURE__ */ jsx4(Text5, { color: "red", children: "This approval has no package details." }),
1919
2188
  /* @__PURE__ */ jsx4(Text5, { color: "cyan", children: "\u203A Decline and dismiss" }),
1920
- /* @__PURE__ */ jsx4(Text5, { dimColor: true, children: "Enter dismiss" })
2189
+ /* @__PURE__ */ jsx4(Text5, { dimColor: true, children: "Enter dismiss \xB7 Esc skip" })
1921
2190
  ] }),
1922
2191
  submitting ? /* @__PURE__ */ jsx4(Text5, { color: "yellow", children: "Submitting\u2026" }) : null,
1923
2192
  error ? /* @__PURE__ */ jsx4(Text5, { color: "red", children: error }) : null
@@ -1932,7 +2201,10 @@ function toggleSet(current, value) {
1932
2201
 
1933
2202
  // src/tui/craftbook-start.ts
1934
2203
  import {
2204
+ CRAFTBOOK_CATEGORY_FAMILY_META,
2205
+ CRAFTBOOK_CATEGORY_META,
1935
2206
  CRAFTBOOK_ROLE_META,
2207
+ resolveCraftbookCategory,
1936
2208
  visibleCatalogItems
1937
2209
  } from "@bendyline/gezel";
1938
2210
  function normalizeCraftbooks(items, showWorkInProgressFeatures = false) {
@@ -1950,7 +2222,8 @@ function normalizeCraftbooks(items, showWorkInProgressFeatures = false) {
1950
2222
  source: item.sourceId === "project" ? "project" : item.sourceId === "local" ? "local" : "bundled",
1951
2223
  stepCount: manifest.steps.length,
1952
2224
  tags: manifest.tags ?? [],
1953
- role: manifest.role ?? "general"
2225
+ role: manifest.role ?? "general",
2226
+ category: resolveCraftbookCategory(manifest)
1954
2227
  });
1955
2228
  }
1956
2229
  return [...byId.values()].sort((left, right) => left.name.localeCompare(right.name));
@@ -1978,15 +2251,34 @@ function craftbookCategories(books, suggestedIds, projectType) {
1978
2251
  bookIds: projectBooks
1979
2252
  });
1980
2253
  }
1981
- for (const role of CRAFTBOOK_ROLE_META) {
1982
- const bookIds = new Set(books.filter((book) => book.role === role.id).map((book) => book.id));
1983
- if (bookIds.size === 0) continue;
1984
- categories.push({
1985
- id: `role:${role.id}`,
1986
- label: role.label,
1987
- hint: countLabel(bookIds.size),
1988
- bookIds
1989
- });
2254
+ const starterMeta = CRAFTBOOK_ROLE_META.find((role) => role.id === "project-starter");
2255
+ if (starterMeta) {
2256
+ const bookIds = new Set(
2257
+ books.filter((book) => book.role === "project-starter").map((book) => book.id)
2258
+ );
2259
+ if (bookIds.size > 0) {
2260
+ categories.push({
2261
+ id: `role:${starterMeta.id}`,
2262
+ label: starterMeta.label,
2263
+ hint: countLabel(bookIds.size),
2264
+ bookIds
2265
+ });
2266
+ }
2267
+ }
2268
+ for (const family of CRAFTBOOK_CATEGORY_FAMILY_META) {
2269
+ for (const meta of CRAFTBOOK_CATEGORY_META) {
2270
+ if (meta.family !== family.id) continue;
2271
+ const bookIds = new Set(
2272
+ books.filter((book) => book.category === meta.id).map((book) => book.id)
2273
+ );
2274
+ if (bookIds.size === 0) continue;
2275
+ categories.push({
2276
+ id: `category:${meta.id}`,
2277
+ label: meta.label,
2278
+ hint: family.id === "universal" ? countLabel(bookIds.size) : `${family.label} \xB7 ${countLabel(bookIds.size)}`,
2279
+ bookIds
2280
+ });
2281
+ }
1990
2282
  }
1991
2283
  categories.push({
1992
2284
  id: "all",
@@ -2604,6 +2896,8 @@ var HELP = [
2604
2896
  "/do \u2014 choose a craftbook and start it as a task",
2605
2897
  "/continue \u2014 process due schedules and active tasks in this project",
2606
2898
  "/nightshift start|stop|list \u2014 manage Night Shift",
2899
+ "/connect vscode|pi|opencode|codex \u2014 connect a local app to Gezel",
2900
+ "/disconnect [vscode|pi|opencode|codex] \u2014 remove one managed app setup",
2607
2901
  "/focus \u2014 send into another active chat /cli \u2014 CLI mode /chat \u2014 chat mode",
2608
2902
  "!cmd \u2014 run shell @tools \u2014 list tools @tool <name> {json} \u2014 run a tool",
2609
2903
  "/clear \u2014 clear feed /quit \u2014 exit",
@@ -3659,6 +3953,44 @@ function App(props) {
3659
3953
  }
3660
3954
  return;
3661
3955
  }
3956
+ case "connect": {
3957
+ const app = resolveManagedApp(rest);
3958
+ if (!app) return note(managedAppUsage("connect"), "error");
3959
+ note(`connecting ${app}\u2026`);
3960
+ try {
3961
+ const result = await connectManagedApp(client, app);
3962
+ note(result.message);
3963
+ } catch (err) {
3964
+ note(`could not connect ${app}: ${errMsg(err)}`, "error");
3965
+ }
3966
+ return;
3967
+ }
3968
+ case "disconnect": {
3969
+ let app = resolveManagedApp(rest);
3970
+ if (!rest.trim()) {
3971
+ try {
3972
+ const connected = await listConnectedManagedApps(client);
3973
+ if (connected.length === 0) return note("no managed local apps are connected.");
3974
+ if (connected.length > 1) {
3975
+ return note(
3976
+ `more than one app is connected (${connected.join(", ")}); ${managedAppUsage("disconnect")}`,
3977
+ "error"
3978
+ );
3979
+ }
3980
+ app = connected[0] ?? null;
3981
+ } catch (err) {
3982
+ return note(`could not inspect connected apps: ${errMsg(err)}`, "error");
3983
+ }
3984
+ }
3985
+ if (!app) return note(managedAppUsage("disconnect"), "error");
3986
+ try {
3987
+ const result = await disconnectManagedApp(client, app);
3988
+ note(result.message);
3989
+ } catch (err) {
3990
+ note(`could not disconnect ${app}: ${errMsg(err)}`, "error");
3991
+ }
3992
+ return;
3993
+ }
3662
3994
  case "focus":
3663
3995
  return setOverlay("focus");
3664
3996
  case "cli":
@@ -3849,6 +4181,7 @@ function App(props) {
3849
4181
  return;
3850
4182
  }
3851
4183
  if (key.escape) {
4184
+ if (pendingQuestion) return;
3852
4185
  if (turns.size > 0 || activeRuns.size > 0) {
3853
4186
  void cancelActiveRef.current().then((did) => did && note("interrupted."));
3854
4187
  } else if (pendingInput) {
@@ -3861,9 +4194,7 @@ function App(props) {
3861
4194
  }
3862
4195
  }
3863
4196
  },
3864
- {
3865
- isActive: overlay === null && (!pendingQuestion || pendingInput !== null || taskPrompt !== null)
3866
- }
4197
+ { isActive: overlay === null }
3867
4198
  );
3868
4199
  if (status) {
3869
4200
  return /* @__PURE__ */ jsx5(Box6, { flexDirection: "column", padding: 1, children: /* @__PURE__ */ jsx5(Text6, { color: status.startsWith("Failed") ? "red" : "cyan", children: status }) });
@@ -4644,15 +4975,17 @@ function BootstrapGate(props) {
4644
4975
  const options = [
4645
4976
  ...best ? [
4646
4977
  {
4647
- label: `Recommended workshop set \u2014 ${bootstrapChatModelLabel(best)} + ${screen.plan.accessories.length} helpers`,
4648
- hint: `${bestInstalled ? "chat model already available \xB7 " : ""}${workshopDownloadBytes > 0 ? formatDownloadSize(workshopDownloadBytes) : "already available"}${workshopHelperLabels ? ` \xB7 includes ${workshopHelperLabels}` : ""}`,
4649
- value: "bundle"
4650
- },
4651
- {
4652
- label: `${bestInstalled ? "Use" : "Download"} ${bootstrapChatModelLabel(best)} only`,
4978
+ label: `Recommended \u2014 ${bestInstalled ? "Use" : "Download"} ${bootstrapChatModelLabel(best)}`,
4653
4979
  hint: `recommended for this device \xB7 ${bestInstalled ? "already available" : formatDownloadSize(best.approxSizeBytes)}`,
4654
4980
  value: bestInstalled ? `installed:${best.id}` : `chat:${best.id}`
4655
- }
4981
+ },
4982
+ ...screen.plan.accessories.length > 0 ? [
4983
+ {
4984
+ label: `Complete workshop set \u2014 ${bootstrapChatModelLabel(best)} + ${screen.plan.accessories.length} ${screen.plan.accessories.length === 1 ? "helper" : "helpers"}`,
4985
+ hint: `optional \xB7 ${bestInstalled ? "chat model already available \xB7 " : ""}${workshopDownloadBytes > 0 ? formatDownloadSize(workshopDownloadBytes) : "already available"}${workshopHelperLabels ? ` \xB7 includes ${workshopHelperLabels}` : ""}`,
4986
+ value: "bundle"
4987
+ }
4988
+ ] : []
4656
4989
  ] : [],
4657
4990
  ...screen.plan.installedChatModels.filter((model) => model.id !== best?.id).map((model) => ({
4658
4991
  label: `Use ${model.name ?? model.id}${model.attribution ? ` (${model.attribution})` : ""}`,
@@ -4924,6 +5257,8 @@ function nativeLabel(engine) {
4924
5257
  return "local runtime helper";
4925
5258
  case "ds4-server":
4926
5259
  return "ds4";
5260
+ case "duckdb":
5261
+ return "data query engine";
4927
5262
  }
4928
5263
  }
4929
5264
  function accessoryKindLabel(model) {