agentera 3.0.0-dev.8 → 3.0.0-dev.81
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 +252 -22
- package/bundle/.agentera-build-source.json +8 -0
- package/bundle/CHANGELOG.md +1389 -0
- package/bundle/DESIGN.md +229 -0
- package/bundle/LICENSE +201 -0
- package/bundle/README.md +142 -0
- package/bundle/UPGRADE.md +275 -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 +443 -188
- package/bundle/references/adapters/package-surface-characterization.md +68 -34
- package/bundle/references/adapters/product-v1-reset.yaml +101 -0
- 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 +357 -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 +262 -0
- package/bundle/references/artifacts/artifact-registry-interface-model.yaml +17 -8
- package/bundle/references/artifacts/glossary-entry-contract.yaml +2906 -0
- package/bundle/references/artifacts/state-storage-authority.yaml +3075 -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 +7 -5
- package/bundle/references/cli/vocabulary-index.yaml +7 -9
- package/bundle/references/cli/vocabulary.md +54 -97
- package/bundle/references/meta/retained-reference-authority.yaml +171 -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 +29 -30
- package/bundle/skills/agentera/schemas/artifacts/design.yaml +1 -0
- package/bundle/skills/agentera/schemas/artifacts/docs.yaml +7 -43
- package/bundle/skills/agentera/schemas/artifacts/experiments.yaml +140 -34
- package/bundle/skills/agentera/schemas/artifacts/glossary.yaml +87 -0
- package/bundle/skills/agentera/schemas/artifacts/health.yaml +53 -51
- package/bundle/skills/agentera/schemas/artifacts/objective.yaml +18 -35
- package/bundle/skills/agentera/schemas/artifacts/plan.yaml +453 -55
- package/bundle/skills/agentera/schemas/artifacts/progress.yaml +128 -39
- package/bundle/skills/agentera/schemas/artifacts/todo.yaml +305 -7
- package/bundle/skills/agentera/schemas/artifacts/vision.yaml +0 -19
- 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 +788 -0
- package/dist/analytics/personalGlossaryCandidateProjectionExcerpts.js +144 -0
- package/dist/analytics/personalGlossaryCandidateProjectionModel.js +1 -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/personalGlossaryRefreshProjection.js +351 -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 +52 -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 +162 -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 +755 -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 +338 -0
- package/dist/cli/commands/prime/collectOrientationState.js +124 -68
- package/dist/cli/commands/prime/orientationOutput.js +271 -59
- package/dist/cli/commands/prime/types.js +0 -1
- package/dist/cli/commands/prime.js +89 -11
- package/dist/cli/commands/profileGrounding.js +55 -0
- package/dist/cli/commands/query.js +74 -52
- package/dist/cli/commands/report.js +187 -27
- 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 +459 -0
- package/dist/cli/commands/upgrade.js +176 -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 +84 -52
- package/dist/cli/dispatch/lifecycle.js +182 -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 +419 -41
- package/dist/cli/migrationRequired.js +125 -0
- package/dist/cli/orientation/attention.js +19 -22
- 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/productV1Eol.js +55 -0
- package/dist/cli/profileAcquisition.js +167 -0
- package/dist/cli/startupCompletenessContract.js +11 -9
- 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 +145 -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 +345 -0
- package/dist/registries/glossaryCandidateProjectionContract.js +108 -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 +168 -11
- 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 +618 -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 +894 -0
- package/dist/state/entityWriterLock.js +18 -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/todoCreateBatch.js +69 -0
- package/dist/state/todoDocsEntities.js +1339 -0
- package/dist/state/todoDocsEntityValidation.js +158 -0
- package/dist/state/todoMarkdownProjection.js +63 -0
- package/dist/state/todoReconciliationActivation.js +182 -0
- package/dist/state/todoReconciliationInspection.js +184 -0
- package/dist/state/todoReconciliationRepair.js +320 -0
- package/dist/state/todoReconciliationTransaction.js +628 -0
- package/dist/state/todoSeverityHeadings.js +71 -0
- package/dist/state/todoTransitionBatch.js +65 -0
- package/dist/state/todoUpdateBatch.js +50 -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 +380 -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 +133 -34
- package/dist/upgrade/lifecycleUpgrade.js +126 -0
- package/dist/upgrade/migrateArtifactsV2ToV3.js +325 -82
- package/dist/upgrade/migrationPublication.js +122 -0
- package/dist/upgrade/nextMajorDoctor.js +0 -22
- package/dist/upgrade/npxPlatformStatus.js +2 -2
- package/dist/upgrade/productV1Reset.js +515 -0
- package/dist/upgrade/productV1ResetAuthority.js +139 -0
- package/dist/upgrade/projectIntegration.js +126 -134
- package/dist/upgrade/projectIntegrationDecision.js +21 -13
- package/dist/upgrade/retiredResourceDiagnostics.js +117 -0
- package/dist/upgrade/runtimeMigration.js +210 -430
- package/dist/upgrade/upgradeCommands.js +14 -1
- package/dist/upgrade/upgradeLock.js +85 -0
- package/dist/upgrade/upgradeOrchestrator.js +257 -48
- 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/glossaryVariantGuard.js +96 -0
- package/dist/validate/retainedReferenceAuthority.js +879 -0
- package/dist/validate/selfAudit.js +39 -45
- 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/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/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/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/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/types.js.map +0 -1
- package/dist/cli/commands/prime/v1Migration.js +0 -39
- 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/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/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/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 -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/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/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/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/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/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
|
@@ -11,58 +11,202 @@
|
|
|
11
11
|
* runtime these fields are always strings.
|
|
12
12
|
*/
|
|
13
13
|
import fs from "node:fs";
|
|
14
|
+
import path from "node:path";
|
|
14
15
|
import YAML from "yaml";
|
|
15
16
|
import { loadYamlMapping } from "../../core/yaml.js";
|
|
16
17
|
import { MAX_FULL_ENTRIES, MAX_ONELINE_ENTRIES, MAX_TOTAL_ENTRIES, applyRetentionCaps } from "../common.js";
|
|
17
18
|
import { COMPACTABLE_YAML_ARTIFACTS, SPECS, YAML_SPEC_BY_ARTIFACT, formatTodoOneline } from "./dryRun.js";
|
|
18
|
-
import {
|
|
19
|
-
import { normalizeTodoResolvedLayout, parseEntries, parseTodoResolved, extractResolvedSection } from "./parse.js";
|
|
20
|
-
|
|
19
|
+
import { decisionRequiresUserReview, selectDecisionActiveEntries, selectDecisionArchiveEntries, stableSortBy, yamlArchiveEntry, yamlEntryNumber, yamlRecentFullAndOlder, yamlSortEntries, } from "./retention.js";
|
|
20
|
+
import { normalizeTodoResolvedLayout, parseEntries, parseTodoResolved, extractResolvedSection, countTodoResolvedSectionHeadings, countTodoPendingSummarization, TODO_DROPPED_RECOVERY_GUIDANCE } from "./parse.js";
|
|
21
|
+
import { hydrateDecisionRecords } from "../../state/decisionOverlay.js";
|
|
22
|
+
import { gateProjectionEntries } from "../../state/archiveRecovery.js";
|
|
23
|
+
import { loadProjectionPolicy, projectionOmission, } from "../../state/projectionPolicy.js";
|
|
24
|
+
function restoreRawSatisfaction(selected, rawEntries) {
|
|
25
|
+
return selected.map((entry) => {
|
|
26
|
+
const raw = rawEntries.find((candidate) => yamlEntryNumber(candidate) === yamlEntryNumber(entry));
|
|
27
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
28
|
+
return entry;
|
|
29
|
+
const restored = { ...entry };
|
|
30
|
+
if ("satisfaction" in raw)
|
|
31
|
+
restored.satisfaction = raw.satisfaction;
|
|
32
|
+
else
|
|
33
|
+
delete restored.satisfaction;
|
|
34
|
+
return restored;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function existingOmissionCount(data) {
|
|
38
|
+
const count = data.omitted_count;
|
|
39
|
+
return typeof count === "number" && Number.isSafeInteger(count) && count > 0 ? count : 0;
|
|
40
|
+
}
|
|
41
|
+
function archiveProjectionCandidates(specName, rawArchive, generatedArchive, summaryCapacity) {
|
|
42
|
+
// Inline summaries have no independently verified complete record. They
|
|
43
|
+
// participate in the same bounded projection as verified summaries, but
|
|
44
|
+
// their omission explicitly remains degraded legacy history.
|
|
45
|
+
const candidates = [
|
|
46
|
+
...rawArchive.map((entry) => ({ entry, source: "legacy_summary", index: 0 })),
|
|
47
|
+
...generatedArchive.map((entry) => ({ entry, source: "archive", index: 1 })),
|
|
48
|
+
];
|
|
49
|
+
const ordered = candidates.sort((left, right) => {
|
|
50
|
+
const leftTimestamp = String(left.entry?.timestamp ?? left.entry?.date ?? "");
|
|
51
|
+
const rightTimestamp = String(right.entry?.timestamp ?? right.entry?.date ?? "");
|
|
52
|
+
if (leftTimestamp !== rightTimestamp)
|
|
53
|
+
return leftTimestamp < rightTimestamp ? 1 : -1;
|
|
54
|
+
const leftNumber = yamlEntryNumber(left.entry);
|
|
55
|
+
const rightNumber = yamlEntryNumber(right.entry);
|
|
56
|
+
if (leftNumber !== rightNumber)
|
|
57
|
+
return rightNumber - leftNumber;
|
|
58
|
+
return left.index - right.index;
|
|
59
|
+
});
|
|
60
|
+
const reviewFirst = specName === "decisions"
|
|
61
|
+
? [
|
|
62
|
+
...ordered.filter((candidate) => decisionRequiresUserReview(candidate.entry)),
|
|
63
|
+
...ordered.filter((candidate) => !decisionRequiresUserReview(candidate.entry)),
|
|
64
|
+
]
|
|
65
|
+
: ordered;
|
|
66
|
+
const retained = reviewFirst.slice(0, summaryCapacity);
|
|
67
|
+
const omitted = reviewFirst.slice(summaryCapacity);
|
|
68
|
+
const provenance = [];
|
|
69
|
+
for (const source of ["legacy_summary", "archive"]) {
|
|
70
|
+
const omittedCount = omitted.filter((candidate) => candidate.source === source).length;
|
|
71
|
+
if (omittedCount === 0)
|
|
72
|
+
continue;
|
|
73
|
+
provenance.push({
|
|
74
|
+
source,
|
|
75
|
+
detail_availability: source === "legacy_summary" ? "unavailable" : "full",
|
|
76
|
+
compatibility: source === "legacy_summary" ? "degraded" : "complete",
|
|
77
|
+
archive_verified: source === "archive",
|
|
78
|
+
omitted_count: omittedCount,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
archive: yamlSortEntries(retained.map((candidate) => candidate.entry), specName),
|
|
83
|
+
omitted: omitted.length,
|
|
84
|
+
provenance,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function existingOmissionProvenance(data) {
|
|
88
|
+
const raw = data.omission_provenance;
|
|
89
|
+
const values = Array.isArray(raw) ? raw : raw && typeof raw === "object" ? [raw] : [];
|
|
90
|
+
return values.filter((entry) => Boolean(entry && typeof entry === "object" && !Array.isArray(entry)));
|
|
91
|
+
}
|
|
92
|
+
export function compactYamlBytes(bytes, artifact, projectRoot) {
|
|
21
93
|
if (!(artifact in COMPACTABLE_YAML_ARTIFACTS)) {
|
|
22
94
|
throw new Error(`unsupported YAML artifact: ${artifact}`);
|
|
23
95
|
}
|
|
24
|
-
if (!fs.existsSync(p)) {
|
|
25
|
-
throw new Error(p);
|
|
26
|
-
}
|
|
27
96
|
const [activeKey, archiveKey] = COMPACTABLE_YAML_ARTIFACTS[artifact];
|
|
28
97
|
const specName = YAML_SPEC_BY_ARTIFACT[artifact];
|
|
29
|
-
const data = loadYamlMapping(
|
|
98
|
+
const data = loadYamlMapping(bytes);
|
|
30
99
|
let active = data[activeKey] || [];
|
|
31
100
|
let archive = data[archiveKey] || [];
|
|
32
101
|
if (!Array.isArray(active))
|
|
33
102
|
active = [];
|
|
34
103
|
if (!Array.isArray(archive))
|
|
35
104
|
archive = [];
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
105
|
+
const rawActive = active;
|
|
106
|
+
const rawArchive = archive;
|
|
107
|
+
const policy = loadProjectionPolicy();
|
|
108
|
+
const selectionActive = specName === "decisions" && projectRoot
|
|
109
|
+
? hydrateDecisionRecords(rawActive, projectRoot)
|
|
110
|
+
: rawActive;
|
|
111
|
+
const fullBefore = rawActive.length;
|
|
112
|
+
const onelineBefore = rawArchive.length;
|
|
113
|
+
if (fullBefore <= policy.activeEntries && onelineBefore <= policy.summaryEntries && fullBefore + onelineBefore <= policy.totalEntries) {
|
|
114
|
+
return {
|
|
115
|
+
bytes,
|
|
116
|
+
result: {
|
|
117
|
+
full_before: fullBefore,
|
|
118
|
+
oneline_before: onelineBefore,
|
|
119
|
+
full_after: fullBefore,
|
|
120
|
+
oneline_after: onelineBefore,
|
|
121
|
+
dropped: 0,
|
|
122
|
+
omitted_count: 0,
|
|
123
|
+
changed: false,
|
|
124
|
+
},
|
|
125
|
+
};
|
|
40
126
|
}
|
|
41
127
|
let recentFull;
|
|
42
128
|
let olderActive;
|
|
43
129
|
if (specName === "decisions") {
|
|
44
|
-
[
|
|
130
|
+
const [selectedRecent, selectedOlder] = selectDecisionActiveEntries(selectionActive, policy.activeEntries);
|
|
131
|
+
recentFull = restoreRawSatisfaction(selectedRecent, rawActive);
|
|
132
|
+
olderActive = restoreRawSatisfaction(selectedOlder, rawActive);
|
|
45
133
|
}
|
|
46
134
|
else {
|
|
47
|
-
[recentFull, olderActive] = yamlRecentFullAndOlder(
|
|
135
|
+
[recentFull, olderActive] = yamlRecentFullAndOlder(rawActive, specName, policy.activeEntries);
|
|
48
136
|
}
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
137
|
+
const projectionRoot = projectRoot ?? process.cwd();
|
|
138
|
+
// Experiment summaries are the pre-existing 10/40/50 projection itself.
|
|
139
|
+
// Durable experiment archives are introduced separately; publication must
|
|
140
|
+
// not silently disable the current projection while that policy is pending.
|
|
141
|
+
const gated = specName === "experiments"
|
|
142
|
+
? {
|
|
143
|
+
verified: olderActive,
|
|
144
|
+
refused: [],
|
|
145
|
+
recovery: {
|
|
146
|
+
status: "unsupported",
|
|
147
|
+
attempted: olderActive.length,
|
|
148
|
+
verified: 0,
|
|
149
|
+
retained_full: 0,
|
|
150
|
+
refused_count: 0,
|
|
151
|
+
refusals: [],
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
: gateProjectionEntries(projectionRoot, specName, olderActive);
|
|
155
|
+
const compactedFromActive = gated.verified.map((entry) => yamlArchiveEntry(specName, entry));
|
|
156
|
+
const retainedFull = gated.refused.map(({ entry }) => entry);
|
|
157
|
+
recentFull = yamlSortEntries([...recentFull, ...retainedFull], specName);
|
|
158
|
+
const archiveProjection = archiveProjectionCandidates(specName, rawArchive, compactedFromActive, policy.summaryEntries);
|
|
159
|
+
let archiveAfter = archiveProjection.archive;
|
|
52
160
|
if (specName === "decisions") {
|
|
53
|
-
|
|
161
|
+
const selectionArchiveCandidates = projectRoot
|
|
162
|
+
? hydrateDecisionRecords(archiveAfter, projectRoot)
|
|
163
|
+
: archiveAfter;
|
|
164
|
+
archiveAfter = restoreRawSatisfaction(selectDecisionArchiveEntries(selectionArchiveCandidates), archiveAfter);
|
|
54
165
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
166
|
+
const omittedCount = existingOmissionCount(data) + archiveProjection.omitted;
|
|
167
|
+
if (omittedCount > 0) {
|
|
168
|
+
Object.assign(data, projectionOmission(specName, omittedCount, "projection_capacity", {
|
|
169
|
+
forceOmitted: true,
|
|
170
|
+
provenance: [...existingOmissionProvenance(data), ...archiveProjection.provenance],
|
|
171
|
+
}));
|
|
58
172
|
}
|
|
59
173
|
data[activeKey] = recentFull;
|
|
60
|
-
|
|
61
|
-
|
|
174
|
+
if (archiveAfter.length > 0 || archiveKey in data || compactedFromActive.length > 0) {
|
|
175
|
+
data[archiveKey] = archiveAfter;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
delete data[archiveKey];
|
|
179
|
+
}
|
|
180
|
+
const compactedBytes = YAML.stringify(data);
|
|
62
181
|
const fullAfter = recentFull.length;
|
|
63
182
|
const onelineAfter = archiveAfter.length;
|
|
64
|
-
|
|
65
|
-
|
|
183
|
+
// A projection may omit detail only after its complete numbered archive is
|
|
184
|
+
// verified. Omission is reported separately; logical entries are never
|
|
185
|
+
// counted as dropped.
|
|
186
|
+
const dropped = 0;
|
|
187
|
+
return {
|
|
188
|
+
bytes: compactedBytes,
|
|
189
|
+
result: {
|
|
190
|
+
full_before: fullBefore,
|
|
191
|
+
oneline_before: onelineBefore,
|
|
192
|
+
full_after: fullAfter,
|
|
193
|
+
oneline_after: onelineAfter,
|
|
194
|
+
dropped,
|
|
195
|
+
omitted_count: omittedCount,
|
|
196
|
+
...(omittedCount > 0 ? { omission_reason: "projection_capacity" } : {}),
|
|
197
|
+
changed: true,
|
|
198
|
+
recovery: gated.recovery,
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
export function compactYamlFile(p, artifact, projectRoot) {
|
|
203
|
+
if (!fs.existsSync(p))
|
|
204
|
+
throw new Error(p);
|
|
205
|
+
const inferredProjectRoot = path.basename(path.dirname(p)) === ".agentera" ? path.dirname(path.dirname(p)) : path.dirname(p);
|
|
206
|
+
const compacted = compactYamlBytes(fs.readFileSync(p, "utf8"), artifact, projectRoot ?? inferredProjectRoot);
|
|
207
|
+
if (compacted.result.changed)
|
|
208
|
+
fs.writeFileSync(p, compacted.bytes);
|
|
209
|
+
return compacted.result;
|
|
66
210
|
}
|
|
67
211
|
function detectDirection(entries) {
|
|
68
212
|
let asc = 0;
|
|
@@ -108,24 +252,32 @@ export function compactEntries(entries, maxFull = MAX_FULL_ENTRIES, maxOneline =
|
|
|
108
252
|
return result;
|
|
109
253
|
}
|
|
110
254
|
function compactTodoEntries(entries) {
|
|
255
|
+
// Positional tiering per TC9: the first ten resolved rows are the
|
|
256
|
+
// recent/full-detail tier even when they have no indented body; rows
|
|
257
|
+
// 11-50 are the summary tier; rows beyond 50 are dropped. Using
|
|
258
|
+
// position (not body presence) ensures: (1) a TODO with 55 bodyless
|
|
259
|
+
// one-liners retains 50 (10 promoted to full + 40 summary), not 40;
|
|
260
|
+
// (2) a second compaction is idempotent because a compacted file
|
|
261
|
+
// with 0 body + 50 headers still reports total=50 (not oneline=50>40).
|
|
111
262
|
const result = [];
|
|
112
|
-
let
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
result.push(
|
|
117
|
-
|
|
118
|
-
|
|
263
|
+
for (let i = 0; i < entries.length; i++) {
|
|
264
|
+
if (i < MAX_FULL_ENTRIES) {
|
|
265
|
+
// First 10: full-detail tier — preserve body if present, promote
|
|
266
|
+
// kind to "full" so the writer keeps the header (not formatOneline).
|
|
267
|
+
result.push(entries[i].kind === "oneline"
|
|
268
|
+
? { ...entries[i], kind: "full" }
|
|
269
|
+
: entries[i]);
|
|
119
270
|
}
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
271
|
+
else if (i < MAX_TOTAL_ENTRIES) {
|
|
272
|
+
// Items 11-50: summary tier — force ≤15-word summary formatting
|
|
273
|
+
// by passing kind="full" to formatTodoOneline so it goes through
|
|
274
|
+
// the truncation path (strip metadata + truncateWords). This must
|
|
275
|
+
// NOT use kind="oneline" (passthrough), which preserves long
|
|
276
|
+
// verbatim headers unchanged.
|
|
277
|
+
const summary = formatTodoOneline({ ...entries[i], kind: "full" });
|
|
278
|
+
result.push({ header: summary, body: "", kind: "oneline" });
|
|
128
279
|
}
|
|
280
|
+
// Items 51+: dropped entirely.
|
|
129
281
|
}
|
|
130
282
|
return result;
|
|
131
283
|
}
|
|
@@ -180,19 +332,39 @@ function extractHeaderPrefix(text, spec) {
|
|
|
180
332
|
function compactTodoResolved(p) {
|
|
181
333
|
const spec = SPECS["todo-resolved"];
|
|
182
334
|
let text = fs.readFileSync(p, "utf8");
|
|
335
|
+
// Enforce exactly one `## ✓ Resolved` heading. Multiple headings hide
|
|
336
|
+
// trailing entries from parsing; zero headings leave placement ambiguous.
|
|
337
|
+
// The check-mode status path emits the error before reaching here; this
|
|
338
|
+
// guard protects direct callers (e.g. validate-artifact auto-compact).
|
|
339
|
+
const headingCount = countTodoResolvedSectionHeadings(text);
|
|
340
|
+
if (headingCount > 1) {
|
|
341
|
+
throw new Error(`TODO.md has ${headingCount} '## ✓ Resolved' sections; merge into exactly one before compacting. ` +
|
|
342
|
+
`Compaction drops oldest resolved entries and is destructive (no lossless archive); ` +
|
|
343
|
+
TODO_DROPPED_RECOVERY_GUIDANCE);
|
|
344
|
+
}
|
|
345
|
+
if (headingCount === 0) {
|
|
346
|
+
throw new Error("TODO.md has no required '## ✓ Resolved' section; add exactly one before compacting.");
|
|
347
|
+
}
|
|
348
|
+
// headingCount === 1: normalize (migrate misplaced items into existing heading)
|
|
183
349
|
const normalized = normalizeTodoResolvedLayout(text);
|
|
184
350
|
if (normalized.changed) {
|
|
185
351
|
fs.writeFileSync(p, normalized.text);
|
|
186
352
|
text = normalized.text;
|
|
187
353
|
}
|
|
188
|
-
const [start, end] = extractResolvedSection(text);
|
|
354
|
+
const [start, end, currentBody] = extractResolvedSection(text);
|
|
189
355
|
if (start < 0)
|
|
190
356
|
return { full_before: 0, oneline_before: 0, full_after: 0, oneline_after: 0, dropped: 0, changed: normalized.changed };
|
|
191
357
|
const entries = parseTodoResolved(text, spec);
|
|
192
|
-
const fullBefore = entries.filter((e) => e.kind === "full").length;
|
|
193
|
-
const onelineBefore = entries.filter((e) => e.kind === "oneline").length;
|
|
194
358
|
const totalBefore = entries.length;
|
|
195
|
-
|
|
359
|
+
// Positional tiering per TC9 (consistent with countTodoResolvedEntries and
|
|
360
|
+
// compactTodoEntries): first min(N,10) = full tier, rest = oneline tier.
|
|
361
|
+
const fullBefore = Math.min(totalBefore, MAX_FULL_ENTRIES);
|
|
362
|
+
const onelineBefore = Math.max(0, totalBefore - MAX_FULL_ENTRIES);
|
|
363
|
+
// Skip the rewrite when within budget AND no rows 11-50 need reformatting.
|
|
364
|
+
// This preserves idempotency: a fully-compacted file (10 verbatim + 40
|
|
365
|
+
// summaries) reports pendingSummarization=0 and returns changed=false.
|
|
366
|
+
const pendingSummarization = countTodoPendingSummarization(text);
|
|
367
|
+
if (totalBefore <= MAX_TOTAL_ENTRIES && pendingSummarization === 0) {
|
|
196
368
|
return {
|
|
197
369
|
full_before: fullBefore,
|
|
198
370
|
oneline_before: onelineBefore,
|
|
@@ -202,6 +374,9 @@ function compactTodoResolved(p) {
|
|
|
202
374
|
changed: normalized.changed,
|
|
203
375
|
};
|
|
204
376
|
}
|
|
377
|
+
// Either total > 50 (entries to drop) or pendingSummarization > 0 (rows
|
|
378
|
+
// 11-50 need ≤15-word summary formatting). Run compactTodoEntries and
|
|
379
|
+
// rewrite the Resolved section body.
|
|
205
380
|
const compacted = compactTodoEntries(entries);
|
|
206
381
|
const fullAfter = compacted.filter((e) => e.kind === "full").length;
|
|
207
382
|
const onelineAfter = compacted.filter((e) => e.kind === "oneline").length;
|
|
@@ -227,7 +402,12 @@ function compactTodoResolved(p) {
|
|
|
227
402
|
full_after: fullAfter,
|
|
228
403
|
oneline_after: onelineAfter,
|
|
229
404
|
dropped,
|
|
230
|
-
|
|
405
|
+
// TODO has no lossless numbered archive: dropped resolved entries are
|
|
406
|
+
// recoverable only via project history (Git), and only if previously
|
|
407
|
+
// committed. Surface this honestly in the JSON result rather than
|
|
408
|
+
// implying a lossless projection.
|
|
409
|
+
...(dropped > 0 ? { omission_reason: TODO_DROPPED_RECOVERY_GUIDANCE } : {}),
|
|
410
|
+
changed: true,
|
|
231
411
|
};
|
|
232
412
|
}
|
|
233
413
|
export function compactFile(p, specName) {
|
|
@@ -263,7 +443,4 @@ export function detectOverflow(text, specName) {
|
|
|
263
443
|
const onelineCount = entries.filter((e) => e.kind === "oneline").length;
|
|
264
444
|
return [fullCount, onelineCount];
|
|
265
445
|
}
|
|
266
|
-
// Silence the re-export-only `_applyRetentionCaps` alias used by status.ts.
|
|
267
|
-
void _applyRetentionCaps;
|
|
268
446
|
void yamlSortEntries;
|
|
269
|
-
//# sourceMappingURL=apply.js.map
|
|
@@ -167,11 +167,13 @@ export const COMPACTABLE_YAML_ARTIFACTS = {
|
|
|
167
167
|
progress: ["cycles", "archive"],
|
|
168
168
|
decisions: ["decisions", "archive"],
|
|
169
169
|
health: ["audits", "archive"],
|
|
170
|
+
experiments: ["experiments", "archive"],
|
|
170
171
|
};
|
|
171
172
|
export const YAML_SPEC_BY_ARTIFACT = {
|
|
172
173
|
progress: "progress",
|
|
173
174
|
decisions: "decisions",
|
|
174
175
|
health: "health",
|
|
176
|
+
experiments: "experiments",
|
|
175
177
|
};
|
|
176
178
|
export const NON_COMPACTABLE_ARTIFACTS = {
|
|
177
179
|
changelog: ["exempt", "public release history is not compacted"],
|
|
@@ -180,4 +182,3 @@ export const NON_COMPACTABLE_ARTIFACTS = {
|
|
|
180
182
|
vision: ["protected", "vision state is protected during execution cycles"],
|
|
181
183
|
design: ["unsupported", "design is a human-facing identity artifact, not a uniform retained-entry log"],
|
|
182
184
|
};
|
|
183
|
-
//# sourceMappingURL=dryRun.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Public surface for the compaction
|
|
2
|
+
* Public surface for the compaction engine.
|
|
3
3
|
*
|
|
4
4
|
* Re-exports the API consumed by `cli/commands/compact.ts` and the
|
|
5
5
|
* test suite. The actual implementation lives in the per-
|
|
@@ -13,11 +13,10 @@
|
|
|
13
13
|
* checkCompaction, fixCompaction, runCompaction)
|
|
14
14
|
*/
|
|
15
15
|
import { applyRetentionCaps as _applyRetentionCaps } from "../common.js";
|
|
16
|
-
import { compactFile, compactYamlFile, detectOverflow, compactEntries } from "./apply.js";
|
|
16
|
+
import { compactFile, compactYamlBytes, compactYamlFile, detectOverflow, compactEntries, } from "./apply.js";
|
|
17
17
|
import { checkCompaction, computeCompactionStatus, fixCompaction, runCompaction } from "./status.js";
|
|
18
|
-
import { parseEntries, parseFullEntries, parseOnelineEntries, splitArchive, extractResolvedSection, parseTodoResolved, countTodoResolvedEntries, normalizeTodoResolvedLayout, } from "./parse.js";
|
|
18
|
+
import { parseEntries, parseFullEntries, parseOnelineEntries, splitArchive, extractResolvedSection, parseTodoResolved, countTodoResolvedEntries, countTodoResolvedSectionHeadings, countTodoPendingSummarization, normalizeTodoResolvedLayout, TODO_DROPPED_RECOVERY_GUIDANCE, } from "./parse.js";
|
|
19
19
|
import { SPECS, COMPACTABLE_YAML_ARTIFACTS, NON_COMPACTABLE_ARTIFACTS, YAML_SPEC_BY_ARTIFACT, formatTodoOneline } from "./dryRun.js";
|
|
20
|
-
import { overLimitCount, stableSortBy, yamlArchiveEntry, yamlArchiveEntries, yamlRecentFullAndOlder, yamlSortEntries, decisionProtectedOverflowCount, selectDecisionActiveEntries, selectDecisionArchiveEntries, } from "./retention.js";
|
|
21
|
-
export { compactFile, compactYamlFile, detectOverflow, compactEntries, checkCompaction, computeCompactionStatus, fixCompaction, runCompaction, parseEntries, parseFullEntries, parseOnelineEntries, splitArchive, extractResolvedSection, parseTodoResolved, SPECS, COMPACTABLE_YAML_ARTIFACTS, NON_COMPACTABLE_ARTIFACTS, YAML_SPEC_BY_ARTIFACT, formatTodoOneline, countTodoResolvedEntries, normalizeTodoResolvedLayout, overLimitCount, stableSortBy, yamlArchiveEntry, yamlArchiveEntries, yamlRecentFullAndOlder, yamlSortEntries, decisionProtectedOverflowCount, selectDecisionActiveEntries, selectDecisionArchiveEntries, };
|
|
20
|
+
import { overLimitCount, stableSortBy, yamlArchiveEntry, yamlArchiveEntries, yamlRecentFullAndOlder, yamlSortEntries, yamlEntryNumber, decisionProtectedOverflowCount, decisionRequiresUserReview, selectDecisionActiveEntries, selectDecisionArchiveEntries, } from "./retention.js";
|
|
21
|
+
export { compactFile, compactYamlBytes, compactYamlFile, detectOverflow, compactEntries, checkCompaction, computeCompactionStatus, fixCompaction, runCompaction, parseEntries, parseFullEntries, parseOnelineEntries, splitArchive, extractResolvedSection, parseTodoResolved, SPECS, COMPACTABLE_YAML_ARTIFACTS, NON_COMPACTABLE_ARTIFACTS, YAML_SPEC_BY_ARTIFACT, formatTodoOneline, countTodoResolvedEntries, countTodoResolvedSectionHeadings, countTodoPendingSummarization, TODO_DROPPED_RECOVERY_GUIDANCE, normalizeTodoResolvedLayout, overLimitCount, stableSortBy, yamlArchiveEntry, yamlArchiveEntries, yamlRecentFullAndOlder, yamlSortEntries, yamlEntryNumber, decisionProtectedOverflowCount, decisionRequiresUserReview, selectDecisionActiveEntries, selectDecisionArchiveEntries, };
|
|
22
22
|
void _applyRetentionCaps;
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -9,9 +9,24 @@
|
|
|
9
9
|
* `## ✓ Resolved`.
|
|
10
10
|
*/
|
|
11
11
|
import { parseTodoMarkdownListItem } from "../../cli/todoMarkdown.js";
|
|
12
|
-
import {
|
|
12
|
+
import { MAX_FULL_ENTRIES, MAX_TOTAL_ENTRIES } from "../common.js";
|
|
13
|
+
import { SPECS, escapeRe, formatTodoOneline } from "./dryRun.js";
|
|
13
14
|
const SEVERITY_HEADING_RE = /^##\s*(⇶|⇉|→|⇢)\s/m;
|
|
14
15
|
const STRIKETHROUGH_ITEM_RE = /^(\s*)-\s+~~(.+?)~~\s*(.*)$/;
|
|
16
|
+
// Shared case-insensitive resolved-heading matcher. Duplicate detection
|
|
17
|
+
// (countTodoResolvedSectionHeadings), validation (markdown.ts), classification
|
|
18
|
+
// (isTodoResolvedSectionHeading), and extraction (extractResolvedSection) all
|
|
19
|
+
// use these so they accept the same variants: `## ✓ Resolved`, `## Resolved`,
|
|
20
|
+
// `## resolved`, `## RESOLVED`. Formerly extractResolvedSection used `\s+`
|
|
21
|
+
// (requiring a space after ##) without the `i` flag, silently rejecting
|
|
22
|
+
// case variants and `##Resolved`; now unified.
|
|
23
|
+
const TODO_RESOLVED_HEADING_RE = /^##\s*(?:✓\s+)?Resolved\s*$/im;
|
|
24
|
+
const TODO_RESOLVED_HEADING_GLOBAL_RE = /^##\s*(?:✓\s+)?Resolved\s*$/gim;
|
|
25
|
+
// TODO.md is a bounded human-facing queue, not a lossless numbered archive:
|
|
26
|
+
// dropped resolved entries are recoverable only via project history (Git),
|
|
27
|
+
// and only if previously committed. Surfaced in compaction diagnostics
|
|
28
|
+
// alongside the `dropped` count.
|
|
29
|
+
export const TODO_DROPPED_RECOVERY_GUIDANCE = "dropped resolved entries are not retained in a lossless archive; recover previously committed content via Git: `git log -p -- :/TODO.md` (non-Git projects have no historical recovery)";
|
|
15
30
|
export function splitArchive(text, archiveHeading) {
|
|
16
31
|
if (!archiveHeading)
|
|
17
32
|
return [text, ""];
|
|
@@ -70,7 +85,7 @@ export function parseOnelineEntries(text, spec) {
|
|
|
70
85
|
return entries;
|
|
71
86
|
}
|
|
72
87
|
export function extractResolvedSection(text) {
|
|
73
|
-
const m =
|
|
88
|
+
const m = TODO_RESOLVED_HEADING_RE.exec(text);
|
|
74
89
|
if (!m)
|
|
75
90
|
return [-1, -1, ""];
|
|
76
91
|
const bodyStart = m.index + m[0].length + 1;
|
|
@@ -124,7 +139,17 @@ export function isTodoSeveritySectionHeading(line) {
|
|
|
124
139
|
return SEVERITY_HEADING_RE.test(line.trim());
|
|
125
140
|
}
|
|
126
141
|
export function isTodoResolvedSectionHeading(line) {
|
|
127
|
-
return
|
|
142
|
+
return TODO_RESOLVED_HEADING_RE.test(line.trim());
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Count `## ✓ Resolved` section headings in a TODO.md. A well-formed queue has
|
|
146
|
+
* exactly one; duplicates make parsing silently process only the first and
|
|
147
|
+
* hide the remaining entries from the compaction budget. Callers (validation,
|
|
148
|
+
* compaction status, compaction apply) refuse when this returns a value > 1.
|
|
149
|
+
*/
|
|
150
|
+
export function countTodoResolvedSectionHeadings(text) {
|
|
151
|
+
const matches = text.match(TODO_RESOLVED_HEADING_GLOBAL_RE);
|
|
152
|
+
return matches ? matches.length : 0;
|
|
128
153
|
}
|
|
129
154
|
export function classifyTodoSectionHeading(line) {
|
|
130
155
|
if (isTodoSeveritySectionHeading(line))
|
|
@@ -171,11 +196,54 @@ export function countTodoResolvedEntries(content) {
|
|
|
171
196
|
const spec = SPECS["todo-resolved"];
|
|
172
197
|
const resolvedSection = parseTodoResolved(content, spec);
|
|
173
198
|
const misplaced = countTodoResolvedInSeverityBands(content);
|
|
199
|
+
const total = resolvedSection.length + misplaced;
|
|
200
|
+
// Positional tiering per TC9: the first ten resolved rows are the
|
|
201
|
+
// recent/full-detail tier even when they have no indented body; rows
|
|
202
|
+
// 11+ are the summary tier. This keeps status reporting consistent
|
|
203
|
+
// with how compactTodoEntries assigns tiers (positional, not
|
|
204
|
+
// body-presence-based), so a compacted file with 10 header-only rows
|
|
205
|
+
// + 40 summaries reports 10/40 (not 0/50).
|
|
174
206
|
return {
|
|
175
|
-
full:
|
|
176
|
-
oneline:
|
|
207
|
+
full: Math.min(total, MAX_FULL_ENTRIES),
|
|
208
|
+
oneline: Math.max(0, total - MAX_FULL_ENTRIES),
|
|
177
209
|
};
|
|
178
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Count resolved entries in positions 11-50 that need ≤15-word summarization
|
|
213
|
+
* but are not yet summaries. An entry needs summarization when:
|
|
214
|
+
* - it has an indented body (should be stripped), or
|
|
215
|
+
* - its kind is "full" (should be demoted to the summary tier), or
|
|
216
|
+
* - its header differs from what `formatTodoOneline` would produce (i.e.
|
|
217
|
+
* it is a long verbatim header, not a ≤15-word summary).
|
|
218
|
+
*
|
|
219
|
+
* Returns 0 when the Resolved section is already compacted (idempotent).
|
|
220
|
+
* `check compact` uses this to detect in-budget (≤50) TODOs that still need
|
|
221
|
+
* a formatting rewrite, so `--mode fix` is triggered before entries overflow.
|
|
222
|
+
*/
|
|
223
|
+
export function countTodoPendingSummarization(content) {
|
|
224
|
+
const spec = SPECS["todo-resolved"];
|
|
225
|
+
const entries = parseTodoResolved(content, spec);
|
|
226
|
+
if (entries.length <= MAX_FULL_ENTRIES)
|
|
227
|
+
return 0;
|
|
228
|
+
const summaryTier = entries.slice(MAX_FULL_ENTRIES, MAX_TOTAL_ENTRIES);
|
|
229
|
+
let count = 0;
|
|
230
|
+
for (const entry of summaryTier) {
|
|
231
|
+
if (entry.body) {
|
|
232
|
+
count++;
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
if (entry.kind === "full") {
|
|
236
|
+
count++;
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
// kind=oneline, no body: check if header matches the summary format
|
|
240
|
+
// by forcing kind="full" through formatTodoOneline (truncation path).
|
|
241
|
+
const expected = formatTodoOneline({ ...entry, kind: "full" });
|
|
242
|
+
if (entry.header.trim() !== expected.trim())
|
|
243
|
+
count++;
|
|
244
|
+
}
|
|
245
|
+
return count;
|
|
246
|
+
}
|
|
179
247
|
/**
|
|
180
248
|
* Move resolved rows from severity bands into `## ✓ Resolved`, creating the
|
|
181
249
|
* section when absent. Newly migrated rows are prepended (newest-first folds).
|
|
@@ -255,4 +323,3 @@ export function parseEntries(text, specName) {
|
|
|
255
323
|
const onelineEntries = parseOnelineEntries(archiveBody, spec);
|
|
256
324
|
return [...fullEntries, ...onelineEntries];
|
|
257
325
|
}
|
|
258
|
-
//# sourceMappingURL=parse.js.map
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* by `apply.ts` (which writes the compacted result back to disk)
|
|
6
6
|
* and by `status.ts` (which counts overflow without writing).
|
|
7
7
|
*/
|
|
8
|
-
import { MAX_FULL_ENTRIES, MAX_ONELINE_ENTRIES, applyRetentionCaps } from "../common.js";
|
|
8
|
+
import { MAX_FULL_ENTRIES, MAX_ONELINE_ENTRIES, MAX_TOTAL_ENTRIES, applyRetentionCaps } from "../common.js";
|
|
9
9
|
import { truncateWords } from "./dryRun.js";
|
|
10
10
|
export function overLimitCount(activeCount, archiveCount) {
|
|
11
11
|
const totalCount = activeCount + archiveCount;
|
|
12
|
-
return Math.max(Math.max(activeCount - MAX_FULL_ENTRIES, 0), Math.max(archiveCount - MAX_ONELINE_ENTRIES, 0), Math.max(totalCount -
|
|
12
|
+
return Math.max(Math.max(activeCount - MAX_FULL_ENTRIES, 0), Math.max(archiveCount - MAX_ONELINE_ENTRIES, 0), Math.max(totalCount - MAX_TOTAL_ENTRIES, 0));
|
|
13
13
|
}
|
|
14
14
|
export function stableSortBy(arr, key, reverse = false) {
|
|
15
15
|
return arr
|
|
@@ -100,13 +100,16 @@ export function yamlArchiveEntry(specName, entry) {
|
|
|
100
100
|
const summary = yamlSummaryText(e, "trajectory", "grades");
|
|
101
101
|
return { summary: `Audit ${number}${datePart}: ${summary}` };
|
|
102
102
|
}
|
|
103
|
+
if (specName === "experiments") {
|
|
104
|
+
return { number: e.number, summary: yamlSummaryText(e, "conclusion", "label") };
|
|
105
|
+
}
|
|
103
106
|
if (specName === "session") {
|
|
104
107
|
return { timestamp: String(e.timestamp ?? ""), summary: yamlSummaryText(e, "summary") };
|
|
105
108
|
}
|
|
106
109
|
return { summary: yamlSummaryText(e, "summary") };
|
|
107
110
|
}
|
|
108
111
|
export function yamlSortEntries(entries, specName) {
|
|
109
|
-
if (specName === "decisions" || specName === "health") {
|
|
112
|
+
if (specName === "decisions" || specName === "health" || specName === "experiments") {
|
|
110
113
|
return stableSortBy(entries, yamlEntryNumber);
|
|
111
114
|
}
|
|
112
115
|
if (specName === "session") {
|
|
@@ -114,12 +117,12 @@ export function yamlSortEntries(entries, specName) {
|
|
|
114
117
|
}
|
|
115
118
|
return stableSortBy(entries, yamlEntryNumber, true);
|
|
116
119
|
}
|
|
117
|
-
export function yamlRecentFullAndOlder(entries, specName) {
|
|
120
|
+
export function yamlRecentFullAndOlder(entries, specName, fullCapacity = MAX_FULL_ENTRIES) {
|
|
118
121
|
const newestFirst = specName === "session"
|
|
119
122
|
? stableSortBy(entries, yamlEntryTimestamp, true)
|
|
120
123
|
: stableSortBy(entries, yamlEntryNumber, true);
|
|
121
|
-
const recent = newestFirst.slice(0,
|
|
122
|
-
const older = newestFirst.slice(
|
|
124
|
+
const recent = newestFirst.slice(0, fullCapacity);
|
|
125
|
+
const older = newestFirst.slice(fullCapacity);
|
|
123
126
|
return [yamlSortEntries(recent, specName), older];
|
|
124
127
|
}
|
|
125
128
|
function yamlArchiveSortKey(entry) {
|
|
@@ -155,7 +158,7 @@ function decisionSatisfactionState(entry) {
|
|
|
155
158
|
const state = satisfaction.state;
|
|
156
159
|
return typeof state === "string" ? state : null;
|
|
157
160
|
}
|
|
158
|
-
function decisionRequiresUserReview(entry) {
|
|
161
|
+
export function decisionRequiresUserReview(entry) {
|
|
159
162
|
if (!entry || typeof entry !== "object")
|
|
160
163
|
return true;
|
|
161
164
|
// cast: decision record fields read from parsed decisions.yaml
|
|
@@ -163,37 +166,37 @@ function decisionRequiresUserReview(entry) {
|
|
|
163
166
|
if (!satisfaction || typeof satisfaction !== "object")
|
|
164
167
|
return true;
|
|
165
168
|
const confirmation = satisfaction.user_confirmation;
|
|
169
|
+
const confirmedBy = confirmation && typeof confirmation === "object" ? confirmation.confirmed_by : null;
|
|
170
|
+
const confirmedAt = confirmation && typeof confirmation === "object" ? confirmation.confirmed_at : null;
|
|
166
171
|
return (decisionSatisfactionState(entry) !== "user_confirmed_satisfied" ||
|
|
167
172
|
!confirmation ||
|
|
168
173
|
typeof confirmation !== "object" ||
|
|
169
|
-
|
|
174
|
+
typeof confirmedBy !== "string" ||
|
|
175
|
+
confirmedBy.trim() === "" ||
|
|
176
|
+
typeof confirmedAt !== "string" ||
|
|
177
|
+
confirmedAt.trim() === "");
|
|
178
|
+
}
|
|
179
|
+
export function decisionSatisfiedActiveCount(active) {
|
|
180
|
+
return active.filter((e) => !decisionRequiresUserReview(e)).length;
|
|
170
181
|
}
|
|
171
182
|
export function decisionProtectedOverflowCount(active, archive) {
|
|
172
183
|
const protectedActive = active.filter((e) => decisionRequiresUserReview(e)).length;
|
|
173
184
|
const protectedArchive = archive.filter((e) => decisionRequiresUserReview(e)).length;
|
|
174
|
-
return Math.max(protectedActive - MAX_FULL_ENTRIES, protectedArchive - MAX_ONELINE_ENTRIES, protectedActive + protectedArchive -
|
|
185
|
+
return Math.max(protectedActive - MAX_FULL_ENTRIES, protectedArchive - MAX_ONELINE_ENTRIES, protectedActive + protectedArchive - MAX_TOTAL_ENTRIES, 0);
|
|
175
186
|
}
|
|
176
|
-
export function selectDecisionActiveEntries(active) {
|
|
187
|
+
export function selectDecisionActiveEntries(active, fullCapacity = MAX_FULL_ENTRIES) {
|
|
177
188
|
const protectedEntries = active.filter((e) => decisionRequiresUserReview(e));
|
|
178
|
-
if (protectedEntries.length > MAX_FULL_ENTRIES) {
|
|
179
|
-
throw new Error("decisions: protected-overflow review pressure; " +
|
|
180
|
-
`${protectedEntries.length} protected active decision(s) exceed ${MAX_FULL_ENTRIES} full-detail slots`);
|
|
181
|
-
}
|
|
182
189
|
const satisfied = active.filter((e) => !decisionRequiresUserReview(e));
|
|
183
190
|
const newestSatisfied = stableSortBy(satisfied, yamlEntryNumber, true);
|
|
184
|
-
const
|
|
185
|
-
const
|
|
191
|
+
const satisfiedCapacity = Math.max(fullCapacity - protectedEntries.length, 0);
|
|
192
|
+
const keepSatisfied = newestSatisfied.slice(0, satisfiedCapacity);
|
|
193
|
+
const compactSatisfied = newestSatisfied.slice(satisfiedCapacity);
|
|
186
194
|
return [yamlSortEntries([...protectedEntries, ...keepSatisfied], "decisions"), compactSatisfied];
|
|
187
195
|
}
|
|
188
196
|
export function selectDecisionArchiveEntries(archiveCandidates) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
const satisfied = archiveCandidates.filter((e) => !decisionRequiresUserReview(e));
|
|
195
|
-
const keepSatisfied = yamlArchiveEntries(satisfied).slice(0, MAX_ONELINE_ENTRIES - protectedEntries.length);
|
|
196
|
-
return yamlSortEntries([...protectedEntries, ...keepSatisfied], "decisions");
|
|
197
|
+
// Review pressure is a projection concern, not a write failure. Capacity
|
|
198
|
+
// selection happens after archive recovery so protected records are never
|
|
199
|
+
// discarded merely because they are unresolved.
|
|
200
|
+
return yamlSortEntries(archiveCandidates, "decisions");
|
|
197
201
|
}
|
|
198
202
|
export { applyRetentionCaps };
|
|
199
|
-
//# sourceMappingURL=retention.js.map
|