opencode-swarm 7.144.8 → 7.145.1

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.
Files changed (87) hide show
  1. package/dist/background/workspace-snapshot.d.ts +29 -0
  2. package/dist/cli/{config-doctor-zbqfp0v6.js → config-doctor-96jmxr7s.js} +3 -3
  3. package/dist/cli/{core-pz9gwatq.js → core-w78pc1hh.js} +3 -3
  4. package/dist/cli/{curation-policy-a511r0qz.js → curation-policy-smyc2mrm.js} +7 -7
  5. package/dist/cli/{curator-sk0dyvke.js → curator-59hzdxrv.js} +33 -32
  6. package/dist/cli/{curator-drift-ckjm272w.js → curator-drift-r50x1rac.js} +4 -4
  7. package/dist/cli/{curator-llm-factory-3nq3p02z.js → curator-llm-factory-g794pv51.js} +33 -32
  8. package/dist/cli/dispatch-ndxbsk98.js +1 -1
  9. package/dist/cli/{evidence-summary-service-abwrjqd0.js → evidence-summary-service-41m0cna6.js} +15 -14
  10. package/dist/cli/{gate-evidence-aa7vvtcd.js → gate-evidence-7aywx7qa.js} +10 -9
  11. package/dist/cli/guardrail-explain-j88dhm6w.js +65 -0
  12. package/dist/cli/{guardrail-log-jw5mzs0d.js → guardrail-log-xcb3ke8s.js} +5 -5
  13. package/dist/cli/{hive-promoter-m20j63yg.js → hive-promoter-nnnx5692.js} +33 -32
  14. package/dist/cli/{index-7qb0hn8n.js → index-17e73wac.js} +1 -1
  15. package/dist/cli/{index-r2rkwvzq.js → index-19v4tccw.js} +2 -2
  16. package/dist/cli/{index-vdha477y.js → index-2qrd8mfa.js} +1 -1
  17. package/dist/cli/{index-6z5jtf7d.js → index-34tawmyx.js} +4 -4
  18. package/dist/cli/{index-jdxnzbah.js → index-41t3hgaa.js} +10 -10
  19. package/dist/cli/index-4evasm2b.js +514 -0
  20. package/dist/cli/{index-gfvkttvd.js → index-7axx11dt.js} +1 -1
  21. package/dist/cli/{index-8dbzaf0m.js → index-8ef23wex.js} +4 -4
  22. package/dist/cli/{index-k7fk9fjs.js → index-90w06fqr.js} +107 -29
  23. package/dist/cli/{index-t2ntgzts.js → index-b7ntt9cw.js} +3 -3
  24. package/dist/cli/{index-c2rpht77.js → index-bst6epnr.js} +2703 -2054
  25. package/dist/cli/{index-tffg4mwr.js → index-cqfp05jb.js} +3 -3
  26. package/dist/cli/{index-1jsmmx7y.js → index-dppzthm9.js} +92 -35
  27. package/dist/cli/{index-h1p08s3n.js → index-dzan8czb.js} +1 -1
  28. package/dist/cli/{index-cwtpqm5f.js → index-e1pxav9g.js} +1 -1
  29. package/dist/cli/{index-d1dbpxxk.js → index-evpgszmp.js} +2 -2
  30. package/dist/cli/{index-cx51wy0c.js → index-ff66fbjt.js} +10 -10
  31. package/dist/cli/{index-wknz5c8q.js → index-fwnhh6s7.js} +2 -2
  32. package/dist/cli/{index-hkdgkkhb.js → index-gey2257h.js} +2 -2
  33. package/dist/cli/{index-f9vvg5xb.js → index-gf03198s.js} +67 -2
  34. package/dist/cli/{index-z4fssj97.js → index-kxzgnz2h.js} +20 -20
  35. package/dist/cli/{index-9s8drsf9.js → index-mpf01swm.js} +4 -21
  36. package/dist/cli/{index-sxe5nyq4.js → index-mrkgxfeh.js} +13 -15
  37. package/dist/cli/{index-0v1f2sdb.js → index-neh8azwc.js} +2 -2
  38. package/dist/cli/{index-3k3nbs52.js → index-qpke2x5h.js} +9 -9
  39. package/dist/cli/{index-n4hwcsbd.js → index-rtkttser.js} +5 -5
  40. package/dist/cli/{index-xx8tm58n.js → index-sfemjcb8.js} +5 -5
  41. package/dist/cli/{index-bv44950t.js → index-tm0bezd9.js} +1 -1
  42. package/dist/cli/{index-r14qx363.js → index-tw8ck794.js} +1 -1
  43. package/dist/cli/{index-t72g4a7y.js → index-xz4x17z0.js} +35 -34
  44. package/dist/cli/{index-nmy6rss1.js → index-ymyke19q.js} +1 -1
  45. package/dist/cli/{index-f36ybbsv.js → index-z9yhhk6q.js} +93 -5
  46. package/dist/cli/{index-xp5g9eps.js → index-zpp507z0.js} +15 -1
  47. package/dist/cli/index.js +33 -32
  48. package/dist/cli/{knowledge-escalator-mg8qb7tm.js → knowledge-escalator-s6acdpwj.js} +15 -14
  49. package/dist/cli/{knowledge-events-3zxf8xpb.js → knowledge-events-jprkz49t.js} +13 -12
  50. package/dist/cli/{knowledge-link-4cg4776a.js → knowledge-link-zvtmj756.js} +6 -6
  51. package/dist/cli/{knowledge-store-awnm8s6c.js → knowledge-store-mc4awds4.js} +7 -7
  52. package/dist/cli/{knowledge-validator-3ke5scx3.js → knowledge-validator-pe4ncrvj.js} +9 -9
  53. package/dist/cli/model-preflight-77dwxfv5.js +170 -0
  54. package/dist/cli/{pending-delegations-9h1jmtw1.js → pending-delegations-epzht3d7.js} +6 -6
  55. package/dist/cli/{pr-subscriptions-8pg34pev.js → pr-subscriptions-2ahy8g87.js} +6 -6
  56. package/dist/cli/{runner-cqecp1na.js → runner-ra9pjhp2.js} +8 -7
  57. package/dist/cli/{scan-cursor-00rbxkb4.js → scan-cursor-hdzhqwzj.js} +8 -8
  58. package/dist/cli/{schema-5nmkp1pc.js → schema-pg85z06v.js} +1 -1
  59. package/dist/cli/{scope-persistence-6m79atw9.js → scope-persistence-v8we8ja7.js} +11 -7
  60. package/dist/cli/{skill-generator-gv70s796.js → skill-generator-ctskfct2.js} +17 -16
  61. package/dist/cli/{telemetry-cybx6cfz.js → telemetry-c21dgffc.js} +1 -1
  62. package/dist/cli/{workspace-snapshot-d89zm6wm.js → workspace-snapshot-kznz5e13.js} +3 -1
  63. package/dist/cli/{worktree-collision-ownership-vy0kxa98.js → worktree-collision-ownership-f7se4wbf.js} +10 -10
  64. package/dist/cli/{worktree-isolation-bne0p54w.js → worktree-isolation-j4qb7mgb.js} +35 -32
  65. package/dist/cli/{worktree-provisioning-owner-zzkjycp1.js → worktree-provisioning-owner-72cyddz5.js} +3 -3
  66. package/dist/commands/close.d.ts +8 -1
  67. package/dist/config/evidence-schema.d.ts +6 -6
  68. package/dist/config/plan-schema.d.ts +2 -2
  69. package/dist/config/schema.d.ts +7 -7
  70. package/dist/evidence/task-file.d.ts +16 -16
  71. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +4 -0
  72. package/dist/index.js +603 -559
  73. package/dist/memory/schema.d.ts +3 -3
  74. package/dist/observability/catalog.d.ts +5 -4
  75. package/dist/observability/envelope.d.ts +2 -2
  76. package/dist/scope/scope-binding.d.ts +16 -0
  77. package/dist/services/model-preflight.d.ts +151 -0
  78. package/dist/services/session-reflection.d.ts +24 -0
  79. package/dist/services/swarm-residue.d.ts +151 -0
  80. package/dist/telemetry.d.ts +32 -2
  81. package/dist/tools/knowledge-receipt.d.ts +1 -1
  82. package/dist/tools/placeholder-scan.d.ts +64 -0
  83. package/dist/tools/sast-scan.d.ts +6 -0
  84. package/dist/utils/atomic-write.d.ts +185 -0
  85. package/package.json +1 -1
  86. package/dist/cli/guardrail-explain-hvtyr2fz.js +0 -64
  87. package/dist/cli/{index-fv0s19g9.js → index-w8pgjr75.js} +3 -3
@@ -2,22 +2,26 @@
2
2
  import {
3
3
  computePlanStructureHash,
4
4
  derivePlanId
5
- } from "./index-tffg4mwr.js";
5
+ } from "./index-cqfp05jb.js";
6
6
  import {
7
7
  unsafePathTextReason
8
8
  } from "./index-556ja8an.js";
9
9
  import {
10
10
  PlanSchema
11
- } from "./index-7qb0hn8n.js";
11
+ } from "./index-17e73wac.js";
12
+ import {
13
+ validateSwarmPath
14
+ } from "./index-w8pgjr75.js";
15
+ import {
16
+ atomicWriteSwarmFile,
17
+ atomicWriteSwarmFileSync
18
+ } from "./index-4evasm2b.js";
12
19
  import {
13
20
  assertProjectRoot
14
- } from "./index-f9vvg5xb.js";
21
+ } from "./index-gf03198s.js";
15
22
  import {
16
23
  require_proper_lockfile
17
24
  } from "./index-7g4c7s5r.js";
18
- import {
19
- bunWrite
20
- } from "./index-zj6t9zgx.js";
21
25
  import {
22
26
  __toESM
23
27
  } from "./index-a76rekgs.js";
@@ -194,6 +198,16 @@ function hasScopeBindingDenyOverlay(binding) {
194
198
  const tombstone = scopeBindingTombstones.get(binding.generationId);
195
199
  return Boolean(tombstone && tombstone.bindingId === binding.bindingId && tombstone.revision >= binding.revision && tombstone.lifecycleState !== "live");
196
200
  }
201
+ function hasDeliberateScopeBindingDenyOverlay(binding) {
202
+ const tombstone = scopeBindingTombstones.get(binding.generationId);
203
+ return Boolean(tombstone && tombstone.bindingId === binding.bindingId && tombstone.revision >= binding.revision && tombstone.lifecycleState !== "live" && tombstone.lifecycleState !== "expired");
204
+ }
205
+ function clearSweepTombstoneForRevival(binding) {
206
+ const tombstone = scopeBindingTombstones.get(binding.generationId);
207
+ if (tombstone && tombstone.bindingId === binding.bindingId && tombstone.lifecycleState === "expired" && tombstone.revision <= binding.revision) {
208
+ scopeBindingTombstones.delete(binding.generationId);
209
+ }
210
+ }
197
211
  function installFailedRevocationOverlay(binding, reason) {
198
212
  const current = pendingScopeBindings.get(binding.generationId);
199
213
  if (!current || current.bindingId !== binding.bindingId || current.revision !== binding.revision)
@@ -562,11 +576,7 @@ function migrateLegacyBindingsSync(directory, scanCapacity = bindingFileScanCapa
562
576
  if (valid && binding) {
563
577
  const exactPath = getBindingFilePath(directory, binding);
564
578
  if (!fs2.existsSync(exactPath)) {
565
- const temp = `${exactPath}.migration-${process.pid}`;
566
- fs2.writeFileSync(temp, JSON.stringify(binding, null, 2), {
567
- flag: "wx"
568
- });
569
- fs2.renameSync(temp, exactPath);
579
+ atomicWriteSwarmFileSync(exactPath, JSON.stringify(binding, null, 2));
570
580
  } else {
571
581
  const existingRaw = readBoundedFile(exactPath);
572
582
  const existing = existingRaw ? validateScopeBindingPayload(directory, JSON.parse(existingRaw)) : null;
@@ -1431,6 +1441,82 @@ function readCurrentPlan(directory) {
1431
1441
  return null;
1432
1442
  }
1433
1443
  }
1444
+ var SCOPE_BINDING_AUTO_REVIVE_WINDOW_MS = 24 * 60 * 60 * 1000;
1445
+ function appendScopeBindingRevivalEvent(workspace, revived) {
1446
+ try {
1447
+ const eventsPath = validateSwarmPath(workspace, "events.jsonl");
1448
+ fs2.mkdirSync(path2.dirname(eventsPath), { recursive: true });
1449
+ fs2.appendFileSync(eventsPath, `${JSON.stringify({
1450
+ type: "scope_binding_auto_recovered",
1451
+ timestamp: new Date().toISOString(),
1452
+ taskId: revived.taskId,
1453
+ sessionId: revived.ownerSessionId,
1454
+ generationId: revived.generationId,
1455
+ revision: revived.revision,
1456
+ expiresAt: new Date(revived.expiresAt).toISOString()
1457
+ })}
1458
+ `, "utf-8");
1459
+ } catch {}
1460
+ }
1461
+ function attemptIdleScopeBindingRevival(directory, resolution) {
1462
+ if (resolution.status !== "expired")
1463
+ return null;
1464
+ if (resolution.totalCandidates !== 1 || resolution.candidates.length !== 1)
1465
+ return null;
1466
+ const candidate = resolution.candidates[0];
1467
+ if (!candidate)
1468
+ return null;
1469
+ const now = Date.now();
1470
+ if (candidate.lifecycleState !== "live")
1471
+ return null;
1472
+ if (candidate.expiresAt > now)
1473
+ return null;
1474
+ if (now - candidate.expiresAt > SCOPE_BINDING_AUTO_REVIVE_WINDOW_MS)
1475
+ return null;
1476
+ if (hasDeliberateScopeBindingDenyOverlay(candidate))
1477
+ return null;
1478
+ let release;
1479
+ try {
1480
+ const resolvedWorkspace = fs2.realpathSync(directory);
1481
+ assertProjectRoot(resolvedWorkspace);
1482
+ const scopePath = getBindingFilePath(resolvedWorkspace, candidate);
1483
+ if (!isScopesDirSafe(resolvedWorkspace, getScopesDir(resolvedWorkspace)))
1484
+ return null;
1485
+ const lockPath = getGenerationLockPath(scopePath);
1486
+ if (!ensureLockTargetSync(lockPath))
1487
+ return null;
1488
+ release = lockSyncWithBoundedRetry(lockPath);
1489
+ const raw = readBoundedFile(scopePath);
1490
+ if (!raw)
1491
+ return null;
1492
+ const current = validateScopeBindingPayload(resolvedWorkspace, JSON.parse(raw));
1493
+ if (!current || current.bindingId !== candidate.bindingId || current.generationId !== candidate.generationId || current.revision !== candidate.revision || current.lifecycleState !== "live" || current.expiresAt > Date.now() || Date.now() - current.expiresAt > SCOPE_BINDING_AUTO_REVIVE_WINDOW_MS)
1494
+ return null;
1495
+ const revivedAt = Date.now();
1496
+ const revived = {
1497
+ ...current,
1498
+ revision: current.revision + 1,
1499
+ updatedAt: revivedAt,
1500
+ leaseStartedAt: revivedAt,
1501
+ expiresAt: revivedAt + DEFAULT_SCOPE_BINDING_TTL_MS
1502
+ };
1503
+ atomicWriteSync(scopePath, JSON.stringify(revived, null, 2));
1504
+ const verifiedRaw = readBoundedFile(scopePath);
1505
+ const verified = verifiedRaw ? validateScopeBindingPayload(resolvedWorkspace, JSON.parse(verifiedRaw)) : null;
1506
+ if (!verified || verified.revision !== revived.revision || verified.lifecycleState !== "live" || verified.expiresAt !== revived.expiresAt)
1507
+ return null;
1508
+ clearSweepTombstoneForRevival(revived);
1509
+ appendScopeBindingRevivalEvent(resolvedWorkspace, revived);
1510
+ return revived;
1511
+ } catch {
1512
+ return null;
1513
+ } finally {
1514
+ if (release)
1515
+ try {
1516
+ release();
1517
+ } catch {}
1518
+ }
1519
+ }
1434
1520
  function resolveAuthorizedScopeBindingForPlan(input) {
1435
1521
  const resolution = resolveAuthorizedScopeBindingForPlanDetailed(input);
1436
1522
  return resolution.status === "found" ? resolution.binding : null;
@@ -1454,6 +1540,14 @@ function resolveAuthorizedScopeBindingForPlanDetailed(input) {
1454
1540
  const admission = registerScopeBinding(durable.binding);
1455
1541
  return admission.ok ? durable : { status: "overloaded" };
1456
1542
  }
1543
+ if (durable.status === "expired") {
1544
+ const revived = attemptIdleScopeBindingRevival(input.directory, durable);
1545
+ if (revived) {
1546
+ const admission = registerScopeBinding(revived);
1547
+ if (admission.ok)
1548
+ return { status: "found", binding: revived };
1549
+ }
1550
+ }
1457
1551
  if (durable.status !== "not_declared")
1458
1552
  return durable;
1459
1553
  return { status: "not_declared" };
@@ -1596,26 +1690,10 @@ function resolveAuthorizedPrFeedbackScopeBindingFromDisk(input) {
1596
1690
  return admission.ok ? matches[0] : null;
1597
1691
  }
1598
1692
  async function atomicWrite(targetPath, content) {
1599
- const tempPath = `${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
1600
- try {
1601
- await bunWrite(tempPath, content);
1602
- fs2.renameSync(tempPath, targetPath);
1603
- } finally {
1604
- try {
1605
- fs2.unlinkSync(tempPath);
1606
- } catch {}
1607
- }
1693
+ await atomicWriteSwarmFile(targetPath, content);
1608
1694
  }
1609
1695
  function atomicWriteSync(targetPath, content) {
1610
- const tempPath = `${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
1611
- try {
1612
- fs2.writeFileSync(tempPath, content, { flag: "wx" });
1613
- fs2.renameSync(tempPath, targetPath);
1614
- } finally {
1615
- try {
1616
- fs2.unlinkSync(tempPath);
1617
- } catch {}
1618
- }
1696
+ atomicWriteSwarmFileSync(targetPath, content);
1619
1697
  }
1620
1698
  var _scopePersistenceInternals = {
1621
1699
  get liveBindingCapacity() {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  _internals,
4
4
  resolveWorktreeIsolationConfig
5
- } from "./index-0v1f2sdb.js";
5
+ } from "./index-neh8azwc.js";
6
6
  import {
7
7
  ApprovalEvidenceSchema,
8
8
  BaseEvidenceSchema,
@@ -42,7 +42,7 @@ import {
42
42
  loadPluginConfig,
43
43
  loadPluginConfigWithMeta,
44
44
  loadPluginConfigWithMetaAsync
45
- } from "./index-7qb0hn8n.js";
45
+ } from "./index-17e73wac.js";
46
46
  import {
47
47
  AUTO_REVIEW_V8_BURN_IN_DECISION,
48
48
  AgentOverrideConfigSchema,
@@ -64,7 +64,7 @@ import {
64
64
  TurboConfigSchema,
65
65
  WorktreeIsolationConfigSchema,
66
66
  resolveAutoReviewConfig
67
- } from "./index-gfvkttvd.js";
67
+ } from "./index-7axx11dt.js";
68
68
  import {
69
69
  ALL_AGENT_NAMES,
70
70
  ALL_SUBAGENT_NAMES,