@cortexkit/pi-anthropic-auth 1.10.3 → 1.12.0
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/commands.js +57 -1
- package/package.json +2 -2
package/dist/commands.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildClaudeQuotaSummary, buildFallbackQuotaSummaries, CLAUDE_CACHE_KEEP_COMMAND_NAME, CLAUDE_ROUTING_COMMAND_NAME, executeCache1hCommand, executeCacheKeepCommand, executeDumpCommand, executeFastModeCommand, executeRoutingCommand, getCache1hPersistentMode, getCacheKeepWindow, getRoutingMode, isCache1hPersistentlyEnabled, isCacheKeepHybridActive, isCacheKeepPersistentlyEnabled, isDumpPersistentlyEnabled, isFastModePersistentlyEnabled, loadAccounts, parseCache1hCommandAction, parseCacheKeepCommandAction, parseDumpCommandAction, parseFastModeCommandAction, parseRoutingCommandAction, setCache1hPersistentEnabled, setCache1hPersistentMode, setCacheKeepPersistentEnabled, setCacheKeepPersistentWindow, setDumpEnabled, setDumpPersistentEnabled, setFastModePersistentEnabled, setRoutingMode, } from '@cortexkit/anthropic-auth-core';
|
|
1
|
+
import { buildClaudeQuotaSummary, buildFallbackQuotaSummaries, CLAUDE_ACCOUNT_COMMAND_NAME, CLAUDE_CACHE_KEEP_COMMAND_NAME, CLAUDE_ROUTING_COMMAND_NAME, createEmptyStorage, executeAccountCommand, executeCache1hCommand, executeCacheKeepCommand, executeDumpCommand, executeFastModeCommand, executeLoggingCommand, executeRoutingCommand, getCache1hPersistentMode, getCacheKeepWindow, getPersistedLogLevel, getRoutingMode, isCache1hPersistentlyEnabled, isCacheKeepHybridActive, isCacheKeepPersistentlyEnabled, isDumpPersistentlyEnabled, isFastModePersistentlyEnabled, loadAccounts, parseCache1hCommandAction, parseCacheKeepCommandAction, parseDumpCommandAction, parseFastModeCommandAction, parseLoggingCommandAction, parseRoutingCommandAction, removeAccountPersistent, reorderAccountsPersistent, setAccountEnabledPersistent, setCache1hPersistentEnabled, setCache1hPersistentMode, setCacheKeepPersistentEnabled, setCacheKeepPersistentWindow, setCacheKeepSubagentsEnabled, setDumpEnabled, setDumpPersistentEnabled, setFastModePersistentEnabled, setLogLevelPersistent, setRoutingMode, } from '@cortexkit/anthropic-auth-core';
|
|
2
2
|
import { getPiAccountStoragePath } from "./paths.js";
|
|
3
3
|
function notify(ctx, message, kind = 'info') {
|
|
4
4
|
ctx.ui.notify(message, kind);
|
|
@@ -46,6 +46,9 @@ export function registerCommands(pi) {
|
|
|
46
46
|
else if (action.type === 'disable') {
|
|
47
47
|
storage = await setCacheKeepPersistentEnabled(false, path);
|
|
48
48
|
}
|
|
49
|
+
else if (action.type === 'subagents') {
|
|
50
|
+
storage = await setCacheKeepSubagentsEnabled(action.enabled, path);
|
|
51
|
+
}
|
|
49
52
|
notify(ctx, executeCacheKeepCommand({
|
|
50
53
|
argumentsText: args ?? '',
|
|
51
54
|
enabled: isCacheKeepPersistentlyEnabled(storage),
|
|
@@ -129,4 +132,57 @@ export function registerCommands(pi) {
|
|
|
129
132
|
}));
|
|
130
133
|
},
|
|
131
134
|
});
|
|
135
|
+
pi.registerCommand(CLAUDE_ACCOUNT_COMMAND_NAME, {
|
|
136
|
+
description: 'List, enable/disable, reorder, or remove fallback accounts',
|
|
137
|
+
handler: async (args, ctx) => {
|
|
138
|
+
const path = getPiAccountStoragePath();
|
|
139
|
+
const storage = await loadAccounts(path);
|
|
140
|
+
const result = executeAccountCommand({
|
|
141
|
+
argumentsText: args ?? '',
|
|
142
|
+
storage: storage ?? createEmptyStorage(),
|
|
143
|
+
});
|
|
144
|
+
if (!result.updated) {
|
|
145
|
+
notify(ctx, result.text);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
// Wire persistent mutations via core helpers
|
|
149
|
+
const { id, action: mutationAction } = result.updated;
|
|
150
|
+
if (mutationAction === 'enable') {
|
|
151
|
+
await setAccountEnabledPersistent(id, true, path);
|
|
152
|
+
}
|
|
153
|
+
else if (mutationAction === 'disable') {
|
|
154
|
+
await setAccountEnabledPersistent(id, false, path);
|
|
155
|
+
}
|
|
156
|
+
else if (mutationAction === 'remove') {
|
|
157
|
+
const existed = await removeAccountPersistent(id, path);
|
|
158
|
+
if (!existed) {
|
|
159
|
+
notify(ctx, `Account "${id}" not found.`, 'warning');
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else if (mutationAction === 'reorder') {
|
|
164
|
+
const newOrder = result.updated.newOrder;
|
|
165
|
+
if (newOrder) {
|
|
166
|
+
await reorderAccountsPersistent(newOrder, path);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
notify(ctx, result.text);
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
pi.registerCommand('claude-logging', {
|
|
173
|
+
description: 'Show or set the plugin log level',
|
|
174
|
+
handler: async (args, ctx) => {
|
|
175
|
+
const path = getPiAccountStoragePath();
|
|
176
|
+
const storage = await loadAccounts(path);
|
|
177
|
+
const action = parseLoggingCommandAction(args ?? '');
|
|
178
|
+
const currentLevel = getPersistedLogLevel(storage) ?? 'info';
|
|
179
|
+
// Wire persistent log-level mutation
|
|
180
|
+
let level = currentLevel;
|
|
181
|
+
if (action.type === 'level') {
|
|
182
|
+
await setLogLevelPersistent(action.level, path);
|
|
183
|
+
level = action.level;
|
|
184
|
+
}
|
|
185
|
+
notify(ctx, executeLoggingCommand({ argumentsText: args ?? '', level }));
|
|
186
|
+
},
|
|
187
|
+
});
|
|
132
188
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/pi-anthropic-auth",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
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": "1.
|
|
39
|
+
"@cortexkit/anthropic-auth-core": "1.12.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@earendil-works/pi-ai": "*",
|