@companion-ai/feynman 0.2.6 → 0.2.7

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.
@@ -9,7 +9,9 @@
9
9
  "npm:pi-mermaid",
10
10
  "npm:@aliou/pi-processes",
11
11
  "npm:pi-zotero",
12
+ "npm:@kaiserlich-dev/pi-session-search",
12
13
  "npm:pi-schedule-prompt",
14
+ "npm:@samfp/pi-memory",
13
15
  "npm:@tmustier/pi-ralph-wiggum"
14
16
  ],
15
17
  "quietStartup": true,
@@ -8,7 +8,9 @@ export const CORE_PACKAGE_SOURCES = [
8
8
  "npm:pi-mermaid",
9
9
  "npm:@aliou/pi-processes",
10
10
  "npm:pi-zotero",
11
+ "npm:@kaiserlich-dev/pi-session-search",
11
12
  "npm:pi-schedule-prompt",
13
+ "npm:@samfp/pi-memory",
12
14
  "npm:@tmustier/pi-ralph-wiggum",
13
15
  ];
14
16
  export const OPTIONAL_PACKAGE_PRESETS = {
@@ -16,24 +18,10 @@ export const OPTIONAL_PACKAGE_PRESETS = {
16
18
  description: "Interactive Glimpse UI widgets.",
17
19
  sources: ["npm:pi-generative-ui"],
18
20
  },
19
- memory: {
20
- description: "Cross-session memory and preference recall.",
21
- sources: ["npm:@samfp/pi-memory"],
22
- },
23
- "session-search": {
24
- description: "Indexed session recall with SQLite-backed search.",
25
- sources: ["npm:@kaiserlich-dev/pi-session-search"],
26
- },
27
- "all-extras": {
28
- description: "Install all optional packages.",
29
- sources: ["npm:pi-generative-ui", "npm:@samfp/pi-memory", "npm:@kaiserlich-dev/pi-session-search"],
30
- },
31
21
  };
32
22
  const LEGACY_DEFAULT_PACKAGE_SOURCES = [
33
23
  ...CORE_PACKAGE_SOURCES,
34
24
  "npm:pi-generative-ui",
35
- "npm:@kaiserlich-dev/pi-session-search",
36
- "npm:@samfp/pi-memory",
37
25
  ];
38
26
  function arraysMatchAsSets(left, right) {
39
27
  if (left.length !== right.length) {
@@ -56,9 +44,6 @@ export function getOptionalPackagePresetSources(name) {
56
44
  if (normalized === "ui") {
57
45
  return [...OPTIONAL_PACKAGE_PRESETS["generative-ui"].sources];
58
46
  }
59
- if (normalized === "search") {
60
- return [...OPTIONAL_PACKAGE_PRESETS["session-search"].sources];
61
- }
62
47
  const preset = OPTIONAL_PACKAGE_PRESETS[normalized];
63
48
  return preset ? [...preset.sources] : undefined;
64
49
  }
@@ -14,14 +14,7 @@ export const FEYNMAN_VERSION = (() => {
14
14
  }
15
15
  })();
16
16
 
17
- export const FEYNMAN_AGENT_LOGO = [
18
- "███████╗███████╗██╗ ██╗███╗ ██╗███╗ ███╗ █████╗ ███╗ ██╗",
19
- "██╔════╝██╔════╝╚██╗ ██╔╝████╗ ██║████╗ ████║██╔══██╗████╗ ██║",
20
- "█████╗ █████╗ ╚████╔╝ ██╔██╗ ██║██╔████╔██║███████║██╔██╗ ██║",
21
- "██╔══╝ ██╔══╝ ╚██╔╝ ██║╚██╗██║██║╚██╔╝██║██╔══██║██║╚██╗██║",
22
- "██║ ███████╗ ██║ ██║ ╚████║██║ ╚═╝ ██║██║ ██║██║ ╚████║",
23
- "╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝",
24
- ];
17
+ export { FEYNMAN_ASCII_LOGO as FEYNMAN_AGENT_LOGO } from "../../logo.mjs";
25
18
 
26
19
  export const FEYNMAN_RESEARCH_TOOLS = [
27
20
  "alpha_search",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companion-ai/feynman",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Research-first CLI agent built on Pi and alphaXiv",
5
5
  "type": "module",
6
6
  "engines": {
@@ -2,6 +2,7 @@ import { spawnSync } from "node:child_process";
2
2
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import { dirname, resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
+ import { FEYNMAN_ASCII_LOGO_HTML } from "../logo.mjs";
5
6
 
6
7
  const here = dirname(fileURLToPath(import.meta.url));
7
8
  const appRoot = resolve(here, "..");
@@ -90,14 +91,27 @@ function ensurePackageWorkspace() {
90
91
  "utf8",
91
92
  );
92
93
 
93
- console.log("[feynman] installing research packages...");
94
- const result = spawnSync("npm", ["install", "--prefer-offline", "--no-audit", "--no-fund", "--prefix", workspaceDir, ...packageSpecs], {
95
- stdio: "inherit",
94
+ const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
95
+ let frame = 0;
96
+ const start = Date.now();
97
+ const spinner = setInterval(() => {
98
+ const elapsed = Math.round((Date.now() - start) / 1000);
99
+ process.stderr.write(`\r${frames[frame++ % frames.length]} setting up feynman... ${elapsed}s`);
100
+ }, 80);
101
+
102
+ const result = spawnSync("npm", ["install", "--prefer-offline", "--no-audit", "--no-fund", "--loglevel", "error", "--prefix", workspaceDir, ...packageSpecs], {
103
+ stdio: ["ignore", "ignore", "pipe"],
96
104
  timeout: 300000,
97
105
  });
98
106
 
107
+ clearInterval(spinner);
108
+ const elapsed = Math.round((Date.now() - start) / 1000);
109
+
99
110
  if (result.status !== 0) {
100
- console.warn("[feynman] warning: package install failed, Pi will retry on first launch");
111
+ process.stderr.write(`\r✗ setup failed (${elapsed}s)\n`);
112
+ if (result.stderr?.length) process.stderr.write(result.stderr);
113
+ } else {
114
+ process.stderr.write(`\r✓ feynman ready (${elapsed}s)\n`);
101
115
  }
102
116
  }
103
117
 
@@ -351,12 +365,33 @@ if (oauthPagePath && existsSync(oauthPagePath)) {
351
365
  let source = readFileSync(oauthPagePath, "utf8");
352
366
  const piLogo = 'const LOGO_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 800" aria-hidden="true"><path fill="#fff" fill-rule="evenodd" d="M165.29 165.29 H517.36 V400 H400 V517.36 H282.65 V634.72 H165.29 Z M282.65 282.65 V400 H400 V282.65 Z"/><path fill="#fff" d="M517.36 400 H634.72 V634.72 H517.36 Z"/></svg>`;';
353
367
  if (source.includes(piLogo)) {
354
- const feynmanLogo = 'const LOGO_SVG = `<span style="font-size:32px;font-weight:700;color:#10b981;font-family:system-ui,sans-serif;letter-spacing:-0.02em">feynman</span>`;';
368
+ const feynmanLogo = `const LOGO_SVG = \`${FEYNMAN_ASCII_LOGO_HTML}\`;`;
355
369
  source = source.replace(piLogo, feynmanLogo);
356
370
  writeFileSync(oauthPagePath, source, "utf8");
357
371
  }
358
372
  }
359
373
 
374
+ const alphaHubAuthPath = findPackageRoot("@companion-ai/alpha-hub")
375
+ ? resolve(findPackageRoot("@companion-ai/alpha-hub"), "src", "lib", "auth.js")
376
+ : null;
377
+
378
+ if (alphaHubAuthPath && existsSync(alphaHubAuthPath)) {
379
+ let source = readFileSync(alphaHubAuthPath, "utf8");
380
+ const callbackStyle = `style="font-family:system-ui,sans-serif;display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:80vh;background:#050a08;color:#f0f5f2"`;
381
+ const logoHtml = FEYNMAN_ASCII_LOGO_HTML.replace('color:#10b981', 'color:#34d399');
382
+ const successPage = `<html><body ${callbackStyle}>${logoHtml}<h2 style="color:#34d399;margin-top:24px">Logged in</h2><p style="color:#8aaa9a">You can close this tab.</p></body></html>`;
383
+ const errorPage = `<html><body ${callbackStyle}>${logoHtml}<h2 style="color:#ef4444;margin-top:24px">Login failed</h2><p style="color:#8aaa9a">You can close this tab.</p></body></html>`;
384
+ const oldSuccess = `'<html><body><h2>Logged in to Alpha Hub</h2><p>You can close this tab.</p></body></html>'`;
385
+ const oldError = `'<html><body><h2>Login failed</h2><p>You can close this tab.</p></body></html>'`;
386
+ if (source.includes(oldSuccess)) {
387
+ source = source.replace(oldSuccess, `'${successPage}'`);
388
+ }
389
+ if (source.includes(oldError)) {
390
+ source = source.replace(oldError, `'${errorPage}'`);
391
+ }
392
+ writeFileSync(alphaHubAuthPath, source, "utf8");
393
+ }
394
+
360
395
  if (existsSync(piMemoryPath)) {
361
396
  let source = readFileSync(piMemoryPath, "utf8");
362
397
  const memoryOriginal = 'const MEMORY_DIR = join(homedir(), ".pi", "memory");';