@cedulon/mcp-server 0.2.3 → 0.3.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/README.md +20 -0
- package/dist/index.js +62 -2
- package/dist/index.js.map +1 -1
- package/dist/session.d.ts +81 -2
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +395 -10
- package/dist/session.js.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -76,3 +76,23 @@ Policy knobs (demo defaults in parentheses):
|
|
|
76
76
|
- `CEDULON_PAYER` (`payer-1`)
|
|
77
77
|
|
|
78
78
|
The rail is the in-process mock. No wallet, no RPC, no network.
|
|
79
|
+
|
|
80
|
+
## Privacy Policy
|
|
81
|
+
|
|
82
|
+
<https://cedulon.com/privacy.html>
|
|
83
|
+
|
|
84
|
+
The short version, which that page states at length. This server runs on your
|
|
85
|
+
machine and speaks to your client over stdio. It makes no network requests:
|
|
86
|
+
this package and the six packages it depends on contain no HTTP client, no
|
|
87
|
+
socket, and no telemetry, and the only dependency outside the project is the
|
|
88
|
+
official Model Context Protocol SDK. It collects nothing, because there is no
|
|
89
|
+
endpoint of ours to collect it.
|
|
90
|
+
|
|
91
|
+
While it runs it holds, in memory, the spend requests of the session (amount,
|
|
92
|
+
currency, payee, nonce, calling tool name), the receipts derived from them,
|
|
93
|
+
the checkpoint, and your policy limits. It writes nothing to disk unless you
|
|
94
|
+
set `CEDULON_STATE_PATH`, in which case that ledger is written as JSON to the
|
|
95
|
+
path you chose, on your machine. No analytics, no crash reporting, no update
|
|
96
|
+
check, no third-party sharing.
|
|
97
|
+
|
|
98
|
+
Privacy questions and security reports: <e.dogru@conarium.dev>.
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,16 @@ const TOOLS = [
|
|
|
8
8
|
{
|
|
9
9
|
name: "cedulon_spend",
|
|
10
10
|
description: "Policy-gated spend on the mock rail. Allow returns a signed COSE receipt JSON. Deny returns the fail-closed reason.",
|
|
11
|
+
annotations: {
|
|
12
|
+
title: "Spend on the mock rail",
|
|
13
|
+
// Appends a receipt and consumes window budget. It overwrites nothing,
|
|
14
|
+
// and repeating it spends again, so it is neither destructive nor
|
|
15
|
+
// idempotent. No socket is opened; see openWorldHint below.
|
|
16
|
+
readOnlyHint: false,
|
|
17
|
+
destructiveHint: false,
|
|
18
|
+
idempotentHint: false,
|
|
19
|
+
openWorldHint: false,
|
|
20
|
+
},
|
|
11
21
|
inputSchema: {
|
|
12
22
|
type: "object",
|
|
13
23
|
additionalProperties: false,
|
|
@@ -24,10 +34,31 @@ const TOOLS = [
|
|
|
24
34
|
{
|
|
25
35
|
name: "cedulon_audit",
|
|
26
36
|
description: "Reconcile the in-process receipt chain and checkpoint against the rail extract. Returns audit: balanced or findings.",
|
|
37
|
+
annotations: {
|
|
38
|
+
title: "Audit the receipt chain",
|
|
39
|
+
readOnlyHint: true,
|
|
40
|
+
openWorldHint: false,
|
|
41
|
+
},
|
|
27
42
|
inputSchema: {
|
|
28
43
|
type: "object",
|
|
29
44
|
additionalProperties: false,
|
|
30
45
|
properties: {
|
|
46
|
+
trust: {
|
|
47
|
+
type: "object",
|
|
48
|
+
description: "Rail key you hold out of band: { publicKeyPem, accountId?, railId?, windowStartMs?, windowEndMs? }",
|
|
49
|
+
},
|
|
50
|
+
issuerTrust: {
|
|
51
|
+
type: "object",
|
|
52
|
+
description: "Issuer key(s) you hold out of band: { publicKeyPem: string | string[] }. Without it the audit checks this server's records against this server's own key.",
|
|
53
|
+
},
|
|
54
|
+
witnessTrust: {
|
|
55
|
+
type: "object",
|
|
56
|
+
description: "Transparency log key you hold out of band: { publicKeyPem: string | string[] }",
|
|
57
|
+
},
|
|
58
|
+
payeeTrust: {
|
|
59
|
+
type: "object",
|
|
60
|
+
description: "Payee keys you hold out of band, keyed by payee: { \"payee-1\": publicKeyPem }",
|
|
61
|
+
},
|
|
31
62
|
extraSettlements: {
|
|
32
63
|
type: "array",
|
|
33
64
|
description: "Optional extra extract rows, used to inject a bypass settlement in tests",
|
|
@@ -47,7 +78,12 @@ const TOOLS = [
|
|
|
47
78
|
},
|
|
48
79
|
{
|
|
49
80
|
name: "cedulon_verify_receipt",
|
|
50
|
-
description: "Verify a spend receipt COSE_Sign1 (and payee countersignature when present).",
|
|
81
|
+
description: "Verify a spend receipt COSE_Sign1 (and payee countersignature when present). Supply expectIssuerKeyPem to check it against a key you already hold; without one the receipt is only checked against the key it carries, which any key satisfies.",
|
|
82
|
+
annotations: {
|
|
83
|
+
title: "Verify a spend receipt",
|
|
84
|
+
readOnlyHint: true,
|
|
85
|
+
openWorldHint: false,
|
|
86
|
+
},
|
|
51
87
|
inputSchema: {
|
|
52
88
|
type: "object",
|
|
53
89
|
additionalProperties: false,
|
|
@@ -57,17 +93,35 @@ const TOOLS = [
|
|
|
57
93
|
publicKeyPem: { type: "string" },
|
|
58
94
|
counterCoseHex: { type: "string" },
|
|
59
95
|
payeePublicKeyPem: { type: "string" },
|
|
96
|
+
expectIssuerKeyPem: {
|
|
97
|
+
type: "string",
|
|
98
|
+
description: "Issuer key you hold out of band. Omit and the check is self-referential.",
|
|
99
|
+
},
|
|
100
|
+
expectPayeeKeyPem: {
|
|
101
|
+
type: "string",
|
|
102
|
+
description: "Payee key you hold out of band, for the countersignature.",
|
|
103
|
+
},
|
|
60
104
|
},
|
|
61
105
|
},
|
|
62
106
|
},
|
|
63
107
|
{
|
|
64
108
|
name: "cedulon_export_ledger",
|
|
65
109
|
description: "Export receipts, checkpoint, and rail extract in the same JSON shape as npm run demo:export.",
|
|
110
|
+
annotations: {
|
|
111
|
+
title: "Export the ledger",
|
|
112
|
+
readOnlyHint: true,
|
|
113
|
+
openWorldHint: false,
|
|
114
|
+
},
|
|
66
115
|
inputSchema: { type: "object", additionalProperties: false, properties: {} },
|
|
67
116
|
},
|
|
68
117
|
{
|
|
69
118
|
name: "cedulon_status",
|
|
70
119
|
description: "Server version, policy summary, receipt count, and chain head hash.",
|
|
120
|
+
annotations: {
|
|
121
|
+
title: "Server status",
|
|
122
|
+
readOnlyHint: true,
|
|
123
|
+
openWorldHint: false,
|
|
124
|
+
},
|
|
71
125
|
inputSchema: { type: "object", additionalProperties: false, properties: {} },
|
|
72
126
|
},
|
|
73
127
|
];
|
|
@@ -111,7 +165,13 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
111
165
|
return textResult(outcome, !outcome.ok);
|
|
112
166
|
}
|
|
113
167
|
case "cedulon_audit": {
|
|
114
|
-
const report = session.audit({
|
|
168
|
+
const report = session.audit({
|
|
169
|
+
extraSettlements: asExtraSettlements(args.extraSettlements),
|
|
170
|
+
trust: args.trust,
|
|
171
|
+
issuerTrust: args.issuerTrust,
|
|
172
|
+
witnessTrust: args.witnessTrust,
|
|
173
|
+
payeeTrust: args.payeeTrust,
|
|
174
|
+
});
|
|
115
175
|
return textResult({
|
|
116
176
|
ok: report.ok,
|
|
117
177
|
summary: report.summary,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAmC,MAAM,cAAc,CAAC;AAGnG,MAAM,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;AAErC,MAAM,KAAK,GAAG;IACZ;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EACT,qHAAqH;QACvH,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE,KAAK;YAC3B,UAAU,EAAE;gBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oCAAoC,EAAE;gBAC7E,QAAQ,EAAE,EAAE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AAG,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC;QAClE,OAAO,UAAU,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
package/dist/session.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Finding } from "@cedulon/audit";
|
|
1
|
+
import { type Finding, type IssuerTrustPin, type PayeeTrustPins, type RailTrustPin } from "@cedulon/audit";
|
|
2
2
|
import { type SignedCheckpoint } from "@cedulon/checkpoint";
|
|
3
3
|
import { PolicyEngine, type Policy } from "@cedulon/core";
|
|
4
4
|
import { type SignedReceipt } from "@cedulon/receipts";
|
|
@@ -22,12 +22,29 @@ export type SpendDeny = {
|
|
|
22
22
|
export type SpendOutcome = SpendOk | SpendDeny;
|
|
23
23
|
export type AuditArgs = {
|
|
24
24
|
extraSettlements?: RailSettlement[];
|
|
25
|
+
/**
|
|
26
|
+
* Trust roots the caller holds out of band. Without them the audit is checking
|
|
27
|
+
* this server's records against this server's own key, which is a question
|
|
28
|
+
* that answers itself - so every answer it could give was conditional.
|
|
29
|
+
*/
|
|
30
|
+
trust?: RailTrustPin;
|
|
31
|
+
issuerTrust?: IssuerTrustPin;
|
|
32
|
+
witnessTrust?: IssuerTrustPin;
|
|
33
|
+
payeeTrust?: PayeeTrustPins;
|
|
25
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Whether the file holding this server's signing key is protected by the OS.
|
|
37
|
+
* `owner-only` is a mode this platform enforces; `unprotected-on-this-platform`
|
|
38
|
+
* is Windows, where the same call succeeds and protects nothing because the
|
|
39
|
+
* access control there is the directory ACL, which this server does not set.
|
|
40
|
+
*/
|
|
41
|
+
export type StateProtection = "in-memory" | "absent" | "owner-only" | "unprotected-on-this-platform";
|
|
26
42
|
export type StatusReport = {
|
|
27
43
|
version: string;
|
|
28
44
|
policy: Record<string, unknown>;
|
|
29
45
|
receiptCount: number;
|
|
30
46
|
chainHead: string | null;
|
|
47
|
+
stateProtection: StateProtection;
|
|
31
48
|
};
|
|
32
49
|
export type PanelReceipt = {
|
|
33
50
|
payer: string;
|
|
@@ -44,7 +61,8 @@ export type PanelCheckpoint = {
|
|
|
44
61
|
startMs: number;
|
|
45
62
|
endMs: number;
|
|
46
63
|
receiptCount: number;
|
|
47
|
-
totals
|
|
64
|
+
/** `null` when the checkpoint was signed with its totals withheld. */
|
|
65
|
+
totals: Record<string, string> | null;
|
|
48
66
|
chainHead: string | null;
|
|
49
67
|
hash: string;
|
|
50
68
|
};
|
|
@@ -62,6 +80,10 @@ export type LedgerExport = {
|
|
|
62
80
|
warnings: Finding[];
|
|
63
81
|
};
|
|
64
82
|
export type VerifyArgs = {
|
|
83
|
+
/** Issuer key the caller holds out of band; without it the check is self-referential. */
|
|
84
|
+
expectIssuerKeyPem?: string;
|
|
85
|
+
/** Payee key the caller holds out of band, for the countersignature. */
|
|
86
|
+
expectPayeeKeyPem?: string;
|
|
65
87
|
receipt?: SignedReceipt;
|
|
66
88
|
coseHex?: string;
|
|
67
89
|
publicKeyPem?: string;
|
|
@@ -77,6 +99,9 @@ export declare class CedulonSession {
|
|
|
77
99
|
checkpoints: SignedCheckpoint[];
|
|
78
100
|
readonly payer: string;
|
|
79
101
|
private readonly statePath;
|
|
102
|
+
/** Fingerprint of the state file as this session last saw it. */
|
|
103
|
+
private lastSeenState;
|
|
104
|
+
private lockDepth;
|
|
80
105
|
constructor(opts?: {
|
|
81
106
|
policy?: Policy;
|
|
82
107
|
keys?: AdapterKeys;
|
|
@@ -84,17 +109,71 @@ export declare class CedulonSession {
|
|
|
84
109
|
payer?: string;
|
|
85
110
|
});
|
|
86
111
|
spend(args: SpendArgs, nowMs?: number): SpendOutcome;
|
|
112
|
+
/**
|
|
113
|
+
* Discard what this session was holding and take the file as it now stands.
|
|
114
|
+
* A conflict is otherwise permanent - the session keeps a view the disk no
|
|
115
|
+
* longer matches and refuses every write, with no way back short of restarting
|
|
116
|
+
* the process. Returns the nonces this session was holding that the file does
|
|
117
|
+
* not have, so nothing disappears silently.
|
|
118
|
+
*/
|
|
119
|
+
reload(): {
|
|
120
|
+
dropped: string[];
|
|
121
|
+
};
|
|
122
|
+
private snapshot;
|
|
123
|
+
private restore;
|
|
124
|
+
private settleAndRecord;
|
|
87
125
|
audit(args?: AuditArgs): import("@cedulon/audit").AuditReport;
|
|
88
126
|
status(): StatusReport;
|
|
127
|
+
/**
|
|
128
|
+
* Said out loud rather than left to be inferred from the absence of an error:
|
|
129
|
+
* a server that writes a private key to disk has to report which protection it
|
|
130
|
+
* actually got.
|
|
131
|
+
*/
|
|
132
|
+
stateProtection(): StateProtection;
|
|
133
|
+
/**
|
|
134
|
+
* A path checked once at startup is a path an attacker can replace afterwards,
|
|
135
|
+
* and the directories were never checked at all. Anything symlinked on the way
|
|
136
|
+
* lets whoever placed the link choose where the private key lands.
|
|
137
|
+
*/
|
|
138
|
+
private assertNoSymlink;
|
|
139
|
+
/**
|
|
140
|
+
* Reading the fingerprint and then writing leaves a window: two servers that
|
|
141
|
+
* both read before either wrote each saw an unchanged file, and one receipt
|
|
142
|
+
* disappeared with both sides reporting success. An exclusive create is the
|
|
143
|
+
* cheapest thing that actually closes it. A lock whose holder is gone is taken
|
|
144
|
+
* over rather than obeyed forever.
|
|
145
|
+
*/
|
|
146
|
+
private withStateLock;
|
|
147
|
+
private lockHolderPid;
|
|
148
|
+
/**
|
|
149
|
+
* A temp file from a write that never finished still holds the signing key in
|
|
150
|
+
* the clear. The writer that left it is gone; nothing else is going to clean
|
|
151
|
+
* it up.
|
|
152
|
+
*/
|
|
153
|
+
private sweepStaleTemp;
|
|
154
|
+
private pidIsGone;
|
|
155
|
+
private lockHolderIsGone;
|
|
89
156
|
exportLedger(): LedgerExport;
|
|
157
|
+
/**
|
|
158
|
+
* `expectIssuerKeyPem` / `expectPayeeKeyPem` are the keys the caller already
|
|
159
|
+
* holds. Without them this answers whether the receipt is internally
|
|
160
|
+
* consistent, which any minted key satisfies - so the answer says which
|
|
161
|
+
* question it answered rather than letting the caller assume the stronger one.
|
|
162
|
+
*/
|
|
90
163
|
verify(args: VerifyArgs): {
|
|
91
164
|
ok: boolean;
|
|
92
165
|
receipt: boolean;
|
|
93
166
|
countersignature: boolean | null;
|
|
167
|
+
issuerCheckedAgainstSuppliedKey: boolean;
|
|
168
|
+
payeeCheckedAgainstSuppliedKey: boolean | null;
|
|
94
169
|
};
|
|
95
170
|
private rebuildCheckpoint;
|
|
96
171
|
private load;
|
|
97
172
|
private save;
|
|
173
|
+
private writeLocked;
|
|
174
|
+
private writeState;
|
|
175
|
+
/** What the state file looked like the last time this session agreed with it. */
|
|
176
|
+
private readStateFingerprint;
|
|
98
177
|
}
|
|
99
178
|
export declare function receiptFromArgs(args: VerifyArgs): SignedReceipt;
|
|
100
179
|
//# sourceMappingURL=session.d.ts.map
|
package/dist/session.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAkB,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAA2F,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEhJ,OAAO,EACL,UAAU,EAEV,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MA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;;;;OAKG;IACH,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG;QACxB,EAAE,EAAE,OAAO,CAAC;QACZ,OAAO,EAAE,OAAO,CAAC;QACjB,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAAC;QACjC,+BAA+B,EAAE,OAAO,CAAC;QACzC,8BAA8B,EAAE,OAAO,GAAG,IAAI,CAAC;KAChD;IAyBD,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,IAAI;IA0CZ,OAAO,CAAC,IAAI;IA+BZ,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,UAAU;IAelB,iFAAiF;IACjF,OAAO,CAAC,oBAAoB;CAU7B;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,aAAa,CAmB/D"}
|
package/dist/session.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { lstatSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
2
3
|
import { createRequire } from "node:module";
|
|
3
|
-
import { dirname } from "node:path";
|
|
4
|
-
import { audit } from "@cedulon/audit";
|
|
4
|
+
import { basename, dirname, join } from "node:path";
|
|
5
|
+
import { audit, } from "@cedulon/audit";
|
|
5
6
|
import { buildCheckpointClaims, checkpointHash, signCheckpoint, } from "@cedulon/checkpoint";
|
|
6
7
|
import { PolicyEngine, policyDocument } from "@cedulon/core";
|
|
7
8
|
import { claimsFromCbor, generateReceiptKeys, receiptHash, verifyCounterSignature, verifyReceipt } from "@cedulon/receipts";
|
|
@@ -44,6 +45,9 @@ export class CedulonSession {
|
|
|
44
45
|
checkpoints = [];
|
|
45
46
|
payer;
|
|
46
47
|
statePath;
|
|
48
|
+
/** Fingerprint of the state file as this session last saw it. */
|
|
49
|
+
lastSeenState = null;
|
|
50
|
+
lockDepth = 0;
|
|
47
51
|
constructor(opts) {
|
|
48
52
|
this.payer = opts?.payer ?? envOr("CEDULON_PAYER", "payer-1");
|
|
49
53
|
this.statePath = opts?.statePath !== undefined ? opts.statePath : process.env.CEDULON_STATE_PATH || null;
|
|
@@ -54,10 +58,95 @@ export class CedulonSession {
|
|
|
54
58
|
receiptPublicPem: generated.publicKeyPem,
|
|
55
59
|
};
|
|
56
60
|
if (this.statePath) {
|
|
61
|
+
// Read through on load, a symlink at this path lets whoever placed it
|
|
62
|
+
// decide what this server starts up believing. Refusing the path is the
|
|
63
|
+
// only answer that does not depend on write ordering.
|
|
64
|
+
this.assertNoSymlink();
|
|
57
65
|
this.load();
|
|
66
|
+
this.lastSeenState = this.readStateFingerprint();
|
|
58
67
|
}
|
|
59
68
|
}
|
|
60
69
|
spend(args, nowMs = Date.now()) {
|
|
70
|
+
// Settle first and save afterwards and a failed save leaves the rail holding
|
|
71
|
+
// a settlement whose receipt exists only in memory. Restart, and it is a
|
|
72
|
+
// settlement with no receipt - the one condition this project exists to make
|
|
73
|
+
// impossible. So the whole thing happens under the lock, and the write is
|
|
74
|
+
// proven possible before any money moves.
|
|
75
|
+
let locked = null;
|
|
76
|
+
try {
|
|
77
|
+
locked = this.withStateLock(() => {
|
|
78
|
+
if (this.statePath && this.readStateFingerprint() !== this.lastSeenState) {
|
|
79
|
+
return { ok: false, reason: "state-conflict" };
|
|
80
|
+
}
|
|
81
|
+
// Everything from here is undone together if the record cannot be
|
|
82
|
+
// written. A settlement the caller was told failed must not survive in
|
|
83
|
+
// memory, must not reach the ledger, and must not be carried out to disk
|
|
84
|
+
// by the next payment that succeeds.
|
|
85
|
+
const undo = this.snapshot();
|
|
86
|
+
try {
|
|
87
|
+
return this.settleAndRecord(args, nowMs);
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
this.restore(undo);
|
|
91
|
+
if (err?.message === "cedulon-state-symlink") {
|
|
92
|
+
throw err;
|
|
93
|
+
}
|
|
94
|
+
return { ok: false, reason: "state-io" };
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
const message = err?.message ?? "";
|
|
100
|
+
if (message.startsWith("cedulon-state-locked")) {
|
|
101
|
+
return { ok: false, reason: `state-locked:${message.split(":")[1] ?? "unknown"}` };
|
|
102
|
+
}
|
|
103
|
+
throw err;
|
|
104
|
+
}
|
|
105
|
+
return locked;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Discard what this session was holding and take the file as it now stands.
|
|
109
|
+
* A conflict is otherwise permanent - the session keeps a view the disk no
|
|
110
|
+
* longer matches and refuses every write, with no way back short of restarting
|
|
111
|
+
* the process. Returns the nonces this session was holding that the file does
|
|
112
|
+
* not have, so nothing disappears silently.
|
|
113
|
+
*/
|
|
114
|
+
reload() {
|
|
115
|
+
const held = this.receipts.map((r) => r.claims.nonce);
|
|
116
|
+
this.receipts.length = 0;
|
|
117
|
+
this.checkpoints = [];
|
|
118
|
+
this.ledger.restore([]);
|
|
119
|
+
this.engine.store.reset();
|
|
120
|
+
this.load();
|
|
121
|
+
this.lastSeenState = this.readStateFingerprint();
|
|
122
|
+
const now = new Set(this.receipts.map((r) => r.claims.nonce));
|
|
123
|
+
return { dropped: held.filter((nonce) => !now.has(nonce)) };
|
|
124
|
+
}
|
|
125
|
+
snapshot() {
|
|
126
|
+
return {
|
|
127
|
+
receipts: [...this.receipts],
|
|
128
|
+
settlements: this.ledger.extract(),
|
|
129
|
+
checkpoints: this.checkpoints,
|
|
130
|
+
usedNonces: new Set(this.engine.store.usedNonces),
|
|
131
|
+
consumedDecisions: new Set(this.engine.store.consumedDecisions),
|
|
132
|
+
counters: { ...this.engine.store.counters },
|
|
133
|
+
nextDecision: this.engine.nextDecision,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
restore(snap) {
|
|
137
|
+
this.receipts.splice(0, this.receipts.length, ...snap.receipts);
|
|
138
|
+
this.ledger.restore(snap.settlements);
|
|
139
|
+
this.checkpoints = snap.checkpoints;
|
|
140
|
+
this.engine.store.usedNonces.clear();
|
|
141
|
+
for (const n of snap.usedNonces)
|
|
142
|
+
this.engine.store.usedNonces.add(n);
|
|
143
|
+
this.engine.store.consumedDecisions.clear();
|
|
144
|
+
for (const d of snap.consumedDecisions)
|
|
145
|
+
this.engine.store.consumedDecisions.add(d);
|
|
146
|
+
this.engine.store.counters = { ...snap.counters };
|
|
147
|
+
this.engine.nextDecision = snap.nextDecision;
|
|
148
|
+
}
|
|
149
|
+
settleAndRecord(args, nowMs) {
|
|
61
150
|
const prev = this.receipts.length === 0 ? null : receiptHash(this.receipts[this.receipts.length - 1]);
|
|
62
151
|
const result = gatedSettleWithLedger(this.engine, {
|
|
63
152
|
req: {
|
|
@@ -85,6 +174,10 @@ export class CedulonSession {
|
|
|
85
174
|
receipts: this.receipts,
|
|
86
175
|
checkpoints: this.checkpoints,
|
|
87
176
|
settlements,
|
|
177
|
+
trust: args.trust,
|
|
178
|
+
issuerTrust: args.issuerTrust,
|
|
179
|
+
witnessTrust: args.witnessTrust,
|
|
180
|
+
payeeTrust: args.payeeTrust,
|
|
88
181
|
});
|
|
89
182
|
}
|
|
90
183
|
status() {
|
|
@@ -93,8 +186,220 @@ export class CedulonSession {
|
|
|
93
186
|
policy: policyDocument(this.engine.policy),
|
|
94
187
|
receiptCount: this.receipts.length,
|
|
95
188
|
chainHead: this.receipts.length === 0 ? null : receiptHash(this.receipts[this.receipts.length - 1]),
|
|
189
|
+
stateProtection: this.stateProtection(),
|
|
96
190
|
};
|
|
97
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Said out loud rather than left to be inferred from the absence of an error:
|
|
194
|
+
* a server that writes a private key to disk has to report which protection it
|
|
195
|
+
* actually got.
|
|
196
|
+
*/
|
|
197
|
+
stateProtection() {
|
|
198
|
+
if (!this.statePath) {
|
|
199
|
+
return "in-memory";
|
|
200
|
+
}
|
|
201
|
+
let file;
|
|
202
|
+
try {
|
|
203
|
+
// Read back off the file rather than inferred from process.platform. A
|
|
204
|
+
// mount that ignores POSIX modes - a Windows drive seen from WSL, some
|
|
205
|
+
// network shares - accepts the call and leaves the file world-readable,
|
|
206
|
+
// and the claim would have been wrong in exactly the case that matters.
|
|
207
|
+
file = statSync(this.statePath);
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
// "There is no file" is a different fact from "the file has no
|
|
211
|
+
// protection", and an operator acting on the second would be chasing a
|
|
212
|
+
// permission problem that does not exist.
|
|
213
|
+
return "absent";
|
|
214
|
+
}
|
|
215
|
+
if ((file.mode & 0o777) !== 0o600) {
|
|
216
|
+
return "unprotected-on-this-platform";
|
|
217
|
+
}
|
|
218
|
+
// Mode 0600 says who can open the file, and the parent says who can replace
|
|
219
|
+
// it - but a grandparent anyone can write lets the parent itself be renamed
|
|
220
|
+
// away, key and all, with a decoy left in its place. So walk up: every
|
|
221
|
+
// directory on the path has to be closed to others, or sticky, which is what
|
|
222
|
+
// makes a shared /tmp safe against exactly that rename.
|
|
223
|
+
let dir = dirname(this.statePath);
|
|
224
|
+
for (;;) {
|
|
225
|
+
let entry;
|
|
226
|
+
try {
|
|
227
|
+
entry = statSync(dir);
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
return "unprotected-on-this-platform";
|
|
231
|
+
}
|
|
232
|
+
const openToOthers = (entry.mode & 0o022) !== 0;
|
|
233
|
+
const sticky = (entry.mode & 0o1000) !== 0;
|
|
234
|
+
if (openToOthers && !sticky) {
|
|
235
|
+
return "unprotected-on-this-platform";
|
|
236
|
+
}
|
|
237
|
+
const parent = dirname(dir);
|
|
238
|
+
if (parent === dir) {
|
|
239
|
+
return "owner-only";
|
|
240
|
+
}
|
|
241
|
+
dir = parent;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* A path checked once at startup is a path an attacker can replace afterwards,
|
|
246
|
+
* and the directories were never checked at all. Anything symlinked on the way
|
|
247
|
+
* lets whoever placed the link choose where the private key lands.
|
|
248
|
+
*/
|
|
249
|
+
assertNoSymlink() {
|
|
250
|
+
if (!this.statePath) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const seen = [];
|
|
254
|
+
let node = this.statePath;
|
|
255
|
+
for (;;) {
|
|
256
|
+
seen.push(node);
|
|
257
|
+
const parent = dirname(node);
|
|
258
|
+
if (parent === node) {
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
node = parent;
|
|
262
|
+
}
|
|
263
|
+
for (const path of seen) {
|
|
264
|
+
try {
|
|
265
|
+
if (lstatSync(path).isSymbolicLink()) {
|
|
266
|
+
throw new Error("cedulon-state-symlink");
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
catch (err) {
|
|
270
|
+
if (err?.code === "ENOENT") {
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
throw err;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Reading the fingerprint and then writing leaves a window: two servers that
|
|
279
|
+
* both read before either wrote each saw an unchanged file, and one receipt
|
|
280
|
+
* disappeared with both sides reporting success. An exclusive create is the
|
|
281
|
+
* cheapest thing that actually closes it. A lock whose holder is gone is taken
|
|
282
|
+
* over rather than obeyed forever.
|
|
283
|
+
*/
|
|
284
|
+
withStateLock(run) {
|
|
285
|
+
if (!this.statePath || this.lockDepth > 0) {
|
|
286
|
+
// Already held by an outer call - settling and saving happen under one
|
|
287
|
+
// lock, so the payment and the record it needs cannot be separated.
|
|
288
|
+
this.lockDepth += 1;
|
|
289
|
+
try {
|
|
290
|
+
return run();
|
|
291
|
+
}
|
|
292
|
+
finally {
|
|
293
|
+
this.lockDepth -= 1;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
// The lock now guards the whole settle-and-save, which can run before the
|
|
297
|
+
// state file has ever been written, so its directory has to exist first.
|
|
298
|
+
mkdirSync(dirname(this.statePath), { recursive: true, mode: 0o700 });
|
|
299
|
+
const lockPath = `${this.statePath}.lock`;
|
|
300
|
+
// The lock path decides where a file gets created just as the state path
|
|
301
|
+
// does, so it is guarded the same way.
|
|
302
|
+
try {
|
|
303
|
+
if (lstatSync(lockPath).isSymbolicLink()) {
|
|
304
|
+
throw new Error("cedulon-state-symlink");
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
catch (err) {
|
|
308
|
+
if (err?.code !== "ENOENT") {
|
|
309
|
+
throw err;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
this.sweepStaleTemp();
|
|
313
|
+
const claim = () => writeFileSync(lockPath, JSON.stringify({ pid: process.pid }), { flag: "wx", mode: 0o600 });
|
|
314
|
+
try {
|
|
315
|
+
claim();
|
|
316
|
+
}
|
|
317
|
+
catch (err) {
|
|
318
|
+
if (err?.code !== "EEXIST") {
|
|
319
|
+
throw err;
|
|
320
|
+
}
|
|
321
|
+
if (!this.lockHolderIsGone(lockPath)) {
|
|
322
|
+
throw new Error(`cedulon-state-locked:${this.lockHolderPid(lockPath) ?? "unknown"}`);
|
|
323
|
+
}
|
|
324
|
+
rmSync(lockPath, { force: true });
|
|
325
|
+
claim();
|
|
326
|
+
}
|
|
327
|
+
this.lockDepth += 1;
|
|
328
|
+
try {
|
|
329
|
+
return run();
|
|
330
|
+
}
|
|
331
|
+
finally {
|
|
332
|
+
this.lockDepth -= 1;
|
|
333
|
+
rmSync(lockPath, { force: true });
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
lockHolderPid(lockPath) {
|
|
337
|
+
try {
|
|
338
|
+
const pid = JSON.parse(readFileSync(lockPath, "utf8")).pid;
|
|
339
|
+
return typeof pid === "number" ? pid : null;
|
|
340
|
+
}
|
|
341
|
+
catch {
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* A temp file from a write that never finished still holds the signing key in
|
|
347
|
+
* the clear. The writer that left it is gone; nothing else is going to clean
|
|
348
|
+
* it up.
|
|
349
|
+
*/
|
|
350
|
+
sweepStaleTemp() {
|
|
351
|
+
if (!this.statePath) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const dir = dirname(this.statePath);
|
|
355
|
+
const prefix = `.${basename(this.statePath)}.`;
|
|
356
|
+
let entries;
|
|
357
|
+
try {
|
|
358
|
+
entries = readdirSync(dir);
|
|
359
|
+
}
|
|
360
|
+
catch {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
for (const entry of entries) {
|
|
364
|
+
if (!entry.startsWith(prefix) || !entry.endsWith(".tmp")) {
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
const pid = Number(entry.slice(prefix.length, -".tmp".length));
|
|
368
|
+
if (Number.isFinite(pid) && pid !== process.pid && !this.pidIsGone(pid)) {
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
rmSync(join(dir, entry), { force: true });
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
pidIsGone(pid) {
|
|
375
|
+
try {
|
|
376
|
+
process.kill(pid, 0);
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
catch (err) {
|
|
380
|
+
return err?.code !== "EPERM";
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
lockHolderIsGone(lockPath) {
|
|
384
|
+
let pid;
|
|
385
|
+
try {
|
|
386
|
+
pid = JSON.parse(readFileSync(lockPath, "utf8")).pid;
|
|
387
|
+
}
|
|
388
|
+
catch {
|
|
389
|
+
// A lock we cannot read says nothing about who holds it.
|
|
390
|
+
return true;
|
|
391
|
+
}
|
|
392
|
+
if (typeof pid !== "number" || pid === process.pid) {
|
|
393
|
+
return true;
|
|
394
|
+
}
|
|
395
|
+
try {
|
|
396
|
+
process.kill(pid, 0);
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
catch (err) {
|
|
400
|
+
return err?.code !== "EPERM";
|
|
401
|
+
}
|
|
402
|
+
}
|
|
98
403
|
exportLedger() {
|
|
99
404
|
const report = this.audit();
|
|
100
405
|
const gap = report.findings.find((f) => f.code === "settlement-without-receipt");
|
|
@@ -129,14 +434,35 @@ export class CedulonSession {
|
|
|
129
434
|
warnings: report.warnings,
|
|
130
435
|
};
|
|
131
436
|
}
|
|
437
|
+
/**
|
|
438
|
+
* `expectIssuerKeyPem` / `expectPayeeKeyPem` are the keys the caller already
|
|
439
|
+
* holds. Without them this answers whether the receipt is internally
|
|
440
|
+
* consistent, which any minted key satisfies - so the answer says which
|
|
441
|
+
* question it answered rather than letting the caller assume the stronger one.
|
|
442
|
+
*/
|
|
132
443
|
verify(args) {
|
|
133
444
|
const signed = receiptFromArgs(args);
|
|
134
|
-
const receiptOk = verifyReceipt(signed);
|
|
445
|
+
const receiptOk = verifyReceipt(signed, args.expectIssuerKeyPem);
|
|
446
|
+
// Two questions, so two answers. One flag read as "nothing was checked"
|
|
447
|
+
// whenever either key was missing, including when the issuer had been.
|
|
448
|
+
const issuerCheckedAgainstSuppliedKey = args.expectIssuerKeyPem !== undefined;
|
|
135
449
|
if (!signed.counterCoseHex) {
|
|
136
|
-
return {
|
|
450
|
+
return {
|
|
451
|
+
ok: receiptOk,
|
|
452
|
+
receipt: receiptOk,
|
|
453
|
+
countersignature: null,
|
|
454
|
+
issuerCheckedAgainstSuppliedKey,
|
|
455
|
+
payeeCheckedAgainstSuppliedKey: null,
|
|
456
|
+
};
|
|
137
457
|
}
|
|
138
|
-
const counterOk = verifyCounterSignature(signed);
|
|
139
|
-
return {
|
|
458
|
+
const counterOk = verifyCounterSignature(signed, args.expectPayeeKeyPem);
|
|
459
|
+
return {
|
|
460
|
+
ok: receiptOk && counterOk,
|
|
461
|
+
receipt: receiptOk,
|
|
462
|
+
countersignature: counterOk,
|
|
463
|
+
issuerCheckedAgainstSuppliedKey,
|
|
464
|
+
payeeCheckedAgainstSuppliedKey: args.expectPayeeKeyPem !== undefined,
|
|
465
|
+
};
|
|
140
466
|
}
|
|
141
467
|
rebuildCheckpoint(nowMs) {
|
|
142
468
|
if (this.receipts.length === 0) {
|
|
@@ -161,7 +487,15 @@ export class CedulonSession {
|
|
|
161
487
|
catch {
|
|
162
488
|
return;
|
|
163
489
|
}
|
|
164
|
-
|
|
490
|
+
let parsed;
|
|
491
|
+
try {
|
|
492
|
+
parsed = JSON.parse(raw);
|
|
493
|
+
}
|
|
494
|
+
catch {
|
|
495
|
+
// A file that does not parse is not an empty ledger. Starting from zero
|
|
496
|
+
// here would quietly drop every receipt the state was holding.
|
|
497
|
+
throw new Error("cedulon-state-unreadable");
|
|
498
|
+
}
|
|
165
499
|
if (parsed.version !== 1) {
|
|
166
500
|
throw new Error("cedulon-state-version");
|
|
167
501
|
}
|
|
@@ -204,8 +538,59 @@ export class CedulonSession {
|
|
|
204
538
|
allowedSum: this.engine.store.counters.allowedSum.toString(),
|
|
205
539
|
},
|
|
206
540
|
};
|
|
207
|
-
|
|
208
|
-
|
|
541
|
+
// The receipt private key is in this payload in the clear: there is no
|
|
542
|
+
// secret to encrypt it with here, so the file mode is the whole protection.
|
|
543
|
+
// And writeFileSync truncates before it writes - a crash in between leaves a
|
|
544
|
+
// short file that the next start would read as the whole ledger. Write to a
|
|
545
|
+
// temporary name in the same directory, then rename: on POSIX and on NTFS
|
|
546
|
+
// the swap is atomic, so a reader sees the old file or the new one.
|
|
547
|
+
const dir = dirname(this.statePath);
|
|
548
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
549
|
+
this.assertNoSymlink();
|
|
550
|
+
this.writeLocked(dir, payload);
|
|
551
|
+
}
|
|
552
|
+
writeLocked(dir, payload) {
|
|
553
|
+
if (!this.statePath) {
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
this.withStateLock(() => {
|
|
557
|
+
// Atomic writes stop a torn file; they do not stop a lost one. Two servers
|
|
558
|
+
// sharing a state path both load it, both append, and the later rename
|
|
559
|
+
// wins - the other one's receipt is simply gone. Comparing under the lock
|
|
560
|
+
// turns that into a loud stop.
|
|
561
|
+
const current = this.readStateFingerprint();
|
|
562
|
+
if (current !== this.lastSeenState) {
|
|
563
|
+
throw new Error("cedulon-state-conflict");
|
|
564
|
+
}
|
|
565
|
+
this.writeState(dir, payload);
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
writeState(dir, payload) {
|
|
569
|
+
if (!this.statePath) {
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
const tmp = join(dir, `.${basename(this.statePath)}.${process.pid}.tmp`);
|
|
573
|
+
writeFileSync(tmp, `${JSON.stringify(payload)}\n`, { mode: 0o600 });
|
|
574
|
+
try {
|
|
575
|
+
renameSync(tmp, this.statePath);
|
|
576
|
+
}
|
|
577
|
+
catch (err) {
|
|
578
|
+
rmSync(tmp, { force: true });
|
|
579
|
+
throw err;
|
|
580
|
+
}
|
|
581
|
+
this.lastSeenState = this.readStateFingerprint();
|
|
582
|
+
}
|
|
583
|
+
/** What the state file looked like the last time this session agreed with it. */
|
|
584
|
+
readStateFingerprint() {
|
|
585
|
+
if (!this.statePath) {
|
|
586
|
+
return null;
|
|
587
|
+
}
|
|
588
|
+
try {
|
|
589
|
+
return createHash("sha256").update(readFileSync(this.statePath)).digest("hex");
|
|
590
|
+
}
|
|
591
|
+
catch {
|
|
592
|
+
return null;
|
|
593
|
+
}
|
|
209
594
|
}
|
|
210
595
|
}
|
|
211
596
|
export function receiptFromArgs(args) {
|
package/dist/session.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAgB,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,cAAc,GAEf,M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C;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAC3C,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;IACrD,IAAI,CAAC,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;IACzD,OAAO;QACL,MAAM,EAAE,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC;QACnC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QACxD,YAAY;QACZ,QAAQ,EAAE,MAAM;QAChB,OAAO;QACP,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;KAC1C,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedulon/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"mcpName": "io.github.dogrucanemek-alt/cedulon",
|
|
5
5
|
"description": "Local stdio MCP server for policy-gated Cedulon spend and audit.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@cedulon/audit": "^0.
|
|
48
|
-
"@cedulon/checkpoint": "^0.
|
|
49
|
-
"@cedulon/core": "^0.
|
|
50
|
-
"@cedulon/cose": "^0.
|
|
51
|
-
"@cedulon/receipts": "^0.
|
|
52
|
-
"@cedulon/x402-adapter": "^0.
|
|
47
|
+
"@cedulon/audit": "^0.3.0",
|
|
48
|
+
"@cedulon/checkpoint": "^0.3.0",
|
|
49
|
+
"@cedulon/core": "^0.3.0",
|
|
50
|
+
"@cedulon/cose": "^0.3.0",
|
|
51
|
+
"@cedulon/receipts": "^0.3.0",
|
|
52
|
+
"@cedulon/x402-adapter": "^0.3.0",
|
|
53
53
|
"@modelcontextprotocol/sdk": "^1.30.0"
|
|
54
54
|
}
|
|
55
55
|
}
|