fuli-context 0.27.7 → 0.27.8

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,7 @@
9
9
  />
10
10
  <link rel="icon" href="/favicon.ico" sizes="any" />
11
11
  <title>复利 · Context Graph</title>
12
- <script type="module" crossorigin src="/assets/index-BMXvGfju.js"></script>
12
+ <script type="module" crossorigin src="/assets/index-BTvXsU8s.js"></script>
13
13
  <link rel="modulepreload" crossorigin href="/assets/_plugin-vue_export-helper-DOpmHs7b.js">
14
14
  <link rel="modulepreload" crossorigin href="/assets/runtime-dom.esm-bundler-BOLvE4oK.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/client-CEDozSk8.js">
@@ -63,7 +63,7 @@
63
63
  <link rel="modulepreload" crossorigin href="/assets/source-adapters-yfN0SDhc.js">
64
64
  <link rel="modulepreload" crossorigin href="/assets/label-table-DWm9MaBL.js">
65
65
  <link rel="modulepreload" crossorigin href="/assets/settings-tabs-BgvdL5Pa.js">
66
- <link rel="modulepreload" crossorigin href="/assets/version-DkZhCyrF.js">
66
+ <link rel="modulepreload" crossorigin href="/assets/version-Bbyzi5SM.js">
67
67
  <link rel="modulepreload" crossorigin href="/assets/motion-preference-9MRelICo.js">
68
68
  <link rel="modulepreload" crossorigin href="/assets/role-names-D5hqFIPM.js">
69
69
  <link rel="modulepreload" crossorigin href="/assets/AgentAvatar-BxoydFOA.js">
@@ -87,7 +87,7 @@
87
87
  <link rel="modulepreload" crossorigin href="/assets/review-store-C60c33JI.js">
88
88
  <link rel="modulepreload" crossorigin href="/assets/roundtable-live-Cn5hnlLX.js">
89
89
  <link rel="modulepreload" crossorigin href="/assets/motion-CpalLa7e.js">
90
- <link rel="modulepreload" crossorigin href="/assets/CopyFixPrompt-CGRnvJQo.js">
90
+ <link rel="modulepreload" crossorigin href="/assets/CopyFixPrompt-_o5uZOIH.js">
91
91
  <link rel="modulepreload" crossorigin href="/assets/agent-identity-color-RqpT7gtx.js">
92
92
  <link rel="modulepreload" crossorigin href="/assets/task-evidence-D0XkNnb8.js">
93
93
  <link rel="modulepreload" crossorigin href="/assets/useAgentRecords-CFyrJia0.js">
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fuli-graph-provider"
3
- version = "0.27.7"
3
+ version = "0.27.8"
4
4
  description = "Graphiti-backed personal and shared project provider for Fuli."
5
5
  requires-python = ">=3.12"
6
6
  dependencies = [
Binary file
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "fuli-context",
3
- "version": "0.27.7",
3
+ "version": "0.27.8",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "fuli-context",
9
- "version": "0.27.7",
9
+ "version": "0.27.8",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@agentclientprotocol/sdk": "1.5.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuli-context",
3
- "version": "0.27.7",
3
+ "version": "0.27.8",
4
4
  "description": "Local-first collaboration relationship graph for AI agents.",
5
5
  "type": "module",
6
6
  "files": [
@@ -0,0 +1,70 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { accessSync, constants, statSync } from 'node:fs';
3
+ import { userInfo } from 'node:os';
4
+ import { delimiter, join } from 'node:path';
5
+
6
+ // A desktop app on macOS, or a service started outside a terminal, runs with
7
+ // a shorter PATH than the person's shell. A client's command line installed
8
+ // under the home folder (~/.local/bin, a Homebrew or npm prefix) is then not
9
+ // found, and neither are the programs it starts itself (node). So when a
10
+ // command is not on FULI's own PATH, the person's login shell is asked for its
11
+ // PATH: the command is looked for there, and the client is started with those
12
+ // directories added after FULI's own. The answer is kept for a few minutes,
13
+ // since asking starts a shell; a shell that fails to answer is not asked again
14
+ // until then. Nothing is asked on Windows, where applications share one PATH.
15
+ const KEEP_MS = 5 * 60_000;
16
+ const SHELL_TIMEOUT_MS = 4000;
17
+ // The shell may print its own lines when it starts: the PATH is read between marks.
18
+ const MARK = '__FULI_LOGIN_PATH__';
19
+ const BETWEEN_MARKS = new RegExp(`${MARK}([^\\n]*)${MARK}`);
20
+ // Shell text only; the mark and the variable name are constants, nothing is interpolated from outside.
21
+ const PRINT_PATH = `printf '%s%s%s' '${MARK}' "$PATH" '${MARK}'`;
22
+
23
+ let kept = null;
24
+
25
+ // The login shell's PATH, or null when it cannot be learned.
26
+ export function loginShellPath({ env = process.env, platform = process.platform, run = spawnSync, now = () => Date.now(),
27
+ accountShell = () => userInfo().shell } = {}) {
28
+ if (platform === 'win32') return null;
29
+ if (kept && now() - kept.at < KEEP_MS) return kept.path;
30
+ let path = null;
31
+ try {
32
+ // An application started by the desktop has no SHELL: the account's own shell is used.
33
+ const named = env.SHELL || accountShell();
34
+ // fish takes another syntax; zsh and bash both take this, and so does sh.
35
+ const shell = /\/(?:ba|z)?sh$/.test(named ?? '') ? named : '/bin/sh';
36
+ const result = run(shell, ['-lic', PRINT_PATH], { encoding: 'utf8', timeout: SHELL_TIMEOUT_MS, env, stdio: ['ignore', 'pipe', 'ignore'] });
37
+ if (result?.status === 0) path = BETWEEN_MARKS.exec(String(result.stdout ?? ''))?.[1] || null;
38
+ } catch { /* an account without a shell, or one that cannot start: not learned */ }
39
+ kept = { at: now(), path };
40
+ return path;
41
+ }
42
+
43
+ // The program `name` in one of the login shell's directories, or null.
44
+ export function findInLoginShellPath(name, options = {}) {
45
+ const path = loginShellPath(options);
46
+ if (!path) return null;
47
+ const isProgram = options.isProgram ?? programFile;
48
+ return path.split(delimiter).filter(Boolean).map((directory) => join(directory, name)).find((file) => isProgram(file)) ?? null;
49
+ }
50
+
51
+ // The environment a client is started with: the login shell's directories
52
+ // after FULI's own, once that PATH was learned for a lookup. It never asks the
53
+ // shell itself, so a start costs nothing where every command was on the PATH.
54
+ export function withLoginShellPath(env) {
55
+ if (!kept?.path) return env;
56
+ const own = String(env.PATH ?? '').split(delimiter).filter(Boolean);
57
+ const added = kept.path.split(delimiter).filter((directory) => directory && !own.includes(directory));
58
+ return added.length ? { ...env, PATH: [...own, ...added].join(delimiter) } : env;
59
+ }
60
+
61
+ // For tests: what was learned is forgotten.
62
+ export function forgetLoginShellPath() { kept = null; }
63
+
64
+ function programFile(file) {
65
+ try {
66
+ if (!statSync(file).isFile()) return false;
67
+ accessSync(file, constants.X_OK);
68
+ return true;
69
+ } catch { return false; }
70
+ }
@@ -6,6 +6,7 @@ import { setTimeout as delay } from 'node:timers/promises';
6
6
  import { StringDecoder } from 'node:string_decoder';
7
7
 
8
8
  import { WAKE_CLIENTS, wakeAdapter } from '../agents/wake-registry.js';
9
+ import { findInLoginShellPath, withLoginShellPath } from './login-shell-path.js';
9
10
  import { wakeFailure } from './wake-failure.js';
10
11
 
11
12
  // Wakes the recipient Agent in its own client, headlessly in the given mode, and
@@ -127,7 +128,8 @@ export function runProcess(command, args, { cwd, env, input, timeoutMs, maxOutpu
127
128
  let child;
128
129
  // Windows refuses some files at once (EFTYPE); other systems report it as an error event.
129
130
  try {
130
- child = spawn(command, args, { cwd, env, shell: false, windowsHide: true,
131
+ // The login shell's directories, once learned for a lookup (login-shell-path.js): a client found there starts its own helpers from there too.
132
+ child = spawn(command, args, { cwd, env: withLoginShellPath(env), shell: false, windowsHide: true,
131
133
  detached: process.platform !== 'win32', stdio: ['pipe', 'pipe', 'pipe'] });
132
134
  } catch (error) { reject(startFailure(error)); return; }
133
135
  const closed = new Promise((resolve) => child.once('close', resolve));
@@ -253,9 +255,11 @@ async function processGroupExited(pgid, stopped) {
253
255
  }
254
256
  }
255
257
 
258
+ // On FULI's own PATH first; a desktop app's PATH is shorter than the person's shell's, so a command missing there is
259
+ // looked for in the login shell's directories (login-shell-path.js).
256
260
  function whichCommand(name, platform) {
257
261
  const result = spawnSync(platform === 'win32' ? 'where.exe' : 'which', [name], { encoding: 'utf8', windowsHide: true });
258
- if (result.status !== 0) return null;
262
+ if (result.status !== 0) return platform === 'win32' ? null : findInLoginShellPath(name, { platform });
259
263
  // On Windows only real executables can be spawned without a shell.
260
264
  return result.stdout.split(/\r?\n/).map((line) => line.trim())
261
265
  .find((line) => line && (platform !== 'win32' || /\.exe$/i.test(line))) ?? null;
@@ -3,4 +3,4 @@
3
3
  // and writes its digest here before publishing (scripts/pin-win-helper.js); a
4
4
  // source checkout has no helper and no pin, so Windows Hello is unavailable there.
5
5
  // The helper is not Authenticode-signed: this digest is its only integrity check.
6
- export const WIN_HELPER_SHA256 = '26050310ffbf3e984df577f201502fd9e7549124a282d43a63e5de1bac30f5ef';
6
+ export const WIN_HELPER_SHA256 = '52a50137c8bccf3a16f8f9c747ef71e9ee3a6601ea2582192e44cdb0f759c4da';
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": "0.27.8",
3
+ "zh": [
4
+ "Mac 上从访达启动的 FULI 现在找得到 Claude Code 和 Codex 了,能叫醒助手。",
5
+ "原因是这样启动的应用 PATH 很短;FULI 找不到时会去问一次登录环境。"
6
+ ],
7
+ "en": [
8
+ "On a Mac, a FULI started from Finder now finds Claude Code and Codex and can wake assistants.",
9
+ "Apps started that way get a short PATH; when FULI finds nothing it asks your login environment."
10
+ ]
11
+ }