@common-agent/agentdoc 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/NOTICE +4 -0
- package/README.md +142 -2
- package/dist/assemble.d.ts +36 -0
- package/dist/assemble.js +951 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +9 -0
- package/dist/check.d.ts +14 -0
- package/dist/check.js +358 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.js +368 -0
- package/dist/descriptor.d.ts +21 -0
- package/dist/descriptor.js +114 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +17 -0
- package/dist/paths.d.ts +23 -0
- package/dist/paths.js +58 -0
- package/dist/render.d.ts +21 -0
- package/dist/render.js +405 -0
- package/dist/signatures.d.ts +41 -0
- package/dist/signatures.js +176 -0
- package/dist/types.d.ts +105 -0
- package/dist/types.js +26 -0
- package/dist/util.d.ts +35 -0
- package/dist/util.js +80 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/package.json +60 -4
- package/schema/agentdoc-v1.schema.json +200 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shapes this package reads and writes: the AgentDoc of Common Agent
|
|
3
|
+
* Section 9, what `assemble` is given, and what `check` reports.
|
|
4
|
+
*
|
|
5
|
+
* An AgentDoc is a view. Every section names the sources it was built from,
|
|
6
|
+
* and every member it could not fill is named in `not_stated`. The types are
|
|
7
|
+
* loose where the specification lets a source say more than this package
|
|
8
|
+
* reads: an unknown member is carried, never dropped.
|
|
9
|
+
*/
|
|
10
|
+
/** Whether a source's own signature was checked, and how it came out (Section 9.4). */
|
|
11
|
+
export type SignatureState = "verified" | "unsigned" | "failed" | "not_checked";
|
|
12
|
+
/** One thing the AgentDoc was built from (Section 9.4). */
|
|
13
|
+
export interface AgentDocSource {
|
|
14
|
+
id: string;
|
|
15
|
+
kind: string;
|
|
16
|
+
url?: string;
|
|
17
|
+
fetched_at?: string;
|
|
18
|
+
digest?: string;
|
|
19
|
+
signature?: SignatureState;
|
|
20
|
+
/** An observation's moment and what was done, in place of `url` (Section 9.4). */
|
|
21
|
+
at?: string;
|
|
22
|
+
what?: string;
|
|
23
|
+
/** The version a Descriptor or a package names, where it names one. */
|
|
24
|
+
agent_version?: string;
|
|
25
|
+
/** Where a projection disagrees with what it projects: reported, never merged (Section 9.4). */
|
|
26
|
+
disagreements?: string[];
|
|
27
|
+
[member: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
/** A section: the sources it came from, and the facts it carries. */
|
|
30
|
+
export interface AgentDocSection {
|
|
31
|
+
from: string[];
|
|
32
|
+
[member: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
/** The assembled view of one agent, or of one package (Sections 9.4 and 13.4). */
|
|
35
|
+
export interface AgentDoc {
|
|
36
|
+
agentdoc: "v1";
|
|
37
|
+
/** The agent described. Absent only in a package AgentDoc, which carries `package`. */
|
|
38
|
+
subject?: {
|
|
39
|
+
id: string;
|
|
40
|
+
handle?: string;
|
|
41
|
+
name?: string;
|
|
42
|
+
};
|
|
43
|
+
/** The package a package AgentDoc was assembled from (Section 13.4). */
|
|
44
|
+
package?: {
|
|
45
|
+
name?: string;
|
|
46
|
+
version?: string;
|
|
47
|
+
};
|
|
48
|
+
assembled_at?: string;
|
|
49
|
+
assembled_by?: string;
|
|
50
|
+
stale_after?: string;
|
|
51
|
+
sources: AgentDocSource[];
|
|
52
|
+
sections: Record<string, AgentDocSection>;
|
|
53
|
+
not_stated: string[];
|
|
54
|
+
signatures: unknown[];
|
|
55
|
+
[member: string]: unknown;
|
|
56
|
+
}
|
|
57
|
+
/** A JSON document handed in: parsed already, as its exact bytes, as its text, or (a string starting `http://` or `https://`) where to fetch it. */
|
|
58
|
+
export type DocumentInput = object | string | Uint8Array;
|
|
59
|
+
/** What `assemble` is given. Everything is optional; it assembles from what it has and names the rest. */
|
|
60
|
+
export interface AssembleInput {
|
|
61
|
+
/** The agent's address, such as `https://agent.example`. The card and the Descriptor are discovered from it. */
|
|
62
|
+
address?: string;
|
|
63
|
+
/** The A2A Agent Card, when it is already in hand. */
|
|
64
|
+
card?: DocumentInput;
|
|
65
|
+
/** The agent's Descriptor (Section 6), when it is not served at the address. */
|
|
66
|
+
descriptor?: DocumentInput;
|
|
67
|
+
/** Agent SoW standing proposals: the agent's signed terms. */
|
|
68
|
+
terms?: DocumentInput[];
|
|
69
|
+
/** Attestations other parties published about the agent. */
|
|
70
|
+
attestations?: object[];
|
|
71
|
+
/** Signed evaluation records (Section 8.4) about the agent. */
|
|
72
|
+
evalRecords?: object[];
|
|
73
|
+
/** The fetch to use. Defaults to the global fetch. */
|
|
74
|
+
fetch?: typeof fetch;
|
|
75
|
+
/** The moment of assembly. Defaults to now. */
|
|
76
|
+
now?: Date;
|
|
77
|
+
/**
|
|
78
|
+
* A package's manifest (`plugin.json`). With it, and the package's draft
|
|
79
|
+
* Descriptor in `descriptor`, assemble writes a package AgentDoc
|
|
80
|
+
* (Section 13.4) instead of one about a running agent.
|
|
81
|
+
*/
|
|
82
|
+
package?: DocumentInput;
|
|
83
|
+
/** Who assembled it, in words. Defaults to this package's name and version. */
|
|
84
|
+
assembledBy?: string;
|
|
85
|
+
}
|
|
86
|
+
/** The fourteen checks of Section 9.10, by the ids every Common Agent checker shares. */
|
|
87
|
+
export declare const RULE_IDS: readonly ["sources-exist", "section-has-source", "source-digest", "fact-in-source", "no-summary-grade", "visibility-supports-claim", "decided-by-rule", "sells-scope", "open-offering-members", "open-ended-no-claim", "assembled-at", "fetched-at", "not-stated-complete", "no-default"];
|
|
88
|
+
export type RuleId = (typeof RULE_IDS)[number];
|
|
89
|
+
/** One problem `check` found: the rule, where, and what, in words. */
|
|
90
|
+
export interface Finding {
|
|
91
|
+
rule: RuleId;
|
|
92
|
+
path: string;
|
|
93
|
+
message: string;
|
|
94
|
+
level: "fail" | "warn";
|
|
95
|
+
}
|
|
96
|
+
/** What `check` reports. `ok` is true when no finding has level `fail`. */
|
|
97
|
+
export interface CheckReport {
|
|
98
|
+
ok: boolean;
|
|
99
|
+
findings: Finding[];
|
|
100
|
+
}
|
|
101
|
+
/** How `check` runs. With `fetchSources`, it fetches each source to check its digest and the facts taken from it. */
|
|
102
|
+
export interface CheckOptions {
|
|
103
|
+
fetch?: typeof fetch;
|
|
104
|
+
fetchSources?: boolean;
|
|
105
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shapes this package reads and writes: the AgentDoc of Common Agent
|
|
3
|
+
* Section 9, what `assemble` is given, and what `check` reports.
|
|
4
|
+
*
|
|
5
|
+
* An AgentDoc is a view. Every section names the sources it was built from,
|
|
6
|
+
* and every member it could not fill is named in `not_stated`. The types are
|
|
7
|
+
* loose where the specification lets a source say more than this package
|
|
8
|
+
* reads: an unknown member is carried, never dropped.
|
|
9
|
+
*/
|
|
10
|
+
/** The fourteen checks of Section 9.10, by the ids every Common Agent checker shares. */
|
|
11
|
+
export const RULE_IDS = [
|
|
12
|
+
"sources-exist",
|
|
13
|
+
"section-has-source",
|
|
14
|
+
"source-digest",
|
|
15
|
+
"fact-in-source",
|
|
16
|
+
"no-summary-grade",
|
|
17
|
+
"visibility-supports-claim",
|
|
18
|
+
"decided-by-rule",
|
|
19
|
+
"sells-scope",
|
|
20
|
+
"open-offering-members",
|
|
21
|
+
"open-ended-no-claim",
|
|
22
|
+
"assembled-at",
|
|
23
|
+
"fetched-at",
|
|
24
|
+
"not-stated-complete",
|
|
25
|
+
"no-default",
|
|
26
|
+
];
|
package/dist/util.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { DocumentInput } from "./types.js";
|
|
2
|
+
export type Rec = Record<string, unknown>;
|
|
3
|
+
export declare const isObj: (v: unknown) => v is Rec;
|
|
4
|
+
export declare const str: (v: unknown) => string;
|
|
5
|
+
/** A non-empty trimmed string, or undefined. */
|
|
6
|
+
export declare const text: (v: unknown) => string | undefined;
|
|
7
|
+
export declare const arr: <T = Rec>(v: unknown) => T[];
|
|
8
|
+
export declare const unique: <T>(xs: T[]) => T[];
|
|
9
|
+
/** A moment as the AgentDoc spells it: UTC, to the second. */
|
|
10
|
+
export declare const isoSecond: (d: Date) => string;
|
|
11
|
+
/** Whether a string is an address to fetch rather than JSON text. */
|
|
12
|
+
export declare const isUrl: (s: string) => boolean;
|
|
13
|
+
/** A JSON document as read: its value, its exact bytes where they are known, where it came from, and its digest. */
|
|
14
|
+
export interface Loaded {
|
|
15
|
+
value: unknown;
|
|
16
|
+
bytes?: Uint8Array;
|
|
17
|
+
url?: string;
|
|
18
|
+
digest: string;
|
|
19
|
+
fetchedAt: string;
|
|
20
|
+
}
|
|
21
|
+
/** Why a document could not be read, in plain words. */
|
|
22
|
+
export declare class ReadError extends Error {
|
|
23
|
+
readonly status?: number | undefined;
|
|
24
|
+
constructor(message: string, status?: number | undefined);
|
|
25
|
+
}
|
|
26
|
+
/** Parse bytes as one JSON document, or throw a ReadError that says why. */
|
|
27
|
+
export declare function parseBytes(bytes: Uint8Array, where: string): unknown;
|
|
28
|
+
/** The digest of a loaded document: over its exact bytes where they are known, over its canonical JSON otherwise. */
|
|
29
|
+
export declare function digestOf(value: unknown, bytes?: Uint8Array): string;
|
|
30
|
+
/** Fetch a JSON document and keep its exact bytes. A 404 is a ReadError with status 404. */
|
|
31
|
+
export declare function fetchJson(f: typeof fetch, url: string, now: string): Promise<Loaded>;
|
|
32
|
+
/** Read a document handed in any of the accepted forms. A URL is fetched. */
|
|
33
|
+
export declare function load(input: DocumentInput, f: typeof fetch, now: string, what: string): Promise<Loaded>;
|
|
34
|
+
/** A list joined for a sentence: "a", "a and b", "a, b and c". */
|
|
35
|
+
export declare function joinWords(xs: string[]): string;
|
package/dist/util.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small helpers the rest of the package shares: reading loose JSON safely,
|
|
3
|
+
* the one spelling of a time and a digest, and fetching a JSON document with
|
|
4
|
+
* its exact bytes.
|
|
5
|
+
*/
|
|
6
|
+
import { canonicalJSON, sha256Digest } from "@common-agent/crypto";
|
|
7
|
+
export const isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
8
|
+
export const str = (v) => (typeof v === "string" ? v : "");
|
|
9
|
+
/** A non-empty trimmed string, or undefined. */
|
|
10
|
+
export const text = (v) => (typeof v === "string" && v.trim() ? v.trim() : undefined);
|
|
11
|
+
export const arr = (v) => (Array.isArray(v) ? v : []);
|
|
12
|
+
export const unique = (xs) => [...new Set(xs)];
|
|
13
|
+
/** A moment as the AgentDoc spells it: UTC, to the second. */
|
|
14
|
+
export const isoSecond = (d) => d.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
15
|
+
/** Whether a string is an address to fetch rather than JSON text. */
|
|
16
|
+
export const isUrl = (s) => /^https?:\/\//i.test(s.trim());
|
|
17
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
18
|
+
/** Why a document could not be read, in plain words. */
|
|
19
|
+
export class ReadError extends Error {
|
|
20
|
+
status;
|
|
21
|
+
constructor(message, status) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.status = status;
|
|
24
|
+
this.name = "ReadError";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Parse bytes as one JSON document, or throw a ReadError that says why. */
|
|
28
|
+
export function parseBytes(bytes, where) {
|
|
29
|
+
let textValue;
|
|
30
|
+
try {
|
|
31
|
+
textValue = decoder.decode(bytes);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
throw new ReadError(`${where} is not UTF-8 text`);
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
return JSON.parse(textValue.replace(/^/, ""));
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
throw new ReadError(`${where} is not valid JSON: ${e.message}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** The digest of a loaded document: over its exact bytes where they are known, over its canonical JSON otherwise. */
|
|
44
|
+
export function digestOf(value, bytes) {
|
|
45
|
+
return bytes ? sha256Digest(bytes) : sha256Digest(canonicalJSON(value));
|
|
46
|
+
}
|
|
47
|
+
/** Fetch a JSON document and keep its exact bytes. A 404 is a ReadError with status 404. */
|
|
48
|
+
export async function fetchJson(f, url, now) {
|
|
49
|
+
let res;
|
|
50
|
+
try {
|
|
51
|
+
res = await f(url, { headers: { accept: "application/json" }, redirect: "follow", signal: AbortSignal.timeout(15000) });
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
throw new ReadError(`could not reach ${url}: ${e.message}`);
|
|
55
|
+
}
|
|
56
|
+
if (!res.ok)
|
|
57
|
+
throw new ReadError(`${url} answered ${res.status}`, res.status);
|
|
58
|
+
const bytes = new Uint8Array(await res.arrayBuffer());
|
|
59
|
+
const value = parseBytes(bytes, url);
|
|
60
|
+
return { value, bytes, url, digest: sha256Digest(bytes), fetchedAt: now };
|
|
61
|
+
}
|
|
62
|
+
/** Read a document handed in any of the accepted forms. A URL is fetched. */
|
|
63
|
+
export async function load(input, f, now, what) {
|
|
64
|
+
if (typeof input === "string") {
|
|
65
|
+
if (isUrl(input))
|
|
66
|
+
return fetchJson(f, input.trim(), now);
|
|
67
|
+
const bytes = new TextEncoder().encode(input);
|
|
68
|
+
return { value: parseBytes(bytes, what), bytes, digest: sha256Digest(bytes), fetchedAt: now };
|
|
69
|
+
}
|
|
70
|
+
if (input instanceof Uint8Array) {
|
|
71
|
+
return { value: parseBytes(input, what), bytes: input, digest: sha256Digest(input), fetchedAt: now };
|
|
72
|
+
}
|
|
73
|
+
return { value: input, digest: digestOf(input), fetchedAt: now };
|
|
74
|
+
}
|
|
75
|
+
/** A list joined for a sentence: "a", "a and b", "a, b and c". */
|
|
76
|
+
export function joinWords(xs) {
|
|
77
|
+
if (xs.length <= 1)
|
|
78
|
+
return xs.join("");
|
|
79
|
+
return `${xs.slice(0, -1).join(", ")} and ${xs[xs.length - 1]}`;
|
|
80
|
+
}
|
package/dist/version.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-agent/agentdoc",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Make, publish and check an AgentDoc: one document that says what an agent is, what it offers and what it refuses, assembled from its A2A card and signed Descriptor, with a small command line tool.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"common-agent",
|
|
7
|
+
"agentdoc",
|
|
8
|
+
"a2a",
|
|
9
|
+
"agent-card",
|
|
10
|
+
"agent-descriptor"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://agentdoc.net",
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/CommonAgent/common-agent-ts.git",
|
|
17
|
+
"directory": "packages/agentdoc"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/CommonAgent/common-agent-ts/issues"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"default": "./dist/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./cli": {
|
|
29
|
+
"types": "./dist/cli.d.ts",
|
|
30
|
+
"default": "./dist/cli.js"
|
|
31
|
+
},
|
|
32
|
+
"./schema/agentdoc-v1.schema.json": "./schema/agentdoc-v1.schema.json",
|
|
33
|
+
"./package.json": "./package.json"
|
|
34
|
+
},
|
|
35
|
+
"bin": {
|
|
36
|
+
"common-agent-doc": "./dist/bin.js"
|
|
37
|
+
},
|
|
38
|
+
"main": "./dist/index.js",
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"schema",
|
|
43
|
+
"README.md",
|
|
44
|
+
"LICENSE",
|
|
45
|
+
"NOTICE"
|
|
46
|
+
],
|
|
47
|
+
"sideEffects": [
|
|
48
|
+
"./dist/bin.js"
|
|
49
|
+
],
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=20.10"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@common-agent/crypto": "0.1.0"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsc -p tsconfig.json"
|
|
58
|
+
},
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://agentdoc.net/schema/agentdoc-v1.json",
|
|
4
|
+
"title": "AgentDoc v1",
|
|
5
|
+
"description": "The assembled view of an agent (Common Agent Specification, Chapter 9), or of a package before any agent exists (Section 13.4). This schema checks the document's shape. The rules that need more than a shape, such as every section citing listed sources and silence being named in not_stated, are the checks of Section 9.10, which @common-agent/agentdoc runs.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["agentdoc", "sources", "sections", "not_stated"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"agentdoc": { "const": "v1" },
|
|
10
|
+
"subject": {
|
|
11
|
+
"description": "The agent described. id is its stable identifier, normally its public key, and is never absent (Section 9.4).",
|
|
12
|
+
"type": "object",
|
|
13
|
+
"required": ["id"],
|
|
14
|
+
"properties": {
|
|
15
|
+
"id": { "type": "string", "minLength": 1 },
|
|
16
|
+
"handle": { "type": "string" },
|
|
17
|
+
"name": { "type": "string" }
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"package": {
|
|
21
|
+
"description": "The package a package AgentDoc was assembled from, in place of subject (Section 13.4).",
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {
|
|
24
|
+
"name": { "type": "string" },
|
|
25
|
+
"version": { "type": "string" }
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"assembled_at": { "$ref": "#/$defs/time" },
|
|
29
|
+
"assembled_by": { "type": "string" },
|
|
30
|
+
"stale_after": { "$ref": "#/$defs/time" },
|
|
31
|
+
"sources": { "type": "array", "items": { "$ref": "#/$defs/source" } },
|
|
32
|
+
"sections": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"properties": {
|
|
35
|
+
"identity": { "$ref": "#/$defs/identity" },
|
|
36
|
+
"shape": { "$ref": "#/$defs/shape" },
|
|
37
|
+
"asked": { "$ref": "#/$defs/asked" },
|
|
38
|
+
"role": { "$ref": "#/$defs/section" },
|
|
39
|
+
"sells": { "$ref": "#/$defs/sells" },
|
|
40
|
+
"access": { "$ref": "#/$defs/access" },
|
|
41
|
+
"refuses": { "$ref": "#/$defs/refuses" },
|
|
42
|
+
"reaches": { "$ref": "#/$defs/section" },
|
|
43
|
+
"leaves": { "$ref": "#/$defs/section" },
|
|
44
|
+
"configs": { "$ref": "#/$defs/section" },
|
|
45
|
+
"triggers": { "$ref": "#/$defs/section" },
|
|
46
|
+
"handling": { "$ref": "#/$defs/section" },
|
|
47
|
+
"standing": { "$ref": "#/$defs/section" }
|
|
48
|
+
},
|
|
49
|
+
"additionalProperties": { "$ref": "#/$defs/section" }
|
|
50
|
+
},
|
|
51
|
+
"not_stated": {
|
|
52
|
+
"description": "The section and member paths no source says anything about (Section 9.5).",
|
|
53
|
+
"type": "array",
|
|
54
|
+
"items": { "type": "string", "minLength": 1 }
|
|
55
|
+
},
|
|
56
|
+
"signatures": {
|
|
57
|
+
"description": "The assembler's own signatures, agentdoc-assembly-v1 (Section 9.11). An entry with a tag a reader does not know is skipped.",
|
|
58
|
+
"type": "array",
|
|
59
|
+
"items": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"required": ["tag"],
|
|
62
|
+
"properties": {
|
|
63
|
+
"tag": { "type": "string" },
|
|
64
|
+
"by": { "type": "string" },
|
|
65
|
+
"sig": { "type": "string" }
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"oneOf": [
|
|
71
|
+
{ "required": ["subject"], "not": { "required": ["package"] } },
|
|
72
|
+
{ "required": ["package"], "not": { "required": ["subject"] } }
|
|
73
|
+
],
|
|
74
|
+
"$defs": {
|
|
75
|
+
"time": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$" },
|
|
76
|
+
"digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
|
|
77
|
+
"signatureState": { "enum": ["verified", "unsigned", "failed", "not_checked"] },
|
|
78
|
+
"state": { "enum": ["declared", "confirmed", "failed"] },
|
|
79
|
+
"source": {
|
|
80
|
+
"description": "One thing the AgentDoc was built from (Section 9.4). An observation carries at and what in place of url.",
|
|
81
|
+
"type": "object",
|
|
82
|
+
"required": ["id", "kind"],
|
|
83
|
+
"properties": {
|
|
84
|
+
"id": { "type": "string", "minLength": 1 },
|
|
85
|
+
"kind": { "type": "string", "minLength": 1 },
|
|
86
|
+
"url": { "type": "string" },
|
|
87
|
+
"fetched_at": { "$ref": "#/$defs/time" },
|
|
88
|
+
"digest": { "type": "string" },
|
|
89
|
+
"signature": { "$ref": "#/$defs/signatureState" },
|
|
90
|
+
"at": { "$ref": "#/$defs/time" },
|
|
91
|
+
"what": { "type": "string" },
|
|
92
|
+
"agent_version": { "type": "string" },
|
|
93
|
+
"disagreements": { "type": "array", "items": { "type": "string" } }
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"section": {
|
|
97
|
+
"description": "Every section names the sources it was assembled from (Section 9.3).",
|
|
98
|
+
"type": "object",
|
|
99
|
+
"required": ["from"],
|
|
100
|
+
"properties": {
|
|
101
|
+
"from": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 } }
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"identity": {
|
|
105
|
+
"allOf": [{ "$ref": "#/$defs/section" }],
|
|
106
|
+
"properties": {
|
|
107
|
+
"name": { "type": "string" },
|
|
108
|
+
"description": { "type": "string" },
|
|
109
|
+
"operator": { "type": "string" },
|
|
110
|
+
"acts_for": { "enum": ["person", "organization", "anyone"] },
|
|
111
|
+
"organization_name": { "type": "string" },
|
|
112
|
+
"fleet": { "type": "boolean" }
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"shape": {
|
|
116
|
+
"allOf": [{ "$ref": "#/$defs/section" }],
|
|
117
|
+
"properties": {
|
|
118
|
+
"interaction": { "enum": ["interactive", "service"] },
|
|
119
|
+
"visibility": { "enum": ["verifiable", "observed", "opaque"] }
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"asked": {
|
|
123
|
+
"allOf": [{ "$ref": "#/$defs/section" }],
|
|
124
|
+
"properties": {
|
|
125
|
+
"interfaces": {
|
|
126
|
+
"type": "array",
|
|
127
|
+
"items": {
|
|
128
|
+
"type": "object",
|
|
129
|
+
"required": ["name"],
|
|
130
|
+
"properties": {
|
|
131
|
+
"name": { "type": "string" },
|
|
132
|
+
"exchanges": {
|
|
133
|
+
"type": "array",
|
|
134
|
+
"items": {
|
|
135
|
+
"type": "object",
|
|
136
|
+
"properties": { "state": { "$ref": "#/$defs/state" } }
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"offering": {
|
|
145
|
+
"type": "object",
|
|
146
|
+
"required": ["scope"],
|
|
147
|
+
"properties": {
|
|
148
|
+
"id": { "type": "string" },
|
|
149
|
+
"name": { "type": "string" },
|
|
150
|
+
"does": { "type": "string" },
|
|
151
|
+
"scope": { "type": "string", "minLength": 1 },
|
|
152
|
+
"focus": { "enum": ["software", "documents", "data", "research", "operations"] },
|
|
153
|
+
"inputs": { "type": "array" },
|
|
154
|
+
"outputs": { "type": "array" },
|
|
155
|
+
"workspace": { "type": "array" },
|
|
156
|
+
"authority": { "type": "array", "items": { "type": "string" } },
|
|
157
|
+
"authority_decided_by": { "enum": ["rule", "model"] },
|
|
158
|
+
"ceilings": {
|
|
159
|
+
"type": "object",
|
|
160
|
+
"additionalProperties": {
|
|
161
|
+
"type": "object",
|
|
162
|
+
"required": ["most"],
|
|
163
|
+
"properties": { "decided_by": { "enum": ["rule", "model"] } }
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"steps": { "type": "array" },
|
|
167
|
+
"trial": {
|
|
168
|
+
"type": "object",
|
|
169
|
+
"required": ["offered"],
|
|
170
|
+
"properties": { "offered": { "type": "boolean" } }
|
|
171
|
+
},
|
|
172
|
+
"state": { "$ref": "#/$defs/state" }
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
"sells": {
|
|
176
|
+
"allOf": [{ "$ref": "#/$defs/section" }],
|
|
177
|
+
"properties": {
|
|
178
|
+
"scopes": { "type": "array", "items": { "type": "string" } },
|
|
179
|
+
"offerings": { "type": "array", "items": { "$ref": "#/$defs/offering" } }
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"access": {
|
|
183
|
+
"allOf": [{ "$ref": "#/$defs/section" }],
|
|
184
|
+
"properties": {
|
|
185
|
+
"address": { "type": "string" },
|
|
186
|
+
"protocol": { "type": "string" },
|
|
187
|
+
"schemes": { "type": "array", "items": { "type": "object" } },
|
|
188
|
+
"admission": { "type": "string" }
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"refuses": {
|
|
192
|
+
"allOf": [{ "$ref": "#/$defs/section" }],
|
|
193
|
+
"properties": {
|
|
194
|
+
"statement": { "type": "string" },
|
|
195
|
+
"kind": { "enum": ["prose", "clause", "role"] },
|
|
196
|
+
"hands_over": { "type": "array", "items": { "type": "string" } }
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|