opencode-swarm 7.110.2 → 7.112.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 (71) hide show
  1. package/.opencode/skills/ci-failure-batching/SKILL.md +6 -9
  2. package/.opencode/skills/gate-attribution/SKILL.md +24 -7
  3. package/.opencode/skills/merge-queue-readiness/SKILL.md +21 -7
  4. package/.opencode/skills/skill-edit-validation/SKILL.md +10 -3
  5. package/.opencode/skills/swarm-pr-feedback/SKILL.md +24 -0
  6. package/.opencode/skills/worktree-retry-cleanup/SKILL.md +7 -11
  7. package/dist/background/pr-event-subscribers.d.ts +28 -0
  8. package/dist/background/pr-monitor-worker.d.ts +8 -1
  9. package/dist/background/pr-subscriptions.d.ts +6 -0
  10. package/dist/cli/{config-doctor-q5e9yzn6.js → config-doctor-mmw4c50z.js} +2 -2
  11. package/dist/cli/{core-gjac7vd9.js → core-f4cbabe7.js} +2 -2
  12. package/dist/cli/{curator-drift-169wgaxn.js → curator-drift-jvs1v6em.js} +2 -2
  13. package/dist/cli/{curator-qpgdv0fp.js → curator-j7ty8k6t.js} +19 -19
  14. package/dist/cli/curator-llm-factory-8rnk2083.js +40 -0
  15. package/dist/cli/{dispatch-zr1xja4t.js → dispatch-wst7bypk.js} +2 -2
  16. package/dist/cli/{evidence-summary-service-8tasw2tt.js → evidence-summary-service-j6fnsfeq.js} +5 -5
  17. package/dist/cli/{gate-evidence-v6ds8rcp.js → gate-evidence-mk0ss1re.js} +3 -3
  18. package/dist/cli/guardrail-explain-2j0gw8f0.js +41 -0
  19. package/dist/cli/{guardrail-log-973nan7m.js → guardrail-log-xjgr00eq.js} +4 -4
  20. package/dist/cli/{hive-promoter-rs5dr4pf.js → hive-promoter-y179n7wx.js} +19 -19
  21. package/dist/cli/{index-1cn967sa.js → index-0dab9w37.js} +1 -1
  22. package/dist/cli/{index-r3j3458j.js → index-1rga1vvb.js} +1 -1
  23. package/dist/cli/{index-mvg66d9n.js → index-2aqs6daa.js} +3 -3
  24. package/dist/cli/{index-yw8qpf51.js → index-9fxs0rm1.js} +1 -1
  25. package/dist/cli/{index-cmjq1kg7.js → index-b83y9a7r.js} +3 -3
  26. package/dist/cli/{index-rm8b4959.js → index-c3h3d8kh.js} +23 -21
  27. package/dist/cli/{index-0g5xsrp4.js → index-cq2hgvd2.js} +13 -5
  28. package/dist/cli/{index-yhmt3dw3.js → index-cye4g7zj.js} +3 -3
  29. package/dist/cli/{index-j2v3w1ds.js → index-d0w40jm3.js} +4 -4
  30. package/dist/cli/{index-40h0yp9e.js → index-db1fh1fv.js} +1 -1
  31. package/dist/cli/{index-dm35e55e.js → index-fhmw7evd.js} +36 -15
  32. package/dist/cli/{index-vzzt3ygr.js → index-g55nzpwn.js} +1 -1
  33. package/dist/cli/{index-c483hnn4.js → index-hg0pamsa.js} +3 -3
  34. package/dist/cli/{index-smk3st51.js → index-j5c98bd9.js} +1799 -1249
  35. package/dist/cli/{index-53z1afgh.js → index-npxmfj48.js} +1 -1
  36. package/dist/cli/{index-6jng9c8t.js → index-pm992z24.js} +1 -1
  37. package/dist/cli/{index-85bacexr.js → index-q1jaeynn.js} +4 -1
  38. package/dist/cli/{index-v8pk35h7.js → index-t7efm8vz.js} +4 -4
  39. package/dist/cli/{index-5rfxzgmt.js → index-w84stmkx.js} +1 -1
  40. package/dist/cli/{index-4k3gh2nz.js → index-x4bghdyv.js} +2 -2
  41. package/dist/cli/{index-xddysq89.js → index-xehrmy76.js} +1 -1
  42. package/dist/cli/index.js +19 -19
  43. package/dist/cli/{knowledge-escalator-0dkkenp2.js → knowledge-escalator-t1e2211j.js} +6 -6
  44. package/dist/cli/{knowledge-events-bckbj6ah.js → knowledge-events-2h3gvtfa.js} +4 -4
  45. package/dist/cli/{knowledge-store-dvjbdn00.js → knowledge-store-gpta9gzh.js} +4 -4
  46. package/dist/cli/{knowledge-validator-bqr936sg.js → knowledge-validator-03f0hm0p.js} +5 -5
  47. package/dist/cli/{pending-delegations-yyz3fcfn.js → pending-delegations-gc3a2hfx.js} +2 -2
  48. package/dist/cli/{pr-subscriptions-vv8byxe6.js → pr-subscriptions-p8g2rzxd.js} +3 -3
  49. package/dist/cli/{schema-s48je8zt.js → schema-2p15yrvn.js} +1 -1
  50. package/dist/cli/{scope-persistence-tgp00wtd.js → scope-persistence-5ccgtebg.js} +2 -2
  51. package/dist/cli/{skill-generator-5rsjmmfq.js → skill-generator-2tsqqaa2.js} +7 -7
  52. package/dist/commands/ci-simulate.d.ts +40 -0
  53. package/dist/commands/index.d.ts +1 -0
  54. package/dist/commands/pr-monitor-status.d.ts +24 -0
  55. package/dist/commands/registry.d.ts +8 -0
  56. package/dist/config/bundled-skills.d.ts +1 -1
  57. package/dist/config/schema.d.ts +5 -0
  58. package/dist/full-auto/oversight.d.ts +4 -0
  59. package/dist/full-auto/state.d.ts +12 -0
  60. package/dist/git/pr.d.ts +23 -0
  61. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +110 -0
  62. package/dist/hooks/delegation-gate.d.ts +17 -0
  63. package/dist/hooks/full-auto-intercept.d.ts +1 -1
  64. package/dist/index.js +399 -364
  65. package/dist/tools/placeholder-scan.d.ts +15 -0
  66. package/dist/utils/bun-compat.d.ts +6 -0
  67. package/dist/worktree/merge.d.ts +12 -0
  68. package/package.json +9 -5
  69. package/dist/cli/curator-llm-factory-3x89ddtd.js +0 -40
  70. package/dist/cli/guardrail-explain-jdwp6h9c.js +0 -41
  71. /package/dist/cli/{index-7xgqky26.js → index-h91bv3hy.js} +0 -0
@@ -9,6 +9,7 @@
9
9
  * The _internals seam allows test injection of worktree operations.
10
10
  */
11
11
  import type { PluginConfig, WorktreeIsolationConfig } from '../../config';
12
+ import { bunSpawn } from '../../utils/bun-compat';
12
13
  import type { WorktreeHandle } from '../../worktree';
13
14
  import { attemptMergeBackFromDirty, cleanupOrphanedBranches, postMergeCleanup, provisionWorktree, removeWorktree, startupOrphanRecovery } from '../../worktree';
14
15
  /**
@@ -107,6 +108,38 @@ declare function rememberStandardWorktreeSerializationSession(sessionID: string)
107
108
  export declare function sanitizeWorktreeTaskId(raw: string): string;
108
109
  import { resolveWorktreeIsolationConfig } from '../../config/worktree-isolation-config';
109
110
  export { resolveWorktreeIsolationConfig };
111
+ /**
112
+ * FR-001b SC-004: Runs `git worktree list --porcelain` and checks whether
113
+ * ANY registered worktree has a lane branch for the given taskId (regardless
114
+ * of which session owns it).
115
+ *
116
+ * The detection pattern matches both current `swarm/lane/<sessionId>/<taskId>`
117
+ * and legacy `swarm-lane/<sessionId>/<taskId>` branch formats.
118
+ *
119
+ * Returns collision info if any lane for this taskId is found registered in
120
+ * an active worktree. Does NOT check whether the worktree path is valid on
121
+ * disk — only whether the branch is checked out somewhere.
122
+ *
123
+ * @param taskId - Task ID to detect collisions for.
124
+ * @param directory - Project root (git working tree).
125
+ * @param sessionId - Current session ID (used only to populate ownerSessionId
126
+ * in the collision result; NOT used for collision detection).
127
+ */
128
+ export declare function preProvisionCollisionCheck(taskId: string, directory: string, _sessionId: string): Promise<{
129
+ collision: boolean;
130
+ existingBranch?: string;
131
+ ownerSessionId?: string;
132
+ worktreePath?: string;
133
+ }>;
134
+ /**
135
+ * FR-001b SC-005: Returns true when `branchName`'s embedded session ID matches
136
+ * `expectedSessionId`.
137
+ *
138
+ * Uses `extractSessionId` (merge.ts) to parse the branch name. Supports both
139
+ * legacy `swarm-lane/<sessionId>/<id>` and current `swarm/lane/<sessionId>/<id>`
140
+ * patterns.
141
+ */
142
+ export declare function isLaneOwnedByCurrentSession(branchName: string, expectedSessionId: string): boolean;
110
143
  export declare function precreateStandardWorktreeSession(args: {
111
144
  config: PluginConfig;
112
145
  directory: string;
@@ -122,6 +155,68 @@ export declare function precreateStandardWorktreeSession(args: {
122
155
  files: string[];
123
156
  };
124
157
  }): Promise<void>;
158
+ /**
159
+ * FR-001c: Preserves dirty work in a worktree before cleanup on denial or cancellation.
160
+ *
161
+ * Detects dirty state, auto-commits with a descriptive message, tags the commit,
162
+ * and returns the commit hash so the work is recoverable from the reflog.
163
+ *
164
+ * @returns Three distinct outcomes:
165
+ * - `{ outcome: 'clean', preserved: false }` — worktree was clean; nothing to preserve.
166
+ * - `{ outcome: 'preserved', preserved: true, ref: <hash> }` — dirty AND commit succeeded.
167
+ * - `{ outcome: 'preserve-failed', preserved: false, error: <msg> }` — dirty AND commit/tag failed.
168
+ */
169
+ export declare function preserveDirtyWorktreeForCallId(callID: string, reason: 'denied' | 'cancelled', _directory: string, _worktree_dir?: string): Promise<{
170
+ outcome: 'clean' | 'preserved' | 'preserve-failed';
171
+ preserved: false | true;
172
+ ref?: string;
173
+ error?: string;
174
+ }>;
175
+ /**
176
+ * FR-001b SC-004: Preserves dirty worktree state at a known worktree path.
177
+ *
178
+ * This is the path-based counterpart of `preserveDirtyWorktreeForCallId` for the
179
+ * pre-provision collision fallback path where the callID is no longer tracked in
180
+ * any map (dispatch was GC'd). It runs the same git status → add → commit → tag
181
+ * sequence on a direct worktreePath.
182
+ *
183
+ * @param worktreePath - Absolute path to the worktree directory.
184
+ * @param branchName - Branch name (used only for advisory messages).
185
+ * @param reason - Preservation reason: 'denied' (pre-provision collision) or 'cancelled'.
186
+ * @param directory - Project root for git commands.
187
+ * @param worktree_dir - Optional worktree-dir override.
188
+ * @returns Preservation result matching preserveDirtyWorktreeForCallId's shape.
189
+ */
190
+ export declare function preserveDirtyWorktreeAtPath(worktreePath: string, branchName: string, reason: 'denied' | 'cancelled', _directory: string, _worktree_dir?: string): Promise<{
191
+ outcome: 'clean' | 'preserved' | 'preserve-failed';
192
+ preserved: false | true;
193
+ ref?: string;
194
+ error?: string;
195
+ }>;
196
+ /**
197
+ * FR-001a: Unconditionally cleans up a standard worktree dispatch's resources.
198
+ *
199
+ * Called at the end of every dispatch outcome (success, denial, cancellation)
200
+ * to ensure no worktree or branch is left behind.
201
+ *
202
+ * @param callID - The callID of the dispatch to clean up.
203
+ * @param reason - The outcome reason: 'success', 'denied', or 'cancelled'.
204
+ * @param directory - The project root (required for git worktree/branch commands).
205
+ * @param worktree_dir - Configured worktree-dir override.
206
+ */
207
+ export declare function cleanupStandardWorktreeForCallId(callID: string, reason: 'success' | 'denied' | 'cancelled', directory: string, worktree_dir?: string): Promise<void>;
208
+ /**
209
+ * FR-001a: Abort an in-flight standard worktree dispatch.
210
+ *
211
+ * Called when a dispatch needs to be cancelled before merge-back completes.
212
+ * Handles the case where the worktree was never provisioned (no entry in
213
+ * standardWorktreeByCallID) by returning early with a no-op diagnostic.
214
+ *
215
+ * @param callID - The callID of the dispatch to abort.
216
+ * @param reason - The abort reason: 'denied' or 'cancelled'.
217
+ * @param directory - The project root (required for git worktree/branch commands).
218
+ */
219
+ export declare function abortStandardWorktreeDispatch(callID: string, reason: 'denied' | 'cancelled', directory: string): Promise<void>;
125
220
  export declare function finishStandardWorktreeDispatch(directory: string, dispatch: StandardWorktreeDispatch, config?: PluginConfig,
126
221
  /**
127
222
  * Optional callID for cleanup of awaitingMergeByCallID. When omitted,
@@ -165,4 +260,19 @@ export declare const _internals: {
165
260
  awaitingMergeByCallID: Map<string, AwaitingMergeRecord>;
166
261
  startupOrphanRecovery: typeof startupOrphanRecovery;
167
262
  cleanupOrphanedBranches: typeof cleanupOrphanedBranches;
263
+ /** FR-001a: cleanup entry point for finishStandardWorktreeDispatch. */
264
+ cleanupStandardWorktreeForCallId: typeof cleanupStandardWorktreeForCallId;
265
+ /** FR-001c: preserves dirty worktree state before cleanup on denial/cancellation. */
266
+ preserveDirtyWorktreeForCallId: typeof preserveDirtyWorktreeForCallId;
267
+ /** FR-001b SC-004: path-based dirty worktree preservation for stale-lane fallback. */
268
+ preserveDirtyWorktreeAtPath: typeof preserveDirtyWorktreeAtPath;
269
+ /** FR-001a: abort entry point for in-flight dispatches. */
270
+ abortStandardWorktreeDispatch: typeof abortStandardWorktreeDispatch;
271
+ standardWorktreeByCallID: Map<string, StandardWorktreeDispatch>;
272
+ /** FR-001b SC-004: pre-provision collision check. */
273
+ preProvisionCollisionCheck: typeof preProvisionCollisionCheck;
274
+ /** FR-001b SC-005: lane ownership validation. */
275
+ isLaneOwnedByCurrentSession: typeof isLaneOwnedByCurrentSession;
276
+ /** FR-001b: bunSpawn — exposed for test injection so collision check can be mocked. */
277
+ bunSpawn: typeof bunSpawn;
168
278
  };
@@ -83,6 +83,22 @@ interface MessageWithParts {
83
83
  parts: MessagePart[];
84
84
  }
85
85
  declare function resolveDelegatedPlanTaskId(args: Record<string, unknown>, knownPlanTaskIds?: ReadonlySet<string>): string | null;
86
+ /**
87
+ * Parses structured per-task verdict lines from agent dispatch output.
88
+ *
89
+ * Recognized formats:
90
+ * [REVIEWED] | task-2.1 | APPROVED | ...
91
+ * [TESTED] | task-2.1 | PASS | ...
92
+ * [REVIEWED] | 2.1 | APPROVED | ... (bare task ID without prefix)
93
+ *
94
+ * Returns a Map from task ID to verdict string (e.g. "APPROVED", "REJECTED", "PASS", "FAIL").
95
+ * Only task IDs matching strict task ID format (N.M or N.M.P) are included.
96
+ * Lines that don't match the pattern are silently ignored.
97
+ *
98
+ * @param outputText - Raw text output from the agent dispatch
99
+ * @returns Map of taskId -> verdict string
100
+ */
101
+ export declare function parsePerTaskVerdicts(outputText: string): Map<string, string>;
86
102
  declare function buildParallelExecutionGuidance(directory: string | undefined, sessionID: string, session: AgentSessionState): Promise<string | null>;
87
103
  /**
88
104
  * Resolves the correct task ID for evidence recording by chaining:
@@ -107,6 +123,7 @@ declare function resolveEvidenceTaskId(args: Record<string, unknown> | undefined
107
123
  export declare const _internals: {
108
124
  resolveEvidenceTaskId: typeof resolveEvidenceTaskId;
109
125
  resolveDelegatedPlanTaskId: typeof resolveDelegatedPlanTaskId;
126
+ parsePerTaskVerdicts: typeof parsePerTaskVerdicts;
110
127
  buildParallelExecutionGuidance: typeof buildParallelExecutionGuidance;
111
128
  loadPlanJsonOnly: typeof loadPlanJsonOnly;
112
129
  resetStandardWorktreeIsolationState: typeof resetStandardWorktreeIsolationState;
@@ -53,7 +53,7 @@ export declare function injectVerdictIntoMessages(messages: MessageWithParts[],
53
53
  * This function encapsulates the critic invocation and event writing flow.
54
54
  * The critic response is awaited before writing the event to events.jsonl.
55
55
  */
56
- export declare function dispatchCriticAndWriteEvent(directory: string, architectOutput: string, criticContext: string, criticModel: string, escalationType: 'phase_completion' | 'question', interactionCount: number, deadlockCount: number, oversightAgentName: string, sessionID?: string): Promise<CriticDispatchResult>;
56
+ export declare function dispatchCriticAndWriteEvent(directory: string, architectOutput: string, criticContext: string, criticModel: string, escalationType: 'phase_completion' | 'question', interactionCount: number, deadlockCount: number, oversightAgentName: string, sessionID?: string, maxDispatchRetries?: number, maxConsecutiveDispatchFailures?: number): Promise<CriticDispatchResult>;
57
57
  /**
58
58
  * Creates the full-auto intercept hook factory.
59
59
  *