opencode-swarm 7.107.5 → 7.108.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.
Files changed (87) hide show
  1. package/.opencode/skills/codebase-review-swarm/SKILL.md +15 -0
  2. package/.opencode/skills/codebase-review-swarm/references/review-protocol-v8.2.md +15 -0
  3. package/.opencode/skills/engineering-conventions/SKILL.md +1 -1
  4. package/.opencode/skills/execute/SKILL.md +2 -0
  5. package/.opencode/skills/phase-wrap/SKILL.md +6 -1
  6. package/.opencode/skills/swarm-implement/SKILL.md +161 -0
  7. package/.opencode/skills/swarm-pr-feedback/SKILL.md +5 -2
  8. package/.opencode/skills/swarm-pr-review/SKILL.md +61 -0
  9. package/.opencode/skills/writing-tests/SKILL.md +7 -0
  10. package/dist/cli/{capability-probe-wsjzcp48.js → capability-probe-sh9bwh39.js} +2 -1
  11. package/dist/cli/{config-doctor-kdq3vae4.js → config-doctor-q354tb2w.js} +2 -2
  12. package/dist/cli/core-vev13ej2.js +34 -0
  13. package/dist/cli/{curator-drift-ed7p5mfy.js → curator-drift-fdfgj9qf.js} +3 -3
  14. package/dist/cli/{curator-k9swkynp.js → curator-js92gc8a.js} +24 -20
  15. package/dist/cli/curator-llm-factory-n70bxf40.js +40 -0
  16. package/dist/cli/{dispatch-anmxxhen.js → dispatch-zr1xja4t.js} +2 -2
  17. package/dist/cli/{evidence-summary-service-6zsgw7x7.js → evidence-summary-service-bjhr75v0.js} +9 -7
  18. package/dist/cli/{gate-evidence-pgr7d942.js → gate-evidence-v6ds8rcp.js} +5 -4
  19. package/dist/cli/guardrail-explain-sn2a4pb7.js +41 -0
  20. package/dist/cli/{guardrail-log-fjypsmek.js → guardrail-log-8mqqsssq.js} +4 -4
  21. package/dist/cli/hive-promoter-3hh8ph4a.js +48 -0
  22. package/dist/cli/{index-9b7qp18e.js → index-1cn967sa.js} +2 -2
  23. package/dist/cli/{index-vzq4h90s.js → index-1emhz3zb.js} +1380 -2013
  24. package/dist/cli/{index-n1sptn1w.js → index-2nt4mq9n.js} +1 -1
  25. package/dist/cli/{index-6h82c2h0.js → index-48mc4d48.js} +1056 -192
  26. package/dist/cli/{index-bq8kd9r9.js → index-5gnp8fyw.js} +3 -3
  27. package/dist/cli/index-5mkc2f9z.js +154 -0
  28. package/dist/cli/{index-0kxc7t16.js → index-6jng9c8t.js} +1 -1
  29. package/dist/cli/{index-jrka8jd4.js → index-7jyndvsy.js} +2 -2
  30. package/dist/cli/{index-b9v501fr.js → index-7xgqky26.js} +33 -5
  31. package/dist/cli/{index-4r5z8sgw.js → index-85bacexr.js} +2 -2
  32. package/dist/cli/{index-bpgqbwmf.js → index-9qxntjtx.js} +6 -6
  33. package/dist/cli/index-f1qyj61w.js +418 -0
  34. package/dist/cli/{index-wvxhynxq.js → index-fm7xz1ne.js} +1 -1
  35. package/dist/cli/{index-dfdg4ws5.js → index-fz1jgbvw.js} +6 -6
  36. package/dist/cli/{index-pchpahdf.js → index-h4c4rrwx.js} +20 -3
  37. package/dist/cli/{index-kxm3bdjh.js → index-mmny81g1.js} +6 -6
  38. package/dist/cli/{index-v4fcn4tr.js → index-q1exe2b3.js} +2 -198
  39. package/dist/cli/{index-57ymmh7h.js → index-r3j3458j.js} +4 -4
  40. package/dist/cli/{index-3naa2ajc.js → index-vvk2g744.js} +10 -156
  41. package/dist/cli/{index-zej8cy0j.js → index-vx76tcxe.js} +1 -1
  42. package/dist/cli/{index-xmarctsf.js → index-wg0665ft.js} +7 -7
  43. package/dist/cli/{index-4vsgp5a8.js → index-wj4jeavn.js} +1 -1
  44. package/dist/cli/index-wvrj16f0.js +206 -0
  45. package/dist/cli/{index-w1tvqh4x.js → index-x06d2qqm.js} +28 -24
  46. package/dist/cli/index-x2q0gnt8.js +254 -0
  47. package/dist/cli/{index-xg18az81.js → index-yw8qpf51.js} +1 -1
  48. package/dist/cli/index.js +24 -20
  49. package/dist/cli/{knowledge-escalator-3sgwrgy9.js → knowledge-escalator-6v7sjprx.js} +8 -7
  50. package/dist/cli/{knowledge-events-kfc6xmkw.js → knowledge-events-6n3x3he2.js} +6 -5
  51. package/dist/cli/{knowledge-store-kyacem71.js → knowledge-store-exkw6yb1.js} +6 -5
  52. package/dist/cli/{knowledge-validator-ez3ws8ef.js → knowledge-validator-exymfcb9.js} +7 -6
  53. package/dist/cli/{pending-delegations-vfnpm8zt.js → pending-delegations-yyz3fcfn.js} +5 -4
  54. package/dist/cli/{pr-subscriptions-bpvazmsw.js → pr-subscriptions-vv8byxe6.js} +6 -5
  55. package/dist/cli/{schema-x0ekqzvs.js → schema-x17zmd03.js} +1 -1
  56. package/dist/cli/scope-persistence-6m5nsp1r.js +20 -0
  57. package/dist/cli/{skill-generator-x83re96d.js → skill-generator-mx9br4ty.js} +9 -8
  58. package/dist/commands/_shared/url-security.d.ts +13 -3
  59. package/dist/commands/close.d.ts +11 -0
  60. package/dist/commands/lanes.d.ts +35 -0
  61. package/dist/commands/registry.d.ts +7 -0
  62. package/dist/config/bundled-skills.d.ts +1 -1
  63. package/dist/config/schema.d.ts +102 -0
  64. package/dist/config/skill-mirrors.d.ts +1 -1
  65. package/dist/git/branch.d.ts +53 -7
  66. package/dist/git/index.d.ts +5 -1
  67. package/dist/git/pr.d.ts +35 -2
  68. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +118 -2
  69. package/dist/hooks/delegation-gate/worktree-merge-status.d.ts +17 -0
  70. package/dist/hooks/init-orphan-recovery-advisory.d.ts +58 -0
  71. package/dist/hooks/init-orphan-recovery.d.ts +65 -0
  72. package/dist/index.js +427 -416
  73. package/dist/sandbox/executor.d.ts +11 -1
  74. package/dist/sandbox/linux/bubblewrap-executor.d.ts +3 -1
  75. package/dist/sandbox/macos/sandbox-exec-executor.d.ts +3 -1
  76. package/dist/sandbox/win32/native-sandbox-executor.d.ts +1 -1
  77. package/dist/sandbox/win32/restricted-environment-executor.d.ts +4 -1
  78. package/dist/turbo/lean/runner.d.ts +11 -20
  79. package/dist/turbo/lean/worktree.d.ts +9 -3
  80. package/dist/utils/bun-compat.d.ts +30 -0
  81. package/dist/worktree/core.d.ts +55 -0
  82. package/dist/worktree/merge.d.ts +5 -1
  83. package/dist/worktree/types.d.ts +38 -0
  84. package/package.json +2 -1
  85. package/dist/cli/curator-llm-factory-ed67kywr.js +0 -36
  86. package/dist/cli/guardrail-explain-vd6da30t.js +0 -37
  87. package/dist/cli/hive-promoter-gh0nva5c.js +0 -44
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Init Orphan Recovery Advisory Hook (FR-103 SC-108)
3
+ *
4
+ * At plugin init, `cleanupOrphanedBranches` is called to reclaim orphaned worktrees
5
+ * and branches. Any warnings or errors (state-unreadable conditions) are written
6
+ * to `<directory>/.swarm/advisories/init-orphan-recovery.json`.
7
+ *
8
+ * This hook runs in the `messagesTransform` chain (before `guardrailsHooks.messagesTransform`)
9
+ * and surfaces those advisories to the architect on their NEXT TURN.
10
+ *
11
+ * Advisory file format:
12
+ * ```json
13
+ * {
14
+ * "initTimestamp": "<ISO timestamp>",
15
+ * "warnings": ["warning message 1", "warning message 2"],
16
+ * "errors": [{ "branch": "swarm-lane/sess/lane", "error": "detail" }],
17
+ * "reclaimed": { "removedBranches": [], "prunedWorktrees": true }
18
+ * }
19
+ * ```
20
+ *
21
+ * The file is deleted after consumption (best-effort) so repeated turns don't re-surface.
22
+ */
23
+ export interface InitOrphanAdvisory {
24
+ initTimestamp: string;
25
+ warnings: string[];
26
+ errors: Array<{
27
+ branch: string;
28
+ error: string;
29
+ }>;
30
+ reclaimed: {
31
+ removedBranches: string[];
32
+ removedWorktrees: string[];
33
+ prunedWorktrees: boolean;
34
+ };
35
+ }
36
+ /**
37
+ * Creates a messagesTransform hook that surfaces init orphan recovery advisories
38
+ * on the architect's first turn after plugin init.
39
+ *
40
+ * @param directory - Project root directory (for .swarm/advisories path)
41
+ * @returns A hook object with a messagesTransform handler
42
+ */
43
+ export declare function createInitOrphanRecoveryAdvisoryHook(directory: string): {
44
+ messagesTransform: (input: Record<string, never>, output: {
45
+ messages?: Array<{
46
+ info: {
47
+ role: string;
48
+ agent?: string;
49
+ sessionID?: string;
50
+ };
51
+ parts: Array<{
52
+ type?: string;
53
+ text?: string;
54
+ [key: string]: unknown;
55
+ }>;
56
+ }>;
57
+ }) => Promise<void>;
58
+ };
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Init Orphan Recovery Helper (FR-103 / SC-107..SC-110)
3
+ *
4
+ * Bounded plugin-init wrapper around `cleanupOrphanedBranches` that:
5
+ * - Enumerates orphaned worktree directories under `.swarm-worktrees/<sessionId>/` and removes them
6
+ * - Calls cleanupOrphanedBranches(ctx.directory, []) at plugin init (no sessions active → all swarm-lane branches are orphans)
7
+ * - Writes results to `<directory>/.swarm/advisories/init-orphan-recovery.json`
8
+ * - Is wrapped in `withTimeout` so it never blocks plugin init
9
+ * - Runs via `queueMicrotask` off the `server()` resolution path (precedent: repoGraphHook.init)
10
+ *
11
+ * This module intentionally lives in `src/hooks/` so that `src/index.ts` can import
12
+ * it without matching the forbidden `worktree/` or `merge-back/` patterns.
13
+ *
14
+ * The companion hook `createInitOrphanRecoveryAdvisoryHook` (src/hooks/init-orphan-recovery-advisory.ts)
15
+ * reads the advisory file at session-start and pushes messages to pendingAdvisoryMessages.
16
+ */
17
+ import * as fs from 'node:fs';
18
+ import { isLocked, listActiveLocks, tryAcquireLock } from '../parallel/file-locks';
19
+ import { removeWorktree } from '../worktree/core';
20
+ /**
21
+ * Lock file path for the init orphan recovery advisory lock.
22
+ * advisory-only — signals that another process may be actively using the repo.
23
+ */
24
+ export declare const ORPHAN_RECOVERY_LOCK_FILE = ".swarm/locks/init-orphan-recovery.lock";
25
+ /**
26
+ * DI seam for orphaned worktree removal operations and cross-process lock checking.
27
+ * Exposed so tests can intercept removeWorktree, rmSync, and lock operations
28
+ * without mock.module leakage.
29
+ */
30
+ export declare const _internals: {
31
+ rmSync: typeof fs.rmSync;
32
+ removeWorktree: typeof removeWorktree;
33
+ isLocked: typeof isLocked;
34
+ listActiveLocks: typeof listActiveLocks;
35
+ tryAcquireLock: typeof tryAcquireLock;
36
+ };
37
+ export interface InitOrphanRecoveryResult {
38
+ attempted: boolean;
39
+ /** Set to true when cross-process lock is held by another process — advisory-only cleanup */
40
+ crossProcessLockHeld: boolean;
41
+ warnings: string[];
42
+ orphanedBranches: string[];
43
+ removedWorktrees: string[];
44
+ prunedWorktrees: boolean;
45
+ diagnostic?: {
46
+ file: string;
47
+ reason: string;
48
+ };
49
+ }
50
+ /**
51
+ * Runs bounded orphan cleanup at plugin init time.
52
+ *
53
+ * Active sessions from swarmState are passed to cleanupOrphanedBranches so their
54
+ * branches are skipped and not reclaimed during init recovery.
55
+ *
56
+ * Cross-process safety: before doing any destructive cleanup, checks whether any
57
+ * other opencode process holds the advisory lock at `.swarm/locks/init-orphan-recovery.lock`.
58
+ * If a lock is held (another process is active), skips destructive cleanup entirely
59
+ * and reports detected orphans in result.warnings instead — preventing a second
60
+ * process from deleting the first process's active worktrees/branches.
61
+ *
62
+ * @param directory - Project root directory
63
+ * @returns Result object describing what was attempted and any warnings/diagnostics
64
+ */
65
+ export declare function runInitOrphanRecovery(directory: string): Promise<InitOrphanRecoveryResult>;