akm-cli 0.9.30 → 0.10.261001-beta
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/CHANGELOG.md +438 -0
- package/README.md +10 -10
- package/ROADMAP.md +112 -0
- package/STABILITY.md +99 -57
- package/dist/api-node.mjs +20 -0
- package/dist/api.d.ts +23 -0
- package/dist/api.js +45 -0
- package/dist/assets/hints/cli-hints-full.md +15 -29
- package/dist/assets/hints/cli-hints-short.md +2 -2
- package/dist/assets/improve-strategies/default.json +3 -3
- package/dist/assets/prompts/consolidate-pair.md +9 -7
- package/dist/assets/stash-skeleton/README.md +1 -1
- package/dist/assets/tasks/improve/akm-improve-consolidate.yml +1 -1
- package/dist/cli/shared.js +31 -48
- package/dist/cli/unknown-flags.js +6 -43
- package/dist/cli.js +8 -34
- package/dist/commands/agent/contribute-cli.js +1 -1
- package/dist/commands/completions.js +1 -2
- package/dist/commands/config-cli.js +5 -28
- package/dist/commands/env/env-cli.js +5 -5
- package/dist/commands/env/secret-cli.js +2 -2
- package/dist/commands/feedback-cli.js +75 -49
- package/dist/commands/health/checks.js +41 -16
- package/dist/commands/health/plugin-staleness.js +52 -22
- package/dist/commands/improve/autonomy-gate.js +5 -3
- package/dist/commands/improve/consolidate/chunking.js +3 -10
- package/dist/commands/improve/consolidate/continuity-check.js +4 -4
- package/dist/commands/improve/consolidate/pair-pass.js +29 -10
- package/dist/commands/improve/consolidate.js +10 -65
- package/dist/commands/improve/distill/lesson-update.js +91 -0
- package/dist/commands/improve/distill-guards.js +1 -43
- package/dist/commands/improve/distill.js +148 -21
- package/dist/commands/improve/eligibility.js +14 -1
- package/dist/commands/improve/extract-cli.js +1 -1
- package/dist/commands/improve/extract-prompt.js +17 -7
- package/dist/commands/improve/extract.js +5 -7
- package/dist/commands/improve/improve-cli.js +125 -118
- package/dist/commands/improve/improve-strategies.js +8 -12
- package/dist/commands/improve/improve.js +134 -52
- package/dist/commands/improve/loop-stages.js +18 -5
- package/dist/commands/improve/planner.js +0 -1
- package/dist/commands/improve/preparation.js +40 -99
- package/dist/commands/improve/proactive-maintenance.js +2 -2
- package/dist/commands/improve/reflect-noise.js +3 -55
- package/dist/commands/improve/reflect.js +29 -34
- package/dist/commands/improve/retrieval-queries.js +37 -0
- package/dist/commands/improve/retrieval-scope.js +2 -2
- package/dist/commands/improve/salience.js +2 -9
- package/dist/commands/improve/session-asset.js +4 -1
- package/dist/commands/improve/stage.js +23 -12
- package/dist/commands/lint/index.js +5 -20
- package/dist/commands/observability-cli.js +3 -9
- package/dist/commands/proposal/drain.js +43 -6
- package/dist/commands/proposal/proposal-cli.js +11 -31
- package/dist/commands/proposal/repository.js +20 -14
- package/dist/commands/proposal/validators/proposal-quality-validators.js +0 -3
- package/dist/commands/read/knowledge.js +3 -3
- package/dist/commands/read/remember-cli.js +0 -13
- package/dist/commands/read/search-cli.js +29 -97
- package/dist/commands/read/search.js +0 -11
- package/dist/commands/read/show.js +0 -19
- package/dist/commands/sources/plugin-upgrade.js +164 -101
- package/dist/commands/sources/sources-cli.js +1 -15
- package/dist/commands/sources/stash-cli.js +6 -14
- package/dist/commands/tasks/tasks-cli.js +4 -115
- package/dist/commands/workflow/plan.js +11 -33
- package/dist/commands/workflow-cli.js +2 -7
- package/dist/core/adapter/adapter-ids.js +1 -2
- package/dist/core/adapter/adapters/agent-skills-adapter.js +0 -4
- package/dist/core/adapter/adapters/akm-adapter.js +9 -48
- package/dist/core/adapter/adapters/akm-lint.js +10 -26
- package/dist/core/adapter/adapters/akm-metadata.js +2 -72
- package/dist/core/adapter/adapters/akm-task-adapter.js +0 -5
- package/dist/core/adapter/adapters/akm-workflow-adapter.js +9 -28
- package/dist/core/adapter/adapters/dotenv-adapter.js +1 -20
- package/dist/core/adapter/adapters/generic-files-adapter.js +0 -10
- package/dist/core/adapter/adapters/llm-wiki-adapter.js +0 -4
- package/dist/core/adapter/adapters/tool-dir-shared.js +0 -24
- package/dist/core/adapter/adapters/website-snapshot-adapter.js +4 -4
- package/dist/core/adapter/recognize-match.js +3 -4
- package/dist/core/common.js +18 -2
- package/dist/core/config/config-schema.js +12 -15
- package/dist/core/config/config-types.js +6 -15
- package/dist/core/config/config-walker.js +6 -23
- package/dist/core/config/config.js +17 -80
- package/dist/core/config/engine-semantics.js +7 -3
- package/dist/core/config/schema/engines.js +7 -7
- package/dist/core/config/schema/improve-processes.js +10 -63
- package/dist/core/config/schema/improve.js +2 -21
- package/dist/core/config/schema/index-config.js +6 -39
- package/dist/core/env-secret-ref.js +2 -45
- package/dist/core/errors.js +1 -2
- package/dist/core/extra-params.js +2 -86
- package/dist/core/file-lock.js +12 -7
- package/dist/core/improve-result.js +13 -1
- package/dist/core/mutation-target.js +2 -2
- package/dist/core/paths.js +4 -0
- package/dist/core/recognition-util.js +4 -5
- package/dist/core/run-lock.js +1 -1
- package/dist/core/subprocess.js +49 -0
- package/dist/core/warn.js +21 -4
- package/dist/core/write-source.js +3 -3
- package/dist/execution/target-ref.js +1 -2
- package/dist/indexer/indexer.js +15 -6
- package/dist/indexer/passes/memory-inference.js +15 -6
- package/dist/indexer/search/db-search.js +49 -36
- package/dist/indexer/search/fts-query.js +0 -19
- package/dist/indexer/search/ranking.js +29 -1
- package/dist/indexer/usage/usage-events.js +21 -16
- package/dist/integrations/agent/engine-resolution.js +5 -2
- package/dist/integrations/agent/index.js +1 -1
- package/dist/integrations/agent/profiles.js +41 -98
- package/dist/integrations/agent/request-lowering.js +3 -3
- package/dist/integrations/harnesses/aider/index.js +5 -0
- package/dist/integrations/harnesses/amazonq/index.js +1 -0
- package/dist/integrations/harnesses/claude/config-import.js +2 -3
- package/dist/integrations/harnesses/claude/index.js +5 -0
- package/dist/integrations/harnesses/codex/index.js +1 -0
- package/dist/integrations/harnesses/copilot/index.js +1 -0
- package/dist/integrations/harnesses/gemini/index.js +1 -0
- package/dist/integrations/harnesses/index.js +18 -39
- package/dist/integrations/harnesses/opencode/agent-builder.js +60 -35
- package/dist/integrations/harnesses/opencode/config-import.js +121 -52
- package/dist/integrations/harnesses/opencode/index.js +22 -0
- package/dist/integrations/harnesses/opencode/plugin-layout.js +68 -0
- package/dist/integrations/harnesses/opencode/session-log-types.js +12 -0
- package/dist/integrations/harnesses/opencode/session-log-v1.js +72 -0
- package/dist/integrations/harnesses/opencode/session-log-v2.js +140 -0
- package/dist/integrations/harnesses/opencode/session-log.js +104 -115
- package/dist/integrations/harnesses/opencode/version.js +98 -0
- package/dist/integrations/harnesses/opencode-sdk/{harness.js → index.js} +5 -17
- package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +105 -206
- package/dist/integrations/harnesses/opencode-sdk/v1-adapter.js +199 -0
- package/dist/integrations/harnesses/opencode-sdk/v2-adapter.js +254 -0
- package/dist/integrations/harnesses/opencode-sdk/wire.js +66 -0
- package/dist/integrations/harnesses/openhands/index.js +1 -0
- package/dist/integrations/harnesses/pi/index.js +1 -0
- package/dist/integrations/harnesses/shared.js +2 -0
- package/dist/integrations/harnesses/types.js +2 -0
- package/dist/llm/client.js +74 -14
- package/dist/output/cli-hints.js +1 -1
- package/dist/output/context.js +10 -19
- package/dist/output/format-exempt.js +5 -8
- package/dist/output/shapes/helpers.js +1 -22
- package/dist/output/shapes/passthrough.js +0 -1
- package/dist/output/shapes.js +3 -31
- package/dist/output/stdout.js +5 -1
- package/dist/output/text/command-format.js +6 -1
- package/dist/output/text/workflow-format.js +4 -22
- package/dist/scripts/akm-migrate-node.js +15769 -16731
- package/dist/scripts/akm-migrate.js +16339 -17297
- package/dist/setup/detect.js +10 -4
- package/dist/setup/harness-config-import.js +5 -14
- package/dist/setup/setup.js +1 -1
- package/dist/setup/steps/tasks.js +12 -13
- package/dist/sources/providers/git-stash.js +94 -13
- package/dist/storage/repositories/index-utility-repository.js +2 -32
- package/dist/storage/repositories/index-vec-repository.js +4 -0
- package/dist/storage/repositories/task-history-repository.js +0 -5
- package/dist/storage/repositories/workflow-runs-repository.js +5 -15
- package/dist/tasks/embedded.js +2 -1
- package/dist/tasks/run/run-command-task.js +9 -1
- package/dist/tasks/run/run-workflow-task.js +4 -3
- package/dist/tasks/run/task-history.js +0 -2
- package/dist/tasks/run/task-log.js +38 -1
- package/dist/tasks/schedule-gates.js +39 -0
- package/dist/tasks/scheduler-binding.js +0 -16
- package/dist/tasks/scheduler-sync.js +3 -97
- package/dist/tasks/source/bounded-document.js +1 -1
- package/dist/tasks/source/task-source-v4.js +2 -12
- package/dist/tasks/task-run-reserved-flags.js +2 -31
- package/dist/workflows/authoring/authoring.js +6 -6
- package/dist/workflows/compile.js +8 -65
- package/dist/workflows/exec/child-workflow.js +22 -3
- package/dist/workflows/exec/native-executor.js +12 -147
- package/dist/workflows/exec/run-workflow.js +31 -103
- package/dist/workflows/exec/step-work.js +9 -178
- package/dist/workflows/exec/unit-dispatch.js +0 -10
- package/dist/workflows/freeze/environment.js +3 -44
- package/dist/workflows/freeze/freeze.js +8 -41
- package/dist/workflows/freeze/targets/child-workflow.js +27 -63
- package/dist/workflows/freeze/targets/command.js +2 -16
- package/dist/workflows/freeze/targets/shell.js +0 -2
- package/dist/workflows/freeze/task-bindings.js +2 -28
- package/dist/workflows/ir/params.js +12 -2
- package/dist/workflows/parser.js +82 -232
- package/dist/workflows/plan.js +1 -1
- package/dist/workflows/renderer.js +10 -19
- package/dist/workflows/runtime/run-plan.js +11 -53
- package/dist/workflows/runtime/runs.js +4 -27
- package/dist/workflows/source-files.js +12 -16
- package/dist/workflows/source-semantics.js +1 -93
- package/docs/README.md +43 -42
- package/docs/agents/README.md +15 -0
- package/docs/agents/agent-install.md +14 -0
- package/docs/architecture/0.10-process-rules.md +827 -0
- package/docs/architecture/README.md +67 -0
- package/docs/architecture/adapters.md +258 -0
- package/docs/architecture/akm-architecture-decision-history.md +2055 -0
- package/docs/architecture/akm-core-principles.md +126 -0
- package/docs/architecture/architecture.md +578 -0
- package/docs/architecture/comparisons/claude-code-vs-akm-workflows-full.md +550 -0
- package/docs/architecture/decisions/0001-no-interpolation-attached-structured-context.md +72 -0
- package/docs/architecture/decisions/0002-unit-reuse-and-input-hash-scope.md +142 -0
- package/docs/architecture/decisions/0003-child-env-allowlist-and-provenance.md +189 -0
- package/docs/architecture/decisions/0004-task-input-contract-and-flag-coercion.md +97 -0
- package/docs/architecture/decisions/0005-task-result-vocabulary-and-legacy-read-mapping.md +108 -0
- package/docs/architecture/decisions/0006-task-source-version-routing.md +124 -0
- package/docs/architecture/decisions/0007-workflow-composition-bounds.md +83 -0
- package/docs/architecture/decisions/0008-task-binding-normalization.md +88 -0
- package/docs/architecture/decisions/0009-child-run-publication-column-parity.md +80 -0
- package/docs/architecture/decisions/0010-driver-protocol-cut.md +36 -0
- package/docs/architecture/decisions/0011-engine-run-loop-invariants.md +125 -0
- package/docs/architecture/decisions/README.md +62 -0
- package/docs/architecture/improvement.md +479 -0
- package/docs/architecture/internals/classification.md +154 -0
- package/docs/architecture/internals/fresh-host-rebuild-runbook.md +40 -0
- package/docs/architecture/internals/functional-contract-patterns.md +340 -0
- package/docs/architecture/internals/health-advisories.md +110 -0
- package/docs/architecture/internals/improve-workflow.md +719 -0
- package/docs/architecture/internals/indexing.md +498 -0
- package/docs/architecture/internals/registry-network-boundary.md +57 -0
- package/docs/architecture/internals/search.md +248 -0
- package/docs/architecture/internals/storage-locations.md +943 -0
- package/docs/architecture/persisted-data-compat.md +68 -0
- package/docs/architecture/reviews/env-secret-access.md +319 -0
- package/docs/architecture/runtime-boundary-design.md +153 -0
- package/docs/architecture/specs/0.9.0-close-out-plan.md +361 -0
- package/docs/architecture/specs/0.9.0-decisions.md +532 -0
- package/docs/architecture/specs/0.9.0-docs-code-drift-register.md +745 -0
- package/docs/architecture/specs/0.9.0-open-items-register.md +135 -0
- package/docs/architecture/specs/0.9.0-public-api-issue-backlog.md +740 -0
- package/docs/architecture/specs/0.9.0-release-surface-review.md +636 -0
- package/docs/architecture/specs/agent-command-engine-model-design.md +513 -0
- package/docs/architecture/specs/akm-0.9.0-bundle-adapter-spec.md +501 -0
- package/docs/architecture/specs/akm-0.9.0-ref-grammar-decision.md +291 -0
- package/docs/architecture/specs/akm-format-neutral-bundle-workspace-spec.md +2059 -0
- package/docs/architecture/specs/di-seams-plan.md +539 -0
- package/docs/architecture/specs/driver-protocol-keep-or-cut.md +275 -0
- package/docs/architecture/specs/fact-asset-type.md +142 -0
- package/docs/architecture/specs/improve-collapse-churn-detector-design.md +634 -0
- package/docs/architecture/specs/okf-support.md +148 -0
- package/docs/architecture/specs/ref.md +329 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/README.md +72 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/findings-consolidated.md +152 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-alternatives.md +352 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-bunqueue.md +300 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-openworkflow.md +402 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-1.md +758 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-2.md +645 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-3.md +602 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-adversarial.md +27 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-architecture.md +27 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-coverage.md +74 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-security.md +15 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-adversarial.md +132 -0
- package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-verification.md +147 -0
- package/docs/architecture/specs/stash-conventions-code-spec.md +275 -0
- package/docs/architecture/specs/stash-organization-conventions.md +377 -0
- package/docs/architecture/specs/task-workflow-format-unification.md +721 -0
- package/docs/architecture/specs/workflow-engine-buy-vs-build.md +231 -0
- package/docs/architecture/specs/workflow-format-unification.md +432 -0
- package/docs/architecture/testing/manual-testing-checklist.md +3411 -0
- package/docs/architecture/testing/okf-v0.2-conformance-runbook.md +924 -0
- package/docs/architecture/testing/task-workflow-manual-tests.md +1720 -0
- package/docs/architecture/testing/testing-workflow.md +446 -0
- package/docs/architecture/workflow-engine.md +223 -0
- package/docs/guides/README.md +33 -0
- package/docs/guides/author-bundles.md +310 -0
- package/docs/guides/author-workflows.md +490 -0
- package/docs/guides/bundles.md +323 -0
- package/docs/guides/capture-knowledge.md +136 -0
- package/docs/guides/claude-code-vs-akm-workflows.md +29 -0
- package/docs/guides/concepts.md +93 -0
- package/docs/guides/discover-and-load.md +158 -0
- package/docs/guides/getting-started.md +240 -0
- package/docs/guides/improve-the-library.md +247 -0
- package/docs/guides/knowledge-management.md +18 -0
- package/docs/guides/recipes/headless-install.md +97 -0
- package/docs/guides/recipes/website-source.md +28 -0
- package/docs/guides/run-workflows.md +279 -0
- package/docs/guides/scheduling.md +131 -0
- package/docs/guides/use-with-any-agent.md +174 -0
- package/docs/guides/wikis.md +81 -0
- package/docs/integration/bundling-akm.md +7 -6
- package/docs/maintainers/README.md +19 -0
- package/docs/maintainers/curate-workmap.md +335 -0
- package/docs/maintainers/eval.md +3 -0
- package/docs/maintainers/local-development.md +108 -0
- package/docs/maintainers/release-checklist.md +135 -0
- package/docs/migration/README.md +4 -2
- package/docs/migration/release-notes/0.0.13.md +1 -1
- package/docs/migration/release-notes/0.1.0.md +1 -1
- package/docs/migration/release-notes/0.10.0.md +201 -0
- package/docs/migration/release-notes/0.2.0.md +1 -1
- package/docs/migration/release-notes/0.3.0.md +1 -1
- package/docs/migration/release-notes/0.5.0.md +1 -1
- package/docs/migration/release-notes/0.6.0.md +1 -1
- package/docs/migration/release-notes/0.7.0.md +1 -1
- package/docs/migration/release-notes/0.7.3.md +2 -2
- package/docs/migration/release-notes/0.7.4.md +1 -1
- package/docs/migration/release-notes/0.7.5.md +1 -1
- package/docs/migration/release-notes/0.8.0.md +1 -1
- package/docs/migration/release-notes/0.9.0.md +1 -1
- package/docs/migration/release-notes/0.9.14.md +1 -1
- package/docs/migration/release-notes/0.9.15.md +1 -1
- package/docs/migration/release-notes/0.9.16.md +1 -1
- package/docs/migration/release-notes/0.9.17.md +1 -1
- package/docs/migration/release-notes/0.9.19.md +1 -1
- package/docs/migration/release-notes/0.9.2.md +1 -1
- package/docs/migration/release-notes/README.md +28 -31
- package/docs/migration/v0.5-to-v0.6.md +759 -0
- package/docs/migration/v0.8-to-v0.9.md +1 -1
- package/docs/migration/v0.9-to-v0.10.md +507 -0
- package/docs/plans/0.9.2-agent-command-workflow-plan.md +423 -0
- package/docs/posts/README.md +30 -0
- package/docs/posts/akm-command-tour.md +495 -0
- package/docs/posts/akm-logo-sized.webp +0 -0
- package/docs/posts/belief-aware-memory-12.md +139 -0
- package/docs/posts/config-v2-lessons-16.md +191 -0
- package/docs/posts/improve-loop-autonomous-10.md +225 -0
- package/docs/posts/improve-pipeline-debugging-0803.md +179 -0
- package/docs/posts/intro-part-01.md +76 -0
- package/docs/posts/intro-part-02.md +221 -0
- package/docs/posts/intro-part-03.md +190 -0
- package/docs/posts/intro-part-04.md +221 -0
- package/docs/posts/llm-mode-reflect-13.md +166 -0
- package/docs/posts/openpalm-built-on-akm.md +86 -0
- package/docs/posts/progressive-disclosure-06.md +129 -0
- package/docs/posts/proposal-safety-net-15.md +112 -0
- package/docs/posts/release-0.5.0.md +247 -0
- package/docs/posts/release-0.6.0.md +117 -0
- package/docs/posts/release-0.7.0.md +159 -0
- package/docs/posts/release-0.8.0.md +332 -0
- package/docs/posts/scattered-skills-05.md +100 -0
- package/docs/posts/task-assets-persistent-workflows-11.md +222 -0
- package/docs/posts/team-skills-07.md +198 -0
- package/docs/posts/wiki-agent-knowledge-08.md +223 -0
- package/docs/posts/workflows-vaults-09.md +321 -0
- package/docs/product-surface.md +54 -0
- package/docs/reference/README.md +2 -2
- package/docs/reference/api.md +65 -0
- package/docs/reference/asset-types.md +166 -0
- package/docs/reference/bundle-types.md +2 -4
- package/docs/reference/cli.md +163 -192
- package/docs/reference/configuration.md +101 -20
- package/docs/reference/data-and-telemetry.md +2 -2
- package/docs/reference/env-and-secrets.md +126 -0
- package/docs/reference/memory.md +124 -0
- package/docs/reference/refs.md +156 -0
- package/docs/reference/registry.md +489 -0
- package/docs/reference/supported-formats.md +3 -4
- package/docs/reference/tasks.md +12 -19
- package/docs/reference/website-sources.md +141 -0
- package/docs/reference/workflow-schema.md +89 -317
- package/docs/reference/workflows.md +20 -48
- package/package.json +23 -16
- package/schemas/akm-config.json +2 -243
- package/schemas/akm-task.json +2 -3
- package/schemas/akm-workflow.json +47 -84
- package/dist/assets/improve-strategies/catchup.json +0 -41
- package/dist/assets/improve-strategies/proactive-maintenance.json +0 -24
- package/dist/assets/improve-strategies/quick.json +0 -17
- package/dist/assets/improve-strategies/reflect-distill.json +0 -29
- package/dist/assets/improve-strategies/thorough.json +0 -49
- package/dist/assets/prompts/retrieval-relevance-judge.md +0 -6
- package/dist/assets/tasks/improve/akm-improve-catchup.yml +0 -6
- package/dist/assets/tasks/improve/akm-improve-frequent.yml +0 -4
- package/dist/assets/tasks/improve/akm-improve-nightly.yml +0 -4
- package/dist/cli/retired-commands.js +0 -118
- package/dist/commands/improve/retrieval-gate.js +0 -132
- package/dist/commands/tasks/validate.js +0 -176
- package/dist/core/config/legacy-source-shape-shim.js +0 -117
- package/dist/indexer/feedback/utility-policy.js +0 -75
- package/dist/integrations/harnesses/ids.js +0 -28
- package/dist/tasks/source/task-source-v3-frozen.js +0 -424
- package/dist/tasks/source/task-to-v4.js +0 -863
- package/dist/workflows/exec/worktree.js +0 -372
- package/dist/workflows/freeze/child-output-references.js +0 -83
- package/dist/workflows/freeze/identity.js +0 -22
- package/dist/workflows/freeze/targets/script.js +0 -50
- package/dist/workflows/freeze/targets/task.js +0 -124
- package/dist/workflows/github-yaml.js +0 -506
- package/dist/workflows/runtime/run-outputs.js +0 -80
package/dist/llm/client.js
CHANGED
|
@@ -49,10 +49,14 @@ function htmlExcerpt(body) {
|
|
|
49
49
|
export class LlmCallError extends Error {
|
|
50
50
|
code;
|
|
51
51
|
statusCode;
|
|
52
|
-
|
|
52
|
+
namesResponseFormat;
|
|
53
|
+
constructor(message, code, statusCode,
|
|
54
|
+
/** A 5xx whose body names the response format; set from the whole body, since the message keeps only its first 200 characters. */
|
|
55
|
+
namesResponseFormat = false) {
|
|
53
56
|
super(message);
|
|
54
57
|
this.code = code;
|
|
55
58
|
this.statusCode = statusCode;
|
|
59
|
+
this.namesResponseFormat = namesResponseFormat;
|
|
56
60
|
this.name = "LlmCallError";
|
|
57
61
|
}
|
|
58
62
|
}
|
|
@@ -227,6 +231,12 @@ const jsonSchemaUnsupportedConnections = new Set();
|
|
|
227
231
|
* `enable_thinking`): a strict hosted API answers 400 `Unknown parameter`.
|
|
228
232
|
*/
|
|
229
233
|
const thinkingControlRejectedConnections = new Set();
|
|
234
|
+
/**
|
|
235
|
+
* And for OpenAI's reasoning models: they answer 400 to any `temperature` but
|
|
236
|
+
* the default, and to `max_tokens`, naming `max_completion_tokens` instead.
|
|
237
|
+
*/
|
|
238
|
+
const temperatureRejectedConnections = new Set();
|
|
239
|
+
const maxCompletionTokensConnections = new Set();
|
|
230
240
|
function connectionKey(config) {
|
|
231
241
|
return `${config.endpoint}|${config.model}`;
|
|
232
242
|
}
|
|
@@ -234,6 +244,8 @@ function connectionKey(config) {
|
|
|
234
244
|
export function _resetEndpointSupportTrackersForTests() {
|
|
235
245
|
jsonSchemaUnsupportedConnections.clear();
|
|
236
246
|
thinkingControlRejectedConnections.clear();
|
|
247
|
+
temperatureRejectedConnections.clear();
|
|
248
|
+
maxCompletionTokensConnections.clear();
|
|
237
249
|
}
|
|
238
250
|
/**
|
|
239
251
|
* Whether this connection has already been proven, this process, not to
|
|
@@ -263,6 +275,12 @@ function isRejectedRequest(err) {
|
|
|
263
275
|
}
|
|
264
276
|
/** A strict API names the field it does not know: `Unknown parameter: 'chat_template_kwargs'.` */
|
|
265
277
|
const THINKING_FIELD_NAMED = /chat_template_kwargs|enable_thinking/;
|
|
278
|
+
/** `Unsupported value: 'temperature' does not support 0 with this model. Only the default (1) value is supported.` */
|
|
279
|
+
const TEMPERATURE_NAMED = /'temperature'/;
|
|
280
|
+
/** `Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.` */
|
|
281
|
+
const MAX_TOKENS_REPLACED = /max_completion_tokens/;
|
|
282
|
+
/** A gateway that cannot honour the schema may answer 5xx: `502 {"error":{"code":"format_ignored"}}` (#1150). */
|
|
283
|
+
const RESPONSE_FORMAT_NAMED = /format_ignored|response_format|json_schema/;
|
|
266
284
|
/**
|
|
267
285
|
* A single chat-completion attempt: one HTTP request/response cycle, with an
|
|
268
286
|
* inline fallback-once when a schema was requested and the provider 4xx's
|
|
@@ -275,18 +293,49 @@ const THINKING_FIELD_NAMED = /chat_template_kwargs|enable_thinking/;
|
|
|
275
293
|
*
|
|
276
294
|
* The thinking-control fields get the same treatment (#1045): a 4xx that
|
|
277
295
|
* names `chat_template_kwargs` or `enable_thinking` is answered by one retry
|
|
278
|
-
* without them, which may in turn fall back without the schema.
|
|
296
|
+
* without them, which may in turn fall back without the schema. A 4xx that
|
|
297
|
+
* names `temperature`, or asks for `max_completion_tokens`, is answered the
|
|
298
|
+
* same way: the connection stops sending `temperature`, or sends the token cap
|
|
299
|
+
* as `max_completion_tokens`, for the rest of the process.
|
|
279
300
|
*/
|
|
280
301
|
async function chatCompletionAttempt(config, messages, options, timeoutMs, includeThinking = (options?.enableThinking ?? config.enableThinking) !== undefined &&
|
|
281
302
|
!isThinkingControlKnownRejected(config)) {
|
|
282
303
|
const wantsSchema = Boolean(options?.responseSchema) && config.supportsJsonSchema !== false && !isJsonSchemaKnownUnsupported(config);
|
|
304
|
+
// The schema attempt's error record is held, not emitted: when the retry without the schema
|
|
305
|
+
// recovers the call, that call is ONE success, not a failure plus a success. Every other exit
|
|
306
|
+
// flushes the held record, so a failed call is still recorded once.
|
|
307
|
+
const held = wantsSchema ? {} : undefined;
|
|
308
|
+
const flushHeld = () => {
|
|
309
|
+
if (held?.record)
|
|
310
|
+
emitLlmUsage(held.record);
|
|
311
|
+
};
|
|
283
312
|
try {
|
|
284
|
-
return await chatCompletionAttemptOnce(config, messages, options, timeoutMs, wantsSchema, includeThinking);
|
|
313
|
+
return await chatCompletionAttemptOnce(config, messages, options, timeoutMs, wantsSchema, includeThinking, held);
|
|
285
314
|
}
|
|
286
315
|
catch (err) {
|
|
287
|
-
|
|
316
|
+
// A 5xx that names the response format is answered like the 4xx rejection below (#1150).
|
|
317
|
+
if (wantsSchema && err instanceof LlmCallError && err.namesResponseFormat) {
|
|
318
|
+
return retryWithoutSchema(config, messages, options, timeoutMs, includeThinking, err);
|
|
319
|
+
}
|
|
320
|
+
if (!isRejectedRequest(err)) {
|
|
321
|
+
flushHeld();
|
|
288
322
|
throw err;
|
|
323
|
+
}
|
|
324
|
+
const key = connectionKey(config);
|
|
325
|
+
if (TEMPERATURE_NAMED.test(err.message) && !temperatureRejectedConnections.has(key)) {
|
|
326
|
+
flushHeld();
|
|
327
|
+
warnVerbose(`[akm] LLM rejected temperature (${err.statusCode}); retrying once without it: ${err.message}`);
|
|
328
|
+
temperatureRejectedConnections.add(key);
|
|
329
|
+
return chatCompletionAttempt(config, messages, options, timeoutMs, includeThinking);
|
|
330
|
+
}
|
|
331
|
+
if (MAX_TOKENS_REPLACED.test(err.message) && !maxCompletionTokensConnections.has(key)) {
|
|
332
|
+
flushHeld();
|
|
333
|
+
warnVerbose(`[akm] LLM rejected max_tokens (${err.statusCode}); retrying once with max_completion_tokens: ${err.message}`);
|
|
334
|
+
maxCompletionTokensConnections.add(key);
|
|
335
|
+
return chatCompletionAttempt(config, messages, options, timeoutMs, includeThinking);
|
|
336
|
+
}
|
|
289
337
|
if (includeThinking && THINKING_FIELD_NAMED.test(err.message)) {
|
|
338
|
+
flushHeld();
|
|
290
339
|
warnVerbose(`[akm] LLM rejected chat_template_kwargs/enable_thinking (${err.statusCode}); retrying once without them: ${err.message}`);
|
|
291
340
|
const fallback = await chatCompletionAttempt(config, messages, options, timeoutMs, false);
|
|
292
341
|
thinkingControlRejectedConnections.add(connectionKey(config));
|
|
@@ -294,13 +343,16 @@ async function chatCompletionAttempt(config, messages, options, timeoutMs, inclu
|
|
|
294
343
|
}
|
|
295
344
|
if (!wantsSchema)
|
|
296
345
|
throw err;
|
|
297
|
-
|
|
298
|
-
const fallback = await chatCompletionAttemptOnce(config, messages, options, timeoutMs, false, includeThinking);
|
|
299
|
-
jsonSchemaUnsupportedConnections.add(connectionKey(config));
|
|
300
|
-
return fallback;
|
|
346
|
+
return retryWithoutSchema(config, messages, options, timeoutMs, includeThinking, err);
|
|
301
347
|
}
|
|
302
348
|
}
|
|
303
|
-
async function
|
|
349
|
+
async function retryWithoutSchema(config, messages, options, timeoutMs, includeThinking, err) {
|
|
350
|
+
warnVerbose(`[akm] LLM rejected response_format:json_schema (${err.statusCode}); retrying once without it: ${err.message}`);
|
|
351
|
+
const fallback = await chatCompletionAttemptOnce(config, messages, options, timeoutMs, false, includeThinking);
|
|
352
|
+
jsonSchemaUnsupportedConnections.add(connectionKey(config));
|
|
353
|
+
return fallback;
|
|
354
|
+
}
|
|
355
|
+
async function chatCompletionAttemptOnce(config, messages, options, timeoutMs, includeSchema, includeThinking, held) {
|
|
304
356
|
if (config.extraParams !== undefined) {
|
|
305
357
|
const issue = validateExtraParams(config.extraParams)[0];
|
|
306
358
|
if (issue)
|
|
@@ -344,11 +396,15 @@ async function chatCompletionAttemptOnce(config, messages, options, timeoutMs, i
|
|
|
344
396
|
? {}
|
|
345
397
|
: { chat_template_kwargs: { enable_thinking: resolvedEnableThinking }, enable_thinking: resolvedEnableThinking };
|
|
346
398
|
const reasoningEffortParams = config.reasoningEffort === undefined ? {} : { reasoning_effort: config.reasoningEffort };
|
|
399
|
+
const key = connectionKey(config);
|
|
400
|
+
const maxTokensField = maxCompletionTokensConnections.has(key) ? "max_completion_tokens" : "max_tokens";
|
|
347
401
|
const requestBody = JSON.stringify({
|
|
348
402
|
model: config.model,
|
|
349
403
|
messages,
|
|
350
|
-
|
|
351
|
-
|
|
404
|
+
...(temperatureRejectedConnections.has(key)
|
|
405
|
+
? {}
|
|
406
|
+
: { temperature: options?.temperature ?? config.temperature ?? 0.3 }),
|
|
407
|
+
...(resolvedMaxTokens !== undefined ? { [maxTokensField]: resolvedMaxTokens } : {}),
|
|
352
408
|
...config.extraParams,
|
|
353
409
|
...responseFormat,
|
|
354
410
|
...thinkingParams,
|
|
@@ -410,7 +466,7 @@ async function chatCompletionAttemptOnce(config, messages, options, timeoutMs, i
|
|
|
410
466
|
throw new LlmCallError(`LLM provider returned HTML instead of JSON (${status}) ${config.endpoint}: ${redactSensitiveText(htmlExcerpt(rawBody), resolvedKey ? [resolvedKey] : [])}`, "provider_html_error", status);
|
|
411
467
|
}
|
|
412
468
|
if (status >= 500) {
|
|
413
|
-
throw new LlmCallError(`LLM provider error (${status}) ${config.endpoint}: ${safeBody}`, "provider_error", status);
|
|
469
|
+
throw new LlmCallError(`LLM provider error (${status}) ${config.endpoint}: ${safeBody}`, "provider_error", status, RESPONSE_FORMAT_NAMED.test(rawBody));
|
|
414
470
|
}
|
|
415
471
|
throw new LlmCallError(`LLM request failed (${status}) ${config.endpoint}: ${safeBody}`, "provider_error", status);
|
|
416
472
|
}
|
|
@@ -469,12 +525,16 @@ async function chatCompletionAttemptOnce(config, messages, options, timeoutMs, i
|
|
|
469
525
|
return result;
|
|
470
526
|
}
|
|
471
527
|
catch (err) {
|
|
472
|
-
|
|
528
|
+
const errorRecord = {
|
|
473
529
|
...terminalFields,
|
|
474
530
|
outcome: "error",
|
|
475
531
|
durationMs: Date.now() - requestStartedAt,
|
|
476
532
|
errorCode: err instanceof LlmCallError ? err.code : "unknown_error",
|
|
477
|
-
}
|
|
533
|
+
};
|
|
534
|
+
if (held)
|
|
535
|
+
held.record = errorRecord;
|
|
536
|
+
else
|
|
537
|
+
emitLlmUsage(errorRecord);
|
|
478
538
|
throw err;
|
|
479
539
|
}
|
|
480
540
|
}
|
package/dist/output/cli-hints.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
4
|
/**
|
|
5
|
-
* Embedded agent CLI guide rendered by `akm hints
|
|
5
|
+
* Embedded agent CLI guide rendered by `akm hints`.
|
|
6
6
|
*
|
|
7
7
|
* Extracted from `src/cli.ts` so it does not bloat the CLI module and so
|
|
8
8
|
* docs/CI tooling can re-use the same constants. Two flavors:
|
package/dist/output/context.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Process-level output mode singleton.
|
|
6
6
|
*
|
|
7
|
-
* Output mode (format + detail
|
|
7
|
+
* Output mode (format + detail, and the agent projection `--detail agent`
|
|
8
|
+
* selects) is parsed once at startup from
|
|
8
9
|
* `process.argv` and the persisted user config. All subsequent `output()`
|
|
9
10
|
* calls read from this in-memory singleton instead of re-scanning argv and
|
|
10
11
|
* re-loading config on every call.
|
|
@@ -15,8 +16,7 @@
|
|
|
15
16
|
*/
|
|
16
17
|
import { UsageError } from "../core/errors.js";
|
|
17
18
|
const OUTPUT_FORMATS = ["json", "yaml", "text", "jsonl", "md", "html"];
|
|
18
|
-
const
|
|
19
|
-
const SHAPE_MODES = ["human", "agent", "summary"];
|
|
19
|
+
const DETAIL_VALUES = ["brief", "normal", "full", "agent"];
|
|
20
20
|
function parseOutputFormat(value) {
|
|
21
21
|
if (!value)
|
|
22
22
|
return undefined;
|
|
@@ -27,16 +27,9 @@ function parseOutputFormat(value) {
|
|
|
27
27
|
export function parseDetailLevel(value) {
|
|
28
28
|
if (!value)
|
|
29
29
|
return undefined;
|
|
30
|
-
if (
|
|
30
|
+
if (DETAIL_VALUES.includes(value))
|
|
31
31
|
return value;
|
|
32
|
-
throw new UsageError(`Invalid value for --detail: ${value}. Expected one of: ${
|
|
33
|
-
}
|
|
34
|
-
function parseShapeMode(value) {
|
|
35
|
-
if (!value)
|
|
36
|
-
return undefined;
|
|
37
|
-
if (SHAPE_MODES.includes(value))
|
|
38
|
-
return value;
|
|
39
|
-
throw new UsageError(`Invalid value for --shape: ${value}. Expected one of: ${SHAPE_MODES.join("|")}`, "INVALID_SHAPE_VALUE");
|
|
32
|
+
throw new UsageError(`Invalid value for --detail: ${value}. Expected one of: ${DETAIL_VALUES.join("|")}`, "INVALID_DETAIL_VALUE");
|
|
40
33
|
}
|
|
41
34
|
export function parseFlagValue(argv, flag) {
|
|
42
35
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -88,13 +81,11 @@ export function getHyphenatedBoolean(args, key) {
|
|
|
88
81
|
*/
|
|
89
82
|
export function resolveOutputMode(argv, defaults = {}) {
|
|
90
83
|
const format = parseOutputFormat(parseFlagValue(argv, "--format")) ?? defaults?.format ?? "json";
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const detail = parseDetailLevel(rawDetail) ?? defaults?.detail ?? "brief";
|
|
97
|
-
const shape = parseShapeMode(rawShape) ?? "human";
|
|
84
|
+
// `--detail agent` selects the agent projection; the verbosity then stays at
|
|
85
|
+
// the configured default (the projection ignores it).
|
|
86
|
+
const parsedDetail = parseDetailLevel(parseFlagValue(argv, "--detail"));
|
|
87
|
+
const shape = parsedDetail === "agent" ? "agent" : "human";
|
|
88
|
+
const detail = (parsedDetail === "agent" ? undefined : parsedDetail) ?? defaults?.detail ?? "brief";
|
|
98
89
|
const outputPath = parseFlagValue(argv, "--output");
|
|
99
90
|
return { format, detail, shape, ...(outputPath ? { outputPath } : {}) };
|
|
100
91
|
}
|
|
@@ -35,12 +35,11 @@ const EXEMPT_COMMANDS = new Set([
|
|
|
35
35
|
// progress-event lines the child prints during a real `apply` still print
|
|
36
36
|
// verbatim ahead of the formatted result — those are operational logging,
|
|
37
37
|
// not part of the result envelope, the same way a progress spinner would be.
|
|
38
|
-
// Document payload group: bare `help` prints the sectioned overview
|
|
39
|
-
// `help migrate <version>` prints release notes
|
|
40
|
-
//
|
|
41
|
-
// the three render a result envelope.
|
|
38
|
+
// Document payload group: bare `help` prints the sectioned overview and
|
|
39
|
+
// `help migrate <version>` prints release notes — neither renders a result
|
|
40
|
+
// envelope.
|
|
42
41
|
"help",
|
|
43
|
-
// Embedded agent guide document.
|
|
42
|
+
// Embedded agent guide document (`src/output/cli-hints.ts`).
|
|
44
43
|
"hints",
|
|
45
44
|
]);
|
|
46
45
|
/**
|
|
@@ -57,9 +56,7 @@ const EXEMPT_SUBCOMMANDS = new Set([
|
|
|
57
56
|
// envelope. Wrapping it broke every existing substitution silently: the
|
|
58
57
|
// CLI's default format is `json`, so an un-flagged `akm env path <ref>`
|
|
59
58
|
// (exactly how the substitution is always written) started emitting
|
|
60
|
-
// `{"path":"..."}` instead of the raw path.
|
|
61
|
-
// command has no `--all`-style multi-field variant, so the whole surface
|
|
62
|
-
// can be exempt without wrongly warning on a real envelope case.
|
|
59
|
+
// `{"path":"..."}` instead of the raw path.
|
|
63
60
|
"env path",
|
|
64
61
|
]);
|
|
65
62
|
/**
|
|
@@ -310,7 +310,7 @@ export function shapeSearchHit(hit, detail) {
|
|
|
310
310
|
}
|
|
311
311
|
// Stash hit (local or remote)
|
|
312
312
|
// `ref` is included at `brief` so agents can run `akm show <ref>` without
|
|
313
|
-
// needing --detail full or --
|
|
313
|
+
// needing --detail full or --detail agent (REC-03).
|
|
314
314
|
if (detail === "brief") {
|
|
315
315
|
return pickFields(hit, ["type", "name", "ref", "action", "estimatedTokens", "keys"]);
|
|
316
316
|
}
|
|
@@ -393,27 +393,6 @@ export function shapeShowOutput(result, detail, shape = "human") {
|
|
|
393
393
|
delete shaped.editHint;
|
|
394
394
|
return shaped;
|
|
395
395
|
}
|
|
396
|
-
if (shape === "summary") {
|
|
397
|
-
return pickFields(result, [
|
|
398
|
-
"type",
|
|
399
|
-
"name",
|
|
400
|
-
// ref is present on every show shape (human/summary/agent) — it is the
|
|
401
|
-
// canonical identity of the asset, not an agent-only convenience field
|
|
402
|
-
// (R-020).
|
|
403
|
-
"ref",
|
|
404
|
-
"description",
|
|
405
|
-
"tags",
|
|
406
|
-
"parameters",
|
|
407
|
-
"workflowTitle",
|
|
408
|
-
"action",
|
|
409
|
-
"run",
|
|
410
|
-
"origin",
|
|
411
|
-
"keys",
|
|
412
|
-
"links",
|
|
413
|
-
...FRAGMENT_PROVENANCE_FIELDS,
|
|
414
|
-
...FRAGMENT_CONTEXT_FIELDS,
|
|
415
|
-
]);
|
|
416
|
-
}
|
|
417
396
|
const base = pickFields(result, [
|
|
418
397
|
"type",
|
|
419
398
|
"name",
|
package/dist/output/shapes.js
CHANGED
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
2
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
-
/**
|
|
5
|
-
* Pure shaping functions that select and trim fields from command result
|
|
6
|
-
* objects according to the active detail level / agent mode.
|
|
7
|
-
*
|
|
8
|
-
* Every function in this module is side-effect free and operates on plain
|
|
9
|
-
* `Record<string, unknown>` shapes, which makes them trivial to unit test.
|
|
10
|
-
*
|
|
11
|
-
* Output shapes are assembled EXPLICITLY here: each per-command module under
|
|
12
|
-
* `src/output/shapes/` EXPORTS a pure `OutputShapeEntry[]` (no top-level
|
|
13
|
-
* side effect), and this barrel imports those exports and registers them in a
|
|
14
|
-
* single deterministic, order-independent pass (`BUILT_IN_OUTPUT_SHAPES`).
|
|
15
|
-
* Dropping a module from the assembly array is a COMPILE error, not a silent
|
|
16
|
-
* runtime gap. The central `shapeForCommand` dispatcher looks up the registry
|
|
17
|
-
* and throws for unknown commands (v1 spec §9 — exhaustive registry, no silent
|
|
18
|
-
* fallback).
|
|
19
|
-
*/
|
|
20
|
-
import { warnOnce } from "../core/warn.js";
|
|
21
4
|
import { curateShapes } from "./shapes/curate.js";
|
|
22
5
|
import { envListShapes } from "./shapes/env-list.js";
|
|
23
6
|
import { eventsShapes } from "./shapes/events.js";
|
|
@@ -64,12 +47,6 @@ const BUILT_IN_OUTPUT_SHAPES = [
|
|
|
64
47
|
...passthroughShapes,
|
|
65
48
|
];
|
|
66
49
|
registerOutputShapes(BUILT_IN_OUTPUT_SHAPES);
|
|
67
|
-
/**
|
|
68
|
-
* Commands whose shape handler implements the `summary` projection. For every
|
|
69
|
-
* other command, `--shape summary` is a usage error (v1 §5 — honest rejection
|
|
70
|
-
* for a soon-frozen contract, not a silent fallback to `human`).
|
|
71
|
-
*/
|
|
72
|
-
const SHAPE_SUMMARY_COMMANDS = new Set(["show"]);
|
|
73
50
|
// ── `results` collection alias ──────────────────────────────────────────────
|
|
74
51
|
//
|
|
75
52
|
// Every list-returning command names its collection differently (`hits`,
|
|
@@ -80,8 +57,8 @@ const SHAPE_SUMMARY_COMMANDS = new Set(["show"]);
|
|
|
80
57
|
//
|
|
81
58
|
// This maps each list-returning command to the field already holding its
|
|
82
59
|
// collection, and `withResultsAlias` below adds a `results` key pointing at
|
|
83
|
-
// that SAME array (not a copy) to the shaped output — in every
|
|
84
|
-
// `--detail` combination, `
|
|
60
|
+
// that SAME array (not a copy) to the shaped output — in every
|
|
61
|
+
// `--detail` combination, `agent` included, so `--detail agent` needs no
|
|
85
62
|
// separate handling to "guarantee" it. A new list-returning command MUST add
|
|
86
63
|
// an entry here; there is no way to detect a missed one automatically, so the
|
|
87
64
|
// survey deliberately lives in this one place rather than scattered per
|
|
@@ -118,14 +95,9 @@ function withResultsAlias(command, shaped) {
|
|
|
118
95
|
return { ...obj, results: collection };
|
|
119
96
|
}
|
|
120
97
|
export function shapeForCommand(command, result, detail, shape = "human") {
|
|
121
|
-
let effectiveShape = shape;
|
|
122
|
-
if (shape === "summary" && !SHAPE_SUMMARY_COMMANDS.has(command)) {
|
|
123
|
-
warnOnce(`shape-summary-unsupported:${command}`, `[output] '--shape summary' is not supported for 'akm ${command}' (only 'akm show' has a summary projection); falling back to 'agent'.`);
|
|
124
|
-
effectiveShape = "agent";
|
|
125
|
-
}
|
|
126
98
|
const handler = getOutputShapeHandler(command);
|
|
127
99
|
if (handler) {
|
|
128
|
-
return withResultsAlias(command, handler(result, detail,
|
|
100
|
+
return withResultsAlias(command, handler(result, detail, shape));
|
|
129
101
|
}
|
|
130
102
|
// v1 spec §9 (output-shape registry exhaustive): no silent JSON.stringify
|
|
131
103
|
// fallback. A missing case here is a registration bug — fail loudly so
|
package/dist/output/stdout.js
CHANGED
|
@@ -20,5 +20,9 @@
|
|
|
20
20
|
* `tests/integration/output-baseline.test.ts` pins the bytes either way.
|
|
21
21
|
*/
|
|
22
22
|
export function writeStdout(document) {
|
|
23
|
-
process.stdout.write(
|
|
23
|
+
process.stdout.write(stdoutText(document));
|
|
24
|
+
}
|
|
25
|
+
/** The exact bytes {@link writeStdout} writes for `document`; in-process callers return this instead of writing. */
|
|
26
|
+
export function stdoutText(document) {
|
|
27
|
+
return `${document}\n`;
|
|
24
28
|
}
|
|
@@ -662,7 +662,12 @@ export function formatUpdatePlain(r) {
|
|
|
662
662
|
}
|
|
663
663
|
return lines.length > 0 ? lines.join("\n") : `update: nothing to update`;
|
|
664
664
|
}
|
|
665
|
-
const HARNESS_LABELS = {
|
|
665
|
+
const HARNESS_LABELS = {
|
|
666
|
+
"claude-code": "Claude Code",
|
|
667
|
+
codex: "Codex",
|
|
668
|
+
opencode: "OpenCode",
|
|
669
|
+
"opencode-v2": "OpenCode 2",
|
|
670
|
+
};
|
|
666
671
|
/** The plugin lines worth printing: nothing for a plugin that is current or has no plugin to update. */
|
|
667
672
|
function formatUpgradePluginLines(r) {
|
|
668
673
|
const lines = [];
|
|
@@ -235,8 +235,7 @@ function formatInputBindingsList(bindings) {
|
|
|
235
235
|
* expansion's own steps, recursively, indented one level per composition
|
|
236
236
|
* boundary. A child step also carries the child's `planHash` on the step
|
|
237
237
|
* line itself, and (when present) a `with:` line for the step's own
|
|
238
|
-
* `inputBindings[]`
|
|
239
|
-
* names — §4.6's worked example.
|
|
238
|
+
* `inputBindings[]` — §4.6's worked example.
|
|
240
239
|
*/
|
|
241
240
|
function renderPlanStepLines(step, ordinal, lines, prefix = " ") {
|
|
242
241
|
const stepId = typeof step.stepId === "string" ? step.stepId : "unknown";
|
|
@@ -244,11 +243,9 @@ function renderPlanStepLines(step, ordinal, lines, prefix = " ") {
|
|
|
244
243
|
const expansion = typeof step.expansion === "object" && step.expansion !== null ? step.expansion : {};
|
|
245
244
|
const via = typeof expansion.via === "string" ? expansion.via : "direct";
|
|
246
245
|
const childPlanHash = typeof expansion.childPlanHash === "string" ? expansion.childPlanHash : undefined;
|
|
247
|
-
const viaText = via === "
|
|
248
|
-
?
|
|
249
|
-
:
|
|
250
|
-
? `-> ${String(expansion.childRef ?? "")}${childPlanHash ? ` (plan ${childPlanHash})` : ""}`
|
|
251
|
-
: "direct";
|
|
246
|
+
const viaText = via === "child"
|
|
247
|
+
? `-> ${String(expansion.childRef ?? "")}${childPlanHash ? ` (plan ${childPlanHash})` : ""}`
|
|
248
|
+
: "direct";
|
|
252
249
|
lines.push(`${prefix}${ordinal}. ${stepId} ${targetKind} ${viaText}`.replace(/ +/g, " ").trimEnd());
|
|
253
250
|
const detailPrefix = `${prefix} `;
|
|
254
251
|
const inputBindings = Array.isArray(step.inputBindings) ? step.inputBindings : [];
|
|
@@ -256,10 +253,6 @@ function renderPlanStepLines(step, ordinal, lines, prefix = " ") {
|
|
|
256
253
|
lines.push(`${detailPrefix}with: ${formatInputBindingsList(inputBindings)}`);
|
|
257
254
|
}
|
|
258
255
|
if (via === "child") {
|
|
259
|
-
const childOutputs = Array.isArray(expansion.childOutputs) ? expansion.childOutputs : [];
|
|
260
|
-
if (childOutputs.length > 0) {
|
|
261
|
-
lines.push(`${detailPrefix}exports: ${childOutputs.map(String).join(", ")}`);
|
|
262
|
-
}
|
|
263
256
|
const childSteps = Array.isArray(expansion.steps) ? expansion.steps : [];
|
|
264
257
|
for (const [index, childStep] of childSteps.entries()) {
|
|
265
258
|
renderPlanStepLines(childStep, index + 1, lines, `${prefix} ${ordinal}.`);
|
|
@@ -304,17 +297,6 @@ export function formatWorkflowPlanPlain(result) {
|
|
|
304
297
|
const params = Array.isArray(result.params) ? result.params : undefined;
|
|
305
298
|
if (params && params.length > 0)
|
|
306
299
|
lines.push(`params: ${params.join(", ")}`);
|
|
307
|
-
const outputs = typeof result.outputs === "object" && result.outputs !== null
|
|
308
|
-
? result.outputs
|
|
309
|
-
: undefined;
|
|
310
|
-
if (outputs) {
|
|
311
|
-
for (const [name, declaration] of Object.entries(outputs)) {
|
|
312
|
-
const from = typeof declaration === "object" && declaration !== null
|
|
313
|
-
? String(declaration.from ?? "")
|
|
314
|
-
: "";
|
|
315
|
-
lines.push(`outputs: ${name} <- ${from}`);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
300
|
const steps = Array.isArray(result.steps) ? result.steps : [];
|
|
319
301
|
lines.push("steps:");
|
|
320
302
|
for (const [index, step] of steps.entries()) {
|