@realtimex/sdk 1.7.7 → 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.
@@ -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.