claude-use 6.0.0 → 6.2.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/index.cjs CHANGED
@@ -120,7 +120,8 @@ var LaunchSchema = import_zod.z.strictObject({
120
120
  skipPermissions: import_zod.z.boolean().optional(),
121
121
  remoteControl: import_zod.z.boolean().optional(),
122
122
  provider: import_zod.z.string().min(1).optional(),
123
- headroom: import_zod.z.boolean().optional()
123
+ headroom: import_zod.z.boolean().optional(),
124
+ trackUsage: import_zod.z.boolean().optional()
124
125
  });
125
126
  var CREDENTIAL_TARGETS = ["bearer", "apiKey", "oauthToken"];
126
127
  var PROVIDER_CREDENTIAL_TARGETS = ["bearer", "apiKey"];
@@ -214,10 +215,18 @@ var ConfigProfileSchema = import_zod.z.strictObject({
214
215
  entries: EntriesSchema.optional(),
215
216
  launch: LaunchSchema.optional()
216
217
  });
218
+ var POOL_SELECTOR_PREFIX = "pool:";
219
+ var POOL_NAME_PATTERN = "[A-Za-z0-9][A-Za-z0-9._-]*";
220
+ var IDENTITY_NAME_PATTERN = "[A-Za-z0-9][A-Za-z0-9._@-]*";
221
+ var PoolNameSchema = import_zod.z.string().min(1).regex(new RegExp(`^${POOL_NAME_PATTERN}$`));
222
+ var IdentitySelectorSchema = import_zod.z.string().min(1).regex(new RegExp(`^(${POOL_SELECTOR_PREFIX}${POOL_NAME_PATTERN}|${IDENTITY_NAME_PATTERN})$`));
223
+ var PoolSchema = import_zod.z.strictObject({
224
+ identities: import_zod.z.array(import_zod.z.string().min(1).regex(new RegExp(`^${IDENTITY_NAME_PATTERN}$`))).min(1).refine((names) => new Set(names).size === names.length, { message: "pool members must be unique" })
225
+ });
217
226
  var DirectoryRuleSchema = ConfigProfileSchema.omit({ description: true }).extend({
218
227
  path: import_zod.z.string().min(1),
219
228
  configProfile: import_zod.z.string().min(1).optional(),
220
- identity: import_zod.z.string().min(1).optional(),
229
+ identity: IdentitySelectorSchema.optional(),
221
230
  when: WhenSchema.optional()
222
231
  });
223
232
  var DirectoryRulesSchema = import_zod.z.strictObject({
@@ -226,7 +235,7 @@ var DirectoryRulesSchema = import_zod.z.strictObject({
226
235
  });
227
236
  var PortableConfigSchema = ConfigProfileSchema.omit({ description: true }).extend({
228
237
  configProfile: import_zod.z.string().min(1).optional(),
229
- identity: import_zod.z.string().min(1).optional(),
238
+ identity: IdentitySelectorSchema.optional(),
230
239
  when: WhenSchema.optional()
231
240
  });
232
241
  var HEADROOM_MODES = ["cache", "token"];
@@ -274,7 +283,8 @@ var GlobalConfigSchema = import_zod.z.strictObject({
274
283
  entries: EntriesSchema.optional(),
275
284
  launch: LaunchSchema.optional(),
276
285
  headroom: HeadroomGlobalConfigSchema.optional(),
277
- frontdoor: FrontDoorGlobalConfigSchema.optional()
286
+ frontdoor: FrontDoorGlobalConfigSchema.optional(),
287
+ pools: import_zod.z.record(PoolNameSchema, PoolSchema).optional()
278
288
  });
279
289
  var IdentitySchema = import_zod.z.strictObject({
280
290
  $schema: import_zod.z.string().optional(),
@@ -668,6 +678,9 @@ function flattenLayers(layers, options) {
668
678
  if (layer.launch.headroom !== void 0) {
669
679
  launch.headroom = layer.launch.headroom;
670
680
  }
681
+ if (layer.launch.trackUsage !== void 0) {
682
+ launch.trackUsage = layer.launch.trackUsage;
683
+ }
671
684
  }
672
685
  if (layer.entries === void 0) {
673
686
  continue;
package/dist/index.mjs CHANGED
@@ -46,7 +46,8 @@ var LaunchSchema = z.strictObject({
46
46
  skipPermissions: z.boolean().optional(),
47
47
  remoteControl: z.boolean().optional(),
48
48
  provider: z.string().min(1).optional(),
49
- headroom: z.boolean().optional()
49
+ headroom: z.boolean().optional(),
50
+ trackUsage: z.boolean().optional()
50
51
  });
51
52
  var CREDENTIAL_TARGETS = ["bearer", "apiKey", "oauthToken"];
52
53
  var PROVIDER_CREDENTIAL_TARGETS = ["bearer", "apiKey"];
@@ -140,10 +141,18 @@ var ConfigProfileSchema = z.strictObject({
140
141
  entries: EntriesSchema.optional(),
141
142
  launch: LaunchSchema.optional()
142
143
  });
144
+ var POOL_SELECTOR_PREFIX = "pool:";
145
+ var POOL_NAME_PATTERN = "[A-Za-z0-9][A-Za-z0-9._-]*";
146
+ var IDENTITY_NAME_PATTERN = "[A-Za-z0-9][A-Za-z0-9._@-]*";
147
+ var PoolNameSchema = z.string().min(1).regex(new RegExp(`^${POOL_NAME_PATTERN}$`));
148
+ var IdentitySelectorSchema = z.string().min(1).regex(new RegExp(`^(${POOL_SELECTOR_PREFIX}${POOL_NAME_PATTERN}|${IDENTITY_NAME_PATTERN})$`));
149
+ var PoolSchema = z.strictObject({
150
+ identities: z.array(z.string().min(1).regex(new RegExp(`^${IDENTITY_NAME_PATTERN}$`))).min(1).refine((names) => new Set(names).size === names.length, { message: "pool members must be unique" })
151
+ });
143
152
  var DirectoryRuleSchema = ConfigProfileSchema.omit({ description: true }).extend({
144
153
  path: z.string().min(1),
145
154
  configProfile: z.string().min(1).optional(),
146
- identity: z.string().min(1).optional(),
155
+ identity: IdentitySelectorSchema.optional(),
147
156
  when: WhenSchema.optional()
148
157
  });
149
158
  var DirectoryRulesSchema = z.strictObject({
@@ -152,7 +161,7 @@ var DirectoryRulesSchema = z.strictObject({
152
161
  });
153
162
  var PortableConfigSchema = ConfigProfileSchema.omit({ description: true }).extend({
154
163
  configProfile: z.string().min(1).optional(),
155
- identity: z.string().min(1).optional(),
164
+ identity: IdentitySelectorSchema.optional(),
156
165
  when: WhenSchema.optional()
157
166
  });
158
167
  var HEADROOM_MODES = ["cache", "token"];
@@ -200,7 +209,8 @@ var GlobalConfigSchema = z.strictObject({
200
209
  entries: EntriesSchema.optional(),
201
210
  launch: LaunchSchema.optional(),
202
211
  headroom: HeadroomGlobalConfigSchema.optional(),
203
- frontdoor: FrontDoorGlobalConfigSchema.optional()
212
+ frontdoor: FrontDoorGlobalConfigSchema.optional(),
213
+ pools: z.record(PoolNameSchema, PoolSchema).optional()
204
214
  });
205
215
  var IdentitySchema = z.strictObject({
206
216
  $schema: z.string().optional(),
@@ -594,6 +604,9 @@ function flattenLayers(layers, options) {
594
604
  if (layer.launch.headroom !== void 0) {
595
605
  launch.headroom = layer.launch.headroom;
596
606
  }
607
+ if (layer.launch.trackUsage !== void 0) {
608
+ launch.trackUsage = layer.launch.trackUsage;
609
+ }
597
610
  }
598
611
  if (layer.entries === void 0) {
599
612
  continue;
@@ -83,6 +83,7 @@ declare const LaunchSchema: z.ZodObject<{
83
83
  remoteControl: z.ZodOptional<z.ZodBoolean>;
84
84
  provider: z.ZodOptional<z.ZodString>;
85
85
  headroom: z.ZodOptional<z.ZodBoolean>;
86
+ trackUsage: z.ZodOptional<z.ZodBoolean>;
86
87
  }, z.core.$strict>;
87
88
  export type LaunchFlags = z.infer<typeof LaunchSchema>;
88
89
  /**
@@ -417,9 +418,19 @@ export declare const ConfigProfileSchema: z.ZodObject<{
417
418
  remoteControl: z.ZodOptional<z.ZodBoolean>;
418
419
  provider: z.ZodOptional<z.ZodString>;
419
420
  headroom: z.ZodOptional<z.ZodBoolean>;
421
+ trackUsage: z.ZodOptional<z.ZodBoolean>;
420
422
  }, z.core.$strict>>;
421
423
  }, z.core.$strict>;
422
424
  export type ConfigProfile = z.infer<typeof ConfigProfileSchema>;
425
+ /** The prefix that turns a pool name into an identity selector. `:` is outside an identity name's character set, so a selector can never be mistaken for an identity. */
426
+ export declare const POOL_SELECTOR_PREFIX = "pool:";
427
+ /** A pool's own name: the identity alphabet minus `@`, since a pool is never an email address. */
428
+ export declare const PoolNameSchema: z.ZodString;
429
+ /** A named, explicit set of identities to choose among at launch. Never implicit: a pool lists its members, so an identity that bills a client is only ever picked when someone put it there. */
430
+ declare const PoolSchema: z.ZodObject<{
431
+ identities: z.ZodArray<z.ZodString>;
432
+ }, z.core.$strict>;
433
+ export type Pool = z.infer<typeof PoolSchema>;
423
434
  /** One directory rule in `~/.claude-use/directory-rules.json`, scoped to an explicit absolute (or `~`-rooted) path. */
424
435
  export declare const DirectoryRuleSchema: z.ZodObject<{
425
436
  entries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
@@ -452,6 +463,7 @@ export declare const DirectoryRuleSchema: z.ZodObject<{
452
463
  remoteControl: z.ZodOptional<z.ZodBoolean>;
453
464
  provider: z.ZodOptional<z.ZodString>;
454
465
  headroom: z.ZodOptional<z.ZodBoolean>;
466
+ trackUsage: z.ZodOptional<z.ZodBoolean>;
455
467
  }, z.core.$strict>>;
456
468
  path: z.ZodString;
457
469
  configProfile: z.ZodOptional<z.ZodString>;
@@ -499,6 +511,7 @@ export declare const DirectoryRulesSchema: z.ZodObject<{
499
511
  remoteControl: z.ZodOptional<z.ZodBoolean>;
500
512
  provider: z.ZodOptional<z.ZodString>;
501
513
  headroom: z.ZodOptional<z.ZodBoolean>;
514
+ trackUsage: z.ZodOptional<z.ZodBoolean>;
502
515
  }, z.core.$strict>>;
503
516
  path: z.ZodString;
504
517
  configProfile: z.ZodOptional<z.ZodString>;
@@ -547,6 +560,7 @@ export declare const PortableConfigSchema: z.ZodObject<{
547
560
  remoteControl: z.ZodOptional<z.ZodBoolean>;
548
561
  provider: z.ZodOptional<z.ZodString>;
549
562
  headroom: z.ZodOptional<z.ZodBoolean>;
563
+ trackUsage: z.ZodOptional<z.ZodBoolean>;
550
564
  }, z.core.$strict>>;
551
565
  configProfile: z.ZodOptional<z.ZodString>;
552
566
  identity: z.ZodOptional<z.ZodString>;
@@ -626,6 +640,7 @@ export declare const GlobalConfigSchema: z.ZodObject<{
626
640
  remoteControl: z.ZodOptional<z.ZodBoolean>;
627
641
  provider: z.ZodOptional<z.ZodString>;
628
642
  headroom: z.ZodOptional<z.ZodBoolean>;
643
+ trackUsage: z.ZodOptional<z.ZodBoolean>;
629
644
  }, z.core.$strict>>;
630
645
  headroom: z.ZodOptional<z.ZodObject<{
631
646
  source: z.ZodOptional<z.ZodString>;
@@ -651,6 +666,9 @@ export declare const GlobalConfigSchema: z.ZodObject<{
651
666
  frontdoor: z.ZodOptional<z.ZodObject<{
652
667
  idleShutdownMinutes: z.ZodOptional<z.ZodNumber>;
653
668
  }, z.core.$strict>>;
669
+ pools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
670
+ identities: z.ZodArray<z.ZodString>;
671
+ }, z.core.$strict>>>;
654
672
  }, z.core.$strict>;
655
673
  export type GlobalConfig = z.infer<typeof GlobalConfigSchema>;
656
674
  /**
@@ -58,6 +58,8 @@ export interface LayoutPaths {
58
58
  readonly usageLogDir: string;
59
59
  /** Directory of the latest-state snapshots, one `<identity>.json` per identity: the stable file other tools read. */
60
60
  readonly usageSnapshotsDir: string;
61
+ /** The last identity picked from a pool for each directory, so a conversation stays on the account whose prompt cache is warm. */
62
+ readonly usagePicksFile: string;
61
63
  }
62
64
  /**
63
65
  * Resolves the current CLAUDE_USE_HOME root: the environment variable when set to a non-empty string, otherwise `~/.claude-use`. An empty string counts as unset, consistent with how this project treats empty-string environment variables elsewhere (see the ambient-credential guard).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-use",
3
- "version": "6.0.0",
3
+ "version": "6.2.0",
4
4
  "description": "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Joseph Mearman <joseph@mearman.co.uk>",