@aeolus-fleet/common 0.2.1 → 0.4.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.
@@ -2,7 +2,8 @@ import { z } from 'zod';
2
2
  /**
3
3
  * Inputs and outputs of receiving and acknowledging deliveries (`ship.receive`
4
4
  * and `ship.ack`): how many deliveries a ship takes at once, what it gets for
5
- * each, and which one it acknowledges.
5
+ * each, and which one it acknowledges; and of the inbox check (`ship.inbox`),
6
+ * which counts what waits without taking any of it.
6
7
  */
7
8
  /** How many deliveries a receive returns when the ship does not say. */
8
9
  export declare const RECEIVE_MAX_DEFAULT = 1;
@@ -83,3 +84,18 @@ export type AckInput = z.infer<typeof ackInputSchema>;
83
84
  /** Output of `ship.ack`: nothing; the OK is the answer. */
84
85
  export declare const ackOutputSchema: z.ZodObject<{}, z.core.$strict>;
85
86
  export type AckOutput = z.infer<typeof ackOutputSchema>;
87
+ /** The longest an inbox check waits while nothing waits: as long as a receive. */
88
+ export declare const INBOX_WAIT_MAX_SECONDS = 25;
89
+ /**
90
+ * Input of `ship.inbox`: how long to wait, 0 to 25 whole seconds, while
91
+ * nothing waits for the crew. Without it, it answers at once.
92
+ */
93
+ export declare const inboxInputSchema: z.ZodOptional<z.ZodObject<{
94
+ waitSeconds: z.ZodOptional<z.ZodInt>;
95
+ }, z.core.$strip>>;
96
+ export type InboxInput = z.infer<typeof inboxInputSchema>;
97
+ /** Output of `ship.inbox`: how many deliveries the crew's next receive would hand it. */
98
+ export declare const inboxOutputSchema: z.ZodObject<{
99
+ waiting: z.ZodInt;
100
+ }, z.core.$strip>;
101
+ export type InboxOutput = z.infer<typeof inboxOutputSchema>;
@@ -3,7 +3,8 @@ import { idSchema } from '../ids/index.js';
3
3
  /**
4
4
  * Inputs and outputs of receiving and acknowledging deliveries (`ship.receive`
5
5
  * and `ship.ack`): how many deliveries a ship takes at once, what it gets for
6
- * each, and which one it acknowledges.
6
+ * each, and which one it acknowledges; and of the inbox check (`ship.inbox`),
7
+ * which counts what waits without taking any of it.
7
8
  */
8
9
  /** How many deliveries a receive returns when the ship does not say. */
9
10
  export const RECEIVE_MAX_DEFAULT = 1;
@@ -54,4 +55,15 @@ export const receiveOutputSchema = z.object({
54
55
  export const ackInputSchema = z.object({ deliveryId: idSchema('delivery') });
55
56
  /** Output of `ship.ack`: nothing; the OK is the answer. */
56
57
  export const ackOutputSchema = z.strictObject({});
58
+ /** The longest an inbox check waits while nothing waits: as long as a receive. */
59
+ export const INBOX_WAIT_MAX_SECONDS = 25;
60
+ /**
61
+ * Input of `ship.inbox`: how long to wait, 0 to 25 whole seconds, while
62
+ * nothing waits for the crew. Without it, it answers at once.
63
+ */
64
+ export const inboxInputSchema = z
65
+ .object({ waitSeconds: z.int().min(0).max(INBOX_WAIT_MAX_SECONDS).optional() })
66
+ .optional();
67
+ /** Output of `ship.inbox`: how many deliveries the crew's next receive would hand it. */
68
+ export const inboxOutputSchema = z.object({ waiting: z.int().min(0) });
57
69
  //# sourceMappingURL=delivery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"delivery.js","sourceRoot":"","sources":["../../src/schemas/delivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;;GAIG;AAEH,wEAAwE;AACxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C,gGAAgG;AAChG,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;KACvE,QAAQ,EAAE,CAAC;AAId;;;GAGG;AACH,M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,GAAG,CAAC,sBAAsB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;KAC9E,QAAQ,EAAE,CAAC;AAId,yFAAyF;AACzF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC"}
@@ -21,12 +21,14 @@ export declare const getStartingPromptInputSchema: z.ZodObject<{
21
21
  }, z.core.$strip>;
22
22
  /**
23
23
  * Output of `fleet.commission` and `fleet.getStartingPrompt`: the starting
24
- * prompt, holding the ship's new secret. Shown once; the secret is never
25
- * readable again.
24
+ * prompt, holding the ship's new secret, and the crew line, the same in one
25
+ * line for a Claude Code session with the aeolus plugin. Shown once; the
26
+ * secret is never readable again.
26
27
  */
27
28
  export declare const startingPromptOutputSchema: z.ZodObject<{
28
29
  shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
29
30
  prompt: z.ZodString;
31
+ crewLine: z.ZodString;
30
32
  }, z.core.$strip>;
31
33
  export type StartingPromptOutput = z.infer<typeof startingPromptOutputSchema>;
32
34
  /** Input of `fleet.release`: the crewed ship whose session loses it. */
@@ -109,8 +111,9 @@ export declare const fleetEventsInputSchema: z.ZodObject<{
109
111
  export type FleetEventsInput = z.infer<typeof fleetEventsInputSchema>;
110
112
  /**
111
113
  * One committed event as the live fleet view hears it: its number in the
112
- * fleet's stream (commit order, without gaps), what happened and when, and
113
- * which ship, message and delivery it concerns. Never its details.
114
+ * fleet's stream (commit order, without gaps), what happened and when, which
115
+ * ship caused it, and which ship, message and delivery it concerns. Never its
116
+ * details.
114
117
  */
115
118
  export declare const liveFleetEventSchema: z.ZodObject<{
116
119
  seq: z.ZodNumber;
@@ -130,6 +133,7 @@ export declare const liveFleetEventSchema: z.ZodObject<{
130
133
  DeliveryReturned: "DeliveryReturned";
131
134
  }>;
132
135
  occurredAt: z.ZodISODateTime;
136
+ actorShipId: z.ZodNullable<z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>>;
133
137
  shipId: z.ZodNullable<z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>>;
134
138
  messageId: z.ZodNullable<z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>>;
135
139
  deliveryId: z.ZodNullable<z.ZodType<`dlv_${string}`, unknown, z.core.$ZodTypeInternals<`dlv_${string}`, unknown>>>;
@@ -159,6 +163,7 @@ export declare const fleetStreamItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject
159
163
  DeliveryReturned: "DeliveryReturned";
160
164
  }>;
161
165
  occurredAt: z.ZodISODateTime;
166
+ actorShipId: z.ZodNullable<z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>>;
162
167
  shipId: z.ZodNullable<z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>>;
163
168
  messageId: z.ZodNullable<z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>>;
164
169
  deliveryId: z.ZodNullable<z.ZodType<`dlv_${string}`, unknown, z.core.$ZodTypeInternals<`dlv_${string}`, unknown>>>;
@@ -28,12 +28,15 @@ export const commissionShipInputSchema = z.object({
28
28
  export const getStartingPromptInputSchema = z.object({ shipId: idSchema('ship') });
29
29
  /**
30
30
  * Output of `fleet.commission` and `fleet.getStartingPrompt`: the starting
31
- * prompt, holding the ship's new secret. Shown once; the secret is never
32
- * readable again.
31
+ * prompt, holding the ship's new secret, and the crew line, the same in one
32
+ * line for a Claude Code session with the aeolus plugin. Shown once; the
33
+ * secret is never readable again.
33
34
  */
34
35
  export const startingPromptOutputSchema = z.object({
35
36
  shipId: idSchema('ship'),
36
37
  prompt: z.string(),
38
+ /** `/aeolus:crew <fleetUrl> <shipId> <secret>`. */
39
+ crewLine: z.string(),
37
40
  });
38
41
  /** Input of `fleet.release`: the crewed ship whose session loses it. */
39
42
  export const releaseShipInputSchema = z.object({ shipId: idSchema('ship') });
@@ -81,8 +84,9 @@ export const fleetEventsInputSchema = z.object({
81
84
  });
82
85
  /**
83
86
  * One committed event as the live fleet view hears it: its number in the
84
- * fleet's stream (commit order, without gaps), what happened and when, and
85
- * which ship, message and delivery it concerns. Never its details.
87
+ * fleet's stream (commit order, without gaps), what happened and when, which
88
+ * ship caused it, and which ship, message and delivery it concerns. Never its
89
+ * details.
86
90
  */
87
91
  export const liveFleetEventSchema = z.object({
88
92
  seq: z.number().int().positive(),
@@ -90,6 +94,8 @@ export const liveFleetEventSchema = z.object({
90
94
  type: eventTypeSchema,
91
95
  /** ISO 8601 in UTC. */
92
96
  occurredAt: z.iso.datetime(),
97
+ /** The ship that caused it; null for the system. */
98
+ actorShipId: idSchema('ship').nullable(),
93
99
  shipId: idSchema('ship').nullable(),
94
100
  messageId: idSchema('message').nullable(),
95
101
  deliveryId: idSchema('delivery').nullable(),
@@ -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,EAAE,MAAM,mBAAmB,CAAC;AAC1G,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;;GAGG;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AACzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAClD,MAAM,cAAc,GAAG,YAAY,sBAAsB,uCAAuC,CAAC;AAEjG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,EAAE;KACR,GAAG,CAAC,sBAAsB,EAAE,cAAc,CAAC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C,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;CACxC,CAAC,CAAC"}
@@ -0,0 +1,324 @@
1
+ import { z } from 'zod';
2
+ /** A ship as a party to an event or a message: its id (and so its suffix) and its name. */
3
+ export declare const partySchema: z.ZodObject<{
4
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
5
+ name: z.ZodString;
6
+ }, z.core.$strip>;
7
+ export type Party = z.infer<typeof partySchema>;
8
+ /** Who a message was addressed to: one ship, or any ship of a type. */
9
+ export declare const messageRecipientSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
10
+ kind: z.ZodLiteral<"ship">;
11
+ ship: z.ZodObject<{
12
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
13
+ name: z.ZodString;
14
+ }, z.core.$strip>;
15
+ }, z.core.$strip>, z.ZodObject<{
16
+ kind: z.ZodLiteral<"type">;
17
+ type: z.ZodString;
18
+ }, z.core.$strip>], "kind">;
19
+ export type MessageRecipient = z.infer<typeof messageRecipientSchema>;
20
+ /** Input of `fleet.ship`, `fleet.shipTimeline` and `fleet.shipMessages`. */
21
+ export declare const shipInputSchema: z.ZodObject<{
22
+ shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
23
+ }, z.core.$strip>;
24
+ /**
25
+ * Output of `fleet.ship`: the ship as the overview lists it, with when it was
26
+ * commissioned, since when its crew has held it (null while not crewed) and
27
+ * when it retired.
28
+ */
29
+ export declare const shipDetailOutputSchema: z.ZodObject<{
30
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
31
+ name: z.ZodString;
32
+ type: z.ZodString;
33
+ kind: z.ZodEnum<{
34
+ operator: "operator";
35
+ agent: "agent";
36
+ }>;
37
+ status: z.ZodEnum<{
38
+ awaitingCrew: "awaitingCrew";
39
+ crewed: "crewed";
40
+ retired: "retired";
41
+ }>;
42
+ startingPrompt: z.ZodNullable<z.ZodObject<{
43
+ issuedAt: z.ZodISODateTime;
44
+ isClaimed: z.ZodBoolean;
45
+ }, z.core.$strip>>;
46
+ location: z.ZodNullable<z.ZodObject<{
47
+ kind: z.ZodEnum<{
48
+ DEVICE: "DEVICE";
49
+ CLOUD: "CLOUD";
50
+ SERVER: "SERVER";
51
+ OTHER: "OTHER";
52
+ }>;
53
+ description: z.ZodNullable<z.ZodString>;
54
+ }, z.core.$strip>>;
55
+ commissionedAt: z.ZodISODateTime;
56
+ crewedSince: z.ZodNullable<z.ZodISODateTime>;
57
+ retiredAt: z.ZodNullable<z.ZodISODateTime>;
58
+ }, z.core.$strip>;
59
+ export type ShipDetail = z.infer<typeof shipDetailOutputSchema>;
60
+ /** One event on a ship's timeline: its number, type and time, its parties and its small flat details. */
61
+ export declare const timelineEntrySchema: z.ZodObject<{
62
+ seq: z.ZodNumber;
63
+ id: z.ZodType<`evt_${string}`, unknown, z.core.$ZodTypeInternals<`evt_${string}`, unknown>>;
64
+ type: z.ZodEnum<{
65
+ FleetInitialised: "FleetInitialised";
66
+ ShipCommissioned: "ShipCommissioned";
67
+ ShipClaimed: "ShipClaimed";
68
+ LeaseRevoked: "LeaseRevoked";
69
+ CredentialRevoked: "CredentialRevoked";
70
+ StartingPromptIssued: "StartingPromptIssued";
71
+ OperatorPasswordReset: "OperatorPasswordReset";
72
+ MessageAccepted: "MessageAccepted";
73
+ DeliveryClaimed: "DeliveryClaimed";
74
+ DeliveryAcknowledged: "DeliveryAcknowledged";
75
+ DeliveryUndeliverable: "DeliveryUndeliverable";
76
+ DeliveryReturned: "DeliveryReturned";
77
+ }>;
78
+ occurredAt: z.ZodISODateTime;
79
+ actor: z.ZodNullable<z.ZodObject<{
80
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
81
+ name: z.ZodString;
82
+ }, z.core.$strip>>;
83
+ ship: z.ZodNullable<z.ZodObject<{
84
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
85
+ name: z.ZodString;
86
+ }, z.core.$strip>>;
87
+ message: z.ZodNullable<z.ZodObject<{
88
+ id: z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>;
89
+ sender: z.ZodObject<{
90
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
91
+ name: z.ZodString;
92
+ }, z.core.$strip>;
93
+ recipient: z.ZodDiscriminatedUnion<[z.ZodObject<{
94
+ kind: z.ZodLiteral<"ship">;
95
+ ship: z.ZodObject<{
96
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
97
+ name: z.ZodString;
98
+ }, z.core.$strip>;
99
+ }, z.core.$strip>, z.ZodObject<{
100
+ kind: z.ZodLiteral<"type">;
101
+ type: z.ZodString;
102
+ }, z.core.$strip>], "kind">;
103
+ }, z.core.$strip>>;
104
+ details: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
105
+ }, z.core.$strip>;
106
+ export type TimelineEntry = z.infer<typeof timelineEntrySchema>;
107
+ /** Output of `fleet.shipTimeline`: the events that concern the ship, newest first. */
108
+ export declare const shipTimelineOutputSchema: z.ZodArray<z.ZodObject<{
109
+ seq: z.ZodNumber;
110
+ id: z.ZodType<`evt_${string}`, unknown, z.core.$ZodTypeInternals<`evt_${string}`, unknown>>;
111
+ type: z.ZodEnum<{
112
+ FleetInitialised: "FleetInitialised";
113
+ ShipCommissioned: "ShipCommissioned";
114
+ ShipClaimed: "ShipClaimed";
115
+ LeaseRevoked: "LeaseRevoked";
116
+ CredentialRevoked: "CredentialRevoked";
117
+ StartingPromptIssued: "StartingPromptIssued";
118
+ OperatorPasswordReset: "OperatorPasswordReset";
119
+ MessageAccepted: "MessageAccepted";
120
+ DeliveryClaimed: "DeliveryClaimed";
121
+ DeliveryAcknowledged: "DeliveryAcknowledged";
122
+ DeliveryUndeliverable: "DeliveryUndeliverable";
123
+ DeliveryReturned: "DeliveryReturned";
124
+ }>;
125
+ occurredAt: z.ZodISODateTime;
126
+ actor: z.ZodNullable<z.ZodObject<{
127
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
128
+ name: z.ZodString;
129
+ }, z.core.$strip>>;
130
+ ship: z.ZodNullable<z.ZodObject<{
131
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
132
+ name: z.ZodString;
133
+ }, z.core.$strip>>;
134
+ message: z.ZodNullable<z.ZodObject<{
135
+ id: z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>;
136
+ sender: z.ZodObject<{
137
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
138
+ name: z.ZodString;
139
+ }, z.core.$strip>;
140
+ recipient: z.ZodDiscriminatedUnion<[z.ZodObject<{
141
+ kind: z.ZodLiteral<"ship">;
142
+ ship: z.ZodObject<{
143
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
144
+ name: z.ZodString;
145
+ }, z.core.$strip>;
146
+ }, z.core.$strip>, z.ZodObject<{
147
+ kind: z.ZodLiteral<"type">;
148
+ type: z.ZodString;
149
+ }, z.core.$strip>], "kind">;
150
+ }, z.core.$strip>>;
151
+ details: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
152
+ }, z.core.$strip>>;
153
+ /** One message as the ship page lists it: parties, thread link, a preview of its payload and its delivery now. */
154
+ export declare const listedMessageSchema: z.ZodObject<{
155
+ id: z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>;
156
+ sender: z.ZodObject<{
157
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
158
+ name: z.ZodString;
159
+ }, z.core.$strip>;
160
+ recipient: z.ZodDiscriminatedUnion<[z.ZodObject<{
161
+ kind: z.ZodLiteral<"ship">;
162
+ ship: z.ZodObject<{
163
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
164
+ name: z.ZodString;
165
+ }, z.core.$strip>;
166
+ }, z.core.$strip>, z.ZodObject<{
167
+ kind: z.ZodLiteral<"type">;
168
+ type: z.ZodString;
169
+ }, z.core.$strip>], "kind">;
170
+ inReplyTo: z.ZodNullable<z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>>;
171
+ sentAt: z.ZodISODateTime;
172
+ contentType: z.ZodString;
173
+ preview: z.ZodString;
174
+ delivery: z.ZodObject<{
175
+ id: z.ZodType<`dlv_${string}`, unknown, z.core.$ZodTypeInternals<`dlv_${string}`, unknown>>;
176
+ state: z.ZodEnum<{
177
+ pending: "pending";
178
+ delivered: "delivered";
179
+ acknowledged: "acknowledged";
180
+ undeliverable: "undeliverable";
181
+ dismissed: "dismissed";
182
+ abandoned: "abandoned";
183
+ }>;
184
+ claimedBy: z.ZodNullable<z.ZodObject<{
185
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
186
+ name: z.ZodString;
187
+ }, z.core.$strip>>;
188
+ }, z.core.$strip>;
189
+ }, z.core.$strip>;
190
+ export type ListedMessage = z.infer<typeof listedMessageSchema>;
191
+ /** Output of `fleet.shipMessages`: the messages the ship sent, was sent or claimed, newest first. */
192
+ export declare const shipMessagesOutputSchema: z.ZodArray<z.ZodObject<{
193
+ id: z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>;
194
+ sender: z.ZodObject<{
195
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
196
+ name: z.ZodString;
197
+ }, z.core.$strip>;
198
+ recipient: z.ZodDiscriminatedUnion<[z.ZodObject<{
199
+ kind: z.ZodLiteral<"ship">;
200
+ ship: z.ZodObject<{
201
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
202
+ name: z.ZodString;
203
+ }, z.core.$strip>;
204
+ }, z.core.$strip>, z.ZodObject<{
205
+ kind: z.ZodLiteral<"type">;
206
+ type: z.ZodString;
207
+ }, z.core.$strip>], "kind">;
208
+ inReplyTo: z.ZodNullable<z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>>;
209
+ sentAt: z.ZodISODateTime;
210
+ contentType: z.ZodString;
211
+ preview: z.ZodString;
212
+ delivery: z.ZodObject<{
213
+ id: z.ZodType<`dlv_${string}`, unknown, z.core.$ZodTypeInternals<`dlv_${string}`, unknown>>;
214
+ state: z.ZodEnum<{
215
+ pending: "pending";
216
+ delivered: "delivered";
217
+ acknowledged: "acknowledged";
218
+ undeliverable: "undeliverable";
219
+ dismissed: "dismissed";
220
+ abandoned: "abandoned";
221
+ }>;
222
+ claimedBy: z.ZodNullable<z.ZodObject<{
223
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
224
+ name: z.ZodString;
225
+ }, z.core.$strip>>;
226
+ }, z.core.$strip>;
227
+ }, z.core.$strip>>;
228
+ /** Input of `fleet.message`. */
229
+ export declare const messageInputSchema: z.ZodObject<{
230
+ messageId: z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>;
231
+ }, z.core.$strip>;
232
+ /** The event types that change a delivery: its history. */
233
+ export declare const DELIVERY_HISTORY_TYPES: readonly ["MessageAccepted", "DeliveryClaimed", "DeliveryReturned", "DeliveryAcknowledged", "DeliveryUndeliverable"];
234
+ /** One change to a delivery: when, which ship held it and where its session ran, and the claims counted by then. */
235
+ export declare const deliveryHistoryEntrySchema: z.ZodObject<{
236
+ seq: z.ZodNumber;
237
+ type: z.ZodEnum<{
238
+ MessageAccepted: "MessageAccepted";
239
+ DeliveryClaimed: "DeliveryClaimed";
240
+ DeliveryAcknowledged: "DeliveryAcknowledged";
241
+ DeliveryUndeliverable: "DeliveryUndeliverable";
242
+ DeliveryReturned: "DeliveryReturned";
243
+ }>;
244
+ occurredAt: z.ZodISODateTime;
245
+ ship: z.ZodNullable<z.ZodObject<{
246
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
247
+ name: z.ZodString;
248
+ }, z.core.$strip>>;
249
+ location: z.ZodNullable<z.ZodObject<{
250
+ kind: z.ZodEnum<{
251
+ DEVICE: "DEVICE";
252
+ CLOUD: "CLOUD";
253
+ SERVER: "SERVER";
254
+ OTHER: "OTHER";
255
+ }>;
256
+ description: z.ZodNullable<z.ZodString>;
257
+ }, z.core.$strip>>;
258
+ attempts: z.ZodNullable<z.ZodNumber>;
259
+ }, z.core.$strip>;
260
+ export type DeliveryHistoryEntry = z.infer<typeof deliveryHistoryEntrySchema>;
261
+ /** Output of `fleet.message`: the envelope, the payload and the delivery with its history, newest first. */
262
+ export declare const messageOutputSchema: z.ZodObject<{
263
+ id: z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>;
264
+ recipient: z.ZodDiscriminatedUnion<[z.ZodObject<{
265
+ kind: z.ZodLiteral<"ship">;
266
+ ship: z.ZodObject<{
267
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
268
+ name: z.ZodString;
269
+ }, z.core.$strip>;
270
+ }, z.core.$strip>, z.ZodObject<{
271
+ kind: z.ZodLiteral<"type">;
272
+ type: z.ZodString;
273
+ }, z.core.$strip>], "kind">;
274
+ contentType: z.ZodString;
275
+ inReplyTo: z.ZodNullable<z.ZodType<`msg_${string}`, unknown, z.core.$ZodTypeInternals<`msg_${string}`, unknown>>>;
276
+ sentAt: z.ZodISODateTime;
277
+ sender: z.ZodObject<{
278
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
279
+ name: z.ZodString;
280
+ }, z.core.$strip>;
281
+ payload: z.ZodString;
282
+ delivery: z.ZodObject<{
283
+ id: z.ZodType<`dlv_${string}`, unknown, z.core.$ZodTypeInternals<`dlv_${string}`, unknown>>;
284
+ state: z.ZodEnum<{
285
+ pending: "pending";
286
+ delivered: "delivered";
287
+ acknowledged: "acknowledged";
288
+ undeliverable: "undeliverable";
289
+ dismissed: "dismissed";
290
+ abandoned: "abandoned";
291
+ }>;
292
+ attempts: z.ZodNumber;
293
+ claimedBy: z.ZodNullable<z.ZodObject<{
294
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
295
+ name: z.ZodString;
296
+ }, z.core.$strip>>;
297
+ history: z.ZodArray<z.ZodObject<{
298
+ seq: z.ZodNumber;
299
+ type: z.ZodEnum<{
300
+ MessageAccepted: "MessageAccepted";
301
+ DeliveryClaimed: "DeliveryClaimed";
302
+ DeliveryAcknowledged: "DeliveryAcknowledged";
303
+ DeliveryUndeliverable: "DeliveryUndeliverable";
304
+ DeliveryReturned: "DeliveryReturned";
305
+ }>;
306
+ occurredAt: z.ZodISODateTime;
307
+ ship: z.ZodNullable<z.ZodObject<{
308
+ id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
309
+ name: z.ZodString;
310
+ }, z.core.$strip>>;
311
+ location: z.ZodNullable<z.ZodObject<{
312
+ kind: z.ZodEnum<{
313
+ DEVICE: "DEVICE";
314
+ CLOUD: "CLOUD";
315
+ SERVER: "SERVER";
316
+ OTHER: "OTHER";
317
+ }>;
318
+ description: z.ZodNullable<z.ZodString>;
319
+ }, z.core.$strip>>;
320
+ attempts: z.ZodNullable<z.ZodNumber>;
321
+ }, z.core.$strip>>;
322
+ }, z.core.$strip>;
323
+ }, z.core.$strip>;
324
+ export type MessageDetail = z.infer<typeof messageOutputSchema>;
@@ -0,0 +1,101 @@
1
+ import { z } from 'zod';
2
+ import { deliveryStateSchema, eventTypeSchema, locationKindSchema } from '../fleet/index.js';
3
+ import { idSchema } from '../ids/index.js';
4
+ import { listedShipSchema } from './fleet.js';
5
+ /**
6
+ * Inputs and outputs of the history procedures, for the ship page: one ship,
7
+ * its timeline from the event log, its messages, and one message with the
8
+ * history of its delivery. Every one reads with fleet:read.
9
+ */
10
+ /** ISO 8601 in UTC. */
11
+ const isoTime = z.iso.datetime();
12
+ /** A ship as a party to an event or a message: its id (and so its suffix) and its name. */
13
+ export const partySchema = z.object({ id: idSchema('ship'), name: z.string() });
14
+ /** Who a message was addressed to: one ship, or any ship of a type. */
15
+ export const messageRecipientSchema = z.discriminatedUnion('kind', [
16
+ z.object({ kind: z.literal('ship'), ship: partySchema }),
17
+ z.object({ kind: z.literal('type'), type: z.string() }),
18
+ ]);
19
+ /** Input of `fleet.ship`, `fleet.shipTimeline` and `fleet.shipMessages`. */
20
+ export const shipInputSchema = z.object({ shipId: idSchema('ship') });
21
+ /**
22
+ * Output of `fleet.ship`: the ship as the overview lists it, with when it was
23
+ * commissioned, since when its crew has held it (null while not crewed) and
24
+ * when it retired.
25
+ */
26
+ export const shipDetailOutputSchema = listedShipSchema.extend({
27
+ commissionedAt: isoTime,
28
+ crewedSince: isoTime.nullable(),
29
+ retiredAt: isoTime.nullable(),
30
+ });
31
+ /** One event on a ship's timeline: its number, type and time, its parties and its small flat details. */
32
+ export const timelineEntrySchema = z.object({
33
+ seq: z.number().int().positive(),
34
+ id: idSchema('event'),
35
+ type: eventTypeSchema,
36
+ occurredAt: isoTime,
37
+ /** The ship that caused it; null for the system. */
38
+ actor: partySchema.nullable(),
39
+ /** The ship it concerns, when it names one. */
40
+ ship: partySchema.nullable(),
41
+ /** The message it concerns, with its sender and recipient. */
42
+ message: z
43
+ .object({ id: idSchema('message'), sender: partySchema, recipient: messageRecipientSchema })
44
+ .nullable(),
45
+ details: z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.null()])),
46
+ });
47
+ /** Output of `fleet.shipTimeline`: the events that concern the ship, newest first. */
48
+ export const shipTimelineOutputSchema = z.array(timelineEntrySchema);
49
+ /** One message as the ship page lists it: parties, thread link, a preview of its payload and its delivery now. */
50
+ export const listedMessageSchema = z.object({
51
+ id: idSchema('message'),
52
+ sender: partySchema,
53
+ recipient: messageRecipientSchema,
54
+ inReplyTo: idSchema('message').nullable(),
55
+ sentAt: isoTime,
56
+ contentType: z.string(),
57
+ /** The start of the payload, for the list; the whole payload comes with `fleet.message`. */
58
+ preview: z.string(),
59
+ delivery: z.object({
60
+ id: idSchema('delivery'),
61
+ state: deliveryStateSchema,
62
+ /** The ship holding or having acknowledged it; null while pending. */
63
+ claimedBy: partySchema.nullable(),
64
+ }),
65
+ });
66
+ /** Output of `fleet.shipMessages`: the messages the ship sent, was sent or claimed, newest first. */
67
+ export const shipMessagesOutputSchema = z.array(listedMessageSchema);
68
+ /** Input of `fleet.message`. */
69
+ export const messageInputSchema = z.object({ messageId: idSchema('message') });
70
+ /** The event types that change a delivery: its history. */
71
+ export const DELIVERY_HISTORY_TYPES = [
72
+ 'MessageAccepted',
73
+ 'DeliveryClaimed',
74
+ 'DeliveryReturned',
75
+ 'DeliveryAcknowledged',
76
+ 'DeliveryUndeliverable',
77
+ ];
78
+ /** One change to a delivery: when, which ship held it and where its session ran, and the claims counted by then. */
79
+ export const deliveryHistoryEntrySchema = z.object({
80
+ seq: z.number().int().positive(),
81
+ type: z.enum(DELIVERY_HISTORY_TYPES),
82
+ occurredAt: isoTime,
83
+ /** The ship that claimed, returned or acknowledged it; null when it was stored. */
84
+ ship: partySchema.nullable(),
85
+ /** Where the claiming session ran, for a claim. */
86
+ location: z.object({ kind: locationKindSchema, description: z.string().nullable() }).nullable(),
87
+ /** The claims counted so far, where the event records them. */
88
+ attempts: z.number().int().nonnegative().nullable(),
89
+ });
90
+ /** Output of `fleet.message`: the envelope, the payload and the delivery with its history, newest first. */
91
+ export const messageOutputSchema = listedMessageSchema.omit({ preview: true, delivery: true }).extend({
92
+ payload: z.string(),
93
+ delivery: z.object({
94
+ id: idSchema('delivery'),
95
+ state: deliveryStateSchema,
96
+ attempts: z.number().int().nonnegative(),
97
+ claimedBy: partySchema.nullable(),
98
+ history: z.array(deliveryHistoryEntrySchema),
99
+ }),
100
+ });
101
+ //# sourceMappingURL=history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/schemas/history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;GAIG;AAEH,uBAAuB;AACvB,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;AAEjC,2FAA2F;AAC3F,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAIhF,uEAAuE;AACvE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACjE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IACxD,CAAC,CAAC,MAAM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,EAAE;IAChC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC;IACpC,UAAU,EAAE,OAAO;IACnB,mFAAmF;IACnF,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE;IAC5B,mDAAmD;IACnD,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC/F,+DAA+D;IAC/D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;CACpD,CAAC,CAAC;AAIH,4GAA4G;AAC5G,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;IACpG,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,EAAE,EAAE,QAAQ,CAAC,UAAU,CAAC;QACxB,KAAK,EAAE,mBAAmB;QAC1B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;QACxC,SAAS,EAAE,WAAW,CAAC,QAAQ,EAAE;QACjC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,0BAA0B,CAAC;KAC7C,CAAC;CACH,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export * from './console.js';
2
2
  export * from './delivery.js';
3
3
  export * from './fleet.js';
4
+ export * from './history.js';
4
5
  export * from './message.js';
5
6
  export * from './ship.js';
6
7
  export * from './system.js';
@@ -1,6 +1,7 @@
1
1
  export * from './console.js';
2
2
  export * from './delivery.js';
3
3
  export * from './fleet.js';
4
+ export * from './history.js';
4
5
  export * from './message.js';
5
6
  export * from './ship.js';
6
7
  export * from './system.js';
@@ -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,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,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeolus-fleet/common",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "description": "Aeolus shared schemas, prefixed ids and types.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",