@aeolus-fleet/common 0.15.1 → 0.17.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.
- package/dist/fleet/index.d.ts +6 -3
- package/dist/fleet/index.js +4 -3
- package/dist/fleet/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/schemas/console.d.ts +1 -0
- package/dist/schemas/fleet.d.ts +6 -2
- package/dist/schemas/fleet.js +3 -2
- package/dist/schemas/fleet.js.map +1 -1
- package/dist/schemas/history.d.ts +1 -0
- package/dist/trierarch/configuration.d.ts +23 -0
- package/dist/trierarch/configuration.js +32 -0
- package/dist/trierarch/configuration.js.map +1 -0
- package/dist/trierarch/index.d.ts +3 -0
- package/dist/trierarch/index.js +4 -0
- package/dist/trierarch/index.js.map +1 -0
- package/dist/trierarch/names.d.ts +9 -0
- package/dist/trierarch/names.js +13 -0
- package/dist/trierarch/names.js.map +1 -0
- package/dist/trierarch/protocol.d.ts +130 -0
- package/dist/trierarch/protocol.js +109 -0
- package/dist/trierarch/protocol.js.map +1 -0
- package/package.json +1 -1
package/dist/fleet/index.d.ts
CHANGED
|
@@ -5,22 +5,25 @@ import { z } from 'zod';
|
|
|
5
5
|
* states and event types. Server and web use the same words.
|
|
6
6
|
*/
|
|
7
7
|
/** A permission of a ship, stored on the server with the ship and checked before every call. */
|
|
8
|
-
export declare const SCOPES: readonly ["messages:send", "messages:receive", "fleet:read", "fleet:manage"];
|
|
8
|
+
export declare const SCOPES: readonly ["messages:send", "messages:receive", "fleet:read", "fleet:manage", "fleet:crew"];
|
|
9
9
|
export declare const scopeSchema: z.ZodEnum<{
|
|
10
10
|
"messages:send": "messages:send";
|
|
11
11
|
"messages:receive": "messages:receive";
|
|
12
12
|
"fleet:read": "fleet:read";
|
|
13
13
|
"fleet:manage": "fleet:manage";
|
|
14
|
+
"fleet:crew": "fleet:crew";
|
|
14
15
|
}>;
|
|
15
16
|
export type Scope = z.infer<typeof scopeSchema>;
|
|
16
17
|
/**
|
|
17
18
|
* The scopes commissioning may add to an agent ship, beside sending and
|
|
18
|
-
* receiving, which every agent ship has (ADR 0002).
|
|
19
|
+
* receiving, which every agent ship has (ADR 0002). `fleet:crew` is a
|
|
20
|
+
* trierarch's: it reads one ship, gets its starting prompt and releases it.
|
|
19
21
|
*/
|
|
20
|
-
export declare const FLEET_SCOPES: readonly ["fleet:read", "fleet:manage"];
|
|
22
|
+
export declare const FLEET_SCOPES: readonly ["fleet:read", "fleet:manage", "fleet:crew"];
|
|
21
23
|
export declare const fleetScopeSchema: z.ZodEnum<{
|
|
22
24
|
"fleet:read": "fleet:read";
|
|
23
25
|
"fleet:manage": "fleet:manage";
|
|
26
|
+
"fleet:crew": "fleet:crew";
|
|
24
27
|
}>;
|
|
25
28
|
export type FleetScope = z.infer<typeof fleetScopeSchema>;
|
|
26
29
|
/** `argo` is the one ship of kind `operator` in a fleet; every other ship is an `agent`. */
|
package/dist/fleet/index.js
CHANGED
|
@@ -5,13 +5,14 @@ import { z } from 'zod';
|
|
|
5
5
|
* states and event types. Server and web use the same words.
|
|
6
6
|
*/
|
|
7
7
|
/** A permission of a ship, stored on the server with the ship and checked before every call. */
|
|
8
|
-
export const SCOPES = ['messages:send', 'messages:receive', 'fleet:read', 'fleet:manage'];
|
|
8
|
+
export const SCOPES = ['messages:send', 'messages:receive', 'fleet:read', 'fleet:manage', 'fleet:crew'];
|
|
9
9
|
export const scopeSchema = z.enum(SCOPES);
|
|
10
10
|
/**
|
|
11
11
|
* The scopes commissioning may add to an agent ship, beside sending and
|
|
12
|
-
* receiving, which every agent ship has (ADR 0002).
|
|
12
|
+
* receiving, which every agent ship has (ADR 0002). `fleet:crew` is a
|
|
13
|
+
* trierarch's: it reads one ship, gets its starting prompt and releases it.
|
|
13
14
|
*/
|
|
14
|
-
export const FLEET_SCOPES = ['fleet:read', 'fleet:manage'];
|
|
15
|
+
export const FLEET_SCOPES = ['fleet:read', 'fleet:manage', 'fleet:crew'];
|
|
15
16
|
export const fleetScopeSchema = z.enum(FLEET_SCOPES);
|
|
16
17
|
/** `argo` is the one ship of kind `operator` in a fleet; every other ship is an `agent`. */
|
|
17
18
|
export const SHIP_KINDS = ['operator', 'agent', 'viewer'];
|
package/dist/fleet/index.js.map
CHANGED
|
@@ -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;
|
|
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,EAAE,YAAY,CAAU,CAAC;AACjH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAG1C;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,cAAc,EAAE,YAAY,CAAU,CAAC;AAClF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AAGrD,4FAA4F;AAC5F,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AACnE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAGjD,kFAAkF;AAClF,MAAM,CAAC,MAAM,cAAc,G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"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
|
|
@@ -58,6 +58,7 @@ export declare const consoleSessionOutputSchema: z.ZodObject<{
|
|
|
58
58
|
"messages:receive": "messages:receive";
|
|
59
59
|
"fleet:read": "fleet:read";
|
|
60
60
|
"fleet:manage": "fleet:manage";
|
|
61
|
+
"fleet:crew": "fleet:crew";
|
|
61
62
|
}>>;
|
|
62
63
|
}, z.core.$strip>;
|
|
63
64
|
export type ConsoleSessionOutput = z.infer<typeof consoleSessionOutputSchema>;
|
package/dist/schemas/fleet.d.ts
CHANGED
|
@@ -14,8 +14,9 @@ export declare const shipHandleSchema: z.ZodString;
|
|
|
14
14
|
export declare const SHIP_NOTE_MAX_LENGTH = 500;
|
|
15
15
|
/**
|
|
16
16
|
* Input of `fleet.commission`. The note is free text for the operator;
|
|
17
|
-
* whitespace around it is dropped. `fleetScopes` adds fleet:read
|
|
18
|
-
* fleet:manage to the scopes every agent ship has; none
|
|
17
|
+
* whitespace around it is dropped. `fleetScopes` adds fleet:read,
|
|
18
|
+
* fleet:manage and/or fleet:crew to the scopes every agent ship has; none
|
|
19
|
+
* when left out.
|
|
19
20
|
* `idempotencyKey` is the caller's own key, as for a send: a retry with the
|
|
20
21
|
* same key and the same request commissions no second ship.
|
|
21
22
|
*/
|
|
@@ -25,6 +26,7 @@ export declare const commissionShipInputSchema: z.ZodObject<{
|
|
|
25
26
|
fleetScopes: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
26
27
|
"fleet:read": "fleet:read";
|
|
27
28
|
"fleet:manage": "fleet:manage";
|
|
29
|
+
"fleet:crew": "fleet:crew";
|
|
28
30
|
}>>>;
|
|
29
31
|
note: z.ZodOptional<z.ZodString>;
|
|
30
32
|
idempotencyKey: z.ZodString;
|
|
@@ -179,6 +181,7 @@ export declare const listedShipSchema: z.ZodObject<{
|
|
|
179
181
|
"messages:receive": "messages:receive";
|
|
180
182
|
"fleet:read": "fleet:read";
|
|
181
183
|
"fleet:manage": "fleet:manage";
|
|
184
|
+
"fleet:crew": "fleet:crew";
|
|
182
185
|
}>>;
|
|
183
186
|
report: z.ZodNullable<z.ZodObject<{
|
|
184
187
|
state: z.ZodEnum<{
|
|
@@ -242,6 +245,7 @@ export declare const fleetListOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
242
245
|
"messages:receive": "messages:receive";
|
|
243
246
|
"fleet:read": "fleet:read";
|
|
244
247
|
"fleet:manage": "fleet:manage";
|
|
248
|
+
"fleet:crew": "fleet:crew";
|
|
245
249
|
}>>;
|
|
246
250
|
report: z.ZodNullable<z.ZodObject<{
|
|
247
251
|
state: z.ZodEnum<{
|
package/dist/schemas/fleet.js
CHANGED
|
@@ -22,8 +22,9 @@ export const shipHandleSchema = z
|
|
|
22
22
|
export const SHIP_NOTE_MAX_LENGTH = 500;
|
|
23
23
|
/**
|
|
24
24
|
* Input of `fleet.commission`. The note is free text for the operator;
|
|
25
|
-
* whitespace around it is dropped. `fleetScopes` adds fleet:read
|
|
26
|
-
* fleet:manage to the scopes every agent ship has; none
|
|
25
|
+
* whitespace around it is dropped. `fleetScopes` adds fleet:read,
|
|
26
|
+
* fleet:manage and/or fleet:crew to the scopes every agent ship has; none
|
|
27
|
+
* when left out.
|
|
27
28
|
* `idempotencyKey` is the caller's own key, as for a send: a retry with the
|
|
28
29
|
* same key and the same request commissions no second ship.
|
|
29
30
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fleet.js","sourceRoot":"","sources":["../../src/schemas/fleet.ts"],"names":[],"mappings":"AAAA,O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AC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5E,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC;CACjH,CAAC,CAAC"}
|
|
@@ -74,6 +74,7 @@ export declare const shipDetailOutputSchema: z.ZodObject<{
|
|
|
74
74
|
"messages:receive": "messages:receive";
|
|
75
75
|
"fleet:read": "fleet:read";
|
|
76
76
|
"fleet:manage": "fleet:manage";
|
|
77
|
+
"fleet:crew": "fleet:crew";
|
|
77
78
|
}>>;
|
|
78
79
|
report: z.ZodNullable<z.ZodObject<{
|
|
79
80
|
state: z.ZodEnum<{
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const trierarchConfigurationSchema: z.ZodObject<{
|
|
3
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
4
|
+
worktreeRoot: z.ZodOptional<z.ZodString>;
|
|
5
|
+
caps: z.ZodObject<{
|
|
6
|
+
ships: z.ZodInt;
|
|
7
|
+
running: z.ZodInt;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
repositories: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
10
|
+
path: z.ZodString;
|
|
11
|
+
}, z.core.$strict>>;
|
|
12
|
+
folders: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
13
|
+
path: z.ZodString;
|
|
14
|
+
}, z.core.$strict>>;
|
|
15
|
+
harnesses: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
16
|
+
flags: z.ZodArray<z.ZodString>;
|
|
17
|
+
options: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
18
|
+
values: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>;
|
|
19
|
+
default: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strict>>;
|
|
21
|
+
}, z.core.$strict>>;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export type TrierarchConfiguration = z.infer<typeof trierarchConfigurationSchema>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { harnessSchema } from '../schemas/ship.js';
|
|
3
|
+
import { trierarchNameSchema } from './names.js';
|
|
4
|
+
/**
|
|
5
|
+
* The trierarch's local configuration (docs/architecture.md, "The
|
|
6
|
+
* trierarch"): `~/.aeolus/trierarch/config.json`, written by the operator.
|
|
7
|
+
* Paths and flags live here and only here; messages name what it holds.
|
|
8
|
+
* The trierarch adds no flag by itself.
|
|
9
|
+
*/
|
|
10
|
+
const placeSchema = z.strictObject({ path: z.string().min(1) });
|
|
11
|
+
/** An option a want may set: its values by name, each with the flags it adds, and the value used when the want sets none. */
|
|
12
|
+
const optionSchema = z
|
|
13
|
+
.strictObject({ values: z.record(trierarchNameSchema, z.array(z.string())), default: trierarchNameSchema.optional() })
|
|
14
|
+
.refine((option) => option.default === undefined || option.default in option.values, {
|
|
15
|
+
message: 'The default is one of the values',
|
|
16
|
+
path: ['default'],
|
|
17
|
+
});
|
|
18
|
+
const harnessConfigurationSchema = z.strictObject({
|
|
19
|
+
/** Flags every launch of the harness gets: the operator's choice, with no policy on which. */
|
|
20
|
+
flags: z.array(z.string()),
|
|
21
|
+
options: z.record(trierarchNameSchema, optionSchema),
|
|
22
|
+
});
|
|
23
|
+
export const trierarchConfigurationSchema = z.strictObject({
|
|
24
|
+
$schema: z.string().optional(),
|
|
25
|
+
/** Where worktrees go, one folder per ship; `~/.aeolus/trierarch/worktrees/` when left out. */
|
|
26
|
+
worktreeRoot: z.string().min(1).optional(),
|
|
27
|
+
caps: z.strictObject({ ships: z.int().positive(), running: z.int().positive() }),
|
|
28
|
+
repositories: z.record(trierarchNameSchema, placeSchema),
|
|
29
|
+
folders: z.record(trierarchNameSchema, placeSchema),
|
|
30
|
+
harnesses: z.record(harnessSchema, harnessConfigurationSchema),
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/trierarch/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;GAKG;AAEH,MAAM,WAAW,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAEhE,6HAA6H;AAC7H,MAAM,YAAY,GAAG,CAAC;KACnB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,mBAAmB,CAAC,QAAQ,EAAE,EAAE,CAAC;KACrH,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE;IACnF,OAAO,EAAE,kCAAkC;IAC3C,IAAI,EAAE,CAAC,SAAS,CAAC;CAClB,CAAC,CAAC;AAEL,MAAM,0BAA0B,GAAG,CAAC,CAAC,YAAY,CAAC;IAChD,8FAA8F;IAC9F,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1B,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,mBAAmB,EAAE,YAAY,CAAC;CACrD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,YAAY,CAAC;IACzD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,+FAA+F;IAC/F,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC1C,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC;IAChF,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,mBAAmB,EAAE,WAAW,CAAC;IACxD,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,mBAAmB,EAAE,WAAW,CAAC;IACnD,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,0BAA0B,CAAC;CAC/D,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/trierarch/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** The longest name of a repository, a folder, an option or one of its values. */
|
|
3
|
+
export declare const TRIERARCH_NAME_MAX_LENGTH = 100;
|
|
4
|
+
/**
|
|
5
|
+
* A name the trierarch's configuration gives a repository, a folder, an
|
|
6
|
+
* option or an option's value. Messages carry names, never paths
|
|
7
|
+
* (decision 0027), so a name holds no slash and starts with no dot.
|
|
8
|
+
*/
|
|
9
|
+
export declare const trierarchNameSchema: z.ZodString;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** The longest name of a repository, a folder, an option or one of its values. */
|
|
3
|
+
export const TRIERARCH_NAME_MAX_LENGTH = 100;
|
|
4
|
+
/**
|
|
5
|
+
* A name the trierarch's configuration gives a repository, a folder, an
|
|
6
|
+
* option or an option's value. Messages carry names, never paths
|
|
7
|
+
* (decision 0027), so a name holds no slash and starts with no dot.
|
|
8
|
+
*/
|
|
9
|
+
export const trierarchNameSchema = z
|
|
10
|
+
.string()
|
|
11
|
+
.max(TRIERARCH_NAME_MAX_LENGTH, `A name is at most ${String(TRIERARCH_NAME_MAX_LENGTH)} characters`)
|
|
12
|
+
.regex(/^[a-z0-9][a-z0-9._-]*$/, 'A name is lowercase letters, digits, dots, hyphens and underscores, and never a path');
|
|
13
|
+
//# sourceMappingURL=names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.js","sourceRoot":"","sources":["../../src/trierarch/names.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,kFAAkF;AAClF,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,EAAE;KACR,GAAG,CAAC,yBAAyB,EAAE,qBAAqB,MAAM,CAAC,yBAAyB,CAAC,aAAa,CAAC;KACnG,KAAK,CAAC,wBAAwB,EAAE,sFAAsF,CAAC,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The trierarch protocol (docs/trierarch.md, decision 0027): fleet messages
|
|
4
|
+
* to and from a trierarch's ship. Aeolus reads none of them. The core is
|
|
5
|
+
* fixed for every dispatcher; each harness's options are open, described by
|
|
6
|
+
* the JSON Schema describe answers with. Every message refuses unknown
|
|
7
|
+
* fields, so a dispatcher never ignores what a requester meant.
|
|
8
|
+
*/
|
|
9
|
+
/** A message's content type, by convention: `application/vnd.aeolus.trierarch.<name>+json`. */
|
|
10
|
+
export declare function trierarchContentType(name: string): string;
|
|
11
|
+
/** The longest first prompt, in UTF-8 bytes: 8 KB, given on the first start only. */
|
|
12
|
+
export declare const FIRST_PROMPT_MAX_BYTES = 8192;
|
|
13
|
+
/** Where an entry stands in the trierarch's loop; running covers idle and busy. */
|
|
14
|
+
export declare const TRIERARCH_ENTRY_STATES: readonly ["wanted", "crewing", "running", "restarting", "crashed", "releasing"];
|
|
15
|
+
export declare const trierarchEntryStateSchema: z.ZodEnum<{
|
|
16
|
+
running: "running";
|
|
17
|
+
wanted: "wanted";
|
|
18
|
+
crewing: "crewing";
|
|
19
|
+
restarting: "restarting";
|
|
20
|
+
crashed: "crashed";
|
|
21
|
+
releasing: "releasing";
|
|
22
|
+
}>;
|
|
23
|
+
export type TrierarchEntryState = z.infer<typeof trierarchEntryStateSchema>;
|
|
24
|
+
/** A new git worktree of a configured repository, or a configured folder used as it is: named, never a path. */
|
|
25
|
+
export declare const trierarchWorkspaceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
26
|
+
kind: z.ZodLiteral<"worktree">;
|
|
27
|
+
repository: z.ZodString;
|
|
28
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
30
|
+
kind: z.ZodLiteral<"folder">;
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
}, z.core.$strict>], "kind">;
|
|
33
|
+
export type TrierarchWorkspace = z.infer<typeof trierarchWorkspaceSchema>;
|
|
34
|
+
export declare const describeCommandSchema: z.ZodObject<{}, z.core.$strict>;
|
|
35
|
+
export declare const describedAnswerSchema: z.ZodObject<{
|
|
36
|
+
harnesses: z.ZodArray<z.ZodObject<{
|
|
37
|
+
harness: z.ZodString;
|
|
38
|
+
options: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
39
|
+
flags: z.ZodArray<z.ZodString>;
|
|
40
|
+
}, z.core.$strict>>;
|
|
41
|
+
workspaces: z.ZodObject<{
|
|
42
|
+
repositories: z.ZodArray<z.ZodString>;
|
|
43
|
+
folders: z.ZodArray<z.ZodString>;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
caps: z.ZodObject<{
|
|
46
|
+
ships: z.ZodInt;
|
|
47
|
+
running: z.ZodInt;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
kept: z.ZodArray<z.ZodObject<{
|
|
50
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
51
|
+
path: z.ZodString;
|
|
52
|
+
}, z.core.$strict>>;
|
|
53
|
+
version: z.ZodString;
|
|
54
|
+
}, z.core.$strict>;
|
|
55
|
+
export declare const wantCommandSchema: z.ZodObject<{
|
|
56
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
57
|
+
harness: z.ZodString;
|
|
58
|
+
workspace: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
59
|
+
kind: z.ZodLiteral<"worktree">;
|
|
60
|
+
repository: z.ZodString;
|
|
61
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
63
|
+
kind: z.ZodLiteral<"folder">;
|
|
64
|
+
name: z.ZodString;
|
|
65
|
+
}, z.core.$strict>], "kind">;
|
|
66
|
+
squadron: z.ZodOptional<z.ZodString>;
|
|
67
|
+
firstPrompt: z.ZodOptional<z.ZodString>;
|
|
68
|
+
options: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
export type WantCommand = z.infer<typeof wantCommandSchema>;
|
|
71
|
+
export declare const wantedAnswerSchema: z.ZodObject<{
|
|
72
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
export declare const refusedAnswerSchema: z.ZodObject<{
|
|
75
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
76
|
+
field: z.ZodOptional<z.ZodString>;
|
|
77
|
+
reason: z.ZodString;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
export declare const releaseCommandSchema: z.ZodObject<{
|
|
80
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
81
|
+
force: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
}, z.core.$strict>;
|
|
83
|
+
export declare const releasedAnswerSchema: z.ZodObject<{
|
|
84
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
85
|
+
workspace: z.ZodEnum<{
|
|
86
|
+
kept: "kept";
|
|
87
|
+
removed: "removed";
|
|
88
|
+
}>;
|
|
89
|
+
path: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
export declare const listCommandSchema: z.ZodObject<{}, z.core.$strict>;
|
|
92
|
+
export declare const listedAnswerSchema: z.ZodObject<{
|
|
93
|
+
ships: z.ZodArray<z.ZodObject<{
|
|
94
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
95
|
+
harness: z.ZodString;
|
|
96
|
+
state: z.ZodEnum<{
|
|
97
|
+
running: "running";
|
|
98
|
+
wanted: "wanted";
|
|
99
|
+
crewing: "crewing";
|
|
100
|
+
restarting: "restarting";
|
|
101
|
+
crashed: "crashed";
|
|
102
|
+
releasing: "releasing";
|
|
103
|
+
}>;
|
|
104
|
+
since: z.ZodISODateTime;
|
|
105
|
+
restarts: z.ZodInt;
|
|
106
|
+
}, z.core.$strict>>;
|
|
107
|
+
kept: z.ZodArray<z.ZodObject<{
|
|
108
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
109
|
+
path: z.ZodString;
|
|
110
|
+
}, z.core.$strict>>;
|
|
111
|
+
orphans: z.ZodArray<z.ZodObject<{
|
|
112
|
+
path: z.ZodString;
|
|
113
|
+
}, z.core.$strict>>;
|
|
114
|
+
}, z.core.$strict>;
|
|
115
|
+
export declare const runningNoticeSchema: z.ZodObject<{
|
|
116
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
117
|
+
}, z.core.$strict>;
|
|
118
|
+
export declare const crashedNoticeSchema: z.ZodObject<{
|
|
119
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
120
|
+
exits: z.ZodInt;
|
|
121
|
+
}, z.core.$strict>;
|
|
122
|
+
export declare const leaseEndedNoticeSchema: z.ZodObject<{
|
|
123
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
124
|
+
}, z.core.$strict>;
|
|
125
|
+
/** The commands, by name: what a requester sends a trierarch. */
|
|
126
|
+
export declare const trierarchCommandSchemas: Readonly<Record<string, z.ZodType>>;
|
|
127
|
+
/** The answers, by name, each in reply to its command. */
|
|
128
|
+
export declare const trierarchAnswerSchemas: Readonly<Record<string, z.ZodType>>;
|
|
129
|
+
/** The notices, by name, unasked, to the ship that sent the want. */
|
|
130
|
+
export declare const trierarchNoticeSchemas: Readonly<Record<string, z.ZodType>>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { idSchema } from '../ids/index.js';
|
|
3
|
+
import { shipHandleSchema } from '../schemas/fleet.js';
|
|
4
|
+
import { harnessSchema } from '../schemas/ship.js';
|
|
5
|
+
import { trierarchNameSchema } from './names.js';
|
|
6
|
+
/**
|
|
7
|
+
* The trierarch protocol (docs/trierarch.md, decision 0027): fleet messages
|
|
8
|
+
* to and from a trierarch's ship. Aeolus reads none of them. The core is
|
|
9
|
+
* fixed for every dispatcher; each harness's options are open, described by
|
|
10
|
+
* the JSON Schema describe answers with. Every message refuses unknown
|
|
11
|
+
* fields, so a dispatcher never ignores what a requester meant.
|
|
12
|
+
*/
|
|
13
|
+
/** A message's content type, by convention: `application/vnd.aeolus.trierarch.<name>+json`. */
|
|
14
|
+
export function trierarchContentType(name) {
|
|
15
|
+
return `application/vnd.aeolus.trierarch.${name}+json`;
|
|
16
|
+
}
|
|
17
|
+
/** The longest first prompt, in UTF-8 bytes: 8 KB, given on the first start only. */
|
|
18
|
+
export const FIRST_PROMPT_MAX_BYTES = 8192;
|
|
19
|
+
const utf8 = new TextEncoder();
|
|
20
|
+
/** Where an entry stands in the trierarch's loop; running covers idle and busy. */
|
|
21
|
+
export const TRIERARCH_ENTRY_STATES = ['wanted', 'crewing', 'running', 'restarting', 'crashed', 'releasing'];
|
|
22
|
+
export const trierarchEntryStateSchema = z.enum(TRIERARCH_ENTRY_STATES);
|
|
23
|
+
const shipIdSchema = idSchema('ship');
|
|
24
|
+
/** A new git worktree of a configured repository, or a configured folder used as it is: named, never a path. */
|
|
25
|
+
export const trierarchWorkspaceSchema = z.discriminatedUnion('kind', [
|
|
26
|
+
z.strictObject({ kind: z.literal('worktree'), repository: trierarchNameSchema, ref: z.string().min(1).optional() }),
|
|
27
|
+
z.strictObject({ kind: z.literal('folder'), name: trierarchNameSchema }),
|
|
28
|
+
]);
|
|
29
|
+
/** A worktree the trierarch kept because it had changes, until a human or a release with force clears it. */
|
|
30
|
+
const keptWorktreeSchema = z.strictObject({ shipId: shipIdSchema, path: z.string().min(1) });
|
|
31
|
+
export const describeCommandSchema = z.strictObject({});
|
|
32
|
+
export const describedAnswerSchema = z.strictObject({
|
|
33
|
+
harnesses: z.array(z.strictObject({
|
|
34
|
+
harness: harnessSchema,
|
|
35
|
+
/** The JSON Schema a want's options are checked against. */
|
|
36
|
+
options: z.record(z.string(), z.json()),
|
|
37
|
+
/** The flags every launch of this harness gets, as the configuration makes them. */
|
|
38
|
+
flags: z.array(z.string()),
|
|
39
|
+
})),
|
|
40
|
+
workspaces: z.strictObject({ repositories: z.array(trierarchNameSchema), folders: z.array(trierarchNameSchema) }),
|
|
41
|
+
caps: z.strictObject({ ships: z.int().positive(), running: z.int().positive() }),
|
|
42
|
+
kept: z.array(keptWorktreeSchema),
|
|
43
|
+
version: z.string().min(1),
|
|
44
|
+
});
|
|
45
|
+
export const wantCommandSchema = z.strictObject({
|
|
46
|
+
shipId: shipIdSchema,
|
|
47
|
+
harness: harnessSchema,
|
|
48
|
+
workspace: trierarchWorkspaceSchema,
|
|
49
|
+
/** The squadron the ship is a member of, so it checks in at its flagship as a crew line's squadron id does. */
|
|
50
|
+
squadron: shipHandleSchema.optional(),
|
|
51
|
+
firstPrompt: z
|
|
52
|
+
.string()
|
|
53
|
+
.min(1)
|
|
54
|
+
.refine((prompt) => utf8.encode(prompt).byteLength <= FIRST_PROMPT_MAX_BYTES, `A first prompt is at most ${String(FIRST_PROMPT_MAX_BYTES)} bytes`)
|
|
55
|
+
.optional(),
|
|
56
|
+
/** Named settings from what describe offers; checked against its JSON Schema by the trierarch. */
|
|
57
|
+
options: z.record(z.string(), z.json()),
|
|
58
|
+
});
|
|
59
|
+
export const wantedAnswerSchema = z.strictObject({ shipId: shipIdSchema });
|
|
60
|
+
export const refusedAnswerSchema = z.strictObject({
|
|
61
|
+
shipId: shipIdSchema,
|
|
62
|
+
/** The field that was refused, such as `options.model`, when one was. */
|
|
63
|
+
field: z.string().min(1).optional(),
|
|
64
|
+
reason: z.string().min(1),
|
|
65
|
+
});
|
|
66
|
+
export const releaseCommandSchema = z.strictObject({ shipId: shipIdSchema, force: z.boolean().optional() });
|
|
67
|
+
export const releasedAnswerSchema = z.strictObject({
|
|
68
|
+
shipId: shipIdSchema,
|
|
69
|
+
workspace: z.enum(['removed', 'kept']),
|
|
70
|
+
path: z.string().min(1).optional(),
|
|
71
|
+
});
|
|
72
|
+
export const listCommandSchema = z.strictObject({});
|
|
73
|
+
export const listedAnswerSchema = z.strictObject({
|
|
74
|
+
ships: z.array(z.strictObject({
|
|
75
|
+
shipId: shipIdSchema,
|
|
76
|
+
harness: harnessSchema,
|
|
77
|
+
state: trierarchEntryStateSchema,
|
|
78
|
+
since: z.iso.datetime(),
|
|
79
|
+
restarts: z.int().nonnegative(),
|
|
80
|
+
})),
|
|
81
|
+
kept: z.array(keptWorktreeSchema),
|
|
82
|
+
/** Worktrees under the trierarch's root with no entry: reported, never deleted. */
|
|
83
|
+
orphans: z.array(z.strictObject({ path: z.string().min(1) })),
|
|
84
|
+
});
|
|
85
|
+
export const runningNoticeSchema = z.strictObject({ shipId: shipIdSchema });
|
|
86
|
+
export const crashedNoticeSchema = z.strictObject({ shipId: shipIdSchema, exits: z.int().positive() });
|
|
87
|
+
export const leaseEndedNoticeSchema = z.strictObject({ shipId: shipIdSchema });
|
|
88
|
+
/** The commands, by name: what a requester sends a trierarch. */
|
|
89
|
+
export const trierarchCommandSchemas = {
|
|
90
|
+
describe: describeCommandSchema,
|
|
91
|
+
want: wantCommandSchema,
|
|
92
|
+
release: releaseCommandSchema,
|
|
93
|
+
list: listCommandSchema,
|
|
94
|
+
};
|
|
95
|
+
/** The answers, by name, each in reply to its command. */
|
|
96
|
+
export const trierarchAnswerSchemas = {
|
|
97
|
+
described: describedAnswerSchema,
|
|
98
|
+
wanted: wantedAnswerSchema,
|
|
99
|
+
refused: refusedAnswerSchema,
|
|
100
|
+
released: releasedAnswerSchema,
|
|
101
|
+
listed: listedAnswerSchema,
|
|
102
|
+
};
|
|
103
|
+
/** The notices, by name, unasked, to the ship that sent the want. */
|
|
104
|
+
export const trierarchNoticeSchemas = {
|
|
105
|
+
running: runningNoticeSchema,
|
|
106
|
+
crashed: crashedNoticeSchema,
|
|
107
|
+
leaseEnded: leaseEndedNoticeSchema,
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=protocol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