@cortexkit/pi-anthropic-auth 2.4.0 → 2.4.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.
Files changed (2) hide show
  1. package/dist/native.js +16 -11
  2. package/package.json +2 -2
package/dist/native.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { resolve } from 'node:path';
2
- import { acquireNativeAccountRuntime, createNativeUsagePublisher, getAccountStatePath, getHostClaustrumEnrollmentPaths, isKillswitchEnabled, killswitchPassesPolicy, logger, nativeAccountCanServe, nativeMigrationAuthorityPhase, nativeRuntimeOptionIdentity, quotaSnapshotHasStandardWindows, quotaSnapshotPassesModelScope, quotaSnapshotPassesPolicy, readNativeAccountsForRequest, readNativeMigrationJournal, registerNativePoolHolder, resolveClaustrumConnectionPath, resolveLocalRoutingDestination, resolveNativePoolPaths, } from '@cortexkit/anthropic-auth-core';
2
+ import { acquireNativeAccountRuntime, createNativeUsagePublisher, decidePiStateLayout, getAccountStatePath, getHostClaustrumEnrollmentPaths, isKillswitchEnabled, killswitchPassesPolicy, LEGACY_STATE_LAYOUT, logger, nativeAccountCanServe, nativeMigrationAuthorityPhase, nativeRuntimeOptionIdentity, quotaSnapshotHasStandardWindows, quotaSnapshotPassesModelScope, quotaSnapshotPassesPolicy, readNativeAccountsForRequest, readNativeMigrationJournal, resolveClaustrumConnectionPath, resolveLocalRoutingDestination, resolveNativePoolPaths, } from '@cortexkit/anthropic-auth-core';
3
3
  import { getPiAccountStoragePath, getPiClaustrumConnectionOptions, getPiConfigDir, requirePiNativeHostAuth, } from './paths.js';
4
4
  export function piAttemptAccessToken(attempt) {
5
5
  return attempt.source === 'vault'
@@ -94,17 +94,22 @@ export class PiNativeRuntime {
94
94
  this.env = env;
95
95
  const poll = options.vaultPoll ?? { intervalMs: PI_VAULT_POLL_INTERVAL_MS };
96
96
  const identity = getPiClaustrumConnectionOptions(storagePath).identity;
97
- this.paths = resolveNativePoolPaths(storagePath);
98
- // Record that this process uses these files before any pool I/O, so a
99
- // later version never moves them while it runs. A refusal (the files
100
- // were moved, or an override points into a managed folder) fails
97
+ // Pi's files never move, so they are always resolved in the legacy
98
+ // layout, whatever an OpenCode start in this process decided.
99
+ this.paths = resolveNativePoolPaths(storagePath, undefined, LEGACY_STATE_LAYOUT);
100
+ // Pi's part of the layout decision records that this process uses these
101
+ // files before any pool I/O, so a later version never moves them while
102
+ // it runs. A refusal (the files were moved, an override points into a
103
+ // managed folder, or the record could not be written) fails
101
104
  // initialization, which every request then reports.
102
- this.holderRegistration = this.paths.then((paths) => registerNativePoolHolder({
103
- paths,
104
- role: 'pi',
105
- kind: 'pi',
106
- onLockEvent: options.local?.onLockEvent,
107
- }));
105
+ this.holderRegistration = this.paths.then(async (paths) => {
106
+ const decision = await decidePiStateLayout({
107
+ paths,
108
+ role: 'pi',
109
+ onLockEvent: options.local?.onLockEvent,
110
+ });
111
+ return decision.registration;
112
+ });
108
113
  void this.holderRegistration.catch(() => { });
109
114
  this.initialization = this.holderRegistration.then(async () => {
110
115
  const paths = await this.paths;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/pi-anthropic-auth",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,7 +36,7 @@
36
36
  "prepublishOnly": "bun run build"
37
37
  },
38
38
  "dependencies": {
39
- "@cortexkit/anthropic-auth-core": "2.4.0"
39
+ "@cortexkit/anthropic-auth-core": "2.4.2"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@earendil-works/pi-ai": ">=0.86.1 <2",