mandala-computer-mcp 0.1.1 → 0.4.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 +139 -24
- package/dist/api.d.ts +19 -6
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +355 -76
- package/dist/api.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +113 -8
- package/dist/cli.js.map +1 -1
- package/dist/errors.d.ts +100 -12
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +169 -29
- package/dist/errors.js.map +1 -1
- package/dist/events.d.ts +45 -4
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +422 -114
- package/dist/events.js.map +1 -1
- package/dist/format.d.ts +48 -0
- package/dist/format.d.ts.map +1 -1
- package/dist/format.js +111 -4
- package/dist/format.js.map +1 -1
- package/dist/http-body.d.ts +17 -0
- package/dist/http-body.d.ts.map +1 -0
- package/dist/http-body.js +48 -0
- package/dist/http-body.js.map +1 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +177 -51
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +17 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/limits.js +17 -0
- package/dist/limits.js.map +1 -0
- package/dist/paths.d.ts +30 -20
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +89 -25
- package/dist/paths.js.map +1 -1
- package/dist/poll.d.ts +107 -0
- package/dist/poll.d.ts.map +1 -0
- package/dist/poll.js +233 -0
- package/dist/poll.js.map +1 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +2 -1
- package/dist/server.js.map +1 -1
- package/dist/tools/agent.d.ts.map +1 -1
- package/dist/tools/agent.js +72 -5
- package/dist/tools/agent.js.map +1 -1
- package/dist/tools/computers.d.ts.map +1 -1
- package/dist/tools/computers.js +559 -233
- package/dist/tools/computers.js.map +1 -1
- package/dist/tools/events.d.ts.map +1 -1
- package/dist/tools/events.js +359 -69
- package/dist/tools/events.js.map +1 -1
- package/dist/tools/guest.d.ts.map +1 -1
- package/dist/tools/guest.js +234 -33
- package/dist/tools/guest.js.map +1 -1
- package/dist/tools/input.d.ts.map +1 -1
- package/dist/tools/input.js +92 -8
- package/dist/tools/input.js.map +1 -1
- package/dist/tools/snapshots.d.ts.map +1 -1
- package/dist/tools/snapshots.js +501 -33
- package/dist/tools/snapshots.js.map +1 -1
- package/dist/tools/templates.d.ts.map +1 -1
- package/dist/tools/templates.js +61 -26
- package/dist/tools/templates.js.map +1 -1
- package/dist/tools/webhooks.d.ts.map +1 -1
- package/dist/tools/webhooks.js +116 -17
- package/dist/tools/webhooks.js.map +1 -1
- package/package.json +3 -2
package/dist/errors.js
CHANGED
|
@@ -19,12 +19,14 @@ export class MandalaError extends Error {
|
|
|
19
19
|
export class APIError extends MandalaError {
|
|
20
20
|
status;
|
|
21
21
|
body;
|
|
22
|
+
retryAfterMs;
|
|
22
23
|
name = 'APIError';
|
|
23
24
|
/**
|
|
24
25
|
* The platform's own word for what KIND of refusal this is, where it sent
|
|
25
|
-
* one: `contention`, `starting`, `unavailable` or `unsupported` (OPL-3898)
|
|
26
|
-
* `
|
|
27
|
-
*
|
|
26
|
+
* one: `contention`, `starting`, `unavailable` or `unsupported` (OPL-3898),
|
|
27
|
+
* or `revoked` (OPL-4801) — the one word about the caller rather than the
|
|
28
|
+
* computer. `undefined` for most errors, and always will be — the platform is
|
|
29
|
+
* explicit that an absent value means unclassified rather than "none of these".
|
|
28
30
|
*
|
|
29
31
|
* Read on the base class rather than on the one 409 it was filed for, because
|
|
30
32
|
* the platform keys it on the ERROR and not on the route: the same sentinel is
|
|
@@ -33,10 +35,13 @@ export class APIError extends MandalaError {
|
|
|
33
35
|
* the caller who arrived a moment earlier heard.
|
|
34
36
|
*/
|
|
35
37
|
reason;
|
|
36
|
-
constructor(message, status, body
|
|
38
|
+
constructor(message, status, body,
|
|
39
|
+
/** Parsed Retry-After delay in milliseconds; absent when missing or invalid. */
|
|
40
|
+
retryAfterMs) {
|
|
37
41
|
super(message);
|
|
38
42
|
this.status = status;
|
|
39
43
|
this.body = body;
|
|
44
|
+
this.retryAfterMs = retryAfterMs;
|
|
40
45
|
this.reason = refusalReason(body);
|
|
41
46
|
}
|
|
42
47
|
}
|
|
@@ -53,7 +58,54 @@ export class APIError extends MandalaError {
|
|
|
53
58
|
* `_REASON_PERMANENT` in mandala-computer-python's `_exceptions.py`.
|
|
54
59
|
*/
|
|
55
60
|
const REASON_CLEARS = new Set(['contention', 'starting']);
|
|
56
|
-
|
|
61
|
+
/**
|
|
62
|
+
* `revoked` is the first of these about the CALLER rather than about a computer:
|
|
63
|
+
* the authority the request arrived with no longer holds — suspended, demoted,
|
|
64
|
+
* removed, or a session the platform has retired (platform OPL-4801). Permanent,
|
|
65
|
+
* and named rather than left to fall through: a 401 or a 403 is none of the four
|
|
66
|
+
* transient classes, so an unrecognised word already answered "not transient" and
|
|
67
|
+
* nothing changes today. What changes is that a future status for this refusal
|
|
68
|
+
* cannot quietly make it look replayable.
|
|
69
|
+
*/
|
|
70
|
+
const REASON_PERMANENT = new Set(['unavailable', 'unsupported', 'revoked']);
|
|
71
|
+
/**
|
|
72
|
+
* How a refusal the platform classified behaves, or `undefined` for a word this
|
|
73
|
+
* version has no opinion about.
|
|
74
|
+
*
|
|
75
|
+
* The EXPORTED half of the two the sets above feed, and the split is
|
|
76
|
+
* deliberate. {@link reasonAdvice} beside it is this server's prose for a
|
|
77
|
+
* language model, tuned to how a model reads an MCP tool result and rewritten
|
|
78
|
+
* whenever one reads it wrong; publishing those sentences would make their
|
|
79
|
+
* wording something this package versions. What an embedder needs from here is
|
|
80
|
+
* narrower and does not move: whether waiting can change the answer.
|
|
81
|
+
*
|
|
82
|
+
* The raw word stays theirs. `APIError.reason` is public, the platform's set is
|
|
83
|
+
* documented and deliberately open, and switching on it is the supported path —
|
|
84
|
+
* this only offers the classification of the words this version knows, so an
|
|
85
|
+
* embedder need not duplicate a table that lives here. A word it has never
|
|
86
|
+
* heard of is `undefined` rather than a guess, which is the same contract
|
|
87
|
+
* `reasonAdvice` keeps and the reason "absent means unclassified" exists.
|
|
88
|
+
*
|
|
89
|
+
* NOT A RETRY PREDICATE. It classifies the WORD, and an error is more than its
|
|
90
|
+
* word: {@link isTransient} answers `MoveRequiredError` and
|
|
91
|
+
* {@link ConnectivityInterruptedError} before it ever looks at `reason`, because
|
|
92
|
+
* both are subclasses of branches that would otherwise say yes (OPL-3775,
|
|
93
|
+
* OPL-3855). A move-required 409 whose body also carries `reason: 'contention'`
|
|
94
|
+
* classifies here as `'clears'` while `isTransient` correctly says no — it is a
|
|
95
|
+
* decision about the size that was asked for, and it answers the same forever.
|
|
96
|
+
* So `if (reasonKind(err.reason) !== 'permanent') retry()` is the loop this
|
|
97
|
+
* sentence exists to prevent; ask {@link isTransient} whether to retry, and ask
|
|
98
|
+
* this what the platform's word meant.
|
|
99
|
+
*/
|
|
100
|
+
export function reasonKind(reason) {
|
|
101
|
+
if (reason === undefined)
|
|
102
|
+
return undefined;
|
|
103
|
+
if (REASON_CLEARS.has(reason))
|
|
104
|
+
return 'clears';
|
|
105
|
+
if (REASON_PERMANENT.has(reason))
|
|
106
|
+
return 'permanent';
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
57
109
|
/**
|
|
58
110
|
* What to tell a model about a refusal the platform classified, or `undefined`.
|
|
59
111
|
*
|
|
@@ -74,9 +126,56 @@ export function reasonAdvice(reason) {
|
|
|
74
126
|
case 'starting':
|
|
75
127
|
return 'the guest agent is still inside its boot window, so this is worth sending again in a moment';
|
|
76
128
|
case 'unavailable':
|
|
77
|
-
|
|
129
|
+
// Softened from "does NOT clear by waiting", which was false of exactly
|
|
130
|
+
// the case OPL-4631 is about and is the sentence a model actually sees:
|
|
131
|
+
// the platform raises this whenever no guest process is up, so a start
|
|
132
|
+
// that has been admitted but has not launched yet lands here too, and
|
|
133
|
+
// telling that caller to start_computer is telling them to start it
|
|
134
|
+
// twice. This refusal cannot see the reservation — it is a
|
|
135
|
+
// reason code, not a computer — so it names the call that CAN.
|
|
136
|
+
return 'the computer is not running; if nothing is starting it this will not clear on its own and start_computer is the fix, and if a start is already under way wait_for_computer says so without starting a second one';
|
|
78
137
|
case 'unsupported':
|
|
79
138
|
return 'this computer cannot do it at all, so do not retry it — the answer is the same forever';
|
|
139
|
+
case 'revoked':
|
|
140
|
+
// Reached only on a status statusAdvice has no sentence for, because the
|
|
141
|
+
// formatter asks that one first and the platform sends this word on 401 and
|
|
142
|
+
// 403 today. It is here so that a different status tomorrow still says the
|
|
143
|
+
// one thing a model has to be told: this is about who is calling, not about
|
|
144
|
+
// the computer, and sending it again unchanged changes nothing.
|
|
145
|
+
return 'the authority this server is calling with no longer holds — a credential, role or account that changed, rather than anything wrong with the computer. Sending this again unchanged is refused the same way, and it can be decided partway through a call, so check what already took effect';
|
|
146
|
+
default:
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* What to tell a model about a refusal that is about the CALLER, not the computer.
|
|
152
|
+
*
|
|
153
|
+
* The companion to {@link reasonAdvice}, for the three statuses the platform can
|
|
154
|
+
* answer with partway through a call rather than only at the start of one: the
|
|
155
|
+
* credential, the role and the plan are all checked again before the platform
|
|
156
|
+
* does anything further, so a long call can be refused after part of its work is
|
|
157
|
+
* already done.
|
|
158
|
+
*
|
|
159
|
+
* Which makes the wording the interesting part. A model reads one sentence and
|
|
160
|
+
* decides from it whether to send the call again, and the default instinct on
|
|
161
|
+
* anything that looks like a transport failure is to retry — so the sentence has
|
|
162
|
+
* to say, in words and not by omission, that a retry is wrong and that some of
|
|
163
|
+
* the work may already stand. None of the three is a fault on the computer, and
|
|
164
|
+
* a model told only "unauthorized (HTTP 401)" reads it as one.
|
|
165
|
+
*
|
|
166
|
+
* Only these three. A 404 is deliberately not here: it does not separate deleted
|
|
167
|
+
* from out of this key's reach, so a single clause would have to be wrong about
|
|
168
|
+
* one of them — that judgement belongs to the tools that know which id they were
|
|
169
|
+
* given. Silence is the same discipline {@link reasonAdvice} keeps.
|
|
170
|
+
*/
|
|
171
|
+
export function statusAdvice(status) {
|
|
172
|
+
switch (status) {
|
|
173
|
+
case 401:
|
|
174
|
+
return 'the credential this server is using stopped being accepted — revoked, or a session that ended. Sending this again unchanged is refused the same way. This can be decided partway through a call, so check what already took effect before repeating anything that creates, starts, moves, writes or deletes';
|
|
175
|
+
case 403:
|
|
176
|
+
return 'this account does not permit this — a role that changed or an account suspended, rather than anything wrong with the computer. Retrying does not help, and it can be decided partway through a call, so check what already took effect before repeating anything that writes';
|
|
177
|
+
case 402:
|
|
178
|
+
return 'the plan on this account, as it stands now, does not cover what was asked for. Not a fault on the computer and not something waiting fixes — say what was refused';
|
|
80
179
|
default:
|
|
81
180
|
return undefined;
|
|
82
181
|
}
|
|
@@ -168,8 +267,8 @@ export class MoveRequiredError extends ConflictError {
|
|
|
168
267
|
name = 'MoveRequiredError';
|
|
169
268
|
constructor(message, status, body,
|
|
170
269
|
/** Whether a host in this region could run the size that was asked for. */
|
|
171
|
-
movePossible) {
|
|
172
|
-
super(message, status, body);
|
|
270
|
+
movePossible, retryAfterMs) {
|
|
271
|
+
super(message, status, body, retryAfterMs);
|
|
173
272
|
this.movePossible = movePossible;
|
|
174
273
|
}
|
|
175
274
|
}
|
|
@@ -210,8 +309,8 @@ export class RangeNotSatisfiableError extends APIError {
|
|
|
210
309
|
name = 'RangeNotSatisfiableError';
|
|
211
310
|
constructor(message, status, body,
|
|
212
311
|
/** The file's real length, off `Content-Range`, when the response sent one. */
|
|
213
|
-
size) {
|
|
214
|
-
super(message, status, body);
|
|
312
|
+
size, retryAfterMs) {
|
|
313
|
+
super(message, status, body, retryAfterMs);
|
|
215
314
|
this.size = size;
|
|
216
315
|
}
|
|
217
316
|
}
|
|
@@ -229,13 +328,12 @@ export class RangeNotSatisfiableError extends APIError {
|
|
|
229
328
|
* how a rate limit becomes a longer one.
|
|
230
329
|
*/
|
|
231
330
|
export class RateLimitError extends APIError {
|
|
232
|
-
retryAfterMs;
|
|
233
331
|
name = 'RateLimitError';
|
|
332
|
+
// biome-ignore lint/complexity/noUselessConstructor: Preserve the documented public constructor.
|
|
234
333
|
constructor(message, status, body,
|
|
235
334
|
/** From `Retry-After`, in milliseconds from now, when the response sent one. */
|
|
236
335
|
retryAfterMs) {
|
|
237
|
-
super(message, status, body);
|
|
238
|
-
this.retryAfterMs = retryAfterMs;
|
|
336
|
+
super(message, status, body, retryAfterMs);
|
|
239
337
|
}
|
|
240
338
|
}
|
|
241
339
|
/** 503 — a hypervisor could not be reached, so an inventory would be short. */
|
|
@@ -384,6 +482,27 @@ export class GatewayTimeoutError extends APIError {
|
|
|
384
482
|
export class OriginUnreachableError extends APIError {
|
|
385
483
|
name = 'OriginUnreachableError';
|
|
386
484
|
}
|
|
485
|
+
/**
|
|
486
|
+
* A 3xx, which this client answers rather than follows.
|
|
487
|
+
*
|
|
488
|
+
* Following one is the tempting default and it is wrong twice over. The bearer
|
|
489
|
+
* is the smaller half: `fetch` strips `Authorization` across origins but keeps
|
|
490
|
+
* it on a same-origin hop, so a redirect inside the configured origin carries
|
|
491
|
+
* the key to a path the operator did not name. The larger half is that a
|
|
492
|
+
* redirect is a CONFIGURATION fact — a `MANDALA_BASE_URL` missing its trailing
|
|
493
|
+
* path, an http URL for an https deployment, a tenant that has moved — and
|
|
494
|
+
* following it silently means the operator never learns the value they set is
|
|
495
|
+
* not the value in use, while every request pays an extra round trip forever.
|
|
496
|
+
*
|
|
497
|
+
* So it is surfaced, and it names the `Location`: the whole point is that the
|
|
498
|
+
* next thing the operator does is put that in `MANDALA_BASE_URL`. It is an
|
|
499
|
+
* `APIError` with the real status so {@link isTransientForPoll}'s `>= 500` rule
|
|
500
|
+
* files it with the 4xx, where it belongs — repeating the request unchanged
|
|
501
|
+
* cannot change the answer.
|
|
502
|
+
*/
|
|
503
|
+
export class RedirectError extends APIError {
|
|
504
|
+
name = 'RedirectError';
|
|
505
|
+
}
|
|
387
506
|
/**
|
|
388
507
|
* 502, 520 — a proxy had no usable answer from the platform.
|
|
389
508
|
*
|
|
@@ -452,11 +571,8 @@ const BY_STATUS = {
|
|
|
452
571
|
// arriving from anywhere else is still the right class with the platform's
|
|
453
572
|
// own message on it.
|
|
454
573
|
416: RangeNotSatisfiableError,
|
|
455
|
-
//
|
|
456
|
-
//
|
|
457
|
-
// reason: `Retry-After` is on the headers and the number is worth keeping.
|
|
458
|
-
// The entry is here so a 429 arriving from anywhere else is still the right
|
|
459
|
-
// class, which is what {@link isTransient} now asks about.
|
|
574
|
+
// Retry-After is parsed by Api and passed through errorForStatus.
|
|
575
|
+
// A 429 built without headers still has the same public error class.
|
|
460
576
|
429: RateLimitError,
|
|
461
577
|
// The other status a proxy writes on its own, and it was the one gap left in
|
|
462
578
|
// this range: with no entry it fell through to a bare APIError, so a model
|
|
@@ -615,7 +731,7 @@ export function platformSaid(body) {
|
|
|
615
731
|
return typeof err === 'string' && err.length > 0 ? err : undefined;
|
|
616
732
|
}
|
|
617
733
|
/** Build the error for a status, with the platform's own message when it sent one. */
|
|
618
|
-
export function errorForStatus(status, message, body) {
|
|
734
|
+
export function errorForStatus(status, message, body, retryAfterMs) {
|
|
619
735
|
const Cls = BY_STATUS[status] ?? APIError;
|
|
620
736
|
// The 409 that is an offer, told apart by its body. Before the substitutions
|
|
621
737
|
// below because it never wants one: the platform's sentence here is the whole
|
|
@@ -624,7 +740,10 @@ export function errorForStatus(status, message, body) {
|
|
|
624
740
|
if (Cls === ConflictError) {
|
|
625
741
|
const offer = moveOffer(body);
|
|
626
742
|
if (offer)
|
|
627
|
-
return new MoveRequiredError(message, status, body, offer.possible);
|
|
743
|
+
return new MoveRequiredError(message, status, body, offer.possible, retryAfterMs);
|
|
744
|
+
}
|
|
745
|
+
if (Cls === RangeNotSatisfiableError) {
|
|
746
|
+
return new RangeNotSatisfiableError(message, status, body, undefined, retryAfterMs);
|
|
628
747
|
}
|
|
629
748
|
// Substituted for an empty body, which says nothing, and for a proxy's HTML
|
|
630
749
|
// page, which says 500 characters of nothing. NOT for a structured message:
|
|
@@ -641,21 +760,21 @@ export function errorForStatus(status, message, body) {
|
|
|
641
760
|
// that deployment than the generic outage prose here does, and discarding it
|
|
642
761
|
// was the very thing the 504 and 520 guards exist to prevent.
|
|
643
762
|
if (Cls === GatewayTimeoutError && !platformNamed(body)) {
|
|
644
|
-
return new GatewayTimeoutError(gatewayTimeoutMessage(status), status, body);
|
|
763
|
+
return new GatewayTimeoutError(gatewayTimeoutMessage(status), status, body, retryAfterMs);
|
|
645
764
|
}
|
|
646
765
|
if (Cls === OriginResponseError && !platformNamed(body)) {
|
|
647
766
|
// 502 and 520 share a class and not a message: one knows the request
|
|
648
767
|
// arrived, the other cannot tell. See BAD_GATEWAY_MESSAGE.
|
|
649
768
|
const said = status === 502 ? BAD_GATEWAY_MESSAGE : ORIGIN_RESPONSE_MESSAGE;
|
|
650
|
-
return new OriginResponseError(said, status, body);
|
|
769
|
+
return new OriginResponseError(said, status, body, retryAfterMs);
|
|
651
770
|
}
|
|
652
771
|
if (Cls === OriginTLSError && !platformNamed(body)) {
|
|
653
|
-
return new OriginTLSError(ORIGIN_TLS_MESSAGE, status, body);
|
|
772
|
+
return new OriginTLSError(ORIGIN_TLS_MESSAGE, status, body, retryAfterMs);
|
|
654
773
|
}
|
|
655
774
|
if (Cls === OriginUnreachableError && !platformNamed(body)) {
|
|
656
|
-
return new OriginUnreachableError(ORIGIN_UNREACHABLE_MESSAGE, status, body);
|
|
775
|
+
return new OriginUnreachableError(ORIGIN_UNREACHABLE_MESSAGE, status, body, retryAfterMs);
|
|
657
776
|
}
|
|
658
|
-
return new Cls(message, status, body);
|
|
777
|
+
return new Cls(message, status, body, retryAfterMs);
|
|
659
778
|
}
|
|
660
779
|
/**
|
|
661
780
|
* Whether an error is worth trying again without changing the request.
|
|
@@ -730,6 +849,14 @@ export function errorForStatus(status, message, body) {
|
|
|
730
849
|
* what it can and cannot tell apart.
|
|
731
850
|
*/
|
|
732
851
|
export function isTransient(err) {
|
|
852
|
+
// Preparation requires the original template and a token, and may have failed.
|
|
853
|
+
// A generic retry of the unchanged create is not the continuation protocol.
|
|
854
|
+
if (err instanceof APIError &&
|
|
855
|
+
err.body !== null &&
|
|
856
|
+
typeof err.body === 'object' &&
|
|
857
|
+
err.body.code === 'template_image_preparing') {
|
|
858
|
+
return false;
|
|
859
|
+
}
|
|
733
860
|
// A move offer is a 409 and is NOT transient — it is a decision about the
|
|
734
861
|
// size that was asked for, and the same request answers the same way forever.
|
|
735
862
|
// First, because it is a subclass of the very branch below that would say yes
|
|
@@ -748,9 +875,12 @@ export function isTransient(err) {
|
|
|
748
875
|
// an arbitrary exception may happen to have a `reason` property, and that is
|
|
749
876
|
// neither this protocol nor retry advice.
|
|
750
877
|
if (err instanceof APIError && err.reason !== undefined) {
|
|
751
|
-
|
|
878
|
+
// Through the exported classifier rather than the sets directly, so what an
|
|
879
|
+
// embedder is told and what this server does are one answer and not two.
|
|
880
|
+
const kind = reasonKind(err.reason);
|
|
881
|
+
if (kind === 'clears')
|
|
752
882
|
return true;
|
|
753
|
-
if (
|
|
883
|
+
if (kind === 'permanent')
|
|
754
884
|
return false;
|
|
755
885
|
}
|
|
756
886
|
return (err instanceof ConflictError ||
|
|
@@ -835,6 +965,13 @@ export function isTransient(err) {
|
|
|
835
965
|
* SDK found that one; this is the same rule, and it is why all three now say
|
|
836
966
|
* `>= 500`.
|
|
837
967
|
*
|
|
968
|
+
* "Does not follow redirects" is a claim about `#fetch`'s `redirect: 'manual'`
|
|
969
|
+
* and is load-bearing HERE, in a way it was not while the default `'follow'`
|
|
970
|
+
* silently made it untrue: under `'follow'` a 3xx never reaches this predicate
|
|
971
|
+
* at all, so the paragraph above described a case that could not arise and the
|
|
972
|
+
* `>= 500` bound rested on nothing. {@link RedirectError} is what a 3xx
|
|
973
|
+
* becomes now. Change one and this paragraph is wrong again.
|
|
974
|
+
*
|
|
838
975
|
* {@link APIError.reason} is deliberately NOT consulted here, and that is the
|
|
839
976
|
* one place this predicate and {@link isTransient} part company (OPL-3898).
|
|
840
977
|
* `unavailable` means the computer is not running, which is a permanent answer
|
|
@@ -842,8 +979,11 @@ export function isTransient(err) {
|
|
|
842
979
|
* may not be, since a computer coming up passes through it. The same generosity
|
|
843
980
|
* as every unmapped 5xx below, for the same reason: this only ever replays a
|
|
844
981
|
* read, and the loops above return a refusal of their own the moment the status
|
|
845
|
-
* they are watching says stopped or suspended
|
|
846
|
-
*
|
|
982
|
+
* they are watching says stopped or suspended AND the platform says it is
|
|
983
|
+
* holding nothing for the machine — the qualification OPL-4631 added, because
|
|
984
|
+
* a start that has been admitted reads as stopped or suspended until its guest
|
|
985
|
+
* process exists. mandala-computer-python's `_is_transient_for_poll` draws the
|
|
986
|
+
* line in the same place.
|
|
847
987
|
*
|
|
848
988
|
* Everything at 5xx polls through, 502 and 520-523 included: they mean the
|
|
849
989
|
* outcome is unknown, and a read whose outcome is unknown can simply be read
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,IAAI,GAAG,cAAc,CAAC;CAChC;AAED,MAAM,OAAO,QAAS,SAAQ,YAAY;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,IAAI,GAAG,cAAc,CAAC;CAChC;AAED,MAAM,OAAO,QAAS,SAAQ,YAAY;IAkB7B;IACA;IAEA;IApBF,IAAI,GAAG,UAAU,CAAC;IAC3B;;;;;;;;;;;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,CAAC;IACD,OAAO,CACL,GAAG,YAAY,aAAa;QAC5B,GAAG,YAAY,cAAc;QAC7B,GAAG,YAAY,gBAAgB;QAC/B,GAAG,YAAY,iBAAiB,CACjC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC7C,IAAI,CAAC,CAAC,GAAG,YAAY,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,YAAY,iBAAiB,CAAC;QAAE,OAAO,KAAK,CAAC;IACpF,IAAI,GAAG,YAAY,iBAAiB;QAAE,OAAO,KAAK,CAAC;IACnD,IAAI,GAAG,YAAY,cAAc;QAAE,OAAO,KAAK,CAAC;IAChD,IAAI,GAAG,YAAY,QAAQ,EAAE,CAAC;QAC5B,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;YAAE,OAAO,KAAK,CAAC;QACrC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;YAAE,OAAO,IAAI,CAAC;QAChF,OAAO,GAAG,CAAC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC;IAC/C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/events.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* What a computer is doing, held open on this side of the model.
|
|
3
3
|
*
|
|
4
|
-
* `GET computers/:id/events` (
|
|
4
|
+
* `GET computers/:id/events` (OPL-3785) is a websocket that says what
|
|
5
5
|
* a computer is doing without being asked, so that an agent stops paying for a
|
|
6
6
|
* screenshot to learn that nothing has changed. Every other client of that
|
|
7
7
|
* stream hands it to its caller as an iterator, because every other caller sits
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
* doorbell an addition to this file rather than a replacement for it, and one
|
|
26
26
|
* whose bell nothing on the other end rings yet.
|
|
27
27
|
*
|
|
28
|
-
* Written against the `events_url` entry in the platform's
|
|
29
|
-
* which is
|
|
28
|
+
* Written against the `events_url` entry in the platform's API reference,
|
|
29
|
+
* which is what this must not contradict.
|
|
30
30
|
*/
|
|
31
31
|
import type { Api } from './api.js';
|
|
32
32
|
/**
|
|
@@ -212,6 +212,9 @@ export declare class Subscription {
|
|
|
212
212
|
*/
|
|
213
213
|
get resumeCursor(): string | undefined;
|
|
214
214
|
get state(): SubscriptionState;
|
|
215
|
+
/** Cached capabilities survive a disconnect; this describes the current connection. */
|
|
216
|
+
get connected(): boolean;
|
|
217
|
+
get connectionVersion(): number;
|
|
215
218
|
get idleMs(): number;
|
|
216
219
|
/** What this computer can emit, as last stated. `undefined` before `hello`. */
|
|
217
220
|
get eventTypes(): string[] | undefined;
|
|
@@ -234,6 +237,10 @@ export declare class Subscription {
|
|
|
234
237
|
* that was looking for file paths.
|
|
235
238
|
*/
|
|
236
239
|
armGeneration(path: string): number;
|
|
240
|
+
/** Whether a completed re-arm still needs to be explained to this tree's caller. */
|
|
241
|
+
hasUndisclosedRearm(path: string): boolean;
|
|
242
|
+
/** Claim a re-arm for the response that is about to explain it. */
|
|
243
|
+
takeUndisclosedRearm(path: string): boolean;
|
|
237
244
|
/** The last thing this tree said it had lost, if it has said one since arming. */
|
|
238
245
|
lostFor(path: string): string | undefined;
|
|
239
246
|
/**
|
|
@@ -317,6 +324,24 @@ export declare class Subscription {
|
|
|
317
324
|
limit: number;
|
|
318
325
|
through?: number;
|
|
319
326
|
}): Delivery;
|
|
327
|
+
/**
|
|
328
|
+
* Whether this read needs the current computer state attached to its loss.
|
|
329
|
+
*
|
|
330
|
+
* Asked before {@link read}, because reconciliation awaits network reads and
|
|
331
|
+
* a caller can cancel during them. Consuming first would advance the shared
|
|
332
|
+
* cursor and clear the loss into a response that caller never receives.
|
|
333
|
+
*
|
|
334
|
+
* A pure preview, and that is load-bearing rather than tidiness. It sees the
|
|
335
|
+
* gap an unplaceable `since` implies, but it does not record one: a subscription
|
|
336
|
+
* is shared by every call on its computer, so a predicate that stamped `#loss`
|
|
337
|
+
* would hand that gap to whichever call read next — the cancelled caller's hole
|
|
338
|
+
* reported against a later read that named a different cursor, or none at all.
|
|
339
|
+
*/
|
|
340
|
+
needsReconciliation(opts: {
|
|
341
|
+
since?: string;
|
|
342
|
+
limit: number;
|
|
343
|
+
through?: number;
|
|
344
|
+
}): boolean;
|
|
320
345
|
/**
|
|
321
346
|
* Where a read or a wait starts: the model's own place, or the cursor it named.
|
|
322
347
|
*
|
|
@@ -326,6 +351,10 @@ export declare class Subscription {
|
|
|
326
351
|
* server holds, and saying so is the whole of the gap discipline — never a
|
|
327
352
|
* frame the model has to interpret, always a sentence and, from the tool, the
|
|
328
353
|
* state it would otherwise have gone to reconcile against.
|
|
354
|
+
*
|
|
355
|
+
* Reads nothing back into the subscription: see {@link #place}, which is where
|
|
356
|
+
* the sentence that gap discipline owes the model is composed, and {@link read},
|
|
357
|
+
* which is the only caller allowed to make it standing.
|
|
329
358
|
*/
|
|
330
359
|
resolveFrom(since?: string): number;
|
|
331
360
|
/**
|
|
@@ -398,8 +427,20 @@ export declare class EventHub {
|
|
|
398
427
|
* resume — reaped for idleness, stopped on a computer somebody suspended —
|
|
399
428
|
* and one there is nothing left to resume: a deleted computer's cursor names
|
|
400
429
|
* a position in a stream that no longer exists.
|
|
430
|
+
*
|
|
431
|
+
* `expect` is the subscription the caller drained, and dropping BY IDENTITY
|
|
432
|
+
* rather than by id is what makes this safe under the concurrency these tools
|
|
433
|
+
* are designed for. Two calls on one computer overlap by design — a
|
|
434
|
+
* `wait_for_event` parked while a `poll_events` runs — and each holds its own
|
|
435
|
+
* handle. Without the check: A finds its stream stopped, drains it and drops
|
|
436
|
+
* it; the model's next call opens a fresh, healthy S2; B, still holding the
|
|
437
|
+
* stale S1, wakes, sees the status it recorded, drains an empty ring and
|
|
438
|
+
* drops — closing S2, a stream nothing was wrong with, out from under whoever
|
|
439
|
+
* had just opened it. Looked up by id, `drop` had no way to tell the two
|
|
440
|
+
* apart. A caller with no handle to name (the idle sweep passes the entry it
|
|
441
|
+
* is iterating) still drops whatever is there.
|
|
401
442
|
*/
|
|
402
|
-
drop(computerId: string, reason: string, remember?: boolean): void;
|
|
443
|
+
drop(computerId: string, reason: string, remember?: boolean, expect?: Subscription): void;
|
|
403
444
|
/** Close every socket. The session is over, or the process is going away. */
|
|
404
445
|
closeAll(): void;
|
|
405
446
|
}
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAKpC;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IACrD,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IAC7E,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IACtD,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IACtD,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,WAAW,CAAC;AAE9D;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EA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