opencode-swarm 7.104.0 → 7.106.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 (46) hide show
  1. package/.opencode/skills/commit-pr/SKILL.md +15 -7
  2. package/.opencode/skills/swarm-pr-feedback/SKILL.md +7 -0
  3. package/.opencode/skills/swarm-pr-review/SKILL.md +6 -0
  4. package/.opencode/skills/swarm-pr-subscribe/SKILL.md +176 -0
  5. package/dist/background/pr-event-delivery.d.ts +107 -0
  6. package/dist/background/pr-event-subscribers.d.ts +36 -7
  7. package/dist/cli/{config-doctor-5m8z8jeg.js → config-doctor-cntnpyvj.js} +2 -2
  8. package/dist/cli/{guardrail-explain-2zat1bxh.js → guardrail-explain-fvjc90wa.js} +5 -5
  9. package/dist/cli/{guardrail-log-zhshjbpk.js → guardrail-log-fsc85hwa.js} +3 -3
  10. package/dist/cli/{index-t1vfvtg9.js → index-2560cctg.js} +34 -1
  11. package/dist/cli/{index-fk8ta8zw.js → index-7dtekwvd.js} +2 -2
  12. package/dist/cli/{index-5tywmqeh.js → index-esg1554h.js} +1 -1
  13. package/dist/cli/{index-n3ys2eny.js → index-f4yjypa4.js} +21113 -20999
  14. package/dist/cli/{index-kcbcy6wq.js → index-fxtrk7y8.js} +1 -1
  15. package/dist/cli/{index-0derejrq.js → index-w8dzxnx4.js} +1 -1
  16. package/dist/cli/{index-e7nhwa9k.js → index-z4t3w4xf.js} +6 -6
  17. package/dist/cli/index.js +4 -4
  18. package/dist/cli/{schema-yxkdx5g5.js → schema-vw2ffhe9.js} +1 -1
  19. package/dist/commands/close.d.ts +2 -0
  20. package/dist/commands/pr-subscribe.d.ts +5 -3
  21. package/dist/commands/registry.d.ts +4 -4
  22. package/dist/config/bundled-skills.d.ts +1 -1
  23. package/dist/config/schema.d.ts +46 -0
  24. package/dist/hooks/pr-auto-subscribe.d.ts +51 -0
  25. package/dist/index.js +547 -506
  26. package/dist/memory/config.d.ts +48 -0
  27. package/dist/memory/finalize-reward-sweep.d.ts +132 -0
  28. package/dist/memory/gateway.d.ts +0 -1
  29. package/dist/memory/index.d.ts +1 -2
  30. package/dist/memory/injector.d.ts +11 -0
  31. package/dist/memory/local-jsonl-provider.d.ts +3 -1
  32. package/dist/memory/maintenance.d.ts +16 -4
  33. package/dist/memory/provider.d.ts +42 -47
  34. package/dist/memory/q-learning.d.ts +62 -0
  35. package/dist/memory/reward-capture.d.ts +119 -0
  36. package/dist/memory/schema.d.ts +9 -9
  37. package/dist/memory/scoring.d.ts +60 -5
  38. package/dist/memory/sqlite-provider.d.ts +5 -53
  39. package/dist/memory/types.d.ts +25 -5
  40. package/dist/state.d.ts +9 -2
  41. package/dist/tools/convene-council.d.ts +0 -2
  42. package/dist/tools/submit-phase-council-verdicts.d.ts +0 -1
  43. package/dist/tools/swarm-memory-recall.d.ts +2 -0
  44. package/dist/tools/write-final-council-evidence.d.ts +2 -2
  45. package/package.json +2 -1
  46. package/dist/memory/reward.d.ts +0 -39
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  stripKnownSwarmPrefix
4
- } from "./index-t1vfvtg9.js";
4
+ } from "./index-2560cctg.js";
5
5
  import {
6
6
  init_logger,
7
7
  warn
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  redactPath,
4
4
  redactShellCommand
5
- } from "./index-kcbcy6wq.js";
5
+ } from "./index-fxtrk7y8.js";
6
6
 
7
7
  // src/services/guardrail-log-service.ts
8
8
  import * as fs from "fs/promises";
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-fk8ta8zw.js";
4
+ } from "./index-7dtekwvd.js";
5
5
  import {
6
6
  handleGuardrailLog
7
- } from "./index-0derejrq.js";
7
+ } from "./index-w8dzxnx4.js";
8
8
  import {
9
9
  COMMAND_REGISTRY,
10
10
  SWARM_COMMAND_TOOL_ALLOWLIST,
@@ -80,17 +80,17 @@ import {
80
80
  handleWriteRetroCommand,
81
81
  normalizeSwarmCommandInput,
82
82
  resolveCommand
83
- } from "./index-n3ys2eny.js";
84
- import"./index-kcbcy6wq.js";
83
+ } from "./index-f4yjypa4.js";
84
+ import"./index-fxtrk7y8.js";
85
85
  import"./index-ydgy7vg5.js";
86
86
  import"./index-vwyjkzgs.js";
87
87
  import"./index-f7nma02k.js";
88
- import"./index-5tywmqeh.js";
88
+ import"./index-esg1554h.js";
89
89
  import {
90
90
  AGENT_TOOL_MAP,
91
91
  ORCHESTRATOR_NAME,
92
92
  stripKnownSwarmPrefix
93
- } from "./index-t1vfvtg9.js";
93
+ } from "./index-2560cctg.js";
94
94
  import"./index-k2rmw9sz.js";
95
95
  import"./index-8w4d325g.js";
96
96
  import"./index-v4fcn4tr.js";
package/dist/cli/index.js CHANGED
@@ -7,15 +7,15 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-n3ys2eny.js";
11
- import"./index-kcbcy6wq.js";
10
+ } from "./index-f4yjypa4.js";
11
+ import"./index-fxtrk7y8.js";
12
12
  import"./index-ydgy7vg5.js";
13
13
  import"./index-vwyjkzgs.js";
14
14
  import"./index-f7nma02k.js";
15
- import"./index-5tywmqeh.js";
15
+ import"./index-esg1554h.js";
16
16
  import {
17
17
  DEFAULT_AGENT_CONFIGS
18
- } from "./index-t1vfvtg9.js";
18
+ } from "./index-2560cctg.js";
19
19
  import"./index-k2rmw9sz.js";
20
20
  import"./index-8w4d325g.js";
21
21
  import"./index-v4fcn4tr.js";
@@ -85,7 +85,7 @@ import {
85
85
  resolveGeneratedAgentRole,
86
86
  resolveGuardrailsConfig,
87
87
  stripKnownSwarmPrefix
88
- } from "./index-t1vfvtg9.js";
88
+ } from "./index-2560cctg.js";
89
89
  import"./index-p0arc26j.js";
90
90
  import"./index-293f68mj.js";
91
91
  import"./index-a76rekgs.js";
@@ -6,6 +6,7 @@ import { createCuratorLLMDelegate } from '../hooks/curator-llm-factory';
6
6
  import { runCuratorPostMortem } from '../hooks/curator-postmortem';
7
7
  import { checkHivePromotions } from '../hooks/hive-promoter';
8
8
  import { curateAndStoreSwarm } from '../hooks/knowledge-curator';
9
+ import { runFinalizeRewardSweep } from '../memory/finalize-reward-sweep';
9
10
  import { closePlanTerminalState } from '../plan/manager';
10
11
  import { type SessionReflectionResult } from '../services/session-reflection';
11
12
  import { endAgentSession, resetSwarmStatePreservingSingletons } from '../state';
@@ -190,6 +191,7 @@ export declare const _internals: {
190
191
  createCuratorLLMDelegate: typeof createCuratorLLMDelegate;
191
192
  resetSwarmStatePreservingSingletons: typeof resetSwarmStatePreservingSingletons;
192
193
  runFinalizeStage: typeof runFinalizeStage;
194
+ runFinalizeRewardSweep: typeof runFinalizeRewardSweep;
193
195
  acquireFinalizeLock: typeof acquireFinalizeLock;
194
196
  runArchiveStage: typeof runArchiveStage;
195
197
  runArchiveEvidenceRetention: typeof runArchiveEvidenceRetention;
@@ -3,9 +3,11 @@
3
3
  *
4
4
  * Subscribes the current session to PR state-change notifications. When
5
5
  * `pr_monitor.enabled` is true, the background polling worker will detect CI
6
- * failures, new comments, merge conflicts, review state changes, and
7
- * merge/close events. Notifications are delivered as session-scoped advisories
8
- * with dedup tokens.
6
+ * failures, new comments, merge conflicts (and resolutions), review state
7
+ * changes, and merge/close events each gated by its `notify_*` config flag.
8
+ * Events are delivered per `pr_monitor.event_delivery`: 'prompt' (default)
9
+ * wakes the subscribed session with a structured <pr-activity> message;
10
+ * 'advisory' queues session-scoped advisories with dedup tokens.
9
11
  *
10
12
  * Input contract (PR reference is required):
11
13
  * /swarm pr subscribe 155 → subscribe via bare number
@@ -502,9 +502,9 @@ export declare const COMMAND_REGISTRY: {
502
502
  readonly handler: (ctx: CommandContext) => Promise<string>;
503
503
  readonly description: "Subscribe the current session to PR state-change notifications";
504
504
  readonly args: "<pr-url|owner/repo#N|N>";
505
- readonly details: "Subscribes the current session to receive advisory notifications for the specified PR. When pr_monitor.enabled is true, the background polling worker will detect CI failures, new comments, merge conflicts, review state changes, and merge/close events. Notifications are delivered as session-scoped advisories with dedup tokens. Supports full GitHub URL, owner/repo#N shorthand, or bare PR number (resolved against origin). Requires pr_monitor.enabled: true in config.";
505
+ readonly details: "Subscribes the current session to PR state-change events for the specified PR. When pr_monitor.enabled is true, the background polling worker detects CI failures, new comments, review state changes (changes requested / approved), merge conflicts and conflict resolutions, and merge/close events — each gated by its pr_monitor notify_* config flag (notify_ci_success defaults to false). Delivery follows pr_monitor.event_delivery: \"prompt\" (default) wakes the subscribed session with a structured <pr-activity> message; \"advisory\" queues session-scoped advisories with dedup tokens for the next turn. Subscriptions are idempotent, capped by pr_monitor.max_subscriptions, and agent-callable. Supports full GitHub URL, owner/repo#N shorthand, or bare PR number (resolved against origin). Requires pr_monitor.enabled: true in config.";
506
506
  readonly category: "agent";
507
- readonly toolPolicy: "human-only";
507
+ readonly toolPolicy: "agent";
508
508
  };
509
509
  readonly 'pr-subscribe': {
510
510
  readonly handler: (ctx: CommandContext) => Promise<string>;
@@ -516,9 +516,9 @@ export declare const COMMAND_REGISTRY: {
516
516
  readonly handler: (ctx: CommandContext) => Promise<string>;
517
517
  readonly description: "Unsubscribe the current session from PR state-change notifications";
518
518
  readonly args: "<pr-url|owner/repo#N|N>";
519
- readonly details: "Unsubscribes the current session from receiving advisory notifications for the specified PR. Removes the active subscription record. Supports full GitHub URL, owner/repo#N shorthand, or bare PR number (resolved against origin).";
519
+ readonly details: "Unsubscribes the current session from PR state-change events for the specified PR. Removes the active subscription record (idempotent; agent-callable). Supports full GitHub URL, owner/repo#N shorthand, or bare PR number (resolved against origin).";
520
520
  readonly category: "agent";
521
- readonly toolPolicy: "human-only";
521
+ readonly toolPolicy: "agent";
522
522
  };
523
523
  readonly 'pr-unsubscribe': {
524
524
  readonly handler: (ctx: CommandContext) => Promise<string>;
@@ -1,4 +1,4 @@
1
- export declare const BUNDLED_PROJECT_SKILLS: readonly ["brainstorm", "specify", "clarify-spec", "resume", "clarify", "discover", "consult", "pre-phase-briefing", "council", "deep-dive", "deep-research", "codebase-review-swarm", "design-docs", "swarm-pr-review", "swarm-pr-feedback", "issue-ingest", "plan", "critic-gate", "execute", "phase-wrap", "loop", "writing-tests", "running-tests", "engineering-conventions", "commit-pr"];
1
+ export declare const BUNDLED_PROJECT_SKILLS: readonly ["brainstorm", "specify", "clarify-spec", "resume", "clarify", "discover", "consult", "pre-phase-briefing", "council", "deep-dive", "deep-research", "codebase-review-swarm", "design-docs", "swarm-pr-review", "swarm-pr-feedback", "swarm-pr-subscribe", "issue-ingest", "plan", "critic-gate", "execute", "phase-wrap", "loop", "writing-tests", "running-tests", "engineering-conventions", "commit-pr"];
2
2
  interface CopyState {
3
3
  files: number;
4
4
  bytes: number;
@@ -676,6 +676,20 @@ export declare const MemoryConfigSchema: z.ZodObject<{
676
676
  threshold: z.ZodDefault<z.ZodNumber>;
677
677
  }, z.core.$strip>>;
678
678
  }, z.core.$strip>>;
679
+ qLearning: z.ZodDefault<z.ZodObject<{
680
+ learningRate: z.ZodDefault<z.ZodNumber>;
681
+ qValueBoostWeight: z.ZodDefault<z.ZodNumber>;
682
+ suppressionThreshold: z.ZodDefault<z.ZodNumber>;
683
+ promotionThreshold: z.ZodDefault<z.ZodNumber>;
684
+ promotionMinRetrievals: z.ZodDefault<z.ZodNumber>;
685
+ propagationFraction: z.ZodDefault<z.ZodNumber>;
686
+ propagationFanoutCap: z.ZodDefault<z.ZodNumber>;
687
+ propagationWindowDays: z.ZodDefault<z.ZodNumber>;
688
+ propagationRelatednessThreshold: z.ZodDefault<z.ZodNumber>;
689
+ explorationRate: z.ZodDefault<z.ZodNumber>;
690
+ verdictPayloadCapBytes: z.ZodDefault<z.ZodNumber>;
691
+ initialQValue: z.ZodDefault<z.ZodNumber>;
692
+ }, z.core.$strip>>;
679
693
  consolidation: z.ZodDefault<z.ZodObject<{
680
694
  enabled: z.ZodDefault<z.ZodBoolean>;
681
695
  maxClustersPerPass: z.ZodDefault<z.ZodNumber>;
@@ -1001,7 +1015,16 @@ export declare const PrMonitorConfigSchema: z.ZodObject<{
1001
1015
  notify_ci_failure: z.ZodDefault<z.ZodBoolean>;
1002
1016
  notify_new_comments: z.ZodDefault<z.ZodBoolean>;
1003
1017
  notify_merge_conflict: z.ZodDefault<z.ZodBoolean>;
1018
+ notify_review_activity: z.ZodDefault<z.ZodBoolean>;
1019
+ notify_merged: z.ZodDefault<z.ZodBoolean>;
1020
+ notify_closed: z.ZodDefault<z.ZodBoolean>;
1021
+ notify_ci_success: z.ZodDefault<z.ZodBoolean>;
1004
1022
  auto_pr_feedback: z.ZodDefault<z.ZodBoolean>;
1023
+ event_delivery: z.ZodDefault<z.ZodEnum<{
1024
+ advisory: "advisory";
1025
+ prompt: "prompt";
1026
+ }>>;
1027
+ auto_subscribe_on_pr_create: z.ZodDefault<z.ZodBoolean>;
1005
1028
  }, z.core.$strict>;
1006
1029
  export type PrMonitorConfig = z.infer<typeof PrMonitorConfigSchema>;
1007
1030
  export declare const ParallelizationConfigSchema: z.ZodObject<{
@@ -1872,6 +1895,20 @@ export declare const PluginConfigSchema: z.ZodObject<{
1872
1895
  threshold: z.ZodDefault<z.ZodNumber>;
1873
1896
  }, z.core.$strip>>;
1874
1897
  }, z.core.$strip>>;
1898
+ qLearning: z.ZodDefault<z.ZodObject<{
1899
+ learningRate: z.ZodDefault<z.ZodNumber>;
1900
+ qValueBoostWeight: z.ZodDefault<z.ZodNumber>;
1901
+ suppressionThreshold: z.ZodDefault<z.ZodNumber>;
1902
+ promotionThreshold: z.ZodDefault<z.ZodNumber>;
1903
+ promotionMinRetrievals: z.ZodDefault<z.ZodNumber>;
1904
+ propagationFraction: z.ZodDefault<z.ZodNumber>;
1905
+ propagationFanoutCap: z.ZodDefault<z.ZodNumber>;
1906
+ propagationWindowDays: z.ZodDefault<z.ZodNumber>;
1907
+ propagationRelatednessThreshold: z.ZodDefault<z.ZodNumber>;
1908
+ explorationRate: z.ZodDefault<z.ZodNumber>;
1909
+ verdictPayloadCapBytes: z.ZodDefault<z.ZodNumber>;
1910
+ initialQValue: z.ZodDefault<z.ZodNumber>;
1911
+ }, z.core.$strip>>;
1875
1912
  consolidation: z.ZodDefault<z.ZodObject<{
1876
1913
  enabled: z.ZodDefault<z.ZodBoolean>;
1877
1914
  maxClustersPerPass: z.ZodDefault<z.ZodNumber>;
@@ -2257,7 +2294,16 @@ export declare const PluginConfigSchema: z.ZodObject<{
2257
2294
  notify_ci_failure: z.ZodDefault<z.ZodBoolean>;
2258
2295
  notify_new_comments: z.ZodDefault<z.ZodBoolean>;
2259
2296
  notify_merge_conflict: z.ZodDefault<z.ZodBoolean>;
2297
+ notify_review_activity: z.ZodDefault<z.ZodBoolean>;
2298
+ notify_merged: z.ZodDefault<z.ZodBoolean>;
2299
+ notify_closed: z.ZodDefault<z.ZodBoolean>;
2300
+ notify_ci_success: z.ZodDefault<z.ZodBoolean>;
2260
2301
  auto_pr_feedback: z.ZodDefault<z.ZodBoolean>;
2302
+ event_delivery: z.ZodDefault<z.ZodEnum<{
2303
+ advisory: "advisory";
2304
+ prompt: "prompt";
2305
+ }>>;
2306
+ auto_subscribe_on_pr_create: z.ZodDefault<z.ZodBoolean>;
2261
2307
  }, z.core.$strict>>;
2262
2308
  external_skills: z.ZodOptional<z.ZodObject<{
2263
2309
  curation_enabled: z.ZodDefault<z.ZodBoolean>;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * PR auto-subscribe hook (tool.execute.after).
3
+ *
4
+ * When `pr_monitor.enabled` and `pr_monitor.auto_subscribe_on_pr_create`
5
+ * are set, a successful `gh pr create` run through the bash tool
6
+ * automatically subscribes the current session to the created PR — closing
7
+ * the commit-pr → swarm-pr-review → swarm-pr-feedback → swarm-pr-subscribe
8
+ * lifecycle without a manual `/swarm pr subscribe` step.
9
+ *
10
+ * Detection: the bash command must contain `gh pr create` and the tool
11
+ * output must contain a GitHub PR URL. Only the first URL in a bounded
12
+ * slice of the output is used. The subscribe call is idempotent (keyed by
13
+ * session::repo::number) and lazy-starts the PR monitor worker via the
14
+ * store's onSubscriptionCreated callback.
15
+ *
16
+ * Fail-open: never throws, never blocks the hook chain, no subprocesses.
17
+ */
18
+ import { subscribe } from '../background/pr-subscriptions.js';
19
+ import type { PrMonitorConfig } from '../config/schema.js';
20
+ import { log } from '../utils';
21
+ export interface PrAutoSubscribeHook {
22
+ toolAfter: (input: {
23
+ tool: string;
24
+ sessionID?: string;
25
+ args?: unknown;
26
+ }, output: {
27
+ output?: unknown;
28
+ args?: unknown;
29
+ }) => Promise<void>;
30
+ }
31
+ /** DI seam for testability. */
32
+ export declare const _internals: {
33
+ subscribe: typeof subscribe;
34
+ log: typeof log;
35
+ };
36
+ /**
37
+ * Extract `{ repoFullName, prNumber, prUrl }` from the first GitHub PR URL
38
+ * in the given text, or null when none is present. The returned prUrl is
39
+ * re-canonicalized from the captures so it always satisfies the
40
+ * subscription store's strict URL schema.
41
+ */
42
+ export declare function extractPrUrl(text: string): {
43
+ repoFullName: string;
44
+ prNumber: number;
45
+ prUrl: string;
46
+ } | null;
47
+ /**
48
+ * Create the auto-subscribe hook. Cheap to construct (no I/O); all gating
49
+ * happens inside toolAfter.
50
+ */
51
+ export declare function createPrAutoSubscribeHook(directory: string, config: PrMonitorConfig): PrAutoSubscribeHook;