@sentropic/h2a-runtime 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/dist/attach.d.ts +2 -0
- package/dist/attach.d.ts.map +1 -1
- package/dist/attach.js +73 -6
- package/dist/attach.js.map +1 -1
- package/dist/auth-login.d.ts +24 -1
- package/dist/auth-login.d.ts.map +1 -1
- package/dist/auth-login.js +132 -4
- package/dist/auth-login.js.map +1 -1
- package/dist/central-mcp.d.ts +2 -0
- package/dist/central-mcp.d.ts.map +1 -1
- package/dist/central-mcp.js +90 -3
- package/dist/central-mcp.js.map +1 -1
- package/dist/cli-help-groups.js +1 -1
- package/dist/cli-help-groups.js.map +1 -1
- package/dist/crash-log.d.ts +112 -0
- package/dist/crash-log.d.ts.map +1 -0
- package/dist/crash-log.js +560 -0
- package/dist/crash-log.js.map +1 -0
- package/dist/gateway-host/live-declarations.d.ts +58 -0
- package/dist/gateway-host/live-declarations.d.ts.map +1 -0
- package/dist/gateway-host/live-declarations.js +423 -0
- package/dist/gateway-host/live-declarations.js.map +1 -0
- package/dist/gateway-host/live-registration.d.ts +162 -0
- package/dist/gateway-host/live-registration.d.ts.map +1 -0
- package/dist/gateway-host/live-registration.js +455 -0
- package/dist/gateway-host/live-registration.js.map +1 -0
- package/dist/identity-cull/cull.d.ts.map +1 -1
- package/dist/identity-cull/cull.js +35 -89
- package/dist/identity-cull/cull.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +90 -6
- package/dist/index.js.map +1 -1
- package/dist/native-host.d.ts +3 -1
- package/dist/native-host.d.ts.map +1 -1
- package/dist/native-host.js +43 -10
- package/dist/native-host.js.map +1 -1
- package/dist/native-terminal/client.d.ts +2 -2
- package/dist/native-terminal/client.d.ts.map +1 -1
- package/dist/native-terminal/client.js +2 -2
- package/dist/native-terminal/client.js.map +1 -1
- package/dist/native-terminal/host.d.ts +21 -5
- package/dist/native-terminal/host.d.ts.map +1 -1
- package/dist/native-terminal/host.js +104 -72
- package/dist/native-terminal/host.js.map +1 -1
- package/dist/native-terminal/journal.d.ts +5 -0
- package/dist/native-terminal/journal.d.ts.map +1 -1
- package/dist/native-terminal/journal.js +30 -17
- package/dist/native-terminal/journal.js.map +1 -1
- package/dist/native-terminal/op.d.ts +16 -1
- package/dist/native-terminal/op.d.ts.map +1 -1
- package/dist/native-terminal/op.js +124 -45
- package/dist/native-terminal/op.js.map +1 -1
- package/dist/native-terminal/process.d.ts.map +1 -1
- package/dist/native-terminal/process.js +4 -2
- package/dist/native-terminal/process.js.map +1 -1
- package/dist/native-terminal/publication-refusal.d.ts +22 -0
- package/dist/native-terminal/publication-refusal.d.ts.map +1 -0
- package/dist/native-terminal/publication-refusal.js +26 -0
- package/dist/native-terminal/publication-refusal.js.map +1 -0
- package/dist/native-terminal/server.d.ts +9 -2
- package/dist/native-terminal/server.d.ts.map +1 -1
- package/dist/native-terminal/server.js +335 -138
- package/dist/native-terminal/server.js.map +1 -1
- package/dist/native-terminal/supervisor.d.ts.map +1 -1
- package/dist/native-terminal/supervisor.js +9 -0
- package/dist/native-terminal/supervisor.js.map +1 -1
- package/dist/proc-identity.d.ts +63 -1
- package/dist/proc-identity.d.ts.map +1 -1
- package/dist/proc-identity.js +98 -1
- package/dist/proc-identity.js.map +1 -1
- package/dist/pty.d.ts.map +1 -1
- package/dist/pty.js +18 -0
- package/dist/pty.js.map +1 -1
- package/dist/registry.d.ts +15 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +17 -4
- package/dist/registry.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +79 -16
- package/dist/run.js.map +1 -1
- package/dist/terminal-reset.d.ts +104 -0
- package/dist/terminal-reset.d.ts.map +1 -0
- package/dist/terminal-reset.js +229 -0
- package/dist/terminal-reset.js.map +1 -0
- package/dist/tmux.d.ts +25 -3
- package/dist/tmux.d.ts.map +1 -1
- package/dist/tmux.js +61 -18
- package/dist/tmux.js.map +1 -1
- package/dist/vendor/engram-live/contracts.d.ts +208 -0
- package/dist/vendor/engram-live/contracts.js +558 -0
- package/dist/vendor/engram-live/integration.d.ts +73 -0
- package/dist/vendor/engram-live/integration.js +194 -0
- package/dist/vendor/engram-live/registration.d.ts +138 -0
- package/dist/vendor/engram-live/registration.js +360 -0
- package/package.json +4 -3
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* L6a (H) — durable local store for explicit live workspace declarations.
|
|
3
|
+
*
|
|
4
|
+
* DESIGN (LIVE §2, §12):
|
|
5
|
+
* - The declaration store is LOCAL h2a state under the injected h2a root
|
|
6
|
+
* (<root>/live/declarations.json), outside every observed worktree and
|
|
7
|
+
* its git-dir/common-dir. It is authoritative independently of the live
|
|
8
|
+
* projection: losing the projection never loses registrations, and the
|
|
9
|
+
* store is never a projection-owned surface.
|
|
10
|
+
* - Each record wraps the EXACT neutral WorkspaceDeclarationDto (flat
|
|
11
|
+
* identity triangle declarationId/cloneId/worktreeId, tenant,
|
|
12
|
+
* liveCapability, declarationRevision, flat product binding) plus the
|
|
13
|
+
* full local CloneIdentityDto/WorktreeIdentityDto (host-local realpath,
|
|
14
|
+
* git-dir and paths needed to operate; only the opaque ids cross to
|
|
15
|
+
* sentropic). Every write is validated with the engram validators — the
|
|
16
|
+
* runtime keeps no mirror of the contract, it imports the vendored
|
|
17
|
+
* neutral contracts entry (../vendor/engram-live, see the
|
|
18
|
+
* core live/contracts.ts header).
|
|
19
|
+
* - Writes are atomic (0600, tmp+rename) through a token-owned staging
|
|
20
|
+
* file; a corrupt store fails EXPLICITLY, it never silently
|
|
21
|
+
* restarts empty (that would erase desired live registrations). A
|
|
22
|
+
* pre-realignment (nested, `live-git-1`) store file is rejected
|
|
23
|
+
* EXPLICITLY as unsupported — never silently migrated, never silently
|
|
24
|
+
* read: L6a is not consumed yet, so no migration replay exists and the
|
|
25
|
+
* operator removes the file to start fresh.
|
|
26
|
+
* - Update is revision-guarded ATOMICALLY: the caller composes the next
|
|
27
|
+
* record through the contract rules (declarationRevision + 1, immutable
|
|
28
|
+
* identity triangle, binding renewal-or-preserved); the store verifies
|
|
29
|
+
* the guard, the triangle, the binding monotonicity (first binding
|
|
30
|
+
* exactly INITIAL_BINDING_REVISION, then strictly greater) and the
|
|
31
|
+
* final DTOs, then re-verifies the durable revision and persists under
|
|
32
|
+
* ONE exclusive lock. A stale writer is refused with the typed
|
|
33
|
+
* LiveRevisionConflict, never clobbering; a declaration removed after
|
|
34
|
+
* the read is never resurrected. Insert and remove hold the same lock,
|
|
35
|
+
* so every read-check-write (including removals) is serialized.
|
|
36
|
+
*/
|
|
37
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmdirSync, rmSync, statSync, writeFileSync, } from "node:fs";
|
|
38
|
+
import { randomUUID } from "node:crypto";
|
|
39
|
+
import { join } from "node:path";
|
|
40
|
+
import { INITIAL_BINDING_REVISION, validateCloneIdentity, validateWorkspaceDeclaration, validateWorktreeIdentity, } from "../vendor/engram-live/contracts.js";
|
|
41
|
+
export const LIVE_DECLARATION_KIND = "h2a-live-declaration";
|
|
42
|
+
export const LIVE_DECLARATION_SCHEMA_VERSION = 1;
|
|
43
|
+
/**
|
|
44
|
+
* Typed revision conflict: the durable declaration moved (or vanished)
|
|
45
|
+
* under a writer holding a stale base revision. The message keeps the
|
|
46
|
+
* `revision_conflict` marker; the name and the revision fields let callers
|
|
47
|
+
* branch on it without parsing text.
|
|
48
|
+
*/
|
|
49
|
+
export class LiveRevisionConflict extends Error {
|
|
50
|
+
declarationId;
|
|
51
|
+
expectedDeclarationRevision;
|
|
52
|
+
/** Current durable revision; undefined when the declaration is gone. */
|
|
53
|
+
actualDeclarationRevision;
|
|
54
|
+
constructor(declarationId, expectedDeclarationRevision, actualDeclarationRevision) {
|
|
55
|
+
super(actualDeclarationRevision === undefined
|
|
56
|
+
? `revision_conflict: live declaration ${declarationId} was removed; stale writer held declaration revision ${expectedDeclarationRevision}`
|
|
57
|
+
: `revision_conflict: live declaration ${declarationId} is at declaration revision ` +
|
|
58
|
+
`${actualDeclarationRevision}, stale writer held ${expectedDeclarationRevision}`);
|
|
59
|
+
this.name = "LiveRevisionConflict";
|
|
60
|
+
this.declarationId = declarationId;
|
|
61
|
+
this.expectedDeclarationRevision = expectedDeclarationRevision;
|
|
62
|
+
this.actualDeclarationRevision = actualDeclarationRevision;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
// Exclusive store lock (synchronous, no dependency).
|
|
67
|
+
// ---------------------------------------------------------------------------
|
|
68
|
+
//
|
|
69
|
+
// Every mutation (insert/update/remove) holds this lock from its read to
|
|
70
|
+
// its persisted rename, so no stale revision can slip between the guard
|
|
71
|
+
// check and the write — across processes as well as across store
|
|
72
|
+
// instances. The lock is an atomically created directory; acquisition
|
|
73
|
+
// retries briefly, recovers abandoned locks by age, then fails explicitly
|
|
74
|
+
// (never silently proceeding unlocked). Re-entry by the SAME process only
|
|
75
|
+
// bumps a counter: the pre-persist re-verification inside update() still
|
|
76
|
+
// rejects a same-process interleaving, so re-entrancy never hides a
|
|
77
|
+
// conflict. Each acquisition has a unique token directory: takeover removes
|
|
78
|
+
// that generation, including its staged writes. Even a holder suspended
|
|
79
|
+
// after its final fence check cannot rename a removed source into the store.
|
|
80
|
+
// Reads stay lock-free: the tmp+rename persistence is atomic,
|
|
81
|
+
// so readers always observe one whole committed file.
|
|
82
|
+
const STORE_LOCK_DIRNAME = ".declarations.lock";
|
|
83
|
+
const STORE_LOCK_TIMEOUT_MS = 5_000;
|
|
84
|
+
const STORE_LOCK_STALE_MS = 10_000;
|
|
85
|
+
const STORE_LOCK_POLL_MS = 5;
|
|
86
|
+
/** Re-entry shares the SAME generation, never a successor's token. */
|
|
87
|
+
const storeLocksHeld = new Map();
|
|
88
|
+
const lockDirFor = (root) => join(root, "live", STORE_LOCK_DIRNAME);
|
|
89
|
+
const sleepSync = (ms) => {
|
|
90
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
91
|
+
};
|
|
92
|
+
/** Remove only the observed generation; never recursively delete a successor. */
|
|
93
|
+
function removeStoreLockGeneration(dir, token) {
|
|
94
|
+
rmSync(join(dir, token), { recursive: true, force: true });
|
|
95
|
+
try {
|
|
96
|
+
rmdirSync(dir);
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
const code = error.code;
|
|
100
|
+
if (code !== "ENOENT" && code !== "ENOTEMPTY" && code !== "EEXIST")
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function acquireStoreLock(root) {
|
|
105
|
+
const dir = lockDirFor(root);
|
|
106
|
+
mkdirSync(join(root, "live"), { recursive: true });
|
|
107
|
+
const held = storeLocksHeld.get(dir);
|
|
108
|
+
if (held !== undefined) {
|
|
109
|
+
held.depth += 1;
|
|
110
|
+
return held;
|
|
111
|
+
}
|
|
112
|
+
const deadline = Date.now() + STORE_LOCK_TIMEOUT_MS;
|
|
113
|
+
for (;;) {
|
|
114
|
+
try {
|
|
115
|
+
mkdirSync(dir);
|
|
116
|
+
const lock = { token: randomUUID(), depth: 1 };
|
|
117
|
+
// No recursive mkdir: if takeover removed our parent in this window,
|
|
118
|
+
// acquisition must retry, never recreate a dispossessed generation.
|
|
119
|
+
mkdirSync(join(dir, lock.token));
|
|
120
|
+
storeLocksHeld.set(dir, lock);
|
|
121
|
+
return lock;
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
const code = error.code;
|
|
125
|
+
if (code !== "EEXIST" && code !== "ENOENT")
|
|
126
|
+
throw error;
|
|
127
|
+
}
|
|
128
|
+
// Age permits takeover, but does NOT prove the holder stopped. Invalidate
|
|
129
|
+
// only the generation observed before the age check. A competing cleanup
|
|
130
|
+
// cannot erase a newly acquired token or its staged write.
|
|
131
|
+
try {
|
|
132
|
+
const tokens = readdirSync(dir);
|
|
133
|
+
if (Date.now() - statSync(dir).mtimeMs > STORE_LOCK_STALE_MS) {
|
|
134
|
+
for (const token of tokens)
|
|
135
|
+
removeStoreLockGeneration(dir, token);
|
|
136
|
+
if (tokens.length === 0)
|
|
137
|
+
rmdirSync(dir);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
// The directory vanished under us; the next iteration retries.
|
|
142
|
+
}
|
|
143
|
+
if (Date.now() >= deadline) {
|
|
144
|
+
throw new Error(`live declarations store busy: cannot acquire lock at ${dir}`);
|
|
145
|
+
}
|
|
146
|
+
sleepSync(STORE_LOCK_POLL_MS);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function releaseStoreLock(root) {
|
|
150
|
+
const dir = lockDirFor(root);
|
|
151
|
+
const held = storeLocksHeld.get(dir);
|
|
152
|
+
if (held === undefined)
|
|
153
|
+
return;
|
|
154
|
+
if (held.depth > 1) {
|
|
155
|
+
held.depth -= 1;
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
storeLocksHeld.delete(dir);
|
|
159
|
+
removeStoreLockGeneration(dir, held.token);
|
|
160
|
+
}
|
|
161
|
+
function withStoreLock(root, fn) {
|
|
162
|
+
const lock = acquireStoreLock(root);
|
|
163
|
+
try {
|
|
164
|
+
return fn(lock);
|
|
165
|
+
}
|
|
166
|
+
finally {
|
|
167
|
+
releaseStoreLock(root);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** Structural validation of a record: envelope, triangle consistency, then the engram validators. */
|
|
171
|
+
const validateRecord = (record) => {
|
|
172
|
+
if (record.kind !== LIVE_DECLARATION_KIND)
|
|
173
|
+
return "unexpected declaration kind";
|
|
174
|
+
if (record.schemaVersion !== LIVE_DECLARATION_SCHEMA_VERSION) {
|
|
175
|
+
return "unsupported declaration schema version";
|
|
176
|
+
}
|
|
177
|
+
const declaration = validateWorkspaceDeclaration(record.declaration);
|
|
178
|
+
if (!declaration.ok)
|
|
179
|
+
return `invalid declaration: ${declaration.errors.join("; ")}`;
|
|
180
|
+
if (record.clone.cloneId !== record.declaration.cloneId) {
|
|
181
|
+
return "clone/worktree attachment mismatch: clone.cloneId differs from declaration.cloneId";
|
|
182
|
+
}
|
|
183
|
+
if (record.worktree.cloneId !== record.declaration.cloneId) {
|
|
184
|
+
return "clone/worktree attachment mismatch: worktree.cloneId differs from declaration.cloneId";
|
|
185
|
+
}
|
|
186
|
+
if (record.worktree.worktreeId !== record.declaration.worktreeId) {
|
|
187
|
+
return "clone/worktree attachment mismatch: worktree.worktreeId differs from declaration.worktreeId";
|
|
188
|
+
}
|
|
189
|
+
const clone = validateCloneIdentity(record.clone);
|
|
190
|
+
if (!clone.ok)
|
|
191
|
+
return `invalid clone identity: ${clone.errors.join("; ")}`;
|
|
192
|
+
const worktree = validateWorktreeIdentity(record.worktree);
|
|
193
|
+
if (!worktree.ok)
|
|
194
|
+
return `invalid worktree identity: ${worktree.errors.join("; ")}`;
|
|
195
|
+
for (const field of ["createdAt", "activatedAt", "updatedAt"]) {
|
|
196
|
+
if (typeof record[field] !== "string" || record[field].length === 0) {
|
|
197
|
+
return `missing ${field}`;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return undefined;
|
|
201
|
+
};
|
|
202
|
+
const isRecord = (value) => {
|
|
203
|
+
if (typeof value !== "object" || value === null)
|
|
204
|
+
return false;
|
|
205
|
+
const record = value;
|
|
206
|
+
if (record.kind !== LIVE_DECLARATION_KIND ||
|
|
207
|
+
record.schemaVersion !== LIVE_DECLARATION_SCHEMA_VERSION ||
|
|
208
|
+
typeof record.declaration !== "object" ||
|
|
209
|
+
record.declaration === null ||
|
|
210
|
+
typeof record.clone !== "object" ||
|
|
211
|
+
record.clone === null ||
|
|
212
|
+
typeof record.worktree !== "object" ||
|
|
213
|
+
record.worktree === null ||
|
|
214
|
+
typeof record.declaration.declarationId !== "string") {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
return validateRecord(record) === undefined;
|
|
218
|
+
};
|
|
219
|
+
/** Pre-realignment entries (nested shape, top-level hostScope/revision, no neutral DTO) are never read as records. */
|
|
220
|
+
const isLegacyRecord = (value) => {
|
|
221
|
+
if (typeof value !== "object" || value === null)
|
|
222
|
+
return false;
|
|
223
|
+
const record = value;
|
|
224
|
+
return ("hostScope" in record ||
|
|
225
|
+
("declarationId" in record && !("declaration" in record)));
|
|
226
|
+
};
|
|
227
|
+
/** Durable declarations live under the injected h2a root, never a worktree. */
|
|
228
|
+
export function liveDeclarationsPath(root) {
|
|
229
|
+
return join(root, "live", "declarations.json");
|
|
230
|
+
}
|
|
231
|
+
const readStoreFile = (root) => {
|
|
232
|
+
const path = liveDeclarationsPath(root);
|
|
233
|
+
if (!existsSync(path)) {
|
|
234
|
+
return { kind: "h2a-live-declarations", version: 1, declarations: [] };
|
|
235
|
+
}
|
|
236
|
+
let parsed;
|
|
237
|
+
try {
|
|
238
|
+
parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
// Explicit failure: a corrupt declaration store must never be treated
|
|
242
|
+
// as an empty registry (LIVE §12: database loss must not erase live
|
|
243
|
+
// registrations; silent loss is worse).
|
|
244
|
+
throw new Error(`live declarations store unreadable at ${path}: ${error.message}`);
|
|
245
|
+
}
|
|
246
|
+
if (typeof parsed !== "object" ||
|
|
247
|
+
parsed === null ||
|
|
248
|
+
parsed.kind !== "h2a-live-declarations" ||
|
|
249
|
+
parsed.version !== 1 ||
|
|
250
|
+
!Array.isArray(parsed.declarations)) {
|
|
251
|
+
throw new Error(`live declarations store invalid at ${path}`);
|
|
252
|
+
}
|
|
253
|
+
const file = parsed;
|
|
254
|
+
for (const entry of file.declarations) {
|
|
255
|
+
if (isLegacyRecord(entry)) {
|
|
256
|
+
throw new Error(`live declarations store uses the pre-realignment L6a format at ${path}: ` +
|
|
257
|
+
`remove the file to start fresh (L6a is not consumed yet; no migration replay exists)`);
|
|
258
|
+
}
|
|
259
|
+
if (!isRecord(entry)) {
|
|
260
|
+
throw new Error(`live declarations store contains a malformed declaration at ${path}`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return file;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* A store instance is a thin read-through over the durable file: every
|
|
267
|
+
* operation re-reads, so two instances (or two processes) on the same root
|
|
268
|
+
* observe each other's committed writes.
|
|
269
|
+
*/
|
|
270
|
+
export function createLiveDeclarationStore(root) {
|
|
271
|
+
const load = () => readStoreFile(root).declarations;
|
|
272
|
+
const persist = (lock, expected, declarations, declarationId, expectedRevision) => {
|
|
273
|
+
const generation = join(lockDirFor(root), lock.token);
|
|
274
|
+
const tmp = join(generation, `${randomUUID()}.tmp`);
|
|
275
|
+
const conflict = () => new LiveRevisionConflict(declarationId, expectedRevision, load().find((record) => record.declaration.declarationId === declarationId)
|
|
276
|
+
?.declaration.declarationRevision);
|
|
277
|
+
const file = {
|
|
278
|
+
kind: "h2a-live-declarations",
|
|
279
|
+
version: 1,
|
|
280
|
+
declarations: [...declarations],
|
|
281
|
+
};
|
|
282
|
+
try {
|
|
283
|
+
if (!existsSync(generation))
|
|
284
|
+
throw conflict();
|
|
285
|
+
// The source belongs to this unique token and cannot survive takeover.
|
|
286
|
+
// Never mkdir here: a dispossessed holder must not recreate its source.
|
|
287
|
+
writeFileSync(tmp, JSON.stringify(file, null, 2) + "\n", { mode: 0o600, flag: "wx" });
|
|
288
|
+
const fresh = load();
|
|
289
|
+
if (!existsSync(generation) || JSON.stringify(fresh) !== JSON.stringify(expected)) {
|
|
290
|
+
throw conflict();
|
|
291
|
+
}
|
|
292
|
+
// Atomic rename is the commit point. A suspension AFTER the checks
|
|
293
|
+
// above is fenced by takeover removing this generation's source file.
|
|
294
|
+
renameSync(tmp, liveDeclarationsPath(root));
|
|
295
|
+
}
|
|
296
|
+
catch (error) {
|
|
297
|
+
// Cleanup can unlink the source before removing its directory.
|
|
298
|
+
if (error.code === "ENOENT" || !existsSync(generation)) {
|
|
299
|
+
throw conflict();
|
|
300
|
+
}
|
|
301
|
+
throw error;
|
|
302
|
+
}
|
|
303
|
+
finally {
|
|
304
|
+
rmSync(tmp, { force: true });
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
return {
|
|
308
|
+
list() {
|
|
309
|
+
return [...load()].sort((a, b) => a.declaration.declarationId < b.declaration.declarationId
|
|
310
|
+
? -1
|
|
311
|
+
: a.declaration.declarationId > b.declaration.declarationId
|
|
312
|
+
? 1
|
|
313
|
+
: 0);
|
|
314
|
+
},
|
|
315
|
+
get(declarationId) {
|
|
316
|
+
return load().find((record) => record.declaration.declarationId === declarationId);
|
|
317
|
+
},
|
|
318
|
+
findByPath(path) {
|
|
319
|
+
return load().find((record) => record.declaration.authorizedRoots.includes(path));
|
|
320
|
+
},
|
|
321
|
+
insert(record) {
|
|
322
|
+
const problem = validateRecord(record);
|
|
323
|
+
if (problem !== undefined) {
|
|
324
|
+
throw new Error(`invalid live declaration record: ${problem}`);
|
|
325
|
+
}
|
|
326
|
+
withStoreLock(root, (lock) => {
|
|
327
|
+
const declarations = load();
|
|
328
|
+
if (declarations.some((existing) => existing.declaration.declarationId === record.declaration.declarationId)) {
|
|
329
|
+
throw new Error(`live declaration already exists: ${record.declaration.declarationId}`);
|
|
330
|
+
}
|
|
331
|
+
persist(lock, declarations, [...declarations, record], record.declaration.declarationId, record.declaration.declarationRevision);
|
|
332
|
+
});
|
|
333
|
+
},
|
|
334
|
+
update(declarationId, expectedDeclarationRevision, mutate) {
|
|
335
|
+
return withStoreLock(root, (lock) => {
|
|
336
|
+
const declarations = load();
|
|
337
|
+
const index = declarations.findIndex((record) => record.declaration.declarationId === declarationId);
|
|
338
|
+
if (index === -1) {
|
|
339
|
+
throw new Error(`unknown live declaration: ${declarationId}`);
|
|
340
|
+
}
|
|
341
|
+
const current = declarations[index];
|
|
342
|
+
if (current.declaration.declarationRevision !== expectedDeclarationRevision) {
|
|
343
|
+
throw new LiveRevisionConflict(declarationId, expectedDeclarationRevision, current.declaration.declarationRevision);
|
|
344
|
+
}
|
|
345
|
+
const next = mutate(current);
|
|
346
|
+
if (next.declaration.declarationId !== declarationId) {
|
|
347
|
+
throw new Error(`update must not change declarationId: ${declarationId}`);
|
|
348
|
+
}
|
|
349
|
+
if (next.declaration.declarationRevision !== expectedDeclarationRevision + 1) {
|
|
350
|
+
throw new Error(`update must advance declarationRevision by exactly one: held ${expectedDeclarationRevision}`);
|
|
351
|
+
}
|
|
352
|
+
for (const field of [
|
|
353
|
+
"tenant",
|
|
354
|
+
"principal",
|
|
355
|
+
"hostFingerprint",
|
|
356
|
+
"cloneId",
|
|
357
|
+
"worktreeId",
|
|
358
|
+
"liveCapability",
|
|
359
|
+
]) {
|
|
360
|
+
if (next.declaration[field] !== current.declaration[field]) {
|
|
361
|
+
throw new Error(`update must not change declaration identity field "${field}": ${declarationId}`);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
// Binding renewal-or-preserved: a workspace/issuer/revision change
|
|
365
|
+
// renews the binding (complete triplet, first binding exactly
|
|
366
|
+
// INITIAL_BINDING_REVISION, then strictly greater); any other
|
|
367
|
+
// mutation preserves it.
|
|
368
|
+
const previous = current.declaration;
|
|
369
|
+
const candidate = next.declaration;
|
|
370
|
+
const workspaceChanged = candidate.serverWorkspaceId !== previous.serverWorkspaceId;
|
|
371
|
+
const issuerChanged = candidate.serverIssuer !== previous.serverIssuer;
|
|
372
|
+
const revisionTouched = candidate.bindingRevision !== previous.bindingRevision;
|
|
373
|
+
if (workspaceChanged || issuerChanged || revisionTouched) {
|
|
374
|
+
if (candidate.serverWorkspaceId === undefined ||
|
|
375
|
+
candidate.serverIssuer === undefined ||
|
|
376
|
+
candidate.bindingRevision === undefined) {
|
|
377
|
+
throw new Error(`update must carry the complete serverWorkspaceId + serverIssuer + bindingRevision triplet when the binding changes: ${declarationId}`);
|
|
378
|
+
}
|
|
379
|
+
if (previous.bindingRevision === undefined) {
|
|
380
|
+
if (candidate.bindingRevision !== INITIAL_BINDING_REVISION) {
|
|
381
|
+
throw new Error(`update must carry bindingRevision ${INITIAL_BINDING_REVISION} for the first product binding: ${declarationId}`);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
else if (candidate.bindingRevision <= previous.bindingRevision) {
|
|
385
|
+
throw new Error(`update must carry a strictly increasing bindingRevision: ${declarationId}`);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
const problem = validateRecord(next);
|
|
389
|
+
if (problem !== undefined) {
|
|
390
|
+
throw new Error(`invalid updated live declaration record: ${problem}`);
|
|
391
|
+
}
|
|
392
|
+
// Atomic compare-and-write under the same lock: re-read the durable
|
|
393
|
+
// file and refuse when the declaration moved (a concurrent writer
|
|
394
|
+
// committed inside mutate()) or vanished (an interleaved removal).
|
|
395
|
+
// The merge applies onto the FRESH list, so unrelated concurrent
|
|
396
|
+
// records are never dropped; a stale write never clobbers and a
|
|
397
|
+
// removed declaration never resurrects.
|
|
398
|
+
const fresh = load();
|
|
399
|
+
const refetch = fresh.find((record) => record.declaration.declarationId === declarationId);
|
|
400
|
+
if (refetch === undefined) {
|
|
401
|
+
throw new LiveRevisionConflict(declarationId, expectedDeclarationRevision, undefined);
|
|
402
|
+
}
|
|
403
|
+
if (refetch.declaration.declarationRevision !== expectedDeclarationRevision) {
|
|
404
|
+
throw new LiveRevisionConflict(declarationId, expectedDeclarationRevision, refetch.declaration.declarationRevision);
|
|
405
|
+
}
|
|
406
|
+
persist(lock, fresh, fresh.map((record) => record.declaration.declarationId === declarationId ? next : record), declarationId, expectedDeclarationRevision);
|
|
407
|
+
return next;
|
|
408
|
+
});
|
|
409
|
+
},
|
|
410
|
+
remove(declarationId) {
|
|
411
|
+
return withStoreLock(root, (lock) => {
|
|
412
|
+
const declarations = load();
|
|
413
|
+
const remaining = declarations.filter((record) => record.declaration.declarationId !== declarationId);
|
|
414
|
+
if (remaining.length === declarations.length)
|
|
415
|
+
return false;
|
|
416
|
+
persist(lock, declarations, remaining, declarationId, declarations.find((record) => record.declaration.declarationId === declarationId)
|
|
417
|
+
.declaration.declarationRevision);
|
|
418
|
+
return true;
|
|
419
|
+
});
|
|
420
|
+
},
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
//# sourceMappingURL=live-declarations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-declarations.js","sourceRoot":"","sources":["../../src/gateway-host/live-declarations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,WAAW,EACX,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACR,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,oCAAoC,CAAC;AAO5C,MAAM,CAAC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAC5D,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,aAAa,CAAS;IACtB,2BAA2B,CAAS;IAC7C,wEAAwE;IAC/D,yBAAyB,CAAqB;IAEvD,YACE,aAAqB,EACrB,2BAAmC,EACnC,yBAA6C;QAE7C,KAAK,CACH,yBAAyB,KAAK,SAAS;YACrC,CAAC,CAAC,uCAAuC,aAAa,wDAAwD,2BAA2B,EAAE;YAC3I,CAAC,CAAC,uCAAuC,aAAa,8BAA8B;gBAChF,GAAG,yBAAyB,uBAAuB,2BAA2B,EAAE,CACvF,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAA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;gBACF,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { NON_ACTIVATING_LIFECYCLE_KINDS } from "../vendor/engram-live/contracts.js";
|
|
2
|
+
import type { DeclarationRevocationDto, IdentityUncertaintyState, NonActivatingLifecycleKind, OidAlgorithm, RevocationReason } from "../vendor/engram-live/contracts.js";
|
|
3
|
+
import { type LiveDeclarationRecord } from "./live-declarations.js";
|
|
4
|
+
export declare function normalizeRootCommits(shas: ReadonlyArray<string>): string;
|
|
5
|
+
export declare function computeDurableWorkspaceId(rootCommitSHA: string, worktreeRelPath: string): string;
|
|
6
|
+
export interface LiveWorkspaceProbe {
|
|
7
|
+
/** Authorized root: resolved real path of the observed worktree. */
|
|
8
|
+
readonly worktreeRealpath: string;
|
|
9
|
+
/** Resolved git-dir (`.git/worktrees/<name>` for a linked worktree). */
|
|
10
|
+
readonly gitDir: string;
|
|
11
|
+
/** Resolved common-dir real path, shared by linked worktrees. */
|
|
12
|
+
readonly commonDirRealpath: string;
|
|
13
|
+
/** "" for the main worktree, else the linked-worktree name. */
|
|
14
|
+
readonly worktreeName: string;
|
|
15
|
+
/** Repository object format; undefined when Git cannot report it. */
|
|
16
|
+
readonly oidAlgorithm?: OidAlgorithm;
|
|
17
|
+
/** Normalized root commits; undefined when history is missing. */
|
|
18
|
+
readonly rootCommits?: string;
|
|
19
|
+
/** Preserved public `ws:` fingerprint; absent with missing_history. */
|
|
20
|
+
readonly workspaceFingerprint?: string;
|
|
21
|
+
/** Project fingerprint (empty main-worktree component); may be absent. */
|
|
22
|
+
readonly projectFingerprint?: string;
|
|
23
|
+
/** A `shallow` graft file exists in the common dir. */
|
|
24
|
+
readonly shallow: boolean;
|
|
25
|
+
/** Explicit identity/coverage uncertainty labels, never silent. */
|
|
26
|
+
readonly identityUncertainty: readonly IdentityUncertaintyState[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Probe a worktree's live identity with read-only Git plumbing. Every
|
|
30
|
+
* invocation disables optional locks (`--no-optional-locks`, LIVE §7) and
|
|
31
|
+
* never writes to the observed worktree, its index or its refs. Returns
|
|
32
|
+
* undefined when the path is not a Git worktree; missing (unborn HEAD) or
|
|
33
|
+
* shallow history is a successful probe with explicit uncertainty.
|
|
34
|
+
*/
|
|
35
|
+
export declare function probeLiveWorkspace(cwd: string): LiveWorkspaceProbe | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Classify a host lifecycle event against live declarations. Bind, upload,
|
|
38
|
+
* code-workspace creation and session open/end never activate or remove a
|
|
39
|
+
* declaration: the only outcome is "no-activation-change". Unknown kinds
|
|
40
|
+
* are refused. Pinned to NON_ACTIVATING_LIFECYCLE_KINDS, never a copy.
|
|
41
|
+
*/
|
|
42
|
+
export declare function classifyLifecycleEvent(kind: NonActivatingLifecycleKind): "no-activation-change";
|
|
43
|
+
export type LiveOperation = "activate" | "list" | "status" | "resolve" | "remove" | "remove-clone" | "rebind" | "replay";
|
|
44
|
+
export interface LiveAuthorizationRequest {
|
|
45
|
+
readonly operation: LiveOperation;
|
|
46
|
+
/** Stable local scope `local:<host-owner-id>`; never a sentropic tenant. */
|
|
47
|
+
readonly tenant: string;
|
|
48
|
+
readonly path?: string;
|
|
49
|
+
readonly declarationId?: string;
|
|
50
|
+
readonly hostFingerprint?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface LiveAuthorizationDecision {
|
|
53
|
+
readonly ok: boolean;
|
|
54
|
+
readonly reason?: string;
|
|
55
|
+
readonly principal?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface LiveAuthority {
|
|
58
|
+
authorize(request: LiveAuthorizationRequest): LiveAuthorizationDecision;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Default authority until L7a: deny everything explicitly. Local identity
|
|
62
|
+
* verification is L7a work; until it exists, no declaration API is usable,
|
|
63
|
+
* and denial is an error — never a successful empty result (A01).
|
|
64
|
+
*/
|
|
65
|
+
export declare const unverifiedLocalLiveAuthority: LiveAuthority;
|
|
66
|
+
export interface LiveWorkScope {
|
|
67
|
+
readonly declarationId: string;
|
|
68
|
+
readonly cloneId: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Cancellation/purge seam. Removal stops scheduled (delayed) work and
|
|
72
|
+
* requests a purge of PRIVATE local snapshots and derived indexes only;
|
|
73
|
+
* authorized committed history is never deleted by live (LIVE §10).
|
|
74
|
+
*/
|
|
75
|
+
export interface LiveWorkController {
|
|
76
|
+
cancelScheduledWork(scope: LiveWorkScope): boolean;
|
|
77
|
+
requestPrivatePurge(scope: LiveWorkScope): boolean;
|
|
78
|
+
hasInFlightWork(scope: LiveWorkScope): boolean;
|
|
79
|
+
}
|
|
80
|
+
export declare const inertLiveWorkController: LiveWorkController;
|
|
81
|
+
export declare class LiveAccessRefused extends Error {
|
|
82
|
+
readonly operation: LiveOperation;
|
|
83
|
+
readonly reason: string;
|
|
84
|
+
constructor(operation: LiveOperation, reason: string);
|
|
85
|
+
}
|
|
86
|
+
export interface LiveRegistrationOptions {
|
|
87
|
+
/** Durable h2a root (outside every observed worktree); injected, never a worktree. */
|
|
88
|
+
readonly root: string;
|
|
89
|
+
/**
|
|
90
|
+
* Stable local scope `local:<host-owner-id>`; defaults to the OS owner.
|
|
91
|
+
* PROVISIONAL until L7a supplies the verified owner scope — never a
|
|
92
|
+
* sentropic tenant inferred from a workspace id.
|
|
93
|
+
*/
|
|
94
|
+
readonly tenant?: string;
|
|
95
|
+
/** Authority seam; defaults to {@link unverifiedLocalLiveAuthority} (L7a completes verification). */
|
|
96
|
+
readonly authority?: LiveAuthority;
|
|
97
|
+
/** Work-control seam; defaults to {@link inertLiveWorkController}. */
|
|
98
|
+
readonly workController?: LiveWorkController;
|
|
99
|
+
/** Injectable clock for deterministic timestamps. */
|
|
100
|
+
readonly now?: () => string;
|
|
101
|
+
}
|
|
102
|
+
export interface ActivateLiveRequest {
|
|
103
|
+
readonly path: string;
|
|
104
|
+
}
|
|
105
|
+
export interface RemoveLiveRequest {
|
|
106
|
+
readonly path: string;
|
|
107
|
+
/** Mandatory: every revocation names its reason (contract DTO). */
|
|
108
|
+
readonly reason: RevocationReason;
|
|
109
|
+
}
|
|
110
|
+
export interface RemoveCloneLiveRequest {
|
|
111
|
+
readonly cloneId: string;
|
|
112
|
+
/** Mandatory: every revocation names its reason (contract DTO). */
|
|
113
|
+
readonly reason: RevocationReason;
|
|
114
|
+
}
|
|
115
|
+
export interface RebindLiveRequest {
|
|
116
|
+
readonly path: string;
|
|
117
|
+
readonly sentropicWorkspaceId: string;
|
|
118
|
+
readonly issuer: string;
|
|
119
|
+
}
|
|
120
|
+
export interface RemoveLiveResult {
|
|
121
|
+
readonly removed: boolean;
|
|
122
|
+
readonly canceledWork: boolean;
|
|
123
|
+
readonly purgeRequested: boolean;
|
|
124
|
+
/** The contract revocation, present exactly when a declaration was removed. */
|
|
125
|
+
readonly revocation?: DeclarationRevocationDto;
|
|
126
|
+
}
|
|
127
|
+
export interface RemoveCloneLiveResult {
|
|
128
|
+
/** Number of declarations revoked. */
|
|
129
|
+
readonly removed: number;
|
|
130
|
+
/** One contract revocation per revoked declaration, in declarationId order. */
|
|
131
|
+
readonly revocations: readonly DeclarationRevocationDto[];
|
|
132
|
+
readonly canceledWork: boolean;
|
|
133
|
+
readonly purgeRequested: boolean;
|
|
134
|
+
}
|
|
135
|
+
export interface ResolvedLivePath {
|
|
136
|
+
readonly declaration: LiveDeclarationRecord;
|
|
137
|
+
readonly relativePath: string;
|
|
138
|
+
}
|
|
139
|
+
export interface LiveRegistration {
|
|
140
|
+
readonly authority: LiveAuthority;
|
|
141
|
+
probe(cwd: string): LiveWorkspaceProbe | undefined;
|
|
142
|
+
/** Explicit activation, once per worktree; idempotent re-activation replays the existing declaration. */
|
|
143
|
+
activate(request: ActivateLiveRequest): {
|
|
144
|
+
declaration: LiveDeclarationRecord;
|
|
145
|
+
created: boolean;
|
|
146
|
+
};
|
|
147
|
+
list(): readonly LiveDeclarationRecord[];
|
|
148
|
+
status(path: string): LiveDeclarationRecord | undefined;
|
|
149
|
+
/** Path-resolution seam: the declaration covering `path`, with its relative path. */
|
|
150
|
+
resolvePath(path: string): ResolvedLivePath | undefined;
|
|
151
|
+
/** Stop work, cancel delayed jobs, revoke the declaration with its reason, request a private purge, then unregister. */
|
|
152
|
+
remove(request: RemoveLiveRequest): RemoveLiveResult;
|
|
153
|
+
/** Withdraw a whole clone: revoke EACH of its declarations, one revocation each. */
|
|
154
|
+
removeClone(request: RemoveCloneLiveRequest): RemoveCloneLiveResult;
|
|
155
|
+
/** Server/issuer-bound product live intent; requires fresh revalidation, bumps the binding revision. */
|
|
156
|
+
rebind(request: RebindLiveRequest): LiveDeclarationRecord;
|
|
157
|
+
/** Host-startup replay of durable declarations, without renewed activation. */
|
|
158
|
+
replay(): readonly LiveDeclarationRecord[];
|
|
159
|
+
}
|
|
160
|
+
export declare function createLiveRegistration(options: LiveRegistrationOptions): LiveRegistration;
|
|
161
|
+
export { NON_ACTIVATING_LIFECYCLE_KINDS };
|
|
162
|
+
//# sourceMappingURL=live-registration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-registration.d.ts","sourceRoot":"","sources":["../../src/gateway-host/live-registration.ts"],"names":[],"mappings":"AA4CA,OAAO,EAGL,8BAA8B,EAM/B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAEV,wBAAwB,EACxB,wBAAwB,EACxB,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,EAGjB,MAAM,oCAAoC,CAAC;AAO5C,OAAO,EAIL,KAAK,qBAAqB,EAE3B,MAAM,wBAAwB,CAAC;AAUhC,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAIxE;AAED,wBAAgB,yBAAyB,CACvC,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,GACt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