agent-shim 8.29.0 → 8.30.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/cli.cjs CHANGED
@@ -61796,7 +61796,7 @@ function registerIdentityCommand(program2, deps) {
61796
61796
  // package.json
61797
61797
  var package_default = {
61798
61798
  name: "agent-shim",
61799
- version: "8.29.0",
61799
+ version: "8.30.0",
61800
61800
  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.",
61801
61801
  license: "MIT",
61802
61802
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -69906,6 +69906,10 @@ var CheckRunInputSchema = external_exports.strictObject({
69906
69906
  path: external_exports.string().min(1),
69907
69907
  identity: external_exports.string().min(1).optional()
69908
69908
  }).refine((input2) => import_node_path33.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
69909
+ var PoolPickInputSchema = external_exports.strictObject({
69910
+ pool: external_exports.string().min(1),
69911
+ path: external_exports.string().min(1)
69912
+ }).refine((input2) => import_node_path33.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
69909
69913
  var DoctorFindingSchema = external_exports.strictObject({
69910
69914
  section: external_exports.enum(DOCTOR_SECTIONS),
69911
69915
  subject: external_exports.string().optional(),
@@ -73965,6 +73969,7 @@ var USAGE_API_TAG = "usage";
73965
73969
  var FRONTDOOR_API_TAG = "frontdoor";
73966
73970
  var CHECK_API_TAG = "check";
73967
73971
  var DOCTOR_API_TAG = "doctor";
73972
+ var POOL_API_TAG = "pool";
73968
73973
  function createControlApiRouter(deps) {
73969
73974
  const authed = doorApiAuth(deps.expectedToken);
73970
73975
  return {
@@ -74008,6 +74013,18 @@ function createControlApiRouter(deps) {
74008
74013
  },
74009
74014
  doctor: {
74010
74015
  run: authed.route({ method: "GET", path: "/rest/doctor", summary: "Run the doctor report", tags: [DOCTOR_API_TAG] }).output(DoctorRunOutputSchema).handler(() => deps.doctorReport())
74016
+ },
74017
+ pool: {
74018
+ pick: authed.route({ method: "GET", path: "/rest/pool/pick", summary: "Rank one pool exactly as a launch from a directory would right now", tags: [POOL_API_TAG] }).input(PoolPickInputSchema).output(PoolPickReportSchema).handler(({ input: input2 }) => {
74019
+ const report = deps.poolPick(input2.pool, input2.path);
74020
+ if (report === void 0) {
74021
+ const live = deps.poolNames();
74022
+ throw new ORPCError("NOT_FOUND", {
74023
+ message: live.length === 0 ? `no pools are configured, so none is named ${input2.pool}` : `no pool is named ${input2.pool}; the live pools are ${live.map((name) => `"${name}"`).join(", ")}`
74024
+ });
74025
+ }
74026
+ return report;
74027
+ })
74011
74028
  }
74012
74029
  };
74013
74030
  }
@@ -78614,7 +78631,13 @@ function realFrontDoorSupervisorPorts(paths) {
78614
78631
  now: () => Date.now(),
78615
78632
  frontDoorStatus: () => collectFrontDoorStatus(realFarmFs, realHeadroomSocketTrust, paths, realIsProcessRunning),
78616
78633
  checkReport: (target, identity) => collectCheckReport({ paths, cwd: target, ...identity === void 0 ? {} : { identity }, env: process.env }),
78617
- doctorReport: () => collectDoctorReport({ paths, env: process.env })
78634
+ doctorReport: () => collectDoctorReport({ paths, env: process.env }),
78635
+ // The pool table is read per call, not captured here, so a pool created or removed after the door started is ranked or refused by its live name the same moment the CLI would see it.
78636
+ poolPick: (pool, directory) => {
78637
+ const pools = readPools(paths);
78638
+ return pools[pool] === void 0 ? void 0 : collectPoolPick({ paths, fs: realFsPort, usageFs: realFarmFs, poolName: pool, pools, directory, nowMs: Date.now() });
78639
+ },
78640
+ poolNames: () => Object.keys(readPools(paths)).sort()
78618
78641
  };
78619
78642
  realFarmFs.mkdirp(paths.frontdoorDir);
78620
78643
  realFarmFs.writeFilePrivate(paths.frontdoorControlTokenFile, `${rcControlToken}
package/dist/index.cjs CHANGED
@@ -5342,7 +5342,7 @@ var import_undici = require("undici");
5342
5342
  // package.json
5343
5343
  var package_default = {
5344
5344
  name: "agent-shim",
5345
- version: "8.29.0",
5345
+ version: "8.30.0",
5346
5346
  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.",
5347
5347
  license: "MIT",
5348
5348
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -10180,6 +10180,10 @@ var CheckRunInputSchema = import_zod19.z.strictObject({
10180
10180
  path: import_zod19.z.string().min(1),
10181
10181
  identity: import_zod19.z.string().min(1).optional()
10182
10182
  }).refine((input) => import_node_path27.default.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
10183
+ var PoolPickInputSchema = import_zod19.z.strictObject({
10184
+ pool: import_zod19.z.string().min(1),
10185
+ path: import_zod19.z.string().min(1)
10186
+ }).refine((input) => import_node_path27.default.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
10183
10187
  var DoctorFindingSchema = import_zod19.z.strictObject({
10184
10188
  section: import_zod19.z.enum(DOCTOR_SECTIONS),
10185
10189
  subject: import_zod19.z.string().optional(),
@@ -10259,6 +10263,7 @@ var USAGE_API_TAG = "usage";
10259
10263
  var FRONTDOOR_API_TAG = "frontdoor";
10260
10264
  var CHECK_API_TAG = "check";
10261
10265
  var DOCTOR_API_TAG = "doctor";
10266
+ var POOL_API_TAG = "pool";
10262
10267
  function createControlApiRouter(deps) {
10263
10268
  const authed = doorApiAuth(deps.expectedToken);
10264
10269
  return {
@@ -10302,6 +10307,18 @@ function createControlApiRouter(deps) {
10302
10307
  },
10303
10308
  doctor: {
10304
10309
  run: authed.route({ method: "GET", path: "/rest/doctor", summary: "Run the doctor report", tags: [DOCTOR_API_TAG] }).output(DoctorRunOutputSchema).handler(() => deps.doctorReport())
10310
+ },
10311
+ pool: {
10312
+ pick: authed.route({ method: "GET", path: "/rest/pool/pick", summary: "Rank one pool exactly as a launch from a directory would right now", tags: [POOL_API_TAG] }).input(PoolPickInputSchema).output(PoolPickReportSchema).handler(({ input }) => {
10313
+ const report = deps.poolPick(input.pool, input.path);
10314
+ if (report === void 0) {
10315
+ const live = deps.poolNames();
10316
+ throw new import_client3.ORPCError("NOT_FOUND", {
10317
+ message: live.length === 0 ? `no pools are configured, so none is named ${input.pool}` : `no pool is named ${input.pool}; the live pools are ${live.map((name) => `"${name}"`).join(", ")}`
10318
+ });
10319
+ }
10320
+ return report;
10321
+ })
10305
10322
  }
10306
10323
  };
10307
10324
  }
package/dist/index.mjs CHANGED
@@ -5037,7 +5037,7 @@ import { Agent as Agent3, fetch as undiciFetch } from "undici";
5037
5037
  // package.json
5038
5038
  var package_default = {
5039
5039
  name: "agent-shim",
5040
- version: "8.29.0",
5040
+ version: "8.30.0",
5041
5041
  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.",
5042
5042
  license: "MIT",
5043
5043
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -9875,6 +9875,10 @@ var CheckRunInputSchema = z19.strictObject({
9875
9875
  path: z19.string().min(1),
9876
9876
  identity: z19.string().min(1).optional()
9877
9877
  }).refine((input) => path27.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
9878
+ var PoolPickInputSchema = z19.strictObject({
9879
+ pool: z19.string().min(1),
9880
+ path: z19.string().min(1)
9881
+ }).refine((input) => path27.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
9878
9882
  var DoctorFindingSchema = z19.strictObject({
9879
9883
  section: z19.enum(DOCTOR_SECTIONS),
9880
9884
  subject: z19.string().optional(),
@@ -9954,6 +9958,7 @@ var USAGE_API_TAG = "usage";
9954
9958
  var FRONTDOOR_API_TAG = "frontdoor";
9955
9959
  var CHECK_API_TAG = "check";
9956
9960
  var DOCTOR_API_TAG = "doctor";
9961
+ var POOL_API_TAG = "pool";
9957
9962
  function createControlApiRouter(deps) {
9958
9963
  const authed = doorApiAuth(deps.expectedToken);
9959
9964
  return {
@@ -9997,6 +10002,18 @@ function createControlApiRouter(deps) {
9997
10002
  },
9998
10003
  doctor: {
9999
10004
  run: authed.route({ method: "GET", path: "/rest/doctor", summary: "Run the doctor report", tags: [DOCTOR_API_TAG] }).output(DoctorRunOutputSchema).handler(() => deps.doctorReport())
10005
+ },
10006
+ pool: {
10007
+ pick: authed.route({ method: "GET", path: "/rest/pool/pick", summary: "Rank one pool exactly as a launch from a directory would right now", tags: [POOL_API_TAG] }).input(PoolPickInputSchema).output(PoolPickReportSchema).handler(({ input }) => {
10008
+ const report = deps.poolPick(input.pool, input.path);
10009
+ if (report === void 0) {
10010
+ const live = deps.poolNames();
10011
+ throw new ORPCError3("NOT_FOUND", {
10012
+ message: live.length === 0 ? `no pools are configured, so none is named ${input.pool}` : `no pool is named ${input.pool}; the live pools are ${live.map((name) => `"${name}"`).join(", ")}`
10013
+ });
10014
+ }
10015
+ return report;
10016
+ })
10000
10017
  }
10001
10018
  };
10002
10019
  }
@@ -3915,6 +3915,7 @@ declare function formatFrontDoorStatus(status: FrontDoorStatus, caCertPath: stri
3915
3915
  * - `usage.*` reads the per-identity usage snapshots the door's own middleware writes, reads a provider's quota windows the way every in-process consumer does (`effectiveWindow`: a window past its reset is empty and carries no status), and reads the live rate-limit observations the event backbone files off the Remote Control client stream (`live`: per-session latest state, exactly as fresh as the last turn a session completed, never a timer's derivation of it).
3916
3916
  * - `frontdoor.*` returns what `agent-shim frontdoor status` returns: the supervisor state, its liveness, the session registry's launches and the headroom hop.
3917
3917
  * - `check.run` and `doctor.run` return the reports `agent-shim check` and `agent-shim doctor` print, as data, `check.run` parameterised by an absolute directory path.
3918
+ * - `pool.pick` returns what `agent-shim pool pick` prints, the ranked pick for one pool exactly as a launch from the named absolute directory would make it right now, so a programmatic consumer can ask which identity to use without reading the door host's files.
3918
3919
  *
3919
3920
  * Read-only by design: identity, configuration-profile, provider, pool and directory-rule management stay CLI-side, and adding writes over this mount is a decision of its own rather than a gap here. `createDoorApiNodeHandler` mounts these routers and the door-wide `events.subscribe` router beside the Remote Control router on the one prefix the provider listener already serves, so a consumer dials one address with one token for the whole door.
3920
3921
  */
@@ -3940,6 +3941,10 @@ interface ControlApiDeps {
3940
3941
  readonly checkReport: (path: string, identity?: string) => CheckReport;
3941
3942
  /** The doctor report, as `collectDoctorReport` collects it. */
3942
3943
  readonly doctorReport: () => DoctorReport;
3944
+ /** The ranked pick for one pool as a launch from one absolute directory would make it right now, exactly `pool pick`'s own product; undefined when the pool table names no such pool. */
3945
+ readonly poolPick: (pool: string, directory: string) => PoolPickReport | undefined;
3946
+ /** The pool table's live names, so an unknown pool is refused naming the real ones rather than answered as an empty ranking. */
3947
+ readonly poolNames: () => readonly string[];
3943
3948
  }
3944
3949
  /** Builds the control-plane routers: one procedure per read, every one behind the control-token middleware. */
3945
3950
  declare function createControlApiRouter(deps: ControlApiDeps): {
@@ -4441,13 +4446,13 @@ declare function createControlApiRouter(deps: ControlApiDeps): {
4441
4446
  "config-profile": "config-profile";
4442
4447
  identity: "identity";
4443
4448
  provider: "provider";
4449
+ pool: "pool";
4450
+ keychain: "keychain";
4444
4451
  "ambient-credential": "ambient-credential";
4445
4452
  "binary-discovery": "binary-discovery";
4446
4453
  "claude-shim": "claude-shim";
4447
4454
  "path-resolution": "path-resolution";
4448
4455
  "legacy-name": "legacy-name";
4449
- pool: "pool";
4450
- keychain: "keychain";
4451
4456
  "directory-rules": "directory-rules";
4452
4457
  "categories-local": "categories-local";
4453
4458
  "active-identity": "active-identity";
@@ -4463,6 +4468,44 @@ declare function createControlApiRouter(deps: ControlApiDeps): {
4463
4468
  }, zod_v4_core.$strict>>>;
4464
4469
  }, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
4465
4470
  };
4471
+ pool: {
4472
+ pick: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<DoorApiContext & Record<never, never>, DoorApiContext, DoorApiContext>, any, zod.ZodObject<{
4473
+ pool: zod.ZodString;
4474
+ path: zod.ZodString;
4475
+ }, zod_v4_core.$strict>, zod.ZodObject<{
4476
+ pool: zod.ZodString;
4477
+ directory: zod.ZodString;
4478
+ pick: zod.ZodOptional<zod.ZodString>;
4479
+ candidates: zod.ZodArray<zod.ZodObject<{
4480
+ identity: zod.ZodString;
4481
+ class: zod.ZodEnum<{
4482
+ unknown: "unknown";
4483
+ scored: "scored";
4484
+ "pay-per-use": "pay-per-use";
4485
+ ineligible: "ineligible";
4486
+ }>;
4487
+ score: zod.ZodOptional<zod.ZodNumber>;
4488
+ feasible: zod.ZodBoolean;
4489
+ blockedUntil: zod.ZodOptional<zod.ZodISODateTime>;
4490
+ plan: zod.ZodUnion<readonly [zod.ZodObject<{
4491
+ kind: zod.ZodLiteral<"subscription">;
4492
+ capacity: zod.ZodNumber;
4493
+ recognised: zod.ZodBoolean;
4494
+ tier: zod.ZodOptional<zod.ZodString>;
4495
+ }, zod_v4_core.$strict>, zod.ZodObject<{
4496
+ kind: zod.ZodLiteral<"pay-per-use">;
4497
+ tier: zod.ZodOptional<zod.ZodString>;
4498
+ }, zod_v4_core.$strict>]>;
4499
+ reasons: zod.ZodArray<zod.ZodString>;
4500
+ }, zod_v4_core.$strict>>;
4501
+ missing: zod.ZodArray<zod.ZodString>;
4502
+ earliestReturn: zod.ZodOptional<zod.ZodObject<{
4503
+ identity: zod.ZodString;
4504
+ at: zod.ZodISODateTime;
4505
+ }, zod_v4_core.$strict>>;
4506
+ stickyProblem: zod.ZodOptional<zod.ZodString>;
4507
+ }, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
4508
+ };
4466
4509
  };
4467
4510
  /** The control-plane routers, as the merged mount's and the client's own types are derived from them. */
4468
4511
  type ControlApiRouter = ReturnType<typeof createControlApiRouter>;
@@ -4976,13 +5019,13 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
4976
5019
  "config-profile": "config-profile";
4977
5020
  identity: "identity";
4978
5021
  provider: "provider";
5022
+ pool: "pool";
5023
+ keychain: "keychain";
4979
5024
  "ambient-credential": "ambient-credential";
4980
5025
  "binary-discovery": "binary-discovery";
4981
5026
  "claude-shim": "claude-shim";
4982
5027
  "path-resolution": "path-resolution";
4983
5028
  "legacy-name": "legacy-name";
4984
- pool: "pool";
4985
- keychain: "keychain";
4986
5029
  "directory-rules": "directory-rules";
4987
5030
  "categories-local": "categories-local";
4988
5031
  "active-identity": "active-identity";
@@ -4998,6 +5041,44 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
4998
5041
  }, zod_v4_core.$strict>>>;
4999
5042
  }, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
5000
5043
  };
5044
+ pool: {
5045
+ pick: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<DoorApiContext & Record<never, never>, DoorApiContext, DoorApiContext>, any, zod.ZodObject<{
5046
+ pool: zod.ZodString;
5047
+ path: zod.ZodString;
5048
+ }, zod_v4_core.$strict>, zod.ZodObject<{
5049
+ pool: zod.ZodString;
5050
+ directory: zod.ZodString;
5051
+ pick: zod.ZodOptional<zod.ZodString>;
5052
+ candidates: zod.ZodArray<zod.ZodObject<{
5053
+ identity: zod.ZodString;
5054
+ class: zod.ZodEnum<{
5055
+ unknown: "unknown";
5056
+ scored: "scored";
5057
+ "pay-per-use": "pay-per-use";
5058
+ ineligible: "ineligible";
5059
+ }>;
5060
+ score: zod.ZodOptional<zod.ZodNumber>;
5061
+ feasible: zod.ZodBoolean;
5062
+ blockedUntil: zod.ZodOptional<zod.ZodISODateTime>;
5063
+ plan: zod.ZodUnion<readonly [zod.ZodObject<{
5064
+ kind: zod.ZodLiteral<"subscription">;
5065
+ capacity: zod.ZodNumber;
5066
+ recognised: zod.ZodBoolean;
5067
+ tier: zod.ZodOptional<zod.ZodString>;
5068
+ }, zod_v4_core.$strict>, zod.ZodObject<{
5069
+ kind: zod.ZodLiteral<"pay-per-use">;
5070
+ tier: zod.ZodOptional<zod.ZodString>;
5071
+ }, zod_v4_core.$strict>]>;
5072
+ reasons: zod.ZodArray<zod.ZodString>;
5073
+ }, zod_v4_core.$strict>>;
5074
+ missing: zod.ZodArray<zod.ZodString>;
5075
+ earliestReturn: zod.ZodOptional<zod.ZodObject<{
5076
+ identity: zod.ZodString;
5077
+ at: zod.ZodISODateTime;
5078
+ }, zod_v4_core.$strict>>;
5079
+ stickyProblem: zod.ZodOptional<zod.ZodString>;
5080
+ }, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
5081
+ };
5001
5082
  rc: {
5002
5083
  list: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<DoorApiContext & Record<never, never>, DoorApiContext, DoorApiContext>, any, Schema<unknown, unknown>, zod.ZodObject<{
5003
5084
  sessions: zod.ZodReadonly<zod.ZodArray<zod.ZodObject<{
@@ -5424,13 +5505,13 @@ declare const DoctorFindingSchema: z.ZodObject<{
5424
5505
  "config-profile": "config-profile";
5425
5506
  identity: "identity";
5426
5507
  provider: "provider";
5508
+ pool: "pool";
5509
+ keychain: "keychain";
5427
5510
  "ambient-credential": "ambient-credential";
5428
5511
  "binary-discovery": "binary-discovery";
5429
5512
  "claude-shim": "claude-shim";
5430
5513
  "path-resolution": "path-resolution";
5431
5514
  "legacy-name": "legacy-name";
5432
- pool: "pool";
5433
- keychain: "keychain";
5434
5515
  "directory-rules": "directory-rules";
5435
5516
  "categories-local": "categories-local";
5436
5517
  "active-identity": "active-identity";
@@ -5453,13 +5534,13 @@ declare const DoctorRunOutputSchema: z.ZodObject<{
5453
5534
  "config-profile": "config-profile";
5454
5535
  identity: "identity";
5455
5536
  provider: "provider";
5537
+ pool: "pool";
5538
+ keychain: "keychain";
5456
5539
  "ambient-credential": "ambient-credential";
5457
5540
  "binary-discovery": "binary-discovery";
5458
5541
  "claude-shim": "claude-shim";
5459
5542
  "path-resolution": "path-resolution";
5460
5543
  "legacy-name": "legacy-name";
5461
- pool: "pool";
5462
- keychain: "keychain";
5463
5544
  "directory-rules": "directory-rules";
5464
5545
  "categories-local": "categories-local";
5465
5546
  "active-identity": "active-identity";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-shim",
3
- "version": "8.29.0",
3
+ "version": "8.30.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": "MIT",
6
6
  "author": "Joseph Mearman <joseph@mearman.co.uk>",