@printobserver/sdk 0.2.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.
@@ -0,0 +1,976 @@
1
+ /**
2
+ * Generated by `contract-codegen` from the checked-in contract schemas.
3
+ *
4
+ * This file is the Node client's request and response types.
5
+ *
6
+ * Do not edit by hand: change the contracts, regenerate with `just
7
+ * generate-clients`, and commit what that writes.
8
+ */
9
+ import { GeneratedSurface } from "./surface.ts";
10
+ /**
11
+ * The version of the server contract these types were generated from, which
12
+ * is the version the type crate declares in the tree they came from.
13
+ */
14
+ export declare const CONTRACT_VERSION = "0.2.0";
15
+ /**
16
+ * Every operation this client exposes a method for, which is every operation
17
+ * the server declares and no other.
18
+ */
19
+ export declare const OPERATION_NAMES: readonly ["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"];
20
+ /** What an operator's acknowledgement of a failure event asks for next. */
21
+ export type AcknowledgementDisposition = "continue" | "watch" | "stop";
22
+ /** What one mutating request left behind it. */
23
+ export interface ActionAnswer {
24
+ /** The bounded intervention it opened, when it opened one. */
25
+ intervention?: Intervention | null;
26
+ /** What the printer said, when the request reached it and it refused. */
27
+ printer_refusal?: string | null;
28
+ /**
29
+ * The record of the request and the decision taken on it. A rejected
30
+ * request's rejection is here, carrying its reason, the value asked for
31
+ * and the range allowed, so a caller can ask again inside the range.
32
+ */
33
+ record: ActionRecord;
34
+ }
35
+ /** An accepted action reached the printer. */
36
+ export interface ActionExecutedPayload {
37
+ /** The action's identifier. */
38
+ action_id: ActionId;
39
+ /** The bounded intervention it opened, when it opened one. */
40
+ intervention_id?: InterventionId | null;
41
+ }
42
+ /** A lowercase hyphenated version 7 UUID identifying one requested action. */
43
+ export type ActionId = string;
44
+ /**
45
+ * One action of the closed vocabulary, named without its payload.
46
+ *
47
+ * This is what a safety envelope grants and what a policy rejection names;
48
+ * the
49
+ * payload lives on `PrintAction` itself.
50
+ */
51
+ 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";
52
+ /**
53
+ * One request, the decision taken on it, and what became of it.
54
+ *
55
+ * `executed_at` and `outcome` are both optional and are absent together: a
56
+ * record is written when the decision is taken, which is before — and, for a
57
+ * rejected request, instead of — anything reaching the printer.
58
+ */
59
+ export interface ActionRecord {
60
+ /** The decision policy took on it. */
61
+ decision: PolicyDecision;
62
+ /** When it reached the printer, if it did. */
63
+ executed_at?: Timestamp | null;
64
+ /** This record's identifier, minted by the store. */
65
+ id: ActionId;
66
+ /** What the printer made of it, if it reached the printer. */
67
+ outcome?: ExecutionOutcome | null;
68
+ /** The print this request was made against. */
69
+ print_id: PrintId;
70
+ /** The request itself. */
71
+ request: ActionRequest;
72
+ }
73
+ /** Policy refused an action. */
74
+ export interface ActionRejectedPayload {
75
+ /** The action's identifier. */
76
+ action_id: ActionId;
77
+ /** The whole decision, carrying which rejection it was. */
78
+ decision: PolicyDecision;
79
+ }
80
+ /** One request an actor made, at the instant it made it. */
81
+ export interface ActionRequest {
82
+ /** What was asked for. */
83
+ action: PrintAction;
84
+ /** Who asked. */
85
+ actor: Actor;
86
+ /** When they asked. */
87
+ requested_at: Timestamp;
88
+ }
89
+ /** An actor asked for an action. */
90
+ export interface ActionRequestedPayload {
91
+ /** What was asked for. */
92
+ action: PrintAction;
93
+ /** The action's identifier. */
94
+ action_id: ActionId;
95
+ /** Who asked. */
96
+ actor: Actor;
97
+ }
98
+ /** Who asked for something. */
99
+ export type Actor = {
100
+ agent: {
101
+ session_name: string;
102
+ };
103
+ } | "operator" | "system";
104
+ /** An actor class, which is what a safety envelope grants actions to. */
105
+ export type ActorClass = "agent" | "operator" | "system";
106
+ /** One thing an adjustment may change. */
107
+ export type Adjustable = string;
108
+ /**
109
+ * The agent's written record of one supervision turn.
110
+ *
111
+ * This is deliberately not how the agent acts: acting is a
112
+ * `PrintAction` that policy rules on.
113
+ */
114
+ export interface AgentAssessment {
115
+ /** How sure the agent is. */
116
+ confidence: Confidence;
117
+ /** What the agent did. */
118
+ did: string;
119
+ /** Whether the agent is escalating to a person. */
120
+ escalating: boolean;
121
+ /** Whether the print should carry on. */
122
+ should_continue: boolean;
123
+ /** One line saying what is happening. */
124
+ summary: string;
125
+ /** Why it did it. */
126
+ why: string;
127
+ }
128
+ /** The agent wrote down what it made of a turn. */
129
+ export interface AgentAssessmentPayload {
130
+ /** What the agent answered with. */
131
+ assessment: AgentAssessment;
132
+ /** The session the turn ran in. */
133
+ session_name: string;
134
+ }
135
+ /**
136
+ * How sure the agent is.
137
+ *
138
+ * A closed vocabulary rather than a number, because a number invites a
139
+ * precision the agent does not have.
140
+ */
141
+ export type Confidence = "low" | "medium" | "high";
142
+ /**
143
+ * What a context read answers.
144
+ *
145
+ * The latest image is **materialized** here rather than left as the handle
146
+ * `PrintContext` carries: the one thing a supervision turn does with an
147
+ * image is look at it, and a handle is not something anything can open. The
148
+ * path is absolute on this server's own filesystem, exactly as
149
+ * `ImageAnswer`'s is, and is absent when there is no image or when the
150
+ * record is intact and the file is not.
151
+ */
152
+ export interface ContextAnswer {
153
+ /** Everything a supervision turn is given about the print. */
154
+ context: PrintContext;
155
+ /** Where the latest image's bytes are, absolute on this host. */
156
+ image_path?: string | null;
157
+ }
158
+ /**
159
+ * The envelope intersected with the print's manifest.
160
+ *
161
+ * This is what context reports, so that the agent can see its own limits
162
+ * before it asks. Computing one is the supervision core's; this crate
163
+ * declares
164
+ * the shape and nothing that produces it.
165
+ */
166
+ export interface EffectiveBounds {
167
+ /** The range each adjustable may be set to, inclusive. */
168
+ allowed: Record<string, Range>;
169
+ }
170
+ /** What this server answers when it will not do what it was asked. */
171
+ export interface ErrorAnswer {
172
+ /** One line saying why, in the words of whatever refused it. */
173
+ error: string;
174
+ }
175
+ /** A lowercase hyphenated version 7 UUID identifying one event. */
176
+ export type EventId = string;
177
+ /**
178
+ * What every arm of `EventRecord` carries beside its own payload.
179
+ *
180
+ * One event, as the store holds it.
181
+ *
182
+ * `raw` holds the bytes exactly as received for an externally sourced event
183
+ * and is absent for an internally raised one — it is what makes the history
184
+ * auditable when a normalization turns out to be wrong. `print_id` is
185
+ * optional, because an externally sourced event may name no print this
186
+ * system
187
+ * knows.
188
+ */
189
+ export interface EventRecordCommon {
190
+ /** This event's identifier, minted by the store. */
191
+ id: EventId;
192
+ /** The image it arrived with, when it arrived with one. */
193
+ image?: ImageRef | null;
194
+ /** The print it belongs to, when it belongs to one. */
195
+ print_id?: PrintId | null;
196
+ /** The bytes exactly as received, for an externally sourced event. */
197
+ raw?: RawBytes | null;
198
+ /** When it was received. */
199
+ received_at: Timestamp;
200
+ /** Where it came from. */
201
+ source: EventSource;
202
+ }
203
+ /**
204
+ * One event, as the store holds it.
205
+ *
206
+ * `raw` holds the bytes exactly as received for an externally sourced event
207
+ * and is absent for an internally raised one — it is what makes the history
208
+ * auditable when a normalization turns out to be wrong. `print_id` is
209
+ * optional, because an externally sourced event may name no print this
210
+ * system
211
+ * knows.
212
+ */
213
+ export type EventRecord = (EventRecordCommon & {
214
+ kind: "obico_failure_alert";
215
+ payload: ObicoFailureAlertPayload;
216
+ }) | (EventRecordCommon & {
217
+ kind: "obico_printer_notification";
218
+ payload: ObicoPrinterNotificationPayload;
219
+ }) | (EventRecordCommon & {
220
+ kind: "malformed_external_event";
221
+ payload: MalformedExternalEventPayload;
222
+ }) | (EventRecordCommon & {
223
+ kind: "action_requested";
224
+ payload: ActionRequestedPayload;
225
+ }) | (EventRecordCommon & {
226
+ kind: "action_executed";
227
+ payload: ActionExecutedPayload;
228
+ }) | (EventRecordCommon & {
229
+ kind: "action_rejected";
230
+ payload: ActionRejectedPayload;
231
+ }) | (EventRecordCommon & {
232
+ kind: "intervention_expired";
233
+ payload: InterventionExpiredPayload;
234
+ }) | (EventRecordCommon & {
235
+ kind: "supervision_session_opened";
236
+ payload: SupervisionSessionOpenedPayload;
237
+ }) | (EventRecordCommon & {
238
+ kind: "supervision_session_closed";
239
+ payload: SupervisionSessionClosedPayload;
240
+ }) | (EventRecordCommon & {
241
+ kind: "agent_assessment";
242
+ payload: AgentAssessmentPayload;
243
+ }) | (EventRecordCommon & {
244
+ kind: "operator_acknowledgement";
245
+ payload: OperatorAcknowledgementPayload;
246
+ }) | (EventRecordCommon & {
247
+ kind: "port_failure";
248
+ payload: PortFailurePayload;
249
+ }) | (EventRecordCommon & {
250
+ kind: "startup_reconciliation";
251
+ payload: StartupReconciliationPayload;
252
+ });
253
+ /** Where an event came from. */
254
+ export type EventSource = "obico" | "operator" | "agent" | "system";
255
+ /** What happened when an accepted action reached the printer. */
256
+ export type ExecutionOutcome = "succeeded" | {
257
+ failed: {
258
+ reason: string;
259
+ };
260
+ };
261
+ /**
262
+ * A file name a printer's own file API can be asked for: no path separator,
263
+ * no NUL byte, no `.` or `..` segment, no drive prefix, and not empty.
264
+ */
265
+ export type FileName = string;
266
+ /**
267
+ * One heater, as a source reported it.
268
+ *
269
+ * Every field is optional, because a source that reports no heater at all
270
+ * reports none of these; each is a plausibility-ranged reported value in
271
+ * degrees Celsius.
272
+ */
273
+ export interface HeaterSnapshot {
274
+ /** The temperature the heater is at. */
275
+ actual_c?: Reported | null;
276
+ /** The offset applied to this heater's target. */
277
+ offset_c?: Reported | null;
278
+ /** The temperature the heater is driving towards. */
279
+ target_c?: Reported | null;
280
+ }
281
+ /** What a history read answers. */
282
+ export interface HistoryAnswer {
283
+ /** The print's events, newest first. */
284
+ events: Array<EventRecord>;
285
+ }
286
+ /**
287
+ * What an image read answers.
288
+ *
289
+ * The path is absolute on this server's own filesystem, and is the whole of
290
+ * the answer about the bytes: nothing here renders them, encodes them or
291
+ * serves them. It is absent when the record is intact and the file is not,
292
+ * which is a different answer from there being no such image.
293
+ */
294
+ export interface ImageAnswer {
295
+ /** Where its bytes are, absolute on this host. */
296
+ path?: string | null;
297
+ /** The record. */
298
+ record: ImageRecord;
299
+ }
300
+ /** A lowercase hyphenated version 7 UUID identifying one image. */
301
+ export type ImageId = string;
302
+ /**
303
+ * One image, stored beside the event it arrived with.
304
+ *
305
+ * `relative_path` is relative to the configured state directory, so that the
306
+ * store stays portable. Materializing an image resolves that to an absolute
307
+ * path; nothing in this system renders image bytes into JSON.
308
+ */
309
+ export interface ImageRecord {
310
+ /** How many bytes it is. */
311
+ byte_len: number;
312
+ /** The content type it was served as. */
313
+ content_type: string;
314
+ /** The event it arrived with. */
315
+ event_id: EventId;
316
+ /** When it was fetched. */
317
+ fetched_at: Timestamp;
318
+ /** This image's identifier, minted by the store. */
319
+ id: ImageId;
320
+ /** The print it belongs to. */
321
+ print_id: PrintId;
322
+ /** Where it lives, relative to the configured state directory. */
323
+ relative_path: string;
324
+ /** The SHA-256 of its bytes, lowercase hexadecimal. */
325
+ sha256: string;
326
+ /** Where it was fetched from, when it was fetched from somewhere. */
327
+ source_url?: string | null;
328
+ }
329
+ /** The handle an image travels in context under. */
330
+ export interface ImageRef {
331
+ /** The image's identifier. */
332
+ id: ImageId;
333
+ /** The SHA-256 of its bytes, lowercase hexadecimal. */
334
+ sha256: string;
335
+ }
336
+ /**
337
+ * One adjustment made for a bounded time.
338
+ *
339
+ * `prior_value` is read from the printer snapshot taken before the change,
340
+ * and
341
+ * is absent when the printer reported none — in which case expiry restores
342
+ * nothing and the outcome says so rather than guessing a default.
343
+ */
344
+ export interface Intervention {
345
+ /** The action that asked for it. */
346
+ action_id: ActionId;
347
+ /** What it changed. */
348
+ adjustable: Adjustable;
349
+ /** When it was applied. */
350
+ applied_at: Timestamp;
351
+ /** What it was changed to. */
352
+ applied_value: number;
353
+ /** When it stops standing. */
354
+ expires_at: Timestamp;
355
+ /** This intervention's identifier, minted by the store. */
356
+ id: InterventionId;
357
+ /** What became of it. */
358
+ outcome: InterventionOutcome;
359
+ /** The print it was made against. */
360
+ print_id: PrintId;
361
+ /** What the printer reported before the change, if it reported anything. */
362
+ prior_value?: number | null;
363
+ /** When the prior value was put back, if it was. */
364
+ restored_at?: Timestamp | null;
365
+ }
366
+ /** A bounded intervention expired. */
367
+ export interface InterventionExpiredPayload {
368
+ /** What it had changed. */
369
+ adjustable: Adjustable;
370
+ /** The intervention's identifier. */
371
+ intervention_id: InterventionId;
372
+ /** What became of it. */
373
+ outcome: InterventionOutcome;
374
+ }
375
+ /**
376
+ * A lowercase hyphenated version 7 UUID identifying one bounded
377
+ * intervention.
378
+ */
379
+ export type InterventionId = string;
380
+ /** What became of a bounded change. */
381
+ export type InterventionOutcome = "still_active" | "restored" | "restore_unavailable" | {
382
+ restore_failed: {
383
+ reason: string;
384
+ };
385
+ } | {
386
+ superseded: {
387
+ by: InterventionId;
388
+ };
389
+ };
390
+ /**
391
+ * What a sliced job declares about itself and about what may be adjusted.
392
+ *
393
+ * An adjustable the manifest does not name takes the envelope's own range; a
394
+ * manifest range wider than the envelope's is narrowed to the envelope's and
395
+ * the narrowing is recorded on the print. A manifest may only narrow.
396
+ */
397
+ export interface JobManifest {
398
+ /** The range each named adjustable may take, inclusive. */
399
+ allowed: Record<string, Range>;
400
+ /** The file this manifest is about, as the slicer named it. */
401
+ file_name: string;
402
+ /** The material the job is sliced for. */
403
+ material: string;
404
+ /** Whatever else the slicer recorded. */
405
+ metadata: Record<string, string>;
406
+ /** The nozzle the job is sliced for, in millimetres. */
407
+ nozzle_diameter_mm: number;
408
+ /** The slicer profile the job was sliced with. */
409
+ slicer_profile: string;
410
+ }
411
+ /**
412
+ * The job a printer reports it is running.
413
+ *
414
+ * Every field but `state` is optional: an absent one means the source did
415
+ * not
416
+ * report it.
417
+ */
418
+ export interface JobSnapshot {
419
+ /**
420
+ * How far through the print is, as a fraction from zero to one.
421
+ *
422
+ * Normalized to a fraction here regardless of how the source expresses it.
423
+ */
424
+ completion?: Reported | null;
425
+ /** The error the source reports, when it reports one. */
426
+ error?: string | null;
427
+ /** The whole print's estimated duration, in whole seconds. */
428
+ estimated_print_time_s?: number | null;
429
+ /** The name of the file being printed, as the source reported it. */
430
+ file_name?: string | null;
431
+ /** Where the file lives, in the source's own vocabulary. */
432
+ file_origin?: string | null;
433
+ /** How long the print has left, in whole seconds. */
434
+ print_time_left_s?: number | null;
435
+ /** How long the print has been running, in whole seconds. */
436
+ print_time_s?: number | null;
437
+ /** The file's size in bytes. */
438
+ size_bytes?: number | null;
439
+ /** The state the source reports the job to be in. */
440
+ state: PrinterState;
441
+ }
442
+ /**
443
+ * An external body arrived that could not be read.
444
+ *
445
+ * This kind always carries its `raw` bytes, and it exists so that an alert
446
+ * this system cannot read is written down rather than dropped.
447
+ */
448
+ export interface MalformedExternalEventPayload {
449
+ /** One line saying why the body could not be read. */
450
+ detail: string;
451
+ }
452
+ /** What a manifest read or write answers. */
453
+ export interface ManifestAnswer {
454
+ /** The manifest, when the print has one. */
455
+ manifest?: JobManifest | null;
456
+ /**
457
+ * Every range this manifest asked wider than the envelope allows, narrowed
458
+ * to the envelope's — recorded on the print, so nobody has to wonder later
459
+ * which bound applied.
460
+ */
461
+ narrowings: Array<ManifestNarrowing>;
462
+ }
463
+ /** One adjustable whose manifest range was wider than the envelope's. */
464
+ export interface ManifestNarrowing {
465
+ /** The adjustable that was narrowed. */
466
+ adjustable: Adjustable;
467
+ /** The range that stands. */
468
+ applied: Range;
469
+ /** The range the manifest asked for. */
470
+ requested: Range;
471
+ }
472
+ /**
473
+ * Obico reported a print failure.
474
+ *
475
+ * The two instants are optional because Obico's own field for each is a Unix
476
+ * timestamp number, an empty string, or absent, and the last two both mean
477
+ * the
478
+ * producer reported no instant. An absent field here is that, never an epoch
479
+ * date standing in for it.
480
+ */
481
+ export interface ObicoFailureAlertPayload {
482
+ /** When the print ended, when Obico reported an instant for it. */
483
+ ended_at?: Timestamp | null;
484
+ /** The file being printed, when Obico named one. */
485
+ file_name?: string | null;
486
+ /** Whether Obico called it a warning rather than a failure. */
487
+ is_warning: boolean;
488
+ /** Obico's own identifier for the print, when it named one. */
489
+ obico_print_id?: number | null;
490
+ /** Whether Obico paused the print itself. */
491
+ print_paused: boolean;
492
+ /** When the print started, when Obico reported an instant for it. */
493
+ started_at?: Timestamp | null;
494
+ }
495
+ /** The kind of printer notification Obico sent, normalized. */
496
+ export type ObicoNotificationType = "started" | "done" | "cancelled" | "paused" | "resumed" | "filament_change" | "heater_cooled" | "heater_target";
497
+ /**
498
+ * Obico sent a printer notification.
499
+ *
500
+ * The two instants are optional for the same reason
501
+ * `ObicoFailureAlertPayload`'s are, and are absent along with the rest of
502
+ * the print's fields when the notification is about no print at all.
503
+ */
504
+ export interface ObicoPrinterNotificationPayload {
505
+ /** When the print ended, when Obico reported an instant for it. */
506
+ ended_at?: Timestamp | null;
507
+ /** The file being printed, when the notification is about one. */
508
+ file_name?: string | null;
509
+ /** Which notification it is. */
510
+ notification_type: ObicoNotificationType;
511
+ /**
512
+ * Obico's own identifier for the print, when the notification is about
513
+ * one.
514
+ */
515
+ obico_print_id?: number | null;
516
+ /** When the print started, when Obico reported an instant for it. */
517
+ started_at?: Timestamp | null;
518
+ }
519
+ /** An operator acknowledged an event. */
520
+ export interface OperatorAcknowledgementPayload {
521
+ /** The event being acknowledged. */
522
+ acknowledged_event_id: EventId;
523
+ /** What the operator asked for next. */
524
+ disposition: AcknowledgementDisposition;
525
+ }
526
+ /** The decision policy took on one request. */
527
+ export type PolicyDecision = "accepted" | {
528
+ rejected: RejectionReason;
529
+ };
530
+ /**
531
+ * A port failed while one event was being handled.
532
+ *
533
+ * The event is named rather than implied, so that a reader holding an
534
+ * event's
535
+ * identifier reaches every failure recorded while that event was being
536
+ * handled. A failure recorded here is one the handling survived: the event
537
+ * is
538
+ * already in the history by the time any of these sites is reached, and the
539
+ * loop goes on to handle the next event.
540
+ */
541
+ export interface PortFailurePayload {
542
+ /** What the port said about it, in the port's own words. */
543
+ detail: string;
544
+ /** The event whose handling reached the failing call. */
545
+ event_id: EventId;
546
+ /** Where it failed. */
547
+ site: PortFailureSite;
548
+ }
549
+ /**
550
+ * Where a port failed while an event was being handled.
551
+ *
552
+ * A closed set of exactly the sites at which a failure has nowhere else to
553
+ * be
554
+ * recorded. The printer's action methods record theirs on the
555
+ * `ActionRecord` the request minted, and a restoring
556
+ * call records its own on the `Intervention` it was
557
+ * expiring; those are not sites here, because a second record of them would
558
+ * be
559
+ * a second version of one fact.
560
+ */
561
+ export type PortFailureSite = "printer_snapshot" | "printer_job" | "image_write" | "supervision_turn";
562
+ /** The whole vocabulary an actor may ask for, and there is no other. */
563
+ export type PrintAction = {
564
+ action: "pause";
565
+ actor: Actor;
566
+ reason: string;
567
+ } | {
568
+ action: "resume";
569
+ actor: Actor;
570
+ reason: string;
571
+ } | {
572
+ action: "cancel";
573
+ actor: Actor;
574
+ reason: string;
575
+ } | {
576
+ action: "start_print";
577
+ actor: Actor;
578
+ file_name: FileName;
579
+ manifest: JobManifest;
580
+ reason: string;
581
+ } | {
582
+ action: "set_feedrate_factor";
583
+ actor: Actor;
584
+ duration_s?: number | null;
585
+ factor: number;
586
+ reason: string;
587
+ } | {
588
+ action: "set_flowrate_factor";
589
+ actor: Actor;
590
+ duration_s?: number | null;
591
+ factor: number;
592
+ reason: string;
593
+ } | {
594
+ action: "set_tool_target_c";
595
+ actor: Actor;
596
+ duration_s?: number | null;
597
+ reason: string;
598
+ target_c: number;
599
+ tool: number;
600
+ } | {
601
+ action: "set_bed_target_c";
602
+ actor: Actor;
603
+ duration_s?: number | null;
604
+ reason: string;
605
+ target_c: number;
606
+ } | {
607
+ action: "set_fan_percent";
608
+ actor: Actor;
609
+ duration_s?: number | null;
610
+ percent: number;
611
+ reason: string;
612
+ } | {
613
+ action: "acknowledge_failure";
614
+ actor: Actor;
615
+ disposition: AcknowledgementDisposition;
616
+ event_id: EventId;
617
+ reason: string;
618
+ };
619
+ /** Everything a supervision turn is given about one print. */
620
+ export interface PrintContext {
621
+ /** The limits in force, so that the agent can see them before it asks. */
622
+ bounds: EffectiveBounds;
623
+ /** The interventions still active. */
624
+ interventions: Array<Intervention>;
625
+ /** The job, when a snapshot could be taken. */
626
+ job?: JobSnapshot | null;
627
+ /** The most recent image, when there is one. */
628
+ latest_image?: ImageRef | null;
629
+ /** The manifest, when the print has one. */
630
+ manifest?: JobManifest | null;
631
+ /** The print itself. */
632
+ print: PrintRecord;
633
+ /** The printer, when a snapshot could be taken. */
634
+ printer?: PrinterSnapshot | null;
635
+ /** A bounded list of this print's events, newest first. */
636
+ recent_events: Array<EventRecord>;
637
+ }
638
+ /** A lowercase hyphenated version 7 UUID identifying one print. */
639
+ export type PrintId = string;
640
+ /**
641
+ * One print, and the record supervision keys from.
642
+ *
643
+ * Obico's own print id is carried beside this record's identifier rather
644
+ * than
645
+ * as it, because a print may be observed before Obico has one.
646
+ */
647
+ export interface PrintRecord {
648
+ /** Why it ended, if it has. */
649
+ end_reason?: string | null;
650
+ /** When it ended, if it has. */
651
+ ended_at?: Timestamp | null;
652
+ /** The file being printed, as the source reported it. */
653
+ file_name?: string | null;
654
+ /** This print's identifier, minted by the store. */
655
+ id: PrintId;
656
+ /** Every manifest range this print narrowed to the envelope's. */
657
+ narrowings: Array<ManifestNarrowing>;
658
+ /** Obico's own identifier for the print, when Obico has one. */
659
+ obico_print_id?: number | null;
660
+ /** When the print was opened. */
661
+ opened_at: Timestamp;
662
+ /** The state the print is in. */
663
+ state: PrinterState;
664
+ }
665
+ /** A printer, as a source reported it at one instant. */
666
+ export interface PrinterSnapshot {
667
+ /** The bed heater, when the printer reports one. */
668
+ bed?: HeaterSnapshot | null;
669
+ /** The chamber heater, when the printer reports one. */
670
+ chamber?: HeaterSnapshot | null;
671
+ /** The state the printer is in. */
672
+ connection: PrinterState;
673
+ /** The part-cooling fan, in percent. */
674
+ fan_percent?: Reported | null;
675
+ /** The feedrate multiplier, where one means one hundred percent. */
676
+ feedrate_factor?: Reported | null;
677
+ /** The flowrate multiplier, where one means one hundred percent. */
678
+ flowrate_factor?: Reported | null;
679
+ /** The instant this observation was taken. */
680
+ observed_at: Timestamp;
681
+ /** The tool heaters, indexed by tool number. */
682
+ tools: Array<HeaterSnapshot>;
683
+ }
684
+ /**
685
+ * The state a source reports a printer or a print to be in.
686
+ *
687
+ * The `unknown` arm exists so that a state nobody anticipated is recorded
688
+ * carrying the source's own word for it rather than lost.
689
+ */
690
+ export type PrinterState = "operational" | "paused" | "printing" | "cancelling" | "error" | "offline" | {
691
+ unknown: string;
692
+ };
693
+ /** An inclusive pair of 64-bit floats. */
694
+ export interface Range {
695
+ /** The highest value the range admits, inclusive. */
696
+ max: number;
697
+ /** The lowest value the range admits, inclusive. */
698
+ min: number;
699
+ }
700
+ /** Bytes exactly as received, base64-encoded. */
701
+ export type RawBytes = string;
702
+ /**
703
+ * Why a request was refused.
704
+ *
705
+ * Each rejection is a distinct variant, so a consumer distinguishes them by
706
+ * matching rather than by reading a message.
707
+ */
708
+ export type RejectionReason = {
709
+ out_of_bounds: {
710
+ adjustable: Adjustable;
711
+ allowed: Range;
712
+ requested: number;
713
+ };
714
+ } | {
715
+ actor_may_not_request: {
716
+ action: ActionKind;
717
+ actor_class: ActorClass;
718
+ };
719
+ } | "no_active_print" | {
720
+ invalid_from_state: {
721
+ state: PrinterState;
722
+ };
723
+ } | {
724
+ min_interval_not_elapsed: {
725
+ interval_s: number;
726
+ since_last_s: number;
727
+ };
728
+ } | {
729
+ unsupported_adjustable: {
730
+ adjustable: Adjustable;
731
+ };
732
+ };
733
+ /**
734
+ * A value as a source reported it, flagged when it is outside the
735
+ * plausibility range this crate declares for its field.
736
+ */
737
+ export interface Reported {
738
+ /** One shape of the contracts, which say nothing more about it. */
739
+ out_of_range: boolean;
740
+ /** One shape of the contracts, which say nothing more about it. */
741
+ value: number;
742
+ }
743
+ /**
744
+ * What one restart put back the way it found it.
745
+ *
746
+ * A supervisor that has been restarted adopts whatever the store holds
747
+ * rather
748
+ * than starting empty, and each of these is one of those adoptions. They are
749
+ * recorded rather than merely done, because a print that carried on across a
750
+ * restart and one that was started again look identical afterwards unless
751
+ * the
752
+ * history says which happened.
753
+ */
754
+ export type StartupOutcome = "print_adopted" | {
755
+ session_resumed: {
756
+ session_name: string;
757
+ };
758
+ } | {
759
+ intervention_expired: {
760
+ adjustable: Adjustable;
761
+ intervention_id: InterventionId;
762
+ outcome: InterventionOutcome;
763
+ };
764
+ };
765
+ /** A supervisor reconciled one thing the store held when it started. */
766
+ export interface StartupReconciliationPayload {
767
+ /** What was reconciled. */
768
+ outcome: StartupOutcome;
769
+ /** The print it is about. */
770
+ print_id: PrintId;
771
+ }
772
+ /** What a status read answers. */
773
+ export interface StatusAnswer {
774
+ /** The bounded interventions still in force. */
775
+ interventions: Array<Intervention>;
776
+ /** The job, when a snapshot could be taken. */
777
+ job?: JobSnapshot | null;
778
+ /** The print. */
779
+ print: PrintRecord;
780
+ /** The printer, when a snapshot could be taken. */
781
+ printer?: PrinterSnapshot | null;
782
+ /** The supervision session watching it, when one is. */
783
+ session?: SupervisionSession | null;
784
+ }
785
+ /** The supervision session keyed to one print. */
786
+ export interface SupervisionSession {
787
+ /** Why it was closed, if it was. */
788
+ close_reason?: string | null;
789
+ /** When the session was closed, if it was. */
790
+ closed_at?: Timestamp | null;
791
+ /** When the session was opened. */
792
+ created_at: Timestamp;
793
+ /** The identity the harness ran the session under. */
794
+ harness_identity: string;
795
+ /** When the last turn ran. */
796
+ last_turn_at: Timestamp;
797
+ /** The print this session watches. */
798
+ print_id: PrintId;
799
+ /** The session's own name in the harness. */
800
+ session_name: string;
801
+ }
802
+ /** A supervision session was closed. */
803
+ export interface SupervisionSessionClosedPayload {
804
+ /** Why it was closed. */
805
+ close_reason: string;
806
+ /** The session's own name in the harness. */
807
+ session_name: string;
808
+ }
809
+ /** A supervision session was opened. */
810
+ export interface SupervisionSessionOpenedPayload {
811
+ /** The identity the harness ran it under. */
812
+ harness_identity: string;
813
+ /** The session's own name in the harness. */
814
+ session_name: string;
815
+ }
816
+ /** An instant in UTC, as an RFC 3339 string with a zero offset. */
817
+ export type Timestamp = string;
818
+ /**
819
+ * One method per operation the server declares.
820
+ *
821
+ * Every method here is generated from the checked-in description of the
822
+ * server's own operations. The transport, the configuration and the error
823
+ * vocabulary are hand-written, and this class is written against them.
824
+ */
825
+ export declare class GeneratedClient extends GeneratedSurface {
826
+ /**
827
+ * Call `status` on the configured supervisor.
828
+ *
829
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
830
+ * the answer could not be read, and with `Refused` when the supervisor
831
+ * said no.
832
+ */
833
+ status(printId: string): Promise<StatusAnswer>;
834
+ /**
835
+ * Call `context` on the configured supervisor.
836
+ *
837
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
838
+ * the answer could not be read, and with `Refused` when the supervisor
839
+ * said no.
840
+ */
841
+ context(printId: string): Promise<ContextAnswer>;
842
+ /**
843
+ * Call `image` on the configured supervisor.
844
+ *
845
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
846
+ * the answer could not be read, and with `Refused` when the supervisor
847
+ * said no.
848
+ */
849
+ image(imageId: string): Promise<ImageAnswer>;
850
+ /**
851
+ * Call `history` on the configured supervisor.
852
+ *
853
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
854
+ * the answer could not be read, and with `Refused` when the supervisor
855
+ * said no.
856
+ */
857
+ history(printId: string, limit?: number): Promise<HistoryAnswer>;
858
+ /**
859
+ * Call `manifest_get` on the configured supervisor.
860
+ *
861
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
862
+ * the answer could not be read, and with `Refused` when the supervisor
863
+ * said no.
864
+ */
865
+ manifestGet(printId: string): Promise<ManifestAnswer>;
866
+ /**
867
+ * Call `manifest_set` on the configured supervisor.
868
+ *
869
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
870
+ * the answer could not be read, and with `Refused` when the supervisor
871
+ * said no. A call whose reason is empty is refused here, before a request
872
+ * is made, and the policy's own refusal arrives as `Rejected`, carrying
873
+ * the reason, the value asked for and the range allowed.
874
+ */
875
+ manifestSet(printId: string, reason: string, manifest: JobManifest): Promise<ManifestAnswer>;
876
+ /**
877
+ * Call `pause` on the configured supervisor.
878
+ *
879
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
880
+ * the answer could not be read, and with `Refused` when the supervisor
881
+ * said no. A call whose reason is empty is refused here, before a request
882
+ * is made, and the policy's own refusal arrives as `Rejected`, carrying
883
+ * the reason, the value asked for and the range allowed.
884
+ */
885
+ pause(printId: string, reason: string): Promise<ActionAnswer>;
886
+ /**
887
+ * Call `resume` on the configured supervisor.
888
+ *
889
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
890
+ * the answer could not be read, and with `Refused` when the supervisor
891
+ * said no. A call whose reason is empty is refused here, before a request
892
+ * is made, and the policy's own refusal arrives as `Rejected`, carrying
893
+ * the reason, the value asked for and the range allowed.
894
+ */
895
+ resume(printId: string, reason: string): Promise<ActionAnswer>;
896
+ /**
897
+ * Call `cancel` on the configured supervisor.
898
+ *
899
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
900
+ * the answer could not be read, and with `Refused` when the supervisor
901
+ * said no. A call whose reason is empty is refused here, before a request
902
+ * is made, and the policy's own refusal arrives as `Rejected`, carrying
903
+ * the reason, the value asked for and the range allowed.
904
+ */
905
+ cancel(printId: string, reason: string): Promise<ActionAnswer>;
906
+ /**
907
+ * Call `start_print` on the configured supervisor.
908
+ *
909
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
910
+ * the answer could not be read, and with `Refused` when the supervisor
911
+ * said no. A call whose reason is empty is refused here, before a request
912
+ * is made, and the policy's own refusal arrives as `Rejected`, carrying
913
+ * the reason, the value asked for and the range allowed.
914
+ */
915
+ startPrint(printId: string, fileName: FileName, manifest: JobManifest, reason: string): Promise<ActionAnswer>;
916
+ /**
917
+ * Call `set_feedrate_factor` on the configured supervisor.
918
+ *
919
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
920
+ * the answer could not be read, and with `Refused` when the supervisor
921
+ * said no. A call whose reason is empty is refused here, before a request
922
+ * is made, and the policy's own refusal arrives as `Rejected`, carrying
923
+ * the reason, the value asked for and the range allowed.
924
+ */
925
+ setFeedrateFactor(printId: string, factor: number, reason: string, durationS?: number): Promise<ActionAnswer>;
926
+ /**
927
+ * Call `set_flowrate_factor` on the configured supervisor.
928
+ *
929
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
930
+ * the answer could not be read, and with `Refused` when the supervisor
931
+ * said no. A call whose reason is empty is refused here, before a request
932
+ * is made, and the policy's own refusal arrives as `Rejected`, carrying
933
+ * the reason, the value asked for and the range allowed.
934
+ */
935
+ setFlowrateFactor(printId: string, factor: number, reason: string, durationS?: number): Promise<ActionAnswer>;
936
+ /**
937
+ * Call `set_tool_target_c` on the configured supervisor.
938
+ *
939
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
940
+ * the answer could not be read, and with `Refused` when the supervisor
941
+ * said no. A call whose reason is empty is refused here, before a request
942
+ * is made, and the policy's own refusal arrives as `Rejected`, carrying
943
+ * the reason, the value asked for and the range allowed.
944
+ */
945
+ setToolTargetC(printId: string, reason: string, targetC: number, tool: number, durationS?: number): Promise<ActionAnswer>;
946
+ /**
947
+ * Call `set_bed_target_c` on the configured supervisor.
948
+ *
949
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
950
+ * the answer could not be read, and with `Refused` when the supervisor
951
+ * said no. A call whose reason is empty is refused here, before a request
952
+ * is made, and the policy's own refusal arrives as `Rejected`, carrying
953
+ * the reason, the value asked for and the range allowed.
954
+ */
955
+ setBedTargetC(printId: string, reason: string, targetC: number, durationS?: number): Promise<ActionAnswer>;
956
+ /**
957
+ * Call `set_fan_percent` on the configured supervisor.
958
+ *
959
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
960
+ * the answer could not be read, and with `Refused` when the supervisor
961
+ * said no. A call whose reason is empty is refused here, before a request
962
+ * is made, and the policy's own refusal arrives as `Rejected`, carrying
963
+ * the reason, the value asked for and the range allowed.
964
+ */
965
+ setFanPercent(printId: string, percent: number, reason: string, durationS?: number): Promise<ActionAnswer>;
966
+ /**
967
+ * Call `acknowledge_failure` on the configured supervisor.
968
+ *
969
+ * Rejects with `Unreachable` when nothing answered, with `Unreadable` when
970
+ * the answer could not be read, and with `Refused` when the supervisor
971
+ * said no. A call whose reason is empty is refused here, before a request
972
+ * is made, and the policy's own refusal arrives as `Rejected`, carrying
973
+ * the reason, the value asked for and the range allowed.
974
+ */
975
+ acknowledgeFailure(printId: string, disposition: AcknowledgementDisposition, eventId: EventId, reason: string): Promise<ActionAnswer>;
976
+ }