agent-shim 14.20.1 → 14.22.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.
@@ -6753,6 +6753,123 @@ declare function realConnectCertStore(paths: {
6753
6753
  readonly frontdoorCaKeyFile: string;
6754
6754
  }): ConnectCertStore;
6755
6755
 
6756
+ /**
6757
+ * The Zod schemas of the Remote Control surfaces: one definition each for the summaries, statuses and pending lists the tracker produces, the stream events the door's client attachment fans out, and every input and output the typed API accepts. The tracker's own TypeScript interfaces in `rcSessions.ts` stay the implementations' types; these schemas are what the oRPC contract validates through, and because the procedures wrap the very operations that produce those interfaces' values, a drift between a schema and its interface fails the API's own output validation (exercised by its tests) rather than shipping silently. This module deliberately imports nothing from oRPC: it is a plain Zod leaf, so the tracker and the stream half can share it without either depending on the API layer.
6758
+ */
6759
+ /** The permission modes the SDK's own `set_permission_mode` control request accepts, as the input schema of the set-permission-mode operation and the subscribe-free vocabulary every surface narrows untrusted strings through. */
6760
+ declare const RcPermissionModeSchema: z.ZodEnum<{
6761
+ default: "default";
6762
+ acceptEdits: "acceptEdits";
6763
+ bypassPermissions: "bypassPermissions";
6764
+ plan: "plan";
6765
+ dontAsk: "dontAsk";
6766
+ auto: "auto";
6767
+ }>;
6768
+ /** What the API host says about one session: its own `status` (`active`, or `archived` once the user archives it in claude.ai) with the worker and connection facts it reports beside it, or why the door could not read it. `unknown` is never `active`: a refused or unreachable read says nothing about the session. */
6769
+ declare const RcServerStateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
6770
+ kind: z.ZodLiteral<"read">;
6771
+ status: z.ZodString;
6772
+ workerStatus: z.ZodOptional<z.ZodString>;
6773
+ connectionStatus: z.ZodOptional<z.ZodString>;
6774
+ }, z.core.$strict>, z.ZodObject<{
6775
+ kind: z.ZodLiteral<"unknown">;
6776
+ reason: z.ZodString;
6777
+ }, z.core.$strict>], "kind">;
6778
+ /** One session's server-side state, as the status surface reports it. */
6779
+ type RcServerState = z.infer<typeof RcServerStateSchema>;
6780
+ /** One event off the client read stream, exactly as the door forwards it to subscribers: the envelope the API host sent, with the fields the door itself relies on typed and the rest (the payload above all) carried verbatim for the consumer to narrow. */
6781
+ declare const RcStreamEnvelopeSchema: z.ZodObject<{
6782
+ event_id: z.ZodOptional<z.ZodString>;
6783
+ event_type: z.ZodString;
6784
+ sequence_num: z.ZodInt;
6785
+ source: z.ZodString;
6786
+ payload: z.ZodOptional<z.ZodUnknown>;
6787
+ created_at: z.ZodOptional<z.ZodUnknown>;
6788
+ }, z.core.$loose>;
6789
+ /** One fan-out event: the session the stream it rode belongs to, beside the envelope itself. */
6790
+ declare const RcStreamEventSchema: z.ZodObject<{
6791
+ session: z.ZodString;
6792
+ envelope: z.ZodObject<{
6793
+ event_id: z.ZodOptional<z.ZodString>;
6794
+ event_type: z.ZodString;
6795
+ sequence_num: z.ZodInt;
6796
+ source: z.ZodString;
6797
+ payload: z.ZodOptional<z.ZodUnknown>;
6798
+ created_at: z.ZodOptional<z.ZodUnknown>;
6799
+ }, z.core.$loose>;
6800
+ }, z.core.$strict>;
6801
+ /** One event off the client read stream, as the TypeScript every in-process consumer of the fan-out handles it (the schema's own inferred type, so the two cannot drift). */
6802
+ type RcStreamEnvelope = z.output<typeof RcStreamEnvelopeSchema>;
6803
+ /** One fan-out event, as the TypeScript every in-process consumer handles it. */
6804
+ type RcStreamEvent = z.output<typeof RcStreamEventSchema>;
6805
+ /**
6806
+ * 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.
6807
+ */
6808
+ declare const RcRateLimitWindowSchema: z.ZodObject<{
6809
+ utilization: z.ZodOptional<z.ZodNumber>;
6810
+ resetsAt: z.ZodOptional<z.ZodNumber>;
6811
+ }, z.core.$loose>;
6812
+ /** One subscription window's usage, as the TypeScript the renderers handle it. */
6813
+ type RcRateLimitWindow = z.output<typeof RcRateLimitWindowSchema>;
6814
+ /**
6815
+ * 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.
6816
+ */
6817
+ declare const RcRateLimitInfoSchema: z.ZodObject<{
6818
+ status: z.ZodString;
6819
+ resetsAt: z.ZodOptional<z.ZodNumber>;
6820
+ rateLimitType: z.ZodOptional<z.ZodString>;
6821
+ utilization: z.ZodOptional<z.ZodNumber>;
6822
+ isUsingOverage: z.ZodOptional<z.ZodBoolean>;
6823
+ overageStatus: z.ZodOptional<z.ZodString>;
6824
+ overageResetsAt: z.ZodOptional<z.ZodNumber>;
6825
+ unifiedWindows: z.ZodOptional<z.ZodObject<{
6826
+ five_hour: z.ZodOptional<z.ZodObject<{
6827
+ utilization: z.ZodOptional<z.ZodNumber>;
6828
+ resetsAt: z.ZodOptional<z.ZodNumber>;
6829
+ }, z.core.$loose>>;
6830
+ seven_day: z.ZodOptional<z.ZodObject<{
6831
+ utilization: z.ZodOptional<z.ZodNumber>;
6832
+ resetsAt: z.ZodOptional<z.ZodNumber>;
6833
+ }, z.core.$loose>>;
6834
+ seven_day_overage_included: z.ZodOptional<z.ZodObject<{
6835
+ utilization: z.ZodOptional<z.ZodNumber>;
6836
+ resetsAt: z.ZodOptional<z.ZodNumber>;
6837
+ }, z.core.$loose>>;
6838
+ }, z.core.$loose>>;
6839
+ }, z.core.$loose>;
6840
+ /** One rate-limit payload's facts, as the TypeScript the live usage state and the renderers handle it. */
6841
+ type RcRateLimitInfo = z.output<typeof RcRateLimitInfoSchema>;
6842
+ /** 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`. */
6843
+ declare const RcLiveRateLimitSchema: z.ZodObject<{
6844
+ session: z.ZodString;
6845
+ observedAt: z.ZodNumber;
6846
+ rateLimit: z.ZodObject<{
6847
+ status: z.ZodString;
6848
+ resetsAt: z.ZodOptional<z.ZodNumber>;
6849
+ rateLimitType: z.ZodOptional<z.ZodString>;
6850
+ utilization: z.ZodOptional<z.ZodNumber>;
6851
+ isUsingOverage: z.ZodOptional<z.ZodBoolean>;
6852
+ overageStatus: z.ZodOptional<z.ZodString>;
6853
+ overageResetsAt: z.ZodOptional<z.ZodNumber>;
6854
+ unifiedWindows: z.ZodOptional<z.ZodObject<{
6855
+ five_hour: z.ZodOptional<z.ZodObject<{
6856
+ utilization: z.ZodOptional<z.ZodNumber>;
6857
+ resetsAt: z.ZodOptional<z.ZodNumber>;
6858
+ }, z.core.$loose>>;
6859
+ seven_day: z.ZodOptional<z.ZodObject<{
6860
+ utilization: z.ZodOptional<z.ZodNumber>;
6861
+ resetsAt: z.ZodOptional<z.ZodNumber>;
6862
+ }, z.core.$loose>>;
6863
+ seven_day_overage_included: z.ZodOptional<z.ZodObject<{
6864
+ utilization: z.ZodOptional<z.ZodNumber>;
6865
+ resetsAt: z.ZodOptional<z.ZodNumber>;
6866
+ }, z.core.$loose>>;
6867
+ }, z.core.$loose>>;
6868
+ }, z.core.$loose>;
6869
+ }, z.core.$strict>;
6870
+ /** One live rate-limit observation, as the TypeScript every in-process consumer handles it. */
6871
+ type RcLiveRateLimit = z.output<typeof RcLiveRateLimitSchema>;
6872
+
6756
6873
  /**
6757
6874
  * The agent tree of one session as the reader returns it, and the shape of the meta file it reads. One definition each, so the type, the validator and the published JSON Schema (`schema/AgentTree.schema.json`) cannot drift. The on-disk layout is documented in `docs/agent-transcripts.md`; it belongs to Claude Code and has changed across versions, which is why the meta file is read leniently and the tree this module returns is strict.
6758
6875
  */
@@ -7263,111 +7380,6 @@ type RcQuestionSelection = string | number | {
7263
7380
  readonly text: string;
7264
7381
  };
7265
7382
 
7266
- /**
7267
- * The Zod schemas of the Remote Control surfaces: one definition each for the summaries, statuses and pending lists the tracker produces, the stream events the door's client attachment fans out, and every input and output the typed API accepts. The tracker's own TypeScript interfaces in `rcSessions.ts` stay the implementations' types; these schemas are what the oRPC contract validates through, and because the procedures wrap the very operations that produce those interfaces' values, a drift between a schema and its interface fails the API's own output validation (exercised by its tests) rather than shipping silently. This module deliberately imports nothing from oRPC: it is a plain Zod leaf, so the tracker and the stream half can share it without either depending on the API layer.
7268
- */
7269
- /** The permission modes the SDK's own `set_permission_mode` control request accepts, as the input schema of the set-permission-mode operation and the subscribe-free vocabulary every surface narrows untrusted strings through. */
7270
- declare const RcPermissionModeSchema: z.ZodEnum<{
7271
- default: "default";
7272
- acceptEdits: "acceptEdits";
7273
- bypassPermissions: "bypassPermissions";
7274
- plan: "plan";
7275
- dontAsk: "dontAsk";
7276
- auto: "auto";
7277
- }>;
7278
- /** One event off the client read stream, exactly as the door forwards it to subscribers: the envelope the API host sent, with the fields the door itself relies on typed and the rest (the payload above all) carried verbatim for the consumer to narrow. */
7279
- declare const RcStreamEnvelopeSchema: z.ZodObject<{
7280
- event_id: z.ZodOptional<z.ZodString>;
7281
- event_type: z.ZodString;
7282
- sequence_num: z.ZodInt;
7283
- source: z.ZodString;
7284
- payload: z.ZodOptional<z.ZodUnknown>;
7285
- created_at: z.ZodOptional<z.ZodUnknown>;
7286
- }, z.core.$loose>;
7287
- /** One fan-out event: the session the stream it rode belongs to, beside the envelope itself. */
7288
- declare const RcStreamEventSchema: z.ZodObject<{
7289
- session: z.ZodString;
7290
- envelope: z.ZodObject<{
7291
- event_id: z.ZodOptional<z.ZodString>;
7292
- event_type: z.ZodString;
7293
- sequence_num: z.ZodInt;
7294
- source: z.ZodString;
7295
- payload: z.ZodOptional<z.ZodUnknown>;
7296
- created_at: z.ZodOptional<z.ZodUnknown>;
7297
- }, z.core.$loose>;
7298
- }, z.core.$strict>;
7299
- /** One event off the client read stream, as the TypeScript every in-process consumer of the fan-out handles it (the schema's own inferred type, so the two cannot drift). */
7300
- type RcStreamEnvelope = z.output<typeof RcStreamEnvelopeSchema>;
7301
- /** One fan-out event, as the TypeScript every in-process consumer handles it. */
7302
- type RcStreamEvent = z.output<typeof RcStreamEventSchema>;
7303
- /**
7304
- * 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.
7305
- */
7306
- declare const RcRateLimitWindowSchema: z.ZodObject<{
7307
- utilization: z.ZodOptional<z.ZodNumber>;
7308
- resetsAt: z.ZodOptional<z.ZodNumber>;
7309
- }, z.core.$loose>;
7310
- /** One subscription window's usage, as the TypeScript the renderers handle it. */
7311
- type RcRateLimitWindow = z.output<typeof RcRateLimitWindowSchema>;
7312
- /**
7313
- * 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.
7314
- */
7315
- declare const RcRateLimitInfoSchema: z.ZodObject<{
7316
- status: z.ZodString;
7317
- resetsAt: z.ZodOptional<z.ZodNumber>;
7318
- rateLimitType: z.ZodOptional<z.ZodString>;
7319
- utilization: z.ZodOptional<z.ZodNumber>;
7320
- isUsingOverage: z.ZodOptional<z.ZodBoolean>;
7321
- overageStatus: z.ZodOptional<z.ZodString>;
7322
- overageResetsAt: z.ZodOptional<z.ZodNumber>;
7323
- unifiedWindows: z.ZodOptional<z.ZodObject<{
7324
- five_hour: z.ZodOptional<z.ZodObject<{
7325
- utilization: z.ZodOptional<z.ZodNumber>;
7326
- resetsAt: z.ZodOptional<z.ZodNumber>;
7327
- }, z.core.$loose>>;
7328
- seven_day: z.ZodOptional<z.ZodObject<{
7329
- utilization: z.ZodOptional<z.ZodNumber>;
7330
- resetsAt: z.ZodOptional<z.ZodNumber>;
7331
- }, z.core.$loose>>;
7332
- seven_day_overage_included: z.ZodOptional<z.ZodObject<{
7333
- utilization: z.ZodOptional<z.ZodNumber>;
7334
- resetsAt: z.ZodOptional<z.ZodNumber>;
7335
- }, z.core.$loose>>;
7336
- }, z.core.$loose>>;
7337
- }, z.core.$loose>;
7338
- /** One rate-limit payload's facts, as the TypeScript the live usage state and the renderers handle it. */
7339
- type RcRateLimitInfo = z.output<typeof RcRateLimitInfoSchema>;
7340
- /** 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`. */
7341
- declare const RcLiveRateLimitSchema: z.ZodObject<{
7342
- session: z.ZodString;
7343
- observedAt: z.ZodNumber;
7344
- rateLimit: z.ZodObject<{
7345
- status: z.ZodString;
7346
- resetsAt: z.ZodOptional<z.ZodNumber>;
7347
- rateLimitType: z.ZodOptional<z.ZodString>;
7348
- utilization: z.ZodOptional<z.ZodNumber>;
7349
- isUsingOverage: z.ZodOptional<z.ZodBoolean>;
7350
- overageStatus: z.ZodOptional<z.ZodString>;
7351
- overageResetsAt: z.ZodOptional<z.ZodNumber>;
7352
- unifiedWindows: z.ZodOptional<z.ZodObject<{
7353
- five_hour: z.ZodOptional<z.ZodObject<{
7354
- utilization: z.ZodOptional<z.ZodNumber>;
7355
- resetsAt: z.ZodOptional<z.ZodNumber>;
7356
- }, z.core.$loose>>;
7357
- seven_day: z.ZodOptional<z.ZodObject<{
7358
- utilization: z.ZodOptional<z.ZodNumber>;
7359
- resetsAt: z.ZodOptional<z.ZodNumber>;
7360
- }, z.core.$loose>>;
7361
- seven_day_overage_included: z.ZodOptional<z.ZodObject<{
7362
- utilization: z.ZodOptional<z.ZodNumber>;
7363
- resetsAt: z.ZodOptional<z.ZodNumber>;
7364
- }, z.core.$loose>>;
7365
- }, z.core.$loose>>;
7366
- }, z.core.$loose>;
7367
- }, z.core.$strict>;
7368
- /** One live rate-limit observation, as the TypeScript every in-process consumer handles it. */
7369
- type RcLiveRateLimit = z.output<typeof RcLiveRateLimitSchema>;
7370
-
7371
7383
  /** What the identity step learned about one request from the launcher-injected headers. */
7372
7384
  interface SessionIdentity {
7373
7385
  /** The directory id of the identity the launch resolved, when it resolved one: the key the usage store files under; a lookup by name (a pool member, an override's identity scope) maps it to the identity's current name first. */
@@ -7619,6 +7631,8 @@ interface RcEventDial {
7619
7631
  * Posts one write to the session's teleport-events path instead of its events path: the write half of the channel the CLI only ever reads (`GET /teleport-events`, the teleport-to-local hydration's page source, verified in the 2.1.289 bundle, which contains no POST sender for it at all). The door's own client half is the one sender this surface has, so this method exists for `teleportRcSession` alone.
7620
7632
  */
7621
7633
  readonly writeTeleportEvents: (sessionId: string, headers: Readonly<Record<string, string>>, body: string) => Promise<RcDialAnswer>;
7634
+ /** Reads the session's own record, `GET /v1/code/sessions/{id}`: the one read the client half makes, and the only place the host says whether the user archived the session. */
7635
+ readonly readSession: (sessionId: string, headers: Readonly<Record<string, string>>) => Promise<RcDialAnswer>;
7622
7636
  }
7623
7637
  /** Why the door refused an operation itself, before the session, the API host or the worker could fail it: `invalid-input` is a request that can never succeed as written, `not-observed` names a session (or, for an answer, a control request) the door does not observe, and `session-state` is a session the door observes but whose state does not let the operation run now (no route reaches it, its version is unverified, two launches claim it, only worker calls crossed the door, another answer is being written, its transcript is not recorded yet). A failure without one was attempted and not delivered: the API host, the plugin or the worker did not deliver it. */
7624
7638
  type RcRefusalKind = "invalid-input" | "not-observed" | "session-state";
@@ -8922,6 +8936,8 @@ interface RcApiDeps {
8922
8936
  readonly turn: (sessionId: string, text: string, options: RcSessionCommandOptions) => Promise<RcSessionCommandResult<RcTurnReport>>;
8923
8937
  /** Which route those verbs would take for a session now, or why none would; read for every session the status read reports. */
8924
8938
  readonly routeOf: (sessionId: string) => Promise<RcSessionRoute>;
8939
+ /** What the API host says about a session now (archived or active, its worker and connection facts), or why it could not be read; read for every session the status read reports. */
8940
+ readonly serverStateOf: (sessionId: string) => Promise<RcServerState>;
8925
8941
  /** The client attachment's fan-out, whose events the subscription yields. */
8926
8942
  readonly fanout: RcEventFanout;
8927
8943
  }
@@ -8958,6 +8974,15 @@ declare function createRcApiRouter(deps: RcApiDeps): {
8958
8974
  route: zod.ZodNull;
8959
8975
  refused: zod.ZodString;
8960
8976
  }, zod_v4_core.$strict>]>;
8977
+ serverState: zod.ZodDiscriminatedUnion<[zod.ZodObject<{
8978
+ kind: zod.ZodLiteral<"read">;
8979
+ status: zod.ZodString;
8980
+ workerStatus: zod.ZodOptional<zod.ZodString>;
8981
+ connectionStatus: zod.ZodOptional<zod.ZodString>;
8982
+ }, zod_v4_core.$strict>, zod.ZodObject<{
8983
+ kind: zod.ZodLiteral<"unknown">;
8984
+ reason: zod.ZodString;
8985
+ }, zod_v4_core.$strict>], "kind">;
8961
8986
  workerState: zod.ZodOptional<zod.ZodObject<{
8962
8987
  value: zod.ZodString;
8963
8988
  observedAt: zod.ZodNumber;
@@ -22260,6 +22285,15 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
22260
22285
  route: z.ZodNull;
22261
22286
  refused: z.ZodString;
22262
22287
  }, z.core.$strict>]>;
22288
+ serverState: z.ZodDiscriminatedUnion<[z.ZodObject<{
22289
+ kind: z.ZodLiteral<"read">;
22290
+ status: z.ZodString;
22291
+ workerStatus: z.ZodOptional<z.ZodString>;
22292
+ connectionStatus: z.ZodOptional<z.ZodString>;
22293
+ }, z.core.$strict>, z.ZodObject<{
22294
+ kind: z.ZodLiteral<"unknown">;
22295
+ reason: z.ZodString;
22296
+ }, z.core.$strict>], "kind">;
22263
22297
  workerState: z.ZodOptional<z.ZodObject<{
22264
22298
  value: z.ZodString;
22265
22299
  observedAt: z.ZodNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-shim",
3
- "version": "14.20.1",
3
+ "version": "14.22.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>",