agentskeptic 0.2.1 → 1.0.1
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/README.md +39 -39
- package/config/marketing.json +187 -0
- package/dist/actionableFailure.d.ts.map +1 -1
- package/dist/actionableFailure.js +95 -0
- package/dist/actionableFailure.js.map +1 -1
- package/dist/actionableFailure.remediationExhaustive.test.js +4 -4
- package/dist/actionableFailure.remediationExhaustive.test.js.map +1 -1
- package/dist/agentRunBundle.d.ts +2 -0
- package/dist/agentRunBundle.d.ts.map +1 -1
- package/dist/agentRunBundle.js +4 -0
- package/dist/agentRunBundle.js.map +1 -1
- package/dist/assurance/assurancePathArgs.d.ts.map +1 -1
- package/dist/assurance/assurancePathArgs.js +1 -0
- package/dist/assurance/assurancePathArgs.js.map +1 -1
- package/dist/assurance/buildAssuranceOutput.d.ts +29 -0
- package/dist/assurance/buildAssuranceOutput.d.ts.map +1 -0
- package/dist/assurance/buildAssuranceOutput.js +53 -0
- package/dist/assurance/buildAssuranceOutput.js.map +1 -0
- package/dist/assurance/checkStale.d.ts +7 -0
- package/dist/assurance/checkStale.d.ts.map +1 -1
- package/dist/assurance/checkStale.js +14 -3
- package/dist/assurance/checkStale.js.map +1 -1
- package/dist/assurance/runAssurance.d.ts.map +1 -1
- package/dist/assurance/runAssurance.js +26 -3
- package/dist/assurance/runAssurance.js.map +1 -1
- package/dist/bootstrap/executeBootstrapPack.d.ts.map +1 -1
- package/dist/bootstrap/executeBootstrapPack.js +3 -2
- package/dist/bootstrap/executeBootstrapPack.js.map +1 -1
- package/dist/certificateDigest.d.ts +4 -0
- package/dist/certificateDigest.d.ts.map +1 -0
- package/dist/certificateDigest.js +7 -0
- package/dist/certificateDigest.js.map +1 -0
- package/dist/certificateDigest.test.d.ts +2 -0
- package/dist/certificateDigest.test.d.ts.map +1 -0
- package/dist/certificateDigest.test.js +14 -0
- package/dist/certificateDigest.test.js.map +1 -0
- package/dist/ciLockWorkflow.js +1 -1
- package/dist/cli/lockOrchestration.d.ts.map +1 -1
- package/dist/cli/lockOrchestration.js +81 -50
- package/dist/cli/lockOrchestration.js.map +1 -1
- package/dist/cli/lockOrchestration.test.js +7 -1
- package/dist/cli/lockOrchestration.test.js.map +1 -1
- package/dist/cli/runFunnelAnonSet.js +1 -1
- package/dist/cli.js +147 -136
- package/dist/cli.js.map +1 -1
- package/dist/cliArgv.d.ts +4 -1
- package/dist/cliArgv.d.ts.map +1 -1
- package/dist/cliArgv.js +9 -4
- package/dist/cliArgv.js.map +1 -1
- package/dist/cliArgv.test.d.ts +2 -0
- package/dist/cliArgv.test.d.ts.map +1 -0
- package/dist/cliArgv.test.js +34 -0
- package/dist/cliArgv.test.js.map +1 -0
- package/dist/cliOperationalCodes.d.ts +8 -0
- package/dist/cliOperationalCodes.d.ts.map +1 -1
- package/dist/cliOperationalCodes.js +8 -0
- package/dist/cliOperationalCodes.js.map +1 -1
- package/dist/commercial/activationCorrelation.d.ts +3 -0
- package/dist/commercial/activationCorrelation.d.ts.map +1 -0
- package/dist/commercial/activationCorrelation.js +6 -0
- package/dist/commercial/activationCorrelation.js.map +1 -0
- package/dist/commercial/getCurrentUsage.d.ts +16 -0
- package/dist/commercial/getCurrentUsage.d.ts.map +1 -0
- package/dist/commercial/getCurrentUsage.js +33 -0
- package/dist/commercial/getCurrentUsage.js.map +1 -0
- package/dist/commercial/licensePreflight.d.ts +1 -0
- package/dist/commercial/licensePreflight.d.ts.map +1 -1
- package/dist/commercial/licensePreflight.js +27 -8
- package/dist/commercial/licensePreflight.js.map +1 -1
- package/dist/commercial/postVerifyOutcomeBeacon.d.ts +5 -3
- package/dist/commercial/postVerifyOutcomeBeacon.d.ts.map +1 -1
- package/dist/commercial/postVerifyOutcomeBeacon.js +17 -10
- package/dist/commercial/postVerifyOutcomeBeacon.js.map +1 -1
- package/dist/commercial/verifyOutcomeBeaconBody.d.ts +12 -0
- package/dist/commercial/verifyOutcomeBeaconBody.d.ts.map +1 -0
- package/dist/commercial/verifyOutcomeBeaconBody.js +26 -0
- package/dist/commercial/verifyOutcomeBeaconBody.js.map +1 -0
- package/dist/commercial/verifyWorkloadClassify.d.ts +2 -7
- package/dist/commercial/verifyWorkloadClassify.d.ts.map +1 -1
- package/dist/commercial/verifyWorkloadClassify.js +1 -1
- package/dist/commercial/verifyWorkloadClassify.js.map +1 -1
- package/dist/commercial/verifyWorkloadClassify.test.js +7 -0
- package/dist/commercial/verifyWorkloadClassify.test.js.map +1 -1
- package/dist/compare.acceptance.test.js +25 -0
- package/dist/compare.acceptance.test.js.map +1 -1
- package/dist/compareRunManifest.d.ts +32 -0
- package/dist/compareRunManifest.d.ts.map +1 -0
- package/dist/compareRunManifest.js +60 -0
- package/dist/compareRunManifest.js.map +1 -0
- package/dist/crossing/crossingDecisionReadyFooter.d.ts +1 -1
- package/dist/crossing/crossingDecisionReadyFooter.js +1 -1
- package/dist/crossing/runCrossingSubcommand.js +8 -8
- package/dist/debug-ui/app.css +42 -0
- package/dist/debug-ui/app.js +206 -15
- package/dist/debug-ui/index.html +11 -4
- package/dist/debug-ui/urlState.d.ts +15 -0
- package/dist/debug-ui/urlState.js +92 -0
- package/dist/debugCorpus.test.js +33 -7
- package/dist/debugCorpus.test.js.map +1 -1
- package/dist/debugPanels.d.ts +0 -3
- package/dist/debugPanels.d.ts.map +1 -1
- package/dist/debugPanels.js +0 -23
- package/dist/debugPanels.js.map +1 -1
- package/dist/debugPanels.test.js +16 -15
- package/dist/debugPanels.test.js.map +1 -1
- package/dist/debugServer.d.ts.map +1 -1
- package/dist/debugServer.js +19 -16
- package/dist/debugServer.js.map +1 -1
- package/dist/debugServer.test.js +18 -9
- package/dist/debugServer.test.js.map +1 -1
- package/dist/debugUiUrlState.test.d.ts +2 -0
- package/dist/debugUiUrlState.test.d.ts.map +1 -0
- package/dist/debugUiUrlState.test.js +49 -0
- package/dist/debugUiUrlState.test.js.map +1 -0
- package/dist/decisionBlocker.contract.test.d.ts +2 -0
- package/dist/decisionBlocker.contract.test.d.ts.map +1 -0
- package/dist/decisionBlocker.contract.test.js +51 -0
- package/dist/decisionBlocker.contract.test.js.map +1 -0
- package/dist/decisionBlocker.d.ts +10 -0
- package/dist/decisionBlocker.d.ts.map +1 -0
- package/dist/decisionBlocker.js +66 -0
- package/dist/decisionBlocker.js.map +1 -0
- package/dist/decisionGate.assertSafe.test.d.ts +2 -0
- package/dist/decisionGate.assertSafe.test.d.ts.map +1 -0
- package/dist/decisionGate.assertSafe.test.js +52 -0
- package/dist/decisionGate.assertSafe.test.js.map +1 -0
- package/dist/decisionGate.d.ts +23 -0
- package/dist/decisionGate.d.ts.map +1 -0
- package/dist/decisionGate.js +85 -0
- package/dist/decisionGate.js.map +1 -0
- package/dist/decisionGate.persistBundle.test.d.ts +2 -0
- package/dist/decisionGate.persistBundle.test.d.ts.map +1 -0
- package/dist/{withWorkflowVerification.persistBundle.test.js → decisionGate.persistBundle.test.js} +31 -19
- package/dist/decisionGate.persistBundle.test.js.map +1 -0
- package/dist/decisionUnsafeError.d.ts +8 -0
- package/dist/decisionUnsafeError.d.ts.map +1 -0
- package/dist/decisionUnsafeError.js +12 -0
- package/dist/decisionUnsafeError.js.map +1 -0
- package/dist/discovery-payload-v1.json +167 -59
- package/dist/enforceCli.d.ts.map +1 -1
- package/dist/enforceCli.js +15 -40
- package/dist/enforceCli.js.map +1 -1
- package/dist/enforceStateful.d.ts +2 -0
- package/dist/enforceStateful.d.ts.map +1 -0
- package/dist/enforceStateful.js +106 -0
- package/dist/enforceStateful.js.map +1 -0
- package/dist/enforcementProjection.d.ts +17 -0
- package/dist/enforcementProjection.d.ts.map +1 -0
- package/dist/enforcementProjection.js +20 -0
- package/dist/enforcementProjection.js.map +1 -0
- package/dist/executionPathFindings.d.ts +1 -1
- package/dist/executionPathFindings.d.ts.map +1 -1
- package/dist/executionPathFindings.js +2 -2
- package/dist/executionPathFindings.js.map +1 -1
- package/dist/executionTrace.js +2 -2
- package/dist/executionTrace.js.map +1 -1
- package/dist/executionTrace.test.js +35 -0
- package/dist/executionTrace.test.js.map +1 -1
- package/dist/executionTraceDiff.d.ts +36 -0
- package/dist/executionTraceDiff.d.ts.map +1 -0
- package/dist/executionTraceDiff.js +86 -0
- package/dist/executionTraceDiff.js.map +1 -0
- package/dist/executionTraceDiff.test.d.ts +2 -0
- package/dist/executionTraceDiff.test.d.ts.map +1 -0
- package/dist/executionTraceDiff.test.js +44 -0
- package/dist/executionTraceDiff.test.js.map +1 -0
- package/dist/failureCatalog.d.ts +1 -0
- package/dist/failureCatalog.d.ts.map +1 -1
- package/dist/failureCatalog.js +1 -0
- package/dist/failureCatalog.js.map +1 -1
- package/dist/failureOriginCatalog.d.ts.map +1 -1
- package/dist/failureOriginCatalog.js +20 -0
- package/dist/failureOriginCatalog.js.map +1 -1
- package/dist/firstFiveMinutesChecklist.d.ts +11 -0
- package/dist/firstFiveMinutesChecklist.d.ts.map +1 -0
- package/dist/firstFiveMinutesChecklist.js +18 -0
- package/dist/firstFiveMinutesChecklist.js.map +1 -0
- package/dist/funnel/workflowLineageClassify.d.ts +1 -1
- package/dist/funnel/workflowLineageClassify.js +1 -1
- package/dist/index.d.ts +22 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/langGraphCheckpointTrustGate.d.ts +38 -0
- package/dist/langGraphCheckpointTrustGate.d.ts.map +1 -0
- package/dist/langGraphCheckpointTrustGate.js +124 -0
- package/dist/langGraphCheckpointTrustGate.js.map +1 -0
- package/dist/langGraphCheckpointTrustIneligibleCertificate.d.ts +8 -0
- package/dist/langGraphCheckpointTrustIneligibleCertificate.d.ts.map +1 -0
- package/dist/langGraphCheckpointTrustIneligibleCertificate.js +17 -0
- package/dist/langGraphCheckpointTrustIneligibleCertificate.js.map +1 -0
- package/dist/langGraphCheckpointTrustUnsafeError.d.ts +8 -0
- package/dist/langGraphCheckpointTrustUnsafeError.d.ts.map +1 -0
- package/dist/langGraphCheckpointTrustUnsafeError.js +12 -0
- package/dist/langGraphCheckpointTrustUnsafeError.js.map +1 -0
- package/dist/loadEvents.d.ts +5 -0
- package/dist/loadEvents.d.ts.map +1 -1
- package/dist/loadEvents.js +32 -0
- package/dist/loadEvents.js.map +1 -1
- package/dist/operationalDisposition.d.ts +64 -0
- package/dist/operationalDisposition.d.ts.map +1 -1
- package/dist/operationalDisposition.js +64 -0
- package/dist/operationalDisposition.js.map +1 -1
- package/dist/outcomeCertificate.d.ts +60 -0
- package/dist/outcomeCertificate.d.ts.map +1 -0
- package/dist/outcomeCertificate.js +254 -0
- package/dist/outcomeCertificate.js.map +1 -0
- package/dist/outcomeCertificate.test.d.ts +2 -0
- package/dist/outcomeCertificate.test.d.ts.map +1 -0
- package/dist/outcomeCertificate.test.js +74 -0
- package/dist/outcomeCertificate.test.js.map +1 -0
- package/dist/pipeline.d.ts +19 -17
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +61 -167
- package/dist/pipeline.js.map +1 -1
- package/dist/planTransition.test.js +4 -4
- package/dist/publicDistribution.generated.d.ts +2 -2
- package/dist/publicDistribution.generated.d.ts.map +1 -1
- package/dist/publicDistribution.generated.js +7 -8
- package/dist/publicDistribution.generated.js.map +1 -1
- package/dist/quickVerify/quickVerifyScope.d.ts +1 -1
- package/dist/quickVerify/quickVerifyScope.js +1 -1
- package/dist/quickVerify/runQuickVerify.js +1 -1
- package/dist/quickVerify/runQuickVerify.js.map +1 -1
- package/dist/quickVerify/verifyExecution.d.ts +1 -1
- package/dist/quickVerify/verifyExecution.d.ts.map +1 -1
- package/dist/quickVerify/verifyExecution.js +3 -2
- package/dist/quickVerify/verifyExecution.js.map +1 -1
- package/dist/reconciler.d.ts +6 -2
- package/dist/reconciler.d.ts.map +1 -1
- package/dist/reconciler.js +17 -11
- package/dist/reconciler.js.map +1 -1
- package/dist/registryDraft/createRegistryDraftAjv.d.ts +1 -1
- package/dist/registryDraft/createRegistryDraftAjv.js +1 -1
- package/dist/regressionArtifact.d.ts +63 -0
- package/dist/regressionArtifact.d.ts.map +1 -0
- package/dist/regressionArtifact.js +290 -0
- package/dist/regressionArtifact.js.map +1 -0
- package/dist/relationalInvariant.d.ts +13 -3
- package/dist/relationalInvariant.d.ts.map +1 -1
- package/dist/relationalInvariant.existsSql.test.js +1 -1
- package/dist/relationalInvariant.existsSql.test.js.map +1 -1
- package/dist/relationalInvariant.js +59 -39
- package/dist/relationalInvariant.js.map +1 -1
- package/dist/relationalInvariant.test.js +2 -2
- package/dist/relationalInvariant.test.js.map +1 -1
- package/dist/resolveExpectation.d.ts +18 -2
- package/dist/resolveExpectation.d.ts.map +1 -1
- package/dist/resolveExpectation.js +332 -1
- package/dist/resolveExpectation.js.map +1 -1
- package/dist/resolveExpectation.test.js +25 -0
- package/dist/resolveExpectation.test.js.map +1 -1
- package/dist/runComparison.d.ts +0 -1
- package/dist/runComparison.d.ts.map +1 -1
- package/dist/runComparison.js +18 -86
- package/dist/runComparison.js.map +1 -1
- package/dist/runComparison.test.js +101 -57
- package/dist/runComparison.test.js.map +1 -1
- package/dist/schema-validation.test.js +29 -0
- package/dist/schema-validation.test.js.map +1 -1
- package/dist/schemaLoad.d.ts +1 -1
- package/dist/schemaLoad.d.ts.map +1 -1
- package/dist/schemaLoad.js +15 -0
- package/dist/schemaLoad.js.map +1 -1
- package/dist/shareReport/postPublicVerificationReport.d.ts +6 -0
- package/dist/shareReport/postPublicVerificationReport.d.ts.map +1 -1
- package/dist/shareReport/postPublicVerificationReport.js +3 -1
- package/dist/shareReport/postPublicVerificationReport.js.map +1 -1
- package/dist/sortedJsonStringify.d.ts +2 -0
- package/dist/sortedJsonStringify.d.ts.map +1 -0
- package/dist/sortedJsonStringify.js +23 -0
- package/dist/sortedJsonStringify.js.map +1 -0
- package/dist/sqlDialect.d.ts +8 -0
- package/dist/sqlDialect.d.ts.map +1 -0
- package/dist/sqlDialect.js +37 -0
- package/dist/sqlDialect.js.map +1 -0
- package/dist/standardVerifyWorkflowCli.d.ts +20 -5
- package/dist/standardVerifyWorkflowCli.d.ts.map +1 -1
- package/dist/standardVerifyWorkflowCli.js +56 -24
- package/dist/standardVerifyWorkflowCli.js.map +1 -1
- package/dist/stateWitness.d.ts +4 -0
- package/dist/stateWitness.d.ts.map +1 -0
- package/dist/stateWitness.js +383 -0
- package/dist/stateWitness.js.map +1 -0
- package/dist/stateWitness.test.d.ts +2 -0
- package/dist/stateWitness.test.d.ts.map +1 -0
- package/dist/stateWitness.test.js +120 -0
- package/dist/stateWitness.test.js.map +1 -0
- package/dist/telemetry/maybeEmitOssClaimTicketUrl.d.ts +2 -0
- package/dist/telemetry/maybeEmitOssClaimTicketUrl.d.ts.map +1 -1
- package/dist/telemetry/maybeEmitOssClaimTicketUrl.js +13 -2
- package/dist/telemetry/maybeEmitOssClaimTicketUrl.js.map +1 -1
- package/dist/telemetry/ossClaimOrigin.d.ts +1 -1
- package/dist/telemetry/ossClaimOrigin.js +1 -1
- package/dist/telemetry/postOssClaimContinuation.d.ts +1 -1
- package/dist/telemetry/postOssClaimContinuation.d.ts.map +1 -1
- package/dist/telemetry/postOssClaimContinuation.js +10 -6
- package/dist/telemetry/postOssClaimContinuation.js.map +1 -1
- package/dist/telemetry/postOssClaimTicket.d.ts +8 -0
- package/dist/telemetry/postOssClaimTicket.d.ts.map +1 -1
- package/dist/telemetry/postOssClaimTicket.js +31 -5
- package/dist/telemetry/postOssClaimTicket.js.map +1 -1
- package/dist/telemetry/verificationHypothesisContract.d.ts +1 -1
- package/dist/telemetry/verificationHypothesisContract.js +1 -1
- package/dist/trustDecision.d.ts +8 -0
- package/dist/trustDecision.d.ts.map +1 -0
- package/dist/trustDecision.js +13 -0
- package/dist/trustDecision.js.map +1 -0
- package/dist/types.d.ts +139 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/verificationConnections.d.ts +10 -0
- package/dist/verificationConnections.d.ts.map +1 -0
- package/dist/verificationConnections.js +190 -0
- package/dist/verificationConnections.js.map +1 -0
- package/dist/verificationDatabaseUrl.d.ts +11 -0
- package/dist/verificationDatabaseUrl.d.ts.map +1 -0
- package/dist/verificationDatabaseUrl.js +41 -0
- package/dist/verificationDatabaseUrl.js.map +1 -0
- package/dist/verificationDatabaseUrl.test.d.ts +2 -0
- package/dist/verificationDatabaseUrl.test.d.ts.map +1 -0
- package/dist/verificationDatabaseUrl.test.js +66 -0
- package/dist/verificationDatabaseUrl.test.js.map +1 -0
- package/dist/verificationDiagnostics.d.ts.map +1 -1
- package/dist/verificationDiagnostics.js +33 -9
- package/dist/verificationDiagnostics.js.map +1 -1
- package/dist/verificationDiagnostics.test.js +15 -0
- package/dist/verificationDiagnostics.test.js.map +1 -1
- package/dist/verificationPolicy.d.ts +2 -1
- package/dist/verificationPolicy.d.ts.map +1 -1
- package/dist/verificationPolicy.js +97 -0
- package/dist/verificationPolicy.js.map +1 -1
- package/dist/verificationPolicy.test.js +7 -0
- package/dist/verificationPolicy.test.js.map +1 -1
- package/dist/verificationRunContext.d.ts.map +1 -1
- package/dist/verificationRunContext.js +3 -0
- package/dist/verificationRunContext.js.map +1 -1
- package/dist/verificationUserPhrases.d.ts.map +1 -1
- package/dist/verificationUserPhrases.js +21 -0
- package/dist/verificationUserPhrases.js.map +1 -1
- package/dist/verify/batchVerifyTelemetrySubcommand.d.ts.map +1 -1
- package/dist/verify/batchVerifyTelemetrySubcommand.js +131 -33
- package/dist/verify/batchVerifyTelemetrySubcommand.js.map +1 -1
- package/dist/verifyAgentskeptic.d.ts +4 -8
- package/dist/verifyAgentskeptic.d.ts.map +1 -1
- package/dist/verifyAgentskeptic.js +16 -21
- package/dist/verifyAgentskeptic.js.map +1 -1
- package/dist/verifyAgentskeptic.test.js +10 -12
- package/dist/verifyAgentskeptic.test.js.map +1 -1
- package/dist/verifyRunStateFromBufferedRunEvents.d.ts +18 -0
- package/dist/verifyRunStateFromBufferedRunEvents.d.ts.map +1 -0
- package/dist/verifyRunStateFromBufferedRunEvents.js +65 -0
- package/dist/verifyRunStateFromBufferedRunEvents.js.map +1 -0
- package/dist/vitestMonorepoRoot.d.ts +10 -0
- package/dist/vitestMonorepoRoot.d.ts.map +1 -0
- package/dist/vitestMonorepoRoot.js +97 -0
- package/dist/vitestMonorepoRoot.js.map +1 -0
- package/dist/wireReasonCodes.d.ts +21 -0
- package/dist/wireReasonCodes.d.ts.map +1 -1
- package/dist/wireReasonCodes.js +21 -0
- package/dist/wireReasonCodes.js.map +1 -1
- package/package.json +63 -40
- package/schemas/assurance-output-v1.schema.json +81 -0
- package/schemas/compare-run-manifest-v1.schema.json +65 -0
- package/schemas/conformance-normalized-result.schema.json +73 -0
- package/schemas/connector-capabilities.schema.json +38 -0
- package/schemas/event.schema.json +35 -0
- package/schemas/execution-trace-view.schema.json +1 -1
- package/schemas/openapi-commercial-v1.in.yaml +616 -17
- package/schemas/openapi-commercial-v1.yaml +616 -17
- package/schemas/outcome-certificate-v1.schema.json +89 -0
- package/schemas/public-verification-report-v2.schema.json +15 -0
- package/schemas/quick-verify-report.schema.json +1 -1
- package/schemas/regression-artifact-v1.schema.json +212 -0
- package/schemas/tools-registry.schema.json +103 -0
- package/schemas/workflow-engine-result.schema.json +71 -2
- package/schemas/workflow-truth-report.schema.json +12 -0
- package/scripts/discovery-acquisition.lib.cjs +60 -97
- package/scripts/discovery-payload.lib.cjs +41 -7
- package/scripts/emit-primary-marketing.cjs +326 -0
- package/scripts/origin.cjs +52 -0
- package/scripts/public-product-anchors.cjs +3 -0
- package/scripts/validate-marketing.cjs +156 -0
- package/dist/withWorkflowVerification.persistBundle.test.d.ts +0 -2
- package/dist/withWorkflowVerification.persistBundle.test.d.ts.map +0 -1
- package/dist/withWorkflowVerification.persistBundle.test.js.map +0 -1
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const { readFileSync } = require("node:fs");
|
|
3
|
+
const { existsSync, readFileSync, readdirSync } = require("node:fs");
|
|
4
4
|
const { join } = require("node:path");
|
|
5
|
-
const Ajv = require("ajv");
|
|
6
|
-
const addFormats = require("ajv-formats");
|
|
7
5
|
|
|
8
6
|
const PLACEHOLDER_KEYS = [
|
|
9
7
|
["{{ORIGIN}}", "ORIGIN"],
|
|
@@ -20,8 +18,7 @@ const PLACEHOLDER_KEYS = [
|
|
|
20
18
|
*/
|
|
21
19
|
function discoveryPaths(root) {
|
|
22
20
|
return {
|
|
23
|
-
jsonPath: join(root, "config", "
|
|
24
|
-
schemaPath: join(root, "config", "discovery-acquisition.schema.json"),
|
|
21
|
+
jsonPath: join(root, "config", "marketing.json"),
|
|
25
22
|
};
|
|
26
23
|
}
|
|
27
24
|
|
|
@@ -33,6 +30,36 @@ function loadDiscoveryAcquisition(root) {
|
|
|
33
30
|
return JSON.parse(readFileSync(jsonPath, "utf8"));
|
|
34
31
|
}
|
|
35
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @param {string} root
|
|
35
|
+
* @returns {{ guides: string[]; examples: string[]; compare: string[] }}
|
|
36
|
+
*/
|
|
37
|
+
function listMarkdownSurfaceRoutesGrouped(root) {
|
|
38
|
+
const base = join(root, "website", "content", "surfaces");
|
|
39
|
+
/** @type {{ guides: string[]; examples: string[]; compare: string[] }} */
|
|
40
|
+
const out = { guides: [], examples: [], compare: [] };
|
|
41
|
+
for (const seg of /** @type {const} */ (["guides", "examples", "compare"])) {
|
|
42
|
+
const dir = join(base, seg);
|
|
43
|
+
if (!existsSync(dir)) continue;
|
|
44
|
+
for (const f of readdirSync(dir)) {
|
|
45
|
+
if (!f.endsWith(".md")) continue;
|
|
46
|
+
const raw = readFileSync(join(dir, f), "utf8");
|
|
47
|
+
const m = raw.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
48
|
+
if (!m) throw new Error(`markdown-surfaces: missing frontmatter in ${seg}/${f}`);
|
|
49
|
+
const rm = m[1].match(/^route:\s*(.+)$/m);
|
|
50
|
+
if (!rm) throw new Error(`markdown-surfaces: missing route in ${seg}/${f}`);
|
|
51
|
+
const route = rm[1].trim().replace(/^['"]|['"]$/g, "");
|
|
52
|
+
if (seg === "guides") out.guides.push(route);
|
|
53
|
+
else if (seg === "examples") out.examples.push(route);
|
|
54
|
+
else out.compare.push(route);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
out.guides.sort((a, b) => a.localeCompare(b, "en", { sensitivity: "base" }));
|
|
58
|
+
out.examples.sort((a, b) => a.localeCompare(b, "en", { sensitivity: "base" }));
|
|
59
|
+
out.compare.sort((a, b) => a.localeCompare(b, "en", { sensitivity: "base" }));
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
|
|
36
63
|
/**
|
|
37
64
|
* @param {Record<string, unknown>} discovery
|
|
38
65
|
* @param {string} originNormalized
|
|
@@ -85,71 +112,6 @@ function escapeMdLinkText(s) {
|
|
|
85
112
|
return s.replace(/\\/g, "\\\\").replace(/\[/g, "\\[").replace(/\]/g, "\\]");
|
|
86
113
|
}
|
|
87
114
|
|
|
88
|
-
/**
|
|
89
|
-
* @param {Record<string, unknown>} discovery
|
|
90
|
-
*/
|
|
91
|
-
function validateIndexableGuides(discovery) {
|
|
92
|
-
const guides = /** @type {{ path: string; navLabel: string; problemAnchor: string }[]} */ (
|
|
93
|
-
discovery.indexableGuides
|
|
94
|
-
);
|
|
95
|
-
if (!Array.isArray(guides)) {
|
|
96
|
-
throw new Error("discovery-acquisition: indexableGuides must be an array");
|
|
97
|
-
}
|
|
98
|
-
const paths = guides.map((g) => String(g.path));
|
|
99
|
-
const uniq = new Set(paths);
|
|
100
|
-
if (uniq.size !== paths.length) {
|
|
101
|
-
throw new Error("discovery-acquisition: indexableGuides paths must be unique");
|
|
102
|
-
}
|
|
103
|
-
const demandMoments = /** @type {string[]} */ (discovery.demandMoments);
|
|
104
|
-
for (let k = 0; k < guides.length; k++) {
|
|
105
|
-
const pa = String(guides[k].problemAnchor);
|
|
106
|
-
if (pa.includes("`")) {
|
|
107
|
-
throw new Error("discovery-acquisition: problemAnchor must not contain backtick");
|
|
108
|
-
}
|
|
109
|
-
if (k >= 1) {
|
|
110
|
-
const dm = String(demandMoments[k - 1]);
|
|
111
|
-
if (!dm.includes(pa)) {
|
|
112
|
-
throw new Error(
|
|
113
|
-
`discovery-acquisition: indexableGuides[${k}].problemAnchor must be a substring of demandMoments[${k - 1}]`,
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* @param {Record<string, unknown>} discovery
|
|
122
|
-
*/
|
|
123
|
-
function validateIndexableExamples(discovery) {
|
|
124
|
-
const ex = /** @type {{ path: string; navLabel: string; problemAnchor: string; embedKey: string }[]} */ (
|
|
125
|
-
discovery.indexableExamples
|
|
126
|
-
);
|
|
127
|
-
if (!Array.isArray(ex)) {
|
|
128
|
-
throw new Error("discovery-acquisition: indexableExamples must be an array");
|
|
129
|
-
}
|
|
130
|
-
if (ex.length !== 2) {
|
|
131
|
-
throw new Error("discovery-acquisition: indexableExamples must have length exactly 2");
|
|
132
|
-
}
|
|
133
|
-
if (ex[0].path !== "/examples/wf-complete" || ex[1].path !== "/examples/wf-missing") {
|
|
134
|
-
throw new Error(
|
|
135
|
-
"discovery-acquisition: indexableExamples paths must be /examples/wf-complete then /examples/wf-missing",
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
if (ex[0].embedKey !== "wf_complete" || ex[1].embedKey !== "wf_missing") {
|
|
139
|
-
throw new Error(
|
|
140
|
-
"discovery-acquisition: indexableExamples embedKey order must be wf_complete then wf_missing",
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
for (let i = 0; i < ex.length; i++) {
|
|
144
|
-
const row = ex[i];
|
|
145
|
-
const nl = String(row.navLabel);
|
|
146
|
-
const pa = String(row.problemAnchor);
|
|
147
|
-
if (nl.includes("`") || pa.includes("`")) {
|
|
148
|
-
throw new Error(`discovery-acquisition: indexableExamples[${i}] must not contain backtick`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
115
|
/**
|
|
154
116
|
* @param {string} baseLlms
|
|
155
117
|
* @param {Record<string, unknown>} discovery
|
|
@@ -162,18 +124,24 @@ function appendDiscoveryLlmsAppendix(baseLlms, discovery, canonicalOrigin) {
|
|
|
162
124
|
const bullets = (/** @type {string[]} */ arr) => arr.map((x) => `- ${x}`).join("\n");
|
|
163
125
|
|
|
164
126
|
let out = String(baseLlms).replace(/\s*$/, "") + "\n";
|
|
165
|
-
const
|
|
166
|
-
|
|
127
|
+
const root = join(__dirname, "..");
|
|
128
|
+
const grouped = listMarkdownSurfaceRoutesGrouped(root);
|
|
129
|
+
if (grouped.guides.length > 0) {
|
|
167
130
|
out += "\n## Indexable guides\n";
|
|
168
|
-
for (const
|
|
169
|
-
out += `- ${origin}${
|
|
131
|
+
for (const path of grouped.guides) {
|
|
132
|
+
out += `- ${origin}${path}\n`;
|
|
170
133
|
}
|
|
171
134
|
}
|
|
172
|
-
|
|
173
|
-
if (Array.isArray(examples) && examples.length > 0) {
|
|
135
|
+
if (grouped.examples.length > 0) {
|
|
174
136
|
out += "\n## Indexable examples\n";
|
|
175
|
-
for (const
|
|
176
|
-
out += `- ${origin}${
|
|
137
|
+
for (const path of grouped.examples) {
|
|
138
|
+
out += `- ${origin}${path}\n`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (grouped.compare.length > 0) {
|
|
142
|
+
out += "\n## Indexable comparisons\n";
|
|
143
|
+
for (const path of grouped.compare) {
|
|
144
|
+
out += `- ${origin}${path}\n`;
|
|
177
145
|
}
|
|
178
146
|
}
|
|
179
147
|
const demo = discovery.shareableTerminalDemo;
|
|
@@ -186,9 +154,15 @@ function appendDiscoveryLlmsAppendix(baseLlms, discovery, canonicalOrigin) {
|
|
|
186
154
|
out += bullets(llms.notFor) + "\n";
|
|
187
155
|
out += "\n## Related queries\n";
|
|
188
156
|
out += bullets(llms.relatedQueries) + "\n";
|
|
189
|
-
const
|
|
157
|
+
const rows = /** @type {{ moment: string; primaryRoute: string; relatedRoutes?: string[] }[]} */ (
|
|
158
|
+
discovery.problemIndex
|
|
159
|
+
);
|
|
190
160
|
out += "\n## When this hurts (search-shaped)\n";
|
|
191
|
-
|
|
161
|
+
for (const row of rows) {
|
|
162
|
+
const paths = [row.primaryRoute, ...(Array.isArray(row.relatedRoutes) ? row.relatedRoutes : [])];
|
|
163
|
+
const links = paths.map((p) => `${origin}${String(p).startsWith("/") ? String(p) : `/${String(p)}`}`);
|
|
164
|
+
out += `- ${row.moment} — ${links.join(" · ")}\n`;
|
|
165
|
+
}
|
|
192
166
|
out += "\n## Problem framing (shareable)\n";
|
|
193
167
|
out += `- Full page: ${origin}${slug}\n`;
|
|
194
168
|
out += "\n## Visitor problem (canonical answer)\n\n";
|
|
@@ -200,20 +174,12 @@ function appendDiscoveryLlmsAppendix(baseLlms, discovery, canonicalOrigin) {
|
|
|
200
174
|
* @param {string} root
|
|
201
175
|
*/
|
|
202
176
|
function validateDiscoveryAcquisition(root) {
|
|
203
|
-
const { jsonPath
|
|
177
|
+
const { jsonPath } = discoveryPaths(root);
|
|
178
|
+
const { validateMarketing } = require("./validate-marketing.cjs");
|
|
179
|
+
validateMarketing(root);
|
|
204
180
|
const discovery = JSON.parse(readFileSync(jsonPath, "utf8"));
|
|
205
|
-
const
|
|
206
|
-
const
|
|
207
|
-
addFormats(ajv);
|
|
208
|
-
const validate = ajv.compile(schema);
|
|
209
|
-
if (!validate(discovery)) {
|
|
210
|
-
const msg = ajv.errorsText(validate.errors, { separator: "\n" });
|
|
211
|
-
throw new Error(`discovery-acquisition: schema validation failed:\n${msg}`);
|
|
212
|
-
}
|
|
213
|
-
const anchorsPath = join(root, "config", "public-product-anchors.json");
|
|
214
|
-
const anchors = JSON.parse(readFileSync(anchorsPath, "utf8"));
|
|
215
|
-
const { normalize } = require("./public-product-anchors.cjs");
|
|
216
|
-
const origin = normalize(anchors.productionCanonicalOrigin);
|
|
181
|
+
const { normalize } = require("./origin.cjs");
|
|
182
|
+
const origin = normalize(String(discovery.productionCanonicalOrigin));
|
|
217
183
|
buildDiscoveryFoldBody(discovery, origin);
|
|
218
184
|
const demo = discovery.shareableTerminalDemo;
|
|
219
185
|
if (demo && String(demo.transcript).includes("```")) {
|
|
@@ -221,8 +187,6 @@ function validateDiscoveryAcquisition(root) {
|
|
|
221
187
|
"discovery-acquisition: shareableTerminalDemo.transcript must not contain markdown fence ```",
|
|
222
188
|
);
|
|
223
189
|
}
|
|
224
|
-
validateIndexableGuides(discovery);
|
|
225
|
-
validateIndexableExamples(discovery);
|
|
226
190
|
return discovery;
|
|
227
191
|
}
|
|
228
192
|
|
|
@@ -231,7 +195,6 @@ module.exports = {
|
|
|
231
195
|
buildDiscoveryFoldBody,
|
|
232
196
|
appendDiscoveryLlmsAppendix,
|
|
233
197
|
validateDiscoveryAcquisition,
|
|
234
|
-
validateIndexableGuides,
|
|
235
|
-
validateIndexableExamples,
|
|
236
198
|
discoveryPaths,
|
|
199
|
+
listMarkdownSurfaceRoutesGrouped,
|
|
237
200
|
};
|
|
@@ -105,8 +105,37 @@ function buildDiscoveryPayload(root) {
|
|
|
105
105
|
const discoveryLib = require("./discovery-acquisition.lib.cjs");
|
|
106
106
|
discoveryLib.validateDiscoveryAcquisition(root);
|
|
107
107
|
const discovery = discoveryLib.loadDiscoveryAcquisition(root);
|
|
108
|
-
const
|
|
109
|
-
const
|
|
108
|
+
const grouped = discoveryLib.listMarkdownSurfaceRoutesGrouped(root);
|
|
109
|
+
const padAnchor = (path) =>
|
|
110
|
+
`Markdown-backed discovery surface content for ${path} — read-only SQL verification context.`;
|
|
111
|
+
const indexableGuidesFromMd = grouped.guides.map((path) => ({
|
|
112
|
+
path,
|
|
113
|
+
navLabel: path.replace(/^\/guides\//, ""),
|
|
114
|
+
problemAnchor: padAnchor(path),
|
|
115
|
+
}));
|
|
116
|
+
const embedKeyForExamplePath = (examplePath) => {
|
|
117
|
+
const tail = String(examplePath).replace(/^\/examples\//, "");
|
|
118
|
+
switch (tail) {
|
|
119
|
+
case "wf-complete":
|
|
120
|
+
return "wf_complete";
|
|
121
|
+
case "wf-missing":
|
|
122
|
+
return "wf_missing";
|
|
123
|
+
case "langgraph-checkpoint-trust":
|
|
124
|
+
return "langgraph_checkpoint_trust";
|
|
125
|
+
default:
|
|
126
|
+
throw new Error(`discovery-payload: unknown example path for embedKey: ${examplePath}`);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const indexableExamplesFromMd = grouped.examples.map((path) => ({
|
|
130
|
+
path,
|
|
131
|
+
navLabel: path.replace(/^\/examples\//, ""),
|
|
132
|
+
problemAnchor: padAnchor(path),
|
|
133
|
+
embedKey: embedKeyForExamplePath(path),
|
|
134
|
+
}));
|
|
135
|
+
const pm = /** @type {{ productionCanonicalOrigin: string; identityOneLiner: string; gitRepositoryUrl: string; npmPackageUrl: string }} */ (
|
|
136
|
+
discovery
|
|
137
|
+
);
|
|
138
|
+
const anchors = pm;
|
|
110
139
|
const canonicalOrigin = normalizeOrigin(anchors.productionCanonicalOrigin);
|
|
111
140
|
const integrateUrl = `${canonicalOrigin}/integrate`;
|
|
112
141
|
const learnHubUrl = `${canonicalOrigin}/guides`;
|
|
@@ -114,6 +143,7 @@ function buildDiscoveryPayload(root) {
|
|
|
114
143
|
const { owner, repo } = parseGithubRepoFromUrl(anchors.gitRepositoryUrl);
|
|
115
144
|
const llmsRaw = `https://raw.githubusercontent.com/${owner}/${repo}/refs/heads/${DISCOVERY_LLM_BRANCH}/llms.txt`;
|
|
116
145
|
const llmsBlob = `https://github.com/${owner}/${repo}/blob/${DISCOVERY_LLM_BRANCH}/llms.txt`;
|
|
146
|
+
const integratorVerificationSsotRaw = `https://raw.githubusercontent.com/${owner}/${repo}/refs/heads/${DISCOVERY_LLM_BRANCH}/docs/integrator-verification.md`;
|
|
117
147
|
const openapiRaw = `https://raw.githubusercontent.com/${owner}/${repo}/refs/heads/${DISCOVERY_LLM_BRANCH}/schemas/openapi-commercial-v1.yaml`;
|
|
118
148
|
const llms = /** @type {{ intentPhrases: string[]; notFor: string[]; relatedQueries: string[] }} */ (
|
|
119
149
|
discovery.llms
|
|
@@ -133,6 +163,7 @@ function buildDiscoveryPayload(root) {
|
|
|
133
163
|
npm: String(anchors.npmPackageUrl),
|
|
134
164
|
llmsRaw,
|
|
135
165
|
llmsBlob,
|
|
166
|
+
integratorVerificationSsotRaw,
|
|
136
167
|
},
|
|
137
168
|
appendix: {
|
|
138
169
|
slug: String(discovery.slug),
|
|
@@ -140,9 +171,11 @@ function buildDiscoveryPayload(root) {
|
|
|
140
171
|
intentPhrases: llms.intentPhrases.map(String),
|
|
141
172
|
notFor: llms.notFor.map(String),
|
|
142
173
|
relatedQueries: llms.relatedQueries.map(String),
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
174
|
+
problemIndex: /** @type {unknown} */ (
|
|
175
|
+
Array.isArray(discovery.problemIndex) ? JSON.parse(JSON.stringify(discovery.problemIndex)) : []
|
|
176
|
+
),
|
|
177
|
+
indexableGuides: /** @type {unknown} */ (indexableGuidesFromMd),
|
|
178
|
+
indexableExamples: /** @type {unknown} */ (indexableExamplesFromMd),
|
|
146
179
|
shareableTerminalDemo: {
|
|
147
180
|
title: String(demo.title),
|
|
148
181
|
transcript: String(demo.transcript),
|
|
@@ -155,13 +188,13 @@ function buildDiscoveryPayload(root) {
|
|
|
155
188
|
* @param {Record<string, unknown>} payload
|
|
156
189
|
*/
|
|
157
190
|
function discoveryObjectFromAppendix(payload) {
|
|
158
|
-
const ap = /** @type {{ slug: string; visitorProblemAnswer: string; intentPhrases: string[]; notFor: string[]; relatedQueries: string[];
|
|
191
|
+
const ap = /** @type {{ slug: string; visitorProblemAnswer: string; intentPhrases: string[]; notFor: string[]; relatedQueries: string[]; problemIndex: { moment: string; primaryRoute: string; relatedRoutes?: string[] }[]; indexableGuides?: { path: string; navLabel: string; problemAnchor: string }[]; indexableExamples?: { path: string; navLabel: string; problemAnchor: string; embedKey: string }[]; shareableTerminalDemo?: { title: string; transcript: string } }} */ (
|
|
159
192
|
payload.appendix
|
|
160
193
|
);
|
|
161
194
|
const out = {
|
|
162
195
|
slug: ap.slug,
|
|
163
196
|
visitorProblemAnswer: ap.visitorProblemAnswer,
|
|
164
|
-
|
|
197
|
+
problemIndex: ap.problemIndex,
|
|
165
198
|
llms: {
|
|
166
199
|
intentPhrases: ap.intentPhrases,
|
|
167
200
|
notFor: ap.notFor,
|
|
@@ -214,6 +247,7 @@ function renderLlmsTextFromPayload(payload) {
|
|
|
214
247
|
"",
|
|
215
248
|
"## Primary links",
|
|
216
249
|
`- Canonical site: ${links.site}`,
|
|
250
|
+
`- Integrator verification SSOT (Python + LangGraph tables): ${links.integratorVerificationSsotRaw}`,
|
|
217
251
|
`- First-run integration: ${integrateUrl}`,
|
|
218
252
|
`- Learn: ${learnHubUrl}`,
|
|
219
253
|
`- OpenAPI (canonical): ${openapiSelfCanonical}`,
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { readFileSync, writeFileSync, mkdirSync } = require("node:fs");
|
|
4
|
+
const { join, dirname } = require("node:path");
|
|
5
|
+
const { normalize, assertNextPublicOriginParity, MARKETING_PATH } = require("./origin.cjs");
|
|
6
|
+
|
|
7
|
+
const ROOT = join(__dirname, "..");
|
|
8
|
+
|
|
9
|
+
const OPENAPI_IN = join(ROOT, "schemas", "openapi-commercial-v1.in.yaml");
|
|
10
|
+
const OPENAPI_OUT = join(ROOT, "schemas", "openapi-commercial-v1.yaml");
|
|
11
|
+
const OPENAPI_PUBLIC = join(ROOT, "website", "public", "openapi-commercial-v1.yaml");
|
|
12
|
+
const LLMS_PUBLIC = join(ROOT, "website", "public", "llms.txt");
|
|
13
|
+
const LLMS_REPO_ROOT = join(ROOT, "llms.txt");
|
|
14
|
+
const README_PATH = join(ROOT, "README.md");
|
|
15
|
+
const PKG_PATH = join(ROOT, "package.json");
|
|
16
|
+
|
|
17
|
+
const README_START = "<!-- public-product-anchors:start -->";
|
|
18
|
+
const README_END = "<!-- public-product-anchors:end -->";
|
|
19
|
+
const DISCOVERY_README_START = "<!-- discovery-acquisition-fold:start -->";
|
|
20
|
+
const DISCOVERY_README_END = "<!-- discovery-acquisition-fold:end -->";
|
|
21
|
+
const DISCOVERY_README_TITLE_START = "<!-- discovery-readme-title:start -->";
|
|
22
|
+
const DISCOVERY_README_TITLE_END = "<!-- discovery-readme-title:end -->";
|
|
23
|
+
|
|
24
|
+
const TOKENS = [
|
|
25
|
+
"__IDENTITY_ONE_LINER__",
|
|
26
|
+
"__DISTRIBUTION_CONTACT_URL__",
|
|
27
|
+
"__DISTRIBUTION_INTEGRATE_URL__",
|
|
28
|
+
"__DISTRIBUTION_REPO_URL__",
|
|
29
|
+
"__DISTRIBUTION_NPM_URL__",
|
|
30
|
+
"__OPENAPI_SELF_URL__",
|
|
31
|
+
"__SERVERS_ORIGIN__",
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @param {string} haystack
|
|
36
|
+
* @param {string} needle
|
|
37
|
+
*/
|
|
38
|
+
function countOccurrences(haystack, needle) {
|
|
39
|
+
let n = 0;
|
|
40
|
+
let i = 0;
|
|
41
|
+
while (true) {
|
|
42
|
+
const j = haystack.indexOf(needle, i);
|
|
43
|
+
if (j === -1) break;
|
|
44
|
+
n++;
|
|
45
|
+
i = j + needle.length;
|
|
46
|
+
}
|
|
47
|
+
return n;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function validateOpenapiTemplate() {
|
|
51
|
+
const template = readFileSync(OPENAPI_IN, "utf8");
|
|
52
|
+
for (const tok of TOKENS) {
|
|
53
|
+
const c = countOccurrences(template, tok);
|
|
54
|
+
if (c !== 1) {
|
|
55
|
+
throw new Error(`openapi template: token ${tok} must appear exactly once, found ${c}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function escapeYamlDoubleQuotedOneLiner(s) {
|
|
61
|
+
return String(s).replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {Record<string, unknown>} anchors
|
|
66
|
+
*/
|
|
67
|
+
function distributionSsotBlobUrl(anchors) {
|
|
68
|
+
const u = String(anchors.gitRepositoryUrl);
|
|
69
|
+
const m = u.match(/github\.com\/([^/]+)\/([^/#?]+)/i);
|
|
70
|
+
if (!m) throw new Error("emit-primary-marketing: cannot derive SSOT blob URL from gitRepositoryUrl");
|
|
71
|
+
const repo = m[2].replace(/\.git$/i, "");
|
|
72
|
+
return `https://github.com/${m[1]}/${repo}/blob/main/docs/public-distribution.md`;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @param {string} line
|
|
77
|
+
* @param {string} origin
|
|
78
|
+
* @param {string} slug
|
|
79
|
+
*/
|
|
80
|
+
function expandCliFooterLine(line, origin, slug) {
|
|
81
|
+
const acquisitionUrl = `${origin}${slug}`;
|
|
82
|
+
const integrateUrl = `${origin}/integrate`;
|
|
83
|
+
let out = String(line)
|
|
84
|
+
.replace(/\{\{ORIGIN\}\}/g, origin)
|
|
85
|
+
.replace(/\{\{ACQUISITION_URL\}\}/g, acquisitionUrl)
|
|
86
|
+
.replace(/\{\{INTEGRATE_URL\}\}/g, integrateUrl);
|
|
87
|
+
if (out.includes("{{")) {
|
|
88
|
+
throw new Error(`emit-primary-marketing: unresolved placeholder in cliFollowupLines: ${line}`);
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @param {Record<string, unknown>} anchors
|
|
95
|
+
* @param {Record<string, unknown>} discovery
|
|
96
|
+
*/
|
|
97
|
+
function writePublicDistributionGenerated(anchors, discovery) {
|
|
98
|
+
const ssotUrl = distributionSsotBlobUrl(anchors);
|
|
99
|
+
const origin = normalize(anchors.productionCanonicalOrigin);
|
|
100
|
+
const slug = String(discovery.slug);
|
|
101
|
+
const cliLines = /** @type {string[]} */ (discovery.cliFollowupLines);
|
|
102
|
+
const expanded = cliLines.map((l) => expandCliFooterLine(l, origin, slug));
|
|
103
|
+
expanded.push(`Distribution contract (SSOT): ${ssotUrl}`);
|
|
104
|
+
if (expanded.length > 6) {
|
|
105
|
+
throw new Error(
|
|
106
|
+
`emit-primary-marketing: distribution footer exceeds 6 lines (${expanded.length}); shorten cliFollowupLines`,
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
const returnParts = expanded.map((line) => `${JSON.stringify(`${line}\n`)}`);
|
|
110
|
+
const pkgRaw = readFileSync(PKG_PATH, "utf8");
|
|
111
|
+
const pkgJson = JSON.parse(pkgRaw);
|
|
112
|
+
const cliSemver = String(pkgJson.version ?? "").trim();
|
|
113
|
+
if (!cliSemver) {
|
|
114
|
+
throw new Error("emit-primary-marketing: package.json missing version");
|
|
115
|
+
}
|
|
116
|
+
const body = `// Generated by npm run emit-primary-marketing — do not hand edit.
|
|
117
|
+
|
|
118
|
+
export const PUBLIC_DISTRIBUTION_SSOT_BLOB_URL = ${JSON.stringify(ssotUrl)};
|
|
119
|
+
|
|
120
|
+
export const PUBLIC_CANONICAL_SITE_ORIGIN = ${JSON.stringify(origin)};
|
|
121
|
+
|
|
122
|
+
export const AGENTSKEPTIC_CLI_SEMVER = ${JSON.stringify(cliSemver)};
|
|
123
|
+
|
|
124
|
+
export function formatDistributionFooter(): string {
|
|
125
|
+
return ${returnParts.join("\n + ")};
|
|
126
|
+
}
|
|
127
|
+
`;
|
|
128
|
+
writeFileSync(join(ROOT, "src", "publicDistribution.generated.ts"), body, "utf8");
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @param {Record<string, unknown>} anchors
|
|
133
|
+
* @param {Record<string, unknown>} discovery
|
|
134
|
+
*/
|
|
135
|
+
function writeAgentsMd(anchors, discovery) {
|
|
136
|
+
const url = distributionSsotBlobUrl(anchors);
|
|
137
|
+
const origin = normalize(anchors.productionCanonicalOrigin);
|
|
138
|
+
const slug = String(discovery.slug);
|
|
139
|
+
const acquisitionUrl = `${origin}${slug}`;
|
|
140
|
+
const dp = require("./discovery-payload.lib.cjs");
|
|
141
|
+
const { owner, repo } = dp.parseGithubRepoFromUrl(String(anchors.gitRepositoryUrl));
|
|
142
|
+
const branch = dp.DISCOVERY_LLM_BRANCH;
|
|
143
|
+
const llmsRaw = `https://raw.githubusercontent.com/${owner}/${repo}/refs/heads/${branch}/llms.txt`;
|
|
144
|
+
const openapiRaw = `https://raw.githubusercontent.com/${owner}/${repo}/refs/heads/${branch}/schemas/openapi-commercial-v1.yaml`;
|
|
145
|
+
const body = `# AGENTS
|
|
146
|
+
|
|
147
|
+
Normative **public distribution** and anchor sync: [\`docs/public-distribution.md\`](docs/public-distribution.md) (same content as ${url}).
|
|
148
|
+
|
|
149
|
+
## Machine-readable product entrypoints
|
|
150
|
+
|
|
151
|
+
- Committed \`llms.txt\` at repo root (same bytes as site \`/llms.txt\` after prebuild sync).
|
|
152
|
+
- Raw GitHub \`llms.txt\`: ${llmsRaw}
|
|
153
|
+
- OpenAPI YAML (repo raw): ${openapiRaw}
|
|
154
|
+
- Acquisition page (canonical): ${acquisitionUrl}
|
|
155
|
+
`;
|
|
156
|
+
writeFileSync(join(ROOT, "AGENTS.md"), body, "utf8");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function syncPrimaryMarketing() {
|
|
160
|
+
const discoveryLib = require("./discovery-acquisition.lib.cjs");
|
|
161
|
+
discoveryLib.validateDiscoveryAcquisition(ROOT);
|
|
162
|
+
const pm = discoveryLib.loadDiscoveryAcquisition(ROOT);
|
|
163
|
+
const anchors = pm;
|
|
164
|
+
const discovery = pm;
|
|
165
|
+
|
|
166
|
+
validateOpenapiTemplate();
|
|
167
|
+
|
|
168
|
+
const escaped = escapeYamlDoubleQuotedOneLiner(anchors.identityOneLiner);
|
|
169
|
+
const canonicalOrigin = normalize(anchors.productionCanonicalOrigin);
|
|
170
|
+
const openapiSelfCanonical = `${canonicalOrigin}/openapi-commercial-v1.yaml`;
|
|
171
|
+
|
|
172
|
+
const envUrl = process.env.NEXT_PUBLIC_APP_URL;
|
|
173
|
+
const effectivePublicOrigin =
|
|
174
|
+
typeof envUrl === "string" && envUrl.trim() ? envUrl.trim() : anchors.productionCanonicalOrigin;
|
|
175
|
+
const publicOriginNormalized = normalize(effectivePublicOrigin);
|
|
176
|
+
const openapiSelfEffective = `${publicOriginNormalized}/openapi-commercial-v1.yaml`;
|
|
177
|
+
|
|
178
|
+
const integrateUrl = `${canonicalOrigin}/integrate`;
|
|
179
|
+
|
|
180
|
+
const template = readFileSync(OPENAPI_IN, "utf8");
|
|
181
|
+
let mid = template;
|
|
182
|
+
mid = mid.replace("__IDENTITY_ONE_LINER__", escaped);
|
|
183
|
+
mid = mid.replace("__DISTRIBUTION_CONTACT_URL__", canonicalOrigin);
|
|
184
|
+
mid = mid.replace("__DISTRIBUTION_INTEGRATE_URL__", integrateUrl);
|
|
185
|
+
mid = mid.replace("__DISTRIBUTION_REPO_URL__", anchors.gitRepositoryUrl);
|
|
186
|
+
mid = mid.replace("__DISTRIBUTION_NPM_URL__", anchors.npmPackageUrl);
|
|
187
|
+
|
|
188
|
+
const repoYaml = mid
|
|
189
|
+
.replace("__SERVERS_ORIGIN__", canonicalOrigin)
|
|
190
|
+
.replace("__OPENAPI_SELF_URL__", openapiSelfCanonical);
|
|
191
|
+
writeFileSync(OPENAPI_OUT, repoYaml, "utf8");
|
|
192
|
+
|
|
193
|
+
mkdirSync(dirname(OPENAPI_PUBLIC), { recursive: true });
|
|
194
|
+
const publicYaml = mid
|
|
195
|
+
.replace("__SERVERS_ORIGIN__", publicOriginNormalized)
|
|
196
|
+
.replace("__OPENAPI_SELF_URL__", openapiSelfEffective);
|
|
197
|
+
writeFileSync(OPENAPI_PUBLIC, publicYaml, "utf8");
|
|
198
|
+
|
|
199
|
+
const discoveryPayload = require("./discovery-payload.lib.cjs");
|
|
200
|
+
const discoveryPayloadObj = discoveryPayload.buildDiscoveryPayload(ROOT);
|
|
201
|
+
const llmsNormalized = discoveryPayload.renderLlmsTextFromPayload(discoveryPayloadObj);
|
|
202
|
+
|
|
203
|
+
mkdirSync(dirname(LLMS_PUBLIC), { recursive: true });
|
|
204
|
+
writeFileSync(LLMS_PUBLIC, llmsNormalized, "utf8");
|
|
205
|
+
writeFileSync(LLMS_REPO_ROOT, llmsNormalized, "utf8");
|
|
206
|
+
|
|
207
|
+
const pkgRaw = readFileSync(PKG_PATH, "utf8");
|
|
208
|
+
const pkg = JSON.parse(pkgRaw);
|
|
209
|
+
pkg.description = String(discovery.pageMetadata.description);
|
|
210
|
+
pkg.repository = { type: "git", url: anchors.gitRepositoryGitUrl };
|
|
211
|
+
pkg.homepage = `${canonicalOrigin}${String(discovery.slug)}`;
|
|
212
|
+
pkg.bugs = { url: anchors.bugsUrl };
|
|
213
|
+
pkg.keywords = anchors.keywords;
|
|
214
|
+
writeFileSync(PKG_PATH, JSON.stringify(pkg, null, 2) + "\n", "utf8");
|
|
215
|
+
|
|
216
|
+
let readme = readFileSync(README_PATH, "utf8");
|
|
217
|
+
if (!readme.includes(DISCOVERY_README_TITLE_START) || !readme.includes(DISCOVERY_README_TITLE_END)) {
|
|
218
|
+
throw new Error("README.md must contain discovery-readme-title markers");
|
|
219
|
+
}
|
|
220
|
+
const titleBody = `# ${String(discovery.readmeTitle)}`;
|
|
221
|
+
const titleBlock = `${DISCOVERY_README_TITLE_START}\n${titleBody}\n${DISCOVERY_README_TITLE_END}`;
|
|
222
|
+
const titleRe = new RegExp(
|
|
223
|
+
`${DISCOVERY_README_TITLE_START.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}[\\s\\S]*?${DISCOVERY_README_TITLE_END.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`,
|
|
224
|
+
);
|
|
225
|
+
if (!titleRe.test(readme)) {
|
|
226
|
+
throw new Error("README: could not match discovery-readme-title region");
|
|
227
|
+
}
|
|
228
|
+
readme = readme.replace(titleRe, titleBlock);
|
|
229
|
+
|
|
230
|
+
if (!readme.includes(DISCOVERY_README_START) || !readme.includes(DISCOVERY_README_END)) {
|
|
231
|
+
throw new Error("README.md must contain discovery-acquisition-fold markers");
|
|
232
|
+
}
|
|
233
|
+
const foldBody = discoveryLib.buildDiscoveryFoldBody(discovery, canonicalOrigin);
|
|
234
|
+
const discBlock = `${DISCOVERY_README_START}\n${foldBody}\n${DISCOVERY_README_END}`;
|
|
235
|
+
const discRe = new RegExp(
|
|
236
|
+
`${DISCOVERY_README_START.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}[\\s\\S]*?${DISCOVERY_README_END.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`,
|
|
237
|
+
);
|
|
238
|
+
if (!discRe.test(readme)) {
|
|
239
|
+
throw new Error("README: could not match discovery-acquisition-fold region");
|
|
240
|
+
}
|
|
241
|
+
readme = readme.replace(discRe, discBlock);
|
|
242
|
+
|
|
243
|
+
if (!readme.includes(README_START) || !readme.includes(README_END)) {
|
|
244
|
+
throw new Error("README.md must contain public-product-anchors markers");
|
|
245
|
+
}
|
|
246
|
+
const pl = discoveryPayloadObj.links;
|
|
247
|
+
const inner = [
|
|
248
|
+
anchors.identityOneLiner,
|
|
249
|
+
"",
|
|
250
|
+
`- **Repository:** ${anchors.gitRepositoryUrl}`,
|
|
251
|
+
`- **npm package:** ${anchors.npmPackageUrl}`,
|
|
252
|
+
`- **Canonical site:** ${canonicalOrigin}`,
|
|
253
|
+
`- **Integrate:** ${integrateUrl}`,
|
|
254
|
+
`- **OpenAPI (canonical):** ${openapiSelfCanonical}`,
|
|
255
|
+
`- **llms.txt (agents, site):** ${canonicalOrigin}/llms.txt`,
|
|
256
|
+
`- **llms.txt (repo, raw):** ${pl.llmsRaw}`,
|
|
257
|
+
`- **llms.txt (repo, blob):** ${pl.llmsBlob}`,
|
|
258
|
+
"",
|
|
259
|
+
].join("\n");
|
|
260
|
+
const block = `${README_START}\n${inner}\n${README_END}`;
|
|
261
|
+
const re = new RegExp(
|
|
262
|
+
`${README_START.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}[\\s\\S]*?${README_END.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`,
|
|
263
|
+
);
|
|
264
|
+
if (!re.test(readme)) {
|
|
265
|
+
throw new Error("README: could not match public-product-anchors region");
|
|
266
|
+
}
|
|
267
|
+
readme = readme.replace(re, block);
|
|
268
|
+
writeFileSync(README_PATH, readme, "utf8");
|
|
269
|
+
|
|
270
|
+
writePublicDistributionGenerated(anchors, discovery);
|
|
271
|
+
writeAgentsMd(anchors, discovery);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function validateForCheck() {
|
|
275
|
+
const discoveryLib = require("./discovery-acquisition.lib.cjs");
|
|
276
|
+
discoveryLib.validateDiscoveryAcquisition(ROOT);
|
|
277
|
+
validateOpenapiTemplate();
|
|
278
|
+
const pm = JSON.parse(readFileSync(MARKETING_PATH, "utf8"));
|
|
279
|
+
const required = [
|
|
280
|
+
"identityOneLiner",
|
|
281
|
+
"productionCanonicalOrigin",
|
|
282
|
+
"gitRepositoryUrl",
|
|
283
|
+
"gitRepositoryGitUrl",
|
|
284
|
+
"npmPackageUrl",
|
|
285
|
+
"bugsUrl",
|
|
286
|
+
"keywords",
|
|
287
|
+
];
|
|
288
|
+
for (const k of required) {
|
|
289
|
+
if (pm[k] === undefined || pm[k] === null) {
|
|
290
|
+
throw new Error(`marketing: missing ${k}`);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (!Array.isArray(pm.keywords) || pm.keywords.length === 0) {
|
|
294
|
+
throw new Error("marketing: keywords must be a non-empty array");
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function main() {
|
|
299
|
+
validateForCheck();
|
|
300
|
+
if (process.argv.includes("--check")) {
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
syncPrimaryMarketing();
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/** @deprecated use syncPrimaryMarketing */
|
|
307
|
+
const syncPublicProductAnchors = syncPrimaryMarketing;
|
|
308
|
+
/** @deprecated use validateForCheck */
|
|
309
|
+
const validateAnchors = validateForCheck;
|
|
310
|
+
|
|
311
|
+
module.exports = {
|
|
312
|
+
validateAnchors,
|
|
313
|
+
syncPublicProductAnchors,
|
|
314
|
+
syncPrimaryMarketing,
|
|
315
|
+
assertNextPublicOriginParity,
|
|
316
|
+
normalize,
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
if (require.main === module) {
|
|
320
|
+
try {
|
|
321
|
+
main();
|
|
322
|
+
} catch (e) {
|
|
323
|
+
console.error(e instanceof Error ? e.message : e);
|
|
324
|
+
process.exit(1);
|
|
325
|
+
}
|
|
326
|
+
}
|