@lapis-notes/api 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/LICENSE.md +4 -0
- package/README.md +43 -0
- package/dist/__tests__/data-adapter-conformance.js +205 -0
- package/dist/__tests__/lapis-runtime-manifest.js +32 -0
- package/dist/__tests__/svelte-internal-client.d.ts +3 -0
- package/dist/agent-result-views.d.ts +52 -0
- package/dist/agent-result-views.js +89 -0
- package/dist/agent-skills.d.ts +99 -0
- package/dist/agent-skills.js +182 -0
- package/dist/agent-tools.d.ts +92 -0
- package/dist/agent-tools.js +139 -0
- package/dist/app-database-host.d.ts +4 -0
- package/dist/app-database-host.js +4 -0
- package/dist/app-shell-plugin-persistence.d.ts +15 -0
- package/dist/app-shell-plugin-persistence.js +34 -0
- package/dist/app-url.d.ts +54 -0
- package/dist/app-url.js +269 -0
- package/dist/application-compatibility.d.ts +31 -0
- package/dist/application-compatibility.js +64 -0
- package/dist/application-state.svelte.d.ts +14 -0
- package/dist/application-state.svelte.js +30 -0
- package/dist/assets/lapis-logo.svg +471 -0
- package/dist/bases.d.ts +281 -0
- package/dist/bases.js +475 -0
- package/dist/cache.svelte.d.ts +569 -0
- package/dist/cache.svelte.js +1433 -0
- package/dist/command.svelte.d.ts +337 -0
- package/dist/command.svelte.js +571 -0
- package/dist/compat.d.ts +29 -0
- package/dist/compat.js +30 -0
- package/dist/components/configuration/configuration.css +199 -0
- package/dist/components/configuration/date-setting.svelte +71 -0
- package/dist/components/configuration/date-setting.svelte.d.ts +8 -0
- package/dist/components/configuration/list-setting.svelte +128 -0
- package/dist/components/configuration/list-setting.svelte.d.ts +13 -0
- package/dist/components/configuration/object-array-row-grip.svelte +78 -0
- package/dist/components/configuration/object-array-row-grip.svelte.d.ts +9 -0
- package/dist/components/configuration/object-array-row.svelte +163 -0
- package/dist/components/configuration/object-array-row.svelte.d.ts +19 -0
- package/dist/components/configuration/object-array-setting.svelte +196 -0
- package/dist/components/configuration/object-array-setting.svelte.d.ts +15 -0
- package/dist/components/configuration/object-array-table-dnd.d.ts +8 -0
- package/dist/components/configuration/object-array-table-dnd.js +10 -0
- package/dist/components/configuration/object-array-utils.d.ts +11 -0
- package/dist/components/configuration/object-array-utils.js +103 -0
- package/dist/components/configuration/object-grid-setting.svelte +79 -0
- package/dist/components/configuration/object-grid-setting.svelte.d.ts +10 -0
- package/dist/components/configuration/object-map-row.svelte +147 -0
- package/dist/components/configuration/object-map-row.svelte.d.ts +15 -0
- package/dist/components/configuration/object-map-setting.svelte +137 -0
- package/dist/components/configuration/object-map-setting.svelte.d.ts +14 -0
- package/dist/components/configuration/object-map-types.d.ts +5 -0
- package/dist/components/configuration/object-map-types.js +1 -0
- package/dist/components/configuration/options-combobox-setting.svelte +129 -0
- package/dist/components/configuration/options-combobox-setting.svelte.d.ts +12 -0
- package/dist/components/copy-button/button.svelte +93 -0
- package/dist/components/copy-button/button.svelte.d.ts +13 -0
- package/dist/components/copy-button/index.d.ts +2 -0
- package/dist/components/copy-button/index.js +2 -0
- package/dist/components/editor/editor.css +565 -0
- package/dist/components/editor/editor.d.ts +33 -0
- package/dist/components/editor/editor.js +132 -0
- package/dist/components/editor/editor.svelte +176 -0
- package/dist/components/editor/editor.svelte.d.ts +15 -0
- package/dist/components/editor/embedded-editor-surface.d.ts +12 -0
- package/dist/components/editor/embedded-editor-surface.js +22 -0
- package/dist/components/editor/embedded-editor-surface.svelte +115 -0
- package/dist/components/editor/embedded-editor-surface.svelte.d.ts +17 -0
- package/dist/components/editor/extensions/autocomplete/index.d.ts +2 -0
- package/dist/components/editor/extensions/autocomplete/index.js +2 -0
- package/dist/components/editor/extensions/autocomplete/lapis-code-mirror-autocomplete.d.ts +16 -0
- package/dist/components/editor/extensions/autocomplete/lapis-code-mirror-autocomplete.js +34 -0
- package/dist/components/editor/extensions/autocomplete/vault-completion-sources.d.ts +27 -0
- package/dist/components/editor/extensions/autocomplete/vault-completion-sources.js +55 -0
- package/dist/components/editor/extensions/class-highlighter/index.d.ts +1 -0
- package/dist/components/editor/extensions/class-highlighter/index.js +47 -0
- package/dist/components/editor/extensions/fold-gutter/index.d.ts +8 -0
- package/dist/components/editor/extensions/fold-gutter/index.js +40 -0
- package/dist/components/editor/extensions/gutter-line-style-sync/index.d.ts +2 -0
- package/dist/components/editor/extensions/gutter-line-style-sync/index.js +118 -0
- package/dist/components/editor/extensions/lint/index.d.ts +4 -0
- package/dist/components/editor/extensions/lint/index.js +4 -0
- package/dist/components/editor/extensions/lint/lapis-code-mirror-lint.d.ts +26 -0
- package/dist/components/editor/extensions/lint/lapis-code-mirror-lint.js +101 -0
- package/dist/components/editor/extensions/lint/lapis-lint-diagnostic-helpers.d.ts +8 -0
- package/dist/components/editor/extensions/lint/lapis-lint-diagnostic-helpers.js +7 -0
- package/dist/components/editor/extensions/lint/lapis-lint-diagnostic.d.ts +20 -0
- package/dist/components/editor/extensions/lint/lapis-lint-diagnostic.js +47 -0
- package/dist/components/editor/extensions/lint/lapis-lint-hover-tooltip.d.ts +9 -0
- package/dist/components/editor/extensions/lint/lapis-lint-hover-tooltip.js +373 -0
- package/dist/components/editor/extensions/lint/lapis-lint-inline-widget.d.ts +31 -0
- package/dist/components/editor/extensions/lint/lapis-lint-inline-widget.js +191 -0
- package/dist/components/editor/extensions/lint/lapis-lint-tooltip.svelte +176 -0
- package/dist/components/editor/extensions/lint/lapis-lint-tooltip.svelte.d.ts +15 -0
- package/dist/components/editor/extensions/lint/lint-tooltip-actions.d.ts +11 -0
- package/dist/components/editor/extensions/lint/lint-tooltip-actions.js +21 -0
- package/dist/components/editor/extensions/lint/mount-lint-tooltip.d.ts +16 -0
- package/dist/components/editor/extensions/lint/mount-lint-tooltip.js +60 -0
- package/dist/components/editor/extensions/search/dom.d.ts +2 -0
- package/dist/components/editor/extensions/search/dom.js +6 -0
- package/dist/components/editor/extensions/search/index.d.ts +35 -0
- package/dist/components/editor/extensions/search/index.js +44 -0
- package/dist/components/editor/extensions/search/search.svelte +335 -0
- package/dist/components/editor/extensions/search/search.svelte.d.ts +8 -0
- package/dist/components/editor/index.d.ts +9 -0
- package/dist/components/editor/index.js +9 -0
- package/dist/components/editor/language-service/dom.d.ts +1 -0
- package/dist/components/editor/language-service/dom.js +6 -0
- package/dist/components/editor/language-service/index.d.ts +28 -0
- package/dist/components/editor/language-service/index.js +342 -0
- package/dist/components/empty-view/empty-view.css +39 -0
- package/dist/components/empty-view/empty-view.svelte +26 -0
- package/dist/components/empty-view/empty-view.svelte.d.ts +9 -0
- package/dist/components/empty-view/index.d.ts +2 -0
- package/dist/components/empty-view/index.js +2 -0
- package/dist/components/icon/icon-list.css +74 -0
- package/dist/components/icon/icon-list.svelte +213 -0
- package/dist/components/icon/icon-list.svelte.d.ts +11 -0
- package/dist/components/icon/icon.svelte +15 -0
- package/dist/components/icon/icon.svelte.d.ts +7 -0
- package/dist/components/icon/index.d.ts +3 -0
- package/dist/components/icon/index.js +3 -0
- package/dist/components/menu/context-menu.svelte +89 -0
- package/dist/components/menu/context-menu.svelte.d.ts +11 -0
- package/dist/components/menu/drawer-menu.svelte +83 -0
- package/dist/components/menu/drawer-menu.svelte.d.ts +8 -0
- package/dist/components/menu/dropdown-menu.svelte +89 -0
- package/dist/components/menu/dropdown-menu.svelte.d.ts +11 -0
- package/dist/components/menu/index.d.ts +6 -0
- package/dist/components/menu/index.js +6 -0
- package/dist/components/menu/menu.css +139 -0
- package/dist/components/menu/menu.svelte +37 -0
- package/dist/components/menu/menu.svelte.d.ts +11 -0
- package/dist/components/menu/mobile-menu-query.svelte.d.ts +3 -0
- package/dist/components/menu/mobile-menu-query.svelte.js +21 -0
- package/dist/components/menu/popover-menu.svelte +90 -0
- package/dist/components/menu/popover-menu.svelte.d.ts +10 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +2 -0
- package/dist/components/select/select.svelte +72 -0
- package/dist/components/select/select.svelte.d.ts +25 -0
- package/dist/configuration-option-source-providers.d.ts +17 -0
- package/dist/configuration-option-source-providers.js +59 -0
- package/dist/configuration-option-source-registry.d.ts +59 -0
- package/dist/configuration-option-source-registry.js +123 -0
- package/dist/configuration.svelte.d.ts +258 -0
- package/dist/configuration.svelte.js +887 -0
- package/dist/context-keys.svelte.d.ts +42 -0
- package/dist/context-keys.svelte.js +278 -0
- package/dist/context.svelte.d.ts +247 -0
- package/dist/context.svelte.js +540 -0
- package/dist/daily-document-provider.d.ts +38 -0
- package/dist/daily-document-provider.js +176 -0
- package/dist/design-core-button-types.d.ts +7 -0
- package/dist/design-core-button-types.js +1 -0
- package/dist/diagnostics.d.ts +93 -0
- package/dist/diagnostics.js +84 -0
- package/dist/dialog-portal.d.ts +3 -0
- package/dist/dialog-portal.js +3 -0
- package/dist/docs-api.d.ts +44 -0
- package/dist/docs-api.js +29 -0
- package/dist/editor-view-registry.d.ts +35 -0
- package/dist/editor-view-registry.js +112 -0
- package/dist/editor.svelte.d.ts +126 -0
- package/dist/editor.svelte.js +454 -0
- package/dist/embed-registry.d.ts +15 -0
- package/dist/embed-registry.js +16 -0
- package/dist/enhance.d.ts +111 -0
- package/dist/enhance.js +309 -0
- package/dist/events.d.ts +28 -0
- package/dist/events.js +49 -0
- package/dist/file-manager.d.ts +90 -0
- package/dist/file-manager.js +289 -0
- package/dist/file-tools/app-tools.d.ts +3 -0
- package/dist/file-tools/app-tools.js +242 -0
- package/dist/file-tools/index.d.ts +3 -0
- package/dist/file-tools/index.js +3 -0
- package/dist/file-tools/paths.d.ts +14 -0
- package/dist/file-tools/paths.js +33 -0
- package/dist/file-tools/vault-operations.d.ts +3 -0
- package/dist/file-tools/vault-operations.js +60 -0
- package/dist/generated/plugin-host-modules.schema.generated.d.ts +371 -0
- package/dist/generated/plugin-host-modules.schema.generated.js +374 -0
- package/dist/glob.d.ts +15 -0
- package/dist/glob.js +68 -0
- package/dist/history.svelte.d.ts +24 -0
- package/dist/history.svelte.js +74 -0
- package/dist/hooks/createVirtualizer.svelte.d.ts +7 -0
- package/dist/hooks/createVirtualizer.svelte.js +70 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/is-mobile.svelte.d.ts +5 -0
- package/dist/hooks/is-mobile.svelte.js +23 -0
- package/dist/hooks/mountComponent.svelte.d.ts +7 -0
- package/dist/hooks/mountComponent.svelte.js +16 -0
- package/dist/hooks/use-text-highlight.d.ts +17 -0
- package/dist/hooks/use-text-highlight.js +82 -0
- package/dist/hooks/useBoundingRect.svelte.d.ts +11 -0
- package/dist/hooks/useBoundingRect.svelte.js +46 -0
- package/dist/icons/index.d.ts +57 -0
- package/dist/icons/index.js +288 -0
- package/dist/index.d.ts +87 -0
- package/dist/index.js +87 -0
- package/dist/language-service/index.d.ts +9 -0
- package/dist/language-service/index.js +7 -0
- package/dist/language-service/manager.d.ts +47 -0
- package/dist/language-service/manager.js +404 -0
- package/dist/language-service/types.d.ts +92 -0
- package/dist/language-service/types.js +1 -0
- package/dist/language-service/virtual-document.d.ts +11 -0
- package/dist/language-service/virtual-document.js +45 -0
- package/dist/language-service/worker-protocol.d.ts +63 -0
- package/dist/language-service/worker-protocol.js +1 -0
- package/dist/language-service/worker-provider.d.ts +9 -0
- package/dist/language-service/worker-provider.js +38 -0
- package/dist/lapis-extension.d.ts +244 -0
- package/dist/lapis-extension.js +591 -0
- package/dist/links.d.ts +34 -0
- package/dist/links.js +191 -0
- package/dist/loaders.d.ts +9 -0
- package/dist/loaders.js +59 -0
- package/dist/localization-manager.svelte.d.ts +56 -0
- package/dist/localization-manager.svelte.js +157 -0
- package/dist/logging.d.ts +172 -0
- package/dist/logging.js +352 -0
- package/dist/markdown-extension-registry.d.ts +31 -0
- package/dist/markdown-extension-registry.js +31 -0
- package/dist/markdown-file-surface-registry.d.ts +25 -0
- package/dist/markdown-file-surface-registry.js +23 -0
- package/dist/markdown.d.ts +205 -0
- package/dist/markdown.js +147 -0
- package/dist/menu-utils.d.ts +1 -0
- package/dist/menu-utils.js +47 -0
- package/dist/menu.svelte.d.ts +121 -0
- package/dist/menu.svelte.js +295 -0
- package/dist/metadata-value.d.ts +10 -0
- package/dist/metadata-value.js +173 -0
- package/dist/metadata.svelte.d.ts +106 -0
- package/dist/metadata.svelte.js +608 -0
- package/dist/notifications.d.ts +209 -0
- package/dist/notifications.js +338 -0
- package/dist/open-file.d.ts +23 -0
- package/dist/open-file.js +102 -0
- package/dist/platform.d.ts +86 -0
- package/dist/platform.js +86 -0
- package/dist/plugin-asset-server.d.ts +60 -0
- package/dist/plugin-asset-server.js +222 -0
- package/dist/plugin-assets.d.ts +4 -0
- package/dist/plugin-assets.js +3 -0
- package/dist/plugin-capability-facade.d.ts +104 -0
- package/dist/plugin-capability-facade.js +61 -0
- package/dist/plugin-dependency-resolver.d.ts +36 -0
- package/dist/plugin-dependency-resolver.js +54 -0
- package/dist/plugin-dependency-scanner.d.ts +9 -0
- package/dist/plugin-dependency-scanner.js +274 -0
- package/dist/plugin-distribution/canonical-json.d.ts +1 -0
- package/dist/plugin-distribution/canonical-json.js +40 -0
- package/dist/plugin-distribution/compatibility.d.ts +5 -0
- package/dist/plugin-distribution/compatibility.js +38 -0
- package/dist/plugin-distribution/errors.d.ts +11 -0
- package/dist/plugin-distribution/errors.js +13 -0
- package/dist/plugin-distribution/hashes.d.ts +2 -0
- package/dist/plugin-distribution/hashes.js +17 -0
- package/dist/plugin-distribution/index.d.ts +18 -0
- package/dist/plugin-distribution/index.js +18 -0
- package/dist/plugin-distribution/installed-plugin-state.d.ts +20 -0
- package/dist/plugin-distribution/installed-plugin-state.js +73 -0
- package/dist/plugin-distribution/installer.d.ts +89 -0
- package/dist/plugin-distribution/installer.js +395 -0
- package/dist/plugin-distribution/manager.d.ts +128 -0
- package/dist/plugin-distribution/manager.js +358 -0
- package/dist/plugin-distribution/path-safety.d.ts +2 -0
- package/dist/plugin-distribution/path-safety.js +20 -0
- package/dist/plugin-distribution/plugin-bundle-verifier.d.ts +28 -0
- package/dist/plugin-distribution/plugin-bundle-verifier.js +96 -0
- package/dist/plugin-distribution/plugin-bundle-worker.d.ts +34 -0
- package/dist/plugin-distribution/plugin-bundle-worker.js +99 -0
- package/dist/plugin-distribution/plugin-bundle.d.ts +16 -0
- package/dist/plugin-distribution/plugin-bundle.js +244 -0
- package/dist/plugin-distribution/plugin-bundle.worker.d.ts +1 -0
- package/dist/plugin-distribution/plugin-bundle.worker.js +38 -0
- package/dist/plugin-distribution/registry-cache.d.ts +26 -0
- package/dist/plugin-distribution/registry-cache.js +85 -0
- package/dist/plugin-distribution/registry-client.d.ts +36 -0
- package/dist/plugin-distribution/registry-client.js +115 -0
- package/dist/plugin-distribution/reserved-ids.d.ts +4 -0
- package/dist/plugin-distribution/reserved-ids.js +10 -0
- package/dist/plugin-distribution/runtime-validation.d.ts +14 -0
- package/dist/plugin-distribution/runtime-validation.js +388 -0
- package/dist/plugin-distribution/schemas.d.ts +4895 -0
- package/dist/plugin-distribution/schemas.js +299 -0
- package/dist/plugin-distribution/signing.d.ts +5 -0
- package/dist/plugin-distribution/signing.js +38 -0
- package/dist/plugin-distribution/types.d.ts +217 -0
- package/dist/plugin-distribution/types.js +1 -0
- package/dist/plugin-install-progress.d.ts +15 -0
- package/dist/plugin-install-progress.js +86 -0
- package/dist/plugin-manager.d.ts +306 -0
- package/dist/plugin-manager.js +2848 -0
- package/dist/plugin-runtime-entry.d.ts +19 -0
- package/dist/plugin-runtime-entry.js +135 -0
- package/dist/plugin.d.ts +350 -0
- package/dist/plugin.js +754 -0
- package/dist/popover.d.ts +20 -0
- package/dist/popover.js +32 -0
- package/dist/promise-worker.d.ts +22 -0
- package/dist/promise-worker.js +65 -0
- package/dist/prompt-confirm.d.ts +9 -0
- package/dist/prompt-confirm.js +33 -0
- package/dist/search-document-provider.d.ts +45 -0
- package/dist/search-document-provider.js +54 -0
- package/dist/search-query/index.d.ts +78 -0
- package/dist/search-query/index.js +426 -0
- package/dist/search-query/parser.d.ts +3 -0
- package/dist/search-query/parser.js +16 -0
- package/dist/search-query/parser.terms.js +26 -0
- package/dist/search-query/search-query.grammar +128 -0
- package/dist/search.d.ts +19 -0
- package/dist/search.js +104 -0
- package/dist/setting-section-layout.d.ts +19 -0
- package/dist/setting-section-layout.js +194 -0
- package/dist/settings.svelte.d.ts +474 -0
- package/dist/settings.svelte.js +1421 -0
- package/dist/source-text-file-view.d.ts +25 -0
- package/dist/source-text-file-view.js +78 -0
- package/dist/status-bar.svelte.d.ts +29 -0
- package/dist/status-bar.svelte.js +72 -0
- package/dist/storage/app-database.d.ts +860 -0
- package/dist/storage/app-database.js +2372 -0
- package/dist/storage/blob-store.d.ts +12 -0
- package/dist/storage/blob-store.js +1 -0
- package/dist/storage/browser-app-database-coordination.d.ts +35 -0
- package/dist/storage/browser-app-database-coordination.js +207 -0
- package/dist/storage/browser-coordinated-app-database.d.ts +109 -0
- package/dist/storage/browser-coordinated-app-database.js +704 -0
- package/dist/storage/browser.d.ts +153 -0
- package/dist/storage/browser.js +794 -0
- package/dist/storage/desktop-native.d.ts +184 -0
- package/dist/storage/desktop-native.js +415 -0
- package/dist/storage/fs.d.ts +188 -0
- package/dist/storage/fs.js +307 -0
- package/dist/storage/index-projection.d.ts +236 -0
- package/dist/storage/index-projection.js +402 -0
- package/dist/storage/index.d.ts +17 -0
- package/dist/storage/index.js +17 -0
- package/dist/storage/keyval.d.ts +94 -0
- package/dist/storage/keyval.js +199 -0
- package/dist/storage/memory-vault-adapter.d.ts +44 -0
- package/dist/storage/memory-vault-adapter.js +351 -0
- package/dist/storage/native-vault-bootstrap-kv.d.ts +22 -0
- package/dist/storage/native-vault-bootstrap-kv.js +96 -0
- package/dist/storage/path.d.ts +22 -0
- package/dist/storage/path.js +110 -0
- package/dist/storage/search-embedding-provider.d.ts +75 -0
- package/dist/storage/search-embedding-provider.js +446 -0
- package/dist/storage/search-embedding-worker.d.ts +1 -0
- package/dist/storage/search-embedding-worker.js +63 -0
- package/dist/storage/search-query-evaluator.d.ts +14 -0
- package/dist/storage/search-query-evaluator.js +678 -0
- package/dist/storage/task-projection.d.ts +152 -0
- package/dist/storage/task-projection.js +154 -0
- package/dist/storage/turso-app-database.d.ts +150 -0
- package/dist/storage/turso-app-database.js +2671 -0
- package/dist/storage/vault-session.d.ts +37 -0
- package/dist/storage/vault-session.js +196 -0
- package/dist/storage/vault-state.d.ts +74 -0
- package/dist/storage/vault-state.js +181 -0
- package/dist/storage/vault.svelte.d.ts +257 -0
- package/dist/storage/vault.svelte.js +661 -0
- package/dist/suggest.d.ts +193 -0
- package/dist/suggest.js +391 -0
- package/dist/tasks.d.ts +7 -0
- package/dist/tasks.js +18 -0
- package/dist/telemetry.d.ts +116 -0
- package/dist/telemetry.js +103 -0
- package/dist/utils.d.ts +55 -0
- package/dist/utils.js +314 -0
- package/dist/vault-api.d.ts +5 -0
- package/dist/vault-api.js +3 -0
- package/dist/vault-maintenance-commands.d.ts +5 -0
- package/dist/vault-maintenance-commands.js +32 -0
- package/dist/view.svelte.d.ts +215 -0
- package/dist/view.svelte.js +381 -0
- package/dist/vite-env.d.ts +2 -0
- package/dist/workspace-host-internal.d.ts +7 -0
- package/dist/workspace-host-internal.js +7 -0
- package/dist/workspace-host.d.ts +10 -0
- package/dist/workspace-host.js +14 -0
- package/dist/workspace-layout-commands.d.ts +3 -0
- package/dist/workspace-layout-commands.js +72 -0
- package/dist/workspace-layout-normalizer.d.ts +92 -0
- package/dist/workspace-layout-normalizer.js +301 -0
- package/dist/workspace-layouts.d.ts +7 -0
- package/dist/workspace-layouts.js +23 -0
- package/dist/workspace-trust.d.ts +32 -0
- package/dist/workspace-trust.js +72 -0
- package/dist/workspace.svelte.d.ts +796 -0
- package/dist/workspace.svelte.js +4380 -0
- package/package.json +240 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { EventDispatcher } from "./events";
|
|
2
|
+
export const SKILL_NAME_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
|
|
3
|
+
export const SLASH_COMMAND_NAME_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
|
|
4
|
+
let skillSequence = 0;
|
|
5
|
+
let slashSequence = 0;
|
|
6
|
+
export function assertSkillRelativePath(path, label) {
|
|
7
|
+
const trimmed = path.trim().replaceAll("\\", "/");
|
|
8
|
+
if (!trimmed) {
|
|
9
|
+
throw new Error(`${label} must not be empty.`);
|
|
10
|
+
}
|
|
11
|
+
if (trimmed.startsWith("/") || /^[a-z]:/iu.test(trimmed)) {
|
|
12
|
+
throw new Error(`${label} must stay inside the extension root.`);
|
|
13
|
+
}
|
|
14
|
+
const segments = trimmed.split("/");
|
|
15
|
+
if (segments.some((segment) => segment === "" || segment === "." || segment === "..")) {
|
|
16
|
+
throw new Error(`${label} must not contain traversal segments.`);
|
|
17
|
+
}
|
|
18
|
+
return trimmed;
|
|
19
|
+
}
|
|
20
|
+
function normalizeSkill(skill) {
|
|
21
|
+
const name = skill.name.trim();
|
|
22
|
+
if (!SKILL_NAME_PATTERN.test(name)) {
|
|
23
|
+
throw new Error(`Invalid skill name: ${skill.name}. Expected pattern ${SKILL_NAME_PATTERN.source}.`);
|
|
24
|
+
}
|
|
25
|
+
const description = skill.description.trim();
|
|
26
|
+
if (!description) {
|
|
27
|
+
throw new Error(`Skill ${name} description must not be empty.`);
|
|
28
|
+
}
|
|
29
|
+
const instructions = skill.instructions.trim();
|
|
30
|
+
if (!instructions) {
|
|
31
|
+
throw new Error(`Skill ${name} instructions must not be empty.`);
|
|
32
|
+
}
|
|
33
|
+
return { ...skill, name, description, instructions };
|
|
34
|
+
}
|
|
35
|
+
function normalizeSlashName(name) {
|
|
36
|
+
const normalized = name.trim().replace(/^\/+/u, "").toLowerCase();
|
|
37
|
+
if (!SLASH_COMMAND_NAME_PATTERN.test(normalized)) {
|
|
38
|
+
throw new Error(`Invalid slash command name: ${name}. Expected pattern ${SLASH_COMMAND_NAME_PATTERN.source}.`);
|
|
39
|
+
}
|
|
40
|
+
return normalized;
|
|
41
|
+
}
|
|
42
|
+
/** Transport-neutral registry for plugin-owned skill sources. */
|
|
43
|
+
export class AppSkillRegistry extends EventDispatcher {
|
|
44
|
+
sources = new Map();
|
|
45
|
+
registerRoot(owner, path) {
|
|
46
|
+
return this.#registerPath(owner, "root", path);
|
|
47
|
+
}
|
|
48
|
+
registerDirectory(owner, path) {
|
|
49
|
+
return this.#registerPath(owner, "directory", path);
|
|
50
|
+
}
|
|
51
|
+
registerSkill(owner, skill) {
|
|
52
|
+
const pluginId = owner.pluginId.trim();
|
|
53
|
+
if (!pluginId) {
|
|
54
|
+
throw new Error("Skill owner plugin id must not be empty.");
|
|
55
|
+
}
|
|
56
|
+
const registeredSkill = normalizeSkill(skill);
|
|
57
|
+
const registrationId = `app-skill-${++skillSequence}`;
|
|
58
|
+
const registered = {
|
|
59
|
+
registrationId,
|
|
60
|
+
ownerPluginId: pluginId,
|
|
61
|
+
kind: "programmatic",
|
|
62
|
+
skill: registeredSkill,
|
|
63
|
+
};
|
|
64
|
+
this.sources.set(registrationId, registered);
|
|
65
|
+
this.emit("changed", {
|
|
66
|
+
registrationId,
|
|
67
|
+
ownerPluginId: pluginId,
|
|
68
|
+
reason: "registered",
|
|
69
|
+
});
|
|
70
|
+
return this.#disposable(registered);
|
|
71
|
+
}
|
|
72
|
+
list() {
|
|
73
|
+
return [...this.sources.values()];
|
|
74
|
+
}
|
|
75
|
+
#registerPath(owner, kind, path) {
|
|
76
|
+
const pluginId = owner.pluginId.trim();
|
|
77
|
+
if (!pluginId) {
|
|
78
|
+
throw new Error("Skill owner plugin id must not be empty.");
|
|
79
|
+
}
|
|
80
|
+
const relative = assertSkillRelativePath(path, "Skill source path");
|
|
81
|
+
const registrationId = `app-skill-${++skillSequence}`;
|
|
82
|
+
const registered = {
|
|
83
|
+
registrationId,
|
|
84
|
+
ownerPluginId: pluginId,
|
|
85
|
+
kind,
|
|
86
|
+
path: relative,
|
|
87
|
+
};
|
|
88
|
+
this.sources.set(registrationId, registered);
|
|
89
|
+
this.emit("changed", {
|
|
90
|
+
registrationId,
|
|
91
|
+
ownerPluginId: pluginId,
|
|
92
|
+
reason: "registered",
|
|
93
|
+
});
|
|
94
|
+
return this.#disposable(registered);
|
|
95
|
+
}
|
|
96
|
+
#disposable(registered) {
|
|
97
|
+
let disposed = false;
|
|
98
|
+
return {
|
|
99
|
+
id: registered.registrationId,
|
|
100
|
+
kind: registered.kind,
|
|
101
|
+
dispose: () => {
|
|
102
|
+
if (disposed)
|
|
103
|
+
return;
|
|
104
|
+
disposed = true;
|
|
105
|
+
if (this.sources.get(registered.registrationId) !== registered)
|
|
106
|
+
return;
|
|
107
|
+
this.sources.delete(registered.registrationId);
|
|
108
|
+
this.emit("changed", {
|
|
109
|
+
registrationId: registered.registrationId,
|
|
110
|
+
ownerPluginId: registered.ownerPluginId,
|
|
111
|
+
reason: "unregistered",
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/** Transport-neutral registry for plugin-owned composer slash commands. */
|
|
118
|
+
export class AppSlashCommandRegistry extends EventDispatcher {
|
|
119
|
+
commands = new Map();
|
|
120
|
+
register(owner, command) {
|
|
121
|
+
const pluginId = owner.pluginId.trim();
|
|
122
|
+
if (!pluginId) {
|
|
123
|
+
throw new Error("Slash command owner plugin id must not be empty.");
|
|
124
|
+
}
|
|
125
|
+
const name = normalizeSlashName(command.name);
|
|
126
|
+
if (this.commands.has(name)) {
|
|
127
|
+
throw new Error(`Slash command already registered: ${name}`);
|
|
128
|
+
}
|
|
129
|
+
const description = command.description.trim();
|
|
130
|
+
if (!description) {
|
|
131
|
+
throw new Error(`Slash command ${name} description must not be empty.`);
|
|
132
|
+
}
|
|
133
|
+
if (!command.dispatch || typeof command.dispatch !== "object") {
|
|
134
|
+
throw new Error(`Slash command ${name} must provide a dispatch.`);
|
|
135
|
+
}
|
|
136
|
+
const aliases = (command.aliases ?? []).map((alias) => normalizeSlashName(alias));
|
|
137
|
+
const registrationId = `app-slash-${++slashSequence}`;
|
|
138
|
+
const registered = {
|
|
139
|
+
registrationId,
|
|
140
|
+
ownerPluginId: pluginId,
|
|
141
|
+
command: {
|
|
142
|
+
...command,
|
|
143
|
+
name,
|
|
144
|
+
description,
|
|
145
|
+
aliases,
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
this.commands.set(name, registered);
|
|
149
|
+
this.emit("changed", {
|
|
150
|
+
registrationId,
|
|
151
|
+
name,
|
|
152
|
+
ownerPluginId: pluginId,
|
|
153
|
+
reason: "registered",
|
|
154
|
+
});
|
|
155
|
+
let disposed = false;
|
|
156
|
+
return {
|
|
157
|
+
id: registrationId,
|
|
158
|
+
name,
|
|
159
|
+
dispose: () => {
|
|
160
|
+
if (disposed)
|
|
161
|
+
return;
|
|
162
|
+
disposed = true;
|
|
163
|
+
if (this.commands.get(name) !== registered)
|
|
164
|
+
return;
|
|
165
|
+
this.commands.delete(name);
|
|
166
|
+
this.emit("changed", {
|
|
167
|
+
registrationId,
|
|
168
|
+
name,
|
|
169
|
+
ownerPluginId: pluginId,
|
|
170
|
+
reason: "unregistered",
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
get(name) {
|
|
176
|
+
const normalized = name.trim().replace(/^\/+/u, "").toLowerCase();
|
|
177
|
+
return this.commands.get(normalized);
|
|
178
|
+
}
|
|
179
|
+
list() {
|
|
180
|
+
return [...this.commands.values()].sort((left, right) => left.command.name.localeCompare(right.command.name));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { EventDispatcher } from "./events";
|
|
2
|
+
export type AppToolEffect = "read" | "write" | "external";
|
|
3
|
+
export type AppToolJsonValue = null | boolean | number | string | AppToolJsonValue[] | {
|
|
4
|
+
[key: string]: AppToolJsonValue;
|
|
5
|
+
};
|
|
6
|
+
export type AppToolContent = {
|
|
7
|
+
type: "text";
|
|
8
|
+
text: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: "image";
|
|
11
|
+
data: string;
|
|
12
|
+
mimeType: string;
|
|
13
|
+
};
|
|
14
|
+
export interface AppToolResult {
|
|
15
|
+
content: AppToolContent[];
|
|
16
|
+
isError?: boolean;
|
|
17
|
+
structuredContent?: AppToolJsonValue;
|
|
18
|
+
}
|
|
19
|
+
export interface AppToolApprovalDetails {
|
|
20
|
+
title: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
path?: string;
|
|
23
|
+
paths?: string[];
|
|
24
|
+
diff?: {
|
|
25
|
+
before: string;
|
|
26
|
+
after: string;
|
|
27
|
+
};
|
|
28
|
+
diffs?: Array<{
|
|
29
|
+
path?: string;
|
|
30
|
+
before: string;
|
|
31
|
+
after: string;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
export interface AppToolExecutionScope {
|
|
35
|
+
/** Vault-relative directory fixed by the owning conversation. */
|
|
36
|
+
readonly directory: string;
|
|
37
|
+
contains(path: string): boolean;
|
|
38
|
+
resolve(path: string): string;
|
|
39
|
+
}
|
|
40
|
+
/** Construct an immutable execution scope from trusted conversation state. */
|
|
41
|
+
export declare function createAppToolExecutionScope(directory: string): AppToolExecutionScope;
|
|
42
|
+
export interface AppToolExecutionContext {
|
|
43
|
+
conversationId: string;
|
|
44
|
+
agentBindingId: string;
|
|
45
|
+
runId: string;
|
|
46
|
+
toolCallId: string;
|
|
47
|
+
scope: AppToolExecutionScope;
|
|
48
|
+
launchNotePath?: string;
|
|
49
|
+
signal: AbortSignal;
|
|
50
|
+
}
|
|
51
|
+
export interface AppTool<TInput = unknown> {
|
|
52
|
+
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
inputSchema: Record<string, unknown>;
|
|
55
|
+
outputSchema?: Record<string, unknown>;
|
|
56
|
+
effect: AppToolEffect;
|
|
57
|
+
describeApproval?(input: TInput, context: AppToolExecutionContext): Promise<AppToolApprovalDetails>;
|
|
58
|
+
execute(input: TInput, context: AppToolExecutionContext): Promise<AppToolResult>;
|
|
59
|
+
}
|
|
60
|
+
export interface AppToolOwner {
|
|
61
|
+
pluginId: string;
|
|
62
|
+
source: "core" | "community" | "official" | "system";
|
|
63
|
+
provenance: "bundled" | "official" | "community" | "manual" | "development";
|
|
64
|
+
}
|
|
65
|
+
export interface RegisteredAppTool {
|
|
66
|
+
registrationId: string;
|
|
67
|
+
owner: AppToolOwner;
|
|
68
|
+
tool: AppTool;
|
|
69
|
+
}
|
|
70
|
+
export interface AppToolRegistration {
|
|
71
|
+
readonly id: string;
|
|
72
|
+
readonly name: string;
|
|
73
|
+
dispose(): void;
|
|
74
|
+
}
|
|
75
|
+
export type AppToolRegistryChange = {
|
|
76
|
+
registrationId: string;
|
|
77
|
+
name: string;
|
|
78
|
+
ownerPluginId: string;
|
|
79
|
+
reason: "registered" | "unregistered";
|
|
80
|
+
};
|
|
81
|
+
export { createVaultFileAppTools, createVaultFileOperations, } from "./file-tools";
|
|
82
|
+
export declare const APP_TOOL_NAME_PATTERN: RegExp;
|
|
83
|
+
/** Transport-neutral registry for plugin-owned application tools. */
|
|
84
|
+
export declare class AppToolRegistry extends EventDispatcher<{
|
|
85
|
+
changed: [change: AppToolRegistryChange];
|
|
86
|
+
}> {
|
|
87
|
+
private readonly tools;
|
|
88
|
+
register<TInput>(owner: AppToolOwner, tool: AppTool<TInput>): AppToolRegistration;
|
|
89
|
+
get(name: string): RegisteredAppTool | undefined;
|
|
90
|
+
resolve(name: string, registrationId: string): RegisteredAppTool | undefined;
|
|
91
|
+
list(): RegisteredAppTool[];
|
|
92
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { EventDispatcher } from "./events";
|
|
2
|
+
function assertPortableVaultPath(path, label) {
|
|
3
|
+
if (path.includes("\\") || path.startsWith("/") || /^[a-z]:/iu.test(path)) {
|
|
4
|
+
throw new Error(`${label} must be a vault-relative portable path.`);
|
|
5
|
+
}
|
|
6
|
+
const segments = path.split("/");
|
|
7
|
+
if (segments.some((segment) => segment === "." || segment === "..")) {
|
|
8
|
+
throw new Error(`${label} must not contain traversal segments.`);
|
|
9
|
+
}
|
|
10
|
+
if (segments.some((segment) => segment.length === 0) && path.length > 0) {
|
|
11
|
+
throw new Error(`${label} must not contain empty path segments.`);
|
|
12
|
+
}
|
|
13
|
+
return path;
|
|
14
|
+
}
|
|
15
|
+
/** Construct an immutable execution scope from trusted conversation state. */
|
|
16
|
+
export function createAppToolExecutionScope(directory) {
|
|
17
|
+
const trustedDirectory = assertPortableVaultPath(directory, "App tool scope directory");
|
|
18
|
+
return Object.freeze({
|
|
19
|
+
directory: trustedDirectory,
|
|
20
|
+
contains(path) {
|
|
21
|
+
try {
|
|
22
|
+
const candidate = assertPortableVaultPath(path, "App tool path");
|
|
23
|
+
return (trustedDirectory === "" ||
|
|
24
|
+
candidate === trustedDirectory ||
|
|
25
|
+
candidate.startsWith(`${trustedDirectory}/`));
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
resolve(path) {
|
|
32
|
+
const candidate = assertPortableVaultPath(path, "App tool path");
|
|
33
|
+
if (trustedDirectory !== "" &&
|
|
34
|
+
candidate !== trustedDirectory &&
|
|
35
|
+
!candidate.startsWith(`${trustedDirectory}/`)) {
|
|
36
|
+
throw new Error(`App tool path escapes scope: ${path}`);
|
|
37
|
+
}
|
|
38
|
+
return candidate;
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export { createVaultFileAppTools, createVaultFileOperations, } from "./file-tools";
|
|
43
|
+
export const APP_TOOL_NAME_PATTERN = /^[a-z][a-z0-9_]{0,63}$/;
|
|
44
|
+
let registrationSequence = 0;
|
|
45
|
+
function isRecord(value) {
|
|
46
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
47
|
+
}
|
|
48
|
+
function validateSchema(schema, label, toolName) {
|
|
49
|
+
if (!isRecord(schema)) {
|
|
50
|
+
throw new Error(`App tool ${toolName} ${label} schema must be an object.`);
|
|
51
|
+
}
|
|
52
|
+
if (schema.type !== "object") {
|
|
53
|
+
throw new Error(`App tool ${toolName} ${label} schema must have type object.`);
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
JSON.stringify(schema);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
throw new Error(`App tool ${toolName} ${label} schema must be serializable.`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function normalizeTool(tool) {
|
|
63
|
+
const name = tool.name.trim();
|
|
64
|
+
if (!APP_TOOL_NAME_PATTERN.test(name)) {
|
|
65
|
+
throw new Error(`Invalid app tool name: ${tool.name}. Expected pattern ${APP_TOOL_NAME_PATTERN.source}.`);
|
|
66
|
+
}
|
|
67
|
+
const description = tool.description.trim();
|
|
68
|
+
if (!description) {
|
|
69
|
+
throw new Error(`App tool ${name} description must not be empty.`);
|
|
70
|
+
}
|
|
71
|
+
if (!["read", "write", "external"].includes(tool.effect)) {
|
|
72
|
+
throw new Error(`App tool ${name} has an invalid effect: ${tool.effect}.`);
|
|
73
|
+
}
|
|
74
|
+
if (typeof tool.execute !== "function") {
|
|
75
|
+
throw new Error(`App tool ${name} must provide an execute function.`);
|
|
76
|
+
}
|
|
77
|
+
validateSchema(tool.inputSchema, "input", name);
|
|
78
|
+
if (tool.outputSchema !== undefined) {
|
|
79
|
+
validateSchema(tool.outputSchema, "output", name);
|
|
80
|
+
}
|
|
81
|
+
return { ...tool, name, description };
|
|
82
|
+
}
|
|
83
|
+
/** Transport-neutral registry for plugin-owned application tools. */
|
|
84
|
+
export class AppToolRegistry extends EventDispatcher {
|
|
85
|
+
tools = new Map();
|
|
86
|
+
register(owner, tool) {
|
|
87
|
+
const registeredTool = normalizeTool(tool);
|
|
88
|
+
if (!owner.pluginId.trim()) {
|
|
89
|
+
throw new Error("App tool owner plugin id must not be empty.");
|
|
90
|
+
}
|
|
91
|
+
if (this.tools.has(registeredTool.name)) {
|
|
92
|
+
throw new Error(`App tool already registered: ${registeredTool.name}`);
|
|
93
|
+
}
|
|
94
|
+
const registrationId = `app-tool-${++registrationSequence}`;
|
|
95
|
+
const registered = {
|
|
96
|
+
registrationId,
|
|
97
|
+
owner: { ...owner, pluginId: owner.pluginId.trim() },
|
|
98
|
+
tool: registeredTool,
|
|
99
|
+
};
|
|
100
|
+
this.tools.set(registeredTool.name, registered);
|
|
101
|
+
this.emit("changed", {
|
|
102
|
+
registrationId,
|
|
103
|
+
name: registeredTool.name,
|
|
104
|
+
ownerPluginId: registered.owner.pluginId,
|
|
105
|
+
reason: "registered",
|
|
106
|
+
});
|
|
107
|
+
let disposed = false;
|
|
108
|
+
return {
|
|
109
|
+
id: registrationId,
|
|
110
|
+
name: registeredTool.name,
|
|
111
|
+
dispose: () => {
|
|
112
|
+
if (disposed)
|
|
113
|
+
return;
|
|
114
|
+
disposed = true;
|
|
115
|
+
if (this.tools.get(registeredTool.name) !== registered)
|
|
116
|
+
return;
|
|
117
|
+
this.tools.delete(registeredTool.name);
|
|
118
|
+
this.emit("changed", {
|
|
119
|
+
registrationId,
|
|
120
|
+
name: registeredTool.name,
|
|
121
|
+
ownerPluginId: registered.owner.pluginId,
|
|
122
|
+
reason: "unregistered",
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
get(name) {
|
|
128
|
+
return this.tools.get(name);
|
|
129
|
+
}
|
|
130
|
+
resolve(name, registrationId) {
|
|
131
|
+
const registered = this.tools.get(name);
|
|
132
|
+
return registered?.registrationId === registrationId
|
|
133
|
+
? registered
|
|
134
|
+
: undefined;
|
|
135
|
+
}
|
|
136
|
+
list() {
|
|
137
|
+
return [...this.tools.values()].sort((left, right) => left.tool.name.localeCompare(right.tool.name));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const APP_SHELL_PLUGINS_PATH = ".obsidian/app-shell-plugins.json";
|
|
2
|
+
export interface AppShellPluginPersistenceVault {
|
|
3
|
+
mkpath?(path: string): Promise<unknown>;
|
|
4
|
+
adapter?: {
|
|
5
|
+
exists?(path: string): Promise<boolean>;
|
|
6
|
+
read(path: string): Promise<string>;
|
|
7
|
+
write(path: string, data: string): Promise<unknown>;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export type AppShellPluginPersistenceVaultSource = AppShellPluginPersistenceVault | (() => AppShellPluginPersistenceVault | undefined | null) | undefined | null;
|
|
11
|
+
export interface AppShellPluginEnablementPersistence {
|
|
12
|
+
load(): Promise<unknown | null>;
|
|
13
|
+
save(enabledById: Record<string, boolean>): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare function createAppShellPluginPersistence(vault: AppShellPluginPersistenceVaultSource): AppShellPluginEnablementPersistence;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const APP_SHELL_PLUGINS_PATH = ".obsidian/app-shell-plugins.json";
|
|
2
|
+
function resolvePluginPersistenceVault(source) {
|
|
3
|
+
if (typeof source === "function") {
|
|
4
|
+
return source() ?? undefined;
|
|
5
|
+
}
|
|
6
|
+
return source ?? undefined;
|
|
7
|
+
}
|
|
8
|
+
export function createAppShellPluginPersistence(vault) {
|
|
9
|
+
return {
|
|
10
|
+
async load() {
|
|
11
|
+
const adapter = resolvePluginPersistenceVault(vault)?.adapter;
|
|
12
|
+
if (!adapter?.read)
|
|
13
|
+
return null;
|
|
14
|
+
try {
|
|
15
|
+
if (adapter.exists && !(await adapter.exists(APP_SHELL_PLUGINS_PATH))) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const raw = await adapter.read(APP_SHELL_PLUGINS_PATH);
|
|
19
|
+
return JSON.parse(raw);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
async save(enabledById) {
|
|
26
|
+
const resolved = resolvePluginPersistenceVault(vault);
|
|
27
|
+
const adapter = resolved?.adapter;
|
|
28
|
+
if (!adapter?.write)
|
|
29
|
+
return;
|
|
30
|
+
await resolved?.mkpath?.(".obsidian").catch(() => undefined);
|
|
31
|
+
await adapter.write(APP_SHELL_PLUGINS_PATH, `${JSON.stringify(enabledById, null, 2)}\n`);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { App } from "./context.svelte";
|
|
2
|
+
import type { PaneType } from "./workspace.svelte";
|
|
3
|
+
export type AppUrlHandlerParams = Record<string, string>;
|
|
4
|
+
export type AppUrlHandler = (params: AppUrlHandlerParams) => unknown;
|
|
5
|
+
export interface ParsedAppUrl {
|
|
6
|
+
scheme: string;
|
|
7
|
+
action: string;
|
|
8
|
+
params: AppUrlHandlerParams;
|
|
9
|
+
}
|
|
10
|
+
export interface CreateLapisOpenUrlOptions {
|
|
11
|
+
vault: string;
|
|
12
|
+
file?: string;
|
|
13
|
+
path?: string;
|
|
14
|
+
paneType?: PaneType;
|
|
15
|
+
}
|
|
16
|
+
export declare function createLapisOpenUrl(options: CreateLapisOpenUrlOptions): string;
|
|
17
|
+
export declare function createLapisFileUrl(vault: string, file: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Parses `lapis://` app URLs and dispatches registered protocol handlers.
|
|
20
|
+
*
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export declare class AppUrlService {
|
|
24
|
+
#private;
|
|
25
|
+
private readonly app;
|
|
26
|
+
constructor(app: App);
|
|
27
|
+
/**
|
|
28
|
+
* Register a handler for a custom app URL action.
|
|
29
|
+
*
|
|
30
|
+
* @param action - Action name to match after the app URL scheme.
|
|
31
|
+
* @param handler - Callback invoked when a matching URL is dispatched.
|
|
32
|
+
* @returns A cleanup function that unregisters the handler.
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
registerProtocolHandler(action: string, handler: AppUrlHandler): () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Parse an app URL into its normalized action and parameter map.
|
|
38
|
+
*
|
|
39
|
+
* @param rawUrl - Raw `lapis://`, `lapis-notes://`, or compatible app URL.
|
|
40
|
+
* @returns The normalized URL request.
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
parse(rawUrl: string): ParsedAppUrl;
|
|
44
|
+
/**
|
|
45
|
+
* Dispatch an app URL through the built-in open handler or a registered
|
|
46
|
+
* custom action.
|
|
47
|
+
*
|
|
48
|
+
* @param rawUrl - Raw app URL to parse and execute.
|
|
49
|
+
* @returns `true` when the URL was handled successfully.
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
dispatch(rawUrl: string): Promise<boolean>;
|
|
53
|
+
private open;
|
|
54
|
+
}
|