n8n-nodes-lenz 0.1.9 → 0.2.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 lenzhq
3
+ Copyright (c) 2026, Lenz IO
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -21,16 +21,54 @@ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes
21
21
 
22
22
  ## Operations
23
23
 
24
+ Operations are grouped under a **Resource** picker. (Nodes added before v0.1.10 stay on node version 1, which shows the original flat operation list — existing workflows are unaffected.)
25
+
26
+ ### Claim — check something
27
+
24
28
  | Operation | What it does |
25
29
  |---|---|
26
- | **Verify (Deep)** *(default)* | Full 8-model pipeline (research → debate → adjudication), ~90 seconds. Returns a verdict, confidence, `lenz_score` (1-10), sourced citations, and an executive summary. Reserve for high-stakes claims that need a thorough, cited answer. |
30
+ | **Verify (Deep)** *(default)* | Full 8-model pipeline (research → debate → adjudication), ~90 seconds. Returns a verdict, confidence, `lenz_score` (1-10), `key_finding`, sourced citations, and an executive summary. Reserve for high-stakes claims that need a thorough, cited answer. |
27
31
  | **Assess (Fast)** | A quick 3-model panel verdict, ~5-10 seconds, one entry per claim identified in the input text. Good default for lower-stakes checks. |
28
32
  | **Extract Claims** | Free — pulls the verifiable factual claims out of a block of text without checking them. Useful as a first step before running Assess or Verify on each claim individually. |
29
- | **Ask Follow-Up** | Asks a question grounded in the full research behind a completed **Verify (Deep)** result. Requires the `verification_id` that Verify returns — not usable standalone. |
30
- | **Check Usage** | Returns remaining quota per capability (`assess` / `verify` / `ask`), current plan, and when quota resets. |
33
+
34
+ ### Verification — manage submitted and stored work
35
+
36
+ | Operation | What it does |
37
+ |---|---|
38
+ | **Get Status** | Polls a submitted verification by `task_id`. Pairs with Verify's **Wait for Completion** toggle and with webhook delivery. |
39
+ | **Select Claims** | Resolves a paused verification (see [Ambiguous and multi-claim input](#ambiguous-and-multi-claim-input)). |
40
+ | **Submit Batch** | Submits up to 20 claims at once without waiting. Returns one item per spawned task. |
41
+ | **Get** | Retrieves a stored verification report by `verification_id`. |
42
+ | **Get Many** | Lists the verifications stored against this API key, with **Return All** / **Limit**. |
43
+ | **List Related** | Public verifications semantically related to a given one — useful for "see also" surfaces. |
44
+ | **Delete** | Permanently deletes one of your stored verifications. |
45
+
46
+ ### Ask — follow-up questions
47
+
48
+ | Operation | What it does |
49
+ |---|---|
50
+ | **Send** | Asks a question grounded in the full research behind a completed **Verify (Deep)** result. Requires the `verification_id` that Verify returns — not usable standalone. |
51
+ | **Get History** | Returns the stored conversation for a verification plus remaining ask quota. |
52
+ | **Reset History** | Deletes the stored conversation for a verification. |
53
+
54
+ ### Account
55
+
56
+ | Operation | What it does |
57
+ |---|---|
58
+ | **Get Usage** | Returns remaining quota per capability (`assess` / `verify` / `ask` / `extract`), current plan, and when quota resets. |
31
59
 
32
60
  Every claim-checking operation returns a branch-ready `passed` boolean (derived from the verdict) alongside the raw verdict/confidence/citations, so you can wire an **IF** node directly off the result — e.g. route failed claims to human review.
33
61
 
62
+ Verify and Get also expose an **Include Audit Trail** toggle, which adds the adjudication reasoning, debate transcript, per-panelist assessments, and panel agreement under `audit`. It's off by default because it's a lot of data per item.
63
+
64
+ ### Retry safety
65
+
66
+ Billable calls (Verify, Assess, Extract, Submit Batch, Select Claims) send an `Idempotency-Key` derived from the execution ID, node name, item index, and a fingerprint of the request body. If n8n retries the node — via **Retry On Fail**, or after a dropped response — the input is identical, so Lenz replays the original response instead of charging you a second time. A fresh run of the workflow is a new execution, so it bills normally.
67
+
68
+ Including the body in the key is what makes repeated runs safe: **Loop Over Items** and **AI Agent** tool calls both execute the node several times within a single execution, each time restarting the item index at 0, so a position-only key would send one key with different inputs and the API would reject it.
69
+
70
+ Note that **Assess bills per claim found in the text**, not per request: a paragraph containing five claims spends five assess units.
71
+
34
72
  ## Credentials
35
73
 
36
74
  You'll need a free Lenz API key:
@@ -86,6 +124,29 @@ Ask a grounded question about the evidence behind a Verify (Deep) result, by cha
86
124
  3. Set the Verification ID field to an expression referencing the first node's output: `{{ $json.verification_id }}`.
87
125
  4. Keep the Question field as a fixed string (e.g. `"What are the main sources supporting this verdict?"`) — it works for whatever claim was just verified, since only the Verification ID needs to change per run.
88
126
 
127
+ ### Ambiguous and multi-claim input
128
+
129
+ Verify pauses rather than guessing when the text isn't a single unambiguous claim. The result comes back with `status: "needs_input"` and a `reason`:
130
+
131
+ | `reason` | What the node returns | How to continue |
132
+ |---|---|---|
133
+ | `multi_claim` | `claims` — the distinct claims found in your text | Feed the ones you want into **Select Claims** with the same `task_id` |
134
+ | `clarification_required` | `candidates` — the possible readings of one ambiguous claim | Feed the intended reading into **Select Claims** with the same `task_id` |
135
+ | `duplicate_found` | `similar_claims` — existing verifications that already cover this | Reuse one of those `verification_id`s, or rephrase to force a fresh check |
136
+
137
+ **Select Claims** spawns one independent verification per selected claim and returns one item each, so you can poll them with **Get Status** or collect them via webhook:
138
+
139
+ ```
140
+ [Lenz node] ──▶ [IF node] ──▶ [Lenz node] ──▶ [Lenz node]
141
+ Verify (Deep) status == Select Claims Get Status
142
+ needs_input Task ID: Task ID:
143
+ {{ $json.task_id }} {{ $json.task_id }}
144
+ Selected Claims:
145
+ {{ $json.claims[0].text }}
146
+ ```
147
+
148
+ A paused task expires **10 minutes** after it pauses, and Select Claims only accepts text that was actually offered — so copy the claim text verbatim rather than retyping it.
149
+
89
150
  ## Resources
90
151
 
91
152
  * [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
@@ -102,3 +163,12 @@ Ask a grounded question about the evidence behind a Verify (Deep) result, by cha
102
163
  * **0.1.7** — Clarified the Verification ID field description and added an Ask Follow-Up wiring example to the README.
103
164
  * **0.1.8** — Rewrote the node to call the Lenz REST API directly via n8n's `httpRequestWithAuthentication` helper, removing the `lenz-io` SDK dependency entirely (zero runtime dependencies, no build-time bundling). This resolves the source-level restricted-import violations required for n8n Cloud verification.
104
165
  * **0.1.9** — Send a `User-Agent: n8n-nodes-lenz/<version>` header on every API request so Lenz can attribute API usage to the n8n integration.
166
+ * **0.1.10** — Brought the node up to the full Lenz Public API v1 surface. Added operations for batch verification, claim selection, status polling, stored-verification management (get / list / delete / related), and ask history (get / reset). Verify now accepts `source_url`, `webhook_url`, and `visibility`, can skip waiting via **Wait for Completion**, and surfaces the fields the API had been returning but the node discarded — `key_finding`, `domain`, `entities`, `presumed_intent`, `warnings`, `language`, timestamps, full source detail (`snippet` / `source_name` / `date`), and an opt-in `audit` trail. A `needs_input` result now returns the offered claims and a reason-specific next step instead of dead-ending. Billable POSTs send an `Idempotency-Key` so an n8n retry cannot double-charge quota, and every request pins `X-Lenz-API-Version`. Operations are now organised under a **Resource** picker in node version 1.1; nodes already saved on version 1 keep their original flat operation list and behaviour.
167
+
168
+ * **0.2.0** — Out-of-credits is now reported as a billing problem instead of a generic API failure. The node re-wrapped every error as `new NodeApiError(node, { message })`, and because a bare `{message}` carries no status, `httpCode` was always `null` — so the node was structurally blind to the difference between 402, 403 and 429 regardless of what the API returned. The original error is now passed through, and an HTTP 402 gets an explicit branch naming the condition, linking to [lenz.io/plans](https://lenz.io/plans), and stating that retrying will not help. Also documents the `/extract` daily cap (1000 calls per key per day, resetting 00:00 UTC), which the operation description had only ever called "free".
169
+
170
+ Also fixes an `Idempotency-Key` collision introduced in 0.1.10. The key was derived from the item index alone, so a node that ran more than once inside a single execution — **Loop Over Items**, or an **AI Agent** calling Lenz as a tool — reused the first run's key with different input, and the API rejected it (`422`, or `409` while the first call was still in flight). The key now includes a fingerprint of the request body, which keeps retry protection intact while letting repeated runs through. Verify also fails with a clear message if a submit returns no `task_id`, rather than polling an invalid status URL.
171
+
172
+ ## Maintainer
173
+
174
+ [@David19782](https://github.com/David19782)