towow-mcp 0.2.0
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/client.d.ts +121 -0
- package/dist/client.js +374 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +26 -0
- package/dist/config.js +89 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +923 -0
- package/dist/index.js.map +1 -0
- package/dist/sse.d.ts +26 -0
- package/dist/sse.js +116 -0
- package/dist/sse.js.map +1 -0
- package/package.json +38 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REST client for the Towow Protocol API.
|
|
3
|
+
*
|
|
4
|
+
* Port of Python client.py — all methods use native fetch().
|
|
5
|
+
* URL validation enforces https-only (plus http://localhost for dev).
|
|
6
|
+
*/
|
|
7
|
+
export declare class AuthError extends Error {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
export declare class APIError extends Error {
|
|
11
|
+
statusCode: number;
|
|
12
|
+
detail: string;
|
|
13
|
+
constructor(statusCode: number, detail: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class TowowClient {
|
|
16
|
+
private base;
|
|
17
|
+
private token;
|
|
18
|
+
private timeout;
|
|
19
|
+
constructor(opts?: {
|
|
20
|
+
backendUrl?: string;
|
|
21
|
+
sessionToken?: string;
|
|
22
|
+
timeout?: number;
|
|
23
|
+
});
|
|
24
|
+
private url;
|
|
25
|
+
private protocolUrl;
|
|
26
|
+
private authHeaders;
|
|
27
|
+
private protocolHeaders;
|
|
28
|
+
private handleResponse;
|
|
29
|
+
private fetch;
|
|
30
|
+
private jsonPost;
|
|
31
|
+
private jsonPut;
|
|
32
|
+
private jsonPatch;
|
|
33
|
+
register(inviteCode: string, email: string, password: string, name: string, profileText: string): Promise<Record<string, unknown>>;
|
|
34
|
+
login(email: string, password: string): Promise<Record<string, unknown>>;
|
|
35
|
+
logout(): Promise<Record<string, unknown>>;
|
|
36
|
+
listAgents(): Promise<Record<string, unknown>>;
|
|
37
|
+
createAgent(opts: {
|
|
38
|
+
displayName: string;
|
|
39
|
+
profileText: string;
|
|
40
|
+
visibility?: string;
|
|
41
|
+
scopedTags?: string[];
|
|
42
|
+
capabilityManifest?: Record<string, unknown>;
|
|
43
|
+
}): Promise<Record<string, unknown>>;
|
|
44
|
+
getAgent(agentId: string): Promise<Record<string, unknown>>;
|
|
45
|
+
updateAgent(agentId: string, opts: {
|
|
46
|
+
displayName?: string;
|
|
47
|
+
profileText?: string;
|
|
48
|
+
scopedTags?: string[];
|
|
49
|
+
capabilityManifest?: Record<string, unknown>;
|
|
50
|
+
}): Promise<Record<string, unknown>>;
|
|
51
|
+
setAgentVisibility(agentId: string, visibility: string): Promise<Record<string, unknown>>;
|
|
52
|
+
deleteAgent(agentId: string): Promise<void>;
|
|
53
|
+
createFormulation(opts: {
|
|
54
|
+
agentId: string;
|
|
55
|
+
rawIntent: string;
|
|
56
|
+
sceneContext?: string;
|
|
57
|
+
}): Promise<Record<string, unknown>>;
|
|
58
|
+
getFormulation(sessionId: string): Promise<Record<string, unknown>>;
|
|
59
|
+
/**
|
|
60
|
+
* POST /protocol/formulations/{sessionId}/reply — returns raw Response
|
|
61
|
+
* for SSE stream consumption.
|
|
62
|
+
*/
|
|
63
|
+
formulationReplyStream(sessionId: string, userMessage: string): Promise<Response>;
|
|
64
|
+
confirmFormulation(opts: {
|
|
65
|
+
sessionId: string;
|
|
66
|
+
scopeTags?: string[];
|
|
67
|
+
maxCandidates?: number;
|
|
68
|
+
}): Promise<Record<string, unknown>>;
|
|
69
|
+
getDiscoveryQuery(queryId: string): Promise<Record<string, unknown>>;
|
|
70
|
+
discover(opts: {
|
|
71
|
+
requester: string;
|
|
72
|
+
demandText: string;
|
|
73
|
+
scopeTags?: string[];
|
|
74
|
+
sceneContext?: string;
|
|
75
|
+
maxCandidates?: number;
|
|
76
|
+
}): Promise<Record<string, unknown>>;
|
|
77
|
+
createInvitation(opts: {
|
|
78
|
+
inviter: string;
|
|
79
|
+
nominationId?: string;
|
|
80
|
+
invitee?: string;
|
|
81
|
+
expiresInHours?: number;
|
|
82
|
+
}): Promise<Record<string, unknown>>;
|
|
83
|
+
listInvitations(opts?: {
|
|
84
|
+
agentId?: string;
|
|
85
|
+
}): Promise<Record<string, unknown>>;
|
|
86
|
+
getInvitation(invitationId: string): Promise<Record<string, unknown>>;
|
|
87
|
+
respondInvitation(invitationId: string, opts: {
|
|
88
|
+
agentId: string;
|
|
89
|
+
action: string;
|
|
90
|
+
}): Promise<Record<string, unknown>>;
|
|
91
|
+
createRun(opts: {
|
|
92
|
+
initiator: string;
|
|
93
|
+
invitationIds: string[];
|
|
94
|
+
maxRounds?: number;
|
|
95
|
+
}): Promise<Record<string, unknown>>;
|
|
96
|
+
getRun(runId: string): Promise<Record<string, unknown>>;
|
|
97
|
+
getRunPrompt(runId: string, agentId: string): Promise<Record<string, unknown>>;
|
|
98
|
+
respondRun(runId: string, opts: {
|
|
99
|
+
agentId: string;
|
|
100
|
+
roundNumber: number;
|
|
101
|
+
content: string;
|
|
102
|
+
metadata?: Record<string, unknown>;
|
|
103
|
+
}): Promise<Record<string, unknown>>;
|
|
104
|
+
getRunResult(runId: string, agentId: string): Promise<Record<string, unknown>>;
|
|
105
|
+
submitFeedback(opts: {
|
|
106
|
+
agentId: string;
|
|
107
|
+
targetType: string;
|
|
108
|
+
targetId: string;
|
|
109
|
+
exposureEventId: string;
|
|
110
|
+
rating: number;
|
|
111
|
+
comment?: string;
|
|
112
|
+
}): Promise<Record<string, unknown>>;
|
|
113
|
+
getUsage(opts?: {
|
|
114
|
+
period?: string;
|
|
115
|
+
agentId?: string;
|
|
116
|
+
}): Promise<Record<string, unknown>>;
|
|
117
|
+
refreshToken(): Promise<Record<string, unknown>>;
|
|
118
|
+
bindByok(apiKey: string, provider?: string): Promise<Record<string, unknown>>;
|
|
119
|
+
getByok(): Promise<Record<string, unknown>>;
|
|
120
|
+
clearByok(): Promise<Record<string, unknown>>;
|
|
121
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REST client for the Towow Protocol API.
|
|
3
|
+
*
|
|
4
|
+
* Port of Python client.py — all methods use native fetch().
|
|
5
|
+
* URL validation enforces https-only (plus http://localhost for dev).
|
|
6
|
+
*/
|
|
7
|
+
import { randomUUID } from "node:crypto";
|
|
8
|
+
import { getBackendUrl, getSessionToken } from "./config.js";
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// Constants
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
const ALLOWED_SCHEMES = new Set(["https:", "http:"]);
|
|
13
|
+
const PROTOCOL_ACCEPT = "application/vnd.towow.v1+json";
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Error classes
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
export class AuthError extends Error {
|
|
18
|
+
constructor(message) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = "AuthError";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export class APIError extends Error {
|
|
24
|
+
statusCode;
|
|
25
|
+
detail;
|
|
26
|
+
constructor(statusCode, detail) {
|
|
27
|
+
super(`HTTP ${statusCode}: ${detail}`);
|
|
28
|
+
this.name = "APIError";
|
|
29
|
+
this.statusCode = statusCode;
|
|
30
|
+
this.detail = detail;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// URL validation (D-5 M-4 security)
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
function validateUrl(url) {
|
|
37
|
+
let parsed;
|
|
38
|
+
try {
|
|
39
|
+
parsed = new URL(url);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
throw new Error(`Invalid URL: ${url}`);
|
|
43
|
+
}
|
|
44
|
+
if (!ALLOWED_SCHEMES.has(parsed.protocol)) {
|
|
45
|
+
throw new Error(`Unsupported URL scheme: ${parsed.protocol} Only https and http are allowed.`);
|
|
46
|
+
}
|
|
47
|
+
if (!parsed.hostname) {
|
|
48
|
+
throw new Error(`Invalid URL: missing hostname in ${url}`);
|
|
49
|
+
}
|
|
50
|
+
if (parsed.protocol === "http:" &&
|
|
51
|
+
parsed.hostname !== "localhost" &&
|
|
52
|
+
parsed.hostname !== "127.0.0.1" &&
|
|
53
|
+
!/^\d+\.\d+\.\d+\.\d+$/.test(parsed.hostname ?? "")) {
|
|
54
|
+
throw new Error(`HTTP is only allowed for localhost and IP addresses, got: ${parsed.hostname}`);
|
|
55
|
+
}
|
|
56
|
+
return url;
|
|
57
|
+
}
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
// Client
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
export class TowowClient {
|
|
62
|
+
base;
|
|
63
|
+
token;
|
|
64
|
+
timeout;
|
|
65
|
+
constructor(opts) {
|
|
66
|
+
const rawUrl = opts?.backendUrl ?? getBackendUrl();
|
|
67
|
+
this.base = validateUrl(rawUrl.replace(/\/+$/, ""));
|
|
68
|
+
this.token = opts?.sessionToken ?? null;
|
|
69
|
+
this.timeout = opts?.timeout ?? 30_000;
|
|
70
|
+
}
|
|
71
|
+
// ---- URL builders ----
|
|
72
|
+
url(path) {
|
|
73
|
+
return `${this.base}/api${path}`;
|
|
74
|
+
}
|
|
75
|
+
protocolUrl(path) {
|
|
76
|
+
return `${this.base}/protocol${path}`;
|
|
77
|
+
}
|
|
78
|
+
// ---- Header builders ----
|
|
79
|
+
authHeaders() {
|
|
80
|
+
const token = this.token ?? getSessionToken();
|
|
81
|
+
if (!token) {
|
|
82
|
+
throw new AuthError("Not logged in. Use register or login first.");
|
|
83
|
+
}
|
|
84
|
+
return { Authorization: `Bearer ${token}` };
|
|
85
|
+
}
|
|
86
|
+
protocolHeaders() {
|
|
87
|
+
const headers = this.authHeaders();
|
|
88
|
+
headers["Accept"] = PROTOCOL_ACCEPT;
|
|
89
|
+
return headers;
|
|
90
|
+
}
|
|
91
|
+
// ---- Response handler ----
|
|
92
|
+
async handleResponse(resp) {
|
|
93
|
+
if (resp.status === 401) {
|
|
94
|
+
throw new AuthError("Authentication failed (401). Please login again.");
|
|
95
|
+
}
|
|
96
|
+
if (resp.status >= 400) {
|
|
97
|
+
let detail;
|
|
98
|
+
try {
|
|
99
|
+
const body = await resp.json();
|
|
100
|
+
if (body && typeof body === "object" && "error" in body) {
|
|
101
|
+
const errObj = body.error;
|
|
102
|
+
detail = errObj?.message ?? (await resp.text()).slice(0, 200);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
detail = body?.detail ?? (await resp.text()).slice(0, 200);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
detail = (await resp.text().catch(() => "")).slice(0, 200);
|
|
110
|
+
}
|
|
111
|
+
throw new APIError(resp.status, detail);
|
|
112
|
+
}
|
|
113
|
+
return (await resp.json());
|
|
114
|
+
}
|
|
115
|
+
// ---- Fetch wrapper with timeout ----
|
|
116
|
+
async fetch(url, init) {
|
|
117
|
+
const controller = new AbortController();
|
|
118
|
+
const timer = setTimeout(() => controller.abort(), this.timeout);
|
|
119
|
+
try {
|
|
120
|
+
return await fetch(url, { ...init, signal: controller.signal });
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
clearTimeout(timer);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// ---- Helpers for JSON POST/PUT/PATCH/DELETE ----
|
|
127
|
+
async jsonPost(url, body, headers) {
|
|
128
|
+
return this.fetch(url, {
|
|
129
|
+
method: "POST",
|
|
130
|
+
headers: { "Content-Type": "application/json", ...headers },
|
|
131
|
+
body: JSON.stringify(body),
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
async jsonPut(url, body, headers) {
|
|
135
|
+
return this.fetch(url, {
|
|
136
|
+
method: "PUT",
|
|
137
|
+
headers: { "Content-Type": "application/json", ...headers },
|
|
138
|
+
body: JSON.stringify(body),
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
async jsonPatch(url, body, headers) {
|
|
142
|
+
return this.fetch(url, {
|
|
143
|
+
method: "PATCH",
|
|
144
|
+
headers: { "Content-Type": "application/json", ...headers },
|
|
145
|
+
body: JSON.stringify(body),
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
// ===========================================================================
|
|
149
|
+
// Public (no auth)
|
|
150
|
+
// ===========================================================================
|
|
151
|
+
async register(inviteCode, email, password, name, profileText) {
|
|
152
|
+
const resp = await this.jsonPost(this.protocolUrl("/auth/register"), {
|
|
153
|
+
invite_code: inviteCode,
|
|
154
|
+
email,
|
|
155
|
+
password,
|
|
156
|
+
name,
|
|
157
|
+
profile_text: profileText,
|
|
158
|
+
}, { Accept: PROTOCOL_ACCEPT });
|
|
159
|
+
return this.handleResponse(resp);
|
|
160
|
+
}
|
|
161
|
+
async login(email, password) {
|
|
162
|
+
const resp = await this.jsonPost(this.protocolUrl("/auth/login"), { email, password }, { Accept: PROTOCOL_ACCEPT });
|
|
163
|
+
return this.handleResponse(resp);
|
|
164
|
+
}
|
|
165
|
+
async logout() {
|
|
166
|
+
const resp = await this.jsonPost(this.protocolUrl("/auth/logout"), {}, this.protocolHeaders());
|
|
167
|
+
return this.handleResponse(resp);
|
|
168
|
+
}
|
|
169
|
+
// ===========================================================================
|
|
170
|
+
// Authenticated
|
|
171
|
+
// ===========================================================================
|
|
172
|
+
async listAgents() {
|
|
173
|
+
const resp = await this.fetch(this.protocolUrl("/agents"), {
|
|
174
|
+
headers: this.protocolHeaders(),
|
|
175
|
+
});
|
|
176
|
+
return this.handleResponse(resp);
|
|
177
|
+
}
|
|
178
|
+
async createAgent(opts) {
|
|
179
|
+
const resp = await this.jsonPost(this.protocolUrl("/agents"), {
|
|
180
|
+
display_name: opts.displayName,
|
|
181
|
+
profile_source: "plaintext",
|
|
182
|
+
profile_text: opts.profileText,
|
|
183
|
+
visibility: opts.visibility ?? "scoped",
|
|
184
|
+
scoped_tags: opts.scopedTags ?? [],
|
|
185
|
+
capability_manifest: opts.capabilityManifest ?? null,
|
|
186
|
+
}, this.protocolHeaders());
|
|
187
|
+
return this.handleResponse(resp);
|
|
188
|
+
}
|
|
189
|
+
async getAgent(agentId) {
|
|
190
|
+
const resp = await this.fetch(this.protocolUrl(`/agents/${agentId}`), {
|
|
191
|
+
headers: this.protocolHeaders(),
|
|
192
|
+
});
|
|
193
|
+
return this.handleResponse(resp);
|
|
194
|
+
}
|
|
195
|
+
async updateAgent(agentId, opts) {
|
|
196
|
+
const payload = {};
|
|
197
|
+
if (opts.displayName !== undefined)
|
|
198
|
+
payload.display_name = opts.displayName;
|
|
199
|
+
if (opts.profileText !== undefined)
|
|
200
|
+
payload.profile_text = opts.profileText;
|
|
201
|
+
if (opts.scopedTags !== undefined)
|
|
202
|
+
payload.scoped_tags = opts.scopedTags;
|
|
203
|
+
if (opts.capabilityManifest !== undefined)
|
|
204
|
+
payload.capability_manifest = opts.capabilityManifest;
|
|
205
|
+
const resp = await this.jsonPut(this.protocolUrl(`/agents/${agentId}`), payload, this.protocolHeaders());
|
|
206
|
+
return this.handleResponse(resp);
|
|
207
|
+
}
|
|
208
|
+
async setAgentVisibility(agentId, visibility) {
|
|
209
|
+
const resp = await this.jsonPatch(this.protocolUrl(`/agents/${agentId}/visibility`), { visibility }, this.protocolHeaders());
|
|
210
|
+
return this.handleResponse(resp);
|
|
211
|
+
}
|
|
212
|
+
async deleteAgent(agentId) {
|
|
213
|
+
const resp = await this.fetch(this.protocolUrl(`/agents/${agentId}`), {
|
|
214
|
+
method: "DELETE",
|
|
215
|
+
headers: this.protocolHeaders(),
|
|
216
|
+
});
|
|
217
|
+
if (resp.status === 204)
|
|
218
|
+
return;
|
|
219
|
+
await this.handleResponse(resp);
|
|
220
|
+
}
|
|
221
|
+
async createFormulation(opts) {
|
|
222
|
+
const payload = {
|
|
223
|
+
agent_id: opts.agentId,
|
|
224
|
+
raw_intent: opts.rawIntent,
|
|
225
|
+
};
|
|
226
|
+
if (opts.sceneContext)
|
|
227
|
+
payload.scene_context = opts.sceneContext;
|
|
228
|
+
const resp = await this.jsonPost(this.protocolUrl("/formulations"), payload, this.protocolHeaders());
|
|
229
|
+
return this.handleResponse(resp);
|
|
230
|
+
}
|
|
231
|
+
async getFormulation(sessionId) {
|
|
232
|
+
const resp = await this.fetch(this.protocolUrl(`/formulations/${sessionId}`), { headers: this.protocolHeaders() });
|
|
233
|
+
return this.handleResponse(resp);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* POST /protocol/formulations/{sessionId}/reply — returns raw Response
|
|
237
|
+
* for SSE stream consumption.
|
|
238
|
+
*/
|
|
239
|
+
async formulationReplyStream(sessionId, userMessage) {
|
|
240
|
+
const resp = await this.jsonPost(this.protocolUrl(`/formulations/${sessionId}/reply`), { user_message: userMessage }, this.protocolHeaders());
|
|
241
|
+
if (resp.status >= 400) {
|
|
242
|
+
await this.handleResponse(resp);
|
|
243
|
+
}
|
|
244
|
+
return resp;
|
|
245
|
+
}
|
|
246
|
+
async confirmFormulation(opts) {
|
|
247
|
+
const resp = await this.jsonPost(this.protocolUrl(`/formulations/${opts.sessionId}/confirm`), {
|
|
248
|
+
scope_tags: opts.scopeTags ?? [],
|
|
249
|
+
max_candidates: opts.maxCandidates ?? 10,
|
|
250
|
+
}, this.protocolHeaders());
|
|
251
|
+
return this.handleResponse(resp);
|
|
252
|
+
}
|
|
253
|
+
async getDiscoveryQuery(queryId) {
|
|
254
|
+
const resp = await this.fetch(this.protocolUrl(`/discover/${queryId}`), {
|
|
255
|
+
headers: this.protocolHeaders(),
|
|
256
|
+
});
|
|
257
|
+
return this.handleResponse(resp);
|
|
258
|
+
}
|
|
259
|
+
async discover(opts) {
|
|
260
|
+
const payload = {
|
|
261
|
+
requester: opts.requester,
|
|
262
|
+
demand_source: "plaintext",
|
|
263
|
+
demand_text: opts.demandText,
|
|
264
|
+
scope_tags: opts.scopeTags ?? [],
|
|
265
|
+
max_candidates: opts.maxCandidates ?? 10,
|
|
266
|
+
};
|
|
267
|
+
if (opts.sceneContext)
|
|
268
|
+
payload.scene_context = opts.sceneContext;
|
|
269
|
+
const resp = await this.jsonPost(this.protocolUrl("/discover"), payload, this.protocolHeaders());
|
|
270
|
+
return this.handleResponse(resp);
|
|
271
|
+
}
|
|
272
|
+
async createInvitation(opts) {
|
|
273
|
+
const payload = {
|
|
274
|
+
inviter: opts.inviter,
|
|
275
|
+
expires_in_hours: opts.expiresInHours ?? 24,
|
|
276
|
+
};
|
|
277
|
+
if (opts.nominationId !== undefined)
|
|
278
|
+
payload.nomination_id = opts.nominationId;
|
|
279
|
+
if (opts.invitee !== undefined)
|
|
280
|
+
payload.invitee = opts.invitee;
|
|
281
|
+
const resp = await this.jsonPost(this.protocolUrl("/invitations"), payload, this.protocolHeaders());
|
|
282
|
+
return this.handleResponse(resp);
|
|
283
|
+
}
|
|
284
|
+
async listInvitations(opts) {
|
|
285
|
+
let url = this.protocolUrl("/invitations");
|
|
286
|
+
if (opts?.agentId) {
|
|
287
|
+
url += `?agent_id=${encodeURIComponent(opts.agentId)}`;
|
|
288
|
+
}
|
|
289
|
+
const resp = await this.fetch(url, { headers: this.protocolHeaders() });
|
|
290
|
+
return this.handleResponse(resp);
|
|
291
|
+
}
|
|
292
|
+
async getInvitation(invitationId) {
|
|
293
|
+
const resp = await this.fetch(this.protocolUrl(`/invitations/${invitationId}`), { headers: this.protocolHeaders() });
|
|
294
|
+
return this.handleResponse(resp);
|
|
295
|
+
}
|
|
296
|
+
async respondInvitation(invitationId, opts) {
|
|
297
|
+
const resp = await this.jsonPatch(this.protocolUrl(`/invitations/${invitationId}`), { agent_id: opts.agentId, action: opts.action }, this.protocolHeaders());
|
|
298
|
+
return this.handleResponse(resp);
|
|
299
|
+
}
|
|
300
|
+
async createRun(opts) {
|
|
301
|
+
const headers = this.protocolHeaders();
|
|
302
|
+
headers["Idempotency-Key"] = randomUUID().replace(/-/g, "");
|
|
303
|
+
const resp = await this.jsonPost(this.protocolUrl("/runs"), {
|
|
304
|
+
initiator: opts.initiator,
|
|
305
|
+
invitation_ids: opts.invitationIds,
|
|
306
|
+
max_rounds: opts.maxRounds ?? 4,
|
|
307
|
+
}, headers);
|
|
308
|
+
return this.handleResponse(resp);
|
|
309
|
+
}
|
|
310
|
+
async getRun(runId) {
|
|
311
|
+
const resp = await this.fetch(this.protocolUrl(`/runs/${runId}`), {
|
|
312
|
+
headers: this.protocolHeaders(),
|
|
313
|
+
});
|
|
314
|
+
return this.handleResponse(resp);
|
|
315
|
+
}
|
|
316
|
+
async getRunPrompt(runId, agentId) {
|
|
317
|
+
const resp = await this.fetch(this.protocolUrl(`/runs/${runId}/prompt?agent_id=${encodeURIComponent(agentId)}`), { headers: this.protocolHeaders() });
|
|
318
|
+
return this.handleResponse(resp);
|
|
319
|
+
}
|
|
320
|
+
async respondRun(runId, opts) {
|
|
321
|
+
const resp = await this.jsonPost(this.protocolUrl(`/runs/${runId}/respond`), {
|
|
322
|
+
agent_id: opts.agentId,
|
|
323
|
+
round: opts.roundNumber,
|
|
324
|
+
content: opts.content,
|
|
325
|
+
metadata: opts.metadata ?? null,
|
|
326
|
+
}, this.protocolHeaders());
|
|
327
|
+
return this.handleResponse(resp);
|
|
328
|
+
}
|
|
329
|
+
async getRunResult(runId, agentId) {
|
|
330
|
+
const resp = await this.fetch(this.protocolUrl(`/runs/${runId}/result?agent_id=${encodeURIComponent(agentId)}`), { headers: this.protocolHeaders() });
|
|
331
|
+
return this.handleResponse(resp);
|
|
332
|
+
}
|
|
333
|
+
async submitFeedback(opts) {
|
|
334
|
+
const resp = await this.jsonPost(this.protocolUrl("/feedback"), {
|
|
335
|
+
agent_id: opts.agentId,
|
|
336
|
+
target_type: opts.targetType,
|
|
337
|
+
target_id: opts.targetId,
|
|
338
|
+
exposure_event_id: opts.exposureEventId,
|
|
339
|
+
rating: opts.rating,
|
|
340
|
+
comment: opts.comment ?? null,
|
|
341
|
+
}, this.protocolHeaders());
|
|
342
|
+
return this.handleResponse(resp);
|
|
343
|
+
}
|
|
344
|
+
async getUsage(opts) {
|
|
345
|
+
const params = new URLSearchParams();
|
|
346
|
+
params.set("period", opts?.period ?? "month");
|
|
347
|
+
if (opts?.agentId)
|
|
348
|
+
params.set("agent_id", opts.agentId);
|
|
349
|
+
const resp = await this.fetch(this.protocolUrl(`/usage?${params.toString()}`), { headers: this.protocolHeaders() });
|
|
350
|
+
return this.handleResponse(resp);
|
|
351
|
+
}
|
|
352
|
+
async refreshToken() {
|
|
353
|
+
const resp = await this.jsonPost(this.protocolUrl("/auth/token"), {}, this.protocolHeaders());
|
|
354
|
+
return this.handleResponse(resp);
|
|
355
|
+
}
|
|
356
|
+
async bindByok(apiKey, provider = "anthropic") {
|
|
357
|
+
const resp = await this.jsonPost(this.protocolUrl("/auth/byok-session"), { api_key: apiKey, provider }, this.protocolHeaders());
|
|
358
|
+
return this.handleResponse(resp);
|
|
359
|
+
}
|
|
360
|
+
async getByok() {
|
|
361
|
+
const resp = await this.fetch(this.protocolUrl("/auth/byok-session"), {
|
|
362
|
+
headers: this.protocolHeaders(),
|
|
363
|
+
});
|
|
364
|
+
return this.handleResponse(resp);
|
|
365
|
+
}
|
|
366
|
+
async clearByok() {
|
|
367
|
+
const resp = await this.fetch(this.protocolUrl("/auth/byok-session"), {
|
|
368
|
+
method: "DELETE",
|
|
369
|
+
headers: this.protocolHeaders(),
|
|
370
|
+
});
|
|
371
|
+
return this.handleResponse(resp);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,eAAe,EA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ED,KAAK,CAAC,SAAS;QACb,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,EAAE;YACpE,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE;SAChC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;CACF"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local configuration management for ~/.towow/config.json.
|
|
3
|
+
*
|
|
4
|
+
* Fully compatible with the Python MCP server's config format —
|
|
5
|
+
* both versions read/write the same file.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_BACKEND_URL = "http://47.118.31.230:8080";
|
|
8
|
+
interface TowowConfig {
|
|
9
|
+
backend_url?: string;
|
|
10
|
+
session_token?: string;
|
|
11
|
+
agent_id?: string;
|
|
12
|
+
display_name?: string;
|
|
13
|
+
last_negotiation_id?: string;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
export declare function readConfig(path?: string): TowowConfig;
|
|
17
|
+
export declare function writeConfig(data: TowowConfig, path?: string): void;
|
|
18
|
+
export declare function getBackendUrl(): string;
|
|
19
|
+
export declare function getSessionToken(path?: string): string | null;
|
|
20
|
+
export declare function saveSessionToken(token: string, path?: string): void;
|
|
21
|
+
export declare function clearSessionToken(path?: string): void;
|
|
22
|
+
export declare function getAgentId(path?: string): string | null;
|
|
23
|
+
export declare function getDisplayName(path?: string): string | null;
|
|
24
|
+
export declare function saveAgent(agentId: string, displayName?: string | null, path?: string): void;
|
|
25
|
+
export declare function clearAgent(path?: string): void;
|
|
26
|
+
export {};
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local configuration management for ~/.towow/config.json.
|
|
3
|
+
*
|
|
4
|
+
* Fully compatible with the Python MCP server's config format —
|
|
5
|
+
* both versions read/write the same file.
|
|
6
|
+
*/
|
|
7
|
+
import { readFileSync, writeFileSync, mkdirSync, chmodSync, existsSync } from "node:fs";
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { homedir } from "node:os";
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Paths
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
const CONFIG_DIR = join(homedir(), ".towow");
|
|
14
|
+
const CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
15
|
+
export const DEFAULT_BACKEND_URL = "http://47.118.31.230:8080";
|
|
16
|
+
export function readConfig(path) {
|
|
17
|
+
const target = path ?? CONFIG_FILE;
|
|
18
|
+
if (!existsSync(target))
|
|
19
|
+
return {};
|
|
20
|
+
try {
|
|
21
|
+
const raw = readFileSync(target, "utf-8");
|
|
22
|
+
return JSON.parse(raw);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function writeConfig(data, path) {
|
|
29
|
+
const target = path ?? CONFIG_FILE;
|
|
30
|
+
const dir = target === CONFIG_FILE ? CONFIG_DIR : join(target, "..");
|
|
31
|
+
mkdirSync(dir, { recursive: true });
|
|
32
|
+
writeFileSync(target, JSON.stringify(data, null, 2), "utf-8");
|
|
33
|
+
try {
|
|
34
|
+
chmodSync(target, 0o600);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
// chmod may fail on Windows — best-effort
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
// Backend URL
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
export function getBackendUrl() {
|
|
44
|
+
const envUrl = process.env["TOWOW_BACKEND_URL"];
|
|
45
|
+
if (envUrl)
|
|
46
|
+
return envUrl.replace(/\/+$/, "");
|
|
47
|
+
const config = readConfig();
|
|
48
|
+
return (config.backend_url ?? DEFAULT_BACKEND_URL).replace(/\/+$/, "");
|
|
49
|
+
}
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// Session token
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
export function getSessionToken(path) {
|
|
54
|
+
return readConfig(path).session_token ?? null;
|
|
55
|
+
}
|
|
56
|
+
export function saveSessionToken(token, path) {
|
|
57
|
+
const config = readConfig(path);
|
|
58
|
+
config.session_token = token;
|
|
59
|
+
writeConfig(config, path);
|
|
60
|
+
}
|
|
61
|
+
export function clearSessionToken(path) {
|
|
62
|
+
const config = readConfig(path);
|
|
63
|
+
delete config.session_token;
|
|
64
|
+
writeConfig(config, path);
|
|
65
|
+
}
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
// Agent helpers
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
export function getAgentId(path) {
|
|
70
|
+
return readConfig(path).agent_id ?? null;
|
|
71
|
+
}
|
|
72
|
+
export function getDisplayName(path) {
|
|
73
|
+
return readConfig(path).display_name ?? null;
|
|
74
|
+
}
|
|
75
|
+
export function saveAgent(agentId, displayName, path) {
|
|
76
|
+
const config = readConfig(path);
|
|
77
|
+
config.agent_id = agentId;
|
|
78
|
+
if (displayName !== undefined && displayName !== null) {
|
|
79
|
+
config.display_name = displayName;
|
|
80
|
+
}
|
|
81
|
+
writeConfig(config, path);
|
|
82
|
+
}
|
|
83
|
+
export function clearAgent(path) {
|
|
84
|
+
const config = readConfig(path);
|
|
85
|
+
delete config.agent_id;
|
|
86
|
+
delete config.display_name;
|
|
87
|
+
writeConfig(config, path);
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,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