@sentropic/h2a-runtime 0.98.6 → 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/index.d.ts.map +1 -1
- package/dist/index.js +79 -1
- package/dist/index.js.map +1 -1
- package/dist/native-host.d.ts.map +1 -1
- package/dist/native-host.js +27 -5
- package/dist/native-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 +28 -16
- package/dist/native-terminal/journal.js.map +1 -1
- package/dist/native-terminal/op.d.ts +13 -0
- package/dist/native-terminal/op.d.ts.map +1 -1
- package/dist/native-terminal/op.js +64 -5
- package/dist/native-terminal/op.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 +23 -3
- package/dist/tmux.d.ts.map +1 -1
- package/dist/tmux.js +47 -16
- 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 +2 -2
|
@@ -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":["../../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|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAmFA,OAAO,EAsDL,KAAK,YAAY,EAClB,MAAM,WAAW,CAAC;AAsCnB,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAS7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQ9C,OAAO,EAOL,KAAK,qBAAqB,EAE3B,MAAM,cAAc,CAAC;AAGtB,OAAO,EAqBL,KAAK,aAAa,EAGnB,MAAM,eAAe,CAAC;AACvB,OAAO,EASL,gBAAgB,EAEhB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AA8G5B,OAAO,EAGL,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAwGhC,eAAO,MAAM,WAAW,2BAA2B,CAAC;AACpD,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EACL,oBAAoB,EACpB,4BAA4B,EAC5B,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,sBAAsB,EACtB,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,+BAA+B,EAC/B,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,6BAA6B,EAC7B,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;A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
package/dist/index.js
CHANGED
|
@@ -9,7 +9,9 @@ import { Command, Help } from "commander";
|
|
|
9
9
|
import { applyRuntimeHelpGroups, groupRuntimeHelpItems, } from "./cli-help-groups.js";
|
|
10
10
|
import { attach, createRemoteSession, getRemoteSession, listRemoteSessions, refreshRemoteSession, renameRemoteSession, sessionTerminalHealth, stopRemoteSession, } from "./attach.js";
|
|
11
11
|
import { authHeaders, clearDefaultRemote, getDefaultRemote, getDefaultTarget, getDefaultTools, getH2aConfig, getJobMaxAgeHours, getMaxConcurrent, getLlmMeshRuntimeConfig, getTmuxProfileConfig, getTunnel, resolveConfigPath, setDefaultRemote, setDefaultTarget, migrateConfigHomeIfNeeded, setDefaultTools, setLlmMeshRuntimeConfig, setTmuxProfileConfig, setToken, setTunnel, } from "./config.js";
|
|
12
|
-
import { prepareCentralMcpForLaunch, prepareCentralMcpForRestore, } from "./central-mcp.js";
|
|
12
|
+
import { prepareCentralMcpForLaunch, prepareCentralMcpForRestore, resolveCentralMcpLogPath, } from "./central-mcp.js";
|
|
13
|
+
import { CRASH_LOG_COMPONENTS, formatCrashLogHumanRow, installCliWitnessOnce, installCrashHandlers, readFileTailLines, redactCrashText, readRecentCrashLogs, resolveCrashLogDir, } from "./crash-log.js";
|
|
14
|
+
import { readHostJournal, resolveHostJournalPath } from "./native-terminal/journal.js";
|
|
13
15
|
import { ensureConnected, stopTunnel } from "./tunnel.js";
|
|
14
16
|
import { detectToolAuth, KNOWN_TOOLS, partitionTools } from "./auth-tools.js";
|
|
15
17
|
import { transmittedSecrets, secretsSummary } from "./secrets.js";
|
|
@@ -1719,6 +1721,10 @@ function setAndReportDefaultRemote(url) {
|
|
|
1719
1721
|
process.stderr.write(`[h2a] default remote set to ${configured}\n`);
|
|
1720
1722
|
}
|
|
1721
1723
|
export async function main(argv) {
|
|
1724
|
+
// Passive fatal-path witness on the real entry path (see
|
|
1725
|
+
// installCliWitnessOnce): observes via uncaughtExceptionMonitor, so the
|
|
1726
|
+
// default crash/exit behavior is unchanged.
|
|
1727
|
+
installCliWitnessOnce();
|
|
1722
1728
|
// ②b — auto-migrate the config home remote-cli/ -> h2a/ on first run (backup +
|
|
1723
1729
|
// compat symlink). Best-effort: never let it break a command. Runs once
|
|
1724
1730
|
// (idempotent) before any config/registry read.
|
|
@@ -7771,6 +7777,75 @@ export async function main(argv) {
|
|
|
7771
7777
|
? `[h2a] lineage ${id} resumed\n`
|
|
7772
7778
|
: `[h2a] lineage ${id} was not suspended (no-op)\n`);
|
|
7773
7779
|
});
|
|
7780
|
+
// ---------------------------------------------------------------------------
|
|
7781
|
+
// logs — last crash-log incidents (native host journal + per-component logs)
|
|
7782
|
+
// ---------------------------------------------------------------------------
|
|
7783
|
+
program
|
|
7784
|
+
.command("logs")
|
|
7785
|
+
.description("Show the last crash-log incidents: native host journal plus cli/attach/mcp-server logs.")
|
|
7786
|
+
.option("--component <name>", "only this component (native-host|cli|attach|mcp-server)")
|
|
7787
|
+
.option("-n, --lines <n>", "number of rows to show", "50")
|
|
7788
|
+
.option("--json", "emit JSON rows instead of human lines")
|
|
7789
|
+
.action((opts) => {
|
|
7790
|
+
const dir = resolveCrashLogDir();
|
|
7791
|
+
const lines = Math.max(1, parseInt(opts.lines ?? "50", 10) || 50);
|
|
7792
|
+
const only = (opts.component ?? "").trim();
|
|
7793
|
+
const wantHost = only === "" || only === "native-host";
|
|
7794
|
+
const wanted = CRASH_LOG_COMPONENTS.filter((c) => only === "" || only === c);
|
|
7795
|
+
if (!wantHost && wanted.length === 0) {
|
|
7796
|
+
process.stderr.write("h2a logs: --component must be native-host|cli|attach|mcp-server\n");
|
|
7797
|
+
process.exitCode = 1;
|
|
7798
|
+
return;
|
|
7799
|
+
}
|
|
7800
|
+
const rows = readRecentCrashLogs(wanted, lines).map((row) => ({
|
|
7801
|
+
timestamp: row.timestamp,
|
|
7802
|
+
component: row.component,
|
|
7803
|
+
version: row.version,
|
|
7804
|
+
pid: row.pid,
|
|
7805
|
+
event: row.event,
|
|
7806
|
+
...(row.sessionId ? { sessionId: row.sessionId } : {}),
|
|
7807
|
+
...(row.instanceId ? { instanceId: row.instanceId } : {}),
|
|
7808
|
+
...(row.reason ? { reason: row.reason } : {}),
|
|
7809
|
+
...(row.exitCode !== undefined ? { exitCode: row.exitCode } : {}),
|
|
7810
|
+
...(row.signal ? { signal: row.signal } : {}),
|
|
7811
|
+
...(row.detail ? { detail: row.detail } : {}),
|
|
7812
|
+
}));
|
|
7813
|
+
const hostRows = wantHost
|
|
7814
|
+
? readHostJournal(resolveHostJournalPath())
|
|
7815
|
+
.slice(-lines)
|
|
7816
|
+
.map((entry) => ({
|
|
7817
|
+
timestamp: entry.timestamp ?? "unknown",
|
|
7818
|
+
component: "native-host",
|
|
7819
|
+
...entry,
|
|
7820
|
+
}))
|
|
7821
|
+
: [];
|
|
7822
|
+
const merged = [...hostRows, ...rows]
|
|
7823
|
+
.sort((a, b) => (a.timestamp < b.timestamp ? -1 : a.timestamp > b.timestamp ? 1 : 0))
|
|
7824
|
+
.slice(-lines);
|
|
7825
|
+
// The raw server output is verbatim child stderr (unredacted at rest):
|
|
7826
|
+
// read it before the empty check so a raw-only crash is shown, and
|
|
7827
|
+
// redact it on display like every structured row.
|
|
7828
|
+
const rawPath = resolveCentralMcpLogPath();
|
|
7829
|
+
const rawTail = (only === "" || only === "mcp-server") ? readFileTailLines(rawPath, 20) : [];
|
|
7830
|
+
if (merged.length === 0 && rawTail.length === 0) {
|
|
7831
|
+
process.stdout.write(`[h2a] no crash-log incidents in ${dir}\n`);
|
|
7832
|
+
return;
|
|
7833
|
+
}
|
|
7834
|
+
if (opts.json && merged.length > 0) {
|
|
7835
|
+
process.stdout.write(`${merged.map((row) => JSON.stringify(row)).join("\n")}\n`);
|
|
7836
|
+
return;
|
|
7837
|
+
}
|
|
7838
|
+
for (const row of merged) {
|
|
7839
|
+
process.stdout.write(`${formatCrashLogHumanRow(row)}\n`);
|
|
7840
|
+
}
|
|
7841
|
+
if (rawTail.length > 0) {
|
|
7842
|
+
// The server process itself leaves no structured rows (it dies with
|
|
7843
|
+
// its witness); its raw stderr tail is the only "why" for its crash.
|
|
7844
|
+
process.stdout.write(`[h2a] --- mcp-central.log raw tail (${rawPath}) ---\n`);
|
|
7845
|
+
for (const line of rawTail)
|
|
7846
|
+
process.stdout.write(`${redactCrashText(line)}\n`);
|
|
7847
|
+
}
|
|
7848
|
+
});
|
|
7774
7849
|
// Help layout only — assign every top-level command an intention group and
|
|
7775
7850
|
// render the groups in the declared order instead of registration order.
|
|
7776
7851
|
// Presentational for every PRE-EXISTING RECOGNIZED COMMAND: `helpGroup()` and
|
|
@@ -7838,6 +7913,9 @@ function isEntryPoint() {
|
|
|
7838
7913
|
}
|
|
7839
7914
|
}
|
|
7840
7915
|
if (isEntryPoint()) {
|
|
7916
|
+
// Passive witness for fatal paths outside runOp: installed once inside
|
|
7917
|
+
// main() so the lazy core-binary dispatch path is covered too.
|
|
7918
|
+
installCliWitnessOnce();
|
|
7841
7919
|
main(process.argv).catch((error) => {
|
|
7842
7920
|
if (error instanceof AuthRefreshError ||
|
|
7843
7921
|
error instanceof AuthBundleMissingError) {
|