n8n-nodes-engram 0.7.1 → 0.7.2
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/README.md +36 -1
- package/dist/embeddings/EmbeddingService.js +6 -1
- package/dist/embeddings/EmbeddingService.js.map +1 -1
- package/dist/extraction/AutomaticClaims.d.ts +10 -0
- package/dist/extraction/AutomaticClaims.js +401 -0
- package/dist/extraction/AutomaticClaims.js.map +1 -0
- package/dist/extraction/AutomaticEvidence.d.ts +10 -0
- package/dist/extraction/AutomaticEvidence.js +514 -0
- package/dist/extraction/AutomaticEvidence.js.map +1 -0
- package/dist/extraction/BoundedExtraction.js +2 -1
- package/dist/extraction/BoundedExtraction.js.map +1 -1
- package/dist/extraction/DurableExtraction.d.ts +2 -0
- package/dist/extraction/DurableExtraction.js +43 -5
- package/dist/extraction/DurableExtraction.js.map +1 -1
- package/dist/extraction/ExtractionDiagnostics.d.ts +6 -0
- package/dist/extraction/ExtractionDiagnostics.js +13 -1
- package/dist/extraction/ExtractionDiagnostics.js.map +1 -1
- package/dist/extraction/LlmClient.js +6 -1
- package/dist/extraction/LlmClient.js.map +1 -1
- package/dist/extraction/QueueState.d.ts +71 -15
- package/dist/extraction/QueueState.js +7 -0
- package/dist/extraction/QueueState.js.map +1 -1
- package/dist/extraction/RequestBudget.js +8 -6
- package/dist/extraction/RequestBudget.js.map +1 -1
- package/dist/extraction/StagedGraph.js +3 -1
- package/dist/extraction/StagedGraph.js.map +1 -1
- package/dist/memory/AutomaticCapture.d.ts +175 -0
- package/dist/memory/AutomaticCapture.js +39 -0
- package/dist/memory/AutomaticCapture.js.map +1 -0
- package/dist/memory/EngramChatMemory.d.ts +3 -0
- package/dist/memory/EngramChatMemory.js +205 -13
- package/dist/memory/EngramChatMemory.js.map +1 -1
- package/dist/memory/EngramChatMessageHistory.d.ts +2 -0
- package/dist/memory/EngramChatMessageHistory.js +12 -1
- package/dist/memory/EngramChatMessageHistory.js.map +1 -1
- package/dist/nodes/EngramAdmin/EngramAdmin.node.js +68 -26
- package/dist/nodes/EngramAdmin/EngramAdmin.node.js.map +1 -1
- package/dist/nodes/EngramMemory/EngramMemory.node.js +56 -43
- package/dist/nodes/EngramMemory/EngramMemory.node.js.map +1 -1
- package/dist/schemas/AutomaticClaim.schema.d.ts +517 -0
- package/dist/schemas/AutomaticClaim.schema.js +92 -0
- package/dist/schemas/AutomaticClaim.schema.js.map +1 -0
- package/dist/schemas/AutomaticMemory.schema.d.ts +803 -0
- package/dist/schemas/AutomaticMemory.schema.js +230 -0
- package/dist/schemas/AutomaticMemory.schema.js.map +1 -0
- package/dist/schemas/AutomaticOperations.schema.d.ts +221 -0
- package/dist/schemas/AutomaticOperations.schema.js +86 -0
- package/dist/schemas/AutomaticOperations.schema.js.map +1 -0
- package/dist/schemas/AutomaticRuntime.schema.d.ts +169 -0
- package/dist/schemas/AutomaticRuntime.schema.js +26 -0
- package/dist/schemas/AutomaticRuntime.schema.js.map +1 -0
- package/dist/schemas/ExtractionBudget.schema.d.ts +13 -0
- package/dist/schemas/ExtractionBudget.schema.js +24 -0
- package/dist/schemas/ExtractionBudget.schema.js.map +1 -0
- package/dist/schemas/ExtractionMetadata.schema.d.ts +10 -10
- package/dist/schemas/ExtractionMetadata.schema.js +1 -1
- package/dist/schemas/ExtractionMetadata.schema.js.map +1 -1
- package/dist/schemas/ExtractionOutcome.schema.d.ts +222 -10
- package/dist/schemas/ExtractionOutcome.schema.js +4 -0
- package/dist/schemas/ExtractionOutcome.schema.js.map +1 -1
- package/dist/schemas/ExtractionPolicy.schema.d.ts +22 -22
- package/dist/schemas/ExtractionQueue.schema.d.ts +3132 -272
- package/dist/schemas/GraphData.schema.d.ts +8 -8
- package/dist/schemas/MemoryPolicy.schema.d.ts +804 -56
- package/dist/schemas/index.d.ts +5 -0
- package/dist/schemas/index.js +5 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/search/AutomaticRetrieval.d.ts +5 -0
- package/dist/search/AutomaticRetrieval.js +79 -0
- package/dist/search/AutomaticRetrieval.js.map +1 -0
- package/dist/search/GovernedContext.js +16 -2
- package/dist/search/GovernedContext.js.map +1 -1
- package/dist/search/HybridSearchEngine.d.ts +3 -1
- package/dist/search/HybridSearchEngine.js +4 -4
- package/dist/search/HybridSearchEngine.js.map +1 -1
- package/dist/search/RetrievalGovernance.d.ts +3 -2
- package/dist/search/RetrievalGovernance.js +32 -8
- package/dist/search/RetrievalGovernance.js.map +1 -1
- package/dist/storage/AutomaticIdentity.d.ts +30 -0
- package/dist/storage/AutomaticIdentity.js +683 -0
- package/dist/storage/AutomaticIdentity.js.map +1 -0
- package/dist/storage/GraphologyStorage.d.ts +10 -1
- package/dist/storage/GraphologyStorage.js +98 -25
- package/dist/storage/GraphologyStorage.js.map +1 -1
- package/dist/storage/IGraphStorage.d.ts +9 -1
- package/dist/storage/Neo4jStorage.d.ts +10 -1
- package/dist/storage/Neo4jStorage.js +143 -61
- package/dist/storage/Neo4jStorage.js.map +1 -1
- package/dist/utils/advancedExtraction.js +7 -7
- package/dist/utils/advancedExtraction.js.map +1 -1
- package/dist/utils/automaticAdmin.d.ts +4 -0
- package/dist/utils/automaticAdmin.js +235 -0
- package/dist/utils/automaticAdmin.js.map +1 -0
- package/dist/utils/automaticMemory.d.ts +35 -0
- package/dist/utils/automaticMemory.js +160 -0
- package/dist/utils/automaticMemory.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
<p align="center">
|
|
27
27
|
<a href="#installation">Installation</a> ·
|
|
28
|
-
<a href="#upgrading-to-
|
|
28
|
+
<a href="#upgrading-to-v072">Upgrade</a> ·
|
|
29
29
|
<a href="#node-reference">Nodes</a> ·
|
|
30
30
|
<a href="#storage-backends">Storage</a> ·
|
|
31
31
|
<a href="#knowledge-extraction">Extraction</a> ·
|
|
@@ -101,6 +101,41 @@ npm install n8n-nodes-engram
|
|
|
101
101
|
|
|
102
102
|
---
|
|
103
103
|
|
|
104
|
+
## Upgrading to v0.7.2
|
|
105
|
+
|
|
106
|
+
Existing saved workflows retain their defaults and node versions. Installing this release does not enable automatic acceptance, change namespaces, rewrite historical memory or start a queue worker. New **Memory v3** and **Admin v3** nodes default to **Memory Behaviour > Existing / Custom**.
|
|
107
|
+
|
|
108
|
+
### Back Up and Activate
|
|
109
|
+
|
|
110
|
+
1. Take fresh, consistent workflow and backend backups before installing `n8n-nodes-engram@0.7.2`. Preserve exact namespaces, verified alias mappings, storage paths and producer workflow IDs. Restart n8n, refresh the editor and confirm the package version.
|
|
111
|
+
2. Start with an inactive copy of one direct-conversation workflow and a separate restored store. Upgrade only the selected Memory/Admin nodes to **v3**. Preserve the current extraction route, model and provider-default temperature setting.
|
|
112
|
+
3. In **Admin > Automatic Memory > Create Verified Actor Binding**, select the exact memory namespace and producer workflow ID. Bind a trusted application's stable issuer/actor reference to an **existing, explicitly accepted subject UUID**. Supply the operator and review reason. A name, phone number, session key or model confidence alone does not create this binding. Reassignment and revocation require the current binding revision.
|
|
113
|
+
4. Select a profile deliberately. **Conservative Automatic** accepts supported source-grounded preferences; **Explicit Requests Only** additionally requires trusted save intent or an unquoted leading `Remember this:`; **Review First** proposes supported preferences. Use **Preview Memory Policy** to inspect the versioned effective policy, configured limits and identity readiness. Worker readiness is a separate check.
|
|
114
|
+
5. On Memory v3, retain **Bounded** resolution, enable knowledge extraction and **Final Turns**, persist human episodes, and disable extraction from AI/system/tool content. Map the verified actor issuer/reference and a stable **Current Turn ID** from trusted application input. Keep tool audits separate. Extraction credentials/model remain required configuration, although this first profile implementation uses deterministic preference parsing rather than model requests.
|
|
115
|
+
6. Supply the complete **Raw Current Human Content**. If agent input adds a display label, explicitly attest **Application-Owned Display Wrapper** and provide exact UTF-16 human-region offsets. This attestation is only for application display metadata; never use it to hide quotes, reports, conditions or other human context. No arbitrary label stripping occurs.
|
|
116
|
+
|
|
117
|
+
### Supported Automatic Memory
|
|
118
|
+
|
|
119
|
+
Profile version 1 supports complete literal first-person preferences such as `I prefer concise explanations.`, `I like bullet points.`, `I do not like long explanations.` when the value belongs to the supported language, explanation, presentation or format vocabulary. Supported negative preferences retain their polarity. Ambiguous, quoted, hypothetical, sensitive and unsupported statements remain in the episode history without being promoted to accepted facts. Complex preferences, nickname identity merging and dated commitments are outside this profile version. No **Personal Assistant** profile is offered yet.
|
|
120
|
+
|
|
121
|
+
Exact repeated claims reuse the logical fact; a conflicting supported claim requires review. Rejected/manual decisions remain protected. Claim receipts distinguish accepted, proposed, rejected, deferred, unchanged and not-selected results, with persistence and mutation state. Source-episode acceptance is separate from fact acceptance. New budget diagnostics use a separate versioned `budget` field; the existing error categories remain unchanged.
|
|
122
|
+
|
|
123
|
+
Current personalization suppresses revoked bindings, unsupported evidence and unresolved opposite claims. Historical modes may return intact source-grounded preference records with an explicit historical qualification: their recorded review state does not establish current identity or validity. As-of retrieval excludes new claims recorded after the requested date. Literal value nodes are never presented independently as personal facts.
|
|
124
|
+
|
|
125
|
+
For an acknowledgement based on actual saving, put **Admin > Automatic Memory > Capture Human Memory** before the agent. Pass its **sourceId** into Memory v3's **Captured Human Source ID**, using the same backend, exact namespace, actor, turn ID, policy and formatted input. The current source is excluded from history, and the subsequent writer saves the final assistant/audits without saving or extracting the human turn again. Only `facts_accepted` confirms accepted graph knowledge; `review_required`, `not_saved`, `queued` and `unconfirmed` do not. A synchronous retry with a saved source but no recoverable receipt remains unconfirmed. An ordinary agent response generated before memory saving must not promise durable acceptance.
|
|
126
|
+
|
|
127
|
+
Budget/execution settings are separate from acceptance. The deadline is one extraction work budget, not memory expiry or the whole workflow timeout. Increasing it does not broaden accepted evidence. Durable mode still requires an explicitly deployed matching **Admin v3** worker, route and profile; queued work is not already indexed. Extraction retries never resend an external chat message.
|
|
128
|
+
|
|
129
|
+
### Verify and Roll Back
|
|
130
|
+
|
|
131
|
+
Before expanding rollout, verify normal and tool-assisted writes, a supported preference without a save command, a negative/uncertain preference, duplicate turns, and a temporary question. Check accepted graph records and provenance, then verify graph-only recall on the separate restored store with recent conversation excluded. Test historical recall separately. Review active and passive group writers independently.
|
|
132
|
+
|
|
133
|
+
**Recovery boundary:** once new profiles write bindings, envelopes, claims or role ownership, use consistent backend-native snapshots for recovery: the complete embedded graph file, or a Neo4j database backup. Preserve the original logical store mapping. Generic graph import and queue-aware JSON import deliberately reject restoration of new privileged bindings/ownership into a fresh store; a JSON export alone is not a supported recovery backup for these profiles. Retain queue-aware exports as additional inspection evidence when jobs exist.
|
|
134
|
+
|
|
135
|
+
For rollback, keep this binary and restore **Existing / Custom** writer settings while its readers continue validating new claims. Old-package downgrade and mixed-version writers/workers are unsupported for new-profile stores. Keep newly appended conversations; never overwrite them with an older snapshot. No reset, purge, bulk re-extraction or automatic legacy repair is part of this upgrade.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
104
139
|
## Upgrading to v0.7.1
|
|
105
140
|
|
|
106
141
|
This patch fixes JSON-mode requests in bounded identity matching. It explicitly requests a valid JSON object and checks the trusted instruction before sending bounded extraction requests. Existing legacy extraction behavior and saved workflow defaults remain unchanged. No model, temperature or governance change is needed.
|
|
@@ -39,7 +39,12 @@ class EmbeddingService {
|
|
|
39
39
|
const controller = new AbortController();
|
|
40
40
|
const abort = () => controller.abort();
|
|
41
41
|
(_c = this.budget) === null || _c === void 0 ? void 0 : _c.controller.signal.addEventListener('abort', abort, { once: true });
|
|
42
|
-
const timeout = setTimeout(
|
|
42
|
+
const timeout = setTimeout(() => {
|
|
43
|
+
var _a;
|
|
44
|
+
if (remaining !== undefined && remaining <= this.timeoutMs)
|
|
45
|
+
(_a = this.budget) === null || _a === void 0 ? void 0 : _a.controller.abort();
|
|
46
|
+
abort();
|
|
47
|
+
}, Math.min(remaining !== null && remaining !== void 0 ? remaining : this.timeoutMs, this.timeoutMs));
|
|
43
48
|
const metric = (_d = this.diagnostics) === null || _d === void 0 ? void 0 : _d.beginRequest('embeddings');
|
|
44
49
|
try {
|
|
45
50
|
let response;
|
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AE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gBAChE,IAAI,IAAI,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,OAAO;oBAAE,MAAM,IAAI,uCAAe,CAAC,SAAS,CAAC,CAAC;gBACnF,MAAM,KAAK,CAAC;YACd,CAAC;oBAAS,CAAC;gBACT,IAAI,MAAM;oBACR,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;gBACnF,YAAY,CAAC,OAAO,CAAC,CAAC;gBACtB,MAAA,IAAI,CAAC,MAAM,0CAAE,UAAU,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAG,MAAM,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;CACF;AArJD,4CAqJC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type GraphData, type StagedExtraction, type ExtractionOutcome, type EntityEdge } from '../schemas';
|
|
2
|
+
import { type AutomaticPolicy } from '../schemas/AutomaticMemory.schema';
|
|
3
|
+
export declare const AUTOMATIC_ENVELOPE = "engram_source_envelope_v1";
|
|
4
|
+
export declare const AUTOMATIC_CLAIM = "engram_claim_v1";
|
|
5
|
+
export declare const AUTOMATIC_OWNER = "engram_write_owner_v1";
|
|
6
|
+
export declare function validateStoredAutomaticClaim(graph: GraphData, edge: EntityEdge, check?: () => void, historicalEvidence?: boolean): boolean;
|
|
7
|
+
export declare function planAutomaticClaims(graph: GraphData, group: string, sourceIds: string[], policy: AutomaticPolicy, baseOutcome: ExtractionOutcome, timestamp?: string, workCheck?: () => void): StagedExtraction;
|
|
8
|
+
export declare function validateAutomaticPlan(graph: GraphData, plan: StagedExtraction): boolean;
|
|
9
|
+
export declare function committedAutomaticReceipt(outcome: ExtractionOutcome, timestamp: string): void;
|
|
10
|
+
export declare function failedAutomaticReceipt(outcome: ExtractionOutcome): void;
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AUTOMATIC_OWNER = exports.AUTOMATIC_CLAIM = exports.AUTOMATIC_ENVELOPE = void 0;
|
|
4
|
+
exports.validateStoredAutomaticClaim = validateStoredAutomaticClaim;
|
|
5
|
+
exports.planAutomaticClaims = planAutomaticClaims;
|
|
6
|
+
exports.validateAutomaticPlan = validateAutomaticPlan;
|
|
7
|
+
exports.committedAutomaticReceipt = committedAutomaticReceipt;
|
|
8
|
+
exports.failedAutomaticReceipt = failedAutomaticReceipt;
|
|
9
|
+
const crypto_1 = require("crypto");
|
|
10
|
+
const perf_hooks_1 = require("perf_hooks");
|
|
11
|
+
const ExtractionDiagnostics_1 = require("./ExtractionDiagnostics");
|
|
12
|
+
const uuid_1 = require("uuid");
|
|
13
|
+
const schemas_1 = require("../schemas");
|
|
14
|
+
const AutomaticMemory_schema_1 = require("../schemas/AutomaticMemory.schema");
|
|
15
|
+
const AutomaticClaim_schema_1 = require("../schemas/AutomaticClaim.schema");
|
|
16
|
+
const AutomaticEvidence_1 = require("./AutomaticEvidence");
|
|
17
|
+
const AutomaticIdentity_1 = require("../storage/AutomaticIdentity");
|
|
18
|
+
const QueueState_1 = require("./QueueState");
|
|
19
|
+
exports.AUTOMATIC_ENVELOPE = 'engram_source_envelope_v1';
|
|
20
|
+
exports.AUTOMATIC_CLAIM = 'engram_claim_v1';
|
|
21
|
+
exports.AUTOMATIC_OWNER = 'engram_write_owner_v1';
|
|
22
|
+
const hashText = (text) => (0, crypto_1.createHash)('sha256').update(text, 'utf8').digest('hex');
|
|
23
|
+
const stableId = (key) => (0, uuid_1.v5)((0, QueueState_1.canonical)(key), uuid_1.v5.URL);
|
|
24
|
+
function validateStoredAutomaticClaim(graph, edge, check = () => { }, historicalEvidence = false) {
|
|
25
|
+
var _a;
|
|
26
|
+
try {
|
|
27
|
+
check();
|
|
28
|
+
const meta = AutomaticClaim_schema_1.AutomaticClaimMetadataSchema.parse(edge.attributes[exports.AUTOMATIC_CLAIM]);
|
|
29
|
+
const source = graph.episodes.find((ep) => ep.uuid === meta.sourceId && ep.group_id === edge.group_id);
|
|
30
|
+
if (!source ||
|
|
31
|
+
source.role !== 'human' ||
|
|
32
|
+
!['active_human', 'passive_human'].includes(source.episode_kind) ||
|
|
33
|
+
source.review_status !== 'accepted' ||
|
|
34
|
+
!['standard', 'trusted'].includes(source.trust_level) ||
|
|
35
|
+
source.quoted_message_id)
|
|
36
|
+
return false;
|
|
37
|
+
(0, AutomaticIdentity_1.prepareAutomaticEpisodeInput)(source);
|
|
38
|
+
const envelope = AutomaticMemory_schema_1.AutomaticSourceEnvelopeSchema.parse(source.attributes[exports.AUTOMATIC_ENVELOPE]);
|
|
39
|
+
if (envelope.namespace !== edge.group_id ||
|
|
40
|
+
hashText(source.content) !== envelope.rawContentHash ||
|
|
41
|
+
(0, QueueState_1.canonical)(meta.binding) !== (0, QueueState_1.canonical)(envelope.bindingRef) ||
|
|
42
|
+
meta.issuer !== envelope.issuer ||
|
|
43
|
+
meta.actorReference !== envelope.actorReference ||
|
|
44
|
+
(0, QueueState_1.canonical)(meta.policy) !== (0, QueueState_1.canonical)(envelope.policy))
|
|
45
|
+
return false;
|
|
46
|
+
if (!historicalEvidence)
|
|
47
|
+
(0, AutomaticIdentity_1.assertAutomaticBinding)(graph, envelope, check);
|
|
48
|
+
const parsed = (0, AutomaticEvidence_1.parseAutomaticPreferences)(envelope, source.content.slice(envelope.humanRegion.start, envelope.humanRegion.end));
|
|
49
|
+
if (!parsed.claims.some((claim) => (0, QueueState_1.canonical)(claim) === (0, QueueState_1.canonical)(meta.claim)))
|
|
50
|
+
return false;
|
|
51
|
+
const valueKey = [
|
|
52
|
+
'literal-preference-v1',
|
|
53
|
+
edge.group_id,
|
|
54
|
+
'preference_value',
|
|
55
|
+
meta.claim.languageTag,
|
|
56
|
+
meta.claim.literal,
|
|
57
|
+
];
|
|
58
|
+
const key = (0, QueueState_1.fingerprint)([...valueKey, envelope.bindingRef.subjectId, meta.claim.polarity]);
|
|
59
|
+
const target = graph.entities.find((entity) => entity.uuid === edge.target_node_uuid && entity.group_id === edge.group_id);
|
|
60
|
+
return (meta.key === key &&
|
|
61
|
+
meta.subjectId === envelope.bindingRef.subjectId &&
|
|
62
|
+
edge.uuid === stableId(['attributed-preference-v1', key]) &&
|
|
63
|
+
edge.source_node_uuid === meta.subjectId &&
|
|
64
|
+
edge.target_node_uuid === stableId(valueKey) &&
|
|
65
|
+
(target === null || target === void 0 ? void 0 : target.name) === meta.claim.literal &&
|
|
66
|
+
target.entity_type === 'preference_value' &&
|
|
67
|
+
edge.name === 'PREFERS' &&
|
|
68
|
+
edge.fact === meta.claim.clause &&
|
|
69
|
+
edge.episodes.includes(source.uuid) &&
|
|
70
|
+
((_a = (0, schemas_1.extractionMetadataFromAttributes)(edge.attributes)) === null || _a === void 0 ? void 0 : _a.episode_uuids.includes(source.uuid)) ===
|
|
71
|
+
true);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (error instanceof ExtractionDiagnostics_1.ExtractionBudgetError)
|
|
75
|
+
throw error;
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function planAutomaticClaims(graph, group, sourceIds, policy, baseOutcome, timestamp = new Date().toISOString(), workCheck) {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
const expires = perf_hooks_1.performance.now() + 30000;
|
|
82
|
+
const check = workCheck !== null && workCheck !== void 0 ? workCheck : (() => {
|
|
83
|
+
if (perf_hooks_1.performance.now() >= expires)
|
|
84
|
+
throw new ExtractionDiagnostics_1.ExtractionBudgetError('deadline');
|
|
85
|
+
});
|
|
86
|
+
check();
|
|
87
|
+
if (graph.entities.length + graph.edges.length + graph.episodes.length > 100000)
|
|
88
|
+
throw new ExtractionDiagnostics_1.ExtractionBudgetError('snapshot_limit');
|
|
89
|
+
let snapshotBytes = 0;
|
|
90
|
+
for (const item of [...graph.entities, ...graph.edges, ...graph.episodes]) {
|
|
91
|
+
check();
|
|
92
|
+
snapshotBytes += Buffer.byteLength(JSON.stringify(item));
|
|
93
|
+
if (snapshotBytes > 100 * 1024 * 1024)
|
|
94
|
+
throw new ExtractionDiagnostics_1.ExtractionBudgetError('snapshot_limit');
|
|
95
|
+
}
|
|
96
|
+
const compiled = (0, AutomaticEvidence_1.compileAutomaticPolicy)({ profileId: policy.profileId });
|
|
97
|
+
if (policy.profileId === 'existing' || (0, QueueState_1.canonical)(compiled) !== (0, QueueState_1.canonical)(policy))
|
|
98
|
+
throw new Error('Engram automatic: unsupported_policy');
|
|
99
|
+
if (!sourceIds.length || sourceIds.length > 32 || new Set(sourceIds).size !== sourceIds.length)
|
|
100
|
+
throw new Error('Engram automatic: source_limit');
|
|
101
|
+
const entities = [], edges = [];
|
|
102
|
+
const outcome = JSON.parse(JSON.stringify(baseOutcome));
|
|
103
|
+
const receipt = {
|
|
104
|
+
version: 1,
|
|
105
|
+
policy,
|
|
106
|
+
sourceIds,
|
|
107
|
+
persisted: false,
|
|
108
|
+
commitAt: null,
|
|
109
|
+
items: [],
|
|
110
|
+
coverageComplete: true,
|
|
111
|
+
};
|
|
112
|
+
let hydrated = 0;
|
|
113
|
+
let conflictScans = 0;
|
|
114
|
+
let sourceBytes = 0;
|
|
115
|
+
let extensionBytes = 0;
|
|
116
|
+
for (const sourceId of sourceIds) {
|
|
117
|
+
check();
|
|
118
|
+
const source = graph.episodes.find((ep) => ep.uuid === sourceId && ep.group_id === group);
|
|
119
|
+
if (!source ||
|
|
120
|
+
source.role !== 'human' ||
|
|
121
|
+
!['active_human', 'passive_human'].includes(source.episode_kind) ||
|
|
122
|
+
!['standard', 'trusted'].includes(source.trust_level) ||
|
|
123
|
+
source.review_status !== 'accepted' ||
|
|
124
|
+
source.quoted_message_id)
|
|
125
|
+
throw new Error('Engram automatic: invalid_source');
|
|
126
|
+
(0, AutomaticIdentity_1.prepareAutomaticEpisodeInput)(source);
|
|
127
|
+
sourceBytes += Buffer.byteLength(source.content);
|
|
128
|
+
if (sourceBytes > 65536)
|
|
129
|
+
throw new ExtractionDiagnostics_1.ExtractionBudgetError('source_bytes');
|
|
130
|
+
extensionBytes += Buffer.byteLength(JSON.stringify({
|
|
131
|
+
envelope: source.attributes[exports.AUTOMATIC_ENVELOPE],
|
|
132
|
+
owner: source.attributes[exports.AUTOMATIC_OWNER],
|
|
133
|
+
}));
|
|
134
|
+
const envelope = AutomaticMemory_schema_1.AutomaticSourceEnvelopeSchema.parse(source.attributes[exports.AUTOMATIC_ENVELOPE]);
|
|
135
|
+
if (envelope.namespace !== group ||
|
|
136
|
+
(0, QueueState_1.canonical)(envelope.policy) !== (0, QueueState_1.canonical)(policy) ||
|
|
137
|
+
hashText(source.content) !== envelope.rawContentHash ||
|
|
138
|
+
Buffer.byteLength(source.content) > 65536)
|
|
139
|
+
throw new Error('Engram automatic: source_changed');
|
|
140
|
+
(0, AutomaticIdentity_1.assertAutomaticBinding)(graph, envelope, check);
|
|
141
|
+
const content = source.content.slice(envelope.humanRegion.start, envelope.humanRegion.end);
|
|
142
|
+
const parsed = (0, AutomaticEvidence_1.parseAutomaticPreferences)(envelope, content);
|
|
143
|
+
if (!parsed.claims.length) {
|
|
144
|
+
receipt.items.push({
|
|
145
|
+
state: 'not_selected',
|
|
146
|
+
persisted: false,
|
|
147
|
+
mutation: 'none',
|
|
148
|
+
reasons: parsed.reasons.length ? parsed.reasons : ['not_selected'],
|
|
149
|
+
});
|
|
150
|
+
outcome.counts.filtered++;
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
for (const claim of parsed.claims) {
|
|
154
|
+
check();
|
|
155
|
+
if (receipt.items.length >= 32)
|
|
156
|
+
throw new Error('Engram automatic: claim_limit');
|
|
157
|
+
const valueKey = [
|
|
158
|
+
'literal-preference-v1',
|
|
159
|
+
group,
|
|
160
|
+
'preference_value',
|
|
161
|
+
claim.languageTag,
|
|
162
|
+
claim.literal,
|
|
163
|
+
];
|
|
164
|
+
const targetId = stableId(valueKey);
|
|
165
|
+
const key = (0, QueueState_1.fingerprint)([...valueKey, envelope.bindingRef.subjectId, claim.polarity]);
|
|
166
|
+
const edgeId = stableId(['attributed-preference-v1', key]);
|
|
167
|
+
const prior = [...graph.edges, ...edges].find((edge) => edge.uuid === edgeId);
|
|
168
|
+
if (prior) {
|
|
169
|
+
const priorClaim = AutomaticClaim_schema_1.AutomaticClaimMetadataSchema.safeParse(prior.attributes[exports.AUTOMATIC_CLAIM]);
|
|
170
|
+
if (!priorClaim.success ||
|
|
171
|
+
priorClaim.data.key !== key ||
|
|
172
|
+
prior.group_id !== group ||
|
|
173
|
+
!validateStoredAutomaticClaim({
|
|
174
|
+
...graph,
|
|
175
|
+
entities: [...graph.entities, ...entities],
|
|
176
|
+
edges: [...graph.edges, ...edges],
|
|
177
|
+
}, prior, check))
|
|
178
|
+
throw new Error('Engram automatic: identity_collision');
|
|
179
|
+
const review = (_a = (0, schemas_1.extractionMetadataFromAttributes)(prior.attributes)) === null || _a === void 0 ? void 0 : _a.review_status;
|
|
180
|
+
if (!review)
|
|
181
|
+
throw new Error('Engram automatic: missing_claim_review');
|
|
182
|
+
receipt.items.push({
|
|
183
|
+
claimId: prior.uuid,
|
|
184
|
+
state: review === 'rejected' ? 'rejected' : review === 'proposed' ? 'proposed' : 'unchanged',
|
|
185
|
+
persisted: true,
|
|
186
|
+
mutation: 'none',
|
|
187
|
+
reasons: ['existing_claim'],
|
|
188
|
+
});
|
|
189
|
+
outcome.counts.unchanged++;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
const candidates = [...graph.edges, ...edges].filter((edge) => {
|
|
193
|
+
check();
|
|
194
|
+
if (edge.group_id !== group ||
|
|
195
|
+
edge.source_node_uuid !== envelope.bindingRef.subjectId ||
|
|
196
|
+
edge.target_node_uuid !== targetId ||
|
|
197
|
+
edge.attributes[exports.AUTOMATIC_CLAIM] === undefined)
|
|
198
|
+
return false;
|
|
199
|
+
if (++conflictScans > 128)
|
|
200
|
+
throw new ExtractionDiagnostics_1.ExtractionBudgetError('conflict_limit');
|
|
201
|
+
return true;
|
|
202
|
+
});
|
|
203
|
+
const references = candidates.reduce((total, edge) => {
|
|
204
|
+
var _a, _b;
|
|
205
|
+
return total +
|
|
206
|
+
new Set([
|
|
207
|
+
...edge.episodes,
|
|
208
|
+
...((_b = (_a = (0, schemas_1.extractionMetadataFromAttributes)(edge.attributes)) === null || _a === void 0 ? void 0 : _a.episode_uuids) !== null && _b !== void 0 ? _b : []),
|
|
209
|
+
]).size;
|
|
210
|
+
}, 0);
|
|
211
|
+
hydrated += references;
|
|
212
|
+
if (references > 8 || hydrated > 512)
|
|
213
|
+
throw new ExtractionDiagnostics_1.ExtractionBudgetError('conflict_limit');
|
|
214
|
+
const conflict = candidates.some((edge) => {
|
|
215
|
+
var _a;
|
|
216
|
+
const other = AutomaticClaim_schema_1.AutomaticClaimMetadataSchema.safeParse(edge.attributes[exports.AUTOMATIC_CLAIM]);
|
|
217
|
+
return (other.success &&
|
|
218
|
+
validateStoredAutomaticClaim({ ...graph, entities: [...graph.entities, ...entities] }, edge, check) &&
|
|
219
|
+
other.data.claim.polarity !== claim.polarity &&
|
|
220
|
+
((_a = (0, schemas_1.extractionMetadataFromAttributes)(edge.attributes)) === null || _a === void 0 ? void 0 : _a.review_status) !== 'rejected');
|
|
221
|
+
});
|
|
222
|
+
const existingTarget = graph.entities.find((entity) => entity.uuid === targetId);
|
|
223
|
+
const targetReview = existingTarget
|
|
224
|
+
? (_b = (0, schemas_1.extractionMetadataFromAttributes)(existingTarget.attributes)) === null || _b === void 0 ? void 0 : _b.review_status
|
|
225
|
+
: undefined;
|
|
226
|
+
const accepted = policy.autoAccept && !conflict && (!existingTarget || targetReview === 'accepted');
|
|
227
|
+
const metadata = {
|
|
228
|
+
version: 2,
|
|
229
|
+
source: 'policy',
|
|
230
|
+
confidence: null,
|
|
231
|
+
review_status: accepted ? 'accepted' : 'proposed',
|
|
232
|
+
threshold_decision: accepted ? 'auto_accepted' : 'pending_review',
|
|
233
|
+
extracted_at: timestamp,
|
|
234
|
+
episode_uuids: [sourceId],
|
|
235
|
+
reviewed_at: null,
|
|
236
|
+
reviewed_by: null,
|
|
237
|
+
};
|
|
238
|
+
const quality = {
|
|
239
|
+
version: 1,
|
|
240
|
+
category: 'preference',
|
|
241
|
+
policy: 'durableTemporal',
|
|
242
|
+
evidence: [
|
|
243
|
+
{ source_id: sourceId, start: claim.rawClauseSpan.start, end: claim.rawClauseSpan.end },
|
|
244
|
+
],
|
|
245
|
+
temporal: { status: 'none', source_times: [source.reference_time], timezone: null },
|
|
246
|
+
};
|
|
247
|
+
const claimMetadata = AutomaticClaim_schema_1.AutomaticClaimMetadataSchema.parse({
|
|
248
|
+
version: 1,
|
|
249
|
+
generation: 'literal-parser-v1',
|
|
250
|
+
subjectId: envelope.bindingRef.subjectId,
|
|
251
|
+
binding: envelope.bindingRef,
|
|
252
|
+
issuer: envelope.issuer,
|
|
253
|
+
actorReference: envelope.actorReference,
|
|
254
|
+
policy,
|
|
255
|
+
claim,
|
|
256
|
+
sourceId,
|
|
257
|
+
key,
|
|
258
|
+
});
|
|
259
|
+
const target = [...graph.entities, ...entities].find((entity) => entity.uuid === targetId);
|
|
260
|
+
if (target &&
|
|
261
|
+
(target.group_id !== group ||
|
|
262
|
+
target.entity_type !== 'preference_value' ||
|
|
263
|
+
target.name !== claim.literal))
|
|
264
|
+
throw new Error('Engram automatic: identity_collision');
|
|
265
|
+
if (!target) {
|
|
266
|
+
entities.push(schemas_1.EntityNodeSchema.parse({
|
|
267
|
+
uuid: targetId,
|
|
268
|
+
group_id: group,
|
|
269
|
+
name: claim.literal,
|
|
270
|
+
entity_type: 'preference_value',
|
|
271
|
+
summary: '',
|
|
272
|
+
created_at: timestamp,
|
|
273
|
+
updated_at: timestamp,
|
|
274
|
+
attributes: {
|
|
275
|
+
engram_extraction: metadata,
|
|
276
|
+
engram_memory_quality: quality,
|
|
277
|
+
engram_literal_v1: {
|
|
278
|
+
version: 1,
|
|
279
|
+
languageTag: claim.languageTag,
|
|
280
|
+
literal: claim.literal,
|
|
281
|
+
key: (0, QueueState_1.fingerprint)(valueKey),
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
}));
|
|
285
|
+
outcome.counts.entities_created++;
|
|
286
|
+
}
|
|
287
|
+
edges.push(schemas_1.EntityEdgeSchema.parse({
|
|
288
|
+
uuid: edgeId,
|
|
289
|
+
group_id: group,
|
|
290
|
+
source_node_uuid: envelope.bindingRef.subjectId,
|
|
291
|
+
target_node_uuid: targetId,
|
|
292
|
+
name: 'PREFERS',
|
|
293
|
+
fact: claim.clause,
|
|
294
|
+
episodes: [sourceId],
|
|
295
|
+
created_at: timestamp,
|
|
296
|
+
updated_at: timestamp,
|
|
297
|
+
attributes: {
|
|
298
|
+
engram_extraction: metadata,
|
|
299
|
+
engram_memory_quality: quality,
|
|
300
|
+
[exports.AUTOMATIC_CLAIM]: claimMetadata,
|
|
301
|
+
},
|
|
302
|
+
}));
|
|
303
|
+
outcome.counts.edges_created++;
|
|
304
|
+
receipt.items.push({
|
|
305
|
+
claimId: edgeId,
|
|
306
|
+
state: accepted ? 'accepted' : 'proposed',
|
|
307
|
+
persisted: false,
|
|
308
|
+
mutation: 'pending',
|
|
309
|
+
reasons: [conflict ? 'conflicting_claim' : accepted ? 'selected' : 'review_required'],
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
outcome.automatic = AutomaticClaim_schema_1.AutomaticReceiptSchema.parse(receipt);
|
|
314
|
+
extensionBytes += Buffer.byteLength(JSON.stringify(receipt));
|
|
315
|
+
for (const item of [...entities, ...edges])
|
|
316
|
+
extensionBytes += Buffer.byteLength(JSON.stringify({
|
|
317
|
+
claim: item.attributes[exports.AUTOMATIC_CLAIM],
|
|
318
|
+
literal: item.attributes.engram_literal_v1,
|
|
319
|
+
}));
|
|
320
|
+
if (extensionBytes > 32 * 1024)
|
|
321
|
+
throw new ExtractionDiagnostics_1.ExtractionBudgetError('metadata_bytes');
|
|
322
|
+
check();
|
|
323
|
+
return {
|
|
324
|
+
version: 1,
|
|
325
|
+
group_id: group,
|
|
326
|
+
graph_hash: (0, QueueState_1.graphFingerprint)(graph, group),
|
|
327
|
+
source_guards: sourceIds.map((id) => ({
|
|
328
|
+
uuid: id,
|
|
329
|
+
hash: (0, QueueState_1.sourceFingerprint)(graph.episodes.find((ep) => ep.uuid === id)),
|
|
330
|
+
})),
|
|
331
|
+
entities,
|
|
332
|
+
edges,
|
|
333
|
+
outcome,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
function validateAutomaticPlan(graph, plan) {
|
|
337
|
+
var _a, _b, _c, _d, _e;
|
|
338
|
+
const sources = plan.source_guards.map((guard) => graph.episodes.find((ep) => ep.uuid === guard.uuid && ep.group_id === plan.group_id));
|
|
339
|
+
const hasEnvelope = sources.some((source) => (source === null || source === void 0 ? void 0 : source.attributes[exports.AUTOMATIC_ENVELOPE]) !== undefined);
|
|
340
|
+
if (!hasEnvelope) {
|
|
341
|
+
if (plan.outcome.automatic ||
|
|
342
|
+
[...plan.entities, ...plan.edges].some((item) => {
|
|
343
|
+
var _a;
|
|
344
|
+
return item.attributes[exports.AUTOMATIC_CLAIM] ||
|
|
345
|
+
((_a = (0, schemas_1.extractionMetadataFromAttributes)(item.attributes)) === null || _a === void 0 ? void 0 : _a.source) === 'policy';
|
|
346
|
+
}))
|
|
347
|
+
throw new Error('Engram automatic: missing_source_authority');
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
if (plan.outcome.error_count || plan.outcome.errors.length || plan.outcome.status !== 'succeeded')
|
|
351
|
+
throw new Error('Engram automatic: failed_plan');
|
|
352
|
+
const first = AutomaticMemory_schema_1.AutomaticSourceEnvelopeSchema.parse((_a = sources[0]) === null || _a === void 0 ? void 0 : _a.attributes[exports.AUTOMATIC_ENVELOPE]);
|
|
353
|
+
if (!first.policy)
|
|
354
|
+
throw new Error('Engram automatic: missing_policy');
|
|
355
|
+
const timestamp = (_e = (_c = (_b = plan.edges[0]) === null || _b === void 0 ? void 0 : _b.created_at) !== null && _c !== void 0 ? _c : (_d = plan.entities[0]) === null || _d === void 0 ? void 0 : _d.created_at) !== null && _e !== void 0 ? _e : new Date().toISOString();
|
|
356
|
+
const empty = {
|
|
357
|
+
...plan.outcome,
|
|
358
|
+
counts: {
|
|
359
|
+
entities_created: 0,
|
|
360
|
+
entities_updated: 0,
|
|
361
|
+
edges_created: 0,
|
|
362
|
+
edges_updated: 0,
|
|
363
|
+
edges_expired: 0,
|
|
364
|
+
unchanged: 0,
|
|
365
|
+
malformed: 0,
|
|
366
|
+
filtered: 0,
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
const expected = planAutomaticClaims(graph, plan.group_id, plan.source_guards.map((guard) => guard.uuid), first.policy, empty, timestamp);
|
|
370
|
+
if ((0, QueueState_1.canonical)(expected.entities) !== (0, QueueState_1.canonical)(plan.entities) ||
|
|
371
|
+
(0, QueueState_1.canonical)(expected.edges) !== (0, QueueState_1.canonical)(plan.edges) ||
|
|
372
|
+
(0, QueueState_1.canonical)(expected.outcome.automatic) !== (0, QueueState_1.canonical)(plan.outcome.automatic) ||
|
|
373
|
+
(0, QueueState_1.canonical)(expected.outcome.counts) !== (0, QueueState_1.canonical)(plan.outcome.counts))
|
|
374
|
+
throw new Error('Engram automatic: invalid_plan');
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
function committedAutomaticReceipt(outcome, timestamp) {
|
|
378
|
+
if (!outcome.automatic)
|
|
379
|
+
return;
|
|
380
|
+
outcome.automatic.persisted = true;
|
|
381
|
+
outcome.automatic.commitAt = timestamp;
|
|
382
|
+
for (const item of outcome.automatic.items)
|
|
383
|
+
if (item.mutation === 'pending') {
|
|
384
|
+
item.persisted = true;
|
|
385
|
+
item.mutation = 'created';
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
function failedAutomaticReceipt(outcome) {
|
|
389
|
+
if (!outcome.automatic)
|
|
390
|
+
return;
|
|
391
|
+
outcome.automatic.persisted = false;
|
|
392
|
+
outcome.automatic.commitAt = null;
|
|
393
|
+
for (const item of outcome.automatic.items)
|
|
394
|
+
if (item.mutation === 'pending') {
|
|
395
|
+
item.persisted = false;
|
|
396
|
+
item.mutation = 'none';
|
|
397
|
+
item.state = 'deferred';
|
|
398
|
+
item.reasons = ['interrupted'];
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
//# sourceMappingURL=AutomaticClaims.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutomaticClaims.js","sourceRoot":"","sources":["../../src/extraction/AutomaticClaims.ts"],"names":[],"mappings":";;;AAkCA,oEAmEC;AAGD,kDAkSC;AAGD,sDAsDC;AAED,8DASC;AAED,wDAWC;AA3dD,mCAAoC;AACpC,2CAAyC;AACzC,mEAAgE;AAChE,+BAAkC;AAClC,wCASoB;AACpB,8EAG2C;AAC3C,4EAI0C;AAC1C,2DAAwF;AACxF,oEAAoG;AACpG,6CAA2F;AAE9E,QAAA,kBAAkB,GAAG,2BAA2B,CAAC;AACjD,QAAA,eAAe,GAAG,iBAAiB,CAAC;AACpC,QAAA,eAAe,GAAG,uBAAuB,CAAC;AACvD,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC3F,MAAM,QAAQ,GAAG,CAAC,GAAY,EAAE,EAAE,CAAC,IAAA,SAAI,EAAC,IAAA,sBAAS,EAAC,GAAG,CAAC,EAAE,SAAI,CAAC,GA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AAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;YACvB,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC;YACvB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC;YACxB,IAAI,CAAC,OAAO,GAAG,CAAC,aAAa,CAAC,CAAC;QACjC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type AutomaticActor, type AutomaticBindingReference, type AutomaticCaptureFailureReason, type AutomaticPolicy, type AutomaticPolicyInput, type AutomaticPreferenceParseResult, type AutomaticSourceEnvelope } from '../schemas/AutomaticMemory.schema';
|
|
2
|
+
export declare function compileAutomaticPolicy(input?: AutomaticPolicyInput): AutomaticPolicy;
|
|
3
|
+
export declare function captureEnvelope(content: string, rawContent: string, actor: AutomaticActor, bindingRef: AutomaticBindingReference, intent: boolean, policy?: AutomaticPolicy): {
|
|
4
|
+
ok: true;
|
|
5
|
+
envelope: AutomaticSourceEnvelope;
|
|
6
|
+
} | {
|
|
7
|
+
ok: false;
|
|
8
|
+
reason: AutomaticCaptureFailureReason;
|
|
9
|
+
};
|
|
10
|
+
export declare function parseAutomaticPreferences(envelope: AutomaticSourceEnvelope, content: string): AutomaticPreferenceParseResult;
|