mindwire 0.1.43 → 0.1.45

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.
@@ -1,57 +0,0 @@
1
- // src/errors.ts
2
- var MindwireError = class extends Error {
3
- constructor(message, options) {
4
- super(message, options);
5
- this.name = "MindwireError";
6
- }
7
- };
8
- var ApiError = class _ApiError extends MindwireError {
9
- status;
10
- url;
11
- method;
12
- body;
13
- constructor(args) {
14
- super(_ApiError.messageFor(args));
15
- this.name = "ApiError";
16
- this.status = args.status;
17
- this.url = args.url;
18
- this.method = args.method;
19
- this.body = args.body;
20
- }
21
- static messageFor({
22
- status,
23
- method,
24
- url,
25
- body
26
- }) {
27
- const detail = body && typeof body === "object" && "error" in body && typeof body.error === "string" ? body.error : typeof body === "string" && body.trim() !== "" ? body.trim() : "";
28
- const base = `${method} ${url} failed with ${status}`;
29
- return detail ? `${base}: ${detail}` : base;
30
- }
31
- };
32
- var RunFailedError = class extends MindwireError {
33
- status;
34
- runId;
35
- constructor(runId, status, detail) {
36
- super(detail ? `run ${runId} ${status}: ${detail}` : `run ${runId} ${status}`);
37
- this.name = "RunFailedError";
38
- this.runId = runId;
39
- this.status = status;
40
- }
41
- };
42
- var TimeoutError = class extends MindwireError {
43
- method;
44
- path;
45
- timeoutMs;
46
- constructor(method, path, timeoutMs) {
47
- super(`mindwire: ${method} ${path} timed out after ${timeoutMs}ms`);
48
- this.name = "TimeoutError";
49
- this.method = method;
50
- this.path = path;
51
- this.timeoutMs = timeoutMs;
52
- }
53
- };
54
-
55
- export { ApiError, MindwireError, RunFailedError, TimeoutError };
56
- //# sourceMappingURL=chunk-T6TD76UA.js.map
57
- //# sourceMappingURL=chunk-T6TD76UA.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";AACO,IAAM,aAAA,GAAN,cAA4B,KAAA,CAAM;AAAA,EACvC,WAAA,CAAY,SAAiB,OAAA,EAA+B;AAC1D,IA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EAAgB,MAAA,EAAiB;AAC1D,IAAA,KAAA,CAAM,MAAA,GAAS,CAAA,IAAA,EAAO,KAAK,CAAA,CAAA,EAAI,MAAM,CAAA,EAAA,EAAK,MAAM,CAAA,CAAA,GAAK,CAAA,IAAA,EAAO,KAAK,CAAA,CAAA,EAAI,MAAM,CAAA,CAAE,CAAA;AAC7E,IAAA,IAAA,CAAK,IAAA,GAAO,gBAAA;AACZ,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AACb,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AAAA,EAChB;AACF;AAOO,IAAM,YAAA,GAAN,cAA2B,aAAA,CAAc;AAAA,EACrC,MAAA;AAAA,EACA,IAAA;AAAA,EACA,SAAA;AAAA,EAET,WAAA,CAAY,MAAA,EAAgB,IAAA,EAAc,SAAA,EAAmB;AAC3D,IAAA,KAAA,CAAM,aAAa,MAAM,CAAA,CAAA,EAAI,IAAI,CAAA,iBAAA,EAAoB,SAAS,CAAA,EAAA,CAAI,CAAA;AAClE,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AACZ,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACnB;AACF","file":"chunk-T6TD76UA.js","sourcesContent":["/** Base class for every error thrown by the SDK. */\nexport class MindwireError extends Error {\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options);\n this.name = \"MindwireError\";\n }\n}\n\n/**\n * A non-2xx HTTP response from the daemon. `body` is the parsed JSON error payload when the\n * daemon returned one (it uses `{ \"error\": \"...\" }`), otherwise the raw text.\n */\nexport class ApiError extends MindwireError {\n readonly status: number;\n readonly url: string;\n readonly method: string;\n readonly body: unknown;\n\n constructor(args: { status: number; url: string; method: string; body: unknown }) {\n super(ApiError.messageFor(args));\n this.name = \"ApiError\";\n this.status = args.status;\n this.url = args.url;\n this.method = args.method;\n this.body = args.body;\n }\n\n private static messageFor({\n status,\n method,\n url,\n body,\n }: {\n status: number;\n method: string;\n url: string;\n body: unknown;\n }): string {\n const detail =\n body && typeof body === \"object\" && \"error\" in body && typeof body.error === \"string\"\n ? body.error\n : typeof body === \"string\" && body.trim() !== \"\"\n ? body.trim()\n : \"\";\n const base = `${method} ${url} failed with ${status}`;\n return detail ? `${base}: ${detail}` : base;\n }\n}\n\n/**\n * Thrown by {@link import(\"./run.js\").Run.wait} when a run ends in a non-success terminal state\n * (`error`/`cancelled`), or when the event stream ends before the run reaches any terminal state —\n * a dropped/truncated stream. The `status` is whatever the run was in when `wait()` gave up, so a\n * truncated stream surfaces as e.g. `run <id> running: event stream ended …` rather than silently\n * returning a success-shaped result.\n */\nexport class RunFailedError extends MindwireError {\n readonly status: string;\n readonly runId: string;\n\n constructor(runId: string, status: string, detail?: string) {\n super(detail ? `run ${runId} ${status}: ${detail}` : `run ${runId} ${status}`);\n this.name = \"RunFailedError\";\n this.runId = runId;\n this.status = status;\n }\n}\n\n/**\n * Thrown when a unary request exceeds the client's `requestTimeoutMs` deadline. A hung daemon or a\n * dead tunnel would otherwise block the caller forever; this bounds every non-streaming call. SSE\n * streams are long-lived and are never subject to this timeout.\n */\nexport class TimeoutError extends MindwireError {\n readonly method: string;\n readonly path: string;\n readonly timeoutMs: number;\n\n constructor(method: string, path: string, timeoutMs: number) {\n super(`mindwire: ${method} ${path} timed out after ${timeoutMs}ms`);\n this.name = \"TimeoutError\";\n this.method = method;\n this.path = path;\n this.timeoutMs = timeoutMs;\n }\n}\n"]}