opencode-swarm 7.29.4 → 7.30.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/agents/architect.d.ts +1 -1
- package/dist/cli/index.js +24 -2
- package/dist/config/constants.d.ts +2 -0
- package/dist/config/index.d.ts +2 -2
- package/dist/config/schema.d.ts +35 -0
- package/dist/index.js +1252 -125
- package/dist/memory/config.d.ts +22 -0
- package/dist/memory/errors.d.ts +7 -0
- package/dist/memory/gateway.d.ts +51 -0
- package/dist/memory/index.d.ts +11 -0
- package/dist/memory/local-jsonl-provider.d.ts +26 -0
- package/dist/memory/prompt-block.d.ts +13 -0
- package/dist/memory/provider.d.ts +17 -0
- package/dist/memory/redaction.d.ts +7 -0
- package/dist/memory/schema.d.ts +256 -0
- package/dist/memory/scoring.d.ts +5 -0
- package/dist/memory/types.d.ts +96 -0
- package/dist/tools/index.d.ts +3 -1
- package/dist/tools/swarm-command.d.ts +1 -0
- package/dist/tools/swarm-memory-propose.d.ts +8 -0
- package/dist/tools/swarm-memory-recall.d.ts +8 -0
- package/dist/tools/tool-names.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MemoryKind } from './types';
|
|
2
|
+
export interface MemoryConfig {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
provider: 'local-jsonl';
|
|
5
|
+
storageDir: string;
|
|
6
|
+
recall: {
|
|
7
|
+
defaultMaxItems: number;
|
|
8
|
+
defaultTokenBudget: number;
|
|
9
|
+
minScore: number;
|
|
10
|
+
};
|
|
11
|
+
writes: {
|
|
12
|
+
mode: 'propose';
|
|
13
|
+
};
|
|
14
|
+
redaction: {
|
|
15
|
+
rejectDurableSecrets: boolean;
|
|
16
|
+
};
|
|
17
|
+
hardDelete: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const DEFAULT_MEMORY_CONFIG: MemoryConfig;
|
|
20
|
+
export declare const DURABLE_MEMORY_KINDS: ReadonlySet<MemoryKind>;
|
|
21
|
+
export declare const EVIDENCE_REQUIRED_KINDS: ReadonlySet<MemoryKind>;
|
|
22
|
+
export declare function resolveMemoryConfig(input: Partial<MemoryConfig> | undefined): MemoryConfig;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type MemoryConfig } from './config';
|
|
2
|
+
import type { MemoryProposalStore, MemoryProvider } from './provider';
|
|
3
|
+
import type { MemoryContext, MemoryKind, MemoryProposal, MemoryRecord, MemoryScopeRef, MemorySource, RecallBundle } from './types';
|
|
4
|
+
export interface MemoryGatewayOptions {
|
|
5
|
+
config?: Partial<MemoryConfig>;
|
|
6
|
+
provider?: MemoryProvider & Partial<MemoryProposalStore>;
|
|
7
|
+
now?: () => Date;
|
|
8
|
+
}
|
|
9
|
+
export interface ProposeMemoryInput {
|
|
10
|
+
operation: MemoryProposal['operation'];
|
|
11
|
+
kind?: MemoryKind;
|
|
12
|
+
text?: string;
|
|
13
|
+
targetMemoryId?: string;
|
|
14
|
+
relatedMemoryIds?: string[];
|
|
15
|
+
rationale: string;
|
|
16
|
+
evidenceRefs?: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface RecallMemoryInput {
|
|
19
|
+
query: string;
|
|
20
|
+
task?: string;
|
|
21
|
+
kinds?: MemoryKind[];
|
|
22
|
+
maxItems?: number;
|
|
23
|
+
tokenBudget?: number;
|
|
24
|
+
minScore?: number;
|
|
25
|
+
includeExpired?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class MemoryGateway {
|
|
28
|
+
private readonly context;
|
|
29
|
+
private readonly config;
|
|
30
|
+
private readonly provider;
|
|
31
|
+
private readonly now;
|
|
32
|
+
constructor(context: MemoryContext, options?: MemoryGatewayOptions);
|
|
33
|
+
isEnabled(): boolean;
|
|
34
|
+
deriveAllowedScopes(): MemoryScopeRef[];
|
|
35
|
+
recall(input: RecallMemoryInput): Promise<RecallBundle>;
|
|
36
|
+
propose(input: ProposeMemoryInput): Promise<MemoryProposal>;
|
|
37
|
+
upsertCurated(record: MemoryRecord): Promise<MemoryRecord>;
|
|
38
|
+
createRecord(input: {
|
|
39
|
+
kind: MemoryKind;
|
|
40
|
+
text: string;
|
|
41
|
+
evidenceRefs?: string[];
|
|
42
|
+
source?: MemorySource;
|
|
43
|
+
scope?: MemoryScopeRef;
|
|
44
|
+
confidence?: number;
|
|
45
|
+
stability?: MemoryRecord['stability'];
|
|
46
|
+
tags?: string[];
|
|
47
|
+
metadata?: Record<string, unknown>;
|
|
48
|
+
}): MemoryRecord;
|
|
49
|
+
private assertEnabled;
|
|
50
|
+
}
|
|
51
|
+
export declare function createMemoryGateway(context: MemoryContext, options?: MemoryGatewayOptions): MemoryGateway;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { MemoryConfig } from './config';
|
|
2
|
+
export { DEFAULT_MEMORY_CONFIG, resolveMemoryConfig } from './config';
|
|
3
|
+
export { MemoryDisabledError, MemoryValidationError } from './errors';
|
|
4
|
+
export type { MemoryGatewayOptions, ProposeMemoryInput, RecallMemoryInput, } from './gateway';
|
|
5
|
+
export { createMemoryGateway, MemoryGateway } from './gateway';
|
|
6
|
+
export { LocalJsonlMemoryProvider } from './local-jsonl-provider';
|
|
7
|
+
export { buildRecallPromptBlock } from './prompt-block';
|
|
8
|
+
export type { MemoryProposalStore, MemoryProvider } from './provider';
|
|
9
|
+
export { findSecrets, redactSecrets } from './redaction';
|
|
10
|
+
export { computeMemoryContentHash, createBundleId, createMemoryId, createProposalId, isExpired, normalizeMemoryText, validateMemoryProposal, validateMemoryRecordRules, } from './schema';
|
|
11
|
+
export type { MemoryContext, MemoryKind, MemoryListFilter, MemoryProposal, MemoryRecord, MemoryScopeRef, MemoryScopeType, RecallBundle, RecallRequest, RecallResultItem, } from './types';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type MemoryConfig } from './config';
|
|
2
|
+
import type { MemoryProposalStore, MemoryProvider } from './provider';
|
|
3
|
+
import type { MemoryListFilter, MemoryProposal, MemoryRecord, RecallRequest, RecallResultItem } from './types';
|
|
4
|
+
export declare class LocalJsonlMemoryProvider implements MemoryProvider, MemoryProposalStore {
|
|
5
|
+
readonly name = "local-jsonl";
|
|
6
|
+
private readonly rootDirectory;
|
|
7
|
+
private readonly config;
|
|
8
|
+
private initialized;
|
|
9
|
+
private memories;
|
|
10
|
+
private proposals;
|
|
11
|
+
constructor(rootDirectory: string, config?: Partial<MemoryConfig>);
|
|
12
|
+
private pathFor;
|
|
13
|
+
initialize(): Promise<void>;
|
|
14
|
+
upsert(record: MemoryRecord): Promise<MemoryRecord>;
|
|
15
|
+
get(id: string): Promise<MemoryRecord | null>;
|
|
16
|
+
delete(id: string, reason?: string): Promise<void>;
|
|
17
|
+
recall(request: RecallRequest): Promise<RecallResultItem[]>;
|
|
18
|
+
list(filter?: MemoryListFilter): Promise<MemoryRecord[]>;
|
|
19
|
+
createProposal(proposal: MemoryProposal): Promise<MemoryProposal>;
|
|
20
|
+
listProposals(filter?: {
|
|
21
|
+
status?: MemoryProposal['status'];
|
|
22
|
+
limit?: number;
|
|
23
|
+
}): Promise<MemoryProposal[]>;
|
|
24
|
+
compact(): Promise<void>;
|
|
25
|
+
private audit;
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RecallBundle, RecallResultItem } from './types';
|
|
2
|
+
export declare function buildRecallPromptBlock(items: RecallResultItem[], tokenBudget: number): {
|
|
3
|
+
promptBlock: string;
|
|
4
|
+
tokenEstimate: number;
|
|
5
|
+
items: RecallResultItem[];
|
|
6
|
+
};
|
|
7
|
+
export declare function toRecallBundle(input: {
|
|
8
|
+
id: string;
|
|
9
|
+
query: string;
|
|
10
|
+
generatedAt: string;
|
|
11
|
+
items: RecallResultItem[];
|
|
12
|
+
tokenBudget: number;
|
|
13
|
+
}): RecallBundle;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MemoryListFilter, MemoryProposal, MemoryRecord, RecallRequest, RecallResultItem } from './types';
|
|
2
|
+
export interface MemoryProvider {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
initialize?(): Promise<void>;
|
|
5
|
+
upsert(record: MemoryRecord): Promise<MemoryRecord>;
|
|
6
|
+
get(id: string): Promise<MemoryRecord | null>;
|
|
7
|
+
delete(id: string, reason?: string): Promise<void>;
|
|
8
|
+
recall(request: RecallRequest): Promise<RecallResultItem[]>;
|
|
9
|
+
list(filter: MemoryListFilter): Promise<MemoryRecord[]>;
|
|
10
|
+
}
|
|
11
|
+
export interface MemoryProposalStore {
|
|
12
|
+
createProposal(proposal: MemoryProposal): Promise<MemoryProposal>;
|
|
13
|
+
listProposals(filter?: {
|
|
14
|
+
status?: MemoryProposal['status'];
|
|
15
|
+
limit?: number;
|
|
16
|
+
}): Promise<MemoryProposal[]>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { MemoryKind, MemoryProposal, MemoryRecord, MemoryScopeRef } from './types';
|
|
3
|
+
export declare const MemoryScopeTypeSchema: z.ZodEnum<{
|
|
4
|
+
agent: "agent";
|
|
5
|
+
project: "project";
|
|
6
|
+
run: "run";
|
|
7
|
+
global_user: "global_user";
|
|
8
|
+
workspace: "workspace";
|
|
9
|
+
repository: "repository";
|
|
10
|
+
}>;
|
|
11
|
+
export declare const MemoryScopeRefSchema: z.ZodObject<{
|
|
12
|
+
type: z.ZodEnum<{
|
|
13
|
+
agent: "agent";
|
|
14
|
+
project: "project";
|
|
15
|
+
run: "run";
|
|
16
|
+
global_user: "global_user";
|
|
17
|
+
workspace: "workspace";
|
|
18
|
+
repository: "repository";
|
|
19
|
+
}>;
|
|
20
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
22
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
23
|
+
repoId: z.ZodOptional<z.ZodString>;
|
|
24
|
+
repoRoot: z.ZodOptional<z.ZodString>;
|
|
25
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
26
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
export declare const MemoryKindSchema: z.ZodEnum<{
|
|
29
|
+
evidence: "evidence";
|
|
30
|
+
todo: "todo";
|
|
31
|
+
user_preference: "user_preference";
|
|
32
|
+
project_fact: "project_fact";
|
|
33
|
+
architecture_decision: "architecture_decision";
|
|
34
|
+
repo_convention: "repo_convention";
|
|
35
|
+
api_finding: "api_finding";
|
|
36
|
+
code_pattern: "code_pattern";
|
|
37
|
+
test_pattern: "test_pattern";
|
|
38
|
+
failure_pattern: "failure_pattern";
|
|
39
|
+
security_note: "security_note";
|
|
40
|
+
scratch: "scratch";
|
|
41
|
+
}>;
|
|
42
|
+
export declare const MemorySourceSchema: z.ZodObject<{
|
|
43
|
+
type: z.ZodEnum<{
|
|
44
|
+
agent: "agent";
|
|
45
|
+
file: "file";
|
|
46
|
+
manual: "manual";
|
|
47
|
+
test: "test";
|
|
48
|
+
tool: "tool";
|
|
49
|
+
user: "user";
|
|
50
|
+
commit: "commit";
|
|
51
|
+
repo: "repo";
|
|
52
|
+
web: "web";
|
|
53
|
+
}>;
|
|
54
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
55
|
+
url: z.ZodOptional<z.ZodString>;
|
|
56
|
+
filePath: z.ZodOptional<z.ZodString>;
|
|
57
|
+
commitSha: z.ZodOptional<z.ZodString>;
|
|
58
|
+
createdBy: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, z.core.$strict>;
|
|
60
|
+
export declare const MemoryRecordSchema: z.ZodObject<{
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
scope: z.ZodObject<{
|
|
63
|
+
type: z.ZodEnum<{
|
|
64
|
+
agent: "agent";
|
|
65
|
+
project: "project";
|
|
66
|
+
run: "run";
|
|
67
|
+
global_user: "global_user";
|
|
68
|
+
workspace: "workspace";
|
|
69
|
+
repository: "repository";
|
|
70
|
+
}>;
|
|
71
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
72
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
73
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
74
|
+
repoId: z.ZodOptional<z.ZodString>;
|
|
75
|
+
repoRoot: z.ZodOptional<z.ZodString>;
|
|
76
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
77
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
kind: z.ZodEnum<{
|
|
80
|
+
evidence: "evidence";
|
|
81
|
+
todo: "todo";
|
|
82
|
+
user_preference: "user_preference";
|
|
83
|
+
project_fact: "project_fact";
|
|
84
|
+
architecture_decision: "architecture_decision";
|
|
85
|
+
repo_convention: "repo_convention";
|
|
86
|
+
api_finding: "api_finding";
|
|
87
|
+
code_pattern: "code_pattern";
|
|
88
|
+
test_pattern: "test_pattern";
|
|
89
|
+
failure_pattern: "failure_pattern";
|
|
90
|
+
security_note: "security_note";
|
|
91
|
+
scratch: "scratch";
|
|
92
|
+
}>;
|
|
93
|
+
text: z.ZodString;
|
|
94
|
+
tags: z.ZodArray<z.ZodString>;
|
|
95
|
+
confidence: z.ZodNumber;
|
|
96
|
+
stability: z.ZodEnum<{
|
|
97
|
+
session: "session";
|
|
98
|
+
ephemeral: "ephemeral";
|
|
99
|
+
durable: "durable";
|
|
100
|
+
}>;
|
|
101
|
+
source: z.ZodObject<{
|
|
102
|
+
type: z.ZodEnum<{
|
|
103
|
+
agent: "agent";
|
|
104
|
+
file: "file";
|
|
105
|
+
manual: "manual";
|
|
106
|
+
test: "test";
|
|
107
|
+
tool: "tool";
|
|
108
|
+
user: "user";
|
|
109
|
+
commit: "commit";
|
|
110
|
+
repo: "repo";
|
|
111
|
+
web: "web";
|
|
112
|
+
}>;
|
|
113
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
114
|
+
url: z.ZodOptional<z.ZodString>;
|
|
115
|
+
filePath: z.ZodOptional<z.ZodString>;
|
|
116
|
+
commitSha: z.ZodOptional<z.ZodString>;
|
|
117
|
+
createdBy: z.ZodOptional<z.ZodString>;
|
|
118
|
+
}, z.core.$strict>;
|
|
119
|
+
createdAt: z.ZodString;
|
|
120
|
+
updatedAt: z.ZodString;
|
|
121
|
+
lastAccessedAt: z.ZodOptional<z.ZodString>;
|
|
122
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
123
|
+
supersedes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
124
|
+
supersededBy: z.ZodOptional<z.ZodString>;
|
|
125
|
+
contentHash: z.ZodString;
|
|
126
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
export declare const MemoryProposalSchema: z.ZodObject<{
|
|
129
|
+
id: z.ZodString;
|
|
130
|
+
operation: z.ZodEnum<{
|
|
131
|
+
ignore: "ignore";
|
|
132
|
+
add: "add";
|
|
133
|
+
delete: "delete";
|
|
134
|
+
update: "update";
|
|
135
|
+
merge: "merge";
|
|
136
|
+
supersede: "supersede";
|
|
137
|
+
}>;
|
|
138
|
+
proposedRecord: z.ZodOptional<z.ZodObject<{
|
|
139
|
+
id: z.ZodString;
|
|
140
|
+
scope: z.ZodObject<{
|
|
141
|
+
type: z.ZodEnum<{
|
|
142
|
+
agent: "agent";
|
|
143
|
+
project: "project";
|
|
144
|
+
run: "run";
|
|
145
|
+
global_user: "global_user";
|
|
146
|
+
workspace: "workspace";
|
|
147
|
+
repository: "repository";
|
|
148
|
+
}>;
|
|
149
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
150
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
151
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
152
|
+
repoId: z.ZodOptional<z.ZodString>;
|
|
153
|
+
repoRoot: z.ZodOptional<z.ZodString>;
|
|
154
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
155
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
156
|
+
}, z.core.$strict>;
|
|
157
|
+
kind: z.ZodEnum<{
|
|
158
|
+
evidence: "evidence";
|
|
159
|
+
todo: "todo";
|
|
160
|
+
user_preference: "user_preference";
|
|
161
|
+
project_fact: "project_fact";
|
|
162
|
+
architecture_decision: "architecture_decision";
|
|
163
|
+
repo_convention: "repo_convention";
|
|
164
|
+
api_finding: "api_finding";
|
|
165
|
+
code_pattern: "code_pattern";
|
|
166
|
+
test_pattern: "test_pattern";
|
|
167
|
+
failure_pattern: "failure_pattern";
|
|
168
|
+
security_note: "security_note";
|
|
169
|
+
scratch: "scratch";
|
|
170
|
+
}>;
|
|
171
|
+
text: z.ZodString;
|
|
172
|
+
tags: z.ZodArray<z.ZodString>;
|
|
173
|
+
confidence: z.ZodNumber;
|
|
174
|
+
stability: z.ZodEnum<{
|
|
175
|
+
session: "session";
|
|
176
|
+
ephemeral: "ephemeral";
|
|
177
|
+
durable: "durable";
|
|
178
|
+
}>;
|
|
179
|
+
source: z.ZodObject<{
|
|
180
|
+
type: z.ZodEnum<{
|
|
181
|
+
agent: "agent";
|
|
182
|
+
file: "file";
|
|
183
|
+
manual: "manual";
|
|
184
|
+
test: "test";
|
|
185
|
+
tool: "tool";
|
|
186
|
+
user: "user";
|
|
187
|
+
commit: "commit";
|
|
188
|
+
repo: "repo";
|
|
189
|
+
web: "web";
|
|
190
|
+
}>;
|
|
191
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
192
|
+
url: z.ZodOptional<z.ZodString>;
|
|
193
|
+
filePath: z.ZodOptional<z.ZodString>;
|
|
194
|
+
commitSha: z.ZodOptional<z.ZodString>;
|
|
195
|
+
createdBy: z.ZodOptional<z.ZodString>;
|
|
196
|
+
}, z.core.$strict>;
|
|
197
|
+
createdAt: z.ZodString;
|
|
198
|
+
updatedAt: z.ZodString;
|
|
199
|
+
lastAccessedAt: z.ZodOptional<z.ZodString>;
|
|
200
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
201
|
+
supersedes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
202
|
+
supersededBy: z.ZodOptional<z.ZodString>;
|
|
203
|
+
contentHash: z.ZodString;
|
|
204
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
205
|
+
}, z.core.$strict>>;
|
|
206
|
+
targetMemoryId: z.ZodOptional<z.ZodString>;
|
|
207
|
+
relatedMemoryIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
208
|
+
proposedBy: z.ZodObject<{
|
|
209
|
+
agentRole: z.ZodOptional<z.ZodString>;
|
|
210
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
211
|
+
runId: z.ZodOptional<z.ZodString>;
|
|
212
|
+
}, z.core.$strict>;
|
|
213
|
+
rationale: z.ZodString;
|
|
214
|
+
evidenceRefs: z.ZodArray<z.ZodString>;
|
|
215
|
+
status: z.ZodEnum<{
|
|
216
|
+
approved: "approved";
|
|
217
|
+
rejected: "rejected";
|
|
218
|
+
pending: "pending";
|
|
219
|
+
applied: "applied";
|
|
220
|
+
superseded: "superseded";
|
|
221
|
+
}>;
|
|
222
|
+
reviewer: z.ZodOptional<z.ZodEnum<{
|
|
223
|
+
user: "user";
|
|
224
|
+
controller: "controller";
|
|
225
|
+
curator_agent: "curator_agent";
|
|
226
|
+
auto_policy: "auto_policy";
|
|
227
|
+
}>>;
|
|
228
|
+
reviewedAt: z.ZodOptional<z.ZodString>;
|
|
229
|
+
rejectionReason: z.ZodOptional<z.ZodString>;
|
|
230
|
+
createdAt: z.ZodString;
|
|
231
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
232
|
+
}, z.core.$strict>;
|
|
233
|
+
export declare function normalizeMemoryText(text: string): string;
|
|
234
|
+
export declare function stableScopeKey(scope: MemoryScopeRef): string;
|
|
235
|
+
export declare function computeMemoryContentHash(recordLike: {
|
|
236
|
+
scope: MemoryScopeRef;
|
|
237
|
+
kind: MemoryKind;
|
|
238
|
+
text: string;
|
|
239
|
+
}): string;
|
|
240
|
+
export declare function createMemoryId(recordLike: {
|
|
241
|
+
scope: MemoryScopeRef;
|
|
242
|
+
kind: MemoryKind;
|
|
243
|
+
text: string;
|
|
244
|
+
}): string;
|
|
245
|
+
export declare function createProposalId(input: {
|
|
246
|
+
createdAt: string;
|
|
247
|
+
proposer: string;
|
|
248
|
+
text: string;
|
|
249
|
+
}): string;
|
|
250
|
+
export declare function createBundleId(query: string, generatedAt: string): string;
|
|
251
|
+
export declare function isExpired(record: MemoryRecord, now?: Date): boolean;
|
|
252
|
+
export declare function hasEvidenceSource(record: MemoryRecord): boolean;
|
|
253
|
+
export declare function validateMemoryRecordRules(record: MemoryRecord, options: {
|
|
254
|
+
rejectDurableSecrets: boolean;
|
|
255
|
+
}): MemoryRecord;
|
|
256
|
+
export declare function validateMemoryProposal(proposal: MemoryProposal): MemoryProposal;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { MemoryRecord, MemoryScopeRef, RecallRequest, RecallResultItem } from './types';
|
|
2
|
+
export declare function sameScope(a: MemoryScopeRef, b: MemoryScopeRef): boolean;
|
|
3
|
+
export declare function scopeAllowed(recordScope: MemoryScopeRef, allowedScopes: MemoryScopeRef[]): boolean;
|
|
4
|
+
export declare function scoreMemoryRecord(record: MemoryRecord, request: RecallRequest): RecallResultItem | null;
|
|
5
|
+
export declare function scoreMemoryRecords(records: MemoryRecord[], request: RecallRequest): RecallResultItem[];
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export type MemoryScopeType = 'global_user' | 'workspace' | 'project' | 'repository' | 'run' | 'agent';
|
|
2
|
+
export interface MemoryScopeRef {
|
|
3
|
+
type: MemoryScopeType;
|
|
4
|
+
userId?: string;
|
|
5
|
+
workspaceId?: string;
|
|
6
|
+
projectId?: string;
|
|
7
|
+
repoId?: string;
|
|
8
|
+
repoRoot?: string;
|
|
9
|
+
runId?: string;
|
|
10
|
+
agentId?: string;
|
|
11
|
+
}
|
|
12
|
+
export type MemoryKind = 'user_preference' | 'project_fact' | 'architecture_decision' | 'repo_convention' | 'api_finding' | 'code_pattern' | 'test_pattern' | 'failure_pattern' | 'security_note' | 'evidence' | 'todo' | 'scratch';
|
|
13
|
+
export interface MemorySource {
|
|
14
|
+
type: 'user' | 'agent' | 'tool' | 'file' | 'repo' | 'commit' | 'test' | 'web' | 'manual';
|
|
15
|
+
ref?: string;
|
|
16
|
+
url?: string;
|
|
17
|
+
filePath?: string;
|
|
18
|
+
commitSha?: string;
|
|
19
|
+
createdBy?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface MemoryRecord {
|
|
22
|
+
id: string;
|
|
23
|
+
scope: MemoryScopeRef;
|
|
24
|
+
kind: MemoryKind;
|
|
25
|
+
text: string;
|
|
26
|
+
tags: string[];
|
|
27
|
+
confidence: number;
|
|
28
|
+
stability: 'ephemeral' | 'session' | 'durable';
|
|
29
|
+
source: MemorySource;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
lastAccessedAt?: string;
|
|
33
|
+
expiresAt?: string;
|
|
34
|
+
supersedes?: string[];
|
|
35
|
+
supersededBy?: string;
|
|
36
|
+
contentHash: string;
|
|
37
|
+
metadata: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
export interface MemoryProposal {
|
|
40
|
+
id: string;
|
|
41
|
+
operation: 'add' | 'update' | 'delete' | 'ignore' | 'merge' | 'supersede';
|
|
42
|
+
proposedRecord?: MemoryRecord;
|
|
43
|
+
targetMemoryId?: string;
|
|
44
|
+
relatedMemoryIds?: string[];
|
|
45
|
+
proposedBy: {
|
|
46
|
+
agentRole?: string;
|
|
47
|
+
agentId?: string;
|
|
48
|
+
runId?: string;
|
|
49
|
+
};
|
|
50
|
+
rationale: string;
|
|
51
|
+
evidenceRefs: string[];
|
|
52
|
+
status: 'pending' | 'approved' | 'rejected' | 'superseded' | 'applied';
|
|
53
|
+
reviewer?: 'user' | 'controller' | 'curator_agent' | 'auto_policy';
|
|
54
|
+
reviewedAt?: string;
|
|
55
|
+
rejectionReason?: string;
|
|
56
|
+
createdAt: string;
|
|
57
|
+
metadata: Record<string, unknown>;
|
|
58
|
+
}
|
|
59
|
+
export interface RecallRequest {
|
|
60
|
+
query: string;
|
|
61
|
+
task?: string;
|
|
62
|
+
agentRole?: string;
|
|
63
|
+
scopes: MemoryScopeRef[];
|
|
64
|
+
kinds?: MemoryKind[];
|
|
65
|
+
maxItems: number;
|
|
66
|
+
tokenBudget: number;
|
|
67
|
+
minScore?: number;
|
|
68
|
+
includeExpired?: boolean;
|
|
69
|
+
includePendingProposals?: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface RecallResultItem {
|
|
72
|
+
record: MemoryRecord;
|
|
73
|
+
score: number;
|
|
74
|
+
reason: string;
|
|
75
|
+
}
|
|
76
|
+
export interface RecallBundle {
|
|
77
|
+
id: string;
|
|
78
|
+
query: string;
|
|
79
|
+
generatedAt: string;
|
|
80
|
+
items: RecallResultItem[];
|
|
81
|
+
tokenEstimate: number;
|
|
82
|
+
promptBlock: string;
|
|
83
|
+
}
|
|
84
|
+
export interface MemoryContext {
|
|
85
|
+
directory: string;
|
|
86
|
+
sessionID?: string;
|
|
87
|
+
agentRole?: string;
|
|
88
|
+
agentId?: string;
|
|
89
|
+
runId?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface MemoryListFilter {
|
|
92
|
+
scopes?: MemoryScopeRef[];
|
|
93
|
+
kinds?: MemoryKind[];
|
|
94
|
+
includeExpired?: boolean;
|
|
95
|
+
limit?: number;
|
|
96
|
+
}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -50,7 +50,9 @@ export { skill_inspect } from './skill-inspect';
|
|
|
50
50
|
export { skill_list } from './skill-list';
|
|
51
51
|
export { spec_write } from './spec-write';
|
|
52
52
|
export { submit_phase_council_verdicts } from './submit-phase-council-verdicts';
|
|
53
|
-
export { createSwarmCommandTool } from './swarm-command';
|
|
53
|
+
export { createSwarmCommandTool, swarm_command } from './swarm-command';
|
|
54
|
+
export { swarm_memory_propose } from './swarm-memory-propose';
|
|
55
|
+
export { swarm_memory_recall } from './swarm-memory-recall';
|
|
54
56
|
import { suggestPatch } from './suggest-patch';
|
|
55
57
|
export { suggestPatch };
|
|
56
58
|
export type { SuggestPatchArgs } from './suggest-patch';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { AgentDefinition } from '../agents/index.js';
|
|
2
2
|
import { createSwarmTool } from './create-tool.js';
|
|
3
3
|
export declare function createSwarmCommandTool(agents: Record<string, AgentDefinition>): ReturnType<typeof createSwarmTool>;
|
|
4
|
+
export declare const swarm_command: ReturnType<typeof createSwarmTool>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { loadPluginConfigWithMeta } from '../config';
|
|
2
|
+
import { createMemoryGateway } from '../memory';
|
|
3
|
+
import { createSwarmTool } from './create-tool';
|
|
4
|
+
export declare const swarm_memory_propose: ReturnType<typeof createSwarmTool>;
|
|
5
|
+
export declare const _internals: {
|
|
6
|
+
loadPluginConfigWithMeta: typeof loadPluginConfigWithMeta;
|
|
7
|
+
createMemoryGateway: typeof createMemoryGateway;
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { loadPluginConfigWithMeta } from '../config';
|
|
2
|
+
import { createMemoryGateway } from '../memory';
|
|
3
|
+
import { createSwarmTool } from './create-tool';
|
|
4
|
+
export declare const swarm_memory_recall: ReturnType<typeof createSwarmTool>;
|
|
5
|
+
export declare const _internals: {
|
|
6
|
+
loadPluginConfigWithMeta: typeof loadPluginConfigWithMeta;
|
|
7
|
+
createMemoryGateway: typeof createMemoryGateway;
|
|
8
|
+
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Used for constants and agent setup references.
|
|
4
4
|
*/
|
|
5
5
|
/** Union type of all valid tool names */
|
|
6
|
-
export type ToolName = 'diff' | 'diff_summary' | 'syntax_check' | 'placeholder_scan' | 'imports' | 'lint' | 'secretscan' | 'sast_scan' | 'build_check' | 'pre_check_batch' | 'quality_budget' | 'symbols' | 'complexity_hotspots' | 'schema_drift' | 'todo_extract' | 'evidence_check' | 'check_gate_status' | 'completion_verify' | 'submit_council_verdicts' | 'submit_phase_council_verdicts' | 'declare_council_criteria' | 'sbom_generate' | 'checkpoint' | 'pkg_audit' | 'test_runner' | 'test_impact' | 'mutation_test' | 'generate_mutants' | 'detect_domains' | 'gitingest' | 'retrieve_summary' | 'extract_code_blocks' | 'phase_complete' | 'save_plan' | 'update_task_status' | 'lint_spec' | 'write_retro' | 'write_drift_evidence' | 'write_hallucination_evidence' | 'write_mutation_evidence' | 'declare_scope' | 'knowledge_query' | 'doc_scan' | 'doc_extract' | 'curator_analyze' | 'knowledge_add' | 'knowledge_recall' | 'knowledge_remove' | 'co_change_analyzer' | 'search' | 'batch_symbols' | 'suggest_patch' | 'req_coverage' | 'get_approved_plan' | 'repo_map' | 'get_qa_gate_profile' | 'set_qa_gates' | 'web_search' | 'convene_general_council' | 'write_final_council_evidence' | 'skill_generate' | 'skill_list' | 'skill_apply' | 'skill_inspect' | 'skill_improve' | 'spec_write' | 'knowledge_ack' | 'swarm_command' | 'lean_turbo_plan_lanes' | 'lean_turbo_acquire_locks' | 'lean_turbo_runner_status' | 'lean_turbo_review' | 'lean_turbo_run_phase' | 'lean_turbo_status';
|
|
6
|
+
export type ToolName = 'diff' | 'diff_summary' | 'syntax_check' | 'placeholder_scan' | 'imports' | 'lint' | 'secretscan' | 'sast_scan' | 'build_check' | 'pre_check_batch' | 'quality_budget' | 'symbols' | 'complexity_hotspots' | 'schema_drift' | 'todo_extract' | 'evidence_check' | 'check_gate_status' | 'completion_verify' | 'submit_council_verdicts' | 'submit_phase_council_verdicts' | 'declare_council_criteria' | 'sbom_generate' | 'checkpoint' | 'pkg_audit' | 'test_runner' | 'test_impact' | 'mutation_test' | 'generate_mutants' | 'detect_domains' | 'gitingest' | 'retrieve_summary' | 'extract_code_blocks' | 'phase_complete' | 'save_plan' | 'update_task_status' | 'lint_spec' | 'write_retro' | 'write_drift_evidence' | 'write_hallucination_evidence' | 'write_mutation_evidence' | 'declare_scope' | 'knowledge_query' | 'doc_scan' | 'doc_extract' | 'curator_analyze' | 'knowledge_add' | 'knowledge_recall' | 'knowledge_remove' | 'co_change_analyzer' | 'search' | 'batch_symbols' | 'suggest_patch' | 'req_coverage' | 'get_approved_plan' | 'repo_map' | 'get_qa_gate_profile' | 'set_qa_gates' | 'web_search' | 'convene_general_council' | 'write_final_council_evidence' | 'skill_generate' | 'skill_list' | 'skill_apply' | 'skill_inspect' | 'skill_improve' | 'spec_write' | 'knowledge_ack' | 'swarm_memory_recall' | 'swarm_memory_propose' | 'swarm_command' | 'lean_turbo_plan_lanes' | 'lean_turbo_acquire_locks' | 'lean_turbo_runner_status' | 'lean_turbo_review' | 'lean_turbo_run_phase' | 'lean_turbo_status';
|
|
7
7
|
/** Readonly array of all tool names */
|
|
8
8
|
export declare const TOOL_NAMES: readonly ToolName[];
|
|
9
9
|
/** Set for O(1) tool name validation */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.30.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",
|