@printobserver/sdk 0.8.1 → 0.9.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.
@@ -134,6 +134,21 @@ export interface AgentAssessmentPayload {
134
134
  /** The session the turn ran in. */
135
135
  session_name: string;
136
136
  }
137
+ /**
138
+ * The camera gave no usable frame for a look or a periodic observation,
139
+ * however many times it was asked.
140
+ *
141
+ * Written in place of the look or the observation it was for, so that no
142
+ * frame the camera could not give is handed to the agent as one it did.
143
+ */
144
+ export interface CameraDegradedPayload {
145
+ /** How many frames were fetched, every one of them bad. */
146
+ attempts: number;
147
+ /** Why the last of them was bad. */
148
+ cause: FrameCause;
149
+ /** What was wrong with each, in words. */
150
+ detail: string;
151
+ }
137
152
  /**
138
153
  * Somebody took a fresh look at the print.
139
154
  *
@@ -231,6 +246,33 @@ export interface ContextAnswer {
231
246
  /** Where the latest image's bytes are, absolute on this host. */
232
247
  image_path?: string | null;
233
248
  }
249
+ /**
250
+ * The failure detector's health, and since when it has been so: `since` is
251
+ * `null` exactly while the status is `unchecked`.
252
+ */
253
+ export type DetectorHealth = {
254
+ status: "unchecked";
255
+ since: null;
256
+ } | {
257
+ status: "available";
258
+ since: Timestamp;
259
+ } | {
260
+ status: "unavailable";
261
+ since: Timestamp;
262
+ };
263
+ /**
264
+ * The failure detector's own health changed.
265
+ *
266
+ * The printer's rather than any print's, so it is written with no print.
267
+ */
268
+ export interface DetectorHealthChangedPayload {
269
+ /** What it was answered, in words. */
270
+ detail: string;
271
+ /** What the check found. */
272
+ status: DetectorStatus;
273
+ }
274
+ /** What a check of the failure detector's own health found. */
275
+ export type DetectorStatus = "available" | "unavailable";
234
276
  /**
235
277
  * The envelope intersected with the print's manifest.
236
278
  *
@@ -248,6 +290,8 @@ export interface ErrorAnswer {
248
290
  /** One line saying why, in the words of whatever refused it. */
249
291
  error: string;
250
292
  }
293
+ /** Whose error a job's error is. */
294
+ export type ErrorSource = "printer" | "host";
251
295
  /** A lowercase hyphenated version 7 UUID identifying one event. */
252
296
  export type EventId = string;
253
297
  /**
@@ -399,6 +443,15 @@ export interface FileTallyRebaselinedPayload {
399
443
  /** Where it lives, in the printer's own vocabulary. */
400
444
  origin: string;
401
445
  }
446
+ /** Why a camera frame was not one to hand the agent. */
447
+ export type FrameCause = "blank" | "undecodable";
448
+ /** One tool heater whose target was above zero. */
449
+ export interface HeatedTool {
450
+ /** Its target, in degrees Celsius. */
451
+ target_c: number;
452
+ /** The tool's number. */
453
+ tool: number;
454
+ }
402
455
  /**
403
456
  * One heater, as a source reported it.
404
457
  *
@@ -523,6 +576,13 @@ export type InterventionOutcome = "still_active" | "restored" | "restore_unavail
523
576
  by: InterventionId;
524
577
  };
525
578
  };
579
+ /** A job's error, and whose it is. */
580
+ export interface JobError {
581
+ /** Whose it is. */
582
+ source: ErrorSource;
583
+ /** The error, as the source reported it. */
584
+ text: string;
585
+ }
526
586
  /**
527
587
  * What a sliced job declares about itself and about what may be adjusted.
528
588
  *
@@ -558,8 +618,8 @@ export interface JobSnapshot {
558
618
  * Normalized to a fraction here regardless of how the source expresses it.
559
619
  */
560
620
  completion?: Reported | null;
561
- /** The error the source reports, when it reports one. */
562
- error?: string | null;
621
+ /** The error the source reports, when it reports one, and whose it is. */
622
+ error?: JobError | null;
563
623
  /** The whole print's estimated duration, in whole seconds. */
564
624
  estimated_print_time_s?: number | null;
565
625
  /**
@@ -991,6 +1051,8 @@ export type PrintAction = {
991
1051
  export interface PrintContext {
992
1052
  /** The limits in force, so that the agent can see them before it asks. */
993
1053
  bounds: EffectiveBounds;
1054
+ /** The failure detector's health, and since when it has been so. */
1055
+ detector?: DetectorHealth;
994
1056
  /** The interventions still active. */
995
1057
  interventions: Array<Intervention>;
996
1058
  /** The job, when a snapshot could be taken. */
@@ -1118,6 +1180,34 @@ export interface PrintUntrackedPayload {
1118
1180
  /** Why the print carries no charge. */
1119
1181
  reason: string;
1120
1182
  }
1183
+ /**
1184
+ * The printer's connection changed into or out of `offline` or `error`: a
1185
+ * serial disconnect, a reconnect, a printer error.
1186
+ *
1187
+ * The printer's rather than any print's, so it is written with no print.
1188
+ */
1189
+ export interface PrinterConnectionChangedPayload {
1190
+ /** What the watch read, in words. */
1191
+ detail: string;
1192
+ /** The state the previous read found. */
1193
+ from: PrinterState;
1194
+ /** The state this read found. */
1195
+ to: PrinterState;
1196
+ }
1197
+ /**
1198
+ * The printer reset: its firmware restarted, and whatever it held is gone.
1199
+ *
1200
+ * Recorded on each reset the printer pushed, one while idle included, which
1201
+ * changes nothing a read of its state reports. The printer's rather than any
1202
+ * print's, so it is written with no print; `during_print` names the print it
1203
+ * happened during, when one was running.
1204
+ */
1205
+ export interface PrinterResetPayload {
1206
+ /** What the watch knew of it, in words. */
1207
+ detail: string;
1208
+ /** The print that was running when it reset, `null` when none was. */
1209
+ during_print?: PrintId | null;
1210
+ }
1121
1211
  /** A printer, as a source reported it at one instant. */
1122
1212
  export interface PrinterSnapshot {
1123
1213
  /** The bed heater, when the printer reports one. */
@@ -1570,6 +1660,8 @@ export interface StartupReconciliationPayload {
1570
1660
  }
1571
1661
  /** What a status read answers. */
1572
1662
  export interface StatusAnswer {
1663
+ /** The failure detector's health, and since when it has been so. */
1664
+ detector: DetectorHealth;
1573
1665
  /** The bounded interventions still in force. */
1574
1666
  interventions: Array<Intervention>;
1575
1667
  /** The job, when a snapshot could be taken. */
@@ -1647,6 +1739,32 @@ export interface UnaccountedPrintPayload {
1647
1739
  /** Whether it completed. */
1648
1740
  success: boolean;
1649
1741
  }
1742
+ /**
1743
+ * The printer heated or moved with no job running, soon after a print ended
1744
+ * `interrupted` or `failed`.
1745
+ *
1746
+ * A transition rather than a reading: written once when such activity
1747
+ * begins,
1748
+ * and again only when what it reports changes. The printer's rather than any
1749
+ * print's, so it is written with no print; `last_print_id` names the print
1750
+ * it
1751
+ * came after.
1752
+ */
1753
+ export interface UnattendedPrinterActivityPayload {
1754
+ /** The bed's target, when it is above zero; `null` otherwise. */
1755
+ bed_target_c?: number | null;
1756
+ /** What the watch read, in words. */
1757
+ detail: string;
1758
+ /** The print that ended before it. */
1759
+ last_print_id: PrintId;
1760
+ /**
1761
+ * Whether the print head moved since the last position read, `null` when
1762
+ * no position could be read.
1763
+ */
1764
+ moved?: boolean | null;
1765
+ /** Every tool whose target is above zero. */
1766
+ tools: Array<HeatedTool>;
1767
+ }
1650
1768
  /** One reason a spool's figure is in doubt, and since when. */
1651
1769
  export interface UnverifiedMark {
1652
1770
  /** Why the figure is in doubt. */
@@ -1683,8 +1801,10 @@ export interface EventPayloads {
1683
1801
  action_rejected: ActionRejectedPayload;
1684
1802
  action_requested: ActionRequestedPayload;
1685
1803
  agent_assessment: AgentAssessmentPayload;
1804
+ camera_degraded: CameraDegradedPayload;
1686
1805
  camera_look: CameraLookPayload;
1687
1806
  charge_pended: ChargePendedPayload;
1807
+ detector_health_changed: DetectorHealthChangedPayload;
1688
1808
  filament_change_signalled: FilamentChangeSignalledPayload;
1689
1809
  filament_consumed: FilamentConsumedPayload;
1690
1810
  file_tally_rebaselined: FileTallyRebaselinedPayload;
@@ -1699,6 +1819,8 @@ export interface EventPayloads {
1699
1819
  print_ended: PrintEndedPayload;
1700
1820
  print_started: PrintStartedPayload;
1701
1821
  print_untracked: PrintUntrackedPayload;
1822
+ printer_connection_changed: PrinterConnectionChangedPayload;
1823
+ printer_reset: PrinterResetPayload;
1702
1824
  spool_adjusted: SpoolAdjustedPayload;
1703
1825
  spool_command_rejected: SpoolCommandRejectedPayload;
1704
1826
  spool_loaded: SpoolLoadedPayload;
@@ -1710,9 +1832,10 @@ export interface EventPayloads {
1710
1832
  supervision_session_closed: SupervisionSessionClosedPayload;
1711
1833
  supervision_session_opened: SupervisionSessionOpenedPayload;
1712
1834
  unaccounted_print: UnaccountedPrintPayload;
1835
+ unattended_printer_activity: UnattendedPrinterActivityPayload;
1713
1836
  }
1714
1837
  /** Every kind the server declares a payload type for, in name order. */
1715
- 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"];
1838
+ export declare const EVENT_KINDS: readonly ["action_executed", "action_rejected", "action_requested", "agent_assessment", "camera_degraded", "camera_look", "charge_pended", "detector_health_changed", "filament_change_signalled", "filament_consumed", "file_tally_rebaselined", "intervention_expired", "malformed_external_event", "obico_failure_alert", "obico_printer_notification", "operator_acknowledgement", "periodic_observation", "port_failure", "preflight_checked", "print_ended", "print_started", "print_untracked", "printer_connection_changed", "printer_reset", "spool_adjusted", "spool_command_rejected", "spool_loaded", "spool_registered", "spool_retired", "spool_unloaded", "spool_unverified", "startup_reconciliation", "supervision_session_closed", "supervision_session_opened", "unaccounted_print", "unattended_printer_activity"];
1716
1839
  /**
1717
1840
  * The payload of one event as the type its kind declares, or `undefined` for
1718
1841
  * an event of any other kind — one this client knows or one it does not. No
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.8.1";
10
+ export const CONTRACT_VERSION = "0.9.0";
11
11
  /**
12
12
  * Every operation this client exposes a method for, which is every operation
13
13
  * the server declares and no other.
@@ -49,8 +49,10 @@ export const EVENT_KINDS = [
49
49
  "action_rejected",
50
50
  "action_requested",
51
51
  "agent_assessment",
52
+ "camera_degraded",
52
53
  "camera_look",
53
54
  "charge_pended",
55
+ "detector_health_changed",
54
56
  "filament_change_signalled",
55
57
  "filament_consumed",
56
58
  "file_tally_rebaselined",
@@ -65,6 +67,8 @@ export const EVENT_KINDS = [
65
67
  "print_ended",
66
68
  "print_started",
67
69
  "print_untracked",
70
+ "printer_connection_changed",
71
+ "printer_reset",
68
72
  "spool_adjusted",
69
73
  "spool_command_rejected",
70
74
  "spool_loaded",
@@ -76,6 +80,7 @@ export const EVENT_KINDS = [
76
80
  "supervision_session_closed",
77
81
  "supervision_session_opened",
78
82
  "unaccounted_print",
83
+ "unattended_printer_activity",
79
84
  ];
80
85
  /**
81
86
  * The payload of one event as the type its kind declares, or `undefined` for
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.8.1",
15
+ "printobserverContractVersion": "0.9.0",
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.8.1"
22
+ "version": "0.9.0"
23
23
  }