@bendyline/gezel-cli 1.0.3 → 1.0.4

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
@@ -139,6 +139,7 @@ Run `gezel --help` for the full list. The most-used ones:
139
139
  |---|---|
140
140
  | `gezel` | Launch the interactive TUI |
141
141
  | `gezel run [prompt…]` | One-shot prompt in the current directory's project, using its voorman by default; optionally `--gezel <id>` / `--project <folder>` |
142
+ | `gezel do <craftbook…>` | Start a craftbook as an immediately dispatched task in the current directory's project; accepts its id or display name |
142
143
  | `gezel start` / `stop` / `status` | Use or inspect the selected service. `stop` is the same hard stop as the desktop UX: cancel work, unload local engines, and switch to Reactive. `stop --daemon` shuts down a user-owned daemon process itself. `start --web` serves the browser UI. On hosts without a Gezel machine service, a started daemon prefers the canonical port 6228 (ephemeral fallback) so third-party OpenAI clients get a stable `https://127.0.0.1:6228/v1` base URL; with a machine service installed, the service owns 6228 and started daemons use an ephemeral port (`--port` pins one explicitly). |
143
144
  | `gezel doctor` | Report on the local install |
144
145
  | `gezel mode [read-only\|reactive\|reactive+tasks\|full-play]` | Show or change how much AI activity is allowed |
package/dist/bin/gezel.js CHANGED
@@ -484,15 +484,33 @@ async function ensureProjectForFolder(client, folderPath) {
484
484
  name,
485
485
  description: `CLI workspace at ${wd}`,
486
486
  about: `${name} \u2014 working directory ${wd}. Fill in who this project is for, what's in scope, and what's explicitly out of scope.`,
487
- missionObjectives: `${name} \u2014 fill in concrete success criteria for this project.`
487
+ missionObjectives: `${name} \u2014 fill in concrete success criteria for this project.`,
488
+ mode: "solo",
489
+ workingDir: wd
488
490
  });
489
- await client.setProjectWorkingDir(created.id, wd);
490
491
  return created.id;
491
492
  }
492
493
  async function ensureCliProjectLead(client, projectId) {
493
494
  const project = await client.getProject(projectId);
494
495
  if (project.voormanGezelId) return project.voormanGezelId;
495
- if (project.mode === "solo" && project.gezelIds?.[0]) return project.gezelIds[0];
496
+ if (project.mode === "solo") {
497
+ if (project.gezelIds?.[0]) return project.gezelIds[0];
498
+ if (project.workingDir) {
499
+ const { gezels: gezels2 } = await client.listGezels();
500
+ let builder = gezels2.find(
501
+ (gezel) => gezel.templateId === "builder" || gezel.role?.trim().toLowerCase() === "builder"
502
+ );
503
+ if (!builder) {
504
+ const { name, gender } = pickRandomNameWithGender();
505
+ builder = await client.createGezelFromTemplate("builder", { name, gender });
506
+ }
507
+ const updated2 = await client.updateProject(projectId, { voormanGezelId: builder.id });
508
+ if (!updated2.voormanGezelId) {
509
+ throw new CliError(`project "${updated2.name}" has no Builder`);
510
+ }
511
+ return updated2.voormanGezelId;
512
+ }
513
+ }
496
514
  const { gezels } = await client.listGezels();
497
515
  let voorman = gezels.find(
498
516
  (gezel) => gezel.templateId === "voorman" || gezel.role?.trim().toLowerCase() === "voorman"
@@ -763,6 +781,97 @@ var init_bootstrap = __esm({
763
781
  }
764
782
  });
765
783
 
784
+ // src/tui/craftbook-start.ts
785
+ import {
786
+ CRAFTBOOK_ROLE_META,
787
+ visibleCatalogItems
788
+ } from "@bendyline/gezel";
789
+ function normalizeCraftbooks(items, showWorkInProgressFeatures = false) {
790
+ const byId = /* @__PURE__ */ new Map();
791
+ for (const item of visibleCatalogItems(items, showWorkInProgressFeatures)) {
792
+ if (item.manifest.kind !== "craftbook-template") continue;
793
+ const manifest = item.manifest;
794
+ if (byId.has(manifest.id)) continue;
795
+ byId.set(manifest.id, {
796
+ id: manifest.id,
797
+ name: manifest.name,
798
+ ...manifest.description ? { description: manifest.description } : {},
799
+ version: manifest.version,
800
+ sourceId: item.sourceId,
801
+ source: item.sourceId === "project" ? "project" : item.sourceId === "local" ? "local" : "bundled",
802
+ stepCount: manifest.steps.length,
803
+ tags: manifest.tags ?? [],
804
+ role: manifest.role ?? "general"
805
+ });
806
+ }
807
+ return [...byId.values()].sort((left, right) => left.name.localeCompare(right.name));
808
+ }
809
+ function craftbookCategories(books, suggestedIds, projectType) {
810
+ const categories = [];
811
+ const allIds = new Set(books.map((book) => book.id));
812
+ const recommended = new Set([...suggestedIds].filter((id) => allIds.has(id)));
813
+ if (recommended.size > 0) {
814
+ categories.push({
815
+ id: "recommended",
816
+ label: projectType ? `Recommended for ${projectType.label}` : "Recommended",
817
+ hint: countLabel(recommended.size),
818
+ bookIds: recommended
819
+ });
820
+ }
821
+ const projectBooks = new Set(
822
+ books.filter((book) => book.source === "project").map((book) => book.id)
823
+ );
824
+ if (projectBooks.size > 0) {
825
+ categories.push({
826
+ id: "project",
827
+ label: "Project craftbooks",
828
+ hint: countLabel(projectBooks.size),
829
+ bookIds: projectBooks
830
+ });
831
+ }
832
+ for (const role of CRAFTBOOK_ROLE_META) {
833
+ const bookIds = new Set(books.filter((book) => book.role === role.id).map((book) => book.id));
834
+ if (bookIds.size === 0) continue;
835
+ categories.push({
836
+ id: `role:${role.id}`,
837
+ label: role.label,
838
+ hint: countLabel(bookIds.size),
839
+ bookIds
840
+ });
841
+ }
842
+ categories.push({
843
+ id: "all",
844
+ label: "All craftbooks",
845
+ hint: countLabel(allIds.size),
846
+ bookIds: allIds
847
+ });
848
+ return categories;
849
+ }
850
+ function countLabel(count) {
851
+ return `${count} ${count === 1 ? "craftbook" : "craftbooks"}`;
852
+ }
853
+ function findCraftbook(books, value) {
854
+ const query = value.trim().toLowerCase();
855
+ return books.find((book) => book.id.toLowerCase() === query || book.name.toLowerCase() === query);
856
+ }
857
+ function craftbookStartRequest(book) {
858
+ const summary = book.description?.trim();
859
+ const description = summary ? `Start the "${book.name}" craftbook for this project. ${summary}` : `Start the "${book.name}" craftbook for this project. Follow every step in the recipe and verify its required outcomes before completing the task.`;
860
+ return {
861
+ title: book.name,
862
+ description,
863
+ craftbookId: book.id,
864
+ craftbookSourceId: book.sourceId,
865
+ ...book.version ? { craftbookVersion: book.version } : {},
866
+ dispatchEntry: true
867
+ };
868
+ }
869
+ var init_craftbook_start = __esm({
870
+ "src/tui/craftbook-start.ts"() {
871
+ "use strict";
872
+ }
873
+ });
874
+
766
875
  // src/tui/active-access.ts
767
876
  import * as GezelCore from "@bendyline/gezel";
768
877
  function activeAccessMode(opts) {
@@ -800,6 +909,115 @@ var init_active_access = __esm({
800
909
  }
801
910
  });
802
911
 
912
+ // src/tui/open-command.ts
913
+ function rememberCliOpenReferences(current, observed, max = MAX_RECENT_REFERENCES) {
914
+ const next = [...current];
915
+ for (const reference2 of observed) {
916
+ const index = next.findIndex((candidate) => candidate.key === reference2.key);
917
+ if (index !== -1) next.splice(index, 1);
918
+ next.unshift(reference2);
919
+ }
920
+ return next.slice(0, max);
921
+ }
922
+ function cliOpenReferencesFromEvent(env2) {
923
+ if (env2.event.type === "tool") {
924
+ return referencesFromTool(env2.event, env2.projectId);
925
+ }
926
+ if (env2.event.type === "complete" || env2.event.type === "user_message") {
927
+ return referencesFromMessage(env2.event.message, env2.projectId);
928
+ }
929
+ return [];
930
+ }
931
+ function cliOpenReferencesFromSession(session) {
932
+ let recent = [];
933
+ for (const message of session.messages) {
934
+ recent = rememberCliOpenReferences(recent, referencesFromMessage(message, session.projectId));
935
+ }
936
+ return recent;
937
+ }
938
+ function resolveCliOpenTarget(input, recentReferences) {
939
+ const query = normalizeLookup(input);
940
+ if (query === "workspace" || query === "artifacts") {
941
+ return { type: "folder", folder: query };
942
+ }
943
+ if (!query) return null;
944
+ const exact = recentReferences.find((reference2) => normalizeLookup(reference2.path) === query);
945
+ if (exact) return { type: "reference", reference: exact };
946
+ const basenameMatches = recentReferences.filter(
947
+ (reference2) => normalizeLookup(basename3(reference2.path)) === query
948
+ );
949
+ return basenameMatches.length === 1 ? { type: "reference", reference: basenameMatches[0] } : null;
950
+ }
951
+ function referencesFromMessage(message, projectId) {
952
+ const references = [];
953
+ for (const tool of message.toolCalls ?? []) {
954
+ references.push(...referencesFromTool(tool, projectId));
955
+ }
956
+ for (const path of message.referencedArtifacts ?? []) {
957
+ references.push(reference("artifact", path, projectId));
958
+ }
959
+ return references;
960
+ }
961
+ function referencesFromTool(tool, projectId) {
962
+ if (!tool.success) return [];
963
+ const references = [];
964
+ for (const media of [...tool.images ?? [], ...tool.audios ?? [], ...tool.videos ?? []]) {
965
+ references.push(reference("artifact", media.path, projectId));
966
+ }
967
+ const kind = classifyTool(tool.name);
968
+ if (!kind) return references;
969
+ const paths = tool.paths && tool.paths.length > 0 ? tool.paths : tool.path ? [tool.path] : [];
970
+ for (const path of paths) references.push(reference(kind, path, projectId));
971
+ return references;
972
+ }
973
+ function classifyTool(name) {
974
+ const normalized = name.replaceAll("-", "_").toLowerCase();
975
+ if (["read_artifact", "write_artifact"].includes(normalized)) return "artifact";
976
+ if (["read_document", "write_document"].includes(normalized)) return "document";
977
+ if ([
978
+ "readfile",
979
+ "read_file",
980
+ "read_files",
981
+ "writefile",
982
+ "write_file",
983
+ "replace_in_file",
984
+ "replace_lines",
985
+ "insert_at_marker",
986
+ "apply_patch"
987
+ ].includes(normalized)) {
988
+ return "workspace";
989
+ }
990
+ return null;
991
+ }
992
+ function reference(kind, path, projectId) {
993
+ return {
994
+ key: `${projectId}:${kind}:${normalizeLookup(path)}`,
995
+ kind,
996
+ path,
997
+ projectId
998
+ };
999
+ }
1000
+ function normalizeCliOpenLookup(value) {
1001
+ return normalizeLookup(value);
1002
+ }
1003
+ function cliOpenBasename(path) {
1004
+ return basename3(path);
1005
+ }
1006
+ function normalizeLookup(value) {
1007
+ return value.trim().replaceAll("\\", "/").toLowerCase();
1008
+ }
1009
+ function basename3(path) {
1010
+ const normalized = path.replaceAll("\\", "/");
1011
+ return normalized.slice(normalized.lastIndexOf("/") + 1);
1012
+ }
1013
+ var MAX_RECENT_REFERENCES;
1014
+ var init_open_command = __esm({
1015
+ "src/tui/open-command.ts"() {
1016
+ "use strict";
1017
+ MAX_RECENT_REFERENCES = 12;
1018
+ }
1019
+ });
1020
+
803
1021
  // src/tui/commands.ts
804
1022
  function suggestSlashCommands(input) {
805
1023
  if (!input.startsWith("/") || /\s/.test(input)) return [];
@@ -810,7 +1028,35 @@ function parseProjectPermissionName(input) {
810
1028
  const normalized = input.trim().toLowerCase();
811
1029
  return PROJECT_PERMISSIONS.find((permission) => permission.name === normalized)?.name;
812
1030
  }
813
- function suggestSlashWordwheel(input, craftbooks) {
1031
+ function suggestSlashWordwheel(input, craftbooks, recentReferences = []) {
1032
+ const openMatch = input.match(/^\/open\s+(.*)$/i);
1033
+ if (openMatch) {
1034
+ const query = normalizeCliOpenLookup(openMatch[1] ?? "");
1035
+ const matches = (candidate) => !query || normalizeCliOpenLookup(candidate).includes(query);
1036
+ const folders = ["workspace", "artifacts"].filter(matches).map((folder) => ({
1037
+ key: `open:folder:${folder}`,
1038
+ label: `/open ${folder}`,
1039
+ description: `open the project ${folder} folder`,
1040
+ submit: `/open ${folder}`,
1041
+ completion: `/open ${folder}`
1042
+ }));
1043
+ const seen = /* @__PURE__ */ new Set();
1044
+ const files = [];
1045
+ for (const reference2 of recentReferences) {
1046
+ if (seen.has(reference2.key)) continue;
1047
+ seen.add(reference2.key);
1048
+ if (!matches(reference2.path) && !matches(cliOpenBasename(reference2.path))) continue;
1049
+ files.push({
1050
+ key: `open:reference:${reference2.key}`,
1051
+ label: `/open ${reference2.path}`,
1052
+ description: `open recent ${reference2.kind}`,
1053
+ submit: `/open ${reference2.path}`,
1054
+ completion: `/open ${reference2.path}`
1055
+ });
1056
+ if (files.length >= 8) break;
1057
+ }
1058
+ return [...folders, ...files];
1059
+ }
814
1060
  const modelMatch = input.match(/^\/model\s+(.*)$/i);
815
1061
  if (modelMatch) {
816
1062
  const query = (modelMatch[1] ?? "").trim().toLowerCase();
@@ -918,6 +1164,7 @@ var init_commands = __esm({
918
1164
  "src/tui/commands.ts"() {
919
1165
  "use strict";
920
1166
  init_engagement_mode();
1167
+ init_open_command();
921
1168
  SLASH_COMMAND_WORDWHEEL_SIZE = 4;
922
1169
  SLASH_COMMANDS = [
923
1170
  { name: "help", description: "show the command reference" },
@@ -928,6 +1175,7 @@ var init_commands = __esm({
928
1175
  { name: "mode", description: "set AI activity: read-only through full play" },
929
1176
  { name: "model", description: "switch engine and model" },
930
1177
  { name: "thread", description: "switch the active chat thread" },
1178
+ { name: "open", description: "open a project folder or recent chat file" },
931
1179
  { name: "task", description: "list and manage project tasks" },
932
1180
  { name: "do", description: "do a task from a craftbook" },
933
1181
  { name: "continue", description: "process due and active project tasks" },
@@ -1133,7 +1381,8 @@ function sessionToFeedRows(session) {
1133
1381
  }
1134
1382
  function reduceTurns(turns, env2) {
1135
1383
  const { sessionId, event } = env2;
1136
- const set = (label) => new Map(turns).set(sessionId, label);
1384
+ const prior = turns.get(sessionId);
1385
+ const set = (label, outputChars = prior?.outputChars ?? 0, activeToolName = prior?.activeToolName ?? null) => new Map(turns).set(sessionId, { label, outputChars, activeToolName });
1137
1386
  const clear = () => {
1138
1387
  if (!turns.has(sessionId)) return turns;
1139
1388
  const m = new Map(turns);
@@ -1142,19 +1391,31 @@ function reduceTurns(turns, env2) {
1142
1391
  };
1143
1392
  switch (event.type) {
1144
1393
  case "user_message":
1145
- return set("thinking\u2026");
1394
+ return set("thinking\u2026", 0, null);
1146
1395
  case "queued":
1147
1396
  return set(event.aheadOf > 0 ? `queued \xB7 ${event.aheadOf} ahead` : "queued");
1148
1397
  case "intent":
1149
- return set(event.label);
1398
+ return set(event.label, void 0, null);
1150
1399
  case "engine_phase":
1151
- return set(phaseLabel(event));
1400
+ return set(phaseLabel(event, prior?.outputChars ?? 0), void 0, null);
1152
1401
  case "delta":
1153
- return set("generating");
1154
- case "tool":
1155
- return set("running tool");
1402
+ case "reasoning_delta": {
1403
+ const outputChars = (prior?.outputChars ?? 0) + event.content.length;
1404
+ return set(generationLabel(outputChars), outputChars, null);
1405
+ }
1406
+ case "tool_args_delta": {
1407
+ const outputChars = (prior?.outputChars ?? 0) + event.content.length;
1408
+ const name = event.name.trim() || prior?.activeToolName || null;
1409
+ return set(runningToolLabel(name), outputChars, name);
1410
+ }
1411
+ case "tool": {
1412
+ const name = event.name.trim() || prior?.activeToolName || null;
1413
+ return set(runningToolLabel(name), void 0, name);
1414
+ }
1415
+ case "heartbeat":
1416
+ return event.label ? set(heartbeatLabel(event.label), void 0, null) : turns;
1156
1417
  case "awaiting_gezel":
1157
- return set("awaiting gezel");
1418
+ return set("awaiting gezel", void 0, null);
1158
1419
  case "error":
1159
1420
  case "done":
1160
1421
  return clear();
@@ -1162,7 +1423,7 @@ function reduceTurns(turns, env2) {
1162
1423
  return turns;
1163
1424
  }
1164
1425
  }
1165
- function phaseLabel(event) {
1426
+ function phaseLabel(event, outputChars) {
1166
1427
  const pct = event.progress !== void 0 ? ` ${Math.round(event.progress * 100)}%` : "";
1167
1428
  switch (event.phase) {
1168
1429
  case "starting":
@@ -1172,11 +1433,26 @@ function phaseLabel(event) {
1172
1433
  case "prefill":
1173
1434
  return `reading prompt${pct}`;
1174
1435
  case "generating":
1175
- return "generating";
1436
+ return generationLabel(outputChars);
1176
1437
  default:
1177
1438
  return "ready";
1178
1439
  }
1179
1440
  }
1441
+ function generationLabel(outputChars) {
1442
+ if (!Number.isFinite(outputChars) || outputChars <= 0) return "generating";
1443
+ const tokens = Math.max(1, Math.round(outputChars / 4));
1444
+ return `generating \xB7 ~${tokens.toLocaleString("en-US")} ${tokens === 1 ? "token" : "tokens"}`;
1445
+ }
1446
+ function runningToolLabel(name) {
1447
+ return name ? `running tool \xB7 ${name}` : "running tool";
1448
+ }
1449
+ function heartbeatLabel(label) {
1450
+ const trimmed = label.trim();
1451
+ if (/^(thinking|reasoning|streaming|preparing|working)(?:\b|$)/i.test(trimmed) || /^(running|updating|searching|awaiting|using)(?:\b|$)/i.test(trimmed)) {
1452
+ return trimmed;
1453
+ }
1454
+ return runningToolLabel(trimmed || null);
1455
+ }
1180
1456
  function appendNote(rows, text, kind = "note") {
1181
1457
  const next = [
1182
1458
  ...rows,
@@ -1609,6 +1885,7 @@ function PromptLine(props) {
1609
1885
  active,
1610
1886
  history,
1611
1887
  craftbooks,
1888
+ recentOpenReferences,
1612
1889
  pendingPrompt,
1613
1890
  pendingMode,
1614
1891
  onChange,
@@ -1616,7 +1893,7 @@ function PromptLine(props) {
1616
1893
  } = props;
1617
1894
  const [cursor, setCursor] = useState2(history.length);
1618
1895
  const [suggestionIndex, setSuggestionIndex] = useState2(0);
1619
- const suggestions = active && !pendingPrompt ? suggestSlashWordwheel(value, craftbooks) : [];
1896
+ const suggestions = active && !pendingPrompt ? suggestSlashWordwheel(value, craftbooks, recentOpenReferences) : [];
1620
1897
  const activeSuggestionIndex = Math.min(suggestionIndex, Math.max(0, suggestions.length - 1));
1621
1898
  const suggestionWindowStart = Math.min(
1622
1899
  Math.max(0, activeSuggestionIndex - SLASH_COMMAND_WORDWHEEL_SIZE + 1),
@@ -1898,97 +2175,6 @@ var init_QuestionPrompt = __esm({
1898
2175
  }
1899
2176
  });
1900
2177
 
1901
- // src/tui/craftbook-start.ts
1902
- import {
1903
- CRAFTBOOK_ROLE_META,
1904
- visibleCatalogItems
1905
- } from "@bendyline/gezel";
1906
- function normalizeCraftbooks(items, showWorkInProgressFeatures = false) {
1907
- const byId = /* @__PURE__ */ new Map();
1908
- for (const item of visibleCatalogItems(items, showWorkInProgressFeatures)) {
1909
- if (item.manifest.kind !== "craftbook-template") continue;
1910
- const manifest = item.manifest;
1911
- if (byId.has(manifest.id)) continue;
1912
- byId.set(manifest.id, {
1913
- id: manifest.id,
1914
- name: manifest.name,
1915
- ...manifest.description ? { description: manifest.description } : {},
1916
- version: manifest.version,
1917
- sourceId: item.sourceId,
1918
- source: item.sourceId === "project" ? "project" : item.sourceId === "local" ? "local" : "bundled",
1919
- stepCount: manifest.steps.length,
1920
- tags: manifest.tags ?? [],
1921
- role: manifest.role ?? "general"
1922
- });
1923
- }
1924
- return [...byId.values()].sort((left, right) => left.name.localeCompare(right.name));
1925
- }
1926
- function craftbookCategories(books, suggestedIds, projectType) {
1927
- const categories = [];
1928
- const allIds = new Set(books.map((book) => book.id));
1929
- const recommended = new Set([...suggestedIds].filter((id) => allIds.has(id)));
1930
- if (recommended.size > 0) {
1931
- categories.push({
1932
- id: "recommended",
1933
- label: projectType ? `Recommended for ${projectType.label}` : "Recommended",
1934
- hint: countLabel(recommended.size),
1935
- bookIds: recommended
1936
- });
1937
- }
1938
- const projectBooks = new Set(
1939
- books.filter((book) => book.source === "project").map((book) => book.id)
1940
- );
1941
- if (projectBooks.size > 0) {
1942
- categories.push({
1943
- id: "project",
1944
- label: "Project craftbooks",
1945
- hint: countLabel(projectBooks.size),
1946
- bookIds: projectBooks
1947
- });
1948
- }
1949
- for (const role of CRAFTBOOK_ROLE_META) {
1950
- const bookIds = new Set(books.filter((book) => book.role === role.id).map((book) => book.id));
1951
- if (bookIds.size === 0) continue;
1952
- categories.push({
1953
- id: `role:${role.id}`,
1954
- label: role.label,
1955
- hint: countLabel(bookIds.size),
1956
- bookIds
1957
- });
1958
- }
1959
- categories.push({
1960
- id: "all",
1961
- label: "All craftbooks",
1962
- hint: countLabel(allIds.size),
1963
- bookIds: allIds
1964
- });
1965
- return categories;
1966
- }
1967
- function countLabel(count) {
1968
- return `${count} ${count === 1 ? "craftbook" : "craftbooks"}`;
1969
- }
1970
- function findCraftbook(books, value) {
1971
- const query = value.trim().toLowerCase();
1972
- return books.find((book) => book.id.toLowerCase() === query || book.name.toLowerCase() === query);
1973
- }
1974
- function craftbookStartRequest(book) {
1975
- const summary = book.description?.trim();
1976
- const description = summary ? `Start the "${book.name}" craftbook for this project. ${summary}` : `Start the "${book.name}" craftbook for this project. Follow every step in the recipe and verify its required outcomes before completing the task.`;
1977
- return {
1978
- title: book.name,
1979
- description,
1980
- craftbookId: book.id,
1981
- craftbookSourceId: book.sourceId,
1982
- ...book.version ? { craftbookVersion: book.version } : {},
1983
- dispatchEntry: true
1984
- };
1985
- }
1986
- var init_craftbook_start = __esm({
1987
- "src/tui/craftbook-start.ts"() {
1988
- "use strict";
1989
- }
1990
- });
1991
-
1992
2178
  // src/tui/model-picker.ts
1993
2179
  import {
1994
2180
  formatModelAttribution as formatModelAttribution2
@@ -2284,6 +2470,8 @@ function App(props) {
2284
2470
  const [value, setValue] = useState4("");
2285
2471
  const [rows, setRows] = useState4([]);
2286
2472
  const [turns, setTurns] = useState4(() => /* @__PURE__ */ new Map());
2473
+ const [recentOpenReferences, setRecentOpenReferences] = useState4([]);
2474
+ const recentOpenReferencesRef = useRef2([]);
2287
2475
  const [status, setStatus] = useState4("Connecting\u2026");
2288
2476
  const [history, setHistory] = useState4([]);
2289
2477
  const [activeRuns, setActiveRuns] = useState4(() => /* @__PURE__ */ new Set());
@@ -2294,7 +2482,7 @@ function App(props) {
2294
2482
  const pendingQuestion = pendingQuestions[0];
2295
2483
  const { rows: termRows, columns: termColumns } = useTerminalSize();
2296
2484
  const shellColumns = Math.min(500, Math.max(20, termColumns - 2));
2297
- const wordwheelCount = overlay === null && !pendingInput && !pendingQuestion ? suggestSlashWordwheel(value, craftbooks).length : 0;
2485
+ const wordwheelCount = overlay === null && !pendingInput && !pendingQuestion ? suggestSlashWordwheel(value, craftbooks, recentOpenReferences).length : 0;
2298
2486
  const wordwheelRows = wordwheelCount > 0 ? Math.min(SLASH_COMMAND_WORDWHEEL_SIZE, wordwheelCount) + 1 : 0;
2299
2487
  const questionRows = pendingQuestion ? Math.min(QUESTION_OPTION_WINDOW_SIZE, Math.max(1, questionOptionCount(pendingQuestion))) + 4 : 0;
2300
2488
  const modelPickerWindowSize = Math.max(4, Math.min(10, termRows - 12));
@@ -2313,12 +2501,16 @@ function App(props) {
2313
2501
  const effectiveModel = activeGezel?.model ?? (effectiveProvider ? config?.defaultModel?.[effectiveProvider] : void 0);
2314
2502
  const statusLabel = useMemo(() => {
2315
2503
  if (turns.size === 0) return void 0;
2316
- return focusedSessionId && turns.get(focusedSessionId) || ownSessionId && turns.get(ownSessionId) || turns.values().next().value;
2504
+ const turn = focusedSessionId && turns.get(focusedSessionId) || ownSessionId && turns.get(ownSessionId) || turns.values().next().value;
2505
+ return turn?.label;
2317
2506
  }, [turns, focusedSessionId, ownSessionId]);
2318
2507
  const note = useCallback(
2319
2508
  (text, kind = "note") => setRows((r) => appendNote(r, text, kind)),
2320
2509
  []
2321
2510
  );
2511
+ useEffect3(() => {
2512
+ recentOpenReferencesRef.current = recentOpenReferences;
2513
+ }, [recentOpenReferences]);
2322
2514
  const gezelIds = useRef2(/* @__PURE__ */ new Set());
2323
2515
  const gezelRefreshInFlight = useRef2(false);
2324
2516
  const applyGezelSnapshot = useCallback((next) => {
@@ -2365,6 +2557,12 @@ function App(props) {
2365
2557
  (env2) => {
2366
2558
  setRows((r) => reduceFeed(r, env2));
2367
2559
  setTurns((t) => reduceTurns(t, env2));
2560
+ const observedReferences = cliOpenReferencesFromEvent(env2);
2561
+ if (observedReferences.length > 0) {
2562
+ setRecentOpenReferences(
2563
+ (current) => rememberCliOpenReferences(current, observedReferences)
2564
+ );
2565
+ }
2368
2566
  const eventGezelId = env2.gezelId || (env2.event.type === "task_event" ? env2.event.gezelId : void 0);
2369
2567
  if (eventGezelId && !gezelIds.current.has(eventGezelId)) void refreshGezels();
2370
2568
  if (env2.event.type === "task_event") void refreshTasks();
@@ -2448,6 +2646,7 @@ function App(props) {
2448
2646
  setProjectName(project.name);
2449
2647
  setActiveGezelId(gezelId);
2450
2648
  setRows([]);
2649
+ setRecentOpenReferences([]);
2451
2650
  setTurns(/* @__PURE__ */ new Map());
2452
2651
  setActiveRuns(/* @__PURE__ */ new Set());
2453
2652
  setPendingInput(null);
@@ -2545,6 +2744,7 @@ function App(props) {
2545
2744
  setFocusedSessionId(session.id);
2546
2745
  setActiveThreadTitle(displayThreadTitle(session.title));
2547
2746
  setRows(sessionToFeedRows(session));
2747
+ setRecentOpenReferences(cliOpenReferencesFromSession(session));
2548
2748
  } catch (err) {
2549
2749
  note(`could not switch thread: ${errMsg(err)}`, "error");
2550
2750
  }
@@ -2564,6 +2764,7 @@ function App(props) {
2564
2764
  setFocusedSessionId(session.id);
2565
2765
  setActiveThreadTitle(displayThreadTitle(session.title));
2566
2766
  setRows([]);
2767
+ setRecentOpenReferences([]);
2567
2768
  setThreads((current) => [session, ...current.filter((item) => item.id !== session.id)]);
2568
2769
  } catch (err) {
2569
2770
  note(`could not start a thread: ${errMsg(err)}`, "error");
@@ -2757,7 +2958,10 @@ function App(props) {
2757
2958
  setOverlay(null);
2758
2959
  note(`starting ${book.name}\u2026`);
2759
2960
  try {
2760
- const created = await client.createTask(projectId, craftbookStartRequest(book));
2961
+ const created = await client.createTask(projectId, {
2962
+ ...craftbookStartRequest(book),
2963
+ roleBasedNameOnlyMode: boring
2964
+ });
2761
2965
  rememberTask(created);
2762
2966
  setManagedTaskRef(created.ref);
2763
2967
  note(`started ${created.ref} \u2014 ${created.title}`);
@@ -2765,7 +2969,7 @@ function App(props) {
2765
2969
  note(`could not start ${book.name}: ${errMsg(err)}`, "error");
2766
2970
  }
2767
2971
  },
2768
- [client, note, projectId, rememberTask]
2972
+ [boring, client, note, projectId, rememberTask]
2769
2973
  );
2770
2974
  const submitTaskPrompt = useCallback(
2771
2975
  async (raw) => {
@@ -2784,7 +2988,8 @@ function App(props) {
2784
2988
  title: text,
2785
2989
  description: `${text} \u2014 complete this task and verify that the result meets the requested outcome.`,
2786
2990
  assignee: { kind: "user" },
2787
- steps: [{ name: "Main" }]
2991
+ steps: [{ name: "Main" }],
2992
+ roleBasedNameOnlyMode: boring
2788
2993
  });
2789
2994
  rememberTask(created);
2790
2995
  setManagedTaskRef(created.ref);
@@ -2803,7 +3008,7 @@ function App(props) {
2803
3008
  note(`task update failed: ${errMsg(err)}`, "error");
2804
3009
  }
2805
3010
  },
2806
- [client, note, projectId, rememberTask, taskPrompt, tasks]
3011
+ [boring, client, note, projectId, rememberTask, taskPrompt, tasks]
2807
3012
  );
2808
3013
  const applyTaskStatus = useCallback(
2809
3014
  async (status2) => {
@@ -2968,6 +3173,33 @@ function App(props) {
2968
3173
  case "thread":
2969
3174
  await openThreadPicker();
2970
3175
  return;
3176
+ case "open": {
3177
+ const target = resolveCliOpenTarget(rest, recentOpenReferencesRef.current);
3178
+ if (!target) {
3179
+ return note(
3180
+ "usage: /open workspace|artifacts|<recent file> (type /open and a space to browse)",
3181
+ "error"
3182
+ );
3183
+ }
3184
+ try {
3185
+ if (target.type === "folder") {
3186
+ const result = await client.revealProject(projectId, target.folder);
3187
+ note(`opened ${target.folder}: ${result.path}`);
3188
+ } else {
3189
+ const result = await client.revealProjectReference(target.reference.projectId, {
3190
+ kind: target.reference.kind,
3191
+ path: target.reference.path
3192
+ });
3193
+ setRecentOpenReferences(
3194
+ (current) => rememberCliOpenReferences(current, [target.reference])
3195
+ );
3196
+ note(`revealed ${target.reference.path}: ${result.path}`);
3197
+ }
3198
+ } catch (err) {
3199
+ note(`open failed: ${errMsg(err)}`, "error");
3200
+ }
3201
+ return;
3202
+ }
2971
3203
  case "task":
2972
3204
  setManagedTaskRef(null);
2973
3205
  return setOverlay("task");
@@ -3548,6 +3780,7 @@ function App(props) {
3548
3780
  active: overlay === null && (!pendingQuestion || pendingInput !== null || taskPrompt !== null),
3549
3781
  history,
3550
3782
  craftbooks,
3783
+ recentOpenReferences,
3551
3784
  pendingPrompt: pendingInput?.promptLine ?? taskPrompt?.promptLine,
3552
3785
  pendingMode: pendingInput?.mode ?? (taskPrompt ? "text" : void 0),
3553
3786
  onChange: setValue,
@@ -3710,6 +3943,7 @@ var init_App = __esm({
3710
3943
  init_craftbook_start();
3711
3944
  init_feed();
3712
3945
  init_model_picker();
3946
+ init_open_command();
3713
3947
  init_question_queue();
3714
3948
  init_streams();
3715
3949
  HELP = [
@@ -3720,6 +3954,7 @@ var init_App = __esm({
3720
3954
  "/disallow codexedits|claudeedits \u2014 put that provider in read-only plan mode",
3721
3955
  "/mode \u2014 choose read-only, reactive, reactive+tasks, or full-play AI activity",
3722
3956
  "/thread \u2014 switch or start a chat thread",
3957
+ "/open workspace|artifacts|<recent file> \u2014 open a folder or file from chat",
3723
3958
  "/task \u2014 list, inspect, create, edit, assign, or change task status",
3724
3959
  "/do \u2014 choose a craftbook and start it as a task",
3725
3960
  "/continue \u2014 process due schedules and active tasks in this project",
@@ -4273,7 +4508,7 @@ async function installAccessory(client, model2, onEvent) {
4273
4508
  }
4274
4509
  if (terminalError) throw new Error(terminalError);
4275
4510
  }
4276
- function updateDownloadProgress(setScreen, job, index, total, event, title = "Installing local models") {
4511
+ function updateDownloadProgress(setScreen, job, index, total, event, title = "Downloading local models from Hugging Face (huggingface.co)") {
4277
4512
  let pct = null;
4278
4513
  let detail = job.label;
4279
4514
  if (event.type === "progress") {
@@ -5011,7 +5246,7 @@ var init_handboek_export = __esm({
5011
5246
  // src/bin/gezel.ts
5012
5247
  init_connection();
5013
5248
  init_engagement_mode();
5014
- import { basename as basename3 } from "path";
5249
+ import { basename as basename4 } from "path";
5015
5250
  import { GEZEL_VERSION as GEZEL_VERSION2 } from "@bendyline/gezel";
5016
5251
  import {
5017
5252
  streamChatEvents
@@ -5214,6 +5449,7 @@ function installSignalCleanup(cleanup, options = {}) {
5214
5449
  }
5215
5450
 
5216
5451
  // src/bin/gezel.ts
5452
+ init_craftbook_start();
5217
5453
  var program = new Command();
5218
5454
  program.name("gezel").description("Gezel \u2014 build a community of agents that do things.").version(GEZEL_VERSION2).option(
5219
5455
  "--connect <url>",
@@ -5239,7 +5475,7 @@ program.action(async () => {
5239
5475
  const { client } = connection;
5240
5476
  const projectId = await resolveTuiProject(client, globals);
5241
5477
  const gezelId = await ensureCliProjectLead(client, projectId);
5242
- let projectName = basename3(process.cwd()) || "workspace";
5478
+ let projectName = basename4(process.cwd()) || "workspace";
5243
5479
  try {
5244
5480
  const { projects } = await client.listProjects();
5245
5481
  projectName = projects.find((p) => p.id === projectId)?.name ?? projectName;
@@ -5549,6 +5785,28 @@ ${ev.error}`);
5549
5785
  if (conn.stop) await conn.stop();
5550
5786
  }
5551
5787
  });
5788
+ program.command("do <craftbook...>").description("Start a craftbook as a task in the current directory's project").action(async (craftbookParts) => {
5789
+ const craftbookRef = craftbookParts.join(" ").trim();
5790
+ const client = await connectOwned(cliGlobals());
5791
+ const projectId = await resolveRunProject(client, cliGlobals());
5792
+ const [config, result] = await Promise.all([
5793
+ client.getConfig(),
5794
+ client.listProjectCraftbooks(projectId)
5795
+ ]);
5796
+ const craftbooks = normalizeCraftbooks(
5797
+ result.items,
5798
+ config.showWorkInProgressFeatures === true
5799
+ );
5800
+ const book = findCraftbook(craftbooks, craftbookRef);
5801
+ if (!book) {
5802
+ throw new CliError(`craftbook not found: ${craftbookRef} (run gezel and type /do to browse)`);
5803
+ }
5804
+ const created = await client.createTask(projectId, {
5805
+ ...craftbookStartRequest(book),
5806
+ roleBasedNameOnlyMode: true
5807
+ });
5808
+ console.log(`started ${created.ref} \u2014 ${created.title}`);
5809
+ });
5552
5810
  var agent = program.command("agent").description("Manage agents");
5553
5811
  agent.command("list").description("List agents").action(async () => {
5554
5812
  const client = await connectOwned(cliGlobals());
@@ -5709,7 +5967,8 @@ task.command("create <projectId> <title>").description("Create a task with a sin
5709
5967
  title,
5710
5968
  description,
5711
5969
  assignee: opts.assignee ? { kind: "gezel", gezelId: opts.assignee } : { kind: "user" },
5712
- steps: [{ name: opts.phase }]
5970
+ steps: [{ name: opts.phase }],
5971
+ roleBasedNameOnlyMode: true
5713
5972
  });
5714
5973
  console.log(`created ${created.ref}`);
5715
5974
  }
package/dist/tui/index.js CHANGED
@@ -41,7 +41,24 @@ var CliError = class extends Error {
41
41
  async function ensureCliProjectLead(client, projectId) {
42
42
  const project = await client.getProject(projectId);
43
43
  if (project.voormanGezelId) return project.voormanGezelId;
44
- if (project.mode === "solo" && project.gezelIds?.[0]) return project.gezelIds[0];
44
+ if (project.mode === "solo") {
45
+ if (project.gezelIds?.[0]) return project.gezelIds[0];
46
+ if (project.workingDir) {
47
+ const { gezels: gezels2 } = await client.listGezels();
48
+ let builder = gezels2.find(
49
+ (gezel) => gezel.templateId === "builder" || gezel.role?.trim().toLowerCase() === "builder"
50
+ );
51
+ if (!builder) {
52
+ const { name, gender } = pickRandomNameWithGender();
53
+ builder = await client.createGezelFromTemplate("builder", { name, gender });
54
+ }
55
+ const updated2 = await client.updateProject(projectId, { voormanGezelId: builder.id });
56
+ if (!updated2.voormanGezelId) {
57
+ throw new CliError(`project "${updated2.name}" has no Builder`);
58
+ }
59
+ return updated2.voormanGezelId;
60
+ }
61
+ }
45
62
  const { gezels } = await client.listGezels();
46
63
  let voorman = gezels.find(
47
64
  (gezel) => gezel.templateId === "voorman" || gezel.role?.trim().toLowerCase() === "voorman"
@@ -140,6 +157,109 @@ function activeAccessMode(opts) {
140
157
  return GezelCore.projectWorkspaceWritable(project) ? "editable" : "read-only";
141
158
  }
142
159
 
160
+ // src/tui/open-command.ts
161
+ var MAX_RECENT_REFERENCES = 12;
162
+ function rememberCliOpenReferences(current, observed, max = MAX_RECENT_REFERENCES) {
163
+ const next = [...current];
164
+ for (const reference2 of observed) {
165
+ const index = next.findIndex((candidate) => candidate.key === reference2.key);
166
+ if (index !== -1) next.splice(index, 1);
167
+ next.unshift(reference2);
168
+ }
169
+ return next.slice(0, max);
170
+ }
171
+ function cliOpenReferencesFromEvent(env) {
172
+ if (env.event.type === "tool") {
173
+ return referencesFromTool(env.event, env.projectId);
174
+ }
175
+ if (env.event.type === "complete" || env.event.type === "user_message") {
176
+ return referencesFromMessage(env.event.message, env.projectId);
177
+ }
178
+ return [];
179
+ }
180
+ function cliOpenReferencesFromSession(session) {
181
+ let recent = [];
182
+ for (const message of session.messages) {
183
+ recent = rememberCliOpenReferences(recent, referencesFromMessage(message, session.projectId));
184
+ }
185
+ return recent;
186
+ }
187
+ function resolveCliOpenTarget(input, recentReferences) {
188
+ const query = normalizeLookup(input);
189
+ if (query === "workspace" || query === "artifacts") {
190
+ return { type: "folder", folder: query };
191
+ }
192
+ if (!query) return null;
193
+ const exact = recentReferences.find((reference2) => normalizeLookup(reference2.path) === query);
194
+ if (exact) return { type: "reference", reference: exact };
195
+ const basenameMatches = recentReferences.filter(
196
+ (reference2) => normalizeLookup(basename2(reference2.path)) === query
197
+ );
198
+ return basenameMatches.length === 1 ? { type: "reference", reference: basenameMatches[0] } : null;
199
+ }
200
+ function referencesFromMessage(message, projectId) {
201
+ const references = [];
202
+ for (const tool of message.toolCalls ?? []) {
203
+ references.push(...referencesFromTool(tool, projectId));
204
+ }
205
+ for (const path of message.referencedArtifacts ?? []) {
206
+ references.push(reference("artifact", path, projectId));
207
+ }
208
+ return references;
209
+ }
210
+ function referencesFromTool(tool, projectId) {
211
+ if (!tool.success) return [];
212
+ const references = [];
213
+ for (const media of [...tool.images ?? [], ...tool.audios ?? [], ...tool.videos ?? []]) {
214
+ references.push(reference("artifact", media.path, projectId));
215
+ }
216
+ const kind = classifyTool(tool.name);
217
+ if (!kind) return references;
218
+ const paths = tool.paths && tool.paths.length > 0 ? tool.paths : tool.path ? [tool.path] : [];
219
+ for (const path of paths) references.push(reference(kind, path, projectId));
220
+ return references;
221
+ }
222
+ function classifyTool(name) {
223
+ const normalized = name.replaceAll("-", "_").toLowerCase();
224
+ if (["read_artifact", "write_artifact"].includes(normalized)) return "artifact";
225
+ if (["read_document", "write_document"].includes(normalized)) return "document";
226
+ if ([
227
+ "readfile",
228
+ "read_file",
229
+ "read_files",
230
+ "writefile",
231
+ "write_file",
232
+ "replace_in_file",
233
+ "replace_lines",
234
+ "insert_at_marker",
235
+ "apply_patch"
236
+ ].includes(normalized)) {
237
+ return "workspace";
238
+ }
239
+ return null;
240
+ }
241
+ function reference(kind, path, projectId) {
242
+ return {
243
+ key: `${projectId}:${kind}:${normalizeLookup(path)}`,
244
+ kind,
245
+ path,
246
+ projectId
247
+ };
248
+ }
249
+ function normalizeCliOpenLookup(value) {
250
+ return normalizeLookup(value);
251
+ }
252
+ function cliOpenBasename(path) {
253
+ return basename2(path);
254
+ }
255
+ function normalizeLookup(value) {
256
+ return value.trim().replaceAll("\\", "/").toLowerCase();
257
+ }
258
+ function basename2(path) {
259
+ const normalized = path.replaceAll("\\", "/");
260
+ return normalized.slice(normalized.lastIndexOf("/") + 1);
261
+ }
262
+
143
263
  // src/tui/commands.ts
144
264
  var SLASH_COMMAND_WORDWHEEL_SIZE = 4;
145
265
  var SLASH_COMMANDS = [
@@ -151,6 +271,7 @@ var SLASH_COMMANDS = [
151
271
  { name: "mode", description: "set AI activity: read-only through full play" },
152
272
  { name: "model", description: "switch engine and model" },
153
273
  { name: "thread", description: "switch the active chat thread" },
274
+ { name: "open", description: "open a project folder or recent chat file" },
154
275
  { name: "task", description: "list and manage project tasks" },
155
276
  { name: "do", description: "do a task from a craftbook" },
156
277
  { name: "continue", description: "process due and active project tasks" },
@@ -198,7 +319,35 @@ function parseProjectPermissionName(input) {
198
319
  const normalized = input.trim().toLowerCase();
199
320
  return PROJECT_PERMISSIONS.find((permission) => permission.name === normalized)?.name;
200
321
  }
201
- function suggestSlashWordwheel(input, craftbooks) {
322
+ function suggestSlashWordwheel(input, craftbooks, recentReferences = []) {
323
+ const openMatch = input.match(/^\/open\s+(.*)$/i);
324
+ if (openMatch) {
325
+ const query = normalizeCliOpenLookup(openMatch[1] ?? "");
326
+ const matches = (candidate) => !query || normalizeCliOpenLookup(candidate).includes(query);
327
+ const folders = ["workspace", "artifacts"].filter(matches).map((folder) => ({
328
+ key: `open:folder:${folder}`,
329
+ label: `/open ${folder}`,
330
+ description: `open the project ${folder} folder`,
331
+ submit: `/open ${folder}`,
332
+ completion: `/open ${folder}`
333
+ }));
334
+ const seen = /* @__PURE__ */ new Set();
335
+ const files = [];
336
+ for (const reference2 of recentReferences) {
337
+ if (seen.has(reference2.key)) continue;
338
+ seen.add(reference2.key);
339
+ if (!matches(reference2.path) && !matches(cliOpenBasename(reference2.path))) continue;
340
+ files.push({
341
+ key: `open:reference:${reference2.key}`,
342
+ label: `/open ${reference2.path}`,
343
+ description: `open recent ${reference2.kind}`,
344
+ submit: `/open ${reference2.path}`,
345
+ completion: `/open ${reference2.path}`
346
+ });
347
+ if (files.length >= 8) break;
348
+ }
349
+ return [...folders, ...files];
350
+ }
202
351
  const modelMatch = input.match(/^\/model\s+(.*)$/i);
203
352
  if (modelMatch) {
204
353
  const query = (modelMatch[1] ?? "").trim().toLowerCase();
@@ -472,7 +621,8 @@ function sessionToFeedRows(session) {
472
621
  }
473
622
  function reduceTurns(turns, env) {
474
623
  const { sessionId, event } = env;
475
- const set = (label) => new Map(turns).set(sessionId, label);
624
+ const prior = turns.get(sessionId);
625
+ const set = (label, outputChars = prior?.outputChars ?? 0, activeToolName = prior?.activeToolName ?? null) => new Map(turns).set(sessionId, { label, outputChars, activeToolName });
476
626
  const clear = () => {
477
627
  if (!turns.has(sessionId)) return turns;
478
628
  const m = new Map(turns);
@@ -481,19 +631,31 @@ function reduceTurns(turns, env) {
481
631
  };
482
632
  switch (event.type) {
483
633
  case "user_message":
484
- return set("thinking\u2026");
634
+ return set("thinking\u2026", 0, null);
485
635
  case "queued":
486
636
  return set(event.aheadOf > 0 ? `queued \xB7 ${event.aheadOf} ahead` : "queued");
487
637
  case "intent":
488
- return set(event.label);
638
+ return set(event.label, void 0, null);
489
639
  case "engine_phase":
490
- return set(phaseLabel(event));
640
+ return set(phaseLabel(event, prior?.outputChars ?? 0), void 0, null);
491
641
  case "delta":
492
- return set("generating");
493
- case "tool":
494
- return set("running tool");
642
+ case "reasoning_delta": {
643
+ const outputChars = (prior?.outputChars ?? 0) + event.content.length;
644
+ return set(generationLabel(outputChars), outputChars, null);
645
+ }
646
+ case "tool_args_delta": {
647
+ const outputChars = (prior?.outputChars ?? 0) + event.content.length;
648
+ const name = event.name.trim() || prior?.activeToolName || null;
649
+ return set(runningToolLabel(name), outputChars, name);
650
+ }
651
+ case "tool": {
652
+ const name = event.name.trim() || prior?.activeToolName || null;
653
+ return set(runningToolLabel(name), void 0, name);
654
+ }
655
+ case "heartbeat":
656
+ return event.label ? set(heartbeatLabel(event.label), void 0, null) : turns;
495
657
  case "awaiting_gezel":
496
- return set("awaiting gezel");
658
+ return set("awaiting gezel", void 0, null);
497
659
  case "error":
498
660
  case "done":
499
661
  return clear();
@@ -501,7 +663,7 @@ function reduceTurns(turns, env) {
501
663
  return turns;
502
664
  }
503
665
  }
504
- function phaseLabel(event) {
666
+ function phaseLabel(event, outputChars) {
505
667
  const pct = event.progress !== void 0 ? ` ${Math.round(event.progress * 100)}%` : "";
506
668
  switch (event.phase) {
507
669
  case "starting":
@@ -511,11 +673,26 @@ function phaseLabel(event) {
511
673
  case "prefill":
512
674
  return `reading prompt${pct}`;
513
675
  case "generating":
514
- return "generating";
676
+ return generationLabel(outputChars);
515
677
  default:
516
678
  return "ready";
517
679
  }
518
680
  }
681
+ function generationLabel(outputChars) {
682
+ if (!Number.isFinite(outputChars) || outputChars <= 0) return "generating";
683
+ const tokens = Math.max(1, Math.round(outputChars / 4));
684
+ return `generating \xB7 ~${tokens.toLocaleString("en-US")} ${tokens === 1 ? "token" : "tokens"}`;
685
+ }
686
+ function runningToolLabel(name) {
687
+ return name ? `running tool \xB7 ${name}` : "running tool";
688
+ }
689
+ function heartbeatLabel(label) {
690
+ const trimmed = label.trim();
691
+ if (/^(thinking|reasoning|streaming|preparing|working)(?:\b|$)/i.test(trimmed) || /^(running|updating|searching|awaiting|using)(?:\b|$)/i.test(trimmed)) {
692
+ return trimmed;
693
+ }
694
+ return runningToolLabel(trimmed || null);
695
+ }
519
696
  function appendNote(rows, text, kind = "note") {
520
697
  const next = [
521
698
  ...rows,
@@ -916,6 +1093,7 @@ function PromptLine(props) {
916
1093
  active,
917
1094
  history,
918
1095
  craftbooks,
1096
+ recentOpenReferences,
919
1097
  pendingPrompt,
920
1098
  pendingMode,
921
1099
  onChange,
@@ -923,7 +1101,7 @@ function PromptLine(props) {
923
1101
  } = props;
924
1102
  const [cursor, setCursor] = useState2(history.length);
925
1103
  const [suggestionIndex, setSuggestionIndex] = useState2(0);
926
- const suggestions = active && !pendingPrompt ? suggestSlashWordwheel(value, craftbooks) : [];
1104
+ const suggestions = active && !pendingPrompt ? suggestSlashWordwheel(value, craftbooks, recentOpenReferences) : [];
927
1105
  const activeSuggestionIndex = Math.min(suggestionIndex, Math.max(0, suggestions.length - 1));
928
1106
  const suggestionWindowStart = Math.min(
929
1107
  Math.max(0, activeSuggestionIndex - SLASH_COMMAND_WORDWHEEL_SIZE + 1),
@@ -1697,6 +1875,7 @@ var HELP = [
1697
1875
  "/disallow codexedits|claudeedits \u2014 put that provider in read-only plan mode",
1698
1876
  "/mode \u2014 choose read-only, reactive, reactive+tasks, or full-play AI activity",
1699
1877
  "/thread \u2014 switch or start a chat thread",
1878
+ "/open workspace|artifacts|<recent file> \u2014 open a folder or file from chat",
1700
1879
  "/task \u2014 list, inspect, create, edit, assign, or change task status",
1701
1880
  "/do \u2014 choose a craftbook and start it as a task",
1702
1881
  "/continue \u2014 process due schedules and active tasks in this project",
@@ -1742,6 +1921,8 @@ function App(props) {
1742
1921
  const [value, setValue] = useState4("");
1743
1922
  const [rows, setRows] = useState4([]);
1744
1923
  const [turns, setTurns] = useState4(() => /* @__PURE__ */ new Map());
1924
+ const [recentOpenReferences, setRecentOpenReferences] = useState4([]);
1925
+ const recentOpenReferencesRef = useRef2([]);
1745
1926
  const [status, setStatus] = useState4("Connecting\u2026");
1746
1927
  const [history, setHistory] = useState4([]);
1747
1928
  const [activeRuns, setActiveRuns] = useState4(() => /* @__PURE__ */ new Set());
@@ -1752,7 +1933,7 @@ function App(props) {
1752
1933
  const pendingQuestion = pendingQuestions[0];
1753
1934
  const { rows: termRows, columns: termColumns } = useTerminalSize();
1754
1935
  const shellColumns = Math.min(500, Math.max(20, termColumns - 2));
1755
- const wordwheelCount = overlay === null && !pendingInput && !pendingQuestion ? suggestSlashWordwheel(value, craftbooks).length : 0;
1936
+ const wordwheelCount = overlay === null && !pendingInput && !pendingQuestion ? suggestSlashWordwheel(value, craftbooks, recentOpenReferences).length : 0;
1756
1937
  const wordwheelRows = wordwheelCount > 0 ? Math.min(SLASH_COMMAND_WORDWHEEL_SIZE, wordwheelCount) + 1 : 0;
1757
1938
  const questionRows = pendingQuestion ? Math.min(QUESTION_OPTION_WINDOW_SIZE, Math.max(1, questionOptionCount(pendingQuestion))) + 4 : 0;
1758
1939
  const modelPickerWindowSize = Math.max(4, Math.min(10, termRows - 12));
@@ -1771,12 +1952,16 @@ function App(props) {
1771
1952
  const effectiveModel = activeGezel?.model ?? (effectiveProvider ? config?.defaultModel?.[effectiveProvider] : void 0);
1772
1953
  const statusLabel = useMemo(() => {
1773
1954
  if (turns.size === 0) return void 0;
1774
- return focusedSessionId && turns.get(focusedSessionId) || ownSessionId && turns.get(ownSessionId) || turns.values().next().value;
1955
+ const turn = focusedSessionId && turns.get(focusedSessionId) || ownSessionId && turns.get(ownSessionId) || turns.values().next().value;
1956
+ return turn?.label;
1775
1957
  }, [turns, focusedSessionId, ownSessionId]);
1776
1958
  const note = useCallback(
1777
1959
  (text, kind = "note") => setRows((r) => appendNote(r, text, kind)),
1778
1960
  []
1779
1961
  );
1962
+ useEffect3(() => {
1963
+ recentOpenReferencesRef.current = recentOpenReferences;
1964
+ }, [recentOpenReferences]);
1780
1965
  const gezelIds = useRef2(/* @__PURE__ */ new Set());
1781
1966
  const gezelRefreshInFlight = useRef2(false);
1782
1967
  const applyGezelSnapshot = useCallback((next) => {
@@ -1823,6 +2008,12 @@ function App(props) {
1823
2008
  (env) => {
1824
2009
  setRows((r) => reduceFeed(r, env));
1825
2010
  setTurns((t) => reduceTurns(t, env));
2011
+ const observedReferences = cliOpenReferencesFromEvent(env);
2012
+ if (observedReferences.length > 0) {
2013
+ setRecentOpenReferences(
2014
+ (current) => rememberCliOpenReferences(current, observedReferences)
2015
+ );
2016
+ }
1826
2017
  const eventGezelId = env.gezelId || (env.event.type === "task_event" ? env.event.gezelId : void 0);
1827
2018
  if (eventGezelId && !gezelIds.current.has(eventGezelId)) void refreshGezels();
1828
2019
  if (env.event.type === "task_event") void refreshTasks();
@@ -1906,6 +2097,7 @@ function App(props) {
1906
2097
  setProjectName(project.name);
1907
2098
  setActiveGezelId(gezelId);
1908
2099
  setRows([]);
2100
+ setRecentOpenReferences([]);
1909
2101
  setTurns(/* @__PURE__ */ new Map());
1910
2102
  setActiveRuns(/* @__PURE__ */ new Set());
1911
2103
  setPendingInput(null);
@@ -2003,6 +2195,7 @@ function App(props) {
2003
2195
  setFocusedSessionId(session.id);
2004
2196
  setActiveThreadTitle(displayThreadTitle(session.title));
2005
2197
  setRows(sessionToFeedRows(session));
2198
+ setRecentOpenReferences(cliOpenReferencesFromSession(session));
2006
2199
  } catch (err) {
2007
2200
  note(`could not switch thread: ${errMsg(err)}`, "error");
2008
2201
  }
@@ -2022,6 +2215,7 @@ function App(props) {
2022
2215
  setFocusedSessionId(session.id);
2023
2216
  setActiveThreadTitle(displayThreadTitle(session.title));
2024
2217
  setRows([]);
2218
+ setRecentOpenReferences([]);
2025
2219
  setThreads((current) => [session, ...current.filter((item) => item.id !== session.id)]);
2026
2220
  } catch (err) {
2027
2221
  note(`could not start a thread: ${errMsg(err)}`, "error");
@@ -2215,7 +2409,10 @@ function App(props) {
2215
2409
  setOverlay(null);
2216
2410
  note(`starting ${book.name}\u2026`);
2217
2411
  try {
2218
- const created = await client.createTask(projectId, craftbookStartRequest(book));
2412
+ const created = await client.createTask(projectId, {
2413
+ ...craftbookStartRequest(book),
2414
+ roleBasedNameOnlyMode: boring
2415
+ });
2219
2416
  rememberTask(created);
2220
2417
  setManagedTaskRef(created.ref);
2221
2418
  note(`started ${created.ref} \u2014 ${created.title}`);
@@ -2223,7 +2420,7 @@ function App(props) {
2223
2420
  note(`could not start ${book.name}: ${errMsg(err)}`, "error");
2224
2421
  }
2225
2422
  },
2226
- [client, note, projectId, rememberTask]
2423
+ [boring, client, note, projectId, rememberTask]
2227
2424
  );
2228
2425
  const submitTaskPrompt = useCallback(
2229
2426
  async (raw) => {
@@ -2242,7 +2439,8 @@ function App(props) {
2242
2439
  title: text,
2243
2440
  description: `${text} \u2014 complete this task and verify that the result meets the requested outcome.`,
2244
2441
  assignee: { kind: "user" },
2245
- steps: [{ name: "Main" }]
2442
+ steps: [{ name: "Main" }],
2443
+ roleBasedNameOnlyMode: boring
2246
2444
  });
2247
2445
  rememberTask(created);
2248
2446
  setManagedTaskRef(created.ref);
@@ -2261,7 +2459,7 @@ function App(props) {
2261
2459
  note(`task update failed: ${errMsg(err)}`, "error");
2262
2460
  }
2263
2461
  },
2264
- [client, note, projectId, rememberTask, taskPrompt, tasks]
2462
+ [boring, client, note, projectId, rememberTask, taskPrompt, tasks]
2265
2463
  );
2266
2464
  const applyTaskStatus = useCallback(
2267
2465
  async (status2) => {
@@ -2426,6 +2624,33 @@ function App(props) {
2426
2624
  case "thread":
2427
2625
  await openThreadPicker();
2428
2626
  return;
2627
+ case "open": {
2628
+ const target = resolveCliOpenTarget(rest, recentOpenReferencesRef.current);
2629
+ if (!target) {
2630
+ return note(
2631
+ "usage: /open workspace|artifacts|<recent file> (type /open and a space to browse)",
2632
+ "error"
2633
+ );
2634
+ }
2635
+ try {
2636
+ if (target.type === "folder") {
2637
+ const result = await client.revealProject(projectId, target.folder);
2638
+ note(`opened ${target.folder}: ${result.path}`);
2639
+ } else {
2640
+ const result = await client.revealProjectReference(target.reference.projectId, {
2641
+ kind: target.reference.kind,
2642
+ path: target.reference.path
2643
+ });
2644
+ setRecentOpenReferences(
2645
+ (current) => rememberCliOpenReferences(current, [target.reference])
2646
+ );
2647
+ note(`revealed ${target.reference.path}: ${result.path}`);
2648
+ }
2649
+ } catch (err) {
2650
+ note(`open failed: ${errMsg(err)}`, "error");
2651
+ }
2652
+ return;
2653
+ }
2429
2654
  case "task":
2430
2655
  setManagedTaskRef(null);
2431
2656
  return setOverlay("task");
@@ -3006,6 +3231,7 @@ function App(props) {
3006
3231
  active: overlay === null && (!pendingQuestion || pendingInput !== null || taskPrompt !== null),
3007
3232
  history,
3008
3233
  craftbooks,
3234
+ recentOpenReferences,
3009
3235
  pendingPrompt: pendingInput?.promptLine ?? taskPrompt?.promptLine,
3010
3236
  pendingMode: pendingInput?.mode ?? (taskPrompt ? "text" : void 0),
3011
3237
  onChange: setValue,
@@ -3695,7 +3921,7 @@ async function installAccessory(client, model, onEvent) {
3695
3921
  }
3696
3922
  if (terminalError) throw new Error(terminalError);
3697
3923
  }
3698
- function updateDownloadProgress(setScreen, job, index, total, event, title = "Installing local models") {
3924
+ function updateDownloadProgress(setScreen, job, index, total, event, title = "Downloading local models from Hugging Face (huggingface.co)") {
3699
3925
  let pct = null;
3700
3926
  let detail = job.label;
3701
3927
  if (event.type === "progress") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/gezel-cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "The `gezel` command-line tool.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -44,14 +44,14 @@
44
44
  "!dist/**/*.map"
45
45
  ],
46
46
  "dependencies": {
47
- "@bendyline/gezel": "1.0.3",
48
- "@bendyline/gezel-app-sdk": "1.0.3",
49
- "@bendyline/gezel-catalog": "1.0.3",
50
- "@bendyline/gezel-client": "1.0.3",
51
- "@bendyline/gezel-service": "1.0.3",
47
+ "@bendyline/gezel": "1.0.4",
48
+ "@bendyline/gezel-app-sdk": "1.0.4",
49
+ "@bendyline/gezel-catalog": "1.0.4",
50
+ "@bendyline/gezel-client": "1.0.4",
51
+ "@bendyline/gezel-service": "1.0.4",
52
52
  "@bendyline/squisq": "2.7.1",
53
- "@bendyline/squisq-formats": "2.4.3",
54
- "@bendyline/squisq-react": "2.7.1",
53
+ "@bendyline/squisq-formats": "2.4.4",
54
+ "@bendyline/squisq-react": "2.7.2",
55
55
  "commander": "^15.0.0",
56
56
  "ink": "^7.1.1",
57
57
  "ink-text-input": "^6.0.0",