claude-use 11.62.3 → 11.63.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.
@@ -4,6 +4,7 @@ import * as zod from 'zod';
4
4
  import { z } from 'zod';
5
5
  import { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'node:http';
6
6
  import * as net from 'node:net';
7
+ import net__default from 'node:net';
7
8
  import { Duplex, Readable } from 'node:stream';
8
9
  import * as _orpc_client from '@orpc/client';
9
10
  import * as zod_v4_core from 'zod/v4/core';
@@ -296,8 +297,8 @@ declare const LaunchSchema: z.ZodObject<{
296
297
  }>>;
297
298
  layout: z.ZodOptional<z.ZodObject<{
298
299
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
299
- model: "model";
300
300
  account: "account";
301
+ model: "model";
301
302
  identity: "identity";
302
303
  provider: "provider";
303
304
  version: "version";
@@ -389,8 +390,8 @@ declare const LaunchSchema: z.ZodObject<{
389
390
  effort: z.ZodOptional<z.ZodObject<{
390
391
  format: z.ZodOptional<z.ZodEnum<{
391
392
  symbol: "symbol";
392
- text: "text";
393
393
  full: "full";
394
+ text: "text";
394
395
  }>>;
395
396
  }, z.core.$strict>>;
396
397
  advisor: z.ZodOptional<z.ZodObject<{
@@ -1427,8 +1428,8 @@ declare const ConfigProfileSchema: z.ZodObject<{
1427
1428
  }>>;
1428
1429
  layout: z.ZodOptional<z.ZodObject<{
1429
1430
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
1430
- model: "model";
1431
1431
  account: "account";
1432
+ model: "model";
1432
1433
  identity: "identity";
1433
1434
  provider: "provider";
1434
1435
  version: "version";
@@ -1520,8 +1521,8 @@ declare const ConfigProfileSchema: z.ZodObject<{
1520
1521
  effort: z.ZodOptional<z.ZodObject<{
1521
1522
  format: z.ZodOptional<z.ZodEnum<{
1522
1523
  symbol: "symbol";
1523
- text: "text";
1524
1524
  full: "full";
1525
+ text: "text";
1525
1526
  }>>;
1526
1527
  }, z.core.$strict>>;
1527
1528
  advisor: z.ZodOptional<z.ZodObject<{
@@ -2178,8 +2179,8 @@ declare const DirectoryRuleSchema: z.ZodObject<{
2178
2179
  }>>;
2179
2180
  layout: z.ZodOptional<z.ZodObject<{
2180
2181
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2181
- model: "model";
2182
2182
  account: "account";
2183
+ model: "model";
2183
2184
  identity: "identity";
2184
2185
  provider: "provider";
2185
2186
  version: "version";
@@ -2271,8 +2272,8 @@ declare const DirectoryRuleSchema: z.ZodObject<{
2271
2272
  effort: z.ZodOptional<z.ZodObject<{
2272
2273
  format: z.ZodOptional<z.ZodEnum<{
2273
2274
  symbol: "symbol";
2274
- text: "text";
2275
2275
  full: "full";
2276
+ text: "text";
2276
2277
  }>>;
2277
2278
  }, z.core.$strict>>;
2278
2279
  advisor: z.ZodOptional<z.ZodObject<{
@@ -2856,8 +2857,8 @@ declare const DirectoryRulesSchema: z.ZodObject<{
2856
2857
  }>>;
2857
2858
  layout: z.ZodOptional<z.ZodObject<{
2858
2859
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
2859
- model: "model";
2860
2860
  account: "account";
2861
+ model: "model";
2861
2862
  identity: "identity";
2862
2863
  provider: "provider";
2863
2864
  version: "version";
@@ -2949,8 +2950,8 @@ declare const DirectoryRulesSchema: z.ZodObject<{
2949
2950
  effort: z.ZodOptional<z.ZodObject<{
2950
2951
  format: z.ZodOptional<z.ZodEnum<{
2951
2952
  symbol: "symbol";
2952
- text: "text";
2953
2953
  full: "full";
2954
+ text: "text";
2954
2955
  }>>;
2955
2956
  }, z.core.$strict>>;
2956
2957
  advisor: z.ZodOptional<z.ZodObject<{
@@ -3534,8 +3535,8 @@ declare const PortableConfigSchema: z.ZodObject<{
3534
3535
  }>>;
3535
3536
  layout: z.ZodOptional<z.ZodObject<{
3536
3537
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
3537
- model: "model";
3538
3538
  account: "account";
3539
+ model: "model";
3539
3540
  identity: "identity";
3540
3541
  provider: "provider";
3541
3542
  version: "version";
@@ -3627,8 +3628,8 @@ declare const PortableConfigSchema: z.ZodObject<{
3627
3628
  effort: z.ZodOptional<z.ZodObject<{
3628
3629
  format: z.ZodOptional<z.ZodEnum<{
3629
3630
  symbol: "symbol";
3630
- text: "text";
3631
3631
  full: "full";
3632
+ text: "text";
3632
3633
  }>>;
3633
3634
  }, z.core.$strict>>;
3634
3635
  advisor: z.ZodOptional<z.ZodObject<{
@@ -4193,8 +4194,8 @@ declare const GlobalConfigSchema: z.ZodObject<{
4193
4194
  }>>;
4194
4195
  layout: z.ZodOptional<z.ZodObject<{
4195
4196
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
4196
- model: "model";
4197
4197
  account: "account";
4198
+ model: "model";
4198
4199
  identity: "identity";
4199
4200
  provider: "provider";
4200
4201
  version: "version";
@@ -4286,8 +4287,8 @@ declare const GlobalConfigSchema: z.ZodObject<{
4286
4287
  effort: z.ZodOptional<z.ZodObject<{
4287
4288
  format: z.ZodOptional<z.ZodEnum<{
4288
4289
  symbol: "symbol";
4289
- text: "text";
4290
4290
  full: "full";
4291
+ text: "text";
4291
4292
  }>>;
4292
4293
  }, z.core.$strict>>;
4293
4294
  advisor: z.ZodOptional<z.ZodObject<{
@@ -5785,6 +5786,42 @@ interface ConnectCapture {
5785
5786
  readonly upgrade: (request: CapturedRequestShape) => void;
5786
5787
  }
5787
5788
 
5789
+ /**
5790
+ * The listening-socket handover between a serving front door and the successor it starts for a planned replacement (`agent-shim frontdoor restart`, `agent-shim update --restart-door`), so the sticky addresses never stop accepting: the kernel's accept queue for each listener is held by the old door until the successor holds it too, and only then does the old door stop accepting and drain.
5791
+ *
5792
+ * The two doors speak over the IPC channel Node opens between a parent and the child it spawns with one, and each listening socket crosses it as a handle attached to a message (`child.send(message, server)`), which is the only way Node passes a listening socket between processes. The successor asks for each listener only once its own server for that listener is built, and adopts the handle in the same turn the message is delivered in: Node starts accepting on a received listening handle inside a server of its own before it hands the handle over, and a connection accepted there before the successor's server adopts it would reach a server with no connection listener and hang. Asking per listener keeps every adoption inside one delivery.
5793
+ *
5794
+ * The exchange, in order: the successor sends `take` naming one listener; the old door answers with `listener` naming it and carrying the handle; once the successor has adopted all three and recorded itself as the owner in the state file, it sends `serving` and ends the channel. The old door then drains exactly as it does on `SIGTERM`. Any other outcome (the successor exits or ends the channel early, sends something this release cannot read, or is still not serving when the budget ends) ends the successor if it is still running and leaves the old door to drain the ordinary way, so the replacement still happens, through the path that has a gap.
5795
+ */
5796
+ /** Where a listener's socket comes from: bound afresh, preferring the sticky port and taking any free one when it is held, or adopted from the door being replaced. */
5797
+ type ListenSource = {
5798
+ readonly preferredPort: number | undefined;
5799
+ } | {
5800
+ readonly inherit: () => Promise<net__default.Server>;
5801
+ };
5802
+ /** The listeners a door hands over: the HTTPS provider listener, the CONNECT surface, and the plain-HTTP direct listener. */
5803
+ declare const HANDOVER_LISTENERS: readonly ["provider", "connect", "direct"];
5804
+ type HandoverListenerName = (typeof HANDOVER_LISTENERS)[number];
5805
+ /** The listening sockets a door hands over, one per listener. */
5806
+ type HandoverSockets = Readonly<Record<HandoverListenerName, net__default.Server>>;
5807
+ /** How a handover ended, as the old door sees it. */
5808
+ type HandoverOutcome = {
5809
+ readonly ok: true;
5810
+ readonly successorPid: number;
5811
+ } | {
5812
+ readonly ok: false;
5813
+ readonly reason: string;
5814
+ };
5815
+ /** What a successor door does with the channel to the door it replaces: take each listener's socket, then report that it serves. */
5816
+ interface Predecessor {
5817
+ /**
5818
+ * Asks for one listener's socket and resolves with it in the turn the old door's answer is delivered in, so the caller's continuation (which must adopt it at once, see the module comment) runs before the event loop can accept a connection on it. Rejects when the channel ends first or the answer cannot be read.
5819
+ */
5820
+ readonly take: (listener: HandoverListenerName) => Promise<net__default.Server>;
5821
+ /** Tells the old door this door accepts on every listener and owns the state file, then ends the channel. */
5822
+ readonly serving: () => void;
5823
+ }
5824
+
5788
5825
  /**
5789
5826
  * The front door's CONNECT surface, so an OAuth session can have agent-shim's routing AND Claude Code's Remote Control at once: Remote Control refuses any `ANTHROPIC_BASE_URL` other than the real API, but happily honours `HTTPS_PROXY`, so OAuth launches route at the proxy layer instead.
5790
5827
  *
@@ -5892,6 +5929,8 @@ type ConnectRequestHandler = (request: IncomingMessage, response: ServerResponse
5892
5929
  /** A bound loopback listener and how to stop it. */
5893
5930
  interface ConnectListenerHandle {
5894
5931
  readonly port: number;
5932
+ /** The listening socket itself, which a planned replacement hands to the successor door (see `./handover.ts`). */
5933
+ readonly listening: net.Server;
5895
5934
  /** Stops accepting and releases the port at once, leaving every connection already accepted open: a successor can bind the same port while they finish. */
5896
5935
  readonly stopAccepting: () => void;
5897
5936
  /** Stops accepting, ends every live connection, and resolves once the port is released. */
@@ -5920,8 +5959,8 @@ interface HttpParserSession {
5920
5959
  * Every effect the MITM proxy performs, injected so the routing decisions and lifecycle run against fakes in unit tests (the SupervisorPorts pattern): TCP listening, TLS termination, HTTP parsing, plain TCP tunnels, and request forwarding. The real implementation is `realConnectEffects`; the TLS round-trip test uses it with redirected targets.
5921
5960
  */
5922
5961
  interface ConnectEffects {
5923
- /** Binds a loopback TCP listener; `preferredPort` is tried first and any free port used when it is taken (bind, do not probe: check-then-bind races). Resolves with the bound port and a close handle. */
5924
- readonly listenLoopback: (preferredPort: number | undefined, onSocket: (socket: net.Socket) => void) => Promise<ConnectListenerHandle>;
5962
+ /** Binds a loopback TCP listener, or adopts the one `source` inherits from the door being replaced; a bound one tries the preferred port first and uses any free port when it is taken (bind, do not probe: check-then-bind races). Resolves with the bound port and a close handle. */
5963
+ readonly listenLoopback: (source: ListenSource, onSocket: (socket: net.Socket) => void) => Promise<ConnectListenerHandle>;
5925
5964
  /** Builds the TLS terminator for one leaf, handing each successfully handshaked session to `onSecure` together with the context its `accept` call carried. `alpnProtocols`, when given, is advertised during the handshake, which is how a tap host's session can offer HTTP/2 the way its real server does. */
5926
5965
  readonly createTlsAcceptor: (leaf: LeafCert, onSecure: (secure: net.Socket, context: string) => void, alpnProtocols?: readonly string[]) => TlsAcceptor;
5927
5966
  /** Builds the transparent surface's TLS terminator: one handshake whose SNI name selects which served host's leaf answers it, so a connection redirected from any of the hosts sharing the redirected address is terminated as the host it named. A name the surface does not serve is answered with no certificate at all (a client that sends no SNI never reaches the selection and finds no default certificate either), because the only leaf that could answer such a name is another host's, which the client's own hostname check would reject anyway. No ALPN is offered: node's TLS server negotiates ALPN from the listener's own options and ignores protocols named on an SNI-selected secure context, and the API host's terminated session is parsed as HTTP/1.1, which a negotiated `h2` would strand. */
@@ -5975,12 +6014,14 @@ interface ConnectServerConfig {
5975
6014
  /** A running connect surface. */
5976
6015
  interface ConnectServerHandle {
5977
6016
  readonly port: number;
6017
+ /** The CONNECT listener's listening socket, which a planned replacement hands to the successor door (see `./handover.ts`). The transparent listener is not handed over: it exists only when the door's own environment asks for it, which a successor decides for itself. */
6018
+ readonly listening: net.Server;
5978
6019
  /** The transparent listener's port, when one was requested: what an operating-system redirect should point at. */
5979
6020
  readonly transparentPort?: number;
5980
6021
  /** How many authenticated connections (blind tunnels and terminated sessions together) are open now: what closing this surface, or exiting its process, drops. */
5981
6022
  readonly openTunnels: () => number;
5982
6023
  /**
5983
- * Retires the surface without cutting off the tunnels it carries: the port is released at once so a successor can bind it, every connection that is not a blind tunnel (the terminated sessions, which carry this door's own routing state, and connections still waiting for their head) is ended, and the blind tunnels, which are byte pumps to hosts the door never looks into, keep running until they end by themselves or their launch ends. Resolves when the last has, with the surface fully closed.
6024
+ * Retires the surface without cutting off the tunnels it carries: the port is released at once so a successor can bind it, the terminated sessions (which carry this door's own routing state) are ended so their clients reconnect to the successor, and the blind tunnels, which are byte pumps to hosts the door never looks into, keep running until they end by themselves or their launch ends. A connection the listener accepted before it stopped but whose head has not arrived yet is still answered: its blind tunnel runs like any other, its terminated session serves one request and ends, and one whose head never comes is refused at its deadline. Resolves when the last connection has closed, with the surface fully closed.
5984
6025
  */
5985
6026
  readonly drain: () => Promise<void>;
5986
6027
  /** Stops the listener, drops every live tunnel and terminated session, and resolves once the port is released. */
@@ -6002,7 +6043,7 @@ interface ConnectLocalSurface {
6002
6043
  *
6003
6044
  * The connection flow: read the CONNECT head within the deadline (never more of the stream than that, so an early ClientHello glued to the head is pushed back with `unshift` and still seen by whatever consumes the socket next), authenticate it, then either blind-tunnel the target or terminate its TLS and parse HTTP on the session. Every network effect flows through `effects`; nothing here touches the network or filesystem itself.
6004
6045
  */
6005
- declare function startConnectServer(config: ConnectServerConfig, effects: ConnectEffects, preferredPort: number | undefined): Promise<ConnectServerHandle>;
6046
+ declare function startConnectServer(config: ConnectServerConfig, effects: ConnectEffects, source: ListenSource): Promise<ConnectServerHandle>;
6006
6047
  /** The real `ConnectCertStore` on the filesystem: `ca.pem` world-readable (it is public material), `ca.key` mode 0600 exactly, chmod'ed after the write because a create's mode bits pass through the process umask. */
6007
6048
  declare function realConnectCertStore(paths: {
6008
6049
  readonly frontdoorCaDir: string;
@@ -9019,6 +9060,7 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
9019
9060
  kind: zod.ZodLiteral<"profile">;
9020
9061
  name: zod.ZodString;
9021
9062
  value: zod.ZodObject<{
9063
+ description: zod.ZodOptional<zod.ZodString>;
9022
9064
  entries: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodBoolean, zod.ZodObject<{
9023
9065
  value: zod.ZodBoolean;
9024
9066
  when: zod.ZodUnion<readonly [zod.ZodObject<{
@@ -9094,7 +9136,6 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
9094
9136
  key: zod.ZodType<trilean.JsonValue, unknown, zod_v4_core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
9095
9137
  }, zod_v4_core.$strip>], "kind">]>;
9096
9138
  }, zod_v4_core.$strict>]>>>;
9097
- description: zod.ZodOptional<zod.ZodString>;
9098
9139
  models: zod.ZodOptional<zod.ZodObject<{
9099
9140
  virtual: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodObject<{
9100
9141
  mode: zod.ZodEnum<{
@@ -9182,8 +9223,8 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
9182
9223
  }>>;
9183
9224
  layout: zod.ZodOptional<zod.ZodObject<{
9184
9225
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
9185
- model: "model";
9186
9226
  account: "account";
9227
+ model: "model";
9187
9228
  identity: "identity";
9188
9229
  provider: "provider";
9189
9230
  version: "version";
@@ -9275,8 +9316,8 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
9275
9316
  effort: zod.ZodOptional<zod.ZodObject<{
9276
9317
  format: zod.ZodOptional<zod.ZodEnum<{
9277
9318
  symbol: "symbol";
9278
- text: "text";
9279
9319
  full: "full";
9320
+ text: "text";
9280
9321
  }>>;
9281
9322
  }, zod_v4_core.$strict>>;
9282
9323
  advisor: zod.ZodOptional<zod.ZodObject<{
@@ -9645,6 +9686,7 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
9645
9686
  kind: zod.ZodLiteral<"profile">;
9646
9687
  name: zod.ZodString;
9647
9688
  value: zod.ZodObject<{
9689
+ description: zod.ZodOptional<zod.ZodString>;
9648
9690
  entries: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodBoolean, zod.ZodObject<{
9649
9691
  value: zod.ZodBoolean;
9650
9692
  when: zod.ZodUnion<readonly [zod.ZodObject<{
@@ -9720,7 +9762,6 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
9720
9762
  key: zod.ZodType<trilean.JsonValue, unknown, zod_v4_core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
9721
9763
  }, zod_v4_core.$strip>], "kind">]>;
9722
9764
  }, zod_v4_core.$strict>]>>>;
9723
- description: zod.ZodOptional<zod.ZodString>;
9724
9765
  models: zod.ZodOptional<zod.ZodObject<{
9725
9766
  virtual: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodObject<{
9726
9767
  mode: zod.ZodEnum<{
@@ -9808,8 +9849,8 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
9808
9849
  }>>;
9809
9850
  layout: zod.ZodOptional<zod.ZodObject<{
9810
9851
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
9811
- model: "model";
9812
9852
  account: "account";
9853
+ model: "model";
9813
9854
  identity: "identity";
9814
9855
  provider: "provider";
9815
9856
  version: "version";
@@ -9901,8 +9942,8 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
9901
9942
  effort: zod.ZodOptional<zod.ZodObject<{
9902
9943
  format: zod.ZodOptional<zod.ZodEnum<{
9903
9944
  symbol: "symbol";
9904
- text: "text";
9905
9945
  full: "full";
9946
+ text: "text";
9906
9947
  }>>;
9907
9948
  }, zod_v4_core.$strict>>;
9908
9949
  advisor: zod.ZodOptional<zod.ZodObject<{
@@ -10910,8 +10951,8 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
10910
10951
  }>>;
10911
10952
  layout: zod.ZodOptional<zod.ZodObject<{
10912
10953
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
10913
- model: "model";
10914
10954
  account: "account";
10955
+ model: "model";
10915
10956
  identity: "identity";
10916
10957
  provider: "provider";
10917
10958
  version: "version";
@@ -11003,8 +11044,8 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
11003
11044
  effort: zod.ZodOptional<zod.ZodObject<{
11004
11045
  format: zod.ZodOptional<zod.ZodEnum<{
11005
11046
  symbol: "symbol";
11006
- text: "text";
11007
11047
  full: "full";
11048
+ text: "text";
11008
11049
  }>>;
11009
11050
  }, zod_v4_core.$strict>>;
11010
11051
  advisor: zod.ZodOptional<zod.ZodObject<{
@@ -11593,8 +11634,8 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
11593
11634
  }>>;
11594
11635
  layout: zod.ZodOptional<zod.ZodObject<{
11595
11636
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
11596
- model: "model";
11597
11637
  account: "account";
11638
+ model: "model";
11598
11639
  identity: "identity";
11599
11640
  provider: "provider";
11600
11641
  version: "version";
@@ -11686,8 +11727,8 @@ declare function createConfigApiRouter(deps: ConfigApiDeps): {
11686
11727
  effort: zod.ZodOptional<zod.ZodObject<{
11687
11728
  format: zod.ZodOptional<zod.ZodEnum<{
11688
11729
  symbol: "symbol";
11689
- text: "text";
11690
11730
  full: "full";
11731
+ text: "text";
11691
11732
  }>>;
11692
11733
  }, zod_v4_core.$strict>>;
11693
11734
  advisor: zod.ZodOptional<zod.ZodObject<{
@@ -12365,8 +12406,8 @@ declare const StatuslineSchema: z.ZodObject<{
12365
12406
  }>>;
12366
12407
  layout: z.ZodOptional<z.ZodObject<{
12367
12408
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
12368
- model: "model";
12369
12409
  account: "account";
12410
+ model: "model";
12370
12411
  identity: "identity";
12371
12412
  provider: "provider";
12372
12413
  version: "version";
@@ -12458,8 +12499,8 @@ declare const StatuslineSchema: z.ZodObject<{
12458
12499
  effort: z.ZodOptional<z.ZodObject<{
12459
12500
  format: z.ZodOptional<z.ZodEnum<{
12460
12501
  symbol: "symbol";
12461
- text: "text";
12462
12502
  full: "full";
12503
+ text: "text";
12463
12504
  }>>;
12464
12505
  }, z.core.$strict>>;
12465
12506
  advisor: z.ZodOptional<z.ZodObject<{
@@ -13128,8 +13169,8 @@ declare function createLaunchApiRouter(deps: LaunchApiDeps): {
13128
13169
  }>>;
13129
13170
  layout: zod.ZodOptional<zod.ZodObject<{
13130
13171
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
13131
- model: "model";
13132
13172
  account: "account";
13173
+ model: "model";
13133
13174
  identity: "identity";
13134
13175
  provider: "provider";
13135
13176
  version: "version";
@@ -13221,8 +13262,8 @@ declare function createLaunchApiRouter(deps: LaunchApiDeps): {
13221
13262
  effort: zod.ZodOptional<zod.ZodObject<{
13222
13263
  format: zod.ZodOptional<zod.ZodEnum<{
13223
13264
  symbol: "symbol";
13224
- text: "text";
13225
13265
  full: "full";
13266
+ text: "text";
13226
13267
  }>>;
13227
13268
  }, zod_v4_core.$strict>>;
13228
13269
  advisor: zod.ZodOptional<zod.ZodObject<{
@@ -14702,8 +14743,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
14702
14743
  }>>;
14703
14744
  layout: zod.ZodOptional<zod.ZodObject<{
14704
14745
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
14705
- model: "model";
14706
14746
  account: "account";
14747
+ model: "model";
14707
14748
  identity: "identity";
14708
14749
  provider: "provider";
14709
14750
  version: "version";
@@ -14795,8 +14836,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
14795
14836
  effort: zod.ZodOptional<zod.ZodObject<{
14796
14837
  format: zod.ZodOptional<zod.ZodEnum<{
14797
14838
  symbol: "symbol";
14798
- text: "text";
14799
14839
  full: "full";
14840
+ text: "text";
14800
14841
  }>>;
14801
14842
  }, zod_v4_core.$strict>>;
14802
14843
  advisor: zod.ZodOptional<zod.ZodObject<{
@@ -15405,6 +15446,7 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
15405
15446
  kind: zod.ZodLiteral<"profile">;
15406
15447
  name: zod.ZodString;
15407
15448
  value: zod.ZodObject<{
15449
+ description: zod.ZodOptional<zod.ZodString>;
15408
15450
  entries: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodBoolean, zod.ZodObject<{
15409
15451
  value: zod.ZodBoolean;
15410
15452
  when: zod.ZodUnion<readonly [zod.ZodObject<{
@@ -15480,7 +15522,6 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
15480
15522
  key: zod.ZodType<trilean.JsonValue, unknown, zod_v4_core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
15481
15523
  }, zod_v4_core.$strip>], "kind">]>;
15482
15524
  }, zod_v4_core.$strict>]>>>;
15483
- description: zod.ZodOptional<zod.ZodString>;
15484
15525
  models: zod.ZodOptional<zod.ZodObject<{
15485
15526
  virtual: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodObject<{
15486
15527
  mode: zod.ZodEnum<{
@@ -15568,8 +15609,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
15568
15609
  }>>;
15569
15610
  layout: zod.ZodOptional<zod.ZodObject<{
15570
15611
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
15571
- model: "model";
15572
15612
  account: "account";
15613
+ model: "model";
15573
15614
  identity: "identity";
15574
15615
  provider: "provider";
15575
15616
  version: "version";
@@ -15661,8 +15702,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
15661
15702
  effort: zod.ZodOptional<zod.ZodObject<{
15662
15703
  format: zod.ZodOptional<zod.ZodEnum<{
15663
15704
  symbol: "symbol";
15664
- text: "text";
15665
15705
  full: "full";
15706
+ text: "text";
15666
15707
  }>>;
15667
15708
  }, zod_v4_core.$strict>>;
15668
15709
  advisor: zod.ZodOptional<zod.ZodObject<{
@@ -16031,6 +16072,7 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
16031
16072
  kind: zod.ZodLiteral<"profile">;
16032
16073
  name: zod.ZodString;
16033
16074
  value: zod.ZodObject<{
16075
+ description: zod.ZodOptional<zod.ZodString>;
16034
16076
  entries: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodBoolean, zod.ZodObject<{
16035
16077
  value: zod.ZodBoolean;
16036
16078
  when: zod.ZodUnion<readonly [zod.ZodObject<{
@@ -16106,7 +16148,6 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
16106
16148
  key: zod.ZodType<trilean.JsonValue, unknown, zod_v4_core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
16107
16149
  }, zod_v4_core.$strip>], "kind">]>;
16108
16150
  }, zod_v4_core.$strict>]>>>;
16109
- description: zod.ZodOptional<zod.ZodString>;
16110
16151
  models: zod.ZodOptional<zod.ZodObject<{
16111
16152
  virtual: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnion<readonly [zod.ZodObject<{
16112
16153
  mode: zod.ZodEnum<{
@@ -16194,8 +16235,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
16194
16235
  }>>;
16195
16236
  layout: zod.ZodOptional<zod.ZodObject<{
16196
16237
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
16197
- model: "model";
16198
16238
  account: "account";
16239
+ model: "model";
16199
16240
  identity: "identity";
16200
16241
  provider: "provider";
16201
16242
  version: "version";
@@ -16287,8 +16328,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
16287
16328
  effort: zod.ZodOptional<zod.ZodObject<{
16288
16329
  format: zod.ZodOptional<zod.ZodEnum<{
16289
16330
  symbol: "symbol";
16290
- text: "text";
16291
16331
  full: "full";
16332
+ text: "text";
16292
16333
  }>>;
16293
16334
  }, zod_v4_core.$strict>>;
16294
16335
  advisor: zod.ZodOptional<zod.ZodObject<{
@@ -17296,8 +17337,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
17296
17337
  }>>;
17297
17338
  layout: zod.ZodOptional<zod.ZodObject<{
17298
17339
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
17299
- model: "model";
17300
17340
  account: "account";
17341
+ model: "model";
17301
17342
  identity: "identity";
17302
17343
  provider: "provider";
17303
17344
  version: "version";
@@ -17389,8 +17430,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
17389
17430
  effort: zod.ZodOptional<zod.ZodObject<{
17390
17431
  format: zod.ZodOptional<zod.ZodEnum<{
17391
17432
  symbol: "symbol";
17392
- text: "text";
17393
17433
  full: "full";
17434
+ text: "text";
17394
17435
  }>>;
17395
17436
  }, zod_v4_core.$strict>>;
17396
17437
  advisor: zod.ZodOptional<zod.ZodObject<{
@@ -17979,8 +18020,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
17979
18020
  }>>;
17980
18021
  layout: zod.ZodOptional<zod.ZodObject<{
17981
18022
  header: zod.ZodOptional<zod.ZodArray<zod.ZodEnum<{
17982
- model: "model";
17983
18023
  account: "account";
18024
+ model: "model";
17984
18025
  identity: "identity";
17985
18026
  provider: "provider";
17986
18027
  version: "version";
@@ -18072,8 +18113,8 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
18072
18113
  effort: zod.ZodOptional<zod.ZodObject<{
18073
18114
  format: zod.ZodOptional<zod.ZodEnum<{
18074
18115
  symbol: "symbol";
18075
- text: "text";
18076
18116
  full: "full";
18117
+ text: "text";
18077
18118
  }>>;
18078
18119
  }, zod_v4_core.$strict>>;
18079
18120
  advisor: zod.ZodOptional<zod.ZodObject<{
@@ -19540,6 +19581,7 @@ declare const ConfigProfileAddOutputSchema: z.ZodObject<{
19540
19581
  kind: z.ZodLiteral<"profile">;
19541
19582
  name: z.ZodString;
19542
19583
  value: z.ZodObject<{
19584
+ description: z.ZodOptional<z.ZodString>;
19543
19585
  entries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
19544
19586
  value: z.ZodBoolean;
19545
19587
  when: z.ZodUnion<readonly [z.ZodObject<{
@@ -19615,7 +19657,6 @@ declare const ConfigProfileAddOutputSchema: z.ZodObject<{
19615
19657
  key: z.ZodType<trilean.JsonValue, unknown, z.core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
19616
19658
  }, z.core.$strip>], "kind">]>;
19617
19659
  }, z.core.$strict>]>>>;
19618
- description: z.ZodOptional<z.ZodString>;
19619
19660
  models: z.ZodOptional<z.ZodObject<{
19620
19661
  virtual: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
19621
19662
  mode: z.ZodEnum<{
@@ -19703,8 +19744,8 @@ declare const ConfigProfileAddOutputSchema: z.ZodObject<{
19703
19744
  }>>;
19704
19745
  layout: z.ZodOptional<z.ZodObject<{
19705
19746
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
19706
- model: "model";
19707
19747
  account: "account";
19748
+ model: "model";
19708
19749
  identity: "identity";
19709
19750
  provider: "provider";
19710
19751
  version: "version";
@@ -19796,8 +19837,8 @@ declare const ConfigProfileAddOutputSchema: z.ZodObject<{
19796
19837
  effort: z.ZodOptional<z.ZodObject<{
19797
19838
  format: z.ZodOptional<z.ZodEnum<{
19798
19839
  symbol: "symbol";
19799
- text: "text";
19800
19840
  full: "full";
19841
+ text: "text";
19801
19842
  }>>;
19802
19843
  }, z.core.$strict>>;
19803
19844
  advisor: z.ZodOptional<z.ZodObject<{
@@ -20168,6 +20209,7 @@ declare const ConfigProfileSetOutputSchema: z.ZodObject<{
20168
20209
  kind: z.ZodLiteral<"profile">;
20169
20210
  name: z.ZodString;
20170
20211
  value: z.ZodObject<{
20212
+ description: z.ZodOptional<z.ZodString>;
20171
20213
  entries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
20172
20214
  value: z.ZodBoolean;
20173
20215
  when: z.ZodUnion<readonly [z.ZodObject<{
@@ -20243,7 +20285,6 @@ declare const ConfigProfileSetOutputSchema: z.ZodObject<{
20243
20285
  key: z.ZodType<trilean.JsonValue, unknown, z.core.$ZodTypeInternals<trilean.JsonValue, unknown>>;
20244
20286
  }, z.core.$strip>], "kind">]>;
20245
20287
  }, z.core.$strict>]>>>;
20246
- description: z.ZodOptional<z.ZodString>;
20247
20288
  models: z.ZodOptional<z.ZodObject<{
20248
20289
  virtual: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
20249
20290
  mode: z.ZodEnum<{
@@ -20331,8 +20372,8 @@ declare const ConfigProfileSetOutputSchema: z.ZodObject<{
20331
20372
  }>>;
20332
20373
  layout: z.ZodOptional<z.ZodObject<{
20333
20374
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
20334
- model: "model";
20335
20375
  account: "account";
20376
+ model: "model";
20336
20377
  identity: "identity";
20337
20378
  provider: "provider";
20338
20379
  version: "version";
@@ -20424,8 +20465,8 @@ declare const ConfigProfileSetOutputSchema: z.ZodObject<{
20424
20465
  effort: z.ZodOptional<z.ZodObject<{
20425
20466
  format: z.ZodOptional<z.ZodEnum<{
20426
20467
  symbol: "symbol";
20427
- text: "text";
20428
20468
  full: "full";
20469
+ text: "text";
20429
20470
  }>>;
20430
20471
  }, z.core.$strict>>;
20431
20472
  advisor: z.ZodOptional<z.ZodObject<{
@@ -21435,8 +21476,8 @@ declare const ConfigRuleAddOutputSchema: z.ZodObject<{
21435
21476
  }>>;
21436
21477
  layout: z.ZodOptional<z.ZodObject<{
21437
21478
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
21438
- model: "model";
21439
21479
  account: "account";
21480
+ model: "model";
21440
21481
  identity: "identity";
21441
21482
  provider: "provider";
21442
21483
  version: "version";
@@ -21528,8 +21569,8 @@ declare const ConfigRuleAddOutputSchema: z.ZodObject<{
21528
21569
  effort: z.ZodOptional<z.ZodObject<{
21529
21570
  format: z.ZodOptional<z.ZodEnum<{
21530
21571
  symbol: "symbol";
21531
- text: "text";
21532
21572
  full: "full";
21573
+ text: "text";
21533
21574
  }>>;
21534
21575
  }, z.core.$strict>>;
21535
21576
  advisor: z.ZodOptional<z.ZodObject<{
@@ -22120,8 +22161,8 @@ declare const ConfigRuleSetOutputSchema: z.ZodObject<{
22120
22161
  }>>;
22121
22162
  layout: z.ZodOptional<z.ZodObject<{
22122
22163
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
22123
- model: "model";
22124
22164
  account: "account";
22165
+ model: "model";
22125
22166
  identity: "identity";
22126
22167
  provider: "provider";
22127
22168
  version: "version";
@@ -22213,8 +22254,8 @@ declare const ConfigRuleSetOutputSchema: z.ZodObject<{
22213
22254
  effort: z.ZodOptional<z.ZodObject<{
22214
22255
  format: z.ZodOptional<z.ZodEnum<{
22215
22256
  symbol: "symbol";
22216
- text: "text";
22217
22257
  full: "full";
22258
+ text: "text";
22218
22259
  }>>;
22219
22260
  }, z.core.$strict>>;
22220
22261
  advisor: z.ZodOptional<z.ZodObject<{
@@ -23062,8 +23103,8 @@ declare const LaunchResolveOutputSchema: z.ZodObject<{
23062
23103
  }>>;
23063
23104
  layout: z.ZodOptional<z.ZodObject<{
23064
23105
  header: z.ZodOptional<z.ZodArray<z.ZodEnum<{
23065
- model: "model";
23066
23106
  account: "account";
23107
+ model: "model";
23067
23108
  identity: "identity";
23068
23109
  provider: "provider";
23069
23110
  version: "version";
@@ -23155,8 +23196,8 @@ declare const LaunchResolveOutputSchema: z.ZodObject<{
23155
23196
  effort: z.ZodOptional<z.ZodObject<{
23156
23197
  format: z.ZodOptional<z.ZodEnum<{
23157
23198
  symbol: "symbol";
23158
- text: "text";
23159
23199
  full: "full";
23200
+ text: "text";
23160
23201
  }>>;
23161
23202
  }, z.core.$strict>>;
23162
23203
  advisor: z.ZodOptional<z.ZodObject<{
@@ -23843,6 +23884,10 @@ interface EnsureFrontDoorPorts {
23843
23884
  readonly verifyListener: (port: number) => ListenerVerdict;
23844
23885
  /** Asks a running front-door supervisor to exit, without waiting for it to: the caller polls `isRunning`. Only ever called for a pid whose recorded listener has just authenticated as agent-shim's own, or whose process is agent-shim's front-door supervisor (`isFrontDoorSupervisor`). */
23845
23886
  readonly stopSupervisor: (pid: number) => void;
23887
+ /**
23888
+ * Asks a running front-door supervisor to hand its listening sockets to a successor it starts itself (see `./handover.ts`), without waiting for it to: the caller polls the state file for the successor. Only ever called for a pid whose listener has just authenticated, whose recorded protocol is `FRONT_DOOR_HANDOVER_PROTOCOL` or later, and whose process is agent-shim's own front-door supervisor, the process that installs the handler for the request. Absent where the platform has no way to deliver the request (Windows, which has no user signals), so every replacement there takes the stop-and-start path.
23889
+ */
23890
+ readonly requestHandover?: (pid: number) => void;
23846
23891
  /** Appends one line to the front door's own log. Called before every signal sent to a door, so the door's log names the cause of its own exit. */
23847
23892
  readonly recordReplacement: (line: string) => void;
23848
23893
  /** Ends a supervisor that did not exit when asked to, without giving it the chance to refuse: a door whose event loop is blocked never runs its signal handler. Called only for a pid `isFrontDoorSupervisor` has just confirmed, after `stopSupervisor` and a grace period. */
@@ -23878,6 +23923,8 @@ interface DoorWatchdog {
23878
23923
  /** A bound front-door listener in this process, and how to stop it. */
23879
23924
  interface FrontDoorListenerHandle {
23880
23925
  readonly port: number;
23926
+ /** The listening socket itself, which a planned replacement hands to the successor door (see `./handover.ts`). */
23927
+ readonly listening: net__default.Server;
23881
23928
  /** Stops accepting, ends every live connection, and resolves once the port is released. */
23882
23929
  readonly close: () => Promise<void>;
23883
23930
  /** Releases the port at once (before the first await) and leaves the work already in progress to finish; resolves when the listener has nothing left to carry. */
@@ -23911,17 +23958,17 @@ interface FrontDoorSupervisorPorts {
23911
23958
  */
23912
23959
  readonly runningAmong: (pids: readonly number[]) => Promise<ReadonlySet<number>>;
23913
23960
  /**
23914
- * Starts the provider listener in this process on `preferredPort` (falling back to any free port when the sticky one is taken, decided at bind time rather than by a racy check-then-bind probe) and resolves once it has bound and answered its own health probe over TLS. This is the HTTPS listener every provider session's base URL points at, serving a loopback leaf signed by agent-shim's CA.
23961
+ * Starts the provider listener in this process from `source`: bound on its preferred port (falling back to any free port when the sticky one is taken, decided at bind time rather than by a racy check-then-bind probe), or adopted from the door this one replaces. Resolves once it accepts and has answered its own health probe over TLS. This is the HTTPS listener every provider session's base URL points at, serving a loopback leaf signed by agent-shim's CA.
23915
23962
  */
23916
- readonly startProviderListener: (preferredPort: number | undefined) => Promise<FrontDoorListenerHandle>;
23963
+ readonly startProviderListener: (source: ListenSource) => Promise<FrontDoorListenerHandle>;
23917
23964
  /**
23918
- * Starts the CONNECT surface in this process on `preferredPort` (same bind-time fallback): the TLS-terminating listener an OAuth session's HTTPS_PROXY points at. Bound before any state names it, so an OAuth launch never finds one listener up without the other.
23965
+ * Starts the CONNECT surface in this process from `source` (same bind-time fallback, or adopted): the TLS-terminating listener an OAuth session's HTTPS_PROXY points at. Bound before any state names it, so an OAuth launch never finds one listener up without the other.
23919
23966
  */
23920
- readonly startConnectListener: (preferredPort: number | undefined) => Promise<FrontDoorListenerHandle>;
23967
+ readonly startConnectListener: (source: ListenSource) => Promise<FrontDoorListenerHandle>;
23921
23968
  /**
23922
- * Starts the direct listener on `preferredPort` (same bind-time fallback): the same routes as the provider listener, minus the headroom hop, over plain HTTP because headroom is what connects to it. Headroom forwards routed traffic back here, which is what keeps the hop from looping, and the port is sticky like the others because headroom's allowlist admits its exact origin. It admits only the hop's own requests and holds no credential until it redeems one from the hop's custody.
23969
+ * Starts the direct listener from `source` (same bind-time fallback, or adopted): the same routes as the provider listener, minus the headroom hop, over plain HTTP because headroom is what connects to it. Headroom forwards routed traffic back here, which is what keeps the hop from looping, and the port is sticky like the others because headroom's allowlist admits its exact origin. It admits only the hop's own requests and holds no credential until it redeems one from the hop's custody.
23923
23970
  */
23924
- readonly startDirectListener: (preferredPort: number | undefined) => Promise<FrontDoorListenerHandle>;
23971
+ readonly startDirectListener: (source: ListenSource) => Promise<FrontDoorListenerHandle>;
23925
23972
  /**
23926
23973
  * Stops the Remote Control stream hub: persists every live attachment's sequence cursor synchronously, then frees the dials. Called exactly once on every exit the supervisor owns, after every listener has stopped accepting. A closing exit has every listener down by then; a drain still has responses settling, which is safe because the hub refuses to attach once it is closed (otherwise the reconcile after an observed exchange would re-attach a stream the close had just ended).
23927
23974
  */
@@ -23934,6 +23981,17 @@ interface FrontDoorSupervisorPorts {
23934
23981
  * Aborted when the process is asked to exit (the CLI's `__frontdoor-supervisor` aborts it on its first SIGTERM or SIGINT). The door then retires by draining: it releases its listening addresses at once, so a successor can bind the same sticky ports, ends what holds its own routing state, and stays up only as long as the connections it still carries (blind tunnels, a response being streamed) take to end. Optional for a host that decides when the door stops by other means.
23935
23982
  */
23936
23983
  readonly retire?: AbortSignal;
23984
+ /**
23985
+ * A planned replacement that keeps every address accepting (see `./handover.ts`): `requested` is aborted when a launcher asks this door to hand its listeners to a successor (the CLI's `__frontdoor-supervisor` aborts it on `SIGUSR2`), and `run` starts the successor, hands it the three listening sockets and resolves once it serves them or with why it did not. The door keeps accepting throughout and drains afterwards either way, so a failed handover still ends in the ordinary replacement. Optional because only a door whose process can start a successor of itself can offer it.
23986
+ */
23987
+ readonly handover?: {
23988
+ readonly requested: AbortSignal;
23989
+ readonly run: (sockets: HandoverSockets) => Promise<HandoverOutcome>;
23990
+ };
23991
+ /**
23992
+ * The door this one replaces through a handover, when it was started for one: its listeners are adopted from that door's sockets instead of bound, the state file is not written until this door accepts on all three (the old door owns it and keeps serving until then), and the old door is told once this door serves. Absent for every other start.
23993
+ */
23994
+ readonly predecessor?: Predecessor;
23937
23995
  /** Stops the work the door runs on its own account rather than for a request (the usage, window, job and catalogue keepers), called once when a drain begins so the successor's are the only ones acting. Optional because a host without such work has nothing to stop. */
23938
23996
  readonly stopBackgroundWork?: () => void;
23939
23997
  /**