claude-dev-env 8.110.1 → 8.110.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/.agents/skills/usage-pause/scripts/resolve_usage_window.py +3 -1
- package/.agents/skills/usage-pause/scripts/test_resolve_usage_window.py +14 -0
- package/bin/install-pstack-plugin.mjs +1 -1
- package/bin/install-pstack-plugin.test.mjs +9 -9
- package/bin/install.test.mjs +8 -8
- package/docs/second-claude-account.md +6 -3
- package/package.json +1 -1
- package/scripts/dev_env_scripts_constants/account_broker_constants.py +5 -19
- package/scripts/test_account_broker.py +13 -0
|
@@ -263,7 +263,9 @@ def read_oauth_access_token(credentials_path: Path, now: datetime) -> str | None
|
|
|
263
263
|
logger.warning("credential file is missing the token or its expiry")
|
|
264
264
|
return None
|
|
265
265
|
if expires_at_milliseconds <= now.timestamp() * MILLISECONDS_PER_SECOND:
|
|
266
|
-
logger.warning(
|
|
266
|
+
logger.warning(
|
|
267
|
+
"stored access token at %s is expired; probe unavailable", credentials_path
|
|
268
|
+
)
|
|
267
269
|
return None
|
|
268
270
|
return access_token
|
|
269
271
|
|
|
@@ -174,6 +174,20 @@ class TestReadOauthAccessToken:
|
|
|
174
174
|
write_credentials(credentials_path, past_milliseconds)
|
|
175
175
|
assert resolver.read_oauth_access_token(credentials_path, now) is None
|
|
176
176
|
|
|
177
|
+
def should_name_the_credential_file_when_its_token_expired(
|
|
178
|
+
self, tmp_path: Path, caplog: pytest.LogCaptureFixture
|
|
179
|
+
) -> None:
|
|
180
|
+
resolver = load_resolver_module()
|
|
181
|
+
now = local_now()
|
|
182
|
+
credentials_path = tmp_path / ".credentials.json"
|
|
183
|
+
past_milliseconds = int((now - timedelta(hours=1)).timestamp() * 1000)
|
|
184
|
+
write_credentials(credentials_path, past_milliseconds)
|
|
185
|
+
with caplog.at_level(logging.WARNING):
|
|
186
|
+
resolver.read_oauth_access_token(credentials_path, now)
|
|
187
|
+
assert [each_record.getMessage() for each_record in caplog.records] == [
|
|
188
|
+
f"stored access token at {credentials_path} is expired; probe unavailable"
|
|
189
|
+
]
|
|
190
|
+
|
|
177
191
|
def should_not_warn_when_credential_file_missing(
|
|
178
192
|
self, tmp_path: Path, caplog: pytest.LogCaptureFixture
|
|
179
193
|
) -> None:
|
|
@@ -228,7 +228,7 @@ export function marketplacePluginsPlan(allSpecs, host) {
|
|
|
228
228
|
marketplaceAddCommand,
|
|
229
229
|
['plugin', 'marketplace', hostDefinition.updateVerb, firstSpec.marketplaceName],
|
|
230
230
|
...allPluginInstallCommands,
|
|
231
|
-
...allSpecs.map(eachSpec => ['plugin', hostDefinition.updateVerb, eachSpec.pluginIdentifier]),
|
|
231
|
+
...allSpecs.map(eachSpec => ['plugin', hostDefinition.updateVerb, eachSpec.pluginIdentifier, '--scope', 'user']),
|
|
232
232
|
]
|
|
233
233
|
: [];
|
|
234
234
|
return {
|
|
@@ -77,7 +77,7 @@ test('each host installs into the managed root this run wrote', () => {
|
|
|
77
77
|
['claude', 'plugin', 'marketplace', 'add', PSTACK_MARKETPLACE_REPOSITORY],
|
|
78
78
|
['claude', 'plugin', 'marketplace', 'update', 'pstack-claude'],
|
|
79
79
|
['claude', 'plugin', 'install', PSTACK_PLUGIN_IDENTIFIER],
|
|
80
|
-
['claude', 'plugin', 'update', PSTACK_PLUGIN_IDENTIFIER],
|
|
80
|
+
['claude', 'plugin', 'update', PSTACK_PLUGIN_IDENTIFIER, '--scope', 'user'],
|
|
81
81
|
['codex', 'plugin', 'remove', PSTACK_PLUGIN_IDENTIFIER],
|
|
82
82
|
['codex', 'plugin', 'marketplace', 'remove', 'pstack-claude'],
|
|
83
83
|
['codex', 'plugin', 'marketplace', 'add', PSTACK_MARKETPLACE_REPOSITORY],
|
|
@@ -92,7 +92,7 @@ test('the Claude plan refreshes in place and Codex has no refresh commands', ()
|
|
|
92
92
|
['plugin', 'marketplace', 'add', PSTACK_MARKETPLACE_REPOSITORY],
|
|
93
93
|
['plugin', 'marketplace', 'update', 'pstack-claude'],
|
|
94
94
|
['plugin', 'install', PSTACK_PLUGIN_IDENTIFIER],
|
|
95
|
-
['plugin', 'update', PSTACK_PLUGIN_IDENTIFIER],
|
|
95
|
+
['plugin', 'update', PSTACK_PLUGIN_IDENTIFIER, '--scope', 'user'],
|
|
96
96
|
]);
|
|
97
97
|
assert.deepEqual(marketplacePluginsPlan([PSTACK_PLUGIN_SPEC], 'codex').refreshCommands, []);
|
|
98
98
|
});
|
|
@@ -140,7 +140,7 @@ test('a Claude refresh that fails on the network keeps the installed plugin and
|
|
|
140
140
|
: { status: 0, stderr: '' }));
|
|
141
141
|
const outcome = installMarketplacePlugins([PSTACK_PLUGIN_SPEC], { ...ROOTS, hosts: ['claude'] }, runner);
|
|
142
142
|
assert.equal(outcome.status, 'failed');
|
|
143
|
-
assert.match(outcome.hosts[0].warning, /claude plugin update pstack@pstack-claude failed: .*ENOTFOUND/);
|
|
143
|
+
assert.match(outcome.hosts[0].warning, /claude plugin update pstack@pstack-claude --scope user failed: .*ENOTFOUND/);
|
|
144
144
|
const allRemovalCalls = runner.calls.filter(call => (
|
|
145
145
|
call.commandArguments.includes('uninstall') || call.commandArguments.includes('remove')
|
|
146
146
|
));
|
|
@@ -364,7 +364,7 @@ test('installing usage-wrapup runs only the Claude commands, inside the managed
|
|
|
364
364
|
['claude', 'plugin', 'marketplace', 'add', 'jl-cmd-projects/claude-mods-framework'],
|
|
365
365
|
['claude', 'plugin', 'marketplace', 'update', 'claude-mods-framework'],
|
|
366
366
|
['claude', 'plugin', 'install', 'usage-wrapup@claude-mods-framework'],
|
|
367
|
-
['claude', 'plugin', 'update', 'usage-wrapup@claude-mods-framework'],
|
|
367
|
+
['claude', 'plugin', 'update', 'usage-wrapup@claude-mods-framework', '--scope', 'user'],
|
|
368
368
|
]);
|
|
369
369
|
for (const call of runner.calls) {
|
|
370
370
|
assert.deepEqual(call.environment, { CLAUDE_CONFIG_DIR: ROOTS.claudeRoot });
|
|
@@ -416,9 +416,9 @@ test('should add and update the mods framework marketplace once for drawer-core,
|
|
|
416
416
|
['claude', 'plugin', 'install', 'drawer-core@claude-mods-framework'],
|
|
417
417
|
['claude', 'plugin', 'install', 'usage-wrapup@claude-mods-framework'],
|
|
418
418
|
['claude', 'plugin', 'install', 'subagent-models@claude-mods-framework'],
|
|
419
|
-
['claude', 'plugin', 'update', 'drawer-core@claude-mods-framework'],
|
|
420
|
-
['claude', 'plugin', 'update', 'usage-wrapup@claude-mods-framework'],
|
|
421
|
-
['claude', 'plugin', 'update', 'subagent-models@claude-mods-framework'],
|
|
419
|
+
['claude', 'plugin', 'update', 'drawer-core@claude-mods-framework', '--scope', 'user'],
|
|
420
|
+
['claude', 'plugin', 'update', 'usage-wrapup@claude-mods-framework', '--scope', 'user'],
|
|
421
|
+
['claude', 'plugin', 'update', 'subagent-models@claude-mods-framework', '--scope', 'user'],
|
|
422
422
|
]);
|
|
423
423
|
});
|
|
424
424
|
|
|
@@ -694,7 +694,7 @@ test('should install security-guidance from the official marketplace on Claude o
|
|
|
694
694
|
['claude', 'plugin', 'marketplace', 'add', 'anthropics/claude-plugins-official'],
|
|
695
695
|
['claude', 'plugin', 'marketplace', 'update', 'claude-plugins-official'],
|
|
696
696
|
['claude', 'plugin', 'install', 'security-guidance@claude-plugins-official'],
|
|
697
|
-
['claude', 'plugin', 'update', 'security-guidance@claude-plugins-official'],
|
|
697
|
+
['claude', 'plugin', 'update', 'security-guidance@claude-plugins-official', '--scope', 'user'],
|
|
698
698
|
]);
|
|
699
699
|
assert.equal(runner.calls[0].environment.CLAUDE_CONFIG_DIR, ROOTS.claudeRoot);
|
|
700
700
|
});
|
|
@@ -710,7 +710,7 @@ test('should install against an official marketplace already known under another
|
|
|
710
710
|
['plugin', 'marketplace', 'add', 'anthropics/claude-plugins-official'],
|
|
711
711
|
['plugin', 'marketplace', 'update', 'claude-plugins-official'],
|
|
712
712
|
['plugin', 'install', 'security-guidance@claude-plugins-official'],
|
|
713
|
-
['plugin', 'update', 'security-guidance@claude-plugins-official'],
|
|
713
|
+
['plugin', 'update', 'security-guidance@claude-plugins-official', '--scope', 'user'],
|
|
714
714
|
]);
|
|
715
715
|
});
|
|
716
716
|
|
package/bin/install.test.mjs
CHANGED
|
@@ -3163,7 +3163,7 @@ test('a full install adds the pstack marketplace and plugin on both hosts', t =>
|
|
|
3163
3163
|
'claude plugin marketplace add jl-cmd/pstack-claude',
|
|
3164
3164
|
'claude plugin marketplace update pstack-claude',
|
|
3165
3165
|
'claude plugin install pstack@pstack-claude',
|
|
3166
|
-
'claude plugin update pstack@pstack-claude',
|
|
3166
|
+
'claude plugin update pstack@pstack-claude --scope user',
|
|
3167
3167
|
'codex plugin remove pstack@pstack-claude',
|
|
3168
3168
|
'codex plugin marketplace remove pstack-claude',
|
|
3169
3169
|
'codex plugin marketplace add jl-cmd/pstack-claude',
|
|
@@ -3206,7 +3206,7 @@ test('a full install adds DeepStack for Claude, Codex, and Cursor', t => {
|
|
|
3206
3206
|
'claude plugin marketplace add jl-cmd-projects/DeepStack',
|
|
3207
3207
|
'claude plugin marketplace update DeepStack',
|
|
3208
3208
|
'claude plugin install deepstack@DeepStack',
|
|
3209
|
-
'claude plugin update deepstack@DeepStack',
|
|
3209
|
+
'claude plugin update deepstack@DeepStack --scope user',
|
|
3210
3210
|
'codex plugin remove deepstack@DeepStack',
|
|
3211
3211
|
'codex plugin marketplace remove DeepStack',
|
|
3212
3212
|
'codex plugin marketplace add jl-cmd-projects/DeepStack',
|
|
@@ -3424,8 +3424,8 @@ const USAGE_WRAPUP_CLAUDE_COMMANDS = Object.freeze([
|
|
|
3424
3424
|
'claude plugin marketplace update claude-mods-framework',
|
|
3425
3425
|
'claude plugin install drawer-core@claude-mods-framework',
|
|
3426
3426
|
'claude plugin install usage-wrapup@claude-mods-framework',
|
|
3427
|
-
'claude plugin update drawer-core@claude-mods-framework',
|
|
3428
|
-
'claude plugin update usage-wrapup@claude-mods-framework',
|
|
3427
|
+
'claude plugin update drawer-core@claude-mods-framework --scope user',
|
|
3428
|
+
'claude plugin update usage-wrapup@claude-mods-framework --scope user',
|
|
3429
3429
|
]);
|
|
3430
3430
|
|
|
3431
3431
|
function usageWrapupCommands(allRecordedCommands) {
|
|
@@ -3506,9 +3506,9 @@ const MODS_FRAMEWORK_PLUGIN_CLAUDE_COMMANDS = Object.freeze([
|
|
|
3506
3506
|
'claude plugin install drawer-core@claude-mods-framework',
|
|
3507
3507
|
'claude plugin install usage-wrapup@claude-mods-framework',
|
|
3508
3508
|
'claude plugin install subagent-models@claude-mods-framework',
|
|
3509
|
-
'claude plugin update drawer-core@claude-mods-framework',
|
|
3510
|
-
'claude plugin update usage-wrapup@claude-mods-framework',
|
|
3511
|
-
'claude plugin update subagent-models@claude-mods-framework',
|
|
3509
|
+
'claude plugin update drawer-core@claude-mods-framework --scope user',
|
|
3510
|
+
'claude plugin update usage-wrapup@claude-mods-framework --scope user',
|
|
3511
|
+
'claude plugin update subagent-models@claude-mods-framework --scope user',
|
|
3512
3512
|
]);
|
|
3513
3513
|
|
|
3514
3514
|
test('should install drawer-core and subagent-models beside usage-wrapup with one marketplace add on a full install', t => {
|
|
@@ -3560,7 +3560,7 @@ test('should install security-guidance from the official marketplace on a full i
|
|
|
3560
3560
|
'claude plugin marketplace add anthropics/claude-plugins-official',
|
|
3561
3561
|
'claude plugin marketplace update claude-plugins-official',
|
|
3562
3562
|
'claude plugin install security-guidance@claude-plugins-official',
|
|
3563
|
-
'claude plugin update security-guidance@claude-plugins-official',
|
|
3563
|
+
'claude plugin update security-guidance@claude-plugins-official --scope user',
|
|
3564
3564
|
]);
|
|
3565
3565
|
assert.match(installerOutput, /Security-guidance \(claude\): installed/);
|
|
3566
3566
|
});
|
|
@@ -47,7 +47,9 @@ room.
|
|
|
47
47
|
|
|
48
48
|
When no account has room, the job waits until the next account reset, or for one
|
|
49
49
|
hour when no reset is known. An unreadable meter never picks its account, and
|
|
50
|
-
the wait reason names each account whose meter could not be read.
|
|
50
|
+
the wait reason names each account whose meter could not be read. A window the
|
|
51
|
+
usage endpoint returns as `null` holds no account back, but an account needs at
|
|
52
|
+
least one window with a percent to have room.
|
|
51
53
|
|
|
52
54
|
```
|
|
53
55
|
python packages/claude-dev-env/scripts/account_broker.py choose --product claude
|
|
@@ -55,7 +57,8 @@ python packages/claude-dev-env/scripts/account_broker.py choose --product claude
|
|
|
55
57
|
|
|
56
58
|
The JSON output has a `decision` object and an `accounts` list. Each account's
|
|
57
59
|
`meters` holds its remaining percent and reset time for the 5-hour window and
|
|
58
|
-
the week. An
|
|
59
|
-
`unread_reason` holds the failure text when the reader raised one. A
|
|
60
|
+
the week. An account whose meter could not be read has `meters` of `null`, and
|
|
61
|
+
its `unread_reason` holds the failure text when the reader raised one. A window
|
|
62
|
+
with no data has a `null` percent inside a read `meters` object. A wait decision has
|
|
60
63
|
`action: "wait"` and a `resets_at` timestamp. The broker exits with code 3 on
|
|
61
64
|
wait. The worker writes the same reset time to its report.
|
package/package.json
CHANGED
|
@@ -282,14 +282,6 @@ def _claude_blocking_flags(meters: Meters, is_main: bool) -> tuple[bool, bool]:
|
|
|
282
282
|
)
|
|
283
283
|
|
|
284
284
|
|
|
285
|
-
def _claude_extra_tier(meters: Meters | None) -> str | None:
|
|
286
|
-
if meters is None or meters.tightest_percent_left is None:
|
|
287
|
-
return None
|
|
288
|
-
if any(_claude_blocking_flags(meters, is_main=False)):
|
|
289
|
-
return None
|
|
290
|
-
return "normal"
|
|
291
|
-
|
|
292
|
-
|
|
293
285
|
def _codex_tier(meters: Meters | None) -> str | None:
|
|
294
286
|
if meters is None or meters.tightest_percent_left is None:
|
|
295
287
|
return None
|
|
@@ -334,21 +326,15 @@ def _rank_key(reading: Reading) -> tuple[bool, int, bool, float]:
|
|
|
334
326
|
return (priority is None, priority or 0, not is_pro_plan, -(room if room is not None else -1.0))
|
|
335
327
|
|
|
336
328
|
|
|
337
|
-
def
|
|
338
|
-
|
|
329
|
+
def _claude_has_room(reading: Reading) -> bool:
|
|
330
|
+
meters = reading.meters
|
|
331
|
+
return (
|
|
339
332
|
meters is not None
|
|
340
|
-
and meters.
|
|
341
|
-
and meters.
|
|
342
|
-
and not any(_claude_blocking_flags(meters, is_main=True))
|
|
333
|
+
and meters.tightest_percent_left is not None
|
|
334
|
+
and not any(_claude_blocking_flags(meters, reading.account.is_main))
|
|
343
335
|
)
|
|
344
336
|
|
|
345
337
|
|
|
346
|
-
def _claude_has_room(reading: Reading) -> bool:
|
|
347
|
-
if reading.account.is_main:
|
|
348
|
-
return _main_has_room(reading.meters)
|
|
349
|
-
return _claude_extra_tier(reading.meters) is not None
|
|
350
|
-
|
|
351
|
-
|
|
352
338
|
def _choose_claude(all_available: Sequence[Reading], preferred_command: str | None) -> Decision | None:
|
|
353
339
|
all_with_room = [each_reading for each_reading in all_available if _claude_has_room(each_reading)]
|
|
354
340
|
for each_reading in all_with_room:
|
|
@@ -233,6 +233,19 @@ def test_should_pick_main_when_it_is_the_only_readable_account() -> None:
|
|
|
233
233
|
assert decision.account == main.account
|
|
234
234
|
|
|
235
235
|
|
|
236
|
+
def test_should_pick_main_when_its_5_hour_meter_is_null_and_its_week_has_room() -> None:
|
|
237
|
+
main = Reading(
|
|
238
|
+
_account("main", Product.CLAUDE, main=True),
|
|
239
|
+
Meters(None, None, 96.0, NOW + timedelta(days=5)),
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
decision = choose_from_readings(Product.CLAUDE, (main,), now=NOW)
|
|
243
|
+
|
|
244
|
+
assert decision.action == "run"
|
|
245
|
+
assert decision.account == main.account
|
|
246
|
+
assert decision.reason == "main has 96% left"
|
|
247
|
+
|
|
248
|
+
|
|
236
249
|
def test_should_wait_for_main_5_hour_reset_while_its_week_resets_days_away() -> None:
|
|
237
250
|
short_reset = NOW + timedelta(hours=2)
|
|
238
251
|
main = Reading(
|