@vatio-ai/cli 0.55.0 → 0.56.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/README.md +10 -18
- package/bin/vatio.mjs +15 -23
- package/lib/api-client.mjs +17 -172
- package/lib/bundle.mjs +1 -1
- package/lib/commands/channels.mjs +10 -335
- package/lib/commands/chat.mjs +31 -84
- package/lib/commands/deploy.mjs +2 -17
- package/lib/commands/improve.mjs +1 -1
- package/lib/commands/knowledge.mjs +13 -70
- package/lib/commands/support-commands.mjs +2 -167
- package/lib/commands/workspace-admin.mjs +3 -18
- package/lib/config.mjs +1 -1
- package/lib/device-auth.mjs +3 -3
- package/lib/help.mjs +11 -22
- package/lib/update-notice.mjs +2 -3
- package/lib/workspace.mjs +1 -5
- package/package.json +1 -1
- package/lib/commands/mcp.mjs +0 -350
package/README.md
CHANGED
|
@@ -19,13 +19,11 @@ is the same thing without installing anything.
|
|
|
19
19
|
## If you are a coding agent
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
vatio
|
|
23
|
-
vatio docs # the whole developer contract as markdown, live from Vatio
|
|
22
|
+
vatio docs --save # the whole developer contract as markdown, live from Vatio
|
|
24
23
|
```
|
|
25
24
|
|
|
26
|
-
`vatio
|
|
27
|
-
|
|
28
|
-
contract that [docs.vatio.ai/docs.md](https://docs.vatio.ai/docs.md) serves, and
|
|
25
|
+
`vatio docs` prints the same contract that
|
|
26
|
+
[docs.vatio.ai/docs.md](https://docs.vatio.ai/docs.md) serves, and
|
|
29
27
|
`vatio docs --save` writes it next to the workspace.
|
|
30
28
|
|
|
31
29
|
Don't guess `vatio.yml` keys. Unknown root keys fail validation, and the rules
|
|
@@ -60,27 +58,22 @@ publish [--env NAME] Promote the latest push to live, or the named previe
|
|
|
60
58
|
diff [--env NAME] What this directory would change
|
|
61
59
|
status Preview and live deployment state
|
|
62
60
|
rollback Restore the previous live deployment
|
|
63
|
-
tools check Validate the workspace against Vatio's contracts
|
|
64
61
|
|
|
65
|
-
chat "message" [--env NAME]
|
|
66
|
-
|
|
67
|
-
chat show CHAT_ID [--json]
|
|
62
|
+
chat "message" [--env NAME] [--new]
|
|
63
|
+
Talk to your own agent; the token is the identity
|
|
64
|
+
chat show [CHAT_ID] [--json]
|
|
65
|
+
The chat you are in, or any chat in the workspace, with its tool calls
|
|
68
66
|
|
|
69
67
|
kb list|show|create|rm Knowledge bases
|
|
70
68
|
kb write|cat|rm-entry Entries, from a file or stdin
|
|
71
|
-
kb follow|unfollow|refresh Read a site into a base, nightly
|
|
72
69
|
|
|
73
70
|
secrets list|set|rm Credentials your tools read
|
|
74
71
|
tokens list|create|origins|revoke Publishable tokens and the origins each accepts
|
|
75
|
-
widget [--env NAME] What the platform enforces, and the tokens there are
|
|
76
72
|
auth --new-key Keypair that signs the visitor's JWT
|
|
77
73
|
|
|
78
|
-
whatsapp
|
|
79
|
-
instagram ... Shared sandbox, or your own account
|
|
74
|
+
whatsapp | instagram Set up in the console; prints the link
|
|
80
75
|
|
|
81
76
|
docs [--save [PATH]] The whole developer contract
|
|
82
|
-
mcp Speak MCP over stdio, for a coding agent
|
|
83
|
-
issue "what should change" Send a change request, workspace attached
|
|
84
77
|
config show|set|unset base_url and token, per developer
|
|
85
78
|
```
|
|
86
79
|
|
|
@@ -99,14 +92,13 @@ command, which is what CI should use.
|
|
|
99
92
|
## Where the rules live
|
|
100
93
|
|
|
101
94
|
Whether a workspace is valid is answered by Vatio, not by this package: `push`
|
|
102
|
-
and `
|
|
95
|
+
and `diff` send the directory and read the result back. So the rules that
|
|
103
96
|
judge your workspace are always the deployed ones, and this CLI never has to be
|
|
104
97
|
upgraded to understand a new one.
|
|
105
98
|
|
|
106
99
|
## Issues
|
|
107
100
|
|
|
108
|
-
Bugs and questions go to [issues](https://github.com/vatio-ai/cli/issues)
|
|
109
|
-
`vatio issue` from inside a workspace. This repository is a read-only mirror of
|
|
101
|
+
Bugs and questions go to [issues](https://github.com/vatio-ai/cli/issues). This repository is a read-only mirror of
|
|
110
102
|
the CLI as it ships inside Vatio, so a pull request cannot be merged here: open
|
|
111
103
|
an issue describing the change instead. Release notes live in the
|
|
112
104
|
[changelog](https://docs.vatio.ai/changelog).
|
package/bin/vatio.mjs
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// The Vatio CLI, as an npm package: `npx @vatio-ai/cli push`.
|
|
3
3
|
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// and a developer who logged in with one is logged in for the other -- the
|
|
7
|
-
// credential belongs to their home directory, not to a client.
|
|
8
|
-
//
|
|
9
|
-
// This exists because Node is the runtime this audience already has and Ruby
|
|
10
|
-
// is the one some of them do not. Nothing about the contract moved: the
|
|
11
|
-
// workspace is parsed by the platform, so a client is HTTP and a terminal.
|
|
4
|
+
// The workspace is parsed by the platform, so a client is HTTP and a
|
|
5
|
+
// terminal; the credential lives in ~/.vatio/config.json.
|
|
12
6
|
|
|
13
7
|
import { Config, ConfigError } from "../lib/config.mjs";
|
|
14
8
|
import { HttpError, UnauthorizedError, ForbiddenError, NotFoundError } from "../lib/http.mjs";
|
|
@@ -16,24 +10,30 @@ import { UserError, fail } from "../lib/support.mjs";
|
|
|
16
10
|
import { helpText } from "../lib/help.mjs";
|
|
17
11
|
import { login, logout } from "../lib/commands/auth.mjs";
|
|
18
12
|
import { configCommand, doctor, init, version } from "../lib/commands/misc.mjs";
|
|
19
|
-
import { diff, publish, push, rollback, status
|
|
13
|
+
import { diff, publish, push, rollback, status } from "../lib/commands/deploy.mjs";
|
|
20
14
|
import { env } from "../lib/commands/env.mjs";
|
|
21
|
-
import { secrets, tokens
|
|
15
|
+
import { secrets, tokens } from "../lib/commands/workspace-admin.mjs";
|
|
22
16
|
import { auth } from "../lib/commands/identity-key.mjs";
|
|
23
17
|
import { chat } from "../lib/commands/chat.mjs";
|
|
24
18
|
import { kb } from "../lib/commands/knowledge.mjs";
|
|
25
19
|
import { instagram, whatsapp } from "../lib/commands/channels.mjs";
|
|
26
|
-
import { docs
|
|
20
|
+
import { docs } from "../lib/commands/support-commands.mjs";
|
|
27
21
|
import { evalCommand, flags } from "../lib/commands/improve.mjs";
|
|
28
|
-
import { mcp } from "../lib/commands/mcp.mjs";
|
|
29
22
|
import { printUpdateNotice, startUpdateCheck } from "../lib/update-notice.mjs";
|
|
30
23
|
|
|
31
|
-
//
|
|
32
|
-
// unknown:
|
|
24
|
+
// Commands that existed and are gone, answered by name rather than as
|
|
25
|
+
// unknown: removed from the product, or what npm does now.
|
|
33
26
|
const RETIRED = {
|
|
34
27
|
pull: "was removed: a deployed manifest only ever comes from a push, so it could never\n" +
|
|
35
28
|
"hand back anything your repository did not already have. Use `vatio diff --env live`,\n" +
|
|
36
|
-
"or read the manifest at GET /api/v1/:slug/
|
|
29
|
+
"or read the manifest at GET /api/developer/v1/:slug/manifest.",
|
|
30
|
+
issue: "was removed: report a problem on the public repository it belongs to --\n" +
|
|
31
|
+
"https://github.com/vatio-ai/cli/issues (or sdk, ios, ruby under github.com/vatio-ai).",
|
|
32
|
+
tools: "was removed: `vatio push` validates before it deploys, and `vatio diff` validates\n" +
|
|
33
|
+
"without deploying.",
|
|
34
|
+
widget: "was removed: `vatio env` prints the snippet and its token, and the look is edited on\n" +
|
|
35
|
+
"the console's Widget page.",
|
|
36
|
+
mcp: "was removed. Point your coding agent at `vatio docs --save` and let it run the CLI.",
|
|
37
37
|
update: "is npm's job now: `npx @vatio-ai/cli@latest` always runs the current release, and\n" +
|
|
38
38
|
"`npm install -g @vatio-ai/cli@latest` updates a global install."
|
|
39
39
|
};
|
|
@@ -76,12 +76,8 @@ async function run(command, args) {
|
|
|
76
76
|
return await env(config, args);
|
|
77
77
|
case "diff":
|
|
78
78
|
return await diff(config, args);
|
|
79
|
-
case "tools":
|
|
80
|
-
return await toolsCheck(config, args);
|
|
81
79
|
case "tokens":
|
|
82
80
|
return await tokens(config, args);
|
|
83
|
-
case "widget":
|
|
84
|
-
return await widget(config, args);
|
|
85
81
|
case "auth":
|
|
86
82
|
return await auth(config, args);
|
|
87
83
|
case "chat":
|
|
@@ -100,10 +96,6 @@ async function run(command, args) {
|
|
|
100
96
|
return await evalCommand(config, args);
|
|
101
97
|
case "docs":
|
|
102
98
|
return await docs(config, args);
|
|
103
|
-
case "issue":
|
|
104
|
-
return await issue(config, args);
|
|
105
|
-
case "mcp":
|
|
106
|
-
return await mcp(config);
|
|
107
99
|
case "help":
|
|
108
100
|
case "-h":
|
|
109
101
|
case "--help":
|
package/lib/api-client.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Everything the CLI can ask of one workspace: /api/v1/:slug/*.
|
|
1
|
+
// Everything the CLI can ask of one workspace: /api/developer/v1/:slug/*.
|
|
2
2
|
//
|
|
3
3
|
// One class rather than a client per surface. They share a host, a token and an
|
|
4
4
|
// error contract, and splitting them only ever meant passing the same three
|
|
@@ -12,11 +12,11 @@ export class ApiClient extends HttpClient {
|
|
|
12
12
|
// --- deploy ---------------------------------------------------------
|
|
13
13
|
|
|
14
14
|
deployStatus() {
|
|
15
|
-
return this.get("/
|
|
15
|
+
return this.get("/status");
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
deployedManifest({ environment = "live" } = {}) {
|
|
19
|
-
return this.get("/
|
|
19
|
+
return this.get("/manifest", { environment });
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
// Validation without deploying: send the directory, get back the manifest it
|
|
@@ -26,7 +26,7 @@ export class ApiClient extends HttpClient {
|
|
|
26
26
|
check({ files, environment = null }) {
|
|
27
27
|
const body = { files };
|
|
28
28
|
if (environment) body.environment = environment;
|
|
29
|
-
return this.post("/
|
|
29
|
+
return this.post("/check", body);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
pushPreview({ manifest, gitSha = null, gitBranch = null, createdBy = null, environment = null }) {
|
|
@@ -35,42 +35,34 @@ export class ApiClient extends HttpClient {
|
|
|
35
35
|
if (gitBranch) body.git_branch = gitBranch;
|
|
36
36
|
if (createdBy) body.created_by = createdBy;
|
|
37
37
|
if (environment) body.environment = environment;
|
|
38
|
-
return this.put("/
|
|
38
|
+
return this.put("/push", body);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
publish({ createdBy = null, environment = null } = {}) {
|
|
42
42
|
const body = {};
|
|
43
43
|
if (createdBy) body.created_by = createdBy;
|
|
44
44
|
if (environment) body.environment = environment;
|
|
45
|
-
return this.post("/
|
|
45
|
+
return this.post("/publish", body);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
rollback({ createdBy = null } = {}) {
|
|
49
49
|
const body = {};
|
|
50
50
|
if (createdBy) body.created_by = createdBy;
|
|
51
|
-
return this.post("/
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
revisions() {
|
|
55
|
-
return this.get("/deploy/revisions");
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
revision(id) {
|
|
59
|
-
return this.get(`/deploy/revisions/${encode(id)}`);
|
|
51
|
+
return this.post("/rollback", body);
|
|
60
52
|
}
|
|
61
53
|
|
|
62
54
|
// --- environments ---------------------------------------------------
|
|
63
55
|
|
|
64
56
|
environments() {
|
|
65
|
-
return this.get("/
|
|
57
|
+
return this.get("/env");
|
|
66
58
|
}
|
|
67
59
|
|
|
68
60
|
environment(name) {
|
|
69
|
-
return this.get(`/
|
|
61
|
+
return this.get(`/env/${encode(name)}`);
|
|
70
62
|
}
|
|
71
63
|
|
|
72
64
|
deleteEnvironment(name) {
|
|
73
|
-
return this.delete(`/
|
|
65
|
+
return this.delete(`/env/${encode(name)}`);
|
|
74
66
|
}
|
|
75
67
|
|
|
76
68
|
// --- secrets --------------------------------------------------------
|
|
@@ -78,24 +70,21 @@ export class ApiClient extends HttpClient {
|
|
|
78
70
|
// Without an environment, the value everywhere; with one, the value only
|
|
79
71
|
// that environment uses instead.
|
|
80
72
|
listSecrets({ environment = null } = {}) {
|
|
81
|
-
return this.get("/
|
|
73
|
+
return this.get("/secrets", { environment });
|
|
82
74
|
}
|
|
83
75
|
|
|
84
76
|
upsertSecret({ key, value, environment = null }) {
|
|
85
77
|
const body = { value };
|
|
86
78
|
if (environment) body.environment = environment;
|
|
87
|
-
return this.put(`/
|
|
79
|
+
return this.put(`/secrets/${encode(key)}`, body);
|
|
88
80
|
}
|
|
89
81
|
|
|
90
82
|
deleteSecret({ key, environment = null }) {
|
|
91
|
-
return this.delete(`/
|
|
83
|
+
return this.delete(`/secrets/${encode(key)}${query({ environment })}`);
|
|
92
84
|
}
|
|
93
85
|
|
|
94
86
|
// --- knowledge bases ------------------------------------------------
|
|
95
87
|
//
|
|
96
|
-
// A base holds entries (markdown) and reads sites (a URL or a pattern). Two
|
|
97
|
-
// nouns, and every call below is one of them.
|
|
98
|
-
|
|
99
88
|
// Every read and write below is as one environment sees the base: a
|
|
100
89
|
// branch's, which keeps its changes on top of live, or `live` itself.
|
|
101
90
|
// Without one the platform means `preview`.
|
|
@@ -116,10 +105,6 @@ export class ApiClient extends HttpClient {
|
|
|
116
105
|
return this.delete(`/knowledge_bases/${encode(name)}`);
|
|
117
106
|
}
|
|
118
107
|
|
|
119
|
-
refreshKnowledgeBase(name) {
|
|
120
|
-
return this.post(`/knowledge_bases/${encode(name)}/refresh`, {});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
108
|
knowledgeEntry({ base, name, environment = null, version = null }) {
|
|
124
109
|
return this.get(`/knowledge_bases/${encode(base)}/entries/${encode(name)}`, { environment, version });
|
|
125
110
|
}
|
|
@@ -137,21 +122,6 @@ export class ApiClient extends HttpClient {
|
|
|
137
122
|
return this.delete(`/knowledge_bases/${encode(base)}/entries/${encode(name)}${query({ environment })}`);
|
|
138
123
|
}
|
|
139
124
|
|
|
140
|
-
followKnowledgeSite({ base, url }) {
|
|
141
|
-
return this.post(`/knowledge_bases/${encode(base)}/sites`, { url });
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Addressed by the URL you typed rather than by an id you would have to look
|
|
145
|
-
// up first. It travels as a query parameter because a URL does not survive
|
|
146
|
-
// being a path segment.
|
|
147
|
-
unfollowKnowledgeSite({ base, url }) {
|
|
148
|
-
return this.delete(`/knowledge_bases/${encode(base)}/sites?url=${encode(url)}`);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
refreshKnowledgeSite({ base, url }) {
|
|
152
|
-
return this.post(`/knowledge_bases/${encode(base)}/sites/refresh`, { url });
|
|
153
|
-
}
|
|
154
|
-
|
|
155
125
|
// What the environment changed that live does not have yet.
|
|
156
126
|
knowledgeChanges(base, { environment = null } = {}) {
|
|
157
127
|
return this.get(`/knowledge_bases/${encode(base)}/changes`, { environment });
|
|
@@ -167,7 +137,7 @@ export class ApiClient extends HttpClient {
|
|
|
167
137
|
return this.get(`/knowledge_bases/${encode(base)}/history`);
|
|
168
138
|
}
|
|
169
139
|
|
|
170
|
-
// --- publishable tokens
|
|
140
|
+
// --- publishable tokens ------------------------------------------
|
|
171
141
|
|
|
172
142
|
listPublishableTokens() {
|
|
173
143
|
return this.get("/publishable_tokens");
|
|
@@ -188,121 +158,6 @@ export class ApiClient extends HttpClient {
|
|
|
188
158
|
return this.delete(`/publishable_tokens/${encode(prefix)}`);
|
|
189
159
|
}
|
|
190
160
|
|
|
191
|
-
widget() {
|
|
192
|
-
return this.get("/widget");
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// --- the shared WhatsApp preview ------------------------------------
|
|
196
|
-
|
|
197
|
-
listTestPhoneNumbers() {
|
|
198
|
-
return this.get("/test_phone_numbers");
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
addTestPhoneNumber({ phoneNumber, environment = null }) {
|
|
202
|
-
const body = { phone_number: phoneNumber };
|
|
203
|
-
if (environment) body.environment = environment;
|
|
204
|
-
return this.post("/test_phone_numbers", body);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Which environment the phone reaches on the shared number.
|
|
208
|
-
pointTestPhoneNumber({ phoneNumber, environment }) {
|
|
209
|
-
return this.patch(`/test_phone_numbers/${waId(phoneNumber)}`, { environment });
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
verifyTestPhoneNumber({ phoneNumber, code }) {
|
|
213
|
-
return this.post(`/test_phone_numbers/${waId(phoneNumber)}/verify`, { code });
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
resendTestPhoneNumberCode({ phoneNumber }) {
|
|
217
|
-
return this.post(`/test_phone_numbers/${waId(phoneNumber)}/resend`, {});
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
removeTestPhoneNumber({ phoneNumber }) {
|
|
221
|
-
return this.delete(`/test_phone_numbers/${waId(phoneNumber)}`);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// --- the workspace's own WhatsApp number ----------------------------
|
|
225
|
-
|
|
226
|
-
whatsappAccount() {
|
|
227
|
-
return this.get("/whatsapp_account");
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// Mints the URL for Meta's Embedded Signup and returns it; it connects
|
|
231
|
-
// nothing on its own. Same shape as instagramConnectLink.
|
|
232
|
-
whatsappConnectLink() {
|
|
233
|
-
return this.post("/whatsapp_account", {});
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
checkWhatsappAccount() {
|
|
237
|
-
return this.post("/whatsapp_account/check", {});
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
activateWhatsappAccount() {
|
|
241
|
-
return this.post("/whatsapp_account/activate", {});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
deactivateWhatsappAccount() {
|
|
245
|
-
return this.post("/whatsapp_account/deactivate", {});
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
disconnectWhatsappAccount() {
|
|
249
|
-
return this.delete("/whatsapp_account");
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
// --- Instagram ------------------------------------------------------
|
|
253
|
-
|
|
254
|
-
instagramAccount() {
|
|
255
|
-
return this.get("/instagram_account");
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
instagramConnectLink() {
|
|
259
|
-
return this.post("/instagram_account", {});
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
checkInstagramAccount() {
|
|
263
|
-
return this.post("/instagram_account/check", {});
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
disconnectInstagramAccount() {
|
|
267
|
-
return this.delete("/instagram_account");
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
listTestInstagramAccounts() {
|
|
271
|
-
return this.get("/test_instagram_accounts");
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
// Declares which Instagram account you mean. The code comes later, by DM,
|
|
275
|
-
// once that account writes to the shared preview -- Instagram will not let
|
|
276
|
-
// Vatio message an account that has not messaged it first.
|
|
277
|
-
addTestInstagramAccount({ username, environment = null }) {
|
|
278
|
-
const body = { username };
|
|
279
|
-
if (environment) body.environment = environment;
|
|
280
|
-
return this.post("/test_instagram_accounts", body);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// Which environment the account reaches on the shared one.
|
|
284
|
-
pointTestInstagramAccount({ id, environment }) {
|
|
285
|
-
return this.patch(`/test_instagram_accounts/${encode(id)}`, { environment });
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// Addressed by the code alone: the workspace is already in the path and the
|
|
289
|
-
// code is the only value the developer has in hand.
|
|
290
|
-
verifyTestInstagramAccount({ code }) {
|
|
291
|
-
return this.post("/test_instagram_accounts/verify", { code });
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
showTestInstagramAccount(id) {
|
|
295
|
-
return this.get(`/test_instagram_accounts/${encode(id)}`);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
resendTestInstagramAccountCode(id) {
|
|
299
|
-
return this.post(`/test_instagram_accounts/${encode(id)}/resend_otp`, {});
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
removeTestInstagramAccount(id) {
|
|
303
|
-
return this.delete(`/test_instagram_accounts/${encode(id)}`);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
161
|
// --- chats ----------------------------------------------------------
|
|
307
162
|
|
|
308
163
|
createChat({ environment }) {
|
|
@@ -315,7 +170,6 @@ export class ApiClient extends HttpClient {
|
|
|
315
170
|
|
|
316
171
|
// No `view` parameter: the developer token is the developer view, so the
|
|
317
172
|
// API returns one shape and the caller decides how much of it to print.
|
|
318
|
-
// `transcript` prints the visitor's half of it; `debug` prints all of it.
|
|
319
173
|
showChat({ chatId }) {
|
|
320
174
|
return this.get(`/chats/${encode(chatId)}`);
|
|
321
175
|
}
|
|
@@ -331,21 +185,18 @@ export class ApiClient extends HttpClient {
|
|
|
331
185
|
return this.post(`/chats/${encode(chatId)}/messages`, { content });
|
|
332
186
|
}
|
|
333
187
|
|
|
334
|
-
destroyChat({ chatId }) {
|
|
335
|
-
return this.delete(`/chats/${encode(chatId)}`);
|
|
336
|
-
}
|
|
337
188
|
}
|
|
338
189
|
|
|
339
|
-
// /
|
|
190
|
+
// /api/developer/v1/workspaces -- not workspace-scoped, so it takes the bare host.
|
|
340
191
|
export class CliClient extends HttpClient {
|
|
341
192
|
listWorkspaces() {
|
|
342
|
-
return this.get("/
|
|
193
|
+
return this.get("/api/developer/v1/workspaces");
|
|
343
194
|
}
|
|
344
195
|
|
|
345
196
|
createWorkspace({ slug, name = null }) {
|
|
346
197
|
const body = { slug };
|
|
347
198
|
if (String(name ?? "").trim() !== "") body.name = String(name).trim();
|
|
348
|
-
return this.post("/
|
|
199
|
+
return this.post("/api/developer/v1/workspaces", body);
|
|
349
200
|
}
|
|
350
201
|
|
|
351
202
|
async workspaceExists(slug) {
|
|
@@ -364,9 +215,3 @@ function query(params) {
|
|
|
364
215
|
const text = search.toString();
|
|
365
216
|
return text ? `?${text}` : "";
|
|
366
217
|
}
|
|
367
|
-
|
|
368
|
-
// The path carries the digits: "+" and spaces do not survive a URL, and the
|
|
369
|
-
// digits are what the API stores as `wa_id`.
|
|
370
|
-
function waId(phoneNumber) {
|
|
371
|
-
return String(phoneNumber ?? "").replace(/\D/g, "");
|
|
372
|
-
}
|
package/lib/bundle.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// The workspace directory as the bytes that go on the wire, for
|
|
2
|
-
// POST /api/v1/:slug/
|
|
2
|
+
// POST /api/developer/v1/:slug/check. The port of cli/lib/workspace_bundle.rb.
|
|
3
3
|
//
|
|
4
4
|
// There is deliberately no list here of "the files a manifest reads". That list
|
|
5
5
|
// *is* the contract -- `widget.logo` and `identity.public_key` name files from
|