agentera 3.0.0-dev.41 → 3.0.0-dev.46
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 +33 -4
- package/bundle/CHANGELOG.md +91 -1
- package/bundle/README.md +26 -19
- package/bundle/UPGRADE.md +50 -15
- package/bundle/references/adapters/package-publication.json +408 -14
- package/bundle/references/adapters/package-registry.yaml +414 -1
- package/bundle/references/adapters/package-surface-characterization.md +20 -0
- package/bundle/references/adapters/runtime-retired-resources.yaml +237 -1
- package/bundle/references/analysis/evidence-tier-authority.yaml +3 -3
- package/bundle/references/analysis/verification-policy.yaml +48 -0
- package/bundle/references/artifacts/artifact-registry-interface-model.yaml +1 -1
- package/bundle/references/artifacts/glossary-entry-contract.yaml +11 -11
- package/bundle/references/artifacts/state-storage-authority.yaml +170 -118
- package/bundle/references/cli/capability-instruction-contract.yaml +4 -4
- package/bundle/references/cli/hybrid-route-contract.yaml +27 -5
- package/bundle/references/cli/routing-model.md +20 -4
- package/bundle/references/cli/trigger-schema-enrichment.md +7 -0
- package/bundle/references/cli/vocabulary-index.yaml +1 -3
- package/bundle/references/cli/vocabulary.md +18 -60
- package/bundle/references/meta/retained-reference-authority.yaml +151 -0
- package/bundle/skills/agentera/SKILL.md +32 -16
- package/bundle/skills/agentera/capabilities/audit/schemas/artifacts.yaml +3 -3
- package/bundle/skills/agentera/capabilities/audit/schemas/validation.yaml +1 -1
- package/bundle/skills/agentera/capabilities/build/schemas/artifacts.yaml +5 -5
- package/bundle/skills/agentera/capabilities/build/schemas/validation.yaml +5 -5
- package/bundle/skills/agentera/capabilities/design/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/discuss/schemas/artifacts.yaml +3 -3
- package/bundle/skills/agentera/capabilities/discuss/schemas/validation.yaml +2 -2
- package/bundle/skills/agentera/capabilities/document/schemas/artifacts.yaml +3 -3
- package/bundle/skills/agentera/capabilities/document/schemas/validation.yaml +1 -1
- package/bundle/skills/agentera/capabilities/optimize/schemas/artifacts.yaml +1 -1
- package/bundle/skills/agentera/capabilities/optimize/schemas/validation.yaml +1 -1
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/artifacts.yaml +5 -5
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/validation.yaml +2 -2
- package/bundle/skills/agentera/capabilities/plan/schemas/artifacts.yaml +1 -1
- package/bundle/skills/agentera/capabilities/plan/schemas/validation.yaml +1 -1
- package/bundle/skills/agentera/capabilities/profile/schemas/validation.yaml +1 -1
- package/bundle/skills/agentera/capability_schema_contract.yaml +2 -2
- package/bundle/skills/agentera/schemas/artifacts/decisions.yaml +3 -3
- package/bundle/skills/agentera/schemas/artifacts/experiments.yaml +3 -3
- package/bundle/skills/agentera/schemas/artifacts/glossary.yaml +1 -1
- package/bundle/skills/agentera/schemas/artifacts/health.yaml +3 -3
- package/bundle/skills/agentera/schemas/artifacts/plan.yaml +12 -10
- package/bundle/skills/agentera/schemas/artifacts/progress.yaml +3 -3
- package/bundle/skills/agentera/schemas/artifacts/todo.yaml +6 -4
- package/dist/analytics/extractCorpus/cli.js +0 -1
- package/dist/analytics/extractCorpus/copilotSessions.js +0 -1
- package/dist/analytics/extractCorpus/core.js +0 -1
- package/dist/analytics/extractCorpus/corpus.js +0 -1
- package/dist/analytics/extractCorpus/coverageAudit.js +0 -1
- package/dist/analytics/extractCorpus/cursorSessions.js +0 -1
- package/dist/analytics/extractCorpus/evidenceTiers.js +0 -1
- package/dist/analytics/extractCorpus/extractCorpusParity.js +0 -1
- package/dist/analytics/extractCorpus/filesystemSources.js +0 -1
- package/dist/analytics/extractCorpus/index.js +0 -1
- package/dist/analytics/extractCorpus/jsonlSessions.js +0 -1
- package/dist/analytics/extractCorpus/sqliteCaps.js +0 -1
- package/dist/analytics/extractCorpus/sqliteSessions.js +0 -1
- package/dist/analytics/extractCorpus/tierReader.js +0 -1
- package/dist/analytics/extractCorpus.js +0 -1
- package/dist/analytics/glossaryAdviceResolution.js +0 -1
- package/dist/analytics/glossaryInputAcquisition.js +0 -1
- package/dist/analytics/personalGlossaryAdmission.js +0 -1
- package/dist/analytics/personalGlossaryProfile.js +0 -1
- package/dist/analytics/profileSignals.js +0 -1
- package/dist/analytics/usageStats.js +0 -1
- package/dist/audit/terminologyDrift.js +0 -1
- package/dist/bin/agentera.js +0 -1
- package/dist/capabilities/audit/instructions.js +3 -4
- package/dist/capabilities/build/instructions.js +2 -3
- package/dist/capabilities/design/instructions.js +1 -2
- package/dist/capabilities/discuss/instructions.js +2 -3
- package/dist/capabilities/document/instructions.js +2 -3
- package/dist/capabilities/index.js +5 -4
- package/dist/capabilities/optimize/instructions.js +1 -2
- package/dist/capabilities/orchestrate/instructions.js +3 -4
- package/dist/capabilities/plan/instructions.js +1 -2
- package/dist/capabilities/profile/instructions.js +1 -2
- package/dist/capabilities/research/instructions.js +1 -2
- package/dist/capabilities/status/instructions.js +1 -2
- package/dist/capabilities/status/startupInstructions.js +0 -5
- package/dist/capabilities/vision/instructions.js +1 -2
- package/dist/cli/appContext.js +0 -1
- package/dist/cli/argvalidate.js +0 -1
- package/dist/cli/capabilityContext/benchmark.js +4 -4
- package/dist/cli/capabilityContext/bespoke.js +0 -1
- package/dist/cli/capabilityContext/build.js +8 -10
- package/dist/cli/capabilityContext/closeout.js +8 -10
- package/dist/cli/capabilityContext/contract.js +7 -42
- package/dist/cli/capabilityContext/evidence.js +12 -14
- package/dist/cli/capabilityContext/index.js +0 -1
- package/dist/cli/capabilityContext/orchestration.js +6 -8
- package/dist/cli/capabilityContext/planState.js +0 -1
- package/dist/cli/capabilityContext/progress.js +0 -1
- package/dist/cli/capabilityContext/projectVerification.js +0 -1
- package/dist/cli/capabilityContext/shared.js +2 -19
- package/dist/cli/capabilityContext/slim.js +0 -1
- package/dist/cli/capabilityContext/startup.js +24 -152
- package/dist/cli/capabilityContext/startupAggregation.js +68 -0
- package/dist/cli/capabilityContext/types.js +4 -4
- 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 +0 -1
- package/dist/cli/commands/doctor.js +104 -9
- package/dist/cli/commands/durability.js +0 -1
- package/dist/cli/commands/glossaryAdvice.js +0 -1
- package/dist/cli/commands/lint.js +0 -1
- package/dist/cli/commands/personalGlossary.js +0 -1
- package/dist/cli/commands/prime/briefOrientation.js +24 -85
- package/dist/cli/commands/prime/buildExecutionRequest.js +2 -2
- package/dist/cli/commands/prime/bundleStatus.js +0 -1
- package/dist/cli/commands/prime/collectEntityOrientation.js +47 -27
- package/dist/cli/commands/prime/collectOrientationState.js +36 -2
- package/dist/cli/commands/prime/orientationOutput.js +104 -84
- package/dist/cli/commands/prime/types.js +0 -1
- package/dist/cli/commands/prime/v1Migration.js +0 -1
- package/dist/cli/commands/prime.js +18 -36
- package/dist/cli/commands/profileGrounding.js +0 -1
- package/dist/cli/commands/query.js +2 -2
- package/dist/cli/commands/report.js +0 -1
- package/dist/cli/commands/route.js +3 -3
- package/dist/cli/commands/schema.js +62 -92
- package/dist/cli/commands/state/decisions.js +0 -1
- package/dist/cli/commands/state/docs.js +0 -1
- package/dist/cli/commands/state/experimentRecords.js +0 -1
- package/dist/cli/commands/state/experiments.js +0 -1
- package/dist/cli/commands/state/get.js +0 -1
- package/dist/cli/commands/state/health.js +0 -1
- package/dist/cli/commands/state/index.js +0 -1
- package/dist/cli/commands/state/list.js +0 -1
- package/dist/cli/commands/state/objective.js +0 -1
- package/dist/cli/commands/state/plan.js +0 -1
- package/dist/cli/commands/state/planTasks.js +0 -1
- package/dist/cli/commands/state/plans.js +0 -1
- package/dist/cli/commands/state/progress.js +0 -1
- package/dist/cli/commands/state/shared.js +0 -1
- package/dist/cli/commands/state/todo.js +0 -1
- package/dist/cli/commands/state/write.js +10 -1
- package/dist/cli/commands/upgrade.js +0 -1
- package/dist/cli/commands/upgradeVerify.js +0 -1
- package/dist/cli/commands/validate.js +106 -10
- package/dist/cli/commands/verify.js +0 -1
- 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 +6 -24
- package/dist/cli/dispatch/commands.js +3 -3
- package/dist/cli/dispatch/index.js +9 -36
- package/dist/cli/dispatch/lifecycle.js +11 -57
- package/dist/cli/dispatch/prime.js +0 -1
- package/dist/cli/dispatch/projections.js +17 -0
- package/dist/cli/dispatch/shared.js +0 -1
- package/dist/cli/dispatch/state.js +0 -1
- package/dist/cli/dispatch.js +0 -1
- package/dist/cli/errors.js +0 -1
- package/dist/cli/help.js +51 -30
- package/dist/cli/migrationRequired.js +3 -5
- package/dist/cli/orientation/attention.js +4 -17
- package/dist/cli/orientation/corpusCoverage.js +0 -1
- package/dist/cli/orientation.js +5 -5
- package/dist/cli/planArtifacts.js +0 -1
- package/dist/cli/planEvidence.js +0 -1
- package/dist/cli/planLifecycleState.js +2 -2
- package/dist/cli/planTaskIndex.js +0 -1
- package/dist/cli/preCutoverCommand.js +32 -0
- package/dist/cli/prime-blob.js +6 -6
- package/dist/cli/profileAcquisition.js +0 -1
- package/dist/cli/startupCompletenessContract.js +0 -1
- package/dist/cli/stateQuery.js +17 -21
- package/dist/cli/structured.js +0 -1
- package/dist/cli/todoMarkdown.js +0 -1
- package/dist/cli/todoReadinessSelection.js +2 -2
- package/dist/cli/todoSeverity.js +0 -1
- package/dist/core/atomicWriter.js +0 -1
- package/dist/core/developmentChannel.js +1 -0
- package/dist/core/developmentInvocation.js +374 -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 +0 -1
- package/dist/core/skillIdentity.js +0 -1
- package/dist/core/sourceRoot.js +9 -12
- package/dist/core/text.js +0 -1
- package/dist/core/toml.js +0 -1
- package/dist/core/yaml.js +0 -1
- package/dist/eval/evalSkills.js +0 -1
- package/dist/eval/hybridRouteEvaluation.js +0 -1
- package/dist/eval/semanticEval.js +0 -1
- package/dist/eval/semanticFixtures.js +0 -1
- package/dist/hooks/common.js +1 -54
- package/dist/hooks/compaction/apply.js +0 -1
- package/dist/hooks/compaction/dryRun.js +0 -1
- package/dist/hooks/compaction/index.js +1 -2
- package/dist/hooks/compaction/parse.js +0 -1
- package/dist/hooks/compaction/retention.js +0 -1
- package/dist/hooks/compaction/status.js +0 -1
- 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 +0 -1
- package/dist/hooks/validateArtifact/schema.js +0 -1
- package/dist/hooks/validateArtifact/traversal.js +0 -1
- package/dist/hooks/validateArtifact/violations.js +0 -1
- package/dist/migrate/v2HandoffManifest.js +0 -3
- package/dist/registries/activationContract.js +2 -0
- package/dist/registries/activationTuples.js +106 -0
- package/dist/registries/artifactProtocolIds.js +0 -1
- package/dist/registries/artifactRegistry.js +0 -1
- package/dist/registries/artifactSchemaProjection.js +0 -1
- package/dist/registries/capabilityContract.js +0 -1
- package/dist/registries/evaluatorHandoffContract.js +0 -1
- package/dist/registries/evidenceTierContract.js +0 -1
- package/dist/registries/glossaryAdviceContract.js +2 -2
- package/dist/registries/glossaryCaveatContract.js +0 -1
- package/dist/registries/glossaryConsumerContractValidation.js +5 -6
- package/dist/registries/glossaryEntryContract.js +8 -8
- package/dist/registries/glossaryTermIdentity.js +0 -1
- package/dist/registries/glossaryTermOccurrence.js +0 -1
- package/dist/registries/hybridRoute.js +73 -2
- package/dist/registries/hybridRouteReceipt.js +2 -2
- package/dist/registries/packagePublication.js +229 -0
- package/dist/registries/packageRegistry.js +118 -2
- package/dist/registries/todoReadinessContract.js +0 -1
- package/dist/registries/triggerLoader.js +0 -1
- package/dist/registries/verbosityBudgetContract.js +0 -1
- package/dist/release/releaseMetadata.js +69 -3
- package/dist/runtime/lifecycleAdapterContract.js +0 -1
- package/dist/runtime/lifecycleAdapters.js +0 -1
- package/dist/runtime/lifecycleAuthority.js +0 -1
- package/dist/runtime/lifecycleOperationContract.js +12 -3
- package/dist/runtime/lifecycleOperations.js +0 -1
- package/dist/runtime/lifecycleOwnershipJournal.js +0 -1
- package/dist/runtime/lifecyclePublication.js +0 -1
- package/dist/runtime/lifecycleSnapshot.js +0 -1
- package/dist/runtime/nativeResourceCleanup.js +191 -6
- package/dist/setup/opencode.js +0 -1
- package/dist/setup/opencodeConstants.js +0 -1
- package/dist/setup/sharedSkill.js +0 -1
- package/dist/setup/smokeChecks.js +1 -33
- package/dist/state/archiveDiscovery.js +0 -1
- package/dist/state/archivePublication.js +0 -1
- package/dist/state/archiveRecovery.js +0 -1
- package/dist/state/archiveReplay.js +0 -1
- package/dist/state/canonicalMigrationRecord.js +0 -1
- package/dist/state/changelog.js +0 -1
- package/dist/state/decisionEntities.js +0 -1
- package/dist/state/decisionLegacyValidation.js +0 -1
- package/dist/state/decisionMigrationProvenance.js +0 -1
- package/dist/state/decisionOverlay.js +0 -1
- package/dist/state/decisionRevision.js +0 -1
- package/dist/state/decisionRevisionMigration.js +0 -1
- package/dist/state/directRetrieval.js +0 -1
- package/dist/state/durability.js +0 -1
- package/dist/state/entityCutover.js +174 -9
- package/dist/state/entityCutoverGit.js +0 -1
- package/dist/state/entityGlossaryAuthority.js +0 -1
- package/dist/state/entityListProjection.js +0 -1
- package/dist/state/entityListRuntimeRegistry.js +46 -11
- package/dist/state/entityMigrationCausality.js +3 -5
- package/dist/state/entityMigrationIdentity.js +0 -1
- package/dist/state/entityMigrationPreview.js +35 -73
- package/dist/state/entityMigrationTodo.js +133 -0
- package/dist/state/entityPublicationContext.js +0 -1
- package/dist/state/entityRetrievalHelp.js +53 -23
- package/dist/state/entityStorage.js +0 -1
- package/dist/state/exactReplacementRecovery.js +0 -1
- package/dist/state/experimentArchive.js +0 -1
- package/dist/state/experimentIdentity.js +0 -1
- package/dist/state/healthEntities.js +0 -1
- package/dist/state/healthEntityValidation.js +0 -1
- package/dist/state/healthRepair.js +0 -1
- package/dist/state/installRoot.js +0 -1
- package/dist/state/legacyEntityCutoverEvidence.js +0 -1
- package/dist/state/legacyIdentity.js +0 -1
- package/dist/state/legacySummaryRecord.js +0 -1
- package/dist/state/listAccounting.js +0 -1
- package/dist/state/listClassification.js +0 -1
- package/dist/state/listCursor.js +0 -1
- package/dist/state/listRetrieval.js +0 -1
- package/dist/state/migrationSourceBinding.js +0 -1
- package/dist/state/objectiveExperimentEntities.js +0 -1
- package/dist/state/planEntities.js +0 -1
- package/dist/state/planIdentity.js +0 -1
- package/dist/state/planRetrieval.js +0 -1
- package/dist/state/planTaskRetrieval.js +0 -1
- package/dist/state/progressEntities.js +0 -1
- package/dist/state/progressGlossaryCaveat.js +0 -1
- package/dist/state/progressPublicationOrder.js +0 -1
- package/dist/state/projectRoot.js +0 -1
- package/dist/state/projectionPolicy.js +0 -1
- package/dist/state/retrievalAuthority.js +0 -1
- package/dist/state/safeProjectFile.js +0 -1
- package/dist/state/startupAnalysis/benchmark.js +0 -1
- package/dist/state/startupAnalysis/contract.js +44 -10
- package/dist/state/startupAnalysis/helpers.js +0 -1
- 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 +0 -1
- package/dist/state/startupAnalysis.js +0 -1
- package/dist/state/startupProjection.js +2 -2
- package/dist/state/stateMode.js +0 -1
- package/dist/state/stateStorageAuthority.js +0 -1
- package/dist/state/summaryEntityRead.js +0 -1
- package/dist/state/summaryMigrationProvenance.js +0 -1
- package/dist/state/summarySourceRowAuthority.js +0 -1
- package/dist/state/todoDocsEntities.js +161 -83
- package/dist/state/todoDocsEntityValidation.js +0 -1
- package/dist/state/todoMarkdownProjection.js +51 -0
- package/dist/state/todoReconciliationActivation.js +73 -4
- package/dist/state/todoReconciliationInspection.js +173 -0
- package/dist/state/todoReconciliationRepair.js +170 -0
- package/dist/state/todoReconciliationTransaction.js +41 -13
- package/dist/state/write/assign.js +0 -1
- package/dist/state/write/candidateMutation.js +0 -1
- package/dist/state/write/errors.js +0 -1
- package/dist/state/write/experimentPublication.js +0 -1
- package/dist/state/write/explain.js +0 -1
- package/dist/state/write/fields.js +0 -1
- package/dist/state/write/glossaryPublication.js +0 -1
- package/dist/state/write/grammar.js +13 -4
- package/dist/state/write/helpers.js +0 -1
- package/dist/state/write/index.js +0 -1
- package/dist/state/write/input.js +0 -1
- package/dist/state/write/lock.js +0 -1
- package/dist/state/write/mutation.js +0 -1
- package/dist/state/write/operations.js +0 -1
- package/dist/state/write/planEvaluation.js +0 -1
- package/dist/state/write/planPublication.js +0 -1
- package/dist/state/write/runtimeOperations.js +83 -6
- package/dist/state/write/serialize.js +0 -1
- package/dist/state/write/transaction.js +0 -1
- package/dist/state/write/validate.js +0 -1
- package/dist/upgrade/appContentRefresh.js +0 -1
- package/dist/upgrade/appModel.js +0 -1
- package/dist/upgrade/atomicWriter.js +0 -1
- package/dist/upgrade/bundleEvidence.js +0 -1
- package/dist/upgrade/channels.js +0 -1
- package/dist/upgrade/compatibility.js +0 -1
- package/dist/upgrade/doctor.js +0 -1
- package/dist/upgrade/doctorClassifier.js +0 -1
- package/dist/upgrade/installedHooksRetirement.js +0 -1
- package/dist/upgrade/legacyAgentCleanup.js +0 -1
- package/dist/upgrade/lifecycleUpgrade.js +0 -1
- package/dist/upgrade/migrateArtifactsV2ToV3.js +7 -15
- package/dist/upgrade/migrationPublication.js +0 -1
- package/dist/upgrade/nextMajorDoctor.js +0 -1
- package/dist/upgrade/npxPlatformStatus.js +0 -1
- package/dist/upgrade/projectIntegration.js +4 -17
- package/dist/upgrade/projectIntegrationDecision.js +0 -1
- package/dist/upgrade/retiredResourceDiagnostics.js +117 -0
- package/dist/upgrade/runtimeMigration.js +61 -190
- package/dist/upgrade/upgradeCommands.js +5 -1
- package/dist/upgrade/upgradeLock.js +0 -1
- package/dist/upgrade/upgradeOrchestrator.js +52 -9
- package/dist/upgrade/v3CapabilitySurface.js +0 -1
- package/dist/upgrade/versionResolution.js +0 -1
- package/dist/validate/activationArtifactEvidence.js +844 -0
- package/dist/validate/activationConjunction.js +816 -0
- package/dist/validate/activationEvidenceManifest.js +515 -0
- package/dist/validate/activationPackageSemantics.js +29 -0
- package/dist/validate/appHomeContract.js +0 -2
- package/dist/validate/bootstrapAuthority.js +44 -0
- package/dist/validate/capability.js +0 -1
- package/dist/validate/crossCapability.js +0 -1
- package/dist/validate/retainedReferenceAuthority.js +879 -0
- package/dist/validate/selfAudit.js +0 -1
- package/dist/validate/v1LegacyCruft.js +0 -10
- package/dist/validate/vocabularyAuthority.js +6 -8
- package/package.json +12 -5
- package/bundle/references/adapters/package-manifest-interface-model.yaml +0 -127
- package/bundle/references/analysis/benchmark.md +0 -271
- package/bundle/references/analysis/startup-measurement-contract.yaml +0 -435
- package/bundle/references/cli/agent-ready-state-contract.yaml +0 -1015
- package/bundle/references/cli/audience-namespace-cli-migration.yaml +0 -395
- package/bundle/references/cli/bundle-skill-vocabulary.yaml +0 -241
- package/bundle/references/cli/capability-instruction-structure.md +0 -144
- 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/prime-consumer-compatibility.yaml +0 -701
- package/bundle/references/cli/routing-execution-vocabulary.yaml +0 -259
- package/bundle/references/cli/single-name-protocol.yaml +0 -42
- package/bundle/references/cli/upgrade-repair-wording.md +0 -25
- package/bundle/references/cli/v3-handoff-manifest.schema.yaml +0 -97
- package/bundle/references/meta/documentation-inventory.md +0 -50
- package/bundle/skills/agentera/references/contract.md +0 -1097
- 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/evidenceTiers.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/tierReader.js.map +0 -1
- package/dist/analytics/extractCorpus.js.map +0 -1
- package/dist/analytics/glossaryAdviceResolution.js.map +0 -1
- package/dist/analytics/glossaryInputAcquisition.js.map +0 -1
- package/dist/analytics/personalGlossaryAdmission.js.map +0 -1
- package/dist/analytics/personalGlossaryProfile.js.map +0 -1
- package/dist/analytics/profileSignals.js.map +0 -1
- package/dist/analytics/usageStats.js.map +0 -1
- package/dist/audit/terminologyDrift.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/index.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/plan/instructions.js.map +0 -1
- package/dist/capabilities/profile/instructions.js.map +0 -1
- package/dist/capabilities/research/instructions.js.map +0 -1
- package/dist/capabilities/status/instructions.js.map +0 -1
- package/dist/capabilities/status/startupInstructions.js.map +0 -1
- package/dist/capabilities/vision/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/projectVerification.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/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/durability.js.map +0 -1
- package/dist/cli/commands/entityMigrate.js +0 -132
- package/dist/cli/commands/entityMigrate.js.map +0 -1
- package/dist/cli/commands/glossaryAdvice.js.map +0 -1
- package/dist/cli/commands/lint.js.map +0 -1
- package/dist/cli/commands/personalGlossary.js.map +0 -1
- package/dist/cli/commands/prime/briefOrientation.js.map +0 -1
- package/dist/cli/commands/prime/buildExecutionRequest.js.map +0 -1
- package/dist/cli/commands/prime/bundleStatus.js.map +0 -1
- package/dist/cli/commands/prime/collectEntityOrientation.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/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/profileGrounding.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/route.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/experimentRecords.js.map +0 -1
- package/dist/cli/commands/state/experiments.js.map +0 -1
- package/dist/cli/commands/state/get.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/list.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/planTasks.js.map +0 -1
- package/dist/cli/commands/state/plans.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/write.js.map +0 -1
- package/dist/cli/commands/upgrade.js.map +0 -1
- package/dist/cli/commands/upgradeVerify.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/migrationRequired.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/planArtifacts.js.map +0 -1
- package/dist/cli/planEvidence.js.map +0 -1
- package/dist/cli/planLifecycleState.js.map +0 -1
- package/dist/cli/planTaskIndex.js.map +0 -1
- package/dist/cli/prime-blob.js.map +0 -1
- package/dist/cli/profileAcquisition.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/todoReadinessSelection.js.map +0 -1
- package/dist/cli/todoSeverity.js.map +0 -1
- package/dist/core/atomicWriter.js.map +0 -1
- package/dist/core/difflib.js.map +0 -1
- package/dist/core/envPaths.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/shell.js.map +0 -1
- package/dist/core/skillIdentity.js.map +0 -1
- package/dist/core/sourceRoot.js.map +0 -1
- package/dist/core/text.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/hybridRouteEvaluation.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/types.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 -64
- package/dist/hooks/cursorSessionStart.js.map +0 -1
- package/dist/hooks/projectHookInput.js +0 -26
- package/dist/hooks/projectHookInput.js.map +0 -1
- package/dist/hooks/sessionStart.js +0 -94
- package/dist/hooks/sessionStart.js.map +0 -1
- package/dist/hooks/sessionStop.js +0 -198
- package/dist/hooks/sessionStop.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/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/artifactSchemaProjection.js.map +0 -1
- package/dist/registries/capabilityContract.js.map +0 -1
- package/dist/registries/evaluatorHandoffContract.js.map +0 -1
- package/dist/registries/evidenceTierContract.js.map +0 -1
- package/dist/registries/glossaryAdviceContract.js.map +0 -1
- package/dist/registries/glossaryCaveatContract.js.map +0 -1
- package/dist/registries/glossaryConsumerContractValidation.js.map +0 -1
- package/dist/registries/glossaryEntryContract.js.map +0 -1
- package/dist/registries/glossaryTermIdentity.js.map +0 -1
- package/dist/registries/glossaryTermOccurrence.js.map +0 -1
- package/dist/registries/hybridRoute.js.map +0 -1
- package/dist/registries/hybridRouteReceipt.js.map +0 -1
- package/dist/registries/packageRegistry.js.map +0 -1
- package/dist/registries/todoReadinessContract.js.map +0 -1
- package/dist/registries/triggerLoader.js.map +0 -1
- package/dist/registries/verbosityBudgetContract.js.map +0 -1
- package/dist/release/releaseMetadata.js.map +0 -1
- package/dist/runtime/lifecycleAdapterContract.js.map +0 -1
- package/dist/runtime/lifecycleAdapters.js.map +0 -1
- package/dist/runtime/lifecycleAuthority.js.map +0 -1
- package/dist/runtime/lifecycleOperationContract.js.map +0 -1
- package/dist/runtime/lifecycleOperations.js.map +0 -1
- package/dist/runtime/lifecycleOwnershipJournal.js.map +0 -1
- package/dist/runtime/lifecyclePublication.js.map +0 -1
- package/dist/runtime/lifecycleSnapshot.js.map +0 -1
- package/dist/runtime/nativeResourceCleanup.js.map +0 -1
- package/dist/setup/codex/cli.js +0 -130
- package/dist/setup/codex/cli.js.map +0 -1
- package/dist/setup/codex/configToml.js +0 -558
- package/dist/setup/codex/configToml.js.map +0 -1
- package/dist/setup/codex/constants.js +0 -14
- 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 -252
- package/dist/setup/codex/state.js.map +0 -1
- package/dist/setup/codex.js +0 -10
- package/dist/setup/codex.js.map +0 -1
- package/dist/setup/opencode.js.map +0 -1
- package/dist/setup/opencodeConstants.js.map +0 -1
- package/dist/setup/sharedSkill.js.map +0 -1
- package/dist/setup/smokeChecks.js.map +0 -1
- package/dist/state/archiveDiscovery.js.map +0 -1
- package/dist/state/archivePublication.js.map +0 -1
- package/dist/state/archiveRecovery.js.map +0 -1
- package/dist/state/archiveReplay.js.map +0 -1
- package/dist/state/canonicalMigrationRecord.js.map +0 -1
- package/dist/state/changelog.js.map +0 -1
- package/dist/state/decisionEntities.js.map +0 -1
- package/dist/state/decisionLegacyValidation.js.map +0 -1
- package/dist/state/decisionMigrationProvenance.js.map +0 -1
- package/dist/state/decisionOverlay.js.map +0 -1
- package/dist/state/decisionRevision.js.map +0 -1
- package/dist/state/decisionRevisionMigration.js.map +0 -1
- package/dist/state/directRetrieval.js.map +0 -1
- package/dist/state/durability.js.map +0 -1
- package/dist/state/entityCutover.js.map +0 -1
- package/dist/state/entityCutoverGit.js.map +0 -1
- package/dist/state/entityGlossaryAuthority.js.map +0 -1
- package/dist/state/entityListProjection.js.map +0 -1
- package/dist/state/entityListRuntimeRegistry.js.map +0 -1
- package/dist/state/entityMigrationCausality.js.map +0 -1
- package/dist/state/entityMigrationIdentity.js.map +0 -1
- package/dist/state/entityMigrationPreview.js.map +0 -1
- package/dist/state/entityPublicationContext.js.map +0 -1
- package/dist/state/entityRetrievalHelp.js.map +0 -1
- package/dist/state/entityStorage.js.map +0 -1
- package/dist/state/exactReplacementRecovery.js.map +0 -1
- package/dist/state/experimentArchive.js.map +0 -1
- package/dist/state/experimentIdentity.js.map +0 -1
- package/dist/state/healthEntities.js.map +0 -1
- package/dist/state/healthEntityValidation.js.map +0 -1
- package/dist/state/healthRepair.js.map +0 -1
- package/dist/state/installRoot.js.map +0 -1
- package/dist/state/legacyEntityCutoverEvidence.js.map +0 -1
- package/dist/state/legacyIdentity.js.map +0 -1
- package/dist/state/legacySummaryRecord.js.map +0 -1
- package/dist/state/listAccounting.js.map +0 -1
- package/dist/state/listClassification.js.map +0 -1
- package/dist/state/listCursor.js.map +0 -1
- package/dist/state/listRetrieval.js.map +0 -1
- package/dist/state/migrationSourceBinding.js.map +0 -1
- package/dist/state/objectiveExperimentEntities.js.map +0 -1
- package/dist/state/planEntities.js.map +0 -1
- package/dist/state/planIdentity.js.map +0 -1
- package/dist/state/planRetrieval.js.map +0 -1
- package/dist/state/planTaskRetrieval.js.map +0 -1
- package/dist/state/progressEntities.js.map +0 -1
- package/dist/state/progressGlossaryCaveat.js.map +0 -1
- package/dist/state/progressPublicationOrder.js.map +0 -1
- package/dist/state/projectRoot.js.map +0 -1
- package/dist/state/projectionPolicy.js.map +0 -1
- package/dist/state/retrievalAuthority.js.map +0 -1
- package/dist/state/safeProjectFile.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/state/startupProjection.js.map +0 -1
- package/dist/state/stateMode.js.map +0 -1
- package/dist/state/stateStorageAuthority.js.map +0 -1
- package/dist/state/summaryEntityRead.js.map +0 -1
- package/dist/state/summaryMigrationProvenance.js.map +0 -1
- package/dist/state/summarySourceRowAuthority.js.map +0 -1
- package/dist/state/todoDocsEntities.js.map +0 -1
- package/dist/state/todoDocsEntityValidation.js.map +0 -1
- package/dist/state/todoReconciliationActivation.js.map +0 -1
- package/dist/state/todoReconciliationTransaction.js.map +0 -1
- package/dist/state/write/assign.js.map +0 -1
- package/dist/state/write/candidateMutation.js.map +0 -1
- package/dist/state/write/errors.js.map +0 -1
- package/dist/state/write/experimentPublication.js.map +0 -1
- package/dist/state/write/explain.js.map +0 -1
- package/dist/state/write/fields.js.map +0 -1
- package/dist/state/write/glossaryPublication.js.map +0 -1
- package/dist/state/write/grammar.js.map +0 -1
- package/dist/state/write/helpers.js.map +0 -1
- package/dist/state/write/index.js.map +0 -1
- package/dist/state/write/input.js.map +0 -1
- package/dist/state/write/lock.js.map +0 -1
- package/dist/state/write/mutation.js.map +0 -1
- package/dist/state/write/operations.js.map +0 -1
- package/dist/state/write/planEvaluation.js.map +0 -1
- package/dist/state/write/planPublication.js.map +0 -1
- package/dist/state/write/runtimeOperations.js.map +0 -1
- package/dist/state/write/serialize.js.map +0 -1
- package/dist/state/write/transaction.js.map +0 -1
- package/dist/state/write/validate.js.map +0 -1
- package/dist/upgrade/appContentRefresh.js.map +0 -1
- package/dist/upgrade/appModel.js.map +0 -1
- package/dist/upgrade/atomicWriter.js.map +0 -1
- package/dist/upgrade/bundleEvidence.js.map +0 -1
- package/dist/upgrade/channels.js.map +0 -1
- package/dist/upgrade/coexistenceProbe.js +0 -105
- 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/lifecycleUpgrade.js.map +0 -1
- package/dist/upgrade/migrateArtifactsV2ToV3.js.map +0 -1
- package/dist/upgrade/migrationPublication.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/upgradeLock.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/selfAudit.js.map +0 -1
- package/dist/validate/v1LegacyCruft.js.map +0 -1
- package/dist/validate/vocabularyAuthority.js.map +0 -1
|
@@ -18,8 +18,11 @@ import { parseTodoMarkdownListItem, renderTodoPublicRecord } from "../cli/todoMa
|
|
|
18
18
|
import { evaluateTodoReadinessQueue } from "../cli/todoReadinessSelection.js";
|
|
19
19
|
import { artifactSchemasDir, loadArtifactRecord, registryModelPath, resolveArtifactPath } from "../registries/artifactRegistry.js";
|
|
20
20
|
import { inspectTodoReconciliation, publishTodoReconciliation, recoverTodoReconciliation, todoCreateRequestSha256 } from "./todoReconciliationTransaction.js";
|
|
21
|
-
import { loadTodoReconciliationActivation, todoLegacyRowFingerprint, todoReconciliationActivationBytes, TODO_RECONCILIATION_ACTIVATION_PATH, TODO_RECONCILIATION_ITEM_LIMIT, } from "./todoReconciliationActivation.js";
|
|
21
|
+
import { loadTodoReconciliationActivation, todoLegacyRowFingerprint, todoReconciliationActivationBytes, TODO_RECONCILIATION_ACTIVATION_PATH, TODO_RECONCILIATION_ITEM_LIMIT, TODO_ACTIVATION_APPLY_COMMAND, TODO_ACTIVATION_PREVIEW_COMMAND, TODO_REPAIR_APPLY_COMMAND, TODO_REPAIR_PREVIEW_COMMAND, todoActivationEffect, todoRepairEffect, unchangedTodoActivationEffect, } from "./todoReconciliationActivation.js";
|
|
22
|
+
import { planTodoRepair } from "./todoReconciliationRepair.js";
|
|
23
|
+
import { readTodoMarkdown, renderManagedMarkdown } from "./todoMarkdownProjection.js";
|
|
22
24
|
const ID = /^[a-z]{10}$/;
|
|
25
|
+
const SHA256 = /^[a-f0-9]{64}$/;
|
|
23
26
|
const TODO = { artifact: "todo", boundary: "todo_item", order: "severity_then_status_then_markdown_order_then_id" };
|
|
24
27
|
const DOCS = { artifact: "docs", boundary: "documentation_inventory_entry", order: "path_then_id" };
|
|
25
28
|
function mapping(value) { return value !== null && typeof value === "object" && !Array.isArray(value); }
|
|
@@ -41,7 +44,7 @@ function failure(kind, artifact, message, recovery, id, exitCode = 1) {
|
|
|
41
44
|
const family = kind === "cursor_invalid" || kind === "cursor_snapshot_unavailable" ? entityListFamily(artifact) : undefined;
|
|
42
45
|
return new StateRetrievalFailure({ schemaVersion: "agentera.stateFailure.v1", status: "fail", error: { class: kind, message, syntax: family?.syntax ?? `agentera state ${artifact} get --id ID --format json`, example: family?.example ?? `agentera state ${artifact} get --id ${id ?? "qjtrmnpvka"} --format json`, recovery, artifact, ...(id ? { id } : {}) } }, exitCode);
|
|
43
46
|
}
|
|
44
|
-
function relevant(root, sourceRoot, artifact, supplied, sourceBinding) {
|
|
47
|
+
export function relevant(root, sourceRoot, artifact, supplied, sourceBinding) {
|
|
45
48
|
if (supplied)
|
|
46
49
|
assertEntityDiscoveryOrigin(root, sourceRoot, supplied);
|
|
47
50
|
const discovery = supplied ?? discoverEntities(root, sourceRoot, sourceBinding);
|
|
@@ -73,13 +76,13 @@ function assertState(root, sourceRoot, sourceBinding) {
|
|
|
73
76
|
function markdownSeverity(section) {
|
|
74
77
|
return section === "critical" || section === "degraded" || section === "normal" || section === "annoying" ? section : null;
|
|
75
78
|
}
|
|
76
|
-
function todoPublicPath(root, sourceRoot) {
|
|
79
|
+
export function todoPublicPath(root, sourceRoot) {
|
|
77
80
|
const todo = loadArtifactRecord("todo", artifactSchemasDir(sourceRoot), registryModelPath(sourceRoot));
|
|
78
81
|
if (!todo)
|
|
79
82
|
throw new Error("artifact registry is missing the canonical 'todo' record");
|
|
80
83
|
return resolveArtifactPath(todo, root, { strictWrite: true });
|
|
81
84
|
}
|
|
82
|
-
function todoReconciliationBinding(root, sourceRoot) {
|
|
85
|
+
export function todoReconciliationBinding(root, sourceRoot) {
|
|
83
86
|
const publicPath = relative(root, todoPublicPath(root, sourceRoot));
|
|
84
87
|
const docsRecord = loadArtifactRecord("docs", artifactSchemasDir(sourceRoot), registryModelPath(sourceRoot));
|
|
85
88
|
if (!docsRecord)
|
|
@@ -107,7 +110,6 @@ export function assertTodoReconciliationReadable(root, sourceRoot, id) {
|
|
|
107
110
|
throw failure("unsupported_state", "todo", `TODO reconciliation transaction '${pending[0]}' is pending; no mixed TODO state is readable`, "Retry the exact non-dry-run TODO mutation to complete recovery, then repeat this read.", id);
|
|
108
111
|
}
|
|
109
112
|
const RECONCILIATION_VERSION = "agentera.todoReconciliation.v1";
|
|
110
|
-
const TODO_MARKDOWN_MAX_BYTES = 1024 * 1024;
|
|
111
113
|
const TODO_DRIFT_ITEM_LIMIT = 20;
|
|
112
114
|
const PUBLIC_FIELDS = ["description", "severity", "status"];
|
|
113
115
|
function publicSnapshot(record, order) {
|
|
@@ -135,33 +137,7 @@ function todoAuthority() {
|
|
|
135
137
|
operational: { owner: "agentera", source: "canonical_entity_file", fields: ["readiness", "dependencies", "blocked", "gate", "evidence", "lifecycle"] },
|
|
136
138
|
};
|
|
137
139
|
}
|
|
138
|
-
function
|
|
139
|
-
if (!fs.existsSync(target))
|
|
140
|
-
return { bytes: Buffer.from(""), text: "" };
|
|
141
|
-
const stat = fs.lstatSync(target);
|
|
142
|
-
if (!stat.isFile() || stat.isSymbolicLink())
|
|
143
|
-
reject({
|
|
144
|
-
class: "conflict",
|
|
145
|
-
message: "managed TODO Markdown must be a regular file",
|
|
146
|
-
recovery: "Restore the docs-mapped TODO artifact as a regular file within the project and retry; no state was changed.",
|
|
147
|
-
});
|
|
148
|
-
if (stat.size > TODO_MARKDOWN_MAX_BYTES)
|
|
149
|
-
reject({
|
|
150
|
-
class: "conflict",
|
|
151
|
-
message: `managed TODO Markdown exceeds the ${TODO_MARKDOWN_MAX_BYTES}-byte reconciliation bound`,
|
|
152
|
-
recovery: "Compact unmanaged or resolved Markdown content below the declared bound and retry; no state was changed.",
|
|
153
|
-
});
|
|
154
|
-
const bytes = fs.readFileSync(target);
|
|
155
|
-
let text;
|
|
156
|
-
try {
|
|
157
|
-
text = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
158
|
-
}
|
|
159
|
-
catch {
|
|
160
|
-
reject({ class: "conflict", message: "managed TODO Markdown is not valid UTF-8", recovery: "Restore valid UTF-8 TODO Markdown and retry; no state was changed." });
|
|
161
|
-
}
|
|
162
|
-
return { bytes, text: text };
|
|
163
|
-
}
|
|
164
|
-
function managedRows(markdown, activation, entities) {
|
|
140
|
+
export function managedRows(markdown, activation, entities) {
|
|
165
141
|
const result = new Map();
|
|
166
142
|
const order = new Map();
|
|
167
143
|
const legacy = [];
|
|
@@ -169,7 +145,7 @@ function managedRows(markdown, activation, entities) {
|
|
|
169
145
|
markdown.split(/\r?\n/).forEach((line, index) => {
|
|
170
146
|
const heading = line.trim().match(/^##\s+(.+)$/)?.[1]?.toLowerCase();
|
|
171
147
|
if (heading)
|
|
172
|
-
section = heading.includes("critical") ? "critical" : heading.includes("degraded") ? "degraded" : heading.includes("annoying") ? "annoying" : heading.includes("resolved") ? "resolved" : heading.includes("normal") ? "normal" : null;
|
|
148
|
+
section = heading.includes("critical") ? "critical" : heading.includes("degraded") ? "degraded" : heading.includes("annoying") ? "annoying" : heading.includes("resolved") ? "resolved" : heading.includes("normal") ? "normal" : heading === "notes" ? null : section;
|
|
173
149
|
const item = parseTodoMarkdownListItem(line.trim());
|
|
174
150
|
if (!item)
|
|
175
151
|
return;
|
|
@@ -191,6 +167,8 @@ function managedRows(markdown, activation, entities) {
|
|
|
191
167
|
result.set(item.id, { ...row, id: item.id });
|
|
192
168
|
});
|
|
193
169
|
const retainedLegacyRows = [];
|
|
170
|
+
const matchedRows = result.size;
|
|
171
|
+
let convertedRows = 0;
|
|
194
172
|
if (activation) {
|
|
195
173
|
const retained = new Set(activation.retained_legacy_rows);
|
|
196
174
|
for (const row of legacy) {
|
|
@@ -236,6 +214,7 @@ function managedRows(markdown, activation, entities) {
|
|
|
236
214
|
if (matched?.id) {
|
|
237
215
|
claimed.add(matched.id);
|
|
238
216
|
result.set(matched.id, { ...row, id: matched.id });
|
|
217
|
+
convertedRows += 1;
|
|
239
218
|
continue;
|
|
240
219
|
}
|
|
241
220
|
const fingerprint = todoLegacyRowFingerprint(row.section, row.sourceLine);
|
|
@@ -254,13 +233,29 @@ function managedRows(markdown, activation, entities) {
|
|
|
254
233
|
message: `TODO.md exceeds the ${TODO_RECONCILIATION_ITEM_LIMIT}-item reconciliation or legacy-activation bound`,
|
|
255
234
|
recovery: `Compact retained resolved rows until each bounded set has at most ${TODO_RECONCILIATION_ITEM_LIMIT} items, then retry once; no state was changed.`,
|
|
256
235
|
});
|
|
257
|
-
return { rows: result, retainedLegacyRows };
|
|
236
|
+
return { rows: result, retainedLegacyRows, matchedRows, convertedRows };
|
|
258
237
|
}
|
|
259
238
|
function rowSnapshot(row, record) {
|
|
260
239
|
return { ...row.snapshot, severity: row.section === "resolved" ? String(record.severity) : row.snapshot.severity };
|
|
261
240
|
}
|
|
262
241
|
function inspectTodoReadView(root, sourceRoot, entities) {
|
|
263
|
-
|
|
242
|
+
let activation;
|
|
243
|
+
try {
|
|
244
|
+
activation = loadTodoReconciliationActivation(root)?.record ?? null;
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
return {
|
|
248
|
+
rows: new Map(),
|
|
249
|
+
drift: {
|
|
250
|
+
schema_version: RECONCILIATION_VERSION,
|
|
251
|
+
status: "invalid_lifecycle",
|
|
252
|
+
read_effect: "none",
|
|
253
|
+
authority: todoAuthority(),
|
|
254
|
+
counts: { managed: 0, drifted: 0, conflicts: 1 },
|
|
255
|
+
items: [],
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
}
|
|
264
259
|
if (!activation) {
|
|
265
260
|
return {
|
|
266
261
|
rows: new Map(),
|
|
@@ -274,10 +269,29 @@ function inspectTodoReadView(root, sourceRoot, entities) {
|
|
|
274
269
|
},
|
|
275
270
|
};
|
|
276
271
|
}
|
|
277
|
-
const markdownPath = todoPublicPath(root, sourceRoot);
|
|
278
|
-
const markdown = readTodoMarkdown(markdownPath).text;
|
|
279
272
|
const todoEntities = entities.filter(({ boundary }) => boundary === TODO.boundary);
|
|
280
|
-
|
|
273
|
+
let markdown;
|
|
274
|
+
let rows;
|
|
275
|
+
try {
|
|
276
|
+
markdown = readTodoMarkdown(todoPublicPath(root, sourceRoot)).text;
|
|
277
|
+
rows = managedRows(markdown, activation, todoEntities).rows;
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
if (error instanceof StateWriteInputError && /Markdown/i.test(error.body.message))
|
|
281
|
+
throw error;
|
|
282
|
+
return {
|
|
283
|
+
rows: new Map(),
|
|
284
|
+
drift: {
|
|
285
|
+
schema_version: RECONCILIATION_VERSION,
|
|
286
|
+
status: "unsafe",
|
|
287
|
+
read_effect: "none",
|
|
288
|
+
next_write_boundary: "atomic_reconciliation",
|
|
289
|
+
authority: todoAuthority(),
|
|
290
|
+
counts: { managed: 0, drifted: 0, conflicts: 1 },
|
|
291
|
+
items: [],
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
}
|
|
281
295
|
const items = [];
|
|
282
296
|
const entityIds = new Set();
|
|
283
297
|
for (const entity of todoEntities) {
|
|
@@ -391,46 +405,9 @@ function withBaseline(record, value) {
|
|
|
391
405
|
const publicValue = Object.fromEntries(Object.entries(value).filter(([, field]) => field !== undefined));
|
|
392
406
|
return { ...record, reconciliation: { schema_version: RECONCILIATION_VERSION, public: publicValue } };
|
|
393
407
|
}
|
|
394
|
-
function
|
|
395
|
-
function
|
|
396
|
-
function
|
|
397
|
-
function renderManagedMarkdown(markdown, records, existing) {
|
|
398
|
-
const byLine = new Map([...existing.values()].map((row) => [row.line, row]));
|
|
399
|
-
const retained = new Set();
|
|
400
|
-
const lines = markdown.split(/\r?\n/).flatMap((line, index) => {
|
|
401
|
-
const row = byLine.get(index);
|
|
402
|
-
if (!row)
|
|
403
|
-
return [line];
|
|
404
|
-
const record = records.get(row.id);
|
|
405
|
-
if (!record || sectionFor(record) !== row.section)
|
|
406
|
-
return [];
|
|
407
|
-
retained.add(row.id);
|
|
408
|
-
return [rowFor(row.id, record)];
|
|
409
|
-
});
|
|
410
|
-
for (const section of ["critical", "degraded", "normal", "annoying", "resolved"]) {
|
|
411
|
-
const ids = [...records.entries()].filter(([id, record]) => !retained.has(id) && sectionFor(record) === section).sort(([left], [right]) => {
|
|
412
|
-
const a = existing.get(left);
|
|
413
|
-
const b = existing.get(right);
|
|
414
|
-
return (a?.section === section ? a.snapshot.order : Number.MAX_SAFE_INTEGER) - (b?.section === section ? b.snapshot.order : Number.MAX_SAFE_INTEGER) || left.localeCompare(right);
|
|
415
|
-
}).map(([id]) => id);
|
|
416
|
-
if (!ids.length)
|
|
417
|
-
continue;
|
|
418
|
-
let heading = lines.findIndex((line) => line.trim().toLowerCase() === headingFor(section).toLowerCase());
|
|
419
|
-
if (heading < 0) {
|
|
420
|
-
if (lines.at(-1)?.trim())
|
|
421
|
-
lines.push("");
|
|
422
|
-
lines.push(headingFor(section));
|
|
423
|
-
heading = lines.length - 1;
|
|
424
|
-
}
|
|
425
|
-
let insert = heading + 1;
|
|
426
|
-
while (insert < lines.length && !/^##\s+/.test(lines[insert].trim()))
|
|
427
|
-
insert += 1;
|
|
428
|
-
while (insert > heading + 1 && !lines[insert - 1].trim())
|
|
429
|
-
insert -= 1;
|
|
430
|
-
lines.splice(insert, 0, ...ids.map((id) => rowFor(id, records.get(id))));
|
|
431
|
-
}
|
|
432
|
-
return `${lines.join("\n").replace(/\n*$/, "")}\n`;
|
|
433
|
-
}
|
|
408
|
+
function inactiveTodoMutation() { reject({ class: "conflict", message: "TODO reconciliation is inactive; ordinary TODO mutations cannot activate it implicitly", syntax: TODO_ACTIVATION_PREVIEW_COMMAND, example: TODO_ACTIVATION_APPLY_COMMAND, recovery: `Run exactly '${TODO_ACTIVATION_PREVIEW_COMMAND}', review every reported effect, then run exactly '${TODO_ACTIVATION_APPLY_COMMAND}'; no state was changed.` }); }
|
|
409
|
+
function activationEnvelope(effect, dryRun, replay, transactionId, targets, recovered) { return { schemaVersion: "agentera.stateWrite.v1", command: "state todo activate", status: "pass", path: TODO_RECONCILIATION_ACTIVATION_PATH, artifact: "todo", operation: { verb: "activate", dry_run: dryRun, idempotent_replay: replay }, validation: { status: "pass", violations: [] }, activation: effect, apply_command: TODO_ACTIVATION_APPLY_COMMAND.replace("EFFECT_SHA256", String(effect.effect_sha256)), reconciliation: { transaction_id: transactionId, targets, recovered } }; }
|
|
410
|
+
function repairEnvelope(effect, dryRun, replay, transactionId, targets, recovered) { return { schemaVersion: "agentera.stateWrite.v1", command: "state todo repair", status: "pass", path: TODO_RECONCILIATION_ACTIVATION_PATH, artifact: "todo", operation: { verb: "repair", dry_run: dryRun, idempotent_replay: replay }, validation: { status: "pass", violations: [] }, repair: effect, apply_command: TODO_REPAIR_APPLY_COMMAND.replace("EFFECT_SHA256", String(effect.effect_sha256)), reconciliation: { transaction_id: transactionId, targets, recovered } }; }
|
|
434
411
|
function envelope(command, entity, artifact, record, dryRun) {
|
|
435
412
|
return { schemaVersion: "agentera.stateWrite.v1", command, status: "pass", path: entity.path, id: entity.id, artifact, record, operation: { verb: command.split(" ").at(-1), dry_run: dryRun, idempotent_replay: entity.replay }, validation: { status: "pass", violations: [] } };
|
|
436
413
|
}
|
|
@@ -687,6 +664,20 @@ export function mutateTodoDocsEntity(req, options = {}) {
|
|
|
687
664
|
context.assertValid();
|
|
688
665
|
const todoBinding = artifact === "todo" ? todoReconciliationBinding(req.projectRoot, sourceRoot) : null;
|
|
689
666
|
const pending = todoBinding ? inspectTodoReconciliation(pinnedRoot, todoBinding) : [];
|
|
667
|
+
const initialActivation = artifact === "todo" ? loadTodoReconciliationActivation(pinnedRoot) : null;
|
|
668
|
+
if (artifact === "todo" && ["activate", "repair"].includes(req.spec.verb)) {
|
|
669
|
+
const repairing = req.spec.verb === "repair";
|
|
670
|
+
const previewCommand = repairing ? TODO_REPAIR_PREVIEW_COMMAND : TODO_ACTIVATION_PREVIEW_COMMAND;
|
|
671
|
+
const applyCommand = repairing ? TODO_REPAIR_APPLY_COMMAND : TODO_ACTIVATION_APPLY_COMMAND;
|
|
672
|
+
if (repairing && !initialActivation)
|
|
673
|
+
reject({ class: "conflict", message: "TODO repair requires an existing reconciliation activation marker", recovery: `Use '${TODO_ACTIVATION_PREVIEW_COMMAND}' for an inactive project; no state was changed.` });
|
|
674
|
+
if (req.dryRun && (req.values.confirmed === true || req.values.effect_sha256 !== undefined))
|
|
675
|
+
reject({ class: "mutually_exclusive", message: `TODO ${req.spec.verb} --dry-run cannot include apply confirmation`, recovery: `Run exactly '${previewCommand}' or the preview's exact apply_command; no state was changed.` });
|
|
676
|
+
if (!req.dryRun && (req.values.confirmed !== true || !SHA256.test(String(req.values.effect_sha256 ?? ""))))
|
|
677
|
+
reject({ class: "missing_argument", message: `TODO ${req.spec.verb} apply requires the preview effect SHA-256 and explicit --yes confirmation`, syntax: previewCommand, example: applyCommand, recovery: `Run exactly '${previewCommand}', review every reported effect, then run its exact apply_command; no state was changed.` });
|
|
678
|
+
}
|
|
679
|
+
else if (artifact === "todo" && !initialActivation)
|
|
680
|
+
inactiveTodoMutation();
|
|
690
681
|
if (req.dryRun && pending.length)
|
|
691
682
|
reject({ class: "conflict", message: `TODO reconciliation transaction '${pending[0]}' requires recovery before dry-run`, recovery: "Retry the exact TODO mutation without --dry-run once to complete recovery; this dry-run changed no state." });
|
|
692
683
|
const createRequest = artifact === "todo" && req.spec.verb === "create" ? mutationRecord(req, undefined) : null;
|
|
@@ -694,6 +685,7 @@ export function mutateTodoDocsEntity(req, options = {}) {
|
|
|
694
685
|
const recoveryReceipts = todoBinding && !req.dryRun
|
|
695
686
|
? recoverTodoReconciliation(context, sourceRoot, todoBinding, {
|
|
696
687
|
createRequestSha256,
|
|
688
|
+
...(["activate", "repair"].includes(req.spec.verb) ? { activationEffectSha256: String(req.values.effect_sha256) } : {}),
|
|
697
689
|
beforeCommit: () => assertState(pinnedRoot, sourceRoot, sourceBinding),
|
|
698
690
|
})
|
|
699
691
|
: [];
|
|
@@ -706,10 +698,7 @@ export function mutateTodoDocsEntity(req, options = {}) {
|
|
|
706
698
|
const recoveredCreate = recoveryReceipts.find((receipt) => receipt.create);
|
|
707
699
|
if (recoveredCreate?.create) {
|
|
708
700
|
const created = selectedById(entities, "todo", recoveredCreate.create.created_id);
|
|
709
|
-
return {
|
|
710
|
-
...envelope("state todo create", { id: created.id, path: created.path, replay: true }, "todo", created.record, false),
|
|
711
|
-
reconciliation: { transaction_id: recoveredCreate.transaction_id, targets: 0, recovered },
|
|
712
|
-
};
|
|
701
|
+
return { ...envelope("state todo create", { id: created.id, path: created.path, replay: true }, "todo", created.record, false), reconciliation: { transaction_id: recoveredCreate.transaction_id, targets: 0, recovered } };
|
|
713
702
|
}
|
|
714
703
|
const publicFile = todoPublicPath(pinnedRoot, sourceRoot);
|
|
715
704
|
const publicRelative = todoBinding.publicPath;
|
|
@@ -720,6 +709,96 @@ export function mutateTodoDocsEntity(req, options = {}) {
|
|
|
720
709
|
const todoEntities = entities.filter(({ boundary }) => boundary === TODO.boundary);
|
|
721
710
|
const loadedActivation = loadTodoReconciliationActivation(pinnedRoot);
|
|
722
711
|
const activation = loadedActivation?.record ?? null;
|
|
712
|
+
if (req.spec.verb === "activate") {
|
|
713
|
+
if (activation) {
|
|
714
|
+
const effect = unchangedTodoActivationEffect(publicRelative, markdownBefore, activation.retained_legacy_rows.length, activation.effect_sha256);
|
|
715
|
+
if (!req.dryRun && req.values.effect_sha256 !== effect.effect_sha256)
|
|
716
|
+
reject({ class: "conflict", message: "TODO activation replay does not match the authorized effect", recovery: `Use the exact apply_command returned by ${activation.effect_sha256 ? "the original activation preview" : "the active no-op preview"}; no state was changed.` });
|
|
717
|
+
return activationEnvelope(effect, req.dryRun, true, null, 0, recovered);
|
|
718
|
+
}
|
|
719
|
+
const scan = managedRows(markdown, null, todoEntities);
|
|
720
|
+
const rows = scan.rows;
|
|
721
|
+
const reconciled = reconcileTodoRecords(todoEntities, rows, true);
|
|
722
|
+
for (const [todoId, record] of reconciled.records) {
|
|
723
|
+
const violations = recordViolations("todo", record, sourceRoot);
|
|
724
|
+
if (violations.length)
|
|
725
|
+
reject({ class: "schema_violation", message: "todo entity input is invalid", violations });
|
|
726
|
+
if (record.readiness !== undefined)
|
|
727
|
+
assertTodoReferences(todoId, record, [...reconciled.records].map(([entityId, entityRecord]) => ({ boundary: TODO.boundary, id: entityId, record: entityRecord })));
|
|
728
|
+
}
|
|
729
|
+
const visibleRecords = new Map([...reconciled.records].filter(([todoId]) => reconciled.visible.has(todoId)));
|
|
730
|
+
const rendered = renderManagedMarkdown(markdown, visibleRecords, rows);
|
|
731
|
+
let activationBytesAfter = todoReconciliationActivationBytes(scan.retainedLegacyRows, "0".repeat(64));
|
|
732
|
+
const activationAfter = JSON.parse(activationBytesAfter);
|
|
733
|
+
const finalRows = managedRows(rendered, activationAfter, todoEntities).rows;
|
|
734
|
+
for (const [todoId, record] of reconciled.records) {
|
|
735
|
+
const row = finalRows.get(todoId);
|
|
736
|
+
reconciled.records.set(todoId, withBaseline(record, row ? rowSnapshot(row, record) : { present: false }));
|
|
737
|
+
}
|
|
738
|
+
const targets = todoEntities.map((entity) => ({ path: entity.relativePath, before: exactDiscoveredEntityBytes(entity), after: canonicalEntityEnvelopeBytes({ id: entity.id, artifact: "todo", record: reconciled.records.get(entity.id), migrationProvenance: entity.migrationProvenance ?? undefined }) }));
|
|
739
|
+
targets.push({ path: TODO_RECONCILIATION_ACTIVATION_PATH, before: null, after: activationBytesAfter });
|
|
740
|
+
targets.push({ path: publicRelative, before: publicExists ? markdownBefore : null, after: rendered });
|
|
741
|
+
const resurrectedIds = [...reconciled.visible].filter((todoId) => { const row = rows.get(todoId); return !row || (reconciled.records.get(todoId)?.status === "resolved" && !row.item.id); }).sort();
|
|
742
|
+
const preliminaryEffect = todoActivationEffect(scan, targets, publicRelative, markdownBefore, rendered, resurrectedIds);
|
|
743
|
+
activationBytesAfter = todoReconciliationActivationBytes(scan.retainedLegacyRows, String(preliminaryEffect.effect_sha256));
|
|
744
|
+
targets.find((target) => target.path === TODO_RECONCILIATION_ACTIVATION_PATH).after = activationBytesAfter;
|
|
745
|
+
const effect = todoActivationEffect(scan, targets, publicRelative, markdownBefore, rendered, resurrectedIds);
|
|
746
|
+
if (effect.effect_sha256 !== preliminaryEffect.effect_sha256)
|
|
747
|
+
throw new Error("TODO activation effect authorization is not self-consistent");
|
|
748
|
+
if (req.dryRun)
|
|
749
|
+
return activationEnvelope(effect, true, false, null, effect.targets.length, recovered);
|
|
750
|
+
if (req.values.effect_sha256 !== effect.effect_sha256)
|
|
751
|
+
reject({ class: "conflict", message: "TODO activation effects changed after preview", syntax: TODO_ACTIVATION_PREVIEW_COMMAND, example: TODO_ACTIVATION_APPLY_COMMAND, recovery: `Rerun exactly '${TODO_ACTIVATION_PREVIEW_COMMAND}', review the changed bounded effects, then run its new exact apply_command; no state was changed.` });
|
|
752
|
+
const transaction = publishTodoReconciliation(context, sourceRoot, todoBinding, targets, {
|
|
753
|
+
activationEffectSha256: String(effect.effect_sha256),
|
|
754
|
+
interruptAfterTarget: options.interruptAfterTarget,
|
|
755
|
+
beforeCommit: () => {
|
|
756
|
+
assertState(pinnedRoot, sourceRoot, sourceBinding);
|
|
757
|
+
const currentBinding = todoReconciliationBinding(req.projectRoot, sourceRoot);
|
|
758
|
+
if (currentBinding.publicPath !== todoBinding.publicPath || currentBinding.mappingSha256 !== todoBinding.mappingSha256)
|
|
759
|
+
reject({ class: "conflict", message: "TODO reconciliation mapping changed during activation publication", recovery: "Preserve the changed docs mapping and retry activation after every transaction target is restored; no mapping bytes were overwritten." });
|
|
760
|
+
},
|
|
761
|
+
});
|
|
762
|
+
context.assertValid();
|
|
763
|
+
return activationEnvelope(effect, false, false, transaction.id, transaction.targetCount, recovered);
|
|
764
|
+
}
|
|
765
|
+
if (req.spec.verb === "repair") {
|
|
766
|
+
if (!activation || !loadedActivation)
|
|
767
|
+
throw new Error("TODO repair lost its required activation marker");
|
|
768
|
+
const plan = planTodoRepair(markdown, activation, todoEntities);
|
|
769
|
+
let activationBytesAfter = todoReconciliationActivationBytes(plan.retainedLegacyRows, "0".repeat(64), "repair");
|
|
770
|
+
const targets = todoEntities.map((entity) => ({ path: entity.relativePath, before: exactDiscoveredEntityBytes(entity), after: canonicalEntityEnvelopeBytes({ id: entity.id, artifact: "todo", record: plan.records.get(entity.id), migrationProvenance: entity.migrationProvenance ?? undefined }) }));
|
|
771
|
+
targets.push({ path: TODO_RECONCILIATION_ACTIVATION_PATH, before: loadedActivation.bytes, after: activationBytesAfter });
|
|
772
|
+
targets.push({ path: publicRelative, before: publicExists ? markdownBefore : null, after: plan.rendered });
|
|
773
|
+
const substantiveChange = targets.some((target) => target.path !== TODO_RECONCILIATION_ACTIVATION_PATH && (target.before === null || !target.before.equals(Buffer.from(target.after))));
|
|
774
|
+
if (!req.dryRun && !substantiveChange && activation.effect_operation === "repair" && req.values.effect_sha256 === activation.effect_sha256) {
|
|
775
|
+
const replayEffect = todoRepairEffect(plan.diagnosis, [], publicRelative, markdownBefore, markdown);
|
|
776
|
+
replayEffect.effect_sha256 = activation.effect_sha256;
|
|
777
|
+
return repairEnvelope(replayEffect, false, true, null, 0, recovered);
|
|
778
|
+
}
|
|
779
|
+
const preliminaryEffect = todoRepairEffect(plan.diagnosis, targets, publicRelative, markdownBefore, plan.rendered);
|
|
780
|
+
activationBytesAfter = todoReconciliationActivationBytes(plan.retainedLegacyRows, String(preliminaryEffect.effect_sha256), "repair");
|
|
781
|
+
targets.find((target) => target.path === TODO_RECONCILIATION_ACTIVATION_PATH).after = activationBytesAfter;
|
|
782
|
+
const effect = todoRepairEffect(plan.diagnosis, targets, publicRelative, markdownBefore, plan.rendered);
|
|
783
|
+
if (effect.effect_sha256 !== preliminaryEffect.effect_sha256)
|
|
784
|
+
throw new Error("TODO repair effect authorization is not self-consistent");
|
|
785
|
+
if (req.dryRun)
|
|
786
|
+
return repairEnvelope(effect, true, false, null, effect.targets.length, recovered);
|
|
787
|
+
if (req.values.effect_sha256 !== effect.effect_sha256)
|
|
788
|
+
reject({ class: "conflict", message: "TODO repair effects changed after preview", syntax: TODO_REPAIR_PREVIEW_COMMAND, example: TODO_REPAIR_APPLY_COMMAND, recovery: `Rerun exactly '${TODO_REPAIR_PREVIEW_COMMAND}', review the changed bounded effects, then run its new exact apply_command; no state was changed.` });
|
|
789
|
+
const transaction = publishTodoReconciliation(context, sourceRoot, todoBinding, targets, {
|
|
790
|
+
activationEffectSha256: String(effect.effect_sha256),
|
|
791
|
+
interruptAfterTarget: options.interruptAfterTarget,
|
|
792
|
+
beforeCommit: () => {
|
|
793
|
+
assertState(pinnedRoot, sourceRoot, sourceBinding);
|
|
794
|
+
const currentBinding = todoReconciliationBinding(req.projectRoot, sourceRoot);
|
|
795
|
+
if (currentBinding.publicPath !== todoBinding.publicPath || currentBinding.mappingSha256 !== todoBinding.mappingSha256)
|
|
796
|
+
reject({ class: "conflict", message: "TODO reconciliation mapping changed during repair publication", recovery: "Preserve the changed docs mapping and retry repair after every transaction target is restored; no mapping bytes were overwritten." });
|
|
797
|
+
},
|
|
798
|
+
});
|
|
799
|
+
context.assertValid();
|
|
800
|
+
return repairEnvelope(effect, false, false, transaction.id, transaction.targetCount, recovered);
|
|
801
|
+
}
|
|
723
802
|
const activating = activation === null;
|
|
724
803
|
const scan = managedRows(markdown, activation, todoEntities);
|
|
725
804
|
const rows = scan.rows;
|
|
@@ -983,4 +1062,3 @@ export function listTodoDocsEntities(root, artifact, limit, cursor, filters = {}
|
|
|
983
1062
|
const response = () => { const remaining = selected.length - start - page.length; const next = remaining && page.length ? encodeListCursor({ snapshot_id: snap, order: definition(artifact).order, filters, selector: selectorKey, after: page.at(-1).id, ...(artifact === "todo" ? { limit: take } : {}) }, root, declared.authorityPath) : undefined; return { schemaVersion: "agentera.stateList.v1", command: `state ${artifact} list`, status: remaining ? "degraded" : "ok", entries: page.map((entity) => entry(root, entity, view?.rows.get(entity.id), queueRanks.get(entity.id), actionability.get(entity.id), view?.drift)), ...(view ? { reconciliation: view.drift } : {}), counts: { total: selected.length, returned: page.length, remaining }, order: definition(artifact).order, filters, snapshot: { id: snap, first_page: !cursor, has_more: Boolean(remaining), candidate_count: selected.length }, source: { artifact, authority: "canonical_entity_files", root: declared.entityRoot }, source_contract: { authority: "references/artifacts/state-storage-authority.yaml", detail: "full", cursor: "opaque_snapshot_cursor" }, retrieval: { ...(next ? { continue: `agentera state ${artifact} list${filterFlags}${selectorFlags} --limit ${take} --cursor ${next} --format json` } : {}) }, ...(remaining ? { omitted: true, omitted_count: remaining, omission_reason: "page_limit", next_cursor: next } : {}) }; };
|
|
984
1063
|
return projectEntityList(response(), selector, projectionOptions);
|
|
985
1064
|
}
|
|
986
|
-
//# sourceMappingURL=todoDocsEntities.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { renderTodoPublicRecord } from "../cli/todoMarkdown.js";
|
|
3
|
+
import { reject } from "./write/errors.js";
|
|
4
|
+
const TODO_MARKDOWN_MAX_BYTES = 1024 * 1024;
|
|
5
|
+
export function readTodoMarkdown(target) {
|
|
6
|
+
if (!fs.existsSync(target))
|
|
7
|
+
return { bytes: Buffer.from(""), text: "" };
|
|
8
|
+
const stat = fs.lstatSync(target);
|
|
9
|
+
if (!stat.isFile() || stat.isSymbolicLink())
|
|
10
|
+
reject({ class: "conflict", message: "managed TODO Markdown must be a regular file", recovery: "Restore the docs-mapped TODO artifact as a regular file within the project and retry; no state was changed." });
|
|
11
|
+
if (stat.size > TODO_MARKDOWN_MAX_BYTES)
|
|
12
|
+
reject({ class: "conflict", message: `managed TODO Markdown exceeds the ${TODO_MARKDOWN_MAX_BYTES}-byte reconciliation bound`, recovery: "Compact unmanaged or resolved Markdown content below the declared bound and retry; no state was changed." });
|
|
13
|
+
const bytes = fs.readFileSync(target);
|
|
14
|
+
let text;
|
|
15
|
+
try {
|
|
16
|
+
text = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
reject({ class: "conflict", message: "managed TODO Markdown is not valid UTF-8", recovery: "Restore valid UTF-8 TODO Markdown and retry; no state was changed." });
|
|
20
|
+
}
|
|
21
|
+
return { bytes, text: text };
|
|
22
|
+
}
|
|
23
|
+
function sectionFor(record) { return record.status === "resolved" ? "resolved" : String(record.severity); }
|
|
24
|
+
function headingFor(section) { return section === "resolved" ? "## ✓ Resolved" : `## → ${section[0].toUpperCase()}${section.slice(1)}`; }
|
|
25
|
+
function rowFor(id, record) { return `- [${record.status === "resolved" ? "x" : " "}] [id:${id}] ${renderTodoPublicRecord(record)}`; }
|
|
26
|
+
export function renderManagedMarkdown(markdown, records, existing) {
|
|
27
|
+
const byLine = new Map([...existing.values()].map((row) => [row.line, row]));
|
|
28
|
+
const retained = new Set();
|
|
29
|
+
const lines = markdown.split(/\r?\n/).flatMap((line, index) => { const row = byLine.get(index); if (!row)
|
|
30
|
+
return [line]; const record = records.get(row.id); if (!record || sectionFor(record) !== row.section)
|
|
31
|
+
return []; retained.add(row.id); return [rowFor(row.id, record)]; });
|
|
32
|
+
for (const section of ["critical", "degraded", "normal", "annoying", "resolved"]) {
|
|
33
|
+
const ids = [...records.entries()].filter(([id, record]) => !retained.has(id) && sectionFor(record) === section).sort(([left], [right]) => { const a = existing.get(left); const b = existing.get(right); return (a?.section === section ? a.snapshot.order : Number.MAX_SAFE_INTEGER) - (b?.section === section ? b.snapshot.order : Number.MAX_SAFE_INTEGER) || left.localeCompare(right); }).map(([id]) => id);
|
|
34
|
+
if (!ids.length)
|
|
35
|
+
continue;
|
|
36
|
+
let heading = lines.findIndex((line) => line.trim().toLowerCase() === headingFor(section).toLowerCase());
|
|
37
|
+
if (heading < 0) {
|
|
38
|
+
if (lines.at(-1)?.trim())
|
|
39
|
+
lines.push("");
|
|
40
|
+
lines.push(headingFor(section));
|
|
41
|
+
heading = lines.length - 1;
|
|
42
|
+
}
|
|
43
|
+
let insert = heading + 1;
|
|
44
|
+
while (insert < lines.length && !/^##\s+/.test(lines[insert].trim()))
|
|
45
|
+
insert += 1;
|
|
46
|
+
while (insert > heading + 1 && !lines[insert - 1].trim())
|
|
47
|
+
insert -= 1;
|
|
48
|
+
lines.splice(insert, 0, ...ids.map((id) => rowFor(id, records.get(id))));
|
|
49
|
+
}
|
|
50
|
+
return `${lines.join("\n").replace(/\n*$/, "")}\n`;
|
|
51
|
+
}
|
|
@@ -2,11 +2,18 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { reject } from "./write/errors.js";
|
|
5
|
+
import { CANONICAL_DEVELOPMENT_CLI } from "../core/developmentChannel.js";
|
|
6
|
+
import { canonicalRecordJson } from "./archiveDiscovery.js";
|
|
5
7
|
export const TODO_RECONCILIATION_ACTIVATION_PATH = ".agentera/todo-reconciliation-activation.json";
|
|
6
8
|
export const TODO_RECONCILIATION_ACTIVATION_VERSION = "agentera.todoReconciliationActivation.v1";
|
|
7
9
|
export const TODO_RECONCILIATION_ITEM_LIMIT = 256;
|
|
8
10
|
const MAX_ACTIVATION_BYTES = 32 * 1024;
|
|
9
11
|
const SHA256 = /^[a-f0-9]{64}$/;
|
|
12
|
+
export const TODO_ACTIVATION_PREVIEW_COMMAND = `${CANONICAL_DEVELOPMENT_CLI} state todo activate --dry-run --format json`;
|
|
13
|
+
export const TODO_ACTIVATION_APPLY_COMMAND = `${CANONICAL_DEVELOPMENT_CLI} state todo activate --effect-sha256 EFFECT_SHA256 --yes --format json`;
|
|
14
|
+
export const TODO_REPAIR_PREVIEW_COMMAND = `${CANONICAL_DEVELOPMENT_CLI} state todo repair --dry-run --format json`;
|
|
15
|
+
export const TODO_REPAIR_APPLY_COMMAND = `${CANONICAL_DEVELOPMENT_CLI} state todo repair --effect-sha256 EFFECT_SHA256 --yes --format json`;
|
|
16
|
+
const CHANGE_LIMIT = 20;
|
|
10
17
|
function activationFailure(message) {
|
|
11
18
|
reject({
|
|
12
19
|
class: "conflict",
|
|
@@ -17,15 +24,19 @@ function activationFailure(message) {
|
|
|
17
24
|
export function todoLegacyRowFingerprint(section, line) {
|
|
18
25
|
return createHash("sha256").update(section).update("\0").update(line).digest("hex");
|
|
19
26
|
}
|
|
20
|
-
export function todoReconciliationActivationBytes(retainedLegacyRows) {
|
|
27
|
+
export function todoReconciliationActivationBytes(retainedLegacyRows, effectSha256, effectOperation = "activate") {
|
|
21
28
|
const retained = [...retainedLegacyRows].sort();
|
|
22
29
|
if (retained.length > TODO_RECONCILIATION_ITEM_LIMIT
|
|
23
30
|
|| new Set(retained).size !== retained.length
|
|
24
31
|
|| retained.some((digest) => !SHA256.test(digest)))
|
|
25
32
|
activationFailure("TODO reconciliation activation has invalid retained legacy-row identities");
|
|
33
|
+
if (effectSha256 !== undefined && !SHA256.test(effectSha256))
|
|
34
|
+
activationFailure("TODO reconciliation activation has an invalid effect authorization");
|
|
26
35
|
return `${JSON.stringify({
|
|
27
36
|
schema_version: TODO_RECONCILIATION_ACTIVATION_VERSION,
|
|
28
37
|
retained_legacy_rows: retained,
|
|
38
|
+
...(effectSha256 ? { effect_sha256: effectSha256 } : {}),
|
|
39
|
+
...(effectSha256 ? { effect_operation: effectOperation } : {}),
|
|
29
40
|
})}\n`;
|
|
30
41
|
}
|
|
31
42
|
export function loadTodoReconciliationActivation(root) {
|
|
@@ -51,13 +62,71 @@ export function loadTodoReconciliationActivation(root) {
|
|
|
51
62
|
activationFailure("TODO reconciliation activation is not a mapping");
|
|
52
63
|
}
|
|
53
64
|
const record = value;
|
|
54
|
-
if (Object.keys(record).sort().join(",")
|
|
65
|
+
if (!["retained_legacy_rows,schema_version", "effect_operation,effect_sha256,retained_legacy_rows,schema_version", "effect_sha256,retained_legacy_rows,schema_version"].includes(Object.keys(record).sort().join(","))
|
|
55
66
|
|| record.schema_version !== TODO_RECONCILIATION_ACTIVATION_VERSION
|
|
56
67
|
|| !Array.isArray(record.retained_legacy_rows)
|
|
57
68
|
|| record.retained_legacy_rows.length > TODO_RECONCILIATION_ITEM_LIMIT
|
|
58
69
|
|| record.retained_legacy_rows.some((digest) => typeof digest !== "string" || !SHA256.test(digest))
|
|
59
|
-
|| new Set(record.retained_legacy_rows).size !== record.retained_legacy_rows.length
|
|
70
|
+
|| new Set(record.retained_legacy_rows).size !== record.retained_legacy_rows.length
|
|
71
|
+
|| (record.effect_sha256 !== undefined && (typeof record.effect_sha256 !== "string" || !SHA256.test(record.effect_sha256)))
|
|
72
|
+
|| (record.effect_operation !== undefined && !["activate", "repair"].includes(record.effect_operation)))
|
|
60
73
|
activationFailure("TODO reconciliation activation has an invalid canonical record");
|
|
61
74
|
return { record: record, bytes };
|
|
62
75
|
}
|
|
63
|
-
|
|
76
|
+
function sha256(bytes) { return createHash("sha256").update(bytes).digest("hex"); }
|
|
77
|
+
function boundedPublicChanges(before, after) {
|
|
78
|
+
const beforeLines = before.split(/\r?\n/);
|
|
79
|
+
const afterLines = after.split(/\r?\n/);
|
|
80
|
+
const changes = [];
|
|
81
|
+
let count = 0;
|
|
82
|
+
for (let index = 0; index < Math.max(beforeLines.length, afterLines.length); index += 1) {
|
|
83
|
+
if (beforeLines[index] === afterLines[index])
|
|
84
|
+
continue;
|
|
85
|
+
count += 1;
|
|
86
|
+
if (changes.length < CHANGE_LIMIT)
|
|
87
|
+
changes.push({ line: index + 1, before: (beforeLines[index] ?? "").slice(0, 240), after: (afterLines[index] ?? "").slice(0, 240) });
|
|
88
|
+
}
|
|
89
|
+
return { count, items: changes, omitted_count: count - changes.length };
|
|
90
|
+
}
|
|
91
|
+
export function todoActivationEffect(scan, targets, publicPath, markdownBefore, rendered, resurrectedIds) {
|
|
92
|
+
const changedTargets = targets.filter((target) => target.before === null || !target.before.equals(Buffer.from(target.after))).map((target) => ({ path: target.path, before_sha256: target.before === null ? null : sha256(target.before), after_sha256: sha256(target.after) }));
|
|
93
|
+
const evidence = {
|
|
94
|
+
counts: { matched: scan.matchedRows, converted: scan.convertedRows, retained: scan.retainedLegacyRows.length, conflicting: 0 }, targets: changedTargets,
|
|
95
|
+
public_document: { path: publicPath, changed: !markdownBefore.equals(Buffer.from(rendered)), before_bytes: markdownBefore.length, after_bytes: Buffer.byteLength(rendered), before_sha256: sha256(markdownBefore), after_sha256: sha256(rendered), changed_lines: boundedPublicChanges(markdownBefore.toString("utf8"), rendered) },
|
|
96
|
+
risks: { resurrected_count: resurrectedIds.length, resurrected_ids: resurrectedIds.slice(0, CHANGE_LIMIT), omitted_count: Math.max(0, resurrectedIds.length - CHANGE_LIMIT) },
|
|
97
|
+
};
|
|
98
|
+
const authorizedTargets = changedTargets.map((target) => target.path === TODO_RECONCILIATION_ACTIVATION_PATH ? { ...target, after_sha256: "activation_effect_authorization" } : target);
|
|
99
|
+
return { ...evidence, effect_sha256: sha256(canonicalRecordJson({ ...evidence, targets: authorizedTargets })) };
|
|
100
|
+
}
|
|
101
|
+
export function unchangedTodoActivationEffect(publicPath, markdown, retained, authorizedEffectSha256) {
|
|
102
|
+
const evidence = { counts: { matched: 0, converted: 0, retained, conflicting: 0 }, targets: [], public_document: { path: publicPath, changed: false, before_bytes: markdown.length, after_bytes: markdown.length, before_sha256: sha256(markdown), after_sha256: sha256(markdown), changed_lines: { count: 0, items: [], omitted_count: 0 } }, risks: { resurrected_count: 0, resurrected_ids: [], omitted_count: 0 } };
|
|
103
|
+
return { ...evidence, effect_sha256: authorizedEffectSha256 ?? sha256(canonicalRecordJson(evidence)) };
|
|
104
|
+
}
|
|
105
|
+
export function todoRepairEffect(diagnosis, targets, publicPath, markdownBefore, rendered) {
|
|
106
|
+
const changedTargets = targets
|
|
107
|
+
.filter((target) => target.before === null || !target.before.equals(Buffer.from(target.after)))
|
|
108
|
+
.map((target) => ({ path: target.path, before_sha256: target.before === null ? null : sha256(target.before), after_sha256: sha256(target.after) }));
|
|
109
|
+
const evidence = {
|
|
110
|
+
diagnosis,
|
|
111
|
+
targets: changedTargets,
|
|
112
|
+
public_document: {
|
|
113
|
+
path: publicPath,
|
|
114
|
+
changed: !markdownBefore.equals(Buffer.from(rendered)),
|
|
115
|
+
before_bytes: markdownBefore.length,
|
|
116
|
+
after_bytes: Buffer.byteLength(rendered),
|
|
117
|
+
before_sha256: sha256(markdownBefore),
|
|
118
|
+
after_sha256: sha256(rendered),
|
|
119
|
+
changed_lines: boundedPublicChanges(markdownBefore.toString("utf8"), rendered),
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
const activationTarget = targets.find((target) => target.path === TODO_RECONCILIATION_ACTIVATION_PATH);
|
|
123
|
+
let normalizedActivationSha256 = null;
|
|
124
|
+
if (activationTarget) {
|
|
125
|
+
const parsed = JSON.parse(activationTarget.after);
|
|
126
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed) || typeof parsed.effect_sha256 !== "string")
|
|
127
|
+
throw new Error("TODO repair activation target cannot be normalized for effect authorization");
|
|
128
|
+
normalizedActivationSha256 = sha256(canonicalRecordJson({ ...parsed, effect_sha256: "activation_effect_authorization" }));
|
|
129
|
+
}
|
|
130
|
+
const authorizedTargets = changedTargets.map((target) => target.path === TODO_RECONCILIATION_ACTIVATION_PATH ? { ...target, after_sha256: normalizedActivationSha256 } : target);
|
|
131
|
+
return { ...evidence, effect_sha256: sha256(canonicalRecordJson({ ...evidence, targets: authorizedTargets })) };
|
|
132
|
+
}
|