opencode-swarm 7.144.7 → 7.145.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 (86) hide show
  1. package/dist/cli/{capability-probe-976tt4ba.js → capability-probe-va4kk8vg.js} +2 -2
  2. package/dist/cli/{config-doctor-zdvaq4nb.js → config-doctor-dzsv3pqy.js} +2 -2
  3. package/dist/cli/{core-j7f118a5.js → core-qkh9me8x.js} +2 -2
  4. package/dist/cli/{curation-policy-a511r0qz.js → curation-policy-5x6346tf.js} +7 -7
  5. package/dist/cli/{curator-drift-ckjm272w.js → curator-drift-yn5d0mvq.js} +3 -3
  6. package/dist/cli/curator-llm-factory-q5p4578g.js +64 -0
  7. package/dist/cli/{curator-97sm8wn0.js → curator-zssndq5x.js} +34 -33
  8. package/dist/cli/dispatch-ndxbsk98.js +1 -1
  9. package/dist/cli/{evidence-summary-service-kwtb2d14.js → evidence-summary-service-dqcpapj8.js} +15 -14
  10. package/dist/cli/{gate-evidence-rk9j0hc4.js → gate-evidence-bkdqryqg.js} +9 -8
  11. package/dist/cli/guardrail-explain-kspf83x5.js +65 -0
  12. package/dist/cli/{guardrail-log-zbqf4ws6.js → guardrail-log-qg4sq6gr.js} +4 -4
  13. package/dist/cli/{hive-promoter-qzvtp5wx.js → hive-promoter-3h7dhnek.js} +34 -33
  14. package/dist/cli/{index-00fk9c3b.js → index-0jr9zn34.js} +1 -1
  15. package/dist/cli/{index-zq9gs0yk.js → index-0pcq32y2.js} +1 -1
  16. package/dist/cli/{index-gmdgap01.js → index-2dnqazyr.js} +1 -1
  17. package/dist/cli/{index-b44qqqt2.js → index-3g0xk6tk.js} +1 -1
  18. package/dist/cli/{index-yz0hfa4g.js → index-4e5a28h7.js} +2 -2
  19. package/dist/cli/index-4evasm2b.js +514 -0
  20. package/dist/cli/{index-jszgrk71.js → index-4zwjc9sb.js} +10 -29
  21. package/dist/cli/{index-x4q96ejx.js → index-6ezbzd5e.js} +2509 -1995
  22. package/dist/cli/{index-q7zy6dej.js → index-6hqhyb0f.js} +4 -4
  23. package/dist/cli/{index-9s8drsf9.js → index-6q3agdmr.js} +4 -21
  24. package/dist/cli/{index-hkdgkkhb.js → index-77ef8gye.js} +2 -2
  25. package/dist/cli/{index-bx20cv1v.js → index-7g276m9m.js} +2 -2
  26. package/dist/cli/{index-zy7f84cs.js → index-85gkedsf.js} +14 -5
  27. package/dist/cli/{index-7bvd5nh2.js → index-apjdytwx.js} +3 -3
  28. package/dist/cli/{index-pzsezhek.js → index-b3xret0a.js} +5 -5
  29. package/dist/cli/{index-qm0mz7rj.js → index-c13ttmak.js} +8 -8
  30. package/dist/cli/{index-d879g58v.js → index-e00wbqw5.js} +2 -2
  31. package/dist/cli/{index-cwtpqm5f.js → index-e1pxav9g.js} +1 -1
  32. package/dist/cli/{index-n4hwcsbd.js → index-ffdwj1an.js} +5 -5
  33. package/dist/cli/{index-vdha477y.js → index-fp464as8.js} +1 -1
  34. package/dist/cli/{index-c1cfsg9y.js → index-h4hasck4.js} +4 -4
  35. package/dist/cli/{index-39jbnhar.js → index-hfzcztv6.js} +36 -35
  36. package/dist/cli/{index-wknz5c8q.js → index-jy9bwa9k.js} +2 -2
  37. package/dist/cli/{index-xjgwr4c6.js → index-k6pdsct6.js} +1 -1
  38. package/dist/cli/{index-r2q0nd0a.js → index-kp87kr1a.js} +3 -3
  39. package/dist/cli/{index-w9bnt74s.js → index-mkks7jwg.js} +13 -15
  40. package/dist/cli/{index-f9vvg5xb.js → index-pa86tpgt.js} +67 -2
  41. package/dist/cli/{index-77h4xjn5.js → index-qfawexc8.js} +9 -9
  42. package/dist/cli/{index-grkev1g6.js → index-s6cwsnrw.js} +8 -8
  43. package/dist/cli/{index-h1p08s3n.js → index-s72naw1j.js} +1 -1
  44. package/dist/cli/{index-s1xefrx7.js → index-v64kjqvg.js} +19 -16
  45. package/dist/cli/{index-6z5jtf7d.js → index-wk54ey3h.js} +4 -4
  46. package/dist/cli/{index-x4eqd82b.js → index-zfhe7vbb.js} +1 -1
  47. package/dist/cli/{index-1jsmmx7y.js → index-zz5qsjd1.js} +64 -35
  48. package/dist/cli/index.js +34 -33
  49. package/dist/cli/{knowledge-escalator-fhc6ecbv.js → knowledge-escalator-w1mbaktt.js} +14 -13
  50. package/dist/cli/{knowledge-events-31g69mx2.js → knowledge-events-a0dj6gy6.js} +12 -11
  51. package/dist/cli/{knowledge-link-4cg4776a.js → knowledge-link-mzdjvjsd.js} +6 -6
  52. package/dist/cli/{knowledge-store-g389c1cy.js → knowledge-store-8kk3rghx.js} +7 -7
  53. package/dist/cli/{knowledge-validator-sng5xt5a.js → knowledge-validator-91ym56e0.js} +9 -9
  54. package/dist/cli/{pending-delegations-9h1jmtw1.js → pending-delegations-6vsrmw5w.js} +6 -6
  55. package/dist/cli/{pr-subscriptions-8pg34pev.js → pr-subscriptions-zc3skxde.js} +6 -6
  56. package/dist/cli/{runner-cqecp1na.js → runner-jj32v8bk.js} +8 -7
  57. package/dist/cli/{scan-cursor-qm3tsvvw.js → scan-cursor-12jxwd14.js} +8 -8
  58. package/dist/cli/{schema-vnghba3d.js → schema-nq9tcz87.js} +1 -1
  59. package/dist/cli/{scope-persistence-k9mqd414.js → scope-persistence-dv6z7n08.js} +8 -7
  60. package/dist/cli/{skill-generator-v1wdh3ne.js → skill-generator-drscnzq9.js} +16 -15
  61. package/dist/cli/{telemetry-cybx6cfz.js → telemetry-z54dgdrh.js} +1 -1
  62. package/dist/cli/{workspace-snapshot-d89zm6wm.js → workspace-snapshot-q21mgbsh.js} +2 -2
  63. package/dist/cli/{worktree-collision-ownership-vy0kxa98.js → worktree-collision-ownership-rfyyjjct.js} +9 -9
  64. package/dist/cli/{worktree-isolation-bxt3rftm.js → worktree-isolation-4tehtym5.js} +34 -33
  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/git/branch.d.ts +9 -0
  72. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +5 -0
  73. package/dist/index.js +561 -531
  74. package/dist/memory/schema.d.ts +3 -3
  75. package/dist/observability/catalog.d.ts +5 -4
  76. package/dist/observability/envelope.d.ts +2 -2
  77. package/dist/sandbox/executor.d.ts +6 -0
  78. package/dist/services/swarm-residue.d.ts +151 -0
  79. package/dist/telemetry.d.ts +20 -1
  80. package/dist/tools/knowledge-receipt.d.ts +1 -1
  81. package/dist/utils/atomic-write.d.ts +185 -0
  82. package/package.json +1 -1
  83. package/dist/cli/curator-llm-factory-eny079d1.js +0 -63
  84. package/dist/cli/guardrail-explain-8gggptqj.js +0 -64
  85. package/dist/cli/{index-f36ybbsv.js → index-b30x236n.js} +3 -3
  86. package/dist/cli/{index-fv0s19g9.js → index-w8pgjr75.js} +3 -3
@@ -169,7 +169,14 @@ export interface CleanStageResult {
169
169
  cleanedFiles: string[];
170
170
  configBackupsRemoved: number;
171
171
  swarmPlanFilesRemoved: number;
172
- tmpFilesRemoved: number;
172
+ /**
173
+ * Stale atomic-write temp files MOVED into `.swarm/quarantine/<batch>/`
174
+ * (issue #2035). Quarantine is a recoverable move with a manifest — the
175
+ * pre-#2035 blind `.tmp.*` unlink sweep is gone; preserved candidates
176
+ * (recent/active/tracked/ambiguous) are counted in `residuePreserved`.
177
+ */
178
+ residueQuarantined: number;
179
+ residuePreserved: number;
173
180
  }
174
181
  /**
175
182
  * Emit the single `close_archive_result` telemetry event whose payload is the
@@ -90,9 +90,9 @@ export declare const ReviewEvidenceSchema: z.ZodObject<{
90
90
  }>;
91
91
  issues: z.ZodDefault<z.ZodArray<z.ZodObject<{
92
92
  severity: z.ZodEnum<{
93
- error: "error";
94
93
  info: "info";
95
94
  warning: "warning";
95
+ error: "error";
96
96
  }>;
97
97
  message: z.ZodString;
98
98
  file: z.ZodOptional<z.ZodString>;
@@ -518,8 +518,8 @@ export declare const QualityBudgetEvidenceSchema: z.ZodObject<{
518
518
  }>;
519
519
  message: z.ZodString;
520
520
  severity: z.ZodEnum<{
521
- error: "error";
522
521
  warning: "warning";
522
+ error: "error";
523
523
  }>;
524
524
  files: z.ZodArray<z.ZodString>;
525
525
  }, z.core.$strip>>>;
@@ -623,9 +623,9 @@ export declare const EvidenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
623
623
  }>;
624
624
  issues: z.ZodDefault<z.ZodArray<z.ZodObject<{
625
625
  severity: z.ZodEnum<{
626
- error: "error";
627
626
  info: "info";
628
627
  warning: "warning";
628
+ error: "error";
629
629
  }>;
630
630
  message: z.ZodString;
631
631
  file: z.ZodOptional<z.ZodString>;
@@ -1013,8 +1013,8 @@ export declare const EvidenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1013
1013
  }>;
1014
1014
  message: z.ZodString;
1015
1015
  severity: z.ZodEnum<{
1016
- error: "error";
1017
1016
  warning: "warning";
1017
+ error: "error";
1018
1018
  }>;
1019
1019
  files: z.ZodArray<z.ZodString>;
1020
1020
  }, z.core.$strip>>>;
@@ -1113,9 +1113,9 @@ export declare const EvidenceBundleSchema: z.ZodObject<{
1113
1113
  }>;
1114
1114
  issues: z.ZodDefault<z.ZodArray<z.ZodObject<{
1115
1115
  severity: z.ZodEnum<{
1116
- error: "error";
1117
1116
  info: "info";
1118
1117
  warning: "warning";
1118
+ error: "error";
1119
1119
  }>;
1120
1120
  message: z.ZodString;
1121
1121
  file: z.ZodOptional<z.ZodString>;
@@ -1503,8 +1503,8 @@ export declare const EvidenceBundleSchema: z.ZodObject<{
1503
1503
  }>;
1504
1504
  message: z.ZodString;
1505
1505
  severity: z.ZodEnum<{
1506
- error: "error";
1507
1506
  warning: "warning";
1507
+ error: "error";
1508
1508
  }>;
1509
1509
  files: z.ZodArray<z.ZodString>;
1510
1510
  }, z.core.$strip>>>;
@@ -48,8 +48,8 @@ export declare function normalizePhaseStatus(status: PhaseStatus): PhaseStatus;
48
48
  */
49
49
  export declare function isPhaseComplete(status: PhaseStatus): boolean;
50
50
  export declare const MigrationStatusSchema: z.ZodEnum<{
51
- native: "native";
52
51
  migrated: "migrated";
52
+ native: "native";
53
53
  migration_failed: "migration_failed";
54
54
  }>;
55
55
  export type MigrationStatus = z.infer<typeof MigrationStatusSchema>;
@@ -164,8 +164,8 @@ export declare const PlanSchema: z.ZodObject<{
164
164
  required_agents: z.ZodOptional<z.ZodArray<z.ZodString>>;
165
165
  }, z.core.$strip>>;
166
166
  migration_status: z.ZodOptional<z.ZodEnum<{
167
- native: "native";
168
167
  migrated: "migrated";
168
+ native: "native";
169
169
  migration_failed: "migration_failed";
170
170
  }>>;
171
171
  specMtime: z.ZodOptional<z.ZodString>;
@@ -435,8 +435,8 @@ export type AutoReviewConfig = z.infer<typeof AutoReviewConfigSchema>;
435
435
  export declare const AdversarialDetectionConfigSchema: z.ZodObject<{
436
436
  enabled: z.ZodDefault<z.ZodBoolean>;
437
437
  policy: z.ZodDefault<z.ZodEnum<{
438
- ignore: "ignore";
439
438
  gate: "gate";
439
+ ignore: "ignore";
440
440
  warn: "warn";
441
441
  }>>;
442
442
  pairs: z.ZodDefault<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>>;
@@ -1571,10 +1571,10 @@ export declare const ExternalSkillCandidateSourceTypeSchema: z.ZodEnum<{
1571
1571
  export type ExternalSkillCandidateSourceType = z.infer<typeof ExternalSkillCandidateSourceTypeSchema>;
1572
1572
  /** Evaluation verdict for an external skill candidate. */
1573
1573
  export declare const ExternalSkillCandidateEvaluationVerdictSchema: z.ZodEnum<{
1574
+ quarantined: "quarantined";
1574
1575
  passed: "passed";
1575
1576
  pending: "pending";
1576
1577
  promoted: "promoted";
1577
- quarantined: "quarantined";
1578
1578
  in_review: "in_review";
1579
1579
  rejected: "rejected";
1580
1580
  revoked: "revoked";
@@ -1618,20 +1618,20 @@ export declare const ExternalSkillCandidateSchema: z.ZodObject<{
1618
1618
  skill_body: z.ZodString;
1619
1619
  risk_flags: z.ZodDefault<z.ZodArray<z.ZodString>>;
1620
1620
  evaluation_verdict: z.ZodDefault<z.ZodEnum<{
1621
+ quarantined: "quarantined";
1621
1622
  passed: "passed";
1622
1623
  pending: "pending";
1623
1624
  promoted: "promoted";
1624
- quarantined: "quarantined";
1625
1625
  in_review: "in_review";
1626
1626
  rejected: "rejected";
1627
1627
  revoked: "revoked";
1628
1628
  }>>;
1629
1629
  evaluation_history: z.ZodDefault<z.ZodArray<z.ZodObject<{
1630
1630
  verdict: z.ZodEnum<{
1631
+ quarantined: "quarantined";
1631
1632
  passed: "passed";
1632
1633
  pending: "pending";
1633
1634
  promoted: "promoted";
1634
- quarantined: "quarantined";
1635
1635
  in_review: "in_review";
1636
1636
  rejected: "rejected";
1637
1637
  revoked: "revoked";
@@ -1641,10 +1641,10 @@ export declare const ExternalSkillCandidateSchema: z.ZodObject<{
1641
1641
  reason: z.ZodOptional<z.ZodString>;
1642
1642
  candidate_id: z.ZodOptional<z.ZodString>;
1643
1643
  original_verdict: z.ZodOptional<z.ZodEnum<{
1644
+ quarantined: "quarantined";
1644
1645
  passed: "passed";
1645
1646
  pending: "pending";
1646
1647
  promoted: "promoted";
1647
- quarantined: "quarantined";
1648
1648
  in_review: "in_review";
1649
1649
  rejected: "rejected";
1650
1650
  revoked: "revoked";
@@ -1657,8 +1657,8 @@ export declare const ExternalSkillCandidateSchema: z.ZodObject<{
1657
1657
  total_flags: z.ZodNumber;
1658
1658
  findings: z.ZodArray<z.ZodObject<{
1659
1659
  severity: z.ZodEnum<{
1660
- error: "error";
1661
1660
  warning: "warning";
1661
+ error: "error";
1662
1662
  }>;
1663
1663
  category: z.ZodString;
1664
1664
  }, z.core.$strip>>;
@@ -2033,8 +2033,8 @@ export declare const PluginConfigSchema: z.ZodObject<{
2033
2033
  adversarial_detection: z.ZodOptional<z.ZodObject<{
2034
2034
  enabled: z.ZodDefault<z.ZodBoolean>;
2035
2035
  policy: z.ZodDefault<z.ZodEnum<{
2036
- ignore: "ignore";
2037
2036
  gate: "gate";
2037
+ ignore: "ignore";
2038
2038
  warn: "warn";
2039
2039
  }>>;
2040
2040
  pairs: z.ZodDefault<z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>>;
@@ -17,7 +17,6 @@
17
17
  * This module deliberately holds no schema/validation logic — each caller keeps
18
18
  * its own taskId validation and read/merge semantics.
19
19
  */
20
- import { renameSync, unlinkSync } from 'node:fs';
21
20
  /**
22
21
  * Relative path (under `.swarm/`) of the flat task evidence file.
23
22
  * This is also the lock key — it MUST be identical across all writers to the
@@ -26,26 +25,27 @@ import { renameSync, unlinkSync } from 'node:fs';
26
25
  export declare function taskEvidenceRelPath(taskId: string): string;
27
26
  /** Absolute path of the flat task evidence file under `<directory>/.swarm/`. */
28
27
  export declare function taskEvidencePath(directory: string, taskId: string): string;
29
- /**
30
- * Dependency-injection seam for testing. Tests can temporarily replace these
31
- * to exercise failure paths (e.g. EPERM on renameSync) without mock.module leakage.
32
- * Restore each entry in afterEach via the saved original reference.
33
- */
34
- export declare const _internals: {
35
- renameSync: typeof renameSync;
36
- unlinkSync: typeof unlinkSync;
37
- };
38
28
  /**
39
29
  * Atomic write: write to a unique temp file, then rename over the target.
40
30
  * The rename is atomic on POSIX and Windows, so readers never observe a torn
41
31
  * file. The temp file is cleaned up in `finally` (no-op once renamed away).
42
32
  *
43
- * Invalidates any swarm-artifact-cache entry for `targetPath` after a
44
- * successful rename: the cache's stat-based staleness check can collide on a
45
- * same-size rewrite that lands within one filesystem timestamp tick (issue
46
- * #1729), which would otherwise let a read immediately following this write
47
- * (e.g. a second locked transaction in the same logical operation) observe
48
- * the pre-write content instead of what was just committed.
33
+ * Delegates to the canonical writer core (`src/utils/atomic-write.ts`, issue
34
+ * #2035) via the ANY-ROOT variant: this shared writer serves dual
35
+ * destinations `.swarm/evidence/**` files AND the linked/hive knowledge
36
+ * stores whose directories live outside any `.swarm` root (knowledge-store /
37
+ * knowledge-link / memory-link / family migrations) so `.swarm` root
38
+ * containment (the canonical entry point's contract) is inapplicable here.
39
+ * Everything else is canonical: registered `canonical-v1` temp grammar,
40
+ * fsync-before-rename, bounded Windows rename retry, exact own-temp cleanup,
41
+ * and swarm-artifact-cache invalidation after a successful rename — the
42
+ * cache's stat-based staleness check can collide on a same-size rewrite that
43
+ * lands within one filesystem timestamp tick (issue #1729), which would
44
+ * otherwise let a read immediately following this write observe the pre-write
45
+ * content instead of what was just committed.
46
+ *
47
+ * Failure-injection tests target `src/utils/atomic-write.ts:_internals`
48
+ * (renameSync/unlinkSync) — the seam moved there with the implementation.
49
49
  */
50
50
  export declare function atomicWriteFile(targetPath: string, content: string): Promise<void>;
51
51
  /**
@@ -60,6 +60,15 @@ declare const __spawnSyncSeam: {
60
60
  * Synchronously read and parse a lane runtime profile from disk.
61
61
  * Mirrors the logic of `readLaneEnvFileFromDisk` but uses sync fs.
62
62
  * Returns an empty record when the file does not exist or cannot be read.
63
+ *
64
+ * UNTRUSTED INPUT (issue #2263): this file lives at
65
+ * `<worktree>/.swarm/lanes/<N>.env` — a path INSIDE the repository — so a
66
+ * hostile repository can simply commit it. Every key/value parsed here is
67
+ * attacker-controlled and must pass BOTH the `isValidEnvKey` shape check and
68
+ * the `isUntrustedEnvKey` denylist (drops the `GIT_*` control plane and the
69
+ * `LD_*`/`DYLD_*` loader-hijack families, which are code-execution
70
+ * primitives in a git child-process environment). The shape-only validation
71
+ * looks sufficient but is not — that gap is exactly what #2263 reported.
63
72
  */
64
73
  export declare function readLaneEnvFileFromDiskSync(worktreePath: string, laneIndex: number): Record<string, string>;
65
74
  declare function gitExec(args: string[], cwd: string, laneEnv?: Record<string, string>, laneIndex?: number): string;
@@ -287,6 +287,11 @@ callID?: string, settlement?: StandardWorktreeSettlementOptions): Promise<Standa
287
287
  * - Skips blank lines and lines starting with `#` (comments).
288
288
  * - Skips malformed lines (no `=` separator).
289
289
  * - Validates each key with `isValidEnvKey`; rejects and skips invalid keys.
290
+ * - Drops `GIT_*` / `LD_*` / `DYLD_*` keys via `isUntrustedEnvKey` (#2263):
291
+ * the file is repo-resident, so its contents are attacker-controlled. The
292
+ * `GIT_*` family is git's control plane (`GIT_SSH_COMMAND`,
293
+ * `GIT_CONFIG_*`, …) and `LD_*`/`DYLD_*` are loader-hijack vectors — none
294
+ * belong in a lane profile (PORT / TMPDIR / cache redirects).
290
295
  * - Returns an empty record when the file does not exist.
291
296
  *
292
297
  * Exposed via _internals for testability (no mock.module leakage).