@realtimex/sdk 1.7.9 → 1.7.11

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.11",
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.11
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.11**. Authentication is automatic when running inside RealtimeX.
11
11
 
12
12
  `<SKILL_DIR>` below refers to the directory containing this SKILL.md.
13
13
 
@@ -20,6 +20,7 @@ SKILL=<SKILL_DIR>/scripts/rtx.js
20
20
  ENV=--env-dir=<cwd>
21
21
 
22
22
  node "$SKILL" ping $ENV
23
+ node "$SKILL" context $ENV
23
24
  node "$SKILL" agents $ENV
24
25
  node "$SKILL" workspaces $ENV
25
26
  node "$SKILL" threads <workspace-slug> $ENV
@@ -39,13 +40,34 @@ node "$SKILL" help
39
40
 
40
41
  ```js
41
42
  const { initSDK } = require('<SKILL_DIR>/scripts/lib/sdk-init');
42
- const { sdk } = await initSDK();
43
+ const { sdk, context } = await initSDK();
43
44
  // All SDK APIs — see references/api-reference.md
44
45
  ```
45
46
 
46
47
  When writing helper scripts, use the working directory or system temp — never the SKILL directory.
47
48
  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
49
 
50
+ When the skill runs inside a spawned ACP or desktop terminal session, RealtimeX injects:
51
+ - `RTX_WORKSPACE_SLUG`
52
+ - `RTX_THREAD_SLUG`
53
+
54
+ 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.
55
+
56
+ ## Workspace And Thread Rule
57
+
58
+ When the skill is used and a task needs workspace/thread context:
59
+
60
+ 1. Check current context first.
61
+ Use `const { sdk, context } = await initSDK()` or `node "$SKILL" context`.
62
+ 2. If `context.workspaceSlug` or `context.threadSlug` exists, use it as the default.
63
+ 3. If the user explicitly provided workspace/thread, those values override the default context.
64
+ 4. If no current context is available:
65
+ - list workspaces first
66
+ - list threads for the chosen workspace if a thread is needed
67
+ - ask the user only when still ambiguous
68
+
69
+ Do not guess a workspace or thread if the current context is unknown.
70
+
49
71
  ---
50
72
 
51
73
  ## Desktop Terminal Sessions
@@ -96,6 +118,11 @@ await sdk.desktopRuntimeSessions.launchTerminalCliAgent({
96
118
  });
97
119
  ```
98
120
 
121
+ If `workspaceSlug` and `threadSlug` are omitted, prefer this order:
122
+ - explicit user-provided values
123
+ - `RTX_WORKSPACE_SLUG` / `RTX_THREAD_SLUG` from the current spawned process
124
+ - list workspaces/threads and ask only if still ambiguous
125
+
99
126
  Important:
100
127
  - `agentName` is the agent label, like `"claude"` or `"gemini"`
101
128
  - `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.11** · 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,8 @@ 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.
45
+ Always resolve current workspace/thread context first when a terminal action needs it: explicit user input > spawned-process env > list workspaces/threads > ask user if still ambiguous.
44
46
 
45
47
  ### `V1DesktopRuntimeSessionsModule`
46
48
 
@@ -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.11** · 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,11 +53,35 @@ 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
  // ---------------------------------------------------------------------------
59
74
  const CMD = {};
60
75
 
76
+ CMD.context = async () => {
77
+ const { context } = await getSDK();
78
+ print({
79
+ workspaceSlug: context?.workspaceSlug || null,
80
+ threadSlug: context?.threadSlug || null,
81
+ hasContext: Boolean(context?.workspaceSlug || context?.threadSlug),
82
+ });
83
+ };
84
+
61
85
  // -- ping -------------------------------------------------------------------
62
86
  // Source: index.ts → sdk.ping() → { success, mode, appId, timestamp }
63
87
  CMD.ping = async () => { const { sdk } = await getSDK(); print(await sdk.ping()); };
@@ -89,9 +113,10 @@ CMD.workspaces = async () => {
89
113
  // -- threads ----------------------------------------------------------------
90
114
  // Source: ApiModule.getThreads(workspaceSlug) → Thread[] { id, slug, name }
91
115
  CMD.threads = async () => {
92
- const [slug] = cmdArgs;
116
+ const [slugArg] = cmdArgs;
117
+ const { sdk, context } = await getSDK();
118
+ const slug = slugArg || resolveWorkspaceFlagOrContext(context);
93
119
  if (!slug) { console.error('Usage: rtx.js threads <workspace-slug>'); process.exit(1); }
94
- const { sdk } = await getSDK();
95
120
  printTable(await sdk.api.getThreads(slug), ['id', 'slug', 'name']);
96
121
  };
97
122
 
@@ -321,9 +346,9 @@ function getDesktopRuntimeSessionsModule(sdk) {
321
346
 
322
347
  // -- terminal-launcher / terminal sessions ----------------------------------
323
348
  CMD['terminal-open-launcher'] = async () => {
324
- const { sdk } = await getSDK();
349
+ const { sdk, context } = await getSDK();
325
350
  const terminal = getDesktopRuntimeSessionsModule(sdk);
326
- const body = {};
351
+ const body = applyWorkspaceThreadDefaults({}, context);
327
352
  if (flags.workspace) body.workspaceSlug = flags.workspace;
328
353
  if (flags.thread) body.threadSlug = flags.thread;
329
354
  if (flags.presentation) body.presentationMode = flags.presentation;
@@ -333,9 +358,9 @@ CMD['terminal-open-launcher'] = async () => {
333
358
  };
334
359
 
335
360
  CMD['terminal-launch-shell'] = async () => {
336
- const { sdk } = await getSDK();
361
+ const { sdk, context } = await getSDK();
337
362
  const terminal = getDesktopRuntimeSessionsModule(sdk);
338
- const body = {};
363
+ const body = applyWorkspaceThreadDefaults({}, context);
339
364
  if (flags.workspace) body.workspaceSlug = flags.workspace;
340
365
  if (flags.thread) body.threadSlug = flags.thread;
341
366
  if (flags.presentation) body.presentationMode = flags.presentation;
@@ -353,9 +378,9 @@ CMD['terminal-launch-cli-agent'] = async () => {
353
378
  console.error('Usage: rtx.js terminal-launch-cli-agent <agent-name> [<provider-id>] [<message>] [--workspace=<slug>] [--thread=<slug>] [--presentation=panel|tab] [--model=<id>]');
354
379
  process.exit(1);
355
380
  }
356
- const { sdk } = await getSDK();
381
+ const { sdk, context } = await getSDK();
357
382
  const terminal = getDesktopRuntimeSessionsModule(sdk);
358
- const body = { agentName };
383
+ const body = applyWorkspaceThreadDefaults({ agentName }, context);
359
384
  if (providerId) body.providerId = providerId;
360
385
  if (message) body.message = message;
361
386
  if (flags.workspace) body.workspaceSlug = flags.workspace;
@@ -876,6 +901,7 @@ Connection:
876
901
 
877
902
  sdk.api.*:
878
903
  agents / workspaces / threads <slug> / task <uuid>
904
+ context
879
905
 
880
906
  sdk.activities.*:
881
907
  activities [--status --limit --offset]