@signetai/signet-memory-openclaw 0.134.0 → 0.135.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/index.js +80 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9402,6 +9402,29 @@ function up75(db) {
|
|
|
9402
9402
|
ON memory_artifacts(agent_id, source_id, source_root);
|
|
9403
9403
|
`);
|
|
9404
9404
|
}
|
|
9405
|
+
function up76(db) {
|
|
9406
|
+
db.exec(`
|
|
9407
|
+
CREATE TABLE IF NOT EXISTS temporal_edges (
|
|
9408
|
+
id TEXT PRIMARY KEY,
|
|
9409
|
+
agent_id TEXT NOT NULL DEFAULT 'default',
|
|
9410
|
+
subject_type TEXT NOT NULL,
|
|
9411
|
+
subject_id TEXT NOT NULL,
|
|
9412
|
+
facet TEXT NOT NULL CHECK(facet IN ('captured', 'session', 'source', 'observed', 'occurred', 'valid')),
|
|
9413
|
+
start_at TEXT NOT NULL,
|
|
9414
|
+
end_at TEXT,
|
|
9415
|
+
confidence REAL NOT NULL DEFAULT 1.0,
|
|
9416
|
+
provenance_json TEXT,
|
|
9417
|
+
metadata_json TEXT,
|
|
9418
|
+
created_at TEXT NOT NULL,
|
|
9419
|
+
updated_at TEXT NOT NULL
|
|
9420
|
+
);
|
|
9421
|
+
|
|
9422
|
+
CREATE INDEX IF NOT EXISTS idx_temporal_edges_agent_facet_range
|
|
9423
|
+
ON temporal_edges(agent_id, facet, start_at, end_at);
|
|
9424
|
+
CREATE INDEX IF NOT EXISTS idx_temporal_edges_agent_subject
|
|
9425
|
+
ON temporal_edges(agent_id, subject_type, subject_id);
|
|
9426
|
+
`);
|
|
9427
|
+
}
|
|
9405
9428
|
var MIGRATIONS = [
|
|
9406
9429
|
{
|
|
9407
9430
|
version: 1,
|
|
@@ -10004,6 +10027,14 @@ var MIGRATIONS = [
|
|
|
10004
10027
|
{ table: "memory_artifacts", column: "source_meta_json" }
|
|
10005
10028
|
]
|
|
10006
10029
|
}
|
|
10030
|
+
},
|
|
10031
|
+
{
|
|
10032
|
+
version: 76,
|
|
10033
|
+
name: "temporal-edges",
|
|
10034
|
+
up: up76,
|
|
10035
|
+
artifacts: {
|
|
10036
|
+
tables: ["temporal_edges"]
|
|
10037
|
+
}
|
|
10007
10038
|
}
|
|
10008
10039
|
];
|
|
10009
10040
|
var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
|
|
@@ -10065,7 +10096,8 @@ function parseRecallMeta(raw, fallbackCount) {
|
|
|
10065
10096
|
suppressed: typeof raw.dedupe.suppressed === "number" ? raw.dedupe.suppressed : 0,
|
|
10066
10097
|
repeatedReturned: typeof raw.dedupe.repeatedReturned === "number" ? raw.dedupe.repeatedReturned : 0
|
|
10067
10098
|
} : undefined;
|
|
10068
|
-
|
|
10099
|
+
const temporal = isRecord3(raw.temporal) ? raw.temporal : undefined;
|
|
10100
|
+
return { totalReturned, hasSupplementary, noHits, ...dedupe ? { dedupe } : {}, ...temporal ? { temporal } : {} };
|
|
10069
10101
|
}
|
|
10070
10102
|
function parseRecallPayload(raw) {
|
|
10071
10103
|
const payload = isRecord3(raw) ? raw : {};
|
|
@@ -10093,7 +10125,8 @@ function applyRecallScoreThreshold(raw, minScore) {
|
|
|
10093
10125
|
totalReturned: filtered.length,
|
|
10094
10126
|
hasSupplementary: filtered.some((row) => row.supplementary === true),
|
|
10095
10127
|
noHits: filtered.length === 0,
|
|
10096
|
-
...isRecord3(payload.meta) && isRecord3(payload.meta.dedupe) ? { dedupe: payload.meta.dedupe } : {}
|
|
10128
|
+
...isRecord3(payload.meta) && isRecord3(payload.meta.dedupe) ? { dedupe: payload.meta.dedupe } : {},
|
|
10129
|
+
...isRecord3(payload.meta) && isRecord3(payload.meta.temporal) ? { temporal: payload.meta.temporal } : {}
|
|
10097
10130
|
}
|
|
10098
10131
|
};
|
|
10099
10132
|
}
|
|
@@ -10110,6 +10143,43 @@ function formatRecallRow(row, options) {
|
|
|
10110
10143
|
const prefix = options?.includeIndex ? `${options.includeIndex}. ` : "- ";
|
|
10111
10144
|
return `${prefix}${score}${id}${row.content ?? ""} (${type}, ${source}, ${createdAt}${who})`;
|
|
10112
10145
|
}
|
|
10146
|
+
function temporalGroupLabel(row) {
|
|
10147
|
+
if (row.temporal_facet === "session")
|
|
10148
|
+
return "Sessions";
|
|
10149
|
+
if (row.temporal_facet === "source")
|
|
10150
|
+
return "Source Activity";
|
|
10151
|
+
if (row.temporal_facet === "occurred" || row.temporal_facet === "observed" || row.temporal_facet === "valid") {
|
|
10152
|
+
return "Events";
|
|
10153
|
+
}
|
|
10154
|
+
return "Memories Captured";
|
|
10155
|
+
}
|
|
10156
|
+
function formatTemporalDate(value) {
|
|
10157
|
+
const parsed = new Date(value);
|
|
10158
|
+
if (Number.isNaN(parsed.getTime()))
|
|
10159
|
+
return value.slice(0, 10);
|
|
10160
|
+
return parsed.toLocaleDateString("en-US", {
|
|
10161
|
+
month: "long",
|
|
10162
|
+
day: "numeric",
|
|
10163
|
+
year: "numeric",
|
|
10164
|
+
timeZone: "UTC"
|
|
10165
|
+
});
|
|
10166
|
+
}
|
|
10167
|
+
function formatTemporalRecallText(rows, meta) {
|
|
10168
|
+
const parts = [formatTemporalDate(meta.start)];
|
|
10169
|
+
const groups = new Map;
|
|
10170
|
+
for (const row of rows) {
|
|
10171
|
+
const label = temporalGroupLabel(row);
|
|
10172
|
+
groups.set(label, [...groups.get(label) ?? [], row]);
|
|
10173
|
+
}
|
|
10174
|
+
for (const label of ["Sessions", "Source Activity", "Events", "Memories Captured"]) {
|
|
10175
|
+
const group = groups.get(label);
|
|
10176
|
+
if (!group || group.length === 0)
|
|
10177
|
+
continue;
|
|
10178
|
+
parts.push("", label, ...group.map((row) => formatRecallRow(row)));
|
|
10179
|
+
}
|
|
10180
|
+
return parts.join(`
|
|
10181
|
+
`);
|
|
10182
|
+
}
|
|
10113
10183
|
function formatRecallText(raw) {
|
|
10114
10184
|
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
10115
10185
|
return typeof raw === "string" ? raw : JSON.stringify(raw, null, 2);
|
|
@@ -10121,6 +10191,8 @@ function formatRecallText(raw) {
|
|
|
10121
10191
|
if (parsed.meta.noHits || parsed.rows.length === 0)
|
|
10122
10192
|
return "No matching memories found.";
|
|
10123
10193
|
const { primary, supporting } = partitionRecallRows(parsed.rows);
|
|
10194
|
+
if (parsed.meta.temporal?.mode === "timeline")
|
|
10195
|
+
return formatTemporalRecallText(primary, parsed.meta.temporal);
|
|
10124
10196
|
const noun = parsed.meta.totalReturned === 1 ? "memory" : "memories";
|
|
10125
10197
|
const parts = [`Found ${parsed.meta.totalReturned} ${noun}${parsed.method ? ` (${parsed.method})` : ""}.`];
|
|
10126
10198
|
if (primary.length > 0) {
|
|
@@ -10145,6 +10217,7 @@ function buildRecallRequestBody(query, options = {}) {
|
|
|
10145
10217
|
importance_min: options.importance_min,
|
|
10146
10218
|
since: options.since,
|
|
10147
10219
|
until: options.until,
|
|
10220
|
+
time: options.time,
|
|
10148
10221
|
expand: options.expand === true ? true : undefined,
|
|
10149
10222
|
agentId: options.agentId,
|
|
10150
10223
|
sessionKey: options.sessionKey,
|
|
@@ -10200,6 +10273,11 @@ function buildRememberRequestBody(content, options = {}) {
|
|
|
10200
10273
|
sourceId: options.sourceId,
|
|
10201
10274
|
sourcePath: options.sourcePath,
|
|
10202
10275
|
createdAt: options.createdAt,
|
|
10276
|
+
occurredAt: options.occurredAt,
|
|
10277
|
+
observedAt: options.observedAt,
|
|
10278
|
+
validFrom: options.validFrom,
|
|
10279
|
+
validUntil: options.validUntil,
|
|
10280
|
+
sourceCreatedAt: options.sourceCreatedAt,
|
|
10203
10281
|
hints: options.hints,
|
|
10204
10282
|
transcript: options.transcript,
|
|
10205
10283
|
structured: normalizeStructuredMemoryPayload(options.structured),
|