@sentropic/h2a 0.98.4 → 0.98.6
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/runtime/drive/consent.d.ts +1 -1
- package/dist/runtime/drive/consent.d.ts.map +1 -1
- package/dist/runtime/drive/consent.js +2 -2
- package/dist/runtime/drive/consent.js.map +1 -1
- package/dist/runtime/drive/index.d.ts +1 -1
- package/dist/runtime/drive/index.d.ts.map +1 -1
- package/dist/runtime/drive/index.js +3 -1
- package/dist/runtime/drive/index.js.map +1 -1
- package/dist/runtime/drumbeat/relaunchers.d.ts +1 -1
- package/dist/runtime/drumbeat/relaunchers.d.ts.map +1 -1
- package/dist/runtime/drumbeat/relaunchers.js +2 -1
- package/dist/runtime/drumbeat/relaunchers.js.map +1 -1
- package/dist/runtime/identity/binding-commit.d.ts +31 -0
- package/dist/runtime/identity/binding-commit.d.ts.map +1 -0
- package/dist/runtime/identity/binding-commit.js +211 -0
- package/dist/runtime/identity/binding-commit.js.map +1 -0
- package/dist/runtime/identity/bindings.d.ts +6 -30
- package/dist/runtime/identity/bindings.d.ts.map +1 -1
- package/dist/runtime/identity/bindings.js +85 -96
- package/dist/runtime/identity/bindings.js.map +1 -1
- package/dist/runtime/identity/durable.d.ts +7 -0
- package/dist/runtime/identity/durable.d.ts.map +1 -0
- package/dist/runtime/identity/durable.js +68 -0
- package/dist/runtime/identity/durable.js.map +1 -0
- package/dist/runtime/identity/live.d.ts +4 -1
- package/dist/runtime/identity/live.d.ts.map +1 -1
- package/dist/runtime/identity/live.js +59 -6
- package/dist/runtime/identity/live.js.map +1 -1
- package/dist/runtime/identity/possession.d.ts +34 -0
- package/dist/runtime/identity/possession.d.ts.map +1 -0
- package/dist/runtime/identity/possession.js +162 -0
- package/dist/runtime/identity/possession.js.map +1 -0
- package/dist/runtime/identity/worker.js +16 -5
- package/dist/runtime/identity/worker.js.map +1 -1
- package/dist/runtime/local-files/identity-fence.d.ts +164 -0
- package/dist/runtime/local-files/identity-fence.d.ts.map +1 -0
- package/dist/runtime/local-files/identity-fence.js +1336 -0
- package/dist/runtime/local-files/identity-fence.js.map +1 -0
- package/dist/runtime/local-files/index.d.ts +1 -0
- package/dist/runtime/local-files/index.d.ts.map +1 -1
- package/dist/runtime/local-files/index.js +1 -0
- package/dist/runtime/local-files/index.js.map +1 -1
- package/dist/runtime/local-files/legacy-identity-evidence.d.ts +26 -0
- package/dist/runtime/local-files/legacy-identity-evidence.d.ts.map +1 -0
- package/dist/runtime/local-files/legacy-identity-evidence.js +234 -0
- package/dist/runtime/local-files/legacy-identity-evidence.js.map +1 -0
- package/dist/runtime/local-files/locks.d.ts +3 -0
- package/dist/runtime/local-files/locks.d.ts.map +1 -1
- package/dist/runtime/local-files/locks.js +6 -5
- package/dist/runtime/local-files/locks.js.map +1 -1
- package/dist/runtime/local-files/store.d.ts +1 -1
- package/dist/runtime/local-files/store.d.ts.map +1 -1
- package/dist/runtime/local-files/store.js +12 -1
- package/dist/runtime/local-files/store.js.map +1 -1
- package/dist/runtime/local-files/succession-lock.d.ts +71 -6
- package/dist/runtime/local-files/succession-lock.d.ts.map +1 -1
- package/dist/runtime/local-files/succession-lock.js +226 -31
- package/dist/runtime/local-files/succession-lock.js.map +1 -1
- package/dist/runtime/mcp/identity-blocker-snapshot.d.ts +2 -0
- package/dist/runtime/mcp/identity-blocker-snapshot.d.ts.map +1 -0
- package/dist/runtime/mcp/identity-blocker-snapshot.js +98 -0
- package/dist/runtime/mcp/identity-blocker-snapshot.js.map +1 -0
- package/dist/runtime/mcp/identity-state.d.ts +20 -3
- package/dist/runtime/mcp/identity-state.d.ts.map +1 -1
- package/dist/runtime/mcp/identity-state.js +98 -13
- package/dist/runtime/mcp/identity-state.js.map +1 -1
- package/dist/runtime/mcp/server.d.ts.map +1 -1
- package/dist/runtime/mcp/server.js +12 -9
- package/dist/runtime/mcp/server.js.map +1 -1
- package/dist/runtime/remote/client.d.ts +1 -1
- package/dist/runtime/remote/client.d.ts.map +1 -1
- package/dist/runtime/remote/client.js +1 -1
- package/dist/runtime/remote/client.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { closeSync, existsSync, fsyncSync, linkSync, openSync, readFileSync, readdirSync, statSync, unlinkSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { BindingCommitIntegrityError, BindingCommitConflictError, BindingFenceStaleError, digestBytes, preparePossession, receiptMatches, withPossession, isPreparedPossession } from './possession.js';
|
|
4
|
+
import { appendDurable, ensureDurableDirectory, syncDirectory, syncFile, writeComplete } from './durable.js';
|
|
5
|
+
export const bindingKeyHash = (host, providerSessionId) => digestBytes(`${host}\0${providerSessionId}`).slice(0, 32);
|
|
6
|
+
export const bindingLineId = (line) => digestBytes(line);
|
|
7
|
+
const journal = (dir) => join(dir, 'bindings.jsonl');
|
|
8
|
+
function lines(dir) {
|
|
9
|
+
if (!existsSync(journal(dir)))
|
|
10
|
+
return [];
|
|
11
|
+
const bytes = readFileSync(journal(dir), 'utf8');
|
|
12
|
+
return [...new Set(bytes.slice(0, bytes.lastIndexOf('\n') + 1).split('\n').filter(Boolean).map(line => line + '\n'))];
|
|
13
|
+
}
|
|
14
|
+
function keyOf(line) {
|
|
15
|
+
try {
|
|
16
|
+
const row = JSON.parse(line);
|
|
17
|
+
return typeof row.host === 'string' && typeof row.providerSessionId === 'string' ? bindingKeyHash(row.host, row.providerSessionId) : undefined;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function latest(dir, host, providerSessionId) {
|
|
24
|
+
return lines(dir).filter(line => { try {
|
|
25
|
+
const row = JSON.parse(line);
|
|
26
|
+
return row.host === host && row.providerSessionId === providerSessionId;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
} }).map(bindingLineId).at(-1) ?? 'genesis';
|
|
31
|
+
}
|
|
32
|
+
function requireHeld(held) {
|
|
33
|
+
if (!held())
|
|
34
|
+
throw new BindingCommitIntegrityError('fence changed during protected mutation');
|
|
35
|
+
}
|
|
36
|
+
/** A pending winner is prepared before acquiring the fence; it forbids remint. */
|
|
37
|
+
export function pendingBindingWinner(dir, kh) {
|
|
38
|
+
const commits = join(dir, 'commits');
|
|
39
|
+
if (!existsSync(commits))
|
|
40
|
+
return undefined;
|
|
41
|
+
const candidates = readdirSync(commits).filter(name => name.startsWith(kh + '.') && name.endsWith('.json'));
|
|
42
|
+
if (!candidates.length)
|
|
43
|
+
return undefined;
|
|
44
|
+
const complete = new Set(lines(dir).map(bindingLineId));
|
|
45
|
+
const slots = candidates.map(name => {
|
|
46
|
+
try {
|
|
47
|
+
const slot = JSON.parse(readFileSync(join(commits, name), 'utf8'));
|
|
48
|
+
if (slot.kh !== kh || !slot.line.endsWith('\n') || bindingLineId(slot.line) !== slot.lineId)
|
|
49
|
+
throw new Error();
|
|
50
|
+
return slot;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
throw new BindingCommitIntegrityError('pending winner incomplete or incoherent');
|
|
54
|
+
}
|
|
55
|
+
}).filter(slot => !complete.has(slot.lineId));
|
|
56
|
+
if (!slots.length)
|
|
57
|
+
return undefined;
|
|
58
|
+
const tip = slots.find(slot => !slots.some(next => next.pred === slot.lineId));
|
|
59
|
+
if (!tip)
|
|
60
|
+
throw new BindingCommitIntegrityError('pending winner chain cyclic');
|
|
61
|
+
return JSON.parse(tip.line);
|
|
62
|
+
}
|
|
63
|
+
/** Cold possession preparation happens before election/normal possession. */
|
|
64
|
+
export function prepareBindingSlots(dir) {
|
|
65
|
+
const commits = join(dir, 'commits');
|
|
66
|
+
const prepared = new Map();
|
|
67
|
+
if (!existsSync(commits))
|
|
68
|
+
return prepared;
|
|
69
|
+
for (const name of readdirSync(commits)) {
|
|
70
|
+
if (!name.endsWith('.json') || name.includes('.tmp.'))
|
|
71
|
+
continue;
|
|
72
|
+
const bytes = readFileSync(join(commits, name));
|
|
73
|
+
let receipt;
|
|
74
|
+
try {
|
|
75
|
+
const slot = JSON.parse(bytes.toString());
|
|
76
|
+
const row = JSON.parse(slot.line);
|
|
77
|
+
if (slot.proof?.instance === row.instance && receiptMatches(dirname(dir), slot.proof, true))
|
|
78
|
+
receipt = preparePossession(dirname(dir), row.instance);
|
|
79
|
+
}
|
|
80
|
+
catch (e) {
|
|
81
|
+
if (e.code)
|
|
82
|
+
throw e;
|
|
83
|
+
}
|
|
84
|
+
prepared.set(name, { sha256: digestBytes(bytes), ...(receipt ? { receipt } : {}) });
|
|
85
|
+
}
|
|
86
|
+
return prepared;
|
|
87
|
+
}
|
|
88
|
+
export function repairBindingSlots(dir, held, prepared) {
|
|
89
|
+
const commits = join(dir, 'commits');
|
|
90
|
+
if (!existsSync(commits))
|
|
91
|
+
return;
|
|
92
|
+
const pending = [];
|
|
93
|
+
for (const name of readdirSync(commits)) {
|
|
94
|
+
if (name.includes('.tmp.'))
|
|
95
|
+
continue;
|
|
96
|
+
if (!/^[0-9a-f]{32}\.(genesis|[0-9a-f]{64})\.json$/.test(name))
|
|
97
|
+
throw new BindingCommitIntegrityError('unsupported slot name');
|
|
98
|
+
let slot;
|
|
99
|
+
const bytes = readFileSync(join(commits, name));
|
|
100
|
+
const preparation = prepared.get(name);
|
|
101
|
+
if (!preparation || preparation.sha256 !== digestBytes(bytes))
|
|
102
|
+
throw new BindingFenceStaleError();
|
|
103
|
+
try {
|
|
104
|
+
slot = JSON.parse(bytes.toString());
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
throw new BindingCommitIntegrityError('incomplete slot');
|
|
108
|
+
}
|
|
109
|
+
if (!slot || slot.version !== 1 || typeof slot.line !== 'string' || !slot.line.endsWith('\n') || slot.line.slice(0, -1).includes('\n')
|
|
110
|
+
|| keyOf(slot.line) !== slot.kh || bindingLineId(slot.line) !== slot.lineId || name !== `${slot.kh}.${slot.pred}.json`
|
|
111
|
+
|| !/^[0-9a-f]{32}$/.test(slot.fenceEpoch))
|
|
112
|
+
throw new BindingCommitIntegrityError('incoherent slot content or predecessor');
|
|
113
|
+
const row = JSON.parse(slot.line);
|
|
114
|
+
if (!slot.proof || slot.proof.instance !== row.instance || !preparation.receipt || !isPreparedPossession(preparation.receipt))
|
|
115
|
+
throw new BindingCommitIntegrityError('slot possession proof missing');
|
|
116
|
+
if (!receiptMatches(dirname(dir), preparation.receipt))
|
|
117
|
+
throw new BindingFenceStaleError();
|
|
118
|
+
syncFile(join(commits, name));
|
|
119
|
+
pending.push(slot);
|
|
120
|
+
}
|
|
121
|
+
const complete = new Set(lines(dir).map(bindingLineId));
|
|
122
|
+
const byKey = new Map();
|
|
123
|
+
for (const line of lines(dir)) {
|
|
124
|
+
const kh = keyOf(line);
|
|
125
|
+
if (kh) {
|
|
126
|
+
const ids = byKey.get(kh) ?? new Set();
|
|
127
|
+
ids.add(bindingLineId(line));
|
|
128
|
+
byKey.set(kh, ids);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
while (pending.length) {
|
|
132
|
+
const i = pending.findIndex(slot => slot.pred === 'genesis' || byKey.get(slot.kh)?.has(slot.pred));
|
|
133
|
+
if (i < 0)
|
|
134
|
+
throw new BindingCommitIntegrityError('slot predecessor missing or cyclic');
|
|
135
|
+
const [slot] = pending.splice(i, 1);
|
|
136
|
+
if (!complete.has(slot.lineId)) {
|
|
137
|
+
requireHeld(held);
|
|
138
|
+
appendDurable(journal(dir), slot.line, held);
|
|
139
|
+
complete.add(slot.lineId);
|
|
140
|
+
}
|
|
141
|
+
else
|
|
142
|
+
syncFile(journal(dir));
|
|
143
|
+
const ids = byKey.get(slot.kh) ?? new Set();
|
|
144
|
+
ids.add(slot.lineId);
|
|
145
|
+
byKey.set(slot.kh, ids);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
export function commitBinding(dir, row, fenceEpoch, proof, held, beginMutation, endMutation) {
|
|
149
|
+
const kh = bindingKeyHash(row.host, row.providerSessionId);
|
|
150
|
+
const pred = latest(dir, row.host, row.providerSessionId);
|
|
151
|
+
const line = JSON.stringify(row) + '\n';
|
|
152
|
+
const slot = { version: 1, kh, pred, fenceEpoch, line, lineId: bindingLineId(line), proof };
|
|
153
|
+
const commits = join(dir, 'commits');
|
|
154
|
+
withPossession(dirname(dir), proof, () => {
|
|
155
|
+
requireHeld(held);
|
|
156
|
+
beginMutation();
|
|
157
|
+
ensureDurableDirectory(commits);
|
|
158
|
+
const path = join(commits, `${kh}.${pred}.json`);
|
|
159
|
+
if (existsSync(path))
|
|
160
|
+
throw new BindingCommitConflictError();
|
|
161
|
+
const tmp = `${path}.tmp.${fenceEpoch}`;
|
|
162
|
+
const fd = openSync(tmp, 'wx', 0o600);
|
|
163
|
+
try {
|
|
164
|
+
writeComplete(fd, JSON.stringify(slot));
|
|
165
|
+
fsyncSync(fd);
|
|
166
|
+
}
|
|
167
|
+
finally {
|
|
168
|
+
closeSync(fd);
|
|
169
|
+
}
|
|
170
|
+
requireHeld(held);
|
|
171
|
+
try {
|
|
172
|
+
linkSync(tmp, path);
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
const code = e.code;
|
|
176
|
+
if (code === 'EEXIST')
|
|
177
|
+
throw new BindingCommitConflictError();
|
|
178
|
+
if (!['EPERM', 'ENOTSUP', 'EOPNOTSUPP', 'ENOSYS'].includes(code ?? ''))
|
|
179
|
+
throw e;
|
|
180
|
+
// Nominal acquisition remains possible without hard links. A partial
|
|
181
|
+
// fallback slot after a crash fails integrity under the retained barrier.
|
|
182
|
+
requireHeld(held);
|
|
183
|
+
const slotFd = openSync(path, 'wx', 0o600);
|
|
184
|
+
try {
|
|
185
|
+
writeComplete(slotFd, JSON.stringify(slot));
|
|
186
|
+
fsyncSync(slotFd);
|
|
187
|
+
}
|
|
188
|
+
finally {
|
|
189
|
+
closeSync(slotFd);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
syncDirectory(commits);
|
|
193
|
+
requireHeld(held);
|
|
194
|
+
unlinkSync(tmp);
|
|
195
|
+
syncDirectory(commits);
|
|
196
|
+
requireHeld(held);
|
|
197
|
+
appendDurable(journal(dir), line, held);
|
|
198
|
+
// Conditional cleanup is limited to this key's successfully materialized slot.
|
|
199
|
+
const before = statSync(path);
|
|
200
|
+
if (readFileSync(path, 'utf8') !== JSON.stringify(slot))
|
|
201
|
+
throw new BindingCommitIntegrityError('slot changed after append');
|
|
202
|
+
requireHeld(held);
|
|
203
|
+
const current = statSync(path);
|
|
204
|
+
if (before.dev !== current.dev || before.ino !== current.ino)
|
|
205
|
+
throw new BindingCommitIntegrityError('slot replaced after append');
|
|
206
|
+
unlinkSync(path);
|
|
207
|
+
syncDirectory(commits);
|
|
208
|
+
endMutation();
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=binding-commit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding-commit.js","sourceRoot":"","sources":["../../../src/runtime/identity/binding-commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChI,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,oBAAoB,EAA0B,MAAM,iBAAiB,CAAC;AAChO,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,M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IAAI,CAAC,CAAC;QAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,MAAM,CAAC,GAAG,KAAK,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,KAAK,OAAO,CAAC,GAAG;YAAE,MAAM,IAAI,2BAA2B,CAAC,4BAA4B,CAAC,CAAC;QAClI,UAAU,CAAC,IAAI,CAAC,CAAC;QAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACzC,WAAW,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -24,13 +24,15 @@
|
|
|
24
24
|
* identity, not the victim's inbox). The read → decide → append runs in ONE lock
|
|
25
25
|
* (no reclaim/mint race, F3).
|
|
26
26
|
*/
|
|
27
|
-
import {
|
|
27
|
+
import type { IdentityFenceOptions } from "../local-files/identity-fence.js";
|
|
28
|
+
import type { H2ASignature } from "@sentropic/h2a";
|
|
29
|
+
import { IDENTITY_BINDING_FENCE_PROTOCOL } from "../local-files/identity-fence.js";
|
|
28
30
|
/**
|
|
29
31
|
* The one protocol accepted by the DEF identity-binding writer. The cull
|
|
30
32
|
* executor uses the same sentinel and refuses a writer inventory that cannot
|
|
31
33
|
* prove this epoch-bearing protocol for every binding write path.
|
|
32
34
|
*/
|
|
33
|
-
export
|
|
35
|
+
export { IDENTITY_BINDING_FENCE_PROTOCOL };
|
|
34
36
|
export interface H2AIdentityBinding {
|
|
35
37
|
readonly host: string;
|
|
36
38
|
readonly providerSessionId: string;
|
|
@@ -86,38 +88,12 @@ export interface ReclaimOrMintResult {
|
|
|
86
88
|
* binding. Spoofing the id without the key → mint (a new identity), never a
|
|
87
89
|
* reclaim of someone else's.
|
|
88
90
|
*/
|
|
89
|
-
export
|
|
90
|
-
/**
|
|
91
|
-
* L2 options for the ASYNC (MCP identity worker) reclaim/mint transaction.
|
|
92
|
-
*/
|
|
93
|
-
export interface ReclaimOrMintOptions {
|
|
94
|
-
/**
|
|
95
|
-
* Cooperative cancellation (transport closed / signal). When aborted BEFORE the
|
|
96
|
-
* lock is held, the wait stops and the attempt throws; a transaction already
|
|
97
|
-
* entered under the lock finishes so no half-written binding is left.
|
|
98
|
-
*/
|
|
99
|
-
readonly signal?: AbortSignal;
|
|
100
|
-
/** Monotone remaining budget (ms) bounding the lock wait for this attempt. */
|
|
91
|
+
export interface ReclaimOrMintOptions extends IdentityFenceOptions {
|
|
101
92
|
readonly deadlineMs?: number;
|
|
102
|
-
/**
|
|
103
|
-
* Materialize keys / registration / alias BEFORE the binding row is appended
|
|
104
|
-
* (mint path only), all inside the held identity lock. This closes the
|
|
105
|
-
* publish-order window through which a concurrent worker that read the fresh
|
|
106
|
-
* binding — but not yet its keyring — could fail proof-of-possession and mint a
|
|
107
|
-
* DUPLICATE identity. The binding is always the LAST durable write.
|
|
108
|
-
*/
|
|
109
93
|
readonly beforePublish?: (result: ReclaimOrMintResult, heldLocks: {
|
|
110
94
|
readonly identity: true;
|
|
111
95
|
}) => void;
|
|
112
96
|
}
|
|
113
|
-
|
|
114
|
-
* Async twin of {@link reclaimOrMint} used by the L2 identity worker. Identical
|
|
115
|
-
* invariants — proof-of-possession gates reclaim, a fail-closed fence
|
|
116
|
-
* (`reclaimStale:false`) refuses an ambiguous sentinel, `reclaimOrMint*` stays
|
|
117
|
-
* the UNIQUE append of a binding row — but the lock WAIT is asynchronous so the
|
|
118
|
-
* worker can receive an IPC cancel between poll attempts instead of blocking the
|
|
119
|
-
* event loop inside `Atomics.wait`. On a mint, `beforePublish` publishes the
|
|
120
|
-
* keyring/registration/alias before the binding append (window closure, T5).
|
|
121
|
-
*/
|
|
97
|
+
export declare function reclaimOrMint(root: string, key: IdentityBindingKey, deps: ReclaimOrMintDeps, options?: ReclaimOrMintOptions): ReclaimOrMintResult;
|
|
122
98
|
export declare function reclaimOrMintAsync(root: string, key: IdentityBindingKey, deps: ReclaimOrMintDeps, options?: ReclaimOrMintOptions): Promise<ReclaimOrMintResult>;
|
|
123
99
|
//# sourceMappingURL=bindings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../../../src/runtime/identity/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;
|
|
1
|
+
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../../../src/runtime/identity/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AASH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAE7E,OAAO,KAAK,EACV,YAAY,EACb,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EACL,+BAA+B,EAIhC,MAAM,kCAAkC,CAAC;AAG1C;;;;GAIG;AACH,OAAO,EAAE,+BAA+B,EAAE,CAAC;AAE3C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,yFAAyF;IACzF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAYD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAc/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,kBAAkB,GAAG,kBAAkB,GAAG,SAAS,CAUjG;AAED;;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|
|
26
26
|
*/
|
|
27
|
-
import { existsSync,
|
|
28
|
-
import { randomUUID } from "node:crypto";
|
|
27
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
29
28
|
import { join } from "node:path";
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
29
|
+
import { performance } from "node:perf_hooks";
|
|
30
|
+
import { commitBinding, pendingBindingWinner, bindingKeyHash } from "./binding-commit.js";
|
|
31
|
+
import { BindingCommitIntegrityError, BindingFenceStaleError, preparePossession, receiptMatches, withPossession } from "./possession.js";
|
|
32
|
+
import { ensureDurableDirectory } from "./durable.js";
|
|
33
|
+
import { LockTimeoutError } from "../local-files/locks.js";
|
|
34
|
+
import { verifyCanonical } from "../../signature.js";
|
|
35
|
+
import { localStorePaths } from "../local-files/index.js";
|
|
36
|
+
import { IDENTITY_BINDING_FENCE_PROTOCOL, withIdentityFence, withIdentityFenceSync } from "../local-files/identity-fence.js";
|
|
37
|
+
import { launchLookupKey, lookupLaunchRows } from "../local-files/launch-index.js";
|
|
34
38
|
/**
|
|
35
39
|
* The one protocol accepted by the DEF identity-binding writer. The cull
|
|
36
40
|
* executor uses the same sentinel and refuses a writer inventory that cannot
|
|
37
41
|
* prove this epoch-bearing protocol for every binding write path.
|
|
38
42
|
*/
|
|
39
|
-
export
|
|
43
|
+
export { IDENTITY_BINDING_FENCE_PROTOCOL };
|
|
40
44
|
function identityDir(root) {
|
|
41
45
|
return join(localStorePaths(root).root, "identity");
|
|
42
46
|
}
|
|
@@ -51,11 +55,13 @@ export function listBindings(root) {
|
|
|
51
55
|
if (!existsSync(f))
|
|
52
56
|
return [];
|
|
53
57
|
const out = [];
|
|
54
|
-
for (const line of readFileSync(f, "utf8").split("\n")) {
|
|
58
|
+
for (const line of readFileSync(f, "utf8").split("\n").slice(0, -1)) {
|
|
55
59
|
if (!line.trim())
|
|
56
60
|
continue;
|
|
57
61
|
try {
|
|
58
|
-
|
|
62
|
+
const row = JSON.parse(line);
|
|
63
|
+
if (row && typeof row === 'object' && !Array.isArray(row))
|
|
64
|
+
out.push(row);
|
|
59
65
|
}
|
|
60
66
|
catch {
|
|
61
67
|
// skip malformed
|
|
@@ -103,98 +109,81 @@ export function verifyReclaimProof(nonce, signature, publicKeys) {
|
|
|
103
109
|
}
|
|
104
110
|
return false;
|
|
105
111
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
112
|
+
function prepareTransaction(root, key, deps, options, memo) {
|
|
113
|
+
const binding = findBinding(root, key);
|
|
114
|
+
let pending;
|
|
115
|
+
try {
|
|
116
|
+
pending = pendingBindingWinner(identityDir(root), bindingKeyHash(key.host, key.providerSessionId));
|
|
117
|
+
}
|
|
118
|
+
catch (e) {
|
|
119
|
+
if (!(e instanceof BindingCommitIntegrityError))
|
|
120
|
+
throw e;
|
|
121
|
+
return { binding, proof: undefined };
|
|
122
|
+
}
|
|
123
|
+
if (pending) {
|
|
124
|
+
const proof = preparePossession(root, pending.instance);
|
|
125
|
+
if (!proof)
|
|
126
|
+
return { binding: pending, proof: undefined };
|
|
127
|
+
return { binding: pending, proof };
|
|
128
|
+
}
|
|
129
|
+
const proof = binding && deps.verifyProof(binding) ? preparePossession(root, binding.instance) : undefined;
|
|
130
|
+
if (binding && proof)
|
|
131
|
+
return { binding, proof };
|
|
132
|
+
memo.value ??= { action: 'mint', ...deps.mint() };
|
|
133
|
+
options.beforePublish?.(memo.value, { identity: true });
|
|
134
|
+
const mintedProof = preparePossession(root, memo.value.instance);
|
|
135
|
+
if (!mintedProof)
|
|
136
|
+
throw new BindingCommitIntegrityError('binding possession prerequisites missing');
|
|
137
|
+
return { binding, proof: mintedProof };
|
|
138
|
+
}
|
|
139
|
+
function transact(root, key, deps, memo, prepared, lease) {
|
|
140
|
+
if (!prepared.proof)
|
|
141
|
+
throw new BindingFenceStaleError();
|
|
142
|
+
const existing = findBinding(root, key);
|
|
143
|
+
if (existing?.instance !== prepared.binding?.instance || !receiptMatches(root, prepared.proof))
|
|
144
|
+
throw new BindingFenceStaleError();
|
|
145
|
+
if (existing && prepared.proof.instance === existing.instance) {
|
|
146
|
+
return withPossession(root, prepared.proof, () => ({ action: 'reclaim', instance: existing.instance, agentUuid: existing.agentUuid }));
|
|
147
|
+
}
|
|
148
|
+
if (!memo.value)
|
|
149
|
+
throw new BindingCommitIntegrityError('mint candidate unavailable');
|
|
150
|
+
commitBinding(identityDir(root), { ...key, instance: memo.value.instance, agentUuid: memo.value.agentUuid, at: new Date(deps.now()).toISOString() }, lease.token, prepared.proof, lease.stillHeld, lease.beginMutation, lease.endMutation);
|
|
151
|
+
return memo.value;
|
|
152
|
+
}
|
|
153
|
+
export function reclaimOrMint(root, key, deps, options = {}) {
|
|
154
|
+
ensureDurableDirectory(identityDir(root));
|
|
155
|
+
const end = performance.now() + (options.deadlineMs ?? options.timeoutMs ?? 5000);
|
|
156
|
+
const memo = {};
|
|
157
|
+
options = { ...options, signal: options.signal ?? new AbortController().signal };
|
|
158
|
+
for (;;) {
|
|
159
|
+
try {
|
|
160
|
+
const prepared = prepareTransaction(root, key, deps, options, memo);
|
|
161
|
+
return withIdentityFenceSync(bindingsLock(root), lease => transact(root, key, deps, memo, prepared, lease), { ...options, timeoutMs: Math.max(0, end - performance.now()) });
|
|
125
162
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
163
|
+
catch (e) {
|
|
164
|
+
// The short registry wait is one preparation attempt within the original deadline.
|
|
165
|
+
const contention = e instanceof LockTimeoutError && e.lockPath === join(root, "registry", ".lock");
|
|
166
|
+
if ((!(e instanceof BindingFenceStaleError) && !contention) || performance.now() >= end)
|
|
167
|
+
throw e;
|
|
131
168
|
}
|
|
132
|
-
|
|
133
|
-
appendLaunchRow(bindingsFile(root), "bindings", {
|
|
134
|
-
...key, instance: minted.instance, agentUuid: minted.agentUuid,
|
|
135
|
-
at: new Date(deps.now()).toISOString()
|
|
136
|
-
});
|
|
137
|
-
return { action: "mint", instance: minted.instance, agentUuid: minted.agentUuid };
|
|
138
|
-
}, {
|
|
139
|
-
ownerMetadata: {
|
|
140
|
-
protocol: IDENTITY_BINDING_FENCE_PROTOCOL,
|
|
141
|
-
fenceEpoch: randomUUID()
|
|
142
|
-
},
|
|
143
|
-
// A cull fence is fail-closed. Reclaiming an apparently stale sentinel
|
|
144
|
-
// would turn an ambiguous owner/fence state into a concurrent write.
|
|
145
|
-
reclaimStale: false,
|
|
146
|
-
...(observe ? { observe } : {})
|
|
147
|
-
});
|
|
169
|
+
}
|
|
148
170
|
}
|
|
149
|
-
/**
|
|
150
|
-
* Async twin of {@link reclaimOrMint} used by the L2 identity worker. Identical
|
|
151
|
-
* invariants — proof-of-possession gates reclaim, a fail-closed fence
|
|
152
|
-
* (`reclaimStale:false`) refuses an ambiguous sentinel, `reclaimOrMint*` stays
|
|
153
|
-
* the UNIQUE append of a binding row — but the lock WAIT is asynchronous so the
|
|
154
|
-
* worker can receive an IPC cancel between poll attempts instead of blocking the
|
|
155
|
-
* event loop inside `Atomics.wait`. On a mint, `beforePublish` publishes the
|
|
156
|
-
* keyring/registration/alias before the binding append (window closure, T5).
|
|
157
|
-
*/
|
|
158
171
|
export async function reclaimOrMintAsync(root, key, deps, options = {}) {
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
});
|
|
172
|
+
ensureDurableDirectory(identityDir(root));
|
|
173
|
+
const end = performance.now() + (options.deadlineMs ?? options.timeoutMs ?? 5000);
|
|
174
|
+
const memo = {};
|
|
175
|
+
options = { ...options, signal: options.signal ?? new AbortController().signal };
|
|
176
|
+
for (;;) {
|
|
177
|
+
try {
|
|
178
|
+
const prepared = prepareTransaction(root, key, deps, options, memo);
|
|
179
|
+
return await withIdentityFence(bindingsLock(root), lease => transact(root, key, deps, memo, prepared, lease), { ...options, timeoutMs: Math.max(0, end - performance.now()) });
|
|
168
180
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
181
|
+
catch (e) {
|
|
182
|
+
const contention = e instanceof LockTimeoutError && e.lockPath === join(root, "registry", ".lock");
|
|
183
|
+
if ((!(e instanceof BindingFenceStaleError) && !contention) || performance.now() >= end)
|
|
184
|
+
throw e;
|
|
185
|
+
await new Promise(r => setTimeout(r, 0));
|
|
174
186
|
}
|
|
175
|
-
|
|
176
|
-
const result = {
|
|
177
|
-
action: "mint",
|
|
178
|
-
instance: minted.instance,
|
|
179
|
-
agentUuid: minted.agentUuid
|
|
180
|
-
};
|
|
181
|
-
// Publish keys / registration / alias BEFORE the binding row so no reader
|
|
182
|
-
// can observe a binding whose keyring is not yet provable.
|
|
183
|
-
options.beforePublish?.(result, { identity: true });
|
|
184
|
-
appendLaunchRow(bindingsFile(root), "bindings", {
|
|
185
|
-
...key, instance: minted.instance, agentUuid: minted.agentUuid,
|
|
186
|
-
at: new Date(deps.now()).toISOString()
|
|
187
|
-
});
|
|
188
|
-
return result;
|
|
189
|
-
}, {
|
|
190
|
-
ownerMetadata: {
|
|
191
|
-
protocol: IDENTITY_BINDING_FENCE_PROTOCOL,
|
|
192
|
-
fenceEpoch: randomUUID()
|
|
193
|
-
},
|
|
194
|
-
reclaimStale: false,
|
|
195
|
-
...(options.signal ? { signal: options.signal } : {}),
|
|
196
|
-
...(options.deadlineMs !== undefined ? { timeoutMs: options.deadlineMs } : {}),
|
|
197
|
-
...(observe ? { observe } : {})
|
|
198
|
-
});
|
|
187
|
+
}
|
|
199
188
|
}
|
|
200
189
|
//# sourceMappingURL=bindings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../../../src/runtime/identity/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"bindings.js","sourceRoot":"","sources":["../../../src/runtime/identity/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAE,2BAA2B,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACzI,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAM3D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EACjB,qBAAqB,EAEtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAEnF;;;;GAIG;AACH,OAAO,EAAE,+BAA+B,EAAE,CAAC;AAmB3C,SAAS,WAAW,CAAC,IAAY;IAC/B,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AACtD,CAAC;AACD,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,IAAI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,IAAI,GAAkC,EAAE,CAAC;IAC/C,OAAO,GAAC,EAAC,GAAG,OAAO,EAAC,MAAM,EAAC,OAAO,CAAC,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC,MAAM,EAAC,CAAC;IAC3E,SAAS,CAAC;QACR,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,kBAAkB,CAAC,IAAI,EAAC,GAAG,EAAC,IAAI,EAAC,OAAO,EAAC,IAAI,CAAC,CAAC;YAChE,OAAO,MAAM,iBAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAC,GAAG,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,CAAC,EACvG,EAAC,GAAG,OAAO,EAAE,SAAS,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAC,GAAG,GAAC,WAAW,CAAC,GAAG,EAAE,CAAC,EAAC,CAAC,CAAC;QAAC,CAAC;QAC/D,OAAM,CAAC,EAAE,CAAC;YACR,MAAM,UAAU,GAAG,CAAC,YAAY,gBAAgB,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;YACnG,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,sBAAsB,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,WAAW,CAAC,GAAG,EAAE,IAAI,GAAG;gBAAE,MAAM,CAAC,CAAC;YACjG,MAAM,IAAI,OAAO,CAAC,CAAC,CAAA,EAAE,CAAA,UAAU,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function redactIdentityStorageError(error: unknown): unknown;
|
|
2
|
+
export declare function syncDirectory(dir: string): void;
|
|
3
|
+
export declare function ensureDurableDirectory(dir: string): void;
|
|
4
|
+
export declare function syncFile(file: string): void;
|
|
5
|
+
export declare function writeComplete(fd: number, bytes: Buffer | string): void;
|
|
6
|
+
export declare function appendDurable(file: string, line: string, held: () => boolean): void;
|
|
7
|
+
//# sourceMappingURL=durable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durable.d.ts","sourceRoot":"","sources":["../../../src/runtime/identity/durable.ts"],"names":[],"mappings":"AAGA,wBAAgB,0BAA0B,CAAC,KAAK,EAAC,OAAO,GAAE,OAAO,CAIhE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAQ/C;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAOxD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI3C;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQtE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,GAAG,IAAI,CAKnF"}
|