agent-shim 8.25.0 → 8.26.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.
@@ -1712,6 +1712,73 @@ declare const RcStreamEventSchema: z.ZodObject<{
1712
1712
  type RcStreamEnvelope = z.output<typeof RcStreamEnvelopeSchema>;
1713
1713
  /** One fan-out event, as the TypeScript every in-process consumer handles it. */
1714
1714
  type RcStreamEvent = z.output<typeof RcStreamEventSchema>;
1715
+ /**
1716
+ * One subscription window inside a `rate_limit_event` payload's `unifiedWindows`: the fraction of the window used and when it resets, as the CLI read them from the `anthropic-ratelimit-unified-*` response headers. Loose because the payload family grows: the door asserts the two fields it renders and carries anything else verbatim.
1717
+ */
1718
+ declare const RcRateLimitWindowSchema: z.ZodObject<{
1719
+ utilization: z.ZodOptional<z.ZodNumber>;
1720
+ resetsAt: z.ZodOptional<z.ZodNumber>;
1721
+ }, z.core.$loose>;
1722
+ /** One subscription window's usage, as the TypeScript the renderers handle it. */
1723
+ type RcRateLimitWindow = z.output<typeof RcRateLimitWindowSchema>;
1724
+ /**
1725
+ * The `rate_limit_info` a worker's `rate_limit_event` payload carries: the SDK's own `SDKRateLimitInfo`, read through the 2.1.289 bundle's schema, which is the fuller source because it adds `unifiedWindows` (the published d.ts omits it). The top-level fields describe the currently limiting window, with `rateLimitType` naming which one it is, while `unifiedWindows` carries each subscription window beside them; every `resetsAt` is unix epoch seconds. The fields the door renders are typed here and the overage trio beside them because the watch line and the page summary state them; everything else the family carries rides through verbatim. Loose for the same reason the envelope is: the family grows, the door asserts the fields it renders, and a field it does not know still reaches consumers rather than being stripped. `status` is asserted present because it is the payload's own one required field, so a payload without it is not this family and is not filed.
1726
+ */
1727
+ declare const RcRateLimitInfoSchema: z.ZodObject<{
1728
+ status: z.ZodString;
1729
+ resetsAt: z.ZodOptional<z.ZodNumber>;
1730
+ rateLimitType: z.ZodOptional<z.ZodString>;
1731
+ utilization: z.ZodOptional<z.ZodNumber>;
1732
+ isUsingOverage: z.ZodOptional<z.ZodBoolean>;
1733
+ overageStatus: z.ZodOptional<z.ZodString>;
1734
+ overageResetsAt: z.ZodOptional<z.ZodNumber>;
1735
+ unifiedWindows: z.ZodOptional<z.ZodObject<{
1736
+ five_hour: z.ZodOptional<z.ZodObject<{
1737
+ utilization: z.ZodOptional<z.ZodNumber>;
1738
+ resetsAt: z.ZodOptional<z.ZodNumber>;
1739
+ }, z.core.$loose>>;
1740
+ seven_day: z.ZodOptional<z.ZodObject<{
1741
+ utilization: z.ZodOptional<z.ZodNumber>;
1742
+ resetsAt: z.ZodOptional<z.ZodNumber>;
1743
+ }, z.core.$loose>>;
1744
+ seven_day_overage_included: z.ZodOptional<z.ZodObject<{
1745
+ utilization: z.ZodOptional<z.ZodNumber>;
1746
+ resetsAt: z.ZodOptional<z.ZodNumber>;
1747
+ }, z.core.$loose>>;
1748
+ }, z.core.$loose>>;
1749
+ }, z.core.$loose>;
1750
+ /** One rate-limit payload's facts, as the TypeScript the live usage state and the renderers handle it. */
1751
+ type RcRateLimitInfo = z.output<typeof RcRateLimitInfoSchema>;
1752
+ /** One live rate-limit observation as the live usage surface reports it: the session whose stream filed it, when the door observed it (the door's own clock, epoch milliseconds), and the payload's `rate_limit_info`. */
1753
+ declare const RcLiveRateLimitSchema: z.ZodObject<{
1754
+ session: z.ZodString;
1755
+ observedAt: z.ZodNumber;
1756
+ rateLimit: z.ZodObject<{
1757
+ status: z.ZodString;
1758
+ resetsAt: z.ZodOptional<z.ZodNumber>;
1759
+ rateLimitType: z.ZodOptional<z.ZodString>;
1760
+ utilization: z.ZodOptional<z.ZodNumber>;
1761
+ isUsingOverage: z.ZodOptional<z.ZodBoolean>;
1762
+ overageStatus: z.ZodOptional<z.ZodString>;
1763
+ overageResetsAt: z.ZodOptional<z.ZodNumber>;
1764
+ unifiedWindows: z.ZodOptional<z.ZodObject<{
1765
+ five_hour: z.ZodOptional<z.ZodObject<{
1766
+ utilization: z.ZodOptional<z.ZodNumber>;
1767
+ resetsAt: z.ZodOptional<z.ZodNumber>;
1768
+ }, z.core.$loose>>;
1769
+ seven_day: z.ZodOptional<z.ZodObject<{
1770
+ utilization: z.ZodOptional<z.ZodNumber>;
1771
+ resetsAt: z.ZodOptional<z.ZodNumber>;
1772
+ }, z.core.$loose>>;
1773
+ seven_day_overage_included: z.ZodOptional<z.ZodObject<{
1774
+ utilization: z.ZodOptional<z.ZodNumber>;
1775
+ resetsAt: z.ZodOptional<z.ZodNumber>;
1776
+ }, z.core.$loose>>;
1777
+ }, z.core.$loose>>;
1778
+ }, z.core.$loose>;
1779
+ }, z.core.$strict>;
1780
+ /** One live rate-limit observation, as the TypeScript every in-process consumer handles it. */
1781
+ type RcLiveRateLimit = z.output<typeof RcLiveRateLimitSchema>;
1715
1782
 
1716
1783
  /** What the identity step learned about one request from the launcher-injected headers. */
1717
1784
  interface SessionIdentity {
@@ -3843,7 +3910,7 @@ declare function formatFrontDoorStatus(status: FrontDoorStatus, caCertPath: stri
3843
3910
  /**
3844
3911
  * The door's general control plane as a typed oRPC API: the read-only surfaces a programmatic consumer (automation, a dashboard, another of this user's tools) needs beyond Remote Control, one router per domain, every procedure behind the same per-generation control token as `rc.*` and validating through the Zod schemas of `controlSchemas.ts`.
3845
3912
  *
3846
- * - `usage.*` reads the per-identity usage snapshots the door's own middleware writes, and 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).
3913
+ * - `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).
3847
3914
  * - `frontdoor.*` returns what `agent-shim frontdoor status` returns: the supervisor state, its liveness, the session registry's launches and the headroom hop.
3848
3915
  * - `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.
3849
3916
  *
@@ -3857,6 +3924,12 @@ interface ControlApiDeps {
3857
3924
  readonly usageSnapshots: () => readonly UsageSnapshot[];
3858
3925
  /** One identity's usage snapshot, as `readUsageSnapshot` reads it: undefined when the identity has none yet. */
3859
3926
  readonly usageSnapshotOf: (identity: string) => UsageSnapshot | undefined;
3927
+ /** The observed Remote Control sessions as the tracker lists them, so the live quota read can tell a session that never crossed this door from one that has completed no turn through it yet. */
3928
+ readonly list: () => readonly RcSessionSummary[];
3929
+ /** The live rate-limit observations the door's event backbone has filed, as the live usage state reads them, filtered to one session when named. */
3930
+ readonly liveRateLimits: (sessionId?: string) => readonly RcLiveRateLimit[];
3931
+ /** The freshest live rate-limit observation across every session, as the live usage state reads it: undefined while no rate_limit_event has been filed at all. */
3932
+ readonly latestRateLimit: () => RcLiveRateLimit | undefined;
3860
3933
  /** The clock the window semantics read a recorded window at. */
3861
3934
  readonly now: () => number;
3862
3935
  /** The door's read-only status, as `collectFrontDoorStatus` collects it. */
@@ -3965,6 +4038,64 @@ declare function createControlApiRouter(deps: ControlApiDeps): {
3965
4038
  status: zod.ZodOptional<zod.ZodString>;
3966
4039
  }, zod_v4_core.$strict>>;
3967
4040
  }, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
4041
+ live: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<DoorApiContext & Record<never, never>, DoorApiContext, DoorApiContext>, any, zod.ZodObject<{
4042
+ session: zod.ZodOptional<zod.ZodString>;
4043
+ }, zod_v4_core.$strict>, zod.ZodObject<{
4044
+ latest: zod.ZodOptional<zod.ZodObject<{
4045
+ session: zod.ZodString;
4046
+ observedAt: zod.ZodNumber;
4047
+ rateLimit: zod.ZodObject<{
4048
+ status: zod.ZodString;
4049
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4050
+ rateLimitType: zod.ZodOptional<zod.ZodString>;
4051
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4052
+ isUsingOverage: zod.ZodOptional<zod.ZodBoolean>;
4053
+ overageStatus: zod.ZodOptional<zod.ZodString>;
4054
+ overageResetsAt: zod.ZodOptional<zod.ZodNumber>;
4055
+ unifiedWindows: zod.ZodOptional<zod.ZodObject<{
4056
+ five_hour: zod.ZodOptional<zod.ZodObject<{
4057
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4058
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4059
+ }, zod_v4_core.$loose>>;
4060
+ seven_day: zod.ZodOptional<zod.ZodObject<{
4061
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4062
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4063
+ }, zod_v4_core.$loose>>;
4064
+ seven_day_overage_included: zod.ZodOptional<zod.ZodObject<{
4065
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4066
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4067
+ }, zod_v4_core.$loose>>;
4068
+ }, zod_v4_core.$loose>>;
4069
+ }, zod_v4_core.$loose>;
4070
+ }, zod_v4_core.$strict>>;
4071
+ sessions: zod.ZodReadonly<zod.ZodArray<zod.ZodObject<{
4072
+ session: zod.ZodString;
4073
+ observedAt: zod.ZodNumber;
4074
+ rateLimit: zod.ZodObject<{
4075
+ status: zod.ZodString;
4076
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4077
+ rateLimitType: zod.ZodOptional<zod.ZodString>;
4078
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4079
+ isUsingOverage: zod.ZodOptional<zod.ZodBoolean>;
4080
+ overageStatus: zod.ZodOptional<zod.ZodString>;
4081
+ overageResetsAt: zod.ZodOptional<zod.ZodNumber>;
4082
+ unifiedWindows: zod.ZodOptional<zod.ZodObject<{
4083
+ five_hour: zod.ZodOptional<zod.ZodObject<{
4084
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4085
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4086
+ }, zod_v4_core.$loose>>;
4087
+ seven_day: zod.ZodOptional<zod.ZodObject<{
4088
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4089
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4090
+ }, zod_v4_core.$loose>>;
4091
+ seven_day_overage_included: zod.ZodOptional<zod.ZodObject<{
4092
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4093
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4094
+ }, zod_v4_core.$loose>>;
4095
+ }, zod_v4_core.$loose>>;
4096
+ }, zod_v4_core.$loose>;
4097
+ }, zod_v4_core.$strict>>>;
4098
+ }, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
3968
4099
  };
3969
4100
  frontdoor: {
3970
4101
  status: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<DoorApiContext & Record<never, never>, DoorApiContext, DoorApiContext>, any, Schema<unknown, unknown>, zod.ZodObject<{
@@ -4442,6 +4573,64 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
4442
4573
  status: zod.ZodOptional<zod.ZodString>;
4443
4574
  }, zod_v4_core.$strict>>;
4444
4575
  }, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
4576
+ live: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<DoorApiContext & Record<never, never>, DoorApiContext, DoorApiContext>, any, zod.ZodObject<{
4577
+ session: zod.ZodOptional<zod.ZodString>;
4578
+ }, zod_v4_core.$strict>, zod.ZodObject<{
4579
+ latest: zod.ZodOptional<zod.ZodObject<{
4580
+ session: zod.ZodString;
4581
+ observedAt: zod.ZodNumber;
4582
+ rateLimit: zod.ZodObject<{
4583
+ status: zod.ZodString;
4584
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4585
+ rateLimitType: zod.ZodOptional<zod.ZodString>;
4586
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4587
+ isUsingOverage: zod.ZodOptional<zod.ZodBoolean>;
4588
+ overageStatus: zod.ZodOptional<zod.ZodString>;
4589
+ overageResetsAt: zod.ZodOptional<zod.ZodNumber>;
4590
+ unifiedWindows: zod.ZodOptional<zod.ZodObject<{
4591
+ five_hour: zod.ZodOptional<zod.ZodObject<{
4592
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4593
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4594
+ }, zod_v4_core.$loose>>;
4595
+ seven_day: zod.ZodOptional<zod.ZodObject<{
4596
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4597
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4598
+ }, zod_v4_core.$loose>>;
4599
+ seven_day_overage_included: zod.ZodOptional<zod.ZodObject<{
4600
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4601
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4602
+ }, zod_v4_core.$loose>>;
4603
+ }, zod_v4_core.$loose>>;
4604
+ }, zod_v4_core.$loose>;
4605
+ }, zod_v4_core.$strict>>;
4606
+ sessions: zod.ZodReadonly<zod.ZodArray<zod.ZodObject<{
4607
+ session: zod.ZodString;
4608
+ observedAt: zod.ZodNumber;
4609
+ rateLimit: zod.ZodObject<{
4610
+ status: zod.ZodString;
4611
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4612
+ rateLimitType: zod.ZodOptional<zod.ZodString>;
4613
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4614
+ isUsingOverage: zod.ZodOptional<zod.ZodBoolean>;
4615
+ overageStatus: zod.ZodOptional<zod.ZodString>;
4616
+ overageResetsAt: zod.ZodOptional<zod.ZodNumber>;
4617
+ unifiedWindows: zod.ZodOptional<zod.ZodObject<{
4618
+ five_hour: zod.ZodOptional<zod.ZodObject<{
4619
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4620
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4621
+ }, zod_v4_core.$loose>>;
4622
+ seven_day: zod.ZodOptional<zod.ZodObject<{
4623
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4624
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4625
+ }, zod_v4_core.$loose>>;
4626
+ seven_day_overage_included: zod.ZodOptional<zod.ZodObject<{
4627
+ utilization: zod.ZodOptional<zod.ZodNumber>;
4628
+ resetsAt: zod.ZodOptional<zod.ZodNumber>;
4629
+ }, zod_v4_core.$loose>>;
4630
+ }, zod_v4_core.$loose>>;
4631
+ }, zod_v4_core.$loose>;
4632
+ }, zod_v4_core.$strict>>>;
4633
+ }, zod_v4_core.$strict>, Record<never, never>, Record<never, never>>;
4445
4634
  };
4446
4635
  frontdoor: {
4447
4636
  status: _orpc_server.DecoratedProcedure<_orpc_server.MergedInitialContext<DoorApiContext & Record<never, never>, DoorApiContext, DoorApiContext>, any, Schema<unknown, unknown>, zod.ZodObject<{
@@ -5008,7 +5197,7 @@ type DoorApiClient = RouterClient<DoorApiRouter>;
5008
5197
  declare function frontDoorApiClient(port: number, ca: string, token: string): DoorApiClient;
5009
5198
 
5010
5199
  /**
5011
- * The Zod schemas of the door's general control plane: the usage snapshots a remote consumer reads, the front door's own status and session registry, the check report over a path, and the doctor report, each one the input or output of a procedure in `controlApi.ts`. Like `rcSchemas.ts` this module is a plain Zod leaf (nothing here imports oRPC), and every shape it asserts is one the implementation already defines: the usage snapshot and front-door state schemas are the store's and the registry's own, the check report's is `checkReportSchema.ts`'s (`CheckReportJsonSchema`, imported straight by the procedure), and the doctor vocabulary is `doctorReport.ts`'s own, so contract and behaviour share one source and a drift fails the procedures' own validation rather than shipping silently.
5200
+ * The Zod schemas of the door's general control plane: the usage snapshots a remote consumer reads, the live rate-limit observations the event backbone files, the front door's own status and session registry, the check report over a path, and the doctor report, each one the input or output of a procedure in `controlApi.ts`. Like `rcSchemas.ts` this module is a plain Zod leaf (nothing here imports oRPC), and every shape it asserts is one the implementation already defines: the usage snapshot and front-door state schemas are the store's and the registry's own, the check report's is `checkReportSchema.ts`'s (`CheckReportJsonSchema`, imported straight by the procedure), and the doctor vocabulary is `doctorReport.ts`'s own, so contract and behaviour share one source and a drift fails the procedures' own validation rather than shipping silently.
5012
5201
  */
5013
5202
  /** Every usage snapshot on this machine, one per identity that has routed a request through the door. */
5014
5203
  declare const UsageListOutputSchema: z.ZodObject<{
@@ -5117,6 +5306,63 @@ declare const UsageWindowsOutputSchema: z.ZodObject<{
5117
5306
  status: z.ZodOptional<z.ZodString>;
5118
5307
  }, z.core.$strict>>;
5119
5308
  }, z.core.$strict>;
5309
+ /** The live quota read's answer: every per-session rate-limit observation the door's event backbone has filed, oldest-observed first, and the freshest one across every session. */
5310
+ declare const UsageLiveOutputSchema: z.ZodObject<{
5311
+ latest: z.ZodOptional<z.ZodObject<{
5312
+ session: z.ZodString;
5313
+ observedAt: z.ZodNumber;
5314
+ rateLimit: z.ZodObject<{
5315
+ status: z.ZodString;
5316
+ resetsAt: z.ZodOptional<z.ZodNumber>;
5317
+ rateLimitType: z.ZodOptional<z.ZodString>;
5318
+ utilization: z.ZodOptional<z.ZodNumber>;
5319
+ isUsingOverage: z.ZodOptional<z.ZodBoolean>;
5320
+ overageStatus: z.ZodOptional<z.ZodString>;
5321
+ overageResetsAt: z.ZodOptional<z.ZodNumber>;
5322
+ unifiedWindows: z.ZodOptional<z.ZodObject<{
5323
+ five_hour: z.ZodOptional<z.ZodObject<{
5324
+ utilization: z.ZodOptional<z.ZodNumber>;
5325
+ resetsAt: z.ZodOptional<z.ZodNumber>;
5326
+ }, z.core.$loose>>;
5327
+ seven_day: z.ZodOptional<z.ZodObject<{
5328
+ utilization: z.ZodOptional<z.ZodNumber>;
5329
+ resetsAt: z.ZodOptional<z.ZodNumber>;
5330
+ }, z.core.$loose>>;
5331
+ seven_day_overage_included: z.ZodOptional<z.ZodObject<{
5332
+ utilization: z.ZodOptional<z.ZodNumber>;
5333
+ resetsAt: z.ZodOptional<z.ZodNumber>;
5334
+ }, z.core.$loose>>;
5335
+ }, z.core.$loose>>;
5336
+ }, z.core.$loose>;
5337
+ }, z.core.$strict>>;
5338
+ sessions: z.ZodReadonly<z.ZodArray<z.ZodObject<{
5339
+ session: z.ZodString;
5340
+ observedAt: z.ZodNumber;
5341
+ rateLimit: z.ZodObject<{
5342
+ status: z.ZodString;
5343
+ resetsAt: z.ZodOptional<z.ZodNumber>;
5344
+ rateLimitType: z.ZodOptional<z.ZodString>;
5345
+ utilization: z.ZodOptional<z.ZodNumber>;
5346
+ isUsingOverage: z.ZodOptional<z.ZodBoolean>;
5347
+ overageStatus: z.ZodOptional<z.ZodString>;
5348
+ overageResetsAt: z.ZodOptional<z.ZodNumber>;
5349
+ unifiedWindows: z.ZodOptional<z.ZodObject<{
5350
+ five_hour: z.ZodOptional<z.ZodObject<{
5351
+ utilization: z.ZodOptional<z.ZodNumber>;
5352
+ resetsAt: z.ZodOptional<z.ZodNumber>;
5353
+ }, z.core.$loose>>;
5354
+ seven_day: z.ZodOptional<z.ZodObject<{
5355
+ utilization: z.ZodOptional<z.ZodNumber>;
5356
+ resetsAt: z.ZodOptional<z.ZodNumber>;
5357
+ }, z.core.$loose>>;
5358
+ seven_day_overage_included: z.ZodOptional<z.ZodObject<{
5359
+ utilization: z.ZodOptional<z.ZodNumber>;
5360
+ resetsAt: z.ZodOptional<z.ZodNumber>;
5361
+ }, z.core.$loose>>;
5362
+ }, z.core.$loose>>;
5363
+ }, z.core.$loose>;
5364
+ }, z.core.$strict>>>;
5365
+ }, z.core.$strict>;
5120
5366
  /** One registered launch as the status surfaces list it: the launcher's pid and start time plus whether it is still running, never the session's capability token. */
5121
5367
  declare const FrontDoorSessionStatusSchema: z.ZodObject<{
5122
5368
  pid: z.ZodInt;
@@ -5242,6 +5488,27 @@ interface LaunchEventPublisher {
5242
5488
  /** Creates the launch lifecycle publisher. One per door process, fed by the supervisor's tick. */
5243
5489
  declare function createLaunchEventPublisher(hub: DoorEventHub, now: () => number): LaunchEventPublisher;
5244
5490
 
5491
+ /**
5492
+ * The rate-limit facts one client read stream event carries, or undefined when the event is not a `rate_limit_event` this module can read: a payload of another type, a payload without the family's own one required field, or one whose `rate_limit_info` does not parse. An envelope the door cannot read is one it knows nothing about, never a failure, exactly as the stream's own parser treats an envelope it cannot read. Exported because the renderers (`frontdoor rc watch`, the web client's twin) narrow the same payload through the same one definition.
5493
+ */
5494
+ declare function rcRateLimitInfoOf(event: RcStreamEvent): RcRateLimitInfo | undefined;
5495
+ /** Everything the live quota state needs, injected so its filing runs against fakes in unit tests. */
5496
+ interface RcLiveUsageDeps {
5497
+ /** The door's clock, read at the moment an envelope is filed: the observation's `observedAt`. */
5498
+ readonly now: () => number;
5499
+ /** The door's event backbone, whose Remote Control source the state subscribes to. */
5500
+ readonly hub: DoorEventHub;
5501
+ }
5502
+ /** The door's live quota state, one per door process. */
5503
+ interface RcLiveUsage {
5504
+ /** Every observation the door holds, oldest-observed first, filtered to one session when named: the state the control plane's `usage.live` read serves. */
5505
+ readonly liveOf: (sessionId?: string) => readonly RcLiveRateLimit[];
5506
+ /** The freshest observation across every session, whatever filter a read names, because it is the door's single latest statement of the account's quota. */
5507
+ readonly latestOf: () => RcLiveRateLimit | undefined;
5508
+ }
5509
+ /** Creates the live quota state and subscribes it to the backbone, so every rate-limit envelope published from now on is filed the moment it arrives. One per door process; everything it holds dies with it. */
5510
+ declare function createRcLiveUsage(deps: RcLiveUsageDeps): RcLiveUsage;
5511
+
5245
5512
  /**
5246
5513
  * The worker's web-fetch proxy target side: the URL fetch the CLI delegates to the Remote Control host when its environment sends `CLAUDE_CODE_WEBFETCH_USE_CCR_PROXY`, served by the self-hosted surface so such a session does not break on the first fetch. The wire contract is the one the 2.1.289 CLI's own client half defines (its `THr`/`jPt` functions): a POST of `{url}` to `/{cse}/worker/web-fetch` answered with `{url, destination_url, text, content_type}` or `{error: {error_type, error_message}}`, read under a 12 MiB answer cap and a 40 s per-attempt timeout.
5247
5514
  *
@@ -6240,5 +6507,5 @@ interface PrepareClaudeLaunchOptions {
6240
6507
  */
6241
6508
  declare function prepareClaudeLaunch(options: PrepareClaudeLaunchOptions): LaunchPlan;
6242
6509
 
6243
- export { AMBIENT_CREDENTIAL_VARS, CHECK_CREDENTIAL_APPLIES, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, CONNECT_LIMITS, CONTROL_PATH_PREFIX, CategoryClassificationOverlaySchema, CategoryClassificationSchema, CategoryMapSchema, CheckReportJsonSchema, CheckRunInputSchema, CliError, ConfigProfileSchema, CredentialCacheSchema, CredentialSchema, CredentialSourceSchema, DOOR_EVENT_BUFFER_EVENTS, DOOR_EVENT_SOURCE_RC, DirectoryRuleAlreadyExistsError, DirectoryRuleMissingTargetError, DirectoryRuleNotFoundError, DirectoryRuleSchema, DirectoryRulesSchema, DoctorFindingSchema, DoctorRunOutputSchema, DoorEventSchema, DoorEventSourceQuerySchema, EXIT_FAILURE, EXIT_USAGE, EffectiveWindowSchema, EntryValueSchema, FARM_MANIFEST_FILENAME, FrontDoorSessionStatusSchema, FrontDoorSessionsOutputSchema, FrontDoorStartError, FrontDoorStateSchema, FrontDoorStatusOutputSchema, GlobalConfigSchema, HeadroomSocketTargetSchema, HeadroomStartError, IdentityAlreadyExistsError, IdentityNotFoundError, IdentitySchema, InvalidCategoryNameError, InvalidIdentityNameError, InvalidProviderNameError, LAUNCH_EVENT_SOURCE, LaunchLifecycleEventSchema, LaunchRefusedError, LegacyProviderFileError, PROMPT_CACHE_TTL_MS, PlanClassSchema, PoolNameSchema, PoolNotFoundError, PoolPickReportSchema, PoolSchema, PortableConfigSchema, ProfileAlreadyExistsError, ProfileNotFoundError, ProviderAlreadyExistsError, ProviderKindMismatchError, ProviderNotFoundError, ProviderSchema, RC_CONTEXT_USAGE_DETAILS, RC_IDLE_EXPIRY_MS, RC_ORPC_PATH_PREFIX, RC_PENDING_DEADLINE_MS, RC_PERMISSION_MODES, RC_READ_FILE_ENCODINGS, RC_REQUEST_PARSE_CAP_BYTES, RC_SELF_HOST_ENV, RC_SELF_HOST_KEEPALIVE_MS, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE, RC_SELF_HOST_RETENTION_MS, RC_SELF_HOST_SCOPE_LIST, RC_SELF_HOST_WORKER_JWT_TTL_SECONDS, RC_SESSIONS_PATH_PREFIX, RC_STREAM_BACKOFF_MS, RC_WEB_FETCH_ALLOW_PRIVATE_ENV, RC_WEB_FETCH_DEADLINE_MS, RC_WEB_FETCH_MAX_BYTES, RC_WEB_FETCH_MAX_REDIRECTS, ROUTED_PATH_PREFIX, RcPermissionModeSchema, RcStreamEnvelopeSchema, RcStreamEventSchema, UsageError, UsageListOutputSchema, UsageSnapshotError, UsageSnapshotSchema, UsageWindowsInputSchema, UsageWindowsOutputSchema, WhenSchema, addDirectoryRule, addIdentity, addPool, addProvider, answerRcControlRequest, authenticateRcSessionMcpServer, buildEntryFacts, buildLayoutPaths, buildRcControlRequestPayload, buildRcControlResponsePayload, buildRcEndSessionPayload, buildRcEventWriteBody, buildRcFileSuggestionsPayload, buildRcGetContextUsagePayload, buildRcGetUsagePayload, buildRcInterruptPayload, buildRcKeepAlivePayload, buildRcMarkReadBody, buildRcMcpAuthenticatePayload, buildRcMcpOAuthCallbackUrlPayload, buildRcMcpReconnectPayload, buildRcMcpStatusPayload, buildRcReadFilePayload, buildRcSetModelPayload, buildRcSetPermissionModePayload, buildRcUserMessagePayload, carryOver, checkReportHasWarnings, checkReportToJson, collectCheckReport, collectDoctorReport, collectFrontDoorStatus, collectPoolPick, createControlApiRouter, createDoorApiNodeHandler, createDoorApiRouter, createDoorEventHub, createEventsApiRouter, createLaunchEventPublisher, createLeafCache, createProfile, createRcApiNodeHandler, createRcApiRouter, createRcControlHandler, createRcCredentialStore, createRcEventFanout, createRcSelfHostSurface, createRcSessionTracker, createRcStreamHub, createSseParser, describeProviderEndpoint, detectAmbientCredential, doorApiAuth, doorApiNodeHandlerOf, effectiveWindow, endRcSession, ensureCa, ensureFrontDoor, ensureHeadroom, evaluateAmbientCredentialGuard, evaluateWhen, fetchThroughWebProxy, formatAmbientCredentialGuardMessage, formatCheckReport, formatDoctorReport, formatFrontDoorStatus, forwardableHeaders, frontDoorApiClient, frontDoorApiLink, frontDoorRcApiClient, frontDoorRcControl, generateCa, getRcSessionContextUsage, getRcSessionMcpStatus, getRcSessionUsage, headroomSocketTarget, identityExists, injectRcUserMessage, interruptRcSession, isIdentityDirectoryName, isInterceptedHost, isPrivateAddress, isRcContextUsageDetail, isRcPermissionMode, isRcReadFileEncoding, lateRcEventDial, lateRcStreamDial, listDirectoryRules, listIdentities, listProfiles, listProviders, listUsageSnapshots, matchBranch, mintLeaf, mintRcSelfHostCredential, observingRoutedRoute, parseConnectTarget, parseRcStreamEnvelope, planOf, prepareClaudeLaunch, prepareLaunch, profileExists, providerExists, rankPool, rcEventWriteResultFromAnswer, rcFanoutOnDoorHub, rcObserverAsPassthrough, rcSelfHostFromEnv, rcWebFetchAllowsPrivateFromEnv, readActiveIdentity, readDirectoryRules, readFarmManifest, readGlobalConfig, readIdentity, readPools, readProfile, readProvider, readRcSelfHostRecord, readRcSessionFile, readUsageSnapshot, realConnectCertStore, realConnectEffects, realRcControlTransport, realRcEventDial, realRcStreamDial, realRcWebFetch, reconnectRcSessionMcpServer, recoverFarm, recoveryDiagnostics, removeDirectoryRule, removeIdentity, removePool, removeProfile, removeProvider, requirePool, resolveAgentShimHome, resolveClaudeHome, resolveDecisions, resolveLayoutPaths, resolveSupervisorConfig, resyncFarm, runCheck, runDoctor, runFrontDoorSupervisor, runLauncher, runSupervisor, sendRcKeepAlive, servedByPipeline, setAllowAmbientCredential, setDefaultConfigProfile, setGlobalDefaultProfile, setIdentityCredential, setPool, setProfileCategories, setProfileEntries, setProfileLaunchFlags, setProfileMetadata, setRcSessionModel, setRcSessionPermissionMode, snapshotPath, spawnClaude, startConnectServer, submitRcSessionMcpOAuthCallbackUrl, suggestRcSessionFiles, teleportRcSession, topLevelNames, updateDirectoryRule, updateProvider, useIdentity, writeDirectoryRules };
6244
- export type { AddDirectoryRuleOptions, AddProviderInput, AmbientCredentialDetection, AmbientCredentialGuardResult, AmbientCredentialVar, BuildEntryFactsParams, CaMaterial, Candidate, CarryOverParams, CarryOverResult, CategoryMap, CheckReport, CheckReportJson, CollectCheckReportParams, CollectDoctorReportParams, CompiledRule, ConditionContext, ConfigProfile, ConnectCertStore, ConnectEffects, ConnectLimits, ConnectLocalSurface, ConnectServerConfig, ConnectServerHandle, ConnectTarget, ControlApiClient, ControlApiDeps, ControlApiRouter, Credential, CredentialSource, Decision, Diagnostic, DirectoryRule, DirectoryRules, DoctorReport, DoorApiClient, DoorApiContext, DoorApiDeps, DoorApiRouter, DoorEvent, DoorEventHub, DoorEventPublisher, DoorEventStream, DoorEventsApiDeps, EffectiveWindow, EliminatedRule, EnsureFrontDoorPorts, EnsureHeadroomPorts, EntryFact, EntryFacts, EntryValue, EvaluateAmbientCredentialGuardParams, FlattenedCascade, FrontDoorRcControl, FrontDoorSessionStatus, FrontDoorStatus, FrontDoorSupervisorPorts, GlobalConfig, HeadroomSupervisorConfig, Identity, IdentityCredentialChange, IdentityListEntry, IdentityListing, InjectedCredential, LaunchEventPublisher, LaunchLifecycleEvent, LaunchPlan, Layer, LayerId, LayoutPaths, LeafCert, NestedContribution, PlanClass, Pool, PoolMember, PoolPickReport, PoolRanking, PortableConfig, PrepareClaudeLaunchOptions, PrepareLaunchParams, ProfileListEntry, Provider, ProviderListEntry, RankPoolInput, RcAnswerDecision, RcAnswerDeps, RcApiClient, RcApiDeps, RcApiRouter, RcContextUsageDetail, RcControlAnswer, RcControlHandlerDeps, RcControlRequestDeps, RcControlTransport, RcCredentialStore, RcDialAnswer, RcDialTarget, RcEventDial, RcEventFanout, RcEventWriteResult, RcExchangeObserver, RcInjectDeps, RcObservedCredential, RcObservedRequest, RcPendingRequestSummary, RcPermissionMode, RcPresenceAnswer, RcReadFileEncoding, RcReadFileOptions, RcSelfHostCredentialRecord, RcSelfHostDeps, RcSelfHostMintResult, RcSelfHostSurface, RcSessionStatus, RcSessionSummary, RcSessionTracker, RcSessionTrackerDeps, RcStreamAnswer, RcStreamDial, RcStreamEnvelope, RcStreamEvent, RcStreamHub, RcStreamHubDeps, RcWebFetchDeps, RcWebFetchHop, RcWebFetchOutcome, RcWebFetcher, RcWorkerFact, RcWriteHeaders, RecoverFarmParams, RecoveryResult, ResolveDecisionsInput, ResolvedState, ResyncFarmParams, ResyncFarmResult, RunCheckParams, RunDoctorParams, RunFrontDoorSupervisorOptions, RunLauncherParams, RunSupervisorOptions, SpawnClaudeParams, SseParsedEvent, StickyPick, SupervisorPorts, UnreadableIdentityListEntry, UpdateDirectoryRuleOptions, UpdateProviderInput, UsageReadFs, UsageSnapshot, WhenCondition, WhenEvaluation };
6510
+ export { AMBIENT_CREDENTIAL_VARS, CHECK_CREDENTIAL_APPLIES, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, CONNECT_LIMITS, CONTROL_PATH_PREFIX, CategoryClassificationOverlaySchema, CategoryClassificationSchema, CategoryMapSchema, CheckReportJsonSchema, CheckRunInputSchema, CliError, ConfigProfileSchema, CredentialCacheSchema, CredentialSchema, CredentialSourceSchema, DOOR_EVENT_BUFFER_EVENTS, DOOR_EVENT_SOURCE_RC, DirectoryRuleAlreadyExistsError, DirectoryRuleMissingTargetError, DirectoryRuleNotFoundError, DirectoryRuleSchema, DirectoryRulesSchema, DoctorFindingSchema, DoctorRunOutputSchema, DoorEventSchema, DoorEventSourceQuerySchema, EXIT_FAILURE, EXIT_USAGE, EffectiveWindowSchema, EntryValueSchema, FARM_MANIFEST_FILENAME, FrontDoorSessionStatusSchema, FrontDoorSessionsOutputSchema, FrontDoorStartError, FrontDoorStateSchema, FrontDoorStatusOutputSchema, GlobalConfigSchema, HeadroomSocketTargetSchema, HeadroomStartError, IdentityAlreadyExistsError, IdentityNotFoundError, IdentitySchema, InvalidCategoryNameError, InvalidIdentityNameError, InvalidProviderNameError, LAUNCH_EVENT_SOURCE, LaunchLifecycleEventSchema, LaunchRefusedError, LegacyProviderFileError, PROMPT_CACHE_TTL_MS, PlanClassSchema, PoolNameSchema, PoolNotFoundError, PoolPickReportSchema, PoolSchema, PortableConfigSchema, ProfileAlreadyExistsError, ProfileNotFoundError, ProviderAlreadyExistsError, ProviderKindMismatchError, ProviderNotFoundError, ProviderSchema, RC_CONTEXT_USAGE_DETAILS, RC_IDLE_EXPIRY_MS, RC_ORPC_PATH_PREFIX, RC_PENDING_DEADLINE_MS, RC_PERMISSION_MODES, RC_READ_FILE_ENCODINGS, RC_REQUEST_PARSE_CAP_BYTES, RC_SELF_HOST_ENV, RC_SELF_HOST_KEEPALIVE_MS, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE, RC_SELF_HOST_RETENTION_MS, RC_SELF_HOST_SCOPE_LIST, RC_SELF_HOST_WORKER_JWT_TTL_SECONDS, RC_SESSIONS_PATH_PREFIX, RC_STREAM_BACKOFF_MS, RC_WEB_FETCH_ALLOW_PRIVATE_ENV, RC_WEB_FETCH_DEADLINE_MS, RC_WEB_FETCH_MAX_BYTES, RC_WEB_FETCH_MAX_REDIRECTS, ROUTED_PATH_PREFIX, RcLiveRateLimitSchema, RcPermissionModeSchema, RcRateLimitInfoSchema, RcRateLimitWindowSchema, RcStreamEnvelopeSchema, RcStreamEventSchema, UsageError, UsageListOutputSchema, UsageLiveOutputSchema, UsageSnapshotError, UsageSnapshotSchema, UsageWindowsInputSchema, UsageWindowsOutputSchema, WhenSchema, addDirectoryRule, addIdentity, addPool, addProvider, answerRcControlRequest, authenticateRcSessionMcpServer, buildEntryFacts, buildLayoutPaths, buildRcControlRequestPayload, buildRcControlResponsePayload, buildRcEndSessionPayload, buildRcEventWriteBody, buildRcFileSuggestionsPayload, buildRcGetContextUsagePayload, buildRcGetUsagePayload, buildRcInterruptPayload, buildRcKeepAlivePayload, buildRcMarkReadBody, buildRcMcpAuthenticatePayload, buildRcMcpOAuthCallbackUrlPayload, buildRcMcpReconnectPayload, buildRcMcpStatusPayload, buildRcReadFilePayload, buildRcSetModelPayload, buildRcSetPermissionModePayload, buildRcUserMessagePayload, carryOver, checkReportHasWarnings, checkReportToJson, collectCheckReport, collectDoctorReport, collectFrontDoorStatus, collectPoolPick, createControlApiRouter, createDoorApiNodeHandler, createDoorApiRouter, createDoorEventHub, createEventsApiRouter, createLaunchEventPublisher, createLeafCache, createProfile, createRcApiNodeHandler, createRcApiRouter, createRcControlHandler, createRcCredentialStore, createRcEventFanout, createRcLiveUsage, createRcSelfHostSurface, createRcSessionTracker, createRcStreamHub, createSseParser, describeProviderEndpoint, detectAmbientCredential, doorApiAuth, doorApiNodeHandlerOf, effectiveWindow, endRcSession, ensureCa, ensureFrontDoor, ensureHeadroom, evaluateAmbientCredentialGuard, evaluateWhen, fetchThroughWebProxy, formatAmbientCredentialGuardMessage, formatCheckReport, formatDoctorReport, formatFrontDoorStatus, forwardableHeaders, frontDoorApiClient, frontDoorApiLink, frontDoorRcApiClient, frontDoorRcControl, generateCa, getRcSessionContextUsage, getRcSessionMcpStatus, getRcSessionUsage, headroomSocketTarget, identityExists, injectRcUserMessage, interruptRcSession, isIdentityDirectoryName, isInterceptedHost, isPrivateAddress, isRcContextUsageDetail, isRcPermissionMode, isRcReadFileEncoding, lateRcEventDial, lateRcStreamDial, listDirectoryRules, listIdentities, listProfiles, listProviders, listUsageSnapshots, matchBranch, mintLeaf, mintRcSelfHostCredential, observingRoutedRoute, parseConnectTarget, parseRcStreamEnvelope, planOf, prepareClaudeLaunch, prepareLaunch, profileExists, providerExists, rankPool, rcEventWriteResultFromAnswer, rcFanoutOnDoorHub, rcObserverAsPassthrough, rcRateLimitInfoOf, rcSelfHostFromEnv, rcWebFetchAllowsPrivateFromEnv, readActiveIdentity, readDirectoryRules, readFarmManifest, readGlobalConfig, readIdentity, readPools, readProfile, readProvider, readRcSelfHostRecord, readRcSessionFile, readUsageSnapshot, realConnectCertStore, realConnectEffects, realRcControlTransport, realRcEventDial, realRcStreamDial, realRcWebFetch, reconnectRcSessionMcpServer, recoverFarm, recoveryDiagnostics, removeDirectoryRule, removeIdentity, removePool, removeProfile, removeProvider, requirePool, resolveAgentShimHome, resolveClaudeHome, resolveDecisions, resolveLayoutPaths, resolveSupervisorConfig, resyncFarm, runCheck, runDoctor, runFrontDoorSupervisor, runLauncher, runSupervisor, sendRcKeepAlive, servedByPipeline, setAllowAmbientCredential, setDefaultConfigProfile, setGlobalDefaultProfile, setIdentityCredential, setPool, setProfileCategories, setProfileEntries, setProfileLaunchFlags, setProfileMetadata, setRcSessionModel, setRcSessionPermissionMode, snapshotPath, spawnClaude, startConnectServer, submitRcSessionMcpOAuthCallbackUrl, suggestRcSessionFiles, teleportRcSession, topLevelNames, updateDirectoryRule, updateProvider, useIdentity, writeDirectoryRules };
6511
+ export type { AddDirectoryRuleOptions, AddProviderInput, AmbientCredentialDetection, AmbientCredentialGuardResult, AmbientCredentialVar, BuildEntryFactsParams, CaMaterial, Candidate, CarryOverParams, CarryOverResult, CategoryMap, CheckReport, CheckReportJson, CollectCheckReportParams, CollectDoctorReportParams, CompiledRule, ConditionContext, ConfigProfile, ConnectCertStore, ConnectEffects, ConnectLimits, ConnectLocalSurface, ConnectServerConfig, ConnectServerHandle, ConnectTarget, ControlApiClient, ControlApiDeps, ControlApiRouter, Credential, CredentialSource, Decision, Diagnostic, DirectoryRule, DirectoryRules, DoctorReport, DoorApiClient, DoorApiContext, DoorApiDeps, DoorApiRouter, DoorEvent, DoorEventHub, DoorEventPublisher, DoorEventStream, DoorEventsApiDeps, EffectiveWindow, EliminatedRule, EnsureFrontDoorPorts, EnsureHeadroomPorts, EntryFact, EntryFacts, EntryValue, EvaluateAmbientCredentialGuardParams, FlattenedCascade, FrontDoorRcControl, FrontDoorSessionStatus, FrontDoorStatus, FrontDoorSupervisorPorts, GlobalConfig, HeadroomSupervisorConfig, Identity, IdentityCredentialChange, IdentityListEntry, IdentityListing, InjectedCredential, LaunchEventPublisher, LaunchLifecycleEvent, LaunchPlan, Layer, LayerId, LayoutPaths, LeafCert, NestedContribution, PlanClass, Pool, PoolMember, PoolPickReport, PoolRanking, PortableConfig, PrepareClaudeLaunchOptions, PrepareLaunchParams, ProfileListEntry, Provider, ProviderListEntry, RankPoolInput, RcAnswerDecision, RcAnswerDeps, RcApiClient, RcApiDeps, RcApiRouter, RcContextUsageDetail, RcControlAnswer, RcControlHandlerDeps, RcControlRequestDeps, RcControlTransport, RcCredentialStore, RcDialAnswer, RcDialTarget, RcEventDial, RcEventFanout, RcEventWriteResult, RcExchangeObserver, RcInjectDeps, RcLiveRateLimit, RcLiveUsage, RcLiveUsageDeps, RcObservedCredential, RcObservedRequest, RcPendingRequestSummary, RcPermissionMode, RcPresenceAnswer, RcRateLimitInfo, RcRateLimitWindow, RcReadFileEncoding, RcReadFileOptions, RcSelfHostCredentialRecord, RcSelfHostDeps, RcSelfHostMintResult, RcSelfHostSurface, RcSessionStatus, RcSessionSummary, RcSessionTracker, RcSessionTrackerDeps, RcStreamAnswer, RcStreamDial, RcStreamEnvelope, RcStreamEvent, RcStreamHub, RcStreamHubDeps, RcWebFetchDeps, RcWebFetchHop, RcWebFetchOutcome, RcWebFetcher, RcWorkerFact, RcWriteHeaders, RecoverFarmParams, RecoveryResult, ResolveDecisionsInput, ResolvedState, ResyncFarmParams, ResyncFarmResult, RunCheckParams, RunDoctorParams, RunFrontDoorSupervisorOptions, RunLauncherParams, RunSupervisorOptions, SpawnClaudeParams, SseParsedEvent, StickyPick, SupervisorPorts, UnreadableIdentityListEntry, UpdateDirectoryRuleOptions, UpdateProviderInput, UsageReadFs, UsageSnapshot, WhenCondition, WhenEvaluation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-shim",
3
- "version": "8.25.0",
3
+ "version": "8.26.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>",