@realtimex/sdk 2.0.6 → 2.0.8
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-SFY6E7TY.mjs +132 -0
- package/dist/chunk-UPXEAZIT.mjs +41 -0
- package/dist/{chunk-DZUAP6FW.mjs → chunk-XKQRTTIC.mjs} +7 -38
- package/dist/cli/index.d.mts +54 -0
- package/dist/cli/index.d.ts +54 -0
- package/dist/cli/index.js +185 -0
- package/dist/cli/index.mjs +9 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +129 -0
- package/dist/index.mjs +16 -3
- package/dist/v1/index.mjs +8 -6
- package/package.json +12 -7
- package/skills/realtimex-moderator-sdk/SKILL.md +126 -27
- package/skills/realtimex-moderator-sdk/templates/AGENTS.template.md +49 -0
- package/skills/realtimex-moderator-sdk/templates/HEARTBEAT.template.md +61 -0
- package/skills/realtimex-moderator-sdk/build/stage/bin/realtimex-pp-cli +0 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AuthenticationError,
|
|
3
|
+
DeveloperApiError,
|
|
4
|
+
NotFoundError,
|
|
5
|
+
ServerError,
|
|
6
|
+
ValidationError
|
|
7
|
+
} from "./chunk-UPXEAZIT.mjs";
|
|
8
|
+
|
|
9
|
+
// src/cli/client.ts
|
|
10
|
+
var CliApiClient = class {
|
|
11
|
+
constructor(baseUrl, apiKey, appId) {
|
|
12
|
+
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
13
|
+
this.apiKey = apiKey;
|
|
14
|
+
this.appId = appId;
|
|
15
|
+
}
|
|
16
|
+
getHeaders(extra) {
|
|
17
|
+
const headers = {
|
|
18
|
+
"Content-Type": "application/json",
|
|
19
|
+
"Authorization": `Bearer ${this.apiKey}`
|
|
20
|
+
};
|
|
21
|
+
if (this.appId) headers["x-app-id"] = this.appId;
|
|
22
|
+
return { ...headers, ...extra };
|
|
23
|
+
}
|
|
24
|
+
async handleResponse(response) {
|
|
25
|
+
let data;
|
|
26
|
+
try {
|
|
27
|
+
data = await response.json();
|
|
28
|
+
} catch {
|
|
29
|
+
data = {};
|
|
30
|
+
}
|
|
31
|
+
if (response.ok) return data;
|
|
32
|
+
const message = data?.message || data?.error || response.statusText || "Request failed";
|
|
33
|
+
switch (response.status) {
|
|
34
|
+
case 400:
|
|
35
|
+
throw new ValidationError(message);
|
|
36
|
+
case 401:
|
|
37
|
+
case 403:
|
|
38
|
+
throw new AuthenticationError(message);
|
|
39
|
+
case 404:
|
|
40
|
+
throw new NotFoundError(message);
|
|
41
|
+
case 500:
|
|
42
|
+
case 502:
|
|
43
|
+
case 503:
|
|
44
|
+
throw new ServerError(message);
|
|
45
|
+
default:
|
|
46
|
+
throw new DeveloperApiError(response.status, "API_ERROR", message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async request(method, path, body) {
|
|
50
|
+
const url = `${this.baseUrl}/cli${path}`;
|
|
51
|
+
const response = await fetch(url, {
|
|
52
|
+
method,
|
|
53
|
+
headers: this.getHeaders(),
|
|
54
|
+
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
55
|
+
});
|
|
56
|
+
return this.handleResponse(response);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/cli/namespace.ts
|
|
61
|
+
var CliApiNamespace = class {
|
|
62
|
+
constructor(baseUrl, apiKey, appId) {
|
|
63
|
+
this._client = new CliApiClient(baseUrl, apiKey, appId);
|
|
64
|
+
}
|
|
65
|
+
async prepare() {
|
|
66
|
+
return this._client.request("GET", "/prepare");
|
|
67
|
+
}
|
|
68
|
+
async listWorkspaces() {
|
|
69
|
+
return this._client.request("GET", "/list-workspaces");
|
|
70
|
+
}
|
|
71
|
+
async createWorkspace(body) {
|
|
72
|
+
return this._client.request("POST", "/create-workspace", body);
|
|
73
|
+
}
|
|
74
|
+
async getWorkspace(workspaceSlug) {
|
|
75
|
+
return this._client.request("GET", `/get-workspace/${encodeURIComponent(workspaceSlug)}`);
|
|
76
|
+
}
|
|
77
|
+
async renameWorkspace(workspaceSlug, body) {
|
|
78
|
+
return this._client.request("POST", `/rename-workspace/${encodeURIComponent(workspaceSlug)}`, body);
|
|
79
|
+
}
|
|
80
|
+
async deleteWorkspace(workspaceSlug) {
|
|
81
|
+
return this._client.request("DELETE", `/delete-workspace/${encodeURIComponent(workspaceSlug)}`);
|
|
82
|
+
}
|
|
83
|
+
async setWorkspaceDefaultAgent(workspaceSlug, body) {
|
|
84
|
+
return this._client.request("POST", `/set-workspace-default-agent/${encodeURIComponent(workspaceSlug)}`, body);
|
|
85
|
+
}
|
|
86
|
+
async clearWorkspaceDefaultAgent(workspaceSlug) {
|
|
87
|
+
return this._client.request("DELETE", `/clear-workspace-default-agent/${encodeURIComponent(workspaceSlug)}`);
|
|
88
|
+
}
|
|
89
|
+
async listThreads(workspaceSlug) {
|
|
90
|
+
return this._client.request("GET", `/list-threads/${encodeURIComponent(workspaceSlug)}`);
|
|
91
|
+
}
|
|
92
|
+
async createThread(workspaceSlug, body) {
|
|
93
|
+
return this._client.request("POST", `/create-thread/${encodeURIComponent(workspaceSlug)}`, body);
|
|
94
|
+
}
|
|
95
|
+
async getThread(workspaceSlug, threadSlug) {
|
|
96
|
+
return this._client.request(
|
|
97
|
+
"GET",
|
|
98
|
+
`/get-thread/${encodeURIComponent(workspaceSlug)}/${encodeURIComponent(threadSlug)}`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
async renameThread(workspaceSlug, threadSlug, body) {
|
|
102
|
+
return this._client.request(
|
|
103
|
+
"POST",
|
|
104
|
+
`/rename-thread/${encodeURIComponent(workspaceSlug)}/${encodeURIComponent(threadSlug)}`,
|
|
105
|
+
body
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
async deleteThread(workspaceSlug, threadSlug) {
|
|
109
|
+
return this._client.request(
|
|
110
|
+
"DELETE",
|
|
111
|
+
`/delete-thread/${encodeURIComponent(workspaceSlug)}/${encodeURIComponent(threadSlug)}`
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
async sendLlmMessage(workspaceSlug, threadSlug, body) {
|
|
115
|
+
return this._client.request(
|
|
116
|
+
"POST",
|
|
117
|
+
`/send-llm-message/${encodeURIComponent(workspaceSlug)}/${encodeURIComponent(threadSlug)}`,
|
|
118
|
+
body
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
async listLlmProviders() {
|
|
122
|
+
return this._client.request("GET", "/list-llm-providers");
|
|
123
|
+
}
|
|
124
|
+
async listLlmModels(provider) {
|
|
125
|
+
return this._client.request("GET", `/list-llm-models/${encodeURIComponent(provider)}`);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export {
|
|
130
|
+
CliApiClient,
|
|
131
|
+
CliApiNamespace
|
|
132
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/v1/errors.ts
|
|
2
|
+
var DeveloperApiError = class extends Error {
|
|
3
|
+
constructor(status, code, message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.status = status;
|
|
6
|
+
this.code = code;
|
|
7
|
+
this.name = "DeveloperApiError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var AuthenticationError = class extends DeveloperApiError {
|
|
11
|
+
constructor(message = "Invalid or missing API key") {
|
|
12
|
+
super(403, "AUTHENTICATION_ERROR", message);
|
|
13
|
+
this.name = "AuthenticationError";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var NotFoundError = class extends DeveloperApiError {
|
|
17
|
+
constructor(message = "Resource not found") {
|
|
18
|
+
super(404, "NOT_FOUND", message);
|
|
19
|
+
this.name = "NotFoundError";
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var ValidationError = class extends DeveloperApiError {
|
|
23
|
+
constructor(message) {
|
|
24
|
+
super(400, "VALIDATION_ERROR", message);
|
|
25
|
+
this.name = "ValidationError";
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var ServerError = class extends DeveloperApiError {
|
|
29
|
+
constructor(message = "Internal server error") {
|
|
30
|
+
super(500, "SERVER_ERROR", message);
|
|
31
|
+
this.name = "ServerError";
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
DeveloperApiError,
|
|
37
|
+
AuthenticationError,
|
|
38
|
+
NotFoundError,
|
|
39
|
+
ValidationError,
|
|
40
|
+
ServerError
|
|
41
|
+
};
|
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var AuthenticationError = class extends DeveloperApiError {
|
|
11
|
-
constructor(message = "Invalid or missing API key") {
|
|
12
|
-
super(403, "AUTHENTICATION_ERROR", message);
|
|
13
|
-
this.name = "AuthenticationError";
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
var NotFoundError = class extends DeveloperApiError {
|
|
17
|
-
constructor(message = "Resource not found") {
|
|
18
|
-
super(404, "NOT_FOUND", message);
|
|
19
|
-
this.name = "NotFoundError";
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
var ValidationError = class extends DeveloperApiError {
|
|
23
|
-
constructor(message) {
|
|
24
|
-
super(400, "VALIDATION_ERROR", message);
|
|
25
|
-
this.name = "ValidationError";
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
var ServerError = class extends DeveloperApiError {
|
|
29
|
-
constructor(message = "Internal server error") {
|
|
30
|
-
super(500, "SERVER_ERROR", message);
|
|
31
|
-
this.name = "ServerError";
|
|
32
|
-
}
|
|
33
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
AuthenticationError,
|
|
3
|
+
DeveloperApiError,
|
|
4
|
+
NotFoundError,
|
|
5
|
+
ServerError,
|
|
6
|
+
ValidationError
|
|
7
|
+
} from "./chunk-UPXEAZIT.mjs";
|
|
34
8
|
|
|
35
9
|
// src/v1/client.ts
|
|
36
10
|
var DeveloperApiClient = class {
|
|
@@ -585,11 +559,6 @@ var V1ApiNamespace = class {
|
|
|
585
559
|
};
|
|
586
560
|
|
|
587
561
|
export {
|
|
588
|
-
DeveloperApiError,
|
|
589
|
-
AuthenticationError,
|
|
590
|
-
NotFoundError,
|
|
591
|
-
ValidationError,
|
|
592
|
-
ServerError,
|
|
593
562
|
DeveloperApiClient,
|
|
594
563
|
V1ChatModule,
|
|
595
564
|
V1WorkspaceModule,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
declare class CliApiClient {
|
|
2
|
+
private readonly baseUrl;
|
|
3
|
+
private readonly apiKey;
|
|
4
|
+
private readonly appId?;
|
|
5
|
+
constructor(baseUrl: string, apiKey: string, appId?: string);
|
|
6
|
+
private getHeaders;
|
|
7
|
+
private handleResponse;
|
|
8
|
+
request<T = unknown>(method: string, path: string, body?: unknown): Promise<T>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface NameRequest {
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
interface CreateThreadRequest {
|
|
15
|
+
name?: string;
|
|
16
|
+
}
|
|
17
|
+
interface WorkspaceDefaultAgentRequest {
|
|
18
|
+
canonical: string;
|
|
19
|
+
providerId?: string;
|
|
20
|
+
modelId?: string;
|
|
21
|
+
}
|
|
22
|
+
interface SendLlmMessageRequest {
|
|
23
|
+
message: string;
|
|
24
|
+
chatProvider: string;
|
|
25
|
+
chatModel: string;
|
|
26
|
+
attachments?: Record<string, unknown>[];
|
|
27
|
+
webSearchEnabled?: boolean;
|
|
28
|
+
thinkingEffort?: string;
|
|
29
|
+
chatTuningConfig?: Record<string, unknown>;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
declare class CliApiNamespace {
|
|
33
|
+
/** @internal Shared HTTP client used by all CLI API methods */
|
|
34
|
+
readonly _client: CliApiClient;
|
|
35
|
+
constructor(baseUrl: string, apiKey: string, appId?: string);
|
|
36
|
+
prepare(): Promise<unknown>;
|
|
37
|
+
listWorkspaces(): Promise<unknown>;
|
|
38
|
+
createWorkspace(body: NameRequest): Promise<unknown>;
|
|
39
|
+
getWorkspace(workspaceSlug: string): Promise<unknown>;
|
|
40
|
+
renameWorkspace(workspaceSlug: string, body: NameRequest): Promise<unknown>;
|
|
41
|
+
deleteWorkspace(workspaceSlug: string): Promise<unknown>;
|
|
42
|
+
setWorkspaceDefaultAgent(workspaceSlug: string, body: WorkspaceDefaultAgentRequest): Promise<unknown>;
|
|
43
|
+
clearWorkspaceDefaultAgent(workspaceSlug: string): Promise<unknown>;
|
|
44
|
+
listThreads(workspaceSlug: string): Promise<unknown>;
|
|
45
|
+
createThread(workspaceSlug: string, body?: CreateThreadRequest): Promise<unknown>;
|
|
46
|
+
getThread(workspaceSlug: string, threadSlug: string): Promise<unknown>;
|
|
47
|
+
renameThread(workspaceSlug: string, threadSlug: string, body: NameRequest): Promise<unknown>;
|
|
48
|
+
deleteThread(workspaceSlug: string, threadSlug: string): Promise<unknown>;
|
|
49
|
+
sendLlmMessage(workspaceSlug: string, threadSlug: string, body: SendLlmMessageRequest): Promise<unknown>;
|
|
50
|
+
listLlmProviders(): Promise<unknown>;
|
|
51
|
+
listLlmModels(provider: string): Promise<unknown>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { CliApiClient, CliApiNamespace, type CreateThreadRequest, type NameRequest, type SendLlmMessageRequest, type WorkspaceDefaultAgentRequest };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
declare class CliApiClient {
|
|
2
|
+
private readonly baseUrl;
|
|
3
|
+
private readonly apiKey;
|
|
4
|
+
private readonly appId?;
|
|
5
|
+
constructor(baseUrl: string, apiKey: string, appId?: string);
|
|
6
|
+
private getHeaders;
|
|
7
|
+
private handleResponse;
|
|
8
|
+
request<T = unknown>(method: string, path: string, body?: unknown): Promise<T>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface NameRequest {
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
interface CreateThreadRequest {
|
|
15
|
+
name?: string;
|
|
16
|
+
}
|
|
17
|
+
interface WorkspaceDefaultAgentRequest {
|
|
18
|
+
canonical: string;
|
|
19
|
+
providerId?: string;
|
|
20
|
+
modelId?: string;
|
|
21
|
+
}
|
|
22
|
+
interface SendLlmMessageRequest {
|
|
23
|
+
message: string;
|
|
24
|
+
chatProvider: string;
|
|
25
|
+
chatModel: string;
|
|
26
|
+
attachments?: Record<string, unknown>[];
|
|
27
|
+
webSearchEnabled?: boolean;
|
|
28
|
+
thinkingEffort?: string;
|
|
29
|
+
chatTuningConfig?: Record<string, unknown>;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
}
|
|
32
|
+
declare class CliApiNamespace {
|
|
33
|
+
/** @internal Shared HTTP client used by all CLI API methods */
|
|
34
|
+
readonly _client: CliApiClient;
|
|
35
|
+
constructor(baseUrl: string, apiKey: string, appId?: string);
|
|
36
|
+
prepare(): Promise<unknown>;
|
|
37
|
+
listWorkspaces(): Promise<unknown>;
|
|
38
|
+
createWorkspace(body: NameRequest): Promise<unknown>;
|
|
39
|
+
getWorkspace(workspaceSlug: string): Promise<unknown>;
|
|
40
|
+
renameWorkspace(workspaceSlug: string, body: NameRequest): Promise<unknown>;
|
|
41
|
+
deleteWorkspace(workspaceSlug: string): Promise<unknown>;
|
|
42
|
+
setWorkspaceDefaultAgent(workspaceSlug: string, body: WorkspaceDefaultAgentRequest): Promise<unknown>;
|
|
43
|
+
clearWorkspaceDefaultAgent(workspaceSlug: string): Promise<unknown>;
|
|
44
|
+
listThreads(workspaceSlug: string): Promise<unknown>;
|
|
45
|
+
createThread(workspaceSlug: string, body?: CreateThreadRequest): Promise<unknown>;
|
|
46
|
+
getThread(workspaceSlug: string, threadSlug: string): Promise<unknown>;
|
|
47
|
+
renameThread(workspaceSlug: string, threadSlug: string, body: NameRequest): Promise<unknown>;
|
|
48
|
+
deleteThread(workspaceSlug: string, threadSlug: string): Promise<unknown>;
|
|
49
|
+
sendLlmMessage(workspaceSlug: string, threadSlug: string, body: SendLlmMessageRequest): Promise<unknown>;
|
|
50
|
+
listLlmProviders(): Promise<unknown>;
|
|
51
|
+
listLlmModels(provider: string): Promise<unknown>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { CliApiClient, CliApiNamespace, type CreateThreadRequest, type NameRequest, type SendLlmMessageRequest, type WorkspaceDefaultAgentRequest };
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/cli/index.ts
|
|
21
|
+
var cli_exports = {};
|
|
22
|
+
__export(cli_exports, {
|
|
23
|
+
CliApiClient: () => CliApiClient,
|
|
24
|
+
CliApiNamespace: () => CliApiNamespace
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(cli_exports);
|
|
27
|
+
|
|
28
|
+
// src/v1/errors.ts
|
|
29
|
+
var DeveloperApiError = class extends Error {
|
|
30
|
+
constructor(status, code, message) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.status = status;
|
|
33
|
+
this.code = code;
|
|
34
|
+
this.name = "DeveloperApiError";
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var AuthenticationError = class extends DeveloperApiError {
|
|
38
|
+
constructor(message = "Invalid or missing API key") {
|
|
39
|
+
super(403, "AUTHENTICATION_ERROR", message);
|
|
40
|
+
this.name = "AuthenticationError";
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var NotFoundError = class extends DeveloperApiError {
|
|
44
|
+
constructor(message = "Resource not found") {
|
|
45
|
+
super(404, "NOT_FOUND", message);
|
|
46
|
+
this.name = "NotFoundError";
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var ValidationError = class extends DeveloperApiError {
|
|
50
|
+
constructor(message) {
|
|
51
|
+
super(400, "VALIDATION_ERROR", message);
|
|
52
|
+
this.name = "ValidationError";
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var ServerError = class extends DeveloperApiError {
|
|
56
|
+
constructor(message = "Internal server error") {
|
|
57
|
+
super(500, "SERVER_ERROR", message);
|
|
58
|
+
this.name = "ServerError";
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// src/cli/client.ts
|
|
63
|
+
var CliApiClient = class {
|
|
64
|
+
constructor(baseUrl, apiKey, appId) {
|
|
65
|
+
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
66
|
+
this.apiKey = apiKey;
|
|
67
|
+
this.appId = appId;
|
|
68
|
+
}
|
|
69
|
+
getHeaders(extra) {
|
|
70
|
+
const headers = {
|
|
71
|
+
"Content-Type": "application/json",
|
|
72
|
+
"Authorization": `Bearer ${this.apiKey}`
|
|
73
|
+
};
|
|
74
|
+
if (this.appId) headers["x-app-id"] = this.appId;
|
|
75
|
+
return { ...headers, ...extra };
|
|
76
|
+
}
|
|
77
|
+
async handleResponse(response) {
|
|
78
|
+
let data;
|
|
79
|
+
try {
|
|
80
|
+
data = await response.json();
|
|
81
|
+
} catch {
|
|
82
|
+
data = {};
|
|
83
|
+
}
|
|
84
|
+
if (response.ok) return data;
|
|
85
|
+
const message = data?.message || data?.error || response.statusText || "Request failed";
|
|
86
|
+
switch (response.status) {
|
|
87
|
+
case 400:
|
|
88
|
+
throw new ValidationError(message);
|
|
89
|
+
case 401:
|
|
90
|
+
case 403:
|
|
91
|
+
throw new AuthenticationError(message);
|
|
92
|
+
case 404:
|
|
93
|
+
throw new NotFoundError(message);
|
|
94
|
+
case 500:
|
|
95
|
+
case 502:
|
|
96
|
+
case 503:
|
|
97
|
+
throw new ServerError(message);
|
|
98
|
+
default:
|
|
99
|
+
throw new DeveloperApiError(response.status, "API_ERROR", message);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
async request(method, path, body) {
|
|
103
|
+
const url = `${this.baseUrl}/cli${path}`;
|
|
104
|
+
const response = await fetch(url, {
|
|
105
|
+
method,
|
|
106
|
+
headers: this.getHeaders(),
|
|
107
|
+
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
108
|
+
});
|
|
109
|
+
return this.handleResponse(response);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// src/cli/namespace.ts
|
|
114
|
+
var CliApiNamespace = class {
|
|
115
|
+
constructor(baseUrl, apiKey, appId) {
|
|
116
|
+
this._client = new CliApiClient(baseUrl, apiKey, appId);
|
|
117
|
+
}
|
|
118
|
+
async prepare() {
|
|
119
|
+
return this._client.request("GET", "/prepare");
|
|
120
|
+
}
|
|
121
|
+
async listWorkspaces() {
|
|
122
|
+
return this._client.request("GET", "/list-workspaces");
|
|
123
|
+
}
|
|
124
|
+
async createWorkspace(body) {
|
|
125
|
+
return this._client.request("POST", "/create-workspace", body);
|
|
126
|
+
}
|
|
127
|
+
async getWorkspace(workspaceSlug) {
|
|
128
|
+
return this._client.request("GET", `/get-workspace/${encodeURIComponent(workspaceSlug)}`);
|
|
129
|
+
}
|
|
130
|
+
async renameWorkspace(workspaceSlug, body) {
|
|
131
|
+
return this._client.request("POST", `/rename-workspace/${encodeURIComponent(workspaceSlug)}`, body);
|
|
132
|
+
}
|
|
133
|
+
async deleteWorkspace(workspaceSlug) {
|
|
134
|
+
return this._client.request("DELETE", `/delete-workspace/${encodeURIComponent(workspaceSlug)}`);
|
|
135
|
+
}
|
|
136
|
+
async setWorkspaceDefaultAgent(workspaceSlug, body) {
|
|
137
|
+
return this._client.request("POST", `/set-workspace-default-agent/${encodeURIComponent(workspaceSlug)}`, body);
|
|
138
|
+
}
|
|
139
|
+
async clearWorkspaceDefaultAgent(workspaceSlug) {
|
|
140
|
+
return this._client.request("DELETE", `/clear-workspace-default-agent/${encodeURIComponent(workspaceSlug)}`);
|
|
141
|
+
}
|
|
142
|
+
async listThreads(workspaceSlug) {
|
|
143
|
+
return this._client.request("GET", `/list-threads/${encodeURIComponent(workspaceSlug)}`);
|
|
144
|
+
}
|
|
145
|
+
async createThread(workspaceSlug, body) {
|
|
146
|
+
return this._client.request("POST", `/create-thread/${encodeURIComponent(workspaceSlug)}`, body);
|
|
147
|
+
}
|
|
148
|
+
async getThread(workspaceSlug, threadSlug) {
|
|
149
|
+
return this._client.request(
|
|
150
|
+
"GET",
|
|
151
|
+
`/get-thread/${encodeURIComponent(workspaceSlug)}/${encodeURIComponent(threadSlug)}`
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
async renameThread(workspaceSlug, threadSlug, body) {
|
|
155
|
+
return this._client.request(
|
|
156
|
+
"POST",
|
|
157
|
+
`/rename-thread/${encodeURIComponent(workspaceSlug)}/${encodeURIComponent(threadSlug)}`,
|
|
158
|
+
body
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
async deleteThread(workspaceSlug, threadSlug) {
|
|
162
|
+
return this._client.request(
|
|
163
|
+
"DELETE",
|
|
164
|
+
`/delete-thread/${encodeURIComponent(workspaceSlug)}/${encodeURIComponent(threadSlug)}`
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
async sendLlmMessage(workspaceSlug, threadSlug, body) {
|
|
168
|
+
return this._client.request(
|
|
169
|
+
"POST",
|
|
170
|
+
`/send-llm-message/${encodeURIComponent(workspaceSlug)}/${encodeURIComponent(threadSlug)}`,
|
|
171
|
+
body
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
async listLlmProviders() {
|
|
175
|
+
return this._client.request("GET", "/list-llm-providers");
|
|
176
|
+
}
|
|
177
|
+
async listLlmModels(provider) {
|
|
178
|
+
return this._client.request("GET", `/list-llm-models/${encodeURIComponent(provider)}`);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
182
|
+
0 && (module.exports = {
|
|
183
|
+
CliApiClient,
|
|
184
|
+
CliApiNamespace
|
|
185
|
+
});
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { V as V1ApiNamespace } from './errors-DwEt8WYf.mjs';
|
|
2
2
|
export { A as AuthenticationError, D as DeveloperApiClient, a as DeveloperApiError, N as NotFoundError, S as ServerError, b as ValidationError } from './errors-DwEt8WYf.mjs';
|
|
3
|
+
import { CliApiNamespace } from './cli/index.mjs';
|
|
4
|
+
export { CliApiClient } from './cli/index.mjs';
|
|
3
5
|
|
|
4
6
|
interface SDKConfig {
|
|
5
7
|
realtimex?: {
|
|
@@ -21,9 +23,10 @@ declare class RealtimeXSDK {
|
|
|
21
23
|
readonly apiKey: string | undefined;
|
|
22
24
|
readonly realtimexUrl: string;
|
|
23
25
|
readonly v1: V1ApiNamespace;
|
|
26
|
+
readonly cli: CliApiNamespace;
|
|
24
27
|
private static DEFAULT_REALTIMEX_URL;
|
|
25
28
|
constructor(config?: SDKConfig);
|
|
26
29
|
private getEnvVar;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
export { RealtimeXSDK, type SDKConfig, V1ApiNamespace };
|
|
32
|
+
export { CliApiNamespace, RealtimeXSDK, type SDKConfig, V1ApiNamespace };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { V as V1ApiNamespace } from './errors-DwEt8WYf.js';
|
|
2
2
|
export { A as AuthenticationError, D as DeveloperApiClient, a as DeveloperApiError, N as NotFoundError, S as ServerError, b as ValidationError } from './errors-DwEt8WYf.js';
|
|
3
|
+
import { CliApiNamespace } from './cli/index.js';
|
|
4
|
+
export { CliApiClient } from './cli/index.js';
|
|
3
5
|
|
|
4
6
|
interface SDKConfig {
|
|
5
7
|
realtimex?: {
|
|
@@ -21,9 +23,10 @@ declare class RealtimeXSDK {
|
|
|
21
23
|
readonly apiKey: string | undefined;
|
|
22
24
|
readonly realtimexUrl: string;
|
|
23
25
|
readonly v1: V1ApiNamespace;
|
|
26
|
+
readonly cli: CliApiNamespace;
|
|
24
27
|
private static DEFAULT_REALTIMEX_URL;
|
|
25
28
|
constructor(config?: SDKConfig);
|
|
26
29
|
private getEnvVar;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
export { RealtimeXSDK, type SDKConfig, V1ApiNamespace };
|
|
32
|
+
export { CliApiNamespace, RealtimeXSDK, type SDKConfig, V1ApiNamespace };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
AuthenticationError: () => AuthenticationError,
|
|
24
|
+
CliApiClient: () => CliApiClient,
|
|
25
|
+
CliApiNamespace: () => CliApiNamespace,
|
|
24
26
|
DeveloperApiClient: () => DeveloperApiClient,
|
|
25
27
|
DeveloperApiError: () => DeveloperApiError,
|
|
26
28
|
NotFoundError: () => NotFoundError,
|
|
@@ -617,6 +619,126 @@ var V1ApiNamespace = class {
|
|
|
617
619
|
}
|
|
618
620
|
};
|
|
619
621
|
|
|
622
|
+
// src/cli/client.ts
|
|
623
|
+
var CliApiClient = class {
|
|
624
|
+
constructor(baseUrl, apiKey, appId) {
|
|
625
|
+
this.baseUrl = baseUrl.replace(/\/$/, "");
|
|
626
|
+
this.apiKey = apiKey;
|
|
627
|
+
this.appId = appId;
|
|
628
|
+
}
|
|
629
|
+
getHeaders(extra) {
|
|
630
|
+
const headers = {
|
|
631
|
+
"Content-Type": "application/json",
|
|
632
|
+
"Authorization": `Bearer ${this.apiKey}`
|
|
633
|
+
};
|
|
634
|
+
if (this.appId) headers["x-app-id"] = this.appId;
|
|
635
|
+
return { ...headers, ...extra };
|
|
636
|
+
}
|
|
637
|
+
async handleResponse(response) {
|
|
638
|
+
let data;
|
|
639
|
+
try {
|
|
640
|
+
data = await response.json();
|
|
641
|
+
} catch {
|
|
642
|
+
data = {};
|
|
643
|
+
}
|
|
644
|
+
if (response.ok) return data;
|
|
645
|
+
const message = data?.message || data?.error || response.statusText || "Request failed";
|
|
646
|
+
switch (response.status) {
|
|
647
|
+
case 400:
|
|
648
|
+
throw new ValidationError(message);
|
|
649
|
+
case 401:
|
|
650
|
+
case 403:
|
|
651
|
+
throw new AuthenticationError(message);
|
|
652
|
+
case 404:
|
|
653
|
+
throw new NotFoundError(message);
|
|
654
|
+
case 500:
|
|
655
|
+
case 502:
|
|
656
|
+
case 503:
|
|
657
|
+
throw new ServerError(message);
|
|
658
|
+
default:
|
|
659
|
+
throw new DeveloperApiError(response.status, "API_ERROR", message);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
async request(method, path, body) {
|
|
663
|
+
const url = `${this.baseUrl}/cli${path}`;
|
|
664
|
+
const response = await fetch(url, {
|
|
665
|
+
method,
|
|
666
|
+
headers: this.getHeaders(),
|
|
667
|
+
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
668
|
+
});
|
|
669
|
+
return this.handleResponse(response);
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
// src/cli/namespace.ts
|
|
674
|
+
var CliApiNamespace = class {
|
|
675
|
+
constructor(baseUrl, apiKey, appId) {
|
|
676
|
+
this._client = new CliApiClient(baseUrl, apiKey, appId);
|
|
677
|
+
}
|
|
678
|
+
async prepare() {
|
|
679
|
+
return this._client.request("GET", "/prepare");
|
|
680
|
+
}
|
|
681
|
+
async listWorkspaces() {
|
|
682
|
+
return this._client.request("GET", "/list-workspaces");
|
|
683
|
+
}
|
|
684
|
+
async createWorkspace(body) {
|
|
685
|
+
return this._client.request("POST", "/create-workspace", body);
|
|
686
|
+
}
|
|
687
|
+
async getWorkspace(workspaceSlug) {
|
|
688
|
+
return this._client.request("GET", `/get-workspace/${encodeURIComponent(workspaceSlug)}`);
|
|
689
|
+
}
|
|
690
|
+
async renameWorkspace(workspaceSlug, body) {
|
|
691
|
+
return this._client.request("POST", `/rename-workspace/${encodeURIComponent(workspaceSlug)}`, body);
|
|
692
|
+
}
|
|
693
|
+
async deleteWorkspace(workspaceSlug) {
|
|
694
|
+
return this._client.request("DELETE", `/delete-workspace/${encodeURIComponent(workspaceSlug)}`);
|
|
695
|
+
}
|
|
696
|
+
async setWorkspaceDefaultAgent(workspaceSlug, body) {
|
|
697
|
+
return this._client.request("POST", `/set-workspace-default-agent/${encodeURIComponent(workspaceSlug)}`, body);
|
|
698
|
+
}
|
|
699
|
+
async clearWorkspaceDefaultAgent(workspaceSlug) {
|
|
700
|
+
return this._client.request("DELETE", `/clear-workspace-default-agent/${encodeURIComponent(workspaceSlug)}`);
|
|
701
|
+
}
|
|
702
|
+
async listThreads(workspaceSlug) {
|
|
703
|
+
return this._client.request("GET", `/list-threads/${encodeURIComponent(workspaceSlug)}`);
|
|
704
|
+
}
|
|
705
|
+
async createThread(workspaceSlug, body) {
|
|
706
|
+
return this._client.request("POST", `/create-thread/${encodeURIComponent(workspaceSlug)}`, body);
|
|
707
|
+
}
|
|
708
|
+
async getThread(workspaceSlug, threadSlug) {
|
|
709
|
+
return this._client.request(
|
|
710
|
+
"GET",
|
|
711
|
+
`/get-thread/${encodeURIComponent(workspaceSlug)}/${encodeURIComponent(threadSlug)}`
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
async renameThread(workspaceSlug, threadSlug, body) {
|
|
715
|
+
return this._client.request(
|
|
716
|
+
"POST",
|
|
717
|
+
`/rename-thread/${encodeURIComponent(workspaceSlug)}/${encodeURIComponent(threadSlug)}`,
|
|
718
|
+
body
|
|
719
|
+
);
|
|
720
|
+
}
|
|
721
|
+
async deleteThread(workspaceSlug, threadSlug) {
|
|
722
|
+
return this._client.request(
|
|
723
|
+
"DELETE",
|
|
724
|
+
`/delete-thread/${encodeURIComponent(workspaceSlug)}/${encodeURIComponent(threadSlug)}`
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
async sendLlmMessage(workspaceSlug, threadSlug, body) {
|
|
728
|
+
return this._client.request(
|
|
729
|
+
"POST",
|
|
730
|
+
`/send-llm-message/${encodeURIComponent(workspaceSlug)}/${encodeURIComponent(threadSlug)}`,
|
|
731
|
+
body
|
|
732
|
+
);
|
|
733
|
+
}
|
|
734
|
+
async listLlmProviders() {
|
|
735
|
+
return this._client.request("GET", "/list-llm-providers");
|
|
736
|
+
}
|
|
737
|
+
async listLlmModels(provider) {
|
|
738
|
+
return this._client.request("GET", `/list-llm-models/${encodeURIComponent(provider)}`);
|
|
739
|
+
}
|
|
740
|
+
};
|
|
741
|
+
|
|
620
742
|
// src/index.ts
|
|
621
743
|
var _RealtimeXSDK = class _RealtimeXSDK {
|
|
622
744
|
constructor(config = {}) {
|
|
@@ -630,6 +752,11 @@ var _RealtimeXSDK = class _RealtimeXSDK {
|
|
|
630
752
|
this.apiKey ?? "",
|
|
631
753
|
this.appId || void 0
|
|
632
754
|
);
|
|
755
|
+
this.cli = new CliApiNamespace(
|
|
756
|
+
this.realtimexUrl,
|
|
757
|
+
this.apiKey ?? "",
|
|
758
|
+
this.appId || void 0
|
|
759
|
+
);
|
|
633
760
|
}
|
|
634
761
|
getEnvVar(name) {
|
|
635
762
|
if (typeof process !== "undefined" && process.env) {
|
|
@@ -646,6 +773,8 @@ var RealtimeXSDK = _RealtimeXSDK;
|
|
|
646
773
|
// Annotate the CommonJS export names for ESM import in node:
|
|
647
774
|
0 && (module.exports = {
|
|
648
775
|
AuthenticationError,
|
|
776
|
+
CliApiClient,
|
|
777
|
+
CliApiNamespace,
|
|
649
778
|
DeveloperApiClient,
|
|
650
779
|
DeveloperApiError,
|
|
651
780
|
NotFoundError,
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
CliApiClient,
|
|
3
|
+
CliApiNamespace
|
|
4
|
+
} from "./chunk-SFY6E7TY.mjs";
|
|
5
|
+
import {
|
|
3
6
|
DeveloperApiClient,
|
|
7
|
+
V1ApiNamespace
|
|
8
|
+
} from "./chunk-XKQRTTIC.mjs";
|
|
9
|
+
import {
|
|
10
|
+
AuthenticationError,
|
|
4
11
|
DeveloperApiError,
|
|
5
12
|
NotFoundError,
|
|
6
13
|
ServerError,
|
|
7
|
-
V1ApiNamespace,
|
|
8
14
|
ValidationError
|
|
9
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-UPXEAZIT.mjs";
|
|
10
16
|
|
|
11
17
|
// src/index.ts
|
|
12
18
|
var _RealtimeXSDK = class _RealtimeXSDK {
|
|
@@ -21,6 +27,11 @@ var _RealtimeXSDK = class _RealtimeXSDK {
|
|
|
21
27
|
this.apiKey ?? "",
|
|
22
28
|
this.appId || void 0
|
|
23
29
|
);
|
|
30
|
+
this.cli = new CliApiNamespace(
|
|
31
|
+
this.realtimexUrl,
|
|
32
|
+
this.apiKey ?? "",
|
|
33
|
+
this.appId || void 0
|
|
34
|
+
);
|
|
24
35
|
}
|
|
25
36
|
getEnvVar(name) {
|
|
26
37
|
if (typeof process !== "undefined" && process.env) {
|
|
@@ -36,6 +47,8 @@ _RealtimeXSDK.DEFAULT_REALTIMEX_URL = "http://localhost:3001";
|
|
|
36
47
|
var RealtimeXSDK = _RealtimeXSDK;
|
|
37
48
|
export {
|
|
38
49
|
AuthenticationError,
|
|
50
|
+
CliApiClient,
|
|
51
|
+
CliApiNamespace,
|
|
39
52
|
DeveloperApiClient,
|
|
40
53
|
DeveloperApiError,
|
|
41
54
|
NotFoundError,
|
package/dist/v1/index.mjs
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AuthenticationError,
|
|
3
2
|
DeveloperApiClient,
|
|
4
|
-
DeveloperApiError,
|
|
5
|
-
NotFoundError,
|
|
6
|
-
ServerError,
|
|
7
3
|
V1ApiNamespace,
|
|
8
4
|
V1ChatModule,
|
|
9
5
|
V1ThreadModule,
|
|
10
|
-
V1WorkspaceModule
|
|
6
|
+
V1WorkspaceModule
|
|
7
|
+
} from "../chunk-XKQRTTIC.mjs";
|
|
8
|
+
import {
|
|
9
|
+
AuthenticationError,
|
|
10
|
+
DeveloperApiError,
|
|
11
|
+
NotFoundError,
|
|
12
|
+
ServerError,
|
|
11
13
|
ValidationError
|
|
12
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-UPXEAZIT.mjs";
|
|
13
15
|
|
|
14
16
|
// src/v1/overrides/v1WorkspaceStreaming.ts
|
|
15
17
|
async function* streamWorkspaceChat(client, slug, body) {
|
package/package.json
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@realtimex/sdk",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "SDK for building Local Apps that integrate with RealtimeX",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
10
11
|
"import": "./dist/index.mjs",
|
|
11
|
-
"require": "./dist/index.js"
|
|
12
|
-
"types": "./dist/index.d.ts"
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"./v1": {
|
|
15
|
+
"types": "./dist/v1/index.d.ts",
|
|
15
16
|
"import": "./dist/v1/index.mjs",
|
|
16
|
-
"require": "./dist/v1/index.js"
|
|
17
|
-
|
|
17
|
+
"require": "./dist/v1/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./cli": {
|
|
20
|
+
"types": "./dist/cli/index.d.ts",
|
|
21
|
+
"import": "./dist/cli/index.mjs",
|
|
22
|
+
"require": "./dist/cli/index.js"
|
|
18
23
|
}
|
|
19
24
|
},
|
|
20
25
|
"scripts": {
|
|
21
|
-
"build": "node ../scripts/generate-v1-sdk.mjs --force && tsup src/index.ts src/v1/index.ts --format cjs,esm --dts --clean",
|
|
22
|
-
"dev": "tsup src/index.ts src/v1/index.ts --format cjs,esm --dts --watch",
|
|
26
|
+
"build": "node ../scripts/generate-v1-sdk.mjs --force && tsup src/index.ts src/v1/index.ts src/cli/index.ts --format cjs,esm --dts --clean",
|
|
27
|
+
"dev": "tsup src/index.ts src/v1/index.ts src/cli/index.ts --format cjs,esm --dts --watch",
|
|
23
28
|
"test": "vitest run --passWithNoTests",
|
|
24
29
|
"sdk:generate": "node ../scripts/generate-v1-sdk.mjs",
|
|
25
30
|
"sdk:generate:force": "node ../scripts/generate-v1-sdk.mjs --force",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: realtimex-moderator-sdk
|
|
3
|
-
description: "Use the RealTimeX API through the generated CLI for workspace, thread, and
|
|
3
|
+
description: "Use the RealTimeX API through the generated CLI for workspace, thread, channel (Telegram, Zalo, Discord), send messages, setup personality, and heartbeat operations."
|
|
4
4
|
author: ""
|
|
5
5
|
license: "Apache-2.0"
|
|
6
6
|
argument-hint: "<command> [args] | install cli"
|
|
@@ -20,22 +20,36 @@ This skill drives the `realtimex-pp-cli` binary. Verify the CLI is installed and
|
|
|
20
20
|
|
|
21
21
|
1. Install or reinstall the pinned version via npm:
|
|
22
22
|
```bash
|
|
23
|
-
npm install -g @realtimex/pp-cli@2.0.
|
|
23
|
+
npm install -g @realtimex/pp-cli@2.0.8
|
|
24
24
|
```
|
|
25
25
|
2. Verify the exact version:
|
|
26
26
|
```bash
|
|
27
27
|
realtimex-pp-cli --version
|
|
28
28
|
```
|
|
29
|
-
The output must be `realtimex-pp-cli 2.0.
|
|
29
|
+
The output must be `realtimex-pp-cli 2.0.8`.
|
|
30
30
|
|
|
31
|
-
If `--version` reports "command not found" after install, the npm global bin directory is not on `$PATH`. If it reports any version other than `2.0.
|
|
31
|
+
If `--version` reports "command not found" after install, the npm global bin directory is not on `$PATH`. If it reports any version other than `2.0.8`, reinstall with the pinned npm command above. Do not proceed with skill commands until exact-version verification succeeds.
|
|
32
|
+
|
|
33
|
+
* Always run first:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
realtimex-pp-cli prepare --workspace-slug "$RTX_WORKSPACE_SLUG" --thread-slug "$RTX_THREAD_SLUG" --agent
|
|
37
|
+
```
|
|
32
38
|
|
|
33
39
|
## Command Reference
|
|
34
40
|
|
|
41
|
+
**approve-channel-pairing-code** — Manage approve channel pairing code
|
|
42
|
+
|
|
43
|
+
- `realtimex-pp-cli approve-channel-pairing-code <code>` — Approve one pending channel pairing code by visible 6-digit code or database id.
|
|
44
|
+
|
|
35
45
|
**clear-workspace-default-agent** — Manage clear workspace default agent
|
|
36
46
|
|
|
37
47
|
- `realtimex-pp-cli clear-workspace-default-agent <workspaceSlug>` — Clear the default CLI agent from a workspace.
|
|
38
48
|
|
|
49
|
+
**create-channel** — Manage create channel
|
|
50
|
+
|
|
51
|
+
- `realtimex-pp-cli create-channel <workspaceSlug>` — Create a chat channel in one exact workspace. Defaults to Telegram when plugin_type, channelType, and type are omitted.
|
|
52
|
+
|
|
39
53
|
**create-thread** — Manage create thread
|
|
40
54
|
|
|
41
55
|
- `realtimex-pp-cli create-thread <workspaceSlug>` — Create a thread in one workspace. The name is optional but recommended.
|
|
@@ -44,6 +58,10 @@ If `--version` reports "command not found" after install, the npm global bin dir
|
|
|
44
58
|
|
|
45
59
|
- `realtimex-pp-cli create-workspace` — Create a workspace. Requires a human-readable workspace name.
|
|
46
60
|
|
|
61
|
+
**delete-channel** — Manage delete channel
|
|
62
|
+
|
|
63
|
+
- `realtimex-pp-cli delete-channel <channelId>` — Delete one chat channel by exact channel id.
|
|
64
|
+
|
|
47
65
|
**delete-thread** — Manage delete thread
|
|
48
66
|
|
|
49
67
|
- `realtimex-pp-cli delete-thread <workspaceSlug> <threadSlug>` — Delete one thread by exact workspace slug and exact thread slug.
|
|
@@ -52,6 +70,22 @@ If `--version` reports "command not found" after install, the npm global bin dir
|
|
|
52
70
|
|
|
53
71
|
- `realtimex-pp-cli delete-workspace <workspaceSlug>` — Delete one workspace by exact workspace slug.
|
|
54
72
|
|
|
73
|
+
**disable-plugin** — Manage disable plugin
|
|
74
|
+
|
|
75
|
+
- `realtimex-pp-cli disable-plugin <pluginId>` — Disable one installed plugin globally and unload it from runtime.
|
|
76
|
+
|
|
77
|
+
**disable-workspace-agent-skill** — Manage disable workspace agent skill
|
|
78
|
+
|
|
79
|
+
- `realtimex-pp-cli disable-workspace-agent-skill <workspaceSlug> <skillId>` — Disable one agent skill in a workspace. Use a skill id, name, or displayName from list-workspace-agent-skills.
|
|
80
|
+
|
|
81
|
+
**enable-plugin** — Manage enable plugin
|
|
82
|
+
|
|
83
|
+
- `realtimex-pp-cli enable-plugin <pluginId>` — Enable one installed plugin globally and load it into runtime. Use a plugin id, name, or displayName from list-plugins.
|
|
84
|
+
|
|
85
|
+
**enable-workspace-agent-skill** — Manage enable workspace agent skill
|
|
86
|
+
|
|
87
|
+
- `realtimex-pp-cli enable-workspace-agent-skill <workspaceSlug> <skillId>` — Enable one agent skill in a workspace. Use a skill id, name, or displayName from list-workspace-agent-skills.
|
|
88
|
+
|
|
55
89
|
**get-thread** — Manage get thread
|
|
56
90
|
|
|
57
91
|
- `realtimex-pp-cli get-thread <workspaceSlug> <threadSlug>` — Get one thread by exact workspace slug and exact thread slug.
|
|
@@ -60,25 +94,45 @@ If `--version` reports "command not found" after install, the npm global bin dir
|
|
|
60
94
|
|
|
61
95
|
- `realtimex-pp-cli get-workspace <workspaceSlug>` — Get one workspace by exact workspace slug.
|
|
62
96
|
|
|
97
|
+
**list-agent-skills** — Manage list agent skills
|
|
98
|
+
|
|
99
|
+
- `realtimex-pp-cli list-agent-skills` — List published agent skills. Use list-workspace-agent-skills to see enabled/disabled state for one workspace.
|
|
100
|
+
|
|
101
|
+
**list-channels** — Manage list channels
|
|
102
|
+
|
|
103
|
+
- `realtimex-pp-cli list-channels` — List configured chat channels. Use returned channel ids with update-channel.
|
|
104
|
+
|
|
63
105
|
**list-llm-models** — Manage list llm models
|
|
64
106
|
|
|
65
|
-
- `realtimex-pp-cli list-llm-models <provider>` — List models for one provider id.
|
|
107
|
+
- `realtimex-pp-cli list-llm-models <provider>` — List models for one provider id.
|
|
66
108
|
|
|
67
109
|
**list-llm-providers** — Manage list llm providers
|
|
68
110
|
|
|
69
|
-
- `realtimex-pp-cli list-llm-providers` — List supported LLM providers. Use provider ids from this response
|
|
111
|
+
- `realtimex-pp-cli list-llm-providers` — List supported LLM providers. Use provider ids from this response when configuring workspace or thread LLM settings.
|
|
112
|
+
|
|
113
|
+
**list-plugins** — Manage list plugins
|
|
114
|
+
|
|
115
|
+
- `realtimex-pp-cli list-plugins` — List installed plugins with enabled state and runtime load status.
|
|
70
116
|
|
|
71
117
|
**list-threads** — Manage list threads
|
|
72
118
|
|
|
73
119
|
- `realtimex-pp-cli list-threads <workspaceSlug>` — List threads for one exact workspace slug.
|
|
74
120
|
|
|
121
|
+
**list-workspace-agent-skills** — Manage list workspace agent skills
|
|
122
|
+
|
|
123
|
+
- `realtimex-pp-cli list-workspace-agent-skills <workspaceSlug>` — List published agent skills with enabled/disabled state for one exact workspace slug.
|
|
124
|
+
|
|
75
125
|
**list-workspaces** — Manage list workspaces
|
|
76
126
|
|
|
77
127
|
- `realtimex-pp-cli list-workspaces` — List all workspaces visible to the current API caller. Use this before choosing a workspace slug.
|
|
78
128
|
|
|
79
129
|
**prepare** — Manage prepare
|
|
80
130
|
|
|
81
|
-
- `realtimex-pp-cli prepare` — Return compact workspace, thread,
|
|
131
|
+
- `realtimex-pp-cli prepare` — Return compact workspace, thread, current workspace/thread from explicit workspaceSlug and threadSlug query parameters
|
|
132
|
+
|
|
133
|
+
**reload-plugin** — Manage reload plugin
|
|
134
|
+
|
|
135
|
+
- `realtimex-pp-cli reload-plugin <pluginId>` — Reload one enabled plugin in runtime. Disabled plugins must be enabled before reload.
|
|
82
136
|
|
|
83
137
|
**rename-thread** — Manage rename thread
|
|
84
138
|
|
|
@@ -88,14 +142,58 @@ If `--version` reports "command not found" after install, the npm global bin dir
|
|
|
88
142
|
|
|
89
143
|
- `realtimex-pp-cli rename-workspace <workspaceSlug>` — Rename one workspace by exact workspace slug. Only the name is changed.
|
|
90
144
|
|
|
91
|
-
**send-
|
|
145
|
+
**send-message** — Manage send message
|
|
146
|
+
|
|
147
|
+
- `realtimex-pp-cli send-message <workspaceSlug> <threadSlug>` — Send one message to an exact thread using the same routing as channel replies.
|
|
148
|
+
|
|
149
|
+
**set-heartbeat-active-hours** — Manage set heartbeat active hours
|
|
150
|
+
|
|
151
|
+
- `realtimex-pp-cli set-heartbeat-active-hours` — Set workspace or global ambient-agent active hours using HH:mm start and end values.
|
|
152
|
+
|
|
153
|
+
**set-heartbeat-auto-pilot** — Manage set heartbeat auto pilot
|
|
154
|
+
|
|
155
|
+
- `realtimex-pp-cli set-heartbeat-auto-pilot` — Turn workspace or global ambient-agent heartbeat auto pilot on or off.
|
|
156
|
+
|
|
157
|
+
**set-heartbeat-default-agent** — Manage set heartbeat default agent
|
|
158
|
+
|
|
159
|
+
- `realtimex-pp-cli set-heartbeat-default-agent` — Set workspace or global ambient-agent main executor default terminal agent and optional model.
|
|
160
|
+
|
|
161
|
+
**set-heartbeat-enabled** — Manage set heartbeat enabled
|
|
162
|
+
|
|
163
|
+
- `realtimex-pp-cli set-heartbeat-enabled` — Turn workspace or global ambient-agent heartbeat on or off.
|
|
164
|
+
|
|
165
|
+
**set-heartbeat-interval** — Manage set heartbeat interval
|
|
166
|
+
|
|
167
|
+
- `realtimex-pp-cli set-heartbeat-interval` — Set workspace or global ambient-agent main executor interval.
|
|
92
168
|
|
|
93
|
-
-
|
|
169
|
+
**set-heartbeat-timezone** — Manage set heartbeat timezone
|
|
170
|
+
|
|
171
|
+
- `realtimex-pp-cli set-heartbeat-timezone` — Set workspace or global ambient-agent heartbeat timezone, for example Asia/Saigon or UTC.
|
|
94
172
|
|
|
95
173
|
**set-workspace-default-agent** — Manage set workspace default agent
|
|
96
174
|
|
|
97
175
|
- `realtimex-pp-cli set-workspace-default-agent <workspaceSlug>` — Set the default CLI agent for a workspace.
|
|
98
176
|
|
|
177
|
+
**setup-heartbeat-tasks** — Manage setup heartbeat tasks
|
|
178
|
+
|
|
179
|
+
- `realtimex-pp-cli setup-heartbeat-tasks` — Set up HEARTBEAT.md task instructions for a workspace or global ambient agent.
|
|
180
|
+
|
|
181
|
+
**setup-personality** — Manage setup personality
|
|
182
|
+
|
|
183
|
+
- `realtimex-pp-cli setup-personality` — Set up AGENTS.md and CLAUDE.md personality files for a workspace or global ambient agent.
|
|
184
|
+
|
|
185
|
+
**start-channel** — Manage start channel
|
|
186
|
+
|
|
187
|
+
- `realtimex-pp-cli start-channel <channelId>` — Start one chat channel by exact channel id.
|
|
188
|
+
|
|
189
|
+
**stop-channel** — Manage stop channel
|
|
190
|
+
|
|
191
|
+
- `realtimex-pp-cli stop-channel <channelId>` — Stop one chat channel by exact channel id.
|
|
192
|
+
|
|
193
|
+
**update-channel** — Manage update channel
|
|
194
|
+
|
|
195
|
+
- `realtimex-pp-cli update-channel <channelId>` — Update one chat channel by exact channel id. Only channel writable fields are changed.
|
|
196
|
+
|
|
99
197
|
|
|
100
198
|
### Finding the right command
|
|
101
199
|
|
|
@@ -126,7 +224,7 @@ Add `--agent` to any command. Expands to: `--json --compact --no-input --no-colo
|
|
|
126
224
|
- **Filterable** — `--select` keeps a subset of fields. Dotted paths descend into nested structures; arrays traverse element-wise. Critical for keeping context small on verbose APIs:
|
|
127
225
|
|
|
128
226
|
```bash
|
|
129
|
-
realtimex-pp-cli
|
|
227
|
+
realtimex-pp-cli approve-channel-pairing-code mock-value --agent --select id,name,status
|
|
130
228
|
```
|
|
131
229
|
- **Previewable** — `--dry-run` shows the request without sending
|
|
132
230
|
- **Offline-friendly** — sync/search commands can use the local SQLite store when available
|
|
@@ -178,7 +276,7 @@ A profile is a saved set of flag values, reused across invocations. Use it when
|
|
|
178
276
|
|
|
179
277
|
```
|
|
180
278
|
realtimex-pp-cli profile save briefing --json
|
|
181
|
-
realtimex-pp-cli --profile briefing
|
|
279
|
+
realtimex-pp-cli --profile briefing approve-channel-pairing-code mock-value
|
|
182
280
|
realtimex-pp-cli profile list --json
|
|
183
281
|
realtimex-pp-cli profile show briefing
|
|
184
282
|
realtimex-pp-cli profile delete briefing --yes
|
|
@@ -222,9 +320,9 @@ Verify: `claude mcp list`
|
|
|
222
320
|
```bash
|
|
223
321
|
realtimex-pp-cli --version
|
|
224
322
|
```
|
|
225
|
-
If the command is missing or the output is not exactly `realtimex-pp-cli 2.0.
|
|
323
|
+
If the command is missing or the output is not exactly `realtimex-pp-cli 2.0.8`, reinstall the pinned version:
|
|
226
324
|
```bash
|
|
227
|
-
npm install -g @realtimex/pp-cli@2.0.
|
|
325
|
+
npm install -g @realtimex/pp-cli@2.0.8
|
|
228
326
|
```
|
|
229
327
|
Then run `realtimex-pp-cli --version` again and proceed only after exact-version verification succeeds.
|
|
230
328
|
2. Match the user query to the best command from the Unique Capabilities and Command Reference above.
|
|
@@ -245,7 +343,7 @@ This skill intentionally exposes a small action-first command set. Prefer these
|
|
|
245
343
|
* Always run first:
|
|
246
344
|
|
|
247
345
|
```bash
|
|
248
|
-
realtimex-pp-cli prepare --agent
|
|
346
|
+
realtimex-pp-cli prepare --workspace-slug "$RTX_WORKSPACE_SLUG" --thread-slug "$RTX_THREAD_SLUG" --agent
|
|
249
347
|
```
|
|
250
348
|
|
|
251
349
|
* Use exact workspace slugs, thread slugs, provider ids, model ids, agent `canonical`, and agent `modelId` values from `prepare`.
|
|
@@ -257,25 +355,26 @@ This skill intentionally exposes a small action-first command set. Prefer these
|
|
|
257
355
|
* When the user explicitly uses contextual references such as "current workspace", "this thread", "the thread just created", "that workspace", or similar references, resolve them from the available conversation context only when the reference is unambiguous.
|
|
258
356
|
* If multiple plausible matches exist, ask the user to choose.
|
|
259
357
|
|
|
260
|
-
For `send-
|
|
358
|
+
For `send-message`:
|
|
261
359
|
|
|
262
|
-
* Require
|
|
360
|
+
* Require these values to be explicitly named or explicitly referenced in the current request:
|
|
263
361
|
* workspace
|
|
264
362
|
* thread
|
|
265
|
-
*
|
|
266
|
-
|
|
267
|
-
*
|
|
268
|
-
* Use provider/model only from:
|
|
269
|
-
* `prepare.models`
|
|
270
|
-
* `list-llm-providers`
|
|
271
|
-
* `list-llm-models`
|
|
272
|
-
* Never use `prepare.agents[].models` for `send-llm-message`.
|
|
273
|
-
* Prefer provider `realtimexai` unless the user explicitly asks for local `nodellama`.
|
|
274
|
-
* Only choose a model id that exists in the selected provider's LLM model list.
|
|
275
|
-
* If the requested model is unavailable, ask which available model to use instead.
|
|
363
|
+
* message
|
|
364
|
+
* If any of those values are missing or ambiguous, ask for the missing values before running the command.
|
|
365
|
+
* Do not provide LLM provider/model arguments to `send-message`; the server routes the message based on the thread/workspace configuration.
|
|
276
366
|
|
|
277
367
|
For workspace default-agent setup:
|
|
278
368
|
|
|
279
369
|
* Use `prepare.agents` only.
|
|
280
370
|
* Use exact agent `canonical` and optional agent `modelId` values from `prepare.agents`.
|
|
281
371
|
* Never use `prepare.models` for workspace default-agent setup.
|
|
372
|
+
|
|
373
|
+
For personality and heartbeat setup:
|
|
374
|
+
|
|
375
|
+
* Use `setup-personality` to get the target directory for workspace or global personality files.
|
|
376
|
+
* Start from `templates/AGENTS.template.md` when creating `AGENTS.md`.
|
|
377
|
+
* Make `CLAUDE.md` a symlink to `AGENTS.md`.
|
|
378
|
+
* Use `setup-heartbeat-tasks` to get the target `HEARTBEAT.md` path.
|
|
379
|
+
* Start from `templates/HEARTBEAT.template.md` when creating `HEARTBEAT.md`.
|
|
380
|
+
* Keep heartbeat instructions separate from personality files.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Agent Instructions
|
|
2
|
+
|
|
3
|
+
## Mission
|
|
4
|
+
|
|
5
|
+
Describe the workspace or global personality that agents should follow.
|
|
6
|
+
|
|
7
|
+
You are working inside the RealTimeX app.
|
|
8
|
+
|
|
9
|
+
## Role
|
|
10
|
+
|
|
11
|
+
- State who the agent is for this workspace.
|
|
12
|
+
- Define the agent's primary responsibility.
|
|
13
|
+
- Define what the agent should avoid doing.
|
|
14
|
+
|
|
15
|
+
## Boundaries
|
|
16
|
+
|
|
17
|
+
- Ask for clarification when instructions are ambiguous.
|
|
18
|
+
- Do not fabricate facts.
|
|
19
|
+
- Do not take destructive actions without explicit approval.
|
|
20
|
+
- Do not store secrets in personality files.
|
|
21
|
+
|
|
22
|
+
## Tools
|
|
23
|
+
|
|
24
|
+
- Describe which tools the agent may use.
|
|
25
|
+
- Describe any tool-specific constraints.
|
|
26
|
+
- Prefer using the `realtimex-moderator-sdk` skill for work related to RealTimeX workspaces, threads, channels (Telegram, Zalo, Discord), sending messages, setup personality, and heartbeat operations.
|
|
27
|
+
- Prefer documented RealTimeX CLI commands when interacting with RealTimeX.
|
|
28
|
+
|
|
29
|
+
## Memory
|
|
30
|
+
|
|
31
|
+
- Record only durable preferences or facts that should affect future work.
|
|
32
|
+
- Keep memory concise and verifiable.
|
|
33
|
+
- Do not store credentials, tokens, or private secrets.
|
|
34
|
+
|
|
35
|
+
## Style
|
|
36
|
+
|
|
37
|
+
- Be concise.
|
|
38
|
+
- Prefer concrete updates over speculation.
|
|
39
|
+
- Explain blockers clearly.
|
|
40
|
+
|
|
41
|
+
## Child Files
|
|
42
|
+
|
|
43
|
+
Reference child markdown files here if used:
|
|
44
|
+
|
|
45
|
+
- SOUL.md
|
|
46
|
+
- USER.md
|
|
47
|
+
- IDENTITY.md
|
|
48
|
+
- TOOLS.md
|
|
49
|
+
- MEMORY.md
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Heartbeat Instructions
|
|
2
|
+
|
|
3
|
+
## Mission
|
|
4
|
+
|
|
5
|
+
Describe the ambient agent's standing responsibility.
|
|
6
|
+
|
|
7
|
+
## Scheduled tasks (optional)
|
|
8
|
+
|
|
9
|
+
Remove this section if you don't need recurring tasks.
|
|
10
|
+
When present, the scheduler runs only tasks that are due on each tick.
|
|
11
|
+
Tasks without an interval inherit the main check interval.
|
|
12
|
+
Use `interval` for simple timing. Supported units are `m`, `h`, and `d`, for example `3m`, `1h`, or `1d`.
|
|
13
|
+
Use `cron` for complex schedules, for example `0 9 * * *`.
|
|
14
|
+
Use `agent` to run a task with a specific terminal agent, for example `@codex-terminal`.
|
|
15
|
+
Use `model` to run a task with a specific model, for example `gpt-5.5-medium`.
|
|
16
|
+
Use `skills` to prefer skills for the task, for example `agent-browser, realtimex-moderator-sdk`.
|
|
17
|
+
`agent`, `model`, `skills`, `interval`, and `cron` are optional. If omitted, the task inherits from the main heartbeat executor.
|
|
18
|
+
|
|
19
|
+
tasks:
|
|
20
|
+
|
|
21
|
+
- name: example-task
|
|
22
|
+
interval: 30m
|
|
23
|
+
agent: @codex-terminal
|
|
24
|
+
model: gpt-5.5-medium
|
|
25
|
+
skills: agent-browser, realtimex-moderator-sdk
|
|
26
|
+
prompt: Describe what the agent should do for this task
|
|
27
|
+
- name: weekday-morning-task
|
|
28
|
+
cron: 0 9 * * 1-5
|
|
29
|
+
prompt: Describe what should run on a cron schedule
|
|
30
|
+
- name: another-task
|
|
31
|
+
prompt: Tasks without interval run at the main check interval
|
|
32
|
+
|
|
33
|
+
## Check for
|
|
34
|
+
|
|
35
|
+
- Pending tasks that require follow-up
|
|
36
|
+
- New events that need awareness
|
|
37
|
+
|
|
38
|
+
## When action is needed
|
|
39
|
+
|
|
40
|
+
- State what should trigger action
|
|
41
|
+
- Describe the preferred next step
|
|
42
|
+
- If calendar routine context is provided, use it only when a concise update would help
|
|
43
|
+
|
|
44
|
+
## When nothing is needed
|
|
45
|
+
|
|
46
|
+
- Reply exactly HEARTBEAT_OK
|
|
47
|
+
|
|
48
|
+
## Allowed actions
|
|
49
|
+
|
|
50
|
+
- Review the current workspace context
|
|
51
|
+
- Create or update relevant artifacts when necessary
|
|
52
|
+
|
|
53
|
+
## Never do
|
|
54
|
+
|
|
55
|
+
- Do not repeat old work without a clear reason
|
|
56
|
+
- Do not take destructive actions without explicit approval
|
|
57
|
+
|
|
58
|
+
## Style
|
|
59
|
+
|
|
60
|
+
- Be concise
|
|
61
|
+
- Prefer concrete updates over speculation
|
|
Binary file
|