@aeolus-fleet/common 0.8.0 → 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.
@@ -13,6 +13,16 @@ export declare const scopeSchema: z.ZodEnum<{
13
13
  "fleet:manage": "fleet:manage";
14
14
  }>;
15
15
  export type Scope = z.infer<typeof scopeSchema>;
16
+ /**
17
+ * The scopes commissioning may add to an agent ship, beside sending and
18
+ * receiving, which every agent ship has (ADR 0002).
19
+ */
20
+ export declare const FLEET_SCOPES: readonly ["fleet:read", "fleet:manage"];
21
+ export declare const fleetScopeSchema: z.ZodEnum<{
22
+ "fleet:read": "fleet:read";
23
+ "fleet:manage": "fleet:manage";
24
+ }>;
25
+ export type FleetScope = z.infer<typeof fleetScopeSchema>;
16
26
  /** `argo` is the one ship of kind `operator` in a fleet; every other ship is an `agent`. */
17
27
  export declare const SHIP_KINDS: readonly ["operator", "agent"];
18
28
  export declare const shipKindSchema: z.ZodEnum<{
@@ -63,7 +73,7 @@ export declare const deliveryStateSchema: z.ZodEnum<{
63
73
  }>;
64
74
  export type DeliveryState = z.infer<typeof deliveryStateSchema>;
65
75
  /** The event types written so far. Each later slice adds the ones it writes. */
66
- export declare const EVENT_TYPES: readonly ["FleetInitialised", "ShipCommissioned", "ShipClaimed", "LeaseRevoked", "CredentialRevoked", "StartingPromptIssued", "OperatorPasswordReset", "MessageAccepted", "DeliveryClaimed", "DeliveryAcknowledged", "DeliveryUndeliverable", "DeliveryReturned", "ShipRetired", "DeliveryAbandoned", "DeliveryDismissed", "ShipRenamed"];
76
+ export declare const EVENT_TYPES: readonly ["FleetInitialised", "ShipCommissioned", "ShipClaimed", "LeaseRevoked", "CredentialRevoked", "StartingPromptIssued", "OperatorPasswordReset", "MessageAccepted", "DeliveryClaimed", "DeliveryAcknowledged", "DeliveryUndeliverable", "DeliveryReturned", "ShipRetired", "DeliveryAbandoned", "DeliveryDismissed", "ShipRenamed", "ShipReported"];
67
77
  export declare const eventTypeSchema: z.ZodEnum<{
68
78
  FleetInitialised: "FleetInitialised";
69
79
  ShipCommissioned: "ShipCommissioned";
@@ -81,5 +91,6 @@ export declare const eventTypeSchema: z.ZodEnum<{
81
91
  DeliveryAbandoned: "DeliveryAbandoned";
82
92
  DeliveryDismissed: "DeliveryDismissed";
83
93
  ShipRenamed: "ShipRenamed";
94
+ ShipReported: "ShipReported";
84
95
  }>;
85
96
  export type EventType = z.infer<typeof eventTypeSchema>;
@@ -7,6 +7,12 @@ import { z } from 'zod';
7
7
  /** A permission of a ship, stored on the server with the ship and checked before every call. */
8
8
  export const SCOPES = ['messages:send', 'messages:receive', 'fleet:read', 'fleet:manage'];
9
9
  export const scopeSchema = z.enum(SCOPES);
10
+ /**
11
+ * The scopes commissioning may add to an agent ship, beside sending and
12
+ * receiving, which every agent ship has (ADR 0002).
13
+ */
14
+ export const FLEET_SCOPES = ['fleet:read', 'fleet:manage'];
15
+ export const fleetScopeSchema = z.enum(FLEET_SCOPES);
10
16
  /** `argo` is the one ship of kind `operator` in a fleet; every other ship is an `agent`. */
11
17
  export const SHIP_KINDS = ['operator', 'agent'];
12
18
  export const shipKindSchema = z.enum(SHIP_KINDS);
@@ -47,6 +53,7 @@ export const EVENT_TYPES = [
47
53
  'DeliveryAbandoned',
48
54
  'DeliveryDismissed',
49
55
  'ShipRenamed',
56
+ 'ShipReported',
50
57
  ];
51
58
  export const eventTypeSchema = z.enum(EVENT_TYPES);
52
59
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fleet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AAEH,gGAAgG;AAChG,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,eAAe,EAAE,kBAAkB,EAAE,YAAY,EAAE,cAAc,CAAU,CAAC;AACnG,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI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,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAGzD;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,CAAU,CAAC;AAC5H,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAG3D,gFAAgF;AAChF,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,kBAAkB;IAClB,kBAAkB;IAClB,aAAa;IACb,cAAc;IACd,mBAAmB;IACnB,sBAAsB;IACtB,uBAAuB;IACvB,iBAAiB;IACjB,iBAAiB;IACjB,sBAAsB;IACtB,uBAAuB;IACvB,kBAAkB;IAClB,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,aAAa;IACb,cAAc;CACN,CAAC;AACX,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC"}
@@ -27,6 +27,17 @@ export declare const themeSchema: z.ZodEnum<{
27
27
  system: "system";
28
28
  }>;
29
29
  export type Theme = z.infer<typeof themeSchema>;
30
+ /**
31
+ * Output of `console.session`: for another service the operator uses beside
32
+ * the console, which forwards the browser's session cookie and asks whether
33
+ * the operator is signed in. The fleet they signed in to, and when the
34
+ * session expires (ISO 8601 in UTC).
35
+ */
36
+ export declare const consoleSessionOutputSchema: z.ZodObject<{
37
+ fleetId: z.ZodType<`flt_${string}`, unknown, z.core.$ZodTypeInternals<`flt_${string}`, unknown>>;
38
+ expiresAt: z.ZodISODateTime;
39
+ }, z.core.$strip>;
40
+ export type ConsoleSessionOutput = z.infer<typeof consoleSessionOutputSchema>;
30
41
  /**
31
42
  * Output of `console.account`: the signed-in operator, their theme, and this
32
43
  * console session: the device it signed in from and since when.
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { idSchema } from '../ids/index.js';
2
3
  /** The operator's email: at most 254 characters, the longest address mail carries. */
3
4
  export const OPERATOR_EMAIL_MAX_LENGTH = 254;
4
5
  /** One @ with something on each side, and no whitespace. */
@@ -23,6 +24,16 @@ export const THEMES = ['light', 'dark', 'system'];
23
24
  export const themeSchema = z.enum(THEMES);
24
25
  /** ISO 8601 in UTC. */
25
26
  const isoTime = z.iso.datetime();
27
+ /**
28
+ * Output of `console.session`: for another service the operator uses beside
29
+ * the console, which forwards the browser's session cookie and asks whether
30
+ * the operator is signed in. The fleet they signed in to, and when the
31
+ * session expires (ISO 8601 in UTC).
32
+ */
33
+ export const consoleSessionOutputSchema = z.object({
34
+ fleetId: idSchema('fleet'),
35
+ expiresAt: z.iso.datetime(),
36
+ });
26
37
  /**
27
38
  * Output of `console.account`: the signed-in operator, their theme, and this
28
39
  * console session: the device it signed in from and since when.
@@ -1 +1 @@
1
- {"version":3,"file":"console.js","sourceRoot":"","sources":["../../src/schemas/console.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,sFAAsF;AACtF,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAC7C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,GAAG,CAAC,yBAAyB,CAAC;IAClF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC,GAAG,CAAC,4BAA4B,CAAC;CACrF,CAAC,CAAC;AAIH,8GAA8G;AAC9G,MAAM,CA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ENGTH = 48;
12
12
  export declare const SHIP_HANDLE_PATTERN: RegExp;
13
13
  export declare const shipHandleSchema: z.ZodString;
14
14
  export declare const SHIP_NOTE_MAX_LENGTH = 500;
15
- /** Input of `fleet.commission`. The note is free text for the operator; whitespace around it is dropped. */
15
+ /**
16
+ * Input of `fleet.commission`. The note is free text for the operator;
17
+ * whitespace around it is dropped. `fleetScopes` adds fleet:read and/or
18
+ * fleet:manage to the scopes every agent ship has; none when left out.
19
+ */
16
20
  export declare const commissionShipInputSchema: z.ZodObject<{
17
21
  name: z.ZodString;
18
22
  type: z.ZodString;
23
+ fleetScopes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
24
+ "fleet:read": "fleet:read";
25
+ "fleet:manage": "fleet:manage";
26
+ }>>>;
19
27
  note: z.ZodOptional<z.ZodString>;
20
28
  }, z.core.$strip>;
21
29
  export type CommissionShipInput = z.infer<typeof commissionShipInputSchema>;
@@ -115,6 +123,21 @@ export declare const listedShipSchema: z.ZodObject<{
115
123
  sentAt: z.ZodISODateTime;
116
124
  answeredAt: z.ZodNullable<z.ZodISODateTime>;
117
125
  }, z.core.$strip>>;
126
+ scopes: z.ZodArray<z.ZodEnum<{
127
+ "messages:send": "messages:send";
128
+ "messages:receive": "messages:receive";
129
+ "fleet:read": "fleet:read";
130
+ "fleet:manage": "fleet:manage";
131
+ }>>;
132
+ report: z.ZodNullable<z.ZodObject<{
133
+ state: z.ZodEnum<{
134
+ working: "working";
135
+ blocked: "blocked";
136
+ idle: "idle";
137
+ }>;
138
+ note: z.ZodNullable<z.ZodString>;
139
+ reportedAt: z.ZodISODateTime;
140
+ }, z.core.$strip>>;
118
141
  }, z.core.$strip>;
119
142
  export type ListedShip = z.infer<typeof listedShipSchema>;
120
143
  /** Output of `fleet.list`: every ship in the caller's fleet, `argo` included. */
@@ -154,6 +177,21 @@ export declare const fleetListOutputSchema: z.ZodArray<z.ZodObject<{
154
177
  sentAt: z.ZodISODateTime;
155
178
  answeredAt: z.ZodNullable<z.ZodISODateTime>;
156
179
  }, z.core.$strip>>;
180
+ scopes: z.ZodArray<z.ZodEnum<{
181
+ "messages:send": "messages:send";
182
+ "messages:receive": "messages:receive";
183
+ "fleet:read": "fleet:read";
184
+ "fleet:manage": "fleet:manage";
185
+ }>>;
186
+ report: z.ZodNullable<z.ZodObject<{
187
+ state: z.ZodEnum<{
188
+ working: "working";
189
+ blocked: "blocked";
190
+ idle: "idle";
191
+ }>;
192
+ note: z.ZodNullable<z.ZodString>;
193
+ reportedAt: z.ZodISODateTime;
194
+ }, z.core.$strip>>;
157
195
  }, z.core.$strip>>;
158
196
  /**
159
197
  * Input of the `fleet.events` subscription: the number of the last event the
@@ -190,6 +228,7 @@ export declare const liveFleetEventSchema: z.ZodObject<{
190
228
  DeliveryAbandoned: "DeliveryAbandoned";
191
229
  DeliveryDismissed: "DeliveryDismissed";
192
230
  ShipRenamed: "ShipRenamed";
231
+ ShipReported: "ShipReported";
193
232
  }>;
194
233
  occurredAt: z.ZodISODateTime;
195
234
  actorShipId: z.ZodNullable<z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>>;
@@ -224,6 +263,7 @@ export declare const fleetStreamItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject
224
263
  DeliveryAbandoned: "DeliveryAbandoned";
225
264
  DeliveryDismissed: "DeliveryDismissed";
226
265
  ShipRenamed: "ShipRenamed";
266
+ ShipReported: "ShipReported";
227
267
  }>;
228
268
  occurredAt: z.ZodISODateTime;
229
269
  actorShipId: z.ZodNullable<z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>>;
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { eventTypeSchema, locationKindSchema, shipKindSchema, shipStatusSchema } from '../fleet/index.js';
2
+ import { eventTypeSchema, fleetScopeSchema, locationKindSchema, scopeSchema, shipKindSchema, shipStatusSchema } from '../fleet/index.js';
3
3
  import { idSchema } from '../ids/index.js';
4
+ import { reportStateSchema } from './report.js';
4
5
  /**
5
6
  * Inputs and outputs of the fleet procedures: commission a ship, get its
6
7
  * starting prompt, release it, list the fleet, follow its events live.
@@ -18,10 +19,15 @@ export const shipHandleSchema = z
18
19
  .max(SHIP_HANDLE_MAX_LENGTH, HANDLE_MESSAGE)
19
20
  .regex(SHIP_HANDLE_PATTERN, HANDLE_MESSAGE);
20
21
  export const SHIP_NOTE_MAX_LENGTH = 500;
21
- /** Input of `fleet.commission`. The note is free text for the operator; whitespace around it is dropped. */
22
+ /**
23
+ * Input of `fleet.commission`. The note is free text for the operator;
24
+ * whitespace around it is dropped. `fleetScopes` adds fleet:read and/or
25
+ * fleet:manage to the scopes every agent ship has; none when left out.
26
+ */
22
27
  export const commissionShipInputSchema = z.object({
23
28
  name: shipHandleSchema,
24
29
  type: shipHandleSchema,
30
+ fleetScopes: z.array(fleetScopeSchema).optional(),
25
31
  note: z
26
32
  .string()
27
33
  .trim()
@@ -107,6 +113,19 @@ export const listedShipSchema = z.object({
107
113
  answeredAt: z.iso.datetime().nullable(),
108
114
  })
109
115
  .nullable(),
116
+ /** What the ship may do, checked on every call: every agent ship sends and receives, argo has all. */
117
+ scopes: z.array(scopeSchema),
118
+ /**
119
+ * The crew's last report (ISO 8601 in UTC): its state, its note, and when it
120
+ * last reported. Null until the crew reports, and for a ship no session crews.
121
+ */
122
+ report: z
123
+ .object({
124
+ state: reportStateSchema,
125
+ note: z.string().nullable(),
126
+ reportedAt: z.iso.datetime(),
127
+ })
128
+ .nullable(),
110
129
  });
111
130
  /** Output of `fleet.list`: every ship in the caller's fleet, `argo` included. */
112
131
  export const fleetListOutputSchema = z.array(listedShipSchema);
@@ -1 +1 @@
1
- {"version":3,"file":"fleet.js","sourceRoot":"","sources":["../../src/schemas/fleet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,cAAc,EAAE,gBAAgB,E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EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,EAAE,sCAAsC,CAAC,CAAC,OAAO,EAAE;CACzG,CAAC,CAAC;AAIH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAChC,EAAE,EAAE,QAAQ,CAAC,OAAO,CAAC;IACrB,IAAI,EAAE,eAAe;IACrB,uBAAuB;IACvB,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC5B,oDAAoD;IACpD,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;IACxC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;IACnC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE;IACzC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;CAC5C,CAAC,CAAC;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAChE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC;IACnE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;CACxC,CAAC,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+ /** The most events one follow answers, and how many it answers unless told fewer. */
3
+ export declare const FOLLOW_MAX_LIMIT = 100;
4
+ export declare const FOLLOW_MAX_DEFAULT = 100;
5
+ /** The longest a follow waits while no event has come, in seconds. */
6
+ export declare const FOLLOW_WAIT_MAX_SECONDS = 25;
7
+ /**
8
+ * Input of `fleet.follow`: the number of the last event the caller has (the
9
+ * same commit-ordered numbers the console follows by), at most how many to
10
+ * answer, and how long to wait while none has come. Without a position it
11
+ * answers where to start from.
12
+ */
13
+ export declare const followFleetInputSchema: z.ZodOptional<z.ZodObject<{
14
+ afterSeq: z.ZodOptional<z.ZodInt>;
15
+ max: z.ZodOptional<z.ZodInt>;
16
+ waitSeconds: z.ZodOptional<z.ZodInt>;
17
+ }, z.core.$strip>>;
18
+ export type FollowFleetInput = z.infer<typeof followFleetInputSchema>;
19
+ /** Output of `fleet.follow`: the events after the position, oldest first, and the number to follow from next. */
20
+ export declare const followFleetOutputSchema: z.ZodObject<{
21
+ events: z.ZodArray<z.ZodObject<{
22
+ seq: z.ZodNumber;
23
+ id: z.ZodType<`evt_${string}`, unknown, z.core.$ZodTypeInternals<`evt_${string}`, unknown>>;
24
+ type: z.ZodEnum<{
25
+ FleetInitialised: "FleetInitialised";
26
+ ShipCommissioned: "ShipCommissioned";
27
+ ShipClaimed: "ShipClaimed";
28
+ LeaseRevoked: "LeaseRevoked";
29
+ CredentialRevoked: "CredentialRevoked";
30
+ StartingPromptIssued: "StartingPromptIssued";
31
+ OperatorPasswordReset: "OperatorPasswordReset";
32
+ MessageAccepted: "MessageAccepted";
33
+ DeliveryClaimed: "DeliveryClaimed";
34
+ DeliveryAcknowledged: "DeliveryAcknowledged";
35
+ DeliveryUndeliverable: "DeliveryUndeliverable";
36
+ DeliveryReturned: "DeliveryReturned";
37
+ ShipRetired: "ShipRetired";
38
+ DeliveryAbandoned: "DeliveryAbandoned";
39
+ DeliveryDismissed: "DeliveryDismissed";
40
+ ShipRenamed: "ShipRenamed";
41
+ ShipReported: "ShipReported";
42
+ }>;
43
+ occurredAt: z.ZodISODateTime;
44
+ actorShipId: z.ZodNullable<z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>>;
45
+ shipId: z.ZodNullable<z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>>;
46
+ messageId: z.ZodNullable<z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>>;
47
+ deliveryId: z.ZodNullable<z.ZodType<`dlv_${string}`, unknown, z.core.$ZodTypeInternals<`dlv_${string}`, unknown>>>;
48
+ }, z.core.$strip>>;
49
+ lastSeq: z.ZodInt;
50
+ }, z.core.$strip>;
51
+ export type FollowFleetOutput = z.infer<typeof followFleetOutputSchema>;
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import { liveFleetEventSchema } from './fleet.js';
3
+ /** The most events one follow answers, and how many it answers unless told fewer. */
4
+ export const FOLLOW_MAX_LIMIT = 100;
5
+ export const FOLLOW_MAX_DEFAULT = FOLLOW_MAX_LIMIT;
6
+ /** The longest a follow waits while no event has come, in seconds. */
7
+ export const FOLLOW_WAIT_MAX_SECONDS = 25;
8
+ /**
9
+ * Input of `fleet.follow`: the number of the last event the caller has (the
10
+ * same commit-ordered numbers the console follows by), at most how many to
11
+ * answer, and how long to wait while none has come. Without a position it
12
+ * answers where to start from.
13
+ */
14
+ export const followFleetInputSchema = z
15
+ .object({
16
+ afterSeq: z.int().min(0).optional(),
17
+ max: z.int().min(1).max(FOLLOW_MAX_LIMIT).optional(),
18
+ waitSeconds: z.int().min(0).max(FOLLOW_WAIT_MAX_SECONDS).optional(),
19
+ })
20
+ .optional();
21
+ /** Output of `fleet.follow`: the events after the position, oldest first, and the number to follow from next. */
22
+ export const followFleetOutputSchema = z.object({
23
+ events: z.array(liveFleetEventSchema),
24
+ lastSeq: z.int().min(0),
25
+ });
26
+ //# sourceMappingURL=follow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"follow.js","sourceRoot":"","sources":["../../src/schemas/follow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD,qFAAqF;AACrF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AACpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAEnD,sEAAsE;AACtE,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACnC,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE;IACpD,WAAW,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,QAAQ,EAAE;CACpE,CAAC;KACD,QAAQ,EAAE,CAAC;AAId,iHAAiH;AACjH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACxB,CAAC,CAAC"}
@@ -62,6 +62,21 @@ export declare const shipDetailOutputSchema: z.ZodObject<{
62
62
  sentAt: z.ZodISODateTime;
63
63
  answeredAt: z.ZodNullable<z.ZodISODateTime>;
64
64
  }, z.core.$strip>>;
65
+ scopes: z.ZodArray<z.ZodEnum<{
66
+ "messages:send": "messages:send";
67
+ "messages:receive": "messages:receive";
68
+ "fleet:read": "fleet:read";
69
+ "fleet:manage": "fleet:manage";
70
+ }>>;
71
+ report: z.ZodNullable<z.ZodObject<{
72
+ state: z.ZodEnum<{
73
+ working: "working";
74
+ blocked: "blocked";
75
+ idle: "idle";
76
+ }>;
77
+ note: z.ZodNullable<z.ZodString>;
78
+ reportedAt: z.ZodISODateTime;
79
+ }, z.core.$strip>>;
65
80
  commissionedAt: z.ZodISODateTime;
66
81
  crewedSince: z.ZodNullable<z.ZodISODateTime>;
67
82
  retiredAt: z.ZodNullable<z.ZodISODateTime>;
@@ -90,6 +105,7 @@ export declare const timelineEntrySchema: z.ZodObject<{
90
105
  DeliveryAbandoned: "DeliveryAbandoned";
91
106
  DeliveryDismissed: "DeliveryDismissed";
92
107
  ShipRenamed: "ShipRenamed";
108
+ ShipReported: "ShipReported";
93
109
  }>;
94
110
  occurredAt: z.ZodISODateTime;
95
111
  actor: z.ZodNullable<z.ZodObject<{
@@ -142,6 +158,7 @@ export declare const shipTimelineOutputSchema: z.ZodArray<z.ZodObject<{
142
158
  DeliveryAbandoned: "DeliveryAbandoned";
143
159
  DeliveryDismissed: "DeliveryDismissed";
144
160
  ShipRenamed: "ShipRenamed";
161
+ ShipReported: "ShipReported";
145
162
  }>;
146
163
  occurredAt: z.ZodISODateTime;
147
164
  actor: z.ZodNullable<z.ZodObject<{
@@ -1,10 +1,12 @@
1
1
  export * from './console.js';
2
2
  export * from './delivery.js';
3
3
  export * from './fleet.js';
4
+ export * from './follow.js';
4
5
  export * from './history.js';
5
6
  export * from './message.js';
6
7
  export * from './needs-attention.js';
7
8
  export * from './operator-inbox.js';
8
9
  export * from './ping.js';
10
+ export * from './report.js';
9
11
  export * from './ship.js';
10
12
  export * from './system.js';
@@ -1,11 +1,13 @@
1
1
  export * from './console.js';
2
2
  export * from './delivery.js';
3
3
  export * from './fleet.js';
4
+ export * from './follow.js';
4
5
  export * from './history.js';
5
6
  export * from './message.js';
6
7
  export * from './needs-attention.js';
7
8
  export * from './operator-inbox.js';
8
9
  export * from './ping.js';
10
+ export * from './report.js';
9
11
  export * from './ship.js';
10
12
  export * from './system.js';
11
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ /** What a crew says it is doing: working, blocked or idle. Plain data: nothing acts on it. */
3
+ export declare const REPORT_STATES: readonly ["working", "blocked", "idle"];
4
+ export declare const reportStateSchema: z.ZodEnum<{
5
+ working: "working";
6
+ blocked: "blocked";
7
+ idle: "idle";
8
+ }>;
9
+ export type ReportState = z.infer<typeof reportStateSchema>;
10
+ /** The longest a report's note may be. */
11
+ export declare const REPORT_NOTE_MAX_LENGTH = 200;
12
+ /** Whether a note fits on one line. */
13
+ export declare function isOneLine(text: string): boolean;
14
+ /** Input of `report`: the crew's state and a short note on what it is doing, trimmed. Calling it is a check-in. */
15
+ export declare const reportInputSchema: z.ZodObject<{
16
+ state: z.ZodEnum<{
17
+ working: "working";
18
+ blocked: "blocked";
19
+ idle: "idle";
20
+ }>;
21
+ note: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$strip>;
23
+ export type ReportInput = z.infer<typeof reportInputSchema>;
24
+ /** Output of `report`: nothing; the OK is the answer. */
25
+ export declare const reportOutputSchema: z.ZodObject<{}, z.core.$strict>;
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ /** What a crew says it is doing: working, blocked or idle. Plain data: nothing acts on it. */
3
+ export const REPORT_STATES = ['working', 'blocked', 'idle'];
4
+ export const reportStateSchema = z.enum(REPORT_STATES);
5
+ /** The longest a report's note may be. */
6
+ export const REPORT_NOTE_MAX_LENGTH = 200;
7
+ const NOTE_MESSAGE = `A note is one line of at most ${String(REPORT_NOTE_MAX_LENGTH)} characters`;
8
+ /** Whether a note fits on one line. */
9
+ export function isOneLine(text) {
10
+ return !/[\r\n]/.test(text);
11
+ }
12
+ /** Input of `report`: the crew's state and a short note on what it is doing, trimmed. Calling it is a check-in. */
13
+ export const reportInputSchema = z.object({
14
+ state: reportStateSchema,
15
+ note: z.string().trim().max(REPORT_NOTE_MAX_LENGTH, NOTE_MESSAGE).refine(isOneLine, NOTE_MESSAGE).optional(),
16
+ });
17
+ /** Output of `report`: nothing; the OK is the answer. */
18
+ export const reportOutputSchema = z.strictObject({});
19
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/schemas/report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8FAA8F;AAC9F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAU,CAAC;AACrE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAGvD,0CAA0C;AAC1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAE1C,MAAM,YAAY,GAAG,iCAAiC,MAAM,CAAC,sBAAsB,CAAC,aAAa,CAAC;AAElG,uCAAuC;AACvC,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED,mHAAmH;AACnH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,iBAAiB;IACxB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,QAAQ,EAAE;CAC7G,CAAC,CAAC;AAIH,yDAAyD;AACzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeolus-fleet/common",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Aeolus shared schemas, prefixed ids and types.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",