deusproof 0.4.0__tar.gz → 0.4.1__tar.gz

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.
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deusproof
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: Prove your AI agent's work existed at a given moment — one call, self-signed, timestamped and Bitcoin-anchored on a public append-only register. Free.
5
5
  Author: DEUSPROOF
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://deusproof.com
8
8
  Project-URL: Pantheon, https://deusproof.com/pantheon
9
- Keywords: ai-agents,provenance,audit-log,tamper-evident,did,bitcoin,rfc3161,langchain,langgraph,claude-code,cli
9
+ Keywords: ai-agents,provenance,audit-log,tamper-evident,did,bitcoin,rfc3161,langchain,langgraph,claude-code,cursor,cli
10
10
  Requires-Python: >=3.9
11
11
  Description-Content-Type: text/markdown
12
12
  Requires-Dist: httpx>=0.24
@@ -139,6 +139,23 @@ Add a `SessionEnd` hook to `.claude/settings.json` (or `~/.claude/settings.json`
139
139
  When a session ends, its transcript is fingerprinted and sealed. The transcript never leaves your
140
140
  machine. The hook never fails your session: without network it just skips and says so on stderr.
141
141
 
142
+ ### Cursor: the same, from its `stop` hook
143
+
144
+ Add to `.cursor/hooks.json` (or `~/.cursor/hooks.json` for all projects):
145
+
146
+ ```json
147
+ {
148
+ "version": 1,
149
+ "hooks": {
150
+ "stop": [ { "command": "deusproof seal --hook --handle my-dev-agent --platform cursor --min-gap 15" } ]
151
+ }
152
+ }
153
+ ```
154
+
155
+ Cursor's `stop` fires after every agent turn, so the hook skips a transcript that has not changed
156
+ since its last seal, and `--min-gap 15` seals at most once every 15 minutes. Nothing is lost: each
157
+ seal covers everything before it.
158
+
142
159
  ## Use it from LangChain
143
160
 
144
161
  ```bash
@@ -121,6 +121,23 @@ Add a `SessionEnd` hook to `.claude/settings.json` (or `~/.claude/settings.json`
121
121
  When a session ends, its transcript is fingerprinted and sealed. The transcript never leaves your
122
122
  machine. The hook never fails your session: without network it just skips and says so on stderr.
123
123
 
124
+ ### Cursor: the same, from its `stop` hook
125
+
126
+ Add to `.cursor/hooks.json` (or `~/.cursor/hooks.json` for all projects):
127
+
128
+ ```json
129
+ {
130
+ "version": 1,
131
+ "hooks": {
132
+ "stop": [ { "command": "deusproof seal --hook --handle my-dev-agent --platform cursor --min-gap 15" } ]
133
+ }
134
+ }
135
+ ```
136
+
137
+ Cursor's `stop` fires after every agent turn, so the hook skips a transcript that has not changed
138
+ since its last seal, and `--min-gap 15` seals at most once every 15 minutes. Nothing is lost: each
139
+ seal covers everything before it.
140
+
124
141
  ## Use it from LangChain
125
142
 
126
143
  ```bash
@@ -15,4 +15,4 @@
15
15
  from .notary import Notary, Proof
16
16
 
17
17
  __all__ = ["Notary", "Proof"]
18
- __version__ = "0.4.0"
18
+ __version__ = "0.4.1"
@@ -22,8 +22,16 @@ anchor. Keep it with the file.
22
22
 
23
23
  HOOK MODE. `deusproof seal --hook` reads a hook event as JSON on stdin and seals
24
24
  its `transcript_path`. That makes it a one-line SessionEnd hook for Claude Code
25
- (and any tool that passes a transcript path the same way). In hook mode it
26
- never fails the caller: errors go to stderr and the exit code is 0.
25
+ and a `stop` hook for Cursor (any tool that passes a transcript path the same
26
+ way). In hook mode it never fails the caller: errors go to stderr, stdout gets
27
+ an empty JSON object (what Cursor expects from a hook) and the exit code is 0.
28
+
29
+ NOT EVERY TURN (18-nov-2026). Cursor's `stop` fires after every agent turn, not
30
+ once per session. A seal per turn would flood the register with near-identical
31
+ records and hit the rate limit. So in hook mode a transcript that has not
32
+ changed since its last seal is skipped, and `--min-gap MINUTES` skips a seal
33
+ when the last one is more recent than that. Nothing is lost: the next seal
34
+ covers every byte before it.
27
35
  """
28
36
 
29
37
  from __future__ import annotations
@@ -123,6 +131,27 @@ def verify_file(path: str | Path, *, receipts: Optional[str] = None) -> list[dic
123
131
 
124
132
 
125
133
  # ---------------------------------------------------------------------- CLI
134
+ def _too_soon(path: Path, receipts: Optional[str], min_gap: float, *, skip_unchanged: bool) -> str:
135
+ """Why this seal should be skipped, or "" to go ahead. Reads only the local receipts."""
136
+ rows = _read_receipts(_receipts_path(path, receipts))
137
+ if not rows:
138
+ return ""
139
+ last = rows[-1]
140
+ if skip_unchanged and int(last.get("bytes", -1)) == path.stat().st_size:
141
+ digest, _ = _sha256_prefix(path)
142
+ if digest == last.get("sha256"):
143
+ return "unchanged since the last seal"
144
+ if min_gap > 0:
145
+ try:
146
+ then = datetime.fromisoformat(str(last.get("sealed_at")))
147
+ except ValueError:
148
+ return ""
149
+ minutes = (datetime.now(timezone.utc) - then).total_seconds() / 60
150
+ if minutes < min_gap:
151
+ return f"last seal {minutes:.0f} min ago (--min-gap {min_gap:g})"
152
+ return ""
153
+
154
+
126
155
  def _notary(args: argparse.Namespace):
127
156
  from .notary import Notary # imported here so `verify` works without network deps configured
128
157
 
@@ -143,14 +172,25 @@ def _cmd_seal(args: argparse.Namespace) -> int:
143
172
  target = event.get("transcript_path") or target
144
173
  if not target:
145
174
  print("deusproof: hook event has no transcript_path; nothing sealed", file=sys.stderr)
146
- return 0
147
- r = seal_file(os.path.expanduser(target), notary=_notary(args), receipts=args.receipts)
148
- print(f"deusproof: sealed {r['bytes']} bytes | {r['verify_url']}", file=sys.stderr)
175
+ else:
176
+ p = Path(os.path.expanduser(target))
177
+ why = _too_soon(p, args.receipts, args.min_gap, skip_unchanged=True) if p.is_file() else ""
178
+ if why:
179
+ print(f"deusproof: skipped, {why}", file=sys.stderr)
180
+ else:
181
+ r = seal_file(p, notary=_notary(args), receipts=args.receipts)
182
+ print(f"deusproof: sealed {r['bytes']} bytes | {r['verify_url']}", file=sys.stderr)
149
183
  except BaseException as e: # a witness must never break the session it witnesses
150
184
  print(f"deusproof: not sealed ({e})", file=sys.stderr)
185
+ print("{}")
151
186
  return 0
152
187
  if not target:
153
188
  raise SystemExit("seal needs a file path (or --hook)")
189
+ if args.min_gap > 0 and Path(target).is_file():
190
+ why = _too_soon(Path(target), args.receipts, args.min_gap, skip_unchanged=False)
191
+ if why:
192
+ print(f"skipped {Path(target).name}: {why}")
193
+ return 0
154
194
  r = seal_file(target, notary=_notary(args), receipts=args.receipts)
155
195
  print(f"sealed {r['file']} | {r['bytes']} bytes | sha256 {r['sha256']}")
156
196
  print(f" {r['verify_url']}")
@@ -167,7 +207,7 @@ def _cmd_verify(args: argparse.Namespace) -> int:
167
207
  bad = 0
168
208
  for r in results:
169
209
  if r["ok"]:
170
- extra = f" · {r['added']} bytes added since" if r["added"] else ""
210
+ extra = f" | {r['added']} bytes added since" if r["added"] else ""
171
211
  print(f"OK {r['sealed_at']} | first {r['bytes']} bytes unchanged{extra} | {r['verify_url']}")
172
212
  else:
173
213
  bad += 1
@@ -186,6 +226,8 @@ def main(argv: Optional[list] = None) -> int:
186
226
  s.add_argument("--receipts", help="where to keep receipts (default: <file>.deusproof.jsonl)")
187
227
  s.add_argument("--base-url", help=argparse.SUPPRESS)
188
228
  s.add_argument("--hook", action="store_true", help="read a hook event (JSON on stdin) and seal its transcript_path; never fails")
229
+ s.add_argument("--min-gap", type=float, default=0, metavar="MINUTES",
230
+ help="skip if the last seal of this file is more recent than this (useful for per-turn hooks)")
189
231
  s.set_defaults(func=_cmd_seal)
190
232
 
191
233
  v = sub.add_parser("verify", help="check a file against its receipts (offline)")
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deusproof
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: Prove your AI agent's work existed at a given moment — one call, self-signed, timestamped and Bitcoin-anchored on a public append-only register. Free.
5
5
  Author: DEUSPROOF
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://deusproof.com
8
8
  Project-URL: Pantheon, https://deusproof.com/pantheon
9
- Keywords: ai-agents,provenance,audit-log,tamper-evident,did,bitcoin,rfc3161,langchain,langgraph,claude-code,cli
9
+ Keywords: ai-agents,provenance,audit-log,tamper-evident,did,bitcoin,rfc3161,langchain,langgraph,claude-code,cursor,cli
10
10
  Requires-Python: >=3.9
11
11
  Description-Content-Type: text/markdown
12
12
  Requires-Dist: httpx>=0.24
@@ -139,6 +139,23 @@ Add a `SessionEnd` hook to `.claude/settings.json` (or `~/.claude/settings.json`
139
139
  When a session ends, its transcript is fingerprinted and sealed. The transcript never leaves your
140
140
  machine. The hook never fails your session: without network it just skips and says so on stderr.
141
141
 
142
+ ### Cursor: the same, from its `stop` hook
143
+
144
+ Add to `.cursor/hooks.json` (or `~/.cursor/hooks.json` for all projects):
145
+
146
+ ```json
147
+ {
148
+ "version": 1,
149
+ "hooks": {
150
+ "stop": [ { "command": "deusproof seal --hook --handle my-dev-agent --platform cursor --min-gap 15" } ]
151
+ }
152
+ }
153
+ ```
154
+
155
+ Cursor's `stop` fires after every agent turn, so the hook skips a transcript that has not changed
156
+ since its last seal, and `--min-gap 15` seals at most once every 15 minutes. Nothing is lost: each
157
+ seal covers everything before it.
158
+
142
159
  ## Use it from LangChain
143
160
 
144
161
  ```bash
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "deusproof"
7
- version = "0.4.0"
7
+ version = "0.4.1"
8
8
  description = "Prove your AI agent's work existed at a given moment — one call, self-signed, timestamped and Bitcoin-anchored on a public append-only register. Free."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -15,7 +15,7 @@ dependencies = [
15
15
  "cryptography>=41",
16
16
  "base58>=2.1",
17
17
  ]
18
- keywords = ["ai-agents", "provenance", "audit-log", "tamper-evident", "did", "bitcoin", "rfc3161", "langchain", "langgraph", "claude-code", "cli"]
18
+ keywords = ["ai-agents", "provenance", "audit-log", "tamper-evident", "did", "bitcoin", "rfc3161", "langchain", "langgraph", "claude-code", "cursor", "cli"]
19
19
 
20
20
  # LA SONDA, COMO EXTRA OPCIONAL (16-sep-2026). Quien instale `deusproof` a secas
21
21
  # no se descarga el arbol de LangChain; solo lo pide quien lo va a usar.
File without changes
File without changes
File without changes