| 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 | ShieldAnalysisSchema,
|
| 46 | ShieldCaseSchema,
|
| 47 | ShieldConsultationSchema,
|
| 48 | ShieldOutcomeSchema,
|
| 49 | SourceRecordEnvelopeSchema,
|
| 50 | SuccessCriterionAssessmentSchema,
|
| 51 | TrustEnvelopeSchema,
|
| 52 | LearningEligibilityDecisionSchema,
|
| 53 | } from '@openclasp/protocol';
|
| 54 |
|
| 55 | const schemas = {
|
| 56 | agent_identity: AgentIdentitySchema,
|
| 57 | agent_resolution: AgentResolutionSchema,
|
| 58 | delegation_credential: DelegationCredentialSchema,
|
| 59 | expectation_manifest: ExpectationManifestSchema,
|
| 60 | interaction_contract: InteractionContractSchema,
|
| 61 | contract_revision: ContractRevisionSchema,
|
| 62 | trust_envelope: TrustEnvelopeSchema,
|
| 63 | interaction_event: InteractionEventSchema,
|
| 64 | fact_check_result: FactCheckResultSchema,
|
| 65 | receipt: ReceiptSchema,
|
| 66 | record_attestation: RecordAttestationSchema,
|
| 67 | feedback: FeedbackSchema,
|
| 68 | risk_decision: RiskDecisionSchema,
|
| 69 | shield_case: ShieldCaseSchema,
|
| 70 | shield_analysis: ShieldAnalysisSchema,
|
| 71 | shield_consultation: ShieldConsultationSchema,
|
| 72 | shield_outcome: ShieldOutcomeSchema,
|
| 73 | agent_transport: AgentTransportSchema,
|
| 74 | agent_presence: AgentPresenceSchema,
|
| 75 | agent_mode: AgentModeSchema,
|
| 76 | public_agent_card: PublicAgentCardSchema,
|
| 77 | assurance_probe_plan: AssuranceProbePlanSchema,
|
| 78 | assurance_probe_response: AssuranceProbeResponseSchema,
|
| 79 | assurance_claim_outcome_comparison: AssuranceClaimOutcomeComparisonSchema,
|
| 80 | assurance_decision: AssuranceDecisionSchema,
|
| 81 | assurance_prediction_snapshot: AssurancePredictionSnapshotSchema,
|
| 82 | assurance_safeguard: AssuranceSafeguardSchema,
|
| 83 | assurance_effectiveness_evaluation: AssuranceEffectivenessEvaluationSchema,
|
| 84 | assurance_probe_a2a_payload: AssuranceProbeA2APayloadSchema,
|
| 85 | assurance_response_a2a_payload: AssuranceResponseA2APayloadSchema,
|
| 86 | federated_interaction: FederatedInteractionSchema,
|
| 87 | live_session_offer: LiveSessionOfferSchema,
|
| 88 | live_session_acceptance: LiveSessionAcceptanceSchema,
|
| 89 | live_session_activation: LiveSessionActivationSchema,
|
| 90 | live_session_event: LiveSessionEventSchema,
|
| 91 | live_session_state_record: LiveSessionStateRecordSchema,
|
| 92 | requirement_assessment: RequirementAssessmentSchema,
|
| 93 | counterparty_brief: CounterpartyBriefSchema,
|
| 94 | completion_outcome: CompletionOutcomeSchema,
|
| 95 | success_criterion_assessment: SuccessCriterionAssessmentSchema,
|
| 96 | interaction_completion_report: InteractionCompletionReportSchema,
|
| 97 | feedback_dimension: FeedbackDimensionSchema,
|
| 98 | feedback_request: FeedbackRequestSchema,
|
| 99 | interaction_feedback: InteractionFeedbackSchema,
|
| 100 | interaction_conclusion: InteractionConclusionSchema,
|
| 101 | learning_eligibility_decision: LearningEligibilityDecisionSchema,
|
| 102 | behavioural_profile_delta: BehaviouralProfileDeltaSchema,
|
| 103 | contextual_reliability_summary: ContextualReliabilitySummarySchema,
|
| 104 | source_record_envelope: SourceRecordEnvelopeSchema,
|
| 105 | };
|
| 106 | await mkdir('schemas/v0.1', { recursive: true });
|
| 107 | await Promise.all(
|
| 108 | Object.entries(schemas).map(([name, schema]) =>
|
| 109 | writeFile(
|
| 110 | `schemas/v0.1/${name}.schema.json`,
|
| 111 | `${JSON.stringify(z.toJSONSchema(schema, { target: 'draft-2020-12' }), null, 2)}\n`,
|
| 112 | ),
|
| 113 | ),
|
| 114 | );
|