@printobserver/sdk 0.3.0 → 0.4.1
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 +5 -4
- package/dist/client.js +3 -1
- package/dist/contract.d.ts +798 -5
- package/dist/contract.js +252 -2
- package/dist/surface.d.ts +8 -4
- package/dist/surface.js +5 -1
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -25,10 +25,11 @@ export interface ClientOptions {
|
|
|
25
25
|
actor: Actor;
|
|
26
26
|
/**
|
|
27
27
|
* What authenticates to it. The supervisor serves no versioned operation to a
|
|
28
|
-
* caller that does not present
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* that throws `Refused` with status 401.
|
|
28
|
+
* caller that does not present a credential it admits — the operator's, whose
|
|
29
|
+
* verifier it is configured with and which `printobserver credential issue`
|
|
30
|
+
* issues, or the one a supervision turn is handed — and a call it refuses for
|
|
31
|
+
* that throws `Refused` with status 401. A call whose actor is not the
|
|
32
|
+
* identity that credential is throws it with status 403.
|
|
32
33
|
*/
|
|
33
34
|
credential?: string;
|
|
34
35
|
}
|
package/dist/client.js
CHANGED
|
@@ -115,7 +115,9 @@ function refusalText(said) {
|
|
|
115
115
|
/** The policy's own refusal, as the answer to it carries it. */
|
|
116
116
|
function rejection(status, said) {
|
|
117
117
|
const answer = document(status, said);
|
|
118
|
-
|
|
118
|
+
// An action's answer carries its decision in its record; a spool command's
|
|
119
|
+
// carries it at the top.
|
|
120
|
+
const decision = "record" in answer ? answer.record.decision : answer.decision;
|
|
119
121
|
if (typeof decision !== "object" || !("rejected" in decision)) {
|
|
120
122
|
return new Unreadable(status, "the supervisor refused this action and answered a record whose decision is not a refusal");
|
|
121
123
|
}
|
package/dist/contract.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ 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", "manifest_get", "manifest_set", "pause", "resume", "cancel", "start_print", "set_feedrate_factor", "set_flowrate_factor", "set_tool_target_c", "set_bed_target_c", "set_fan_percent", "acknowledge_failure"];
|
|
21
|
+
export declare const OPERATION_NAMES: readonly ["prints", "status", "context", "image", "history", "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", "register_spool", "load_spool", "unload_spool", "adjust_spool", "retire_spool"];
|
|
22
22
|
/** What an operator's acknowledgement of a failure event asks for next. */
|
|
23
23
|
export type AcknowledgementDisposition = "continue" | "watch" | "stop";
|
|
24
24
|
/** What one mutating request left behind it. */
|
|
@@ -50,7 +50,7 @@ export type ActionId = string;
|
|
|
50
50
|
* the
|
|
51
51
|
* payload lives on `PrintAction` itself.
|
|
52
52
|
*/
|
|
53
|
-
export type ActionKind = "pause" | "resume" | "cancel" | "start_print" | "set_feedrate_factor" | "set_flowrate_factor" | "set_tool_target_c" | "set_bed_target_c" | "set_fan_percent" | "acknowledge_failure";
|
|
53
|
+
export type ActionKind = "pause" | "resume" | "cancel" | "start_print" | "set_feedrate_factor" | "set_flowrate_factor" | "set_tool_target_c" | "set_bed_target_c" | "set_fan_percent" | "acknowledge_failure" | "register_spool" | "load_spool" | "unload_spool" | "adjust_spool" | "retire_spool";
|
|
54
54
|
/**
|
|
55
55
|
* One request, the decision taken on it, and what became of it.
|
|
56
56
|
*
|
|
@@ -134,6 +134,56 @@ export interface AgentAssessmentPayload {
|
|
|
134
134
|
/** The session the turn ran in. */
|
|
135
135
|
session_name: string;
|
|
136
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Somebody took a fresh look at the print.
|
|
139
|
+
*
|
|
140
|
+
* Written down before the camera is asked for a frame, so that a frame the
|
|
141
|
+
* camera would not give is recorded against a look that is already in the
|
|
142
|
+
* history; the frame itself, when there is one, is this event's image.
|
|
143
|
+
*/
|
|
144
|
+
export interface CameraLookPayload {
|
|
145
|
+
/**
|
|
146
|
+
* The events for the print that arrived while it waited, and that it
|
|
147
|
+
* handed to whoever looked, oldest first.
|
|
148
|
+
*/
|
|
149
|
+
delivered?: Array<EventId>;
|
|
150
|
+
/**
|
|
151
|
+
* How long the look waited for something to happen before it was taken,
|
|
152
|
+
* in whole seconds.
|
|
153
|
+
*/
|
|
154
|
+
waited_s: number;
|
|
155
|
+
}
|
|
156
|
+
/** The durable identity of one debit, so that a replay can never debit twice. */
|
|
157
|
+
export type ChargeKey = {
|
|
158
|
+
key: "print";
|
|
159
|
+
print_id: PrintId;
|
|
160
|
+
segment: number;
|
|
161
|
+
tool: number;
|
|
162
|
+
} | {
|
|
163
|
+
key: "unobserved";
|
|
164
|
+
file_name: string;
|
|
165
|
+
generation: number;
|
|
166
|
+
origin: string;
|
|
167
|
+
print_number: number;
|
|
168
|
+
tool: number;
|
|
169
|
+
};
|
|
170
|
+
/** How the length a charge debits was worked out. */
|
|
171
|
+
export type ChargeMethod = "slicer_estimate" | "gcode_extrusion" | "file_fraction" | "unobserved_estimate";
|
|
172
|
+
/**
|
|
173
|
+
* Filament a tool fed after an unconfirmed filament change was held for the
|
|
174
|
+
* next spool loaded onto that tool, or confirmed on it.
|
|
175
|
+
*/
|
|
176
|
+
export interface ChargePendedPayload {
|
|
177
|
+
/** What was held. */
|
|
178
|
+
pending: PendingCharge;
|
|
179
|
+
}
|
|
180
|
+
/** One mark a spool command cleared, and the spool it was cleared from. */
|
|
181
|
+
export interface ClearedMark {
|
|
182
|
+
/** The reason that no longer stands. */
|
|
183
|
+
reason: UnverifiedReason;
|
|
184
|
+
/** The spool the mark was cleared from. */
|
|
185
|
+
spool_id: SpoolId;
|
|
186
|
+
}
|
|
137
187
|
/**
|
|
138
188
|
* How sure the agent is.
|
|
139
189
|
*
|
|
@@ -220,11 +270,106 @@ export type ExecutionOutcome = "succeeded" | {
|
|
|
220
270
|
reason: string;
|
|
221
271
|
};
|
|
222
272
|
};
|
|
273
|
+
/** A filament change was signalled during a print. */
|
|
274
|
+
export interface FilamentChangeSignalledPayload {
|
|
275
|
+
/** The position the spool was charged up to, when one was known. */
|
|
276
|
+
position?: FilePosition | null;
|
|
277
|
+
/**
|
|
278
|
+
* Whether that position was read when the signal was handled, rather than
|
|
279
|
+
* being the last one recorded; never with no position at all.
|
|
280
|
+
*/
|
|
281
|
+
position_read_at_signal: boolean;
|
|
282
|
+
/** The kind of the alert that carried the signal. */
|
|
283
|
+
source_kind: EventKind;
|
|
284
|
+
/** The spool that was on it, when one was tracked. */
|
|
285
|
+
spool_id?: SpoolId | null;
|
|
286
|
+
/** The tool the change was signalled for, when it is known. */
|
|
287
|
+
tool?: number | null;
|
|
288
|
+
}
|
|
289
|
+
/** Filament was charged against a spool, or recorded uncharged. */
|
|
290
|
+
export interface FilamentConsumedPayload {
|
|
291
|
+
/**
|
|
292
|
+
* The file's analysed length for the tool, in millimetres, when it had
|
|
293
|
+
* one.
|
|
294
|
+
*/
|
|
295
|
+
analysed_length_mm?: number | null;
|
|
296
|
+
/** The durable identity of this debit. */
|
|
297
|
+
charge_key: ChargeKey;
|
|
298
|
+
/**
|
|
299
|
+
* The density the grams were worked out with, in grams per cubic
|
|
300
|
+
* centimetre.
|
|
301
|
+
*/
|
|
302
|
+
density_g_cm3?: number | null;
|
|
303
|
+
/** The diameter the grams were worked out with, in millimetres. */
|
|
304
|
+
diameter_mm?: number | null;
|
|
305
|
+
/**
|
|
306
|
+
* What that length weighs, in grams, when a spool gave its diameter and
|
|
307
|
+
* density.
|
|
308
|
+
*/
|
|
309
|
+
grams?: number | null;
|
|
310
|
+
/** How much was fed, in millimetres. */
|
|
311
|
+
length_mm: number;
|
|
312
|
+
/** How the length was worked out. */
|
|
313
|
+
method: ChargeMethod;
|
|
314
|
+
/** Anything a reader needs to make sense of the figure. */
|
|
315
|
+
note?: string | null;
|
|
316
|
+
/** How far into the file the charge runs, when that was read. */
|
|
317
|
+
position?: FilePosition | null;
|
|
318
|
+
/** The spool's figure after it, in grams. */
|
|
319
|
+
remaining_after_g?: number | null;
|
|
320
|
+
/** The spool's figure before the charge, in grams. */
|
|
321
|
+
remaining_before_g?: number | null;
|
|
322
|
+
/**
|
|
323
|
+
* The spool charged; absent when nothing was tracked on the tool, and the
|
|
324
|
+
* filament was recorded uncharged.
|
|
325
|
+
*/
|
|
326
|
+
spool_id?: SpoolId | null;
|
|
327
|
+
/** The tool that fed it. */
|
|
328
|
+
tool: number;
|
|
329
|
+
}
|
|
223
330
|
/**
|
|
224
331
|
* A file name a printer's own file API can be asked for: no path separator,
|
|
225
332
|
* no NUL byte, no `.` or `..` segment, no drive prefix, and not empty.
|
|
226
333
|
*/
|
|
227
334
|
export type FileName = string;
|
|
335
|
+
/** How far into its file a print had got, and when that was read. */
|
|
336
|
+
export interface FilePosition {
|
|
337
|
+
/** The byte the printer had read the file up to. */
|
|
338
|
+
bytes: number;
|
|
339
|
+
/** When the position was read. */
|
|
340
|
+
observed_at: Timestamp;
|
|
341
|
+
/** The file's size in bytes, when it was known. */
|
|
342
|
+
size_bytes?: number | null;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* The printer's tally for a file went down — the file was deleted and
|
|
346
|
+
* uploaded again — so the file's tally generation advanced, and the new
|
|
347
|
+
* count
|
|
348
|
+
* is that generation's growth from zero.
|
|
349
|
+
*
|
|
350
|
+
* The rebaseline itself marks no spool; only an `unverified` disposition
|
|
351
|
+
* does.
|
|
352
|
+
*/
|
|
353
|
+
export interface FileTallyRebaselinedPayload {
|
|
354
|
+
/** What became of the prints the new generation counts. */
|
|
355
|
+
disposition: RebaselineDisposition;
|
|
356
|
+
/** The file whose tally went down. */
|
|
357
|
+
file_name: string;
|
|
358
|
+
/** The failed prints the new tally counts. */
|
|
359
|
+
new_failures: number;
|
|
360
|
+
/** The generation it is in now. */
|
|
361
|
+
new_generation: number;
|
|
362
|
+
/** The completed prints the new tally counts. */
|
|
363
|
+
new_successes: number;
|
|
364
|
+
/** The failed prints the old tally counted. */
|
|
365
|
+
old_failures: number;
|
|
366
|
+
/** The generation the tally was in. */
|
|
367
|
+
old_generation: number;
|
|
368
|
+
/** The completed prints the old tally counted. */
|
|
369
|
+
old_successes: number;
|
|
370
|
+
/** Where it lives, in the printer's own vocabulary. */
|
|
371
|
+
origin: string;
|
|
372
|
+
}
|
|
228
373
|
/**
|
|
229
374
|
* One heater, as a source reported it.
|
|
230
375
|
*
|
|
@@ -388,10 +533,20 @@ export interface JobSnapshot {
|
|
|
388
533
|
error?: string | null;
|
|
389
534
|
/** The whole print's estimated duration, in whole seconds. */
|
|
390
535
|
estimated_print_time_s?: number | null;
|
|
536
|
+
/**
|
|
537
|
+
* The filament the source's analysis of the file says each tool uses;
|
|
538
|
+
* empty when the source reported none.
|
|
539
|
+
*/
|
|
540
|
+
filament?: Array<ToolFilament>;
|
|
391
541
|
/** The name of the file being printed, as the source reported it. */
|
|
392
542
|
file_name?: string | null;
|
|
393
543
|
/** Where the file lives, in the source's own vocabulary. */
|
|
394
544
|
file_origin?: string | null;
|
|
545
|
+
/**
|
|
546
|
+
* How far into the file the printer has read, in bytes, when the source
|
|
547
|
+
* reported it.
|
|
548
|
+
*/
|
|
549
|
+
file_position_bytes?: number | null;
|
|
395
550
|
/** How long the print has left, in whole seconds. */
|
|
396
551
|
print_time_left_s?: number | null;
|
|
397
552
|
/** How long the print has been running, in whole seconds. */
|
|
@@ -401,6 +556,48 @@ export interface JobSnapshot {
|
|
|
401
556
|
/** The state the source reports the job to be in. */
|
|
402
557
|
state: PrinterState;
|
|
403
558
|
}
|
|
559
|
+
/** One spool loaded on one tool, as a print started. */
|
|
560
|
+
export interface LoadedSpool {
|
|
561
|
+
/** The spool loaded on it. */
|
|
562
|
+
spool_id: SpoolId;
|
|
563
|
+
/** The tool, in the printer's own numbering. */
|
|
564
|
+
tool: number;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* One fresh look at a print.
|
|
568
|
+
*
|
|
569
|
+
* An answer rather than a record, so it admits fields beside its own the way
|
|
570
|
+
* every answer of the server does: a client that could not open the frame's
|
|
571
|
+
* path says so in a field of its own beside the rest of the answer.
|
|
572
|
+
*/
|
|
573
|
+
export interface Look {
|
|
574
|
+
/**
|
|
575
|
+
* The events for this print that arrived while the look waited, oldest
|
|
576
|
+
* first; the look returned early when there were any.
|
|
577
|
+
*/
|
|
578
|
+
arrived?: Array<EventRecord>;
|
|
579
|
+
/**
|
|
580
|
+
* Whether the print is paused and the pause is the detector's, which is
|
|
581
|
+
* what an adjustment asked for now would be applied under.
|
|
582
|
+
*/
|
|
583
|
+
detector_paused: boolean;
|
|
584
|
+
/**
|
|
585
|
+
* The look itself, as it was written into the print's history, carrying
|
|
586
|
+
* the frame as its image when there is one.
|
|
587
|
+
*/
|
|
588
|
+
event: EventRecord;
|
|
589
|
+
/**
|
|
590
|
+
* The frame the camera gave, absent when no camera is configured or it
|
|
591
|
+
* gave none — which the history records as a port failure.
|
|
592
|
+
*/
|
|
593
|
+
frame?: ImageRef | null;
|
|
594
|
+
/** The absolute path the frame's bytes are at, on the supervisor's host. */
|
|
595
|
+
image_path?: string | null;
|
|
596
|
+
/** The job the printer reports now, absent when it could not be read. */
|
|
597
|
+
job?: JobSnapshot | null;
|
|
598
|
+
/** The printer's state now, absent when it could not be read. */
|
|
599
|
+
printer?: PrinterSnapshot | null;
|
|
600
|
+
}
|
|
404
601
|
/**
|
|
405
602
|
* An external body arrived that could not be read.
|
|
406
603
|
*
|
|
@@ -485,6 +682,72 @@ export interface OperatorAcknowledgementPayload {
|
|
|
485
682
|
/** What the operator asked for next. */
|
|
486
683
|
disposition: AcknowledgementDisposition;
|
|
487
684
|
}
|
|
685
|
+
/**
|
|
686
|
+
* Filament a tool fed after a filament change nobody has confirmed, held
|
|
687
|
+
* until
|
|
688
|
+
* somebody says which spool fed it.
|
|
689
|
+
*
|
|
690
|
+
* A length rather than grams, because the grams follow the spool that takes
|
|
691
|
+
* it.
|
|
692
|
+
*/
|
|
693
|
+
export interface PendingCharge {
|
|
694
|
+
/**
|
|
695
|
+
* The file's analysed length for the tool, in millimetres, when it had
|
|
696
|
+
* one.
|
|
697
|
+
*/
|
|
698
|
+
analysed_length_mm?: number | null;
|
|
699
|
+
/** The key of the print segment the filament was fed in. */
|
|
700
|
+
charge_key: ChargeKey;
|
|
701
|
+
/** How much was fed, in millimetres. */
|
|
702
|
+
length_mm: number;
|
|
703
|
+
/** How that length was worked out. */
|
|
704
|
+
method: ChargeMethod;
|
|
705
|
+
/** Anything a reader needs to make sense of the figure. */
|
|
706
|
+
note?: string | null;
|
|
707
|
+
/** When it was held. */
|
|
708
|
+
pended_at: Timestamp;
|
|
709
|
+
/** How far into the file the segment ran, when that was read. */
|
|
710
|
+
position?: FilePosition | null;
|
|
711
|
+
/** The print it was fed in. */
|
|
712
|
+
print_id: PrintId;
|
|
713
|
+
/** The tool that fed it. */
|
|
714
|
+
tool: number;
|
|
715
|
+
}
|
|
716
|
+
/** One pending charge a spool command took. */
|
|
717
|
+
export interface PendingTaken {
|
|
718
|
+
/** The key it is charged under. */
|
|
719
|
+
charge_key: ChargeKey;
|
|
720
|
+
/** The print it was fed in. */
|
|
721
|
+
print_id: PrintId;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* The supervisor looked in on an active print on its own schedule, with no
|
|
725
|
+
* detector having said anything about it.
|
|
726
|
+
*
|
|
727
|
+
* What a failure detector never alerts on — a progress that stopped moving,
|
|
728
|
+
* a
|
|
729
|
+
* heater whose target fell to nothing mid-print, a fan cut at a bridge, a
|
|
730
|
+
* wall
|
|
731
|
+
* going thin — is still on the machine and in the camera's frame, so every
|
|
732
|
+
* active print is given one of these each interval and a turn on it. It
|
|
733
|
+
* carries what the printer reported as it was taken; the frame the camera
|
|
734
|
+
* gave
|
|
735
|
+
* at the same moment, untagged by any detector, is this event's image.
|
|
736
|
+
*/
|
|
737
|
+
export interface PeriodicObservationPayload {
|
|
738
|
+
/** How often these are taken, in whole seconds. */
|
|
739
|
+
interval_s: number;
|
|
740
|
+
/**
|
|
741
|
+
* The job the printer reported as the observation was taken, absent when
|
|
742
|
+
* it could not be read.
|
|
743
|
+
*/
|
|
744
|
+
job?: JobSnapshot | null;
|
|
745
|
+
/**
|
|
746
|
+
* The printer's state as the observation was taken, absent when it could
|
|
747
|
+
* not be read — which the history records as a port failure.
|
|
748
|
+
*/
|
|
749
|
+
printer?: PrinterSnapshot | null;
|
|
750
|
+
}
|
|
488
751
|
/** The decision policy took on one request. */
|
|
489
752
|
export type PolicyDecision = "accepted" | {
|
|
490
753
|
rejected: RejectionReason;
|
|
@@ -520,7 +783,60 @@ export interface PortFailurePayload {
|
|
|
520
783
|
* be
|
|
521
784
|
* a second version of one fact.
|
|
522
785
|
*/
|
|
523
|
-
export type PortFailureSite = "printer_snapshot" | "printer_job" | "image_write" | "supervision_turn";
|
|
786
|
+
export type PortFailureSite = "printer_snapshot" | "printer_job" | "image_write" | "supervision_turn" | "camera_look" | "detector_acknowledgement";
|
|
787
|
+
/** What a filament check found for one print. */
|
|
788
|
+
export interface Preflight {
|
|
789
|
+
/** When the check was made. */
|
|
790
|
+
checked_at: Timestamp;
|
|
791
|
+
/** The file the print is of. */
|
|
792
|
+
file_name: string;
|
|
793
|
+
/** What it found for each tool. */
|
|
794
|
+
tools: Array<PreflightTool>;
|
|
795
|
+
/**
|
|
796
|
+
* The worst of the tools' verdicts, in the order insufficient,
|
|
797
|
+
* unverified spool, no analysis, warned, overridden, unchecked, passed.
|
|
798
|
+
*/
|
|
799
|
+
verdict: PreflightVerdict;
|
|
800
|
+
}
|
|
801
|
+
/** What a filament check answers. */
|
|
802
|
+
export interface PreflightAnswer {
|
|
803
|
+
/** What the check found, read now. */
|
|
804
|
+
preflight: Preflight;
|
|
805
|
+
}
|
|
806
|
+
/** The filament check before a start was made. */
|
|
807
|
+
export interface PreflightCheckedPayload {
|
|
808
|
+
/** The start it was made for, when it was made for one. */
|
|
809
|
+
action_id?: ActionId | null;
|
|
810
|
+
/** What the check found. */
|
|
811
|
+
preflight: Preflight;
|
|
812
|
+
}
|
|
813
|
+
/** What a filament check found for one tool. */
|
|
814
|
+
export interface PreflightTool {
|
|
815
|
+
/** The margin asked for beyond that, in grams. */
|
|
816
|
+
buffer_g?: number | null;
|
|
817
|
+
/**
|
|
818
|
+
* The loaded spool's marks at the check, oldest first, whatever the
|
|
819
|
+
* verdict, so a spool both short and unverified says both.
|
|
820
|
+
*/
|
|
821
|
+
marks?: Array<UnverifiedMark>;
|
|
822
|
+
/** What the spool holds, in grams. */
|
|
823
|
+
remaining_g?: number | null;
|
|
824
|
+
/** What the print needs from it, in grams, when the file's analysis says. */
|
|
825
|
+
required_g?: number | null;
|
|
826
|
+
/** The spool loaded on it, when one is. */
|
|
827
|
+
spool_id?: SpoolId | null;
|
|
828
|
+
/**
|
|
829
|
+
* That spool's name, beside its identifier, so a reader need not look it
|
|
830
|
+
* up.
|
|
831
|
+
*/
|
|
832
|
+
spool_name?: string | null;
|
|
833
|
+
/** The tool, in the printer's own numbering. */
|
|
834
|
+
tool: number;
|
|
835
|
+
/** What the check found for this tool. */
|
|
836
|
+
verdict: PreflightVerdict;
|
|
837
|
+
}
|
|
838
|
+
/** What a filament check found, for one tool or for a whole print. */
|
|
839
|
+
export type PreflightVerdict = "passed" | "unchecked" | "insufficient" | "unverified_spool" | "no_analysis" | "overridden" | "warned";
|
|
524
840
|
/** The whole vocabulary an actor may ask for, and there is no other. */
|
|
525
841
|
export type PrintAction = {
|
|
526
842
|
action: "pause";
|
|
@@ -539,6 +855,7 @@ export type PrintAction = {
|
|
|
539
855
|
actor: Actor;
|
|
540
856
|
file_name: FileName;
|
|
541
857
|
manifest: JobManifest;
|
|
858
|
+
override_filament_check?: boolean;
|
|
542
859
|
reason: string;
|
|
543
860
|
} | {
|
|
544
861
|
action: "set_feedrate_factor";
|
|
@@ -597,8 +914,21 @@ export interface PrintContext {
|
|
|
597
914
|
/** A bounded list of this print's events, newest first. */
|
|
598
915
|
recent_events: Array<EventRecord>;
|
|
599
916
|
}
|
|
917
|
+
/** A print ended. */
|
|
918
|
+
export interface PrintEndedPayload {
|
|
919
|
+
/** How far into its file it last read, when that was read. */
|
|
920
|
+
last_position?: FilePosition | null;
|
|
921
|
+
/** How it ended. */
|
|
922
|
+
outcome: PrintOutcome;
|
|
923
|
+
/** Why it ended, in the words the end was recorded with. */
|
|
924
|
+
reason: string;
|
|
925
|
+
/** The state the printer was in as it ended. */
|
|
926
|
+
state: PrinterState;
|
|
927
|
+
}
|
|
600
928
|
/** A lowercase hyphenated version 7 UUID identifying one print. */
|
|
601
929
|
export type PrintId = string;
|
|
930
|
+
/** How a print ended. */
|
|
931
|
+
export type PrintOutcome = "completed" | "cancelled" | "failed";
|
|
602
932
|
/**
|
|
603
933
|
* One print, and the record supervision keys from.
|
|
604
934
|
*
|
|
@@ -615,6 +945,31 @@ export interface PrintRecord {
|
|
|
615
945
|
file_name?: string | null;
|
|
616
946
|
/** This print's identifier, minted by the store. */
|
|
617
947
|
id: PrintId;
|
|
948
|
+
/**
|
|
949
|
+
* The longest running time, in whole seconds, the printer reported for
|
|
950
|
+
* this print's job at a read that found it printing rather than paused.
|
|
951
|
+
*
|
|
952
|
+
* The time a job has spent printing only grows, pause or no pause, so a
|
|
953
|
+
* job of this print's file reporting less — by more than
|
|
954
|
+
* `listing::JOB_IDENTITY_TOLERANCE_S` — is a later job. Absent until a
|
|
955
|
+
* read finds the job printing.
|
|
956
|
+
*/
|
|
957
|
+
job_print_time_s?: number | null;
|
|
958
|
+
/**
|
|
959
|
+
* When the printer's job this print records began, as the printer's own
|
|
960
|
+
* running time put it at the latest read that found the job running or
|
|
961
|
+
* paused: the instant of that read, less the running time it reported.
|
|
962
|
+
*
|
|
963
|
+
* `OctoPrint` counts a pause into the running time until the job resumes
|
|
964
|
+
* and then takes the pause back out, so a pause moves this later: a read
|
|
965
|
+
* putting it further than `listing::JOB_IDENTITY_TOLERANCE_S` from the one
|
|
966
|
+
* recorded resets it, rather than it being fixed once. Absent when no read
|
|
967
|
+
* has
|
|
968
|
+
* found this print's job reporting a running time — a print opened by an
|
|
969
|
+
* alert or a start before any read, and every print recorded before this
|
|
970
|
+
* was.
|
|
971
|
+
*/
|
|
972
|
+
job_started_at?: Timestamp | null;
|
|
618
973
|
/** Every manifest range this print narrowed to the envelope's. */
|
|
619
974
|
narrowings: Array<ManifestNarrowing>;
|
|
620
975
|
/** When the print was opened. */
|
|
@@ -627,6 +982,28 @@ export interface PrintRecord {
|
|
|
627
982
|
/** The state the print is in. */
|
|
628
983
|
state: PrinterState;
|
|
629
984
|
}
|
|
985
|
+
/** A print started. */
|
|
986
|
+
export interface PrintStartedPayload {
|
|
987
|
+
/** The file being printed, when it is known. */
|
|
988
|
+
file_name?: string | null;
|
|
989
|
+
/** The spool loaded on each tool as it started. */
|
|
990
|
+
loaded: Array<LoadedSpool>;
|
|
991
|
+
/** The filament check made before it started, when one was. */
|
|
992
|
+
preflight?: Preflight | null;
|
|
993
|
+
/**
|
|
994
|
+
* The action that started it; absent when the print was observed rather
|
|
995
|
+
* than started through this system.
|
|
996
|
+
*/
|
|
997
|
+
started_by?: ActionId | null;
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* A print that was already open when spool tracking was installed: it is
|
|
1001
|
+
* never charged, and this says why it carries no charge.
|
|
1002
|
+
*/
|
|
1003
|
+
export interface PrintUntrackedPayload {
|
|
1004
|
+
/** Why the print carries no charge. */
|
|
1005
|
+
reason: string;
|
|
1006
|
+
}
|
|
630
1007
|
/** A printer, as a source reported it at one instant. */
|
|
631
1008
|
export interface PrinterSnapshot {
|
|
632
1009
|
/** The bed heater, when the printer reports one. */
|
|
@@ -682,6 +1059,8 @@ export interface Range {
|
|
|
682
1059
|
}
|
|
683
1060
|
/** Bytes exactly as received, base64-encoded. */
|
|
684
1061
|
export type RawBytes = string;
|
|
1062
|
+
/** What became of the prints a file's new tally generation counts. */
|
|
1063
|
+
export type RebaselineDisposition = "accounted" | "unverified";
|
|
685
1064
|
/**
|
|
686
1065
|
* Why a request was refused.
|
|
687
1066
|
*
|
|
@@ -712,6 +1091,32 @@ export type RejectionReason = {
|
|
|
712
1091
|
unsupported_adjustable: {
|
|
713
1092
|
adjustable: Adjustable;
|
|
714
1093
|
};
|
|
1094
|
+
} | {
|
|
1095
|
+
insufficient_filament: {
|
|
1096
|
+
buffer_g: number;
|
|
1097
|
+
remaining_g: number;
|
|
1098
|
+
required_g: number;
|
|
1099
|
+
spool_id: SpoolId;
|
|
1100
|
+
spool_name: string;
|
|
1101
|
+
tool: number;
|
|
1102
|
+
unverified?: UnverifiedReason | null;
|
|
1103
|
+
};
|
|
1104
|
+
} | {
|
|
1105
|
+
unverified_spool: {
|
|
1106
|
+
reason: UnverifiedReason;
|
|
1107
|
+
spool_id: SpoolId;
|
|
1108
|
+
spool_name: string;
|
|
1109
|
+
tool: number;
|
|
1110
|
+
};
|
|
1111
|
+
} | {
|
|
1112
|
+
analysis_unavailable: {
|
|
1113
|
+
file_name: string;
|
|
1114
|
+
waited_s: number;
|
|
1115
|
+
};
|
|
1116
|
+
} | {
|
|
1117
|
+
spool_refused: {
|
|
1118
|
+
detail: string;
|
|
1119
|
+
};
|
|
715
1120
|
};
|
|
716
1121
|
/**
|
|
717
1122
|
* A value as a source reported it, flagged when it is outside the
|
|
@@ -723,6 +1128,227 @@ export interface Reported {
|
|
|
723
1128
|
/** One shape of the contracts, which say nothing more about it. */
|
|
724
1129
|
value: number;
|
|
725
1130
|
}
|
|
1131
|
+
/** A spool's remaining figure was corrected. */
|
|
1132
|
+
export interface SpoolAdjustedPayload {
|
|
1133
|
+
/** Who corrected it. */
|
|
1134
|
+
actor: Actor;
|
|
1135
|
+
/** Every mark the correction cleared. */
|
|
1136
|
+
cleared_marks?: Array<ClearedMark>;
|
|
1137
|
+
/**
|
|
1138
|
+
* The scale reading the figure was worked out from, when it was given as
|
|
1139
|
+
* one.
|
|
1140
|
+
*/
|
|
1141
|
+
gross_g?: number | null;
|
|
1142
|
+
/** Why. */
|
|
1143
|
+
reason: string;
|
|
1144
|
+
/** Its figure after, in grams. */
|
|
1145
|
+
remaining_after_g: number;
|
|
1146
|
+
/** Its figure before, in grams, after any pending charge it took. */
|
|
1147
|
+
remaining_before_g: number;
|
|
1148
|
+
/** The spool corrected. */
|
|
1149
|
+
spool_id: SpoolId;
|
|
1150
|
+
/**
|
|
1151
|
+
* The pending charges the correction took first, each also its own
|
|
1152
|
+
* `filament_consumed` event under its key.
|
|
1153
|
+
*/
|
|
1154
|
+
took_pending?: Array<PendingTaken>;
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* What one spool's read answers: the spool, and the newest of the printer's
|
|
1158
|
+
* own events that name it.
|
|
1159
|
+
*/
|
|
1160
|
+
export interface SpoolAnswer {
|
|
1161
|
+
/** The newest timeline events naming it, newest first. */
|
|
1162
|
+
recent: Array<EventRecord>;
|
|
1163
|
+
/** The spool, retired or not. */
|
|
1164
|
+
spool: SpoolRecord;
|
|
1165
|
+
}
|
|
1166
|
+
/** The whole vocabulary of the spool ledger, and there is no other. */
|
|
1167
|
+
export type SpoolCommand = {
|
|
1168
|
+
command: "register_spool";
|
|
1169
|
+
actor: Actor;
|
|
1170
|
+
color?: string | null;
|
|
1171
|
+
density_g_cm3?: number | null;
|
|
1172
|
+
diameter_mm?: number | null;
|
|
1173
|
+
initial_g: number;
|
|
1174
|
+
material: string;
|
|
1175
|
+
name: string;
|
|
1176
|
+
reason: string;
|
|
1177
|
+
remaining_g?: number | null;
|
|
1178
|
+
tare_g?: number | null;
|
|
1179
|
+
} | {
|
|
1180
|
+
command: "load_spool";
|
|
1181
|
+
actor: Actor;
|
|
1182
|
+
reason: string;
|
|
1183
|
+
spool_id: SpoolId;
|
|
1184
|
+
tool: number;
|
|
1185
|
+
} | {
|
|
1186
|
+
command: "unload_spool";
|
|
1187
|
+
actor: Actor;
|
|
1188
|
+
reason: string;
|
|
1189
|
+
spool_id: SpoolId;
|
|
1190
|
+
} | {
|
|
1191
|
+
command: "adjust_spool";
|
|
1192
|
+
actor: Actor;
|
|
1193
|
+
gross_g?: number | null;
|
|
1194
|
+
reason: string;
|
|
1195
|
+
remaining_g?: number | null;
|
|
1196
|
+
spool_id: SpoolId;
|
|
1197
|
+
} | {
|
|
1198
|
+
command: "retire_spool";
|
|
1199
|
+
actor: Actor;
|
|
1200
|
+
reason: string;
|
|
1201
|
+
spool_id: SpoolId;
|
|
1202
|
+
};
|
|
1203
|
+
/**
|
|
1204
|
+
* What a spool command answers, accepted or refused.
|
|
1205
|
+
*
|
|
1206
|
+
* A refusal is the same shape and deliberately so: the decision carries the
|
|
1207
|
+
* grant or the ledger's own reason, and the events are the record the
|
|
1208
|
+
* refusal
|
|
1209
|
+
* wrote.
|
|
1210
|
+
*/
|
|
1211
|
+
export interface SpoolCommandAnswer {
|
|
1212
|
+
/** The decision taken on the command. */
|
|
1213
|
+
decision: PolicyDecision;
|
|
1214
|
+
/** Every event it wrote, in the order they were written. */
|
|
1215
|
+
events: Array<EventRecord>;
|
|
1216
|
+
/** The spool it was about, as the command left it, when there is one. */
|
|
1217
|
+
spool?: SpoolRecord | null;
|
|
1218
|
+
}
|
|
1219
|
+
/** A spool command was refused. */
|
|
1220
|
+
export interface SpoolCommandRejectedPayload {
|
|
1221
|
+
/** The command, as it was asked for. */
|
|
1222
|
+
command: SpoolCommand;
|
|
1223
|
+
/** The whole decision, carrying which refusal it was. */
|
|
1224
|
+
decision: PolicyDecision;
|
|
1225
|
+
}
|
|
1226
|
+
/** A lowercase hyphenated version 7 UUID identifying one registered spool. */
|
|
1227
|
+
export type SpoolId = string;
|
|
1228
|
+
/** A spool was loaded onto a tool, or confirmed as never having left it. */
|
|
1229
|
+
export interface SpoolLoadedPayload {
|
|
1230
|
+
/** Who loaded it. */
|
|
1231
|
+
actor: Actor;
|
|
1232
|
+
/** Every mark the load cleared, on either spool. */
|
|
1233
|
+
cleared_marks?: Array<ClearedMark>;
|
|
1234
|
+
/** Why. */
|
|
1235
|
+
reason: string;
|
|
1236
|
+
/** The spool the load swapped off the tool, when it was occupied. */
|
|
1237
|
+
replaced?: SpoolId | null;
|
|
1238
|
+
/** The spool loaded. */
|
|
1239
|
+
spool_id: SpoolId;
|
|
1240
|
+
/**
|
|
1241
|
+
* The pending charges the load took, each also its own
|
|
1242
|
+
* `filament_consumed` event under its key.
|
|
1243
|
+
*/
|
|
1244
|
+
took_pending?: Array<PendingTaken>;
|
|
1245
|
+
/** The tool, in the printer's own numbering. */
|
|
1246
|
+
tool: number;
|
|
1247
|
+
}
|
|
1248
|
+
/** One spool the operator registered, and what is known of it now. */
|
|
1249
|
+
export interface SpoolRecord {
|
|
1250
|
+
/** The filament's colour, when the operator gave one. */
|
|
1251
|
+
color?: string | null;
|
|
1252
|
+
/** The material's density, in grams per cubic centimetre; above zero. */
|
|
1253
|
+
density_g_cm3: number;
|
|
1254
|
+
/** The filament's diameter, in millimetres; above zero. */
|
|
1255
|
+
diameter_mm: number;
|
|
1256
|
+
/** This spool's identifier, minted when it was registered. */
|
|
1257
|
+
id: SpoolId;
|
|
1258
|
+
/** The net filament on the spool when it was full, in grams; above zero. */
|
|
1259
|
+
initial_g: number;
|
|
1260
|
+
/** The tool the spool is loaded on, when it is loaded. */
|
|
1261
|
+
loaded_on_tool?: number | null;
|
|
1262
|
+
/** The material, as given and trimmed, such as `PLA`; never empty. */
|
|
1263
|
+
material: string;
|
|
1264
|
+
/** The operator's own label for the spool; never empty. */
|
|
1265
|
+
name: string;
|
|
1266
|
+
/** When the spool was registered. */
|
|
1267
|
+
registered_at: Timestamp;
|
|
1268
|
+
/**
|
|
1269
|
+
* The filament left, in grams.
|
|
1270
|
+
*
|
|
1271
|
+
* Always the initial figure less every charge plus every correction. A
|
|
1272
|
+
* charge is never refused or clamped, so this may go below zero.
|
|
1273
|
+
*/
|
|
1274
|
+
remaining_g: number;
|
|
1275
|
+
/** When the spool was retired, if it has been. */
|
|
1276
|
+
retired_at?: Timestamp | null;
|
|
1277
|
+
/** The empty spool's own weight, in grams, when the operator gave it. */
|
|
1278
|
+
tare_g?: number | null;
|
|
1279
|
+
/** How far the remaining figure can be trusted. */
|
|
1280
|
+
trust: SpoolTrust;
|
|
1281
|
+
/** When anything about the spool last changed. */
|
|
1282
|
+
updated_at: Timestamp;
|
|
1283
|
+
}
|
|
1284
|
+
/** A spool was registered. */
|
|
1285
|
+
export interface SpoolRegisteredPayload {
|
|
1286
|
+
/** Who registered it. */
|
|
1287
|
+
actor: Actor;
|
|
1288
|
+
/** Why. */
|
|
1289
|
+
reason: string;
|
|
1290
|
+
/** The spool, as it was registered. */
|
|
1291
|
+
spool: SpoolRecord;
|
|
1292
|
+
}
|
|
1293
|
+
/** A spool was retired. */
|
|
1294
|
+
export interface SpoolRetiredPayload {
|
|
1295
|
+
/** Who retired it. */
|
|
1296
|
+
actor: Actor;
|
|
1297
|
+
/** Why. */
|
|
1298
|
+
reason: string;
|
|
1299
|
+
/** Its figure as it was retired, in grams. */
|
|
1300
|
+
remaining_g: number;
|
|
1301
|
+
/** The spool retired. */
|
|
1302
|
+
spool_id: SpoolId;
|
|
1303
|
+
}
|
|
1304
|
+
/** How far a spool's remaining figure can be trusted. */
|
|
1305
|
+
export type SpoolTrust = {
|
|
1306
|
+
state: "verified";
|
|
1307
|
+
} | {
|
|
1308
|
+
state: "unverified";
|
|
1309
|
+
marks: Array<UnverifiedMark>;
|
|
1310
|
+
};
|
|
1311
|
+
/** A spool was unloaded from its tool. */
|
|
1312
|
+
export interface SpoolUnloadedPayload {
|
|
1313
|
+
/** Who unloaded it. */
|
|
1314
|
+
actor: Actor;
|
|
1315
|
+
/** Why. */
|
|
1316
|
+
reason: string;
|
|
1317
|
+
/** The spool unloaded. */
|
|
1318
|
+
spool_id: SpoolId;
|
|
1319
|
+
/** The tool it left. */
|
|
1320
|
+
tool: number;
|
|
1321
|
+
}
|
|
1322
|
+
/** A spool was marked as one whose figure is in doubt. */
|
|
1323
|
+
export interface SpoolUnverifiedPayload {
|
|
1324
|
+
/** Why its figure is in doubt. */
|
|
1325
|
+
reason: UnverifiedReason;
|
|
1326
|
+
/** The spool marked. */
|
|
1327
|
+
spool_id: SpoolId;
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* What the spools read answers.
|
|
1331
|
+
*
|
|
1332
|
+
* `at_a_glance` is one line per spool, in the order `spools` lists them,
|
|
1333
|
+
* composed here so that what is left on each spool is the first thing a
|
|
1334
|
+
* reader of either rendering meets rather than a figure inside a whole
|
|
1335
|
+
* record. Its name is what puts it first: both renderings walk an answer's
|
|
1336
|
+
* fields in name order, ahead of `pending` and `spools`.
|
|
1337
|
+
*/
|
|
1338
|
+
export interface SpoolsAnswer {
|
|
1339
|
+
/** One line per spool in `spools`, in the same order. */
|
|
1340
|
+
at_a_glance: Array<string>;
|
|
1341
|
+
/**
|
|
1342
|
+
* Every charge held after a filament change nobody has confirmed, oldest
|
|
1343
|
+
* first: what the next spool loaded on that tool is charged.
|
|
1344
|
+
*/
|
|
1345
|
+
pending: Array<PendingCharge>;
|
|
1346
|
+
/**
|
|
1347
|
+
* Every spool, retired ones only when asked for, most recently registered
|
|
1348
|
+
* first.
|
|
1349
|
+
*/
|
|
1350
|
+
spools: Array<SpoolRecord>;
|
|
1351
|
+
}
|
|
726
1352
|
/**
|
|
727
1353
|
* What one restart put back the way it found it.
|
|
728
1354
|
*
|
|
@@ -796,8 +1422,67 @@ export interface SupervisionSessionOpenedPayload {
|
|
|
796
1422
|
/** The session's own name in the harness. */
|
|
797
1423
|
session_name: string;
|
|
798
1424
|
}
|
|
1425
|
+
/** What a printer history read answers: one page of the printer's own events. */
|
|
1426
|
+
export interface TimelineAnswer {
|
|
1427
|
+
/** The events, newest first. */
|
|
1428
|
+
events: Array<EventRecord>;
|
|
1429
|
+
/**
|
|
1430
|
+
* The cursor for the following, older page, given as `before`; absent
|
|
1431
|
+
* when there is none.
|
|
1432
|
+
*/
|
|
1433
|
+
next?: EventId | null;
|
|
1434
|
+
}
|
|
799
1435
|
/** An instant in UTC, as an RFC 3339 string with a zero offset. */
|
|
800
1436
|
export type Timestamp = string;
|
|
1437
|
+
/** The filament one tool feeds, as a length and, when it is known, a volume. */
|
|
1438
|
+
export interface ToolFilament {
|
|
1439
|
+
/** The length of filament fed, in millimetres. */
|
|
1440
|
+
length_mm: number;
|
|
1441
|
+
/** The tool, in the printer's own numbering. */
|
|
1442
|
+
tool: number;
|
|
1443
|
+
/**
|
|
1444
|
+
* The volume of filament fed, in cubic centimetres, when the source
|
|
1445
|
+
* reported one.
|
|
1446
|
+
*/
|
|
1447
|
+
volume_cm3?: number | null;
|
|
1448
|
+
}
|
|
1449
|
+
/** A print this system never saw was found in the printer's own tally. */
|
|
1450
|
+
export interface UnaccountedPrintPayload {
|
|
1451
|
+
/** Whether it was charged against a spool. */
|
|
1452
|
+
charged: boolean;
|
|
1453
|
+
/** The file that was printed. */
|
|
1454
|
+
file_name: string;
|
|
1455
|
+
/** When it was printed, when the printer says. */
|
|
1456
|
+
printed_at?: Timestamp | null;
|
|
1457
|
+
/** Whether it completed. */
|
|
1458
|
+
success: boolean;
|
|
1459
|
+
}
|
|
1460
|
+
/** One reason a spool's figure is in doubt, and since when. */
|
|
1461
|
+
export interface UnverifiedMark {
|
|
1462
|
+
/** Why the figure is in doubt. */
|
|
1463
|
+
reason: UnverifiedReason;
|
|
1464
|
+
/** When the spool was marked for it. */
|
|
1465
|
+
since: Timestamp;
|
|
1466
|
+
}
|
|
1467
|
+
/** Why a spool's figure is in doubt. */
|
|
1468
|
+
export type UnverifiedReason = {
|
|
1469
|
+
reason: "uncharged_print";
|
|
1470
|
+
print_id: PrintId;
|
|
1471
|
+
} | {
|
|
1472
|
+
reason: "unaccounted_print";
|
|
1473
|
+
file_name: string;
|
|
1474
|
+
printed_at: Timestamp;
|
|
1475
|
+
} | {
|
|
1476
|
+
reason: "filament_change_unconfirmed";
|
|
1477
|
+
print_id: PrintId;
|
|
1478
|
+
} | {
|
|
1479
|
+
reason: "filament_change_unconfirmed_position";
|
|
1480
|
+
print_id: PrintId;
|
|
1481
|
+
} | {
|
|
1482
|
+
reason: "tally_reset";
|
|
1483
|
+
file_name: string;
|
|
1484
|
+
origin: string;
|
|
1485
|
+
};
|
|
801
1486
|
/**
|
|
802
1487
|
* Every kind the server declares a payload type for, keyed by the kind's
|
|
803
1488
|
* name, and the type each payload has. A kind this client does not know
|
|
@@ -808,18 +1493,36 @@ export interface EventPayloads {
|
|
|
808
1493
|
action_rejected: ActionRejectedPayload;
|
|
809
1494
|
action_requested: ActionRequestedPayload;
|
|
810
1495
|
agent_assessment: AgentAssessmentPayload;
|
|
1496
|
+
camera_look: CameraLookPayload;
|
|
1497
|
+
charge_pended: ChargePendedPayload;
|
|
1498
|
+
filament_change_signalled: FilamentChangeSignalledPayload;
|
|
1499
|
+
filament_consumed: FilamentConsumedPayload;
|
|
1500
|
+
file_tally_rebaselined: FileTallyRebaselinedPayload;
|
|
811
1501
|
intervention_expired: InterventionExpiredPayload;
|
|
812
1502
|
malformed_external_event: MalformedExternalEventPayload;
|
|
813
1503
|
obico_failure_alert: ObicoFailureAlertPayload;
|
|
814
1504
|
obico_printer_notification: ObicoPrinterNotificationPayload;
|
|
815
1505
|
operator_acknowledgement: OperatorAcknowledgementPayload;
|
|
1506
|
+
periodic_observation: PeriodicObservationPayload;
|
|
816
1507
|
port_failure: PortFailurePayload;
|
|
1508
|
+
preflight_checked: PreflightCheckedPayload;
|
|
1509
|
+
print_ended: PrintEndedPayload;
|
|
1510
|
+
print_started: PrintStartedPayload;
|
|
1511
|
+
print_untracked: PrintUntrackedPayload;
|
|
1512
|
+
spool_adjusted: SpoolAdjustedPayload;
|
|
1513
|
+
spool_command_rejected: SpoolCommandRejectedPayload;
|
|
1514
|
+
spool_loaded: SpoolLoadedPayload;
|
|
1515
|
+
spool_registered: SpoolRegisteredPayload;
|
|
1516
|
+
spool_retired: SpoolRetiredPayload;
|
|
1517
|
+
spool_unloaded: SpoolUnloadedPayload;
|
|
1518
|
+
spool_unverified: SpoolUnverifiedPayload;
|
|
817
1519
|
startup_reconciliation: StartupReconciliationPayload;
|
|
818
1520
|
supervision_session_closed: SupervisionSessionClosedPayload;
|
|
819
1521
|
supervision_session_opened: SupervisionSessionOpenedPayload;
|
|
1522
|
+
unaccounted_print: UnaccountedPrintPayload;
|
|
820
1523
|
}
|
|
821
1524
|
/** Every kind the server declares a payload type for, in name order. */
|
|
822
|
-
export declare const EVENT_KINDS: readonly ["action_executed", "action_rejected", "action_requested", "agent_assessment", "intervention_expired", "malformed_external_event", "obico_failure_alert", "obico_printer_notification", "operator_acknowledgement", "port_failure", "startup_reconciliation", "supervision_session_closed", "supervision_session_opened"];
|
|
1525
|
+
export declare const EVENT_KINDS: readonly ["action_executed", "action_rejected", "action_requested", "agent_assessment", "camera_look", "charge_pended", "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", "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"];
|
|
823
1526
|
/**
|
|
824
1527
|
* The payload of one event as the type its kind declares, or `undefined` for
|
|
825
1528
|
* an event of any other kind — one this client knows or one it does not. No
|
|
@@ -883,6 +1586,14 @@ export declare class GeneratedClient extends GeneratedSurface {
|
|
|
883
1586
|
* said no.
|
|
884
1587
|
*/
|
|
885
1588
|
manifestGet(printId: string): Promise<ManifestAnswer>;
|
|
1589
|
+
/**
|
|
1590
|
+
* Call `look` on the configured supervisor.
|
|
1591
|
+
*
|
|
1592
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
1593
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
1594
|
+
* said no.
|
|
1595
|
+
*/
|
|
1596
|
+
look(printId: string, waitS?: number): Promise<Look>;
|
|
886
1597
|
/**
|
|
887
1598
|
* Call `manifest_set` on the configured supervisor.
|
|
888
1599
|
*
|
|
@@ -893,6 +1604,38 @@ export declare class GeneratedClient extends GeneratedSurface {
|
|
|
893
1604
|
* the reason, the value asked for and the range allowed.
|
|
894
1605
|
*/
|
|
895
1606
|
manifestSet(printId: string, reason: string, manifest: JobManifest): Promise<ManifestAnswer>;
|
|
1607
|
+
/**
|
|
1608
|
+
* Call `spools` on the configured supervisor.
|
|
1609
|
+
*
|
|
1610
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
1611
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
1612
|
+
* said no.
|
|
1613
|
+
*/
|
|
1614
|
+
spools(includeRetired?: boolean): Promise<SpoolsAnswer>;
|
|
1615
|
+
/**
|
|
1616
|
+
* Call `spool` on the configured supervisor.
|
|
1617
|
+
*
|
|
1618
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
1619
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
1620
|
+
* said no.
|
|
1621
|
+
*/
|
|
1622
|
+
spool(spoolId: string): Promise<SpoolAnswer>;
|
|
1623
|
+
/**
|
|
1624
|
+
* Call `printer_history` on the configured supervisor.
|
|
1625
|
+
*
|
|
1626
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
1627
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
1628
|
+
* said no.
|
|
1629
|
+
*/
|
|
1630
|
+
printerHistory(kinds?: Array<string>, since?: string, until?: string, spoolId?: string, before?: string, limit?: number): Promise<TimelineAnswer>;
|
|
1631
|
+
/**
|
|
1632
|
+
* Call `preflight` on the configured supervisor.
|
|
1633
|
+
*
|
|
1634
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
1635
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
1636
|
+
* said no.
|
|
1637
|
+
*/
|
|
1638
|
+
preflight(fileName: string): Promise<PreflightAnswer>;
|
|
896
1639
|
/**
|
|
897
1640
|
* Call `pause` on the configured supervisor.
|
|
898
1641
|
*
|
|
@@ -932,7 +1675,7 @@ export declare class GeneratedClient extends GeneratedSurface {
|
|
|
932
1675
|
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
933
1676
|
* the reason, the value asked for and the range allowed.
|
|
934
1677
|
*/
|
|
935
|
-
startPrint(printId: string, fileName: FileName, manifest: JobManifest, reason: string): Promise<ActionAnswer>;
|
|
1678
|
+
startPrint(printId: string, fileName: FileName, manifest: JobManifest, reason: string, overrideFilamentCheck?: boolean): Promise<ActionAnswer>;
|
|
936
1679
|
/**
|
|
937
1680
|
* Call `set_feedrate_factor` on the configured supervisor.
|
|
938
1681
|
*
|
|
@@ -993,4 +1736,54 @@ export declare class GeneratedClient extends GeneratedSurface {
|
|
|
993
1736
|
* the reason, the value asked for and the range allowed.
|
|
994
1737
|
*/
|
|
995
1738
|
acknowledgeFailure(printId: string, disposition: AcknowledgementDisposition, eventId: EventId, reason: string): Promise<ActionAnswer>;
|
|
1739
|
+
/**
|
|
1740
|
+
* Call `register_spool` on the configured supervisor.
|
|
1741
|
+
*
|
|
1742
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
1743
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
1744
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
1745
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
1746
|
+
* the reason, the value asked for and the range allowed.
|
|
1747
|
+
*/
|
|
1748
|
+
registerSpool(initialG: number, material: string, name: string, reason: string, color?: string, densityGCm3?: number, diameterMm?: number, remainingG?: number, tareG?: number): Promise<SpoolCommandAnswer>;
|
|
1749
|
+
/**
|
|
1750
|
+
* Call `load_spool` on the configured supervisor.
|
|
1751
|
+
*
|
|
1752
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
1753
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
1754
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
1755
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
1756
|
+
* the reason, the value asked for and the range allowed.
|
|
1757
|
+
*/
|
|
1758
|
+
loadSpool(spoolId: string, reason: string, tool: number): Promise<SpoolCommandAnswer>;
|
|
1759
|
+
/**
|
|
1760
|
+
* Call `unload_spool` on the configured supervisor.
|
|
1761
|
+
*
|
|
1762
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
1763
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
1764
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
1765
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
1766
|
+
* the reason, the value asked for and the range allowed.
|
|
1767
|
+
*/
|
|
1768
|
+
unloadSpool(spoolId: string, reason: string): Promise<SpoolCommandAnswer>;
|
|
1769
|
+
/**
|
|
1770
|
+
* Call `adjust_spool` on the configured supervisor.
|
|
1771
|
+
*
|
|
1772
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
1773
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
1774
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
1775
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
1776
|
+
* the reason, the value asked for and the range allowed.
|
|
1777
|
+
*/
|
|
1778
|
+
adjustSpool(spoolId: string, reason: string, grossG?: number, remainingG?: number): Promise<SpoolCommandAnswer>;
|
|
1779
|
+
/**
|
|
1780
|
+
* Call `retire_spool` on the configured supervisor.
|
|
1781
|
+
*
|
|
1782
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
1783
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
1784
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
1785
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
1786
|
+
* the reason, the value asked for and the range allowed.
|
|
1787
|
+
*/
|
|
1788
|
+
retireSpool(spoolId: string, reason: string): Promise<SpoolCommandAnswer>;
|
|
996
1789
|
}
|
package/dist/contract.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* generate-clients`, and commit what that writes.
|
|
8
8
|
*/
|
|
9
9
|
import { GeneratedSurface, reasonGiven } from "./surface.js";
|
|
10
|
-
export const CONTRACT_VERSION = "0.
|
|
10
|
+
export const CONTRACT_VERSION = "0.4.1";
|
|
11
11
|
/**
|
|
12
12
|
* Every operation this client exposes a method for, which is every operation
|
|
13
13
|
* the server declares and no other.
|
|
@@ -19,7 +19,12 @@ export const OPERATION_NAMES = [
|
|
|
19
19
|
"image",
|
|
20
20
|
"history",
|
|
21
21
|
"manifest_get",
|
|
22
|
+
"look",
|
|
22
23
|
"manifest_set",
|
|
24
|
+
"spools",
|
|
25
|
+
"spool",
|
|
26
|
+
"printer_history",
|
|
27
|
+
"preflight",
|
|
23
28
|
"pause",
|
|
24
29
|
"resume",
|
|
25
30
|
"cancel",
|
|
@@ -30,6 +35,11 @@ export const OPERATION_NAMES = [
|
|
|
30
35
|
"set_bed_target_c",
|
|
31
36
|
"set_fan_percent",
|
|
32
37
|
"acknowledge_failure",
|
|
38
|
+
"register_spool",
|
|
39
|
+
"load_spool",
|
|
40
|
+
"unload_spool",
|
|
41
|
+
"adjust_spool",
|
|
42
|
+
"retire_spool",
|
|
33
43
|
];
|
|
34
44
|
/** Every kind the server declares a payload type for, in name order. */
|
|
35
45
|
export const EVENT_KINDS = [
|
|
@@ -37,15 +47,33 @@ export const EVENT_KINDS = [
|
|
|
37
47
|
"action_rejected",
|
|
38
48
|
"action_requested",
|
|
39
49
|
"agent_assessment",
|
|
50
|
+
"camera_look",
|
|
51
|
+
"charge_pended",
|
|
52
|
+
"filament_change_signalled",
|
|
53
|
+
"filament_consumed",
|
|
54
|
+
"file_tally_rebaselined",
|
|
40
55
|
"intervention_expired",
|
|
41
56
|
"malformed_external_event",
|
|
42
57
|
"obico_failure_alert",
|
|
43
58
|
"obico_printer_notification",
|
|
44
59
|
"operator_acknowledgement",
|
|
60
|
+
"periodic_observation",
|
|
45
61
|
"port_failure",
|
|
62
|
+
"preflight_checked",
|
|
63
|
+
"print_ended",
|
|
64
|
+
"print_started",
|
|
65
|
+
"print_untracked",
|
|
66
|
+
"spool_adjusted",
|
|
67
|
+
"spool_command_rejected",
|
|
68
|
+
"spool_loaded",
|
|
69
|
+
"spool_registered",
|
|
70
|
+
"spool_retired",
|
|
71
|
+
"spool_unloaded",
|
|
72
|
+
"spool_unverified",
|
|
46
73
|
"startup_reconciliation",
|
|
47
74
|
"supervision_session_closed",
|
|
48
75
|
"supervision_session_opened",
|
|
76
|
+
"unaccounted_print",
|
|
49
77
|
];
|
|
50
78
|
/**
|
|
51
79
|
* The payload of one event as the type its kind declares, or `undefined` for
|
|
@@ -155,6 +183,23 @@ export class GeneratedClient extends GeneratedSurface {
|
|
|
155
183
|
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
156
184
|
return await this.call("GET", target, asked, sending);
|
|
157
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Call `look` on the configured supervisor.
|
|
188
|
+
*
|
|
189
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
190
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
191
|
+
* said no.
|
|
192
|
+
*/
|
|
193
|
+
async look(printId, waitS) {
|
|
194
|
+
const target = `/v1/prints/${printId}/look`;
|
|
195
|
+
const asked = [];
|
|
196
|
+
if (waitS !== undefined) {
|
|
197
|
+
asked.push(["wait_s", String(waitS)]);
|
|
198
|
+
}
|
|
199
|
+
const sending = undefined;
|
|
200
|
+
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
201
|
+
return await this.call("GET", target, asked, sending);
|
|
202
|
+
}
|
|
158
203
|
/**
|
|
159
204
|
* Call `manifest_set` on the configured supervisor.
|
|
160
205
|
*
|
|
@@ -174,6 +219,88 @@ export class GeneratedClient extends GeneratedSurface {
|
|
|
174
219
|
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
175
220
|
return await this.call("PUT", target, asked, sending);
|
|
176
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* Call `spools` on the configured supervisor.
|
|
224
|
+
*
|
|
225
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
226
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
227
|
+
* said no.
|
|
228
|
+
*/
|
|
229
|
+
async spools(includeRetired) {
|
|
230
|
+
const target = `/v1/spools`;
|
|
231
|
+
const asked = [];
|
|
232
|
+
if (includeRetired !== undefined) {
|
|
233
|
+
asked.push(["include_retired", String(includeRetired)]);
|
|
234
|
+
}
|
|
235
|
+
const sending = undefined;
|
|
236
|
+
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
237
|
+
return await this.call("GET", target, asked, sending);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Call `spool` on the configured supervisor.
|
|
241
|
+
*
|
|
242
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
243
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
244
|
+
* said no.
|
|
245
|
+
*/
|
|
246
|
+
async spool(spoolId) {
|
|
247
|
+
const target = `/v1/spools/${spoolId}`;
|
|
248
|
+
const asked = [];
|
|
249
|
+
const sending = undefined;
|
|
250
|
+
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
251
|
+
return await this.call("GET", target, asked, sending);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Call `printer_history` on the configured supervisor.
|
|
255
|
+
*
|
|
256
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
257
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
258
|
+
* said no.
|
|
259
|
+
*/
|
|
260
|
+
async printerHistory(kinds, since, until, spoolId, before, limit) {
|
|
261
|
+
const target = `/v1/history`;
|
|
262
|
+
const asked = [];
|
|
263
|
+
if (kinds !== undefined) {
|
|
264
|
+
for (const value of kinds) {
|
|
265
|
+
asked.push(["kinds", String(value)]);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (since !== undefined) {
|
|
269
|
+
asked.push(["since", String(since)]);
|
|
270
|
+
}
|
|
271
|
+
if (until !== undefined) {
|
|
272
|
+
asked.push(["until", String(until)]);
|
|
273
|
+
}
|
|
274
|
+
if (spoolId !== undefined) {
|
|
275
|
+
asked.push(["spool_id", String(spoolId)]);
|
|
276
|
+
}
|
|
277
|
+
if (before !== undefined) {
|
|
278
|
+
asked.push(["before", String(before)]);
|
|
279
|
+
}
|
|
280
|
+
if (limit !== undefined) {
|
|
281
|
+
asked.push(["limit", String(limit)]);
|
|
282
|
+
}
|
|
283
|
+
const sending = undefined;
|
|
284
|
+
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
285
|
+
return await this.call("GET", target, asked, sending);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Call `preflight` on the configured supervisor.
|
|
289
|
+
*
|
|
290
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
291
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
292
|
+
* said no.
|
|
293
|
+
*/
|
|
294
|
+
async preflight(fileName) {
|
|
295
|
+
const target = `/v1/preflight`;
|
|
296
|
+
const asked = [];
|
|
297
|
+
if (fileName !== undefined) {
|
|
298
|
+
asked.push(["file_name", String(fileName)]);
|
|
299
|
+
}
|
|
300
|
+
const sending = undefined;
|
|
301
|
+
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
302
|
+
return await this.call("GET", target, asked, sending);
|
|
303
|
+
}
|
|
177
304
|
/**
|
|
178
305
|
* Call `pause` on the configured supervisor.
|
|
179
306
|
*
|
|
@@ -240,7 +367,7 @@ export class GeneratedClient extends GeneratedSurface {
|
|
|
240
367
|
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
241
368
|
* the reason, the value asked for and the range allowed.
|
|
242
369
|
*/
|
|
243
|
-
async startPrint(printId, fileName, manifest, reason) {
|
|
370
|
+
async startPrint(printId, fileName, manifest, reason, overrideFilamentCheck) {
|
|
244
371
|
reasonGiven(reason);
|
|
245
372
|
const target = `/v1/prints/${printId}/actions/start_print`;
|
|
246
373
|
const asked = [];
|
|
@@ -248,6 +375,9 @@ export class GeneratedClient extends GeneratedSurface {
|
|
|
248
375
|
sending.actor = this.actor;
|
|
249
376
|
sending.file_name = fileName;
|
|
250
377
|
sending.manifest = manifest;
|
|
378
|
+
if (overrideFilamentCheck !== undefined) {
|
|
379
|
+
sending.override_filament_check = overrideFilamentCheck;
|
|
380
|
+
}
|
|
251
381
|
sending.reason = reason;
|
|
252
382
|
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
253
383
|
return await this.call("POST", target, asked, sending);
|
|
@@ -389,4 +519,124 @@ export class GeneratedClient extends GeneratedSurface {
|
|
|
389
519
|
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
390
520
|
return await this.call("POST", target, asked, sending);
|
|
391
521
|
}
|
|
522
|
+
/**
|
|
523
|
+
* Call `register_spool` on the configured supervisor.
|
|
524
|
+
*
|
|
525
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
526
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
527
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
528
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
529
|
+
* the reason, the value asked for and the range allowed.
|
|
530
|
+
*/
|
|
531
|
+
async registerSpool(initialG, material, name, reason, color, densityGCm3, diameterMm, remainingG, tareG) {
|
|
532
|
+
reasonGiven(reason);
|
|
533
|
+
const target = `/v1/spools/actions/register_spool`;
|
|
534
|
+
const asked = [];
|
|
535
|
+
const sending = {};
|
|
536
|
+
sending.actor = this.actor;
|
|
537
|
+
if (color !== undefined) {
|
|
538
|
+
sending.color = color;
|
|
539
|
+
}
|
|
540
|
+
if (densityGCm3 !== undefined) {
|
|
541
|
+
sending.density_g_cm3 = densityGCm3;
|
|
542
|
+
}
|
|
543
|
+
if (diameterMm !== undefined) {
|
|
544
|
+
sending.diameter_mm = diameterMm;
|
|
545
|
+
}
|
|
546
|
+
sending.initial_g = initialG;
|
|
547
|
+
sending.material = material;
|
|
548
|
+
sending.name = name;
|
|
549
|
+
sending.reason = reason;
|
|
550
|
+
if (remainingG !== undefined) {
|
|
551
|
+
sending.remaining_g = remainingG;
|
|
552
|
+
}
|
|
553
|
+
if (tareG !== undefined) {
|
|
554
|
+
sending.tare_g = tareG;
|
|
555
|
+
}
|
|
556
|
+
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
557
|
+
return await this.call("POST", target, asked, sending);
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Call `load_spool` on the configured supervisor.
|
|
561
|
+
*
|
|
562
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
563
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
564
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
565
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
566
|
+
* the reason, the value asked for and the range allowed.
|
|
567
|
+
*/
|
|
568
|
+
async loadSpool(spoolId, reason, tool) {
|
|
569
|
+
reasonGiven(reason);
|
|
570
|
+
const target = `/v1/spools/${spoolId}/actions/load_spool`;
|
|
571
|
+
const asked = [];
|
|
572
|
+
const sending = {};
|
|
573
|
+
sending.actor = this.actor;
|
|
574
|
+
sending.reason = reason;
|
|
575
|
+
sending.tool = tool;
|
|
576
|
+
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
577
|
+
return await this.call("POST", target, asked, sending);
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Call `unload_spool` on the configured supervisor.
|
|
581
|
+
*
|
|
582
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
583
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
584
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
585
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
586
|
+
* the reason, the value asked for and the range allowed.
|
|
587
|
+
*/
|
|
588
|
+
async unloadSpool(spoolId, reason) {
|
|
589
|
+
reasonGiven(reason);
|
|
590
|
+
const target = `/v1/spools/${spoolId}/actions/unload_spool`;
|
|
591
|
+
const asked = [];
|
|
592
|
+
const sending = {};
|
|
593
|
+
sending.actor = this.actor;
|
|
594
|
+
sending.reason = reason;
|
|
595
|
+
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
596
|
+
return await this.call("POST", target, asked, sending);
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Call `adjust_spool` on the configured supervisor.
|
|
600
|
+
*
|
|
601
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
602
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
603
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
604
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
605
|
+
* the reason, the value asked for and the range allowed.
|
|
606
|
+
*/
|
|
607
|
+
async adjustSpool(spoolId, reason, grossG, remainingG) {
|
|
608
|
+
reasonGiven(reason);
|
|
609
|
+
const target = `/v1/spools/${spoolId}/actions/adjust_spool`;
|
|
610
|
+
const asked = [];
|
|
611
|
+
const sending = {};
|
|
612
|
+
sending.actor = this.actor;
|
|
613
|
+
if (grossG !== undefined) {
|
|
614
|
+
sending.gross_g = grossG;
|
|
615
|
+
}
|
|
616
|
+
sending.reason = reason;
|
|
617
|
+
if (remainingG !== undefined) {
|
|
618
|
+
sending.remaining_g = remainingG;
|
|
619
|
+
}
|
|
620
|
+
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
621
|
+
return await this.call("POST", target, asked, sending);
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Call `retire_spool` on the configured supervisor.
|
|
625
|
+
*
|
|
626
|
+
* Rejects with `Unreachable` when nothing answered, with `Unreadable` when
|
|
627
|
+
* the answer could not be read, and with `Refused` when the supervisor
|
|
628
|
+
* said no. A call whose reason is empty is refused here, before a request
|
|
629
|
+
* is made, and the policy's own refusal arrives as `Rejected`, carrying
|
|
630
|
+
* the reason, the value asked for and the range allowed.
|
|
631
|
+
*/
|
|
632
|
+
async retireSpool(spoolId, reason) {
|
|
633
|
+
reasonGiven(reason);
|
|
634
|
+
const target = `/v1/spools/${spoolId}/actions/retire_spool`;
|
|
635
|
+
const asked = [];
|
|
636
|
+
const sending = {};
|
|
637
|
+
sending.actor = this.actor;
|
|
638
|
+
sending.reason = reason;
|
|
639
|
+
// llmlint: ignore[boundary_inputs_validated] See suppressions.toml.
|
|
640
|
+
return await this.call("POST", target, asked, sending);
|
|
641
|
+
}
|
|
392
642
|
}
|
package/dist/surface.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* are that module's, imported as types alone, so that the two files can name
|
|
11
11
|
* each other's shapes without either being unloadable.
|
|
12
12
|
*/
|
|
13
|
-
import type { ActionAnswer, Actor, Range, RejectionReason } from "./contract.ts";
|
|
13
|
+
import type { ActionAnswer, Actor, Range, RejectionReason, SpoolCommandAnswer } from "./contract.ts";
|
|
14
14
|
/** Why a call did not answer what it asked for. */
|
|
15
15
|
export declare class ClientError extends Error {
|
|
16
16
|
constructor(said: string);
|
|
@@ -72,9 +72,13 @@ export declare class Rejected extends ClientError {
|
|
|
72
72
|
readonly requested: number | undefined;
|
|
73
73
|
/** The range that is allowed, where the policy ruled on a value. */
|
|
74
74
|
readonly allowed: Range | undefined;
|
|
75
|
-
/**
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
/**
|
|
76
|
+
* The whole answer: an action's, whose record carries the request and the
|
|
77
|
+
* decision, or a spool command's, carrying the decision and the events its
|
|
78
|
+
* refusal wrote.
|
|
79
|
+
*/
|
|
80
|
+
readonly answer: ActionAnswer | SpoolCommandAnswer;
|
|
81
|
+
constructor(reason: RejectionReason, requested: number | undefined, allowed: Range | undefined, answer: ActionAnswer | SpoolCommandAnswer);
|
|
78
82
|
}
|
|
79
83
|
/**
|
|
80
84
|
* Refuse a mutating call that carries no reason, before it is made.
|
package/dist/surface.js
CHANGED
|
@@ -99,7 +99,11 @@ export class Rejected extends ClientError {
|
|
|
99
99
|
requested;
|
|
100
100
|
/** The range that is allowed, where the policy ruled on a value. */
|
|
101
101
|
allowed;
|
|
102
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* The whole answer: an action's, whose record carries the request and the
|
|
104
|
+
* decision, or a spool command's, carrying the decision and the events its
|
|
105
|
+
* refusal wrote.
|
|
106
|
+
*/
|
|
103
107
|
answer;
|
|
104
108
|
constructor(reason, requested, allowed, answer) {
|
|
105
109
|
super(`the supervisor's policy refused this action: ${JSON.stringify(reason)}` +
|
package/package.json
CHANGED
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"main": "dist/index.js",
|
|
14
14
|
"name": "@printobserver/sdk",
|
|
15
|
-
"printobserverContractVersion": "0.
|
|
15
|
+
"printobserverContractVersion": "0.4.1",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
18
|
"url": "https://github.com/nickderobertis/printobserver"
|
|
19
19
|
},
|
|
20
20
|
"type": "module",
|
|
21
21
|
"types": "dist/index.d.ts",
|
|
22
|
-
"version": "0.
|
|
22
|
+
"version": "0.4.1"
|
|
23
23
|
}
|