opencode-swarm 7.103.3 → 7.105.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 (45) 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-4rxjsg22.js → config-doctor-4dhkq5qe.js} +2 -2
  8. package/dist/cli/{guardrail-explain-7c857j83.js → guardrail-explain-9br76zh5.js} +5 -5
  9. package/dist/cli/{guardrail-log-vg0atkrx.js → guardrail-log-peftzya3.js} +3 -3
  10. package/dist/cli/{index-9zb70qfe.js → index-25bc7j87.js} +1 -1
  11. package/dist/cli/{index-m9keg83x.js → index-50qqqbrb.js} +1 -1
  12. package/dist/cli/{index-ga7et2xw.js → index-5qzchq7p.js} +28 -1
  13. package/dist/cli/{index-fhn62ce4.js → index-8mj10cds.js} +8 -6
  14. package/dist/cli/{index-h0h4qjmc.js → index-hxnnp4qj.js} +1 -1
  15. package/dist/cli/{index-ye6zt96v.js → index-qnapygnz.js} +670 -64
  16. package/dist/cli/{index-60prdx3j.js → index-wg8ars51.js} +2 -2
  17. package/dist/cli/index.js +4 -4
  18. package/dist/cli/{schema-az0hgfv0.js → schema-3a02876y.js} +1 -1
  19. package/dist/commands/index.d.ts +1 -1
  20. package/dist/commands/memory.d.ts +1 -0
  21. package/dist/commands/pr-subscribe.d.ts +5 -3
  22. package/dist/commands/registry.d.ts +12 -4
  23. package/dist/config/bundled-skills.d.ts +1 -1
  24. package/dist/config/schema.d.ts +40 -0
  25. package/dist/council/types.d.ts +9 -0
  26. package/dist/graph/import-extractor.d.ts +1 -1
  27. package/dist/hooks/pr-auto-subscribe.d.ts +51 -0
  28. package/dist/index.js +154 -106
  29. package/dist/lang/symbol-visibility.d.ts +2 -0
  30. package/dist/memory/config.d.ts +20 -0
  31. package/dist/memory/gateway.d.ts +1 -0
  32. package/dist/memory/index.d.ts +2 -1
  33. package/dist/memory/maintenance.d.ts +4 -1
  34. package/dist/memory/provider-pool.d.ts +23 -0
  35. package/dist/memory/provider.d.ts +53 -0
  36. package/dist/memory/reward.d.ts +39 -0
  37. package/dist/memory/schema.d.ts +2 -0
  38. package/dist/memory/scoring.d.ts +2 -0
  39. package/dist/memory/sqlite-provider.d.ts +53 -1
  40. package/dist/memory/types.d.ts +5 -0
  41. package/dist/tools/convene-council.d.ts +2 -0
  42. package/dist/tools/repo-graph/builder.d.ts +4 -2
  43. package/dist/tools/submit-phase-council-verdicts.d.ts +1 -0
  44. package/dist/tools/symbols.d.ts +2 -0
  45. package/package.json +2 -1
@@ -12,14 +12,14 @@ import {
12
12
  detectPosixWrites,
13
13
  detectWindowsWrites,
14
14
  resolveWriteTargets
15
- } from "./index-ye6zt96v.js";
15
+ } from "./index-qnapygnz.js";
16
16
  import {
17
17
  checkFileAuthority,
18
18
  classifyFile,
19
19
  isInDeclaredScope,
20
20
  redactPath,
21
21
  redactShellCommand
22
- } from "./index-m9keg83x.js";
22
+ } from "./index-50qqqbrb.js";
23
23
 
24
24
  // src/services/guardrail-explain-service.ts
25
25
  import path from "path";
package/dist/cli/index.js CHANGED
@@ -7,15 +7,15 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-ye6zt96v.js";
11
- import"./index-m9keg83x.js";
10
+ } from "./index-qnapygnz.js";
11
+ import"./index-50qqqbrb.js";
12
12
  import"./index-ydgy7vg5.js";
13
13
  import"./index-vwyjkzgs.js";
14
14
  import"./index-f7nma02k.js";
15
- import"./index-h0h4qjmc.js";
15
+ import"./index-hxnnp4qj.js";
16
16
  import {
17
17
  DEFAULT_AGENT_CONFIGS
18
- } from "./index-ga7et2xw.js";
18
+ } from "./index-5qzchq7p.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-ga7et2xw.js";
88
+ } from "./index-5qzchq7p.js";
89
89
  import"./index-p0arc26j.js";
90
90
  import"./index-293f68mj.js";
91
91
  import"./index-a76rekgs.js";
@@ -34,7 +34,7 @@ export { handleHistoryCommand } from './history';
34
34
  export { handleKnowledgeListCommand, handleKnowledgeMigrateCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeRetryHardeningCommand, handleKnowledgeUnactionableCommand, } from './knowledge';
35
35
  export { handleLearningCommand } from './learning';
36
36
  export { handleLinkCommand } from './link';
37
- export { handleMemoryCommand, handleMemoryExportCommand, handleMemoryImportCommand, handleMemoryMigrateCommand, handleMemoryStatusCommand, } from './memory';
37
+ export { handleMemoryCommand, handleMemoryExportCommand, handleMemoryImportCommand, handleMemoryMigrateCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, } from './memory';
38
38
  export { handlePlanCommand } from './plan';
39
39
  export { handlePreflightCommand } from './preflight';
40
40
  export { handlePromoteCommand } from './promote';
@@ -3,6 +3,7 @@ export declare function handleMemoryConsolidationLogCommand(directory: string, a
3
3
  export declare function handleMemoryStatusCommand(directory: string, _args: string[]): Promise<string>;
4
4
  export declare function handleMemoryPendingCommand(directory: string, args: string[]): Promise<string>;
5
5
  export declare function handleMemoryRecallLogCommand(directory: string, args: string[]): Promise<string>;
6
+ export declare function handleMemoryValueLogCommand(directory: string, args: string[]): Promise<string>;
6
7
  export declare function handleMemoryStaleCommand(directory: string, args: string[]): Promise<string>;
7
8
  export declare function handleMemoryCompactCommand(directory: string, args: string[]): Promise<string>;
8
9
  export declare function handleMemoryMigrateCommand(directory: string, _args: string[]): Promise<string>;
@@ -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>;
@@ -798,6 +798,14 @@ export declare const COMMAND_REGISTRY: {
798
798
  readonly category: "diagnostics";
799
799
  readonly toolPolicy: "agent";
800
800
  };
801
+ readonly 'memory value-log': {
802
+ readonly handler: (ctx: CommandContext) => Promise<string>;
803
+ readonly description: "Show Swarm memory Q-value and reward updates";
804
+ readonly subcommandOf: "memory";
805
+ readonly args: "--limit <n>";
806
+ readonly category: "diagnostics";
807
+ readonly toolPolicy: "agent";
808
+ };
801
809
  readonly 'memory compact': {
802
810
  readonly handler: (ctx: CommandContext) => Promise<string>;
803
811
  readonly description: "Compact deleted, superseded, and expired scratch memories";
@@ -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;
@@ -645,6 +645,17 @@ export declare const MemoryConfigSchema: z.ZodObject<{
645
645
  tokenBudget: z.ZodDefault<z.ZodNumber>;
646
646
  }, z.core.$strip>>;
647
647
  }, z.core.$strip>>;
648
+ learning: z.ZodDefault<z.ZodObject<{
649
+ learningRate: z.ZodDefault<z.ZodNumber>;
650
+ propagationFactor: z.ZodDefault<z.ZodNumber>;
651
+ qValueBoostWeight: z.ZodDefault<z.ZodNumber>;
652
+ suppressionThreshold: z.ZodDefault<z.ZodNumber>;
653
+ promotionThreshold: z.ZodDefault<z.ZodNumber>;
654
+ propagationTokenOverlapThreshold: z.ZodDefault<z.ZodNumber>;
655
+ propagationEmbeddingCosineThreshold: z.ZodDefault<z.ZodNumber>;
656
+ propagationFanout: z.ZodDefault<z.ZodNumber>;
657
+ propagationLookbackDays: z.ZodDefault<z.ZodNumber>;
658
+ }, z.core.$strip>>;
648
659
  writes: z.ZodDefault<z.ZodObject<{
649
660
  mode: z.ZodDefault<z.ZodLiteral<"propose">>;
650
661
  }, z.core.$strip>>;
@@ -990,7 +1001,16 @@ export declare const PrMonitorConfigSchema: z.ZodObject<{
990
1001
  notify_ci_failure: z.ZodDefault<z.ZodBoolean>;
991
1002
  notify_new_comments: z.ZodDefault<z.ZodBoolean>;
992
1003
  notify_merge_conflict: z.ZodDefault<z.ZodBoolean>;
1004
+ notify_review_activity: z.ZodDefault<z.ZodBoolean>;
1005
+ notify_merged: z.ZodDefault<z.ZodBoolean>;
1006
+ notify_closed: z.ZodDefault<z.ZodBoolean>;
1007
+ notify_ci_success: z.ZodDefault<z.ZodBoolean>;
993
1008
  auto_pr_feedback: z.ZodDefault<z.ZodBoolean>;
1009
+ event_delivery: z.ZodDefault<z.ZodEnum<{
1010
+ advisory: "advisory";
1011
+ prompt: "prompt";
1012
+ }>>;
1013
+ auto_subscribe_on_pr_create: z.ZodDefault<z.ZodBoolean>;
994
1014
  }, z.core.$strict>;
995
1015
  export type PrMonitorConfig = z.infer<typeof PrMonitorConfigSchema>;
996
1016
  export declare const ParallelizationConfigSchema: z.ZodObject<{
@@ -1830,6 +1850,17 @@ export declare const PluginConfigSchema: z.ZodObject<{
1830
1850
  tokenBudget: z.ZodDefault<z.ZodNumber>;
1831
1851
  }, z.core.$strip>>;
1832
1852
  }, z.core.$strip>>;
1853
+ learning: z.ZodDefault<z.ZodObject<{
1854
+ learningRate: z.ZodDefault<z.ZodNumber>;
1855
+ propagationFactor: z.ZodDefault<z.ZodNumber>;
1856
+ qValueBoostWeight: z.ZodDefault<z.ZodNumber>;
1857
+ suppressionThreshold: z.ZodDefault<z.ZodNumber>;
1858
+ promotionThreshold: z.ZodDefault<z.ZodNumber>;
1859
+ propagationTokenOverlapThreshold: z.ZodDefault<z.ZodNumber>;
1860
+ propagationEmbeddingCosineThreshold: z.ZodDefault<z.ZodNumber>;
1861
+ propagationFanout: z.ZodDefault<z.ZodNumber>;
1862
+ propagationLookbackDays: z.ZodDefault<z.ZodNumber>;
1863
+ }, z.core.$strip>>;
1833
1864
  writes: z.ZodDefault<z.ZodObject<{
1834
1865
  mode: z.ZodDefault<z.ZodLiteral<"propose">>;
1835
1866
  }, z.core.$strip>>;
@@ -2235,7 +2266,16 @@ export declare const PluginConfigSchema: z.ZodObject<{
2235
2266
  notify_ci_failure: z.ZodDefault<z.ZodBoolean>;
2236
2267
  notify_new_comments: z.ZodDefault<z.ZodBoolean>;
2237
2268
  notify_merge_conflict: z.ZodDefault<z.ZodBoolean>;
2269
+ notify_review_activity: z.ZodDefault<z.ZodBoolean>;
2270
+ notify_merged: z.ZodDefault<z.ZodBoolean>;
2271
+ notify_closed: z.ZodDefault<z.ZodBoolean>;
2272
+ notify_ci_success: z.ZodDefault<z.ZodBoolean>;
2238
2273
  auto_pr_feedback: z.ZodDefault<z.ZodBoolean>;
2274
+ event_delivery: z.ZodDefault<z.ZodEnum<{
2275
+ advisory: "advisory";
2276
+ prompt: "prompt";
2277
+ }>>;
2278
+ auto_subscribe_on_pr_create: z.ZodDefault<z.ZodBoolean>;
2239
2279
  }, z.core.$strict>>;
2240
2280
  external_skills: z.ZodOptional<z.ZodObject<{
2241
2281
  curation_enabled: z.ZodDefault<z.ZodBoolean>;
@@ -31,6 +31,15 @@ export interface CouncilMemberVerdict {
31
31
  /** Criteria IDs that failed */
32
32
  criteriaUnmet: string[];
33
33
  durationMs: number;
34
+ /**
35
+ * Optional session id of the dispatched agent that produced this verdict.
36
+ * When supplied, the memory reward pathway rewards this member's own
37
+ * recall bundle in addition to the submitting session's, so sub-agent
38
+ * recalls are not silently skipped. Unvalidated caller input — the
39
+ * reward pathway must confirm this resolves to a real tracked session
40
+ * before trusting it.
41
+ */
42
+ sessionId?: string;
34
43
  }
35
44
  export interface CouncilSynthesis {
36
45
  taskId: string;
@@ -29,7 +29,7 @@ export interface ExtractImportsOptions {
29
29
  content?: string;
30
30
  }
31
31
  /** Source file extensions we know how to scan. */
32
- export declare const SOURCE_EXTENSIONS: readonly [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".py", ".go", ".rs"];
32
+ export declare const SOURCE_EXTENSIONS: readonly [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".py", ".pyw", ".go", ".rs"];
33
33
  export declare function getLanguageFromExtension(ext: string): string | null;
34
34
  /**
35
35
  * Extract import edges for a single file. Returns an empty array when the
@@ -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;