@lotics/cli 0.313.2 → 0.313.4
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/src/cli.js +2290 -2555
- package/dist/src/client.d.ts +8 -1
- package/dist/src/client.js +27 -2
- package/docs/building_an_app.md +2 -1
- package/package.json +1 -1
package/dist/src/client.d.ts
CHANGED
|
@@ -118,6 +118,9 @@ export interface ToolExecuteResult {
|
|
|
118
118
|
* and the only part of a failure a caller may branch on. Absent when the
|
|
119
119
|
* failure was not a typed error, and from any server older than it. */
|
|
120
120
|
error_code?: string;
|
|
121
|
+
/** Whose words `error` is: `system` ours, `customer` a workspace author's (a table check's sentence). Absent from
|
|
122
|
+
* a server older than it. */
|
|
123
|
+
message_source?: "system" | "customer";
|
|
121
124
|
/** A refused input addressed per field: one sentence from a typed alias, a
|
|
122
125
|
* list from a refusing table check. */
|
|
123
126
|
field_errors?: Record<string, string> | Record<string, string[]>;
|
|
@@ -213,7 +216,11 @@ export interface ModelBinding {
|
|
|
213
216
|
export declare class LoticsRequestError extends Error {
|
|
214
217
|
readonly status: number;
|
|
215
218
|
readonly body: Record<string, unknown>;
|
|
216
|
-
|
|
219
|
+
/** What a command's record may say of it: the message only where the envelope marks it the server's own words. */
|
|
220
|
+
readonly telemetryMessage: string;
|
|
221
|
+
constructor(message: string, status: number, body: Record<string, unknown>,
|
|
222
|
+
/** What a command's record may say of it: the message only where the envelope marks it the server's own words. */
|
|
223
|
+
telemetryMessage: string);
|
|
217
224
|
}
|
|
218
225
|
/**
|
|
219
226
|
* The website: where a person goes when the CLI cannot finish the job. Held
|
package/dist/src/client.js
CHANGED
|
@@ -58,6 +58,24 @@ async function uploadParts(options) {
|
|
|
58
58
|
return done.sort((a, b) => a.part_number - b.part_number);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
// ../shared/src/transport_error.ts
|
|
62
|
+
function gatewayErrorMessage(status) {
|
|
63
|
+
if (status === 524) {
|
|
64
|
+
return "The request took too long to finish (gateway timeout). It may still be running \u2014 check back in a moment, or try again.";
|
|
65
|
+
}
|
|
66
|
+
if (status >= 500) {
|
|
67
|
+
return "The service is temporarily unavailable. Please try again shortly.";
|
|
68
|
+
}
|
|
69
|
+
return "The service returned an unexpected response. Please try again.";
|
|
70
|
+
}
|
|
71
|
+
function telemetryErrorMessage(status, parsed) {
|
|
72
|
+
if (parsed === null || typeof parsed !== "object") return gatewayErrorMessage(status);
|
|
73
|
+
const code = "code" in parsed && typeof parsed.code === "string" && parsed.code.length > 0 ? parsed.code : null;
|
|
74
|
+
const system = "message_source" in parsed && parsed.message_source === "system";
|
|
75
|
+
if (system && "message" in parsed && typeof parsed.message === "string") return parsed.message;
|
|
76
|
+
return code ?? gatewayErrorMessage(status);
|
|
77
|
+
}
|
|
78
|
+
|
|
61
79
|
// ../shared/src/cli_capabilities.ts
|
|
62
80
|
var CLI_CAPABILITIES_HEADER = "x-lotics-cli-capabilities";
|
|
63
81
|
var CLI_CAPABILITIES = ["docs-fallback"];
|
|
@@ -131,14 +149,16 @@ function getMimeType(filename) {
|
|
|
131
149
|
var MULTIPART_THRESHOLD_BYTES = 8 * 1024 * 1024;
|
|
132
150
|
var PROXY_BATCH_MAX_BYTES = PROXY_UPLOAD_MAX_BYTES / 2;
|
|
133
151
|
var LoticsRequestError = class extends Error {
|
|
134
|
-
constructor(message, status, body) {
|
|
152
|
+
constructor(message, status, body, telemetryMessage) {
|
|
135
153
|
super(message);
|
|
136
154
|
this.status = status;
|
|
137
155
|
this.body = body;
|
|
156
|
+
this.telemetryMessage = telemetryMessage;
|
|
138
157
|
this.name = "LoticsRequestError";
|
|
139
158
|
}
|
|
140
159
|
status;
|
|
141
160
|
body;
|
|
161
|
+
telemetryMessage;
|
|
142
162
|
};
|
|
143
163
|
var WEB_APP_URL = process.env.LOTICS_WEB_URL ?? "https://lotics.ai";
|
|
144
164
|
var PUBLIC_FETCH_TIMEOUT_MS = 1e4;
|
|
@@ -226,7 +246,12 @@ var LoticsClient = class {
|
|
|
226
246
|
const trace = requestId === void 0 ? "" : `
|
|
227
247
|
|
|
228
248
|
Request id: ${requestId} \u2014 quote this to Lotics support.`;
|
|
229
|
-
throw new LoticsRequestError(
|
|
249
|
+
throw new LoticsRequestError(
|
|
250
|
+
`${response.status}: ${message}${hint}${trace}`,
|
|
251
|
+
response.status,
|
|
252
|
+
body,
|
|
253
|
+
`${response.status}: ${telemetryErrorMessage(response.status, body)}${trace}`
|
|
254
|
+
);
|
|
230
255
|
}
|
|
231
256
|
/**
|
|
232
257
|
* The backend's `log()` middleware registers `user-agent`,
|
package/docs/building_an_app.md
CHANGED
|
@@ -192,7 +192,8 @@ on it, the `patch` adopting the decisions among them, and the app's body as the
|
|
|
192
192
|
leaves it (`draft`). `verdict_unread` says why none was read.
|
|
193
193
|
|
|
194
194
|
The app's `name`, `icon`, `theme` and `description` are keys of the app in the model, and each apply
|
|
195
|
-
writes them onto the app;
|
|
195
|
+
writes them onto the app; an `icon` or `description` the model leaves out is cleared, and an app
|
|
196
|
+
stating no `theme` is refused (`app.theme`). `lotics run update_app` changes them on
|
|
196
197
|
the app, and `lotics model pull` reads them back as the app holds them. The
|
|
197
198
|
`description` heads the capability listing the member's chat agent reads on **every** turn, so a
|
|
198
199
|
standing process the app expects that agent to carry out belongs there and nowhere else.
|