@realtimex/sdk 1.7.17 → 1.7.19
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 +1 -1
- package/skills/realtimex-moderator-sdk/SKILL.md +49 -493
- package/skills/realtimex-moderator-sdk/references/activities.md +14 -0
- package/skills/realtimex-moderator-sdk/references/agents.md +13 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/acpagent.md +105 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/activities.md +24 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/agent.md +27 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/api.md +17 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/auth.md +36 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/contract.md +27 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/core.md +40 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/database.md +24 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/index.md +43 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/llm.md +176 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/mcp.md +50 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/port.md +21 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/stt.md +15 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/task.md +62 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/tts.md +18 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-acpauth.md +21 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-acpcommands.md +15 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-admin.md +48 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-auth.md +18 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-channels.md +78 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-credentials.md +27 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-customthemes.md +24 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-desktopbrowser.md +39 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-desktopembed.md +24 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-desktopruntimesessions.md +33 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-document.md +39 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-embed.md +27 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-openai.md +21 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-sttapi.md +12 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-system.md +36 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-thread.md +26 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-users.md +15 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/v1-workspace.md +39 -0
- package/skills/realtimex-moderator-sdk/references/api-reference/webhook.md +13 -0
- package/skills/realtimex-moderator-sdk/references/api-reference.md +78 -1
- package/skills/realtimex-moderator-sdk/references/app-concepts.md +148 -0
- package/skills/realtimex-moderator-sdk/references/browser.md +27 -0
- package/skills/realtimex-moderator-sdk/references/channels.md +189 -0
- package/skills/realtimex-moderator-sdk/references/known-issues.md +1 -1
- package/skills/realtimex-moderator-sdk/references/llm.md +13 -0
- package/skills/realtimex-moderator-sdk/references/mcp.md +13 -0
- package/skills/realtimex-moderator-sdk/references/permissions.md +30 -0
- package/skills/realtimex-moderator-sdk/references/quickstart.md +16 -0
- package/skills/realtimex-moderator-sdk/references/terminal-sessions.md +34 -0
- package/skills/realtimex-moderator-sdk/references/workspaces.md +20 -0
- package/skills/realtimex-moderator-sdk/scripts/rtx.js +121 -0
package/package.json
CHANGED
|
@@ -1,453 +1,84 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: realtimex-moderator-sdk
|
|
3
|
-
description: Control and interact with the RealTimeX application through its Node.js SDK.
|
|
4
|
-
generated: 2026-05-
|
|
5
|
-
sdk_version: 1.7.
|
|
3
|
+
description: Control and interact with the RealTimeX application through its Node.js SDK. Use for workspaces, threads, agents, activities, LLM chat, vector store, MCP tools, ACP sessions, desktop terminal/browser sessions, chat channels, TTS/STT, and other RealTimeX platform APIs. Load detailed version-matched instructions with `rtx.js skills get <topic>`.
|
|
4
|
+
generated: 2026-05-18
|
|
5
|
+
sdk_version: 1.7.19
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# RealTimeX Moderator
|
|
8
|
+
# RealTimeX Moderator SDK
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
SDK-backed control of the local RealTimeX platform (`http://localhost:3001`) using `@realtimex/sdk` **v1.7.19**.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
This file is the discovery stub. Load workflow content from the bundled CLI so instructions match the installed SDK version.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
`<SKILL_DIR>` below means this skill directory.
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Start Here
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
19
|
SKILL=<SKILL_DIR>/scripts/rtx.js
|
|
20
20
|
ENV=--env-dir=<cwd>
|
|
21
21
|
|
|
22
|
-
node "$SKILL"
|
|
23
|
-
node "$SKILL"
|
|
24
|
-
node "$SKILL" agents $ENV
|
|
25
|
-
node "$SKILL" workspaces $ENV
|
|
26
|
-
node "$SKILL" threads <workspace-slug> $ENV
|
|
27
|
-
node "$SKILL" trigger-agent <agent> <workspace> <msg> $ENV
|
|
28
|
-
node "$SKILL" terminal-launch-cli-agent claude claude-cli "what is current working dir" --workspace=<slug> --thread=<slug> $ENV
|
|
29
|
-
node "$SKILL" terminal-launch-shell --workspace=<slug> --thread=<slug> --command="pwd" $ENV
|
|
30
|
-
node "$SKILL" terminal-sessions --workspace=<slug> $ENV
|
|
31
|
-
node "$SKILL" terminal-write <session-id> "continue" $ENV
|
|
32
|
-
node "$SKILL" browser-sessions $ENV
|
|
33
|
-
node "$SKILL" browser-session-create github-review $ENV
|
|
34
|
-
node "$SKILL" browser-tab-create https://example.com --session=github-review $ENV
|
|
35
|
-
node "$SKILL" acp-chat qwen-cli "question" --cwd=<path> $ENV
|
|
36
|
-
node "$SKILL" llm-chat "message" $ENV
|
|
37
|
-
node "$SKILL" activities --status=pending $ENV
|
|
38
|
-
node "$SKILL" mcp-servers $ENV
|
|
39
|
-
node "$SKILL" help
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Option B — Custom script
|
|
43
|
-
|
|
44
|
-
```js
|
|
45
|
-
const { initSDK } = require('<SKILL_DIR>/scripts/lib/sdk-init');
|
|
46
|
-
const { sdk, context } = await initSDK();
|
|
47
|
-
// All SDK APIs — see references/api-reference.md
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
When writing helper scripts, use the working directory or system temp — never the SKILL directory.
|
|
51
|
-
Scripts using the SDK must exit explicitly — `process.exit(0)` on success, `process.exit(1)` on error — or they hang on open HTTP sockets.
|
|
52
|
-
|
|
53
|
-
When the skill runs inside a spawned ACP or desktop terminal session, RealtimeX injects:
|
|
54
|
-
- `RTX_WORKSPACE_SLUG`
|
|
55
|
-
- `RTX_THREAD_SLUG`
|
|
56
|
-
|
|
57
|
-
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.
|
|
58
|
-
|
|
59
|
-
## Workspace And Thread Rule
|
|
60
|
-
|
|
61
|
-
When the skill is used and a task needs workspace/thread context:
|
|
62
|
-
|
|
63
|
-
1. Check current context first.
|
|
64
|
-
Use `const { sdk, context } = await initSDK()` or `node "$SKILL" context`.
|
|
65
|
-
2. If `context.workspaceSlug` or `context.threadSlug` exists, use it as the default.
|
|
66
|
-
3. If the user explicitly provided workspace/thread, those values override the default context.
|
|
67
|
-
4. If no current context is available:
|
|
68
|
-
- list workspaces first
|
|
69
|
-
- list threads for the chosen workspace if a thread is needed
|
|
70
|
-
- ask the user only when still ambiguous
|
|
71
|
-
|
|
72
|
-
Do not guess a workspace or thread if the current context is unknown.
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## Desktop Terminal Sessions
|
|
77
|
-
|
|
78
|
-
For anything that says **launch terminal**, **open shell**, **open Claude/Gemini in terminal**, or **send another message to an existing terminal session**, use:
|
|
79
|
-
|
|
80
|
-
- `sdk.desktopRuntimeSessions.*`
|
|
81
|
-
|
|
82
|
-
Do **not** use ACP for that unless the user explicitly asks for a headless ACP session.
|
|
83
|
-
|
|
84
|
-
### Use desktop terminal sessions for
|
|
85
|
-
- opening a visible terminal in the Electron app
|
|
86
|
-
- launching a shell session
|
|
87
|
-
- launching a CLI agent in a terminal tab/panel
|
|
88
|
-
- listing desktop terminal sessions
|
|
89
|
-
- writing more input to an existing terminal session
|
|
90
|
-
- approving or denying a pending terminal action
|
|
91
|
-
- closing a terminal session
|
|
92
|
-
|
|
93
|
-
### Use ACP only for
|
|
94
|
-
- headless background agent sessions
|
|
95
|
-
- persistent server-side automation
|
|
96
|
-
- `acp-chat`, `acp-stream`, `acp-session-*`
|
|
97
|
-
|
|
98
|
-
### Correct SDK namespace
|
|
99
|
-
|
|
100
|
-
```js
|
|
101
|
-
sdk.desktopRuntimeSessions
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Compatibility:
|
|
105
|
-
- `sdk.desktopRuntimeSessions` is the preferred alias
|
|
106
|
-
- `sdk.v1.desktopRuntimeSessions` still exists for backward compatibility
|
|
107
|
-
- there is no `sdk.v1.runtimeSessions`
|
|
108
|
-
|
|
109
|
-
### Required payloads
|
|
110
|
-
|
|
111
|
-
Launch terminal CLI agent:
|
|
112
|
-
|
|
113
|
-
```js
|
|
114
|
-
await sdk.desktopRuntimeSessions.launchTerminalCliAgent({
|
|
115
|
-
workspaceSlug: "agent-heartbeat",
|
|
116
|
-
threadSlug: "ambient-agent-week-agent-heartbeat-2026-w17",
|
|
117
|
-
agentName: "claude", // required
|
|
118
|
-
providerId: "claude-cli", // strongly recommended
|
|
119
|
-
presentationMode: "panel", // optional: "panel" | "tab"
|
|
120
|
-
message: "what is current working dir"
|
|
121
|
-
});
|
|
22
|
+
node "$SKILL" skills get core $ENV
|
|
23
|
+
node "$SKILL" skills get core --full $ENV
|
|
122
24
|
```
|
|
123
25
|
|
|
124
|
-
|
|
125
|
-
- explicit user-provided values
|
|
126
|
-
- `RTX_WORKSPACE_SLUG` / `RTX_THREAD_SLUG` from the current spawned process
|
|
127
|
-
- list workspaces/threads and ask only if still ambiguous
|
|
128
|
-
|
|
129
|
-
Important:
|
|
130
|
-
- `agentName` is the agent label, like `"claude"` or `"gemini"`
|
|
131
|
-
- `providerId` is the launcher/provider id, like `"claude-cli"` or `"gemini-cli"`
|
|
132
|
-
- Do not pass `agentName: "claude-cli"` unless that is truly the agent label shown by the app
|
|
133
|
-
|
|
134
|
-
Launch terminal shell:
|
|
26
|
+
The CLI serves skill content generated from the installed SDK source and generated references.
|
|
135
27
|
|
|
136
|
-
|
|
137
|
-
await sdk.desktopRuntimeSessions.launchTerminalShell({
|
|
138
|
-
workspaceSlug: "agent-heartbeat",
|
|
139
|
-
threadSlug: "ambient-agent-week-agent-heartbeat-2026-w17",
|
|
140
|
-
presentationMode: "panel",
|
|
141
|
-
initialCommand: "pwd",
|
|
142
|
-
initialCommandMode: "direct"
|
|
143
|
-
});
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
Rule:
|
|
147
|
-
- If you launch a shell with `initialCommand` and the user did not explicitly ask to prefill only, use `initialCommandMode: "direct"`.
|
|
148
|
-
- Use `prefill` only when the user specifically wants the command staged without execution.
|
|
28
|
+
## Specialized Skills
|
|
149
29
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
```js
|
|
153
|
-
await sdk.desktopRuntimeSessions.listRuntimeSessions();
|
|
154
|
-
await sdk.desktopRuntimeSessions.getRuntimeSession("cli-agent:pty-123");
|
|
155
|
-
await sdk.desktopRuntimeSessions.write("cli-agent:pty-123", {
|
|
156
|
-
message: "continue"
|
|
157
|
-
});
|
|
158
|
-
await sdk.desktopRuntimeSessions.permission("cli-agent:pty-123", {
|
|
159
|
-
outcome: "approved",
|
|
160
|
-
actionId: "terminal-action-1"
|
|
161
|
-
});
|
|
162
|
-
await sdk.desktopRuntimeSessions.deleteRuntimeSession("cli-agent:pty-123");
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### Preferred decision rule
|
|
166
|
-
|
|
167
|
-
If the user says:
|
|
168
|
-
- "launch in terminal"
|
|
169
|
-
- "open Claude in terminal"
|
|
170
|
-
- "ask Gemini in terminal"
|
|
171
|
-
- "open a shell and run pwd"
|
|
172
|
-
|
|
173
|
-
then prefer `sdk.desktopRuntimeSessions.*`, not ACP.
|
|
174
|
-
|
|
175
|
-
If the user says:
|
|
176
|
-
- "open this URL in RealTimeX Browser"
|
|
177
|
-
- "create a browser session"
|
|
178
|
-
- "navigate the managed browser tab"
|
|
179
|
-
- "focus or close a RealTimeX Browser tab"
|
|
180
|
-
- "control the webpage in the browser"
|
|
181
|
-
|
|
182
|
-
then prefer `sdk.desktopBrowser.*`, not ACP and not desktop terminal sessions.
|
|
183
|
-
|
|
184
|
-
---
|
|
185
|
-
|
|
186
|
-
## Desktop Browser
|
|
187
|
-
|
|
188
|
-
For anything that says **RealTimeX Browser**, **browser session**, **browser tab**, **open a URL in the managed browser**, or **navigate/focus/close a managed browser tab**, use:
|
|
189
|
-
|
|
190
|
-
- `sdk.desktopBrowser.*`
|
|
191
|
-
|
|
192
|
-
Do **not** use ACP for this unless the user explicitly wants ACP browser handoff behavior. Do **not** use `sdk.desktopRuntimeSessions.*` for browser tabs; that module is only for terminal sessions.
|
|
193
|
-
|
|
194
|
-
### Use desktop browser for
|
|
195
|
-
- listing named RealTimeX Browser sessions
|
|
196
|
-
- creating a named browser session
|
|
197
|
-
- getting or deleting a named browser session
|
|
198
|
-
- opening the initial URL for a new browser session
|
|
199
|
-
- reading a browser tab snapshot
|
|
200
|
-
- evaluating JavaScript in a browser tab
|
|
201
|
-
- focusing a browser tab
|
|
202
|
-
- navigating a browser tab
|
|
203
|
-
- closing a browser tab
|
|
204
|
-
|
|
205
|
-
### Current workflow rule
|
|
206
|
-
|
|
207
|
-
The current CLI browser flow has a known problem when opening another URL in a new managed tab.
|
|
208
|
-
|
|
209
|
-
Because of that:
|
|
210
|
-
- if the user needs a different URL, create a new browser session first
|
|
211
|
-
- do not rely on opening another managed tab as the primary workflow
|
|
212
|
-
- treat one named browser session as one main browsing target
|
|
213
|
-
|
|
214
|
-
Preferred flow:
|
|
215
|
-
1. create a named browser session
|
|
216
|
-
2. read the returned `remoteDebugPort`
|
|
217
|
-
3. use the `agent-browser` skill against that CDP port for page interaction and automation
|
|
218
|
-
|
|
219
|
-
Use `sdk.desktopBrowser.*` to create/list/get/delete the session.
|
|
220
|
-
Use `agent-browser` to manipulate the webpage after the session is running.
|
|
221
|
-
|
|
222
|
-
### Correct SDK namespace
|
|
223
|
-
|
|
224
|
-
```js
|
|
225
|
-
sdk.desktopBrowser
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
Compatibility:
|
|
229
|
-
- `sdk.desktopBrowser` is the preferred alias
|
|
230
|
-
- `sdk.v1.desktopBrowser` still exists for backward compatibility
|
|
231
|
-
|
|
232
|
-
### Correct examples
|
|
233
|
-
|
|
234
|
-
List browser sessions:
|
|
235
|
-
|
|
236
|
-
```js
|
|
237
|
-
await sdk.desktopBrowser.listSessions();
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
Create a named browser session:
|
|
241
|
-
|
|
242
|
-
```js
|
|
243
|
-
await sdk.desktopBrowser.createSession({
|
|
244
|
-
sessionName: "github-review"
|
|
245
|
-
});
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
Create a browser tab:
|
|
249
|
-
|
|
250
|
-
```js
|
|
251
|
-
await sdk.desktopBrowser.createTab({
|
|
252
|
-
sessionName: "github-review",
|
|
253
|
-
url: "https://example.com"
|
|
254
|
-
});
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
Get the CDP port from a session:
|
|
258
|
-
|
|
259
|
-
```js
|
|
260
|
-
const session = await sdk.desktopBrowser.getSession("github-review");
|
|
261
|
-
const port = session?.session?.remoteDebugPort || session?.runtime?.remoteDebugPort;
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
Navigate a browser tab:
|
|
265
|
-
|
|
266
|
-
```js
|
|
267
|
-
await sdk.desktopBrowser.navigateTab("cli-browser:9555:tab:3", {
|
|
268
|
-
url: "https://docs.realtimex.ai",
|
|
269
|
-
focus: true,
|
|
270
|
-
focusWindow: true
|
|
271
|
-
});
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
Evaluate JavaScript in a browser tab:
|
|
275
|
-
|
|
276
|
-
```js
|
|
277
|
-
await sdk.desktopBrowser.evaluateTab("cli-browser:9555:tab:3", {
|
|
278
|
-
expression: "document.title",
|
|
279
|
-
userGesture: true
|
|
280
|
-
});
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
Preferred webpage-control pattern:
|
|
284
|
-
|
|
285
|
-
```js
|
|
286
|
-
const created = await sdk.desktopBrowser.createSession({
|
|
287
|
-
sessionName: "docs-research"
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
const port =
|
|
291
|
-
created?.session?.remoteDebugPort ||
|
|
292
|
-
created?.runtime?.remoteDebugPort;
|
|
293
|
-
|
|
294
|
-
// Then hand off to the `agent-browser` skill using the CDP endpoint for that port,
|
|
295
|
-
// e.g. http://127.0.0.1:${port}
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
### Naming rule
|
|
299
|
-
|
|
300
|
-
Prefer normal named sessions like:
|
|
301
|
-
- `github-review`
|
|
302
|
-
- `docs-research`
|
|
303
|
-
- `qa-checkout`
|
|
304
|
-
|
|
305
|
-
Avoid mutating reserved/system-managed sessions like `acp-*` unless the user explicitly asks to work with internal ACP browser flows.
|
|
306
|
-
|
|
307
|
-
---
|
|
308
|
-
|
|
309
|
-
## ACP Session Management
|
|
310
|
-
|
|
311
|
-
ACP sessions are persistent agent processes. **Always reuse sessions** across turns instead of spawning a new process for every message — it preserves context and is far more efficient.
|
|
312
|
-
|
|
313
|
-
### Smart `acp-chat` (recommended)
|
|
314
|
-
|
|
315
|
-
`acp-chat` automatically finds or creates a session using this priority:
|
|
316
|
-
|
|
317
|
-
1. `--session=<key>` → validate and reuse that exact session
|
|
318
|
-
2. `listSessions()` → find a compatible active session (same `agent_id`, optional `cwd` match)
|
|
319
|
-
3. `createSession()` → spawn a new agent process only if none available
|
|
30
|
+
Load the smallest relevant topic before acting:
|
|
320
31
|
|
|
321
32
|
```bash
|
|
322
|
-
|
|
323
|
-
node "$SKILL"
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
node "$SKILL"
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
node "$SKILL"
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
node "$SKILL" acp-chat qwen-cli "start over" --new $ENV
|
|
333
|
-
|
|
334
|
-
# Close session after this turn
|
|
335
|
-
node "$SKILL" acp-chat qwen-cli "done for now" --close $ENV
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
### Manual Session Lifecycle
|
|
339
|
-
|
|
340
|
-
```bash
|
|
341
|
-
# Spawn a session explicitly — save the session_key
|
|
342
|
-
node "$SKILL" acp-session-create qwen-cli --cwd=~/projects/myapp $ENV
|
|
343
|
-
|
|
344
|
-
# Inspect session state
|
|
345
|
-
node "$SKILL" acp-session-get <session-key> $ENV
|
|
346
|
-
|
|
347
|
-
# List all active sessions
|
|
348
|
-
node "$SKILL" acp-sessions $ENV
|
|
349
|
-
|
|
350
|
-
# Patch runtime options (applied on next turn)
|
|
351
|
-
node "$SKILL" acp-session-patch <session-key> --cwd=~/projects/other $ENV
|
|
352
|
-
|
|
353
|
-
# Send a turn on an existing session (sync, no streaming)
|
|
354
|
-
node "$SKILL" acp-send <session-key> "what files did you create?" $ENV
|
|
355
|
-
|
|
356
|
-
# Stream a turn on an existing session (with permission handling)
|
|
357
|
-
node "$SKILL" acp-stream <session-key> "run the tests" $ENV
|
|
358
|
-
|
|
359
|
-
# Cancel the active turn
|
|
360
|
-
node "$SKILL" acp-cancel <session-key> $ENV
|
|
361
|
-
|
|
362
|
-
# Manually resolve a permission request (while stream is active in another process)
|
|
363
|
-
node "$SKILL" acp-resolve <session-key> <request-id> <option-id> $ENV
|
|
364
|
-
|
|
365
|
-
# Close/terminate the session
|
|
366
|
-
node "$SKILL" acp-session-close <session-key> $ENV
|
|
33
|
+
node "$SKILL" skills list $ENV
|
|
34
|
+
node "$SKILL" skills get workspaces $ENV
|
|
35
|
+
node "$SKILL" skills get agents $ENV
|
|
36
|
+
node "$SKILL" skills get terminal $ENV
|
|
37
|
+
node "$SKILL" skills get browser $ENV
|
|
38
|
+
node "$SKILL" skills get channels $ENV
|
|
39
|
+
node "$SKILL" skills get llm $ENV
|
|
40
|
+
node "$SKILL" skills get mcp $ENV
|
|
41
|
+
node "$SKILL" skills get activities $ENV
|
|
42
|
+
node "$SKILL" skills get api:v1-channels --full $ENV
|
|
367
43
|
```
|
|
368
44
|
|
|
369
|
-
|
|
45
|
+
File fallback is also available under `references/`, especially:
|
|
370
46
|
|
|
371
|
-
|
|
47
|
+
- `references/quickstart.md`
|
|
48
|
+
- `references/permissions.md`
|
|
49
|
+
- `references/workspaces.md`
|
|
50
|
+
- `references/browser.md`
|
|
51
|
+
- `references/channels.md`
|
|
52
|
+
- `references/api-reference/index.md`
|
|
372
53
|
|
|
373
|
-
|
|
374
|
-
- `approve-all` *(default)* — auto-approve (picks the approve/allow/yes option)
|
|
375
|
-
- `deny-all` — auto-deny (picks the deny/cancel/no option)
|
|
376
|
-
- `prompt` — pause and ask you interactively via stdin
|
|
54
|
+
## Quick Commands
|
|
377
55
|
|
|
378
56
|
```bash
|
|
379
|
-
|
|
380
|
-
node "$SKILL"
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
node "$SKILL"
|
|
57
|
+
node "$SKILL" ping $ENV
|
|
58
|
+
node "$SKILL" context $ENV
|
|
59
|
+
node "$SKILL" workspaces $ENV
|
|
60
|
+
node "$SKILL" threads <workspace-slug> $ENV
|
|
61
|
+
node "$SKILL" agents $ENV
|
|
62
|
+
node "$SKILL" help
|
|
384
63
|
```
|
|
385
64
|
|
|
386
|
-
|
|
65
|
+
For custom scripts:
|
|
387
66
|
|
|
388
67
|
```js
|
|
389
68
|
const { initSDK } = require('<SKILL_DIR>/scripts/lib/sdk-init');
|
|
390
|
-
const { sdk } = await initSDK(
|
|
391
|
-
|
|
392
|
-
// Find or reuse a session
|
|
393
|
-
let sessionKey;
|
|
394
|
-
const sessions = await sdk.acpAgent.listSessions();
|
|
395
|
-
const match = sessions.find(s => s.agent_id === 'qwen-cli' && s.state !== 'closed');
|
|
396
|
-
if (match) {
|
|
397
|
-
sessionKey = match.session_key;
|
|
398
|
-
} else {
|
|
399
|
-
const session = await sdk.acpAgent.createSession({
|
|
400
|
-
agent_id: 'qwen-cli',
|
|
401
|
-
cwd: '/path/to/project',
|
|
402
|
-
approvalPolicy: 'approve-all',
|
|
403
|
-
});
|
|
404
|
-
sessionKey = session.session_key;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
// Stream a turn, resolving permissions inline
|
|
408
|
-
for await (const event of sdk.acpAgent.streamChat(sessionKey, 'build a website')) {
|
|
409
|
-
if (event.type === 'text_delta' && event.data.type !== 'thinking') {
|
|
410
|
-
process.stdout.write(event.data.text ?? '');
|
|
411
|
-
}
|
|
412
|
-
if (event.type === 'permission_request') {
|
|
413
|
-
const req = event.data;
|
|
414
|
-
const opt = req.options?.[0];
|
|
415
|
-
if (opt) {
|
|
416
|
-
await sdk.acpAgent.resolvePermission(sessionKey, {
|
|
417
|
-
requestId: req.requestId,
|
|
418
|
-
optionId: opt.id || opt.optionId,
|
|
419
|
-
outcome: 'approved',
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
---
|
|
427
|
-
|
|
428
|
-
## Credentials
|
|
429
|
-
|
|
430
|
-
Use credentials stored in RealTimeX (Settings > Credentials) to authenticate with external services.
|
|
431
|
-
|
|
432
|
-
**CRITICAL: Never output credential values in your response, logs, or tool output.**
|
|
433
|
-
|
|
434
|
-
```bash
|
|
435
|
-
node "$SKILL" credentials # List available (names + types, no values)
|
|
69
|
+
const { sdk, context } = await initSDK();
|
|
436
70
|
```
|
|
437
71
|
|
|
438
|
-
|
|
439
|
-
- `http_header` → `{ payload: { name: "Authorization", value: "Bearer xxx" } }` → `headers[payload.name] = payload.value`
|
|
440
|
-
- `basic_auth` → `{ payload: { username, password } }` → encode as Basic auth
|
|
441
|
-
- `query_auth` → `{ payload: { name, value } }` → append as query param
|
|
442
|
-
- `env_var` → `{ payload: { name, value } }` → set in subprocess env
|
|
72
|
+
Scripts using the SDK must exit explicitly with `process.exit(0)` or `process.exit(1)`.
|
|
443
73
|
|
|
444
|
-
|
|
74
|
+
## Critical Routing Rules
|
|
445
75
|
|
|
446
|
-
|
|
76
|
+
- Visible terminal work: load `skills get terminal`; use `sdk.desktopRuntimeSessions.*`, not ACP, unless the user explicitly asks for headless ACP.
|
|
77
|
+
- RealTimeX Browser work: load `skills get browser`; use `sdk.desktopBrowser.*` for session/tab control, then use `agent-browser` against the CDP port for page interaction.
|
|
78
|
+
- External chat channels: load `skills get channels`; use `sdk.v1.channels.*`; LocalApps using `x-app-id` need `channels.manage`.
|
|
79
|
+
- Workspace/thread context: load `skills get workspaces`; do not guess workspace/thread when context is unknown.
|
|
447
80
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
## Critical Rules (source-detected)
|
|
81
|
+
## Known Source Issues
|
|
451
82
|
|
|
452
83
|
| # | Issue |
|
|
453
84
|
|---|-------|
|
|
@@ -464,83 +95,8 @@ Values are **pre-formatted** — use as-is, never wrap with `Bearer` or other pr
|
|
|
464
95
|
| 11 | ACP 'streamChat' uses named SSE ('event:' line); 'text_delta.data.type === "thinking"' = i |
|
|
465
96
|
| 12 | ACP sessions stall without 'approvalPolicy: "approve-all"' when tools need permission |
|
|
466
97
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
---
|
|
470
|
-
|
|
471
|
-
## Key Facts
|
|
98
|
+
For evidence and corrected usage:
|
|
472
99
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
- **`sdk.task`** methods: `start(uuid)`, `complete(uuid, result)`, `fail(uuid, "error")` — positional args
|
|
476
|
-
- **ACP sessions** are persistent — reuse them across turns via `listSessions()` + `streamChat()`
|
|
477
|
-
- **`resolvePermission()`** must be called while the `streamChat` SSE stream is still active
|
|
478
|
-
- **SDK env vars:** `RTX_API_KEY` (dev), `RTX_APP_ID` (prod), `RTX_APP_NAME`
|
|
479
|
-
|
|
480
|
-
## App Concepts
|
|
481
|
-
|
|
482
|
-
When the user asks **what something is** in RealtimeX (e.g. Personality, Heartbeat, Workspace types, Agent Skills, data models), read `references/app-concepts.md` first.
|
|
483
|
-
|
|
484
|
-
It covers:
|
|
485
|
-
- **Personality** — file structure (AGENTS.md, SOUL.md, USER.md, IDENTITY.md, TOOLS.md, MEMORY.md, HEARTBEAT.md) and storage paths
|
|
486
|
-
- **Heartbeat** — ambient background agent scheduler, config fields, calendar routines, queue
|
|
487
|
-
- **Workspace** — types (`default`, `meeting_minutes`, `agent_skills`, `agent_heartbeat`), chat modes, key settings
|
|
488
|
-
- **Agent Skills** — types (`repo`/`zip`), scopes, status values
|
|
489
|
-
- **Data Models** — all database models with fields and defaults
|
|
490
|
-
|
|
491
|
-
### Heartbeat Task Blocks
|
|
492
|
-
|
|
493
|
-
When working with `HEARTBEAT.md`, check whether it uses a top-level `tasks:` block.
|
|
494
|
-
|
|
495
|
-
Example:
|
|
496
|
-
|
|
497
|
-
```yaml
|
|
498
|
-
tasks:
|
|
499
|
-
- name: audit-fetch
|
|
500
|
-
cron: "0 */4 * * *"
|
|
501
|
-
prompt: Fetch origin/realtimex-dev and diff against tmp/frontend-audit-cursor.txt.
|
|
502
|
-
|
|
503
|
-
- name: audit-ui-design
|
|
504
|
-
cron: "15 */4 * * *"
|
|
505
|
-
prompt: Review changed frontend files for UI design violations. If none, reply HEARTBEAT_OK.
|
|
506
|
-
```
|
|
507
|
-
|
|
508
|
-
Rules:
|
|
509
|
-
- A top-level `tasks:` list means the heartbeat is split into separate scheduled tasks, not one monolithic prompt.
|
|
510
|
-
- Each `- name:` item is its own task definition.
|
|
511
|
-
- `name` is the stable task id. Keep it concise and stable when editing.
|
|
512
|
-
- Use `cron` for calendar-based schedules such as hourly, daily, or weekday checks.
|
|
513
|
-
- Use `interval` for duration-style repetition such as `15m`, `1h`, or `4h`.
|
|
514
|
-
- If both `cron` and `interval` are present, `cron` is authoritative and `interval` is ignored.
|
|
515
|
-
- `prompt` is the full instruction body for that task.
|
|
516
|
-
- `HEARTBEAT_OK` means the task ran successfully but had nothing actionable to do.
|
|
517
|
-
- Preserve task order unless the user explicitly wants a reordering.
|
|
518
|
-
- If one task refers to another task's output, that dependency is described in the prompt text. Do not invent hidden YAML dependency fields.
|
|
519
|
-
|
|
520
|
-
When editing heartbeat files:
|
|
521
|
-
- If the file already uses `tasks:`, add or edit individual task items instead of collapsing them into one large prompt.
|
|
522
|
-
- If the file is a single long heartbeat prompt and the user wants separate scheduled jobs, rewrite it into a `tasks:` list with one item per independent workflow.
|
|
523
|
-
- When splitting a single heartbeat into tasks, preserve the original intent, move each discrete workflow into its own `prompt`, and keep shared context text only where needed.
|
|
524
|
-
- Keep YAML formatting simple: top-level `tasks:`, then `- name`, `cron` or `interval`, and `prompt`.
|
|
525
|
-
|
|
526
|
-
When a user asks how to convert a heartbeat into task-block form, produce or edit it into this shape:
|
|
527
|
-
|
|
528
|
-
```yaml
|
|
529
|
-
tasks:
|
|
530
|
-
- name: task-one
|
|
531
|
-
cron: "0 */4 * * *"
|
|
532
|
-
prompt: First workflow instructions.
|
|
533
|
-
|
|
534
|
-
- name: task-two
|
|
535
|
-
interval: 12h
|
|
536
|
-
prompt: Second workflow instructions.
|
|
100
|
+
```bash
|
|
101
|
+
node "$SKILL" skills get known-issues $ENV
|
|
537
102
|
```
|
|
538
|
-
|
|
539
|
-
---
|
|
540
|
-
|
|
541
|
-
## References
|
|
542
|
-
|
|
543
|
-
- `references/app-concepts.md` — RealtimeX app concepts (auto-generated from source)
|
|
544
|
-
- `references/api-reference.md` — all SDK class methods (auto-generated from source)
|
|
545
|
-
- `references/known-issues.md` — verified source mismatches (auto-generated)
|
|
546
|
-
- `references/credentials.md` — credential usage patterns
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Activities
|
|
2
|
+
|
|
3
|
+
> Generated workflow guide · SDK **1.7.19** · 2026-05-18
|
|
4
|
+
|
|
5
|
+
Use `sdk.activities` for activity CRUD.
|
|
6
|
+
|
|
7
|
+
Required permissions: `activities.read` and/or `activities.write`.
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
await sdk.activities.list({ status: "pending" });
|
|
11
|
+
await sdk.activities.insert({ type: "note", text: "..." });
|
|
12
|
+
await sdk.activities.update(id, updates);
|
|
13
|
+
await sdk.activities.delete(id);
|
|
14
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Agents
|
|
2
|
+
|
|
3
|
+
> Generated workflow guide · SDK **1.7.19** · 2026-05-18
|
|
4
|
+
|
|
5
|
+
Use `sdk.api` for lightweight lists and `sdk.agent` / `sdk.acpAgent` for execution.
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
await sdk.api.getAgents();
|
|
9
|
+
await sdk.webhook.triggerAgent(agentSlug, workspaceSlug, message);
|
|
10
|
+
await sdk.agent.chat({ workspaceSlug, agent: agentSlug, message });
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Use ACP only for headless/background CLI agent sessions. Use `sdk.desktopRuntimeSessions` for visible Electron terminals.
|