@agentproto/corpus-cli 0.10.1 → 0.10.2
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/specs/resources/aip-14/draft/TOOL.schema.json +1 -1
- package/dist/specs/resources/aip-15/draft/WORKFLOW.schema.json +47 -52
- package/dist/specs/resources/aip-18/draft/COLLECTION.schema.json +128 -7
- package/dist/specs/resources/aip-36/draft/SANDBOX.schema.json +13 -0
- package/dist/specs/resources/aip-41/draft/ROUTINE.schema.json +21 -2
- package/dist/specs/resources/aip-42/draft/AGENT.schema.json +1 -1
- package/dist/specs/resources/aip-47/draft/ROLE.schema.json +1 -1
- package/dist/specs/resources/aip-49/draft/ASSET.schema.json +232 -0
- package/dist/specs/resources/aip-50/draft/AUTH.schema.json +114 -0
- package/dist/specs/resources/aip-53/draft/APP.schema.json +211 -0
- package/dist/specs/resources/aip-54/draft/REF.schema.json +1 -1
- package/dist/specs/resources/aip-54/draft/WS-REF.schema.json +46 -0
- package/dist/specs/resources/aip-55/draft/PRODUCT.schema.json +172 -38
- package/dist/specs/resources/aip-58/draft/vectors/v8-heuristic-not-suspend.json +1 -1
- package/dist/specs/resources/aip-62/draft/ATTESTATION.schema.json +184 -0
- package/dist/specs/resources/aip-62/draft/REVIEW-PACK.schema.json +70 -0
- package/dist/specs/resources/aip-62/draft/REVIEW.schema.json +180 -0
- package/dist/specs/resources/aip-7/draft/GOVERNANCE.schema.json +147 -1
- package/dist/specs/resources/{aip-52/draft → pending/harness}/HARNESS.schema.json +1 -1
- package/package.json +3 -3
- package/dist/specs/resources/aip-52/draft/ADAPTER.md +0 -193
- package/dist/specs/resources/aip-54/draft/REF.md +0 -89
- package/dist/specs/resources/aip-55/draft/PRODUCT.md +0 -143
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://agentproto.sh/schemas/aip-62/REVIEW.schema.json",
|
|
4
|
+
"title": "REVIEW.md frontmatter (kind: review)",
|
|
5
|
+
"description": "The YAML frontmatter of a REVIEW.md review manifest, parsed to JSON. Field shapes only: the cross-field rules (unique ids, binding references, prepare/effects rules, implied default binding, explicit bindings when uses[] is present) are normative in AIP-62 and are enforced by the parser, not by this schema. Unknown keys are errors at every level.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["kind", "id", "target", "checks"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"kind": { "const": "review" },
|
|
11
|
+
"id": { "$ref": "#/$defs/id" },
|
|
12
|
+
"name": { "type": "string" },
|
|
13
|
+
"description": { "type": "string" },
|
|
14
|
+
"target": {
|
|
15
|
+
"description": "What is reviewed. v1 supports only a git range. The string form \"git-range\" is shorthand for { kind: git-range } with the default base (origin/main). The reviewed range is merge-base(base, HEAD)..HEAD.",
|
|
16
|
+
"oneOf": [
|
|
17
|
+
{ "const": "git-range" },
|
|
18
|
+
{
|
|
19
|
+
"type": "object",
|
|
20
|
+
"additionalProperties": false,
|
|
21
|
+
"required": ["kind"],
|
|
22
|
+
"properties": {
|
|
23
|
+
"kind": { "const": "git-range" },
|
|
24
|
+
"base": { "type": "string", "minLength": 1, "default": "origin/main" }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"checks": {
|
|
30
|
+
"type": "array",
|
|
31
|
+
"minItems": 1,
|
|
32
|
+
"items": {
|
|
33
|
+
"oneOf": [
|
|
34
|
+
{ "$ref": "#/$defs/commandCheck" },
|
|
35
|
+
{ "$ref": "#/$defs/agentCheck" }
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"bindings": {
|
|
40
|
+
"description": "Named lane selections, keyed by binding id. When absent, an implied `default` binding over every non-effects check applies. When `uses` is present, explicit bindings are required.",
|
|
41
|
+
"type": "object",
|
|
42
|
+
"propertyNames": { "$ref": "#/$defs/id" },
|
|
43
|
+
"additionalProperties": { "$ref": "#/$defs/binding" }
|
|
44
|
+
},
|
|
45
|
+
"uses": {
|
|
46
|
+
"type": "array",
|
|
47
|
+
"items": { "$ref": "#/$defs/use" }
|
|
48
|
+
},
|
|
49
|
+
"verdict": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"additionalProperties": false,
|
|
52
|
+
"properties": {
|
|
53
|
+
"exportDir": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"minLength": 1,
|
|
56
|
+
"description": "Repo-relative directory attestation exports are written to and `verify` reads from."
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"$defs": {
|
|
62
|
+
"id": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"pattern": "^[a-z][a-z0-9-]*$",
|
|
65
|
+
"maxLength": 64
|
|
66
|
+
},
|
|
67
|
+
"checkRef": {
|
|
68
|
+
"description": "A local check id, or `<as>/<id>` for a check contributed by a uses[] pack.",
|
|
69
|
+
"type": "string",
|
|
70
|
+
"pattern": "^[a-z][a-z0-9-]*(?:/[a-z][a-z0-9-]*)?$",
|
|
71
|
+
"maxLength": 129
|
|
72
|
+
},
|
|
73
|
+
"severity": { "enum": ["high", "medium", "low"] },
|
|
74
|
+
"commandCheck": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"additionalProperties": false,
|
|
77
|
+
"required": ["id", "kind", "run"],
|
|
78
|
+
"properties": {
|
|
79
|
+
"id": { "$ref": "#/$defs/id" },
|
|
80
|
+
"kind": { "const": "command" },
|
|
81
|
+
"description": { "type": "string" },
|
|
82
|
+
"run": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"minLength": 1,
|
|
85
|
+
"description": "Executed as `sh -c`. May contain {base}, {head}, {changed} placeholders; {{name}} escapes a literal {name}."
|
|
86
|
+
},
|
|
87
|
+
"cwd": { "type": "string", "description": "Relative to the repo root." },
|
|
88
|
+
"blocking": { "type": "boolean", "default": true },
|
|
89
|
+
"timeoutMs": { "type": "integer", "exclusiveMinimum": 0, "default": 600000 },
|
|
90
|
+
"effects": {
|
|
91
|
+
"type": "boolean",
|
|
92
|
+
"default": false,
|
|
93
|
+
"description": "true marks a prepare-only check that mutates the working tree. It MUST appear only in a binding's `prepare`."
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"agentCheck": {
|
|
98
|
+
"type": "object",
|
|
99
|
+
"additionalProperties": false,
|
|
100
|
+
"required": ["id", "kind", "preset", "rubric"],
|
|
101
|
+
"properties": {
|
|
102
|
+
"id": { "$ref": "#/$defs/id" },
|
|
103
|
+
"kind": { "const": "agent" },
|
|
104
|
+
"description": { "type": "string" },
|
|
105
|
+
"preset": { "type": "string", "minLength": 1 },
|
|
106
|
+
"rubric": {
|
|
107
|
+
"type": "string",
|
|
108
|
+
"minLength": 1,
|
|
109
|
+
"description": "Path relative to the directory containing REVIEW.md."
|
|
110
|
+
},
|
|
111
|
+
"blockOn": { "$ref": "#/$defs/severity", "default": "high" },
|
|
112
|
+
"blocking": { "type": "boolean", "default": true },
|
|
113
|
+
"timeoutMs": { "type": "integer", "exclusiveMinimum": 0, "default": 900000 },
|
|
114
|
+
"effects": {
|
|
115
|
+
"const": false,
|
|
116
|
+
"description": "An agent check is always a read-only reviewer; effects: true is an error."
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"binding": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"additionalProperties": false,
|
|
123
|
+
"required": ["checks"],
|
|
124
|
+
"properties": {
|
|
125
|
+
"on": {
|
|
126
|
+
"type": "string",
|
|
127
|
+
"description": "Informational label (e.g. pre-push, pr). Nothing dispatches on it."
|
|
128
|
+
},
|
|
129
|
+
"prepare": {
|
|
130
|
+
"type": "array",
|
|
131
|
+
"items": { "$ref": "#/$defs/checkRef" },
|
|
132
|
+
"description": "effects: true command checks, run in order before the range freezes."
|
|
133
|
+
},
|
|
134
|
+
"checks": {
|
|
135
|
+
"type": "array",
|
|
136
|
+
"minItems": 1,
|
|
137
|
+
"items": { "$ref": "#/$defs/checkRef" }
|
|
138
|
+
},
|
|
139
|
+
"quorum": { "const": "all-blocking-pass", "default": "all-blocking-pass" }
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"use": {
|
|
143
|
+
"type": "object",
|
|
144
|
+
"additionalProperties": false,
|
|
145
|
+
"required": ["pack", "as"],
|
|
146
|
+
"properties": {
|
|
147
|
+
"pack": {
|
|
148
|
+
"type": "string",
|
|
149
|
+
"description": "An npm package name, a relative path (./ or ../), an absolute path, or `git+https://<url>#<40-hex-sha>`. Other git+ schemes are not allowed and a git ref MUST be pinned to a full commit sha.",
|
|
150
|
+
"pattern": "^(?!git\\+)\\S+$|^git\\+https://[^\\s#]+#[0-9a-f]{40}$"
|
|
151
|
+
},
|
|
152
|
+
"as": {
|
|
153
|
+
"$ref": "#/$defs/id",
|
|
154
|
+
"description": "Namespace: the pack's check `<id>` becomes `<as>/<id>` in this manifest."
|
|
155
|
+
},
|
|
156
|
+
"checks": {
|
|
157
|
+
"type": "array",
|
|
158
|
+
"items": { "$ref": "#/$defs/id" },
|
|
159
|
+
"description": "Subset of the pack's check ids to import. Default: all."
|
|
160
|
+
},
|
|
161
|
+
"preset": { "type": "string", "minLength": 1 },
|
|
162
|
+
"overrides": {
|
|
163
|
+
"type": "object",
|
|
164
|
+
"propertyNames": { "$ref": "#/$defs/id" },
|
|
165
|
+
"additionalProperties": {
|
|
166
|
+
"type": "object",
|
|
167
|
+
"additionalProperties": false,
|
|
168
|
+
"properties": {
|
|
169
|
+
"blockOn": { "$ref": "#/$defs/severity" },
|
|
170
|
+
"blocking": { "type": "boolean" },
|
|
171
|
+
"timeoutMs": { "type": "integer", "exclusiveMinimum": 0 },
|
|
172
|
+
"preset": { "type": "string", "minLength": 1 }
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"allowCommands": { "type": "boolean", "default": false }
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://agentproto.sh/schemas/aip-7/GOVERNANCE.schema.json",
|
|
4
4
|
"title": "agentgovernance/v1 (AIP-7)",
|
|
5
|
-
"description": "Validates the
|
|
5
|
+
"description": "Validates the five AIP-7 doctypes: signature (approval event), audit-event (append-only log line), policy (declarative autonomy rule), approval-request (pending human decision over a pinned payload), and governance.workspace/v1 (workspace manifest, root or view). Branch on the `doctype` (or for the workspace, the `schema`) field.",
|
|
6
6
|
"oneOf": [
|
|
7
7
|
{ "$ref": "#/$defs/signature" },
|
|
8
8
|
{ "$ref": "#/$defs/auditEvent" },
|
|
9
9
|
{ "$ref": "#/$defs/policy" },
|
|
10
|
+
{ "$ref": "#/$defs/approvalRequest" },
|
|
10
11
|
{ "$ref": "#/$defs/workspace" }
|
|
11
12
|
],
|
|
12
13
|
"$defs": {
|
|
@@ -112,7 +113,38 @@
|
|
|
112
113
|
"maxLength": 4000,
|
|
113
114
|
"description": "Required when decision is 'reject'. Recommended for 'approve' in multi-signer flows."
|
|
114
115
|
},
|
|
116
|
+
"documentHash": {
|
|
117
|
+
"type": "string",
|
|
118
|
+
"pattern": "^[0-9a-f]{64}$",
|
|
119
|
+
"description": "Lowercase hex SHA-256 of the artifact's bytes at signing time. For a signature that resolves an approval-request, MUST equal that request's payloadHash."
|
|
120
|
+
},
|
|
115
121
|
"signer": { "$ref": "#/$defs/signer" },
|
|
122
|
+
"signerKind": {
|
|
123
|
+
"enum": ["operator", "user", "counterparty", "agent", "external"],
|
|
124
|
+
"description": "What kind of principal signed. An approve that resolves an approval-request MUST carry 'user'."
|
|
125
|
+
},
|
|
126
|
+
"method": {
|
|
127
|
+
"enum": ["typed_name", "agent_confirm", "click_through", "esign_external"],
|
|
128
|
+
"description": "How the signature was produced. An approve that resolves an approval-request MUST carry 'click_through'."
|
|
129
|
+
},
|
|
130
|
+
"evidence": {
|
|
131
|
+
"type": "object",
|
|
132
|
+
"required": ["kind"],
|
|
133
|
+
"additionalProperties": true,
|
|
134
|
+
"properties": {
|
|
135
|
+
"kind": {
|
|
136
|
+
"enum": ["typed_name", "agent_confirm", "click_through", "esign_external"],
|
|
137
|
+
"description": "MUST equal `method` when both are present."
|
|
138
|
+
},
|
|
139
|
+
"ipAddress": { "type": "string" },
|
|
140
|
+
"userAgent": { "type": "string" },
|
|
141
|
+
"signedUrlToken": {
|
|
142
|
+
"type": "string",
|
|
143
|
+
"description": "click_through: a value unique to this decision. For a ui_card decision, the hash of the one-time ticket, never the ticket."
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"description": "Method-specific evidence. Shape shown is for click_through; other methods define their own members."
|
|
147
|
+
},
|
|
116
148
|
"signedAt": { "$ref": "#/$defs/isoDateTime" },
|
|
117
149
|
"policy": { "$ref": "#/$defs/policyRef" },
|
|
118
150
|
"signature": { "$ref": "#/$defs/signatureBlock" },
|
|
@@ -129,6 +161,120 @@
|
|
|
129
161
|
}
|
|
130
162
|
]
|
|
131
163
|
},
|
|
164
|
+
"approvalRequest": {
|
|
165
|
+
"type": "object",
|
|
166
|
+
"title": "approval-request (pending human decision over a pinned payload)",
|
|
167
|
+
"required": [
|
|
168
|
+
"$schema",
|
|
169
|
+
"doctype",
|
|
170
|
+
"id",
|
|
171
|
+
"kind",
|
|
172
|
+
"title",
|
|
173
|
+
"payloadHash",
|
|
174
|
+
"status",
|
|
175
|
+
"requestedBy",
|
|
176
|
+
"channels",
|
|
177
|
+
"requestedAt"
|
|
178
|
+
],
|
|
179
|
+
"additionalProperties": false,
|
|
180
|
+
"properties": {
|
|
181
|
+
"$schema": { "$ref": "#/$defs/schemaTag" },
|
|
182
|
+
"doctype": { "const": "approval-request" },
|
|
183
|
+
"id": {
|
|
184
|
+
"type": "string",
|
|
185
|
+
"minLength": 1,
|
|
186
|
+
"maxLength": 128,
|
|
187
|
+
"pattern": "^[A-Za-z0-9_-]+$",
|
|
188
|
+
"description": "Opaque unique identifier, stable for the life of the request."
|
|
189
|
+
},
|
|
190
|
+
"kind": {
|
|
191
|
+
"type": "string",
|
|
192
|
+
"minLength": 1,
|
|
193
|
+
"maxLength": 128,
|
|
194
|
+
"description": "Free-form class of the thing being approved."
|
|
195
|
+
},
|
|
196
|
+
"title": { "type": "string", "minLength": 1, "maxLength": 256 },
|
|
197
|
+
"preview": {
|
|
198
|
+
"description": "JSON value supplied by the requester for a human-facing surface to render. Opaque to the host and NOT covered by payloadHash."
|
|
199
|
+
},
|
|
200
|
+
"payloadHash": {
|
|
201
|
+
"type": "string",
|
|
202
|
+
"pattern": "^[0-9a-f]{64}$",
|
|
203
|
+
"description": "Lowercase hex SHA-256 of the UTF-8 bytes of the canonical JSON of the pinned payload (keys sorted recursively by UTF-16 code unit, arrays in order, undefined as null)."
|
|
204
|
+
},
|
|
205
|
+
"status": {
|
|
206
|
+
"enum": ["pending", "approved", "denied", "expired", "consumed"],
|
|
207
|
+
"description": "pending -> approved | denied | expired; approved -> consumed. denied, expired, and consumed are terminal."
|
|
208
|
+
},
|
|
209
|
+
"requestedBy": {
|
|
210
|
+
"oneOf": [
|
|
211
|
+
{
|
|
212
|
+
"type": "object",
|
|
213
|
+
"required": ["sessionId"],
|
|
214
|
+
"additionalProperties": false,
|
|
215
|
+
"properties": {
|
|
216
|
+
"sessionId": { "type": "string", "minLength": 1 }
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"type": "object",
|
|
221
|
+
"required": ["operator"],
|
|
222
|
+
"additionalProperties": false,
|
|
223
|
+
"properties": {
|
|
224
|
+
"operator": { "const": true }
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
"description": "The requester: an agent session, or the operator acting directly. Only the requester (an operator for operator-made requests) may consume."
|
|
229
|
+
},
|
|
230
|
+
"taskId": { "type": "string", "minLength": 1 },
|
|
231
|
+
"appId": { "type": "string", "minLength": 1 },
|
|
232
|
+
"channels": {
|
|
233
|
+
"type": "array",
|
|
234
|
+
"uniqueItems": true,
|
|
235
|
+
"items": { "$ref": "#/$defs/approvalChannel" },
|
|
236
|
+
"description": "Human channels allowed to decide this request. A decision on any other channel MUST be rejected. Empty when no declared channel is enabled."
|
|
237
|
+
},
|
|
238
|
+
"requestedAt": { "$ref": "#/$defs/isoDateTime" },
|
|
239
|
+
"expiresAt": { "$ref": "#/$defs/isoDateTime" },
|
|
240
|
+
"decision": {
|
|
241
|
+
"type": "object",
|
|
242
|
+
"required": ["decision", "channel", "decidedAt"],
|
|
243
|
+
"additionalProperties": false,
|
|
244
|
+
"properties": {
|
|
245
|
+
"decision": { "enum": ["approved", "denied"] },
|
|
246
|
+
"channel": { "$ref": "#/$defs/approvalChannel" },
|
|
247
|
+
"decidedAt": { "$ref": "#/$defs/isoDateTime" },
|
|
248
|
+
"signaturePath": {
|
|
249
|
+
"type": "string",
|
|
250
|
+
"description": "Workspace-relative path to the signature.json. Present only when decision is 'approved', and written after the signature exists."
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
"consumedAt": { "$ref": "#/$defs/isoDateTime" }
|
|
255
|
+
},
|
|
256
|
+
"allOf": [
|
|
257
|
+
{
|
|
258
|
+
"if": { "properties": { "status": { "enum": ["approved", "denied", "consumed"] } } },
|
|
259
|
+
"then": { "required": ["decision"] }
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"if": { "properties": { "status": { "const": "consumed" } } },
|
|
263
|
+
"then": { "required": ["consumedAt"] }
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"if": {
|
|
267
|
+
"required": ["decision"],
|
|
268
|
+
"properties": { "decision": { "properties": { "decision": { "const": "denied" } } } }
|
|
269
|
+
},
|
|
270
|
+
"then": { "properties": { "decision": { "not": { "required": ["signaturePath"] } } } }
|
|
271
|
+
}
|
|
272
|
+
]
|
|
273
|
+
},
|
|
274
|
+
"approvalChannel": {
|
|
275
|
+
"enum": ["web_click", "ui_card"],
|
|
276
|
+
"description": "A declared human channel. web_click: bearer credential plus an Origin on a configured allowlist. ui_card: one-time ticket minted per card render, app-only decide action, served on a surface agent sessions cannot reach. Further channels MAY be registered; each MUST satisfy the AIP-7 human channel rule."
|
|
277
|
+
},
|
|
132
278
|
"auditEvent": {
|
|
133
279
|
"type": "object",
|
|
134
280
|
"title": "audit-event (append-only chain entry)",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://agentproto.sh/schemas/
|
|
3
|
+
"$id": "https://agentproto.sh/schemas/pending/harness/HARNESS.schema.json",
|
|
4
4
|
"title": "HarnessDefinition",
|
|
5
5
|
"description": "Validates the YAML frontmatter of a .harness/<slug>.md file. A Harness is a stateful conversational shell with modes, threads, tool-approval gates, subagents, and observational memory. Today the canonical runtime is Mastra's Harness class (@mastra/core/harness); the spec is implementation-agnostic.",
|
|
6
6
|
"$comment": "Relationship to other AIPs: a Harness HAS agents (via modes[].agent and HarnessConfig.agent) but IS NOT a subtype of AIP-42. AIP-42 agents are referenced from harness manifests via $resolver. See also AIP-12 for agent pack ingestion — packs can auto-generate .harness/ manifests from modes/*.md files.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentproto/corpus-cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "@agentproto/corpus-cli — the `corpus` binary. Validate, lint, and operate an AIP-10 corpus workspace from the command line. Local-topology host for @agentproto/corpus — pair with a local backing engine (qdrant docker / gbrain) for a fully offline corpus runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentproto",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"zod": "^4.6.5",
|
|
55
55
|
"@agentproto/batch": "0.2.2",
|
|
56
56
|
"@agentproto/cli-exec": "0.1.1",
|
|
57
|
-
"@agentproto/corpus": "0.8.
|
|
58
|
-
"@agentproto/corpus-presets": "0.2.
|
|
57
|
+
"@agentproto/corpus": "0.8.2",
|
|
58
|
+
"@agentproto/corpus-presets": "0.2.14"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/node": "^25.9.5",
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
# AIP-52 — Harness · Implementer Guide
|
|
2
|
-
|
|
3
|
-
> **Status:** Draft
|
|
4
|
-
> **Schema:** `HARNESS.schema.json`
|
|
5
|
-
> **Canonical runtime:** `@mastra/core/harness` (Mastra's `Harness` class)
|
|
6
|
-
|
|
7
|
-
## What is a Harness?
|
|
8
|
-
|
|
9
|
-
A Harness is a **stateful, multi-mode conversational shell**. Where an AIP-42 Agent is
|
|
10
|
-
a single-purpose inference unit, a Harness composes multiple agents into an orchestrated
|
|
11
|
-
shell that can:
|
|
12
|
-
|
|
13
|
-
- Switch between **modes** (e.g. plan → execute → review) with distinct agents, tools,
|
|
14
|
-
and permission rules per mode.
|
|
15
|
-
- Hold a **typed conversation state** (`stateSchema` + `initialState`) that persists
|
|
16
|
-
across turns and is visible to all modes.
|
|
17
|
-
- Spawn **subagents** via the built-in `subagent` tool (forked or isolated thread).
|
|
18
|
-
- Gate tool calls via **tool-approval gates** (`permissions`, `submit_plan` builtin).
|
|
19
|
-
- Run **heartbeat handlers** in the background (OM reflector, progress reporter, etc.).
|
|
20
|
-
|
|
21
|
-
A Harness IS NOT a subtype of AIP-42. Agents are referenced _from_ harness manifests
|
|
22
|
-
via `$resolver` / `$ref`; the harness is the orchestrator, not the agent itself.
|
|
23
|
-
|
|
24
|
-
## Filesystem layout
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
.harness/
|
|
28
|
-
<slug>.md ← one manifest per harness (YAML frontmatter + prose body)
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
The markdown body (after the frontmatter block) is purely documentary — it is not
|
|
32
|
-
parsed by the runtime.
|
|
33
|
-
|
|
34
|
-
## Manifest shape
|
|
35
|
-
|
|
36
|
-
```yaml
|
|
37
|
-
---
|
|
38
|
-
spec: harness/v1
|
|
39
|
-
id: my-harness
|
|
40
|
-
name: My Harness
|
|
41
|
-
version: 1.0.0
|
|
42
|
-
description: One-sentence description.
|
|
43
|
-
|
|
44
|
-
storage:
|
|
45
|
-
$resolver: mastra.storage.composite # must resolve to MastraCompositeStore
|
|
46
|
-
|
|
47
|
-
modes:
|
|
48
|
-
- id: plan
|
|
49
|
-
default: true
|
|
50
|
-
name: Plan
|
|
51
|
-
agent: { $resolver: my-agent }
|
|
52
|
-
model: { $resolver: model.plan }
|
|
53
|
-
builtins:
|
|
54
|
-
ask_user: true
|
|
55
|
-
submit_plan: required # blocks until approved
|
|
56
|
-
transitionsTo: execute
|
|
57
|
-
|
|
58
|
-
- id: execute
|
|
59
|
-
name: Execute
|
|
60
|
-
agent: { $resolver: my-agent }
|
|
61
|
-
model: { $resolver: model.execute }
|
|
62
|
-
builtins:
|
|
63
|
-
ask_user: false
|
|
64
|
-
subagent: true
|
|
65
|
-
|
|
66
|
-
models:
|
|
67
|
-
resolver: { $resolver: model.resolver } # (modelId) => LanguageModel
|
|
68
|
-
|
|
69
|
-
subagents:
|
|
70
|
-
- id: researcher
|
|
71
|
-
name: Researcher
|
|
72
|
-
description: Searches and summarises.
|
|
73
|
-
agent: { $resolver: researcher-agent }
|
|
74
|
-
forked: false # isolated thread (default)
|
|
75
|
-
maxSteps: 20
|
|
76
|
-
|
|
77
|
-
memory:
|
|
78
|
-
$resolver: mastra.memory.thread
|
|
79
|
-
|
|
80
|
-
observability:
|
|
81
|
-
$resolver: my.telemetry.entrypoint
|
|
82
|
-
---
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### Required fields
|
|
86
|
-
|
|
87
|
-
| Field | Type | Notes |
|
|
88
|
-
|---|---|---|
|
|
89
|
-
| `spec` | `"harness/v1"` | Version pin. |
|
|
90
|
-
| `id` | `string` (kebab-case) | Registry key; must be unique within a workspace. |
|
|
91
|
-
| `name` | `string` | Human label (≤ 80 chars). |
|
|
92
|
-
| `version` | `semver` | Bump on breaking mode / subagent changes. |
|
|
93
|
-
| `storage` | `refOrString` | Must resolve to `MastraCompositeStore`. |
|
|
94
|
-
| `modes` | `mode[]` | At least one mode required. |
|
|
95
|
-
| `models.resolver` | `refOrString` | `(modelId: string) => LanguageModel`. |
|
|
96
|
-
|
|
97
|
-
## Resolver syntax (`refOrString`)
|
|
98
|
-
|
|
99
|
-
Three forms are accepted for any field annotated `$ref: "#/$defs/refOrString"`:
|
|
100
|
-
|
|
101
|
-
```yaml
|
|
102
|
-
# 1. Inline literal string (if the field accepts a raw value)
|
|
103
|
-
storage: "fs://./data/state"
|
|
104
|
-
|
|
105
|
-
# 2. Named registry ref — resolved at harness boot from the resolver registry
|
|
106
|
-
storage:
|
|
107
|
-
$ref: myApp.storage.main
|
|
108
|
-
|
|
109
|
-
# 3. Dynamic resolver call — arbitrary typed input passed to the resolver
|
|
110
|
-
storage:
|
|
111
|
-
$resolver: myApp.storage.build
|
|
112
|
-
input: { path: "./state", ttl: 3600 }
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
## Modes
|
|
116
|
-
|
|
117
|
-
Each mode entry defines **one operational context**:
|
|
118
|
-
|
|
119
|
-
| Field | Required | Notes |
|
|
120
|
-
|---|---|---|
|
|
121
|
-
| `id` | ✅ | Unique within this harness (kebab-case recommended). |
|
|
122
|
-
| `agent` | ✅ | Backing `Mastra Agent` instance (via resolver). |
|
|
123
|
-
| `model` | ✅ | Resolver returning `{ modelId, defaultModelId?, allowed? }`. |
|
|
124
|
-
| `default` | — | First mode with `default: true` activates on new sessions. |
|
|
125
|
-
| `transitionsTo` | — | Auto-switch to this mode id after `submit_plan` approval. |
|
|
126
|
-
| `tools` | — | Replaces the agent's built-in tools entirely (mutually exclusive with `additionalTools`). |
|
|
127
|
-
| `prompt.blocks` | — | Instruction blocks resolved and concatenated as `instructions`. |
|
|
128
|
-
| `builtins.*` | — | Enable / disable built-in tools: `ask_user`, `submit_plan`, `task_write`, `task_check`, `subagent`. |
|
|
129
|
-
| `permissions` | — | `PermissionRules` resolver — default tool-approval policy for this mode. |
|
|
130
|
-
|
|
131
|
-
### `submit_plan` values
|
|
132
|
-
|
|
133
|
-
| Value | Behaviour |
|
|
134
|
-
|---|---|
|
|
135
|
-
| `false` (default) | Tool not registered. |
|
|
136
|
-
| `true` | Registered; plan approval is optional. |
|
|
137
|
-
| `"required"` | Registered; the mode blocks on plan approval and then transitions to `transitionsTo`. |
|
|
138
|
-
|
|
139
|
-
## Subagents
|
|
140
|
-
|
|
141
|
-
```yaml
|
|
142
|
-
subagents:
|
|
143
|
-
- id: drafter
|
|
144
|
-
name: Drafter
|
|
145
|
-
description: Writes first-draft content.
|
|
146
|
-
agent: { $resolver: drafter-agent }
|
|
147
|
-
forked: true # inherits parent thread + prompt cache
|
|
148
|
-
maxSteps: 30
|
|
149
|
-
allowedHarnessTools: [ask_user, task_write]
|
|
150
|
-
allowedWorkspaceTools: [read_file, write_file]
|
|
151
|
-
prompt:
|
|
152
|
-
blocks:
|
|
153
|
-
- "You are a concise technical writer."
|
|
154
|
-
- { $ref: brand.voice.guide }
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
- `forked: true` — subagent inherits the parent conversation thread and prompt cache
|
|
158
|
-
(cheaper, shares context).
|
|
159
|
-
- `forked: false` (default) — fresh isolated thread; the subagent is context-blind to
|
|
160
|
-
the parent.
|
|
161
|
-
|
|
162
|
-
## Heartbeats
|
|
163
|
-
|
|
164
|
-
Heartbeats are periodic background handlers registered on the Harness constructor's
|
|
165
|
-
`heartbeats` array. Each entry is a `refOrString` resolving to a `HeartbeatConfig`
|
|
166
|
-
(interval + handler function). Common uses: Observational Memory reflector, progress
|
|
167
|
-
reporter, stale-session reaper.
|
|
168
|
-
|
|
169
|
-
## Loading algorithm
|
|
170
|
-
|
|
171
|
-
1. Locate `.harness/<slug>.md` in the workspace (or agent pack).
|
|
172
|
-
2. Parse the YAML frontmatter block; validate against `HARNESS.schema.json`.
|
|
173
|
-
3. Resolve all `$ref` / `$resolver` entries against the resolver registry at boot time
|
|
174
|
-
— fail loudly if any resolver is missing.
|
|
175
|
-
4. Instantiate the `Harness` object (Mastra constructor) with the resolved config.
|
|
176
|
-
5. Register in the harness registry keyed by `id`.
|
|
177
|
-
|
|
178
|
-
**Never execute a harness at load time** — only parse, validate, and register.
|
|
179
|
-
|
|
180
|
-
## Relationship to other AIPs
|
|
181
|
-
|
|
182
|
-
| AIP | Relationship |
|
|
183
|
-
|---|---|
|
|
184
|
-
| AIP-42 (Agent) | Harness agents are AIP-42 instances. A Harness orchestrates them; it is NOT an AIP-42 agent itself. |
|
|
185
|
-
| AIP-12 (Playbook) | Agent packs can auto-generate `.harness/` manifests from `modes/*.md` files during ingestion. |
|
|
186
|
-
| AIP-35 (Storage) | `storage` field resolves to a provider defined under AIP-35. |
|
|
187
|
-
| AIP-37 (Lifecycle Events) | Harness emits `harness-session-start`, `harness-mode-switch`, `harness-session-end` events. |
|
|
188
|
-
| AIP-47 (Role) | `permissions` per mode align with AIP-47 role-based access scopes. |
|
|
189
|
-
|
|
190
|
-
## See also
|
|
191
|
-
|
|
192
|
-
- `HARNESS.schema.json` — canonical validation schema
|
|
193
|
-
- `@mastra/core/harness` — canonical runtime implementation
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# AIP-54 — Ref · Implementer Guide
|
|
2
|
-
|
|
3
|
-
> **Status:** Draft
|
|
4
|
-
> **Schema:** `REF.schema.json`
|
|
5
|
-
> **Reference runtime:** `@agentproto/ref`
|
|
6
|
-
|
|
7
|
-
## What is a Ref?
|
|
8
|
-
|
|
9
|
-
A Ref is **one typed, cross-AIP reference** — `{aip, id, version?}`,
|
|
10
|
-
serialized in string contexts as `aip://<aip>/<id>[@version]`. It is
|
|
11
|
-
the general answer to a question every AIP has answered differently:
|
|
12
|
-
|
|
13
|
-
- AIP-18's `ref` field — an id string scoped to ONE named collection,
|
|
14
|
-
no shape guarantee.
|
|
15
|
-
- app-kit's `attach` — a structural `DoctypeHandle` that serializes
|
|
16
|
-
the whole bundle and carries no reliable discriminator.
|
|
17
|
-
- AIP-42's `AnyRef` — bare strings, typed only by call-site convention.
|
|
18
|
-
- AIP-55's first draft — bespoke `appRef`/`packRef` per target kind.
|
|
19
|
-
|
|
20
|
-
A Ref IS NOT a handle. It is inert data pointing at one; the AIP-43
|
|
21
|
-
registry owns the handle. A Ref IS NOT resolvable by itself —
|
|
22
|
-
resolution is the host's `RefCatalog`, which joins per-family AIP-43
|
|
23
|
-
registries.
|
|
24
|
-
|
|
25
|
-
## Reference runtime
|
|
26
|
-
|
|
27
|
-
```ts
|
|
28
|
-
import { RefCatalog, refFor, refToUri, refFromUri } from "@agentproto/ref"
|
|
29
|
-
|
|
30
|
-
const cat = new RefCatalog()
|
|
31
|
-
cat.registerFamily(42, { family: "app", keyBy: h => h.id! }, appRegistry)
|
|
32
|
-
cat.registerFamily(52, { family: "pack", keyBy: h => h.name }, packRegistry)
|
|
33
|
-
|
|
34
|
-
const ref = refFor({ aip: 52, keyBy: h => h.name }, packHandle, "1.0.0")
|
|
35
|
-
// { aip: 52, id: "the-agentic-coder", version: "1.0.0" }
|
|
36
|
-
|
|
37
|
-
const hit = cat.resolveStrict(ref) // { handle, family } — throws if dangling
|
|
38
|
-
const uri = refToUri(ref) // "aip://52/the-agentic-coder@1.0.0"
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Normative rules
|
|
42
|
-
|
|
43
|
-
1. **keyBy identity.** The `keyBy` passed to `refFor` MUST be the same
|
|
44
|
-
function the family's registry uses. A ref id that drifts from its
|
|
45
|
-
registry key is a HARD authoring error.
|
|
46
|
-
2. **Unreferenceable handles.** A handle with no registry key (no
|
|
47
|
-
`id`/`provider`/`slug`/`name`) MUST be refused by `refFor` — the
|
|
48
|
-
pre-AIP-54 world silently produced dangling id strings. Anonymous
|
|
49
|
-
AIP-42 apps (no `id`) are unreferenceable; hosts MUST refuse.
|
|
50
|
-
3. **Loud failure.** `resolve` on an unknown aip or id returns
|
|
51
|
-
`undefined` (default) or throws `RefFamilyError` /
|
|
52
|
-
`RefUnresolvableError` (`onUnresolvable: "throw"` / `resolveStrict`).
|
|
53
|
-
A dangling ref MUST never masquerade as a resolution.
|
|
54
|
-
4. **Ref is inert.** Frozen at construction; carries no behavior. All
|
|
55
|
-
semantics live in the catalog + registries.
|
|
56
|
-
5. **One family per aip.** Re-registering replaces the binding
|
|
57
|
-
(hot-reload parity with AIP-43's `replace`).
|
|
58
|
-
|
|
59
|
-
### Conventions for referenced handles
|
|
60
|
-
|
|
61
|
-
- **Handles SHOULD carry `schema: "<doctype>/vN"`.** Several existing
|
|
62
|
-
handles don't (e.g. the in-memory AIP-42 `AppHandle` never carries
|
|
63
|
-
the `schema: "app/v1"` literal that `emit` writes into `APP.md`) —
|
|
64
|
-
until they do, `refFor` requires the family spec to be supplied
|
|
65
|
-
explicitly, and a bare serialized handle cannot self-describe into a
|
|
66
|
-
ref. New doctypes SHOULD include it in `createDoctype`'s default
|
|
67
|
-
`build()`.
|
|
68
|
-
- **Family keys are the family's choice.** Most families key on `id`
|
|
69
|
-
(or `provider`/`slug` per AIP-43's default), but packs (AIP-52) key
|
|
70
|
-
on `name`. The `RefCatalog` owns the `aip → family + keyBy` table;
|
|
71
|
-
`refFor` MUST be given the same `keyBy` the family's registry uses.
|
|
72
|
-
|
|
73
|
-
## Migration notes for existing mechanisms
|
|
74
|
-
|
|
75
|
-
| Existing | Migration |
|
|
76
|
-
|---|---|
|
|
77
|
-
| AIP-18 `ref` field + `refKind` | Validate ref values as `aip://` URIs; `refKind` narrows the accepted `aip`(s). |
|
|
78
|
-
| app-kit `attach` (DoctypeHandle) | Carry `ArtifactRef`s; the host resolves through its catalog. Fixes the inline-the-whole-bundle flaw. |
|
|
79
|
-
| AIP-42 `AnyRef` string form | Unchanged at the string layer; `aip://` URIs are a valid `ref:` value hosts narrow to `ref/v1`. |
|
|
80
|
-
| AIP-52 `$resolver` | A URI rendering of the same coordinates. |
|
|
81
|
-
| AIP-53 draft `target` union | Replaced by `on: ref/v1` (see AIP-53). |
|
|
82
|
-
|
|
83
|
-
## What a new AIP needs to be referenceable
|
|
84
|
-
|
|
85
|
-
Nothing ref-specific. It needs what every AIP needs anyway: a
|
|
86
|
-
`defineX` handle with a stable identity field, and (for hosts that
|
|
87
|
-
resolve in-memory) an AIP-43 registry entry with a `family` + `keyBy`.
|
|
88
|
-
Pricing, entitling, or any future capability composes ON TOP via a
|
|
89
|
-
capability attached to a ref — the target AIP never learns about it.
|