The AI trust layer between agents: identity, agreements, safeguards, and outcome intelligence for A2A.

Viewing files at commit 1da1b7ef4016Commit detailsView latest

scripts/export-schemas.ts 44 lines · 1.3 KB · typescript
1
import { mkdir, writeFile } from 'node:fs/promises';
2
import { z } from 'zod';
3
import {
4
  AgentIdentitySchema,
5
  AgentPresenceSchema,
6
  AgentTransportSchema,
7
  DelegationCredentialSchema,
8
  ExpectationManifestSchema,
9
  FactCheckResultSchema,
10
  FeedbackSchema,
11
  InteractionContractSchema,
12
  InteractionEventSchema,
13
  FederatedInteractionSchema,
14
  PublicAgentCardSchema,
15
  ReceiptSchema,
16
  RiskDecisionSchema,
17
  TrustEnvelopeSchema,
18
} from '@openclasp/protocol';
19
20
const schemas = {
21
  agent_identity: AgentIdentitySchema,
22
  delegation_credential: DelegationCredentialSchema,
23
  expectation_manifest: ExpectationManifestSchema,
24
  interaction_contract: InteractionContractSchema,
25
  trust_envelope: TrustEnvelopeSchema,
26
  interaction_event: InteractionEventSchema,
27
  fact_check_result: FactCheckResultSchema,
28
  receipt: ReceiptSchema,
29
  feedback: FeedbackSchema,
30
  risk_decision: RiskDecisionSchema,
31
  agent_transport: AgentTransportSchema,
32
  agent_presence: AgentPresenceSchema,
33
  public_agent_card: PublicAgentCardSchema,
34
  federated_interaction: FederatedInteractionSchema,
35
};
36
await mkdir('schemas/v0.1', { recursive: true });
37
await Promise.all(
38
  Object.entries(schemas).map(([name, schema]) =>
39
    writeFile(
40
      `schemas/v0.1/${name}.schema.json`,
41
      `${JSON.stringify(z.toJSONSchema(schema, { target: 'draft-2020-12' }), null, 2)}\n`,
42
    ),
43
  ),
44
);