@printobserver/sdk 0.9.0 → 0.10.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/dist/client.d.ts +1 -1
- package/dist/client.js +84 -18
- package/dist/contract.d.ts +367 -2
- package/dist/contract.js +6219 -59
- package/dist/shapes.d.ts +21 -0
- package/dist/shapes.js +171 -0
- package/dist/surface.d.ts +10 -9
- package/dist/surface.js +7 -6
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -45,5 +45,5 @@ export declare class Client extends GeneratedClient {
|
|
|
45
45
|
/** What authenticates to it, where anything does. */
|
|
46
46
|
readonly credential: string | undefined;
|
|
47
47
|
constructor(options: ClientOptions);
|
|
48
|
-
protected call<T>(method: string, target: string, asked: Array<[string, string]>, sending: Record<string, unknown> | undefined): Promise<T>;
|
|
48
|
+
protected call<T>(method: string, target: string, asked: Array<[string, string]>, sending: Record<string, unknown> | undefined, answer: string): Promise<T>;
|
|
49
49
|
}
|
package/dist/client.js
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* transport stack of its own.
|
|
14
14
|
*/
|
|
15
15
|
import { GeneratedClient } from "./contract.js";
|
|
16
|
+
import { conforms } from "./shapes.js";
|
|
16
17
|
import { PrinterRefused, Refused, Rejected, Unreachable, Unreadable } from "./surface.js";
|
|
17
18
|
/** The status a rejected action is answered under. */
|
|
18
19
|
const REJECTED_STATUS = 409;
|
|
@@ -38,7 +39,7 @@ export class Client extends GeneratedClient {
|
|
|
38
39
|
this.origin = origin(options.server);
|
|
39
40
|
this.credential = options.credential;
|
|
40
41
|
}
|
|
41
|
-
async call(method, target, asked, sending) {
|
|
42
|
+
async call(method, target, asked, sending, answer) {
|
|
42
43
|
const headers = { Accept: MEDIA_TYPE };
|
|
43
44
|
if (sending !== undefined) {
|
|
44
45
|
headers["Content-Type"] = MEDIA_TYPE;
|
|
@@ -59,7 +60,12 @@ export class Client extends GeneratedClient {
|
|
|
59
60
|
}
|
|
60
61
|
const said = await answered.text();
|
|
61
62
|
if (answered.status === SUCCESS_STATUS) {
|
|
62
|
-
|
|
63
|
+
const parsed = document(answered.status, said);
|
|
64
|
+
if (!conforms(parsed, answer)) {
|
|
65
|
+
throw new Unreadable(answered.status, `the supervisor answered no ${answer}`);
|
|
66
|
+
}
|
|
67
|
+
// Held above to the type the contracts declare for this answer.
|
|
68
|
+
return parsed;
|
|
63
69
|
}
|
|
64
70
|
if (answered.status === REJECTED_STATUS) {
|
|
65
71
|
throw rejection(answered.status, said);
|
|
@@ -112,26 +118,86 @@ function refusalText(said) {
|
|
|
112
118
|
}
|
|
113
119
|
return "it said nothing this client can read";
|
|
114
120
|
}
|
|
115
|
-
/**
|
|
121
|
+
/** Whether one parsed value is a JSON object, whose members can then be read. */
|
|
122
|
+
function isObject(value) {
|
|
123
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The answer type a refused document declares itself as by its members: an
|
|
127
|
+
* action's answer carries its record, a recovery's names its action beside its
|
|
128
|
+
* decision, and a spool command's carries its decision at the top.
|
|
129
|
+
*/
|
|
130
|
+
function answerType(document) {
|
|
131
|
+
if (isObject(document) && "record" in document) {
|
|
132
|
+
return "ActionAnswer";
|
|
133
|
+
}
|
|
134
|
+
if (isObject(document) && "action" in document) {
|
|
135
|
+
return "RecoveryAnswer";
|
|
136
|
+
}
|
|
137
|
+
return "SpoolCommandAnswer";
|
|
138
|
+
}
|
|
139
|
+
/** A refusal's value asked for and range allowed, when it ruled on a value. */
|
|
140
|
+
function boundsOf(refused) {
|
|
141
|
+
const bounds = isObject(refused) ? refused.out_of_bounds : undefined;
|
|
142
|
+
if (!isObject(bounds) || typeof bounds.requested !== "number" || !isObject(bounds.allowed)) {
|
|
143
|
+
return {};
|
|
144
|
+
}
|
|
145
|
+
const { min, max } = bounds.allowed;
|
|
146
|
+
if (typeof min !== "number" || typeof max !== "number") {
|
|
147
|
+
return {};
|
|
148
|
+
}
|
|
149
|
+
return { requested: bounds.requested, allowed: { min, max } };
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* The policy's own refusal, as the answer to it carries it.
|
|
153
|
+
*
|
|
154
|
+
* The whole answer is held to the type the contracts declare for it — every
|
|
155
|
+
* member, every closed set of names and arms, every nested shape — before any
|
|
156
|
+
* of it is handed on as that type.
|
|
157
|
+
*/
|
|
116
158
|
function rejection(status, said) {
|
|
117
159
|
const answer = document(status, said);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (typeof decision !== "object" || !("rejected" in decision)) {
|
|
122
|
-
return new Unreadable(status, "the supervisor refused this action and answered a record whose decision is not a refusal");
|
|
160
|
+
const declared = answerType(answer);
|
|
161
|
+
if (!isObject(answer) || !conforms(answer, declared)) {
|
|
162
|
+
return new Unreadable(status, `the supervisor refused this and answered no ${declared}`);
|
|
123
163
|
}
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
requested = reason.out_of_bounds.requested;
|
|
129
|
-
allowed = reason.out_of_bounds.allowed;
|
|
164
|
+
const decision = isObject(answer.record) ? answer.record.decision : answer.decision;
|
|
165
|
+
const refused = isObject(decision) ? decision.rejected : undefined;
|
|
166
|
+
if (refused === undefined) {
|
|
167
|
+
return new Unreadable(status, "the supervisor refused this action and answered a record whose decision is not a refusal");
|
|
130
168
|
}
|
|
131
|
-
|
|
169
|
+
const bounds = boundsOf(refused);
|
|
170
|
+
return new Rejected(
|
|
171
|
+
// Held above to the refusal vocabulary its answer type declares.
|
|
172
|
+
refused, bounds.requested, bounds.allowed,
|
|
173
|
+
// Held above to the answer type it declares itself as.
|
|
174
|
+
answer);
|
|
132
175
|
}
|
|
133
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* The machine's own refusal of an action the policy accepted.
|
|
178
|
+
*
|
|
179
|
+
* A recovery the machine refused carries no action record, and arrives as the
|
|
180
|
+
* supervisor's own words for it: a recovery answer whose decision was carried
|
|
181
|
+
* out and failed at the printer. Either answer is held to the type the
|
|
182
|
+
* contracts declare for it before any of it is handed on.
|
|
183
|
+
*/
|
|
134
184
|
function machineRefusal(status, said) {
|
|
135
|
-
const
|
|
136
|
-
|
|
185
|
+
const answered = document(status, said);
|
|
186
|
+
const declared = answerType(answered);
|
|
187
|
+
if (declared === "SpoolCommandAnswer" || !isObject(answered) || !conforms(answered, declared)) {
|
|
188
|
+
return new Unreadable(status, "the supervisor answered a refusal carrying neither a record nor words");
|
|
189
|
+
}
|
|
190
|
+
if (declared === "RecoveryAnswer") {
|
|
191
|
+
const { decision, detail } = answered;
|
|
192
|
+
const executed = isObject(decision) ? decision.executed : undefined;
|
|
193
|
+
if (!isObject(executed) || !isObject(executed.failed) || typeof detail !== "string") {
|
|
194
|
+
return new Unreadable(status, "the supervisor answered a machine refusal of a recovery that did not fail");
|
|
195
|
+
}
|
|
196
|
+
return new Refused(status, detail);
|
|
197
|
+
}
|
|
198
|
+
return new PrinterRefused(typeof answered.printer_refusal === "string"
|
|
199
|
+
? answered.printer_refusal
|
|
200
|
+
: "it said nothing this client can read",
|
|
201
|
+
// Held above to the answer type it declares itself as.
|
|
202
|
+
answered);
|
|
137
203
|
}
|
package/dist/contract.d.ts
CHANGED
|
@@ -18,9 +18,21 @@ export declare const CONTRACT_VERSION: string;
|
|
|
18
18
|
* Every operation this client exposes a method for, which is every operation
|
|
19
19
|
* the server declares and no other.
|
|
20
20
|
*/
|
|
21
|
-
export declare const OPERATION_NAMES: readonly ["prints", "status", "context", "image", "history", "events", "manifest_get", "look", "manifest_set", "spools", "spool", "printer_history", "preflight", "pause", "resume", "cancel", "start_print", "set_feedrate_factor", "set_flowrate_factor", "set_tool_target_c", "set_bed_target_c", "set_fan_percent", "acknowledge_failure", "close_print", "register_spool", "load_spool", "unload_spool", "adjust_spool", "retire_spool"];
|
|
21
|
+
export declare const OPERATION_NAMES: readonly ["prints", "status", "context", "image", "history", "events", "manifest_get", "look", "manifest_set", "spools", "spool", "printer_history", "preflight", "pause", "resume", "cancel", "start_print", "set_feedrate_factor", "set_flowrate_factor", "set_tool_target_c", "set_bed_target_c", "set_fan_percent", "acknowledge_failure", "close_print", "register_spool", "load_spool", "unload_spool", "adjust_spool", "retire_spool", "recover_status", "recover_lift", "recover_cool", "recover_fan", "recover_heat", "recover_park", "recover_home_xy", "recover_home_z"];
|
|
22
22
|
/** What an operator's acknowledgement of a failure event asks for next. */
|
|
23
23
|
export type AcknowledgementDisposition = "continue" | "watch" | "stop";
|
|
24
|
+
/**
|
|
25
|
+
* Whether one recovery action is allowed now: `allowed`, and the refusal it
|
|
26
|
+
* would meet, present exactly when it is not.
|
|
27
|
+
*/
|
|
28
|
+
export interface ActionAllowance {
|
|
29
|
+
/** One shape of the contracts, which say nothing more about it. */
|
|
30
|
+
action: RecoveryActionKind;
|
|
31
|
+
/** Whether it is allowed now. */
|
|
32
|
+
allowed: boolean;
|
|
33
|
+
/** One shape of the contracts, which say nothing more about it. */
|
|
34
|
+
refusal?: RecoveryRejection;
|
|
35
|
+
}
|
|
24
36
|
/** What one mutating request left behind it. */
|
|
25
37
|
export interface ActionAnswer {
|
|
26
38
|
/** The bounded intervention it opened, when it opened one. */
|
|
@@ -134,6 +146,16 @@ export interface AgentAssessmentPayload {
|
|
|
134
146
|
/** The session the turn ran in. */
|
|
135
147
|
session_name: string;
|
|
136
148
|
}
|
|
149
|
+
/** The bed heater, as a recovery read reports it. */
|
|
150
|
+
export interface BedTemperature {
|
|
151
|
+
/** What it reads, in degrees Celsius, `null` when not reported. */
|
|
152
|
+
actual_c: number | null;
|
|
153
|
+
/**
|
|
154
|
+
* What it is driving towards, in degrees Celsius, `null` when not
|
|
155
|
+
* reported.
|
|
156
|
+
*/
|
|
157
|
+
target_c: number | null;
|
|
158
|
+
}
|
|
137
159
|
/**
|
|
138
160
|
* The camera gave no usable frame for a look or a periodic observation,
|
|
139
161
|
* however many times it was asked.
|
|
@@ -443,6 +465,20 @@ export interface FileTallyRebaselinedPayload {
|
|
|
443
465
|
/** Where it lives, in the printer's own vocabulary. */
|
|
444
466
|
origin: string;
|
|
445
467
|
}
|
|
468
|
+
/**
|
|
469
|
+
* The XY rectangle every extruding move of a file lies inside, in
|
|
470
|
+
* millimetres.
|
|
471
|
+
*/
|
|
472
|
+
export interface Footprint {
|
|
473
|
+
/** The largest X. */
|
|
474
|
+
max_x: number;
|
|
475
|
+
/** The largest Y. */
|
|
476
|
+
max_y: number;
|
|
477
|
+
/** The smallest X. */
|
|
478
|
+
min_x: number;
|
|
479
|
+
/** The smallest Y. */
|
|
480
|
+
min_y: number;
|
|
481
|
+
}
|
|
446
482
|
/** Why a camera frame was not one to hand the agent. */
|
|
447
483
|
export type FrameCause = "blank" | "undecodable";
|
|
448
484
|
/** One tool heater whose target was above zero. */
|
|
@@ -645,6 +681,18 @@ export interface JobSnapshot {
|
|
|
645
681
|
/** The state the source reports the job to be in. */
|
|
646
682
|
state: PrinterState;
|
|
647
683
|
}
|
|
684
|
+
/**
|
|
685
|
+
* What the last print laid down, read from its own G-code up to the last
|
|
686
|
+
* file position recorded for it.
|
|
687
|
+
*/
|
|
688
|
+
export interface LastPrint {
|
|
689
|
+
/** Where in X and Y it laid material. */
|
|
690
|
+
footprint: Footprint;
|
|
691
|
+
/** The print. */
|
|
692
|
+
print_id: PrintId;
|
|
693
|
+
/** The tallest part it laid down, in millimetres. */
|
|
694
|
+
tallest_mm: number;
|
|
695
|
+
}
|
|
648
696
|
/** One spool loaded on one tool, as a print started. */
|
|
649
697
|
export interface LoadedSpool {
|
|
650
698
|
/** The spool loaded on it. */
|
|
@@ -771,6 +819,19 @@ export interface OperatorAcknowledgementPayload {
|
|
|
771
819
|
/** What the operator asked for next. */
|
|
772
820
|
disposition: AcknowledgementDisposition;
|
|
773
821
|
}
|
|
822
|
+
/**
|
|
823
|
+
* The print paused under the printer, and whether resuming it is still safe.
|
|
824
|
+
*
|
|
825
|
+
* A recovery action executed while it was paused moved the head, and
|
|
826
|
+
* `OctoPrint` restores no position on resume, so the rest of the layer would
|
|
827
|
+
* print at the wrong height: such a print is not resumable.
|
|
828
|
+
*/
|
|
829
|
+
export interface PausedPrint {
|
|
830
|
+
/** The print. */
|
|
831
|
+
print_id: PrintId;
|
|
832
|
+
/** Whether it may be resumed. */
|
|
833
|
+
resumable: boolean;
|
|
834
|
+
}
|
|
774
835
|
/**
|
|
775
836
|
* Filament a tool fed after a filament change nobody has confirmed, held
|
|
776
837
|
* until
|
|
@@ -1265,6 +1326,192 @@ export interface Range {
|
|
|
1265
1326
|
export type RawBytes = string;
|
|
1266
1327
|
/** What became of the prints a file's new tally generation counts. */
|
|
1267
1328
|
export type RebaselineDisposition = "accounted" | "unverified";
|
|
1329
|
+
/**
|
|
1330
|
+
* The whole recovery vocabulary, and there is no other.
|
|
1331
|
+
*
|
|
1332
|
+
* The two assertions are the operator's word for what printobserver cannot
|
|
1333
|
+
* see: `clearance_asserted` that the nozzle is clear of the part, and
|
|
1334
|
+
* `bed_clear_asserted` that homing Z will meet nothing on the bed. Each is
|
|
1335
|
+
* false when left out.
|
|
1336
|
+
*/
|
|
1337
|
+
export type RecoveryAction = {
|
|
1338
|
+
action: "recover_lift";
|
|
1339
|
+
mm: number;
|
|
1340
|
+
} | {
|
|
1341
|
+
action: "recover_cool";
|
|
1342
|
+
} | {
|
|
1343
|
+
action: "recover_fan";
|
|
1344
|
+
percent: number;
|
|
1345
|
+
} | {
|
|
1346
|
+
action: "recover_heat";
|
|
1347
|
+
clearance_asserted?: boolean;
|
|
1348
|
+
target_c: number;
|
|
1349
|
+
tool: number;
|
|
1350
|
+
} | {
|
|
1351
|
+
action: "recover_park";
|
|
1352
|
+
clearance_asserted?: boolean;
|
|
1353
|
+
} | {
|
|
1354
|
+
action: "recover_home_xy";
|
|
1355
|
+
clearance_asserted?: boolean;
|
|
1356
|
+
} | {
|
|
1357
|
+
action: "recover_home_z";
|
|
1358
|
+
bed_clear_asserted?: boolean;
|
|
1359
|
+
};
|
|
1360
|
+
/**
|
|
1361
|
+
* One recovery action, named without its fields: what a grant names and what
|
|
1362
|
+
* a refusal of an ungranted request names.
|
|
1363
|
+
*/
|
|
1364
|
+
export type RecoveryActionKind = "recover_lift" | "recover_cool" | "recover_fan" | "recover_heat" | "recover_park" | "recover_home_xy" | "recover_home_z";
|
|
1365
|
+
/**
|
|
1366
|
+
* What a recovery action answers, carried out or refused.
|
|
1367
|
+
*
|
|
1368
|
+
* A refusal is the same shape and deliberately so: `decision` is either
|
|
1369
|
+
* `executed`, carrying what the printer made of it, or `rejected`, carrying
|
|
1370
|
+
* the reason, and the two events are what the request wrote.
|
|
1371
|
+
*/
|
|
1372
|
+
export interface RecoveryAnswer {
|
|
1373
|
+
/** What was asked for. */
|
|
1374
|
+
action: RecoveryAction;
|
|
1375
|
+
/** What became of it. */
|
|
1376
|
+
decision: RecoveryDecision;
|
|
1377
|
+
/**
|
|
1378
|
+
* What became of it, in a sentence for a person: why it was refused and
|
|
1379
|
+
* what would let it go ahead, or what it did.
|
|
1380
|
+
*/
|
|
1381
|
+
detail: string;
|
|
1382
|
+
/**
|
|
1383
|
+
* The `recovery_requested` event, and the `recovery_executed` or
|
|
1384
|
+
* `recovery_rejected` beside it.
|
|
1385
|
+
*/
|
|
1386
|
+
events: Array<EventRecord>;
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* What became of a recovery request: carried out with the printer's outcome,
|
|
1390
|
+
* or refused — one or the other, never both and never neither.
|
|
1391
|
+
*/
|
|
1392
|
+
export type RecoveryDecision = {
|
|
1393
|
+
executed: ExecutionOutcome;
|
|
1394
|
+
} | {
|
|
1395
|
+
rejected: RecoveryRejection;
|
|
1396
|
+
};
|
|
1397
|
+
/** A recovery action reached the printer, and what the printer made of it. */
|
|
1398
|
+
export interface RecoveryExecutedPayload {
|
|
1399
|
+
/** What was asked for. */
|
|
1400
|
+
action: RecoveryAction;
|
|
1401
|
+
/** Who asked. */
|
|
1402
|
+
actor: Actor;
|
|
1403
|
+
/** What the printer made of it. */
|
|
1404
|
+
outcome: ExecutionOutcome;
|
|
1405
|
+
/** Why. */
|
|
1406
|
+
reason: string;
|
|
1407
|
+
}
|
|
1408
|
+
/** One field of a recovery action a bound is held to. */
|
|
1409
|
+
export type RecoveryField = "mm" | "percent" | "tool" | "target_c" | "clearance_asserted" | "bed_clear_asserted";
|
|
1410
|
+
/** Where the print head is, in millimetres, as the printer reported it. */
|
|
1411
|
+
export interface RecoveryPosition {
|
|
1412
|
+
/** X. */
|
|
1413
|
+
x: number;
|
|
1414
|
+
/** Y. */
|
|
1415
|
+
y: number;
|
|
1416
|
+
/** Z. */
|
|
1417
|
+
z: number;
|
|
1418
|
+
}
|
|
1419
|
+
/** A recovery action was refused, and reached nothing. */
|
|
1420
|
+
export interface RecoveryRejectedPayload {
|
|
1421
|
+
/** What was asked for. */
|
|
1422
|
+
action: RecoveryAction;
|
|
1423
|
+
/** Who asked. */
|
|
1424
|
+
actor: Actor;
|
|
1425
|
+
/** Why. */
|
|
1426
|
+
reason: string;
|
|
1427
|
+
/** Why it was refused. */
|
|
1428
|
+
rejection: RecoveryRejection;
|
|
1429
|
+
}
|
|
1430
|
+
/**
|
|
1431
|
+
* Why a recovery request was refused, each a variant of its own so a
|
|
1432
|
+
* consumer tells them apart by matching rather than by reading words.
|
|
1433
|
+
*/
|
|
1434
|
+
export type RecoveryRejection = {
|
|
1435
|
+
actor_may_not_request: {
|
|
1436
|
+
action: RecoveryActionKind;
|
|
1437
|
+
};
|
|
1438
|
+
} | {
|
|
1439
|
+
print_running: {
|
|
1440
|
+
state: PrinterState;
|
|
1441
|
+
};
|
|
1442
|
+
} | "printer_unreachable" | "z_untrusted" | {
|
|
1443
|
+
insufficient_clearance: {
|
|
1444
|
+
margin_mm: number;
|
|
1445
|
+
nozzle_z_mm: number;
|
|
1446
|
+
tallest_mm: number;
|
|
1447
|
+
};
|
|
1448
|
+
} | {
|
|
1449
|
+
out_of_bounds: {
|
|
1450
|
+
allowed: Range;
|
|
1451
|
+
field: RecoveryField;
|
|
1452
|
+
requested: number;
|
|
1453
|
+
};
|
|
1454
|
+
} | {
|
|
1455
|
+
assertion_required: {
|
|
1456
|
+
field: RecoveryField;
|
|
1457
|
+
};
|
|
1458
|
+
} | "recovery_not_configured" | {
|
|
1459
|
+
printer_cannot: {
|
|
1460
|
+
action: RecoveryActionKind;
|
|
1461
|
+
detail: string;
|
|
1462
|
+
};
|
|
1463
|
+
};
|
|
1464
|
+
/**
|
|
1465
|
+
* A recovery action was asked for.
|
|
1466
|
+
*
|
|
1467
|
+
* The printer's rather than any print's, so it is written with no print.
|
|
1468
|
+
*/
|
|
1469
|
+
export interface RecoveryRequestedPayload {
|
|
1470
|
+
/** What was asked for. */
|
|
1471
|
+
action: RecoveryAction;
|
|
1472
|
+
/** Who asked. */
|
|
1473
|
+
actor: Actor;
|
|
1474
|
+
/** Why. */
|
|
1475
|
+
reason: string;
|
|
1476
|
+
}
|
|
1477
|
+
/**
|
|
1478
|
+
* What a recovery read answers: everything a recovery is checked against,
|
|
1479
|
+
* and what each action would meet now.
|
|
1480
|
+
*/
|
|
1481
|
+
export interface RecoveryStatus {
|
|
1482
|
+
/** Each action, and whether it is allowed now. */
|
|
1483
|
+
actions: Array<ActionAllowance>;
|
|
1484
|
+
/**
|
|
1485
|
+
* What the last print laid down, `null` when there is no print with a
|
|
1486
|
+
* file to read or its file could not be read.
|
|
1487
|
+
*/
|
|
1488
|
+
last_print: LastPrint | null;
|
|
1489
|
+
/** The print paused under the printer, `null` when none is. */
|
|
1490
|
+
paused_print: PausedPrint | null;
|
|
1491
|
+
/**
|
|
1492
|
+
* Where the head is, read only while Z is trusted; `null` otherwise or
|
|
1493
|
+
* when it could not be read.
|
|
1494
|
+
*/
|
|
1495
|
+
position: RecoveryPosition | null;
|
|
1496
|
+
/** The state the printer reports; `offline` when it could not be read. */
|
|
1497
|
+
state: PrinterState;
|
|
1498
|
+
/** Every heater. */
|
|
1499
|
+
temperatures: RecoveryTemperatures;
|
|
1500
|
+
/**
|
|
1501
|
+
* Where Z is homed and whether that sweeps the bed, `null` when
|
|
1502
|
+
* recovery is not configured.
|
|
1503
|
+
*/
|
|
1504
|
+
z_home: ZHome | null;
|
|
1505
|
+
/** Whether Z is trusted. */
|
|
1506
|
+
z_trust: ZTrust;
|
|
1507
|
+
}
|
|
1508
|
+
/** Every heater, as a recovery read reports it. */
|
|
1509
|
+
export interface RecoveryTemperatures {
|
|
1510
|
+
/** The bed, `null` when the printer reports none. */
|
|
1511
|
+
bed: BedTemperature | null;
|
|
1512
|
+
/** Each tool. */
|
|
1513
|
+
tools: Array<ToolTemperature>;
|
|
1514
|
+
}
|
|
1268
1515
|
/**
|
|
1269
1516
|
* Why a request was refused.
|
|
1270
1517
|
*
|
|
@@ -1325,6 +1572,10 @@ export type RejectionReason = {
|
|
|
1325
1572
|
intervention_still_active: {
|
|
1326
1573
|
intervention_id: InterventionId;
|
|
1327
1574
|
};
|
|
1575
|
+
} | {
|
|
1576
|
+
print_not_resumable: {
|
|
1577
|
+
recovery_event_id: EventId;
|
|
1578
|
+
};
|
|
1328
1579
|
} | {
|
|
1329
1580
|
spool_refused: {
|
|
1330
1581
|
cause: SpoolRefusalCause;
|
|
@@ -1728,6 +1979,18 @@ export interface ToolFilament {
|
|
|
1728
1979
|
*/
|
|
1729
1980
|
volume_cm3?: number | null;
|
|
1730
1981
|
}
|
|
1982
|
+
/** One tool heater, as a recovery read reports it. */
|
|
1983
|
+
export interface ToolTemperature {
|
|
1984
|
+
/** What it reads, in degrees Celsius, `null` when not reported. */
|
|
1985
|
+
actual_c: number | null;
|
|
1986
|
+
/**
|
|
1987
|
+
* What it is driving towards, in degrees Celsius, `null` when not
|
|
1988
|
+
* reported.
|
|
1989
|
+
*/
|
|
1990
|
+
target_c: number | null;
|
|
1991
|
+
/** The tool, in the printer's own numbering. */
|
|
1992
|
+
tool: number;
|
|
1993
|
+
}
|
|
1731
1994
|
/** A print this system never saw was found in the printer's own tally. */
|
|
1732
1995
|
export interface UnaccountedPrintPayload {
|
|
1733
1996
|
/** Whether it was charged against a spool. */
|
|
@@ -1791,6 +2054,21 @@ export type UnverifiedReason = {
|
|
|
1791
2054
|
file_name: string;
|
|
1792
2055
|
origin: string;
|
|
1793
2056
|
};
|
|
2057
|
+
/** Where the machine homes Z, and whether doing so sweeps the bed. */
|
|
2058
|
+
export interface ZHome {
|
|
2059
|
+
/** Whether homing Z brings a gantry down over the whole bed. */
|
|
2060
|
+
sweeps_bed: boolean;
|
|
2061
|
+
/** Where in X Z is homed, in millimetres. */
|
|
2062
|
+
x: number;
|
|
2063
|
+
/** Where in Y Z is homed, in millimetres. */
|
|
2064
|
+
y: number;
|
|
2065
|
+
}
|
|
2066
|
+
/** Whether Z is trusted, and since when or why not. */
|
|
2067
|
+
export type ZTrust = {
|
|
2068
|
+
trusted_since: Timestamp;
|
|
2069
|
+
} | {
|
|
2070
|
+
untrusted: string;
|
|
2071
|
+
};
|
|
1794
2072
|
/**
|
|
1795
2073
|
* Every kind the server declares a payload type for, keyed by the kind's
|
|
1796
2074
|
* name, and the type each payload has. A kind this client does not know
|
|
@@ -1821,6 +2099,9 @@ export interface EventPayloads {
|
|
|
1821
2099
|
print_untracked: PrintUntrackedPayload;
|
|
1822
2100
|
printer_connection_changed: PrinterConnectionChangedPayload;
|
|
1823
2101
|
printer_reset: PrinterResetPayload;
|
|
2102
|
+
recovery_executed: RecoveryExecutedPayload;
|
|
2103
|
+
recovery_rejected: RecoveryRejectedPayload;
|
|
2104
|
+
recovery_requested: RecoveryRequestedPayload;
|
|
1824
2105
|
spool_adjusted: SpoolAdjustedPayload;
|
|
1825
2106
|
spool_command_rejected: SpoolCommandRejectedPayload;
|
|
1826
2107
|
spool_loaded: SpoolLoadedPayload;
|
|
@@ -1835,7 +2116,7 @@ export interface EventPayloads {
|
|
|
1835
2116
|
unattended_printer_activity: UnattendedPrinterActivityPayload;
|
|
1836
2117
|
}
|
|
1837
2118
|
/** Every kind the server declares a payload type for, in name order. */
|
|
1838
|
-
export declare const EVENT_KINDS: readonly ["action_executed", "action_rejected", "action_requested", "agent_assessment", "camera_degraded", "camera_look", "charge_pended", "detector_health_changed", "filament_change_signalled", "filament_consumed", "file_tally_rebaselined", "intervention_expired", "malformed_external_event", "obico_failure_alert", "obico_printer_notification", "operator_acknowledgement", "periodic_observation", "port_failure", "preflight_checked", "print_ended", "print_started", "print_untracked", "printer_connection_changed", "printer_reset", "spool_adjusted", "spool_command_rejected", "spool_loaded", "spool_registered", "spool_retired", "spool_unloaded", "spool_unverified", "startup_reconciliation", "supervision_session_closed", "supervision_session_opened", "unaccounted_print", "unattended_printer_activity"];
|
|
2119
|
+
export declare const EVENT_KINDS: readonly ["action_executed", "action_rejected", "action_requested", "agent_assessment", "camera_degraded", "camera_look", "charge_pended", "detector_health_changed", "filament_change_signalled", "filament_consumed", "file_tally_rebaselined", "intervention_expired", "malformed_external_event", "obico_failure_alert", "obico_printer_notification", "operator_acknowledgement", "periodic_observation", "port_failure", "preflight_checked", "print_ended", "print_started", "print_untracked", "printer_connection_changed", "printer_reset", "recovery_executed", "recovery_rejected", "recovery_requested", "spool_adjusted", "spool_command_rejected", "spool_loaded", "spool_registered", "spool_retired", "spool_unloaded", "spool_unverified", "startup_reconciliation", "supervision_session_closed", "supervision_session_opened", "unaccounted_print", "unattended_printer_activity"];
|
|
1839
2120
|
/**
|
|
1840
2121
|
* The payload of one event as the type its kind declares, or `undefined` for
|
|
1841
2122
|
* an event of any other kind — one this client knows or one it does not. No
|
|
@@ -1843,6 +2124,12 @@ export declare const EVENT_KINDS: readonly ["action_executed", "action_rejected"
|
|
|
1843
2124
|
* sent, handed on as the type the table says it is.
|
|
1844
2125
|
*/
|
|
1845
2126
|
export declare function payloadOf<K extends keyof EventPayloads>(event: EventRecord, kind: K): EventPayloads[K] | undefined;
|
|
2127
|
+
/**
|
|
2128
|
+
* Every declaration of the contracts, as the client checks a document
|
|
2129
|
+
* against its declared type: generated from the same declarations as every
|
|
2130
|
+
* type above.
|
|
2131
|
+
*/
|
|
2132
|
+
export declare const SHAPES: Readonly<Record<string, unknown>>;
|
|
1846
2133
|
/**
|
|
1847
2134
|
* One method per operation the server declares.
|
|
1848
2135
|
*
|
|
@@ -2117,4 +2404,82 @@ export declare class GeneratedClient extends GeneratedSurface {
|
|
|
2117
2404
|
* the reason, the value asked for and the range allowed.
|
|
2118
2405
|
*/
|
|
2119
2406
|
retireSpool(spoolId: string, reason: string): Promise<SpoolCommandAnswer>;
|
|
2407
|
+
/**
|
|
2408
|
+
* Call `recover_status` on the configured supervisor.
|
|
2409
|
+
*
|
|
2410
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
2411
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
2412
|
+
* said no.
|
|
2413
|
+
*/
|
|
2414
|
+
recoverStatus(): Promise<RecoveryStatus>;
|
|
2415
|
+
/**
|
|
2416
|
+
* Call `recover_lift` on the configured supervisor.
|
|
2417
|
+
*
|
|
2418
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
2419
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
2420
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
2421
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
2422
|
+
* the reason, the value asked for and the range allowed.
|
|
2423
|
+
*/
|
|
2424
|
+
recoverLift(mm: number, reason: string): Promise<RecoveryAnswer>;
|
|
2425
|
+
/**
|
|
2426
|
+
* Call `recover_cool` on the configured supervisor.
|
|
2427
|
+
*
|
|
2428
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
2429
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
2430
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
2431
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
2432
|
+
* the reason, the value asked for and the range allowed.
|
|
2433
|
+
*/
|
|
2434
|
+
recoverCool(reason: string): Promise<RecoveryAnswer>;
|
|
2435
|
+
/**
|
|
2436
|
+
* Call `recover_fan` on the configured supervisor.
|
|
2437
|
+
*
|
|
2438
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
2439
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
2440
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
2441
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
2442
|
+
* the reason, the value asked for and the range allowed.
|
|
2443
|
+
*/
|
|
2444
|
+
recoverFan(percent: number, reason: string): Promise<RecoveryAnswer>;
|
|
2445
|
+
/**
|
|
2446
|
+
* Call `recover_heat` on the configured supervisor.
|
|
2447
|
+
*
|
|
2448
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
2449
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
2450
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
2451
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
2452
|
+
* the reason, the value asked for and the range allowed.
|
|
2453
|
+
*/
|
|
2454
|
+
recoverHeat(reason: string, targetC: number, tool: number, clearanceAsserted?: boolean): Promise<RecoveryAnswer>;
|
|
2455
|
+
/**
|
|
2456
|
+
* Call `recover_park` on the configured supervisor.
|
|
2457
|
+
*
|
|
2458
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
2459
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
2460
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
2461
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
2462
|
+
* the reason, the value asked for and the range allowed.
|
|
2463
|
+
*/
|
|
2464
|
+
recoverPark(reason: string, clearanceAsserted?: boolean): Promise<RecoveryAnswer>;
|
|
2465
|
+
/**
|
|
2466
|
+
* Call `recover_home_xy` on the configured supervisor.
|
|
2467
|
+
*
|
|
2468
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
2469
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
2470
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
2471
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
2472
|
+
* the reason, the value asked for and the range allowed.
|
|
2473
|
+
*/
|
|
2474
|
+
recoverHomeXy(reason: string, clearanceAsserted?: boolean): Promise<RecoveryAnswer>;
|
|
2475
|
+
/**
|
|
2476
|
+
* Call `recover_home_z` on the configured supervisor.
|
|
2477
|
+
*
|
|
2478
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
2479
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
2480
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
2481
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
2482
|
+
* the reason, the value asked for and the range allowed.
|
|
2483
|
+
*/
|
|
2484
|
+
recoverHomeZ(reason: string, bedClearAsserted?: boolean): Promise<RecoveryAnswer>;
|
|
2120
2485
|
}
|