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

Viewing files at commit b95ad82c1c50Commit detailsView latest

scripts/export-schemas.ts 86 lines · 2.9 KB · typescript
1
import { mkdir, writeFile } from 'node:fs/promises';
2
import { z } from 'zod';
3
import {
4
  AgentIdentitySchema,
5
  AgentResolutionSchema,
6
  AgentPresenceSchema,
7
  AgentModeSchema,
8
  AgentTransportSchema,
9
  BehaviouralProfileDeltaSchema,
10
  CompletionOutcomeSchema,
11
  CounterpartyBriefSchema,
12
  ContractRevisionSchema,
13
  DelegationCredentialSchema,
14
  ExpectationManifestSchema,
15
  FactCheckResultSchema,
16
  FeedbackSchema,
17
  FeedbackDimensionSchema,
18
  FeedbackRequestSchema,
19
  InteractionContractSchema,
20
  InteractionCompletionReportSchema,
21
  InteractionConclusionSchema,
22
  InteractionEventSchema,
23
  InteractionFeedbackSchema,
24
  FederatedInteractionSchema,
25
  LiveSessionAcceptanceSchema,
26
  LiveSessionActivationSchema,
27
  LiveSessionEventSchema,
28
  LiveSessionOfferSchema,
29
  HostedMessageSchema,
30
  HostedThreadSchema,
31
  PublicAgentCardSchema,
32
  RequirementAssessmentSchema,
33
  ReceiptSchema,
34
  RecordAttestationSchema,
35
  RiskDecisionSchema,
36
  SuccessCriterionAssessmentSchema,
37
  TrustEnvelopeSchema,
38
  LearningEligibilityDecisionSchema,
39
} from '@openclasp/protocol';
40
41
const schemas = {
42
  agent_identity: AgentIdentitySchema,
43
  agent_resolution: AgentResolutionSchema,
44
  delegation_credential: DelegationCredentialSchema,
45
  expectation_manifest: ExpectationManifestSchema,
46
  interaction_contract: InteractionContractSchema,
47
  contract_revision: ContractRevisionSchema,
48
  trust_envelope: TrustEnvelopeSchema,
49
  interaction_event: InteractionEventSchema,
50
  fact_check_result: FactCheckResultSchema,
51
  receipt: ReceiptSchema,
52
  record_attestation: RecordAttestationSchema,
53
  feedback: FeedbackSchema,
54
  risk_decision: RiskDecisionSchema,
55
  agent_transport: AgentTransportSchema,
56
  agent_presence: AgentPresenceSchema,
57
  agent_mode: AgentModeSchema,
58
  public_agent_card: PublicAgentCardSchema,
59
  federated_interaction: FederatedInteractionSchema,
60
  live_session_offer: LiveSessionOfferSchema,
61
  live_session_acceptance: LiveSessionAcceptanceSchema,
62
  live_session_activation: LiveSessionActivationSchema,
63
  live_session_event: LiveSessionEventSchema,
64
  hosted_message: HostedMessageSchema,
65
  hosted_thread: HostedThreadSchema,
66
  requirement_assessment: RequirementAssessmentSchema,
67
  counterparty_brief: CounterpartyBriefSchema,
68
  completion_outcome: CompletionOutcomeSchema,
69
  success_criterion_assessment: SuccessCriterionAssessmentSchema,
70
  interaction_completion_report: InteractionCompletionReportSchema,
71
  feedback_dimension: FeedbackDimensionSchema,
72
  feedback_request: FeedbackRequestSchema,
73
  interaction_feedback: InteractionFeedbackSchema,
74
  interaction_conclusion: InteractionConclusionSchema,
75
  learning_eligibility_decision: LearningEligibilityDecisionSchema,
76
  behavioural_profile_delta: BehaviouralProfileDeltaSchema,
77
};
78
await mkdir('schemas/v0.1', { recursive: true });
79
await Promise.all(
80
  Object.entries(schemas).map(([name, schema]) =>
81
    writeFile(
82
      `schemas/v0.1/${name}.schema.json`,
83
      `${JSON.stringify(z.toJSONSchema(schema, { target: 'draft-2020-12' }), null, 2)}\n`,
84
    ),
85
  ),
86
);