agentera 3.0.0-dev.7 → 3.0.0-dev.72
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 +118 -22
- package/bundle/CHANGELOG.md +1361 -0
- package/bundle/DESIGN.md +229 -0
- package/bundle/LICENSE +201 -0
- package/bundle/README.md +143 -0
- package/bundle/UPGRADE.md +252 -0
- package/bundle/extract-corpus-parity.json +2 -4
- package/bundle/fixtures/routing/hybrid-corpus.yaml +154 -0
- package/bundle/references/adapters/package-publication.json +488 -0
- package/bundle/references/adapters/package-registry.yaml +435 -188
- package/bundle/references/adapters/package-surface-characterization.md +66 -34
- 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 +266 -0
- package/bundle/references/artifacts/artifact-registry-interface-model.yaml +17 -8
- package/bundle/references/artifacts/glossary-entry-contract.yaml +1254 -0
- package/bundle/references/artifacts/state-storage-authority.yaml +3061 -0
- package/bundle/references/artifacts/verbosity-budget-authority.yaml +42 -0
- package/bundle/references/cli/app-lifecycle-vocabulary.yaml +3 -4
- package/bundle/references/cli/capability-instruction-contract.yaml +11 -14
- package/bundle/references/cli/hybrid-route-contract.yaml +438 -0
- package/bundle/references/cli/routing-model.md +152 -93
- package/bundle/references/cli/trigger-schema-enrichment.md +57 -46
- package/bundle/references/cli/update-channels.yaml +4 -2
- package/bundle/references/cli/vocabulary-index.yaml +5 -7
- package/bundle/references/cli/vocabulary.md +51 -93
- package/bundle/references/meta/retained-reference-authority.yaml +151 -0
- package/bundle/skills/agentera/SKILL.md +183 -63
- package/bundle/skills/agentera/capabilities/audit/schemas/artifacts.yaml +27 -19
- package/bundle/skills/agentera/capabilities/audit/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/audit/schemas/triggers.yaml +13 -35
- package/bundle/skills/agentera/capabilities/audit/schemas/validation.yaml +30 -11
- package/bundle/skills/agentera/capabilities/build/schemas/artifacts.yaml +44 -21
- package/bundle/skills/agentera/capabilities/build/schemas/exit.yaml +8 -6
- package/bundle/skills/agentera/capabilities/build/schemas/triggers.yaml +14 -36
- package/bundle/skills/agentera/capabilities/build/schemas/validation.yaml +95 -21
- package/bundle/skills/agentera/capabilities/design/schemas/artifacts.yaml +6 -6
- package/bundle/skills/agentera/capabilities/design/schemas/exit.yaml +5 -5
- package/bundle/skills/agentera/capabilities/design/schemas/triggers.yaml +5 -34
- package/bundle/skills/agentera/capabilities/design/schemas/validation.yaml +2 -2
- package/bundle/skills/agentera/capabilities/discuss/schemas/artifacts.yaml +17 -13
- package/bundle/skills/agentera/capabilities/discuss/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/discuss/schemas/triggers.yaml +6 -40
- package/bundle/skills/agentera/capabilities/discuss/schemas/validation.yaml +72 -5
- package/bundle/skills/agentera/capabilities/document/schemas/artifacts.yaml +24 -17
- package/bundle/skills/agentera/capabilities/document/schemas/triggers.yaml +5 -35
- package/bundle/skills/agentera/capabilities/document/schemas/validation.yaml +13 -13
- package/bundle/skills/agentera/capabilities/optimize/schemas/artifacts.yaml +10 -10
- package/bundle/skills/agentera/capabilities/optimize/schemas/exit.yaml +2 -2
- package/bundle/skills/agentera/capabilities/optimize/schemas/triggers.yaml +4 -35
- package/bundle/skills/agentera/capabilities/optimize/schemas/validation.yaml +3 -3
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/artifacts.yaml +34 -22
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/exit.yaml +9 -7
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/triggers.yaml +5 -37
- package/bundle/skills/agentera/capabilities/orchestrate/schemas/validation.yaml +38 -37
- package/bundle/skills/agentera/capabilities/plan/schemas/artifacts.yaml +20 -16
- package/bundle/skills/agentera/capabilities/plan/schemas/triggers.yaml +8 -31
- package/bundle/skills/agentera/capabilities/plan/schemas/validation.yaml +66 -6
- package/bundle/skills/agentera/capabilities/profile/schemas/artifacts.yaml +9 -4
- package/bundle/skills/agentera/capabilities/profile/schemas/exit.yaml +4 -4
- package/bundle/skills/agentera/capabilities/profile/schemas/triggers.yaml +8 -37
- package/bundle/skills/agentera/capabilities/profile/schemas/validation.yaml +61 -3
- package/bundle/skills/agentera/capabilities/research/schemas/artifacts.yaml +6 -6
- package/bundle/skills/agentera/capabilities/research/schemas/triggers.yaml +5 -29
- package/bundle/skills/agentera/capabilities/status/schemas/artifacts.yaml +13 -12
- package/bundle/skills/agentera/capabilities/status/schemas/triggers.yaml +7 -49
- package/bundle/skills/agentera/capabilities/vision/schemas/artifacts.yaml +8 -8
- package/bundle/skills/agentera/capabilities/vision/schemas/exit.yaml +7 -6
- package/bundle/skills/agentera/capabilities/vision/schemas/triggers.yaml +7 -39
- package/bundle/skills/agentera/capabilities/vision/schemas/validation.yaml +14 -16
- package/bundle/skills/agentera/capability_schema_contract.yaml +32 -32
- package/bundle/skills/agentera/protocol.yaml +4 -4
- package/bundle/skills/agentera/route-phrases.yaml +81 -0
- package/bundle/skills/agentera/schemas/artifacts/changelog.yaml +1 -0
- package/bundle/skills/agentera/schemas/artifacts/decisions.yaml +30 -12
- package/bundle/skills/agentera/schemas/artifacts/design.yaml +1 -0
- package/bundle/skills/agentera/schemas/artifacts/docs.yaml +7 -12
- package/bundle/skills/agentera/schemas/artifacts/experiments.yaml +140 -9
- package/bundle/skills/agentera/schemas/artifacts/glossary.yaml +82 -0
- package/bundle/skills/agentera/schemas/artifacts/health.yaml +56 -19
- package/bundle/skills/agentera/schemas/artifacts/objective.yaml +18 -4
- package/bundle/skills/agentera/schemas/artifacts/plan.yaml +457 -32
- package/bundle/skills/agentera/schemas/artifacts/progress.yaml +131 -18
- package/bundle/skills/agentera/schemas/artifacts/todo.yaml +302 -7
- package/dist/analytics/extractCorpus/cli.js +52 -11
- package/dist/analytics/extractCorpus/copilotSessions.js +6 -4
- package/dist/analytics/extractCorpus/core.js +40 -12
- package/dist/analytics/extractCorpus/corpus.js +39 -17
- package/dist/analytics/extractCorpus/coverageAudit.js +44 -45
- package/dist/analytics/extractCorpus/cursorSessions.js +6 -4
- package/dist/analytics/extractCorpus/evidenceTiers.js +603 -0
- package/dist/analytics/extractCorpus/extractCorpusParity.js +4 -4
- package/dist/analytics/extractCorpus/filesystemSources.js +1 -5
- package/dist/analytics/extractCorpus/index.js +3 -1
- package/dist/analytics/extractCorpus/jsonlSessions.js +24 -5
- package/dist/analytics/extractCorpus/sqliteCaps.js +0 -1
- package/dist/analytics/extractCorpus/sqliteSessions.js +0 -1
- package/dist/analytics/extractCorpus/tierReader.js +108 -0
- package/dist/analytics/extractCorpus.js +0 -1
- package/dist/analytics/glossaryAdviceResolution.js +166 -0
- package/dist/analytics/glossaryInputAcquisition.js +319 -0
- package/dist/analytics/personalGlossaryAdmission.js +133 -0
- package/dist/analytics/personalGlossaryProfile.js +219 -0
- package/dist/analytics/profileSignals.js +211 -0
- package/dist/analytics/usageStats.js +150 -23
- package/dist/audit/terminologyDrift.js +281 -0
- package/dist/bin/agentera.js +3 -2
- package/dist/capabilities/audit/instructions.js +16 -6
- package/dist/capabilities/build/instructions.js +59 -6
- package/dist/capabilities/design/instructions.js +3 -4
- package/dist/capabilities/discuss/instructions.js +29 -6
- package/dist/capabilities/document/instructions.js +11 -6
- package/dist/capabilities/index.js +16 -14
- package/dist/capabilities/optimize/instructions.js +14 -6
- package/dist/capabilities/orchestrate/instructions.js +42 -6
- package/dist/capabilities/plan/instructions.js +30 -3
- package/dist/capabilities/profile/instructions.js +70 -6
- package/dist/capabilities/research/instructions.js +4 -5
- package/dist/capabilities/status/instructions.js +15 -6
- package/dist/capabilities/status/startupInstructions.js +34 -0
- package/dist/capabilities/vision/instructions.js +3 -5
- package/dist/cli/appContext.js +14 -7
- package/dist/cli/argvalidate.js +0 -1
- package/dist/cli/capabilityContext/benchmark.js +5 -4
- package/dist/cli/capabilityContext/bespoke.js +14 -6
- package/dist/cli/capabilityContext/build.js +116 -42
- package/dist/cli/capabilityContext/closeout.js +30 -27
- package/dist/cli/capabilityContext/contract.js +18 -27
- package/dist/cli/capabilityContext/evidence.js +84 -77
- package/dist/cli/capabilityContext/index.js +0 -1
- package/dist/cli/capabilityContext/orchestration.js +42 -18
- package/dist/cli/capabilityContext/planState.js +89 -96
- package/dist/cli/capabilityContext/progress.js +51 -12
- package/dist/cli/capabilityContext/projectVerification.js +409 -0
- package/dist/cli/capabilityContext/shared.js +9 -20
- package/dist/cli/capabilityContext/slim.js +52 -8
- package/dist/cli/capabilityContext/startup.js +51 -114
- package/dist/cli/capabilityContext/startupAggregation.js +68 -0
- package/dist/cli/capabilityContext/types.js +26 -10
- package/dist/cli/capabilityContext.js +0 -1
- package/dist/cli/commands/appHome.js +0 -1
- package/dist/cli/commands/capability.js +2 -2
- package/dist/cli/commands/compact.js +163 -13
- package/dist/cli/commands/doctor.js +117 -11
- package/dist/cli/commands/durability.js +81 -0
- package/dist/cli/commands/glossaryAdvice.js +138 -0
- package/dist/cli/commands/lint.js +22 -8
- package/dist/cli/commands/personalGlossary.js +176 -0
- package/dist/cli/commands/prime/briefOrientation.js +746 -0
- package/dist/cli/commands/prime/buildExecutionRequest.js +165 -0
- package/dist/cli/commands/prime/bundleStatus.js +54 -4
- package/dist/cli/commands/prime/collectEntityOrientation.js +326 -0
- package/dist/cli/commands/prime/collectOrientationState.js +126 -63
- package/dist/cli/commands/prime/orientationOutput.js +267 -56
- package/dist/cli/commands/prime/types.js +0 -1
- package/dist/cli/commands/prime/v1Migration.js +0 -1
- package/dist/cli/commands/prime.js +76 -11
- package/dist/cli/commands/profileGrounding.js +55 -0
- package/dist/cli/commands/query.js +74 -52
- package/dist/cli/commands/report.js +73 -19
- package/dist/cli/commands/route.js +142 -0
- package/dist/cli/commands/schema.js +257 -138
- package/dist/cli/commands/state/decisions.js +40 -56
- package/dist/cli/commands/state/docs.js +58 -85
- package/dist/cli/commands/state/experimentRecords.js +151 -0
- package/dist/cli/commands/state/experiments.js +11 -65
- package/dist/cli/commands/state/get.js +129 -0
- package/dist/cli/commands/state/health.js +11 -113
- package/dist/cli/commands/state/index.js +6 -41
- package/dist/cli/commands/state/list.js +194 -0
- package/dist/cli/commands/state/objective.js +21 -65
- package/dist/cli/commands/state/plan.js +11 -170
- package/dist/cli/commands/state/planTasks.js +154 -0
- package/dist/cli/commands/state/plans.js +154 -0
- package/dist/cli/commands/state/progress.js +11 -45
- package/dist/cli/commands/state/shared.js +0 -1
- package/dist/cli/commands/state/todo.js +28 -107
- package/dist/cli/commands/state/write.js +433 -0
- package/dist/cli/commands/upgrade.js +146 -5
- package/dist/cli/commands/upgradeVerify.js +118 -0
- package/dist/cli/commands/validate.js +235 -136
- package/dist/cli/commands/verify.js +23 -8
- package/dist/cli/contracts/bundleStatus.js +0 -1
- package/dist/cli/contracts/orientationState.js +0 -1
- package/dist/cli/dispatch/argvParser.js +0 -1
- package/dist/cli/dispatch/check.js +84 -40
- package/dist/cli/dispatch/commands.js +3 -3
- package/dist/cli/dispatch/index.js +77 -52
- package/dist/cli/dispatch/lifecycle.js +117 -62
- package/dist/cli/dispatch/prime.js +37 -2
- package/dist/cli/dispatch/projections.js +17 -0
- package/dist/cli/dispatch/shared.js +1 -2
- package/dist/cli/dispatch/state.js +62 -66
- package/dist/cli/dispatch.js +0 -1
- package/dist/cli/errors.js +16 -17
- package/dist/cli/help.js +358 -39
- package/dist/cli/migrationRequired.js +122 -0
- package/dist/cli/orientation/attention.js +19 -19
- package/dist/cli/orientation/corpusCoverage.js +32 -1
- package/dist/cli/orientation.js +346 -129
- package/dist/cli/planArtifacts.js +350 -0
- package/dist/cli/planEvidence.js +157 -0
- package/dist/cli/planLifecycleState.js +36 -0
- package/dist/cli/planTaskIndex.js +11 -0
- package/dist/cli/preCutoverCommand.js +32 -0
- package/dist/cli/prime-blob.js +71 -3
- package/dist/cli/profileAcquisition.js +167 -0
- package/dist/cli/startupCompletenessContract.js +11 -8
- package/dist/cli/stateQuery.js +47 -12
- package/dist/cli/structured.js +0 -1
- package/dist/cli/todoMarkdown.js +25 -12
- package/dist/cli/todoReadinessSelection.js +192 -0
- package/dist/cli/todoSeverity.js +0 -1
- package/dist/core/atomicWriter.js +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 +0 -1
- package/dist/core/jsonValue.js +0 -1
- package/dist/core/paths.js +0 -1
- package/dist/core/pyjson.js +0 -1
- package/dist/core/shell.js +4 -0
- package/dist/core/skillIdentity.js +23 -0
- package/dist/core/sourceRoot.js +9 -12
- package/dist/core/text.js +10 -0
- package/dist/core/toml.js +0 -1
- package/dist/core/yaml.js +8 -1
- package/dist/eval/evalSkills.js +13 -14
- package/dist/eval/hybridRouteEvaluation.js +155 -0
- package/dist/eval/semanticEval.js +0 -1
- package/dist/eval/semanticFixtures.js +0 -1
- package/dist/hooks/common.js +3 -56
- package/dist/hooks/compaction/apply.js +224 -47
- package/dist/hooks/compaction/dryRun.js +2 -1
- package/dist/hooks/compaction/index.js +5 -6
- package/dist/hooks/compaction/parse.js +73 -6
- package/dist/hooks/compaction/retention.js +28 -25
- package/dist/hooks/compaction/status.js +145 -26
- package/dist/hooks/compaction/types.js +0 -1
- package/dist/hooks/validateArtifact/agentFacing.js +0 -1
- package/dist/hooks/validateArtifact/index.js +6 -65
- package/dist/hooks/validateArtifact/markdown.js +9 -10
- package/dist/hooks/validateArtifact/schema.js +96 -9
- package/dist/hooks/validateArtifact/traversal.js +12 -11
- package/dist/hooks/validateArtifact/violations.js +5 -3
- package/dist/migrate/v2HandoffManifest.js +8 -3
- package/dist/registries/activationContract.js +2 -0
- package/dist/registries/activationTuples.js +108 -0
- package/dist/registries/artifactProtocolIds.js +2 -1
- package/dist/registries/artifactRegistry.js +207 -60
- package/dist/registries/artifactSchemaProjection.js +45 -0
- package/dist/registries/capabilityContract.js +5 -21
- package/dist/registries/evaluatorHandoffContract.js +0 -1
- package/dist/registries/evidenceTierContract.js +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 +273 -0
- package/dist/registries/packageRegistry.js +184 -209
- package/dist/registries/todoReadinessContract.js +448 -0
- package/dist/registries/triggerLoader.js +7 -44
- package/dist/registries/verbosityBudgetContract.js +205 -0
- package/dist/release/releaseMetadata.js +155 -5
- 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 -13
- package/dist/setup/opencodeConstants.js +1 -0
- package/dist/setup/sharedSkill.js +45 -0
- package/dist/setup/smokeChecks.js +14 -75
- package/dist/state/archiveDiscovery.js +580 -0
- package/dist/state/archivePublication.js +225 -0
- package/dist/state/archiveRecovery.js +237 -0
- package/dist/state/archiveReplay.js +53 -0
- package/dist/state/canonicalMigrationRecord.js +36 -0
- package/dist/state/changelog.js +221 -0
- package/dist/state/decisionEntities.js +367 -0
- package/dist/state/decisionLegacyValidation.js +215 -0
- package/dist/state/decisionMigrationProvenance.js +199 -0
- package/dist/state/decisionOverlay.js +254 -0
- package/dist/state/decisionRevision.js +256 -0
- package/dist/state/decisionRevisionMigration.js +89 -0
- package/dist/state/directRetrieval.js +323 -0
- package/dist/state/durability.js +324 -0
- package/dist/state/entityCutover.js +459 -0
- package/dist/state/entityCutoverGit.js +127 -0
- package/dist/state/entityGlossaryAuthority.js +13 -0
- package/dist/state/entityListProjection.js +187 -0
- package/dist/state/entityListRuntimeRegistry.js +85 -0
- package/dist/state/entityMigrationCausality.js +97 -0
- package/dist/state/entityMigrationIdentity.js +5 -0
- package/dist/state/entityMigrationPreview.js +840 -0
- package/dist/state/entityMigrationTodo.js +133 -0
- package/dist/state/entityPublicationContext.js +859 -0
- package/dist/state/entityRetrievalHelp.js +506 -0
- package/dist/state/entityStorage.js +899 -0
- package/dist/state/exactReplacementRecovery.js +18 -0
- package/dist/state/experimentArchive.js +63 -0
- package/dist/state/experimentIdentity.js +202 -0
- package/dist/state/healthEntities.js +262 -0
- package/dist/state/healthEntityValidation.js +18 -0
- package/dist/state/healthRepair.js +69 -0
- package/dist/state/installRoot.js +15 -7
- package/dist/state/legacyEntityCutoverEvidence.js +65 -0
- package/dist/state/legacyIdentity.js +47 -0
- package/dist/state/legacySummaryRecord.js +6 -0
- package/dist/state/listAccounting.js +54 -0
- package/dist/state/listClassification.js +17 -0
- package/dist/state/listCursor.js +42 -0
- package/dist/state/listRetrieval.js +781 -0
- package/dist/state/migrationSourceBinding.js +30 -0
- package/dist/state/objectiveExperimentEntities.js +322 -0
- package/dist/state/planEntities.js +1027 -0
- package/dist/state/planIdentity.js +47 -0
- package/dist/state/planLineageValidation.js +52 -0
- package/dist/state/planReplacementTransaction.js +475 -0
- package/dist/state/planRetrieval.js +313 -0
- package/dist/state/planTaskRetrieval.js +294 -0
- package/dist/state/progressEntities.js +512 -0
- package/dist/state/progressGlossaryCaveat.js +168 -0
- package/dist/state/progressPublicationOrder.js +19 -0
- package/dist/state/progressWritePolicy.js +33 -0
- package/dist/state/projectRoot.js +62 -0
- package/dist/state/projectionPolicy.js +190 -0
- package/dist/state/retrievalAuthority.js +156 -0
- package/dist/state/safeProjectFile.js +155 -0
- package/dist/state/startupAnalysis/benchmark.js +70 -9
- package/dist/state/startupAnalysis/contract.js +44 -10
- package/dist/state/startupAnalysis/helpers.js +1 -2
- package/dist/state/startupAnalysis/index.js +0 -1
- package/dist/state/startupAnalysis/metrics.js +0 -1
- package/dist/state/startupAnalysis/records.js +0 -1
- package/dist/state/startupAnalysis/report.js +0 -1
- package/dist/state/startupAnalysis/threshold.js +13 -1
- package/dist/state/startupAnalysis.js +0 -1
- package/dist/state/startupProjection.js +499 -0
- package/dist/state/stateMode.js +222 -0
- package/dist/state/stateStorageAuthority.js +47 -0
- package/dist/state/summaryEntityRead.js +25 -0
- package/dist/state/summaryMigrationProvenance.js +66 -0
- package/dist/state/summarySourceRowAuthority.js +36 -0
- package/dist/state/todoActivationSafety.js +58 -0
- package/dist/state/todoDocsEntities.js +1124 -0
- package/dist/state/todoDocsEntityValidation.js +158 -0
- package/dist/state/todoMarkdownProjection.js +51 -0
- package/dist/state/todoReconciliationActivation.js +182 -0
- package/dist/state/todoReconciliationInspection.js +171 -0
- package/dist/state/todoReconciliationRepair.js +318 -0
- package/dist/state/todoReconciliationTransaction.js +595 -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 +377 -0
- package/dist/state/write/fields.js +61 -0
- package/dist/state/write/glossaryPublication.js +263 -0
- package/dist/state/write/grammar.js +285 -0
- package/dist/state/write/helpers.js +29 -0
- package/dist/state/write/index.js +12 -0
- package/dist/state/write/input.js +391 -0
- package/dist/state/write/lock.js +837 -0
- package/dist/state/write/mutation.js +234 -0
- package/dist/state/write/operations.js +170 -0
- package/dist/state/write/planEvaluation.js +128 -0
- package/dist/state/write/planPublication.js +179 -0
- package/dist/state/write/runtimeOperations.js +146 -0
- package/dist/state/write/serialize.js +1 -0
- package/dist/state/write/transaction.js +57 -0
- package/dist/state/write/validate.js +7 -0
- package/dist/upgrade/appContentRefresh.js +77 -36
- package/dist/upgrade/appModel.js +0 -1
- package/dist/upgrade/atomicWriter.js +1 -0
- package/dist/upgrade/bundleEvidence.js +0 -1
- package/dist/upgrade/channels.js +6 -9
- package/dist/upgrade/compatibility.js +43 -17
- package/dist/upgrade/doctor.js +55 -32
- package/dist/upgrade/doctorClassifier.js +11 -1
- package/dist/upgrade/installedHooksRetirement.js +46 -40
- package/dist/upgrade/legacyAgentCleanup.js +187 -21
- package/dist/upgrade/lifecycleUpgrade.js +113 -0
- package/dist/upgrade/migrateArtifactsV2ToV3.js +334 -64
- package/dist/upgrade/migrationPublication.js +122 -0
- package/dist/upgrade/nextMajorDoctor.js +0 -1
- package/dist/upgrade/npxPlatformStatus.js +0 -1
- package/dist/upgrade/projectIntegration.js +121 -159
- package/dist/upgrade/projectIntegrationDecision.js +42 -85
- package/dist/upgrade/retiredResourceDiagnostics.js +117 -0
- package/dist/upgrade/runtimeMigration.js +262 -453
- 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 +2 -3
- package/dist/upgrade/versionResolution.js +0 -1
- package/dist/validate/activationArtifactEvidence.js +852 -0
- package/dist/validate/activationArtifactEvidenceTypes.js +12 -0
- package/dist/validate/activationConjunction.js +816 -0
- package/dist/validate/activationEvidenceManifest.js +531 -0
- package/dist/validate/activationPackageSemantics.js +29 -0
- package/dist/validate/appHomeContract.js +1 -7
- package/dist/validate/bootstrapAuthority.js +44 -0
- package/dist/validate/capability.js +11 -3
- package/dist/validate/crossCapability.js +14 -9
- package/dist/validate/retainedReferenceAuthority.js +879 -0
- package/dist/validate/selfAudit.js +39 -45
- package/dist/validate/v1LegacyCruft.js +131 -0
- package/dist/validate/vocabularyAuthority.js +8 -8
- package/package.json +41 -13
- package/bundle/references/adapters/cursor.md +0 -214
- package/bundle/references/adapters/opencode.md +0 -530
- package/bundle/references/adapters/package-manifest-interface-model.yaml +0 -337
- package/bundle/references/adapters/runtime-adapter-characterization.md +0 -79
- package/bundle/references/adapters/runtime-adapter-interface-model.yaml +0 -200
- package/bundle/references/adapters/runtime-adapter-registry.yaml +0 -554
- package/bundle/references/adapters/runtime-feature-parity.md +0 -189
- package/bundle/references/analysis/benchmark.md +0 -267
- package/bundle/references/analysis/startup-measurement-contract.yaml +0 -424
- package/bundle/references/cli/agent-ready-state-contract.yaml +0 -953
- package/bundle/references/cli/audience-namespace-cli-migration.yaml +0 -369
- package/bundle/references/cli/bundle-skill-vocabulary.yaml +0 -250
- package/bundle/references/cli/capability-tool-classification.yaml +0 -53
- package/bundle/references/cli/coexistence-probe.yaml +0 -13
- package/bundle/references/cli/parity-expected-actual-template.md +0 -30
- package/bundle/references/cli/routing-execution-vocabulary.yaml +0 -281
- package/bundle/references/cli/single-name-protocol.yaml +0 -42
- package/bundle/references/cli/upgrade-repair-wording.md +0 -45
- package/bundle/references/cli/v3-handoff-manifest.schema.yaml +0 -98
- package/bundle/references/meta/documentation-inventory.md +0 -49
- package/bundle/skills/agentera/.claude-plugin/plugin.json +0 -27
- package/bundle/skills/agentera/agents/audit.toml +0 -6
- package/bundle/skills/agentera/agents/build.toml +0 -6
- package/bundle/skills/agentera/agents/design.toml +0 -6
- package/bundle/skills/agentera/agents/discuss.toml +0 -6
- package/bundle/skills/agentera/agents/document.toml +0 -6
- package/bundle/skills/agentera/agents/optimize.toml +0 -6
- package/bundle/skills/agentera/agents/orchestrate.toml +0 -6
- package/bundle/skills/agentera/agents/plan.toml +0 -6
- package/bundle/skills/agentera/agents/profile.toml +0 -6
- package/bundle/skills/agentera/agents/research.toml +0 -6
- package/bundle/skills/agentera/agents/status.toml +0 -6
- package/bundle/skills/agentera/agents/vision.toml +0 -6
- package/bundle/skills/agentera/references/contract.md +0 -1048
- package/dist/analytics/extractCorpus/cli.js.map +0 -1
- package/dist/analytics/extractCorpus/copilotSessions.js.map +0 -1
- package/dist/analytics/extractCorpus/core.js.map +0 -1
- package/dist/analytics/extractCorpus/corpus.js.map +0 -1
- package/dist/analytics/extractCorpus/coverageAudit.js.map +0 -1
- package/dist/analytics/extractCorpus/cursorSessions.js.map +0 -1
- package/dist/analytics/extractCorpus/extractCorpusParity.js.map +0 -1
- package/dist/analytics/extractCorpus/filesystemSources.js.map +0 -1
- package/dist/analytics/extractCorpus/index.js.map +0 -1
- package/dist/analytics/extractCorpus/jsonlSessions.js.map +0 -1
- package/dist/analytics/extractCorpus/sqliteCaps.js.map +0 -1
- package/dist/analytics/extractCorpus/sqliteSessions.js.map +0 -1
- package/dist/analytics/extractCorpus.js.map +0 -1
- package/dist/analytics/usageStats.js.map +0 -1
- package/dist/bin/agentera.js.map +0 -1
- package/dist/capabilities/audit/instructions.js.map +0 -1
- package/dist/capabilities/build/instructions.js.map +0 -1
- package/dist/capabilities/design/instructions.js.map +0 -1
- package/dist/capabilities/discuss/instructions.js.map +0 -1
- package/dist/capabilities/document/instructions.js.map +0 -1
- package/dist/capabilities/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/optimize/instructions.js.map +0 -1
- package/dist/capabilities/orchestrate/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/plan/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/profile/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/research/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/status/instructions.js.map +0 -1
- package/dist/capabilities/vision/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 -5
- 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/benchmark.js.map +0 -1
- package/dist/cli/capabilityContext/bespoke.js.map +0 -1
- package/dist/cli/capabilityContext/build.js.map +0 -1
- package/dist/cli/capabilityContext/closeout.js.map +0 -1
- package/dist/cli/capabilityContext/contract.js.map +0 -1
- package/dist/cli/capabilityContext/evidence.js.map +0 -1
- package/dist/cli/capabilityContext/index.js.map +0 -1
- package/dist/cli/capabilityContext/orchestration.js.map +0 -1
- package/dist/cli/capabilityContext/planState.js.map +0 -1
- package/dist/cli/capabilityContext/progress.js.map +0 -1
- package/dist/cli/capabilityContext/realisera.js +0 -174
- package/dist/cli/capabilityContext/realisera.js.map +0 -1
- package/dist/cli/capabilityContext/shared.js.map +0 -1
- package/dist/cli/capabilityContext/slim.js.map +0 -1
- package/dist/cli/capabilityContext/startup.js.map +0 -1
- package/dist/cli/capabilityContext/types.js.map +0 -1
- package/dist/cli/capabilityContext.js.map +0 -1
- package/dist/cli/commands/appHome.js.map +0 -1
- package/dist/cli/commands/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/bundleStatus.js.map +0 -1
- package/dist/cli/commands/prime/collectOrientationState.js.map +0 -1
- package/dist/cli/commands/prime/orientationOutput.js.map +0 -1
- package/dist/cli/commands/prime/routeOutput.js +0 -50
- package/dist/cli/commands/prime/routeOutput.js.map +0 -1
- package/dist/cli/commands/prime/types.js.map +0 -1
- package/dist/cli/commands/prime/v1Migration.js.map +0 -1
- package/dist/cli/commands/prime.js.map +0 -1
- package/dist/cli/commands/query.js.map +0 -1
- package/dist/cli/commands/report.js.map +0 -1
- package/dist/cli/commands/schema.js.map +0 -1
- package/dist/cli/commands/state/decisions.js.map +0 -1
- package/dist/cli/commands/state/docs.js.map +0 -1
- package/dist/cli/commands/state/experiments.js.map +0 -1
- package/dist/cli/commands/state/health.js.map +0 -1
- package/dist/cli/commands/state/index.js.map +0 -1
- package/dist/cli/commands/state/objective.js.map +0 -1
- package/dist/cli/commands/state/plan.js.map +0 -1
- package/dist/cli/commands/state/progress.js.map +0 -1
- package/dist/cli/commands/state/shared.js.map +0 -1
- package/dist/cli/commands/state/todo.js.map +0 -1
- package/dist/cli/commands/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/contracts/bundleStatus.js.map +0 -1
- package/dist/cli/contracts/orientationState.js.map +0 -1
- package/dist/cli/dispatch/argvParser.js.map +0 -1
- package/dist/cli/dispatch/check.js.map +0 -1
- package/dist/cli/dispatch/commands.js.map +0 -1
- package/dist/cli/dispatch/index.js.map +0 -1
- package/dist/cli/dispatch/lifecycle.js.map +0 -1
- package/dist/cli/dispatch/prime.js.map +0 -1
- package/dist/cli/dispatch/shared.js.map +0 -1
- package/dist/cli/dispatch/state.js.map +0 -1
- package/dist/cli/dispatch.js.map +0 -1
- package/dist/cli/errors.js.map +0 -1
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/orientation/attention.js.map +0 -1
- package/dist/cli/orientation/corpusCoverage.js.map +0 -1
- package/dist/cli/orientation.js.map +0 -1
- package/dist/cli/prime-blob.js.map +0 -1
- package/dist/cli/startupCompletenessContract.js.map +0 -1
- package/dist/cli/stateQuery.js.map +0 -1
- package/dist/cli/structured.js.map +0 -1
- package/dist/cli/todoMarkdown.js.map +0 -1
- package/dist/cli/todoSeverity.js.map +0 -1
- package/dist/core/difflib.js.map +0 -1
- package/dist/core/envPaths.js.map +0 -1
- package/dist/core/git.js +0 -43
- package/dist/core/git.js.map +0 -1
- package/dist/core/jsonValue.js.map +0 -1
- package/dist/core/paths.js.map +0 -1
- package/dist/core/pyjson.js.map +0 -1
- package/dist/core/sourceRoot.js.map +0 -1
- package/dist/core/toml.js.map +0 -1
- package/dist/core/yaml.js.map +0 -1
- package/dist/eval/evalSkills.js.map +0 -1
- package/dist/eval/semanticEval.js.map +0 -1
- package/dist/eval/semanticFixtures.js.map +0 -1
- package/dist/hooks/common.js.map +0 -1
- package/dist/hooks/compaction/apply.js.map +0 -1
- package/dist/hooks/compaction/dryRun.js.map +0 -1
- package/dist/hooks/compaction/index.js.map +0 -1
- package/dist/hooks/compaction/parse.js.map +0 -1
- package/dist/hooks/compaction/retention.js.map +0 -1
- package/dist/hooks/compaction/status.js.map +0 -1
- package/dist/hooks/compaction/todoResolved.js +0 -137
- package/dist/hooks/compaction/todoResolved.js.map +0 -1
- package/dist/hooks/compaction/types.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 -79
- package/dist/hooks/cursorSessionStart.js.map +0 -1
- package/dist/hooks/sessionStart.js +0 -216
- package/dist/hooks/sessionStart.js.map +0 -1
- package/dist/hooks/sessionStop.js +0 -206
- package/dist/hooks/sessionStop.js.map +0 -1
- package/dist/hooks/todoLayout.js +0 -177
- package/dist/hooks/todoLayout.js.map +0 -1
- package/dist/hooks/validateArtifact/agentFacing.js.map +0 -1
- package/dist/hooks/validateArtifact/index.js.map +0 -1
- package/dist/hooks/validateArtifact/markdown.js.map +0 -1
- package/dist/hooks/validateArtifact/runtime.js +0 -86
- package/dist/hooks/validateArtifact/runtime.js.map +0 -1
- package/dist/hooks/validateArtifact/schema.js.map +0 -1
- package/dist/hooks/validateArtifact/traversal.js.map +0 -1
- package/dist/hooks/validateArtifact/violations.js.map +0 -1
- package/dist/hooks/validateArtifact.js +0 -924
- package/dist/hooks/validateArtifact.js.map +0 -1
- package/dist/migrate/v2HandoffManifest.js.map +0 -1
- package/dist/registries/artifactProtocolIds.js.map +0 -1
- package/dist/registries/artifactRegistry.js.map +0 -1
- package/dist/registries/capabilityContract.js.map +0 -1
- package/dist/registries/evaluatorHandoffContract.js.map +0 -1
- package/dist/registries/packageRegistry.js.map +0 -1
- package/dist/registries/runtimeAdapterRegistry.js +0 -316
- package/dist/registries/runtimeAdapterRegistry.js.map +0 -1
- package/dist/registries/triggerLoader.js.map +0 -1
- package/dist/release/releaseMetadata.js.map +0 -1
- package/dist/routing/index.js +0 -2
- package/dist/routing/index.js.map +0 -1
- package/dist/routing/routeEngine.js +0 -189
- package/dist/routing/routeEngine.js.map +0 -1
- package/dist/setup/codex/agents.js +0 -96
- package/dist/setup/codex/agents.js.map +0 -1
- package/dist/setup/codex/cli.js +0 -161
- package/dist/setup/codex/cli.js.map +0 -1
- package/dist/setup/codex/configToml.js +0 -639
- package/dist/setup/codex/configToml.js.map +0 -1
- package/dist/setup/codex/constants.js +0 -29
- package/dist/setup/codex/constants.js.map +0 -1
- package/dist/setup/codex/installRoot.js +0 -64
- package/dist/setup/codex/installRoot.js.map +0 -1
- package/dist/setup/codex/state.js +0 -270
- package/dist/setup/codex/state.js.map +0 -1
- package/dist/setup/codex.js +0 -12
- package/dist/setup/codex.js.map +0 -1
- package/dist/setup/copilot.js +0 -227
- package/dist/setup/copilot.js.map +0 -1
- package/dist/setup/cursor.js +0 -129
- package/dist/setup/cursor.js.map +0 -1
- package/dist/setup/cursorSurfaces.js +0 -67
- package/dist/setup/cursorSurfaces.js.map +0 -1
- package/dist/setup/doctor/core.js +0 -300
- package/dist/setup/doctor/core.js.map +0 -1
- package/dist/setup/doctor/diagnostics.js +0 -240
- package/dist/setup/doctor/diagnostics.js.map +0 -1
- package/dist/setup/doctor/opencode.js +0 -313
- package/dist/setup/doctor/opencode.js.map +0 -1
- package/dist/setup/doctor/report.js +0 -425
- package/dist/setup/doctor/report.js.map +0 -1
- package/dist/setup/doctor.js +0 -10
- package/dist/setup/doctor.js.map +0 -1
- package/dist/setup/opencode.js.map +0 -1
- package/dist/setup/smokeChecks.js.map +0 -1
- package/dist/state/installRoot.js.map +0 -1
- package/dist/state/progressCommit.js +0 -289
- package/dist/state/progressCommit.js.map +0 -1
- package/dist/state/startupAnalysis/benchmark.js.map +0 -1
- package/dist/state/startupAnalysis/contract.js.map +0 -1
- package/dist/state/startupAnalysis/helpers.js.map +0 -1
- package/dist/state/startupAnalysis/index.js.map +0 -1
- package/dist/state/startupAnalysis/metrics.js.map +0 -1
- package/dist/state/startupAnalysis/records.js.map +0 -1
- package/dist/state/startupAnalysis/report.js.map +0 -1
- package/dist/state/startupAnalysis/threshold.js.map +0 -1
- package/dist/state/startupAnalysis.js.map +0 -1
- package/dist/upgrade/appContentRefresh.js.map +0 -1
- package/dist/upgrade/appModel.js.map +0 -1
- package/dist/upgrade/bundleEvidence.js.map +0 -1
- package/dist/upgrade/channels.js.map +0 -1
- package/dist/upgrade/cliProbe.js +0 -22
- package/dist/upgrade/cliProbe.js.map +0 -1
- package/dist/upgrade/coexistenceProbe.js +0 -107
- package/dist/upgrade/coexistenceProbe.js.map +0 -1
- package/dist/upgrade/compatibility.js.map +0 -1
- package/dist/upgrade/doctor.js.map +0 -1
- package/dist/upgrade/doctorClassifier.js.map +0 -1
- package/dist/upgrade/installedHooksRetirement.js.map +0 -1
- package/dist/upgrade/legacyAgentCleanup.js.map +0 -1
- package/dist/upgrade/migrateArtifactsV1ToV2.js +0 -570
- package/dist/upgrade/migrateArtifactsV1ToV2.js.map +0 -1
- package/dist/upgrade/migrateArtifactsV2ToV3.js.map +0 -1
- package/dist/upgrade/nextMajorDoctor.js.map +0 -1
- package/dist/upgrade/npxPlatformStatus.js.map +0 -1
- package/dist/upgrade/projectIntegration.js.map +0 -1
- package/dist/upgrade/projectIntegrationDecision.js.map +0 -1
- package/dist/upgrade/runtimeMigration.js.map +0 -1
- package/dist/upgrade/upgradeCommands.js.map +0 -1
- package/dist/upgrade/upgradeOrchestrator.js.map +0 -1
- package/dist/upgrade/v3CapabilitySurface.js.map +0 -1
- package/dist/upgrade/versionResolution.js.map +0 -1
- package/dist/validate/appHomeContract.js.map +0 -1
- package/dist/validate/capability.js.map +0 -1
- package/dist/validate/crossCapability.js.map +0 -1
- package/dist/validate/lifecycleAdapters/legacyPythonParity.js +0 -93
- package/dist/validate/lifecycleAdapters/legacyPythonParity.js.map +0 -1
- package/dist/validate/lifecycleAdapters/nodeFormChecks.js +0 -488
- package/dist/validate/lifecycleAdapters/nodeFormChecks.js.map +0 -1
- package/dist/validate/lifecycleAdapters/shared.js +0 -198
- package/dist/validate/lifecycleAdapters/shared.js.map +0 -1
- package/dist/validate/lifecycleAdapters.js +0 -62
- package/dist/validate/lifecycleAdapters.js.map +0 -1
- package/dist/validate/selfAudit.js.map +0 -1
- package/dist/validate/vocabularyAuthority.js.map +0 -1
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import YAML from "yaml";
|
|
2
|
+
import { resolveSourceRoot } from "../../../core/sourceRoot.js";
|
|
3
|
+
import { StateRetrievalFailure } from "../../../state/directRetrieval.js";
|
|
4
|
+
import { getDecisionEntity } from "../../../state/decisionEntities.js";
|
|
5
|
+
import { getHealthEntity } from "../../../state/healthEntities.js";
|
|
6
|
+
import { getObjectiveEntity } from "../../../state/objectiveExperimentEntities.js";
|
|
7
|
+
import { getProgressEntity } from "../../../state/progressEntities.js";
|
|
8
|
+
import { getTodoDocsEntity } from "../../../state/todoDocsEntities.js";
|
|
9
|
+
import { emitStructured } from "../../structured.js";
|
|
10
|
+
import { entityListFamily } from "../../../state/entityRetrievalHelp.js";
|
|
11
|
+
import { runtimeGenericEntityListFamily } from "../../../state/entityListRuntimeRegistry.js";
|
|
12
|
+
function requestedFormat(argv) {
|
|
13
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
14
|
+
const token = argv[index];
|
|
15
|
+
if (token === "--format") {
|
|
16
|
+
const value = argv[index + 1];
|
|
17
|
+
if (value === "json" || value === "yaml")
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
if (token.startsWith("--format=")) {
|
|
21
|
+
const value = token.slice("--format=".length);
|
|
22
|
+
if (value === "json" || value === "yaml")
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return "text";
|
|
27
|
+
}
|
|
28
|
+
function failure(message, id, artifact = "progress") {
|
|
29
|
+
const runtime = runtimeGenericEntityListFamily(artifact);
|
|
30
|
+
const family = runtime ? entityListFamily(runtime.key) : undefined;
|
|
31
|
+
return new StateRetrievalFailure({
|
|
32
|
+
schemaVersion: "agentera.stateFailure.v1",
|
|
33
|
+
status: "fail",
|
|
34
|
+
error: {
|
|
35
|
+
class: "invalid_request",
|
|
36
|
+
message,
|
|
37
|
+
syntax: family?.get ?? `agentera state ${artifact} get --id ID --format json`,
|
|
38
|
+
example: `agentera state ${artifact} get --id ${id ?? "qjtrmnpvka"} --format json`,
|
|
39
|
+
recovery: `Use a bare ten-letter ${artifact} ID returned by append or list; no state was changed.`,
|
|
40
|
+
artifact,
|
|
41
|
+
...(id ? { id } : {}),
|
|
42
|
+
},
|
|
43
|
+
}, 2);
|
|
44
|
+
}
|
|
45
|
+
function readValue(argv, index, name) {
|
|
46
|
+
const token = argv[index];
|
|
47
|
+
if (token.startsWith(`${name}=`))
|
|
48
|
+
return { value: token.slice(name.length + 1), next: index + 1 };
|
|
49
|
+
const value = argv[index + 1];
|
|
50
|
+
if (!value || value.startsWith("--"))
|
|
51
|
+
throw new Error(`${name} requires a value`);
|
|
52
|
+
return { value, next: index + 2 };
|
|
53
|
+
}
|
|
54
|
+
function emitFailure(error, format, io) {
|
|
55
|
+
if (format === "json" || format === "yaml") {
|
|
56
|
+
emitStructured(error.body, format, io.out ?? ((text) => process.stdout.write(text)));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const detail = error.body.error;
|
|
60
|
+
(io.err ?? ((text) => process.stderr.write(text)))([
|
|
61
|
+
`Error: ${detail.message}`,
|
|
62
|
+
`Syntax: ${detail.syntax}`,
|
|
63
|
+
`Example: ${detail.example}`,
|
|
64
|
+
`Recovery: ${detail.recovery}`,
|
|
65
|
+
].join("\n") + "\n");
|
|
66
|
+
}
|
|
67
|
+
return error.exitCode;
|
|
68
|
+
}
|
|
69
|
+
export function runStateGet(artifactId, argv, io, projectRoot = process.cwd()) {
|
|
70
|
+
const format = requestedFormat(argv);
|
|
71
|
+
const sourceRoot = resolveSourceRoot();
|
|
72
|
+
try {
|
|
73
|
+
if (!runtimeGenericEntityListFamily(artifactId))
|
|
74
|
+
throw failure(`unsupported state artifact '${artifactId}'`, undefined, artifactId);
|
|
75
|
+
let id;
|
|
76
|
+
let entityFormat = "text";
|
|
77
|
+
let formatSupplied = false;
|
|
78
|
+
for (let index = 0; index < argv.length;) {
|
|
79
|
+
const token = argv[index];
|
|
80
|
+
if (token !== "--id" && !token.startsWith("--id=") && token !== "--format" && !token.startsWith("--format=")) {
|
|
81
|
+
throw failure(`unrecognized argument '${token}'; entity-mode ${artifactId} retrieval requires --id ID`, id, artifactId);
|
|
82
|
+
}
|
|
83
|
+
const name = token.startsWith("--id") ? "--id" : "--format";
|
|
84
|
+
let parsed;
|
|
85
|
+
try {
|
|
86
|
+
parsed = readValue(argv, index, name);
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
throw failure(error.message, id, artifactId);
|
|
90
|
+
}
|
|
91
|
+
index = parsed.next;
|
|
92
|
+
if (name === "--id") {
|
|
93
|
+
if (id !== undefined)
|
|
94
|
+
throw failure("--id may only be supplied once", id, artifactId);
|
|
95
|
+
id = parsed.value;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
if (formatSupplied)
|
|
99
|
+
throw failure("--format may only be supplied once", id, artifactId);
|
|
100
|
+
formatSupplied = true;
|
|
101
|
+
if (parsed.value !== "text" && parsed.value !== "json" && parsed.value !== "yaml")
|
|
102
|
+
throw failure(`invalid --format '${parsed.value}'`, id, artifactId);
|
|
103
|
+
entityFormat = parsed.value;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (!id)
|
|
107
|
+
throw failure(`--id is required for entity-mode ${artifactId} retrieval`, id, artifactId);
|
|
108
|
+
const response = artifactId === "progress"
|
|
109
|
+
? getProgressEntity(projectRoot, id, sourceRoot)
|
|
110
|
+
: artifactId === "decisions"
|
|
111
|
+
? getDecisionEntity(projectRoot, id, sourceRoot)
|
|
112
|
+
: artifactId === "health"
|
|
113
|
+
? getHealthEntity(projectRoot, id, sourceRoot)
|
|
114
|
+
: artifactId === "objective"
|
|
115
|
+
? getObjectiveEntity(projectRoot, id, sourceRoot)
|
|
116
|
+
: getTodoDocsEntity(projectRoot, artifactId, id, sourceRoot);
|
|
117
|
+
const output = io.out ?? ((text) => process.stdout.write(text));
|
|
118
|
+
if (entityFormat === "json" || entityFormat === "yaml")
|
|
119
|
+
emitStructured(response, entityFormat, output);
|
|
120
|
+
else
|
|
121
|
+
output(YAML.stringify(response));
|
|
122
|
+
return 0;
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
if (error instanceof StateRetrievalFailure)
|
|
126
|
+
return emitFailure(error, format, io);
|
|
127
|
+
return emitFailure(failure(error.message, undefined, artifactId), format, io);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -1,116 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
import { asList, emitStateStructured, extractEntries, loadArtifact, missingSchemaError, sourceMetadata, structuredState, } from "../../stateQuery.js";
|
|
8
|
-
import { artifactPath } from "../../appContext.js";
|
|
9
|
-
import { out, err } from "./shared.js";
|
|
10
|
-
export function healthAuditNumber(entry) {
|
|
11
|
-
const number = entry.number;
|
|
12
|
-
if (typeof number === "number" && Number.isInteger(number))
|
|
13
|
-
return number;
|
|
14
|
-
if (typeof number === "string" && /^\d+$/.test(number))
|
|
15
|
-
return parseInt(number, 10);
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
export function latestHealthAudit(entries) {
|
|
19
|
-
if (entries.length === 0)
|
|
20
|
-
return null;
|
|
21
|
-
let best = null;
|
|
22
|
-
let bestNumber = -1;
|
|
23
|
-
for (const entry of entries) {
|
|
24
|
-
const number = healthAuditNumber(entry);
|
|
25
|
-
if (number === null)
|
|
26
|
-
continue;
|
|
27
|
-
if (number > bestNumber) {
|
|
28
|
-
bestNumber = number;
|
|
29
|
-
best = entry;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return best !== null ? best : entries[entries.length - 1];
|
|
33
|
-
}
|
|
34
|
-
export function queryHealth(args, schemas, io) {
|
|
35
|
-
const o = out(io);
|
|
36
|
-
const e = err(io);
|
|
37
|
-
const info = schemas.health;
|
|
38
|
-
if (!info) {
|
|
39
|
-
e(missingSchemaError("health") + "\n");
|
|
40
|
-
return 1;
|
|
41
|
-
}
|
|
42
|
-
const p = artifactPath(info, "health");
|
|
43
|
-
const data = loadArtifact(p);
|
|
44
|
-
const entries = extractEntries(data);
|
|
45
|
-
const dimension = args.dimension ?? null;
|
|
46
|
-
let latest = latestHealthAudit(entries);
|
|
47
|
-
let latestEntries = latest ? [latest] : [];
|
|
48
|
-
if (dimension && latestEntries.length > 0) {
|
|
49
|
-
latest = latestEntries[0];
|
|
50
|
-
const dimLower = dimension.toLowerCase();
|
|
51
|
-
let matched = false;
|
|
52
|
-
const grades = latest.grades;
|
|
53
|
-
if (grades && typeof grades === "object" && !Array.isArray(grades)) {
|
|
54
|
-
matched = Object.keys(grades).some((gk) => String(gk).toLowerCase().includes(dimLower));
|
|
55
|
-
}
|
|
56
|
-
const details = latest.dimensions_detail;
|
|
57
|
-
if (Array.isArray(details)) {
|
|
58
|
-
matched =
|
|
59
|
-
matched ||
|
|
60
|
-
details.some((d) => d && typeof d === "object" && !Array.isArray(d) && String(d.name ?? "").toLowerCase().includes(dimLower));
|
|
61
|
-
}
|
|
62
|
-
if (!matched)
|
|
63
|
-
latestEntries = [];
|
|
64
|
-
}
|
|
1
|
+
import { emitStructured } from "../../structured.js";
|
|
2
|
+
import { listHealthEntities } from "../../../state/healthEntities.js";
|
|
3
|
+
import YAML from "yaml";
|
|
4
|
+
import { out } from "./shared.js";
|
|
5
|
+
export function queryHealth(args, _schemas, io) {
|
|
65
6
|
const format = args.format ?? "text";
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (entries.length === 0)
|
|
73
|
-
return 0;
|
|
74
|
-
latest = latestHealthAudit(entries);
|
|
75
|
-
if (!latest)
|
|
76
|
-
return 0;
|
|
77
|
-
if (dimension) {
|
|
78
|
-
const dimLower = dimension.toLowerCase();
|
|
79
|
-
// cast: latest.grades is read from a parsed health.yaml audit entry (IO boundary)
|
|
80
|
-
const grades = (latest.grades ?? {});
|
|
81
|
-
let matched = false;
|
|
82
|
-
for (const [gk, gv] of Object.entries(grades)) {
|
|
83
|
-
if (String(gk).toLowerCase().includes(dimLower)) {
|
|
84
|
-
o(`${gk}: ${gv}\n`);
|
|
85
|
-
matched = true;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
const details = asList(latest.dimensions_detail);
|
|
89
|
-
for (const d of details) {
|
|
90
|
-
const dn = String(d.name ?? "");
|
|
91
|
-
if (dn.toLowerCase().includes(dimLower)) {
|
|
92
|
-
const summary = d.summary ?? "";
|
|
93
|
-
if (summary)
|
|
94
|
-
o(` ${summary}\n`);
|
|
95
|
-
for (const f of asList(d.findings)) {
|
|
96
|
-
o(` [${f.severity ?? ""}] ${f.heading ?? ""}\n`);
|
|
97
|
-
}
|
|
98
|
-
matched = true;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (!matched)
|
|
102
|
-
return 0;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
const num = latest.number ?? "?";
|
|
106
|
-
const traj = latest.trajectory ?? "";
|
|
107
|
-
o(`Audit ${num}: ${traj}\n`);
|
|
108
|
-
// cast: latest.grades is read from a parsed health.yaml audit entry (IO boundary)
|
|
109
|
-
const grades = (latest.grades ?? {});
|
|
110
|
-
for (const [gk, gv] of Object.entries(grades)) {
|
|
111
|
-
o(` ${gk}: ${gv}\n`);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
7
|
+
const response = listHealthEntities(process.cwd(), args.limit ?? 1, args.dimension ?? undefined, args.cursor ?? undefined, { format });
|
|
8
|
+
const output = out(io);
|
|
9
|
+
if (format === "text")
|
|
10
|
+
output(YAML.stringify(response));
|
|
11
|
+
else
|
|
12
|
+
emitStructured(response, format, output);
|
|
114
13
|
return 0;
|
|
115
14
|
}
|
|
116
|
-
//# sourceMappingURL=health.js.map
|
|
@@ -1,51 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public surface for the `state <name>` command family.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* is the public surface used by `cli/dispatch.ts` to decide whether
|
|
8
|
-
* a top-level token is a state command or a deprecated alias.
|
|
4
|
+
* Record-family retrieval dispatch is owned by entityListRuntimeRegistry.
|
|
5
|
+
* This module retains the specialized projections used by startup collectors
|
|
6
|
+
* and compatibility code; it does not enumerate public retrieval routes.
|
|
9
7
|
*/
|
|
10
|
-
import { COMMAND_FILTERS, validateFilterValues } from "../../stateQuery.js";
|
|
11
|
-
import { loadSchemas, discoverSchemasDir } from "../../appContext.js";
|
|
12
|
-
import { err } from "./shared.js";
|
|
13
8
|
import { queryProgress } from "./progress.js";
|
|
14
9
|
import { queryPlan } from "./plan.js";
|
|
15
|
-
import { queryHealth
|
|
10
|
+
import { queryHealth } from "./health.js";
|
|
16
11
|
import { queryDocs } from "./docs.js";
|
|
17
12
|
import { queryObjective } from "./objective.js";
|
|
18
13
|
import { queryExperiments } from "./experiments.js";
|
|
19
14
|
import { queryTodo, normalizeSeverity } from "./todo.js";
|
|
20
|
-
import { queryDecisions, decisionContextEntry, decisionSatisfactionContext, decisionSourceContract, extractDecisionEntries, displayFields, } from "./decisions.js";
|
|
21
|
-
export { queryProgress, queryPlan, queryHealth, queryDocs, queryObjective, queryExperiments, queryTodo, queryDecisions,
|
|
22
|
-
const STATE_COMMAND_HANDLERS = {
|
|
23
|
-
progress: queryProgress,
|
|
24
|
-
plan: queryPlan,
|
|
25
|
-
health: queryHealth,
|
|
26
|
-
docs: queryDocs,
|
|
27
|
-
objective: queryObjective,
|
|
28
|
-
experiments: queryExperiments,
|
|
29
|
-
todo: queryTodo,
|
|
30
|
-
decisions: queryDecisions,
|
|
31
|
-
};
|
|
32
|
-
export function isPortedStateCommand(command) {
|
|
33
|
-
return command in STATE_COMMAND_HANDLERS;
|
|
34
|
-
}
|
|
35
|
-
export function cmdState(args, io) {
|
|
36
|
-
const e = err(io);
|
|
37
|
-
try {
|
|
38
|
-
validateFilterValues(args, COMMAND_FILTERS[args.command] ?? []);
|
|
39
|
-
if (args.limit !== null && args.limit !== undefined && args.limit < 0) {
|
|
40
|
-
throw new Error("limit must be zero or greater");
|
|
41
|
-
}
|
|
42
|
-
const schemas = loadSchemas(discoverSchemasDir());
|
|
43
|
-
const handler = STATE_COMMAND_HANDLERS[args.command];
|
|
44
|
-
return handler(args, schemas, io);
|
|
45
|
-
}
|
|
46
|
-
catch (exc) {
|
|
47
|
-
e(`Error: ${exc.message}\n`);
|
|
48
|
-
return 2;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=index.js.map
|
|
15
|
+
import { queryDecisions, decisionContextEntry, decisionSatisfactionContext, decisionSourceContract, extractDecisionEntries, hydrateDecisionEntries, displayFields, } from "./decisions.js";
|
|
16
|
+
export { queryProgress, queryPlan, queryHealth, queryDocs, queryObjective, queryExperiments, queryTodo, queryDecisions, normalizeSeverity, decisionContextEntry, decisionSatisfactionContext, decisionSourceContract, extractDecisionEntries, hydrateDecisionEntries, displayFields, };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { resolveSourceRoot } from "../../../core/sourceRoot.js";
|
|
2
|
+
import { StateRetrievalFailure } from "../../../state/directRetrieval.js";
|
|
3
|
+
import { emitStructured } from "../../structured.js";
|
|
4
|
+
import { listProgressEntities, renderProgressEntityListText } from "../../../state/progressEntities.js";
|
|
5
|
+
import { listDecisionEntities } from "../../../state/decisionEntities.js";
|
|
6
|
+
import { listHealthEntities } from "../../../state/healthEntities.js";
|
|
7
|
+
import { listObjectiveEntities } from "../../../state/objectiveExperimentEntities.js";
|
|
8
|
+
import { listTodoDocsEntities } from "../../../state/todoDocsEntities.js";
|
|
9
|
+
import YAML from "yaml";
|
|
10
|
+
import { entityListFamilies, entityListValidValues } from "../../../state/entityRetrievalHelp.js";
|
|
11
|
+
import { ENTITY_LIST_RUNTIME_FAMILIES, runtimeGenericEntityListFamily } from "../../../state/entityListRuntimeRegistry.js";
|
|
12
|
+
function requestedFormat(argv) {
|
|
13
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
14
|
+
const token = argv[index];
|
|
15
|
+
if (token === "--format") {
|
|
16
|
+
const value = argv[index + 1];
|
|
17
|
+
if (value === "json" || value === "yaml")
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
if (token.startsWith("--format=")) {
|
|
21
|
+
const value = token.slice("--format=".length);
|
|
22
|
+
if (value === "json" || value === "yaml")
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return "text";
|
|
27
|
+
}
|
|
28
|
+
function syntax(artifactId) {
|
|
29
|
+
return `agentera state ${artifactId} list [--limit N] [--cursor TOKEN] --format json`;
|
|
30
|
+
}
|
|
31
|
+
function failure(className, artifactId, message, example = `agentera state ${artifactId} list --limit 20 --format json`, validValues) {
|
|
32
|
+
const family = entityListFamilies().find(({ key }) => key === artifactId);
|
|
33
|
+
return new StateRetrievalFailure({
|
|
34
|
+
schemaVersion: "agentera.stateFailure.v1",
|
|
35
|
+
status: "fail",
|
|
36
|
+
error: {
|
|
37
|
+
class: className,
|
|
38
|
+
message,
|
|
39
|
+
syntax: family?.syntax ?? syntax(artifactId),
|
|
40
|
+
example: family?.example ?? example,
|
|
41
|
+
recovery: family ? `Run \`${family.example}\`; no state was changed.` : "Correct the command using the valid syntax and retry; no state was changed.",
|
|
42
|
+
artifact_id: artifactId,
|
|
43
|
+
...(validValues ? { valid_values: validValues } : family ? { valid_values: entityListValidValues(family) } : {}),
|
|
44
|
+
},
|
|
45
|
+
}, 2);
|
|
46
|
+
}
|
|
47
|
+
function readValue(argv, index, name) {
|
|
48
|
+
const token = argv[index];
|
|
49
|
+
if (token.startsWith(`${name}=`))
|
|
50
|
+
return { value: token.slice(name.length + 1), next: index + 1 };
|
|
51
|
+
const value = argv[index + 1];
|
|
52
|
+
if (!value || value.startsWith("--"))
|
|
53
|
+
throw new Error(`${name} requires a value`);
|
|
54
|
+
return { value, next: index + 2 };
|
|
55
|
+
}
|
|
56
|
+
function parseListArgs(artifactId, argv) {
|
|
57
|
+
const runtime = runtimeGenericEntityListFamily(artifactId);
|
|
58
|
+
if (!runtime) {
|
|
59
|
+
const validValues = ENTITY_LIST_RUNTIME_FAMILIES.map(({ commandTokens }) => commandTokens.join(" "));
|
|
60
|
+
throw failure("unsupported_artifact", artifactId, `unsupported state artifact '${artifactId}'`, undefined, validValues);
|
|
61
|
+
}
|
|
62
|
+
const family = entityListFamilies().find(({ key }) => key === runtime.key);
|
|
63
|
+
let limit = family.bounds.default;
|
|
64
|
+
let cursor;
|
|
65
|
+
let format = "text";
|
|
66
|
+
const filters = {};
|
|
67
|
+
const selector = {};
|
|
68
|
+
const allowedFilters = new Set(family.filters.map(({ name }) => `--${name}`));
|
|
69
|
+
let limitSupplied = false;
|
|
70
|
+
let cursorSupplied = false;
|
|
71
|
+
let formatSupplied = false;
|
|
72
|
+
const filterSupplied = new Set();
|
|
73
|
+
for (let index = 0; index < argv.length;) {
|
|
74
|
+
const token = argv[index];
|
|
75
|
+
if (token === "--ids-only") {
|
|
76
|
+
if (selector.idsOnly)
|
|
77
|
+
throw failure("invalid_request", artifactId, "--ids-only may only be supplied once");
|
|
78
|
+
selector.idsOnly = true;
|
|
79
|
+
index += 1;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const matches = (flag) => token === flag || token.startsWith(`${flag}=`);
|
|
83
|
+
const name = matches("--limit") ? "--limit" : matches("--cursor") ? "--cursor" : matches("--format") ? "--format" : matches("--fields") ? "--fields" : [...allowedFilters].find(matches) ?? null;
|
|
84
|
+
if (!name)
|
|
85
|
+
throw failure("invalid_request", artifactId, `unrecognized argument '${token}'`);
|
|
86
|
+
let parsed;
|
|
87
|
+
try {
|
|
88
|
+
parsed = readValue(argv, index, name);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
throw failure("invalid_request", artifactId, error.message);
|
|
92
|
+
}
|
|
93
|
+
index = parsed.next;
|
|
94
|
+
if (name === "--limit") {
|
|
95
|
+
if (limitSupplied)
|
|
96
|
+
throw failure("invalid_request", artifactId, "--limit may only be supplied once");
|
|
97
|
+
limitSupplied = true;
|
|
98
|
+
if (!/^[1-9][0-9]*$/.test(parsed.value))
|
|
99
|
+
throw failure("invalid_request", artifactId, `argument --limit must be a positive canonical integer from ${family.bounds.minimum} through ${family.bounds.maximum}`);
|
|
100
|
+
limit = Number(parsed.value);
|
|
101
|
+
if (!Number.isSafeInteger(limit) || limit < family.bounds.minimum || limit > family.bounds.maximum)
|
|
102
|
+
throw failure("invalid_request", artifactId, `argument --limit must be between ${family.bounds.minimum} and ${family.bounds.maximum}`);
|
|
103
|
+
}
|
|
104
|
+
else if (name === "--cursor") {
|
|
105
|
+
if (cursorSupplied)
|
|
106
|
+
throw failure("invalid_request", artifactId, "--cursor may only be supplied once");
|
|
107
|
+
cursorSupplied = true;
|
|
108
|
+
if (parsed.value.length === 0)
|
|
109
|
+
throw failure("invalid_request", artifactId, "argument --cursor must be a non-empty opaque token");
|
|
110
|
+
cursor = parsed.value;
|
|
111
|
+
}
|
|
112
|
+
else if (name === "--fields") {
|
|
113
|
+
if (selector.fields !== undefined)
|
|
114
|
+
throw failure("invalid_request", artifactId, "--fields may only be supplied once");
|
|
115
|
+
selector.fields = parsed.value;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
if (name !== "--format") {
|
|
119
|
+
if (filterSupplied.has(name))
|
|
120
|
+
throw failure("invalid_request", artifactId, `${name} may only be supplied once`);
|
|
121
|
+
filterSupplied.add(name);
|
|
122
|
+
const key = name.slice(2);
|
|
123
|
+
filters[key] = parsed.value;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (formatSupplied)
|
|
127
|
+
throw failure("invalid_request", artifactId, "--format may only be supplied once");
|
|
128
|
+
formatSupplied = true;
|
|
129
|
+
if (!family.formats.includes(parsed.value)) {
|
|
130
|
+
throw failure("invalid_request", artifactId, `argument --format: invalid choice: '${parsed.value}' (choose from ${family.formats.map((value) => `'${value}'`).join(", ")})`);
|
|
131
|
+
}
|
|
132
|
+
format = parsed.value;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return { limit, ...(cursor ? { cursor } : {}), format, filters, selector };
|
|
136
|
+
}
|
|
137
|
+
function emitFailure(error, format, io) {
|
|
138
|
+
const out = io.out ?? ((text) => process.stdout.write(text));
|
|
139
|
+
if (format === "json" || format === "yaml")
|
|
140
|
+
emitStructured(error.body, format, out);
|
|
141
|
+
else {
|
|
142
|
+
const details = error.body.error;
|
|
143
|
+
(io.err ?? ((text) => process.stderr.write(text)))([
|
|
144
|
+
`Error: ${details.message}`,
|
|
145
|
+
`Class: ${details.class}`,
|
|
146
|
+
`Syntax: ${details.syntax}`,
|
|
147
|
+
`Valid values: ${(details.valid_values ?? []).join("; ")}`,
|
|
148
|
+
`Example: ${details.example}`,
|
|
149
|
+
`Recovery: ${details.recovery}`,
|
|
150
|
+
].join("\n") + "\n");
|
|
151
|
+
}
|
|
152
|
+
return error.exitCode;
|
|
153
|
+
}
|
|
154
|
+
export function runStateList(artifactId, argv, io, projectRoot = process.cwd()) {
|
|
155
|
+
const format = requestedFormat(argv);
|
|
156
|
+
const sourceRoot = resolveSourceRoot();
|
|
157
|
+
try {
|
|
158
|
+
const args = parseListArgs(artifactId, argv);
|
|
159
|
+
const response = artifactId === "progress"
|
|
160
|
+
? listProgressEntities(projectRoot, args.limit, args.filters, args.cursor, { sourceRoot, format: args.format, selector: args.selector })
|
|
161
|
+
: artifactId === "decisions"
|
|
162
|
+
? listDecisionEntities(projectRoot, args.limit, args.filters.topic ?? undefined, args.cursor, { sourceRoot, format: args.format, selector: args.selector })
|
|
163
|
+
: artifactId === "health"
|
|
164
|
+
? listHealthEntities(projectRoot, args.limit, args.filters.dimension ?? undefined, args.cursor, { sourceRoot, format: args.format, selector: args.selector })
|
|
165
|
+
: artifactId === "objective"
|
|
166
|
+
? listObjectiveEntities(projectRoot, args.limit, args.cursor, { sourceRoot, format: args.format, selector: args.selector })
|
|
167
|
+
: listTodoDocsEntities(projectRoot, artifactId, args.limit, args.cursor, args.filters, { sourceRoot, format: args.format, selector: args.selector });
|
|
168
|
+
const output = io.out ?? ((text) => process.stdout.write(text));
|
|
169
|
+
if (args.format === "text")
|
|
170
|
+
output(artifactId === "progress" ? renderProgressEntityListText(response) : YAML.stringify(response));
|
|
171
|
+
else
|
|
172
|
+
emitStructured(response, args.format, output);
|
|
173
|
+
return 0;
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
if (error instanceof StateRetrievalFailure) {
|
|
177
|
+
const body = structuredClone(error.body);
|
|
178
|
+
delete body.error.artifact_id;
|
|
179
|
+
body.error.artifact = artifactId;
|
|
180
|
+
return emitFailure(new StateRetrievalFailure(body, error.exitCode), format, io);
|
|
181
|
+
}
|
|
182
|
+
return emitFailure(new StateRetrievalFailure({
|
|
183
|
+
schemaVersion: "agentera.stateFailure.v1",
|
|
184
|
+
status: "fail",
|
|
185
|
+
error: {
|
|
186
|
+
class: "unsupported_state",
|
|
187
|
+
message: error.message,
|
|
188
|
+
syntax: syntax(artifactId),
|
|
189
|
+
example: `agentera state ${artifactId} list --limit 20 --format json`,
|
|
190
|
+
recovery: "Use a state format supported by the storage authority, then retry.",
|
|
191
|
+
},
|
|
192
|
+
}, 1), format, io);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -1,69 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const info = schemas.objective;
|
|
15
|
-
if (!info) {
|
|
16
|
-
e(missingSchemaError("objective") + "\n");
|
|
17
|
-
return 1;
|
|
18
|
-
}
|
|
19
|
-
const p = artifactPath(info, "objective");
|
|
20
|
-
const data = loadArtifact(p);
|
|
21
|
-
const format = args.format ?? "text";
|
|
22
|
-
const isDict = data !== null && typeof data === "object" && !Array.isArray(data);
|
|
23
|
-
if (!isDict) {
|
|
24
|
-
if (format !== "text") {
|
|
25
|
-
return emitStateStructured("objective", structuredState("objective", [], sourceMetadata("objective", p), { filters: { status: args.status ?? null } }), format, args.fields, o, e);
|
|
26
|
-
}
|
|
27
|
-
return 0;
|
|
28
|
-
}
|
|
29
|
-
// cast: data is the parsed objective artifact from loadArtifact (YAML/MD IO boundary)
|
|
30
|
-
const d = data;
|
|
31
|
-
const legacyEntries = asList(d.entries);
|
|
32
|
-
if (legacyEntries.length > 0) {
|
|
33
|
-
let entries = legacyEntries;
|
|
34
|
-
const statusFilter = args.status ?? null;
|
|
35
|
-
if (statusFilter)
|
|
36
|
-
entries = filterByFieldValue(entries, "status", statusFilter);
|
|
37
|
-
if (format !== "text") {
|
|
38
|
-
return emitStateStructured("objective", structuredState("objective", entries, sourceMetadata("objective", p), { filters: { status: statusFilter } }), format, args.fields, o, e);
|
|
39
|
-
}
|
|
40
|
-
for (const entry of entries) {
|
|
41
|
-
const line = formatEntry(entry, ["title", "status", "target", "reason"]);
|
|
42
|
-
if (line)
|
|
43
|
-
o(line + "\n");
|
|
44
|
-
}
|
|
1
|
+
import { StateRetrievalFailure } from "../../../state/directRetrieval.js";
|
|
2
|
+
import { currentObjectiveEntity } from "../../../state/objectiveExperimentEntities.js";
|
|
3
|
+
import { emitStructured } from "../../structured.js";
|
|
4
|
+
import { formatEntry } from "../../stateQuery.js";
|
|
5
|
+
import { err, out } from "./shared.js";
|
|
6
|
+
export function queryObjective(args, _schemas, io) {
|
|
7
|
+
const output = out(io);
|
|
8
|
+
try {
|
|
9
|
+
const response = currentObjectiveEntity(process.cwd());
|
|
10
|
+
if (args.format === "json" || args.format === "yaml")
|
|
11
|
+
emitStructured(response, args.format, output);
|
|
12
|
+
else
|
|
13
|
+
output(formatEntry(response.entries[0], ["id", "artifact"]) + "\n");
|
|
45
14
|
return 0;
|
|
46
15
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
summary: { title, status, header, closure },
|
|
56
|
-
}), format, args.fields, o, e);
|
|
57
|
-
}
|
|
58
|
-
o(`Objective: title=${truncate(title)} | status=${status || "unknown"}\n`);
|
|
59
|
-
for (const key of ["description", "target", "measurement", "direction", "unit"]) {
|
|
60
|
-
const value = objective[key] ?? d[key];
|
|
61
|
-
if (value)
|
|
62
|
-
o(`${key}: ${truncate(value)}\n`);
|
|
63
|
-
}
|
|
64
|
-
if (Object.keys(closure).length > 0) {
|
|
65
|
-
o(formatEntry(closure, ["final_value", "target", "reason"]) + "\n");
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (!(error instanceof StateRetrievalFailure))
|
|
18
|
+
throw error;
|
|
19
|
+
if (args.format === "json" || args.format === "yaml")
|
|
20
|
+
emitStructured(error.body, args.format, output);
|
|
21
|
+
else
|
|
22
|
+
err(io)(`Error: ${error.body.error.message}\nRecovery: ${error.body.error.recovery}\n`);
|
|
23
|
+
return error.exitCode;
|
|
66
24
|
}
|
|
67
|
-
return 0;
|
|
68
25
|
}
|
|
69
|
-
//# sourceMappingURL=objective.js.map
|