@realtimex/sdk 1.7.8 → 1.7.9

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.
@@ -498,4 +498,4 @@ declare class ServerError extends DeveloperApiError {
498
498
  constructor(message?: string);
499
499
  }
500
500
 
501
- export { AuthenticationError as A, DeveloperApiClient as D, NotFoundError as N, ServerError as S, V1ApiNamespace as V, DeveloperApiError as a, ValidationError as b, V1AuthModule as c, V1AdminModule as d, V1DocumentModule as e, V1WorkspaceModule as f, V1SystemModule as g, V1ThreadModule as h, V1UsersModule as i, V1OpenAIModule as j, V1EmbedModule as k, V1DesktopRuntimeSessionsModule as l };
501
+ export { AuthenticationError as A, DeveloperApiClient as D, NotFoundError as N, ServerError as S, V1ApiNamespace as V, V1DesktopRuntimeSessionsModule as a, DeveloperApiError as b, ValidationError as c, V1AuthModule as d, V1AdminModule as e, V1DocumentModule as f, V1WorkspaceModule as g, V1SystemModule as h, V1ThreadModule as i, V1UsersModule as j, V1OpenAIModule as k, V1EmbedModule as l };
@@ -498,4 +498,4 @@ declare class ServerError extends DeveloperApiError {
498
498
  constructor(message?: string);
499
499
  }
500
500
 
501
- export { AuthenticationError as A, DeveloperApiClient as D, NotFoundError as N, ServerError as S, V1ApiNamespace as V, DeveloperApiError as a, ValidationError as b, V1AuthModule as c, V1AdminModule as d, V1DocumentModule as e, V1WorkspaceModule as f, V1SystemModule as g, V1ThreadModule as h, V1UsersModule as i, V1OpenAIModule as j, V1EmbedModule as k, V1DesktopRuntimeSessionsModule as l };
501
+ export { AuthenticationError as A, DeveloperApiClient as D, NotFoundError as N, ServerError as S, V1ApiNamespace as V, V1DesktopRuntimeSessionsModule as a, DeveloperApiError as b, ValidationError as c, V1AuthModule as d, V1AdminModule as e, V1DocumentModule as f, V1WorkspaceModule as g, V1SystemModule as h, V1ThreadModule as i, V1UsersModule as j, V1OpenAIModule as k, V1EmbedModule as l };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { V as V1ApiNamespace } from './errors-BmVxnpJS.mjs';
2
- export { A as AuthenticationError, D as DeveloperApiClient, a as DeveloperApiError, N as NotFoundError, S as ServerError, b as ValidationError } from './errors-BmVxnpJS.mjs';
1
+ import { V as V1ApiNamespace, a as V1DesktopRuntimeSessionsModule } from './errors-x6ngbrlA.mjs';
2
+ export { A as AuthenticationError, D as DeveloperApiClient, b as DeveloperApiError, N as NotFoundError, S as ServerError, c as ValidationError } from './errors-x6ngbrlA.mjs';
3
3
 
4
4
  /**
5
5
  * RealtimeX Local App SDK - Types
@@ -2022,6 +2022,11 @@ declare class RealtimeXSDK {
2022
2022
  * Provides access to workspace management, admin, documents, system settings, and more.
2023
2023
  */
2024
2024
  v1: V1ApiNamespace | undefined;
2025
+ /**
2026
+ * Desktop terminal sessions — top-level alias for the desktop runtime session APIs.
2027
+ * Backed by `sdk.v1.desktopRuntimeSessions` for compatibility with generated v1 modules.
2028
+ */
2029
+ desktopRuntimeSessions: V1DesktopRuntimeSessionsModule | undefined;
2025
2030
  readonly appId: string;
2026
2031
  readonly appName: string | undefined;
2027
2032
  readonly apiKey: string | undefined;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { V as V1ApiNamespace } from './errors-BmVxnpJS.js';
2
- export { A as AuthenticationError, D as DeveloperApiClient, a as DeveloperApiError, N as NotFoundError, S as ServerError, b as ValidationError } from './errors-BmVxnpJS.js';
1
+ import { V as V1ApiNamespace, a as V1DesktopRuntimeSessionsModule } from './errors-x6ngbrlA.js';
2
+ export { A as AuthenticationError, D as DeveloperApiClient, b as DeveloperApiError, N as NotFoundError, S as ServerError, c as ValidationError } from './errors-x6ngbrlA.js';
3
3
 
4
4
  /**
5
5
  * RealtimeX Local App SDK - Types
@@ -2022,6 +2022,11 @@ declare class RealtimeXSDK {
2022
2022
  * Provides access to workspace management, admin, documents, system settings, and more.
2023
2023
  */
2024
2024
  v1: V1ApiNamespace | undefined;
2025
+ /**
2026
+ * Desktop terminal sessions — top-level alias for the desktop runtime session APIs.
2027
+ * Backed by `sdk.v1.desktopRuntimeSessions` for compatibility with generated v1 modules.
2028
+ */
2029
+ desktopRuntimeSessions: V1DesktopRuntimeSessionsModule | undefined;
2025
2030
  readonly appId: string;
2026
2031
  readonly appName: string | undefined;
2027
2032
  readonly apiKey: string | undefined;
package/dist/index.js CHANGED
@@ -4467,6 +4467,7 @@ var _RealtimeXSDK = class _RealtimeXSDK {
4467
4467
  this.auth = new AuthModule(this.realtimexUrl, this.appId, this.apiKey);
4468
4468
  this.credentials = new CredentialsModule(this.httpClient);
4469
4469
  this.v1 = this.apiKey || this.appId ? new V1ApiNamespace(this.realtimexUrl, this.apiKey ?? "", this.appId || void 0) : void 0;
4470
+ this.desktopRuntimeSessions = this.v1?.desktopRuntimeSessions;
4470
4471
  if (this.permissions.length > 0 && this.appId && !this.apiKey) {
4471
4472
  this.register().catch((err) => {
4472
4473
  console.error("[RealtimeX SDK] Auto-registration failed:", err.message);
package/dist/index.mjs CHANGED
@@ -3652,6 +3652,7 @@ var _RealtimeXSDK = class _RealtimeXSDK {
3652
3652
  this.auth = new AuthModule(this.realtimexUrl, this.appId, this.apiKey);
3653
3653
  this.credentials = new CredentialsModule(this.httpClient);
3654
3654
  this.v1 = this.apiKey || this.appId ? new V1ApiNamespace(this.realtimexUrl, this.apiKey ?? "", this.appId || void 0) : void 0;
3655
+ this.desktopRuntimeSessions = this.v1?.desktopRuntimeSessions;
3655
3656
  if (this.permissions.length > 0 && this.appId && !this.apiKey) {
3656
3657
  this.register().catch((err) => {
3657
3658
  console.error("[RealtimeX SDK] Auto-registration failed:", err.message);
@@ -1,5 +1,5 @@
1
- import { D as DeveloperApiClient } from '../errors-BmVxnpJS.mjs';
2
- export { A as AuthenticationError, a as DeveloperApiError, N as NotFoundError, S as ServerError, d as V1AdminModule, V as V1ApiNamespace, c as V1AuthModule, l as V1DesktopRuntimeSessionsModule, e as V1DocumentModule, k as V1EmbedModule, j as V1OpenAIModule, g as V1SystemModule, h as V1ThreadModule, i as V1UsersModule, f as V1WorkspaceModule, b as ValidationError } from '../errors-BmVxnpJS.mjs';
1
+ import { D as DeveloperApiClient } from '../errors-x6ngbrlA.mjs';
2
+ export { A as AuthenticationError, b as DeveloperApiError, N as NotFoundError, S as ServerError, e as V1AdminModule, V as V1ApiNamespace, d as V1AuthModule, a as V1DesktopRuntimeSessionsModule, f as V1DocumentModule, l as V1EmbedModule, k as V1OpenAIModule, h as V1SystemModule, i as V1ThreadModule, j as V1UsersModule, g as V1WorkspaceModule, c as ValidationError } from '../errors-x6ngbrlA.mjs';
3
3
 
4
4
  interface WorkspaceStreamChunk {
5
5
  /** The text fragment emitted by this SSE event */
@@ -1,5 +1,5 @@
1
- import { D as DeveloperApiClient } from '../errors-BmVxnpJS.js';
2
- export { A as AuthenticationError, a as DeveloperApiError, N as NotFoundError, S as ServerError, d as V1AdminModule, V as V1ApiNamespace, c as V1AuthModule, l as V1DesktopRuntimeSessionsModule, e as V1DocumentModule, k as V1EmbedModule, j as V1OpenAIModule, g as V1SystemModule, h as V1ThreadModule, i as V1UsersModule, f as V1WorkspaceModule, b as ValidationError } from '../errors-BmVxnpJS.js';
1
+ import { D as DeveloperApiClient } from '../errors-x6ngbrlA.js';
2
+ export { A as AuthenticationError, b as DeveloperApiError, N as NotFoundError, S as ServerError, e as V1AdminModule, V as V1ApiNamespace, d as V1AuthModule, a as V1DesktopRuntimeSessionsModule, f as V1DocumentModule, l as V1EmbedModule, k as V1OpenAIModule, h as V1SystemModule, i as V1ThreadModule, j as V1UsersModule, g as V1WorkspaceModule, c as ValidationError } from '../errors-x6ngbrlA.js';
3
3
 
4
4
  interface WorkspaceStreamChunk {
5
5
  /** The text fragment emitted by this SSE event */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realtimex/sdk",
3
- "version": "1.7.8",
3
+ "version": "1.7.9",
4
4
  "description": "SDK for building Local Apps that integrate with RealtimeX",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -2,12 +2,12 @@
2
2
  name: realtimex-moderator-sdk
3
3
  description: Control and interact with the RealTimeX application through its Node.js SDK. This skill should be used when users want to manage workspaces, threads, agents, activities, LLM chat, vector store, MCP tools, ACP agent sessions, TTS/STT, or any other RealTimeX platform feature via the API. All method signatures are verified against the SDK source code.
4
4
  generated: 2026-05-06
5
- sdk_version: 1.7.8
5
+ sdk_version: 1.7.9
6
6
  ---
7
7
 
8
8
  # RealTimeX Moderator (SDK Source-Verified)
9
9
 
10
- Interact with the RealTimeX platform (`http://localhost:3001`) using `@realtimex/sdk` **v1.7.8**. Authentication is automatic when running inside RealtimeX.
10
+ Interact with the RealTimeX platform (`http://localhost:3001`) using `@realtimex/sdk` **v1.7.9**. Authentication is automatic when running inside RealtimeX.
11
11
 
12
12
  `<SKILL_DIR>` below refers to the directory containing this SKILL.md.
13
13
 
@@ -24,6 +24,10 @@ node "$SKILL" agents $ENV
24
24
  node "$SKILL" workspaces $ENV
25
25
  node "$SKILL" threads <workspace-slug> $ENV
26
26
  node "$SKILL" trigger-agent <agent> <workspace> <msg> $ENV
27
+ node "$SKILL" terminal-launch-cli-agent claude claude-cli "what is current working dir" --workspace=<slug> --thread=<slug> $ENV
28
+ node "$SKILL" terminal-launch-shell --workspace=<slug> --thread=<slug> --command="pwd" $ENV
29
+ node "$SKILL" terminal-sessions --workspace=<slug> $ENV
30
+ node "$SKILL" terminal-write <session-id> "continue" $ENV
27
31
  node "$SKILL" acp-chat qwen-cli "question" --cwd=<path> $ENV
28
32
  node "$SKILL" llm-chat "message" $ENV
29
33
  node "$SKILL" activities --status=pending $ENV
@@ -44,15 +48,95 @@ Scripts using the SDK must exit explicitly — `process.exit(0)` on success, `pr
44
48
 
45
49
  ---
46
50
 
47
- ## Runtime Sessions
51
+ ## Desktop Terminal Sessions
48
52
 
49
- In this SDK, **Runtime Sessions** means the CLI Agent in **Terminal mode**. Use `sdk.agent.*` for that path.
53
+ For anything that says **launch terminal**, **open shell**, **open Claude/Gemini in terminal**, or **send another message to an existing terminal session**, use:
50
54
 
51
- This is separate from ACP mode:
52
- - `sdk.agent.*` = Runtime Sessions = CLI Agent / Terminal mode
53
- - `sdk.acpAgent.*` = ACP-backed CLI agent sessions
55
+ - `sdk.desktopRuntimeSessions.*`
54
56
 
55
- If a user refers to the v1/OpenAPI tag `Runtime Sessions`, interpret that as the Terminal mode session flow, not ACP.
57
+ Do **not** use ACP for that unless the user explicitly asks for a headless ACP session.
58
+
59
+ ### Use desktop terminal sessions for
60
+ - opening a visible terminal in the Electron app
61
+ - launching a shell session
62
+ - launching a CLI agent in a terminal tab/panel
63
+ - listing desktop terminal sessions
64
+ - writing more input to an existing terminal session
65
+ - approving or denying a pending terminal action
66
+ - closing a terminal session
67
+
68
+ ### Use ACP only for
69
+ - headless background agent sessions
70
+ - persistent server-side automation
71
+ - `acp-chat`, `acp-stream`, `acp-session-*`
72
+
73
+ ### Correct SDK namespace
74
+
75
+ ```js
76
+ sdk.desktopRuntimeSessions
77
+ ```
78
+
79
+ Compatibility:
80
+ - `sdk.desktopRuntimeSessions` is the preferred alias
81
+ - `sdk.v1.desktopRuntimeSessions` still exists for backward compatibility
82
+ - there is no `sdk.v1.runtimeSessions`
83
+
84
+ ### Required payloads
85
+
86
+ Launch terminal CLI agent:
87
+
88
+ ```js
89
+ await sdk.desktopRuntimeSessions.launchTerminalCliAgent({
90
+ workspaceSlug: "agent-heartbeat",
91
+ threadSlug: "ambient-agent-week-agent-heartbeat-2026-w17",
92
+ agentName: "claude", // required
93
+ providerId: "claude-cli", // strongly recommended
94
+ presentationMode: "panel", // optional: "panel" | "tab"
95
+ message: "what is current working dir"
96
+ });
97
+ ```
98
+
99
+ Important:
100
+ - `agentName` is the agent label, like `"claude"` or `"gemini"`
101
+ - `providerId` is the launcher/provider id, like `"claude-cli"` or `"gemini-cli"`
102
+ - Do not pass `agentName: "claude-cli"` unless that is truly the agent label shown by the app
103
+
104
+ Launch terminal shell:
105
+
106
+ ```js
107
+ await sdk.desktopRuntimeSessions.launchTerminalShell({
108
+ workspaceSlug: "agent-heartbeat",
109
+ threadSlug: "ambient-agent-week-agent-heartbeat-2026-w17",
110
+ presentationMode: "panel",
111
+ initialCommand: "pwd",
112
+ initialCommandMode: "direct"
113
+ });
114
+ ```
115
+
116
+ Manage existing terminal sessions:
117
+
118
+ ```js
119
+ await sdk.desktopRuntimeSessions.listRuntimeSessions();
120
+ await sdk.desktopRuntimeSessions.getRuntimeSession("cli-agent:pty-123");
121
+ await sdk.desktopRuntimeSessions.write("cli-agent:pty-123", {
122
+ message: "continue"
123
+ });
124
+ await sdk.desktopRuntimeSessions.permission("cli-agent:pty-123", {
125
+ outcome: "approved",
126
+ actionId: "terminal-action-1"
127
+ });
128
+ await sdk.desktopRuntimeSessions.deleteRuntimeSession("cli-agent:pty-123");
129
+ ```
130
+
131
+ ### Preferred decision rule
132
+
133
+ If the user says:
134
+ - "launch in terminal"
135
+ - "open Claude in terminal"
136
+ - "ask Gemini in terminal"
137
+ - "open a shell and run pwd"
138
+
139
+ then prefer `sdk.desktopRuntimeSessions.*`, not ACP.
56
140
 
57
141
  ---
58
142
 
@@ -1,6 +1,6 @@
1
1
  # RealTimeX SDK — API Reference
2
2
 
3
- > Auto-generated from `@realtimex/sdk` source · v**1.7.8** · 2026-05-06
3
+ > Auto-generated from `@realtimex/sdk` source · v**1.7.9** · 2026-05-06
4
4
 
5
5
  **Package:** `@realtimex/sdk` (CJS) · **Server:** `http://localhost:3001`
6
6
  **Developer Mode auth:** `Authorization: Bearer <apiKey>`
@@ -30,6 +30,77 @@
30
30
 
31
31
  ---
32
32
 
33
+ ## sdk.desktopRuntimeSessions — Desktop Terminal Sessions
34
+
35
+ Use this module for visible Electron terminal sessions. This is the correct path for:
36
+ - launching a shell terminal
37
+ - launching Claude/Gemini/Qwen in a terminal
38
+ - listing existing terminal sessions
39
+ - sending more input to an existing terminal
40
+ - approving terminal prompts
41
+ - closing a terminal session
42
+
43
+ Do not use ACP for these unless the user explicitly asks for ACP/headless mode.
44
+
45
+ ### `V1DesktopRuntimeSessionsModule`
46
+
47
+ ```ts
48
+ async openLauncher(body?: { workspaceSlug?: string; threadSlug?: string; presentationMode?: 'panel' | 'tab'; preferredAgentName?: string; preferredAgentProviderId?: string; }): Promise<unknown>
49
+ async launchTerminalShell(body?: { workspaceSlug?: string; threadSlug?: string; presentationMode?: 'panel' | 'tab'; title?: string; subtitle?: string; initialCommand?: string; initialCommandMode?: 'direct' | 'prefill' | 'shell'; }): Promise<unknown>
50
+ async launchTerminalCliAgent(body?: { workspaceSlug?: string; threadSlug?: string; agentName: string; providerId?: string; modelId?: string; presentationMode?: 'panel' | 'tab'; message?: string; }): Promise<unknown>
51
+ async listRuntimeSessions(): Promise<unknown>
52
+ async getRuntimeSession(sessionId: string): Promise<unknown>
53
+ async write(sessionId: string, body?: { message?: string; input?: string; }): Promise<unknown>
54
+ async permission(sessionId: string, body?: { outcome: 'approved' | 'denied'; actionId?: string; requestId?: string; optionId?: string; optionLabel?: string; input?: string; reason?: string; }): Promise<unknown>
55
+ async deleteRuntimeSession(sessionId: string): Promise<unknown>
56
+ ```
57
+
58
+ ### Correct examples
59
+
60
+ Launch Claude in a terminal:
61
+
62
+ ```js
63
+ await sdk.desktopRuntimeSessions.launchTerminalCliAgent({
64
+ workspaceSlug: 'agent-heartbeat',
65
+ threadSlug: 'ambient-agent-week-agent-heartbeat-2026-w17',
66
+ agentName: 'claude',
67
+ providerId: 'claude-cli',
68
+ presentationMode: 'panel',
69
+ message: 'what is current working dir'
70
+ });
71
+ ```
72
+
73
+ Launch a shell and run `pwd`:
74
+
75
+ ```js
76
+ await sdk.desktopRuntimeSessions.launchTerminalShell({
77
+ workspaceSlug: 'agent-heartbeat',
78
+ threadSlug: 'ambient-agent-week-agent-heartbeat-2026-w17',
79
+ presentationMode: 'panel',
80
+ initialCommand: 'pwd',
81
+ initialCommandMode: 'direct'
82
+ });
83
+ ```
84
+
85
+ Common mistake:
86
+
87
+ ```js
88
+ // ❌ WRONG
89
+ await sdk.desktopRuntimeSessions.launchTerminalCliAgent({
90
+ agentName: 'claude-cli'
91
+ });
92
+
93
+ // ✅ CORRECT
94
+ await sdk.desktopRuntimeSessions.launchTerminalCliAgent({
95
+ agentName: 'claude',
96
+ providerId: 'claude-cli'
97
+ });
98
+ ```
99
+
100
+ Compatibility: `sdk.v1.desktopRuntimeSessions` remains available, but prefer the top-level alias.
101
+
102
+ ---
103
+
33
104
  ## Core — RealtimeXSDK
34
105
 
35
106
  ### `RealtimeXSDK`
@@ -52,6 +123,7 @@
52
123
  - `auth: AuthModule`
53
124
  - `credentials: CredentialsModule`
54
125
  - `v1: V1ApiNamespace | undefined`
126
+ - `desktopRuntimeSessions: V1DesktopRuntimeSessionsModule | undefined`
55
127
 
56
128
  ```ts
57
129
  // Developer API (v1) — requires apiKey to be set in config.
@@ -503,7 +575,7 @@ outcome?: string
503
575
 
504
576
  ---
505
577
 
506
- ## sdk.agent — Runtime Sessions (CLI Agent / Terminal mode)
578
+ ## sdk.agent — LLM Agent Sessions (REST/SSE)
507
579
 
508
580
  ### `AgentModule`
509
581
 
@@ -1,6 +1,6 @@
1
1
  # Known Issues — Source-Detected
2
2
 
3
- > Auto-generated by `scripts/generate-skill.mjs` · SDK **1.7.8** · 2026-05-06
3
+ > Auto-generated by `scripts/generate-skill.mjs` · SDK **1.7.9** · 2026-05-06
4
4
 
5
5
  Run `node scripts/generate-skill.mjs --force` after SDK source changes to refresh.
6
6
 
@@ -311,6 +311,116 @@ CMD['credentials'] = async () => {
311
311
  printTable(list, ['name', 'type']);
312
312
  };
313
313
 
314
+ function getDesktopRuntimeSessionsModule(sdk) {
315
+ const module = sdk?.desktopRuntimeSessions || sdk?.v1?.desktopRuntimeSessions;
316
+ if (!module) {
317
+ throw new Error('sdk.desktopRuntimeSessions is unavailable. Ensure the SDK was initialized with Developer API access.');
318
+ }
319
+ return module;
320
+ }
321
+
322
+ // -- terminal-launcher / terminal sessions ----------------------------------
323
+ CMD['terminal-open-launcher'] = async () => {
324
+ const { sdk } = await getSDK();
325
+ const terminal = getDesktopRuntimeSessionsModule(sdk);
326
+ const body = {};
327
+ if (flags.workspace) body.workspaceSlug = flags.workspace;
328
+ if (flags.thread) body.threadSlug = flags.thread;
329
+ if (flags.presentation) body.presentationMode = flags.presentation;
330
+ if (flags.agent) body.preferredAgentName = flags.agent;
331
+ if (flags.provider) body.preferredAgentProviderId = flags.provider;
332
+ print(await terminal.openLauncher(body));
333
+ };
334
+
335
+ CMD['terminal-launch-shell'] = async () => {
336
+ const { sdk } = await getSDK();
337
+ const terminal = getDesktopRuntimeSessionsModule(sdk);
338
+ const body = {};
339
+ if (flags.workspace) body.workspaceSlug = flags.workspace;
340
+ if (flags.thread) body.threadSlug = flags.thread;
341
+ if (flags.presentation) body.presentationMode = flags.presentation;
342
+ if (flags.command) body.initialCommand = flags.command;
343
+ if (flags['command-mode']) body.initialCommandMode = flags['command-mode'];
344
+ if (flags.title) body.title = flags.title;
345
+ if (flags.subtitle) body.subtitle = flags.subtitle;
346
+ print(await terminal.launchTerminalShell(body));
347
+ };
348
+
349
+ CMD['terminal-launch-cli-agent'] = async () => {
350
+ const [agentName, providerId, ...messageParts] = cmdArgs;
351
+ const message = messageParts.join(' ');
352
+ if (!agentName) {
353
+ console.error('Usage: rtx.js terminal-launch-cli-agent <agent-name> [<provider-id>] [<message>] [--workspace=<slug>] [--thread=<slug>] [--presentation=panel|tab] [--model=<id>]');
354
+ process.exit(1);
355
+ }
356
+ const { sdk } = await getSDK();
357
+ const terminal = getDesktopRuntimeSessionsModule(sdk);
358
+ const body = { agentName };
359
+ if (providerId) body.providerId = providerId;
360
+ if (message) body.message = message;
361
+ if (flags.workspace) body.workspaceSlug = flags.workspace;
362
+ if (flags.thread) body.threadSlug = flags.thread;
363
+ if (flags.presentation) body.presentationMode = flags.presentation;
364
+ if (flags.model) body.modelId = flags.model;
365
+ print(await terminal.launchTerminalCliAgent(body));
366
+ };
367
+
368
+ CMD['terminal-sessions'] = async () => {
369
+ const { sdk } = await getSDK();
370
+ const terminal = getDesktopRuntimeSessionsModule(sdk);
371
+ const sessions = await terminal.listRuntimeSessions();
372
+ print(sessions);
373
+ };
374
+
375
+ CMD['terminal-session-get'] = async () => {
376
+ const [sessionId] = cmdArgs;
377
+ if (!sessionId) {
378
+ console.error('Usage: rtx.js terminal-session-get <session-id>');
379
+ process.exit(1);
380
+ }
381
+ const { sdk } = await getSDK();
382
+ const terminal = getDesktopRuntimeSessionsModule(sdk);
383
+ print(await terminal.getRuntimeSession(sessionId));
384
+ };
385
+
386
+ CMD['terminal-write'] = async () => {
387
+ const [sessionId, ...rest] = cmdArgs;
388
+ if (!sessionId || rest.length === 0) {
389
+ console.error('Usage: rtx.js terminal-write <session-id> <message> [--raw]');
390
+ process.exit(1);
391
+ }
392
+ const { sdk } = await getSDK();
393
+ const terminal = getDesktopRuntimeSessionsModule(sdk);
394
+ const payload = rest.join(' ');
395
+ print(await terminal.write(sessionId, flags.raw ? { input: payload } : { message: payload }));
396
+ };
397
+
398
+ CMD['terminal-permission'] = async () => {
399
+ const [sessionId, outcome, actionId] = cmdArgs;
400
+ if (!sessionId || !outcome) {
401
+ console.error('Usage: rtx.js terminal-permission <session-id> <approved|denied> [<action-id>] [--option-id=<id>] [--reason=<text>]');
402
+ process.exit(1);
403
+ }
404
+ const { sdk } = await getSDK();
405
+ const terminal = getDesktopRuntimeSessionsModule(sdk);
406
+ const body = { outcome };
407
+ if (actionId) body.actionId = actionId;
408
+ if (flags['option-id']) body.optionId = flags['option-id'];
409
+ if (flags.reason) body.reason = flags.reason;
410
+ print(await terminal.permission(sessionId, body));
411
+ };
412
+
413
+ CMD['terminal-close'] = async () => {
414
+ const [sessionId] = cmdArgs;
415
+ if (!sessionId) {
416
+ console.error('Usage: rtx.js terminal-close <session-id>');
417
+ process.exit(1);
418
+ }
419
+ const { sdk } = await getSDK();
420
+ const terminal = getDesktopRuntimeSessionsModule(sdk);
421
+ print(await terminal.deleteRuntimeSession(sessionId));
422
+ };
423
+
314
424
  // -- acp-agents -------------------------------------------------------------
315
425
  // Source: AcpAgentModule.listAgents({ includeModels? })
316
426
  // Returns: AcpAgentInfo[] { id, label, handles[], installed, authReady, status }
@@ -808,6 +918,39 @@ sdk.credentials.*:
808
918
  credentials
809
919
  List available credentials (names and types, no values).
810
920
 
921
+ sdk.desktopRuntimeSessions.* — Desktop terminal sessions:
922
+ terminal-open-launcher
923
+ [--workspace=<slug>] [--thread=<slug>] [--presentation=panel|tab]
924
+ Open the terminal launcher UI in the Electron app.
925
+
926
+ terminal-launch-shell
927
+ [--workspace=<slug>] [--thread=<slug>] [--presentation=panel|tab]
928
+ [--command="pwd"] [--command-mode=direct|prefill|shell]
929
+ Launch a visible shell terminal.
930
+
931
+ terminal-launch-cli-agent <agent-name> [<provider-id>] [<message>]
932
+ [--workspace=<slug>] [--thread=<slug>] [--presentation=panel|tab] [--model=<id>]
933
+ Launch a visible CLI agent terminal.
934
+ Example: terminal-launch-cli-agent claude claude-cli "what is current working dir"
935
+
936
+ terminal-sessions
937
+ List desktop terminal sessions.
938
+
939
+ terminal-session-get <session-id>
940
+ Fetch one desktop terminal session by runtime session id.
941
+
942
+ terminal-write <session-id> <message> [--raw]
943
+ Send another message or raw PTY input to an existing terminal session.
944
+
945
+ terminal-permission <session-id> <approved|denied> [<action-id>] [--option-id=<id>] [--reason=<text>]
946
+ Resolve a pending terminal approval request.
947
+
948
+ terminal-close <session-id>
949
+ Close a desktop terminal session.
950
+
951
+ Compatibility:
952
+ The SDK also exposes this module as sdk.v1.desktopRuntimeSessions.
953
+
811
954
  sdk.acpAgent.* — Session Management:
812
955
  acp-agents [--models=true]
813
956
  List available ACP CLI agents.