@cmmd-center/forge 0.13.15 → 0.13.16

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.cjs CHANGED
@@ -12,7 +12,7 @@ const require_Cache = require("./Cache-BmGc_2BZ.cjs");
12
12
  const require_SqlError = require("./SqlError-g4pLzNWR.cjs");
13
13
  const require_Mime = require("./Mime-Bilnh8zE.cjs");
14
14
  const require_esm = require("./esm-BZhXwX5p.cjs");
15
- const require_runtimeControlAuthority = require("./runtimeControlAuthority-BkVB0uAA.cjs");
15
+ const require_runtimeControlAuthority = require("./runtimeControlAuthority-DCitZFTk.cjs");
16
16
  const require_PTY = require("./PTY-B4ZctbwQ.cjs");
17
17
  let node_child_process = require("node:child_process");
18
18
  node_child_process = require_chunk.__toESM(node_child_process);
@@ -66418,7 +66418,7 @@ function normalizeNumberish(value) {
66418
66418
  }
66419
66419
  //#endregion
66420
66420
  //#region package.json
66421
- var version$1 = "0.13.15";
66421
+ var version$1 = "0.13.16";
66422
66422
  //#endregion
66423
66423
  //#region src/sentry.ts
66424
66424
  const SERVER_APP_NAME = "forge-server";
@@ -97076,6 +97076,7 @@ const registerCloudRuntimeForReplicaHydration = require_Schema$1.gen(function* (
97076
97076
  credentialEpoch,
97077
97077
  activeTurnCount: 0,
97078
97078
  activeSessionCount: 0,
97079
+ acceptingTurns: false,
97079
97080
  ...forgeGitCommit !== void 0 ? { forgeGitCommit } : {},
97080
97081
  forgeServerVersion: installedForgeServerVersion
97081
97082
  }),
@@ -97112,6 +97113,128 @@ const hydrateCloudRuntimeReplica = require_Schema$1.gen(function* () {
97112
97113
  return yield* hydrateRuntimeReplica({ expectedRuntimeId: grant.runtimeId }, dependencies);
97113
97114
  });
97114
97115
  //#endregion
97116
+ //#region src/runtimeDrain/RuntimeDrainState.ts
97117
+ /**
97118
+ * The positive facts this process must observe before it can claim a turn.
97119
+ *
97120
+ * Every entry is required, so adding one here is the whole change: the
97121
+ * derivation below reads this list rather than naming fields, and the record
97122
+ * it indexes cannot be built with a member missing.
97123
+ */
97124
+ const RUNTIME_EXECUTION_PRECONDITIONS = ["orchestrationEngine", "providerLayer"];
97125
+ /**
97126
+ * The single definition of the accepting-turns fact.
97127
+ *
97128
+ * Exported so test stubs of this service derive it exactly as the live state
97129
+ * does. A stub that recomputed it by hand could disagree with production and
97130
+ * still pass.
97131
+ */
97132
+ function deriveAcceptingTurns(input) {
97133
+ return RUNTIME_EXECUTION_PRECONDITIONS.every((precondition) => input.preconditions[precondition]) && !input.draining && !input.shutdownRequested;
97134
+ }
97135
+ const initialState = {
97136
+ activeTurns: /* @__PURE__ */ new Set(),
97137
+ activeTurnCount: 0,
97138
+ activeSessionCount: 0,
97139
+ draining: false,
97140
+ drainReason: null,
97141
+ drainTargetImageRef: null,
97142
+ drainTargetImageVersion: null,
97143
+ drainForceRequired: false,
97144
+ preconditions: {
97145
+ orchestrationEngine: false,
97146
+ providerLayer: false
97147
+ },
97148
+ shutdownRequested: false
97149
+ };
97150
+ function snapshotFromState(state) {
97151
+ return {
97152
+ activeTurnCount: state.activeTurnCount,
97153
+ activeSessionCount: state.activeSessionCount,
97154
+ draining: state.draining,
97155
+ drainReason: state.drainReason,
97156
+ drainTargetImageRef: state.drainTargetImageRef,
97157
+ drainTargetImageVersion: state.drainTargetImageVersion,
97158
+ drainForceRequired: state.drainForceRequired,
97159
+ acceptingTurns: deriveAcceptingTurns(state)
97160
+ };
97161
+ }
97162
+ function turnKey(input) {
97163
+ return `${input.threadId}:${input.turnId ?? "unknown"}`;
97164
+ }
97165
+ function normalizeCount(count) {
97166
+ return Number.isFinite(count) ? Math.max(0, Math.floor(count)) : 0;
97167
+ }
97168
+ const makeRuntimeDrainState = require_Schema$1.gen(function* () {
97169
+ const stateRef = yield* require_HttpServer.make$3(initialState);
97170
+ const update = (f) => require_HttpServer.updateAndGet(stateRef, f).pipe(require_Schema$1.map(snapshotFromState));
97171
+ return {
97172
+ beginTurn: (input) => update((state) => {
97173
+ const activeTurns = new Set(state.activeTurns);
97174
+ activeTurns.add(turnKey(input));
97175
+ return {
97176
+ ...state,
97177
+ activeTurns,
97178
+ activeTurnCount: activeTurns.size
97179
+ };
97180
+ }),
97181
+ completeTurn: (input) => update((state) => {
97182
+ const activeTurns = new Set(state.activeTurns);
97183
+ activeTurns.delete(turnKey(input));
97184
+ return {
97185
+ ...state,
97186
+ activeTurns,
97187
+ activeTurnCount: activeTurns.size
97188
+ };
97189
+ }),
97190
+ clearActiveTurns: update((state) => ({
97191
+ ...state,
97192
+ activeTurns: /* @__PURE__ */ new Set(),
97193
+ activeTurnCount: 0
97194
+ })),
97195
+ setActiveSessionCount: (count) => update((state) => ({
97196
+ ...state,
97197
+ activeSessionCount: normalizeCount(count)
97198
+ })),
97199
+ reconcileProviderSessions: (sessions) => update((state) => {
97200
+ const activeSessions = sessions.filter((session) => session.status !== "closed");
97201
+ const activeTurns = new Set(activeSessions.flatMap((session) => session.activeTurnId === void 0 ? [] : [turnKey({
97202
+ threadId: session.threadId,
97203
+ turnId: session.activeTurnId
97204
+ })]));
97205
+ return {
97206
+ ...state,
97207
+ activeTurns,
97208
+ activeTurnCount: activeTurns.size,
97209
+ activeSessionCount: activeSessions.length
97210
+ };
97211
+ }),
97212
+ applyControlPlaneState: (input) => update((state) => ({
97213
+ ...state,
97214
+ draining: input.draining ?? state.draining,
97215
+ drainReason: input.drainReason ?? state.drainReason,
97216
+ drainTargetImageRef: input.drainTargetImageRef ?? state.drainTargetImageRef,
97217
+ drainTargetImageVersion: input.drainTargetImageVersion ?? state.drainTargetImageVersion,
97218
+ drainForceRequired: input.drainForceRequired ?? state.drainForceRequired
97219
+ })),
97220
+ markExecutionPrecondition: (precondition) => update((state) => ({
97221
+ ...state,
97222
+ preconditions: {
97223
+ ...state.preconditions,
97224
+ [precondition]: true
97225
+ }
97226
+ })),
97227
+ requestShutdown: update((state) => ({
97228
+ ...state,
97229
+ shutdownRequested: true
97230
+ })),
97231
+ snapshot: require_HttpServer.get$1(stateRef).pipe(require_Schema$1.map(snapshotFromState)),
97232
+ isDraining: require_HttpServer.get$1(stateRef).pipe(require_Schema$1.map((state) => state.draining))
97233
+ };
97234
+ });
97235
+ var RuntimeDrainState = class extends require_Schema$1.Service()("forge/runtimeDrain/RuntimeDrainState") {};
97236
+ const RuntimeDrainStateLive = require_Schema$1.effect(RuntimeDrainState, makeRuntimeDrainState);
97237
+ //#endregion
97115
97238
  //#region src/persistence/Services/LocalAutomations.ts
97116
97239
  const LocalAutomationStatus = require_Schema$1.Literals([
97117
97240
  "active",
@@ -100748,6 +100871,30 @@ const makeCommandGate = require_Schema$1.gen(function* () {
100748
100871
  })
100749
100872
  };
100750
100873
  });
100874
+ /**
100875
+ * Settle the command gate for a finished startup, and report whether commands
100876
+ * are now accepted.
100877
+ *
100878
+ * The success branch is the moment the orchestration engine can take work, so
100879
+ * it is where the engine half of the accepting-turns fact is marked. A failed
100880
+ * startup accepts nothing and must leave the fact untouched: absent must not
100881
+ * read as healthy.
100882
+ */
100883
+ const settleCommandReadiness = (input) => require_Schema$1.gen(function* () {
100884
+ if (require_Schema$1.isFailure(input.startupExit)) {
100885
+ const error = new ServerRuntimeStartupError({
100886
+ message: startupFailureMessage(input.startupExit.cause),
100887
+ cause: input.startupExit.cause
100888
+ });
100889
+ yield* require_Schema$1.logError("server runtime startup failed", { cause: describeStartupFailure(input.startupExit.cause) });
100890
+ yield* input.commandGate.failCommandReady(error);
100891
+ return false;
100892
+ }
100893
+ yield* require_Schema$1.logDebug("Accepting commands");
100894
+ yield* input.commandGate.signalCommandReady;
100895
+ yield* input.drainState.markExecutionPrecondition("orchestrationEngine");
100896
+ return true;
100897
+ });
100751
100898
  const launchStartupHeartbeat = require_Schema$1.gen(function* () {
100752
100899
  const analytics = yield* AnalyticsService;
100753
100900
  const { threadCount, projectCount } = yield* (yield* ProjectionSnapshotQuery).getCounts().pipe(require_Schema$1.catch_((cause) => require_Schema$1.logWarning("failed to gather startup projection counts for telemetry", { cause }).pipe(require_Schema$1.as({
@@ -100929,6 +101076,7 @@ const makeServerRuntimeStartup = require_Schema$1.gen(function* () {
100929
101076
  const serverSettings = yield* ServerSettingsService;
100930
101077
  const serverEnvironment = yield* ServerEnvironment;
100931
101078
  const usage = yield* UsageService;
101079
+ const drainState = yield* RuntimeDrainState;
100932
101080
  const commandGate = yield* makeCommandGate;
100933
101081
  const httpListening = yield* require_Schema$1.make$4();
100934
101082
  const reactorScope = yield* require_Schema$1.make$3("sequential");
@@ -101011,18 +101159,11 @@ const makeServerRuntimeStartup = require_Schema$1.gen(function* () {
101011
101159
  root: true
101012
101160
  }));
101013
101161
  yield* require_Schema$1.forkScoped(require_Schema$1.gen(function* () {
101014
- const startupExit = yield* require_Schema$1.exit(startup);
101015
- if (require_Schema$1.isFailure(startupExit)) {
101016
- const error = new ServerRuntimeStartupError({
101017
- message: startupFailureMessage(startupExit.cause),
101018
- cause: startupExit.cause
101019
- });
101020
- yield* require_Schema$1.logError("server runtime startup failed", { cause: describeStartupFailure(startupExit.cause) });
101021
- yield* commandGate.failCommandReady(error);
101022
- return;
101023
- }
101024
- yield* require_Schema$1.logDebug("Accepting commands");
101025
- yield* commandGate.signalCommandReady;
101162
+ if (!(yield* settleCommandReadiness({
101163
+ startupExit: yield* require_Schema$1.exit(startup),
101164
+ commandGate,
101165
+ drainState
101166
+ }))) return;
101026
101167
  yield* require_Schema$1.logDebug("startup phase: starting the usage scan warm-up");
101027
101168
  yield* require_Schema$1.forkScoped(runUsageScanWarmup({ readSummary: usage.readSummary }));
101028
101169
  yield* require_Schema$1.logDebug("startup phase: waiting for http listener");
@@ -153634,7 +153775,9 @@ var CodexAppServerManager = class extends node_events.EventEmitter {
153634
153775
  scheduleProviderEgressTokenRefresh(context, delayMs) {
153635
153776
  if (context.tokenRefreshTimer) clearTimeout(context.tokenRefreshTimer);
153636
153777
  const tokenRefreshTimer = setTimeout(() => {
153637
- this.handleProviderEgressTokenRefresh(context.session.threadId).catch(() => void 0);
153778
+ this.handleProviderEgressTokenRefresh(context.session.threadId).catch((error) => {
153779
+ this.emitErrorEvent(context, "session/tokenRefreshFailed", error instanceof Error ? error.message : String(error));
153780
+ });
153638
153781
  }, delayMs);
153639
153782
  tokenRefreshTimer.unref?.();
153640
153783
  context.tokenRefreshTimer = tokenRefreshTimer;
@@ -290988,93 +291131,6 @@ async function maybeRefreshRuntimeProvisioningGrant(input) {
290988
291131
  return "refreshed";
290989
291132
  }
290990
291133
  //#endregion
290991
- //#region src/runtimeDrain/RuntimeDrainState.ts
290992
- const initialState = {
290993
- activeTurns: /* @__PURE__ */ new Set(),
290994
- activeTurnCount: 0,
290995
- activeSessionCount: 0,
290996
- draining: false,
290997
- drainReason: null,
290998
- drainTargetImageRef: null,
290999
- drainTargetImageVersion: null,
291000
- drainForceRequired: false
291001
- };
291002
- function snapshotFromState(state) {
291003
- return {
291004
- activeTurnCount: state.activeTurnCount,
291005
- activeSessionCount: state.activeSessionCount,
291006
- draining: state.draining,
291007
- drainReason: state.drainReason,
291008
- drainTargetImageRef: state.drainTargetImageRef,
291009
- drainTargetImageVersion: state.drainTargetImageVersion,
291010
- drainForceRequired: state.drainForceRequired
291011
- };
291012
- }
291013
- function turnKey(input) {
291014
- return `${input.threadId}:${input.turnId ?? "unknown"}`;
291015
- }
291016
- function normalizeCount(count) {
291017
- return Number.isFinite(count) ? Math.max(0, Math.floor(count)) : 0;
291018
- }
291019
- const makeRuntimeDrainState = require_Schema$1.gen(function* () {
291020
- const stateRef = yield* require_HttpServer.make$3(initialState);
291021
- const update = (f) => require_HttpServer.updateAndGet(stateRef, f).pipe(require_Schema$1.map(snapshotFromState));
291022
- return {
291023
- beginTurn: (input) => update((state) => {
291024
- const activeTurns = new Set(state.activeTurns);
291025
- activeTurns.add(turnKey(input));
291026
- return {
291027
- ...state,
291028
- activeTurns,
291029
- activeTurnCount: activeTurns.size
291030
- };
291031
- }),
291032
- completeTurn: (input) => update((state) => {
291033
- const activeTurns = new Set(state.activeTurns);
291034
- activeTurns.delete(turnKey(input));
291035
- return {
291036
- ...state,
291037
- activeTurns,
291038
- activeTurnCount: activeTurns.size
291039
- };
291040
- }),
291041
- clearActiveTurns: update((state) => ({
291042
- ...state,
291043
- activeTurns: /* @__PURE__ */ new Set(),
291044
- activeTurnCount: 0
291045
- })),
291046
- setActiveSessionCount: (count) => update((state) => ({
291047
- ...state,
291048
- activeSessionCount: normalizeCount(count)
291049
- })),
291050
- reconcileProviderSessions: (sessions) => update((state) => {
291051
- const activeSessions = sessions.filter((session) => session.status !== "closed");
291052
- const activeTurns = new Set(activeSessions.flatMap((session) => session.activeTurnId === void 0 ? [] : [turnKey({
291053
- threadId: session.threadId,
291054
- turnId: session.activeTurnId
291055
- })]));
291056
- return {
291057
- ...state,
291058
- activeTurns,
291059
- activeTurnCount: activeTurns.size,
291060
- activeSessionCount: activeSessions.length
291061
- };
291062
- }),
291063
- applyControlPlaneState: (input) => update((state) => ({
291064
- ...state,
291065
- draining: input.draining ?? state.draining,
291066
- drainReason: input.drainReason ?? state.drainReason,
291067
- drainTargetImageRef: input.drainTargetImageRef ?? state.drainTargetImageRef,
291068
- drainTargetImageVersion: input.drainTargetImageVersion ?? state.drainTargetImageVersion,
291069
- drainForceRequired: input.drainForceRequired ?? state.drainForceRequired
291070
- })),
291071
- snapshot: require_HttpServer.get$1(stateRef).pipe(require_Schema$1.map(snapshotFromState)),
291072
- isDraining: require_HttpServer.get$1(stateRef).pipe(require_Schema$1.map((state) => state.draining))
291073
- };
291074
- });
291075
- var RuntimeDrainState = class extends require_Schema$1.Service()("forge/runtimeDrain/RuntimeDrainState") {};
291076
- const RuntimeDrainStateLive = require_Schema$1.effect(RuntimeDrainState, makeRuntimeDrainState);
291077
- //#endregion
291078
291134
  //#region src/runtimeDrain/RuntimeDrainReporter.ts
291079
291135
  const HEARTBEAT_INTERVAL = require_Schema$1.seconds(30);
291080
291136
  const HEARTBEAT_TICK_TIMEOUT = require_Schema$1.seconds(60);
@@ -291132,6 +291188,7 @@ const postRuntimeHeartbeat = (config, snapshot) => require_Schema$1.promise(asyn
291132
291188
  ...config,
291133
291189
  activeTurnCount: snapshot.activeTurnCount,
291134
291190
  activeSessionCount: snapshot.activeSessionCount,
291191
+ acceptingTurns: snapshot.acceptingTurns,
291135
291192
  ...forgeGitCommit !== void 0 ? { forgeGitCommit } : {},
291136
291193
  forgeServerVersion: installedForgeServerVersion
291137
291194
  });
@@ -291240,6 +291297,7 @@ const makeRuntimeDrainReporter = require_Schema$1.gen(function* () {
291240
291297
  work: reportOnce,
291241
291298
  interval: HEARTBEAT_INTERVAL
291242
291299
  }));
291300
+ yield* require_Schema$1.addFinalizer(() => drainState.requestShutdown);
291243
291301
  })
291244
291302
  };
291245
291303
  });
@@ -291450,6 +291508,7 @@ function decodeCodexRateLimitWindows(raw) {
291450
291508
  function publicProviderRuntimeError(message) {
291451
291509
  return sanitizePublicProviderText(message, { fallback: DEFAULT_PUBLIC_PROVIDER_ERROR });
291452
291510
  }
291511
+ const processDomainEvent = (_event) => require_Schema$1.void_;
291453
291512
  function isAssistantTextDeltaEvent(event) {
291454
291513
  return event.type === "content.delta" && event.payload.streamKind === "assistant_text";
291455
291514
  }
@@ -292245,7 +292304,6 @@ const make$9 = require_Schema$1.fn("make")(function* () {
292245
292304
  yield* runtimeDrainReporter.reportOnce;
292246
292305
  }
292247
292306
  });
292248
- const processDomainEvent = (_event) => require_Schema$1.void_;
292249
292307
  const processInput = (input) => input.source === "runtime" ? processRuntimeEvent(input.event) : processDomainEvent(input.event);
292250
292308
  const processInputSafely = (input) => processInput(input).pipe(require_Schema$1.catchCause((cause) => {
292251
292309
  if (require_Schema$1.hasInterruptsOnly(cause)) return require_Schema$1.failCause(cause);
@@ -292296,6 +292354,7 @@ const make$9 = require_Schema$1.fn("make")(function* () {
292296
292354
  return {
292297
292355
  start: require_Schema$1.fn("start")(function* () {
292298
292356
  yield* reconcileOrphanedRunningSessions();
292357
+ yield* runtimeDrainState.markExecutionPrecondition("providerLayer");
292299
292358
  yield* runtimeDrainReporter.start;
292300
292359
  yield* require_Schema$1.forkScoped(require_Path.runForEach(providerService.streamEvents, (event) => enqueueInput({
292301
292360
  source: "runtime",
@@ -292535,6 +292594,8 @@ const HANDLED_TURN_START_KEY_MAX = 1e4;
292535
292594
  const HANDLED_TURN_START_KEY_TTL = require_Schema$1.minutes(30);
292536
292595
  const DEFAULT_RUNTIME_MODE = "full-access";
292537
292596
  const DEFAULT_THREAD_TITLE = "New thread";
292597
+ const isProviderValidationError = require_Schema$1.is(ProviderValidationError);
292598
+ const isProviderKind = require_Schema$1.is(ProviderKind);
292538
292599
  function isPathInsideRoot(candidatePath, rootPath) {
292539
292600
  let resolvedCandidate;
292540
292601
  let resolvedRoot;
@@ -292571,6 +292632,38 @@ function resolveExistingWorkspaceCwd(input) {
292571
292632
  function publicProviderFailureDetail(detail) {
292572
292633
  return sanitizePublicProviderText(detail, { fallback: "CMMD is temporarily unavailable. Check the workspace AI connection and retry." }) ?? "CMMD is temporarily unavailable. Check the workspace AI connection and retry.";
292573
292634
  }
292635
+ /**
292636
+ * The failure detail a transcript shows, judged on the text and not the envelope.
292637
+ *
292638
+ * Forge writes its own validation copy, so `ProviderValidationError.issue` is
292639
+ * not raw provider output. Every envelope around it hides it, each in its own
292640
+ * way: `Cause.pretty` prints the error tag, and the sanitizer counts
292641
+ * "ProviderValidationError" as a provider leak, so a validation failure
292642
+ * rendered through `Cause.pretty` tripped the guard on its own wrapper. The
292643
+ * `message` getter spells the same tag out in prose. On 2026-09-16 the first of
292644
+ * those replaced "Reconnect the account and try again" with "CMMD is
292645
+ * temporarily unavailable" (#3337).
292646
+ *
292647
+ * The issue still goes through the sanitizer. `ProviderService` builds some
292648
+ * issues from a schema formatter, which echoes the decoded payload, so this is a
292649
+ * narrower input to the same guard rather than a way around it.
292650
+ */
292651
+ function publicProviderFailureDetailFromError(error) {
292652
+ if (isProviderValidationError(error)) return publicProviderFailureDetail(error.issue);
292653
+ return publicProviderFailureDetail(error instanceof Error ? error.message : String(error));
292654
+ }
292655
+ /**
292656
+ * The same judgement for a failure that arrives as a cause.
292657
+ *
292658
+ * Only the validation branch delegates. A cause carries what a bare error does
292659
+ * not: defects, interrupts, and more than one failure, all of which
292660
+ * `Cause.pretty` renders and `.message` would drop. Squashing every failure into
292661
+ * its message to reach one shared line would lose that.
292662
+ */
292663
+ function publicProviderFailureDetailFromCause(cause) {
292664
+ const error = require_Schema$1.squash(cause);
292665
+ return isProviderValidationError(error) ? publicProviderFailureDetailFromError(error) : publicProviderFailureDetail(require_Schema$1.pretty(cause));
292666
+ }
292574
292667
  function canReplaceThreadTitle(currentTitle, titleSeed) {
292575
292668
  const trimmedCurrentTitle = currentTitle.trim();
292576
292669
  if (trimmedCurrentTitle === DEFAULT_THREAD_TITLE) return true;
@@ -292726,7 +292819,7 @@ const make$8 = require_Schema$1.gen(function* () {
292726
292819
  const thread = readModel.threads.find((entry) => entry.id === threadId);
292727
292820
  if (!thread) return yield* require_Schema$1.die(/* @__PURE__ */ new Error(`Thread '${threadId}' was not found in read model.`));
292728
292821
  const desiredRuntimeMode = thread.runtimeMode;
292729
- const currentProvider = thread.session?.status !== "stopped" && require_Schema$1.is(ProviderKind)(thread.session?.providerName) ? thread.session.providerName : void 0;
292822
+ const currentProvider = thread.session?.status !== "stopped" && isProviderKind(thread.session?.providerName) ? thread.session.providerName : void 0;
292730
292823
  const rawRequestedModelSelection = options?.modelSelection;
292731
292824
  const threadProvider = currentProvider ?? thread.modelSelection.provider;
292732
292825
  const isStaleRequestedProvider = rawRequestedModelSelection !== void 0 && rawRequestedModelSelection.provider !== threadProvider;
@@ -293105,7 +293198,7 @@ const make$8 = require_Schema$1.gen(function* () {
293105
293198
  threadId: event.payload.threadId,
293106
293199
  kind: "provider.turn.start.failed",
293107
293200
  summary: "Provider turn start failed",
293108
- detail: publicProviderFailureDetail(require_Schema$1.pretty(cause)),
293201
+ detail: publicProviderFailureDetailFromCause(cause),
293109
293202
  turnId: null,
293110
293203
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
293111
293204
  })));
@@ -293121,7 +293214,14 @@ const make$8 = require_Schema$1.gen(function* () {
293121
293214
  turnId: event.payload.turnId ?? null,
293122
293215
  createdAt: event.payload.createdAt
293123
293216
  });
293124
- yield* providerService.interruptTurn({ threadId: event.payload.threadId });
293217
+ yield* providerService.interruptTurn({ threadId: event.payload.threadId }).pipe(require_Schema$1.catchCause((cause) => appendProviderFailureActivity({
293218
+ threadId: event.payload.threadId,
293219
+ kind: "provider.turn.interrupt.failed",
293220
+ summary: "Provider turn interrupt failed",
293221
+ detail: publicProviderFailureDetail(require_Schema$1.pretty(cause)),
293222
+ turnId: event.payload.turnId ?? null,
293223
+ createdAt: event.payload.createdAt
293224
+ })));
293125
293225
  });
293126
293226
  const processApprovalResponseRequested = require_Schema$1.fn("processApprovalResponseRequested")(function* (event) {
293127
293227
  const staged = peekThreadContinuationSession(event.commandId);
@@ -293158,7 +293258,7 @@ const make$8 = require_Schema$1.gen(function* () {
293158
293258
  threadId: event.payload.threadId,
293159
293259
  kind: "provider.approval.respond.failed",
293160
293260
  summary: "Provider approval response failed",
293161
- detail: isUnknownPendingApprovalRequestError(cause) ? stalePendingRequestDetail("approval", event.payload.requestId) : publicProviderFailureDetail(require_Schema$1.pretty(cause)),
293261
+ detail: isUnknownPendingApprovalRequestError(cause) ? stalePendingRequestDetail("approval", event.payload.requestId) : publicProviderFailureDetailFromCause(cause),
293162
293262
  turnId: null,
293163
293263
  createdAt: event.payload.createdAt,
293164
293264
  requestId: event.payload.requestId
@@ -293201,7 +293301,7 @@ const make$8 = require_Schema$1.gen(function* () {
293201
293301
  threadId: event.payload.threadId,
293202
293302
  kind: "provider.user-input.respond.failed",
293203
293303
  summary: "Provider user input response failed",
293204
- detail: isUnknownPendingUserInputRequestError(cause) ? stalePendingRequestDetail("user-input", event.payload.requestId) : publicProviderFailureDetail(require_Schema$1.pretty(cause)),
293304
+ detail: isUnknownPendingUserInputRequestError(cause) ? stalePendingRequestDetail("user-input", event.payload.requestId) : publicProviderFailureDetailFromCause(cause),
293205
293305
  turnId: null,
293206
293306
  createdAt: event.payload.createdAt,
293207
293307
  requestId: event.payload.requestId
@@ -293214,8 +293314,7 @@ const make$8 = require_Schema$1.gen(function* () {
293214
293314
  yield* providerService.stopSession({
293215
293315
  threadId: thread.id,
293216
293316
  ...event.payload.preserveResumeState === true ? { preserveResumeState: true } : {}
293217
- });
293218
- yield* setThreadSession({
293317
+ }).pipe(require_Schema$1.tap(() => setThreadSession({
293219
293318
  threadId: thread.id,
293220
293319
  session: {
293221
293320
  threadId: thread.id,
@@ -293227,7 +293326,14 @@ const make$8 = require_Schema$1.gen(function* () {
293227
293326
  updatedAt: now
293228
293327
  },
293229
293328
  createdAt: now
293230
- });
293329
+ })), require_Schema$1.catchCause((cause) => appendProviderFailureActivity({
293330
+ threadId: event.payload.threadId,
293331
+ kind: "provider.session.stop.failed",
293332
+ summary: "Provider session stop failed",
293333
+ detail: publicProviderFailureDetail(require_Schema$1.pretty(cause)),
293334
+ turnId: null,
293335
+ createdAt: now
293336
+ })));
293231
293337
  });
293232
293338
  const processDomainEvent = require_Schema$1.fn("processDomainEvent")(function* (event) {
293233
293339
  yield* require_Schema$1.annotateCurrentSpan({
@@ -293322,7 +293428,7 @@ const make$8 = require_Schema$1.gen(function* () {
293322
293428
  threadId: event.payload.threadId,
293323
293429
  kind: "provider.turn.start.failed",
293324
293430
  summary: "Provider turn start cleanup failed",
293325
- detail: publicProviderFailureDetail(cause instanceof Error ? cause.message : String(cause)),
293431
+ detail: publicProviderFailureDetailFromError(cause),
293326
293432
  turnId: null,
293327
293433
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
293328
293434
  })
@@ -298790,7 +298896,7 @@ function resolveBuildCommitFromEnv(env) {
298790
298896
  * environment descriptor down instead of reporting an honest "unknown".
298791
298897
  */
298792
298898
  function readBakedBuildCommit() {
298793
- return "78b0e072680ed734c4eb8337a6d38c87e7e34393";
298899
+ return "b06001f4e16f7a336e9108920f9250b366862f3d";
298794
298900
  }
298795
298901
  async function resolveServerBuildCommit(input) {
298796
298902
  if (isFullCommitSha(input.baked)) return input.baked;
@@ -322280,7 +322386,7 @@ const PlatformServicesLive = require_Schema$1.unwrap(require_Schema$1.gen(functi
322280
322386
  }));
322281
322387
  const RuntimeReplicationLayerLive = RuntimeReplicationLive.pipe(require_Schema$1.provideMerge(RuntimeReplicationClientLive), require_Schema$1.provideMerge(RuntimeReplicationOutboxLive), require_Schema$1.provideMerge(ActiveHourMeterLive.pipe(require_Schema$1.provide$1(RuntimeReplicationOutboxLive))));
322282
322388
  const RuntimeDrainLayerLive = RuntimeDrainReporterLive.pipe(require_Schema$1.provideMerge(RuntimeDrainStateLive));
322283
- const RuntimeAwareProviderReactorsLive = require_Schema$1.mergeAll(ProviderRuntimeIngestionLive, ProviderCommandReactorLive).pipe(require_Schema$1.provide$1(RuntimeDrainLayerLive), require_Schema$1.provide$1(ClaudeUsageTelemetryLive));
322389
+ const RuntimeAwareProviderReactorsLive = require_Schema$1.mergeAll(ProviderRuntimeIngestionLive, ProviderCommandReactorLive).pipe(require_Schema$1.provide$1(RuntimeDrainLayerLive), require_Schema$1.provideMerge(RuntimeDrainStateLive), require_Schema$1.provide$1(ClaudeUsageTelemetryLive));
322284
322390
  const PipelineWorkerCoordinatorLayerLive = PipelineWorkerCoordinatorLive.pipe(require_Schema$1.provideMerge(PipelineRunClientLive));
322285
322391
  const AgentProtocolReactorLayerLive = AgentProtocolReactorLive.pipe(require_Schema$1.provideMerge(PipelineRunStoreLive));
322286
322392
  const PipelineRunCoordinatorLayerLive = PipelineRunCoordinatorLive.pipe(require_Schema$1.provideMerge(PipelineProviderAuthorityInstallerLive), require_Schema$1.provideMerge(PipelineChangeInspectorLive), require_Schema$1.provideMerge(PipelineContextArtifactStoreLive), require_Schema$1.provideMerge(PipelineModelPolicyLive), require_Schema$1.provideMerge(PipelineRunClientLive), require_Schema$1.provideMerge(PipelineRunStoreLive), require_Schema$1.provideMerge(PipelineRunWorkspaceAllocatorLive), require_Schema$1.provideMerge(PipelineStagePolicyLive), require_Schema$1.provideMerge(PipelineWorkerCoordinatorLayerLive));