open-agents-ai 0.187.192 → 0.187.193
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/index.js +30 -644
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -265967,134 +265967,16 @@ var init_db = __esm({
|
|
|
265967
265967
|
});
|
|
265968
265968
|
|
|
265969
265969
|
// packages/memory/dist/repoProfileStore.js
|
|
265970
|
-
function rowToProfile(row) {
|
|
265971
|
-
return {
|
|
265972
|
-
repoRoot: row.repo_root,
|
|
265973
|
-
languages: JSON.parse(row.languages),
|
|
265974
|
-
frameworks: JSON.parse(row.frameworks),
|
|
265975
|
-
buildSystem: row.build_system,
|
|
265976
|
-
testCommands: JSON.parse(row.test_commands),
|
|
265977
|
-
lintCommands: JSON.parse(row.lint_commands),
|
|
265978
|
-
packageManager: row.package_manager,
|
|
265979
|
-
notes: row.notes ?? null,
|
|
265980
|
-
createdAt: row.created_at,
|
|
265981
|
-
updatedAt: row.updated_at
|
|
265982
|
-
};
|
|
265983
|
-
}
|
|
265984
|
-
var RepoProfileStore;
|
|
265985
265970
|
var init_repoProfileStore = __esm({
|
|
265986
265971
|
"packages/memory/dist/repoProfileStore.js"() {
|
|
265987
265972
|
"use strict";
|
|
265988
|
-
RepoProfileStore = class {
|
|
265989
|
-
db;
|
|
265990
|
-
constructor(db) {
|
|
265991
|
-
this.db = db;
|
|
265992
|
-
}
|
|
265993
|
-
/** Insert or replace a repo profile row. */
|
|
265994
|
-
upsert(input) {
|
|
265995
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
265996
|
-
this.db.prepare(`INSERT INTO repo_profiles
|
|
265997
|
-
(repo_root, languages, frameworks, build_system,
|
|
265998
|
-
test_commands, lint_commands, package_manager,
|
|
265999
|
-
notes, created_at, updated_at)
|
|
266000
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
266001
|
-
ON CONFLICT (repo_root) DO UPDATE SET
|
|
266002
|
-
languages = excluded.languages,
|
|
266003
|
-
frameworks = excluded.frameworks,
|
|
266004
|
-
build_system = excluded.build_system,
|
|
266005
|
-
test_commands = excluded.test_commands,
|
|
266006
|
-
lint_commands = excluded.lint_commands,
|
|
266007
|
-
package_manager = excluded.package_manager,
|
|
266008
|
-
notes = excluded.notes,
|
|
266009
|
-
updated_at = excluded.updated_at`).run(input.repoRoot, JSON.stringify(input.languages), JSON.stringify(input.frameworks), input.buildSystem, JSON.stringify(input.testCommands), JSON.stringify(input.lintCommands), input.packageManager, input.notes ?? null, now, now);
|
|
266010
|
-
}
|
|
266011
|
-
/** Retrieve a profile by repository root path, or `null` if not found. */
|
|
266012
|
-
get(repoRoot) {
|
|
266013
|
-
const row = this.db.prepare("SELECT * FROM repo_profiles WHERE repo_root = ?").get(repoRoot);
|
|
266014
|
-
return row ? rowToProfile(row) : null;
|
|
266015
|
-
}
|
|
266016
|
-
/** List all stored repository profiles. */
|
|
266017
|
-
list() {
|
|
266018
|
-
const rows = this.db.prepare("SELECT * FROM repo_profiles ORDER BY repo_root").all();
|
|
266019
|
-
return rows.map(rowToProfile);
|
|
266020
|
-
}
|
|
266021
|
-
/** Remove a profile by repository root path. No-ops if not found. */
|
|
266022
|
-
delete(repoRoot) {
|
|
266023
|
-
this.db.prepare("DELETE FROM repo_profiles WHERE repo_root = ?").run(repoRoot);
|
|
266024
|
-
}
|
|
266025
|
-
};
|
|
266026
265973
|
}
|
|
266027
265974
|
});
|
|
266028
265975
|
|
|
266029
265976
|
// packages/memory/dist/fileSummaryStore.js
|
|
266030
|
-
function rowToSummary(row) {
|
|
266031
|
-
return {
|
|
266032
|
-
filePath: row.file_path,
|
|
266033
|
-
repoRoot: row.repo_root,
|
|
266034
|
-
purpose: row.purpose,
|
|
266035
|
-
exports: JSON.parse(row.exports),
|
|
266036
|
-
imports: JSON.parse(row.imports),
|
|
266037
|
-
domain: row.domain,
|
|
266038
|
-
riskLevel: row.risk_level,
|
|
266039
|
-
relatedTests: JSON.parse(row.related_tests),
|
|
266040
|
-
notes: row.notes ?? null,
|
|
266041
|
-
createdAt: row.created_at,
|
|
266042
|
-
updatedAt: row.updated_at
|
|
266043
|
-
};
|
|
266044
|
-
}
|
|
266045
|
-
var FileSummaryStore;
|
|
266046
265977
|
var init_fileSummaryStore = __esm({
|
|
266047
265978
|
"packages/memory/dist/fileSummaryStore.js"() {
|
|
266048
265979
|
"use strict";
|
|
266049
|
-
FileSummaryStore = class {
|
|
266050
|
-
db;
|
|
266051
|
-
constructor(db) {
|
|
266052
|
-
this.db = db;
|
|
266053
|
-
}
|
|
266054
|
-
/** Insert or replace a file summary. */
|
|
266055
|
-
upsert(input) {
|
|
266056
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
266057
|
-
this.db.prepare(`INSERT INTO file_summaries
|
|
266058
|
-
(file_path, repo_root, purpose, exports, imports,
|
|
266059
|
-
domain, risk_level, related_tests, notes,
|
|
266060
|
-
created_at, updated_at)
|
|
266061
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
266062
|
-
ON CONFLICT (file_path) DO UPDATE SET
|
|
266063
|
-
repo_root = excluded.repo_root,
|
|
266064
|
-
purpose = excluded.purpose,
|
|
266065
|
-
exports = excluded.exports,
|
|
266066
|
-
imports = excluded.imports,
|
|
266067
|
-
domain = excluded.domain,
|
|
266068
|
-
risk_level = excluded.risk_level,
|
|
266069
|
-
related_tests = excluded.related_tests,
|
|
266070
|
-
notes = excluded.notes,
|
|
266071
|
-
updated_at = excluded.updated_at`).run(input.filePath, input.repoRoot, input.purpose, JSON.stringify(input.exports), JSON.stringify(input.imports), input.domain, input.riskLevel, JSON.stringify(input.relatedTests), input.notes ?? null, now, now);
|
|
266072
|
-
}
|
|
266073
|
-
/** Retrieve a file summary by path, or `null` if not found. */
|
|
266074
|
-
get(filePath) {
|
|
266075
|
-
const row = this.db.prepare("SELECT * FROM file_summaries WHERE file_path = ?").get(filePath);
|
|
266076
|
-
return row ? rowToSummary(row) : null;
|
|
266077
|
-
}
|
|
266078
|
-
/** List all file summaries for a repository. */
|
|
266079
|
-
listByRepo(repoRoot) {
|
|
266080
|
-
const rows = this.db.prepare("SELECT * FROM file_summaries WHERE repo_root = ? ORDER BY file_path").all(repoRoot);
|
|
266081
|
-
return rows.map(rowToSummary);
|
|
266082
|
-
}
|
|
266083
|
-
/** List all file summaries belonging to a domain label. */
|
|
266084
|
-
listByDomain(domain) {
|
|
266085
|
-
const rows = this.db.prepare("SELECT * FROM file_summaries WHERE domain = ? ORDER BY file_path").all(domain);
|
|
266086
|
-
return rows.map(rowToSummary);
|
|
266087
|
-
}
|
|
266088
|
-
/** List all file summaries with the given risk level. */
|
|
266089
|
-
listByRiskLevel(riskLevel) {
|
|
266090
|
-
const rows = this.db.prepare("SELECT * FROM file_summaries WHERE risk_level = ? ORDER BY file_path").all(riskLevel);
|
|
266091
|
-
return rows.map(rowToSummary);
|
|
266092
|
-
}
|
|
266093
|
-
/** Remove a file summary by path. No-ops if not found. */
|
|
266094
|
-
delete(filePath) {
|
|
266095
|
-
this.db.prepare("DELETE FROM file_summaries WHERE file_path = ?").run(filePath);
|
|
266096
|
-
}
|
|
266097
|
-
};
|
|
266098
265980
|
}
|
|
266099
265981
|
});
|
|
266100
265982
|
|
|
@@ -266169,82 +266051,14 @@ var init_taskMemoryStore = __esm({
|
|
|
266169
266051
|
});
|
|
266170
266052
|
|
|
266171
266053
|
// packages/memory/dist/patchHistoryStore.js
|
|
266172
|
-
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
266173
|
-
function rowToPatch(row) {
|
|
266174
|
-
return {
|
|
266175
|
-
id: row.id,
|
|
266176
|
-
taskId: row.task_id,
|
|
266177
|
-
sessionId: row.session_id,
|
|
266178
|
-
repoRoot: row.repo_root,
|
|
266179
|
-
filePath: row.file_path,
|
|
266180
|
-
diff: row.diff,
|
|
266181
|
-
status: row.status,
|
|
266182
|
-
appliedAt: row.applied_at ?? null,
|
|
266183
|
-
revertedAt: row.reverted_at ?? null,
|
|
266184
|
-
notes: row.notes ?? null,
|
|
266185
|
-
createdAt: row.created_at
|
|
266186
|
-
};
|
|
266187
|
-
}
|
|
266188
|
-
var PatchHistoryStore;
|
|
266189
266054
|
var init_patchHistoryStore = __esm({
|
|
266190
266055
|
"packages/memory/dist/patchHistoryStore.js"() {
|
|
266191
266056
|
"use strict";
|
|
266192
|
-
PatchHistoryStore = class {
|
|
266193
|
-
db;
|
|
266194
|
-
constructor(db) {
|
|
266195
|
-
this.db = db;
|
|
266196
|
-
}
|
|
266197
|
-
/**
|
|
266198
|
-
* Record a new patch and return its auto-generated id.
|
|
266199
|
-
*/
|
|
266200
|
-
insert(input) {
|
|
266201
|
-
const id = randomUUID3();
|
|
266202
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
266203
|
-
this.db.prepare(`INSERT INTO patch_history
|
|
266204
|
-
(id, task_id, session_id, repo_root, file_path,
|
|
266205
|
-
diff, status, applied_at, reverted_at, notes, created_at)
|
|
266206
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(id, input.taskId, input.sessionId, input.repoRoot, input.filePath, input.diff, input.status, input.appliedAt ?? null, input.revertedAt ?? null, input.notes ?? null, now);
|
|
266207
|
-
return id;
|
|
266208
|
-
}
|
|
266209
|
-
/** Retrieve a patch by id, or `null` if not found. */
|
|
266210
|
-
getById(id) {
|
|
266211
|
-
const row = this.db.prepare("SELECT * FROM patch_history WHERE id = ?").get(id);
|
|
266212
|
-
return row ? rowToPatch(row) : null;
|
|
266213
|
-
}
|
|
266214
|
-
/** List all patches associated with a task. */
|
|
266215
|
-
listByTask(taskId) {
|
|
266216
|
-
const rows = this.db.prepare("SELECT * FROM patch_history WHERE task_id = ? ORDER BY created_at ASC").all(taskId);
|
|
266217
|
-
return rows.map(rowToPatch);
|
|
266218
|
-
}
|
|
266219
|
-
/** List all patches for a given file path (across all tasks). */
|
|
266220
|
-
listByFile(filePath) {
|
|
266221
|
-
const rows = this.db.prepare("SELECT * FROM patch_history WHERE file_path = ? ORDER BY created_at DESC").all(filePath);
|
|
266222
|
-
return rows.map(rowToPatch);
|
|
266223
|
-
}
|
|
266224
|
-
/** List patches filtered by status. */
|
|
266225
|
-
listByStatus(status) {
|
|
266226
|
-
const rows = this.db.prepare("SELECT * FROM patch_history WHERE status = ? ORDER BY created_at DESC").all(status);
|
|
266227
|
-
return rows.map(rowToPatch);
|
|
266228
|
-
}
|
|
266229
|
-
/**
|
|
266230
|
-
* Update the lifecycle status of a patch and optionally set a timestamp.
|
|
266231
|
-
*
|
|
266232
|
-
* @param id - The patch record id.
|
|
266233
|
-
* @param status - New status value.
|
|
266234
|
-
* @param revertedAt - ISO timestamp string when the patch was reverted
|
|
266235
|
-
* (only meaningful when status is "reverted").
|
|
266236
|
-
*/
|
|
266237
|
-
updateStatus(id, status, revertedAt) {
|
|
266238
|
-
this.db.prepare(`UPDATE patch_history
|
|
266239
|
-
SET status = ?, reverted_at = ?
|
|
266240
|
-
WHERE id = ?`).run(status, revertedAt ?? null, id);
|
|
266241
|
-
}
|
|
266242
|
-
};
|
|
266243
266057
|
}
|
|
266244
266058
|
});
|
|
266245
266059
|
|
|
266246
266060
|
// packages/memory/dist/failureStore.js
|
|
266247
|
-
import { randomUUID as
|
|
266061
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
266248
266062
|
function rowToFailure(row) {
|
|
266249
266063
|
return {
|
|
266250
266064
|
id: row.id,
|
|
@@ -266275,7 +266089,7 @@ var init_failureStore = __esm({
|
|
|
266275
266089
|
* Record a new failure event and return its auto-generated id.
|
|
266276
266090
|
*/
|
|
266277
266091
|
insert(input) {
|
|
266278
|
-
const id =
|
|
266092
|
+
const id = randomUUID3();
|
|
266279
266093
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
266280
266094
|
this.db.prepare(`INSERT INTO failures
|
|
266281
266095
|
(id, task_id, session_id, repo_root, failure_type,
|
|
@@ -266320,86 +266134,14 @@ var init_failureStore = __esm({
|
|
|
266320
266134
|
});
|
|
266321
266135
|
|
|
266322
266136
|
// packages/memory/dist/validationStore.js
|
|
266323
|
-
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
266324
|
-
function rowToRun(row) {
|
|
266325
|
-
return {
|
|
266326
|
-
id: row.id,
|
|
266327
|
-
taskId: row.task_id,
|
|
266328
|
-
sessionId: row.session_id,
|
|
266329
|
-
repoRoot: row.repo_root,
|
|
266330
|
-
runType: row.run_type,
|
|
266331
|
-
command: row.command,
|
|
266332
|
-
passed: row.passed === 1,
|
|
266333
|
-
durationMs: row.duration_ms ?? null,
|
|
266334
|
-
output: row.output ?? null,
|
|
266335
|
-
errorOutput: row.error_output ?? null,
|
|
266336
|
-
coveragePercent: row.coverage_percent ?? null,
|
|
266337
|
-
notes: row.notes ?? null,
|
|
266338
|
-
createdAt: row.created_at
|
|
266339
|
-
};
|
|
266340
|
-
}
|
|
266341
|
-
var ValidationStore;
|
|
266342
266137
|
var init_validationStore = __esm({
|
|
266343
266138
|
"packages/memory/dist/validationStore.js"() {
|
|
266344
266139
|
"use strict";
|
|
266345
|
-
ValidationStore = class {
|
|
266346
|
-
db;
|
|
266347
|
-
constructor(db) {
|
|
266348
|
-
this.db = db;
|
|
266349
|
-
}
|
|
266350
|
-
/**
|
|
266351
|
-
* Record a new validation run and return its auto-generated id.
|
|
266352
|
-
*/
|
|
266353
|
-
insert(input) {
|
|
266354
|
-
const id = randomUUID5();
|
|
266355
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
266356
|
-
this.db.prepare(`INSERT INTO validation_runs
|
|
266357
|
-
(id, task_id, session_id, repo_root, run_type,
|
|
266358
|
-
command, passed, duration_ms, output, error_output,
|
|
266359
|
-
coverage_percent, notes, created_at)
|
|
266360
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(id, input.taskId, input.sessionId, input.repoRoot, input.runType, input.command, input.passed ? 1 : 0, input.durationMs ?? null, input.output ?? null, input.errorOutput ?? null, input.coveragePercent ?? null, input.notes ?? null, now);
|
|
266361
|
-
return id;
|
|
266362
|
-
}
|
|
266363
|
-
/** Retrieve a validation run by id, or `null` if not found. */
|
|
266364
|
-
getById(id) {
|
|
266365
|
-
const row = this.db.prepare("SELECT * FROM validation_runs WHERE id = ?").get(id);
|
|
266366
|
-
return row ? rowToRun(row) : null;
|
|
266367
|
-
}
|
|
266368
|
-
/** List all validation runs for a given task. */
|
|
266369
|
-
listByTask(taskId) {
|
|
266370
|
-
const rows = this.db.prepare("SELECT * FROM validation_runs WHERE task_id = ? ORDER BY created_at ASC").all(taskId);
|
|
266371
|
-
return rows.map(rowToRun);
|
|
266372
|
-
}
|
|
266373
|
-
/** List validation runs filtered by run type. */
|
|
266374
|
-
listByRunType(runType) {
|
|
266375
|
-
const rows = this.db.prepare("SELECT * FROM validation_runs WHERE run_type = ? ORDER BY created_at DESC").all(runType);
|
|
266376
|
-
return rows.map(rowToRun);
|
|
266377
|
-
}
|
|
266378
|
-
/** List all failed validation runs. */
|
|
266379
|
-
listFailed() {
|
|
266380
|
-
const rows = this.db.prepare("SELECT * FROM validation_runs WHERE passed = 0 ORDER BY created_at DESC").all();
|
|
266381
|
-
return rows.map(rowToRun);
|
|
266382
|
-
}
|
|
266383
|
-
/**
|
|
266384
|
-
* Return the most recent validation run for a task, or `null` if no runs
|
|
266385
|
-
* exist for that task yet.
|
|
266386
|
-
*
|
|
266387
|
-
* Uses rowid as a tiebreaker so that two runs with identical timestamps
|
|
266388
|
-
* (common in tests) are ordered deterministically by insertion order.
|
|
266389
|
-
*/
|
|
266390
|
-
latestByTask(taskId) {
|
|
266391
|
-
const row = this.db.prepare(`SELECT * FROM validation_runs
|
|
266392
|
-
WHERE task_id = ?
|
|
266393
|
-
ORDER BY created_at DESC, rowid DESC
|
|
266394
|
-
LIMIT 1`).get(taskId);
|
|
266395
|
-
return row ? rowToRun(row) : null;
|
|
266396
|
-
}
|
|
266397
|
-
};
|
|
266398
266140
|
}
|
|
266399
266141
|
});
|
|
266400
266142
|
|
|
266401
266143
|
// packages/memory/dist/toolPatternStore.js
|
|
266402
|
-
import { randomUUID as
|
|
266144
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
266403
266145
|
var ToolPatternStore;
|
|
266404
266146
|
var init_toolPatternStore = __esm({
|
|
266405
266147
|
"packages/memory/dist/toolPatternStore.js"() {
|
|
@@ -266442,7 +266184,7 @@ var init_toolPatternStore = __esm({
|
|
|
266442
266184
|
}
|
|
266443
266185
|
/** Record a tool call sequence from a completed task */
|
|
266444
266186
|
insert(input) {
|
|
266445
|
-
const id =
|
|
266187
|
+
const id = randomUUID4();
|
|
266446
266188
|
this.db.prepare(`
|
|
266447
266189
|
INSERT INTO tool_sequences (id, task_id, session_id, repo_root, sequence)
|
|
266448
266190
|
VALUES (?, ?, ?, ?, ?)
|
|
@@ -266584,7 +266326,7 @@ var init_toolPatternStore = __esm({
|
|
|
266584
266326
|
// packages/memory/dist/episodeStore.js
|
|
266585
266327
|
import { join as join63 } from "node:path";
|
|
266586
266328
|
import { mkdirSync as mkdirSync24, existsSync as existsSync47 } from "node:fs";
|
|
266587
|
-
import { randomUUID as
|
|
266329
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
266588
266330
|
import { createHash as createHash3 } from "node:crypto";
|
|
266589
266331
|
function sanitizeImportance(raw, fallback = 5) {
|
|
266590
266332
|
if (typeof raw !== "number" || !Number.isFinite(raw))
|
|
@@ -266691,7 +266433,7 @@ var init_episodeStore = __esm({
|
|
|
266691
266433
|
}
|
|
266692
266434
|
/** Insert a new episode. Returns the episode ID. */
|
|
266693
266435
|
insert(ep) {
|
|
266694
|
-
const id =
|
|
266436
|
+
const id = randomUUID5();
|
|
266695
266437
|
const now = Date.now();
|
|
266696
266438
|
const contentHash = createHash3("sha256").update(ep.content).digest("hex").slice(0, 16);
|
|
266697
266439
|
const modality = ep.modality ?? "text";
|
|
@@ -266846,7 +266588,7 @@ var init_episodeStore = __esm({
|
|
|
266846
266588
|
// packages/memory/dist/temporalGraph.js
|
|
266847
266589
|
import { join as join64 } from "node:path";
|
|
266848
266590
|
import { mkdirSync as mkdirSync25, existsSync as existsSync48 } from "node:fs";
|
|
266849
|
-
import { randomUUID as
|
|
266591
|
+
import { randomUUID as randomUUID6 } from "node:crypto";
|
|
266850
266592
|
var TemporalGraph;
|
|
266851
266593
|
var init_temporalGraph = __esm({
|
|
266852
266594
|
"packages/memory/dist/temporalGraph.js"() {
|
|
@@ -266901,7 +266643,7 @@ var init_temporalGraph = __esm({
|
|
|
266901
266643
|
this.db.prepare("UPDATE kg_nodes SET mention_count = mention_count + 1, last_seen = ? WHERE id = ?").run(now, existing.id);
|
|
266902
266644
|
return existing.id;
|
|
266903
266645
|
}
|
|
266904
|
-
const id =
|
|
266646
|
+
const id = randomUUID6();
|
|
266905
266647
|
const embBuf = insert.embedding ? Buffer.from(insert.embedding.buffer) : null;
|
|
266906
266648
|
this.db.prepare(`
|
|
266907
266649
|
INSERT INTO kg_nodes (id, text, node_type, embedding, first_seen, last_seen, mention_count)
|
|
@@ -267483,34 +267225,6 @@ async function generateEmbedding(text, config) {
|
|
|
267483
267225
|
return null;
|
|
267484
267226
|
}
|
|
267485
267227
|
}
|
|
267486
|
-
async function generateEmbeddingBatch(texts, config) {
|
|
267487
|
-
const cfg = { ...DEFAULT_CONFIG6, ...config };
|
|
267488
|
-
try {
|
|
267489
|
-
const url = `${cfg.baseUrl}/api/embed`;
|
|
267490
|
-
const resp = await fetch(url, {
|
|
267491
|
-
method: "POST",
|
|
267492
|
-
headers: { "Content-Type": "application/json" },
|
|
267493
|
-
body: JSON.stringify({
|
|
267494
|
-
model: cfg.model,
|
|
267495
|
-
input: texts
|
|
267496
|
-
}),
|
|
267497
|
-
signal: AbortSignal.timeout(cfg.timeoutMs * 2)
|
|
267498
|
-
// longer timeout for batch
|
|
267499
|
-
});
|
|
267500
|
-
if (!resp.ok)
|
|
267501
|
-
return texts.map(() => null);
|
|
267502
|
-
const data = await resp.json();
|
|
267503
|
-
if (!data.embeddings)
|
|
267504
|
-
return texts.map(() => null);
|
|
267505
|
-
return data.embeddings.map((vec) => vec && vec.length > 0 ? {
|
|
267506
|
-
vector: new Float32Array(vec),
|
|
267507
|
-
model: cfg.model,
|
|
267508
|
-
dimensions: vec.length
|
|
267509
|
-
} : null);
|
|
267510
|
-
} catch {
|
|
267511
|
-
return texts.map(() => null);
|
|
267512
|
-
}
|
|
267513
|
-
}
|
|
267514
267228
|
async function checkEmbeddingAvailable(config) {
|
|
267515
267229
|
const cfg = { ...DEFAULT_CONFIG6, ...config };
|
|
267516
267230
|
try {
|
|
@@ -267552,348 +267266,14 @@ var init_embeddings = __esm({
|
|
|
267552
267266
|
});
|
|
267553
267267
|
|
|
267554
267268
|
// packages/memory/dist/proceduralMemoryStore.js
|
|
267555
|
-
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
267556
|
-
function cosineSimilarity3(a2, b) {
|
|
267557
|
-
if (a2.length !== b.length)
|
|
267558
|
-
return 0;
|
|
267559
|
-
let dot = 0, normA = 0, normB = 0;
|
|
267560
|
-
for (let i2 = 0; i2 < a2.length; i2++) {
|
|
267561
|
-
dot += a2[i2] * b[i2];
|
|
267562
|
-
normA += a2[i2] * a2[i2];
|
|
267563
|
-
normB += b[i2] * b[i2];
|
|
267564
|
-
}
|
|
267565
|
-
const denom = Math.sqrt(normA) * Math.sqrt(normB);
|
|
267566
|
-
return denom === 0 ? 0 : dot / denom;
|
|
267567
|
-
}
|
|
267568
|
-
var ProceduralMemoryStore;
|
|
267569
267269
|
var init_proceduralMemoryStore = __esm({
|
|
267570
267270
|
"packages/memory/dist/proceduralMemoryStore.js"() {
|
|
267571
267271
|
"use strict";
|
|
267572
267272
|
init_embeddings();
|
|
267573
|
-
ProceduralMemoryStore = class {
|
|
267574
|
-
db;
|
|
267575
|
-
constructor(db) {
|
|
267576
|
-
this.db = db;
|
|
267577
|
-
}
|
|
267578
|
-
// ── CRUD ────────────────────────────────────────────────────────────
|
|
267579
|
-
/** Create a new procedural memory. Returns the full record. */
|
|
267580
|
-
create(input) {
|
|
267581
|
-
const id = randomUUID9();
|
|
267582
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
267583
|
-
this.db.prepare(`
|
|
267584
|
-
INSERT INTO procedural_memory
|
|
267585
|
-
(id, type, category, content, trigger_pattern, steps, source_trace, utility, confidence, created_at, updated_at)
|
|
267586
|
-
VALUES
|
|
267587
|
-
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
267588
|
-
`).run(id, input.type ?? "procedural", input.category ?? "strategy", input.content, input.triggerPattern ?? "", input.steps ?? "", input.sourceTrace ?? "", input.utility ?? 0.5, input.confidence ?? 0.5, now, now);
|
|
267589
|
-
this.db.prepare(`
|
|
267590
|
-
INSERT INTO memory_revision (id, memory_id, content, revision_type, created_at)
|
|
267591
|
-
VALUES (?, ?, ?, 'create', ?)
|
|
267592
|
-
`).run(randomUUID9(), id, input.content, now);
|
|
267593
|
-
return this.get(id);
|
|
267594
|
-
}
|
|
267595
|
-
/**
|
|
267596
|
-
* Create a memory AND auto-generate embedding + auto-link to similar memories.
|
|
267597
|
-
* This is the primary creation method for the agent loop — combines WO-FM1 + FM2 + FM3.
|
|
267598
|
-
* Embedding generation is async (Ollama call) and non-blocking — if it fails,
|
|
267599
|
-
* the memory is still created (text search fallback).
|
|
267600
|
-
*/
|
|
267601
|
-
async createWithEmbedding(input, embeddingConfig) {
|
|
267602
|
-
const memory = this.create(input);
|
|
267603
|
-
try {
|
|
267604
|
-
const textForEmbed = [input.content, input.triggerPattern ?? "", input.steps ?? ""].filter(Boolean).join(". ");
|
|
267605
|
-
const result = await generateEmbedding(textForEmbed, embeddingConfig);
|
|
267606
|
-
if (result) {
|
|
267607
|
-
this.storeEmbedding(memory.id, result.vector, result.model);
|
|
267608
|
-
const similar = this.searchSemantic(result.vector, 3, 0.6);
|
|
267609
|
-
for (const match of similar) {
|
|
267610
|
-
if (match.memory.id !== memory.id) {
|
|
267611
|
-
this.createLink(memory.id, match.memory.id, "related", match.score);
|
|
267612
|
-
}
|
|
267613
|
-
}
|
|
267614
|
-
}
|
|
267615
|
-
} catch {
|
|
267616
|
-
}
|
|
267617
|
-
return memory;
|
|
267618
|
-
}
|
|
267619
|
-
/** Get a memory by ID. Returns null if not found or soft-deleted. */
|
|
267620
|
-
get(id) {
|
|
267621
|
-
const row = this.db.prepare(`
|
|
267622
|
-
SELECT * FROM procedural_memory WHERE id = ? AND deleted_at IS NULL
|
|
267623
|
-
`).get(id);
|
|
267624
|
-
return row ? this._mapRow(row) : null;
|
|
267625
|
-
}
|
|
267626
|
-
/** List all active memories, ordered by utility*confidence descending. */
|
|
267627
|
-
list(limit = 100, offset = 0) {
|
|
267628
|
-
const rows = this.db.prepare(`
|
|
267629
|
-
SELECT * FROM procedural_memory
|
|
267630
|
-
WHERE deleted_at IS NULL
|
|
267631
|
-
ORDER BY (utility * confidence) DESC
|
|
267632
|
-
LIMIT ? OFFSET ?
|
|
267633
|
-
`).all(limit, offset);
|
|
267634
|
-
return rows.map((r2) => this._mapRow(r2));
|
|
267635
|
-
}
|
|
267636
|
-
/** Update a memory. Creates a revision. */
|
|
267637
|
-
update(id, changes, model) {
|
|
267638
|
-
const existing = this.get(id);
|
|
267639
|
-
if (!existing)
|
|
267640
|
-
return null;
|
|
267641
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
267642
|
-
const sets = ["updated_at = ?"];
|
|
267643
|
-
const vals = [now];
|
|
267644
|
-
if (changes.content !== void 0) {
|
|
267645
|
-
sets.push("content = ?");
|
|
267646
|
-
vals.push(changes.content);
|
|
267647
|
-
}
|
|
267648
|
-
if (changes.triggerPattern !== void 0) {
|
|
267649
|
-
sets.push("trigger_pattern = ?");
|
|
267650
|
-
vals.push(changes.triggerPattern);
|
|
267651
|
-
}
|
|
267652
|
-
if (changes.steps !== void 0) {
|
|
267653
|
-
sets.push("steps = ?");
|
|
267654
|
-
vals.push(changes.steps);
|
|
267655
|
-
}
|
|
267656
|
-
if (changes.utility !== void 0) {
|
|
267657
|
-
sets.push("utility = ?");
|
|
267658
|
-
vals.push(changes.utility);
|
|
267659
|
-
}
|
|
267660
|
-
if (changes.confidence !== void 0) {
|
|
267661
|
-
sets.push("confidence = ?");
|
|
267662
|
-
vals.push(changes.confidence);
|
|
267663
|
-
}
|
|
267664
|
-
if (changes.category !== void 0) {
|
|
267665
|
-
sets.push("category = ?");
|
|
267666
|
-
vals.push(changes.category);
|
|
267667
|
-
}
|
|
267668
|
-
vals.push(id);
|
|
267669
|
-
this.db.prepare(`UPDATE procedural_memory SET ${sets.join(", ")} WHERE id = ?`).run(...vals);
|
|
267670
|
-
this.db.prepare(`
|
|
267671
|
-
INSERT INTO memory_revision (id, memory_id, content, revision_type, model, created_at)
|
|
267672
|
-
VALUES (?, ?, ?, 'update', ?, ?)
|
|
267673
|
-
`).run(randomUUID9(), id, changes.content ?? existing.content, model ?? null, now);
|
|
267674
|
-
return this.get(id);
|
|
267675
|
-
}
|
|
267676
|
-
/** Soft-delete a memory. */
|
|
267677
|
-
delete(id) {
|
|
267678
|
-
const result = this.db.prepare(`
|
|
267679
|
-
UPDATE procedural_memory SET deleted_at = ? WHERE id = ? AND deleted_at IS NULL
|
|
267680
|
-
`).run((/* @__PURE__ */ new Date()).toISOString(), id);
|
|
267681
|
-
return result.changes > 0;
|
|
267682
|
-
}
|
|
267683
|
-
/** Restore a soft-deleted memory. */
|
|
267684
|
-
restore(id) {
|
|
267685
|
-
const result = this.db.prepare(`
|
|
267686
|
-
UPDATE procedural_memory SET deleted_at = NULL WHERE id = ? AND deleted_at IS NOT NULL
|
|
267687
|
-
`).run(id);
|
|
267688
|
-
return result.changes > 0;
|
|
267689
|
-
}
|
|
267690
|
-
// ── Search ──────────────────────────────────────────────────────────
|
|
267691
|
-
/** Full-text search across content, trigger, and steps. */
|
|
267692
|
-
searchText(query, limit = 10) {
|
|
267693
|
-
const pattern = `%${query}%`;
|
|
267694
|
-
const rows = this.db.prepare(`
|
|
267695
|
-
SELECT *, 1.0 as score FROM procedural_memory
|
|
267696
|
-
WHERE deleted_at IS NULL
|
|
267697
|
-
AND (content LIKE ? OR trigger_pattern LIKE ? OR steps LIKE ?)
|
|
267698
|
-
ORDER BY (utility * confidence) DESC
|
|
267699
|
-
LIMIT ?
|
|
267700
|
-
`).all(pattern, pattern, pattern, limit);
|
|
267701
|
-
return rows.map((r2) => ({
|
|
267702
|
-
memory: this._mapRow(r2),
|
|
267703
|
-
score: r2.score,
|
|
267704
|
-
matchType: "text"
|
|
267705
|
-
}));
|
|
267706
|
-
}
|
|
267707
|
-
/** Semantic search using stored embeddings. */
|
|
267708
|
-
searchSemantic(queryVector, limit = 5, minSimilarity = 0.3) {
|
|
267709
|
-
const rows = this.db.prepare(`
|
|
267710
|
-
SELECT pm.*, me.vector FROM procedural_memory pm
|
|
267711
|
-
JOIN memory_embedding me ON me.memory_id = pm.id
|
|
267712
|
-
WHERE pm.deleted_at IS NULL
|
|
267713
|
-
`).all();
|
|
267714
|
-
const results = [];
|
|
267715
|
-
for (const row of rows) {
|
|
267716
|
-
const stored = new Float32Array(row.vector.buffer, row.vector.byteOffset, row.vector.byteLength / 4);
|
|
267717
|
-
const sim = cosineSimilarity3(queryVector, stored);
|
|
267718
|
-
if (sim >= minSimilarity) {
|
|
267719
|
-
results.push({
|
|
267720
|
-
memory: this._mapRow(row),
|
|
267721
|
-
score: sim,
|
|
267722
|
-
matchType: "semantic"
|
|
267723
|
-
});
|
|
267724
|
-
}
|
|
267725
|
-
}
|
|
267726
|
-
return results.sort((a2, b) => b.score - a2.score).slice(0, limit);
|
|
267727
|
-
}
|
|
267728
|
-
/** Get top-K memories by utility*confidence (for prompt injection). */
|
|
267729
|
-
getTopMemories(k = 3) {
|
|
267730
|
-
return this.list(k);
|
|
267731
|
-
}
|
|
267732
|
-
// ── Embeddings ──────────────────────────────────────────────────────
|
|
267733
|
-
/** Store an embedding vector for a memory. */
|
|
267734
|
-
storeEmbedding(memoryId, vector, model) {
|
|
267735
|
-
const buf = Buffer.from(vector.buffer, vector.byteOffset, vector.byteLength);
|
|
267736
|
-
this.db.prepare(`
|
|
267737
|
-
INSERT OR REPLACE INTO memory_embedding (id, memory_id, vector, model, dimensions, created_at)
|
|
267738
|
-
VALUES (?, ?, ?, ?, ?, ?)
|
|
267739
|
-
`).run(randomUUID9(), memoryId, buf, model, vector.length, (/* @__PURE__ */ new Date()).toISOString());
|
|
267740
|
-
}
|
|
267741
|
-
/** Check if a memory has an embedding. */
|
|
267742
|
-
hasEmbedding(memoryId) {
|
|
267743
|
-
const row = this.db.prepare(`
|
|
267744
|
-
SELECT COUNT(*) as cnt FROM memory_embedding WHERE memory_id = ?
|
|
267745
|
-
`).get(memoryId);
|
|
267746
|
-
return row?.cnt > 0;
|
|
267747
|
-
}
|
|
267748
|
-
// ── Links ───────────────────────────────────────────────────────────
|
|
267749
|
-
/** Create a link between two memories. */
|
|
267750
|
-
createLink(sourceId, targetId, linkType = "related", confidence = 0.5) {
|
|
267751
|
-
const id = randomUUID9();
|
|
267752
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
267753
|
-
this.db.prepare(`
|
|
267754
|
-
INSERT INTO memory_link (id, source_id, target_id, link_type, confidence, created_at)
|
|
267755
|
-
VALUES (?, ?, ?, ?, ?, ?)
|
|
267756
|
-
`).run(id, sourceId, targetId, linkType, confidence, now);
|
|
267757
|
-
return { id, sourceId, targetId, linkType, confidence, createdAt: now };
|
|
267758
|
-
}
|
|
267759
|
-
/** Find memories linked to the given memory ID. */
|
|
267760
|
-
findLinked(memoryId, limit = 5) {
|
|
267761
|
-
const rows = this.db.prepare(`
|
|
267762
|
-
SELECT pm.*, ml.confidence as link_confidence FROM procedural_memory pm
|
|
267763
|
-
JOIN memory_link ml ON (ml.target_id = pm.id AND ml.source_id = ?)
|
|
267764
|
-
OR (ml.source_id = pm.id AND ml.target_id = ?)
|
|
267765
|
-
WHERE pm.deleted_at IS NULL
|
|
267766
|
-
ORDER BY ml.confidence DESC
|
|
267767
|
-
LIMIT ?
|
|
267768
|
-
`).all(memoryId, memoryId, limit);
|
|
267769
|
-
return rows.map((r2) => ({
|
|
267770
|
-
memory: this._mapRow(r2),
|
|
267771
|
-
confidence: r2.link_confidence
|
|
267772
|
-
}));
|
|
267773
|
-
}
|
|
267774
|
-
// ── Revisions ───────────────────────────────────────────────────────
|
|
267775
|
-
/** Get revision history for a memory. */
|
|
267776
|
-
getRevisions(memoryId) {
|
|
267777
|
-
const rows = this.db.prepare(`
|
|
267778
|
-
SELECT * FROM memory_revision WHERE memory_id = ? ORDER BY created_at DESC
|
|
267779
|
-
`).all(memoryId);
|
|
267780
|
-
return rows.map((r2) => ({
|
|
267781
|
-
id: r2.id,
|
|
267782
|
-
memoryId: r2.memory_id,
|
|
267783
|
-
content: r2.content,
|
|
267784
|
-
revisionType: r2.revision_type,
|
|
267785
|
-
model: r2.model,
|
|
267786
|
-
createdAt: r2.created_at
|
|
267787
|
-
}));
|
|
267788
|
-
}
|
|
267789
|
-
// ── Scoring ─────────────────────────────────────────────────────────
|
|
267790
|
-
/** Reinforce a memory (increase utility + confidence after successful use). */
|
|
267791
|
-
reinforce(id, amount = 0.1) {
|
|
267792
|
-
this.db.prepare(`
|
|
267793
|
-
UPDATE procedural_memory
|
|
267794
|
-
SET utility = MIN(1.0, utility + ?),
|
|
267795
|
-
confidence = MIN(1.0, confidence + ? * 0.5),
|
|
267796
|
-
access_count = access_count + 1,
|
|
267797
|
-
updated_at = ?
|
|
267798
|
-
WHERE id = ? AND deleted_at IS NULL
|
|
267799
|
-
`).run(amount, amount, (/* @__PURE__ */ new Date()).toISOString(), id);
|
|
267800
|
-
}
|
|
267801
|
-
/** Decay a memory (decrease utility after failed/irrelevant use). */
|
|
267802
|
-
decay(id, amount = 0.05) {
|
|
267803
|
-
this.db.prepare(`
|
|
267804
|
-
UPDATE procedural_memory
|
|
267805
|
-
SET utility = MAX(0.0, utility - ?),
|
|
267806
|
-
confidence = MAX(0.0, confidence - ? * 0.5),
|
|
267807
|
-
access_count = access_count + 1,
|
|
267808
|
-
updated_at = ?
|
|
267809
|
-
WHERE id = ? AND deleted_at IS NULL
|
|
267810
|
-
`).run(amount, amount, (/* @__PURE__ */ new Date()).toISOString(), id);
|
|
267811
|
-
}
|
|
267812
|
-
// ── Stats ───────────────────────────────────────────────────────────
|
|
267813
|
-
/** Count active memories. */
|
|
267814
|
-
count() {
|
|
267815
|
-
const row = this.db.prepare(`
|
|
267816
|
-
SELECT COUNT(*) as cnt FROM procedural_memory WHERE deleted_at IS NULL
|
|
267817
|
-
`).get();
|
|
267818
|
-
return row?.cnt ?? 0;
|
|
267819
|
-
}
|
|
267820
|
-
/** Migration helper: import from flat JSON metabolism store. */
|
|
267821
|
-
importFromJson(entries) {
|
|
267822
|
-
let imported = 0;
|
|
267823
|
-
const insert = this.db.prepare(`
|
|
267824
|
-
INSERT INTO procedural_memory
|
|
267825
|
-
(id, type, category, content, source_trace, utility, confidence, created_at, updated_at)
|
|
267826
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
267827
|
-
`);
|
|
267828
|
-
const txn = this.db.transaction(() => {
|
|
267829
|
-
for (const entry of entries) {
|
|
267830
|
-
const id = randomUUID9();
|
|
267831
|
-
const now = entry.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
267832
|
-
let category = "strategy";
|
|
267833
|
-
if (entry.content.startsWith("[recovery]"))
|
|
267834
|
-
category = "recovery";
|
|
267835
|
-
else if (entry.content.startsWith("[optimization]"))
|
|
267836
|
-
category = "optimization";
|
|
267837
|
-
insert.run(id, entry.type ?? "procedural", category, entry.content, entry.sourceTrace ?? "json-import", entry.scores?.utility ?? 0.5, entry.scores?.confidence ?? 0.5, now, now);
|
|
267838
|
-
imported++;
|
|
267839
|
-
}
|
|
267840
|
-
});
|
|
267841
|
-
txn();
|
|
267842
|
-
return imported;
|
|
267843
|
-
}
|
|
267844
|
-
// ── Internal ────────────────────────────────────────────────────────
|
|
267845
|
-
_mapRow(row) {
|
|
267846
|
-
return {
|
|
267847
|
-
id: row.id,
|
|
267848
|
-
type: row.type,
|
|
267849
|
-
category: row.category,
|
|
267850
|
-
content: row.content,
|
|
267851
|
-
triggerPattern: row.trigger_pattern,
|
|
267852
|
-
steps: row.steps,
|
|
267853
|
-
sourceTrace: row.source_trace,
|
|
267854
|
-
utility: row.utility,
|
|
267855
|
-
confidence: row.confidence,
|
|
267856
|
-
accessCount: row.access_count,
|
|
267857
|
-
deletedAt: row.deleted_at,
|
|
267858
|
-
createdAt: row.created_at,
|
|
267859
|
-
updatedAt: row.updated_at
|
|
267860
|
-
};
|
|
267861
|
-
}
|
|
267862
|
-
};
|
|
267863
267273
|
}
|
|
267864
267274
|
});
|
|
267865
267275
|
|
|
267866
267276
|
// packages/memory/dist/index.js
|
|
267867
|
-
var dist_exports3 = {};
|
|
267868
|
-
__export(dist_exports3, {
|
|
267869
|
-
DECAY_TAU: () => DECAY_TAU,
|
|
267870
|
-
EpisodeStore: () => EpisodeStore,
|
|
267871
|
-
FailureStore: () => FailureStore,
|
|
267872
|
-
FileSummaryStore: () => FileSummaryStore,
|
|
267873
|
-
PatchHistoryStore: () => PatchHistoryStore,
|
|
267874
|
-
ProceduralMemoryStore: () => ProceduralMemoryStore,
|
|
267875
|
-
RepoProfileStore: () => RepoProfileStore,
|
|
267876
|
-
TaskMemoryStore: () => TaskMemoryStore,
|
|
267877
|
-
TemporalGraph: () => TemporalGraph,
|
|
267878
|
-
ToolPatternStore: () => ToolPatternStore,
|
|
267879
|
-
ValidationStore: () => ValidationStore,
|
|
267880
|
-
autoDecayClass: () => autoDecayClass,
|
|
267881
|
-
autoImportance: () => autoImportance,
|
|
267882
|
-
batchLink: () => batchLink,
|
|
267883
|
-
checkEmbeddingAvailable: () => checkEmbeddingAvailable,
|
|
267884
|
-
closeDb: () => closeDb,
|
|
267885
|
-
compressAndStore: () => compressAndStore,
|
|
267886
|
-
compressToGist: () => compressToGist,
|
|
267887
|
-
cosineSimilarity: () => cosineSimilarity2,
|
|
267888
|
-
extractQueryEntities: () => extractQueryEntities,
|
|
267889
|
-
findNeighbors: () => findNeighbors,
|
|
267890
|
-
generateEmbedding: () => generateEmbedding,
|
|
267891
|
-
generateEmbeddingBatch: () => generateEmbeddingBatch,
|
|
267892
|
-
initDb: () => initDb,
|
|
267893
|
-
linkEpisode: () => linkEpisode,
|
|
267894
|
-
personalizedPageRank: () => personalizedPageRank,
|
|
267895
|
-
retrieveByPPR: () => retrieveByPPR
|
|
267896
|
-
});
|
|
267897
267277
|
var init_dist7 = __esm({
|
|
267898
267278
|
"packages/memory/dist/index.js"() {
|
|
267899
267279
|
"use strict";
|
|
@@ -275469,8 +274849,8 @@ var init_skill_fork = __esm({
|
|
|
275469
274849
|
});
|
|
275470
274850
|
|
|
275471
274851
|
// packages/orchestrator/dist/index.js
|
|
275472
|
-
var
|
|
275473
|
-
__export(
|
|
274852
|
+
var dist_exports3 = {};
|
|
274853
|
+
__export(dist_exports3, {
|
|
275474
274854
|
AGENT_DISALLOWED_TOOLS: () => AGENT_DISALLOWED_TOOLS,
|
|
275475
274855
|
AgentLoop: () => AgentLoop,
|
|
275476
274856
|
AgentTaskManager: () => AgentTaskManager,
|
|
@@ -313831,18 +313211,22 @@ async function handleCallMcp(ctx3, name10) {
|
|
|
313831
313211
|
}
|
|
313832
313212
|
async function getMemoryStores() {
|
|
313833
313213
|
if (memoryStoresCache) return memoryStoresCache;
|
|
313214
|
+
if (memoryInitTried) return null;
|
|
313215
|
+
memoryInitTried = true;
|
|
313834
313216
|
try {
|
|
313835
|
-
const memMod = await Promise.resolve().then(() => (init_dist7(), dist_exports3));
|
|
313836
|
-
const { initDb: initDb2, EpisodeStore: EpisodeStore2, TemporalGraph: TemporalGraph2, FailureStore: FailureStore2 } = memMod;
|
|
313837
313217
|
const dbPath = join90(homedir29(), ".open-agents", "memory.db");
|
|
313838
|
-
const db =
|
|
313218
|
+
const db = initDb(dbPath);
|
|
313839
313219
|
memoryStoresCache = {
|
|
313840
|
-
episode: new
|
|
313841
|
-
temporal: new
|
|
313842
|
-
failure: new
|
|
313220
|
+
episode: new EpisodeStore(db),
|
|
313221
|
+
temporal: new TemporalGraph(db),
|
|
313222
|
+
failure: new FailureStore(db)
|
|
313843
313223
|
};
|
|
313844
313224
|
return memoryStoresCache;
|
|
313845
|
-
} catch {
|
|
313225
|
+
} catch (err) {
|
|
313226
|
+
try {
|
|
313227
|
+
console.error("[memory-init]", err instanceof Error ? err.message : String(err));
|
|
313228
|
+
} catch {
|
|
313229
|
+
}
|
|
313846
313230
|
return null;
|
|
313847
313231
|
}
|
|
313848
313232
|
}
|
|
@@ -314424,7 +313808,7 @@ async function handleSponsors(ctx3) {
|
|
|
314424
313808
|
async function handleCost(ctx3) {
|
|
314425
313809
|
const { res, requestId } = ctx3;
|
|
314426
313810
|
try {
|
|
314427
|
-
const orchMod = await Promise.resolve().then(() => (init_dist8(),
|
|
313811
|
+
const orchMod = await Promise.resolve().then(() => (init_dist8(), dist_exports3)).catch(() => null);
|
|
314428
313812
|
if (!orchMod) {
|
|
314429
313813
|
sendJson(res, 200, { providers: [], note: "Cost tracker unavailable" });
|
|
314430
313814
|
return true;
|
|
@@ -314578,7 +313962,7 @@ async function handleListHooks(ctx3) {
|
|
|
314578
313962
|
async function handleListAgentTypes(ctx3) {
|
|
314579
313963
|
const { req: req2, res, url, requestId } = ctx3;
|
|
314580
313964
|
try {
|
|
314581
|
-
const orchMod = await Promise.resolve().then(() => (init_dist8(),
|
|
313965
|
+
const orchMod = await Promise.resolve().then(() => (init_dist8(), dist_exports3)).catch(() => null);
|
|
314582
313966
|
if (!orchMod?.getAgentTypeRegistry) {
|
|
314583
313967
|
sendJson(res, 200, { data: [], pagination: { limit: 50, offset: 0, total: 0, has_more: false } });
|
|
314584
313968
|
return true;
|
|
@@ -315194,13 +314578,14 @@ async function handleAimsConfigHistory(ctx3) {
|
|
|
315194
314578
|
return true;
|
|
315195
314579
|
}
|
|
315196
314580
|
}
|
|
315197
|
-
var PROBLEM_BASE, P, mcpManagerCache, memoryStoresCache, FILE_READ_MAX_BYTES, _aimsLocks;
|
|
314581
|
+
var PROBLEM_BASE, P, mcpManagerCache, memoryStoresCache, memoryInitTried, FILE_READ_MAX_BYTES, _aimsLocks;
|
|
315198
314582
|
var init_routes_v1 = __esm({
|
|
315199
314583
|
"packages/cli/src/api/routes-v1.ts"() {
|
|
315200
314584
|
"use strict";
|
|
315201
314585
|
init_http2();
|
|
315202
314586
|
init_config();
|
|
315203
314587
|
init_oa_directory();
|
|
314588
|
+
init_dist7();
|
|
315204
314589
|
PROBLEM_BASE = "https://openagents.nexus/problems";
|
|
315205
314590
|
P = {
|
|
315206
314591
|
notFound: `${PROBLEM_BASE}/not-found`,
|
|
@@ -315216,6 +314601,7 @@ var init_routes_v1 = __esm({
|
|
|
315216
314601
|
};
|
|
315217
314602
|
mcpManagerCache = /* @__PURE__ */ new Map();
|
|
315218
314603
|
memoryStoresCache = null;
|
|
314604
|
+
memoryInitTried = false;
|
|
315219
314605
|
FILE_READ_MAX_BYTES = 2 * 1024 * 1024;
|
|
315220
314606
|
_aimsLocks = /* @__PURE__ */ new Map();
|
|
315221
314607
|
}
|
|
@@ -316787,7 +316173,7 @@ var init_auth_oidc = __esm({
|
|
|
316787
316173
|
});
|
|
316788
316174
|
|
|
316789
316175
|
// packages/cli/src/api/chat-session.ts
|
|
316790
|
-
import { randomUUID as
|
|
316176
|
+
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
316791
316177
|
import { existsSync as existsSync74, readFileSync as readFileSync58, readdirSync as readdirSync24 } from "node:fs";
|
|
316792
316178
|
import { join as join91 } from "node:path";
|
|
316793
316179
|
function buildSystemPrompt(cwd4) {
|
|
@@ -316842,7 +316228,7 @@ function getSession(sessionId, model, cwd4) {
|
|
|
316842
316228
|
s2.lastActivity = Date.now();
|
|
316843
316229
|
return s2;
|
|
316844
316230
|
}
|
|
316845
|
-
const id = sessionId ||
|
|
316231
|
+
const id = sessionId || randomUUID7();
|
|
316846
316232
|
const systemPrompt = buildSystemPrompt(cwd4);
|
|
316847
316233
|
const session = {
|
|
316848
316234
|
id,
|
|
@@ -317477,7 +316863,7 @@ import { fileURLToPath as fileURLToPath16 } from "node:url";
|
|
|
317477
316863
|
import { dirname as dirname26, join as join95, resolve as resolve34 } from "node:path";
|
|
317478
316864
|
import { spawn as spawn25, execSync as execSync55 } from "node:child_process";
|
|
317479
316865
|
import { mkdirSync as mkdirSync46, readFileSync as readFileSync61, readdirSync as readdirSync26, existsSync as existsSync78 } from "node:fs";
|
|
317480
|
-
import { randomBytes as randomBytes19, randomUUID as
|
|
316866
|
+
import { randomBytes as randomBytes19, randomUUID as randomUUID8 } from "node:crypto";
|
|
317481
316867
|
function getVersion3() {
|
|
317482
316868
|
try {
|
|
317483
316869
|
const require3 = createRequire4(import.meta.url);
|
|
@@ -319267,7 +318653,7 @@ async function handleRequest(req2, res, ollamaUrl, verbose) {
|
|
|
319267
318653
|
const urlObj = new URL(req2.url ?? "/", `http://${req2.headers.host ?? "localhost"}`);
|
|
319268
318654
|
const pathname = urlObj.pathname;
|
|
319269
318655
|
const startMs = performance.now();
|
|
319270
|
-
const requestId = req2.headers["x-request-id"] ||
|
|
318656
|
+
const requestId = req2.headers["x-request-id"] || randomUUID8();
|
|
319271
318657
|
res.setHeader("X-Request-ID", requestId);
|
|
319272
318658
|
res.setHeader("X-API-Version", API_VERSION);
|
|
319273
318659
|
if (method === "OPTIONS") {
|
package/package.json
CHANGED