opencode-swarm 7.108.0 → 7.109.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,7 +54,7 @@ import {
54
54
  savePlan,
55
55
  transientBackoff,
56
56
  validateProjectRoot
57
- } from "./index-48mc4d48.js";
57
+ } from "./index-wfq4r95s.js";
58
58
  import {
59
59
  buildOpenSpecProjectionSync,
60
60
  detectSpeckit,
@@ -63,7 +63,7 @@ import {
63
63
  resolveSpeckitProjection,
64
64
  validateSpeckit,
65
65
  writeProjectedSpecSync
66
- } from "./index-91j1sqzm.js";
66
+ } from "./index-scww5b77.js";
67
67
  import {
68
68
  _internals,
69
69
  _internals1 as _internals2,
@@ -7203,11 +7203,11 @@ var _internals7 = {
7203
7203
  return KnowledgeConfigSchema2.parse({});
7204
7204
  },
7205
7205
  applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig) => {
7206
- const { applyCuratorKnowledgeUpdates } = await import("./curator-js92gc8a.js");
7206
+ const { applyCuratorKnowledgeUpdates } = await import("./curator-3efwdf9x.js");
7207
7207
  return applyCuratorKnowledgeUpdates(directory, recommendations, knowledgeConfig);
7208
7208
  },
7209
7209
  checkHivePromotions: async (entries, knowledgeConfig) => {
7210
- const { checkHivePromotions } = await import("./hive-promoter-3hh8ph4a.js");
7210
+ const { checkHivePromotions } = await import("./hive-promoter-rc6z2x8f.js");
7211
7211
  return checkHivePromotions(entries, knowledgeConfig);
7212
7212
  },
7213
7213
  applyProposalTriage: async (directory, triage) => {
@@ -7257,7 +7257,7 @@ var _internals7 = {
7257
7257
  return result;
7258
7258
  },
7259
7259
  readPriorDriftReports: async (directory) => {
7260
- const { readPriorDriftReports } = await import("./curator-drift-fdfgj9qf.js");
7260
+ const { readPriorDriftReports } = await import("./curator-drift-169wgaxn.js");
7261
7261
  return readPriorDriftReports(directory);
7262
7262
  },
7263
7263
  readSwarmKnowledge: (directory) => readKnowledge(resolveSwarmKnowledgePath(directory))
@@ -16499,8 +16499,8 @@ var _internals21 = {
16499
16499
  loadCuratorDeps: async () => {
16500
16500
  const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
16501
16501
  import("./schema-x17zmd03.js"),
16502
- import("./curator-js92gc8a.js"),
16503
- import("./curator-llm-factory-n70bxf40.js")
16502
+ import("./curator-3efwdf9x.js"),
16503
+ import("./curator-llm-factory-nttpcx4b.js")
16504
16504
  ]);
16505
16505
  return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
16506
16506
  }
@@ -16996,7 +16996,7 @@ import { fileURLToPath } from "url";
16996
16996
  // package.json
16997
16997
  var package_default = {
16998
16998
  name: "opencode-swarm",
16999
- version: "7.108.0",
16999
+ version: "7.109.0",
17000
17000
  description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
17001
17001
  main: "dist/index.js",
17002
17002
  types: "dist/index.d.ts",
@@ -19254,7 +19254,7 @@ async function handleEvidenceCommand(directory, args) {
19254
19254
  return formatTaskEvidenceMarkdown(evidenceData);
19255
19255
  }
19256
19256
  async function handleEvidenceSummaryCommand(directory) {
19257
- const { buildEvidenceSummary } = await import("./evidence-summary-service-bjhr75v0.js");
19257
+ const { buildEvidenceSummary } = await import("./evidence-summary-service-j7jwf20f.js");
19258
19258
  const artifact = await buildEvidenceSummary(directory);
19259
19259
  if (!artifact) {
19260
19260
  return "No plan found. Run `/swarm plan` to check plan status.";
@@ -30133,11 +30133,14 @@ async function handleRollbackCommand(directory, args) {
30133
30133
  // src/commands/sdd.ts
30134
30134
  import * as fs28 from "fs";
30135
30135
  import * as path59 from "path";
30136
+ var _internals43 = {
30137
+ writeProjectedSpecSync
30138
+ };
30136
30139
  var SWARM_SPEC_REL = path59.join(".swarm", "spec.md");
30137
30140
  var USAGE9 = `Usage:
30138
30141
  /swarm sdd status [--json] [--source <provider>]
30139
30142
  /swarm sdd validate [--json] [--change <id>] [--source <provider>] [--feature <id>]
30140
- /swarm sdd project [--dry-run] [--json] [--change <id>] [--source <provider>] [--feature <id>]
30143
+ /swarm sdd project [--dry-run] [--overwrite] [--json] [--change <id>] [--source <provider>] [--feature <id>]
30141
30144
 
30142
30145
  Source options (required when both openspec and speckit are detected):
30143
30146
  --source <swarm|openspec|speckit> select the SDD provider explicitly
@@ -30157,13 +30160,19 @@ function isUnsafeId(value) {
30157
30160
  return value.includes("/") || value.includes("\\") || value.includes("..") || value.includes("[") || value.includes("]") || containsControlChars(value);
30158
30161
  }
30159
30162
  function parseArgs10(args) {
30160
- const parsed = { json: false, dryRun: false };
30163
+ const parsed = {
30164
+ json: false,
30165
+ dryRun: false,
30166
+ overwrite: false
30167
+ };
30161
30168
  for (let i = 0;i < args.length; i++) {
30162
30169
  const token = args[i];
30163
30170
  if (token === "--json") {
30164
30171
  parsed.json = true;
30165
30172
  } else if (token === "--dry-run") {
30166
30173
  parsed.dryRun = true;
30174
+ } else if (token === "--overwrite") {
30175
+ parsed.overwrite = true;
30167
30176
  } else if (token === "--change") {
30168
30177
  if (i + 1 >= args.length || args[i + 1].startsWith("--")) {
30169
30178
  return { ...parsed, error: "--change requires a value" };
@@ -30472,6 +30481,20 @@ ${USAGE9}`;
30472
30481
 
30473
30482
  ${USAGE9}`;
30474
30483
  }
30484
+ if (!parsed.dryRun) {
30485
+ const nativeSpecPath = path59.join(directory, SWARM_SPEC_REL);
30486
+ if (fs28.existsSync(nativeSpecPath)) {
30487
+ if (!parsed.overwrite) {
30488
+ return [
30489
+ "Error: .swarm/spec.md already exists.",
30490
+ "Pass --overwrite to replace it.",
30491
+ "",
30492
+ USAGE9
30493
+ ].join(`
30494
+ `);
30495
+ }
30496
+ }
30497
+ }
30475
30498
  let useSpeckit = false;
30476
30499
  if (parsed.source === "speckit") {
30477
30500
  useSpeckit = true;
@@ -30506,23 +30529,34 @@ ${USAGE9}`;
30506
30529
 
30507
30530
  ${USAGE9}`;
30508
30531
  }
30509
- const result2 = writeProjectedSpecSync(directory, {
30532
+ const result2 = _internals43.writeProjectedSpecSync(directory, {
30510
30533
  source: "speckit",
30511
30534
  feature: resolution.feature,
30512
- dryRun: parsed.dryRun
30513
- });
30514
- const response2 = {
30515
- written: result2.written,
30516
30535
  dryRun: parsed.dryRun,
30517
- path: result2.path,
30518
- archivePath: result2.archivePath ?? null,
30519
- hash: result2.projection?.hash ?? null,
30520
- sourcePaths: result2.projection?.sourcePaths ?? [],
30521
- warnings: result2.projection?.warnings ?? []
30522
- };
30523
- if (parsed.json)
30524
- return JSON.stringify(response2, null, 2);
30536
+ overwrite: parsed.overwrite
30537
+ });
30538
+ if (result2.error) {
30539
+ if (parsed.json) {
30540
+ return JSON.stringify({
30541
+ written: false,
30542
+ dryRun: parsed.dryRun,
30543
+ path: result2.path,
30544
+ error: result2.error
30545
+ }, null, 2);
30546
+ }
30547
+ return `Error: ${result2.error}
30548
+
30549
+ ${USAGE9}`;
30550
+ }
30525
30551
  if (!result2.projection) {
30552
+ if (parsed.json) {
30553
+ return JSON.stringify({
30554
+ written: false,
30555
+ dryRun: parsed.dryRun,
30556
+ path: result2.path,
30557
+ error: "no valid Spec-Kit projection could be built"
30558
+ }, null, 2);
30559
+ }
30526
30560
  return [
30527
30561
  "SDD projection failed: no valid Spec-Kit projection could be built.",
30528
30562
  "",
@@ -30530,6 +30564,17 @@ ${USAGE9}`;
30530
30564
  ].join(`
30531
30565
  `);
30532
30566
  }
30567
+ const response2 = {
30568
+ written: result2.written,
30569
+ dryRun: parsed.dryRun,
30570
+ path: result2.path,
30571
+ archivePath: result2.archivePath ?? null,
30572
+ hash: result2.projection.hash,
30573
+ sourcePaths: result2.projection.sourcePaths,
30574
+ warnings: result2.projection.warnings
30575
+ };
30576
+ if (parsed.json)
30577
+ return JSON.stringify(response2, null, 2);
30533
30578
  return [
30534
30579
  parsed.dryRun ? "SDD projection preview" : "SDD projection written",
30535
30580
  `Path: ${result2.path}`,
@@ -30542,22 +30587,33 @@ ${formatList(result2.projection.warnings)}` : ""
30542
30587
  ].join(`
30543
30588
  `);
30544
30589
  }
30545
- const result = writeProjectedSpecSync(directory, {
30590
+ const result = _internals43.writeProjectedSpecSync(directory, {
30546
30591
  changeId: parsed.changeId,
30547
- dryRun: parsed.dryRun
30548
- });
30549
- const response = {
30550
- written: result.written,
30551
30592
  dryRun: parsed.dryRun,
30552
- path: result.path,
30553
- archivePath: result.archivePath ?? null,
30554
- hash: result.projection?.hash ?? null,
30555
- sourcePaths: result.projection?.sourcePaths ?? [],
30556
- warnings: result.projection?.warnings ?? []
30557
- };
30558
- if (parsed.json)
30559
- return JSON.stringify(response, null, 2);
30593
+ overwrite: parsed.overwrite
30594
+ });
30595
+ if (result.error) {
30596
+ if (parsed.json) {
30597
+ return JSON.stringify({
30598
+ written: false,
30599
+ dryRun: parsed.dryRun,
30600
+ path: result.path,
30601
+ error: result.error
30602
+ }, null, 2);
30603
+ }
30604
+ return `Error: ${result.error}
30605
+
30606
+ ${USAGE9}`;
30607
+ }
30560
30608
  if (!result.projection) {
30609
+ if (parsed.json) {
30610
+ return JSON.stringify({
30611
+ written: false,
30612
+ dryRun: parsed.dryRun,
30613
+ path: result.path,
30614
+ error: "no valid OpenSpec-compatible projection could be built"
30615
+ }, null, 2);
30616
+ }
30561
30617
  return [
30562
30618
  "SDD projection failed: no valid OpenSpec-compatible projection could be built.",
30563
30619
  "",
@@ -30565,6 +30621,17 @@ ${formatList(result2.projection.warnings)}` : ""
30565
30621
  ].join(`
30566
30622
  `);
30567
30623
  }
30624
+ const response = {
30625
+ written: result.written,
30626
+ dryRun: parsed.dryRun,
30627
+ path: result.path,
30628
+ archivePath: result.archivePath ?? null,
30629
+ hash: result.projection.hash,
30630
+ sourcePaths: result.projection.sourcePaths,
30631
+ warnings: result.projection.warnings
30632
+ };
30633
+ if (parsed.json)
30634
+ return JSON.stringify(response, null, 2);
30568
30635
  return [
30569
30636
  parsed.dryRun ? "SDD projection preview" : "SDD projection written",
30570
30637
  `Path: ${result.path}`,
@@ -30906,7 +30973,7 @@ var DEFAULT_CONTEXT_BUDGET_CONFIG = {
30906
30973
  };
30907
30974
 
30908
30975
  // src/services/status-service.ts
30909
- var _internals43 = {
30976
+ var _internals44 = {
30910
30977
  loadLeanTurboRunState,
30911
30978
  hasActiveLeanTurbo,
30912
30979
  hasActiveFullAuto
@@ -31011,7 +31078,7 @@ async function getStatusData(directory, agents) {
31011
31078
  }
31012
31079
  function enrichWithLeanTurbo(status, directory) {
31013
31080
  const turboMode = hasActiveTurboMode();
31014
- const leanActive = _internals43.hasActiveLeanTurbo();
31081
+ const leanActive = _internals44.hasActiveLeanTurbo();
31015
31082
  let turboStrategy = "off";
31016
31083
  if (leanActive) {
31017
31084
  turboStrategy = "lean";
@@ -31030,7 +31097,7 @@ function enrichWithLeanTurbo(status, directory) {
31030
31097
  }
31031
31098
  }
31032
31099
  if (leanSessionID) {
31033
- const runState = _internals43.loadLeanTurboRunState(directory, leanSessionID);
31100
+ const runState = _internals44.loadLeanTurboRunState(directory, leanSessionID);
31034
31101
  if (runState) {
31035
31102
  status.leanTurboPhase = runState.phase;
31036
31103
  status.leanMaxParallelCoders = runState.maxParallelCoders;
@@ -31062,7 +31129,7 @@ function enrichWithLeanTurbo(status, directory) {
31062
31129
  }
31063
31130
  }
31064
31131
  }
31065
- status.fullAutoActive = _internals43.hasActiveFullAuto();
31132
+ status.fullAutoActive = _internals44.hasActiveFullAuto();
31066
31133
  return status;
31067
31134
  }
31068
31135
  function formatStatusMarkdown(status) {
@@ -31216,7 +31283,7 @@ No active swarm plan found. Nothing to sync.`;
31216
31283
 
31217
31284
  // src/commands/turbo.ts
31218
31285
  init_logger();
31219
- var _internals44 = {
31286
+ var _internals45 = {
31220
31287
  loadPluginConfigWithMeta
31221
31288
  };
31222
31289
  async function handleTurboCommand(directory, args, sessionID) {
@@ -31276,7 +31343,7 @@ async function handleTurboCommand(directory, args, sessionID) {
31276
31343
  if (arg0 === "on") {
31277
31344
  let strategy = "standard";
31278
31345
  try {
31279
- const { config } = _internals44.loadPluginConfigWithMeta(directory);
31346
+ const { config } = _internals45.loadPluginConfigWithMeta(directory);
31280
31347
  if (config.turbo?.strategy === "lean") {
31281
31348
  strategy = "lean";
31282
31349
  }
@@ -31373,7 +31440,7 @@ function enableLeanTurbo(session, directory, sessionID) {
31373
31440
  let maxParallelCoders = 4;
31374
31441
  let conflictPolicy = "serialize";
31375
31442
  try {
31376
- const { config } = _internals44.loadPluginConfigWithMeta(directory);
31443
+ const { config } = _internals45.loadPluginConfigWithMeta(directory);
31377
31444
  const leanConfig = config.turbo?.lean;
31378
31445
  if (leanConfig) {
31379
31446
  maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
@@ -31589,7 +31656,7 @@ function findSimilarCommands(query) {
31589
31656
  }
31590
31657
  const scored = VALID_COMMANDS.map((cmd) => {
31591
31658
  const cmdLower = cmd.toLowerCase();
31592
- const fullScore = _internals45.levenshteinDistance(q, cmdLower);
31659
+ const fullScore = _internals46.levenshteinDistance(q, cmdLower);
31593
31660
  let tokenScore = Infinity;
31594
31661
  if (cmd.includes(" ") || cmd.includes("-")) {
31595
31662
  const qTokens = q.split(/[\s-]+/);
@@ -31602,7 +31669,7 @@ function findSimilarCommands(query) {
31602
31669
  for (const ct of cmdTokens) {
31603
31670
  if (ct.length === 0)
31604
31671
  continue;
31605
- const dist = _internals45.levenshteinDistance(qt, ct);
31672
+ const dist = _internals46.levenshteinDistance(qt, ct);
31606
31673
  if (dist < minDist)
31607
31674
  minDist = dist;
31608
31675
  }
@@ -31612,7 +31679,7 @@ function findSimilarCommands(query) {
31612
31679
  }
31613
31680
  const dashStrippedQ = q.replace(/-/g, "");
31614
31681
  const dashStrippedCmd = cmdLower.replace(/-/g, "");
31615
- const dashScore = _internals45.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
31682
+ const dashScore = _internals46.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
31616
31683
  const score = Math.min(fullScore, tokenScore, dashScore);
31617
31684
  return { cmd, score };
31618
31685
  });
@@ -31647,16 +31714,16 @@ function buildDetailedHelp(commandName, entry) {
31647
31714
  async function handleHelpCommand(ctx) {
31648
31715
  const targetCommand = ctx.args.join(" ");
31649
31716
  if (!targetCommand) {
31650
- const { buildHelpText } = await import("./index-x06d2qqm.js");
31717
+ const { buildHelpText } = await import("./index-1mjzvkzj.js");
31651
31718
  return buildHelpText();
31652
31719
  }
31653
31720
  const tokens = targetCommand.split(/\s+/);
31654
- const resolved = _internals45.resolveCommand(tokens);
31721
+ const resolved = _internals46.resolveCommand(tokens);
31655
31722
  if (resolved) {
31656
- return _internals45.buildDetailedHelp(resolved.key, resolved.entry);
31723
+ return _internals46.buildDetailedHelp(resolved.key, resolved.entry);
31657
31724
  }
31658
- const similar = _internals45.findSimilarCommands(targetCommand);
31659
- const { buildHelpText: fullHelp } = await import("./index-x06d2qqm.js");
31725
+ const similar = _internals46.findSimilarCommands(targetCommand);
31726
+ const { buildHelpText: fullHelp } = await import("./index-1mjzvkzj.js");
31660
31727
  if (similar.length > 0) {
31661
31728
  return `Command '/swarm ${targetCommand}' not found.
31662
31729
 
@@ -31720,7 +31787,7 @@ var COMMAND_REGISTRY = {
31720
31787
  toolNoArgs: true
31721
31788
  },
31722
31789
  help: {
31723
- handler: (ctx) => _internals45.handleHelpCommand(ctx),
31790
+ handler: (ctx) => _internals46.handleHelpCommand(ctx),
31724
31791
  description: "Show help for swarm commands",
31725
31792
  category: "core",
31726
31793
  args: "[command]",
@@ -31789,7 +31856,7 @@ var COMMAND_REGISTRY = {
31789
31856
  },
31790
31857
  "guardrail explain": {
31791
31858
  handler: async (ctx) => {
31792
- const { handleGuardrailExplain } = await import("./guardrail-explain-sn2a4pb7.js");
31859
+ const { handleGuardrailExplain } = await import("./guardrail-explain-e85gbj0r.js");
31793
31860
  return handleGuardrailExplain(ctx.directory, ctx.args);
31794
31861
  },
31795
31862
  description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
@@ -32066,9 +32133,9 @@ Subcommands:
32066
32133
  handler: (ctx) => handleSddProjectCommand(ctx.directory, ctx.args),
32067
32134
  description: "Materialize the OpenSpec-compatible effective spec into .swarm/spec.md",
32068
32135
  subcommandOf: "sdd",
32069
- args: "[--dry-run] [--json] [--change <id>]",
32136
+ args: "[--dry-run] [--overwrite] [--json] [--change <id>]",
32070
32137
  category: "utility",
32071
- toolPolicy: "human-only"
32138
+ toolPolicy: "agent"
32072
32139
  },
32073
32140
  "sdd-status": {
32074
32141
  handler: (ctx) => handleSddStatusCommand(ctx.directory, ctx.args),
@@ -32615,7 +32682,7 @@ function validateToolPolicy() {
32615
32682
  }
32616
32683
  return { valid: warnings.length === 0, warnings };
32617
32684
  }
32618
- var _internals45 = {
32685
+ var _internals46 = {
32619
32686
  handleHelpCommand,
32620
32687
  validateAliases,
32621
32688
  validateToolPolicy,
@@ -32625,16 +32692,16 @@ var _internals45 = {
32625
32692
  findSimilarCommands,
32626
32693
  buildDetailedHelp
32627
32694
  };
32628
- var validation = _internals45.validateAliases();
32695
+ var validation = _internals46.validateAliases();
32629
32696
  if (!validation.valid) {
32630
32697
  throw new Error(`COMMAND_REGISTRY alias validation failed:
32631
32698
  ${validation.errors.join(`
32632
32699
  `)}`);
32633
32700
  }
32634
- _internals45.emitValidationWarnings("COMMAND_REGISTRY alias warnings", validation.warnings);
32701
+ _internals46.emitValidationWarnings("COMMAND_REGISTRY alias warnings", validation.warnings);
32635
32702
  try {
32636
- const toolPolicyValidation = _internals45.validateToolPolicy();
32637
- _internals45.emitValidationWarnings("COMMAND_REGISTRY toolPolicy warnings", toolPolicyValidation.warnings);
32703
+ const toolPolicyValidation = _internals46.validateToolPolicy();
32704
+ _internals46.emitValidationWarnings("COMMAND_REGISTRY toolPolicy warnings", toolPolicyValidation.warnings);
32638
32705
  } catch (e) {
32639
32706
  warn(`COMMAND_REGISTRY toolPolicy validation failed (non-fatal): ${e.message}`);
32640
32707
  }
@@ -34289,7 +34356,7 @@ function formatCommandNotFound(tokens) {
34289
34356
  const attemptedCommand = tokens[0] || "";
34290
34357
  const MAX_DISPLAY = 100;
34291
34358
  const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
34292
- const similar = _internals45.findSimilarCommands(attemptedCommand);
34359
+ const similar = _internals46.findSimilarCommands(attemptedCommand);
34293
34360
  const header = `Command \`/swarm ${displayCommand}\` not found.`;
34294
34361
  const suggestions = similar.length > 0 ? `Did you mean:
34295
34362
  ${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
@@ -34555,7 +34622,7 @@ function classifySwarmCommandChatFallbackUse(resolved) {
34555
34622
  message: "/swarm config doctor --fix is not available through chat fallback because it can modify configuration files. Run the CLI command directly when you intend to apply fixes."
34556
34623
  };
34557
34624
  }
34558
- if (canonicalKey === "knowledge migrate" || canonicalKey === "knowledge quarantine" || canonicalKey === "knowledge restore" || canonicalKey === "memory import" || canonicalKey === "memory migrate" || canonicalKey === "memory compact" || canonicalKey === "sdd project") {
34625
+ if (canonicalKey === "knowledge migrate" || canonicalKey === "knowledge quarantine" || canonicalKey === "knowledge restore" || canonicalKey === "memory import" || canonicalKey === "memory migrate" || canonicalKey === "memory compact") {
34559
34626
  return {
34560
34627
  allowed: false,
34561
34628
  message: `/swarm ${canonicalKey} is not available through chat fallback because it mutates .swarm state. ` + "Run the CLI command directly after confirming the intended state change."
@@ -36206,10 +36273,10 @@ function startAgentSession(sessionId, agentName, staleDurationMs = STALE_SESSION
36206
36273
  }
36207
36274
  telemetry.sessionStarted(sessionId, agentName);
36208
36275
  swarmState.activeAgent.set(sessionId, agentName);
36209
- _internals48.applyRehydrationCache(sessionState);
36276
+ _internals49.applyRehydrationCache(sessionState);
36210
36277
  if (directory) {
36211
36278
  let rehydrationPromise;
36212
- rehydrationPromise = _internals48.rehydrateSessionFromDisk(directory, sessionState).then(async () => {
36279
+ rehydrationPromise = _internals49.rehydrateSessionFromDisk(directory, sessionState).then(async () => {
36213
36280
  try {
36214
36281
  sessionState.prSubscriptions = await rehydratePrSubscriptions(sessionId, directory);
36215
36282
  } catch (err) {
@@ -36390,7 +36457,7 @@ function ensureAgentSession(sessionId, agentName, directory) {
36390
36457
  maybeSweepStaleSessions();
36391
36458
  return session;
36392
36459
  }
36393
- _internals48.startAgentSession(sessionId, agentName ?? "unknown", 7200000, directory);
36460
+ _internals49.startAgentSession(sessionId, agentName ?? "unknown", 7200000, directory);
36394
36461
  session = swarmState.agentSessions.get(sessionId);
36395
36462
  if (!session) {
36396
36463
  throw new Error(`Failed to create guardrail session for ${sessionId}`);
@@ -36678,8 +36745,8 @@ function applyRehydrationCache(session) {
36678
36745
  }
36679
36746
  }
36680
36747
  async function rehydrateSessionFromDisk(directory, session) {
36681
- await _internals48.buildRehydrationCache(directory);
36682
- _internals48.applyRehydrationCache(session);
36748
+ await _internals49.buildRehydrationCache(directory);
36749
+ _internals49.applyRehydrationCache(session);
36683
36750
  }
36684
36751
  function hasActiveTurboMode(sessionID) {
36685
36752
  if (sessionID) {
@@ -36753,7 +36820,7 @@ async function rehydratePrSubscriptions(sessionID, directory) {
36753
36820
  }
36754
36821
  return map;
36755
36822
  }
36756
- var _internals48 = {
36823
+ var _internals49 = {
36757
36824
  swarmState,
36758
36825
  resetSwarmState,
36759
36826
  ensureAgentSession,
@@ -36892,4 +36959,4 @@ function createCuratorLLMDelegate(directory, mode = "init", sessionId) {
36892
36959
  };
36893
36960
  }
36894
36961
 
36895
- export { package_default, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleArchiveCommand, DC_SAFE_TARGETS, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcValidateTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleClarifyCommand, createCuratorLLMDelegate, _internals10 as _internals, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, checkHivePromotions, createHivePromoterHook, promoteToHive, promoteFromSwarm, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleHandoffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS, _internals45 as _internals1, resolveCommand };
36962
+ export { package_default, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleArchiveCommand, DC_SAFE_TARGETS, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcValidateTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleClarifyCommand, createCuratorLLMDelegate, _internals10 as _internals, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, checkHivePromotions, createHivePromoterHook, promoteToHive, promoteFromSwarm, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleHandoffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS, _internals46 as _internals1, resolveCommand };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  readEffectiveSpecSync
4
- } from "./index-91j1sqzm.js";
4
+ } from "./index-scww5b77.js";
5
5
  import {
6
6
  _internals,
7
7
  buildDefaultPolicy,
package/dist/cli/index.js CHANGED
@@ -7,13 +7,13 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-1emhz3zb.js";
10
+ } from "./index-vb5t1kvs.js";
11
11
  import"./index-wj4jeavn.js";
12
12
  import"./index-5gnp8fyw.js";
13
13
  import"./index-c8s9a3zh.js";
14
14
  import"./index-fm7xz1ne.js";
15
- import"./index-48mc4d48.js";
16
- import"./index-91j1sqzm.js";
15
+ import"./index-wfq4r95s.js";
16
+ import"./index-scww5b77.js";
17
17
  import"./index-yw8qpf51.js";
18
18
  import"./index-85bacexr.js";
19
19
  import"./index-09xpycan.js";
@@ -422,9 +422,9 @@ export declare const COMMAND_REGISTRY: {
422
422
  readonly handler: (ctx: CommandContext) => Promise<string>;
423
423
  readonly description: "Materialize the OpenSpec-compatible effective spec into .swarm/spec.md";
424
424
  readonly subcommandOf: "sdd";
425
- readonly args: "[--dry-run] [--json] [--change <id>]";
425
+ readonly args: "[--dry-run] [--overwrite] [--json] [--change <id>]";
426
426
  readonly category: "utility";
427
- readonly toolPolicy: "human-only";
427
+ readonly toolPolicy: "agent";
428
428
  };
429
429
  readonly 'sdd-status': {
430
430
  readonly handler: (ctx: CommandContext) => Promise<string>;
@@ -1,6 +1,16 @@
1
+ import { writeProjectedSpecSync } from '../sdd/effective-spec';
2
+ /**
3
+ * DI seam for testing TOCTOU error propagation without filesystem races.
4
+ * Tests override `_internals.writeProjectedSpecSync` to inject an error result,
5
+ * then restore the original in `afterEach`.
6
+ */
7
+ export declare const _internals: {
8
+ writeProjectedSpecSync: typeof writeProjectedSpecSync;
9
+ };
1
10
  interface ParsedSddArgs {
2
11
  json: boolean;
3
12
  dryRun: boolean;
13
+ overwrite: boolean;
4
14
  changeId?: string;
5
15
  source?: 'swarm' | 'openspec' | 'speckit';
6
16
  feature?: string;