@claudexor/harness-claude 1.0.1 → 2.1.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.
@@ -0,0 +1,3 @@
1
+ import type { HarnessCapabilityProfile } from "@claudexor/schema";
2
+ export declare const CLAUDE_CAPABILITY_PROFILE: HarnessCapabilityProfile;
3
+ //# sourceMappingURL=capability-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-profile.d.ts","sourceRoot":"","sources":["../src/capability-profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAGlE,eAAO,MAAM,yBAAyB,EAAE,wBAgCpC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { HarnessCapabilityProfile as HarnessCapabilityProfileSchema } from "@claudexor/schema";
2
+ export const CLAUDE_CAPABILITY_PROFILE = HarnessCapabilityProfileSchema.parse({
3
+ auth: {
4
+ supported_sources: ["native_session", "oauth_token_env", "api_key_env"],
5
+ preferred_source: null,
6
+ credential_transports: [
7
+ { source: "native_session", kind: "config_file", relocatable_by: ["CONFIG_DIR"] },
8
+ { source: "native_session", kind: "os_keychain", relocatable_by: ["HOME"] },
9
+ { source: "oauth_token_env", kind: "oauth_token_env", relocatable_by: ["ENV"] },
10
+ { source: "api_key_env", kind: "env_var", relocatable_by: ["ENV"] },
11
+ ],
12
+ },
13
+ access_control: { readonly_mechanism: "tool_allowlist" },
14
+ isolation: {
15
+ supported_containment: ["scoped_home_keychain_bridge", "env_or_file_injection"],
16
+ },
17
+ attachment_inputs: [
18
+ {
19
+ kind: "image",
20
+ mime_types: ["image/png", "image/jpeg", "image/gif", "image/webp"],
21
+ max_bytes: 5 * 1024 * 1024,
22
+ max_count: 20,
23
+ transport: "base64_stream",
24
+ },
25
+ {
26
+ kind: "file",
27
+ mime_types: ["text/plain", "text/markdown", "application/json"],
28
+ max_bytes: 1 * 1024 * 1024,
29
+ max_count: 10,
30
+ transport: "text_inline",
31
+ },
32
+ ],
33
+ });
34
+ //# sourceMappingURL=capability-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability-profile.js","sourceRoot":"","sources":["../src/capability-profile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,IAAI,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AAE/F,MAAM,CAAC,MAAM,yBAAyB,GACpC,8BAA8B,CAAC,KAAK,CAAC;IACnC,IAAI,EAAE;QACJ,iBAAiB,EAAE,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,aAAa,CAAC;QACvE,gBAAgB,EAAE,IAAI;QACtB,qBAAqB,EAAE;YACrB,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC,YAAY,CAAC,EAAE;YACjF,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC,MAAM,CAAC,EAAE;YAC3E,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,iBAAiB,EAAE,cAAc,EAAE,CAAC,KAAK,CAAC,EAAE;YAC/E,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,KAAK,CAAC,EAAE;SACpE;KACF;IACD,cAAc,EAAE,EAAE,kBAAkB,EAAE,gBAAgB,EAAE;IACxD,SAAS,EAAE;QACT,qBAAqB,EAAE,CAAC,6BAA6B,EAAE,uBAAuB,CAAC;KAChF;IACD,iBAAiB,EAAE;QACjB;YACE,IAAI,EAAE,OAAO;YACb,UAAU,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,CAAC;YAClE,SAAS,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;YAC1B,SAAS,EAAE,EAAE;YACb,SAAS,EAAE,eAAe;SAC3B;QACD;YACE,IAAI,EAAE,MAAM;YACZ,UAAU,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,kBAAkB,CAAC;YAC/D,SAAS,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI;YAC1B,SAAS,EAAE,EAAE;YACb,SAAS,EAAE,aAAa;SACzB;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The honest native-login remedy for Claude doctor reasons (INV-067).
3
+ *
4
+ * Native setup is the product path. Scoped macOS runs receive a Claude-only
5
+ * Keychain bridge; if that bridge cannot be prepared, disclose the
6
+ * infrastructure cause instead of claiming the user is logged out.
7
+ */
8
+ export declare function claudeNativeLoginRemedy(env: Record<string, string | null | undefined> | undefined): string;
9
+ //# sourceMappingURL=doctor-remedy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor-remedy.d.ts","sourceRoot":"","sources":["../src/doctor-remedy.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,SAAS,GACzD,MAAM,CAKR"}
@@ -0,0 +1,15 @@
1
+ import { CLAUDE_KEYCHAIN_BRIDGE_ENV } from "./native-home.js";
2
+ /**
3
+ * The honest native-login remedy for Claude doctor reasons (INV-067).
4
+ *
5
+ * Native setup is the product path. Scoped macOS runs receive a Claude-only
6
+ * Keychain bridge; if that bridge cannot be prepared, disclose the
7
+ * infrastructure cause instead of claiming the user is logged out.
8
+ */
9
+ export function claudeNativeLoginRemedy(env) {
10
+ if (env?.[CLAUDE_KEYCHAIN_BRIDGE_ENV] === "unavailable") {
11
+ return "the scoped Claude process could not bridge the macOS login Keychain — reopen Claudexor and retry Native setup, or configure an API key fallback";
12
+ }
13
+ return "open Accounts → Claude → Login (or Settings → Harnesses → Claude → Manage), then complete Native setup; alternatively configure an API key fallback";
14
+ }
15
+ //# sourceMappingURL=doctor-remedy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor-remedy.js","sourceRoot":"","sources":["../src/doctor-remedy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,GAA0D;IAE1D,IAAI,GAAG,EAAE,CAAC,0BAA0B,CAAC,KAAK,aAAa,EAAE,CAAC;QACxD,OAAO,iJAAiJ,CAAC;IAC3J,CAAC;IACD,OAAO,qJAAqJ,CAAC;AAC/J,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,19 +1,76 @@
1
- import type { HarnessRunSpec } from "@claudexor/schema";
1
+ import type { AuthSourceReadiness, HarnessRunSpec } from "@claudexor/schema";
2
2
  import type { HarnessAdapter } from "@claudexor/core";
3
- /** The user's real Claude config dir (native subscription session lives here). */
4
- export declare function defaultNativeClaudeConfigDir(): string;
3
+ import { runCapture, runCliHarness, selectStrictAuthRoute } from "@claudexor/core";
4
+ export { defaultNativeClaudeConfigDir } from "./native-home.js";
5
+ export { canonicalProfileConfigDir } from "./profile.js";
6
+ import { smokeIsolatedApiKey, smokeIsolatedOAuthToken } from "./smoke.js";
7
+ export declare const BIN: string;
8
+ export declare const CLAUDE_PROVIDER_ENV_DENYLIST: string[];
9
+ /** Exported for focused route-policy tests; runtime uses this exact selector. */
10
+ export declare const selectClaudeRunAuthRoute: typeof selectStrictAuthRoute;
11
+ export interface ClaudeReadonlyProfileProbe {
12
+ supported: boolean;
13
+ missingFlags: string[];
14
+ detail: string;
15
+ }
16
+ export declare function probeClaudeReadonlyProfile(abortSignal?: AbortSignal): Promise<ClaudeReadonlyProfileProbe>;
17
+ declare function detectVersion(abortSignal?: AbortSignal): Promise<string | null>;
5
18
  /**
6
- * Seed the user's NATIVE Claude session (`.credentials.json`, subscription OAuth)
7
- * into an isolated CLAUDE_CONFIG_DIR so a Pro/Max subscriber with NO API key can
8
- * run inside a Claudexor envelope. Copies only if scoped creds are absent and a
9
- * native credentials file exists; never overwrites. Returns true when scoped
10
- * creds are present afterwards.
11
- *
12
- * Caveats encoded by the caller: `ANTHROPIC_API_KEY` takes precedence over the
13
- * OAuth session, and `--bare` disables it — so the subscription route must set
14
- * neither.
19
+ * Native-session probe with a distinct PROBE-FAILURE state (same contract as
20
+ * the codex adapter's probeLogin). `claude auth status` prints a typed JSON
21
+ * verdict `{loggedIn, authMethod, ...}` on stdout; the exit code alone is NOT
22
+ * the auth verdict. When the JSON is present we trust its `loggedIn` field;
23
+ * a probe that produces no parseable verdict is a probe error, never a silent
24
+ * "not logged in".
15
25
  */
16
- export declare function ensureClaudeNativeAuth(env?: Record<string, string>, nativeDir?: string): boolean;
17
- export declare function createClaudeAdapter(): HarnessAdapter;
26
+ export interface ClaudeAuthStatusProbe {
27
+ loggedIn: boolean;
28
+ authed: boolean;
29
+ authMethod: string | null;
30
+ probeError: string | null;
31
+ }
32
+ export interface ClaudeAuthStatusProbeOptions {
33
+ env?: Record<string, string | null | undefined>;
34
+ /** Explicit CLAUDE_CONFIG_DIR for the probe (INV-135, release wave round-17
35
+ * BLOCK): without it the probe re-normalizes onto the DEFAULT native dir —
36
+ * a credential-profile probe must inspect ITS OWN store, never the
37
+ * default's. Callers without a profile omit it and keep the default. */
38
+ configDir?: string;
39
+ abortSignal?: AbortSignal;
40
+ runCapture?: typeof runCapture;
41
+ }
42
+ export declare function claudeNativeEnv(base?: Record<string, string | null | undefined>, configDir?: string): Record<string, string | null | undefined>;
43
+ export declare function probeAuthStatus(bin?: string, options?: ClaudeAuthStatusProbeOptions): Promise<ClaudeAuthStatusProbe>;
44
+ export declare function anthropicApiKey(): string | null;
45
+ /** A stored/long-lived Claude Code OAuth (`claude setup-token`) for headless
46
+ * subscription auth. The hermetic kill switch is honored inside resolveSecret
47
+ * (single owner), so this reads env-only under CLAUDEXOR_DISABLE_STORED_SECRETS. */
48
+ declare function claudeOAuthToken(): string | null;
49
+ export declare function claudeAuthSourceReadiness(input: {
50
+ native: ClaudeAuthStatusProbe;
51
+ oauthAvailable: boolean;
52
+ oauthVerification: "passed" | "failed" | "not_run";
53
+ oauthDetail: string;
54
+ apiKeyAvailable: boolean;
55
+ apiKeyVerification: "passed" | "failed" | "not_run";
56
+ apiKeyDetail: string;
57
+ }): AuthSourceReadiness[];
58
+ export declare function redactClaudeDoctorDetail(text: string): string;
59
+ /** The runtime surface the profile module needs (test-stubbable). */
60
+ export type ClaudeProfileRuntimeDeps = Pick<ClaudeRuntimeDeps, "probeAuthStatus" | "resolveProfileSecret">;
61
+ type ClaudeRuntimeDeps = {
62
+ detectVersion: typeof detectVersion;
63
+ probeAuthStatus: typeof probeAuthStatus;
64
+ anthropicApiKey: typeof anthropicApiKey;
65
+ claudeOAuthToken: typeof claudeOAuthToken;
66
+ /** Profile-scoped secret resolution (INV-135): reads exactly the profile's
67
+ * namespaced ref, never the engine-default ladder. */
68
+ resolveProfileSecret: (ref: string) => string | null;
69
+ smokeIsolatedApiKey: typeof smokeIsolatedApiKey;
70
+ smokeIsolatedOAuthToken: typeof smokeIsolatedOAuthToken;
71
+ probeReadonlyProfile: typeof probeClaudeReadonlyProfile;
72
+ runCliHarness: typeof runCliHarness;
73
+ };
74
+ export declare function createClaudeAdapter(deps?: Partial<ClaudeRuntimeDeps>): HarnessAdapter;
18
75
  export declare function claudeArgsForSpec(spec: HarnessRunSpec, interactive?: boolean, suppressBare?: boolean): string[];
19
76
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAyG,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE/J,OAAO,KAAK,EAAc,cAAc,EAAsB,MAAM,iBAAiB,CAAC;AAmFtF,kFAAkF;AAClF,wBAAgB,4BAA4B,IAAI,MAAM,CAIrD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAA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