opencode-swarm 6.40.7 → 6.40.8

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/cli/index.js CHANGED
@@ -34157,7 +34157,8 @@ function serializeAgentSession(s) {
34157
34157
  model_fallback_index: s.model_fallback_index ?? 0,
34158
34158
  modelFallbackExhausted: s.modelFallbackExhausted ?? false,
34159
34159
  coderRevisions: s.coderRevisions ?? 0,
34160
- revisionLimitHit: s.revisionLimitHit ?? false
34160
+ revisionLimitHit: s.revisionLimitHit ?? false,
34161
+ sessionRehydratedAt: s.sessionRehydratedAt ?? 0
34161
34162
  };
34162
34163
  }
34163
34164
  async function writeSnapshot(directory, state) {
@@ -39564,6 +39565,9 @@ async function handleResetSessionCommand(directory, _args) {
39564
39565
  const sessionCount = swarmState.agentSessions.size;
39565
39566
  swarmState.agentSessions.clear();
39566
39567
  results.push(`\u2705 Cleared ${sessionCount} in-memory agent session(s)`);
39568
+ const chainCount = swarmState.delegationChains.size;
39569
+ swarmState.delegationChains.clear();
39570
+ results.push(`\u2705 Cleared ${chainCount} delegation chain(s)`);
39567
39571
  return [
39568
39572
  "## Session State Reset",
39569
39573
  "",
package/dist/index.js CHANGED
@@ -40852,7 +40852,8 @@ function startAgentSession(sessionId, agentName, staleDurationMs = 7200000, dire
40852
40852
  coderRevisions: 0,
40853
40853
  revisionLimitHit: false,
40854
40854
  loopDetectionWindow: [],
40855
- pendingAdvisoryMessages: []
40855
+ pendingAdvisoryMessages: [],
40856
+ sessionRehydratedAt: 0
40856
40857
  };
40857
40858
  swarmState.agentSessions.set(sessionId, sessionState);
40858
40859
  telemetry.sessionStarted(sessionId, agentName);
@@ -40982,6 +40983,9 @@ function ensureAgentSession(sessionId, agentName, directory) {
40982
40983
  if (session.revisionLimitHit === undefined) {
40983
40984
  session.revisionLimitHit = false;
40984
40985
  }
40986
+ if (session.sessionRehydratedAt === undefined) {
40987
+ session.sessionRehydratedAt = 0;
40988
+ }
40985
40989
  session.lastToolCallTime = now;
40986
40990
  return session;
40987
40991
  }
@@ -48292,7 +48296,8 @@ function serializeAgentSession(s) {
48292
48296
  model_fallback_index: s.model_fallback_index ?? 0,
48293
48297
  modelFallbackExhausted: s.modelFallbackExhausted ?? false,
48294
48298
  coderRevisions: s.coderRevisions ?? 0,
48295
- revisionLimitHit: s.revisionLimitHit ?? false
48299
+ revisionLimitHit: s.revisionLimitHit ?? false,
48300
+ sessionRehydratedAt: s.sessionRehydratedAt ?? 0
48296
48301
  };
48297
48302
  }
48298
48303
  async function writeSnapshot(directory, state) {
@@ -49073,6 +49078,9 @@ async function handleResetSessionCommand(directory, _args) {
49073
49078
  const sessionCount = swarmState.agentSessions.size;
49074
49079
  swarmState.agentSessions.clear();
49075
49080
  results.push(`\u2705 Cleared ${sessionCount} in-memory agent session(s)`);
49081
+ const chainCount = swarmState.delegationChains.size;
49082
+ swarmState.delegationChains.clear();
49083
+ results.push(`\u2705 Cleared ${chainCount} delegation chain(s)`);
49076
49084
  return [
49077
49085
  "## Session State Reset",
49078
49086
  "",
@@ -52726,13 +52734,21 @@ function createDelegationGateHook(config3, directory) {
52726
52734
  for (const [taskId, state] of session.taskWorkflowStates) {
52727
52735
  if (state !== "coder_delegated")
52728
52736
  continue;
52737
+ const freshnessThreshold = session.sessionRehydratedAt > 0 ? session.sessionRehydratedAt : session.lastPhaseCompleteTimestamp ?? 0;
52738
+ const delegationChains = swarmState.delegationChains.get(input.sessionID) ?? [];
52739
+ const hasCurrentSessionCoderDelegation = delegationChains.some((d) => stripKnownSwarmPrefix(d.to) === "coder" && d.timestamp > freshnessThreshold);
52740
+ if (!hasCurrentSessionCoderDelegation) {
52741
+ session.taskWorkflowStates.set(taskId, "idle");
52742
+ console.warn(`[delegation-gate] Reset stale coder_delegated state for task ${taskId} \u2014 ` + `no coder delegation found in current session.`);
52743
+ continue;
52744
+ }
52729
52745
  const turbo = hasActiveTurboMode(input.sessionID);
52730
52746
  if (turbo) {
52731
52747
  const isTier3 = taskId.startsWith("3.");
52732
52748
  if (!isTier3)
52733
52749
  continue;
52734
52750
  }
52735
- throw new Error(`REVIEWER_GATE_VIOLATION: Cannot re-delegate to coder without reviewer delegation. ` + `Task ${taskId} state: coder_delegated. Delegate to reviewer first.`);
52751
+ throw new Error(`REVIEWER_GATE_VIOLATION: Cannot re-delegate to coder without reviewer delegation. ` + `Task ${taskId} state: coder_delegated. Delegate to reviewer first. ` + `If this is stale state from a prior session, run /swarm reset-session to clear workflow state.`);
52736
52752
  }
52737
52753
  };
52738
52754
  const toolAfter = async (input, _output) => {
@@ -56938,7 +56954,8 @@ function deserializeAgentSession(s) {
56938
56954
  model_fallback_index: s.model_fallback_index ?? 0,
56939
56955
  modelFallbackExhausted: s.modelFallbackExhausted ?? false,
56940
56956
  coderRevisions: s.coderRevisions ?? 0,
56941
- revisionLimitHit: s.revisionLimitHit ?? false
56957
+ revisionLimitHit: s.revisionLimitHit ?? false,
56958
+ sessionRehydratedAt: s.sessionRehydratedAt ?? 0
56942
56959
  };
56943
56960
  }
56944
56961
  async function readSnapshot(directory) {
@@ -56999,6 +57016,7 @@ async function rehydrateState(snapshot) {
56999
57016
  const session = deserializeAgentSession(serializedSession);
57000
57017
  session.lastToolCallTime = now;
57001
57018
  session.lastAgentEventTime = now;
57019
+ session.sessionRehydratedAt = now;
57002
57020
  if (session.windows) {
57003
57021
  for (const window2 of Object.values(session.windows)) {
57004
57022
  window2.startedAtMs = now;
@@ -49,6 +49,8 @@ export interface SerializedAgentSession {
49
49
  coderRevisions: number;
50
50
  /** Flag set when coder revisions hit the configured ceiling (v6.33) */
51
51
  revisionLimitHit: boolean;
52
+ /** Timestamp when session was rehydrated from snapshot (0 if never rehydrated) */
53
+ sessionRehydratedAt?: number;
52
54
  }
53
55
  /**
54
56
  * Minimal interface for serialized InvocationWindow
package/dist/state.d.ts CHANGED
@@ -139,6 +139,8 @@ export interface AgentSessionState {
139
139
  contextPressureWarningSent?: boolean;
140
140
  /** Queue of advisory messages (e.g., SLOP, context pressure) pending injection into next messagesTransform */
141
141
  pendingAdvisoryMessages?: string[];
142
+ /** Timestamp when session was rehydrated from snapshot (0 if never rehydrated) */
143
+ sessionRehydratedAt: number;
142
144
  }
143
145
  /**
144
146
  * Represents a single agent invocation window with isolated guardrail budgets.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "6.40.7",
3
+ "version": "6.40.8",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",