agentera 3.0.0-dev.4 → 3.0.0-dev.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +108 -22
- package/bundle/.agentera-npx-bundle.json +1 -1
- package/bundle/CHANGELOG.md +1351 -0
- package/bundle/DESIGN.md +229 -0
- package/bundle/LICENSE +201 -0
- package/bundle/README.md +143 -0
- package/bundle/UPGRADE.md +236 -0
- package/bundle/extract-corpus-parity.json +21 -0
- package/bundle/fixtures/routing/hybrid-corpus.yaml +154 -0
- package/bundle/references/adapters/package-publication.json +437 -0
- package/bundle/references/adapters/package-registry.yaml +434 -189
- package/bundle/references/adapters/package-surface-characterization.md +66 -35
- 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 +518 -0
- package/bundle/references/analysis/verification-policy.yaml +191 -0
- package/bundle/references/artifacts/artifact-registry-interface-model.yaml +20 -10
- package/bundle/references/artifacts/glossary-entry-contract.yaml +1254 -0
- package/bundle/references/artifacts/state-storage-authority.yaml +2982 -0
- package/bundle/references/artifacts/verbosity-budget-authority.yaml +42 -0
- package/bundle/references/cli/app-lifecycle-vocabulary.yaml +7 -8
- package/bundle/references/cli/capability-instruction-contract.yaml +97 -59
- package/bundle/references/cli/hybrid-route-contract.yaml +438 -0
- package/bundle/references/cli/routing-model.md +155 -0
- package/bundle/references/cli/trigger-schema-enrichment.md +147 -0
- package/bundle/references/cli/update-channels.yaml +35 -2
- package/bundle/references/cli/vocabulary-index.yaml +23 -20
- package/bundle/references/cli/vocabulary.md +337 -366
- package/bundle/references/meta/retained-reference-authority.yaml +151 -0
- package/bundle/registry.json +14 -14
- package/bundle/skills/agentera/SKILL.md +218 -408
- package/bundle/skills/agentera/capabilities/audit/schemas/artifacts.yaml +84 -0
- package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/audit/schemas/triggers.yaml +25 -0
- package/bundle/skills/agentera/capabilities/{inspektera → audit}/schemas/validation.yaml +37 -18
- package/bundle/skills/agentera/capabilities/build/schemas/artifacts.yaml +102 -0
- package/bundle/skills/agentera/capabilities/{realisera → build}/schemas/exit.yaml +6 -5
- package/bundle/skills/agentera/capabilities/build/schemas/triggers.yaml +27 -0
- package/bundle/skills/agentera/capabilities/build/schemas/validation.yaml +176 -0
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/artifacts.yaml +12 -12
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/exit.yaml +5 -5
- package/bundle/skills/agentera/capabilities/design/schemas/triggers.yaml +16 -0
- package/bundle/skills/agentera/capabilities/{visualisera → design}/schemas/validation.yaml +7 -7
- package/bundle/skills/agentera/capabilities/discuss/schemas/artifacts.yaml +51 -0
- package/bundle/skills/agentera/capabilities/{resonera → discuss}/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/discuss/schemas/triggers.yaml +20 -0
- package/bundle/skills/agentera/capabilities/discuss/schemas/validation.yaml +144 -0
- package/bundle/skills/agentera/capabilities/document/schemas/artifacts.yaml +80 -0
- package/bundle/skills/agentera/capabilities/document/schemas/triggers.yaml +16 -0
- package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/validation.yaml +18 -18
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/artifacts.yaml +18 -18
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/optimize/schemas/triggers.yaml +16 -0
- package/bundle/skills/agentera/capabilities/{optimera → optimize}/schemas/validation.yaml +9 -9
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/artifacts.yaml +76 -0
- package/bundle/skills/agentera/capabilities/{orkestrera → orchestrate}/schemas/exit.yaml +9 -7
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/triggers.yaml +23 -0
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/validation.yaml +121 -0
- package/bundle/skills/agentera/capabilities/plan/schemas/artifacts.yaml +66 -0
- package/bundle/skills/agentera/capabilities/{planera → plan}/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/plan/schemas/triggers.yaml +23 -0
- package/bundle/skills/agentera/capabilities/plan/schemas/validation.yaml +121 -0
- package/bundle/skills/agentera/capabilities/profile/schemas/artifacts.yaml +23 -0
- package/bundle/skills/agentera/capabilities/{profilera → profile}/schemas/exit.yaml +6 -5
- package/bundle/skills/agentera/capabilities/profile/schemas/triggers.yaml +20 -0
- package/bundle/skills/agentera/capabilities/profile/schemas/validation.yaml +115 -0
- package/bundle/skills/agentera/capabilities/research/schemas/artifacts.yaml +24 -0
- package/bundle/skills/agentera/capabilities/research/schemas/triggers.yaml +16 -0
- package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/validation.yaml +2 -2
- package/bundle/skills/agentera/capabilities/status/schemas/artifacts.yaml +73 -0
- package/bundle/skills/agentera/capabilities/status/schemas/triggers.yaml +22 -0
- package/bundle/skills/agentera/capabilities/{hej → status}/schemas/validation.yaml +5 -5
- package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/artifacts.yaml +16 -16
- package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/exit.yaml +7 -6
- package/bundle/skills/agentera/capabilities/vision/schemas/triggers.yaml +23 -0
- package/bundle/skills/agentera/capabilities/{visionera → vision}/schemas/validation.yaml +18 -20
- package/bundle/skills/agentera/capability_schema_contract.yaml +200 -37
- package/bundle/skills/agentera/protocol.yaml +31 -31
- package/bundle/skills/agentera/route-phrases.yaml +81 -0
- package/bundle/skills/agentera/schemas/artifacts/changelog.yaml +5 -4
- package/bundle/skills/agentera/schemas/artifacts/decisions.yaml +40 -22
- package/bundle/skills/agentera/schemas/artifacts/design.yaml +5 -4
- package/bundle/skills/agentera/schemas/artifacts/docs.yaml +15 -19
- package/bundle/skills/agentera/schemas/artifacts/experiments.yaml +145 -14
- package/bundle/skills/agentera/schemas/artifacts/glossary.yaml +82 -0
- package/bundle/skills/agentera/schemas/artifacts/health.yaml +58 -21
- package/bundle/skills/agentera/schemas/artifacts/objective.yaml +22 -8
- package/bundle/skills/agentera/schemas/artifacts/plan.yaml +421 -33
- package/bundle/skills/agentera/schemas/artifacts/progress.yaml +143 -53
- package/bundle/skills/agentera/schemas/artifacts/todo.yaml +345 -31
- package/bundle/skills/agentera/schemas/artifacts/vision.yaml +3 -3
- package/dist/analytics/extractCorpus/cli.js +190 -0
- package/dist/analytics/extractCorpus/copilotSessions.js +275 -0
- package/dist/analytics/extractCorpus/core.js +392 -0
- package/dist/analytics/extractCorpus/corpus.js +167 -0
- package/dist/analytics/extractCorpus/coverageAudit.js +260 -0
- package/dist/analytics/extractCorpus/cursorSessions.js +425 -0
- package/dist/analytics/extractCorpus/evidenceTiers.js +603 -0
- package/dist/analytics/extractCorpus/extractCorpusParity.js +105 -0
- package/dist/analytics/extractCorpus/filesystemSources.js +118 -0
- package/dist/analytics/extractCorpus/index.js +14 -0
- package/dist/analytics/extractCorpus/jsonlSessions.js +204 -0
- package/dist/analytics/extractCorpus/sqliteCaps.js +43 -0
- package/dist/analytics/extractCorpus/sqliteSessions.js +367 -0
- package/dist/analytics/extractCorpus/tierReader.js +108 -0
- package/dist/analytics/extractCorpus.js +2 -1791
- package/dist/analytics/glossaryAdviceResolution.js +166 -0
- package/dist/analytics/glossaryInputAcquisition.js +319 -0
- package/dist/analytics/personalGlossaryAdmission.js +133 -0
- package/dist/analytics/personalGlossaryProfile.js +219 -0
- package/dist/analytics/profileSignals.js +211 -0
- package/dist/analytics/usageStats.js +169 -42
- package/dist/audit/terminologyDrift.js +281 -0
- package/dist/bin/agentera.js +3 -2
- package/dist/capabilities/audit/instructions.js +16 -0
- package/dist/capabilities/build/instructions.js +56 -0
- package/dist/capabilities/design/instructions.js +4 -0
- package/dist/capabilities/discuss/instructions.js +29 -0
- package/dist/capabilities/document/instructions.js +11 -0
- package/dist/capabilities/index.js +40 -0
- package/dist/capabilities/optimize/instructions.js +14 -0
- package/dist/capabilities/orchestrate/instructions.js +40 -0
- package/dist/capabilities/plan/instructions.js +32 -0
- package/dist/capabilities/profile/instructions.js +70 -0
- package/dist/capabilities/research/instructions.js +5 -0
- package/dist/capabilities/status/instructions.js +11 -0
- package/dist/capabilities/status/startupInstructions.js +34 -0
- package/dist/capabilities/vision/instructions.js +4 -0
- package/dist/cli/appContext.js +30 -24
- package/dist/cli/argvalidate.js +0 -1
- package/dist/cli/capabilityContext/benchmark.js +565 -0
- package/dist/cli/capabilityContext/bespoke.js +44 -0
- package/dist/cli/capabilityContext/build.js +242 -0
- package/dist/cli/capabilityContext/closeout.js +233 -0
- package/dist/cli/capabilityContext/contract.js +179 -0
- package/dist/cli/capabilityContext/evidence.js +463 -0
- package/dist/cli/capabilityContext/index.js +3 -0
- package/dist/cli/capabilityContext/orchestration.js +131 -0
- package/dist/cli/capabilityContext/planState.js +260 -0
- package/dist/cli/capabilityContext/progress.js +142 -0
- package/dist/cli/capabilityContext/projectVerification.js +409 -0
- package/dist/cli/capabilityContext/shared.js +83 -0
- package/dist/cli/capabilityContext/slim.js +152 -0
- package/dist/cli/capabilityContext/startup.js +150 -0
- package/dist/cli/capabilityContext/startupAggregation.js +68 -0
- package/dist/cli/capabilityContext/types.js +56 -0
- package/dist/cli/capabilityContext.js +1 -2421
- package/dist/cli/commands/appHome.js +22 -0
- package/dist/cli/commands/capability.js +5 -12
- package/dist/cli/commands/compact.js +41 -13
- package/dist/cli/commands/doctor.js +127 -97
- package/dist/cli/commands/durability.js +81 -0
- package/dist/cli/commands/glossaryAdvice.js +138 -0
- package/dist/cli/commands/lint.js +26 -44
- package/dist/cli/commands/personalGlossary.js +176 -0
- package/dist/cli/commands/prime/briefOrientation.js +747 -0
- package/dist/cli/commands/prime/buildExecutionRequest.js +165 -0
- package/dist/cli/commands/prime/bundleStatus.js +190 -0
- package/dist/cli/commands/prime/collectEntityOrientation.js +311 -0
- package/dist/cli/commands/prime/collectOrientationState.js +212 -0
- package/dist/cli/commands/prime/orientationOutput.js +397 -0
- package/dist/cli/commands/prime/types.js +1 -0
- package/dist/cli/commands/prime/v1Migration.js +38 -0
- package/dist/cli/commands/prime.js +80 -558
- package/dist/cli/commands/profileGrounding.js +55 -0
- package/dist/cli/commands/query.js +78 -53
- package/dist/cli/commands/report.js +96 -25
- package/dist/cli/commands/route.js +142 -0
- package/dist/cli/commands/schema.js +266 -143
- package/dist/cli/commands/state/decisions.js +387 -0
- package/dist/cli/commands/state/docs.js +70 -0
- package/dist/cli/commands/state/experimentRecords.js +151 -0
- package/dist/cli/commands/state/experiments.js +14 -0
- package/dist/cli/commands/state/get.js +129 -0
- package/dist/cli/commands/state/health.js +14 -0
- package/dist/cli/commands/state/index.js +16 -0
- package/dist/cli/commands/state/list.js +194 -0
- package/dist/cli/commands/state/objective.js +25 -0
- package/dist/cli/commands/state/plan.js +14 -0
- 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 +13 -0
- package/dist/cli/commands/state/shared.js +14 -0
- package/dist/cli/commands/state/todo.js +42 -0
- package/dist/cli/commands/state/write.js +434 -0
- package/dist/cli/commands/upgrade.js +146 -5
- package/dist/cli/commands/upgradeVerify.js +118 -0
- package/dist/cli/commands/validate.js +272 -213
- package/dist/cli/commands/verify.js +24 -9
- package/dist/cli/contracts/bundleStatus.js +1 -0
- package/dist/cli/contracts/orientationState.js +1 -0
- package/dist/cli/dispatch/argvParser.js +32 -0
- package/dist/cli/dispatch/check.js +372 -0
- package/dist/cli/dispatch/commands.js +27 -0
- package/dist/cli/dispatch/index.js +207 -0
- package/dist/cli/dispatch/lifecycle.js +652 -0
- package/dist/cli/dispatch/prime.js +139 -0
- package/dist/cli/dispatch/projections.js +17 -0
- package/dist/cli/dispatch/shared.js +63 -0
- package/dist/cli/dispatch/state.js +140 -0
- package/dist/cli/dispatch.js +1 -996
- package/dist/cli/errors.js +52 -0
- package/dist/cli/help.js +390 -43
- package/dist/cli/migrationRequired.js +87 -0
- package/dist/cli/orientation/attention.js +59 -0
- package/dist/cli/orientation/corpusCoverage.js +102 -0
- package/dist/cli/orientation.js +444 -173
- package/dist/cli/planArtifacts.js +350 -0
- package/dist/cli/planEvidence.js +157 -0
- package/dist/cli/planLifecycleState.js +36 -0
- package/dist/cli/planTaskIndex.js +11 -0
- package/dist/cli/preCutoverCommand.js +32 -0
- package/dist/cli/prime-blob.js +71 -3
- package/dist/cli/profileAcquisition.js +167 -0
- package/dist/cli/startupCompletenessContract.js +59 -0
- package/dist/cli/stateQuery.js +63 -14
- package/dist/cli/structured.js +0 -1
- package/dist/cli/todoMarkdown.js +46 -0
- package/dist/cli/todoReadinessSelection.js +192 -0
- package/dist/cli/todoSeverity.js +18 -0
- package/dist/core/atomicWriter.js +20 -0
- package/dist/core/developmentChannel.js +1 -0
- package/dist/core/developmentInvocation.js +374 -0
- package/dist/core/difflib.js +0 -1
- package/dist/core/envPaths.js +20 -0
- package/dist/core/jsonValue.js +5 -0
- package/dist/core/paths.js +0 -1
- package/dist/core/pyjson.js +67 -3
- 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 +8 -1
- package/dist/eval/evalSkills.js +30 -26
- package/dist/eval/hybridRouteEvaluation.js +155 -0
- package/dist/eval/semanticEval.js +43 -20
- package/dist/eval/semanticFixtures.js +16 -5
- package/dist/hooks/common.js +11 -81
- package/dist/hooks/compaction/apply.js +446 -0
- package/dist/hooks/compaction/dryRun.js +184 -0
- package/dist/hooks/compaction/index.js +22 -0
- package/dist/hooks/compaction/parse.js +325 -0
- package/dist/hooks/compaction/retention.js +202 -0
- package/dist/hooks/compaction/status.js +360 -0
- package/dist/hooks/compaction/types.js +5 -0
- package/dist/hooks/validateArtifact/agentFacing.js +9 -0
- package/dist/hooks/validateArtifact/index.js +92 -0
- package/dist/hooks/validateArtifact/markdown.js +145 -0
- package/dist/hooks/validateArtifact/schema.js +546 -0
- package/dist/hooks/validateArtifact/traversal.js +107 -0
- package/dist/hooks/validateArtifact/violations.js +107 -0
- package/dist/migrate/v2HandoffManifest.js +452 -0
- package/dist/registries/activationContract.js +2 -0
- package/dist/registries/activationTuples.js +106 -0
- package/dist/registries/artifactProtocolIds.js +78 -0
- package/dist/registries/artifactRegistry.js +224 -63
- package/dist/registries/artifactSchemaProjection.js +45 -0
- package/dist/registries/capabilityContract.js +141 -13
- package/dist/registries/evaluatorHandoffContract.js +170 -0
- package/dist/registries/evidenceTierContract.js +371 -0
- package/dist/registries/glossaryAdviceContract.js +79 -0
- package/dist/registries/glossaryCaveatContract.js +67 -0
- package/dist/registries/glossaryConsumerContractValidation.js +787 -0
- package/dist/registries/glossaryEntryContract.js +757 -0
- package/dist/registries/glossaryTermIdentity.js +17 -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 +229 -0
- package/dist/registries/packageRegistry.js +187 -211
- package/dist/registries/todoReadinessContract.js +448 -0
- package/dist/registries/triggerLoader.js +174 -0
- package/dist/registries/verbosityBudgetContract.js +205 -0
- package/dist/release/releaseMetadata.js +385 -0
- package/dist/runtime/lifecycleAdapterContract.js +457 -0
- package/dist/runtime/lifecycleAdapters.js +777 -0
- package/dist/runtime/lifecycleAuthority.js +453 -0
- package/dist/runtime/lifecycleOperationContract.js +123 -0
- package/dist/runtime/lifecycleOperations.js +634 -0
- package/dist/runtime/lifecycleOwnershipJournal.js +622 -0
- package/dist/runtime/lifecyclePublication.js +415 -0
- package/dist/runtime/lifecycleSnapshot.js +438 -0
- package/dist/runtime/nativeResourceCleanup.js +502 -0
- package/dist/setup/opencode.js +20 -0
- package/dist/setup/opencodeConstants.js +1 -0
- package/dist/setup/sharedSkill.js +45 -0
- package/dist/setup/smokeChecks.js +21 -82
- 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 +846 -0
- package/dist/state/entityMigrationTodo.js +133 -0
- package/dist/state/entityPublicationContext.js +806 -0
- package/dist/state/entityRetrievalHelp.js +506 -0
- package/dist/state/entityStorage.js +896 -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 +64 -25
- 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 +530 -0
- package/dist/state/planIdentity.js +47 -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/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 +432 -0
- package/dist/state/startupAnalysis/contract.js +160 -0
- package/dist/state/startupAnalysis/helpers.js +286 -0
- package/dist/state/startupAnalysis/index.js +6 -0
- package/dist/state/startupAnalysis/metrics.js +340 -0
- package/dist/state/startupAnalysis/records.js +198 -0
- package/dist/state/startupAnalysis/report.js +111 -0
- package/dist/state/startupAnalysis/threshold.js +512 -0
- package/dist/state/startupAnalysis.js +2 -1953
- package/dist/state/startupProjection.js +499 -0
- package/dist/state/stateMode.js +85 -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/todoDocsEntities.js +1064 -0
- package/dist/state/todoDocsEntityValidation.js +158 -0
- package/dist/state/todoMarkdownProjection.js +51 -0
- package/dist/state/todoReconciliationActivation.js +132 -0
- package/dist/state/todoReconciliationInspection.js +173 -0
- package/dist/state/todoReconciliationRepair.js +170 -0
- package/dist/state/todoReconciliationTransaction.js +582 -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 +332 -0
- package/dist/state/write/fields.js +61 -0
- package/dist/state/write/glossaryPublication.js +263 -0
- package/dist/state/write/grammar.js +280 -0
- package/dist/state/write/helpers.js +29 -0
- package/dist/state/write/index.js +12 -0
- package/dist/state/write/input.js +367 -0
- package/dist/state/write/lock.js +837 -0
- package/dist/state/write/mutation.js +234 -0
- package/dist/state/write/operations.js +169 -0
- package/dist/state/write/planEvaluation.js +128 -0
- package/dist/state/write/planPublication.js +179 -0
- package/dist/state/write/runtimeOperations.js +142 -0
- package/dist/state/write/serialize.js +1 -0
- package/dist/state/write/transaction.js +52 -0
- package/dist/state/write/validate.js +7 -0
- package/dist/upgrade/appContentRefresh.js +383 -0
- package/dist/upgrade/appModel.js +8 -7
- package/dist/upgrade/atomicWriter.js +1 -0
- package/dist/upgrade/bundleEvidence.js +33 -0
- package/dist/upgrade/channels.js +12 -8
- package/dist/upgrade/compatibility.js +56 -21
- package/dist/upgrade/doctor.js +197 -192
- package/dist/upgrade/doctorClassifier.js +187 -0
- package/dist/upgrade/installedHooksRetirement.js +196 -0
- package/dist/upgrade/legacyAgentCleanup.js +282 -0
- package/dist/upgrade/lifecycleUpgrade.js +113 -0
- package/dist/upgrade/migrateArtifactsV2ToV3.js +367 -149
- package/dist/upgrade/migrationPublication.js +122 -0
- package/dist/upgrade/nextMajorDoctor.js +155 -0
- package/dist/upgrade/npxPlatformStatus.js +22 -0
- package/dist/upgrade/projectIntegration.js +145 -187
- package/dist/upgrade/projectIntegrationDecision.js +50 -0
- package/dist/upgrade/retiredResourceDiagnostics.js +117 -0
- package/dist/upgrade/runtimeMigration.js +278 -352
- package/dist/upgrade/upgradeCommands.js +14 -1
- package/dist/upgrade/upgradeLock.js +85 -0
- package/dist/upgrade/upgradeOrchestrator.js +263 -59
- package/dist/upgrade/v3CapabilitySurface.js +14 -0
- package/dist/upgrade/versionResolution.js +12 -5
- package/dist/validate/activationArtifactEvidence.js +844 -0
- package/dist/validate/activationConjunction.js +816 -0
- package/dist/validate/activationEvidenceManifest.js +515 -0
- package/dist/validate/activationPackageSemantics.js +29 -0
- package/dist/validate/appHomeContract.js +5 -11
- package/dist/validate/bootstrapAuthority.js +44 -0
- package/dist/validate/capability.js +144 -15
- package/dist/validate/crossCapability.js +15 -10
- package/dist/validate/retainedReferenceAuthority.js +879 -0
- package/dist/validate/selfAudit.js +73 -37
- package/dist/validate/v1LegacyCruft.js +131 -0
- package/dist/validate/vocabularyAuthority.js +303 -0
- package/package.json +53 -27
- package/bundle/references/adapters/cursor.md +0 -213
- 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 -548
- 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 -355
- package/bundle/references/cli/bundle-skill-vocabulary.yaml +0 -278
- package/bundle/references/cli/capability-tool-classification.yaml +0 -53
- package/bundle/references/cli/routing-execution-vocabulary.yaml +0 -281
- package/bundle/references/meta/documentation-inventory.md +0 -43
- package/bundle/references/v1-section-mapping.md +0 -47
- package/bundle/skills/agentera/.claude-plugin/plugin.json +0 -27
- package/bundle/skills/agentera/agents/dokumentera.toml +0 -6
- package/bundle/skills/agentera/agents/hej.toml +0 -6
- package/bundle/skills/agentera/agents/inspektera.toml +0 -6
- package/bundle/skills/agentera/agents/inspirera.toml +0 -6
- package/bundle/skills/agentera/agents/optimera.toml +0 -6
- package/bundle/skills/agentera/agents/orkestrera.toml +0 -6
- package/bundle/skills/agentera/agents/planera.toml +0 -6
- package/bundle/skills/agentera/agents/profilera.toml +0 -6
- package/bundle/skills/agentera/agents/realisera.toml +0 -6
- package/bundle/skills/agentera/agents/resonera.toml +0 -6
- package/bundle/skills/agentera/agents/visionera.toml +0 -6
- package/bundle/skills/agentera/agents/visualisera.toml +0 -6
- package/bundle/skills/agentera/capabilities/dokumentera/instructions.md +0 -428
- package/bundle/skills/agentera/capabilities/dokumentera/schemas/artifacts.yaml +0 -73
- package/bundle/skills/agentera/capabilities/dokumentera/schemas/triggers.yaml +0 -35
- package/bundle/skills/agentera/capabilities/hej/instructions.md +0 -331
- package/bundle/skills/agentera/capabilities/hej/schemas/artifacts.yaml +0 -69
- package/bundle/skills/agentera/capabilities/hej/schemas/triggers.yaml +0 -58
- package/bundle/skills/agentera/capabilities/inspektera/instructions.md +0 -514
- package/bundle/skills/agentera/capabilities/inspektera/schemas/artifacts.yaml +0 -76
- package/bundle/skills/agentera/capabilities/inspektera/schemas/triggers.yaml +0 -38
- package/bundle/skills/agentera/capabilities/inspirera/instructions.md +0 -280
- package/bundle/skills/agentera/capabilities/inspirera/schemas/artifacts.yaml +0 -24
- package/bundle/skills/agentera/capabilities/inspirera/schemas/triggers.yaml +0 -34
- package/bundle/skills/agentera/capabilities/optimera/instructions.md +0 -437
- package/bundle/skills/agentera/capabilities/optimera/schemas/triggers.yaml +0 -39
- package/bundle/skills/agentera/capabilities/orkestrera/instructions.md +0 -433
- package/bundle/skills/agentera/capabilities/orkestrera/schemas/artifacts.yaml +0 -64
- package/bundle/skills/agentera/capabilities/orkestrera/schemas/triggers.yaml +0 -42
- package/bundle/skills/agentera/capabilities/orkestrera/schemas/validation.yaml +0 -107
- package/bundle/skills/agentera/capabilities/planera/instructions.md +0 -368
- package/bundle/skills/agentera/capabilities/planera/schemas/artifacts.yaml +0 -62
- package/bundle/skills/agentera/capabilities/planera/schemas/triggers.yaml +0 -34
- package/bundle/skills/agentera/capabilities/planera/schemas/validation.yaml +0 -61
- package/bundle/skills/agentera/capabilities/profilera/instructions.md +0 -419
- package/bundle/skills/agentera/capabilities/profilera/schemas/artifacts.yaml +0 -18
- package/bundle/skills/agentera/capabilities/profilera/schemas/triggers.yaml +0 -45
- package/bundle/skills/agentera/capabilities/profilera/schemas/validation.yaml +0 -57
- package/bundle/skills/agentera/capabilities/realisera/instructions.md +0 -403
- package/bundle/skills/agentera/capabilities/realisera/schemas/artifacts.yaml +0 -80
- package/bundle/skills/agentera/capabilities/realisera/schemas/triggers.yaml +0 -39
- package/bundle/skills/agentera/capabilities/realisera/schemas/validation.yaml +0 -110
- package/bundle/skills/agentera/capabilities/resonera/instructions.md +0 -329
- package/bundle/skills/agentera/capabilities/resonera/schemas/artifacts.yaml +0 -47
- package/bundle/skills/agentera/capabilities/resonera/schemas/triggers.yaml +0 -46
- package/bundle/skills/agentera/capabilities/resonera/schemas/validation.yaml +0 -77
- package/bundle/skills/agentera/capabilities/visionera/instructions.md +0 -309
- package/bundle/skills/agentera/capabilities/visionera/schemas/triggers.yaml +0 -41
- package/bundle/skills/agentera/capabilities/visualisera/instructions.md +0 -400
- package/bundle/skills/agentera/capabilities/visualisera/schemas/triggers.yaml +0 -33
- package/bundle/skills/agentera/references/contract.md +0 -1039
- package/bundle/skills/hej/.claude-plugin/plugin.json +0 -6
- package/bundle/skills/hej/SKILL.md +0 -69
- package/bundle/skills/hej/agents/hej.toml +0 -11
- package/bundle/skills/hej/agents/openai.yaml +0 -8
- 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/cli/appContext.js.map +0 -1
- package/dist/cli/argvalidate.js.map +0 -1
- package/dist/cli/capabilityContext.js.map +0 -1
- package/dist/cli/commands/backfill.js +0 -84
- package/dist/cli/commands/backfill.js.map +0 -1
- package/dist/cli/commands/capability.js.map +0 -1
- package/dist/cli/commands/compact.js.map +0 -1
- package/dist/cli/commands/doctor.js.map +0 -1
- package/dist/cli/commands/lint.js.map +0 -1
- package/dist/cli/commands/prime.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.js +0 -1012
- package/dist/cli/commands/state.js.map +0 -1
- package/dist/cli/commands/upgrade.js.map +0 -1
- package/dist/cli/commands/validate.js.map +0 -1
- package/dist/cli/commands/verify.js.map +0 -1
- package/dist/cli/dispatch.js.map +0 -1
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/orientation.js.map +0 -1
- package/dist/cli/prime-blob.js.map +0 -1
- package/dist/cli/stateQuery.js.map +0 -1
- package/dist/cli/structured.js.map +0 -1
- package/dist/core/difflib.js.map +0 -1
- package/dist/core/git.js +0 -43
- package/dist/core/git.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.js +0 -935
- package/dist/hooks/compaction.js.map +0 -1
- package/dist/hooks/cursorPreToolUse.js +0 -19
- package/dist/hooks/cursorPreToolUse.js.map +0 -1
- package/dist/hooks/cursorSessionStart.js +0 -71
- package/dist/hooks/cursorSessionStart.js.map +0 -1
- package/dist/hooks/sessionStart.js +0 -209
- package/dist/hooks/sessionStart.js.map +0 -1
- package/dist/hooks/sessionStop.js +0 -212
- package/dist/hooks/sessionStop.js.map +0 -1
- package/dist/hooks/validateArtifact.js +0 -933
- package/dist/hooks/validateArtifact.js.map +0 -1
- package/dist/registries/artifactRegistry.js.map +0 -1
- package/dist/registries/capabilityContract.js.map +0 -1
- package/dist/registries/packageRegistry.js.map +0 -1
- package/dist/registries/runtimeAdapterRegistry.js +0 -315
- package/dist/registries/runtimeAdapterRegistry.js.map +0 -1
- package/dist/setup/codex.js +0 -1056
- 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 -127
- package/dist/setup/cursor.js.map +0 -1
- package/dist/setup/doctor.js +0 -1297
- package/dist/setup/doctor.js.map +0 -1
- package/dist/setup/smokeChecks.js.map +0 -1
- package/dist/state/installRoot.js.map +0 -1
- package/dist/state/progressCommit.js +0 -289
- package/dist/state/progressCommit.js.map +0 -1
- package/dist/state/startupAnalysis.js.map +0 -1
- package/dist/upgrade/appModel.js.map +0 -1
- package/dist/upgrade/channels.js.map +0 -1
- package/dist/upgrade/compatibility.js.map +0 -1
- package/dist/upgrade/doctor.js.map +0 -1
- package/dist/upgrade/migrateArtifactsV1ToV2.js +0 -571
- package/dist/upgrade/migrateArtifactsV1ToV2.js.map +0 -1
- package/dist/upgrade/migrateArtifactsV2ToV3.js.map +0 -1
- package/dist/upgrade/projectIntegration.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/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.js +0 -772
- package/dist/validate/lifecycleAdapters.js.map +0 -1
- package/dist/validate/selfAudit.js.map +0 -1
- /package/bundle/skills/agentera/capabilities/{dokumentera → document}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{inspirera → research}/schemas/exit.yaml +0 -0
- /package/bundle/skills/agentera/capabilities/{hej → status}/schemas/exit.yaml +0 -0
package/dist/cli/orientation.js
CHANGED
|
@@ -1,40 +1,51 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { preCutoverCommand } from "./preCutoverCommand.js";
|
|
4
|
+
import { loadArtifactRecord, resolveArtifactPath, } from "../registries/artifactRegistry.js";
|
|
5
|
+
import { activeObjectiveName, artifactPath, resolveRegistryModelPath, } from "./appContext.js";
|
|
5
6
|
import { asList, extractEntries, firstPresent, loadArtifact, recentCycles, truncate, } from "./stateQuery.js";
|
|
6
|
-
import {
|
|
7
|
+
import { normalizeSeverity } from "./commands/state/index.js";
|
|
8
|
+
import { isResolvedTodoMarkdownStatus, parseTodoMarkdownListItem } from "./todoMarkdown.js";
|
|
9
|
+
import { truncateCodePoints } from "../core/text.js";
|
|
10
|
+
import { TODO_SEVERITY_ORDER_KEYS } from "./todoSeverity.js";
|
|
11
|
+
import { evaluateTodoReadinessQueue, } from "./todoReadinessSelection.js";
|
|
12
|
+
import { capabilityStartupComplete } from "./startupCompletenessContract.js";
|
|
13
|
+
import { discoverPlanArtifacts, planCatalogEntry, planDocumentParts } from "./planArtifacts.js";
|
|
14
|
+
import { planLifecycleState } from "./planLifecycleState.js";
|
|
15
|
+
import { firstActionablePlanTask } from "./capabilityContext/planState.js";
|
|
16
|
+
import { resolveSourceRoot } from "../core/sourceRoot.js";
|
|
17
|
+
import { entityListFamily } from "../state/entityRetrievalHelp.js";
|
|
18
|
+
import { scanYamlCollection } from "../state/startupProjection.js";
|
|
19
|
+
import { numberedArchiveContract } from "../state/archiveDiscovery.js";
|
|
20
|
+
const PLAN_FAMILY = entityListFamily("plans");
|
|
21
|
+
const PLAN_TASK_FAMILY = entityListFamily("plan_tasks");
|
|
22
|
+
const OBJECTIVE_FAMILY = entityListFamily("objective");
|
|
23
|
+
const PLAN_LIST_COMMAND = preCutoverCommand(`state ${PLAN_FAMILY.commandTokens.join(" ")} list --format json`);
|
|
24
|
+
function planTaskListCommand(planId) {
|
|
25
|
+
const selector = typeof planId === "string" && planId ? ` ${planId}` : "";
|
|
26
|
+
return preCutoverCommand(`state ${PLAN_TASK_FAMILY.commandTokens.join(" ")} list${selector} --limit 100 --format json`);
|
|
27
|
+
}
|
|
28
|
+
function planTaskGetCommand(taskId) {
|
|
29
|
+
const selector = typeof taskId === "string" && taskId ? taskId : "ID";
|
|
30
|
+
return preCutoverCommand(`state ${PLAN_TASK_FAMILY.commandTokens.join(" ")} get --id ${selector} --format json`);
|
|
31
|
+
}
|
|
32
|
+
function objectiveGetCommand(objectiveId) {
|
|
33
|
+
const selector = typeof objectiveId === "string" && objectiveId ? objectiveId : "ID";
|
|
34
|
+
return preCutoverCommand(`state ${OBJECTIVE_FAMILY.commandTokens.join(" ")} get --id ${selector} --format json`);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Orientation summaries layer for prime/status. Faithful port of the
|
|
38
|
+
* scripts/agentera `_*_summary`, `_load_todo_items`, `_issue_counts`,
|
|
39
|
+
* `_decision_*`, `_select_status_next_action`, and staleness helpers.
|
|
40
|
+
*/
|
|
7
41
|
export const DONE_STATUSES = new Set(["complete", "completed", "closed", "done", "resolved", "retired"]);
|
|
8
42
|
export const BLOCKED_STATUSES = new Set(["blocked", "stuck"]);
|
|
9
43
|
export const DECISION_ATTENTION_MAX_ENTRIES = 3;
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
normal: 2,
|
|
16
|
-
info: 3,
|
|
17
|
-
annoying: 3,
|
|
18
|
-
};
|
|
19
|
-
const TODO_SECTION_SEVERITIES = {
|
|
20
|
-
critical: "critical",
|
|
21
|
-
degraded: "degraded",
|
|
22
|
-
warning: "warning",
|
|
23
|
-
normal: "normal",
|
|
24
|
-
info: "info",
|
|
25
|
-
annoying: "annoying",
|
|
26
|
-
};
|
|
27
|
-
const TODO_ITEM_RE = /^- \[([^\]]+)\]\s+(.*)/;
|
|
28
|
-
const TODO_PLANERA_SIGNALS = new Set([
|
|
29
|
-
"acceptance", "artifact", "capability", "capability-context", "compatibility", "contract",
|
|
30
|
-
"cross-capability", "docs", "metadata", "migration", "schema", "startup", "surface", "test", "validation",
|
|
31
|
-
]);
|
|
32
|
-
const PROFILERA_STALE_DAYS_ENV = "AGENTERA_PROFILERA_MAX_AGE_DAYS";
|
|
33
|
-
const DEFAULT_PROFILERA_STALE_DAYS = 7;
|
|
34
|
-
const INSPEKTERA_STALE_DAYS_ENV = "AGENTERA_INSPEKTERA_MAX_AGE_DAYS";
|
|
35
|
-
const DEFAULT_INSPEKTERA_STALE_DAYS = 30;
|
|
36
|
-
const INSPEKTERA_STALE_CYCLES_ENV = "AGENTERA_INSPEKTERA_MAX_CYCLES";
|
|
37
|
-
const DEFAULT_INSPEKTERA_STALE_CYCLES = 10;
|
|
44
|
+
const TODO_SECTION_SEVERITIES = Object.fromEntries(TODO_SEVERITY_ORDER_KEYS.map((key) => [key, key]));
|
|
45
|
+
const AUDIT_STALE_DAYS_ENV = "AGENTERA_AUDIT_MAX_AGE_DAYS";
|
|
46
|
+
const DEFAULT_AUDIT_STALE_DAYS = 30;
|
|
47
|
+
const AUDIT_STALE_CYCLES_ENV = "AGENTERA_AUDIT_MAX_CYCLES";
|
|
48
|
+
const DEFAULT_AUDIT_STALE_CYCLES = 10;
|
|
38
49
|
function intEnv(env, key, def) {
|
|
39
50
|
const raw = env[key] ?? String(def);
|
|
40
51
|
const n = parseInt(raw, 10);
|
|
@@ -77,33 +88,37 @@ export function loadNamedArtifact(schemas, name) {
|
|
|
77
88
|
return null;
|
|
78
89
|
return loadArtifact(artifactPath(info, name));
|
|
79
90
|
}
|
|
80
|
-
export function registryArtifactPath(artifactId, schemasDir) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
export function checkProfileraStaleness(profilePath, env = process.env) {
|
|
88
|
-
if (!fs.existsSync(profilePath))
|
|
89
|
-
return null;
|
|
90
|
-
let text;
|
|
91
|
+
export function registryArtifactPath(artifactId, schemasDir, env = process.env, options = {}) {
|
|
92
|
+
// Targeted lookup: resolving a single identity (e.g. `profile` against a
|
|
93
|
+
// v2-shaped install) must not walk the full registry and warn about every
|
|
94
|
+
// required schema that happens to be absent from this install. Only the
|
|
95
|
+
// requested identity is inspected; model/schemas authority is shared with the
|
|
96
|
+
// full loader via `resolveRegistryModelPath`.
|
|
97
|
+
let record;
|
|
91
98
|
try {
|
|
92
|
-
|
|
99
|
+
record = loadArtifactRecord(artifactId, schemasDir, resolveRegistryModelPath(schemasDir));
|
|
93
100
|
}
|
|
94
101
|
catch (exc) {
|
|
95
|
-
|
|
96
|
-
|
|
102
|
+
if (options.warn !== false) {
|
|
103
|
+
process.stderr.write(`warning: failed to load artifact registry for schemas: ${exc.message}\n`);
|
|
104
|
+
}
|
|
105
|
+
record = undefined;
|
|
97
106
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
if (record === undefined)
|
|
108
|
+
throw new Error(`artifact registry does not define '${artifactId}'`);
|
|
109
|
+
return resolveArtifactPath(record, process.cwd(), activeObjectiveName(), env);
|
|
110
|
+
}
|
|
111
|
+
// ── staleness ───────────────────────────────────────────────────────
|
|
112
|
+
const PROFILE_GENERATED_RE = /<!-- Generated:\s*(\d{4}-\d{2}-\d{2})/;
|
|
113
|
+
const PROFILE_VALIDATED_RE = /Validated:\s*(\d{4}-\d{2}-\d{2})/;
|
|
114
|
+
export function parseProfileHeaderDates(text) {
|
|
115
|
+
const genMatch = PROFILE_GENERATED_RE.exec(text);
|
|
116
|
+
const generatedDate = genMatch ? genMatch[1] : null;
|
|
117
|
+
const generatedUtc = generatedDate ? dateFromIso(generatedDate) : null;
|
|
118
|
+
const valMatch = PROFILE_VALIDATED_RE.exec(text);
|
|
119
|
+
const validatedDate = valMatch ? valMatch[1] : null;
|
|
120
|
+
const validatedUtc = validatedDate ? dateFromIso(validatedDate) : null;
|
|
121
|
+
return { generatedDate, validatedDate, generatedUtc, validatedUtc };
|
|
107
122
|
}
|
|
108
123
|
export function healthAuditDate(entry) {
|
|
109
124
|
for (const key of ["date", "timestamp"]) {
|
|
@@ -127,8 +142,25 @@ function progressEntryDate(entry) {
|
|
|
127
142
|
}
|
|
128
143
|
return null;
|
|
129
144
|
}
|
|
145
|
+
function scanSchemaArtifact(schemas, artifactId) {
|
|
146
|
+
const info = schemas[artifactId];
|
|
147
|
+
const contract = numberedArchiveContract(artifactId, resolveSourceRoot());
|
|
148
|
+
const currentPath = info ? artifactPath(info, artifactId) : path.join(process.cwd(), ".agentera", `${artifactId}.yaml`);
|
|
149
|
+
const primary = scanYamlCollection(currentPath, contract.entryCollection, artifactId, contract.entryNumberField);
|
|
150
|
+
const active = artifactId === "progress" && !primary.collection_found
|
|
151
|
+
? scanYamlCollection(currentPath, "progress", artifactId, contract.entryNumberField)
|
|
152
|
+
: primary;
|
|
153
|
+
return {
|
|
154
|
+
active,
|
|
155
|
+
archive: scanYamlCollection(currentPath, "archive", artifactId, contract.entryNumberField),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
130
158
|
function cyclesSinceHealthAudit(schemas, auditDate) {
|
|
131
|
-
const
|
|
159
|
+
const info = schemas.progress;
|
|
160
|
+
if (!info)
|
|
161
|
+
return null;
|
|
162
|
+
const scan = scanSchemaArtifact(schemas, "progress").active;
|
|
163
|
+
const entries = scan.entries.map((entry) => entry.fields);
|
|
132
164
|
if (entries.length === 0)
|
|
133
165
|
return null;
|
|
134
166
|
let count = 0;
|
|
@@ -139,11 +171,11 @@ function cyclesSinceHealthAudit(schemas, auditDate) {
|
|
|
139
171
|
}
|
|
140
172
|
return count;
|
|
141
173
|
}
|
|
142
|
-
function
|
|
174
|
+
function checkAuditStaleness(schemas, latest, auditDate, env = process.env) {
|
|
143
175
|
if (latest === null || auditDate === null)
|
|
144
176
|
return null;
|
|
145
|
-
const staleDaysThreshold = intEnv(env,
|
|
146
|
-
const staleCyclesThreshold = intEnv(env,
|
|
177
|
+
const staleDaysThreshold = intEnv(env, AUDIT_STALE_DAYS_ENV, DEFAULT_AUDIT_STALE_DAYS);
|
|
178
|
+
const staleCyclesThreshold = intEnv(env, AUDIT_STALE_CYCLES_ENV, DEFAULT_AUDIT_STALE_CYCLES);
|
|
147
179
|
const since = daysSince(auditDate);
|
|
148
180
|
const cyclesSince = cyclesSinceHealthAudit(schemas, auditDate);
|
|
149
181
|
const timeStale = since >= staleDaysThreshold;
|
|
@@ -168,7 +200,7 @@ function checkInspekteraAuditStaleness(schemas, latest, auditDate, env = process
|
|
|
168
200
|
if (cyclesSince !== null)
|
|
169
201
|
result.cycles_since_audit = cyclesSince;
|
|
170
202
|
if (isStale)
|
|
171
|
-
result.suggested_action = "Run
|
|
203
|
+
result.suggested_action = "Run audit to refresh health audit";
|
|
172
204
|
return result;
|
|
173
205
|
}
|
|
174
206
|
// ── todo items + issue counts ───────────────────────────────────────
|
|
@@ -217,9 +249,12 @@ export function loadTodoItems(schemas) {
|
|
|
217
249
|
continue;
|
|
218
250
|
}
|
|
219
251
|
if (currentSeverity) {
|
|
220
|
-
const
|
|
221
|
-
if (
|
|
222
|
-
|
|
252
|
+
const parsed = parseTodoMarkdownListItem(stripped);
|
|
253
|
+
if (!parsed || isResolvedTodoMarkdownStatus(parsed.status))
|
|
254
|
+
continue;
|
|
255
|
+
if (!parsed.description)
|
|
256
|
+
continue;
|
|
257
|
+
items.push({ severity: currentSeverity, status: parsed.status, text: parsed.description });
|
|
223
258
|
}
|
|
224
259
|
}
|
|
225
260
|
return items;
|
|
@@ -227,7 +262,7 @@ export function loadTodoItems(schemas) {
|
|
|
227
262
|
export function issueCounts(todoItems) {
|
|
228
263
|
const counts = { critical: 0, degraded: 0, normal: 0, annoying: 0 };
|
|
229
264
|
for (const item of todoItems) {
|
|
230
|
-
const severity = item.severity;
|
|
265
|
+
const severity = String(item.severity ?? "normal");
|
|
231
266
|
if (severity === "critical")
|
|
232
267
|
counts.critical += 1;
|
|
233
268
|
else if (severity === "degraded" || severity === "warning")
|
|
@@ -239,123 +274,246 @@ export function issueCounts(todoItems) {
|
|
|
239
274
|
}
|
|
240
275
|
return counts;
|
|
241
276
|
}
|
|
242
|
-
function todoNeedsPlanera(item) {
|
|
243
|
-
const text = item.text.toLowerCase();
|
|
244
|
-
let signalCount = 0;
|
|
245
|
-
for (const signal of TODO_PLANERA_SIGNALS)
|
|
246
|
-
if (text.includes(signal))
|
|
247
|
-
signalCount += 1;
|
|
248
|
-
return signalCount >= 2 || (signalCount >= 1 && text.length > 180);
|
|
249
|
-
}
|
|
250
277
|
// ── per-artifact summaries ──────────────────────────────────────────
|
|
251
278
|
export function planSummary(schemas) {
|
|
252
|
-
const
|
|
253
|
-
if (!
|
|
254
|
-
|
|
279
|
+
const info = schemas.plan;
|
|
280
|
+
if (!info) {
|
|
281
|
+
const summary = {
|
|
255
282
|
exists: false,
|
|
256
283
|
active: false,
|
|
257
284
|
tasks: [],
|
|
258
285
|
status: "absent",
|
|
259
286
|
title: "",
|
|
260
|
-
|
|
287
|
+
active_path: "",
|
|
288
|
+
absence_reason: "No active plan artifact is available from agentera state plan.",
|
|
261
289
|
};
|
|
290
|
+
summary.lifecycle_state = planLifecycleState(summary);
|
|
291
|
+
return summary;
|
|
262
292
|
}
|
|
263
|
-
const
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
293
|
+
const discovery = discoverPlanArtifacts(artifactPath(info, "plan"));
|
|
294
|
+
const activeDiagnostics = discovery.diagnostics.filter((diagnostic) => diagnostic.path === discovery.activePath && diagnostic.category !== "legacy");
|
|
295
|
+
const archivedPlans = discovery.archived.map((artifact) => planCatalogEntry(artifact, discovery.activePath));
|
|
296
|
+
if (!discovery.active) {
|
|
297
|
+
const summary = {
|
|
298
|
+
exists: activeDiagnostics.length === 0 && archivedPlans.length > 0,
|
|
299
|
+
active: false,
|
|
300
|
+
tasks: [],
|
|
301
|
+
status: activeDiagnostics.length > 0 ? "invalid" : archivedPlans.length > 0 ? "archived" : "absent",
|
|
302
|
+
title: "",
|
|
303
|
+
active_path: discovery.activePath,
|
|
304
|
+
absence_reason: activeDiagnostics.length > 0
|
|
305
|
+
? "Current plan artifact is invalid; see diagnostics."
|
|
306
|
+
: archivedPlans.length > 0
|
|
307
|
+
? "No active plan artifact is available; archived plan state is history only."
|
|
308
|
+
: "No active plan artifact is available from agentera state plan.",
|
|
309
|
+
complete: 0,
|
|
310
|
+
total: 0,
|
|
311
|
+
complete_plan: false,
|
|
312
|
+
first_pending: null,
|
|
313
|
+
archived_plans: archivedPlans,
|
|
314
|
+
archive_count: archivedPlans.length,
|
|
315
|
+
invalid_archive_paths: discovery.invalidArchivePaths,
|
|
316
|
+
...(activeDiagnostics.length > 0 ? { invalid_path: discovery.activePath } : {}),
|
|
317
|
+
diagnostics: discovery.diagnostics,
|
|
318
|
+
};
|
|
319
|
+
summary.lifecycle_state = planLifecycleState(summary);
|
|
320
|
+
return summary;
|
|
278
321
|
}
|
|
322
|
+
const d = discovery.active.data;
|
|
323
|
+
const parts = planDocumentParts(d);
|
|
324
|
+
const tasks = parts.tasks;
|
|
325
|
+
const status = parts.legacyEntries ? entryStatusPy(tasks[0], "") : parts.status;
|
|
326
|
+
const title = parts.legacyEntries
|
|
327
|
+
? String(firstPresent(tasks[0] ?? {}, ["title", "name"], ""))
|
|
328
|
+
: parts.title;
|
|
279
329
|
const complete = tasks.filter((task) => DONE_STATUSES.has(entryStatusPy(task, ""))).length;
|
|
280
330
|
const total = tasks.length;
|
|
281
331
|
const completePlan = DONE_STATUSES.has(status.toLowerCase()) && complete === total;
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
if (DONE_STATUSES.has(ts) || BLOCKED_STATUSES.has(ts))
|
|
287
|
-
continue;
|
|
288
|
-
firstPending = task;
|
|
289
|
-
break;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
return {
|
|
332
|
+
const firstPending = completePlan
|
|
333
|
+
? null
|
|
334
|
+
: firstActionablePlanTask(tasks);
|
|
335
|
+
const summary = {
|
|
293
336
|
exists: true,
|
|
294
337
|
status,
|
|
295
338
|
title,
|
|
339
|
+
active_path: discovery.activePath,
|
|
296
340
|
constraints: d.constraints ?? null,
|
|
297
341
|
scope: d.scope ?? null,
|
|
298
342
|
design: d.design ?? null,
|
|
299
343
|
tasks,
|
|
300
344
|
complete,
|
|
301
345
|
total,
|
|
302
|
-
active:
|
|
346
|
+
active: true,
|
|
303
347
|
complete_plan: completePlan,
|
|
304
348
|
first_pending: firstPending,
|
|
349
|
+
archived_plans: archivedPlans,
|
|
350
|
+
archive_count: archivedPlans.length,
|
|
351
|
+
invalid_archive_paths: discovery.invalidArchivePaths,
|
|
352
|
+
diagnostics: discovery.diagnostics,
|
|
353
|
+
};
|
|
354
|
+
summary.lifecycle_state = planLifecycleState(summary);
|
|
355
|
+
return summary;
|
|
356
|
+
}
|
|
357
|
+
/** Startup keeps plan routing metadata, not the full active plan body. */
|
|
358
|
+
export function startupPlanSummary(plan) {
|
|
359
|
+
const tasks = asList(plan.tasks).filter((task) => task && typeof task === "object" && !Array.isArray(task));
|
|
360
|
+
const boundedTasks = tasks.slice(0, 10).map((task) => {
|
|
361
|
+
const item = {};
|
|
362
|
+
for (const key of ["id", "artifact", "name", "title", "status", "depends_on", "acceptance_summary", "evidence_summary", "blocked_reasons", "evaluation_state"]) {
|
|
363
|
+
if (!(key in task))
|
|
364
|
+
continue;
|
|
365
|
+
if (key === "acceptance_summary" || key === "evidence_summary") {
|
|
366
|
+
const summary = task[key];
|
|
367
|
+
item[key] = summary && typeof summary === "object" && !Array.isArray(summary)
|
|
368
|
+
? { count: summary.count ?? asList(summary.items).length }
|
|
369
|
+
: null;
|
|
370
|
+
}
|
|
371
|
+
else if (key === "evaluation_state") {
|
|
372
|
+
const evaluation = task[key];
|
|
373
|
+
item[key] = evaluation && typeof evaluation === "object" && !Array.isArray(evaluation)
|
|
374
|
+
? Object.fromEntries(Object.entries(evaluation).filter(([name]) => ["attempt_count", "failure_count", "last_verdict"].includes(name)))
|
|
375
|
+
: null;
|
|
376
|
+
}
|
|
377
|
+
else if (key === "depends_on") {
|
|
378
|
+
item[key] = asList(task[key]).slice(0, 20);
|
|
379
|
+
}
|
|
380
|
+
else if (key === "blocked_reasons") {
|
|
381
|
+
item[key] = asList(task[key]).slice(0, 3).map((reason) => truncateCodePoints(String(reason), 160));
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
item[key] = typeof task[key] === "string" ? truncateCodePoints(task[key], 256) : task[key];
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return item;
|
|
388
|
+
});
|
|
389
|
+
const archived = asList(plan.archived_plans).slice(0, 10);
|
|
390
|
+
const diagnostics = asList(plan.diagnostics).slice(0, 10);
|
|
391
|
+
const totalTasks = Number(plan.total ?? tasks.length);
|
|
392
|
+
const taskOmission = plan.task_omission && typeof plan.task_omission === "object" && !Array.isArray(plan.task_omission) ? plan.task_omission : {};
|
|
393
|
+
const finalTaskOmission = {
|
|
394
|
+
...taskOmission,
|
|
395
|
+
omitted: totalTasks > boundedTasks.length,
|
|
396
|
+
total: totalTasks,
|
|
397
|
+
returned_count: boundedTasks.length,
|
|
398
|
+
omitted_count: Math.max(0, totalTasks - boundedTasks.length),
|
|
399
|
+
omission_reason: totalTasks > boundedTasks.length ? taskOmission.omission_reason ?? "startup_detail_capacity" : "none",
|
|
400
|
+
retrieval: taskOmission.retrieval ?? { list: planTaskListCommand(plan.id), restart: planTaskListCommand(plan.id), get: PLAN_TASK_FAMILY.get },
|
|
401
|
+
};
|
|
402
|
+
const pending = plan.first_pending && typeof plan.first_pending === "object" && !Array.isArray(plan.first_pending)
|
|
403
|
+
? plan.first_pending
|
|
404
|
+
: null;
|
|
405
|
+
const pendingDependencies = pending ? asList(pending.depends_on).slice(0, 20).map(String) : [];
|
|
406
|
+
const pendingAcceptance = pending
|
|
407
|
+
? asList(pending.acceptance).slice(0, 10).map((item) => truncateCodePoints(String(item), 200, "…"))
|
|
408
|
+
: [];
|
|
409
|
+
const firstPending = pending ? {
|
|
410
|
+
id: pending.id ?? null,
|
|
411
|
+
artifact: pending.artifact ?? "plan",
|
|
412
|
+
name: truncateCodePoints(String(pending.name ?? pending.title ?? ""), 256, "…"),
|
|
413
|
+
status: pending.status ?? "pending",
|
|
414
|
+
depends_on: pendingDependencies,
|
|
415
|
+
dependency_count: asList(pending.depends_on).length,
|
|
416
|
+
omitted_dependency_count: Math.max(0, asList(pending.depends_on).length - pendingDependencies.length),
|
|
417
|
+
acceptance: pendingAcceptance,
|
|
418
|
+
acceptance_count: asList(pending.acceptance).length,
|
|
419
|
+
omitted_acceptance_count: Math.max(0, asList(pending.acceptance).length - pendingAcceptance.length),
|
|
420
|
+
retrieval: { get: planTaskGetCommand(pending.id) },
|
|
421
|
+
} : null;
|
|
422
|
+
return {
|
|
423
|
+
id: plan.id ?? null,
|
|
424
|
+
artifact: plan.artifact ?? "plan",
|
|
425
|
+
exists: Boolean(plan.exists),
|
|
426
|
+
active: Boolean(plan.active),
|
|
427
|
+
status: plan.status,
|
|
428
|
+
title: plan.title ?? "",
|
|
429
|
+
complete: plan.complete ?? 0,
|
|
430
|
+
superseded: plan.superseded ?? 0,
|
|
431
|
+
total: totalTasks,
|
|
432
|
+
task_status_counts: plan.task_status_counts ?? {},
|
|
433
|
+
task_omission: finalTaskOmission,
|
|
434
|
+
complete_plan: Boolean(plan.complete_plan),
|
|
435
|
+
first_pending: firstPending,
|
|
436
|
+
tasks: boundedTasks,
|
|
437
|
+
task_count: totalTasks,
|
|
438
|
+
omitted_task_count: Math.max(0, totalTasks - boundedTasks.length),
|
|
439
|
+
archived_plans: archived,
|
|
440
|
+
archive_count: plan.archive_count ?? archived.length,
|
|
441
|
+
omitted_archive_count: Math.max(0, Number(plan.archive_count ?? archived.length) - archived.length),
|
|
442
|
+
invalid_archive_paths: (plan.invalid_archive_paths ?? []).slice(0, 10),
|
|
443
|
+
diagnostics,
|
|
444
|
+
omitted_diagnostic_count: Math.max(0, (plan.diagnostics ?? []).length - diagnostics.length),
|
|
445
|
+
source_contract: {
|
|
446
|
+
detail_availability: totalTasks > boundedTasks.length ? "summary" : "full",
|
|
447
|
+
retrieval: PLAN_LIST_COMMAND,
|
|
448
|
+
raw_archive_records: false,
|
|
449
|
+
},
|
|
450
|
+
lifecycle_state: plan.lifecycle_state ?? null,
|
|
305
451
|
};
|
|
306
452
|
}
|
|
307
|
-
export function docsSummary(schemas) {
|
|
308
|
-
const
|
|
309
|
-
if (!
|
|
310
|
-
return { exists: false, status: "absent", absence_reason: "No docs mapping artifact is available from agentera docs." };
|
|
453
|
+
export function docsSummary(schemas, startupInput = {}) {
|
|
454
|
+
const info = schemas.docs;
|
|
455
|
+
if (!info) {
|
|
456
|
+
return { exists: false, status: "absent", absence_reason: "No docs mapping artifact is available from agentera state docs." };
|
|
311
457
|
}
|
|
312
|
-
const
|
|
313
|
-
const mapping =
|
|
314
|
-
const index =
|
|
315
|
-
const
|
|
316
|
-
const
|
|
458
|
+
const docsPath = artifactPath(info, "docs");
|
|
459
|
+
const mapping = scanYamlCollection(docsPath, "mapping", "docs", "artifact");
|
|
460
|
+
const index = scanYamlCollection(docsPath, "index", "docs", "artifact");
|
|
461
|
+
const exists = fs.existsSync(docsPath);
|
|
462
|
+
const header = exists ? truncateCodePoints(fs.readFileSync(docsPath, "utf8"), 4096) : "";
|
|
463
|
+
const lastAudit = /^last_audit:\s*(.+)$/m.exec(header)?.[1]?.trim().replace(/^['"]|['"]$/g, "") ?? null;
|
|
317
464
|
return {
|
|
318
|
-
exists
|
|
465
|
+
exists,
|
|
319
466
|
status: "available",
|
|
320
|
-
last_audit:
|
|
321
|
-
conventions,
|
|
322
|
-
mapping,
|
|
323
|
-
mapping_entries: mapping.length,
|
|
324
|
-
coverage,
|
|
467
|
+
last_audit: lastAudit,
|
|
468
|
+
conventions: {},
|
|
469
|
+
mapping: mapping.entries.slice(0, 10).map((entry) => entry.fields),
|
|
470
|
+
mapping_entries: mapping.entries.length,
|
|
471
|
+
coverage: {},
|
|
325
472
|
source_contract: {
|
|
326
|
-
capability_startup_complete:
|
|
473
|
+
capability_startup_complete: capabilityStartupComplete(startupInput),
|
|
327
474
|
raw_artifact_reads_required: false,
|
|
328
475
|
state_families: [
|
|
329
476
|
"plan task details, dependencies, acceptance criteria, and evidence summaries",
|
|
330
477
|
"docs artifact mapping and source-contract completeness metadata",
|
|
331
|
-
"latest progress verification metadata needed for
|
|
332
|
-
"
|
|
478
|
+
"latest progress verification metadata needed for Orchestrate evaluation",
|
|
479
|
+
"Document closeout context metadata for docs/TODO/changelog/progress synchronization",
|
|
333
480
|
],
|
|
334
481
|
},
|
|
335
|
-
indexed_documents: index.length,
|
|
482
|
+
indexed_documents: index.entries.length,
|
|
336
483
|
};
|
|
337
484
|
}
|
|
338
485
|
export function progressSummary(schemas) {
|
|
339
|
-
const
|
|
340
|
-
|
|
486
|
+
const info = schemas.progress;
|
|
487
|
+
if (!info)
|
|
488
|
+
return { exists: false, status: "absent", absence_reason: "No progress cycles are available from agentera progress." };
|
|
489
|
+
const scan = scanSchemaArtifact(schemas, "progress").active;
|
|
490
|
+
const entries = scan.entries.map((entry) => entry.fields);
|
|
341
491
|
if (entries.length === 0) {
|
|
342
492
|
return { exists: false, status: "absent", absence_reason: "No progress cycles are available from agentera progress." };
|
|
343
493
|
}
|
|
344
|
-
const latest = recentCycles(entries, 1)[0];
|
|
494
|
+
const latest = recentCycles(entries, 1)[0] ?? {};
|
|
495
|
+
const latestCycle = {};
|
|
496
|
+
for (const key of ["number", "timestamp", "type", "phase", "what", "status"]) {
|
|
497
|
+
if (key in latest)
|
|
498
|
+
latestCycle[key] = latest[key];
|
|
499
|
+
}
|
|
345
500
|
return {
|
|
346
501
|
exists: true,
|
|
347
502
|
status: "available",
|
|
348
|
-
latest,
|
|
349
|
-
latest_verification: latest.
|
|
503
|
+
latest: latestCycle,
|
|
504
|
+
latest_verification: latest.verified_present ? { present: true } : null,
|
|
350
505
|
cycle_count: entries.length,
|
|
351
506
|
};
|
|
352
507
|
}
|
|
353
508
|
export function healthSummary(schemas, env = process.env) {
|
|
354
|
-
const
|
|
355
|
-
|
|
509
|
+
const info = schemas.health;
|
|
510
|
+
if (!info)
|
|
511
|
+
return { exists: false };
|
|
512
|
+
const scan = scanSchemaArtifact(schemas, "health").active;
|
|
513
|
+
const entries = scan.entries.map((entry) => entry.fields);
|
|
356
514
|
if (entries.length === 0)
|
|
357
515
|
return { exists: false };
|
|
358
|
-
const latest =
|
|
516
|
+
const latest = [...entries].sort((left, right) => Number(right.number ?? 0) - Number(left.number ?? 0))[0] ?? null;
|
|
359
517
|
if (!latest)
|
|
360
518
|
return { exists: false };
|
|
361
519
|
const grades = latest.grades && typeof latest.grades === "object" && !Array.isArray(latest.grades) ? latest.grades : {};
|
|
@@ -370,18 +528,20 @@ export function healthSummary(schemas, env = process.env) {
|
|
|
370
528
|
const trajectory = String(latest.trajectory ?? "");
|
|
371
529
|
const auditDate = healthAuditDate(latest);
|
|
372
530
|
const dateStr = auditDate !== null ? isoFromUtc(auditDate) : null;
|
|
531
|
+
const latestTimestamp = typeof latest.timestamp === "string" ? latest.timestamp : null;
|
|
373
532
|
const summary = {
|
|
374
533
|
exists: true,
|
|
375
|
-
|
|
534
|
+
id: latest.id ?? null,
|
|
535
|
+
artifact: "health",
|
|
376
536
|
date: dateStr,
|
|
377
|
-
timestamp: dateStr ??
|
|
537
|
+
timestamp: dateStr ?? latestTimestamp,
|
|
378
538
|
trajectory,
|
|
379
539
|
grade: worst ? worst[1] : "",
|
|
380
540
|
worst,
|
|
381
541
|
degrading: ["degrading", "declining", "worse"].includes(trajectory.toLowerCase()) ||
|
|
382
542
|
(worst !== null && worst[2] >= gradeRank.D),
|
|
383
543
|
};
|
|
384
|
-
const staleness =
|
|
544
|
+
const staleness = checkAuditStaleness(schemas, latest, auditDate, env);
|
|
385
545
|
if (staleness !== null)
|
|
386
546
|
Object.assign(summary, staleness);
|
|
387
547
|
return summary;
|
|
@@ -399,7 +559,7 @@ function objectiveStatus(data) {
|
|
|
399
559
|
return String(firstPresent(header, ["status"], data.status ?? objective.status ?? "") || "").toLowerCase();
|
|
400
560
|
}
|
|
401
561
|
export function activeObjectiveSummary() {
|
|
402
|
-
const root = path.join(process.cwd(), ".agentera", "
|
|
562
|
+
const root = path.join(process.cwd(), ".agentera", "optimize");
|
|
403
563
|
let isDir = false;
|
|
404
564
|
try {
|
|
405
565
|
isDir = fs.statSync(root).isDirectory();
|
|
@@ -462,7 +622,11 @@ export function statePresence(plan, docs, progress, health, objective) {
|
|
|
462
622
|
objective: Boolean(objective.exists),
|
|
463
623
|
};
|
|
464
624
|
const absence = {};
|
|
465
|
-
for (const [name, summary] of [
|
|
625
|
+
for (const [name, summary] of [
|
|
626
|
+
["plan", plan],
|
|
627
|
+
["docs", docs],
|
|
628
|
+
["progress", progress],
|
|
629
|
+
]) {
|
|
466
630
|
if (!summary.exists && summary.absence_reason)
|
|
467
631
|
absence[name] = summary.absence_reason;
|
|
468
632
|
}
|
|
@@ -477,43 +641,49 @@ export function statePresence(plan, docs, progress, health, objective) {
|
|
|
477
641
|
}
|
|
478
642
|
// ── decisions follow-up + attention ─────────────────────────────────
|
|
479
643
|
export function decisionFollowUp(schemas) {
|
|
480
|
-
const
|
|
481
|
-
for (const rawEntry of extractEntries(data)) {
|
|
482
|
-
const entry = decisionContextEntry(rawEntry);
|
|
644
|
+
for (const entry of startupDecisionEntries(schemas)) {
|
|
483
645
|
const satisfaction = entry.satisfaction;
|
|
484
|
-
if (!satisfaction || typeof satisfaction !== "object" || !satisfaction.review_needed)
|
|
646
|
+
if (!satisfaction || typeof satisfaction !== "object" || Array.isArray(satisfaction) || !satisfaction.review_needed)
|
|
485
647
|
continue;
|
|
486
|
-
const number = entry.number
|
|
648
|
+
const number = typeof entry.number === "string" || typeof entry.number === "number" ? entry.number : "?";
|
|
487
649
|
const title = firstPresent(entry, ["question", "choice"], "decision follow-up");
|
|
488
|
-
return { object: `DECISION ${number} follow-up`, title };
|
|
650
|
+
return { object: `DECISION ${number} follow-up`, title: String(title) };
|
|
489
651
|
}
|
|
490
652
|
return null;
|
|
491
653
|
}
|
|
654
|
+
export function startupDecisionEntries(schemas) {
|
|
655
|
+
if (!schemas.decisions)
|
|
656
|
+
return [];
|
|
657
|
+
const scans = scanSchemaArtifact(schemas, "decisions");
|
|
658
|
+
return [...scans.active.entries, ...scans.archive.entries].map((candidate) => ({
|
|
659
|
+
...candidate.fields,
|
|
660
|
+
...(candidate.identity.number !== null && candidate.fields.number === undefined ? { number: candidate.identity.number } : {}),
|
|
661
|
+
}));
|
|
662
|
+
}
|
|
492
663
|
function decisionAttentionState(satisfaction) {
|
|
493
664
|
const state = satisfaction.state;
|
|
494
665
|
if (state === null || state === undefined || state === "")
|
|
495
666
|
return "missing";
|
|
496
667
|
if (state === "user_confirmed_satisfied" && satisfaction.review_needed)
|
|
497
668
|
return "unconfirmed_user_confirmed_satisfied";
|
|
498
|
-
if (["open", "provisionally_satisfied", "review_needed"].includes(state))
|
|
669
|
+
if (["open", "provisionally_satisfied", "review_needed"].includes(String(state)))
|
|
499
670
|
return String(state);
|
|
500
671
|
if (state === "user_confirmed_satisfied")
|
|
501
672
|
return "user_confirmed_satisfied";
|
|
502
673
|
return "unrecognized";
|
|
503
674
|
}
|
|
504
675
|
export function decisionReviewAttention(schemas) {
|
|
505
|
-
const data = loadNamedArtifact(schemas, "decisions");
|
|
506
676
|
const reviewEntries = [];
|
|
507
677
|
const stateCounts = {};
|
|
508
|
-
for (const
|
|
509
|
-
const entry = decisionContextEntry(rawEntry);
|
|
678
|
+
for (const entry of startupDecisionEntries(schemas)) {
|
|
510
679
|
const satisfaction = entry.satisfaction;
|
|
511
|
-
if (!satisfaction || typeof satisfaction !== "object" || !satisfaction.review_needed)
|
|
680
|
+
if (!satisfaction || typeof satisfaction !== "object" || Array.isArray(satisfaction) || !satisfaction.review_needed)
|
|
512
681
|
continue;
|
|
513
682
|
const state = decisionAttentionState(satisfaction);
|
|
514
683
|
stateCounts[state] = (stateCounts[state] ?? 0) + 1;
|
|
515
684
|
reviewEntries.push({
|
|
516
|
-
|
|
685
|
+
id: String(entry.stable_id ?? entry.number ?? "legacy-unaddressable"),
|
|
686
|
+
artifact: "decisions",
|
|
517
687
|
title: truncate(firstPresent(entry, ["question", "choice", "summary"], "decision review"), 80),
|
|
518
688
|
state,
|
|
519
689
|
source: satisfaction.source ?? null,
|
|
@@ -526,7 +696,7 @@ export function decisionReviewAttention(schemas) {
|
|
|
526
696
|
.sort()
|
|
527
697
|
.map((name) => `${name}=${stateCounts[name]}`)
|
|
528
698
|
.join(", ");
|
|
529
|
-
const refs = boundedEntries.map((entry) => `Decision ${entry.
|
|
699
|
+
const refs = boundedEntries.map((entry) => `Decision ${entry.id}: ${entry.title}`).join("; ");
|
|
530
700
|
const more = reviewEntries.length - boundedEntries.length;
|
|
531
701
|
const suffix = more > 0 ? `; +${more} more` : "";
|
|
532
702
|
return {
|
|
@@ -541,55 +711,156 @@ export function decisionReviewAttention(schemas) {
|
|
|
541
711
|
}
|
|
542
712
|
export function formatNextAction(action) {
|
|
543
713
|
if (!action)
|
|
544
|
-
return "object=VISION refresh | capability=
|
|
545
|
-
|
|
714
|
+
return "object=VISION refresh | capability=vision | reason=no executable follow-up | phase=envision";
|
|
715
|
+
const fields = [
|
|
716
|
+
`object=${truncate(action.object)}`,
|
|
717
|
+
`capability=${action.capability}`,
|
|
718
|
+
`reason=${action.reason}`,
|
|
719
|
+
];
|
|
720
|
+
if ("phase" in action && action.phase)
|
|
721
|
+
fields.push(`phase=${action.phase}`);
|
|
722
|
+
if ("id" in action && action.id)
|
|
723
|
+
fields.push(`id=${action.id}`);
|
|
724
|
+
if ("artifact" in action && action.artifact)
|
|
725
|
+
fields.push(`artifact=${action.artifact}`);
|
|
726
|
+
if ("outcome" in action && action.outcome)
|
|
727
|
+
fields.push(`outcome=${action.outcome}`);
|
|
728
|
+
if ("eligible" in action && typeof action.eligible === "boolean")
|
|
729
|
+
fields.push(`eligible=${String(action.eligible)}`);
|
|
730
|
+
if ("retrieval" in action
|
|
731
|
+
&& action.retrieval
|
|
732
|
+
&& typeof action.retrieval === "object"
|
|
733
|
+
&& "exact" in action.retrieval
|
|
734
|
+
&& typeof action.retrieval.exact === "string")
|
|
735
|
+
fields.push(`retrieval=${action.retrieval.exact}`);
|
|
736
|
+
return fields.join(" | ");
|
|
546
737
|
}
|
|
547
|
-
|
|
738
|
+
/**
|
|
739
|
+
* Evolved state-readiness hint (Decision 76). Evaluates every cascade branch
|
|
740
|
+
* (no early-return); each candidate carries a protocol.yaml phase tag (PH1
|
|
741
|
+
* envision → PH5 audit). Position 1 (`recommended`) is the branch that would
|
|
742
|
+
* have won under the legacy early-return cascade.
|
|
743
|
+
*/
|
|
744
|
+
export function selectStatusReadiness(plan, health, objective, todoItems, decision, savedContext, completeTodoReadiness) {
|
|
745
|
+
const candidates = [];
|
|
548
746
|
const pending = plan.first_pending;
|
|
549
747
|
if (pending && typeof pending === "object" && !Array.isArray(pending)) {
|
|
550
748
|
const number = pending.number ?? "?";
|
|
551
749
|
const title = firstPresent(pending, ["name", "title"], "pending task");
|
|
552
|
-
|
|
750
|
+
const id = typeof pending.id === "string" ? pending.id : undefined;
|
|
751
|
+
candidates.push({
|
|
752
|
+
object: `PLAN Task ${number}: ${title}`,
|
|
753
|
+
capability: "orchestrate",
|
|
754
|
+
reason: "first pending plan task",
|
|
755
|
+
phase: "build",
|
|
756
|
+
...(id ? {
|
|
757
|
+
id,
|
|
758
|
+
artifact: typeof pending.artifact === "string" ? pending.artifact : "plan",
|
|
759
|
+
outcome: String(pending.status ?? "pending"),
|
|
760
|
+
eligible: true,
|
|
761
|
+
retrieval: { exact: planTaskGetCommand(id) },
|
|
762
|
+
} : {}),
|
|
763
|
+
});
|
|
553
764
|
}
|
|
554
765
|
if (health.degrading) {
|
|
555
766
|
const worst = health.worst;
|
|
556
767
|
const target = worst ? `${worst[0]}:${worst[1]}` : "degrading health";
|
|
557
|
-
|
|
768
|
+
candidates.push({
|
|
769
|
+
object: `HEALTH: ${target}`,
|
|
770
|
+
capability: "audit",
|
|
771
|
+
reason: "critical or degrading health",
|
|
772
|
+
phase: "audit",
|
|
773
|
+
});
|
|
558
774
|
}
|
|
559
775
|
if (objective.active) {
|
|
560
|
-
|
|
776
|
+
const id = typeof objective.id === "string" ? objective.id : undefined;
|
|
777
|
+
candidates.push({
|
|
561
778
|
object: `OBJECTIVE: ${objective.metric || objective.title}`,
|
|
562
|
-
capability: "
|
|
779
|
+
capability: "optimize",
|
|
563
780
|
reason: "active non-closed objective",
|
|
564
|
-
|
|
781
|
+
phase: "build",
|
|
782
|
+
...(id ? {
|
|
783
|
+
id,
|
|
784
|
+
artifact: typeof objective.artifact === "string" ? objective.artifact : "objective",
|
|
785
|
+
outcome: objective.status ?? "active",
|
|
786
|
+
eligible: true,
|
|
787
|
+
retrieval: { exact: objectiveGetCommand(id) },
|
|
788
|
+
} : {}),
|
|
789
|
+
});
|
|
565
790
|
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
791
|
+
const todoReadiness = completeTodoReadiness ?? evaluateTodoReadinessQueue(todoItems.map((item) => ({
|
|
792
|
+
id: String(item.id ?? ""),
|
|
793
|
+
artifact: String(item.artifact ?? "todo"),
|
|
794
|
+
record: { ...item, description: item.text },
|
|
795
|
+
})));
|
|
796
|
+
if (todoReadiness.selected) {
|
|
797
|
+
const item = todoReadiness.selected;
|
|
798
|
+
candidates.push({
|
|
799
|
+
object: `TODO ${item.id}: ${truncate(item.description, 120)}`,
|
|
800
|
+
capability: item.capability,
|
|
801
|
+
reason: item.reason,
|
|
802
|
+
phase: item.phase,
|
|
803
|
+
id: item.id,
|
|
804
|
+
artifact: item.artifact,
|
|
805
|
+
outcome: item.result,
|
|
806
|
+
eligible: item.eligible,
|
|
807
|
+
retrieval: item.retrieval,
|
|
808
|
+
});
|
|
809
|
+
if (todoReadiness.triage.count > 0) {
|
|
810
|
+
candidates.push({
|
|
811
|
+
object: `TODO triage: ${todoReadiness.triage.count} item(s)`,
|
|
812
|
+
capability: "status",
|
|
813
|
+
reason: todoReadiness.triage.recovery,
|
|
814
|
+
phase: "audit",
|
|
815
|
+
outcome: "needs-triage",
|
|
816
|
+
eligible: false,
|
|
817
|
+
});
|
|
570
818
|
}
|
|
571
|
-
|
|
819
|
+
}
|
|
820
|
+
else if (todoReadiness.abstainRecovery) {
|
|
821
|
+
candidates.push({
|
|
822
|
+
object: "TODO queue: no actionable item",
|
|
823
|
+
capability: "status",
|
|
824
|
+
reason: todoReadiness.abstainRecovery,
|
|
825
|
+
phase: "audit",
|
|
826
|
+
outcome: "needs-triage",
|
|
827
|
+
eligible: false,
|
|
828
|
+
});
|
|
572
829
|
}
|
|
573
830
|
if (health.stale && !health.degrading) {
|
|
574
|
-
|
|
575
|
-
object: `HEALTH:
|
|
576
|
-
capability: "
|
|
831
|
+
candidates.push({
|
|
832
|
+
object: `HEALTH: audit ${String(health.id ?? "unknown")} stale`,
|
|
833
|
+
capability: "audit",
|
|
577
834
|
reason: "stale health audit",
|
|
578
|
-
|
|
835
|
+
phase: "audit",
|
|
836
|
+
});
|
|
579
837
|
}
|
|
580
838
|
if (decision) {
|
|
581
|
-
|
|
839
|
+
candidates.push({
|
|
840
|
+
object: String(decision.object),
|
|
841
|
+
capability: "discuss",
|
|
842
|
+
reason: "unresolved decision follow-up",
|
|
843
|
+
phase: "deliberate",
|
|
844
|
+
});
|
|
582
845
|
}
|
|
583
846
|
const visionExists = fs.existsSync(path.join(process.cwd(), ".agentera", "vision.yaml"));
|
|
584
|
-
if (plan.exists && !plan.complete_plan) {
|
|
585
|
-
|
|
847
|
+
if ((plan.exists && !plan.complete_plan) || visionExists) {
|
|
848
|
+
candidates.push({ object: "VISION refresh", capability: "plan", reason: "no executable follow-up", phase: "envision" });
|
|
586
849
|
}
|
|
587
|
-
if (visionExists) {
|
|
588
|
-
|
|
850
|
+
if (savedContext && !visionExists) {
|
|
851
|
+
candidates.push({ object: "Direction clarification", capability: "discuss", reason: "saved context without vision", phase: "envision" });
|
|
589
852
|
}
|
|
590
|
-
|
|
591
|
-
|
|
853
|
+
candidates.push({ object: "VISION refresh", capability: "vision", reason: "fresh project direction", phase: "envision" });
|
|
854
|
+
// Guarantee at least one alternative so the hint never collapses to a single entry.
|
|
855
|
+
if (candidates.length < 2) {
|
|
856
|
+
candidates.push({ object: "Direction clarification", capability: "discuss", reason: "clarify project direction", phase: "envision" });
|
|
592
857
|
}
|
|
593
|
-
|
|
858
|
+
const [recommended, ...alternatives] = candidates;
|
|
859
|
+
return { recommended, alternatives };
|
|
860
|
+
}
|
|
861
|
+
/** Legacy single-entry projection of {@link selectStatusReadiness}: the
|
|
862
|
+
* top-priority candidate as `{object, capability, reason}` (no `phase`). */
|
|
863
|
+
export function selectStatusNextAction(plan, health, objective, todoItems, decision, savedContext, completeTodoReadiness) {
|
|
864
|
+
const { recommended } = selectStatusReadiness(plan, health, objective, todoItems, decision, savedContext, completeTodoReadiness);
|
|
865
|
+
return { object: recommended.object, capability: recommended.capability, reason: recommended.reason };
|
|
594
866
|
}
|
|
595
|
-
//# sourceMappingURL=orientation.js.map
|