opencode-swarm 7.113.3 → 7.114.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.
package/dist/cli/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-dh87tpc5.js";
10
+ } from "./index-zezjy05g.js";
11
11
  import"./index-g6va6n3t.js";
12
12
  import"./index-c8s9a3zh.js";
13
13
  import"./index-2148358e.js";
@@ -14,10 +14,20 @@
14
14
  * Architect MODE skills whose `.opencode` and `.claude` mirrors must be
15
15
  * byte-identical. `.opencode` is the operative protocol loaded by
16
16
  * `src/agents/architect.ts` MODE stubs; the `.claude` mirror must match so
17
- * Claude Code and OpenCode sessions cannot diverge silently. Tuple shape is
18
- * `[slug, opencodePath, claudePath]`.
17
+ * Claude Code and OpenCode sessions cannot diverge silently.
18
+ *
19
+ * `canonical` records which side wins when they drift (fix direction only;
20
+ * detection is symmetric). For architect MODE skills `.opencode` is always
21
+ * canonical because it is the operative protocol the MODE stubs load. Issue
22
+ * #1781 E3 added this field so `drift:fix` can copy the canonical side to the
23
+ * mirror without guessing.
19
24
  */
20
- export declare const MIRRORED_ARCHITECT_MODE_SKILLS: readonly [readonly ["brainstorm", ".opencode/skills/brainstorm/SKILL.md", ".claude/skills/brainstorm/SKILL.md"], readonly ["specify", ".opencode/skills/specify/SKILL.md", ".claude/skills/specify/SKILL.md"], readonly ["clarify-spec", ".opencode/skills/clarify-spec/SKILL.md", ".claude/skills/clarify-spec/SKILL.md"], readonly ["resume", ".opencode/skills/resume/SKILL.md", ".claude/skills/resume/SKILL.md"], readonly ["clarify", ".opencode/skills/clarify/SKILL.md", ".claude/skills/clarify/SKILL.md"], readonly ["discover", ".opencode/skills/discover/SKILL.md", ".claude/skills/discover/SKILL.md"], readonly ["consult", ".opencode/skills/consult/SKILL.md", ".claude/skills/consult/SKILL.md"], readonly ["pre-phase-briefing", ".opencode/skills/pre-phase-briefing/SKILL.md", ".claude/skills/pre-phase-briefing/SKILL.md"], readonly ["council", ".opencode/skills/council/SKILL.md", ".claude/skills/council/SKILL.md"], readonly ["deep-dive", ".opencode/skills/deep-dive/SKILL.md", ".claude/skills/deep-dive/SKILL.md"], readonly ["deep-research", ".opencode/skills/deep-research/SKILL.md", ".claude/skills/deep-research/SKILL.md"], readonly ["issue-ingest", ".opencode/skills/issue-ingest/SKILL.md", ".claude/skills/issue-ingest/SKILL.md"], readonly ["plan", ".opencode/skills/plan/SKILL.md", ".claude/skills/plan/SKILL.md"], readonly ["critic-gate", ".opencode/skills/critic-gate/SKILL.md", ".claude/skills/critic-gate/SKILL.md"], readonly ["design-docs", ".opencode/skills/design-docs/SKILL.md", ".claude/skills/design-docs/SKILL.md"]];
25
+ export declare const MIRRORED_ARCHITECT_MODE_SKILLS: Array<{
26
+ slug: string;
27
+ opencodePath: string;
28
+ claudePath: string;
29
+ canonical: '.opencode' | '.claude';
30
+ }>;
21
31
  /**
22
32
  * Architect MODE skills where `.opencode` is the full operative protocol and
23
33
  * `.claude` is an intentionally different surface. Both must exist; byte
@@ -37,6 +37,19 @@ export interface FullAutoRunState {
37
37
  terminateReason?: string;
38
38
  /** Consecutive oversight dispatch failures for auto-degrade. */
39
39
  consecutiveOversightFailures?: number;
40
+ /**
41
+ * Issue #1781 E2: the most recent oversight-escalation detail, persisted so
42
+ * `/swarm status` can surface the reason + interaction/deadlock counts +
43
+ * phase without parsing the human-readable `.swarm/escalation-report.md`.
44
+ * Updated atomically by `recordFullAutoEscalation` at escalation time.
45
+ */
46
+ lastEscalation?: {
47
+ reason: string;
48
+ interactionCount: number;
49
+ deadlockCount: number;
50
+ phase?: number;
51
+ escalatedAt: string;
52
+ };
40
53
  }
41
54
  export interface FullAutoPersistedState {
42
55
  version: 2;
@@ -129,6 +142,19 @@ export declare function resetFullAutoDenials(directory: string, sessionID: strin
129
142
  */
130
143
  export declare function nextFullAutoOversightSequence(directory: string): number;
131
144
  export declare function recordFullAutoOversight(directory: string, sessionID: string, verdict: string, reason: string): FullAutoRunState | undefined;
145
+ /**
146
+ * Issue #1781 E2: persist the most recent oversight-escalation detail
147
+ * (reason, interaction/deadlock counts, phase) to the durable run state so
148
+ * `/swarm status` can surface it. Called from `handleEscalation` in
149
+ * `src/hooks/full-auto-intercept.ts` alongside the existing pause/terminate
150
+ * state writes — those writes spread `...state`, so this field survives them.
151
+ */
152
+ export declare function recordFullAutoEscalation(directory: string, sessionID: string, detail: {
153
+ reason: string;
154
+ interactionCount: number;
155
+ deadlockCount: number;
156
+ phase?: number;
157
+ }): FullAutoRunState | undefined;
132
158
  export interface DenialLimitDecision {
133
159
  pause: boolean;
134
160
  reason?: string;
@@ -26,8 +26,8 @@
26
26
  */
27
27
  import { listSkills, parseDraftFrontmatter, retireOrMarkStale, retireSkill } from '../services/skill-generator.js';
28
28
  import { getSkillVersion, reviseSkill } from '../services/skill-reviser.js';
29
- import type { ComplianceObservation, CuratorConfig, CuratorInitResult, CuratorPhaseResult, CuratorSummary, KnowledgeRecommendation } from './curator-types.js';
30
- import { getArchivedKnowledgeIds, readKnowledge } from './knowledge-store.js';
29
+ import type { ComplianceObservation, CuratorConfig, CuratorInitResult, CuratorPhaseResult, CuratorSummary, KnowledgeRecommendation, PhaseDigestEntry } from './curator-types.js';
30
+ import { getArchivedKnowledgeIds, readKnowledge, transactFile } from './knowledge-store.js';
31
31
  import type { KnowledgeConfig } from './knowledge-types.js';
32
32
  import { readSkillUsageEntries } from './skill-usage-log.js';
33
33
  /**
@@ -41,6 +41,11 @@ export declare const _internals: {
41
41
  parseKnowledgeRecommendationsWithDiagnostics: typeof parseKnowledgeRecommendationsWithDiagnostics;
42
42
  readCuratorSummary: typeof readCuratorSummary;
43
43
  writeCuratorSummary: typeof writeCuratorSummary;
44
+ appendCuratorRecommendation: typeof appendCuratorRecommendation;
45
+ mergeCuratorPhaseSummary: typeof mergeCuratorPhaseSummary;
46
+ readCuratorSummaryState: typeof readCuratorSummaryState;
47
+ writeCuratorSummaryState: typeof writeCuratorSummaryState;
48
+ transactFile: typeof transactFile;
44
49
  filterPhaseEvents: typeof filterPhaseEvents;
45
50
  checkPhaseCompliance: typeof checkPhaseCompliance;
46
51
  normalizeAgentName: typeof normalizeAgentName;
@@ -113,18 +118,37 @@ export declare function parseStructuredCuratorBlocks(llmOutput: string): {
113
118
  candidates: import('./curator-types.js').SkillCandidate[];
114
119
  diagnostics: StructuredCuratorDiagnostic[];
115
120
  };
121
+ interface CuratorSummaryFileState {
122
+ summary: CuratorSummary | null;
123
+ dirty: boolean;
124
+ }
125
+ declare function readCuratorSummaryState(filePath: string): Promise<CuratorSummaryFileState>;
126
+ declare function writeCuratorSummaryState(filePath: string, state: CuratorSummaryFileState): Promise<void>;
116
127
  /**
117
- * Read curator summary from .swarm/curator-summary.json
118
- * @param directory - The workspace directory
119
- * @returns CuratorSummary if valid, null if missing or invalid
128
+ * Read and normalize curator summary from .swarm/curator-summary.json.
129
+ * Legacy recommendation spam is deduplicated and capped on first successful read.
130
+ * Cleanup failure is fail-open: callers still receive the normalized in-memory state.
120
131
  */
121
132
  export declare function readCuratorSummary(directory: string): Promise<CuratorSummary | null>;
133
+ /** Write a fully normalized curator summary under the shared summary lock. */
134
+ export declare function writeCuratorSummary(directory: string, summary: CuratorSummary): Promise<void>;
122
135
  /**
123
- * Write curator summary to .swarm/curator-summary.json
124
- * @param directory - The workspace directory
125
- * @param summary - The curator summary to write
136
+ * Append one recommendation through the shared locked persistence boundary.
137
+ * Returns false when no summary exists or no persisted representation changes.
138
+ * A semantic duplicate can return true when it replaces the retained representative
139
+ * under the newest-wins policy (for example, a hive event with a newer timestamp).
126
140
  */
127
- export declare function writeCuratorSummary(directory: string, summary: CuratorSummary): Promise<void>;
141
+ export declare function appendCuratorRecommendation(directory: string, recommendation: KnowledgeRecommendation): Promise<boolean>;
142
+ interface CuratorPhaseSummaryMerge {
143
+ phase: number;
144
+ phaseDigest: PhaseDigestEntry;
145
+ complianceObservations: ComplianceObservation[];
146
+ knowledgeRecommendations: KnowledgeRecommendation[];
147
+ sessionId: string;
148
+ timestamp: string;
149
+ }
150
+ /** Merge a phase result against the latest on-disk summary under the shared lock. */
151
+ export declare function mergeCuratorPhaseSummary(directory: string, merge: CuratorPhaseSummaryMerge): Promise<boolean>;
128
152
  /**
129
153
  * Normalize an agent name to its canonical role.
130
154
  *
@@ -1,4 +1,5 @@
1
1
  /** Hive promoter hook for opencode-swarm v6.17 two-tier knowledge system. */
2
+ import { appendCuratorRecommendation, readCuratorSummary } from './curator.js';
2
3
  import type { KnowledgeConfig, SwarmKnowledgeEntry } from './knowledge-types.js';
3
4
  /** Hive promotion summary for curator state */
4
5
  export interface HivePromotionSummary {
@@ -30,6 +31,12 @@ export declare function isHiveEligible(entry: SwarmKnowledgeEntry, autoPromoteDa
30
31
  * (inferTags() never produces it automatically).
31
32
  */
32
33
  export declare function checkHivePromotions(swarmEntries: SwarmKnowledgeEntry[], config: KnowledgeConfig): Promise<HivePromotionSummary>;
34
+ export declare const _internals: {
35
+ readSwarmEntries: (directory: string) => Promise<SwarmKnowledgeEntry[]>;
36
+ checkHivePromotions: typeof checkHivePromotions;
37
+ readCuratorSummary: typeof readCuratorSummary;
38
+ appendCuratorRecommendation: typeof appendCuratorRecommendation;
39
+ };
33
40
  /**
34
41
  * Create a hook that promotes swarm entries to the hive.
35
42
  * The hook fires unconditionally - the caller decides when to invoke it.
@@ -1,4 +1,5 @@
1
1
  /** Knowledge curator hook for opencode-swarm v6.17 two-tier knowledge system. */
2
+ import { realpath } from 'node:fs/promises';
2
3
  import type { CuratorLLMDelegate } from './curator.js';
3
4
  import type { ActionableDirectiveFields, KnowledgeConfig, SwarmKnowledgeEntry } from './knowledge-types.js';
4
5
  import { type InsightCandidate } from './micro-reflector.js';
@@ -6,6 +7,7 @@ declare const seenRetroSections: Map<string, {
6
7
  value: string;
7
8
  timestamp: number;
8
9
  }>;
10
+ declare const inFlightEvidenceEntries: Set<string>;
9
11
  /**
10
12
  * Bound seenRetroSections to MAX_TRACKED_RETRO_SECTIONS entries, evicting the
11
13
  * oldest-timestamp entries first. Called after every insert so the map can never
@@ -16,6 +18,13 @@ declare function capSeenRetroSections(): void;
16
18
  /** Record a seen-section hash and enforce the size cap in one step. */
17
19
  declare function recordSeenRetroSection(key: string, value: string, timestamp: number): void;
18
20
  declare function hashContent(content: string): string;
21
+ interface EvidenceLessonBatch {
22
+ identity: string;
23
+ lessons: string[];
24
+ projectName: string;
25
+ phaseNumber: number;
26
+ }
27
+ declare function extractEvidenceLessonBatches(evidenceData: Record<string, unknown>): EvidenceLessonBatch[];
19
28
  /**
20
29
  * Check if the input is a write operation targeting an evidence file.
21
30
  * Exported for testing purposes only.
@@ -141,5 +150,9 @@ export declare const _internals: {
141
150
  hashContent: typeof hashContent;
142
151
  capSeenRetroSections: typeof capSeenRetroSections;
143
152
  MAX_TRACKED_RETRO_SECTIONS: number;
153
+ inFlightEvidenceEntries: typeof inFlightEvidenceEntries;
154
+ MAX_IN_FLIGHT_EVIDENCE_ENTRIES: number;
155
+ extractEvidenceLessonBatches: typeof extractEvidenceLessonBatches;
156
+ realpath: typeof realpath;
144
157
  };
145
158
  export {};