@sentropic/h2a-runtime 0.98.3 → 0.98.5
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/gateway-host/sessions.d.ts +6 -0
- package/dist/gateway-host/sessions.d.ts.map +1 -1
- package/dist/gateway-host/sessions.js +64 -0
- package/dist/gateway-host/sessions.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35 -10
- package/dist/index.js.map +1 -1
- package/dist/llm-mesh-accounts.d.ts +15 -2
- package/dist/llm-mesh-accounts.d.ts.map +1 -1
- package/dist/llm-mesh-accounts.js +13 -3
- package/dist/llm-mesh-accounts.js.map +1 -1
- package/dist/native-terminal/crash-safe-log.d.ts +17 -0
- package/dist/native-terminal/crash-safe-log.d.ts.map +1 -0
- package/dist/native-terminal/crash-safe-log.js +79 -0
- package/dist/native-terminal/crash-safe-log.js.map +1 -0
- package/dist/native-terminal/fault-counters.d.ts +38 -0
- package/dist/native-terminal/fault-counters.d.ts.map +1 -0
- package/dist/native-terminal/fault-counters.js +46 -0
- package/dist/native-terminal/fault-counters.js.map +1 -0
- package/dist/native-terminal/host.d.ts.map +1 -1
- package/dist/native-terminal/host.js +98 -37
- package/dist/native-terminal/host.js.map +1 -1
- package/dist/native-terminal/journal.d.ts +5 -1
- package/dist/native-terminal/journal.d.ts.map +1 -1
- package/dist/native-terminal/journal.js +4 -1
- package/dist/native-terminal/journal.js.map +1 -1
- package/dist/native-terminal/process.d.ts.map +1 -1
- package/dist/native-terminal/process.js +38 -11
- package/dist/native-terminal/process.js.map +1 -1
- package/dist/native-terminal/server.d.ts +31 -0
- package/dist/native-terminal/server.d.ts.map +1 -1
- package/dist/native-terminal/server.js +196 -45
- package/dist/native-terminal/server.js.map +1 -1
- package/dist/native-terminal/socket-path.d.ts +1 -0
- package/dist/native-terminal/socket-path.d.ts.map +1 -1
- package/dist/native-terminal/socket-path.js +3 -3
- package/dist/native-terminal/socket-path.js.map +1 -1
- package/dist/native-terminal/supervisor.d.ts.map +1 -1
- package/dist/native-terminal/supervisor.js +60 -1
- package/dist/native-terminal/supervisor.js.map +1 -1
- package/dist/registry.d.ts +23 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +53 -0
- package/dist/registry.js.map +1 -1
- package/dist/resume-launch-options.d.ts +59 -0
- package/dist/resume-launch-options.d.ts.map +1 -0
- package/dist/resume-launch-options.js +64 -0
- package/dist/resume-launch-options.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pinned launch options for `runtime:run --resume` — recovery + SELF-HEAL of
|
|
3
|
+
* the conflicting-rows outage (2026-10): two registry rows for one
|
|
4
|
+
* convId/cwd/tool with different bare/gatewayMode pins used to be a bare fatal
|
|
5
|
+
* ("cannot recover pinned launch options: conflicting registry rows") that
|
|
6
|
+
* blocked EVERY resume of that conversation, even when all but one row
|
|
7
|
+
* provably described a dead session.
|
|
8
|
+
*
|
|
9
|
+
* The resolution: probe each conflicting row with the SAME 3-state vocabulary
|
|
10
|
+
* as the managed-host resolver (`probeManagedRowLiveness`). A row whose
|
|
11
|
+
* session is PROVABLY dead (dead probe, or positively ended) is pruned from
|
|
12
|
+
* the registry under the lock (`removeRegistryRowsById`); a live or UNKNOWN
|
|
13
|
+
* row stays (fail closed — a probe failure is never death). When one row (or
|
|
14
|
+
* none) remains, the resume continues normally with it; a still-conflicting
|
|
15
|
+
* set stays a fatal, but now naming the ids in cause and the repair action
|
|
16
|
+
* instead of leaving the operator to guess.
|
|
17
|
+
*/
|
|
18
|
+
import { type ManagedHostProbeResult, type RegistryEntry } from "./registry.js";
|
|
19
|
+
/** Injectable session probes (tests stay deterministic, no tmux/host needed). */
|
|
20
|
+
export type ResumeLaunchProbes = {
|
|
21
|
+
readonly native?: (name: string) => ManagedHostProbeResult;
|
|
22
|
+
readonly tmux?: (name: string) => ManagedHostProbeResult;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Same conflict predicate as the pre-self-heal fatal: any row pinning launch
|
|
26
|
+
* options (bare/gatewayMode) that differ from the first row's. All rows in the
|
|
27
|
+
* set share convId/cwd/tool, so ANY difference poisons the whole set.
|
|
28
|
+
*/
|
|
29
|
+
export declare function pinnedLaunchOptionsConflict(entries: readonly RegistryEntry[]): boolean;
|
|
30
|
+
/** Actionable fatal for a conflict that survived the self-heal. */
|
|
31
|
+
export declare function conflictingRowsReason(ids: readonly string[]): string;
|
|
32
|
+
export type PinnedLaunchResolution = {
|
|
33
|
+
readonly state: "unreadable";
|
|
34
|
+
readonly reason: string;
|
|
35
|
+
} | {
|
|
36
|
+
readonly state: "conflict";
|
|
37
|
+
readonly reason: string;
|
|
38
|
+
readonly ids: readonly string[];
|
|
39
|
+
} | {
|
|
40
|
+
readonly state: "ok";
|
|
41
|
+
readonly entries: RegistryEntry[];
|
|
42
|
+
readonly prunedIds: readonly string[];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Resolve the rows that pin launch options for a resume of `convId` in `cwd`
|
|
46
|
+
* under tool `tool`: read the registry (3-state), keep only managed local rows
|
|
47
|
+
* for this conversation, self-heal a conflicting set by pruning provably-dead
|
|
48
|
+
* rows, and report what remains. Pure over injectable probes; the registry
|
|
49
|
+
* write (pruning) goes through the registry lock.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolvePinnedLaunchEntries(args: {
|
|
52
|
+
readonly convId: string;
|
|
53
|
+
readonly cwd: string;
|
|
54
|
+
readonly tool: string;
|
|
55
|
+
/** Defaults to the canonical registry path (honors REMOTE_CLI_CONFIG_HOME). */
|
|
56
|
+
readonly registryPath?: string;
|
|
57
|
+
readonly probes?: ResumeLaunchProbes;
|
|
58
|
+
}): PinnedLaunchResolution;
|
|
59
|
+
//# sourceMappingURL=resume-launch-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume-launch-options.d.ts","sourceRoot":"","sources":["../src/resume-launch-options.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C;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,kBAAkB,CAAC;CACtC,GAAG,sBAAsB,CA0BzB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pinned launch options for `runtime:run --resume` — recovery + SELF-HEAL of
|
|
3
|
+
* the conflicting-rows outage (2026-10): two registry rows for one
|
|
4
|
+
* convId/cwd/tool with different bare/gatewayMode pins used to be a bare fatal
|
|
5
|
+
* ("cannot recover pinned launch options: conflicting registry rows") that
|
|
6
|
+
* blocked EVERY resume of that conversation, even when all but one row
|
|
7
|
+
* provably described a dead session.
|
|
8
|
+
*
|
|
9
|
+
* The resolution: probe each conflicting row with the SAME 3-state vocabulary
|
|
10
|
+
* as the managed-host resolver (`probeManagedRowLiveness`). A row whose
|
|
11
|
+
* session is PROVABLY dead (dead probe, or positively ended) is pruned from
|
|
12
|
+
* the registry under the lock (`removeRegistryRowsById`); a live or UNKNOWN
|
|
13
|
+
* row stays (fail closed — a probe failure is never death). When one row (or
|
|
14
|
+
* none) remains, the resume continues normally with it; a still-conflicting
|
|
15
|
+
* set stays a fatal, but now naming the ids in cause and the repair action
|
|
16
|
+
* instead of leaving the operator to guess.
|
|
17
|
+
*/
|
|
18
|
+
import { isManagedLocalKind, loadRegistry, probeManagedRowLiveness, removeRegistryRowsById, resolveRegistryPath, } from "./registry.js";
|
|
19
|
+
/**
|
|
20
|
+
* Same conflict predicate as the pre-self-heal fatal: any row pinning launch
|
|
21
|
+
* options (bare/gatewayMode) that differ from the first row's. All rows in the
|
|
22
|
+
* set share convId/cwd/tool, so ANY difference poisons the whole set.
|
|
23
|
+
*/
|
|
24
|
+
export function pinnedLaunchOptionsConflict(entries) {
|
|
25
|
+
return entries.some((entry) => entry.bare !== entries[0]?.bare || entry.gatewayMode !== entries[0]?.gatewayMode);
|
|
26
|
+
}
|
|
27
|
+
/** Actionable fatal for a conflict that survived the self-heal. */
|
|
28
|
+
export function conflictingRowsReason(ids) {
|
|
29
|
+
return ("cannot recover pinned launch options: conflicting registry rows: ids " +
|
|
30
|
+
`${ids.join(", ")} — stop the stale session or remove its row`);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolve the rows that pin launch options for a resume of `convId` in `cwd`
|
|
34
|
+
* under tool `tool`: read the registry (3-state), keep only managed local rows
|
|
35
|
+
* for this conversation, self-heal a conflicting set by pruning provably-dead
|
|
36
|
+
* rows, and report what remains. Pure over injectable probes; the registry
|
|
37
|
+
* write (pruning) goes through the registry lock.
|
|
38
|
+
*/
|
|
39
|
+
export function resolvePinnedLaunchEntries(args) {
|
|
40
|
+
const registryPath = args.registryPath ?? resolveRegistryPath();
|
|
41
|
+
const read = loadRegistry(registryPath);
|
|
42
|
+
if (read.state === "unknown") {
|
|
43
|
+
return { state: "unreadable", reason: read.reason };
|
|
44
|
+
}
|
|
45
|
+
let entries = read.entries.filter((entry) => isManagedLocalKind(entry.kind) && entry.convId === args.convId &&
|
|
46
|
+
entry.cwd === args.cwd && entry.tool === args.tool);
|
|
47
|
+
if (!pinnedLaunchOptionsConflict(entries)) {
|
|
48
|
+
return { state: "ok", entries, prunedIds: [] };
|
|
49
|
+
}
|
|
50
|
+
const deadIds = entries
|
|
51
|
+
.filter((entry) => probeManagedRowLiveness(entry, args.probes) === "dead")
|
|
52
|
+
.map((entry) => entry.id);
|
|
53
|
+
if (deadIds.length > 0) {
|
|
54
|
+
removeRegistryRowsById(deadIds, registryPath);
|
|
55
|
+
const pruned = new Set(deadIds);
|
|
56
|
+
entries = entries.filter((entry) => !pruned.has(entry.id));
|
|
57
|
+
}
|
|
58
|
+
if (pinnedLaunchOptionsConflict(entries)) {
|
|
59
|
+
const ids = entries.map((entry) => entry.id);
|
|
60
|
+
return { state: "conflict", ids, reason: conflictingRowsReason(ids) };
|
|
61
|
+
}
|
|
62
|
+
return { state: "ok", entries, prunedIds: deadIds };
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=resume-launch-options.js.map
|
|
@@ -0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