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

Viewing files at commit e4047161f2b3Commit detailsView latest

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