opencode-swarm 7.106.0 → 7.107.1

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 (40) 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/agents/explorer.d.ts +2 -2
  7. package/dist/cli/curator-drift-6ad8mxxb.js +211 -0
  8. package/dist/cli/curator-llm-factory-gdhtm1hh.js +31 -0
  9. package/dist/cli/curator-np2ky29t.js +51 -0
  10. package/dist/cli/{evidence-summary-service-v9kmv783.js → evidence-summary-service-dh44gevz.js} +4 -3
  11. package/dist/cli/{explorer-rwfvbbx5.js → explorer-ksr3xq7n.js} +1 -1
  12. package/dist/cli/{guardrail-explain-fvjc90wa.js → guardrail-explain-414smfg4.js} +13 -11
  13. package/dist/cli/hive-promoter-y9r8d315.js +39 -0
  14. package/dist/cli/{index-ydgy7vg5.js → index-09xpycan.js} +31 -5
  15. package/dist/cli/index-357p0baj.js +719 -0
  16. package/dist/cli/{index-7dtekwvd.js → index-7v734syt.js} +1 -1
  17. package/dist/cli/{index-z4t3w4xf.js → index-87d4wsv9.js} +14 -12
  18. package/dist/cli/{index-vwyjkzgs.js → index-9wstcavp.js} +1 -1
  19. package/dist/cli/index-c8s9a3zh.js +73 -0
  20. package/dist/cli/{index-f4yjypa4.js → index-gt514nt1.js} +29028 -27099
  21. package/dist/cli/{index-k2rmw9sz.js → index-jjp5qrjv.js} +265 -843
  22. package/dist/cli/{index-e9n3xsk0.js → index-t4hbye3v.js} +1 -1
  23. package/dist/cli/index.js +12 -10
  24. package/dist/cli/{pending-delegations-dvprsdfy.js → pending-delegations-46xf2n2e.js} +2 -2
  25. package/dist/cli/{pr-subscriptions-zfxjtyzw.js → pr-subscriptions-3c34rnm1.js} +3 -3
  26. package/dist/cli/{skill-generator-99rrfwae.js → skill-generator-y6mmq8n5.js} +1 -1
  27. package/dist/commands/curate.d.ts +38 -1
  28. package/dist/commands/registry.d.ts +2 -2
  29. package/dist/commands/reset-session.d.ts +10 -0
  30. package/dist/hooks/curator-postmortem.d.ts +52 -3
  31. package/dist/hooks/curator.d.ts +2 -1
  32. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +3 -1
  33. package/dist/hooks/guardrails/index.d.ts +3 -1
  34. package/dist/hooks/system-enhancer.d.ts +4 -0
  35. package/dist/index.js +458 -386
  36. package/dist/plan/manager.d.ts +15 -1
  37. package/dist/tools/update-task-status.d.ts +1 -0
  38. package/dist/utils/spec-hash.d.ts +36 -0
  39. package/package.json +1 -1
  40. package/dist/cli/{index-7ztmmqpt.js → index-mpe0yk9s.js} +3 -3
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  validateSwarmPath
4
- } from "./index-7ztmmqpt.js";
4
+ } from "./index-mpe0yk9s.js";
5
5
  import {
6
6
  log
7
7
  } from "./index-zgwm4ryv.js";
package/dist/cli/index.js CHANGED
@@ -7,25 +7,27 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-f4yjypa4.js";
11
- import"./index-fxtrk7y8.js";
12
- import"./index-ydgy7vg5.js";
13
- import"./index-vwyjkzgs.js";
14
- import"./index-f7nma02k.js";
10
+ } from "./index-gt514nt1.js";
15
11
  import"./index-esg1554h.js";
12
+ import"./index-jjp5qrjv.js";
13
+ import"./index-8w4d325g.js";
14
+ import"./index-fxtrk7y8.js";
15
+ import"./index-09xpycan.js";
16
16
  import {
17
17
  DEFAULT_AGENT_CONFIGS
18
18
  } from "./index-2560cctg.js";
19
- import"./index-k2rmw9sz.js";
20
- import"./index-8w4d325g.js";
19
+ import"./index-9wstcavp.js";
20
+ import"./index-f7nma02k.js";
21
+ import"./index-c8s9a3zh.js";
22
+ import"./index-357p0baj.js";
21
23
  import"./index-v4fcn4tr.js";
22
24
  import"./index-r8f89sm9.js";
23
25
  import"./index-9b7qp18e.js";
24
- import"./index-e9n3xsk0.js";
25
- import"./index-7ztmmqpt.js";
26
- import"./index-jtqkh8jf.js";
26
+ import"./index-t4hbye3v.js";
27
+ import"./index-mpe0yk9s.js";
27
28
  import"./index-5e4e2hvv.js";
28
29
  import"./index-p0arc26j.js";
30
+ import"./index-jtqkh8jf.js";
29
31
  import"./index-zgwm4ryv.js";
30
32
  import"./index-3naa2ajc.js";
31
33
  import"./index-293f68mj.js";
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  validateSwarmPath
4
- } from "./index-7ztmmqpt.js";
5
- import"./index-jtqkh8jf.js";
4
+ } from "./index-mpe0yk9s.js";
6
5
  import"./index-5e4e2hvv.js";
7
6
  import"./index-p0arc26j.js";
7
+ import"./index-jtqkh8jf.js";
8
8
  import {
9
9
  init_logger,
10
10
  warn
@@ -9,11 +9,11 @@ import {
9
9
  sweepStale,
10
10
  unsubscribe,
11
11
  updateSnapshot
12
- } from "./index-e9n3xsk0.js";
13
- import"./index-7ztmmqpt.js";
14
- import"./index-jtqkh8jf.js";
12
+ } from "./index-t4hbye3v.js";
13
+ import"./index-mpe0yk9s.js";
15
14
  import"./index-5e4e2hvv.js";
16
15
  import"./index-p0arc26j.js";
16
+ import"./index-jtqkh8jf.js";
17
17
  import"./index-zgwm4ryv.js";
18
18
  import"./index-3naa2ajc.js";
19
19
  import"./index-293f68mj.js";
@@ -27,7 +27,7 @@ import {
27
27
  retireSkill,
28
28
  sanitizeSlug,
29
29
  selectCandidateEntries
30
- } from "./index-vwyjkzgs.js";
30
+ } from "./index-9wstcavp.js";
31
31
  import"./index-f7nma02k.js";
32
32
  import"./index-9b7qp18e.js";
33
33
  import"./index-jtqkh8jf.js";
@@ -7,15 +7,52 @@
7
7
  *
8
8
  * Returns a summary with counts, or zero counts for empty-state.
9
9
  */
10
+ import { checkHivePromotions } from '../hooks/hive-promoter.js';
11
+ import { readKnowledge, resolveSwarmKnowledgePath } from '../hooks/knowledge-store.js';
12
+ import { readSwarmFileAsync } from '../hooks/utils.js';
13
+ export declare const _internals: {
14
+ checkHivePromotions: typeof checkHivePromotions;
15
+ readKnowledge: typeof readKnowledge;
16
+ resolveSwarmKnowledgePath: typeof resolveSwarmKnowledgePath;
17
+ readSwarmFileAsync: typeof readSwarmFileAsync;
18
+ loadCuratorDeps: () => Promise<{
19
+ CuratorConfigSchema: import("zod").ZodObject<{
20
+ enabled: import("zod").ZodDefault<import("zod").ZodBoolean>;
21
+ init_enabled: import("zod").ZodDefault<import("zod").ZodBoolean>;
22
+ phase_enabled: import("zod").ZodDefault<import("zod").ZodBoolean>;
23
+ postmortem_enabled: import("zod").ZodDefault<import("zod").ZodBoolean>;
24
+ max_summary_tokens: import("zod").ZodDefault<import("zod").ZodNumber>;
25
+ min_knowledge_confidence: import("zod").ZodDefault<import("zod").ZodNumber>;
26
+ compliance_report: import("zod").ZodDefault<import("zod").ZodBoolean>;
27
+ suppress_warnings: import("zod").ZodDefault<import("zod").ZodBoolean>;
28
+ drift_inject_max_chars: import("zod").ZodDefault<import("zod").ZodNumber>;
29
+ llm_timeout_ms: import("zod").ZodDefault<import("zod").ZodNumber>;
30
+ skill_generation_enabled: import("zod").ZodDefault<import("zod").ZodBoolean>;
31
+ skill_generation_mode: import("zod").ZodDefault<import("zod").ZodEnum<{
32
+ draft: "draft";
33
+ active: "active";
34
+ }>>;
35
+ min_skill_confidence: import("zod").ZodDefault<import("zod").ZodNumber>;
36
+ min_skill_confirmations: import("zod").ZodDefault<import("zod").ZodNumber>;
37
+ }, import("zod/v4/core").$strip>;
38
+ curator: typeof import("../hooks/curator.js");
39
+ createCuratorLLMDelegate: typeof import("../hooks/curator-llm-factory.js").createCuratorLLMDelegate;
40
+ }>;
41
+ };
10
42
  export interface CurationSummary {
11
43
  timestamp: string;
12
44
  new_promotions: number;
13
45
  encounters_incremented: number;
14
46
  advancements: number;
15
47
  total_hive_entries: number;
48
+ knowledge_applied?: number;
49
+ knowledge_skipped?: number;
50
+ curator_phase?: number;
16
51
  }
17
52
  /**
18
53
  * Handles the /swarm curate command.
19
54
  * Runs hive promotion review on existing swarm entries.
20
55
  */
21
- export declare function handleCurateCommand(directory: string, _args: string[]): Promise<string>;
56
+ export declare function handleCurateCommand(directory: string, _args: string[], options?: {
57
+ sessionID?: string;
58
+ }): Promise<string>;
@@ -367,8 +367,8 @@ export declare const COMMAND_REGISTRY: {
367
367
  readonly 'post-mortem': {
368
368
  readonly handler: (ctx: CommandContext) => Promise<string>;
369
369
  readonly description: "Run the post-mortem agent: project-end synthesis, queue triage, and final curation pass";
370
- readonly details: "Reads .swarm/ evidence (knowledge entries, events, curator digests, proposals, retrospectives, drift reports) and produces a post-mortem report at .swarm/post-mortem-{planId}.md. Idempotent: re-runs skip if report exists unless --force is passed.";
371
- readonly args: "--force";
370
+ readonly details: "Reads .swarm/ evidence (knowledge entries, events, curator digests, proposals, retrospectives, drift reports) and produces a post-mortem report at .swarm/post-mortem-{planId}.md. Idempotent: re-runs skip if report exists unless --force is passed. Use --scope session to limit knowledge event aggregation to the current session; project scope is the default.";
371
+ readonly args: "--force, --scope session|project";
372
372
  readonly category: "core";
373
373
  readonly toolPolicy: "agent";
374
374
  };
@@ -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)
@@ -12,16 +12,23 @@
12
12
  * hive promotion) — no new ungated injection source.
13
13
  */
14
14
  import type { CuratorLLMDelegate } from './curator.js';
15
+ import type { KnowledgeRecommendation } from './curator-types.js';
16
+ import type { KnowledgeConfig, SwarmKnowledgeEntry } from './knowledge-types.js';
15
17
  export interface PostMortemResult {
16
18
  success: boolean;
17
19
  planId: string | null;
18
20
  reportPath: string | null;
19
21
  summary: string | null;
20
22
  warnings: string[];
23
+ actions?: PostMortemActionResult;
21
24
  }
22
25
  export interface PostMortemOptions {
23
26
  llmDelegate?: CuratorLLMDelegate;
24
27
  force?: boolean;
28
+ scope?: 'session' | 'project';
29
+ sessionID?: string;
30
+ knowledgeConfig?: KnowledgeConfig;
31
+ llmTimeoutMs?: number;
25
32
  }
26
33
  interface KnowledgeEventSummary {
27
34
  id: string;
@@ -32,10 +39,36 @@ interface KnowledgeEventSummary {
32
39
  confidence: number;
33
40
  status: string;
34
41
  }
35
- declare function collectKnowledgeSummary(directory: string): Promise<KnowledgeEventSummary[]>;
42
+ interface ParsedPostMortemActions {
43
+ summary: string | null;
44
+ recommendations: KnowledgeRecommendation[];
45
+ queueTriage: Array<{
46
+ proposal_id: string;
47
+ action: 'apply' | 'reject';
48
+ reason: string;
49
+ }>;
50
+ diagnostics: string[];
51
+ }
52
+ export interface PostMortemActionResult {
53
+ knowledge_applied: number;
54
+ knowledge_skipped: number;
55
+ hive_promotions: number;
56
+ hive_encounters_incremented: number;
57
+ hive_advancements: number;
58
+ proposals_approved: number;
59
+ proposals_rejected: number;
60
+ proposals_skipped: number;
61
+ }
62
+ declare function collectKnowledgeSummary(directory: string, scope?: 'session' | 'project', sessionID?: string): Promise<KnowledgeEventSummary[]>;
63
+ declare function parsePostMortemActions(llmOutput: string): ParsedPostMortemActions;
64
+ declare function executePostMortemActions(directory: string, parsed: ParsedPostMortemActions, options: PostMortemOptions): Promise<{
65
+ result: PostMortemActionResult;
66
+ warnings: string[];
67
+ }>;
68
+ declare function repairPostMortemActions(llmOutput: string, diagnostics: string[], options: PostMortemOptions): Promise<ParsedPostMortemActions | null>;
36
69
  declare function readJsonlFile(filePath: string, maxLines?: number): unknown[];
37
70
  declare function collectRetrospectives(directory: string): string[];
38
- declare function collectDriftReports(directory: string): string[];
71
+ declare function collectDriftReports(directory: string): Promise<string[]>;
39
72
  declare function collectPendingProposals(directory: string): Array<{
40
73
  source: string;
41
74
  content: string;
@@ -49,7 +82,7 @@ declare function buildDataOnlyReport(planId: string, planSummary: string, knowle
49
82
  source: string;
50
83
  content: string;
51
84
  }>, unactionable: unknown[], retrospectives: string[], driftReports: string[]): string;
52
- declare function assembleLLMInput(planId: string, planSummary: string, knowledgeSummary: KnowledgeEventSummary[], curatorDigest: string | null, proposals: Array<{
85
+ declare function assembleLLMInput(planId: string, scope: 'session' | 'project', sessionID: string | undefined, planSummary: string, knowledgeSummary: KnowledgeEventSummary[], curatorDigest: string | null, proposals: Array<{
53
86
  source: string;
54
87
  content: string;
55
88
  }>, unactionable: unknown[], retrospectives: string[], driftReports: string[]): string;
@@ -64,5 +97,21 @@ export declare const _internals: {
64
97
  buildDataOnlyReport: typeof buildDataOnlyReport;
65
98
  assembleLLMInput: typeof assembleLLMInput;
66
99
  isReportValid: typeof isReportValid;
100
+ parsePostMortemActions: typeof parsePostMortemActions;
101
+ executePostMortemActions: typeof executePostMortemActions;
102
+ repairPostMortemActions: typeof repairPostMortemActions;
103
+ loadDefaultKnowledgeConfig: () => Promise<KnowledgeConfig>;
104
+ applyCuratorKnowledgeUpdates: (directory: string, recommendations: KnowledgeRecommendation[], knowledgeConfig: KnowledgeConfig) => Promise<{
105
+ applied: number;
106
+ skipped: number;
107
+ }>;
108
+ checkHivePromotions: (entries: SwarmKnowledgeEntry[], knowledgeConfig: KnowledgeConfig) => Promise<import("./hive-promoter.js").HivePromotionSummary>;
109
+ applyProposalTriage: (directory: string, triage: ParsedPostMortemActions["queueTriage"]) => Promise<{
110
+ approved: string[];
111
+ rejected: string[];
112
+ skipped: string[];
113
+ }>;
114
+ readPriorDriftReports: (directory: string) => Promise<import("./curator-types.js").DriftReport[]>;
115
+ readSwarmKnowledge: (directory: string) => Promise<SwarmKnowledgeEntry[]>;
67
116
  };
68
117
  export {};
@@ -55,9 +55,10 @@ export declare const _internals: {
55
55
  readKnowledge: typeof readKnowledge;
56
56
  reviseSkill: typeof reviseSkill;
57
57
  getSkillVersion: typeof getSkillVersion;
58
+ readLatestPostMortemDigest: (directory: string) => string | null;
58
59
  };
59
60
  export interface RecommendationParseDiagnostic {
60
- section: 'OBSERVATIONS' | 'KNOWLEDGE_UPDATES';
61
+ section: 'OBSERVATIONS';
61
62
  line: string;
62
63
  reason: string;
63
64
  }
@@ -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;