@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,455 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* L6a (H) — explicit live workspace registration (composition seam).
|
|
3
|
+
*
|
|
4
|
+
* DESIGN (LIVE §2–3, §10, §12; owner decision Q4 = A):
|
|
5
|
+
* - Activation is EXPLICIT and once per worktree: bind, transcript upload,
|
|
6
|
+
* code-workspace creation and agent sessions are never inputs here, and
|
|
7
|
+
* nothing in this module observes sessions at all. Session end never
|
|
8
|
+
* unregisters; host restart replays durable declarations.
|
|
9
|
+
* - The durable declaration store is LOCAL h2a state (see
|
|
10
|
+
* ./live-declarations.ts); it is never the product workspace router and
|
|
11
|
+
* never projection-owned.
|
|
12
|
+
* - Identities are minted ONLY through the three canonical public
|
|
13
|
+
* derivations from the vendored neutral integration entry
|
|
14
|
+
* (../vendor/engram-live, see the core live/contracts.ts header), so
|
|
15
|
+
* H ids are byte-identical to the engram (E) side for identical inputs:
|
|
16
|
+
* equal fingerprints under different realpaths derive distinct clones,
|
|
17
|
+
* while linked worktrees sharing one common-dir derive the same clone.
|
|
18
|
+
* Missing/shallow history is explicit uncertainty, never a
|
|
19
|
+
* URL/fingerprint-only merge.
|
|
20
|
+
* - The public `ws:` worktree/project fingerprint is H's own preserved
|
|
21
|
+
* fingerprint (spec §12: keep the existing derivation byte-identical);
|
|
22
|
+
* the two helpers below are its only copy, forced by the core/runtime
|
|
23
|
+
* boundary (no static runtime→core import), and pinned byte-identical
|
|
24
|
+
* to core by live-registration.test.ts. They compute fingerprints, never
|
|
25
|
+
* opaque ids: every cloneId/worktreeId/declarationId comes from the
|
|
26
|
+
* package.
|
|
27
|
+
* - Local authority is a seam with NO fallback: a positive authorization
|
|
28
|
+
* without a verified principal is refused explicitly
|
|
29
|
+
* (`verified_principal_required`) before any neutral DTO is built — for
|
|
30
|
+
* reads as well as activation (spec §12). The default authority DENIES
|
|
31
|
+
* every operation explicitly (`local_authority_unavailable`) until L7a
|
|
32
|
+
* supplies verified local principals and the stable owner scope.
|
|
33
|
+
* Refusal is an error, never a successful empty result.
|
|
34
|
+
* - Removal and clone withdrawal stop work first (cancellation seam),
|
|
35
|
+
* then return the contract revocation (exact declarationId, tenant,
|
|
36
|
+
* clone/worktree attachment, declarationRevision, reason, full private
|
|
37
|
+
* purge request); committed history is never touched.
|
|
38
|
+
*/
|
|
39
|
+
import { execFileSync } from "node:child_process";
|
|
40
|
+
import { createHash } from "node:crypto";
|
|
41
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
42
|
+
import { userInfo } from "node:os";
|
|
43
|
+
import { basename, isAbsolute, resolve } from "node:path";
|
|
44
|
+
import { EXPLICIT_LIVE_CAPABILITY, INITIAL_DECLARATION_REVISION, NON_ACTIVATING_LIFECYCLE_KINDS, POLICY_VERSION, isIdentityUncertaintyState, isNonActivatingLifecycleKind, validateDeclarationRevocation, validateWorkspaceDeclaration, } from "../vendor/engram-live/contracts.js";
|
|
45
|
+
import { deriveCloneIdentity, deriveDeclarationIdentity, deriveWorktreeIdentity, } from "../vendor/engram-live/integration.js";
|
|
46
|
+
import { LIVE_DECLARATION_KIND, LIVE_DECLARATION_SCHEMA_VERSION, createLiveDeclarationStore, } from "./live-declarations.js";
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// H-public `ws:` fingerprint (LIVE §12: preserved byte-identical).
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
//
|
|
51
|
+
// The ONLY runtime copy of the core derivation (core/runtime boundary
|
|
52
|
+
// forbids a static runtime→core import). Fingerprints only: opaque ids are
|
|
53
|
+
// minted exclusively through the canonical package derivations above.
|
|
54
|
+
export function normalizeRootCommits(shas) {
|
|
55
|
+
return [...new Set(shas.map((s) => s.trim()).filter((s) => s.length > 0))]
|
|
56
|
+
.sort()
|
|
57
|
+
.join(",");
|
|
58
|
+
}
|
|
59
|
+
export function computeDurableWorkspaceId(rootCommitSHA, worktreeRelPath) {
|
|
60
|
+
const hex = createHash("sha256")
|
|
61
|
+
.update(`${rootCommitSHA}\n${worktreeRelPath}`, "utf8")
|
|
62
|
+
.digest("hex");
|
|
63
|
+
return `ws:${hex}`;
|
|
64
|
+
}
|
|
65
|
+
const resolveWithin = (base, path) => {
|
|
66
|
+
if (isAbsolute(path))
|
|
67
|
+
return path;
|
|
68
|
+
return resolve(base, path);
|
|
69
|
+
};
|
|
70
|
+
const realpathOr = (path, fallback) => {
|
|
71
|
+
try {
|
|
72
|
+
return realpathSync(path);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return fallback;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Probe a worktree's live identity with read-only Git plumbing. Every
|
|
80
|
+
* invocation disables optional locks (`--no-optional-locks`, LIVE §7) and
|
|
81
|
+
* never writes to the observed worktree, its index or its refs. Returns
|
|
82
|
+
* undefined when the path is not a Git worktree; missing (unborn HEAD) or
|
|
83
|
+
* shallow history is a successful probe with explicit uncertainty.
|
|
84
|
+
*/
|
|
85
|
+
export function probeLiveWorkspace(cwd) {
|
|
86
|
+
const worktreeRealpath = realpathOr(cwd, resolve(cwd));
|
|
87
|
+
const spawnOpts = {
|
|
88
|
+
cwd: worktreeRealpath,
|
|
89
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
90
|
+
timeout: 5000,
|
|
91
|
+
windowsHide: true,
|
|
92
|
+
};
|
|
93
|
+
const run = (args) => {
|
|
94
|
+
try {
|
|
95
|
+
const out = execFileSync("git", ["--no-optional-locks", "-C", worktreeRealpath, ...args], spawnOpts)
|
|
96
|
+
.toString("utf8")
|
|
97
|
+
.trim();
|
|
98
|
+
return out.length > 0 ? out : undefined;
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
// --- git-dir / common-dir (resolve relative outputs against the root) ---
|
|
105
|
+
const gitDirRaw = run(["rev-parse", "--git-dir"]);
|
|
106
|
+
const commonDirRaw = run(["rev-parse", "--git-common-dir"]);
|
|
107
|
+
if (gitDirRaw === undefined || commonDirRaw === undefined)
|
|
108
|
+
return undefined;
|
|
109
|
+
const gitDir = realpathOr(resolveWithin(worktreeRealpath, gitDirRaw), gitDirRaw);
|
|
110
|
+
const commonDirRealpath = realpathOr(resolveWithin(worktreeRealpath, commonDirRaw), commonDirRaw);
|
|
111
|
+
const worktreeName = gitDir === commonDirRealpath ? "" : basename(gitDir);
|
|
112
|
+
// --- object format (required to mint a contract-valid clone identity) ---
|
|
113
|
+
const objectFormat = run(["rev-parse", "--show-object-format"]);
|
|
114
|
+
const oidAlgorithm = objectFormat === "sha1" || objectFormat === "sha256" ? objectFormat : undefined;
|
|
115
|
+
// --- root commits of this worktree's HEAD (absent on unborn HEAD) ---
|
|
116
|
+
// HEAD-bound by design: this feeds the public per-worktree `ws:`
|
|
117
|
+
// fingerprint only, never the clone key.
|
|
118
|
+
const rootCommitLines = run(["rev-list", "--max-parents=0", "HEAD"]);
|
|
119
|
+
const rootCommits = rootCommitLines === undefined ? undefined : normalizeRootCommits(rootCommitLines.split(/\r?\n/));
|
|
120
|
+
// --- common-dir history roots (HEAD-independent clone key, spec §12) ---
|
|
121
|
+
// The union of root commits over every ref in the shared common-dir,
|
|
122
|
+
// identical from every worktree of the clone whatever its HEAD (an
|
|
123
|
+
// orphan branch checked out in one worktree must not fork the clone).
|
|
124
|
+
// HEAD itself is deliberately excluded: it is per-worktree state.
|
|
125
|
+
const refTipLines = run(["for-each-ref", "--format=%(objectname)"]);
|
|
126
|
+
const refTips = refTipLines === undefined
|
|
127
|
+
? []
|
|
128
|
+
: refTipLines
|
|
129
|
+
.split(/\r?\n/)
|
|
130
|
+
.map((tip) => tip.trim())
|
|
131
|
+
.filter((tip) => tip.length > 0);
|
|
132
|
+
let cloneRootCommits;
|
|
133
|
+
if (refTips.length > 0) {
|
|
134
|
+
const cloneRootLines = run(["rev-list", "--max-parents=0", ...refTips]);
|
|
135
|
+
cloneRootCommits =
|
|
136
|
+
cloneRootLines === undefined
|
|
137
|
+
? undefined
|
|
138
|
+
: normalizeRootCommits(cloneRootLines.split(/\r?\n/));
|
|
139
|
+
}
|
|
140
|
+
const shallow = existsSync(resolve(commonDirRealpath.startsWith("/") ? commonDirRealpath : resolveWithin(worktreeRealpath, commonDirRealpath), "shallow"));
|
|
141
|
+
const identityUncertainty = [];
|
|
142
|
+
if (rootCommits === undefined) {
|
|
143
|
+
identityUncertainty.push("missing_history");
|
|
144
|
+
}
|
|
145
|
+
// The clone fingerprint may be absent only under explicit
|
|
146
|
+
// missing_history uncertainty (engram contract): when the common-dir
|
|
147
|
+
// holds no ref history at all, say so even if this worktree's HEAD
|
|
148
|
+
// somehow resolves.
|
|
149
|
+
if (cloneRootCommits === undefined && !identityUncertainty.includes("missing_history")) {
|
|
150
|
+
identityUncertainty.push("missing_history");
|
|
151
|
+
}
|
|
152
|
+
if (shallow) {
|
|
153
|
+
identityUncertainty.push("shallow_history");
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
worktreeRealpath,
|
|
157
|
+
gitDir,
|
|
158
|
+
commonDirRealpath,
|
|
159
|
+
worktreeName,
|
|
160
|
+
...(oidAlgorithm !== undefined ? { oidAlgorithm } : {}),
|
|
161
|
+
...(rootCommits !== undefined ? { rootCommits } : {}),
|
|
162
|
+
...(rootCommits !== undefined
|
|
163
|
+
? { workspaceFingerprint: computeDurableWorkspaceId(rootCommits, worktreeName) }
|
|
164
|
+
: {}),
|
|
165
|
+
...(cloneRootCommits !== undefined
|
|
166
|
+
? { projectFingerprint: computeDurableWorkspaceId(cloneRootCommits, "") }
|
|
167
|
+
: {}),
|
|
168
|
+
shallow,
|
|
169
|
+
identityUncertainty,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
// ---------------------------------------------------------------------------
|
|
173
|
+
// Lifecycle classification (spec §12: these kinds never activate/remove)
|
|
174
|
+
// ---------------------------------------------------------------------------
|
|
175
|
+
/**
|
|
176
|
+
* Classify a host lifecycle event against live declarations. Bind, upload,
|
|
177
|
+
* code-workspace creation and session open/end never activate or remove a
|
|
178
|
+
* declaration: the only outcome is "no-activation-change". Unknown kinds
|
|
179
|
+
* are refused. Pinned to NON_ACTIVATING_LIFECYCLE_KINDS, never a copy.
|
|
180
|
+
*/
|
|
181
|
+
export function classifyLifecycleEvent(kind) {
|
|
182
|
+
if (!isNonActivatingLifecycleKind(kind)) {
|
|
183
|
+
throw new Error(`unknown lifecycle kind: ${String(kind)}`);
|
|
184
|
+
}
|
|
185
|
+
return "no-activation-change";
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Default authority until L7a: deny everything explicitly. Local identity
|
|
189
|
+
* verification is L7a work; until it exists, no declaration API is usable,
|
|
190
|
+
* and denial is an error — never a successful empty result (A01).
|
|
191
|
+
*/
|
|
192
|
+
export const unverifiedLocalLiveAuthority = {
|
|
193
|
+
authorize: () => ({ ok: false, reason: "local_authority_unavailable" }),
|
|
194
|
+
};
|
|
195
|
+
export const inertLiveWorkController = {
|
|
196
|
+
cancelScheduledWork: () => false,
|
|
197
|
+
requestPrivatePurge: () => false,
|
|
198
|
+
hasInFlightWork: () => false,
|
|
199
|
+
};
|
|
200
|
+
export class LiveAccessRefused extends Error {
|
|
201
|
+
operation;
|
|
202
|
+
reason;
|
|
203
|
+
constructor(operation, reason) {
|
|
204
|
+
super(`live ${operation} refused: ${reason}`);
|
|
205
|
+
this.operation = operation;
|
|
206
|
+
this.reason = reason;
|
|
207
|
+
this.name = "LiveAccessRefused";
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const defaultTenant = () => {
|
|
211
|
+
const username = userInfo().username;
|
|
212
|
+
return `local:${username && username.length > 0 ? username : "unknown"}`;
|
|
213
|
+
};
|
|
214
|
+
export function createLiveRegistration(options) {
|
|
215
|
+
const root = options.root;
|
|
216
|
+
const tenant = options.tenant ?? defaultTenant();
|
|
217
|
+
const authority = options.authority ?? unverifiedLocalLiveAuthority;
|
|
218
|
+
const workController = options.workController ?? inertLiveWorkController;
|
|
219
|
+
const now = options.now ?? (() => new Date().toISOString());
|
|
220
|
+
const store = createLiveDeclarationStore(root);
|
|
221
|
+
const authorize = (operation, detail = {}) => {
|
|
222
|
+
const decision = authority.authorize({
|
|
223
|
+
operation,
|
|
224
|
+
tenant,
|
|
225
|
+
...(detail.path !== undefined ? { path: detail.path } : {}),
|
|
226
|
+
...(detail.declarationId !== undefined ? { declarationId: detail.declarationId } : {}),
|
|
227
|
+
...(detail.hostFingerprint !== undefined
|
|
228
|
+
? { hostFingerprint: detail.hostFingerprint }
|
|
229
|
+
: {}),
|
|
230
|
+
});
|
|
231
|
+
if (!decision.ok) {
|
|
232
|
+
throw new LiveAccessRefused(operation, decision.reason ?? "denied");
|
|
233
|
+
}
|
|
234
|
+
// No fabricated fallback: a positive authorization without a verified
|
|
235
|
+
// principal is refused before any neutral DTO is built. The stable
|
|
236
|
+
// owner scope and principal proof are L7a work — say so, don't invent.
|
|
237
|
+
if (decision.principal === undefined || decision.principal.trim().length === 0) {
|
|
238
|
+
throw new LiveAccessRefused(operation, "verified_principal_required");
|
|
239
|
+
}
|
|
240
|
+
return { ...decision, principal: decision.principal };
|
|
241
|
+
};
|
|
242
|
+
const resolveInputPath = (path) => realpathOr(resolve(path), resolve(path));
|
|
243
|
+
const findByAuthorizedRoot = (path) => {
|
|
244
|
+
const resolved = resolveInputPath(path);
|
|
245
|
+
return store
|
|
246
|
+
.list()
|
|
247
|
+
.find((record) => record.declaration.authorizedRoots.includes(resolved) ||
|
|
248
|
+
record.declaration.authorizedRoots.includes(realpathOr(resolved, resolved)));
|
|
249
|
+
};
|
|
250
|
+
const buildRevocation = (record, reason) => {
|
|
251
|
+
const revocation = {
|
|
252
|
+
declarationId: record.declaration.declarationId,
|
|
253
|
+
tenant: record.declaration.tenant,
|
|
254
|
+
cloneId: record.declaration.cloneId,
|
|
255
|
+
worktreeId: record.declaration.worktreeId,
|
|
256
|
+
declarationRevision: record.declaration.declarationRevision,
|
|
257
|
+
reason,
|
|
258
|
+
requestPrivatePurge: {
|
|
259
|
+
purgePrivateSnapshots: true,
|
|
260
|
+
purgeDerivedIndexes: true,
|
|
261
|
+
revokeDecryptability: true,
|
|
262
|
+
preserveCommittedHistory: true,
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
const checked = validateDeclarationRevocation(revocation);
|
|
266
|
+
if (!checked.ok) {
|
|
267
|
+
throw new Error(`invalid live declaration revocation: ${checked.errors.join("; ")}`);
|
|
268
|
+
}
|
|
269
|
+
return revocation;
|
|
270
|
+
};
|
|
271
|
+
return {
|
|
272
|
+
authority,
|
|
273
|
+
probe: probeLiveWorkspace,
|
|
274
|
+
activate(request) {
|
|
275
|
+
const decision = authorize("activate", { path: request.path });
|
|
276
|
+
const probe = probeLiveWorkspace(request.path);
|
|
277
|
+
if (probe === undefined) {
|
|
278
|
+
throw new Error(`not a git worktree: ${request.path}`);
|
|
279
|
+
}
|
|
280
|
+
for (const state of probe.identityUncertainty) {
|
|
281
|
+
if (!isIdentityUncertaintyState(state)) {
|
|
282
|
+
throw new Error(`unknown identity uncertainty state: ${String(state)}`);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (probe.oidAlgorithm !== "sha1" && probe.oidAlgorithm !== "sha256") {
|
|
286
|
+
throw new Error(`cannot mint a live clone identity for ${request.path}: repository object format is undetectable`);
|
|
287
|
+
}
|
|
288
|
+
// Canonical identities: byte-identical to the engram side for
|
|
289
|
+
// identical inputs (hostScope carries the local tenant scope, which
|
|
290
|
+
// bounds the clone to one host).
|
|
291
|
+
const clone = deriveCloneIdentity({
|
|
292
|
+
hostScope: tenant,
|
|
293
|
+
commonDirRealpath: probe.commonDirRealpath,
|
|
294
|
+
...(probe.projectFingerprint !== undefined
|
|
295
|
+
? { commonDirProjectFingerprint: probe.projectFingerprint }
|
|
296
|
+
: {}),
|
|
297
|
+
identityUncertainty: [...probe.identityUncertainty],
|
|
298
|
+
oidAlgorithm: probe.oidAlgorithm,
|
|
299
|
+
});
|
|
300
|
+
const worktree = deriveWorktreeIdentity({
|
|
301
|
+
hostScope: tenant,
|
|
302
|
+
clone: { cloneId: clone.cloneId },
|
|
303
|
+
worktreePath: probe.worktreeRealpath,
|
|
304
|
+
gitDir: probe.gitDir,
|
|
305
|
+
...(probe.workspaceFingerprint !== undefined
|
|
306
|
+
? { worktreeFingerprint: probe.workspaceFingerprint }
|
|
307
|
+
: {}),
|
|
308
|
+
identityUncertainty: [...probe.identityUncertainty],
|
|
309
|
+
});
|
|
310
|
+
const identity = deriveDeclarationIdentity({
|
|
311
|
+
hostScope: tenant,
|
|
312
|
+
clone: { cloneId: clone.cloneId },
|
|
313
|
+
worktree: { worktreeId: worktree.worktreeId },
|
|
314
|
+
});
|
|
315
|
+
const declaration = {
|
|
316
|
+
tenant,
|
|
317
|
+
principal: decision.principal,
|
|
318
|
+
...(probe.workspaceFingerprint !== undefined
|
|
319
|
+
? { hostFingerprint: probe.workspaceFingerprint }
|
|
320
|
+
: {}),
|
|
321
|
+
identityUncertainty: [...probe.identityUncertainty],
|
|
322
|
+
declarationId: identity.declarationId,
|
|
323
|
+
cloneId: identity.cloneId,
|
|
324
|
+
worktreeId: identity.worktreeId,
|
|
325
|
+
authorizedRoots: [probe.worktreeRealpath],
|
|
326
|
+
liveCapability: EXPLICIT_LIVE_CAPABILITY,
|
|
327
|
+
policyVersion: POLICY_VERSION,
|
|
328
|
+
declarationRevision: INITIAL_DECLARATION_REVISION,
|
|
329
|
+
};
|
|
330
|
+
const checked = validateWorkspaceDeclaration(declaration);
|
|
331
|
+
if (!checked.ok) {
|
|
332
|
+
throw new Error(`invalid live workspace declaration: ${checked.errors.join("; ")}`);
|
|
333
|
+
}
|
|
334
|
+
const existing = store.get(declaration.declarationId);
|
|
335
|
+
if (existing !== undefined) {
|
|
336
|
+
// Once per worktree: replay the existing declaration, no revision bump.
|
|
337
|
+
return { declaration: existing, created: false };
|
|
338
|
+
}
|
|
339
|
+
const timestamp = now();
|
|
340
|
+
const record = {
|
|
341
|
+
kind: LIVE_DECLARATION_KIND,
|
|
342
|
+
schemaVersion: LIVE_DECLARATION_SCHEMA_VERSION,
|
|
343
|
+
declaration,
|
|
344
|
+
clone,
|
|
345
|
+
worktree,
|
|
346
|
+
createdAt: timestamp,
|
|
347
|
+
activatedAt: timestamp,
|
|
348
|
+
updatedAt: timestamp,
|
|
349
|
+
};
|
|
350
|
+
store.insert(record);
|
|
351
|
+
return { declaration: record, created: true };
|
|
352
|
+
},
|
|
353
|
+
list() {
|
|
354
|
+
authorize("list");
|
|
355
|
+
return store.list();
|
|
356
|
+
},
|
|
357
|
+
status(path) {
|
|
358
|
+
authorize("status", { path });
|
|
359
|
+
return findByAuthorizedRoot(path);
|
|
360
|
+
},
|
|
361
|
+
resolvePath(path) {
|
|
362
|
+
authorize("resolve", { path });
|
|
363
|
+
const resolved = resolveInputPath(path);
|
|
364
|
+
let best;
|
|
365
|
+
let bestMatchedLength = -1;
|
|
366
|
+
for (const record of store.list()) {
|
|
367
|
+
for (const rootPath of record.declaration.authorizedRoots) {
|
|
368
|
+
if (resolved !== rootPath && !resolved.startsWith(rootPath + "/"))
|
|
369
|
+
continue;
|
|
370
|
+
const relativePath = resolved === rootPath ? "" : resolved.slice(rootPath.length + 1);
|
|
371
|
+
if (best === undefined || rootPath.length > bestMatchedLength) {
|
|
372
|
+
best = { declaration: record, relativePath };
|
|
373
|
+
bestMatchedLength = rootPath.length;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return best;
|
|
378
|
+
},
|
|
379
|
+
remove(request) {
|
|
380
|
+
authorize("remove", { path: request.path });
|
|
381
|
+
const record = findByAuthorizedRoot(request.path);
|
|
382
|
+
if (record === undefined) {
|
|
383
|
+
return { removed: false, canceledWork: false, purgeRequested: false };
|
|
384
|
+
}
|
|
385
|
+
const scope = {
|
|
386
|
+
declarationId: record.declaration.declarationId,
|
|
387
|
+
cloneId: record.declaration.cloneId,
|
|
388
|
+
};
|
|
389
|
+
// Stop work and reject delayed jobs BEFORE unregistering; then purge
|
|
390
|
+
// private local snapshots. Committed history is never touched here.
|
|
391
|
+
const canceledWork = workController.cancelScheduledWork(scope);
|
|
392
|
+
const purgeRequested = workController.requestPrivatePurge(scope);
|
|
393
|
+
const revocation = buildRevocation(record, request.reason);
|
|
394
|
+
store.remove(record.declaration.declarationId);
|
|
395
|
+
return { removed: true, canceledWork, purgeRequested, revocation };
|
|
396
|
+
},
|
|
397
|
+
removeClone(request) {
|
|
398
|
+
authorize("remove-clone");
|
|
399
|
+
// Withdrawing a whole clone revokes EACH of its declarations, one
|
|
400
|
+
// unambiguous revocation per declaration (contract §L6a).
|
|
401
|
+
const targets = store
|
|
402
|
+
.list()
|
|
403
|
+
.filter((record) => record.declaration.cloneId === request.cloneId);
|
|
404
|
+
const revocations = [];
|
|
405
|
+
let canceledWork = false;
|
|
406
|
+
let purgeRequested = false;
|
|
407
|
+
for (const record of targets) {
|
|
408
|
+
const scope = {
|
|
409
|
+
declarationId: record.declaration.declarationId,
|
|
410
|
+
cloneId: record.declaration.cloneId,
|
|
411
|
+
};
|
|
412
|
+
canceledWork = workController.cancelScheduledWork(scope) || canceledWork;
|
|
413
|
+
purgeRequested = workController.requestPrivatePurge(scope) || purgeRequested;
|
|
414
|
+
revocations.push(buildRevocation(record, request.reason));
|
|
415
|
+
store.remove(record.declaration.declarationId);
|
|
416
|
+
}
|
|
417
|
+
return { removed: revocations.length, revocations, canceledWork, purgeRequested };
|
|
418
|
+
},
|
|
419
|
+
rebind(request) {
|
|
420
|
+
authorize("rebind", { path: request.path });
|
|
421
|
+
const record = findByAuthorizedRoot(request.path);
|
|
422
|
+
if (record === undefined) {
|
|
423
|
+
throw new Error(`no live declaration for path: ${request.path}`);
|
|
424
|
+
}
|
|
425
|
+
const scope = {
|
|
426
|
+
declarationId: record.declaration.declarationId,
|
|
427
|
+
cloneId: record.declaration.cloneId,
|
|
428
|
+
};
|
|
429
|
+
// In-flight collection/publication cannot be redirected by a rebind.
|
|
430
|
+
if (workController.hasInFlightWork(scope)) {
|
|
431
|
+
throw new LiveAccessRefused("rebind", "in_flight_work_cannot_be_redirected");
|
|
432
|
+
}
|
|
433
|
+
const nextBindingRevision = (record.declaration.bindingRevision ?? 0) + 1;
|
|
434
|
+
return store.update(record.declaration.declarationId, record.declaration.declarationRevision, (current) => ({
|
|
435
|
+
...current,
|
|
436
|
+
declaration: {
|
|
437
|
+
...current.declaration,
|
|
438
|
+
serverWorkspaceId: request.sentropicWorkspaceId,
|
|
439
|
+
serverIssuer: request.issuer,
|
|
440
|
+
bindingRevision: nextBindingRevision,
|
|
441
|
+
declarationRevision: current.declaration.declarationRevision + 1,
|
|
442
|
+
},
|
|
443
|
+
updatedAt: now(),
|
|
444
|
+
}));
|
|
445
|
+
},
|
|
446
|
+
replay() {
|
|
447
|
+
authorize("replay");
|
|
448
|
+
return store.list();
|
|
449
|
+
},
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
// Re-export the consumed lifecycle vocabulary for host compositors that
|
|
453
|
+
// classify events without importing the neutral package directly.
|
|
454
|
+
export { NON_ACTIVATING_LIFECYCLE_KINDS };
|
|
455
|
+
//# sourceMappingURL=live-registration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-registration.js","sourceRoot":"","sources":["../../src/gateway-host/live-registration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,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AAC,aAAa;gBAC/C,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,OAAO;aACpC,CAAC;YACF,qEAAqE;YACrE,IAAI,cAAc,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC1C,MAAM,IAAI,iBAAiB,CAAC,QAAQ,EAAE,qCAAqC,CAAC,CAAC;YAC/E,CAAC;YACD,MAAM,mBAAmB,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,eAAe,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YAC1E,OAAO,KAAK,CAAC,MAAM,CACjB,MAAM,CAAC,WAAW,CAAC,aAAa,EAChC,MAAM,CAAC,WAAW,CAAC,mBAAmB,EACtC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBACZ,GAAG,OAAO;gBACV,WAAW,EAAE;oBACX,GAAG,OAAO,CAAC,WAAW;oBACtB,iBAAiB,EAAE,OAAO,CAAC,oBAAoB;oBAC/C,YAAY,EAAE,OAAO,CAAC,MAAM;oBAC5B,eAAe,EAAE,mBAAmB;oBACpC,mBAAmB,EAAE,OAAO,CAAC,WAAW,CAAC,mBAAmB,GAAG,CAAC;iBACjE;gBACD,SAAS,EAAE,GAAG,EAAE;aACjB,CAAC,CACH,CAAC;QACJ,CAAC;QACD,MAAM;YACJ,SAAS,CAAC,QAAQ,CAAC,CAAC;YACpB,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,wEAAwE;AACxE,kEAAkE;AAClE,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cull.d.ts","sourceRoot":"","sources":["../../src/identity-cull/cull.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"cull.d.ts","sourceRoot":"","sources":["../../src/identity-cull/cull.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqBH,MAAM,MAAM,WAAW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AAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,MAAM,uBAAuB,GAC/B;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,sBAAsB,GAAG,oBAAoB,CAAA;CAAE,GAC7F;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAQ5F,wEAAwE;AACxE,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,wBAAwB,GAAG,uBAAuB,CAShG"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* however, implement and verify the canonical binding-fence + held-descriptor
|
|
6
6
|
* CAS needed by a future, separately owner-authorized executor.
|
|
7
7
|
*/
|
|
8
|
+
import { withIdentityFenceSync } from "@sentropic/h2a";
|
|
8
9
|
import { createHash, randomUUID } from "node:crypto";
|
|
9
10
|
import { closeSync, constants, existsSync, fstatSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, readSync, realpathSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
10
11
|
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
@@ -797,62 +798,6 @@ function compareHeldDescriptor(fd, expectedSize, expectedSha256) {
|
|
|
797
798
|
? { state: "READY" }
|
|
798
799
|
: { state: "ABORTED", reason: "HELD_DESCRIPTOR_HASH_MISMATCH" };
|
|
799
800
|
}
|
|
800
|
-
function fencePayload(fence) {
|
|
801
|
-
return JSON.stringify({
|
|
802
|
-
protocol: IDENTITY_BINDING_FENCE_PROTOCOL,
|
|
803
|
-
fenceEpoch: fence.epoch,
|
|
804
|
-
pid: process.pid,
|
|
805
|
-
acquiredAt: new Date().toISOString(),
|
|
806
|
-
});
|
|
807
|
-
}
|
|
808
|
-
function fenceIsHeld(fence) {
|
|
809
|
-
try {
|
|
810
|
-
const stat = lstatSync(fence.lockPath);
|
|
811
|
-
if (stat.isSymbolicLink() || !stat.isFile())
|
|
812
|
-
return false;
|
|
813
|
-
const payload = JSON.parse(readFileSync(fence.lockPath, "utf8"));
|
|
814
|
-
return isRecord(payload)
|
|
815
|
-
&& payload.protocol === IDENTITY_BINDING_FENCE_PROTOCOL
|
|
816
|
-
&& payload.fenceEpoch === fence.epoch
|
|
817
|
-
&& payload.pid === process.pid;
|
|
818
|
-
}
|
|
819
|
-
catch {
|
|
820
|
-
return false;
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
function acquireCanonicalBindingFence(lockPath) {
|
|
824
|
-
const fence = { lockPath, epoch: randomUUID() };
|
|
825
|
-
let fd;
|
|
826
|
-
try {
|
|
827
|
-
fd = openSync(lockPath, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL | constants.O_NOFOLLOW, 0o600);
|
|
828
|
-
}
|
|
829
|
-
catch (error) {
|
|
830
|
-
if (error.code === "EEXIST")
|
|
831
|
-
return undefined;
|
|
832
|
-
throw error;
|
|
833
|
-
}
|
|
834
|
-
try {
|
|
835
|
-
writeFileSync(fd, fencePayload(fence));
|
|
836
|
-
fsyncSync(fd);
|
|
837
|
-
}
|
|
838
|
-
catch (error) {
|
|
839
|
-
closeSync(fd);
|
|
840
|
-
try {
|
|
841
|
-
unlinkSync(lockPath);
|
|
842
|
-
}
|
|
843
|
-
catch {
|
|
844
|
-
// A failure to clean up an owned fence is safer than proceeding.
|
|
845
|
-
}
|
|
846
|
-
throw error;
|
|
847
|
-
}
|
|
848
|
-
closeSync(fd);
|
|
849
|
-
return fence;
|
|
850
|
-
}
|
|
851
|
-
function releaseCanonicalBindingFence(fence) {
|
|
852
|
-
if (!fenceIsHeld(fence))
|
|
853
|
-
throw new Error("canonical binding fence ownership was lost");
|
|
854
|
-
unlinkSync(fence.lockPath);
|
|
855
|
-
}
|
|
856
801
|
/**
|
|
857
802
|
* Exercises the authoritative len/hash primitive over one held descriptor.
|
|
858
803
|
* This staging-only verification releases its test fence before it returns and
|
|
@@ -865,42 +810,43 @@ export function verifyHeldDescriptorCas(input) {
|
|
|
865
810
|
return { state: "ABORTED", reason: "SINGLE_WRITER_PRECONDITION_FAILED" };
|
|
866
811
|
}
|
|
867
812
|
const canonicalBindingPath = realpathSync(input.bindingPath);
|
|
868
|
-
const fence = acquireCanonicalBindingFence(join(dirname(canonicalBindingPath), ".lock"));
|
|
869
|
-
if (!fence)
|
|
870
|
-
return { state: "ABORTED", reason: "CANONICAL_BINDING_FENCE_UNAVAILABLE" };
|
|
871
813
|
try {
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
const fd = openSync(canonicalBindingPath, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
875
|
-
try {
|
|
876
|
-
if (!fstatSync(fd).isFile())
|
|
877
|
-
return { state: "ABORTED", reason: "HELD_DESCRIPTOR_HASH_MISMATCH" };
|
|
878
|
-
const preflight = compareHeldDescriptor(fd, input.expectedSize, input.expectedSha256);
|
|
879
|
-
if (preflight.state === "ABORTED")
|
|
880
|
-
return preflight;
|
|
881
|
-
// This seam runs while the canonical fence is held. A direct append
|
|
882
|
-
// here models a bypass; the immediately-pre-rename held-fd CAS below
|
|
883
|
-
// must refuse it before any executor could rename.
|
|
884
|
-
input.afterPreflight?.();
|
|
885
|
-
if (!fenceIsHeld(fence))
|
|
814
|
+
return withIdentityFenceSync(join(dirname(canonicalBindingPath), ".lock"), (fence) => {
|
|
815
|
+
if (!fence.stillHeld())
|
|
886
816
|
return { state: "ABORTED", reason: "CANONICAL_BINDING_FENCE_LOST" };
|
|
887
|
-
const
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
817
|
+
const fd = openSync(canonicalBindingPath, constants.O_RDONLY | constants.O_NOFOLLOW);
|
|
818
|
+
try {
|
|
819
|
+
if (!fstatSync(fd).isFile())
|
|
820
|
+
return { state: "ABORTED", reason: "HELD_DESCRIPTOR_HASH_MISMATCH" };
|
|
821
|
+
const preflight = compareHeldDescriptor(fd, input.expectedSize, input.expectedSha256);
|
|
822
|
+
if (preflight.state === "ABORTED")
|
|
823
|
+
return preflight;
|
|
824
|
+
// This seam runs while the canonical fence is held. A direct append
|
|
825
|
+
// here models a bypass; the immediately-pre-rename held-fd CAS below
|
|
826
|
+
// must refuse it before any executor could rename.
|
|
827
|
+
input.afterPreflight?.();
|
|
828
|
+
if (!fence.stillHeld())
|
|
829
|
+
return { state: "ABORTED", reason: "CANONICAL_BINDING_FENCE_LOST" };
|
|
830
|
+
const final = compareHeldDescriptor(fd, input.expectedSize, input.expectedSha256);
|
|
831
|
+
if (final.state === "ABORTED")
|
|
832
|
+
return final;
|
|
833
|
+
if (!fence.stillHeld())
|
|
834
|
+
return { state: "ABORTED", reason: "CANONICAL_BINDING_FENCE_LOST" };
|
|
835
|
+
// Never call rename: execution remains hard-gated for this release. This
|
|
836
|
+
// staging verification releases its fence at return; an executor must not
|
|
837
|
+
// use it as a released-then-reacquired rename precondition.
|
|
838
|
+
void input.rename;
|
|
839
|
+
return { state: "STAGING_VERIFIED" };
|
|
840
|
+
}
|
|
841
|
+
finally {
|
|
842
|
+
closeSync(fd);
|
|
843
|
+
}
|
|
844
|
+
}, { timeoutMs: 5000 });
|
|
901
845
|
}
|
|
902
|
-
|
|
903
|
-
|
|
846
|
+
catch (error) {
|
|
847
|
+
if (error instanceof Error && error.name === "LockTimeoutError")
|
|
848
|
+
return { state: "ABORTED", reason: "CANONICAL_BINDING_FENCE_UNAVAILABLE" };
|
|
849
|
+
throw error;
|
|
904
850
|
}
|
|
905
851
|
}
|
|
906
852
|
function isValidTail(tail) {
|