@signetai/signet-memory-openclaw 0.147.22 → 0.148.1

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 +348 -311
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6900,6 +6900,248 @@ var PIPELINE_PROVIDER_CHOICES = [
6900
6900
  var SYNTHESIS_PROVIDER_CHOICES = PIPELINE_PROVIDER_CHOICES.filter((provider) => provider !== "command");
6901
6901
  var PIPELINE_PROVIDER_SET = new Set(PIPELINE_PROVIDER_CHOICES);
6902
6902
  var SYNTHESIS_PROVIDER_SET = new Set(SYNTHESIS_PROVIDER_CHOICES);
6903
+ function isRecord(value) {
6904
+ return typeof value === "object" && value !== null && !Array.isArray(value);
6905
+ }
6906
+ function withDefined(value) {
6907
+ return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== undefined));
6908
+ }
6909
+ function normalizeRememberTags(tags) {
6910
+ if (typeof tags === "string") {
6911
+ const value = tags.split(",").map((tag) => tag.trim()).filter((tag) => tag.length > 0).join(",");
6912
+ return value.length > 0 ? value : undefined;
6913
+ }
6914
+ if (Array.isArray(tags)) {
6915
+ const value = tags.map((tag) => tag.trim()).filter((tag) => tag.length > 0).join(",");
6916
+ return value.length > 0 ? value : undefined;
6917
+ }
6918
+ return;
6919
+ }
6920
+ function normalizeRecallLimit(limit) {
6921
+ if (typeof limit !== "number" || !Number.isFinite(limit))
6922
+ return 10;
6923
+ return Math.min(100, Math.max(1, Math.trunc(limit)));
6924
+ }
6925
+ function partitionRecallRows(rows) {
6926
+ return {
6927
+ primary: rows.filter((row) => row.supplementary !== true),
6928
+ supporting: rows.filter((row) => row.supplementary === true)
6929
+ };
6930
+ }
6931
+ function parseRecallMeta(raw, fallbackCount) {
6932
+ if (!isRecord(raw)) {
6933
+ return {
6934
+ totalReturned: fallbackCount,
6935
+ hasSupplementary: false,
6936
+ noHits: fallbackCount === 0
6937
+ };
6938
+ }
6939
+ const totalReturned = typeof raw.totalReturned === "number" ? raw.totalReturned : fallbackCount;
6940
+ const hasSupplementary = raw.hasSupplementary === true;
6941
+ const noHits = "noHits" in raw ? raw.noHits === true : totalReturned === 0;
6942
+ const dedupe = isRecord(raw.dedupe) ? {
6943
+ enabled: raw.dedupe.enabled === true,
6944
+ contextEpoch: typeof raw.dedupe.contextEpoch === "number" ? raw.dedupe.contextEpoch : undefined,
6945
+ suppressed: typeof raw.dedupe.suppressed === "number" ? raw.dedupe.suppressed : 0,
6946
+ repeatedReturned: typeof raw.dedupe.repeatedReturned === "number" ? raw.dedupe.repeatedReturned : 0
6947
+ } : undefined;
6948
+ const temporal = isRecord(raw.temporal) ? raw.temporal : undefined;
6949
+ return { totalReturned, hasSupplementary, noHits, ...dedupe ? { dedupe } : {}, ...temporal ? { temporal } : {} };
6950
+ }
6951
+ function parseRecallPayload(raw) {
6952
+ const payload = isRecord(raw) ? raw : {};
6953
+ const results = Array.isArray(payload.results) ? payload.results : Array.isArray(payload.memories) ? payload.memories : [];
6954
+ const rows = results.filter(isRecord);
6955
+ return {
6956
+ query: typeof payload.query === "string" ? payload.query : undefined,
6957
+ method: typeof payload.method === "string" ? payload.method : undefined,
6958
+ rows,
6959
+ meta: parseRecallMeta(payload.meta, rows.length),
6960
+ message: typeof payload.message === "string" ? payload.message : undefined
6961
+ };
6962
+ }
6963
+ function applyRecallScoreThreshold(raw, minScore) {
6964
+ if (typeof minScore !== "number" || !Number.isFinite(minScore) || typeof raw !== "object" || raw === null || Array.isArray(raw)) {
6965
+ return raw;
6966
+ }
6967
+ const payload = raw;
6968
+ const rows = Array.isArray(payload.results) ? payload.results : [];
6969
+ const filtered = rows.filter((row) => typeof row.score !== "number" || row.score >= minScore);
6970
+ return {
6971
+ ...payload,
6972
+ results: filtered,
6973
+ meta: {
6974
+ ...isRecord(payload.meta) ? payload.meta : {},
6975
+ totalReturned: filtered.length,
6976
+ hasSupplementary: filtered.some((row) => row.supplementary === true),
6977
+ noHits: filtered.length === 0
6978
+ }
6979
+ };
6980
+ }
6981
+ function formatDate(value) {
6982
+ return typeof value === "string" && value.length > 0 ? value.slice(0, 10) : "unknown";
6983
+ }
6984
+ function formatRecallRow(row, options) {
6985
+ const score = typeof row.score === "number" ? `[${(row.score * 100).toFixed(0)}%] ` : "";
6986
+ const source = typeof row.source === "string" ? row.source : "unknown";
6987
+ const type = typeof row.type === "string" ? row.type : "memory";
6988
+ const who = typeof row.who === "string" && row.who.length > 0 ? `, by ${row.who}` : "";
6989
+ const createdAt = formatDate(row.created_at);
6990
+ const id = typeof row.id === "string" && row.id.length > 0 ? `id: ${row.id}; ` : "";
6991
+ const prefix = options?.includeIndex ? `${options.includeIndex}. ` : "- ";
6992
+ return `${prefix}${score}${id}${row.content ?? ""} (${type}, ${source}, ${createdAt}${who})`;
6993
+ }
6994
+ function temporalGroupLabel(row) {
6995
+ if (row.temporal_facet === "session")
6996
+ return "Sessions";
6997
+ if (row.temporal_facet === "source")
6998
+ return "Source Activity";
6999
+ if (row.temporal_facet === "occurred" || row.temporal_facet === "observed" || row.temporal_facet === "valid") {
7000
+ return "Events";
7001
+ }
7002
+ return "Memories Captured";
7003
+ }
7004
+ function formatTemporalDate(value) {
7005
+ const parsed = new Date(value);
7006
+ if (Number.isNaN(parsed.getTime()))
7007
+ return value.slice(0, 10);
7008
+ return parsed.toLocaleDateString("en-US", {
7009
+ month: "long",
7010
+ day: "numeric",
7011
+ year: "numeric",
7012
+ timeZone: "UTC"
7013
+ });
7014
+ }
7015
+ function formatTemporalRecallText(rows, meta) {
7016
+ const parts = [formatTemporalDate(meta.start)];
7017
+ const groups = new Map;
7018
+ for (const row of rows) {
7019
+ const label = temporalGroupLabel(row);
7020
+ groups.set(label, [...groups.get(label) ?? [], row]);
7021
+ }
7022
+ for (const label of ["Sessions", "Source Activity", "Events", "Memories Captured"]) {
7023
+ const group = groups.get(label);
7024
+ if (!group || group.length === 0)
7025
+ continue;
7026
+ parts.push("", label, ...group.map((row) => formatRecallRow(row)));
7027
+ }
7028
+ return parts.join(`
7029
+ `);
7030
+ }
7031
+ function formatRecallText(raw) {
7032
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
7033
+ return typeof raw === "string" ? raw : JSON.stringify(raw, null, 2);
7034
+ }
7035
+ const payload = raw;
7036
+ const parsed = parseRecallPayload(payload);
7037
+ if (parsed.message && parsed.rows.length === 0)
7038
+ return parsed.message;
7039
+ if (parsed.meta.noHits || parsed.rows.length === 0)
7040
+ return "No matching memories found.";
7041
+ const { primary, supporting } = partitionRecallRows(parsed.rows);
7042
+ if (parsed.meta.temporal?.mode === "timeline")
7043
+ return formatTemporalRecallText(primary, parsed.meta.temporal);
7044
+ const noun = parsed.meta.totalReturned === 1 ? "memory" : "memories";
7045
+ const parts = payload.aggregate?.partial === true && typeof payload.aggregate.message === "string" ? [
7046
+ payload.aggregate.message,
7047
+ "",
7048
+ `Found ${parsed.meta.totalReturned} ${noun}${parsed.method ? ` (${parsed.method})` : ""}.`
7049
+ ] : [`Found ${parsed.meta.totalReturned} ${noun}${parsed.method ? ` (${parsed.method})` : ""}.`];
7050
+ if (primary.length > 0) {
7051
+ parts.push("", "Primary matches:", ...primary.map((row) => formatRecallRow(row)));
7052
+ }
7053
+ if (supporting.length > 0) {
7054
+ parts.push("", "Supporting context:", ...supporting.map((row) => formatRecallRow(row)));
7055
+ }
7056
+ return parts.join(`
7057
+ `);
7058
+ }
7059
+ function buildRecallRequestBody(query, options = {}) {
7060
+ return withDefined({
7061
+ query,
7062
+ keywordQuery: options.keywordQuery ?? options.keyword_query,
7063
+ limit: normalizeRecallLimit(options.limit),
7064
+ project: options.project,
7065
+ type: options.type,
7066
+ tags: options.tags,
7067
+ who: options.who,
7068
+ pinned: options.pinned === true ? true : undefined,
7069
+ importance_min: options.importance_min,
7070
+ since: options.since,
7071
+ until: options.until,
7072
+ time: options.time,
7073
+ expand: options.expand === true ? true : undefined,
7074
+ agentId: options.agentId ?? options.agent_id ?? options.contextAgentId,
7075
+ sessionKey: options.sessionKey ?? options.session_key,
7076
+ includeRecalled: options.includeRecalled === true || options.include_recalled === true ? true : undefined,
7077
+ scope: options.scope,
7078
+ sourceOnly: options.sourceOnly === true || options.source_only === true ? true : undefined,
7079
+ aggregate: options.aggregate === true ? true : undefined,
7080
+ aggregateBudget: options.aggregateBudget ?? options.aggregate_budget,
7081
+ saveAggregate: options.saveAggregate === false || options.save_aggregate === false ? false : options.saveAggregate === true || options.save_aggregate === true ? true : undefined
7082
+ });
7083
+ }
7084
+ function normalizeStructuredMemoryPayload(value) {
7085
+ if (!isRecord(value))
7086
+ return value;
7087
+ const aspects = value.aspects;
7088
+ if (!Array.isArray(aspects))
7089
+ return value;
7090
+ return {
7091
+ ...value,
7092
+ aspects: aspects.map((aspect) => {
7093
+ if (!isRecord(aspect))
7094
+ return aspect;
7095
+ if (typeof aspect.entityName === "string" && Array.isArray(aspect.attributes))
7096
+ return aspect;
7097
+ if (typeof aspect.entity === "string" && typeof aspect.aspect === "string" && typeof aspect.value === "string") {
7098
+ return {
7099
+ entityName: aspect.entity,
7100
+ aspect: aspect.aspect,
7101
+ attributes: [
7102
+ withDefined({
7103
+ content: aspect.value,
7104
+ groupKey: typeof aspect.groupKey === "string" ? aspect.groupKey : undefined,
7105
+ claimKey: typeof aspect.claimKey === "string" ? aspect.claimKey : undefined,
7106
+ confidence: typeof aspect.confidence === "number" ? aspect.confidence : undefined,
7107
+ importance: typeof aspect.importance === "number" ? aspect.importance : undefined
7108
+ })
7109
+ ]
7110
+ };
7111
+ }
7112
+ return aspect;
7113
+ })
7114
+ };
7115
+ }
7116
+ function buildRememberRequestBody(content, options = {}) {
7117
+ return withDefined({
7118
+ content,
7119
+ type: options.type,
7120
+ importance: options.importance,
7121
+ tags: normalizeRememberTags(options.tags),
7122
+ who: options.who,
7123
+ pinned: options.pinned === true ? true : undefined,
7124
+ sourceType: options.sourceType,
7125
+ sourceId: options.sourceId,
7126
+ sourcePath: options.sourcePath,
7127
+ createdAt: options.createdAt,
7128
+ occurredAt: options.occurredAt,
7129
+ observedAt: options.observedAt,
7130
+ validFrom: options.validFrom,
7131
+ validUntil: options.validUntil,
7132
+ sourceCreatedAt: options.sourceCreatedAt,
7133
+ hints: options.hints,
7134
+ transcript: options.transcript,
7135
+ structured: normalizeStructuredMemoryPayload(options.structured),
7136
+ agentId: options.agentId,
7137
+ visibility: options.visibility,
7138
+ mode: options.mode,
7139
+ idempotencyKey: options.idempotencyKey,
7140
+ runtimePath: options.runtimePath,
7141
+ harness: options.harness,
7142
+ source: options.source
7143
+ });
7144
+ }
6903
7145
  var MEMORIES_FTS_TOKENIZER = "unicode61";
6904
7146
  function normalizeSql(sql) {
6905
7147
  return sql.replace(/\s+/g, " ").trim().toLowerCase();
@@ -10588,285 +10830,42 @@ var MIGRATIONS = [
10588
10830
  tables: ["entity_dependencies"]
10589
10831
  }
10590
10832
  },
10591
- {
10592
- version: 86,
10593
- name: "summary-jobs-content-hash",
10594
- up: up86,
10595
- artifacts: {
10596
- columns: [{ table: "summary_jobs", column: "content_hash" }]
10597
- }
10598
- },
10599
- {
10600
- version: 87,
10601
- name: "summary-jobs-boundary-reason",
10602
- up: up87,
10603
- artifacts: {
10604
- columns: [{ table: "summary_jobs", column: "boundary_reason" }]
10605
- }
10606
- }
10607
- ];
10608
- var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
10609
- var __filename2 = fileURLToPath(import.meta.url);
10610
- var __dirname2 = dirname(__filename2);
10611
- var import_yaml = __toESM(require_dist(), 1);
10612
- var LOCAL_BINDS = new Set(["127.0.0.1", "localhost", "::1", "::ffff:127.0.0.1"]);
10613
- var import_yaml2 = __toESM(require_dist(), 1);
10614
- function parseSimpleYaml(text) {
10615
- try {
10616
- const parsed = import_yaml2.default.parse(text);
10617
- return typeof parsed === "object" && parsed !== null ? parsed : {};
10618
- } catch {
10619
- return {};
10620
- }
10621
- }
10622
- var native = null;
10623
- try {
10624
- const esmRequire = createRequire22(import.meta.url);
10625
- native = esmRequire("@signet/native");
10626
- } catch {}
10627
- function isRecord3(value) {
10628
- return typeof value === "object" && value !== null && !Array.isArray(value);
10629
- }
10630
- function withDefined(value) {
10631
- return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== undefined));
10632
- }
10633
- function normalizeRememberTags(tags) {
10634
- if (typeof tags === "string") {
10635
- const value = tags.split(",").map((tag) => tag.trim()).filter((tag) => tag.length > 0).join(",");
10636
- return value.length > 0 ? value : undefined;
10637
- }
10638
- if (Array.isArray(tags)) {
10639
- const value = tags.map((tag) => tag.trim()).filter((tag) => tag.length > 0).join(",");
10640
- return value.length > 0 ? value : undefined;
10641
- }
10642
- return;
10643
- }
10644
- function normalizeRecallLimit(limit) {
10645
- if (typeof limit !== "number" || !Number.isFinite(limit))
10646
- return 10;
10647
- return Math.min(100, Math.max(1, Math.trunc(limit)));
10648
- }
10649
- function partitionRecallRows(rows) {
10650
- return {
10651
- primary: rows.filter((row) => row.supplementary !== true),
10652
- supporting: rows.filter((row) => row.supplementary === true)
10653
- };
10654
- }
10655
- function parseRecallMeta(raw, fallbackCount) {
10656
- if (!isRecord3(raw)) {
10657
- return {
10658
- totalReturned: fallbackCount,
10659
- hasSupplementary: false,
10660
- noHits: fallbackCount === 0
10661
- };
10662
- }
10663
- const totalReturned = typeof raw.totalReturned === "number" ? raw.totalReturned : fallbackCount;
10664
- const hasSupplementary = raw.hasSupplementary === true;
10665
- const noHits = "noHits" in raw ? raw.noHits === true : totalReturned === 0;
10666
- const dedupe = isRecord3(raw.dedupe) ? {
10667
- enabled: raw.dedupe.enabled === true,
10668
- contextEpoch: typeof raw.dedupe.contextEpoch === "number" ? raw.dedupe.contextEpoch : undefined,
10669
- suppressed: typeof raw.dedupe.suppressed === "number" ? raw.dedupe.suppressed : 0,
10670
- repeatedReturned: typeof raw.dedupe.repeatedReturned === "number" ? raw.dedupe.repeatedReturned : 0
10671
- } : undefined;
10672
- const temporal = isRecord3(raw.temporal) ? raw.temporal : undefined;
10673
- return { totalReturned, hasSupplementary, noHits, ...dedupe ? { dedupe } : {}, ...temporal ? { temporal } : {} };
10674
- }
10675
- function parseRecallPayload(raw) {
10676
- const payload = isRecord3(raw) ? raw : {};
10677
- const results = Array.isArray(payload.results) ? payload.results : Array.isArray(payload.memories) ? payload.memories : [];
10678
- const rows = results.filter(isRecord3);
10679
- return {
10680
- query: typeof payload.query === "string" ? payload.query : undefined,
10681
- method: typeof payload.method === "string" ? payload.method : undefined,
10682
- rows,
10683
- meta: parseRecallMeta(payload.meta, rows.length),
10684
- message: typeof payload.message === "string" ? payload.message : undefined
10685
- };
10686
- }
10687
- function applyRecallScoreThreshold(raw, minScore) {
10688
- if (typeof minScore !== "number" || !Number.isFinite(minScore) || typeof raw !== "object" || raw === null || Array.isArray(raw)) {
10689
- return raw;
10690
- }
10691
- const payload = raw;
10692
- const rows = Array.isArray(payload.results) ? payload.results : [];
10693
- const filtered = rows.filter((row) => typeof row.score !== "number" || row.score >= minScore);
10694
- return {
10695
- ...payload,
10696
- results: filtered,
10697
- meta: {
10698
- totalReturned: filtered.length,
10699
- hasSupplementary: filtered.some((row) => row.supplementary === true),
10700
- noHits: filtered.length === 0,
10701
- ...isRecord3(payload.meta) && isRecord3(payload.meta.dedupe) ? { dedupe: payload.meta.dedupe } : {},
10702
- ...isRecord3(payload.meta) && isRecord3(payload.meta.temporal) ? { temporal: payload.meta.temporal } : {}
10833
+ {
10834
+ version: 86,
10835
+ name: "summary-jobs-content-hash",
10836
+ up: up86,
10837
+ artifacts: {
10838
+ columns: [{ table: "summary_jobs", column: "content_hash" }]
10839
+ }
10840
+ },
10841
+ {
10842
+ version: 87,
10843
+ name: "summary-jobs-boundary-reason",
10844
+ up: up87,
10845
+ artifacts: {
10846
+ columns: [{ table: "summary_jobs", column: "boundary_reason" }]
10703
10847
  }
10704
- };
10705
- }
10706
- function formatDate(value) {
10707
- return typeof value === "string" && value.length > 0 ? value.slice(0, 10) : "unknown";
10708
- }
10709
- function formatRecallRow(row, options) {
10710
- const score = typeof row.score === "number" ? `[${(row.score * 100).toFixed(0)}%] ` : "";
10711
- const source = typeof row.source === "string" ? row.source : "unknown";
10712
- const type = typeof row.type === "string" ? row.type : "memory";
10713
- const who = typeof row.who === "string" && row.who.length > 0 ? `, by ${row.who}` : "";
10714
- const createdAt = formatDate(row.created_at);
10715
- const id = typeof row.id === "string" && row.id.length > 0 ? `id: ${row.id}; ` : "";
10716
- const prefix = options?.includeIndex ? `${options.includeIndex}. ` : "- ";
10717
- return `${prefix}${score}${id}${row.content ?? ""} (${type}, ${source}, ${createdAt}${who})`;
10718
- }
10719
- function temporalGroupLabel(row) {
10720
- if (row.temporal_facet === "session")
10721
- return "Sessions";
10722
- if (row.temporal_facet === "source")
10723
- return "Source Activity";
10724
- if (row.temporal_facet === "occurred" || row.temporal_facet === "observed" || row.temporal_facet === "valid") {
10725
- return "Events";
10726
- }
10727
- return "Memories Captured";
10728
- }
10729
- function formatTemporalDate(value) {
10730
- const parsed = new Date(value);
10731
- if (Number.isNaN(parsed.getTime()))
10732
- return value.slice(0, 10);
10733
- return parsed.toLocaleDateString("en-US", {
10734
- month: "long",
10735
- day: "numeric",
10736
- year: "numeric",
10737
- timeZone: "UTC"
10738
- });
10739
- }
10740
- function formatTemporalRecallText(rows, meta) {
10741
- const parts = [formatTemporalDate(meta.start)];
10742
- const groups = new Map;
10743
- for (const row of rows) {
10744
- const label = temporalGroupLabel(row);
10745
- groups.set(label, [...groups.get(label) ?? [], row]);
10746
- }
10747
- for (const label of ["Sessions", "Source Activity", "Events", "Memories Captured"]) {
10748
- const group = groups.get(label);
10749
- if (!group || group.length === 0)
10750
- continue;
10751
- parts.push("", label, ...group.map((row) => formatRecallRow(row)));
10752
- }
10753
- return parts.join(`
10754
- `);
10755
- }
10756
- function formatRecallText(raw) {
10757
- if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
10758
- return typeof raw === "string" ? raw : JSON.stringify(raw, null, 2);
10759
- }
10760
- const payload = raw;
10761
- const parsed = parseRecallPayload(payload);
10762
- if (parsed.message && parsed.rows.length === 0)
10763
- return parsed.message;
10764
- if (parsed.meta.noHits || parsed.rows.length === 0)
10765
- return "No matching memories found.";
10766
- const { primary, supporting } = partitionRecallRows(parsed.rows);
10767
- if (parsed.meta.temporal?.mode === "timeline")
10768
- return formatTemporalRecallText(primary, parsed.meta.temporal);
10769
- const noun = parsed.meta.totalReturned === 1 ? "memory" : "memories";
10770
- const parts = payload.aggregate?.partial === true && typeof payload.aggregate.message === "string" ? [
10771
- payload.aggregate.message,
10772
- "",
10773
- `Found ${parsed.meta.totalReturned} ${noun}${parsed.method ? ` (${parsed.method})` : ""}.`
10774
- ] : [`Found ${parsed.meta.totalReturned} ${noun}${parsed.method ? ` (${parsed.method})` : ""}.`];
10775
- if (primary.length > 0) {
10776
- parts.push("", "Primary matches:", ...primary.map((row) => formatRecallRow(row)));
10777
10848
  }
10778
- if (supporting.length > 0) {
10779
- parts.push("", "Supporting context:", ...supporting.map((row) => formatRecallRow(row)));
10849
+ ];
10850
+ var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
10851
+ var __filename2 = fileURLToPath(import.meta.url);
10852
+ var __dirname2 = dirname(__filename2);
10853
+ var import_yaml = __toESM(require_dist(), 1);
10854
+ var LOCAL_BINDS = new Set(["127.0.0.1", "localhost", "::1", "::ffff:127.0.0.1"]);
10855
+ var import_yaml2 = __toESM(require_dist(), 1);
10856
+ function parseSimpleYaml(text) {
10857
+ try {
10858
+ const parsed = import_yaml2.default.parse(text);
10859
+ return typeof parsed === "object" && parsed !== null ? parsed : {};
10860
+ } catch {
10861
+ return {};
10780
10862
  }
10781
- return parts.join(`
10782
- `);
10783
- }
10784
- function buildRecallRequestBody(query, options = {}) {
10785
- return withDefined({
10786
- query,
10787
- keywordQuery: options.keywordQuery ?? options.keyword_query,
10788
- limit: normalizeRecallLimit(options.limit),
10789
- project: options.project,
10790
- type: options.type,
10791
- tags: options.tags,
10792
- who: options.who,
10793
- pinned: options.pinned === true ? true : undefined,
10794
- importance_min: options.importance_min,
10795
- since: options.since,
10796
- until: options.until,
10797
- time: options.time,
10798
- expand: options.expand === true ? true : undefined,
10799
- agentId: options.agentId ?? options.agent_id ?? options.contextAgentId,
10800
- sessionKey: options.sessionKey ?? options.session_key,
10801
- includeRecalled: options.includeRecalled === true || options.include_recalled === true ? true : undefined,
10802
- scope: options.scope,
10803
- sourceOnly: options.sourceOnly === true || options.source_only === true ? true : undefined,
10804
- aggregate: options.aggregate === true ? true : undefined,
10805
- aggregateBudget: options.aggregateBudget ?? options.aggregate_budget,
10806
- saveAggregate: options.saveAggregate === false || options.save_aggregate === false ? false : options.saveAggregate === true || options.save_aggregate === true ? true : undefined
10807
- });
10808
- }
10809
- function normalizeStructuredMemoryPayload(value) {
10810
- if (!isRecord3(value))
10811
- return value;
10812
- const aspects = value.aspects;
10813
- if (!Array.isArray(aspects))
10814
- return value;
10815
- return {
10816
- ...value,
10817
- aspects: aspects.map((aspect) => {
10818
- if (!isRecord3(aspect))
10819
- return aspect;
10820
- if (typeof aspect.entityName === "string" && Array.isArray(aspect.attributes))
10821
- return aspect;
10822
- if (typeof aspect.entity === "string" && typeof aspect.aspect === "string" && typeof aspect.value === "string") {
10823
- return {
10824
- entityName: aspect.entity,
10825
- aspect: aspect.aspect,
10826
- attributes: [
10827
- withDefined({
10828
- content: aspect.value,
10829
- groupKey: typeof aspect.groupKey === "string" ? aspect.groupKey : undefined,
10830
- claimKey: typeof aspect.claimKey === "string" ? aspect.claimKey : undefined,
10831
- confidence: typeof aspect.confidence === "number" ? aspect.confidence : undefined,
10832
- importance: typeof aspect.importance === "number" ? aspect.importance : undefined
10833
- })
10834
- ]
10835
- };
10836
- }
10837
- return aspect;
10838
- })
10839
- };
10840
- }
10841
- function buildRememberRequestBody(content, options = {}) {
10842
- return withDefined({
10843
- content,
10844
- type: options.type,
10845
- importance: options.importance,
10846
- tags: normalizeRememberTags(options.tags),
10847
- who: options.who,
10848
- pinned: options.pinned === true ? true : undefined,
10849
- sourceType: options.sourceType,
10850
- sourceId: options.sourceId,
10851
- sourcePath: options.sourcePath,
10852
- createdAt: options.createdAt,
10853
- occurredAt: options.occurredAt,
10854
- observedAt: options.observedAt,
10855
- validFrom: options.validFrom,
10856
- validUntil: options.validUntil,
10857
- sourceCreatedAt: options.sourceCreatedAt,
10858
- hints: options.hints,
10859
- transcript: options.transcript,
10860
- structured: normalizeStructuredMemoryPayload(options.structured),
10861
- agentId: options.agentId,
10862
- visibility: options.visibility,
10863
- mode: options.mode,
10864
- idempotencyKey: options.idempotencyKey,
10865
- runtimePath: options.runtimePath,
10866
- harness: options.harness,
10867
- source: options.source
10868
- });
10869
10863
  }
10864
+ var native = null;
10865
+ try {
10866
+ const esmRequire = createRequire22(import.meta.url);
10867
+ native = esmRequire("@signet/native");
10868
+ } catch {}
10870
10869
  var SIGNET_SOURCE_CHECKOUT_DIRNAME = "signetai";
10871
10870
  var SIGNET_GIT_ALLOWED_DIRECTORIES = ["skills", "tools", "dreaming"];
10872
10871
  var SIGNET_GIT_PROTECTED_PATHS = [
@@ -11297,6 +11296,61 @@ var CODE_EXTS = new Set([
11297
11296
  var SKIP_FILES = new Set([".DS_Store", "Thumbs.db", ".gitkeep", "node_modules", ".git", ".env", ".env.local"]);
11298
11297
 
11299
11298
  // ../../../libs/sdk/dist/index.js
11299
+ function isRecord2(value) {
11300
+ return typeof value === "object" && value !== null && !Array.isArray(value);
11301
+ }
11302
+ function withDefined2(value) {
11303
+ return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== undefined));
11304
+ }
11305
+ function normalizeRecallLimit2(limit) {
11306
+ if (typeof limit !== "number" || !Number.isFinite(limit))
11307
+ return 10;
11308
+ return Math.min(100, Math.max(1, Math.trunc(limit)));
11309
+ }
11310
+ function applyRecallScoreThreshold2(raw, minScore) {
11311
+ if (typeof minScore !== "number" || !Number.isFinite(minScore) || typeof raw !== "object" || raw === null || Array.isArray(raw)) {
11312
+ return raw;
11313
+ }
11314
+ const payload = raw;
11315
+ const rows = Array.isArray(payload.results) ? payload.results : [];
11316
+ const filtered = rows.filter((row) => typeof row.score !== "number" || row.score >= minScore);
11317
+ return {
11318
+ ...payload,
11319
+ results: filtered,
11320
+ meta: {
11321
+ ...isRecord2(payload.meta) ? payload.meta : {},
11322
+ totalReturned: filtered.length,
11323
+ hasSupplementary: filtered.some((row) => row.supplementary === true),
11324
+ noHits: filtered.length === 0
11325
+ }
11326
+ };
11327
+ }
11328
+ function buildRecallRequestBody2(query, options = {}) {
11329
+ return withDefined2({
11330
+ query,
11331
+ keywordQuery: options.keywordQuery ?? options.keyword_query,
11332
+ limit: normalizeRecallLimit2(options.limit),
11333
+ project: options.project,
11334
+ type: options.type,
11335
+ tags: options.tags,
11336
+ who: options.who,
11337
+ pinned: options.pinned === true ? true : undefined,
11338
+ importance_min: options.importance_min,
11339
+ since: options.since,
11340
+ until: options.until,
11341
+ time: options.time,
11342
+ expand: options.expand === true ? true : undefined,
11343
+ agentId: options.agentId ?? options.agent_id ?? options.contextAgentId,
11344
+ sessionKey: options.sessionKey ?? options.session_key,
11345
+ includeRecalled: options.includeRecalled === true || options.include_recalled === true ? true : undefined,
11346
+ scope: options.scope,
11347
+ sourceOnly: options.sourceOnly === true || options.source_only === true ? true : undefined,
11348
+ aggregate: options.aggregate === true ? true : undefined,
11349
+ aggregateBudget: options.aggregateBudget ?? options.aggregate_budget,
11350
+ saveAggregate: options.saveAggregate === false || options.save_aggregate === false ? false : options.saveAggregate === true || options.save_aggregate === true ? true : undefined
11351
+ });
11352
+ }
11353
+
11300
11354
  class SignetClientP2 {
11301
11355
  transport;
11302
11356
  constructor(transport) {
@@ -11544,20 +11598,7 @@ class SignetTimeoutError extends SignetNetworkError {
11544
11598
  }
11545
11599
  }
11546
11600
  function applyRecallMinScore(result, minScore) {
11547
- if (typeof minScore !== "number") {
11548
- return result;
11549
- }
11550
- const filtered = result.results.filter((row) => row.score >= minScore);
11551
- return {
11552
- ...result,
11553
- results: filtered,
11554
- meta: {
11555
- ...result.meta,
11556
- totalReturned: filtered.length,
11557
- hasSupplementary: filtered.some((row) => row.supplementary === true),
11558
- noHits: filtered.length === 0
11559
- }
11560
- };
11601
+ return applyRecallScoreThreshold2(result, minScore);
11561
11602
  }
11562
11603
 
11563
11604
  class SignetClientHelpers {
@@ -11599,10 +11640,8 @@ class SignetClientHelpers {
11599
11640
  return this.waitForDocument(result.id);
11600
11641
  }
11601
11642
  async recallOrThrow(query, opts) {
11602
- const result = applyRecallMinScore(await this.transport.post("/api/memory/recall", {
11603
- query,
11604
- ...opts
11605
- }), opts?.minScore);
11643
+ const { minScore, ...requestOptions } = opts ?? {};
11644
+ const result = applyRecallMinScore(await this.transport.post("/api/memory/recall", buildRecallRequestBody2(query, requestOptions)), minScore);
11606
11645
  if (!result.results || result.results.length === 0) {
11607
11646
  throw new Error(`No memories found for query: "${query}"`);
11608
11647
  }
@@ -11789,10 +11828,8 @@ class SignetClient extends SignetClientHelpers {
11789
11828
  });
11790
11829
  }
11791
11830
  async recall(query, opts) {
11792
- return applyRecallMinScore(await this.transport.post("/api/memory/recall", {
11793
- query,
11794
- ...opts
11795
- }), opts?.minScore);
11831
+ const { minScore, ...requestOptions } = opts ?? {};
11832
+ return applyRecallMinScore(await this.transport.post("/api/memory/recall", buildRecallRequestBody2(query, requestOptions)), minScore);
11796
11833
  }
11797
11834
  async getMemory(id) {
11798
11835
  return this.transport.get(`/api/memory/${id}`);
@@ -14778,7 +14815,7 @@ function firstNonEmptyString(...values) {
14778
14815
  }
14779
14816
  return;
14780
14817
  }
14781
- function isRecord(value) {
14818
+ function isRecord3(value) {
14782
14819
  return typeof value === "object" && value !== null;
14783
14820
  }
14784
14821
  function isAssistantMessage(message) {
@@ -14794,7 +14831,7 @@ function getMessageText(message) {
14794
14831
  return;
14795
14832
  const textParts = [];
14796
14833
  for (const chunk of message.content) {
14797
- if (!isRecord(chunk))
14834
+ if (!isRecord3(chunk))
14798
14835
  continue;
14799
14836
  const part = chunk;
14800
14837
  if (part.type !== "text")
@@ -14817,7 +14854,7 @@ function extractLastAssistantMessage(event) {
14817
14854
  return;
14818
14855
  for (let i = messages.length - 1;i >= 0; i--) {
14819
14856
  const raw = messages[i];
14820
- if (!isRecord(raw))
14857
+ if (!isRecord3(raw))
14821
14858
  continue;
14822
14859
  const message = raw;
14823
14860
  if (!isAssistantMessage(message))
@@ -14838,7 +14875,7 @@ function extractLastUserMessage(messages) {
14838
14875
  return;
14839
14876
  for (let i = messages.length - 1;i >= 0; i--) {
14840
14877
  const raw = messages[i];
14841
- if (!isRecord(raw))
14878
+ if (!isRecord3(raw))
14842
14879
  continue;
14843
14880
  if (!isUserMessage(raw))
14844
14881
  continue;
@@ -15028,7 +15065,7 @@ async function memoryRecall(query, options = {}) {
15028
15065
  const result = await daemonFetch(daemonUrl, "/api/memory/recall", {
15029
15066
  method: "POST",
15030
15067
  body: buildRecallRequestBody(query, {
15031
- limit: options.limit ?? 10,
15068
+ limit: options.limit,
15032
15069
  type: options.type,
15033
15070
  aggregate: options.aggregate,
15034
15071
  aggregateBudget: options.aggregateBudget,
@@ -15428,7 +15465,7 @@ function readNumber(value) {
15428
15465
  return typeof value === "number" && Number.isFinite(value) ? value : undefined;
15429
15466
  }
15430
15467
  function resolveCtx(event, ctx) {
15431
- const c = isRecord(ctx) ? ctx : {};
15468
+ const c = isRecord3(ctx) ? ctx : {};
15432
15469
  return {
15433
15470
  sessionKey: readString(c.sessionKey) ?? readString(event.sessionKey) ?? readString(c.sessionId) ?? readString(event.sessionId),
15434
15471
  agentId: readString(c.agentId) ?? readString(event.agentId),
@@ -15438,7 +15475,7 @@ function resolveCtx(event, ctx) {
15438
15475
  };
15439
15476
  }
15440
15477
  function resolveCompactionSessionFile(event, sessionFile) {
15441
- const compaction = isRecord(event.compaction) ? event.compaction : undefined;
15478
+ const compaction = isRecord3(event.compaction) ? event.compaction : undefined;
15442
15479
  return firstNonEmptyString(event.sessionFile, event.session_file, compaction?.sessionFile, compaction?.session_file, sessionFile);
15443
15480
  }
15444
15481
  function readSessionFileProject(sessionFile) {
@@ -15450,7 +15487,7 @@ function readSessionFileProject(sessionFile) {
15450
15487
  for (const line of lines) {
15451
15488
  try {
15452
15489
  const row = JSON.parse(line);
15453
- if (!isRecord(row) || row.type !== "session")
15490
+ if (!isRecord3(row) || row.type !== "session")
15454
15491
  continue;
15455
15492
  return firstNonEmptyString(row.cwd, row.project, row.workspace);
15456
15493
  } catch {}
@@ -15462,7 +15499,7 @@ function extractCompactionSummary(event, sessionFile) {
15462
15499
  const direct = readString(event.summary);
15463
15500
  if (direct)
15464
15501
  return direct;
15465
- const compaction = isRecord(event.compaction) ? event.compaction : undefined;
15502
+ const compaction = isRecord3(event.compaction) ? event.compaction : undefined;
15466
15503
  const nested = readString(compaction?.summary);
15467
15504
  if (nested)
15468
15505
  return nested;
@@ -15474,7 +15511,7 @@ function extractCompactionSummary(event, sessionFile) {
15474
15511
  for (let i = lines.length - 1;i >= 0; i--) {
15475
15512
  try {
15476
15513
  const row = JSON.parse(lines[i]);
15477
- if (!isRecord(row) || row.type !== "compaction")
15514
+ if (!isRecord3(row) || row.type !== "compaction")
15478
15515
  continue;
15479
15516
  const summary = readString(row.summary);
15480
15517
  if (summary)
@@ -15485,7 +15522,7 @@ function extractCompactionSummary(event, sessionFile) {
15485
15522
  return;
15486
15523
  }
15487
15524
  function buildCompactionEventKey(event, options) {
15488
- const compaction = isRecord(event.compaction) ? event.compaction : undefined;
15525
+ const compaction = isRecord3(event.compaction) ? event.compaction : undefined;
15489
15526
  const parts = [
15490
15527
  options.agentId ?? "-",
15491
15528
  options.sessionKey ?? "-",
@@ -16011,7 +16048,7 @@ ${lines.join(`
16011
16048
  },
16012
16049
  timeout: WRITE_TIMEOUT
16013
16050
  }).then((resp) => {
16014
- if (isRecord(resp) && resp.skipped === true) {
16051
+ if (isRecord3(resp) && resp.skipped === true) {
16015
16052
  const cur = checkpointTurns.get(scopedKey);
16016
16053
  if (cur && cur.count < CHECKPOINT_TURN_THRESHOLD - 1)
16017
16054
  checkpointTurns.set(scopedKey, { ...cur, count: CHECKPOINT_TURN_THRESHOLD - 1 });
@@ -16024,7 +16061,7 @@ ${lines.join(`
16024
16061
  });
16025
16062
  };
16026
16063
  const resolveCompactionProject = (event, resolved) => {
16027
- const compaction = isRecord(event.compaction) ? event.compaction : undefined;
16064
+ const compaction = isRecord3(event.compaction) ? event.compaction : undefined;
16028
16065
  const sessionFile = resolveCompactionSessionFile(event, resolved.sessionFile);
16029
16066
  return firstNonEmptyString(event.cwd, event.project, event.workspace, compaction?.project, compaction?.cwd, compaction?.workspace, resolved.project, readSessionFileProject(sessionFile));
16030
16067
  };
@@ -16042,7 +16079,7 @@ ${lines.join(`
16042
16079
  if (!cfg.enabled || !daemonReachable)
16043
16080
  return;
16044
16081
  const resolved = resolveCtx(event, ctx);
16045
- const messageCount = typeof event.messageCount === "number" ? event.messageCount : typeof event.compactingCount === "number" ? event.compactingCount : typeof event.compactedCount === "number" ? event.compactedCount : isRecord(event.compaction) && typeof event.compaction.compactingCount === "number" ? event.compaction.compactingCount : isRecord(event.compaction) && typeof event.compaction.compactedCount === "number" ? event.compaction.compactedCount : undefined;
16082
+ const messageCount = typeof event.messageCount === "number" ? event.messageCount : typeof event.compactingCount === "number" ? event.compactingCount : typeof event.compactedCount === "number" ? event.compactedCount : isRecord3(event.compaction) && typeof event.compaction.compactingCount === "number" ? event.compaction.compactingCount : isRecord3(event.compaction) && typeof event.compaction.compactedCount === "number" ? event.compaction.compactedCount : undefined;
16046
16083
  const dedupeKey = buildCompactionEventKey(event, {
16047
16084
  agentId: resolved.agentId,
16048
16085
  sessionKey: resolved.sessionKey
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signetai/signet-memory-openclaw",
3
- "version": "0.147.22",
3
+ "version": "0.148.1",
4
4
  "description": "Signet adapter for OpenClaw — runtime plugin for AI agent memory",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",