opencode-swarm 7.132.0 → 7.132.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 (46) hide show
  1. package/.opencode/skills/swarm-pr-feedback/SKILL.md +8 -0
  2. package/.opencode/skills/swarm-pr-review/SKILL.md +17 -5
  3. package/README.md +11 -2
  4. package/dist/cli/{config-doctor-3rssa871.js → config-doctor-bp5spb79.js} +2 -2
  5. package/dist/cli/{curation-policy-3914h3g9.js → curation-policy-7zp2m9gv.js} +2 -2
  6. package/dist/cli/{curator-1e77dq6x.js → curator-h067mrcc.js} +12 -12
  7. package/dist/cli/{curator-llm-factory-41c17ybs.js → curator-llm-factory-605d08hf.js} +12 -12
  8. package/dist/cli/{guardrail-explain-624brj1y.js → guardrail-explain-s7vzm6z7.js} +13 -13
  9. package/dist/cli/{guardrail-log-vfka4tcn.js → guardrail-log-aa112fxv.js} +3 -3
  10. package/dist/cli/{hive-promoter-mw5prfy2.js → hive-promoter-nv0m5rzk.js} +12 -12
  11. package/dist/cli/{index-6mcx76j9.js → index-3s9rfnqq.js} +4 -4
  12. package/dist/cli/{index-q0ysv66x.js → index-630badhp.js} +1 -1
  13. package/dist/cli/{index-zah4qws8.js → index-6ccynjv3.js} +2 -2
  14. package/dist/cli/{index-qg1cj1ev.js → index-8d3m0ge3.js} +14 -14
  15. package/dist/cli/{index-e630fw43.js → index-9cf1yr67.js} +3 -3
  16. package/dist/cli/{index-5x3g1q91.js → index-bvp2v7k1.js} +18 -4
  17. package/dist/cli/{index-sbq3gbjs.js → index-djwemsjn.js} +1 -1
  18. package/dist/cli/{index-8w3sp149.js → index-f6480ee6.js} +48 -39
  19. package/dist/cli/{index-64z5dvam.js → index-fgcmxjp7.js} +1 -1
  20. package/dist/cli/{index-nsxchdx0.js → index-jgfcp9bh.js} +1 -1
  21. package/dist/cli/{index-exs5bt14.js → index-jj4earrh.js} +1 -1
  22. package/dist/cli/{index-99tq1zd5.js → index-k4tmx21m.js} +2 -2
  23. package/dist/cli/{index-ppkp20fp.js → index-mwkwyej1.js} +5 -5
  24. package/dist/cli/{index-2dtwjx39.js → index-rt5jgktq.js} +1 -1
  25. package/dist/cli/{index-zrh07ykv.js → index-y5qp59rc.js} +2 -2
  26. package/dist/cli/{index-fegng5pv.js → index-yvv1wt2h.js} +1 -1
  27. package/dist/cli/index.js +12 -12
  28. package/dist/cli/{knowledge-escalator-5hv2dwhz.js → knowledge-escalator-j0nceas7.js} +3 -3
  29. package/dist/cli/{knowledge-events-434663dp.js → knowledge-events-gpqc62jr.js} +1 -1
  30. package/dist/cli/{knowledge-store-73ykq5j3.js → knowledge-store-ggxr3ww5.js} +1 -1
  31. package/dist/cli/{knowledge-validator-tnadtt1h.js → knowledge-validator-007smap6.js} +4 -4
  32. package/dist/cli/{scan-cursor-e33n9pej.js → scan-cursor-wz4bff7a.js} +2 -2
  33. package/dist/cli/{schema-1kwmcayk.js → schema-023gwne7.js} +1 -1
  34. package/dist/cli/{skill-generator-k111qfdw.js → skill-generator-rtsg1m7x.js} +5 -5
  35. package/dist/config/constants.d.ts +22 -0
  36. package/dist/hooks/guardrails/index.d.ts +32 -0
  37. package/dist/hooks/guardrails/messages-transform.d.ts +7 -0
  38. package/dist/hooks/guardrails.d.ts +1 -1
  39. package/dist/hooks/pr-workflow-gate.d.ts +2 -0
  40. package/dist/hooks/pr-workflow-response-gate.d.ts +44 -26
  41. package/dist/index.d.ts +13 -0
  42. package/dist/index.js +30 -30
  43. package/dist/tools/dispatch-lanes.d.ts +18 -0
  44. package/dist/tools/run-pr-feedback-stage-a.d.ts +2 -0
  45. package/dist/tools/tool-metadata.d.ts +4 -0
  46. package/package.json +1 -1
@@ -19,6 +19,13 @@ export declare const _internals: {
19
19
  resolveFallbackModel: typeof resolveFallbackModel;
20
20
  dcCheckJunctionCreation: typeof dcCheckJunctionCreation;
21
21
  extractErrorSignal: typeof extractErrorSignal;
22
+ /**
23
+ * Test/inspection seams for the no-op detector's bounded session state
24
+ * (invariant 8). Production code does not call these; they exist so the
25
+ * eviction bound can be asserted without exporting the maps themselves.
26
+ */
27
+ noOpStateSize: () => number;
28
+ hasNoOpState: (sessionID: string) => boolean;
22
29
  };
23
30
  /**
24
31
  * Issue #853 Layer B: tools that are structurally blocked while
@@ -36,6 +43,31 @@ export declare function enforceSpecDriftGate(directory: string | undefined, tool
36
43
  * Extracts bounded provider/error signal from unknown hook error payloads.
37
44
  */
38
45
  declare function extractErrorSignal(errorContent: unknown): string;
46
+ /**
47
+ * v6.33.1: No-op work detector state.
48
+ *
49
+ * AGENTS.md invariant 8: module-level, session-keyed state must have an explicit
50
+ * eviction strategy. Both containers below are keyed by `sessionID` and were
51
+ * previously unbounded — they grew for the lifetime of the plugin process, since
52
+ * nothing removed a key when a session ended. `noOpWarningIssued` was only ever
53
+ * `delete`d on a reset, and `toolCallsSinceLastWrite` never shrank at all.
54
+ *
55
+ * Bounded LRU, evicting the LEAST-RECENTLY-TOUCHED session.
56
+ *
57
+ * Plain insertion-order (FIFO) eviction is wrong here and actively harmful.
58
+ * `Map.set()` on an EXISTING key does not move it, so the first session created
59
+ * in the process stays permanently at the front of the iteration order. In an
60
+ * OpenCode plugin process that first session is the architect — the very session
61
+ * this detector exists to watch — making it the guaranteed first eviction victim
62
+ * while a session touched once and abandoned later survives. Measured: with a
63
+ * FIFO bound, an architect climbing toward the threshold had its counter evicted
64
+ * and reset mid-climb, and its 15th consecutive no-write call produced ZERO
65
+ * warnings. A bound must not silence the detector it was added to protect.
66
+ *
67
+ * {@link touchNoOpSession} therefore deletes before setting, moving the key to
68
+ * the back on every touch, so eviction genuinely targets quiet sessions.
69
+ */
70
+ export declare const MAX_TRACKED_NO_OP_SESSIONS = 200;
39
71
  /**
40
72
  * Redacts sensitive values from a shell command string before audit logging.
41
73
  * Single-sourced from ./helpers (which additionally redacts home paths).
@@ -32,6 +32,13 @@ type ChatMessageLike = {
32
32
  text?: unknown;
33
33
  }>;
34
34
  };
35
+ /**
36
+ * Shared by the runaway-output advisory's TEXT and its once-per-drain dedupe
37
+ * predicate, so the two can never drift apart again. They previously did: the
38
+ * predicate tested for the string 'runaway output', which the pushed message
39
+ * never contained, making the guard permanently inert.
40
+ */
41
+ export declare const RUNAWAY_OUTPUT_ADVISORY_MARKER = "Model is generating analysis without taking action";
35
42
  export declare function getMostRecentAssistantText(messages: ChatMessageLike[]): string;
36
43
  export declare function isTransientProviderFailureText(text: string): boolean;
37
44
  export declare function getProviderFailureFingerprint(text: string): string;
@@ -10,5 +10,5 @@
10
10
  * - Layer 2 (Hard Block @ 100%): Throws error in toolBefore to block further calls, injects STOP message
11
11
  */
12
12
  export { type AgentRule, type AttestationRecord, buildEffectiveRules, checkFileAuthority, checkFileAuthorityWithRules, checkWriteTargetForSymlink, clearGuardrailsCaches, DEFAULT_AGENT_AUTHORITY_RULES, getGlobMatcher, hashArgs, isOnDifferentFilesystemRoot, normalizePathWithCache, recordAttestation, validateAndRecordAttestation, validateAttestation, } from './guardrails/file-authority';
13
- export { _internals, createGuardrailsHooks, enforceSpecDriftGate, redactShellCommand, SPEC_DRIFT_BLOCKED_TOOLS, } from './guardrails/index';
13
+ export { _internals, createGuardrailsHooks, enforceSpecDriftGate, MAX_TRACKED_NO_OP_SESSIONS, redactShellCommand, SPEC_DRIFT_BLOCKED_TOOLS, } from './guardrails/index';
14
14
  export { deleteStoredInputArgs, getStoredInputArgs, setStoredInputArgs, } from './guardrails/stored-input-args';
@@ -354,6 +354,7 @@ export declare const _test_exports: {
354
354
  resolveRemoteRefsContainingHeadAsync: typeof resolveRemoteRefsContainingHeadAsync;
355
355
  parseCriticVerdict: typeof parseCriticVerdict;
356
356
  isProcessAlive: typeof isProcessAlive;
357
+ isSafeStandaloneGitCommit: typeof isSafeStandaloneGitCommit;
357
358
  rename: typeof fsp.rename;
358
359
  nowMs: () => number;
359
360
  };
@@ -366,6 +367,7 @@ export declare function normalizePrWorkflowShellCommand(command: string): {
366
367
  normalized: string;
367
368
  strippedCdPrefix: boolean;
368
369
  };
370
+ declare function isSafeStandaloneGitCommit(command: string): boolean;
369
371
  /** Require at least one real discovery row or a lane-bound CLEAN attestation. */
370
372
  export declare function prReviewDiscoveryArtifactCoversLane(text: string, expectedWorkflowLane: string): boolean;
371
373
  declare function parseCriticVerdict(text: string, itemId: string, reviewerSeverity?: string): {
@@ -26,26 +26,38 @@ export declare const DEFAULT_MAX_CONSECUTIVE_UNPRODUCTIVE_WAKES = 5;
26
26
  */
27
27
  export declare const DEFAULT_WAKE_COOLDOWN_MS = 30000;
28
28
  /**
29
- * Minimum time between FULL workflow banners prepended to a single session's
30
- * completed text parts. The textComplete hook prepends a banner to every
31
- * architect text part while the durable gate exists; without a cooldown a
32
- * burst of reasoning parts repeats the full multi-line banner many times
33
- * (field report: ~8 repeats between two model thoughts). Within the cooldown a
34
- * short one-line marker is prepended instead; the full banner (and its
35
- * suspension/interruption recovery notices) returns once the cooldown elapses.
29
+ * Minimum time between FULL workflow banners for a single session. The banner
30
+ * is injected at most once per assistant MESSAGE (see the `banneredMessages`
31
+ * map in {@link createPrWorkflowResponseGate}); this cooldown only chooses
32
+ * whether that one injection is the full multi-line banner or the short
33
+ * one-line marker.
36
34
  *
37
- * The input event exposes only `{ sessionID }` — there is NO message/part ID —
38
- * so this dedupe is necessarily a per-session cooldown, not a per-message one.
39
- *
40
- * Suspended and user-interrupted states BYPASS the cooldown entirely: those are
41
- * invariant-10 operational notices that must appear in full on every part.
35
+ * Suspended and user-interrupted states BYPASS the cooldown: those are
36
+ * invariant-10 operational notices that must not be downgraded to the short
37
+ * marker. They are still subject to the per-message dedupe — "always visible"
38
+ * means visible on every user-facing turn, not repeated on every part of it.
42
39
  * Overridable via `createPrWorkflowResponseGate({ bannerCooldownMs })`.
43
40
  */
44
41
  export declare const DEFAULT_BANNER_COOLDOWN_MS = 20000;
42
+ /**
43
+ * Absolute per-session injection ceiling used ONLY when the host does not
44
+ * supply `messageID`. The pinned host contract
45
+ * (`@opencode-ai/plugin` `index.d.ts`: `experimental.text.complete` receives
46
+ * `{ sessionID, messageID, partID }`, all required) always supplies it, so this
47
+ * path is defensive. Without a ceiling, a host that omitted `messageID` would
48
+ * fall back to the wall-clock window alone — which is exactly the behavior that
49
+ * produced the measured flood (968 marker-only lines, 55.3% of a real review
50
+ * transcript), because a cooldown only downgrades an injection, it never
51
+ * suppresses one.
52
+ */
53
+ export declare const MAX_FALLBACK_BANNER_INJECTIONS_PER_SESSION = 20;
45
54
  /**
46
55
  * Bounded FIFO map of tracked wake budgets. Invariant 8 (session/global
47
- * state): module-level state must have an explicit eviction strategy. The
48
- * banner-stamp map (last full-banner instant per session) shares this bound.
56
+ * state): module-level state must have an explicit eviction strategy. Three
57
+ * further per-session maps share this same bound and the same FIFO discipline:
58
+ * `bannerStamps` (instant of the last full banner), `banneredMessages` (the
59
+ * assistant message already carrying a banner), and `fallbackInjections` (the
60
+ * injection count on the messageID-less path).
49
61
  */
50
62
  export declare const MAX_TRACKED_WAKE_SESSIONS = 200;
51
63
  interface PrWorkflowResponseGateClient {
@@ -59,19 +71,23 @@ interface WakeBudget {
59
71
  }
60
72
  /**
61
73
  * Prevent an architect from masquerading a premature text output as a terminal
62
- * verdict. The text-complete hook prepends a workflow-active banner to
63
- * architect-session text parts while the durable gate exists; the model's
64
- * original text is preserved below the banner. To avoid spamming the full
65
- * multi-line banner across a burst of reasoning parts, the full banner is
66
- * throttled per session (see DEFAULT_BANNER_COOLDOWN_MS) within the cooldown a
67
- * short one-line marker is prepended instead. session.idle then mechanically
68
- * resumes that session.
74
+ * verdict. The text-complete hook prepends a workflow-active banner to the
75
+ * FIRST substantive text part of each architect message while the durable gate
76
+ * exists; the model's original text is preserved below the banner.
77
+ *
78
+ * Injection is bounded on three independent axes, because a banner that is
79
+ * merely throttled is still injected on every part:
80
+ * 1. blank parts are never decorated (a banner labelling no content is noise);
81
+ * 2. a part that already opens with a banner is never re-decorated;
82
+ * 3. at most ONE injection per assistant `messageID`.
83
+ * The wall-clock cooldown (see DEFAULT_BANNER_COOLDOWN_MS) then only chooses
84
+ * whether that single injection is the full banner or the short marker.
69
85
  *
70
- * The resume loop is bounded (see DEFAULT_MAX_CONSECUTIVE_UNPRODUCTIVE_WAKES)
71
- * so a session that cannot make progress suspends instead of spinning
72
- * forever. Suspended and user-interrupted parts bypass the cooldown and always
73
- * carry the full suspension/interruption recovery notices so the user-visible
74
- * surface always names the recovery path.
86
+ * session.idle mechanically resumes a gated session. The resume loop is bounded
87
+ * (see DEFAULT_MAX_CONSECUTIVE_UNPRODUCTIVE_WAKES) so a session that cannot make
88
+ * progress suspends instead of spinning forever. Suspended and user-interrupted
89
+ * messages bypass the cooldown so their recovery notices are never downgraded to
90
+ * the short marker.
75
91
  */
76
92
  export declare function createPrWorkflowResponseGate(options: {
77
93
  directory: string;
@@ -86,6 +102,8 @@ export declare function createPrWorkflowResponseGate(options: {
86
102
  }) => Promise<void>;
87
103
  textComplete: (input: {
88
104
  sessionID?: string;
105
+ messageID?: string;
106
+ partID?: string;
89
107
  }, output: {
90
108
  text: string;
91
109
  }) => Promise<void>;
package/dist/index.d.ts CHANGED
@@ -26,6 +26,19 @@ export declare function overrideIndexInternalsForTest(overrides: {
26
26
  ensureSwarmGitExcluded?: typeof ensureSwarmGitExcluded;
27
27
  }): () => void;
28
28
  export declare function schedulePostResolutionTasksForTest(tasks: readonly PostResolutionTask[]): void;
29
+ /**
30
+ * Compute the effective set of tools eligible for line-based truncation.
31
+ *
32
+ * SUMMARIZER_EXEMPT_TOOL_NAMES is applied as an unconditional floor
33
+ * subtraction against BOTH the default allowlist and any operator-configured
34
+ * `tool_output.truncation_tools` override (finding R6). Line-truncating a
35
+ * lane/retrieval tool's payload destroys the `output_ref` rows a caller needs
36
+ * to recover the full content — the same unrecoverable-payload defect class
37
+ * the summarizer/context-budget floor already guards against — so operator
38
+ * config must never be able to reintroduce it via this separate rewriting
39
+ * layer.
40
+ */
41
+ export declare function computeEffectiveTruncatableTools(defaultTools: ReadonlySet<string>, configuredTools: readonly string[] | undefined): Set<string>;
29
42
  declare const _default: {
30
43
  id: "opencode-swarm";
31
44
  server: Plugin;