@maiaos/sdk 0.1.0-canary.44 → 0.1.0-canary.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.
package/dist/node/bridge.js
CHANGED
|
@@ -63,6 +63,7 @@ const streamsUnsupported = () => new MaiaClientError("transport_failure", "The b
|
|
|
63
63
|
message: "Attaching to a Session on this Node is not implemented: its SSH bridge predates streams. Update the Node, or follow the Session with 'maia session turn wait' and 'maia session turn show --include-content'.",
|
|
64
64
|
retryable: false,
|
|
65
65
|
},
|
|
66
|
+
synthetic: true,
|
|
66
67
|
});
|
|
67
68
|
const closedUnderStream = () => new MaiaClientError("transport_failure", "The Maia Node bridge closed under the Session stream.");
|
|
68
69
|
const refusedStream = (code) => {
|
|
@@ -71,6 +72,7 @@ const refusedStream = (code) => {
|
|
|
71
72
|
const message = "The bridge could not serve the Session stream.";
|
|
72
73
|
return new MaiaClientError(isClientCode(code) ? code : "remote_error", message, {
|
|
73
74
|
remoteError: { code, message, retryable: false },
|
|
75
|
+
synthetic: true,
|
|
74
76
|
});
|
|
75
77
|
};
|
|
76
78
|
const streamLost = () => new MaiaClientError("transport_failure", "The Session stream was lost; reattach after its cursor.");
|
package/dist/request/classify.js
CHANGED
|
@@ -40,7 +40,7 @@ const fromPlatform = (reason) => {
|
|
|
40
40
|
return undefined;
|
|
41
41
|
};
|
|
42
42
|
export const platformStoppedBeforeDispatch = (error) => fromPlatform(platformReason(error)) !== undefined;
|
|
43
|
-
const
|
|
43
|
+
const remoteKind = (remote) => {
|
|
44
44
|
if (remote.code === "outcome_unknown")
|
|
45
45
|
return classified("outcome_unknown", true, remote.code);
|
|
46
46
|
if (DENIED_CODES.has(remote.code))
|
|
@@ -53,6 +53,13 @@ const fromRemote = (remote) => {
|
|
|
53
53
|
return classified("unavailable", false, remote.code);
|
|
54
54
|
return classified("refused", remote.retryable, remote.code);
|
|
55
55
|
};
|
|
56
|
+
const SHOWN_MESSAGE_CODES = new Set(["saturated"]);
|
|
57
|
+
const fromRemote = (remote, synthetic) => ({
|
|
58
|
+
...remoteKind(remote),
|
|
59
|
+
...(synthetic === false && SHOWN_MESSAGE_CODES.has(remote.code)
|
|
60
|
+
? { message: remote.message }
|
|
61
|
+
: {}),
|
|
62
|
+
});
|
|
56
63
|
const unanswered = (code, mutation) => mutation
|
|
57
64
|
? classified("outcome_unknown", true, code)
|
|
58
65
|
: classified("offline", true, code);
|
|
@@ -85,7 +92,7 @@ const classify = (error, mutation) => {
|
|
|
85
92
|
return platform;
|
|
86
93
|
return error.remoteError === undefined
|
|
87
94
|
? fromClient(error, mutation)
|
|
88
|
-
: fromRemote(error.remoteError);
|
|
95
|
+
: fromRemote(error.remoteError, error.synthetic);
|
|
89
96
|
};
|
|
90
97
|
export const classifyClientError = (error, options) => ({
|
|
91
98
|
_tag: "MaiaError",
|
|
@@ -3,8 +3,10 @@ export type MaiaClientErrorCode = "cancelled" | "correlation_mismatch" | "invali
|
|
|
3
3
|
export declare class MaiaClientError extends Error {
|
|
4
4
|
readonly code: MaiaClientErrorCode;
|
|
5
5
|
readonly remoteError?: ProtocolError;
|
|
6
|
+
readonly synthetic: boolean;
|
|
6
7
|
constructor(code: MaiaClientErrorCode, message: string, options?: ErrorOptions & {
|
|
7
8
|
readonly remoteError?: ProtocolError;
|
|
9
|
+
readonly synthetic?: true;
|
|
8
10
|
});
|
|
9
11
|
static [Symbol.hasInstance](value: unknown): boolean;
|
|
10
12
|
}
|
|
@@ -2,11 +2,13 @@ const brand = Symbol.for("@maiaos/sdk/MaiaClientError");
|
|
|
2
2
|
export class MaiaClientError extends Error {
|
|
3
3
|
code;
|
|
4
4
|
remoteError;
|
|
5
|
+
synthetic;
|
|
5
6
|
constructor(code, message, options) {
|
|
6
7
|
super(message, options);
|
|
7
8
|
this.name = "MaiaClientError";
|
|
8
9
|
this.code = code;
|
|
9
10
|
this.remoteError = options?.remoteError;
|
|
11
|
+
this.synthetic = options?.synthetic === true;
|
|
10
12
|
Object.defineProperty(this, brand, { value: true });
|
|
11
13
|
}
|
|
12
14
|
static [Symbol.hasInstance](value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maiaos/sdk",
|
|
3
|
-
"version": "0.1.0-canary.
|
|
3
|
+
"version": "0.1.0-canary.45",
|
|
4
4
|
"description": "TypeScript SDK for Maia Node: typed, validated calls to create and drive AI coding agent Sessions (Claude Code, Codex), wait for turns and read receipts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"maia",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"typescript": "npm:@typescript/typescript6@6.0.2"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@maiaos/protocol": "0.1.0-canary.
|
|
75
|
+
"@maiaos/protocol": "0.1.0-canary.45",
|
|
76
76
|
"effect": "4.0.0"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|