@realtimex/sdk 1.7.9 → 1.7.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realtimex/sdk",
3
- "version": "1.7.9",
3
+ "version": "1.7.10",
4
4
  "description": "SDK for building Local Apps that integrate with RealtimeX",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1,13 +1,13 @@
1
1
  ---
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
- generated: 2026-05-06
5
- sdk_version: 1.7.9
4
+ generated: 2026-05-07
5
+ sdk_version: 1.7.10
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.9**. Authentication is automatic when running inside RealtimeX.
10
+ Interact with the RealTimeX platform (`http://localhost:3001`) using `@realtimex/sdk` **v1.7.10**. Authentication is automatic when running inside RealtimeX.
11
11
 
12
12
  `<SKILL_DIR>` below refers to the directory containing this SKILL.md.
13
13
 
@@ -39,13 +39,19 @@ node "$SKILL" help
39
39
 
40
40
  ```js
41
41
  const { initSDK } = require('<SKILL_DIR>/scripts/lib/sdk-init');
42
- const { sdk } = await initSDK();
42
+ const { sdk, context } = await initSDK();
43
43
  // All SDK APIs — see references/api-reference.md
44
44
  ```
45
45
 
46
46
  When writing helper scripts, use the working directory or system temp — never the SKILL directory.
47
47
  Scripts using the SDK must exit explicitly — `process.exit(0)` on success, `process.exit(1)` on error — or they hang on open HTTP sockets.
48
48
 
49
+ When the skill runs inside a spawned ACP or desktop terminal session, RealtimeX injects:
50
+ - `RTX_WORKSPACE_SLUG`
51
+ - `RTX_THREAD_SLUG`
52
+
53
+ The bundled `sdk-init` and `rtx.js` helpers use those env vars as default context for terminal actions and thread listing. Explicit arguments still win.
54
+
49
55
  ---
50
56
 
51
57
  ## Desktop Terminal Sessions
@@ -96,6 +102,11 @@ await sdk.desktopRuntimeSessions.launchTerminalCliAgent({
96
102
  });
97
103
  ```
98
104
 
105
+ If `workspaceSlug` and `threadSlug` are omitted, prefer this order:
106
+ - explicit user-provided values
107
+ - `RTX_WORKSPACE_SLUG` / `RTX_THREAD_SLUG` from the current spawned process
108
+ - list workspaces/threads and ask only if still ambiguous
109
+
99
110
  Important:
100
111
  - `agentName` is the agent label, like `"claude"` or `"gemini"`
101
112
  - `providerId` is the launcher/provider id, like `"claude-cli"` or `"gemini-cli"`
@@ -1,6 +1,6 @@
1
1
  # RealTimeX SDK — API Reference
2
2
 
3
- > Auto-generated from `@realtimex/sdk` source · v**1.7.9** · 2026-05-06
3
+ > Auto-generated from `@realtimex/sdk` source · v**1.7.10** · 2026-05-07
4
4
 
5
5
  **Package:** `@realtimex/sdk` (CJS) · **Server:** `http://localhost:3001`
6
6
  **Developer Mode auth:** `Authorization: Bearer <apiKey>`
@@ -41,6 +41,7 @@ Use this module for visible Electron terminal sessions. This is the correct path
41
41
  - closing a terminal session
42
42
 
43
43
  Do not use ACP for these unless the user explicitly asks for ACP/headless mode.
44
+ If the current process was spawned by RealtimeX, prefer `process.env.RTX_WORKSPACE_SLUG` and `process.env.RTX_THREAD_SLUG` as default context before guessing or asking the user.
44
45
 
45
46
  ### `V1DesktopRuntimeSessionsModule`
46
47
 
@@ -1,6 +1,6 @@
1
1
  # Known Issues — Source-Detected
2
2
 
3
- > Auto-generated by `scripts/generate-skill.mjs` · SDK **1.7.9** · 2026-05-06
3
+ > Auto-generated by `scripts/generate-skill.mjs` · SDK **1.7.10** · 2026-05-07
4
4
 
5
5
  Run `node scripts/generate-skill.mjs --force` after SDK source changes to refresh.
6
6
 
@@ -23,11 +23,17 @@ const ALL_PERMISSIONS = [
23
23
  'llm.chat', 'llm.embed', 'llm.providers',
24
24
  'vectors.read', 'vectors.write',
25
25
  'tts.generate', 'mcp.servers', 'mcp.tools', 'acp.agent',
26
+ 'desktop.runtime-sessions',
26
27
  ];
27
28
 
28
29
  /** Well-known file written by RealtimeX server for seamless auth. */
29
30
  const SDK_APP_ID_FILE = path.join(os.homedir(), '.realtimex.ai', '.sdk-app-id');
30
31
 
32
+ function normalizeContextValue(value) {
33
+ const normalized = String(value || '').trim();
34
+ return normalized || null;
35
+ }
36
+
31
37
  function parseEnvFile(filePath) {
32
38
  const vars = {};
33
39
  if (!fs.existsSync(filePath)) return vars;
@@ -86,9 +92,24 @@ async function resolveCredentials({ envDir, apiKey, appId } = {}) {
86
92
  return { apiKey: null, appId: null };
87
93
  }
88
94
 
95
+ function resolveDefaultWorkspaceThreadContext(overrides = {}) {
96
+ const workspaceSlug =
97
+ normalizeContextValue(overrides.workspaceSlug) ||
98
+ normalizeContextValue(process.env.RTX_WORKSPACE_SLUG);
99
+ const threadSlug =
100
+ normalizeContextValue(overrides.threadSlug) ||
101
+ normalizeContextValue(process.env.RTX_THREAD_SLUG);
102
+
103
+ return {
104
+ workspaceSlug,
105
+ threadSlug,
106
+ };
107
+ }
108
+
89
109
  async function initSDK(opts = {}) {
90
110
  const { RealtimeXSDK } = require('@realtimex/sdk');
91
111
  const { apiKey, appId } = await resolveCredentials(opts);
112
+ const context = resolveDefaultWorkspaceThreadContext(opts);
92
113
 
93
114
  if (!apiKey && !appId) {
94
115
  throw new Error(
@@ -105,7 +126,14 @@ async function initSDK(opts = {}) {
105
126
  permissions: opts.permissions || ALL_PERMISSIONS,
106
127
  });
107
128
 
108
- return { sdk, apiKey: apiKey || null, appId: appId || null };
129
+ return { sdk, apiKey: apiKey || null, appId: appId || null, context };
109
130
  }
110
131
 
111
- module.exports = { initSDK, resolveCredentials, parseEnvFile, ALL_PERMISSIONS, SDK_APP_ID_FILE };
132
+ module.exports = {
133
+ initSDK,
134
+ resolveCredentials,
135
+ resolveDefaultWorkspaceThreadContext,
136
+ parseEnvFile,
137
+ ALL_PERMISSIONS,
138
+ SDK_APP_ID_FILE,
139
+ };
@@ -53,6 +53,21 @@ async function getSDK() {
53
53
  return _sdk;
54
54
  }
55
55
 
56
+ function applyWorkspaceThreadDefaults(body = {}, context = {}) {
57
+ const nextBody = { ...body };
58
+ if (!nextBody.workspaceSlug && context?.workspaceSlug) {
59
+ nextBody.workspaceSlug = context.workspaceSlug;
60
+ }
61
+ if (!nextBody.threadSlug && context?.threadSlug) {
62
+ nextBody.threadSlug = context.threadSlug;
63
+ }
64
+ return nextBody;
65
+ }
66
+
67
+ function resolveWorkspaceFlagOrContext(context = {}) {
68
+ return flags.workspace || context?.workspaceSlug || null;
69
+ }
70
+
56
71
  // ---------------------------------------------------------------------------
57
72
  // Commands
58
73
  // ---------------------------------------------------------------------------
@@ -89,9 +104,10 @@ CMD.workspaces = async () => {
89
104
  // -- threads ----------------------------------------------------------------
90
105
  // Source: ApiModule.getThreads(workspaceSlug) → Thread[] { id, slug, name }
91
106
  CMD.threads = async () => {
92
- const [slug] = cmdArgs;
107
+ const [slugArg] = cmdArgs;
108
+ const { sdk, context } = await getSDK();
109
+ const slug = slugArg || resolveWorkspaceFlagOrContext(context);
93
110
  if (!slug) { console.error('Usage: rtx.js threads <workspace-slug>'); process.exit(1); }
94
- const { sdk } = await getSDK();
95
111
  printTable(await sdk.api.getThreads(slug), ['id', 'slug', 'name']);
96
112
  };
97
113
 
@@ -321,9 +337,9 @@ function getDesktopRuntimeSessionsModule(sdk) {
321
337
 
322
338
  // -- terminal-launcher / terminal sessions ----------------------------------
323
339
  CMD['terminal-open-launcher'] = async () => {
324
- const { sdk } = await getSDK();
340
+ const { sdk, context } = await getSDK();
325
341
  const terminal = getDesktopRuntimeSessionsModule(sdk);
326
- const body = {};
342
+ const body = applyWorkspaceThreadDefaults({}, context);
327
343
  if (flags.workspace) body.workspaceSlug = flags.workspace;
328
344
  if (flags.thread) body.threadSlug = flags.thread;
329
345
  if (flags.presentation) body.presentationMode = flags.presentation;
@@ -333,9 +349,9 @@ CMD['terminal-open-launcher'] = async () => {
333
349
  };
334
350
 
335
351
  CMD['terminal-launch-shell'] = async () => {
336
- const { sdk } = await getSDK();
352
+ const { sdk, context } = await getSDK();
337
353
  const terminal = getDesktopRuntimeSessionsModule(sdk);
338
- const body = {};
354
+ const body = applyWorkspaceThreadDefaults({}, context);
339
355
  if (flags.workspace) body.workspaceSlug = flags.workspace;
340
356
  if (flags.thread) body.threadSlug = flags.thread;
341
357
  if (flags.presentation) body.presentationMode = flags.presentation;
@@ -353,9 +369,9 @@ CMD['terminal-launch-cli-agent'] = async () => {
353
369
  console.error('Usage: rtx.js terminal-launch-cli-agent <agent-name> [<provider-id>] [<message>] [--workspace=<slug>] [--thread=<slug>] [--presentation=panel|tab] [--model=<id>]');
354
370
  process.exit(1);
355
371
  }
356
- const { sdk } = await getSDK();
372
+ const { sdk, context } = await getSDK();
357
373
  const terminal = getDesktopRuntimeSessionsModule(sdk);
358
- const body = { agentName };
374
+ const body = applyWorkspaceThreadDefaults({ agentName }, context);
359
375
  if (providerId) body.providerId = providerId;
360
376
  if (message) body.message = message;
361
377
  if (flags.workspace) body.workspaceSlug = flags.workspace;