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

Viewing files at commit 1f74f1f0e3abCommit detailsView latest

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