@cortexkit/anthropic-auth-core 2.13.1 → 2.14.1

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.
@@ -14,14 +14,14 @@ export interface SessionToolWait {
14
14
  /** Epoch milliseconds when the oldest running plan tool started. */
15
15
  since: number;
16
16
  }
17
- export declare const CACHE_WARM_STOP_REASONS: readonly ['cost-cap', 'count-cap', 'outside-hours', 'session-ended', 'unsupported'];
17
+ export declare const CACHE_WARM_STOP_REASONS: readonly ['cost-cap', 'count-cap', 'deadline-missed', 'outside-hours', 'session-ended', 'unsupported'];
18
18
  /** Billing rejects unknown stop reasons; omit them rather than guessing. */
19
19
  export declare function isCacheWarmStopReason(value: unknown): value is (typeof CACHE_WARM_STOP_REASONS)[number];
20
20
  /**
21
21
  * The stop reasons the llm-runner contract defines today; any other string is
22
22
  * accepted too, for reasons that contract adds later.
23
23
  */
24
- export type CacheWarmStopReason = 'cost-cap' | 'count-cap' | 'outside-hours' | 'session-ended' | 'unsupported' | (string & Record<never, never>);
24
+ export type CacheWarmStopReason = 'cost-cap' | 'count-cap' | 'deadline-missed' | 'outside-hours' | 'session-ended' | 'unsupported' | (string & Record<never, never>);
25
25
  export interface CacheTouchInput {
26
26
  /** Integer epoch milliseconds when the provider answered. */
27
27
  at: number;
@@ -1,4 +1,5 @@
1
1
  import { type MenuTerminal } from '../auth-menu/terminal.js';
2
+ import { SetupProcessGuard } from './process-guard.js';
2
3
  import type { SetupEnrollmentAccess, SetupHost, SetupIO, SetupPlugin } from './types.js';
3
4
  /** Fixed text: no version, host or account detail, so it is safe to print anywhere. */
4
5
  export declare const UNSUPPORTED_VAULT_MESSAGE = "This Claustrum vault is too old to connect plugins. Run ck upgrade to move to Claustrum v0.2.0 or newer (read \"Upgrading from v0.1.3\" in its release notes first), or run setup without --claustrum to use local accounts.";
@@ -31,4 +32,4 @@ export declare class HostNotEnrolledError extends Error {
31
32
  });
32
33
  }
33
34
  /** Enroll an independently revocable host; plugin callbacks choose its credential store and account permissions. */
34
- export declare function connectSetupHost(plugin: SetupPlugin, host: SetupHost, io: SetupIO, terminal: MenuTerminal, fence: () => Promise<void>): Promise<SetupEnrollmentAccess | undefined>;
35
+ export declare function connectSetupHost(plugin: SetupPlugin, host: SetupHost, io: SetupIO, terminal: MenuTerminal, fence: (() => Promise<void>) | SetupProcessGuard): Promise<SetupEnrollmentAccess | undefined>;
@@ -1,6 +1,8 @@
1
1
  import type { CommandRunner, ProcessFence, SetupEnvironment } from './types.js';
2
2
  export interface ProcessInspectionStep {
3
3
  step: 'tasklist' | 'CIM' | 'ps';
4
+ /** The selected CIM interpreter; absent for tasklist and ps. */
5
+ program?: 'pwsh' | 'powershell';
4
6
  exitCode: number | null;
5
7
  signal: NodeJS.Signals | null;
6
8
  timedOut: boolean;
@@ -9,6 +11,7 @@ export interface ProcessInspectionStep {
9
11
  export declare class ProcessInspectionError extends Error implements ProcessInspectionStep {
10
12
  readonly code = "process-inspection-failed";
11
13
  readonly step: ProcessInspectionStep['step'];
14
+ readonly program?: ProcessInspectionStep['program'];
12
15
  readonly exitCode: number | null;
13
16
  readonly signal: NodeJS.Signals | null;
14
17
  readonly timedOut: boolean;
@@ -30,6 +33,10 @@ export declare class ProcessFenceViolationError extends Error {
30
33
  export declare function listSetupProcesses(runner?: CommandRunner, options?: {
31
34
  platform?: string;
32
35
  env?: SetupEnvironment;
36
+ /** Tests can replace the regular-file check for the fixed pwsh location. */
37
+ isFile?: (file: string) => boolean;
38
+ /** Reports before each slow Windows ARM PowerShell 5.1 check. */
39
+ onProgress?: (line: string) => void;
33
40
  onStep?: (details: ProcessInspectionStep) => void;
34
41
  /** False skips the Windows PowerShell query for Node and Bun command lines. */
35
42
  inspectRuntimes?: boolean;
@@ -53,5 +60,7 @@ export declare function listSetupProcesses(runner?: CommandRunner, options?: {
53
60
  export declare function createProcessFence(runner?: CommandRunner, options?: {
54
61
  platform?: string;
55
62
  selfPid?: number;
63
+ isFile?: (file: string) => boolean;
64
+ onProgress?: (line: string) => void;
56
65
  }): ProcessFence;
57
66
  export declare function assertHostsStopped(fence: ProcessFence, env?: SetupEnvironment): Promise<void>;
@@ -0,0 +1,12 @@
1
+ /** Reuse an inspection only while setup has done nothing a running host could observe. */
2
+ export declare class SetupProcessGuard {
3
+ #private;
4
+ private readonly inspect;
5
+ private readonly now;
6
+ constructor(inspect: () => Promise<void>, now?: () => number);
7
+ check(options?: {
8
+ reuse?: boolean;
9
+ }): Promise<void>;
10
+ /** Callbacks, writes and waits can all make an earlier inspection stale. */
11
+ step<T>(run: () => T | Promise<T>): Promise<T>;
12
+ }
@@ -1,3 +1,4 @@
1
+ import { SetupProcessGuard } from './process-guard.js';
1
2
  import type { OpenCodeGeneration, SetupIO, SetupPlugin } from './types.js';
2
3
  export interface PlannedWrite {
3
4
  path: string;
@@ -9,5 +10,5 @@ export interface PlannedWrite {
9
10
  /** Edit only array entries so unrelated JSONC text, including comments, survives. */
10
11
  export declare function updatePluginConfig(text: string, key: 'plugin' | 'plugins', pkg: string, version: string): string;
11
12
  export declare function planOpenCodeRegistration(plugin: SetupPlugin, generation: OpenCodeGeneration, io?: SetupIO): PlannedWrite[];
12
- export declare function registerOpenCode(writes: readonly PlannedWrite[], beforeWrite?: () => Promise<void>): Promise<void>;
13
+ export declare function registerOpenCode(writes: readonly PlannedWrite[], beforeWrite?: (() => Promise<void>) | SetupProcessGuard): Promise<void>;
13
14
  export declare function registerPi(plugin: SetupPlugin, executable: string, io?: SetupIO): Promise<void>;
@@ -39,6 +39,8 @@ export interface NativeMigrationOptions {
39
39
  routingDestinationPath: string;
40
40
  env: NodeJS.ProcessEnv;
41
41
  processFence: () => Promise<void>;
42
+ /** Read-only safety checks; defaults to processFence for existing callers. */
43
+ validate?: () => Promise<void>;
42
44
  removePiAnthropicAuth: boolean;
43
45
  custody?: NativeMigrationCustody;
44
46
  preflight?: NativeMigrationPreflight;
@@ -80,6 +82,8 @@ export interface NativeEmptyInitOptions {
80
82
  paths: NativePoolPaths;
81
83
  routingDestinationPath: string;
82
84
  processFence: () => Promise<void>;
85
+ /** Read-only safety checks; defaults to processFence for existing callers. */
86
+ validate?: () => Promise<void>;
83
87
  env: NodeJS.ProcessEnv;
84
88
  }
85
89
  export interface NativeEmptyInitHooks extends Pick<NativeMigrationHooks, 'onStep'> {
@@ -189,5 +189,7 @@ export declare function recordNativeCustodyActivation(paths: NativePoolPaths, pl
189
189
  /** Advance a recorded activation one phase; never backwards or across a phase. */
190
190
  export declare function advanceNativeCustodyActivation(paths: NativePoolPaths, expected: NativeCustodyActivationPhase, next: NativeCustodyActivationPhase, hooks?: JournalHooks): Promise<NativeLegacyMigrationJournal>;
191
191
  /** Publish local authority without inventing migration inputs or creating a pool. */
192
- export declare function beginNativeEmptyInit(paths: NativePoolPaths, hooks?: JournalHooks): Promise<NativeEmptyInitJournal>;
192
+ export declare function beginNativeEmptyInit(paths: NativePoolPaths, hooks?: JournalHooks & {
193
+ validate?: () => Promise<void>;
194
+ }): Promise<NativeEmptyInitJournal>;
193
195
  export {};
@@ -13,7 +13,9 @@ export declare function withSessionCacheReportHandoff<Args extends unknown[], T>
13
13
  * routing report bridge, not auth, resends its newest failed touch.
14
14
  */
15
15
  export declare function reportSessionCacheTouch(sessionId: string, input: CacheTouchInput): void;
16
- /** Stops describe actual warming, not a refusal to start warming. */
16
+ /** Only in-memory terminal removals report stops; startup drops and closed lifetimes are silent. */
17
+ export type SessionCacheWarmStopReason = CacheWarmStoppedInput['reason'];
18
+ export declare function isSessionCacheWarmStopReason(value: unknown): value is SessionCacheWarmStopReason;
17
19
  export declare function reportSessionCacheWarmStopped(sessionId: string, input: CacheWarmStoppedInput): boolean;
18
20
  /** Apply only a lifetime override; the host still chooses breakpoint placement. */
19
21
  export declare function applySessionCacheTtl(body: Record<string, unknown>, ttl: SessionCacheTtl | undefined): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/anthropic-auth-core",
3
- "version": "2.13.1",
3
+ "version": "2.14.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,7 +31,7 @@
31
31
  "prepublishOnly": "bun run build"
32
32
  },
33
33
  "devDependencies": {
34
- "@cortexkit/common-auth": "0.50.0"
34
+ "@cortexkit/common-auth": "0.52.0"
35
35
  },
36
36
  "dependencies": {
37
37
  "@cortexkit/claustrum-client": "0.18.0",