@sentropic/h2a 0.98.5 → 0.98.7-rc.1
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/cli-command-map.d.ts.map +1 -1
- package/dist/cli-command-map.js +1 -0
- package/dist/cli-command-map.js.map +1 -1
- package/dist/cli-contract.js +2 -2
- package/dist/cli-contract.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +224 -16
- package/dist/cli.js.map +1 -1
- package/dist/hosts/agy.js +1 -1
- package/dist/hosts/agy.js.map +1 -1
- package/dist/hosts/installation-doctor.d.ts +1 -0
- package/dist/hosts/installation-doctor.d.ts.map +1 -1
- package/dist/hosts/installation-doctor.js +1 -1
- package/dist/hosts/installation-doctor.js.map +1 -1
- package/dist/hosts/muse.d.ts.map +1 -1
- package/dist/hosts/muse.js +2 -4
- package/dist/hosts/muse.js.map +1 -1
- package/dist/hosts/native-artifacts.d.ts +33 -0
- package/dist/hosts/native-artifacts.d.ts.map +1 -0
- package/dist/hosts/native-artifacts.js +104 -0
- package/dist/hosts/native-artifacts.js.map +1 -0
- package/dist/hosts/native-catalog.d.ts +19 -0
- package/dist/hosts/native-catalog.d.ts.map +1 -0
- package/dist/hosts/native-catalog.js +14 -0
- package/dist/hosts/native-catalog.js.map +1 -0
- package/dist/hosts/native-convergence.d.ts +132 -0
- package/dist/hosts/native-convergence.d.ts.map +1 -0
- package/dist/hosts/native-convergence.js +86 -0
- package/dist/hosts/native-convergence.js.map +1 -0
- package/dist/hosts/native-files.d.ts +40 -0
- package/dist/hosts/native-files.d.ts.map +1 -0
- package/dist/hosts/native-files.js +131 -0
- package/dist/hosts/native-files.js.map +1 -0
- package/dist/hosts/native-inspection.d.ts +31 -0
- package/dist/hosts/native-inspection.d.ts.map +1 -0
- package/dist/hosts/native-inspection.js +79 -0
- package/dist/hosts/native-inspection.js.map +1 -0
- package/dist/hosts/native-paths.d.ts +11 -0
- package/dist/hosts/native-paths.d.ts.map +1 -0
- package/dist/hosts/native-paths.js +21 -0
- package/dist/hosts/native-paths.js.map +1 -0
- package/dist/hosts/native-proof.d.ts +32 -0
- package/dist/hosts/native-proof.d.ts.map +1 -0
- package/dist/hosts/native-proof.js +31 -0
- package/dist/hosts/native-proof.js.map +1 -0
- package/dist/hosts/native-runtime-record.d.ts +3 -0
- package/dist/hosts/native-runtime-record.d.ts.map +1 -0
- package/dist/hosts/native-runtime-record.js +60 -0
- package/dist/hosts/native-runtime-record.js.map +1 -0
- package/dist/hosts/native-skills.d.ts +24 -0
- package/dist/hosts/native-skills.d.ts.map +1 -0
- package/dist/hosts/native-skills.js +56 -0
- package/dist/hosts/native-skills.js.map +1 -0
- package/dist/hosts/native-toml.d.ts +18 -0
- package/dist/hosts/native-toml.d.ts.map +1 -0
- package/dist/hosts/native-toml.js +91 -0
- package/dist/hosts/native-toml.js.map +1 -0
- package/dist/hosts/operator-notices.d.ts +3 -0
- package/dist/hosts/operator-notices.d.ts.map +1 -0
- package/dist/hosts/operator-notices.js +31 -0
- package/dist/hosts/operator-notices.js.map +1 -0
- package/dist/hosts/plugin.d.ts.map +1 -1
- package/dist/hosts/plugin.js +3 -2
- package/dist/hosts/plugin.js.map +1 -1
- package/dist/hosts/upgrade-equipment.d.ts +42 -0
- package/dist/hosts/upgrade-equipment.d.ts.map +1 -0
- package/dist/hosts/upgrade-equipment.js +26 -0
- package/dist/hosts/upgrade-equipment.js.map +1 -0
- package/dist/hosts/vibe-discovery.d.ts +12 -0
- package/dist/hosts/vibe-discovery.d.ts.map +1 -0
- package/dist/hosts/vibe-discovery.js +33 -0
- package/dist/hosts/vibe-discovery.js.map +1 -0
- package/dist/hosts/vibe-equipment.d.ts +71 -0
- package/dist/hosts/vibe-equipment.d.ts.map +1 -0
- package/dist/hosts/vibe-equipment.js +162 -0
- package/dist/hosts/vibe-equipment.js.map +1 -0
- package/dist/hosts/vibe-mcp.d.ts +32 -0
- package/dist/hosts/vibe-mcp.d.ts.map +1 -0
- package/dist/hosts/vibe-mcp.js +210 -0
- package/dist/hosts/vibe-mcp.js.map +1 -0
- package/dist/hosts/vibe.d.ts +12 -3
- package/dist/hosts/vibe.d.ts.map +1 -1
- package/dist/hosts/vibe.js +15 -7
- package/dist/hosts/vibe.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- 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/live/contracts.d.ts +55 -0
- package/dist/runtime/live/contracts.d.ts.map +1 -0
- package/dist/runtime/live/contracts.js +59 -0
- package/dist/runtime/live/contracts.js.map +1 -0
- 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 +1338 -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/orphan-gc.d.ts +3 -0
- package/dist/runtime/local-files/orphan-gc.d.ts.map +1 -0
- package/dist/runtime/local-files/orphan-gc.js +69 -0
- package/dist/runtime/local-files/orphan-gc.js.map +1 -0
- package/dist/runtime/local-files/presence.d.ts +5 -2
- package/dist/runtime/local-files/presence.d.ts.map +1 -1
- package/dist/runtime/local-files/presence.js +32 -29
- package/dist/runtime/local-files/presence.js.map +1 -1
- package/dist/runtime/local-files/recipient-hints.d.ts +10 -0
- package/dist/runtime/local-files/recipient-hints.d.ts.map +1 -0
- package/dist/runtime/local-files/recipient-hints.js +156 -0
- package/dist/runtime/local-files/recipient-hints.js.map +1 -0
- 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/handlers.d.ts +1 -0
- package/dist/runtime/mcp/handlers.d.ts.map +1 -1
- package/dist/runtime/mcp/handlers.js +7 -4
- package/dist/runtime/mcp/handlers.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/notifications.d.ts +2 -1
- package/dist/runtime/mcp/notifications.d.ts.map +1 -1
- package/dist/runtime/mcp/notifications.js +16 -2
- package/dist/runtime/mcp/notifications.js.map +1 -1
- package/dist/runtime/mcp/server.d.ts +3 -0
- package/dist/runtime/mcp/server.d.ts.map +1 -1
- package/dist/runtime/mcp/server.js +31 -15
- package/dist/runtime/mcp/server.js.map +1 -1
- package/dist/runtime/mcp/sessions.d.ts +6 -6
- package/dist/runtime/mcp/sessions.d.ts.map +1 -1
- package/dist/runtime/mcp/sessions.js +18 -6
- package/dist/runtime/mcp/sessions.js.map +1 -1
- package/dist/runtime/mcp/stdio.d.ts.map +1 -1
- package/dist/runtime/mcp/stdio.js +11 -0
- package/dist/runtime/mcp/stdio.js.map +1 -1
- package/dist/runtime/mcp/tools.js +1 -1
- package/dist/runtime/mcp/tools.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/dist/runtime/send.d.ts +10 -0
- package/dist/runtime/send.d.ts.map +1 -1
- package/dist/runtime/send.js +80 -5
- package/dist/runtime/send.js.map +1 -1
- package/dist/runtime/upgrade/index.d.ts +1 -0
- package/dist/runtime/upgrade/index.d.ts.map +1 -1
- package/dist/runtime/upgrade/index.js +1 -0
- package/dist/runtime/upgrade/index.js.map +1 -1
- package/dist/vendor/engram-live/contracts.d.ts +208 -0
- package/dist/vendor/engram-live/contracts.js +558 -0
- package/fixtures/native-host-catalog.json +1 -0
- package/fixtures/native-host-history.json +1261 -0
- package/fixtures/native-host-renderers.json +1 -0
- package/hooks/deny-manual-h2a-cli.mjs +38 -0
- package/hooks/hooks.json +17 -0
- package/hooks/vibe-post-agent.mjs +29 -0
- package/hooks/vibe-pre-tool.mjs +40 -0
- package/package.json +9 -6
- package/scripts/qualification-budget.mjs +56 -0
- package/scripts/qualification-cleanup.mjs +15 -0
- package/scripts/qualification-oracles.mjs +44 -0
- package/scripts/qualification-patch.mjs +21 -0
- package/scripts/qualification-poll-hosts.mjs +19 -0
- package/scripts/qualification-probe.mjs +63 -0
- package/scripts/qualification-rpc.mjs +59 -0
- package/scripts/qualification-vibe.mjs +159 -0
- package/scripts/qualify-host.mjs +143 -0
- package/skills/h2a/SKILL.md +6 -2
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LockTimeoutError } from '../local-files/locks.js';
|
|
2
|
+
export declare const digestBytes: (bytes: string | Buffer) => string;
|
|
3
|
+
export declare class BindingCommitIntegrityError extends Error {
|
|
4
|
+
readonly reasonCode = "binding-commit-integrity";
|
|
5
|
+
readonly retryable = false;
|
|
6
|
+
constructor(detail: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class BindingFenceStaleError extends LockTimeoutError {
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
11
|
+
export declare class BindingCommitConflictError extends LockTimeoutError {
|
|
12
|
+
constructor();
|
|
13
|
+
}
|
|
14
|
+
export interface ProofSource {
|
|
15
|
+
file: string;
|
|
16
|
+
dev: number;
|
|
17
|
+
ino: number;
|
|
18
|
+
size: number;
|
|
19
|
+
mtimeMs: number;
|
|
20
|
+
ctimeMs: number;
|
|
21
|
+
offset: number;
|
|
22
|
+
length: number;
|
|
23
|
+
sha256: string;
|
|
24
|
+
}
|
|
25
|
+
export interface PossessionReceipt {
|
|
26
|
+
instance: string;
|
|
27
|
+
sources: ProofSource[];
|
|
28
|
+
publicKeySha256: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const isPreparedPossession: (receipt: PossessionReceipt) => boolean;
|
|
31
|
+
export declare function preparePossession(root: string, instance: string): PossessionReceipt | undefined;
|
|
32
|
+
export declare function receiptMatches(root: string, receipt: PossessionReceipt, cold?: boolean): boolean;
|
|
33
|
+
export declare function withPossession<T>(root: string, receipt: PossessionReceipt, fn: () => T): T;
|
|
34
|
+
//# sourceMappingURL=possession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"possession.d.ts","sourceRoot":"","sources":["../../../src/runtime/identity/possession.ts"],"names":[],"mappings":"AAKA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGzE,eAAO,MAAM,WAAW,GAAI,OAAO,MAAM,GAAG,MAAM,KAAG,MAA0D,CAAC;AAChH,qBAAa,2BAA4B,SAAQ,KAAK;IACpD,QAAQ,CAAC,UAAU,8BAA8B;IACjD,QAAQ,CAAC,SAAS,SAAS;gBACf,MAAM,EAAE,MAAM;CAC3B;AACD,qBAAa,sBAAuB,SAAQ,gBAAgB;;CAE3D;AACD,qBAAa,0BAA2B,SAAQ,gBAAgB;;CAE/D;AACD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IACvF,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;CAChD;AACD,MAAM,WAAW,iBAAiB;IAAG,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,WAAW,EAAE,CAAC;IAAC,eAAe,EAAE,MAAM,CAAC;CAAE;AAEzG,eAAO,MAAM,oBAAoB,GAAE,SAAQ,iBAAiB,KAAE,OAAsC,CAAC;AAwBrG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAsC/F;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,IAAI,UAAQ,GAAG,OAAO,CAoB9F;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAK1F"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// Preparation parses sources outside identity possession. Admission reads only
|
|
2
|
+
// the receipt's fixed ranges and file metadata, under the registry lock.
|
|
3
|
+
import { createHash, createPublicKey, randomBytes, sign, verify } from 'node:crypto';
|
|
4
|
+
import { closeSync, existsSync, fstatSync, openSync, readFileSync, readSync, statSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { withLockSync, LockTimeoutError } from '../local-files/locks.js';
|
|
7
|
+
import { syncDirectory, syncFile } from './durable.js';
|
|
8
|
+
export const digestBytes = (bytes) => createHash('sha256').update(bytes).digest('hex');
|
|
9
|
+
export class BindingCommitIntegrityError extends Error {
|
|
10
|
+
reasonCode = 'binding-commit-integrity';
|
|
11
|
+
retryable = false;
|
|
12
|
+
constructor(detail) { super(`Identity binding commit integrity: ${detail}`, { cause: 'identity_storage_failed' }); }
|
|
13
|
+
}
|
|
14
|
+
export class BindingFenceStaleError extends LockTimeoutError {
|
|
15
|
+
constructor() { super('identity/.lock', undefined, 0); this.message = 'Identity possession receipt changed; prepare again outside the fence'; }
|
|
16
|
+
}
|
|
17
|
+
export class BindingCommitConflictError extends LockTimeoutError {
|
|
18
|
+
constructor() { super('identity/.lock', undefined, 0); this.message = 'Identity binding CAS conflict; the existing winner is retained'; }
|
|
19
|
+
}
|
|
20
|
+
const verifiedReceipts = new WeakSet();
|
|
21
|
+
export const isPreparedPossession = (receipt) => verifiedReceipts.has(receipt);
|
|
22
|
+
const stamp = (file, offset, bytes) => {
|
|
23
|
+
const st = statSync(file);
|
|
24
|
+
return { file, dev: st.dev, ino: st.ino, size: st.size, mtimeMs: st.mtimeMs, ctimeMs: st.ctimeMs,
|
|
25
|
+
offset, length: bytes.length, sha256: digestBytes(bytes) };
|
|
26
|
+
};
|
|
27
|
+
function rows(file) {
|
|
28
|
+
if (!existsSync(file))
|
|
29
|
+
return [];
|
|
30
|
+
const bytes = readFileSync(file);
|
|
31
|
+
if (bytes.length && bytes.at(-1) !== 10)
|
|
32
|
+
throw new BindingCommitIntegrityError('unterminated registry source');
|
|
33
|
+
const out = [];
|
|
34
|
+
let offset = 0;
|
|
35
|
+
for (let end = bytes.indexOf(10); end !== -1; end = bytes.indexOf(10, offset)) {
|
|
36
|
+
const line = bytes.subarray(offset, end + 1);
|
|
37
|
+
if (line.toString().trim()) {
|
|
38
|
+
let row;
|
|
39
|
+
try {
|
|
40
|
+
row = JSON.parse(line.toString());
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
throw new BindingCommitIntegrityError('invalid registry source');
|
|
44
|
+
}
|
|
45
|
+
if (!row || typeof row !== 'object' || Array.isArray(row))
|
|
46
|
+
throw new BindingCommitIntegrityError('invalid registry record');
|
|
47
|
+
out.push({ row, offset, bytes: line });
|
|
48
|
+
}
|
|
49
|
+
offset = end + 1;
|
|
50
|
+
}
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
export function preparePossession(root, instance) {
|
|
54
|
+
const keyName = instance.replace(/[:/]/g, '-');
|
|
55
|
+
const privateFile = join(root, 'keys', `${keyName}.key.pem`);
|
|
56
|
+
const publicFile = join(root, 'keys', `${keyName}.pub.pem`);
|
|
57
|
+
if (!existsSync(privateFile) || !existsSync(publicFile))
|
|
58
|
+
return undefined;
|
|
59
|
+
return withLockSync(join(root, 'registry', '.lock'), () => {
|
|
60
|
+
const privateBytes = readFileSync(privateFile);
|
|
61
|
+
const publicBytes = readFileSync(publicFile);
|
|
62
|
+
const instancesFile = join(root, 'registry', 'instances.jsonl');
|
|
63
|
+
const keysFile = join(root, 'registry', 'keys.jsonl');
|
|
64
|
+
const registrations = rows(instancesFile);
|
|
65
|
+
const registration = registrations.find(({ row }) => row.id === instance);
|
|
66
|
+
const events = rows(keysFile);
|
|
67
|
+
if (!registration || !Array.isArray(registration.row.publicKeys))
|
|
68
|
+
return undefined;
|
|
69
|
+
const active = new Set(registration.row.publicKeys);
|
|
70
|
+
for (const { row } of events)
|
|
71
|
+
if (row.instance === instance && row.type === 'added')
|
|
72
|
+
active.add(row.publicKey);
|
|
73
|
+
for (const { row } of events)
|
|
74
|
+
if (row.instance === instance && row.type === 'revoked')
|
|
75
|
+
active.delete(row.publicKey);
|
|
76
|
+
try {
|
|
77
|
+
const expected = createPublicKey(privateBytes).export({ type: 'spki', format: 'der' });
|
|
78
|
+
if (!expected.equals(createPublicKey(publicBytes).export({ type: 'spki', format: 'der' })))
|
|
79
|
+
return undefined;
|
|
80
|
+
const nonce = randomBytes(32);
|
|
81
|
+
const signature = sign(null, nonce, privateBytes);
|
|
82
|
+
if (![...active].some(pem => verify(null, nonce, pem, signature)))
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
for (const file of [privateFile, publicFile, instancesFile, ...(existsSync(keysFile) ? [keysFile] : [])])
|
|
89
|
+
syncFile(file);
|
|
90
|
+
syncDirectory(root);
|
|
91
|
+
const sources = [stamp(privateFile, 0, privateBytes), stamp(publicFile, 0, publicBytes),
|
|
92
|
+
stamp(instancesFile, registration.offset, registration.bytes),
|
|
93
|
+
...(existsSync(keysFile) ? [stamp(keysFile, 0, Buffer.alloc(0))] : [])];
|
|
94
|
+
const publicPem = publicBytes.toString();
|
|
95
|
+
if (!registration.row.publicKeys.includes(publicPem)) {
|
|
96
|
+
const added = events.find(({ row }) => row.instance === instance && row.type === 'added' && row.publicKey === publicPem);
|
|
97
|
+
if (!added)
|
|
98
|
+
return undefined;
|
|
99
|
+
sources.push(stamp(keysFile, added.offset, added.bytes));
|
|
100
|
+
}
|
|
101
|
+
// An absent key-event source is observed again at admission.
|
|
102
|
+
if (!existsSync(keysFile))
|
|
103
|
+
sources.push({ file: keysFile, dev: 0, ino: 0, size: 0, mtimeMs: 0, ctimeMs: 0, offset: 0, length: 0, sha256: digestBytes('') });
|
|
104
|
+
const receipt = { instance, sources: sources.map(s => ({ ...s, file: s.file.slice(root.length + 1) })), publicKeySha256: digestBytes(publicBytes) };
|
|
105
|
+
verifiedReceipts.add(receipt);
|
|
106
|
+
return receipt;
|
|
107
|
+
}, { timeoutMs: 250 });
|
|
108
|
+
}
|
|
109
|
+
export function receiptMatches(root, receipt, cold = false) {
|
|
110
|
+
if (!receipt || typeof receipt.instance !== 'string' || !Array.isArray(receipt.sources) || receipt.sources.length < 3)
|
|
111
|
+
return false;
|
|
112
|
+
for (const source of receipt.sources) {
|
|
113
|
+
if (!/^(keys\/[A-Za-z0-9._-]+\.(key|pub)\.pem|registry\/(instances|keys)\.jsonl)$/.test(source.file))
|
|
114
|
+
return false;
|
|
115
|
+
const file = join(root, source.file);
|
|
116
|
+
if (source.ino === 0) {
|
|
117
|
+
if (!cold && existsSync(file))
|
|
118
|
+
return false;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
let fd;
|
|
122
|
+
try {
|
|
123
|
+
fd = openSync(file, 'r');
|
|
124
|
+
const st = fstatSync(fd);
|
|
125
|
+
if (st.dev !== source.dev || st.ino !== source.ino || st.size < source.size)
|
|
126
|
+
return false;
|
|
127
|
+
if (!cold && (st.size !== source.size || st.mtimeMs !== source.mtimeMs || st.ctimeMs !== source.ctimeMs))
|
|
128
|
+
return false;
|
|
129
|
+
if (!Number.isSafeInteger(source.offset) || !Number.isSafeInteger(source.length) || source.offset < 0 || source.length < 0 || source.offset + source.length > st.size)
|
|
130
|
+
return false;
|
|
131
|
+
const bytes = Buffer.alloc(source.length);
|
|
132
|
+
let offset = 0;
|
|
133
|
+
while (offset < bytes.length) {
|
|
134
|
+
const n = readSync(fd, bytes, offset, bytes.length - offset, source.offset + offset);
|
|
135
|
+
if (!n)
|
|
136
|
+
return false;
|
|
137
|
+
offset += n;
|
|
138
|
+
}
|
|
139
|
+
if (digestBytes(bytes) !== source.sha256)
|
|
140
|
+
return false;
|
|
141
|
+
const current = statSync(file);
|
|
142
|
+
if (current.ino !== st.ino || current.dev !== st.dev || current.size !== st.size || current.ctimeMs !== st.ctimeMs)
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
if (fd !== undefined)
|
|
150
|
+
closeSync(fd);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
export function withPossession(root, receipt, fn) {
|
|
156
|
+
return withLockSync(join(root, 'registry', '.lock'), () => {
|
|
157
|
+
if (!isPreparedPossession(receipt) || !receiptMatches(root, receipt))
|
|
158
|
+
throw new BindingFenceStaleError();
|
|
159
|
+
return fn();
|
|
160
|
+
}, { timeoutMs: 250 });
|
|
161
|
+
}
|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;YAAC,IAAI,EAAE,KAAK,SAAS;gBAAE,SAAS,CAAC,EAAE,CAAC,CAAC;QAAC,CAAC;IAC5E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,cAAc,CAAI,IAAY,EAAE,OAA0B,EAAE,EAAW;IACrF,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE;QACxD,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC;YAAE,MAAM,IAAI,sBAAsB,EAAE,CAAC;QACzG,OAAO,EAAE,EAAE,CAAC;IACd,CAAC,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -28,6 +28,8 @@ function classify(err) {
|
|
|
28
28
|
return { cause: "storage_readonly", message };
|
|
29
29
|
if (code === "EACCES" || code === "EPERM")
|
|
30
30
|
return { cause: "storage_permission_denied", message };
|
|
31
|
+
if (err instanceof Error && err.cause === 'identity_storage_failed')
|
|
32
|
+
return { cause: 'identity_storage_failed', message };
|
|
31
33
|
if (err instanceof Error && err.name === "LockTimeoutError") {
|
|
32
34
|
return { cause: "identity_timeout", message };
|
|
33
35
|
}
|
|
@@ -85,9 +87,10 @@ process.on("message", (raw) => {
|
|
|
85
87
|
? { declaredCapabilities: req.request.declaredCapabilities }
|
|
86
88
|
: {})
|
|
87
89
|
};
|
|
88
|
-
const budgetMs = Number.isFinite(req.budgetMs) && req.budgetMs
|
|
90
|
+
const budgetMs = Number.isFinite(req.budgetMs) && req.budgetMs >= 0 ? req.budgetMs : 20_000;
|
|
89
91
|
const startNs = process.hrtime.bigint();
|
|
90
|
-
const
|
|
92
|
+
const parentDeadline = req.deadlineNs && /^[0-9]{1,30}$/.test(req.deadlineNs) ? BigInt(req.deadlineNs) : undefined;
|
|
93
|
+
const remainingMs = () => Math.min(budgetMs - Number(process.hrtime.bigint() - startNs) / 1_000_000, parentDeadline === undefined ? Infinity : Number(parentDeadline - process.hrtime.bigint()) / 1_000_000);
|
|
91
94
|
const cancellableDelay = (ms) => new Promise((resolve) => {
|
|
92
95
|
if (abort.signal.aborted)
|
|
93
96
|
return resolve();
|
|
@@ -109,13 +112,14 @@ process.on("message", (raw) => {
|
|
|
109
112
|
const mintMemo = {};
|
|
110
113
|
const prepCache = {};
|
|
111
114
|
let attempt = 0;
|
|
115
|
+
let sequence = 0;
|
|
112
116
|
const resolveWithRetry = async () => {
|
|
113
117
|
while (!abort.signal.aborted) {
|
|
114
118
|
const budget = remainingMs();
|
|
115
119
|
if (budget <= 0)
|
|
116
120
|
throw new LockTimeoutError("identity", undefined, budgetMs);
|
|
117
121
|
try {
|
|
118
|
-
|
|
122
|
+
const identity = await resolveLiveIdentityAsync(input, {
|
|
119
123
|
signal: abort.signal,
|
|
120
124
|
deadlineMs: budget,
|
|
121
125
|
// Fail a contended registration fast so the identity lock is not held
|
|
@@ -123,8 +127,13 @@ process.on("message", (raw) => {
|
|
|
123
127
|
registryLockTimeoutMs: 250,
|
|
124
128
|
mintMemo,
|
|
125
129
|
prepCache,
|
|
126
|
-
attempt
|
|
130
|
+
attempt,
|
|
131
|
+
...(req.diagnosticKey && /^[0-9a-f]{64}$/.test(req.diagnosticKey) ? { diagnosticKey: Buffer.from(req.diagnosticKey, 'hex') } : {}),
|
|
132
|
+
onBlocker: (diagnostic, stabilityKey) => send({ kind: 'identity_observation', v: 1, attemptId: req.attemptId ?? req.traceAttemptId ?? 'legacy-parent', sequence: ++sequence, diagnostic, stabilityKey })
|
|
127
133
|
});
|
|
134
|
+
if (remainingMs() <= 0)
|
|
135
|
+
throw new LockTimeoutError('identity/.lock', undefined, budgetMs);
|
|
136
|
+
return identity;
|
|
128
137
|
}
|
|
129
138
|
catch (err) {
|
|
130
139
|
attempt += 1;
|
|
@@ -173,7 +182,9 @@ process.on("message", (raw) => {
|
|
|
173
182
|
})
|
|
174
183
|
.catch((err) => {
|
|
175
184
|
const { cause, message } = classify(err);
|
|
176
|
-
|
|
185
|
+
const diagnostic = err?.diagnostic;
|
|
186
|
+
const safeMessage = message.replaceAll(req.request.root, '<store-root>').replace(/\/(?:[^\s,;:]+\/)+[^\s,;:]+/g, '<path>');
|
|
187
|
+
send({ kind: "identity_error", v: 1, cause, message: safeMessage, ...(diagnostic ? { diagnostic } : {}) });
|
|
177
188
|
})
|
|
178
189
|
.finally(() => {
|
|
179
190
|
// The worker's whole job is one resolution; exit so no orphan lingers to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/runtime/identity/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/runtime/identity/worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAgC1E,SAAS,QAAQ,CAAC,GAAY;IAC5B,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,IAAI,GAAG,YAAY,kBAAkB,EAAE,CAAC;QACtC,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC;IAChD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M,UAAU,GAAE,GAA6B,EAAE,UAAU,CAAC;QAC5D,MAAM,WAAW,GAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAC,cAAc,CAAC,CAAC,OAAO,CAAC,8BAA8B,EAAC,QAAQ,CAAC,CAAC;QACvH,IAAI,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAC,WAAW,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAC,UAAU,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1G,CAAC,CAAC;SACD,OAAO,CAAC,GAAG,EAAE;QACZ,yEAAyE;QACzE,2DAA2D;QAC3D,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;IAClD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,2EAA2E;AAC3E,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;IAC5B,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAC1B,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;AAClD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live Git Indexing — L6a (H): h2a-side core contract view.
|
|
3
|
+
*
|
|
4
|
+
* The neutral contract FROZE at @sentropic/engram-live 0.1.0 (graphify
|
|
5
|
+
* 70ebdfee, PR rhanka/engram#359): H no longer carries its own declaration
|
|
6
|
+
* vocabulary, validators or identity derivations. This module re-exports the
|
|
7
|
+
* consumed contract surface — the underlying contracts.js takes zero imports,
|
|
8
|
+
* so this re-export stays data-pure (types, constants and deterministic
|
|
9
|
+
* validation only; no I/O, no host state) — and adds only H-core-owned pure
|
|
10
|
+
* policy (isLocalLiveTenant below).
|
|
11
|
+
*
|
|
12
|
+
* PRE-RELEASE CONSUMPTION (spec §11): @sentropic/engram-live is not
|
|
13
|
+
* published yet — and it is os-bounded (linux), so even a digest-pinned
|
|
14
|
+
* packed prerelease consumed through a `file:` dependency breaks
|
|
15
|
+
* cross-platform install and packed redistribution (smoke). H therefore
|
|
16
|
+
* vendors the portable contract entry (dist/contracts.js, extracted
|
|
17
|
+
* byte-identical from the pinned tarball built from graphify@70ebdfee;
|
|
18
|
+
* provenance and per-file integrity pinned by the GUARD test in h2a-runtime
|
|
19
|
+
* live-registration.test.ts) under ../../vendor/engram-live, with no
|
|
20
|
+
* external dependency and no neighboring checkout imported: at publication
|
|
21
|
+
* time this becomes an exact registry version pin. The
|
|
22
|
+
* derivations (deriveCloneIdentity / deriveWorktreeIdentity /
|
|
23
|
+
* deriveDeclarationIdentity) live in the /integration entry and are consumed
|
|
24
|
+
* by the runtime side only — core never imports the factory entry, keeping
|
|
25
|
+
* copyable DTOs separate from factory imports per spec §3.
|
|
26
|
+
*
|
|
27
|
+
* RETIRED H VOCABULARY (L6a realignment; L6a is not consumed yet, so the
|
|
28
|
+
* break is local-only, no migration replay):
|
|
29
|
+
* - hostScope -> tenant (the value stays a `local:<id>` scope)
|
|
30
|
+
* - capability -> liveCapability (the value stays "live")
|
|
31
|
+
* - revision -> declarationRevision
|
|
32
|
+
* - workspaceFingerprint -> hostFingerprint (declaration level)
|
|
33
|
+
* - policy "live-git-1" -> POLICY_VERSION "live-git-indexing/1"
|
|
34
|
+
* - nested binding {sentropicWorkspaceId, issuer, bindingRevision} ->
|
|
35
|
+
* flat serverWorkspaceId / serverIssuer / bindingRevision
|
|
36
|
+
* - nested clone {cloneId, commonDirRealpath, projectFingerprint} ->
|
|
37
|
+
* CloneIdentityDto {hostScope, commonDirRealpath,
|
|
38
|
+
* commonDirProjectFingerprint, cloneId, oidAlgorithm}
|
|
39
|
+
* - nested worktree {worktreeId, path, workspaceFingerprint} ->
|
|
40
|
+
* WorktreeIdentityDto {cloneId, worktreeId, worktreePath, gitDir,
|
|
41
|
+
* worktreeFingerprint}
|
|
42
|
+
* - newline-joined sha256 identity derivations -> the three canonical
|
|
43
|
+
* public derivations (runtime side, see above).
|
|
44
|
+
*/
|
|
45
|
+
export { CONTRACT_NAME, CONTRACT_VERSION, EXPLICIT_LIVE_CAPABILITY, IDENTITY_UNCERTAINTY_STATES, INITIAL_BINDING_REVISION, INITIAL_DECLARATION_REVISION, NON_ACTIVATING_LIFECYCLE_KINDS, POLICY_VERSION, isIdentityUncertaintyState, isNonActivatingLifecycleKind, isRevocationReason, validateCloneIdentity, validateDeclarationRevocation, validatePrivatePurgeRequest, validateWorkspaceDeclaration, validateWorktreeIdentity, } from "../../vendor/engram-live/contracts.js";
|
|
46
|
+
export type { CloneIdentityDto, DeclarationRevocationDto, IdentityUncertaintyState, NonActivatingLifecycleKind, OidAlgorithm, PrivatePurgeRequestDto, RevocationReason, ValidationResult, WorkspaceDeclarationDto, WorktreeIdentityDto, } from "../../vendor/engram-live/contracts.js";
|
|
47
|
+
/**
|
|
48
|
+
* H tenant guard: the live tenant is ALWAYS a stable local scope
|
|
49
|
+
* `local:<host-owner-id>`, never a sentropic tenant inferred from a
|
|
50
|
+
* workspace id. The verified owner scope and principal proof are L7a work;
|
|
51
|
+
* until then the tenant default is provisional (see the runtime
|
|
52
|
+
* live-registration service).
|
|
53
|
+
*/
|
|
54
|
+
export declare function isLocalLiveTenant(value: unknown): value is string;
|
|
55
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../src/runtime/live/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC5B,8BAA8B,EAC9B,cAAc,EACd,0BAA0B,EAC1B,4BAA4B,EAC5B,kBAAkB,EAClB,qBAAqB,EACrB,6BAA6B,EAC7B,2BAA2B,EAC3B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EACV,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,uCAAuC,CAAC;AAE/C;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAOjE"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live Git Indexing — L6a (H): h2a-side core contract view.
|
|
3
|
+
*
|
|
4
|
+
* The neutral contract FROZE at @sentropic/engram-live 0.1.0 (graphify
|
|
5
|
+
* 70ebdfee, PR rhanka/engram#359): H no longer carries its own declaration
|
|
6
|
+
* vocabulary, validators or identity derivations. This module re-exports the
|
|
7
|
+
* consumed contract surface — the underlying contracts.js takes zero imports,
|
|
8
|
+
* so this re-export stays data-pure (types, constants and deterministic
|
|
9
|
+
* validation only; no I/O, no host state) — and adds only H-core-owned pure
|
|
10
|
+
* policy (isLocalLiveTenant below).
|
|
11
|
+
*
|
|
12
|
+
* PRE-RELEASE CONSUMPTION (spec §11): @sentropic/engram-live is not
|
|
13
|
+
* published yet — and it is os-bounded (linux), so even a digest-pinned
|
|
14
|
+
* packed prerelease consumed through a `file:` dependency breaks
|
|
15
|
+
* cross-platform install and packed redistribution (smoke). H therefore
|
|
16
|
+
* vendors the portable contract entry (dist/contracts.js, extracted
|
|
17
|
+
* byte-identical from the pinned tarball built from graphify@70ebdfee;
|
|
18
|
+
* provenance and per-file integrity pinned by the GUARD test in h2a-runtime
|
|
19
|
+
* live-registration.test.ts) under ../../vendor/engram-live, with no
|
|
20
|
+
* external dependency and no neighboring checkout imported: at publication
|
|
21
|
+
* time this becomes an exact registry version pin. The
|
|
22
|
+
* derivations (deriveCloneIdentity / deriveWorktreeIdentity /
|
|
23
|
+
* deriveDeclarationIdentity) live in the /integration entry and are consumed
|
|
24
|
+
* by the runtime side only — core never imports the factory entry, keeping
|
|
25
|
+
* copyable DTOs separate from factory imports per spec §3.
|
|
26
|
+
*
|
|
27
|
+
* RETIRED H VOCABULARY (L6a realignment; L6a is not consumed yet, so the
|
|
28
|
+
* break is local-only, no migration replay):
|
|
29
|
+
* - hostScope -> tenant (the value stays a `local:<id>` scope)
|
|
30
|
+
* - capability -> liveCapability (the value stays "live")
|
|
31
|
+
* - revision -> declarationRevision
|
|
32
|
+
* - workspaceFingerprint -> hostFingerprint (declaration level)
|
|
33
|
+
* - policy "live-git-1" -> POLICY_VERSION "live-git-indexing/1"
|
|
34
|
+
* - nested binding {sentropicWorkspaceId, issuer, bindingRevision} ->
|
|
35
|
+
* flat serverWorkspaceId / serverIssuer / bindingRevision
|
|
36
|
+
* - nested clone {cloneId, commonDirRealpath, projectFingerprint} ->
|
|
37
|
+
* CloneIdentityDto {hostScope, commonDirRealpath,
|
|
38
|
+
* commonDirProjectFingerprint, cloneId, oidAlgorithm}
|
|
39
|
+
* - nested worktree {worktreeId, path, workspaceFingerprint} ->
|
|
40
|
+
* WorktreeIdentityDto {cloneId, worktreeId, worktreePath, gitDir,
|
|
41
|
+
* worktreeFingerprint}
|
|
42
|
+
* - newline-joined sha256 identity derivations -> the three canonical
|
|
43
|
+
* public derivations (runtime side, see above).
|
|
44
|
+
*/
|
|
45
|
+
export { CONTRACT_NAME, CONTRACT_VERSION, EXPLICIT_LIVE_CAPABILITY, IDENTITY_UNCERTAINTY_STATES, INITIAL_BINDING_REVISION, INITIAL_DECLARATION_REVISION, NON_ACTIVATING_LIFECYCLE_KINDS, POLICY_VERSION, isIdentityUncertaintyState, isNonActivatingLifecycleKind, isRevocationReason, validateCloneIdentity, validateDeclarationRevocation, validatePrivatePurgeRequest, validateWorkspaceDeclaration, validateWorktreeIdentity, } from "../../vendor/engram-live/contracts.js";
|
|
46
|
+
/**
|
|
47
|
+
* H tenant guard: the live tenant is ALWAYS a stable local scope
|
|
48
|
+
* `local:<host-owner-id>`, never a sentropic tenant inferred from a
|
|
49
|
+
* workspace id. The verified owner scope and principal proof are L7a work;
|
|
50
|
+
* until then the tenant default is provisional (see the runtime
|
|
51
|
+
* live-registration service).
|
|
52
|
+
*/
|
|
53
|
+
export function isLocalLiveTenant(value) {
|
|
54
|
+
return (typeof value === "string" &&
|
|
55
|
+
value.startsWith("local:") &&
|
|
56
|
+
value.trim().length > "local:".length &&
|
|
57
|
+
!value.includes("\0"));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../src/runtime/live/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC5B,8BAA8B,EAC9B,cAAc,EACd,0BAA0B,EAC1B,4BAA4B,EAC5B,kBAAkB,EAClB,qBAAqB,EACrB,6BAA6B,EAC7B,2BAA2B,EAC3B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,uCAAuC,CAAC;AAc/C;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC1B,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM;QACrC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/** Identity binding fence, FINAL v6 (A+B). Strict v2/v4 discrimination,
|
|
2
|
+
* qualified death proofs, bounded legacy NSpid evidence, shared succession,
|
|
3
|
+
* durable journal/slot repair before retirement, and monotone diagnostics.
|
|
4
|
+
* Upgrade retains its own protocol bindings. No operator call or signal is
|
|
5
|
+
* used by automatic recovery; every unsupported blocker waits for release.
|
|
6
|
+
*/
|
|
7
|
+
import { type PreparedBindingSlots } from "../identity/binding-commit.js";
|
|
8
|
+
import { LockTimeoutError, type LockObservation } from "./locks.js";
|
|
9
|
+
import { type HostKind, type LegacyLockHolder, type LockRec, type PrefixLockLease, type PublishStatus, type BreakLockAsOperatorOptions, type OperatorBreakResult, type SelfIdent } from "./succession-lock.js";
|
|
10
|
+
/** The one identity fence protocol (also carried by every v2 record). */
|
|
11
|
+
export declare const IDENTITY_BINDING_FENCE_PROTOCOL = "identity-binding-fence-v1";
|
|
12
|
+
type RecordPlatform = "linux" | "darwin" | "win32" | "other";
|
|
13
|
+
type RecordPublication = "link" | "o-excl";
|
|
14
|
+
/** The v2 identity lock record (R2 contract). Strictly validated; never mixed
|
|
15
|
+
* with `hostname`/`startedAt`/`acquiredAt` or any unknown field. */
|
|
16
|
+
export interface IdentityLockRec {
|
|
17
|
+
readonly recordVersion: 2;
|
|
18
|
+
readonly protocol: typeof IDENTITY_BINDING_FENCE_PROTOCOL;
|
|
19
|
+
readonly platform: RecordPlatform;
|
|
20
|
+
readonly publication: RecordPublication;
|
|
21
|
+
readonly hostKind: HostKind;
|
|
22
|
+
readonly host: string | null;
|
|
23
|
+
readonly boot: string | null;
|
|
24
|
+
readonly ns: string | null;
|
|
25
|
+
readonly timeNs: string | null;
|
|
26
|
+
readonly pid: number;
|
|
27
|
+
readonly start: string | null;
|
|
28
|
+
readonly token: string;
|
|
29
|
+
readonly fenceEpoch: string;
|
|
30
|
+
readonly at: number;
|
|
31
|
+
readonly target?: string;
|
|
32
|
+
readonly operator?: true;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* This process's fresh identity context (R2: renewed at every decision; the
|
|
36
|
+
* machine-id falls back to /var/lib/dbus/machine-id when /etc/machine-id is
|
|
37
|
+
* absent). Never memoized, unlike the upgrade path's `me()`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function identitySelf(): SelfIdent;
|
|
40
|
+
/** Diagnostic view of what blocks an identity acquisition (never a raw machine-id). */
|
|
41
|
+
export type IdentityLockRead = "absent" | "corrupt" | "unknown" | {
|
|
42
|
+
kind: "io-error";
|
|
43
|
+
code: string;
|
|
44
|
+
} | {
|
|
45
|
+
kind: "v2";
|
|
46
|
+
rec: IdentityLockRec;
|
|
47
|
+
bytes: Buffer;
|
|
48
|
+
} | {
|
|
49
|
+
kind: "adapter";
|
|
50
|
+
rec: LockRec;
|
|
51
|
+
bytes: Buffer;
|
|
52
|
+
} | {
|
|
53
|
+
kind: "legacy";
|
|
54
|
+
holder: LegacyLockHolder;
|
|
55
|
+
bytes: Buffer;
|
|
56
|
+
eligible?: boolean;
|
|
57
|
+
} | {
|
|
58
|
+
kind: "cull";
|
|
59
|
+
bytes: Buffer;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Reader for `identity/.lock` and its SUCC chain. Distinguishes (R6): the v2
|
|
63
|
+
* record, the 0.98.5 succession format (adapter — publication link is
|
|
64
|
+
* recognized, anchors are used as-is, never completed), the legacy binding
|
|
65
|
+
* record, the historical cull fence, an explicit unknown version/protocol
|
|
66
|
+
* (never downgraded), corruption, absence and I/O errors.
|
|
67
|
+
*/
|
|
68
|
+
export declare function readIdentityLock(path: string): IdentityLockRead;
|
|
69
|
+
/**
|
|
70
|
+
* R1 filesystem guard: automatic recovery is authorized only when the REAL
|
|
71
|
+
* identity directory sits on an explicitly whitelisted local filesystem.
|
|
72
|
+
* tmpfs, NFS, SMB, FUSE, OverlayFS, virtiofs, 9p, ZFS and unknown types or a
|
|
73
|
+
* statfs error all refuse it (wait for normal release instead).
|
|
74
|
+
*/
|
|
75
|
+
export declare function identityFsQualified(dir: string): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Publication (R2): tmp (wx, byte-count-checked write, fsync, close) then
|
|
78
|
+
* `link(2)`, then a directory fsync. On a qualified link incapacity the
|
|
79
|
+
* exclusive-create fallback registers `publication:"o-excl"` — such records
|
|
80
|
+
* are never recovered automatically. EEXIST stays a contention signal; real
|
|
81
|
+
* storage errors are never masked.
|
|
82
|
+
*/
|
|
83
|
+
export type IdentityPublishStatus = PublishStatus & {
|
|
84
|
+
publication?: RecordPublication;
|
|
85
|
+
};
|
|
86
|
+
export declare function publishIdentityRecord(path: string, rec: IdentityLockRec, atomicOnly?: boolean): IdentityPublishStatus;
|
|
87
|
+
export interface IdentityBlockerInfo {
|
|
88
|
+
readonly blockerType: "LOCK" | "SUCC" | "unknown";
|
|
89
|
+
readonly pid: number | "unknown";
|
|
90
|
+
readonly machineClass: "local" | "other" | "unknown";
|
|
91
|
+
readonly machineFingerprint?: string;
|
|
92
|
+
readonly bootClass: "current" | "other" | "unknown";
|
|
93
|
+
readonly ns: string | "unknown";
|
|
94
|
+
readonly start: string | "unknown";
|
|
95
|
+
readonly generation: string;
|
|
96
|
+
readonly target: string | "unknown";
|
|
97
|
+
readonly reasonCode: string;
|
|
98
|
+
readonly reason: string;
|
|
99
|
+
readonly retryCondition: "interval" | "blocker-change";
|
|
100
|
+
}
|
|
101
|
+
export interface IdentityLockDiagnostic extends IdentityBlockerInfo {
|
|
102
|
+
readonly elapsedMs: number;
|
|
103
|
+
readonly budgetMs: number;
|
|
104
|
+
readonly lock: string;
|
|
105
|
+
readonly stable: boolean;
|
|
106
|
+
readonly retryAfterMs?: number;
|
|
107
|
+
/** R6 conditional literal, present only for a stable legacy blocker. */
|
|
108
|
+
readonly legacyNote?: string;
|
|
109
|
+
/** Operator command with a root placeholder, never an absolute path. */
|
|
110
|
+
readonly command?: string;
|
|
111
|
+
}
|
|
112
|
+
/** R7 common literal; absent values render as "unknown". */
|
|
113
|
+
export declare function diagnosticMessage(d: IdentityLockDiagnostic): string;
|
|
114
|
+
export declare class IdentityLockTimeoutError extends LockTimeoutError {
|
|
115
|
+
readonly diagnostic: IdentityLockDiagnostic;
|
|
116
|
+
constructor(lockPath: string, diagnostic: IdentityLockDiagnostic);
|
|
117
|
+
}
|
|
118
|
+
export interface IdentityFenceOptions {
|
|
119
|
+
readonly onBlocker?: (info: IdentityBlockerInfo, stabilityKey: string) => void;
|
|
120
|
+
readonly diagnosticKey?: Buffer;
|
|
121
|
+
/** Monotone budget bounding the whole wait (default 5000 ms). */
|
|
122
|
+
readonly timeoutMs?: number;
|
|
123
|
+
readonly pollMs?: number;
|
|
124
|
+
/** L0 passive observation, same contract as the store locks. */
|
|
125
|
+
readonly observe?: (event: LockObservation) => void;
|
|
126
|
+
/** Cooperative cancellation while WAITING (async variant only). */
|
|
127
|
+
readonly signal?: AbortSignal;
|
|
128
|
+
/** Diagnostic label (default: the lock path relative to the store root). */
|
|
129
|
+
readonly relativeLockPath?: string;
|
|
130
|
+
}
|
|
131
|
+
export interface IdentityFenceLease extends PrefixLockLease {
|
|
132
|
+
beginMutation(): void;
|
|
133
|
+
endMutation(): void;
|
|
134
|
+
/** Publication actually used for this fence (o-excl is never recovered). */
|
|
135
|
+
readonly publication: RecordPublication;
|
|
136
|
+
/** True when acquisition recovered a provably dead previous holder. */
|
|
137
|
+
readonly recovered: boolean;
|
|
138
|
+
}
|
|
139
|
+
export declare function repairIdentityJournal(dir: string, held: () => boolean, slots: PreparedBindingSlots): void;
|
|
140
|
+
/** Identity operator uses the same election and repair barrier; upgrade stays separate. */
|
|
141
|
+
export declare function breakIdentityLockAsOperator(lockPath: string, options: BreakLockAsOperatorOptions): OperatorBreakResult;
|
|
142
|
+
/** Synchronous identity fence (CLI / sync binding writer). */
|
|
143
|
+
export declare function withIdentityFenceSync<T>(lockPath: string, fn: (lease: IdentityFenceLease) => T, options?: IdentityFenceOptions): T;
|
|
144
|
+
/** Asynchronous identity fence (the identity worker's binding transaction). */
|
|
145
|
+
export declare function withIdentityFence<T>(lockPath: string, fn: (lease: IdentityFenceLease) => T | Promise<T>, options?: IdentityFenceOptions): Promise<T>;
|
|
146
|
+
export interface TailNeutralized {
|
|
147
|
+
readonly offset: number;
|
|
148
|
+
readonly length: number;
|
|
149
|
+
readonly sha256: string;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Terminate an unterminated final suffix of the journal with exactly one
|
|
153
|
+
* appended `\n` (R5). No byte before the suffix is ever rewritten or removed;
|
|
154
|
+
* the operation is idempotent. `offset`/`length` are in bytes, `sha256` covers
|
|
155
|
+
* the ORIGINAL suffix without the added separator; no content is exposed.
|
|
156
|
+
*/
|
|
157
|
+
export declare function neutralizeBindingsTail(file: string, held?: () => boolean): TailNeutralized | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* Attest the journal's durability after a recovery (R5 idempotence): a visible
|
|
160
|
+
* separator whose previous fsync is unattested is fsynced now, content-free.
|
|
161
|
+
*/
|
|
162
|
+
export declare function attestBindingsTailDurable(file: string): void;
|
|
163
|
+
export {};
|
|
164
|
+
//# sourceMappingURL=identity-fence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-fence.d.ts","sourceRoot":"","sources":["../../../src/runtime/local-files/identity-fence.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoBH,OAAO,EAA2C,KAAK,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAInH,OAAO,EAEL,gBAAgB,EAGhB,KAAK,eAAe,EACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAcL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK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