opencode-swarm 7.135.0 → 7.135.2

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 (86) hide show
  1. package/.opencode/skills/swarm-pr-feedback/SKILL.md +24 -21
  2. package/.opencode/skills/swarm-pr-review/SKILL.md +55 -42
  3. package/dist/agents/explorer.d.ts +1 -1
  4. package/dist/background/candidate-contract.d.ts +113 -0
  5. package/dist/background/candidate-parser.d.ts +8 -29
  6. package/dist/background/pr-review-trigger-contract.d.ts +197 -0
  7. package/dist/background/workspace-snapshot.d.ts +26 -0
  8. package/dist/cli/{config-doctor-j1x63x87.js → config-doctor-pj3yvxdb.js} +2 -2
  9. package/dist/cli/{core-fvqp2gnn.js → core-4va9z2ng.js} +2 -2
  10. package/dist/cli/{curation-policy-xg9zw0ep.js → curation-policy-b2caf3v3.js} +5 -5
  11. package/dist/cli/{curator-drift-9q6f85bm.js → curator-drift-2ta83hss.js} +2 -2
  12. package/dist/cli/{curator-llm-factory-4mat6cq5.js → curator-llm-factory-9983528d.js} +26 -26
  13. package/dist/cli/{curator-yc06cmnz.js → curator-r1s2mwf2.js} +26 -26
  14. package/dist/cli/{dispatch-gxbeb2ps.js → dispatch-wtk6dxky.js} +2 -2
  15. package/dist/cli/{evidence-summary-service-0cczdmjv.js → evidence-summary-service-feby8ny0.js} +5 -5
  16. package/dist/cli/{explorer-jp0nen03.js → explorer-15gqzxh8.js} +1 -1
  17. package/dist/cli/{gate-evidence-8zrwdj69.js → gate-evidence-84b03mb4.js} +3 -3
  18. package/dist/cli/guardrail-explain-pwxvg5n0.js +57 -0
  19. package/dist/cli/{guardrail-log-7egxrxap.js → guardrail-log-yzpz8b7t.js} +4 -4
  20. package/dist/cli/{hive-promoter-7s3gzajy.js → hive-promoter-586dhndj.js} +26 -26
  21. package/dist/cli/{index-nrvs08pr.js → index-02cqjna3.js} +6 -6
  22. package/dist/cli/{index-grxkbbc5.js → index-2pxk6qg4.js} +1 -1
  23. package/dist/cli/{index-crw4n55v.js → index-340chr1e.js} +1612 -166
  24. package/dist/cli/{index-g0raqavt.js → index-3m7kpnqf.js} +2 -2
  25. package/dist/cli/{index-z085b4ka.js → index-3xbx305x.js} +1 -1
  26. package/dist/cli/{index-b4z7s917.js → index-73dfyfhq.js} +1 -1
  27. package/dist/cli/{index-ens0gt38.js → index-7pnvf04s.js} +8 -8
  28. package/dist/cli/{index-x88w0cp5.js → index-8gw8p7yh.js} +3 -3
  29. package/dist/cli/{index-e8w62fgs.js → index-9c3gf2wd.js} +1 -1
  30. package/dist/cli/{index-vf6e8ame.js → index-b0eva00y.js} +2 -2
  31. package/dist/cli/{index-2ghkk9ve.js → index-bfd4xfpp.js} +3 -3
  32. package/dist/cli/{index-6kmmdtdp.js → index-bs4m85v1.js} +2 -2
  33. package/dist/cli/{index-86wdrskb.js → index-ckdva4rs.js} +5 -5
  34. package/dist/cli/{index-96b78s7p.js → index-cwdy5vw9.js} +28 -28
  35. package/dist/cli/{index-44zgqvqh.js → index-d5psymdk.js} +4 -4
  36. package/dist/cli/{index-vxv732ex.js → index-dg1njnms.js} +7 -4
  37. package/dist/cli/{index-yhba8swx.js → index-dzyjb33e.js} +1 -1
  38. package/dist/cli/{index-xg9repnx.js → index-ey29aap6.js} +1 -1
  39. package/dist/cli/{index-q9mq5tv3.js → index-g3meqrsg.js} +2 -2
  40. package/dist/cli/{index-7an2qn0s.js → index-hdy2nd5h.js} +4 -4
  41. package/dist/cli/{index-4yv2rn8q.js → index-hvrrq3f3.js} +1 -1
  42. package/dist/cli/{index-337r9pkr.js → index-j0kte6gd.js} +1 -1
  43. package/dist/cli/{index-ctvnb76s.js → index-j92ser8n.js} +1 -1
  44. package/dist/cli/{index-997d6p42.js → index-jgkjxpdh.js} +4 -4
  45. package/dist/cli/{index-13xxjfhn.js → index-m0ynxkaa.js} +3 -3
  46. package/dist/cli/{index-a4972t0f.js → index-qqkw794p.js} +3 -3
  47. package/dist/cli/{index-b7p0mp2q.js → index-ryqnn3nv.js} +1 -1
  48. package/dist/cli/{index-ny93srnd.js → index-vg3yx648.js} +1 -1
  49. package/dist/cli/{index-qe3v54nb.js → index-y111zefa.js} +64 -23
  50. package/dist/cli/{index-3nasn371.js → index-y6a7gjtj.js} +126 -42
  51. package/dist/cli/index.js +26 -26
  52. package/dist/cli/{knowledge-escalator-d76a090n.js → knowledge-escalator-w7by1m8m.js} +6 -6
  53. package/dist/cli/{knowledge-events-3mcg1a0e.js → knowledge-events-n8xxsay3.js} +4 -4
  54. package/dist/cli/{knowledge-link-etrfntkd.js → knowledge-link-mm1w967j.js} +3 -3
  55. package/dist/cli/{knowledge-store-xtt4sede.js → knowledge-store-xzmvfnx3.js} +4 -4
  56. package/dist/cli/{knowledge-validator-h1k7ymtd.js → knowledge-validator-5q1amsq6.js} +7 -7
  57. package/dist/cli/{pending-delegations-4z3tkkct.js → pending-delegations-mt5gs1bt.js} +3 -3
  58. package/dist/cli/{pr-subscriptions-29j794kd.js → pr-subscriptions-v5xd3j6d.js} +3 -3
  59. package/dist/cli/{scan-cursor-stztfv7d.js → scan-cursor-1q1zmt4b.js} +5 -5
  60. package/dist/cli/{schema-tbq2srrh.js → schema-8mtsfspm.js} +1 -1
  61. package/dist/cli/{scope-persistence-7wydjzx8.js → scope-persistence-h2fpgxww.js} +2 -2
  62. package/dist/cli/{skill-generator-02q1qdf0.js → skill-generator-54xbjgak.js} +8 -8
  63. package/dist/cli/{workspace-snapshot-9h5za0s6.js → workspace-snapshot-jmyamqnv.js} +6 -1
  64. package/dist/cli/{worktree-collision-ownership-dtwr0xj4.js → worktree-collision-ownership-15hymf1y.js} +5 -5
  65. package/dist/commands/registry.d.ts +1 -1
  66. package/dist/hooks/pr-workflow-gate.d.ts +30 -4
  67. package/dist/hooks/repo-graph-builder.d.ts +18 -0
  68. package/dist/hooks/scope-guard.d.ts +11 -4
  69. package/dist/index.js +395 -391
  70. package/dist/scope/scope-binding.d.ts +68 -0
  71. package/dist/session/snapshot-reader.d.ts +6 -0
  72. package/dist/state.d.ts +118 -0
  73. package/dist/tools/convene-council.d.ts +3 -3
  74. package/dist/tools/dispatch-lanes.d.ts +65 -7
  75. package/dist/tools/repo-graph/builder.d.ts +20 -2
  76. package/dist/tools/repo-graph/incremental.d.ts +18 -1
  77. package/dist/tools/repo-graph/ontology.d.ts +8 -0
  78. package/dist/tools/repo-graph/types.d.ts +62 -1
  79. package/dist/tools/repo-graph.d.ts +1 -1
  80. package/dist/tools/submit-phase-council-verdicts.d.ts +3 -3
  81. package/dist/tools/write-final-council-evidence.d.ts +3 -3
  82. package/dist/tools/write-pr-review-trigger-eval.d.ts +34 -63
  83. package/dist/turbo/lean/lane-scope.d.ts +120 -0
  84. package/dist/turbo/lean/runner.d.ts +66 -4
  85. package/package.json +1 -1
  86. package/dist/cli/guardrail-explain-zmbxwh3s.js +0 -57
@@ -1,8 +1,9 @@
1
1
  import * as fsp from 'node:fs/promises';
2
+ import { type PrReviewInlineTriggerRow } from '../background/pr-review-trigger-contract.js';
2
3
  import { resolveCommitCountSince, resolveCommitCountSinceAsync, resolveCurrentGitHead, resolveCurrentGitHeadAsync, resolveCurrentUpstreamPushTarget, resolveCurrentUpstreamPushTargetAsync, resolveCurrentUpstreamRemoteRef, resolveExactRemoteBranchHead, resolveExactRemoteBranchHeadAsync, resolveIsExactSingleChildCommit, resolveIsExactSingleChildCommitAsync, resolveIsWorkingTreeClean, resolveIsWorkingTreeCleanAsync, resolvePrReviewDiffStats, resolvePrReviewDiffStatsAsync, resolvePrWorkflowRevisionDigest, resolveRemoteRefsContainingHead, resolveRemoteRefsContainingHeadAsync } from '../background/workspace-snapshot.js';
3
4
  import { type PrWorkflowGitState } from '../git/pr-workflow-state.js';
4
5
  export declare const PR_REVIEW_BASE_DIMENSION_IDS: readonly ["intent-architecture", "correctness-state", "tests-falsifiability", "security-trust", "reliability-performance", "compatibility-delivery"];
5
- export declare const PR_REVIEW_REQUIRED_MICRO_LANE_IDS: readonly ["auth-identity-secrets", "untrusted-input-boundaries", "subprocess-platform", "concurrency-state", "dependencies-build-release", "api-schema-migrations", "test-infrastructure", "ui-accessibility-i18n", "privacy-observability", "generated-provenance", "unclassified-risk"];
6
+ export declare const PR_REVIEW_REQUIRED_MICRO_LANE_IDS: ("auth-identity-secrets" | "untrusted-input-boundaries" | "subprocess-platform" | "concurrency-state" | "dependencies-build-release" | "api-schema-migrations" | "test-infrastructure" | "ui-accessibility-i18n" | "privacy-observability" | "generated-provenance" | "unclassified-risk")[];
6
7
  export type PrReviewBaseDimensionId = (typeof PR_REVIEW_BASE_DIMENSION_IDS)[number];
7
8
  export type PrWorkflowMode = 'PR_REVIEW' | 'PR_FEEDBACK';
8
9
  export interface PrWorkflowCheckoutRecoveryRecord {
@@ -194,6 +195,8 @@ export interface PrWorkflowGateState {
194
195
  prReviewBaseDispatches?: PrReviewBaseDispatchRecord[];
195
196
  /** @deprecated Compatibility projection of the most recent base dispatch. */
196
197
  prReviewBaseDispatch?: PrReviewBaseDispatchRecord;
198
+ /** Canonical ordered semantic ledger frozen by the first micro dispatch. */
199
+ prReviewTriggerLedger?: PrReviewInlineTriggerRow[];
197
200
  prReviewTriggerEvalPath?: string;
198
201
  prReviewValidationBatches?: PrReviewValidationBatchRecord[];
199
202
  prReviewArtifactRunId?: string;
@@ -284,7 +287,7 @@ export declare function bindPrReviewBase(directory: string, sessionID: string, o
284
287
  * exact remediation command so callers can self-diagnose instead of
285
288
  * cascading into fictional root causes.
286
289
  */
287
- export declare function assertCurrentCheckoutHead(directory: string, expectedHead: string): Promise<string>;
290
+ export declare function assertCurrentCheckoutHead(directory: string, expectedHead: string, mode?: PrWorkflowMode): Promise<string>;
288
291
  /** Prove that every PR-review lane reads the immutable checked-out PR tree. */
289
292
  export declare function assertPrReviewCleanCheckout(directory: string, mode?: PrWorkflowMode): Promise<void>;
290
293
  export declare function enforcePrWorkflowDispatchLanesAsync(directory: string, sessionID: string, toolName: string): Promise<PrWorkflowGateState | null>;
@@ -335,6 +338,8 @@ export declare function assertPrFeedbackGatePhaseSettled(directory: string, sess
335
338
  /** Require every ordered feedback gate on one unchanged revision. */
336
339
  export declare function assertPrFeedbackReadyToPublish(directory: string, sessionID: string): Promise<PrWorkflowGateState>;
337
340
  export declare function markPrReviewTriggerEvaluationComplete(directory: string, sessionID: string, artifactPath: string): Promise<PrWorkflowGateState>;
341
+ /** Freeze one exact inline trigger ledger across every micro dispatch. */
342
+ export declare function bindPrReviewTriggerLedger(directory: string, sessionID: string, input: unknown): Promise<PrWorkflowGateState>;
338
343
  export declare function assertPrReviewArtifactBoundary(directory: string, sessionID: string, runId: string, boundary: PrReviewArtifactBoundary, findingIds: string[]): Promise<PrWorkflowGateState>;
339
344
  /**
340
345
  * Artifact records are a projection of lane receipts, never a caller-controlled
@@ -365,14 +370,23 @@ export declare function completePrWorkflow(directory: string, sessionID: string,
365
370
  export declare const _test_exports: {
366
371
  workflowGateStateRelativePath: typeof workflowGateStateRelativePath;
367
372
  workflowGateStateLockRelativePath: typeof workflowGateStateLockRelativePath;
373
+ workflowCheckoutMutationLockRelativePath: typeof workflowCheckoutMutationLockRelativePath;
374
+ withPrWorkflowCheckoutMutationLock: typeof withPrWorkflowCheckoutMutationLock;
368
375
  resetTrackedStateCache: () => void;
369
376
  beforeTerminalClear: (() => Promise<void>) | undefined;
370
377
  beforePrFeedbackTransitionLock: (() => Promise<void>) | undefined;
378
+ beforePrFeedbackTrackingSwitch: (() => Promise<void>) | undefined;
379
+ afterPrFeedbackTrackingSwitch: (() => Promise<void>) | undefined;
380
+ beforePrFeedbackTrackingPersist: (() => Promise<void>) | undefined;
371
381
  beforeBoundedSwarmFileOpen: (() => Promise<void>) | undefined;
372
382
  beforeSessionStateLockWrite: (() => Promise<void>) | undefined;
383
+ beforeCheckoutLockWrite: (() => Promise<void>) | undefined;
373
384
  beforeSafeDirectoryCreate: ((parentPath: string, nextPath: string) => Promise<void>) | undefined;
374
385
  beforeAtomicTempWrite: (() => Promise<void>) | undefined;
375
386
  beforeAtomicRename: (() => Promise<void>) | undefined;
387
+ openCheckoutLock: typeof openCheckoutLockFile;
388
+ removeCheckoutLock: typeof removeCheckoutLockFile;
389
+ checkoutMutationActionTimeoutMs: number;
376
390
  resolveCurrentGitHead: typeof resolveCurrentGitHead;
377
391
  resolveCurrentGitHeadAsync: typeof resolveCurrentGitHeadAsync;
378
392
  resolveCurrentUpstreamPushTarget: typeof resolveCurrentUpstreamPushTarget;
@@ -407,12 +421,24 @@ export declare function normalizePrWorkflowShellCommand(command: string): {
407
421
  strippedCdPrefix: boolean;
408
422
  };
409
423
  declare function isSafeStandaloneGitCommit(command: string): boolean;
410
- /** Require at least one real discovery row or a lane-bound CLEAN attestation. */
411
- export declare function prReviewDiscoveryArtifactCoversLane(text: string, expectedWorkflowLane: string): boolean;
424
+ /** Require at least one semantically valid discovery row or CLEAN attestation. */
425
+ export declare function prReviewDiscoveryArtifactCoversLane(text: string, expectedWorkflowLane: string, ownedWorkflowLanes?: readonly string[]): boolean;
412
426
  declare function parseCriticVerdict(text: string, itemId: string, reviewerSeverity?: string): {
413
427
  status: string;
414
428
  severity: string;
415
429
  } | null;
430
+ declare function workflowCheckoutMutationLockRelativePath(): string;
431
+ declare function openCheckoutLockFile(lockPath: string): Promise<fsp.FileHandle>;
432
+ declare function removeCheckoutLockFile(lockPath: string): Promise<void>;
433
+ /** A bounded checkout-mutation refusal that never permits unsafe late overlap. */
434
+ export declare class PrWorkflowCheckoutMutationTimeoutError extends Error {
435
+ readonly phase: 'queue' | 'action';
436
+ readonly code: "PR_WORKFLOW_CHECKOUT_MUTATION_TIMEOUT";
437
+ readonly retryable: false;
438
+ constructor(phase: 'queue' | 'action');
439
+ }
440
+ /** Serialize project-wide checkout mutations before any session state lock. */
441
+ export declare function withPrWorkflowCheckoutMutationLock<T>(directory: string, action: () => Promise<T>): Promise<T>;
416
442
  declare function isProcessAlive(pid: number): boolean;
417
443
  declare function workflowGateStateLockRelativePath(sessionID: string): string;
418
444
  declare function workflowGateStateRelativePath(sessionID: string): string;
@@ -44,6 +44,24 @@ export interface RepoGraphDeps {
44
44
  }) => Promise<RepoGraph>;
45
45
  safeRealpathSync?: typeof safeRealpathSync;
46
46
  }
47
+ /**
48
+ * Rebase a realpath'd file onto the lexical workspace root so the incremental
49
+ * update keys the same node the walk produced (issue #1985, defect A5). Exported
50
+ * for direct unit testing of the symlink-root rebase logic.
51
+ *
52
+ * The walk keys nodes lexically relative to `workspaceRoot` (realpath is used
53
+ * only as a cycle-break key). When the workspace root itself is a symlink
54
+ * (`workspaceRoot` → `realWorkspace`), a realpath'd file (`realFilePath`) lives
55
+ * under `realWorkspace` and would key a DIFFERENT node than the lexical path the
56
+ * walker would have produced — causing a duplicate node.
57
+ *
58
+ * If `realFilePath` is under `realWorkspace`, rebase its workspace-relative tail
59
+ * onto the lexical `workspaceRoot` (reconstructing the lexical absolute path the
60
+ * walker used). Otherwise (case-insensitive aliasing without a symlinked root,
61
+ * or an unexpected layout) return `realFilePath` so the case-folding benefit of
62
+ * the realpath is preserved.
63
+ */
64
+ export declare function rebaseOntoWorkspace(realFilePath: string, realWorkspace: string, workspaceRoot: string): string;
47
65
  export declare function createRepoGraphBuilderHook(workspaceRoot: string, deps?: Partial<RepoGraphDeps>, options?: {
48
66
  excludeDirs?: readonly string[];
49
67
  }): RepoGraphBuilderHook;
@@ -8,9 +8,9 @@
8
8
  * Fires BEFORE write/edit tools execute. When a coder attempts to modify a file
9
9
  * outside its Task-correlated scope, blocks the call and injects an advisory.
10
10
  */
11
- import { getAuthorizedPrFeedbackScopeBinding } from '../scope/scope-binding';
11
+ import { describeScopeWorkspaceMismatch, getAuthorizedPrFeedbackScopeBinding } from '../scope/scope-binding';
12
12
  import { resolveAuthorizedPrFeedbackScopeBindingFromDisk, resolveAuthorizedScopeBinding, resolveAuthorizedScopeBindingForSession } from '../scope/scope-persistence';
13
- import { type AgentSessionState } from '../state';
13
+ import { type AgentSessionState, resolveSessionWorkspaceDirectory } from '../state';
14
14
  import { validatePrFeedbackScopeBinding } from './pr-workflow-gate';
15
15
  import { resolveWriteTargets } from './write-target-resolver';
16
16
  /**
@@ -25,10 +25,15 @@ export interface ScopeGuardConfig {
25
25
  /**
26
26
  * Creates the scope-guard hook that blocks out-of-scope writes.
27
27
  * @param config - ScopeGuardConfig (enabled, skip_in_turbo)
28
- * @param _directory - The workspace directory (reserved for future use)
28
+ * @param fallbackDirectory - The plugin-root directory (`ctx.directory`). Used
29
+ * ONLY as the fallback for sessions with no recorded workspace root. Issue
30
+ * #2002: this hook is constructed once per plugin instance and serves every
31
+ * session, including worktree-isolated coder children that execute in a
32
+ * different root — so this value must never be used directly as "the
33
+ * directory" inside the handler. Resolve per session instead.
29
34
  * @param injectAdvisory - Optional callback to push advisory to architect session
30
35
  */
31
- export declare function createScopeGuardHook(config: Partial<ScopeGuardConfig>, directory: string, injectAdvisory?: (sessionId: string, message: string) => void): {
36
+ export declare function createScopeGuardHook(config: Partial<ScopeGuardConfig>, fallbackDirectory: string, injectAdvisory?: (sessionId: string, message: string) => void): {
32
37
  toolBefore: (input: {
33
38
  tool: string;
34
39
  sessionID: string;
@@ -74,6 +79,8 @@ export declare const _internals: {
74
79
  getAuthorizedPrFeedbackScopeBinding: typeof getAuthorizedPrFeedbackScopeBinding;
75
80
  resolveAuthorizedPrFeedbackScopeBindingFromDisk: typeof resolveAuthorizedPrFeedbackScopeBindingFromDisk;
76
81
  validatePrFeedbackScopeBinding: typeof validatePrFeedbackScopeBinding;
82
+ resolveSessionWorkspaceDirectory: typeof resolveSessionWorkspaceDirectory;
83
+ describeScopeWorkspaceMismatch: typeof describeScopeWorkspaceMismatch;
77
84
  resolveTaskId: (session: AgentSessionState | undefined) => string | null;
78
85
  };
79
86
  export {};