@adhdev/session-host-core 0.9.81 → 0.9.82-rc.452

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 CHANGED
@@ -30,6 +30,25 @@ interface SessionBufferSnapshot {
30
30
  cols?: number;
31
31
  rows?: number;
32
32
  }
33
+ interface SessionTerminalState {
34
+ cursor: {
35
+ row: number;
36
+ col: number;
37
+ };
38
+ altScreen: boolean;
39
+ pasteMode: boolean;
40
+ rawMode: boolean;
41
+ scrollRegion: {
42
+ top: number;
43
+ bot: number;
44
+ };
45
+ cols: number;
46
+ rows: number;
47
+ }
48
+ interface SessionTerminalSnapshot {
49
+ text: string;
50
+ state: SessionTerminalState;
51
+ }
33
52
  interface SessionBufferState {
34
53
  scrollbackBytes: number;
35
54
  snapshotSeq: number;
@@ -115,6 +134,9 @@ interface GetSnapshotPayload {
115
134
  sessionId: string;
116
135
  sinceSeq?: number;
117
136
  }
137
+ interface GetTerminalSnapshotPayload {
138
+ sessionId: string;
139
+ }
118
140
  interface ClearSessionBufferPayload {
119
141
  sessionId: string;
120
142
  }
@@ -229,6 +251,9 @@ type SessionHostRequest = {
229
251
  } | {
230
252
  type: 'get_snapshot';
231
253
  payload: GetSnapshotPayload;
254
+ } | {
255
+ type: 'get_terminal_snapshot';
256
+ payload: GetTerminalSnapshotPayload;
232
257
  } | {
233
258
  type: 'clear_session_buffer';
234
259
  payload: ClearSessionBufferPayload;
@@ -398,6 +423,12 @@ declare function isSessionHostLiveRuntime(record: SessionHostSurfaceRecordLike |
398
423
  declare function getSessionHostRecoveryLabel(meta: Record<string, unknown> | null | undefined): string | null;
399
424
  declare function isSessionHostRecoverySnapshot(record: SessionHostSurfaceRecordLike | null | undefined): boolean;
400
425
  declare function getSessionHostSurfaceKind(record: SessionHostSurfaceRecordLike | null | undefined): SessionHostSurfaceKind;
426
+ declare function partitionSessionHostRecords<T extends SessionHostSurfaceRecordLike>(records: T[]): {
427
+ liveRuntimes: T[];
428
+ recoverySnapshots: T[];
429
+ inactiveRecords: T[];
430
+ };
431
+ declare function partitionSessionHostDiagnosticsSessions(records: SessionHostRecord[] | null | undefined): ReturnType<typeof partitionSessionHostRecords<SessionHostRecord>>;
401
432
  declare function resolveAttachableRuntimeRecord(records: SessionHostRecord[], identifier: string): SessionHostRecord;
402
433
  declare function resolveRuntimeRecord(records: SessionHostRecord[], identifier: string): SessionHostRecord;
403
434
  declare function formatRuntimeOwner(record: Pick<SessionHostRecord, 'writeOwner'>): string;
@@ -455,4 +486,48 @@ declare function applyTerminalColorEnv(env: Record<string, string>): void;
455
486
  */
456
487
  declare function ensureNodePtySpawnHelperPermissions(logFn?: (msg: string) => void): void;
457
488
 
458
- export { type AcquireWritePayload, type AttachSessionPayload, type ClearSessionBufferPayload, type CreateSessionPayload, DEFAULT_SESSION_RING_BUFFER_MAX_BYTES, type DetachSessionPayload, type ForceDetachClientPayload, type GetHostDiagnosticsPayload, type GetSnapshotPayload, type PruneDuplicateSessionsPayload, type ReleaseWritePayload, type ResizeSessionPayload, type RestartSessionPayload, type ResumeSessionPayload, SESSION_HOST_SUPPORTED_REQUEST_TYPES, type SendInputPayload, type SendSignalPayload, type SessionAttachedClient, type SessionBufferSnapshot, type SessionClientType, type SessionHostCategory, SessionHostClient, type SessionHostClientOptions, type SessionHostDiagnostics, type SessionHostDuplicateSessionGroup, type SessionHostEndpoint, 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 SessionHostSurfaceKind, type SessionHostWireEnvelope, type SessionLaunchCommand, type SessionLifecycle, type SessionOwnerType, SessionRingBuffer, type SessionRingBufferOptions, type SessionTransport, type SessionWriteOwner, type StopSessionPayload, type UpdateSessionMetaPayload, applyTerminalColorEnv, buildRuntimeDisplayName, buildRuntimeKey, createLineParser, createResponseEnvelope, ensureNodePtySpawnHelperPermissions, formatRuntimeOwner, getDefaultSessionHostEndpoint, getSessionHostRecoveryLabel, getSessionHostSurfaceKind, getWorkspaceLabel, isSessionHostLiveRuntime, isSessionHostRecoverySnapshot, resolveAttachableRuntimeRecord, resolveRuntimeRecord, sanitizeSpawnEnv, writeEnvelope };
489
+ /**
490
+ * The 11-method session-host control-plane surface shared by the cloud and
491
+ * standalone daemons. Both daemons used to carry a byte-for-byte copy of this
492
+ * dispatch table plus the identical throw strings; this is the single source of
493
+ * truth for that mapping. The wire `type` strings and error text here are the
494
+ * daemon IPC contract and MUST match what the session-host daemon accepts.
495
+ */
496
+ interface SessionHostControlPlane {
497
+ getDiagnostics(payload?: GetHostDiagnosticsPayload): Promise<SessionHostDiagnostics>;
498
+ listSessions(): Promise<SessionHostRecord[]>;
499
+ stopSession(sessionId: string): Promise<SessionHostRecord | null>;
500
+ deleteSession(sessionId: string, opts?: {
501
+ force?: boolean;
502
+ }): Promise<SessionHostRecord | null>;
503
+ resumeSession(sessionId: string): Promise<SessionHostRecord | null>;
504
+ restartSession(sessionId: string): Promise<SessionHostRecord | null>;
505
+ sendSignal(sessionId: string, signal: string): Promise<SessionHostRecord | null>;
506
+ forceDetachClient(sessionId: string, clientId: string): Promise<SessionHostRecord | null>;
507
+ pruneDuplicateSessions(payload?: PruneDuplicateSessionsPayload): Promise<SessionHostPruneDuplicatesResult>;
508
+ acquireWrite(payload: AcquireWritePayload): Promise<SessionHostRecord | null>;
509
+ releaseWrite(payload: ReleaseWritePayload): Promise<SessionHostRecord | null>;
510
+ }
511
+ /**
512
+ * Minimal request transport the control-plane factory needs. Each daemon injects
513
+ * its own implementation:
514
+ * - cloud reuses a single persistent SessionHostClient (with reconnect); its
515
+ * `request` calls `ensureConnected()` then the shared client.
516
+ * - standalone opens a fresh client per request and closes it in `finally`.
517
+ *
518
+ * The factory below owns ONLY the type/payload dispatch table; the connection
519
+ * lifecycle and success/error unwrapping stay in each daemon's transport so the
520
+ * observable behavior of both paths is preserved exactly.
521
+ */
522
+ interface SessionHostControlTransport {
523
+ request<T>(type: SessionHostRequestType, payload: Record<string, unknown>): Promise<T>;
524
+ }
525
+ /**
526
+ * Build the shared 11-method control-plane over an injected request transport.
527
+ * The (type string, payload shape) pairs are verbatim what both daemons emitted
528
+ * previously — do not reword them without matching the session-host daemon's
529
+ * request handlers.
530
+ */
531
+ declare function createSessionHostControlPlane(transport: SessionHostControlTransport): SessionHostControlPlane;
532
+
533
+ export { type AcquireWritePayload, type AttachSessionPayload, type ClearSessionBufferPayload, type CreateSessionPayload, DEFAULT_SESSION_RING_BUFFER_MAX_BYTES, type DetachSessionPayload, type ForceDetachClientPayload, type GetHostDiagnosticsPayload, type GetSnapshotPayload, type GetTerminalSnapshotPayload, type PruneDuplicateSessionsPayload, type ReleaseWritePayload, type ResizeSessionPayload, type RestartSessionPayload, type ResumeSessionPayload, SESSION_HOST_SUPPORTED_REQUEST_TYPES, type SendInputPayload, type SendSignalPayload, type SessionAttachedClient, type SessionBufferSnapshot, type SessionClientType, type SessionHostCategory, SessionHostClient, type SessionHostClientOptions, type SessionHostControlPlane, type SessionHostControlTransport, type SessionHostDiagnostics, type SessionHostDuplicateSessionGroup, type SessionHostEndpoint, 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 SessionHostSurfaceKind, type SessionHostSurfaceRecordLike, type SessionHostWireEnvelope, type SessionLaunchCommand, type SessionLifecycle, type SessionOwnerType, SessionRingBuffer, type SessionRingBufferOptions, type SessionTerminalSnapshot, type SessionTerminalState, type SessionTransport, type SessionWriteOwner, type StopSessionPayload, type UpdateSessionMetaPayload, applyTerminalColorEnv, buildRuntimeDisplayName, buildRuntimeKey, createLineParser, createResponseEnvelope, createSessionHostControlPlane, ensureNodePtySpawnHelperPermissions, formatRuntimeOwner, getDefaultSessionHostEndpoint, getSessionHostRecoveryLabel, getSessionHostSurfaceKind, getWorkspaceLabel, isSessionHostLiveRuntime, isSessionHostRecoverySnapshot, partitionSessionHostDiagnosticsSessions, partitionSessionHostRecords, resolveAttachableRuntimeRecord, resolveRuntimeRecord, sanitizeSpawnEnv, writeEnvelope };
package/dist/index.d.ts CHANGED
@@ -30,6 +30,25 @@ interface SessionBufferSnapshot {
30
30
  cols?: number;
31
31
  rows?: number;
32
32
  }
33
+ interface SessionTerminalState {
34
+ cursor: {
35
+ row: number;
36
+ col: number;
37
+ };
38
+ altScreen: boolean;
39
+ pasteMode: boolean;
40
+ rawMode: boolean;
41
+ scrollRegion: {
42
+ top: number;
43
+ bot: number;
44
+ };
45
+ cols: number;
46
+ rows: number;
47
+ }
48
+ interface SessionTerminalSnapshot {
49
+ text: string;
50
+ state: SessionTerminalState;
51
+ }
33
52
  interface SessionBufferState {
34
53
  scrollbackBytes: number;
35
54
  snapshotSeq: number;
@@ -115,6 +134,9 @@ interface GetSnapshotPayload {
115
134
  sessionId: string;
116
135
  sinceSeq?: number;
117
136
  }
137
+ interface GetTerminalSnapshotPayload {
138
+ sessionId: string;
139
+ }
118
140
  interface ClearSessionBufferPayload {
119
141
  sessionId: string;
120
142
  }
@@ -229,6 +251,9 @@ type SessionHostRequest = {
229
251
  } | {
230
252
  type: 'get_snapshot';
231
253
  payload: GetSnapshotPayload;
254
+ } | {
255
+ type: 'get_terminal_snapshot';
256
+ payload: GetTerminalSnapshotPayload;
232
257
  } | {
233
258
  type: 'clear_session_buffer';
234
259
  payload: ClearSessionBufferPayload;
@@ -398,6 +423,12 @@ declare function isSessionHostLiveRuntime(record: SessionHostSurfaceRecordLike |
398
423
  declare function getSessionHostRecoveryLabel(meta: Record<string, unknown> | null | undefined): string | null;
399
424
  declare function isSessionHostRecoverySnapshot(record: SessionHostSurfaceRecordLike | null | undefined): boolean;
400
425
  declare function getSessionHostSurfaceKind(record: SessionHostSurfaceRecordLike | null | undefined): SessionHostSurfaceKind;
426
+ declare function partitionSessionHostRecords<T extends SessionHostSurfaceRecordLike>(records: T[]): {
427
+ liveRuntimes: T[];
428
+ recoverySnapshots: T[];
429
+ inactiveRecords: T[];
430
+ };
431
+ declare function partitionSessionHostDiagnosticsSessions(records: SessionHostRecord[] | null | undefined): ReturnType<typeof partitionSessionHostRecords<SessionHostRecord>>;
401
432
  declare function resolveAttachableRuntimeRecord(records: SessionHostRecord[], identifier: string): SessionHostRecord;
402
433
  declare function resolveRuntimeRecord(records: SessionHostRecord[], identifier: string): SessionHostRecord;
403
434
  declare function formatRuntimeOwner(record: Pick<SessionHostRecord, 'writeOwner'>): string;
@@ -455,4 +486,48 @@ declare function applyTerminalColorEnv(env: Record<string, string>): void;
455
486
  */
456
487
  declare function ensureNodePtySpawnHelperPermissions(logFn?: (msg: string) => void): void;
457
488
 
458
- export { type AcquireWritePayload, type AttachSessionPayload, type ClearSessionBufferPayload, type CreateSessionPayload, DEFAULT_SESSION_RING_BUFFER_MAX_BYTES, type DetachSessionPayload, type ForceDetachClientPayload, type GetHostDiagnosticsPayload, type GetSnapshotPayload, type PruneDuplicateSessionsPayload, type ReleaseWritePayload, type ResizeSessionPayload, type RestartSessionPayload, type ResumeSessionPayload, SESSION_HOST_SUPPORTED_REQUEST_TYPES, type SendInputPayload, type SendSignalPayload, type SessionAttachedClient, type SessionBufferSnapshot, type SessionClientType, type SessionHostCategory, SessionHostClient, type SessionHostClientOptions, type SessionHostDiagnostics, type SessionHostDuplicateSessionGroup, type SessionHostEndpoint, 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 SessionHostSurfaceKind, type SessionHostWireEnvelope, type SessionLaunchCommand, type SessionLifecycle, type SessionOwnerType, SessionRingBuffer, type SessionRingBufferOptions, type SessionTransport, type SessionWriteOwner, type StopSessionPayload, type UpdateSessionMetaPayload, applyTerminalColorEnv, buildRuntimeDisplayName, buildRuntimeKey, createLineParser, createResponseEnvelope, ensureNodePtySpawnHelperPermissions, formatRuntimeOwner, getDefaultSessionHostEndpoint, getSessionHostRecoveryLabel, getSessionHostSurfaceKind, getWorkspaceLabel, isSessionHostLiveRuntime, isSessionHostRecoverySnapshot, resolveAttachableRuntimeRecord, resolveRuntimeRecord, sanitizeSpawnEnv, writeEnvelope };
489
+ /**
490
+ * The 11-method session-host control-plane surface shared by the cloud and
491
+ * standalone daemons. Both daemons used to carry a byte-for-byte copy of this
492
+ * dispatch table plus the identical throw strings; this is the single source of
493
+ * truth for that mapping. The wire `type` strings and error text here are the
494
+ * daemon IPC contract and MUST match what the session-host daemon accepts.
495
+ */
496
+ interface SessionHostControlPlane {
497
+ getDiagnostics(payload?: GetHostDiagnosticsPayload): Promise<SessionHostDiagnostics>;
498
+ listSessions(): Promise<SessionHostRecord[]>;
499
+ stopSession(sessionId: string): Promise<SessionHostRecord | null>;
500
+ deleteSession(sessionId: string, opts?: {
501
+ force?: boolean;
502
+ }): Promise<SessionHostRecord | null>;
503
+ resumeSession(sessionId: string): Promise<SessionHostRecord | null>;
504
+ restartSession(sessionId: string): Promise<SessionHostRecord | null>;
505
+ sendSignal(sessionId: string, signal: string): Promise<SessionHostRecord | null>;
506
+ forceDetachClient(sessionId: string, clientId: string): Promise<SessionHostRecord | null>;
507
+ pruneDuplicateSessions(payload?: PruneDuplicateSessionsPayload): Promise<SessionHostPruneDuplicatesResult>;
508
+ acquireWrite(payload: AcquireWritePayload): Promise<SessionHostRecord | null>;
509
+ releaseWrite(payload: ReleaseWritePayload): Promise<SessionHostRecord | null>;
510
+ }
511
+ /**
512
+ * Minimal request transport the control-plane factory needs. Each daemon injects
513
+ * its own implementation:
514
+ * - cloud reuses a single persistent SessionHostClient (with reconnect); its
515
+ * `request` calls `ensureConnected()` then the shared client.
516
+ * - standalone opens a fresh client per request and closes it in `finally`.
517
+ *
518
+ * The factory below owns ONLY the type/payload dispatch table; the connection
519
+ * lifecycle and success/error unwrapping stay in each daemon's transport so the
520
+ * observable behavior of both paths is preserved exactly.
521
+ */
522
+ interface SessionHostControlTransport {
523
+ request<T>(type: SessionHostRequestType, payload: Record<string, unknown>): Promise<T>;
524
+ }
525
+ /**
526
+ * Build the shared 11-method control-plane over an injected request transport.
527
+ * The (type string, payload shape) pairs are verbatim what both daemons emitted
528
+ * previously — do not reword them without matching the session-host daemon's
529
+ * request handlers.
530
+ */
531
+ declare function createSessionHostControlPlane(transport: SessionHostControlTransport): SessionHostControlPlane;
532
+
533
+ export { type AcquireWritePayload, type AttachSessionPayload, type ClearSessionBufferPayload, type CreateSessionPayload, DEFAULT_SESSION_RING_BUFFER_MAX_BYTES, type DetachSessionPayload, type ForceDetachClientPayload, type GetHostDiagnosticsPayload, type GetSnapshotPayload, type GetTerminalSnapshotPayload, type PruneDuplicateSessionsPayload, type ReleaseWritePayload, type ResizeSessionPayload, type RestartSessionPayload, type ResumeSessionPayload, SESSION_HOST_SUPPORTED_REQUEST_TYPES, type SendInputPayload, type SendSignalPayload, type SessionAttachedClient, type SessionBufferSnapshot, type SessionClientType, type SessionHostCategory, SessionHostClient, type SessionHostClientOptions, type SessionHostControlPlane, type SessionHostControlTransport, type SessionHostDiagnostics, type SessionHostDuplicateSessionGroup, type SessionHostEndpoint, 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 SessionHostSurfaceKind, type SessionHostSurfaceRecordLike, type SessionHostWireEnvelope, type SessionLaunchCommand, type SessionLifecycle, type SessionOwnerType, SessionRingBuffer, type SessionRingBufferOptions, type SessionTerminalSnapshot, type SessionTerminalState, type SessionTransport, type SessionWriteOwner, type StopSessionPayload, type UpdateSessionMetaPayload, applyTerminalColorEnv, buildRuntimeDisplayName, buildRuntimeKey, createLineParser, createResponseEnvelope, createSessionHostControlPlane, ensureNodePtySpawnHelperPermissions, formatRuntimeOwner, getDefaultSessionHostEndpoint, getSessionHostRecoveryLabel, getSessionHostSurfaceKind, getWorkspaceLabel, isSessionHostLiveRuntime, isSessionHostRecoverySnapshot, partitionSessionHostDiagnosticsSessions, partitionSessionHostRecords, resolveAttachableRuntimeRecord, resolveRuntimeRecord, sanitizeSpawnEnv, writeEnvelope };
package/dist/index.js CHANGED
@@ -42,6 +42,7 @@ __export(index_exports, {
42
42
  buildRuntimeKey: () => buildRuntimeKey,
43
43
  createLineParser: () => createLineParser,
44
44
  createResponseEnvelope: () => createResponseEnvelope,
45
+ createSessionHostControlPlane: () => createSessionHostControlPlane,
45
46
  ensureNodePtySpawnHelperPermissions: () => ensureNodePtySpawnHelperPermissions,
46
47
  formatRuntimeOwner: () => formatRuntimeOwner,
47
48
  getDefaultSessionHostEndpoint: () => getDefaultSessionHostEndpoint,
@@ -50,6 +51,8 @@ __export(index_exports, {
50
51
  getWorkspaceLabel: () => getWorkspaceLabel,
51
52
  isSessionHostLiveRuntime: () => isSessionHostLiveRuntime,
52
53
  isSessionHostRecoverySnapshot: () => isSessionHostRecoverySnapshot,
54
+ partitionSessionHostDiagnosticsSessions: () => partitionSessionHostDiagnosticsSessions,
55
+ partitionSessionHostRecords: () => partitionSessionHostRecords,
53
56
  resolveAttachableRuntimeRecord: () => resolveAttachableRuntimeRecord,
54
57
  resolveRuntimeRecord: () => resolveRuntimeRecord,
55
58
  resolveSessionHostCols: () => resolveSessionHostCols,
@@ -72,6 +75,7 @@ var SESSION_HOST_SUPPORTED_REQUEST_TYPES = [
72
75
  "acquire_write",
73
76
  "release_write",
74
77
  "get_snapshot",
78
+ "get_terminal_snapshot",
75
79
  "clear_session_buffer",
76
80
  "update_session_meta",
77
81
  "get_host_diagnostics",
@@ -234,6 +238,29 @@ function getSessionHostSurfaceKind(record) {
234
238
  if (isSessionHostRecoverySnapshot(record)) return "recovery_snapshot";
235
239
  return "inactive_record";
236
240
  }
241
+ function partitionSessionHostRecords(records) {
242
+ const liveRuntimes = [];
243
+ const recoverySnapshots = [];
244
+ const inactiveRecords = [];
245
+ for (const record of records) {
246
+ const kind = getSessionHostSurfaceKind(record);
247
+ if (kind === "live_runtime") {
248
+ liveRuntimes.push(record);
249
+ } else if (kind === "recovery_snapshot") {
250
+ recoverySnapshots.push(record);
251
+ } else {
252
+ inactiveRecords.push(record);
253
+ }
254
+ }
255
+ return {
256
+ liveRuntimes,
257
+ recoverySnapshots,
258
+ inactiveRecords
259
+ };
260
+ }
261
+ function partitionSessionHostDiagnosticsSessions(records) {
262
+ return partitionSessionHostRecords(records || []);
263
+ }
237
264
  function resolveAttachableRuntimeRecord(records, identifier) {
238
265
  const record = resolveRuntimeRecord(records, identifier);
239
266
  const surfaceKind = getSessionHostSurfaceKind(record);
@@ -680,6 +707,16 @@ function sanitizeSpawnEnv(baseEnv, overrides) {
680
707
  }
681
708
  delete env.CODEX_THREAD_ID;
682
709
  delete env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE;
710
+ delete env.CODEX_SANDBOX_NETWORK_DISABLED;
711
+ delete env.NO_COLOR;
712
+ delete env.COLOR;
713
+ if (process.platform === "win32") {
714
+ delete env.CLAUDECODE;
715
+ delete env.CLAUDE_CODE_CHILD_SESSION;
716
+ delete env.CLAUDE_CODE_ENTRYPOINT;
717
+ delete env.CLAUDE_CODE_SESSION_ID;
718
+ delete env.CLAUDE_CODE_EXECPATH;
719
+ }
683
720
  applyTerminalColorEnv(env);
684
721
  return env;
685
722
  }
@@ -711,6 +748,45 @@ function ensureNodePtySpawnHelperPermissions(logFn) {
711
748
  } catch {
712
749
  }
713
750
  }
751
+
752
+ // src/control-plane.ts
753
+ function createSessionHostControlPlane(transport) {
754
+ return {
755
+ getDiagnostics(payload = {}) {
756
+ return transport.request("get_host_diagnostics", payload);
757
+ },
758
+ listSessions() {
759
+ return transport.request("list_sessions", {});
760
+ },
761
+ stopSession(sessionId) {
762
+ return transport.request("stop_session", { sessionId });
763
+ },
764
+ deleteSession(sessionId, opts = {}) {
765
+ return transport.request("delete_session", { sessionId, force: opts.force === true });
766
+ },
767
+ resumeSession(sessionId) {
768
+ return transport.request("resume_session", { sessionId });
769
+ },
770
+ restartSession(sessionId) {
771
+ return transport.request("restart_session", { sessionId });
772
+ },
773
+ sendSignal(sessionId, signal) {
774
+ return transport.request("send_signal", { sessionId, signal });
775
+ },
776
+ forceDetachClient(sessionId, clientId) {
777
+ return transport.request("force_detach_client", { sessionId, clientId });
778
+ },
779
+ pruneDuplicateSessions(payload = {}) {
780
+ return transport.request("prune_duplicate_sessions", payload);
781
+ },
782
+ acquireWrite(payload) {
783
+ return transport.request("acquire_write", payload);
784
+ },
785
+ releaseWrite(payload) {
786
+ return transport.request("release_write", payload);
787
+ }
788
+ };
789
+ }
714
790
  // Annotate the CommonJS export names for ESM import in node:
715
791
  0 && (module.exports = {
716
792
  DEFAULT_SESSION_HOST_COLS,
@@ -725,6 +801,7 @@ function ensureNodePtySpawnHelperPermissions(logFn) {
725
801
  buildRuntimeKey,
726
802
  createLineParser,
727
803
  createResponseEnvelope,
804
+ createSessionHostControlPlane,
728
805
  ensureNodePtySpawnHelperPermissions,
729
806
  formatRuntimeOwner,
730
807
  getDefaultSessionHostEndpoint,
@@ -733,6 +810,8 @@ function ensureNodePtySpawnHelperPermissions(logFn) {
733
810
  getWorkspaceLabel,
734
811
  isSessionHostLiveRuntime,
735
812
  isSessionHostRecoverySnapshot,
813
+ partitionSessionHostDiagnosticsSessions,
814
+ partitionSessionHostRecords,
736
815
  resolveAttachableRuntimeRecord,
737
816
  resolveRuntimeRecord,
738
817
  resolveSessionHostCols,