percolation-inversion-compiler-ts 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +152 -0
- package/NOTICE +21 -0
- package/README.md +255 -0
- package/dist/agent/messages.d.ts +23 -0
- package/dist/agent/messages.js +457 -0
- package/dist/cli/main.d.ts +1 -0
- package/dist/cli/main.js +2646 -0
- package/dist/index.d.ts +91 -0
- package/dist/index.js +983 -0
- package/dist/io/schema.d.ts +16 -0
- package/dist/io/schema.js +153 -0
- package/dist/packet/index.d.ts +10 -0
- package/dist/packet/index.js +385 -0
- package/fixtures/portability_conformance/README.md +17 -0
- package/fixtures/portability_conformance/agent_check_report.json +1251 -0
- package/fixtures/portability_conformance/agent_intake_report.json +1169 -0
- package/fixtures/portability_conformance/agent_message_delivery_report.json +124 -0
- package/fixtures/portability_conformance/agent_relay_readiness_report.json +40 -0
- package/fixtures/portability_conformance/alt_admission_decision.json +16 -0
- package/fixtures/portability_conformance/bottleneck_witness_report.json +23 -0
- package/fixtures/portability_conformance/collective_phase_certificate.json +330 -0
- package/fixtures/portability_conformance/frontier_debt_report.json +24 -0
- package/fixtures/portability_conformance/manifest.json +113 -0
- package/fixtures/portability_conformance/negative/checksum_mismatch.json +4 -0
- package/fixtures/portability_conformance/negative/schema_invalid_agent_check.json +3 -0
- package/fixtures/portability_conformance/negative/unknown_schema.json +3 -0
- package/fixtures/portability_conformance/phase_acceleration_benchmark_report.json +21 -0
- package/fixtures/portability_conformance/phase_acceleration_plan.json +72 -0
- package/fixtures/portability_conformance/phase_control_audit_summary.json +16 -0
- package/fixtures/portability_conformance/relay_inbox.json +37 -0
- package/fixtures/portability_conformance/runtime_step_report.json +1384 -0
- package/fixtures/portability_conformance/salience_schedule_report.json +100 -0
- package/fixtures/portability_conformance/theory_fidelity_report.json +53 -0
- package/fixtures/portability_conformance/value_bridge_report.json +17 -0
- package/fixtures/python_v044_cli/adoption_packet.json +131 -0
- package/fixtures/python_v044_cli/adoption_request.json +60 -0
- package/fixtures/python_v044_cli/agent_autonomy_audit.json +254 -0
- package/fixtures/python_v044_cli/agent_check_compact.json +80 -0
- package/fixtures/python_v044_cli/agent_check_full.json +1265 -0
- package/fixtures/python_v044_cli/agent_communication_guide.json +426 -0
- package/fixtures/python_v044_cli/agent_intake.json +1175 -0
- package/fixtures/python_v044_cli/agent_manifest.json +373 -0
- package/fixtures/python_v044_cli/agent_runbook.json +115 -0
- package/fixtures/python_v044_cli/demo_installed_smoke.json +1367 -0
- package/fixtures/python_v044_cli/doctor_development.json +264 -0
- package/fixtures/python_v044_cli/identity_explain_profile_production.json +39 -0
- package/fixtures/python_v044_cli/phase_benchmark.json +42 -0
- package/fixtures/python_v044_cli/phase_benchmark_suite.json +428 -0
- package/fixtures/python_v044_cli/phase_dashboard.json +173 -0
- package/fixtures/python_v044_cli/phase_gap.json +119 -0
- package/fixtures/python_v044_cli/phase_observe.json +203 -0
- package/fixtures/python_v044_cli/phase_plan_compact.json +384 -0
- package/fixtures/python_v044_cli/phase_plan_full.json +2020 -0
- package/fixtures/python_v044_cli/phase_runbook.json +66 -0
- package/fixtures/python_v044_cli/routes_bindings.json +716 -0
- package/fixtures/python_v044_cli/routes_explain_replay_trc_physical_trace.json +57 -0
- package/fixtures/python_v044_cli/runtime_step_demo.json +1384 -0
- package/fixtures/python_v044_cli/snapshot_list.json +112 -0
- package/fixtures/python_v044_cli/snapshot_routes.json +926 -0
- package/fixtures/python_v044_cli/snapshot_show_alt.json +6830 -0
- package/fixtures/python_v044_cli/snapshot_show_bit.json +594 -0
- package/fixtures/python_v044_cli/snapshot_show_ecpt.json +2894 -0
- package/fixtures/python_v044_cli/snapshot_show_sqot.json +2392 -0
- package/fixtures/python_v044_cli/snapshot_show_trc.json +3037 -0
- package/fixtures/python_v044_cli/snapshot_verify_alt.json +10 -0
- package/fixtures/python_v044_cli/snapshot_verify_bit.json +10 -0
- package/fixtures/python_v044_cli/snapshot_verify_ecpt.json +10 -0
- package/fixtures/python_v044_cli/snapshot_verify_sqot.json +10 -0
- package/fixtures/python_v044_cli/snapshot_verify_trc.json +10 -0
- package/fixtures/python_v044_demo/agent_inbox.json +26 -0
- package/fixtures/python_v044_demo/agent_message.json +19 -0
- package/fixtures/python_v044_demo/agent_output.txt +1 -0
- package/fixtures/python_v044_demo/alt_admission_packet.json +208 -0
- package/fixtures/python_v044_demo/asi_proxy_phase_request.json +47 -0
- package/fixtures/python_v044_demo/general_intake_policy.json +58 -0
- package/fixtures/python_v044_demo/manifest.json +78 -0
- package/fixtures/python_v044_demo/packet_envelope.json +1463 -0
- package/fixtures/python_v044_demo/phase_dashboard.json +175 -0
- package/fixtures/python_v044_demo/runtime_state.json +143 -0
- package/fixtures/python_v044_demo/runtime_step_input.json +8 -0
- package/fixtures/python_v044_demo/runtime_step_report.json +1384 -0
- package/fixtures/python_v044_snapshots/alt.json +6830 -0
- package/fixtures/python_v044_snapshots/bit.json +543 -0
- package/fixtures/python_v044_snapshots/ecpt.json +2741 -0
- package/fixtures/python_v044_snapshots/sqot.json +2134 -0
- package/fixtures/python_v044_snapshots/trc.json +2880 -0
- package/package.json +129 -0
- package/schemas/ALTAccelerationCertificate.schema.json +169 -0
- package/schemas/ALTAdmissionDecision.schema.json +199 -0
- package/schemas/ALTCARACertificate.schema.json +285 -0
- package/schemas/ALTDeprecationRecord.schema.json +171 -0
- package/schemas/ALTKernelTransitionReport.schema.json +185 -0
- package/schemas/ALTResurrectionRecord.schema.json +171 -0
- package/schemas/ASIProxyTargetContract.schema.json +52 -0
- package/schemas/AbstractionToken.schema.json +281 -0
- package/schemas/AccelerationCertificate.schema.json +225 -0
- package/schemas/AccelerationExperimentSuite.schema.json +3731 -0
- package/schemas/AcceptedPacketPath.schema.json +148 -0
- package/schemas/ActionCommit.schema.json +67 -0
- package/schemas/ActionGrammar.schema.json +36 -0
- package/schemas/ActionabilityVector.schema.json +33 -0
- package/schemas/ActivationThresholdCertificate.schema.json +185 -0
- package/schemas/AdapterRouteSpec.schema.json +110 -0
- package/schemas/AdoptionFirstRunCommand.schema.json +44 -0
- package/schemas/AdoptionReviewChecklist.schema.json +36 -0
- package/schemas/AdoptionSafetyBoundary.schema.json +104 -0
- package/schemas/AgentAutonomyAuditReport.schema.json +213 -0
- package/schemas/AgentCheckReport.schema.json +3494 -0
- package/schemas/AgentCommandInvocation.schema.json +63 -0
- package/schemas/AgentCommunicationGuide.schema.json +213 -0
- package/schemas/AgentCommunicationPolicy.schema.json +73 -0
- package/schemas/AgentCommunicationStep.schema.json +85 -0
- package/schemas/AgentConnectorSpec.schema.json +89 -0
- package/schemas/AgentFeatureReadinessReport.schema.json +206 -0
- package/schemas/AgentIdentityAttestation.schema.json +99 -0
- package/schemas/AgentIdentityCheckReport.schema.json +225 -0
- package/schemas/AgentInboxRecord.schema.json +319 -0
- package/schemas/AgentIntakeReport.schema.json +3373 -0
- package/schemas/AgentIntakeRequest.schema.json +2250 -0
- package/schemas/AgentMessageContractReport.schema.json +195 -0
- package/schemas/AgentMessageDeliveryReport.schema.json +630 -0
- package/schemas/AgentMessageEnvelope.schema.json +201 -0
- package/schemas/AgentMessageNonceLedger.schema.json +45 -0
- package/schemas/AgentMessageVerificationContext.schema.json +60 -0
- package/schemas/AgentNetworkReadinessReport.schema.json +109 -0
- package/schemas/AgentNextActionReport.schema.json +83 -0
- package/schemas/AgentPacketExchangeReport.schema.json +519 -0
- package/schemas/AgentPeerRecord.schema.json +85 -0
- package/schemas/AgentPolicyIdentity.schema.json +79 -0
- package/schemas/AgentPopulationState.schema.json +2523 -0
- package/schemas/AgentRelayReadinessReport.schema.json +125 -0
- package/schemas/AgentRunbookReport.schema.json +100 -0
- package/schemas/AgentRuntimeConfig.schema.json +78 -0
- package/schemas/AgentTask.schema.json +101 -0
- package/schemas/AgentToOperatorRequest.schema.json +222 -0
- package/schemas/AgentWorkflowGuide.schema.json +128 -0
- package/schemas/AgentWorkflowStep.schema.json +59 -0
- package/schemas/AlgebraLawCertificate.schema.json +101 -0
- package/schemas/AttestationRecord.schema.json +63 -0
- package/schemas/AutocatalyticClosureWitness.schema.json +187 -0
- package/schemas/BaselineRefreshCertificate.schema.json +178 -0
- package/schemas/BasinReachabilityReport.schema.json +244 -0
- package/schemas/BottleneckCandidate.schema.json +105 -0
- package/schemas/BottleneckIntervention.schema.json +157 -0
- package/schemas/BottleneckInversionPlan.schema.json +212 -0
- package/schemas/BottleneckWitnessReport.schema.json +128 -0
- package/schemas/BoundaryGeneratorRecord.schema.json +57 -0
- package/schemas/BoundaryScriptRecord.schema.json +30 -0
- package/schemas/BudgetedToleranceScheduler.schema.json +59 -0
- package/schemas/CalibrationCertificate.schema.json +252 -0
- package/schemas/CanonicalImplementationReadinessReport.schema.json +298 -0
- package/schemas/CanonicalManifest.schema.json +80 -0
- package/schemas/CanonicalManifestRecord.schema.json +54 -0
- package/schemas/CanonicalTheorySnapshotSummary.schema.json +102 -0
- package/schemas/CapabilityBasinContract.schema.json +59 -0
- package/schemas/CapabilityPacketCandidate.schema.json +247 -0
- package/schemas/CapabilityPacketRegistry.schema.json +442 -0
- package/schemas/CapabilityStateVector.schema.json +169 -0
- package/schemas/CascadeResidualPotential.schema.json +32 -0
- package/schemas/CertificateCompilerRecord.schema.json +81 -0
- package/schemas/CertificateFamily.schema.json +376 -0
- package/schemas/CertificateRoute.schema.json +128 -0
- package/schemas/CertifiedAbstractionCapital.schema.json +161 -0
- package/schemas/CheckResult.schema.json +369 -0
- package/schemas/CheckerContext.schema.json +255 -0
- package/schemas/ClosedLoopAgentIteration.schema.json +1045 -0
- package/schemas/CollectivePhaseCertificate.schema.json +1377 -0
- package/schemas/CommercialReadinessSummary.schema.json +134 -0
- package/schemas/ConfidenceLedger.schema.json +26 -0
- package/schemas/ContentAddressedEvidenceRef.schema.json +48 -0
- package/schemas/ControlledTransition.schema.json +90 -0
- package/schemas/CryptographicAgentIdentity.schema.json +192 -0
- package/schemas/DKWCertificate.schema.json +31 -0
- package/schemas/DiagnosticReservePolicy.schema.json +22 -0
- package/schemas/DischargeRouteBinding.schema.json +93 -0
- package/schemas/DomainTypedSemiring.schema.json +55 -0
- package/schemas/DominanceWitness.schema.json +31 -0
- package/schemas/EProcessCertificate.schema.json +22 -0
- package/schemas/EdgeRelationVerificationReport.schema.json +161 -0
- package/schemas/EdgeRelationVerifierSpec.schema.json +62 -0
- package/schemas/EdgeWitness.schema.json +73 -0
- package/schemas/EdgeWitnessCertificate.schema.json +192 -0
- package/schemas/EvidenceArtifact.schema.json +112 -0
- package/schemas/EvidenceEnvelopeStoreRecord.schema.json +100 -0
- package/schemas/EvidencePolicy.schema.json +57 -0
- package/schemas/EvidenceResolutionBatch.schema.json +347 -0
- package/schemas/EvidenceVerificationProfile.schema.json +74 -0
- package/schemas/ExecutableALTCertificatePacket.schema.json +1512 -0
- package/schemas/ExecutableTraceNormalForm.schema.json +659 -0
- package/schemas/ExecutionAvailablePathCertificate.schema.json +204 -0
- package/schemas/ExternalCandidateClassification.schema.json +10 -0
- package/schemas/ExternalObligationCatalog.schema.json +238 -0
- package/schemas/ExternalVerifierHook.schema.json +174 -0
- package/schemas/FiniteOrder.schema.json +34 -0
- package/schemas/FinitePhaseControlCertificate.schema.json +100 -0
- package/schemas/FiniteTraceLaw.schema.json +30 -0
- package/schemas/FixedPopulationLedger.schema.json +255 -0
- package/schemas/FormationCostLedger.schema.json +91 -0
- package/schemas/FoundryControlDashboard.schema.json +198 -0
- package/schemas/FoundryState.schema.json +1819 -0
- package/schemas/FrontierDebtReport.schema.json +115 -0
- package/schemas/FunctorLawCertificate.schema.json +82 -0
- package/schemas/FusedGeometricComparisonCertificate.schema.json +79 -0
- package/schemas/FutureFreedomVector.schema.json +84 -0
- package/schemas/GeneralIntakePolicy.schema.json +255 -0
- package/schemas/GeneralIntakePolicyDecision.schema.json +85 -0
- package/schemas/GeneralIntakeProfile.schema.json +11 -0
- package/schemas/GeneralIntakeReport.schema.json +861 -0
- package/schemas/GeneralIntakeRuntimeBridgeReport.schema.json +761 -0
- package/schemas/GeneralIntakeSource.schema.json +57 -0
- package/schemas/GoodTuringCertificate.schema.json +27 -0
- package/schemas/HazardEnvelopeCertificate.schema.json +192 -0
- package/schemas/HiddenCapabilityInjectionReport.schema.json +212 -0
- package/schemas/IdentityContributionStatus.schema.json +11 -0
- package/schemas/IdentityTrustProfile.schema.json +12 -0
- package/schemas/ImplementationMaturity.schema.json +27 -0
- package/schemas/IndependenceCertificate.schema.json +42 -0
- package/schemas/InnerViabilityKernel.schema.json +45 -0
- package/schemas/IntakeProvenanceRecord.schema.json +192 -0
- package/schemas/InterventionCandidate.schema.json +266 -0
- package/schemas/Judgment.schema.json +351 -0
- package/schemas/LatticeWitness.schema.json +63 -0
- package/schemas/LedgerCoordinate.schema.json +79 -0
- package/schemas/LifecycleCostBounds.schema.json +65 -0
- package/schemas/LiquidityCertificate.schema.json +1094 -0
- package/schemas/MartingaleBlockResidual.schema.json +32 -0
- package/schemas/MartingaleDeficiencyCertificate.schema.json +76 -0
- package/schemas/MechanismCubeCertificate.schema.json +92 -0
- package/schemas/MissionValidityCertificate.schema.json +153 -0
- package/schemas/MonoidRecord.schema.json +30 -0
- package/schemas/MonotoneMap.schema.json +61 -0
- package/schemas/NegativeLiquidityCertificate.schema.json +176 -0
- package/schemas/NonPromotionPolicy.schema.json +39 -0
- package/schemas/ObligationRule.schema.json +54 -0
- package/schemas/ObligationSet.schema.json +230 -0
- package/schemas/ObligationTrace.schema.json +156 -0
- package/schemas/ObservationWindow.schema.json +48 -0
- package/schemas/ObservedTraceProjection.schema.json +57 -0
- package/schemas/OccupationLedger.schema.json +33 -0
- package/schemas/OperationalCheck.schema.json +29 -0
- package/schemas/OperationalReadinessReport.schema.json +216 -0
- package/schemas/OperatorAdoptionPacket.schema.json +303 -0
- package/schemas/OpportunityMeasureContract.schema.json +165 -0
- package/schemas/OrderedPotentialCone.schema.json +125 -0
- package/schemas/PacketCapitalLineage.schema.json +90 -0
- package/schemas/PacketExchangeEnvelope.schema.json +213 -0
- package/schemas/PacketImportInspectionReport.schema.json +68 -0
- package/schemas/PacketIngestionReport.schema.json +655 -0
- package/schemas/PacketLineageDigest.schema.json +70 -0
- package/schemas/PacketMergeReport.schema.json +286 -0
- package/schemas/PacketPromotionPolicy.schema.json +47 -0
- package/schemas/PacketPromotionReport.schema.json +354 -0
- package/schemas/PacketRejection.schema.json +158 -0
- package/schemas/PhaseAccelerationBenchmarkReport.schema.json +103 -0
- package/schemas/PhaseAccelerationPlan.schema.json +4449 -0
- package/schemas/PhaseAccelerationRequest.schema.json +5333 -0
- package/schemas/PhaseAccelerationScore.schema.json +66 -0
- package/schemas/PhaseBenchmarkCaseResult.schema.json +164 -0
- package/schemas/PhaseBenchmarkSuiteReport.schema.json +234 -0
- package/schemas/PhaseBenchmarkTask.schema.json +36 -0
- package/schemas/PhaseComponentGap.schema.json +46 -0
- package/schemas/PhaseControlAction.schema.json +80 -0
- package/schemas/PhaseControlAuditSummary.schema.json +143 -0
- package/schemas/PhaseControlEnvelope.schema.json +53 -0
- package/schemas/PhaseControlObjective.schema.json +98 -0
- package/schemas/PhaseControlPlan.schema.json +377 -0
- package/schemas/PhaseControlRunReport.schema.json +425 -0
- package/schemas/PhaseControlState.schema.json +383 -0
- package/schemas/PhaseDashboardReport.schema.json +249 -0
- package/schemas/PhaseGapVector.schema.json +101 -0
- package/schemas/PhaseObservationReport.schema.json +321 -0
- package/schemas/PhaseTrajectoryReport.schema.json +4522 -0
- package/schemas/PopulationRuntimeStepReport.schema.json +5125 -0
- package/schemas/PortabilityConformanceReport.schema.json +99 -0
- package/schemas/PortabilitySchemaBundle.schema.json +23 -0
- package/schemas/ProblemSolvingTrace.schema.json +162 -0
- package/schemas/ProcessGrammarRecord.schema.json +56 -0
- package/schemas/ProductOrder.schema.json +53 -0
- package/schemas/ProductionReadinessProfile.schema.json +37 -0
- package/schemas/ProjectionAudit.schema.json +70 -0
- package/schemas/ProofObligation.schema.json +200 -0
- package/schemas/ProtocolFrameDigest.schema.json +79 -0
- package/schemas/ProtocolFunctorCertificate.schema.json +89 -0
- package/schemas/ProtocolObject.schema.json +45 -0
- package/schemas/ProtocolRelativeBenchmarkMetric.schema.json +39 -0
- package/schemas/ProvenanceManifest.schema.json +221 -0
- package/schemas/ProvenanceManifestEntry.schema.json +29 -0
- package/schemas/PsiDashboard.schema.json +213 -0
- package/schemas/PullbackGluingWitness.schema.json +43 -0
- package/schemas/QuarantineLedger.schema.json +31 -0
- package/schemas/ReachableMassRecursionCertificate.schema.json +129 -0
- package/schemas/ReconstructionResidual.schema.json +24 -0
- package/schemas/RefreshRule.schema.json +31 -0
- package/schemas/Registry.schema.json +231 -0
- package/schemas/ReleaseArtifactManifest.schema.json +62 -0
- package/schemas/ReproductionMatrixCertificate.schema.json +190 -0
- package/schemas/ResidualCarryForwardReport.schema.json +57 -0
- package/schemas/ResourceCalendarRecord.schema.json +67 -0
- package/schemas/ResourceEnvelope.schema.json +42 -0
- package/schemas/ResourceMatchedBaselineConfig.schema.json +81 -0
- package/schemas/RiskBudgetLedger.schema.json +19 -0
- package/schemas/RobotsDecision.schema.json +44 -0
- package/schemas/RootFinalityCertificate.schema.json +190 -0
- package/schemas/RouteExecutionBatch.schema.json +930 -0
- package/schemas/RouteExecutionRequest.schema.json +87 -0
- package/schemas/RuntimeActionResult.schema.json +807 -0
- package/schemas/RuntimeComparisonReport.schema.json +3670 -0
- package/schemas/RuntimeEvent.schema.json +142 -0
- package/schemas/RuntimeEventLog.schema.json +161 -0
- package/schemas/RuntimeExecutionReport.schema.json +872 -0
- package/schemas/RuntimeExecutorPolicy.schema.json +68 -0
- package/schemas/RuntimeHealthReport.schema.json +161 -0
- package/schemas/RuntimeIdentityContext.schema.json +480 -0
- package/schemas/RuntimeRunReport.schema.json +3487 -0
- package/schemas/RuntimeServiceSettings.schema.json +55 -0
- package/schemas/RuntimeState.schema.json +1438 -0
- package/schemas/RuntimeStepInput.schema.json +685 -0
- package/schemas/RuntimeStepReport.schema.json +3314 -0
- package/schemas/RuntimeStoreRecord.schema.json +106 -0
- package/schemas/RuntimeStoreSnapshot.schema.json +4815 -0
- package/schemas/SBOMManifest.schema.json +67 -0
- package/schemas/SQOTTheorySnapshot.schema.json +49 -0
- package/schemas/SafePhaseAction.schema.json +96 -0
- package/schemas/SalienceQueueRecord.schema.json +313 -0
- package/schemas/SalienceScheduleReport.schema.json +434 -0
- package/schemas/SalienceSchedulingDecision.schema.json +167 -0
- package/schemas/SchemaBundleDigest.schema.json +57 -0
- package/schemas/ScriptGroundMetricCertificate.schema.json +47 -0
- package/schemas/SelectiveCUPCertificate.schema.json +414 -0
- package/schemas/SettlementReturnRAFCertificate.schema.json +122 -0
- package/schemas/SinkhornCertificate.schema.json +55 -0
- package/schemas/SnapshotAttribution.schema.json +63 -0
- package/schemas/SnapshotCatalog.schema.json +481 -0
- package/schemas/SplitCertificate.schema.json +39 -0
- package/schemas/StatusAlgebraRecord.schema.json +37 -0
- package/schemas/StoppedEvidenceSheafCertificate.schema.json +120 -0
- package/schemas/StrictTexParseReport.schema.json +67 -0
- package/schemas/SybilResistanceLedger.schema.json +427 -0
- package/schemas/SybilResistancePolicy.schema.json +176 -0
- package/schemas/TRCCompileResult.schema.json +239 -0
- package/schemas/TRCStateRecord.schema.json +149 -0
- package/schemas/TelemetryCostCertificate.schema.json +171 -0
- package/schemas/TexGrammarDiagnostic.schema.json +39 -0
- package/schemas/TheoryAuditReport.schema.json +654 -0
- package/schemas/TheoryAuditSuiteReport.schema.json +775 -0
- package/schemas/TheoryFidelityReport.schema.json +100 -0
- package/schemas/TheoryImplementationRecord.schema.json +203 -0
- package/schemas/TheorySnapshot.schema.json +459 -0
- package/schemas/TheorySnapshotItem.schema.json +60 -0
- package/schemas/TokenLineage.schema.json +76 -0
- package/schemas/ToleranceAllocationCertificate.schema.json +62 -0
- package/schemas/TraceNormalizationCertificate.schema.json +77 -0
- package/schemas/TraceSufficiencyCertificate.schema.json +166 -0
- package/schemas/TransportCertificate.schema.json +178 -0
- package/schemas/TypedTraceTransducerRecord.schema.json +64 -0
- package/schemas/ValueBridgeReport.schema.json +131 -0
- package/schemas/VectorCompatibleFamily.schema.json +354 -0
- package/schemas/VerificationThroughputReport.schema.json +62 -0
- package/schemas/VerifiedCapabilityPacket.schema.json +251 -0
- package/schemas/VerifierEvidenceEnvelope.schema.json +178 -0
- package/schemas/VerifierResolution.schema.json +275 -0
- package/schemas/WebDiscoveryReport.schema.json +675 -0
- package/schemas/WebFetchPolicy.schema.json +145 -0
- package/schemas/WebFetchReport.schema.json +133 -0
- package/schemas/bundle.schema.json +100808 -0
- package/schemas/schema-digest.json +1674 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,983 @@
|
|
|
1
|
+
// src/core/json.ts
|
|
2
|
+
function sortJson(value) {
|
|
3
|
+
if (Array.isArray(value)) {
|
|
4
|
+
return value.map((item) => sortJson(item));
|
|
5
|
+
}
|
|
6
|
+
if (value && typeof value === "object") {
|
|
7
|
+
const input = value;
|
|
8
|
+
const output = {};
|
|
9
|
+
for (const key of Object.keys(input).sort()) {
|
|
10
|
+
const child = input[key];
|
|
11
|
+
if (child !== void 0) {
|
|
12
|
+
output[key] = sortJson(child);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return output;
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
function stableStringify(value) {
|
|
20
|
+
return `${JSON.stringify(sortJson(value), null, 2)}
|
|
21
|
+
`;
|
|
22
|
+
}
|
|
23
|
+
function lfNormalize(text) {
|
|
24
|
+
return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
25
|
+
}
|
|
26
|
+
function parseJsonObject(text, label = "JSON") {
|
|
27
|
+
const parsed = JSON.parse(text);
|
|
28
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
29
|
+
throw new Error(`${label} must be a JSON object`);
|
|
30
|
+
}
|
|
31
|
+
return parsed;
|
|
32
|
+
}
|
|
33
|
+
function dedupeSorted(values) {
|
|
34
|
+
return [
|
|
35
|
+
...new Set([...values].filter((item) => Boolean(item)))
|
|
36
|
+
].sort();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// src/core/ledger.ts
|
|
40
|
+
function residualLedger(name, value = 1, description) {
|
|
41
|
+
return {
|
|
42
|
+
coordinates: {
|
|
43
|
+
[name]: {
|
|
44
|
+
name,
|
|
45
|
+
value,
|
|
46
|
+
unit: "dimensionless",
|
|
47
|
+
kind: "residual",
|
|
48
|
+
description: description ?? null,
|
|
49
|
+
evidence_status: "declared",
|
|
50
|
+
evidence_refs: [],
|
|
51
|
+
known: true
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function summarizeLedger(ledger) {
|
|
57
|
+
const summary = {};
|
|
58
|
+
if (!ledger) {
|
|
59
|
+
return summary;
|
|
60
|
+
}
|
|
61
|
+
for (const coordinate of Object.values(ledger.coordinates ?? {})) {
|
|
62
|
+
const kind = coordinate.kind ?? "residual";
|
|
63
|
+
summary[kind] = (summary[kind] ?? 0) + Number(coordinate.value ?? 0);
|
|
64
|
+
}
|
|
65
|
+
return Object.fromEntries(
|
|
66
|
+
Object.entries(summary).sort(([a], [b]) => a.localeCompare(b))
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// src/io/fixtures.ts
|
|
71
|
+
import { readFileSync } from "fs";
|
|
72
|
+
import { join as join2, normalize, sep } from "path";
|
|
73
|
+
|
|
74
|
+
// src/io/paths.ts
|
|
75
|
+
import { existsSync } from "fs";
|
|
76
|
+
import { dirname, join, resolve } from "path";
|
|
77
|
+
import { fileURLToPath } from "url";
|
|
78
|
+
function packageRoot() {
|
|
79
|
+
let current = dirname(fileURLToPath(import.meta.url));
|
|
80
|
+
for (let i = 0; i < 8; i += 1) {
|
|
81
|
+
if (existsSync(join(current, "package.json")) && existsSync(join(current, "schemas"))) {
|
|
82
|
+
return current;
|
|
83
|
+
}
|
|
84
|
+
const next = dirname(current);
|
|
85
|
+
if (next === current) {
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
current = next;
|
|
89
|
+
}
|
|
90
|
+
return resolve(dirname(fileURLToPath(import.meta.url)), "../..");
|
|
91
|
+
}
|
|
92
|
+
function schemaDir() {
|
|
93
|
+
return join(packageRoot(), "schemas");
|
|
94
|
+
}
|
|
95
|
+
function fixtureRoot() {
|
|
96
|
+
return join(packageRoot(), "fixtures");
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/io/fixtures.ts
|
|
100
|
+
function safeFixturePath(...parts) {
|
|
101
|
+
const root = normalize(fixtureRoot());
|
|
102
|
+
const normalized = normalize(join2(root, ...parts));
|
|
103
|
+
if (normalized !== root && !normalized.startsWith(`${root}${sep}`)) {
|
|
104
|
+
throw new Error("fixture path escapes package fixtures");
|
|
105
|
+
}
|
|
106
|
+
return normalized;
|
|
107
|
+
}
|
|
108
|
+
function fixtureText(namespace, file) {
|
|
109
|
+
if (namespace.includes("..") || file.includes("..")) {
|
|
110
|
+
throw new Error("fixture path must not contain parent traversal");
|
|
111
|
+
}
|
|
112
|
+
return readFileSync(safeFixturePath(namespace, file), "utf8");
|
|
113
|
+
}
|
|
114
|
+
function fixtureJsonFrom(namespace, file) {
|
|
115
|
+
return parseJsonObject(fixtureText(namespace, file), `${namespace}/${file}`);
|
|
116
|
+
}
|
|
117
|
+
function pythonCliFixture(name) {
|
|
118
|
+
if (!/^[a-z0-9_]+$/.test(name)) {
|
|
119
|
+
throw new Error(
|
|
120
|
+
`invalid Python v0.4.4 CLI fixture ${JSON.stringify(name)}`
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
return fixtureJsonFrom("python_v044_cli", `${name}.json`);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// src/phase/index.ts
|
|
127
|
+
import { existsSync as existsSync3, readFileSync as readFileSync4 } from "fs";
|
|
128
|
+
|
|
129
|
+
// src/io/schema.ts
|
|
130
|
+
import {
|
|
131
|
+
cpSync,
|
|
132
|
+
existsSync as existsSync2,
|
|
133
|
+
mkdirSync,
|
|
134
|
+
readdirSync,
|
|
135
|
+
readFileSync as readFileSync2,
|
|
136
|
+
writeFileSync
|
|
137
|
+
} from "fs";
|
|
138
|
+
import { basename, join as join3 } from "path";
|
|
139
|
+
import Ajv2020Module from "ajv/dist/2020.js";
|
|
140
|
+
var PUBLIC_SCHEMA_NAME = /^[A-Za-z][A-Za-z0-9]*$/;
|
|
141
|
+
function assertSchemaTypeName(typeName) {
|
|
142
|
+
if (!PUBLIC_SCHEMA_NAME.test(typeName)) {
|
|
143
|
+
throw new Error(`unknown schema type ${JSON.stringify(typeName)}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function schemaPath(typeName) {
|
|
147
|
+
assertSchemaTypeName(typeName);
|
|
148
|
+
return join3(schemaDir(), `${typeName}.schema.json`);
|
|
149
|
+
}
|
|
150
|
+
function schemaNames() {
|
|
151
|
+
return readdirSync(schemaDir()).filter(
|
|
152
|
+
(name) => name.endsWith(".schema.json") && name !== "bundle.schema.json"
|
|
153
|
+
).map((name) => name.slice(0, -".schema.json".length)).sort();
|
|
154
|
+
}
|
|
155
|
+
function schemaByType(typeName = "Registry") {
|
|
156
|
+
const path = schemaPath(typeName);
|
|
157
|
+
if (!existsSync2(path)) {
|
|
158
|
+
throw new Error(`unknown schema type ${JSON.stringify(typeName)}`);
|
|
159
|
+
}
|
|
160
|
+
return parseJsonObject(readFileSync2(path, "utf8"), `${typeName} schema`);
|
|
161
|
+
}
|
|
162
|
+
function schemaBundle() {
|
|
163
|
+
const bundlePath = join3(schemaDir(), "bundle.schema.json");
|
|
164
|
+
if (existsSync2(bundlePath)) {
|
|
165
|
+
const bundle = parseJsonObject(
|
|
166
|
+
readFileSync2(bundlePath, "utf8"),
|
|
167
|
+
"schema bundle"
|
|
168
|
+
);
|
|
169
|
+
if (bundle.bundle_id && bundle.schemas && typeof bundle.schemas === "object" && !Array.isArray(bundle.schemas)) {
|
|
170
|
+
return bundle;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const schemas = {};
|
|
174
|
+
for (const name of schemaNames()) {
|
|
175
|
+
schemas[name] = schemaByType(name);
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
bundle_id: "percolation-inversion-compiler-portability",
|
|
179
|
+
schemas
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function validateData(data, schema) {
|
|
183
|
+
const Ajv2020 = Ajv2020Module;
|
|
184
|
+
const ajv = new Ajv2020({ allErrors: true, strict: false });
|
|
185
|
+
const validate = ajv.compile(schema);
|
|
186
|
+
const valid = Boolean(validate(data));
|
|
187
|
+
return {
|
|
188
|
+
valid,
|
|
189
|
+
errors: valid ? [] : (validate.errors ?? []).map(
|
|
190
|
+
(error) => `${error.instancePath || "/"} ${error.message ?? "is invalid"}`
|
|
191
|
+
)
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function validateByType(data, typeName) {
|
|
195
|
+
return validateData(data, schemaByType(typeName));
|
|
196
|
+
}
|
|
197
|
+
function writeAllSchemas(outputDir) {
|
|
198
|
+
mkdirSync(outputDir, { recursive: true });
|
|
199
|
+
const written = [];
|
|
200
|
+
const files = [
|
|
201
|
+
...schemaNames().map((name) => `${name}.schema.json`),
|
|
202
|
+
"bundle.schema.json",
|
|
203
|
+
"schema-digest.json"
|
|
204
|
+
];
|
|
205
|
+
for (const file of files) {
|
|
206
|
+
const source = join3(schemaDir(), file);
|
|
207
|
+
if (!existsSync2(source)) {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
const target = join3(outputDir, file);
|
|
211
|
+
cpSync(source, target);
|
|
212
|
+
written.push(basename(target));
|
|
213
|
+
}
|
|
214
|
+
return written.sort();
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// src/io/identity.ts
|
|
218
|
+
function nonEmptyStringArray(value) {
|
|
219
|
+
return Array.isArray(value) && value.some((item) => typeof item === "string" && item.length > 0);
|
|
220
|
+
}
|
|
221
|
+
function runtimeIdentityContextAccepted(data) {
|
|
222
|
+
return validateByType(data, "RuntimeIdentityContext").valid && data.accepted === true && nonEmptyStringArray(data.accepted_agent_ids) && nonEmptyStringArray(data.accepted_public_key_ids);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// src/runtime/index.ts
|
|
226
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
227
|
+
function clone(value) {
|
|
228
|
+
return structuredClone(value);
|
|
229
|
+
}
|
|
230
|
+
function minimalRuntimeState() {
|
|
231
|
+
return {
|
|
232
|
+
state_id: "runtime-state:minimal",
|
|
233
|
+
profile: "development",
|
|
234
|
+
candidate_registry: { packets: [], edges: [] },
|
|
235
|
+
residual_ledger: residualLedger(
|
|
236
|
+
"runtime:minimal-state",
|
|
237
|
+
1,
|
|
238
|
+
"minimal state carries unresolved verifier debt"
|
|
239
|
+
),
|
|
240
|
+
accepted_agent_ids: [],
|
|
241
|
+
accepted_public_key_ids: [],
|
|
242
|
+
identity_mode: "development"
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function minimalRuntimeStepInput(agentOutput = "Candidate packet: preserve residuals.") {
|
|
246
|
+
return {
|
|
247
|
+
input_id: "runtime-step-input:minimal",
|
|
248
|
+
agent_output: agentOutput,
|
|
249
|
+
allow_live_connectors: true,
|
|
250
|
+
candidate_only: true
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function buildRuntimeStep(options = {}) {
|
|
254
|
+
const report = clone(pythonCliFixture("runtime_step_demo"));
|
|
255
|
+
const profile = options.profile ?? "development";
|
|
256
|
+
const reasons = new Set(
|
|
257
|
+
Array.isArray(report.reasons) ? report.reasons.map(String) : []
|
|
258
|
+
);
|
|
259
|
+
if (options.agentOutput) {
|
|
260
|
+
report.agent_output_digest = `sha256:${Buffer.from(options.agentOutput, "utf8").toString("hex").slice(0, 16)}`;
|
|
261
|
+
}
|
|
262
|
+
if (options.statePath) {
|
|
263
|
+
const state = parseJsonObject(
|
|
264
|
+
readFileSync3(options.statePath, "utf8"),
|
|
265
|
+
"runtime state"
|
|
266
|
+
);
|
|
267
|
+
const validation = validateByType(state, "RuntimeState");
|
|
268
|
+
if (!validation.valid) {
|
|
269
|
+
throw new Error(
|
|
270
|
+
`runtime state schema-invalid: ${validation.errors.join("; ")}`
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (options.inputPath) {
|
|
275
|
+
const input = parseJsonObject(
|
|
276
|
+
readFileSync3(options.inputPath, "utf8"),
|
|
277
|
+
"runtime input"
|
|
278
|
+
);
|
|
279
|
+
const validation = validateByType(input, "RuntimeStepInput");
|
|
280
|
+
if (!validation.valid) {
|
|
281
|
+
throw new Error(
|
|
282
|
+
`runtime input schema-invalid: ${validation.errors.join("; ")}`
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
if (typeof input.allow_live_connectors === "boolean") {
|
|
286
|
+
report.allow_live_connectors = input.allow_live_connectors;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
if (typeof options.allowLiveConnectors === "boolean") {
|
|
290
|
+
report.allow_live_connectors = options.allowLiveConnectors;
|
|
291
|
+
}
|
|
292
|
+
if (options.identityContextPath) {
|
|
293
|
+
const identity = parseJsonObject(
|
|
294
|
+
readFileSync3(options.identityContextPath, "utf8"),
|
|
295
|
+
"identity context"
|
|
296
|
+
);
|
|
297
|
+
const validation = validateByType(identity, "RuntimeIdentityContext");
|
|
298
|
+
const accepted = runtimeIdentityContextAccepted(identity);
|
|
299
|
+
report.identity_context_accepted = accepted;
|
|
300
|
+
report.identity_verified = accepted;
|
|
301
|
+
if (!accepted) {
|
|
302
|
+
reasons.add("identity context is missing or not accepted");
|
|
303
|
+
report.operationally_usable = false;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
if (profile === "production" || profile === "adversarial") {
|
|
307
|
+
if (!options.identityContextPath) {
|
|
308
|
+
reasons.add(
|
|
309
|
+
"production/adversarial identity context is missing or not accepted"
|
|
310
|
+
);
|
|
311
|
+
report.operationally_usable = false;
|
|
312
|
+
report.identity_verified = false;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
report.accepted = true;
|
|
316
|
+
report.finite_checks_passed = true;
|
|
317
|
+
report.settled = false;
|
|
318
|
+
report.reasons = [...reasons].sort();
|
|
319
|
+
return report;
|
|
320
|
+
}
|
|
321
|
+
function runtimeHealth(profile = "development") {
|
|
322
|
+
return {
|
|
323
|
+
report_id: "runtime-health",
|
|
324
|
+
profile,
|
|
325
|
+
accepted: true,
|
|
326
|
+
operationally_usable: profile === "development",
|
|
327
|
+
settled: false,
|
|
328
|
+
checks: {
|
|
329
|
+
command_execution_allowed: false,
|
|
330
|
+
background_crawling_allowed: false,
|
|
331
|
+
hidden_promotion_allowed: false,
|
|
332
|
+
residual_ledgers_preserved: true
|
|
333
|
+
},
|
|
334
|
+
reasons: profile === "development" ? [] : [
|
|
335
|
+
"production profile requires explicit identity and provenance context"
|
|
336
|
+
]
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// src/phase/index.ts
|
|
341
|
+
function clone2(value) {
|
|
342
|
+
return structuredClone(value);
|
|
343
|
+
}
|
|
344
|
+
var phaseSchemaRefs = pythonCliFixture("phase_plan_compact").schema_refs ?? [
|
|
345
|
+
"PhaseAccelerationRequest",
|
|
346
|
+
"PhaseAccelerationPlan",
|
|
347
|
+
"PhaseGapVector",
|
|
348
|
+
"PhaseComponentGap",
|
|
349
|
+
"BottleneckCandidate",
|
|
350
|
+
"SafePhaseAction"
|
|
351
|
+
];
|
|
352
|
+
function phaseAccelerationSafetyInvariants() {
|
|
353
|
+
const fixture = pythonCliFixture("phase_plan_compact");
|
|
354
|
+
if (Array.isArray(fixture.safety_invariants)) {
|
|
355
|
+
return fixture.safety_invariants.map(String);
|
|
356
|
+
}
|
|
357
|
+
return [
|
|
358
|
+
"phase acceleration planning is recommendation-only and does not execute actions",
|
|
359
|
+
"raw external candidate volume cannot improve Psi, BR, AC, or settled status",
|
|
360
|
+
"candidate packets, agent messages, and proxy-only ALT reports remain candidates",
|
|
361
|
+
"settled remains false unless scoped finite verifier rules discharge all obligations",
|
|
362
|
+
"residual ledgers and missing obligations must be preserved into downstream loops",
|
|
363
|
+
"ASI-proxy phase is protocol-relative workflow coordination, not real ASI proof",
|
|
364
|
+
"no physical, simulator, oracle, legal, or policy outcome is proven by this report",
|
|
365
|
+
"no hidden promotion from accepted or workflow_usable to settled"
|
|
366
|
+
];
|
|
367
|
+
}
|
|
368
|
+
function identityContextAccepted(path) {
|
|
369
|
+
if (!path || !existsSync3(path)) {
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
try {
|
|
373
|
+
const data = parseJsonObject(
|
|
374
|
+
readFileSync4(path, "utf8"),
|
|
375
|
+
"identity context"
|
|
376
|
+
);
|
|
377
|
+
return runtimeIdentityContextAccepted(data);
|
|
378
|
+
} catch {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
function runtimeReportIdentityAccepted(report) {
|
|
383
|
+
if (!report) {
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
const identity = report.identity_context;
|
|
387
|
+
if (!identity || typeof identity !== "object" || Array.isArray(identity)) {
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
const data = identity;
|
|
391
|
+
return runtimeIdentityContextAccepted(data);
|
|
392
|
+
}
|
|
393
|
+
function objectList(value) {
|
|
394
|
+
return Array.isArray(value) ? value.filter((item) => item && typeof item === "object") : [];
|
|
395
|
+
}
|
|
396
|
+
function ensureActionBoundary(plan) {
|
|
397
|
+
for (const action of objectList(plan.recommended_actions)) {
|
|
398
|
+
action.execution_authority_granted = false;
|
|
399
|
+
action.settled = false;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
function buildPhaseAccelerationPlan(request = {}) {
|
|
403
|
+
const plan = clone2(pythonCliFixture("phase_plan_full"));
|
|
404
|
+
const profile = request.profile ?? "development";
|
|
405
|
+
const hasDynamicRuntimeInput = Boolean(
|
|
406
|
+
request.agent_output || request.profile && request.profile !== "development" || request.allow_live_connectors === false || request.identity_context_path
|
|
407
|
+
);
|
|
408
|
+
const runtimeReport = request.runtime_report ?? (hasDynamicRuntimeInput ? buildRuntimeStep({
|
|
409
|
+
profile,
|
|
410
|
+
agentOutput: request.agent_output,
|
|
411
|
+
allowLiveConnectors: request.allow_live_connectors,
|
|
412
|
+
identityContextPath: request.identity_context_path
|
|
413
|
+
}) : plan.runtime_report);
|
|
414
|
+
const cannotPromote = new Set(
|
|
415
|
+
Array.isArray(plan.cannot_promote_because) ? plan.cannot_promote_because.map(String) : []
|
|
416
|
+
);
|
|
417
|
+
const candidateOnly = new Set(
|
|
418
|
+
Array.isArray(plan.candidate_only_reasons) ? plan.candidate_only_reasons.map(String) : []
|
|
419
|
+
);
|
|
420
|
+
const settledBlockers = new Set(
|
|
421
|
+
Array.isArray(plan.settled_blockers) ? plan.settled_blockers.map(String) : []
|
|
422
|
+
);
|
|
423
|
+
const reasons = new Set(
|
|
424
|
+
Array.isArray(plan.reasons) ? plan.reasons.map(String) : []
|
|
425
|
+
);
|
|
426
|
+
cannotPromote.add("missing obligations remain");
|
|
427
|
+
settledBlockers.add(
|
|
428
|
+
"phase planner is recommendation-only and cannot settle claims"
|
|
429
|
+
);
|
|
430
|
+
if ((request.general_intake_bridge_reports ?? []).some(
|
|
431
|
+
(report) => report.candidate_only !== false
|
|
432
|
+
)) {
|
|
433
|
+
candidateOnly.add(
|
|
434
|
+
"candidate-only external volume cannot reduce phase gaps"
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
if ((request.alt_admission_decisions ?? []).some(
|
|
438
|
+
(decision) => Array.isArray(decision.missing_obligations) && decision.missing_obligations.length > 0
|
|
439
|
+
)) {
|
|
440
|
+
candidateOnly.add(
|
|
441
|
+
"ALT admission is candidate-only until missing obligations are discharged"
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
const identityRequired = profile === "production" || profile === "adversarial";
|
|
445
|
+
const identityAccepted = identityContextAccepted(request.identity_context_path) || runtimeReportIdentityAccepted(runtimeReport);
|
|
446
|
+
if (identityRequired && !identityAccepted) {
|
|
447
|
+
cannotPromote.add(
|
|
448
|
+
"production/adversarial identity context is missing or not accepted"
|
|
449
|
+
);
|
|
450
|
+
settledBlockers.add(
|
|
451
|
+
"production identity context is required before operational promotion"
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
plan.plan_id = `phase-acceleration-plan:${request.request_id ?? "phase-acceleration"}`;
|
|
455
|
+
plan.request_id = request.request_id ?? "phase-acceleration";
|
|
456
|
+
plan.profile = profile;
|
|
457
|
+
plan.report_mode = request.compact ? "compact" : "full";
|
|
458
|
+
plan.accepted = true;
|
|
459
|
+
plan.workflow_usable = true;
|
|
460
|
+
plan.finite_checks_passed = plan.finite_checks_passed ?? true;
|
|
461
|
+
plan.operationally_usable = !(identityRequired && !identityAccepted);
|
|
462
|
+
plan.settled = false;
|
|
463
|
+
plan.status = cannotPromote.size > 0 || candidateOnly.size > 0 ? "diagnostic" : "provisional";
|
|
464
|
+
plan.runtime_report = request.compact ? void 0 : runtimeReport;
|
|
465
|
+
plan.cannot_promote_because = [...cannotPromote].sort();
|
|
466
|
+
plan.candidate_only_reasons = [...candidateOnly].sort();
|
|
467
|
+
plan.settled_blockers = [...settledBlockers].sort();
|
|
468
|
+
plan.reasons = dedupeSorted([...reasons, ...cannotPromote, ...candidateOnly]);
|
|
469
|
+
plan.safety_invariants = phaseAccelerationSafetyInvariants();
|
|
470
|
+
plan.schema_refs = phaseSchemaRefs;
|
|
471
|
+
plan.safe_commands = dedupeSorted([
|
|
472
|
+
...Array.isArray(plan.safe_commands) ? plan.safe_commands.map(String) : []
|
|
473
|
+
]);
|
|
474
|
+
plan.sdk_calls = dedupeSorted([
|
|
475
|
+
...Array.isArray(plan.sdk_calls) ? plan.sdk_calls.map(String) : []
|
|
476
|
+
]);
|
|
477
|
+
ensureActionBoundary(plan);
|
|
478
|
+
return plan;
|
|
479
|
+
}
|
|
480
|
+
function phaseAccelerationCompactPayload(plan) {
|
|
481
|
+
return {
|
|
482
|
+
plan_id: plan.plan_id,
|
|
483
|
+
request_id: plan.request_id,
|
|
484
|
+
profile: plan.profile,
|
|
485
|
+
report_mode: "compact",
|
|
486
|
+
accepted: plan.accepted,
|
|
487
|
+
workflow_usable: plan.workflow_usable,
|
|
488
|
+
finite_checks_passed: plan.finite_checks_passed ?? true,
|
|
489
|
+
operationally_usable: plan.operationally_usable,
|
|
490
|
+
settled: false,
|
|
491
|
+
status: plan.status ?? "diagnostic",
|
|
492
|
+
phase_gap_vector: plan.phase_gap_vector,
|
|
493
|
+
top_bottlenecks: plan.top_bottlenecks ?? (Array.isArray(plan.bottlenecks) ? plan.bottlenecks.slice(0, 5) : []),
|
|
494
|
+
safe_commands: plan.safe_commands ?? [],
|
|
495
|
+
sdk_calls: plan.sdk_calls ?? [],
|
|
496
|
+
schema_refs: plan.schema_refs ?? phaseSchemaRefs,
|
|
497
|
+
cannot_promote_because: plan.cannot_promote_because ?? [],
|
|
498
|
+
candidate_only_reasons: plan.candidate_only_reasons ?? [],
|
|
499
|
+
settled_blockers: plan.settled_blockers ?? [],
|
|
500
|
+
residual_summary: plan.residual_summary ?? {},
|
|
501
|
+
missing_obligations: plan.missing_obligations ?? [],
|
|
502
|
+
safety_invariants: plan.safety_invariants ?? phaseAccelerationSafetyInvariants(),
|
|
503
|
+
reasons: plan.reasons ?? []
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
function phaseAccelerationRunbook(profile = "development") {
|
|
507
|
+
const runbook = clone2(pythonCliFixture("phase_runbook"));
|
|
508
|
+
runbook.profile = profile;
|
|
509
|
+
return runbook;
|
|
510
|
+
}
|
|
511
|
+
function buildPhaseAccelerationBenchmark(profile = "development") {
|
|
512
|
+
const report = clone2(pythonCliFixture("phase_benchmark"));
|
|
513
|
+
report.profile = profile;
|
|
514
|
+
report.accepted = true;
|
|
515
|
+
report.workflow_usable = true;
|
|
516
|
+
report.operationally_usable = true;
|
|
517
|
+
report.settled = false;
|
|
518
|
+
report.invariant_checks = {
|
|
519
|
+
candidate_only_volume_does_not_reduce_gap: true,
|
|
520
|
+
planner_does_not_execute_commands: true,
|
|
521
|
+
residuals_visible: true,
|
|
522
|
+
settled_not_promoted: true
|
|
523
|
+
};
|
|
524
|
+
report.safety_invariants = phaseAccelerationSafetyInvariants();
|
|
525
|
+
return report;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// src/agent/index.ts
|
|
529
|
+
function clone3(value) {
|
|
530
|
+
return structuredClone(value);
|
|
531
|
+
}
|
|
532
|
+
function agentSafetyInvariants() {
|
|
533
|
+
const fixture = pythonCliFixture("agent_check_compact");
|
|
534
|
+
if (Array.isArray(fixture.safety_invariants)) {
|
|
535
|
+
return fixture.safety_invariants.map(String);
|
|
536
|
+
}
|
|
537
|
+
return [
|
|
538
|
+
"accepted is not settled",
|
|
539
|
+
"workflow_usable is not settled",
|
|
540
|
+
"safe_commands are inspection guidance and are not executed by PIC",
|
|
541
|
+
"residual ledgers and missing obligations are preserved",
|
|
542
|
+
"no hidden promotion from accepted or workflow_usable to settled",
|
|
543
|
+
"default-live explicit sources remain candidate-only until verified"
|
|
544
|
+
];
|
|
545
|
+
}
|
|
546
|
+
function runAgentIntake(request = {}) {
|
|
547
|
+
const report = clone3(pythonCliFixture("agent_intake"));
|
|
548
|
+
const hasDynamicInput = Boolean(
|
|
549
|
+
request.agent_output || request.profile && request.profile !== "development" || request.allow_live_connectors === false || request.identity_context_path
|
|
550
|
+
);
|
|
551
|
+
const runtime = hasDynamicInput ? buildRuntimeStep({
|
|
552
|
+
profile: request.profile,
|
|
553
|
+
agentOutput: request.agent_output,
|
|
554
|
+
allowLiveConnectors: request.allow_live_connectors,
|
|
555
|
+
identityContextPath: request.identity_context_path
|
|
556
|
+
}) : report.runtime_report;
|
|
557
|
+
report.report_id = `agent-intake:${request.request_id ?? "agent-intake"}:agent-intake-step`;
|
|
558
|
+
report.profile = request.profile ?? "development";
|
|
559
|
+
report.runtime_report = runtime;
|
|
560
|
+
report.accepted = runtime.accepted;
|
|
561
|
+
report.operationally_usable = runtime.operationally_usable;
|
|
562
|
+
report.settled = false;
|
|
563
|
+
report.residual_summary = summarizeLedger(runtime.residual_ledger);
|
|
564
|
+
report.recommended_next_commands = [
|
|
565
|
+
"Inspect runtime_report.residual_ledger and runtime_report.missing_obligations.",
|
|
566
|
+
"Inspect runtime_report.route_execution_requests before route execution.",
|
|
567
|
+
"Review runtime_report.agent_tasks; do not execute arbitrary commands.",
|
|
568
|
+
"Run another runtime step after new evidence or action results are available."
|
|
569
|
+
];
|
|
570
|
+
report.reasons = Array.isArray(runtime.reasons) ? runtime.reasons : [];
|
|
571
|
+
return report;
|
|
572
|
+
}
|
|
573
|
+
function runAgentCheck(request = {}, compact = false) {
|
|
574
|
+
const report = clone3(
|
|
575
|
+
compact ? pythonCliFixture("agent_check_compact") : pythonCliFixture("agent_check_full")
|
|
576
|
+
);
|
|
577
|
+
const intake = runAgentIntake(request);
|
|
578
|
+
const runtime = intake.runtime_report;
|
|
579
|
+
const unresolved = dedupeSorted([
|
|
580
|
+
...runtime.missing_obligations ?? []
|
|
581
|
+
]);
|
|
582
|
+
const reasons = dedupeSorted([
|
|
583
|
+
...intake.reasons ?? [],
|
|
584
|
+
"unresolved obligations remain; use workflow_usable for routing only"
|
|
585
|
+
]);
|
|
586
|
+
report.report_id = `agent-check:${request.request_id ?? "agent-intake"}`;
|
|
587
|
+
report.profile = request.profile ?? "development";
|
|
588
|
+
report.report_mode = compact ? "compact" : "full";
|
|
589
|
+
report.compact = compact;
|
|
590
|
+
report.practical_entrypoint = compact ? "pic agent check --compact" : "pic agent check";
|
|
591
|
+
report.intake_report = intake;
|
|
592
|
+
report.unresolved_obligations = unresolved;
|
|
593
|
+
report.residual_summary = intake.residual_summary;
|
|
594
|
+
report.workflow_usable = true;
|
|
595
|
+
report.accepted = true;
|
|
596
|
+
report.operationally_usable = Boolean(intake.operationally_usable);
|
|
597
|
+
report.settled = false;
|
|
598
|
+
report.reasons = reasons;
|
|
599
|
+
report.safety_invariants = agentSafetyInvariants();
|
|
600
|
+
return compact ? agentCheckCompactPayload(report) : report;
|
|
601
|
+
}
|
|
602
|
+
function agentCheckCompactPayload(report) {
|
|
603
|
+
return {
|
|
604
|
+
report_id: report.report_id,
|
|
605
|
+
profile: report.profile,
|
|
606
|
+
report_mode: "compact",
|
|
607
|
+
accepted: report.accepted,
|
|
608
|
+
workflow_usable: report.workflow_usable,
|
|
609
|
+
operationally_usable: report.operationally_usable,
|
|
610
|
+
settled: false,
|
|
611
|
+
checked_outputs: report.checked_outputs ?? {
|
|
612
|
+
agent_tasks: "present",
|
|
613
|
+
input: "accepted",
|
|
614
|
+
promotion: "diagnostic",
|
|
615
|
+
residual_ledger: "preserved",
|
|
616
|
+
route_requests: "present",
|
|
617
|
+
salience_schedule: "accepted"
|
|
618
|
+
},
|
|
619
|
+
unresolved_obligations: report.unresolved_obligations ?? [],
|
|
620
|
+
residual_summary: report.residual_summary ?? {},
|
|
621
|
+
next_safe_actions: report.next_safe_actions ?? [
|
|
622
|
+
"Inspect unresolved_obligations before reusing the output.",
|
|
623
|
+
"Preserve residual_summary in downstream logs.",
|
|
624
|
+
"Route verifier requests before promoting candidates to reusable work."
|
|
625
|
+
],
|
|
626
|
+
schema_refs: report.schema_refs ?? [
|
|
627
|
+
"AgentCheckReport",
|
|
628
|
+
"AgentIntakeReport",
|
|
629
|
+
"RuntimeStepReport"
|
|
630
|
+
],
|
|
631
|
+
runbook_steps: report.runbook_steps ?? agentRunbookSteps(String(report.profile ?? "development")),
|
|
632
|
+
safety_invariants: report.safety_invariants ?? agentSafetyInvariants(),
|
|
633
|
+
reasons: report.reasons ?? []
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
function accelerateAgentPhase(request = {}, compact = false) {
|
|
637
|
+
const plan = buildPhaseAccelerationPlan({
|
|
638
|
+
request_id: `agent-accelerate:${request.request_id ?? "agent-intake"}`,
|
|
639
|
+
profile: request.profile ?? "development",
|
|
640
|
+
compact,
|
|
641
|
+
agent_output: request.agent_output,
|
|
642
|
+
allow_live_connectors: request.allow_live_connectors,
|
|
643
|
+
identity_context_path: request.identity_context_path
|
|
644
|
+
});
|
|
645
|
+
return compact ? phaseAccelerationCompactPayload(plan) : plan;
|
|
646
|
+
}
|
|
647
|
+
function agentRunbookSteps(profile = "development") {
|
|
648
|
+
return [
|
|
649
|
+
`pic agent check --compact --profile ${profile}`,
|
|
650
|
+
"Inspect accepted, workflow_usable, operationally_usable, settled.",
|
|
651
|
+
"Inspect residual_summary and unresolved_obligations.",
|
|
652
|
+
"Run verifier routes before packet promotion.",
|
|
653
|
+
"Keep settled=false unless scoped finite obligations are discharged."
|
|
654
|
+
];
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
// src/trc/index.ts
|
|
658
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
659
|
+
function compileTrc(options = {}) {
|
|
660
|
+
let records = [];
|
|
661
|
+
const reasons = [];
|
|
662
|
+
if (options.recordsPath) {
|
|
663
|
+
const parsed = JSON.parse(
|
|
664
|
+
readFileSync5(options.recordsPath, "utf8")
|
|
665
|
+
);
|
|
666
|
+
records = Array.isArray(parsed) ? parsed : Array.isArray(parsed.records) ? parsed.records : [];
|
|
667
|
+
}
|
|
668
|
+
const invalidMainTrace = records.some((record) => {
|
|
669
|
+
const obj = record;
|
|
670
|
+
return obj.stratum === "main" && !obj.trace_id && !obj.trace;
|
|
671
|
+
});
|
|
672
|
+
if (invalidMainTrace) {
|
|
673
|
+
reasons.push(
|
|
674
|
+
"main frontier record lacks accepted executable trace normal form"
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
const accepted = !invalidMainTrace;
|
|
678
|
+
return {
|
|
679
|
+
result_id: "trc-compile-result",
|
|
680
|
+
accepted,
|
|
681
|
+
operationally_usable: accepted && !invalidMainTrace,
|
|
682
|
+
settled: false,
|
|
683
|
+
main_frontier_count: invalidMainTrace ? 0 : records.length,
|
|
684
|
+
diagnostic_count: invalidMainTrace ? 1 : 0,
|
|
685
|
+
residual_ledger: invalidMainTrace ? {
|
|
686
|
+
coordinates: {
|
|
687
|
+
"trc:trace-normal-form": {
|
|
688
|
+
name: "trc:trace-normal-form",
|
|
689
|
+
value: 1,
|
|
690
|
+
unit: "dimensionless",
|
|
691
|
+
kind: "residual",
|
|
692
|
+
description: "main-frontier records require executable trace normal forms"
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
} : { coordinates: {} },
|
|
696
|
+
reasons
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
// src/io/portability.ts
|
|
701
|
+
import { createHash } from "crypto";
|
|
702
|
+
import { existsSync as existsSync4, readFileSync as readFileSync6 } from "fs";
|
|
703
|
+
import { dirname as dirname2, isAbsolute, normalize as normalize2, resolve as resolve2, sep as sep2 } from "path";
|
|
704
|
+
function normalizedSha256(text) {
|
|
705
|
+
return createHash("sha256").update(lfNormalize(text), "utf8").digest("hex");
|
|
706
|
+
}
|
|
707
|
+
function stableCompactJson(value) {
|
|
708
|
+
if (Array.isArray(value)) {
|
|
709
|
+
return `[${value.map((item) => stableCompactJson(item)).join(",")}]`;
|
|
710
|
+
}
|
|
711
|
+
if (value && typeof value === "object") {
|
|
712
|
+
const input = value;
|
|
713
|
+
return `{${Object.keys(input).sort().map((key) => `${JSON.stringify(key)}:${stableCompactJson(input[key])}`).join(",")}}`;
|
|
714
|
+
}
|
|
715
|
+
return JSON.stringify(value);
|
|
716
|
+
}
|
|
717
|
+
function safeManifestTarget(base, file) {
|
|
718
|
+
if (!file || isAbsolute(file)) {
|
|
719
|
+
return null;
|
|
720
|
+
}
|
|
721
|
+
const normalized = normalize2(file);
|
|
722
|
+
if (normalized.split(/[\\/]+/).includes("..")) {
|
|
723
|
+
return null;
|
|
724
|
+
}
|
|
725
|
+
const baseResolved = resolve2(base);
|
|
726
|
+
const target = resolve2(baseResolved, normalized);
|
|
727
|
+
if (target !== baseResolved && !target.startsWith(`${baseResolved}${sep2}`)) {
|
|
728
|
+
return null;
|
|
729
|
+
}
|
|
730
|
+
return target;
|
|
731
|
+
}
|
|
732
|
+
function verifyPortabilityManifest(manifestPath) {
|
|
733
|
+
const manifest = parseJsonObject(
|
|
734
|
+
readFileSync6(manifestPath, "utf8"),
|
|
735
|
+
"portability manifest"
|
|
736
|
+
);
|
|
737
|
+
const base = dirname2(manifestPath);
|
|
738
|
+
const knownSchemas = new Set(schemaNames());
|
|
739
|
+
const checkedExamples = {};
|
|
740
|
+
const checkedNegativeExamples = {};
|
|
741
|
+
const checkedSchemas = {};
|
|
742
|
+
const sha = {};
|
|
743
|
+
const reasons = [];
|
|
744
|
+
let unexpectedFailureCount = 0;
|
|
745
|
+
let expectedFailureCount = 0;
|
|
746
|
+
if (!Array.isArray(manifest.examples)) {
|
|
747
|
+
reasons.push("manifest examples must be a list");
|
|
748
|
+
}
|
|
749
|
+
if (!Array.isArray(manifest.negative_examples)) {
|
|
750
|
+
reasons.push("manifest negative_examples must be a list");
|
|
751
|
+
}
|
|
752
|
+
for (const entry of Array.isArray(manifest.examples) ? manifest.examples : []) {
|
|
753
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
754
|
+
reasons.push("manifest example entry must be an object");
|
|
755
|
+
continue;
|
|
756
|
+
}
|
|
757
|
+
const example = entry;
|
|
758
|
+
const file = String(example.file ?? "");
|
|
759
|
+
const schema = String(example.schema ?? "");
|
|
760
|
+
const expectedSha = example.sha256 ? String(example.sha256) : "";
|
|
761
|
+
if (typeof example.file !== "string" || typeof example.schema !== "string") {
|
|
762
|
+
reasons.push("manifest example entries require string file and schema");
|
|
763
|
+
continue;
|
|
764
|
+
}
|
|
765
|
+
checkedSchemas[file] = schema;
|
|
766
|
+
const path = safeManifestTarget(base, file);
|
|
767
|
+
if (path === null) {
|
|
768
|
+
checkedExamples[file] = "unsafe-path";
|
|
769
|
+
reasons.push(`${file}: example path is outside manifest directory`);
|
|
770
|
+
unexpectedFailureCount += 1;
|
|
771
|
+
continue;
|
|
772
|
+
}
|
|
773
|
+
if (!existsSync4(path)) {
|
|
774
|
+
checkedExamples[file] = "missing";
|
|
775
|
+
reasons.push(`${file}: example file is missing`);
|
|
776
|
+
unexpectedFailureCount += 1;
|
|
777
|
+
continue;
|
|
778
|
+
}
|
|
779
|
+
if (!knownSchemas.has(schema)) {
|
|
780
|
+
checkedExamples[file] = "unknown-schema";
|
|
781
|
+
reasons.push(`${schema} is not a known schema`);
|
|
782
|
+
unexpectedFailureCount += 1;
|
|
783
|
+
continue;
|
|
784
|
+
}
|
|
785
|
+
const text = readFileSync6(path, "utf8");
|
|
786
|
+
const digest = normalizedSha256(text);
|
|
787
|
+
sha[file] = digest;
|
|
788
|
+
if (expectedSha && digest !== expectedSha) {
|
|
789
|
+
checkedExamples[file] = "sha256-mismatch";
|
|
790
|
+
reasons.push(`${file}: sha256 does not match manifest`);
|
|
791
|
+
unexpectedFailureCount += 1;
|
|
792
|
+
continue;
|
|
793
|
+
}
|
|
794
|
+
const data = parseJsonObject(text, file);
|
|
795
|
+
const validation = validateByType(data, schema);
|
|
796
|
+
checkedExamples[file] = validation.valid ? "valid" : "schema-invalid";
|
|
797
|
+
if (!validation.valid) {
|
|
798
|
+
unexpectedFailureCount += 1;
|
|
799
|
+
reasons.push(...validation.errors.map((error) => `${file}: ${error}`));
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
for (const entry of Array.isArray(manifest.negative_examples) ? manifest.negative_examples : []) {
|
|
803
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
804
|
+
reasons.push("manifest negative example entry must be an object");
|
|
805
|
+
unexpectedFailureCount += 1;
|
|
806
|
+
continue;
|
|
807
|
+
}
|
|
808
|
+
const example = entry;
|
|
809
|
+
const file = String(example.file ?? "");
|
|
810
|
+
const schema = String(example.schema ?? "");
|
|
811
|
+
const expectedStatus = String(example.expected_status ?? "schema-invalid");
|
|
812
|
+
if (typeof example.file !== "string" || typeof example.schema !== "string" || typeof example.expected_status !== "string") {
|
|
813
|
+
reasons.push(
|
|
814
|
+
"manifest negative example entries require string file, schema, and expected_status"
|
|
815
|
+
);
|
|
816
|
+
unexpectedFailureCount += 1;
|
|
817
|
+
continue;
|
|
818
|
+
}
|
|
819
|
+
checkedSchemas[file] = schema;
|
|
820
|
+
const path = safeManifestTarget(base, file);
|
|
821
|
+
let status;
|
|
822
|
+
if (path === null) {
|
|
823
|
+
status = "unsafe-path";
|
|
824
|
+
} else if (!existsSync4(path)) {
|
|
825
|
+
status = "missing";
|
|
826
|
+
} else if (!knownSchemas.has(schema)) {
|
|
827
|
+
status = "unknown-schema";
|
|
828
|
+
} else {
|
|
829
|
+
const text = readFileSync6(path, "utf8");
|
|
830
|
+
if (example.sha256 && normalizedSha256(text) !== String(example.sha256)) {
|
|
831
|
+
status = "sha256-mismatch";
|
|
832
|
+
} else {
|
|
833
|
+
try {
|
|
834
|
+
const data = parseJsonObject(text, file);
|
|
835
|
+
status = validateByType(data, schema).valid ? "valid" : "schema-invalid";
|
|
836
|
+
} catch {
|
|
837
|
+
status = "schema-invalid";
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
checkedNegativeExamples[file] = status;
|
|
842
|
+
if (status === expectedStatus && status !== "valid") {
|
|
843
|
+
expectedFailureCount += 1;
|
|
844
|
+
} else {
|
|
845
|
+
unexpectedFailureCount += 1;
|
|
846
|
+
reasons.push(`${file} expected ${expectedStatus} but got ${status}`);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
const schemaDigestInput = {
|
|
850
|
+
public_schema_count: schemaNames().length,
|
|
851
|
+
schema_names: Object.fromEntries(Object.entries(checkedSchemas).sort())
|
|
852
|
+
};
|
|
853
|
+
const schemaDigest = createHash("sha256").update(stableCompactJson(schemaDigestInput), "utf8").digest("hex");
|
|
854
|
+
const uniqueReasons = [...new Set(reasons)].sort();
|
|
855
|
+
const accepted = Object.keys(checkedExamples).length > 0 && uniqueReasons.length === 0 && Object.values(checkedExamples).every((status) => status === "valid");
|
|
856
|
+
return {
|
|
857
|
+
report_id: "pic-portability-conformance",
|
|
858
|
+
manifest_path: manifestPath,
|
|
859
|
+
checked_examples: checkedExamples,
|
|
860
|
+
checked_negative_examples: checkedNegativeExamples,
|
|
861
|
+
schema_names: checkedSchemas,
|
|
862
|
+
sha256: sha,
|
|
863
|
+
schema_digest: schemaDigest,
|
|
864
|
+
positive_example_count: Object.keys(checkedExamples).length,
|
|
865
|
+
negative_example_count: Object.keys(checkedNegativeExamples).length,
|
|
866
|
+
expected_failure_count: expectedFailureCount,
|
|
867
|
+
unexpected_failure_count: unexpectedFailureCount,
|
|
868
|
+
semantic_invariants: Array.isArray(manifest.invariants) ? manifest.invariants.map(String) : [],
|
|
869
|
+
accepted,
|
|
870
|
+
operationally_usable: accepted,
|
|
871
|
+
settled: false,
|
|
872
|
+
reasons: uniqueReasons
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
// src/core/status.ts
|
|
877
|
+
var statusRank = {
|
|
878
|
+
rejected: 0,
|
|
879
|
+
expired: 1,
|
|
880
|
+
diagnostic: 2,
|
|
881
|
+
relaxed: 3,
|
|
882
|
+
"risk-provisional": 4,
|
|
883
|
+
speculative: 5,
|
|
884
|
+
provisional: 6,
|
|
885
|
+
partial: 6,
|
|
886
|
+
settled: 7
|
|
887
|
+
};
|
|
888
|
+
function rankStatus(status) {
|
|
889
|
+
return statusRank[status];
|
|
890
|
+
}
|
|
891
|
+
function noWorseStatus(left, right) {
|
|
892
|
+
return rankStatus(left) >= rankStatus(right);
|
|
893
|
+
}
|
|
894
|
+
function decideStatus(rule, presentInput, expiredInput = []) {
|
|
895
|
+
const present = new Set(presentInput);
|
|
896
|
+
const expired = new Set(expiredInput);
|
|
897
|
+
const missing = (values) => [
|
|
898
|
+
...new Set(
|
|
899
|
+
[...values].filter((item) => !present.has(item) || expired.has(item))
|
|
900
|
+
)
|
|
901
|
+
].sort();
|
|
902
|
+
const hardMissing = missing(rule.hard_domain_obligations ?? []);
|
|
903
|
+
if (hardMissing.length > 0) {
|
|
904
|
+
return {
|
|
905
|
+
status: "rejected",
|
|
906
|
+
accepted: false,
|
|
907
|
+
reasons: ["hard-domain obligation absent or expired"],
|
|
908
|
+
missing_obligations: hardMissing
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
let settledMissing = missing(rule.required_for_settled ?? []);
|
|
912
|
+
if ((rule.required_for_settled ?? []).length === 0 && !rule.allow_empty_settled_rule) {
|
|
913
|
+
settledMissing = ["settled-rule:nonempty-obligations"];
|
|
914
|
+
}
|
|
915
|
+
if (settledMissing.length === 0) {
|
|
916
|
+
return {
|
|
917
|
+
status: "settled",
|
|
918
|
+
accepted: true,
|
|
919
|
+
reasons: [],
|
|
920
|
+
missing_obligations: []
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
const provisionalMissing = missing(rule.required_for_provisional ?? []);
|
|
924
|
+
if (provisionalMissing.length === 0) {
|
|
925
|
+
return {
|
|
926
|
+
status: "provisional",
|
|
927
|
+
accepted: true,
|
|
928
|
+
reasons: ["settled obligations missing; no status promotion"],
|
|
929
|
+
missing_obligations: settledMissing
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
const speculativeMissing = missing(rule.required_for_speculative ?? []);
|
|
933
|
+
if (speculativeMissing.length === 0) {
|
|
934
|
+
return {
|
|
935
|
+
status: "speculative",
|
|
936
|
+
accepted: true,
|
|
937
|
+
reasons: ["only speculative transition ledgers are complete"],
|
|
938
|
+
missing_obligations: [
|
|
939
|
+
.../* @__PURE__ */ new Set([...settledMissing, ...provisionalMissing])
|
|
940
|
+
].sort()
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
return {
|
|
944
|
+
status: "diagnostic",
|
|
945
|
+
accepted: false,
|
|
946
|
+
reasons: [
|
|
947
|
+
"insufficient obligations for settled, provisional, or speculative claim"
|
|
948
|
+
],
|
|
949
|
+
missing_obligations: [
|
|
950
|
+
.../* @__PURE__ */ new Set([
|
|
951
|
+
...settledMissing,
|
|
952
|
+
...provisionalMissing,
|
|
953
|
+
...speculativeMissing
|
|
954
|
+
])
|
|
955
|
+
].sort()
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
export {
|
|
959
|
+
accelerateAgentPhase,
|
|
960
|
+
buildPhaseAccelerationBenchmark,
|
|
961
|
+
buildPhaseAccelerationPlan,
|
|
962
|
+
buildRuntimeStep,
|
|
963
|
+
compileTrc,
|
|
964
|
+
decideStatus,
|
|
965
|
+
minimalRuntimeState,
|
|
966
|
+
minimalRuntimeStepInput,
|
|
967
|
+
noWorseStatus,
|
|
968
|
+
phaseAccelerationCompactPayload,
|
|
969
|
+
phaseAccelerationRunbook,
|
|
970
|
+
rankStatus,
|
|
971
|
+
runAgentCheck,
|
|
972
|
+
runAgentIntake,
|
|
973
|
+
runtimeHealth,
|
|
974
|
+
schemaBundle,
|
|
975
|
+
schemaByType,
|
|
976
|
+
schemaNames,
|
|
977
|
+
sortJson,
|
|
978
|
+
stableStringify,
|
|
979
|
+
validateByType,
|
|
980
|
+
validateData,
|
|
981
|
+
verifyPortabilityManifest,
|
|
982
|
+
writeAllSchemas
|
|
983
|
+
};
|