opencode-swarm 6.40.6 → 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
@@ -33150,26 +33150,31 @@ async function checkGrammarWasmFiles() {
33150
33150
  const grammarFiles = [
33151
33151
  "tree-sitter-javascript.wasm",
33152
33152
  "tree-sitter-typescript.wasm",
33153
+ "tree-sitter-tsx.wasm",
33153
33154
  "tree-sitter-python.wasm",
33154
33155
  "tree-sitter-go.wasm",
33155
33156
  "tree-sitter-rust.wasm",
33156
33157
  "tree-sitter-cpp.wasm",
33157
33158
  "tree-sitter-c-sharp.wasm",
33158
33159
  "tree-sitter-css.wasm",
33159
- "tree-sitter-html.wasm",
33160
- "tree-sitter-json.wasm",
33161
33160
  "tree-sitter-bash.wasm",
33162
33161
  "tree-sitter-ruby.wasm",
33163
33162
  "tree-sitter-php.wasm",
33164
33163
  "tree-sitter-java.wasm",
33165
33164
  "tree-sitter-kotlin.wasm",
33166
33165
  "tree-sitter-swift.wasm",
33167
- "tree-sitter-dart.wasm"
33166
+ "tree-sitter-dart.wasm",
33167
+ "tree-sitter-powershell.wasm",
33168
+ "tree-sitter-ini.wasm",
33169
+ "tree-sitter-regex.wasm"
33168
33170
  ];
33169
33171
  const thisDir = path12.dirname(fileURLToPath(import.meta.url));
33170
33172
  const isSource = thisDir.replace(/\\/g, "/").endsWith("/src/services");
33171
33173
  const grammarDir = isSource ? path12.join(thisDir, "..", "lang", "grammars") : path12.join(thisDir, "lang", "grammars");
33172
33174
  const missing = [];
33175
+ if (!existsSync4(path12.join(grammarDir, "tree-sitter.wasm"))) {
33176
+ missing.push("tree-sitter.wasm (core runtime)");
33177
+ }
33173
33178
  for (const file3 of grammarFiles) {
33174
33179
  if (!existsSync4(path12.join(grammarDir, file3))) {
33175
33180
  missing.push(file3);
@@ -33179,13 +33184,13 @@ async function checkGrammarWasmFiles() {
33179
33184
  return {
33180
33185
  name: "Grammar WASM Files",
33181
33186
  status: "\u2705",
33182
- detail: "All 17 grammar WASM files present"
33187
+ detail: `Core runtime + all ${grammarFiles.length} grammar WASM files present`
33183
33188
  };
33184
33189
  }
33185
33190
  return {
33186
33191
  name: "Grammar WASM Files",
33187
33192
  status: "\u274C",
33188
- detail: `${missing.length} grammar WASM file(s) missing: ${missing.join(", ")}`
33193
+ detail: `${missing.length} WASM file(s) missing: ${missing.join(", ")}`
33189
33194
  };
33190
33195
  }
33191
33196
  async function checkCheckpointManifest(directory) {
@@ -34152,7 +34157,8 @@ function serializeAgentSession(s) {
34152
34157
  model_fallback_index: s.model_fallback_index ?? 0,
34153
34158
  modelFallbackExhausted: s.modelFallbackExhausted ?? false,
34154
34159
  coderRevisions: s.coderRevisions ?? 0,
34155
- revisionLimitHit: s.revisionLimitHit ?? false
34160
+ revisionLimitHit: s.revisionLimitHit ?? false,
34161
+ sessionRehydratedAt: s.sessionRehydratedAt ?? 0
34156
34162
  };
34157
34163
  }
34158
34164
  async function writeSnapshot(directory, state) {
@@ -39559,6 +39565,9 @@ async function handleResetSessionCommand(directory, _args) {
39559
39565
  const sessionCount = swarmState.agentSessions.size;
39560
39566
  swarmState.agentSessions.clear();
39561
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)`);
39562
39571
  return [
39563
39572
  "## Session State Reset",
39564
39573
  "",
package/dist/index.js CHANGED
@@ -40757,6 +40757,7 @@ var init_runtime = __esm(() => {
40757
40757
  LANGUAGE_WASM_MAP = {
40758
40758
  javascript: "tree-sitter-javascript.wasm",
40759
40759
  typescript: "tree-sitter-typescript.wasm",
40760
+ tsx: "tree-sitter-tsx.wasm",
40760
40761
  python: "tree-sitter-python.wasm",
40761
40762
  go: "tree-sitter-go.wasm",
40762
40763
  rust: "tree-sitter-rust.wasm",
@@ -40770,7 +40771,10 @@ var init_runtime = __esm(() => {
40770
40771
  java: "tree-sitter-java.wasm",
40771
40772
  kotlin: "tree-sitter-kotlin.wasm",
40772
40773
  swift: "tree-sitter-swift.wasm",
40773
- dart: "tree-sitter-dart.wasm"
40774
+ dart: "tree-sitter-dart.wasm",
40775
+ powershell: "tree-sitter-powershell.wasm",
40776
+ ini: "tree-sitter-ini.wasm",
40777
+ regex: "tree-sitter-regex.wasm"
40774
40778
  };
40775
40779
  });
40776
40780
 
@@ -40848,7 +40852,8 @@ function startAgentSession(sessionId, agentName, staleDurationMs = 7200000, dire
40848
40852
  coderRevisions: 0,
40849
40853
  revisionLimitHit: false,
40850
40854
  loopDetectionWindow: [],
40851
- pendingAdvisoryMessages: []
40855
+ pendingAdvisoryMessages: [],
40856
+ sessionRehydratedAt: 0
40852
40857
  };
40853
40858
  swarmState.agentSessions.set(sessionId, sessionState);
40854
40859
  telemetry.sessionStarted(sessionId, agentName);
@@ -40978,6 +40983,9 @@ function ensureAgentSession(sessionId, agentName, directory) {
40978
40983
  if (session.revisionLimitHit === undefined) {
40979
40984
  session.revisionLimitHit = false;
40980
40985
  }
40986
+ if (session.sessionRehydratedAt === undefined) {
40987
+ session.sessionRehydratedAt = 0;
40988
+ }
40981
40989
  session.lastToolCallTime = now;
40982
40990
  return session;
40983
40991
  }
@@ -47280,26 +47288,31 @@ async function checkGrammarWasmFiles() {
47280
47288
  const grammarFiles = [
47281
47289
  "tree-sitter-javascript.wasm",
47282
47290
  "tree-sitter-typescript.wasm",
47291
+ "tree-sitter-tsx.wasm",
47283
47292
  "tree-sitter-python.wasm",
47284
47293
  "tree-sitter-go.wasm",
47285
47294
  "tree-sitter-rust.wasm",
47286
47295
  "tree-sitter-cpp.wasm",
47287
47296
  "tree-sitter-c-sharp.wasm",
47288
47297
  "tree-sitter-css.wasm",
47289
- "tree-sitter-html.wasm",
47290
- "tree-sitter-json.wasm",
47291
47298
  "tree-sitter-bash.wasm",
47292
47299
  "tree-sitter-ruby.wasm",
47293
47300
  "tree-sitter-php.wasm",
47294
47301
  "tree-sitter-java.wasm",
47295
47302
  "tree-sitter-kotlin.wasm",
47296
47303
  "tree-sitter-swift.wasm",
47297
- "tree-sitter-dart.wasm"
47304
+ "tree-sitter-dart.wasm",
47305
+ "tree-sitter-powershell.wasm",
47306
+ "tree-sitter-ini.wasm",
47307
+ "tree-sitter-regex.wasm"
47298
47308
  ];
47299
47309
  const thisDir = path18.dirname(fileURLToPath(import.meta.url));
47300
47310
  const isSource = thisDir.replace(/\\/g, "/").endsWith("/src/services");
47301
47311
  const grammarDir = isSource ? path18.join(thisDir, "..", "lang", "grammars") : path18.join(thisDir, "lang", "grammars");
47302
47312
  const missing = [];
47313
+ if (!existsSync8(path18.join(grammarDir, "tree-sitter.wasm"))) {
47314
+ missing.push("tree-sitter.wasm (core runtime)");
47315
+ }
47303
47316
  for (const file3 of grammarFiles) {
47304
47317
  if (!existsSync8(path18.join(grammarDir, file3))) {
47305
47318
  missing.push(file3);
@@ -47309,13 +47322,13 @@ async function checkGrammarWasmFiles() {
47309
47322
  return {
47310
47323
  name: "Grammar WASM Files",
47311
47324
  status: "\u2705",
47312
- detail: "All 17 grammar WASM files present"
47325
+ detail: `Core runtime + all ${grammarFiles.length} grammar WASM files present`
47313
47326
  };
47314
47327
  }
47315
47328
  return {
47316
47329
  name: "Grammar WASM Files",
47317
47330
  status: "\u274C",
47318
- detail: `${missing.length} grammar WASM file(s) missing: ${missing.join(", ")}`
47331
+ detail: `${missing.length} WASM file(s) missing: ${missing.join(", ")}`
47319
47332
  };
47320
47333
  }
47321
47334
  async function checkCheckpointManifest(directory) {
@@ -48283,7 +48296,8 @@ function serializeAgentSession(s) {
48283
48296
  model_fallback_index: s.model_fallback_index ?? 0,
48284
48297
  modelFallbackExhausted: s.modelFallbackExhausted ?? false,
48285
48298
  coderRevisions: s.coderRevisions ?? 0,
48286
- revisionLimitHit: s.revisionLimitHit ?? false
48299
+ revisionLimitHit: s.revisionLimitHit ?? false,
48300
+ sessionRehydratedAt: s.sessionRehydratedAt ?? 0
48287
48301
  };
48288
48302
  }
48289
48303
  async function writeSnapshot(directory, state) {
@@ -49064,6 +49078,9 @@ async function handleResetSessionCommand(directory, _args) {
49064
49078
  const sessionCount = swarmState.agentSessions.size;
49065
49079
  swarmState.agentSessions.clear();
49066
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)`);
49067
49084
  return [
49068
49085
  "## Session State Reset",
49069
49086
  "",
@@ -52717,13 +52734,21 @@ function createDelegationGateHook(config3, directory) {
52717
52734
  for (const [taskId, state] of session.taskWorkflowStates) {
52718
52735
  if (state !== "coder_delegated")
52719
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
+ }
52720
52745
  const turbo = hasActiveTurboMode(input.sessionID);
52721
52746
  if (turbo) {
52722
52747
  const isTier3 = taskId.startsWith("3.");
52723
52748
  if (!isTier3)
52724
52749
  continue;
52725
52750
  }
52726
- 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.`);
52727
52752
  }
52728
52753
  };
52729
52754
  const toolAfter = async (input, _output) => {
@@ -56929,7 +56954,8 @@ function deserializeAgentSession(s) {
56929
56954
  model_fallback_index: s.model_fallback_index ?? 0,
56930
56955
  modelFallbackExhausted: s.modelFallbackExhausted ?? false,
56931
56956
  coderRevisions: s.coderRevisions ?? 0,
56932
- revisionLimitHit: s.revisionLimitHit ?? false
56957
+ revisionLimitHit: s.revisionLimitHit ?? false,
56958
+ sessionRehydratedAt: s.sessionRehydratedAt ?? 0
56933
56959
  };
56934
56960
  }
56935
56961
  async function readSnapshot(directory) {
@@ -56990,6 +57016,7 @@ async function rehydrateState(snapshot) {
56990
57016
  const session = deserializeAgentSession(serializedSession);
56991
57017
  session.lastToolCallTime = now;
56992
57018
  session.lastAgentEventTime = now;
57019
+ session.sessionRehydratedAt = now;
56993
57020
  if (session.windows) {
56994
57021
  for (const window2 of Object.values(session.windows)) {
56995
57022
  window2.startedAtMs = now;
Binary file
@@ -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.6",
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",