agentera 3.0.0-dev.5 → 3.0.0-dev.51
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 +119 -22
- 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 +435 -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 +3022 -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 +11 -14
- 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 +19 -1
- package/bundle/references/cli/vocabulary-index.yaml +20 -17
- package/bundle/references/cli/vocabulary.md +326 -361
- package/bundle/references/meta/retained-reference-authority.yaml +151 -0
- package/bundle/registry.json +13 -13
- package/bundle/skills/agentera/SKILL.md +224 -422
- 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 +178 -34
- 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 +39 -21
- 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 +458 -36
- package/bundle/skills/agentera/schemas/artifacts/progress.yaml +128 -17
- package/bundle/skills/agentera/schemas/artifacts/todo.yaml +342 -42
- 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 +29 -27
- package/dist/capabilities/optimize/instructions.js +14 -0
- package/dist/capabilities/orchestrate/instructions.js +42 -0
- package/dist/capabilities/plan/instructions.js +33 -0
- package/dist/capabilities/profile/instructions.js +70 -0
- package/dist/capabilities/research/instructions.js +5 -0
- package/dist/capabilities/status/instructions.js +15 -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 -2487
- package/dist/cli/commands/appHome.js +22 -0
- package/dist/cli/commands/capability.js +4 -4
- package/dist/cli/commands/compact.js +164 -14
- package/dist/cli/commands/doctor.js +122 -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 +326 -0
- package/dist/cli/commands/prime/collectOrientationState.js +212 -0
- package/dist/cli/commands/prime/orientationOutput.js +399 -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 +430 -0
- package/dist/cli/commands/upgrade.js +146 -5
- package/dist/cli/commands/upgradeVerify.js +118 -0
- package/dist/cli/commands/validate.js +272 -223
- 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 -1294
- package/dist/cli/errors.js +16 -17
- package/dist/cli/help.js +394 -43
- package/dist/cli/migrationRequired.js +87 -0
- package/dist/cli/orientation/attention.js +61 -0
- package/dist/cli/orientation/corpusCoverage.js +102 -0
- package/dist/cli/orientation.js +438 -170
- 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 +56 -14
- 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 +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 -79
- 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 +107 -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 +129 -2
- package/dist/registries/evaluatorHandoffContract.js +2 -3
- 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 +899 -0
- package/dist/state/exactReplacementRecovery.js +18 -0
- package/dist/state/experimentArchive.js +63 -0
- package/dist/state/experimentIdentity.js +202 -0
- package/dist/state/healthEntities.js +262 -0
- package/dist/state/healthEntityValidation.js +18 -0
- package/dist/state/healthRepair.js +69 -0
- package/dist/state/installRoot.js +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 +982 -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/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/todoActivationSafety.js +58 -0
- package/dist/state/todoDocsEntities.js +1069 -0
- package/dist/state/todoDocsEntityValidation.js +158 -0
- package/dist/state/todoMarkdownProjection.js +51 -0
- package/dist/state/todoReconciliationActivation.js +140 -0
- package/dist/state/todoReconciliationInspection.js +169 -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 +363 -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 +367 -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 +144 -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 +42 -8
- 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 +273 -363
- 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 +8 -1
- package/dist/validate/activationArtifactEvidence.js +844 -0
- package/dist/validate/activationConjunction.js +816 -0
- package/dist/validate/activationEvidenceManifest.js +515 -0
- package/dist/validate/activationPackageSemantics.js +29 -0
- package/dist/validate/appHomeContract.js +5 -11
- package/dist/validate/bootstrapAuthority.js +44 -0
- package/dist/validate/capability.js +133 -12
- 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/schemas/artifacts.yaml +0 -73
- package/bundle/skills/agentera/capabilities/dokumentera/schemas/triggers.yaml +0 -35
- 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/schemas/artifacts.yaml +0 -76
- package/bundle/skills/agentera/capabilities/inspektera/schemas/triggers.yaml +0 -38
- 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/schemas/triggers.yaml +0 -39
- 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 -120
- 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/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/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/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/schemas/triggers.yaml +0 -41
- 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/capabilities/dokumentera/instructions.js +0 -6
- package/dist/capabilities/dokumentera/instructions.js.map +0 -1
- package/dist/capabilities/hej/instructions.js +0 -6
- package/dist/capabilities/hej/instructions.js.map +0 -1
- package/dist/capabilities/index.js.map +0 -1
- package/dist/capabilities/inspektera/instructions.js +0 -6
- package/dist/capabilities/inspektera/instructions.js.map +0 -1
- package/dist/capabilities/inspirera/instructions.js +0 -6
- package/dist/capabilities/inspirera/instructions.js.map +0 -1
- package/dist/capabilities/optimera/instructions.js +0 -6
- package/dist/capabilities/optimera/instructions.js.map +0 -1
- package/dist/capabilities/orkestrera/instructions.js +0 -6
- package/dist/capabilities/orkestrera/instructions.js.map +0 -1
- package/dist/capabilities/planera/instructions.js +0 -6
- package/dist/capabilities/planera/instructions.js.map +0 -1
- package/dist/capabilities/profilera/instructions.js +0 -6
- package/dist/capabilities/profilera/instructions.js.map +0 -1
- package/dist/capabilities/realisera/instructions.js +0 -6
- package/dist/capabilities/realisera/instructions.js.map +0 -1
- package/dist/capabilities/resonera/instructions.js +0 -6
- package/dist/capabilities/resonera/instructions.js.map +0 -1
- package/dist/capabilities/visionera/instructions.js +0 -6
- package/dist/capabilities/visionera/instructions.js.map +0 -1
- package/dist/capabilities/visualisera/instructions.js +0 -6
- package/dist/capabilities/visualisera/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.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 -1023
- 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/errors.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/cli/todoMarkdown.js.map +0 -1
- package/dist/core/difflib.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 -935
- 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/evaluatorHandoffContract.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 -1197
- 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/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 -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/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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { preCutoverCommand } from "./preCutoverCommand.js";
|
|
4
|
+
import { loadArtifactRecord, resolveArtifactPath, } from "../registries/artifactRegistry.js";
|
|
5
|
+
import { activeObjectiveName, artifactPath, resolveRegistryModelPath, } from "./appContext.js";
|
|
6
|
+
import { asList, extractEntries, firstPresent, loadArtifact, recentCycles, truncate, } from "./stateQuery.js";
|
|
7
|
+
import { normalizeSeverity } from "./commands/state/index.js";
|
|
7
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
|
+
*/
|
|
8
41
|
export const DONE_STATUSES = new Set(["complete", "completed", "closed", "done", "resolved", "retired"]);
|
|
9
42
|
export const BLOCKED_STATUSES = new Set(["blocked", "stuck"]);
|
|
10
43
|
export const DECISION_ATTENTION_MAX_ENTRIES = 3;
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
normal: 2,
|
|
17
|
-
info: 3,
|
|
18
|
-
annoying: 3,
|
|
19
|
-
};
|
|
20
|
-
const TODO_SECTION_SEVERITIES = {
|
|
21
|
-
critical: "critical",
|
|
22
|
-
degraded: "degraded",
|
|
23
|
-
warning: "warning",
|
|
24
|
-
normal: "normal",
|
|
25
|
-
info: "info",
|
|
26
|
-
annoying: "annoying",
|
|
27
|
-
};
|
|
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 ───────────────────────────────────────
|
|
@@ -230,7 +262,7 @@ export function loadTodoItems(schemas) {
|
|
|
230
262
|
export function issueCounts(todoItems) {
|
|
231
263
|
const counts = { critical: 0, degraded: 0, normal: 0, annoying: 0 };
|
|
232
264
|
for (const item of todoItems) {
|
|
233
|
-
const severity = item.severity;
|
|
265
|
+
const severity = String(item.severity ?? "normal");
|
|
234
266
|
if (severity === "critical")
|
|
235
267
|
counts.critical += 1;
|
|
236
268
|
else if (severity === "degraded" || severity === "warning")
|
|
@@ -242,123 +274,246 @@ export function issueCounts(todoItems) {
|
|
|
242
274
|
}
|
|
243
275
|
return counts;
|
|
244
276
|
}
|
|
245
|
-
function todoNeedsPlanera(item) {
|
|
246
|
-
const text = item.text.toLowerCase();
|
|
247
|
-
let signalCount = 0;
|
|
248
|
-
for (const signal of TODO_PLANERA_SIGNALS)
|
|
249
|
-
if (text.includes(signal))
|
|
250
|
-
signalCount += 1;
|
|
251
|
-
return signalCount >= 2 || (signalCount >= 1 && text.length > 180);
|
|
252
|
-
}
|
|
253
277
|
// ── per-artifact summaries ──────────────────────────────────────────
|
|
254
278
|
export function planSummary(schemas) {
|
|
255
|
-
const
|
|
256
|
-
if (!
|
|
257
|
-
|
|
279
|
+
const info = schemas.plan;
|
|
280
|
+
if (!info) {
|
|
281
|
+
const summary = {
|
|
258
282
|
exists: false,
|
|
259
283
|
active: false,
|
|
260
284
|
tasks: [],
|
|
261
285
|
status: "absent",
|
|
262
286
|
title: "",
|
|
263
|
-
|
|
287
|
+
active_path: "",
|
|
288
|
+
absence_reason: "No active plan artifact is available from agentera state plan.",
|
|
264
289
|
};
|
|
290
|
+
summary.lifecycle_state = planLifecycleState(summary);
|
|
291
|
+
return summary;
|
|
265
292
|
}
|
|
266
|
-
const
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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;
|
|
281
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;
|
|
282
329
|
const complete = tasks.filter((task) => DONE_STATUSES.has(entryStatusPy(task, ""))).length;
|
|
283
330
|
const total = tasks.length;
|
|
284
331
|
const completePlan = DONE_STATUSES.has(status.toLowerCase()) && complete === total;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
if (DONE_STATUSES.has(ts) || BLOCKED_STATUSES.has(ts))
|
|
290
|
-
continue;
|
|
291
|
-
firstPending = task;
|
|
292
|
-
break;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
return {
|
|
332
|
+
const firstPending = completePlan
|
|
333
|
+
? null
|
|
334
|
+
: firstActionablePlanTask(tasks);
|
|
335
|
+
const summary = {
|
|
296
336
|
exists: true,
|
|
297
337
|
status,
|
|
298
338
|
title,
|
|
339
|
+
active_path: discovery.activePath,
|
|
299
340
|
constraints: d.constraints ?? null,
|
|
300
341
|
scope: d.scope ?? null,
|
|
301
342
|
design: d.design ?? null,
|
|
302
343
|
tasks,
|
|
303
344
|
complete,
|
|
304
345
|
total,
|
|
305
|
-
active:
|
|
346
|
+
active: true,
|
|
306
347
|
complete_plan: completePlan,
|
|
307
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,
|
|
308
451
|
};
|
|
309
452
|
}
|
|
310
|
-
export function docsSummary(schemas) {
|
|
311
|
-
const
|
|
312
|
-
if (!
|
|
313
|
-
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." };
|
|
314
457
|
}
|
|
315
|
-
const
|
|
316
|
-
const mapping =
|
|
317
|
-
const index =
|
|
318
|
-
const
|
|
319
|
-
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;
|
|
320
464
|
return {
|
|
321
|
-
exists
|
|
465
|
+
exists,
|
|
322
466
|
status: "available",
|
|
323
|
-
last_audit:
|
|
324
|
-
conventions,
|
|
325
|
-
mapping,
|
|
326
|
-
mapping_entries: mapping.length,
|
|
327
|
-
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: {},
|
|
328
472
|
source_contract: {
|
|
329
|
-
capability_startup_complete:
|
|
473
|
+
capability_startup_complete: capabilityStartupComplete(startupInput),
|
|
330
474
|
raw_artifact_reads_required: false,
|
|
331
475
|
state_families: [
|
|
332
476
|
"plan task details, dependencies, acceptance criteria, and evidence summaries",
|
|
333
477
|
"docs artifact mapping and source-contract completeness metadata",
|
|
334
|
-
"latest progress verification metadata needed for
|
|
335
|
-
"
|
|
478
|
+
"latest progress verification metadata needed for Orchestrate evaluation",
|
|
479
|
+
"Document closeout context metadata for docs/TODO/changelog/progress synchronization",
|
|
336
480
|
],
|
|
337
481
|
},
|
|
338
|
-
indexed_documents: index.length,
|
|
482
|
+
indexed_documents: index.entries.length,
|
|
339
483
|
};
|
|
340
484
|
}
|
|
341
485
|
export function progressSummary(schemas) {
|
|
342
|
-
const
|
|
343
|
-
|
|
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);
|
|
344
491
|
if (entries.length === 0) {
|
|
345
492
|
return { exists: false, status: "absent", absence_reason: "No progress cycles are available from agentera progress." };
|
|
346
493
|
}
|
|
347
|
-
const latest =
|
|
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
|
+
}
|
|
348
500
|
return {
|
|
349
501
|
exists: true,
|
|
350
502
|
status: "available",
|
|
351
|
-
latest,
|
|
352
|
-
latest_verification: latest.
|
|
503
|
+
latest: latestCycle,
|
|
504
|
+
latest_verification: latest.verified_present ? { present: true } : null,
|
|
353
505
|
cycle_count: entries.length,
|
|
354
506
|
};
|
|
355
507
|
}
|
|
356
508
|
export function healthSummary(schemas, env = process.env) {
|
|
357
|
-
const
|
|
358
|
-
|
|
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);
|
|
359
514
|
if (entries.length === 0)
|
|
360
515
|
return { exists: false };
|
|
361
|
-
const latest =
|
|
516
|
+
const latest = [...entries].sort((left, right) => Number(right.number ?? 0) - Number(left.number ?? 0))[0] ?? null;
|
|
362
517
|
if (!latest)
|
|
363
518
|
return { exists: false };
|
|
364
519
|
const grades = latest.grades && typeof latest.grades === "object" && !Array.isArray(latest.grades) ? latest.grades : {};
|
|
@@ -373,18 +528,20 @@ export function healthSummary(schemas, env = process.env) {
|
|
|
373
528
|
const trajectory = String(latest.trajectory ?? "");
|
|
374
529
|
const auditDate = healthAuditDate(latest);
|
|
375
530
|
const dateStr = auditDate !== null ? isoFromUtc(auditDate) : null;
|
|
531
|
+
const latestTimestamp = typeof latest.timestamp === "string" ? latest.timestamp : null;
|
|
376
532
|
const summary = {
|
|
377
533
|
exists: true,
|
|
378
|
-
|
|
534
|
+
id: latest.id ?? null,
|
|
535
|
+
artifact: "health",
|
|
379
536
|
date: dateStr,
|
|
380
|
-
timestamp: dateStr ??
|
|
537
|
+
timestamp: dateStr ?? latestTimestamp,
|
|
381
538
|
trajectory,
|
|
382
539
|
grade: worst ? worst[1] : "",
|
|
383
540
|
worst,
|
|
384
541
|
degrading: ["degrading", "declining", "worse"].includes(trajectory.toLowerCase()) ||
|
|
385
542
|
(worst !== null && worst[2] >= gradeRank.D),
|
|
386
543
|
};
|
|
387
|
-
const staleness =
|
|
544
|
+
const staleness = checkAuditStaleness(schemas, latest, auditDate, env);
|
|
388
545
|
if (staleness !== null)
|
|
389
546
|
Object.assign(summary, staleness);
|
|
390
547
|
return summary;
|
|
@@ -402,7 +559,7 @@ function objectiveStatus(data) {
|
|
|
402
559
|
return String(firstPresent(header, ["status"], data.status ?? objective.status ?? "") || "").toLowerCase();
|
|
403
560
|
}
|
|
404
561
|
export function activeObjectiveSummary() {
|
|
405
|
-
const root = path.join(process.cwd(), ".agentera", "
|
|
562
|
+
const root = path.join(process.cwd(), ".agentera", "optimize");
|
|
406
563
|
let isDir = false;
|
|
407
564
|
try {
|
|
408
565
|
isDir = fs.statSync(root).isDirectory();
|
|
@@ -465,7 +622,11 @@ export function statePresence(plan, docs, progress, health, objective) {
|
|
|
465
622
|
objective: Boolean(objective.exists),
|
|
466
623
|
};
|
|
467
624
|
const absence = {};
|
|
468
|
-
for (const [name, summary] of [
|
|
625
|
+
for (const [name, summary] of [
|
|
626
|
+
["plan", plan],
|
|
627
|
+
["docs", docs],
|
|
628
|
+
["progress", progress],
|
|
629
|
+
]) {
|
|
469
630
|
if (!summary.exists && summary.absence_reason)
|
|
470
631
|
absence[name] = summary.absence_reason;
|
|
471
632
|
}
|
|
@@ -480,43 +641,49 @@ export function statePresence(plan, docs, progress, health, objective) {
|
|
|
480
641
|
}
|
|
481
642
|
// ── decisions follow-up + attention ─────────────────────────────────
|
|
482
643
|
export function decisionFollowUp(schemas) {
|
|
483
|
-
const
|
|
484
|
-
for (const rawEntry of extractEntries(data)) {
|
|
485
|
-
const entry = decisionContextEntry(rawEntry);
|
|
644
|
+
for (const entry of startupDecisionEntries(schemas)) {
|
|
486
645
|
const satisfaction = entry.satisfaction;
|
|
487
|
-
if (!satisfaction || typeof satisfaction !== "object" || !satisfaction.review_needed)
|
|
646
|
+
if (!satisfaction || typeof satisfaction !== "object" || Array.isArray(satisfaction) || !satisfaction.review_needed)
|
|
488
647
|
continue;
|
|
489
|
-
const number = entry.number
|
|
648
|
+
const number = typeof entry.number === "string" || typeof entry.number === "number" ? entry.number : "?";
|
|
490
649
|
const title = firstPresent(entry, ["question", "choice"], "decision follow-up");
|
|
491
|
-
return { object: `DECISION ${number} follow-up`, title };
|
|
650
|
+
return { object: `DECISION ${number} follow-up`, title: String(title) };
|
|
492
651
|
}
|
|
493
652
|
return null;
|
|
494
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
|
+
}
|
|
495
663
|
function decisionAttentionState(satisfaction) {
|
|
496
664
|
const state = satisfaction.state;
|
|
497
665
|
if (state === null || state === undefined || state === "")
|
|
498
666
|
return "missing";
|
|
499
667
|
if (state === "user_confirmed_satisfied" && satisfaction.review_needed)
|
|
500
668
|
return "unconfirmed_user_confirmed_satisfied";
|
|
501
|
-
if (["open", "provisionally_satisfied", "review_needed"].includes(state))
|
|
669
|
+
if (["open", "provisionally_satisfied", "review_needed"].includes(String(state)))
|
|
502
670
|
return String(state);
|
|
503
671
|
if (state === "user_confirmed_satisfied")
|
|
504
672
|
return "user_confirmed_satisfied";
|
|
505
673
|
return "unrecognized";
|
|
506
674
|
}
|
|
507
675
|
export function decisionReviewAttention(schemas) {
|
|
508
|
-
const data = loadNamedArtifact(schemas, "decisions");
|
|
509
676
|
const reviewEntries = [];
|
|
510
677
|
const stateCounts = {};
|
|
511
|
-
for (const
|
|
512
|
-
const entry = decisionContextEntry(rawEntry);
|
|
678
|
+
for (const entry of startupDecisionEntries(schemas)) {
|
|
513
679
|
const satisfaction = entry.satisfaction;
|
|
514
|
-
if (!satisfaction || typeof satisfaction !== "object" || !satisfaction.review_needed)
|
|
680
|
+
if (!satisfaction || typeof satisfaction !== "object" || Array.isArray(satisfaction) || !satisfaction.review_needed)
|
|
515
681
|
continue;
|
|
516
682
|
const state = decisionAttentionState(satisfaction);
|
|
517
683
|
stateCounts[state] = (stateCounts[state] ?? 0) + 1;
|
|
518
684
|
reviewEntries.push({
|
|
519
|
-
|
|
685
|
+
id: String(entry.stable_id ?? entry.number ?? "legacy-unaddressable"),
|
|
686
|
+
artifact: "decisions",
|
|
520
687
|
title: truncate(firstPresent(entry, ["question", "choice", "summary"], "decision review"), 80),
|
|
521
688
|
state,
|
|
522
689
|
source: satisfaction.source ?? null,
|
|
@@ -529,7 +696,7 @@ export function decisionReviewAttention(schemas) {
|
|
|
529
696
|
.sort()
|
|
530
697
|
.map((name) => `${name}=${stateCounts[name]}`)
|
|
531
698
|
.join(", ");
|
|
532
|
-
const refs = boundedEntries.map((entry) => `Decision ${entry.
|
|
699
|
+
const refs = boundedEntries.map((entry) => `Decision ${entry.id}: ${entry.title}`).join("; ");
|
|
533
700
|
const more = reviewEntries.length - boundedEntries.length;
|
|
534
701
|
const suffix = more > 0 ? `; +${more} more` : "";
|
|
535
702
|
return {
|
|
@@ -544,55 +711,156 @@ export function decisionReviewAttention(schemas) {
|
|
|
544
711
|
}
|
|
545
712
|
export function formatNextAction(action) {
|
|
546
713
|
if (!action)
|
|
547
|
-
return "object=VISION refresh | capability=
|
|
548
|
-
|
|
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(" | ");
|
|
549
737
|
}
|
|
550
|
-
|
|
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 = [];
|
|
551
746
|
const pending = plan.first_pending;
|
|
552
747
|
if (pending && typeof pending === "object" && !Array.isArray(pending)) {
|
|
553
748
|
const number = pending.number ?? "?";
|
|
554
749
|
const title = firstPresent(pending, ["name", "title"], "pending task");
|
|
555
|
-
|
|
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
|
+
});
|
|
556
764
|
}
|
|
557
765
|
if (health.degrading) {
|
|
558
766
|
const worst = health.worst;
|
|
559
767
|
const target = worst ? `${worst[0]}:${worst[1]}` : "degrading health";
|
|
560
|
-
|
|
768
|
+
candidates.push({
|
|
769
|
+
object: `HEALTH: ${target}`,
|
|
770
|
+
capability: "audit",
|
|
771
|
+
reason: "critical or degrading health",
|
|
772
|
+
phase: "audit",
|
|
773
|
+
});
|
|
561
774
|
}
|
|
562
775
|
if (objective.active) {
|
|
563
|
-
|
|
776
|
+
const id = typeof objective.id === "string" ? objective.id : undefined;
|
|
777
|
+
candidates.push({
|
|
564
778
|
object: `OBJECTIVE: ${objective.metric || objective.title}`,
|
|
565
|
-
capability: "
|
|
779
|
+
capability: "optimize",
|
|
566
780
|
reason: "active non-closed objective",
|
|
567
|
-
|
|
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
|
+
});
|
|
568
790
|
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
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
|
+
});
|
|
573
818
|
}
|
|
574
|
-
|
|
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
|
+
});
|
|
575
829
|
}
|
|
576
830
|
if (health.stale && !health.degrading) {
|
|
577
|
-
|
|
578
|
-
object: `HEALTH:
|
|
579
|
-
capability: "
|
|
831
|
+
candidates.push({
|
|
832
|
+
object: `HEALTH: audit ${String(health.id ?? "unknown")} stale`,
|
|
833
|
+
capability: "audit",
|
|
580
834
|
reason: "stale health audit",
|
|
581
|
-
|
|
835
|
+
phase: "audit",
|
|
836
|
+
});
|
|
582
837
|
}
|
|
583
838
|
if (decision) {
|
|
584
|
-
|
|
839
|
+
candidates.push({
|
|
840
|
+
object: String(decision.object),
|
|
841
|
+
capability: "discuss",
|
|
842
|
+
reason: "unresolved decision follow-up",
|
|
843
|
+
phase: "deliberate",
|
|
844
|
+
});
|
|
585
845
|
}
|
|
586
846
|
const visionExists = fs.existsSync(path.join(process.cwd(), ".agentera", "vision.yaml"));
|
|
587
|
-
if (plan.exists && !plan.complete_plan) {
|
|
588
|
-
|
|
847
|
+
if ((plan.exists && !plan.complete_plan) || visionExists) {
|
|
848
|
+
candidates.push({ object: "VISION refresh", capability: "plan", reason: "no executable follow-up", phase: "envision" });
|
|
589
849
|
}
|
|
590
|
-
if (visionExists) {
|
|
591
|
-
|
|
850
|
+
if (savedContext && !visionExists) {
|
|
851
|
+
candidates.push({ object: "Direction clarification", capability: "discuss", reason: "saved context without vision", phase: "envision" });
|
|
592
852
|
}
|
|
593
|
-
|
|
594
|
-
|
|
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" });
|
|
595
857
|
}
|
|
596
|
-
|
|
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 };
|
|
597
866
|
}
|
|
598
|
-
//# sourceMappingURL=orientation.js.map
|