@dev-sergeev/datalab-kit 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +23 -5
- package/THIRD_PARTY_NOTICES.md +6 -2
- package/dist/extension.js +8 -1
- package/dist/recap.d.ts +2 -0
- package/dist/recap.js +31 -0
- package/docs/adr/0002-package-delivery.md +2 -0
- package/node_modules/@pi-plugins/elapsed/LICENSE +21 -0
- package/node_modules/@pi-plugins/elapsed/README.md +45 -0
- package/node_modules/@pi-plugins/elapsed/dist/index.d.mts +8 -0
- package/node_modules/@pi-plugins/elapsed/dist/index.d.mts.map +1 -0
- package/node_modules/@pi-plugins/elapsed/dist/index.mjs +47 -0
- package/node_modules/@pi-plugins/elapsed/dist/index.mjs.map +1 -0
- package/node_modules/@pi-plugins/elapsed/package.json +65 -0
- package/node_modules/@tifan/pi-recap/README.md +61 -0
- package/node_modules/@tifan/pi-recap/package.json +43 -0
- package/node_modules/@tifan/pi-recap/src/index.ts +584 -0
- package/node_modules/@tifan/pi-recap/src/model-picker.ts +233 -0
- package/node_modules/@tifan/pi-recap/src/models.ts +183 -0
- package/node_modules/@tifan/pi-recap/src/sanitize.ts +119 -0
- package/node_modules/@tifan/pi-recap/src/tui.ts +155 -0
- package/node_modules/@zigai/pi-extension-internals/README.md +24 -0
- package/node_modules/@zigai/pi-extension-internals/dist/editor-enhancer-registry.d.ts +21 -0
- package/node_modules/@zigai/pi-extension-internals/dist/editor-enhancer-registry.js +233 -0
- package/node_modules/@zigai/pi-extension-internals/dist/index.d.ts +6 -0
- package/node_modules/@zigai/pi-extension-internals/dist/index.js +3 -0
- package/node_modules/@zigai/pi-extension-internals/dist/linked-method-patch.d.ts +34 -0
- package/node_modules/@zigai/pi-extension-internals/dist/linked-method-patch.js +272 -0
- package/node_modules/@zigai/pi-extension-internals/dist/pi-internal-import.d.ts +11 -0
- package/node_modules/@zigai/pi-extension-internals/dist/pi-internal-import.js +139 -0
- package/node_modules/@zigai/pi-extension-internals/package.json +41 -0
- package/node_modules/@zigai/pi-extension-settings/LICENSE +21 -0
- package/node_modules/@zigai/pi-extension-settings/README.md +36 -0
- package/node_modules/@zigai/pi-extension-settings/dist/artifacts.d.ts +23 -0
- package/node_modules/@zigai/pi-extension-settings/dist/artifacts.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/artifacts.js +75 -0
- package/node_modules/@zigai/pi-extension-settings/dist/artifacts.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.d.ts +3 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.js +5 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli-entry.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli.d.ts +6 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli.js +87 -0
- package/node_modules/@zigai/pi-extension-settings/dist/cli.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.d.ts +2 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.js +2 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition-marker.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition.d.ts +159 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition.js +248 -0
- package/node_modules/@zigai/pi-extension-settings/dist/definition.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/file-system.d.ts +10 -0
- package/node_modules/@zigai/pi-extension-settings/dist/file-system.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/file-system.js +115 -0
- package/node_modules/@zigai/pi-extension-settings/dist/file-system.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/index.d.ts +2 -0
- package/node_modules/@zigai/pi-extension-settings/dist/index.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/index.js +2 -0
- package/node_modules/@zigai/pi-extension-settings/dist/index.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/json-value.d.ts +18 -0
- package/node_modules/@zigai/pi-extension-settings/dist/json-value.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/json-value.js +56 -0
- package/node_modules/@zigai/pi-extension-settings/dist/json-value.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/paths.d.ts +11 -0
- package/node_modules/@zigai/pi-extension-settings/dist/paths.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/paths.js +23 -0
- package/node_modules/@zigai/pi-extension-settings/dist/paths.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.d.ts +5 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.js +21 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi-host-paths.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi.d.ts +106 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi.js +122 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi.ts +2537 -0
- package/node_modules/@zigai/pi-extension-settings/dist/pi.ts.map +7 -0
- package/node_modules/@zigai/pi-extension-settings/dist/projects.d.ts +10 -0
- package/node_modules/@zigai/pi-extension-settings/dist/projects.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/projects.js +177 -0
- package/node_modules/@zigai/pi-extension-settings/dist/projects.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/runtime.d.ts +40 -0
- package/node_modules/@zigai/pi-extension-settings/dist/runtime.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/runtime.js +158 -0
- package/node_modules/@zigai/pi-extension-settings/dist/runtime.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/runtime.ts +158 -0
- package/node_modules/@zigai/pi-extension-settings/dist/runtime.ts.map +7 -0
- package/node_modules/@zigai/pi-extension-settings/dist/schema-document.d.ts +19 -0
- package/node_modules/@zigai/pi-extension-settings/dist/schema-document.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/schema-document.js +168 -0
- package/node_modules/@zigai/pi-extension-settings/dist/schema-document.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.d.ts +9 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.js +242 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-documentation.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.d.ts +59 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.js +98 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-layer.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.d.ts +80 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.js +144 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-loader.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.d.ts +5 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.js +30 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-merge.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.d.ts +10 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.js +16 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-revision.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.d.ts +54 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.js +202 -0
- package/node_modules/@zigai/pi-extension-settings/dist/settings-transaction.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.d.ts +5 -0
- package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.d.ts.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.js +9 -0
- package/node_modules/@zigai/pi-extension-settings/dist/typebox-runtime.js.map +1 -0
- package/node_modules/@zigai/pi-extension-settings/docs/generation.md +71 -0
- package/node_modules/@zigai/pi-extension-settings/docs/manual-setup.md +98 -0
- package/node_modules/@zigai/pi-extension-settings/docs/runtime.md +100 -0
- package/node_modules/@zigai/pi-extension-settings/docs/ui-controls.md +31 -0
- package/node_modules/@zigai/pi-extension-settings/package.json +97 -0
- package/node_modules/@zigai/pi-mention-anything/README.md +113 -0
- package/node_modules/@zigai/pi-mention-anything/config.schema.json +313 -0
- package/node_modules/@zigai/pi-mention-anything/docs/command-protocol.md +106 -0
- package/node_modules/@zigai/pi-mention-anything/docs/providers.md +128 -0
- package/node_modules/@zigai/pi-mention-anything/examples/query-command.mjs +96 -0
- package/node_modules/@zigai/pi-mention-anything/examples/recursive-tree.ts +28 -0
- package/node_modules/@zigai/pi-mention-anything/examples/static.ts +28 -0
- package/node_modules/@zigai/pi-mention-anything/examples/tmux.ts +90 -0
- package/node_modules/@zigai/pi-mention-anything/examples/tree-settings.json +25 -0
- package/node_modules/@zigai/pi-mention-anything/package.json +58 -0
- package/node_modules/@zigai/pi-mention-anything/src/api.ts +75 -0
- package/node_modules/@zigai/pi-mention-anything/src/autocomplete.ts +231 -0
- package/node_modules/@zigai/pi-mention-anything/src/chain-autocomplete.ts +596 -0
- package/node_modules/@zigai/pi-mention-anything/src/chain-syntax.ts +345 -0
- package/node_modules/@zigai/pi-mention-anything/src/command-provider.ts +291 -0
- package/node_modules/@zigai/pi-mention-anything/src/configured-source.ts +66 -0
- package/node_modules/@zigai/pi-mention-anything/src/editor.ts +180 -0
- package/node_modules/@zigai/pi-mention-anything/src/expand-mentions.ts +162 -0
- package/node_modules/@zigai/pi-mention-anything/src/index.ts +54 -0
- package/node_modules/@zigai/pi-mention-anything/src/initial-suggestions.ts +190 -0
- package/node_modules/@zigai/pi-mention-anything/src/list-provider.ts +71 -0
- package/node_modules/@zigai/pi-mention-anything/src/mention-hub.ts +307 -0
- package/node_modules/@zigai/pi-mention-anything/src/mention-resolution.ts +374 -0
- package/node_modules/@zigai/pi-mention-anything/src/mention-syntax.ts +105 -0
- package/node_modules/@zigai/pi-mention-anything/src/register-mention.ts +89 -0
- package/node_modules/@zigai/pi-mention-anything/src/rendering.ts +53 -0
- package/node_modules/@zigai/pi-mention-anything/src/selected-items.ts +21 -0
- package/node_modules/@zigai/pi-mention-anything/src/selection-history.ts +135 -0
- package/node_modules/@zigai/pi-mention-anything/src/settings-input.ts +317 -0
- package/node_modules/@zigai/pi-mention-anything/src/settings.prevalidated.ts +57 -0
- package/node_modules/@zigai/pi-mention-anything/src/settings.ts +52 -0
- package/node_modules/@zigai/pi-mention-anything/src/source-contract.ts +174 -0
- package/node_modules/@zigai/pi-mention-anything/src/source-controller.ts +1070 -0
- package/node_modules/@zigai/pi-mention-anything/src/source-runtime.ts +99 -0
- package/node_modules/@zigai/pi-mention-skill/README.md +60 -0
- package/node_modules/@zigai/pi-mention-skill/config.schema.json +81 -0
- package/node_modules/@zigai/pi-mention-skill/package.json +56 -0
- package/node_modules/@zigai/pi-mention-skill/src/index.ts +60 -0
- package/node_modules/@zigai/pi-mention-skill/src/settings-input.ts +74 -0
- package/node_modules/@zigai/pi-mention-skill/src/settings.prevalidated.ts +18 -0
- package/node_modules/@zigai/pi-mention-skill/src/settings.ts +54 -0
- package/node_modules/@zigai/pi-mention-skill/src/skill-commands.ts +18 -0
- package/node_modules/@zigai/pi-mention-skill/src/skill-content.ts +60 -0
- package/node_modules/@zigai/pi-mention-skill/src/skill-provider.ts +105 -0
- package/node_modules/@zigai/pi-mention-skill/src/slash-skill-filter.ts +29 -0
- package/node_modules/argparse/LICENSE +21 -0
- package/node_modules/argparse/README.md +257 -0
- package/node_modules/argparse/index.js +3 -0
- package/node_modules/argparse/lib/action/append/constant.js +47 -0
- package/node_modules/argparse/lib/action/append.js +53 -0
- package/node_modules/argparse/lib/action/count.js +40 -0
- package/node_modules/argparse/lib/action/help.js +47 -0
- package/node_modules/argparse/lib/action/store/constant.js +43 -0
- package/node_modules/argparse/lib/action/store/false.js +27 -0
- package/node_modules/argparse/lib/action/store/true.js +26 -0
- package/node_modules/argparse/lib/action/store.js +50 -0
- package/node_modules/argparse/lib/action/subparsers.js +149 -0
- package/node_modules/argparse/lib/action/version.js +47 -0
- package/node_modules/argparse/lib/action.js +146 -0
- package/node_modules/argparse/lib/action_container.js +482 -0
- package/node_modules/argparse/lib/argparse.js +14 -0
- package/node_modules/argparse/lib/argument/error.js +50 -0
- package/node_modules/argparse/lib/argument/exclusive.js +54 -0
- package/node_modules/argparse/lib/argument/group.js +75 -0
- package/node_modules/argparse/lib/argument_parser.js +1161 -0
- package/node_modules/argparse/lib/const.js +21 -0
- package/node_modules/argparse/lib/help/added_formatters.js +87 -0
- package/node_modules/argparse/lib/help/formatter.js +795 -0
- package/node_modules/argparse/lib/namespace.js +76 -0
- package/node_modules/argparse/lib/utils.js +57 -0
- package/node_modules/argparse/package.json +34 -0
- package/node_modules/esprima/LICENSE.BSD +21 -0
- package/node_modules/esprima/README.md +46 -0
- package/node_modules/esprima/bin/esparse.js +139 -0
- package/node_modules/esprima/bin/esvalidate.js +236 -0
- package/node_modules/esprima/dist/esprima.js +6709 -0
- package/node_modules/esprima/package.json +112 -0
- package/node_modules/extend-shallow/LICENSE +21 -0
- package/node_modules/extend-shallow/README.md +61 -0
- package/node_modules/extend-shallow/index.js +33 -0
- package/node_modules/extend-shallow/package.json +56 -0
- package/node_modules/graceful-fs/LICENSE +15 -0
- package/node_modules/graceful-fs/README.md +143 -0
- package/node_modules/graceful-fs/clone.js +23 -0
- package/node_modules/graceful-fs/graceful-fs.js +448 -0
- package/node_modules/graceful-fs/legacy-streams.js +118 -0
- package/node_modules/graceful-fs/package.json +53 -0
- package/node_modules/graceful-fs/polyfills.js +355 -0
- package/node_modules/gray-matter/LICENSE +21 -0
- package/node_modules/gray-matter/README.md +565 -0
- package/node_modules/gray-matter/gray-matter.d.ts +114 -0
- package/node_modules/gray-matter/index.js +228 -0
- package/node_modules/gray-matter/lib/defaults.js +18 -0
- package/node_modules/gray-matter/lib/engine.js +30 -0
- package/node_modules/gray-matter/lib/engines.js +54 -0
- package/node_modules/gray-matter/lib/excerpt.js +32 -0
- package/node_modules/gray-matter/lib/parse.js +13 -0
- package/node_modules/gray-matter/lib/stringify.js +56 -0
- package/node_modules/gray-matter/lib/to-file.js +43 -0
- package/node_modules/gray-matter/lib/utils.js +66 -0
- package/node_modules/gray-matter/package.json +127 -0
- package/node_modules/is-extendable/LICENSE +21 -0
- package/node_modules/is-extendable/README.md +72 -0
- package/node_modules/is-extendable/index.js +13 -0
- package/node_modules/is-extendable/package.json +51 -0
- package/node_modules/js-yaml/LICENSE +21 -0
- package/node_modules/js-yaml/README.md +302 -0
- package/node_modules/js-yaml/bin/js-yaml.js +132 -0
- package/node_modules/js-yaml/dist/js-yaml.js +4024 -0
- package/node_modules/js-yaml/dist/js-yaml.min.js +1 -0
- package/node_modules/js-yaml/index.js +7 -0
- package/node_modules/js-yaml/lib/js-yaml/common.js +59 -0
- package/node_modules/js-yaml/lib/js-yaml/dumper.js +850 -0
- package/node_modules/js-yaml/lib/js-yaml/exception.js +43 -0
- package/node_modules/js-yaml/lib/js-yaml/loader.js +1679 -0
- package/node_modules/js-yaml/lib/js-yaml/mark.js +76 -0
- package/node_modules/js-yaml/lib/js-yaml/schema/core.js +18 -0
- package/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +25 -0
- package/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +28 -0
- package/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +17 -0
- package/node_modules/js-yaml/lib/js-yaml/schema/json.js +25 -0
- package/node_modules/js-yaml/lib/js-yaml/schema.js +108 -0
- package/node_modules/js-yaml/lib/js-yaml/type/binary.js +138 -0
- package/node_modules/js-yaml/lib/js-yaml/type/bool.js +35 -0
- package/node_modules/js-yaml/lib/js-yaml/type/float.js +116 -0
- package/node_modules/js-yaml/lib/js-yaml/type/int.js +173 -0
- package/node_modules/js-yaml/lib/js-yaml/type/js/function.js +93 -0
- package/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +60 -0
- package/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +28 -0
- package/node_modules/js-yaml/lib/js-yaml/type/map.js +8 -0
- package/node_modules/js-yaml/lib/js-yaml/type/merge.js +12 -0
- package/node_modules/js-yaml/lib/js-yaml/type/null.js +34 -0
- package/node_modules/js-yaml/lib/js-yaml/type/omap.js +44 -0
- package/node_modules/js-yaml/lib/js-yaml/type/pairs.js +53 -0
- package/node_modules/js-yaml/lib/js-yaml/type/seq.js +8 -0
- package/node_modules/js-yaml/lib/js-yaml/type/set.js +29 -0
- package/node_modules/js-yaml/lib/js-yaml/type/str.js +8 -0
- package/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +88 -0
- package/node_modules/js-yaml/lib/js-yaml/type.js +61 -0
- package/node_modules/js-yaml/lib/js-yaml.js +39 -0
- package/node_modules/js-yaml/package.json +52 -0
- package/node_modules/kind-of/LICENSE +21 -0
- package/node_modules/kind-of/README.md +367 -0
- package/node_modules/kind-of/index.js +129 -0
- package/node_modules/kind-of/package.json +88 -0
- package/node_modules/pi-toggle-skills/README.md +213 -0
- package/node_modules/pi-toggle-skills/package.json +60 -0
- package/node_modules/pi-toggle-skills/src/index.ts +112 -0
- package/node_modules/pi-toggle-skills/src/skill-discovery.ts +258 -0
- package/node_modules/pi-toggle-skills/src/skill-selector.ts +435 -0
- package/node_modules/pi-toggle-skills/toggle-skills.ts +316 -0
- package/node_modules/pi-toggle-skills/vitest.config.ts +15 -0
- package/node_modules/proper-lockfile/LICENSE +21 -0
- package/node_modules/proper-lockfile/README.md +183 -0
- package/node_modules/proper-lockfile/index.js +40 -0
- package/node_modules/proper-lockfile/lib/adapter.js +85 -0
- package/node_modules/proper-lockfile/lib/lockfile.js +342 -0
- package/node_modules/proper-lockfile/lib/mtime-precision.js +55 -0
- package/node_modules/proper-lockfile/node_modules/retry/.npmignore +3 -0
- package/node_modules/proper-lockfile/node_modules/retry/.travis.yml +15 -0
- package/node_modules/proper-lockfile/node_modules/retry/License +21 -0
- package/node_modules/proper-lockfile/node_modules/retry/Makefile +18 -0
- package/node_modules/proper-lockfile/node_modules/retry/README.md +227 -0
- package/node_modules/proper-lockfile/node_modules/retry/equation.gif +0 -0
- package/node_modules/proper-lockfile/node_modules/retry/example/dns.js +31 -0
- package/node_modules/proper-lockfile/node_modules/retry/example/stop.js +40 -0
- package/node_modules/proper-lockfile/node_modules/retry/index.js +1 -0
- package/node_modules/proper-lockfile/node_modules/retry/lib/retry.js +100 -0
- package/node_modules/proper-lockfile/node_modules/retry/lib/retry_operation.js +158 -0
- package/node_modules/proper-lockfile/node_modules/retry/package.json +32 -0
- package/node_modules/proper-lockfile/node_modules/retry/test/common.js +10 -0
- package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-forever.js +24 -0
- package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-retry-operation.js +258 -0
- package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-retry-wrap.js +101 -0
- package/node_modules/proper-lockfile/node_modules/retry/test/integration/test-timeouts.js +69 -0
- package/node_modules/proper-lockfile/package.json +71 -0
- package/node_modules/section-matter/LICENSE +21 -0
- package/node_modules/section-matter/README.md +236 -0
- package/node_modules/section-matter/index.js +136 -0
- package/node_modules/section-matter/package.json +55 -0
- package/node_modules/signal-exit/LICENSE.txt +16 -0
- package/node_modules/signal-exit/README.md +39 -0
- package/node_modules/signal-exit/index.js +202 -0
- package/node_modules/signal-exit/package.json +38 -0
- package/node_modules/signal-exit/signals.js +53 -0
- package/node_modules/sprintf-js/.npmignore +1 -0
- package/node_modules/sprintf-js/LICENSE +24 -0
- package/node_modules/sprintf-js/README.md +88 -0
- package/node_modules/sprintf-js/bower.json +14 -0
- package/node_modules/sprintf-js/demo/angular.html +20 -0
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js +4 -0
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js.map +1 -0
- package/node_modules/sprintf-js/dist/angular-sprintf.min.map +1 -0
- package/node_modules/sprintf-js/dist/sprintf.min.js +4 -0
- package/node_modules/sprintf-js/dist/sprintf.min.js.map +1 -0
- package/node_modules/sprintf-js/dist/sprintf.min.map +1 -0
- package/node_modules/sprintf-js/gruntfile.js +36 -0
- package/node_modules/sprintf-js/package.json +22 -0
- package/node_modules/sprintf-js/src/angular-sprintf.js +18 -0
- package/node_modules/sprintf-js/src/sprintf.js +208 -0
- package/node_modules/sprintf-js/test/test.js +82 -0
- package/node_modules/strip-bom-string/LICENSE +21 -0
- package/node_modules/strip-bom-string/README.md +66 -0
- package/node_modules/strip-bom-string/index.js +15 -0
- package/node_modules/strip-bom-string/package.json +60 -0
- package/package.json +13 -4
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { Type, type StaticDecode } from "typebox";
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_COMPLETION_SUFFIX = " ";
|
|
4
|
+
|
|
5
|
+
export const mentionItemSchema = Type.Object(
|
|
6
|
+
{
|
|
7
|
+
name: Type.String({
|
|
8
|
+
minLength: 1,
|
|
9
|
+
description: "Name selected and written after the trigger.",
|
|
10
|
+
}),
|
|
11
|
+
id: Type.Optional(
|
|
12
|
+
Type.String({
|
|
13
|
+
minLength: 1,
|
|
14
|
+
description:
|
|
15
|
+
"Stable identity within the parent path. Defaults to name for simple lists.",
|
|
16
|
+
}),
|
|
17
|
+
),
|
|
18
|
+
segment: Type.Optional(
|
|
19
|
+
Type.String({
|
|
20
|
+
minLength: 1,
|
|
21
|
+
description: "Text inserted as this path segment. Defaults to name.",
|
|
22
|
+
}),
|
|
23
|
+
),
|
|
24
|
+
searchText: Type.Optional(
|
|
25
|
+
Type.String({
|
|
26
|
+
description: "Text used for searching instead of the name and description.",
|
|
27
|
+
}),
|
|
28
|
+
),
|
|
29
|
+
insertionText: Type.Optional(
|
|
30
|
+
Type.String({
|
|
31
|
+
minLength: 1,
|
|
32
|
+
description: "Complete editor text for a selected terminal target.",
|
|
33
|
+
}),
|
|
34
|
+
),
|
|
35
|
+
parentPath: Type.Optional(
|
|
36
|
+
Type.Array(Type.String({ minLength: 1 }), {
|
|
37
|
+
description: "Ancestor IDs, from root to parent. Omit for root items.",
|
|
38
|
+
}),
|
|
39
|
+
),
|
|
40
|
+
selectable: Type.Optional(
|
|
41
|
+
Type.Boolean({
|
|
42
|
+
description:
|
|
43
|
+
"Allow selecting this item as a completed target. Defaults to false for navigable items and true otherwise.",
|
|
44
|
+
}),
|
|
45
|
+
),
|
|
46
|
+
navigable: Type.Optional(
|
|
47
|
+
Type.Boolean({
|
|
48
|
+
description: "Open a child picker when this item is selected. Defaults to false.",
|
|
49
|
+
}),
|
|
50
|
+
),
|
|
51
|
+
description: Type.Optional(
|
|
52
|
+
Type.String({ description: "Secondary text shown in autocomplete." }),
|
|
53
|
+
),
|
|
54
|
+
replacement: Type.Optional(
|
|
55
|
+
Type.String({
|
|
56
|
+
description:
|
|
57
|
+
"Text sent to the model in place of the mention. Defaults to the name.",
|
|
58
|
+
}),
|
|
59
|
+
),
|
|
60
|
+
},
|
|
61
|
+
{ additionalProperties: false, title: "MentionItem" },
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const staticMentionSourceSchema = Type.Object(
|
|
65
|
+
{
|
|
66
|
+
type: Type.Literal("static"),
|
|
67
|
+
items: Type.Array(mentionItemSchema, {
|
|
68
|
+
maxItems: 10000,
|
|
69
|
+
description: "Candidates offered by this mention source.",
|
|
70
|
+
}),
|
|
71
|
+
},
|
|
72
|
+
{ additionalProperties: false, title: "StaticMentionSource" },
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const commandMentionSourceSchema = Type.Object(
|
|
76
|
+
{
|
|
77
|
+
type: Type.Literal("command"),
|
|
78
|
+
mode: Type.Optional(
|
|
79
|
+
Type.Union([Type.Literal("array"), Type.Literal("protocol")], {
|
|
80
|
+
default: "array",
|
|
81
|
+
description:
|
|
82
|
+
"array prints a flat item array; protocol uses version 1 JSON requests on stdin for discovery and exact resolution.",
|
|
83
|
+
}),
|
|
84
|
+
),
|
|
85
|
+
filtering: Type.Optional(
|
|
86
|
+
Type.Union([Type.Literal("local"), Type.Literal("provider")], {
|
|
87
|
+
default: "provider",
|
|
88
|
+
description:
|
|
89
|
+
"Protocol result ranking owner. Array commands always use local filtering.",
|
|
90
|
+
}),
|
|
91
|
+
),
|
|
92
|
+
maxOutputBytes: Type.Optional(
|
|
93
|
+
Type.Integer({
|
|
94
|
+
minimum: 1024,
|
|
95
|
+
maximum: 16777216,
|
|
96
|
+
default: 1048576,
|
|
97
|
+
description: "Maximum combined standard output and standard error size in bytes.",
|
|
98
|
+
}),
|
|
99
|
+
),
|
|
100
|
+
refreshIntervalMs: Type.Optional(
|
|
101
|
+
Type.Integer({
|
|
102
|
+
minimum: 1000,
|
|
103
|
+
description:
|
|
104
|
+
"Periodic refresh interval for active cache entries. Requires caching.",
|
|
105
|
+
}),
|
|
106
|
+
),
|
|
107
|
+
watchFiles: Type.Optional(
|
|
108
|
+
Type.Array(Type.String({ minLength: 1 }), {
|
|
109
|
+
maxItems: 32,
|
|
110
|
+
description: "Files whose changes invalidate cached results. Requires caching.",
|
|
111
|
+
}),
|
|
112
|
+
),
|
|
113
|
+
persistentCache: Type.Optional(
|
|
114
|
+
Type.Boolean({
|
|
115
|
+
description:
|
|
116
|
+
"Local disk caching, scoped by configuration, working directory, and trust.",
|
|
117
|
+
}),
|
|
118
|
+
),
|
|
119
|
+
command: Type.String({
|
|
120
|
+
minLength: 1,
|
|
121
|
+
description: "Executable that returns candidates in the selected command mode.",
|
|
122
|
+
}),
|
|
123
|
+
args: Type.Array(Type.String(), {
|
|
124
|
+
default: [],
|
|
125
|
+
description:
|
|
126
|
+
"Arguments passed directly to the executable without shell interpretation.",
|
|
127
|
+
}),
|
|
128
|
+
debounceMs: Type.Optional(
|
|
129
|
+
Type.Integer({
|
|
130
|
+
minimum: 0,
|
|
131
|
+
default: 100,
|
|
132
|
+
description:
|
|
133
|
+
"Delay before starting the command so superseded autocomplete requests can cancel.",
|
|
134
|
+
}),
|
|
135
|
+
),
|
|
136
|
+
timeoutMs: Type.Optional(
|
|
137
|
+
Type.Integer({
|
|
138
|
+
minimum: 1,
|
|
139
|
+
default: 5_000,
|
|
140
|
+
description: "Maximum command runtime in milliseconds.",
|
|
141
|
+
}),
|
|
142
|
+
),
|
|
143
|
+
refreshOnStartup: Type.Optional(
|
|
144
|
+
Type.Boolean({
|
|
145
|
+
description: "Background root discovery at session startup. Requires caching.",
|
|
146
|
+
}),
|
|
147
|
+
),
|
|
148
|
+
cacheTtlMs: Type.Optional(
|
|
149
|
+
Type.Integer({
|
|
150
|
+
minimum: 1,
|
|
151
|
+
description:
|
|
152
|
+
"Cache lifetime in milliseconds. Expired results remain available during refresh. Without a lifetime, results last for the session.",
|
|
153
|
+
}),
|
|
154
|
+
),
|
|
155
|
+
cache: Type.Optional(
|
|
156
|
+
Type.Boolean({
|
|
157
|
+
default: false,
|
|
158
|
+
description: "Caching of successful command results.",
|
|
159
|
+
}),
|
|
160
|
+
),
|
|
161
|
+
},
|
|
162
|
+
{ additionalProperties: false, title: "CommandMentionSource" },
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
export const initialSuggestionStrategySchema = Type.Union(
|
|
166
|
+
[
|
|
167
|
+
Type.Literal("frecency"),
|
|
168
|
+
Type.Literal("recent"),
|
|
169
|
+
Type.Literal("frequent"),
|
|
170
|
+
Type.Literal("alphabetical"),
|
|
171
|
+
Type.Literal("sourceOrder"),
|
|
172
|
+
],
|
|
173
|
+
{
|
|
174
|
+
default: "frecency",
|
|
175
|
+
description: "Ordering used before any query text is entered.",
|
|
176
|
+
},
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
export const initialSuggestionsSchema = Type.Object(
|
|
180
|
+
{
|
|
181
|
+
strategy: initialSuggestionStrategySchema,
|
|
182
|
+
pinned: Type.Array(Type.String({ minLength: 1 }), {
|
|
183
|
+
default: [],
|
|
184
|
+
uniqueItems: true,
|
|
185
|
+
description:
|
|
186
|
+
"Candidate names placed first, in this order, before the configured strategy.",
|
|
187
|
+
}),
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
default: {},
|
|
191
|
+
additionalProperties: false,
|
|
192
|
+
description: "Controls the entries shown immediately after the trigger.",
|
|
193
|
+
},
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
export const mentionDefinitionSchema = Type.Object(
|
|
197
|
+
{
|
|
198
|
+
id: Type.String({
|
|
199
|
+
minLength: 1,
|
|
200
|
+
pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$",
|
|
201
|
+
description: "Stable identifier used for diagnostics and selection history.",
|
|
202
|
+
}),
|
|
203
|
+
trigger: Type.String({
|
|
204
|
+
minLength: 1,
|
|
205
|
+
pattern: "^[^/\\s]+$",
|
|
206
|
+
description: "One or more non-whitespace, non-slash characters that start the mention.",
|
|
207
|
+
}),
|
|
208
|
+
separator: Type.Optional(
|
|
209
|
+
Type.String({
|
|
210
|
+
minLength: 1,
|
|
211
|
+
maxLength: 1,
|
|
212
|
+
pattern: '^[^\\s"\\\\]$',
|
|
213
|
+
description: "Separator between chained mention segments.",
|
|
214
|
+
}),
|
|
215
|
+
),
|
|
216
|
+
expansionPolicy: Type.Optional(
|
|
217
|
+
Type.Union([Type.Literal("selected-only"), Type.Literal("selected-or-resolved")], {
|
|
218
|
+
default: "selected-or-resolved",
|
|
219
|
+
description:
|
|
220
|
+
"Expand only picker selections, or also resolve manually typed mentions.",
|
|
221
|
+
}),
|
|
222
|
+
),
|
|
223
|
+
replacementTemplate: Type.Optional(
|
|
224
|
+
Type.String({
|
|
225
|
+
description:
|
|
226
|
+
"Replacement template. Allowed fields: {{id}}, {{label}}, {{segment}}, {{path}}, {{ids}}. Provider data is never implicitly included.",
|
|
227
|
+
}),
|
|
228
|
+
),
|
|
229
|
+
completionSuffix: Type.Optional(
|
|
230
|
+
Type.String({
|
|
231
|
+
default: DEFAULT_COMPLETION_SUFFIX,
|
|
232
|
+
description: "Text inserted after a completed mention.",
|
|
233
|
+
}),
|
|
234
|
+
),
|
|
235
|
+
source: Type.Union([staticMentionSourceSchema, commandMentionSourceSchema], {
|
|
236
|
+
description: "Where this mention gets its candidates.",
|
|
237
|
+
}),
|
|
238
|
+
initialSuggestions: Type.Optional(initialSuggestionsSchema),
|
|
239
|
+
},
|
|
240
|
+
{ additionalProperties: false, title: "MentionDefinition" },
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
export const mentionAnythingSettingsSchema = Type.Object(
|
|
244
|
+
{
|
|
245
|
+
mentions: Type.Array(mentionDefinitionSchema, {
|
|
246
|
+
default: [],
|
|
247
|
+
description: "Mention sources enabled in Pi.",
|
|
248
|
+
}),
|
|
249
|
+
},
|
|
250
|
+
{ additionalProperties: false },
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
export type ConfiguredMentionInput = StaticDecode<
|
|
254
|
+
typeof mentionAnythingSettingsSchema
|
|
255
|
+
>["mentions"][number];
|
|
256
|
+
|
|
257
|
+
export type ConfiguredMention = Omit<
|
|
258
|
+
ConfiguredMentionInput,
|
|
259
|
+
"completionSuffix" | "initialSuggestions"
|
|
260
|
+
> & {
|
|
261
|
+
completionSuffix: string;
|
|
262
|
+
initialSuggestions: StaticDecode<typeof initialSuggestionsSchema>;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export type MentionAnythingSettings = { mentions: ConfiguredMention[] };
|
|
266
|
+
export type ConfiguredMentionItem = StaticDecode<typeof mentionItemSchema>;
|
|
267
|
+
|
|
268
|
+
const exampleSettings: MentionAnythingSettings = {
|
|
269
|
+
mentions: [
|
|
270
|
+
{
|
|
271
|
+
id: "environments",
|
|
272
|
+
trigger: "%",
|
|
273
|
+
completionSuffix: " ",
|
|
274
|
+
source: {
|
|
275
|
+
type: "static",
|
|
276
|
+
items: [
|
|
277
|
+
{ name: "staging", description: "Staging environment" },
|
|
278
|
+
{ name: "production", description: "Production environment" },
|
|
279
|
+
],
|
|
280
|
+
},
|
|
281
|
+
initialSuggestions: {
|
|
282
|
+
strategy: "frecency",
|
|
283
|
+
pinned: [],
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
id: "tickets",
|
|
288
|
+
trigger: "ticket:",
|
|
289
|
+
completionSuffix: " ",
|
|
290
|
+
source: {
|
|
291
|
+
type: "command",
|
|
292
|
+
mode: "array",
|
|
293
|
+
command: "list-my-tickets",
|
|
294
|
+
args: ["--json"],
|
|
295
|
+
cache: true,
|
|
296
|
+
refreshOnStartup: true,
|
|
297
|
+
cacheTtlMs: 300_000,
|
|
298
|
+
},
|
|
299
|
+
initialSuggestions: {
|
|
300
|
+
strategy: "frecency",
|
|
301
|
+
pinned: [],
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
export const extensionSettingsInput = {
|
|
308
|
+
id: "pi-mention-anything",
|
|
309
|
+
title: "Pi Mention Anything",
|
|
310
|
+
description: "Define custom mention sources and triggers.",
|
|
311
|
+
schemaId:
|
|
312
|
+
"https://raw.githubusercontent.com/zigai/pi-tweaks/master/packages/pi-mention-anything/config.schema.json",
|
|
313
|
+
schema: mentionAnythingSettingsSchema,
|
|
314
|
+
exampleSettings,
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
export default extensionSettingsInput;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Generated by pi-extension-settings. Do not edit.
|
|
2
|
+
const artifact = {
|
|
3
|
+
"formatVersion": 1,
|
|
4
|
+
"fingerprint": "json-sha256-v1:becd796fbe542add8b4fe0622ab1c9535352eae581b8b1f0f5c20d800c7f18bc",
|
|
5
|
+
"semanticFingerprint": "typebox-value-hash-v1:19c4d12b06845b62",
|
|
6
|
+
"defaultSettings": {
|
|
7
|
+
"mentions": []
|
|
8
|
+
},
|
|
9
|
+
"exampleSettings": {
|
|
10
|
+
"mentions": [
|
|
11
|
+
{
|
|
12
|
+
"id": "environments",
|
|
13
|
+
"trigger": "%",
|
|
14
|
+
"completionSuffix": " ",
|
|
15
|
+
"source": {
|
|
16
|
+
"type": "static",
|
|
17
|
+
"items": [
|
|
18
|
+
{
|
|
19
|
+
"name": "staging",
|
|
20
|
+
"description": "Staging environment"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "production",
|
|
24
|
+
"description": "Production environment"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"initialSuggestions": {
|
|
29
|
+
"strategy": "frecency",
|
|
30
|
+
"pinned": []
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "tickets",
|
|
35
|
+
"trigger": "ticket:",
|
|
36
|
+
"completionSuffix": " ",
|
|
37
|
+
"source": {
|
|
38
|
+
"type": "command",
|
|
39
|
+
"mode": "array",
|
|
40
|
+
"command": "list-my-tickets",
|
|
41
|
+
"args": [
|
|
42
|
+
"--json"
|
|
43
|
+
],
|
|
44
|
+
"cache": true,
|
|
45
|
+
"refreshOnStartup": true,
|
|
46
|
+
"cacheTtlMs": 300000
|
|
47
|
+
},
|
|
48
|
+
"initialSuggestions": {
|
|
49
|
+
"strategy": "frecency",
|
|
50
|
+
"pinned": []
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
} as const;
|
|
56
|
+
|
|
57
|
+
export default artifact;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { loadPiExtensionSettings } from "@zigai/pi-extension-settings/pi";
|
|
3
|
+
import { definePrevalidatedExtensionSettings } from "@zigai/pi-extension-settings/runtime";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
type ConfiguredMention,
|
|
7
|
+
type ConfiguredMentionInput,
|
|
8
|
+
DEFAULT_COMPLETION_SUFFIX,
|
|
9
|
+
type MentionAnythingSettings,
|
|
10
|
+
extensionSettingsInput,
|
|
11
|
+
} from "./settings-input.ts";
|
|
12
|
+
import prevalidatedSettings from "./settings.prevalidated.ts";
|
|
13
|
+
|
|
14
|
+
export * from "./settings-input.ts";
|
|
15
|
+
|
|
16
|
+
export const mentionAnythingSettingsDefinition = definePrevalidatedExtensionSettings(
|
|
17
|
+
extensionSettingsInput,
|
|
18
|
+
prevalidatedSettings,
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export default mentionAnythingSettingsDefinition;
|
|
22
|
+
|
|
23
|
+
export type MentionAnythingSettingsContext = Pick<ExtensionContext, "cwd" | "isProjectTrusted">;
|
|
24
|
+
|
|
25
|
+
function copyMention(mention: ConfiguredMentionInput): ConfiguredMention {
|
|
26
|
+
return structuredClone({
|
|
27
|
+
...mention,
|
|
28
|
+
completionSuffix: mention.completionSuffix ?? DEFAULT_COMPLETION_SUFFIX,
|
|
29
|
+
initialSuggestions: mention.initialSuggestions ?? { strategy: "frecency", pinned: [] },
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Load validated global and trusted-project mention settings. */
|
|
34
|
+
export function loadMentionAnythingSettings(
|
|
35
|
+
ctx: MentionAnythingSettingsContext,
|
|
36
|
+
): MentionAnythingSettings {
|
|
37
|
+
const loaded = loadPiExtensionSettings(
|
|
38
|
+
mentionAnythingSettingsDefinition,
|
|
39
|
+
{
|
|
40
|
+
cwd: ctx.cwd,
|
|
41
|
+
isProjectTrusted: () => ctx.isProjectTrusted(),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
bundledSchema: {
|
|
45
|
+
kind: "url",
|
|
46
|
+
url: new URL("../config.schema.json", import.meta.url),
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
return { mentions: loaded.settings.mentions.map(copyMention) };
|
|
52
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { Type, type TSchema } from "typebox";
|
|
2
|
+
import { Value } from "typebox/value";
|
|
3
|
+
|
|
4
|
+
export type JsonValue =
|
|
5
|
+
| null
|
|
6
|
+
| boolean
|
|
7
|
+
| number
|
|
8
|
+
| string
|
|
9
|
+
| readonly JsonValue[]
|
|
10
|
+
| { readonly [key: string]: JsonValue };
|
|
11
|
+
|
|
12
|
+
export type Candidate = {
|
|
13
|
+
readonly id: string;
|
|
14
|
+
readonly label: string;
|
|
15
|
+
readonly segment: string;
|
|
16
|
+
readonly insertionText?: string;
|
|
17
|
+
readonly description?: string;
|
|
18
|
+
readonly searchText?: string;
|
|
19
|
+
readonly selectable: boolean;
|
|
20
|
+
readonly navigable: boolean;
|
|
21
|
+
readonly replacement?: string;
|
|
22
|
+
readonly data?: JsonValue;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const MAX_ID_LENGTH = 4096;
|
|
26
|
+
const MAX_TEXT_LENGTH = 16_384;
|
|
27
|
+
const MAX_REPLACEMENT_LENGTH = 1_048_576;
|
|
28
|
+
const MAX_PATH_LENGTH = 64;
|
|
29
|
+
const MAX_DISCOVERY_ITEMS = 10_000;
|
|
30
|
+
const MAX_JSON_DEPTH = 8;
|
|
31
|
+
const MAX_JSON_COLLECTION_ITEMS = 256;
|
|
32
|
+
const MAX_JSON_OBJECT_PROPERTIES = 256;
|
|
33
|
+
|
|
34
|
+
function createJsonValueSchema(depth: number): TSchema {
|
|
35
|
+
const variants: TSchema[] = [
|
|
36
|
+
Type.Null(),
|
|
37
|
+
Type.Boolean(),
|
|
38
|
+
Type.Number(),
|
|
39
|
+
Type.String({ maxLength: MAX_TEXT_LENGTH }),
|
|
40
|
+
];
|
|
41
|
+
if (depth > 0) {
|
|
42
|
+
const nested = createJsonValueSchema(depth - 1);
|
|
43
|
+
|
|
44
|
+
variants.push(
|
|
45
|
+
Type.Array(nested, { maxItems: MAX_JSON_COLLECTION_ITEMS }),
|
|
46
|
+
Type.Object(
|
|
47
|
+
{},
|
|
48
|
+
{
|
|
49
|
+
additionalProperties: nested,
|
|
50
|
+
maxProperties: MAX_JSON_OBJECT_PROPERTIES,
|
|
51
|
+
propertyNames: Type.String({ maxLength: MAX_ID_LENGTH }),
|
|
52
|
+
},
|
|
53
|
+
),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return Type.Union(variants);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const jsonValueSchema = Type.Unsafe<JsonValue>(createJsonValueSchema(MAX_JSON_DEPTH));
|
|
61
|
+
const candidateFields = {
|
|
62
|
+
id: Type.String({ minLength: 1, maxLength: MAX_ID_LENGTH }),
|
|
63
|
+
label: Type.String({ minLength: 1, maxLength: MAX_TEXT_LENGTH }),
|
|
64
|
+
segment: Type.String({ minLength: 1, maxLength: MAX_TEXT_LENGTH }),
|
|
65
|
+
insertionText: Type.Optional(Type.String({ maxLength: MAX_TEXT_LENGTH })),
|
|
66
|
+
description: Type.Optional(Type.String({ maxLength: MAX_TEXT_LENGTH })),
|
|
67
|
+
searchText: Type.Optional(Type.String({ maxLength: MAX_TEXT_LENGTH })),
|
|
68
|
+
replacement: Type.Optional(Type.String({ maxLength: MAX_REPLACEMENT_LENGTH })),
|
|
69
|
+
data: Type.Optional(jsonValueSchema),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const candidateSchema = Type.Union([
|
|
73
|
+
Type.Object(
|
|
74
|
+
{
|
|
75
|
+
...candidateFields,
|
|
76
|
+
selectable: Type.Literal(true),
|
|
77
|
+
navigable: Type.Boolean(),
|
|
78
|
+
},
|
|
79
|
+
{ additionalProperties: false },
|
|
80
|
+
),
|
|
81
|
+
Type.Object(
|
|
82
|
+
{
|
|
83
|
+
...candidateFields,
|
|
84
|
+
selectable: Type.Literal(false),
|
|
85
|
+
navigable: Type.Literal(true),
|
|
86
|
+
},
|
|
87
|
+
{ additionalProperties: false },
|
|
88
|
+
),
|
|
89
|
+
]);
|
|
90
|
+
|
|
91
|
+
export function parseCandidate(value: unknown): Candidate {
|
|
92
|
+
return Value.Parse(candidateSchema, value);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export type DiscoveryRequest = {
|
|
96
|
+
readonly sourceId: string;
|
|
97
|
+
readonly cwd: string;
|
|
98
|
+
readonly trusted: boolean;
|
|
99
|
+
readonly query: string;
|
|
100
|
+
readonly path: readonly Candidate[];
|
|
101
|
+
readonly limit: number;
|
|
102
|
+
readonly cursor?: string;
|
|
103
|
+
readonly signal: AbortSignal;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export type DiscoveryResponse = {
|
|
107
|
+
readonly items: readonly Candidate[];
|
|
108
|
+
readonly nextCursor?: string;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const discoveryResponseSchema = Type.Object(
|
|
112
|
+
{
|
|
113
|
+
items: Type.Array(candidateSchema, { maxItems: MAX_DISCOVERY_ITEMS }),
|
|
114
|
+
nextCursor: Type.Optional(Type.String({ minLength: 1, maxLength: MAX_TEXT_LENGTH })),
|
|
115
|
+
},
|
|
116
|
+
{ additionalProperties: false },
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
export function parseDiscoveryResponse(value: unknown): DiscoveryResponse {
|
|
120
|
+
return Value.Parse(discoveryResponseSchema, value);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export type ResolveRequest = {
|
|
124
|
+
readonly sourceId: string;
|
|
125
|
+
readonly cwd: string;
|
|
126
|
+
readonly trusted: boolean;
|
|
127
|
+
readonly segments: readonly string[];
|
|
128
|
+
readonly signal: AbortSignal;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export type Resolution =
|
|
132
|
+
| {
|
|
133
|
+
readonly status: "resolved";
|
|
134
|
+
readonly path: readonly Candidate[];
|
|
135
|
+
readonly replacement?: string;
|
|
136
|
+
}
|
|
137
|
+
| { readonly status: "unresolved"; readonly reason: string };
|
|
138
|
+
|
|
139
|
+
export const resolutionSchema = Type.Union([
|
|
140
|
+
Type.Object(
|
|
141
|
+
{
|
|
142
|
+
status: Type.Literal("resolved"),
|
|
143
|
+
path: Type.Array(candidateSchema, { minItems: 1, maxItems: MAX_PATH_LENGTH }),
|
|
144
|
+
replacement: Type.Optional(Type.String({ maxLength: MAX_REPLACEMENT_LENGTH })),
|
|
145
|
+
},
|
|
146
|
+
{ additionalProperties: false },
|
|
147
|
+
),
|
|
148
|
+
Type.Object(
|
|
149
|
+
{
|
|
150
|
+
status: Type.Literal("unresolved"),
|
|
151
|
+
reason: Type.String({ minLength: 1, maxLength: MAX_TEXT_LENGTH }),
|
|
152
|
+
},
|
|
153
|
+
{ additionalProperties: false },
|
|
154
|
+
),
|
|
155
|
+
]);
|
|
156
|
+
|
|
157
|
+
export function parseResolution(value: unknown): Resolution {
|
|
158
|
+
const resolution = Value.Parse(resolutionSchema, value);
|
|
159
|
+
if (resolution.status === "resolved") {
|
|
160
|
+
for (const [index, candidate] of resolution.path.slice(0, -1).entries()) {
|
|
161
|
+
if (!candidate.navigable)
|
|
162
|
+
throw new Error(`resolved path ancestor at index ${index} must be navigable`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return resolution;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export type Provider = {
|
|
170
|
+
readonly filtering: "local" | "provider";
|
|
171
|
+
discover(request: DiscoveryRequest): Promise<DiscoveryResponse>;
|
|
172
|
+
resolve(request: ResolveRequest): Promise<Resolution>;
|
|
173
|
+
dispose?(): void | Promise<void>;
|
|
174
|
+
};
|