@datalayer/agent-runtimes 1.3.43 → 1.3.44
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.
|
@@ -135,6 +135,10 @@ export interface RuntimeMemory {
|
|
|
135
135
|
scope?: string | null;
|
|
136
136
|
created_at?: string | null;
|
|
137
137
|
updated_at?: string | null;
|
|
138
|
+
/** Who corrected it, when it was corrected in place (LOOP R-34). */
|
|
139
|
+
corrected_by?: string | null;
|
|
140
|
+
/** When it was corrected (ISO). */
|
|
141
|
+
corrected_at?: string | null;
|
|
138
142
|
metadata?: Record<string, unknown>;
|
|
139
143
|
}
|
|
140
144
|
/**
|
|
@@ -191,6 +195,21 @@ export interface ForgetRuntimeMemoriesResponse {
|
|
|
191
195
|
* person's own.
|
|
192
196
|
*/
|
|
193
197
|
export declare const forgetRuntimeMemory: (token: string, memoryId: string, baseUrl?: string) => Promise<ForgetRuntimeMemoriesResponse>;
|
|
198
|
+
/**
|
|
199
|
+
* What a correction answers: the memory as it is now kept.
|
|
200
|
+
*/
|
|
201
|
+
export interface CorrectRuntimeMemoryResponse {
|
|
202
|
+
success: boolean;
|
|
203
|
+
memory: RuntimeMemory;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Correct one of the caller's own persisted memories in place (LOOP R-34):
|
|
207
|
+
* its words become `text`, kept with who corrected it and when.
|
|
208
|
+
*
|
|
209
|
+
* Somebody else's is not found (404), whoever asks; empty words, more than
|
|
210
|
+
* the service keeps, or the words it already has are refused (422).
|
|
211
|
+
*/
|
|
212
|
+
export declare const correctRuntimeMemory: (token: string, memoryId: string, text: string, baseUrl?: string) => Promise<CorrectRuntimeMemoryResponse>;
|
|
194
213
|
/**
|
|
195
214
|
* Forget everything one agent — an application, by its key `app:<uid>` —
|
|
196
215
|
* remembers of the caller, no more than `count`: the number the person was
|
|
@@ -277,6 +277,28 @@ export const forgetRuntimeMemory = async (token, memoryId, baseUrl = DEFAULT_SER
|
|
|
277
277
|
forgotten: Number(response?.forgotten ?? 0),
|
|
278
278
|
};
|
|
279
279
|
};
|
|
280
|
+
/**
|
|
281
|
+
* Correct one of the caller's own persisted memories in place (LOOP R-34):
|
|
282
|
+
* its words become `text`, kept with who corrected it and when.
|
|
283
|
+
*
|
|
284
|
+
* Somebody else's is not found (404), whoever asks; empty words, more than
|
|
285
|
+
* the service keeps, or the words it already has are refused (422).
|
|
286
|
+
*/
|
|
287
|
+
export const correctRuntimeMemory = async (token, memoryId, text, baseUrl = DEFAULT_SERVICE_URLS.RUNTIMES) => {
|
|
288
|
+
validateToken(token);
|
|
289
|
+
validateRequiredString(memoryId, 'Memory id');
|
|
290
|
+
validateRequiredString(text, 'What it should remember');
|
|
291
|
+
const response = await requestDatalayerAPI({
|
|
292
|
+
url: `${baseUrl}${API_BASE_PATHS.RUNTIMES}/memories/${encodeURIComponent(memoryId)}`,
|
|
293
|
+
method: 'PATCH',
|
|
294
|
+
body: { memory: text },
|
|
295
|
+
token,
|
|
296
|
+
});
|
|
297
|
+
return {
|
|
298
|
+
success: Boolean(response?.success),
|
|
299
|
+
memory: response?.memory,
|
|
300
|
+
};
|
|
301
|
+
};
|
|
280
302
|
/**
|
|
281
303
|
* Forget everything one agent — an application, by its key `app:<uid>` —
|
|
282
304
|
* remembers of the caller, no more than `count`: the number the person was
|
|
@@ -59,6 +59,7 @@ declare const AgentRuntimesClientWithMixins: {
|
|
|
59
59
|
listRuntimeMemories(options?: ListRuntimeMemoriesOptions): Promise<RuntimeMemory[]>;
|
|
60
60
|
getRuntimeMemory(memoryId: string): Promise<RuntimeMemory>;
|
|
61
61
|
forgetRuntimeMemory(memoryId: string): Promise<number>;
|
|
62
|
+
correctRuntimeMemory(memoryId: string, text: string): Promise<RuntimeMemory>;
|
|
62
63
|
forgetRuntimeMemories(agentId: string, count: number): Promise<number>;
|
|
63
64
|
terminateAllRuntimes(): Promise<PromiseSettledResult<void>[]>;
|
|
64
65
|
createSnapshot(runtimeName: string, name: string, description: string, stop?: boolean): Promise<CodeSandboxSnapshotDTO>;
|
|
@@ -95,6 +96,7 @@ export interface AgentRuntimesClient extends DatalayerCoreClient {
|
|
|
95
96
|
listRuntimeMemories(options?: ListRuntimeMemoriesOptions): Promise<RuntimeMemory[]>;
|
|
96
97
|
getRuntimeMemory(memoryId: string): Promise<RuntimeMemory>;
|
|
97
98
|
forgetRuntimeMemory(memoryId: string): Promise<number>;
|
|
99
|
+
correctRuntimeMemory(memoryId: string, text: string): Promise<RuntimeMemory>;
|
|
98
100
|
forgetRuntimeMemories(agentId: string, count: number): Promise<number>;
|
|
99
101
|
getRuntime(runtimeName: string): Promise<RuntimeDTO>;
|
|
100
102
|
deleteRuntime(runtimeName: string): Promise<void>;
|
|
@@ -96,6 +96,11 @@ export declare function RuntimesMixin<TBase extends Constructor>(Base: TBase): {
|
|
|
96
96
|
* Forget one of the caller's own memories; answers how many were forgotten.
|
|
97
97
|
*/
|
|
98
98
|
forgetRuntimeMemory(memoryId: string): Promise<number>;
|
|
99
|
+
/**
|
|
100
|
+
* Correct one of the caller's own memories in place (LOOP R-34): its
|
|
101
|
+
* words become `text`, kept with who corrected it and when.
|
|
102
|
+
*/
|
|
103
|
+
correctRuntimeMemory(memoryId: string, text: string): Promise<RuntimeMemory>;
|
|
99
104
|
/**
|
|
100
105
|
* Forget everything an agent or application (`app:<uid>`) remembers of
|
|
101
106
|
* the caller, no more than the `count` confirmed.
|
|
@@ -178,6 +178,16 @@ export function RuntimesMixin(Base) {
|
|
|
178
178
|
const response = await runtimes.forgetRuntimeMemory(token, memoryId, runtimesUrl);
|
|
179
179
|
return response.forgotten;
|
|
180
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Correct one of the caller's own memories in place (LOOP R-34): its
|
|
183
|
+
* words become `text`, kept with who corrected it and when.
|
|
184
|
+
*/
|
|
185
|
+
async correctRuntimeMemory(memoryId, text) {
|
|
186
|
+
const token = this.getToken();
|
|
187
|
+
const runtimesUrl = this.getRuntimesUrl();
|
|
188
|
+
const response = await runtimes.correctRuntimeMemory(token, memoryId, text, runtimesUrl);
|
|
189
|
+
return response.memory;
|
|
190
|
+
}
|
|
181
191
|
/**
|
|
182
192
|
* Forget everything an agent or application (`app:<uid>`) remembers of
|
|
183
193
|
* the caller, no more than the `count` confirmed.
|