@cortexkit/pi-anthropic-auth 2.4.1 → 2.4.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.
- package/dist/native.js +24 -11
- 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,
|
|
2
|
+
import { acquireNativeAccountRuntime, createNativeUsagePublisher, decidePiStateLayout, getAccountStatePath, getHostClaustrumEnrollmentPaths, getPersistedLogLevel, isKillswitchEnabled, killswitchPassesPolicy, LEGACY_STATE_LAYOUT, logger, nativeAccountCanServe, nativeMigrationAuthorityPhase, nativeRuntimeOptionIdentity, quotaSnapshotHasStandardWindows, quotaSnapshotPassesModelScope, quotaSnapshotPassesPolicy, readNativeAccountsForRequest, readNativeMigrationJournal, resolveClaustrumConnectionPath, resolveLocalRoutingDestination, resolveNativePoolPaths, setLogLevel, } 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
|
-
|
|
98
|
-
//
|
|
99
|
-
|
|
100
|
-
//
|
|
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) =>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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;
|
|
@@ -120,6 +125,14 @@ export class PiNativeRuntime {
|
|
|
120
125
|
identity,
|
|
121
126
|
},
|
|
122
127
|
});
|
|
128
|
+
// Apply local or vault preferences before the watcher can log. Match
|
|
129
|
+
// OpenCode's startup precedence without blocking migration refusals.
|
|
130
|
+
try {
|
|
131
|
+
const initial = await runtime.read();
|
|
132
|
+
if (!env.OPENCODE_ANTHROPIC_AUTH_LOG_LEVEL)
|
|
133
|
+
setLogLevel(getPersistedLogLevel(initial.policyStorage) ?? 'info');
|
|
134
|
+
}
|
|
135
|
+
catch { }
|
|
123
136
|
if (this.closed)
|
|
124
137
|
runtime.close();
|
|
125
138
|
// Refresh returns at once while this host uses local accounts, so the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/pi-anthropic-auth",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
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.
|
|
39
|
+
"@cortexkit/anthropic-auth-core": "2.4.3"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@earendil-works/pi-ai": ">=0.86.1 <2",
|