@aeolus-fleet/common 0.26.1 → 0.27.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 +67 -9
- package/dist/fleet/index.js +87 -7
- package/dist/fleet/index.js.map +1 -1
- package/dist/fleet/no-terminal-questions.d.ts +1 -1
- package/dist/fleet/no-terminal-questions.js +1 -1
- package/dist/fleet/no-terminal-questions.js.map +1 -1
- package/dist/rules/index.d.ts +1 -0
- package/dist/rules/index.js +1 -0
- package/dist/rules/index.js.map +1 -1
- package/dist/rules/read-reach.d.ts +4 -0
- package/dist/rules/read-reach.js +5 -0
- package/dist/rules/read-reach.js.map +1 -0
- package/dist/schemas/console.d.ts +6 -0
- package/dist/schemas/crew-request.d.ts +2 -0
- package/dist/schemas/crew-request.js +3 -0
- package/dist/schemas/crew-request.js.map +1 -1
- package/dist/schemas/delivery.d.ts +10 -1
- package/dist/schemas/delivery.js +8 -2
- package/dist/schemas/delivery.js.map +1 -1
- package/dist/schemas/fleet.d.ts +61 -37
- package/dist/schemas/fleet.js +25 -9
- package/dist/schemas/fleet.js.map +1 -1
- package/dist/schemas/follow.d.ts +6 -0
- package/dist/schemas/history.d.ts +137 -11
- package/dist/schemas/history.js +5 -1
- package/dist/schemas/history.js.map +1 -1
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/message.d.ts +1 -0
- package/dist/schemas/message.js +2 -0
- package/dist/schemas/message.js.map +1 -1
- package/dist/schemas/needs-attention.d.ts +0 -150
- package/dist/schemas/needs-attention.js +1 -33
- package/dist/schemas/needs-attention.js.map +1 -1
- package/dist/schemas/network.d.ts +302 -12
- package/dist/schemas/network.js +77 -15
- package/dist/schemas/network.js.map +1 -1
- package/dist/schemas/scopes.d.ts +56 -0
- package/dist/schemas/scopes.js +35 -0
- package/dist/schemas/scopes.js.map +1 -0
- package/dist/schemas/ship.d.ts +2 -0
- package/dist/schemas/ship.js +7 -0
- package/dist/schemas/ship.js.map +1 -1
- package/dist/schemas/statement.d.ts +126 -0
- package/dist/schemas/statement.js +88 -0
- package/dist/schemas/statement.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** One scope and its one-line description, as a namespace lists it. */
|
|
3
|
+
export declare const declaredScopeSchema: z.ZodObject<{
|
|
4
|
+
scope: z.ZodString;
|
|
5
|
+
description: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
/**
|
|
8
|
+
* Input of `fleet.declareScopes` (scopes:declare): the caller's plugin
|
|
9
|
+
* namespace and its whole list of scopes (decision 0046). Core checks each
|
|
10
|
+
* rule and names its refusal.
|
|
11
|
+
*/
|
|
12
|
+
export declare const declareScopesInputSchema: z.ZodObject<{
|
|
13
|
+
namespace: z.ZodString;
|
|
14
|
+
scopes: z.ZodArray<z.ZodObject<{
|
|
15
|
+
scope: z.ZodString;
|
|
16
|
+
description: z.ZodString;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
/** Output of `fleet.declareScopes`: the namespace as declared. */
|
|
20
|
+
export declare const declareScopesOutputSchema: z.ZodObject<{
|
|
21
|
+
namespace: z.ZodString;
|
|
22
|
+
scopes: z.ZodArray<z.ZodObject<{
|
|
23
|
+
scope: z.ZodString;
|
|
24
|
+
description: z.ZodString;
|
|
25
|
+
}, z.core.$strip>>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
/**
|
|
28
|
+
* Output of `fleet.scopes` (fleet:read): every namespace of the fleet, the
|
|
29
|
+
* core ones first, declared by no ship, then each plugin's by namespace,
|
|
30
|
+
* with its declarer by id and name (decision 0046).
|
|
31
|
+
*/
|
|
32
|
+
export declare const scopesOutputSchema: z.ZodArray<z.ZodObject<{
|
|
33
|
+
namespace: z.ZodString;
|
|
34
|
+
declaredBy: z.ZodNullable<z.ZodObject<{
|
|
35
|
+
id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
36
|
+
name: z.ZodString;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
scopes: z.ZodArray<z.ZodObject<{
|
|
39
|
+
scope: z.ZodString;
|
|
40
|
+
description: z.ZodString;
|
|
41
|
+
}, z.core.$strip>>;
|
|
42
|
+
}, z.core.$strip>>;
|
|
43
|
+
/**
|
|
44
|
+
* Input of `fleet.grantScopes` (scopes:grant): the live ship, and the scopes
|
|
45
|
+
* granted and revoked at once, each within what the caller's ship may grant
|
|
46
|
+
* (decision 0046).
|
|
47
|
+
*/
|
|
48
|
+
export declare const grantScopesInputSchema: z.ZodObject<{
|
|
49
|
+
shipId: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
50
|
+
grant: z.ZodArray<z.ZodString>;
|
|
51
|
+
revoke: z.ZodArray<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
/** Output of `fleet.grantScopes`: every scope the ship holds now. */
|
|
54
|
+
export declare const grantScopesOutputSchema: z.ZodObject<{
|
|
55
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { scopeNameSchema } from '../fleet/index.js';
|
|
3
|
+
import { idSchema } from '../ids/index.js';
|
|
4
|
+
/** One scope and its one-line description, as a namespace lists it. */
|
|
5
|
+
export const declaredScopeSchema = z.object({ scope: scopeNameSchema, description: z.string() });
|
|
6
|
+
/**
|
|
7
|
+
* Input of `fleet.declareScopes` (scopes:declare): the caller's plugin
|
|
8
|
+
* namespace and its whole list of scopes (decision 0046). Core checks each
|
|
9
|
+
* rule and names its refusal.
|
|
10
|
+
*/
|
|
11
|
+
export const declareScopesInputSchema = z.object({
|
|
12
|
+
namespace: z.string(),
|
|
13
|
+
scopes: z.array(z.object({ scope: z.string(), description: z.string() })),
|
|
14
|
+
});
|
|
15
|
+
/** Output of `fleet.declareScopes`: the namespace as declared. */
|
|
16
|
+
export const declareScopesOutputSchema = z.object({ namespace: z.string(), scopes: z.array(declaredScopeSchema) });
|
|
17
|
+
/**
|
|
18
|
+
* Output of `fleet.scopes` (fleet:read): every namespace of the fleet, the
|
|
19
|
+
* core ones first, declared by no ship, then each plugin's by namespace,
|
|
20
|
+
* with its declarer by id and name (decision 0046).
|
|
21
|
+
*/
|
|
22
|
+
export const scopesOutputSchema = z.array(z.object({
|
|
23
|
+
namespace: z.string(),
|
|
24
|
+
declaredBy: z.object({ id: idSchema('ship'), name: z.string() }).nullable(),
|
|
25
|
+
scopes: z.array(declaredScopeSchema),
|
|
26
|
+
}));
|
|
27
|
+
/**
|
|
28
|
+
* Input of `fleet.grantScopes` (scopes:grant): the live ship, and the scopes
|
|
29
|
+
* granted and revoked at once, each within what the caller's ship may grant
|
|
30
|
+
* (decision 0046).
|
|
31
|
+
*/
|
|
32
|
+
export const grantScopesInputSchema = z.object({ shipId: idSchema('ship'), grant: z.array(z.string()), revoke: z.array(z.string()) });
|
|
33
|
+
/** Output of `fleet.grantScopes`: every scope the ship holds now. */
|
|
34
|
+
export const grantScopesOutputSchema = z.object({ scopes: z.array(scopeNameSchema) });
|
|
35
|
+
//# sourceMappingURL=scopes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopes.js","sourceRoot":"","sources":["../../src/schemas/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,uEAAuE;AACvE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,eAAe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EtI,qEAAqE;AACrE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC"}
|
package/dist/schemas/ship.d.ts
CHANGED
|
@@ -69,6 +69,8 @@ export declare const whoamiOutputSchema: z.ZodObject<{
|
|
|
69
69
|
fleetId: z.ZodType<`flt_${string}`, unknown, z.core.$ZodTypeInternals<`flt_${string}`, unknown>>;
|
|
70
70
|
name: z.ZodString;
|
|
71
71
|
type: z.ZodString;
|
|
72
|
+
ownerShipId: z.ZodNullable<z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>>;
|
|
73
|
+
ownerName: z.ZodNullable<z.ZodString>;
|
|
72
74
|
}, z.core.$strip>;
|
|
73
75
|
export type WhoamiOutput = z.infer<typeof whoamiOutputSchema>;
|
|
74
76
|
/** Output of `ship.deregister`: nothing; the OK is the answer. */
|
package/dist/schemas/ship.js
CHANGED
|
@@ -62,6 +62,13 @@ export const whoamiOutputSchema = z.object({
|
|
|
62
62
|
fleetId: idSchema('fleet'),
|
|
63
63
|
name: z.string(),
|
|
64
64
|
type: z.string(),
|
|
65
|
+
/**
|
|
66
|
+
* Its owner's id and name, both null for argo and the viewer (decision
|
|
67
|
+
* 0045). Keys of their own: the aeolus plugin's scripts read name, shipId
|
|
68
|
+
* and type as the last such key in the answer.
|
|
69
|
+
*/
|
|
70
|
+
ownerShipId: idSchema('ship').nullable(),
|
|
71
|
+
ownerName: z.string().nullable(),
|
|
65
72
|
});
|
|
66
73
|
/** Output of `ship.deregister`: nothing; the OK is the answer. */
|
|
67
74
|
export const deregisterOutputSchema = z.strictObject({});
|
package/dist/schemas/ship.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ship.js","sourceRoot":"","sources":["../../src/schemas/ship.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,E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,EAAE,QAAQ,CAAC,OAAO,CAAC;IAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB;;;;OAIG;IACH,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE;IACxC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAIH,kEAAkE;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* A ship's statement (decision 0047): what it is and what it offers, stated
|
|
4
|
+
* by its crew and read by the ships that can send to it. A short summary and
|
|
5
|
+
* capabilities, each borrowing MCP's tool fields (name, title, description,
|
|
6
|
+
* inputSchema, outputSchema) and A2A's skill fields for media types
|
|
7
|
+
* (inputModes, outputModes), so a later gateway maps them as they are
|
|
8
|
+
* (decision 0048). Core checks the shape and acts on none of it.
|
|
9
|
+
*/
|
|
10
|
+
/** The most a statement holds: 64 KB as the UTF-8 bytes of its JSON, as a payload does (decision 0006). */
|
|
11
|
+
export declare const STATEMENT_MAX_BYTES: number;
|
|
12
|
+
/** The longest a statement's summary may be. */
|
|
13
|
+
export declare const STATEMENT_SUMMARY_MAX_LENGTH = 1000;
|
|
14
|
+
/** One thing a ship offers: MCP's tool fields and A2A's input and output modes. */
|
|
15
|
+
export declare const capabilitySchema: z.ZodObject<{
|
|
16
|
+
name: z.ZodString;
|
|
17
|
+
title: z.ZodOptional<z.ZodString>;
|
|
18
|
+
description: z.ZodOptional<z.ZodString>;
|
|
19
|
+
inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
20
|
+
outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
21
|
+
inputModes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
22
|
+
outputModes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
export type Capability = z.infer<typeof capabilitySchema>;
|
|
25
|
+
/** The size of a statement: the UTF-8 bytes of its JSON. */
|
|
26
|
+
export declare function statementBytes(statement: unknown): number;
|
|
27
|
+
/** A statement: a summary and capabilities, each name once, at most 64 KB. */
|
|
28
|
+
export declare const statementSchema: z.ZodObject<{
|
|
29
|
+
summary: z.ZodString;
|
|
30
|
+
capabilities: z.ZodArray<z.ZodObject<{
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
title: z.ZodOptional<z.ZodString>;
|
|
33
|
+
description: z.ZodOptional<z.ZodString>;
|
|
34
|
+
inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
35
|
+
outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
36
|
+
inputModes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
37
|
+
outputModes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
38
|
+
}, z.core.$strict>>;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
export type Statement = z.infer<typeof statementSchema>;
|
|
41
|
+
/** Input of `setStatement`: the crew's whole statement, replacing the one it stated before. */
|
|
42
|
+
export declare const setStatementInputSchema: z.ZodObject<{
|
|
43
|
+
summary: z.ZodString;
|
|
44
|
+
capabilities: z.ZodArray<z.ZodObject<{
|
|
45
|
+
name: z.ZodString;
|
|
46
|
+
title: z.ZodOptional<z.ZodString>;
|
|
47
|
+
description: z.ZodOptional<z.ZodString>;
|
|
48
|
+
inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
49
|
+
outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
50
|
+
inputModes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
51
|
+
outputModes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
52
|
+
}, z.core.$strict>>;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
/** Output of `setStatement`: the statement's version now. */
|
|
55
|
+
export declare const setStatementOutputSchema: z.ZodObject<{
|
|
56
|
+
version: z.ZodInt;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
/**
|
|
59
|
+
* A ship's statement as discovery shows it, saying who wrote it: its crew's,
|
|
60
|
+
* with its version, while one is stated; else the note it was commissioned
|
|
61
|
+
* with; else none.
|
|
62
|
+
*/
|
|
63
|
+
export declare const discoveredStatementSchema: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
64
|
+
by: z.ZodLiteral<"crew">;
|
|
65
|
+
version: z.ZodInt;
|
|
66
|
+
summary: z.ZodString;
|
|
67
|
+
capabilities: z.ZodArray<z.ZodObject<{
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
title: z.ZodOptional<z.ZodString>;
|
|
70
|
+
description: z.ZodOptional<z.ZodString>;
|
|
71
|
+
inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
72
|
+
outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
73
|
+
inputModes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
74
|
+
outputModes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
75
|
+
}, z.core.$strict>>;
|
|
76
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
77
|
+
by: z.ZodLiteral<"commission">;
|
|
78
|
+
note: z.ZodString;
|
|
79
|
+
}, z.core.$strip>], "by">>;
|
|
80
|
+
export type DiscoveredStatement = z.infer<typeof discoveredStatementSchema>;
|
|
81
|
+
/**
|
|
82
|
+
* Output of `discover` (messages:send): the ships the caller may send to now,
|
|
83
|
+
* each with its name, type, kind, status and statement, and each type with
|
|
84
|
+
* how many of its ships it reaches (decision 0047). Ships, never rules.
|
|
85
|
+
*/
|
|
86
|
+
export declare const discoverOutputSchema: z.ZodObject<{
|
|
87
|
+
ships: z.ZodArray<z.ZodObject<{
|
|
88
|
+
id: z.ZodType<`shp_${string}`, unknown, z.core.$ZodTypeInternals<`shp_${string}`, unknown>>;
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
type: z.ZodString;
|
|
91
|
+
kind: z.ZodEnum<{
|
|
92
|
+
operator: "operator";
|
|
93
|
+
agent: "agent";
|
|
94
|
+
viewer: "viewer";
|
|
95
|
+
person: "person";
|
|
96
|
+
app: "app";
|
|
97
|
+
}>;
|
|
98
|
+
status: z.ZodEnum<{
|
|
99
|
+
awaitingCrew: "awaitingCrew";
|
|
100
|
+
crewed: "crewed";
|
|
101
|
+
retired: "retired";
|
|
102
|
+
}>;
|
|
103
|
+
statement: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
104
|
+
by: z.ZodLiteral<"crew">;
|
|
105
|
+
version: z.ZodInt;
|
|
106
|
+
summary: z.ZodString;
|
|
107
|
+
capabilities: z.ZodArray<z.ZodObject<{
|
|
108
|
+
name: z.ZodString;
|
|
109
|
+
title: z.ZodOptional<z.ZodString>;
|
|
110
|
+
description: z.ZodOptional<z.ZodString>;
|
|
111
|
+
inputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
112
|
+
outputSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
|
|
113
|
+
inputModes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
114
|
+
outputModes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
115
|
+
}, z.core.$strict>>;
|
|
116
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
117
|
+
by: z.ZodLiteral<"commission">;
|
|
118
|
+
note: z.ZodString;
|
|
119
|
+
}, z.core.$strip>], "by">>;
|
|
120
|
+
}, z.core.$strip>>;
|
|
121
|
+
types: z.ZodArray<z.ZodObject<{
|
|
122
|
+
type: z.ZodString;
|
|
123
|
+
reachable: z.ZodInt;
|
|
124
|
+
}, z.core.$strip>>;
|
|
125
|
+
}, z.core.$strip>;
|
|
126
|
+
export type Discovered = z.infer<typeof discoverOutputSchema>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { shipKindSchema, shipStatusSchema } from '../fleet/index.js';
|
|
3
|
+
import { idSchema } from '../ids/index.js';
|
|
4
|
+
import { contentTypeSchema } from './message.js';
|
|
5
|
+
/**
|
|
6
|
+
* A ship's statement (decision 0047): what it is and what it offers, stated
|
|
7
|
+
* by its crew and read by the ships that can send to it. A short summary and
|
|
8
|
+
* capabilities, each borrowing MCP's tool fields (name, title, description,
|
|
9
|
+
* inputSchema, outputSchema) and A2A's skill fields for media types
|
|
10
|
+
* (inputModes, outputModes), so a later gateway maps them as they are
|
|
11
|
+
* (decision 0048). Core checks the shape and acts on none of it.
|
|
12
|
+
*/
|
|
13
|
+
/** The most a statement holds: 64 KB as the UTF-8 bytes of its JSON, as a payload does (decision 0006). */
|
|
14
|
+
export const STATEMENT_MAX_BYTES = 64 * 1024;
|
|
15
|
+
/** The longest a statement's summary may be. */
|
|
16
|
+
export const STATEMENT_SUMMARY_MAX_LENGTH = 1000;
|
|
17
|
+
/** A capability's name as MCP names a tool: 1 to 128 letters, digits, `_`, `-` or `.`. */
|
|
18
|
+
const CAPABILITY_NAME = /^[A-Za-z0-9_.-]{1,128}$/;
|
|
19
|
+
const CAPABILITY_NAME_MESSAGE = 'A capability name is 1 to 128 letters, digits, _, - or ., as MCP names a tool';
|
|
20
|
+
/** A JSON Schema as MCP's tool takes one: a JSON object, never read by the fleet. */
|
|
21
|
+
const jsonSchemaSchema = z.record(z.string(), z.json());
|
|
22
|
+
/** Media types, as A2A's skill lists them: at least one, the first the one to use. */
|
|
23
|
+
const modesSchema = z.array(contentTypeSchema).min(1, 'Name at least one media type');
|
|
24
|
+
/** One thing a ship offers: MCP's tool fields and A2A's input and output modes. */
|
|
25
|
+
export const capabilitySchema = z.strictObject({
|
|
26
|
+
name: z.string().regex(CAPABILITY_NAME, CAPABILITY_NAME_MESSAGE),
|
|
27
|
+
title: z.string().optional(),
|
|
28
|
+
description: z.string().optional(),
|
|
29
|
+
inputSchema: jsonSchemaSchema.optional(),
|
|
30
|
+
outputSchema: jsonSchemaSchema.optional(),
|
|
31
|
+
/** The media types to send it, the first the one to use (A2A's skill inputModes). */
|
|
32
|
+
inputModes: modesSchema.optional(),
|
|
33
|
+
/** The media types that come back, the first the one to expect (A2A's skill outputModes). */
|
|
34
|
+
outputModes: modesSchema.optional(),
|
|
35
|
+
});
|
|
36
|
+
const utf8 = new TextEncoder();
|
|
37
|
+
/** The size of a statement: the UTF-8 bytes of its JSON. */
|
|
38
|
+
export function statementBytes(statement) {
|
|
39
|
+
return utf8.encode(JSON.stringify(statement)).byteLength;
|
|
40
|
+
}
|
|
41
|
+
const STATEMENT_SIZE_MESSAGE = `A statement is at most ${String(STATEMENT_MAX_BYTES)} bytes (64 KB) as JSON in UTF-8`;
|
|
42
|
+
/** A statement: a summary and capabilities, each name once, at most 64 KB. */
|
|
43
|
+
export const statementSchema = z
|
|
44
|
+
.strictObject({
|
|
45
|
+
summary: z
|
|
46
|
+
.string()
|
|
47
|
+
.trim()
|
|
48
|
+
.min(1, 'A statement has a summary')
|
|
49
|
+
.max(STATEMENT_SUMMARY_MAX_LENGTH, `A summary is at most ${String(STATEMENT_SUMMARY_MAX_LENGTH)} characters`),
|
|
50
|
+
capabilities: z.array(capabilitySchema),
|
|
51
|
+
})
|
|
52
|
+
.refine((statement) => new Set(statement.capabilities.map((capability) => capability.name)).size === statement.capabilities.length, {
|
|
53
|
+
message: 'A statement names each capability once',
|
|
54
|
+
path: ['capabilities'],
|
|
55
|
+
})
|
|
56
|
+
.refine((statement) => statementBytes(statement) <= STATEMENT_MAX_BYTES, { message: STATEMENT_SIZE_MESSAGE });
|
|
57
|
+
/** Input of `setStatement`: the crew's whole statement, replacing the one it stated before. */
|
|
58
|
+
export const setStatementInputSchema = statementSchema;
|
|
59
|
+
/** Output of `setStatement`: the statement's version now. */
|
|
60
|
+
export const setStatementOutputSchema = z.object({ version: z.int().min(1) });
|
|
61
|
+
/**
|
|
62
|
+
* A ship's statement as discovery shows it, saying who wrote it: its crew's,
|
|
63
|
+
* with its version, while one is stated; else the note it was commissioned
|
|
64
|
+
* with; else none.
|
|
65
|
+
*/
|
|
66
|
+
export const discoveredStatementSchema = z
|
|
67
|
+
.discriminatedUnion('by', [
|
|
68
|
+
z.object({ by: z.literal('crew'), version: z.int().min(1), summary: z.string(), capabilities: z.array(capabilitySchema) }),
|
|
69
|
+
z.object({ by: z.literal('commission'), note: z.string() }),
|
|
70
|
+
])
|
|
71
|
+
.nullable();
|
|
72
|
+
/**
|
|
73
|
+
* Output of `discover` (messages:send): the ships the caller may send to now,
|
|
74
|
+
* each with its name, type, kind, status and statement, and each type with
|
|
75
|
+
* how many of its ships it reaches (decision 0047). Ships, never rules.
|
|
76
|
+
*/
|
|
77
|
+
export const discoverOutputSchema = z.object({
|
|
78
|
+
ships: z.array(z.object({
|
|
79
|
+
id: idSchema('ship'),
|
|
80
|
+
name: z.string(),
|
|
81
|
+
type: z.string(),
|
|
82
|
+
kind: shipKindSchema,
|
|
83
|
+
status: shipStatusSchema,
|
|
84
|
+
statement: discoveredStatementSchema,
|
|
85
|
+
})),
|
|
86
|
+
types: z.array(z.object({ type: z.string(), reachable: z.int().min(1) })),
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=statement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"statement.js","sourceRoot":"","sources":["../../src/schemas/statement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAA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