@realtimex/sdk 1.4.2 → 1.4.3

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.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "SDK for building Local Apps that integrate with RealtimeX",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -13,7 +13,7 @@
13
13
  }
14
14
  },
15
15
  "scripts": {
16
- "build": "tsup src/index.ts --format cjs,esm --dts --clean",
16
+ "build": "node ../scripts/generate-skill.mjs --force && tsup src/index.ts --format cjs,esm --dts --clean",
17
17
  "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
18
18
  "test": "vitest run",
19
19
  "contract:verify": "node ../scripts/verify-contract-compat.mjs",
@@ -38,6 +38,7 @@
38
38
  },
39
39
  "files": [
40
40
  "dist",
41
+ "skills",
41
42
  "README.md"
42
43
  ],
43
44
  "engines": {
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: realtimex-moderator-sdk
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-26
5
+ sdk_version: 1.4.3
6
+ ---
7
+
8
+ # RealTimeX Moderator (SDK Source-Verified)
9
+
10
+ Interact with the RealTimeX desktop app (`http://localhost:3001`) using `@realtimex/sdk` **v1.4.3** 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)
28
+
29
+ `<SKILL_DIR>` below refers to the directory containing this SKILL.md.
30
+
31
+ ---
32
+
33
+ ## Option A — Bundled CLI
34
+
35
+ ```bash
36
+ SKILL=<SKILL_DIR>/scripts/rtx.js
37
+ ENV=--env-dir=<cwd>
38
+
39
+ node "$SKILL" ping $ENV
40
+ node "$SKILL" agents $ENV
41
+ node "$SKILL" workspaces $ENV
42
+ node "$SKILL" threads <workspace-slug> $ENV
43
+ node "$SKILL" trigger-agent <agent> <workspace> <msg> $ENV
44
+ node "$SKILL" acp-chat qwen "question" --cwd=<path> $ENV
45
+ node "$SKILL" llm-chat "message" $ENV
46
+ node "$SKILL" activities --status=pending $ENV
47
+ node "$SKILL" mcp-servers $ENV
48
+ node "$SKILL" help
49
+ ```
50
+
51
+ ## Option B — Custom script
52
+
53
+ ```js
54
+ const { initSDK } = require('<SKILL_DIR>/scripts/lib/sdk-init');
55
+ const { sdk, apiKey } = await initSDK({ envDir: process.cwd() });
56
+ // All SDK APIs — see references/api-reference.md
57
+ ```
58
+
59
+ ---
60
+
61
+ ## Critical Rules (source-detected)
62
+
63
+ | # | Issue |
64
+ |---|-------|
65
+ | 1 | 'sdk.webhook.triggerAgent()' sends 'event: "task.trigger"' — server expects '"trigger-agen |
66
+ | 2 | 'sdk.task.start/complete/fail' take positional '(taskUuid, ...)' — NOT '{ task_uuid }' obj |
67
+ | 3 | 'sdk.activities.list()' returns 'Activity[]' directly — NOT '{ activities: [...] }' |
68
+ | 4 | 'sdk.llm.chat()' response is 'res.response?.content' — NOT 'choices[0].message.content' |
69
+ | 5 | 'sdk.llm.chatStream()' yields 'chunk.textResponse' — NOT 'choices[0].delta.content' |
70
+ | 6 | 'sdk.llm.embedAndStore()' takes '{ texts: string[], documentId?, workspaceId?, ... }' — NO |
71
+ | 7 | 'sdk.llm.vectors.query()' takes a raw 'number[]' embedding — NOT a text string |
72
+ | 8 | 'sdk.llm.vectors.delete()' requires '{ deleteAll: true }' — delete-by-ID not supported |
73
+ | 9 | 'sdk.mcp.getServers()' takes a plain string — NOT '{ provider: "all" }' |
74
+ | 10 | 'getAgents/getWorkspaces/getThreads/getTask' live on 'sdk.api.*' — NOT directly on 'sdk.*' |
75
+ | 11 | ACP 'streamChat' uses named SSE ('event:' line); 'text_delta.data.type === "thinking"' = i |
76
+ | 12 | ACP sessions stall without 'approvalPolicy: "approve-all"' when tools need permission |
77
+
78
+ Full fixes in `references/known-issues.md`.
79
+
80
+ ---
81
+
82
+ ## Key Facts
83
+
84
+ - **Metadata methods** (`getAgents`, `getWorkspaces`, etc.) live on `sdk.api.*`, not `sdk.*`
85
+ - **`sdk.webhook.triggerAgent()`** sends wrong event type — always use raw fetch with `event: "trigger-agent"`
86
+ - **`sdk.task`** methods: `start(uuid)`, `complete(uuid, result)`, `fail(uuid, "error")` — positional args
87
+ - **ACP sessions** need `approvalPolicy: 'approve-all'` for autonomous scripts
88
+ - **SDK env vars:** `RTX_API_KEY` (dev), `RTX_APP_ID` (prod), `RTX_APP_NAME`
89
+
90
+ ## References
91
+
92
+ - `references/api-reference.md` — all class methods (auto-generated from source)
93
+ - `references/known-issues.md` — verified source mismatches (auto-generated)