@rise-maritime/keelson-js 0.6.0-alpha.255.dev.1 → 0.6.0-alpha.275.dev.2

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.
Files changed (48) hide show
  1. package/dist/index.d.ts +83 -8
  2. package/dist/index.js +23 -1
  3. package/dist/index.test.js +31 -0
  4. package/dist/interfaces/AlarmAck.d.ts +2 -2
  5. package/dist/interfaces/AlarmAck.js +2 -2
  6. package/dist/interfaces/ContainerControl.d.ts +239 -0
  7. package/dist/interfaces/ContainerControl.js +1053 -0
  8. package/dist/interfaces/ContainerHost.d.ts +403 -0
  9. package/dist/interfaces/ContainerHost.js +1230 -0
  10. package/dist/interfaces/ErrorResponse.d.ts +7 -2
  11. package/dist/interfaces/ErrorResponse.js +12 -2
  12. package/dist/interfaces/Route.d.ts +141 -6
  13. package/dist/interfaces/Route.js +309 -4
  14. package/dist/interfaces/RoutePlanner.d.ts +19 -1
  15. package/dist/interfaces/RoutePlanner.js +23 -1
  16. package/dist/interfaces/ScenarioControl.d.ts +132 -3
  17. package/dist/interfaces/ScenarioControl.js +439 -37
  18. package/dist/interfaces/VehicleNavigation.d.ts +55 -0
  19. package/dist/interfaces/VehicleNavigation.js +233 -1
  20. package/dist/interfaces/VehicleSimulatorControl.d.ts +0 -83
  21. package/dist/interfaces/VehicleSimulatorControl.js +1 -293
  22. package/dist/interfaces/serviceRegistry.d.ts +84 -8
  23. package/dist/interfaces/serviceRegistry.js +4 -0
  24. package/dist/interfaces.json +2 -0
  25. package/dist/payloads/AdviceDisposition.d.ts +55 -0
  26. package/dist/payloads/AdviceDisposition.js +242 -0
  27. package/dist/payloads/ChecklistHandover.d.ts +522 -0
  28. package/dist/payloads/ChecklistHandover.js +1735 -0
  29. package/dist/payloads/ContainerHost.d.ts +407 -0
  30. package/dist/payloads/ContainerHost.js +1245 -0
  31. package/dist/payloads/Encounter.d.ts +104 -0
  32. package/dist/payloads/Encounter.js +573 -0
  33. package/dist/payloads/NavigationAdvice.d.ts +94 -0
  34. package/dist/payloads/NavigationAdvice.js +596 -0
  35. package/dist/payloads/NavigationState.d.ts +90 -0
  36. package/dist/payloads/NavigationState.js +377 -0
  37. package/dist/payloads/Route.d.ts +142 -6
  38. package/dist/payloads/Route.js +318 -4
  39. package/dist/payloads/RouteExecution.d.ts +7 -0
  40. package/dist/payloads/ScenarioEvent.d.ts +14 -0
  41. package/dist/payloads/ScenarioEvent.js +16 -0
  42. package/dist/payloads/index.d.ts +1 -1
  43. package/dist/payloads/index.js +2 -2
  44. package/dist/payloads/index.keelson.d.ts +10 -4
  45. package/dist/payloads/index.keelson.js +10 -4
  46. package/dist/qos.json +6 -0
  47. package/dist/subjects.json +20 -1
  48. package/package.json +1 -1
@@ -0,0 +1,90 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ import { OperationalAuthority_AuthorityLevel } from "./OperationalAuthority";
3
+ import { RouteRef } from "./Route";
4
+ /**
5
+ * What the vessel's navigation function is doing right now, stated by the process doing it.
6
+ *
7
+ * Not a lock and not a grant. command_authority says who holds the conn, operational_authority
8
+ * says the most the vessel may claim, and this says what navigation made of both. A consumer
9
+ * deciding whether to act on the vessel reads those, never this.
10
+ */
11
+ export interface NavigationState {
12
+ $type: "keelson.NavigationState";
13
+ timestamp: Date | undefined;
14
+ mode: NavigationState_Mode;
15
+ subMode: NavigationState_SubMode;
16
+ /** The voyage being monitored or sailed. Absent in MODE_IDLE. */
17
+ voyageId?: string | undefined;
18
+ /** The route edition in force. Absent when no edition is resolved; never `latest`. */
19
+ routeRef?: RouteRef | undefined;
20
+ /** The leg being sailed, named by the waypoint it leaves (RouteExecution convention). */
21
+ currentLegFromWaypointId?: string | undefined;
22
+ /**
23
+ * The operational_authority level this process is acting under. UNKNOWN when it has heard
24
+ * none, which is non-authorising exactly as OperationalAuthority defines it.
25
+ */
26
+ authorityLevelInForce: OperationalAuthority_AuthorityLevel;
27
+ /** True only while this process holds a live command_authority lease, judged on its own clock. */
28
+ connHeld: boolean;
29
+ /** Why the process is in this mode. For operators and logs; consumers MUST NOT parse it. */
30
+ reason: string;
31
+ /** Subjects this process needs and currently lacks or holds stale, e.g. "location_fix". */
32
+ degradedInputs: string[];
33
+ }
34
+ export declare enum NavigationState_Mode {
35
+ MODE_UNSPECIFIED = 0,
36
+ /** MODE_IDLE - No active voyage, or none this process can resolve. */
37
+ MODE_IDLE = 1,
38
+ /** MODE_READY - A voyage is active and monitored. Not holding the conn, commanding nothing. */
39
+ MODE_READY = 2,
40
+ /** MODE_UNDERWAY - Holding the conn and commanding the vessel along the voyage. */
41
+ MODE_UNDERWAY = 3,
42
+ /**
43
+ * MODE_FALLBACK - Lost something it needs to navigate (conn, authority, fresh ownship state) and has
44
+ * commanded its declared safe state. `reason` and `degraded_inputs` say what.
45
+ */
46
+ MODE_FALLBACK = 4,
47
+ /** MODE_ARRIVED - Reached the final waypoint of the active voyage. */
48
+ MODE_ARRIVED = 5,
49
+ /** MODE_ENDED - The voyage was completed or aborted; conn released. */
50
+ MODE_ENDED = 6,
51
+ UNRECOGNIZED = -1
52
+ }
53
+ export declare function navigationState_ModeFromJSON(object: any): NavigationState_Mode;
54
+ export declare function navigationState_ModeToJSON(object: NavigationState_Mode): string;
55
+ /** Refines MODE_UNDERWAY; UNSPECIFIED in every other mode. */
56
+ export declare enum NavigationState_SubMode {
57
+ SUB_MODE_UNSPECIFIED = 0,
58
+ /** SUB_MODE_TRACK - following the planned track */
59
+ SUB_MODE_TRACK = 1,
60
+ /** SUB_MODE_AVOIDING - executing accepted collision-avoidance advice */
61
+ SUB_MODE_AVOIDING = 2,
62
+ /** SUB_MODE_HOLDING - speed zero or loitering, waiting on a condition */
63
+ SUB_MODE_HOLDING = 3,
64
+ /** SUB_MODE_REROUTING - awaiting a new route edition */
65
+ SUB_MODE_REROUTING = 4,
66
+ UNRECOGNIZED = -1
67
+ }
68
+ export declare function navigationState_SubModeFromJSON(object: any): NavigationState_SubMode;
69
+ export declare function navigationState_SubModeToJSON(object: NavigationState_SubMode): string;
70
+ export declare const NavigationState: MessageFns<NavigationState, "keelson.NavigationState">;
71
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
72
+ type DeepPartial<T> = T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
73
+ [K in Exclude<keyof T, "$type">]?: DeepPartial<T[K]>;
74
+ } : Partial<T>;
75
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
76
+ type Exact<P, I extends P> = P extends Builtin ? P : P & {
77
+ [K in keyof P]: Exact<P[K], I[K]>;
78
+ } & {
79
+ [K in Exclude<keyof I, KeysOfUnion<P> | "$type">]: never;
80
+ };
81
+ interface MessageFns<T, V extends string> {
82
+ readonly $type: V;
83
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
84
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
85
+ fromJSON(object: any): T;
86
+ toJSON(message: T): unknown;
87
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
88
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
89
+ }
90
+ export {};
@@ -0,0 +1,377 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.6.1
5
+ // protoc v6.30.2
6
+ // source: NavigationState.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.NavigationState = exports.navigationState_SubModeToJSON = exports.navigationState_SubModeFromJSON = exports.NavigationState_SubMode = exports.navigationState_ModeToJSON = exports.navigationState_ModeFromJSON = exports.NavigationState_Mode = void 0;
9
+ /* eslint-disable */
10
+ const wire_1 = require("@bufbuild/protobuf/wire");
11
+ const OperationalAuthority_1 = require("./OperationalAuthority");
12
+ const Route_1 = require("./Route");
13
+ const timestamp_1 = require("./google/protobuf/timestamp");
14
+ const typeRegistry_1 = require("./typeRegistry");
15
+ var NavigationState_Mode;
16
+ (function (NavigationState_Mode) {
17
+ NavigationState_Mode[NavigationState_Mode["MODE_UNSPECIFIED"] = 0] = "MODE_UNSPECIFIED";
18
+ /** MODE_IDLE - No active voyage, or none this process can resolve. */
19
+ NavigationState_Mode[NavigationState_Mode["MODE_IDLE"] = 1] = "MODE_IDLE";
20
+ /** MODE_READY - A voyage is active and monitored. Not holding the conn, commanding nothing. */
21
+ NavigationState_Mode[NavigationState_Mode["MODE_READY"] = 2] = "MODE_READY";
22
+ /** MODE_UNDERWAY - Holding the conn and commanding the vessel along the voyage. */
23
+ NavigationState_Mode[NavigationState_Mode["MODE_UNDERWAY"] = 3] = "MODE_UNDERWAY";
24
+ /**
25
+ * MODE_FALLBACK - Lost something it needs to navigate (conn, authority, fresh ownship state) and has
26
+ * commanded its declared safe state. `reason` and `degraded_inputs` say what.
27
+ */
28
+ NavigationState_Mode[NavigationState_Mode["MODE_FALLBACK"] = 4] = "MODE_FALLBACK";
29
+ /** MODE_ARRIVED - Reached the final waypoint of the active voyage. */
30
+ NavigationState_Mode[NavigationState_Mode["MODE_ARRIVED"] = 5] = "MODE_ARRIVED";
31
+ /** MODE_ENDED - The voyage was completed or aborted; conn released. */
32
+ NavigationState_Mode[NavigationState_Mode["MODE_ENDED"] = 6] = "MODE_ENDED";
33
+ NavigationState_Mode[NavigationState_Mode["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
34
+ })(NavigationState_Mode || (exports.NavigationState_Mode = NavigationState_Mode = {}));
35
+ function navigationState_ModeFromJSON(object) {
36
+ switch (object) {
37
+ case 0:
38
+ case "MODE_UNSPECIFIED":
39
+ return NavigationState_Mode.MODE_UNSPECIFIED;
40
+ case 1:
41
+ case "MODE_IDLE":
42
+ return NavigationState_Mode.MODE_IDLE;
43
+ case 2:
44
+ case "MODE_READY":
45
+ return NavigationState_Mode.MODE_READY;
46
+ case 3:
47
+ case "MODE_UNDERWAY":
48
+ return NavigationState_Mode.MODE_UNDERWAY;
49
+ case 4:
50
+ case "MODE_FALLBACK":
51
+ return NavigationState_Mode.MODE_FALLBACK;
52
+ case 5:
53
+ case "MODE_ARRIVED":
54
+ return NavigationState_Mode.MODE_ARRIVED;
55
+ case 6:
56
+ case "MODE_ENDED":
57
+ return NavigationState_Mode.MODE_ENDED;
58
+ case -1:
59
+ case "UNRECOGNIZED":
60
+ default:
61
+ return NavigationState_Mode.UNRECOGNIZED;
62
+ }
63
+ }
64
+ exports.navigationState_ModeFromJSON = navigationState_ModeFromJSON;
65
+ function navigationState_ModeToJSON(object) {
66
+ switch (object) {
67
+ case NavigationState_Mode.MODE_UNSPECIFIED:
68
+ return "MODE_UNSPECIFIED";
69
+ case NavigationState_Mode.MODE_IDLE:
70
+ return "MODE_IDLE";
71
+ case NavigationState_Mode.MODE_READY:
72
+ return "MODE_READY";
73
+ case NavigationState_Mode.MODE_UNDERWAY:
74
+ return "MODE_UNDERWAY";
75
+ case NavigationState_Mode.MODE_FALLBACK:
76
+ return "MODE_FALLBACK";
77
+ case NavigationState_Mode.MODE_ARRIVED:
78
+ return "MODE_ARRIVED";
79
+ case NavigationState_Mode.MODE_ENDED:
80
+ return "MODE_ENDED";
81
+ case NavigationState_Mode.UNRECOGNIZED:
82
+ default:
83
+ return "UNRECOGNIZED";
84
+ }
85
+ }
86
+ exports.navigationState_ModeToJSON = navigationState_ModeToJSON;
87
+ /** Refines MODE_UNDERWAY; UNSPECIFIED in every other mode. */
88
+ var NavigationState_SubMode;
89
+ (function (NavigationState_SubMode) {
90
+ NavigationState_SubMode[NavigationState_SubMode["SUB_MODE_UNSPECIFIED"] = 0] = "SUB_MODE_UNSPECIFIED";
91
+ /** SUB_MODE_TRACK - following the planned track */
92
+ NavigationState_SubMode[NavigationState_SubMode["SUB_MODE_TRACK"] = 1] = "SUB_MODE_TRACK";
93
+ /** SUB_MODE_AVOIDING - executing accepted collision-avoidance advice */
94
+ NavigationState_SubMode[NavigationState_SubMode["SUB_MODE_AVOIDING"] = 2] = "SUB_MODE_AVOIDING";
95
+ /** SUB_MODE_HOLDING - speed zero or loitering, waiting on a condition */
96
+ NavigationState_SubMode[NavigationState_SubMode["SUB_MODE_HOLDING"] = 3] = "SUB_MODE_HOLDING";
97
+ /** SUB_MODE_REROUTING - awaiting a new route edition */
98
+ NavigationState_SubMode[NavigationState_SubMode["SUB_MODE_REROUTING"] = 4] = "SUB_MODE_REROUTING";
99
+ NavigationState_SubMode[NavigationState_SubMode["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
100
+ })(NavigationState_SubMode || (exports.NavigationState_SubMode = NavigationState_SubMode = {}));
101
+ function navigationState_SubModeFromJSON(object) {
102
+ switch (object) {
103
+ case 0:
104
+ case "SUB_MODE_UNSPECIFIED":
105
+ return NavigationState_SubMode.SUB_MODE_UNSPECIFIED;
106
+ case 1:
107
+ case "SUB_MODE_TRACK":
108
+ return NavigationState_SubMode.SUB_MODE_TRACK;
109
+ case 2:
110
+ case "SUB_MODE_AVOIDING":
111
+ return NavigationState_SubMode.SUB_MODE_AVOIDING;
112
+ case 3:
113
+ case "SUB_MODE_HOLDING":
114
+ return NavigationState_SubMode.SUB_MODE_HOLDING;
115
+ case 4:
116
+ case "SUB_MODE_REROUTING":
117
+ return NavigationState_SubMode.SUB_MODE_REROUTING;
118
+ case -1:
119
+ case "UNRECOGNIZED":
120
+ default:
121
+ return NavigationState_SubMode.UNRECOGNIZED;
122
+ }
123
+ }
124
+ exports.navigationState_SubModeFromJSON = navigationState_SubModeFromJSON;
125
+ function navigationState_SubModeToJSON(object) {
126
+ switch (object) {
127
+ case NavigationState_SubMode.SUB_MODE_UNSPECIFIED:
128
+ return "SUB_MODE_UNSPECIFIED";
129
+ case NavigationState_SubMode.SUB_MODE_TRACK:
130
+ return "SUB_MODE_TRACK";
131
+ case NavigationState_SubMode.SUB_MODE_AVOIDING:
132
+ return "SUB_MODE_AVOIDING";
133
+ case NavigationState_SubMode.SUB_MODE_HOLDING:
134
+ return "SUB_MODE_HOLDING";
135
+ case NavigationState_SubMode.SUB_MODE_REROUTING:
136
+ return "SUB_MODE_REROUTING";
137
+ case NavigationState_SubMode.UNRECOGNIZED:
138
+ default:
139
+ return "UNRECOGNIZED";
140
+ }
141
+ }
142
+ exports.navigationState_SubModeToJSON = navigationState_SubModeToJSON;
143
+ function createBaseNavigationState() {
144
+ return {
145
+ $type: "keelson.NavigationState",
146
+ timestamp: undefined,
147
+ mode: 0,
148
+ subMode: 0,
149
+ voyageId: undefined,
150
+ routeRef: undefined,
151
+ currentLegFromWaypointId: undefined,
152
+ authorityLevelInForce: 0,
153
+ connHeld: false,
154
+ reason: "",
155
+ degradedInputs: [],
156
+ };
157
+ }
158
+ exports.NavigationState = {
159
+ $type: "keelson.NavigationState",
160
+ encode(message, writer = new wire_1.BinaryWriter()) {
161
+ if (message.timestamp !== undefined) {
162
+ timestamp_1.Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(10).fork()).join();
163
+ }
164
+ if (message.mode !== 0) {
165
+ writer.uint32(16).int32(message.mode);
166
+ }
167
+ if (message.subMode !== 0) {
168
+ writer.uint32(24).int32(message.subMode);
169
+ }
170
+ if (message.voyageId !== undefined) {
171
+ writer.uint32(34).string(message.voyageId);
172
+ }
173
+ if (message.routeRef !== undefined) {
174
+ Route_1.RouteRef.encode(message.routeRef, writer.uint32(42).fork()).join();
175
+ }
176
+ if (message.currentLegFromWaypointId !== undefined) {
177
+ writer.uint32(50).string(message.currentLegFromWaypointId);
178
+ }
179
+ if (message.authorityLevelInForce !== 0) {
180
+ writer.uint32(56).int32(message.authorityLevelInForce);
181
+ }
182
+ if (message.connHeld !== false) {
183
+ writer.uint32(64).bool(message.connHeld);
184
+ }
185
+ if (message.reason !== "") {
186
+ writer.uint32(74).string(message.reason);
187
+ }
188
+ for (const v of message.degradedInputs) {
189
+ writer.uint32(82).string(v);
190
+ }
191
+ return writer;
192
+ },
193
+ decode(input, length) {
194
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
195
+ let end = length === undefined ? reader.len : reader.pos + length;
196
+ const message = createBaseNavigationState();
197
+ while (reader.pos < end) {
198
+ const tag = reader.uint32();
199
+ switch (tag >>> 3) {
200
+ case 1: {
201
+ if (tag !== 10) {
202
+ break;
203
+ }
204
+ message.timestamp = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
205
+ continue;
206
+ }
207
+ case 2: {
208
+ if (tag !== 16) {
209
+ break;
210
+ }
211
+ message.mode = reader.int32();
212
+ continue;
213
+ }
214
+ case 3: {
215
+ if (tag !== 24) {
216
+ break;
217
+ }
218
+ message.subMode = reader.int32();
219
+ continue;
220
+ }
221
+ case 4: {
222
+ if (tag !== 34) {
223
+ break;
224
+ }
225
+ message.voyageId = reader.string();
226
+ continue;
227
+ }
228
+ case 5: {
229
+ if (tag !== 42) {
230
+ break;
231
+ }
232
+ message.routeRef = Route_1.RouteRef.decode(reader, reader.uint32());
233
+ continue;
234
+ }
235
+ case 6: {
236
+ if (tag !== 50) {
237
+ break;
238
+ }
239
+ message.currentLegFromWaypointId = reader.string();
240
+ continue;
241
+ }
242
+ case 7: {
243
+ if (tag !== 56) {
244
+ break;
245
+ }
246
+ message.authorityLevelInForce = reader.int32();
247
+ continue;
248
+ }
249
+ case 8: {
250
+ if (tag !== 64) {
251
+ break;
252
+ }
253
+ message.connHeld = reader.bool();
254
+ continue;
255
+ }
256
+ case 9: {
257
+ if (tag !== 74) {
258
+ break;
259
+ }
260
+ message.reason = reader.string();
261
+ continue;
262
+ }
263
+ case 10: {
264
+ if (tag !== 82) {
265
+ break;
266
+ }
267
+ message.degradedInputs.push(reader.string());
268
+ continue;
269
+ }
270
+ }
271
+ if ((tag & 7) === 4 || tag === 0) {
272
+ break;
273
+ }
274
+ reader.skip(tag & 7);
275
+ }
276
+ return message;
277
+ },
278
+ fromJSON(object) {
279
+ return {
280
+ $type: exports.NavigationState.$type,
281
+ timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
282
+ mode: isSet(object.mode) ? navigationState_ModeFromJSON(object.mode) : 0,
283
+ subMode: isSet(object.subMode) ? navigationState_SubModeFromJSON(object.subMode) : 0,
284
+ voyageId: isSet(object.voyageId) ? globalThis.String(object.voyageId) : undefined,
285
+ routeRef: isSet(object.routeRef) ? Route_1.RouteRef.fromJSON(object.routeRef) : undefined,
286
+ currentLegFromWaypointId: isSet(object.currentLegFromWaypointId)
287
+ ? globalThis.String(object.currentLegFromWaypointId)
288
+ : undefined,
289
+ authorityLevelInForce: isSet(object.authorityLevelInForce)
290
+ ? (0, OperationalAuthority_1.operationalAuthority_AuthorityLevelFromJSON)(object.authorityLevelInForce)
291
+ : 0,
292
+ connHeld: isSet(object.connHeld) ? globalThis.Boolean(object.connHeld) : false,
293
+ reason: isSet(object.reason) ? globalThis.String(object.reason) : "",
294
+ degradedInputs: globalThis.Array.isArray(object?.degradedInputs)
295
+ ? object.degradedInputs.map((e) => globalThis.String(e))
296
+ : [],
297
+ };
298
+ },
299
+ toJSON(message) {
300
+ const obj = {};
301
+ if (message.timestamp !== undefined) {
302
+ obj.timestamp = message.timestamp.toISOString();
303
+ }
304
+ if (message.mode !== 0) {
305
+ obj.mode = navigationState_ModeToJSON(message.mode);
306
+ }
307
+ if (message.subMode !== 0) {
308
+ obj.subMode = navigationState_SubModeToJSON(message.subMode);
309
+ }
310
+ if (message.voyageId !== undefined) {
311
+ obj.voyageId = message.voyageId;
312
+ }
313
+ if (message.routeRef !== undefined) {
314
+ obj.routeRef = Route_1.RouteRef.toJSON(message.routeRef);
315
+ }
316
+ if (message.currentLegFromWaypointId !== undefined) {
317
+ obj.currentLegFromWaypointId = message.currentLegFromWaypointId;
318
+ }
319
+ if (message.authorityLevelInForce !== 0) {
320
+ obj.authorityLevelInForce = (0, OperationalAuthority_1.operationalAuthority_AuthorityLevelToJSON)(message.authorityLevelInForce);
321
+ }
322
+ if (message.connHeld !== false) {
323
+ obj.connHeld = message.connHeld;
324
+ }
325
+ if (message.reason !== "") {
326
+ obj.reason = message.reason;
327
+ }
328
+ if (message.degradedInputs?.length) {
329
+ obj.degradedInputs = message.degradedInputs;
330
+ }
331
+ return obj;
332
+ },
333
+ create(base) {
334
+ return exports.NavigationState.fromPartial(base ?? {});
335
+ },
336
+ fromPartial(object) {
337
+ const message = createBaseNavigationState();
338
+ message.timestamp = object.timestamp ?? undefined;
339
+ message.mode = object.mode ?? 0;
340
+ message.subMode = object.subMode ?? 0;
341
+ message.voyageId = object.voyageId ?? undefined;
342
+ message.routeRef = (object.routeRef !== undefined && object.routeRef !== null)
343
+ ? Route_1.RouteRef.fromPartial(object.routeRef)
344
+ : undefined;
345
+ message.currentLegFromWaypointId = object.currentLegFromWaypointId ?? undefined;
346
+ message.authorityLevelInForce = object.authorityLevelInForce ?? 0;
347
+ message.connHeld = object.connHeld ?? false;
348
+ message.reason = object.reason ?? "";
349
+ message.degradedInputs = object.degradedInputs?.map((e) => e) || [];
350
+ return message;
351
+ },
352
+ };
353
+ typeRegistry_1.messageTypeRegistry.set(exports.NavigationState.$type, exports.NavigationState);
354
+ function toTimestamp(date) {
355
+ const seconds = Math.trunc(date.getTime() / 1000);
356
+ const nanos = (date.getTime() % 1000) * 1000000;
357
+ return { $type: "google.protobuf.Timestamp", seconds, nanos };
358
+ }
359
+ function fromTimestamp(t) {
360
+ let millis = (t.seconds || 0) * 1000;
361
+ millis += (t.nanos || 0) / 1000000;
362
+ return new globalThis.Date(millis);
363
+ }
364
+ function fromJsonTimestamp(o) {
365
+ if (o instanceof globalThis.Date) {
366
+ return o;
367
+ }
368
+ else if (typeof o === "string") {
369
+ return new globalThis.Date(o);
370
+ }
371
+ else {
372
+ return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
373
+ }
374
+ }
375
+ function isSet(value) {
376
+ return value !== null && value !== undefined;
377
+ }
@@ -56,13 +56,24 @@ export declare enum HazardZoneType {
56
56
  }
57
57
  export declare function hazardZoneTypeFromJSON(object: any): HazardZoneType;
58
58
  export declare function hazardZoneTypeToJSON(object: HazardZoneType): string;
59
- /** COLREG encounter situation for an annotated leg. */
59
+ /**
60
+ * COLREG encounter situation, from own ship's side. One vocabulary for the plan and the live
61
+ * picture: a Route leg is annotated with 1-4 only; Encounter.situation may also carry 5-6, which
62
+ * describe a live target and never a planned leg.
63
+ */
60
64
  export declare enum ColregSituation {
61
65
  COLREG_SITUATION_UNSPECIFIED = 0,
66
+ /** COLREG_SITUATION_OVERTAKING - own ship is overtaking */
62
67
  COLREG_SITUATION_OVERTAKING = 1,
68
+ /** COLREG_SITUATION_CROSSING_STBD - target crossing from own starboard */
63
69
  COLREG_SITUATION_CROSSING_STBD = 2,
70
+ /** COLREG_SITUATION_CROSSING_PORT - target crossing from own port */
64
71
  COLREG_SITUATION_CROSSING_PORT = 3,
65
72
  COLREG_SITUATION_HEAD_ON = 4,
73
+ /** COLREG_SITUATION_OVERTAKEN - target is overtaking own ship (Encounter only) */
74
+ COLREG_SITUATION_OVERTAKEN = 5,
75
+ /** COLREG_SITUATION_NONE - target not under way, or restricted visibility (Encounter only) */
76
+ COLREG_SITUATION_NONE = 6,
66
77
  UNRECOGNIZED = -1
67
78
  }
68
79
  export declare function colregSituationFromJSON(object: any): ColregSituation;
@@ -87,6 +98,61 @@ export declare enum GeometryType {
87
98
  }
88
99
  export declare function geometryTypeFromJSON(object: any): GeometryType;
89
100
  export declare function geometryTypeToJSON(object: GeometryType): string;
101
+ /**
102
+ * How a leg's XTD corridor is shaped. UNSPECIFIED MUST be read as FIXED:
103
+ * every leg published before this field existed is a fixed-width corridor, and
104
+ * reading it any other way would change routes nobody edited.
105
+ */
106
+ export declare enum XtdCorridorMode {
107
+ XTD_CORRIDOR_MODE_UNSPECIFIED = 0,
108
+ /**
109
+ * XTD_CORRIDOR_MODE_FIXED - Fixed width: parallel lines at xtd_port_m / xtd_starboard_m either side of
110
+ * track.
111
+ */
112
+ XTD_CORRIDOR_MODE_FIXED = 1,
113
+ /**
114
+ * XTD_CORRIDOR_MODE_VARIABLE - Variable width: a boundary drawn by the planner (Leg.xtd_port_boundary /
115
+ * xtd_starboard_boundary), e.g. a corridor that narrows past a shoal.
116
+ * xtd_port_m / xtd_starboard_m still carry a nominal limit for a monitor
117
+ * that does not evaluate the boundary. That fallback is NOT conservative when
118
+ * the drawn corridor is narrower than the nominal one, which is why such a
119
+ * monitor SHOULD report the leg as monitored at reduced fidelity.
120
+ */
121
+ XTD_CORRIDOR_MODE_VARIABLE = 2,
122
+ UNRECOGNIZED = -1
123
+ }
124
+ export declare function xtdCorridorModeFromJSON(object: any): XtdCorridorMode;
125
+ export declare function xtdCorridorModeToJSON(object: XtdCorridorMode): string;
126
+ /**
127
+ * Whether a route's waypoint list closes back on itself. RTZ 1.2 has no such
128
+ * concept, so producers either repeated the first waypoint (breaking id
129
+ * uniqueness) or left closing to consumer convention (silently wrong the first
130
+ * time a consumer chooses not to loop). This field makes the author say.
131
+ *
132
+ * An enum rather than a bool, like every other classification in this file:
133
+ * OPEN says closure was considered and declined, and there is room for a
134
+ * third topology (out-and-back). UNSPECIFIED MUST be read as OPEN; that is
135
+ * the fail-safe direction, since sailing a point-to-point route as a circuit
136
+ * takes the vessel over unplanned water. Terminal behaviour (stop, hold, go
137
+ * round again) is execution policy and belongs on keelson.Voyage, not here.
138
+ * See protocol-specification.md §6.2.1.
139
+ */
140
+ export declare enum RouteTopology {
141
+ ROUTE_TOPOLOGY_UNSPECIFIED = 0,
142
+ /**
143
+ * ROUTE_TOPOLOGY_OPEN - Runs from the first waypoint to the last and ends there. The last
144
+ * waypoint has no outgoing leg.
145
+ */
146
+ ROUTE_TOPOLOGY_OPEN = 1,
147
+ /**
148
+ * ROUTE_TOPOLOGY_CLOSED - A circuit: the last waypoint's outgoing leg terminates at the first
149
+ * waypoint, which is NOT repeated at the end of the list.
150
+ */
151
+ ROUTE_TOPOLOGY_CLOSED = 2,
152
+ UNRECOGNIZED = -1
153
+ }
154
+ export declare function routeTopologyFromJSON(object: any): RouteTopology;
155
+ export declare function routeTopologyToJSON(object: RouteTopology): string;
90
156
  /**
91
157
  * Lifecycle status for the route artifact (authoring + quality).
92
158
  * Execution-side state (vessel sailing, paused, completed) lives on
@@ -330,10 +396,18 @@ export interface Waypoints {
330
396
  defaults: DefaultWaypoint | undefined;
331
397
  /** Ordered list of waypoints, in route order. */
332
398
  waypoint: Waypoint[];
399
+ /**
400
+ * Whether the list above closes back on itself. Lives here because it is a
401
+ * statement about this list. Unset reads as ROUTE_TOPOLOGY_OPEN (§6.2.1).
402
+ */
403
+ topology: RouteTopology;
333
404
  extensions: Extensions | undefined;
334
405
  }
335
406
  /**
336
- * Default values for waypoint/leg fields. RTZ-aligned.
407
+ * Default values for waypoint/leg fields. RTZ-aligned — the field set matches
408
+ * RTZ's own defaultWaypoint element, which is a separate question from where
409
+ * leg data hangs: a merged default inherits the departure convention of the
410
+ * field it backs, same as an explicit value (§6.2.1).
337
411
  *
338
412
  * The scalars are `optional` for the same reason as their `Waypoint`
339
413
  * counterparts, one level up: without presence there is no way to say "this
@@ -373,8 +447,9 @@ export interface Waypoint {
373
447
  */
374
448
  position: Coordinate | undefined;
375
449
  /**
376
- * Planned speed over ground when leaving this waypoint. `optional` because
377
- * `Waypoints.defaults` backs this field: without presence, "no override,
450
+ * Planned speed over ground when LEAVING this waypoint, i.e. on `leg`
451
+ * below. RTZ indexes this on the arrival waypoint instead (§6.2.1).
452
+ * `optional` because `Waypoints.defaults` backs this field: without presence, "no override,
378
453
  * use the default" and "hold zero speed here" are the same bytes, and 0.0
379
454
  * is the more dangerous reading of the pair.
380
455
  */
@@ -398,12 +473,23 @@ export interface Waypoint {
398
473
  lock: boolean;
399
474
  /** Operational context for this waypoint (open sea, port approach, lock, ...). */
400
475
  operationalContext: OperationalContext;
401
- /** Outgoing leg from this waypoint to the next. The last waypoint has none. */
476
+ /**
477
+ * Outgoing leg from this waypoint to the next: `waypoint[i].leg` is the edge
478
+ * to `waypoint[i+1]`. In an OPEN route the last waypoint has none and a
479
+ * consumer MUST ignore one if present. In a CLOSED route the last waypoint's
480
+ * leg runs to `waypoint[0]`; that is how a circuit closes, never by
481
+ * repeating the first waypoint. RTZ hangs the leg on the ARRIVAL waypoint,
482
+ * so a converter shifts by one (§6.2.1).
483
+ */
402
484
  leg: Leg | undefined;
403
485
  /** Free-form notes attached to this waypoint. */
404
486
  note: string;
405
487
  extensions: Extensions | undefined;
406
488
  }
489
+ /**
490
+ * Every field here describes the edge LEAVING the waypoint that carries it
491
+ * (see Waypoint.leg and §6.2.1 for the RTZ shift).
492
+ */
407
493
  export interface Leg {
408
494
  $type: "keelson.Leg";
409
495
  /**
@@ -415,6 +501,19 @@ export interface Leg {
415
501
  xtdStarboardM?: number | undefined;
416
502
  xtdMonitoringPortM?: number | undefined;
417
503
  xtdMonitoringStarboardM?: number | undefined;
504
+ /**
505
+ * Whether this leg's XTD corridor is fixed or variable width. See XtdCorridorMode and
506
+ * protocol-specification.md §6.2.2.
507
+ */
508
+ xtdCorridorMode: XtdCorridorMode;
509
+ /**
510
+ * VARIABLE only: the drawn corridor boundary on each side, vertices in
511
+ * along-track order, covering this leg and the turn at the waypoint it
512
+ * arrives at. A consumer MUST ignore both lists unless the mode is VARIABLE,
513
+ * so a stale shape left behind by a switch back to FIXED is never sailed.
514
+ */
515
+ xtdPortBoundary: XtdBoundaryPoint[];
516
+ xtdStarboardBoundary: XtdBoundaryPoint[];
418
517
  /**
419
518
  * Safety contour (depth in metres below chart datum) below which the route
420
519
  * is considered unsafe.
@@ -463,6 +562,37 @@ export interface Leg {
463
562
  colregTrafficIntensity: ColregTrafficIntensity;
464
563
  extensions: Extensions | undefined;
465
564
  }
565
+ /**
566
+ * One vertex of a variable-width XTD corridor boundary (Leg.xtd_port_boundary /
567
+ * Leg.xtd_starboard_boundary).
568
+ */
569
+ export interface XtdBoundaryPoint {
570
+ $type: "keelson.XtdBoundaryPoint";
571
+ /**
572
+ * WGS-84 vertex. Authoritative: this is the boundary a monitor checks
573
+ * against, whatever the anchor below says.
574
+ */
575
+ position: Coordinate | undefined;
576
+ /**
577
+ * Editor anchor — where along the leg's straight the vertex was placed,
578
+ * 0 at the leg's start and 1 at its end, and how far off track. Lets an
579
+ * editor keep the vertex attached to the leg when a waypoint moves, instead
580
+ * of leaving it stranded at its old position. `optional` because a vertex
581
+ * placed freely (at a leg end or inside a turn) has no such anchor, and 0
582
+ * is a real fraction.
583
+ */
584
+ alongTrackFraction?: number | undefined;
585
+ /**
586
+ * Perpendicular distance from track for that anchor, metres, always
587
+ * positive: the side is given by which boundary list holds the vertex.
588
+ */
589
+ offsetM?: number | undefined;
590
+ /**
591
+ * True when the vertex lies on the turn at the leg's end rather than on the
592
+ * straight.
593
+ */
594
+ inTurn: boolean;
595
+ }
466
596
  export interface Schedules {
467
597
  $type: "keelson.Schedules";
468
598
  /** Multiple schedules can coexist (e.g. "manual", "weather-optimized"). */
@@ -502,7 +632,12 @@ export interface ScheduleElement {
502
632
  etdWindowEnd: Date | undefined;
503
633
  /** Planned duration of stay at this waypoint (port, anchorage, ...). */
504
634
  stay: Duration | undefined;
505
- /** -- Environmental forecast for this leg ------------------------------------ */
635
+ /**
636
+ * -- Environmental forecast for this leg ------------------------------------
637
+ * The OUTGOING leg — the one leaving `waypoint_id`, matching `Waypoint.leg`
638
+ * and `planned_sog_knots`. The last waypoint of an OPEN route has no
639
+ * outgoing leg and so no forecast to carry (§6.2.1).
640
+ */
506
641
  windSpeedMps: number;
507
642
  windDirectionDeg: number;
508
643
  currentSpeedMps: number;
@@ -653,6 +788,7 @@ export declare const Waypoints: MessageFns<Waypoints, "keelson.Waypoints">;
653
788
  export declare const DefaultWaypoint: MessageFns<DefaultWaypoint, "keelson.DefaultWaypoint">;
654
789
  export declare const Waypoint: MessageFns<Waypoint, "keelson.Waypoint">;
655
790
  export declare const Leg: MessageFns<Leg, "keelson.Leg">;
791
+ export declare const XtdBoundaryPoint: MessageFns<XtdBoundaryPoint, "keelson.XtdBoundaryPoint">;
656
792
  export declare const Schedules: MessageFns<Schedules, "keelson.Schedules">;
657
793
  export declare const Schedule: MessageFns<Schedule, "keelson.Schedule">;
658
794
  export declare const ScheduleElement: MessageFns<ScheduleElement, "keelson.ScheduleElement">;