@realtimex/sdk 1.7.21 → 2.0.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/dist/chunk-ORAAYW4C.mjs +271 -0
- package/dist/errors-C98IGxYU.d.mts +168 -0
- package/dist/errors-C98IGxYU.d.ts +168 -0
- package/dist/index.d.mts +8 -2048
- package/dist/index.d.ts +8 -2048
- package/dist/index.js +168 -4723
- package/dist/index.mjs +7 -3783
- package/dist/v1/index.d.mts +3 -56
- package/dist/v1/index.d.ts +3 -56
- package/dist/v1/index.js +2 -756
- package/dist/v1/index.mjs +2 -42
- package/package.json +6 -7
- package/dist/chunk-Z5GAUBIM.mjs +0 -993
- package/dist/errors-NufsyIZ-.d.mts +0 -678
- package/dist/errors-NufsyIZ-.d.ts +0 -678
- package/skills/realtimex-moderator-sdk/SKILL.md +0 -102
- package/skills/realtimex-moderator-sdk/references/activities.md +0 -14
- package/skills/realtimex-moderator-sdk/references/agents.md +0 -13
- package/skills/realtimex-moderator-sdk/references/api-reference/acpagent.md +0 -105
- package/skills/realtimex-moderator-sdk/references/api-reference/activities.md +0 -24
- package/skills/realtimex-moderator-sdk/references/api-reference/agent.md +0 -27
- package/skills/realtimex-moderator-sdk/references/api-reference/api.md +0 -17
- package/skills/realtimex-moderator-sdk/references/api-reference/auth.md +0 -36
- package/skills/realtimex-moderator-sdk/references/api-reference/contract.md +0 -27
- package/skills/realtimex-moderator-sdk/references/api-reference/core.md +0 -40
- package/skills/realtimex-moderator-sdk/references/api-reference/database.md +0 -24
- package/skills/realtimex-moderator-sdk/references/api-reference/index.md +0 -43
- package/skills/realtimex-moderator-sdk/references/api-reference/llm.md +0 -176
- package/skills/realtimex-moderator-sdk/references/api-reference/mcp.md +0 -50
- package/skills/realtimex-moderator-sdk/references/api-reference/port.md +0 -21
- package/skills/realtimex-moderator-sdk/references/api-reference/stt.md +0 -15
- package/skills/realtimex-moderator-sdk/references/api-reference/task.md +0 -62
- package/skills/realtimex-moderator-sdk/references/api-reference/tts.md +0 -18
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-acpauth.md +0 -21
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-acpcommands.md +0 -15
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-admin.md +0 -48
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-auth.md +0 -18
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-channels.md +0 -78
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-credentials.md +0 -27
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-customthemes.md +0 -24
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-desktopbrowser.md +0 -39
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-desktopembed.md +0 -24
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-desktopruntimesessions.md +0 -33
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-document.md +0 -39
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-embed.md +0 -27
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-openai.md +0 -21
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-sttapi.md +0 -12
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-system.md +0 -36
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-thread.md +0 -26
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-users.md +0 -15
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-workspace.md +0 -39
- package/skills/realtimex-moderator-sdk/references/api-reference/webhook.md +0 -13
- package/skills/realtimex-moderator-sdk/references/api-reference.md +0 -1330
- package/skills/realtimex-moderator-sdk/references/app-concepts.md +0 -1111
- package/skills/realtimex-moderator-sdk/references/browser.md +0 -27
- package/skills/realtimex-moderator-sdk/references/channels.md +0 -189
- package/skills/realtimex-moderator-sdk/references/credentials.md +0 -111
- package/skills/realtimex-moderator-sdk/references/known-issues.md +0 -237
- package/skills/realtimex-moderator-sdk/references/llm.md +0 -13
- package/skills/realtimex-moderator-sdk/references/mcp.md +0 -13
- package/skills/realtimex-moderator-sdk/references/permissions.md +0 -30
- package/skills/realtimex-moderator-sdk/references/quickstart.md +0 -16
- package/skills/realtimex-moderator-sdk/references/terminal-sessions.md +0 -34
- package/skills/realtimex-moderator-sdk/references/workspaces.md +0 -20
- package/skills/realtimex-moderator-sdk/scripts/lib/sdk-init.js +0 -140
- package/skills/realtimex-moderator-sdk/scripts/rtx.js +0 -1359
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# RealTimeX Browser
|
|
2
|
-
|
|
3
|
-
> Generated workflow guide · SDK **1.7.21** · 2026-05-18
|
|
4
|
-
|
|
5
|
-
Use this for managed RealTimeX Browser sessions and tabs.
|
|
6
|
-
|
|
7
|
-
Correct namespace:
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
sdk.desktopBrowser
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Preferred flow:
|
|
14
|
-
1. Create or get a named browser session.
|
|
15
|
-
2. Read its `remoteDebugPort`.
|
|
16
|
-
3. Use the `agent-browser` skill against that CDP port for page interaction.
|
|
17
|
-
|
|
18
|
-
```js
|
|
19
|
-
await sdk.desktopBrowser.createSession({ sessionName: "docs-research" });
|
|
20
|
-
await sdk.desktopBrowser.createTab({
|
|
21
|
-
sessionName: "docs-research",
|
|
22
|
-
url: "https://example.com"
|
|
23
|
-
});
|
|
24
|
-
const session = await sdk.desktopBrowser.getSession("docs-research");
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Avoid mutating reserved `acp-*` browser sessions unless the user explicitly asks for internal ACP browser flows.
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
# External Chat Channels
|
|
2
|
-
|
|
3
|
-
> Generated workflow guide · SDK **1.7.21** · 2026-05-18
|
|
4
|
-
|
|
5
|
-
Use this for Telegram, Zalo, WhatsApp, Discord, Slack, and other chat channel setup.
|
|
6
|
-
|
|
7
|
-
Required LocalApp permission for `x-app-id` mode:
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
permissions: ["channels.manage"]
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Main namespace:
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
sdk.v1.channels
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Agent Setup Rules
|
|
20
|
-
|
|
21
|
-
- Never print bot tokens, credentials, QR auth state, or full config values back to chat.
|
|
22
|
-
- Do not guess workspace or thread. Load `skills get workspaces` if context is missing.
|
|
23
|
-
- Ask the user to complete provider-side steps that cannot be automated, such as BotFather setup or QR scanning.
|
|
24
|
-
- Prefer creating plugins disabled first, then start only after credentials/login/policies are ready.
|
|
25
|
-
- Use `settings.thread_id` only when the user explicitly wants messages routed to a specific thread.
|
|
26
|
-
- Use `agentWhitelist: ["*"]` only when the user wants any mentioned/available agent allowed. Otherwise ask which agents should be allowed.
|
|
27
|
-
|
|
28
|
-
## Decision Tree
|
|
29
|
-
|
|
30
|
-
- User says Telegram: ask for workspace and Telegram bot token. If they do not have a token, tell them to create one in BotFather first.
|
|
31
|
-
- User says WhatsApp: create a `whatsapp` plugin with empty config, start QR login, ask the user to scan, poll state, configure policies, then start.
|
|
32
|
-
- User says Zalo personal: create a `zalo_personal` plugin with empty config, start QR login, ask the user to scan, poll state, configure policies, then start.
|
|
33
|
-
- User asks to restrict access: use pairing codes or provider policies.
|
|
34
|
-
- User asks to allow anyone: set permissive policies only after confirming the security tradeoff.
|
|
35
|
-
- User is unsure which provider: list supported values: `telegram`, `slack`, `discord`, `zalo`, `zalo_personal`, `whatsapp`.
|
|
36
|
-
|
|
37
|
-
## Common Flow
|
|
38
|
-
|
|
39
|
-
1. Resolve workspace and optional target thread.
|
|
40
|
-
2. Identify provider and collect only the needed credential or QR action.
|
|
41
|
-
3. For token providers, call `pluginsTest(...)` before creating when supported.
|
|
42
|
-
4. Create plugin with `createPlugin(...)` and `enabled: false`.
|
|
43
|
-
5. For QR providers, call `pluginsQrLoginStart(...)`, ask the user to scan, then poll `getState(...)` until connected or failed.
|
|
44
|
-
6. Configure policies with `pluginsPolicies(...)` where relevant.
|
|
45
|
-
7. Start with `pluginsStart(...)`.
|
|
46
|
-
8. Verify `getStatus()` and ask the user to send a first message from the external platform.
|
|
47
|
-
|
|
48
|
-
## Telegram Bot
|
|
49
|
-
|
|
50
|
-
Provider-side step: the user must create a Telegram bot with BotFather and provide the bot token.
|
|
51
|
-
|
|
52
|
-
Test credentials:
|
|
53
|
-
|
|
54
|
-
```js
|
|
55
|
-
await sdk.v1.channels.pluginsTest({
|
|
56
|
-
plugin_type: "telegram",
|
|
57
|
-
config: { botToken: process.env.TELEGRAM_BOT_TOKEN }
|
|
58
|
-
});
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Create plugin:
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
|
-
const created = await sdk.v1.channels.createPlugin({
|
|
65
|
-
workspace_id: 1,
|
|
66
|
-
plugin_type: "telegram",
|
|
67
|
-
name: "Support Telegram",
|
|
68
|
-
enabled: false,
|
|
69
|
-
config: { botToken: process.env.TELEGRAM_BOT_TOKEN },
|
|
70
|
-
settings: { thread_id: null, agentWhitelist: ["*"] }
|
|
71
|
-
});
|
|
72
|
-
await sdk.v1.channels.pluginsStart(String(created.plugin.id));
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
First-message check: ask the user to open Telegram, start the bot, and send a test message.
|
|
76
|
-
|
|
77
|
-
## WhatsApp QR
|
|
78
|
-
|
|
79
|
-
Provider-side step: the user must scan the QR code with WhatsApp.
|
|
80
|
-
|
|
81
|
-
```js
|
|
82
|
-
const created = await sdk.v1.channels.createPlugin({
|
|
83
|
-
workspace_id: 1,
|
|
84
|
-
plugin_type: "whatsapp",
|
|
85
|
-
name: "WhatsApp",
|
|
86
|
-
enabled: false,
|
|
87
|
-
config: {},
|
|
88
|
-
settings: { thread_id: null, agentWhitelist: ["*"] }
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
const id = String(created.plugin.id);
|
|
92
|
-
await sdk.v1.channels.pluginsQrLoginStart(id, { force: false });
|
|
93
|
-
|
|
94
|
-
// Poll until status.connected is true, status.status is error, or user cancels.
|
|
95
|
-
const state = await sdk.v1.channels.getState(id);
|
|
96
|
-
|
|
97
|
-
await sdk.v1.channels.pluginsPolicies(id, {
|
|
98
|
-
policies: {
|
|
99
|
-
dmPolicy: "pairing",
|
|
100
|
-
groupPolicy: "disabled",
|
|
101
|
-
selfChatMode: false
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
await sdk.v1.channels.pluginsStart(id);
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Policy guidance:
|
|
109
|
-
- `dmPolicy: "pairing"` is safer for private access.
|
|
110
|
-
- Keep `groupPolicy: "disabled"` unless the user explicitly wants group chat support.
|
|
111
|
-
- Enable `selfChatMode` only when the user understands the loop/testing behavior.
|
|
112
|
-
|
|
113
|
-
## Zalo Personal QR
|
|
114
|
-
|
|
115
|
-
Provider-side step: the user must scan the QR code with Zalo.
|
|
116
|
-
|
|
117
|
-
```js
|
|
118
|
-
const created = await sdk.v1.channels.createPlugin({
|
|
119
|
-
workspace_id: 1,
|
|
120
|
-
plugin_type: "zalo_personal",
|
|
121
|
-
name: "Zalo Personal",
|
|
122
|
-
enabled: false,
|
|
123
|
-
config: {},
|
|
124
|
-
settings: { thread_id: null, agentWhitelist: ["*"] }
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
const id = String(created.plugin.id);
|
|
128
|
-
await sdk.v1.channels.pluginsQrLoginStart(id, { force: false });
|
|
129
|
-
const state = await sdk.v1.channels.getState(id);
|
|
130
|
-
|
|
131
|
-
await sdk.v1.channels.pluginsPolicies(id, {
|
|
132
|
-
policies: {
|
|
133
|
-
dmPolicy: "pairing",
|
|
134
|
-
groupPolicy: "disabled",
|
|
135
|
-
requireMention: false,
|
|
136
|
-
allowFrom: [],
|
|
137
|
-
groups: {}
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
await sdk.v1.channels.pluginsStart(id);
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Directory helpers after login:
|
|
145
|
-
|
|
146
|
-
```js
|
|
147
|
-
await sdk.v1.channels.listDirectoryFriends(id);
|
|
148
|
-
await sdk.v1.channels.listDirectoryGroups(id);
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
## Pairing And User Approval
|
|
152
|
-
|
|
153
|
-
Use pairing when the channel should not allow every external user by default.
|
|
154
|
-
|
|
155
|
-
```js
|
|
156
|
-
const code = await sdk.v1.channels.pluginsPairingCodes(pluginId, {
|
|
157
|
-
platform_user_id: "external-user-id",
|
|
158
|
-
platform_username: "Customer Name"
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
await sdk.v1.channels.listPluginPairingCodes(pluginId);
|
|
162
|
-
await sdk.v1.channels.pairingCodesApprove(String(code.code.id));
|
|
163
|
-
await sdk.v1.channels.listPluginUsers(pluginId);
|
|
164
|
-
await sdk.v1.channels.pluginsUsersAuthorization(pluginId, userId, { authorized: true });
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Status And Troubleshooting
|
|
168
|
-
|
|
169
|
-
```js
|
|
170
|
-
await sdk.v1.channels.listPlugins();
|
|
171
|
-
await sdk.v1.channels.getStatus();
|
|
172
|
-
await sdk.v1.channels.getConfig(pluginId);
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
- `Not authenticated`: QR login did not complete or credentials were cleared. Start QR login again.
|
|
176
|
-
- Start fails: stop the plugin, test credentials if token-based, check `getStatus()`, then start again.
|
|
177
|
-
- User cannot chat: check pairing codes, user authorization, `dmPolicy`, `groupPolicy`, and provider allow lists.
|
|
178
|
-
- Messages route to the wrong place: check `workspace_id` and `settings.thread_id`.
|
|
179
|
-
- Bot does not receive external messages: confirm provider-side webhook/session requirements and that the plugin is running.
|
|
180
|
-
|
|
181
|
-
## Cleanup
|
|
182
|
-
|
|
183
|
-
```js
|
|
184
|
-
await sdk.v1.channels.pluginsStop(pluginId);
|
|
185
|
-
await sdk.v1.channels.pluginsLogout(pluginId); // QR providers only
|
|
186
|
-
await sdk.v1.channels.deletePlugin(pluginId);
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
Exact generated methods are in `api-reference/v1-channels.md`.
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
# Credentials Reference
|
|
2
|
-
|
|
3
|
-
Credentials are managed by the user in **Settings > Credentials**. Agents have read-only access via `sdk.credentials`.
|
|
4
|
-
|
|
5
|
-
## Security Rules
|
|
6
|
-
|
|
7
|
-
1. **Never** print credential values to stdout (they become tool results in chat history)
|
|
8
|
-
2. **Never** include credential values in your response text
|
|
9
|
-
3. **Never** write credential values to files or logs
|
|
10
|
-
4. **Never** pass credential values as CLI arguments (visible in process list)
|
|
11
|
-
5. **Always** consume credentials inside scripts — fetch, use, discard
|
|
12
|
-
6. **Always** call `process.exit(0)` at the end of custom scripts (prevents hanging on open HTTP sockets)
|
|
13
|
-
7. **Never** write helper scripts into the SKILL directory — use the working directory or system temp
|
|
14
|
-
|
|
15
|
-
## Credential Types
|
|
16
|
-
|
|
17
|
-
| Type | Payload | How to Apply |
|
|
18
|
-
|------|---------|-------------|
|
|
19
|
-
| `http_header` | `{ name, value }` | Set as HTTP header: `headers[payload.name] = payload.value` |
|
|
20
|
-
| `query_auth` | `{ name, value }` | Append to URL: `?${payload.name}=${payload.value}` |
|
|
21
|
-
| `basic_auth` | `{ username, password }` | Encode: `Authorization: Basic ${btoa(username + ":" + password)}` |
|
|
22
|
-
| `env_var` | `{ name, value }` | Set in subprocess: `env[payload.name] = payload.value` |
|
|
23
|
-
|
|
24
|
-
## Usage Patterns
|
|
25
|
-
|
|
26
|
-
### List available credentials
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
node "$SKILL" credentials
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Output: table of names and types (no values).
|
|
33
|
-
|
|
34
|
-
### Important: credential payload structure
|
|
35
|
-
|
|
36
|
-
`sdk.credentials.get(name)` returns `{ name, type, payload }`. The `payload` object contains structured fields — use them directly. **Never** extract raw values and construct headers manually.
|
|
37
|
-
|
|
38
|
-
### Use an http_header credential in a script
|
|
39
|
-
|
|
40
|
-
```javascript
|
|
41
|
-
const { initSDK } = require('<SKILL_DIR>/scripts/lib/sdk-init');
|
|
42
|
-
(async () => {
|
|
43
|
-
const { sdk } = await initSDK();
|
|
44
|
-
const cred = await sdk.credentials.get('github-token');
|
|
45
|
-
// cred.type === "http_header"
|
|
46
|
-
// cred.payload === { name: "Authorization", value: "Bearer ghp_xxx" }
|
|
47
|
-
// The value already includes the full header value — use as-is
|
|
48
|
-
const res = await fetch('https://api.github.com/user', {
|
|
49
|
-
headers: { [cred.payload.name]: cred.payload.value }
|
|
50
|
-
});
|
|
51
|
-
console.log('Status:', res.status); // Only non-sensitive output
|
|
52
|
-
process.exit(0);
|
|
53
|
-
})();
|
|
54
|
-
// WRONG: const token = cred.payload.value; headers.Authorization = `Bearer ${token}`
|
|
55
|
-
// The value already contains "Bearer ..." — adding prefix again causes 401
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Use a basic_auth credential
|
|
59
|
-
|
|
60
|
-
```javascript
|
|
61
|
-
const { initSDK } = require('<SKILL_DIR>/scripts/lib/sdk-init');
|
|
62
|
-
(async () => {
|
|
63
|
-
const { sdk } = await initSDK();
|
|
64
|
-
const cred = await sdk.credentials.get('registry-login');
|
|
65
|
-
const auth = Buffer.from(cred.payload.username + ':' + cred.payload.password).toString('base64');
|
|
66
|
-
const res = await fetch('https://registry.example.com/v2/_catalog', {
|
|
67
|
-
headers: { 'Authorization': 'Basic ' + auth }
|
|
68
|
-
});
|
|
69
|
-
console.log('Status:', res.status);
|
|
70
|
-
process.exit(0);
|
|
71
|
-
})();
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Use an env_var credential with a subprocess
|
|
75
|
-
|
|
76
|
-
```javascript
|
|
77
|
-
const { initSDK } = require('<SKILL_DIR>/scripts/lib/sdk-init');
|
|
78
|
-
const { execSync } = require('child_process');
|
|
79
|
-
(async () => {
|
|
80
|
-
const { sdk } = await initSDK();
|
|
81
|
-
const cred = await sdk.credentials.get('aws-key');
|
|
82
|
-
// cred.type === "env_var"
|
|
83
|
-
// cred.payload === { name: "AWS_ACCESS_KEY_ID", value: "AKIA..." }
|
|
84
|
-
execSync('aws s3 ls', {
|
|
85
|
-
env: { ...process.env, [cred.payload.name]: cred.payload.value },
|
|
86
|
-
stdio: 'inherit'
|
|
87
|
-
});
|
|
88
|
-
process.exit(0);
|
|
89
|
-
})();
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Error handling
|
|
93
|
-
|
|
94
|
-
```javascript
|
|
95
|
-
const { initSDK } = require('<SKILL_DIR>/scripts/lib/sdk-init');
|
|
96
|
-
(async () => {
|
|
97
|
-
try {
|
|
98
|
-
const { sdk } = await initSDK();
|
|
99
|
-
const cred = await sdk.credentials.get('my-key');
|
|
100
|
-
// use cred...
|
|
101
|
-
process.exit(0);
|
|
102
|
-
} catch (err) {
|
|
103
|
-
if (err.message.includes('not found')) {
|
|
104
|
-
console.log('Credential not found. Ask the user to add it in Settings > Credentials.');
|
|
105
|
-
} else {
|
|
106
|
-
console.log('Error:', err.message);
|
|
107
|
-
}
|
|
108
|
-
process.exit(1);
|
|
109
|
-
}
|
|
110
|
-
})();
|
|
111
|
-
```
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
# Known Issues — Source-Detected
|
|
2
|
-
|
|
3
|
-
> Auto-generated by `scripts/generate-skill.mjs` · SDK **1.7.21** · 2026-05-18
|
|
4
|
-
|
|
5
|
-
Run `node scripts/generate-skill.mjs --force` after SDK source changes to refresh.
|
|
6
|
-
|
|
7
|
-
**12/12 issues confirmed in current source.**
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## 1. `sdk.webhook.triggerAgent()` sends `event: "task.trigger"` — server expects `"trigger-agent"`
|
|
12
|
-
|
|
13
|
-
**Status:** 🔴 DETECTED
|
|
14
|
-
**File:** `modules/webhook.ts`
|
|
15
|
-
**Evidence:** `Found `event: "task.trigger"` hardcoded in triggerAgent() body (line ~100)`
|
|
16
|
-
|
|
17
|
-
**Correct usage:**
|
|
18
|
-
```js
|
|
19
|
-
// ❌ WRONG — SDK sends 'task.trigger' but server enum only accepts 'trigger-agent'
|
|
20
|
-
await sdk.webhook.triggerAgent({ auto_run: true, agent_name: 'agent', ... });
|
|
21
|
-
|
|
22
|
-
// ✅ CORRECT — raw fetch with server-expected event string
|
|
23
|
-
const resp = await fetch('http://localhost:3001/webhooks/realtimex', {
|
|
24
|
-
method: 'POST',
|
|
25
|
-
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${apiKey}` },
|
|
26
|
-
body: JSON.stringify({
|
|
27
|
-
event: 'trigger-agent',
|
|
28
|
-
payload: { auto_run: true, agent_name: 'document2speech', workspace_slug: 'sdfsdf', prompt: '...' },
|
|
29
|
-
}),
|
|
30
|
-
});
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## 2. `sdk.task.start/complete/fail` take positional `(taskUuid, ...)` — NOT `{ task_uuid }` object
|
|
36
|
-
|
|
37
|
-
**Status:** 🔴 DETECTED
|
|
38
|
-
**File:** `modules/task.ts`
|
|
39
|
-
**Evidence:** `start(taskUuid: string, ...) | complete(taskUuid, result, ...) | fail(taskUuid, error: string, ...)`
|
|
40
|
-
|
|
41
|
-
**Correct usage:**
|
|
42
|
-
```js
|
|
43
|
-
// ❌ WRONG
|
|
44
|
-
await sdk.task.start({ task_uuid: uuid });
|
|
45
|
-
await sdk.task.complete({ task_uuid: uuid, result: { out: 'done' } });
|
|
46
|
-
|
|
47
|
-
// ✅ CORRECT
|
|
48
|
-
await sdk.task.start(uuid);
|
|
49
|
-
await sdk.task.complete(uuid, { out: 'done' });
|
|
50
|
-
await sdk.task.fail(uuid, 'error message');
|
|
51
|
-
await sdk.task.start(uuid, { machineId: 'machine-01' });
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
---
|
|
55
|
-
|
|
56
|
-
## 3. `sdk.activities.list()` returns `Activity[]` directly — NOT `{ activities: [...] }`
|
|
57
|
-
|
|
58
|
-
**Status:** 🔴 DETECTED
|
|
59
|
-
**File:** `modules/activities.ts`
|
|
60
|
-
**Evidence:** `Return type is Promise<Activity[]>`
|
|
61
|
-
|
|
62
|
-
**Correct usage:**
|
|
63
|
-
```js
|
|
64
|
-
// ❌ WRONG
|
|
65
|
-
const { activities } = await sdk.activities.list();
|
|
66
|
-
|
|
67
|
-
// ✅ CORRECT
|
|
68
|
-
const activities = await sdk.activities.list();
|
|
69
|
-
for (const a of activities) { ... }
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## 4. `sdk.llm.chat()` response is `res.response?.content` — NOT `choices[0].message.content`
|
|
75
|
-
|
|
76
|
-
**Status:** 🔴 DETECTED
|
|
77
|
-
**File:** `modules/llm.ts`
|
|
78
|
-
**Evidence:** `ChatResponse shape: { success, response?: { content, model, metrics } }`
|
|
79
|
-
|
|
80
|
-
**Correct usage:**
|
|
81
|
-
```js
|
|
82
|
-
// ❌ WRONG (OpenAI style)
|
|
83
|
-
console.log(res.choices[0].message.content);
|
|
84
|
-
|
|
85
|
-
// ✅ CORRECT
|
|
86
|
-
const res = await sdk.llm.chat([{ role: 'user', content: 'Hello' }]);
|
|
87
|
-
console.log(res.response?.content);
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## 5. `sdk.llm.chatStream()` yields `chunk.textResponse` — NOT `choices[0].delta.content`
|
|
93
|
-
|
|
94
|
-
**Status:** 🔴 DETECTED
|
|
95
|
-
**File:** `modules/llm.ts`
|
|
96
|
-
**Evidence:** `StreamChunk interface has textResponse?: string`
|
|
97
|
-
|
|
98
|
-
**Correct usage:**
|
|
99
|
-
```js
|
|
100
|
-
// ❌ WRONG
|
|
101
|
-
chunk.choices?.[0]?.delta?.content
|
|
102
|
-
|
|
103
|
-
// ✅ CORRECT
|
|
104
|
-
for await (const chunk of sdk.llm.chatStream(messages)) {
|
|
105
|
-
if (chunk.textResponse) process.stdout.write(chunk.textResponse);
|
|
106
|
-
if (chunk.close) break;
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## 6. `sdk.llm.embedAndStore()` takes `{ texts: string[], documentId?, workspaceId?, ... }` — NOT `(text, options)`
|
|
113
|
-
|
|
114
|
-
**Status:** 🔴 DETECTED
|
|
115
|
-
**File:** `modules/llm.ts`
|
|
116
|
-
**Evidence:** `embedAndStore(params: { texts: string[]; documentId?; workspaceId?; ... })`
|
|
117
|
-
|
|
118
|
-
**Correct usage:**
|
|
119
|
-
```js
|
|
120
|
-
// ❌ WRONG
|
|
121
|
-
await sdk.llm.embedAndStore('text content', { id: 'doc-1' });
|
|
122
|
-
|
|
123
|
-
// ✅ CORRECT
|
|
124
|
-
await sdk.llm.embedAndStore({ texts: ['chunk 1', 'chunk 2'], documentId: 'doc-1', workspaceId: 'ws-123' });
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
## 7. `sdk.llm.vectors.query()` takes a raw `number[]` embedding — NOT a text string
|
|
130
|
-
|
|
131
|
-
**Status:** 🔴 DETECTED
|
|
132
|
-
**File:** `modules/llm.ts`
|
|
133
|
-
**Evidence:** `query(vector: number[], options?)`
|
|
134
|
-
|
|
135
|
-
**Correct usage:**
|
|
136
|
-
```js
|
|
137
|
-
// ❌ WRONG
|
|
138
|
-
await sdk.llm.vectors.query('search text');
|
|
139
|
-
|
|
140
|
-
// ✅ CORRECT — raw vector
|
|
141
|
-
const { embeddings } = await sdk.llm.embed('search text');
|
|
142
|
-
await sdk.llm.vectors.query(embeddings[0], { topK: 5 });
|
|
143
|
-
|
|
144
|
-
// ✅ EASIER — high-level helper
|
|
145
|
-
const hits = await sdk.llm.search('search text', { topK: 5 });
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## 8. `sdk.llm.vectors.delete()` requires `{ deleteAll: true }` — delete-by-ID not supported
|
|
151
|
-
|
|
152
|
-
**Status:** 🔴 DETECTED
|
|
153
|
-
**File:** `modules/llm.ts`
|
|
154
|
-
**Evidence:** `VectorDeleteOptions: { workspaceId?, deleteAll: true } (literal true)`
|
|
155
|
-
|
|
156
|
-
**Correct usage:**
|
|
157
|
-
```js
|
|
158
|
-
// ❌ WRONG
|
|
159
|
-
await sdk.llm.vectors.delete(['id-1', 'id-2']);
|
|
160
|
-
|
|
161
|
-
// ✅ CORRECT
|
|
162
|
-
await sdk.llm.vectors.delete({ deleteAll: true, workspaceId: 'ws-123' });
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
---
|
|
166
|
-
|
|
167
|
-
## 9. `sdk.mcp.getServers()` takes a plain string — NOT `{ provider: "all" }`
|
|
168
|
-
|
|
169
|
-
**Status:** 🔴 DETECTED
|
|
170
|
-
**File:** `modules/mcp.ts`
|
|
171
|
-
**Evidence:** `getServers(provider: 'local' | 'remote' | 'all' = 'all')`
|
|
172
|
-
|
|
173
|
-
**Correct usage:**
|
|
174
|
-
```js
|
|
175
|
-
// ❌ WRONG
|
|
176
|
-
await sdk.mcp.getServers({ provider: 'all' });
|
|
177
|
-
|
|
178
|
-
// ✅ CORRECT
|
|
179
|
-
await sdk.mcp.getServers('all');
|
|
180
|
-
await sdk.mcp.getServers(); // defaults to 'all'
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
---
|
|
184
|
-
|
|
185
|
-
## 10. `getAgents/getWorkspaces/getThreads/getTask` live on `sdk.api.*` — NOT directly on `sdk.*`
|
|
186
|
-
|
|
187
|
-
**Status:** 🔴 DETECTED
|
|
188
|
-
**File:** `index.ts`
|
|
189
|
-
**Evidence:** `this.api = new ApiModule(...) — separate sub-module in constructor`
|
|
190
|
-
|
|
191
|
-
**Correct usage:**
|
|
192
|
-
```js
|
|
193
|
-
// ❌ WRONG
|
|
194
|
-
await sdk.getAgents();
|
|
195
|
-
await sdk.getWorkspaces();
|
|
196
|
-
|
|
197
|
-
// ✅ CORRECT
|
|
198
|
-
await sdk.api.getAgents();
|
|
199
|
-
await sdk.api.getWorkspaces();
|
|
200
|
-
await sdk.api.getThreads('workspace-slug');
|
|
201
|
-
await sdk.api.getTask('task-uuid');
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
---
|
|
205
|
-
|
|
206
|
-
## 11. ACP `streamChat` uses named SSE (`event:` line); `text_delta.data.type === "thinking"` = internal reasoning
|
|
207
|
-
|
|
208
|
-
**Status:** 🔴 DETECTED
|
|
209
|
-
**File:** `modules/acpAgent.ts`
|
|
210
|
-
**Evidence:** `Uses parseNamedSSEStream() — reads both event: and data: SSE lines per spec`
|
|
211
|
-
|
|
212
|
-
**Correct usage:**
|
|
213
|
-
```js
|
|
214
|
-
for await (const event of sdk.acpAgent.streamChat(key, message)) {
|
|
215
|
-
if (event.type === 'text_delta') {
|
|
216
|
-
if (event.data.type !== 'thinking') { // skip internal reasoning
|
|
217
|
-
process.stdout.write(String(event.data.text ?? ''));
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
---
|
|
224
|
-
|
|
225
|
-
## 12. ACP sessions stall without `approvalPolicy: "approve-all"` when tools need permission
|
|
226
|
-
|
|
227
|
-
**Status:** 🔴 DETECTED
|
|
228
|
-
**File:** `modules/acpAgent.ts`
|
|
229
|
-
**Evidence:** `AcpSessionOptions.approvalPolicy?: 'approve-all' | 'approve-reads' | 'deny-all'`
|
|
230
|
-
|
|
231
|
-
**Correct usage:**
|
|
232
|
-
```js
|
|
233
|
-
// ✅ Always set for autonomous scripts
|
|
234
|
-
await sdk.acpAgent.createSession({ agent_id: 'qwen', approvalPolicy: 'approve-all', cwd });
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
---
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# LLM And Vector Store
|
|
2
|
-
|
|
3
|
-
> Generated workflow guide · SDK **1.7.21** · 2026-05-18
|
|
4
|
-
|
|
5
|
-
Use `sdk.llm` for chat, streaming, embeddings, and vector helpers.
|
|
6
|
-
|
|
7
|
-
Common permissions: `llm.chat`, `llm.embed`, `llm.providers`, `vectors.read`, `vectors.write`.
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
await sdk.llm.chat([{ role: "user", content: "Hello" }]);
|
|
11
|
-
await sdk.llm.embed(["text to embed"]);
|
|
12
|
-
await sdk.llm.vectors.query(vector, { workspaceId });
|
|
13
|
-
```
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# MCP
|
|
2
|
-
|
|
3
|
-
> Generated workflow guide · SDK **1.7.21** · 2026-05-18
|
|
4
|
-
|
|
5
|
-
Use `sdk.mcp` to list MCP servers, list tools, and execute tools.
|
|
6
|
-
|
|
7
|
-
Required permissions: `mcp.servers` and `mcp.tools`.
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
await sdk.mcp.getServers();
|
|
11
|
-
await sdk.mcp.getTools(serverName);
|
|
12
|
-
await sdk.mcp.executeTool(serverName, toolName, args);
|
|
13
|
-
```
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Permissions
|
|
2
|
-
|
|
3
|
-
> Generated workflow guide · SDK **1.7.21** · 2026-05-18
|
|
4
|
-
|
|
5
|
-
LocalApps using `x-app-id` must request permissions before calling protected SDK routes.
|
|
6
|
-
|
|
7
|
-
| Permission | Use For |
|
|
8
|
-
|---|---|
|
|
9
|
-
| `api.agents` | List agents |
|
|
10
|
-
| `api.workspaces` | List workspaces |
|
|
11
|
-
| `api.threads` | List workspace threads |
|
|
12
|
-
| `api.task` | Read task status |
|
|
13
|
-
| `activities.read` | Read activities |
|
|
14
|
-
| `activities.write` | Create/update/delete activities |
|
|
15
|
-
| `llm.chat` | LLM chat and streaming chat |
|
|
16
|
-
| `llm.embed` | Generate embeddings |
|
|
17
|
-
| `llm.providers` | List LLM/embed providers |
|
|
18
|
-
| `vectors.read` | Query/list vector stores |
|
|
19
|
-
| `vectors.write` | Upsert/delete vectors |
|
|
20
|
-
| `mcp.servers` | List MCP servers |
|
|
21
|
-
| `mcp.tools` | List/execute MCP tools |
|
|
22
|
-
| `acp.agent` | ACP agent sessions |
|
|
23
|
-
| `desktop.runtime-sessions` | Visible Electron terminal sessions |
|
|
24
|
-
| `desktop.browser` | RealTimeX Browser sessions and tabs |
|
|
25
|
-
| `channels.manage` | External chat channel setup and administration |
|
|
26
|
-
| `tts.generate` | Text-to-speech |
|
|
27
|
-
| `stt.listen` | Speech-to-text |
|
|
28
|
-
| `credentials.read` | Read stored credentials |
|
|
29
|
-
|
|
30
|
-
API-key dev mode has wildcard access.
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# Quickstart
|
|
2
|
-
|
|
3
|
-
> Generated workflow guide · SDK **1.7.21** · 2026-05-18
|
|
4
|
-
|
|
5
|
-
Use this when starting any SDK task.
|
|
6
|
-
|
|
7
|
-
```js
|
|
8
|
-
const { initSDK } = require('<SKILL_DIR>/scripts/lib/sdk-init');
|
|
9
|
-
const { sdk, context } = await initSDK();
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
Rules:
|
|
13
|
-
- Use the working directory or system temp for helper scripts, never the skill directory.
|
|
14
|
-
- Exit scripts explicitly with `process.exit(0)` or `process.exit(1)`.
|
|
15
|
-
- Check `context.workspaceSlug` and `context.threadSlug` before asking the user.
|
|
16
|
-
- For exact signatures, open `references/api-reference/index.md`.
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Desktop Terminal Sessions
|
|
2
|
-
|
|
3
|
-
> Generated workflow guide · SDK **1.7.21** · 2026-05-18
|
|
4
|
-
|
|
5
|
-
Use this for visible Electron terminal sessions.
|
|
6
|
-
|
|
7
|
-
Correct namespace:
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
sdk.desktopRuntimeSessions
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Do not use ACP for visible terminals unless the user explicitly asks for headless ACP.
|
|
14
|
-
|
|
15
|
-
Examples:
|
|
16
|
-
|
|
17
|
-
```js
|
|
18
|
-
await sdk.desktopRuntimeSessions.launchTerminalCliAgent({
|
|
19
|
-
workspaceSlug,
|
|
20
|
-
threadSlug,
|
|
21
|
-
agentName: "claude",
|
|
22
|
-
providerId: "claude-cli",
|
|
23
|
-
presentationMode: "panel",
|
|
24
|
-
message: "what is current working dir"
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
await sdk.desktopRuntimeSessions.launchTerminalShell({
|
|
28
|
-
workspaceSlug,
|
|
29
|
-
threadSlug,
|
|
30
|
-
presentationMode: "panel",
|
|
31
|
-
initialCommand: "pwd",
|
|
32
|
-
initialCommandMode: "direct"
|
|
33
|
-
});
|
|
34
|
-
```
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Workspaces And Threads
|
|
2
|
-
|
|
3
|
-
> Generated workflow guide · SDK **1.7.21** · 2026-05-18
|
|
4
|
-
|
|
5
|
-
Use this before any task that needs workspace/thread context.
|
|
6
|
-
|
|
7
|
-
Priority order:
|
|
8
|
-
1. Explicit user-provided workspace/thread.
|
|
9
|
-
2. `context.workspaceSlug` / `context.threadSlug` from `initSDK()`.
|
|
10
|
-
3. `RTX_WORKSPACE_SLUG` / `RTX_THREAD_SLUG` in spawned sessions.
|
|
11
|
-
4. List workspaces and threads, then ask only if ambiguous.
|
|
12
|
-
|
|
13
|
-
Useful calls:
|
|
14
|
-
|
|
15
|
-
```js
|
|
16
|
-
await sdk.api.getWorkspaces();
|
|
17
|
-
await sdk.api.getThreads(workspaceSlug);
|
|
18
|
-
await sdk.v1.workspace.listWorkspaces();
|
|
19
|
-
await sdk.v1.thread.listWorkspaceThreads(slug);
|
|
20
|
-
```
|