@p4code/cli 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.mjs CHANGED
@@ -148,7 +148,7 @@ const closeServer = (server) => {
148
148
  * NetService - Service tag for startup networking helpers.
149
149
  */
150
150
  var NetService = class extends Context.Service()("@p4code/shared/Net/NetService") {};
151
- const make$115 = () => {
151
+ const make$116 = () => {
152
152
  /**
153
153
  * Returns true when a TCP server can bind to {host, port}.
154
154
  * `EADDRNOTAVAIL` is treated as available so IPv6-absent hosts don't fail
@@ -257,10 +257,10 @@ const make$115 = () => {
257
257
  })
258
258
  };
259
259
  };
260
- const layer$118 = Layer.sync(NetService, make$115);
260
+ const layer$119 = Layer.sync(NetService, make$116);
261
261
  //#endregion
262
262
  //#region package.json
263
- var version$1 = "0.5.4";
263
+ var version$1 = "0.5.5";
264
264
  //#endregion
265
265
  //#region src/config.ts
266
266
  /**
@@ -281,8 +281,8 @@ var ServerConfig$1 = class extends Context.Service()("@p4code/cli/config/ServerC
281
281
  /** @deprecated Import and use `layerTest` from this module. */
282
282
  static layerTest = (cwd, baseDirOrPrefix) => layerTest$4(cwd, baseDirOrPrefix);
283
283
  };
284
- const make$114 = (config) => ServerConfig$1.of(config);
285
- const layer$117 = (config) => Layer.succeed(ServerConfig$1, make$114(config));
284
+ const make$115 = (config) => ServerConfig$1.of(config);
285
+ const layer$118 = (config) => Layer.succeed(ServerConfig$1, make$115(config));
286
286
  const deriveServerPaths = Effect.fn(function* (baseDir, devUrl, options = {}) {
287
287
  const { join } = yield* Path$1.Path;
288
288
  const stateDir = join(baseDir, devUrl !== void 0 && !options.baseDirIsExplicit ? "dev" : "userdata");
@@ -3719,9 +3719,21 @@ const OrchestrationThreadPairGate = Schema$1.Struct({
3719
3719
  awaitingWatcherSince: Schema$1.NullOr(IsoDateTime),
3720
3720
  updatedAt: IsoDateTime
3721
3721
  });
3722
+ const FusionReviewPolicy = Schema$1.Struct({
3723
+ mode: Schema$1.Literals(["phase", "risk-and-final"]),
3724
+ maxAutomaticReviews: PositiveInt.pipe(Schema$1.withDecodingDefault(Effect.succeed(4))),
3725
+ maxCorrectionRounds: NonNegativeInt.pipe(Schema$1.withDecodingDefault(Effect.succeed(2)))
3726
+ });
3727
+ const FusionReviewExperiment = Schema$1.Struct({
3728
+ policy: FusionReviewPolicy,
3729
+ lastMessageSequence: Schema$1.optionalKey(NonNegativeInt),
3730
+ automaticReviews: NonNegativeInt,
3731
+ correctionRounds: NonNegativeInt
3732
+ });
3722
3733
  /** Persisted relationship between two otherwise ordinary threads. */
3723
3734
  const OrchestrationThreadPair = Schema$1.Struct({
3724
3735
  id: ThreadPairId,
3736
+ reviewExperiment: Schema$1.optionalKey(Schema$1.NullOr(FusionReviewExperiment)),
3725
3737
  implementerThreadId: ThreadId,
3726
3738
  watcherThreadId: ThreadId,
3727
3739
  lastReviewedImplementerSequence: NonNegativeInt,
@@ -4245,6 +4257,7 @@ const ThreadPairCreateCommand = Schema$1.Struct({
4245
4257
  implementerThreadId: ThreadId,
4246
4258
  watcherThreadId: ThreadId,
4247
4259
  continuationMessageId: Schema$1.optional(MessageId),
4260
+ reviewPolicy: Schema$1.optionalKey(Schema$1.NullOr(FusionReviewPolicy)),
4248
4261
  roundCap: Schema$1.optional(NonNegativeInt),
4249
4262
  gateTimeoutMs: Schema$1.optional(NonNegativeInt),
4250
4263
  createdAt: IsoDateTime
@@ -4770,6 +4783,7 @@ const ThreadPairCreatedPayload$1 = Schema$1.Struct({
4770
4783
  lastReviewedImplementerSequence: NonNegativeInt,
4771
4784
  activationTurnId: Schema$1.optional(Schema$1.NullOr(TurnId)),
4772
4785
  continuationMessageId: Schema$1.optional(MessageId),
4786
+ reviewPolicy: Schema$1.optionalKey(Schema$1.NullOr(FusionReviewPolicy)),
4773
4787
  roundCap: Schema$1.optional(NonNegativeInt),
4774
4788
  gateTimeoutMs: Schema$1.optional(NonNegativeInt),
4775
4789
  createdAt: IsoDateTime
@@ -10153,6 +10167,10 @@ const ServerSettings = Schema$1.Struct({
10153
10167
  * smaller; off is the rollback if a pair misbehaves.
10154
10168
  */
10155
10169
  enableOptimizedFusionPromptDelivery: Schema$1.Boolean.pipe(Schema$1.withDecodingDefault(Effect.succeed(true))),
10170
+ /** Local daily measurements and weekly recommendations; never starts agent turns. */
10171
+ enableFusionObservation: Schema$1.Boolean.pipe(Schema$1.withDecodingDefault(Effect.succeed(true))),
10172
+ /** Experimental policy captured by new pairs; null preserves existing behavior. */
10173
+ fusionReviewPolicy: Schema$1.NullOr(FusionReviewPolicy).pipe(Schema$1.withDecodingDefault(Effect.succeed(null))),
10156
10174
  /**
10157
10175
  * Whether the board offers the scoping agent: the Scope action on a task and
10158
10176
  * the panel that drafts a new one by interview.
@@ -10359,6 +10377,8 @@ const ServerSettingsPatch = Schema$1.Struct({
10359
10377
  enableRootCauseBeforeFix: Schema$1.optionalKey(Schema$1.Boolean),
10360
10378
  enableUnpromptedSubagents: Schema$1.optionalKey(Schema$1.Boolean),
10361
10379
  enableOptimizedFusionPromptDelivery: Schema$1.optionalKey(Schema$1.Boolean),
10380
+ enableFusionObservation: Schema$1.optionalKey(Schema$1.Boolean),
10381
+ fusionReviewPolicy: Schema$1.optionalKey(Schema$1.NullOr(FusionReviewPolicy)),
10362
10382
  enableScopingAgent: Schema$1.optionalKey(Schema$1.Boolean),
10363
10383
  enablePlanPhase: Schema$1.optionalKey(Schema$1.Boolean),
10364
10384
  writeGeneratedSkillsToRepo: Schema$1.optionalKey(Schema$1.Boolean),
@@ -14946,7 +14966,7 @@ function deriveAuthClientMetadata(input) {
14946
14966
  //#endregion
14947
14967
  //#region src/auth/EnvironmentAuthPolicy.ts
14948
14968
  var EnvironmentAuthPolicy = class extends Context.Service()("@p4code/cli/auth/EnvironmentAuthPolicy") {};
14949
- const make$113 = Effect.gen(function* () {
14969
+ const make$114 = Effect.gen(function* () {
14950
14970
  const config = yield* ServerConfig$1;
14951
14971
  const isRemoteReachable = isRemoteReachableHost(config.host);
14952
14972
  const policy = config.mode === "desktop" ? isRemoteReachable ? "remote-reachable" : "desktop-managed-local" : isRemoteReachable ? "remote-reachable" : "loopback-browser";
@@ -14964,7 +14984,7 @@ const make$113 = Effect.gen(function* () {
14964
14984
  };
14965
14985
  return EnvironmentAuthPolicy.of({ getDescriptor: () => Effect.succeed(descriptor).pipe(Effect.withSpan("EnvironmentAuthPolicy.getDescriptor")) });
14966
14986
  });
14967
- const layer$116 = Layer.effect(EnvironmentAuthPolicy, make$113);
14987
+ const layer$117 = Layer.effect(EnvironmentAuthPolicy, make$114);
14968
14988
  //#endregion
14969
14989
  //#region src/persistence/Errors.ts
14970
14990
  function summarizeSchemaIssue(issue) {
@@ -15145,7 +15165,7 @@ function toPersistenceSqlOrDecodeError$6(sqlOperation, decodeOperation, correlat
15145
15165
  cause
15146
15166
  });
15147
15167
  }
15148
- const make$112 = Effect.gen(function* () {
15168
+ const make$113 = Effect.gen(function* () {
15149
15169
  const sql = yield* SqlClient.SqlClient;
15150
15170
  const createSessionRow = SqlSchema.void({
15151
15171
  Request: CreateAuthSessionInput,
@@ -15279,7 +15299,7 @@ const make$112 = Effect.gen(function* () {
15279
15299
  setLastConnectedAt
15280
15300
  };
15281
15301
  });
15282
- const layer$115 = Layer.effect(AuthSessionRepository, make$112);
15302
+ const layer$116 = Layer.effect(AuthSessionRepository, make$113);
15283
15303
  //#endregion
15284
15304
  //#region src/auth/ServerSecretStore.ts
15285
15305
  const secretStoreErrorContext = {
@@ -15421,11 +15441,11 @@ const makeForDirectory = Effect.fn("ServerSecretStore.makeForDirectory")(functio
15421
15441
  remove
15422
15442
  });
15423
15443
  });
15424
- const make$111 = Effect.gen(function* () {
15444
+ const make$112 = Effect.gen(function* () {
15425
15445
  const config = yield* ServerConfig$1;
15426
15446
  return yield* makeForDirectory(config.secretsDir);
15427
15447
  });
15428
- const layer$114 = Layer.effect(ServerSecretStore, make$111);
15448
+ const layer$115 = Layer.effect(ServerSecretStore, make$112);
15429
15449
  //#endregion
15430
15450
  //#region src/auth/SessionStore.ts
15431
15451
  var MalformedSessionTokenError = class extends Schema$1.TaggedErrorClass()("MalformedSessionTokenError", {}) {
@@ -15663,7 +15683,7 @@ function toAuthClientSession(input) {
15663
15683
  current: false
15664
15684
  };
15665
15685
  }
15666
- const make$110 = Effect.gen(function* () {
15686
+ const make$111 = Effect.gen(function* () {
15667
15687
  const crypto = yield* Crypto.Crypto;
15668
15688
  const serverConfig = yield* ServerConfig$1;
15669
15689
  const secretStore = yield* ServerSecretStore;
@@ -15978,7 +15998,7 @@ const make$110 = Effect.gen(function* () {
15978
15998
  markDisconnected
15979
15999
  });
15980
16000
  });
15981
- const layer$113 = Layer.effect(SessionStore, make$110).pipe(Layer.provideMerge(layer$115));
16001
+ const layer$114 = Layer.effect(SessionStore, make$111).pipe(Layer.provideMerge(layer$116));
15982
16002
  //#endregion
15983
16003
  //#region src/persistence/AuthPairingLinks.ts
15984
16004
  const AuthPairingLinkRecord = Schema$1.Struct({
@@ -16039,7 +16059,7 @@ function toPersistenceSqlOrDecodeError$5(sqlOperation, decodeOperation, correlat
16039
16059
  cause
16040
16060
  });
16041
16061
  }
16042
- const make$109 = Effect.gen(function* () {
16062
+ const make$110 = Effect.gen(function* () {
16043
16063
  const sql = yield* SqlClient.SqlClient;
16044
16064
  const createPairingLinkRow = SqlSchema.void({
16045
16065
  Request: CreateAuthPairingLinkInput,
@@ -16174,7 +16194,7 @@ const make$109 = Effect.gen(function* () {
16174
16194
  getByCredential
16175
16195
  };
16176
16196
  });
16177
- const layer$112 = Layer.effect(AuthPairingLinkRepository, make$109);
16197
+ const layer$113 = Layer.effect(AuthPairingLinkRepository, make$110);
16178
16198
  //#endregion
16179
16199
  //#region src/auth/PairingGrantStore.ts
16180
16200
  var UnknownBootstrapCredentialError = class extends Schema$1.TaggedErrorClass()("UnknownBootstrapCredentialError", {}) {
@@ -16269,7 +16289,7 @@ const DEV_STARTUP_TTL_HOURS = Duration.hours(24);
16269
16289
  const PAIRING_TOKEN_ALPHABET = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
16270
16290
  const PAIRING_TOKEN_LENGTH = 12;
16271
16291
  const PAIRING_TOKEN_REJECTION_LIMIT = Math.floor(256 / 32) * 32;
16272
- const make$108 = Effect.gen(function* () {
16292
+ const make$109 = Effect.gen(function* () {
16273
16293
  const crypto = yield* Crypto.Crypto;
16274
16294
  const config = yield* ServerConfig$1;
16275
16295
  const pairingLinks = yield* AuthPairingLinkRepository;
@@ -16467,7 +16487,7 @@ const make$108 = Effect.gen(function* () {
16467
16487
  consume
16468
16488
  });
16469
16489
  });
16470
- const layer$111 = Layer.effect(PairingGrantStore, make$108).pipe(Layer.provideMerge(layer$112));
16490
+ const layer$112 = Layer.effect(PairingGrantStore, make$109).pipe(Layer.provideMerge(layer$113));
16471
16491
  //#endregion
16472
16492
  //#region src/persistence/DatabaseSnapshot.ts
16473
16493
  /**
@@ -16599,6 +16619,11 @@ const discardDatabaseSnapshot = Effect.fn("discardDatabaseSnapshot")(function* (
16599
16619
  yield* fs.remove(paths.stagingPath, { force: true });
16600
16620
  });
16601
16621
  //#endregion
16622
+ //#region src/persistence/Migrations/059_FusionReviewExperiment.ts
16623
+ var _059_FusionReviewExperiment_default = Effect.gen(function* () {
16624
+ yield* (yield* SqlClient.SqlClient)`ALTER TABLE thread_pairs ADD COLUMN review_experiment_json TEXT`;
16625
+ });
16626
+ //#endregion
16602
16627
  //#region src/persistence/Migrations/001_OrchestrationEvents.ts
16603
16628
  var _001_OrchestrationEvents_default = Effect.gen(function* () {
16604
16629
  const sql = yield* SqlClient.SqlClient;
@@ -18770,6 +18795,11 @@ const migrationEntries = [
18770
18795
  58,
18771
18796
  "HubActivityOutbound",
18772
18797
  _058_HubActivityOutbound_default
18798
+ ],
18799
+ [
18800
+ 59,
18801
+ "FusionReviewExperiment",
18802
+ _059_FusionReviewExperiment_default
18773
18803
  ]
18774
18804
  ];
18775
18805
  const makeMigrationLoader = (throughId) => Migrator.fromRecord(Object.fromEntries(migrationEntries.filter(([id]) => throughId === void 0 || id <= throughId).map(([id, name, migration]) => [`${id}_${name}`, migration])));
@@ -19798,7 +19828,7 @@ function parseBearerToken(request) {
19798
19828
  const token = header.slice(7).trim();
19799
19829
  return token.length > 0 ? token : null;
19800
19830
  }
19801
- const make$107 = Effect.gen(function* () {
19831
+ const make$108 = Effect.gen(function* () {
19802
19832
  const policy = yield* EnvironmentAuthPolicy;
19803
19833
  const bootstrapCredentials = yield* PairingGrantStore;
19804
19834
  const sessions = yield* SessionStore;
@@ -19993,9 +20023,9 @@ const make$107 = Effect.gen(function* () {
19993
20023
  issueStartupPairingUrl
19994
20024
  });
19995
20025
  });
19996
- const layer$110 = Layer.effect(EnvironmentAuth, make$107).pipe(Layer.provideMerge(layer$111), Layer.provideMerge(layer$113), Layer.provideMerge(layer$116));
19997
- const storageLayer = Layer.mergeAll(layer$114, layerConfig);
19998
- const runtimeLayer = layer$110.pipe(Layer.provideMerge(storageLayer));
20026
+ const layer$111 = Layer.effect(EnvironmentAuth, make$108).pipe(Layer.provideMerge(layer$112), Layer.provideMerge(layer$114), Layer.provideMerge(layer$117));
20027
+ const storageLayer = Layer.mergeAll(layer$115, layerConfig);
20028
+ const runtimeLayer = layer$111.pipe(Layer.provideMerge(storageLayer));
19999
20029
  //#endregion
20000
20030
  //#region ../../packages/shared/src/Struct.ts
20001
20031
  function deepMerge(current, patch) {
@@ -21843,7 +21873,7 @@ const runWithEnvironmentAuth = (flags, run, options) => Effect.gen(function* ()
21843
21873
  }
21844
21874
  return yield* Effect.gen(function* () {
21845
21875
  return yield* run(yield* EnvironmentAuth);
21846
- }).pipe(Effect.provide(Layer.mergeAll(runtimeLayer).pipe(Layer.provide(layer$117(config)), Layer.provide(Layer.succeed(References.MinimumLogLevel, minimumLogLevel)))));
21876
+ }).pipe(Effect.provide(Layer.mergeAll(runtimeLayer).pipe(Layer.provide(layer$118(config)), Layer.provide(Layer.succeed(References.MinimumLogLevel, minimumLogLevel)))));
21847
21877
  });
21848
21878
  const ttlFlag = Flag.string("ttl").pipe(Flag.withSchema(DurationFromString), Flag.withDescription("TTL, for example `5m`, `1h`, `30d`, or `15 minutes`."), Flag.optional);
21849
21879
  const jsonFlag = Flag.boolean("json").pipe(Flag.withDescription("Emit JSON instead of human-readable output."), Flag.withDefault(false));
@@ -21989,7 +22019,7 @@ const DEFAULT_LIMITS = {
21989
22019
  windowMillis: FAILURE_WINDOW_MS$1,
21990
22020
  blockMillis: BLOCK_DURATION_MS
21991
22021
  };
21992
- const make$106 = Effect.fn("HubAuthThrottle.make")(function* (limits = DEFAULT_LIMITS) {
22022
+ const make$107 = Effect.fn("HubAuthThrottle.make")(function* (limits = DEFAULT_LIMITS) {
21993
22023
  const state = yield* Ref.make(initialThrottleState);
21994
22024
  return HubAuthThrottle.of({
21995
22025
  shouldRefuse: Effect.gen(function* () {
@@ -22003,7 +22033,7 @@ const make$106 = Effect.fn("HubAuthThrottle.make")(function* (limits = DEFAULT_L
22003
22033
  })
22004
22034
  });
22005
22035
  });
22006
- const layer$109 = Layer.effect(HubAuthThrottle, make$106());
22036
+ const layer$110 = Layer.effect(HubAuthThrottle, make$107());
22007
22037
  //#endregion
22008
22038
  //#region src/hub/HubAuth.ts
22009
22039
  /**
@@ -22771,7 +22801,7 @@ const TaskRepositoryLive = Layer.effect(TaskRepository, makeTaskRepository);
22771
22801
  //#region src/hub/HubClientRevocations.ts
22772
22802
  var HubClientRevocations = class extends Context.Service()("@p4code/cli/hub/HubClientRevocations") {};
22773
22803
  /** Coalesced invalidations carry no identity or credential; consumers recheck durable state. */
22774
- const layer$108 = Layer.effect(HubClientRevocations, Effect.gen(function* () {
22804
+ const layer$109 = Layer.effect(HubClientRevocations, Effect.gen(function* () {
22775
22805
  const changes = yield* PubSub.sliding(1);
22776
22806
  yield* Effect.addFinalizer(() => PubSub.shutdown(changes));
22777
22807
  return HubClientRevocations.of({
@@ -23009,7 +23039,7 @@ const hubClientPreflight = Effect.gen(function* () {
23009
23039
  }
23010
23040
  });
23011
23041
  });
23012
- const layer$107 = Layer.mergeAll(Layer.empty, ...Object.keys(CLIENT_ROUTES).map((path) => HttpRouter.add("OPTIONS", path, hubClientPreflight)));
23042
+ const layer$108 = Layer.mergeAll(Layer.empty, ...Object.keys(CLIENT_ROUTES).map((path) => HttpRouter.add("OPTIONS", path, hubClientPreflight)));
23013
23043
  const HUB_TUNNEL_MAX_FRAME_PAYLOAD_BYTES = 64 * 1024;
23014
23044
  const HUB_TUNNEL_MAX_MESSAGE_BYTES = 128 * 1024 * 1024;
23015
23045
  const HUB_TUNNEL_FRAME_MAGIC = 1345606705;
@@ -23296,7 +23326,7 @@ var HubTunnelConnectorBudget = class {
23296
23326
  const HUB_TUNNEL_RETIRE_TIMEOUT_MS = 1e4;
23297
23327
  var HubTunnelUnavailable = class extends Data.TaggedError("HubTunnelUnavailable") {};
23298
23328
  var HubTunnelRegistry = class extends Context.Service()("@p4code/cli/hub/HubTunnelRegistry") {};
23299
- const layer$106 = Layer.effect(HubTunnelRegistry, Effect.gen(function* () {
23329
+ const layer$107 = Layer.effect(HubTunnelRegistry, Effect.gen(function* () {
23300
23330
  const config = yield* HubConfig;
23301
23331
  const lock = yield* Semaphore.make(1);
23302
23332
  const entries = /* @__PURE__ */ new Map();
@@ -23549,7 +23579,7 @@ const makeHubClientSocketTickets = Effect.gen(function* () {
23549
23579
  };
23550
23580
  });
23551
23581
  var HubClientSocketTickets = class extends Context.Service()("@p4code/cli/hub/HubClientSocketTickets") {};
23552
- const layer$105 = Layer.effect(HubClientSocketTickets, makeHubClientSocketTickets);
23582
+ const layer$106 = Layer.effect(HubClientSocketTickets, makeHubClientSocketTickets);
23553
23583
  //#endregion
23554
23584
  //#region src/hub/HubClientLease.ts
23555
23585
  /** Other Hub processes sharing the database are observed within this interval. */
@@ -23705,7 +23735,7 @@ const socketTicket = handle$1(Effect.gen(function* () {
23705
23735
  }
23706
23736
  }));
23707
23737
  }), "client-route");
23708
- const layer$104 = Layer.mergeAll(layer$107, HttpRouter.add("POST", "/v1/clients/me/socket-ticket", withHubClientCors(socketTicket)), HttpRouter.add("POST", "/v1/client-enrollments", issue$1), HttpRouter.add("POST", "/v1/client-enrollments/exchange", withHubClientCors(exchange$1)), HttpRouter.add("GET", "/v1/clients/me", withHubClientCors(identity$2)), HttpRouter.add("GET", "/v1/clients/me/events", withHubClientCors(events)), HttpRouter.add("DELETE", "/v1/clients/me", withHubClientCors(signOut)), HttpRouter.add("POST", "/v1/clients/revoke", revoke));
23738
+ const layer$105 = Layer.mergeAll(layer$108, HttpRouter.add("POST", "/v1/clients/me/socket-ticket", withHubClientCors(socketTicket)), HttpRouter.add("POST", "/v1/client-enrollments", issue$1), HttpRouter.add("POST", "/v1/client-enrollments/exchange", withHubClientCors(exchange$1)), HttpRouter.add("GET", "/v1/clients/me", withHubClientCors(identity$2)), HttpRouter.add("GET", "/v1/clients/me/events", withHubClientCors(events)), HttpRouter.add("DELETE", "/v1/clients/me", withHubClientCors(signOut)), HttpRouter.add("POST", "/v1/clients/revoke", revoke));
23709
23739
  //#endregion
23710
23740
  //#region src/hub/HubPushTokenProtection.ts
23711
23741
  const KEY_NAME = "hub-push-token-encryption-v1";
@@ -23985,12 +24015,12 @@ const persistHubAgentActivity = Effect.fn("HubNotificationActivity.persist")(fun
23985
24015
  var HubSecretStoreUnavailable = class extends Data.TaggedError("HubSecretStoreUnavailable") {};
23986
24016
  const HUB_SECRETS_SUFFIX = ".secrets";
23987
24017
  /** Dedicated sibling directory per Hub database; no environment configuration is consulted. */
23988
- const make$105 = Effect.gen(function* () {
24018
+ const make$106 = Effect.gen(function* () {
23989
24019
  const config = yield* HubConfig;
23990
24020
  if (!(yield* Path$1.Path).isAbsolute(config.dbPath)) return yield* Effect.fail(new HubSecretStoreUnavailable({ message: "Hub secret storage requires an absolute database path." }));
23991
24021
  return yield* makeForDirectory(`${config.dbPath}${HUB_SECRETS_SUFFIX}`);
23992
24022
  });
23993
- const layer$103 = Layer.effect(ServerSecretStore, make$105);
24023
+ const layer$104 = Layer.effect(ServerSecretStore, make$106);
23994
24024
  //#endregion
23995
24025
  //#region src/hub/HubNotificationRoutes.ts
23996
24026
  const MAX_NOTIFICATION_BODY_BYTES = 16 * 1024;
@@ -24034,7 +24064,7 @@ const makeRoutes = Effect.gen(function* () {
24034
24064
  }))));
24035
24065
  });
24036
24066
  /** Launch-only composition: isolated Hub HTTP tests need no filesystem credential store. */
24037
- const layer$102 = Layer.unwrap(makeRoutes).pipe(Layer.provide(layer$103));
24067
+ const layer$103 = Layer.unwrap(makeRoutes).pipe(Layer.provide(layer$104));
24038
24068
  //#endregion
24039
24069
  //#region src/hub/HubApnsCredentials.ts
24040
24070
  const HUB_APNS_CREDENTIAL_SECRET = "hub-apns-credentials-v1";
@@ -24777,10 +24807,10 @@ const makeHubNotificationProvider = Effect.fn("HubNotificationRuntime.provider")
24777
24807
  });
24778
24808
  });
24779
24809
  const runHubNotificationSchedule = (batch) => batch.pipe(Effect.asVoid, Effect.catch(() => Effect.logWarning("Hub notification delivery unavailable.")), Effect.repeat(Schedule.spaced(Duration.millis(HUB_NOTIFICATION_INTERVAL_MS))));
24780
- const layer$101 = Layer.effectDiscard(Effect.gen(function* () {
24810
+ const layer$102 = Layer.effectDiscard(Effect.gen(function* () {
24781
24811
  const batch = yield* makeHubNotificationDelivery(yield* makeHubNotificationProvider());
24782
24812
  yield* runHubNotificationSchedule(batch()).pipe(Effect.forkScoped);
24783
- })).pipe(Layer.provide(layer$103));
24813
+ })).pipe(Layer.provide(layer$104));
24784
24814
  const HUB_RETIREMENT_TIMEOUT_MS = 1e4;
24785
24815
  const HUB_RETIREMENT_CLAIM_MS = 3e4;
24786
24816
  const HUB_RETIREMENT_TTL_MS = 1440 * 60 * 1e3;
@@ -24947,10 +24977,10 @@ const HUB_RETIREMENT_INTERVAL_MS = 5e3;
24947
24977
  /** One bounded batch per tick; persisted due times control retries, never an in-memory retry loop. */
24948
24978
  const runHubRetirementSchedule = (batch) => batch.pipe(Effect.asVoid, Effect.catch(() => Effect.logWarning("Hub retirement delivery unavailable.")), Effect.repeat(Schedule.spaced(Duration.millis(HUB_RETIREMENT_INTERVAL_MS))));
24949
24979
  /** Secret store remains private to notification runtime rather than becoming a general Hub dependency. */
24950
- const layer$100 = Layer.effectDiscard(Effect.gen(function* () {
24980
+ const layer$101 = Layer.effectDiscard(Effect.gen(function* () {
24951
24981
  const batch = yield* makeHubPushRetirementDelivery(yield* makeHubRetirementProvider());
24952
24982
  yield* runHubRetirementSchedule(batch()).pipe(Effect.forkScoped);
24953
- })).pipe(Layer.provide(layer$103));
24983
+ })).pipe(Layer.provide(layer$104));
24954
24984
  /** One bounded keyset page; callers resume the receipt and restart from null after a full sweep. */
24955
24985
  const reconcileHubPushRegistrations = Effect.fn("HubPushReconciliation.page")(function* (afterClientId = null) {
24956
24986
  const sql = yield* SqlClient.SqlClient;
@@ -24993,7 +25023,7 @@ const sweepHubPushRegistrations = Effect.fn("HubPushReconciliation.sweep")(funct
24993
25023
  };
24994
25024
  });
24995
25025
  /** Scoped schedule prevents overlapping sweeps and cancels both page work and waiting on shutdown. */
24996
- const layer$99 = Layer.effectDiscard(Effect.gen(function* () {
25026
+ const layer$100 = Layer.effectDiscard(Effect.gen(function* () {
24997
25027
  yield* sweepHubPushRegistrations(reconcileHubPushRegistrations).pipe(Effect.catch(() => Effect.logWarning("Hub notification reconciliation unavailable.")), Effect.repeat(Schedule.spaced(Duration.millis(HUB_PUSH_RECONCILIATION_INTERVAL_MS))), Effect.forkScoped);
24998
25028
  }));
24999
25029
  //#endregion
@@ -25024,7 +25054,7 @@ const hubMdxHost = Effect.gen(function* () {
25024
25054
  }
25025
25055
  });
25026
25056
  }).pipe(Effect.catch(() => Effect.succeed(HttpServerResponse.empty({ status: 503 }))));
25027
- const layer$98 = Layer.mergeAll(HttpRouter.add("GET", "/mdx-host.html", hubMdxHost), HttpRouter.add("GET", "/mdx-jsx-runtime.js", hubMdxHost), HttpRouter.add("GET", "/assets/:file", hubMdxHost));
25057
+ const layer$99 = Layer.mergeAll(HttpRouter.add("GET", "/mdx-host.html", hubMdxHost), HttpRouter.add("GET", "/mdx-jsx-runtime.js", hubMdxHost), HttpRouter.add("GET", "/assets/:file", hubMdxHost));
25028
25058
  //#endregion
25029
25059
  //#region ../../packages/shared/src/hubAssetGrant.ts
25030
25060
  /** Managed assets retain the environment's signed grant root for relative preview resources. */
@@ -25109,7 +25139,7 @@ const makeHubClientAssetGrants = Effect.gen(function* () {
25109
25139
  };
25110
25140
  });
25111
25141
  var HubClientAssetGrants = class extends Context.Service()("@p4code/cli/hub/HubClientAssetGrants") {};
25112
- const layer$97 = Layer.effect(HubClientAssetGrants, makeHubClientAssetGrants);
25142
+ const layer$98 = Layer.effect(HubClientAssetGrants, makeHubClientAssetGrants);
25113
25143
  //#endregion
25114
25144
  //#region src/hub/HubTunnelHttpRequestProducer.ts
25115
25145
  /** Consumes the ingress request lazily under its stream producer; transport admission owns frame copies. */
@@ -25411,7 +25441,7 @@ const writeHubTunnelNativeResponse = Effect.fn("HubTunnelNativeResponse.write")(
25411
25441
  //#region src/hub/HubTunnelPublished.ts
25412
25442
  const MAX_STREAM_ID$1 = 4294967295;
25413
25443
  var HubTunnelPublished = class extends Context.Service()("@p4code/cli/hub/HubTunnelPublished") {};
25414
- const layer$96 = Layer.effect(HubTunnelPublished, Effect.gen(function* () {
25444
+ const layer$97 = Layer.effect(HubTunnelPublished, Effect.gen(function* () {
25415
25445
  const registry = yield* HubTunnelRegistry;
25416
25446
  const entries = /* @__PURE__ */ new Map();
25417
25447
  const current = (lease) => Effect.gen(function* () {
@@ -25597,7 +25627,7 @@ const hubTunnelHttpRoute = Effect.gen(function* () {
25597
25627
  const response = yield* authenticatedRoute;
25598
25628
  return HttpServerResponse.setHeaders(response, cors);
25599
25629
  });
25600
- const layer$95 = HttpRouter.add("*", `${HUB_TUNNEL_HTTP_PATH}/*`, hubTunnelHttpRoute);
25630
+ const layer$96 = HttpRouter.add("*", `${HUB_TUNNEL_HTTP_PATH}/*`, hubTunnelHttpRoute);
25601
25631
  //#endregion
25602
25632
  //#region src/hub/HubAssetRoutes.ts
25603
25633
  const MAX_GRANT_BODY_BYTES = 8192;
@@ -25657,7 +25687,7 @@ const hubAssetRoute = Effect.gen(function* () {
25657
25687
  }
25658
25688
  }))));
25659
25689
  });
25660
- const layer$94 = Layer.mergeAll(HttpRouter.add("POST", "/v1/clients/me/asset-grant", issue), HttpRouter.add("*", `${HUB_ASSET_PATH}/*`, hubAssetRoute));
25690
+ const layer$95 = Layer.mergeAll(HttpRouter.add("POST", "/v1/clients/me/asset-grant", issue), HttpRouter.add("*", `${HUB_ASSET_PATH}/*`, hubAssetRoute));
25661
25691
  //#endregion
25662
25692
  //#region src/hub/HubComputerUseIdentity.ts
25663
25693
  /** A server identity is not a helper identity or a client pairing credential. */
@@ -25745,7 +25775,7 @@ const readBody = Effect.fn("hub.computerUse.readBody")(function* (request) {
25745
25775
  return (yield* request.stream.pipe(Stream.runFoldEffect(() => Buffer.alloc(0), (body, chunk) => body.byteLength + chunk.byteLength > MAX_REQUEST_BYTES$1 ? Effect.fail(new HubComputerUseRoutesFailure({ message: "Computer Use enrollment body exceeds limit" })) : Effect.succeed(Buffer.concat([body, chunk]))))).toString("utf8");
25746
25776
  });
25747
25777
  /** Server-to-server delegation only. A Hub identity does not authenticate an ordinary environment client. */
25748
- const layer$93 = Layer.unwrap(Effect.gen(function* () {
25778
+ const layer$94 = Layer.unwrap(Effect.gen(function* () {
25749
25779
  const enrollments = makeHubComputerUseEnrollments(yield* HubConfig);
25750
25780
  const handle = Effect.fn("hub.computerUse.handle")(function* (operation) {
25751
25781
  const environmentId = yield* authenticateHubComputerUseServer();
@@ -26554,7 +26584,7 @@ const hubTunnelConnectorRoute = Effect.gen(function* () {
26554
26584
  status: 503,
26555
26585
  headers: { "cache-control": "no-store" }
26556
26586
  }))));
26557
- const layer$92 = HttpRouter.add("GET", HUB_TUNNEL_CONNECTOR_PATH, hubTunnelConnectorRoute);
26587
+ const layer$93 = HttpRouter.add("GET", HUB_TUNNEL_CONNECTOR_PATH, hubTunnelConnectorRoute);
26558
26588
  const TICKET_PATTERN = /^[a-f0-9]{64}$/;
26559
26589
  const MAX_TICKETED_URL_CHARS = 8512;
26560
26590
  /** Remove only Hub transport authentication; retain environment query bytes and order exactly. */
@@ -26745,7 +26775,7 @@ const hubTunnelClientSocketRoute = Effect.gen(function* () {
26745
26775
  }
26746
26776
  return unavailable$5();
26747
26777
  })));
26748
- const layer$91 = HttpRouter.add("GET", `${HUB_TUNNEL_CLIENT_SOCKET_PATH}/*`, hubTunnelClientSocketRoute);
26778
+ const layer$92 = HttpRouter.add("GET", `${HUB_TUNNEL_CLIENT_SOCKET_PATH}/*`, hubTunnelClientSocketRoute);
26749
26779
  //#endregion
26750
26780
  //#region src/hub/HubHttpServer.ts
26751
26781
  /**
@@ -27242,8 +27272,8 @@ const releaseFeedLeaseRoute = HttpRouter.add("DELETE", "/feed/lease", respondToH
27242
27272
  return HttpServerResponse.empty({ status: 204 });
27243
27273
  })));
27244
27274
  /** Provide around HttpRouter.serve so request fibers share these process-owned services. */
27245
- const routingServices = Layer.mergeAll(layer$108, layer$105, layer$97, layer$96).pipe(Layer.provideMerge(layer$106));
27246
- const layer$90 = Layer.mergeAll(layer$95, layer$94, layer$98, layer$92, layer$91, layer$104, layer$93, healthRoute, identityRoute, listTasksRoute, getTaskRoute, createTaskRoute, putTaskRoute, updateTaskRoute, deleteTaskRoute, listAssetsRoute, getAssetRoute, putAssetRoute, deleteAssetRoute, listFeedSourcesRoute, upsertFeedSourceRoute, deleteFeedSourceRoute, listFeedRoute, putFeedArticleRoute, putFeedEngagementRoute, markFeedReadRoute, cleanupFeedRoute, setFeedRefreshedAtRoute, acquireFeedLeaseRoute, renewFeedLeaseRoute, releaseFeedLeaseRoute).pipe(Layer.provideMerge(layer$108), Layer.provideMerge(layer$105), Layer.provideMerge(layer$97));
27275
+ const routingServices = Layer.mergeAll(layer$109, layer$106, layer$98, layer$97).pipe(Layer.provideMerge(layer$107));
27276
+ const layer$91 = Layer.mergeAll(layer$96, layer$95, layer$99, layer$93, layer$92, layer$105, layer$94, healthRoute, identityRoute, listTasksRoute, getTaskRoute, createTaskRoute, putTaskRoute, updateTaskRoute, deleteTaskRoute, listAssetsRoute, getAssetRoute, putAssetRoute, deleteAssetRoute, listFeedSourcesRoute, upsertFeedSourceRoute, deleteFeedSourceRoute, listFeedRoute, putFeedArticleRoute, putFeedEngagementRoute, markFeedReadRoute, cleanupFeedRoute, setFeedRefreshedAtRoute, acquireFeedLeaseRoute, renewFeedLeaseRoute, releaseFeedLeaseRoute).pipe(Layer.provideMerge(layer$109), Layer.provideMerge(layer$106), Layer.provideMerge(layer$98));
27247
27277
  //#endregion
27248
27278
  //#region src/hub/Migrations/001_Tasks.ts
27249
27279
  /**
@@ -27931,7 +27961,7 @@ const announce = Layer.effectDiscard(Effect.gen(function* () {
27931
27961
  });
27932
27962
  if (isRemoteReachableHost(config.host)) yield* Effect.logWarning("Hub is reachable beyond loopback. The bearer token is the only control — repeated auth failures are not rate limited.", { host: config.host });
27933
27963
  }));
27934
- const makeHubLayer = HttpRouter.serve(Layer.mergeAll(layer$90, layer$102)).pipe(Layer.provideMerge(routingServices), Layer.provideMerge(layer$100), Layer.provideMerge(layer$101), Layer.provideMerge(layer$99), Layer.provideMerge(announce), Layer.provideMerge(HubHttpServerLive), Layer.provideMerge(layer$109), Layer.provideMerge(TaskRepositoryLive), Layer.provideMerge(AgentAssetRepositoryLive), Layer.provideMerge(HubPersistenceLive));
27964
+ const makeHubLayer = HttpRouter.serve(Layer.mergeAll(layer$91, layer$103)).pipe(Layer.provideMerge(routingServices), Layer.provideMerge(layer$101), Layer.provideMerge(layer$102), Layer.provideMerge(layer$100), Layer.provideMerge(announce), Layer.provideMerge(HubHttpServerLive), Layer.provideMerge(layer$110), Layer.provideMerge(TaskRepositoryLive), Layer.provideMerge(AgentAssetRepositoryLive), Layer.provideMerge(HubPersistenceLive));
27935
27965
  const runHub = Layer.launch(makeHubLayer);
27936
27966
  //#endregion
27937
27967
  //#region src/atomicWrite.ts
@@ -28062,7 +28092,7 @@ function stripDefaultServerSettings(current, defaults) {
28062
28092
  }
28063
28093
  return Object.is(current, defaults) ? void 0 : current;
28064
28094
  }
28065
- const make$104 = Effect.gen(function* () {
28095
+ const make$105 = Effect.gen(function* () {
28066
28096
  const { settingsPath } = yield* ServerConfig$1;
28067
28097
  const fs = yield* FileSystem.FileSystem;
28068
28098
  const pathService = yield* Path$1.Path;
@@ -28284,7 +28314,7 @@ const make$104 = Effect.gen(function* () {
28284
28314
  }
28285
28315
  };
28286
28316
  });
28287
- const layer$89 = Layer.effect(ServerSettingsService, make$104);
28317
+ const layer$90 = Layer.effect(ServerSettingsService, make$105);
28288
28318
  //#endregion
28289
28319
  //#region src/pathExpansion.ts
28290
28320
  /**
@@ -28946,7 +28976,7 @@ function claudeEntryFromRegistration(registration) {
28946
28976
  };
28947
28977
  }
28948
28978
  var ClaudeMcpFiles = class extends Context.Service()("@p4code/cli/mcp/ClaudeMcpFiles") {};
28949
- const make$103 = Effect.gen(function* () {
28979
+ const make$104 = Effect.gen(function* () {
28950
28980
  const fileSystem = yield* FileSystem.FileSystem;
28951
28981
  const path = yield* Path$1.Path;
28952
28982
  const services = yield* Effect.context();
@@ -29013,7 +29043,7 @@ const make$103 = Effect.gen(function* () {
29013
29043
  removeProject: (projectDir, name) => removeAt(Effect.succeed(projectFile(projectDir)))(name)
29014
29044
  };
29015
29045
  });
29016
- const layer$88 = Layer.effect(ClaudeMcpFiles, make$103);
29046
+ const layer$89 = Layer.effect(ClaudeMcpFiles, make$104);
29017
29047
  Layer.succeed(ClaudeMcpFiles, {
29018
29048
  readUser: Effect.succeed([]),
29019
29049
  readUserAt: () => Effect.succeed([]),
@@ -29151,7 +29181,7 @@ const decodeClientRegistration = Schema$1.decodeUnknownExit(ClientRegistrationRe
29151
29181
  const decodeTokenResponse = Schema$1.decodeUnknownExit(TokenResponse);
29152
29182
  var McpOAuth = class extends Context.Service()("@p4code/cli/mcp/McpOAuth") {};
29153
29183
  const registryError = (detail) => new McpRegistryError({ detail });
29154
- const make$102 = Effect.gen(function* () {
29184
+ const make$103 = Effect.gen(function* () {
29155
29185
  const config = yield* ServerConfig$1;
29156
29186
  const secrets = yield* ServerSecretStore;
29157
29187
  const http = yield* HttpClient.HttpClient;
@@ -29471,7 +29501,7 @@ const make$102 = Effect.gen(function* () {
29471
29501
  accessTokenFor
29472
29502
  };
29473
29503
  });
29474
- const layer$87 = Layer.effect(McpOAuth, make$102);
29504
+ const layer$88 = Layer.effect(McpOAuth, make$103);
29475
29505
  Layer.succeed(McpOAuth, {
29476
29506
  statusFor: () => Effect.succeed(Option.none()),
29477
29507
  begin: () => Effect.fail(new McpRegistryError({ detail: "OAuth sign-in is not available." })),
@@ -29489,7 +29519,7 @@ const decodeRegistration$1 = Schema$1.decodeUnknownExit(RegistrationFromJson$1);
29489
29519
  const encodeRegistration = Schema$1.encodeSync(RegistrationFromJson$1);
29490
29520
  var McpRegistry = class extends Context.Service()("@p4code/cli/mcp/McpRegistry") {};
29491
29521
  const slotsOf = (registration) => registration.secrets ?? [];
29492
- const make$101 = Effect.gen(function* () {
29522
+ const make$102 = Effect.gen(function* () {
29493
29523
  const config = yield* ServerConfig$1;
29494
29524
  const secrets = yield* ServerSecretStore;
29495
29525
  const oauth = yield* McpOAuth;
@@ -29663,7 +29693,7 @@ const make$101 = Effect.gen(function* () {
29663
29693
  resolveForSessionAtClaudeUserConfigPath
29664
29694
  };
29665
29695
  });
29666
- const layer$86 = Layer.effect(McpRegistry, make$101);
29696
+ const layer$87 = Layer.effect(McpRegistry, make$102);
29667
29697
  //#endregion
29668
29698
  //#region src/sync/skillDirectory.ts
29669
29699
  /**
@@ -30042,7 +30072,7 @@ const formatHubLink = (input) => encodeStoredHubLink({
30042
30072
  shareMode: input.shareMode
30043
30073
  });
30044
30074
  const fromEnvironment = (environment) => validateHubLink(environment.P4CODE_HUB_URL ?? "", environment.P4CODE_HUB_TOKEN ?? "");
30045
- const make$100 = Effect.fn("HubLink.make")(function* (environment) {
30075
+ const make$101 = Effect.fn("HubLink.make")(function* (environment) {
30046
30076
  const secrets = yield* ServerSecretStore;
30047
30077
  const env = environment ?? process.env;
30048
30078
  const fromEnv = fromEnvironment(env);
@@ -30115,7 +30145,7 @@ const make$100 = Effect.fn("HubLink.make")(function* (environment) {
30115
30145
  })
30116
30146
  };
30117
30147
  });
30118
- const layer$85 = Layer.effect(HubLink, make$100());
30148
+ const layer$86 = Layer.effect(HubLink, make$101());
30119
30149
  //#endregion
30120
30150
  //#region src/sync/HubAssetClient.ts
30121
30151
  /**
@@ -30148,7 +30178,7 @@ const decodeAssetListPage = Schema$1.decodeUnknownEffect(AssetListPage);
30148
30178
  const decodeConflictBody$1 = Schema$1.decodeUnknownEffect(ConflictBody$1);
30149
30179
  const decodeAsset = Schema$1.decodeUnknownEffect(AgentAsset);
30150
30180
  var HubAssetClient = class extends Context.Service()("@p4code/cli/sync/HubAssetClient") {};
30151
- const make$99 = Effect.gen(function* () {
30181
+ const make$100 = Effect.gen(function* () {
30152
30182
  const http = yield* HttpClient.HttpClient;
30153
30183
  const link = yield* HubLink;
30154
30184
  const requireSettings = Effect.gen(function* () {
@@ -30230,7 +30260,7 @@ const make$99 = Effect.gen(function* () {
30230
30260
  remove
30231
30261
  };
30232
30262
  });
30233
- const layer$84 = Layer.effect(HubAssetClient, make$99);
30263
+ const layer$85 = Layer.effect(HubAssetClient, make$100);
30234
30264
  //#endregion
30235
30265
  //#region src/sync/mcpRegistrationFiles.ts
30236
30266
  /**
@@ -31146,7 +31176,7 @@ const EMPTY_REPORT = {
31146
31176
  unavailable: null
31147
31177
  };
31148
31178
  var AssetSync = class extends Context.Service()("@p4code/cli/sync/AssetSync") {};
31149
- const make$98 = Effect.gen(function* () {
31179
+ const make$99 = Effect.gen(function* () {
31150
31180
  const client = yield* HubAssetClient;
31151
31181
  const link = yield* HubLink;
31152
31182
  const settingsStore = yield* ServerSettingsService;
@@ -31992,7 +32022,7 @@ const make$98 = Effect.gen(function* () {
31992
32022
  removeLocal
31993
32023
  };
31994
32024
  });
31995
- const layer$83 = Layer.effect(AssetSync, make$98);
32025
+ const layer$84 = Layer.effect(AssetSync, make$99);
31996
32026
  //#endregion
31997
32027
  //#region src/provider/CompressPrompts.ts
31998
32028
  /**
@@ -32345,7 +32375,7 @@ const findAgentPreset = (requested) => {
32345
32375
  };
32346
32376
  //#endregion
32347
32377
  //#region src/cli/assets.ts
32348
- const SyncServicesLive = layer$83.pipe(Layer.provideMerge(layer$84), Layer.provideMerge(layer$85), Layer.provideMerge(layer$89.pipe(Layer.provide(layer$114))), Layer.provideMerge(layer$114), Layer.provideMerge(FetchHttpClient.layer));
32378
+ const SyncServicesLive = layer$84.pipe(Layer.provideMerge(layer$85), Layer.provideMerge(layer$86), Layer.provideMerge(layer$90.pipe(Layer.provide(layer$115))), Layer.provideMerge(layer$115), Layer.provideMerge(FetchHttpClient.layer));
32349
32379
  const runWithSync = (flags, run) => Effect.gen(function* () {
32350
32380
  const config = yield* resolveCliAuthConfig(flags, yield* GlobalFlag.LogLevel);
32351
32381
  return yield* Effect.gen(function* () {
@@ -32353,7 +32383,7 @@ const runWithSync = (flags, run) => Effect.gen(function* () {
32353
32383
  sync: yield* AssetSync,
32354
32384
  link: yield* HubLink
32355
32385
  });
32356
- }).pipe(Effect.provide(SyncServicesLive.pipe(Layer.provide(layer$117(config)), Layer.provide(Layer.succeed(References.MinimumLogLevel, "Error")))));
32386
+ }).pipe(Effect.provide(SyncServicesLive.pipe(Layer.provide(layer$118(config)), Layer.provide(Layer.succeed(References.MinimumLogLevel, "Error")))));
32357
32387
  });
32358
32388
  const STATE_LABEL = {
32359
32389
  synced: "synced",
@@ -33381,7 +33411,7 @@ const TERMINAL_STATUSES = /* @__PURE__ */ new Set([
33381
33411
  "interrupted"
33382
33412
  ]);
33383
33413
  var ThreadBackgroundLivenessService = class extends Context.Service()("@p4code/cli/orchestration/ThreadBackgroundLiveness/ThreadBackgroundLivenessService") {};
33384
- function make$97() {
33414
+ function make$98() {
33385
33415
  const stateByThreadId = /* @__PURE__ */ new Map();
33386
33416
  const stateFor = (threadId) => {
33387
33417
  const existing = stateByThreadId.get(threadId);
@@ -33437,7 +33467,7 @@ function make$97() {
33437
33467
  }
33438
33468
  };
33439
33469
  }
33440
- const layer$82 = Layer.effect(ThreadBackgroundLivenessService, Effect.sync(make$97));
33470
+ const layer$83 = Layer.effect(ThreadBackgroundLivenessService, Effect.sync(make$98));
33441
33471
  //#endregion
33442
33472
  //#region ../../packages/shared/src/sourceControl.ts
33443
33473
  const GITHUB_CHANGE_REQUEST_PRESENTATION = {
@@ -33811,6 +33841,55 @@ function completionAfterEvent(thread, event) {
33811
33841
  }
33812
33842
  }
33813
33843
  //#endregion
33844
+ //#region src/orchestration/fusionReviewPolicy.ts
33845
+ function fusionBudgetAction(pair, threadId, text) {
33846
+ if (threadId === pair.watcherThreadId && (text.startsWith("[fusion-review]") || text.startsWith("[fusion-gate]"))) return "review";
33847
+ if (threadId === pair.implementerThreadId && text.startsWith("[fusion-advice]")) return "correction";
33848
+ if ([
33849
+ "[fusion-activation]",
33850
+ "[fusion-advice]",
33851
+ "[fusion-gate]",
33852
+ "[fusion-review]"
33853
+ ].some((prefix) => text.startsWith(prefix))) return "protocol";
33854
+ return "human";
33855
+ }
33856
+ function advanceFusionBudget(pair, threadId, text, sequence, commandId = "client") {
33857
+ if (!pair.reviewExperiment || pair.detachedAt !== null || sequence <= (pair.reviewExperiment.lastMessageSequence ?? 0)) return pair.reviewExperiment;
33858
+ const experiment = {
33859
+ ...pair.reviewExperiment,
33860
+ lastMessageSequence: sequence
33861
+ };
33862
+ switch (fusionBudgetAction(pair, threadId, text)) {
33863
+ case "review": return {
33864
+ ...experiment,
33865
+ automaticReviews: experiment.automaticReviews + 1
33866
+ };
33867
+ case "correction": return experiment.automaticReviews === 0 ? experiment : {
33868
+ ...experiment,
33869
+ correctionRounds: experiment.correctionRounds + 1
33870
+ };
33871
+ case "human":
33872
+ if (commandId === null || [
33873
+ "server:",
33874
+ "provider:",
33875
+ "scheduled-task:"
33876
+ ].some((prefix) => commandId.startsWith(prefix))) return experiment;
33877
+ return {
33878
+ ...experiment,
33879
+ automaticReviews: 0,
33880
+ correctionRounds: 0
33881
+ };
33882
+ case "protocol": return experiment;
33883
+ }
33884
+ }
33885
+ function fusionBudgetBlock(pair, threadId, text) {
33886
+ const experiment = pair.reviewExperiment;
33887
+ if (!experiment || pair.detachedAt !== null) return void 0;
33888
+ const action = fusionBudgetAction(pair, threadId, text);
33889
+ if (action === "review" && experiment.automaticReviews >= experiment.policy.maxAutomaticReviews) return `Automatic review limit (${experiment.policy.maxAutomaticReviews}) reached. Work remains unapproved; send a new instruction to either thread to resume.`;
33890
+ if (action === "correction" && experiment.automaticReviews > 0 && (experiment.correctionRounds >= experiment.policy.maxCorrectionRounds || experiment.automaticReviews >= experiment.policy.maxAutomaticReviews)) return "Correction budget exhausted or no review remains for another correction. Work remains unapproved; send a new instruction to either thread to resume.";
33891
+ }
33892
+ //#endregion
33814
33893
  //#region src/attachmentPaths.ts
33815
33894
  function normalizeAttachmentRelativePath(rawRelativePath) {
33816
33895
  const normalized = NodePath.normalize(rawRelativePath).replace(/^[/\\]+/, "");
@@ -34243,6 +34322,11 @@ function projectEvent(model, event) {
34243
34322
  watcherThreadId: payload.watcherThreadId,
34244
34323
  lastReviewedImplementerSequence: payload.lastReviewedImplementerSequence,
34245
34324
  activationTurnId: payload.activationTurnId ?? null,
34325
+ ...payload.reviewPolicy ? { reviewExperiment: {
34326
+ policy: payload.reviewPolicy,
34327
+ automaticReviews: 0,
34328
+ correctionRounds: 0
34329
+ } } : {},
34246
34330
  roundCap: payload.roundCap ?? 2,
34247
34331
  gateTimeoutMs: payload.gateTimeoutMs ?? 12e4,
34248
34332
  activeGate: null,
@@ -34514,6 +34598,10 @@ function projectEvent(model, event) {
34514
34598
  } : entry) : [...thread.messages, message]).slice(-2e3);
34515
34599
  return {
34516
34600
  ...nextBase,
34601
+ threadPairs: payload.role === "user" ? (nextBase.threadPairs ?? []).map((pair) => pair.reviewExperiment && pair.detachedAt === null && (pair.implementerThreadId === payload.threadId || pair.watcherThreadId === payload.threadId) ? {
34602
+ ...pair,
34603
+ reviewExperiment: advanceFusionBudget(pair, payload.threadId, payload.text, event.sequence, event.commandId) ?? pair.reviewExperiment
34604
+ } : pair) : nextBase.threadPairs ?? [],
34517
34605
  threads: updateThread(nextBase.threads, payload.threadId, {
34518
34606
  messages: cappedMessages,
34519
34607
  updatedAt: event.occurredAt
@@ -35110,6 +35198,7 @@ const decideCommand = Effect.fn("decideCommand")(function* ({ command, readModel
35110
35198
  lastReviewedImplementerSequence: readModel.snapshotSequence,
35111
35199
  activationTurnId: implementer.latestTurn?.state === "running" ? implementer.latestTurn.turnId : null,
35112
35200
  ...command.continuationMessageId !== void 0 ? { continuationMessageId: command.continuationMessageId } : {},
35201
+ ...command.reviewPolicy !== void 0 ? { reviewPolicy: command.reviewPolicy } : {},
35113
35202
  ...command.roundCap !== void 0 ? { roundCap: command.roundCap } : {},
35114
35203
  ...command.gateTimeoutMs !== void 0 ? { gateTimeoutMs: command.gateTimeoutMs } : {},
35115
35204
  createdAt: command.createdAt
@@ -35898,7 +35987,13 @@ const decideCommand = Effect.fn("decideCommand")(function* ({ command, readModel
35898
35987
  command,
35899
35988
  threadId: command.threadId
35900
35989
  });
35901
- if (findActiveThreadPair(readModel, command.threadId)?.watcherThreadId === command.threadId && targetThread.interactionMode !== "default") return yield* decideCommandSequence({
35990
+ const activePair = findActiveThreadPair(readModel, command.threadId);
35991
+ const budgetBlock = activePair && fusionBudgetBlock(activePair, command.threadId, command.message.text);
35992
+ if (budgetBlock) return yield* new OrchestrationCommandInvariantError({
35993
+ commandType: command.type,
35994
+ detail: budgetBlock
35995
+ });
35996
+ if (activePair?.watcherThreadId === command.threadId && targetThread.interactionMode !== "default") return yield* decideCommandSequence({
35902
35997
  readModel,
35903
35998
  commands: [{
35904
35999
  type: "thread.interaction-mode.set",
@@ -36497,6 +36592,7 @@ function commandToAggregateRef(command) {
36497
36592
  }
36498
36593
  const makeOrchestrationEngine = Effect.gen(function* () {
36499
36594
  const sql = yield* SqlClient.SqlClient;
36595
+ const settingsService = yield* Effect.serviceOption(ServerSettingsService);
36500
36596
  const eventStore = yield* OrchestrationEventStore;
36501
36597
  const commandReceiptRepository = yield* OrchestrationCommandReceiptRepository;
36502
36598
  const projectionPipeline = yield* OrchestrationProjectionPipeline;
@@ -36548,8 +36644,19 @@ const makeOrchestrationEngine = Effect.gen(function* () {
36548
36644
  detail: existingReceipt.value.error ?? "Previously rejected."
36549
36645
  });
36550
36646
  }
36647
+ let command = envelope.command;
36648
+ if (command.type === "thread-pair.create" && command.reviewPolicy === void 0 && Option.isSome(settingsService)) {
36649
+ const settings = yield* settingsService.value.getSettings.pipe(Effect.mapError(() => new OrchestrationCommandInvariantError({
36650
+ commandType: "thread-pair.create",
36651
+ detail: "Could not read the review policy settings."
36652
+ })));
36653
+ command = {
36654
+ ...command,
36655
+ reviewPolicy: settings.fusionReviewPolicy
36656
+ };
36657
+ }
36551
36658
  const eventBase = yield* decideOrchestrationCommand({
36552
- command: envelope.command,
36659
+ command,
36553
36660
  readModel: commandReadModel,
36554
36661
  hasLiveBackgroundWork: "threadId" in envelope.command && backgroundLiveness.getThreadBackgroundLiveness(envelope.command.threadId) !== null
36555
36662
  }).pipe(Effect.provideService(Crypto.Crypto, crypto), Effect.mapError((cause) => isOrchestrationCommandInvariantError(cause) ? cause : new OrchestrationCommandInvariantError({
@@ -36653,7 +36760,7 @@ const makeOrchestrationEngine = Effect.gen(function* () {
36653
36760
  latestSequence: Effect.sync(() => commandReadModel.snapshotSequence)
36654
36761
  };
36655
36762
  });
36656
- const OrchestrationEngineLive = Layer.effect(OrchestrationEngineService, makeOrchestrationEngine).pipe(Layer.provide(layer$82));
36763
+ const OrchestrationEngineLive = Layer.effect(OrchestrationEngineService, makeOrchestrationEngine).pipe(Layer.provide(layer$83));
36657
36764
  //#endregion
36658
36765
  //#region src/persistence/Services/ProjectionPendingApprovals.ts
36659
36766
  /**
@@ -38132,6 +38239,8 @@ const ProjectionThreadRepositoryLive = Layer.effect(ProjectionThreadRepository,
38132
38239
  * Counted rather than flagged so a lost completion can only strand one task,
38133
38240
  * and read as a boolean by the shell.
38134
38241
  */
38242
+ const decodeReviewExperiment = Schema$1.decodeUnknownEffect(Schema$1.fromJsonString(FusionReviewExperiment));
38243
+ const encodeReviewExperiment = Schema$1.encodeEffect(Schema$1.fromJsonString(FusionReviewExperiment));
38135
38244
  const ORCHESTRATION_PROJECTOR_NAMES = {
38136
38245
  projects: "projection.projects",
38137
38246
  threads: "projection.threads",
@@ -38399,7 +38508,32 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
38399
38508
  });
38400
38509
  const applyThreadPairsProjection = Effect.fn("applyThreadPairsProjection")(function* (event, _attachmentSideEffects) {
38401
38510
  switch (event.type) {
38402
- case "thread-pair.created":
38511
+ case "thread.message-sent": {
38512
+ if (event.payload.role !== "user") return;
38513
+ const rows = yield* sql`
38514
+ SELECT pair_id AS id, implementer_thread_id AS "implementerThreadId", watcher_thread_id AS "watcherThreadId",
38515
+ review_experiment_json AS "experimentJson", created_at AS "createdAt"
38516
+ FROM thread_pairs WHERE detached_at IS NULL AND review_experiment_json IS NOT NULL
38517
+ AND (implementer_thread_id = ${event.payload.threadId} OR watcher_thread_id = ${event.payload.threadId})`.pipe(Effect.mapError(toPersistenceSqlError("ProjectionPipeline.fusionBudget:read")));
38518
+ for (const row of rows) {
38519
+ const experiment = yield* decodeReviewExperiment(row.experimentJson).pipe(Effect.orDie);
38520
+ const next = advanceFusionBudget({
38521
+ ...row,
38522
+ reviewExperiment: experiment,
38523
+ detachedAt: null
38524
+ }, event.payload.threadId, event.payload.text, event.sequence, event.commandId);
38525
+ if (!next) continue;
38526
+ const encoded = yield* encodeReviewExperiment(next).pipe(Effect.orDie);
38527
+ yield* sql`UPDATE thread_pairs SET review_experiment_json = ${encoded} WHERE pair_id = ${row.id}`.pipe(Effect.mapError(toPersistenceSqlError("ProjectionPipeline.fusionBudget:update")));
38528
+ }
38529
+ return;
38530
+ }
38531
+ case "thread-pair.created": {
38532
+ const experimentJson = event.payload.reviewPolicy ? yield* encodeReviewExperiment({
38533
+ policy: event.payload.reviewPolicy,
38534
+ automaticReviews: 0,
38535
+ correctionRounds: 0
38536
+ }).pipe(Effect.orDie) : null;
38403
38537
  yield* sql`
38404
38538
  INSERT INTO thread_pairs (
38405
38539
  pair_id,
@@ -38409,6 +38543,7 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
38409
38543
  activation_turn_id,
38410
38544
  round_cap,
38411
38545
  gate_timeout_ms,
38546
+ review_experiment_json,
38412
38547
  active_gate_json,
38413
38548
  created_at,
38414
38549
  detached_at
@@ -38420,6 +38555,7 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
38420
38555
  ${event.payload.activationTurnId ?? null},
38421
38556
  ${event.payload.roundCap ?? 2},
38422
38557
  ${event.payload.gateTimeoutMs ?? 12e4},
38558
+ ${experimentJson},
38423
38559
  NULL,
38424
38560
  ${event.payload.createdAt},
38425
38561
  NULL
@@ -38431,11 +38567,13 @@ const makeOrchestrationProjectionPipeline = Effect.fn("makeOrchestrationProjecti
38431
38567
  activation_turn_id = excluded.activation_turn_id,
38432
38568
  round_cap = excluded.round_cap,
38433
38569
  gate_timeout_ms = excluded.gate_timeout_ms,
38570
+ review_experiment_json = excluded.review_experiment_json,
38434
38571
  active_gate_json = NULL,
38435
38572
  created_at = excluded.created_at,
38436
38573
  detached_at = NULL
38437
38574
  `.pipe(Effect.mapError(toPersistenceSqlError("ProjectionPipeline.threadPairs:create")));
38438
38575
  return;
38576
+ }
38439
38577
  case "thread-pair.gate-opened":
38440
38578
  case "thread-pair.gate-advanced":
38441
38579
  yield* sql`
@@ -39755,12 +39893,12 @@ const runProcessCore = Effect.fn("processRunner.runProcessCore")(function* (spaw
39755
39893
  stderrInvalidUtf8: stderr.invalidUtf8
39756
39894
  };
39757
39895
  });
39758
- const make$96 = Effect.fn("ProcessRunner.make")(function* () {
39896
+ const make$97 = Effect.fn("ProcessRunner.make")(function* () {
39759
39897
  const spawner = yield* ChildProcessSpawner$1.ChildProcessSpawner;
39760
39898
  const run = (input) => finalizeRunProcess(runProcessCore(spawner, input), input);
39761
39899
  return ProcessRunner.of({ run });
39762
39900
  });
39763
- const layer$81 = Layer.effect(ProcessRunner, make$96());
39901
+ const layer$82 = Layer.effect(ProcessRunner, make$97());
39764
39902
  //#endregion
39765
39903
  //#region src/project/RepositoryIdentityResolver.ts
39766
39904
  const DEFAULT_REPOSITORY_IDENTITY_CACHE_CAPACITY = 512;
@@ -39851,7 +39989,7 @@ const resolveRepositoryIdentityFromCacheKey = Effect.fn("RepositoryIdentityResol
39851
39989
  rootPath: cacheKey
39852
39990
  }) : null;
39853
39991
  });
39854
- const make$95 = Effect.fn("RepositoryIdentityResolver.make")(function* (options = {}) {
39992
+ const make$96 = Effect.fn("RepositoryIdentityResolver.make")(function* (options = {}) {
39855
39993
  const processRunner = yield* ProcessRunner;
39856
39994
  const repositoryIdentityCache = yield* Cache.makeWith((cacheKey) => resolveRepositoryIdentityFromCacheKey(cacheKey).pipe(Effect.provideService(ProcessRunner, processRunner)), {
39857
39995
  capacity: options.cacheCapacity ?? DEFAULT_REPOSITORY_IDENTITY_CACHE_CAPACITY,
@@ -39866,7 +40004,7 @@ const make$95 = Effect.fn("RepositoryIdentityResolver.make")(function* (options
39866
40004
  });
39867
40005
  return RepositoryIdentityResolver.of({ resolve });
39868
40006
  });
39869
- const layer$80 = Layer.effect(RepositoryIdentityResolver, make$95()).pipe(Layer.provide(layer$81));
40007
+ const layer$81 = Layer.effect(RepositoryIdentityResolver, make$96()).pipe(Layer.provide(layer$82));
39870
40008
  //#endregion
39871
40009
  //#region src/orchestration/Layers/ProjectionSnapshotQuery.ts
39872
40010
  const decodeReadModel = Schema$1.decodeUnknownEffect(OrchestrationReadModel);
@@ -39923,6 +40061,7 @@ const ProjectionThreadPairDbRowSchema = Schema$1.Struct({
39923
40061
  activationTurnId: Schema$1.NullOr(TurnId),
39924
40062
  roundCap: NonNegativeInt,
39925
40063
  gateTimeoutMs: NonNegativeInt,
40064
+ reviewExperiment: Schema$1.NullOr(Schema$1.fromJsonString(FusionReviewExperiment)),
39926
40065
  activeGate: Schema$1.NullOr(Schema$1.fromJsonString(OrchestrationThreadPairGate)),
39927
40066
  createdAt: IsoDateTime,
39928
40067
  detachedAt: Schema$1.NullOr(IsoDateTime)
@@ -40175,6 +40314,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
40175
40314
  activation_turn_id AS "activationTurnId",
40176
40315
  round_cap AS "roundCap",
40177
40316
  gate_timeout_ms AS "gateTimeoutMs",
40317
+ review_experiment_json AS "reviewExperiment",
40178
40318
  active_gate_json AS "activeGate",
40179
40319
  created_at AS "createdAt",
40180
40320
  detached_at AS "detachedAt"
@@ -40194,6 +40334,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
40194
40334
  activation_turn_id AS "activationTurnId",
40195
40335
  round_cap AS "roundCap",
40196
40336
  gate_timeout_ms AS "gateTimeoutMs",
40337
+ review_experiment_json AS "reviewExperiment",
40197
40338
  active_gate_json AS "activeGate",
40198
40339
  created_at AS "createdAt",
40199
40340
  detached_at AS "detachedAt"
@@ -42128,7 +42269,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
42128
42269
  getThreadDetailSnapshot
42129
42270
  };
42130
42271
  });
42131
- const OrchestrationProjectionSnapshotQueryLive = Layer.effect(ProjectionSnapshotQuery, makeProjectionSnapshotQuery).pipe(Layer.provide(layer$82));
42272
+ const OrchestrationProjectionSnapshotQueryLive = Layer.effect(ProjectionSnapshotQuery, makeProjectionSnapshotQuery).pipe(Layer.provide(layer$83));
42132
42273
  //#endregion
42133
42274
  //#region src/orchestration/Services/ThreadEventStream.ts
42134
42275
  var ThreadEventStreamService = class extends Context.Service()("@p4code/cli/orchestration/Services/ThreadEventStream/ThreadEventStreamService") {};
@@ -42398,7 +42539,7 @@ const OrchestrationProjectionPipelineLayerLive = OrchestrationProjectionPipeline
42398
42539
  * ingestion writes it, and layers memoize by reference, so both must receive
42399
42540
  * THIS layer or they would each get their own empty registry.
42400
42541
  */
42401
- const ThreadBackgroundLivenessLayerLive = layer$82;
42542
+ const ThreadBackgroundLivenessLayerLive = layer$83;
42402
42543
  const OrchestrationInfrastructureLayerLive = Layer.mergeAll(OrchestrationProjectionSnapshotQueryLive, OrchestrationEventInfrastructureLayerLive, OrchestrationProjectionPipelineLayerLive, ThreadBackgroundLivenessLayerLive);
42403
42544
  const OrchestrationEngineLayerLive = OrchestrationEngineLive.pipe(Layer.provide(OrchestrationInfrastructureLayerLive));
42404
42545
  const OrchestrationLayerLive = Layer.mergeAll(OrchestrationInfrastructureLayerLive, OrchestrationEngineLayerLive, ThreadEventStreamLive.pipe(Layer.provide(OrchestrationEngineLayerLive), Layer.provide(OrchestrationEventStoreLive)));
@@ -42873,7 +43014,7 @@ function mergeWithDefaultKeybindings(custom) {
42873
43014
  * Keybindings - Service tag for keybinding configuration operations.
42874
43015
  */
42875
43016
  var Keybindings = class extends Context.Service()("@p4code/cli/keybindings") {};
42876
- const make$94 = Effect.gen(function* () {
43017
+ const make$95 = Effect.gen(function* () {
42877
43018
  const { keybindingsConfigPath } = yield* ServerConfig$1;
42878
43019
  const fs = yield* FileSystem.FileSystem;
42879
43020
  const path = yield* Path$1.Path;
@@ -43134,7 +43275,7 @@ const make$94 = Effect.gen(function* () {
43134
43275
  }))
43135
43276
  };
43136
43277
  });
43137
- const layer$79 = Layer.effect(Keybindings, make$94);
43278
+ const layer$80 = Layer.effect(Keybindings, make$95);
43138
43279
  //#endregion
43139
43280
  //#region src/process/externalLauncher.ts
43140
43281
  /**
@@ -43361,7 +43502,7 @@ const launchEditorProcess = Effect.fn("externalLauncher.launchEditorProcess")(fu
43361
43502
  cause
43362
43503
  }));
43363
43504
  });
43364
- const make$93 = Effect.gen(function* () {
43505
+ const make$94 = Effect.gen(function* () {
43365
43506
  const spawner = yield* ChildProcessSpawner$1.ChildProcessSpawner;
43366
43507
  const fileSystem = yield* FileSystem.FileSystem;
43367
43508
  const path = yield* Path$1.Path;
@@ -43372,7 +43513,7 @@ const make$93 = Effect.gen(function* () {
43372
43513
  launchEditor: (input) => provideCommandResolutionServices(Effect.flatMap(resolveEditorLaunch(input), (launch) => launchEditorProcess(launch).pipe(Effect.provideService(ChildProcessSpawner$1.ChildProcessSpawner, spawner))))
43373
43514
  });
43374
43515
  });
43375
- const layer$78 = Layer.effect(ExternalLauncher, make$93);
43516
+ const layer$79 = Layer.effect(ExternalLauncher, make$94);
43376
43517
  //#endregion
43377
43518
  //#region src/orchestration/Services/OrchestrationReactor.ts
43378
43519
  /**
@@ -43390,7 +43531,7 @@ var OrchestrationReactor = class extends Context.Service()("@p4code/cli/orchestr
43390
43531
  //#endregion
43391
43532
  //#region src/serverLifecycleEvents.ts
43392
43533
  var ServerLifecycleEvents = class extends Context.Service()("@p4code/cli/serverLifecycleEvents") {};
43393
- const make$92 = Effect.gen(function* () {
43534
+ const make$93 = Effect.gen(function* () {
43394
43535
  const pubsub = yield* PubSub.unbounded();
43395
43536
  const state = yield* Ref.make({
43396
43537
  sequence: 0,
@@ -43414,7 +43555,7 @@ const make$92 = Effect.gen(function* () {
43414
43555
  }
43415
43556
  };
43416
43557
  });
43417
- const layer$77 = Layer.effect(ServerLifecycleEvents, make$92);
43558
+ const layer$78 = Layer.effect(ServerLifecycleEvents, make$93);
43418
43559
  //#endregion
43419
43560
  //#region src/telemetry/Identify.ts
43420
43561
  const CodexAuthJsonSchema = Schema$1.Struct({ tokens: Schema$1.Struct({ account_id: Schema$1.String }) });
@@ -43587,7 +43728,7 @@ var AnalyticsService = class AnalyticsService extends Context.Service()("@p4code
43587
43728
  /** No-op layer for callers that intentionally disable telemetry. */
43588
43729
  static layerTest = Layer.succeed(AnalyticsService, inert);
43589
43730
  };
43590
- const make$91 = Effect.gen(function* () {
43731
+ const make$92 = Effect.gen(function* () {
43591
43732
  const telemetryConfig = yield* TelemetryEnvConfig;
43592
43733
  const posthogKey = telemetryConfig.posthogKey.trim();
43593
43734
  if (!telemetryConfig.enabled || posthogKey === "") return inert;
@@ -43657,7 +43798,7 @@ const make$91 = Effect.gen(function* () {
43657
43798
  flush
43658
43799
  });
43659
43800
  });
43660
- const layer$76 = Layer.effect(AnalyticsService, make$91);
43801
+ const layer$77 = Layer.effect(AnalyticsService, make$92);
43661
43802
  AnalyticsService.layerTest;
43662
43803
  //#endregion
43663
43804
  //#region src/provider/Services/ProviderSessionDirectory.ts
@@ -44088,7 +44229,7 @@ var BootServiceInstallError = class extends Schema$1.TaggedErrorClass()("BootSer
44088
44229
  }
44089
44230
  };
44090
44231
  var BootService = class extends Context.Service()("@p4code/cli/service/bootService") {};
44091
- const make$90 = Effect.fn("cloud.boot_service.make")(function* (input) {
44232
+ const make$91 = Effect.fn("cloud.boot_service.make")(function* (input) {
44092
44233
  const hostExecPath = yield* HostProcessExecutablePath;
44093
44234
  const hostArguments = yield* HostProcessArguments;
44094
44235
  const host = input.host ?? {
@@ -44310,7 +44451,7 @@ const make$90 = Effect.fn("cloud.boot_service.make")(function* (input) {
44310
44451
  logPath
44311
44452
  });
44312
44453
  });
44313
- const layer$75 = (input) => Layer.effect(BootService, make$90(input));
44454
+ const layer$76 = (input) => Layer.effect(BootService, make$91(input));
44314
44455
  //#endregion
44315
44456
  //#region src/service/selfUpdate.ts
44316
44457
  /**
@@ -44385,7 +44526,7 @@ const resolveServerSelfUpdateCapability = Effect.fn("cloud.server_self_update.re
44385
44526
  return null;
44386
44527
  });
44387
44528
  var ServerSelfUpdate = class extends Context.Service()("@p4code/cli/service/selfUpdate/ServerSelfUpdate") {};
44388
- const make$89 = Effect.fn("cloud.server_self_update.make")(function* (options) {
44529
+ const make$90 = Effect.fn("cloud.server_self_update.make")(function* (options) {
44389
44530
  const serverConfig = yield* ServerConfig$1;
44390
44531
  const settings = yield* ServerSettingsService;
44391
44532
  const continuationContext = yield* Effect.context();
@@ -44548,7 +44689,7 @@ const make$89 = Effect.fn("cloud.server_self_update.make")(function* (options) {
44548
44689
  });
44549
44690
  return ServerSelfUpdate.of({ update });
44550
44691
  });
44551
- const layer$74 = Layer.effect(ServerSelfUpdate, make$89()).pipe(Layer.provide(layer$81));
44692
+ const layer$75 = Layer.effect(ServerSelfUpdate, make$90()).pipe(Layer.provide(layer$82));
44552
44693
  //#endregion
44553
44694
  //#region src/environment/ServerEnvironmentLabel.ts
44554
44695
  const ServerEnvironmentLabelCommandProbe = Schema$1.Literals(["macos-computer-name", "linux-pretty-hostname"]);
@@ -44680,7 +44821,7 @@ function platformArch(architecture) {
44680
44821
  default: return "other";
44681
44822
  }
44682
44823
  }
44683
- const make$88 = Effect.gen(function* () {
44824
+ const make$89 = Effect.gen(function* () {
44684
44825
  const fileSystem = yield* FileSystem.FileSystem;
44685
44826
  const path = yield* Path$1.Path;
44686
44827
  const serverConfig = yield* ServerConfig$1;
@@ -44758,7 +44899,7 @@ const make$88 = Effect.gen(function* () {
44758
44899
  * state. It intentionally has no fallback Layer.succeed value: callers must
44759
44900
  * provide the external platform services and a ServerConfig.
44760
44901
  */
44761
- const layer$73 = Layer.effect(ServerEnvironment, make$88).pipe(Layer.provide(layer$81));
44902
+ const layer$74 = Layer.effect(ServerEnvironment, make$89).pipe(Layer.provide(layer$82));
44762
44903
  //#endregion
44763
44904
  //#region src/provider/Services/ProviderSessionReaper.ts
44764
44905
  var ProviderSessionReaper = class extends Context.Service()("@p4code/cli/provider/Services/ProviderSessionReaper") {};
@@ -45113,7 +45254,7 @@ function daemonPortLine(line) {
45113
45254
  const port = Number(raw);
45114
45255
  return Number.isInteger(port) && port > 0 && port <= MAX_PORT$1 ? port : null;
45115
45256
  }
45116
- const make$87 = Effect.fn("AgentDeviceProcess.make")(function* () {
45257
+ const make$88 = Effect.fn("AgentDeviceProcess.make")(function* () {
45117
45258
  const fs = yield* FileSystem.FileSystem;
45118
45259
  const path = yield* Path$1.Path;
45119
45260
  const spawner = yield* ChildProcessSpawner$1.ChildProcessSpawner;
@@ -45225,7 +45366,7 @@ const make$87 = Effect.fn("AgentDeviceProcess.make")(function* () {
45225
45366
  });
45226
45367
  return { start };
45227
45368
  });
45228
- const layer$72 = Layer.effect(AgentDeviceProcess, make$87());
45369
+ const layer$73 = Layer.effect(AgentDeviceProcess, make$88());
45229
45370
  //#endregion
45230
45371
  //#region src/device/DeviceDiscovery.ts
45231
45372
  var DeviceDiscoveryFailure = class extends Data.TaggedError("DeviceDiscoveryFailure") {};
@@ -45258,7 +45399,7 @@ const decodeDeviceDiscovery = (hostId, body) => Schema$1.decodeUnknownEffect(Sch
45258
45399
  partial: (value.errors?.length ?? 0) > 0
45259
45400
  });
45260
45401
  }));
45261
- const make$86 = Effect.fn("DeviceDiscovery.make")(function* () {
45402
+ const make$87 = Effect.fn("DeviceDiscovery.make")(function* () {
45262
45403
  const http = yield* HttpClient.HttpClient;
45263
45404
  return Effect.fn("DeviceDiscovery.read")(function* (input) {
45264
45405
  const origin = yield* Effect.try(() => new URL(input.ready.hub.origin));
@@ -45317,7 +45458,7 @@ const Result = Schema$1.Struct({
45317
45458
  serial: Schema$1.optional(DeviceId),
45318
45459
  error: Schema$1.optional(Schema$1.String)
45319
45460
  });
45320
- const make$85 = Effect.fn("DeviceHubActions.make")(function* () {
45461
+ const make$86 = Effect.fn("DeviceHubActions.make")(function* () {
45321
45462
  const http = yield* HttpClient.HttpClient;
45322
45463
  const post = Effect.fn("DeviceHubActions.post")(function* (ready, route, payload, timeoutMs) {
45323
45464
  return yield* Effect.gen(function* () {
@@ -45386,7 +45527,7 @@ function sessionsToClose(sessions, input) {
45386
45527
  //#endregion
45387
45528
  //#region src/device/DeviceCommandLeases.ts
45388
45529
  /** Owns commands by exact session object, so close/reopen cannot revive an old lease. */
45389
- const make$84 = Effect.fn("DeviceCommandLeases.make")(function* () {
45530
+ const make$85 = Effect.fn("DeviceCommandLeases.make")(function* () {
45390
45531
  const lock = yield* Semaphore.make(1);
45391
45532
  const entries = /* @__PURE__ */ new Map();
45392
45533
  const revoked = /* @__PURE__ */ new WeakSet();
@@ -45432,7 +45573,7 @@ const make$84 = Effect.fn("DeviceCommandLeases.make")(function* () {
45432
45573
  //#endregion
45433
45574
  //#region src/device/DeviceThreadLeases.ts
45434
45575
  /** Thread retirement also cancels opens that have not created a session yet. */
45435
- const make$83 = Effect.fn("DeviceThreadLeases.make")(function* () {
45576
+ const make$84 = Effect.fn("DeviceThreadLeases.make")(function* () {
45436
45577
  const lock = yield* Semaphore.make(1);
45437
45578
  const scopes = /* @__PURE__ */ new Map();
45438
45579
  const blocked = /* @__PURE__ */ new Set();
@@ -45480,7 +45621,7 @@ const make$83 = Effect.fn("DeviceThreadLeases.make")(function* () {
45480
45621
  //#region src/device/DeviceHostRegistry.ts
45481
45622
  const sameConfig = (a, b) => a === b || a !== null && b !== null && a.id === b.id && a.label === b.label && a.target === b.target && a.port === b.port && a.identityFile === b.identityFile;
45482
45623
  /** Owns configuration generations; use() interrupts in-flight work before a host is retired. */
45483
- const make$82 = Effect.fn("DeviceHostRegistry.make")(function* (factories) {
45624
+ const make$83 = Effect.fn("DeviceHostRegistry.make")(function* (factories) {
45484
45625
  const factoryContext = yield* Effect.context();
45485
45626
  const lock = yield* Semaphore.make(1);
45486
45627
  const entries = /* @__PURE__ */ new Map();
@@ -45818,7 +45959,7 @@ function deviceHubPlatform(platforms) {
45818
45959
  const COMMAND_TIMEOUT_MS$1 = 2e4;
45819
45960
  const COMMAND_OUTPUT_LIMIT = 1024 * 1024;
45820
45961
  const COMMAND_FAILURE_CODE = 127;
45821
- const make$81 = Effect.fn("LocalDeviceHost.make")(function* () {
45962
+ const make$82 = Effect.fn("LocalDeviceHost.make")(function* () {
45822
45963
  const config = yield* ServerConfig$1;
45823
45964
  const fs = yield* FileSystem.FileSystem;
45824
45965
  const path = yield* Path$1.Path;
@@ -45953,7 +46094,7 @@ const make$81 = Effect.fn("LocalDeviceHost.make")(function* () {
45953
46094
  stop: lock.withPermit(stop)
45954
46095
  };
45955
46096
  });
45956
- Layer.effect(DeviceHost, make$81()).pipe(Layer.provide(layer$72));
46097
+ Layer.effect(DeviceHost, make$82()).pipe(Layer.provide(layer$73));
45957
46098
  Data.TaggedError("SshHostDiscoveryError");
45958
46099
  var SshInvalidTargetError = class extends Data.TaggedError("SshInvalidTargetError") {};
45959
46100
  var SshCommandError = class extends Data.TaggedError("SshCommandError") {};
@@ -46812,7 +46953,7 @@ const probeSshDeviceHost = Effect.fn("SshDeviceDiagnostics.probe")(function* (co
46812
46953
  //#endregion
46813
46954
  //#region src/device/SshDeviceHost.ts
46814
46955
  const DIAGNOSTICS_CACHE_MS = 1e4;
46815
- const make$80 = Effect.fn("SshDeviceHost.make")(function* (input) {
46956
+ const make$81 = Effect.fn("SshDeviceHost.make")(function* (input) {
46816
46957
  const config = yield* Schema$1.decodeUnknownEffect(SshDeviceHostConfig)({ ...input }).pipe(Effect.mapError(() => new DeviceHostError({
46817
46958
  hostId: input.id,
46818
46959
  step: "configuring SSH device host",
@@ -46952,9 +47093,9 @@ var DeviceService = class extends Context.Service()("@p4code/cli/device/DeviceSe
46952
47093
  const makeWithHosts = Effect.fn("DeviceService.makeWithHosts")(function* (input) {
46953
47094
  const settings = yield* ServerSettingsService;
46954
47095
  const scope = yield* Scope.Scope;
46955
- const registry = yield* make$82(input);
46956
- const commands = yield* make$84();
46957
- const threads = yield* make$83();
47096
+ const registry = yield* make$83(input);
47097
+ const commands = yield* make$85();
47098
+ const threads = yield* make$84();
46958
47099
  const changes = yield* Effect.acquireRelease(PubSub.sliding(STATE_BUFFER_SIZE), PubSub.shutdown);
46959
47100
  const stateLock = yield* Semaphore.make(1);
46960
47101
  const discoveryLock = yield* Semaphore.make(1);
@@ -47357,17 +47498,17 @@ const makeWithHosts = Effect.fn("DeviceService.makeWithHosts")(function* (input)
47357
47498
  }))
47358
47499
  };
47359
47500
  });
47360
- const make$79 = Effect.gen(function* () {
47361
- const discover = yield* make$86();
47362
- const actions = yield* make$85();
47501
+ const make$80 = Effect.gen(function* () {
47502
+ const discover = yield* make$87();
47503
+ const actions = yield* make$86();
47363
47504
  return yield* makeWithHosts({
47364
- local: make$81(),
47365
- ssh: make$80,
47505
+ local: make$82(),
47506
+ ssh: make$81,
47366
47507
  discover,
47367
47508
  actions
47368
47509
  });
47369
- }).pipe(Effect.provide(layer$72));
47370
- const layer$70 = Layer.effect(DeviceService, make$79);
47510
+ }).pipe(Effect.provide(layer$73));
47511
+ const layer$71 = Layer.effect(DeviceService, make$80);
47371
47512
  //#endregion
47372
47513
  //#region src/serverRuntimeStartup.ts
47373
47514
  var ServerRuntimeStartupError = class extends Schema$1.TaggedErrorClass()("ServerRuntimeStartupError", {
@@ -47512,7 +47653,7 @@ const startProviderRecovery = Effect.fn("startup.startProviderRecovery")(functio
47512
47653
  yield* input.recover;
47513
47654
  yield* input.startReaper;
47514
47655
  });
47515
- const make$78 = Effect.gen(function* () {
47656
+ const make$79 = Effect.gen(function* () {
47516
47657
  const serverConfig = yield* ServerConfig$1;
47517
47658
  const keybindings = yield* Keybindings;
47518
47659
  const orchestrationReactor = yield* OrchestrationReactor;
@@ -47659,7 +47800,7 @@ const make$78 = Effect.gen(function* () {
47659
47800
  enqueueCommand: commandGate.enqueueCommand
47660
47801
  };
47661
47802
  });
47662
- const layer$69 = Layer.effect(ServerRuntimeStartup, make$78);
47803
+ const layer$70 = Layer.effect(ServerRuntimeStartup, make$79);
47663
47804
  //#endregion
47664
47805
  //#region src/serverRuntimeState.ts
47665
47806
  const PersistedServerRuntimeState = Schema$1.Struct({
@@ -47816,7 +47957,7 @@ function expandHomePath$2(input, path) {
47816
47957
  if (input.startsWith("~/") || input.startsWith("~\\")) return path.join(NodeOS.homedir(), input.slice(2));
47817
47958
  return input;
47818
47959
  }
47819
- const make$77 = Effect.gen(function* () {
47960
+ const make$78 = Effect.gen(function* () {
47820
47961
  const fileSystem = yield* FileSystem.FileSystem;
47821
47962
  const path = yield* Path$1.Path;
47822
47963
  const statWorkspaceRoot = Effect.fn("WorkspacePaths.statWorkspaceRoot")(function* (workspaceRoot, normalizedWorkspaceRoot, phase) {
@@ -47873,7 +48014,7 @@ const make$77 = Effect.gen(function* () {
47873
48014
  resolveRelativePathWithinRoot
47874
48015
  });
47875
48016
  });
47876
- const layer$68 = Layer.effect(WorkspacePaths, make$77);
48017
+ const layer$69 = Layer.effect(WorkspacePaths, make$78);
47877
48018
  //#endregion
47878
48019
  //#region src/cli/project.ts
47879
48020
  const isEnvironmentHttpCommonError = Schema$1.is(EnvironmentHttpCommonError);
@@ -47979,7 +48120,7 @@ const projectCommandUuid = Crypto.Crypto.pipe(Effect.flatMap((crypto) => crypto.
47979
48120
  operation: "generateProjectCommandId",
47980
48121
  cause
47981
48122
  })));
47982
- const ProjectCliRuntimeLive = Layer.mergeAll(layer$68, OrchestrationLayerLive.pipe(Layer.provideMerge(layer$80), Layer.provideMerge(layerConfig)));
48123
+ const ProjectCliRuntimeLive = Layer.mergeAll(layer$69, OrchestrationLayerLive.pipe(Layer.provideMerge(layer$81), Layer.provideMerge(layerConfig)));
47983
48124
  const PROJECT_CLI_LIVE_SERVER_TIMEOUT = Duration.seconds(1);
47984
48125
  const withProjectCliSessionToken = (environmentAuth, run) => Effect.acquireUseRelease(environmentAuth.issueSession({
47985
48126
  scopes: AuthAdministrativeScopes,
@@ -48070,7 +48211,7 @@ const runProjectMutation = Effect.fn("runProjectMutation")(function* (flags, run
48070
48211
  });
48071
48212
  yield* Console.log(output);
48072
48213
  }));
48073
- const offlineRuntimeLayer = ProjectCliRuntimeLive.pipe(Layer.provide(layer$117(config)), Layer.provide(Layer.succeed(References.MinimumLogLevel, minimumLogLevel)));
48214
+ const offlineRuntimeLayer = ProjectCliRuntimeLive.pipe(Layer.provide(layer$118(config)), Layer.provide(Layer.succeed(References.MinimumLogLevel, minimumLogLevel)));
48074
48215
  return yield* Effect.gen(function* () {
48075
48216
  const snapshot = yield* getOfflineSnapshot();
48076
48217
  const orchestrationEngine = yield* OrchestrationEngineService;
@@ -48081,7 +48222,7 @@ const runProjectMutation = Effect.fn("runProjectMutation")(function* (flags, run
48081
48222
  });
48082
48223
  yield* Console.log(output);
48083
48224
  }).pipe(Effect.provide(offlineRuntimeLayer));
48084
- }).pipe(Effect.provide(Layer.mergeAll(runtimeLayer, layer$68).pipe(Layer.provideMerge(FetchHttpClient.layer), Layer.provide(layer$117(config)), Layer.provide(Layer.succeed(References.MinimumLogLevel, minimumLogLevel)))));
48225
+ }).pipe(Effect.provide(Layer.mergeAll(runtimeLayer, layer$69).pipe(Layer.provideMerge(FetchHttpClient.layer), Layer.provide(layer$118(config)), Layer.provide(Layer.succeed(References.MinimumLogLevel, minimumLogLevel)))));
48085
48226
  });
48086
48227
  const projectAddCommand = Command.make("add", {
48087
48228
  ...projectLocationFlags,
@@ -51797,7 +51938,7 @@ const makeTerminationError$1 = (handle) => Effect.match(handle.exitCode, {
51797
51938
  //#region ../../packages/effect-acp/src/client.ts
51798
51939
  const MAX_STDERR_CALLBACK_CHARS = 32768;
51799
51940
  var AcpClient = class extends Context.Service()("effect-acp/client/AcpClient") {};
51800
- const make$76 = Effect.fn("effect-acp/AcpClient.make")(function* (stdio, options = {}, terminationError) {
51941
+ const make$77 = Effect.fn("effect-acp/AcpClient.make")(function* (stdio, options = {}, terminationError) {
51801
51942
  const coreHandlers = {};
51802
51943
  const notificationHandlers = {
51803
51944
  sessionUpdate: {
@@ -51964,7 +52105,7 @@ const layerChildProcess$1 = (handle, options = {}) => {
51964
52105
  })), Stream.drain)) : stdout
51965
52106
  };
51966
52107
  const terminationError = makeTerminationError$1(handle);
51967
- return Layer.effect(AcpClient, make$76(stdio, options, terminationError));
52108
+ return Layer.effect(AcpClient, make$77(stdio, options, terminationError));
51968
52109
  };
51969
52110
  //#endregion
51970
52111
  //#region src/provider/Drivers/AntigravitySkills.ts
@@ -53243,7 +53384,7 @@ const Reply = Schema$1.Struct({
53243
53384
  id: Schema$1.String,
53244
53385
  result: Schema$1.Struct({ ok: Schema$1.Boolean })
53245
53386
  });
53246
- const make$75 = Effect.fn("DeviceCommandProxy.make")(function* () {
53387
+ const make$76 = Effect.fn("DeviceCommandProxy.make")(function* () {
53247
53388
  const http = yield* HttpClient.HttpClient;
53248
53389
  const daemonSessions = /* @__PURE__ */ new WeakMap();
53249
53390
  return Effect.fn("DeviceCommandProxy.execute")(function* (endpoint, session, payload) {
@@ -53296,7 +53437,7 @@ const make$75 = Effect.fn("DeviceCommandProxy.make")(function* () {
53296
53437
  })));
53297
53438
  });
53298
53439
  var DeviceCommandProxy = class extends Context.Service()("@p4code/cli/device/DeviceCommandProxy") {};
53299
- const layer$67 = Layer.effect(DeviceCommandProxy, make$75().pipe(Effect.map((execute) => ({ execute }))));
53440
+ const layer$68 = Layer.effect(DeviceCommandProxy, make$76().pipe(Effect.map((execute) => ({ execute }))));
53300
53441
  //#endregion
53301
53442
  //#region src/device/DeviceScreenshot.ts
53302
53443
  const MAX_SCREENSHOT_BYTES = 8 * 1024 * 1024;
@@ -53343,7 +53484,7 @@ function pngDimensions(png) {
53343
53484
  height
53344
53485
  };
53345
53486
  }
53346
- const make$74 = Effect.fn("DeviceScreenshot.make")(function* () {
53487
+ const make$75 = Effect.fn("DeviceScreenshot.make")(function* () {
53347
53488
  const http = yield* HttpClient.HttpClient;
53348
53489
  return Effect.fn("DeviceScreenshot.capture")(function* (ready, session) {
53349
53490
  const origin = yield* Effect.try(() => new URL(ready.hub.origin));
@@ -53370,7 +53511,7 @@ const make$74 = Effect.fn("DeviceScreenshot.make")(function* () {
53370
53511
  })));
53371
53512
  });
53372
53513
  var DeviceScreenshot = class extends Context.Service()("@p4code/cli/device/DeviceScreenshot") {};
53373
- const layer$66 = Layer.effect(DeviceScreenshot, make$74().pipe(Effect.map((capture) => ({ capture }))));
53514
+ const layer$67 = Layer.effect(DeviceScreenshot, make$75().pipe(Effect.map((capture) => ({ capture }))));
53374
53515
  //#endregion
53375
53516
  //#region src/device/DeviceHubRoute.ts
53376
53517
  const DEVICE_HUB_PROXY_PREFIX = "/api/device-hub";
@@ -53737,7 +53878,7 @@ const hostSession = (scope) => ({
53737
53878
  providerSessionId: scope.providerSessionId
53738
53879
  });
53739
53880
  var ComputerUseBroker = class extends Context.Service()("@p4code/cli/mcp/ComputerUseBroker") {};
53740
- const layer$65 = Layer.effect(ComputerUseBroker, Effect.gen(function* () {
53881
+ const layer$66 = Layer.effect(ComputerUseBroker, Effect.gen(function* () {
53741
53882
  const serviceScope = yield* Scope.Scope;
53742
53883
  const crypto = yield* Crypto.Crypto;
53743
53884
  const environment = yield* ServerEnvironment;
@@ -54328,7 +54469,7 @@ const renew = HttpRouter.add("POST", "/internal/computer-use/renew", Effect.gen(
54328
54469
  if (binding.trust) yield* (yield* RemoteComputerUseBindings).touch(bearer(request));
54329
54470
  return HttpServerResponse.empty({ status: 204 });
54330
54471
  }).pipe(Effect.catch(failure$1)));
54331
- const layer$64 = Layer.mergeAll(exchange, hubForward, hubExchange, connect, respond, device, report, environment, renew).pipe(Layer.provide(remoteComputerUseBindingsLayer));
54472
+ const layer$65 = Layer.mergeAll(exchange, hubForward, hubExchange, connect, respond, device, report, environment, renew).pipe(Layer.provide(remoteComputerUseBindingsLayer));
54332
54473
  //#endregion
54333
54474
  //#region src/device/DeviceHubSocketProtocol.ts
54334
54475
  const MAX_DEVICE_INPUT_BYTES = 8 * 1024;
@@ -55706,7 +55847,7 @@ const logP4ProjectFileLoadError = (error) => Effect.logWarning(error).pipe(Effec
55706
55847
  filePath: error.filePath,
55707
55848
  errorTag: error._tag
55708
55849
  }));
55709
- const make$73 = Effect.gen(function* () {
55850
+ const make$74 = Effect.gen(function* () {
55710
55851
  const fileSystem = yield* FileSystem.FileSystem;
55711
55852
  const path = yield* Path$1.Path;
55712
55853
  const load = Effect.fn("P4ProjectFileLoader.load")(function* (workspaceRoot) {
@@ -55727,7 +55868,7 @@ const make$73 = Effect.gen(function* () {
55727
55868
  });
55728
55869
  return P4ProjectFileLoader.of({ load });
55729
55870
  });
55730
- const layer$63 = Layer.effect(P4ProjectFileLoader, make$73);
55871
+ const layer$64 = Layer.effect(P4ProjectFileLoader, make$74);
55731
55872
  //#endregion
55732
55873
  //#region src/project/ProjectFaviconResolver.ts
55733
55874
  /**
@@ -55802,7 +55943,7 @@ function extractIconHref(source) {
55802
55943
  return null;
55803
55944
  }
55804
55945
  const optionOnNotFound$1 = (effect) => effect.pipe(Effect.map(Option.some), Effect.catchTags({ PlatformError: (error) => error.reason._tag === "NotFound" ? Effect.succeed(Option.none()) : Effect.fail(error) }));
55805
- const make$72 = Effect.gen(function* () {
55946
+ const make$73 = Effect.gen(function* () {
55806
55947
  const fileSystem = yield* FileSystem.FileSystem;
55807
55948
  const path = yield* Path$1.Path;
55808
55949
  const workspacePaths = yield* WorkspacePaths;
@@ -55871,7 +56012,7 @@ const make$72 = Effect.gen(function* () {
55871
56012
  });
55872
56013
  return ProjectFaviconResolver.of({ resolvePath });
55873
56014
  });
55874
- const layer$62 = Layer.effect(ProjectFaviconResolver, make$72);
56015
+ const layer$63 = Layer.effect(ProjectFaviconResolver, make$73);
55875
56016
  //#endregion
55876
56017
  //#region src/assets/AssetAccess.ts
55877
56018
  const ASSET_ROUTE_PREFIX = "/api/assets";
@@ -56282,10 +56423,10 @@ const resolveAsset = Effect.fn("AssetAccess.resolveAsset")(function* (token, rel
56282
56423
  //#endregion
56283
56424
  //#region src/observability/BrowserTraceCollector.ts
56284
56425
  var BrowserTraceCollector = class extends Context.Service()("@p4code/cli/observability/BrowserTraceCollector") {};
56285
- const make$71 = (sink) => BrowserTraceCollector.of({ record: (records) => Effect.sync(() => {
56426
+ const make$72 = (sink) => BrowserTraceCollector.of({ record: (records) => Effect.sync(() => {
56286
56427
  for (const record of records) sink.push(record);
56287
56428
  }) });
56288
- const layer$61 = (sink) => Layer.succeed(BrowserTraceCollector, make$71(sink));
56429
+ const layer$62 = (sink) => Layer.succeed(BrowserTraceCollector, make$72(sink));
56289
56430
  //#endregion
56290
56431
  //#region src/auth/http.ts
56291
56432
  const CREDENTIAL_RESPONSE_HEADERS = {
@@ -57427,7 +57568,7 @@ const defaultCancelTimeout = Duration.seconds(15);
57427
57568
  const defaultSessionLoadTimeout = Duration.seconds(90);
57428
57569
  const defaultSessionLoadReplayIdleGap = Duration.seconds(2);
57429
57570
  var AcpSessionRuntime = class extends Context.Service()("@p4code/cli/provider/acp/AcpSessionRuntime") {};
57430
- const make$70 = (options) => Effect.gen(function* () {
57571
+ const make$71 = (options) => Effect.gen(function* () {
57431
57572
  const crypto = yield* Crypto.Crypto;
57432
57573
  const spawner = yield* ChildProcessSpawner$1.ChildProcessSpawner;
57433
57574
  const runtimeScope = yield* Scope.Scope;
@@ -57831,7 +57972,7 @@ const make$70 = (options) => Effect.gen(function* () {
57831
57972
  notify: acp.raw.notify
57832
57973
  };
57833
57974
  });
57834
- const layer$60 = (options) => Layer.effect(AcpSessionRuntime, make$70(options));
57975
+ const layer$61 = (options) => Layer.effect(AcpSessionRuntime, make$71(options));
57835
57976
  function sessionConfigOptionsFromSetup(response) {
57836
57977
  return response?.configOptions ?? [];
57837
57978
  }
@@ -58225,7 +58366,7 @@ const buildAntigravityPrompt = Effect.fn("buildAntigravityPrompt")(function* (in
58225
58366
  });
58226
58367
  /** Normal launches reject browser login; only the auth flow supplies `onAuthorizationUrl`. */
58227
58368
  const makeAntigravityAcpRuntime = Effect.fn("makeAntigravityAcpRuntime")(function* (input) {
58228
- const context = yield* Layer.build(layer$60({
58369
+ const context = yield* Layer.build(layer$61({
58229
58370
  ...input,
58230
58371
  authMethodId: input.authMethod ?? "oauth-personal",
58231
58372
  resumeMethod: "resume",
@@ -62202,7 +62343,7 @@ const BundledOnlyModelManifest = {
62202
62343
  refreshInBackground: Effect.void
62203
62344
  };
62204
62345
  Layer.succeed(ModelManifest, BundledOnlyModelManifest);
62205
- const make$69 = Effect.gen(function* () {
62346
+ const make$70 = Effect.gen(function* () {
62206
62347
  const fileSystem = yield* FileSystem.FileSystem;
62207
62348
  const path = yield* Path$1.Path;
62208
62349
  const config = yield* ServerConfig$1;
@@ -62247,7 +62388,7 @@ const make$69 = Effect.gen(function* () {
62247
62388
  refreshInBackground: Effect.forkIn(guardedRefresh, serviceScope).pipe(Effect.asVoid)
62248
62389
  });
62249
62390
  });
62250
- const layer$59 = Layer.effect(ModelManifest, make$69);
62391
+ const layer$60 = Layer.effect(ModelManifest, make$70);
62251
62392
  //#endregion
62252
62393
  //#region src/provider/ProviderDriver.ts
62253
62394
  function defaultProviderContinuationIdentity(input) {
@@ -62507,11 +62648,11 @@ const makeTextGenerationFromRegistry = (registry) => TextGeneration.of({
62507
62648
  detail: "This provider does not report account usage."
62508
62649
  }))))
62509
62650
  });
62510
- const make$68 = Effect.gen(function* () {
62651
+ const make$69 = Effect.gen(function* () {
62511
62652
  const registry = yield* ProviderInstanceRegistry;
62512
62653
  return makeTextGenerationFromRegistry(registry);
62513
62654
  });
62514
- const layer$58 = Layer.effect(TextGeneration, make$68);
62655
+ const layer$59 = Layer.effect(TextGeneration, make$69);
62515
62656
  //#endregion
62516
62657
  //#region src/provider/Layers/claudeUsageLimits.ts
62517
62658
  const SESSION_MINS$1 = 300;
@@ -64186,7 +64327,7 @@ function formatAskUserQuestionAnswers(answers) {
64186
64327
  * written as if the setting applied only to user-facing answers.
64187
64328
  */
64188
64329
  const FUSION_PAIR_COMMUNICATION_INSTRUCTIONS = `Everything you send the other half of the pair obeys the thread's active response-compression mode, exactly as a user-facing answer does: phase reports, advice, reviews, questions, and handoffs. When the mode is off, write normal prose. Compression governs form only - never drop a requirement, a negation, a number or unit, a file, symbol, or command name, code, security or warning text, the evidence behind a claim, or an exact protocol heading or token in order to save words.`;
64189
- const FUSION_BUILDER_INSTRUCTIONS = `You are Fusion Builder in an already-created native server pair. Server owns pairing and coordination. Do not inspect or invoke the Fusion skill, create/pair/rename threads, or announce/setup Fusion. Start the user's task directly. Before editing, create and maintain the phase list with your provider's step-tracking tool (Claude Code: TaskCreate for each phase, then TaskUpdate for status, or TodoWrite when that is the tool offered; Codex: update_plan), never the MCP task board tools - one entry per phase in order, exactly one in progress at a time, marked completed at each phase end - so phases render in the task banner. That list holds phase entries only for the whole task; keep step-level or per-file todos out of it. Name each phase in 3-6 words by its outcome, never by a command, file path, or flag, because the banner shows the title verbatim. Prose alone leaves the banner empty. Split it into the fewest substantial phases the task genuinely needs plus a final integration/whole-task phase; most tasks need one to three work phases. Each phase is a complete reviewable slice of behavior. Never split per file, per function, or per trivial step: over-splitting spends review turns instead of finishing the job. Add a phase only when a real review boundary, risky decision, or independent behavior separates the work. Complete exactly one phase per turn, and finish the whole phase in that turn rather than stopping early. Do not run tests, typecheck, lint, or builds per phase; write the tests the change needs, then run verification once in the final phase over the whole task. Exception: a phase whose own correctness is unclear may run the single narrowest check that resolves it. End every phase turn with phase completed, todo status, changed behavior/files, and remaining phases; do not start the next phase in the same turn. Server then wakes the paired Supervisor, which resumes you through ${FUSION_ADVICE_PROMPT_PREFIX}; a user message may also revise or resume the work. Final phase verifies the entire task against the original request and labels it ready for whole-task review. Supervisor is unreachable during your turn. Never spawn/use another Supervisor thread/subagent or attribute Supervisor decisions without ${FUSION_ADVICE_PROMPT_PREFIX}. Within the current phase, continue when straightforward or evidence is clear. For a concrete unresolved tradeoff, correctness risk, or design decision materially needing judgment, stop safely before the risky choice; final response states the exact question and why review is needed. Evaluate/follow Supervisor advice unless conflicting with user request or verified repo state. ${FUSION_PAIR_COMMUNICATION_INSTRUCTIONS}`;
64330
+ const FUSION_BUILDER_INSTRUCTIONS = `You are Fusion Builder in an already-created native server pair. Server owns pairing and coordination. Follow the current turn's [fusion-review-policy] block when present; it overrides the phase-boundary scheduling rules below. Do not inspect or invoke the Fusion skill, create/pair/rename threads, or announce/setup Fusion. Start the user's task directly. Before editing, create and maintain the phase list with your provider's step-tracking tool (Claude Code: TaskCreate for each phase, then TaskUpdate for status, or TodoWrite when that is the tool offered; Codex: update_plan), never the MCP task board tools - one entry per phase in order, exactly one in progress at a time, marked completed at each phase end - so phases render in the task banner. That list holds phase entries only for the whole task; keep step-level or per-file todos out of it. Name each phase in 3-6 words by its outcome, never by a command, file path, or flag, because the banner shows the title verbatim. Prose alone leaves the banner empty. Split it into the fewest substantial phases the task genuinely needs plus a final integration/whole-task phase; most tasks need one to three work phases. Each phase is a complete reviewable slice of behavior. Never split per file, per function, or per trivial step: over-splitting spends review turns instead of finishing the job. Add a phase only when a real review boundary, risky decision, or independent behavior separates the work. Complete exactly one phase per turn, and finish the whole phase in that turn rather than stopping early. Do not run tests, typecheck, lint, or builds per phase; write the tests the change needs, then run verification once in the final phase over the whole task. Exception: a phase whose own correctness is unclear may run the single narrowest check that resolves it. End every phase turn with phase completed, todo status, changed behavior/files, and remaining phases; do not start the next phase in the same turn. Server then wakes the paired Supervisor, which resumes you through ${FUSION_ADVICE_PROMPT_PREFIX}; a user message may also revise or resume the work. Final phase verifies the entire task against the original request and labels it ready for whole-task review. Supervisor is unreachable during your turn. Never spawn/use another Supervisor thread/subagent or attribute Supervisor decisions without ${FUSION_ADVICE_PROMPT_PREFIX}. Within the current phase, continue when straightforward or evidence is clear. For a concrete unresolved tradeoff, correctness risk, or design decision materially needing judgment, stop safely before the risky choice; final response states the exact question and why review is needed. Evaluate/follow Supervisor advice unless conflicting with user request or verified repo state. ${FUSION_PAIR_COMMUNICATION_INSTRUCTIONS}`;
64190
64331
  const FUSION_WATCHER_TOOL_INSTRUCTIONS = `Supervisor tools belong to the p4-code MCP server: thread_watch_review, thread_watch_events, thread_advise, and thread_gate_respond. If absent from the visible tool list, first use the available tool search/discovery facility to load those exact tools, including provider-prefixed names; absence from the initial list does not establish unavailability. If discovery or a call fails, report the exact missing capability or error and the need to restore the p4-code MCP connection. Do not offer manual relay, draft or implement the task yourself, or abandon the supervisor role as a workaround. For an actionable user requirement, read the relevant builder evidence and relay it through thread_advise; when a gate is open, answer through thread_gate_respond instead. Structure every actionable supervisor advice message with these Markdown headings, in order:
64191
64332
  ## Recommendation
64192
64333
  State the decision or correction in one sentence. For a phase review, say whether the phase is approved or needs changes.
@@ -64194,7 +64335,7 @@ State the decision or correction in one sentence. For a phase review, say whethe
64194
64335
  Give concise evidence, relevant file/line references, and any unresolved risk. Distinguish observed facts from assumptions; do not claim checks you did not run.
64195
64336
  ## Next step
64196
64337
  Give ordered, concrete actions for the builder, including the next phase and its completion condition. Preserve user requirements, constraints, and delivery authorization. Keep each section short; omit empty bullets and repeated status. Formatting does not authorize an otherwise unnecessary advice turn or replace an exact protocol response.`;
64197
- const FUSION_WATCHER_INSTRUCTIONS = `You are Fusion Supervisor (watcher) in an already-created native server pair. Server owns pairing and coordination and wakes you with ${FUSION_REVIEW_PROMPT_PREFIX} or ${FUSION_GATE_PROMPT_PREFIX} prompts at builder turn boundaries. A plain message outside such a wake may arrive after your conversational memory of the pair is gone; its [fusion-pair] metadata block is authoritative: the builder thread exists and is the counterpart thread id. Never report that no builder thread exists. For a new pair, the initial user request is yours, and its first turn is research, not relay. Research it: when the request names a ticket, read that ticket AND its comments, including replies and inline comments, and treat a later comment as newer intent than the description; read the code, docs, project instructions, and current state the request touches. Analyse what you found: root cause or the concrete design constraint, scope, what the user actually wants delivered, and which delivery steps they authorized. Only then direct the first actionable phase to the idle builder through thread_advise, stating the findings that make the direction actionable alongside the original requirements, constraints, and authorized delivery scope. Never echo the request back as its own direction, never hand over a plan you did not ground in evidence, and never send ${FUSION_NO_OBJECTION_TEXT} before the builder has received its first phase and produced a turn to review. The builder has not received the initial prompt and must not start before your direction. Missing builder turn evidence is expected before that first direction; do not wait for it or implement the work yourself. Ask the user only when needed to resolve a blocking requirement. ${FUSION_WATCHER_TOOL_INSTRUCTIONS} To resume supervision, read builder evidence with thread_watch_review from lastReviewedImplementerSequence, capture its throughSequence on the first page and reuse that fixed bound while paging with nextAfterSequence until hasMore is false (including empty pages). Apply message append/replace operations by identity; recover truncated evidence through targeted raw thread_watch_events source ranges. Retain reviewed requirements and evidence for final review; recover missing context with targeted history reads rather than mandatory raw replay from zero, derive phase from artifacts (git log/status, PR, builder events, including its turn.plan.updated phase list), steer with thread_advise, and answer an open gate with thread_gate_respond. When a review or gate wake prompt specifies an explicit event range, that range wins over this metadata. Never poll or wait for the builder; deliver review or advice, then end the turn. Every thread_advise starts a builder turn whose completion wakes you again, so never advise a builder that is idle on an external wait or has nothing actionable; report the state in your own thread and end without advising. ${FUSION_PAIR_COMMUNICATION_INSTRUCTIONS}`;
64338
+ const FUSION_WATCHER_INSTRUCTIONS = `You are Fusion Supervisor (watcher) in an already-created native server pair. Follow the current turn's [fusion-review-policy] block when present; it overrides phase scheduling. Server owns pairing and coordination and wakes you with ${FUSION_REVIEW_PROMPT_PREFIX} or ${FUSION_GATE_PROMPT_PREFIX} prompts at builder turn boundaries. A plain message outside such a wake may arrive after your conversational memory of the pair is gone; its [fusion-pair] metadata block is authoritative: the builder thread exists and is the counterpart thread id. Never report that no builder thread exists. For a new pair, the initial user request is yours, and its first turn is research, not relay. Research it: when the request names a ticket, read that ticket AND its comments, including replies and inline comments, and treat a later comment as newer intent than the description; read the code, docs, project instructions, and current state the request touches. Analyse what you found: root cause or the concrete design constraint, scope, what the user actually wants delivered, and which delivery steps they authorized. Only then direct the first actionable phase to the idle builder through thread_advise, stating the findings that make the direction actionable alongside the original requirements, constraints, and authorized delivery scope. Never echo the request back as its own direction, never hand over a plan you did not ground in evidence, and never send ${FUSION_NO_OBJECTION_TEXT} before the builder has received its first phase and produced a turn to review. The builder has not received the initial prompt and must not start before your direction. Missing builder turn evidence is expected before that first direction; do not wait for it or implement the work yourself. Ask the user only when needed to resolve a blocking requirement. ${FUSION_WATCHER_TOOL_INSTRUCTIONS} To resume supervision, read builder evidence with thread_watch_review from lastReviewedImplementerSequence, capture its throughSequence on the first page and reuse that fixed bound while paging with nextAfterSequence until hasMore is false (including empty pages). Apply message append/replace operations by identity; recover truncated evidence through targeted raw thread_watch_events source ranges. Retain reviewed requirements and evidence for final review; recover missing context with targeted history reads rather than mandatory raw replay from zero, derive phase from artifacts (git log/status, PR, builder events, including its turn.plan.updated phase list), steer with thread_advise, and answer an open gate with thread_gate_respond. When a review or gate wake prompt specifies an explicit event range, that range wins over this metadata. Never poll or wait for the builder; deliver review or advice, then end the turn. Every thread_advise starts a builder turn whose completion wakes you again, so never advise a builder that is idle on an external wait or has nothing actionable; report the state in your own thread and end without advising. ${FUSION_PAIR_COMMUNICATION_INSTRUCTIONS}`;
64198
64339
  /**
64199
64340
  * The one-line stand-in for the full block on a message whose session already
64200
64341
  * carries the role instructions.
@@ -64214,6 +64355,13 @@ function fusionRoleInstructionsFor(role) {
64214
64355
  function fusionRoleReferenceLineFor(role) {
64215
64356
  return role === "implementer" ? FUSION_BUILDER_REFERENCE_LINE : FUSION_WATCHER_REFERENCE_LINE;
64216
64357
  }
64358
+ function fusionReviewPolicyInstructions(experiment) {
64359
+ if (!experiment) return "";
64360
+ const { policy } = experiment;
64361
+ return `[fusion-review-policy] Authoritative policy for this pair, overriding phase-boundary rules in session instructions: ${policy.mode}.
64362
+ ${policy.mode === "risk-and-final" ? "Builder: maintain your phase list, but continue across routine phase boundaries within the same turn. End only for a concrete unresolved judgment request, an external blocker, or final whole-task review after verification. Do not stop merely because one phase finished. Supervisor: after resolving a judgment request, direct the builder to continue through remaining routine phases and final verification; do not require another intermediate phase stop." : "Builder: retain one phase per turn. Supervisor: retain phase reviews."}
64363
+ At most ${policy.maxAutomaticReviews} automatic reviews and ${policy.maxCorrectionRounds} advice turns after review per human instruction. Initial direction is free. Current usage: ${experiment.automaticReviews} reviews, ${experiment.correctionRounds} correction rounds. Gate review wakes also consume reviews. Budget exhaustion pauses unresolved work; it never approves it. Human instruction to either thread resets the budget. Never send acknowledgment-only advice.`;
64364
+ }
64217
64365
  //#endregion
64218
64366
  //#region src/provider/GuardrailPrompts.ts
64219
64367
  /** Fresh-evidence gate adapted from superpowers' verification skill. */
@@ -85454,7 +85602,7 @@ const makeTerminationError = (handle) => Effect.match(handle.exitCode, {
85454
85602
  //#endregion
85455
85603
  //#region ../../packages/effect-codex-app-server/src/client.ts
85456
85604
  var CodexAppServerClient = class extends Context.Service()("effect-codex-app-server/client/CodexAppServerClient") {};
85457
- const make$67 = Effect.fn("effect-codex-app-server/CodexAppServerClient.make")(function* (stdio, options = {}, terminationError) {
85605
+ const make$68 = Effect.fn("effect-codex-app-server/CodexAppServerClient.make")(function* (stdio, options = {}, terminationError) {
85458
85606
  const requestHandlers = /* @__PURE__ */ new Map();
85459
85607
  const notificationHandlers = /* @__PURE__ */ new Map();
85460
85608
  let unknownRequestHandler;
@@ -85521,7 +85669,7 @@ const make$67 = Effect.fn("effect-codex-app-server/CodexAppServerClient.make")(f
85521
85669
  const layerChildProcess = (handle, options = {}) => Layer.effect(CodexAppServerClient, makeChildProcessClient(handle, options));
85522
85670
  const makeChildProcessClient = Effect.fn("effect-codex-app-server/CodexAppServerClient.makeChildProcessClient")(function* (handle, options) {
85523
85671
  yield* Stream.runDrain(handle.stderr).pipe(Effect.ignore, Effect.forkScoped);
85524
- return yield* make$67(makeChildStdio(handle), options, makeTerminationError(handle));
85672
+ return yield* make$68(makeChildStdio(handle), options, makeTerminationError(handle));
85525
85673
  });
85526
85674
  const resolveCodexLaunchArgs = (launchArgs, environment = process.env) => environment["P4CODE_CODEX_LAUNCH_ARGS"]?.trim() || launchArgs?.trim() || "";
85527
85675
  const codexLaunchArgv = (launchArgs) => tokenizeCliArgs(launchArgs);
@@ -89365,7 +89513,7 @@ function buildCursorDiscoveredModelsFromAvailableModelsResponse(response) {
89365
89513
  }
89366
89514
  const makeCursorAcpProbeRuntime = (cursorSettings, environment) => Effect.gen(function* () {
89367
89515
  const spawner = yield* ChildProcessSpawner$1.ChildProcessSpawner;
89368
- const acpContext = yield* Layer.build(layer$60({
89516
+ const acpContext = yield* Layer.build(layer$61({
89369
89517
  spawn: {
89370
89518
  command: cursorSettings.binaryPath,
89371
89519
  args: [...cursorSettings.apiEndpoint ? ["-e", cursorSettings.apiEndpoint] : [], "acp"],
@@ -89815,7 +89963,7 @@ function buildCursorAcpSpawnInput(cursorSettings, cwd, environment) {
89815
89963
  };
89816
89964
  }
89817
89965
  const makeCursorAcpRuntime = (input) => Effect.gen(function* () {
89818
- const acpContext = yield* Layer.build(layer$60({
89966
+ const acpContext = yield* Layer.build(layer$61({
89819
89967
  ...input,
89820
89968
  spawn: buildCursorAcpSpawnInput(input.cursorSettings, input.cwd, input.environment),
89821
89969
  authMethodId: "cursor_login",
@@ -91008,7 +91156,7 @@ function resolveGrokAuthMethodId(environment) {
91008
91156
  return environment?.[GROK_API_KEY_ENV]?.trim() ? GROK_AUTH_METHOD_API_KEY : GROK_AUTH_METHOD_CACHED_TOKEN;
91009
91157
  }
91010
91158
  const makeGrokAcpRuntime = (input) => Effect.gen(function* () {
91011
- const acpContext = yield* Layer.build(layer$60({
91159
+ const acpContext = yield* Layer.build(layer$61({
91012
91160
  ...input,
91013
91161
  spawn: buildGrokAcpSpawnInput(input.grokSettings, input.cwd, input.environment),
91014
91162
  authMethodId: resolveGrokAuthMethodId(input.environment)
@@ -94467,7 +94615,7 @@ const makeOpenCodeRuntime = Effect.gen(function* () {
94467
94615
  };
94468
94616
  });
94469
94617
  var OpenCodeRuntime = class extends Context.Service()("@p4code/cli/provider/opencodeRuntime") {};
94470
- const OpenCodeRuntimeLive = Layer.effect(OpenCodeRuntime, makeOpenCodeRuntime).pipe(Layer.provide(layer$118));
94618
+ const OpenCodeRuntimeLive = Layer.effect(OpenCodeRuntime, makeOpenCodeRuntime).pipe(Layer.provide(layer$119));
94471
94619
  //#endregion
94472
94620
  //#region src/textGeneration/OpenCodeTextGeneration.ts
94473
94621
  const OPENCODE_TEXT_GENERATION_IDLE_TTL = "30 seconds";
@@ -97057,8 +97205,8 @@ const makeWithReader = (api) => Effect.gen(function* () {
97057
97205
  }))
97058
97206
  };
97059
97207
  });
97060
- const make$66 = makeCliproxyApi.pipe(Effect.flatMap(makeWithReader));
97061
- const layer$57 = Layer.effect(UsageLimitSources, make$66);
97208
+ const make$67 = makeCliproxyApi.pipe(Effect.flatMap(makeWithReader));
97209
+ const layer$58 = Layer.effect(UsageLimitSources, make$67);
97062
97210
  //#endregion
97063
97211
  //#region src/resourceTelemetry/HostResources.ts
97064
97212
  const CPU_SAMPLE_INTERVAL = "200 millis";
@@ -97093,7 +97241,7 @@ function darwinAvailableMemory(output) {
97093
97241
  const available = (Number(free) + Number(inactive) + Number(speculative)) * Number(pageSize);
97094
97242
  return Number.isSafeInteger(available) && Number(pageSize) > 0 ? available : null;
97095
97243
  }
97096
- const make$65 = Effect.fn("makeHostResources")(function* () {
97244
+ const make$66 = Effect.fn("makeHostResources")(function* () {
97097
97245
  const fs = yield* FileSystem.FileSystem;
97098
97246
  const platform = yield* HostProcessPlatform;
97099
97247
  const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
@@ -97127,7 +97275,7 @@ const make$65 = Effect.fn("makeHostResources")(function* () {
97127
97275
  });
97128
97276
  return HostResources.of({ read: Cache.get(cache, "host") });
97129
97277
  });
97130
- const layer$56 = Layer.effect(HostResources, make$65());
97278
+ const layer$57 = Layer.effect(HostResources, make$66());
97131
97279
  //#endregion
97132
97280
  //#region src/resourceTelemetry/DesktopTelemetryReceiver.ts
97133
97281
  const INITIAL_SAMPLE_DEADLINE_MS = 9e4;
@@ -97262,7 +97410,7 @@ function requireDesktopTelemetryWriteProgress(fd, remainingBytes, written) {
97262
97410
  }));
97263
97411
  }
97264
97412
  /** @public Service construction is part of the canonical Effect module API. */
97265
- const make$64 = Effect.fn("resourceTelemetry.desktopTelemetryReceiver.make")(function* () {
97413
+ const make$65 = Effect.fn("resourceTelemetry.desktopTelemetryReceiver.make")(function* () {
97266
97414
  const serverConfig = yield* ServerConfig$1;
97267
97415
  const hasDescriptors = serverConfig.mode === "desktop" && serverConfig.desktopTelemetryFd === 4 && serverConfig.desktopTelemetryControlFd === 5;
97268
97416
  const config = {
@@ -97419,7 +97567,7 @@ const make$64 = Effect.fn("resourceTelemetry.desktopTelemetryReceiver.make")(fun
97419
97567
  setDiagnosticsDemand
97420
97568
  });
97421
97569
  });
97422
- const layer$55 = Layer.effect(DesktopTelemetryReceiver, make$64());
97570
+ const layer$56 = Layer.effect(DesktopTelemetryReceiver, make$65());
97423
97571
  //#endregion
97424
97572
  //#region src/resourceTelemetry/Model.ts
97425
97573
  const MAX_DELTA_INTERVAL_MS = 3e4;
@@ -97844,7 +97992,7 @@ function resourceMonitorRustTarget(platform, architecture, linuxLibc) {
97844
97992
  }
97845
97993
  if (platform === "win32") return architecture === "arm64" ? "aarch64-pc-windows-msvc" : architecture === "x64" ? "x86_64-pc-windows-msvc" : void 0;
97846
97994
  }
97847
- const make$63 = Effect.fn("resourceTelemetry.resourceMonitorBinary.make")(function* () {
97995
+ const make$64 = Effect.fn("resourceTelemetry.resourceMonitorBinary.make")(function* () {
97848
97996
  const fileSystem = yield* FileSystem.FileSystem;
97849
97997
  const path = yield* Path$1.Path;
97850
97998
  const platform = yield* HostProcessPlatform;
@@ -97890,7 +98038,7 @@ const make$63 = Effect.fn("resourceTelemetry.resourceMonitorBinary.make")(functi
97890
98038
  });
97891
98039
  return ResourceMonitorBinary.of({ resolve });
97892
98040
  });
97893
- const layer$54 = Layer.effect(ResourceMonitorBinary, make$63());
98041
+ const layer$55 = Layer.effect(ResourceMonitorBinary, make$64());
97894
98042
  //#endregion
97895
98043
  //#region src/resourceTelemetry/NativeTelemetryClient.ts
97896
98044
  const SAMPLE_INTERVAL_MS$1 = 1e3;
@@ -98040,7 +98188,7 @@ function canCommandNativeTelemetrySidecar(status, hasHandle) {
98040
98188
  return hasHandle && (status === "healthy" || status === "degraded");
98041
98189
  }
98042
98190
  /** @public Service construction is part of the canonical Effect module API. */
98043
- const make$62 = Effect.fn("resourceTelemetry.nativeTelemetryClient.make")(function* () {
98191
+ const make$63 = Effect.fn("resourceTelemetry.nativeTelemetryClient.make")(function* () {
98044
98192
  const binary = yield* ResourceMonitorBinary;
98045
98193
  const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
98046
98194
  const crypto = yield* Crypto.Crypto;
@@ -98451,7 +98599,7 @@ const make$62 = Effect.fn("resourceTelemetry.nativeTelemetryClient.make")(functi
98451
98599
  })
98452
98600
  });
98453
98601
  });
98454
- const layer$53 = Layer.effect(NativeTelemetryClient, make$62());
98602
+ const layer$54 = Layer.effect(NativeTelemetryClient, make$63());
98455
98603
  //#endregion
98456
98604
  //#region src/resourceTelemetry/ResourceAttribution.ts
98457
98605
  var ResourceAttribution = class extends Context.Service()("@p4code/cli/resourceTelemetry/ResourceAttribution") {};
@@ -98463,7 +98611,7 @@ function nonNegativeInteger(value, fallback) {
98463
98611
  if (!Number.isFinite(value)) return 0;
98464
98612
  return Math.max(0, Math.round(value));
98465
98613
  }
98466
- const make$61 = Effect.fn("resourceTelemetry.resourceAttribution.make")(function* () {
98614
+ const make$62 = Effect.fn("resourceTelemetry.resourceAttribution.make")(function* () {
98467
98615
  const entries = yield* Ref.make(/* @__PURE__ */ new Map());
98468
98616
  const record = (input) => Ref.update(entries, (current) => {
98469
98617
  const next = new Map(current);
@@ -98489,7 +98637,7 @@ const make$61 = Effect.fn("resourceTelemetry.resourceAttribution.make")(function
98489
98637
  })
98490
98638
  });
98491
98639
  });
98492
- const layer$52 = Layer.effect(ResourceAttribution, make$61());
98640
+ const layer$53 = Layer.effect(ResourceAttribution, make$62());
98493
98641
  //#endregion
98494
98642
  //#region src/resourceTelemetry/ResourceTelemetryHistory.ts
98495
98643
  const MAX_HISTORY_WINDOW_MS = 60 * 6e4;
@@ -98712,7 +98860,7 @@ function buildHealth(input) {
98712
98860
  };
98713
98861
  }
98714
98862
  /** @public Service construction is part of the canonical Effect module API. */
98715
- const make$60 = Effect.fn("resourceTelemetry.resourceTelemetry.make")(function* () {
98863
+ const make$61 = Effect.fn("resourceTelemetry.resourceTelemetry.make")(function* () {
98716
98864
  const nativeClient = yield* NativeTelemetryClient;
98717
98865
  const desktopReceiver = yield* DesktopTelemetryReceiver;
98718
98866
  const attribution = yield* ResourceAttribution;
@@ -98964,7 +99112,7 @@ const make$60 = Effect.fn("resourceTelemetry.resourceTelemetry.make")(function*
98964
99112
  })))
98965
99113
  });
98966
99114
  });
98967
- const layer$51 = Layer.effect(ResourceTelemetry, make$60());
99115
+ const layer$52 = Layer.effect(ResourceTelemetry, make$61());
98968
99116
  //#endregion
98969
99117
  //#region src/device/DeviceInspection.ts
98970
99118
  const READ_TIMEOUT_MS = 1e4;
@@ -102119,7 +102267,7 @@ const classifyNonZeroExit = (command, stderr) => {
102119
102267
  if (command === "gh" && (normalized.includes("could not resolve to a pullrequest") || normalized.includes("repository.pullrequest") || normalized.includes("no pull requests found for branch") || normalized.includes("pull request not found")) || command === "glab" && (normalized.includes("merge request not found") || normalized.includes("not found") || normalized.includes("404")) || command === "az" && normalized.includes("pull request") && (normalized.includes("not found") || normalized.includes("does not exist"))) return "not-found";
102120
102268
  return "command-failed";
102121
102269
  };
102122
- const make$59 = Effect.gen(function* () {
102270
+ const make$60 = Effect.gen(function* () {
102123
102271
  const processRunner = yield* ProcessRunner;
102124
102272
  const run = Effect.fn("VcsProcess.run")(function* (input) {
102125
102273
  const baseError = {
@@ -102178,7 +102326,7 @@ const make$59 = Effect.gen(function* () {
102178
102326
  });
102179
102327
  return VcsProcess.of({ run });
102180
102328
  });
102181
- const layer$50 = Layer.effect(VcsProcess, make$59).pipe(Layer.provide(layer$81));
102329
+ const layer$51 = Layer.effect(VcsProcess, make$60).pipe(Layer.provide(layer$82));
102182
102330
  //#endregion
102183
102331
  //#region src/vcs/VcsDriver.ts
102184
102332
  var VcsDriver = class extends Context.Service()("@p4code/cli/vcs/VcsDriver") {};
@@ -102629,12 +102777,12 @@ const makeVcsDriver = Effect.gen(function* () {
102629
102777
  const driver = yield* makeVcsDriverShape();
102630
102778
  return VcsDriver.of(driver);
102631
102779
  });
102632
- const make$58 = Effect.gen(function* () {
102780
+ const make$59 = Effect.gen(function* () {
102633
102781
  const git = yield* makeGitVcsDriverCore();
102634
102782
  return GitVcsDriver.of(git);
102635
102783
  });
102636
102784
  Layer.effect(VcsDriver, makeVcsDriver);
102637
- const layer$49 = Layer.effect(GitVcsDriver, make$58);
102785
+ const layer$50 = Layer.effect(GitVcsDriver, make$59);
102638
102786
  //#endregion
102639
102787
  //#region src/vcs/VcsProjectConfig.ts
102640
102788
  const ProjectVcsConfigJson = fromLenientJson(Schema$1.Struct({
@@ -102666,7 +102814,7 @@ const logVcsProjectConfigError = (error) => Effect.logWarning(error).pipe(Effect
102666
102814
  configPath: error.configPath,
102667
102815
  errorTag: error._tag
102668
102816
  }));
102669
- const make$57 = Effect.gen(function* () {
102817
+ const make$58 = Effect.gen(function* () {
102670
102818
  const fileSystem = yield* FileSystem.FileSystem;
102671
102819
  const path = yield* Path$1.Path;
102672
102820
  const findConfigPath = Effect.fn("VcsProjectConfig.findConfigPath")(function* (cwd) {
@@ -102707,7 +102855,7 @@ const make$57 = Effect.gen(function* () {
102707
102855
  });
102708
102856
  return VcsProjectConfig.of({ resolveKind });
102709
102857
  });
102710
- const layer$48 = Layer.effect(VcsProjectConfig, make$57);
102858
+ const layer$49 = Layer.effect(VcsProjectConfig, make$58);
102711
102859
  //#endregion
102712
102860
  //#region src/vcs/VcsDriverRegistry.ts
102713
102861
  const DETECTION_CACHE_CAPACITY = 2048;
@@ -102727,7 +102875,7 @@ function parseDetectionCacheKey(key) {
102727
102875
  cwd: key.slice(separatorIndex + 1)
102728
102876
  };
102729
102877
  }
102730
- const make$56 = Effect.gen(function* () {
102878
+ const make$57 = Effect.gen(function* () {
102731
102879
  const projectConfig = yield* VcsProjectConfig;
102732
102880
  const git = yield* makeVcsDriver;
102733
102881
  const drivers = { git };
@@ -102784,7 +102932,7 @@ const make$56 = Effect.gen(function* () {
102784
102932
  resolve
102785
102933
  });
102786
102934
  });
102787
- const layer$47 = Layer.effect(VcsDriverRegistry, make$56).pipe(Layer.provide(layer$48));
102935
+ const layer$48 = Layer.effect(VcsDriverRegistry, make$57).pipe(Layer.provide(layer$49));
102788
102936
  //#endregion
102789
102937
  //#region src/checkpointing/CheckpointStore.ts
102790
102938
  /**
@@ -102804,7 +102952,7 @@ const layer$47 = Layer.effect(VcsDriverRegistry, make$56).pipe(Layer.provide(lay
102804
102952
  */
102805
102953
  /** Service tag for checkpoint persistence and restore operations. */
102806
102954
  var CheckpointStore = class extends Context.Service()("@p4code/cli/checkpointing/CheckpointStore") {};
102807
- const make$55 = Effect.gen(function* () {
102955
+ const make$56 = Effect.gen(function* () {
102808
102956
  const vcsRegistry = yield* VcsDriverRegistry;
102809
102957
  const resolveCheckpoints = Effect.fn("CheckpointStore.resolveCheckpoints")(function* (operation, cwd) {
102810
102958
  const handle = yield* vcsRegistry.resolve({ cwd });
@@ -102843,7 +102991,7 @@ const make$55 = Effect.gen(function* () {
102843
102991
  deleteCheckpointRefs
102844
102992
  });
102845
102993
  });
102846
- const layer$46 = Layer.effect(CheckpointStore, make$55);
102994
+ const layer$47 = Layer.effect(CheckpointStore, make$56);
102847
102995
  //#endregion
102848
102996
  //#region src/checkpointing/CheckpointDiffQuery.ts
102849
102997
  /**
@@ -102865,7 +103013,7 @@ function buildTurnDiffResult(input, diff) {
102865
103013
  diff
102866
103014
  };
102867
103015
  }
102868
- const make$54 = Effect.gen(function* () {
103016
+ const make$55 = Effect.gen(function* () {
102869
103017
  const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
102870
103018
  const checkpointStore = yield* CheckpointStore;
102871
103019
  const threadActivities = yield* ProjectionThreadActivityRepository;
@@ -103036,7 +103184,7 @@ const make$54 = Effect.gen(function* () {
103036
103184
  getFullThreadDiff
103037
103185
  });
103038
103186
  });
103039
- const layer$45 = Layer.effect(CheckpointDiffQuery, make$54);
103187
+ const layer$46 = Layer.effect(CheckpointDiffQuery, make$55);
103040
103188
  //#endregion
103041
103189
  //#region src/orchestration/ThreadLiveEventCoalescer.ts
103042
103190
  const COALESCE_WINDOW = Duration.millis(50);
@@ -103581,7 +103729,7 @@ const serversEqual = (left, right) => {
103581
103729
  }
103582
103730
  return true;
103583
103731
  };
103584
- const make$53 = Effect.gen(function* PortDiscoveryMake() {
103732
+ const make$54 = Effect.gen(function* PortDiscoveryMake() {
103585
103733
  const net = yield* NetService;
103586
103734
  const processRunner = yield* ProcessRunner;
103587
103735
  const hostPlatform = yield* HostProcessPlatform;
@@ -103732,7 +103880,7 @@ const make$53 = Effect.gen(function* PortDiscoveryMake() {
103732
103880
  unregisterTerminal
103733
103881
  });
103734
103882
  }).pipe(Effect.withSpan("PortDiscovery.make"));
103735
- const layer$44 = Layer.effect(PortDiscovery, make$53);
103883
+ const layer$45 = Layer.effect(PortDiscovery, make$54);
103736
103884
  //#endregion
103737
103885
  //#region src/terminal/Manager.ts
103738
103886
  /**
@@ -104410,7 +104558,7 @@ function normalizedRuntimeEnv(env) {
104410
104558
  if (entries.length === 0) return null;
104411
104559
  return Object.fromEntries(entries.toSorted(([left], [right]) => left.localeCompare(right)));
104412
104560
  }
104413
- const make$52 = Effect.fn("TerminalManager.make")(function* () {
104561
+ const make$53 = Effect.fn("TerminalManager.make")(function* () {
104414
104562
  const { terminalLogsDir } = yield* ServerConfig$1;
104415
104563
  const ptyAdapter = yield* PtyAdapter;
104416
104564
  const portDiscovery = yield* PortDiscovery;
@@ -105372,7 +105520,7 @@ const makeWithOptions$1 = Effect.fn("TerminalManager.makeWithOptions")(function*
105372
105520
  subscribeMetadata
105373
105521
  });
105374
105522
  });
105375
- const layer$43 = Layer.effect(TerminalManager, make$52()).pipe(Layer.provide(layer$81));
105523
+ const layer$44 = Layer.effect(TerminalManager, make$53()).pipe(Layer.provide(layer$82));
105376
105524
  //#endregion
105377
105525
  //#region src/project/ProjectSetupScriptRunner.ts
105378
105526
  var ProjectSetupScriptOperationError = class extends Schema$1.TaggedErrorClass()("ProjectSetupScriptOperationError", {
@@ -105404,7 +105552,7 @@ var ProjectSetupScriptProjectNotFoundError = class extends Schema$1.TaggedErrorC
105404
105552
  };
105405
105553
  Schema$1.Union([ProjectSetupScriptOperationError, ProjectSetupScriptProjectNotFoundError]);
105406
105554
  var ProjectSetupScriptRunner = class extends Context.Service()("@p4code/cli/project/ProjectSetupScriptRunner") {};
105407
- const make$51 = Effect.gen(function* () {
105555
+ const make$52 = Effect.gen(function* () {
105408
105556
  const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
105409
105557
  const terminalManager = yield* TerminalManager;
105410
105558
  const settingsService = yield* Effect.serviceOption(ServerSettingsService);
@@ -105467,7 +105615,7 @@ const make$51 = Effect.gen(function* () {
105467
105615
  });
105468
105616
  return ProjectSetupScriptRunner.of({ runForThread });
105469
105617
  });
105470
- const layer$42 = Layer.effect(ProjectSetupScriptRunner, make$51);
105618
+ const layer$43 = Layer.effect(ProjectSetupScriptRunner, make$52);
105471
105619
  //#endregion
105472
105620
  //#region src/sourceControl/azureDevOpsPullRequests.ts
105473
105621
  const AzureDevOpsPullRequestSchema = Schema$1.Struct({
@@ -105795,7 +105943,7 @@ function decodeAzureDevOpsJson(raw, schema, operation, cwd) {
105795
105943
  cause
105796
105944
  })));
105797
105945
  }
105798
- const make$50 = Effect.gen(function* () {
105946
+ const make$51 = Effect.gen(function* () {
105799
105947
  const process = yield* VcsProcess;
105800
105948
  const execute = (input) => process.run({
105801
105949
  operation: "AzureDevOpsCli.execute",
@@ -105937,7 +106085,7 @@ const make$50 = Effect.gen(function* () {
105937
106085
  }).pipe(Effect.asVoid)
105938
106086
  });
105939
106087
  });
105940
- const layer$41 = Layer.effect(AzureDevOpsCli, make$50);
106088
+ const layer$42 = Layer.effect(AzureDevOpsCli, make$51);
105941
106089
  //#endregion
105942
106090
  //#region src/sourceControl/SourceControlProviderDiscovery.ts
105943
106091
  function firstNonEmptyLine(text) {
@@ -106141,7 +106289,7 @@ function toChangeRequest$5(summary) {
106141
106289
  isCrossRepository: false
106142
106290
  };
106143
106291
  }
106144
- const make$49 = Effect.gen(function* () {
106292
+ const make$50 = Effect.gen(function* () {
106145
106293
  const azure = yield* AzureDevOpsCli;
106146
106294
  return SourceControlProvider.of({
106147
106295
  kind: "azure-devops",
@@ -106234,7 +106382,7 @@ const make$49 = Effect.gen(function* () {
106234
106382
  })))
106235
106383
  });
106236
106384
  });
106237
- Layer.effect(SourceControlProvider, make$49);
106385
+ Layer.effect(SourceControlProvider, make$50);
106238
106386
  //#endregion
106239
106387
  //#region src/sourceControl/bitbucketPullRequests.ts
106240
106388
  const BitbucketRepositoryRefSchema = Schema$1.Struct({
@@ -106611,7 +106759,7 @@ function responseError(operation, response) {
106611
106759
  responseBodyLength: collected.text.length
106612
106760
  }))));
106613
106761
  }
106614
- const make$48 = Effect.gen(function* () {
106762
+ const make$49 = Effect.gen(function* () {
106615
106763
  const config = yield* BitbucketApiEnvConfig;
106616
106764
  const httpClient = yield* HttpClient.HttpClient;
106617
106765
  const fileSystem = yield* FileSystem.FileSystem;
@@ -106827,7 +106975,7 @@ const make$48 = Effect.gen(function* () {
106827
106975
  })))
106828
106976
  });
106829
106977
  });
106830
- const layer$39 = Layer.effect(BitbucketApi, make$48);
106978
+ const layer$40 = Layer.effect(BitbucketApi, make$49);
106831
106979
  //#endregion
106832
106980
  //#region src/sourceControl/BitbucketSourceControlProvider.ts
106833
106981
  function toChangeRequest$4(summary) {
@@ -106845,7 +106993,7 @@ function toChangeRequest$4(summary) {
106845
106993
  ...summary.headRepositoryOwnerLogin !== void 0 ? { headRepositoryOwnerLogin: summary.headRepositoryOwnerLogin } : {}
106846
106994
  };
106847
106995
  }
106848
- const make$47 = Effect.gen(function* () {
106996
+ const make$48 = Effect.gen(function* () {
106849
106997
  const bitbucket = yield* BitbucketApi;
106850
106998
  return SourceControlProvider.of({
106851
106999
  kind: "bitbucket",
@@ -106936,7 +107084,7 @@ const make$47 = Effect.gen(function* () {
106936
107084
  })))
106937
107085
  });
106938
107086
  });
106939
- Layer.effect(SourceControlProvider, make$47);
107087
+ Layer.effect(SourceControlProvider, make$48);
106940
107088
  const makeDiscovery = Effect.gen(function* () {
106941
107089
  return {
106942
107090
  type: "api",
@@ -107184,7 +107332,7 @@ function deriveRepositoryCloneUrlsFromCreateOutput(stdout, repository) {
107184
107332
  sshUrl: `git@${fallbackHost}:${repository}.git`
107185
107333
  };
107186
107334
  }
107187
- const make$46 = Effect.gen(function* () {
107335
+ const make$47 = Effect.gen(function* () {
107188
107336
  const process = yield* VcsProcess;
107189
107337
  const execute = (input) => process.run({
107190
107338
  operation: "GitHubCli.execute",
@@ -107302,7 +107450,7 @@ const make$46 = Effect.gen(function* () {
107302
107450
  }).pipe(Effect.asVoid)
107303
107451
  });
107304
107452
  });
107305
- const layer$37 = Layer.effect(GitHubCli, make$46);
107453
+ const layer$38 = Layer.effect(GitHubCli, make$47);
107306
107454
  //#endregion
107307
107455
  //#region src/sourceControl/gitHubAuthStatus.ts
107308
107456
  const GitHubAuthStatusAccountSchema = Schema$1.Struct({
@@ -107404,7 +107552,7 @@ const discovery$1 = {
107404
107552
  parseAuth: parseGitHubAuth,
107405
107553
  installHint: "Install the GitHub command-line tool (`gh`) via https://cli.github.com/ or your package manager (for example `brew install gh`)."
107406
107554
  };
107407
- const make$45 = Effect.gen(function* () {
107555
+ const make$46 = Effect.gen(function* () {
107408
107556
  const github = yield* GitHubCli;
107409
107557
  const listChangeRequests = (input) => {
107410
107558
  if (input.state === "open") return github.listOpenPullRequests({
@@ -107520,7 +107668,7 @@ const make$45 = Effect.gen(function* () {
107520
107668
  })))
107521
107669
  });
107522
107670
  });
107523
- Layer.effect(SourceControlProvider, make$45);
107671
+ Layer.effect(SourceControlProvider, make$46);
107524
107672
  //#endregion
107525
107673
  //#region src/sourceControl/gitLabMergeRequests.ts
107526
107674
  const GitLabProjectReferenceSchema = Schema$1.Struct({
@@ -107839,7 +107987,7 @@ function parseRepositoryPath(repository) {
107839
107987
  projectPath
107840
107988
  };
107841
107989
  }
107842
- const make$44 = Effect.gen(function* () {
107990
+ const make$45 = Effect.gen(function* () {
107843
107991
  const process = yield* VcsProcess;
107844
107992
  const run = (input, mapError) => process.run({
107845
107993
  operation: "GitLabCli.execute",
@@ -107990,7 +108138,7 @@ const make$44 = Effect.gen(function* () {
107990
108138
  }).pipe(Effect.asVoid)
107991
108139
  });
107992
108140
  });
107993
- const layer$35 = Layer.effect(GitLabCli, make$44);
108141
+ const layer$36 = Layer.effect(GitLabCli, make$45);
107994
108142
  //#endregion
107995
108143
  //#region src/sourceControl/gitLabAuthStatus.ts
107996
108144
  const HOST_LINE_PATTERN = /^(?:[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?|\[[a-f0-9:.]+\])(?::\d+)?$/iu;
@@ -108088,7 +108236,7 @@ const discovery = {
108088
108236
  refineUnknownRemote: refineUnknownGitLabRemote,
108089
108237
  installHint: "Install the GitLab command-line tool (`glab`) from https://gitlab.com/gitlab-org/cli or your package manager (for example `brew install glab`)."
108090
108238
  };
108091
- const make$43 = Effect.gen(function* () {
108239
+ const make$44 = Effect.gen(function* () {
108092
108240
  const gitlab = yield* GitLabCli;
108093
108241
  return SourceControlProvider.of({
108094
108242
  kind: "gitlab",
@@ -108177,7 +108325,7 @@ const make$43 = Effect.gen(function* () {
108177
108325
  })))
108178
108326
  });
108179
108327
  });
108180
- Layer.effect(SourceControlProvider, make$43);
108328
+ Layer.effect(SourceControlProvider, make$44);
108181
108329
  //#endregion
108182
108330
  //#region src/sourceControl/SourceControlProviderRegistry.ts
108183
108331
  const PROVIDER_DETECTION_CACHE_CAPACITY = 2048;
@@ -108333,12 +108481,12 @@ const makeWithProviders = Effect.fn("makeSourceControlProviderRegistryWithProvid
108333
108481
  })), { concurrency: "unbounded" })
108334
108482
  });
108335
108483
  });
108336
- const make$42 = Effect.gen(function* () {
108337
- const github = yield* make$45;
108338
- const gitlab = yield* make$43;
108339
- const bitbucket = yield* make$47;
108484
+ const make$43 = Effect.gen(function* () {
108485
+ const github = yield* make$46;
108486
+ const gitlab = yield* make$44;
108487
+ const bitbucket = yield* make$48;
108340
108488
  const bitbucketDiscovery = yield* makeDiscovery;
108341
- const azureDevOps = yield* make$49;
108489
+ const azureDevOps = yield* make$50;
108342
108490
  return yield* makeWithProviders([
108343
108491
  {
108344
108492
  kind: "github",
@@ -108362,7 +108510,7 @@ const make$42 = Effect.gen(function* () {
108362
108510
  }
108363
108511
  ]);
108364
108512
  });
108365
- const layer$33 = Layer.effect(SourceControlProviderRegistry, make$42);
108513
+ const layer$34 = Layer.effect(SourceControlProviderRegistry, make$43);
108366
108514
  //#endregion
108367
108515
  //#region src/sourceControl/PrTemplateDetection.ts
108368
108516
  const TEMPLATE_MAX_BYTES = 8e3;
@@ -108733,7 +108881,7 @@ function toPullRequestHeadRemoteInfo(pr) {
108733
108881
  ...pr.headRepositoryOwnerLogin !== void 0 ? { headRepositoryOwnerLogin: pr.headRepositoryOwnerLogin } : {}
108734
108882
  };
108735
108883
  }
108736
- const make$41 = Effect.gen(function* () {
108884
+ const make$42 = Effect.gen(function* () {
108737
108885
  const gitCore = yield* GitVcsDriver;
108738
108886
  const sourceControlProviders = yield* SourceControlProviderRegistry;
108739
108887
  const textGeneration = yield* TextGeneration;
@@ -109707,7 +109855,7 @@ const make$41 = Effect.gen(function* () {
109707
109855
  runStackedAction
109708
109856
  });
109709
109857
  });
109710
- const layer$32 = Layer.effect(GitManager, make$41);
109858
+ const layer$33 = Layer.effect(GitManager, make$42);
109711
109859
  //#endregion
109712
109860
  //#region src/git/GitWorkflowService.ts
109713
109861
  var GitWorkflowService = class extends Context.Service()("@p4code/cli/git/GitWorkflowService") {};
@@ -109744,7 +109892,7 @@ function nonRepositoryListRefs() {
109744
109892
  totalCount: 0
109745
109893
  };
109746
109894
  }
109747
- const make$40 = Effect.gen(function* () {
109895
+ const make$41 = Effect.gen(function* () {
109748
109896
  const registry = yield* VcsDriverRegistry;
109749
109897
  const git = yield* GitVcsDriver;
109750
109898
  const gitManager = yield* GitManager;
@@ -109830,7 +109978,7 @@ const make$40 = Effect.gen(function* () {
109830
109978
  renameBranch: (input) => ensureGit("GitWorkflowService.renameBranch", input.cwd).pipe(Effect.andThen(git.renameBranch(input)))
109831
109979
  });
109832
109980
  });
109833
- const layer$31 = Layer.effect(GitWorkflowService, make$40);
109981
+ const layer$32 = Layer.effect(GitWorkflowService, make$41);
109834
109982
  //#endregion
109835
109983
  //#region src/pullRequest/PullRequestProvider.ts
109836
109984
  /**
@@ -110191,7 +110339,7 @@ function isReviewerName(value) {
110191
110339
  const name = value.trim();
110192
110340
  return name.length > 0 && !name.startsWith("-");
110193
110341
  }
110194
- const make$39 = Effect.gen(function* () {
110342
+ const make$40 = Effect.gen(function* () {
110195
110343
  const azure = yield* AzureDevOpsCli;
110196
110344
  const detectArgs = ["--detect", "true"];
110197
110345
  const executeJson = (input) => azure.execute({
@@ -110391,7 +110539,7 @@ const make$39 = Effect.gen(function* () {
110391
110539
  }).pipe(Effect.asVoid)
110392
110540
  });
110393
110541
  });
110394
- const layer$30 = Layer.effect(AzureDevOpsPullRequestCli, make$39);
110542
+ const layer$31 = Layer.effect(AzureDevOpsPullRequestCli, make$40);
110395
110543
  //#endregion
110396
110544
  //#region src/pullRequest/AzureDevOpsPullRequestProvider.ts
110397
110545
  const CAPABILITIES$3 = {
@@ -110466,7 +110614,7 @@ function toChangeRequest$1(pullRequest) {
110466
110614
  labels: []
110467
110615
  };
110468
110616
  }
110469
- const make$38 = Effect.gen(function* () {
110617
+ const make$39 = Effect.gen(function* () {
110470
110618
  const cli = yield* AzureDevOpsPullRequestCli;
110471
110619
  const fail = (operation) => (error) => new PullRequestProviderError({
110472
110620
  provider: "azure-devops",
@@ -111206,7 +111354,7 @@ function mergeStrategy(method) {
111206
111354
  default: return "merge_commit";
111207
111355
  }
111208
111356
  }
111209
- const make$37 = Effect.gen(function* () {
111357
+ const make$38 = Effect.gen(function* () {
111210
111358
  const bitbucket = yield* BitbucketApi;
111211
111359
  /**
111212
111360
  * The repository's own path, and the workspace above it — which the people who may review are
@@ -111486,7 +111634,7 @@ const make$37 = Effect.gen(function* () {
111486
111634
  }).pipe(Effect.asVoid))
111487
111635
  });
111488
111636
  });
111489
- const layer$29 = Layer.effect(BitbucketPullRequestApi, make$37);
111637
+ const layer$30 = Layer.effect(BitbucketPullRequestApi, make$38);
111490
111638
  //#endregion
111491
111639
  //#region src/pullRequest/BitbucketPullRequestProvider.ts
111492
111640
  const CAPABILITIES$2 = {
@@ -111566,7 +111714,7 @@ function toChangeRequest(pullRequest) {
111566
111714
  labels: []
111567
111715
  };
111568
111716
  }
111569
- const make$36 = Effect.gen(function* () {
111717
+ const make$37 = Effect.gen(function* () {
111570
111718
  const api = yield* BitbucketPullRequestApi;
111571
111719
  const fail = (operation) => (error) => new PullRequestProviderError({
111572
111720
  provider: "bitbucket",
@@ -113795,7 +113943,7 @@ function actionArgs$1(action, mergeMethod, updateMethod) {
113795
113943
  case "reopen": return ["reopen"];
113796
113944
  }
113797
113945
  }
113798
- const make$35 = Effect.gen(function* () {
113946
+ const make$36 = Effect.gen(function* () {
113799
113947
  const github = yield* GitHubCli;
113800
113948
  /**
113801
113949
  * The pull request's own node id, which is what a mutation against the pull request itself is
@@ -114558,7 +114706,7 @@ const make$35 = Effect.gen(function* () {
114558
114706
  })))
114559
114707
  });
114560
114708
  });
114561
- const layer$28 = Layer.effect(GitHubPullRequestCli, make$35);
114709
+ const layer$29 = Layer.effect(GitHubPullRequestCli, make$36);
114562
114710
  //#endregion
114563
114711
  //#region src/pullRequest/GitHubPullRequestProvider.ts
114564
114712
  const CAPABILITIES$1 = {
@@ -114675,7 +114823,7 @@ function loginAvatarUrl(login, host) {
114675
114823
  }
114676
114824
  /** True where markdown would render nothing: whitespace, or only HTML comments. */
114677
114825
  const rendersEmpty = (body) => body.replace(/<!--[\s\S]*?-->/g, "").trim().length === 0;
114678
- const make$34 = Effect.gen(function* () {
114826
+ const make$35 = Effect.gen(function* () {
114679
114827
  const cli = yield* GitHubPullRequestCli;
114680
114828
  const fail = (operation) => (error) => new PullRequestProviderError({
114681
114829
  provider: "github",
@@ -115697,7 +115845,7 @@ function actionArgs(action, mergeMethod) {
115697
115845
  case "reopen": return ["reopen"];
115698
115846
  }
115699
115847
  }
115700
- const make$33 = Effect.gen(function* () {
115848
+ const make$34 = Effect.gen(function* () {
115701
115849
  const gitlab = yield* GitLabCli;
115702
115850
  const api = (input) => gitlab.execute({
115703
115851
  cwd: input.cwd,
@@ -116268,7 +116416,7 @@ const make$33 = Effect.gen(function* () {
116268
116416
  }).pipe(Effect.asVoid)
116269
116417
  });
116270
116418
  });
116271
- const layer$27 = Layer.effect(GitLabPullRequestCli, make$33);
116419
+ const layer$28 = Layer.effect(GitLabPullRequestCli, make$34);
116272
116420
  //#endregion
116273
116421
  //#region src/pullRequest/GitLabPullRequestProvider.ts
116274
116422
  const CAPABILITIES = {
@@ -116348,7 +116496,7 @@ function reasonFor(error) {
116348
116496
  if (error._tag === "GitLabCliAuthenticationError") return "unauthenticated";
116349
116497
  return "failed";
116350
116498
  }
116351
- const make$32 = Effect.gen(function* () {
116499
+ const make$33 = Effect.gen(function* () {
116352
116500
  const cli = yield* GitLabPullRequestCli;
116353
116501
  const fail = (operation) => (error) => new PullRequestProviderError({
116354
116502
  provider: "gitlab",
@@ -116491,13 +116639,13 @@ function fromProviders(providers) {
116491
116639
  * The hosts this build can read change requests from. A host with no entry here still shows up
116492
116640
  * in the provider list as unimplemented, so its projects are explained rather than missing.
116493
116641
  */
116494
- const make$31 = Effect.map(Effect.all([
116495
- make$34,
116496
- make$32,
116497
- make$36,
116498
- make$38
116642
+ const make$32 = Effect.map(Effect.all([
116643
+ make$35,
116644
+ make$33,
116645
+ make$37,
116646
+ make$39
116499
116647
  ]), fromProviders);
116500
- const layer$26 = Layer.effect(PullRequestProviderRegistry, make$31).pipe(Layer.provide(layer$28.pipe(Layer.provide(layer$37))), Layer.provide(layer$27.pipe(Layer.provide(layer$35))), Layer.provide(layer$29.pipe(Layer.provide(layer$39))), Layer.provide(layer$30.pipe(Layer.provide(layer$41))));
116648
+ const layer$27 = Layer.effect(PullRequestProviderRegistry, make$32).pipe(Layer.provide(layer$29.pipe(Layer.provide(layer$38))), Layer.provide(layer$28.pipe(Layer.provide(layer$36))), Layer.provide(layer$30.pipe(Layer.provide(layer$40))), Layer.provide(layer$31.pipe(Layer.provide(layer$42))));
116501
116649
  //#endregion
116502
116650
  //#region src/pullRequest/PullRequestService.ts
116503
116651
  /**
@@ -116685,7 +116833,7 @@ function repositoryIdentityOf(project) {
116685
116833
  if (identity.displayName) return identity.displayName;
116686
116834
  return identity.owner && identity.name ? `${identity.owner}/${identity.name}` : null;
116687
116835
  }
116688
- const make$30 = Effect.gen(function* () {
116836
+ const make$31 = Effect.gen(function* () {
116689
116837
  const registry = yield* PullRequestProviderRegistry;
116690
116838
  const projections = yield* ProjectionSnapshotQuery;
116691
116839
  const sourceControlProviders = yield* SourceControlProviderRegistry;
@@ -117683,7 +117831,7 @@ const make$30 = Effect.gen(function* () {
117683
117831
  invalidate
117684
117832
  });
117685
117833
  });
117686
- const layer$25 = Layer.effect(PullRequestService, make$30);
117834
+ const layer$26 = Layer.effect(PullRequestService, make$31);
117687
117835
  //#endregion
117688
117836
  //#region src/orchestration/ThreadWorkspaceLifecycle.ts
117689
117837
  var ThreadWorkspaceLifecycleError = class extends Data.TaggedError("ThreadWorkspaceLifecycleError") {};
@@ -117727,7 +117875,7 @@ const mapLifecycleError = Effect.mapError((cause) => cause instanceof ThreadWork
117727
117875
  detail: "Thread workspace lifecycle operation failed.",
117728
117876
  cause
117729
117877
  }));
117730
- const make$29 = Effect.gen(function* () {
117878
+ const make$30 = Effect.gen(function* () {
117731
117879
  const snapshots = yield* ProjectionSnapshotQuery;
117732
117880
  const engine = yield* OrchestrationEngineService;
117733
117881
  const gitWorkflow = yield* GitWorkflowService;
@@ -117981,7 +118129,7 @@ const make$29 = Effect.gen(function* () {
117981
118129
  record
117982
118130
  };
117983
118131
  });
117984
- const layer$24 = Layer.effect(ThreadWorkspaceLifecycleService, make$29);
118132
+ const layer$25 = Layer.effect(ThreadWorkspaceLifecycleService, make$30);
117985
118133
  //#endregion
117986
118134
  //#region src/textGeneration/BtwRequestCoordinator.ts
117987
118135
  const MAX_PENDING_BTW_CANCELLATIONS = 256;
@@ -120254,7 +120402,7 @@ function makeUpdateState(input) {
120254
120402
  output: input.output ?? null
120255
120403
  };
120256
120404
  }
120257
- const make$28 = Effect.fn("ProviderMaintenanceRunner.make")(function* () {
120405
+ const make$29 = Effect.fn("ProviderMaintenanceRunner.make")(function* () {
120258
120406
  const providerRegistry = yield* ProviderRegistry;
120259
120407
  const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
120260
120408
  const httpClient = yield* HttpClient.HttpClient;
@@ -120369,7 +120517,7 @@ const make$28 = Effect.fn("ProviderMaintenanceRunner.make")(function* () {
120369
120517
  });
120370
120518
  return ProviderMaintenanceRunner.of({ updateProvider });
120371
120519
  });
120372
- const layer$23 = Layer.effect(ProviderMaintenanceRunner, make$28());
120520
+ const layer$24 = Layer.effect(ProviderMaintenanceRunner, make$29());
120373
120521
  //#endregion
120374
120522
  //#region src/usage/usageTranscripts.ts
120375
120523
  const EMPTY_TOTALS = {
@@ -121176,29 +121324,33 @@ const ScanCacheJson = Schema$1.fromJsonString(Schema$1.Unknown);
121176
121324
  const decodeScanCacheFile = Schema$1.decodeUnknownEffect(ScanCacheJson);
121177
121325
  const encodeScanCacheFile = Schema$1.encodeEffect(ScanCacheJson);
121178
121326
  var UsageService = class extends Context.Service()("@p4code/cli/usage/UsageService") {};
121179
- Layer.succeed(UsageService, UsageService.of({ readSummary: (input) => Effect.succeed({
121180
- contractVersion: 4,
121181
- readAt: "1970-01-01T00:00:00.000Z",
121182
- timeZone: input.timeZone,
121183
- sinceDay: input.sinceDay,
121184
- untilDay: input.untilDay,
121185
- buckets: [],
121186
- sources: [],
121187
- pricing: {
121188
- status: "unavailable",
121189
- source: LITELLM_RATES_URL,
121190
- fetchedAt: null,
121191
- knownModels: 0
121192
- },
121193
- scanDurationMs: 0
121194
- }) }));
121195
- const make$27 = Effect.gen(function* () {
121327
+ Layer.succeed(UsageService, UsageService.of({
121328
+ readSessionRecords: () => Effect.succeed([]),
121329
+ readSummary: (input) => Effect.succeed({
121330
+ contractVersion: 4,
121331
+ readAt: "1970-01-01T00:00:00.000Z",
121332
+ timeZone: input.timeZone,
121333
+ sinceDay: input.sinceDay,
121334
+ untilDay: input.untilDay,
121335
+ buckets: [],
121336
+ sources: [],
121337
+ pricing: {
121338
+ status: "unavailable",
121339
+ source: LITELLM_RATES_URL,
121340
+ fetchedAt: null,
121341
+ knownModels: 0
121342
+ },
121343
+ scanDurationMs: 0
121344
+ })
121345
+ }));
121346
+ const make$28 = Effect.gen(function* () {
121196
121347
  const fileSystem = yield* FileSystem.FileSystem;
121197
121348
  const path = yield* Path$1.Path;
121198
121349
  const config = yield* ServerConfig$1;
121199
121350
  const settingsService = yield* ServerSettingsService;
121200
121351
  const httpClient = yield* HttpClient.HttpClient;
121201
121352
  const fileCache = /* @__PURE__ */ new Map();
121353
+ const scanLock = yield* Semaphore.make(1);
121202
121354
  let cacheDirty = false;
121203
121355
  const ratesCachePath = path.join(config.stateDir, "usage-model-rates.json");
121204
121356
  const scanCachePath = path.join(config.stateDir, "usage-scan-cache.json");
@@ -121309,7 +121461,7 @@ const make$27 = Effect.gen(function* () {
121309
121461
  cacheDirty = true;
121310
121462
  return tailRecords.length === 0 ? records : [...records, ...tailRecords];
121311
121463
  });
121312
- return { readSummary: Effect.fn("UsageService.readSummary")(function* (input) {
121464
+ const readSummary = Effect.fn("UsageService.readSummary")(function* (input) {
121313
121465
  if (input.sinceDay > input.untilDay) return yield* new UsageReadError({
121314
121466
  reason: "invalidWindow",
121315
121467
  detail: `sinceDay '${input.sinceDay}' is after untilDay '${input.untilDay}'`
@@ -121432,9 +121584,49 @@ const make$27 = Effect.gen(function* () {
121432
121584
  },
121433
121585
  scanDurationMs: Math.max(0, finishedAtMs - startedAtMs)
121434
121586
  };
121435
- }) };
121587
+ });
121588
+ const readSessionRecords = Effect.fn("UsageService.readSessionRecords")(function* (input) {
121589
+ if (input.sessionIds.length === 0) return [];
121590
+ yield* ensureScanCacheLoaded;
121591
+ const { dirs } = yield* resolveTranscriptDirs().pipe(Effect.provideService(Path$1.Path, path));
121592
+ const roots = dirs.flatMap((root) => root.provider === "codex" ? [root, {
121593
+ ...root,
121594
+ dir: path.join(path.dirname(root.dir), "archived_sessions")
121595
+ }] : [root]);
121596
+ const sessions = new Set(input.sessionIds);
121597
+ const seen = /* @__PURE__ */ new Set();
121598
+ const records = [];
121599
+ for (const { provider, dir } of roots) {
121600
+ const files = yield* Effect.promise(() => listTranscriptFiles(dir, input.sinceMs - MTIME_SLACK_MS));
121601
+ for (const file of files) {
121602
+ if (!input.sessionIds.some((id) => file.path.includes(id))) continue;
121603
+ const rows = yield* readFileRecords(file.path, file.size, file.mtimeMs, provider);
121604
+ for (const record of rows) {
121605
+ if (!sessions.has(record.sessionId) || record.timestampMs < input.sinceMs) continue;
121606
+ if (record.dedupeKey !== null) {
121607
+ if (seen.has(record.dedupeKey)) continue;
121608
+ seen.add(record.dedupeKey);
121609
+ }
121610
+ records.push(record);
121611
+ }
121612
+ }
121613
+ }
121614
+ const now = yield* Clock.currentTimeMillis;
121615
+ if (pruneScanCache(fileCache, {
121616
+ livePaths: /* @__PURE__ */ new Set(),
121617
+ walkedRoots: [],
121618
+ windowStartMs: input.sinceMs,
121619
+ retentionCutoffMs: now - CACHE_RETENTION_DAYS * 24 * 60 * 60 * 1e3
121620
+ }) > 0) cacheDirty = true;
121621
+ yield* persistScanCache();
121622
+ return records;
121623
+ });
121624
+ return {
121625
+ readSummary: (input) => scanLock.withPermits(1)(readSummary(input)),
121626
+ readSessionRecords: (input) => scanLock.withPermits(1)(readSessionRecords(input))
121627
+ };
121436
121628
  });
121437
- const layer$22 = Layer.effect(UsageService, make$27);
121629
+ const layer$23 = Layer.effect(UsageService, make$28);
121438
121630
  //#endregion
121439
121631
  //#region src/feed/FeedStore.ts
121440
121632
  const storageFailure = (message) => new FeedError({
@@ -121798,7 +121990,7 @@ const jsonRequest = Effect.fn("FeedService.jsonRequest")(function* (url, token,
121798
121990
  catch: () => fail("hub_unavailable", "Hub returned invalid JSON.")
121799
121991
  });
121800
121992
  });
121801
- const make$26 = Effect.gen(function* () {
121993
+ const make$27 = Effect.gen(function* () {
121802
121994
  const hubLink = yield* HubLink;
121803
121995
  const providers = yield* ProviderInstanceRegistry;
121804
121996
  const config = yield* ServerConfig$1;
@@ -122036,7 +122228,7 @@ var FeedService = class extends Context.Reference("@p4code/cli/feed/FeedService"
122036
122228
  markRead: unavailable,
122037
122229
  cleanup: unavailable
122038
122230
  }) }) {};
122039
- const layer$21 = Layer.effect(FeedService, make$26);
122231
+ const layer$22 = Layer.effect(FeedService, make$27);
122040
122232
  const SKILL_MANIFEST_FILENAME = "SKILL.md";
122041
122233
  /**
122042
122234
  * Split a catalogue id (`owner/repo/skill-name`) into its parts.
@@ -122182,7 +122374,7 @@ const emptyFetch = (id, unavailable) => ({
122182
122374
  skipped: [],
122183
122375
  unavailable
122184
122376
  });
122185
- const make$25 = Effect.gen(function* () {
122377
+ const make$26 = Effect.gen(function* () {
122186
122378
  const http = yield* HttpClient.HttpClient;
122187
122379
  const request = Effect.fn("SkillRegistry.request")(function* (url) {
122188
122380
  return yield* http.execute(HttpClientRequest.get(url).pipe(HttpClientRequest.setHeader("accept", "application/json"), HttpClientRequest.setHeader("user-agent", "p4code"))).pipe(Effect.timeout(REQUEST_TIMEOUT_MS$1));
@@ -122253,7 +122445,7 @@ const make$25 = Effect.gen(function* () {
122253
122445
  fetch
122254
122446
  };
122255
122447
  });
122256
- const layer$20 = Layer.effect(SkillRegistry, make$25);
122448
+ const layer$21 = Layer.effect(SkillRegistry, make$26);
122257
122449
  //#endregion
122258
122450
  //#region src/mcp/PreviewAutomationBroker.ts
122259
122451
  var PreviewAutomationBroker = class extends Context.Service()("@p4code/cli/mcp/PreviewAutomationBroker") {};
@@ -122371,7 +122563,7 @@ const classifyResponseError = (context, error) => {
122371
122563
  });
122372
122564
  }
122373
122565
  };
122374
- const make$24 = Effect.gen(function* PreviewAutomationBrokerMake() {
122566
+ const make$25 = Effect.gen(function* PreviewAutomationBrokerMake() {
122375
122567
  const crypto = yield* Crypto.Crypto;
122376
122568
  const state = yield* SynchronizedRef.make({
122377
122569
  clients: /* @__PURE__ */ new Map(),
@@ -122605,7 +122797,7 @@ const make$24 = Effect.gen(function* PreviewAutomationBrokerMake() {
122605
122797
  invoke
122606
122798
  });
122607
122799
  }).pipe(Effect.withSpan("PreviewAutomationBroker.make"));
122608
- const layer$19 = Layer.effect(PreviewAutomationBroker, make$24);
122800
+ const layer$20 = Layer.effect(PreviewAutomationBroker, make$25);
122609
122801
  //#endregion
122610
122802
  //#region src/preview/Manager.ts
122611
122803
  /**
@@ -122669,7 +122861,7 @@ const buildIdleSnapshot = (input) => ({
122669
122861
  viewport: FILL_PREVIEW_VIEWPORT,
122670
122862
  updatedAt: input.updatedAt
122671
122863
  });
122672
- const make$23 = Effect.gen(function* PreviewManagerMake() {
122864
+ const make$24 = Effect.gen(function* PreviewManagerMake() {
122673
122865
  const serverEpoch = NodeCrypto.randomUUID();
122674
122866
  const stateRef = yield* SynchronizedRef.make(initialState);
122675
122867
  const eventsPubSub = yield* PubSub.unbounded();
@@ -122900,7 +123092,7 @@ const make$23 = Effect.gen(function* PreviewManagerMake() {
122900
123092
  subscribeEvents: PubSub.subscribe(eventsPubSub)
122901
123093
  });
122902
123094
  }).pipe(Effect.withSpan("PreviewManager.make"));
122903
- const layer$18 = Layer.effect(PreviewManager, make$23);
123095
+ const layer$19 = Layer.effect(PreviewManager, make$24);
122904
123096
  //#endregion
122905
123097
  //#region src/workspace/WorkspaceSearchIndex.ts
122906
123098
  const WORKSPACE_INDEX_MAX_ENTRIES = 25e3;
@@ -123037,7 +123229,7 @@ const waitForScan = (cwd, finder, onFailure) => Effect.try({
123037
123229
  timeout: WORKSPACE_INDEX_SCAN_TIMEOUT
123038
123230
  })
123039
123231
  }), Effect.withSpan("WorkspaceSearchIndex.waitForScan"));
123040
- const make$22 = Effect.fn("WorkspaceSearchIndex.make")(function* (cwd, contentSearch = false) {
123232
+ const make$23 = Effect.fn("WorkspaceSearchIndex.make")(function* (cwd, contentSearch = false) {
123041
123233
  const finder = yield* Effect.acquireRelease(createFinder(cwd, contentSearch), (finder) => Effect.try({
123042
123234
  try: () => finder.destroy(),
123043
123235
  catch: (cause) => new WorkspaceSearchIndexDestroyFailed({
@@ -123177,14 +123369,14 @@ const make$22 = Effect.fn("WorkspaceSearchIndex.make")(function* (cwd, contentSe
123177
123369
  * workspace root. WorkspaceSearchIndexMap owns memoization and idle cleanup;
123178
123370
  * using a default cwd here would mix resources from different workspaces.
123179
123371
  */
123180
- const layer$17 = (cwd) => Layer.effect(WorkspaceSearchIndex, make$22(cwd));
123372
+ const layer$18 = (cwd) => Layer.effect(WorkspaceSearchIndex, make$23(cwd));
123181
123373
  var WorkspaceSearchIndexMap = class extends LayerMap.Service()("@p4code/cli/workspace/WorkspaceSearchIndexMap", {
123182
- lookup: layer$17,
123374
+ lookup: layer$18,
123183
123375
  idleTimeToLive: WORKSPACE_INDEX_IDLE_TTL
123184
123376
  }) {};
123185
123377
  /** Content indexing is allocated only when workspace content search is used. */
123186
123378
  var WorkspaceContentSearchIndexMap = class extends LayerMap.Service()("@p4code/cli/workspace/WorkspaceContentSearchIndexMap", {
123187
- lookup: (cwd) => Layer.effect(WorkspaceSearchIndex, make$22(cwd, true)),
123379
+ lookup: (cwd) => Layer.effect(WorkspaceSearchIndex, make$23(cwd, true)),
123188
123380
  idleTimeToLive: WORKSPACE_INDEX_IDLE_TTL
123189
123381
  }) {};
123190
123382
  //#endregion
@@ -123246,7 +123438,7 @@ const resolveBrowseTarget = Effect.fn("WorkspaceEntries.resolveBrowseTarget")(fu
123246
123438
  if (!input.cwd) return yield* new WorkspaceEntriesCurrentProjectRequiredError({ partialPath: input.partialPath });
123247
123439
  return path.resolve(expandHomePath$1(input.cwd, path), input.partialPath);
123248
123440
  });
123249
- const make$21 = Effect.gen(function* () {
123441
+ const make$22 = Effect.gen(function* () {
123250
123442
  const path = yield* Path$1.Path;
123251
123443
  const workspacePaths = yield* WorkspacePaths;
123252
123444
  const contentSearchIndexes = yield* WorkspaceContentSearchIndexMap;
@@ -123328,7 +123520,7 @@ const make$21 = Effect.gen(function* () {
123328
123520
  searchContents
123329
123521
  });
123330
123522
  });
123331
- const layer$16 = Layer.effect(WorkspaceEntries, make$21).pipe(Layer.provide(WorkspaceSearchIndexMap.layer), Layer.provide(WorkspaceContentSearchIndexMap.layer));
123523
+ const layer$17 = Layer.effect(WorkspaceEntries, make$22).pipe(Layer.provide(WorkspaceSearchIndexMap.layer), Layer.provide(WorkspaceContentSearchIndexMap.layer));
123332
123524
  //#endregion
123333
123525
  //#region src/workspace/WorkspaceFileSystem.ts
123334
123526
  /**
@@ -123387,7 +123579,7 @@ Schema$1.Union([
123387
123579
  ]);
123388
123580
  /** Service tag for workspace file operations. */
123389
123581
  var WorkspaceFileSystem = class extends Context.Service()("@p4code/cli/workspace/WorkspaceFileSystem") {};
123390
- const make$20 = Effect.gen(function* () {
123582
+ const make$21 = Effect.gen(function* () {
123391
123583
  const fileSystem = yield* FileSystem.FileSystem;
123392
123584
  const path = yield* Path$1.Path;
123393
123585
  const workspacePaths = yield* WorkspacePaths;
@@ -123531,7 +123723,7 @@ const make$20 = Effect.gen(function* () {
123531
123723
  writeFile
123532
123724
  });
123533
123725
  });
123534
- const layer$15 = Layer.effect(WorkspaceFileSystem, make$20);
123726
+ const layer$16 = Layer.effect(WorkspaceFileSystem, make$21);
123535
123727
  //#endregion
123536
123728
  //#region src/vcs/VcsStatusBroadcaster.ts
123537
123729
  const DEFAULT_VCS_STATUS_REFRESH_INTERVAL = Duration.seconds(30);
@@ -123613,7 +123805,7 @@ const autoPullPolicyLayer = Layer.effect(VcsAutoPullPolicy, Effect.gen(function*
123613
123805
  return resolveProjectAutoPull(yield* settingsService.getSettings, project.value.id);
123614
123806
  }, Effect.orElseSucceed(() => false)) };
123615
123807
  }));
123616
- const make$19 = Effect.gen(function* () {
123808
+ const make$20 = Effect.gen(function* () {
123617
123809
  const autoPullPolicy = yield* VcsAutoPullPolicy;
123618
123810
  const workflow = yield* GitWorkflowService;
123619
123811
  const fs = yield* FileSystem.FileSystem;
@@ -123872,7 +124064,7 @@ const make$19 = Effect.gen(function* () {
123872
124064
  streamStatus
123873
124065
  });
123874
124066
  });
123875
- const layer$14 = Layer.effect(VcsStatusBroadcaster, make$19);
124067
+ const layer$15 = Layer.effect(VcsStatusBroadcaster, make$20);
123876
124068
  //#endregion
123877
124069
  //#region src/vcs/VcsProvisioningService.ts
123878
124070
  var VcsProvisioningService = class extends Context.Service()("@p4code/cli/vcs/VcsProvisioningService") {};
@@ -123885,7 +124077,7 @@ function resolveRequestedKind(kind) {
123885
124077
  }));
123886
124078
  return Effect.succeed(kind);
123887
124079
  }
123888
- const make$18 = Effect.gen(function* () {
124080
+ const make$19 = Effect.gen(function* () {
123889
124081
  const registry = yield* VcsDriverRegistry;
123890
124082
  const initRepository = Effect.fn("VcsProvisioningService.initRepository")(function* (input) {
123891
124083
  const kind = yield* resolveRequestedKind(input.kind);
@@ -123893,11 +124085,11 @@ const make$18 = Effect.gen(function* () {
123893
124085
  });
123894
124086
  return VcsProvisioningService.of({ initRepository });
123895
124087
  });
123896
- const layer$13 = Layer.effect(VcsProvisioningService, make$18);
124088
+ const layer$14 = Layer.effect(VcsProvisioningService, make$19);
123897
124089
  //#endregion
123898
124090
  //#region src/review/ReviewService.ts
123899
124091
  var ReviewService = class extends Context.Service()("@p4code/cli/review/ReviewService") {};
123900
- const make$17 = Effect.gen(function* () {
124092
+ const make$18 = Effect.gen(function* () {
123901
124093
  const config = yield* ServerConfig$1;
123902
124094
  const fileSystem = yield* FileSystem.FileSystem;
123903
124095
  const path = yield* Path$1.Path;
@@ -123953,7 +124145,7 @@ const make$17 = Effect.gen(function* () {
123953
124145
  });
123954
124146
  return ReviewService.of({ getDiffPreview });
123955
124147
  });
123956
- const layer$12 = Layer.effect(ReviewService, make$17);
124148
+ const layer$13 = Layer.effect(ReviewService, make$18);
123957
124149
  //#endregion
123958
124150
  //#region src/diagnostics/ProcessDiagnostics.ts
123959
124151
  const PROCESS_QUERY_TIMEOUT_MS = 1e3;
@@ -124248,7 +124440,7 @@ function assertDescendantPid(pid) {
124248
124440
  }));
124249
124441
  }));
124250
124442
  }
124251
- const make$16 = Effect.gen(function* () {
124443
+ const make$17 = Effect.gen(function* () {
124252
124444
  const spawner = yield* ChildProcessSpawner$1.ChildProcessSpawner;
124253
124445
  const read = Effect.gen(function* () {
124254
124446
  const readAt = yield* DateTime.now;
@@ -124292,7 +124484,7 @@ const make$16 = Effect.gen(function* () {
124292
124484
  signal
124293
124485
  });
124294
124486
  });
124295
- const layer$11 = Layer.effect(ProcessDiagnostics, make$16);
124487
+ const layer$12 = Layer.effect(ProcessDiagnostics, make$17);
124296
124488
  //#endregion
124297
124489
  //#region src/diagnostics/ProcessResourceMonitor.ts
124298
124490
  const SAMPLE_INTERVAL_MS = 5e3;
@@ -124443,7 +124635,7 @@ function aggregateProcessResourceHistory(input) {
124443
124635
  }) : Option.none()
124444
124636
  };
124445
124637
  }
124446
- const make$15 = Effect.gen(function* () {
124638
+ const make$16 = Effect.gen(function* () {
124447
124639
  const spawner = yield* ChildProcessSpawner$1.ChildProcessSpawner;
124448
124640
  const state = yield* Ref.make({
124449
124641
  samples: [],
@@ -124492,7 +124684,7 @@ const make$15 = Effect.gen(function* () {
124492
124684
  });
124493
124685
  return ProcessResourceMonitor.of({ readHistory });
124494
124686
  });
124495
- const layer$10 = Layer.effect(ProcessResourceMonitor, make$15);
124687
+ const layer$11 = Layer.effect(ProcessResourceMonitor, make$16);
124496
124688
  //#endregion
124497
124689
  //#region src/diagnostics/TraceDiagnostics.ts
124498
124690
  var TraceFileReadError = class extends Schema$1.TaggedErrorClass()("TraceFileReadError", {
@@ -124740,7 +124932,7 @@ function readTraceFile(fileSystem, path) {
124740
124932
  cause
124741
124933
  })) }));
124742
124934
  }
124743
- const make$14 = Effect.gen(function* () {
124935
+ const make$15 = Effect.gen(function* () {
124744
124936
  const fileSystem = yield* FileSystem.FileSystem;
124745
124937
  const read = Effect.fn("TraceDiagnostics.read")(function* (options) {
124746
124938
  const readAt = options.readAt ?? (yield* DateTime.now);
@@ -124784,7 +124976,7 @@ const make$14 = Effect.gen(function* () {
124784
124976
  });
124785
124977
  return TraceDiagnostics.of({ read });
124786
124978
  });
124787
- const layer$9 = Layer.effect(TraceDiagnostics, make$14);
124979
+ const layer$10 = Layer.effect(TraceDiagnostics, make$15);
124788
124980
  function readTraceDiagnostics(options) {
124789
124981
  return Effect.gen(function* () {
124790
124982
  return yield* (yield* TraceDiagnostics).read(options);
@@ -124819,7 +125011,7 @@ function snapshotFromDetail(link, detail, syncedAt) {
124819
125011
  mergeability: detail.mergeability
124820
125012
  };
124821
125013
  }
124822
- const make$13 = Effect.gen(function* () {
125014
+ const make$14 = Effect.gen(function* () {
124823
125015
  const engine = yield* OrchestrationEngineService;
124824
125016
  const projections = yield* ProjectionSnapshotQuery;
124825
125017
  const pullRequests = yield* PullRequestService;
@@ -124913,7 +125105,7 @@ const make$13 = Effect.gen(function* () {
124913
125105
  };
124914
125106
  });
124915
125107
  var PullRequestSyncReactor = class extends Context.Service()("@p4code/cli/orchestration/Layers/PullRequestSyncReactor") {};
124916
- const PullRequestSyncReactorLive = Layer.effect(PullRequestSyncReactor, make$13);
125108
+ const PullRequestSyncReactorLive = Layer.effect(PullRequestSyncReactor, make$14);
124917
125109
  //#endregion
124918
125110
  //#region src/sourceControl/SourceControlDiscovery.ts
124919
125111
  const VCS_PROBES = [{
@@ -124932,7 +125124,7 @@ const VCS_PROBES = [{
124932
125124
  installHint: "Install Jujutsu with `brew install jj` or from https://github.com/jj-vcs/jj."
124933
125125
  }];
124934
125126
  var SourceControlDiscovery = class extends Context.Service()("@p4code/cli/sourceControl/SourceControlDiscovery") {};
124935
- const make$12 = Effect.gen(function* () {
125127
+ const make$13 = Effect.gen(function* () {
124936
125128
  const config = yield* ServerConfig$1;
124937
125129
  const process = yield* VcsProcess;
124938
125130
  const sourceControlProviders = yield* SourceControlProviderRegistry;
@@ -124981,7 +125173,7 @@ const make$12 = Effect.gen(function* () {
124981
125173
  sourceControlProviders: sourceControlProviders.discover
124982
125174
  }) });
124983
125175
  });
124984
- const layer$8 = Layer.effect(SourceControlDiscovery, make$12);
125176
+ const layer$9 = Layer.effect(SourceControlDiscovery, make$13);
124985
125177
  //#endregion
124986
125178
  //#region src/sourceControl/SourceControlRepositoryService.ts
124987
125179
  const isSourceControlRepositoryError = Schema$1.is(SourceControlRepositoryError);
@@ -125014,7 +125206,7 @@ function expandHomePath(input, path) {
125014
125206
  if (input.startsWith("~/") || input.startsWith("~\\")) return path.join(NodeOS.homedir(), input.slice(2));
125015
125207
  return input;
125016
125208
  }
125017
- const make$11 = Effect.gen(function* () {
125209
+ const make$12 = Effect.gen(function* () {
125018
125210
  const config = yield* ServerConfig$1;
125019
125211
  const fileSystem = yield* FileSystem.FileSystem;
125020
125212
  const git = yield* GitVcsDriver;
@@ -125153,7 +125345,7 @@ const make$11 = Effect.gen(function* () {
125153
125345
  publishRepository: (input) => publishRepository(input).pipe(mapRepositoryError("publishRepository", input.provider))
125154
125346
  });
125155
125347
  });
125156
- const layer$7 = Layer.effect(SourceControlRepositoryService, make$11);
125348
+ const layer$8 = Layer.effect(SourceControlRepositoryService, make$12);
125157
125349
  //#endregion
125158
125350
  //#region src/ws.ts
125159
125351
  /** Matches `p4c hub token add`, so a token minted here and one minted there are the same thing. */
@@ -126593,7 +126785,7 @@ const websocketRpcRouteLayer = Layer.unwrap(Effect.gen(function* () {
126593
126785
  const serverAuth = yield* EnvironmentAuth;
126594
126786
  const sessions = yield* SessionStore;
126595
126787
  const session = yield* serverAuth.authenticateWebSocketUpgrade(request).pipe(Effect.catchIf(isServerAuthCredentialError, (error) => failEnvironmentAuthInvalid(serverAuthCredentialReason(error))), Effect.catchIf(isServerAuthInternalError, (error) => failEnvironmentInternal("internal_error", error)));
126596
- const rpcWebSocketHttpEffect = yield* RpcServer.toHttpEffectWebsocket(WsRpcGroup, { disableTracing: true }).pipe(Effect.provide(makeWsRpcLayer(session, previewAutomationBroker, computerUseBroker).pipe(Layer.provideMerge(RpcSerialization.layerJson), Layer.provide(layer$23), Layer.provide(Layer.succeed(ServerSelfUpdate, serverSelfUpdate)), Layer.provide(Layer.succeed(PullRequestService, pullRequests)), Layer.provide(Layer.succeed(TaskRepositoryRegistry, taskRepositories)), Layer.provide(Layer.succeed(ProjectionProjectRepository, projectionProjects)), Layer.provide(Layer.succeed(P4ProjectFileLoader, p4ProjectFileLoader)), Layer.provide(layer$8.pipe(Layer.provide(layer$33.pipe(Layer.provide(Layer.mergeAll(layer$41, layer$39, layer$37, layer$35)), Layer.provideMerge(layer$49), Layer.provide(layer$47.pipe(Layer.provide(layer$48))))), Layer.provide(layer$50))))));
126788
+ const rpcWebSocketHttpEffect = yield* RpcServer.toHttpEffectWebsocket(WsRpcGroup, { disableTracing: true }).pipe(Effect.provide(makeWsRpcLayer(session, previewAutomationBroker, computerUseBroker).pipe(Layer.provideMerge(RpcSerialization.layerJson), Layer.provide(layer$24), Layer.provide(Layer.succeed(ServerSelfUpdate, serverSelfUpdate)), Layer.provide(Layer.succeed(PullRequestService, pullRequests)), Layer.provide(Layer.succeed(TaskRepositoryRegistry, taskRepositories)), Layer.provide(Layer.succeed(ProjectionProjectRepository, projectionProjects)), Layer.provide(Layer.succeed(P4ProjectFileLoader, p4ProjectFileLoader)), Layer.provide(layer$9.pipe(Layer.provide(layer$34.pipe(Layer.provide(Layer.mergeAll(layer$42, layer$40, layer$38, layer$36)), Layer.provideMerge(layer$50), Layer.provide(layer$48.pipe(Layer.provide(layer$49))))), Layer.provide(layer$51))))));
126597
126789
  return yield* Effect.acquireUseRelease(sessions.markConnected(session.sessionId), () => rpcWebSocketHttpEffect, () => sessions.markDisconnected(session.sessionId));
126598
126790
  }).pipe(Effect.catchTags({
126599
126791
  EnvironmentAuthInvalidError: HttpServerRespondable.toResponse,
@@ -126658,7 +126850,7 @@ function toPersistenceSqlOrDecodeError(sqlOperation, decodeOperation, correlatio
126658
126850
  cause
126659
126851
  });
126660
126852
  }
126661
- const make$10 = Effect.gen(function* () {
126853
+ const make$11 = Effect.gen(function* () {
126662
126854
  const sql = yield* SqlClient.SqlClient;
126663
126855
  const upsertRuntimeRow = SqlSchema.void({
126664
126856
  Request: ProviderSessionRuntimeDbRowSchema,
@@ -126761,7 +126953,7 @@ const make$10 = Effect.gen(function* () {
126761
126953
  deleteByThreadId
126762
126954
  };
126763
126955
  });
126764
- const layer$6 = Layer.effect(ProviderSessionRuntimeRepository, make$10);
126956
+ const layer$7 = Layer.effect(ProviderSessionRuntimeRepository, make$11);
126765
126957
  //#endregion
126766
126958
  //#region src/provider/Layers/ProviderSessionDirectory.ts
126767
126959
  const decodeProviderDriverKindValue = Schema$1.decodeUnknownEffect(ProviderDriverKind);
@@ -127214,7 +127406,7 @@ const makeWithOptions = Effect.fn("McpSessionRegistry.make")(function* (options
127214
127406
  });
127215
127407
  });
127216
127408
  let activeMcpSessionRegistry;
127217
- const make$9 = Effect.acquireRelease(Effect.gen(function* () {
127409
+ const make$10 = Effect.acquireRelease(Effect.gen(function* () {
127218
127410
  const broker = yield* Effect.serviceOption(ComputerUseBroker);
127219
127411
  return yield* makeWithOptions(Option.isSome(broker) ? { onRevoke: broker.value.invalidate } : {});
127220
127412
  }).pipe(Effect.tap((registry) => Effect.sync(() => {
@@ -127222,7 +127414,7 @@ const make$9 = Effect.acquireRelease(Effect.gen(function* () {
127222
127414
  }))), (registry) => registry.revokeAll.pipe(Effect.andThen(Effect.sync(() => {
127223
127415
  if (activeMcpSessionRegistry === registry) activeMcpSessionRegistry = void 0;
127224
127416
  }))));
127225
- const layer$5 = Layer.effect(McpSessionRegistry, make$9);
127417
+ const layer$6 = Layer.effect(McpSessionRegistry, make$10);
127226
127418
  const issueActiveMcpCredential = (request) => activeMcpSessionRegistry ? activeMcpSessionRegistry.revokeThread(request.threadId).pipe(Effect.andThen(activeMcpSessionRegistry.issue(request))) : Effect.sync(() => void 0);
127227
127419
  /**
127228
127420
  * Refreshes the liveness of a thread's MCP credential. Called on every provider
@@ -128629,7 +128821,7 @@ const stringField = (record, key) => {
128629
128821
  const value = record[key];
128630
128822
  return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
128631
128823
  };
128632
- const make$8 = Effect.gen(function* () {
128824
+ const make$9 = Effect.gen(function* () {
128633
128825
  const linear = yield* LinearClient;
128634
128826
  return { resolve: Effect.fn("TicketResolver.resolve")(function* (reference) {
128635
128827
  const identifier = parseTicketReference(reference);
@@ -128660,7 +128852,7 @@ const make$8 = Effect.gen(function* () {
128660
128852
  };
128661
128853
  }) };
128662
128854
  });
128663
- const layer$4 = Layer.effect(TicketResolver, make$8);
128855
+ const layer$5 = Layer.effect(TicketResolver, make$9);
128664
128856
  //#endregion
128665
128857
  //#region src/mcp/toolkits/tasks/tools.ts
128666
128858
  const dependencies = [McpInvocationContext, TaskRepository];
@@ -130001,6 +130193,34 @@ const ThreadToolkitHandlersLive = ThreadToolkit.toLayer({
130001
130193
  })
130002
130194
  });
130003
130195
  //#endregion
130196
+ //#region src/orchestration/FusionBudgetPause.ts
130197
+ const pauseFusionBudget = Effect.fn("pauseFusionBudget")(function* (input) {
130198
+ const engine = yield* OrchestrationEngineService;
130199
+ const epoch = input.pair.reviewExperiment?.lastMessageSequence ?? 0;
130200
+ for (const threadId of [input.pair.implementerThreadId, input.pair.watcherThreadId]) {
130201
+ const id = `fusion-budget:${input.pair.id}:${epoch}:${threadId}`;
130202
+ yield* engine.dispatch({
130203
+ type: "thread.activity.append",
130204
+ commandId: CommandId.make(id),
130205
+ threadId,
130206
+ activity: {
130207
+ id: EventId.make(id),
130208
+ tone: "info",
130209
+ kind: "fusion.pair.paused",
130210
+ summary: `Fusion paused: ${input.reason}`,
130211
+ payload: {
130212
+ pairId: input.pair.id,
130213
+ reason: "review-budget",
130214
+ experiment: input.pair.reviewExperiment
130215
+ },
130216
+ turnId: null,
130217
+ createdAt: input.createdAt
130218
+ },
130219
+ createdAt: input.createdAt
130220
+ });
130221
+ }
130222
+ });
130223
+ //#endregion
130004
130224
  //#region src/mcp/toolkits/advise/tools.ts
130005
130225
  /**
130006
130226
  * The write half of cross-thread access, and the reason advise is its own
@@ -130104,6 +130324,22 @@ const AdviseToolkitHandlersLive = AdviseToolkit.toLayer({
130104
130324
  };
130105
130325
  }
130106
130326
  const createdAt = DateTime.formatIso(yield* DateTime.now);
130327
+ const activePair = readModel.threadPairs?.find((pair) => pair.detachedAt === null && pair.implementerThreadId === input.threadId);
130328
+ const budgetBlock = activePair && fusionBudgetBlock(activePair, input.threadId, `[fusion-advice] ${input.message}`);
130329
+ if (budgetBlock && activePair) {
130330
+ yield* pauseFusionBudget({
130331
+ pair: activePair,
130332
+ reason: budgetBlock,
130333
+ createdAt
130334
+ }).pipe(Effect.mapError((cause) => new ThreadAdviseFailedError({
130335
+ threadId: input.threadId,
130336
+ detail: cause.message
130337
+ })));
130338
+ return yield* new ThreadAdviseFailedError({
130339
+ threadId: input.threadId,
130340
+ detail: budgetBlock
130341
+ });
130342
+ }
130107
130343
  const interrupted = input.interrupt === true;
130108
130344
  if (interrupted) yield* dispatchAdvise({
130109
130345
  type: "thread.turn.interrupt",
@@ -130391,7 +130627,7 @@ const ComputerUseMcpLive = ComputerUseToolkitRegistrationLive.pipe(Layer.provide
130391
130627
  version: version$1,
130392
130628
  path: "/mcp/computer-use"
130393
130629
  }).pipe(Layer.provide(McpAuthMiddlewareLive))));
130394
- const layer$3 = Layer.mergeAll(Layer.fresh(StandardMcpLive), Layer.fresh(ComputerUseMcpLive));
130630
+ const layer$4 = Layer.mergeAll(Layer.fresh(StandardMcpLive), Layer.fresh(ComputerUseMcpLive));
130395
130631
  //#endregion
130396
130632
  //#region src/hub/HubActivityTransport.ts
130397
130633
  const REQUEST_TIMEOUT_MS = 8e3;
@@ -130681,7 +130917,7 @@ const runHubActivityEmission = Effect.fn("HubActivityRuntime.run")(function* (se
130681
130917
  const outbound = yield* makeHubActivityOutbound(identity.destination);
130682
130918
  yield* runHubActivityTick(outbound, transport, identity).pipe(Effect.tap(() => ready), Effect.repeat(Schedule.spaced(Duration.millis(HUB_ACTIVITY_INTERVAL_MS))));
130683
130919
  });
130684
- const layer$2 = Layer.effectDiscard(Effect.gen(function* () {
130920
+ const layer$3 = Layer.effectDiscard(Effect.gen(function* () {
130685
130921
  yield* runHubTunnelReconnect((yield* HubLink).changes, (settings, ready) => runHubActivityEmission(settings, ready).pipe(Effect.mapError((error) => error instanceof HubActivityUnauthorized ? new HubUnauthorizedError() : error))).pipe(Effect.forkScoped);
130686
130922
  }));
130687
130923
  //#endregion
@@ -131506,7 +131742,7 @@ const runHubTunnelOutbound = Effect.fn("HubTunnelOutbound.run")(function* (setti
131506
131742
  yield* runHubTunnelPump(lease, socket, makeHubTunnelEnvironmentDispatch(localOrigin));
131507
131743
  }));
131508
131744
  });
131509
- const layer$1 = Layer.effectDiscard(Effect.gen(function* () {
131745
+ const layer$2 = Layer.effectDiscard(Effect.gen(function* () {
131510
131746
  const link = yield* HubLink;
131511
131747
  const server = yield* HttpServer.HttpServer;
131512
131748
  if (server.address._tag !== "TcpAddress") return;
@@ -131578,7 +131814,7 @@ const COMPLETION_SWEEP_BATCH_SIZE = 25;
131578
131814
  const COMPLETION_SWEEP_INTERVAL = Duration.minutes(1);
131579
131815
  const COMPLETION_PR_TIMEOUT = Duration.seconds(10);
131580
131816
  const MILLISECONDS_PER_DAY = 1440 * 60 * 1e3;
131581
- const make$7 = Effect.gen(function* () {
131817
+ const make$8 = Effect.gen(function* () {
131582
131818
  const sql = yield* SqlClient.SqlClient;
131583
131819
  const settings = yield* ServerSettingsService;
131584
131820
  const git = yield* GitManager;
@@ -131665,7 +131901,7 @@ const make$7 = Effect.gen(function* () {
131665
131901
  };
131666
131902
  });
131667
131903
  var ThreadCompletionReactor = class extends Context.Service()("@p4code/cli/orchestration/Layers/ThreadCompletionReactor") {};
131668
- const ThreadCompletionReactorLive = Layer.effect(ThreadCompletionReactor, make$7);
131904
+ const ThreadCompletionReactorLive = Layer.effect(ThreadCompletionReactor, make$8);
131669
131905
  //#endregion
131670
131906
  //#region src/orchestration/Services/ScheduledTaskReactor.ts
131671
131907
  /**
@@ -131702,6 +131938,238 @@ const makeOrchestrationReactor = Effect.gen(function* () {
131702
131938
  });
131703
131939
  const OrchestrationReactorLive = Layer.effect(OrchestrationReactor, makeOrchestrationReactor);
131704
131940
  //#endregion
131941
+ //#region src/usage/fusionObservation.ts
131942
+ const OBSERVATION_DAY_MS = 1440 * 60 * 1e3;
131943
+ const REVIEW_RATIO_THRESHOLD = .5;
131944
+ const REVIEW_COUNT_THRESHOLD = 10;
131945
+ const MILLISECONDS_PER_MINUTE = 60 * 1e3;
131946
+ function emptyRole() {
131947
+ return {
131948
+ turns: 0,
131949
+ failedTurns: 0,
131950
+ turnsWithUsage: 0,
131951
+ activeMinutes: 0,
131952
+ tokens: { ...EMPTY_TOTALS }
131953
+ };
131954
+ }
131955
+ function observationWeek(date) {
131956
+ const instant = DateTime.makeUnsafe(date);
131957
+ const daysSinceMonday = (DateTime.getPartUtc(instant, "weekDay") + 7 - 1) % 7;
131958
+ return DateTime.formatIso(DateTime.makeUnsafe(DateTime.toEpochMillis(instant) - daysSinceMonday * OBSERVATION_DAY_MS)).slice(0, 10);
131959
+ }
131960
+ /** Role consumption is descriptive; it cannot estimate a counterfactual solo run. */
131961
+ function buildFusionObservation(input) {
131962
+ const sinceMs = Date.parse(input.since);
131963
+ const untilMs = Date.parse(input.generatedAt);
131964
+ const pairs = /* @__PURE__ */ new Map();
131965
+ const sessions = /* @__PURE__ */ new Map();
131966
+ let missingSessionTurns = 0;
131967
+ for (const turn of input.turns) {
131968
+ const start = Math.max(sinceMs, Date.parse(turn.startedAt), Date.parse(turn.pairCreatedAt));
131969
+ const end = Math.min(untilMs, Date.parse(turn.completedAt), turn.detachedAt === null ? untilMs : Date.parse(turn.detachedAt));
131970
+ if (!Number.isFinite(start) || !Number.isFinite(end) || end < start) continue;
131971
+ let pair = pairs.get(turn.pairId);
131972
+ if (!pair) {
131973
+ pair = {
131974
+ pairId: turn.pairId,
131975
+ reviewPolicy: turn.reviewPolicy ?? null,
131976
+ builder: emptyRole(),
131977
+ review: emptyRole(),
131978
+ supervisorOther: emptyRole()
131979
+ };
131980
+ pairs.set(turn.pairId, pair);
131981
+ }
131982
+ const role = turn.role === "builder" ? pair.builder : turn.trigger === "review" || turn.trigger === "gate" ? pair.review : pair.supervisorOther;
131983
+ role.turns += 1;
131984
+ role.failedTurns += Number(turn.state !== "completed");
131985
+ role.activeMinutes += (end - start) / MILLISECONDS_PER_MINUTE;
131986
+ if (turn.sessionId === null) {
131987
+ missingSessionTurns += 1;
131988
+ continue;
131989
+ }
131990
+ const entries = sessions.get(turn.sessionId) ?? [];
131991
+ entries.push({
131992
+ start,
131993
+ end,
131994
+ role,
131995
+ observed: false
131996
+ });
131997
+ sessions.set(turn.sessionId, entries);
131998
+ }
131999
+ let unattributedRecords = 0;
132000
+ let ambiguousRecords = 0;
132001
+ const seen = /* @__PURE__ */ new Set();
132002
+ for (const record of input.records) {
132003
+ if (record.timestampMs < sinceMs || record.timestampMs > untilMs) continue;
132004
+ if (record.dedupeKey !== null) {
132005
+ if (seen.has(record.dedupeKey)) continue;
132006
+ seen.add(record.dedupeKey);
132007
+ }
132008
+ const matching = (sessions.get(record.sessionId) ?? []).filter((turn) => record.timestampMs >= turn.start && record.timestampMs <= turn.end);
132009
+ if (matching.length !== 1) {
132010
+ unattributedRecords += 1;
132011
+ if (matching.length > 1) ambiguousRecords += 1;
132012
+ continue;
132013
+ }
132014
+ const match = matching[0];
132015
+ match.role.tokens = addTotals(match.role.tokens, record.totals);
132016
+ if (!match.observed) match.role.turnsWithUsage += 1;
132017
+ match.observed = true;
132018
+ }
132019
+ const observedPairs = [...pairs.values()].map((pair) => {
132020
+ const builderTokens = totalTokens(pair.builder.tokens);
132021
+ const reviewTokens = totalTokens(pair.review.tokens);
132022
+ return {
132023
+ ...pair,
132024
+ reviewTokensPerBuilderToken: builderTokens > 0 && reviewTokens > 0 ? reviewTokens / builderTokens : null
132025
+ };
132026
+ });
132027
+ const ratios = observedPairs.flatMap((pair) => pair.reviewTokensPerBuilderToken === null ? [] : [pair.reviewTokensPerBuilderToken]).sort((a, b) => a - b);
132028
+ const middle = Math.floor(ratios.length / 2);
132029
+ const median = ratios.length === 0 ? null : ratios.length % 2 === 0 ? (ratios[middle - 1] + ratios[middle]) / 2 : ratios[middle];
132030
+ const recommendations = [];
132031
+ const hasIncompleteUsage = missingSessionTurns > 0 || observedPairs.some((pair) => [
132032
+ pair.builder,
132033
+ pair.review,
132034
+ pair.supervisorOther
132035
+ ].some((role) => role.turnsWithUsage < role.turns));
132036
+ if (hasIncompleteUsage) recommendations.push("Improve usage attribution before comparing policies; missing usage is not zero consumption.");
132037
+ if (ratios.length < 20) recommendations.push(`Collect at least 20 pairs with builder and review usage before selecting a policy experiment.`);
132038
+ else if (!hasIncompleteUsage && median !== null && median > REVIEW_RATIO_THRESHOLD) recommendations.push("Trial fewer review boundaries against the current policy on fixed tasks; compare independently verified outcomes and total cost.");
132039
+ if (observedPairs.some((pair) => pair.review.turns > REVIEW_COUNT_THRESHOLD)) recommendations.push(`Inspect pairs with more than ${REVIEW_COUNT_THRESHOLD} review turns for overly small phases or repeated corrections; a high count alone does not establish waste.`);
132040
+ recommendations.push("Keep settings unchanged until an isolated comparison passes acceptance and regression checks. These observations do not measure defects prevented or solo performance.");
132041
+ return {
132042
+ version: 1,
132043
+ mode: "observe",
132044
+ generatedAt: input.generatedAt,
132045
+ since: input.since,
132046
+ timeZone: "UTC",
132047
+ coverage: {
132048
+ pairs: observedPairs.length,
132049
+ pairsWithBothUsage: ratios.length,
132050
+ missingSessionTurns,
132051
+ unattributedRecords,
132052
+ ambiguousRecords
132053
+ },
132054
+ medianReviewTokensPerBuilderToken: median,
132055
+ limitations: [
132056
+ "Only completed or failed turn intervals are counted; ongoing turns are excluded.",
132057
+ "Current session linkage may omit usage before a provider session reset; unsupported providers remain unmeasured.",
132058
+ "Codex subagent sessions are not linked; Claude descendants sharing the parent session id can be included.",
132059
+ "Cached tokens are included. Tokens and wall time are not billing, quota, latency overhead, or causal quality measurements.",
132060
+ "Supervisor startup and direct user turns are separate from automatic reviews; review-induced builder repairs are not separable."
132061
+ ],
132062
+ pairs: observedPairs,
132063
+ recommendations
132064
+ };
132065
+ }
132066
+ //#endregion
132067
+ //#region src/usage/FusionObservationService.ts
132068
+ const OBSERVATION_CHECK_INTERVAL = Duration.hours(1);
132069
+ const ReportStamp = Schema$1.Struct({
132070
+ version: Schema$1.Literal(1),
132071
+ generatedAt: Schema$1.String
132072
+ });
132073
+ const TurnRow = Schema$1.Struct({
132074
+ pairId: Schema$1.String,
132075
+ reviewPolicy: Schema$1.NullOr(Schema$1.fromJsonString(FusionReviewPolicy)),
132076
+ threadId: Schema$1.String,
132077
+ turnId: Schema$1.String,
132078
+ role: Schema$1.Literals(["builder", "supervisor"]),
132079
+ sessionId: Schema$1.NullOr(Schema$1.String),
132080
+ pairCreatedAt: Schema$1.String,
132081
+ detachedAt: Schema$1.NullOr(Schema$1.String),
132082
+ startedAt: Schema$1.String,
132083
+ completedAt: Schema$1.String,
132084
+ state: Schema$1.String,
132085
+ trigger: Schema$1.Literals([
132086
+ "review",
132087
+ "gate",
132088
+ "advice",
132089
+ "other"
132090
+ ])
132091
+ });
132092
+ const decodeReportStamp = Schema$1.decodeUnknownEffect(Schema$1.fromJsonString(ReportStamp));
132093
+ const decodeTurns = Schema$1.decodeUnknownEffect(Schema$1.Array(TurnRow));
132094
+ const encodeReport = Schema$1.encodeEffect(Schema$1.UnknownFromJsonString);
132095
+ /** Reads existing projections only; observation never dispatches orchestration commands. */
132096
+ const make$7 = Effect.gen(function* () {
132097
+ const sql = yield* SqlClient.SqlClient;
132098
+ const fs = yield* FileSystem.FileSystem;
132099
+ const path = yield* Path$1.Path;
132100
+ const config = yield* ServerConfig$1;
132101
+ const settings = yield* ServerSettingsService;
132102
+ const usage = yield* UsageService;
132103
+ const lock = yield* Semaphore.make(1);
132104
+ const directory = path.join(config.stateDir, "fusion-observation");
132105
+ const latestPath = path.join(directory, "latest.json");
132106
+ const writeReport = Effect.fn("FusionObservation.writeReport")(function* (destination, body) {
132107
+ const temporary = `${destination}.tmp`;
132108
+ yield* fs.writeFileString(temporary, body);
132109
+ yield* fs.rename(temporary, destination);
132110
+ });
132111
+ const refresh = Effect.fn("FusionObservation.refresh")(function* () {
132112
+ if (!(yield* settings.getSettings).enableFusionObservation) return;
132113
+ const now = yield* Clock.currentTimeMillis;
132114
+ const generatedAt = DateTime.formatIso(DateTime.makeUnsafe(now));
132115
+ const weeklyPath = path.join(directory, `week-${observationWeek(generatedAt)}.json`);
132116
+ const stamp = yield* fs.readFileString(latestPath).pipe(Effect.flatMap(decodeReportStamp), Effect.orElseSucceed(() => null));
132117
+ const weeklyExists = yield* fs.exists(weeklyPath);
132118
+ if (stamp?.generatedAt.slice(0, 10) === generatedAt.slice(0, 10) && weeklyExists) return;
132119
+ const since = DateTime.formatIso(DateTime.makeUnsafe(now - 7 * OBSERVATION_DAY_MS));
132120
+ const rows = yield* sql`
132121
+ SELECT p.pair_id AS "pairId", t.thread_id AS "threadId", t.turn_id AS "turnId",
132122
+ CASE WHEN t.thread_id = p.implementer_thread_id THEN 'builder' ELSE 'supervisor' END AS role,
132123
+ CASE WHEN json_valid(r.resume_cursor_json) THEN
132124
+ CASE WHEN r.provider_name = 'codex' THEN json_extract(r.resume_cursor_json, '$.threadId')
132125
+ WHEN r.provider_name = 'claudeAgent' THEN json_extract(r.resume_cursor_json, '$.resume') END
132126
+ END AS "sessionId",
132127
+ json_extract(p.review_experiment_json, '$.policy') AS "reviewPolicy",
132128
+ p.created_at AS "pairCreatedAt", p.detached_at AS "detachedAt",
132129
+ coalesce(t.started_at, t.requested_at) AS "startedAt", t.completed_at AS "completedAt", t.state,
132130
+ CASE WHEN substr(m.text, 1, 15) = '[fusion-review]' THEN 'review'
132131
+ WHEN substr(m.text, 1, 13) = '[fusion-gate]' THEN 'gate'
132132
+ WHEN substr(m.text, 1, 15) = '[fusion-advice]' THEN 'advice' ELSE 'other' END AS trigger
132133
+ FROM thread_pairs p
132134
+ JOIN projection_turns t ON t.thread_id IN (p.implementer_thread_id, p.watcher_thread_id)
132135
+ LEFT JOIN provider_session_runtime r ON r.thread_id = t.thread_id
132136
+ LEFT JOIN projection_thread_messages m ON m.message_id = t.pending_message_id
132137
+ WHERE t.turn_id IS NOT NULL AND t.completed_at >= ${since} AND t.completed_at <= ${generatedAt}
132138
+ AND t.completed_at >= p.created_at
132139
+ AND (p.detached_at IS NULL OR t.requested_at <= p.detached_at)
132140
+ `;
132141
+ const turns = yield* decodeTurns(rows);
132142
+ const sessionIds = [...new Set(turns.flatMap((turn) => turn.sessionId === null ? [] : [turn.sessionId]))];
132143
+ const report = buildFusionObservation({
132144
+ generatedAt,
132145
+ since,
132146
+ turns,
132147
+ records: yield* usage.readSessionRecords({
132148
+ sessionIds,
132149
+ sinceMs: Date.parse(since)
132150
+ })
132151
+ });
132152
+ yield* fs.makeDirectory(directory, { recursive: true });
132153
+ const body = yield* encodeReport(report);
132154
+ if (!weeklyExists) {
132155
+ yield* writeReport(weeklyPath, body);
132156
+ yield* Effect.logInfo("Weekly Fusion observation available", {
132157
+ path: weeklyPath,
132158
+ pairs: report.coverage.pairs
132159
+ });
132160
+ }
132161
+ yield* writeReport(latestPath, body);
132162
+ });
132163
+ const run = lock.withPermits(1)(refresh());
132164
+ return {
132165
+ refresh: run,
132166
+ start: run.pipe(Effect.catchCause((cause) => Cause.hasInterruptsOnly(cause) ? Effect.failCause(cause) : Effect.logWarning("Fusion observation failed; retrying on the next scheduled check")), Effect.repeat(Schedule.spaced(OBSERVATION_CHECK_INTERVAL)), Effect.forkScoped)
132167
+ };
132168
+ });
132169
+ const layer$1 = Layer.effectDiscard(Effect.gen(function* () {
132170
+ yield* (yield* make$7).start;
132171
+ }));
132172
+ //#endregion
131705
132173
  //#region src/orchestration/Services/RuntimeReceiptBus.ts
131706
132174
  /**
131707
132175
  * RuntimeReceiptBus - Internal checkpoint-reactor synchronization receipts.
@@ -132919,7 +133387,7 @@ const make$6 = Effect.gen(function* () {
132919
133387
  drain: worker.drain
132920
133388
  };
132921
133389
  });
132922
- const ProviderRuntimeIngestionLive = Layer.effect(ProviderRuntimeIngestionService, make$6).pipe(Layer.provide(ProjectionTurnRepositoryLive), Layer.provide(layer$82));
133390
+ const ProviderRuntimeIngestionLive = Layer.effect(ProviderRuntimeIngestionService, make$6).pipe(Layer.provide(ProjectionTurnRepositoryLive), Layer.provide(layer$83));
132923
133391
  //#endregion
132924
133392
  //#region src/provider/userInvokedSkills.ts
132925
133393
  /**
@@ -133759,6 +134227,7 @@ const make$5 = Effect.gen(function* () {
133759
134227
  ].join("\n\n") : fusionRole === "watcher" && isFusionWatcherWakeMessageId(input.messageId) ? sidechatSeededInput : [
133760
134228
  sessionFusionRole === fusionRole ? fusionRoleReferenceLineFor(fusionRole) : fusionRoleInstructionsFor(fusionRole),
133761
134229
  fusionPairContext(activeFusionPair, fusionRole),
134230
+ fusionReviewPolicyInstructions(activeFusionPair.reviewExperiment),
133762
134231
  sidechatSeededInput
133763
134232
  ].join("\n\n");
133764
134233
  const providerHasStructuredQuestionSystemPrompt = activeSession?.provider === "claudeAgent" || activeSession?.provider === "codex";
@@ -134841,7 +135310,7 @@ Then thread_gate_respond, threadId ${input.implementerThreadId}, gateId ${input.
134841
135310
  - "approve": clear gate, continue builder.
134842
135311
  - "object" plus message: send objection, spend round. After ${input.roundCap} objections, escalate to user.
134843
135312
 
134844
- No answer within ${Math.round(input.gateTimeoutMs / 1e3)} seconds: fail open, record unwatched. Answer, briefly explain to user, end turn; never wait for builder.`;
135313
+ No answer within ${Math.round(input.gateTimeoutMs / 1e3)} seconds: ${input.failClosed ? "escalate to the user; keep work unapproved" : "fail open, record unwatched"}. Answer, briefly explain to user, end turn; never wait for builder.`;
134845
135314
  const make$3 = Effect.gen(function* () {
134846
135315
  const orchestrationEngine = yield* OrchestrationEngineService;
134847
135316
  const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
@@ -134944,6 +135413,9 @@ const make$3 = Effect.gen(function* () {
134944
135413
  discard: true
134945
135414
  });
134946
135415
  });
135416
+ const wakeWasRequested = Effect.fn("FusionWatcherReactor.wakeWasRequested")(function* (afterSequence, throughSequence, messageId) {
135417
+ return (yield* orchestrationEngine.readEvents(afterSequence, throughSequence - afterSequence, { eventTypes: ["thread.turn-start-requested"] }).pipe(Stream.takeWhile((event) => event.sequence <= throughSequence), Stream.filter((event) => event.type === "thread.turn-start-requested" && event.payload.messageId === messageId), Stream.take(1), Stream.runCollect)).length > 0;
135418
+ });
134947
135419
  /** Starts one watcher turn for the open gate and advances the pair cursor. */
134948
135420
  const wakeWatcherForGate = Effect.fn("FusionWatcherReactor.wakeWatcherForGate")(function* (event) {
134949
135421
  const gate = event.payload.gate;
@@ -134951,8 +135423,26 @@ const make$3 = Effect.gen(function* () {
134951
135423
  const { readModel, activePairs } = yield* readPairs;
134952
135424
  const pair = activePairs.find((candidate) => candidate.id === event.payload.pairId);
134953
135425
  if (pair === void 0) return;
135426
+ if (pair.reviewExperiment && (pair.activeGate?.id !== gate.id || pair.activeGate.state !== "awaiting-watcher" || pair.activeGate.round !== gate.round)) return;
134954
135427
  const watcher = readModel.threads.find((thread) => thread.id === pair.watcherThreadId && thread.deletedAt === null);
134955
135428
  if (watcher === void 0) return;
135429
+ const budgetBlock = fusionBudgetBlock(pair, watcher.id, FUSION_GATE_PROMPT_PREFIX);
135430
+ if (budgetBlock && !(yield* wakeWasRequested(event.sequence, readModel.snapshotSequence, gateMessageId(gate.id, gate.round)))) {
135431
+ yield* orchestrationEngine.dispatch({
135432
+ type: "thread-pair.gate.advance",
135433
+ commandId: gateCommandId(pair.id, gate.id, `budget:${gate.round}`),
135434
+ pairId: pair.id,
135435
+ gateId: gate.id,
135436
+ transition: "escalate",
135437
+ advancedAt: gate.updatedAt
135438
+ });
135439
+ yield* pauseFusionBudget({
135440
+ pair,
135441
+ reason: budgetBlock,
135442
+ createdAt: gate.updatedAt
135443
+ });
135444
+ return;
135445
+ }
134956
135446
  yield* orchestrationEngine.dispatch({
134957
135447
  type: "thread.turn.start",
134958
135448
  commandId: gateCommandId(pair.id, gate.id, `wake:${gate.round}`),
@@ -134965,9 +135455,10 @@ const make$3 = Effect.gen(function* () {
134965
135455
  gate,
134966
135456
  roundCap: pair.roundCap,
134967
135457
  gateTimeoutMs: pair.gateTimeoutMs,
135458
+ failClosed: pair.reviewExperiment != null,
134968
135459
  afterSequence: pair.lastReviewedImplementerSequence,
134969
135460
  throughSequence: event.sequence
134970
- }),
135461
+ }) + "\n\n" + fusionReviewPolicyInstructions(pair.reviewExperiment),
134971
135462
  attachments: []
134972
135463
  },
134973
135464
  runtimeMode: watcher.runtimeMode,
@@ -135301,6 +135792,15 @@ const make$3 = Effect.gen(function* () {
135301
135792
  implementerSequence: completion.sequence,
135302
135793
  advancedAt: completion.occurredAt
135303
135794
  });
135795
+ const budgetBlock = fusionBudgetBlock(currentPair, watcher.id, FUSION_REVIEW_PROMPT_PREFIX);
135796
+ if (budgetBlock && !(yield* wakeWasRequested(completion.sequence, readModel.snapshotSequence, reviewMessageId(currentPair.id, completion.sequence)))) {
135797
+ yield* pauseFusionBudget({
135798
+ pair: currentPair,
135799
+ reason: budgetBlock,
135800
+ createdAt: completion.occurredAt
135801
+ });
135802
+ return;
135803
+ }
135304
135804
  const idleCycles = turn.startedByAdvice && !turn.humanMessage && !turn.ranTools ? (idleAdviceCycles.get(currentPair.id) ?? 0) + 1 : 0;
135305
135805
  idleAdviceCycles.set(currentPair.id, idleCycles);
135306
135806
  if (idleCycles >= 3) {
@@ -135324,7 +135824,7 @@ const make$3 = Effect.gen(function* () {
135324
135824
  implementerThreadId: currentPair.implementerThreadId,
135325
135825
  afterSequence: currentPair.lastReviewedImplementerSequence,
135326
135826
  throughSequence: completion.sequence
135327
- }),
135827
+ }) + "\n\n" + fusionReviewPolicyInstructions(currentPair.reviewExperiment),
135328
135828
  attachments: []
135329
135829
  },
135330
135830
  runtimeMode: watcher.runtimeMode,
@@ -135378,6 +135878,7 @@ const make$3 = Effect.gen(function* () {
135378
135878
  });
135379
135879
  completions = completions.filter((completion) => completion !== activationCompletion);
135380
135880
  }
135881
+ if (pair.reviewExperiment) completions = completions.filter((completion) => completion.payload.state === "completed").slice(-1);
135381
135882
  let boundary = activationCompletion?.sequence ?? pair.lastReviewedImplementerSequence;
135382
135883
  for (const completion of completions.filter((candidate) => candidate.payload.state === "completed")) {
135383
135884
  const turn = describeBuilderTurn({
@@ -135425,6 +135926,17 @@ const make$3 = Effect.gen(function* () {
135425
135926
  if (gate.awaitingWatcherSince === null) continue;
135426
135927
  const since = Date.parse(gate.awaitingWatcherSince);
135427
135928
  if (Number.isNaN(since) || nowMillis - since < pair.gateTimeoutMs) continue;
135929
+ if (pair.reviewExperiment) {
135930
+ yield* orchestrationEngine.dispatch({
135931
+ type: "thread-pair.gate.advance",
135932
+ commandId: gateCommandId(pair.id, gate.id, `timeout-escalate:${gate.round}`),
135933
+ pairId: pair.id,
135934
+ gateId: gate.id,
135935
+ transition: "escalate",
135936
+ advancedAt: DateTime.formatIso(now)
135937
+ });
135938
+ continue;
135939
+ }
135428
135940
  yield* orchestrationEngine.dispatch({
135429
135941
  type: "thread-pair.gate.resolve",
135430
135942
  commandId: gateCommandId(pair.id, gate.id, `timeout:${gate.round}`),
@@ -136441,7 +136953,7 @@ const ObservabilityLive = Layer.unwrap(Effect.gen(function* () {
136441
136953
  sink,
136442
136954
  ...delegate ? { delegate } : {}
136443
136955
  });
136444
- return Layer.mergeAll(Layer.succeed(Tracer.Tracer, tracer), layer$61(sink));
136956
+ return Layer.mergeAll(Layer.succeed(Tracer.Tracer, tracer), layer$62(sink));
136445
136957
  })).pipe(Layer.provide(OtlpExporter.layerFlusher), Layer.provideMerge(otlpSerializationLayer));
136446
136958
  const metricsLayer = config.otlpMetricsUrl === void 0 ? Layer.empty : OtlpMetrics.layer({
136447
136959
  url: config.otlpMetricsUrl,
@@ -136813,31 +137325,31 @@ const PlatformServicesLive = Layer.unwrap(Effect.gen(function* () {
136813
137325
  }
136814
137326
  }));
136815
137327
  const ReactorLayerLive = Layer.empty.pipe(Layer.provideMerge(OrchestrationReactorLive), Layer.provideMerge(ProviderRuntimeIngestionLive), Layer.provideMerge(ProviderCommandReactorLive), Layer.provideMerge(CheckpointReactorLive), Layer.provideMerge(ThreadDeletionReactorLive), Layer.provideMerge(FusionWatcherReactorLive), Layer.provideMerge(ScheduledTaskReactorLive), Layer.provideMerge(ThreadCompletionReactorLive), Layer.provideMerge(PullRequestSyncReactorLive), Layer.provideMerge(RuntimeReceiptBusLive));
136816
- const ProviderSessionDirectoryLayerLive = ProviderSessionDirectoryLive.pipe(Layer.provide(layer$6));
137328
+ const ProviderSessionDirectoryLayerLive = ProviderSessionDirectoryLive.pipe(Layer.provide(layer$7));
136817
137329
  const ProviderLayerLive = ProviderServiceLive.pipe(Layer.provide(ProviderAdapterRegistryLive), Layer.provideMerge(ProviderSessionDirectoryLayerLive));
136818
137330
  const PersistenceLayerLive = Layer.empty.pipe(Layer.provideMerge(layerConfig));
136819
- const VcsDriverRegistryLayerLive = layer$47.pipe(Layer.provide(layer$48));
136820
- const SourceControlProviderRegistryLayerLive = layer$33.pipe(Layer.provide(Layer.mergeAll(layer$41, layer$39, layer$37, layer$35)), Layer.provideMerge(layer$49), Layer.provideMerge(VcsDriverRegistryLayerLive));
136821
- const GitManagerLayerLive = layer$32.pipe(Layer.provideMerge(layer$42), Layer.provideMerge(layer$49), Layer.provideMerge(SourceControlProviderRegistryLayerLive), Layer.provideMerge(layer$58));
136822
- const GitLayerLive = Layer.empty.pipe(Layer.provideMerge(GitManagerLayerLive), Layer.provideMerge(layer$49));
136823
- const GitWorkflowLayerLive = layer$31.pipe(Layer.provideMerge(VcsDriverRegistryLayerLive), Layer.provideMerge(GitLayerLive));
136824
- const SourceControlRepositoryServiceLayerLive = layer$7.pipe(Layer.provideMerge(layer$49), Layer.provideMerge(SourceControlProviderRegistryLayerLive));
136825
- const ReviewLayerLive = layer$12.pipe(Layer.provideMerge(layer$49), Layer.provideMerge(VcsDriverRegistryLayerLive));
136826
- const VcsLayerLive = Layer.empty.pipe(Layer.provideMerge(layer$48), Layer.provideMerge(VcsDriverRegistryLayerLive), Layer.provideMerge(layer$13.pipe(Layer.provide(VcsDriverRegistryLayerLive))), Layer.provideMerge(GitWorkflowLayerLive), Layer.provideMerge(ReviewLayerLive), Layer.provideMerge(SourceControlRepositoryServiceLayerLive), Layer.provideMerge(layer$14.pipe(Layer.provide(autoPullPolicyLayer), Layer.provide(GitWorkflowLayerLive))));
136827
- const PullRequestServiceLive = layer$25.pipe(Layer.provide(layer$26), Layer.provide(SourceControlProviderRegistryLayerLive), Layer.provide(layer$50));
136828
- const CheckpointingLayerLive = Layer.empty.pipe(Layer.provideMerge(layer$45), Layer.provideMerge(layer$46.pipe(Layer.provide(VcsDriverRegistryLayerLive))));
136829
- const PortScannerLayerLive = layer$44.pipe(Layer.provide(layer$81));
136830
- const TerminalLayerLive = layer$43.pipe(Layer.provide(PtyAdapterLive), Layer.provide(PortScannerLayerLive));
136831
- const PreviewLayerLive = Layer.empty.pipe(Layer.provideMerge(layer$18), Layer.provideMerge(PortScannerLayerLive));
136832
- const WorkspaceEntriesLayerLive = layer$16.pipe(Layer.provide(layer$68));
136833
- const WorkspaceFileSystemLayerLive = layer$15.pipe(Layer.provide(layer$68), Layer.provide(WorkspaceEntriesLayerLive));
136834
- const WorkspaceLayerLive = Layer.mergeAll(layer$68, WorkspaceEntriesLayerLive, WorkspaceFileSystemLayerLive);
136835
- const ProjectFaviconResolverLayerLive = layer$62.pipe(Layer.provide(layer$68), Layer.provide(layer$63));
136836
- const AuthLayerLive = layer$110.pipe(Layer.provideMerge(PersistenceLayerLive), Layer.provide(layer$114));
137331
+ const VcsDriverRegistryLayerLive = layer$48.pipe(Layer.provide(layer$49));
137332
+ const SourceControlProviderRegistryLayerLive = layer$34.pipe(Layer.provide(Layer.mergeAll(layer$42, layer$40, layer$38, layer$36)), Layer.provideMerge(layer$50), Layer.provideMerge(VcsDriverRegistryLayerLive));
137333
+ const GitManagerLayerLive = layer$33.pipe(Layer.provideMerge(layer$43), Layer.provideMerge(layer$50), Layer.provideMerge(SourceControlProviderRegistryLayerLive), Layer.provideMerge(layer$59));
137334
+ const GitLayerLive = Layer.empty.pipe(Layer.provideMerge(GitManagerLayerLive), Layer.provideMerge(layer$50));
137335
+ const GitWorkflowLayerLive = layer$32.pipe(Layer.provideMerge(VcsDriverRegistryLayerLive), Layer.provideMerge(GitLayerLive));
137336
+ const SourceControlRepositoryServiceLayerLive = layer$8.pipe(Layer.provideMerge(layer$50), Layer.provideMerge(SourceControlProviderRegistryLayerLive));
137337
+ const ReviewLayerLive = layer$13.pipe(Layer.provideMerge(layer$50), Layer.provideMerge(VcsDriverRegistryLayerLive));
137338
+ const VcsLayerLive = Layer.empty.pipe(Layer.provideMerge(layer$49), Layer.provideMerge(VcsDriverRegistryLayerLive), Layer.provideMerge(layer$14.pipe(Layer.provide(VcsDriverRegistryLayerLive))), Layer.provideMerge(GitWorkflowLayerLive), Layer.provideMerge(ReviewLayerLive), Layer.provideMerge(SourceControlRepositoryServiceLayerLive), Layer.provideMerge(layer$15.pipe(Layer.provide(autoPullPolicyLayer), Layer.provide(GitWorkflowLayerLive))));
137339
+ const PullRequestServiceLive = layer$26.pipe(Layer.provide(layer$27), Layer.provide(SourceControlProviderRegistryLayerLive), Layer.provide(layer$51));
137340
+ const CheckpointingLayerLive = Layer.empty.pipe(Layer.provideMerge(layer$46), Layer.provideMerge(layer$47.pipe(Layer.provide(VcsDriverRegistryLayerLive))));
137341
+ const PortScannerLayerLive = layer$45.pipe(Layer.provide(layer$82));
137342
+ const TerminalLayerLive = layer$44.pipe(Layer.provide(PtyAdapterLive), Layer.provide(PortScannerLayerLive));
137343
+ const PreviewLayerLive = Layer.empty.pipe(Layer.provideMerge(layer$19), Layer.provideMerge(PortScannerLayerLive));
137344
+ const WorkspaceEntriesLayerLive = layer$17.pipe(Layer.provide(layer$69));
137345
+ const WorkspaceFileSystemLayerLive = layer$16.pipe(Layer.provide(layer$69), Layer.provide(WorkspaceEntriesLayerLive));
137346
+ const WorkspaceLayerLive = Layer.mergeAll(layer$69, WorkspaceEntriesLayerLive, WorkspaceFileSystemLayerLive);
137347
+ const ProjectFaviconResolverLayerLive = layer$63.pipe(Layer.provide(layer$69), Layer.provide(layer$64));
137348
+ const AuthLayerLive = layer$111.pipe(Layer.provideMerge(PersistenceLayerLive), Layer.provide(layer$115));
136837
137349
  const ProviderRuntimeLayerLive = ProviderSessionReaperLive.pipe(Layer.provideMerge(ProviderLayerLive), Layer.provideMerge(OrchestrationLayerLive));
136838
- const RuntimeCoreDependenciesLive = ReactorLayerLive.pipe(Layer.provideMerge(layer$24), Layer.provideMerge(Layer.mergeAll(PullRequestServiceLive, CheckpointingLayerLive, SourceControlProviderRegistryLayerLive)), Layer.provideMerge(GitLayerLive), Layer.provideMerge(VcsLayerLive), Layer.provideMerge(ProviderAuthServiceLive), Layer.provideMerge(ProviderRuntimeLayerLive), Layer.provideMerge(Layer.mergeAll(TerminalLayerLive, PreviewLayerLive, RoutedTaskRepositoryLive)), Layer.provideMerge(Layer.mergeAll(PersistenceLayerLive, layer$85)), Layer.provideMerge(layer$79), Layer.provideMerge(ProviderRegistryLive), Layer.provideMerge(layer$57), Layer.provideMerge(Layer.mergeAll(layer$56, layer$70.pipe(Layer.provide(layer$81)), layer$66, layer$67)), Layer.provideMerge(layer$51), Layer.provideMerge(layer$52), Layer.provideMerge(layer$53), Layer.provideMerge(layer$54), Layer.provideMerge(layer$55)).pipe(Layer.provideMerge(ProviderInstanceRegistryHydrationLive), Layer.provideMerge(AntigravityInstallation.layer), Layer.provideMerge(ProviderEventLoggersLive), Layer.provideMerge(OpenCodeRuntimeLive), Layer.provideMerge(layer$59), Layer.provideMerge(layer$89.pipe(Layer.provide(layer$114))), Layer.provideMerge(WorkspaceLayerLive), Layer.provideMerge(ProjectFaviconResolverLayerLive), Layer.provideMerge(layer$80), Layer.provideMerge(layer$65), Layer.provideMerge(remoteComputerUseBindingsLayer.pipe(Layer.provide(layer$85))), Layer.provideMerge(layer$73), Layer.provideMerge(AuthLayerLive), Layer.provideMerge(layer$4.pipe(Layer.provideMerge(LinearClientLive), Layer.provideMerge(Layer.mergeAll(LinearMcpClientLive, TrackerSecretsLive)), Layer.provideMerge(Layer.mergeAll(layer$86, layer$20).pipe(Layer.provideMerge(layer$87), Layer.provideMerge(layer$88))))), Layer.provideMerge(layer$114));
136839
- const UsageLayerLive = layer$22.pipe(Layer.provide(layer$89.pipe(Layer.provide(layer$114))));
136840
- const RuntimeDependenciesLive = layer$21.pipe(Layer.provideMerge(RuntimeCoreDependenciesLive)).pipe(Layer.provideMerge(UsageLayerLive), Layer.provideMerge(layer$11), Layer.provideMerge(layer$10), Layer.provideMerge(layer$9), Layer.provideMerge(layer$76), Layer.provideMerge(layer$78), Layer.provideMerge(layer$77), Layer.provide(layer$118));
137350
+ const RuntimeCoreDependenciesLive = ReactorLayerLive.pipe(Layer.provideMerge(layer$25), Layer.provideMerge(Layer.mergeAll(PullRequestServiceLive, CheckpointingLayerLive, SourceControlProviderRegistryLayerLive)), Layer.provideMerge(GitLayerLive), Layer.provideMerge(VcsLayerLive), Layer.provideMerge(ProviderAuthServiceLive), Layer.provideMerge(ProviderRuntimeLayerLive), Layer.provideMerge(Layer.mergeAll(TerminalLayerLive, PreviewLayerLive, RoutedTaskRepositoryLive)), Layer.provideMerge(Layer.mergeAll(PersistenceLayerLive, layer$86)), Layer.provideMerge(layer$80), Layer.provideMerge(ProviderRegistryLive), Layer.provideMerge(layer$58), Layer.provideMerge(Layer.mergeAll(layer$57, layer$71.pipe(Layer.provide(layer$82)), layer$67, layer$68)), Layer.provideMerge(layer$52), Layer.provideMerge(layer$53), Layer.provideMerge(layer$54), Layer.provideMerge(layer$55), Layer.provideMerge(layer$56)).pipe(Layer.provideMerge(ProviderInstanceRegistryHydrationLive), Layer.provideMerge(AntigravityInstallation.layer), Layer.provideMerge(ProviderEventLoggersLive), Layer.provideMerge(OpenCodeRuntimeLive), Layer.provideMerge(layer$60), Layer.provideMerge(layer$90.pipe(Layer.provide(layer$115))), Layer.provideMerge(WorkspaceLayerLive), Layer.provideMerge(ProjectFaviconResolverLayerLive), Layer.provideMerge(layer$81), Layer.provideMerge(layer$66), Layer.provideMerge(remoteComputerUseBindingsLayer.pipe(Layer.provide(layer$86))), Layer.provideMerge(layer$74), Layer.provideMerge(AuthLayerLive), Layer.provideMerge(layer$5.pipe(Layer.provideMerge(LinearClientLive), Layer.provideMerge(Layer.mergeAll(LinearMcpClientLive, TrackerSecretsLive)), Layer.provideMerge(Layer.mergeAll(layer$87, layer$21).pipe(Layer.provideMerge(layer$88), Layer.provideMerge(layer$89))))), Layer.provideMerge(layer$115));
137351
+ const UsageLayerLive = layer$23.pipe(Layer.provide(layer$90.pipe(Layer.provide(layer$115))));
137352
+ const RuntimeDependenciesLive = layer$22.pipe(Layer.provideMerge(RuntimeCoreDependenciesLive)).pipe(Layer.provideMerge(UsageLayerLive), Layer.provideMerge(layer$12), Layer.provideMerge(layer$11), Layer.provideMerge(layer$10), Layer.provideMerge(layer$77), Layer.provideMerge(layer$79), Layer.provideMerge(layer$78), Layer.provide(layer$119));
136841
137353
  /**
136842
137354
  * Hub asset sync.
136843
137355
  *
@@ -136845,9 +137357,9 @@ const RuntimeDependenciesLive = layer$21.pipe(Layer.provideMerge(RuntimeCoreDepe
136845
137357
  * not-configured shape, and every call reports that rather than failing — so
136846
137358
  * this costs a server with no hub nothing but a layer.
136847
137359
  */
136848
- const AssetSyncLive = layer$83.pipe(Layer.provideMerge(layer$84), Layer.provideMerge(layer$85));
136849
- const RuntimeServicesLive = layer$69.pipe(Layer.provideMerge(AssetSyncLive), Layer.provideMerge(RuntimeDependenciesLive));
136850
- const makeRoutesLayer = Layer.mergeAll(Layer.mergeAll(HttpApiBuilder.layer(EnvironmentHttpApi).pipe(Layer.provide(authHttpApiLayer), Layer.provide(orchestrationHttpApiLayer), Layer.provide(pullRequestHttpApiLayer), Layer.provide(serverEnvironmentHttpApiLayer), Layer.provide(environmentAuthenticatedAuthLayer)), otlpTracesProxyRouteLayer, assetRouteLayer, mcpOAuthCallbackRouteLayer, staticAndDevRouteLayer, websocketRpcRouteLayer), layer$3.pipe(Layer.provide(layer$5)), layer$64, layer).pipe(Layer.provide(ProjectionProjectRepositoryLive.pipe(Layer.provide(PersistenceLayerLive))), Layer.provide(ProjectionThreadRepositoryLive.pipe(Layer.provide(PersistenceLayerLive))), Layer.provide(layer$63), Layer.provide(layer$24), Layer.provide(PullRequestServiceLive), Layer.provide(layer$19), Layer.provide(layer$74), Layer.provide(browserApiCorsLayer), Layer.provide(httpCompressionLayer));
137360
+ const AssetSyncLive = layer$84.pipe(Layer.provideMerge(layer$85), Layer.provideMerge(layer$86));
137361
+ const RuntimeServicesLive = layer$70.pipe(Layer.provideMerge(layer$1), Layer.provideMerge(AssetSyncLive), Layer.provideMerge(RuntimeDependenciesLive));
137362
+ const makeRoutesLayer = Layer.mergeAll(Layer.mergeAll(HttpApiBuilder.layer(EnvironmentHttpApi).pipe(Layer.provide(authHttpApiLayer), Layer.provide(orchestrationHttpApiLayer), Layer.provide(pullRequestHttpApiLayer), Layer.provide(serverEnvironmentHttpApiLayer), Layer.provide(environmentAuthenticatedAuthLayer)), otlpTracesProxyRouteLayer, assetRouteLayer, mcpOAuthCallbackRouteLayer, staticAndDevRouteLayer, websocketRpcRouteLayer), layer$4.pipe(Layer.provide(layer$6)), layer$65, layer).pipe(Layer.provide(ProjectionProjectRepositoryLive.pipe(Layer.provide(PersistenceLayerLive))), Layer.provide(ProjectionThreadRepositoryLive.pipe(Layer.provide(PersistenceLayerLive))), Layer.provide(layer$64), Layer.provide(layer$25), Layer.provide(PullRequestServiceLive), Layer.provide(layer$20), Layer.provide(layer$75), Layer.provide(browserApiCorsLayer), Layer.provide(httpCompressionLayer));
136851
137363
  const makeServerLayer = Layer.unwrap(Effect.gen(function* () {
136852
137364
  const config = yield* ServerConfig$1;
136853
137365
  yield* fixPath();
@@ -136890,7 +137402,7 @@ const makeServerLayer = Layer.unwrap(Effect.gen(function* () {
136890
137402
  cause,
136891
137403
  servePort: configured.servePort
136892
137404
  }))) : Effect.void)) : Layer.empty;
136893
- const fullyProvisionedServerLayer = Layer.mergeAll(HttpRouter.serve(makeRoutesLayer, { disableLogger: !config.logWebSocketEvents }), httpListeningLayer, runtimeStateLayer, tailscaleServeLayer, layer$1, layer$2).pipe(Layer.provideMerge(RuntimeServicesLive), Layer.provideMerge(HttpResponseCompressionLive), Layer.provideMerge(HttpServerLive), Layer.provide(ObservabilityLive), Layer.provideMerge(FetchHttpClient.layer), Layer.provideMerge(layer$50));
137405
+ const fullyProvisionedServerLayer = Layer.mergeAll(HttpRouter.serve(makeRoutesLayer, { disableLogger: !config.logWebSocketEvents }), httpListeningLayer, runtimeStateLayer, tailscaleServeLayer, layer$2, layer$3).pipe(Layer.provideMerge(RuntimeServicesLive), Layer.provideMerge(HttpResponseCompressionLive), Layer.provideMerge(HttpServerLive), Layer.provide(ObservabilityLive), Layer.provideMerge(FetchHttpClient.layer), Layer.provideMerge(layer$51));
136894
137406
  return Layer.unwrap(Effect.gen(function* () {
136895
137407
  yield* acquireServerInstanceLock(config.stateDir);
136896
137408
  return fullyProvisionedServerLayer;
@@ -137192,11 +137704,11 @@ function describeServiceUpdateState(state) {
137192
137704
  //#endregion
137193
137705
  //#region src/cli/service.ts
137194
137706
  const isBootServiceCommandError = Schema$1.is(BootServiceCommandError);
137195
- const bootServiceLayer = (config) => layer$75({
137707
+ const bootServiceLayer = (config) => layer$76({
137196
137708
  baseDir: config.baseDir,
137197
137709
  logsDir: config.logsDir,
137198
137710
  cliVersion: version$1
137199
- }).pipe(Layer.provide(layer$81));
137711
+ }).pipe(Layer.provide(layer$82));
137200
137712
  /**
137201
137713
  * The update installed a build that never reported itself listening.
137202
137714
  *
@@ -137322,7 +137834,7 @@ const runServiceCommand = Effect.fn("cli.service.run")(function* (flags, run, pr
137322
137834
  const baseDirNotice = yield* describeNonDefaultBaseDir(config.baseDir);
137323
137835
  if (baseDirNotice !== null) yield* Console.error(baseDirNotice);
137324
137836
  if (prepare !== void 0) yield* prepare(config);
137325
- return yield* run.pipe(Effect.tapError((error) => isBootServiceCommandError(error) ? BootService.pipe(Effect.flatMap((service) => Console.error(`Details: ${service.logPath}`))) : Effect.void), Effect.provide(Layer.mergeAll(bootServiceLayer(config), layer$81)));
137837
+ return yield* run.pipe(Effect.tapError((error) => isBootServiceCommandError(error) ? BootService.pipe(Effect.flatMap((service) => Console.error(`Details: ${service.logPath}`))) : Effect.void), Effect.provide(Layer.mergeAll(bootServiceLayer(config), layer$82)));
137326
137838
  });
137327
137839
  /**
137328
137840
  * Options the installed unit carries, rather than ones this command consumes.
@@ -137489,7 +138001,7 @@ const serviceCommand = Command.make("service").pipe(Command.withDescription("Man
137489
138001
  ]));
137490
138002
  //#endregion
137491
138003
  //#region src/bin.ts
137492
- const CliRuntimeLayer = Layer.mergeAll(NodeServices.layer, layer$118, FetchHttpClient.layer);
138004
+ const CliRuntimeLayer = Layer.mergeAll(NodeServices.layer, layer$119, FetchHttpClient.layer);
137493
138005
  /**
137494
138006
  * Prints an update reminder before dispatching, at most once a day.
137495
138007
  *