pacomind-hermes 1.5.24
“Native Hermes general and memory adapters for PacoMind”
Agent Skills SKILL.md definition file
SHA-2569f1ed5912396ff4d665a0a79a3239888690c72c9c47e31d6c1106f774d0d5e26
MaleculeK(Am)
Evidence
1"""Durable source ownership for Hermes transcript payloads.
2
3Only native anchors, source revisions, payload hashes and pending erasure state
4live in the existing outbox. No conversation copy, canonical answer or worker
5is created. Native writers own mutation, lease checks and cache invalidation.
6"""
7import asyncio
8from contextlib import closing
9import hashlib
10import json
11import logging
12import re
13from pathlib import Path
14import sqlite3
15import threading
16
17from .client import source_input_erased, source_message_hash
18
19logger = logging.getLogger(__name__)
20
21
22def _json(value):
23 return json.dumps(value, sort_keys=True, separators=(',', ':'), ensure_ascii=True)
24
25
⋯4 lines
40 @staticmethod
41 def _path():
42 from hermes_state import _default_db_path
43 return Path(_default_db_path()).resolve()
44
45 def _native_read(self, path=None):
46 db = sqlite3.connect(Path(path or self._path()).as_uri()+'?mode=ro', uri=True, timeout=1)
47 db.row_factory = sqlite3.Row
48 return db
49
50 def retain(self, scope, sources, *, native_l …
69:11… return []
70 path = self._path()
71 with closing(self.outbox._connect()) as ledger:
72 owners = [dict(row, metadata=json.loads(row['metadata_json'])) for row in ledger.execute(
73 "SELECT * FROM native_source_ownership WHERE contact_id=? AND ("
74 "(json_extract(metadata_json,'$.kind')='cron' AND json_extract(metadata_json,'$.nativ …
90:39… act(child.model_config,'$._branched_from'),'')=''
91 ) SELECT id FROM lineage""", (scope.session_id,))}
92 spans = {owner['ownership_id']:db.execute(
93 "SELECT MIN(id) FROM messages WHERE session_id=? AND role='user' AND id>?",
94 (owner['session_id'], owner['metadata']['anchor_id'])).fetchone()[0]
95 for owner in owners if owner['metadata']['kind'] == 'supplied' and owner['session_id'] in lineage}
96 actual_rows = []
97 ids = list(observed)
98 for start in range(0, len(ids), 512):
99 batch = ids[start:start+512]
100 actual_rows.extend(db.execute('SELECT * FROM messages WHERE id IN ('+
101 ','.join('?' for _ in batch)+')', batch))
102 for actual in actual_rows:
103 if actual['session_id'] not in lineage:
104 continu …
128:2… if sources:
129 receipts.append({'content':content, 'sources':list(sources.values())})
130 if len(receipts) > 512:
131 raise ValueError …
No evidence locations were recorded for this file. Raw result