@adhdev/session-host-core 1.0.82-rc.37 → 1.0.82-rc.38
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/index.d.mts +1 -94
- package/dist/index.d.ts +1 -94
- package/dist/index.js +0 -131
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +0 -126
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -2
- package/src/types.ts +0 -8
- package/src/operator-recovery.ts +0 -134
package/dist/index.d.mts
CHANGED
|
@@ -3,79 +3,6 @@ import { SpawnOptions, ChildProcess } from 'node:child_process';
|
|
|
3
3
|
import * as net from 'net';
|
|
4
4
|
export { DEFAULT_SESSION_HOST_COLS, DEFAULT_SESSION_HOST_ROWS, resolveSessionHostCols, resolveSessionHostRows } from './defaults.mjs';
|
|
5
5
|
|
|
6
|
-
/** This association is owner asserted, never a historical native receipt. */
|
|
7
|
-
declare const OPERATOR_RECOVERY_TARGET: Readonly<{
|
|
8
|
-
association: "operator_asserted";
|
|
9
|
-
taskId: "a1cdf3c0-f029-4d17-a8e9-db64e0a55501";
|
|
10
|
-
meshId: "mesh_271444af883843e9b36c67155b87b22f";
|
|
11
|
-
attemptId: "mesh_queue:mesh_271444af883843e9b36c67155b87b22f:a1cdf3c0-f029-4d17-a8e9-db64e0a55501:0";
|
|
12
|
-
generation: 0;
|
|
13
|
-
dispatchNonce: 1;
|
|
14
|
-
deliveryId: "dlv-7e259b34-b049-47ee-a466-2ca9c12bcff4";
|
|
15
|
-
ownerDaemonId: "daemon_mach_4462a75330c548be9c2e74dd9f7f6ffb";
|
|
16
|
-
nodeId: "node_d82de0cef9b042b6948986609e32142f";
|
|
17
|
-
workerDaemonId: "daemon_mach_6733c865d60f432dbeb119a6875ee303";
|
|
18
|
-
sessionId: "de321185-4ebc-40aa-8c6e-b4919e87fae3";
|
|
19
|
-
providerSessionId: "60806c79-7d77-4614-9fa6-e628533478ba";
|
|
20
|
-
namespace: "6a2ef3162182";
|
|
21
|
-
}>;
|
|
22
|
-
declare const recoveryTargetBytes: string;
|
|
23
|
-
/** Shared final admission guard for saved IDs, new aliases and provider argv.
|
|
24
|
-
* This is a permanent exact-target denial, independent of journal availability. */
|
|
25
|
-
declare function assertRecoveryLaunchIdentity(value: unknown): void;
|
|
26
|
-
type RecoveryOwnerOperation = 'anchor_recover' | 'fence_install' | 'witness_enroll';
|
|
27
|
-
interface RecoveryOwnerGrant {
|
|
28
|
-
readonly purpose: 'operator_recovery_v1';
|
|
29
|
-
readonly operation: RecoveryOwnerOperation;
|
|
30
|
-
}
|
|
31
|
-
declare function isRecoveryEndpoint(endpoint: string): boolean;
|
|
32
|
-
interface RecoveryOwnerChallenge {
|
|
33
|
-
readonly message: string;
|
|
34
|
-
}
|
|
35
|
-
interface RecoveryOwnerEnrollment {
|
|
36
|
-
/** Trusted boot dependency, provisioned outside delegated worker authority.
|
|
37
|
-
* Do not load this from daemon config, IPC arguments or an MCP credential. */
|
|
38
|
-
publicKey: string;
|
|
39
|
-
enrollmentId: string;
|
|
40
|
-
coordinatorBootId: string;
|
|
41
|
-
authEpoch: string;
|
|
42
|
-
verifyCurrent: () => boolean;
|
|
43
|
-
}
|
|
44
|
-
/** Signature possession authenticates the separately enrolled owner signer.
|
|
45
|
-
* This verifier does not enroll keys or assert user presence on their behalf. */
|
|
46
|
-
declare class RecoveryOwnerAdmission {
|
|
47
|
-
private readonly clock;
|
|
48
|
-
private readonly key;
|
|
49
|
-
private readonly enrollment;
|
|
50
|
-
private readonly pending;
|
|
51
|
-
private readonly grants;
|
|
52
|
-
private lastNow;
|
|
53
|
-
constructor(enrollment: RecoveryOwnerEnrollment, clock?: () => number);
|
|
54
|
-
private now;
|
|
55
|
-
challenge(operation?: RecoveryOwnerOperation): RecoveryOwnerChallenge;
|
|
56
|
-
authorize(message: string, signature: string): RecoveryOwnerGrant;
|
|
57
|
-
assertGrant(grant: unknown): asserts grant is RecoveryOwnerGrant;
|
|
58
|
-
/** Burn synchronously before any work or await. The private continuation
|
|
59
|
-
* rechecks the ORIGINAL deadline and revocation; it cannot mint a new grant. */
|
|
60
|
-
reserve(grant: unknown, operation: RecoveryOwnerOperation): () => void;
|
|
61
|
-
consume(grant: unknown): void;
|
|
62
|
-
}
|
|
63
|
-
interface RecoveryHostBinding {
|
|
64
|
-
namespace: string;
|
|
65
|
-
endpoint: string;
|
|
66
|
-
hostBootId: string;
|
|
67
|
-
workerDaemonId: string;
|
|
68
|
-
}
|
|
69
|
-
interface RecoveryPhysicalProof extends RecoveryHostBinding {
|
|
70
|
-
protocol: 1;
|
|
71
|
-
verdict: 'ABSENT' | 'LIVE' | 'UNKNOWN';
|
|
72
|
-
reason: string;
|
|
73
|
-
nonce: string;
|
|
74
|
-
fenceDigest: string;
|
|
75
|
-
sessionId: string;
|
|
76
|
-
providerSessionId: string;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
6
|
type SessionTransport = 'pty';
|
|
80
7
|
type SessionHostCategory = 'cli' | 'acp' | 'shell';
|
|
81
8
|
type SessionLifecycle = 'starting' | 'running' | 'stopping' | 'stopped' | 'failed' | 'interrupted';
|
|
@@ -444,26 +371,6 @@ interface HostUpgradeLeasePayload {
|
|
|
444
371
|
token: string;
|
|
445
372
|
}
|
|
446
373
|
type SessionHostRequest = {
|
|
447
|
-
type: 'prepare_operator_recovery_fence_v1';
|
|
448
|
-
payload?: {};
|
|
449
|
-
} | {
|
|
450
|
-
type: 'install_operator_recovery_fence_v1';
|
|
451
|
-
payload: {
|
|
452
|
-
message: string;
|
|
453
|
-
signature: string;
|
|
454
|
-
};
|
|
455
|
-
} | {
|
|
456
|
-
type: 'attest_operator_recovery_v1';
|
|
457
|
-
payload: {
|
|
458
|
-
nonce: string;
|
|
459
|
-
fenceDigest: string;
|
|
460
|
-
};
|
|
461
|
-
} | {
|
|
462
|
-
type: 'get_operator_recovery_coverage_v1';
|
|
463
|
-
payload: {
|
|
464
|
-
nonce: string;
|
|
465
|
-
};
|
|
466
|
-
} | {
|
|
467
374
|
type: 'get_upgrade_lease';
|
|
468
375
|
payload?: {};
|
|
469
376
|
} | {
|
|
@@ -1215,4 +1122,4 @@ interface SessionHostControlTransport {
|
|
|
1215
1122
|
*/
|
|
1216
1123
|
declare function createSessionHostControlPlane(transport: SessionHostControlTransport): SessionHostControlPlane;
|
|
1217
1124
|
|
|
1218
|
-
export { type AcquireWritePayload, type AttachSessionPayload, CLEANUP_AFTER_STOP_SIDE_EFFECT_PREFIX, CLI_CHILD_NICE_ENV, CLI_CHILD_NICE_INCREMENT, CLI_CHILD_SCHEDULING_ENV, type ClearSessionBufferPayload, type CreateSessionPayload, DEFAULT_CONFIG_DIR_NAME, DEFAULT_SESSION_RING_BUFFER_MAX_BYTES, type DeleteSessionIfExpectedPayload, type DetachSessionPayload, type ForceDetachClientPayload, type GetHostDiagnosticsPayload, type GetSnapshotPayload, type GetTerminalSnapshotPayload, type HostUpgradeLeasePayload, type MeshWriterAssignment, type MeshWriterStopTarget, type NiceLaunch,
|
|
1125
|
+
export { type AcquireWritePayload, type AttachSessionPayload, CLEANUP_AFTER_STOP_SIDE_EFFECT_PREFIX, CLI_CHILD_NICE_ENV, CLI_CHILD_NICE_INCREMENT, CLI_CHILD_SCHEDULING_ENV, type ClearSessionBufferPayload, type CreateSessionPayload, DEFAULT_CONFIG_DIR_NAME, DEFAULT_SESSION_RING_BUFFER_MAX_BYTES, type DeleteSessionIfExpectedPayload, type DetachSessionPayload, type ForceDetachClientPayload, type GetHostDiagnosticsPayload, type GetSnapshotPayload, type GetTerminalSnapshotPayload, type HostUpgradeLeasePayload, type MeshWriterAssignment, type MeshWriterStopTarget, type NiceLaunch, type PruneDuplicateSessionsPayload, type ReleaseWritePayload, type ResizeSessionPayload, type RestartSessionPayload, type ResumeSessionPayload, SESSION_HOST_SUPPORTED_REQUEST_TYPES, type SendInputPayload, type SendSignalPayload, type SessionAttachedClient, type SessionBufferSnapshot, type SessionCleanupExpectedAssignment, type SessionClientType, type SessionHostCategory, type SessionHostCensus, SessionHostClient, type SessionHostClientOptions, type SessionHostControlPlane, type SessionHostControlTransport, type SessionHostDiagnostics, type SessionHostDisconnectInfo, type SessionHostDisconnectReason, type SessionHostDuplicateSessionGroup, type SessionHostEndpoint, type SessionHostEndpointOptions, type SessionHostEvent, type SessionHostEventEnvelope, type SessionHostLogEntry, type SessionHostPruneDuplicatesResult, type SessionHostRecord, SessionHostRegistry, type SessionHostRequest, type SessionHostRequestEnvelope, type SessionHostRequestTrace, type SessionHostRequestType, type SessionHostResponse, type SessionHostResponseEnvelope, type SessionHostRuntimeTransition, type SessionHostSnapshot, type SessionHostSurfaceKind, type SessionHostSurfaceRecordLike, type SessionHostWireEnvelope, type SessionLaunchCommand, type SessionLifecycle, type SessionOwnerType, SessionRingBuffer, type SessionRingBufferOptions, type SessionTerminalSnapshot, type SessionTerminalState, type SessionTermination, type SessionTransport, type SessionWriteOwner, type StopMeshWriterPayload, type StopSessionIfExpectedPayload, type StopSessionPayload, type UpdateSessionMetaPayload, applyTerminalColorEnv, assertTestStorageIsolated, buildRuntimeDisplayName, buildRuntimeKey, canonicalizeInstancePath, classifyTermination, createCliChildPriorityPolicy, createLineParser, createResponseEnvelope, createSessionHostControlPlane, disconnectSessionHostClients, ensureNodePtySpawnHelperPermissions, findConnectedSessionHostClient, formatRuntimeOwner, getDefaultSessionHostEndpoint, getSessionHostRecoveryLabel, getSessionHostSurfaceKind, getWorkspaceLabel, hiddenSpawn as hiddenSpawnProcess, hostBootIdFromStartedAt, isDefaultInstanceConfigDir, isSessionHostLiveRuntime, isSessionHostRecoverySnapshot, isTerminalRecord, niceLaunch, partitionSessionHostDiagnosticsSessions, partitionSessionHostRecords, refuseCleanupExpectedDelete, refuseCleanupExpectedStop, replayLaunchEnv, resolveAttachableRuntimeRecord, resolveHostBootId, resolveInstanceConfigDir, resolveRuntimeRecord, resolveSessionHostIpcKey, sanitizeSpawnEnv, spawnCliChild, stripCleanupAfterStopSideEffect, tagCleanupAfterStopSideEffect, validateSessionHostEndpoint, writeEnvelope };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,79 +3,6 @@ import { SpawnOptions, ChildProcess } from 'node:child_process';
|
|
|
3
3
|
import * as net from 'net';
|
|
4
4
|
export { DEFAULT_SESSION_HOST_COLS, DEFAULT_SESSION_HOST_ROWS, resolveSessionHostCols, resolveSessionHostRows } from './defaults.js';
|
|
5
5
|
|
|
6
|
-
/** This association is owner asserted, never a historical native receipt. */
|
|
7
|
-
declare const OPERATOR_RECOVERY_TARGET: Readonly<{
|
|
8
|
-
association: "operator_asserted";
|
|
9
|
-
taskId: "a1cdf3c0-f029-4d17-a8e9-db64e0a55501";
|
|
10
|
-
meshId: "mesh_271444af883843e9b36c67155b87b22f";
|
|
11
|
-
attemptId: "mesh_queue:mesh_271444af883843e9b36c67155b87b22f:a1cdf3c0-f029-4d17-a8e9-db64e0a55501:0";
|
|
12
|
-
generation: 0;
|
|
13
|
-
dispatchNonce: 1;
|
|
14
|
-
deliveryId: "dlv-7e259b34-b049-47ee-a466-2ca9c12bcff4";
|
|
15
|
-
ownerDaemonId: "daemon_mach_4462a75330c548be9c2e74dd9f7f6ffb";
|
|
16
|
-
nodeId: "node_d82de0cef9b042b6948986609e32142f";
|
|
17
|
-
workerDaemonId: "daemon_mach_6733c865d60f432dbeb119a6875ee303";
|
|
18
|
-
sessionId: "de321185-4ebc-40aa-8c6e-b4919e87fae3";
|
|
19
|
-
providerSessionId: "60806c79-7d77-4614-9fa6-e628533478ba";
|
|
20
|
-
namespace: "6a2ef3162182";
|
|
21
|
-
}>;
|
|
22
|
-
declare const recoveryTargetBytes: string;
|
|
23
|
-
/** Shared final admission guard for saved IDs, new aliases and provider argv.
|
|
24
|
-
* This is a permanent exact-target denial, independent of journal availability. */
|
|
25
|
-
declare function assertRecoveryLaunchIdentity(value: unknown): void;
|
|
26
|
-
type RecoveryOwnerOperation = 'anchor_recover' | 'fence_install' | 'witness_enroll';
|
|
27
|
-
interface RecoveryOwnerGrant {
|
|
28
|
-
readonly purpose: 'operator_recovery_v1';
|
|
29
|
-
readonly operation: RecoveryOwnerOperation;
|
|
30
|
-
}
|
|
31
|
-
declare function isRecoveryEndpoint(endpoint: string): boolean;
|
|
32
|
-
interface RecoveryOwnerChallenge {
|
|
33
|
-
readonly message: string;
|
|
34
|
-
}
|
|
35
|
-
interface RecoveryOwnerEnrollment {
|
|
36
|
-
/** Trusted boot dependency, provisioned outside delegated worker authority.
|
|
37
|
-
* Do not load this from daemon config, IPC arguments or an MCP credential. */
|
|
38
|
-
publicKey: string;
|
|
39
|
-
enrollmentId: string;
|
|
40
|
-
coordinatorBootId: string;
|
|
41
|
-
authEpoch: string;
|
|
42
|
-
verifyCurrent: () => boolean;
|
|
43
|
-
}
|
|
44
|
-
/** Signature possession authenticates the separately enrolled owner signer.
|
|
45
|
-
* This verifier does not enroll keys or assert user presence on their behalf. */
|
|
46
|
-
declare class RecoveryOwnerAdmission {
|
|
47
|
-
private readonly clock;
|
|
48
|
-
private readonly key;
|
|
49
|
-
private readonly enrollment;
|
|
50
|
-
private readonly pending;
|
|
51
|
-
private readonly grants;
|
|
52
|
-
private lastNow;
|
|
53
|
-
constructor(enrollment: RecoveryOwnerEnrollment, clock?: () => number);
|
|
54
|
-
private now;
|
|
55
|
-
challenge(operation?: RecoveryOwnerOperation): RecoveryOwnerChallenge;
|
|
56
|
-
authorize(message: string, signature: string): RecoveryOwnerGrant;
|
|
57
|
-
assertGrant(grant: unknown): asserts grant is RecoveryOwnerGrant;
|
|
58
|
-
/** Burn synchronously before any work or await. The private continuation
|
|
59
|
-
* rechecks the ORIGINAL deadline and revocation; it cannot mint a new grant. */
|
|
60
|
-
reserve(grant: unknown, operation: RecoveryOwnerOperation): () => void;
|
|
61
|
-
consume(grant: unknown): void;
|
|
62
|
-
}
|
|
63
|
-
interface RecoveryHostBinding {
|
|
64
|
-
namespace: string;
|
|
65
|
-
endpoint: string;
|
|
66
|
-
hostBootId: string;
|
|
67
|
-
workerDaemonId: string;
|
|
68
|
-
}
|
|
69
|
-
interface RecoveryPhysicalProof extends RecoveryHostBinding {
|
|
70
|
-
protocol: 1;
|
|
71
|
-
verdict: 'ABSENT' | 'LIVE' | 'UNKNOWN';
|
|
72
|
-
reason: string;
|
|
73
|
-
nonce: string;
|
|
74
|
-
fenceDigest: string;
|
|
75
|
-
sessionId: string;
|
|
76
|
-
providerSessionId: string;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
6
|
type SessionTransport = 'pty';
|
|
80
7
|
type SessionHostCategory = 'cli' | 'acp' | 'shell';
|
|
81
8
|
type SessionLifecycle = 'starting' | 'running' | 'stopping' | 'stopped' | 'failed' | 'interrupted';
|
|
@@ -444,26 +371,6 @@ interface HostUpgradeLeasePayload {
|
|
|
444
371
|
token: string;
|
|
445
372
|
}
|
|
446
373
|
type SessionHostRequest = {
|
|
447
|
-
type: 'prepare_operator_recovery_fence_v1';
|
|
448
|
-
payload?: {};
|
|
449
|
-
} | {
|
|
450
|
-
type: 'install_operator_recovery_fence_v1';
|
|
451
|
-
payload: {
|
|
452
|
-
message: string;
|
|
453
|
-
signature: string;
|
|
454
|
-
};
|
|
455
|
-
} | {
|
|
456
|
-
type: 'attest_operator_recovery_v1';
|
|
457
|
-
payload: {
|
|
458
|
-
nonce: string;
|
|
459
|
-
fenceDigest: string;
|
|
460
|
-
};
|
|
461
|
-
} | {
|
|
462
|
-
type: 'get_operator_recovery_coverage_v1';
|
|
463
|
-
payload: {
|
|
464
|
-
nonce: string;
|
|
465
|
-
};
|
|
466
|
-
} | {
|
|
467
374
|
type: 'get_upgrade_lease';
|
|
468
375
|
payload?: {};
|
|
469
376
|
} | {
|
|
@@ -1215,4 +1122,4 @@ interface SessionHostControlTransport {
|
|
|
1215
1122
|
*/
|
|
1216
1123
|
declare function createSessionHostControlPlane(transport: SessionHostControlTransport): SessionHostControlPlane;
|
|
1217
1124
|
|
|
1218
|
-
export { type AcquireWritePayload, type AttachSessionPayload, CLEANUP_AFTER_STOP_SIDE_EFFECT_PREFIX, CLI_CHILD_NICE_ENV, CLI_CHILD_NICE_INCREMENT, CLI_CHILD_SCHEDULING_ENV, type ClearSessionBufferPayload, type CreateSessionPayload, DEFAULT_CONFIG_DIR_NAME, DEFAULT_SESSION_RING_BUFFER_MAX_BYTES, type DeleteSessionIfExpectedPayload, type DetachSessionPayload, type ForceDetachClientPayload, type GetHostDiagnosticsPayload, type GetSnapshotPayload, type GetTerminalSnapshotPayload, type HostUpgradeLeasePayload, type MeshWriterAssignment, type MeshWriterStopTarget, type NiceLaunch,
|
|
1125
|
+
export { type AcquireWritePayload, type AttachSessionPayload, CLEANUP_AFTER_STOP_SIDE_EFFECT_PREFIX, CLI_CHILD_NICE_ENV, CLI_CHILD_NICE_INCREMENT, CLI_CHILD_SCHEDULING_ENV, type ClearSessionBufferPayload, type CreateSessionPayload, DEFAULT_CONFIG_DIR_NAME, DEFAULT_SESSION_RING_BUFFER_MAX_BYTES, type DeleteSessionIfExpectedPayload, type DetachSessionPayload, type ForceDetachClientPayload, type GetHostDiagnosticsPayload, type GetSnapshotPayload, type GetTerminalSnapshotPayload, type HostUpgradeLeasePayload, type MeshWriterAssignment, type MeshWriterStopTarget, type NiceLaunch, type PruneDuplicateSessionsPayload, type ReleaseWritePayload, type ResizeSessionPayload, type RestartSessionPayload, type ResumeSessionPayload, SESSION_HOST_SUPPORTED_REQUEST_TYPES, type SendInputPayload, type SendSignalPayload, type SessionAttachedClient, type SessionBufferSnapshot, type SessionCleanupExpectedAssignment, type SessionClientType, type SessionHostCategory, type SessionHostCensus, SessionHostClient, type SessionHostClientOptions, type SessionHostControlPlane, type SessionHostControlTransport, type SessionHostDiagnostics, type SessionHostDisconnectInfo, type SessionHostDisconnectReason, type SessionHostDuplicateSessionGroup, type SessionHostEndpoint, type SessionHostEndpointOptions, type SessionHostEvent, type SessionHostEventEnvelope, type SessionHostLogEntry, type SessionHostPruneDuplicatesResult, type SessionHostRecord, SessionHostRegistry, type SessionHostRequest, type SessionHostRequestEnvelope, type SessionHostRequestTrace, type SessionHostRequestType, type SessionHostResponse, type SessionHostResponseEnvelope, type SessionHostRuntimeTransition, type SessionHostSnapshot, type SessionHostSurfaceKind, type SessionHostSurfaceRecordLike, type SessionHostWireEnvelope, type SessionLaunchCommand, type SessionLifecycle, type SessionOwnerType, SessionRingBuffer, type SessionRingBufferOptions, type SessionTerminalSnapshot, type SessionTerminalState, type SessionTermination, type SessionTransport, type SessionWriteOwner, type StopMeshWriterPayload, type StopSessionIfExpectedPayload, type StopSessionPayload, type UpdateSessionMetaPayload, applyTerminalColorEnv, assertTestStorageIsolated, buildRuntimeDisplayName, buildRuntimeKey, canonicalizeInstancePath, classifyTermination, createCliChildPriorityPolicy, createLineParser, createResponseEnvelope, createSessionHostControlPlane, disconnectSessionHostClients, ensureNodePtySpawnHelperPermissions, findConnectedSessionHostClient, formatRuntimeOwner, getDefaultSessionHostEndpoint, getSessionHostRecoveryLabel, getSessionHostSurfaceKind, getWorkspaceLabel, hiddenSpawn as hiddenSpawnProcess, hostBootIdFromStartedAt, isDefaultInstanceConfigDir, isSessionHostLiveRuntime, isSessionHostRecoverySnapshot, isTerminalRecord, niceLaunch, partitionSessionHostDiagnosticsSessions, partitionSessionHostRecords, refuseCleanupExpectedDelete, refuseCleanupExpectedStop, replayLaunchEnv, resolveAttachableRuntimeRecord, resolveHostBootId, resolveInstanceConfigDir, resolveRuntimeRecord, resolveSessionHostIpcKey, sanitizeSpawnEnv, spawnCliChild, stripCleanupAfterStopSideEffect, tagCleanupAfterStopSideEffect, validateSessionHostEndpoint, writeEnvelope };
|
package/dist/index.js
CHANGED
|
@@ -38,14 +38,11 @@ __export(index_exports, {
|
|
|
38
38
|
DEFAULT_SESSION_HOST_COLS: () => DEFAULT_SESSION_HOST_COLS,
|
|
39
39
|
DEFAULT_SESSION_HOST_ROWS: () => DEFAULT_SESSION_HOST_ROWS,
|
|
40
40
|
DEFAULT_SESSION_RING_BUFFER_MAX_BYTES: () => DEFAULT_SESSION_RING_BUFFER_MAX_BYTES,
|
|
41
|
-
OPERATOR_RECOVERY_TARGET: () => OPERATOR_RECOVERY_TARGET,
|
|
42
|
-
RecoveryOwnerAdmission: () => RecoveryOwnerAdmission,
|
|
43
41
|
SESSION_HOST_SUPPORTED_REQUEST_TYPES: () => SESSION_HOST_SUPPORTED_REQUEST_TYPES,
|
|
44
42
|
SessionHostClient: () => SessionHostClient,
|
|
45
43
|
SessionHostRegistry: () => SessionHostRegistry,
|
|
46
44
|
SessionRingBuffer: () => SessionRingBuffer,
|
|
47
45
|
applyTerminalColorEnv: () => applyTerminalColorEnv,
|
|
48
|
-
assertRecoveryLaunchIdentity: () => assertRecoveryLaunchIdentity,
|
|
49
46
|
assertTestStorageIsolated: () => assertTestStorageIsolated,
|
|
50
47
|
buildRuntimeDisplayName: () => buildRuntimeDisplayName,
|
|
51
48
|
buildRuntimeKey: () => buildRuntimeKey,
|
|
@@ -66,14 +63,12 @@ __export(index_exports, {
|
|
|
66
63
|
hiddenSpawnProcess: () => hiddenSpawn,
|
|
67
64
|
hostBootIdFromStartedAt: () => hostBootIdFromStartedAt,
|
|
68
65
|
isDefaultInstanceConfigDir: () => isDefaultInstanceConfigDir,
|
|
69
|
-
isRecoveryEndpoint: () => isRecoveryEndpoint,
|
|
70
66
|
isSessionHostLiveRuntime: () => isSessionHostLiveRuntime,
|
|
71
67
|
isSessionHostRecoverySnapshot: () => isSessionHostRecoverySnapshot,
|
|
72
68
|
isTerminalRecord: () => isTerminalRecord,
|
|
73
69
|
niceLaunch: () => niceLaunch,
|
|
74
70
|
partitionSessionHostDiagnosticsSessions: () => partitionSessionHostDiagnosticsSessions,
|
|
75
71
|
partitionSessionHostRecords: () => partitionSessionHostRecords,
|
|
76
|
-
recoveryTargetBytes: () => recoveryTargetBytes,
|
|
77
72
|
refuseCleanupExpectedDelete: () => refuseCleanupExpectedDelete,
|
|
78
73
|
refuseCleanupExpectedStop: () => refuseCleanupExpectedStop,
|
|
79
74
|
replayLaunchEnv: () => replayLaunchEnv,
|
|
@@ -93,129 +88,8 @@ __export(index_exports, {
|
|
|
93
88
|
});
|
|
94
89
|
module.exports = __toCommonJS(index_exports);
|
|
95
90
|
|
|
96
|
-
// src/operator-recovery.ts
|
|
97
|
-
var import_node_crypto = require("crypto");
|
|
98
|
-
var import_node_path = require("path");
|
|
99
|
-
var import_node_perf_hooks = require("perf_hooks");
|
|
100
|
-
var OPERATOR_RECOVERY_TARGET = Object.freeze({
|
|
101
|
-
association: "operator_asserted",
|
|
102
|
-
taskId: "a1cdf3c0-f029-4d17-a8e9-db64e0a55501",
|
|
103
|
-
meshId: "mesh_271444af883843e9b36c67155b87b22f",
|
|
104
|
-
attemptId: "mesh_queue:mesh_271444af883843e9b36c67155b87b22f:a1cdf3c0-f029-4d17-a8e9-db64e0a55501:0",
|
|
105
|
-
generation: 0,
|
|
106
|
-
dispatchNonce: 1,
|
|
107
|
-
deliveryId: "dlv-7e259b34-b049-47ee-a466-2ca9c12bcff4",
|
|
108
|
-
ownerDaemonId: "daemon_mach_4462a75330c548be9c2e74dd9f7f6ffb",
|
|
109
|
-
nodeId: "node_d82de0cef9b042b6948986609e32142f",
|
|
110
|
-
workerDaemonId: "daemon_mach_6733c865d60f432dbeb119a6875ee303",
|
|
111
|
-
sessionId: "de321185-4ebc-40aa-8c6e-b4919e87fae3",
|
|
112
|
-
providerSessionId: "60806c79-7d77-4614-9fa6-e628533478ba",
|
|
113
|
-
namespace: "6a2ef3162182"
|
|
114
|
-
});
|
|
115
|
-
var recoveryTargetBytes = JSON.stringify(OPERATOR_RECOVERY_TARGET);
|
|
116
|
-
function assertRecoveryLaunchIdentity(value) {
|
|
117
|
-
if (!value || typeof value !== "object") return;
|
|
118
|
-
const identities = /* @__PURE__ */ new Set([
|
|
119
|
-
"sessionId",
|
|
120
|
-
"runtimeId",
|
|
121
|
-
"runtimeSessionId",
|
|
122
|
-
"providerSessionId",
|
|
123
|
-
"presetSessionKey",
|
|
124
|
-
"resumeSessionId",
|
|
125
|
-
"key"
|
|
126
|
-
]);
|
|
127
|
-
const nested = /* @__PURE__ */ new Set(["options", "meta", "settings", "settingsOverride", "restartBinding", "sessionBinding", "launchCommand"]);
|
|
128
|
-
for (const [key, field] of Object.entries(value)) {
|
|
129
|
-
if (identities.has(key) || ["args", "cliArgs", "cliArgsWithBrain"].includes(key)) {
|
|
130
|
-
const bytes = JSON.stringify(field)?.toLowerCase();
|
|
131
|
-
if (bytes?.includes(OPERATOR_RECOVERY_TARGET.sessionId) || bytes?.includes(OPERATOR_RECOVERY_TARGET.providerSessionId)) {
|
|
132
|
-
throw new Error("operator_recovery_fenced");
|
|
133
|
-
}
|
|
134
|
-
} else if (nested.has(key)) assertRecoveryLaunchIdentity(field);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
function isRecoveryEndpoint(endpoint) {
|
|
138
|
-
return (0, import_node_path.isAbsolute)(endpoint) && (0, import_node_path.basename)(endpoint) === `adhdev-preview-session-host-${OPERATOR_RECOVERY_TARGET.namespace}.sock`;
|
|
139
|
-
}
|
|
140
|
-
var RecoveryOwnerAdmission = class {
|
|
141
|
-
constructor(enrollment, clock = () => import_node_perf_hooks.performance.now()) {
|
|
142
|
-
this.clock = clock;
|
|
143
|
-
this.enrollment = Object.freeze({ ...enrollment });
|
|
144
|
-
if (!enrollment.enrollmentId || !enrollment.coordinatorBootId || !enrollment.authEpoch || typeof enrollment.verifyCurrent !== "function") throw new Error("recovery_owner_enrollment_required");
|
|
145
|
-
this.key = (0, import_node_crypto.createPublicKey)(enrollment.publicKey);
|
|
146
|
-
if (this.key.asymmetricKeyType !== "ed25519") throw new Error("recovery_owner_key_type");
|
|
147
|
-
}
|
|
148
|
-
key;
|
|
149
|
-
enrollment;
|
|
150
|
-
pending = /* @__PURE__ */ new Map();
|
|
151
|
-
grants = /* @__PURE__ */ new WeakMap();
|
|
152
|
-
lastNow = -Infinity;
|
|
153
|
-
now() {
|
|
154
|
-
const n = this.clock();
|
|
155
|
-
if (!Number.isFinite(n) || n < this.lastNow || this.enrollment.verifyCurrent() !== true) {
|
|
156
|
-
this.pending.clear();
|
|
157
|
-
this.lastNow = Infinity;
|
|
158
|
-
throw new Error("recovery_owner_revoked");
|
|
159
|
-
}
|
|
160
|
-
this.lastNow = n;
|
|
161
|
-
return n;
|
|
162
|
-
}
|
|
163
|
-
challenge(operation = "anchor_recover") {
|
|
164
|
-
if (!["anchor_recover", "fence_install", "witness_enroll"].includes(operation)) throw new Error("recovery_owner_operation_rejected");
|
|
165
|
-
const now = this.now();
|
|
166
|
-
for (const [message2, entry] of this.pending) if (entry.deadline <= now) this.pending.delete(message2);
|
|
167
|
-
if (this.pending.size >= 16) throw new Error("recovery_owner_challenge_limit");
|
|
168
|
-
const message = JSON.stringify([
|
|
169
|
-
"operator_recovery_v1",
|
|
170
|
-
operation,
|
|
171
|
-
recoveryTargetBytes,
|
|
172
|
-
this.enrollment.enrollmentId,
|
|
173
|
-
this.enrollment.coordinatorBootId,
|
|
174
|
-
this.enrollment.authEpoch,
|
|
175
|
-
(0, import_node_crypto.randomBytes)(32).toString("hex")
|
|
176
|
-
]);
|
|
177
|
-
this.pending.set(message, { deadline: now + 3e4, operation });
|
|
178
|
-
return Object.freeze({ message });
|
|
179
|
-
}
|
|
180
|
-
authorize(message, signature) {
|
|
181
|
-
const now = this.now();
|
|
182
|
-
const entry = this.pending.get(message);
|
|
183
|
-
this.pending.delete(message);
|
|
184
|
-
if (!entry || now >= entry.deadline || !/^[a-f0-9]{128}$/.test(signature) || !(0, import_node_crypto.verify)(null, Buffer.from(message), this.key, Buffer.from(signature, "hex"))) {
|
|
185
|
-
throw new Error("recovery_owner_signature_rejected");
|
|
186
|
-
}
|
|
187
|
-
const grant = Object.freeze({ purpose: "operator_recovery_v1", operation: entry.operation });
|
|
188
|
-
this.grants.set(grant, entry);
|
|
189
|
-
return grant;
|
|
190
|
-
}
|
|
191
|
-
assertGrant(grant) {
|
|
192
|
-
const now = this.now();
|
|
193
|
-
const entry = typeof grant === "object" && grant !== null ? this.grants.get(grant) : void 0;
|
|
194
|
-
if (!entry || now >= entry.deadline) throw new Error("recovery_owner_grant_rejected");
|
|
195
|
-
}
|
|
196
|
-
/** Burn synchronously before any work or await. The private continuation
|
|
197
|
-
* rechecks the ORIGINAL deadline and revocation; it cannot mint a new grant. */
|
|
198
|
-
reserve(grant, operation) {
|
|
199
|
-
this.assertGrant(grant);
|
|
200
|
-
const entry = this.grants.get(grant);
|
|
201
|
-
this.grants.delete(grant);
|
|
202
|
-
if (entry.operation !== operation) throw new Error("recovery_owner_operation_rejected");
|
|
203
|
-
return () => {
|
|
204
|
-
if (this.now() >= entry.deadline) throw new Error("recovery_owner_grant_rejected");
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
consume(grant) {
|
|
208
|
-
this.assertGrant(grant);
|
|
209
|
-
this.grants.delete(grant);
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
|
|
213
91
|
// src/types.ts
|
|
214
92
|
var SESSION_HOST_SUPPORTED_REQUEST_TYPES = [
|
|
215
|
-
"prepare_operator_recovery_fence_v1",
|
|
216
|
-
"install_operator_recovery_fence_v1",
|
|
217
|
-
"attest_operator_recovery_v1",
|
|
218
|
-
"get_operator_recovery_coverage_v1",
|
|
219
93
|
"get_upgrade_lease",
|
|
220
94
|
"acquire_upgrade_lease",
|
|
221
95
|
"release_upgrade_lease",
|
|
@@ -1719,14 +1593,11 @@ function createSessionHostControlPlane(transport) {
|
|
|
1719
1593
|
DEFAULT_SESSION_HOST_COLS,
|
|
1720
1594
|
DEFAULT_SESSION_HOST_ROWS,
|
|
1721
1595
|
DEFAULT_SESSION_RING_BUFFER_MAX_BYTES,
|
|
1722
|
-
OPERATOR_RECOVERY_TARGET,
|
|
1723
|
-
RecoveryOwnerAdmission,
|
|
1724
1596
|
SESSION_HOST_SUPPORTED_REQUEST_TYPES,
|
|
1725
1597
|
SessionHostClient,
|
|
1726
1598
|
SessionHostRegistry,
|
|
1727
1599
|
SessionRingBuffer,
|
|
1728
1600
|
applyTerminalColorEnv,
|
|
1729
|
-
assertRecoveryLaunchIdentity,
|
|
1730
1601
|
assertTestStorageIsolated,
|
|
1731
1602
|
buildRuntimeDisplayName,
|
|
1732
1603
|
buildRuntimeKey,
|
|
@@ -1747,14 +1618,12 @@ function createSessionHostControlPlane(transport) {
|
|
|
1747
1618
|
hiddenSpawnProcess,
|
|
1748
1619
|
hostBootIdFromStartedAt,
|
|
1749
1620
|
isDefaultInstanceConfigDir,
|
|
1750
|
-
isRecoveryEndpoint,
|
|
1751
1621
|
isSessionHostLiveRuntime,
|
|
1752
1622
|
isSessionHostRecoverySnapshot,
|
|
1753
1623
|
isTerminalRecord,
|
|
1754
1624
|
niceLaunch,
|
|
1755
1625
|
partitionSessionHostDiagnosticsSessions,
|
|
1756
1626
|
partitionSessionHostRecords,
|
|
1757
|
-
recoveryTargetBytes,
|
|
1758
1627
|
refuseCleanupExpectedDelete,
|
|
1759
1628
|
refuseCleanupExpectedStop,
|
|
1760
1629
|
replayLaunchEnv,
|