@vibe-agent-toolkit/cli 0.1.42 â 0.2.0-rc.10
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 +4 -5
- package/dist/bin/vat +95 -28
- package/dist/bin/vat.js +95 -28
- package/dist/bin/vat.js.map +1 -1
- package/dist/bin.js +137 -76
- package/dist/bin.js.map +1 -1
- package/dist/command-loaders.d.ts +44 -0
- package/dist/command-loaders.d.ts.map +1 -0
- package/dist/command-loaders.js +60 -0
- package/dist/command-loaders.js.map +1 -0
- package/dist/commands/agent/build.d.ts.map +1 -1
- package/dist/commands/agent/build.js +2 -1
- package/dist/commands/agent/build.js.map +1 -1
- package/dist/commands/agent/import.d.ts.map +1 -1
- package/dist/commands/agent/import.js +3 -2
- package/dist/commands/agent/import.js.map +1 -1
- package/dist/commands/agent/index.js +1 -1
- package/dist/commands/agent/install-path.d.ts +36 -0
- package/dist/commands/agent/install-path.d.ts.map +1 -0
- package/dist/commands/agent/install-path.js +44 -0
- package/dist/commands/agent/install-path.js.map +1 -0
- package/dist/commands/agent/install.d.ts.map +1 -1
- package/dist/commands/agent/install.js +66 -13
- package/dist/commands/agent/install.js.map +1 -1
- package/dist/commands/agent/installed.d.ts.map +1 -1
- package/dist/commands/agent/installed.js +22 -12
- package/dist/commands/agent/installed.js.map +1 -1
- package/dist/commands/agent/list.d.ts.map +1 -1
- package/dist/commands/agent/list.js +2 -1
- package/dist/commands/agent/list.js.map +1 -1
- package/dist/commands/agent/run.d.ts.map +1 -1
- package/dist/commands/agent/run.js +2 -1
- package/dist/commands/agent/run.js.map +1 -1
- package/dist/commands/agent/uninstall.d.ts.map +1 -1
- package/dist/commands/agent/uninstall.js +13 -6
- package/dist/commands/agent/uninstall.js.map +1 -1
- package/dist/commands/agent/validate.d.ts.map +1 -1
- package/dist/commands/agent/validate.js +3 -2
- package/dist/commands/agent/validate.js.map +1 -1
- package/dist/commands/ard/emit.d.ts +153 -0
- package/dist/commands/ard/emit.d.ts.map +1 -0
- package/dist/commands/ard/emit.js +276 -0
- package/dist/commands/ard/emit.js.map +1 -0
- package/dist/commands/ard/index.d.ts +12 -0
- package/dist/commands/ard/index.d.ts.map +1 -0
- package/dist/commands/ard/index.js +80 -0
- package/dist/commands/ard/index.js.map +1 -0
- package/dist/commands/ard/surfaces.d.ts +56 -0
- package/dist/commands/ard/surfaces.d.ts.map +1 -0
- package/dist/commands/ard/surfaces.js +150 -0
- package/dist/commands/ard/surfaces.js.map +1 -0
- package/dist/commands/audit/distributed-tree.d.ts +60 -2
- package/dist/commands/audit/distributed-tree.d.ts.map +1 -1
- package/dist/commands/audit/distributed-tree.js +73 -1
- package/dist/commands/audit/distributed-tree.js.map +1 -1
- package/dist/commands/audit/git-url-clone.d.ts +1 -1
- package/dist/commands/audit/git-url-clone.d.ts.map +1 -1
- package/dist/commands/audit/git-url-clone.js.map +1 -1
- package/dist/commands/audit/hierarchical-output.d.ts +1 -1
- package/dist/commands/audit/hierarchical-output.d.ts.map +1 -1
- package/dist/commands/audit/hierarchical-output.js +1 -1
- package/dist/commands/audit/hierarchical-output.js.map +1 -1
- package/dist/commands/audit/provenance.d.ts.map +1 -1
- package/dist/commands/audit/provenance.js +4 -3
- package/dist/commands/audit/provenance.js.map +1 -1
- package/dist/commands/audit/scan-population.d.ts +158 -0
- package/dist/commands/audit/scan-population.d.ts.map +1 -0
- package/dist/commands/audit/scan-population.js +292 -0
- package/dist/commands/audit/scan-population.js.map +1 -0
- package/dist/commands/audit-settings.d.ts.map +1 -1
- package/dist/commands/audit-settings.js +6 -5
- package/dist/commands/audit-settings.js.map +1 -1
- package/dist/commands/audit.d.ts +98 -8
- package/dist/commands/audit.d.ts.map +1 -1
- package/dist/commands/audit.js +1133 -395
- package/dist/commands/audit.js.map +1 -1
- package/dist/commands/build.d.ts +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +40 -36
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/cache/cache-control.d.ts +82 -0
- package/dist/commands/cache/cache-control.d.ts.map +1 -0
- package/dist/commands/cache/cache-control.js +86 -0
- package/dist/commands/cache/cache-control.js.map +1 -0
- package/dist/commands/cache/clear.d.ts +105 -0
- package/dist/commands/cache/clear.d.ts.map +1 -0
- package/dist/commands/cache/clear.js +248 -0
- package/dist/commands/cache/clear.js.map +1 -0
- package/dist/commands/cache/index.d.ts +18 -0
- package/dist/commands/cache/index.d.ts.map +1 -0
- package/dist/commands/cache/index.js +94 -0
- package/dist/commands/cache/index.js.map +1 -0
- package/dist/commands/claude/claude-config.d.ts.map +1 -1
- package/dist/commands/claude/claude-config.js +6 -0
- package/dist/commands/claude/claude-config.js.map +1 -1
- package/dist/commands/claude/context.d.ts +340 -0
- package/dist/commands/claude/context.d.ts.map +1 -0
- package/dist/commands/claude/context.js +1080 -0
- package/dist/commands/claude/context.js.map +1 -0
- package/dist/commands/claude/index.d.ts +14 -0
- package/dist/commands/claude/index.d.ts.map +1 -1
- package/dist/commands/claude/index.js +22 -2
- package/dist/commands/claude/index.js.map +1 -1
- package/dist/commands/claude/marketplace/changelog-utils.d.ts +1 -1
- package/dist/commands/claude/marketplace/changelog-utils.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/changelog-utils.js +1 -2
- package/dist/commands/claude/marketplace/changelog-utils.js.map +1 -1
- package/dist/commands/claude/marketplace/git-publish.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/git-publish.js +40 -31
- package/dist/commands/claude/marketplace/git-publish.js.map +1 -1
- package/dist/commands/claude/marketplace/license-utils.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/license-utils.js +0 -1
- package/dist/commands/claude/marketplace/license-utils.js.map +1 -1
- package/dist/commands/claude/marketplace/publish-tree.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/publish-tree.js +0 -6
- package/dist/commands/claude/marketplace/publish-tree.js.map +1 -1
- package/dist/commands/claude/marketplace/publish.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/publish.js +2 -1
- package/dist/commands/claude/marketplace/publish.js.map +1 -1
- package/dist/commands/claude/marketplace/validate.d.ts +73 -22
- package/dist/commands/claude/marketplace/validate.d.ts.map +1 -1
- package/dist/commands/claude/marketplace/validate.js +407 -72
- package/dist/commands/claude/marketplace/validate.js.map +1 -1
- package/dist/commands/claude/org/api-keys.d.ts +0 -3
- package/dist/commands/claude/org/api-keys.d.ts.map +1 -1
- package/dist/commands/claude/org/api-keys.js +2 -1
- package/dist/commands/claude/org/api-keys.js.map +1 -1
- package/dist/commands/claude/org/helpers.d.ts +54 -1
- package/dist/commands/claude/org/helpers.d.ts.map +1 -1
- package/dist/commands/claude/org/helpers.js +42 -7
- package/dist/commands/claude/org/helpers.js.map +1 -1
- package/dist/commands/claude/org/index.d.ts.map +1 -1
- package/dist/commands/claude/org/index.js +24 -16
- package/dist/commands/claude/org/index.js.map +1 -1
- package/dist/commands/claude/org/invites.d.ts +0 -3
- package/dist/commands/claude/org/invites.d.ts.map +1 -1
- package/dist/commands/claude/org/invites.js +3 -2
- package/dist/commands/claude/org/invites.js.map +1 -1
- package/dist/commands/claude/org/skills.d.ts +527 -0
- package/dist/commands/claude/org/skills.d.ts.map +1 -1
- package/dist/commands/claude/org/skills.js +1414 -108
- package/dist/commands/claude/org/skills.js.map +1 -1
- package/dist/commands/claude/org/users.d.ts +0 -3
- package/dist/commands/claude/org/users.d.ts.map +1 -1
- package/dist/commands/claude/org/users.js +6 -3
- package/dist/commands/claude/org/users.js.map +1 -1
- package/dist/commands/claude/org/workspaces.d.ts +0 -3
- package/dist/commands/claude/org/workspaces.d.ts.map +1 -1
- package/dist/commands/claude/org/workspaces.js +11 -7
- package/dist/commands/claude/org/workspaces.js.map +1 -1
- package/dist/commands/claude/plugin/build.d.ts +41 -3
- package/dist/commands/claude/plugin/build.d.ts.map +1 -1
- package/dist/commands/claude/plugin/build.js +147 -80
- package/dist/commands/claude/plugin/build.js.map +1 -1
- package/dist/commands/claude/plugin/helpers.d.ts.map +1 -1
- package/dist/commands/claude/plugin/helpers.js +2 -7
- package/dist/commands/claude/plugin/helpers.js.map +1 -1
- package/dist/commands/claude/plugin/install.d.ts +12 -0
- package/dist/commands/claude/plugin/install.d.ts.map +1 -1
- package/dist/commands/claude/plugin/install.js +93 -62
- package/dist/commands/claude/plugin/install.js.map +1 -1
- package/dist/commands/claude/plugin/list.d.ts.map +1 -1
- package/dist/commands/claude/plugin/list.js +3 -2
- package/dist/commands/claude/plugin/list.js.map +1 -1
- package/dist/commands/claude/plugin/marketplace-json.d.ts +24 -9
- package/dist/commands/claude/plugin/marketplace-json.d.ts.map +1 -1
- package/dist/commands/claude/plugin/marketplace-json.js +10 -9
- package/dist/commands/claude/plugin/marketplace-json.js.map +1 -1
- package/dist/commands/claude/plugin/plugin-changelog.d.ts.map +1 -1
- package/dist/commands/claude/plugin/plugin-changelog.js +0 -2
- package/dist/commands/claude/plugin/plugin-changelog.js.map +1 -1
- package/dist/commands/claude/plugin/plugin-files.d.ts.map +1 -1
- package/dist/commands/claude/plugin/plugin-files.js +3 -6
- package/dist/commands/claude/plugin/plugin-files.js.map +1 -1
- package/dist/commands/claude/plugin/plugin-validators.d.ts.map +1 -1
- package/dist/commands/claude/plugin/plugin-validators.js +3 -6
- package/dist/commands/claude/plugin/plugin-validators.js.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.d.ts +73 -0
- package/dist/commands/claude/plugin/tree-copy.d.ts.map +1 -1
- package/dist/commands/claude/plugin/tree-copy.js +221 -14
- package/dist/commands/claude/plugin/tree-copy.js.map +1 -1
- package/dist/commands/claude/plugin/uninstall.d.ts.map +1 -1
- package/dist/commands/claude/plugin/uninstall.js +4 -4
- package/dist/commands/claude/plugin/uninstall.js.map +1 -1
- package/dist/commands/consistency-check.d.ts +17 -15
- package/dist/commands/consistency-check.d.ts.map +1 -1
- package/dist/commands/consistency-check.js +152 -106
- package/dist/commands/consistency-check.js.map +1 -1
- package/dist/commands/corpus/index.d.ts.map +1 -1
- package/dist/commands/corpus/index.js +3 -0
- package/dist/commands/corpus/index.js.map +1 -1
- package/dist/commands/corpus/report.d.ts +1 -2
- package/dist/commands/corpus/report.d.ts.map +1 -1
- package/dist/commands/corpus/report.js +1 -3
- package/dist/commands/corpus/report.js.map +1 -1
- package/dist/commands/corpus/runner.d.ts +58 -1
- package/dist/commands/corpus/runner.d.ts.map +1 -1
- package/dist/commands/corpus/runner.js +95 -41
- package/dist/commands/corpus/runner.js.map +1 -1
- package/dist/commands/corpus/scan.d.ts.map +1 -1
- package/dist/commands/corpus/scan.js +20 -12
- package/dist/commands/corpus/scan.js.map +1 -1
- package/dist/commands/corpus/seed.d.ts +4 -4
- package/dist/commands/corpus/seed.d.ts.map +1 -1
- package/dist/commands/corpus/seed.js +1 -3
- package/dist/commands/corpus/seed.js.map +1 -1
- package/dist/commands/doctor.d.ts +50 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +245 -52
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/inventory.d.ts +13 -1
- package/dist/commands/inventory.d.ts.map +1 -1
- package/dist/commands/inventory.js +128 -17
- package/dist/commands/inventory.js.map +1 -1
- package/dist/commands/mcp/collections.d.ts +1 -1
- package/dist/commands/mcp/collections.d.ts.map +1 -1
- package/dist/commands/mcp/list-collections.d.ts.map +1 -1
- package/dist/commands/mcp/list-collections.js +2 -1
- package/dist/commands/mcp/list-collections.js.map +1 -1
- package/dist/commands/mcp/serve.d.ts.map +1 -1
- package/dist/commands/mcp/serve.js +3 -2
- package/dist/commands/mcp/serve.js.map +1 -1
- package/dist/commands/okf/index.d.ts +11 -0
- package/dist/commands/okf/index.d.ts.map +1 -0
- package/dist/commands/okf/index.js +114 -0
- package/dist/commands/okf/index.js.map +1 -0
- package/dist/commands/okf/validate.d.ts +191 -0
- package/dist/commands/okf/validate.d.ts.map +1 -0
- package/dist/commands/okf/validate.js +190 -0
- package/dist/commands/okf/validate.js.map +1 -0
- package/dist/commands/phase-utils.d.ts +182 -114
- package/dist/commands/phase-utils.d.ts.map +1 -1
- package/dist/commands/phase-utils.js +154 -163
- package/dist/commands/phase-utils.js.map +1 -1
- package/dist/commands/positional-args.d.ts.map +1 -1
- package/dist/commands/positional-args.js +3 -2
- package/dist/commands/positional-args.js.map +1 -1
- package/dist/commands/rag/clear-command.d.ts.map +1 -1
- package/dist/commands/rag/clear-command.js +2 -1
- package/dist/commands/rag/clear-command.js.map +1 -1
- package/dist/commands/rag/index-command.d.ts +64 -0
- package/dist/commands/rag/index-command.d.ts.map +1 -1
- package/dist/commands/rag/index-command.js +72 -6
- package/dist/commands/rag/index-command.js.map +1 -1
- package/dist/commands/rag/index.d.ts.map +1 -1
- package/dist/commands/rag/index.js +23 -10
- package/dist/commands/rag/index.js.map +1 -1
- package/dist/commands/rag/query-command.d.ts.map +1 -1
- package/dist/commands/rag/query-command.js +2 -1
- package/dist/commands/rag/query-command.js.map +1 -1
- package/dist/commands/rag/stats-command.d.ts.map +1 -1
- package/dist/commands/rag/stats-command.js +2 -1
- package/dist/commands/rag/stats-command.js.map +1 -1
- package/dist/commands/resources/builtin-help.d.ts +27 -0
- package/dist/commands/resources/builtin-help.d.ts.map +1 -0
- package/dist/commands/resources/builtin-help.js +46 -0
- package/dist/commands/resources/builtin-help.js.map +1 -0
- package/dist/commands/resources/check-progress.d.ts +154 -0
- package/dist/commands/resources/check-progress.d.ts.map +1 -0
- package/dist/commands/resources/check-progress.js +222 -0
- package/dist/commands/resources/check-progress.js.map +1 -0
- package/dist/commands/resources/check-supervisor.d.ts +465 -0
- package/dist/commands/resources/check-supervisor.d.ts.map +1 -0
- package/dist/commands/resources/check-supervisor.js +573 -0
- package/dist/commands/resources/check-supervisor.js.map +1 -0
- package/dist/commands/resources/check.d.ts +593 -0
- package/dist/commands/resources/check.d.ts.map +1 -0
- package/dist/commands/resources/check.js +1365 -0
- package/dist/commands/resources/check.js.map +1 -0
- package/dist/commands/resources/index.d.ts.map +1 -1
- package/dist/commands/resources/index.js +425 -6
- package/dist/commands/resources/index.js.map +1 -1
- package/dist/commands/resources/query.d.ts +106 -0
- package/dist/commands/resources/query.d.ts.map +1 -0
- package/dist/commands/resources/query.js +177 -0
- package/dist/commands/resources/query.js.map +1 -0
- package/dist/commands/resources/scan.d.ts +24 -0
- package/dist/commands/resources/scan.d.ts.map +1 -1
- package/dist/commands/resources/scan.js +17 -8
- package/dist/commands/resources/scan.js.map +1 -1
- package/dist/commands/resources/validate.d.ts +57 -4
- package/dist/commands/resources/validate.d.ts.map +1 -1
- package/dist/commands/resources/validate.js +224 -56
- package/dist/commands/resources/validate.js.map +1 -1
- package/dist/commands/skill/review-checklist.d.ts +3 -2
- package/dist/commands/skill/review-checklist.d.ts.map +1 -1
- package/dist/commands/skill/review-checklist.js +40 -2
- package/dist/commands/skill/review-checklist.js.map +1 -1
- package/dist/commands/skill/review.d.ts +247 -0
- package/dist/commands/skill/review.d.ts.map +1 -1
- package/dist/commands/skill/review.js +99 -62
- package/dist/commands/skill/review.js.map +1 -1
- package/dist/commands/skill/test/configure.d.ts +56 -0
- package/dist/commands/skill/test/configure.d.ts.map +1 -1
- package/dist/commands/skill/test/configure.js +75 -16
- package/dist/commands/skill/test/configure.js.map +1 -1
- package/dist/commands/skill/test/run.d.ts +63 -10
- package/dist/commands/skill/test/run.d.ts.map +1 -1
- package/dist/commands/skill/test/run.js +258 -77
- package/dist/commands/skill/test/run.js.map +1 -1
- package/dist/commands/skills/build.d.ts +94 -4
- package/dist/commands/skills/build.d.ts.map +1 -1
- package/dist/commands/skills/build.js +325 -97
- package/dist/commands/skills/build.js.map +1 -1
- package/dist/commands/skills/install.d.ts +2 -1
- package/dist/commands/skills/install.d.ts.map +1 -1
- package/dist/commands/skills/install.js +20 -31
- package/dist/commands/skills/install.js.map +1 -1
- package/dist/commands/skills/list.d.ts +2 -1
- package/dist/commands/skills/list.d.ts.map +1 -1
- package/dist/commands/skills/list.js +44 -26
- package/dist/commands/skills/list.js.map +1 -1
- package/dist/commands/skills/package.d.ts +24 -3
- package/dist/commands/skills/package.d.ts.map +1 -1
- package/dist/commands/skills/package.js +42 -17
- package/dist/commands/skills/package.js.map +1 -1
- package/dist/commands/skills/scope-guard.d.ts.map +1 -1
- package/dist/commands/skills/scope-guard.js +3 -5
- package/dist/commands/skills/scope-guard.js.map +1 -1
- package/dist/commands/skills/shared.d.ts.map +1 -1
- package/dist/commands/skills/shared.js +2 -4
- package/dist/commands/skills/shared.js.map +1 -1
- package/dist/commands/skills/skill-discovery.d.ts +47 -6
- package/dist/commands/skills/skill-discovery.d.ts.map +1 -1
- package/dist/commands/skills/skill-discovery.js +66 -16
- package/dist/commands/skills/skill-discovery.js.map +1 -1
- package/dist/commands/skills/source-resolvers.d.ts +15 -0
- package/dist/commands/skills/source-resolvers.d.ts.map +1 -1
- package/dist/commands/skills/source-resolvers.js +25 -4
- package/dist/commands/skills/source-resolvers.js.map +1 -1
- package/dist/commands/skills/validate-command.d.ts.map +1 -1
- package/dist/commands/skills/validate-command.js +11 -3
- package/dist/commands/skills/validate-command.js.map +1 -1
- package/dist/commands/skills/validate.d.ts +140 -4
- package/dist/commands/skills/validate.d.ts.map +1 -1
- package/dist/commands/skills/validate.js +224 -67
- package/dist/commands/skills/validate.js.map +1 -1
- package/dist/commands/validate.d.ts +1 -1
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +63 -27
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/verify.d.ts +119 -15
- package/dist/commands/verify.d.ts.map +1 -1
- package/dist/commands/verify.js +357 -142
- package/dist/commands/verify.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/report-schemas.d.ts +45 -0
- package/dist/report-schemas.d.ts.map +1 -0
- package/dist/report-schemas.js +100 -0
- package/dist/report-schemas.js.map +1 -0
- package/dist/skill-resolution/classify.js +2 -2
- package/dist/skill-resolution/classify.js.map +1 -1
- package/dist/skill-resolution/packaging-config.d.ts +49 -5
- package/dist/skill-resolution/packaging-config.d.ts.map +1 -1
- package/dist/skill-resolution/packaging-config.js +59 -19
- package/dist/skill-resolution/packaging-config.js.map +1 -1
- package/dist/skill-resolution/resolve-skill-reference.d.ts.map +1 -1
- package/dist/skill-resolution/resolve-skill-reference.js +55 -57
- package/dist/skill-resolution/resolve-skill-reference.js.map +1 -1
- package/dist/utils/agent-discovery.d.ts.map +1 -1
- package/dist/utils/agent-discovery.js +22 -11
- package/dist/utils/agent-discovery.js.map +1 -1
- package/dist/utils/agent-runner.d.ts.map +1 -1
- package/dist/utils/agent-runner.js +7 -4
- package/dist/utils/agent-runner.js.map +1 -1
- package/dist/utils/claude-context-lens.d.ts +34 -0
- package/dist/utils/claude-context-lens.d.ts.map +1 -0
- package/dist/utils/claude-context-lens.js +39 -0
- package/dist/utils/claude-context-lens.js.map +1 -0
- package/dist/utils/command-error.d.ts +144 -7
- package/dist/utils/command-error.d.ts.map +1 -1
- package/dist/utils/command-error.js +179 -16
- package/dist/utils/command-error.js.map +1 -1
- package/dist/utils/config-loader.d.ts +2 -1
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-loader.js +40 -14
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/corpus-target.d.ts +26 -0
- package/dist/utils/corpus-target.d.ts.map +1 -0
- package/dist/utils/corpus-target.js +35 -0
- package/dist/utils/corpus-target.js.map +1 -0
- package/dist/utils/edge-lens-evaluation.d.ts +83 -0
- package/dist/utils/edge-lens-evaluation.d.ts.map +1 -0
- package/dist/utils/edge-lens-evaluation.js +110 -0
- package/dist/utils/edge-lens-evaluation.js.map +1 -0
- package/dist/utils/help-loader.d.ts.map +1 -1
- package/dist/utils/help-loader.js +0 -1
- package/dist/utils/help-loader.js.map +1 -1
- package/dist/utils/issue-anchor.d.ts +2 -2
- package/dist/utils/issue-anchor.d.ts.map +1 -1
- package/dist/utils/issue-anchor.js +1 -1
- package/dist/utils/issue-rendering.d.ts +3 -3
- package/dist/utils/issue-rendering.d.ts.map +1 -1
- package/dist/utils/issue-rendering.js +3 -3
- package/dist/utils/issue-rendering.js.map +1 -1
- package/dist/utils/issue-severity.d.ts +12 -5
- package/dist/utils/issue-severity.d.ts.map +1 -1
- package/dist/utils/issue-severity.js +1 -1
- package/dist/utils/issue-severity.js.map +1 -1
- package/dist/utils/optional-backend.d.ts +78 -0
- package/dist/utils/optional-backend.d.ts.map +1 -0
- package/dist/utils/optional-backend.js +117 -0
- package/dist/utils/optional-backend.js.map +1 -0
- package/dist/utils/output.d.ts +26 -0
- package/dist/utils/output.d.ts.map +1 -1
- package/dist/utils/output.js +35 -0
- package/dist/utils/output.js.map +1 -1
- package/dist/utils/package-json.d.ts +24 -0
- package/dist/utils/package-json.d.ts.map +1 -0
- package/dist/utils/package-json.js +49 -0
- package/dist/utils/package-json.js.map +1 -0
- package/dist/utils/population-wiring.d.ts +100 -0
- package/dist/utils/population-wiring.d.ts.map +1 -0
- package/dist/utils/population-wiring.js +98 -0
- package/dist/utils/population-wiring.js.map +1 -0
- package/dist/utils/project-root-policy.d.ts +20 -0
- package/dist/utils/project-root-policy.d.ts.map +1 -1
- package/dist/utils/project-root-policy.js +30 -0
- package/dist/utils/project-root-policy.js.map +1 -1
- package/dist/utils/projection-lenses.d.ts +98 -0
- package/dist/utils/projection-lenses.d.ts.map +1 -0
- package/dist/utils/projection-lenses.js +203 -0
- package/dist/utils/projection-lenses.js.map +1 -0
- package/dist/utils/projection-query.d.ts +324 -0
- package/dist/utils/projection-query.d.ts.map +1 -0
- package/dist/utils/projection-query.js +357 -0
- package/dist/utils/projection-query.js.map +1 -0
- package/dist/utils/projection-store.d.ts +335 -0
- package/dist/utils/projection-store.d.ts.map +1 -0
- package/dist/utils/projection-store.js +522 -0
- package/dist/utils/projection-store.js.map +1 -0
- package/dist/utils/relation-limits.d.ts +50 -0
- package/dist/utils/relation-limits.d.ts.map +1 -0
- package/dist/utils/relation-limits.js +50 -0
- package/dist/utils/relation-limits.js.map +1 -0
- package/dist/utils/repeatable-option.d.ts +37 -0
- package/dist/utils/repeatable-option.d.ts.map +1 -0
- package/dist/utils/repeatable-option.js +39 -0
- package/dist/utils/repeatable-option.js.map +1 -0
- package/dist/utils/resource-loader.d.ts +132 -2
- package/dist/utils/resource-loader.d.ts.map +1 -1
- package/dist/utils/resource-loader.js +288 -27
- package/dist/utils/resource-loader.js.map +1 -1
- package/dist/utils/root-argv.d.ts +53 -0
- package/dist/utils/root-argv.d.ts.map +1 -0
- package/dist/utils/root-argv.js +215 -0
- package/dist/utils/root-argv.js.map +1 -0
- package/dist/utils/run-integrity.d.ts +95 -0
- package/dist/utils/run-integrity.d.ts.map +1 -0
- package/dist/utils/run-integrity.js +102 -0
- package/dist/utils/run-integrity.js.map +1 -0
- package/dist/utils/skill-discovery.d.ts.map +1 -1
- package/dist/utils/skill-discovery.js +2 -1
- package/dist/utils/skill-discovery.js.map +1 -1
- package/dist/utils/skill-packaging-config.d.ts +63 -1
- package/dist/utils/skill-packaging-config.d.ts.map +1 -1
- package/dist/utils/skill-packaging-config.js +56 -1
- package/dist/utils/skill-packaging-config.js.map +1 -1
- package/dist/utils/sqlite-experimental-warning.d.ts +69 -0
- package/dist/utils/sqlite-experimental-warning.d.ts.map +1 -0
- package/dist/utils/sqlite-experimental-warning.js +144 -0
- package/dist/utils/sqlite-experimental-warning.js.map +1 -0
- package/dist/utils/url-redact.d.ts.map +1 -1
- package/dist/utils/url-redact.js +4 -6
- package/dist/utils/url-redact.js.map +1 -1
- package/dist/utils/user-context-scanner.d.ts +8 -0
- package/dist/utils/user-context-scanner.d.ts.map +1 -1
- package/dist/utils/user-context-scanner.js +4 -2
- package/dist/utils/user-context-scanner.js.map +1 -1
- package/dist/utils/validate-help-files.d.ts.map +1 -1
- package/dist/utils/validate-help-files.js +12 -6
- package/dist/utils/validate-help-files.js.map +1 -1
- package/dist/utils/vat-bin-path.d.ts +36 -0
- package/dist/utils/vat-bin-path.d.ts.map +1 -0
- package/dist/utils/vat-bin-path.js +48 -0
- package/dist/utils/vat-bin-path.js.map +1 -0
- package/dist/utils/verdict-helpers.d.ts +1 -1
- package/dist/utils/verdict-helpers.d.ts.map +1 -1
- package/dist/utils/verdict-helpers.js +1 -1
- package/dist/utils/verdict-helpers.js.map +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -3
- package/dist/version.js.map +1 -1
- package/docs/agent.md +2 -2
- package/docs/audit.md +141 -37
- package/docs/doctor.md +7 -6
- package/docs/index.md +40 -12
- package/docs/mcp.md +2 -2
- package/docs/rag.md +3 -2
- package/docs/resources.md +13 -3
- package/docs/skill-test.md +10 -9
- package/docs/skills.md +53 -69
- package/package.json +38 -27
- package/schemas/ard-emit.json +149 -0
- package/schemas/okf-validate.json +170 -0
- package/schemas/resources-check.json +229 -0
- package/schemas/skill-review.json +230 -0
- package/dist/commands/resources/command-helpers.d.ts +0 -5
- package/dist/commands/resources/command-helpers.d.ts.map +0 -1
- package/dist/commands/resources/command-helpers.js +0 -6
- package/dist/commands/resources/command-helpers.js.map +0 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which lenses a run evaluates, and when it does NOT â the selection that keeps
|
|
3
|
+
* the derived relations affordable.
|
|
4
|
+
*
|
|
5
|
+
* ðĻ **The selector over-selects on purpose: a FALSE NEGATIVE fails a run that
|
|
6
|
+
* had an answer.** A lens skipped when its relation is named leaves that
|
|
7
|
+
* relation ABSENT from the run's database, so the statement is refused with
|
|
8
|
+
* `no such table` â loud rather than wrong, because the refusal is SQLite's and
|
|
9
|
+
* does not depend on this scan. The cost that forced the selection, the rules
|
|
10
|
+
* that keep it fail-safe, and why the registry lives in the CLI rather than in a
|
|
11
|
+
* population are in
|
|
12
|
+
* `docs/architecture/zones.md` §2, "A lens is evaluated only when a statement
|
|
13
|
+
* names one of its relations".
|
|
14
|
+
*/
|
|
15
|
+
import { DERIVED_TABLES } from '@vibe-agent-toolkit/resources';
|
|
16
|
+
import { evaluateClaudeContextLens } from './claude-context-lens.js';
|
|
17
|
+
import { evaluateAuthoredLenses } from './edge-lens-evaluation.js';
|
|
18
|
+
/** The authored-link lens: `lens_contexts`, `edges`, `edge_resolutions`. */
|
|
19
|
+
export const AUTHORED_LINK_LENS = {
|
|
20
|
+
name: 'authored-link',
|
|
21
|
+
relations: ['lensContexts', 'edges', 'edgeResolutions'],
|
|
22
|
+
evaluate: ({ projection }) => evaluateAuthoredLenses(projection),
|
|
23
|
+
};
|
|
24
|
+
/** The always-loaded context lens: `claude_context_chains`, `claude_context_loads`. */
|
|
25
|
+
export const CLAUDE_CONTEXT_LENS = {
|
|
26
|
+
name: 'claude-context',
|
|
27
|
+
relations: ['claudeContextChains', 'claudeContextLoads'],
|
|
28
|
+
evaluate: ({ root, logger, cache }) => evaluateClaudeContextLens({ root, logger, cache }),
|
|
29
|
+
};
|
|
30
|
+
/** Every lens the query lane can evaluate, in evaluation order. */
|
|
31
|
+
export const PROJECTION_LENSES = [
|
|
32
|
+
AUTHORED_LINK_LENS,
|
|
33
|
+
CLAUDE_CONTEXT_LENS,
|
|
34
|
+
];
|
|
35
|
+
/**
|
|
36
|
+
* The SQL names of a lens's relations. Read off `DERIVED_TABLES` rather than
|
|
37
|
+
* restated: the SQL name and the registry key are deliberately different
|
|
38
|
+
* vocabularies (`edgeResolutions` is spelled `edge_resolutions`), so a second
|
|
39
|
+
* copy here would be a rename waiting to be missed.
|
|
40
|
+
*
|
|
41
|
+
* @param lens - The lens
|
|
42
|
+
* @returns Its relations as SQL spells them
|
|
43
|
+
*/
|
|
44
|
+
export function lensRelationNames(lens) {
|
|
45
|
+
return lens.relations.map((name) => DERIVED_TABLES[name].name);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The lenses a run has to evaluate, given the statements it declared.
|
|
49
|
+
*
|
|
50
|
+
* @param statements - Every statement the run may ask, or `undefined` when the
|
|
51
|
+
* caller cannot enumerate them. â `undefined` selects EVERY lens â see the
|
|
52
|
+
* header on why the fail-safe direction is not negotiable
|
|
53
|
+
* @returns The lenses to evaluate, in {@link PROJECTION_LENSES} order
|
|
54
|
+
*/
|
|
55
|
+
export function lensesNamedBy(statements) {
|
|
56
|
+
if (statements === undefined)
|
|
57
|
+
return PROJECTION_LENSES;
|
|
58
|
+
const readable = statements.map((sql) => wordsIn(withoutCommentsAndLiterals(sql)));
|
|
59
|
+
return PROJECTION_LENSES.filter((lens) => lensRelationNames(lens).some((relation) => readable.some((words) => namesRelation(words, relation))));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Evaluate one lens and hand back its rows, refusing any that are not exactly
|
|
63
|
+
* the relations it declares.
|
|
64
|
+
*
|
|
65
|
+
* `LensRows` makes every relation optional, so a lens that forgot one compiles â
|
|
66
|
+
* and `writeDerived` would leave that relation empty, a table that reads as a
|
|
67
|
+
* healthy tree. Checked here because this is the one place every lens passes.
|
|
68
|
+
*
|
|
69
|
+
* @param lens - The lens
|
|
70
|
+
* @param input - What it may read
|
|
71
|
+
* @returns Its rows
|
|
72
|
+
* @throws Error When the rows omit a declared relation or carry an undeclared one
|
|
73
|
+
*/
|
|
74
|
+
export async function evaluateLens(lens, input) {
|
|
75
|
+
const rows = await lens.evaluate(input);
|
|
76
|
+
const declared = lens.relations;
|
|
77
|
+
const missing = declared.filter((name) => !Object.hasOwn(rows, name));
|
|
78
|
+
const undeclared = Object.keys(rows).filter((name) => !declared.includes(name));
|
|
79
|
+
if (missing.length > 0 || undeclared.length > 0) {
|
|
80
|
+
throw new Error(`Lens "${lens.name}" must produce exactly [${declared.join(', ')}];`
|
|
81
|
+
+ ` missing [${missing.join(', ')}], undeclared [${undeclared.join(', ')}]`);
|
|
82
|
+
}
|
|
83
|
+
return rows;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Blank out the parts of a statement that cannot name a table: line comments,
|
|
87
|
+
* block comments and single-quoted string literals. Quoted IDENTIFIERS
|
|
88
|
+
* (`"edges"`, `[edges]`, backticked) are deliberately left alone â those ARE
|
|
89
|
+
* table references, spelled differently. Replaced with spaces rather than
|
|
90
|
+
* removed, so a block comment between `FROM` and `edges` cannot let the two run
|
|
91
|
+
* together.
|
|
92
|
+
*
|
|
93
|
+
* @param sql - The statement
|
|
94
|
+
* @returns The statement with every non-code span blanked
|
|
95
|
+
*/
|
|
96
|
+
function withoutCommentsAndLiterals(sql) {
|
|
97
|
+
let out = '';
|
|
98
|
+
let index = 0;
|
|
99
|
+
while (index < sql.length) {
|
|
100
|
+
const end = spanEnd(sql, index);
|
|
101
|
+
if (end === undefined) {
|
|
102
|
+
out += sql.charAt(index);
|
|
103
|
+
index += 1;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const span = sql.slice(index, end);
|
|
107
|
+
out += QUOTED_IDENTIFIER_CLOSERS.has(span.charAt(0)) ? span : ' '.repeat(span.length);
|
|
108
|
+
index = end;
|
|
109
|
+
}
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
112
|
+
/** The characters that open a quoted identifier, and the one that closes each. */
|
|
113
|
+
const QUOTED_IDENTIFIER_CLOSERS = new Map([['"', '"'], ['[', ']'], ['`', '`']]);
|
|
114
|
+
/** Every quoted span's opener and closer: the identifiers, plus `'` for a literal. */
|
|
115
|
+
const QUOTE_CLOSERS = new Map([...QUOTED_IDENTIFIER_CLOSERS, ["'", "'"]]);
|
|
116
|
+
/**
|
|
117
|
+
* Where a span starting at `start` ends: a line comment, a block comment, a
|
|
118
|
+
* single-quoted literal â or a quoted IDENTIFIER, consumed only so it can be
|
|
119
|
+
* handed back unblanked.
|
|
120
|
+
*
|
|
121
|
+
* â Quoted identifiers MUST be consumed by this same scan even though their
|
|
122
|
+
* contents stay code, and the reason is the whole of this function. SQLite gives
|
|
123
|
+
* `'`, `--` and `/*` no meaning inside `"âĶ"`, `[âĶ]` or `` `âĶ` ``. A scanner that
|
|
124
|
+
* skips those spans lets a character inside one open a literal or a comment that
|
|
125
|
+
* SQLite never opened, desynchronises, and blanks a span of REAL SQL â taking the
|
|
126
|
+
* relation name with it. The statement then reads an EMPTY relation and answers 0
|
|
127
|
+
* instead of being refused, which for a declared check is a silent exit 0: a gate
|
|
128
|
+
* that cannot fail.
|
|
129
|
+
*
|
|
130
|
+
* Scanning left to right is what keeps the spans mutually exclusive: a comment
|
|
131
|
+
* marker inside a literal is never looked at, nor a quote inside a comment.
|
|
132
|
+
*
|
|
133
|
+
* @param sql - The statement
|
|
134
|
+
* @param start - Where to look
|
|
135
|
+
* @returns The index just past the span, or undefined when none opens here
|
|
136
|
+
*/
|
|
137
|
+
function spanEnd(sql, start) {
|
|
138
|
+
const pair = sql.slice(start, start + 2);
|
|
139
|
+
if (pair === '--') {
|
|
140
|
+
const newline = sql.indexOf('\n', start);
|
|
141
|
+
return newline === -1 ? sql.length : newline;
|
|
142
|
+
}
|
|
143
|
+
if (pair === '/*') {
|
|
144
|
+
const close = sql.indexOf('*/', start + 2);
|
|
145
|
+
return close === -1 ? undefined : close + 2;
|
|
146
|
+
}
|
|
147
|
+
const closer = QUOTE_CLOSERS.get(sql.charAt(start));
|
|
148
|
+
return closer === undefined ? undefined : quotedEnd(sql, start, closer);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Where a quoted span ends. A doubled closer (`''`, `""`, two backticks) is an
|
|
152
|
+
* escaped one; `[âĶ]` has no escape. Left unterminated, the span ends at the last
|
|
153
|
+
* doubled closer instead â what the single pattern this replaced did by
|
|
154
|
+
* backtracking.
|
|
155
|
+
*
|
|
156
|
+
* @param sql - The statement
|
|
157
|
+
* @param start - The opening quote
|
|
158
|
+
* @param closer - The character that closes it
|
|
159
|
+
* @returns The index just past the span, or undefined when it never closes
|
|
160
|
+
*/
|
|
161
|
+
function quotedEnd(sql, start, closer) {
|
|
162
|
+
let fallback;
|
|
163
|
+
let from = start + 1;
|
|
164
|
+
for (;;) {
|
|
165
|
+
const close = sql.indexOf(closer, from);
|
|
166
|
+
if (close === -1)
|
|
167
|
+
return fallback;
|
|
168
|
+
if (closer === ']' || sql.charAt(close + 1) !== closer)
|
|
169
|
+
return close + 1;
|
|
170
|
+
fallback = close + 1;
|
|
171
|
+
from = close + 2;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Every whole word in a statement, lowercased.
|
|
176
|
+
*
|
|
177
|
+
* Relation names are `[a-z_]` only and `_` is a word character, so membership in
|
|
178
|
+
* this set answers exactly what a `\b`-anchored search would: `my_edges`
|
|
179
|
+
* tokenizes whole and never answers for `edges`. One pass per statement, rather
|
|
180
|
+
* than one pattern per relation, and no `RegExp` built from a variable.
|
|
181
|
+
*
|
|
182
|
+
* @param sql - The statement, already stripped of comments and literals
|
|
183
|
+
* @returns Its identifier-character runs, lowercased
|
|
184
|
+
*/
|
|
185
|
+
function wordsIn(sql) {
|
|
186
|
+
return new Set((sql.match(IDENTIFIER_RUNS) ?? []).map((word) => word.toLowerCase()));
|
|
187
|
+
}
|
|
188
|
+
/** Runs of identifier characters â SQL's word boundaries, the `\b` equivalent. */
|
|
189
|
+
const IDENTIFIER_RUNS = /[a-z0-9_]+/gi;
|
|
190
|
+
/**
|
|
191
|
+
* Does a statement's word set name this relation?
|
|
192
|
+
*
|
|
193
|
+
* Case-folds the relation as well as the words: a registry name spelled with an
|
|
194
|
+
* uppercase letter would otherwise miss every statement silently.
|
|
195
|
+
*
|
|
196
|
+
* @param words - The statement's words, from {@link wordsIn}
|
|
197
|
+
* @param relation - The relation's SQL name
|
|
198
|
+
* @returns True when the statement could be reading that relation
|
|
199
|
+
*/
|
|
200
|
+
function namesRelation(words, relation) {
|
|
201
|
+
return words.has(relation.toLowerCase());
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=projection-lenses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection-lenses.js","sourceRoot":"","sources":["../../src/utils/projection-lenses.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,cAAc,EAAgE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GAAG,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;AACvF,CAAC;AAED,kFAAkF;AAClF,MAAM,eAAe,GAAG,cAAc,CAAC;AAEvC;;;;;;;;;GASG;AACH,SAAS,aAAa,CAAC,KAA0B,EAAE,QAAgB;IACjE,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Populating a tree's resource projection and putting it somewhere ASKABLE â
|
|
3
|
+
* the shared half of every command that runs SQL over it.
|
|
4
|
+
*
|
|
5
|
+
* `vat resources query` runs one statement a person typed; `vat resources check`
|
|
6
|
+
* runs the statements a project wrote down. They differ in what they do with
|
|
7
|
+
* rows and in nothing else: same population, same store selection, same
|
|
8
|
+
* ephemeral fallback, same cache tell. This module is that "and in nothing
|
|
9
|
+
* else", stated once so the two cannot drift into answering about different
|
|
10
|
+
* corpora.
|
|
11
|
+
*
|
|
12
|
+
* ## ðĻ The SQL ALWAYS runs against a per-run in-memory database. Never the store.
|
|
13
|
+
*
|
|
14
|
+
* This is a correctness property, not an optimisation choice, and it was learned
|
|
15
|
+
* the expensive way. The on-disk projection store is **one database per VAT
|
|
16
|
+
* release, shared by every root on the machine** (`defaultStoreDirectory()` is
|
|
17
|
+
* `tmpdir/.vat-cache/<version>/projection-<shapeDigest>`), it retains three tree
|
|
18
|
+
* hashes per root, and its blob tier is never evicted and carries no tree key at
|
|
19
|
+
* all. `ProjectionStore.readExtent` narrows by `(rootId, treeHash)`; **arbitrary
|
|
20
|
+
* SQL does not**, and cannot be made to â a `WHERE` clause the caller wrote is
|
|
21
|
+
* not a key predicate.
|
|
22
|
+
*
|
|
23
|
+
* So running a user's statement against the file-backed store answered from
|
|
24
|
+
* every projection on the machine. Measured on a two-file scratch repository:
|
|
25
|
+
* `SELECT COUNT(*) FROM resource_realizations` returned **3** with no store and
|
|
26
|
+
* **5,779** with one, and `WHERE path LIKE 'packages/%'` returned paths from a
|
|
27
|
+
* different repository entirely. That is a wrong answer and a cross-project
|
|
28
|
+
* disclosure of link text, heading text and frontmatter â the same material
|
|
29
|
+
* `store.ts` cites as the reason it chmods the cache `0o700`.
|
|
30
|
+
*
|
|
31
|
+
* â The store's job is to make the POPULATION cheap, and that is all. Whatever
|
|
32
|
+
* `populate()` returns â served from the store or derived â is written into a
|
|
33
|
+
* fresh in-memory database that holds this tree and nothing else, and the SQL
|
|
34
|
+
* runs there. The saving is untouched (it was always in the population: on this
|
|
35
|
+
* repository {@link ProjectionProvenance.populationMs} reads 1.16-1.18 s derived
|
|
36
|
+
* against 0.29-0.31 s served), and "one tree, one answer" stops being a claim
|
|
37
|
+
* about how callers behave and becomes a property of the shape.
|
|
38
|
+
*
|
|
39
|
+
* ## The store never reaches a caller
|
|
40
|
+
*
|
|
41
|
+
* Work runs against an `ask` closure rather than a store handle. That is
|
|
42
|
+
* deliberate: `utils/projection-store.ts` is the one module in the toolkit that
|
|
43
|
+
* knows `@vibe-agent-toolkit/projection-sqlite` exists, and handing commands a
|
|
44
|
+
* backend-typed object would spread that knowledge to every future verb. A
|
|
45
|
+
* closure also puts the legible-failure wrapper on the single path that can
|
|
46
|
+
* throw, so no command can forget it.
|
|
47
|
+
*/
|
|
48
|
+
import { type Projection } from '@vibe-agent-toolkit/resources';
|
|
49
|
+
import type { Logger } from './logger.js';
|
|
50
|
+
/** Where the POPULATION a statement ran against came from. */
|
|
51
|
+
export type PopulationOrigin = 'derived' | 'store';
|
|
52
|
+
/**
|
|
53
|
+
* What a run's rows are, and where they came from.
|
|
54
|
+
*
|
|
55
|
+
* â ïļ There is deliberately no `engine` field beside these. An earlier version
|
|
56
|
+
* published one (`sqlite | ephemeral`) to say which database answered the SQL;
|
|
57
|
+
* it is gone because the answer is now always the same â see the header â and a
|
|
58
|
+
* field with one possible value tells a reader nothing while implying the other
|
|
59
|
+
* value is reachable.
|
|
60
|
+
*/
|
|
61
|
+
export interface ProjectionProvenance {
|
|
62
|
+
/**
|
|
63
|
+
* ð The cache tell. Reported rather than inferred, because it CANNOT be
|
|
64
|
+
* inferred: a correct store hit and a correct re-derivation produce identical
|
|
65
|
+
* rows. A hit short-circuits `populate()` before the builder exists, so no
|
|
66
|
+
* contributor timing is filed â an empty record list IS the hit.
|
|
67
|
+
*
|
|
68
|
+
* It describes the POPULATION, which is the only thing the store now affects.
|
|
69
|
+
*/
|
|
70
|
+
readonly population: PopulationOrigin;
|
|
71
|
+
/**
|
|
72
|
+
* ð What that origin was WORTH. {@link population} says whether the
|
|
73
|
+
* projection was served or re-derived; this says what the difference cost, so
|
|
74
|
+
* the tell stops being a bare label a reader has to take on faith.
|
|
75
|
+
*
|
|
76
|
+
* Measured as THIS field, by running `vat resources query 'SELECT COUNT(*) AS
|
|
77
|
+
* n FROM blobs'` against this repository three times per arm with the parse
|
|
78
|
+
* cache warm: **1.16-1.18 s derived against 0.29-0.31 s served**. With a cold
|
|
79
|
+
* parse cache the derived arm is 33-35 s, so the pair above is the store's
|
|
80
|
+
* saving and not the parse cache's.
|
|
81
|
+
*
|
|
82
|
+
* The wall time of the SHARED setup and nothing else: everything
|
|
83
|
+
* {@link withQueriedProjection} does before it hands control to the caller's
|
|
84
|
+
* work â opening the population cache (which, when a store is selected, is a
|
|
85
|
+
* `git write-tree` spawn plus the backend's dynamic import and
|
|
86
|
+
* `openSqliteProjectionStore()`), the git tracker, `buildResourceProjection`,
|
|
87
|
+
* opening the ephemeral database, and writing the blob tier and the extent
|
|
88
|
+
* into it.
|
|
89
|
+
*
|
|
90
|
+
* â ïļ The population cache's CLOSE is outside it, necessarily: that runs in
|
|
91
|
+
* `withPopulationCache`'s `finally`, after the caller's work returns, and a
|
|
92
|
+
* span that ends before the work begins cannot contain it. It is a handle
|
|
93
|
+
* release, not population.
|
|
94
|
+
*
|
|
95
|
+
* ðŠĪ **The span's start is load-bearing, and moving it inward is silent.**
|
|
96
|
+
* This shipped with the clock started on the first line INSIDE
|
|
97
|
+
* `withPopulationCache`'s callback â which put the population-cache open, the
|
|
98
|
+
* only part of the setup a store adds, OUTSIDE the measurement, and only on
|
|
99
|
+
* the arm where a store exists. Measured on a two-file corpus with identical
|
|
100
|
+
* total wall time on both arms: no store 0.145 of 0.146 s, cold store 0.0475
|
|
101
|
+
* of 0.161 s. Same work, `populationSecs` three times apart, and a reader
|
|
102
|
+
* comparing a no-store run to a warm-store run read a 42x saving where the
|
|
103
|
+
* honest totals differ by 1.75x. The field was added to stop the cache tell
|
|
104
|
+
* being a label taken on faith and had become the artifact instead. A
|
|
105
|
+
* measurement that flatters one arm is this repository's most-repeated
|
|
106
|
+
* defect; the system suite now pins `populationSecs / durationSecs > 0.6` on a
|
|
107
|
+
* cold run so the next inward move is red rather than quiet.
|
|
108
|
+
*
|
|
109
|
+
* ## Why it belongs on shared provenance rather than on one verb
|
|
110
|
+
*
|
|
111
|
+
* Both verbs pay it, identically, because it is the half of the run they hold
|
|
112
|
+
* in common â a `check` that runs forty statements and a `query` that runs one
|
|
113
|
+
* do the same population first. And a per-statement cost is UNREADABLE without
|
|
114
|
+
* it: `vat resources check` publishes what each rule's SQL cost, and a reader
|
|
115
|
+
* handed forty small numbers and a large total has no way to tell an expensive
|
|
116
|
+
* rule from a setup everybody shares. Absent this field the only arithmetic
|
|
117
|
+
* available is "total minus the statements", which silently attributes the
|
|
118
|
+
* shared setup to whichever rule the reader is looking at.
|
|
119
|
+
*
|
|
120
|
+
* â ïļ Measured with `performance.now()`, not `Date.now()`. A warm population
|
|
121
|
+
* lands well under a millisecond on a small tree, and a millisecond-granularity
|
|
122
|
+
* clock reports that as `0` â which reads as "not measured" rather than "very
|
|
123
|
+
* fast", turning the best case the store has into its least credible number.
|
|
124
|
+
*
|
|
125
|
+
* â ïļ Deliberately ONE number, not a breakdown. Splitting it into crawl, parse
|
|
126
|
+
* and store-load is a real question and it is the lab's: an instrument that
|
|
127
|
+
* gets reviewed and re-run, rather than a product document that would then owe
|
|
128
|
+
* every consumer a stable sub-phase vocabulary.
|
|
129
|
+
*/
|
|
130
|
+
readonly populationMs: number;
|
|
131
|
+
/**
|
|
132
|
+
* The lenses this run evaluated, by name, in evaluation order.
|
|
133
|
+
*
|
|
134
|
+
* ð **Published because "which lenses ran" became a DECISION, and an
|
|
135
|
+
* unpublished decision is one nobody can check.** Without it an empty derived
|
|
136
|
+
* relation is ambiguous â no rows, or no evaluation? This is the tell, in the
|
|
137
|
+
* same family as {@link population}, and what makes a `lensSecs` of `0`
|
|
138
|
+
* legible rather than alarming.
|
|
139
|
+
*
|
|
140
|
+
* â ïļ Not the only guard: a relation no evaluated lens produced does not
|
|
141
|
+
* EXIST in the run's database, so a statement naming it is refused by SQLite
|
|
142
|
+
* (see {@link withQueriedProjection}). This field explains a cheap run rather
|
|
143
|
+
* than excusing a blind one.
|
|
144
|
+
*/
|
|
145
|
+
readonly lensesEvaluated: readonly string[];
|
|
146
|
+
/**
|
|
147
|
+
* What EVALUATING THE LENSES cost, separately from populating the tree.
|
|
148
|
+
*
|
|
149
|
+
* Separate because the two answer different questions and a reader must be
|
|
150
|
+
* able to tell them apart. Population is work every verb pays and the store
|
|
151
|
+
* can make cheap; this is work the *derived relations* cost, and a store hit
|
|
152
|
+
* does NOT make an authored-link evaluation cheaper â it is a pass over the
|
|
153
|
+
* served rows just as over derived ones. Folded into `populationMs` it would
|
|
154
|
+
* look like the store getting worse.
|
|
155
|
+
*
|
|
156
|
+
* â ïļ **Not an unconditional cost.** A run whose statements name no derived
|
|
157
|
+
* relation evaluates nothing and reports `0`; {@link lensesEvaluated} says
|
|
158
|
+
* which lenses the number covers.
|
|
159
|
+
*
|
|
160
|
+
* â ïļ **DISJOINT from `populationMs`, and that is enforced by where the
|
|
161
|
+
* population clock stops, not by convention.** It shipped overlapping: the
|
|
162
|
+
* population span ended after the lens write, so this value was contained in
|
|
163
|
+
* that one while all three docstrings said otherwise, and anyone adding the
|
|
164
|
+
* two over-counted wall time. If you move either clock, keep them disjoint â
|
|
165
|
+
* a reader comparing a served run against a derived one is the whole reason
|
|
166
|
+
* they are two fields.
|
|
167
|
+
*
|
|
168
|
+
* â ïļ Published rather than merely measured, because a cost that is invisible
|
|
169
|
+
* is the one nobody can argue with. It is the evidence the selection above
|
|
170
|
+
* rests on, and the evidence any future flag would rest on.
|
|
171
|
+
*/
|
|
172
|
+
readonly lensMs: number;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* How much of the tree the population actually covered.
|
|
176
|
+
*
|
|
177
|
+
* ## Why this is not a field on {@link ProjectionProvenance}
|
|
178
|
+
*
|
|
179
|
+
* Provenance is a fact both verbs PUBLISH verbatim â "these rows were served or
|
|
180
|
+
* re-derived" is the same sentence in either document. This is a fact a verb
|
|
181
|
+
* REASONS with, and only one of them has anything to reason about: `vat
|
|
182
|
+
* resources query` prints the rows a person selected, so its reader can see the
|
|
183
|
+
* extent for themselves, while `vat resources check` prints a verdict and a
|
|
184
|
+
* count of rules. Only the second can pass vacuously, and only the second needs
|
|
185
|
+
* to know.
|
|
186
|
+
*
|
|
187
|
+
* ## ð The failure it exists to make visible
|
|
188
|
+
*
|
|
189
|
+
* `vat resources check` reported how many CHECKS ran; nothing said how many ROWS
|
|
190
|
+
* they ran against. So "four checks passed over eight thousand files" and "four
|
|
191
|
+
* checks passed over ZERO files" were byte-identical documents, and the second
|
|
192
|
+
* was a green gate asserting nothing. A broad `.gitignore`, a shallow or sparse
|
|
193
|
+
* checkout, a root that resolved elsewhere, or an extent source that enumerated
|
|
194
|
+
* nothing all produce it â and `buildResourceProjection` DECLINES ignored
|
|
195
|
+
* members rather than flagging them, so an emptied enumeration leaves no trace
|
|
196
|
+
* in the tables either.
|
|
197
|
+
*/
|
|
198
|
+
export interface PopulationExtent {
|
|
199
|
+
/**
|
|
200
|
+
* One per `(extentId, path)` row the population enumerated.
|
|
201
|
+
*
|
|
202
|
+
* ðŠĪ Realizations rather than any other count, because every alternative
|
|
203
|
+
* fails to reach zero on the case that matters: `roots` always holds exactly
|
|
204
|
+
* one row (the invariant thrown for below), so a total over all thirteen tables
|
|
205
|
+
* is never 0; `blobs` is content-keyed and deduped, so it counts parse REACH
|
|
206
|
+
* and already has its own guard in `onBlobPopulation`; and `resources` counts
|
|
207
|
+
* identities, which a corpus can legitimately have none of while enumerating
|
|
208
|
+
* plenty. One row per enumerated path is non-zero exactly when something was
|
|
209
|
+
* enumerated.
|
|
210
|
+
*/
|
|
211
|
+
readonly membersEnumerated: number;
|
|
212
|
+
}
|
|
213
|
+
/** One statement a run intends to ask, with the values it will bind to it. */
|
|
214
|
+
export interface PreflightStatement {
|
|
215
|
+
readonly sql: string;
|
|
216
|
+
/** Bound in order, one per `?`. Empty for a statement that binds nothing. */
|
|
217
|
+
readonly parameters: readonly string[];
|
|
218
|
+
}
|
|
219
|
+
/** Run one read-only statement against the populated projection. */
|
|
220
|
+
export type AskProjection = (sql: string, ...parameters: readonly string[]) => readonly Record<string, unknown>[];
|
|
221
|
+
/**
|
|
222
|
+
* Compile every statement a run intends to ask, against the schema and NO rows,
|
|
223
|
+
* before anything is populated.
|
|
224
|
+
*
|
|
225
|
+
* ## ð What this buys, measured
|
|
226
|
+
*
|
|
227
|
+
* SQLite resolves table and column names when a statement is *prepared*, not
|
|
228
|
+
* when it is stepped â so a typo is knowable before a single row exists. It was
|
|
229
|
+
* not knowable in practice, because the only place a statement met the schema
|
|
230
|
+
* was after the projection had been built. On a real adopter tree, `SELECT path,
|
|
231
|
+
* no_such_column âĶ` cost **8.3 s**, every millisecond of it spent building a
|
|
232
|
+
* projection the statement could never have read. The same typo now costs the
|
|
233
|
+
* price of an empty in-memory database â one extra `createSchema` into
|
|
234
|
+
* `:memory:`, which is the whole overhead this adds on the happy path.
|
|
235
|
+
*
|
|
236
|
+
* It also moves the KIND refusals â a second statement, an `ATTACH`, a `PRAGMA`
|
|
237
|
+
* â in front of the population, so a statement rejected for what it is costs no
|
|
238
|
+
* more than one rejected for what it names.
|
|
239
|
+
*
|
|
240
|
+
* â ïļ **This is a pre-flight, not a second gate.** `ask` still compiles and runs
|
|
241
|
+
* the real statement against the real projection, and nothing here is trusted in
|
|
242
|
+
* place of that. A statement that compiles here can still fail there â SQLite
|
|
243
|
+
* resolves names against a schema, and this is the same schema, but a run-time
|
|
244
|
+
* error (a bad cast, an overflow) belongs to stepping and is unreachable from a
|
|
245
|
+
* prepare.
|
|
246
|
+
*
|
|
247
|
+
* â ïļ It deliberately does not STEP anything. Stepping is where a check's
|
|
248
|
+
* unbounded cost lives, and a preflight that ran `WITH RECURSIVE âĶ` would hang
|
|
249
|
+
* before the run it exists to make cheap had begun.
|
|
250
|
+
*
|
|
251
|
+
* â ïļ Each statement comes WITH the values it will be bound to, because the
|
|
252
|
+
* placeholder count is part of what compiles: a `?` the caller forgot to bind is
|
|
253
|
+
* SQL NULL at run time, and the statement then selects nothing and reports
|
|
254
|
+
* success â the same silent class as a typo'd column, and worth the same early
|
|
255
|
+
* refusal. The backend does the counting; this only has to hand it the values.
|
|
256
|
+
*
|
|
257
|
+
* @param statements - Every statement the run will ask, in any order, each with
|
|
258
|
+
* the values it will bind
|
|
259
|
+
* @throws The same legible failure `ask` throws, for the first statement that
|
|
260
|
+
* does not compile or does not pair its placeholders with its values
|
|
261
|
+
*/
|
|
262
|
+
export declare function assertQueriesCompile(statements: readonly PreflightStatement[]): Promise<void>;
|
|
263
|
+
/**
|
|
264
|
+
* Populate the tree, load it into something askable, and hand the caller a way
|
|
265
|
+
* to ask.
|
|
266
|
+
*
|
|
267
|
+
* @param options - The run
|
|
268
|
+
* @param options.root - Absolute corpus root
|
|
269
|
+
* @param options.logger - Where blob-stage refusals are reported (stderr, so a
|
|
270
|
+
* parseable document on stdout stays parseable)
|
|
271
|
+
* @param options.preflight - Every statement this run intends to ask, compiled
|
|
272
|
+
* against the empty schema BEFORE the population starts. See
|
|
273
|
+
* {@link assertQueriesCompile}
|
|
274
|
+
* @param options.statements - Every statement this run may ask, for LENS
|
|
275
|
+
* SELECTION only â never compiled, never bound, and deliberately separate from
|
|
276
|
+
* `preflight`. â Omitting it evaluates EVERY lens, which is the correct answer
|
|
277
|
+
* and the expensive one
|
|
278
|
+
* @param work - Given the asker, where its rows came from, how much of the tree
|
|
279
|
+
* they cover, and the ROWS THEMSELVES. The store is open for exactly this call
|
|
280
|
+
* and closed however it ends
|
|
281
|
+
* @returns Whatever `work` returned
|
|
282
|
+
*/
|
|
283
|
+
export declare function withQueriedProjection<T>(options: {
|
|
284
|
+
root: string;
|
|
285
|
+
logger: Logger;
|
|
286
|
+
preflight?: readonly PreflightStatement[];
|
|
287
|
+
statements?: readonly string[];
|
|
288
|
+
}, work: (ask: AskProjection, provenance: ProjectionProvenance, extent: PopulationExtent, projection: Projection) => Promise<T> | T): Promise<T>;
|
|
289
|
+
/**
|
|
290
|
+
* Turn a rejected statement into a message that names the surface it missed.
|
|
291
|
+
*
|
|
292
|
+
* ## Why this wrapper exists
|
|
293
|
+
*
|
|
294
|
+
* VAT ships no schema version, by standing rule â the *cache* is safe across a
|
|
295
|
+
* shape change because its digest self-invalidates, but submitted SQL is not: it
|
|
296
|
+
* simply breaks. Pre-1.0 that is acceptable. A raw SQLite error reaching the
|
|
297
|
+
* user is not, because `no such column: contentHash` says nothing about what the
|
|
298
|
+
* column is called now. It matters more for a CHECK than for a query: a query's
|
|
299
|
+
* author is at the keyboard, while a check's author wrote it months ago and the
|
|
300
|
+
* person reading the failure is someone else.
|
|
301
|
+
*
|
|
302
|
+
* â ïļ **A legibility wrapper, not a validator.** It does not parse SQL and does
|
|
303
|
+
* not check a statement before running it â it reacts to a failure by listing
|
|
304
|
+
* what the query COULD have named. When the statement mentions a known table,
|
|
305
|
+
* that table's columns are listed, which is the case that actually answers "what
|
|
306
|
+
* moved"; otherwise the table names are, which at least answers "what is there".
|
|
307
|
+
*
|
|
308
|
+
* ðŠĪ **Only a name that was not found gets the listing.** The engine also refuses
|
|
309
|
+
* a write and this backend refuses a second statement, and neither is answered by
|
|
310
|
+
* a column list â appending one says the problem is the schema when the problem
|
|
311
|
+
* is what the caller asked for. A wrapper that decorates every failure identically
|
|
312
|
+
* teaches the reader to skip the decoration, which costs the case it was written for.
|
|
313
|
+
*
|
|
314
|
+
* Matching is a plain lowercase substring test rather than a regex: the input is
|
|
315
|
+
* user text, and a pattern built from it is both a lint failure here and a
|
|
316
|
+
* needless hazard.
|
|
317
|
+
*
|
|
318
|
+
* @param sql - The statement that was submitted
|
|
319
|
+
* @param message - What the engine said
|
|
320
|
+
* @returns The message to surface, with the queryable surface appended when the
|
|
321
|
+
* failure was a name this projection does not have
|
|
322
|
+
*/
|
|
323
|
+
export declare function describeQueryFailure(sql: string, message: string): string;
|
|
324
|
+
//# sourceMappingURL=projection-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection-query.d.ts","sourceRoot":"","sources":["../../src/utils/projection-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAIH,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAsB1C,8DAA8D;AAC9D,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,OAAO,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0DG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAE5C;;;;;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