opencode-swarm 7.79.1 → 7.79.5

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.
@@ -1 +1,5 @@
1
+ import { computeLearningMetrics } from '../services/learning-metrics.js';
1
2
  export declare function handleLearningCommand(directory: string, args: string[]): Promise<string>;
3
+ export declare const _internals: {
4
+ computeLearningMetrics: typeof computeLearningMetrics;
5
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Handle /swarm loop command.
3
+ *
4
+ * Sanitizes the objective input, parses flags, and emits a [MODE: LOOP ...]
5
+ * signal. The architect picks up the signal and loads
6
+ * `.opencode/skills/loop/SKILL.md`, which runs the compound-engineering loop:
7
+ * brainstorm → plan → build → review → improve, iterating under
8
+ * defense-in-depth stop conditions until the objective is met or a budget is
9
+ * exhausted.
10
+ *
11
+ * The objective is sanitized to prevent prompt injection of rival MODE:
12
+ * headers or newline-based control sequences (mirrors the brainstorm /
13
+ * deep-dive handlers).
14
+ */
15
+ export declare function handleLoopCommand(_directory: string, args: string[]): Promise<string>;
@@ -381,6 +381,24 @@ export declare const COMMAND_REGISTRY: {
381
381
  readonly category: "utility";
382
382
  readonly toolPolicy: "human-only";
383
383
  };
384
+ readonly 'sdd-status': {
385
+ readonly handler: (ctx: CommandContext) => Promise<string>;
386
+ readonly description: "Show OpenSpec-compatible SDD status and effective spec source";
387
+ readonly aliasOf: "sdd status";
388
+ readonly deprecated: true;
389
+ };
390
+ readonly 'sdd-validate': {
391
+ readonly handler: (ctx: CommandContext) => Promise<string>;
392
+ readonly description: "Validate OpenSpec-compatible artifacts and effective spec projection";
393
+ readonly aliasOf: "sdd validate";
394
+ readonly deprecated: true;
395
+ };
396
+ readonly 'sdd-project': {
397
+ readonly handler: (ctx: CommandContext) => Promise<string>;
398
+ readonly description: "Materialize the OpenSpec-compatible effective spec into .swarm/spec.md";
399
+ readonly aliasOf: "sdd project";
400
+ readonly deprecated: true;
401
+ };
384
402
  readonly analyze: {
385
403
  readonly handler: (ctx: CommandContext) => Promise<string>;
386
404
  readonly description: "Analyze spec.md vs plan.md for requirement coverage gaps";
@@ -410,6 +428,14 @@ export declare const COMMAND_REGISTRY: {
410
428
  readonly category: "agent";
411
429
  readonly toolPolicy: "none";
412
430
  };
431
+ readonly loop: {
432
+ readonly handler: (ctx: CommandContext) => CommandResult;
433
+ readonly description: "Enter architect MODE: LOOP — compound-engineering loop: brainstorm → plan → build → review → improve, iterating until done [objective]";
434
+ readonly args: "<objective> [--max-cycles 1..5] [--autonomy checkpoint|auto] [--depth standard|exhaustive] [--resume]";
435
+ readonly details: "Triggers the architect to run the compound-engineering loop defined in .opencode/skills/loop/SKILL.md: BRAINSTORM (requirements) → PLAN (+ critic gate) → BUILD (execute) → REVIEW (independent reviewer + critic on the diff, report-only) → IMPROVE (phase-wrap retrospective + compounding learning capture), then evaluate stop conditions and loop for another improvement cycle if the objective is unmet and budget remains. Generator and reviewer/critic run in separate contexts; failing assertions must be fixed at the root cause, never weakened, mocked, or skipped. Defense-in-depth stop conditions: objective met, --max-cycles budget (default 3), no-progress/plateau, oscillation, unrecoverable error, or explicit user stop. --autonomy checkpoint (default) pauses at phase gates for user approval; --autonomy auto runs unattended with hard stops still enforced. --depth exhaustive widens exploration. --resume continues an existing loop run from durable .swarm/loop/ state. Distinct from full-auto (autonomous cross-phase oversight) and turbo (parallel lanes within a phase): loop is a user-initiated, gated, compounding workflow.";
436
+ readonly category: "agent";
437
+ readonly toolPolicy: "none";
438
+ };
413
439
  readonly council: {
414
440
  readonly handler: (ctx: CommandContext) => CommandResult;
415
441
  readonly description: "Enter architect MODE: COUNCIL — multi-model deliberation [question] [--preset <name>] [--spec-review]";
@@ -442,6 +468,12 @@ export declare const COMMAND_REGISTRY: {
442
468
  readonly category: "agent";
443
469
  readonly toolPolicy: "human-only";
444
470
  };
471
+ readonly 'pr-subscribe': {
472
+ readonly handler: (ctx: CommandContext) => Promise<string>;
473
+ readonly description: "Subscribe the current session to PR state-change notifications";
474
+ readonly aliasOf: "pr subscribe";
475
+ readonly deprecated: true;
476
+ };
445
477
  readonly 'pr unsubscribe': {
446
478
  readonly handler: (ctx: CommandContext) => Promise<string>;
447
479
  readonly description: "Unsubscribe the current session from PR state-change notifications";
@@ -450,6 +482,12 @@ export declare const COMMAND_REGISTRY: {
450
482
  readonly category: "agent";
451
483
  readonly toolPolicy: "human-only";
452
484
  };
485
+ readonly 'pr-unsubscribe': {
486
+ readonly handler: (ctx: CommandContext) => Promise<string>;
487
+ readonly description: "Unsubscribe the current session from PR state-change notifications";
488
+ readonly aliasOf: "pr unsubscribe";
489
+ readonly deprecated: true;
490
+ };
453
491
  readonly 'pr status': {
454
492
  readonly handler: (ctx: CommandContext) => Promise<string>;
455
493
  readonly description: "Show PR monitor subscription status for the current session";
@@ -459,6 +497,12 @@ export declare const COMMAND_REGISTRY: {
459
497
  readonly toolPolicy: "agent";
460
498
  readonly toolNoArgs: true;
461
499
  };
500
+ readonly 'pr-status': {
501
+ readonly handler: (ctx: CommandContext) => Promise<string>;
502
+ readonly description: "Show PR monitor subscription status for the current session";
503
+ readonly aliasOf: "pr status";
504
+ readonly deprecated: true;
505
+ };
462
506
  readonly 'deep-dive': {
463
507
  readonly handler: (ctx: CommandContext) => CommandResult;
464
508
  readonly description: "Launch deep codebase audit with parallel explorer waves, dual reviewers, and critic challenge [scope]";
@@ -742,6 +786,30 @@ export declare const COMMAND_REGISTRY: {
742
786
  readonly category: "utility";
743
787
  readonly toolPolicy: "human-only";
744
788
  };
789
+ readonly 'memory-status': {
790
+ readonly handler: (ctx: CommandContext) => Promise<string>;
791
+ readonly description: "Show Swarm memory provider, JSONL, and migration status";
792
+ readonly aliasOf: "memory status";
793
+ readonly deprecated: true;
794
+ };
795
+ readonly 'memory-export': {
796
+ readonly handler: (ctx: CommandContext) => Promise<string>;
797
+ readonly description: "Export current Swarm memory to JSONL files";
798
+ readonly aliasOf: "memory export";
799
+ readonly deprecated: true;
800
+ };
801
+ readonly 'memory-import': {
802
+ readonly handler: (ctx: CommandContext) => Promise<string>;
803
+ readonly description: "Import legacy JSONL memory into SQLite";
804
+ readonly aliasOf: "memory import";
805
+ readonly deprecated: true;
806
+ };
807
+ readonly 'memory-migrate': {
808
+ readonly handler: (ctx: CommandContext) => Promise<string>;
809
+ readonly description: "Run the one-time legacy JSONL to SQLite migration";
810
+ readonly aliasOf: "memory migrate";
811
+ readonly deprecated: true;
812
+ };
745
813
  readonly checkpoint: {
746
814
  readonly handler: (ctx: CommandContext) => Promise<string>;
747
815
  readonly description: "Manage project checkpoints [save|restore|delete|list] <label>";
@@ -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"];
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"];
2
2
  interface CopyState {
3
3
  files: number;
4
4
  bytes: number;
@@ -9,13 +9,13 @@ export interface CuratorSummary {
9
9
  session_id: string;
10
10
  last_updated: string;
11
11
  last_phase_covered: number;
12
- /** Running digest extended each phase, never regenerated */
12
+ /** Running digest rebuilt from the capped phase_digests projection */
13
13
  digest: string;
14
- /** Phase-level digests for lookup */
14
+ /** Phase-level digests for lookup, capped to the most recent phases */
15
15
  phase_digests: PhaseDigestEntry[];
16
16
  /** Accumulated compliance observations */
17
17
  compliance_observations: ComplianceObservation[];
18
- /** Knowledge update recommendations from the last curator run */
18
+ /** Accumulated knowledge update recommendations from curator runs */
19
19
  knowledge_recommendations: KnowledgeRecommendation[];
20
20
  }
21
21
  export interface PhaseDigestEntry {
@@ -100,12 +100,17 @@ export interface CuratorConfig {
100
100
  enabled: boolean;
101
101
  init_enabled: boolean;
102
102
  phase_enabled: boolean;
103
+ postmortem_enabled?: boolean;
103
104
  max_summary_tokens: number;
104
105
  min_knowledge_confidence: number;
105
106
  compliance_report: boolean;
106
107
  suppress_warnings: boolean;
107
108
  drift_inject_max_chars: number;
108
109
  llm_timeout_ms?: number;
110
+ skill_generation_enabled?: boolean;
111
+ skill_generation_mode?: 'draft' | 'active';
112
+ min_skill_confidence?: number;
113
+ min_skill_confirmations?: number;
109
114
  }
110
115
  export interface CuratorInitResult {
111
116
  briefing: string;
@@ -38,6 +38,7 @@ import { readSkillUsageEntries } from './skill-usage-log.js';
38
38
  export type CuratorLLMDelegate = (systemPrompt: string, userInput: string, signal?: AbortSignal) => Promise<string>;
39
39
  export declare const _internals: {
40
40
  parseKnowledgeRecommendations: typeof parseKnowledgeRecommendations;
41
+ parseKnowledgeRecommendationsWithDiagnostics: typeof parseKnowledgeRecommendationsWithDiagnostics;
41
42
  readCuratorSummary: typeof readCuratorSummary;
42
43
  writeCuratorSummary: typeof writeCuratorSummary;
43
44
  filterPhaseEvents: typeof filterPhaseEvents;
@@ -53,6 +54,11 @@ export declare const _internals: {
53
54
  reviseSkill: typeof reviseSkill;
54
55
  getSkillVersion: typeof getSkillVersion;
55
56
  };
57
+ export interface RecommendationParseDiagnostic {
58
+ section: 'OBSERVATIONS' | 'KNOWLEDGE_UPDATES';
59
+ line: string;
60
+ reason: string;
61
+ }
56
62
  /**
57
63
  * Auto-retire generated skills whose violation rate exceeds 30% or
58
64
  * whose source knowledge entries are all archived.
@@ -69,6 +75,10 @@ declare function autoRetireSkills(directory: string, curatorKnowledgePath: strin
69
75
  * Action hints are extracted from parenthetical directives like "(suggests boost confidence, mark hive_eligible)"
70
76
  */
71
77
  export declare function parseKnowledgeRecommendations(llmOutput: string): KnowledgeRecommendation[];
78
+ export declare function parseKnowledgeRecommendationsWithDiagnostics(llmOutput: string): {
79
+ recommendations: KnowledgeRecommendation[];
80
+ diagnostics: RecommendationParseDiagnostic[];
81
+ };
72
82
  /**
73
83
  * v2: Strict-JSON parser for the new curator output blocks.
74
84
  *
@@ -82,12 +92,19 @@ export declare function parseKnowledgeRecommendations(llmOutput: string): Knowle
82
92
  * [{ "slug": "...", "title": "...", ... }]
83
93
  * ```
84
94
  *
85
- * Malformed JSON or unexpected types are silently dropped: no knowledge or
86
- * skill writes happen when curator output is malformed.
95
+ * Malformed JSON or unexpected types are skipped with diagnostics: no knowledge
96
+ * or skill writes happen when curator output is malformed.
87
97
  */
98
+ export interface StructuredCuratorDiagnostic {
99
+ block: 'knowledge_application_findings' | 'skill_candidates';
100
+ reason: 'malformed_json' | 'expected_array' | 'invalid_finding' | 'invalid_skill_candidate';
101
+ index?: number;
102
+ detail?: string;
103
+ }
88
104
  export declare function parseStructuredCuratorBlocks(llmOutput: string): {
89
105
  findings: import('./curator-types.js').KnowledgeApplicationFinding[];
90
106
  candidates: import('./curator-types.js').SkillCandidate[];
107
+ diagnostics: StructuredCuratorDiagnostic[];
91
108
  };
92
109
  /**
93
110
  * Read curator summary from .swarm/curator-summary.json
@@ -156,7 +173,7 @@ export declare function runCuratorInit(directory: string, config: CuratorConfig,
156
173
  * @param llmDelegate - Optional LLM delegate for enhanced analysis
157
174
  * @returns CuratorPhaseResult with digest, compliance, and recommendations
158
175
  */
159
- export declare function runCuratorPhase(directory: string, phase: number, agentsDispatched: string[], config: CuratorConfig, _knowledgeConfig: {
176
+ export declare function runCuratorPhase(directory: string, phase: number, agentsDispatched: string[], config: CuratorConfig, knowledgeConfig: {
160
177
  directory?: string;
161
178
  }, llmDelegate?: CuratorLLMDelegate): Promise<CuratorPhaseResult>;
162
179
  /**
@@ -15,6 +15,7 @@ declare const seenRetroSections: Map<string, {
15
15
  declare function capSeenRetroSections(): void;
16
16
  /** Record a seen-section hash and enforce the size cap in one step. */
17
17
  declare function recordSeenRetroSection(key: string, value: string, timestamp: number): void;
18
+ declare function hashContent(content: string): string;
18
19
  /**
19
20
  * Check if the input is a write operation targeting an evidence file.
20
21
  * Exported for testing purposes only.
@@ -107,6 +108,7 @@ export declare const _internals: {
107
108
  createKnowledgeCuratorHook: typeof createKnowledgeCuratorHook;
108
109
  seenRetroSections: typeof seenRetroSections;
109
110
  recordSeenRetroSection: typeof recordSeenRetroSection;
111
+ hashContent: typeof hashContent;
110
112
  capSeenRetroSections: typeof capSeenRetroSections;
111
113
  MAX_TRACKED_RETRO_SECTIONS: number;
112
114
  };
@@ -58,6 +58,12 @@ export declare function createTrajectoryLoggerHook(config: Partial<TrajectoryCon
58
58
  * @param sessionId - Session identifier
59
59
  */
60
60
  export declare function resetTrajectoryStep(sessionId: string): void;
61
+ /**
62
+ * Clears trajectory step counters for one session, or all sessions when omitted.
63
+ *
64
+ * @param sessionId - Optional session identifier
65
+ */
66
+ export declare function clearTrajectoryStep(sessionId?: string): void;
61
67
  /**
62
68
  * Records the start time for a tool call (called from toolBefore).
63
69
  * Stored in a module-level Map for correlation with toolAfter.
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Module-level trajectory step counters shared by runtime reset code and the
3
+ * trajectory logger without creating a state <-> hook import cycle.
4
+ */
5
+ export declare function nextTrajectoryStep(sessionId: string): number;
6
+ export declare function resetTrajectoryStepCounter(sessionId: string): void;
7
+ export declare function clearTrajectoryStepCounters(sessionId?: string): void;
8
+ export declare const _test_exports: {
9
+ MAX_TRACKED_STEP_SESSIONS: number;
10
+ getTrackedStepSessionCount: () => number;
11
+ };