opencode-swarm 7.32.2 → 7.33.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.
@@ -1,12 +1,23 @@
1
1
  import type { MemoryKind } from './types';
2
2
  export interface MemoryConfig {
3
3
  enabled: boolean;
4
- provider: 'local-jsonl';
4
+ provider: 'local-jsonl' | 'sqlite';
5
5
  storageDir: string;
6
+ sqlite: {
7
+ path: string;
8
+ busyTimeoutMs: number;
9
+ };
6
10
  recall: {
7
11
  defaultMaxItems: number;
8
12
  defaultTokenBudget: number;
9
13
  minScore: number;
14
+ injection: {
15
+ enabled: boolean;
16
+ minScore: number;
17
+ requireQuerySignal: boolean;
18
+ maxItems: number;
19
+ tokenBudget: number;
20
+ };
10
21
  };
11
22
  writes: {
12
23
  mode: 'propose';
@@ -1,6 +1,6 @@
1
1
  import { type MemoryConfig } from './config';
2
2
  import type { MemoryProposalStore, MemoryProvider } from './provider';
3
- import type { MemoryContext, MemoryKind, MemoryProposal, MemoryRecord, MemoryScopeRef, MemorySource, RecallBundle } from './types';
3
+ import type { MemoryContext, MemoryKind, MemoryProposal, MemoryRecord, MemoryScopeRef, MemorySource, RecallBundle, RecallMode } from './types';
4
4
  export interface MemoryGatewayOptions {
5
5
  config?: Partial<MemoryConfig>;
6
6
  provider?: MemoryProvider & Partial<MemoryProposalStore>;
@@ -18,11 +18,13 @@ export interface ProposeMemoryInput {
18
18
  export interface RecallMemoryInput {
19
19
  query: string;
20
20
  task?: string;
21
+ mode?: RecallMode;
21
22
  scopes?: MemoryScopeRef[];
22
23
  kinds?: MemoryKind[];
23
24
  maxItems?: number;
24
25
  tokenBudget?: number;
25
26
  minScore?: number;
27
+ requireQuerySignal?: boolean;
26
28
  includeExpired?: boolean;
27
29
  }
28
30
  export declare class MemoryGateway {
@@ -32,6 +34,7 @@ export declare class MemoryGateway {
32
34
  private readonly now;
33
35
  constructor(context: MemoryContext, options?: MemoryGatewayOptions);
34
36
  isEnabled(): boolean;
37
+ dispose(): Promise<void>;
35
38
  deriveAllowedScopes(): MemoryScopeRef[];
36
39
  recall(input: RecallMemoryInput): Promise<RecallBundle>;
37
40
  propose(input: ProposeMemoryInput): Promise<MemoryProposal>;
@@ -50,3 +53,4 @@ export declare class MemoryGateway {
50
53
  private assertEnabled;
51
54
  }
52
55
  export declare function createMemoryGateway(context: MemoryContext, options?: MemoryGatewayOptions): MemoryGateway;
56
+ export declare function createConfiguredMemoryProvider(directory: string, config: MemoryConfig): MemoryProvider & MemoryProposalStore;
@@ -2,7 +2,7 @@ export type { MemoryConfig } from './config';
2
2
  export { DEFAULT_MEMORY_CONFIG, resolveMemoryConfig } from './config';
3
3
  export { MemoryDisabledError, MemoryValidationError } from './errors';
4
4
  export type { MemoryGatewayOptions, ProposeMemoryInput, RecallMemoryInput, } from './gateway';
5
- export { createMemoryGateway, MemoryGateway } from './gateway';
5
+ export { createConfiguredMemoryProvider, createMemoryGateway, MemoryGateway, } from './gateway';
6
6
  export { createMemoryLifecycleHooks, type MemoryLifecycleHookOptions, type MemoryLifecycleHooks, } from './injector';
7
7
  export { LocalJsonlMemoryProvider } from './local-jsonl-provider';
8
8
  export { buildRecallPromptBlock } from './prompt-block';
@@ -12,4 +12,5 @@ export { findSecrets, redactSecrets } from './redaction';
12
12
  export { MEMORY_RECALL_PROFILES, type MemoryRecallProfile, normalizeMemoryAgentRole, resolveMemoryRecallProfile, } from './role-profiles';
13
13
  export { appendMemoryRunLog, sanitizeRunId } from './run-log';
14
14
  export { computeMemoryContentHash, createBundleId, createMemoryId, createProposalId, isExpired, normalizeMemoryText, validateMemoryProposal, validateMemoryRecordRules, } from './schema';
15
- export type { MemoryContext, MemoryKind, MemoryListFilter, MemoryProposal, MemoryRecord, MemoryScopeRef, MemoryScopeType, RecallBundle, RecallRequest, RecallResultItem, } from './types';
15
+ export { SQLiteMemoryProvider } from './sqlite-provider';
16
+ export type { MemoryContext, MemoryKind, MemoryListFilter, MemoryProposal, MemoryRecord, MemoryScopeRef, MemoryScopeType, RecallBundle, RecallInjectionSkipReason, RecallMode, RecallRequest, RecallResultItem, } from './types';
@@ -1,4 +1,4 @@
1
- import type { MemoryConfig } from './config';
1
+ import { type MemoryConfig } from './config';
2
2
  import type { MemoryGateway, ProposeMemoryInput } from './gateway';
3
3
  import { appendMemoryRunLog } from './run-log';
4
4
  import type { MemoryKind } from './types';
@@ -1,5 +1,6 @@
1
1
  import { type MemoryConfig } from './config';
2
2
  import type { MemoryProposalStore, MemoryProvider, MemoryRecallUsageEvent } from './provider';
3
+ import type { RecallScoringDiagnostics } from './scoring';
3
4
  import type { MemoryListFilter, MemoryProposal, MemoryRecord, RecallRequest, RecallResultItem } from './types';
4
5
  export declare class LocalJsonlMemoryProvider implements MemoryProvider, MemoryProposalStore {
5
6
  readonly name = "local-jsonl";
@@ -15,6 +16,10 @@ export declare class LocalJsonlMemoryProvider implements MemoryProvider, MemoryP
15
16
  get(id: string): Promise<MemoryRecord | null>;
16
17
  delete(id: string, reason?: string): Promise<void>;
17
18
  recall(request: RecallRequest): Promise<RecallResultItem[]>;
19
+ recallWithDiagnostics(request: RecallRequest): Promise<{
20
+ items: RecallResultItem[];
21
+ diagnostics: RecallScoringDiagnostics;
22
+ }>;
18
23
  recordRecallUsage(event: MemoryRecallUsageEvent): Promise<void>;
19
24
  list(filter?: MemoryListFilter): Promise<MemoryRecord[]>;
20
25
  createProposal(proposal: MemoryProposal): Promise<MemoryProposal>;
@@ -10,4 +10,5 @@ export declare function toRecallBundle(input: {
10
10
  generatedAt: string;
11
11
  items: RecallResultItem[];
12
12
  tokenBudget: number;
13
+ diagnostics?: RecallBundle['diagnostics'];
13
14
  }): RecallBundle;
@@ -1,4 +1,9 @@
1
+ import type { RecallScoringDiagnostics } from './scoring';
1
2
  import type { MemoryListFilter, MemoryProposal, MemoryRecord, RecallRequest, RecallResultItem } from './types';
3
+ export interface MemoryRecallResult {
4
+ items: RecallResultItem[];
5
+ diagnostics?: RecallScoringDiagnostics;
6
+ }
2
7
  export interface MemoryRecallUsageEvent {
3
8
  bundleId: string;
4
9
  query: string;
@@ -14,10 +19,12 @@ export interface MemoryRecallUsageEvent {
14
19
  export interface MemoryProvider {
15
20
  readonly name: string;
16
21
  initialize?(): Promise<void>;
22
+ close?(): Promise<void> | void;
17
23
  upsert(record: MemoryRecord): Promise<MemoryRecord>;
18
24
  get(id: string): Promise<MemoryRecord | null>;
19
25
  delete(id: string, reason?: string): Promise<void>;
20
26
  recall(request: RecallRequest): Promise<RecallResultItem[]>;
27
+ recallWithDiagnostics?(request: RecallRequest): Promise<MemoryRecallResult>;
21
28
  recordRecallUsage?(event: MemoryRecallUsageEvent): Promise<void>;
22
29
  list(filter: MemoryListFilter): Promise<MemoryRecord[]>;
23
30
  }
@@ -1,4 +1,4 @@
1
- export type MemoryRunLogEventName = 'recall_requested' | 'recall_returned' | 'prompt_injected' | 'proposal_created' | 'proposal_rejected_by_validation';
1
+ export type MemoryRunLogEventName = 'recall_requested' | 'recall_returned' | 'prompt_injection_skipped' | 'prompt_injected' | 'proposal_created' | 'proposal_rejected_by_validation';
2
2
  export interface MemoryRunLogEvent {
3
3
  event: MemoryRunLogEventName;
4
4
  runId: string;
@@ -1,5 +1,17 @@
1
1
  import type { MemoryRecord, MemoryScopeRef, RecallRequest, RecallResultItem } from './types';
2
+ export interface RecallScoringDiagnostics {
3
+ candidateCount: number;
4
+ preScoredFilteredCount: number;
5
+ scoredCount: number;
6
+ returnedCount: number;
7
+ noSignalCount: number;
8
+ belowThresholdCount: number;
9
+ }
2
10
  export declare function sameScope(a: MemoryScopeRef, b: MemoryScopeRef): boolean;
3
11
  export declare function scopeAllowed(recordScope: MemoryScopeRef, allowedScopes: MemoryScopeRef[]): boolean;
4
12
  export declare function scoreMemoryRecord(record: MemoryRecord, request: RecallRequest): RecallResultItem | null;
5
13
  export declare function scoreMemoryRecords(records: MemoryRecord[], request: RecallRequest): RecallResultItem[];
14
+ export declare function scoreMemoryRecordsWithDiagnostics(records: MemoryRecord[], request: RecallRequest): {
15
+ items: RecallResultItem[];
16
+ diagnostics: RecallScoringDiagnostics;
17
+ };
@@ -0,0 +1,39 @@
1
+ import { type MemoryConfig } from './config';
2
+ import type { MemoryProposalStore, MemoryProvider, MemoryRecallUsageEvent } from './provider';
3
+ import type { RecallScoringDiagnostics } from './scoring';
4
+ import type { MemoryListFilter, MemoryProposal, MemoryRecord, RecallRequest, RecallResultItem } from './types';
5
+ export declare class SQLiteMemoryProvider implements MemoryProvider, MemoryProposalStore {
6
+ readonly name = "sqlite";
7
+ private readonly rootDirectory;
8
+ private readonly config;
9
+ private initialized;
10
+ private db;
11
+ private memories;
12
+ private proposals;
13
+ constructor(rootDirectory: string, config?: Partial<MemoryConfig>);
14
+ private databasePath;
15
+ initialize(): Promise<void>;
16
+ upsert(record: MemoryRecord): Promise<MemoryRecord>;
17
+ get(id: string): Promise<MemoryRecord | null>;
18
+ delete(id: string, reason?: string): Promise<void>;
19
+ recall(request: RecallRequest): Promise<RecallResultItem[]>;
20
+ recallWithDiagnostics(request: RecallRequest): Promise<{
21
+ items: RecallResultItem[];
22
+ diagnostics: RecallScoringDiagnostics;
23
+ }>;
24
+ recordRecallUsage(event: MemoryRecallUsageEvent): Promise<void>;
25
+ list(filter?: MemoryListFilter): Promise<MemoryRecord[]>;
26
+ createProposal(proposal: MemoryProposal): Promise<MemoryProposal>;
27
+ listProposals(filter?: {
28
+ status?: MemoryProposal['status'];
29
+ limit?: number;
30
+ }): Promise<MemoryProposal[]>;
31
+ close(): void;
32
+ private runMigrations;
33
+ private loadMemories;
34
+ private loadProposals;
35
+ private writeMemory;
36
+ private event;
37
+ private insertEvent;
38
+ private requireDb;
39
+ }
@@ -56,15 +56,19 @@ export interface MemoryProposal {
56
56
  createdAt: string;
57
57
  metadata: Record<string, unknown>;
58
58
  }
59
+ export type RecallMode = 'manual' | 'injection' | 'curator' | 'evaluation';
60
+ export type RecallInjectionSkipReason = 'disabled' | 'no_signal' | 'below_threshold' | 'no_results';
59
61
  export interface RecallRequest {
60
62
  query: string;
61
63
  task?: string;
62
64
  agentRole?: string;
65
+ mode?: RecallMode;
63
66
  scopes: MemoryScopeRef[];
64
67
  kinds?: MemoryKind[];
65
68
  maxItems: number;
66
69
  tokenBudget: number;
67
70
  minScore?: number;
71
+ requireQuerySignal?: boolean;
68
72
  includeExpired?: boolean;
69
73
  includePendingProposals?: boolean;
70
74
  }
@@ -72,6 +76,14 @@ export interface RecallResultItem {
72
76
  record: MemoryRecord;
73
77
  score: number;
74
78
  reason: string;
79
+ signals: {
80
+ textOverlap: number;
81
+ tagOverlap: number;
82
+ fileOverlap?: number;
83
+ symbolOverlap?: number;
84
+ kindMatch: boolean;
85
+ scopeMatch: boolean;
86
+ };
75
87
  }
76
88
  export interface RecallBundle {
77
89
  id: string;
@@ -80,6 +92,13 @@ export interface RecallBundle {
80
92
  items: RecallResultItem[];
81
93
  tokenEstimate: number;
82
94
  promptBlock: string;
95
+ diagnostics?: {
96
+ injectionSkipReason?: RecallInjectionSkipReason;
97
+ candidateCount?: number;
98
+ preScoredFilteredCount?: number;
99
+ noSignalCount?: number;
100
+ belowThresholdCount?: number;
101
+ };
83
102
  }
84
103
  export interface MemoryContext {
85
104
  directory: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.32.2",
3
+ "version": "7.33.0",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",