@claudexor/harness-claude 1.0.0 → 2.1.2

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/index.d.ts CHANGED
@@ -1,19 +1,77 @@
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 { canonicalProfileConfigDir } from "./profile.js";
5
+ import { smokeIsolatedApiKey, smokeIsolatedOAuthToken } from "./smoke.js";
6
+ export declare const BIN: string;
7
+ export declare const CLAUDE_PROVIDER_ENV_DENYLIST: string[];
8
+ /** Exported for focused route-policy tests; runtime uses this exact selector. */
9
+ export declare const selectClaudeRunAuthRoute: typeof selectStrictAuthRoute;
10
+ export interface ClaudeReadonlyProfileProbe {
11
+ supported: boolean;
12
+ missingFlags: string[];
13
+ detail: string;
14
+ }
15
+ export declare function probeClaudeReadonlyProfile(abortSignal?: AbortSignal): Promise<ClaudeReadonlyProfileProbe>;
16
+ declare function detectVersion(abortSignal?: AbortSignal): Promise<string | null>;
5
17
  /**
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.
18
+ * Native-session probe with a distinct PROBE-FAILURE state (same contract as
19
+ * the codex adapter's probeLogin). `claude auth status` prints a typed JSON
20
+ * verdict `{loggedIn, authMethod, ...}` on stdout; the exit code alone is NOT
21
+ * the auth verdict. When the JSON is present we trust its `loggedIn` field;
22
+ * a probe that produces no parseable verdict is a probe error, never a silent
23
+ * "not logged in".
15
24
  */
16
- export declare function ensureClaudeNativeAuth(env?: Record<string, string>, nativeDir?: string): boolean;
17
- export declare function createClaudeAdapter(): HarnessAdapter;
25
+ export interface ClaudeAuthStatusProbe {
26
+ loggedIn: boolean;
27
+ authed: boolean;
28
+ authMethod: string | null;
29
+ probeError: string | null;
30
+ }
31
+ export interface ClaudeAuthStatusProbeOptions {
32
+ env?: Record<string, string | null | undefined>;
33
+ /** Explicit CLAUDE_CONFIG_DIR for the probe (INV-135, release wave round-17
34
+ * BLOCK): without it the probe re-normalizes onto the DEFAULT native dir —
35
+ * a credential-profile probe must inspect ITS OWN store, never the
36
+ * default's. Callers without a profile omit it and keep the default. */
37
+ configDir?: string;
38
+ abortSignal?: AbortSignal;
39
+ runCapture?: typeof runCapture;
40
+ }
41
+ export declare function claudeNativeEnv(base?: Record<string, string | null | undefined>, configDir?: string): Record<string, string | null | undefined>;
42
+ export declare function probeAuthStatus(bin?: string, options?: ClaudeAuthStatusProbeOptions): Promise<ClaudeAuthStatusProbe>;
43
+ export declare function anthropicApiKey(): string | null;
44
+ /** A stored/long-lived Claude Code OAuth (`claude setup-token`) for headless
45
+ * subscription auth. The hermetic kill switch is honored inside resolveSecret
46
+ * (single owner), so this reads env-only under CLAUDEXOR_DISABLE_STORED_SECRETS. */
47
+ declare function claudeOAuthToken(): string | null;
48
+ /** The user's real Claude config dir (native subscription session lives here). */
49
+ export declare function defaultNativeClaudeConfigDir(): string;
50
+ export declare function claudeAuthSourceReadiness(input: {
51
+ native: ClaudeAuthStatusProbe;
52
+ oauthAvailable: boolean;
53
+ oauthVerification: "passed" | "failed" | "not_run";
54
+ oauthDetail: string;
55
+ apiKeyAvailable: boolean;
56
+ apiKeyVerification: "passed" | "failed" | "not_run";
57
+ apiKeyDetail: string;
58
+ }): AuthSourceReadiness[];
59
+ export declare function redactClaudeDoctorDetail(text: string): string;
60
+ /** The runtime surface the profile module needs (test-stubbable). */
61
+ export type ClaudeProfileRuntimeDeps = Pick<ClaudeRuntimeDeps, "probeAuthStatus" | "resolveProfileSecret">;
62
+ type ClaudeRuntimeDeps = {
63
+ detectVersion: typeof detectVersion;
64
+ probeAuthStatus: typeof probeAuthStatus;
65
+ anthropicApiKey: typeof anthropicApiKey;
66
+ claudeOAuthToken: typeof claudeOAuthToken;
67
+ /** Profile-scoped secret resolution (INV-135): reads exactly the profile's
68
+ * namespaced ref, never the engine-default ladder. */
69
+ resolveProfileSecret: (ref: string) => string | null;
70
+ smokeIsolatedApiKey: typeof smokeIsolatedApiKey;
71
+ smokeIsolatedOAuthToken: typeof smokeIsolatedOAuthToken;
72
+ probeReadonlyProfile: typeof probeClaudeReadonlyProfile;
73
+ runCliHarness: typeof runCliHarness;
74
+ };
75
+ export declare function createClaudeAdapter(deps?: Partial<ClaudeRuntimeDeps>): HarnessAdapter;
18
76
  export declare function claudeArgsForSpec(spec: HarnessRunSpec, interactive?: boolean, suppressBare?: boolean): string[];
19
77
  //# 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,MAAM,CAAC,EAC5B,SAAS,GAAE,MAAuC,GACjD,OAAO,CAmBT;AAoCD,wBAAgB,mBAAmB,IAAI,cAAc,CA2HpD;AAOD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,WAAW,UAAQ,EAAE,YAAY,UAAQ,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