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

Viewing files at commit f87848a4fcb8Commit detailsView latest

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