@canonical/pragma-cli 0.34.0 → 0.35.0
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/README.md +153 -30
- package/dist/.build-ok +0 -0
- package/dist/package.json +83 -0
- package/dist/pragma.conf.js +814 -0
- package/dist/pragma.conf.js.map +1 -0
- package/dist/src/bin.js +356 -0
- package/dist/src/bin.js.map +1 -0
- package/dist/src/capabilities/capabilities/capabilities.render.js +70 -0
- package/dist/src/capabilities/capabilities/capabilities.render.js.map +1 -0
- package/dist/src/capabilities/capabilities/capabilities.verb.js +59 -0
- package/dist/src/capabilities/capabilities/capabilities.verb.js.map +1 -0
- package/dist/src/capabilities/capabilities/catalog.js +130 -0
- package/dist/src/capabilities/capabilities/catalog.js.map +1 -0
- package/dist/src/capabilities/capabilities/hints.js +195 -0
- package/dist/src/capabilities/capabilities/hints.js.map +1 -0
- package/dist/src/capabilities/capabilities/index.js +11 -0
- package/dist/src/capabilities/capabilities/index.js.map +1 -0
- package/dist/src/capabilities/capabilities/types.js +11 -0
- package/dist/src/capabilities/capabilities/types.js.map +1 -0
- package/dist/src/capabilities/colophon/collectColophon.js +83 -0
- package/dist/src/capabilities/colophon/collectColophon.js.map +1 -0
- package/dist/src/capabilities/colophon/colophon.render.js +59 -0
- package/dist/src/capabilities/colophon/colophon.render.js.map +1 -0
- package/dist/src/capabilities/colophon/colophon.verb.js +43 -0
- package/dist/src/capabilities/colophon/colophon.verb.js.map +1 -0
- package/dist/src/capabilities/colophon/index.js +5 -0
- package/dist/src/capabilities/colophon/index.js.map +1 -0
- package/dist/src/capabilities/colophon/markdownTerminal.js +90 -0
- package/dist/src/capabilities/colophon/markdownTerminal.js.map +1 -0
- package/dist/src/capabilities/colophon/types.js +10 -0
- package/dist/src/capabilities/colophon/types.js.map +1 -0
- package/dist/src/capabilities/config/collectConfigShow.js +59 -0
- package/dist/src/capabilities/config/collectConfigShow.js.map +1 -0
- package/dist/src/capabilities/config/field.render.js +22 -0
- package/dist/src/capabilities/config/field.render.js.map +1 -0
- package/dist/src/capabilities/config/fields.js +46 -0
- package/dist/src/capabilities/config/fields.js.map +1 -0
- package/dist/src/capabilities/config/get.verb.js +61 -0
- package/dist/src/capabilities/config/get.verb.js.map +1 -0
- package/dist/src/capabilities/config/index.js +5 -0
- package/dist/src/capabilities/config/index.js.map +1 -0
- package/dist/src/capabilities/config/runField.js +59 -0
- package/dist/src/capabilities/config/runField.js.map +1 -0
- package/dist/src/capabilities/config/runGet.js +28 -0
- package/dist/src/capabilities/config/runGet.js.map +1 -0
- package/dist/src/capabilities/config/runSet.js +53 -0
- package/dist/src/capabilities/config/runSet.js.map +1 -0
- package/dist/src/capabilities/config/set.verb.js +66 -0
- package/dist/src/capabilities/config/set.verb.js.map +1 -0
- package/dist/src/capabilities/config/show.render.js +84 -0
- package/dist/src/capabilities/config/show.render.js.map +1 -0
- package/dist/src/capabilities/config/show.verb.js +44 -0
- package/dist/src/capabilities/config/show.verb.js.map +1 -0
- package/dist/src/capabilities/config/types.js +5 -0
- package/dist/src/capabilities/config/types.js.map +1 -0
- package/dist/src/capabilities/config/unset.verb.js +49 -0
- package/dist/src/capabilities/config/unset.verb.js.map +1 -0
- package/dist/src/capabilities/create/cliProjection.js +195 -0
- package/dist/src/capabilities/create/cliProjection.js.map +1 -0
- package/dist/src/capabilities/create/constants.js +47 -0
- package/dist/src/capabilities/create/constants.js.map +1 -0
- package/dist/src/capabilities/create/create.render.js +100 -0
- package/dist/src/capabilities/create/create.render.js.map +1 -0
- package/dist/src/capabilities/create/create.verb.js +438 -0
- package/dist/src/capabilities/create/create.verb.js.map +1 -0
- package/dist/src/capabilities/create/createHelp.js +47 -0
- package/dist/src/capabilities/create/createHelp.js.map +1 -0
- package/dist/src/capabilities/create/createSurface.generated.js +394 -0
- package/dist/src/capabilities/create/createSurface.generated.js.map +1 -0
- package/dist/src/capabilities/create/generatorToVerbSpec.js +106 -0
- package/dist/src/capabilities/create/generatorToVerbSpec.js.map +1 -0
- package/dist/src/capabilities/create/index.js +18 -0
- package/dist/src/capabilities/create/index.js.map +1 -0
- package/dist/src/capabilities/create/messages.js +16 -0
- package/dist/src/capabilities/create/messages.js.map +1 -0
- package/dist/src/capabilities/create/mount.js +293 -0
- package/dist/src/capabilities/create/mount.js.map +1 -0
- package/dist/src/capabilities/create/pathJail.js +65 -0
- package/dist/src/capabilities/create/pathJail.js.map +1 -0
- package/dist/src/capabilities/create/pickGenerator.js +53 -0
- package/dist/src/capabilities/create/pickGenerator.js.map +1 -0
- package/dist/src/capabilities/create/types.js +2 -0
- package/dist/src/capabilities/create/types.js.map +1 -0
- package/dist/src/capabilities/distribution.js +40 -0
- package/dist/src/capabilities/distribution.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkKeStore.js +40 -0
- package/dist/src/capabilities/doctor/checks/checkKeStore.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkNodeVersion.js +21 -0
- package/dist/src/capabilities/doctor/checks/checkNodeVersion.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkPackageRefs.js +92 -0
- package/dist/src/capabilities/doctor/checks/checkPackageRefs.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkPragmaVersion.js +19 -0
- package/dist/src/capabilities/doctor/checks/checkPragmaVersion.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/checkShellCompletions.js +199 -0
- package/dist/src/capabilities/doctor/checks/checkShellCompletions.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/index.js +27 -0
- package/dist/src/capabilities/doctor/checks/index.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/mcpCommand.js +57 -0
- package/dist/src/capabilities/doctor/checks/mcpCommand.js.map +1 -0
- package/dist/src/capabilities/doctor/checks/targetHealth.js +205 -0
- package/dist/src/capabilities/doctor/checks/targetHealth.js.map +1 -0
- package/dist/src/capabilities/doctor/doctor.render.js +185 -0
- package/dist/src/capabilities/doctor/doctor.render.js.map +1 -0
- package/dist/src/capabilities/doctor/doctor.verb.js +45 -0
- package/dist/src/capabilities/doctor/doctor.verb.js.map +1 -0
- package/dist/src/capabilities/doctor/index.js +5 -0
- package/dist/src/capabilities/doctor/index.js.map +1 -0
- package/dist/src/capabilities/doctor/runChecks.js +83 -0
- package/dist/src/capabilities/doctor/runChecks.js.map +1 -0
- package/dist/src/capabilities/doctor/types.js +5 -0
- package/dist/src/capabilities/doctor/types.js.map +1 -0
- package/dist/src/capabilities/graph/index.js +19 -0
- package/dist/src/capabilities/graph/index.js.map +1 -0
- package/dist/src/capabilities/graph/inspect.render.js +76 -0
- package/dist/src/capabilities/graph/inspect.render.js.map +1 -0
- package/dist/src/capabilities/graph/inspect.verb.js +53 -0
- package/dist/src/capabilities/graph/inspect.verb.js.map +1 -0
- package/dist/src/capabilities/graph/query.render.js +73 -0
- package/dist/src/capabilities/graph/query.render.js.map +1 -0
- package/dist/src/capabilities/graph/query.verb.js +49 -0
- package/dist/src/capabilities/graph/query.verb.js.map +1 -0
- package/dist/src/capabilities/graph/runQuery.js +41 -0
- package/dist/src/capabilities/graph/runQuery.js.map +1 -0
- package/dist/src/capabilities/index.js +56 -0
- package/dist/src/capabilities/index.js.map +1 -0
- package/dist/src/capabilities/info/collectInfo.js +66 -0
- package/dist/src/capabilities/info/collectInfo.js.map +1 -0
- package/dist/src/capabilities/info/index.js +5 -0
- package/dist/src/capabilities/info/index.js.map +1 -0
- package/dist/src/capabilities/info/info.render.js +53 -0
- package/dist/src/capabilities/info/info.render.js.map +1 -0
- package/dist/src/capabilities/info/info.verb.js +42 -0
- package/dist/src/capabilities/info/info.verb.js.map +1 -0
- package/dist/src/capabilities/info/types.js +5 -0
- package/dist/src/capabilities/info/types.js.map +1 -0
- package/dist/src/capabilities/meta/complete.verb.js +43 -0
- package/dist/src/capabilities/meta/complete.verb.js.map +1 -0
- package/dist/src/capabilities/meta/index.js +13 -0
- package/dist/src/capabilities/meta/index.js.map +1 -0
- package/dist/src/capabilities/meta/mcp.verb.js +34 -0
- package/dist/src/capabilities/meta/mcp.verb.js.map +1 -0
- package/dist/src/capabilities/ontology/index.js +21 -0
- package/dist/src/capabilities/ontology/index.js.map +1 -0
- package/dist/src/capabilities/ontology/queries.js +123 -0
- package/dist/src/capabilities/ontology/queries.js.map +1 -0
- package/dist/src/capabilities/ontology/render.js +66 -0
- package/dist/src/capabilities/ontology/render.js.map +1 -0
- package/dist/src/capabilities/ontology/verbs.js +181 -0
- package/dist/src/capabilities/ontology/verbs.js.map +1 -0
- package/dist/src/capabilities/prompt/index.js +16 -0
- package/dist/src/capabilities/prompt/index.js.map +1 -0
- package/dist/src/capabilities/prompt/prompt.render.js +78 -0
- package/dist/src/capabilities/prompt/prompt.render.js.map +1 -0
- package/dist/src/capabilities/prompt/types.js +10 -0
- package/dist/src/capabilities/prompt/types.js.map +1 -0
- package/dist/src/capabilities/prompt/verbs.js +93 -0
- package/dist/src/capabilities/prompt/verbs.js.map +1 -0
- package/dist/src/capabilities/resources/index.js +10 -0
- package/dist/src/capabilities/resources/index.js.map +1 -0
- package/dist/src/capabilities/resources/provider.js +423 -0
- package/dist/src/capabilities/resources/provider.js.map +1 -0
- package/dist/src/capabilities/setup/buildPlan.js +168 -0
- package/dist/src/capabilities/setup/buildPlan.js.map +1 -0
- package/dist/src/capabilities/setup/index.js +5 -0
- package/dist/src/capabilities/setup/index.js.map +1 -0
- package/dist/src/capabilities/setup/mode.js +53 -0
- package/dist/src/capabilities/setup/mode.js.map +1 -0
- package/dist/src/capabilities/setup/operations/index.js +39 -0
- package/dist/src/capabilities/setup/operations/index.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupCompletions.js +160 -0
- package/dist/src/capabilities/setup/operations/setupCompletions.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupConfig.js +101 -0
- package/dist/src/capabilities/setup/operations/setupConfig.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupGenerator.js +343 -0
- package/dist/src/capabilities/setup/operations/setupGenerator.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupLsp.js +277 -0
- package/dist/src/capabilities/setup/operations/setupLsp.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupMcp.js +207 -0
- package/dist/src/capabilities/setup/operations/setupMcp.js.map +1 -0
- package/dist/src/capabilities/setup/operations/setupSkills.js +316 -0
- package/dist/src/capabilities/setup/operations/setupSkills.js.map +1 -0
- package/dist/src/capabilities/setup/plan.js +128 -0
- package/dist/src/capabilities/setup/plan.js.map +1 -0
- package/dist/src/capabilities/setup/plan.render.js +193 -0
- package/dist/src/capabilities/setup/plan.render.js.map +1 -0
- package/dist/src/capabilities/setup/setup.render.js +54 -0
- package/dist/src/capabilities/setup/setup.render.js.map +1 -0
- package/dist/src/capabilities/setup/setup.verb.js +334 -0
- package/dist/src/capabilities/setup/setup.verb.js.map +1 -0
- package/dist/src/capabilities/setup/shell.js +196 -0
- package/dist/src/capabilities/setup/shell.js.map +1 -0
- package/dist/src/capabilities/setup/targets.js +263 -0
- package/dist/src/capabilities/setup/targets.js.map +1 -0
- package/dist/src/capabilities/setup/types.js +5 -0
- package/dist/src/capabilities/setup/types.js.map +1 -0
- package/dist/src/capabilities/shared/assertExecOk.js +137 -0
- package/dist/src/capabilities/shared/assertExecOk.js.map +1 -0
- package/dist/src/capabilities/shared/bands.js +16 -0
- package/dist/src/capabilities/shared/bands.js.map +1 -0
- package/dist/src/capabilities/shared/index.js +26 -0
- package/dist/src/capabilities/shared/index.js.map +1 -0
- package/dist/src/capabilities/shared/packageManager.js +103 -0
- package/dist/src/capabilities/shared/packageManager.js.map +1 -0
- package/dist/src/capabilities/shared/registry.js +55 -0
- package/dist/src/capabilities/shared/registry.js.map +1 -0
- package/dist/src/capabilities/skill/discover.js +195 -0
- package/dist/src/capabilities/skill/discover.js.map +1 -0
- package/dist/src/capabilities/skill/index.js +10 -0
- package/dist/src/capabilities/skill/index.js.map +1 -0
- package/dist/src/capabilities/skill/render.js +49 -0
- package/dist/src/capabilities/skill/render.js.map +1 -0
- package/dist/src/capabilities/skill/verbs.js +83 -0
- package/dist/src/capabilities/skill/verbs.js.map +1 -0
- package/dist/src/capabilities/sources/collectStatus.js +103 -0
- package/dist/src/capabilities/sources/collectStatus.js.map +1 -0
- package/dist/src/capabilities/sources/index.js +13 -0
- package/dist/src/capabilities/sources/index.js.map +1 -0
- package/dist/src/capabilities/sources/installSkills.js +167 -0
- package/dist/src/capabilities/sources/installSkills.js.map +1 -0
- package/dist/src/capabilities/sources/runUpdate.js +394 -0
- package/dist/src/capabilities/sources/runUpdate.js.map +1 -0
- package/dist/src/capabilities/sources/status.render.js +64 -0
- package/dist/src/capabilities/sources/status.render.js.map +1 -0
- package/dist/src/capabilities/sources/status.verb.js +40 -0
- package/dist/src/capabilities/sources/status.verb.js.map +1 -0
- package/dist/src/capabilities/sources/types.js +6 -0
- package/dist/src/capabilities/sources/types.js.map +1 -0
- package/dist/src/capabilities/sources/update.render.js +34 -0
- package/dist/src/capabilities/sources/update.render.js.map +1 -0
- package/dist/src/capabilities/sources/update.verb.js +55 -0
- package/dist/src/capabilities/sources/update.verb.js.map +1 -0
- package/dist/src/capabilities/upgrade/index.js +5 -0
- package/dist/src/capabilities/upgrade/index.js.map +1 -0
- package/dist/src/capabilities/upgrade/runUpgrade.js +99 -0
- package/dist/src/capabilities/upgrade/runUpgrade.js.map +1 -0
- package/dist/src/capabilities/upgrade/types.js +5 -0
- package/dist/src/capabilities/upgrade/types.js.map +1 -0
- package/dist/src/capabilities/upgrade/upgrade.render.js +44 -0
- package/dist/src/capabilities/upgrade/upgrade.render.js.map +1 -0
- package/dist/src/capabilities/upgrade/upgrade.verb.js +52 -0
- package/dist/src/capabilities/upgrade/upgrade.verb.js.map +1 -0
- package/dist/src/capabilities/version/index.js +10 -0
- package/dist/src/capabilities/version/index.js.map +1 -0
- package/dist/src/capabilities/version/version.verb.js +36 -0
- package/dist/src/capabilities/version/version.verb.js.map +1 -0
- package/dist/src/constants.js +82 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/index.js +12 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/kernel/completion/complete.js +66 -0
- package/dist/src/kernel/completion/complete.js.map +1 -0
- package/dist/src/kernel/completion/emitScripts.js +92 -0
- package/dist/src/kernel/completion/emitScripts.js.map +1 -0
- package/dist/src/kernel/completion/entitySource.js +285 -0
- package/dist/src/kernel/completion/entitySource.js.map +1 -0
- package/dist/src/kernel/completion/index.js +14 -0
- package/dist/src/kernel/completion/index.js.map +1 -0
- package/dist/src/kernel/completion/model.js +301 -0
- package/dist/src/kernel/completion/model.js.map +1 -0
- package/dist/src/kernel/completion/parse.js +253 -0
- package/dist/src/kernel/completion/parse.js.map +1 -0
- package/dist/src/kernel/completion/rank.js +101 -0
- package/dist/src/kernel/completion/rank.js.map +1 -0
- package/dist/src/kernel/completion/resolve.js +100 -0
- package/dist/src/kernel/completion/resolve.js.map +1 -0
- package/dist/src/kernel/completion/templates/bash.js +209 -0
- package/dist/src/kernel/completion/templates/bash.js.map +1 -0
- package/dist/src/kernel/completion/templates/fish.js +214 -0
- package/dist/src/kernel/completion/templates/fish.js.map +1 -0
- package/dist/src/kernel/completion/templates/index.js +23 -0
- package/dist/src/kernel/completion/templates/index.js.map +1 -0
- package/dist/src/kernel/completion/templates/shared.js +98 -0
- package/dist/src/kernel/completion/templates/shared.js.map +1 -0
- package/dist/src/kernel/completion/templates/zsh.js +201 -0
- package/dist/src/kernel/completion/templates/zsh.js.map +1 -0
- package/dist/src/kernel/completion/types.js +13 -0
- package/dist/src/kernel/completion/types.js.map +1 -0
- package/dist/src/kernel/config/defaults.js +17 -0
- package/dist/src/kernel/config/defaults.js.map +1 -0
- package/dist/src/kernel/config/evaluateProjectConfig.js +126 -0
- package/dist/src/kernel/config/evaluateProjectConfig.js.map +1 -0
- package/dist/src/kernel/config/findProjectConfig.js +43 -0
- package/dist/src/kernel/config/findProjectConfig.js.map +1 -0
- package/dist/src/kernel/config/firstRun.js +34 -0
- package/dist/src/kernel/config/firstRun.js.map +1 -0
- package/dist/src/kernel/config/globalConfig.js +79 -0
- package/dist/src/kernel/config/globalConfig.js.map +1 -0
- package/dist/src/kernel/config/index.js +16 -0
- package/dist/src/kernel/config/index.js.map +1 -0
- package/dist/src/kernel/config/paths.js +35 -0
- package/dist/src/kernel/config/paths.js.map +1 -0
- package/dist/src/kernel/config/readConfig.js +78 -0
- package/dist/src/kernel/config/readConfig.js.map +1 -0
- package/dist/src/kernel/config/schema.js +130 -0
- package/dist/src/kernel/config/schema.js.map +1 -0
- package/dist/src/kernel/config/types.js +19 -0
- package/dist/src/kernel/config/types.js.map +1 -0
- package/dist/src/kernel/config/writeConfigField.js +59 -0
- package/dist/src/kernel/config/writeConfigField.js.map +1 -0
- package/dist/src/kernel/copy.js +43 -0
- package/dist/src/kernel/copy.js.map +1 -0
- package/dist/src/kernel/error/PragmaError.js +149 -0
- package/dist/src/kernel/error/PragmaError.js.map +1 -0
- package/dist/src/kernel/error/constants.js +40 -0
- package/dist/src/kernel/error/constants.js.map +1 -0
- package/dist/src/kernel/error/fromTaskError.js +96 -0
- package/dist/src/kernel/error/fromTaskError.js.map +1 -0
- package/dist/src/kernel/error/index.js +13 -0
- package/dist/src/kernel/error/index.js.map +1 -0
- package/dist/src/kernel/error/recovery.js +52 -0
- package/dist/src/kernel/error/recovery.js.map +1 -0
- package/dist/src/kernel/error/renderError.js +115 -0
- package/dist/src/kernel/error/renderError.js.map +1 -0
- package/dist/src/kernel/error/serialize.js +25 -0
- package/dist/src/kernel/error/serialize.js.map +1 -0
- package/dist/src/kernel/error/types.js +9 -0
- package/dist/src/kernel/error/types.js.map +1 -0
- package/dist/src/kernel/index.js +25 -0
- package/dist/src/kernel/index.js.map +1 -0
- package/dist/src/kernel/packs/collect.js +187 -0
- package/dist/src/kernel/packs/collect.js.map +1 -0
- package/dist/src/kernel/packs/compile.js +304 -0
- package/dist/src/kernel/packs/compile.js.map +1 -0
- package/dist/src/kernel/packs/disclosure.js +76 -0
- package/dist/src/kernel/packs/disclosure.js.map +1 -0
- package/dist/src/kernel/packs/glob.js +38 -0
- package/dist/src/kernel/packs/glob.js.map +1 -0
- package/dist/src/kernel/packs/graphql/buildLookupDocument.js +258 -0
- package/dist/src/kernel/packs/graphql/buildLookupDocument.js.map +1 -0
- package/dist/src/kernel/packs/graphql/fetchGraphqlLookup.js +157 -0
- package/dist/src/kernel/packs/graphql/fetchGraphqlLookup.js.map +1 -0
- package/dist/src/kernel/packs/graphql/index.js +20 -0
- package/dist/src/kernel/packs/graphql/index.js.map +1 -0
- package/dist/src/kernel/packs/graphql/nameMap.js +63 -0
- package/dist/src/kernel/packs/graphql/nameMap.js.map +1 -0
- package/dist/src/kernel/packs/index.js +34 -0
- package/dist/src/kernel/packs/index.js.map +1 -0
- package/dist/src/kernel/packs/iri.js +110 -0
- package/dist/src/kernel/packs/iri.js.map +1 -0
- package/dist/src/kernel/packs/renderPack.js +129 -0
- package/dist/src/kernel/packs/renderPack.js.map +1 -0
- package/dist/src/kernel/packs/resolveEntity.js +223 -0
- package/dist/src/kernel/packs/resolveEntity.js.map +1 -0
- package/dist/src/kernel/packs/runBodies.js +87 -0
- package/dist/src/kernel/packs/runBodies.js.map +1 -0
- package/dist/src/kernel/packs/sample.js +56 -0
- package/dist/src/kernel/packs/sample.js.map +1 -0
- package/dist/src/kernel/packs/schema.js +369 -0
- package/dist/src/kernel/packs/schema.js.map +1 -0
- package/dist/src/kernel/packs/sparql/applyFilters.js +68 -0
- package/dist/src/kernel/packs/sparql/applyFilters.js.map +1 -0
- package/dist/src/kernel/packs/sparql/applySearch.js +25 -0
- package/dist/src/kernel/packs/sparql/applySearch.js.map +1 -0
- package/dist/src/kernel/packs/sparql/buildLookupQuery.js +217 -0
- package/dist/src/kernel/packs/sparql/buildLookupQuery.js.map +1 -0
- package/dist/src/kernel/packs/sparql/escape.js +21 -0
- package/dist/src/kernel/packs/sparql/escape.js.map +1 -0
- package/dist/src/kernel/packs/sparql/index.js +31 -0
- package/dist/src/kernel/packs/sparql/index.js.map +1 -0
- package/dist/src/kernel/packs/sparql/runSelect.js +101 -0
- package/dist/src/kernel/packs/sparql/runSelect.js.map +1 -0
- package/dist/src/kernel/packs/types.js +30 -0
- package/dist/src/kernel/packs/types.js.map +1 -0
- package/dist/src/kernel/packs/uniqueness.js +30 -0
- package/dist/src/kernel/packs/uniqueness.js.map +1 -0
- package/dist/src/kernel/project/cli/buildProgram.js +263 -0
- package/dist/src/kernel/project/cli/buildProgram.js.map +1 -0
- package/dist/src/kernel/project/cli/constants.js +27 -0
- package/dist/src/kernel/project/cli/constants.js.map +1 -0
- package/dist/src/kernel/project/cli/dispatch.js +420 -0
- package/dist/src/kernel/project/cli/dispatch.js.map +1 -0
- package/dist/src/kernel/project/cli/exitCodes.js +66 -0
- package/dist/src/kernel/project/cli/exitCodes.js.map +1 -0
- package/dist/src/kernel/project/cli/globalFlags.js +216 -0
- package/dist/src/kernel/project/cli/globalFlags.js.map +1 -0
- package/dist/src/kernel/project/cli/helpFormat.js +59 -0
- package/dist/src/kernel/project/cli/helpFormat.js.map +1 -0
- package/dist/src/kernel/project/cli/index.js +14 -0
- package/dist/src/kernel/project/cli/index.js.map +1 -0
- package/dist/src/kernel/project/cli/rootHelp.js +197 -0
- package/dist/src/kernel/project/cli/rootHelp.js.map +1 -0
- package/dist/src/kernel/project/cli/suggest.js +75 -0
- package/dist/src/kernel/project/cli/suggest.js.map +1 -0
- package/dist/src/kernel/project/cli/suggestNames.js +96 -0
- package/dist/src/kernel/project/cli/suggestNames.js.map +1 -0
- package/dist/src/kernel/project/cli/verbHelp.js +131 -0
- package/dist/src/kernel/project/cli/verbHelp.js.map +1 -0
- package/dist/src/kernel/project/mcp/buildServer.js +67 -0
- package/dist/src/kernel/project/mcp/buildServer.js.map +1 -0
- package/dist/src/kernel/project/mcp/envelope.js +37 -0
- package/dist/src/kernel/project/mcp/envelope.js.map +1 -0
- package/dist/src/kernel/project/mcp/index.js +8 -0
- package/dist/src/kernel/project/mcp/index.js.map +1 -0
- package/dist/src/kernel/project/mcp/instructions.js +44 -0
- package/dist/src/kernel/project/mcp/instructions.js.map +1 -0
- package/dist/src/kernel/project/mcp/mcpError.js +42 -0
- package/dist/src/kernel/project/mcp/mcpError.js.map +1 -0
- package/dist/src/kernel/project/mcp/prompts/index.js +36 -0
- package/dist/src/kernel/project/mcp/prompts/index.js.map +1 -0
- package/dist/src/kernel/project/mcp/prompts/provider.js +98 -0
- package/dist/src/kernel/project/mcp/prompts/provider.js.map +1 -0
- package/dist/src/kernel/project/mcp/prompts/source.js +154 -0
- package/dist/src/kernel/project/mcp/prompts/source.js.map +1 -0
- package/dist/src/kernel/project/mcp/registerVerb.js +300 -0
- package/dist/src/kernel/project/mcp/registerVerb.js.map +1 -0
- package/dist/src/kernel/project/mcp/serve.js +35 -0
- package/dist/src/kernel/project/mcp/serve.js.map +1 -0
- package/dist/src/kernel/render/compactUri.js +24 -0
- package/dist/src/kernel/render/compactUri.js.map +1 -0
- package/dist/src/kernel/render/contracts.js +10 -0
- package/dist/src/kernel/render/contracts.js.map +1 -0
- package/dist/src/kernel/render/disclosure.js +34 -0
- package/dist/src/kernel/render/disclosure.js.map +1 -0
- package/dist/src/kernel/render/envelope.js +30 -0
- package/dist/src/kernel/render/envelope.js.map +1 -0
- package/dist/src/kernel/render/formatters.js +27 -0
- package/dist/src/kernel/render/formatters.js.map +1 -0
- package/dist/src/kernel/render/index.js +15 -0
- package/dist/src/kernel/render/index.js.map +1 -0
- package/dist/src/kernel/render/prefixes.js +46 -0
- package/dist/src/kernel/render/prefixes.js.map +1 -0
- package/dist/src/kernel/render/renderers.js +468 -0
- package/dist/src/kernel/render/renderers.js.map +1 -0
- package/dist/src/kernel/render/style.js +85 -0
- package/dist/src/kernel/render/style.js.map +1 -0
- package/dist/src/kernel/render/turtle.js +194 -0
- package/dist/src/kernel/render/turtle.js.map +1 -0
- package/dist/src/kernel/render/writeStdout.js +43 -0
- package/dist/src/kernel/render/writeStdout.js.map +1 -0
- package/dist/src/kernel/runtime/boot.js +49 -0
- package/dist/src/kernel/runtime/boot.js.map +1 -0
- package/dist/src/kernel/runtime/facade.js +39 -0
- package/dist/src/kernel/runtime/facade.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/build.js +122 -0
- package/dist/src/kernel/runtime/graphpack/build.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/buildIndex.js +303 -0
- package/dist/src/kernel/runtime/graphpack/buildIndex.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/embedded/pack.generated.js +6 -0
- package/dist/src/kernel/runtime/graphpack/embedded/pack.generated.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/embedded/pack.index.generated.js +4 -0
- package/dist/src/kernel/runtime/graphpack/embedded/pack.index.generated.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/embedded/pack.stories.generated.js +4 -0
- package/dist/src/kernel/runtime/graphpack/embedded/pack.stories.generated.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/embedded.js +82 -0
- package/dist/src/kernel/runtime/graphpack/embedded.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/hash.js +38 -0
- package/dist/src/kernel/runtime/graphpack/hash.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/index.js +11 -0
- package/dist/src/kernel/runtime/graphpack/index.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/manifest.js +145 -0
- package/dist/src/kernel/runtime/graphpack/manifest.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/read.js +92 -0
- package/dist/src/kernel/runtime/graphpack/read.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/schemas.js +70 -0
- package/dist/src/kernel/runtime/graphpack/schemas.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/stories.js +68 -0
- package/dist/src/kernel/runtime/graphpack/stories.js.map +1 -0
- package/dist/src/kernel/runtime/graphpack/types.js +55 -0
- package/dist/src/kernel/runtime/graphpack/types.js.map +1 -0
- package/dist/src/kernel/runtime/index.js +8 -0
- package/dist/src/kernel/runtime/index.js.map +1 -0
- package/dist/src/kernel/runtime/loadSession.js +34 -0
- package/dist/src/kernel/runtime/loadSession.js.map +1 -0
- package/dist/src/kernel/runtime/paths.js +78 -0
- package/dist/src/kernel/runtime/paths.js.map +1 -0
- package/dist/src/kernel/runtime/probe.js +37 -0
- package/dist/src/kernel/runtime/probe.js.map +1 -0
- package/dist/src/kernel/runtime/readEntity.js +363 -0
- package/dist/src/kernel/runtime/readEntity.js.map +1 -0
- package/dist/src/kernel/runtime/refs/gitOps.js +65 -0
- package/dist/src/kernel/runtime/refs/gitOps.js.map +1 -0
- package/dist/src/kernel/runtime/refs/index.js +29 -0
- package/dist/src/kernel/runtime/refs/index.js.map +1 -0
- package/dist/src/kernel/runtime/refs/parseRef.js +70 -0
- package/dist/src/kernel/runtime/refs/parseRef.js.map +1 -0
- package/dist/src/kernel/runtime/refs/resolve.js +332 -0
- package/dist/src/kernel/runtime/refs/resolve.js.map +1 -0
- package/dist/src/kernel/runtime/resolveSources.js +62 -0
- package/dist/src/kernel/runtime/resolveSources.js.map +1 -0
- package/dist/src/kernel/runtime/store.js +75 -0
- package/dist/src/kernel/runtime/store.js.map +1 -0
- package/dist/src/kernel/runtime/storeReadiness.js +51 -0
- package/dist/src/kernel/runtime/storeReadiness.js.map +1 -0
- package/dist/src/kernel/runtime/types.js +11 -0
- package/dist/src/kernel/runtime/types.js.map +1 -0
- package/dist/src/kernel/spec/asVerb.js +21 -0
- package/dist/src/kernel/spec/asVerb.js.map +1 -0
- package/dist/src/kernel/spec/emitReference.js +578 -0
- package/dist/src/kernel/spec/emitReference.js.map +1 -0
- package/dist/src/kernel/spec/emitSurface.js +202 -0
- package/dist/src/kernel/spec/emitSurface.js.map +1 -0
- package/dist/src/kernel/spec/index.js +11 -0
- package/dist/src/kernel/spec/index.js.map +1 -0
- package/dist/src/kernel/spec/surfaceConformance.js +103 -0
- package/dist/src/kernel/spec/surfaceConformance.js.map +1 -0
- package/dist/src/kernel/spec/types.js +14 -0
- package/dist/src/kernel/spec/types.js.map +1 -0
- package/dist/src/kernel/spec/validate.js +110 -0
- package/dist/src/kernel/spec/validate.js.map +1 -0
- package/dist/src/kernel/vocabulary.js +97 -0
- package/dist/src/kernel/vocabulary.js.map +1 -0
- package/dist/src/types.js +11 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +20 -22
- package/pragma.conf.ts +249 -60
- package/src/bin.ts +267 -82
- package/src/capabilities/block.parity.test.ts +6 -3
- package/src/capabilities/capabilities/capabilities.render.ts +1 -1
- package/src/capabilities/capabilities/capabilities.verb.ts +1 -1
- package/src/capabilities/capabilities/catalog.ts +3 -3
- package/src/capabilities/capabilities/hints.ts +32 -7
- package/src/capabilities/capabilities/index.ts +1 -1
- package/src/capabilities/colophon/collectColophon.ts +35 -24
- package/src/capabilities/colophon/colophon.render.ts +25 -1
- package/src/capabilities/colophon/colophon.test.ts +42 -21
- package/src/capabilities/colophon/colophon.verb.ts +4 -4
- package/src/capabilities/config/collectConfigShow.test.ts +1 -0
- package/src/capabilities/config/collectConfigShow.ts +3 -3
- package/src/capabilities/config/field.render.ts +4 -5
- package/src/capabilities/config/fields.ts +17 -10
- package/src/capabilities/config/get.verb.ts +70 -0
- package/src/capabilities/config/getUnset.test.ts +264 -0
- package/src/capabilities/config/index.ts +5 -1
- package/src/capabilities/config/runField.ts +40 -22
- package/src/capabilities/config/runGet.ts +34 -0
- package/src/capabilities/config/runSet.ts +35 -9
- package/src/capabilities/config/set.test.ts +48 -14
- package/src/capabilities/config/set.verb.ts +8 -7
- package/src/capabilities/config/show.render.ts +1 -1
- package/src/capabilities/config/show.verb.ts +9 -6
- package/src/capabilities/config/types.ts +18 -4
- package/src/capabilities/config/unset.verb.ts +58 -0
- package/src/capabilities/create/byteEquality.subprocess.test.ts +2 -3
- package/src/capabilities/create/byteEquality.test.ts +25 -11
- package/src/capabilities/create/cliProjection.ts +227 -0
- package/src/capabilities/create/constants.ts +36 -61
- package/src/capabilities/create/create.mcp.test.ts +89 -5
- package/src/capabilities/create/create.render.ts +71 -7
- package/src/capabilities/create/create.test.ts +433 -219
- package/src/capabilities/create/create.verb.ts +297 -328
- package/src/capabilities/create/createGrammar.test.ts +865 -0
- package/src/capabilities/create/createHelp.ts +71 -0
- package/src/capabilities/create/createSurface.generated.ts +400 -0
- package/src/capabilities/create/crossCli.subprocess.test.ts +745 -0
- package/src/capabilities/create/cwdJail.test.ts +24 -5
- package/src/capabilities/create/generatorToVerbSpec.test.ts +186 -0
- package/src/capabilities/create/generatorToVerbSpec.ts +13 -11
- package/src/capabilities/create/index.ts +7 -4
- package/src/capabilities/create/messages.ts +18 -0
- package/src/capabilities/create/mount.ts +391 -0
- package/src/capabilities/create/pathJail.test.ts +90 -0
- package/src/capabilities/create/pathJail.ts +8 -5
- package/src/capabilities/create/pickGenerator.ts +23 -35
- package/src/capabilities/create/shippedCreate.subprocess.test.ts +164 -0
- package/src/capabilities/create/types.ts +20 -0
- package/src/capabilities/distribution.test.ts +3 -1
- package/src/capabilities/distribution.ts +10 -15
- package/src/capabilities/doctor/checks/checkKeStore.ts +7 -5
- package/src/capabilities/doctor/checks/checkPackageRefs.ts +6 -4
- package/src/capabilities/doctor/checks/checkPragmaVersion.ts +2 -2
- package/src/capabilities/doctor/checks/checkShellCompletions.test.ts +72 -27
- package/src/capabilities/doctor/checks/checkShellCompletions.ts +59 -13
- package/src/capabilities/doctor/checks/index.ts +27 -0
- package/src/capabilities/doctor/checks/mcpCommand.test.ts +100 -0
- package/src/capabilities/doctor/checks/mcpCommand.ts +69 -0
- package/src/capabilities/doctor/checks/targetHealth.ts +274 -0
- package/src/capabilities/doctor/doctor.render.test.ts +18 -7
- package/src/capabilities/doctor/doctor.render.ts +43 -19
- package/src/capabilities/doctor/doctor.test.ts +123 -34
- package/src/capabilities/doctor/doctor.verb.ts +3 -3
- package/src/capabilities/doctor/runChecks.ts +62 -63
- package/src/capabilities/doctor/types.ts +20 -4
- package/src/capabilities/emptyRecovery.test.ts +13 -8
- package/src/capabilities/graph/examples.exec.test.ts +107 -0
- package/src/capabilities/graph/index.ts +1 -1
- package/src/capabilities/graph/inspect.render.ts +70 -22
- package/src/capabilities/graph/inspect.test.ts +260 -5
- package/src/capabilities/graph/inspect.verb.ts +18 -6
- package/src/capabilities/graph/query.render.ts +15 -3
- package/src/capabilities/graph/query.verb.ts +3 -3
- package/src/capabilities/graph/runQuery.ts +2 -3
- package/src/capabilities/index.ts +3 -1
- package/src/capabilities/info/collectInfo.ts +5 -4
- package/src/capabilities/info/info.render.ts +1 -1
- package/src/capabilities/info/info.verb.ts +1 -1
- package/src/capabilities/lazy.test.ts +32 -0
- package/src/capabilities/meta/complete.verb.ts +1 -1
- package/src/capabilities/meta/index.ts +1 -1
- package/src/capabilities/meta/mcp.verb.ts +10 -8
- package/src/capabilities/ontology/index.ts +15 -11
- package/src/capabilities/ontology/ontology.test.ts +6 -55
- package/src/capabilities/ontology/queries.ts +2 -2
- package/src/capabilities/ontology/render.ts +3 -4
- package/src/capabilities/ontology/verbs.ts +27 -68
- package/src/capabilities/prompt/index.ts +2 -2
- package/src/capabilities/prompt/prompt.render.ts +6 -2
- package/src/capabilities/prompt/types.ts +1 -1
- package/src/capabilities/prompt/verbs.ts +4 -5
- package/src/capabilities/reference.test.ts +63 -0
- package/src/capabilities/resources/provider.ts +342 -85
- package/src/capabilities/resources/resources.test.ts +355 -59
- package/src/capabilities/setup/buildPlan.ts +236 -0
- package/src/capabilities/setup/index.ts +7 -7
- package/src/capabilities/setup/mode.ts +74 -0
- package/src/capabilities/setup/operations/index.ts +74 -0
- package/src/capabilities/setup/operations/setupCompletions.ts +97 -24
- package/src/capabilities/setup/operations/setupConfig.ts +124 -0
- package/src/capabilities/setup/operations/setupGenerator.ts +396 -326
- package/src/capabilities/setup/operations/setupLsp.ts +329 -68
- package/src/capabilities/setup/operations/setupMcp.ts +137 -97
- package/src/capabilities/setup/operations/setupSkills.ts +336 -108
- package/src/capabilities/setup/plan.render.ts +241 -0
- package/src/capabilities/setup/plan.ts +236 -0
- package/src/capabilities/setup/setup.mcp.correctness.test.ts +432 -0
- package/src/capabilities/setup/setup.render.test.ts +281 -73
- package/src/capabilities/setup/setup.render.ts +45 -77
- package/src/capabilities/setup/setup.test.ts +972 -209
- package/src/capabilities/setup/setup.verb.ts +223 -71
- package/src/capabilities/setup/shell.test.ts +86 -0
- package/src/capabilities/setup/shell.ts +137 -11
- package/src/capabilities/setup/targets.ts +367 -0
- package/src/capabilities/setup/types.ts +18 -57
- package/src/capabilities/shared/assertExecOk.ts +68 -10
- package/src/capabilities/shared/index.ts +32 -0
- package/src/capabilities/shared/packageManager.test.ts +55 -0
- package/src/capabilities/shared/packageManager.ts +62 -6
- package/src/capabilities/skill/discover.ts +37 -5
- package/src/capabilities/skill/index.ts +1 -1
- package/src/capabilities/skill/render.ts +10 -9
- package/src/capabilities/skill/skill.test.ts +7 -5
- package/src/capabilities/skill/verbs.ts +3 -4
- package/src/capabilities/sources/collectStatus.ts +7 -2
- package/src/capabilities/sources/index.ts +1 -1
- package/src/capabilities/sources/installSkills.ts +84 -7
- package/src/capabilities/sources/runUpdate.ts +53 -21
- package/src/capabilities/sources/sources.test.ts +154 -2
- package/src/capabilities/sources/status.render.ts +1 -1
- package/src/capabilities/sources/status.verb.ts +1 -1
- package/src/capabilities/sources/update.render.ts +1 -1
- package/src/capabilities/sources/update.verb.ts +1 -1
- package/src/capabilities/surface.test.ts +134 -17
- package/src/capabilities/upgrade/runUpgrade.ts +8 -8
- package/src/capabilities/upgrade/upgrade.render.ts +4 -5
- package/src/capabilities/upgrade/upgrade.test.ts +3 -3
- package/src/capabilities/upgrade/upgrade.verb.ts +1 -1
- package/src/capabilities/version/index.ts +12 -0
- package/src/capabilities/version/version.test.ts +66 -0
- package/src/capabilities/version/version.verb.ts +39 -0
- package/src/constants.ts +31 -1
- package/src/identity.test.ts +40 -25
- package/src/kernel/completion/__snapshots__/emitScripts.test.ts.snap +15 -13
- package/src/kernel/completion/complete.test.ts +12 -2
- package/src/kernel/completion/complete.ts +1 -1
- package/src/kernel/completion/emitScripts.ts +1 -1
- package/src/kernel/completion/entitySource.test.ts +1 -1
- package/src/kernel/completion/entitySource.ts +21 -8
- package/src/kernel/completion/model.test.ts +164 -12
- package/src/kernel/completion/model.ts +94 -14
- package/src/kernel/completion/parse.test.ts +4 -7
- package/src/kernel/completion/parse.ts +15 -0
- package/src/kernel/completion/resolve.test.ts +0 -1
- package/src/kernel/completion/safety.test.ts +34 -26
- package/src/kernel/completion/shellDrive.test.ts +28 -9
- package/src/kernel/completion/templates/bash.ts +7 -2
- package/src/kernel/completion/templates/index.ts +23 -0
- package/src/kernel/completion/types.ts +7 -0
- package/src/kernel/config/defaults.test.ts +25 -2
- package/src/kernel/config/defaults.ts +4 -3
- package/src/kernel/config/evaluateProjectConfig.ts +31 -8
- package/src/kernel/config/firstRun.test.ts +44 -38
- package/src/kernel/config/firstRun.ts +24 -88
- package/src/kernel/config/index.ts +1 -1
- package/src/kernel/config/readConfig.test.ts +6 -3
- package/src/kernel/config/readConfig.ts +1 -1
- package/src/kernel/config/schema.ts +3 -1
- package/src/kernel/config/types.ts +3 -1
- package/src/kernel/copy.test.ts +34 -4
- package/src/kernel/copy.ts +54 -0
- package/src/kernel/error/PragmaError.test.ts +5 -2
- package/src/kernel/error/PragmaError.ts +4 -2
- package/src/kernel/error/constants.ts +7 -5
- package/src/kernel/error/fromTaskError.ts +28 -6
- package/src/kernel/error/recovery.ts +14 -0
- package/src/kernel/error/renderError.ts +42 -1
- package/src/kernel/error/types.ts +21 -1
- package/src/kernel/index.ts +26 -0
- package/src/kernel/packs/collect.ts +12 -16
- package/src/kernel/packs/compile.test.ts +130 -1
- package/src/kernel/packs/compile.ts +93 -3
- package/src/kernel/packs/disclosure.ts +2 -2
- package/src/kernel/packs/graphql/buildLookupDocument.ts +1 -1
- package/src/kernel/packs/graphql/fetchGraphqlLookup.ts +3 -4
- package/src/kernel/packs/graphql/index.ts +20 -0
- package/src/kernel/packs/index.ts +40 -0
- package/src/kernel/packs/iri.test.ts +73 -0
- package/src/kernel/packs/iri.ts +66 -14
- package/src/kernel/packs/renderPack.ts +24 -5
- package/src/kernel/packs/resolveEntity.test.ts +213 -0
- package/src/kernel/packs/resolveEntity.ts +112 -18
- package/src/kernel/packs/runBodies.ts +2 -3
- package/src/kernel/packs/sample.ts +1 -1
- package/src/kernel/packs/schema.ts +18 -1
- package/src/kernel/packs/sparql/applyFilters.ts +16 -17
- package/src/kernel/packs/sparql/buildLookupQuery.ts +75 -3
- package/src/kernel/packs/sparql/index.ts +37 -0
- package/src/kernel/packs/sparql/runSelect.test.ts +1 -1
- package/src/kernel/packs/sparql/runSelect.ts +3 -4
- package/src/kernel/packs/toolDescription.test.ts +42 -3
- package/src/kernel/packs/types.ts +13 -0
- package/src/kernel/packs/uniqueness.ts +1 -1
- package/src/kernel/project/cli/buildProgram.test.ts +147 -12
- package/src/kernel/project/cli/buildProgram.ts +77 -18
- package/src/kernel/project/cli/constants.ts +34 -0
- package/src/kernel/project/cli/dispatch.test.ts +160 -3
- package/src/kernel/project/cli/dispatch.ts +222 -42
- package/src/kernel/project/cli/exitCodes.ts +1 -1
- package/src/kernel/project/cli/globalFlags.test.ts +117 -1
- package/src/kernel/project/cli/globalFlags.ts +130 -30
- package/src/kernel/project/cli/helpFormat.ts +13 -0
- package/src/kernel/project/cli/rootHelp.ts +41 -12
- package/src/kernel/project/cli/suggest.test.ts +33 -1
- package/src/kernel/project/cli/suggest.ts +25 -1
- package/src/kernel/project/cli/verbHelp.test.ts +30 -0
- package/src/kernel/project/cli/verbHelp.ts +23 -7
- package/src/kernel/project/mcp/buildServer.ts +7 -4
- package/src/kernel/project/mcp/envelope.ts +2 -2
- package/src/kernel/project/mcp/instructions.ts +2 -2
- package/src/kernel/project/mcp/mcpError.ts +1 -1
- package/src/kernel/project/mcp/parity.test.ts +5 -2
- package/src/kernel/project/mcp/prompts/index.ts +37 -0
- package/src/kernel/project/mcp/prompts/source.ts +2 -2
- package/src/kernel/project/mcp/registerVerb.ts +35 -9
- package/src/kernel/project/mcp/serve.ts +2 -2
- package/src/kernel/render/__snapshots__/renderers.test.ts.snap +7 -4
- package/src/kernel/render/contracts.ts +21 -0
- package/src/kernel/render/envelope.ts +2 -3
- package/src/kernel/render/formatters.ts +1 -1
- package/src/kernel/render/renderers.test.ts +243 -6
- package/src/kernel/render/renderers.ts +222 -20
- package/src/kernel/render/style.test.ts +75 -24
- package/src/kernel/render/style.ts +31 -1
- package/src/kernel/render/turtle.ts +222 -0
- package/src/kernel/runtime/graphpack/buildIndex.ts +1 -1
- package/src/kernel/runtime/graphpack/embedded/pack.generated.ts +3 -3
- package/src/kernel/runtime/graphpack/embedded/pack.index.generated.ts +1 -1
- package/src/kernel/runtime/graphpack/embedded.ts +3 -3
- package/src/kernel/runtime/graphpack/manifest.ts +1 -1
- package/src/kernel/runtime/graphpack/read.ts +1 -2
- package/src/kernel/runtime/loadSession.ts +1 -1
- package/src/kernel/runtime/probe.ts +6 -6
- package/src/kernel/runtime/readEntity.ts +472 -28
- package/src/kernel/runtime/refs/index.ts +39 -0
- package/src/kernel/runtime/refs/parseRef.ts +2 -2
- package/src/kernel/runtime/refs/resolve.ts +4 -4
- package/src/kernel/runtime/storeReadiness.ts +1 -2
- package/src/kernel/runtime/types.ts +15 -1
- package/src/kernel/runtime/wasmEmbed.test.ts +37 -39
- package/src/kernel/spec/emitReference.ts +105 -30
- package/src/kernel/spec/emitSurface.ts +48 -6
- package/src/kernel/spec/surfaceConformance.test.ts +4 -2
- package/src/kernel/spec/types.ts +248 -4
- package/src/testing/behavioral/docExamples.test.ts +14 -0
- package/src/testing/behavioral/errorMatrix.mcp.test.ts +2 -2
- package/src/testing/behavioral/firstRun.e2e.test.ts +24 -24
- package/src/testing/behavioral/journeys.cli.test.ts +1 -1
- package/src/testing/behavioral/journeys.defaultPack.test.ts +7 -7
- package/src/testing/behavioral/journeys.implementation.test.ts +206 -0
- package/src/testing/behavioral/journeys.interactiveTty.e2e.test.ts +2 -2
- package/src/testing/behavioral/journeys.packageStories.test.ts +4 -4
- package/src/testing/behavioral/mcpServe.e2e.test.ts +57 -2
- package/src/testing/behavioral/mcpSurface.test.ts +1 -1
- package/src/testing/behavioral/rootCli.e2e.test.ts +26 -2
- package/src/testing/eval/cases/effectful.ts +3 -2
- package/src/testing/fixtures/blockGraph.ts +79 -0
- package/src/testing/fixtures/graph/canonical.ts +88 -2
- package/src/testing/fixtures/graph/defaultPack.ts +1 -1
- package/src/testing/helpers/blankCanonicalRanges.ts +36 -0
- package/src/testing/helpers/projectMcp.ts +32 -6
- package/src/testing/helpers/runCli.ts +35 -18
- package/src/testing/perf/budgets.test.ts +20 -9
- package/src/testing/perf/budgets.ts +58 -9
- package/src/testing/perf/codegen.test.ts +126 -0
- package/src/testing/perf/globalSetup.test.ts +286 -0
- package/src/testing/perf/globalSetup.ts +505 -23
- package/src/testing/perf/measure.test.ts +38 -0
- package/src/testing/perf/measure.ts +23 -4
- package/src/testing/setupXdgIsolation.ts +81 -21
- package/src/testing/tempRoot.globalSetup.ts +122 -0
- package/dist/pragma +0 -0
- package/src/capabilities/create/compiledCreate.subprocess.test.ts +0 -189
- package/src/capabilities/create/templates.embedded.generated.ts +0 -28
- package/src/capabilities/doctor/checks/checkConfigFile.ts +0 -42
- package/src/capabilities/doctor/checks/checkMcpCommands.ts +0 -114
- package/src/capabilities/doctor/checks/checkMcpConfigured.ts +0 -68
- package/src/capabilities/doctor/checks/checkSkillsSymlinked.ts +0 -61
- package/src/capabilities/doctor/checks/deriveBand.test.ts +0 -42
- package/src/capabilities/doctor/checks/deriveBand.ts +0 -28
- package/src/kernel/config/__snapshots__/firstRun.test.ts.snap +0 -11
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE source of truth for prompt entities — read TWO ways from ONE KG type,
|
|
3
|
+
* so the native MCP `prompts/*` surface and the covenant `prompt_list`/
|
|
4
|
+
* `prompt_lookup` content tools never diverge.
|
|
5
|
+
*
|
|
6
|
+
* The type and its four properties are DECLARED by the distribution
|
|
7
|
+
* (`kernel/vocabulary.ts`), not named here — this module knows the shape of a
|
|
8
|
+
* prompt, not whose prompt it is. With `<type>`/`<body>`/`<argument>`/
|
|
9
|
+
* `<argName>`/`<argRequired>` standing for the declared terms, a prompt entity
|
|
10
|
+
* is authored as:
|
|
11
|
+
*
|
|
12
|
+
* ex:prompt.x a <type> ;
|
|
13
|
+
* rdfs:label "x" ; # the prompt NAME (indexed → storeless list)
|
|
14
|
+
* rdfs:comment "…" ; # the description (indexed)
|
|
15
|
+
* <body> "…" ; # the template body (store-backed)
|
|
16
|
+
* <argument> [ <argName> "a" ; rdfs:comment "…" ; <argRequired> true ] .
|
|
17
|
+
*
|
|
18
|
+
* Listing is STORELESS (over the pack index — `label`/`description` are indexed),
|
|
19
|
+
* so `prompts/list` and native discovery cost nothing until a `get`. A `get`
|
|
20
|
+
* (body + arguments) is STORE-BACKED through `runSelect` — identical laziness to
|
|
21
|
+
* the resource browser (list storeless, read store-backed). An empty or missing
|
|
22
|
+
* index yields zero prompts (never a store boot on the list path).
|
|
23
|
+
*
|
|
24
|
+
* The store-backed reads route through `runSelect` and DO NOT catch. A cold
|
|
25
|
+
* store is already refused upstream — the tools are `needsStore`, and the native
|
|
26
|
+
* provider calls `guardStore()` first — so a swallowed failure here could only
|
|
27
|
+
* ever hide a real one, reporting a broken query as an empty graph. `runSelect`
|
|
28
|
+
* classifies an unbound prefix as STORE_UNAVAILABLE with its `sources update`
|
|
29
|
+
* recovery and lets everything else propagate.
|
|
30
|
+
*/
|
|
31
|
+
import { readPackIndex } from "../../../completion/entitySource.js";
|
|
32
|
+
import { runSelect } from "../../../packs/sparql/index.js";
|
|
33
|
+
import { distributionSource } from "../../../packs/types.js";
|
|
34
|
+
import { VOCABULARY } from "../../../vocabulary.js";
|
|
35
|
+
/** The declared prompt terms this module reads the graph with. */
|
|
36
|
+
const PROMPT = VOCABULARY.prompt;
|
|
37
|
+
/** Whether an index entity carries the prompt type (primary type or any type). */
|
|
38
|
+
function isPromptEntity(entity) {
|
|
39
|
+
return (entity.type === PROMPT.type ||
|
|
40
|
+
(Array.isArray(entity.types) && entity.types.includes(PROMPT.type)));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* List prompt summaries STORELESSLY from the index of the pack the boot decision
|
|
44
|
+
* names. Returns `[]` when no index is reachable (including an unavailable
|
|
45
|
+
* store) or the index carries no prompts — never boots the store.
|
|
46
|
+
*
|
|
47
|
+
* @param decision - The boot decision from `resolveSources`.
|
|
48
|
+
* @returns Prompt summaries (name from the entity label, sorted by name).
|
|
49
|
+
*/
|
|
50
|
+
export function listPromptSummaries(decision) {
|
|
51
|
+
const index = readPackIndex(decision);
|
|
52
|
+
if (!index || !Array.isArray(index.entities))
|
|
53
|
+
return [];
|
|
54
|
+
const summaries = [];
|
|
55
|
+
for (const entity of index.entities) {
|
|
56
|
+
if (!isPromptEntity(entity))
|
|
57
|
+
continue;
|
|
58
|
+
const name = entity.label || entity.name;
|
|
59
|
+
summaries.push({
|
|
60
|
+
name,
|
|
61
|
+
...(entity.description ? { description: entity.description } : {}),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return summaries.sort((a, b) => a.name.localeCompare(b.name));
|
|
65
|
+
}
|
|
66
|
+
/** The SPARQL that materializes prompts (all, or one when `label` is bound). */
|
|
67
|
+
function promptQuery(labelFilter) {
|
|
68
|
+
const filter = labelFilter
|
|
69
|
+
? ` FILTER(LCASE(STR(?name)) = LCASE(${JSON.stringify(labelFilter)}))`
|
|
70
|
+
: "";
|
|
71
|
+
return [
|
|
72
|
+
"SELECT ?name ?description ?body ?argName ?argDescription ?argRequired WHERE {",
|
|
73
|
+
` ?prompt a ${PROMPT.type} ;`,
|
|
74
|
+
" rdfs:label ?name .",
|
|
75
|
+
filter,
|
|
76
|
+
" OPTIONAL { ?prompt rdfs:comment ?description }",
|
|
77
|
+
` OPTIONAL { ?prompt ${PROMPT.body} ?body }`,
|
|
78
|
+
" OPTIONAL {",
|
|
79
|
+
` ?prompt ${PROMPT.argument} ?arg .`,
|
|
80
|
+
` ?arg ${PROMPT.argName} ?argName .`,
|
|
81
|
+
" OPTIONAL { ?arg rdfs:comment ?argDescription }",
|
|
82
|
+
` OPTIONAL { ?arg ${PROMPT.argRequired} ?argRequired }`,
|
|
83
|
+
" }",
|
|
84
|
+
"}",
|
|
85
|
+
"ORDER BY ?name ?argName",
|
|
86
|
+
].join("\n");
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Fold SELECT rows (one per argument; the body repeats) into distinct
|
|
90
|
+
* {@link PromptEntry}s. Rows are keyed by SELECT variable name with plain string
|
|
91
|
+
* values, and an unbound OPTIONAL variable is simply absent.
|
|
92
|
+
*/
|
|
93
|
+
function foldPromptRows(rows) {
|
|
94
|
+
const byName = new Map();
|
|
95
|
+
for (const row of rows) {
|
|
96
|
+
const name = row.name;
|
|
97
|
+
if (!name)
|
|
98
|
+
continue;
|
|
99
|
+
let entry = byName.get(name);
|
|
100
|
+
if (!entry) {
|
|
101
|
+
entry = { body: "", args: new Map() };
|
|
102
|
+
if (row.description)
|
|
103
|
+
entry.description = row.description;
|
|
104
|
+
byName.set(name, entry);
|
|
105
|
+
}
|
|
106
|
+
if (row.body)
|
|
107
|
+
entry.body = row.body;
|
|
108
|
+
const argName = row.argName;
|
|
109
|
+
if (argName && !entry.args.has(argName)) {
|
|
110
|
+
entry.args.set(argName, {
|
|
111
|
+
name: argName,
|
|
112
|
+
...(row.argDescription ? { description: row.argDescription } : {}),
|
|
113
|
+
...(row.argRequired !== undefined
|
|
114
|
+
? { required: row.argRequired === "true" }
|
|
115
|
+
: {}),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return [...byName.entries()]
|
|
120
|
+
.map(([name, entry]) => ({
|
|
121
|
+
name,
|
|
122
|
+
...(entry.description ? { description: entry.description } : {}),
|
|
123
|
+
body: entry.body,
|
|
124
|
+
arguments: [...entry.args.values()],
|
|
125
|
+
}))
|
|
126
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Read every prompt entity STORE-BACKED (body + arguments).
|
|
130
|
+
*
|
|
131
|
+
* @param rt - The per-invocation runtime.
|
|
132
|
+
* @returns The materialized prompt entries, sorted by name.
|
|
133
|
+
* @throws PragmaError STORE_UNAVAILABLE when the store cannot answer; any other
|
|
134
|
+
* query failure propagates, so a broken read is never an empty graph.
|
|
135
|
+
* @note Impure — boots the store through `runSelect`.
|
|
136
|
+
*/
|
|
137
|
+
export async function readPrompts(rt) {
|
|
138
|
+
return foldPromptRows(await runSelect(rt, promptQuery(), distributionSource("prompt")));
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Read ONE prompt entity by name (case-insensitive), STORE-BACKED.
|
|
142
|
+
*
|
|
143
|
+
* @param rt - The per-invocation runtime.
|
|
144
|
+
* @param name - The prompt name (its `rdfs:label`).
|
|
145
|
+
* @returns The materialized prompt, or `undefined` when the graph has no such
|
|
146
|
+
* prompt — a genuine miss, never a failed read.
|
|
147
|
+
* @throws PragmaError STORE_UNAVAILABLE when the store cannot answer; any other
|
|
148
|
+
* query failure propagates.
|
|
149
|
+
* @note Impure — boots the store through `runSelect`.
|
|
150
|
+
*/
|
|
151
|
+
export async function readPrompt(rt, name) {
|
|
152
|
+
return foldPromptRows(await runSelect(rt, promptQuery(name), distributionSource("prompt"))).at(0);
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../../../../../src/kernel/project/mcp/prompts/source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MA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;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,EAAiB,EACjB,IAAY;IAEZ,OAAO,cAAc,CACnB,MAAM,SAAS,CAAC,EAAE,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CACrE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACV,CAAC"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter: {@link VerbSpec} → an MCP tool.
|
|
3
|
+
*
|
|
4
|
+
* This is the one seam where the grammar meets the MCP SDK — the only place a
|
|
5
|
+
* projector reaches for zod (to build the input schema the SDK validates). The
|
|
6
|
+
* tool name follows the grammar's naming rule, annotations derive from the
|
|
7
|
+
* capability, and a mutating verb gains the plan-first `confirm` flow: without
|
|
8
|
+
* `confirm`, the verb's `Task` is dry-run and a plan is returned
|
|
9
|
+
* (`{ planOnly: true, confirmRequired: true }`); with `confirm: true`, it runs
|
|
10
|
+
* for real. That plan is rendered through the SAME shared effect formatter the
|
|
11
|
+
* CLI preview uses, so the agent-facing and human-facing surfaces describe one
|
|
12
|
+
* plan rather than two views of it.
|
|
13
|
+
*/
|
|
14
|
+
import { statSync } from "node:fs";
|
|
15
|
+
import { isAbsolute } from "node:path";
|
|
16
|
+
import { describeEffect } from "@canonical/task";
|
|
17
|
+
import { runPreview, runTask } from "@canonical/task/node";
|
|
18
|
+
import { z } from "zod";
|
|
19
|
+
import { asPragmaError } from "../../error/fromTaskError.js";
|
|
20
|
+
import { PragmaError } from "../../error/index.js";
|
|
21
|
+
import { toolName } from "../../spec/index.js";
|
|
22
|
+
import { toolError, toolSuccess } from "./envelope.js";
|
|
23
|
+
/**
|
|
24
|
+
* Resolve the effective per-call write root for a mutating tool call.
|
|
25
|
+
*
|
|
26
|
+
* The MCP-only injected `cwd` arg lets an agent target a project directory other
|
|
27
|
+
* than the server's launch dir. It MUST be an absolute, existing directory —
|
|
28
|
+
* this is the SINGLE cwd the SEC-2 jail validates AND the interpreter resolves
|
|
29
|
+
* effect paths against, so a write dir the jail never checked can never exist.
|
|
30
|
+
*
|
|
31
|
+
* @throws PragmaError INVALID_INPUT for a relative or non-directory `cwd`.
|
|
32
|
+
*/
|
|
33
|
+
function resolveEffectiveCwd(rawCwd, fallback) {
|
|
34
|
+
if (typeof rawCwd !== "string" || rawCwd === "")
|
|
35
|
+
return fallback;
|
|
36
|
+
if (!isAbsolute(rawCwd)) {
|
|
37
|
+
throw PragmaError.invalidInput("cwd", rawCwd, {
|
|
38
|
+
recovery: { message: "Provide an absolute project directory path." },
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
let isDir = false;
|
|
42
|
+
try {
|
|
43
|
+
isDir = statSync(rawCwd).isDirectory();
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
isDir = false;
|
|
47
|
+
}
|
|
48
|
+
if (!isDir) {
|
|
49
|
+
throw PragmaError.invalidInput("cwd", rawCwd, {
|
|
50
|
+
recovery: { message: "The cwd must be an existing directory." },
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return rawCwd;
|
|
54
|
+
}
|
|
55
|
+
/** The base zod type for a param, before `.describe()`/`.optional()`. */
|
|
56
|
+
function zodForParam(param) {
|
|
57
|
+
switch (param.kind) {
|
|
58
|
+
case "string":
|
|
59
|
+
return z.string();
|
|
60
|
+
case "number":
|
|
61
|
+
return z.number();
|
|
62
|
+
case "boolean":
|
|
63
|
+
return z.boolean();
|
|
64
|
+
case "enum":
|
|
65
|
+
return z.enum(param.values);
|
|
66
|
+
case "string[]":
|
|
67
|
+
return z.array(z.string());
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Build the zod input shape for a verb's params.
|
|
72
|
+
*
|
|
73
|
+
* Each param becomes a described field; non-required params are optional. The
|
|
74
|
+
* returned raw shape is what the MCP SDK validates tool arguments against.
|
|
75
|
+
*
|
|
76
|
+
* @param params - The verb's parameter specs.
|
|
77
|
+
* @returns A zod raw shape keyed by param name.
|
|
78
|
+
*/
|
|
79
|
+
export function buildZodSchema(params) {
|
|
80
|
+
const shape = {};
|
|
81
|
+
for (const param of params) {
|
|
82
|
+
let field = zodForParam(param);
|
|
83
|
+
if (param.doc)
|
|
84
|
+
field = field.describe(param.doc);
|
|
85
|
+
// Apply a declared default so the MCP schema matches the CLI, which fills
|
|
86
|
+
// ParamSpec.default when a flag is omitted (dispatch.extractParams).
|
|
87
|
+
if ("default" in param && param.default !== undefined) {
|
|
88
|
+
field = field.default(param.default);
|
|
89
|
+
}
|
|
90
|
+
else if (!param.required) {
|
|
91
|
+
field = field.optional();
|
|
92
|
+
}
|
|
93
|
+
shape[param.name] = field;
|
|
94
|
+
}
|
|
95
|
+
return shape;
|
|
96
|
+
}
|
|
97
|
+
/** Derive the MCP annotations for a verb from its capability. */
|
|
98
|
+
function annotationsFor(verb) {
|
|
99
|
+
return {
|
|
100
|
+
readOnlyHint: !verb.capability.mutates,
|
|
101
|
+
...(verb.capability.destructive !== undefined
|
|
102
|
+
? { destructiveHint: verb.capability.destructive }
|
|
103
|
+
: {}),
|
|
104
|
+
openWorldHint: false,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** Pick just the verb's declared params out of the parsed tool arguments. */
|
|
108
|
+
function paramsFromArgs(verb, args) {
|
|
109
|
+
const params = {};
|
|
110
|
+
for (const param of verb.params) {
|
|
111
|
+
if (param.name in args)
|
|
112
|
+
params[param.name] = args[param.name];
|
|
113
|
+
}
|
|
114
|
+
return params;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Apply the injected `detail` argument to a per-call runtime.
|
|
118
|
+
*
|
|
119
|
+
* A verb with a {@link DisclosureSpec} gains a `detail` enum tool param (see
|
|
120
|
+
* {@link registerVerb}); when the agent sets it, this seeds `globalFlags.detail`
|
|
121
|
+
* for THIS call so the verb's `run` resolves the level through the same uniform
|
|
122
|
+
* `resolveDetail` the CLI `--detail` flag feeds — no VerbSpec field, no
|
|
123
|
+
* Formatters-signature change, no MCP-opts-out asymmetry.
|
|
124
|
+
*/
|
|
125
|
+
function withDetail(verb, runtime, args) {
|
|
126
|
+
if (!verb.disclosure || typeof args.detail !== "string")
|
|
127
|
+
return runtime;
|
|
128
|
+
return {
|
|
129
|
+
...runtime,
|
|
130
|
+
globalFlags: { ...runtime.globalFlags, detail: args.detail },
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/** The tool handler for a read verb: run, project, envelope. */
|
|
134
|
+
function readHandler(verb, runtime) {
|
|
135
|
+
return async (args) => {
|
|
136
|
+
try {
|
|
137
|
+
if (verb.capability.needsStore)
|
|
138
|
+
await runtime.store.get();
|
|
139
|
+
const params = paramsFromArgs(verb, args);
|
|
140
|
+
const result = await Promise.resolve(verb.run(params, withDetail(verb, runtime, args)));
|
|
141
|
+
return toolSuccess(JSON.parse(verb.output.formatters.json(result)));
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
return toolError(asPragmaError(error));
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Route a Task's log effects to STDERR. The default interpreter logs to
|
|
150
|
+
* `console.log` (stdout), which would corrupt the MCP stdio JSON-RPC frame;
|
|
151
|
+
* diagnostics belong on stderr. Mirrors the CLI dispatcher's `logToStderr`.
|
|
152
|
+
*/
|
|
153
|
+
const logToStderr = (_level, message) => {
|
|
154
|
+
process.stderr.write(`${message}\n`);
|
|
155
|
+
};
|
|
156
|
+
/** The tool handler for a mutating verb: plan-first unless `confirm: true`. */
|
|
157
|
+
function mutateHandler(verb, runtime) {
|
|
158
|
+
return async (args) => {
|
|
159
|
+
try {
|
|
160
|
+
// The SINGLE per-call write root: validated here (absolute + existing dir)
|
|
161
|
+
// and threaded as `rt.cwd`, so the SEC-2 jail and the interpreter's
|
|
162
|
+
// effect-path base are literally the same value — no jail bypass.
|
|
163
|
+
const effectiveCwd = resolveEffectiveCwd(args.cwd, runtime.cwd);
|
|
164
|
+
if (verb.capability.needsStore)
|
|
165
|
+
await runtime.store.get();
|
|
166
|
+
const params = paramsFromArgs(verb, args);
|
|
167
|
+
// Without `confirm`, this is a plan-only preview: tell the verb so a
|
|
168
|
+
// network-touching mutation stays offline and never fetches on discovery.
|
|
169
|
+
const preview = args.confirm !== true;
|
|
170
|
+
// MCP has no interactive channel: transport "mcp" makes an interactive
|
|
171
|
+
// verb pick the params-or-error prompt strategy, so a tool call can never
|
|
172
|
+
// hang waiting for input.
|
|
173
|
+
const interaction = {
|
|
174
|
+
isTTY: false,
|
|
175
|
+
transport: "mcp",
|
|
176
|
+
yes: args.confirm === true,
|
|
177
|
+
};
|
|
178
|
+
const mutationRuntime = {
|
|
179
|
+
...runtime,
|
|
180
|
+
cwd: effectiveCwd,
|
|
181
|
+
mutation: { preview, undo: false },
|
|
182
|
+
interaction,
|
|
183
|
+
};
|
|
184
|
+
const task = await Promise.resolve(verb.run(params, mutationRuntime));
|
|
185
|
+
if (preview) {
|
|
186
|
+
// The HONEST preview (PR7), the same interpreter `--dry-run` uses:
|
|
187
|
+
// reads are real, writes are recorded and never executed. A tool call
|
|
188
|
+
// whose confirmed run would fail now returns that error instead of a
|
|
189
|
+
// confident plan, so plan-first predicts rather than reassures.
|
|
190
|
+
//
|
|
191
|
+
// NO `onLog`: a preview that PERFORMS an effect is not a preview of
|
|
192
|
+
// that effect, and the recorded `Log`s are already about to be listed.
|
|
193
|
+
// The interpreter prints nothing of its own when it is absent.
|
|
194
|
+
const previewExec = mutationRuntime.exec ?? {};
|
|
195
|
+
try {
|
|
196
|
+
const { effects } = await runPreview(task, {
|
|
197
|
+
cwd: previewExec.cwd,
|
|
198
|
+
onEffectStart: previewExec.onEffectStart,
|
|
199
|
+
});
|
|
200
|
+
// This payload is read by an LLM on a token budget, so it carries
|
|
201
|
+
// the plan a person is shown rather than the interpreter's
|
|
202
|
+
// transcript: the same `visiblePlanEffects` filter the CLI preview
|
|
203
|
+
// applies, from the same module. Without it every internal
|
|
204
|
+
// `Check exists:` and every repeat of the output directory spent
|
|
205
|
+
// tokens burying the real artifacts.
|
|
206
|
+
//
|
|
207
|
+
// The FILTER is what the surfaces share; the ROW FORMAT is not.
|
|
208
|
+
// These strings are structured data, so they stay `describeEffect` —
|
|
209
|
+
// the description `@canonical/task` gives its own effects, which
|
|
210
|
+
// carries byte counts, has no terminal chrome, and cannot embed an
|
|
211
|
+
// ANSI escape however the editor that spawned this server configured
|
|
212
|
+
// colour. That also lets the CLI's `--format json` plan and this one
|
|
213
|
+
// be compared string for string, which is the A6 invariant.
|
|
214
|
+
//
|
|
215
|
+
// Loaded lazily, and from the LIGHT `/format` subpath: the kernel
|
|
216
|
+
// keeps summon-core proper (and React) off its static import graph.
|
|
217
|
+
const { visiblePlanEffects } = await import("@canonical/summon-core/format");
|
|
218
|
+
const plan = visiblePlanEffects(effects, runtime.globalFlags.verbose === true).map(describeEffect);
|
|
219
|
+
return toolSuccess({ plan }, { planOnly: true, confirmRequired: true });
|
|
220
|
+
}
|
|
221
|
+
finally {
|
|
222
|
+
// No `store.invalidate()`: a preview cannot have changed disk. Only
|
|
223
|
+
// the verb's own teardown (e.g. an interactive session) runs here.
|
|
224
|
+
await previewExec.dispose?.();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// Real execution: spread the verb's runner options (prompt handler,
|
|
228
|
+
// stamping) into the interpreter; run teardown afterwards.
|
|
229
|
+
const exec = mutationRuntime.exec ?? {};
|
|
230
|
+
try {
|
|
231
|
+
const result = await runTask(task, { onLog: logToStderr, ...exec });
|
|
232
|
+
return toolSuccess(JSON.parse(verb.output.formatters.json(result)));
|
|
233
|
+
}
|
|
234
|
+
finally {
|
|
235
|
+
// A real mutation may have changed the pack/config on disk. This runtime
|
|
236
|
+
// is booted ONCE for the whole server lifetime and shared by every tool,
|
|
237
|
+
// so drop its server-lifetime caches (store session + the config memo the
|
|
238
|
+
// boot depends on) FIRST — before teardown, so a throwing `dispose` can
|
|
239
|
+
// never skip the cache-drop — then the next read re-boots against the new
|
|
240
|
+
// state instead of serving a stale pack/config. `mutationRuntime` spreads
|
|
241
|
+
// `runtime`, so this is the same shared LazyStore. Only reached on the
|
|
242
|
+
// real-run branch (`confirm: true`); the plan-only preview never mutates.
|
|
243
|
+
runtime.store.invalidate();
|
|
244
|
+
await exec.dispose?.();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
return toolError(asPragmaError(error));
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Register one exposed verb as an MCP tool on the server.
|
|
254
|
+
*
|
|
255
|
+
* @param server - The MCP server to register onto.
|
|
256
|
+
* @param verb - The verb to expose (caller ensures `mcp.expose === true`).
|
|
257
|
+
* @param runtime - The runtime handed to the verb's `run`.
|
|
258
|
+
* @note Impure — mutates the server's tool registry.
|
|
259
|
+
*/
|
|
260
|
+
export function registerVerb(server, verb, runtime) {
|
|
261
|
+
const shape = buildZodSchema(verb.params);
|
|
262
|
+
// A verb with progressive disclosure gains a `detail` enum param derived from
|
|
263
|
+
// its DisclosureSpec (Risk2 — NO new VerbSpec field). The handler seeds
|
|
264
|
+
// globalFlags.detail from it per call, so MCP and CLI share one resolveDetail.
|
|
265
|
+
if (verb.disclosure) {
|
|
266
|
+
shape.detail = z
|
|
267
|
+
.enum(verb.disclosure.levels)
|
|
268
|
+
.optional()
|
|
269
|
+
.describe(`Progressive-disclosure level (${verb.disclosure.levels.join(", ")}); default ${verb.disclosure.default}.`);
|
|
270
|
+
}
|
|
271
|
+
if (verb.capability.mutates) {
|
|
272
|
+
shape.confirm = z
|
|
273
|
+
.boolean()
|
|
274
|
+
.default(false)
|
|
275
|
+
.describe("Set true to execute; otherwise a plan is returned.");
|
|
276
|
+
// Injected MCP-only per-call write root — added to the zod shape but NOT to
|
|
277
|
+
// verb.params (like `confirm`/`detail`), so `emitVerb` never emits it and the
|
|
278
|
+
// surface golden is untouched. The handler validates it and threads it as the
|
|
279
|
+
// single `rt.cwd` the jail + interpreter share (SEC-2 atomicity).
|
|
280
|
+
shape.cwd = z
|
|
281
|
+
.string()
|
|
282
|
+
.optional()
|
|
283
|
+
.describe("Absolute project directory to write into; defaults to the server's working directory.");
|
|
284
|
+
}
|
|
285
|
+
const config = {
|
|
286
|
+
// The agent-facing tool description is the verb's richer `doc` when present
|
|
287
|
+
// (pack `toolDescription`s compile into it; hand-written verbs author it
|
|
288
|
+
// directly), falling back to the one-line `summary`. Tool descriptions are
|
|
289
|
+
// NOT part of the frozen surface, so this stays covenant-safe.
|
|
290
|
+
description: verb.doc ?? verb.summary,
|
|
291
|
+
annotations: annotationsFor(verb),
|
|
292
|
+
};
|
|
293
|
+
if (Object.keys(shape).length > 0)
|
|
294
|
+
config.inputSchema = shape;
|
|
295
|
+
const handler = verb.capability.mutates
|
|
296
|
+
? mutateHandler(verb, runtime)
|
|
297
|
+
: readHandler(verb, runtime);
|
|
298
|
+
server.registerTool(toolName(verb.path), config, handler);
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=registerVerb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerVerb.js","sourceRoot":"","sources":["../../../../../src/kernel/project/mcp/registerVerb.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,EAAa,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAA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AClE,4EAA4E;QAC5E,8EAA8E;QAC9E,8EAA8E;QAC9E,kEAAkE;QAClE,KAAK,CAAC,GAAG,GAAG,CAAC;aACV,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,uFAAuF,CACxF,CAAC;IACN,CAAC;IAED,MAAM,MAAM,GAIR;QACF,4EAA4E;QAC5E,yEAAyE;QACzE,2EAA2E;QAC3E,+DAA+D;QAC/D,WAAW,EAAE,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO;QACrC,WAAW,EAAE,cAAc,CAAC,IAAI,CAAC;KAClC,CAAC;IACF,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC;IAE9D,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO;QACrC,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC;QAC9B,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAE/B,MAAM,CAAC,YAAY,CACjB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EACnB,MAAM,EACN,OAAmD,CACpD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serve the MCP projector over stdio.
|
|
3
|
+
*
|
|
4
|
+
* The bin's `mcp` special-case (D9) and the hidden `mcp` meta verb both call
|
|
5
|
+
* this: build the server from the capabilities and connect it to a stdio
|
|
6
|
+
* transport. Kept separate from {@link buildServer} so tests can build a server
|
|
7
|
+
* without touching stdio.
|
|
8
|
+
*/
|
|
9
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
10
|
+
import { loadEffectiveModules } from "../../packs/index.js";
|
|
11
|
+
import { buildServer } from "./buildServer.js";
|
|
12
|
+
/**
|
|
13
|
+
* Build the MCP server and serve it over stdio until the transport closes.
|
|
14
|
+
*
|
|
15
|
+
* The server is a real invocation (not a fast path), so it merges the package-
|
|
16
|
+
* and config-declared story packs into the static capabilities before projecting
|
|
17
|
+
* the tool surface.
|
|
18
|
+
*
|
|
19
|
+
* @param modules - The static capability modules to project.
|
|
20
|
+
* @param cwd - The working directory for the server's runtime.
|
|
21
|
+
* @note Impure — reads config, connects to stdin/stdout.
|
|
22
|
+
*/
|
|
23
|
+
export async function serveMcp(modules, cwd) {
|
|
24
|
+
const dir = cwd ?? process.cwd();
|
|
25
|
+
const effective = await loadEffectiveModules(modules, dir);
|
|
26
|
+
// stderr only — the stdio transport owns stdout, so naming an unusable
|
|
27
|
+
// package story here is safe and reaches the host's server log.
|
|
28
|
+
for (const problem of effective.problems) {
|
|
29
|
+
process.stderr.write(`Ignored story ${problem.source}: ${problem.message}\n`);
|
|
30
|
+
}
|
|
31
|
+
const server = await buildServer(effective.modules, dir);
|
|
32
|
+
const transport = new StdioServerTransport();
|
|
33
|
+
await server.connect(transport);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=serve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../../../src/kernel/project/mcp/serve.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,OAAoC,EACpC,GAAY;IAEZ,MAAM,GAAG,GAAG,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACjC,MAAM,SAAS,GAAG,MAAM,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC3D,uEAAuE;IACvE,gEAAgE;IAChE,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;QACzC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,iBAAiB,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,OAAO,IAAI,CACxD,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACzD,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compact a full URI to its prefixed form using the longest matching
|
|
3
|
+
* namespace. When two registered namespaces both prefix the URI (a base
|
|
4
|
+
* namespace and a sub-namespace), the longer — more specific — one wins.
|
|
5
|
+
* Falls back to the original URI when no namespace matches.
|
|
6
|
+
*
|
|
7
|
+
* @param fullUri - The absolute URI to compact.
|
|
8
|
+
* @param prefixes - A map of prefix to namespace IRI.
|
|
9
|
+
* @returns The `prefix:local` form, or `fullUri` unchanged when none matches.
|
|
10
|
+
*/
|
|
11
|
+
export function compactUri(fullUri, prefixes) {
|
|
12
|
+
let best;
|
|
13
|
+
for (const [prefix, namespace] of Object.entries(prefixes)) {
|
|
14
|
+
if (!fullUri.startsWith(namespace))
|
|
15
|
+
continue;
|
|
16
|
+
if (best === undefined || namespace.length > best.namespace.length) {
|
|
17
|
+
best = { prefix, namespace };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (best === undefined)
|
|
21
|
+
return fullUri;
|
|
22
|
+
return `${best.prefix}:${fullUri.slice(best.namespace.length)}`;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=compactUri.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compactUri.js","sourceRoot":"","sources":["../../../../src/kernel/render/compactUri.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU,CACxB,OAAe,EACf,QAA0C;IAE1C,IAAI,IAAuD,CAAC;IAC5D,KAAK,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3D,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC;YAAE,SAAS;QAC7C,IAAI,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;YACnE,IAAI,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC;IACvC,OAAO,GAAG,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout contracts for the generic list and lookup renderers.
|
|
3
|
+
*
|
|
4
|
+
* These describe *how* a domain's data is projected to text — which columns a
|
|
5
|
+
* list shows, which fields and sections a lookup renders — with no coupling to
|
|
6
|
+
* store shapes, filters, or effects. Domain formatters (PR2+) build these
|
|
7
|
+
* option bags and hand them to {@link renderers}.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../../src/kernel/render/contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progressive-disclosure resolution.
|
|
3
|
+
*
|
|
4
|
+
* A verb renders at one of {@link DETAIL_LEVELS}. The effective level is chosen
|
|
5
|
+
* from four sources, most specific first: the `--detail` flag, the resolved
|
|
6
|
+
* config's `detail`, the verb's own `disclosure.default`, and finally the
|
|
7
|
+
* built-in `"standard"`. Every source is validated upstream (the flag by
|
|
8
|
+
* `readDetail`, the config field by `z.enum` at load, a spec default by the
|
|
9
|
+
* pack grammar), so the fall-back here is a last belt against a source added
|
|
10
|
+
* later without validation — output never fails on disclosure.
|
|
11
|
+
*/
|
|
12
|
+
import { DEFAULT_DETAIL_LEVEL, DETAIL_LEVELS, } from "../../constants.js";
|
|
13
|
+
export { DETAIL_LEVELS };
|
|
14
|
+
/** Type guard: is a string one of the recognized detail levels? */
|
|
15
|
+
function isDetailLevel(value) {
|
|
16
|
+
return DETAIL_LEVELS.includes(value);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the effective disclosure level from its ordered sources.
|
|
20
|
+
*
|
|
21
|
+
* @param sources - Candidate levels, applied most-specific first.
|
|
22
|
+
* @param sources.flag - The explicit `--detail` value, if any.
|
|
23
|
+
* @param sources.config - The resolved config's `detail`, if any.
|
|
24
|
+
* @param sources.specDefault - The verb's `disclosure.default`, if any.
|
|
25
|
+
* @returns The first recognized level, or `"standard"` when none matches.
|
|
26
|
+
*/
|
|
27
|
+
export function resolveDetail(sources) {
|
|
28
|
+
const candidate = sources.flag ??
|
|
29
|
+
sources.config ??
|
|
30
|
+
sources.specDefault ??
|
|
31
|
+
DEFAULT_DETAIL_LEVEL;
|
|
32
|
+
return isDetailLevel(candidate) ? candidate : DEFAULT_DETAIL_LEVEL;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=disclosure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disclosure.js","sourceRoot":"","sources":["../../../../src/kernel/render/disclosure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,oBAAoB,EACpB,aAAa,GAEd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,mEAAmE;AACnE,SAAS,aAAa,CAAC,KAAa;IAClC,OAAQ,aAAmC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,OAI7B;IACC,MAAM,SAAS,GACb,OAAO,CAAC,IAAI;QACZ,OAAO,CAAC,MAAM;QACd,OAAO,CAAC,WAAW;QACnB,oBAAoB,CAAC;IACvB,OAAO,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The machine-output envelope (D3, D4).
|
|
3
|
+
*
|
|
4
|
+
* Both projectors emit the same two shapes: `{ ok: true, data, meta }` for a
|
|
5
|
+
* success and `{ ok: false, error }` for a failure. The CLI writes them to
|
|
6
|
+
* stdout under `--format json`; the MCP projector returns them as tool
|
|
7
|
+
* content. Building both here — from one `successEnvelope` / `errorEnvelope`
|
|
8
|
+
* pair — is what makes CLI-JSON and MCP output provably identical.
|
|
9
|
+
*/
|
|
10
|
+
import { serializeError } from "../error/index.js";
|
|
11
|
+
/**
|
|
12
|
+
* Wrap already-JSON-safe data in the success envelope.
|
|
13
|
+
*
|
|
14
|
+
* @param data - The verb's data projection (JSON-safe).
|
|
15
|
+
* @param meta - Envelope metadata (e.g. plan-first flags); defaults to `{}`.
|
|
16
|
+
* @returns The `{ ok: true, data, meta }` envelope.
|
|
17
|
+
*/
|
|
18
|
+
export function successEnvelope(data, meta = {}) {
|
|
19
|
+
return { ok: true, data, meta };
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Wrap a {@link PragmaError} in the failure envelope.
|
|
23
|
+
*
|
|
24
|
+
* @param error - The structured error to serialize.
|
|
25
|
+
* @returns The `{ ok: false, error }` envelope.
|
|
26
|
+
*/
|
|
27
|
+
export function errorEnvelope(error) {
|
|
28
|
+
return { ok: false, error: serializeError(error) };
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=envelope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../../../src/kernel/render/envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAenD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAa,EACb,OAAgC,EAAE;IAElC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAClC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAkB;IAC9C,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;AACrD,CAAC"}
|