agentera 3.0.0-dev.7 → 3.0.0-dev.74
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 +201 -0
- package/README.md +229 -22
- package/bundle/.agentera-build-source.json +8 -0
- package/bundle/CHANGELOG.md +1361 -0
- package/bundle/DESIGN.md +229 -0
- package/bundle/LICENSE +201 -0
- package/bundle/README.md +143 -0
- package/bundle/UPGRADE.md +252 -0
- package/bundle/extract-corpus-parity.json +2 -4
- package/bundle/fixtures/routing/hybrid-corpus.yaml +154 -0
- package/bundle/references/adapters/package-publication.json +484 -0
- package/bundle/references/adapters/package-registry.yaml +439 -188
- package/bundle/references/adapters/package-surface-characterization.md +68 -34
- package/bundle/references/adapters/runtime-lifecycle-adapters.yaml +74 -0
- package/bundle/references/adapters/runtime-lifecycle-authority.yaml +62 -0
- package/bundle/references/adapters/runtime-lifecycle-operation-contract.yaml +84 -0
- package/bundle/references/adapters/runtime-retired-resources.yaml +333 -0
- package/bundle/references/analysis/evidence-tier-authority.yaml +559 -0
- package/bundle/references/analysis/personal-glossary-evaluation-authority.yaml +175 -0
- package/bundle/references/analysis/personal-glossary-evaluation-corpus.yaml +291 -0
- package/bundle/references/analysis/personal-glossary-holdout.yaml +192 -0
- package/bundle/references/analysis/verification-policy.yaml +266 -0
- package/bundle/references/artifacts/artifact-registry-interface-model.yaml +17 -8
- package/bundle/references/artifacts/glossary-entry-contract.yaml +2752 -0
- package/bundle/references/artifacts/state-storage-authority.yaml +3061 -0
- package/bundle/references/artifacts/verbosity-budget-authority.yaml +42 -0
- package/bundle/references/cli/app-lifecycle-vocabulary.yaml +3 -4
- package/bundle/references/cli/capability-instruction-contract.yaml +11 -14
- package/bundle/references/cli/hybrid-route-contract.yaml +438 -0
- package/bundle/references/cli/routing-model.md +152 -93
- package/bundle/references/cli/trigger-schema-enrichment.md +57 -46
- package/bundle/references/cli/update-channels.yaml +6 -4
- package/bundle/references/cli/vocabulary-index.yaml +5 -7
- package/bundle/references/cli/vocabulary.md +52 -94
- package/bundle/references/meta/retained-reference-authority.yaml +166 -0
- package/bundle/skills/agentera/SKILL.md +183 -63
- package/bundle/skills/agentera/capabilities/audit/schemas/artifacts.yaml +27 -19
- package/bundle/skills/agentera/capabilities/audit/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/audit/schemas/triggers.yaml +13 -35
- package/bundle/skills/agentera/capabilities/audit/schemas/validation.yaml +30 -11
- package/bundle/skills/agentera/capabilities/build/schemas/artifacts.yaml +44 -21
- package/bundle/skills/agentera/capabilities/build/schemas/exit.yaml +8 -6
- package/bundle/skills/agentera/capabilities/build/schemas/triggers.yaml +14 -36
- package/bundle/skills/agentera/capabilities/build/schemas/validation.yaml +95 -21
- package/bundle/skills/agentera/capabilities/design/schemas/artifacts.yaml +6 -6
- package/bundle/skills/agentera/capabilities/design/schemas/exit.yaml +5 -5
- package/bundle/skills/agentera/capabilities/design/schemas/triggers.yaml +5 -34
- package/bundle/skills/agentera/capabilities/design/schemas/validation.yaml +2 -2
- package/bundle/skills/agentera/capabilities/discuss/schemas/artifacts.yaml +17 -13
- package/bundle/skills/agentera/capabilities/discuss/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/discuss/schemas/triggers.yaml +6 -40
- package/bundle/skills/agentera/capabilities/discuss/schemas/validation.yaml +72 -5
- package/bundle/skills/agentera/capabilities/document/schemas/artifacts.yaml +24 -17
- package/bundle/skills/agentera/capabilities/document/schemas/triggers.yaml +5 -35
- package/bundle/skills/agentera/capabilities/document/schemas/validation.yaml +13 -13
- package/bundle/skills/agentera/capabilities/optimize/schemas/artifacts.yaml +10 -10
- package/bundle/skills/agentera/capabilities/optimize/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/optimize/schemas/triggers.yaml +4 -35
- package/bundle/skills/agentera/capabilities/optimize/schemas/validation.yaml +3 -3
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/artifacts.yaml +34 -22
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/exit.yaml +9 -7
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/triggers.yaml +5 -37
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/validation.yaml +38 -37
- package/bundle/skills/agentera/capabilities/plan/schemas/artifacts.yaml +20 -16
- package/bundle/skills/agentera/capabilities/plan/schemas/triggers.yaml +8 -31
- package/bundle/skills/agentera/capabilities/plan/schemas/validation.yaml +66 -6
- package/bundle/skills/agentera/capabilities/profile/schemas/artifacts.yaml +13 -4
- package/bundle/skills/agentera/capabilities/profile/schemas/exit.yaml +8 -5
- package/bundle/skills/agentera/capabilities/profile/schemas/triggers.yaml +8 -37
- package/bundle/skills/agentera/capabilities/profile/schemas/validation.yaml +67 -3
- package/bundle/skills/agentera/capabilities/research/schemas/artifacts.yaml +6 -6
- package/bundle/skills/agentera/capabilities/research/schemas/triggers.yaml +5 -29
- package/bundle/skills/agentera/capabilities/status/schemas/artifacts.yaml +13 -12
- package/bundle/skills/agentera/capabilities/status/schemas/triggers.yaml +7 -49
- package/bundle/skills/agentera/capabilities/vision/schemas/artifacts.yaml +8 -8
- package/bundle/skills/agentera/capabilities/vision/schemas/exit.yaml +7 -6
- package/bundle/skills/agentera/capabilities/vision/schemas/triggers.yaml +7 -39
- package/bundle/skills/agentera/capabilities/vision/schemas/validation.yaml +14 -16
- package/bundle/skills/agentera/capability_schema_contract.yaml +32 -32
- package/bundle/skills/agentera/protocol.yaml +4 -4
- package/bundle/skills/agentera/route-phrases.yaml +81 -0
- package/bundle/skills/agentera/schemas/artifacts/changelog.yaml +1 -0
- package/bundle/skills/agentera/schemas/artifacts/decisions.yaml +30 -12
- package/bundle/skills/agentera/schemas/artifacts/design.yaml +1 -0
- package/bundle/skills/agentera/schemas/artifacts/docs.yaml +7 -12
- package/bundle/skills/agentera/schemas/artifacts/experiments.yaml +140 -9
- package/bundle/skills/agentera/schemas/artifacts/glossary.yaml +87 -0
- package/bundle/skills/agentera/schemas/artifacts/health.yaml +56 -19
- package/bundle/skills/agentera/schemas/artifacts/objective.yaml +18 -4
- package/bundle/skills/agentera/schemas/artifacts/plan.yaml +464 -32
- package/bundle/skills/agentera/schemas/artifacts/progress.yaml +131 -18
- package/bundle/skills/agentera/schemas/artifacts/todo.yaml +302 -7
- package/dist/.agentera-build-source.json +8 -0
- package/dist/analytics/extractCorpus/cli.js +52 -11
- package/dist/analytics/extractCorpus/copilotSessions.js +19 -8
- package/dist/analytics/extractCorpus/core.js +262 -14
- package/dist/analytics/extractCorpus/corpus.js +57 -18
- package/dist/analytics/extractCorpus/coverageAudit.js +44 -45
- package/dist/analytics/extractCorpus/cursorSessions.js +28 -8
- package/dist/analytics/extractCorpus/evidenceTiers.js +709 -0
- package/dist/analytics/extractCorpus/extractCorpusParity.js +4 -4
- package/dist/analytics/extractCorpus/filesystemSources.js +5 -5
- package/dist/analytics/extractCorpus/index.js +4 -2
- package/dist/analytics/extractCorpus/jsonlSessions.js +76 -8
- package/dist/analytics/extractCorpus/sqliteCaps.js +0 -1
- package/dist/analytics/extractCorpus/sqliteSessions.js +12 -4
- package/dist/analytics/extractCorpus/tierReader.js +108 -0
- package/dist/analytics/extractCorpus.js +0 -1
- package/dist/analytics/glossaryAdviceResolution.js +166 -0
- package/dist/analytics/glossaryInputAcquisition.js +319 -0
- package/dist/analytics/personalGlossaryAdmission.js +113 -0
- package/dist/analytics/personalGlossaryCandidateProjection.js +692 -0
- package/dist/analytics/personalGlossaryCandidateProjectionExcerpts.js +144 -0
- package/dist/analytics/personalGlossaryCandidateReadView.js +23 -0
- package/dist/analytics/personalGlossaryCurrentGeneration.js +25 -0
- package/dist/analytics/personalGlossaryDecision.js +203 -0
- package/dist/analytics/personalGlossaryExplicit.js +788 -0
- package/dist/analytics/personalGlossaryExplicitMining.js +285 -0
- package/dist/analytics/personalGlossaryExplicitScope.js +41 -0
- package/dist/analytics/personalGlossaryExplicitSegments.js +418 -0
- package/dist/analytics/personalGlossaryExplicitTypes.js +26 -0
- package/dist/analytics/personalGlossaryLexicalClassifier.js +175 -0
- package/dist/analytics/personalGlossaryProfile.js +229 -0
- package/dist/analytics/personalGlossaryRecurrence.js +618 -0
- package/dist/analytics/personalGlossaryReviewRecordStorage.js +428 -0
- package/dist/analytics/personalGlossaryReviewRecords.js +332 -0
- package/dist/analytics/profileSignals.js +211 -0
- package/dist/analytics/usageStats.js +150 -23
- package/dist/audit/terminologyDrift.js +281 -0
- package/dist/bin/agentera.js +3 -2
- package/dist/capabilities/audit/instructions.js +16 -6
- package/dist/capabilities/build/instructions.js +59 -6
- package/dist/capabilities/design/instructions.js +3 -4
- package/dist/capabilities/discuss/instructions.js +29 -6
- package/dist/capabilities/document/instructions.js +11 -6
- package/dist/capabilities/index.js +20 -14
- package/dist/capabilities/optimize/instructions.js +14 -6
- package/dist/capabilities/orchestrate/instructions.js +42 -6
- package/dist/capabilities/plan/instructions.js +30 -3
- package/dist/capabilities/profile/instructions.js +104 -5
- package/dist/capabilities/research/instructions.js +4 -5
- package/dist/capabilities/status/instructions.js +15 -6
- package/dist/capabilities/status/startupInstructions.js +34 -0
- package/dist/capabilities/vision/instructions.js +3 -5
- package/dist/cli/appContext.js +14 -7
- package/dist/cli/argvalidate.js +0 -1
- package/dist/cli/capabilityContext/benchmark.js +5 -4
- package/dist/cli/capabilityContext/bespoke.js +14 -6
- package/dist/cli/capabilityContext/build.js +116 -42
- package/dist/cli/capabilityContext/closeout.js +30 -27
- package/dist/cli/capabilityContext/contract.js +18 -27
- package/dist/cli/capabilityContext/evidence.js +84 -77
- package/dist/cli/capabilityContext/index.js +0 -1
- package/dist/cli/capabilityContext/orchestration.js +42 -18
- package/dist/cli/capabilityContext/planState.js +89 -96
- package/dist/cli/capabilityContext/progress.js +51 -12
- package/dist/cli/capabilityContext/projectVerification.js +409 -0
- package/dist/cli/capabilityContext/shared.js +9 -20
- package/dist/cli/capabilityContext/slim.js +52 -8
- package/dist/cli/capabilityContext/startup.js +51 -114
- package/dist/cli/capabilityContext/startupAggregation.js +68 -0
- package/dist/cli/capabilityContext/types.js +26 -10
- package/dist/cli/capabilityContext.js +0 -1
- package/dist/cli/commands/appHome.js +0 -1
- package/dist/cli/commands/capability.js +2 -2
- package/dist/cli/commands/compact.js +163 -13
- package/dist/cli/commands/doctor.js +117 -11
- package/dist/cli/commands/durability.js +81 -0
- package/dist/cli/commands/glossaryAdvice.js +138 -0
- package/dist/cli/commands/lint.js +22 -8
- package/dist/cli/commands/personalGlossaryCandidateReads.js +744 -0
- package/dist/cli/commands/personalGlossaryDecision.js +349 -0
- package/dist/cli/commands/personalGlossaryPublish.js +484 -0
- package/dist/cli/commands/personalGlossaryReviewRecordReads.js +209 -0
- package/dist/cli/commands/personalGlossaryReviewRecords.js +623 -0
- package/dist/cli/commands/prime/briefOrientation.js +845 -0
- package/dist/cli/commands/prime/buildExecutionRequest.js +165 -0
- package/dist/cli/commands/prime/bundleStatus.js +54 -4
- package/dist/cli/commands/prime/collectEntityOrientation.js +326 -0
- package/dist/cli/commands/prime/collectOrientationState.js +126 -63
- package/dist/cli/commands/prime/orientationOutput.js +267 -56
- package/dist/cli/commands/prime/types.js +0 -1
- package/dist/cli/commands/prime/v1Migration.js +0 -1
- package/dist/cli/commands/prime.js +76 -11
- package/dist/cli/commands/profileGrounding.js +55 -0
- package/dist/cli/commands/query.js +74 -52
- package/dist/cli/commands/report.js +91 -21
- package/dist/cli/commands/route.js +142 -0
- package/dist/cli/commands/schema.js +436 -138
- package/dist/cli/commands/state/decisions.js +40 -56
- package/dist/cli/commands/state/docs.js +58 -85
- package/dist/cli/commands/state/experimentRecords.js +151 -0
- package/dist/cli/commands/state/experiments.js +11 -65
- package/dist/cli/commands/state/get.js +129 -0
- package/dist/cli/commands/state/health.js +11 -113
- package/dist/cli/commands/state/index.js +6 -41
- package/dist/cli/commands/state/list.js +194 -0
- package/dist/cli/commands/state/objective.js +21 -65
- package/dist/cli/commands/state/plan.js +11 -170
- package/dist/cli/commands/state/planTasks.js +154 -0
- package/dist/cli/commands/state/plans.js +154 -0
- package/dist/cli/commands/state/progress.js +11 -45
- package/dist/cli/commands/state/shared.js +0 -1
- package/dist/cli/commands/state/todo.js +28 -107
- package/dist/cli/commands/state/write.js +433 -0
- package/dist/cli/commands/upgrade.js +146 -5
- package/dist/cli/commands/upgradeVerify.js +118 -0
- package/dist/cli/commands/validate.js +235 -136
- package/dist/cli/commands/verify.js +73 -16
- package/dist/cli/contracts/bundleStatus.js +0 -1
- package/dist/cli/contracts/orientationState.js +0 -1
- package/dist/cli/dispatch/argvParser.js +0 -1
- package/dist/cli/dispatch/check.js +84 -40
- package/dist/cli/dispatch/commands.js +3 -3
- package/dist/cli/dispatch/index.js +77 -52
- package/dist/cli/dispatch/lifecycle.js +162 -62
- package/dist/cli/dispatch/prime.js +37 -2
- package/dist/cli/dispatch/projections.js +17 -0
- package/dist/cli/dispatch/shared.js +1 -2
- package/dist/cli/dispatch/state.js +62 -66
- package/dist/cli/dispatch.js +0 -1
- package/dist/cli/errors.js +16 -17
- package/dist/cli/help.js +404 -39
- package/dist/cli/migrationRequired.js +125 -0
- package/dist/cli/orientation/attention.js +19 -19
- package/dist/cli/orientation/corpusCoverage.js +32 -1
- package/dist/cli/orientation.js +346 -129
- package/dist/cli/planArtifacts.js +350 -0
- package/dist/cli/planEvidence.js +157 -0
- package/dist/cli/planLifecycleState.js +36 -0
- package/dist/cli/planTaskIndex.js +11 -0
- package/dist/cli/preCutoverCommand.js +32 -0
- package/dist/cli/prime-blob.js +71 -3
- package/dist/cli/profileAcquisition.js +167 -0
- package/dist/cli/startupCompletenessContract.js +11 -8
- package/dist/cli/stateQuery.js +47 -12
- package/dist/cli/structured.js +0 -1
- package/dist/cli/todoMarkdown.js +25 -12
- package/dist/cli/todoReadinessSelection.js +192 -0
- package/dist/cli/todoSeverity.js +0 -1
- package/dist/core/atomicWriter.js +23 -0
- package/dist/core/developmentChannel.js +1 -0
- package/dist/core/developmentInvocation.js +377 -0
- package/dist/core/difflib.js +0 -1
- package/dist/core/envPaths.js +0 -1
- package/dist/core/jsonValue.js +0 -1
- package/dist/core/paths.js +0 -1
- package/dist/core/pyjson.js +0 -1
- package/dist/core/shell.js +4 -0
- package/dist/core/skillIdentity.js +23 -0
- package/dist/core/sourceRoot.js +9 -12
- package/dist/core/text.js +10 -0
- package/dist/core/toml.js +0 -1
- package/dist/core/yaml.js +61 -2
- package/dist/eval/evalSkills.js +13 -14
- package/dist/eval/glossaryEvaluation.js +751 -0
- package/dist/eval/glossaryEvaluationProcess.js +29 -0
- package/dist/eval/glossaryEvaluationRunner.js +571 -0
- package/dist/eval/glossaryEvaluationSuccessReport.js +297 -0
- package/dist/eval/hybridRouteEvaluation.js +155 -0
- package/dist/eval/semanticEval.js +0 -1
- package/dist/eval/semanticFixtures.js +0 -1
- package/dist/hooks/common.js +3 -56
- package/dist/hooks/compaction/apply.js +224 -47
- package/dist/hooks/compaction/dryRun.js +2 -1
- package/dist/hooks/compaction/index.js +5 -6
- package/dist/hooks/compaction/parse.js +73 -6
- package/dist/hooks/compaction/retention.js +28 -25
- package/dist/hooks/compaction/status.js +145 -26
- package/dist/hooks/compaction/types.js +0 -1
- package/dist/hooks/validateArtifact/agentFacing.js +0 -1
- package/dist/hooks/validateArtifact/index.js +6 -65
- package/dist/hooks/validateArtifact/markdown.js +9 -10
- package/dist/hooks/validateArtifact/schema.js +96 -9
- package/dist/hooks/validateArtifact/traversal.js +12 -11
- package/dist/hooks/validateArtifact/violations.js +5 -3
- package/dist/migrate/v2HandoffManifest.js +8 -3
- package/dist/registries/activationContract.js +2 -0
- package/dist/registries/activationTuples.js +136 -0
- package/dist/registries/artifactProtocolIds.js +2 -1
- package/dist/registries/artifactRegistry.js +207 -60
- package/dist/registries/artifactSchemaProjection.js +45 -0
- package/dist/registries/capabilityContract.js +5 -21
- package/dist/registries/evaluatorHandoffContract.js +0 -1
- package/dist/registries/evidenceTierContract.js +375 -0
- package/dist/registries/explicitSegmentGrammarContract.js +619 -0
- package/dist/registries/glossaryAdviceContract.js +79 -0
- package/dist/registries/glossaryCandidateContractPaths.js +6 -0
- package/dist/registries/glossaryCandidateContracts.js +820 -0
- package/dist/registries/glossaryCandidateDecisionAuthority.js +119 -0
- package/dist/registries/glossaryCandidateDecisionContract.js +62 -0
- package/dist/registries/glossaryCandidateProjectionAuthority.js +197 -0
- package/dist/registries/glossaryCandidateProjectionContract.js +104 -0
- package/dist/registries/glossaryCaveatContract.js +67 -0
- package/dist/registries/glossaryConsumerContractValidation.js +787 -0
- package/dist/registries/glossaryEntryContract.js +759 -0
- package/dist/registries/glossaryEntryTemporal.js +12 -0
- package/dist/registries/glossaryMiningAuthority.js +764 -0
- package/dist/registries/glossaryProfileFullContract.js +24 -0
- package/dist/registries/glossaryReviewRecordsAuthority.js +426 -0
- package/dist/registries/glossaryReviewRecordsContract.js +129 -0
- package/dist/registries/glossaryTermIdentity.js +139 -0
- package/dist/registries/glossaryTermOccurrence.js +20 -0
- package/dist/registries/hybridRoute.js +274 -0
- package/dist/registries/hybridRouteReceipt.js +221 -0
- package/dist/registries/packagePublication.js +273 -0
- package/dist/registries/packageRegistry.js +184 -209
- package/dist/registries/personalGlossaryContracts.js +1 -0
- package/dist/registries/todoReadinessContract.js +448 -0
- package/dist/registries/triggerLoader.js +7 -44
- package/dist/registries/verbosityBudgetContract.js +205 -0
- package/dist/release/releaseMetadata.js +167 -10
- package/dist/runtime/lifecycleAdapterContract.js +457 -0
- package/dist/runtime/lifecycleAdapters.js +777 -0
- package/dist/runtime/lifecycleAuthority.js +453 -0
- package/dist/runtime/lifecycleOperationContract.js +123 -0
- package/dist/runtime/lifecycleOperations.js +634 -0
- package/dist/runtime/lifecycleOwnershipJournal.js +622 -0
- package/dist/runtime/lifecyclePublication.js +415 -0
- package/dist/runtime/lifecycleSnapshot.js +438 -0
- package/dist/runtime/nativeResourceCleanup.js +502 -0
- package/dist/setup/opencode.js +20 -13
- package/dist/setup/opencodeConstants.js +1 -0
- package/dist/setup/sharedSkill.js +45 -0
- package/dist/setup/smokeChecks.js +14 -75
- package/dist/state/archiveDiscovery.js +580 -0
- package/dist/state/archivePublication.js +225 -0
- package/dist/state/archiveRecovery.js +237 -0
- package/dist/state/archiveReplay.js +53 -0
- package/dist/state/canonicalMigrationRecord.js +36 -0
- package/dist/state/changelog.js +221 -0
- package/dist/state/decisionEntities.js +367 -0
- package/dist/state/decisionLegacyValidation.js +215 -0
- package/dist/state/decisionMigrationProvenance.js +199 -0
- package/dist/state/decisionOverlay.js +254 -0
- package/dist/state/decisionRevision.js +256 -0
- package/dist/state/decisionRevisionMigration.js +89 -0
- package/dist/state/directRetrieval.js +323 -0
- package/dist/state/durability.js +324 -0
- package/dist/state/entityCutover.js +459 -0
- package/dist/state/entityCutoverGit.js +127 -0
- package/dist/state/entityGlossaryAuthority.js +13 -0
- package/dist/state/entityListProjection.js +187 -0
- package/dist/state/entityListRuntimeRegistry.js +85 -0
- package/dist/state/entityMigrationCausality.js +97 -0
- package/dist/state/entityMigrationIdentity.js +5 -0
- package/dist/state/entityMigrationPreview.js +840 -0
- package/dist/state/entityMigrationTodo.js +133 -0
- package/dist/state/entityPublicationContext.js +859 -0
- package/dist/state/entityRetrievalHelp.js +506 -0
- package/dist/state/entityStorage.js +899 -0
- package/dist/state/exactReplacementRecovery.js +18 -0
- package/dist/state/experimentArchive.js +63 -0
- package/dist/state/experimentIdentity.js +202 -0
- package/dist/state/healthEntities.js +262 -0
- package/dist/state/healthEntityValidation.js +18 -0
- package/dist/state/healthRepair.js +69 -0
- package/dist/state/installRoot.js +15 -7
- package/dist/state/legacyEntityCutoverEvidence.js +65 -0
- package/dist/state/legacyIdentity.js +47 -0
- package/dist/state/legacySummaryRecord.js +6 -0
- package/dist/state/listAccounting.js +54 -0
- package/dist/state/listClassification.js +17 -0
- package/dist/state/listCursor.js +42 -0
- package/dist/state/listRetrieval.js +781 -0
- package/dist/state/migrationSourceBinding.js +30 -0
- package/dist/state/objectiveExperimentEntities.js +322 -0
- package/dist/state/planEntities.js +1027 -0
- package/dist/state/planIdentity.js +47 -0
- package/dist/state/planLineageValidation.js +52 -0
- package/dist/state/planReplacementTransaction.js +475 -0
- package/dist/state/planRetrieval.js +313 -0
- package/dist/state/planTaskRetrieval.js +294 -0
- package/dist/state/progressEntities.js +512 -0
- package/dist/state/progressGlossaryCaveat.js +168 -0
- package/dist/state/progressPublicationOrder.js +19 -0
- package/dist/state/progressWritePolicy.js +33 -0
- package/dist/state/projectRoot.js +62 -0
- package/dist/state/projectionPolicy.js +190 -0
- package/dist/state/retrievalAuthority.js +156 -0
- package/dist/state/safeProjectFile.js +155 -0
- package/dist/state/startupAnalysis/benchmark.js +70 -9
- package/dist/state/startupAnalysis/contract.js +44 -10
- package/dist/state/startupAnalysis/helpers.js +1 -2
- package/dist/state/startupAnalysis/index.js +0 -1
- package/dist/state/startupAnalysis/metrics.js +0 -1
- package/dist/state/startupAnalysis/records.js +0 -1
- package/dist/state/startupAnalysis/report.js +0 -1
- package/dist/state/startupAnalysis/threshold.js +13 -1
- package/dist/state/startupAnalysis.js +0 -1
- package/dist/state/startupProjection.js +499 -0
- package/dist/state/stateMode.js +222 -0
- package/dist/state/stateStorageAuthority.js +47 -0
- package/dist/state/summaryEntityRead.js +25 -0
- package/dist/state/summaryMigrationProvenance.js +66 -0
- package/dist/state/summarySourceRowAuthority.js +36 -0
- package/dist/state/todoActivationSafety.js +58 -0
- package/dist/state/todoDocsEntities.js +1124 -0
- package/dist/state/todoDocsEntityValidation.js +158 -0
- package/dist/state/todoMarkdownProjection.js +51 -0
- package/dist/state/todoReconciliationActivation.js +182 -0
- package/dist/state/todoReconciliationInspection.js +171 -0
- package/dist/state/todoReconciliationRepair.js +318 -0
- package/dist/state/todoReconciliationTransaction.js +595 -0
- package/dist/state/write/assign.js +20 -0
- package/dist/state/write/candidateMutation.js +269 -0
- package/dist/state/write/errors.js +11 -0
- package/dist/state/write/experimentPublication.js +192 -0
- package/dist/state/write/explain.js +377 -0
- package/dist/state/write/fields.js +61 -0
- package/dist/state/write/glossaryPublication.js +263 -0
- package/dist/state/write/grammar.js +285 -0
- package/dist/state/write/helpers.js +29 -0
- package/dist/state/write/index.js +12 -0
- package/dist/state/write/input.js +391 -0
- package/dist/state/write/lock.js +837 -0
- package/dist/state/write/mutation.js +234 -0
- package/dist/state/write/operations.js +170 -0
- package/dist/state/write/planEvaluation.js +128 -0
- package/dist/state/write/planPublication.js +179 -0
- package/dist/state/write/runtimeOperations.js +146 -0
- package/dist/state/write/serialize.js +1 -0
- package/dist/state/write/transaction.js +57 -0
- package/dist/state/write/validate.js +7 -0
- package/dist/upgrade/appContentRefresh.js +77 -36
- package/dist/upgrade/appModel.js +0 -1
- package/dist/upgrade/atomicWriter.js +1 -0
- package/dist/upgrade/bundleEvidence.js +0 -1
- package/dist/upgrade/channels.js +6 -9
- package/dist/upgrade/compatibility.js +43 -17
- package/dist/upgrade/doctor.js +55 -32
- package/dist/upgrade/doctorClassifier.js +11 -1
- package/dist/upgrade/installedHooksRetirement.js +46 -40
- package/dist/upgrade/legacyAgentCleanup.js +187 -21
- package/dist/upgrade/lifecycleUpgrade.js +113 -0
- package/dist/upgrade/migrateArtifactsV2ToV3.js +334 -64
- package/dist/upgrade/migrationPublication.js +122 -0
- package/dist/upgrade/nextMajorDoctor.js +0 -1
- package/dist/upgrade/npxPlatformStatus.js +2 -2
- package/dist/upgrade/projectIntegration.js +128 -160
- package/dist/upgrade/projectIntegrationDecision.js +42 -85
- package/dist/upgrade/retiredResourceDiagnostics.js +117 -0
- package/dist/upgrade/runtimeMigration.js +262 -453
- package/dist/upgrade/upgradeCommands.js +14 -1
- package/dist/upgrade/upgradeLock.js +85 -0
- package/dist/upgrade/upgradeOrchestrator.js +263 -59
- package/dist/upgrade/v3CapabilitySurface.js +2 -3
- package/dist/upgrade/versionResolution.js +0 -1
- package/dist/validate/activationArtifactEvidence.js +866 -0
- package/dist/validate/activationArtifactEvidenceTypes.js +12 -0
- package/dist/validate/activationConjunction.js +816 -0
- package/dist/validate/activationEvidenceManifest.js +610 -0
- package/dist/validate/activationPackageSemantics.js +29 -0
- package/dist/validate/appHomeContract.js +1 -7
- package/dist/validate/bootstrapAuthority.js +44 -0
- package/dist/validate/capability.js +11 -3
- package/dist/validate/crossCapability.js +14 -9
- package/dist/validate/retainedReferenceAuthority.js +879 -0
- package/dist/validate/selfAudit.js +39 -45
- package/dist/validate/v1LegacyCruft.js +131 -0
- package/dist/validate/vocabularyAuthority.js +8 -8
- package/package.json +39 -13
- package/bundle/references/adapters/cursor.md +0 -214
- package/bundle/references/adapters/opencode.md +0 -530
- package/bundle/references/adapters/package-manifest-interface-model.yaml +0 -337
- package/bundle/references/adapters/runtime-adapter-characterization.md +0 -79
- package/bundle/references/adapters/runtime-adapter-interface-model.yaml +0 -200
- package/bundle/references/adapters/runtime-adapter-registry.yaml +0 -554
- package/bundle/references/adapters/runtime-feature-parity.md +0 -189
- package/bundle/references/analysis/benchmark.md +0 -267
- package/bundle/references/analysis/startup-measurement-contract.yaml +0 -424
- package/bundle/references/cli/agent-ready-state-contract.yaml +0 -953
- package/bundle/references/cli/audience-namespace-cli-migration.yaml +0 -369
- package/bundle/references/cli/bundle-skill-vocabulary.yaml +0 -250
- package/bundle/references/cli/capability-tool-classification.yaml +0 -53
- package/bundle/references/cli/coexistence-probe.yaml +0 -13
- package/bundle/references/cli/parity-expected-actual-template.md +0 -30
- package/bundle/references/cli/routing-execution-vocabulary.yaml +0 -281
- package/bundle/references/cli/single-name-protocol.yaml +0 -42
- package/bundle/references/cli/upgrade-repair-wording.md +0 -45
- package/bundle/references/cli/v3-handoff-manifest.schema.yaml +0 -98
- package/bundle/references/meta/documentation-inventory.md +0 -49
- package/bundle/skills/agentera/.claude-plugin/plugin.json +0 -27
- package/bundle/skills/agentera/agents/audit.toml +0 -6
- package/bundle/skills/agentera/agents/build.toml +0 -6
- package/bundle/skills/agentera/agents/design.toml +0 -6
- package/bundle/skills/agentera/agents/discuss.toml +0 -6
- package/bundle/skills/agentera/agents/document.toml +0 -6
- package/bundle/skills/agentera/agents/optimize.toml +0 -6
- package/bundle/skills/agentera/agents/orchestrate.toml +0 -6
- package/bundle/skills/agentera/agents/plan.toml +0 -6
- package/bundle/skills/agentera/agents/profile.toml +0 -6
- package/bundle/skills/agentera/agents/research.toml +0 -6
- package/bundle/skills/agentera/agents/status.toml +0 -6
- package/bundle/skills/agentera/agents/vision.toml +0 -6
- package/bundle/skills/agentera/references/contract.md +0 -1048
- package/dist/analytics/extractCorpus/cli.js.map +0 -1
- package/dist/analytics/extractCorpus/copilotSessions.js.map +0 -1
- package/dist/analytics/extractCorpus/core.js.map +0 -1
- package/dist/analytics/extractCorpus/corpus.js.map +0 -1
- package/dist/analytics/extractCorpus/coverageAudit.js.map +0 -1
- package/dist/analytics/extractCorpus/cursorSessions.js.map +0 -1
- package/dist/analytics/extractCorpus/extractCorpusParity.js.map +0 -1
- package/dist/analytics/extractCorpus/filesystemSources.js.map +0 -1
- package/dist/analytics/extractCorpus/index.js.map +0 -1
- package/dist/analytics/extractCorpus/jsonlSessions.js.map +0 -1
- package/dist/analytics/extractCorpus/sqliteCaps.js.map +0 -1
- package/dist/analytics/extractCorpus/sqliteSessions.js.map +0 -1
- package/dist/analytics/extractCorpus.js.map +0 -1
- package/dist/analytics/usageStats.js.map +0 -1
- package/dist/bin/agentera.js.map +0 -1
- package/dist/capabilities/audit/instructions.js.map +0 -1
- package/dist/capabilities/build/instructions.js.map +0 -1
- package/dist/capabilities/design/instructions.js.map +0 -1
- package/dist/capabilities/discuss/instructions.js.map +0 -1
- package/dist/capabilities/document/instructions.js.map +0 -1
- package/dist/capabilities/dokumentera/instructions.js +0 -6
- package/dist/capabilities/dokumentera/instructions.js.map +0 -1
- package/dist/capabilities/hej/instructions.js +0 -6
- package/dist/capabilities/hej/instructions.js.map +0 -1
- package/dist/capabilities/index.js.map +0 -1
- package/dist/capabilities/inspektera/instructions.js +0 -6
- package/dist/capabilities/inspektera/instructions.js.map +0 -1
- package/dist/capabilities/inspirera/instructions.js +0 -6
- package/dist/capabilities/inspirera/instructions.js.map +0 -1
- package/dist/capabilities/optimera/instructions.js +0 -6
- package/dist/capabilities/optimera/instructions.js.map +0 -1
- package/dist/capabilities/optimize/instructions.js.map +0 -1
- package/dist/capabilities/orchestrate/instructions.js.map +0 -1
- package/dist/capabilities/orkestrera/instructions.js +0 -6
- package/dist/capabilities/orkestrera/instructions.js.map +0 -1
- package/dist/capabilities/plan/instructions.js.map +0 -1
- package/dist/capabilities/planera/instructions.js +0 -6
- package/dist/capabilities/planera/instructions.js.map +0 -1
- package/dist/capabilities/profile/instructions.js.map +0 -1
- package/dist/capabilities/profilera/instructions.js +0 -6
- package/dist/capabilities/profilera/instructions.js.map +0 -1
- package/dist/capabilities/realisera/instructions.js +0 -6
- package/dist/capabilities/realisera/instructions.js.map +0 -1
- package/dist/capabilities/research/instructions.js.map +0 -1
- package/dist/capabilities/resonera/instructions.js +0 -6
- package/dist/capabilities/resonera/instructions.js.map +0 -1
- package/dist/capabilities/status/instructions.js.map +0 -1
- package/dist/capabilities/vision/instructions.js.map +0 -1
- package/dist/capabilities/visionera/instructions.js +0 -6
- package/dist/capabilities/visionera/instructions.js.map +0 -1
- package/dist/capabilities/visualisera/instructions.js +0 -5
- package/dist/capabilities/visualisera/instructions.js.map +0 -1
- package/dist/cli/appContext.js.map +0 -1
- package/dist/cli/argvalidate.js.map +0 -1
- package/dist/cli/capabilityContext/benchmark.js.map +0 -1
- package/dist/cli/capabilityContext/bespoke.js.map +0 -1
- package/dist/cli/capabilityContext/build.js.map +0 -1
- package/dist/cli/capabilityContext/closeout.js.map +0 -1
- package/dist/cli/capabilityContext/contract.js.map +0 -1
- package/dist/cli/capabilityContext/evidence.js.map +0 -1
- package/dist/cli/capabilityContext/index.js.map +0 -1
- package/dist/cli/capabilityContext/orchestration.js.map +0 -1
- package/dist/cli/capabilityContext/planState.js.map +0 -1
- package/dist/cli/capabilityContext/progress.js.map +0 -1
- package/dist/cli/capabilityContext/realisera.js +0 -174
- package/dist/cli/capabilityContext/realisera.js.map +0 -1
- package/dist/cli/capabilityContext/shared.js.map +0 -1
- package/dist/cli/capabilityContext/slim.js.map +0 -1
- package/dist/cli/capabilityContext/startup.js.map +0 -1
- package/dist/cli/capabilityContext/types.js.map +0 -1
- package/dist/cli/capabilityContext.js.map +0 -1
- package/dist/cli/commands/appHome.js.map +0 -1
- package/dist/cli/commands/backfill.js +0 -84
- package/dist/cli/commands/backfill.js.map +0 -1
- package/dist/cli/commands/capability.js.map +0 -1
- package/dist/cli/commands/compact.js.map +0 -1
- package/dist/cli/commands/doctor.js.map +0 -1
- package/dist/cli/commands/lint.js.map +0 -1
- package/dist/cli/commands/prime/bundleStatus.js.map +0 -1
- package/dist/cli/commands/prime/collectOrientationState.js.map +0 -1
- package/dist/cli/commands/prime/orientationOutput.js.map +0 -1
- package/dist/cli/commands/prime/routeOutput.js +0 -50
- package/dist/cli/commands/prime/routeOutput.js.map +0 -1
- package/dist/cli/commands/prime/types.js.map +0 -1
- package/dist/cli/commands/prime/v1Migration.js.map +0 -1
- package/dist/cli/commands/prime.js.map +0 -1
- package/dist/cli/commands/query.js.map +0 -1
- package/dist/cli/commands/report.js.map +0 -1
- package/dist/cli/commands/schema.js.map +0 -1
- package/dist/cli/commands/state/decisions.js.map +0 -1
- package/dist/cli/commands/state/docs.js.map +0 -1
- package/dist/cli/commands/state/experiments.js.map +0 -1
- package/dist/cli/commands/state/health.js.map +0 -1
- package/dist/cli/commands/state/index.js.map +0 -1
- package/dist/cli/commands/state/objective.js.map +0 -1
- package/dist/cli/commands/state/plan.js.map +0 -1
- package/dist/cli/commands/state/progress.js.map +0 -1
- package/dist/cli/commands/state/shared.js.map +0 -1
- package/dist/cli/commands/state/todo.js.map +0 -1
- package/dist/cli/commands/state.js +0 -1023
- package/dist/cli/commands/state.js.map +0 -1
- package/dist/cli/commands/upgrade.js.map +0 -1
- package/dist/cli/commands/validate.js.map +0 -1
- package/dist/cli/commands/verify.js.map +0 -1
- package/dist/cli/contracts/bundleStatus.js.map +0 -1
- package/dist/cli/contracts/orientationState.js.map +0 -1
- package/dist/cli/dispatch/argvParser.js.map +0 -1
- package/dist/cli/dispatch/check.js.map +0 -1
- package/dist/cli/dispatch/commands.js.map +0 -1
- package/dist/cli/dispatch/index.js.map +0 -1
- package/dist/cli/dispatch/lifecycle.js.map +0 -1
- package/dist/cli/dispatch/prime.js.map +0 -1
- package/dist/cli/dispatch/shared.js.map +0 -1
- package/dist/cli/dispatch/state.js.map +0 -1
- package/dist/cli/dispatch.js.map +0 -1
- package/dist/cli/errors.js.map +0 -1
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/orientation/attention.js.map +0 -1
- package/dist/cli/orientation/corpusCoverage.js.map +0 -1
- package/dist/cli/orientation.js.map +0 -1
- package/dist/cli/prime-blob.js.map +0 -1
- package/dist/cli/startupCompletenessContract.js.map +0 -1
- package/dist/cli/stateQuery.js.map +0 -1
- package/dist/cli/structured.js.map +0 -1
- package/dist/cli/todoMarkdown.js.map +0 -1
- package/dist/cli/todoSeverity.js.map +0 -1
- package/dist/core/difflib.js.map +0 -1
- package/dist/core/envPaths.js.map +0 -1
- package/dist/core/git.js +0 -43
- package/dist/core/git.js.map +0 -1
- package/dist/core/jsonValue.js.map +0 -1
- package/dist/core/paths.js.map +0 -1
- package/dist/core/pyjson.js.map +0 -1
- package/dist/core/sourceRoot.js.map +0 -1
- package/dist/core/toml.js.map +0 -1
- package/dist/core/yaml.js.map +0 -1
- package/dist/eval/evalSkills.js.map +0 -1
- package/dist/eval/semanticEval.js.map +0 -1
- package/dist/eval/semanticFixtures.js.map +0 -1
- package/dist/hooks/common.js.map +0 -1
- package/dist/hooks/compaction/apply.js.map +0 -1
- package/dist/hooks/compaction/dryRun.js.map +0 -1
- package/dist/hooks/compaction/index.js.map +0 -1
- package/dist/hooks/compaction/parse.js.map +0 -1
- package/dist/hooks/compaction/retention.js.map +0 -1
- package/dist/hooks/compaction/status.js.map +0 -1
- package/dist/hooks/compaction/todoResolved.js +0 -137
- package/dist/hooks/compaction/todoResolved.js.map +0 -1
- package/dist/hooks/compaction/types.js.map +0 -1
- package/dist/hooks/compaction.js +0 -935
- package/dist/hooks/compaction.js.map +0 -1
- package/dist/hooks/cursorPreToolUse.js +0 -19
- package/dist/hooks/cursorPreToolUse.js.map +0 -1
- package/dist/hooks/cursorSessionStart.js +0 -79
- package/dist/hooks/cursorSessionStart.js.map +0 -1
- package/dist/hooks/sessionStart.js +0 -216
- package/dist/hooks/sessionStart.js.map +0 -1
- package/dist/hooks/sessionStop.js +0 -206
- package/dist/hooks/sessionStop.js.map +0 -1
- package/dist/hooks/todoLayout.js +0 -177
- package/dist/hooks/todoLayout.js.map +0 -1
- package/dist/hooks/validateArtifact/agentFacing.js.map +0 -1
- package/dist/hooks/validateArtifact/index.js.map +0 -1
- package/dist/hooks/validateArtifact/markdown.js.map +0 -1
- package/dist/hooks/validateArtifact/runtime.js +0 -86
- package/dist/hooks/validateArtifact/runtime.js.map +0 -1
- package/dist/hooks/validateArtifact/schema.js.map +0 -1
- package/dist/hooks/validateArtifact/traversal.js.map +0 -1
- package/dist/hooks/validateArtifact/violations.js.map +0 -1
- package/dist/hooks/validateArtifact.js +0 -924
- package/dist/hooks/validateArtifact.js.map +0 -1
- package/dist/migrate/v2HandoffManifest.js.map +0 -1
- package/dist/registries/artifactProtocolIds.js.map +0 -1
- package/dist/registries/artifactRegistry.js.map +0 -1
- package/dist/registries/capabilityContract.js.map +0 -1
- package/dist/registries/evaluatorHandoffContract.js.map +0 -1
- package/dist/registries/packageRegistry.js.map +0 -1
- package/dist/registries/runtimeAdapterRegistry.js +0 -316
- package/dist/registries/runtimeAdapterRegistry.js.map +0 -1
- package/dist/registries/triggerLoader.js.map +0 -1
- package/dist/release/releaseMetadata.js.map +0 -1
- package/dist/routing/index.js +0 -2
- package/dist/routing/index.js.map +0 -1
- package/dist/routing/routeEngine.js +0 -189
- package/dist/routing/routeEngine.js.map +0 -1
- package/dist/setup/codex/agents.js +0 -96
- package/dist/setup/codex/agents.js.map +0 -1
- package/dist/setup/codex/cli.js +0 -161
- package/dist/setup/codex/cli.js.map +0 -1
- package/dist/setup/codex/configToml.js +0 -639
- package/dist/setup/codex/configToml.js.map +0 -1
- package/dist/setup/codex/constants.js +0 -29
- package/dist/setup/codex/constants.js.map +0 -1
- package/dist/setup/codex/installRoot.js +0 -64
- package/dist/setup/codex/installRoot.js.map +0 -1
- package/dist/setup/codex/state.js +0 -270
- package/dist/setup/codex/state.js.map +0 -1
- package/dist/setup/codex.js +0 -12
- package/dist/setup/codex.js.map +0 -1
- package/dist/setup/copilot.js +0 -227
- package/dist/setup/copilot.js.map +0 -1
- package/dist/setup/cursor.js +0 -129
- package/dist/setup/cursor.js.map +0 -1
- package/dist/setup/cursorSurfaces.js +0 -67
- package/dist/setup/cursorSurfaces.js.map +0 -1
- package/dist/setup/doctor/core.js +0 -300
- package/dist/setup/doctor/core.js.map +0 -1
- package/dist/setup/doctor/diagnostics.js +0 -240
- package/dist/setup/doctor/diagnostics.js.map +0 -1
- package/dist/setup/doctor/opencode.js +0 -313
- package/dist/setup/doctor/opencode.js.map +0 -1
- package/dist/setup/doctor/report.js +0 -425
- package/dist/setup/doctor/report.js.map +0 -1
- package/dist/setup/doctor.js +0 -10
- package/dist/setup/doctor.js.map +0 -1
- package/dist/setup/opencode.js.map +0 -1
- package/dist/setup/smokeChecks.js.map +0 -1
- package/dist/state/installRoot.js.map +0 -1
- package/dist/state/progressCommit.js +0 -289
- package/dist/state/progressCommit.js.map +0 -1
- package/dist/state/startupAnalysis/benchmark.js.map +0 -1
- package/dist/state/startupAnalysis/contract.js.map +0 -1
- package/dist/state/startupAnalysis/helpers.js.map +0 -1
- package/dist/state/startupAnalysis/index.js.map +0 -1
- package/dist/state/startupAnalysis/metrics.js.map +0 -1
- package/dist/state/startupAnalysis/records.js.map +0 -1
- package/dist/state/startupAnalysis/report.js.map +0 -1
- package/dist/state/startupAnalysis/threshold.js.map +0 -1
- package/dist/state/startupAnalysis.js.map +0 -1
- package/dist/upgrade/appContentRefresh.js.map +0 -1
- package/dist/upgrade/appModel.js.map +0 -1
- package/dist/upgrade/bundleEvidence.js.map +0 -1
- package/dist/upgrade/channels.js.map +0 -1
- package/dist/upgrade/cliProbe.js +0 -22
- package/dist/upgrade/cliProbe.js.map +0 -1
- package/dist/upgrade/coexistenceProbe.js +0 -107
- package/dist/upgrade/coexistenceProbe.js.map +0 -1
- package/dist/upgrade/compatibility.js.map +0 -1
- package/dist/upgrade/doctor.js.map +0 -1
- package/dist/upgrade/doctorClassifier.js.map +0 -1
- package/dist/upgrade/installedHooksRetirement.js.map +0 -1
- package/dist/upgrade/legacyAgentCleanup.js.map +0 -1
- package/dist/upgrade/migrateArtifactsV1ToV2.js +0 -570
- package/dist/upgrade/migrateArtifactsV1ToV2.js.map +0 -1
- package/dist/upgrade/migrateArtifactsV2ToV3.js.map +0 -1
- package/dist/upgrade/nextMajorDoctor.js.map +0 -1
- package/dist/upgrade/npxPlatformStatus.js.map +0 -1
- package/dist/upgrade/projectIntegration.js.map +0 -1
- package/dist/upgrade/projectIntegrationDecision.js.map +0 -1
- package/dist/upgrade/runtimeMigration.js.map +0 -1
- package/dist/upgrade/upgradeCommands.js.map +0 -1
- package/dist/upgrade/upgradeOrchestrator.js.map +0 -1
- package/dist/upgrade/v3CapabilitySurface.js.map +0 -1
- package/dist/upgrade/versionResolution.js.map +0 -1
- package/dist/validate/appHomeContract.js.map +0 -1
- package/dist/validate/capability.js.map +0 -1
- package/dist/validate/crossCapability.js.map +0 -1
- package/dist/validate/lifecycleAdapters/legacyPythonParity.js +0 -93
- package/dist/validate/lifecycleAdapters/legacyPythonParity.js.map +0 -1
- package/dist/validate/lifecycleAdapters/nodeFormChecks.js +0 -488
- package/dist/validate/lifecycleAdapters/nodeFormChecks.js.map +0 -1
- package/dist/validate/lifecycleAdapters/shared.js +0 -198
- package/dist/validate/lifecycleAdapters/shared.js.map +0 -1
- package/dist/validate/lifecycleAdapters.js +0 -62
- package/dist/validate/lifecycleAdapters.js.map +0 -1
- package/dist/validate/selfAudit.js.map +0 -1
- package/dist/validate/vocabularyAuthority.js.map +0 -1
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { dispositionPersonalGlossaryReviewRecord, queuePersonalGlossaryReviewRecord, validPersonalGlossaryReviewGenerationBinding, validPersonalGlossaryReviewMetadataBinding, } from "../../analytics/personalGlossaryReviewRecords.js";
|
|
3
|
+
import { loadYamlMapping } from "../../core/yaml.js";
|
|
4
|
+
import { personalGlossaryReviewRecordsContract } from "../../registries/glossaryReviewRecordsContract.js";
|
|
5
|
+
import { getPersonalGlossaryReviewRecord, listPersonalGlossaryReviewRecords, } from "./personalGlossaryReviewRecordReads.js";
|
|
6
|
+
import { emitInvalidInput } from "../errors.js";
|
|
7
|
+
import { emitStructured } from "../structured.js";
|
|
8
|
+
const SHA256 = /^[a-f0-9]{64}$/u;
|
|
9
|
+
const MAX_CURSOR_UTF8_BYTES = 4_096;
|
|
10
|
+
function mapping(value) {
|
|
11
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
12
|
+
}
|
|
13
|
+
function sameStrings(actual, expected) {
|
|
14
|
+
return JSON.stringify(actual) === JSON.stringify(expected);
|
|
15
|
+
}
|
|
16
|
+
function contract() {
|
|
17
|
+
const value = personalGlossaryReviewRecordsContract();
|
|
18
|
+
const statuses = value.listStatuses;
|
|
19
|
+
if (value.command !== "agentera report personal-glossary-reviews" ||
|
|
20
|
+
value.queueRequestSchemaVersion !== "agentera.personalGlossaryReviewQueueRequest.v1" ||
|
|
21
|
+
!sameStrings(value.queueRequestFields, ["schema_version", "receipt"]) ||
|
|
22
|
+
value.queueMaxRequestUtf8Bytes !== 16_384 ||
|
|
23
|
+
value.queueResultSchemaVersion !== "agentera.personalGlossaryReviewQueueResult.v1" ||
|
|
24
|
+
!sameStrings(value.queueResultStatuses, ["queued", "unchanged_replay", "suppressed", "reopened"]) ||
|
|
25
|
+
value.queueMaxResultUtf8Bytes !== 4_096 ||
|
|
26
|
+
value.dispositionRequestSchemaVersion !== "agentera.personalGlossaryReviewDispositionRequest.v1" ||
|
|
27
|
+
!sameStrings(value.dispositionRequestFields, ["schema_version", "review_id", "receipt", "approval"]) ||
|
|
28
|
+
value.dispositionMaxRequestUtf8Bytes !== 16_384 ||
|
|
29
|
+
value.dispositionResultSchemaVersion !== "agentera.personalGlossaryReviewDispositionResult.v1" ||
|
|
30
|
+
!sameStrings(value.dispositionResultStatuses, ["disposed", "unchanged_replay"]) ||
|
|
31
|
+
value.dispositionMaxResultUtf8Bytes !== 4_096 ||
|
|
32
|
+
!sameStrings(value.dispositionPublicationAuthorizationDispositions, ["accept", "correct"]) ||
|
|
33
|
+
!sameStrings(value.dispositionPublicationAuthorizationFields, ["review_id", "review_record_sha256"]) ||
|
|
34
|
+
value.retrievalSchemaVersion !== "agentera.personalGlossaryReviewRetrieval.v1" ||
|
|
35
|
+
value.retrievalOwner !== "current_user" ||
|
|
36
|
+
value.listDefaultLimit !== 20 ||
|
|
37
|
+
value.listMaximumLimit !== 50 ||
|
|
38
|
+
value.listMaxSerializedUtf8Bytes !== 32_768 ||
|
|
39
|
+
value.listOrder !== "queued_at_desc_then_review_id_asc" ||
|
|
40
|
+
!sameStrings(statuses, ["pending", "terminal"]) ||
|
|
41
|
+
value.cursorAuthority !==
|
|
42
|
+
"references/artifacts/state-storage-authority.yaml#entity_target.public_retrieval.policy.cursor" ||
|
|
43
|
+
value.cursorVocabulary !== "opaque_snapshot_cursor" ||
|
|
44
|
+
!sameStrings(value.cursorBinding, ["collection", "owner", "filters", "limit", "order", "snapshot"]) ||
|
|
45
|
+
value.cursorInvalidBehavior !== "cursor_invalid" ||
|
|
46
|
+
value.cursorUnavailableBehavior !== "cursor_snapshot_unavailable" ||
|
|
47
|
+
!sameStrings(value.exactRequiredBindings, [
|
|
48
|
+
"review_id",
|
|
49
|
+
"candidate_id",
|
|
50
|
+
"candidate_revision",
|
|
51
|
+
"generation",
|
|
52
|
+
"policy_version",
|
|
53
|
+
]) ||
|
|
54
|
+
value.exactCurrentBindingField !== "candidate_projection_sha256" ||
|
|
55
|
+
value.exactMaxSerializedUtf8Bytes !== 8_192) {
|
|
56
|
+
throw new TypeError("personal glossary review-record command contract is unavailable");
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
command: value.command,
|
|
60
|
+
queueRequestSchemaVersion: value.queueRequestSchemaVersion,
|
|
61
|
+
queueRequestFields: value.queueRequestFields,
|
|
62
|
+
queueMaxRequestUtf8Bytes: value.queueMaxRequestUtf8Bytes,
|
|
63
|
+
queueResultSchemaVersion: value.queueResultSchemaVersion,
|
|
64
|
+
queueResultMaxUtf8Bytes: value.queueMaxResultUtf8Bytes,
|
|
65
|
+
dispositionRequestSchemaVersion: value.dispositionRequestSchemaVersion,
|
|
66
|
+
dispositionRequestFields: value.dispositionRequestFields,
|
|
67
|
+
dispositionMaxRequestUtf8Bytes: value.dispositionMaxRequestUtf8Bytes,
|
|
68
|
+
dispositionResultSchemaVersion: value.dispositionResultSchemaVersion,
|
|
69
|
+
dispositionResultMaxUtf8Bytes: value.dispositionMaxResultUtf8Bytes,
|
|
70
|
+
dispositionPublicationAuthorizationDispositions: value.dispositionPublicationAuthorizationDispositions,
|
|
71
|
+
dispositionPublicationAuthorizationFields: value.dispositionPublicationAuthorizationFields,
|
|
72
|
+
retrievalSchemaVersion: value.retrievalSchemaVersion,
|
|
73
|
+
owner: value.retrievalOwner,
|
|
74
|
+
defaultLimit: value.listDefaultLimit,
|
|
75
|
+
maximumLimit: value.listMaximumLimit,
|
|
76
|
+
listMaxSerializedUtf8Bytes: value.listMaxSerializedUtf8Bytes,
|
|
77
|
+
order: value.listOrder,
|
|
78
|
+
statuses,
|
|
79
|
+
cursorAuthority: value.cursorAuthority,
|
|
80
|
+
cursorVocabulary: value.cursorVocabulary,
|
|
81
|
+
cursorBinding: value.cursorBinding,
|
|
82
|
+
cursorInvalidBehavior: value.cursorInvalidBehavior,
|
|
83
|
+
cursorUnavailableBehavior: value.cursorUnavailableBehavior,
|
|
84
|
+
exactBindings: value.exactRequiredBindings,
|
|
85
|
+
exactMaxSerializedUtf8Bytes: value.exactMaxSerializedUtf8Bytes,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function queueSyntax(value) {
|
|
89
|
+
return `${value.command} queue --input <file|-> --format json`;
|
|
90
|
+
}
|
|
91
|
+
function dispositionSyntax(value) {
|
|
92
|
+
return `${value.command} disposition --input <file|-> --format json`;
|
|
93
|
+
}
|
|
94
|
+
function listSyntax(value) {
|
|
95
|
+
return `${value.command} list [--status pending|terminal] [--limit N] [--cursor TOKEN] --format json`;
|
|
96
|
+
}
|
|
97
|
+
function exactSyntax(value) {
|
|
98
|
+
return `${value.command} get --review-id ID --candidate-id ID --candidate-revision REVISION --generation GENERATION --policy-version POLICY --format json`;
|
|
99
|
+
}
|
|
100
|
+
function invalid(io, body) {
|
|
101
|
+
return emitInvalidInput(io, { format: "json", body });
|
|
102
|
+
}
|
|
103
|
+
function failure(io, schemaVersion, command, syntax, example, body) {
|
|
104
|
+
emitStructured({
|
|
105
|
+
schemaVersion,
|
|
106
|
+
command,
|
|
107
|
+
status: "fail",
|
|
108
|
+
error: { ...body, syntax, example },
|
|
109
|
+
}, "json", io.out ?? ((text) => process.stdout.write(text)));
|
|
110
|
+
return 1;
|
|
111
|
+
}
|
|
112
|
+
function argvPart(argument) {
|
|
113
|
+
const separator = argument.indexOf("=");
|
|
114
|
+
return separator < 0
|
|
115
|
+
? { name: argument }
|
|
116
|
+
: { name: argument.slice(0, separator), inline: argument.slice(separator + 1) };
|
|
117
|
+
}
|
|
118
|
+
function boundedText(value, maximum) {
|
|
119
|
+
return value.length > 0 && Buffer.byteLength(value, "utf8") <= maximum;
|
|
120
|
+
}
|
|
121
|
+
function parseQueue(argv, value) {
|
|
122
|
+
let input;
|
|
123
|
+
let format = false;
|
|
124
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
125
|
+
const { name, inline } = argvPart(argv[index]);
|
|
126
|
+
if (name !== "--input" && name !== "--format") {
|
|
127
|
+
return { class: "unrecognized_argument", message: "unrecognized review-record argument", syntax: queueSyntax(value) };
|
|
128
|
+
}
|
|
129
|
+
const option = inline ?? argv[++index];
|
|
130
|
+
if (!option || option.startsWith("--")) {
|
|
131
|
+
return { class: "missing_argument", message: `${name} requires a value`, syntax: `${name} VALUE` };
|
|
132
|
+
}
|
|
133
|
+
if (name === "--format") {
|
|
134
|
+
if (format)
|
|
135
|
+
return { class: "mutually_exclusive", message: "--format may only be supplied once", syntax: queueSyntax(value) };
|
|
136
|
+
if (option !== "json")
|
|
137
|
+
return { class: "invalid_choice", message: "personal-glossary-reviews requires --format json", valid_values: ["json"] };
|
|
138
|
+
format = true;
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (input !== undefined)
|
|
142
|
+
return { class: "mutually_exclusive", message: "--input may only be supplied once", syntax: queueSyntax(value) };
|
|
143
|
+
input = option;
|
|
144
|
+
}
|
|
145
|
+
return input ? { input } : { class: "missing_argument", message: "--input is required", syntax: queueSyntax(value) };
|
|
146
|
+
}
|
|
147
|
+
function parseDisposition(argv, value) {
|
|
148
|
+
let input;
|
|
149
|
+
let format = false;
|
|
150
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
151
|
+
const { name, inline } = argvPart(argv[index]);
|
|
152
|
+
if (name !== "--input" && name !== "--format") {
|
|
153
|
+
return { class: "unrecognized_argument", message: "unrecognized review disposition argument", syntax: dispositionSyntax(value) };
|
|
154
|
+
}
|
|
155
|
+
const option = inline ?? argv[++index];
|
|
156
|
+
if (!option || option.startsWith("--")) {
|
|
157
|
+
return { class: "missing_argument", message: `${name} requires a value`, syntax: `${name} VALUE` };
|
|
158
|
+
}
|
|
159
|
+
if (name === "--format") {
|
|
160
|
+
if (format)
|
|
161
|
+
return { class: "mutually_exclusive", message: "--format may only be supplied once", syntax: dispositionSyntax(value) };
|
|
162
|
+
if (option !== "json")
|
|
163
|
+
return { class: "invalid_choice", message: "personal-glossary-reviews requires --format json", valid_values: ["json"] };
|
|
164
|
+
format = true;
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
if (input !== undefined)
|
|
168
|
+
return { class: "mutually_exclusive", message: "--input may only be supplied once", syntax: dispositionSyntax(value) };
|
|
169
|
+
input = option;
|
|
170
|
+
}
|
|
171
|
+
return input ? { input } : { class: "missing_argument", message: "--input is required", syntax: dispositionSyntax(value) };
|
|
172
|
+
}
|
|
173
|
+
function parseList(argv, value) {
|
|
174
|
+
let limit = value.defaultLimit;
|
|
175
|
+
let cursor;
|
|
176
|
+
let status;
|
|
177
|
+
const seen = new Set();
|
|
178
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
179
|
+
const { name, inline } = argvPart(argv[index]);
|
|
180
|
+
if (![
|
|
181
|
+
"--format",
|
|
182
|
+
"--limit",
|
|
183
|
+
"--cursor",
|
|
184
|
+
"--status",
|
|
185
|
+
].includes(name)) {
|
|
186
|
+
return { class: "unrecognized_argument", message: "unrecognized review-record argument", syntax: listSyntax(value) };
|
|
187
|
+
}
|
|
188
|
+
if (seen.has(name))
|
|
189
|
+
return { class: "mutually_exclusive", message: `${name} may only be supplied once`, syntax: listSyntax(value) };
|
|
190
|
+
seen.add(name);
|
|
191
|
+
const option = inline ?? argv[++index];
|
|
192
|
+
if (!option || option.startsWith("--"))
|
|
193
|
+
return { class: "missing_argument", message: `${name} requires a value`, syntax: `${name} VALUE` };
|
|
194
|
+
if (name === "--format") {
|
|
195
|
+
if (option !== "json")
|
|
196
|
+
return { class: "invalid_choice", message: "--format must be json", valid_values: ["json"] };
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
if (name === "--limit") {
|
|
200
|
+
if (!/^[1-9]\d*$/u.test(option))
|
|
201
|
+
return { class: "invalid_int", message: "--limit must be a positive integer", syntax: listSyntax(value) };
|
|
202
|
+
const parsed = Number(option);
|
|
203
|
+
if (parsed > value.maximumLimit)
|
|
204
|
+
return { class: "invalid_choice", message: `--limit must be from 1 to ${value.maximumLimit}`, valid_values: [`1..${value.maximumLimit}`], syntax: listSyntax(value) };
|
|
205
|
+
limit = parsed;
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (name === "--cursor") {
|
|
209
|
+
if (!boundedText(option, MAX_CURSOR_UTF8_BYTES))
|
|
210
|
+
return { class: "invalid_request", message: `--cursor must be a non-empty value within ${MAX_CURSOR_UTF8_BYTES} UTF-8 bytes`, syntax: listSyntax(value) };
|
|
211
|
+
cursor = option;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (!value.statuses.includes(option)) {
|
|
215
|
+
return { class: "invalid_choice", message: "--status must be pending or terminal", valid_values: value.statuses, syntax: listSyntax(value) };
|
|
216
|
+
}
|
|
217
|
+
status = option;
|
|
218
|
+
}
|
|
219
|
+
return { limit, cursor, status };
|
|
220
|
+
}
|
|
221
|
+
function parseExact(argv, value) {
|
|
222
|
+
const names = {
|
|
223
|
+
"--review-id": "reviewId",
|
|
224
|
+
"--candidate-id": "candidateId",
|
|
225
|
+
"--candidate-revision": "candidateRevision",
|
|
226
|
+
"--generation": "generation",
|
|
227
|
+
"--policy-version": "policyVersion",
|
|
228
|
+
};
|
|
229
|
+
const fields = {};
|
|
230
|
+
const seen = new Set();
|
|
231
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
232
|
+
const { name, inline } = argvPart(argv[index]);
|
|
233
|
+
if (name !== "--format" && !(name in names))
|
|
234
|
+
return { class: "unrecognized_argument", message: "unrecognized review-record argument", syntax: exactSyntax(value) };
|
|
235
|
+
if (seen.has(name))
|
|
236
|
+
return { class: "mutually_exclusive", message: `${name} may only be supplied once`, syntax: exactSyntax(value) };
|
|
237
|
+
seen.add(name);
|
|
238
|
+
const option = inline ?? argv[++index];
|
|
239
|
+
if (!option || option.startsWith("--"))
|
|
240
|
+
return { class: "missing_argument", message: `${name} requires a value`, syntax: `${name} VALUE` };
|
|
241
|
+
if (name === "--format") {
|
|
242
|
+
if (option !== "json")
|
|
243
|
+
return { class: "invalid_choice", message: "--format must be json", valid_values: ["json"] };
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
fields[names[name]] = option;
|
|
247
|
+
}
|
|
248
|
+
for (const [flag, field] of Object.entries(names)) {
|
|
249
|
+
if (!fields[field])
|
|
250
|
+
return { class: "missing_argument", message: `${flag} is required`, syntax: exactSyntax(value) };
|
|
251
|
+
}
|
|
252
|
+
for (const [flag, field] of [
|
|
253
|
+
["--review-id", "reviewId"],
|
|
254
|
+
["--candidate-id", "candidateId"],
|
|
255
|
+
["--candidate-revision", "candidateRevision"],
|
|
256
|
+
]) {
|
|
257
|
+
if (!SHA256.test(fields[field])) {
|
|
258
|
+
return { class: "invalid_request", message: `${flag} must be a lowercase SHA-256 identity`, valid_values: ["64 lowercase hexadecimal characters"], syntax: exactSyntax(value) };
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
for (const [flag, field, valid] of [
|
|
262
|
+
["--generation", "generation", validPersonalGlossaryReviewGenerationBinding],
|
|
263
|
+
["--policy-version", "policyVersion", validPersonalGlossaryReviewMetadataBinding],
|
|
264
|
+
]) {
|
|
265
|
+
if (!valid(fields[field])) {
|
|
266
|
+
return {
|
|
267
|
+
class: "invalid_request",
|
|
268
|
+
message: `${flag} must be a non-secret, non-path value within 256 UTF-8 bytes`,
|
|
269
|
+
syntax: exactSyntax(value),
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return fields;
|
|
274
|
+
}
|
|
275
|
+
function readBoundedDescriptor(fd, maxBytes) {
|
|
276
|
+
const bytes = Buffer.allocUnsafe(maxBytes + 1);
|
|
277
|
+
let offset = 0;
|
|
278
|
+
while (offset < bytes.length) {
|
|
279
|
+
const count = fs.readSync(fd, bytes, offset, bytes.length - offset, null);
|
|
280
|
+
if (count === 0)
|
|
281
|
+
break;
|
|
282
|
+
offset += count;
|
|
283
|
+
}
|
|
284
|
+
if (offset > maxBytes)
|
|
285
|
+
throw new Error("over bound");
|
|
286
|
+
return bytes.subarray(0, offset);
|
|
287
|
+
}
|
|
288
|
+
function sameIdentity(left, right) {
|
|
289
|
+
return left.dev === right.dev && left.ino === right.ino;
|
|
290
|
+
}
|
|
291
|
+
function readBoundedFile(source, maxBytes) {
|
|
292
|
+
const observed = fs.lstatSync(source, { bigint: true });
|
|
293
|
+
if (observed.isSymbolicLink() || !observed.isFile() || observed.size > BigInt(maxBytes)) {
|
|
294
|
+
throw new Error("over bound or unreadable");
|
|
295
|
+
}
|
|
296
|
+
let descriptor = null;
|
|
297
|
+
try {
|
|
298
|
+
descriptor = fs.openSync(source, fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW ?? 0));
|
|
299
|
+
const opened = fs.fstatSync(descriptor, { bigint: true });
|
|
300
|
+
if (!opened.isFile() || !sameIdentity(observed, opened) || opened.size > BigInt(maxBytes)) {
|
|
301
|
+
throw new Error("over bound or unreadable");
|
|
302
|
+
}
|
|
303
|
+
return readBoundedDescriptor(descriptor, maxBytes);
|
|
304
|
+
}
|
|
305
|
+
finally {
|
|
306
|
+
if (descriptor !== null)
|
|
307
|
+
fs.closeSync(descriptor);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function readBoundedStdin(maxBytes, io) {
|
|
311
|
+
if (io.stdin) {
|
|
312
|
+
const value = io.stdin();
|
|
313
|
+
if (Buffer.byteLength(value, "utf8") > maxBytes)
|
|
314
|
+
throw new Error("over bound");
|
|
315
|
+
return Buffer.from(value, "utf8");
|
|
316
|
+
}
|
|
317
|
+
if (process.stdin.isTTY)
|
|
318
|
+
return Buffer.alloc(0);
|
|
319
|
+
return readBoundedDescriptor(0, maxBytes);
|
|
320
|
+
}
|
|
321
|
+
function readRequest(source, maxBytes, io) {
|
|
322
|
+
const bytes = source === "-" ? readBoundedStdin(maxBytes, io) : readBoundedFile(source, maxBytes);
|
|
323
|
+
const text = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
324
|
+
const value = loadYamlMapping(text);
|
|
325
|
+
if (!mapping(value))
|
|
326
|
+
throw new Error("not a mapping");
|
|
327
|
+
return value;
|
|
328
|
+
}
|
|
329
|
+
function validateQueueRequest(request, value) {
|
|
330
|
+
const keys = Object.keys(request);
|
|
331
|
+
if (keys.some((key) => !value.queueRequestFields.includes(key)) ||
|
|
332
|
+
value.queueRequestFields.some((field) => !(field in request))) {
|
|
333
|
+
return { error: { class: "schema_violation", message: "personal glossary review queue request fields are invalid", valid_values: value.queueRequestFields } };
|
|
334
|
+
}
|
|
335
|
+
if (request.schema_version !== value.queueRequestSchemaVersion || !mapping(request.receipt)) {
|
|
336
|
+
return { error: { class: "schema_violation", message: `request requires ${value.queueRequestSchemaVersion} and one receipt mapping`, valid_values: [value.queueRequestSchemaVersion, "receipt"] } };
|
|
337
|
+
}
|
|
338
|
+
return { receipt: request.receipt };
|
|
339
|
+
}
|
|
340
|
+
function validateDispositionRequest(request, value) {
|
|
341
|
+
const keys = Object.keys(request);
|
|
342
|
+
if (keys.some((key) => !value.dispositionRequestFields.includes(key)) ||
|
|
343
|
+
value.dispositionRequestFields.some((field) => !(field in request))) {
|
|
344
|
+
return {
|
|
345
|
+
error: {
|
|
346
|
+
class: "schema_violation",
|
|
347
|
+
message: "personal glossary review disposition request fields are invalid",
|
|
348
|
+
valid_values: value.dispositionRequestFields,
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
if (request.schema_version !== value.dispositionRequestSchemaVersion ||
|
|
353
|
+
typeof request.review_id !== "string" ||
|
|
354
|
+
!SHA256.test(request.review_id) ||
|
|
355
|
+
!mapping(request.receipt) ||
|
|
356
|
+
!mapping(request.approval)) {
|
|
357
|
+
return {
|
|
358
|
+
error: {
|
|
359
|
+
class: "schema_violation",
|
|
360
|
+
message: `request requires ${value.dispositionRequestSchemaVersion}, one review identity, receipt, and approval mappings`,
|
|
361
|
+
valid_values: [value.dispositionRequestSchemaVersion, "review_id", "receipt", "approval"],
|
|
362
|
+
},
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
return { reviewId: request.review_id, receipt: request.receipt, approval: request.approval };
|
|
366
|
+
}
|
|
367
|
+
function reviewSummary(record) {
|
|
368
|
+
return {
|
|
369
|
+
review_id: record.review_id,
|
|
370
|
+
candidate_id: record.candidate_id,
|
|
371
|
+
candidate_revision: record.candidate_revision,
|
|
372
|
+
candidate_capsule_sha256: record.candidate_capsule_sha256,
|
|
373
|
+
candidate_projection_sha256: record.candidate_projection_sha256,
|
|
374
|
+
host_receipt_sha256: record.host_receipt_sha256,
|
|
375
|
+
cli_decision_sha256: record.cli_decision_sha256,
|
|
376
|
+
semantic_fingerprint: record.semantic_fingerprint,
|
|
377
|
+
generation: record.generation,
|
|
378
|
+
policy_version: record.policy_version,
|
|
379
|
+
scope: record.scope,
|
|
380
|
+
reason: record.reason,
|
|
381
|
+
status: record.status,
|
|
382
|
+
disposition: record.disposition,
|
|
383
|
+
reopen_reason: record.reopen_reason,
|
|
384
|
+
queued_at: record.queued_at,
|
|
385
|
+
terminal_at: record.terminal_at,
|
|
386
|
+
expires_at: record.expires_at,
|
|
387
|
+
record_sha256: record.record_sha256,
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
function serializedBytes(value) {
|
|
391
|
+
return Buffer.byteLength(`${JSON.stringify(value, null, 2)}\n`, "utf8");
|
|
392
|
+
}
|
|
393
|
+
function emitQueueSuccess(io, value, result) {
|
|
394
|
+
const response = {
|
|
395
|
+
schemaVersion: value.queueResultSchemaVersion,
|
|
396
|
+
command: `${value.command} queue`,
|
|
397
|
+
status: result.status,
|
|
398
|
+
reason: result.reason,
|
|
399
|
+
reopen_reason: result.reopen_reason,
|
|
400
|
+
owner: value.owner,
|
|
401
|
+
record: reviewSummary(result.record),
|
|
402
|
+
effects: {
|
|
403
|
+
review_metadata: result.status === "queued" || result.status === "reopened"
|
|
404
|
+
? "created"
|
|
405
|
+
: result.status === "suppressed"
|
|
406
|
+
? "unchanged_suppressed"
|
|
407
|
+
: "unchanged_replay",
|
|
408
|
+
profile_entry: "unchanged",
|
|
409
|
+
project_state: "unchanged",
|
|
410
|
+
candidate_projection: "unchanged",
|
|
411
|
+
publication: "unchanged",
|
|
412
|
+
},
|
|
413
|
+
};
|
|
414
|
+
if (serializedBytes(response) > value.queueResultMaxUtf8Bytes) {
|
|
415
|
+
return failure(io, value.queueResultSchemaVersion, `${value.command} queue`, queueSyntax(value), queueSyntax(value), {
|
|
416
|
+
class: "output_bound_exceeded",
|
|
417
|
+
message: `review queue response exceeds its ${value.queueResultMaxUtf8Bytes}-byte bound`,
|
|
418
|
+
recovery: "Repair the private review records before retrying; no partial review metadata was returned.",
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
emitStructured(response, "json", io.out ?? ((text) => process.stdout.write(text)));
|
|
422
|
+
return 0;
|
|
423
|
+
}
|
|
424
|
+
function queueReview(io, input, value) {
|
|
425
|
+
let request;
|
|
426
|
+
try {
|
|
427
|
+
request = readRequest(input, value.queueMaxRequestUtf8Bytes, io);
|
|
428
|
+
}
|
|
429
|
+
catch {
|
|
430
|
+
return invalid(io, { class: "invalid_format", message: "--input must be one readable bounded UTF-8 YAML or JSON mapping" });
|
|
431
|
+
}
|
|
432
|
+
const validated = validateQueueRequest(request, value);
|
|
433
|
+
if ("error" in validated)
|
|
434
|
+
return invalid(io, validated.error);
|
|
435
|
+
let result;
|
|
436
|
+
try {
|
|
437
|
+
result = queuePersonalGlossaryReviewRecord({ receipt: validated.receipt });
|
|
438
|
+
}
|
|
439
|
+
catch {
|
|
440
|
+
return failure(io, value.queueResultSchemaVersion, `${value.command} queue`, queueSyntax(value), queueSyntax(value), {
|
|
441
|
+
class: "review_records_unavailable",
|
|
442
|
+
message: "the private current-user review records could not be read or written",
|
|
443
|
+
recovery: "Repair the configured profile path or its permissions, then retry; no profile, project, or candidate-projection bytes were changed.",
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
if (["queued", "unchanged_replay", "suppressed", "reopened"].includes(result.status)) {
|
|
447
|
+
return emitQueueSuccess(io, value, result);
|
|
448
|
+
}
|
|
449
|
+
const failures = {
|
|
450
|
+
decision_not_review_required: {
|
|
451
|
+
class: "review_not_required",
|
|
452
|
+
message: "the current deterministic decision is not review_required",
|
|
453
|
+
recovery: "Use the current decision outcome without queueing, or submit one current review-required receipt; no review metadata was changed.",
|
|
454
|
+
},
|
|
455
|
+
current_binding_mismatch: {
|
|
456
|
+
class: "current_binding_mismatch",
|
|
457
|
+
message: "the review receipt or decision does not bind the current candidate projection",
|
|
458
|
+
recovery: "Read the current candidate projection, create one matching host receipt, and retry; no review metadata was changed.",
|
|
459
|
+
},
|
|
460
|
+
records_unavailable: {
|
|
461
|
+
class: "review_records_unavailable",
|
|
462
|
+
message: "the private current-user review records are unavailable or invalid",
|
|
463
|
+
recovery: "Repair the private review-record file, then retry; no profile, project, or candidate-projection bytes were changed.",
|
|
464
|
+
},
|
|
465
|
+
record_capacity_exceeded: {
|
|
466
|
+
class: "review_record_capacity_exceeded",
|
|
467
|
+
message: "the bounded private review-record store is full",
|
|
468
|
+
recovery: "Run authenticated review maintenance or purge expired terminal metadata, then retry; no review metadata was changed.",
|
|
469
|
+
},
|
|
470
|
+
already_terminal: {
|
|
471
|
+
class: "review_already_terminal",
|
|
472
|
+
message: "the matching review record is terminal and cannot be silently replaced",
|
|
473
|
+
recovery: "Use the existing terminal review lifecycle or queue a distinct current binding; no review metadata was changed.",
|
|
474
|
+
},
|
|
475
|
+
};
|
|
476
|
+
return failure(io, value.queueResultSchemaVersion, `${value.command} queue`, queueSyntax(value), queueSyntax(value), failures[result.status]);
|
|
477
|
+
}
|
|
478
|
+
function emitDispositionSuccess(io, value, result) {
|
|
479
|
+
const response = {
|
|
480
|
+
schemaVersion: value.dispositionResultSchemaVersion,
|
|
481
|
+
command: `${value.command} disposition`,
|
|
482
|
+
status: result.status,
|
|
483
|
+
owner: value.owner,
|
|
484
|
+
record: reviewSummary(result.record),
|
|
485
|
+
publication_authorization: result.publication_authorization,
|
|
486
|
+
effects: {
|
|
487
|
+
review_metadata: result.status === "disposed" ? "changed" : "unchanged_replay",
|
|
488
|
+
profile_entry: "unchanged",
|
|
489
|
+
project_state: "unchanged",
|
|
490
|
+
candidate_projection: "unchanged",
|
|
491
|
+
publication: "unchanged",
|
|
492
|
+
},
|
|
493
|
+
};
|
|
494
|
+
if (serializedBytes(response) > value.dispositionResultMaxUtf8Bytes) {
|
|
495
|
+
return failure(io, value.dispositionResultSchemaVersion, `${value.command} disposition`, dispositionSyntax(value), dispositionSyntax(value), {
|
|
496
|
+
class: "output_bound_exceeded",
|
|
497
|
+
message: `review disposition response exceeds its ${value.dispositionResultMaxUtf8Bytes}-byte bound`,
|
|
498
|
+
recovery: "Repair the private review records before retrying; no partial review metadata was returned.",
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
emitStructured(response, "json", io.out ?? ((text) => process.stdout.write(text)));
|
|
502
|
+
return 0;
|
|
503
|
+
}
|
|
504
|
+
function dispositionReview(io, input, value) {
|
|
505
|
+
let request;
|
|
506
|
+
try {
|
|
507
|
+
request = readRequest(input, value.dispositionMaxRequestUtf8Bytes, io);
|
|
508
|
+
}
|
|
509
|
+
catch {
|
|
510
|
+
return invalid(io, { class: "invalid_format", message: "--input must be one readable bounded UTF-8 YAML or JSON mapping" });
|
|
511
|
+
}
|
|
512
|
+
const validated = validateDispositionRequest(request, value);
|
|
513
|
+
if ("error" in validated)
|
|
514
|
+
return invalid(io, validated.error);
|
|
515
|
+
let result;
|
|
516
|
+
try {
|
|
517
|
+
result = dispositionPersonalGlossaryReviewRecord({
|
|
518
|
+
review_id: validated.reviewId,
|
|
519
|
+
receipt: validated.receipt,
|
|
520
|
+
approval: validated.approval,
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
catch {
|
|
524
|
+
return failure(io, value.dispositionResultSchemaVersion, `${value.command} disposition`, dispositionSyntax(value), dispositionSyntax(value), {
|
|
525
|
+
class: "review_records_unavailable",
|
|
526
|
+
message: "the private current-user review records could not be read or written",
|
|
527
|
+
recovery: "Repair the configured profile path or its permissions, then retry; no profile, project, or candidate-projection bytes were changed.",
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
if (result.status === "disposed" || result.status === "unchanged_replay") {
|
|
531
|
+
return emitDispositionSuccess(io, value, result);
|
|
532
|
+
}
|
|
533
|
+
const failures = {
|
|
534
|
+
review_not_found: {
|
|
535
|
+
class: "not_found",
|
|
536
|
+
message: "the requested current review record was not found",
|
|
537
|
+
recovery: "List current private review records and copy one current review identity; no review metadata was changed.",
|
|
538
|
+
},
|
|
539
|
+
review_not_pending: {
|
|
540
|
+
class: "review_not_pending",
|
|
541
|
+
message: "the requested review is terminal and cannot receive another disposition",
|
|
542
|
+
recovery: "Use its existing publication authorization or queue a current distinct review; no review metadata was changed.",
|
|
543
|
+
},
|
|
544
|
+
current_binding_mismatch: {
|
|
545
|
+
class: "current_binding_mismatch",
|
|
546
|
+
message: "the review receipt or deterministic decision no longer binds the current candidate projection",
|
|
547
|
+
recovery: "Read the current candidate, create matching host classification evidence, and retry; no review metadata was changed.",
|
|
548
|
+
},
|
|
549
|
+
approval_invalid: {
|
|
550
|
+
class: "review_approval_invalid",
|
|
551
|
+
message: "the current-user review approval is invalid or no longer fresh",
|
|
552
|
+
recovery: "Request a new signed current-user local-host approval for this current review, then retry; no review metadata was changed.",
|
|
553
|
+
},
|
|
554
|
+
approval_conflicting_replay: {
|
|
555
|
+
class: "review_approval_replayed",
|
|
556
|
+
message: "the review approval nonce was already used with different signed content",
|
|
557
|
+
recovery: "Request a new signed current-user local-host approval with a new nonce, then retry; no review metadata was changed.",
|
|
558
|
+
},
|
|
559
|
+
approval_unavailable: {
|
|
560
|
+
class: "review_approval_unavailable",
|
|
561
|
+
message: "the configured trusted local-host key is unavailable or invalid",
|
|
562
|
+
recovery: "Repair the user-local trusted host key configuration, then retry; no review metadata was changed.",
|
|
563
|
+
},
|
|
564
|
+
records_unavailable: {
|
|
565
|
+
class: "review_records_unavailable",
|
|
566
|
+
message: "the private current-user review records are unavailable or invalid",
|
|
567
|
+
recovery: "Repair the private review-record file, then retry; no profile, project, or candidate-projection bytes were changed.",
|
|
568
|
+
},
|
|
569
|
+
replay_capacity_exceeded: {
|
|
570
|
+
class: "review_replay_capacity_exceeded",
|
|
571
|
+
message: "the bounded review approval replay index is full",
|
|
572
|
+
recovery: "Run authenticated review maintenance after receipt expiry, then retry; no review metadata was changed.",
|
|
573
|
+
},
|
|
574
|
+
};
|
|
575
|
+
return failure(io, value.dispositionResultSchemaVersion, `${value.command} disposition`, dispositionSyntax(value), dispositionSyntax(value), failures[result.status]);
|
|
576
|
+
}
|
|
577
|
+
/** Run the private, noninteractive review queue, disposition, and read operations. */
|
|
578
|
+
export function runPersonalGlossaryReviewRecordsCommand(argv, io) {
|
|
579
|
+
let value;
|
|
580
|
+
try {
|
|
581
|
+
value = contract();
|
|
582
|
+
}
|
|
583
|
+
catch {
|
|
584
|
+
return failure(io, "agentera.personalGlossaryReviewRetrieval.v1", "agentera report personal-glossary-reviews", "agentera report personal-glossary-reviews {queue,disposition,list,get} --format json", "agentera report personal-glossary-reviews list --limit 20 --format json", {
|
|
585
|
+
class: "unsupported_state",
|
|
586
|
+
message: "personal glossary review-record contract is unavailable",
|
|
587
|
+
recovery: "Restore the bundled glossary authority, then retry; no review metadata was changed.",
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
const operation = argv[0];
|
|
591
|
+
if (operation !== "queue" && operation !== "disposition" && operation !== "list" && operation !== "get") {
|
|
592
|
+
return invalid(io, {
|
|
593
|
+
class: operation ? "unsupported_target" : "missing_argument",
|
|
594
|
+
message: operation ? "unsupported personal glossary review operation" : "review operation is required",
|
|
595
|
+
valid_values: ["queue", "disposition", "list", "get"],
|
|
596
|
+
syntax: `${value.command} {queue,disposition,list,get} --format json`,
|
|
597
|
+
example: `${value.command} list --limit ${value.defaultLimit} --format json`,
|
|
598
|
+
recovery: "Choose queue, disposition, list, or get and retry; no review metadata was changed.",
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
if (operation === "queue") {
|
|
602
|
+
const parsed = parseQueue(argv.slice(1), value);
|
|
603
|
+
if ("class" in parsed)
|
|
604
|
+
return invalid(io, { ...parsed, recovery: "Correct the bounded queue request and retry; no review metadata was changed." });
|
|
605
|
+
return queueReview(io, parsed.input, value);
|
|
606
|
+
}
|
|
607
|
+
if (operation === "disposition") {
|
|
608
|
+
const parsed = parseDisposition(argv.slice(1), value);
|
|
609
|
+
if ("class" in parsed)
|
|
610
|
+
return invalid(io, { ...parsed, recovery: "Correct the bounded disposition request and retry; no review metadata was changed." });
|
|
611
|
+
return dispositionReview(io, parsed.input, value);
|
|
612
|
+
}
|
|
613
|
+
if (operation === "list") {
|
|
614
|
+
const parsed = parseList(argv.slice(1), value);
|
|
615
|
+
if ("class" in parsed)
|
|
616
|
+
return invalid(io, { ...parsed, recovery: "Correct the bounded list request and retry; no review metadata was changed." });
|
|
617
|
+
return listPersonalGlossaryReviewRecords(io, parsed, value);
|
|
618
|
+
}
|
|
619
|
+
const parsed = parseExact(argv.slice(1), value);
|
|
620
|
+
if ("class" in parsed)
|
|
621
|
+
return invalid(io, { ...parsed, recovery: "Correct the exact review binding and retry; no review metadata was changed." });
|
|
622
|
+
return getPersonalGlossaryReviewRecord(io, parsed, value);
|
|
623
|
+
}
|