@lucascouts/claude-agent-tui 0.17.8 → 0.17.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-catalog.js +3 -1
- package/dist/claude-config-dir.d.ts +1 -0
- package/dist/claude-config-dir.js +21 -0
- package/dist/command-catalog.js +10 -7
- package/dist/jsonl.d.ts +3 -2
- package/dist/jsonl.js +6 -5
- package/package.json +1 -1
package/dist/agent-catalog.js
CHANGED
|
@@ -237,7 +237,9 @@ function globDiscoverAgents(cwd, deps) {
|
|
|
237
237
|
const readdirMd = deps.readdirMd ?? defaultReaddirMd;
|
|
238
238
|
const readFile = deps.readFile ?? defaultReadFile;
|
|
239
239
|
const projectDir = join(cwd, ".claude", "agents");
|
|
240
|
-
|
|
240
|
+
// The user tier follows the CLI's config dir (CLAUDE_CONFIG_DIR, Zeo 0.41.0), else ~/.claude --
|
|
241
|
+
// claude-config-dir.ts's rule, inlined: this module's tests load it from its .ts, with no siblings.
|
|
242
|
+
const userDir = join(process.env.CLAUDE_CONFIG_DIR || join(homedir(), ".claude"), "agents");
|
|
241
243
|
const byValue = new Map();
|
|
242
244
|
for (const dir of [projectDir, userDir]) {
|
|
243
245
|
for (const filename of readdirMd(dir)) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function claudeConfigDir(env?: NodeJS.ProcessEnv, home?: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Claude config dir the `claude` CLI this adapter drives reads its user-level state from:
|
|
3
|
+
* `CLAUDE_CONFIG_DIR` when it is set and not empty, else `<home>/.claude` -- the same rule as
|
|
4
|
+
* Claude Code's own and `acp-agent.ts`'s `CLAUDE_CONFIG_DIR`.
|
|
5
|
+
*
|
|
6
|
+
* Zeo 0.41.0 starts a project's Claude agent with `CLAUDE_CONFIG_DIR` at the project's own Claude
|
|
7
|
+
* folder (Zeo patches 0237-0240), and the spawned `claude` inherits it. Every user-level path this
|
|
8
|
+
* adapter reads -- transcripts, custom agents, user commands and skills, plugins -- must follow the
|
|
9
|
+
* same dir, or the adapter looks in `~/.claude` while the CLI writes elsewhere: a resume finds no
|
|
10
|
+
* transcript, the Agent menu lists the wrong agents. This adapter still never SETS the variable
|
|
11
|
+
* (engine-pty.ts: it relocates auth); it only reads what it was started with.
|
|
12
|
+
*
|
|
13
|
+
* @param env the environment to read (default: `process.env`).
|
|
14
|
+
* @param home the user's home dir (default: `os.homedir()`), for the fallback.
|
|
15
|
+
*/
|
|
16
|
+
import { homedir as osHomedir } from "node:os";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
export function claudeConfigDir(env = process.env, home = osHomedir()) {
|
|
19
|
+
const configured = env.CLAUDE_CONFIG_DIR;
|
|
20
|
+
return configured ? configured : join(home, ".claude");
|
|
21
|
+
}
|
package/dist/command-catalog.js
CHANGED
|
@@ -223,12 +223,12 @@ function sortByName(entries) {
|
|
|
223
223
|
* contributes nothing — this NEVER throws (an unreadable/parse failure degrades to the empty set → all
|
|
224
224
|
* plugins skipped).
|
|
225
225
|
*
|
|
226
|
-
* @param
|
|
226
|
+
* @param configDir the resolved Claude config dir (the manifest lives under `configDir/plugins`).
|
|
227
227
|
* @param readFile the injectable UTF-8 file reader (throws on a missing manifest — caught here).
|
|
228
228
|
* @returns the set of enabled marketplace names (EMPTY when the manifest is absent/malformed).
|
|
229
229
|
*/
|
|
230
|
-
function readEnabledMarketplaces(
|
|
231
|
-
const path = join(
|
|
230
|
+
function readEnabledMarketplaces(configDir, readFile) {
|
|
231
|
+
const path = join(configDir, "plugins", "installed_plugins.json");
|
|
232
232
|
let parsed;
|
|
233
233
|
try {
|
|
234
234
|
parsed = JSON.parse(readFile(path));
|
|
@@ -290,14 +290,17 @@ export function discoverCommands(cwd, deps = {}) {
|
|
|
290
290
|
const readFile = deps.readFile ?? defaultReadFile;
|
|
291
291
|
const builtins = deps.builtins ?? BUILTIN_COMMANDS;
|
|
292
292
|
const home = homedir();
|
|
293
|
+
// The user and plugin tiers follow the CLI's config dir (CLAUDE_CONFIG_DIR, Zeo 0.41.0), else
|
|
294
|
+
// ~/.claude -- claude-config-dir.ts's rule, inlined: this module's tests load it from its .ts.
|
|
295
|
+
const configDir = process.env.CLAUDE_CONFIG_DIR || join(home, ".claude");
|
|
293
296
|
// Ordered disk surfaces (highest precedence first) — commands scanned via `readdirMd`+`resolveEntry`,
|
|
294
297
|
// skills via `readdirDirs`+`resolveSkillEntry`. A cwd command outranks a cwd skill; any cwd surface
|
|
295
298
|
// outranks any user surface (R1.1 / R7). The plugin tier (R8) slots in AFTER these, before builtins.
|
|
296
299
|
const userSources = [
|
|
297
300
|
{ kind: "commands", dir: join(cwd, ".claude", "commands") }, // cwd commands — highest
|
|
298
301
|
{ kind: "skills", dir: join(cwd, ".claude", "skills") }, // cwd skills
|
|
299
|
-
{ kind: "commands", dir: join(
|
|
300
|
-
{ kind: "skills", dir: join(
|
|
302
|
+
{ kind: "commands", dir: join(configDir, "commands") }, // user commands
|
|
303
|
+
{ kind: "skills", dir: join(configDir, "skills") }, // user skills
|
|
301
304
|
];
|
|
302
305
|
const byName = new Map();
|
|
303
306
|
const add = (entry) => {
|
|
@@ -322,8 +325,8 @@ export function discoverCommands(cwd, deps = {}) {
|
|
|
322
325
|
// `installed_plugins.json`. For each enabled marketplace (dirs already sorted), fold its `commands`
|
|
323
326
|
// then its `skills`; first-wins means any plugin name already claimed by a cwd/user surface is DROPPED
|
|
324
327
|
// (R8.1). A missing marketplaces dir / manifest degrades to skipping plugins (never throws).
|
|
325
|
-
const marketplacesDir = join(
|
|
326
|
-
const enabled = readEnabledMarketplaces(
|
|
328
|
+
const marketplacesDir = join(configDir, "plugins", "marketplaces");
|
|
329
|
+
const enabled = readEnabledMarketplaces(configDir, readFile);
|
|
327
330
|
for (const m of readdirDirs(marketplacesDir)) {
|
|
328
331
|
if (!enabled.has(m))
|
|
329
332
|
continue; // treat a not-installed marketplace as disabled
|
package/dist/jsonl.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Build the absolute glob pattern used to locate a session's transcript:
|
|
3
|
-
* the `<sessionId>.jsonl` basename anywhere under
|
|
3
|
+
* the `<sessionId>.jsonl` basename anywhere under `<config dir>/projects` -- `CLAUDE_CONFIG_DIR`, else
|
|
4
|
+
* `~/.claude` ({@link claudeConfigDir}), `~` expanded via os.homedir
|
|
4
5
|
* (globSync does NOT perform tilde expansion). Exposed so callers can report the
|
|
5
6
|
* EXACT pattern they globbed in a not-found/ambiguity diagnostic without
|
|
6
7
|
* re-deriving (and risking drift from) the string used by findTranscript (R1.3).
|
|
@@ -12,7 +13,7 @@ export declare function transcriptGlob(sessionId: string): string;
|
|
|
12
13
|
/**
|
|
13
14
|
* Find Claude transcript file(s) for a given session id.
|
|
14
15
|
*
|
|
15
|
-
* Globs the `<sessionId>.jsonl` basename anywhere under
|
|
16
|
+
* Globs the `<sessionId>.jsonl` basename anywhere under `<config dir>/projects` ({@link claudeConfigDir})
|
|
16
17
|
* so the file is found independent of the cwd→dir encoding (R1.1). Returns ALL
|
|
17
18
|
* matches (normally one) as absolute paths; an empty array means "not found".
|
|
18
19
|
*
|
package/dist/jsonl.js
CHANGED
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
// 5583 ms turn watchdog and MUST NOT be conflated with it. This module only ever uses the
|
|
19
19
|
// file-discovery watchdog.
|
|
20
20
|
import { closeSync, globSync, openSync, readFileSync, readSync, statSync, watch } from "node:fs";
|
|
21
|
-
import { homedir } from "node:os";
|
|
22
21
|
import { join } from "node:path";
|
|
23
22
|
import { StringDecoder } from "node:string_decoder";
|
|
23
|
+
import { claudeConfigDir } from "./claude-config-dir.js";
|
|
24
24
|
/**
|
|
25
25
|
* Build the absolute glob pattern used to locate a session's transcript:
|
|
26
|
-
* the `<sessionId>.jsonl` basename anywhere under
|
|
26
|
+
* the `<sessionId>.jsonl` basename anywhere under `<config dir>/projects` -- `CLAUDE_CONFIG_DIR`, else
|
|
27
|
+
* `~/.claude` ({@link claudeConfigDir}), `~` expanded via os.homedir
|
|
27
28
|
* (globSync does NOT perform tilde expansion). Exposed so callers can report the
|
|
28
29
|
* EXACT pattern they globbed in a not-found/ambiguity diagnostic without
|
|
29
30
|
* re-deriving (and risking drift from) the string used by findTranscript (R1.3).
|
|
@@ -32,12 +33,12 @@ import { StringDecoder } from "node:string_decoder";
|
|
|
32
33
|
* @returns the absolute glob pattern findTranscript passes to globSync.
|
|
33
34
|
*/
|
|
34
35
|
export function transcriptGlob(sessionId) {
|
|
35
|
-
return join(
|
|
36
|
+
return join(claudeConfigDir(), "projects", "**", `${sessionId}.jsonl`);
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* Find Claude transcript file(s) for a given session id.
|
|
39
40
|
*
|
|
40
|
-
* Globs the `<sessionId>.jsonl` basename anywhere under
|
|
41
|
+
* Globs the `<sessionId>.jsonl` basename anywhere under `<config dir>/projects` ({@link claudeConfigDir})
|
|
41
42
|
* so the file is found independent of the cwd→dir encoding (R1.1). Returns ALL
|
|
42
43
|
* matches (normally one) as absolute paths; an empty array means "not found".
|
|
43
44
|
*
|
|
@@ -46,7 +47,7 @@ export function transcriptGlob(sessionId) {
|
|
|
46
47
|
*/
|
|
47
48
|
export function findTranscript(sessionId) {
|
|
48
49
|
// globSync returns paths relative to cwd unless the pattern is absolute, which it is here
|
|
49
|
-
// (
|
|
50
|
+
// (the config dir is absolute, via transcriptGlob), so matches are absolute too. transcriptGlob
|
|
50
51
|
// is the single source of the pattern string.
|
|
51
52
|
return globSync(transcriptGlob(sessionId));
|
|
52
53
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.17.
|
|
6
|
+
"version": "0.17.9",
|
|
7
7
|
"description": "Runs the official Claude Code TUI over a PTY and exposes it via ACP, so Claude Code threads render natively in Zed's agent panel. Built for Anthropic's June 2026 billing split (since paused).",
|
|
8
8
|
"main": "dist/lib.js",
|
|
9
9
|
"types": "dist/lib.d.ts",
|