opencode-swarm 7.118.0 → 7.119.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.
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  readEffectiveSpecSync
4
- } from "./index-scww5b77.js";
4
+ } from "./index-vwvkpg0d.js";
5
5
  import {
6
6
  _internals,
7
7
  buildDefaultPolicy,
@@ -17,6 +17,7 @@ import {
17
17
  criticalWarn,
18
18
  error,
19
19
  init_logger,
20
+ log,
20
21
  warn
21
22
  } from "./index-zgwm4ryv.js";
22
23
  import {
@@ -2128,6 +2129,7 @@ function computeLcsDiff(oldLines, newLines) {
2128
2129
  import * as crypto2 from "crypto";
2129
2130
  import * as fs5 from "fs";
2130
2131
  import * as path8 from "path";
2132
+ init_logger();
2131
2133
 
2132
2134
  // src/plan/utils.ts
2133
2135
  function derivePlanId(plan) {
@@ -2252,7 +2254,7 @@ async function readLedgerEvents(directory) {
2252
2254
  }
2253
2255
  }
2254
2256
  if (skippedCount > 0) {
2255
- console.warn(`[ledger] Skipped ${skippedCount} malformed line(s) in plan-ledger.jsonl`);
2257
+ log(`[ledger] Skipped ${skippedCount} malformed line(s) in plan-ledger.jsonl`);
2256
2258
  }
2257
2259
  events.sort((a, b) => a.seq - b.seq);
2258
2260
  return events;
@@ -2347,7 +2349,7 @@ async function takeSnapshotWithRetry(directory, plan, options) {
2347
2349
  }
2348
2350
  }
2349
2351
  }
2350
- console.warn(`[takeSnapshotWithRetry] Snapshot failed after ${MAX_RETRIES} retries (${TOTAL_ATTEMPTS} attempts): ${lastError.message}`);
2352
+ criticalWarn(`[takeSnapshotWithRetry] Snapshot failed after ${MAX_RETRIES} retries (${TOTAL_ATTEMPTS} attempts): ${lastError.message}`);
2351
2353
  try {
2352
2354
  emit("snapshot_failed", {
2353
2355
  error: lastError.message,
@@ -2578,7 +2580,7 @@ async function quarantineLedgerSuffix(directory, badSuffix) {
2578
2580
  } catch {}
2579
2581
  const quarantinePath = path8.join(swarmDir, `plan-ledger.quarantine.${Date.now()}.${hash}`);
2580
2582
  fs5.writeFileSync(quarantinePath, badSuffix, "utf8");
2581
- console.warn(`[ledger] Corrupted suffix quarantined to ${path8.relative(directory, quarantinePath)} (salvageable events: ${salvagedCount})`);
2583
+ log(`[ledger] Corrupted suffix quarantined to ${path8.relative(directory, quarantinePath)} (salvageable events: ${salvagedCount})`);
2582
2584
  return { path: quarantinePath, salvagedCount };
2583
2585
  } catch {
2584
2586
  return { path: null, salvagedCount };
@@ -3835,7 +3837,7 @@ function migrateLegacyPlan(planContent, swarmId) {
3835
3837
  }
3836
3838
  let migrationStatus = "migrated";
3837
3839
  if (phases.length === 0) {
3838
- console.warn(`migrateLegacyPlan: 0 phases parsed from ${lines.length} lines. First 3 lines: ${lines.slice(0, 3).join(" | ")}`);
3840
+ criticalWarn(`migrateLegacyPlan: 0 phases parsed from ${lines.length} lines. First 3 lines: ${lines.slice(0, 3).join(" | ")}`);
3839
3841
  migrationStatus = "migration_failed";
3840
3842
  phases.push({
3841
3843
  id: 1,
@@ -1,4 +1,7 @@
1
1
  // @bun
2
+ import {
3
+ advisoryWarn
4
+ } from "./index-ye3fndsw.js";
2
5
  import {
3
6
  log
4
7
  } from "./index-zgwm4ryv.js";
@@ -76,7 +79,7 @@ async function removeLaneProfileFromDiskReal(worktreePath, laneIndex) {
76
79
  await fs.promises.unlink(envPath);
77
80
  } catch (err) {
78
81
  if (err.code !== "ENOENT") {
79
- console.warn(`[worktree] Failed to remove lane profile ${envPath}: ${err.message}`);
82
+ log(`[worktree] Failed to remove lane profile ${envPath}: ${err.message}`);
80
83
  }
81
84
  }
82
85
  }
@@ -198,7 +201,7 @@ async function provisionWorktree(directory, id, sessionId, options) {
198
201
  const budgetResult = await checkPathBudget(worktreePath, directory);
199
202
  if (budgetResult.ok === false) {
200
203
  if (options.worktreeDir) {
201
- console.warn(`[swarm] Path budget warning: ${budgetResult.error} ${budgetResult.suggestion}`);
204
+ advisoryWarn(`[swarm] Path budget warning: ${budgetResult.error} ${budgetResult.suggestion}`);
202
205
  } else {
203
206
  const shortPath = shortenWorktreePath(directory, sessionId, id);
204
207
  const shortBudget = await checkPathBudget(shortPath, directory);
@@ -310,7 +313,7 @@ async function provisionWorktree(directory, id, sessionId, options) {
310
313
  _internals.fs.symlinkSync(hostDepDir, laneDepDir, isWindows ? "junction" : "dir");
311
314
  }
312
315
  } catch (e) {
313
- console.warn(`[swarm] deps_strategy '${strategy}' preparation failed for ${id}: ${e instanceof Error ? e.message : String(e)}`);
316
+ log(`[swarm] deps_strategy '${strategy}' preparation failed for ${id}: ${e instanceof Error ? e.message : String(e)}`);
314
317
  }
315
318
  } else {
316
319
  return {
@@ -429,7 +432,7 @@ async function cleanUntrackedFiles(worktreePath) {
429
432
  }).filter((p) => p.length > 0);
430
433
  const unsafePaths = candidates.filter((p) => !isSafeToClean(p));
431
434
  if (unsafePaths.length > 0) {
432
- console.warn(`[swarm:cleanUntrackedFiles] Skipping clean \u2014 untracked source files detected: ${unsafePaths.join(", ")}`);
435
+ advisoryWarn(`[swarm:cleanUntrackedFiles] Skipping clean \u2014 untracked source files detected: ${unsafePaths.join(", ")}`);
433
436
  return {
434
437
  cleaned: false,
435
438
  error: "untracked source files detected \u2014 skipping clean to prevent data loss"
@@ -17,6 +17,9 @@ import {
17
17
  import {
18
18
  isActiveStatus
19
19
  } from "./index-bfwt3abw.js";
20
+ import {
21
+ advisoryWarn
22
+ } from "./index-ye3fndsw.js";
20
23
  import {
21
24
  init_logger,
22
25
  log,
@@ -35,31 +38,6 @@ import * as path4 from "path";
35
38
  import { randomUUID } from "crypto";
36
39
  import * as fsp from "fs/promises";
37
40
  import * as path from "path";
38
-
39
- // src/services/warning-buffer.ts
40
- init_logger();
41
- var deferredWarnings = [];
42
- var MAX_DEFERRED_WARNINGS = 50;
43
- var deferredWarningsTruncated = false;
44
- function addDeferredWarning(warning) {
45
- if (deferredWarnings.length < MAX_DEFERRED_WARNINGS - 1) {
46
- deferredWarnings.push(warning);
47
- return;
48
- }
49
- if (!deferredWarningsTruncated) {
50
- deferredWarnings.push(`[opencode-swarm] ${MAX_DEFERRED_WARNINGS - 1} deferred warnings buffered; additional advisories were dropped (cap reached). Run with OPENCODE_SWARM_DEBUG=1 to see all advisories in the debug log.`);
51
- deferredWarningsTruncated = true;
52
- }
53
- }
54
- function advisoryWarn(message, data) {
55
- addDeferredWarning(message);
56
- log(message, data);
57
- }
58
- function getDeferredWarnings() {
59
- return [...deferredWarnings];
60
- }
61
-
62
- // src/config/bundled-skills.ts
63
41
  init_logger();
64
42
  var BUNDLED_PROJECT_SKILLS = [
65
43
  "brainstorm",
@@ -2152,4 +2130,4 @@ var _internals = {
2152
2130
  clearRetiredSkillLinks
2153
2131
  };
2154
2132
 
2155
- export { advisoryWarn, getDeferredWarnings, BUNDLED_PROJECT_SKILL_ROOT, bundledProjectSkillFileReference, syncBundledProjectSkillsIfMissingAsync, appendSkillChangelog, evaluateSkillChange, appendRejectedSkillEdit, sanitizeSlug, isValidSlug2 as isValidSlug, proposalPath, activePath, activeRepoRelativePath, proposalRepoRelativePath, generateEvalStub, writeEvalStub, DEFAULT_SKILL_MIN_CONFIDENCE, DEFAULT_SKILL_MIN_CONFIRMATIONS, STRONG_SKILL_OUTCOME_COUNT, HIGH_PRIORITY_SKILL_MIN_CONFIDENCE, selectCandidateEntries, isSkillMaturityEligible, clusterEntries, buildKnowledgeCluster, renderSkillMarkdown, generateSkills, parseDraftFrontmatter, activateProposal, findSkillsBySourceKnowledgeId, findStaleSkillsBySourceKnowledgeId, listSkills, autoApplyProposals, inspectSkill, retireSkill, clearDraftSkillLinks, clearRetiredSkillLinks, markSkillStale, clearSkillStale, retireOrMarkStale, regenerateSkill, _internals };
2133
+ export { BUNDLED_PROJECT_SKILL_ROOT, bundledProjectSkillFileReference, syncBundledProjectSkillsIfMissingAsync, appendSkillChangelog, evaluateSkillChange, appendRejectedSkillEdit, sanitizeSlug, isValidSlug2 as isValidSlug, proposalPath, activePath, activeRepoRelativePath, proposalRepoRelativePath, generateEvalStub, writeEvalStub, DEFAULT_SKILL_MIN_CONFIDENCE, DEFAULT_SKILL_MIN_CONFIRMATIONS, STRONG_SKILL_OUTCOME_COUNT, HIGH_PRIORITY_SKILL_MIN_CONFIDENCE, selectCandidateEntries, isSkillMaturityEligible, clusterEntries, buildKnowledgeCluster, renderSkillMarkdown, generateSkills, parseDraftFrontmatter, activateProposal, findSkillsBySourceKnowledgeId, findStaleSkillsBySourceKnowledgeId, listSkills, autoApplyProposals, inspectSkill, retireSkill, clearDraftSkillLinks, clearRetiredSkillLinks, markSkillStale, clearSkillStale, retireOrMarkStale, regenerateSkill, _internals };
@@ -1,4 +1,7 @@
1
1
  // @bun
2
+ import {
3
+ advisoryWarn
4
+ } from "./index-ye3fndsw.js";
2
5
  import {
3
6
  exports_external
4
7
  } from "./index-293f68mj.js";
@@ -676,7 +679,7 @@ function readEffectiveSpecSync(directory, opts) {
676
679
  const openspecProjection = buildOpenSpecProjectionSync(root);
677
680
  const openspecPresent = openspecProjection !== null;
678
681
  if (openspecPresent) {
679
- console.warn("[opencode-swarm] Multiple SDD sources detected (openspec and speckit). " + "Enforcement/projection is suppressed until you disambiguate. " + "Pass --source openspec or --source speckit to select a provider.");
682
+ advisoryWarn("[opencode-swarm] Multiple SDD sources detected (openspec and speckit). " + "Enforcement/projection is suppressed until you disambiguate. " + "Pass --source openspec or --source speckit to select a provider.");
680
683
  return null;
681
684
  }
682
685
  return buildSpeckitProjectionSync(root, { feature: opts?.feature });
@@ -0,0 +1,30 @@
1
+ // @bun
2
+ import {
3
+ init_logger,
4
+ log
5
+ } from "./index-zgwm4ryv.js";
6
+
7
+ // src/services/warning-buffer.ts
8
+ init_logger();
9
+ var deferredWarnings = [];
10
+ var MAX_DEFERRED_WARNINGS = 50;
11
+ var deferredWarningsTruncated = false;
12
+ function addDeferredWarning(warning) {
13
+ if (deferredWarnings.length < MAX_DEFERRED_WARNINGS - 1) {
14
+ deferredWarnings.push(warning);
15
+ return;
16
+ }
17
+ if (!deferredWarningsTruncated) {
18
+ deferredWarnings.push(`[opencode-swarm] ${MAX_DEFERRED_WARNINGS - 1} deferred warnings buffered; additional advisories were dropped (cap reached). Run with OPENCODE_SWARM_DEBUG=1 to see all advisories in the debug log.`);
19
+ deferredWarningsTruncated = true;
20
+ }
21
+ }
22
+ function advisoryWarn(message, data) {
23
+ addDeferredWarning(message);
24
+ log(message, data);
25
+ }
26
+ function getDeferredWarnings() {
27
+ return [...deferredWarnings];
28
+ }
29
+
30
+ export { advisoryWarn, getDeferredWarnings };
package/dist/cli/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-34tsqvqb.js";
10
+ } from "./index-mr3pnc4h.js";
11
11
  import"./index-nprawcc0.js";
12
12
  import"./index-g2wrs7jy.js";
13
13
  import"./index-c8s9a3zh.js";
@@ -15,11 +15,11 @@ import"./index-11q1t6g0.js";
15
15
  import {
16
16
  DEFAULT_AGENT_CONFIGS
17
17
  } from "./index-pdk1n8yh.js";
18
- import"./index-xdsd2hma.js";
19
- import"./index-scww5b77.js";
18
+ import"./index-p45sshb5.js";
19
+ import"./index-vwvkpg0d.js";
20
20
  import"./index-4905hd2m.js";
21
21
  import"./index-5bcrp3bc.js";
22
- import"./index-sb9x6xjj.js";
22
+ import"./index-r2ysfdet.js";
23
23
  import"./index-pjhfe7c3.js";
24
24
  import"./index-jbdgpqpj.js";
25
25
  import"./index-5hze8ztj.js";
@@ -30,7 +30,8 @@ import"./index-vxv732ex.js";
30
30
  import"./index-8fwhhayc.js";
31
31
  import"./index-q1exe2b3.js";
32
32
  import"./index-n6fa2hhk.js";
33
- import"./index-rdwfqhp7.js";
33
+ import"./index-q4kgsvdd.js";
34
+ import"./index-ye3fndsw.js";
34
35
  import"./index-kzj3fp7c.js";
35
36
  import"./index-5e4e2hvv.js";
36
37
  import"./index-p0arc26j.js";
@@ -33,12 +33,13 @@ import {
33
33
  sanitizeSlug,
34
34
  selectCandidateEntries,
35
35
  writeEvalStub
36
- } from "./index-sb9x6xjj.js";
36
+ } from "./index-r2ysfdet.js";
37
37
  import"./index-pjhfe7c3.js";
38
38
  import"./index-5hze8ztj.js";
39
39
  import"./index-qx5z58a7.js";
40
40
  import"./index-bfwt3abw.js";
41
41
  import"./index-wpgv6hht.js";
42
+ import"./index-ye3fndsw.js";
42
43
  import"./index-zgwm4ryv.js";
43
44
  import"./index-0pfqcjp6.js";
44
45
  import"./index-42cx6g2h.js";
@@ -52,7 +52,7 @@ export interface ClassifiedChange {
52
52
  * const diffs = await astDiff(oldCode, newCode);
53
53
  * const classified = classifyChanges(diffs);
54
54
  * for (const change of classified) {
55
- * console.log(`[${change.riskLevel}] ${change.category}: ${change.symbolName}`);
55
+ * printToConsole(`[${change.riskLevel}] ${change.category}: ${change.symbolName}`);
56
56
  * }
57
57
  * ```
58
58
  */
@@ -1,4 +1,3 @@
1
- /** Knowledge curator hook for opencode-swarm v6.17 two-tier knowledge system. */
2
1
  import { realpath } from 'node:fs/promises';
3
2
  import type { CuratorLLMDelegate } from './curator.js';
4
3
  import type { ActionableDirectiveFields, KnowledgeConfig, SwarmKnowledgeEntry } from './knowledge-types.js';
@@ -56,7 +55,7 @@ export interface EnrichmentQuotaOptions {
56
55
  * One retry on schema failure (with a RETRY message naming the missing
57
56
  * fields). Quota-gated per call via the dedicated knowledge-enrichment quota.
58
57
  * Returns null when
59
- * enrichment is unavailable (quota exhausted) or fails twice the caller
58
+ * enrichment is unavailable (quota exhausted) or fails twice — the caller
60
59
  * quarantines the entry. Never throws.
61
60
  */
62
61
  export declare function enrichLessonToV3(params: {
@@ -107,15 +106,15 @@ export declare function runAutoPromotion(directory: string, config: KnowledgeCon
107
106
  /**
108
107
  * G7 (#1716): Auto-demote swarm entries that have sustained a net-negative
109
108
  * outcome signal over consecutive phase EVALUATIONS (i.e. consecutive
110
- * `runAutoDemotion` invocations with distinct phase numbers a skipped phase
111
- * in between still counts, matching the issue's "3 consecutive" intent as
109
+ * `runAutoDemotion` invocations with distinct phase numbers — a skipped phase
110
+ * in between still counts, matching the issue's "≥3 consecutive" intent as
112
111
  * implemented against evaluation cadence, not wall-clock phase contiguity).
113
112
  *
114
113
  * Companion to {@link runAutoPromotion}. For each `promoted` entry:
115
114
  * 1. Dedupe by phase: if `entry.last_demotion_phase === phaseNumber`, this
116
115
  * entry has already been processed for this phase (handles the case where
117
116
  * `curateAndStoreSwarm` is invoked multiple times in the same logical
118
- * phase e.g. phase-complete + close). Skip the counter update.
117
+ * phase — e.g. phase-complete + close). Skip the counter update.
119
118
  * 2. Otherwise compute the outcome signal. If at/below
120
119
  * `config.promoted_demotion_signal_threshold`, increment
121
120
  * `recent_negative_phase_count`; else reset it to 0.