@darqlabs/curator-sdk 0.1.6 → 0.3.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 +18 -0
- 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/graph.d.ts +307 -0
- package/dist/cjs/graph.d.ts.map +1 -0
- package/dist/cjs/graph.js +336 -0
- package/dist/cjs/graph.js.map +1 -0
- 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/streamEventParse.d.ts.map +1 -1
- package/dist/cjs/streamEventParse.js +12 -0
- package/dist/cjs/streamEventParse.js.map +1 -1
- package/dist/cjs/streamEvents.d.ts +30 -2
- package/dist/cjs/streamEvents.d.ts.map +1 -1
- package/dist/cjs/streamEvents.js +2 -1
- package/dist/cjs/streamEvents.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/graph.d.ts +307 -0
- package/dist/esm/graph.d.ts.map +1 -0
- package/dist/esm/graph.js +321 -0
- package/dist/esm/graph.js.map +1 -0
- 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/streamEventParse.d.ts.map +1 -1
- package/dist/esm/streamEventParse.js +12 -0
- package/dist/esm/streamEventParse.js.map +1 -1
- package/dist/esm/streamEvents.d.ts +30 -2
- package/dist/esm/streamEvents.d.ts.map +1 -1
- package/dist/esm/streamEvents.js +2 -1
- package/dist/esm/streamEvents.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/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/cjs/http.js
CHANGED
|
@@ -72,7 +72,7 @@ class HttpClient {
|
|
|
72
72
|
return value || undefined;
|
|
73
73
|
}
|
|
74
74
|
catch (err) {
|
|
75
|
-
throw new errors_js_1.
|
|
75
|
+
throw new errors_js_1.CuratorEndUserAuthError(`Failed to obtain end-user JWT: ${err.message}`);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
@@ -105,15 +105,22 @@ class HttpClient {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
catch (err) {
|
|
108
|
-
throw new errors_js_1.CuratorError(`Network error talking to ${finalUrl}: ${err.message}`, {
|
|
108
|
+
throw new errors_js_1.CuratorError(`Network error talking to ${finalUrl}: ${err.message}`, {
|
|
109
|
+
cause: err,
|
|
110
|
+
url: finalUrl,
|
|
111
|
+
userMessage: "Can't reach the assistant. Check your connection and try again.",
|
|
112
|
+
});
|
|
109
113
|
}
|
|
110
114
|
if (!response.ok) {
|
|
111
115
|
const text = await response.text().catch(() => "");
|
|
112
116
|
const body = text ? safeJsonParse(text) : undefined;
|
|
113
|
-
throw httpError(response.status, body, finalUrl);
|
|
117
|
+
throw httpError(response.status, body, finalUrl, response.headers.get("x-request-id"));
|
|
114
118
|
}
|
|
115
119
|
if (!response.body) {
|
|
116
|
-
throw new errors_js_1.CuratorError(`Streaming response had no body (${finalUrl})
|
|
120
|
+
throw new errors_js_1.CuratorError(`Streaming response had no body (${finalUrl})`, {
|
|
121
|
+
url: finalUrl,
|
|
122
|
+
status: response.status,
|
|
123
|
+
});
|
|
117
124
|
}
|
|
118
125
|
return response;
|
|
119
126
|
}
|
|
@@ -145,7 +152,11 @@ class HttpClient {
|
|
|
145
152
|
});
|
|
146
153
|
}
|
|
147
154
|
catch (err) {
|
|
148
|
-
throw new errors_js_1.CuratorError(`Network error talking to ${finalUrl}: ${err.message}`, {
|
|
155
|
+
throw new errors_js_1.CuratorError(`Network error talking to ${finalUrl}: ${err.message}`, {
|
|
156
|
+
cause: err,
|
|
157
|
+
url: finalUrl,
|
|
158
|
+
userMessage: "Can't reach the assistant. Check your connection and try again.",
|
|
159
|
+
});
|
|
149
160
|
}
|
|
150
161
|
finally {
|
|
151
162
|
if (timer)
|
|
@@ -157,7 +168,7 @@ class HttpClient {
|
|
|
157
168
|
const text = await response.text();
|
|
158
169
|
const body = text ? safeJsonParse(text) : undefined;
|
|
159
170
|
if (!response.ok) {
|
|
160
|
-
throw httpError(response.status, body, finalUrl);
|
|
171
|
+
throw httpError(response.status, body, finalUrl, response.headers.get("x-request-id"));
|
|
161
172
|
}
|
|
162
173
|
return body ?? undefined;
|
|
163
174
|
}
|
|
@@ -188,32 +199,73 @@ function safeJsonParse(text) {
|
|
|
188
199
|
return text;
|
|
189
200
|
}
|
|
190
201
|
}
|
|
191
|
-
|
|
202
|
+
/** Server error codes that mean the END-USER token failed, not the API key. */
|
|
203
|
+
const END_USER_AUTH_CODES = new Set([
|
|
204
|
+
"missing_end_user_jwt",
|
|
205
|
+
"end_user_jwt_invalid",
|
|
206
|
+
"end_user_jwt_expired",
|
|
207
|
+
"end_user_jwt_internal_error",
|
|
208
|
+
"end_user_session_invalid",
|
|
209
|
+
]);
|
|
210
|
+
function httpError(status, body, url, requestId = null) {
|
|
192
211
|
const detail = readErrorMessage(body);
|
|
212
|
+
const code = readErrorCode(body);
|
|
213
|
+
// `url` rides along as a PROPERTY, never inside `message`. A message that
|
|
214
|
+
// embeds the request URL ends up in a chat bubble the moment any consumer
|
|
215
|
+
// renders `err.message`, which is exactly how a deployment URL got shown to
|
|
216
|
+
// an end user.
|
|
217
|
+
const ctx = { status, code, requestId: requestId ?? readCorrelationId(body), url };
|
|
193
218
|
switch (status) {
|
|
194
219
|
case 401:
|
|
195
|
-
|
|
220
|
+
// Two different failures share this status. Distinguished by the server's
|
|
221
|
+
// error code so the SDK can say "sign in again" instead of sending the
|
|
222
|
+
// reader after an API key they cannot see.
|
|
223
|
+
return code && END_USER_AUTH_CODES.has(code)
|
|
224
|
+
? new errors_js_1.CuratorEndUserAuthError(detail ?? undefined, ctx)
|
|
225
|
+
: new errors_js_1.CuratorAuthError(detail ?? "Invalid or revoked API key", ctx);
|
|
196
226
|
case 403:
|
|
197
|
-
return new errors_js_1.CuratorForbiddenError(detail ?? "Permission denied");
|
|
227
|
+
return new errors_js_1.CuratorForbiddenError(detail ?? "Permission denied", ctx);
|
|
198
228
|
case 404:
|
|
199
|
-
return new errors_js_1.CuratorNotFoundError(detail ?? "Resource not found");
|
|
229
|
+
return new errors_js_1.CuratorNotFoundError(detail ?? "Resource not found", ctx);
|
|
200
230
|
case 410: {
|
|
201
231
|
const retiredAt = body && typeof body === "object" && "details" in body
|
|
202
232
|
? (body.details
|
|
203
233
|
?.retired_at ?? null)
|
|
204
234
|
: null;
|
|
205
|
-
return new errors_js_1.CuratorDeploymentRetiredError(detail ?? "Deployment has been retired", retiredAt);
|
|
235
|
+
return new errors_js_1.CuratorDeploymentRetiredError(detail ?? "Deployment has been retired", retiredAt, ctx);
|
|
206
236
|
}
|
|
207
237
|
case 429: {
|
|
208
238
|
const retry = body && typeof body === "object" && "retryAfter" in body
|
|
209
239
|
? Number(body.retryAfter)
|
|
210
240
|
: null;
|
|
211
|
-
return new errors_js_1.CuratorRateLimitError(detail ?? undefined, Number.isFinite(retry) ? retry : null);
|
|
241
|
+
return new errors_js_1.CuratorRateLimitError(detail ?? undefined, Number.isFinite(retry) ? retry : null, ctx);
|
|
212
242
|
}
|
|
213
243
|
default:
|
|
214
|
-
|
|
244
|
+
if (status >= 500) {
|
|
245
|
+
return new errors_js_1.CuratorServerError(`HTTP ${status} from ${url}${detail ? `: ${detail}` : ""}`, ctx);
|
|
246
|
+
}
|
|
247
|
+
return new errors_js_1.CuratorError(`HTTP ${status} from ${url}${detail ? `: ${detail}` : ""}`, ctx);
|
|
215
248
|
}
|
|
216
249
|
}
|
|
250
|
+
function readErrorCode(body) {
|
|
251
|
+
if (!body || typeof body !== "object")
|
|
252
|
+
return null;
|
|
253
|
+
const b = body;
|
|
254
|
+
if (b.error && typeof b.error === "object") {
|
|
255
|
+
const inner = b.error;
|
|
256
|
+
if (typeof inner.code === "string")
|
|
257
|
+
return inner.code;
|
|
258
|
+
}
|
|
259
|
+
if (typeof b.code === "string")
|
|
260
|
+
return b.code;
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
function readCorrelationId(body) {
|
|
264
|
+
if (!body || typeof body !== "object")
|
|
265
|
+
return null;
|
|
266
|
+
const b = body;
|
|
267
|
+
return typeof b.correlationId === "string" ? b.correlationId : null;
|
|
268
|
+
}
|
|
217
269
|
function readErrorMessage(body) {
|
|
218
270
|
if (!body || typeof body !== "object")
|
|
219
271
|
return undefined;
|
package/dist/cjs/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/http.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAEH,2CASoB;AAwDpB,MAAa,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,wBAAY,CAAC,uDAAuD,CAAC,CAAA;QACjF,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QACzB,IAAI,CAAC,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/C,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,UAAU,CAAA;QACzC,wEAAwE;QACxE,sEAAsE;QACtE,wEAAwE;QACxE,sEAAsE;QACtE,+DAA+D;QAC/D,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAA;QACpC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAoC,CAAC,CAAA;QAClH,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,wBAAY,CACpB,+GAA+G,CAChH,CAAA;QACH,CAAC;QACD,IAAI,CAAC,cAAc,GAAG,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,CAAA;IAClD,CAAC;IAED,yDAAy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,MAAM,CAAC,GAAG,IAAmC,CAAA;IAC7C,OAAO,OAAO,CAAC,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAA;AACrE,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAa;IACrC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAA;IACvD,MAAM,CAAC,GAAG,IAA8C,CAAA;IACxD,IAAI,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC,KAAK,CAAA;IAC/C,IAAI,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC3C,MAAM,KAAK,GAAG,CAAC,CAAC,KAA8B,CAAA;QAC9C,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC,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/cjs/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/cjs/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/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTerminalStreamEvent = exports.GmailIntegration = exports.Integrations = exports.CuratorTimeoutError = exports.CuratorAgentError = exports.CuratorAuthorizationRequiredError = exports.CuratorApprovalRequiredError = exports.CuratorRateLimitError = exports.CuratorDeploymentRetiredError = exports.CuratorNotFoundError = exports.CuratorForbiddenError = exports.CuratorAuthError = exports.CuratorError = exports.Files = exports.Chat = exports.Agent = exports.Curator = void 0;
|
|
3
|
+
exports.isTerminalStreamEvent = exports.GmailIntegration = exports.Integrations = exports.parseDelegationFailureCode = exports.DEFAULT_USER_MESSAGE = exports.CuratorTimeoutError = exports.CuratorAgentError = exports.CuratorAuthorizationRequiredError = exports.CuratorApprovalRequiredError = exports.CuratorServerError = exports.CuratorRateLimitError = exports.CuratorDeploymentRetiredError = exports.CuratorNotFoundError = exports.CuratorForbiddenError = exports.CuratorEndUserAuthError = exports.CuratorAuthError = exports.CuratorError = exports.Files = exports.Chat = exports.Agent = exports.Curator = void 0;
|
|
4
4
|
var client_js_1 = require("./client.js");
|
|
5
5
|
Object.defineProperty(exports, "Curator", { enumerable: true, get: function () { return client_js_1.Curator; } });
|
|
6
6
|
Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return client_js_1.Agent; } });
|
|
@@ -10,14 +10,18 @@ Object.defineProperty(exports, "Files", { enumerable: true, get: function () { r
|
|
|
10
10
|
var errors_js_1 = require("./errors.js");
|
|
11
11
|
Object.defineProperty(exports, "CuratorError", { enumerable: true, get: function () { return errors_js_1.CuratorError; } });
|
|
12
12
|
Object.defineProperty(exports, "CuratorAuthError", { enumerable: true, get: function () { return errors_js_1.CuratorAuthError; } });
|
|
13
|
+
Object.defineProperty(exports, "CuratorEndUserAuthError", { enumerable: true, get: function () { return errors_js_1.CuratorEndUserAuthError; } });
|
|
13
14
|
Object.defineProperty(exports, "CuratorForbiddenError", { enumerable: true, get: function () { return errors_js_1.CuratorForbiddenError; } });
|
|
14
15
|
Object.defineProperty(exports, "CuratorNotFoundError", { enumerable: true, get: function () { return errors_js_1.CuratorNotFoundError; } });
|
|
15
16
|
Object.defineProperty(exports, "CuratorDeploymentRetiredError", { enumerable: true, get: function () { return errors_js_1.CuratorDeploymentRetiredError; } });
|
|
16
17
|
Object.defineProperty(exports, "CuratorRateLimitError", { enumerable: true, get: function () { return errors_js_1.CuratorRateLimitError; } });
|
|
18
|
+
Object.defineProperty(exports, "CuratorServerError", { enumerable: true, get: function () { return errors_js_1.CuratorServerError; } });
|
|
17
19
|
Object.defineProperty(exports, "CuratorApprovalRequiredError", { enumerable: true, get: function () { return errors_js_1.CuratorApprovalRequiredError; } });
|
|
18
20
|
Object.defineProperty(exports, "CuratorAuthorizationRequiredError", { enumerable: true, get: function () { return errors_js_1.CuratorAuthorizationRequiredError; } });
|
|
19
21
|
Object.defineProperty(exports, "CuratorAgentError", { enumerable: true, get: function () { return errors_js_1.CuratorAgentError; } });
|
|
20
22
|
Object.defineProperty(exports, "CuratorTimeoutError", { enumerable: true, get: function () { return errors_js_1.CuratorTimeoutError; } });
|
|
23
|
+
Object.defineProperty(exports, "DEFAULT_USER_MESSAGE", { enumerable: true, get: function () { return errors_js_1.DEFAULT_USER_MESSAGE; } });
|
|
24
|
+
Object.defineProperty(exports, "parseDelegationFailureCode", { enumerable: true, get: function () { return errors_js_1.parseDelegationFailureCode; } });
|
|
21
25
|
var integrations_js_1 = require("./integrations.js");
|
|
22
26
|
Object.defineProperty(exports, "Integrations", { enumerable: true, get: function () { return integrations_js_1.Integrations; } });
|
|
23
27
|
Object.defineProperty(exports, "GmailIntegration", { enumerable: true, get: function () { return integrations_js_1.GmailIntegration; } });
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAAkD;AAAzC,oGAAA,OAAO,OAAA;AAAE,kGAAA,KAAK,OAAA;AAAE,iGAAA,IAAI,OAAA;AAG7B,uCAAkC;AAAzB,iGAAA,KAAK,OAAA;AAOd,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,yCAAkD;AAAzC,oGAAA,OAAO,OAAA;AAAE,kGAAA,KAAK,OAAA;AAAE,iGAAA,IAAI,OAAA;AAG7B,uCAAkC;AAAzB,iGAAA,KAAK,OAAA;AAOd,yCAeoB;AAdlB,yGAAA,YAAY,OAAA;AACZ,6GAAA,gBAAgB,OAAA;AAChB,oHAAA,uBAAuB,OAAA;AACvB,kHAAA,qBAAqB,OAAA;AACrB,iHAAA,oBAAoB,OAAA;AACpB,0HAAA,6BAA6B,OAAA;AAC7B,kHAAA,qBAAqB,OAAA;AACrB,+GAAA,kBAAkB,OAAA;AAClB,yHAAA,4BAA4B,OAAA;AAC5B,8HAAA,iCAAiC,OAAA;AACjC,8GAAA,iBAAiB,OAAA;AACjB,gHAAA,mBAAmB,OAAA;AACnB,iHAAA,oBAAoB,OAAA;AACpB,uHAAA,0BAA0B,OAAA;AAmB5B,qDAAkE;AAAzD,+GAAA,YAAY,OAAA;AAAE,mHAAA,gBAAgB,OAAA;AAavC,qDAAyD;AAAhD,wHAAA,qBAAqB,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamEventParse.d.ts","sourceRoot":"","sources":["../../src/streamEventParse.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,GAAG,WAAW,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"streamEventParse.d.ts","sourceRoot":"","sources":["../../src/streamEventParse.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,GAAG,WAAW,GAAG,IAAI,CA0GtE"}
|
|
@@ -36,6 +36,18 @@ function frameToStreamEvent(frame) {
|
|
|
36
36
|
capabilityId: String(data.capability_id),
|
|
37
37
|
durationMs: Number(data.duration_ms ?? 0),
|
|
38
38
|
};
|
|
39
|
+
case "tool_call.failed":
|
|
40
|
+
return {
|
|
41
|
+
type: "tool_call.failed",
|
|
42
|
+
toolCallId: String(data.tool_call_id),
|
|
43
|
+
toolName: String(data.tool_name),
|
|
44
|
+
capabilityId: String(data.capability_id),
|
|
45
|
+
// Narrow to the known vocabulary rather than trusting the wire. A
|
|
46
|
+
// reason this SDK build has never heard of degrades to `tool_error`
|
|
47
|
+
// (the recoverable, less alarming of the two) instead of widening the
|
|
48
|
+
// union at runtime and breaking an exhaustive switch in user code.
|
|
49
|
+
reason: data.reason === "policy_denied" ? "policy_denied" : "tool_error",
|
|
50
|
+
};
|
|
39
51
|
case "state":
|
|
40
52
|
return {
|
|
41
53
|
type: "state",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamEventParse.js","sourceRoot":"","sources":["../../src/streamEventParse.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAKH,
|
|
1
|
+
{"version":3,"file":"streamEventParse.js","sourceRoot":"","sources":["../../src/streamEventParse.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAKH,gDA0GC;AA1GD,SAAgB,kBAAkB,CAAC,KAAe;IAChD,IAAI,IAAS,CAAA;IACb,IAAI,CAAC;QACH,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;IACD,QAAQ,KAAK,CAAC,KAAK,EAAE,CAAC;QACpB,KAAK,OAAO;YACV,OAAO,EAAE,IAAI,EAAE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AChC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,CAAC;aACnD,CAAA;QACH,KAAK,0BAA0B;YAC7B,OAAO;gBACL,IAAI,EAAE,0BAA0B;gBAChC,aAAa,EAAE,IAAI,CAAC,aAAa;gBACjC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;gBAChC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,CAAC;aACnD,CAAA;QACH;YACE,sEAAsE;YACtE,iCAAiC;YACjC,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC"}
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* lives on the server.
|
|
7
7
|
*
|
|
8
8
|
* Terminal events (`done`, `error`, `paused_for_approval`) end the
|
|
9
|
-
* iterator. `delta` and `tool_call.*` events arrive incrementally
|
|
9
|
+
* iterator. `delta` and `tool_call.*` events arrive incrementally — note that
|
|
10
|
+
* `tool_call.failed` is NOT terminal: a tool failing does not end the run.
|
|
10
11
|
*/
|
|
11
12
|
import type { AgentFailureClass, ApprovalDetails, AuthorizationDetails, AssistantMessage } from "./types";
|
|
12
13
|
/** Incremental token delta from the agent. */
|
|
@@ -29,6 +30,33 @@ export interface StreamToolCallCompleted {
|
|
|
29
30
|
capabilityId: string;
|
|
30
31
|
durationMs: number;
|
|
31
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* A tool call ended without succeeding. Non-terminal — the agent sees the
|
|
35
|
+
* failure and usually keeps working; the run continues.
|
|
36
|
+
*
|
|
37
|
+
* Every `tool_call.started` is followed by exactly one `tool_call.completed`
|
|
38
|
+
* or `tool_call.failed` carrying the same `toolCallId`, so a UI tracking
|
|
39
|
+
* concurrent tool calls can always close the right pending indicator.
|
|
40
|
+
*
|
|
41
|
+
* `reason` is a closed vocabulary, not a message:
|
|
42
|
+
*
|
|
43
|
+
* - `policy_denied` — a policy or budget gate blocked the call. Retrying
|
|
44
|
+
* cannot help. Render something like "This action wasn't allowed."
|
|
45
|
+
* - `tool_error` — the tool ran and failed (bad argument, provider 4xx,
|
|
46
|
+
* timeout). Often correctable. Render something like "The tool couldn't
|
|
47
|
+
* complete."
|
|
48
|
+
*
|
|
49
|
+
* Deliberately no free text: the underlying reason can name internal policies,
|
|
50
|
+
* user ids and exception details, none of which belong on an end-user surface.
|
|
51
|
+
* Treat an unrecognised `reason` as a generic failure — more may be added.
|
|
52
|
+
*/
|
|
53
|
+
export interface StreamToolCallFailed {
|
|
54
|
+
type: "tool_call.failed";
|
|
55
|
+
toolCallId: string;
|
|
56
|
+
toolName: string;
|
|
57
|
+
capabilityId: string;
|
|
58
|
+
reason: "policy_denied" | "tool_error";
|
|
59
|
+
}
|
|
32
60
|
/**
|
|
33
61
|
* Non-terminal: the agent reported its current structured result state for
|
|
34
62
|
* this turn. Fires on every turn the agent reports state (including mid-run,
|
|
@@ -102,6 +130,6 @@ export interface StreamPausedForAuthorization {
|
|
|
102
130
|
runId: string;
|
|
103
131
|
conversationId: string;
|
|
104
132
|
}
|
|
105
|
-
export type StreamEvent = StreamDelta | StreamToolCallStarted | StreamToolCallCompleted | StreamState | StreamPlanProgress | StreamDone | StreamError | StreamPausedForApproval | StreamPausedForAuthorization;
|
|
133
|
+
export type StreamEvent = StreamDelta | StreamToolCallStarted | StreamToolCallCompleted | StreamToolCallFailed | StreamState | StreamPlanProgress | StreamDone | StreamError | StreamPausedForApproval | StreamPausedForAuthorization;
|
|
106
134
|
export declare function isTerminalStreamEvent(e: StreamEvent): boolean;
|
|
107
135
|
//# sourceMappingURL=streamEvents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamEvents.d.ts","sourceRoot":"","sources":["../../src/streamEvents.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"streamEvents.d.ts","sourceRoot":"","sources":["../../src/streamEvents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,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,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAE7D"}
|
package/dist/cjs/streamEvents.js
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* lives on the server.
|
|
8
8
|
*
|
|
9
9
|
* Terminal events (`done`, `error`, `paused_for_approval`) end the
|
|
10
|
-
* iterator. `delta` and `tool_call.*` events arrive incrementally
|
|
10
|
+
* iterator. `delta` and `tool_call.*` events arrive incrementally — note that
|
|
11
|
+
* `tool_call.failed` is NOT terminal: a tool failing does not end the run.
|
|
11
12
|
*/
|
|
12
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
14
|
exports.isTerminalStreamEvent = isTerminalStreamEvent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamEvents.js","sourceRoot":"","sources":["../../src/streamEvents.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"streamEvents.js","sourceRoot":"","sources":["../../src/streamEvents.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AA8JH,sDAEC;AATD,MAAM,cAAc,GAAqC,IAAI,GAAG,CAAC;IAC/D,MAAM;IACN,OAAO;IACP,qBAAqB;IACrB,0BAA0B;CAC3B,CAAC,CAAA;AAEF,SAAgB,qBAAqB,CAAC,CAAc;IAClD,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AACnC,CAAC"}
|
package/dist/esm/errors.d.ts
CHANGED
|
@@ -10,31 +10,99 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { AssistantMessage, ApprovalDetails, AuthorizationDetails, AgentFailureClass } from "./types.js";
|
|
12
12
|
export declare class CuratorError extends Error {
|
|
13
|
+
/**
|
|
14
|
+
* What an END USER may be shown.
|
|
15
|
+
*
|
|
16
|
+
* `message` is for developers — it can name the request, the status, and the
|
|
17
|
+
* server's own wording. That is the wrong text to put in a chat bubble, and
|
|
18
|
+
* shipping it there is not a hypothetical: a 500 rendered as
|
|
19
|
+
* `HTTP 500 from https://api.../agents/<slug>/conversations: …`, exposing the
|
|
20
|
+
* deployment's URL to whoever was chatting, and an end-user token failure
|
|
21
|
+
* rendered as "End-user JWT could not be verified", which tells the person
|
|
22
|
+
* nothing they can act on and leaks the auth mechanism.
|
|
23
|
+
*
|
|
24
|
+
* Every subclass sets this to something safe and actionable. `renderError` in
|
|
25
|
+
* the React bindings prefers it and never falls back to `message`, so a new
|
|
26
|
+
* error type is safe-by-default rather than leaky-by-default.
|
|
27
|
+
*/
|
|
28
|
+
readonly userMessage: string;
|
|
29
|
+
/** HTTP status, when this came from a response. */
|
|
30
|
+
readonly status: number | null;
|
|
31
|
+
/** Server error code (`error.code`), when present. */
|
|
32
|
+
readonly code: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Correlation id from `x-request-id` / `correlationId`. The one detail worth
|
|
35
|
+
* showing a user on an unexpected failure — it is what support can trace,
|
|
36
|
+
* and it says nothing about the system's shape.
|
|
37
|
+
*/
|
|
38
|
+
readonly requestId: string | null;
|
|
39
|
+
/**
|
|
40
|
+
* Request URL, as a PROPERTY rather than part of `message`. Available for
|
|
41
|
+
* logs and bug reports without riding along into anything user-visible.
|
|
42
|
+
*/
|
|
43
|
+
readonly url: string | null;
|
|
13
44
|
constructor(message: string, options?: {
|
|
14
45
|
cause?: unknown;
|
|
46
|
+
userMessage?: string;
|
|
47
|
+
status?: number | null;
|
|
48
|
+
code?: string | null;
|
|
49
|
+
requestId?: string | null;
|
|
50
|
+
url?: string | null;
|
|
15
51
|
});
|
|
16
52
|
}
|
|
53
|
+
/** Last-resort user-facing text. Deliberately says nothing about the system. */
|
|
54
|
+
export declare const DEFAULT_USER_MESSAGE = "Something went wrong. Please try again.";
|
|
55
|
+
/** Appends a correlation id when there is one, so support has a handle. */
|
|
56
|
+
export declare function withRequestId(text: string, requestId: string | null): string;
|
|
57
|
+
type HttpContext = {
|
|
58
|
+
status?: number | null;
|
|
59
|
+
code?: string | null;
|
|
60
|
+
requestId?: string | null;
|
|
61
|
+
url?: string | null;
|
|
62
|
+
};
|
|
17
63
|
/** HTTP 401 from the API — your API key is missing, invalid, or revoked. */
|
|
18
64
|
export declare class CuratorAuthError extends CuratorError {
|
|
19
|
-
constructor(message?: string);
|
|
65
|
+
constructor(message?: string, ctx?: HttpContext);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* HTTP 401 specifically because the END-USER token was missing, expired, or
|
|
69
|
+
* unverifiable — distinct from `CuratorAuthError`, which is about the
|
|
70
|
+
* integrator's API key.
|
|
71
|
+
*
|
|
72
|
+
* Separate because the remediation is completely different: an API-key failure
|
|
73
|
+
* needs a developer, whereas this one is usually a stale session the user fixes
|
|
74
|
+
* by signing in again. Collapsing them produced "Authentication failed. Check
|
|
75
|
+
* your API key." in response to an expired user token, which sends the reader
|
|
76
|
+
* after the wrong thing entirely.
|
|
77
|
+
*/
|
|
78
|
+
export declare class CuratorEndUserAuthError extends CuratorError {
|
|
79
|
+
constructor(message?: string, ctx?: HttpContext);
|
|
20
80
|
}
|
|
21
81
|
/** HTTP 403 from the API — your API key doesn't have permission for this action. */
|
|
22
82
|
export declare class CuratorForbiddenError extends CuratorError {
|
|
23
|
-
constructor(message?: string);
|
|
83
|
+
constructor(message?: string, ctx?: HttpContext);
|
|
24
84
|
}
|
|
25
85
|
/** HTTP 404 from the API — the deployment slug or conversation id wasn't found. */
|
|
26
86
|
export declare class CuratorNotFoundError extends CuratorError {
|
|
27
|
-
constructor(message?: string);
|
|
87
|
+
constructor(message?: string, ctx?: HttpContext);
|
|
28
88
|
}
|
|
29
89
|
/** HTTP 410 from the API — the deployment was retired. */
|
|
30
90
|
export declare class CuratorDeploymentRetiredError extends CuratorError {
|
|
31
91
|
readonly retiredAt: string | null;
|
|
32
|
-
constructor(message: string, retiredAt: string | null);
|
|
92
|
+
constructor(message: string, retiredAt: string | null, ctx?: HttpContext);
|
|
33
93
|
}
|
|
34
94
|
/** HTTP 429 from the API — back off. */
|
|
35
95
|
export declare class CuratorRateLimitError extends CuratorError {
|
|
36
96
|
readonly retryAfterSeconds: number | null;
|
|
37
|
-
constructor(message?: string, retryAfterSeconds?: number | null);
|
|
97
|
+
constructor(message?: string, retryAfterSeconds?: number | null, ctx?: HttpContext);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* HTTP 5xx. The server already returns a generic body plus a `correlationId`
|
|
101
|
+
* for unexpected failures, so the useful thing to surface is that id — not the
|
|
102
|
+
* status line and URL the SDK used to build into `message`.
|
|
103
|
+
*/
|
|
104
|
+
export declare class CuratorServerError extends CuratorError {
|
|
105
|
+
constructor(message: string, ctx?: HttpContext);
|
|
38
106
|
}
|
|
39
107
|
/**
|
|
40
108
|
* Run paused waiting for human approval. Approval resolution is not
|
|
@@ -69,6 +137,22 @@ export declare class CuratorAuthorizationRequiredError extends CuratorError {
|
|
|
69
137
|
runId: string;
|
|
70
138
|
});
|
|
71
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Delegated-identity failure codes, mirroring the server's taxonomy in
|
|
142
|
+
* `delegationFailure.ts`. Four outcomes because each implies a DIFFERENT next
|
|
143
|
+
* action, and collapsing them is what makes "why did this fail only after the
|
|
144
|
+
* approval?" unanswerable.
|
|
145
|
+
*
|
|
146
|
+
* `AgentFailureClass` has no delegated variant, and the errored payload carries
|
|
147
|
+
* no structured code — the server prefixes the failure MESSAGE with the code
|
|
148
|
+
* instead. So this is recovered by parsing that prefix, which is a real
|
|
149
|
+
* coupling: if the server stops prefixing, `delegationCode` silently goes null
|
|
150
|
+
* and the user gets the generic agent-error text. The durable fix is a
|
|
151
|
+
* first-class field on the errored event; until then the prefix is the contract.
|
|
152
|
+
*/
|
|
153
|
+
export type DelegationFailureCode = "DELEGATED_IDENTITY_EXPIRED" | "DELEGATED_IDENTITY_REVOKED" | "DELEGATED_TOKEN_EXCHANGE_FAILED" | "DOWNSTREAM_AUTH_REJECTED" | "DELEGATED_AUTH_NOT_CONFIGURED";
|
|
154
|
+
/** Recover the delegated-failure code from a server message prefix. */
|
|
155
|
+
export declare function parseDelegationFailureCode(message: string | undefined): DelegationFailureCode | null;
|
|
72
156
|
/**
|
|
73
157
|
* The agent run reached a terminal error state (LLM quota, auth, 5xx
|
|
74
158
|
* exhausted retries, etc.). `failureClass` and `isPermanent` mirror the
|
|
@@ -80,6 +164,12 @@ export declare class CuratorAgentError extends CuratorError {
|
|
|
80
164
|
readonly conversationId: string;
|
|
81
165
|
readonly runId: string;
|
|
82
166
|
readonly stepId: string | null;
|
|
167
|
+
/**
|
|
168
|
+
* Set when the run failed on delegated identity. Distinct from
|
|
169
|
+
* `failureClass`, which has no delegated variant — see
|
|
170
|
+
* {@link DelegationFailureCode}.
|
|
171
|
+
*/
|
|
172
|
+
readonly delegationCode: DelegationFailureCode | null;
|
|
83
173
|
constructor(args: {
|
|
84
174
|
message: string;
|
|
85
175
|
failureClass: AgentFailureClass;
|
|
@@ -104,4 +194,5 @@ export declare class CuratorTimeoutError extends CuratorError {
|
|
|
104
194
|
continueWaiting: (timeoutMs?: number) => Promise<AssistantMessage>;
|
|
105
195
|
});
|
|
106
196
|
}
|
|
197
|
+
export {};
|
|
107
198
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/esm/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,YAAY,CAAA;AAEnB,qBAAa,YAAa,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,YAAY,CAAA;AAEnB,q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