@aeolus-fleet/common 0.27.0 → 0.28.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.
Files changed (46) hide show
  1. package/dist/fleet/core-version.d.ts +20 -0
  2. package/dist/fleet/core-version.js +59 -0
  3. package/dist/fleet/core-version.js.map +1 -0
  4. package/dist/fleet/index.d.ts +27 -4
  5. package/dist/fleet/index.js +43 -2
  6. package/dist/fleet/index.js.map +1 -1
  7. package/dist/ids/index.d.ts +3 -0
  8. package/dist/ids/index.js +2 -0
  9. package/dist/ids/index.js.map +1 -1
  10. package/dist/schemas/account-token.d.ts +49 -0
  11. package/dist/schemas/account-token.js +51 -0
  12. package/dist/schemas/account-token.js.map +1 -0
  13. package/dist/schemas/console.d.ts +8 -0
  14. package/dist/schemas/console.js +3 -1
  15. package/dist/schemas/console.js.map +1 -1
  16. package/dist/schemas/delivery.d.ts +69 -3
  17. package/dist/schemas/delivery.js +35 -3
  18. package/dist/schemas/delivery.js.map +1 -1
  19. package/dist/schemas/fleet.d.ts +40 -2
  20. package/dist/schemas/fleet.js +21 -4
  21. package/dist/schemas/fleet.js.map +1 -1
  22. package/dist/schemas/follow.d.ts +14 -0
  23. package/dist/schemas/history.d.ts +111 -9
  24. package/dist/schemas/history.js +19 -3
  25. package/dist/schemas/history.js.map +1 -1
  26. package/dist/schemas/index.d.ts +2 -0
  27. package/dist/schemas/index.js +2 -0
  28. package/dist/schemas/index.js.map +1 -1
  29. package/dist/schemas/installation.d.ts +12 -0
  30. package/dist/schemas/installation.js +14 -1
  31. package/dist/schemas/installation.js.map +1 -1
  32. package/dist/schemas/label.d.ts +19 -5
  33. package/dist/schemas/label.js +7 -2
  34. package/dist/schemas/label.js.map +1 -1
  35. package/dist/schemas/network.d.ts +409 -90
  36. package/dist/schemas/network.js +76 -51
  37. package/dist/schemas/network.js.map +1 -1
  38. package/dist/schemas/statement.d.ts +94 -4
  39. package/dist/schemas/statement.js +33 -4
  40. package/dist/schemas/statement.js.map +1 -1
  41. package/dist/schemas/verified-fact.d.ts +109 -0
  42. package/dist/schemas/verified-fact.js +57 -0
  43. package/dist/schemas/verified-fact.js.map +1 -0
  44. package/dist/trierarch/crew-settings.js +1 -1
  45. package/dist/trierarch/report-details.js +2 -2
  46. package/package.json +1 -3
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ import { idSchema } from '../ids/index.js';
3
+ import { accountIdSchema } from './account-token.js';
4
+ /**
5
+ * A verified fact (decision 0059): what an actor checked about a ship, stored
6
+ * as its writer wrote it and shown beside the ship's statement in discovery,
7
+ * naming the writer. One fixed shape: what was checked, from a closed list,
8
+ * the value the check found, and the issuer only where a value means
9
+ * something under one. Core checks the shape and acts on none of it.
10
+ */
11
+ /**
12
+ * What a writer may have checked: the domain a client id document came from,
13
+ * the host a TLS certificate was valid for, the domain an A2A card came from,
14
+ * and the subject an OAuth issuer issued a credential to.
15
+ */
16
+ export const VERIFIED_CHECKS = ['clientIdDocumentDomain', 'tlsHost', 'a2aCardDomain', 'oauthSubject'];
17
+ export const verifiedCheckSchema = z.enum(VERIFIED_CHECKS);
18
+ /** The longest value a fact holds: a domain, a host or a subject. */
19
+ export const VERIFIED_FACT_VALUE_MAX_LENGTH = 255;
20
+ /** The longest issuer a fact names. */
21
+ export const VERIFIED_FACT_ISSUER_MAX_LENGTH = 2048;
22
+ /** The most facts one writer holds about one ship. */
23
+ export const VERIFIED_FACTS_MAX = 10;
24
+ const valueSchema = z.string().min(1).max(VERIFIED_FACT_VALUE_MAX_LENGTH);
25
+ /** One fact as its writer writes it: an OAuth subject with its issuer, every other check without one. */
26
+ export const verifiedFactSchema = z.discriminatedUnion('checked', [
27
+ z.strictObject({ checked: z.enum(['clientIdDocumentDomain', 'tlsHost', 'a2aCardDomain']), value: valueSchema }),
28
+ z.strictObject({ checked: z.literal('oauthSubject'), issuer: z.string().min(1).max(VERIFIED_FACT_ISSUER_MAX_LENGTH), value: valueSchema }),
29
+ ]);
30
+ /** The same fact twice is the same check, issuer and value. */
31
+ function factKey(fact) {
32
+ return JSON.stringify([fact.checked, 'issuer' in fact ? fact.issuer : null, fact.value]);
33
+ }
34
+ /**
35
+ * Input of `fleet.setVerifiedFacts` (fleet:verify): the ship written about
36
+ * and the caller's facts about it, whole, each fact once; none withdraws
37
+ * them.
38
+ */
39
+ export const setVerifiedFactsInputSchema = z.object({
40
+ shipId: idSchema('ship'),
41
+ facts: z
42
+ .array(verifiedFactSchema)
43
+ .max(VERIFIED_FACTS_MAX, `A writer holds at most ${String(VERIFIED_FACTS_MAX)} facts about a ship`)
44
+ .refine((facts) => new Set(facts.map(factKey)).size === facts.length, 'Each fact once'),
45
+ });
46
+ /** Output of `fleet.setVerifiedFacts`: nothing; the OK is the answer. */
47
+ export const setVerifiedFactsOutputSchema = z.strictObject({});
48
+ /** Who wrote a fact, as discovery names an actor (decision 0057): a ship by id and name, an account by its id only, or the installation. */
49
+ export const factWriterSchema = z.discriminatedUnion('kind', [
50
+ z.strictObject({ kind: z.literal('ship'), id: idSchema('ship'), name: z.string() }),
51
+ z.strictObject({ kind: z.literal('account'), id: accountIdSchema }),
52
+ z.strictObject({ kind: z.literal('installation') }),
53
+ ]);
54
+ /** A fact as discovery shows it: as written, with its writer and when it was written. */
55
+ const writtenBy = { by: factWriterSchema, at: z.iso.datetime() };
56
+ export const discoveredVerifiedFactSchema = z.discriminatedUnion('checked', [verifiedFactSchema.options[0].extend(writtenBy), verifiedFactSchema.options[1].extend(writtenBy)]);
57
+ //# sourceMappingURL=verified-fact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verified-fact.js","sourceRoot":"","sources":["../../src/schemas/verified-fact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;GAMG;AAEH;;;;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AC,CAAC,kBAAkB,CAAC,SAAS,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC"}
@@ -37,7 +37,7 @@ export const crewSettingsSchema = z.strictObject({
37
37
  options: z.record(z.string(), z.json()),
38
38
  /**
39
39
  * The label values a machine carries every one of for the request to go to
40
- * it (#102; docs/trierarch.md, "Machine labels"): exact matches, AND. A
40
+ * it (#102; aeolus-fleet-trierarch's docs/trierarch.md, "Machine labels"): exact matches, AND. A
41
41
  * machine carries at most 20, so no more can match. None: any machine.
42
42
  */
43
43
  machineLabels: z.array(idSchema('labelValue')).max(SHIP_LABELS_MAX).optional(),
@@ -9,7 +9,7 @@ export const MACHINE_ARCH = ['arm64', 'amd64'];
9
9
  /** Where a trierarch runs its sessions: on the host or each in a container of its own (decision 0039). */
10
10
  export const SESSION_RUNTIMES = ['host', 'container'];
11
11
  /**
12
- * The details of a trierarch's report (docs/trierarch.md, "What a trierarch
12
+ * The details of a trierarch's report (aeolus-fleet-trierarch's docs/trierarch.md, "What a trierarch
13
13
  * reports"; decision 0028): what its machine can do, read from its local
14
14
  * configuration and what runs. The trierarch plugin places crew requests
15
15
  * from them. No entry per ship: each crew request carries its own status.
@@ -48,7 +48,7 @@ export const trierarchReportDetailsSchema = z.strictObject({
48
48
  orphans: z.array(z.strictObject({ repository: worktreeFolderNameSchema, name: worktreeFolderNameSchema })),
49
49
  /**
50
50
  * The machine it runs on, for the trierarch plugin to label its ship by
51
- * (docs/trierarch.md, "Machine labels"): an os or arch outside the known
51
+ * (aeolus-fleet-trierarch's docs/trierarch.md, "Machine labels"): an os or arch outside the known
52
52
  * ones is left out. None from a trierarch before 0.20.0.
53
53
  */
54
54
  machine: z.strictObject({ os: z.enum(MACHINE_OS).optional(), arch: z.enum(MACHINE_ARCH).optional() }).optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeolus-fleet/common",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "Shared schemas and ids for Aeolus packages.",
5
5
  "keywords": [
6
6
  "aeolus"
@@ -18,12 +18,10 @@
18
18
  },
19
19
  "exports": {
20
20
  ".": {
21
- "@aeolus-fleet/source": "./src/index.ts",
22
21
  "types": "./dist/index.d.ts",
23
22
  "default": "./dist/index.js"
24
23
  },
25
24
  "./rules": {
26
- "@aeolus-fleet/source": "./src/rules/index.ts",
27
25
  "types": "./dist/rules/index.d.ts",
28
26
  "default": "./dist/rules/index.js"
29
27
  }