claude-use 6.2.2 → 7.1.0
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 +90 -79
- package/dist/cli.cjs +716 -621
- package/dist/index.cjs +56 -41
- package/dist/index.mjs +56 -41
- package/dist/types/cliError.d.ts +1 -1
- package/dist/types/config/classify.d.ts +3 -3
- package/dist/types/config/schema.d.ts +13 -13
- package/dist/types/frontdoor/capability.d.ts +3 -3
- package/dist/types/frontdoor/connect.d.ts +2 -2
- package/dist/types/frontdoor/ensure.d.ts +2 -2
- package/dist/types/frontdoor/probe.d.ts +1 -1
- package/dist/types/frontdoor/supervisor.d.ts +1 -1
- package/dist/types/frontdoor/x509.d.ts +1 -1
- package/dist/types/headroom/source.d.ts +8 -0
- package/dist/types/headroom/state.d.ts +1 -1
- package/dist/types/headroom/supervisor.d.ts +2 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/launcher/farm.d.ts +5 -5
- package/dist/types/launcher/guard.d.ts +3 -3
- package/dist/types/launcher/lock.d.ts +1 -1
- package/dist/types/launcher/ports.d.ts +3 -3
- package/dist/types/legacy.d.ts +24 -0
- package/dist/types/paths.d.ts +12 -10
- package/dist/types/resolve/conditions.d.ts +1 -1
- package/dist/types/resolve/match.d.ts +1 -1
- package/dist/types/resolve/reconcile.d.ts +1 -1
- package/dist/types/resolve/types.d.ts +3 -3
- package/dist/types/resolve/walk.d.ts +6 -6
- package/dist/types/usage/read.d.ts +1 -1
- package/dist/types/usage/schema.d.ts +2 -2
- package/package.json +5 -4
|
@@ -50,6 +50,8 @@ export interface SupervisorPorts {
|
|
|
50
50
|
};
|
|
51
51
|
/** The installed `headroom --version` output, or undefined when the binary is not on PATH. */
|
|
52
52
|
readonly headroomVersion: () => string | undefined;
|
|
53
|
+
/** The commit the installed headroom was built from, as the install itself records it (`direct_url.json`), or undefined when it was not installed from a git source. */
|
|
54
|
+
readonly installedCommit: () => string | undefined;
|
|
53
55
|
readonly log: (line: string) => void;
|
|
54
56
|
}
|
|
55
57
|
/** First retry delay after a failed start. Half a second keeps a transient blip invisible to the next launch. */
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The library surface of
|
|
2
|
+
* The library surface of agent-shim: the pure, port-injected parts other tools can call in-process instead of shelling out to the CLI. Four groups, none of which imports interactive prompting or argument parsing:
|
|
3
3
|
*
|
|
4
4
|
* - identity and configuration-profile resolution and farm sync (`resolveDecisions`, `resyncFarm`, `buildEntryFacts`, ...), pure over facts and ports passed in;
|
|
5
5
|
* - routing: the front door's Remote-Control-preserving, capability-authenticated CONNECT surface and its certificate authority, the front-door supervisor and ensure lifecycle, and the headroom supervisor and ensure lifecycle, each pure over its injected ports;
|
|
@@ -4,8 +4,8 @@ import { type ResolvedState } from "../resolve/pipeline";
|
|
|
4
4
|
import type { CascadeInput } from "../resolve/walk";
|
|
5
5
|
import type { Diagnostic, EntryFacts } from "../resolve/types";
|
|
6
6
|
import type { FarmFs } from "./ports";
|
|
7
|
-
/** The manifest file each farm carries at its own root, recording what that resync built. Named distinctly from anything Claude Code itself writes into a config directory. */
|
|
8
|
-
export declare const FARM_MANIFEST_FILENAME = ".
|
|
7
|
+
/** The manifest file each farm carries at its own root, recording what that resync built. Named distinctly from anything Claude Code itself writes into a config directory. A farm built under the former name carries `LEGACY_FARM_MANIFEST_FILENAME` instead, which is read as a fallback and never carried into the next farm, whose resync writes this name. */
|
|
8
|
+
export declare const FARM_MANIFEST_FILENAME = ".agent-shim-farm.json";
|
|
9
9
|
/** Reads and validates the manifest at a farm root, or undefined when it is missing, unparseable, or does not validate. */
|
|
10
10
|
export declare function readFarmManifest(fs: FarmFs, farmRoot: string): FarmManifest | undefined;
|
|
11
11
|
/** Everything `buildEntryFacts` needs. Everything except the tree itself is injected, so the fact manifest is reproducible from a fake filesystem, a fake clock, and a fake branch. */
|
|
@@ -60,7 +60,7 @@ export interface CarryOverResult {
|
|
|
60
60
|
*
|
|
61
61
|
* One category is not ambiguous, though: `runtime`'s own definition (see `config/categories.default.json`'s category table in the README) is specifically "live per-process or per-machine artifacts" — daemon locks, an MCP auth-needed cache, an update-check result — that make no sense being preserved across a swap at all, let alone fought over. When `classification` is given, a colliding name whose category resolves to `runtime` is discarded from the superseded copy and left exactly as the new farm already has it, with no data ever moved: `keep-new` is not a judgement call for this category, it is what the category already means. This needs only the name's *static* classification, never the resolved shared/not-shared decision for the current directory — a `runtime` entry is disposable whether or not this identity currently chooses to share it, so no cascade resolution is needed to make the call.
|
|
62
62
|
*
|
|
63
|
-
* Exported so `launcher/farmResolve.ts` can reuse this exact collision detection (and the same `runtime` auto-resolution) for `
|
|
63
|
+
* Exported so `launcher/farmResolve.ts` can reuse this exact collision detection (and the same `runtime` auto-resolution) for `agent-shim identity resolve-conflicts`'s interactive pass, rather than a second implementation that could drift from this one.
|
|
64
64
|
*/
|
|
65
65
|
export declare function carryOver(params: CarryOverParams): CarryOverResult;
|
|
66
66
|
/** What recovery found and did. */
|
|
@@ -101,10 +101,10 @@ export declare function recoverFarm(params: RecoverFarmParams): RecoveryResult;
|
|
|
101
101
|
/** Inputs to `resyncFarm`. */
|
|
102
102
|
export interface ResyncFarmParams {
|
|
103
103
|
readonly fs: FarmFs;
|
|
104
|
-
/** `~/.
|
|
104
|
+
/** `~/.agent-shim/identities` — the farm root's parent, and where the lock, scratch trees, and superseded farms all live. */
|
|
105
105
|
readonly identitiesDir: string;
|
|
106
106
|
readonly identity: string;
|
|
107
|
-
/** The configuration profile this launch resolved to, recorded in the manifest for `
|
|
107
|
+
/** The configuration profile this launch resolved to, recorded in the manifest for `agent-shim check`. */
|
|
108
108
|
readonly configProfile?: string;
|
|
109
109
|
/** The canonical `~/.claude` every farm symlink points back into. */
|
|
110
110
|
readonly claudeHome: string;
|
|
@@ -18,7 +18,7 @@ export interface InjectedCredential {
|
|
|
18
18
|
*
|
|
19
19
|
* An empty string counts as unset, not set — confirmed load-bearing: one of Joe's real wrapper scripts (`o`, running Claude Code against OpenRouter) does `export ANTHROPIC_API_KEY=""` specifically to *clear* it so `ANTHROPIC_AUTH_TOKEN` takes effect instead, and this must never trip the guard.
|
|
20
20
|
*
|
|
21
|
-
* `injected`, when given, is the credential this launch exports for its own identity. Its variable holding exactly that value is not ambient: it is what a
|
|
21
|
+
* `injected`, when given, is the credential this launch exports for its own identity. Its variable holding exactly that value is not ambient: it is what a agent-shim launch of the same identity left in the environment of the session this one starts from (a `claude @work` run inside a `claude @work` session). The same variable holding any other value still counts.
|
|
22
22
|
*/
|
|
23
23
|
export declare function detectAmbientCredential(env: Readonly<Record<string, string | undefined>>, injected?: InjectedCredential): AmbientCredentialDetection | undefined;
|
|
24
24
|
/**
|
|
@@ -30,7 +30,7 @@ export interface EvaluateAmbientCredentialGuardParams {
|
|
|
30
30
|
readonly env: Readonly<Record<string, string | undefined>>;
|
|
31
31
|
/** The active identity's own `allowAmbientCredential` setting from its `identity.json`, or false when no identity is known. */
|
|
32
32
|
readonly allowAmbientCredential: boolean;
|
|
33
|
-
/** True when `
|
|
33
|
+
/** True when `AGENT_SHIM_ALLOW_AMBIENT_CREDENTIAL=1` is set for this one invocation. */
|
|
34
34
|
readonly allowAmbientCredentialOverride: boolean;
|
|
35
35
|
/** The active identity's name, for the message's persistent-opt-in command. Undefined when no identity is known. */
|
|
36
36
|
readonly identityName?: string;
|
|
@@ -50,7 +50,7 @@ export type AmbientCredentialGuardResult = {
|
|
|
50
50
|
readonly message: string;
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
|
-
* Evaluates the ambient-credential guard: refuses unless no guarded variable is set, or the active identity opted in (`allowAmbientCredential: true`), or this one invocation opted in (`
|
|
53
|
+
* Evaluates the ambient-credential guard: refuses unless no guarded variable is set, or the active identity opted in (`allowAmbientCredential: true`), or this one invocation opted in (`AGENT_SHIM_ALLOW_AMBIENT_CREDENTIAL=1`), or a provider takes over the child's credential (see `providerSelected`).
|
|
54
54
|
*
|
|
55
55
|
* This guard is about credential isolation, not identity/config-dir selection — it must still run even when the `CLAUDE_CONFIG_DIR`-already-set escape hatch applies (callers pass `allowAmbientCredential: false` and no `identityName` in that case, since there is no active identity to consult).
|
|
56
56
|
*/
|
|
@@ -16,7 +16,7 @@ export declare class IdentityLockBusyError extends CliError {
|
|
|
16
16
|
/** Everything `acquireIdentityLock` needs, all of it injected so a test never sleeps for real, never reads a real pid table, and never writes outside its own fake filesystem. */
|
|
17
17
|
export interface AcquireIdentityLockParams {
|
|
18
18
|
readonly identity: string;
|
|
19
|
-
/** The directory the lock file lives in — `~/.
|
|
19
|
+
/** The directory the lock file lives in — `~/.agent-shim/identities`, alongside (never inside) the farm the lock protects, so a farm swap can rename the farm root out from under itself without disturbing the lock. */
|
|
20
20
|
readonly dir: string;
|
|
21
21
|
readonly fs: FarmFs;
|
|
22
22
|
readonly nowMs: () => number;
|
|
@@ -19,7 +19,7 @@ export interface FarmStat {
|
|
|
19
19
|
readonly sizeBytes: number;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Every filesystem operation the farm resync performs, injected so the whole of `src/launcher/farm.ts` — symlink creation, materialisation, adoption copies, and the atomic swap itself — runs against an in-memory fake in tests and never against a real `~/.claude` or `~/.
|
|
22
|
+
* Every filesystem operation the farm resync performs, injected so the whole of `src/launcher/farm.ts` — symlink creation, materialisation, adoption copies, and the atomic swap itself — runs against an in-memory fake in tests and never against a real `~/.claude` or `~/.agent-shim`.
|
|
23
23
|
*
|
|
24
24
|
* `lstat` never follows symlinks: a `~/.claude` that contains a directory symlink escaping the tree (a skills directory linked out to a separate dotfiles repository, say) must be recorded as one symlink entry rather than recursed into, both to keep the fact manifest finite and because the farm links such an entry at `<claudeHome>/<rel>` and lets the OS resolve the remaining hops.
|
|
25
25
|
*/
|
|
@@ -82,7 +82,7 @@ export interface RunPort {
|
|
|
82
82
|
/**
|
|
83
83
|
* The running process itself: its environment, its logical argv, and the ability to terminate with an exit code.
|
|
84
84
|
*
|
|
85
|
-
* `argv` is the *logical* CLI arguments only — whatever the user typed after `claude`/`
|
|
85
|
+
* `argv` is the *logical* CLI arguments only — whatever the user typed after `claude`/`agent-shim`, already stripped of the Node executable path and the script path (`process.argv.slice(2)` in the real implementation). `exit` mirrors `process.exit`'s own `never` return type: a real process never returns from it, and a test fake enforces the same shape by throwing a marker so control flow unwinds the same way in both cases.
|
|
86
86
|
*/
|
|
87
87
|
export interface ProcPort {
|
|
88
88
|
readonly env: Readonly<Record<string, string | undefined>>;
|
|
@@ -125,7 +125,7 @@ export interface FrontDoorUp {
|
|
|
125
125
|
readonly port: number;
|
|
126
126
|
/** The loopback port the CONNECT surface listens on: what an OAuth launch points HTTPS_PROXY at. */
|
|
127
127
|
readonly connectPort: number;
|
|
128
|
-
/** The CA bundle every routed child points NODE_EXTRA_CA_CERTS at:
|
|
128
|
+
/** The CA bundle every routed child points NODE_EXTRA_CA_CERTS at: agent-shim's CA (which signs both the provider listener's leaf and the CONNECT surface's), plus whatever the parent environment already trusted that way. */
|
|
129
129
|
readonly trustBundlePath: string;
|
|
130
130
|
/** Why the trust bundle dropped something the parent environment named, when it did; the launcher logs it. */
|
|
131
131
|
readonly trustWarning?: string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything agent-shim still honours from its former name, `claude-use`, so an installation, a committed project config or an exported environment written for the old name keeps working. Nothing here is consulted when the current name's equivalent is present: a current name always wins, and the legacy form is only a fallback that `agent-shim doctor` reports so it can be retired.
|
|
3
|
+
*/
|
|
4
|
+
/** Prefix of every environment variable agent-shim reads. */
|
|
5
|
+
export declare const ENV_PREFIX = "AGENT_SHIM_";
|
|
6
|
+
/** The former prefix, still accepted wherever `ENV_PREFIX` is. */
|
|
7
|
+
export declare const LEGACY_ENV_PREFIX = "CLAUDE_USE_";
|
|
8
|
+
/** The state root directory name under the home directory. */
|
|
9
|
+
export declare const HOME_DIRNAME = ".agent-shim";
|
|
10
|
+
/**
|
|
11
|
+
* The former state root directory name. It is adopted in place rather than moved: macOS Claude Code keys each identity's Keychain login on the exact `CLAUDE_CONFIG_DIR` string (`<root>/identities/<name>`), so relocating the root would sign every identity out.
|
|
12
|
+
*/
|
|
13
|
+
export declare const LEGACY_HOME_DIRNAME = ".claude-use";
|
|
14
|
+
/** Former committed and per-clone portable config file names. */
|
|
15
|
+
export declare const LEGACY_PORTABLE_CONFIG_FILENAME = ".claude-use.json";
|
|
16
|
+
export declare const LEGACY_PORTABLE_LOCAL_CONFIG_FILENAME = ".claude-use.local.json";
|
|
17
|
+
/** The former farm manifest file name, read when a farm built by an older release has no current one. */
|
|
18
|
+
export declare const LEGACY_FARM_MANIFEST_FILENAME = ".claude-use-farm.json";
|
|
19
|
+
/** The former executable name, still installed beside the current one and still dispatched to the same program. */
|
|
20
|
+
export declare const LEGACY_COMMAND_NAME = "claude-use";
|
|
21
|
+
/**
|
|
22
|
+
* Copies every `CLAUDE_USE_*` variable in `env` to its `AGENT_SHIM_*` name unless that name is already set, mutating `env`. Returns the legacy names that supplied a value, in sorted order. An empty current value counts as set, so exporting `AGENT_SHIM_X=` still overrides a stale `CLAUDE_USE_X`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function aliasLegacyEnv(env: NodeJS.ProcessEnv): string[];
|
package/dist/types/paths.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The resolved set of paths
|
|
2
|
+
* The resolved set of paths agent-shim reads and writes under its own root.
|
|
3
3
|
*
|
|
4
|
-
* `root` is always
|
|
4
|
+
* `root` is always AGENT_SHIM_HOME when that environment variable is set (used by every test in this project, and by any real installation that wants to relocate its state), falling back to `~/.agent-shim` (or the former `~/.claude-use`, see `resolveAgentShimHome`) only when the variable is unset. Every other field is derived from `root` so there is exactly one place a path can go wrong.
|
|
5
5
|
*/
|
|
6
6
|
export interface LayoutPaths {
|
|
7
|
-
/** The resolved root directory
|
|
7
|
+
/** The resolved root directory, see `resolveAgentShimHome`. */
|
|
8
8
|
readonly root: string;
|
|
9
9
|
/** Directory holding one subdirectory per identity (symlink farm + local credentials/daemon state). */
|
|
10
10
|
readonly identitiesDir: string;
|
|
@@ -14,13 +14,13 @@ export interface LayoutPaths {
|
|
|
14
14
|
readonly providersDir: string;
|
|
15
15
|
/** Path to the directory-rules.json file describing directory-scoped identity/profile pins. */
|
|
16
16
|
readonly directoryRulesFile: string;
|
|
17
|
-
/** Path to the persisted active-identity file (the identity `
|
|
17
|
+
/** Path to the persisted active-identity file (the identity `agent-shim identity use` selected). */
|
|
18
18
|
readonly activeIdentityFile: string;
|
|
19
19
|
/** Path to the global config.json (user-global override layer, and default profile/walk-limit settings). */
|
|
20
20
|
readonly globalConfigFile: string;
|
|
21
21
|
/** Path to the categories.local.json overlay recording answers to "unclassified entry" prompts. */
|
|
22
22
|
readonly categoriesLocalFile: string;
|
|
23
|
-
/** Path to the claude-shim.json marker recording where `
|
|
23
|
+
/** Path to the claude-shim.json marker recording where `agent-shim shim enable` last placed a `claude`-named copy of this executable, and how. */
|
|
24
24
|
readonly claudeShimFile: string;
|
|
25
25
|
/** Directory holding the headroom daemon's coordination state: state.json, the start lock, and the session registry. */
|
|
26
26
|
readonly headroomDir: string;
|
|
@@ -62,16 +62,18 @@ export interface LayoutPaths {
|
|
|
62
62
|
readonly usagePicksFile: string;
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
|
-
* Resolves the
|
|
65
|
+
* Resolves the state root: `AGENT_SHIM_HOME` when set to a non-empty string (an empty string counts as unset, consistent with how this project treats empty-string environment variables elsewhere, see the ambient-credential guard), otherwise `~/.agent-shim`, or the former `~/.claude-use` when only that exists.
|
|
66
|
+
*
|
|
67
|
+
* The former root is used where it stands, never moved: macOS Claude Code names each identity's Keychain entry after a hash of its exact `CLAUDE_CONFIG_DIR`, so any relocation would sign every identity out. A fresh installation, or one that already has `~/.agent-shim`, uses the current name.
|
|
66
68
|
*/
|
|
67
|
-
export declare function
|
|
69
|
+
export declare function resolveAgentShimHome(env?: NodeJS.ProcessEnv, home?: string, isDirectory?: (candidate: string) => boolean): string;
|
|
68
70
|
/**
|
|
69
|
-
* Resolves the canonical `~/.claude` directory every farm symlink points back into: `
|
|
71
|
+
* Resolves the canonical `~/.claude` directory every farm symlink points back into: `AGENT_SHIM_CLAUDE_HOME` when set to a non-empty string, otherwise `~/.claude`.
|
|
70
72
|
*
|
|
71
|
-
* The override exists for the same reason `
|
|
73
|
+
* The override exists for the same reason `AGENT_SHIM_HOME` does. Exercising a real resync end to end means building and swapping real directories, and doing that against a real, in-use `~/.claude` to find out whether the code is correct is not an acceptable way to find out. Pointing both variables at throwaway directories makes a full end-to-end run safe.
|
|
72
74
|
*/
|
|
73
75
|
export declare function resolveClaudeHome(): string;
|
|
74
76
|
/** Builds the full LayoutPaths structure from a given root directory. */
|
|
75
77
|
export declare function buildLayoutPaths(root: string): LayoutPaths;
|
|
76
|
-
/** Resolves
|
|
78
|
+
/** Resolves AGENT_SHIM_HOME and builds the full LayoutPaths structure in one call. */
|
|
77
79
|
export declare function resolveLayoutPaths(): LayoutPaths;
|
|
@@ -28,7 +28,7 @@ export declare function matchBranch(pattern: string, branch: string | undefined,
|
|
|
28
28
|
/**
|
|
29
29
|
* Evaluates a `when` object. Every present field must hold — conditions AND together within one object.
|
|
30
30
|
*
|
|
31
|
-
* An absent condition is vacuously true, so `when: {}` passes; `
|
|
31
|
+
* An absent condition is vacuously true, so `when: {}` passes; `agent-shim check` warns about that rather than erroring, since an empty object is more likely a half-finished edit than an intentional statement.
|
|
32
32
|
*
|
|
33
33
|
* `newerThan`, `olderThan`, and `maxSizeBytes` read the subtree-aggregated facts (`latestMtimeMs`, `totalSizeBytes`), never the entry's own inode stat: a directory's own mtime does not change when a file three levels beneath it is rewritten, and its own size is a ~4KB inode figure that says nothing about what it contains.
|
|
34
34
|
*/
|
|
@@ -46,7 +46,7 @@ export declare function patternCouldReachUnder(canonicalPattern: string, dir: st
|
|
|
46
46
|
*
|
|
47
47
|
* The order, exactly:
|
|
48
48
|
*
|
|
49
|
-
* 1. **Different layers — the later layer wins, period.** This rank sits deliberately *above* exactness. Ranking exactness first would let an untrusted committed `.
|
|
49
|
+
* 1. **Different layers — the later layer wins, period.** This rank sits deliberately *above* exactness. Ranking exactness first would let an untrusted committed `.agent-shim.json`'s exact key beat your own later, personal glob override, breaking the design's stated trust property that a directory-scoped local rule can only ever tighten what a committed file opened, never the reverse. Nothing in the design asserts that an earlier exact key beats a later glob, so nothing is lost by closing that hole.
|
|
50
50
|
* 2. Same layer: an exact literal beats a glob.
|
|
51
51
|
* 3. Same layer: the longer literal prefix wins.
|
|
52
52
|
* 4. Same layer: more path segments wins, which separates a one-wildcard pattern from a two-wildcard one at the same depth.
|
|
@@ -35,7 +35,7 @@ export type ReconcileAction =
|
|
|
35
35
|
readonly kind: "adopt-conflict";
|
|
36
36
|
readonly rel: string;
|
|
37
37
|
}
|
|
38
|
-
/** Nothing to do, with the reason recorded so `
|
|
38
|
+
/** Nothing to do, with the reason recorded so `agent-shim check` can explain a no-op. */
|
|
39
39
|
| {
|
|
40
40
|
readonly kind: "skip";
|
|
41
41
|
readonly rel: string;
|
|
@@ -7,7 +7,7 @@ type LayerKind = "global-config" | "config-profile" | "directory-rule" | "portab
|
|
|
7
7
|
export interface Layer {
|
|
8
8
|
readonly id: LayerId;
|
|
9
9
|
readonly kind: LayerKind;
|
|
10
|
-
/** Human-readable origin (a file path, or a profile name) used by `
|
|
10
|
+
/** Human-readable origin (a file path, or a profile name) used by `agent-shim check` to explain a decision. */
|
|
11
11
|
readonly source: string;
|
|
12
12
|
readonly categories?: CategoryMap;
|
|
13
13
|
readonly entries?: Entries;
|
|
@@ -72,7 +72,7 @@ export interface CompiledRule {
|
|
|
72
72
|
/** Matches the pattern itself and everything beneath it, so a rule on `skills` covers `skills/commit/SKILL.md`. */
|
|
73
73
|
readonly matches: (relPath: string) => boolean;
|
|
74
74
|
}
|
|
75
|
-
/** How a decision was reached, for `
|
|
75
|
+
/** How a decision was reached, for `agent-shim check`'s "which layer decided this" output. */
|
|
76
76
|
type DecisionVia =
|
|
77
77
|
/** The unconditional pre-cascade floor: the path's real classification is `secret`. */
|
|
78
78
|
"secret-floor"
|
|
@@ -100,7 +100,7 @@ export interface EliminatedRule {
|
|
|
100
100
|
readonly rule: CompiledRule;
|
|
101
101
|
readonly failed: readonly string[];
|
|
102
102
|
}
|
|
103
|
-
/** Every diagnostic the resolver can raise. Codes are stable strings so `
|
|
103
|
+
/** Every diagnostic the resolver can raise. Codes are stable strings so `agent-shim check` and tests can assert on them. */
|
|
104
104
|
type DiagnosticCode =
|
|
105
105
|
/** A profile's `extends` graph contains a cycle. */
|
|
106
106
|
"EXTENDS_CYCLE"
|
|
@@ -23,19 +23,19 @@ export declare function walkDirectoryAncestors(cwd: string, options: WalkOptions
|
|
|
23
23
|
/** The up-to-three configuration sources that can apply at one directory level. */
|
|
24
24
|
export interface DirectoryLevelSources {
|
|
25
25
|
readonly dir: string;
|
|
26
|
-
/** The committed, team-shared `.
|
|
26
|
+
/** The committed, team-shared `.agent-shim.json` at this level. */
|
|
27
27
|
readonly portable?: {
|
|
28
28
|
readonly config: PortableConfig;
|
|
29
29
|
readonly entryOrder?: readonly string[];
|
|
30
30
|
readonly filepath: string;
|
|
31
31
|
};
|
|
32
|
-
/** Every rule in this user's own `~/.
|
|
32
|
+
/** Every rule in this user's own `~/.agent-shim/directory-rules.json` whose path is exactly this level, in file order. */
|
|
33
33
|
readonly rules?: readonly {
|
|
34
34
|
readonly rule: DirectoryRule;
|
|
35
35
|
readonly entryOrder?: readonly string[];
|
|
36
36
|
readonly filepath: string;
|
|
37
37
|
}[];
|
|
38
|
-
/** The gitignored `.
|
|
38
|
+
/** The gitignored `.agent-shim.local.json` at this level. */
|
|
39
39
|
readonly portableLocal?: {
|
|
40
40
|
readonly config: PortableConfig;
|
|
41
41
|
readonly entryOrder?: readonly string[];
|
|
@@ -45,7 +45,7 @@ export interface DirectoryLevelSources {
|
|
|
45
45
|
/** Everything needed to assemble the full ordered layer sequence, all of it already loaded by the caller. */
|
|
46
46
|
export interface CascadeInput {
|
|
47
47
|
readonly home: string;
|
|
48
|
-
/** The user-global `~/.
|
|
48
|
+
/** The user-global `~/.agent-shim/config.json`, the least-specific layer above the shipped defaults. */
|
|
49
49
|
readonly globalConfig?: {
|
|
50
50
|
readonly config: GlobalConfig;
|
|
51
51
|
readonly entryOrder?: readonly string[];
|
|
@@ -70,7 +70,7 @@ export interface AssembledCascade {
|
|
|
70
70
|
readonly diagnostics: readonly Diagnostic[];
|
|
71
71
|
/** The deepest directory-level `identity` pin encountered, which the launcher uses as a safety net beneath an explicit `@name`. */
|
|
72
72
|
readonly identityPin?: string;
|
|
73
|
-
/** The deepest directory-level `configProfile` selection encountered, which is what `
|
|
73
|
+
/** The deepest directory-level `configProfile` selection encountered, which is what `agent-shim configure` treats as the active profile for a path. */
|
|
74
74
|
readonly directoryConfigProfile?: string;
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
@@ -78,7 +78,7 @@ export interface AssembledCascade {
|
|
|
78
78
|
*
|
|
79
79
|
* Order is: the user-global config, then the base configuration profile's own `extends` chain, then every directory level shallowest-to-deepest, then one-off command-line overrides.
|
|
80
80
|
*
|
|
81
|
-
* Within one directory level, up to three sources fold most-personal-last: the committed `.
|
|
81
|
+
* Within one directory level, up to three sources fold most-personal-last: the committed `.agent-shim.json` (team-shared), then this user's own `directory-rules.json` entries for that exact path, then `.agent-shim.local.json` (this clone, this user, never committed). That three-source fold happens once per level, and the whole shallowest-to-deepest walk is one continuous sequence through those folded levels — a deeper level's three-source result composes on top of a shallower level's, never gathered per-source across the whole tree first.
|
|
82
82
|
*
|
|
83
83
|
* A level source that names a `configProfile` composes that profile's whole chain in *before* its own inline overrides, so the source reads as "everything that profile says, plus what is additionally true this far down the tree" rather than swapping the base profile out wholesale.
|
|
84
84
|
*/
|
|
@@ -22,7 +22,7 @@ export declare function listLogSegments(fs: Pick<FarmFs, "readdir">, logDir: str
|
|
|
22
22
|
export interface UsageLogRead {
|
|
23
23
|
/** Every valid record at or after the cut-off, oldest first. */
|
|
24
24
|
readonly records: readonly UsageRecord[];
|
|
25
|
-
/** Complete lines that did not parse as a record of this schema version: a corrupted line, or one a newer
|
|
25
|
+
/** Complete lines that did not parse as a record of this schema version: a corrupted line, or one a newer agent-shim wrote. Reported, never silently dropped. */
|
|
26
26
|
readonly invalidLines: number;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
@@ -234,7 +234,7 @@ export declare const AccountMetadataSchema: z.ZodObject<{
|
|
|
234
234
|
}, z.core.$strict>;
|
|
235
235
|
export type AccountMetadata = z.infer<typeof AccountMetadataSchema>;
|
|
236
236
|
/**
|
|
237
|
-
* The latest state for one identity, rewritten atomically after each recorded response: the snapshot file other tools read (`~/.
|
|
237
|
+
* The latest state for one identity, rewritten atomically after each recorded response: the snapshot file other tools read (`~/.agent-shim/usage/snapshots/<identity>.json`) without shelling out to `agent-shim`.
|
|
238
238
|
*/
|
|
239
239
|
export declare const UsageSnapshotSchema: z.ZodObject<{
|
|
240
240
|
schemaVersion: z.ZodLiteral<1>;
|
|
@@ -312,7 +312,7 @@ export declare const UsageSnapshotSchema: z.ZodObject<{
|
|
|
312
312
|
}, z.core.$strict>;
|
|
313
313
|
export type UsageSnapshot = z.infer<typeof UsageSnapshotSchema>;
|
|
314
314
|
/**
|
|
315
|
-
* Whether a response header is one the store keeps: the quota and rate-limit families the upstreams
|
|
315
|
+
* Whether a response header is one the store keeps: the quota and rate-limit families the upstreams agent-shim routes to send (Anthropic's `anthropic-ratelimit-*`, the IETF draft's `ratelimit*`, the common `x-ratelimit-*`, the Codex backend's `x-codex-*` quota headers, which the Codex route forwards) and `retry-after`. Every one of these carries a number, a time or a status word; none carries a credential or content.
|
|
316
316
|
*/
|
|
317
317
|
export declare function isRateLimitHeader(name: string): boolean;
|
|
318
318
|
export {};
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-use",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Joseph Mearman <joseph@mearman.co.uk>",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/ExaDev/
|
|
9
|
+
"url": "git+https://github.com/ExaDev/agent-shim.git"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://github.com/ExaDev/
|
|
12
|
-
"bugs": "https://github.com/ExaDev/
|
|
11
|
+
"homepage": "https://github.com/ExaDev/agent-shim#readme",
|
|
12
|
+
"bugs": "https://github.com/ExaDev/agent-shim/issues",
|
|
13
13
|
"keywords": [
|
|
14
14
|
"claude-code",
|
|
15
15
|
"claude",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"node": "^22.18 || >=24"
|
|
22
22
|
},
|
|
23
23
|
"bin": {
|
|
24
|
+
"agent-shim": "dist/cli.cjs",
|
|
24
25
|
"claude-use": "dist/cli.cjs"
|
|
25
26
|
},
|
|
26
27
|
"files": [
|