agentera 3.0.0-dev.8 → 3.0.0-dev.80
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 +1387 -0
- package/bundle/DESIGN.md +229 -0
- package/bundle/LICENSE +201 -0
- package/bundle/README.md +143 -0
- package/bundle/UPGRADE.md +271 -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 +333 -0
- package/bundle/references/analysis/evidence-tier-authority.yaml +559 -0
- package/bundle/references/analysis/personal-glossary-evaluation-authority.yaml +175 -0
- package/bundle/references/analysis/personal-glossary-evaluation-corpus.yaml +291 -0
- package/bundle/references/analysis/personal-glossary-holdout.yaml +192 -0
- package/bundle/references/analysis/verification-policy.yaml +261 -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 +3065 -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 +118 -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 +503 -0
- package/dist/setup/opencode.js +20 -13
- package/dist/setup/opencodeConstants.js +1 -0
- package/dist/setup/sharedSkill.js +45 -0
- package/dist/setup/smokeChecks.js +14 -75
- package/dist/state/archiveDiscovery.js +580 -0
- package/dist/state/archivePublication.js +225 -0
- package/dist/state/archiveRecovery.js +237 -0
- package/dist/state/archiveReplay.js +53 -0
- package/dist/state/canonicalMigrationRecord.js +36 -0
- package/dist/state/changelog.js +221 -0
- package/dist/state/decisionEntities.js +367 -0
- package/dist/state/decisionLegacyValidation.js +215 -0
- package/dist/state/decisionMigrationProvenance.js +199 -0
- package/dist/state/decisionOverlay.js +254 -0
- package/dist/state/decisionRevision.js +256 -0
- package/dist/state/decisionRevisionMigration.js +89 -0
- package/dist/state/directRetrieval.js +323 -0
- package/dist/state/durability.js +324 -0
- package/dist/state/entityCutover.js +459 -0
- package/dist/state/entityCutoverGit.js +127 -0
- package/dist/state/entityGlossaryAuthority.js +13 -0
- package/dist/state/entityListProjection.js +187 -0
- package/dist/state/entityListRuntimeRegistry.js +85 -0
- package/dist/state/entityMigrationCausality.js +97 -0
- package/dist/state/entityMigrationIdentity.js +5 -0
- package/dist/state/entityMigrationPreview.js +840 -0
- package/dist/state/entityMigrationTodo.js +133 -0
- package/dist/state/entityPublicationContext.js +859 -0
- package/dist/state/entityRetrievalHelp.js +506 -0
- package/dist/state/entityStorage.js +899 -0
- package/dist/state/exactReplacementRecovery.js +18 -0
- package/dist/state/experimentArchive.js +63 -0
- package/dist/state/experimentIdentity.js +202 -0
- package/dist/state/healthEntities.js +262 -0
- package/dist/state/healthEntityValidation.js +18 -0
- package/dist/state/healthRepair.js +69 -0
- package/dist/state/installRoot.js +15 -7
- package/dist/state/legacyEntityCutoverEvidence.js +65 -0
- package/dist/state/legacyIdentity.js +47 -0
- package/dist/state/legacySummaryRecord.js +6 -0
- package/dist/state/listAccounting.js +54 -0
- package/dist/state/listClassification.js +17 -0
- package/dist/state/listCursor.js +42 -0
- package/dist/state/listRetrieval.js +781 -0
- package/dist/state/migrationSourceBinding.js +30 -0
- package/dist/state/objectiveExperimentEntities.js +322 -0
- package/dist/state/planEntities.js +1027 -0
- package/dist/state/planIdentity.js +47 -0
- package/dist/state/planLineageValidation.js +52 -0
- package/dist/state/planReplacementTransaction.js +475 -0
- package/dist/state/planRetrieval.js +313 -0
- package/dist/state/planTaskRetrieval.js +294 -0
- package/dist/state/progressEntities.js +512 -0
- package/dist/state/progressGlossaryCaveat.js +168 -0
- package/dist/state/progressPublicationOrder.js +19 -0
- package/dist/state/progressWritePolicy.js +33 -0
- package/dist/state/projectRoot.js +62 -0
- package/dist/state/projectionPolicy.js +190 -0
- package/dist/state/retrievalAuthority.js +156 -0
- package/dist/state/safeProjectFile.js +155 -0
- package/dist/state/startupAnalysis/benchmark.js +70 -9
- package/dist/state/startupAnalysis/contract.js +44 -10
- package/dist/state/startupAnalysis/helpers.js +1 -2
- package/dist/state/startupAnalysis/index.js +0 -1
- package/dist/state/startupAnalysis/metrics.js +0 -1
- package/dist/state/startupAnalysis/records.js +0 -1
- package/dist/state/startupAnalysis/report.js +0 -1
- package/dist/state/startupAnalysis/threshold.js +13 -1
- package/dist/state/startupAnalysis.js +0 -1
- package/dist/state/startupProjection.js +499 -0
- package/dist/state/stateMode.js +222 -0
- package/dist/state/stateStorageAuthority.js +47 -0
- package/dist/state/summaryEntityRead.js +25 -0
- package/dist/state/summaryMigrationProvenance.js +66 -0
- package/dist/state/summarySourceRowAuthority.js +36 -0
- package/dist/state/todoActivationSafety.js +58 -0
- package/dist/state/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 +113 -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 +253 -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
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { loadYamlMapping } from "../core/yaml.js";
|
|
4
|
+
import { resolveSourceRoot } from "../core/sourceRoot.js";
|
|
5
|
+
import { LIFECYCLE_OPERATION_CONTRACT_RELATIVE_PATH, LIFECYCLE_MANUAL_REVIEW_GUIDANCE, applyLifecycleOperations, createLifecycleOwnershipManifest, emptyLifecycleOwnershipLedger, planLifecycleOperations, validateLifecycleOwnershipLedger, } from "./lifecycleOperations.js";
|
|
6
|
+
import { LIFECYCLE_AUTHORITY_RELATIVE_PATH, NATIVE_RESOURCE_CLEANUP_CONTRACT_RELATIVE_PATH, loadLifecycleAuthority, } from "./lifecycleAuthority.js";
|
|
7
|
+
import { loadRuntimeLifecycleAdapterContract } from "./lifecycleAdapterContract.js";
|
|
8
|
+
import { loadLifecycleOperationContract } from "./lifecycleOperationContract.js";
|
|
9
|
+
const REQUIRED_RESOURCE_VOCABULARY = {
|
|
10
|
+
"claude.skill-link": "legacy_skill_link",
|
|
11
|
+
"codex.agent-descriptor": "capability_descriptor",
|
|
12
|
+
"opencode.plugin": "plugin",
|
|
13
|
+
"opencode.command": "command",
|
|
14
|
+
"legacy.primary-agent": "primary_agent",
|
|
15
|
+
"legacy.capability-agent": "capability_agent",
|
|
16
|
+
"opencode.stale-skill-link": "stale_skill_link",
|
|
17
|
+
"installed.hook": "installed_hook",
|
|
18
|
+
"agentera.registration": "registration",
|
|
19
|
+
};
|
|
20
|
+
const CUTOVER_DELETION_INVENTORY = [
|
|
21
|
+
["packages/cli/src/migrate/v2HandoffManifest.ts", "tracked_v2_handoff_preflight"],
|
|
22
|
+
["packages/cli/src/upgrade/appContentRefresh.ts", "v2_managed_app_content_refresh"],
|
|
23
|
+
["packages/cli/src/upgrade/compatibility.ts", "v2_install_classification"],
|
|
24
|
+
["packages/cli/src/upgrade/installedHooksRetirement.ts", "installed_v2_hook_retirement"],
|
|
25
|
+
["packages/cli/src/upgrade/legacyAgentCleanup.ts", "v2_native_agent_retirement"],
|
|
26
|
+
["packages/cli/src/upgrade/migrateArtifactsV2ToV3.ts", "v2_project_artifact_migration"],
|
|
27
|
+
["packages/cli/src/upgrade/runtimeMigration.ts", "v2_native_hook_retirement"],
|
|
28
|
+
["packages/cli/src/upgrade/versionResolution.ts", "cross_major_v2_upgrade_resolution"],
|
|
29
|
+
["packages/cli/shim/lib/exec.mjs", "v2_shim_handoff"],
|
|
30
|
+
["packages/cli/test/upgrade/fixtures/v2-*", "v2_migration_fixtures"],
|
|
31
|
+
];
|
|
32
|
+
function isMapping(value) {
|
|
33
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
34
|
+
}
|
|
35
|
+
function stringList(value) {
|
|
36
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string") ? value : [];
|
|
37
|
+
}
|
|
38
|
+
function requiredString(value, key) {
|
|
39
|
+
return typeof value[key] === "string" && value[key].length > 0;
|
|
40
|
+
}
|
|
41
|
+
function expandedDiagnosticIds(resource) {
|
|
42
|
+
if (typeof resource.id !== "string")
|
|
43
|
+
return [];
|
|
44
|
+
const names = stringList(resource.names);
|
|
45
|
+
if (!resource.id.includes("{name}"))
|
|
46
|
+
return [resource.id];
|
|
47
|
+
return names.map((name) => resource.id.replace("{name}", name));
|
|
48
|
+
}
|
|
49
|
+
export function validateNativeResourceCleanupContractData(value) {
|
|
50
|
+
if (!isMapping(value))
|
|
51
|
+
return ["native resource cleanup contract must be a YAML object"];
|
|
52
|
+
const errors = [];
|
|
53
|
+
if (value.schema_version !== "agentera.nativeResourceCleanup.v1") {
|
|
54
|
+
errors.push("schema_version must be agentera.nativeResourceCleanup.v1");
|
|
55
|
+
}
|
|
56
|
+
if (value.status !== "resource_retirement_contract") {
|
|
57
|
+
errors.push("status must be resource_retirement_contract");
|
|
58
|
+
}
|
|
59
|
+
if (value.decision !== "nksvqmnevm")
|
|
60
|
+
errors.push("decision must cite firm decision nksvqmnevm");
|
|
61
|
+
if (value.authority !== LIFECYCLE_AUTHORITY_RELATIVE_PATH) {
|
|
62
|
+
errors.push(`authority must point to ${LIFECYCLE_AUTHORITY_RELATIVE_PATH}`);
|
|
63
|
+
}
|
|
64
|
+
if (value.operation_contract !== LIFECYCLE_OPERATION_CONTRACT_RELATIVE_PATH) {
|
|
65
|
+
errors.push(`operation_contract must point to ${LIFECYCLE_OPERATION_CONTRACT_RELATIVE_PATH}`);
|
|
66
|
+
}
|
|
67
|
+
const policy = isMapping(value.policy) ? value.policy : {};
|
|
68
|
+
if (policy.host_inventory_exposure !== "evidence_only"
|
|
69
|
+
|| policy.selection !== "native_agentera_resource_only"
|
|
70
|
+
|| policy.preview !== "strictly_read_only"
|
|
71
|
+
|| policy.apply_requires !== "explicit_approval"
|
|
72
|
+
|| policy.ownership !== "matching_whole_resource_ledger_identity_and_fingerprint"
|
|
73
|
+
|| policy.shared_configuration !== "action_required_without_key_level_ownership"
|
|
74
|
+
|| policy.unsupported_platform_result !== "action_required") {
|
|
75
|
+
errors.push("policy must expose resource-only selection, pure preview, explicit approval, and fail-closed ownership");
|
|
76
|
+
}
|
|
77
|
+
const forbidden = stringList(policy.forbidden_ownership_evidence);
|
|
78
|
+
for (const evidence of ["value_equality", "managed_marker", "resource_name", "file_equality"]) {
|
|
79
|
+
if (!forbidden.includes(evidence))
|
|
80
|
+
errors.push(`policy must reject ${evidence} as ownership evidence`);
|
|
81
|
+
}
|
|
82
|
+
const hosts = Array.isArray(value.hosts) ? value.hosts : [];
|
|
83
|
+
const expectedHosts = {
|
|
84
|
+
codex: "supported",
|
|
85
|
+
cursor: "supported",
|
|
86
|
+
opencode: "supported",
|
|
87
|
+
copilot: "supported_disabled",
|
|
88
|
+
claude: "retired_historical",
|
|
89
|
+
};
|
|
90
|
+
const hostStatuses = new Map();
|
|
91
|
+
for (const host of hosts) {
|
|
92
|
+
if (!isMapping(host) || !requiredString(host, "id") || !requiredString(host, "display_name"))
|
|
93
|
+
continue;
|
|
94
|
+
if (!(host.support_status === "supported" || host.support_status === "supported_disabled" || host.support_status === "retired_historical"))
|
|
95
|
+
continue;
|
|
96
|
+
hostStatuses.set(host.id, host.support_status);
|
|
97
|
+
}
|
|
98
|
+
for (const [id, status] of Object.entries(expectedHosts)) {
|
|
99
|
+
if (hostStatuses.get(id) !== status)
|
|
100
|
+
errors.push(`hosts must retain ${id} as ${status}`);
|
|
101
|
+
}
|
|
102
|
+
const evidence = Array.isArray(value.accepted_host_evidence) ? value.accepted_host_evidence : [];
|
|
103
|
+
const proofByHost = new Map();
|
|
104
|
+
for (const item of evidence) {
|
|
105
|
+
if (isMapping(item) && requiredString(item, "host") && requiredString(item, "proof")) {
|
|
106
|
+
proofByHost.set(item.host, item.proof);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
for (const host of ["codex", "cursor", "opencode", "copilot"]) {
|
|
110
|
+
if (!proofByHost.has(host))
|
|
111
|
+
errors.push(`accepted_host_evidence must retain ${host} proof`);
|
|
112
|
+
}
|
|
113
|
+
const vocabulary = Array.isArray(value.resource_vocabulary) ? value.resource_vocabulary : [];
|
|
114
|
+
const vocabularyById = new Map();
|
|
115
|
+
for (const entry of vocabulary) {
|
|
116
|
+
if (!isMapping(entry) || !requiredString(entry, "id"))
|
|
117
|
+
continue;
|
|
118
|
+
vocabularyById.set(entry.id, entry);
|
|
119
|
+
}
|
|
120
|
+
if (vocabulary.length !== Object.keys(REQUIRED_RESOURCE_VOCABULARY).length) {
|
|
121
|
+
errors.push("resource_vocabulary must declare every retired native resource class");
|
|
122
|
+
}
|
|
123
|
+
for (const [id, resourceClass] of Object.entries(REQUIRED_RESOURCE_VOCABULARY)) {
|
|
124
|
+
const entry = vocabularyById.get(id);
|
|
125
|
+
if (!entry || entry.resource_class !== resourceClass
|
|
126
|
+
|| !(entry.migration_scope === "explicit_cleanup" || entry.migration_scope === "v2_upgrade_only")
|
|
127
|
+
|| stringList(entry.resource_ids).length === 0
|
|
128
|
+
|| !Array.isArray(entry.historical_ids)) {
|
|
129
|
+
errors.push(`resource_vocabulary must retain ${id} as ${resourceClass}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const registrationEvidence = stringList(vocabularyById.get("agentera.registration")?.identity_evidence);
|
|
133
|
+
if (registrationEvidence.length === 0) {
|
|
134
|
+
errors.push("agentera.registration must retain identity evidence for excluded template labels");
|
|
135
|
+
}
|
|
136
|
+
const declaredDiagnosticIds = new Map();
|
|
137
|
+
for (const [vocabularyId, entry] of vocabularyById) {
|
|
138
|
+
for (const resourceId of stringList(entry.resource_ids)) {
|
|
139
|
+
if (resourceId.includes("{")) {
|
|
140
|
+
errors.push(`resource_vocabulary ${vocabularyId} must declare exact resource IDs`);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (declaredDiagnosticIds.has(resourceId)) {
|
|
144
|
+
errors.push(`resource_vocabulary must not duplicate ${resourceId}`);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
declaredDiagnosticIds.set(resourceId, vocabularyId);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const diagnosticInventory = isMapping(value.diagnostic_inventory) ? value.diagnostic_inventory : null;
|
|
151
|
+
const maximumResources = diagnosticInventory?.maximum_resources;
|
|
152
|
+
const maximumFileBytes = diagnosticInventory?.maximum_file_bytes;
|
|
153
|
+
if (!Number.isInteger(maximumResources) || maximumResources < 1 || maximumResources > 256
|
|
154
|
+
|| !Number.isInteger(maximumFileBytes) || maximumFileBytes < 1 || maximumFileBytes > 1024 * 1024) {
|
|
155
|
+
errors.push("diagnostic_inventory must declare bounded maximum_resources and maximum_file_bytes");
|
|
156
|
+
}
|
|
157
|
+
const diagnosticResources = Array.isArray(diagnosticInventory?.resources) ? diagnosticInventory.resources : [];
|
|
158
|
+
const diagnosticIds = new Map();
|
|
159
|
+
for (const resource of diagnosticResources) {
|
|
160
|
+
if (!isMapping(resource)
|
|
161
|
+
|| !requiredString(resource, "id")
|
|
162
|
+
|| !requiredString(resource, "vocabulary")
|
|
163
|
+
|| !Array.isArray(resource.destinations)
|
|
164
|
+
|| !stringList(resource.destinations).length
|
|
165
|
+
|| (resource.names !== undefined && !Array.isArray(resource.names))
|
|
166
|
+
|| (resource.contains !== undefined && !requiredString(resource, "contains"))) {
|
|
167
|
+
errors.push("diagnostic_inventory resources must declare bounded resource IDs and paths");
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
const vocabularyId = resource.vocabulary;
|
|
171
|
+
if (!vocabularyById.has(vocabularyId)) {
|
|
172
|
+
errors.push(`diagnostic_inventory references unknown vocabulary ${vocabularyId}`);
|
|
173
|
+
}
|
|
174
|
+
const template = resource.id;
|
|
175
|
+
const ids = expandedDiagnosticIds(resource);
|
|
176
|
+
if (template.includes("{") && (template.match(/\{name\}/g)?.length !== 1 || ids.length === 0)) {
|
|
177
|
+
errors.push(`diagnostic_inventory must expand ${template} with one or more names`);
|
|
178
|
+
}
|
|
179
|
+
for (const id of ids) {
|
|
180
|
+
const declaredVocabulary = declaredDiagnosticIds.get(id);
|
|
181
|
+
if (declaredVocabulary !== vocabularyId) {
|
|
182
|
+
errors.push(`diagnostic_inventory ${id} must map to its exact declared vocabulary identity`);
|
|
183
|
+
}
|
|
184
|
+
if (diagnosticIds.has(id)) {
|
|
185
|
+
errors.push(`diagnostic_inventory must not duplicate ${id}`);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
diagnosticIds.set(id, vocabularyId);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
for (const id of declaredDiagnosticIds.keys()) {
|
|
193
|
+
if (!diagnosticIds.has(id))
|
|
194
|
+
errors.push(`diagnostic_inventory must define ${id}`);
|
|
195
|
+
}
|
|
196
|
+
const resources = Array.isArray(value.resources) ? value.resources : [];
|
|
197
|
+
if (resources.length !== 2)
|
|
198
|
+
errors.push("resources must declare the Claude link and Codex descriptor class");
|
|
199
|
+
const resourceById = new Map();
|
|
200
|
+
for (const resource of resources) {
|
|
201
|
+
if (!isMapping(resource) || !requiredString(resource, "id"))
|
|
202
|
+
continue;
|
|
203
|
+
resourceById.set(resource.id, resource);
|
|
204
|
+
}
|
|
205
|
+
const claude = resourceById.get("claude.agentera-skill-link");
|
|
206
|
+
if (!claude || claude.host !== "claude" || claude.kind !== "symlink" || claude.intent !== "remove"
|
|
207
|
+
|| claude.destination !== "{home}/.claude/skills/agentera" || claude.ledger_status !== "legacy"
|
|
208
|
+
|| claude.vocabulary !== "claude.skill-link" || !requiredString(claude, "durable_proof")) {
|
|
209
|
+
errors.push("Claude cleanup must remain the legacy-ledger Agentera skill symlink removal");
|
|
210
|
+
}
|
|
211
|
+
const codex = resourceById.get("codex.agent-descriptor");
|
|
212
|
+
const descriptors = codex ? stringList(codex.descriptors) : [];
|
|
213
|
+
const expectedDescriptors = ["status", "vision", "discuss", "research", "plan", "build", "optimize", "audit", "document", "profile", "design", "orchestrate"];
|
|
214
|
+
if (!codex || codex.host !== "codex" || codex.kind !== "file" || codex.intent !== "remove"
|
|
215
|
+
|| codex.destination !== "{home}/.codex/agents/{descriptor}.toml" || codex.ledger_status !== "managed"
|
|
216
|
+
|| codex.vocabulary !== "codex.agent-descriptor" || !requiredString(codex, "durable_proof")
|
|
217
|
+
|| stringList(codex.historical_ids).join(",") !== "codex.agents.{descriptor}"
|
|
218
|
+
|| descriptors.join(",") !== expectedDescriptors.join(",")) {
|
|
219
|
+
errors.push("Codex descriptors must be independently ledger-owned native files");
|
|
220
|
+
}
|
|
221
|
+
const configuration = Array.isArray(value.configuration_inventory) ? value.configuration_inventory : [];
|
|
222
|
+
const expectedKeys = [
|
|
223
|
+
"shell_environment_policy.set.AGENTERA_HOME",
|
|
224
|
+
"agents.max_depth",
|
|
225
|
+
"features.multi_agent_v2",
|
|
226
|
+
];
|
|
227
|
+
if (configuration.length !== expectedKeys.length) {
|
|
228
|
+
errors.push("configuration_inventory must declare every Agentera-written Codex key");
|
|
229
|
+
}
|
|
230
|
+
for (const key of expectedKeys) {
|
|
231
|
+
const unit = configuration.find((item) => isMapping(item) && item.key === key);
|
|
232
|
+
if (!isMapping(unit) || !requiredString(unit, "id") || unit.host !== "codex" || unit.destination !== "{home}/.codex/config.toml"
|
|
233
|
+
|| unit.durable_proof !== "key-level ownership ledger identity and fingerprint"
|
|
234
|
+
|| unit.ownership_available !== false || unit.result_without_proof !== "action_required") {
|
|
235
|
+
errors.push(`configuration_inventory must preserve ${key} without key-level ownership`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const deletionInventory = isMapping(value.cutover_deletion_inventory)
|
|
239
|
+
? value.cutover_deletion_inventory
|
|
240
|
+
: null;
|
|
241
|
+
if (deletionInventory?.schema_version !== "agentera.v2CutoverDeletionInventory.v1"
|
|
242
|
+
|| deletionInventory.approval_gate !== "approved_stable_cutover"
|
|
243
|
+
|| deletionInventory.policy !== "delete_only_after_approved_stable_cutover") {
|
|
244
|
+
errors.push("cutover_deletion_inventory must be approval-gated v2 deletion inventory");
|
|
245
|
+
}
|
|
246
|
+
const deletionEntries = Array.isArray(deletionInventory?.entries)
|
|
247
|
+
? deletionInventory.entries
|
|
248
|
+
: [];
|
|
249
|
+
const actualDeletionEntries = deletionEntries.flatMap((entry) => isMapping(entry) && typeof entry.path === "string" && typeof entry.responsibility === "string"
|
|
250
|
+
? [[entry.path, entry.responsibility]]
|
|
251
|
+
: []);
|
|
252
|
+
if (JSON.stringify(actualDeletionEntries) !== JSON.stringify(CUTOVER_DELETION_INVENTORY)) {
|
|
253
|
+
errors.push("cutover_deletion_inventory must identify every quarantined v2 source, shim, and fixture path");
|
|
254
|
+
}
|
|
255
|
+
return errors;
|
|
256
|
+
}
|
|
257
|
+
function expandResource(resource, hostSupportStatus) {
|
|
258
|
+
const descriptorNames = stringList(resource.descriptors);
|
|
259
|
+
const ids = descriptorNames.length > 0
|
|
260
|
+
? descriptorNames.map((name) => `${resource.id}.${name}`)
|
|
261
|
+
: [resource.id];
|
|
262
|
+
return ids.map((id, index) => ({
|
|
263
|
+
id,
|
|
264
|
+
historicalIds: stringList(resource.historical_ids).map((historicalId) => descriptorNames.length > 0
|
|
265
|
+
? historicalId.replace("{descriptor}", descriptorNames[index])
|
|
266
|
+
: historicalId),
|
|
267
|
+
host: resource.host,
|
|
268
|
+
hostSupportStatus,
|
|
269
|
+
kind: resource.kind,
|
|
270
|
+
destination: descriptorNames.length > 0
|
|
271
|
+
? resource.destination.replace("{descriptor}", descriptorNames[index])
|
|
272
|
+
: resource.destination,
|
|
273
|
+
ledgerStatus: resource.ledger_status,
|
|
274
|
+
durableProof: resource.durable_proof,
|
|
275
|
+
neverTouch: stringList(resource.never_touch),
|
|
276
|
+
safetyNote: resource.safety_note ?? "",
|
|
277
|
+
}));
|
|
278
|
+
}
|
|
279
|
+
export function loadNativeResourceCleanupContract(contractPath = path.join(resolveSourceRoot(), NATIVE_RESOURCE_CLEANUP_CONTRACT_RELATIVE_PATH)) {
|
|
280
|
+
const data = loadYamlMapping(fs.readFileSync(contractPath, "utf8"));
|
|
281
|
+
const errors = validateNativeResourceCleanupContractData(data);
|
|
282
|
+
if (errors.length > 0)
|
|
283
|
+
throw new Error(`Native resource cleanup contract validation failed: ${errors.join("; ")}`);
|
|
284
|
+
// The cleanup contract declares the authority and operation-contract paths.
|
|
285
|
+
// Load their adapter chain before using cleanup definitions so migration data
|
|
286
|
+
// cannot look valid while its declared compatibility contracts have drifted.
|
|
287
|
+
const authority = loadLifecycleAuthority();
|
|
288
|
+
loadRuntimeLifecycleAdapterContract(undefined, authority);
|
|
289
|
+
loadLifecycleOperationContract();
|
|
290
|
+
const statuses = new Map(data.hosts.map((host) => [
|
|
291
|
+
host.id,
|
|
292
|
+
host.support_status,
|
|
293
|
+
]));
|
|
294
|
+
return {
|
|
295
|
+
sourcePath: contractPath,
|
|
296
|
+
resourceVocabulary: data.resource_vocabulary.map((entry) => ({
|
|
297
|
+
id: entry.id,
|
|
298
|
+
resourceClass: entry.resource_class,
|
|
299
|
+
migrationScope: entry.migration_scope,
|
|
300
|
+
resourceIds: stringList(entry.resource_ids),
|
|
301
|
+
historicalIds: stringList(entry.historical_ids),
|
|
302
|
+
})),
|
|
303
|
+
diagnosticMaximumResources: data.diagnostic_inventory.maximum_resources,
|
|
304
|
+
diagnosticMaximumFileBytes: data.diagnostic_inventory.maximum_file_bytes,
|
|
305
|
+
diagnosticResources: data.diagnostic_inventory.resources.map((entry) => ({
|
|
306
|
+
id: entry.id,
|
|
307
|
+
vocabulary: entry.vocabulary,
|
|
308
|
+
names: stringList(entry.names),
|
|
309
|
+
destinations: stringList(entry.destinations),
|
|
310
|
+
contains: typeof entry.contains === "string" ? entry.contains : null,
|
|
311
|
+
})),
|
|
312
|
+
resources: data.resources.flatMap((resource) => expandResource(resource, statuses.get(resource.host))),
|
|
313
|
+
configuration: data.configuration_inventory.map((unit) => ({
|
|
314
|
+
id: unit.id,
|
|
315
|
+
host: unit.host,
|
|
316
|
+
destination: unit.destination,
|
|
317
|
+
key: unit.key,
|
|
318
|
+
})),
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
export function nativeResourceCleanupIds(contract = loadNativeResourceCleanupContract()) {
|
|
322
|
+
return contract.resources.map((resource) => resource.id);
|
|
323
|
+
}
|
|
324
|
+
export function retiredResourceDiagnosticIds(contract = loadNativeResourceCleanupContract()) {
|
|
325
|
+
return contract.diagnosticResources.flatMap((resource) => resource.id.includes("{name}")
|
|
326
|
+
? resource.names.map((name) => resource.id.replace("{name}", name))
|
|
327
|
+
: [resource.id]).sort();
|
|
328
|
+
}
|
|
329
|
+
export function nativeResourceCleanupHistoricalIds(contract = loadNativeResourceCleanupContract()) {
|
|
330
|
+
return contract.resources.flatMap((resource) => resource.historicalIds);
|
|
331
|
+
}
|
|
332
|
+
export function resolveNativeResourceCleanupId(resourceId, contract = loadNativeResourceCleanupContract()) {
|
|
333
|
+
const matches = contract.resources.filter((resource) => resource.id === resourceId || resource.historicalIds.includes(resourceId));
|
|
334
|
+
return matches.length === 1 ? matches[0] : null;
|
|
335
|
+
}
|
|
336
|
+
export function validateNativeResourceCleanupContractRoot(root = resolveSourceRoot()) {
|
|
337
|
+
const contractPath = path.join(root, NATIVE_RESOURCE_CLEANUP_CONTRACT_RELATIVE_PATH);
|
|
338
|
+
if (!fs.existsSync(contractPath)) {
|
|
339
|
+
return [`${NATIVE_RESOURCE_CLEANUP_CONTRACT_RELATIVE_PATH}: missing native resource cleanup contract`];
|
|
340
|
+
}
|
|
341
|
+
try {
|
|
342
|
+
return validateNativeResourceCleanupContractData(loadYamlMapping(fs.readFileSync(contractPath, "utf8"))).map((error) => `${NATIVE_RESOURCE_CLEANUP_CONTRACT_RELATIVE_PATH}: ${error}`);
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
return [`${NATIVE_RESOURCE_CLEANUP_CONTRACT_RELATIVE_PATH}: could not parse contract: ${error.message}`];
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
function expandHome(template, home) {
|
|
349
|
+
if (!template.startsWith("{home}/") || template.includes("..")) {
|
|
350
|
+
throw new Error(`unsafe native resource destination template: ${template}`);
|
|
351
|
+
}
|
|
352
|
+
return path.join(path.resolve(home), template.slice("{home}/".length));
|
|
353
|
+
}
|
|
354
|
+
function ledgerDiagnostics(plan, resource) {
|
|
355
|
+
const ledger = plan.request.ledger ?? emptyLifecycleOwnershipLedger();
|
|
356
|
+
const planned = plan.operations[0];
|
|
357
|
+
if (planned?.action === "noop")
|
|
358
|
+
return [];
|
|
359
|
+
const records = ledger.records.filter((record) => record.resourceId === resource.id);
|
|
360
|
+
if (records.length !== 1)
|
|
361
|
+
return [`${resource.id}: cleanup requires exactly one ownership ledger record`];
|
|
362
|
+
const record = records[0];
|
|
363
|
+
if (record.status !== resource.ledgerStatus
|
|
364
|
+
|| record.scope !== "whole"
|
|
365
|
+
|| path.resolve(record.destination) !== path.resolve(plan.request.operations[0].destination)
|
|
366
|
+
|| record.kind !== resource.kind
|
|
367
|
+
|| record.identity === null
|
|
368
|
+
|| record.fingerprint === null) {
|
|
369
|
+
return [`${resource.id}: cleanup requires matching whole-resource ${resource.ledgerStatus} ledger identity and fingerprint`];
|
|
370
|
+
}
|
|
371
|
+
return [];
|
|
372
|
+
}
|
|
373
|
+
function blockedPlan(plan, diagnostics, invalidLedger = false) {
|
|
374
|
+
const reason = `${diagnostics.join("; ")} ${LIFECYCLE_MANUAL_REVIEW_GUIDANCE}`;
|
|
375
|
+
return {
|
|
376
|
+
...plan,
|
|
377
|
+
operations: plan.operations.map((operation) => operation.action === "noop" ? operation : {
|
|
378
|
+
...operation,
|
|
379
|
+
...(invalidLedger ? { state: "ambiguous_ownership", ownership: "ambiguous" } : {}),
|
|
380
|
+
action: "action_required",
|
|
381
|
+
reason,
|
|
382
|
+
}),
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
function configurationUnitsFor(contract, host) {
|
|
386
|
+
return contract.configuration
|
|
387
|
+
.filter((unit) => unit.host === host)
|
|
388
|
+
.map((unit) => ({
|
|
389
|
+
id: unit.id,
|
|
390
|
+
hostId: unit.host,
|
|
391
|
+
key: unit.key,
|
|
392
|
+
status: "action_required",
|
|
393
|
+
reason: "no durable key-level ownership ledger identity and fingerprint",
|
|
394
|
+
}));
|
|
395
|
+
}
|
|
396
|
+
function canonicalizeHistoricalOwnershipIds(ledger, resource) {
|
|
397
|
+
if (resource.historicalIds.length === 0)
|
|
398
|
+
return ledger;
|
|
399
|
+
return {
|
|
400
|
+
...ledger,
|
|
401
|
+
records: ledger.records.map((record) => resource.historicalIds.includes(record.resourceId)
|
|
402
|
+
? { ...record, resourceId: resource.id }
|
|
403
|
+
: record),
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
export function previewNativeResourceCleanup(opts) {
|
|
407
|
+
const contract = opts.contract ?? loadNativeResourceCleanupContract();
|
|
408
|
+
const resource = resolveNativeResourceCleanupId(opts.resourceId, contract);
|
|
409
|
+
if (!resource)
|
|
410
|
+
throw new Error(`unknown native Agentera resource cleanup id: ${opts.resourceId}`);
|
|
411
|
+
const operations = [{
|
|
412
|
+
id: resource.id,
|
|
413
|
+
destination: expandHome(resource.destination, opts.home),
|
|
414
|
+
kind: resource.kind,
|
|
415
|
+
intent: "remove",
|
|
416
|
+
required: true,
|
|
417
|
+
}];
|
|
418
|
+
const suppliedLedger = opts.ledger ?? emptyLifecycleOwnershipLedger();
|
|
419
|
+
const errors = validateLifecycleOwnershipLedger(suppliedLedger);
|
|
420
|
+
const ledger = errors.length === 0
|
|
421
|
+
? canonicalizeHistoricalOwnershipIds(suppliedLedger, resource)
|
|
422
|
+
: emptyLifecycleOwnershipLedger();
|
|
423
|
+
const plan = planLifecycleOperations({
|
|
424
|
+
allowedRoots: [path.resolve(opts.home)],
|
|
425
|
+
operations,
|
|
426
|
+
manifest: createLifecycleOwnershipManifest(operations),
|
|
427
|
+
ledger,
|
|
428
|
+
});
|
|
429
|
+
const diagnostics = errors.length > 0
|
|
430
|
+
? errors.map((error) => `invalid ownership ledger: ${error}`)
|
|
431
|
+
: ledgerDiagnostics(plan, resource);
|
|
432
|
+
return {
|
|
433
|
+
schemaVersion: "agentera.nativeResourceCleanupPreview.v1",
|
|
434
|
+
mode: "preview",
|
|
435
|
+
resourceId: resource.id,
|
|
436
|
+
hostId: resource.host,
|
|
437
|
+
hostSupportStatus: resource.hostSupportStatus,
|
|
438
|
+
ledgerStatus: resource.ledgerStatus,
|
|
439
|
+
approvalRequired: true,
|
|
440
|
+
ownershipRequirement: "matching_whole_resource_ledger",
|
|
441
|
+
ledgerAuthorization: diagnostics.length === 0 ? "match_or_absent_noop" : "blocked",
|
|
442
|
+
ledgerDiagnostics: diagnostics,
|
|
443
|
+
plan: diagnostics.length === 0 ? plan : blockedPlan(plan, diagnostics, errors.length > 0),
|
|
444
|
+
configurationUnits: configurationUnitsFor(contract, resource.host),
|
|
445
|
+
neverTouch: resource.neverTouch.map((entry) => expandHome(entry, opts.home)),
|
|
446
|
+
safetyNote: resource.safetyNote,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
function approvalRequiredResult(preview) {
|
|
450
|
+
const operations = preview.plan.operations.map((operation) => ({
|
|
451
|
+
...operation,
|
|
452
|
+
action: operation.action === "noop" || operation.action === "blocked_unowned" ? operation.action : "action_required",
|
|
453
|
+
status: operation.action === "noop" ? "noop" : operation.action === "blocked_unowned" ? "blocked_unowned" : "action_required",
|
|
454
|
+
dependencyCauses: [],
|
|
455
|
+
reason: operation.action === "noop" || operation.action === "blocked_unowned"
|
|
456
|
+
? operation.reason
|
|
457
|
+
: "explicit cleanup approval is required",
|
|
458
|
+
}));
|
|
459
|
+
const summary = {
|
|
460
|
+
applied: 0,
|
|
461
|
+
noop: operations.filter((item) => item.status === "noop").length,
|
|
462
|
+
failed: 0,
|
|
463
|
+
blocked_unowned: operations.filter((item) => item.status === "blocked_unowned").length,
|
|
464
|
+
skipped_dependency: 0,
|
|
465
|
+
action_required: operations.filter((item) => item.status === "action_required").length,
|
|
466
|
+
};
|
|
467
|
+
return {
|
|
468
|
+
schemaVersion: "agentera.lifecycleApplyResult.v1",
|
|
469
|
+
status: operations.every((item) => item.status === "noop") ? "success" : "non_success",
|
|
470
|
+
operations,
|
|
471
|
+
summary,
|
|
472
|
+
requiredUnmet: operations.filter((item) => item.required && item.status !== "noop").map((item) => item.id),
|
|
473
|
+
ownershipLedger: preview.plan.request.ledger ?? emptyLifecycleOwnershipLedger(),
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
export function applyNativeResourceCleanup(preview, options) {
|
|
477
|
+
const resource = preview.plan.request.operations[0];
|
|
478
|
+
const definition = {
|
|
479
|
+
id: preview.resourceId,
|
|
480
|
+
historicalIds: [],
|
|
481
|
+
host: preview.hostId,
|
|
482
|
+
hostSupportStatus: preview.hostSupportStatus,
|
|
483
|
+
kind: resource.kind,
|
|
484
|
+
destination: resource.destination,
|
|
485
|
+
ledgerStatus: preview.ledgerStatus,
|
|
486
|
+
durableProof: "",
|
|
487
|
+
neverTouch: [],
|
|
488
|
+
safetyNote: "",
|
|
489
|
+
};
|
|
490
|
+
const diagnostics = ledgerDiagnostics(preview.plan, definition);
|
|
491
|
+
const authorized = preview.ledgerAuthorization === "match_or_absent_noop" && diagnostics.length === 0;
|
|
492
|
+
const result = options.approved && authorized
|
|
493
|
+
? applyLifecycleOperations(preview.plan, options)
|
|
494
|
+
: approvalRequiredResult(preview);
|
|
495
|
+
return {
|
|
496
|
+
...result,
|
|
497
|
+
resourceId: preview.resourceId,
|
|
498
|
+
hostId: preview.hostId,
|
|
499
|
+
hostSupportStatus: preview.hostSupportStatus,
|
|
500
|
+
approval: options.approved ? "approved" : "required",
|
|
501
|
+
configurationUnits: preview.configurationUnits,
|
|
502
|
+
};
|
|
503
|
+
}
|
package/dist/setup/opencode.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { expanduser, resolvePath } from "../core/paths.js";
|
|
3
|
+
/** Migration-only resolver for previously installed OpenCode resources. */
|
|
4
|
+
export function opencodeConfigDir(home, env) {
|
|
5
|
+
const explicit = env.OPENCODE_CONFIG_DIR;
|
|
6
|
+
if (explicit)
|
|
7
|
+
return resolvePath(expanduser(explicit));
|
|
8
|
+
const xdg = env.XDG_CONFIG_HOME;
|
|
9
|
+
if (xdg)
|
|
10
|
+
return path.join(resolvePath(expanduser(xdg)), "opencode");
|
|
11
|
+
return path.join(home, ".config", "opencode");
|
|
12
|
+
}
|
|
13
|
+
/** Migration-only ownership marker reader. */
|
|
14
|
+
export function hasManagedMarker(text) {
|
|
15
|
+
const lines = text.split("\n");
|
|
16
|
+
if (lines[0] !== "---")
|
|
17
|
+
return false;
|
|
18
|
+
const closing = lines.indexOf("---", 1);
|
|
19
|
+
return closing !== -1 && lines.slice(1, closing).some((line) => line.trim() === "agentera_managed: true");
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const OPENCODE_SKILL_NAMES = ["agentera", "status"];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { pathExists } from "../core/paths.js";
|
|
4
|
+
import { declaresAgenteraSkill } from "../core/skillIdentity.js";
|
|
5
|
+
export const CANONICAL_SHARED_SKILL_PATH = "~/.agents/skills/agentera";
|
|
6
|
+
function isSymlink(target) {
|
|
7
|
+
try {
|
|
8
|
+
return fs.lstatSync(target).isSymbolicLink();
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function diagnoseCanonicalSkill(home) {
|
|
15
|
+
const target = path.join(home, CANONICAL_SHARED_SKILL_PATH.slice(2));
|
|
16
|
+
const skillFile = path.join(target, "SKILL.md");
|
|
17
|
+
if (fs.existsSync(skillFile) &&
|
|
18
|
+
declaresAgenteraSkill(fs.readFileSync(skillFile, "utf8").slice(0, 64 * 1024))) {
|
|
19
|
+
return {
|
|
20
|
+
name: "canonical_skill",
|
|
21
|
+
status: "pass",
|
|
22
|
+
message: "canonical shared Agentera skill resolves to SKILL.md",
|
|
23
|
+
source: null,
|
|
24
|
+
path: target,
|
|
25
|
+
gap: null,
|
|
26
|
+
details: [],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
const details = [
|
|
30
|
+
`action: install or repair the shared Agentera skill at \`${CANONICAL_SHARED_SKILL_PATH}\``,
|
|
31
|
+
"action: use the Agentera CLI directly; runtime-native installation is retired",
|
|
32
|
+
];
|
|
33
|
+
if (pathExists(target) || isSymlink(target)) {
|
|
34
|
+
details.unshift("existing target preserved; review and repair the shared-skill path manually");
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
name: "canonical_skill",
|
|
38
|
+
status: "warn",
|
|
39
|
+
message: "canonical shared Agentera skill is missing or invalid",
|
|
40
|
+
source: null,
|
|
41
|
+
path: target,
|
|
42
|
+
gap: "skill_path_drift",
|
|
43
|
+
details,
|
|
44
|
+
};
|
|
45
|
+
}
|