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

Viewing files at commit 2307e7ec1ffeCommit detailsView latest

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