opencode-swarm 7.31.0 → 7.32.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.
@@ -18,6 +18,7 @@ export interface ProposeMemoryInput {
18
18
  export interface RecallMemoryInput {
19
19
  query: string;
20
20
  task?: string;
21
+ scopes?: MemoryScopeRef[];
21
22
  kinds?: MemoryKind[];
22
23
  maxItems?: number;
23
24
  tokenBudget?: number;
@@ -3,9 +3,13 @@ export { DEFAULT_MEMORY_CONFIG, resolveMemoryConfig } from './config';
3
3
  export { MemoryDisabledError, MemoryValidationError } from './errors';
4
4
  export type { MemoryGatewayOptions, ProposeMemoryInput, RecallMemoryInput, } from './gateway';
5
5
  export { createMemoryGateway, MemoryGateway } from './gateway';
6
+ export { createMemoryLifecycleHooks, type MemoryLifecycleHookOptions, type MemoryLifecycleHooks, } from './injector';
6
7
  export { LocalJsonlMemoryProvider } from './local-jsonl-provider';
7
8
  export { buildRecallPromptBlock } from './prompt-block';
8
9
  export type { MemoryProposalStore, MemoryProvider } from './provider';
10
+ export { buildMemoryRecallPlan, type MemoryRecallPlan, type MemoryRecallPlannerInput, } from './recall-planner';
9
11
  export { findSecrets, redactSecrets } from './redaction';
12
+ export { MEMORY_RECALL_PROFILES, type MemoryRecallProfile, normalizeMemoryAgentRole, resolveMemoryRecallProfile, } from './role-profiles';
13
+ export { appendMemoryRunLog, sanitizeRunId } from './run-log';
10
14
  export { computeMemoryContentHash, createBundleId, createMemoryId, createProposalId, isExpired, normalizeMemoryText, validateMemoryProposal, validateMemoryRecordRules, } from './schema';
11
15
  export type { MemoryContext, MemoryKind, MemoryListFilter, MemoryProposal, MemoryRecord, MemoryScopeRef, MemoryScopeType, RecallBundle, RecallRequest, RecallResultItem, } from './types';
@@ -0,0 +1,31 @@
1
+ import type { MemoryConfig } from './config';
2
+ import type { MemoryGateway, ProposeMemoryInput } from './gateway';
3
+ import { appendMemoryRunLog } from './run-log';
4
+ import type { MemoryKind } from './types';
5
+ export interface MemoryLifecycleHookOptions {
6
+ directory: string;
7
+ config?: Partial<MemoryConfig>;
8
+ getActiveAgentName?: (sessionID: string | undefined) => string | undefined;
9
+ createGateway?: (context: {
10
+ directory: string;
11
+ sessionID?: string;
12
+ agentRole?: string;
13
+ agentId?: string;
14
+ runId?: string;
15
+ }, options: {
16
+ config?: Partial<MemoryConfig>;
17
+ }) => Pick<MemoryGateway, 'isEnabled' | 'deriveAllowedScopes' | 'recall' | 'propose'>;
18
+ appendRunLog?: typeof appendMemoryRunLog;
19
+ }
20
+ export interface MemoryLifecycleHooks {
21
+ messagesTransform(input: unknown, output: unknown): Promise<void>;
22
+ toolAfter(input: unknown, output: unknown): Promise<void>;
23
+ }
24
+ export declare function createMemoryLifecycleHooks(options: MemoryLifecycleHookOptions): MemoryLifecycleHooks;
25
+ declare function messagesContainRecall(messages: unknown[]): boolean;
26
+ declare function compactText(text: string): string;
27
+ export type { ProposeMemoryInput, MemoryKind };
28
+ export declare const _test_exports: {
29
+ compactText: typeof compactText;
30
+ messagesContainRecall: typeof messagesContainRecall;
31
+ };
@@ -1,5 +1,5 @@
1
1
  import { type MemoryConfig } from './config';
2
- import type { MemoryProposalStore, MemoryProvider } from './provider';
2
+ import type { MemoryProposalStore, MemoryProvider, MemoryRecallUsageEvent } from './provider';
3
3
  import type { MemoryListFilter, MemoryProposal, MemoryRecord, RecallRequest, RecallResultItem } from './types';
4
4
  export declare class LocalJsonlMemoryProvider implements MemoryProvider, MemoryProposalStore {
5
5
  readonly name = "local-jsonl";
@@ -15,6 +15,7 @@ export declare class LocalJsonlMemoryProvider implements MemoryProvider, MemoryP
15
15
  get(id: string): Promise<MemoryRecord | null>;
16
16
  delete(id: string, reason?: string): Promise<void>;
17
17
  recall(request: RecallRequest): Promise<RecallResultItem[]>;
18
+ recordRecallUsage(event: MemoryRecallUsageEvent): Promise<void>;
18
19
  list(filter?: MemoryListFilter): Promise<MemoryRecord[]>;
19
20
  createProposal(proposal: MemoryProposal): Promise<MemoryProposal>;
20
21
  listProposals(filter?: {
@@ -1,5 +1,5 @@
1
1
  import type { RecallBundle, RecallResultItem } from './types';
2
- export declare function buildRecallPromptBlock(items: RecallResultItem[], tokenBudget: number): {
2
+ export declare function buildRecallPromptBlock(items: RecallResultItem[], tokenBudget: number, generatedAt?: string): {
3
3
  promptBlock: string;
4
4
  tokenEstimate: number;
5
5
  items: RecallResultItem[];
@@ -1,4 +1,16 @@
1
1
  import type { MemoryListFilter, MemoryProposal, MemoryRecord, RecallRequest, RecallResultItem } from './types';
2
+ export interface MemoryRecallUsageEvent {
3
+ bundleId: string;
4
+ query: string;
5
+ scopes: RecallRequest['scopes'];
6
+ kinds?: RecallRequest['kinds'];
7
+ memoryIds: string[];
8
+ scores: number[];
9
+ tokenEstimate: number;
10
+ agentRole?: string;
11
+ runId?: string;
12
+ timestamp: string;
13
+ }
2
14
  export interface MemoryProvider {
3
15
  readonly name: string;
4
16
  initialize?(): Promise<void>;
@@ -6,6 +18,7 @@ export interface MemoryProvider {
6
18
  get(id: string): Promise<MemoryRecord | null>;
7
19
  delete(id: string, reason?: string): Promise<void>;
8
20
  recall(request: RecallRequest): Promise<RecallResultItem[]>;
21
+ recordRecallUsage?(event: MemoryRecallUsageEvent): Promise<void>;
9
22
  list(filter: MemoryListFilter): Promise<MemoryRecord[]>;
10
23
  }
11
24
  export interface MemoryProposalStore {
@@ -0,0 +1,26 @@
1
+ import { type MemoryRecallProfile } from './role-profiles';
2
+ import type { MemoryKind, MemoryScopeRef } from './types';
3
+ export interface MemoryRecallPlannerInput {
4
+ userGoal: string;
5
+ runId: string;
6
+ agentRole: string;
7
+ agentId: string;
8
+ agentTask: string;
9
+ projectId?: string;
10
+ repoId?: string;
11
+ repoRoot?: string;
12
+ touchedFiles?: string[];
13
+ currentPlanSummary?: string;
14
+ }
15
+ export interface MemoryRecallPlan {
16
+ query: string;
17
+ scopes: MemoryScopeRef[];
18
+ kinds: MemoryKind[];
19
+ maxItems: number;
20
+ tokenBudget: number;
21
+ }
22
+ export interface BuildMemoryRecallPlanOptions {
23
+ scopes?: MemoryScopeRef[];
24
+ profile?: MemoryRecallProfile;
25
+ }
26
+ export declare function buildMemoryRecallPlan(input: MemoryRecallPlannerInput, options?: BuildMemoryRecallPlanOptions): MemoryRecallPlan;
@@ -0,0 +1,41 @@
1
+ import type { MemoryKind } from './types';
2
+ export interface MemoryRecallProfile {
3
+ kinds: MemoryKind[];
4
+ maxItems: number;
5
+ tokenBudget: number;
6
+ }
7
+ export declare const MEMORY_RECALL_PROFILES: {
8
+ readonly architect: {
9
+ readonly kinds: ["project_fact", "architecture_decision", "repo_convention", "failure_pattern", "security_note"];
10
+ readonly maxItems: 10;
11
+ readonly tokenBudget: 1600;
12
+ };
13
+ readonly sme: {
14
+ readonly kinds: ["api_finding", "code_pattern", "repo_convention", "failure_pattern", "evidence"];
15
+ readonly maxItems: 8;
16
+ readonly tokenBudget: 1200;
17
+ };
18
+ readonly coder: {
19
+ readonly kinds: ["architecture_decision", "repo_convention", "code_pattern", "test_pattern", "failure_pattern"];
20
+ readonly maxItems: 8;
21
+ readonly tokenBudget: 1200;
22
+ };
23
+ readonly qa: {
24
+ readonly kinds: ["test_pattern", "failure_pattern", "repo_convention", "security_note"];
25
+ readonly maxItems: 8;
26
+ readonly tokenBudget: 1200;
27
+ };
28
+ readonly security: {
29
+ readonly kinds: ["security_note", "architecture_decision", "repo_convention", "evidence"];
30
+ readonly maxItems: 8;
31
+ readonly tokenBudget: 1200;
32
+ };
33
+ readonly curator: {
34
+ readonly kinds: ["project_fact", "architecture_decision", "repo_convention", "api_finding", "code_pattern", "test_pattern", "failure_pattern", "security_note", "evidence"];
35
+ readonly maxItems: 20;
36
+ readonly tokenBudget: 3000;
37
+ };
38
+ };
39
+ export type MemoryRecallProfileName = keyof typeof MEMORY_RECALL_PROFILES;
40
+ export declare function resolveMemoryRecallProfile(agentRole: string | undefined): MemoryRecallProfile;
41
+ export declare function normalizeMemoryAgentRole(agentRole: string | undefined): MemoryRecallProfileName;
@@ -0,0 +1,17 @@
1
+ export type MemoryRunLogEventName = 'recall_requested' | 'recall_returned' | 'prompt_injected' | 'proposal_created' | 'proposal_rejected_by_validation';
2
+ export interface MemoryRunLogEvent {
3
+ event: MemoryRunLogEventName;
4
+ runId: string;
5
+ agentRole?: string;
6
+ agentId?: string;
7
+ bundleId?: string;
8
+ memoryIds?: string[];
9
+ scores?: number[];
10
+ tokenEstimate?: number;
11
+ proposalId?: string;
12
+ rejectionReason?: string;
13
+ timestamp?: string;
14
+ metadata?: Record<string, unknown>;
15
+ }
16
+ export declare function appendMemoryRunLog(directory: string, runId: string | undefined, event: MemoryRunLogEvent): Promise<void>;
17
+ export declare function sanitizeRunId(runId: string | undefined): string;
@@ -41,8 +41,8 @@ export declare const MemoryKindSchema: z.ZodEnum<{
41
41
  }>;
42
42
  export declare const MemorySourceSchema: z.ZodObject<{
43
43
  type: z.ZodEnum<{
44
- agent: "agent";
45
44
  file: "file";
45
+ agent: "agent";
46
46
  manual: "manual";
47
47
  test: "test";
48
48
  tool: "tool";
@@ -100,8 +100,8 @@ export declare const MemoryRecordSchema: z.ZodObject<{
100
100
  }>;
101
101
  source: z.ZodObject<{
102
102
  type: z.ZodEnum<{
103
- agent: "agent";
104
103
  file: "file";
104
+ agent: "agent";
105
105
  manual: "manual";
106
106
  test: "test";
107
107
  tool: "tool";
@@ -178,8 +178,8 @@ export declare const MemoryProposalSchema: z.ZodObject<{
178
178
  }>;
179
179
  source: z.ZodObject<{
180
180
  type: z.ZodEnum<{
181
- agent: "agent";
182
181
  file: "file";
182
+ agent: "agent";
183
183
  manual: "manual";
184
184
  test: "test";
185
185
  tool: "tool";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.31.0",
3
+ "version": "7.32.1",
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",