@realtimex/sdk 1.5.0 → 1.5.1

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.5.0",
3
+ "version": "1.5.1",
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,30 +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-03-31
5
- sdk_version: 1.5.0
4
+ generated: 2026-04-02
5
+ sdk_version: 1.5.1
6
6
  ---
7
7
 
8
8
  # RealTimeX Moderator (SDK Source-Verified)
9
9
 
10
- Interact with the RealTimeX desktop app (`http://localhost:3001`) using `@realtimex/sdk` **v1.5.0** in Developer Mode (API Key).
11
-
12
- > Auto-generated from the `@realtimex/sdk` TypeScript source.
13
- > Refresh: `node scripts/generate-skill.mjs --force` from the SDK repo root.
14
-
15
- ---
16
-
17
- ## Authentication
18
-
19
- When running inside RealtimeX (via an agent session or on the same machine), authentication is **automatic** — no setup needed.
20
-
21
- Handled by `scripts/lib/sdk-init.js` — credential resolution priority:
22
- 1. Explicit override passed to `initSDK({ apiKey })` or `initSDK({ appId })`
23
- 2. `REALTIMEX_API_KEY` / `REALTIMEX_AI_API_KEY` in `<cwd>/.env`
24
- 3. `RTX_API_KEY` / `REALTIMEX_API_KEY` / `REALTIMEX_AI_API_KEY` from `process.env`
25
- 4. `RTX_APP_ID` from `process.env` (injected by RealtimeX for agents / local apps)
26
- 5. `~/.realtimex.ai/.sdk-app-id` file (written by RealTimeX server on startup)
27
- 6. Interactive readline prompt (dev fallback)
10
+ Interact with the RealTimeX platform (`http://localhost:3001`) using `@realtimex/sdk` **v1.5.1**. Authentication is automatic when running inside RealtimeX.
28
11
 
29
12
  `<SKILL_DIR>` below refers to the directory containing this SKILL.md.
30
13
 
@@ -52,7 +35,7 @@ node "$SKILL" help
52
35
 
53
36
  ```js
54
37
  const { initSDK } = require('<SKILL_DIR>/scripts/lib/sdk-init');
55
- const { sdk, apiKey } = await initSDK({ envDir: process.cwd() });
38
+ const { sdk } = await initSDK();
56
39
  // All SDK APIs — see references/api-reference.md
57
40
  ```
58
41
 
@@ -1,6 +1,6 @@
1
1
  # RealTimeX SDK — API Reference
2
2
 
3
- > Auto-generated from `@realtimex/sdk` source · v**1.5.0** · 2026-03-31
3
+ > Auto-generated from `@realtimex/sdk` source · v**1.5.1** · 2026-04-02
4
4
 
5
5
  **Package:** `@realtimex/sdk` (CJS) · **Server:** `http://localhost:3001`
6
6
  **Developer Mode auth:** `Authorization: Bearer <apiKey>`
@@ -1,6 +1,6 @@
1
1
  # Known Issues — Source-Detected
2
2
 
3
- > Auto-generated by `scripts/generate-skill.mjs` · SDK **1.5.0** · 2026-03-31
3
+ > Auto-generated by `scripts/generate-skill.mjs` · SDK **1.5.1** · 2026-04-02
4
4
 
5
5
  Run `node scripts/generate-skill.mjs --force` after SDK source changes to refresh.
6
6
 
@@ -1,17 +1,15 @@
1
1
  'use strict';
2
2
  /**
3
- * sdk-init.js — SDK initializer with automatic credential resolution
3
+ * sdk-init.js — SDK initializer
4
4
  * AUTO-GENERATED by scripts/generate-skill.mjs — do not edit by hand.
5
5
  *
6
- * Source reference: typescript/src/index.ts (RealtimeXSDK constructor)
7
- *
8
- * Credential resolution priority:
6
+ * Credential resolution:
9
7
  * 1. Explicit override passed to initSDK({ apiKey } or { appId })
10
- * 2. REALTIMEX_API_KEY / REALTIMEX_AI_API_KEY in <envDir>/.env
11
- * 3. RTX_API_KEY / REALTIMEX_API_KEY / REALTIMEX_AI_API_KEY in process.env
12
- * 4. RTX_APP_ID in process.env (injected by RealtimeX for agents / local apps)
13
- * 5. ~/.realtimex.ai/.sdk-app-id file (written by RealtimeX server on startup)
14
- * 6. Interactive readline prompt (dev fallback)
8
+ * 2. ~/.realtimex.ai/.sdk-app-id file (written by RealtimeX server)
9
+ * 3. RTX_APP_ID in process.env (injected by RealtimeX for local apps)
10
+ * 4. RTX_API_KEY in process.env (standalone dev)
11
+ * 5. REALTIMEX_API_KEY / REALTIMEX_AI_API_KEY in <envDir>/.env (standalone dev)
12
+ * 6. Interactive readline prompt (fallback)
15
13
  */
16
14
 
17
15
  const path = require('path');
@@ -27,7 +25,7 @@ const ALL_PERMISSIONS = [
27
25
  'tts.generate', 'mcp.servers', 'mcp.tools', 'acp.agent',
28
26
  ];
29
27
 
30
- /** Well-known file written by RealtimeX server for seamless SDK auth. */
28
+ /** Well-known file written by RealtimeX server for seamless auth. */
31
29
  const SDK_APP_ID_FILE = path.join(os.homedir(), '.realtimex.ai', '.sdk-app-id');
32
30
 
33
31
  function parseEnvFile(filePath) {
@@ -46,28 +44,16 @@ function parseEnvFile(filePath) {
46
44
  }
47
45
 
48
46
  /**
49
- * Resolve credentials using the full priority chain.
50
- * Returns { apiKey, appId } exactly one will be set.
47
+ * Resolve credentials. The well-known app ID file is checked first so
48
+ * agents running inside RealtimeX authenticate without hitting stale
49
+ * or inherited env vars.
51
50
  */
52
51
  async function resolveCredentials({ envDir, apiKey, appId } = {}) {
53
52
  // 1. Explicit overrides
54
53
  if (apiKey) return { apiKey, appId: null };
55
54
  if (appId) return { apiKey: null, appId };
56
55
 
57
- // 2. .env file
58
- const envVars = parseEnvFile(path.join(envDir || process.cwd(), '.env'));
59
- const fromFile = envVars.REALTIMEX_API_KEY || envVars.REALTIMEX_AI_API_KEY;
60
- if (fromFile) return { apiKey: fromFile, appId: null };
61
-
62
- // 3. Process env — API key
63
- const fromEnv = process.env.RTX_API_KEY || process.env.REALTIMEX_API_KEY || process.env.REALTIMEX_AI_API_KEY;
64
- if (fromEnv) return { apiKey: fromEnv, appId: null };
65
-
66
- // 4. Process env — App ID (injected by RealtimeX for agents / local apps)
67
- const envAppId = process.env.RTX_APP_ID;
68
- if (envAppId) return { apiKey: null, appId: envAppId };
69
-
70
- // 5. Well-known file (written by RealtimeX server on startup)
56
+ // 2. Well-known file (written by RealtimeX server — highest auto priority)
71
57
  try {
72
58
  if (fs.existsSync(SDK_APP_ID_FILE)) {
73
59
  const fileAppId = fs.readFileSync(SDK_APP_ID_FILE, 'utf-8').trim();
@@ -75,7 +61,19 @@ async function resolveCredentials({ envDir, apiKey, appId } = {}) {
75
61
  }
76
62
  } catch { /* ignore read errors */ }
77
63
 
78
- // 6. Interactive prompt (dev fallback)
64
+ // 3. RTX_APP_ID from process.env (injected by Electron for local apps)
65
+ const envAppId = process.env.RTX_APP_ID;
66
+ if (envAppId) return { apiKey: null, appId: envAppId };
67
+
68
+ // 4. RTX_API_KEY from process.env (standalone dev — explicit, no collision risk)
69
+ if (process.env.RTX_API_KEY) return { apiKey: process.env.RTX_API_KEY, appId: null };
70
+
71
+ // 5. .env file (standalone dev)
72
+ const envVars = parseEnvFile(path.join(envDir || process.cwd(), '.env'));
73
+ const fromFile = envVars.RTX_API_KEY || envVars.REALTIMEX_API_KEY || envVars.REALTIMEX_AI_API_KEY;
74
+ if (fromFile) return { apiKey: fromFile, appId: null };
75
+
76
+ // 6. Interactive prompt (fallback)
79
77
  const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
80
78
  const answer = await new Promise((resolve) => {
81
79
  rl.question('RealTimeX API key not found. Enter your API key: ', (ans) => {
@@ -88,19 +86,13 @@ async function resolveCredentials({ envDir, apiKey, appId } = {}) {
88
86
  return { apiKey: null, appId: null };
89
87
  }
90
88
 
91
- /** @deprecated Use resolveCredentials() instead */
92
- async function resolveApiKey(opts = {}) {
93
- const { apiKey } = await resolveCredentials(opts);
94
- return apiKey;
95
- }
96
-
97
89
  async function initSDK(opts = {}) {
98
90
  const { RealtimeXSDK } = require('@realtimex/sdk');
99
91
  const { apiKey, appId } = await resolveCredentials(opts);
100
92
 
101
93
  if (!apiKey && !appId) {
102
94
  throw new Error(
103
- 'No credentials found. Set REALTIMEX_API_KEY in .env, or run inside RealtimeX for automatic auth.'
95
+ 'No credentials found. Run inside RealtimeX for automatic auth, or set RTX_API_KEY.'
104
96
  );
105
97
  }
106
98
 
@@ -116,4 +108,4 @@ async function initSDK(opts = {}) {
116
108
  return { sdk, apiKey: apiKey || null, appId: appId || null };
117
109
  }
118
110
 
119
- module.exports = { initSDK, resolveCredentials, resolveApiKey, parseEnvFile, ALL_PERMISSIONS, SDK_APP_ID_FILE };
111
+ module.exports = { initSDK, resolveCredentials, parseEnvFile, ALL_PERMISSIONS, SDK_APP_ID_FILE };