@darqlabs/curator-sdk 0.2.0 → 0.3.1
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/cjs/client.js +6 -0
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/errors.d.ts +96 -5
- package/dist/cjs/errors.d.ts.map +1 -1
- package/dist/cjs/errors.js +181 -15
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/http.d.ts.map +1 -1
- package/dist/cjs/http.js +65 -13
- package/dist/cjs/http.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types.d.ts +12 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/client.js +6 -0
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/errors.d.ts +96 -5
- package/dist/esm/errors.d.ts.map +1 -1
- package/dist/esm/errors.js +176 -14
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/http.d.ts.map +1 -1
- package/dist/esm/http.js +66 -14
- package/dist/esm/http.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types.d.ts +12 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/esm/errors.js
CHANGED
|
@@ -9,9 +9,45 @@
|
|
|
9
9
|
* backstop.
|
|
10
10
|
*/
|
|
11
11
|
export class CuratorError extends Error {
|
|
12
|
+
/**
|
|
13
|
+
* What an END USER may be shown.
|
|
14
|
+
*
|
|
15
|
+
* `message` is for developers — it can name the request, the status, and the
|
|
16
|
+
* server's own wording. That is the wrong text to put in a chat bubble, and
|
|
17
|
+
* shipping it there is not a hypothetical: a 500 rendered as
|
|
18
|
+
* `HTTP 500 from https://api.../agents/<slug>/conversations: …`, exposing the
|
|
19
|
+
* deployment's URL to whoever was chatting, and an end-user token failure
|
|
20
|
+
* rendered as "End-user JWT could not be verified", which tells the person
|
|
21
|
+
* nothing they can act on and leaks the auth mechanism.
|
|
22
|
+
*
|
|
23
|
+
* Every subclass sets this to something safe and actionable. `renderError` in
|
|
24
|
+
* the React bindings prefers it and never falls back to `message`, so a new
|
|
25
|
+
* error type is safe-by-default rather than leaky-by-default.
|
|
26
|
+
*/
|
|
27
|
+
userMessage;
|
|
28
|
+
/** HTTP status, when this came from a response. */
|
|
29
|
+
status;
|
|
30
|
+
/** Server error code (`error.code`), when present. */
|
|
31
|
+
code;
|
|
32
|
+
/**
|
|
33
|
+
* Correlation id from `x-request-id` / `correlationId`. The one detail worth
|
|
34
|
+
* showing a user on an unexpected failure — it is what support can trace,
|
|
35
|
+
* and it says nothing about the system's shape.
|
|
36
|
+
*/
|
|
37
|
+
requestId;
|
|
38
|
+
/**
|
|
39
|
+
* Request URL, as a PROPERTY rather than part of `message`. Available for
|
|
40
|
+
* logs and bug reports without riding along into anything user-visible.
|
|
41
|
+
*/
|
|
42
|
+
url;
|
|
12
43
|
constructor(message, options) {
|
|
13
44
|
super(message);
|
|
14
45
|
this.name = "CuratorError";
|
|
46
|
+
this.userMessage = options?.userMessage ?? DEFAULT_USER_MESSAGE;
|
|
47
|
+
this.status = options?.status ?? null;
|
|
48
|
+
this.code = options?.code ?? null;
|
|
49
|
+
this.requestId = options?.requestId ?? null;
|
|
50
|
+
this.url = options?.url ?? null;
|
|
15
51
|
// Preserve the underlying error if the runtime supports it.
|
|
16
52
|
if (options?.cause !== undefined) {
|
|
17
53
|
;
|
|
@@ -19,32 +55,65 @@ export class CuratorError extends Error {
|
|
|
19
55
|
}
|
|
20
56
|
}
|
|
21
57
|
}
|
|
58
|
+
/** Last-resort user-facing text. Deliberately says nothing about the system. */
|
|
59
|
+
export const DEFAULT_USER_MESSAGE = "Something went wrong. Please try again.";
|
|
60
|
+
/** Appends a correlation id when there is one, so support has a handle. */
|
|
61
|
+
export function withRequestId(text, requestId) {
|
|
62
|
+
return requestId ? `${text} (reference: ${requestId})` : text;
|
|
63
|
+
}
|
|
22
64
|
/** HTTP 401 from the API — your API key is missing, invalid, or revoked. */
|
|
23
65
|
export class CuratorAuthError extends CuratorError {
|
|
24
|
-
constructor(message = "Invalid or revoked API key") {
|
|
25
|
-
|
|
66
|
+
constructor(message = "Invalid or revoked API key", ctx = {}) {
|
|
67
|
+
// The API key is the INTEGRATOR's credential. An end user can do nothing
|
|
68
|
+
// about it and should not be told which credential failed.
|
|
69
|
+
super(message, { ...ctx, userMessage: "This chat isn't available right now. Please try again later." });
|
|
26
70
|
this.name = "CuratorAuthError";
|
|
27
71
|
}
|
|
28
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* HTTP 401 specifically because the END-USER token was missing, expired, or
|
|
75
|
+
* unverifiable — distinct from `CuratorAuthError`, which is about the
|
|
76
|
+
* integrator's API key.
|
|
77
|
+
*
|
|
78
|
+
* Separate because the remediation is completely different: an API-key failure
|
|
79
|
+
* needs a developer, whereas this one is usually a stale session the user fixes
|
|
80
|
+
* by signing in again. Collapsing them produced "Authentication failed. Check
|
|
81
|
+
* your API key." in response to an expired user token, which sends the reader
|
|
82
|
+
* after the wrong thing entirely.
|
|
83
|
+
*/
|
|
84
|
+
export class CuratorEndUserAuthError extends CuratorError {
|
|
85
|
+
constructor(message = "End-user token could not be verified", ctx = {}) {
|
|
86
|
+
super(message, {
|
|
87
|
+
...ctx,
|
|
88
|
+
userMessage: "Your session has expired. Please sign in again to continue.",
|
|
89
|
+
});
|
|
90
|
+
this.name = "CuratorEndUserAuthError";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
29
93
|
/** HTTP 403 from the API — your API key doesn't have permission for this action. */
|
|
30
94
|
export class CuratorForbiddenError extends CuratorError {
|
|
31
|
-
constructor(message = "Permission denied") {
|
|
32
|
-
super(message);
|
|
95
|
+
constructor(message = "Permission denied", ctx = {}) {
|
|
96
|
+
super(message, { ...ctx, userMessage: "You don't have access to this." });
|
|
33
97
|
this.name = "CuratorForbiddenError";
|
|
34
98
|
}
|
|
35
99
|
}
|
|
36
100
|
/** HTTP 404 from the API — the deployment slug or conversation id wasn't found. */
|
|
37
101
|
export class CuratorNotFoundError extends CuratorError {
|
|
38
|
-
constructor(message = "Resource not found") {
|
|
39
|
-
|
|
102
|
+
constructor(message = "Resource not found", ctx = {}) {
|
|
103
|
+
// Says nothing about WHICH resource: on a 404 the slug is often the thing
|
|
104
|
+
// that is wrong, and echoing it back tells a prober they guessed close.
|
|
105
|
+
super(message, { ...ctx, userMessage: "This chat isn't available." });
|
|
40
106
|
this.name = "CuratorNotFoundError";
|
|
41
107
|
}
|
|
42
108
|
}
|
|
43
109
|
/** HTTP 410 from the API — the deployment was retired. */
|
|
44
110
|
export class CuratorDeploymentRetiredError extends CuratorError {
|
|
45
111
|
retiredAt;
|
|
46
|
-
constructor(message, retiredAt) {
|
|
47
|
-
super(message
|
|
112
|
+
constructor(message, retiredAt, ctx = {}) {
|
|
113
|
+
super(message, {
|
|
114
|
+
...ctx,
|
|
115
|
+
userMessage: "This assistant is no longer available.",
|
|
116
|
+
});
|
|
48
117
|
this.name = "CuratorDeploymentRetiredError";
|
|
49
118
|
this.retiredAt = retiredAt;
|
|
50
119
|
}
|
|
@@ -52,12 +121,31 @@ export class CuratorDeploymentRetiredError extends CuratorError {
|
|
|
52
121
|
/** HTTP 429 from the API — back off. */
|
|
53
122
|
export class CuratorRateLimitError extends CuratorError {
|
|
54
123
|
retryAfterSeconds;
|
|
55
|
-
constructor(message = "Rate limit exceeded", retryAfterSeconds = null) {
|
|
56
|
-
super(message
|
|
124
|
+
constructor(message = "Rate limit exceeded", retryAfterSeconds = null, ctx = {}) {
|
|
125
|
+
super(message, {
|
|
126
|
+
...ctx,
|
|
127
|
+
userMessage: retryAfterSeconds
|
|
128
|
+
? `Too many messages. Please wait ${retryAfterSeconds} seconds and try again.`
|
|
129
|
+
: "Too many messages. Please wait a moment and try again.",
|
|
130
|
+
});
|
|
57
131
|
this.name = "CuratorRateLimitError";
|
|
58
132
|
this.retryAfterSeconds = retryAfterSeconds;
|
|
59
133
|
}
|
|
60
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* HTTP 5xx. The server already returns a generic body plus a `correlationId`
|
|
137
|
+
* for unexpected failures, so the useful thing to surface is that id — not the
|
|
138
|
+
* status line and URL the SDK used to build into `message`.
|
|
139
|
+
*/
|
|
140
|
+
export class CuratorServerError extends CuratorError {
|
|
141
|
+
constructor(message, ctx = {}) {
|
|
142
|
+
super(message, {
|
|
143
|
+
...ctx,
|
|
144
|
+
userMessage: withRequestId("Something went wrong on our end. Please try again.", ctx.requestId ?? null),
|
|
145
|
+
});
|
|
146
|
+
this.name = "CuratorServerError";
|
|
147
|
+
}
|
|
148
|
+
}
|
|
61
149
|
/**
|
|
62
150
|
* Run paused waiting for human approval. Approval resolution is not
|
|
63
151
|
* exposed to API consumers — pauses are routed through the dashboard
|
|
@@ -71,7 +159,10 @@ export class CuratorApprovalRequiredError extends CuratorError {
|
|
|
71
159
|
runId;
|
|
72
160
|
constructor(args) {
|
|
73
161
|
super(`Run paused for approval — the '${args.approval.tool_name}' tool needs an administrator to review it. ` +
|
|
74
|
-
"Contact your administrator to resolve this in the Curator dashboard."
|
|
162
|
+
"Contact your administrator to resolve this in the Curator dashboard.", {
|
|
163
|
+
userMessage: `That action needs administrator approval. Someone has been asked to review the ` +
|
|
164
|
+
`"${args.approval.tool_name}" request.`,
|
|
165
|
+
});
|
|
75
166
|
this.name = "CuratorApprovalRequiredError";
|
|
76
167
|
this.approval = args.approval;
|
|
77
168
|
this.conversationId = args.conversationId;
|
|
@@ -92,13 +183,62 @@ export class CuratorAuthorizationRequiredError extends CuratorError {
|
|
|
92
183
|
super(`Run paused for authorization — connect ${args.authorization.provider} to continue. ` +
|
|
93
184
|
(args.authorization.connect_url
|
|
94
185
|
? `Connect at ${args.authorization.connect_url}, then resume the conversation.`
|
|
95
|
-
: "Connect the provider, then resume the conversation.")
|
|
186
|
+
: "Connect the provider, then resume the conversation."), {
|
|
187
|
+
// `reason` is authored for the end user by the integration; prefer it.
|
|
188
|
+
userMessage: args.authorization.reason ||
|
|
189
|
+
`Connect your ${args.authorization.provider} account to continue.`,
|
|
190
|
+
});
|
|
96
191
|
this.name = "CuratorAuthorizationRequiredError";
|
|
97
192
|
this.authorization = args.authorization;
|
|
98
193
|
this.conversationId = args.conversationId;
|
|
99
194
|
this.runId = args.runId;
|
|
100
195
|
}
|
|
101
196
|
}
|
|
197
|
+
const DELEGATION_CODES = [
|
|
198
|
+
"DELEGATED_IDENTITY_EXPIRED",
|
|
199
|
+
"DELEGATED_IDENTITY_REVOKED",
|
|
200
|
+
"DELEGATED_TOKEN_EXCHANGE_FAILED",
|
|
201
|
+
"DOWNSTREAM_AUTH_REJECTED",
|
|
202
|
+
"DELEGATED_AUTH_NOT_CONFIGURED",
|
|
203
|
+
];
|
|
204
|
+
/** Recover the delegated-failure code from a server message prefix. */
|
|
205
|
+
export function parseDelegationFailureCode(message) {
|
|
206
|
+
if (!message)
|
|
207
|
+
return null;
|
|
208
|
+
for (const code of DELEGATION_CODES) {
|
|
209
|
+
if (message.startsWith(`${code}:`))
|
|
210
|
+
return code;
|
|
211
|
+
}
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* End-user text per delegated-failure code. The split that matters is WHO can
|
|
216
|
+
* fix it: expiry is the user's to resolve by re-authenticating, revocation and
|
|
217
|
+
* scope gaps need an administrator, and the exchange/config failures are ours
|
|
218
|
+
* and must not be phrased as the user's fault.
|
|
219
|
+
*/
|
|
220
|
+
function delegationUserMessage(code) {
|
|
221
|
+
switch (code) {
|
|
222
|
+
case "DELEGATED_IDENTITY_EXPIRED":
|
|
223
|
+
// The common one: a run paused past the assertion's lifetime. Retrying
|
|
224
|
+
// the same request is futile, so the text must ask for a NEW session
|
|
225
|
+
// rather than inviting another attempt.
|
|
226
|
+
return "Your session expired before that could finish. Please sign in again and retry.";
|
|
227
|
+
case "DELEGATED_IDENTITY_REVOKED":
|
|
228
|
+
// Server-side this pages someone — it means a context was crossed or
|
|
229
|
+
// probed. Never hint at the mechanism; the user just lacks authority.
|
|
230
|
+
return "You don't have permission to complete that action. Please contact your administrator.";
|
|
231
|
+
case "DOWNSTREAM_AUTH_REJECTED":
|
|
232
|
+
// Exchange worked; the resource server said no. A scope/permission gap on
|
|
233
|
+
// the customer's side, so an administrator is the right destination.
|
|
234
|
+
return "Your account doesn't have access to what that action needed. Please contact your administrator.";
|
|
235
|
+
case "DELEGATED_TOKEN_EXCHANGE_FAILED":
|
|
236
|
+
case "DELEGATED_AUTH_NOT_CONFIGURED":
|
|
237
|
+
// Ours to fix. Do not tell the user to sign in — it will not help, and it
|
|
238
|
+
// sends them chasing a problem they cannot see.
|
|
239
|
+
return "That action isn't available right now. Please try again later.";
|
|
240
|
+
}
|
|
241
|
+
}
|
|
102
242
|
/**
|
|
103
243
|
* The agent run reached a terminal error state (LLM quota, auth, 5xx
|
|
104
244
|
* exhausted retries, etc.). `failureClass` and `isPermanent` mirror the
|
|
@@ -110,9 +250,29 @@ export class CuratorAgentError extends CuratorError {
|
|
|
110
250
|
conversationId;
|
|
111
251
|
runId;
|
|
112
252
|
stepId;
|
|
253
|
+
/**
|
|
254
|
+
* Set when the run failed on delegated identity. Distinct from
|
|
255
|
+
* `failureClass`, which has no delegated variant — see
|
|
256
|
+
* {@link DelegationFailureCode}.
|
|
257
|
+
*/
|
|
258
|
+
delegationCode;
|
|
113
259
|
constructor(args) {
|
|
114
|
-
|
|
260
|
+
const delegationCode = parseDelegationFailureCode(args.message);
|
|
261
|
+
super(args.message, {
|
|
262
|
+
// NOT `args.message`: the run's failure text is written for an operator
|
|
263
|
+
// and can name providers, quotas, or step ids. A delegated failure gets
|
|
264
|
+
// its own text because the server already told us who can fix it —
|
|
265
|
+
// throwing that away and falling back to `isPermanent` is how an expired
|
|
266
|
+
// session became "couldn't complete that request", which is true and
|
|
267
|
+
// useless when "sign in again" was the answer.
|
|
268
|
+
userMessage: delegationCode
|
|
269
|
+
? delegationUserMessage(delegationCode)
|
|
270
|
+
: args.isPermanent
|
|
271
|
+
? "The assistant couldn't complete that request. Please try rephrasing, or contact support."
|
|
272
|
+
: "The assistant hit a temporary problem. Please try again.",
|
|
273
|
+
});
|
|
115
274
|
this.name = "CuratorAgentError";
|
|
275
|
+
this.delegationCode = delegationCode;
|
|
116
276
|
this.failureClass = args.failureClass;
|
|
117
277
|
this.isPermanent = args.isPermanent;
|
|
118
278
|
this.conversationId = args.conversationId;
|
|
@@ -130,7 +290,9 @@ export class CuratorTimeoutError extends CuratorError {
|
|
|
130
290
|
runId;
|
|
131
291
|
continueWaiting;
|
|
132
292
|
constructor(args) {
|
|
133
|
-
super("Timed out waiting for the agent to reply — the run is still in progress."
|
|
293
|
+
super("Timed out waiting for the agent to reply — the run is still in progress.", {
|
|
294
|
+
userMessage: "This is taking longer than usual. It may still finish — check back in a moment.",
|
|
295
|
+
});
|
|
134
296
|
this.name = "CuratorTimeoutError";
|
|
135
297
|
this.conversationId = args.conversationId;
|
|
136
298
|
this.runId = args.runId;
|
package/dist/esm/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC;;;;;;;;;;;;;;OAcG;IACM,WAAW,CAAQ;IAC5B,mDAAmD;IAC1C,MAAM,CAAe;IAC9B,sDAAsD;IAC7C,IAAI,CAAe;IAC5B;;;;OAIG;IACM,SAAS,CAAe;IACjC;;;OAGG;IACM,GAAG,CAAe;IAE3B,YACE,O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IX;QACC,KAAK,CAAC,0EAA0E,EAAE;YAChF,WAAW,EACT,iFAAiF;SACpF,CAAC,CAAA;QACF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;QACjC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAA;QACzC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;QACvB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAA;IAC7C,CAAC;CACF"}
|
package/dist/esm/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAYH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAA;IAC1B,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,yCAAyC;IACzC,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,GAC1B,MAAM,GACN,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;AAEvD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,gEAAgE;IAChE,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;IACpB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACvC;;;;OAIG;IACH,UAAU,CAAC,EAAE,kBAAkB,CAAA;CAChC;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAA;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;IAC7D,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,oEAAoE;IACpE,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAc;IACxC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAwB;IACvD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAoB;gBAE5C,IAAI,EAAE,iBAAiB;IAsBnC,yDAAyD;IACzD,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM;IAgB9C;;;;;;OAMG;YACW,iBAAiB;IAc/B;;;;;OAKG;IACG,UAAU,CACd,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAO,GACnF,OAAO,CAAC,QAAQ,CAAC;IAgDd,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC;CAuDrE"}
|
package/dist/esm/http.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* Everything else (retries, conversation state, waiting) lives in the
|
|
12
12
|
* higher-level classes that consume this transport.
|
|
13
13
|
*/
|
|
14
|
-
import { CuratorAuthError, CuratorDeploymentRetiredError, CuratorError, CuratorForbiddenError, CuratorNotFoundError, CuratorRateLimitError, } from "./errors.js";
|
|
14
|
+
import { CuratorAuthError, CuratorDeploymentRetiredError, CuratorEndUserAuthError, CuratorError, CuratorForbiddenError, CuratorNotFoundError, CuratorRateLimitError, CuratorServerError, } from "./errors.js";
|
|
15
15
|
export class HttpClient {
|
|
16
16
|
apiKey;
|
|
17
17
|
baseUrl;
|
|
@@ -69,7 +69,7 @@ export class HttpClient {
|
|
|
69
69
|
return value || undefined;
|
|
70
70
|
}
|
|
71
71
|
catch (err) {
|
|
72
|
-
throw new
|
|
72
|
+
throw new CuratorEndUserAuthError(`Failed to obtain end-user JWT: ${err.message}`);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
@@ -102,15 +102,22 @@ export class HttpClient {
|
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
catch (err) {
|
|
105
|
-
throw new CuratorError(`Network error talking to ${finalUrl}: ${err.message}`, {
|
|
105
|
+
throw new CuratorError(`Network error talking to ${finalUrl}: ${err.message}`, {
|
|
106
|
+
cause: err,
|
|
107
|
+
url: finalUrl,
|
|
108
|
+
userMessage: "Can't reach the assistant. Check your connection and try again.",
|
|
109
|
+
});
|
|
106
110
|
}
|
|
107
111
|
if (!response.ok) {
|
|
108
112
|
const text = await response.text().catch(() => "");
|
|
109
113
|
const body = text ? safeJsonParse(text) : undefined;
|
|
110
|
-
throw httpError(response.status, body, finalUrl);
|
|
114
|
+
throw httpError(response.status, body, finalUrl, response.headers.get("x-request-id"));
|
|
111
115
|
}
|
|
112
116
|
if (!response.body) {
|
|
113
|
-
throw new CuratorError(`Streaming response had no body (${finalUrl})
|
|
117
|
+
throw new CuratorError(`Streaming response had no body (${finalUrl})`, {
|
|
118
|
+
url: finalUrl,
|
|
119
|
+
status: response.status,
|
|
120
|
+
});
|
|
114
121
|
}
|
|
115
122
|
return response;
|
|
116
123
|
}
|
|
@@ -142,7 +149,11 @@ export class HttpClient {
|
|
|
142
149
|
});
|
|
143
150
|
}
|
|
144
151
|
catch (err) {
|
|
145
|
-
throw new CuratorError(`Network error talking to ${finalUrl}: ${err.message}`, {
|
|
152
|
+
throw new CuratorError(`Network error talking to ${finalUrl}: ${err.message}`, {
|
|
153
|
+
cause: err,
|
|
154
|
+
url: finalUrl,
|
|
155
|
+
userMessage: "Can't reach the assistant. Check your connection and try again.",
|
|
156
|
+
});
|
|
146
157
|
}
|
|
147
158
|
finally {
|
|
148
159
|
if (timer)
|
|
@@ -154,7 +165,7 @@ export class HttpClient {
|
|
|
154
165
|
const text = await response.text();
|
|
155
166
|
const body = text ? safeJsonParse(text) : undefined;
|
|
156
167
|
if (!response.ok) {
|
|
157
|
-
throw httpError(response.status, body, finalUrl);
|
|
168
|
+
throw httpError(response.status, body, finalUrl, response.headers.get("x-request-id"));
|
|
158
169
|
}
|
|
159
170
|
return body ?? undefined;
|
|
160
171
|
}
|
|
@@ -184,32 +195,73 @@ function safeJsonParse(text) {
|
|
|
184
195
|
return text;
|
|
185
196
|
}
|
|
186
197
|
}
|
|
187
|
-
|
|
198
|
+
/** Server error codes that mean the END-USER token failed, not the API key. */
|
|
199
|
+
const END_USER_AUTH_CODES = new Set([
|
|
200
|
+
"missing_end_user_jwt",
|
|
201
|
+
"end_user_jwt_invalid",
|
|
202
|
+
"end_user_jwt_expired",
|
|
203
|
+
"end_user_jwt_internal_error",
|
|
204
|
+
"end_user_session_invalid",
|
|
205
|
+
]);
|
|
206
|
+
function httpError(status, body, url, requestId = null) {
|
|
188
207
|
const detail = readErrorMessage(body);
|
|
208
|
+
const code = readErrorCode(body);
|
|
209
|
+
// `url` rides along as a PROPERTY, never inside `message`. A message that
|
|
210
|
+
// embeds the request URL ends up in a chat bubble the moment any consumer
|
|
211
|
+
// renders `err.message`, which is exactly how a deployment URL got shown to
|
|
212
|
+
// an end user.
|
|
213
|
+
const ctx = { status, code, requestId: requestId ?? readCorrelationId(body), url };
|
|
189
214
|
switch (status) {
|
|
190
215
|
case 401:
|
|
191
|
-
|
|
216
|
+
// Two different failures share this status. Distinguished by the server's
|
|
217
|
+
// error code so the SDK can say "sign in again" instead of sending the
|
|
218
|
+
// reader after an API key they cannot see.
|
|
219
|
+
return code && END_USER_AUTH_CODES.has(code)
|
|
220
|
+
? new CuratorEndUserAuthError(detail ?? undefined, ctx)
|
|
221
|
+
: new CuratorAuthError(detail ?? "Invalid or revoked API key", ctx);
|
|
192
222
|
case 403:
|
|
193
|
-
return new CuratorForbiddenError(detail ?? "Permission denied");
|
|
223
|
+
return new CuratorForbiddenError(detail ?? "Permission denied", ctx);
|
|
194
224
|
case 404:
|
|
195
|
-
return new CuratorNotFoundError(detail ?? "Resource not found");
|
|
225
|
+
return new CuratorNotFoundError(detail ?? "Resource not found", ctx);
|
|
196
226
|
case 410: {
|
|
197
227
|
const retiredAt = body && typeof body === "object" && "details" in body
|
|
198
228
|
? (body.details
|
|
199
229
|
?.retired_at ?? null)
|
|
200
230
|
: null;
|
|
201
|
-
return new CuratorDeploymentRetiredError(detail ?? "Deployment has been retired", retiredAt);
|
|
231
|
+
return new CuratorDeploymentRetiredError(detail ?? "Deployment has been retired", retiredAt, ctx);
|
|
202
232
|
}
|
|
203
233
|
case 429: {
|
|
204
234
|
const retry = body && typeof body === "object" && "retryAfter" in body
|
|
205
235
|
? Number(body.retryAfter)
|
|
206
236
|
: null;
|
|
207
|
-
return new CuratorRateLimitError(detail ?? undefined, Number.isFinite(retry) ? retry : null);
|
|
237
|
+
return new CuratorRateLimitError(detail ?? undefined, Number.isFinite(retry) ? retry : null, ctx);
|
|
208
238
|
}
|
|
209
239
|
default:
|
|
210
|
-
|
|
240
|
+
if (status >= 500) {
|
|
241
|
+
return new CuratorServerError(`HTTP ${status} from ${url}${detail ? `: ${detail}` : ""}`, ctx);
|
|
242
|
+
}
|
|
243
|
+
return new CuratorError(`HTTP ${status} from ${url}${detail ? `: ${detail}` : ""}`, ctx);
|
|
211
244
|
}
|
|
212
245
|
}
|
|
246
|
+
function readErrorCode(body) {
|
|
247
|
+
if (!body || typeof body !== "object")
|
|
248
|
+
return null;
|
|
249
|
+
const b = body;
|
|
250
|
+
if (b.error && typeof b.error === "object") {
|
|
251
|
+
const inner = b.error;
|
|
252
|
+
if (typeof inner.code === "string")
|
|
253
|
+
return inner.code;
|
|
254
|
+
}
|
|
255
|
+
if (typeof b.code === "string")
|
|
256
|
+
return b.code;
|
|
257
|
+
return null;
|
|
258
|
+
}
|
|
259
|
+
function readCorrelationId(body) {
|
|
260
|
+
if (!body || typeof body !== "object")
|
|
261
|
+
return null;
|
|
262
|
+
const b = body;
|
|
263
|
+
return typeof b.correlationId === "string" ? b.correlationId : null;
|
|
264
|
+
}
|
|
213
265
|
function readErrorMessage(body) {
|
|
214
266
|
if (!body || typeof body !== "object")
|
|
215
267
|
return undefined;
|
package/dist/esm/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,aAAa,CAAA;AAwDpB,MAAM,OAAO,UAAU;IACJ,MAAM,CAAQ;IACd,OAAO,CAAQ;IACf,SAAS,CAAc;IACvB,cAAc,CAAwB;IACtC,kBAAkB,CAAqB;IAExD,YAAY,IAAuB;QACjC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,YAAY,CAAC,uDAAuD,CAAC,CAAA;QACjF,CAAC;QACD,IAAI,CAAC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AAC,OAAO,CAAA;IAC7D,CAAC;IACD,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC,OAAO,CAAA;IACnD,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export type { CuratorOptions, AgentLocator } from "./client.js";
|
|
|
3
3
|
export type { EndUserJwtProvider } from "./http.js";
|
|
4
4
|
export { Files } from "./files.js";
|
|
5
5
|
export type { PresignUploadInput, PresignUploadResult, OneShotUploadInput, UploadData, } from "./files.js";
|
|
6
|
-
export { CuratorError, CuratorAuthError, CuratorForbiddenError, CuratorNotFoundError, CuratorDeploymentRetiredError, CuratorRateLimitError, CuratorApprovalRequiredError, CuratorAuthorizationRequiredError, CuratorAgentError, CuratorTimeoutError, } from "./errors.js";
|
|
6
|
+
export { CuratorError, CuratorAuthError, CuratorEndUserAuthError, CuratorForbiddenError, CuratorNotFoundError, CuratorDeploymentRetiredError, CuratorRateLimitError, CuratorServerError, CuratorApprovalRequiredError, CuratorAuthorizationRequiredError, CuratorAgentError, CuratorTimeoutError, DEFAULT_USER_MESSAGE, parseDelegationFailureCode, } from "./errors.js";
|
|
7
|
+
export type { DelegationFailureCode } from "./errors.js";
|
|
7
8
|
export type { AssistantMessage, UserMessage, ToolMessage, ConversationMessage, Environment, FileAttachment, ApprovalDetails, AuthorizationDetails, AgentFailureClass, SendOptions, HistoryOptions, HistoryPage, DeploymentConfig, EndUserConnection, } from "./types.js";
|
|
8
9
|
export { Integrations, GmailIntegration } from "./integrations.js";
|
|
9
10
|
export type { StreamEvent, StreamDelta, StreamToolCallStarted, StreamToolCallCompleted, StreamState, StreamPlanProgress, StreamDone, StreamError, StreamPausedForApproval, StreamPausedForAuthorization, } from "./streamEvents.js";
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,GACX,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,qBAAqB,EACrB,4BAA4B,EAC5B,iCAAiC,EACjC,iBAAiB,EACjB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAClD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,GACX,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,EAC5B,iCAAiC,EACjC,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACxD,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAClE,YAAY,EACV,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,WAAW,EACX,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Curator, Agent, Chat } from "./client.js";
|
|
2
2
|
export { Files } from "./files.js";
|
|
3
|
-
export { CuratorError, CuratorAuthError, CuratorForbiddenError, CuratorNotFoundError, CuratorDeploymentRetiredError, CuratorRateLimitError, CuratorApprovalRequiredError, CuratorAuthorizationRequiredError, CuratorAgentError, CuratorTimeoutError, } from "./errors.js";
|
|
3
|
+
export { CuratorError, CuratorAuthError, CuratorEndUserAuthError, CuratorForbiddenError, CuratorNotFoundError, CuratorDeploymentRetiredError, CuratorRateLimitError, CuratorServerError, CuratorApprovalRequiredError, CuratorAuthorizationRequiredError, CuratorAgentError, CuratorTimeoutError, DEFAULT_USER_MESSAGE, parseDelegationFailureCode, } from "./errors.js";
|
|
4
4
|
export { Integrations, GmailIntegration } from "./integrations.js";
|
|
5
5
|
export { isTerminalStreamEvent } from "./streamEvents.js";
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAGlD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAOlC,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,qBAAqB,EACrB,4BAA4B,EAC5B,iCAAiC,EACjC,iBAAiB,EACjB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAGlD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAOlC,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,EAC5B,iCAAiC,EACjC,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,aAAa,CAAA;AAkBpB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAalE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -33,6 +33,18 @@ export interface UserMessage {
|
|
|
33
33
|
content: string;
|
|
34
34
|
sequence: number;
|
|
35
35
|
createdAt: string;
|
|
36
|
+
/**
|
|
37
|
+
* Files the person attached to this message.
|
|
38
|
+
*
|
|
39
|
+
* `content` is the text as typed. The server renders a file-reference
|
|
40
|
+
* envelope into the prompt the model sees, but not into the stored message —
|
|
41
|
+
* so this field, not the text, is how a transcript gets a filename to show.
|
|
42
|
+
*
|
|
43
|
+
* Absent on messages without attachments, and on messages written before the
|
|
44
|
+
* server stored them structurally (those still carry the envelope inline in
|
|
45
|
+
* `content`; see `splitAttachmentEnvelope` in the React package).
|
|
46
|
+
*/
|
|
47
|
+
attachments?: FileAttachment[];
|
|
36
48
|
}
|
|
37
49
|
export interface ToolMessage {
|
|
38
50
|
role: "tool";
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,SAAS,GAAG,aAAa,CAAA;AAElE,MAAM,WAAW,gBAAgB,CAAC,SAAS,GAAG,OAAO;IACnD,IAAI,EAAE,WAAW,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf;;;;;;;OAOG;IACH,QAAQ,EAAE,SAAS,GAAG,IAAI,CAAA;IAC1B,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAA;IAChB,2DAA2D;IAC3D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,SAAS,GAAG,aAAa,CAAA;AAElE,MAAM,WAAW,gBAAgB,CAAC,SAAS,GAAG,OAAO;IACnD,IAAI,EAAE,WAAW,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf;;;;;;;OAOG;IACH,QAAQ,EAAE,SAAS,GAAG,IAAI,CAAA;IAC1B,kDAAkD;IAClD,QAAQ,EAAE,MAAM,CAAA;IAChB,2DAA2D;IAC3D,MAAM,EA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