@slashml/memory 1.0.13 → 1.0.15
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/README.md +29 -1
- package/bin/cli.js +881 -113
- package/dist/index.d.ts +188 -6
- package/dist/index.js +439 -76
- package/dist/index.mjs +1 -0
- package/package.json +2 -2
- package/src/index.ts +727 -89
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
export declare const DEFAULT_BASE_URL = "https://api.slashml.ai";
|
|
7
7
|
export declare const DEFAULT_MODEL = "slashml-1.5-fast";
|
|
8
8
|
export declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
9
|
+
export type RedactBucket = "SECRET" | "PCI_FINANCIAL" | "PII" | "PHI" | "COMMERCIAL_MNPI" | "LEGAL_HR" | "SECURITY_EXPLOIT";
|
|
10
|
+
export type RedactPreset = "off" | "tier1_secrets" | "soc2_coding" | "gdpr" | "hipaa" | "enterprise_strict";
|
|
11
|
+
export type RedactPolicy = RedactPreset | RedactBucket[] | string | string[];
|
|
12
|
+
export type RedactScope = "memorize_and_recall" | "recall_only";
|
|
13
|
+
export type AccessMode = "read_write" | "read_only";
|
|
9
14
|
export interface MemoryClientOptions {
|
|
10
15
|
apiKey?: string;
|
|
11
16
|
api_key?: string;
|
|
@@ -17,6 +22,14 @@ export interface MemoryClientOptions {
|
|
|
17
22
|
org_id?: string;
|
|
18
23
|
projectId?: string;
|
|
19
24
|
project_id?: string;
|
|
25
|
+
agentId?: string;
|
|
26
|
+
agent_id?: string;
|
|
27
|
+
callerAgentId?: string;
|
|
28
|
+
caller_agent_id?: string;
|
|
29
|
+
redactPolicy?: RedactPolicy;
|
|
30
|
+
redact_policy?: RedactPolicy;
|
|
31
|
+
redactScope?: RedactScope;
|
|
32
|
+
redact_scope?: RedactScope;
|
|
20
33
|
model?: string;
|
|
21
34
|
timeoutMs?: number;
|
|
22
35
|
fetchImpl?: typeof fetch;
|
|
@@ -32,6 +45,12 @@ export interface MemoryFilters {
|
|
|
32
45
|
runId?: string | null;
|
|
33
46
|
metadata?: Record<string, unknown> | null;
|
|
34
47
|
filters?: Record<string, unknown> | null;
|
|
48
|
+
redact_policy?: RedactPolicy;
|
|
49
|
+
redactPolicy?: RedactPolicy;
|
|
50
|
+
redact_scope?: RedactScope;
|
|
51
|
+
redactScope?: RedactScope;
|
|
52
|
+
caller_agent_id?: string | null;
|
|
53
|
+
callerAgentId?: string | null;
|
|
35
54
|
}
|
|
36
55
|
export interface AddMemoryOptions extends MemoryFilters {
|
|
37
56
|
infer?: boolean;
|
|
@@ -48,14 +67,91 @@ export interface IngestOptions {
|
|
|
48
67
|
namespace?: string;
|
|
49
68
|
model?: string;
|
|
50
69
|
metadata?: Record<string, unknown>;
|
|
70
|
+
redact_policy?: RedactPolicy;
|
|
71
|
+
redactPolicy?: RedactPolicy;
|
|
72
|
+
redact_scope?: RedactScope;
|
|
73
|
+
redactScope?: RedactScope;
|
|
74
|
+
caller_agent_id?: string;
|
|
75
|
+
callerAgentId?: string;
|
|
51
76
|
}
|
|
52
77
|
export interface QueryOptions {
|
|
53
78
|
namespace?: string;
|
|
54
79
|
model?: string;
|
|
55
80
|
top_k?: number;
|
|
81
|
+
redact_policy?: RedactPolicy;
|
|
82
|
+
redactPolicy?: RedactPolicy;
|
|
83
|
+
redact_scope?: RedactScope;
|
|
84
|
+
redactScope?: RedactScope;
|
|
85
|
+
caller_agent_id?: string;
|
|
86
|
+
callerAgentId?: string;
|
|
56
87
|
}
|
|
57
88
|
export interface ForgetOptions {
|
|
58
89
|
namespace?: string;
|
|
90
|
+
purge?: boolean;
|
|
91
|
+
reason?: string;
|
|
92
|
+
caller_agent_id?: string;
|
|
93
|
+
callerAgentId?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface RedactOptions {
|
|
96
|
+
text?: string;
|
|
97
|
+
memory_id?: string;
|
|
98
|
+
memoryId?: string;
|
|
99
|
+
redact_policy?: RedactPolicy;
|
|
100
|
+
redactPolicy?: RedactPolicy;
|
|
101
|
+
explicit_spans?: Array<Record<string, unknown>>;
|
|
102
|
+
explicitSpans?: Array<Record<string, unknown>>;
|
|
103
|
+
dry_run?: boolean;
|
|
104
|
+
dryRun?: boolean;
|
|
105
|
+
caller_agent_id?: string;
|
|
106
|
+
callerAgentId?: string;
|
|
107
|
+
}
|
|
108
|
+
export interface PurgeOptions {
|
|
109
|
+
dry_run?: boolean;
|
|
110
|
+
dryRun?: boolean;
|
|
111
|
+
reason?: string;
|
|
112
|
+
caller_agent_id?: string;
|
|
113
|
+
callerAgentId?: string;
|
|
114
|
+
}
|
|
115
|
+
export interface UndoOptions {
|
|
116
|
+
caller_agent_id?: string;
|
|
117
|
+
callerAgentId?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface UpdateRedactionPolicyOptions {
|
|
120
|
+
redact_policy?: RedactPolicy;
|
|
121
|
+
redactPolicy?: RedactPolicy;
|
|
122
|
+
redact_scope?: RedactScope;
|
|
123
|
+
redactScope?: RedactScope;
|
|
124
|
+
access_mode?: AccessMode;
|
|
125
|
+
accessMode?: AccessMode;
|
|
126
|
+
allow_write?: boolean;
|
|
127
|
+
allowWrite?: boolean;
|
|
128
|
+
}
|
|
129
|
+
export interface PreviewRedactionOptions {
|
|
130
|
+
text?: string;
|
|
131
|
+
agent_id?: string;
|
|
132
|
+
agentId?: string;
|
|
133
|
+
redact_policy?: RedactPolicy;
|
|
134
|
+
redactPolicy?: RedactPolicy;
|
|
135
|
+
redact_scope?: RedactScope;
|
|
136
|
+
redactScope?: RedactScope;
|
|
137
|
+
}
|
|
138
|
+
export interface ConfigureAgentOptions {
|
|
139
|
+
agent_id?: string;
|
|
140
|
+
agentId?: string;
|
|
141
|
+
name?: string | null;
|
|
142
|
+
access_mode?: AccessMode;
|
|
143
|
+
accessMode?: AccessMode;
|
|
144
|
+
allow_write?: boolean;
|
|
145
|
+
allowWrite?: boolean;
|
|
146
|
+
redact_policy?: RedactPolicy;
|
|
147
|
+
redactPolicy?: RedactPolicy;
|
|
148
|
+
redact_scope?: RedactScope;
|
|
149
|
+
redactScope?: RedactScope;
|
|
150
|
+
inherit_policy?: boolean;
|
|
151
|
+
inheritPolicy?: boolean;
|
|
152
|
+
inherit_access?: boolean;
|
|
153
|
+
inheritAccess?: boolean;
|
|
154
|
+
metadata?: Record<string, unknown>;
|
|
59
155
|
}
|
|
60
156
|
export interface InterveneOptions {
|
|
61
157
|
hook_event_name?: string;
|
|
@@ -85,6 +181,12 @@ export interface InterveneOptions {
|
|
|
85
181
|
commitWrites?: boolean;
|
|
86
182
|
top_k?: number;
|
|
87
183
|
topK?: number;
|
|
184
|
+
redact_policy?: RedactPolicy;
|
|
185
|
+
redactPolicy?: RedactPolicy;
|
|
186
|
+
redact_scope?: RedactScope;
|
|
187
|
+
redactScope?: RedactScope;
|
|
188
|
+
caller_agent_id?: string | null;
|
|
189
|
+
callerAgentId?: string | null;
|
|
88
190
|
client_raw_tokens_delta?: number;
|
|
89
191
|
clientRawTokensDelta?: number;
|
|
90
192
|
client_dropped_tokens_delta?: number;
|
|
@@ -104,6 +206,7 @@ export interface StatusOptions {
|
|
|
104
206
|
}
|
|
105
207
|
export declare class SlashMLAPIError extends Error {
|
|
106
208
|
readonly statusCode: number;
|
|
209
|
+
readonly status: number;
|
|
107
210
|
readonly details: Record<string, unknown>;
|
|
108
211
|
constructor(statusCode: number, message: string, details?: Record<string, unknown>);
|
|
109
212
|
}
|
|
@@ -137,23 +240,59 @@ export declare class ProjectManager {
|
|
|
137
240
|
email: string;
|
|
138
241
|
}): Promise<Record<string, unknown>>;
|
|
139
242
|
}
|
|
243
|
+
export declare class AgentsManager {
|
|
244
|
+
private readonly client;
|
|
245
|
+
constructor(client: MemoryClient);
|
|
246
|
+
list(): Promise<Record<string, unknown>>;
|
|
247
|
+
configure(agentIdOrOptions: string | ConfigureAgentOptions, options?: ConfigureAgentOptions): Promise<Record<string, unknown>>;
|
|
248
|
+
upsert(agentIdOrOptions: string | ConfigureAgentOptions, options?: ConfigureAgentOptions): Promise<Record<string, unknown>>;
|
|
249
|
+
delete(agentId: string): Promise<Record<string, unknown>>;
|
|
250
|
+
}
|
|
140
251
|
export declare class MemoryClient {
|
|
141
252
|
readonly apiKey: string;
|
|
142
253
|
readonly baseUrl: string;
|
|
143
254
|
readonly orgId: string | null;
|
|
144
255
|
readonly projectId: string | null;
|
|
256
|
+
readonly agentId: string | null;
|
|
257
|
+
readonly callerAgentId: string | null;
|
|
258
|
+
readonly redactPolicy: string | string[] | null;
|
|
259
|
+
readonly redactScope: RedactScope | null;
|
|
145
260
|
readonly model: string;
|
|
146
261
|
readonly timeoutMs: number;
|
|
147
262
|
readonly project: ProjectManager;
|
|
263
|
+
readonly agents: AgentsManager;
|
|
148
264
|
private readonly fetchImpl;
|
|
149
265
|
constructor(options?: MemoryClientOptions);
|
|
266
|
+
private applyLifecycleDefaults;
|
|
150
267
|
request<T = Record<string, unknown>>(method: string, path: string, options?: {
|
|
151
268
|
params?: Record<string, unknown>;
|
|
152
269
|
jsonBody?: Record<string, unknown>;
|
|
270
|
+
headers?: Record<string, string>;
|
|
153
271
|
}): Promise<T>;
|
|
154
272
|
ingest(documents: string | string[], options?: IngestOptions): Promise<Record<string, unknown>>;
|
|
155
273
|
query(prompt: string, options?: QueryOptions): Promise<Record<string, unknown>>;
|
|
156
274
|
forget(target: string, options?: ForgetOptions): Promise<Record<string, unknown>>;
|
|
275
|
+
redact(textOrOptions: string | RedactOptions, options?: RedactOptions): Promise<Record<string, unknown>>;
|
|
276
|
+
purge(memoryIds: string | string[], options?: PurgeOptions): Promise<Record<string, unknown>>;
|
|
277
|
+
undo(undoToken: string, options?: UndoOptions): Promise<Record<string, unknown>>;
|
|
278
|
+
getRedactionPolicy(): Promise<Record<string, unknown>>;
|
|
279
|
+
get_redaction_policy(): Promise<Record<string, unknown>>;
|
|
280
|
+
updateRedactionPolicy(options?: UpdateRedactionPolicyOptions): Promise<Record<string, unknown>>;
|
|
281
|
+
update_redaction_policy(options?: UpdateRedactionPolicyOptions): Promise<Record<string, unknown>>;
|
|
282
|
+
previewRedaction(textOrOptions: string | PreviewRedactionOptions, options?: PreviewRedactionOptions): Promise<Record<string, unknown>>;
|
|
283
|
+
preview_redaction(textOrOptions: string | PreviewRedactionOptions, options?: PreviewRedactionOptions): Promise<Record<string, unknown>>;
|
|
284
|
+
listAgents(): Promise<Record<string, unknown>>;
|
|
285
|
+
listAgentPolicies(): Promise<Record<string, unknown>>;
|
|
286
|
+
list_agents(): Promise<Record<string, unknown>>;
|
|
287
|
+
list_agent_policies(): Promise<Record<string, unknown>>;
|
|
288
|
+
configureAgent(agentIdOrOptions: string | ConfigureAgentOptions, options?: ConfigureAgentOptions): Promise<Record<string, unknown>>;
|
|
289
|
+
upsertAgentPolicy(agentIdOrOptions: string | ConfigureAgentOptions, options?: ConfigureAgentOptions): Promise<Record<string, unknown>>;
|
|
290
|
+
configure_agent(agentIdOrOptions: string | ConfigureAgentOptions, options?: ConfigureAgentOptions): Promise<Record<string, unknown>>;
|
|
291
|
+
upsert_agent_policy(agentIdOrOptions: string | ConfigureAgentOptions, options?: ConfigureAgentOptions): Promise<Record<string, unknown>>;
|
|
292
|
+
deleteAgent(agentId: string): Promise<Record<string, unknown>>;
|
|
293
|
+
deleteAgentPolicy(agentId: string): Promise<Record<string, unknown>>;
|
|
294
|
+
delete_agent(agentId: string): Promise<Record<string, unknown>>;
|
|
295
|
+
delete_agent_policy(agentId: string): Promise<Record<string, unknown>>;
|
|
157
296
|
intervene(textOrPayload: string | InterveneOptions, options?: InterveneOptions): Promise<Record<string, unknown>>;
|
|
158
297
|
status(options?: StatusOptions): Promise<Record<string, unknown>>;
|
|
159
298
|
add(messages: string | Array<Record<string, unknown>> | Record<string, unknown>, options?: AddMemoryOptions): Promise<Record<string, unknown>>;
|
|
@@ -169,20 +308,63 @@ export declare class MemoryClient {
|
|
|
169
308
|
get_all(options?: MemoryFilters & {
|
|
170
309
|
limit?: number;
|
|
171
310
|
}): Promise<Record<string, unknown>>;
|
|
172
|
-
get(memoryId: string
|
|
311
|
+
get(memoryId: string, options?: {
|
|
312
|
+
redact_policy?: RedactPolicy;
|
|
313
|
+
redactPolicy?: RedactPolicy;
|
|
314
|
+
redact_scope?: RedactScope;
|
|
315
|
+
redactScope?: RedactScope;
|
|
316
|
+
caller_agent_id?: string;
|
|
317
|
+
callerAgentId?: string;
|
|
318
|
+
}): Promise<Record<string, unknown> | null>;
|
|
173
319
|
update(memoryId: string, data: string | {
|
|
174
320
|
text?: string;
|
|
175
321
|
metadata?: Record<string, unknown>;
|
|
322
|
+
redact_policy?: RedactPolicy;
|
|
323
|
+
redactPolicy?: RedactPolicy;
|
|
324
|
+
redact_scope?: RedactScope;
|
|
325
|
+
redactScope?: RedactScope;
|
|
326
|
+
caller_agent_id?: string;
|
|
327
|
+
callerAgentId?: string;
|
|
328
|
+
}, options?: {
|
|
329
|
+
redact_policy?: RedactPolicy;
|
|
330
|
+
redactPolicy?: RedactPolicy;
|
|
331
|
+
redact_scope?: RedactScope;
|
|
332
|
+
redactScope?: RedactScope;
|
|
333
|
+
caller_agent_id?: string;
|
|
334
|
+
callerAgentId?: string;
|
|
335
|
+
}): Promise<Record<string, unknown>>;
|
|
336
|
+
delete(memoryId: string, options?: {
|
|
337
|
+
caller_agent_id?: string;
|
|
338
|
+
callerAgentId?: string;
|
|
176
339
|
}): Promise<Record<string, unknown>>;
|
|
177
|
-
delete(memoryId: string): Promise<Record<string, unknown>>;
|
|
178
340
|
deleteAll(options?: MemoryFilters): Promise<Record<string, unknown>>;
|
|
179
341
|
delete_all(options?: MemoryFilters): Promise<Record<string, unknown>>;
|
|
180
342
|
reset(): Promise<Record<string, unknown>>;
|
|
181
343
|
history(memoryId: string): Promise<Array<Record<string, unknown>>>;
|
|
182
|
-
batchUpdate(memories: Array<Record<string, unknown
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
344
|
+
batchUpdate(memories: Array<Record<string, unknown>>, options?: {
|
|
345
|
+
redact_policy?: RedactPolicy;
|
|
346
|
+
redactPolicy?: RedactPolicy;
|
|
347
|
+
redact_scope?: RedactScope;
|
|
348
|
+
redactScope?: RedactScope;
|
|
349
|
+
caller_agent_id?: string;
|
|
350
|
+
callerAgentId?: string;
|
|
351
|
+
}): Promise<Record<string, unknown>>;
|
|
352
|
+
batch_update(memories: Array<Record<string, unknown>>, options?: {
|
|
353
|
+
redact_policy?: RedactPolicy;
|
|
354
|
+
redactPolicy?: RedactPolicy;
|
|
355
|
+
redact_scope?: RedactScope;
|
|
356
|
+
redactScope?: RedactScope;
|
|
357
|
+
caller_agent_id?: string;
|
|
358
|
+
callerAgentId?: string;
|
|
359
|
+
}): Promise<Record<string, unknown>>;
|
|
360
|
+
batchDelete(memories: Array<string | Record<string, unknown>>, options?: {
|
|
361
|
+
caller_agent_id?: string;
|
|
362
|
+
callerAgentId?: string;
|
|
363
|
+
}): Promise<Record<string, unknown>>;
|
|
364
|
+
batch_delete(memories: Array<string | Record<string, unknown>>, options?: {
|
|
365
|
+
caller_agent_id?: string;
|
|
366
|
+
callerAgentId?: string;
|
|
367
|
+
}): Promise<Record<string, unknown>>;
|
|
186
368
|
users(): Promise<Record<string, unknown>>;
|
|
187
369
|
deleteUsers(options?: MemoryFilters): Promise<Record<string, unknown>>;
|
|
188
370
|
delete_users(options?: MemoryFilters): Promise<Record<string, unknown>>;
|