open-agents-ai 0.187.344 → 0.187.346

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.
Files changed (2) hide show
  1. package/dist/index.js +502 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -259301,6 +259301,7 @@ print(classes[top])
259301
259301
  textParts.push(`Speech: "${episode.audio.transcript}"`);
259302
259302
  episode.text = { content: textParts.join(". ") || "Multi-modal capture", entities: [] };
259303
259303
  this.saveEpisode(episode);
259304
+ this.bridgeToEpisodeStore(episode);
259304
259305
  return {
259305
259306
  success: true,
259306
259307
  output: `Multi-modal episode captured (${episodeId}):
@@ -259379,6 +259380,7 @@ else:
259379
259380
  }
259380
259381
  }
259381
259382
  this.saveEpisode(episode);
259383
+ this.bridgeToEpisodeStore(episode);
259382
259384
  }
259383
259385
  return {
259384
259386
  success: true,
@@ -259550,6 +259552,88 @@ ${lines.join("\n")}`,
259550
259552
  });
259551
259553
  writeFileSync17(MM_INDEX, JSON.stringify(index, null, 2));
259552
259554
  }
259555
+ /**
259556
+ * WO-AM-GAP-02: Bridge multimodal episode to SQLite EpisodeStore + TemporalGraph.
259557
+ * Makes multimodal episodes visible to PPR retrieval, zettelkasten linking,
259558
+ * and the orchestrator's context injection system.
259559
+ */
259560
+ bridgeToEpisodeStore(episode) {
259561
+ try {
259562
+ const { EpisodeStore: EpisodeStore3, TemporalGraph: TemporalGraph3 } = __require("@open-agents/memory");
259563
+ const { existsSync: fsExists } = __require("node:fs");
259564
+ const { join: pathJoin } = __require("node:path");
259565
+ const cwd4 = process.cwd();
259566
+ const oaDirs = [pathJoin(cwd4, ".oa_test"), pathJoin(cwd4, ".oa")];
259567
+ const oaDir = oaDirs.find((d2) => fsExists(d2));
259568
+ if (!oaDir)
259569
+ return;
259570
+ const es = new EpisodeStore3(pathJoin(oaDir, "memory.db"));
259571
+ const tg = new TemporalGraph3(pathJoin(oaDir, "kg.db"));
259572
+ const contentParts = [];
259573
+ if (episode.social?.personName)
259574
+ contentParts.push(`Met ${episode.social.personName}`);
259575
+ if (episode.audio?.transcript)
259576
+ contentParts.push(`Said: "${episode.audio.transcript}"`);
259577
+ if (episode.audio?.soundClass)
259578
+ contentParts.push(`Sound: ${episode.audio.soundClass}`);
259579
+ if (episode.visual?.faceNames?.length)
259580
+ contentParts.push(`Faces: ${episode.visual.faceNames.join(", ")}`);
259581
+ if (episode.visual?.objects?.length)
259582
+ contentParts.push(`Objects: ${episode.visual.objects.join(", ")}`);
259583
+ if (episode.spatial?.locationLabel)
259584
+ contentParts.push(`Location: ${episode.spatial.locationLabel}`);
259585
+ const content = contentParts.join(". ") || episode.text?.content || "Multimodal capture";
259586
+ const modality = episode.social?.personName ? "social" : episode.visual?.imagePath ? "visual" : episode.audio?.recordingPath ? "audio" : "text";
259587
+ const epId = es.insert({
259588
+ sessionId: episode.sessionId,
259589
+ modality,
259590
+ toolName: "multimodal_memory",
259591
+ content,
259592
+ importance: episode.social?.personName ? 9 : 7,
259593
+ decayClass: episode.social?.personName ? "permanent" : "daily",
259594
+ metadata: {
259595
+ multimodal_episode_id: episode.id,
259596
+ has_face: (episode.visual?.faceIds?.length ?? 0) > 0,
259597
+ has_audio: !!episode.audio?.recordingPath,
259598
+ has_gps: !!episode.spatial?.gps
259599
+ }
259600
+ });
259601
+ if (episode.visual?.clipEmbedding) {
259602
+ const emb = new Float32Array(episode.visual.clipEmbedding);
259603
+ es.setEmbedding(epId, emb);
259604
+ }
259605
+ if (episode.social?.personName) {
259606
+ const personId = tg.upsertNode({ text: episode.social.personName, nodeType: "person" });
259607
+ tg.addEdge({
259608
+ srcId: personId,
259609
+ dstId: personId,
259610
+ relation: "discovered_during",
259611
+ fact: `Met ${episode.social.personName} via multimodal capture`,
259612
+ edgeType: "triple",
259613
+ sourceEpisodeId: epId,
259614
+ modality
259615
+ });
259616
+ }
259617
+ if (episode.spatial?.locationLabel) {
259618
+ const locId = tg.upsertNode({ text: episode.spatial.locationLabel, nodeType: "location" });
259619
+ if (episode.social?.personName) {
259620
+ const personNode = tg.findNode(episode.social.personName, "person");
259621
+ if (personNode) {
259622
+ tg.addEdge({
259623
+ srcId: personNode.id,
259624
+ dstId: locId,
259625
+ relation: "appears_in",
259626
+ fact: `${episode.social.personName} seen at ${episode.spatial.locationLabel}`,
259627
+ sourceEpisodeId: epId
259628
+ });
259629
+ }
259630
+ }
259631
+ }
259632
+ es.close();
259633
+ tg.close();
259634
+ } catch {
259635
+ }
259636
+ }
259553
259637
  loadEpisode(id) {
259554
259638
  const file = join52(MM_DIR, id, "episode.json");
259555
259639
  try {
@@ -267715,12 +267799,14 @@ function autoImportance(toolName, modality, content) {
267715
267799
  return 5;
267716
267800
  if (toolName?.startsWith("memory_"))
267717
267801
  return 6;
267718
- if (modality === "visual" || modality === "audio")
267719
- return 7;
267720
267802
  if (modality === "social")
267721
- return 8;
267722
- if (modality === "spatial")
267803
+ return 9;
267804
+ if (modality === "visual")
267805
+ return 7;
267806
+ if (modality === "audio")
267723
267807
  return 6;
267808
+ if (modality === "spatial")
267809
+ return 5;
267724
267810
  if (modality === "reflection")
267725
267811
  return 7;
267726
267812
  if (modality === "gist")
@@ -267738,7 +267824,13 @@ function autoDecayClass(toolName, modality, content) {
267738
267824
  return "daily";
267739
267825
  if (content.toLowerCase().includes("error") || content.toLowerCase().includes("failed"))
267740
267826
  return "procedural";
267741
- if (["visual", "audio", "social", "spatial"].includes(modality))
267827
+ if (modality === "social")
267828
+ return "permanent";
267829
+ if (modality === "visual")
267830
+ return "procedural";
267831
+ if (modality === "spatial")
267832
+ return "procedural";
267833
+ if (modality === "audio")
267742
267834
  return "daily";
267743
267835
  if (modality === "reflection" || modality === "gist")
267744
267836
  return "procedural";
@@ -267793,6 +267885,10 @@ var init_episodeStore = __esm({
267793
267885
  this.db.exec(`CREATE INDEX IF NOT EXISTS idx_ep_tool ON episodes(tool_name)`);
267794
267886
  this.db.exec(`CREATE INDEX IF NOT EXISTS idx_ep_decay ON episodes(decay_class)`);
267795
267887
  this.db.exec(`CREATE INDEX IF NOT EXISTS idx_ep_hash ON episodes(content_hash, session_id)`);
267888
+ try {
267889
+ this.db.exec(`ALTER TABLE episodes ADD COLUMN clip_embedding BLOB`);
267890
+ } catch {
267891
+ }
267796
267892
  this.db.pragma("journal_mode = WAL");
267797
267893
  this.db.pragma("synchronous = NORMAL");
267798
267894
  }
@@ -267853,7 +267949,37 @@ var init_episodeStore = __esm({
267853
267949
  }
267854
267950
  sql += " ORDER BY timestamp DESC LIMIT ?";
267855
267951
  params.push(Math.min(limit * 5, 500));
267856
- const rows = this.db.prepare(sql).all(...params);
267952
+ let rows = this.db.prepare(sql).all(...params);
267953
+ if (query.metadataFilter || query.soundClass || query.rmsRange) {
267954
+ rows = rows.filter((row) => {
267955
+ let meta = null;
267956
+ try {
267957
+ meta = row.metadata ? typeof row.metadata === "string" ? JSON.parse(row.metadata) : row.metadata : null;
267958
+ } catch {
267959
+ return false;
267960
+ }
267961
+ if (!meta)
267962
+ return false;
267963
+ if (query.metadataFilter) {
267964
+ for (const [k, v] of Object.entries(query.metadataFilter)) {
267965
+ if (meta[k] !== v)
267966
+ return false;
267967
+ }
267968
+ }
267969
+ if (query.soundClass && meta.sound_class !== query.soundClass)
267970
+ return false;
267971
+ if (query.rmsRange) {
267972
+ const rms = meta.rms_db ?? meta.rmsDb;
267973
+ if (typeof rms !== "number")
267974
+ return false;
267975
+ if (query.rmsRange.min !== void 0 && rms < query.rmsRange.min)
267976
+ return false;
267977
+ if (query.rmsRange.max !== void 0 && rms > query.rmsRange.max)
267978
+ return false;
267979
+ }
267980
+ return true;
267981
+ });
267982
+ }
267857
267983
  const scored = rows.map((row) => {
267858
267984
  const ep = this.rowToEpisode(row);
267859
267985
  const tau = DECAY_TAU[ep.decayClass] ?? DECAY_TAU.daily;
@@ -267883,7 +268009,8 @@ var init_episodeStore = __esm({
267883
268009
  emb = Math.max(0, Math.min(1, (emb + 1) / 2));
267884
268010
  }
267885
268011
  const relevance = wLex * lex + wEmb * emb;
267886
- const score = recency + importance + relevance;
268012
+ const strengthBonus = Math.min(1, Math.log2(Math.max(1, ep.strength)));
268013
+ const score = recency + importance + relevance + strengthBonus;
267887
268014
  return { episode: ep, score };
267888
268015
  });
267889
268016
  scored.sort((a2, b) => b.score - a2.score);
@@ -267929,6 +268056,11 @@ var init_episodeStore = __esm({
267929
268056
  const buf = Buffer.from(embedding.buffer);
267930
268057
  this.db.prepare("UPDATE episodes SET embedding = ? WHERE id = ?").run(buf, id);
267931
268058
  }
268059
+ /** WO-AM-GAP-03: Set CLIP embedding for cross-modal retrieval (512d). */
268060
+ setClipEmbedding(id, clipEmbedding) {
268061
+ const buf = Buffer.from(clipEmbedding.buffer);
268062
+ this.db.prepare("UPDATE episodes SET clip_embedding = ? WHERE id = ?").run(buf, id);
268063
+ }
267932
268064
  /** Update gist for an episode (from WO-AM-07 gist compression). */
267933
268065
  setGist(id, gist) {
267934
268066
  this.db.prepare("UPDATE episodes SET gist = ? WHERE id = ?").run(gist, id);
@@ -267961,6 +268093,7 @@ var init_episodeStore = __esm({
267961
268093
  decayClass: row.decay_class,
267962
268094
  strength: typeof row.strength === "number" && Number.isFinite(row.strength) ? row.strength : 1,
267963
268095
  lastRetrieved: row.last_retrieved,
268096
+ clipEmbedding: row.clip_embedding ? new Float32Array(new Uint8Array(row.clip_embedding).buffer) : null,
267964
268097
  gist: row.gist,
267965
268098
  sourceEpisodeId: row.source_episode_id
267966
268099
  };
@@ -268989,6 +269122,319 @@ var init_proceduralMemoryStore = __esm({
268989
269122
  }
268990
269123
  });
268991
269124
 
269125
+ // packages/memory/dist/splanifold.js
269126
+ function h00(t2) {
269127
+ return 2 * t2 * t2 * t2 - 3 * t2 * t2 + 1;
269128
+ }
269129
+ function h01(t2) {
269130
+ return -2 * t2 * t2 * t2 + 3 * t2 * t2;
269131
+ }
269132
+ function h10(t2) {
269133
+ return t2 * (t2 - 1) * (t2 - 1);
269134
+ }
269135
+ function h11(t2) {
269136
+ return t2 * t2 * (t2 - 1);
269137
+ }
269138
+ function evaluate(controls, r2) {
269139
+ const { K: K2, N, P: P2, E: Eb, Pd, Ed, expansion, epsSigma, deltaMax } = controls;
269140
+ const eps2 = epsSigma * epsSigma;
269141
+ const u = new Float64Array(K2);
269142
+ const scale = 1 + 2 * expansion;
269143
+ for (let k = 0; k < K2; k++) {
269144
+ u[k] = scale * r2[k] - expansion;
269145
+ }
269146
+ let sigma = 0;
269147
+ for (let k = 0; k < K2; k++)
269148
+ sigma += u[k];
269149
+ const t2 = sigma / K2;
269150
+ const delta = new Float64Array(K2);
269151
+ for (let k = 0; k < K2; k++)
269152
+ delta[k] = u[k] - t2;
269153
+ let deltaTilde = delta;
269154
+ if (isFinite(deltaMax)) {
269155
+ const normSq = delta.reduce((s2, d2) => s2 + d2 * d2, 0);
269156
+ const norm = Math.sqrt(normSq);
269157
+ if (norm > 0) {
269158
+ const warpScale = 1 / Math.sqrt(1 + (norm / deltaMax) ** 2);
269159
+ deltaTilde = new Float64Array(K2);
269160
+ for (let k = 0; k < K2; k++)
269161
+ deltaTilde[k] = delta[k] * warpScale;
269162
+ }
269163
+ }
269164
+ const w = new Float64Array(K2);
269165
+ const denom = sigma * sigma + eps2;
269166
+ for (let k = 0; k < K2; k++) {
269167
+ w[k] = (sigma * u[k] + eps2 / K2) / denom;
269168
+ }
269169
+ const V0 = matVecColMajor(Pd[0], N, K2, w);
269170
+ const V1 = matVecColMajor(Pd[1], N, K2, w);
269171
+ const spine = hermite(P2[0], P2[1], V0, V1, t2, N);
269172
+ const D0 = matVecColMajor(Eb[0], N, K2, deltaTilde);
269173
+ const D1 = matVecColMajor(Eb[1], N, K2, deltaTilde);
269174
+ const T0 = matVecColMajor(Ed[0], N, K2, deltaTilde);
269175
+ const T1 = matVecColMajor(Ed[1], N, K2, deltaTilde);
269176
+ const trans = hermite(D0, D1, T0, T1, t2, N);
269177
+ const out = new Float64Array(N);
269178
+ for (let n2 = 0; n2 < N; n2++)
269179
+ out[n2] = spine[n2] + trans[n2];
269180
+ return out;
269181
+ }
269182
+ function hermite(A, B, Ad, Bd, t2, N) {
269183
+ const h0 = h00(t2), h1 = h01(t2), d0 = h10(t2), d1 = h11(t2);
269184
+ const out = new Float64Array(N);
269185
+ for (let n2 = 0; n2 < N; n2++) {
269186
+ out[n2] = h0 * A[n2] + h1 * B[n2] + d0 * Ad[n2] + d1 * Bd[n2];
269187
+ }
269188
+ return out;
269189
+ }
269190
+ function matVecColMajor(M, N, K2, x) {
269191
+ const y = new Float64Array(N);
269192
+ for (let k = 0; k < K2; k++) {
269193
+ const xk = x[k];
269194
+ const offset = k * N;
269195
+ for (let n2 = 0; n2 < N; n2++) {
269196
+ y[n2] += M[offset + n2] * xk;
269197
+ }
269198
+ }
269199
+ return y;
269200
+ }
269201
+ function fit(samples, K2, N, config) {
269202
+ const expansion = config?.expansion ?? 0;
269203
+ const epsSigma = config?.epsSigma ?? 0.02;
269204
+ const deltaMax = config?.deltaMax ?? Infinity;
269205
+ const lambda = config?.ridgeLambda ?? 1e-4;
269206
+ const eps2 = epsSigma * epsSigma;
269207
+ const S = samples.length;
269208
+ const cols = 2 + 6 * K2;
269209
+ const F = new Float64Array(cols * S);
269210
+ const X = new Float64Array(N * S);
269211
+ const scale = 1 + 2 * expansion;
269212
+ for (let j = 0; j < S; j++) {
269213
+ const r2 = samples[j].input;
269214
+ const x = samples[j].output;
269215
+ const u = new Float64Array(K2);
269216
+ for (let k = 0; k < K2; k++)
269217
+ u[k] = scale * r2[k] - expansion;
269218
+ let sigma = 0;
269219
+ for (let k = 0; k < K2; k++)
269220
+ sigma += u[k];
269221
+ const t2 = sigma / K2;
269222
+ const deltaTilde = new Float64Array(K2);
269223
+ for (let k = 0; k < K2; k++)
269224
+ deltaTilde[k] = u[k] - t2;
269225
+ if (isFinite(deltaMax)) {
269226
+ const normSq = deltaTilde.reduce((s2, d2) => s2 + d2 * d2, 0);
269227
+ const norm = Math.sqrt(normSq);
269228
+ if (norm > 0) {
269229
+ const warpScale = 1 / Math.sqrt(1 + (norm / deltaMax) ** 2);
269230
+ for (let k = 0; k < K2; k++)
269231
+ deltaTilde[k] *= warpScale;
269232
+ }
269233
+ }
269234
+ const w = new Float64Array(K2);
269235
+ const denom = sigma * sigma + eps2;
269236
+ for (let k = 0; k < K2; k++) {
269237
+ w[k] = (sigma * u[k] + eps2 / K2) / denom;
269238
+ }
269239
+ const a0 = h00(t2), a1 = h01(t2), b0 = h10(t2), b1 = h11(t2);
269240
+ let col2 = 0;
269241
+ F[col2 * S + j] = a0;
269242
+ col2++;
269243
+ F[col2 * S + j] = a1;
269244
+ col2++;
269245
+ for (let k = 0; k < K2; k++) {
269246
+ F[col2 * S + j] = b0 * w[k];
269247
+ col2++;
269248
+ }
269249
+ for (let k = 0; k < K2; k++) {
269250
+ F[col2 * S + j] = b1 * w[k];
269251
+ col2++;
269252
+ }
269253
+ for (let k = 0; k < K2; k++) {
269254
+ F[col2 * S + j] = a0 * deltaTilde[k];
269255
+ col2++;
269256
+ }
269257
+ for (let k = 0; k < K2; k++) {
269258
+ F[col2 * S + j] = a1 * deltaTilde[k];
269259
+ col2++;
269260
+ }
269261
+ for (let k = 0; k < K2; k++) {
269262
+ F[col2 * S + j] = b0 * deltaTilde[k];
269263
+ col2++;
269264
+ }
269265
+ for (let k = 0; k < K2; k++) {
269266
+ F[col2 * S + j] = b1 * deltaTilde[k];
269267
+ col2++;
269268
+ }
269269
+ for (let n2 = 0; n2 < N; n2++)
269270
+ X[n2 * S + j] = x[n2];
269271
+ }
269272
+ const G = new Float64Array(cols * cols);
269273
+ for (let i2 = 0; i2 < cols; i2++) {
269274
+ for (let jj = i2; jj < cols; jj++) {
269275
+ let dot = 0;
269276
+ for (let s2 = 0; s2 < S; s2++)
269277
+ dot += F[i2 * S + s2] * F[jj * S + s2];
269278
+ G[i2 * cols + jj] = dot;
269279
+ G[jj * cols + i2] = dot;
269280
+ }
269281
+ G[i2 * cols + i2] += lambda;
269282
+ }
269283
+ const Ginv = invertSPD(G, cols);
269284
+ const XFt = new Float64Array(N * cols);
269285
+ for (let n2 = 0; n2 < N; n2++) {
269286
+ for (let c8 = 0; c8 < cols; c8++) {
269287
+ let dot = 0;
269288
+ for (let s2 = 0; s2 < S; s2++)
269289
+ dot += X[n2 * S + s2] * F[c8 * S + s2];
269290
+ XFt[n2 * cols + c8] = dot;
269291
+ }
269292
+ }
269293
+ const C = new Float64Array(N * cols);
269294
+ for (let n2 = 0; n2 < N; n2++) {
269295
+ for (let c8 = 0; c8 < cols; c8++) {
269296
+ let dot = 0;
269297
+ for (let cc = 0; cc < cols; cc++)
269298
+ dot += XFt[n2 * cols + cc] * Ginv[cc * cols + c8];
269299
+ C[n2 * cols + c8] = dot;
269300
+ }
269301
+ }
269302
+ const extractCol = (idx) => {
269303
+ const v = new Float64Array(N);
269304
+ for (let n2 = 0; n2 < N; n2++)
269305
+ v[n2] = C[n2 * cols + idx];
269306
+ return v;
269307
+ };
269308
+ const extractMat = (startCol, numCols) => {
269309
+ const M = new Float64Array(N * numCols);
269310
+ for (let k = 0; k < numCols; k++) {
269311
+ for (let n2 = 0; n2 < N; n2++) {
269312
+ M[k * N + n2] = C[n2 * cols + startCol + k];
269313
+ }
269314
+ }
269315
+ return M;
269316
+ };
269317
+ let col = 0;
269318
+ const P0 = extractCol(col++);
269319
+ const P1 = extractCol(col++);
269320
+ const Pd0 = extractMat(col, K2);
269321
+ col += K2;
269322
+ const Pd1 = extractMat(col, K2);
269323
+ col += K2;
269324
+ const E0 = extractMat(col, K2);
269325
+ col += K2;
269326
+ const E1 = extractMat(col, K2);
269327
+ col += K2;
269328
+ const Ed0 = extractMat(col, K2);
269329
+ col += K2;
269330
+ const Ed1 = extractMat(col, K2);
269331
+ col += K2;
269332
+ return {
269333
+ K: K2,
269334
+ N,
269335
+ P: [P0, P1],
269336
+ E: [E0, E1],
269337
+ Pd: [Pd0, Pd1],
269338
+ Ed: [Ed0, Ed1],
269339
+ expansion,
269340
+ epsSigma,
269341
+ deltaMax
269342
+ };
269343
+ }
269344
+ function invertSPD(A, n2) {
269345
+ const L = new Float64Array(n2 * n2);
269346
+ for (let i2 = 0; i2 < n2; i2++) {
269347
+ for (let j = 0; j <= i2; j++) {
269348
+ let sum = A[i2 * n2 + j];
269349
+ for (let k = 0; k < j; k++)
269350
+ sum -= L[i2 * n2 + k] * L[j * n2 + k];
269351
+ if (i2 === j) {
269352
+ if (sum <= 0) {
269353
+ const Areg = new Float64Array(A);
269354
+ for (let ii = 0; ii < n2; ii++)
269355
+ Areg[ii * n2 + ii] += 1e-6;
269356
+ return invertSPD(Areg, n2);
269357
+ }
269358
+ L[i2 * n2 + j] = Math.sqrt(sum);
269359
+ } else {
269360
+ L[i2 * n2 + j] = sum / L[j * n2 + j];
269361
+ }
269362
+ }
269363
+ }
269364
+ const Ainv = new Float64Array(n2 * n2);
269365
+ const col = new Float64Array(n2);
269366
+ for (let c8 = 0; c8 < n2; c8++) {
269367
+ col.fill(0);
269368
+ for (let i2 = 0; i2 < n2; i2++) {
269369
+ let sum = i2 === c8 ? 1 : 0;
269370
+ for (let k = 0; k < i2; k++)
269371
+ sum -= L[i2 * n2 + k] * col[k];
269372
+ col[i2] = sum / L[i2 * n2 + i2];
269373
+ }
269374
+ for (let i2 = n2 - 1; i2 >= 0; i2--) {
269375
+ let sum = col[i2];
269376
+ for (let k = i2 + 1; k < n2; k++)
269377
+ sum -= L[k * n2 + i2] * col[k];
269378
+ col[i2] = sum / L[i2 * n2 + i2];
269379
+ }
269380
+ for (let i2 = 0; i2 < n2; i2++)
269381
+ Ainv[i2 * n2 + c8] = col[i2];
269382
+ }
269383
+ return Ainv;
269384
+ }
269385
+ function serialize(controls) {
269386
+ return {
269387
+ K: controls.K,
269388
+ N: controls.N,
269389
+ P: [Array.from(controls.P[0]), Array.from(controls.P[1])],
269390
+ E: [Array.from(controls.E[0]), Array.from(controls.E[1])],
269391
+ Pd: [Array.from(controls.Pd[0]), Array.from(controls.Pd[1])],
269392
+ Ed: [Array.from(controls.Ed[0]), Array.from(controls.Ed[1])],
269393
+ expansion: controls.expansion,
269394
+ epsSigma: controls.epsSigma,
269395
+ deltaMax: controls.deltaMax
269396
+ };
269397
+ }
269398
+ function deserialize(obj) {
269399
+ return {
269400
+ K: obj.K,
269401
+ N: obj.N,
269402
+ P: [obj.P[0], obj.P[1]].map((a2) => new Float64Array(a2)),
269403
+ E: [obj.E[0], obj.E[1]].map((a2) => new Float64Array(a2)),
269404
+ Pd: [obj.Pd[0], obj.Pd[1]].map((a2) => new Float64Array(a2)),
269405
+ Ed: [obj.Ed[0], obj.Ed[1]].map((a2) => new Float64Array(a2)),
269406
+ expansion: obj.expansion,
269407
+ epsSigma: obj.epsSigma,
269408
+ deltaMax: obj.deltaMax
269409
+ };
269410
+ }
269411
+ function rmse(controls, samples) {
269412
+ let sumSq = 0;
269413
+ for (const s2 of samples) {
269414
+ const pred = evaluate(controls, s2.input);
269415
+ for (let n2 = 0; n2 < controls.N; n2++) {
269416
+ const diff = pred[n2] - s2.output[n2];
269417
+ sumSq += diff * diff;
269418
+ }
269419
+ }
269420
+ return Math.sqrt(sumSq / (samples.length * controls.N));
269421
+ }
269422
+ function cosine(a2, b) {
269423
+ let dot = 0, na = 0, nb = 0;
269424
+ for (let i2 = 0; i2 < a2.length; i2++) {
269425
+ dot += a2[i2] * b[i2];
269426
+ na += a2[i2] * a2[i2];
269427
+ nb += b[i2] * b[i2];
269428
+ }
269429
+ const denom = Math.sqrt(na) * Math.sqrt(nb);
269430
+ return denom > 0 ? dot / denom : 0;
269431
+ }
269432
+ var init_splanifold = __esm({
269433
+ "packages/memory/dist/splanifold.js"() {
269434
+ "use strict";
269435
+ }
269436
+ });
269437
+
268992
269438
  // packages/memory/dist/index.js
268993
269439
  var dist_exports3 = {};
268994
269440
  __export(dist_exports3, {
@@ -269018,7 +269464,13 @@ __export(dist_exports3, {
269018
269464
  initDb: () => initDb,
269019
269465
  linkEpisode: () => linkEpisode,
269020
269466
  personalizedPageRank: () => personalizedPageRank,
269021
- retrieveByPPR: () => retrieveByPPR
269467
+ retrieveByPPR: () => retrieveByPPR,
269468
+ splanifoldCosine: () => cosine,
269469
+ splanifoldDeserialize: () => deserialize,
269470
+ splanifoldEvaluate: () => evaluate,
269471
+ splanifoldFit: () => fit,
269472
+ splanifoldRmse: () => rmse,
269473
+ splanifoldSerialize: () => serialize
269022
269474
  });
269023
269475
  var init_dist7 = __esm({
269024
269476
  "packages/memory/dist/index.js"() {
@@ -269038,6 +269490,7 @@ var init_dist7 = __esm({
269038
269490
  init_pprRetrieval();
269039
269491
  init_embeddings();
269040
269492
  init_proceduralMemoryStore();
269493
+ init_splanifold();
269041
269494
  }
269042
269495
  });
269043
269496
 
@@ -269706,6 +270159,19 @@ function repairJson(raw) {
269706
270159
  }
269707
270160
  return found ? result : null;
269708
270161
  }
270162
+ function inferEpisodeModality(toolName) {
270163
+ if (VISUAL_TOOLS.has(toolName))
270164
+ return "visual";
270165
+ if (AUDIO_TOOLS.has(toolName))
270166
+ return "audio";
270167
+ if (SOCIAL_TOOLS.has(toolName))
270168
+ return "social";
270169
+ if (SPATIAL_TOOLS.has(toolName))
270170
+ return "spatial";
270171
+ if (CODE_TOOLS.has(toolName))
270172
+ return "code";
270173
+ return "tool_result";
270174
+ }
269709
270175
  function getSystemPromptForTier(tier) {
269710
270176
  switch (tier) {
269711
270177
  case "small":
@@ -269746,7 +270212,7 @@ ${todoItems}
269746
270212
  </system-reminder>`;
269747
270213
  return { shouldInject: true, content, reason: "injected" };
269748
270214
  }
269749
- var SYSTEM_PROMPT, SYSTEM_PROMPT_MEDIUM, SYSTEM_PROMPT_SMALL, AgenticRunner, OllamaAgenticBackend;
270215
+ var SYSTEM_PROMPT, SYSTEM_PROMPT_MEDIUM, SYSTEM_PROMPT_SMALL, VISUAL_TOOLS, AUDIO_TOOLS, SOCIAL_TOOLS, SPATIAL_TOOLS, CODE_TOOLS, AgenticRunner, OllamaAgenticBackend;
269750
270216
  var init_agenticRunner = __esm({
269751
270217
  "packages/orchestrator/dist/agenticRunner.js"() {
269752
270218
  "use strict";
@@ -269764,6 +270230,11 @@ var init_agenticRunner = __esm({
269764
270230
  SYSTEM_PROMPT = loadPrompt("agentic/system-large.md");
269765
270231
  SYSTEM_PROMPT_MEDIUM = loadPrompt("agentic/system-medium.md");
269766
270232
  SYSTEM_PROMPT_SMALL = loadPrompt("agentic/system-small.md");
270233
+ VISUAL_TOOLS = /* @__PURE__ */ new Set(["vision", "camera_capture", "image_read", "screenshot", "ocr", "ocr_image_advanced", "visual_memory", "desktop_describe", "ocr_pdf", "generate_image"]);
270234
+ AUDIO_TOOLS = /* @__PURE__ */ new Set(["audio_capture", "audio_analyze", "asr_listen", "transcribe_file", "transcribe_url", "audio_playback", "youtube_download"]);
270235
+ SOCIAL_TOOLS = /* @__PURE__ */ new Set(["multimodal_memory", "send_message", "jibberlink"]);
270236
+ SPATIAL_TOOLS = /* @__PURE__ */ new Set(["gps_location", "bluetooth_scan", "wifi_control", "sdr_scan", "meshtastic"]);
270237
+ CODE_TOOLS = /* @__PURE__ */ new Set(["file_write", "file_edit", "file_patch", "batch_edit", "code_sandbox", "repl_exec", "notebook_edit"]);
269767
270238
  AgenticRunner = class {
269768
270239
  backend;
269769
270240
  tools = /* @__PURE__ */ new Map();
@@ -271582,17 +272053,33 @@ ${cachedEntry2.result.slice(0, 500)}` : `[BLOCKED — the observer confirmed thi
271582
272053
  if (this._episodeStore) {
271583
272054
  try {
271584
272055
  const episodeContent = result.success ? `${tc.name}: ${(result.output ?? "").slice(0, 500)}` : `${tc.name} ERROR: ${(result.error ?? result.output ?? "").slice(0, 500)}`;
272056
+ const episodeModality = inferEpisodeModality(tc.name);
272057
+ let episodeMetadata = {
272058
+ args_fingerprint: argsKey.slice(0, 200),
272059
+ success: result.success,
272060
+ duration_ms: performance.now() - toolStart
272061
+ };
272062
+ if (result.success && ["audio_analyze", "audio_capture"].includes(tc.name)) {
272063
+ try {
272064
+ const parsed = JSON.parse(result.output ?? "{}");
272065
+ if (parsed.rms_db !== void 0)
272066
+ episodeMetadata.rms_db = parsed.rms_db;
272067
+ if (parsed.classifications)
272068
+ episodeMetadata.sound_class = parsed.classifications[0]?.class;
272069
+ if (parsed.peak_frequencies)
272070
+ episodeMetadata.peak_frequencies = parsed.peak_frequencies.slice(0, 3);
272071
+ if (parsed.band_energy_db)
272072
+ episodeMetadata.band_energy = parsed.band_energy_db;
272073
+ } catch {
272074
+ }
272075
+ }
271585
272076
  const episodeId = this._episodeStore.insert({
271586
272077
  sessionId: this._sessionId,
271587
272078
  turnNumber: turn,
271588
- modality: "tool_result",
272079
+ modality: episodeModality,
271589
272080
  toolName: tc.name,
271590
272081
  content: episodeContent,
271591
- metadata: {
271592
- args_fingerprint: argsKey.slice(0, 200),
271593
- success: result.success,
271594
- duration_ms: performance.now() - toolStart
271595
- }
272082
+ metadata: episodeMetadata
271596
272083
  });
271597
272084
  if (this._embeddingAvailable && episodeContent.length > 20) {
271598
272085
  this._pendingEmbeddings.push({ id: episodeId, content: episodeContent.slice(0, 500) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.344",
3
+ "version": "0.187.346",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) \u2014 interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",