@signetai/connector-hermes-agent 0.147.21 → 0.147.24

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 CHANGED
@@ -8,7 +8,7 @@ import { fileURLToPath as fileURLToPath3 } from "node:url";
8
8
 
9
9
  // ../../../libs/connector-base/dist/index.js
10
10
  import { randomBytes } from "node:crypto";
11
- import { existsSync, readFileSync, renameSync, unlinkSync as unlinkSync2, writeFileSync } from "node:fs";
11
+ import { existsSync, readFileSync, renameSync, statSync, unlinkSync as unlinkSync2, writeFileSync } from "node:fs";
12
12
  import { dirname as dirname2, join as join3, resolve } from "node:path";
13
13
  import { createRequire } from "node:module";
14
14
  import { dirname, join } from "node:path";
@@ -61,7 +61,7 @@ MEMORY_SEARCH_SCHEMA = {
61
61
  "and timeframe when known; avoid diagnostic keyword soup."
62
62
  ),
63
63
  },
64
- "limit": {"type": "integer", "description": "Max results to return (default 10, max 50)."},
64
+ "limit": {"type": "integer", "description": "Max results to request (default 10, request max 100)."},
65
65
  "project": {"type": "string", "description": "Optional project path filter."},
66
66
  "type": {"type": "string", "description": "Filter by memory type."},
67
67
  "tags": {"type": "string", "description": "Filter by tags, comma-separated."},
@@ -910,7 +910,7 @@ class SignetMemoryProvider(MemoryProvider):
910
910
 
911
911
  result = self._client.recall(
912
912
  query,
913
- limit=_as_int(search_args.get("limit"), 10, minimum=1, maximum=50),
913
+ limit=search_args.get("limit"),
914
914
  project=str(search_args.get("project", "") or ""),
915
915
  memory_type=str(search_args.get("type", "") or ""),
916
916
  tags=str(search_args.get("tags", "") or ""),
@@ -13,6 +13,7 @@ from __future__ import annotations
13
13
 
14
14
  import json
15
15
  import logging
16
+ import math
16
17
  import os
17
18
  import ipaddress
18
19
  import urllib.error
@@ -35,6 +36,59 @@ def _sanitize(value: str) -> str:
35
36
  return value.strip().replace("\r", "").replace("\n", "")
36
37
 
37
38
 
39
+ def _normalize_recall_limit(value: Any) -> int:
40
+ """Match the versioned Signet recall request contract."""
41
+ if isinstance(value, bool) or not isinstance(value, (int, float)):
42
+ return 10
43
+ if isinstance(value, float) and not math.isfinite(value):
44
+ return 10
45
+ return min(100, max(1, math.trunc(value)))
46
+
47
+
48
+ def _build_recall_request_body(
49
+ query: str,
50
+ *,
51
+ limit: Any = None,
52
+ project: str = "",
53
+ memory_type: str = "",
54
+ tags: str = "",
55
+ who: str = "",
56
+ pinned: Optional[bool] = None,
57
+ importance_min: Optional[float] = None,
58
+ since: str = "",
59
+ until: str = "",
60
+ keyword_query: str = "",
61
+ aggregate: bool = False,
62
+ aggregate_budget: str = "",
63
+ save_aggregate: Optional[bool] = None,
64
+ agent_id: str = "",
65
+ ) -> Dict[str, Any]:
66
+ """Build canonical daemon JSON for the options exposed by Hermes."""
67
+ body: Dict[str, Any] = {"query": query, "limit": _normalize_recall_limit(limit)}
68
+ optional_strings = {
69
+ "project": project,
70
+ "type": memory_type,
71
+ "tags": tags,
72
+ "who": who,
73
+ "since": since,
74
+ "until": until,
75
+ "keywordQuery": keyword_query,
76
+ "agentId": agent_id,
77
+ }
78
+ body.update({key: value for key, value in optional_strings.items() if value})
79
+ if pinned is True:
80
+ body["pinned"] = True
81
+ if importance_min is not None:
82
+ body["importance_min"] = importance_min
83
+ if aggregate is True:
84
+ body["aggregate"] = True
85
+ if aggregate_budget in ("small", "medium", "large"):
86
+ body["aggregateBudget"] = aggregate_budget
87
+ if isinstance(save_aggregate, bool):
88
+ body["saveAggregate"] = save_aggregate
89
+ return body
90
+
91
+
38
92
  def _normalize_base_url(raw: str, source: str) -> str:
39
93
  """Normalize a daemon URL to an origin string."""
40
94
  parsed = urllib.parse.urlparse(raw)
@@ -397,7 +451,7 @@ class SignetClient:
397
451
  self,
398
452
  query: str,
399
453
  *,
400
- limit: int = 10,
454
+ limit: Any = None,
401
455
  project: str = "",
402
456
  memory_type: str = "",
403
457
  tags: str = "",
@@ -414,36 +468,23 @@ class SignetClient:
414
468
  agent_scoped: bool = False,
415
469
  ) -> Optional[Dict[str, Any]]:
416
470
  """Search memories via hybrid recall."""
417
- body: Dict[str, Any] = {
418
- "query": query,
419
- "limit": limit,
420
- }
421
- if project:
422
- body["project"] = project
423
- if memory_type:
424
- body["type"] = memory_type
425
- if tags:
426
- body["tags"] = tags
427
- if who:
428
- body["who"] = who
429
- if pinned is not None:
430
- body["pinned"] = pinned
431
- if importance_min is not None:
432
- body["importance_min"] = importance_min
433
- if since:
434
- body["since"] = since
435
- if until:
436
- body["until"] = until
437
- if keyword_query:
438
- body["keywordQuery"] = keyword_query
439
- if aggregate:
440
- body["aggregate"] = True
441
- if aggregate_budget in ("small", "medium", "large"):
442
- body["aggregateBudget"] = aggregate_budget
443
- if save_aggregate is not None:
444
- body["saveAggregate"] = save_aggregate
445
- if agent_scoped and self._agent_id:
446
- body["agentId"] = self._agent_id
471
+ body = _build_recall_request_body(
472
+ query,
473
+ limit=limit,
474
+ project=project,
475
+ memory_type=memory_type,
476
+ tags=tags,
477
+ who=who,
478
+ pinned=pinned,
479
+ importance_min=importance_min,
480
+ since=since,
481
+ until=until,
482
+ keyword_query=keyword_query,
483
+ aggregate=aggregate,
484
+ aggregate_budget=aggregate_budget,
485
+ save_aggregate=save_aggregate,
486
+ agent_id=self._agent_id if agent_scoped else "",
487
+ )
447
488
 
448
489
  result = self._post("/api/memory/recall", body, timeout=_RECALL_TIMEOUT_SECS)
449
490
  if (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signetai/connector-hermes-agent",
3
- "version": "0.147.21",
3
+ "version": "0.147.24",
4
4
  "description": "Signet connector for Hermes Agent — installs Signet as a pluggable memory provider",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -25,8 +25,8 @@
25
25
  "typecheck": "tsc --noEmit"
26
26
  },
27
27
  "dependencies": {
28
- "@signetai/connector-base": "0.147.21",
29
- "@signetai/core": "0.147.21"
28
+ "@signetai/connector-base": "0.147.24",
29
+ "@signetai/core": "0.147.24"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^22.0.0",