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

Viewing files at commit 989559e001cdCommit detailsView latest

scripts/export-schemas.ts 46 lines · 1.4 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
  RuntimeDeliverySchema,
18
  TrustEnvelopeSchema,
19
} from '@openclasp/protocol';
20
21
const schemas = {
22
  agent_identity: AgentIdentitySchema,
23
  delegation_credential: DelegationCredentialSchema,
24
  expectation_manifest: ExpectationManifestSchema,
25
  interaction_contract: InteractionContractSchema,
26
  trust_envelope: TrustEnvelopeSchema,
27
  interaction_event: InteractionEventSchema,
28
  fact_check_result: FactCheckResultSchema,
29
  receipt: ReceiptSchema,
30
  feedback: FeedbackSchema,
31
  risk_decision: RiskDecisionSchema,
32
  agent_transport: AgentTransportSchema,
33
  agent_presence: AgentPresenceSchema,
34
  runtime_delivery: RuntimeDeliverySchema,
35
  public_agent_card: PublicAgentCardSchema,
36
  federated_interaction: FederatedInteractionSchema,
37
};
38
await mkdir('schemas/v0.1', { recursive: true });
39
await Promise.all(
40
  Object.entries(schemas).map(([name, schema]) =>
41
    writeFile(
42
      `schemas/v0.1/${name}.schema.json`,
43
      `${JSON.stringify(z.toJSONSchema(schema, { target: 'draft-2020-12' }), null, 2)}\n`,
44
    ),
45
  ),
46
);