opencode-swarm 7.136.2 → 7.136.4

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/brainstorm/SKILL.md +1 -1
  2. package/.opencode/skills/clarify/SKILL.md +3 -3
  3. package/.opencode/skills/clarify-spec/SKILL.md +2 -2
  4. package/.opencode/skills/consult/SKILL.md +1 -1
  5. package/.opencode/skills/council/SKILL.md +1 -1
  6. package/.opencode/skills/critic-gate/SKILL.md +8 -3
  7. package/.opencode/skills/discover/SKILL.md +1 -1
  8. package/.opencode/skills/execute/SKILL.md +1 -1
  9. package/.opencode/skills/gate-attribution/SKILL.md +1 -1
  10. package/.opencode/skills/issue-ingest/SKILL.md +3 -3
  11. package/.opencode/skills/phase-wrap/SKILL.md +1 -1
  12. package/.opencode/skills/plan/SKILL.md +3 -3
  13. package/.opencode/skills/pre-phase-briefing/SKILL.md +1 -1
  14. package/.opencode/skills/resume/SKILL.md +1 -1
  15. package/.opencode/skills/specify/SKILL.md +1 -1
  16. package/dist/cli/{config-doctor-b67nb84b.js → config-doctor-qwp5y9dk.js} +2 -2
  17. package/dist/cli/{core-4z1s2ak1.js → core-jpjk2qvt.js} +1 -1
  18. package/dist/cli/{curation-policy-kvzhfaj1.js → curation-policy-8tsbaa4q.js} +6 -6
  19. package/dist/cli/{curator-nrmj8bds.js → curator-763smew7.js} +25 -25
  20. package/dist/cli/{curator-llm-factory-x7kvry9x.js → curator-llm-factory-dg8mmzy7.js} +25 -25
  21. package/dist/cli/{evidence-summary-service-cf8sz2bq.js → evidence-summary-service-nse06dqr.js} +7 -7
  22. package/dist/cli/{gate-evidence-aenyz6vt.js → gate-evidence-kdygjr56.js} +4 -4
  23. package/dist/cli/{guardrail-explain-5kd44rcj.js → guardrail-explain-6jc012g3.js} +26 -26
  24. package/dist/cli/{guardrail-log-aksrzqdx.js → guardrail-log-86aw7fne.js} +3 -3
  25. package/dist/cli/{hive-promoter-cy21rhnd.js → hive-promoter-en786ja4.js} +25 -25
  26. package/dist/cli/{index-84nz7bhe.js → index-06htxvzq.js} +3 -3
  27. package/dist/cli/{index-s0vahtdm.js → index-1hef020t.js} +1 -1
  28. package/dist/cli/{index-kwwxevne.js → index-45y0y3xh.js} +5 -5
  29. package/dist/cli/{index-ad6j0m7k.js → index-4cv991ra.js} +3 -3
  30. package/dist/cli/{index-45t7w06b.js → index-7t3vjw5e.js} +1 -1
  31. package/dist/cli/{index-m5fw4mer.js → index-89fpahtg.js} +1 -1
  32. package/dist/cli/{index-rw3f73aq.js → index-94pvh7hc.js} +2 -2
  33. package/dist/cli/{index-ey29aap6.js → index-b3jfcptk.js} +1 -1
  34. package/dist/cli/{index-0755132s.js → index-bb3ks0v3.js} +6 -6
  35. package/dist/cli/{index-7a2hm51h.js → index-cze4bq1x.js} +41 -0
  36. package/dist/cli/{index-mrtms113.js → index-d2sf9an1.js} +2 -2
  37. package/dist/cli/{index-wxyxf0bd.js → index-d61h3f3h.js} +2 -2
  38. package/dist/cli/{index-ckybsn6p.js → index-et8b70c8.js} +27 -27
  39. package/dist/cli/{index-1kn24ja0.js → index-fhnbzz75.js} +2 -2
  40. package/dist/cli/{index-s0rbdp61.js → index-fkdxfdbx.js} +4 -4
  41. package/dist/cli/{index-37v2wxqe.js → index-g0sdhyqk.js} +1 -1
  42. package/dist/cli/{index-7ayaq27q.js → index-gjs5g97v.js} +1 -1
  43. package/dist/cli/{index-c9ddxv4k.js → index-hh34tyv7.js} +1 -1
  44. package/dist/cli/{index-tcn457d5.js → index-kym0cctr.js} +1 -1
  45. package/dist/cli/{index-z1tm47nj.js → index-ne28wyyc.js} +2 -2
  46. package/dist/cli/{index-wjm896ey.js → index-nfm9f10v.js} +1 -1
  47. package/dist/cli/{index-y0xaq4f3.js → index-pq8ge6fe.js} +8 -2
  48. package/dist/cli/{index-azghvnja.js → index-qv1xc6rd.js} +2 -2
  49. package/dist/cli/{index-wnz282j3.js → index-rkp6jvc3.js} +2 -2
  50. package/dist/cli/{index-sr2cynyw.js → index-t1s4b5ha.js} +108 -51
  51. package/dist/cli/{index-09b9zncg.js → index-tncy55bp.js} +1 -1
  52. package/dist/cli/{index-vg3yx648.js → index-w6j1n5az.js} +1 -1
  53. package/dist/cli/{index-21115szq.js → index-wy2f83j5.js} +5 -5
  54. package/dist/cli/{index-dzyjb33e.js → index-zzhyws9g.js} +1 -1
  55. package/dist/cli/index.js +25 -25
  56. package/dist/cli/{knowledge-escalator-ta3xjrdj.js → knowledge-escalator-e815bveb.js} +7 -7
  57. package/dist/cli/{knowledge-events-dk6banmz.js → knowledge-events-dz2tyhpw.js} +5 -5
  58. package/dist/cli/{knowledge-link-mm1w967j.js → knowledge-link-zr40rnwr.js} +4 -4
  59. package/dist/cli/{knowledge-store-h3jz10bv.js → knowledge-store-97qr7m9k.js} +5 -5
  60. package/dist/cli/{knowledge-validator-jsz1dxkr.js → knowledge-validator-xsetvy4v.js} +8 -8
  61. package/dist/cli/{pending-delegations-qajsxct0.js → pending-delegations-0h5b18p7.js} +3 -3
  62. package/dist/cli/{pr-subscriptions-qhr41epq.js → pr-subscriptions-jn0h047q.js} +3 -3
  63. package/dist/cli/{runner-2v413r74.js → runner-deeswadt.js} +5 -5
  64. package/dist/cli/{scan-cursor-48gwzh9c.js → scan-cursor-129fwf7e.js} +6 -6
  65. package/dist/cli/{schema-f937b9cs.js → schema-3xdza5gg.js} +1 -1
  66. package/dist/cli/{scope-persistence-h2fpgxww.js → scope-persistence-5xc9ntdh.js} +4 -4
  67. package/dist/cli/{skill-generator-4p10ktw1.js → skill-generator-8zhprasg.js} +9 -9
  68. package/dist/cli/{telemetry-859khp82.js → telemetry-6678gya0.js} +1 -1
  69. package/dist/cli/{worktree-collision-ownership-13btcj9g.js → worktree-collision-ownership-wt7cc850.js} +3 -3
  70. package/dist/config/schema.d.ts +10 -0
  71. package/dist/hooks/context-budget.d.ts +8 -0
  72. package/dist/hooks/delegation-gate.d.ts +12 -1
  73. package/dist/hooks/gate-denial-tracker.d.ts +175 -0
  74. package/dist/hooks/guardrails/execution-episode.d.ts +41 -0
  75. package/dist/hooks/guardrails/execution-stall.d.ts +285 -0
  76. package/dist/hooks/guardrails/internals-guard.d.ts +117 -0
  77. package/dist/hooks/guardrails/messages-transform.d.ts +85 -0
  78. package/dist/hooks/index.d.ts +1 -1
  79. package/dist/hooks/message-priority.d.ts +62 -4
  80. package/dist/hooks/trajectory-logger.d.ts +76 -0
  81. package/dist/index.js +477 -463
  82. package/dist/memory/schema.d.ts +3 -3
  83. package/dist/prm/index.d.ts +2 -0
  84. package/dist/state.d.ts +32 -0
  85. package/dist/telemetry.d.ts +66 -1
  86. package/dist/types/events.d.ts +14 -1
  87. package/package.json +2 -1
@@ -23,6 +23,13 @@ export interface TrajectoryEntry {
23
23
  args_summary: string;
24
24
  verdict: string;
25
25
  elapsed_ms: number;
26
+ /**
27
+ * Host tool-call id. Written only by {@link recordDeniedToolCall} (issue
28
+ * #2063 D1) so a `tool.execute.after` that unexpectedly fires for a call
29
+ * whose before-hook already threw can be recognised and skipped instead of
30
+ * double-recording the same call.
31
+ */
32
+ callID?: string;
26
33
  }
27
34
  /**
28
35
  * Truncates a trajectory file to the newest half when maxLines is exceeded.
@@ -32,6 +39,28 @@ export interface TrajectoryEntry {
32
39
  * @param maxLines - Maximum number of lines to retain
33
40
  */
34
41
  export declare function truncateTrajectoryFile(filePath: string, maxLines: number): Promise<void>;
42
+ /**
43
+ * Derives the action type from the tool name.
44
+ *
45
+ * Issue #2063 D2: the name is normalized via `normalizeToolNameLowerCase`
46
+ * first, so host-namespaced names (`opencode:bash`, `opencode.read`) bucket
47
+ * identically to their bare forms. Previously they all fell through to
48
+ * `tool_use`, which flattened the taxonomy PRM pattern detection reads. `grep`
49
+ * was likewise missing from the read bucket despite being one of the most
50
+ * frequent read-only calls.
51
+ *
52
+ * @param tool - Tool name (may carry a host namespace prefix)
53
+ * @returns Action type string
54
+ */
55
+ declare function deriveAction(tool: string): string;
56
+ /**
57
+ * Extracts the target from tool arguments.
58
+ *
59
+ * @param tool - Tool name
60
+ * @param args - Tool arguments object
61
+ * @returns Target string
62
+ */
63
+ declare function extractTarget(tool: string, args?: Record<string, unknown>): string;
35
64
  /**
36
65
  * Creates the trajectory logger hook pair.
37
66
  *
@@ -51,6 +80,41 @@ export declare function createTrajectoryLoggerHook(config: Partial<TrajectoryCon
51
80
  metadata: unknown;
52
81
  }) => Promise<void>;
53
82
  };
83
+ /**
84
+ * Records a tool call that a fail-closed `tool.execute.before` hook DENIED.
85
+ *
86
+ * Before this existed the trajectory only contained calls that ran, so a
87
+ * session that spent fifty turns re-issuing a dispatch the delegation gate kept
88
+ * rejecting looked, to PRM and to any post-hoc reader, like a session that made
89
+ * no tool calls at all — the exact loop shape #2063 is about was invisible in
90
+ * the record of it.
91
+ *
92
+ * Contract:
93
+ * - The step is minted with the SHARED `nextTrajectoryStep(sessionId)`. Any
94
+ * private counter would desynchronise the `prmTrajectoryStep` window and
95
+ * silently break PRM's step-range filtering.
96
+ * - `session.delegationActive` gates recording at all (the architect session
97
+ * is deliberately out of scope); the task-evidence copy additionally
98
+ * requires `session.currentTaskId`, so a subagent running without a task id
99
+ * still lands in the PRM store.
100
+ * - EVERY failure is swallowed. This runs inside the `catch` that is about to
101
+ * rethrow a policy denial; it must never change which error propagates.
102
+ *
103
+ * @param sessionID - Session whose chain denied the call
104
+ * @param input - The host `tool.execute.before` input (tool / callID / args)
105
+ * @param errorMessage - The ORIGINAL denial message, before any B1 decoration
106
+ * @param directory - Workspace root (evidence + PRM store live under `.swarm/`)
107
+ * @param options - `maxLines` mirrors the hook's `max_lines` config
108
+ */
109
+ export declare function recordDeniedToolCall(sessionID: string, input: {
110
+ tool: string;
111
+ callID?: string;
112
+ args?: Record<string, unknown>;
113
+ }, errorMessage: string, directory: string, options?: {
114
+ maxLines?: number;
115
+ }): Promise<void>;
116
+ /** Test helper: drop all denied-call dedupe markers. */
117
+ export declare function clearDeniedCallMarkers(): void;
54
118
  /**
55
119
  * Resets the step counter for a session. Called when a new session starts
56
120
  * or when trajectory tracking should restart from step 1.
@@ -73,3 +137,15 @@ export declare function clearTrajectoryStep(sessionId?: string): void;
73
137
  * @param startTime - Start timestamp in milliseconds
74
138
  */
75
139
  export declare function recordToolCallStart(sessionId: string, callID: string, startTime: number): void;
140
+ /**
141
+ * Tier-0 pure-function test seam (writing-tests skill). These helpers take no
142
+ * external dependencies, so testing them directly needs no mocks at all.
143
+ */
144
+ export declare const _test_exports: {
145
+ readonly deriveAction: typeof deriveAction;
146
+ readonly extractTarget: typeof extractTarget;
147
+ readonly MAX_DENIED_CALL_MARKERS: 500;
148
+ readonly DENIED_CALL_TTL_MS: number;
149
+ readonly deniedCallMarkerCount: () => number;
150
+ };
151
+ export {};