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

Viewing files at commit 578449aaa53eCommit detailsView latest

scripts/export-schemas.ts 106 lines · 3.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
  AssuranceClaimOutcomeComparisonSchema,
10
  AssuranceDecisionSchema,
11
  AssuranceEffectivenessEvaluationSchema,
12
  AssurancePredictionSnapshotSchema,
13
  AssuranceProbeA2APayloadSchema,
14
  AssuranceProbePlanSchema,
15
  AssuranceProbeResponseSchema,
16
  AssuranceResponseA2APayloadSchema,
17
  AssuranceSafeguardSchema,
18
  BehaviouralProfileDeltaSchema,
19
  ContextualReliabilitySummarySchema,
20
  CompletionOutcomeSchema,
21
  CounterpartyBriefSchema,
22
  ContractRevisionSchema,
23
  DelegationCredentialSchema,
24
  ExpectationManifestSchema,
25
  FactCheckResultSchema,
26
  FeedbackSchema,
27
  FeedbackDimensionSchema,
28
  FeedbackRequestSchema,
29
  InteractionContractSchema,
30
  InteractionCompletionReportSchema,
31
  InteractionConclusionSchema,
32
  InteractionEventSchema,
33
  InteractionFeedbackSchema,
34
  FederatedInteractionSchema,
35
  LiveSessionAcceptanceSchema,
36
  LiveSessionActivationSchema,
37
  LiveSessionEventSchema,
38
  LiveSessionOfferSchema,
39
  LiveSessionStateRecordSchema,
40
  PublicAgentCardSchema,
41
  RequirementAssessmentSchema,
42
  ReceiptSchema,
43
  RecordAttestationSchema,
44
  RiskDecisionSchema,
45
  SourceRecordEnvelopeSchema,
46
  SuccessCriterionAssessmentSchema,
47
  TrustEnvelopeSchema,
48
  LearningEligibilityDecisionSchema,
49
} from '@openclasp/protocol';
50
51
const schemas = {
52
  agent_identity: AgentIdentitySchema,
53
  agent_resolution: AgentResolutionSchema,
54
  delegation_credential: DelegationCredentialSchema,
55
  expectation_manifest: ExpectationManifestSchema,
56
  interaction_contract: InteractionContractSchema,
57
  contract_revision: ContractRevisionSchema,
58
  trust_envelope: TrustEnvelopeSchema,
59
  interaction_event: InteractionEventSchema,
60
  fact_check_result: FactCheckResultSchema,
61
  receipt: ReceiptSchema,
62
  record_attestation: RecordAttestationSchema,
63
  feedback: FeedbackSchema,
64
  risk_decision: RiskDecisionSchema,
65
  agent_transport: AgentTransportSchema,
66
  agent_presence: AgentPresenceSchema,
67
  agent_mode: AgentModeSchema,
68
  public_agent_card: PublicAgentCardSchema,
69
  assurance_probe_plan: AssuranceProbePlanSchema,
70
  assurance_probe_response: AssuranceProbeResponseSchema,
71
  assurance_claim_outcome_comparison: AssuranceClaimOutcomeComparisonSchema,
72
  assurance_decision: AssuranceDecisionSchema,
73
  assurance_prediction_snapshot: AssurancePredictionSnapshotSchema,
74
  assurance_safeguard: AssuranceSafeguardSchema,
75
  assurance_effectiveness_evaluation: AssuranceEffectivenessEvaluationSchema,
76
  assurance_probe_a2a_payload: AssuranceProbeA2APayloadSchema,
77
  assurance_response_a2a_payload: AssuranceResponseA2APayloadSchema,
78
  federated_interaction: FederatedInteractionSchema,
79
  live_session_offer: LiveSessionOfferSchema,
80
  live_session_acceptance: LiveSessionAcceptanceSchema,
81
  live_session_activation: LiveSessionActivationSchema,
82
  live_session_event: LiveSessionEventSchema,
83
  live_session_state_record: LiveSessionStateRecordSchema,
84
  requirement_assessment: RequirementAssessmentSchema,
85
  counterparty_brief: CounterpartyBriefSchema,
86
  completion_outcome: CompletionOutcomeSchema,
87
  success_criterion_assessment: SuccessCriterionAssessmentSchema,
88
  interaction_completion_report: InteractionCompletionReportSchema,
89
  feedback_dimension: FeedbackDimensionSchema,
90
  feedback_request: FeedbackRequestSchema,
91
  interaction_feedback: InteractionFeedbackSchema,
92
  interaction_conclusion: InteractionConclusionSchema,
93
  learning_eligibility_decision: LearningEligibilityDecisionSchema,
94
  behavioural_profile_delta: BehaviouralProfileDeltaSchema,
95
  contextual_reliability_summary: ContextualReliabilitySummarySchema,
96
  source_record_envelope: SourceRecordEnvelopeSchema,
97
};
98
await mkdir('schemas/v0.1', { recursive: true });
99
await Promise.all(
100
  Object.entries(schemas).map(([name, schema]) =>
101
    writeFile(
102
      `schemas/v0.1/${name}.schema.json`,
103
      `${JSON.stringify(z.toJSONSchema(schema, { target: 'draft-2020-12' }), null, 2)}\n`,
104
    ),
105
  ),
106
);