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