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

Viewing files at commit af23d8c9b675Commit detailsView latest

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