opencode-swarm 7.105.0 → 7.107.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 (50) hide show
  1. package/.opencode/skills/critic-gate/SKILL.md +19 -5
  2. package/.opencode/skills/plan/SKILL.md +18 -3
  3. package/.opencode/skills/resume/SKILL.md +4 -1
  4. package/.opencode/skills/writing-tests/SKILL.md +31 -0
  5. package/dist/agents/critic.d.ts +1 -1
  6. package/dist/cli/{config-doctor-4dhkq5qe.js → config-doctor-cntnpyvj.js} +2 -2
  7. package/dist/cli/{evidence-summary-service-v9kmv783.js → evidence-summary-service-zhw4rkjb.js} +1 -1
  8. package/dist/cli/{guardrail-explain-9br76zh5.js → guardrail-explain-6xt0pb56.js} +6 -6
  9. package/dist/cli/{guardrail-log-peftzya3.js → guardrail-log-fsc85hwa.js} +3 -3
  10. package/dist/cli/{index-5qzchq7p.js → index-2560cctg.js} +27 -0
  11. package/dist/cli/{index-k2rmw9sz.js → index-25pev4e7.js} +165 -31
  12. package/dist/cli/{index-hxnnp4qj.js → index-esg1554h.js} +1 -1
  13. package/dist/cli/{index-qnapygnz.js → index-fhw0jm5c.js} +21468 -21240
  14. package/dist/cli/{index-50qqqbrb.js → index-fxtrk7y8.js} +1 -1
  15. package/dist/cli/{index-8mj10cds.js → index-v90bnn0f.js} +7 -7
  16. package/dist/cli/{index-25bc7j87.js → index-w8dzxnx4.js} +1 -1
  17. package/dist/cli/{index-wg8ars51.js → index-wa6at603.js} +2 -2
  18. package/dist/cli/index.js +5 -5
  19. package/dist/cli/{schema-3a02876y.js → schema-vw2ffhe9.js} +1 -1
  20. package/dist/commands/close.d.ts +2 -0
  21. package/dist/commands/reset-session.d.ts +10 -0
  22. package/dist/config/schema.d.ts +28 -0
  23. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +3 -1
  24. package/dist/hooks/guardrails/index.d.ts +3 -1
  25. package/dist/hooks/system-enhancer.d.ts +4 -0
  26. package/dist/index.js +587 -523
  27. package/dist/memory/config.d.ts +48 -0
  28. package/dist/memory/finalize-reward-sweep.d.ts +132 -0
  29. package/dist/memory/gateway.d.ts +0 -1
  30. package/dist/memory/index.d.ts +1 -2
  31. package/dist/memory/injector.d.ts +11 -0
  32. package/dist/memory/local-jsonl-provider.d.ts +3 -1
  33. package/dist/memory/maintenance.d.ts +16 -4
  34. package/dist/memory/provider.d.ts +42 -47
  35. package/dist/memory/q-learning.d.ts +62 -0
  36. package/dist/memory/reward-capture.d.ts +119 -0
  37. package/dist/memory/schema.d.ts +9 -9
  38. package/dist/memory/scoring.d.ts +60 -5
  39. package/dist/memory/sqlite-provider.d.ts +5 -53
  40. package/dist/memory/types.d.ts +25 -5
  41. package/dist/plan/manager.d.ts +15 -1
  42. package/dist/state.d.ts +9 -2
  43. package/dist/tools/convene-council.d.ts +0 -2
  44. package/dist/tools/submit-phase-council-verdicts.d.ts +0 -1
  45. package/dist/tools/swarm-memory-recall.d.ts +2 -0
  46. package/dist/tools/update-task-status.d.ts +1 -0
  47. package/dist/tools/write-final-council-evidence.d.ts +2 -2
  48. package/dist/utils/spec-hash.d.ts +36 -0
  49. package/package.json +1 -1
  50. package/dist/memory/reward.d.ts +0 -39
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  stripKnownSwarmPrefix
4
- } from "./index-5qzchq7p.js";
4
+ } from "./index-2560cctg.js";
5
5
  import {
6
6
  init_logger,
7
7
  warn
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  handleGuardrailExplain
4
- } from "./index-wg8ars51.js";
4
+ } from "./index-wa6at603.js";
5
5
  import {
6
6
  handleGuardrailLog
7
- } from "./index-25bc7j87.js";
7
+ } from "./index-w8dzxnx4.js";
8
8
  import {
9
9
  COMMAND_REGISTRY,
10
10
  SWARM_COMMAND_TOOL_ALLOWLIST,
@@ -80,18 +80,18 @@ import {
80
80
  handleWriteRetroCommand,
81
81
  normalizeSwarmCommandInput,
82
82
  resolveCommand
83
- } from "./index-qnapygnz.js";
84
- import"./index-50qqqbrb.js";
83
+ } from "./index-fhw0jm5c.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-hxnnp4qj.js";
88
+ import"./index-esg1554h.js";
89
89
  import {
90
90
  AGENT_TOOL_MAP,
91
91
  ORCHESTRATOR_NAME,
92
92
  stripKnownSwarmPrefix
93
- } from "./index-5qzchq7p.js";
94
- import"./index-k2rmw9sz.js";
93
+ } from "./index-2560cctg.js";
94
+ import"./index-25pev4e7.js";
95
95
  import"./index-8w4d325g.js";
96
96
  import"./index-v4fcn4tr.js";
97
97
  import"./index-r8f89sm9.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  redactPath,
4
4
  redactShellCommand
5
- } from "./index-50qqqbrb.js";
5
+ } from "./index-fxtrk7y8.js";
6
6
 
7
7
  // src/services/guardrail-log-service.ts
8
8
  import * as fs from "fs/promises";
@@ -12,14 +12,14 @@ import {
12
12
  detectPosixWrites,
13
13
  detectWindowsWrites,
14
14
  resolveWriteTargets
15
- } from "./index-qnapygnz.js";
15
+ } from "./index-fhw0jm5c.js";
16
16
  import {
17
17
  checkFileAuthority,
18
18
  classifyFile,
19
19
  isInDeclaredScope,
20
20
  redactPath,
21
21
  redactShellCommand
22
- } from "./index-50qqqbrb.js";
22
+ } from "./index-fxtrk7y8.js";
23
23
 
24
24
  // src/services/guardrail-explain-service.ts
25
25
  import path from "path";
package/dist/cli/index.js CHANGED
@@ -7,16 +7,16 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-qnapygnz.js";
11
- import"./index-50qqqbrb.js";
10
+ } from "./index-fhw0jm5c.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-hxnnp4qj.js";
15
+ import"./index-esg1554h.js";
16
16
  import {
17
17
  DEFAULT_AGENT_CONFIGS
18
- } from "./index-5qzchq7p.js";
19
- import"./index-k2rmw9sz.js";
18
+ } from "./index-2560cctg.js";
19
+ import"./index-25pev4e7.js";
20
20
  import"./index-8w4d325g.js";
21
21
  import"./index-v4fcn4tr.js";
22
22
  import"./index-r8f89sm9.js";
@@ -85,7 +85,7 @@ import {
85
85
  resolveGeneratedAgentRole,
86
86
  resolveGuardrailsConfig,
87
87
  stripKnownSwarmPrefix
88
- } from "./index-5qzchq7p.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;
@@ -1,3 +1,13 @@
1
+ import { type OrphanCleanupResult } from '../worktree/merge';
2
+ /**
3
+ * _internals DI seam for testing reset-session without spawning real git processes.
4
+ * Production code calls `_internals.cleanupOrphanedBranches(...)` so tests can
5
+ * replace the function on this object without touching the real worktree/merge
6
+ * module. Mutations are file-scoped and trivially restorable via afterEach.
7
+ */
8
+ export declare const _internals: {
9
+ cleanupOrphanedBranches: (directory: string, activeSessionIds: string[]) => Promise<OrphanCleanupResult>;
10
+ };
1
11
  /**
2
12
  * Handles the /swarm reset-session command.
3
13
  * Deletes only the session state file (.swarm/session/state.json)
@@ -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>;
@@ -1881,6 +1895,20 @@ export declare const PluginConfigSchema: z.ZodObject<{
1881
1895
  threshold: z.ZodDefault<z.ZodNumber>;
1882
1896
  }, z.core.$strip>>;
1883
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>>;
1884
1912
  consolidation: z.ZodDefault<z.ZodObject<{
1885
1913
  enabled: z.ZodDefault<z.ZodBoolean>;
1886
1914
  maxClustersPerPass: z.ZodDefault<z.ZodNumber>;
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import type { PluginConfig } from '../../config';
12
12
  import type { WorktreeHandle } from '../../worktree';
13
- import { attemptMergeBackFromDirty, postMergeCleanup, provisionWorktree, removeWorktree } from '../../worktree';
13
+ import { attemptMergeBackFromDirty, cleanupOrphanedBranches, postMergeCleanup, provisionWorktree, removeWorktree, startupOrphanRecovery } from '../../worktree';
14
14
  export declare const MAX_TRACKED_STANDARD_WORKTREE_CALLS = 256;
15
15
  export interface StandardWorktreeDispatch {
16
16
  callID: string;
@@ -45,4 +45,6 @@ export declare const _internals: {
45
45
  removeWorktree: typeof removeWorktree;
46
46
  attemptMergeBackFromDirty: typeof attemptMergeBackFromDirty;
47
47
  postMergeCleanup: typeof postMergeCleanup;
48
+ startupOrphanRecovery: typeof startupOrphanRecovery;
49
+ cleanupOrphanedBranches: typeof cleanupOrphanedBranches;
48
50
  };
@@ -27,7 +27,9 @@ export declare const _internals: {
27
27
  export declare const SPEC_DRIFT_BLOCKED_TOOLS: Set<string>;
28
28
  /**
29
29
  * Throw SPEC_DRIFT_BLOCK if the tool is on the block-list and the
30
- * spec-staleness marker file exists.
30
+ * spec-staleness marker file exists. The error message includes a unified
31
+ * diff of the recorded vs current spec content so the user can see what
32
+ * changed (FR-001).
31
33
  */
32
34
  export declare function enforceSpecDriftGate(directory: string | undefined, toolName: string): void;
33
35
  /**
@@ -20,6 +20,10 @@ export declare function buildSpecDriftAdvisory(args: {
20
20
  reason: string;
21
21
  currentHash: string | null;
22
22
  storedHash: string;
23
+ diff?: {
24
+ diff: string;
25
+ changedSections: string[];
26
+ } | null;
23
27
  midLoadRemovals?: {
24
28
  count: number;
25
29
  source: string;