aae-protocol 0.0.1 → 0.9.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/models.js ADDED
@@ -0,0 +1,288 @@
1
+ /**
2
+ * Zod schemas + inferred TypeScript types for AAE protocol shapes.
3
+ *
4
+ * These mirror schemas/*.schema.json and the SPEC. When you change one,
5
+ * change the others and bump conformance test fixtures.
6
+ */
7
+ import { z } from "zod";
8
+ export const PROTOCOL_VERSION = "0.8";
9
+ const ulidSchema = z
10
+ .string()
11
+ .regex(/^[0-9A-HJKMNP-TV-Z]{26}$/, "must be a ULID");
12
+ const sha256Schema = z
13
+ .string()
14
+ .regex(/^sha256:[a-f0-9]{64}$/, "must be sha256:<hex>");
15
+ const versionSchema = z.string().regex(/^\d+\.\d+(\.\d+)?$/);
16
+ // ──────────────────────────────────────────────────────────────────────────
17
+ // Enums
18
+ // ──────────────────────────────────────────────────────────────────────────
19
+ export const BlastRadius = {
20
+ READ_ONLY: "read_only",
21
+ SINGLE_SERVICE: "single_service",
22
+ SINGLE_HOST: "single_host",
23
+ MULTI_HOST: "multi_host",
24
+ IRREVERSIBLE: "irreversible",
25
+ };
26
+ export const BlastRadiusSchema = z.enum([
27
+ "read_only",
28
+ "single_service",
29
+ "single_host",
30
+ "multi_host",
31
+ "irreversible",
32
+ ]);
33
+ export const Decision = {
34
+ ALLOW: "allow",
35
+ DENY: "deny",
36
+ REQUIRE_APPROVAL: "require_approval",
37
+ };
38
+ /**
39
+ * v0.8: the decision enum is closed at exactly these three values. Unknown
40
+ * decision values — including the two refined v0.3 values retired in v0.8 —
41
+ * MUST fail parsing; consumers reject rather than coerce.
42
+ */
43
+ export const DecisionSchema = z.enum(["allow", "deny", "require_approval"]);
44
+ /** v0.3: whether a tool's effects can be undone. */
45
+ export const ReversibilitySchema = z.enum([
46
+ "reversible",
47
+ "partially_reversible",
48
+ "irreversible",
49
+ ]);
50
+ /** v0.7: standard ext.confidence shape on policy decisions. A low-confidence
51
+ * allow is still an allow (G-2-safe); hosts may route it to spot checks. */
52
+ export const ConfidenceSchema = z
53
+ .object({
54
+ score: z.number().min(0).max(1),
55
+ basis: z.string().optional(),
56
+ })
57
+ .passthrough();
58
+ /** v0.3: standard ext.cost_estimate shape for cost-aware policy. */
59
+ export const CostEstimateSchema = z
60
+ .object({
61
+ currency: z.string().min(1),
62
+ amount: z.number().nonnegative(),
63
+ amount_max: z.number().nonnegative().optional(),
64
+ basis: z.string().optional(),
65
+ confidence: z.number().min(0).max(1).optional(),
66
+ })
67
+ .passthrough();
68
+ /** Core strictness modes (SPEC §5.3). */
69
+ export const Strictness = {
70
+ STRICT_LITERAL: "strict_literal",
71
+ STRICT_TEMPLATE: "strict_template",
72
+ };
73
+ /**
74
+ * v0.8: strictness is an open string. Core normatively defines
75
+ * `strict_literal` (REQUIRED, default) and `strict_template` (OPTIONAL);
76
+ * any other value is a companion/extension mode, and a host that does not
77
+ * implement the requested mode MUST fail closed (C-16), never downgrade.
78
+ */
79
+ export const StrictnessSchema = z.string().min(1);
80
+ // ──────────────────────────────────────────────────────────────────────────
81
+ // Proposal
82
+ // ──────────────────────────────────────────────────────────────────────────
83
+ export const StepSchema = z
84
+ .object({
85
+ tool: z.string().min(1),
86
+ args: z.record(z.unknown()),
87
+ expected: z.record(z.unknown()).optional(),
88
+ blast_radius: BlastRadiusSchema,
89
+ })
90
+ .strict();
91
+ export const ContextSchema = z
92
+ .object({
93
+ rationale: z.string().min(1),
94
+ triggered_by: z.string().optional(),
95
+ // Also the carrier of the v0.8 negotiation idiom (SPEC §5.5): a
96
+ // proposal submitted in response to a guided deny references the
97
+ // original proposal_id here.
98
+ derived_from: z.string().optional(),
99
+ })
100
+ .passthrough(); // host-specific extensions allowed
101
+ export const ProposalSchema = z
102
+ .object({
103
+ aae_version: versionSchema,
104
+ proposal_id: ulidSchema,
105
+ agent_id: z.string().min(1),
106
+ // v0.3, optional (G-1): ordered provenance; last entry must equal agent_id
107
+ agent_chain: z.array(z.string().min(1)).min(1).optional(),
108
+ tenant_id: z.string().min(1),
109
+ intent: z.string().regex(/^[a-z][a-z0-9_]*$/),
110
+ context: ContextSchema,
111
+ steps: z.array(StepSchema).min(1),
112
+ submitted_at: z.string().datetime({ offset: true }),
113
+ })
114
+ .strict()
115
+ .superRefine((p, ctx) => {
116
+ if (p.agent_chain &&
117
+ p.agent_chain[p.agent_chain.length - 1] !== p.agent_id) {
118
+ ctx.addIssue({
119
+ code: z.ZodIssueCode.custom,
120
+ message: "agent_chain[-1] must equal agent_id",
121
+ });
122
+ }
123
+ });
124
+ // ──────────────────────────────────────────────────────────────────────────
125
+ // Preview
126
+ // ──────────────────────────────────────────────────────────────────────────
127
+ export const EffectSchema = z
128
+ .object({
129
+ type: z.string(),
130
+ target: z.string(),
131
+ from: z.string().nullable().optional(),
132
+ to: z.string().nullable().optional(),
133
+ details: z.record(z.unknown()).optional(),
134
+ })
135
+ .strict();
136
+ export const StepPreviewSchema = z
137
+ .object({
138
+ step_index: z.number().int().nonnegative(),
139
+ predicted_effects: z.array(EffectSchema),
140
+ estimated_duration_ms: z.number().int().nonnegative().optional(),
141
+ diff: z.string().nullable().optional(),
142
+ warnings: z.array(z.string()).default([]),
143
+ preview_unsupported_reason: z.string().optional(),
144
+ // v0.3: non-normative extension fields; standardized shape: cost_estimate
145
+ ext: z.record(z.unknown()).nullish(),
146
+ })
147
+ .strict();
148
+ /** Parse a decision's ext.confidence into the standard shape, if present. */
149
+ export function confidenceOf(decision) {
150
+ const raw = decision.ext?.confidence;
151
+ if (raw === undefined || raw === null)
152
+ return null;
153
+ return ConfidenceSchema.parse(raw);
154
+ }
155
+ /** Parse a step preview's ext.cost_estimate into the standard shape, if present. */
156
+ export function costEstimateOf(preview) {
157
+ const raw = preview.ext?.cost_estimate;
158
+ if (raw === undefined || raw === null)
159
+ return null;
160
+ return CostEstimateSchema.parse(raw);
161
+ }
162
+ export const PreviewSchema = z
163
+ .object({
164
+ aae_version: versionSchema,
165
+ preview_id: ulidSchema,
166
+ proposal_id: ulidSchema,
167
+ step_previews: z.array(StepPreviewSchema),
168
+ aggregate_blast_radius: BlastRadiusSchema,
169
+ preview_unsupported: z.boolean(),
170
+ generated_at: z.string().datetime({ offset: true }),
171
+ })
172
+ .strict();
173
+ // ──────────────────────────────────────────────────────────────────────────
174
+ // Policy decision
175
+ // ──────────────────────────────────────────────────────────────────────────
176
+ export const PolicyDecisionSchema = z
177
+ .object({
178
+ aae_version: versionSchema,
179
+ decision_id: ulidSchema,
180
+ proposal_id: ulidSchema,
181
+ decision: DecisionSchema,
182
+ policy_version: z.string(),
183
+ rules_evaluated: z.array(z.string()),
184
+ reason: z.string(),
185
+ required_approvers: z.array(z.string()).optional(),
186
+ expires_at: z.string().datetime({ offset: true }).optional(),
187
+ strictness: StrictnessSchema.default("strict_literal"),
188
+ decided_at: z.string().datetime({ offset: true }),
189
+ // v0.7: non-normative extensions; standardized shape: confidence
190
+ ext: z.record(z.unknown()).nullish(),
191
+ })
192
+ .strict()
193
+ .superRefine((d, ctx) => {
194
+ if (d.decision === "allow" && !d.expires_at) {
195
+ ctx.addIssue({
196
+ code: z.ZodIssueCode.custom,
197
+ message: "expires_at is required when decision is 'allow'",
198
+ });
199
+ }
200
+ if (d.decision === "require_approval" && !d.required_approvers?.length) {
201
+ ctx.addIssue({
202
+ code: z.ZodIssueCode.custom,
203
+ message: `required_approvers is required when decision is '${d.decision}'`,
204
+ });
205
+ }
206
+ });
207
+ // ──────────────────────────────────────────────────────────────────────────
208
+ // Capability token
209
+ // ──────────────────────────────────────────────────────────────────────────
210
+ export const CapabilityScopeSchema = z
211
+ .object({
212
+ tool: z.string(),
213
+ approved_steps_hash: sha256Schema,
214
+ target_constraints: z.record(z.unknown()).optional(),
215
+ })
216
+ .passthrough();
217
+ export const CapabilityTokenSchema = z
218
+ .object({
219
+ aae_version: versionSchema,
220
+ token_id: ulidSchema,
221
+ proposal_id: ulidSchema,
222
+ decision_id: ulidSchema,
223
+ scope: CapabilityScopeSchema,
224
+ iat: z.number().int(),
225
+ exp: z.number().int(),
226
+ iss: z.string(),
227
+ sub: z.string().optional(),
228
+ max_uses: z.number().int().min(1),
229
+ })
230
+ .strict();
231
+ // ──────────────────────────────────────────────────────────────────────────
232
+ // Audit event
233
+ // ──────────────────────────────────────────────────────────────────────────
234
+ export const EventSignatureSchema = z
235
+ .object({
236
+ alg: z.enum(["ed25519", "ecdsa-p256", "rsa-pss-sha256"]),
237
+ key_id: z.string(),
238
+ value: z.string(),
239
+ })
240
+ .strict();
241
+ /**
242
+ * v0.8 core event type binding an out-of-chain artifact to a chain event by
243
+ * content hash. Required payload fields: `artifact_hash` (algorithm-prefixed
244
+ * canonical hash), `bound_event_id`, `artifact_kind` (free-form string, e.g.
245
+ * `legible_record`, `session_recording`). Optional: `uri`, `media_type`,
246
+ * `producer_id`, `producer_version`. Artifacts are advisory; the chain event
247
+ * is authoritative.
248
+ */
249
+ export const EVENT_TYPE_ARTIFACT_ATTESTED = "artifact_attested";
250
+ export const AuditEventSchema = z
251
+ .object({
252
+ aae_version: versionSchema,
253
+ event_id: ulidSchema,
254
+ // Open string; core v0.8 adds `artifact_attested`. Consumers MUST
255
+ // ignore unknown event types.
256
+ event_type: z.string(),
257
+ proposal_id: ulidSchema,
258
+ tenant_id: z.string().min(1),
259
+ agent_id: z.string().min(1),
260
+ actor: z.string(),
261
+ ts: z.string().datetime({ offset: true }),
262
+ payload: z.record(z.unknown()),
263
+ prev_event_hash: sha256Schema.nullable(),
264
+ this_event_hash: sha256Schema,
265
+ signature: EventSignatureSchema.nullish(),
266
+ })
267
+ .strict();
268
+ // ──────────────────────────────────────────────────────────────────────────
269
+ // Tool registration
270
+ // ──────────────────────────────────────────────────────────────────────────
271
+ export const ToolRegistrationSchema = z
272
+ .object({
273
+ aae_version: versionSchema,
274
+ name: z.string().regex(/^[a-z][a-z0-9_]*$/),
275
+ description: z.string().optional(),
276
+ plan_schema: z.record(z.unknown()),
277
+ preview_schema: z.record(z.unknown()).optional(),
278
+ preview_supported: z.boolean(),
279
+ default_blast_radius: BlastRadiusSchema,
280
+ aae_required: z.boolean(),
281
+ // v0.3 optional metadata (G-4)
282
+ data_classes_touched: z.array(z.string()).default([]),
283
+ compliance_relevant: z.boolean().default(false),
284
+ systems_of_record: z.array(z.string()).default([]),
285
+ reversibility: ReversibilitySchema.optional(),
286
+ })
287
+ .strict();
288
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAc,CAAC;AAE/C,MAAM,UAAU,GAAG,CAAC;KAClB,MAAM,EAAE;KACR,KAAK,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC;AACtD,MAAM,YAAY,GAAG,CAAC;KACpB,MAAM,EAAE;KACR,KAAK,CAAC,uBAAuB,EAAE,sBAAsB,CAAC,CAAC;AACzD,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;AAE7D,6EAA6E;AAC7E,QAAQ;AACR,6EAA6E;AAE7E,MAAM,CAAC,MAAM,WAAW,GAAG;IAC1B,SAAS,EAAE,WAAW;IACtB,cAAc,EAAE,gBAAgB;IAChC,WAAW,EAAE,aAAa;IAC1B,UAAU,EAAE,YAAY;IACxB,YAAY,EAAE,cAAc;CACnB,CAAC;AACX,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC;IACvC,WAAW;IACX,gBAAgB;IAChB,aAAa;IACb,YAAY;IACZ,cAAc;CACd,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACvB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,gBAAgB,EAAE,kBAAkB;CAC3B,CAAC;AAC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A6E;AAE7E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACrC,MAAM,CAAC;IACP,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC;IAC3C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAClC,cAAc,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;IAChD,iBAAiB,EAAE,CAAC,CAAC,OAAO,EAAE;IAC9B,oBAAoB,EAAE,iBAAiB;IACvC,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;IACzB,+BAA+B;IAC/B,oBAAoB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACrD,mBAAmB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAC/C,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAClD,aAAa,EAAE,mBAAmB,CAAC,QAAQ,EAAE;CAC7C,CAAC;KACD,MAAM,EAAE,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Audit-event signatures (SPEC §3.5, v0.7).
3
+ *
4
+ * The signer signs the event's ATTESTATION BYTES —
5
+ * `canonicalize(view sans signature sans this_event_hash) || prev_event_hash`
6
+ * — which are exactly the bytes an unsigned event would hash. The signature
7
+ * is attached, then `this_event_hash` is computed over the view INCLUDING it.
8
+ * So: the chain commits to the signature (stripping it is hash-detectable
9
+ * without keys), and the signature commits to content AND chain position
10
+ * (prev hash is inside the signed bytes).
11
+ *
12
+ * Consequence: signatures are applied at append time or never.
13
+ *
14
+ * v0.x permits exactly one algorithm, `ed25519` — deterministic, so signed
15
+ * fixtures are byte-reproducible.
16
+ */
17
+ /** The only signature algorithm permitted in v0.x. */
18
+ export declare const SIGNATURE_ALG: "ed25519";
19
+ export declare class SignatureError extends Error {
20
+ readonly eventId?: string | undefined;
21
+ name: string;
22
+ constructor(message: string, eventId?: string | undefined);
23
+ }
24
+ /** The bytes a signature covers. */
25
+ export declare function attestationBytes(event: Record<string, unknown>, prevEventHash: string | null): Buffer;
26
+ /** An Ed25519 event signer over a PKCS#8 PEM private key. */
27
+ export declare class Ed25519EventSigner {
28
+ readonly keyId: string;
29
+ private readonly key;
30
+ constructor(keyId: string, privateKeyPem: string);
31
+ sign(data: Buffer): string;
32
+ }
33
+ /**
34
+ * Value-based chain production WITH a signature: seal prev, sign, attach,
35
+ * then hash the view including the signature.
36
+ */
37
+ export declare function appendEventValueSigned(event: Record<string, unknown>, prevEventHash: string | null, signer: Ed25519EventSigner): Record<string, unknown>;
38
+ /**
39
+ * Verify one signed event against a keyId -> PEM public key map.
40
+ *
41
+ * Returns true/false for a present signature. Structural problems (missing
42
+ * signature, unknown key, unpermitted algorithm) THROW — operators must be
43
+ * able to tell "forged" from "misconfigured".
44
+ */
45
+ export declare function verifyEventSignature(event: Record<string, unknown>, trustedKeys: Record<string, string>): boolean;
46
+ /**
47
+ * Verify signatures across a chain; returns how many verified. Unsigned
48
+ * events are permitted unless requireAll; a present-but-invalid signature
49
+ * always throws.
50
+ */
51
+ export declare function verifyChainSignatures(events: Record<string, unknown>[], trustedKeys: Record<string, string>, requireAll?: boolean): number;
52
+ //# sourceMappingURL=signing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../src/signing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAYH,sDAAsD;AACtD,eAAO,MAAM,aAAa,EAAG,SAAkB,CAAC;AAEhD,qBAAa,cAAe,SAAQ,KAAK;aAIvB,OAAO,CAAC,EAAE,MAAM;IAHxB,IAAI,SAAoB;gBAEhC,OAAO,EAAE,MAAM,EACC,OAAO,CAAC,EAAE,MAAM,YAAA;CAIjC;AAED,oCAAoC;AACpC,wBAAgB,gBAAgB,CAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,aAAa,EAAE,MAAM,GAAG,IAAI,GAC1B,MAAM,CASR;AAED,6DAA6D;AAC7D,qBAAa,kBAAkB;aAIb,KAAK,EAAE,MAAM;IAH9B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAY;gBAGf,KAAK,EAAE,MAAM,EAC7B,aAAa,EAAE,MAAM;IAUtB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAI1B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,MAAM,EAAE,kBAAkB,GACxB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgBzB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,OAAO,CAuCT;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EACjC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,UAAU,UAAQ,GAChB,MAAM,CAqBR"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Audit-event signatures (SPEC §3.5, v0.7).
3
+ *
4
+ * The signer signs the event's ATTESTATION BYTES —
5
+ * `canonicalize(view sans signature sans this_event_hash) || prev_event_hash`
6
+ * — which are exactly the bytes an unsigned event would hash. The signature
7
+ * is attached, then `this_event_hash` is computed over the view INCLUDING it.
8
+ * So: the chain commits to the signature (stripping it is hash-detectable
9
+ * without keys), and the signature commits to content AND chain position
10
+ * (prev hash is inside the signed bytes).
11
+ *
12
+ * Consequence: signatures are applied at append time or never.
13
+ *
14
+ * v0.x permits exactly one algorithm, `ed25519` — deterministic, so signed
15
+ * fixtures are byte-reproducible.
16
+ */
17
+ import { createPrivateKey, createPublicKey, sign as nodeSign, verify as nodeVerify, } from "node:crypto";
18
+ import { canonicalize } from "json-canonicalize";
19
+ import { computeEventHash, eventForHashing } from "./hashchain.js";
20
+ /** The only signature algorithm permitted in v0.x. */
21
+ export const SIGNATURE_ALG = "ed25519";
22
+ export class SignatureError extends Error {
23
+ eventId;
24
+ name = "SignatureError";
25
+ constructor(message, eventId) {
26
+ super(message);
27
+ this.eventId = eventId;
28
+ }
29
+ }
30
+ /** The bytes a signature covers. */
31
+ export function attestationBytes(event, prevEventHash) {
32
+ // The signed view omits the signature itself (and this_event_hash, which
33
+ // eventForHashing already drops): a signature cannot cover itself.
34
+ const { signature: _omit, ...view } = eventForHashing(event);
35
+ void _omit;
36
+ return Buffer.concat([
37
+ Buffer.from(canonicalize(view), "utf8"),
38
+ Buffer.from(prevEventHash ?? "", "utf8"),
39
+ ]);
40
+ }
41
+ /** An Ed25519 event signer over a PKCS#8 PEM private key. */
42
+ export class Ed25519EventSigner {
43
+ keyId;
44
+ key;
45
+ constructor(keyId, privateKeyPem) {
46
+ this.keyId = keyId;
47
+ this.key = createPrivateKey(privateKeyPem);
48
+ if (this.key.asymmetricKeyType !== "ed25519") {
49
+ throw new SignatureError(`signing key ${keyId} is not ed25519 (the only permitted v0.x algorithm)`);
50
+ }
51
+ }
52
+ sign(data) {
53
+ // Ed25519 in node: algorithm is null (the key determines it).
54
+ return nodeSign(null, data, this.key).toString("base64url");
55
+ }
56
+ }
57
+ /**
58
+ * Value-based chain production WITH a signature: seal prev, sign, attach,
59
+ * then hash the view including the signature.
60
+ */
61
+ export function appendEventValueSigned(event, prevEventHash, signer) {
62
+ const sealed = {
63
+ ...event,
64
+ prev_event_hash: prevEventHash,
65
+ };
66
+ sealed.signature = {
67
+ alg: SIGNATURE_ALG,
68
+ key_id: signer.keyId,
69
+ value: signer.sign(attestationBytes(sealed, prevEventHash)),
70
+ };
71
+ // hash AFTER attaching: the chain commits to the signature
72
+ sealed.this_event_hash = computeEventHash(eventForHashing(sealed), prevEventHash);
73
+ return sealed;
74
+ }
75
+ /**
76
+ * Verify one signed event against a keyId -> PEM public key map.
77
+ *
78
+ * Returns true/false for a present signature. Structural problems (missing
79
+ * signature, unknown key, unpermitted algorithm) THROW — operators must be
80
+ * able to tell "forged" from "misconfigured".
81
+ */
82
+ export function verifyEventSignature(event, trustedKeys) {
83
+ const eventId = String(event.event_id ?? "<unknown>");
84
+ const sig = event.signature;
85
+ if (sig === null || sig === undefined) {
86
+ throw new SignatureError("event carries no signature", eventId);
87
+ }
88
+ if (sig.alg !== SIGNATURE_ALG) {
89
+ throw new SignatureError(`signature algorithm ${String(sig.alg)} not permitted in v0.x (ed25519 only)`, eventId);
90
+ }
91
+ const pem = trustedKeys[String(sig.key_id)];
92
+ if (pem === undefined) {
93
+ throw new SignatureError(`unknown signing key ${String(sig.key_id)}`, eventId);
94
+ }
95
+ const key = createPublicKey(pem);
96
+ if (key.asymmetricKeyType !== "ed25519") {
97
+ throw new SignatureError(`trusted key ${String(sig.key_id)} is not ed25519`, eventId);
98
+ }
99
+ const data = attestationBytes(event, event.prev_event_hash ?? null);
100
+ return nodeVerify(null, data, key, Buffer.from(String(sig.value), "base64url"));
101
+ }
102
+ /**
103
+ * Verify signatures across a chain; returns how many verified. Unsigned
104
+ * events are permitted unless requireAll; a present-but-invalid signature
105
+ * always throws.
106
+ */
107
+ export function verifyChainSignatures(events, trustedKeys, requireAll = false) {
108
+ let verified = 0;
109
+ for (const ev of events) {
110
+ if (ev.signature === null || ev.signature === undefined) {
111
+ if (requireAll) {
112
+ throw new SignatureError("unsigned event in a chain requiring signatures", String(ev.event_id ?? "<unknown>"));
113
+ }
114
+ continue;
115
+ }
116
+ if (!verifyEventSignature(ev, trustedKeys)) {
117
+ throw new SignatureError("event signature did not verify (content, position, or signature altered)", String(ev.event_id ?? "<unknown>"));
118
+ }
119
+ verified += 1;
120
+ }
121
+ return verified;
122
+ }
123
+ //# sourceMappingURL=signing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signing.js","sourceRoot":"","sources":["../src/signing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAEN,gBAAgB,EAChB,eAAe,EACf,IAAI,IAAI,QAAQ,EAChB,MAAM,IAAI,UAAU,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEnE,sDAAsD;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,SAAkB,CAAC;AAEhD,MAAM,OAAO,cAAe,SAAQ,KAAK;IAIvB;IAHR,IAAI,GAAG,gBAAgB,CAAC;IACjC,YACC,OAAe,EACC,OAAgB;QAEhC,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,YAAO,GAAP,OAAO,CAAS;IAGjC,CAAC;CACD;AAED,oCAAoC;AACpC,MAAM,UAAU,gBAAgB,CAC/B,KAA8B,EAC9B,aAA4B;IAE5B,yEAAyE;IACzE,mEAAmE;IACnE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAC7D,KAAK,KAAK,CAAC;IACX,OAAO,MAAM,CAAC,MAAM,CAAC;QACpB,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,aAAa,IAAI,EAAE,EAAE,MAAM,CAAC;KACxC,CAAC,CAAC;AACJ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,EAAE,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACzD,IAAI,UAAU,EAAE,CAAC;gBAChB,MAAM,IAAI,cAAc,CACvB,gDAAgD,EAChD,MAAM,CAAC,EAAE,CAAC,QAAQ,IAAI,WAAW,CAAC,CAClC,CAAC;YACH,CAAC;YACD,SAAS;QACV,CAAC;QACD,IAAI,CAAC,oBAAoB,CAAC,EAAE,EAAE,WAAW,CAAC,EAAE,CAAC;YAC5C,MAAM,IAAI,cAAc,CACvB,0EAA0E,EAC1E,MAAM,CAAC,EAAE,CAAC,QAAQ,IAAI,WAAW,CAAC,CAClC,CAAC;QACH,CAAC;QACD,QAAQ,IAAI,CAAC,CAAC;IACf,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC"}
package/package.json CHANGED
@@ -1,17 +1,65 @@
1
1
  {
2
2
  "name": "aae-protocol",
3
- "version": "0.0.1",
4
- "description": "Accountable Agentic Execution name reservation placeholder (see repository)",
3
+ "version": "0.9.0",
4
+ "description": "Accountable Agentic Execution \u2014 protocol SDK for TypeScript",
5
5
  "license": "MIT OR Apache-2.0",
6
- "author": "Brent Ellis <brent@r3motely.com>",
6
+ "author": "Brent Ellis <brent@r3motely.net>",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/r3moteBee/aae.git"
9
+ "url": "https://github.com/r3moteBee/aae.git",
10
+ "directory": "sdks/typescript"
10
11
  },
11
12
  "homepage": "https://github.com/r3moteBee/aae",
12
- "keywords": ["agent", "ai", "governance", "policy", "audit", "aae"],
13
+ "bugs": "https://github.com/r3moteBee/aae/issues",
14
+ "keywords": [
15
+ "agent",
16
+ "ai",
17
+ "governance",
18
+ "policy",
19
+ "audit",
20
+ "aae"
21
+ ],
13
22
  "type": "module",
14
- "main": "./index.js",
15
- "files": ["index.js", "README.md"],
16
- "engines": { "node": ">=20" }
23
+ "main": "./dist/index.js",
24
+ "module": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.js"
30
+ },
31
+ "./hashchain": {
32
+ "types": "./dist/hashchain.d.ts",
33
+ "import": "./dist/hashchain.js"
34
+ }
35
+ },
36
+ "files": [
37
+ "dist",
38
+ "README.md",
39
+ "../../LICENSE-MIT",
40
+ "../../LICENSE-APACHE"
41
+ ],
42
+ "engines": {
43
+ "node": ">=20"
44
+ },
45
+ "scripts": {
46
+ "build": "tsc -p tsconfig.json",
47
+ "test": "vitest run",
48
+ "test:conformance": "vitest run test/conformance.test.ts",
49
+ "lint": "biome check src test",
50
+ "produce-chain": "node scripts/produce-chain.mjs",
51
+ "verify-chain": "node scripts/verify-chain.mjs"
52
+ },
53
+ "dependencies": {
54
+ "zod": "^3.23.0",
55
+ "ulid": "^2.3.0",
56
+ "json-canonicalize": "^1.0.6",
57
+ "jose": "^5.6.0"
58
+ },
59
+ "devDependencies": {
60
+ "@biomejs/biome": "^1.8.0",
61
+ "@types/node": "^20.14.0",
62
+ "typescript": "^5.5.0",
63
+ "vitest": "^1.6.0"
64
+ }
17
65
  }
package/index.js DELETED
@@ -1,4 +0,0 @@
1
- // Name-reservation placeholder for the AAE protocol SDK.
2
- // Contains no implementation. See https://github.com/r3moteBee/aae —
3
- // the real SDK ships at version 0.7.0 and later.
4
- export const VERSION = "0.0.1";