@kashscript/hudhud 0.1.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 +133 -0
- package/README.md +67 -0
- package/dist/adapters/prisma.d.ts +170 -0
- package/dist/adapters/prisma.d.ts.map +1 -0
- package/dist/adapters/prisma.js +185 -0
- package/dist/adapters/prisma.js.map +1 -0
- package/dist/anchor/index.d.ts +55 -0
- package/dist/anchor/index.d.ts.map +1 -0
- package/dist/anchor/index.js +97 -0
- package/dist/anchor/index.js.map +1 -0
- package/dist/certificate/certificate.d.ts +115 -0
- package/dist/certificate/certificate.d.ts.map +1 -0
- package/dist/certificate/certificate.js +221 -0
- package/dist/certificate/certificate.js.map +1 -0
- package/dist/certificate/html.d.ts +10 -0
- package/dist/certificate/html.d.ts.map +1 -0
- package/dist/certificate/html.js +141 -0
- package/dist/certificate/html.js.map +1 -0
- package/dist/certificate/index.d.ts +3 -0
- package/dist/certificate/index.d.ts.map +1 -0
- package/dist/certificate/index.js +5 -0
- package/dist/certificate/index.js.map +1 -0
- package/dist/did-registry/index.d.ts +3 -0
- package/dist/did-registry/index.d.ts.map +1 -0
- package/dist/did-registry/index.js +10 -0
- package/dist/did-registry/index.js.map +1 -0
- package/dist/errors.d.ts +35 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +65 -0
- package/dist/errors.js.map +1 -0
- package/dist/exception/index.d.ts +97 -0
- package/dist/exception/index.d.ts.map +1 -0
- package/dist/exception/index.js +144 -0
- package/dist/exception/index.js.map +1 -0
- package/dist/identity/index.d.ts +33 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/index.js +36 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/ledger/event-schema.d.ts +97 -0
- package/dist/ledger/event-schema.d.ts.map +1 -0
- package/dist/ledger/event-schema.js +54 -0
- package/dist/ledger/event-schema.js.map +1 -0
- package/dist/ledger/index.d.ts +7 -0
- package/dist/ledger/index.d.ts.map +1 -0
- package/dist/ledger/index.js +14 -0
- package/dist/ledger/index.js.map +1 -0
- package/dist/ledger/mutex.d.ts +9 -0
- package/dist/ledger/mutex.d.ts.map +1 -0
- package/dist/ledger/mutex.js +36 -0
- package/dist/ledger/mutex.js.map +1 -0
- package/dist/ledger/store.d.ts +31 -0
- package/dist/ledger/store.d.ts.map +1 -0
- package/dist/ledger/store.js +66 -0
- package/dist/ledger/store.js.map +1 -0
- package/dist/ledger/writer.d.ts +69 -0
- package/dist/ledger/writer.d.ts.map +1 -0
- package/dist/ledger/writer.js +167 -0
- package/dist/ledger/writer.js.map +1 -0
- package/dist/mcp/allowlist.d.ts +53 -0
- package/dist/mcp/allowlist.d.ts.map +1 -0
- package/dist/mcp/allowlist.js +65 -0
- package/dist/mcp/allowlist.js.map +1 -0
- package/dist/mcp/client.d.ts +68 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +198 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +5 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/privacy/index.d.ts +21 -0
- package/dist/privacy/index.d.ts.map +1 -0
- package/dist/privacy/index.js +96 -0
- package/dist/privacy/index.js.map +1 -0
- package/dist/runtime/dispatcher.d.ts +27 -0
- package/dist/runtime/dispatcher.d.ts.map +1 -0
- package/dist/runtime/dispatcher.js +66 -0
- package/dist/runtime/dispatcher.js.map +1 -0
- package/dist/runtime/escalation.d.ts +98 -0
- package/dist/runtime/escalation.d.ts.map +1 -0
- package/dist/runtime/escalation.js +188 -0
- package/dist/runtime/escalation.js.map +1 -0
- package/dist/runtime/index.d.ts +7 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +9 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/runner.d.ts +78 -0
- package/dist/runtime/runner.d.ts.map +1 -0
- package/dist/runtime/runner.js +145 -0
- package/dist/runtime/runner.js.map +1 -0
- package/dist/scope/index.d.ts +19 -0
- package/dist/scope/index.d.ts.map +1 -0
- package/dist/scope/index.js +44 -0
- package/dist/scope/index.js.map +1 -0
- package/dist/sop/compiler.d.ts +36 -0
- package/dist/sop/compiler.d.ts.map +1 -0
- package/dist/sop/compiler.js +54 -0
- package/dist/sop/compiler.js.map +1 -0
- package/dist/sop/index.d.ts +3 -0
- package/dist/sop/index.d.ts.map +1 -0
- package/dist/sop/index.js +5 -0
- package/dist/sop/index.js.map +1 -0
- package/dist/sop/service.d.ts +40 -0
- package/dist/sop/service.d.ts.map +1 -0
- package/dist/sop/service.js +140 -0
- package/dist/sop/service.js.map +1 -0
- package/package.json +112 -0
- package/src/adapters/prisma.ts +310 -0
- package/src/anchor/index.ts +149 -0
- package/src/certificate/certificate.ts +340 -0
- package/src/certificate/html.ts +156 -0
- package/src/certificate/index.ts +4 -0
- package/src/did-registry/index.ts +11 -0
- package/src/errors.ts +79 -0
- package/src/exception/index.ts +244 -0
- package/src/identity/index.ts +82 -0
- package/src/index.ts +33 -0
- package/src/ledger/event-schema.ts +61 -0
- package/src/ledger/index.ts +22 -0
- package/src/ledger/mutex.ts +37 -0
- package/src/ledger/store.ts +86 -0
- package/src/ledger/writer.ts +249 -0
- package/src/mcp/allowlist.ts +102 -0
- package/src/mcp/client.ts +284 -0
- package/src/mcp/index.ts +4 -0
- package/src/privacy/index.ts +123 -0
- package/src/runtime/dispatcher.ts +96 -0
- package/src/runtime/escalation.ts +292 -0
- package/src/runtime/index.ts +14 -0
- package/src/runtime/runner.ts +227 -0
- package/src/scope/index.ts +59 -0
- package/src/sop/compiler.ts +99 -0
- package/src/sop/index.ts +4 -0
- package/src/sop/service.ts +184 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
KashScript Sovereign Software License Agreement (SSLA) v1.0
|
|
2
|
+
Schedule B — Commercial Package
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2026 KashScript Studio. All rights reserved.
|
|
5
|
+
|
|
6
|
+
This package is a Commercial Package under the SSLA. Production Use
|
|
7
|
+
requires an active paid Plan (`paid`, `team`, or `enterprise`) on the
|
|
8
|
+
Kash-Registry and a Seat covering your deployment.
|
|
9
|
+
|
|
10
|
+
• Evaluation / local development: permitted on the `free` Plan
|
|
11
|
+
• Production Use: requires a paid Plan + Seat
|
|
12
|
+
• Redistribution / re-hosting: prohibited (see §3)
|
|
13
|
+
• Removing license-verification: prohibited (see §3)
|
|
14
|
+
|
|
15
|
+
──────────────────────────────────────────────────────────────────────
|
|
16
|
+
QUICK SUMMARY (non-binding — the full SSLA controls)
|
|
17
|
+
|
|
18
|
+
WHAT YOU MAY DO
|
|
19
|
+
|
|
20
|
+
• Install, run, and modify this package on hardware you control.
|
|
21
|
+
• Use it in production once you hold a covering paid Plan +
|
|
22
|
+
Seat issued by the Kash-Registry.
|
|
23
|
+
• Build derivative works for your own internal use, provided the
|
|
24
|
+
license-verification code paths remain intact.
|
|
25
|
+
• Distribute compiled artifacts produced by this package (e.g.
|
|
26
|
+
a deployed Solidity contract is yours; the SDK code stays ours).
|
|
27
|
+
|
|
28
|
+
WHAT YOU MAY NOT DO
|
|
29
|
+
|
|
30
|
+
• Use this package in production without a covering Plan.
|
|
31
|
+
• Redistribute the package itself (no mirroring the .tgz, no
|
|
32
|
+
forking onto your own registry, no bundling into a competing
|
|
33
|
+
product under the @kashscript/ namespace).
|
|
34
|
+
• Operate a marketplace, registry, or SaaS that competes with the
|
|
35
|
+
Kash-Registry using this code.
|
|
36
|
+
• Remove or alter the license-verification code paths in any
|
|
37
|
+
production deployment.
|
|
38
|
+
|
|
39
|
+
WHAT YOU GET FROM US
|
|
40
|
+
|
|
41
|
+
• The package source, published openly for inspection.
|
|
42
|
+
• Bug fixes and security patches via the package's normal release
|
|
43
|
+
channel for the term of your Plan.
|
|
44
|
+
• The right to a 30-day cure window if your Plan lapses.
|
|
45
|
+
|
|
46
|
+
WHAT YOU DO NOT GET
|
|
47
|
+
|
|
48
|
+
• Any warranty, fitness-for-purpose, or non-infringement
|
|
49
|
+
guarantee (see §8 of the full SSLA).
|
|
50
|
+
• Indemnification (subject to the cap in §8).
|
|
51
|
+
• Continued production use after your Plan lapses for >14 days
|
|
52
|
+
and is not cured within 30 days.
|
|
53
|
+
|
|
54
|
+
──────────────────────────────────────────────────────────────────────
|
|
55
|
+
FULL SSLA
|
|
56
|
+
|
|
57
|
+
The above is a summary. The legally binding terms are in the SSLA v1.0,
|
|
58
|
+
which governs your use of this package in its entirety. The full text is
|
|
59
|
+
published at:
|
|
60
|
+
|
|
61
|
+
https://kashscript.dev/legal/SSLA
|
|
62
|
+
|
|
63
|
+
and in the source repository at:
|
|
64
|
+
|
|
65
|
+
https://github.com/kashscript/kashscript/blob/main/docs/legal/SSLA.md
|
|
66
|
+
|
|
67
|
+
A snapshot of §0–§10 of the SSLA is reproduced below for offline review.
|
|
68
|
+
|
|
69
|
+
──────────────────────────────────────────────────────────────────────
|
|
70
|
+
SSLA v1.0 — KEY CLAUSES (snapshot, reproduced verbatim)
|
|
71
|
+
|
|
72
|
+
§3. Commercial licence — Schedule B packages
|
|
73
|
+
|
|
74
|
+
For every package in Schedule B, we grant you a time-limited,
|
|
75
|
+
non-sublicensable, non-transferable licence to use the package,
|
|
76
|
+
conditional on:
|
|
77
|
+
|
|
78
|
+
1. You hold an active Plan (`paid`, `team`, or `enterprise`) with
|
|
79
|
+
a Seat count covering your deployment.
|
|
80
|
+
2. You have completed at least one successful /verify-license
|
|
81
|
+
challenge-response within the last 24 hours OR you hold a valid
|
|
82
|
+
Access Token issued by the Kash-Registry license server.
|
|
83
|
+
3. You use the package in a manner consistent with the Permitted
|
|
84
|
+
Use clause for that package in Schedule B.
|
|
85
|
+
|
|
86
|
+
The Commercial grant covers Production Use for the term of your Plan
|
|
87
|
+
and trial use during a 14-day evaluation window after first install
|
|
88
|
+
(the `trial` tier). It does NOT cover:
|
|
89
|
+
|
|
90
|
+
• Redistribution of the package to third parties (you may not host
|
|
91
|
+
the package's .tgz on your own registry mirror).
|
|
92
|
+
• Use of the package to compete with the Kash-Registry (operating
|
|
93
|
+
a marketplace under the @kashscript/ namespace, or selling a
|
|
94
|
+
fork as a substitute).
|
|
95
|
+
• Removal or alteration of the license-verification code paths.
|
|
96
|
+
|
|
97
|
+
Your Commercial licence terminates automatically if (i) your Plan
|
|
98
|
+
lapses for more than 14 days, (ii) you breach §3.1 or §3.2 in writing
|
|
99
|
+
or in conduct, or (iii) your DID is revoked by the Kash-Registry for
|
|
100
|
+
fraud, chargeback, or violation of the Acceptable Use Policy.
|
|
101
|
+
|
|
102
|
+
After termination, you have 30 days to either renew the Plan or stop
|
|
103
|
+
running the Commercial Package in Production.
|
|
104
|
+
|
|
105
|
+
§8. Warranty disclaimer + limitation of liability
|
|
106
|
+
|
|
107
|
+
THE PACKAGES ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. WE
|
|
108
|
+
DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING MERCHANTABILITY,
|
|
109
|
+
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
110
|
+
|
|
111
|
+
OUR AGGREGATE LIABILITY FOR ANY CLAIM ARISING OUT OF OR RELATED TO
|
|
112
|
+
THIS AGREEMENT WILL NOT EXCEED THE GREATER OF (i) THE AMOUNT YOU PAID
|
|
113
|
+
US IN THE 12 MONTHS PRECEDING THE CLAIM, OR (ii) USD 100.
|
|
114
|
+
|
|
115
|
+
NEITHER PARTY IS LIABLE FOR INDIRECT, INCIDENTAL, SPECIAL, OR
|
|
116
|
+
CONSEQUENTIAL DAMAGES.
|
|
117
|
+
|
|
118
|
+
§9. Governing law + venue
|
|
119
|
+
|
|
120
|
+
This Agreement is governed by the laws of the Islamic Republic of
|
|
121
|
+
Pakistan, without regard to conflict-of-laws rules. Disputes are
|
|
122
|
+
resolved exclusively in the courts of Islamabad — except that we may
|
|
123
|
+
seek injunctive relief in any court of competent jurisdiction to
|
|
124
|
+
protect our intellectual property or the integrity of the
|
|
125
|
+
Kash-Registry.
|
|
126
|
+
|
|
127
|
+
──────────────────────────────────────────────────────────────────────
|
|
128
|
+
CONTACT
|
|
129
|
+
|
|
130
|
+
Licensing questions: studio@kashscript.dev
|
|
131
|
+
Security disclosures: security@kashscript.dev
|
|
132
|
+
(see SECURITY.md for GPG fingerprint)
|
|
133
|
+
Plan management: https://kashscript.dev/account
|
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @kashscript/hudhud — the Agent Protocol (accountable runtime)
|
|
2
|
+
|
|
3
|
+
**Where agents act, ventures consume Hudhud and never reach for raw `neuron`.** Commercial (SSLA
|
|
4
|
+
Schedule B). Built in phase **M5** — the final protocol — of the Manifestation
|
|
5
|
+
([ADR-0016](../../docs/adr/0016-protocol-manifestation.md)).
|
|
6
|
+
|
|
7
|
+
The generic accountable agent runtime, lifted from the `oreoasis-core-host` engine: SOP compilation, MCP
|
|
8
|
+
governance (allowlist + fail-closed circuit breaker + PII redaction), scope-gating, a signed action
|
|
9
|
+
**ledger** + forensic scan and chain **anchor** on [`@kashscript/attest`](../attest), **exception
|
|
10
|
+
classification**, AIUC-1 **work certificates** (DSSE), a DID registry, an **identity gate**
|
|
11
|
+
([`@kashscript/identity-server`](../identity-server) agent tokens, MCP OAuth 2.1), and a
|
|
12
|
+
[`@kashscript/neuron`](../neuron)-backed execution runtime. Everything an agent does is Ed25519-signed
|
|
13
|
+
into an append-only, hash-chained ledger; restricted actions suspend for a two-key human sign-off. SOP
|
|
14
|
+
**content**, fixtures, storage schemas, and text UIs stay venture-side. Full contract:
|
|
15
|
+
[`specs/hudhud.md`](../../specs/hudhud.md).
|
|
16
|
+
|
|
17
|
+
## The signed run loop
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { WorkItemRunner } from "@kashscript/hudhud/runtime";
|
|
21
|
+
import { ForensicLedgerService, InMemoryLedgerStore, SessionMutex, createEd25519HostSigner } from "@kashscript/hudhud/ledger";
|
|
22
|
+
import { McpClientPoolManager } from "@kashscript/hudhud/mcp";
|
|
23
|
+
|
|
24
|
+
const forensicLedger = new ForensicLedgerService({
|
|
25
|
+
ledger: new InMemoryLedgerStore(),
|
|
26
|
+
sessionMutex: new SessionMutex(),
|
|
27
|
+
didRegistry, // resolves the agent DID → Ed25519 key
|
|
28
|
+
hostSigner: createEd25519HostSigner({ actorDid, actorClass: "AGENT", privateKey }),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const runner = new WorkItemRunner({ mcpClientPool: new McpClientPoolManager(), forensicLedger });
|
|
32
|
+
const result = await runner.run({ sessionId, dag, bindings }); // DELIVERED | ESCALATED | FAILED
|
|
33
|
+
// one Ed25519-signed ledger row per tool dispatch; a restricted tool with no
|
|
34
|
+
// approval envelope SUSPENDS the run to ESCALATED.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Modules (subpath exports)
|
|
38
|
+
|
|
39
|
+
- **`./sop`** — `compileSopStructural` (numbered/bulleted → content-addressable `TaskDag`) + `SopCompilerService` (goto back-edges + DFS cycle detection). Pure.
|
|
40
|
+
- **`./mcp`** — `validateToolArgs` / `decomposeToolName` / `McpAllowlistStore`; `McpClientPoolManager` — JSON-RPC 2.0 client + **fail-closed circuit breaker** (a transport failure trips it; a JSON-RPC application error does not), injectable `fetchImpl`.
|
|
41
|
+
- **`./privacy`** — `scanAndRedact` + 15 builtin PII/secret patterns; recall-biased, category tags never raw values.
|
|
42
|
+
- **`./scope`** — `assertScopeAllowsTool` — a `RESTRICTED` session cannot dispatch administrative tools.
|
|
43
|
+
- **`./ledger`** — `ForensicLedgerService` (self-signing + caller-signed append under a per-session mutex; gap-free hash chain; `forensicConsistencyScan` throws on tamper), `LedgerEventSchema` (closed vocab). Signing / chain-hash / scan are **attest's** (M1 seed), re-exported.
|
|
44
|
+
- **`./anchor`** — `computeAnchorMerkleRoot` + `ChainAnchor` / `AnchorReceiptStore` — out-of-band chain-tip publication so a full-ledger rewrite is still detectable.
|
|
45
|
+
- **`./exception`** — signed exception-classification dataset; `failureClass` is **mandatory** (no default), each record Ed25519-signed over its exact bytes; class-mix + per-workflow stats.
|
|
46
|
+
- **`./certificate`** — `buildWorkCertificate` (DSSE) + `verifyWorkCertificate` (signature **and** count re-derivation from the enumerated outcomes) + AIUC-1 (A–F) coverage + HTML renderer (brand hook).
|
|
47
|
+
- **`./identity`** — `verifyAccountableIdentity(token, {expectedAudience})` → `{ok, actor:{owner,agent}, scope}` over identity-server agent tokens.
|
|
48
|
+
- **`./runtime`** — `NeuronToolDispatcher` (neuron `ToolDispatcher` SPI; inline signed ledger append per dispatch), `WorkItemRunner`, two-key escalation (`buildHumanApprovalEnvelope` / `appendOperatorSignoff` / `ResumeGuard`).
|
|
49
|
+
- **`./did-registry`** — `DidRegistry` + `InMemoryDidRegistry` (attest's M1 seed).
|
|
50
|
+
- **`./adapters/prisma`** — structural-delegate `PrismaLedgerStore` / `PrismaAnchorReceiptStore` / `PrismaExceptionClassificationStore` / `PrismaDidRegistry`. **No `@prisma/client` dependency** — pass a client model that satisfies the narrow `{ create, findFirst, findMany, count }` delegate; the schema is venture-side.
|
|
51
|
+
|
|
52
|
+
## Two-key escalation
|
|
53
|
+
|
|
54
|
+
An autonomous run that reaches a restricted tool **suspends**; a human must sign off before it resumes.
|
|
55
|
+
The guarantee is literal: the approval envelope's two signatures use **distinct keys** (the host holds the
|
|
56
|
+
agent key but cannot mint the separate operator key), the sign-off is a signed `OPERATOR_ADMIN` ledger row
|
|
57
|
+
plus a mandatory exception classification, and a resume key can be claimed at most once (`ResumeGuard`).
|
|
58
|
+
|
|
59
|
+
## Status
|
|
60
|
+
|
|
61
|
+
`0.x` — the API stays `0.x` until `oreoasis-core-host` becomes a thin host on the published package with
|
|
62
|
+
its full test suite green (consumer-as-acceptance, ADR-0016; the atomic swap is a **separate** venture
|
|
63
|
+
session per the hudhud-last guard). The runtime license assertion + registry tier mapping land in M6.
|
|
64
|
+
Depends on [`@kashscript/identity-core`](../identity-core), [`@kashscript/attest`](../attest),
|
|
65
|
+
[`@kashscript/identity-server`](../identity-server), and [`@kashscript/neuron`](../neuron).
|
|
66
|
+
|
|
67
|
+
Commercial — SSLA Schedule B; see `LICENSE`.
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { LedgerBlockInput, LedgerBlockRecord, LedgerStore } from "../ledger/store";
|
|
2
|
+
import type { AnchorRecord, AnchorReceiptRecord, AnchorReceiptStore } from "../anchor";
|
|
3
|
+
import type { ExceptionClassificationRecord, ExceptionClassificationStore } from "../exception";
|
|
4
|
+
import type { DidPublicKey, DidRegistry } from "../did-registry";
|
|
5
|
+
/** A JSON scalar as Prisma surfaces it (`Json` column). */
|
|
6
|
+
type Json = unknown;
|
|
7
|
+
/** Prisma's model methods return `PrismaPromise<T>` (a `Promise<T>`); the
|
|
8
|
+
* narrow delegates below type only the arg subset hudhud passes + a `Promise`
|
|
9
|
+
* return, so a generated delegate is assignable. */
|
|
10
|
+
export interface LedgerBlockRow {
|
|
11
|
+
readonly sessionId: string;
|
|
12
|
+
readonly stepIndex: number;
|
|
13
|
+
readonly previousBlockHash: string;
|
|
14
|
+
readonly currentTransactionBlockHash: string;
|
|
15
|
+
readonly actorDid: string;
|
|
16
|
+
readonly payloadMutation: Json;
|
|
17
|
+
readonly signature: string;
|
|
18
|
+
readonly emittedAt: string;
|
|
19
|
+
readonly localId: number;
|
|
20
|
+
}
|
|
21
|
+
/** The subset of `PrismaClient.ledgerBlock` hudhud calls. `localId`/`emittedAt`
|
|
22
|
+
* are DB-assigned (autoincrement + default now()), so `create` omits them and
|
|
23
|
+
* the created row carries them back. */
|
|
24
|
+
export interface PrismaLedgerDelegate {
|
|
25
|
+
create(args: {
|
|
26
|
+
data: Omit<LedgerBlockRow, "localId" | "emittedAt"> & {
|
|
27
|
+
emittedAt?: string;
|
|
28
|
+
};
|
|
29
|
+
}): Promise<LedgerBlockRow>;
|
|
30
|
+
findFirst(args: {
|
|
31
|
+
where: {
|
|
32
|
+
sessionId: string;
|
|
33
|
+
};
|
|
34
|
+
orderBy: {
|
|
35
|
+
stepIndex: "asc" | "desc";
|
|
36
|
+
};
|
|
37
|
+
}): Promise<LedgerBlockRow | null>;
|
|
38
|
+
findMany(args: {
|
|
39
|
+
where: {
|
|
40
|
+
sessionId: string;
|
|
41
|
+
};
|
|
42
|
+
orderBy: {
|
|
43
|
+
stepIndex: "asc" | "desc";
|
|
44
|
+
};
|
|
45
|
+
}): Promise<ReadonlyArray<LedgerBlockRow>>;
|
|
46
|
+
count(args: {
|
|
47
|
+
where: {
|
|
48
|
+
sessionId: string;
|
|
49
|
+
};
|
|
50
|
+
}): Promise<number>;
|
|
51
|
+
}
|
|
52
|
+
/** {@link LedgerStore} over a Prisma `ledgerBlock` delegate. Append-only; the
|
|
53
|
+
* DB's `(sessionId, stepIndex)` UNIQUE constraint is what enforces the gap-free
|
|
54
|
+
* chain under concurrency (the in-memory store checks it in JS). */
|
|
55
|
+
export declare class PrismaLedgerStore implements LedgerStore {
|
|
56
|
+
private readonly delegate;
|
|
57
|
+
constructor(delegate: PrismaLedgerDelegate);
|
|
58
|
+
appendBlock(input: LedgerBlockInput): Promise<LedgerBlockRecord>;
|
|
59
|
+
latestBlockForSession(sessionId: string): Promise<LedgerBlockRecord | null>;
|
|
60
|
+
countBlocksForSession(sessionId: string): Promise<number>;
|
|
61
|
+
listBlocksForSession(sessionId: string): Promise<ReadonlyArray<LedgerBlockRecord>>;
|
|
62
|
+
}
|
|
63
|
+
export interface AnchorReceiptRow {
|
|
64
|
+
readonly id: string;
|
|
65
|
+
readonly publishedAt: string;
|
|
66
|
+
readonly merkleRoot: string;
|
|
67
|
+
readonly tipCount: number;
|
|
68
|
+
readonly tips: Json;
|
|
69
|
+
readonly witness: Json;
|
|
70
|
+
readonly createdAt: string;
|
|
71
|
+
}
|
|
72
|
+
export interface PrismaAnchorReceiptDelegate {
|
|
73
|
+
create(args: {
|
|
74
|
+
data: Omit<AnchorReceiptRow, "id" | "createdAt"> & {
|
|
75
|
+
id?: string;
|
|
76
|
+
createdAt?: string;
|
|
77
|
+
};
|
|
78
|
+
}): Promise<AnchorReceiptRow>;
|
|
79
|
+
findFirst(args: {
|
|
80
|
+
where?: {
|
|
81
|
+
merkleRoot?: string;
|
|
82
|
+
};
|
|
83
|
+
orderBy: {
|
|
84
|
+
createdAt: "asc" | "desc";
|
|
85
|
+
};
|
|
86
|
+
}): Promise<AnchorReceiptRow | null>;
|
|
87
|
+
findMany(args: {
|
|
88
|
+
orderBy: {
|
|
89
|
+
createdAt: "asc" | "desc";
|
|
90
|
+
};
|
|
91
|
+
}): Promise<ReadonlyArray<AnchorReceiptRow>>;
|
|
92
|
+
}
|
|
93
|
+
/** {@link AnchorReceiptStore} over a Prisma `anchorReceipt` delegate. */
|
|
94
|
+
export declare class PrismaAnchorReceiptStore implements AnchorReceiptStore {
|
|
95
|
+
private readonly delegate;
|
|
96
|
+
constructor(delegate: PrismaAnchorReceiptDelegate);
|
|
97
|
+
append(record: AnchorRecord): Promise<AnchorReceiptRecord>;
|
|
98
|
+
latest(): Promise<AnchorReceiptRecord | null>;
|
|
99
|
+
history(): Promise<ReadonlyArray<AnchorReceiptRecord>>;
|
|
100
|
+
latestForRoot(merkleRoot: string): Promise<AnchorReceiptRecord | null>;
|
|
101
|
+
}
|
|
102
|
+
export interface ExceptionClassificationRow {
|
|
103
|
+
readonly id: string;
|
|
104
|
+
readonly schemaVersion: string;
|
|
105
|
+
readonly timestampIso: string;
|
|
106
|
+
readonly workflowId: string;
|
|
107
|
+
readonly sopVersion: string;
|
|
108
|
+
readonly inputRef: string;
|
|
109
|
+
readonly contentHash: string;
|
|
110
|
+
readonly model: string;
|
|
111
|
+
readonly modelVersion: string;
|
|
112
|
+
readonly failureClass: string;
|
|
113
|
+
readonly failureTag: string;
|
|
114
|
+
readonly operatorDid: string;
|
|
115
|
+
readonly resolutionSummary: string;
|
|
116
|
+
readonly resolutionActionRefs: Json;
|
|
117
|
+
readonly escalationId: string | null;
|
|
118
|
+
readonly signoffLedgerStepIndex: number | null;
|
|
119
|
+
readonly signedEnvelope: Json;
|
|
120
|
+
}
|
|
121
|
+
export interface PrismaExceptionClassificationDelegate {
|
|
122
|
+
create(args: {
|
|
123
|
+
data: ExceptionClassificationRow;
|
|
124
|
+
}): Promise<unknown>;
|
|
125
|
+
findMany(args: {
|
|
126
|
+
where?: {
|
|
127
|
+
workflowId?: string;
|
|
128
|
+
};
|
|
129
|
+
orderBy: {
|
|
130
|
+
timestampIso: "asc" | "desc";
|
|
131
|
+
};
|
|
132
|
+
}): Promise<ReadonlyArray<ExceptionClassificationRow>>;
|
|
133
|
+
findFirst(args: {
|
|
134
|
+
orderBy: {
|
|
135
|
+
timestampIso: "asc" | "desc";
|
|
136
|
+
};
|
|
137
|
+
}): Promise<ExceptionClassificationRow | null>;
|
|
138
|
+
}
|
|
139
|
+
/** {@link ExceptionClassificationStore} over a Prisma delegate. Signatures live
|
|
140
|
+
* in the row (`signedEnvelope` JSON), so verification survives the round-trip. */
|
|
141
|
+
export declare class PrismaExceptionClassificationStore implements ExceptionClassificationStore {
|
|
142
|
+
private readonly delegate;
|
|
143
|
+
constructor(delegate: PrismaExceptionClassificationDelegate);
|
|
144
|
+
append(record: ExceptionClassificationRecord): Promise<void>;
|
|
145
|
+
history(): Promise<ReadonlyArray<ExceptionClassificationRecord>>;
|
|
146
|
+
latest(): Promise<ExceptionClassificationRecord | null>;
|
|
147
|
+
byWorkflow(workflowId: string): Promise<ReadonlyArray<ExceptionClassificationRecord>>;
|
|
148
|
+
}
|
|
149
|
+
export interface DidKeyRow {
|
|
150
|
+
readonly did: string;
|
|
151
|
+
/** 32-byte Ed25519 public key. Prisma `Bytes` surfaces as a `Uint8Array`. */
|
|
152
|
+
readonly publicKeyBytes: Uint8Array;
|
|
153
|
+
readonly algorithm: string;
|
|
154
|
+
}
|
|
155
|
+
export interface PrismaDidKeyDelegate {
|
|
156
|
+
findUnique(args: {
|
|
157
|
+
where: {
|
|
158
|
+
did: string;
|
|
159
|
+
};
|
|
160
|
+
}): Promise<DidKeyRow | null>;
|
|
161
|
+
}
|
|
162
|
+
/** {@link DidRegistry} over a Prisma `didKey` delegate — resolve-only (the ledger
|
|
163
|
+
* needs only the read side; registration/PDS resolution is venture-side). */
|
|
164
|
+
export declare class PrismaDidRegistry implements DidRegistry {
|
|
165
|
+
private readonly delegate;
|
|
166
|
+
constructor(delegate: PrismaDidKeyDelegate);
|
|
167
|
+
resolve(did: string): Promise<DidPublicKey | null>;
|
|
168
|
+
}
|
|
169
|
+
export {};
|
|
170
|
+
//# sourceMappingURL=prisma.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../../src/adapters/prisma.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAGnB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,6BAA6B,EAC7B,4BAA4B,EAE7B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEjE,2DAA2D;AAC3D,KAAK,IAAI,GAAG,OAAO,CAAC;AAEpB;;qDAEqD;AAIrD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,2BAA2B,EAAE,MAAM,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IA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AC,CAAC;CACzE;AAED;8EAC8E;AAC9E,qBAAa,iBAAkB,YAAW,WAAW;IACvC,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,oBAAoB;IAErD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;CAKzD"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// @kashscript/hudhud/adapters/prisma — durable store adapters (schema-free)
|
|
3
|
+
// ----------------------------------------------------------------------------
|
|
4
|
+
// hudhud ships the STORE INTERFACES (ledger, anchor-receipt, exception, DID);
|
|
5
|
+
// the in-memory references live beside them. This subpath ships the DURABLE
|
|
6
|
+
// adapters WITHOUT a `@prisma/client` dependency: each adapter is constructed
|
|
7
|
+
// over a NARROW STRUCTURAL DELEGATE — the small `{ create, findFirst, findMany,
|
|
8
|
+
// count }` surface hudhud actually calls, typed over the row shape hudhud
|
|
9
|
+
// needs. A venture's generated `PrismaClient.<model>` (with matching columns +
|
|
10
|
+
// a `Json` payload column) satisfies the delegate, so the venture wires:
|
|
11
|
+
//
|
|
12
|
+
// new PrismaLedgerStore(prisma.ledgerBlock)
|
|
13
|
+
//
|
|
14
|
+
// The concrete Prisma SCHEMA (migrations, indexes, column types) is venture-side
|
|
15
|
+
// and lands at the swap. Keeping hudhud schema-free is deliberate (guard b):
|
|
16
|
+
// the protocol owns the CONTRACT; the venture owns the storage.
|
|
17
|
+
// ============================================================================
|
|
18
|
+
function rowToLedgerRecord(row) {
|
|
19
|
+
return {
|
|
20
|
+
sessionId: row.sessionId,
|
|
21
|
+
stepIndex: row.stepIndex,
|
|
22
|
+
previousBlockHash: row.previousBlockHash,
|
|
23
|
+
currentTransactionBlockHash: row.currentTransactionBlockHash,
|
|
24
|
+
actorDid: row.actorDid,
|
|
25
|
+
payloadMutation: (row.payloadMutation ?? {}),
|
|
26
|
+
signature: row.signature,
|
|
27
|
+
emittedAt: row.emittedAt,
|
|
28
|
+
localId: row.localId,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** {@link LedgerStore} over a Prisma `ledgerBlock` delegate. Append-only; the
|
|
32
|
+
* DB's `(sessionId, stepIndex)` UNIQUE constraint is what enforces the gap-free
|
|
33
|
+
* chain under concurrency (the in-memory store checks it in JS). */
|
|
34
|
+
export class PrismaLedgerStore {
|
|
35
|
+
delegate;
|
|
36
|
+
constructor(delegate) {
|
|
37
|
+
this.delegate = delegate;
|
|
38
|
+
}
|
|
39
|
+
async appendBlock(input) {
|
|
40
|
+
const row = await this.delegate.create({
|
|
41
|
+
data: {
|
|
42
|
+
sessionId: input.sessionId,
|
|
43
|
+
stepIndex: input.stepIndex,
|
|
44
|
+
previousBlockHash: input.previousBlockHash,
|
|
45
|
+
currentTransactionBlockHash: input.currentTransactionBlockHash,
|
|
46
|
+
actorDid: input.actorDid,
|
|
47
|
+
payloadMutation: input.payloadMutation,
|
|
48
|
+
signature: input.signature,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
return rowToLedgerRecord(row);
|
|
52
|
+
}
|
|
53
|
+
async latestBlockForSession(sessionId) {
|
|
54
|
+
const row = await this.delegate.findFirst({ where: { sessionId }, orderBy: { stepIndex: "desc" } });
|
|
55
|
+
return row === null ? null : rowToLedgerRecord(row);
|
|
56
|
+
}
|
|
57
|
+
async countBlocksForSession(sessionId) {
|
|
58
|
+
return this.delegate.count({ where: { sessionId } });
|
|
59
|
+
}
|
|
60
|
+
async listBlocksForSession(sessionId) {
|
|
61
|
+
const rows = await this.delegate.findMany({ where: { sessionId }, orderBy: { stepIndex: "asc" } });
|
|
62
|
+
return rows.map(rowToLedgerRecord);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function rowToAnchorReceipt(row) {
|
|
66
|
+
return {
|
|
67
|
+
id: row.id,
|
|
68
|
+
publishedAt: row.publishedAt,
|
|
69
|
+
merkleRoot: row.merkleRoot,
|
|
70
|
+
tipCount: row.tipCount,
|
|
71
|
+
tips: (row.tips ?? []),
|
|
72
|
+
createdAt: row.createdAt,
|
|
73
|
+
...(row.witness ? { witness: row.witness } : {}),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** {@link AnchorReceiptStore} over a Prisma `anchorReceipt` delegate. */
|
|
77
|
+
export class PrismaAnchorReceiptStore {
|
|
78
|
+
delegate;
|
|
79
|
+
constructor(delegate) {
|
|
80
|
+
this.delegate = delegate;
|
|
81
|
+
}
|
|
82
|
+
async append(record) {
|
|
83
|
+
const row = await this.delegate.create({
|
|
84
|
+
data: {
|
|
85
|
+
publishedAt: record.publishedAt,
|
|
86
|
+
merkleRoot: record.merkleRoot,
|
|
87
|
+
tipCount: record.tipCount,
|
|
88
|
+
tips: record.tips,
|
|
89
|
+
witness: (record.witness ?? null),
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
return rowToAnchorReceipt(row);
|
|
93
|
+
}
|
|
94
|
+
async latest() {
|
|
95
|
+
const row = await this.delegate.findFirst({ orderBy: { createdAt: "desc" } });
|
|
96
|
+
return row === null ? null : rowToAnchorReceipt(row);
|
|
97
|
+
}
|
|
98
|
+
async history() {
|
|
99
|
+
const rows = await this.delegate.findMany({ orderBy: { createdAt: "asc" } });
|
|
100
|
+
return rows.map(rowToAnchorReceipt);
|
|
101
|
+
}
|
|
102
|
+
async latestForRoot(merkleRoot) {
|
|
103
|
+
const row = await this.delegate.findFirst({ where: { merkleRoot }, orderBy: { createdAt: "desc" } });
|
|
104
|
+
return row === null ? null : rowToAnchorReceipt(row);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function rowToClassification(row) {
|
|
108
|
+
return {
|
|
109
|
+
id: row.id,
|
|
110
|
+
schemaVersion: row.schemaVersion,
|
|
111
|
+
timestampIso: row.timestampIso,
|
|
112
|
+
workflowId: row.workflowId,
|
|
113
|
+
sopVersion: row.sopVersion,
|
|
114
|
+
inputRef: row.inputRef,
|
|
115
|
+
contentHash: row.contentHash,
|
|
116
|
+
model: row.model,
|
|
117
|
+
modelVersion: row.modelVersion,
|
|
118
|
+
failureClass: row.failureClass,
|
|
119
|
+
failureTag: row.failureTag,
|
|
120
|
+
operatorDid: row.operatorDid,
|
|
121
|
+
resolutionSummary: row.resolutionSummary,
|
|
122
|
+
resolutionActionRefs: (row.resolutionActionRefs ?? []),
|
|
123
|
+
escalationId: row.escalationId,
|
|
124
|
+
signoffLedgerStepIndex: row.signoffLedgerStepIndex,
|
|
125
|
+
signedEnvelope: row.signedEnvelope,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/** {@link ExceptionClassificationStore} over a Prisma delegate. Signatures live
|
|
129
|
+
* in the row (`signedEnvelope` JSON), so verification survives the round-trip. */
|
|
130
|
+
export class PrismaExceptionClassificationStore {
|
|
131
|
+
delegate;
|
|
132
|
+
constructor(delegate) {
|
|
133
|
+
this.delegate = delegate;
|
|
134
|
+
}
|
|
135
|
+
async append(record) {
|
|
136
|
+
await this.delegate.create({
|
|
137
|
+
data: {
|
|
138
|
+
id: record.id,
|
|
139
|
+
schemaVersion: record.schemaVersion,
|
|
140
|
+
timestampIso: record.timestampIso,
|
|
141
|
+
workflowId: record.workflowId,
|
|
142
|
+
sopVersion: record.sopVersion,
|
|
143
|
+
inputRef: record.inputRef,
|
|
144
|
+
contentHash: record.contentHash,
|
|
145
|
+
model: record.model,
|
|
146
|
+
modelVersion: record.modelVersion,
|
|
147
|
+
failureClass: record.failureClass,
|
|
148
|
+
failureTag: record.failureTag,
|
|
149
|
+
operatorDid: record.operatorDid,
|
|
150
|
+
resolutionSummary: record.resolutionSummary,
|
|
151
|
+
resolutionActionRefs: record.resolutionActionRefs,
|
|
152
|
+
escalationId: record.escalationId,
|
|
153
|
+
signoffLedgerStepIndex: record.signoffLedgerStepIndex,
|
|
154
|
+
signedEnvelope: record.signedEnvelope,
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
async history() {
|
|
159
|
+
const rows = await this.delegate.findMany({ orderBy: { timestampIso: "asc" } });
|
|
160
|
+
return rows.map(rowToClassification);
|
|
161
|
+
}
|
|
162
|
+
async latest() {
|
|
163
|
+
const row = await this.delegate.findFirst({ orderBy: { timestampIso: "desc" } });
|
|
164
|
+
return row === null ? null : rowToClassification(row);
|
|
165
|
+
}
|
|
166
|
+
async byWorkflow(workflowId) {
|
|
167
|
+
const rows = await this.delegate.findMany({ where: { workflowId }, orderBy: { timestampIso: "asc" } });
|
|
168
|
+
return rows.map(rowToClassification);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/** {@link DidRegistry} over a Prisma `didKey` delegate — resolve-only (the ledger
|
|
172
|
+
* needs only the read side; registration/PDS resolution is venture-side). */
|
|
173
|
+
export class PrismaDidRegistry {
|
|
174
|
+
delegate;
|
|
175
|
+
constructor(delegate) {
|
|
176
|
+
this.delegate = delegate;
|
|
177
|
+
}
|
|
178
|
+
async resolve(did) {
|
|
179
|
+
const row = await this.delegate.findUnique({ where: { did } });
|
|
180
|
+
if (row === null)
|
|
181
|
+
return null;
|
|
182
|
+
return { did: row.did, publicKeyBytes: new Uint8Array(row.publicKeyBytes), algorithm: "ed25519" };
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=prisma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prisma.js","sourceRoot":"","sources":["../../src/adapters/prisma.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,gFAAgF;AAChF,0EAA0E;AAC1E,+EAA+E;AAC/E,yEAAyE;AACzE,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,iFAAiF;AACjF,6EAA6E;AAC7E,gEAAgE;AAChE,+EAA+E;AAwD/E,SAAS,iBAAiB,CAAC,GAAmB;IAC5C,OAAO;QACL,SAAS,EAAE,GAAG,CAAC,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UAAU,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QAC/D,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAC9B,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,UAAU,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;IACpG,CAAC;CACF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface ChainTip {
|
|
2
|
+
readonly sessionId: string;
|
|
3
|
+
readonly latestHash: string;
|
|
4
|
+
readonly latestStepIndex: number;
|
|
5
|
+
}
|
|
6
|
+
export type AnchorWitnessBackend = "rekor" | "opentimestamps" | "none";
|
|
7
|
+
export interface AnchorWitness {
|
|
8
|
+
readonly backend: AnchorWitnessBackend;
|
|
9
|
+
readonly receipt: Readonly<Record<string, unknown>>;
|
|
10
|
+
readonly witnessedAt: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface AnchorRecord {
|
|
13
|
+
readonly publishedAt: string;
|
|
14
|
+
/** Merkle root over (sessionId, latestHash, stepIndex) triples, sorted by sessionId. */
|
|
15
|
+
readonly merkleRoot: string;
|
|
16
|
+
readonly tipCount: number;
|
|
17
|
+
readonly tips: ReadonlyArray<ChainTip>;
|
|
18
|
+
readonly witness?: AnchorWitness;
|
|
19
|
+
}
|
|
20
|
+
export interface ChainAnchor {
|
|
21
|
+
publish(tips: ReadonlyArray<ChainTip>): Promise<AnchorRecord>;
|
|
22
|
+
history(): Promise<ReadonlyArray<AnchorRecord>>;
|
|
23
|
+
latest(): Promise<AnchorRecord | null>;
|
|
24
|
+
}
|
|
25
|
+
/** Deterministic SHA-256-over-sorted-tip-triples root. Simpler than a binary
|
|
26
|
+
* Merkle tree — the anchor's job is just to be unrewritable; the cross-check
|
|
27
|
+
* against the per-session chain hash is what proves tamper. */
|
|
28
|
+
export declare function computeAnchorMerkleRoot(tips: ReadonlyArray<ChainTip>): Promise<string>;
|
|
29
|
+
/** In-memory anchor — records publications for inspection. A legitimate
|
|
30
|
+
* dev/test backend (the anchor is then witnessed for the process lifetime). */
|
|
31
|
+
export declare class NullChainAnchor implements ChainAnchor {
|
|
32
|
+
private readonly records;
|
|
33
|
+
publish(tips: ReadonlyArray<ChainTip>): Promise<AnchorRecord>;
|
|
34
|
+
history(): Promise<ReadonlyArray<AnchorRecord>>;
|
|
35
|
+
latest(): Promise<AnchorRecord | null>;
|
|
36
|
+
}
|
|
37
|
+
export interface AnchorReceiptRecord extends AnchorRecord {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly createdAt: string;
|
|
40
|
+
}
|
|
41
|
+
export interface AnchorReceiptStore {
|
|
42
|
+
append(record: AnchorRecord): Promise<AnchorReceiptRecord>;
|
|
43
|
+
latest(): Promise<AnchorReceiptRecord | null>;
|
|
44
|
+
history(): Promise<ReadonlyArray<AnchorReceiptRecord>>;
|
|
45
|
+
latestForRoot(merkleRoot: string): Promise<AnchorReceiptRecord | null>;
|
|
46
|
+
}
|
|
47
|
+
/** In-memory receipt store — the no-DB / test profile. */
|
|
48
|
+
export declare class InMemoryAnchorReceiptStore implements AnchorReceiptStore {
|
|
49
|
+
private readonly rows;
|
|
50
|
+
append(record: AnchorRecord): Promise<AnchorReceiptRecord>;
|
|
51
|
+
latest(): Promise<AnchorReceiptRecord | null>;
|
|
52
|
+
history(): Promise<ReadonlyArray<AnchorReceiptRecord>>;
|
|
53
|
+
latestForRoot(merkleRoot: string): Promise<AnchorReceiptRecord | null>;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/anchor/index.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAA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