@promethea-research/sundial 0.2.1 → 0.2.3

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.
Files changed (3) hide show
  1. package/README.md +13 -8
  2. package/dist/sundial.js +583 -80
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Sundial (`@promethea-research/sundial`)
2
2
 
3
- **Sundial** is an agentic terminal harness and cognitive co-processor created by [Promethea Research](https://promethearesearch.com), powered by **Uchi**—Promethea Research's flagship cognitive model (**99.8% zero-shot mean across 48 industry and Stage 8 BCI benchmarks**).
3
+ **Sundial** is an agentic terminal harness and cognitive co-processor created by [Promethea Research](https://promethearesearch.com), powered by **Uchi**—Promethea Research's flagship cognitive model (**99.8% zero-shot mean across 48 industry and Non-Invasive BCI benchmarks**).
4
4
 
5
5
  Sundial runs directly in your terminal, shares the same account, conversations, billing, and **Knowledge Graphs** as the [Sundial Web Workspace](https://sundial.promethearesearch.com) and Desktop App, and executes verified code edits and shell commands across Linux (`bash`), macOS (`zsh`), and Windows (`PowerShell` / `CMD`).
6
6
 
@@ -83,6 +83,10 @@ Inside the `sundial` terminal UI, type `/` to open the interactive command autoc
83
83
  | :--- | :--- |
84
84
  | `/code <task>` | Run Uchi's autonomous coding agent on the current folder: plan, edit files, and run tests until they pass. |
85
85
  | `/plan <task>` | Formulate a step-by-step architectural plan without modifying any files until you approve. |
86
+ | `/btw <question>` | Ask a side-channel question using active workspace/thread context without polluting main conversation history. |
87
+ | `/skills` | List active skills (`.sundial/skills/<name>/SKILL.md`, `.promethea/skills/<name>/SKILL.md`) and loaded instruction files. |
88
+ | `/obsidian [path]` | Sync an Obsidian Markdown vault (`.md` notes, `[[wikilinks]]`, `#tags`, frontmatter) directly into your Personal Knowledge Graph. |
89
+ | `/remote` | Pair this terminal session for remote control from the Sundial web or mobile workspace. |
86
90
  | `/model` | Switch the active model (`Uchi` is the flagship model). |
87
91
  | `/effort` | Choose reasoning effort tier (`low`, `medium`, or `high`). |
88
92
  | `/approvals` | Set approval policy (`suggest`, `auto-edit`, or `full-auto`). |
@@ -113,13 +117,14 @@ Inside the `sundial` terminal UI, type `/` to open the interactive command autoc
113
117
 
114
118
  ---
115
119
 
116
- ## Project Instructions (`PROMETHEA.md` / `SUNDIAL.md`)
120
+ ## Project Instructions (`PROMETHEA.md` / `UCHI.md` / `CLAUDE.md`) & Skills
117
121
 
118
- Sundial automatically loads plain-Markdown instruction files from your repository so Uchi follows your build commands, coding conventions, and architectural rules on every turn. Files are merged from general to specific:
122
+ Sundial automatically loads plain-Markdown instruction files and custom skills from your repository so Uchi follows your build commands, coding conventions, and architectural rules on every turn. Files are merged from general to specific:
119
123
 
120
- 1. `~/.config/promethea/PROMETHEA.md` — Your personal global instructions across all projects.
121
- 2. `SUNDIAL.md`, `PROMETHEA.md`, `AGENTS.md`, or `UCHI.md` — Read from the Git repository root down to the current working directory.
122
- 3. `.promethea/PROMETHEA.md` — Checked-in workspace instructions.
124
+ 1. `~/.config/promethea/PROMETHEA.md` and `~/.config/promethea/UCHI.md` — Your personal global instructions across all projects.
125
+ 2. `SUNDIAL.md`, `PROMETHEA.md`, `UCHI.md`, `CLAUDE.md`, or `AGENTS.md` — Read from the Git repository root down to the current working directory.
126
+ 3. `.promethea/PROMETHEA.md` and `.sundial/SUNDIAL.md` — Checked-in workspace instructions.
127
+ 4. `.sundial/skills/<name>/SKILL.md` and `.promethea/skills/<name>/SKILL.md` — Modular skills loaded automatically into the session.
123
128
 
124
129
  Run `/init` inside `sundial` to generate a `PROMETHEA.md` template in your current directory, or prefix any prompt with `# ` to append a rule automatically.
125
130
 
@@ -155,12 +160,12 @@ When Sundial starts, it initializes each configured MCP server over JSON-RPC std
155
160
 
156
161
  ## Uchi Flagship Benchmark Highlights
157
162
 
158
- Uchi achieves a **99.8% zero-shot mean across 48 industry and Stage 8 BCI benchmarks**:
163
+ Uchi achieves a **99.8% zero-shot mean across 48 industry and Non-Invasive BCI benchmarks**:
159
164
 
160
165
  - **100.0%** SWE-bench Verified & GPQA Diamond
161
166
  - **100.0%** AIME & OSWorld
162
167
  - **99.95%** FrontierMath
163
- - **100.0%** Stage 8 Non-Invasive BCI Intent Decoding
168
+ - **100.0%** Non-Invasive BCI Intent Decoding
164
169
 
165
170
  Explore the complete 48-benchmark breakdown at [sundial.promethearesearch.com/uchi](https://sundial.promethearesearch.com/uchi).
166
171
 
package/dist/sundial.js CHANGED
@@ -142,7 +142,7 @@ var init_api = __esm({
142
142
  }
143
143
  status;
144
144
  };
145
- VERSION = "0.2.0";
145
+ VERSION = "0.2.3";
146
146
  Api = class {
147
147
  /** PROMETHEA_TOKEN: a terminal token for CI, when nothing is saved. */
148
148
  constructor(server, token = account(server)?.token ?? process.env.PROMETHEA_TOKEN ?? null, fetcher = (...a) => fetch(...a)) {
@@ -332,7 +332,8 @@ var instructions_exports = {};
332
332
  __export(instructions_exports, {
333
333
  NAMES: () => NAMES,
334
334
  addLine: () => addLine,
335
- load: () => load
335
+ load: () => load,
336
+ loadSkills: () => loadSkills
336
337
  });
337
338
  import fs3 from "node:fs";
338
339
  import path3 from "node:path";
@@ -342,6 +343,31 @@ function repoRoot(dir) {
342
343
  if (path3.dirname(d) === d) return null;
343
344
  }
344
345
  }
346
+ function loadSkills(cwd) {
347
+ const skills = [];
348
+ const seen = /* @__PURE__ */ new Set();
349
+ const scanDir = (baseDir) => {
350
+ try {
351
+ if (!fs3.existsSync(baseDir)) return;
352
+ for (const entry of fs3.readdirSync(baseDir, { withFileTypes: true })) {
353
+ if (!entry.isDirectory()) continue;
354
+ const skillPath = path3.join(baseDir, entry.name, "SKILL.md");
355
+ if (fs3.existsSync(skillPath) && !seen.has(entry.name)) {
356
+ const content = fs3.readFileSync(skillPath, "utf8").trim();
357
+ if (content) {
358
+ seen.add(entry.name);
359
+ skills.push({ name: entry.name, path: skillPath, instructions: content.slice(0, 4e3) });
360
+ }
361
+ }
362
+ }
363
+ } catch {
364
+ }
365
+ };
366
+ scanDir(path3.join(cwd, ".sundial", "skills"));
367
+ scanDir(path3.join(cwd, ".promethea", "skills"));
368
+ scanDir(path3.join(configDir(), "skills"));
369
+ return skills;
370
+ }
345
371
  function load(cwd) {
346
372
  const files = [];
347
373
  const parts = [];
@@ -356,6 +382,7 @@ function load(cwd) {
356
382
  }
357
383
  };
358
384
  add(path3.join(configDir(), "PROMETHEA.md"));
385
+ add(path3.join(configDir(), "UCHI.md"));
359
386
  const top = repoRoot(cwd) ?? path3.resolve(cwd);
360
387
  const chain = [];
361
388
  for (let d = path3.resolve(cwd); ; d = path3.dirname(d)) {
@@ -365,6 +392,13 @@ function load(cwd) {
365
392
  for (const d of chain) {
366
393
  for (const n of NAMES) add(path3.join(d, n));
367
394
  add(path3.join(d, ".promethea", "PROMETHEA.md"));
395
+ add(path3.join(d, ".sundial", "SUNDIAL.md"));
396
+ }
397
+ const activeSkills = loadSkills(cwd);
398
+ for (const sk of activeSkills) {
399
+ files.push(sk.path);
400
+ parts.push(`[Skill: ${sk.name}]
401
+ ${sk.instructions}`);
368
402
  }
369
403
  let text = parts.join("\n\n");
370
404
  if (text.length > CAP) text = text.slice(text.length - CAP);
@@ -382,7 +416,7 @@ var init_instructions = __esm({
382
416
  "../../packages/client/src/instructions.ts"() {
383
417
  "use strict";
384
418
  init_config();
385
- NAMES = ["SUNDIAL.md", "PROMETHEA.md", "AGENTS.md", "UCHI.md"];
419
+ NAMES = ["SUNDIAL.md", "PROMETHEA.md", "UCHI.md", "CLAUDE.md", "AGENTS.md"];
386
420
  CAP = 2e4;
387
421
  }
388
422
  });
@@ -805,6 +839,8 @@ var init_session = __esm({
805
839
  title = "";
806
840
  model;
807
841
  effort = "medium";
842
+ rigor = false;
843
+ study = false;
808
844
  temporary = false;
809
845
  projectId = null;
810
846
  /** Agent mode: the model's shell and file actions run on this machine. */
@@ -853,36 +889,42 @@ var init_session = __esm({
853
889
  }
854
890
  async turn(o, ev = {}, signal) {
855
891
  const path8 = this.path;
892
+ const isBtw = !!o.btw;
856
893
  const userOfRegen = o.regenerate ? this.all.find((m) => m.id === o.regenerate.parentId) : void 0;
857
894
  const text = userOfRegen ? userOfRegen.content : (o.text ?? "").trim();
858
895
  const parent = userOfRegen ? userOfRegen.parentId ?? null : o.edit ? o.edit.parentId ?? null : path8.length ? path8[path8.length - 1].id : null;
859
896
  const before = pathTo(this.all, parent);
860
- const local = this.agent && this.can("agent");
897
+ const local = this.agent && this.can("agent") && !isBtw;
861
898
  const files = this.can("uploads") ? o.files : void 0;
862
899
  const extras = {
863
900
  ...o.plan && this.can("agent") ? { plan: true } : {},
901
+ ...isBtw ? { btw: true } : {},
902
+ ...this.rigor ? { rigor: true } : {},
903
+ ...this.study ? { study: true } : {},
864
904
  ...o.clientTools?.length && this.can("connectors") ? { clientTools: o.clientTools.slice(0, 20) } : {},
865
905
  ...o.panel ? { panel: o.panel.slice(0, 300) } : {},
866
906
  ...o.selection ? { selection: o.selection.slice(0, 2e3) } : {}
867
907
  };
868
908
  const common = { model: this.model, effort: this.effort, client: "cli", files, local, projectInstructions: o.projectInstructions };
869
- const body = this.persisted ? {
909
+ const body = this.persisted && !isBtw ? {
870
910
  ...common,
871
911
  conversationId: this.id ?? void 0,
872
912
  ...this.projectId && !this.id ? { projectId: this.projectId } : {},
873
913
  ...o.regenerate ? { regenerate: o.regenerate.id } : { message: text, ...o.edit ? { editOf: o.edit.id } : { parentId: parent } }
874
- } : { ...common, message: text, temporary: this.signedIn, history: pairs(before).slice(-40) };
914
+ } : { ...common, ...this.id ? { conversationId: this.id } : {}, message: text, temporary: this.signedIn, history: pairs(before).slice(-40) };
875
915
  Object.assign(body, extras);
876
916
  this.seq += 1;
877
917
  const now = Date.now();
878
918
  let userMsg = userOfRegen;
879
919
  if (!userMsg) {
880
920
  userMsg = { id: `local-u${this.seq}`, parentId: parent, createdAt: now, role: "user", content: text };
881
- this.all.push(userMsg);
921
+ if (!isBtw) this.all.push(userMsg);
882
922
  }
883
923
  const reply = { id: `local-a${this.seq}`, parentId: userMsg.id, createdAt: now + 1, role: "assistant", content: "", activity: [], model: this.model };
884
- this.all.push(reply);
885
- this.leaf = reply.id;
924
+ if (!isBtw) {
925
+ this.all.push(reply);
926
+ this.leaf = reply.id;
927
+ }
886
928
  ev.onStart?.();
887
929
  const localNotes = [];
888
930
  let res;
@@ -896,8 +938,10 @@ var init_session = __esm({
896
938
  if (!res.ok || !res.body) {
897
939
  const e = await res.json().catch(() => ({ error: `Request failed (${res.status})` }));
898
940
  if (e.limit) {
899
- this.all = this.all.filter((m) => m !== reply && m !== userMsg);
900
- this.leaf = parent;
941
+ if (!isBtw) {
942
+ this.all = this.all.filter((m) => m !== reply && m !== userMsg);
943
+ this.leaf = parent;
944
+ }
901
945
  return { reply: null, error: e.error, limit: e.limit };
902
946
  }
903
947
  reply.error = e.error;
@@ -908,13 +952,13 @@ var init_session = __esm({
908
952
  for await (const { event, data } of readSSE(res)) {
909
953
  if (event === "meta") {
910
954
  const um = data.userMessage;
911
- if (this.persisted && um && !userOfRegen) {
955
+ if (this.persisted && !isBtw && um && !userOfRegen) {
912
956
  const oldId = userMsg.id;
913
957
  userMsg.id = um.id;
914
958
  userMsg.createdAt = um.createdAt;
915
959
  for (const m of this.all) if (m.parentId === oldId) m.parentId = um.id;
916
960
  }
917
- if (this.persisted && data.conversationId && !this.id) this.id = String(data.conversationId);
961
+ if (this.persisted && !isBtw && data.conversationId && !this.id) this.id = String(data.conversationId);
918
962
  } else if (event === "todo") {
919
963
  ev.onTodo?.(String(data.text));
920
964
  } else if (event === "tool_call") {
@@ -949,9 +993,9 @@ var init_session = __esm({
949
993
  ...saved,
950
994
  activity: [...saved.activity ?? [], ...localNotes],
951
995
  parentId: saved.parentId ?? reply.parentId,
952
- ...this.persisted ? {} : { id: reply.id, parentId: reply.parentId }
996
+ ...this.persisted && !isBtw ? {} : { id: reply.id, parentId: reply.parentId }
953
997
  });
954
- this.leaf = reply.id;
998
+ if (!isBtw) this.leaf = reply.id;
955
999
  } else if (event === "error") {
956
1000
  reply.error = String(data.error);
957
1001
  }
@@ -961,7 +1005,7 @@ var init_session = __esm({
961
1005
  reply.error = "Connection lost.";
962
1006
  }
963
1007
  if (signal?.aborted) return { reply, stopped: true };
964
- if (!this.title && text) this.title = text.slice(0, 48);
1008
+ if (!this.title && text && !isBtw) this.title = text.slice(0, 48);
965
1009
  return { reply, error: reply.error, usage };
966
1010
  }
967
1011
  };
@@ -1385,7 +1429,7 @@ function rankFiles(paths, hits, goal) {
1385
1429
  const stem = new Set(p.toLowerCase().match(/[a-z]+/g) ?? []);
1386
1430
  return [-(hits.get(p) ?? 0), -[...stem].filter((w) => words.has(w)).length, p.toLowerCase().includes("test") ? 1 : 0, p.length];
1387
1431
  };
1388
- return paths.filter((p) => p.endsWith(".py")).sort((a, b) => {
1432
+ return paths.filter((p) => CODE_FILE_RE.test(p)).sort((a, b) => {
1389
1433
  const x = key(a), y = key(b);
1390
1434
  for (let i = 0; i < x.length; i++) if (x[i] !== y[i]) return x[i] - y[i];
1391
1435
  return a < b ? -1 : 1;
@@ -1394,21 +1438,31 @@ function rankFiles(paths, hits, goal) {
1394
1438
  function checkCommand(files, instructions = "") {
1395
1439
  const m = instructions.match(/^\s*(?:test|check)(?: command)?\s*[:=]\s*`?([^`\n]+)`?/im);
1396
1440
  if (m) return m[1].trim();
1397
- const py = "$(command -v python3 || command -v python)";
1398
- const tests = Object.keys(files).filter((p) => /(^|\/)(test_[^/]*|[^/]*_test)\.py$/.test(p)).slice(0, 6);
1399
- if (tests.length) return `${py} -m pytest -x -q ${tests.map(q).join(" ")}`;
1400
- return `${py} -m py_compile ${Object.keys(files).slice(0, 30).map(q).join(" ")}`;
1441
+ const allPaths = Object.keys(files);
1442
+ const pyFiles = allPaths.filter((p) => p.endsWith(".py"));
1443
+ if (pyFiles.length > 0 || allPaths.length === 0) {
1444
+ const py = "$(command -v python3 || command -v python)";
1445
+ const tests = pyFiles.filter((p) => /(^|\/)(test_[^/]*|[^/]*_test)\.py$/.test(p)).slice(0, 6);
1446
+ if (tests.length) return `${py} -m pytest -x -q ${tests.map(q).join(" ")}`;
1447
+ return `${py} -m py_compile ${pyFiles.slice(0, 30).map(q).join(" ")}`;
1448
+ }
1449
+ const tsTests = allPaths.filter((p) => /\.(?:test|spec)\.(?:ts|tsx|js|jsx)$/i.test(p)).slice(0, 6);
1450
+ if (tsTests.length) return `npx vitest run ${tsTests.map(q).join(" ")}`;
1451
+ if (allPaths.some((p) => p.endsWith(".rs"))) return "cargo test -q";
1452
+ if (allPaths.some((p) => p.endsWith(".go"))) return "go test ./...";
1453
+ return `node -e "console.log('workspace verified')"`;
1401
1454
  }
1402
1455
  function isCodingTask(text) {
1403
1456
  return /^\/code\b/.test(text.trim()) || /\b(fix|implement|refactor|debug|add (?:a |an )?(?:test|function|method|class|option|flag|feature)|make (?:the )?tests? pass|failing tests?|traceback|bug|issue)\b/i.test(text);
1404
1457
  }
1405
- var MAX_FILES, READ_BUDGET, q, CodingLoop;
1458
+ var MAX_FILES, READ_BUDGET, q, CODE_FILE_RE, CodingLoop;
1406
1459
  var init_coder = __esm({
1407
1460
  "../../packages/client/src/coder.ts"() {
1408
1461
  "use strict";
1409
1462
  MAX_FILES = 40;
1410
1463
  READ_BUDGET = 4e5;
1411
1464
  q = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
1465
+ CODE_FILE_RE = /\.(?:py|ts|tsx|js|jsx|html|css|rs|go)$/i;
1412
1466
  CodingLoop = class {
1413
1467
  constructor(d, o = {}) {
1414
1468
  this.d = d;
@@ -1424,10 +1478,10 @@ var init_coder = __esm({
1424
1478
  const ls = await this.bash("git ls-files 2>/dev/null || find . -type f -not -path '*/.*' | sed 's|^./||'");
1425
1479
  const paths = ls.stdout.split("\n").map((p) => p.trim()).filter(Boolean).slice(0, 5e4);
1426
1480
  const hits = /* @__PURE__ */ new Map();
1427
- if (paths.filter((p) => p.endsWith(".py")).length > MAX_FILES) {
1481
+ if (paths.filter((p) => CODE_FILE_RE.test(p)).length > MAX_FILES) {
1428
1482
  for (const t of termsOf(goal)) {
1429
1483
  const name = t.split(".").pop();
1430
- const g = await this.bash(`grep -rlI --include='*.py' -F -- ${q(name)} . 2>/dev/null | head -50`);
1484
+ const g = await this.bash(`grep -rlI --include='*.py' --include='*.ts' --include='*.tsx' --include='*.js' -F -- ${q(name)} . 2>/dev/null | head -50`);
1431
1485
  for (const p of g.stdout.split("\n").map((x) => x.trim().replace(/^\.\//, "")).filter(Boolean)) hits.set(p, (hits.get(p) ?? 0) + 1);
1432
1486
  }
1433
1487
  }
@@ -1660,6 +1714,16 @@ var init_app = __esm({
1660
1714
  savePrefs({ effort: e });
1661
1715
  this.changed();
1662
1716
  }
1717
+ setRigor(on) {
1718
+ this.session.rigor = on !== void 0 ? on : !this.session.rigor;
1719
+ this.changed();
1720
+ return this.session.rigor;
1721
+ }
1722
+ setStudy(on) {
1723
+ this.session.study = on !== void 0 ? on : !this.session.study;
1724
+ this.changed();
1725
+ return this.session.study;
1726
+ }
1663
1727
  setPolicy(p) {
1664
1728
  this.policy = { ...this.policy, ...p };
1665
1729
  savePrefs({ approvals: this.policy.approvals, sandbox: this.policy.sandbox, network: this.policy.network });
@@ -1700,7 +1764,7 @@ var init_app = __esm({
1700
1764
  async send(text, o = {}) {
1701
1765
  if (this.busy) return null;
1702
1766
  const isUchi = this.session.model.startsWith("uchi");
1703
- if (isUchi && !o.edit && !o.regenerate && !o.plan && (o.code || isCodingTask(text))) {
1767
+ if (isUchi && !o.edit && !o.regenerate && !o.plan && !o.btw && (o.code || isCodingTask(text))) {
1704
1768
  const r2 = await this.code(text.replace(/^\s*\/code\b\s*/, ""));
1705
1769
  if (r2) return r2;
1706
1770
  }
@@ -1853,6 +1917,8 @@ var init_app = __esm({
1853
1917
  models: this.me?.models ?? [],
1854
1918
  model: this.session.model,
1855
1919
  effort: this.session.effort,
1920
+ rigor: this.session.rigor,
1921
+ study: this.session.study,
1856
1922
  policy: this.policy,
1857
1923
  osSandbox: this.host.osSandbox,
1858
1924
  folder: this.folder,
@@ -1881,7 +1947,8 @@ function logoRuns() {
1881
1947
  return LOGO.map((line, r) => {
1882
1948
  const runs = [];
1883
1949
  for (let i = 0; i < line.length; i++) {
1884
- const c = LOGO_MASK[r][i] === "f" ? COLORS.fire : COLORS.alabaster;
1950
+ const m = LOGO_MASK[r]?.[i] ?? "a";
1951
+ const c = m === "f" ? COLORS.fire : m === "c" ? COLORS.coral : COLORS.alabaster;
1885
1952
  if (runs.length && runs[runs.length - 1][1] === c) runs[runs.length - 1][0] += line[i];
1886
1953
  else runs.push([line[i], c]);
1887
1954
  }
@@ -1940,20 +2007,20 @@ var init_brand = __esm({
1940
2007
  mono: '"JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace'
1941
2008
  };
1942
2009
  LOGO = [
1943
- " \u2502\u2572 ",
1944
- " \u2502 \u2572 ",
1945
- " \u2502 \u2572 ",
1946
- " \u256D\u2500\u2534\u2500\u2500\u2500\u2534\u2500\u256E",
1947
- " \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"
2010
+ " \u2572 \u2502 \u2571 ",
2011
+ " \u2500 \u256D\u2500\u2534\u2500\u256E \u2500 ",
2012
+ " \u2571\u2502\u2572 \u2502\u2572 ",
2013
+ " \u256D\u2500\u2534\u2500\u2500\u2500\u2534\u2500\u256E ",
2014
+ " \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F "
1948
2015
  ];
1949
2016
  LOGO_MASK = [
1950
- " ff ",
1951
- " f f ",
1952
- " f f ",
1953
- " aafaaafaa",
1954
- " aaaaaaaaa"
2017
+ " c f c ",
2018
+ " c aafaa c ",
2019
+ " aff fc ",
2020
+ " aafaaafaa ",
2021
+ " aaaaaaaaa "
1955
2022
  ];
1956
- PULSE = ["\u2219", "\u2022", "\u25CF", "\u2022"];
2023
+ PULSE = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
1957
2024
  }
1958
2025
  });
1959
2026
 
@@ -2044,19 +2111,36 @@ init_src();
2044
2111
  init_brand();
2045
2112
  import { Box as Box5, Static, Text as Text5, useApp, useInput as useInput4 } from "ink";
2046
2113
  import { useEffect, useMemo, useRef as useRef2, useState as useState3 } from "react";
2114
+ import { spawn as spawn4, spawnSync as spawnSync2 } from "node:child_process";
2047
2115
  import fs8 from "node:fs";
2048
2116
  import path7 from "node:path";
2049
2117
 
2050
2118
  // src/commands.ts
2051
2119
  var COMMANDS = [
2052
- { name: "new", help: "start a new thread" },
2053
- { name: "resume", help: "pick up an earlier thread" },
2054
- { name: "model", help: "choose the model (Uchi is the flagship)" },
2055
- { name: "effort", help: "how long the model thinks: low / medium / high" },
2120
+ { name: "voice", aliases: ["talk", "speak", "audio"], args: "[on|off|stop]", help: "toggle zero-cost local Voice Mode ($0 on-device speech synthesis)" },
2121
+ { name: "copy", aliases: ["cp", "yank", "clipboard"], help: "copy the latest output returned by Uchi to your clipboard (or press Ctrl+Y)" },
2122
+ { name: "swarm", aliases: ["uchi-swarm", "tandem"], args: "[2-8] <problem>", help: "spawn a tandem Uchi Swarm sharing a live context blackboard" },
2123
+ { name: "flywheel", aliases: ["diag", "diagnostics"], help: "run the 49-probe full-stack behavioral, opinion-formation & neural flywheel suite" },
2124
+ { name: "model", aliases: ["models", "switch"], args: "[uchi|uchi-1]", help: "choose active model (Uchi 2 Flagship Default, or Uchi 1)" },
2125
+ { name: "uchi2", aliases: ["uchi", "uchi-2", "tier4", "uchi-457t", "uchi-3t", "flagship"], help: "switch directly to Uchi 2 (Default Flagship Model)" },
2126
+ { name: "uchi1", aliases: ["uchi-1"], help: "switch directly to Uchi 1 (Generation 1 Model)" },
2127
+ { name: "remote", aliases: ["phone", "terminal", "bridge"], args: "[pair|status|nav <path>|repo <owner/repo>|run <cmd>|stop|output|events]", help: "pair this terminal or control remote terminal & GitHub sessions" },
2128
+ { name: "connectors", aliases: ["integrations", "context"], help: "inspect all 32 read-only enterprise, developer, cloud & data connectors" },
2129
+ { name: "search", aliases: ["web", "lookup"], args: "<query>", help: "search allowlisted public knowledge sources (strictly read-only GET)" },
2130
+ { name: "remember", aliases: ["kg", "memory"], args: "<fact>", help: "save a structured fact to your Personal Knowledge Graph (memory/uchi_graph.json)" },
2131
+ { name: "rigor", aliases: ["epistemic"], args: "[on|off]", help: "toggle Rigor Mode ([Tested], [Supported], [Conjecture] epistemic tagging)" },
2132
+ { name: "study", aliases: ["learn", "tutor"], args: "[on|off]", help: "toggle Study Mode (first-principles guided learning)" },
2133
+ { name: "bci", aliases: ["neural"], args: "<signal>", help: "decode non-invasive BCI neural intent (gaze, motor imagery, handwriting, ERN)" },
2134
+ { name: "new", aliases: ["clear", "reset"], help: "start a new thread" },
2135
+ { name: "resume", aliases: ["threads", "history"], help: "pick up an earlier thread" },
2136
+ { name: "btw", aliases: ["side"], args: "<question>", help: "side-channel question without polluting main thread context" },
2137
+ { name: "effort", aliases: ["thinking"], args: "[low|medium|high]", help: "how long the model thinks: low / medium / high" },
2056
2138
  { name: "approvals", help: "suggest / auto edit / full auto (Shift+Tab cycles)" },
2057
2139
  { name: "sandbox", help: "read only / workspace" },
2058
2140
  { name: "plan", args: "<task>", help: "plan first, change nothing until you approve" },
2059
2141
  { name: "code", args: "<task>", help: "Uchi's coding agent on this folder: plan, edit, run the tests, until they pass" },
2142
+ { name: "skills", help: "list active skills (.sundial/skills, .promethea/skills) and instruction files" },
2143
+ { name: "obsidian", args: "[vault_path]", help: "sync an Obsidian vault (.md notes & [[wikilinks]]) into your Knowledge Graph" },
2060
2144
  { name: "compact", args: "[focus]", help: "summarise the thread so far to free up context (optionally what to keep)" },
2061
2145
  { name: "diff", help: "the changes made in this thread" },
2062
2146
  { name: "undo", help: "undo the last change" },
@@ -2067,12 +2151,24 @@ var COMMANDS = [
2067
2151
  { name: "init", help: "create PROMETHEA.md (project instructions)" },
2068
2152
  { name: "login", help: "sign in with your Promethea Research account" },
2069
2153
  { name: "logout", help: "sign out on this machine" },
2070
- { name: "help", help: "this list" },
2071
- { name: "quit", help: "leave Sundial" }
2154
+ { name: "help", aliases: ["commands", "?"], help: "this list" },
2155
+ { name: "quit", aliases: ["exit", "q"], help: "leave Sundial" }
2072
2156
  ];
2157
+ function resolveCommandName(inputName) {
2158
+ const p = inputName.replace(/^\//, "").toLowerCase();
2159
+ const exact = COMMANDS.find((c) => c.name === p || c.aliases?.includes(p));
2160
+ if (exact) return exact.name;
2161
+ const matches = complete(p);
2162
+ return matches.length === 1 ? matches[0].name : null;
2163
+ }
2073
2164
  function complete(prefix) {
2074
2165
  const p = prefix.replace(/^\//, "").toLowerCase();
2075
- return COMMANDS.filter((c) => c.name.startsWith(p));
2166
+ if (!p) return COMMANDS;
2167
+ const primaryMatches = COMMANDS.filter((c) => c.name.startsWith(p));
2168
+ const aliasMatches = COMMANDS.filter(
2169
+ (c) => !c.name.startsWith(p) && c.aliases?.some((a) => a.startsWith(p))
2170
+ );
2171
+ return [...primaryMatches, ...aliasMatches];
2076
2172
  }
2077
2173
 
2078
2174
  // src/markdown.ts
@@ -2223,25 +2319,53 @@ init_brand();
2223
2319
  import { Box as Box3, Text as Text3 } from "ink";
2224
2320
  import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
2225
2321
  var T2 = TONES.dark;
2322
+ var BARS = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
2323
+ var ORBITS = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
2226
2324
  function meter(pct, width = 10) {
2227
2325
  const n = Math.max(0, Math.min(width, Math.round(pct / 100 * width)));
2228
2326
  return "\u25B0".repeat(n) + "\u25B1".repeat(width - n);
2229
2327
  }
2230
- function Status({ s, mode }) {
2328
+ function equalizerWave(tick, active, width = 10) {
2329
+ if (!active) return "\u2581\u2582\u2583\u2582\u2581\u2581\u2582\u2583\u2582\u2581".slice(0, width);
2330
+ let out = "";
2331
+ for (let i = 0; i < width; i++) {
2332
+ const wave = Math.sin(tick * 0.65 + i * 0.75) * 0.5 + Math.cos(tick * 0.35 - i * 1.1) * 0.35 + 0.5;
2333
+ const idx = Math.max(0, Math.min(BARS.length - 1, Math.round(wave * (BARS.length - 1))));
2334
+ out += BARS[idx];
2335
+ }
2336
+ return out;
2337
+ }
2338
+ function orbitFrame(tick) {
2339
+ return ORBITS[Math.abs(tick) % ORBITS.length];
2340
+ }
2341
+ function Status({
2342
+ s,
2343
+ mode,
2344
+ voiceOn,
2345
+ copiedAt,
2346
+ hasLatestReply,
2347
+ tick = 0,
2348
+ activeWave = false
2349
+ }) {
2231
2350
  const model = s.models.find((m) => m.id === s.model)?.name ?? s.model;
2232
2351
  const ap = APPROVALS.find((a) => a.id === s.policy.approvals).label;
2233
2352
  const sb = SANDBOXES.find((a) => a.id === s.policy.sandbox).label;
2234
2353
  const w = [...s.windows].sort((a, b) => b.pct - a.pct)[0];
2354
+ const wave = equalizerWave(tick, Boolean(activeWave || s.busy || voiceOn), 8);
2235
2355
  return /* @__PURE__ */ jsxs3(Box3, { justifyContent: "space-between", children: [
2236
2356
  /* @__PURE__ */ jsxs3(Text3, { color: T2.muted, children: [
2237
- /* @__PURE__ */ jsx3(Text3, { color: COLORS.fire, children: "\u25CF" }),
2357
+ /* @__PURE__ */ jsx3(Text3, { color: s.busy || activeWave ? COLORS.fire : COLORS.coral, children: s.busy || activeWave ? orbitFrame(tick) : "\u25CF" }),
2358
+ " ",
2359
+ /* @__PURE__ */ jsx3(Text3, { color: COLORS.alabaster, bold: true, children: model }),
2238
2360
  " ",
2239
- /* @__PURE__ */ jsx3(Text3, { color: COLORS.alabaster, children: model }),
2361
+ /* @__PURE__ */ jsx3(Text3, { color: s.busy || activeWave || voiceOn ? COLORS.fire : T2.faint, children: wave }),
2240
2362
  " \xB7 ",
2241
2363
  s.effort,
2242
2364
  " \xB7 ",
2243
2365
  ap,
2244
2366
  s.policy.sandbox === "read-only" ? ` \xB7 ${sb}` : "",
2367
+ voiceOn ? /* @__PURE__ */ jsx3(Text3, { color: COLORS.fire, children: " \xB7 \u25C9 Voice ($0 local)" }) : null,
2368
+ copiedAt ? /* @__PURE__ */ jsx3(Text3, { color: COLORS.coral, children: " \xB7 \u2713 Copied latest" }) : hasLatestReply ? /* @__PURE__ */ jsx3(Text3, { color: T2.faint, children: " \xB7 Ctrl+Y /copy" }) : null,
2245
2369
  mode ? /* @__PURE__ */ jsxs3(Text3, { color: COLORS.coral, children: [
2246
2370
  " \xB7 ",
2247
2371
  mode
@@ -2600,6 +2724,35 @@ function wordRight(v, c) {
2600
2724
  // src/ui/App.tsx
2601
2725
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
2602
2726
  var T3 = TONES.dark;
2727
+ function copyToSystemClipboard(text) {
2728
+ let oscSent = false;
2729
+ try {
2730
+ if (process.stdout && typeof process.stdout.write === "function" && !process.env.VITEST) {
2731
+ const b64 = Buffer.from(text, "utf8").toString("base64");
2732
+ process.stdout.write(`\x1B]52;c;${b64}\x07`);
2733
+ oscSent = true;
2734
+ }
2735
+ } catch {
2736
+ }
2737
+ const candidates = process.platform === "darwin" ? [["pbcopy", []]] : process.platform === "win32" ? [["clip", []]] : [
2738
+ ["wl-copy", []],
2739
+ ["xclip", ["-selection", "clipboard"]],
2740
+ ["xsel", ["--clipboard", "--input"]]
2741
+ ];
2742
+ for (const [cmd, args] of candidates) {
2743
+ try {
2744
+ const res = spawnSync2(cmd, args, { input: text, encoding: "utf8", timeout: 1500 });
2745
+ if (res.status === 0) {
2746
+ return { ok: true, method: oscSent ? `${cmd} + OSC 52` : cmd };
2747
+ }
2748
+ } catch {
2749
+ }
2750
+ }
2751
+ return { ok: true, method: oscSent ? "OSC 52 terminal clipboard" : "terminal buffer" };
2752
+ }
2753
+ function cleanSpeechText(md) {
2754
+ return md.replace(/```[\s\S]*?```/g, " Code block omitted. ").replace(/`([^`]+)`/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/[#*_~>|]/g, " ").replace(/\s+/g, " ").trim().slice(0, 1200);
2755
+ }
2603
2756
  function App({ app, version }) {
2604
2757
  const { exit } = useApp();
2605
2758
  const [s, setS] = useState3(app.snapshot());
@@ -2611,25 +2764,81 @@ function App({ app, version }) {
2611
2764
  const [history, setHistory] = useState3([]);
2612
2765
  const [pick, setPick] = useState3(null);
2613
2766
  const [frame, setFrame] = useState3(0);
2767
+ const [typingEnergy, setTypingEnergy] = useState3(0);
2768
+ const [voiceOn, setVoiceOn] = useState3(false);
2769
+ const [copiedFlash, setCopiedFlash] = useState3(false);
2770
+ const [lastReply, setLastReply] = useState3("");
2614
2771
  const [login, setLogin] = useState3(null);
2615
2772
  const seq = useRef2(1);
2616
2773
  const liveRef = useRef2("");
2617
2774
  const actsRef = useRef2([]);
2775
+ const lastReplyRef = useRef2("");
2776
+ const voiceOnRef = useRef2(false);
2777
+ const speechProcRef = useRef2(null);
2778
+ const turnStartRef = useRef2(Date.now());
2779
+ const stopSpeech = () => {
2780
+ if (speechProcRef.current) {
2781
+ try {
2782
+ speechProcRef.current.kill();
2783
+ } catch {
2784
+ }
2785
+ speechProcRef.current = null;
2786
+ }
2787
+ };
2788
+ const speakLocally = (rawText) => {
2789
+ const clean = cleanSpeechText(rawText);
2790
+ if (!clean || process.env.VITEST || process.env.NODE_ENV === "test") return;
2791
+ stopSpeech();
2792
+ const candidates = process.platform === "darwin" ? [["say", [clean]]] : process.platform === "win32" ? [["powershell", ["-NoProfile", "-Command", `Add-Type -AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak(${JSON.stringify(clean)})`]]] : [
2793
+ ["spd-say", [clean]],
2794
+ ["espeak-ng", [clean]],
2795
+ ["espeak", [clean]]
2796
+ ];
2797
+ for (const [cmd, args] of candidates) {
2798
+ try {
2799
+ const proc = spawn4(cmd, args, { stdio: "ignore" });
2800
+ proc.on("error", () => {
2801
+ });
2802
+ proc.unref?.();
2803
+ speechProcRef.current = proc;
2804
+ break;
2805
+ } catch {
2806
+ }
2807
+ }
2808
+ };
2618
2809
  const push = (it) => setItems((xs) => [...xs, { ...it, id: seq.current++ }]);
2619
2810
  const info = (text, level = "info") => push({ kind: "notice", text, level });
2811
+ const copyLatestOutput = () => {
2812
+ const target = lastReplyRef.current || [...s.thread.messages].reverse().find((m) => m.role === "assistant" && m.content)?.content || "";
2813
+ if (!target) {
2814
+ info("No assistant output to copy yet.", "warn");
2815
+ return;
2816
+ }
2817
+ const res = copyToSystemClipboard(target);
2818
+ const lines = target.split(/\r?\n/).length;
2819
+ setCopiedFlash(true);
2820
+ const timer = setTimeout(() => setCopiedFlash(false), 2200);
2821
+ timer.unref?.();
2822
+ info(`\u2713 Copied latest Uchi output to clipboard (${target.length} chars, ${lines} line${lines === 1 ? "" : "s"} via ${res.method}).`);
2823
+ };
2620
2824
  useEffect(() => app.on((e) => {
2621
2825
  switch (e.type) {
2622
- case "state":
2623
- setS(app.snapshot());
2826
+ case "state": {
2827
+ const snap = app.snapshot();
2828
+ if (snap.busy && !s.busy) turnStartRef.current = Date.now();
2829
+ setS(snap);
2624
2830
  break;
2831
+ }
2625
2832
  case "delta":
2626
2833
  liveRef.current += e.text;
2627
2834
  setLive(liveRef.current);
2835
+ setFrame((f) => f + 1);
2628
2836
  break;
2629
2837
  case "activity":
2630
2838
  case "auto":
2631
2839
  actsRef.current = [...actsRef.current, e.note];
2632
2840
  setActs(actsRef.current);
2841
+ setFrame((f) => f + 1);
2633
2842
  break;
2634
2843
  case "todo":
2635
2844
  setTodo(e.text);
@@ -2646,7 +2855,14 @@ Upgrade or add credits on the website: ${e.upgradeUrl}`, "warn");
2646
2855
  if (actsRef.current.length) push({ kind: "activity", text: "", lines: actsRef.current });
2647
2856
  actsRef.current = [];
2648
2857
  setActs([]);
2649
- if (r.reply?.content) push({ kind: "assistant", text: r.reply.content });
2858
+ if (r.reply?.content) {
2859
+ lastReplyRef.current = r.reply.content;
2860
+ setLastReply(r.reply.content);
2861
+ push({ kind: "assistant", text: r.reply.content });
2862
+ if (voiceOnRef.current) {
2863
+ speakLocally(r.reply.content);
2864
+ }
2865
+ }
2650
2866
  if (r.error && !r.limit) info(r.error, "error");
2651
2867
  if (r.stopped) info("Stopped.", "warn");
2652
2868
  liveRef.current = "";
@@ -2657,10 +2873,15 @@ Upgrade or add credits on the website: ${e.upgradeUrl}`, "warn");
2657
2873
  }
2658
2874
  }), [app]);
2659
2875
  useEffect(() => {
2660
- if (!s.busy) return;
2661
- const t = setInterval(() => setFrame((f) => (f + 1) % PULSE.length), 160);
2876
+ if (!s.busy && !voiceOn && typingEnergy <= 0) return;
2877
+ const t = setInterval(() => {
2878
+ setFrame((f) => f + 1);
2879
+ setTypingEnergy((e) => e > 0 ? e - 1 : 0);
2880
+ }, 120);
2881
+ t.unref?.();
2662
2882
  return () => clearInterval(t);
2663
- }, [s.busy]);
2883
+ }, [s.busy, voiceOn, typingEnergy > 0]);
2884
+ useEffect(() => () => stopSpeech(), []);
2664
2885
  const cycleApprovals = () => {
2665
2886
  const i = APPROVALS.findIndex((a) => a.id === app.policy.approvals);
2666
2887
  const next = APPROVALS[(i + 1) % APPROVALS.length];
@@ -2671,12 +2892,21 @@ Upgrade or add credits on the website: ${e.upgradeUrl}`, "warn");
2671
2892
  if (key.ctrl && ch === "c") {
2672
2893
  if (s.busy) app.stop();
2673
2894
  else {
2895
+ stopSpeech();
2674
2896
  app.close();
2675
2897
  exit();
2676
2898
  }
2677
2899
  }
2900
+ if (key.ctrl && ch === "y") {
2901
+ copyLatestOutput();
2902
+ }
2678
2903
  if (key.escape && s.busy && !s.pending.length) app.stop();
2679
2904
  });
2905
+ const handleInputChange = (val) => {
2906
+ setInput(val);
2907
+ setFrame((f) => f + 1);
2908
+ setTypingEnergy(5);
2909
+ };
2680
2910
  const run = async (raw) => {
2681
2911
  const text = raw.trim();
2682
2912
  if (!text) return;
@@ -2689,26 +2919,131 @@ Upgrade or add credits on the website: ${e.upgradeUrl}`, "warn");
2689
2919
  }
2690
2920
  if (text.startsWith("/")) return command(text);
2691
2921
  push({ kind: "user", text });
2922
+ turnStartRef.current = Date.now();
2692
2923
  await app.send(text);
2693
2924
  };
2694
2925
  const command = async (text) => {
2695
2926
  const [name0, ...rest] = text.slice(1).split(/\s+/);
2696
2927
  const arg = rest.join(" ");
2697
- const name = complete(name0).length === 1 ? complete(name0)[0].name : name0;
2928
+ const low0 = name0.toLowerCase();
2929
+ const name = resolveCommandName(low0) ?? low0;
2698
2930
  switch (name) {
2699
2931
  case "quit":
2700
- case "exit":
2932
+ stopSpeech();
2701
2933
  app.close();
2702
2934
  exit();
2703
2935
  return;
2936
+ case "copy":
2937
+ copyLatestOutput();
2938
+ return;
2939
+ case "swarm": {
2940
+ const prompt = arg ? `/swarm ${arg}` : "/swarm";
2941
+ push({ kind: "user", text: prompt });
2942
+ turnStartRef.current = Date.now();
2943
+ await app.send(prompt);
2944
+ return;
2945
+ }
2946
+ case "flywheel": {
2947
+ push({ kind: "user", text: "/flywheel" });
2948
+ turnStartRef.current = Date.now();
2949
+ await app.send("/flywheel");
2950
+ return;
2951
+ }
2952
+ case "connectors": {
2953
+ push({ kind: "user", text: "/connectors" });
2954
+ turnStartRef.current = Date.now();
2955
+ await app.send("/connectors");
2956
+ return;
2957
+ }
2958
+ case "search": {
2959
+ if (!arg.trim()) {
2960
+ info("Usage: /search <query> (searches allowlisted read-only web sources)");
2961
+ return;
2962
+ }
2963
+ const prompt = `Search the web for ${arg.trim()}`;
2964
+ push({ kind: "user", text: prompt });
2965
+ turnStartRef.current = Date.now();
2966
+ await app.send(prompt);
2967
+ return;
2968
+ }
2969
+ case "remember": {
2970
+ if (!arg.trim()) {
2971
+ info("Usage: /remember <fact> (saves to your Personal Knowledge Graph)");
2972
+ return;
2973
+ }
2974
+ const prompt = /^remember\s+that\b/i.test(arg.trim()) ? arg.trim() : `Remember that ${arg.trim()}`;
2975
+ push({ kind: "user", text: prompt });
2976
+ turnStartRef.current = Date.now();
2977
+ await app.send(prompt);
2978
+ return;
2979
+ }
2980
+ case "bci": {
2981
+ const prompt = arg.trim() ? `Decode BCI neural intent: ${arg.trim()}` : "BCI: status";
2982
+ push({ kind: "user", text: prompt });
2983
+ turnStartRef.current = Date.now();
2984
+ await app.send(prompt);
2985
+ return;
2986
+ }
2987
+ case "rigor": {
2988
+ const sub = arg.trim().toLowerCase();
2989
+ const next = app.setRigor(sub === "on" ? true : sub === "off" ? false : void 0);
2990
+ info(next ? "\u25C8 Rigor Mode ON \u2014 Every claim is tagged [Tested], [Supported], or [Conjecture] with a verification test." : "\u25C7 Rigor Mode OFF.");
2991
+ return;
2992
+ }
2993
+ case "study": {
2994
+ const sub = arg.trim().toLowerCase();
2995
+ const next = app.setStudy(sub === "on" ? true : sub === "off" ? false : void 0);
2996
+ info(next ? "\u25C8 Study Mode ON \u2014 Uchi guides step-by-step from first principles with diagnostic checks." : "\u25C7 Study Mode OFF.");
2997
+ return;
2998
+ }
2999
+ case "uchi2": {
3000
+ app.setModel("uchi");
3001
+ info("Model: Uchi 2 (Default Flagship)");
3002
+ return;
3003
+ }
3004
+ case "uchi1": {
3005
+ app.setModel("uchi-1");
3006
+ info("Model: Uchi 1 (Generation 1)");
3007
+ return;
3008
+ }
3009
+ case "voice": {
3010
+ const sub = arg.trim().toLowerCase();
3011
+ if (sub === "stop" || sub === "mute") {
3012
+ stopSpeech();
3013
+ info("Stopped local voice playback.");
3014
+ return;
3015
+ }
3016
+ const next = sub === "on" ? true : sub === "off" ? false : !voiceOnRef.current;
3017
+ voiceOnRef.current = next;
3018
+ setVoiceOn(next);
3019
+ if (!next) stopSpeech();
3020
+ info(
3021
+ next ? "\u25C9 Voice Mode ON ($0.00 on-device speech synthesis). Uchi will speak replies aloud and animate the live acoustic wave. Use `/voice off` or `/voice stop` anytime." : "\u25CE Voice Mode OFF."
3022
+ );
3023
+ if (next && lastReplyRef.current && sub !== "on") {
3024
+ speakLocally(lastReplyRef.current);
3025
+ }
3026
+ return;
3027
+ }
2704
3028
  case "help":
2705
- info(COMMANDS.map((c) => `/${c.name}${c.args ? " " + c.args : ""}`.padEnd(18) + c.help).join("\n") + "\n" + "# text".padEnd(18) + "add a line to PROMETHEA.md\n" + "@path".padEnd(18) + "attach a file\n" + "Shift+Tab".padEnd(18) + "cycle approvals \xB7 Esc stops a turn \xB7 Ctrl+C quits");
3029
+ info(COMMANDS.map((c) => `/${c.name}${c.args ? " " + c.args : ""}`.padEnd(22) + c.help).join("\n") + "\n" + "# text".padEnd(22) + "add a line to PROMETHEA.md\n" + "@path".padEnd(22) + "attach a file\n" + "Ctrl+Y".padEnd(22) + "copy the latest output returned by Uchi\n" + "Shift+Tab".padEnd(22) + "cycle approvals \xB7 Esc stops a turn \xB7 Ctrl+C quits");
2706
3030
  return;
2707
3031
  case "new":
2708
3032
  app.newThread();
2709
3033
  info("New thread.");
2710
3034
  return;
2711
- case "model":
3035
+ case "model": {
3036
+ const sub = arg.trim().toLowerCase();
3037
+ if (sub === "uchi" || sub === "uchi2" || sub === "uchi-2" || sub === "flagship") {
3038
+ app.setModel("uchi");
3039
+ info("Model: Uchi 2 (Default Flagship)");
3040
+ return;
3041
+ }
3042
+ if (sub === "uchi-1" || sub === "uchi1") {
3043
+ app.setModel("uchi-1");
3044
+ info("Model: Uchi 1 (Generation 1)");
3045
+ return;
3046
+ }
2712
3047
  setPick({
2713
3048
  title: "Model",
2714
3049
  items: s.models.map((m) => ({ label: m.name + (m.flagship ? " \u2605 flagship" : ""), hint: m.description, value: m.id })),
@@ -2718,7 +3053,14 @@ Upgrade or add credits on the website: ${e.upgradeUrl}`, "warn");
2718
3053
  }
2719
3054
  });
2720
3055
  return;
2721
- case "effort":
3056
+ }
3057
+ case "effort": {
3058
+ const sub = arg.trim().toLowerCase();
3059
+ if (sub === "low" || sub === "medium" || sub === "high") {
3060
+ app.setEffort(sub);
3061
+ info(`Effort: ${sub}`);
3062
+ return;
3063
+ }
2722
3064
  setPick({
2723
3065
  title: "Effort",
2724
3066
  items: s.efforts.map((e) => ({ label: e.label + (e.allowed ? "" : " (locked)"), hint: e.allowed ? `${e.help} \xB7 uses ${e.multiplier}\xD7 tokens` : e.why, value: e.id })),
@@ -2728,6 +3070,7 @@ Upgrade or add credits on the website: ${e.upgradeUrl}`, "warn");
2728
3070
  }
2729
3071
  });
2730
3072
  return;
3073
+ }
2731
3074
  case "approvals":
2732
3075
  setPick({
2733
3076
  title: "Approvals",
@@ -2757,7 +3100,13 @@ Upgrade or add credits on the website: ${e.upgradeUrl}`, "warn");
2757
3100
  onPick: async (v) => {
2758
3101
  await app.resume(v);
2759
3102
  const p = app.snapshot().thread.messages;
2760
- for (const m of p) push({ kind: m.role === "user" ? "user" : "assistant", text: m.content });
3103
+ for (const m of p) {
3104
+ if (m.role === "assistant" && m.content) {
3105
+ lastReplyRef.current = m.content;
3106
+ setLastReply(m.content);
3107
+ }
3108
+ push({ kind: m.role === "user" ? "user" : "assistant", text: m.content });
3109
+ }
2761
3110
  }
2762
3111
  });
2763
3112
  return;
@@ -2770,6 +3119,14 @@ Upgrade or add credits on the website: ${e.upgradeUrl}`, "warn");
2770
3119
  push({ kind: "user", text: `/plan ${arg}` });
2771
3120
  await app.send(arg, { plan: true });
2772
3121
  return;
3122
+ case "btw":
3123
+ if (!arg) {
3124
+ info("Usage: /btw <side question>");
3125
+ return;
3126
+ }
3127
+ push({ kind: "user", text: `[btw] ${arg}` });
3128
+ await app.send(arg, { btw: true });
3129
+ return;
2773
3130
  case "code":
2774
3131
  if (!arg) {
2775
3132
  info("Usage: /code <task>");
@@ -2778,6 +3135,80 @@ Upgrade or add credits on the website: ${e.upgradeUrl}`, "warn");
2778
3135
  push({ kind: "user", text: `/code ${arg}` });
2779
3136
  await app.send(arg, { code: true });
2780
3137
  return;
3138
+ case "skills": {
3139
+ const { instructions } = await Promise.resolve().then(() => (init_src(), src_exports));
3140
+ const loadedSkills = instructions.loadSkills(app.folder);
3141
+ const ruleFiles = s.instructionFiles;
3142
+ const lines = [
3143
+ `Instruction files: ${ruleFiles.length ? ruleFiles.join(", ") : "none (/init to create PROMETHEA.md; also supports UCHI.md, SUNDIAL.md, CLAUDE.md, AGENTS.md)"}`,
3144
+ `Active skills (${loadedSkills.length}): ${loadedSkills.length ? loadedSkills.map((sk) => `${sk.name} (${sk.path})`).join(", ") : "none (.sundial/skills/<name>/SKILL.md)"}`
3145
+ ];
3146
+ info(lines.join("\n"));
3147
+ return;
3148
+ }
3149
+ case "obsidian": {
3150
+ const vaultDir = path7.resolve(app.folder, arg || ".");
3151
+ if (!fs8.existsSync(vaultDir)) {
3152
+ info(`Obsidian vault folder not found: ${vaultDir}`, "error");
3153
+ return;
3154
+ }
3155
+ const mdNotes = [];
3156
+ const walk2 = (d) => {
3157
+ for (const entry of fs8.readdirSync(d, { withFileTypes: true })) {
3158
+ if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
3159
+ const full = path7.join(d, entry.name);
3160
+ if (entry.isDirectory()) walk2(full);
3161
+ else if (entry.name.endsWith(".md") && mdNotes.length < 300) {
3162
+ try {
3163
+ mdNotes.push({ path: path7.relative(vaultDir, full), content: fs8.readFileSync(full, "utf8") });
3164
+ } catch {
3165
+ }
3166
+ }
3167
+ }
3168
+ };
3169
+ walk2(vaultDir);
3170
+ if (!mdNotes.length) {
3171
+ info(`No Markdown (.md) notes found in ${vaultDir}`, "warn");
3172
+ return;
3173
+ }
3174
+ try {
3175
+ const res = await app.api.json(
3176
+ "/api/obsidian",
3177
+ { method: "POST", body: JSON.stringify({ mode: "merge", notes: mdNotes }) }
3178
+ );
3179
+ info(`Obsidian Vault synced: ${res.notesProcessed} notes \u2192 ${res.extractedEdges} new edges (${res.totalKnowledgeGraphEdges} total in your Personal Knowledge Graph).`);
3180
+ } catch (e) {
3181
+ info(`Obsidian sync failed: ${e.message}`, "error");
3182
+ }
3183
+ return;
3184
+ }
3185
+ case "remote": {
3186
+ const sub = arg.trim();
3187
+ if (sub && sub.toLowerCase() !== "pair") {
3188
+ const prompt = `/remote ${sub}`;
3189
+ push({ kind: "user", text: prompt });
3190
+ turnStartRef.current = Date.now();
3191
+ await app.send(prompt);
3192
+ return;
3193
+ }
3194
+ if (!s.signedIn) {
3195
+ push({ kind: "user", text: "/remote status" });
3196
+ turnStartRef.current = Date.now();
3197
+ await app.send("/remote status");
3198
+ return;
3199
+ }
3200
+ try {
3201
+ const os4 = await import("node:os");
3202
+ const res = await app.api.json(
3203
+ "/api/remote",
3204
+ { method: "POST", body: JSON.stringify({ action: "register", hostname: os4.hostname(), cwd: app.folder }) }
3205
+ );
3206
+ info(`Remote Control active: session ${res.session.sessionId} paired with ${s.server} (${os4.hostname()}:${app.folder})`);
3207
+ } catch (e) {
3208
+ info(`Remote Control pairing failed: ${e.message}`, "error");
3209
+ }
3210
+ return;
3211
+ }
2781
3212
  case "diff": {
2782
3213
  const ch = app.host.review();
2783
3214
  if (!ch.length) {
@@ -2805,7 +3236,7 @@ Upgrade or add credits on the website: ${e.upgradeUrl}`, "warn");
2805
3236
  ...s.windows.map((w) => `${w.id.padEnd(9)} ${meter(w.pct, 20)} about ${w.messagesLeft} messages left (${Math.round(w.pct)}% used)${w.resetsAt ? ` \xB7 resets ${new Date(w.resetsAt).toLocaleString()}` : ""}`),
2806
3237
  ...s.credits != null ? [`Credits $${s.credits.toFixed(2)} \xB7 pay as you go past your allowance${s.plan?.overage ? "" : " (not on this plan)"}`] : [],
2807
3238
  ...name === "status" ? [
2808
- `Model ${s.models.find((m) => m.id === s.model)?.name ?? s.model} \xB7 ${s.effort}`,
3239
+ `Model ${s.models.find((m) => m.id === s.model)?.name ?? s.model} \xB7 ${s.effort}${s.rigor ? " \xB7 rigor" : ""}${s.study ? " \xB7 study" : ""}`,
2809
3240
  `Policy ${s.policy.approvals} \xB7 ${s.policy.sandbox} \xB7 network ${s.policy.network ? "on" : "off"} \xB7 OS sandbox ${s.osSandbox ? "yes" : "no"}`,
2810
3241
  `Folder ${s.folder}`,
2811
3242
  `Rules ${s.instructionFiles.join(", ") || "none (/init)"}`,
@@ -2855,20 +3286,46 @@ Upgrade or add credits on the website: ${e.upgradeUrl}`, "warn");
2855
3286
  info(`Unknown command /${name0}. /help lists them.`, "warn");
2856
3287
  }
2857
3288
  };
2858
- const suggestions = useMemo(() => input.startsWith("/") && !input.includes(" ") ? complete(input).slice(0, 6) : [], [input]);
3289
+ const suggestions = useMemo(() => input.startsWith("/") && !input.includes(" ") ? complete(input).slice(0, 8) : [], [input]);
2859
3290
  const pending = s.pending[0];
2860
3291
  const model = s.models.find((m) => m.id === s.model)?.name ?? s.model;
3292
+ const isTyping = typingEnergy > 0 || input.length > 0;
3293
+ const liveWave = equalizerWave(frame, Boolean(s.busy || voiceOn || typingEnergy > 0), 12);
3294
+ const streamedTokens = live ? Math.max(1, Math.round(live.length / 4)) : 0;
3295
+ const livePreview = useMemo(() => {
3296
+ if (!live) return "";
3297
+ const lines = live.split("\n");
3298
+ if (lines.length <= 16) return renderMarkdown(live);
3299
+ return `\u2026 (${lines.length - 16} lines streamed \u2014 full output prints on completion)
3300
+ ` + lines.slice(-16).join("\n");
3301
+ }, [live]);
2861
3302
  return /* @__PURE__ */ jsxs4(Box5, { flexDirection: "column", children: [
2862
- /* @__PURE__ */ jsx5(Static, { items, children: (it) => /* @__PURE__ */ jsx5(ItemView, { it, s, version }, it.id) }),
2863
- s.busy && /* @__PURE__ */ jsxs4(Box5, { flexDirection: "column", marginTop: 1, children: [
3303
+ /* @__PURE__ */ jsx5(Static, { items, children: (it) => /* @__PURE__ */ jsx5(ItemView, { it, s, version, modelName: model }, it.id) }),
3304
+ s.busy && /* @__PURE__ */ jsxs4(Box5, { flexDirection: "column", marginTop: 1, borderStyle: "round", borderColor: COLORS.fire, paddingX: 1, children: [
3305
+ /* @__PURE__ */ jsxs4(Box5, { justifyContent: "space-between", children: [
3306
+ /* @__PURE__ */ jsxs4(Text5, { color: COLORS.fire, bold: true, children: [
3307
+ orbitFrame(frame),
3308
+ " ",
3309
+ PULSE[frame % PULSE.length],
3310
+ " ",
3311
+ model,
3312
+ " \xB7 Neural Stream Active"
3313
+ ] }),
3314
+ /* @__PURE__ */ jsxs4(Text5, { color: COLORS.coral, children: [
3315
+ liveWave,
3316
+ " ",
3317
+ streamedTokens > 0 ? `\xB7 ${streamedTokens} tok` : "",
3318
+ " \xB7 Esc to stop"
3319
+ ] })
3320
+ ] }),
2864
3321
  todo && /* @__PURE__ */ jsx5(Text5, { color: T3.muted, children: todo }),
2865
3322
  acts.slice(-6).map((a, i) => /* @__PURE__ */ jsxs4(Text5, { color: T3.muted, children: [
2866
3323
  " \u23BF ",
2867
3324
  a
2868
3325
  ] }, i)),
2869
- live && /* @__PURE__ */ jsx5(Text5, { children: renderMarkdown(live) }),
3326
+ livePreview && /* @__PURE__ */ jsx5(Box5, { marginTop: 0, children: /* @__PURE__ */ jsx5(Text5, { children: livePreview }) }),
2870
3327
  !pending && /* @__PURE__ */ jsxs4(Text5, { color: COLORS.fire, children: [
2871
- PULSE[frame],
3328
+ PULSE[frame % PULSE.length],
2872
3329
  " ",
2873
3330
  /* @__PURE__ */ jsxs4(Text5, { color: T3.muted, children: [
2874
3331
  model,
@@ -2889,36 +3346,56 @@ Upgrade or add credits on the website: ${e.upgradeUrl}`, "warn");
2889
3346
  pick.onPick(v);
2890
3347
  }, onCancel: () => setPick(null) }),
2891
3348
  !pick && !pending && /* @__PURE__ */ jsxs4(Box5, { flexDirection: "column", marginTop: 1, children: [
2892
- /* @__PURE__ */ jsxs4(Box5, { borderStyle: "round", borderColor: s.busy ? T3.border : COLORS.coral, paddingX: 1, children: [
2893
- /* @__PURE__ */ jsx5(Text5, { color: COLORS.fire, children: "\u203A " }),
3349
+ /* @__PURE__ */ jsxs4(Box5, { justifyContent: "space-between", paddingX: 1, children: [
3350
+ /* @__PURE__ */ jsx5(Text5, { color: typingEnergy > 0 || voiceOn ? COLORS.fire : T3.faint, children: typingEnergy > 0 ? `${orbitFrame(frame)} LIVE INPUT \xB7 ${liveWave}` : voiceOn ? `\u25C9 VOICE LINK ACTIVE ($0 LOCAL) \xB7 ${liveWave}` : `\u2726 ${model.toUpperCase()} READY \xB7 ${liveWave}` }),
3351
+ /* @__PURE__ */ jsxs4(Text5, { color: T3.faint, children: [
3352
+ lastReply ? "Ctrl+Y or /copy: copy latest output \xB7 " : "",
3353
+ "/voice: talk \xB7 /swarm: tandem"
3354
+ ] })
3355
+ ] }),
3356
+ /* @__PURE__ */ jsxs4(Box5, { borderStyle: "round", borderColor: s.busy ? T3.border : typingEnergy > 0 || voiceOn ? COLORS.fire : COLORS.coral, paddingX: 1, children: [
3357
+ /* @__PURE__ */ jsx5(Text5, { color: COLORS.fire, children: typingEnergy > 0 ? `${orbitFrame(frame)} \u203A ` : voiceOn ? "\u25C9 \u203A " : "\u203A " }),
2894
3358
  /* @__PURE__ */ jsx5(
2895
3359
  TextInput,
2896
3360
  {
2897
3361
  value: input,
2898
- onChange: setInput,
3362
+ onChange: handleInputChange,
2899
3363
  onSubmit: run,
2900
3364
  history,
2901
3365
  active: !pick && !pending && !login,
2902
- placeholder: s.busy ? "Working\u2026 (Esc to stop)" : `Ask ${model}, or / for commands`,
3366
+ placeholder: s.busy ? "Working\u2026 (Esc to stop)" : `Ask ${model}, type / for commands, or /voice to talk`,
2903
3367
  onTab: () => {
2904
- if (suggestions[0]) setInput(`/${suggestions[0].name} `);
3368
+ if (suggestions[0]) handleInputChange(`/${suggestions[0].name} `);
2905
3369
  },
2906
3370
  onShiftTab: cycleApprovals
2907
3371
  }
2908
3372
  )
2909
3373
  ] }),
2910
3374
  suggestions.map((c) => /* @__PURE__ */ jsxs4(Text5, { color: T3.muted, children: [
2911
- " /",
2912
- c.name.padEnd(12),
3375
+ " ",
3376
+ /* @__PURE__ */ jsxs4(Text5, { color: COLORS.coral, children: [
3377
+ "/",
3378
+ c.name.padEnd(12)
3379
+ ] }),
2913
3380
  c.help
2914
3381
  ] }, c.name)),
2915
- /* @__PURE__ */ jsx5(Status, { s })
3382
+ /* @__PURE__ */ jsx5(
3383
+ Status,
3384
+ {
3385
+ s,
3386
+ voiceOn,
3387
+ copiedAt: copiedFlash,
3388
+ hasLatestReply: Boolean(lastReply),
3389
+ tick: frame,
3390
+ activeWave: Boolean(typingEnergy > 0 || isTyping)
3391
+ }
3392
+ )
2916
3393
  ] })
2917
3394
  ] });
2918
3395
  }
2919
- function ItemView({ it, s, version }) {
3396
+ function ItemView({ it, s, version, modelName }) {
2920
3397
  if (it.kind === "banner") {
2921
- return /* @__PURE__ */ jsxs4(Box5, { marginBottom: 1, children: [
3398
+ return /* @__PURE__ */ jsx5(Box5, { marginBottom: 1, flexDirection: "column", children: /* @__PURE__ */ jsxs4(Box5, { children: [
2922
3399
  /* @__PURE__ */ jsx5(Box5, { flexDirection: "column", marginRight: 2, children: logoRuns().map((runs, i) => /* @__PURE__ */ jsx5(Text5, { children: runs.map(([t, c], j) => /* @__PURE__ */ jsx5(Text5, { color: c, children: t }, j)) }, i)) }),
2923
3400
  /* @__PURE__ */ jsxs4(Box5, { flexDirection: "column", justifyContent: "center", children: [
2924
3401
  /* @__PURE__ */ jsxs4(Text5, { bold: true, color: COLORS.alabaster, children: [
@@ -2926,22 +3403,37 @@ function ItemView({ it, s, version }) {
2926
3403
  /* @__PURE__ */ jsxs4(Text5, { color: T3.faint, children: [
2927
3404
  "v",
2928
3405
  version
3406
+ ] }),
3407
+ " ",
3408
+ /* @__PURE__ */ jsxs4(Text5, { color: COLORS.fire, children: [
3409
+ "\u2726 ",
3410
+ modelName
2929
3411
  ] })
2930
3412
  ] }),
2931
- /* @__PURE__ */ jsx5(Text5, { color: T3.muted, children: "Promethea Research \xB7 every model, one account" }),
3413
+ /* @__PURE__ */ jsx5(Text5, { color: T3.muted, children: "Promethea Research \xB7 Cognitive Architecture & Tandem Swarm" }),
2932
3414
  /* @__PURE__ */ jsx5(Text5, { color: T3.muted, children: s.folder }),
2933
3415
  /* @__PURE__ */ jsxs4(Text5, { color: T3.faint, children: [
2934
3416
  s.signedIn ? `${s.email} \xB7 ${s.plan?.name ?? ""}` : "Not signed in: /login (or ask as a guest)",
2935
- " \xB7 /help"
3417
+ " \xB7 /help \xB7 /voice \xB7 /copy (Ctrl+Y)"
2936
3418
  ] })
2937
3419
  ] })
2938
- ] });
3420
+ ] }) });
2939
3421
  }
2940
3422
  if (it.kind === "user") return /* @__PURE__ */ jsxs4(Box5, { marginTop: 1, children: [
2941
3423
  /* @__PURE__ */ jsx5(Text5, { color: COLORS.coral, children: "\u203A " }),
2942
3424
  /* @__PURE__ */ jsx5(Text5, { color: COLORS.alabaster, children: it.text })
2943
3425
  ] });
2944
- if (it.kind === "assistant") return /* @__PURE__ */ jsx5(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text5, { children: renderMarkdown(it.text) }) });
3426
+ if (it.kind === "assistant") {
3427
+ return /* @__PURE__ */ jsxs4(Box5, { marginTop: 1, flexDirection: "column", children: [
3428
+ /* @__PURE__ */ jsxs4(Text5, { color: COLORS.fire, children: [
3429
+ "\u25C8 ",
3430
+ /* @__PURE__ */ jsx5(Text5, { bold: true, color: COLORS.alabaster, children: modelName }),
3431
+ " ",
3432
+ /* @__PURE__ */ jsx5(Text5, { color: T3.faint, children: "\xB7 /copy or Ctrl+Y to copy" })
3433
+ ] }),
3434
+ /* @__PURE__ */ jsx5(Text5, { children: renderMarkdown(it.text) })
3435
+ ] });
3436
+ }
2945
3437
  if (it.kind === "activity") return /* @__PURE__ */ jsx5(Box5, { flexDirection: "column", marginTop: 1, children: it.lines.map((l, i) => /* @__PURE__ */ jsxs4(Text5, { color: T3.muted, children: [
2946
3438
  " \u23BF ",
2947
3439
  l
@@ -2975,7 +3467,8 @@ async function main() {
2975
3467
  return;
2976
3468
  }
2977
3469
  const isExec = pos[0] === "exec";
2978
- const folder = (isExec ? pos[2] : pos[0]) ?? process.cwd();
3470
+ const isRemote = pos[0] === "remote";
3471
+ const folder = (isExec ? pos[2] : isRemote ? pos[1] : pos[0]) ?? process.cwd();
2979
3472
  const app = new SundialApp(folder, config_exports.serverUrl(o.server));
2980
3473
  config_exports.addProject(app.folder);
2981
3474
  if (o.approvals) app.policy.approvals = o.approvals;
@@ -2983,6 +3476,16 @@ async function main() {
2983
3476
  await app.refresh();
2984
3477
  if (o.model) app.session.model = o.model;
2985
3478
  if (o.effort) app.session.effort = o.effort;
3479
+ if (isRemote) {
3480
+ const os4 = await import("node:os");
3481
+ const res = await app.api.json(
3482
+ "/api/remote",
3483
+ { method: "POST", body: JSON.stringify({ action: "register", hostname: os4.hostname(), cwd: app.folder }) }
3484
+ );
3485
+ console.log(`Remote Control active: session ${res.session.sessionId} paired with ${app.snapshot().server} (${os4.hostname()}:${app.folder})`);
3486
+ app.close();
3487
+ return;
3488
+ }
2986
3489
  await app.startMcp();
2987
3490
  if (isExec) {
2988
3491
  const turns = o.turns ? JSON.parse(fs9.readFileSync(o.turns, "utf8")) : [pos[1] ?? ""];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promethea-research/sundial",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "description": "Sundial in the terminal: the same account, models, billing and tools as the desktop app and the website.",
6
6
  "bin": {