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
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { resolveSourceRoot } from "../core/sourceRoot.js";
|
|
4
|
+
import { loadYamlMapping } from "../core/yaml.js";
|
|
5
|
+
import { loadRegistry } from "../registries/packageRegistry.js";
|
|
6
|
+
import { NATIVE_RESOURCE_CLEANUP_CONTRACT_RELATIVE_PATH } from "../runtime/lifecycleAuthority.js";
|
|
7
|
+
export const PRODUCT_V1_RESET_AUTHORITY_RELATIVE_PATH = "references/adapters/product-v1-reset.yaml";
|
|
8
|
+
const PACKAGE_REGISTRY_RELATIVE_PATH = "references/adapters/package-registry.yaml";
|
|
9
|
+
const RUNTIME_LIFECYCLE_RELATIVE_PATH = "references/adapters/runtime-lifecycle-authority.yaml";
|
|
10
|
+
const ALLOWED_ROOTS = new Set(["project", "profile_root", "install_root", "runtime_declared_roots"]);
|
|
11
|
+
function mapping(value, field) {
|
|
12
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
13
|
+
throw new Error(`${field} must be a mapping`);
|
|
14
|
+
}
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
function text(value, field) {
|
|
18
|
+
if (typeof value !== "string" || value.length === 0)
|
|
19
|
+
throw new Error(`${field} must be a non-empty string`);
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
function textList(value, field) {
|
|
23
|
+
if (!Array.isArray(value) || value.length === 0)
|
|
24
|
+
throw new Error(`${field} must be a non-empty string list`);
|
|
25
|
+
return value.map((item, index) => text(item, `${field}[${index}]`));
|
|
26
|
+
}
|
|
27
|
+
function relativePath(value, field) {
|
|
28
|
+
const result = text(value, field);
|
|
29
|
+
if (path.isAbsolute(result) || result.split("/").includes("..")) {
|
|
30
|
+
throw new Error(`${field} must stay within its declared root`);
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
export function loadProductV1ResetAuthority(authorityPath = path.join(resolveSourceRoot(), PRODUCT_V1_RESET_AUTHORITY_RELATIVE_PATH), sourceRoot = resolveSourceRoot()) {
|
|
35
|
+
const data = loadYamlMapping(fs.readFileSync(authorityPath, "utf8"));
|
|
36
|
+
if (data.schema_version !== "agentera.productV1ResetInventory.v1") {
|
|
37
|
+
throw new Error("product v1 reset authority has unsupported schema_version");
|
|
38
|
+
}
|
|
39
|
+
const policy = mapping(data.policy, "policy");
|
|
40
|
+
if (policy.trigger !== "any_declared_product_v1_generation_evidence"
|
|
41
|
+
|| policy.schema_identifier_suffix_is_evidence !== false
|
|
42
|
+
|| policy.discovery !== "declared_roots_only"
|
|
43
|
+
|| policy.preserve_unlisted_state !== true) {
|
|
44
|
+
throw new Error("product v1 reset authority policy must require bounded product-generation evidence");
|
|
45
|
+
}
|
|
46
|
+
const sources = mapping(data.source_authorities, "source_authorities");
|
|
47
|
+
if (sources.retired_resources !== NATIVE_RESOURCE_CLEANUP_CONTRACT_RELATIVE_PATH
|
|
48
|
+
|| sources.package_inventory !== PACKAGE_REGISTRY_RELATIVE_PATH
|
|
49
|
+
|| sources.runtime_lifecycle !== RUNTIME_LIFECYCLE_RELATIVE_PATH) {
|
|
50
|
+
throw new Error("product v1 reset authority must reference the existing runtime and package authorities");
|
|
51
|
+
}
|
|
52
|
+
for (const authority of Object.values(sources)) {
|
|
53
|
+
if (typeof authority !== "string" || !fs.existsSync(path.join(sourceRoot, authority))) {
|
|
54
|
+
throw new Error(`product v1 reset source authority does not exist: ${String(authority)}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const triggers = mapping(data.trigger_evidence, "trigger_evidence");
|
|
58
|
+
if (!Array.isArray(triggers.project_artifacts) || triggers.project_artifacts.length === 0) {
|
|
59
|
+
throw new Error("trigger_evidence.project_artifacts must be non-empty");
|
|
60
|
+
}
|
|
61
|
+
const projectArtifacts = triggers.project_artifacts.map((value, index) => {
|
|
62
|
+
const item = mapping(value, `trigger_evidence.project_artifacts[${index}]`);
|
|
63
|
+
if (item.generation !== "product_v1") {
|
|
64
|
+
throw new Error(`trigger_evidence.project_artifacts[${index}].generation must be product_v1`);
|
|
65
|
+
}
|
|
66
|
+
if (typeof item.triggers_reset !== "boolean") {
|
|
67
|
+
throw new Error(`trigger_evidence.project_artifacts[${index}].triggers_reset must be boolean`);
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
id: text(item.id, `trigger_evidence.project_artifacts[${index}].id`),
|
|
71
|
+
generation: "product_v1",
|
|
72
|
+
triggersReset: item.triggers_reset === true,
|
|
73
|
+
path: relativePath(item.path, `trigger_evidence.project_artifacts[${index}].path`),
|
|
74
|
+
currentPath: relativePath(item.current_path, `trigger_evidence.project_artifacts[${index}].current_path`),
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
const packageTrigger = mapping(triggers.installation_package, "trigger_evidence.installation_package");
|
|
78
|
+
const packageRecord = loadRegistry(path.join(sourceRoot, PACKAGE_REGISTRY_RELATIVE_PATH), sourceRoot).get("agentera");
|
|
79
|
+
if (packageTrigger.generation !== "product_v1"
|
|
80
|
+
|| packageTrigger.triggers_reset !== true
|
|
81
|
+
|| packageTrigger.authority !== PACKAGE_REGISTRY_RELATIVE_PATH
|
|
82
|
+
|| packageTrigger.manifest !== packageRecord.version_authority.persisted_authority
|
|
83
|
+
|| packageTrigger.selector !== packageRecord.version_authority.selector
|
|
84
|
+
|| packageTrigger.predicate !== "semver_major_equals_1") {
|
|
85
|
+
throw new Error("installation package trigger must use the package inventory's version authority and product-v1 major");
|
|
86
|
+
}
|
|
87
|
+
const runtimeTrigger = mapping(triggers.runtime_resources, "trigger_evidence.runtime_resources");
|
|
88
|
+
if (runtimeTrigger.authority !== NATIVE_RESOURCE_CLEANUP_CONTRACT_RELATIVE_PATH
|
|
89
|
+
|| runtimeTrigger.role !== "reset_scope_only") {
|
|
90
|
+
throw new Error("retired runtime identities must remain reset scope, not product-v1 trigger evidence");
|
|
91
|
+
}
|
|
92
|
+
if (!Array.isArray(data.scope_inventory) || data.scope_inventory.length === 0) {
|
|
93
|
+
throw new Error("scope_inventory must be non-empty");
|
|
94
|
+
}
|
|
95
|
+
const ids = new Set();
|
|
96
|
+
const scope = data.scope_inventory.map((value, index) => {
|
|
97
|
+
const item = mapping(value, `scope_inventory[${index}]`);
|
|
98
|
+
const id = text(item.id, `scope_inventory[${index}].id`);
|
|
99
|
+
const owner = text(item.owner, `scope_inventory[${index}].owner`);
|
|
100
|
+
const action = item.action;
|
|
101
|
+
const boundedRoot = item.bounded_root;
|
|
102
|
+
if (ids.has(id))
|
|
103
|
+
throw new Error(`scope_inventory has duplicate id: ${id}`);
|
|
104
|
+
if (action !== "delete" && action !== "recreate")
|
|
105
|
+
throw new Error(`scope_inventory[${index}].action is invalid`);
|
|
106
|
+
if (typeof boundedRoot !== "string" || !ALLOWED_ROOTS.has(boundedRoot)) {
|
|
107
|
+
throw new Error(`scope_inventory[${index}].bounded_root is invalid`);
|
|
108
|
+
}
|
|
109
|
+
ids.add(id);
|
|
110
|
+
return {
|
|
111
|
+
id,
|
|
112
|
+
action: action,
|
|
113
|
+
owner,
|
|
114
|
+
boundedRoot: boundedRoot,
|
|
115
|
+
targets: textList(item.targets, `scope_inventory[${index}].targets`).map((target, targetIndex) => relativePath(target, `scope_inventory[${index}].targets[${targetIndex}]`)),
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
return {
|
|
119
|
+
sourcePath: authorityPath,
|
|
120
|
+
projectArtifacts,
|
|
121
|
+
installationPackage: {
|
|
122
|
+
manifest: packageTrigger.manifest,
|
|
123
|
+
selector: packageTrigger.selector,
|
|
124
|
+
predicate: "semver_major_equals_1",
|
|
125
|
+
},
|
|
126
|
+
scope,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export function productV1ArtifactPairs() {
|
|
130
|
+
return loadProductV1ResetAuthority().projectArtifacts.map(({ path: legacyPath, currentPath }) => [legacyPath, currentPath]);
|
|
131
|
+
}
|
|
132
|
+
export function productV1ProjectTriggerPaths() {
|
|
133
|
+
return loadProductV1ResetAuthority().projectArtifacts
|
|
134
|
+
.filter(({ triggersReset }) => triggersReset)
|
|
135
|
+
.map(({ path: legacyPath }) => legacyPath);
|
|
136
|
+
}
|
|
137
|
+
export function isProductV1PackageVersion(version) {
|
|
138
|
+
return /^1\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(version);
|
|
139
|
+
}
|
|
@@ -1,84 +1,38 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolvePath } from "../core/paths.js";
|
|
2
2
|
import { isNpxBundleRoot } from "../core/sourceRoot.js";
|
|
3
|
-
import { APP_MIGRATION_NEEDED, APP_OUTDATED, APP_REPAIR_NEEDED, APP_UP_TO_DATE, } from "./doctor.js";
|
|
3
|
+
import { APP_MIGRATION_NEEDED, APP_MANUAL_REVIEW_NEEDED, APP_OUTDATED, APP_REPAIR_NEEDED, APP_UP_TO_DATE, } from "./doctor.js";
|
|
4
4
|
import { resolveNpxPlatformStatus } from "./npxPlatformStatus.js";
|
|
5
5
|
import { classifyInstall, crossMajorBoundaryApplies } from "./compatibility.js";
|
|
6
6
|
import { resolveInvokedUpdateChannel } from "./channels.js";
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { projectHasProjectLevelRuntimeHooks, textUsesPythonManagedEntrypoint, } from "./runtimeMigration.js";
|
|
7
|
+
import { planRuntimeRetirementPhase, } from "./migrateArtifactsV2ToV3.js";
|
|
8
|
+
import { projectHasProjectLevelRuntimeHooks, } from "./runtimeMigration.js";
|
|
10
9
|
import { isStableSuccessorAnnounced } from "./nextMajorDoctor.js";
|
|
11
10
|
import { buildUpgradeCommands } from "./upgradeCommands.js";
|
|
12
|
-
import { classifyIntegrationScenario, integrationScenarioMessage,
|
|
11
|
+
import { classifyIntegrationScenario, integrationScenarioMessage, integrationExit, integrationPhase, } from "./projectIntegrationDecision.js";
|
|
13
12
|
import { classifyUpgradeOutcome, parseSemverMajor, resolveRunningVersion, shouldIncludeCrossMajorPlanItems, } from "./versionResolution.js";
|
|
14
13
|
const MAJOR_BOUNDARY_BLOCK_MESSAGE_PREFIX = "v3 successor line is not announced yet; v2 managed app files remain current on the";
|
|
15
14
|
function majorBoundaryBlockMessage(channelName) {
|
|
16
15
|
const label = channelName.trim() || "current";
|
|
17
16
|
return `${MAJOR_BOUNDARY_BLOCK_MESSAGE_PREFIX} ${label} channel`;
|
|
18
17
|
}
|
|
19
|
-
function migrationContext(args, channel) {
|
|
20
|
-
const home = resolvePath(expanduser(args.home));
|
|
21
|
-
const env = { ...(args.env ?? process.env), HOME: home };
|
|
22
|
-
return {
|
|
23
|
-
appHome: args.installRoot,
|
|
24
|
-
project: resolvePath(args.project),
|
|
25
|
-
home,
|
|
26
|
-
sourceRoot: args.sourceRoot,
|
|
27
|
-
channel: args.channel ?? channel.channel,
|
|
28
|
-
env,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
const RUNTIME_MIGRATION_ACTIONS = new Set([
|
|
32
|
-
"rewire-runtime",
|
|
33
|
-
"retire-hooks",
|
|
34
|
-
"copy-plugin",
|
|
35
|
-
"copy-agent",
|
|
36
|
-
"copy-command",
|
|
37
|
-
"link-skill",
|
|
38
|
-
]);
|
|
39
18
|
function isPendingRuntimeMigrationItem(item) {
|
|
40
19
|
if (item.status !== "pending" || item.action === "configure") {
|
|
41
20
|
return false;
|
|
42
21
|
}
|
|
43
|
-
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
if (item.action === "rewire-runtime") {
|
|
47
|
-
if (!item.source) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
return textUsesPythonManagedEntrypoint(fs.readFileSync(item.source, "utf8"));
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return RUNTIME_MIGRATION_ACTIONS.has(item.action);
|
|
22
|
+
return true;
|
|
58
23
|
}
|
|
59
24
|
function isGlobalStaleRuntimeItem(item, ctx) {
|
|
60
25
|
const homeRoot = resolvePath(ctx.home);
|
|
61
26
|
if (!item.source?.startsWith(homeRoot)) {
|
|
62
27
|
return false;
|
|
63
28
|
}
|
|
64
|
-
if (item.action === "
|
|
29
|
+
if (item.action === "retire-hooks") {
|
|
65
30
|
return true;
|
|
66
31
|
}
|
|
67
|
-
if (item.action === "copy-plugin" && item.target) {
|
|
68
|
-
try {
|
|
69
|
-
if (isFile(item.target)) {
|
|
70
|
-
return textUsesPythonManagedEntrypoint(fs.readFileSync(item.target, "utf8"));
|
|
71
|
-
}
|
|
72
|
-
return item.source ? textUsesPythonManagedEntrypoint(fs.readFileSync(item.source, "utf8")) : false;
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
32
|
return false;
|
|
79
33
|
}
|
|
80
|
-
export function pendingRuntimeMigrationItems(ctx) {
|
|
81
|
-
const phase =
|
|
34
|
+
export function pendingRuntimeMigrationItems(ctx, resolvedChannel) {
|
|
35
|
+
const phase = planRuntimeRetirementPhase(ctx, resolvedChannel);
|
|
82
36
|
const projectRoot = resolvePath(ctx.project);
|
|
83
37
|
const hasProjectHooks = projectHasProjectLevelRuntimeHooks(ctx.project);
|
|
84
38
|
return phase.items.filter((item) => {
|
|
@@ -111,16 +65,22 @@ function resolveIntegrationTargets(args) {
|
|
|
111
65
|
project: args.project,
|
|
112
66
|
env: args.env,
|
|
113
67
|
});
|
|
68
|
+
// The executing npm bundle is already a complete app. A missing optional
|
|
69
|
+
// platform install therefore needs no integration work, while an existing
|
|
70
|
+
// stale or damaged platform install still retains its observed status.
|
|
71
|
+
const platformBundleStatus = platformStatus.rootStatus === "missing"
|
|
72
|
+
? APP_UP_TO_DATE
|
|
73
|
+
: platformStatus.status;
|
|
114
74
|
return {
|
|
115
75
|
installRoot: platformRoot,
|
|
116
76
|
bundleStatus: args.bundleStatus,
|
|
117
|
-
platformBundleStatus
|
|
77
|
+
platformBundleStatus,
|
|
118
78
|
crossMajorBoundary: Boolean(platformStatus.crossMajorBoundary),
|
|
119
79
|
crossMajorBoundaryDetected: Boolean(platformStatus.crossMajorBoundaryDetected),
|
|
120
80
|
};
|
|
121
81
|
}
|
|
122
82
|
function commandChannel(args, channel, crossMajor, upgradeOutcome) {
|
|
123
|
-
if (crossMajor && !shouldIncludeCrossMajorPlanItems(channel, upgradeOutcome)) {
|
|
83
|
+
if (crossMajor && upgradeOutcome && !shouldIncludeCrossMajorPlanItems(channel, upgradeOutcome)) {
|
|
124
84
|
return resolveInvokedUpdateChannel({
|
|
125
85
|
channel: "development",
|
|
126
86
|
env: args.env,
|
|
@@ -130,115 +90,147 @@ function commandChannel(args, channel, crossMajor, upgradeOutcome) {
|
|
|
130
90
|
}
|
|
131
91
|
return channel;
|
|
132
92
|
}
|
|
93
|
+
function appPhaseBlockers(bundleStatus, majorBoundaryBlock) {
|
|
94
|
+
const blockers = [];
|
|
95
|
+
if (bundleStatus === APP_MANUAL_REVIEW_NEEDED) {
|
|
96
|
+
blockers.push("app: manual review is required before choosing an app write path");
|
|
97
|
+
}
|
|
98
|
+
if (majorBoundaryBlock)
|
|
99
|
+
blockers.push(`app: ${majorBoundaryBlock}`);
|
|
100
|
+
return blockers;
|
|
101
|
+
}
|
|
102
|
+
function retryGuidance(exit) {
|
|
103
|
+
switch (exit.meaning) {
|
|
104
|
+
case "no_changes_needed":
|
|
105
|
+
return "No retry is needed; project integration is converged.";
|
|
106
|
+
case "preview_required":
|
|
107
|
+
return "Apply the approved preview, then retry Agentera to re-observe project integration.";
|
|
108
|
+
case "preview_and_blockers":
|
|
109
|
+
return "Resolve the reported blockers, apply the approved preview, then retry Agentera.";
|
|
110
|
+
case "manual_review_required":
|
|
111
|
+
return "Complete the manual review, then retry Agentera to re-observe project integration.";
|
|
112
|
+
}
|
|
113
|
+
}
|
|
133
114
|
export function summarizeProjectIntegration(args) {
|
|
134
|
-
const channel = resolveInvokedUpdateChannel({
|
|
115
|
+
const channel = args.resolvedChannel ?? resolveInvokedUpdateChannel({
|
|
135
116
|
channel: args.channel ?? null,
|
|
136
117
|
env: args.env,
|
|
137
118
|
home: args.home,
|
|
138
119
|
sourceRoot: args.sourceRoot,
|
|
139
120
|
});
|
|
140
121
|
const integrationTargets = resolveIntegrationTargets(args);
|
|
141
|
-
const install = classifyInstall({ appHome: integrationTargets.installRoot, sourceRoot: args.sourceRoot });
|
|
122
|
+
const install = args.installClassification ?? classifyInstall({ appHome: integrationTargets.installRoot, sourceRoot: args.sourceRoot });
|
|
142
123
|
const crossMajorDetected = args.crossMajorBoundaryDetected ??
|
|
143
124
|
crossMajorBoundaryApplies(install, args.sourceRoot);
|
|
144
|
-
const successorAnnounced = isStableSuccessorAnnounced(args.sourceRoot, "stable");
|
|
125
|
+
const successorAnnounced = args.successorAnnounced ?? isStableSuccessorAnnounced(args.sourceRoot, "stable");
|
|
145
126
|
const crossMajor = crossMajorDetected && successorAnnounced;
|
|
146
|
-
const runningMajor =
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const upgradeOutcome = classifyUpgradeOutcome({
|
|
127
|
+
const runningMajor = crossMajorDetected
|
|
128
|
+
? parseSemverMajor(resolveRunningVersion({
|
|
129
|
+
appHome: integrationTargets.installRoot,
|
|
130
|
+
sourceRoot: args.sourceRoot,
|
|
131
|
+
install,
|
|
132
|
+
})) ?? 0
|
|
133
|
+
: 0;
|
|
134
|
+
const majorBoundaryBlock = crossMajorDetected && !successorAnnounced && runningMajor > 0 && runningMajor < 3
|
|
135
|
+
? majorBoundaryBlockMessage(channel.channel)
|
|
136
|
+
: null;
|
|
137
|
+
const upgradeOutcome = crossMajor
|
|
138
|
+
? classifyUpgradeOutcome({
|
|
139
|
+
appHome: integrationTargets.installRoot,
|
|
140
|
+
sourceRoot: args.sourceRoot,
|
|
141
|
+
install,
|
|
142
|
+
channel,
|
|
143
|
+
})
|
|
144
|
+
: null;
|
|
145
|
+
const pendingProjectMigration = pendingRuntimeMigrationItems({
|
|
166
146
|
appHome: integrationTargets.installRoot,
|
|
147
|
+
project: args.project,
|
|
148
|
+
home: args.home,
|
|
149
|
+
force: false,
|
|
167
150
|
sourceRoot: args.sourceRoot,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
});
|
|
171
|
-
const
|
|
172
|
-
const v1Artifacts = detectV1ArtifactPairs(args.project);
|
|
173
|
-
const pending = pendingRuntimeMigrationItems(ctx);
|
|
174
|
-
const pendingRuntimes = [
|
|
175
|
-
...new Set(pending.map((item) => item.runtime).filter((runtime) => Boolean(runtime))),
|
|
176
|
-
];
|
|
177
|
-
const crossMajorMigration = crossMajor && shouldIncludeCrossMajorPlanItems(channel, upgradeOutcome);
|
|
178
|
-
const crossMajorNeedsPreview = crossMajor && !crossMajorMigration;
|
|
151
|
+
channel: args.channel ?? null,
|
|
152
|
+
env: args.env,
|
|
153
|
+
}, channel);
|
|
154
|
+
const crossMajorMigration = crossMajor && upgradeOutcome !== null && shouldIncludeCrossMajorPlanItems(channel, upgradeOutcome);
|
|
179
155
|
const isNpx = isNpxBundleRoot(args.sourceRoot);
|
|
180
156
|
const classificationBundleStatus = isNpx && integrationTargets.platformBundleStatus !== undefined
|
|
181
157
|
? integrationTargets.platformBundleStatus
|
|
182
158
|
: integrationTargets.bundleStatus;
|
|
183
159
|
const needsAppUpgrade = isNpx && integrationTargets.bundleStatus === APP_UP_TO_DATE
|
|
184
|
-
? appNeedsUpgrade(integrationTargets.platformBundleStatus ?? APP_UP_TO_DATE)
|
|
185
|
-
pending.length === 0 &&
|
|
186
|
-
v1Artifacts.length === 0
|
|
160
|
+
? appNeedsUpgrade(integrationTargets.platformBundleStatus ?? APP_UP_TO_DATE)
|
|
187
161
|
: appNeedsUpgrade(classificationBundleStatus);
|
|
188
|
-
const
|
|
162
|
+
const appPending = pendingProjectMigration.length +
|
|
163
|
+
(needsAppUpgrade ? 1 : 0) +
|
|
164
|
+
(crossMajorMigration ? 1 : 0);
|
|
165
|
+
const appBlockers = appPhaseBlockers(classificationBundleStatus, majorBoundaryBlock);
|
|
166
|
+
const appPhase = integrationPhase({
|
|
167
|
+
total: appPending + appBlockers.length,
|
|
168
|
+
pending: appPending,
|
|
169
|
+
blocked: appBlockers.length,
|
|
170
|
+
blockers: appBlockers,
|
|
171
|
+
});
|
|
172
|
+
const hasUpgradeWork = appPending > 0;
|
|
173
|
+
const hasBlockers = appBlockers.length > 0;
|
|
174
|
+
const aggregateStatus = hasUpgradeWork
|
|
175
|
+
? "upgrade"
|
|
176
|
+
: hasBlockers
|
|
177
|
+
? "blocked"
|
|
178
|
+
: "stay";
|
|
179
|
+
const scenarioFacts = {
|
|
189
180
|
bundleStatus: classificationBundleStatus,
|
|
190
|
-
|
|
191
|
-
pendingArtifactCount: v1Artifacts.length,
|
|
181
|
+
pendingArtifactCount: pendingProjectMigration.length,
|
|
192
182
|
crossMajor,
|
|
193
183
|
crossMajorMigration,
|
|
194
|
-
crossMajorNeedsPreview,
|
|
184
|
+
crossMajorNeedsPreview: Boolean(majorBoundaryBlock) || (crossMajor && !crossMajorMigration),
|
|
195
185
|
needsAppUpgrade,
|
|
196
186
|
};
|
|
197
|
-
const scenario = classifyIntegrationScenario(
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
pending_runtime: 0,
|
|
205
|
-
pending_runtimes: [],
|
|
206
|
-
pending_artifacts: 0,
|
|
207
|
-
dry_run_command: null,
|
|
208
|
-
apply_command: null,
|
|
209
|
-
update_channel: channel.channel,
|
|
210
|
-
major_boundary_block: null,
|
|
211
|
-
};
|
|
212
|
-
}
|
|
187
|
+
const scenario = classifyIntegrationScenario(scenarioFacts);
|
|
188
|
+
const guidanceMessage = appBlockers.length > 0
|
|
189
|
+
? appBlockers.join("; ")
|
|
190
|
+
: hasUpgradeWork
|
|
191
|
+
? "Preview the app or project-state upgrade, then apply the approved command."
|
|
192
|
+
: "No app or project-state upgrade is required.";
|
|
193
|
+
const exit = integrationExit(hasUpgradeWork, appBlockers.length > 0);
|
|
213
194
|
const cmdsChannel = commandChannel(args, channel, crossMajor, upgradeOutcome);
|
|
214
|
-
const cmds =
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
195
|
+
const cmds = hasUpgradeWork
|
|
196
|
+
? buildUpgradeCommands({
|
|
197
|
+
project: args.project,
|
|
198
|
+
installRoot: null,
|
|
199
|
+
channel: cmdsChannel,
|
|
200
|
+
only: null,
|
|
201
|
+
cwdDefault: true,
|
|
202
|
+
})
|
|
203
|
+
: null;
|
|
204
|
+
const message = hasUpgradeWork
|
|
205
|
+
? `${integrationScenarioMessage(scenario, scenarioFacts)} ${guidanceMessage}`
|
|
206
|
+
: guidanceMessage;
|
|
221
207
|
return {
|
|
222
|
-
recommendation: "upgrade",
|
|
208
|
+
recommendation: aggregateStatus === "upgrade" ? "upgrade" : "stay",
|
|
223
209
|
message,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
210
|
+
pending_artifacts: pendingProjectMigration.length,
|
|
211
|
+
dry_run_command: cmds?.dryRunCommand ?? null,
|
|
212
|
+
apply_command: cmds?.applyCommand ?? null,
|
|
213
|
+
update_channel: hasUpgradeWork ? cmdsChannel.channel : channel.channel,
|
|
214
|
+
major_boundary_block: majorBoundaryBlock,
|
|
215
|
+
phases: {
|
|
216
|
+
app: appPhase,
|
|
217
|
+
},
|
|
218
|
+
aggregate_status: aggregateStatus,
|
|
219
|
+
exit,
|
|
220
|
+
retry: {
|
|
221
|
+
command: args.retryCommand ?? null,
|
|
222
|
+
guidance: retryGuidance(exit),
|
|
223
|
+
},
|
|
232
224
|
};
|
|
233
225
|
}
|
|
234
226
|
export function projectIntegrationAttention(summary) {
|
|
235
|
-
if (summary.recommendation === "stay") {
|
|
227
|
+
if (summary.recommendation === "stay" && summary.aggregate_status === "stay") {
|
|
236
228
|
return null;
|
|
237
229
|
}
|
|
238
230
|
const preview = summary.dry_run_command ? `\`${summary.dry_run_command}\`` : "the preview command";
|
|
239
|
-
const prefix = summary.pending_artifacts > 0
|
|
231
|
+
const prefix = summary.pending_artifacts > 0
|
|
240
232
|
? "normal"
|
|
241
233
|
: "degraded";
|
|
242
|
-
|
|
234
|
+
const previewText = summary.dry_run_command ? ` Preview ${preview}.` : "";
|
|
235
|
+
return `${prefix}: ${summary.message}${previewText}`;
|
|
243
236
|
}
|
|
244
|
-
//# sourceMappingURL=projectIntegration.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { APP_MANUAL_REVIEW_NEEDED, APP_UP_TO_DATE } from "./doctor.js";
|
|
2
2
|
export function classifyIntegrationScenario(facts) {
|
|
3
|
-
if (facts.
|
|
4
|
-
facts.pendingArtifactCount === 0 &&
|
|
3
|
+
if (facts.pendingArtifactCount === 0 &&
|
|
5
4
|
!facts.crossMajor &&
|
|
6
5
|
!facts.crossMajorMigration &&
|
|
7
6
|
!facts.crossMajorNeedsPreview &&
|
|
@@ -13,13 +12,6 @@ export function classifyIntegrationScenario(facts) {
|
|
|
13
12
|
}
|
|
14
13
|
return "upgrade";
|
|
15
14
|
}
|
|
16
|
-
export function integrationScenarioRecommendation(scenario) {
|
|
17
|
-
if (scenario === "stay")
|
|
18
|
-
return "stay";
|
|
19
|
-
if (scenario === "blocked")
|
|
20
|
-
return "stay";
|
|
21
|
-
return "upgrade";
|
|
22
|
-
}
|
|
23
15
|
export function integrationScenarioMessage(scenario, facts) {
|
|
24
16
|
if (scenario === "stay")
|
|
25
17
|
return "Your Agentera install is up to date.";
|
|
@@ -27,10 +19,8 @@ export function integrationScenarioMessage(scenario, facts) {
|
|
|
27
19
|
return "Cross-major version boundary detected; v3 successor not yet announced. Stay on the current channel.";
|
|
28
20
|
}
|
|
29
21
|
const reasons = [];
|
|
30
|
-
if (facts.pendingRuntimeCount > 0)
|
|
31
|
-
reasons.push("runtime wiring needs sync");
|
|
32
22
|
if (facts.pendingArtifactCount > 0)
|
|
33
|
-
reasons.push("
|
|
23
|
+
reasons.push("project state needs migration");
|
|
34
24
|
if (facts.needsAppUpgrade)
|
|
35
25
|
reasons.push("app bundle needs update");
|
|
36
26
|
if (facts.crossMajorMigration)
|
|
@@ -39,4 +29,22 @@ export function integrationScenarioMessage(scenario, facts) {
|
|
|
39
29
|
reasons.push("project changes pending");
|
|
40
30
|
return `This project needs an Agentera upgrade (${reasons.join(", ")}). Preview the upgrade command.`;
|
|
41
31
|
}
|
|
42
|
-
|
|
32
|
+
export function integrationPhase(facts, statusOverride) {
|
|
33
|
+
const status = statusOverride ?? (facts.blocked > 0 ? "blocked" : facts.pending > 0 ? "pending" : "stay");
|
|
34
|
+
return {
|
|
35
|
+
status,
|
|
36
|
+
counts: { total: facts.total, pending: facts.pending, blocked: facts.blocked },
|
|
37
|
+
blockers: facts.blockers,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function integrationExit(hasPendingWork, appBlocked) {
|
|
41
|
+
if (!hasPendingWork && !appBlocked) {
|
|
42
|
+
return { code: 0, meaning: "no_changes_needed" };
|
|
43
|
+
}
|
|
44
|
+
if (hasPendingWork && appBlocked) {
|
|
45
|
+
return { code: 1, meaning: "preview_and_blockers" };
|
|
46
|
+
}
|
|
47
|
+
if (hasPendingWork)
|
|
48
|
+
return { code: 1, meaning: "preview_required" };
|
|
49
|
+
return { code: 1, meaning: "manual_review_required" };
|
|
50
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { loadNativeResourceCleanupContract, retiredResourceDiagnosticIds, } from "../runtime/nativeResourceCleanup.js";
|
|
4
|
+
function templateRoot(template, roots) {
|
|
5
|
+
const match = /^\{(home|project|install_root)\}\//.exec(template);
|
|
6
|
+
if (!match)
|
|
7
|
+
throw new Error(`unsafe retired-resource diagnostic path template: ${template}`);
|
|
8
|
+
return roots[match[1]];
|
|
9
|
+
}
|
|
10
|
+
function expandTemplate(template, roots, name) {
|
|
11
|
+
const root = templateRoot(template, roots);
|
|
12
|
+
const expanded = template
|
|
13
|
+
.replace("{home}", roots.home)
|
|
14
|
+
.replace("{project}", roots.project)
|
|
15
|
+
.replace("{install_root}", roots.install_root)
|
|
16
|
+
.replace("{name}", name ?? "");
|
|
17
|
+
if (expanded.includes("{") || expanded.includes("..")) {
|
|
18
|
+
throw new Error(`unsafe retired-resource diagnostic path template: ${template}`);
|
|
19
|
+
}
|
|
20
|
+
const resolved = path.resolve(expanded);
|
|
21
|
+
const relative = path.relative(root, resolved);
|
|
22
|
+
if (relative === "" || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
|
|
23
|
+
throw new Error(`retired-resource diagnostic path escapes its root: ${template}`);
|
|
24
|
+
}
|
|
25
|
+
return resolved;
|
|
26
|
+
}
|
|
27
|
+
function fileContains(pathname, marker, maximumFileBytes) {
|
|
28
|
+
let stat;
|
|
29
|
+
try {
|
|
30
|
+
stat = fs.lstatSync(pathname);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error.code === "ENOENT")
|
|
34
|
+
return null;
|
|
35
|
+
return "uninspectable";
|
|
36
|
+
}
|
|
37
|
+
if (!stat.isFile() || stat.size > maximumFileBytes)
|
|
38
|
+
return "uninspectable";
|
|
39
|
+
const fd = fs.openSync(pathname, "r");
|
|
40
|
+
try {
|
|
41
|
+
const content = Buffer.alloc(stat.size);
|
|
42
|
+
fs.readSync(fd, content, 0, content.length, 0);
|
|
43
|
+
return content.toString("utf8").includes(marker) ? "path_present" : null;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return "uninspectable";
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
fs.closeSync(fd);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function observeDestination(pathname, definition, maximumFileBytes) {
|
|
53
|
+
if (definition.contains) {
|
|
54
|
+
const observation = fileContains(pathname, definition.contains, maximumFileBytes);
|
|
55
|
+
return observation ? { path: pathname, observation } : null;
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
fs.lstatSync(pathname);
|
|
59
|
+
return { path: pathname, observation: "path_present" };
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
return error.code === "ENOENT"
|
|
63
|
+
? null
|
|
64
|
+
: { path: pathname, observation: "uninspectable" };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function namesFor(definition) {
|
|
68
|
+
return definition.id.includes("{name}") || definition.destinations.some((item) => item.includes("{name}"))
|
|
69
|
+
? definition.names
|
|
70
|
+
: [""];
|
|
71
|
+
}
|
|
72
|
+
export function diagnoseRetiredResources(opts) {
|
|
73
|
+
const contract = opts.contract ?? loadNativeResourceCleanupContract();
|
|
74
|
+
if (opts.resourceId && !retiredResourceDiagnosticIds(contract).includes(opts.resourceId)) {
|
|
75
|
+
throw new Error(`unknown retired Agentera resource ID: ${opts.resourceId}`);
|
|
76
|
+
}
|
|
77
|
+
const roots = {
|
|
78
|
+
home: path.resolve(opts.home),
|
|
79
|
+
project: path.resolve(opts.project),
|
|
80
|
+
install_root: path.resolve(opts.installRoot),
|
|
81
|
+
};
|
|
82
|
+
const observed = new Map();
|
|
83
|
+
for (const definition of contract.diagnosticResources) {
|
|
84
|
+
for (const name of namesFor(definition)) {
|
|
85
|
+
const id = definition.id.replace("{name}", name);
|
|
86
|
+
if (opts.resourceId && id !== opts.resourceId)
|
|
87
|
+
continue;
|
|
88
|
+
for (const destination of definition.destinations) {
|
|
89
|
+
const pathname = expandTemplate(destination, roots, name || null);
|
|
90
|
+
const observation = observeDestination(pathname, definition, contract.diagnosticMaximumFileBytes);
|
|
91
|
+
if (!observation)
|
|
92
|
+
continue;
|
|
93
|
+
const current = observed.get(id) ?? [];
|
|
94
|
+
current.push(observation);
|
|
95
|
+
observed.set(id, current);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const entries = [...observed.entries()].sort(([left], [right]) => left.localeCompare(right));
|
|
100
|
+
const retained = entries.slice(0, contract.diagnosticMaximumResources).map(([id, observations]) => ({
|
|
101
|
+
id,
|
|
102
|
+
status: "action_required",
|
|
103
|
+
evidence: {
|
|
104
|
+
paths: [...new Set(observations.map((observation) => observation.path))].sort(),
|
|
105
|
+
observation: observations.some((observation) => observation.observation === "uninspectable")
|
|
106
|
+
? "uninspectable"
|
|
107
|
+
: "path_present",
|
|
108
|
+
},
|
|
109
|
+
}));
|
|
110
|
+
return {
|
|
111
|
+
schemaVersion: "agentera.retiredResourceDiagnosis.v1",
|
|
112
|
+
status: retained.length > 0 || entries.length > contract.diagnosticMaximumResources ? "action_required" : "clean",
|
|
113
|
+
selectedResourceId: opts.resourceId ?? null,
|
|
114
|
+
resources: retained,
|
|
115
|
+
omittedResourceCount: Math.max(0, entries.length - retained.length),
|
|
116
|
+
};
|
|
117
|
+
}
|