@aigne/afs-cli 1.11.0-beta.1 → 1.11.0-beta.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 +262 -15
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/_virtual/rolldown_runtime.mjs +7 -0
- package/dist/cli.cjs +40 -0
- package/dist/cli.d.cts +2 -0
- package/dist/cli.d.mts +2 -1
- package/dist/cli.mjs +36 -24
- package/dist/cli.mjs.map +1 -0
- package/dist/config/afs-loader.cjs +578 -0
- package/dist/config/afs-loader.d.cts +19 -0
- package/dist/config/afs-loader.d.cts.map +1 -0
- package/dist/config/afs-loader.d.mts +19 -0
- package/dist/config/afs-loader.d.mts.map +1 -0
- package/dist/config/afs-loader.mjs +576 -0
- package/dist/config/afs-loader.mjs.map +1 -0
- package/dist/config/env.cjs +46 -0
- package/dist/config/env.mjs +46 -0
- package/dist/config/env.mjs.map +1 -0
- package/dist/config/loader.cjs +219 -0
- package/dist/config/loader.mjs +217 -0
- package/dist/config/loader.mjs.map +1 -0
- package/dist/config/mount-commands.cjs +226 -0
- package/dist/config/mount-commands.d.cts +14 -0
- package/dist/config/mount-commands.d.cts.map +1 -0
- package/dist/config/mount-commands.d.mts +14 -0
- package/dist/config/mount-commands.d.mts.map +1 -0
- package/dist/config/mount-commands.mjs +220 -0
- package/dist/config/mount-commands.mjs.map +1 -0
- package/dist/config/schema.cjs +99 -0
- package/dist/config/schema.mjs +98 -0
- package/dist/config/schema.mjs.map +1 -0
- package/dist/core/commands/delete.cjs +41 -0
- package/dist/core/commands/delete.d.cts +18 -0
- package/dist/core/commands/delete.d.cts.map +1 -0
- package/dist/core/commands/delete.d.mts +18 -0
- package/dist/core/commands/delete.d.mts.map +1 -0
- package/dist/core/commands/delete.mjs +42 -0
- package/dist/core/commands/delete.mjs.map +1 -0
- package/dist/core/commands/exec.cjs +98 -0
- package/dist/core/commands/exec.d.cts +26 -0
- package/dist/core/commands/exec.d.cts.map +1 -0
- package/dist/core/commands/exec.d.mts +26 -0
- package/dist/core/commands/exec.d.mts.map +1 -0
- package/dist/core/commands/exec.mjs +99 -0
- package/dist/core/commands/exec.mjs.map +1 -0
- package/dist/core/commands/explain.cjs +278 -0
- package/dist/core/commands/explain.d.cts +25 -0
- package/dist/core/commands/explain.d.cts.map +1 -0
- package/dist/core/commands/explain.d.mts +25 -0
- package/dist/core/commands/explain.d.mts.map +1 -0
- package/dist/core/commands/explain.mjs +279 -0
- package/dist/core/commands/explain.mjs.map +1 -0
- package/dist/core/commands/explore.cjs +30 -0
- package/dist/core/commands/explore.d.mts +2 -0
- package/dist/core/commands/explore.mjs +31 -0
- package/dist/core/commands/explore.mjs.map +1 -0
- package/dist/core/commands/index.cjs +36 -0
- package/dist/core/commands/index.d.cts +21 -0
- package/dist/core/commands/index.d.cts.map +1 -0
- package/dist/core/commands/index.d.mts +24 -0
- package/dist/core/commands/index.d.mts.map +1 -0
- package/dist/core/commands/index.mjs +37 -0
- package/dist/core/commands/index.mjs.map +1 -0
- package/dist/core/commands/ls.cjs +57 -0
- package/dist/core/commands/ls.d.cts +21 -0
- package/dist/core/commands/ls.d.cts.map +1 -0
- package/dist/core/commands/ls.d.mts +21 -0
- package/dist/core/commands/ls.d.mts.map +1 -0
- package/dist/core/commands/ls.mjs +58 -0
- package/dist/core/commands/ls.mjs.map +1 -0
- package/dist/core/commands/mount.cjs +222 -0
- package/dist/core/commands/mount.d.cts +35 -0
- package/dist/core/commands/mount.d.cts.map +1 -0
- package/dist/core/commands/mount.d.mts +35 -0
- package/dist/core/commands/mount.d.mts.map +1 -0
- package/dist/core/commands/mount.mjs +223 -0
- package/dist/core/commands/mount.mjs.map +1 -0
- package/dist/core/commands/read.cjs +48 -0
- package/dist/core/commands/read.d.cts +17 -0
- package/dist/core/commands/read.d.cts.map +1 -0
- package/dist/core/commands/read.d.mts +17 -0
- package/dist/core/commands/read.d.mts.map +1 -0
- package/dist/core/commands/read.mjs +49 -0
- package/dist/core/commands/read.mjs.map +1 -0
- package/dist/core/commands/search.cjs +40 -0
- package/dist/core/commands/search.d.mts +2 -0
- package/dist/core/commands/search.mjs +41 -0
- package/dist/core/commands/search.mjs.map +1 -0
- package/dist/core/commands/serve.cjs +267 -0
- package/dist/core/commands/serve.d.mts +2 -0
- package/dist/core/commands/serve.mjs +267 -0
- package/dist/core/commands/serve.mjs.map +1 -0
- package/dist/core/commands/stat.cjs +53 -0
- package/dist/core/commands/stat.d.cts +17 -0
- package/dist/core/commands/stat.d.cts.map +1 -0
- package/dist/core/commands/stat.d.mts +17 -0
- package/dist/core/commands/stat.d.mts.map +1 -0
- package/dist/core/commands/stat.mjs +54 -0
- package/dist/core/commands/stat.mjs.map +1 -0
- package/dist/core/commands/types.cjs +18 -0
- package/dist/core/commands/types.d.cts +54 -0
- package/dist/core/commands/types.d.cts.map +1 -0
- package/dist/core/commands/types.d.mts +54 -0
- package/dist/core/commands/types.d.mts.map +1 -0
- package/dist/core/commands/types.mjs +19 -0
- package/dist/core/commands/types.mjs.map +1 -0
- package/dist/core/commands/write.cjs +70 -0
- package/dist/core/commands/write.d.cts +20 -0
- package/dist/core/commands/write.d.cts.map +1 -0
- package/dist/core/commands/write.d.mts +20 -0
- package/dist/core/commands/write.d.mts.map +1 -0
- package/dist/core/commands/write.mjs +71 -0
- package/dist/core/commands/write.mjs.map +1 -0
- package/dist/core/executor/index.cjs +196 -0
- package/dist/core/executor/index.d.cts +77 -0
- package/dist/core/executor/index.d.cts.map +1 -0
- package/dist/core/executor/index.d.mts +77 -0
- package/dist/core/executor/index.d.mts.map +1 -0
- package/dist/core/executor/index.mjs +195 -0
- package/dist/core/executor/index.mjs.map +1 -0
- package/dist/core/formatters/delete.cjs +37 -0
- package/dist/core/formatters/delete.d.cts +18 -0
- package/dist/core/formatters/delete.d.cts.map +1 -0
- package/dist/core/formatters/delete.d.mts +18 -0
- package/dist/core/formatters/delete.d.mts.map +1 -0
- package/dist/core/formatters/delete.mjs +37 -0
- package/dist/core/formatters/delete.mjs.map +1 -0
- package/dist/core/formatters/exec.cjs +60 -0
- package/dist/core/formatters/exec.d.cts +18 -0
- package/dist/core/formatters/exec.d.cts.map +1 -0
- package/dist/core/formatters/exec.d.mts +18 -0
- package/dist/core/formatters/exec.d.mts.map +1 -0
- package/dist/core/formatters/exec.mjs +60 -0
- package/dist/core/formatters/exec.mjs.map +1 -0
- package/dist/core/formatters/explain.cjs +99 -0
- package/dist/core/formatters/explain.d.cts +11 -0
- package/dist/core/formatters/explain.d.cts.map +1 -0
- package/dist/core/formatters/explain.d.mts +11 -0
- package/dist/core/formatters/explain.d.mts.map +1 -0
- package/dist/core/formatters/explain.mjs +98 -0
- package/dist/core/formatters/explain.mjs.map +1 -0
- package/dist/core/formatters/index.d.mts +9 -0
- package/dist/core/formatters/ls.cjs +179 -0
- package/dist/core/formatters/ls.d.cts +20 -0
- package/dist/core/formatters/ls.d.cts.map +1 -0
- package/dist/core/formatters/ls.d.mts +20 -0
- package/dist/core/formatters/ls.d.mts.map +1 -0
- package/dist/core/formatters/ls.mjs +179 -0
- package/dist/core/formatters/ls.mjs.map +1 -0
- package/dist/core/formatters/mount.cjs +55 -0
- package/dist/core/formatters/mount.d.cts +15 -0
- package/dist/core/formatters/mount.d.cts.map +1 -0
- package/dist/core/formatters/mount.d.mts +15 -0
- package/dist/core/formatters/mount.d.mts.map +1 -0
- package/dist/core/formatters/mount.mjs +55 -0
- package/dist/core/formatters/mount.mjs.map +1 -0
- package/dist/core/formatters/read.cjs +100 -0
- package/dist/core/formatters/read.d.cts +22 -0
- package/dist/core/formatters/read.d.cts.map +1 -0
- package/dist/core/formatters/read.d.mts +22 -0
- package/dist/core/formatters/read.d.mts.map +1 -0
- package/dist/core/formatters/read.mjs +100 -0
- package/dist/core/formatters/read.mjs.map +1 -0
- package/dist/core/formatters/search.cjs +44 -0
- package/dist/core/formatters/search.d.mts +1 -0
- package/dist/core/formatters/search.mjs +44 -0
- package/dist/core/formatters/search.mjs.map +1 -0
- package/dist/core/formatters/stat.cjs +155 -0
- package/dist/core/formatters/stat.d.cts +15 -0
- package/dist/core/formatters/stat.d.cts.map +1 -0
- package/dist/core/formatters/stat.d.mts +15 -0
- package/dist/core/formatters/stat.d.mts.map +1 -0
- package/dist/core/formatters/stat.mjs +155 -0
- package/dist/core/formatters/stat.mjs.map +1 -0
- package/dist/core/formatters/write.cjs +51 -0
- package/dist/core/formatters/write.d.cts +22 -0
- package/dist/core/formatters/write.d.cts.map +1 -0
- package/dist/core/formatters/write.d.mts +22 -0
- package/dist/core/formatters/write.d.mts.map +1 -0
- package/dist/core/formatters/write.mjs +51 -0
- package/dist/core/formatters/write.mjs.map +1 -0
- package/dist/core/helpers/exec-args.cjs +142 -0
- package/dist/core/helpers/exec-args.d.cts +46 -0
- package/dist/core/helpers/exec-args.d.cts.map +1 -0
- package/dist/core/helpers/exec-args.d.mts +46 -0
- package/dist/core/helpers/exec-args.d.mts.map +1 -0
- package/dist/core/helpers/exec-args.mjs +139 -0
- package/dist/core/helpers/exec-args.mjs.map +1 -0
- package/dist/core/helpers/stdin.cjs +41 -0
- package/dist/core/helpers/stdin.d.cts +15 -0
- package/dist/core/helpers/stdin.d.cts.map +1 -0
- package/dist/core/helpers/stdin.d.mts +15 -0
- package/dist/core/helpers/stdin.d.mts.map +1 -0
- package/dist/core/helpers/stdin.mjs +41 -0
- package/dist/core/helpers/stdin.mjs.map +1 -0
- package/dist/core/index.cjs +49 -0
- package/dist/core/index.d.cts +24 -0
- package/dist/core/index.d.mts +25 -0
- package/dist/core/index.mjs +24 -0
- package/dist/core/path-utils.cjs +1 -0
- package/dist/core/path-utils.mjs +3 -0
- package/dist/core/types.d.cts +24 -0
- package/dist/core/types.d.cts.map +1 -0
- package/dist/core/types.d.mts +24 -0
- package/dist/core/types.d.mts.map +1 -0
- package/dist/credential/auth-server.cjs +247 -0
- package/dist/credential/auth-server.mjs +247 -0
- package/dist/credential/auth-server.mjs.map +1 -0
- package/dist/credential/cli-auth-context.cjs +86 -0
- package/dist/credential/cli-auth-context.d.mts +1 -0
- package/dist/credential/cli-auth-context.mjs +86 -0
- package/dist/credential/cli-auth-context.mjs.map +1 -0
- package/dist/credential/index.cjs +5 -0
- package/dist/credential/index.d.mts +4 -0
- package/dist/credential/index.mjs +7 -0
- package/dist/credential/mcp-auth-context.cjs +186 -0
- package/dist/credential/mcp-auth-context.d.mts +1 -0
- package/dist/credential/mcp-auth-context.mjs +186 -0
- package/dist/credential/mcp-auth-context.mjs.map +1 -0
- package/dist/credential/resolver.cjs +127 -0
- package/dist/credential/resolver.d.mts +1 -0
- package/dist/credential/resolver.mjs +127 -0
- package/dist/credential/resolver.mjs.map +1 -0
- package/dist/credential/store.cjs +106 -0
- package/dist/credential/store.d.cts +30 -0
- package/dist/credential/store.d.cts.map +1 -0
- package/dist/credential/store.d.mts +30 -0
- package/dist/credential/store.d.mts.map +1 -0
- package/dist/credential/store.mjs +106 -0
- package/dist/credential/store.mjs.map +1 -0
- package/dist/errors.cjs +18 -0
- package/dist/errors.mjs +18 -0
- package/dist/errors.mjs.map +1 -0
- package/dist/explorer/actions.cjs +311 -0
- package/dist/explorer/actions.mjs +305 -0
- package/dist/explorer/actions.mjs.map +1 -0
- package/dist/explorer/components/dialog.cjs +508 -0
- package/dist/explorer/components/dialog.mjs +509 -0
- package/dist/explorer/components/dialog.mjs.map +1 -0
- package/dist/explorer/components/file-list.cjs +107 -0
- package/dist/explorer/components/file-list.mjs +107 -0
- package/dist/explorer/components/file-list.mjs.map +1 -0
- package/dist/explorer/components/function-bar.cjs +55 -0
- package/dist/explorer/components/function-bar.mjs +55 -0
- package/dist/explorer/components/function-bar.mjs.map +1 -0
- package/dist/explorer/components/index.cjs +5 -0
- package/dist/explorer/components/index.mjs +7 -0
- package/dist/explorer/components/metadata-panel.cjs +219 -0
- package/dist/explorer/components/metadata-panel.mjs +219 -0
- package/dist/explorer/components/metadata-panel.mjs.map +1 -0
- package/dist/explorer/components/status-bar.cjs +53 -0
- package/dist/explorer/components/status-bar.mjs +54 -0
- package/dist/explorer/components/status-bar.mjs.map +1 -0
- package/dist/explorer/keybindings.cjs +214 -0
- package/dist/explorer/keybindings.mjs +213 -0
- package/dist/explorer/keybindings.mjs.map +1 -0
- package/dist/explorer/screen.cjs +251 -0
- package/dist/explorer/screen.d.cts +23 -0
- package/dist/explorer/screen.d.cts.map +1 -0
- package/dist/explorer/screen.d.mts +23 -0
- package/dist/explorer/screen.d.mts.map +1 -0
- package/dist/explorer/screen.mjs +250 -0
- package/dist/explorer/screen.mjs.map +1 -0
- package/dist/explorer/state.cjs +53 -0
- package/dist/explorer/state.mjs +53 -0
- package/dist/explorer/state.mjs.map +1 -0
- package/dist/explorer/theme.cjs +160 -0
- package/dist/explorer/theme.mjs +157 -0
- package/dist/explorer/theme.mjs.map +1 -0
- package/dist/index.cjs +12 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.mts +7 -4
- package/dist/index.mjs +7 -2
- package/dist/mcp/http-transport.cjs +87 -0
- package/dist/mcp/http-transport.mjs +87 -0
- package/dist/mcp/http-transport.mjs.map +1 -0
- package/dist/mcp/prompts.cjs +48 -0
- package/dist/mcp/prompts.mjs +48 -0
- package/dist/mcp/prompts.mjs.map +1 -0
- package/dist/mcp/resources.cjs +25 -0
- package/dist/mcp/resources.mjs +25 -0
- package/dist/mcp/resources.mjs.map +1 -0
- package/dist/mcp/server.cjs +74 -0
- package/dist/mcp/server.mjs +73 -0
- package/dist/mcp/server.mjs.map +1 -0
- package/dist/mcp/tools.cjs +152 -0
- package/dist/mcp/tools.mjs +152 -0
- package/dist/mcp/tools.mjs.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.cts +10 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.mts +10 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.cts +46 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.cts.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.mts +46 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/types.d.mts.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.cjs +902 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.mjs +902 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.mjs.map +1 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.cjs +6 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.mjs +8 -0
- package/dist/node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.mjs.map +1 -0
- package/dist/path-utils.cjs +105 -0
- package/dist/path-utils.d.cts +50 -0
- package/dist/path-utils.d.cts.map +1 -0
- package/dist/path-utils.d.mts +50 -0
- package/dist/path-utils.d.mts.map +1 -0
- package/dist/path-utils.mjs +104 -0
- package/dist/path-utils.mjs.map +1 -0
- package/dist/repl.cjs +491 -0
- package/dist/repl.d.cts +15 -0
- package/dist/repl.d.cts.map +1 -0
- package/dist/repl.d.mts +16 -0
- package/dist/repl.d.mts.map +1 -0
- package/dist/repl.mjs +491 -0
- package/dist/repl.mjs.map +1 -0
- package/dist/serve.cjs +146 -0
- package/dist/serve.d.cts +41 -0
- package/dist/serve.d.cts.map +1 -0
- package/dist/serve.d.mts +41 -0
- package/dist/serve.d.mts.map +1 -0
- package/dist/serve.mjs +146 -0
- package/dist/serve.mjs.map +1 -0
- package/dist/ui/header.cjs +12 -0
- package/dist/ui/header.mjs +13 -0
- package/dist/ui/header.mjs.map +1 -0
- package/dist/ui/index.cjs +8 -0
- package/dist/ui/index.mjs +9 -0
- package/dist/ui/index.mjs.map +1 -0
- package/dist/ui/terminal.cjs +88 -0
- package/dist/ui/terminal.mjs +88 -0
- package/dist/ui/terminal.mjs.map +1 -0
- package/dist/version.cjs +9 -0
- package/dist/version.d.cts +5 -0
- package/dist/version.d.cts.map +1 -0
- package/dist/version.d.mts +5 -0
- package/dist/version.d.mts.map +1 -0
- package/dist/version.mjs +9 -0
- package/dist/version.mjs.map +1 -0
- package/package.json +77 -11
- package/.turbo/turbo-build.log +0 -18
- package/.turbo/turbo-check-types.log +0 -4
- package/dist/version--p6A8sKX.mjs +0 -5
- package/src/cli.test.ts +0 -8
- package/src/cli.ts +0 -29
- package/src/index.ts +0 -7
- package/src/version.ts +0 -1
- package/tsconfig.json +0 -16
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region src/mcp/prompts.ts
|
|
2
|
+
/**
|
|
3
|
+
* Register MCP prompts on the server.
|
|
4
|
+
*/
|
|
5
|
+
function registerPrompts(server, afs) {
|
|
6
|
+
server.prompt("explore", "Explore the AFS virtual filesystem and learn how to use it", async () => {
|
|
7
|
+
const mountList = afs.getMounts().map((m) => {
|
|
8
|
+
const mode = m.module.accessMode ?? "readonly";
|
|
9
|
+
return ` - ${m.path} (${m.module.name}, ${mode})`;
|
|
10
|
+
});
|
|
11
|
+
return { messages: [{
|
|
12
|
+
role: "user",
|
|
13
|
+
content: {
|
|
14
|
+
type: "text",
|
|
15
|
+
text: `# AFS Explorer Guide
|
|
16
|
+
|
|
17
|
+
AFS (Agentic File System) provides a unified interface to access various data sources.
|
|
18
|
+
Use these tools to navigate and interact with the mounted providers:
|
|
19
|
+
|
|
20
|
+
## Available Tools
|
|
21
|
+
|
|
22
|
+
- **afs_list** — List directory contents at a path. Start with \`afs_list /\` to see all mount points.
|
|
23
|
+
- **afs_read** — Read the content of a file or entry.
|
|
24
|
+
- **afs_stat** — Get metadata (size, type, children count) for any path.
|
|
25
|
+
- **afs_search** — Search for content within a path subtree.
|
|
26
|
+
- **afs_explain** — Get a human-readable explanation of a path or topic.
|
|
27
|
+
- **afs_write** — Write content to a path (if the provider supports it).
|
|
28
|
+
- **afs_delete** — Delete a file or directory.
|
|
29
|
+
- **afs_exec** — Execute an action. Use \`afs_list {path}/.actions\` to discover available actions.
|
|
30
|
+
|
|
31
|
+
## Getting Started
|
|
32
|
+
|
|
33
|
+
1. Run \`afs_list /\` to see all mount points
|
|
34
|
+
2. Pick a mount and run \`afs_list /mount-path\` to explore its contents
|
|
35
|
+
3. Use \`afs_read\` to view files, \`afs_stat\` for metadata
|
|
36
|
+
4. Use \`afs_list {path}/.actions\` to discover executable actions
|
|
37
|
+
5. Mount new providers: \`afs_exec /.actions/mount {uri, path}\` or via registry \`afs_exec /registry/.../.actions/mount\`
|
|
38
|
+
6. Unmount providers: \`afs_exec /.actions/unmount {path}\`
|
|
39
|
+
|
|
40
|
+
${mountList.length > 0 ? `## Current Mounts\n\n${mountList.join("\n")}` : "## Current Mounts\n\nNo providers are currently mounted."}`
|
|
41
|
+
}
|
|
42
|
+
}] };
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { registerPrompts };
|
|
48
|
+
//# sourceMappingURL=prompts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.mjs","names":[],"sources":["../../src/mcp/prompts.ts"],"sourcesContent":["/**\n * AFS MCP Prompts Registration\n *\n * Registers the \"explore\" prompt that provides a usage guide with dynamic mount info.\n */\n\nimport type { AFS } from \"@aigne/afs\";\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\n\n/**\n * Register MCP prompts on the server.\n */\nexport function registerPrompts(server: McpServer, afs: AFS): void {\n server.prompt(\n \"explore\",\n \"Explore the AFS virtual filesystem and learn how to use it\",\n async () => {\n const mounts = afs.getMounts();\n const mountList = mounts.map((m) => {\n const mode = m.module.accessMode ?? \"readonly\";\n return ` - ${m.path} (${m.module.name}, ${mode})`;\n });\n\n const mountSection =\n mountList.length > 0\n ? `## Current Mounts\\n\\n${mountList.join(\"\\n\")}`\n : \"## Current Mounts\\n\\nNo providers are currently mounted.\";\n\n const guide = `# AFS Explorer Guide\n\nAFS (Agentic File System) provides a unified interface to access various data sources.\nUse these tools to navigate and interact with the mounted providers:\n\n## Available Tools\n\n- **afs_list** — List directory contents at a path. Start with \\`afs_list /\\` to see all mount points.\n- **afs_read** — Read the content of a file or entry.\n- **afs_stat** — Get metadata (size, type, children count) for any path.\n- **afs_search** — Search for content within a path subtree.\n- **afs_explain** — Get a human-readable explanation of a path or topic.\n- **afs_write** — Write content to a path (if the provider supports it).\n- **afs_delete** — Delete a file or directory.\n- **afs_exec** — Execute an action. Use \\`afs_list {path}/.actions\\` to discover available actions.\n\n## Getting Started\n\n1. Run \\`afs_list /\\` to see all mount points\n2. Pick a mount and run \\`afs_list /mount-path\\` to explore its contents\n3. Use \\`afs_read\\` to view files, \\`afs_stat\\` for metadata\n4. Use \\`afs_list {path}/.actions\\` to discover executable actions\n5. Mount new providers: \\`afs_exec /.actions/mount {uri, path}\\` or via registry \\`afs_exec /registry/.../.actions/mount\\`\n6. Unmount providers: \\`afs_exec /.actions/unmount {path}\\`\n\n${mountSection}`;\n\n return {\n messages: [\n {\n role: \"user\" as const,\n content: { type: \"text\" as const, text: guide },\n },\n ],\n };\n },\n );\n}\n"],"mappings":";;;;AAYA,SAAgB,gBAAgB,QAAmB,KAAgB;AACjE,QAAO,OACL,WACA,8DACA,YAAY;EAEV,MAAM,YADS,IAAI,WAAW,CACL,KAAK,MAAM;GAClC,MAAM,OAAO,EAAE,OAAO,cAAc;AACpC,UAAO,OAAO,EAAE,KAAK,IAAI,EAAE,OAAO,KAAK,IAAI,KAAK;IAChD;AAkCF,SAAO,EACL,UAAU,CACR;GACE,MAAM;GACN,SAAS;IAAE,MAAM;IAAiB,MA/B1B;;;;;;;;;;;;;;;;;;;;;;;;;EAJZ,UAAU,SAAS,IACf,wBAAwB,UAAU,KAAK,KAAK,KAC5C;IAiC+C;GAChD,CACF,EACF;GAEJ"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/mcp/resources.ts
|
|
3
|
+
/**
|
|
4
|
+
* Register MCP resources on the server.
|
|
5
|
+
*/
|
|
6
|
+
function registerResources(server, afs) {
|
|
7
|
+
server.resource("mounts", "afs:///mounts", {
|
|
8
|
+
description: "List of all mounted AFS providers",
|
|
9
|
+
mimeType: "application/json"
|
|
10
|
+
}, async () => {
|
|
11
|
+
const safeList = afs.getMounts().map((m) => ({
|
|
12
|
+
path: m.path,
|
|
13
|
+
name: m.module.name,
|
|
14
|
+
accessMode: m.module.accessMode ?? "readonly"
|
|
15
|
+
}));
|
|
16
|
+
return { contents: [{
|
|
17
|
+
uri: "afs:///mounts",
|
|
18
|
+
mimeType: "application/json",
|
|
19
|
+
text: JSON.stringify(safeList, null, 2)
|
|
20
|
+
}] };
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.registerResources = registerResources;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/mcp/resources.ts
|
|
2
|
+
/**
|
|
3
|
+
* Register MCP resources on the server.
|
|
4
|
+
*/
|
|
5
|
+
function registerResources(server, afs) {
|
|
6
|
+
server.resource("mounts", "afs:///mounts", {
|
|
7
|
+
description: "List of all mounted AFS providers",
|
|
8
|
+
mimeType: "application/json"
|
|
9
|
+
}, async () => {
|
|
10
|
+
const safeList = afs.getMounts().map((m) => ({
|
|
11
|
+
path: m.path,
|
|
12
|
+
name: m.module.name,
|
|
13
|
+
accessMode: m.module.accessMode ?? "readonly"
|
|
14
|
+
}));
|
|
15
|
+
return { contents: [{
|
|
16
|
+
uri: "afs:///mounts",
|
|
17
|
+
mimeType: "application/json",
|
|
18
|
+
text: JSON.stringify(safeList, null, 2)
|
|
19
|
+
}] };
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { registerResources };
|
|
25
|
+
//# sourceMappingURL=resources.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.mjs","names":[],"sources":["../../src/mcp/resources.ts"],"sourcesContent":["/**\n * AFS MCP Resources Registration\n *\n * Registers the afs:///mounts resource that exposes mount point information.\n */\n\nimport type { AFS } from \"@aigne/afs\";\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\n\n/**\n * Register MCP resources on the server.\n */\nexport function registerResources(server: McpServer, afs: AFS): void {\n server.resource(\n \"mounts\",\n \"afs:///mounts\",\n {\n description: \"List of all mounted AFS providers\",\n mimeType: \"application/json\",\n },\n async () => {\n const mounts = afs.getMounts();\n const safeList = mounts.map((m) => ({\n path: m.path,\n name: m.module.name,\n accessMode: m.module.accessMode ?? \"readonly\",\n }));\n\n return {\n contents: [\n {\n uri: \"afs:///mounts\",\n mimeType: \"application/json\",\n text: JSON.stringify(safeList, null, 2),\n },\n ],\n };\n },\n );\n}\n"],"mappings":";;;;AAYA,SAAgB,kBAAkB,QAAmB,KAAgB;AACnE,QAAO,SACL,UACA,iBACA;EACE,aAAa;EACb,UAAU;EACX,EACD,YAAY;EAEV,MAAM,WADS,IAAI,WAAW,CACN,KAAK,OAAO;GAClC,MAAM,EAAE;GACR,MAAM,EAAE,OAAO;GACf,YAAY,EAAE,OAAO,cAAc;GACpC,EAAE;AAEH,SAAO,EACL,UAAU,CACR;GACE,KAAK;GACL,UAAU;GACV,MAAM,KAAK,UAAU,UAAU,MAAM,EAAE;GACxC,CACF,EACF;GAEJ"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_version = require('../version.cjs');
|
|
3
|
+
const require_prompts = require('./prompts.cjs');
|
|
4
|
+
const require_resources = require('./resources.cjs');
|
|
5
|
+
const require_tools = require('./tools.cjs');
|
|
6
|
+
let _modelcontextprotocol_sdk_server_mcp_js = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
7
|
+
|
|
8
|
+
//#region src/mcp/server.ts
|
|
9
|
+
/**
|
|
10
|
+
* Create a new McpServer instance with AFS capabilities.
|
|
11
|
+
* Useful when you need the server before AFS is created (e.g. for MCP auth context).
|
|
12
|
+
*/
|
|
13
|
+
function createMcpServerInstance() {
|
|
14
|
+
return new _modelcontextprotocol_sdk_server_mcp_js.McpServer({
|
|
15
|
+
name: "afs",
|
|
16
|
+
version: require_version.VERSION
|
|
17
|
+
}, { capabilities: {
|
|
18
|
+
tools: {},
|
|
19
|
+
resources: {},
|
|
20
|
+
prompts: {}
|
|
21
|
+
} });
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Build MCP instructions string from AFS instance.
|
|
25
|
+
* Includes base AFS description + dynamically mounted provider details.
|
|
26
|
+
*/
|
|
27
|
+
function buildInstructions(afs) {
|
|
28
|
+
const lines = [];
|
|
29
|
+
lines.push("AFS (Agentic File System) is a virtual filesystem that unifies different data sources into a single namespace.");
|
|
30
|
+
lines.push("All data sources are accessed through a consistent path-based API with standard operations: read, list, stat, explain, search, write, delete, exec.");
|
|
31
|
+
lines.push("");
|
|
32
|
+
lines.push("## Mounted Providers");
|
|
33
|
+
lines.push("");
|
|
34
|
+
const mounts = afs.getMounts(null);
|
|
35
|
+
if (mounts.length === 0) lines.push("No providers currently mounted.");
|
|
36
|
+
else for (const m of mounts) {
|
|
37
|
+
const desc = m.module.description;
|
|
38
|
+
lines.push(`### ${m.module.name} (${m.path})`);
|
|
39
|
+
if (desc) for (const line of desc.split("\n")) lines.push(line);
|
|
40
|
+
lines.push("");
|
|
41
|
+
}
|
|
42
|
+
lines.push("## Usage");
|
|
43
|
+
lines.push("");
|
|
44
|
+
lines.push("- Use `afs_list` to browse directories and discover content");
|
|
45
|
+
lines.push("- Use `afs_read` to read file/node content");
|
|
46
|
+
lines.push("- Use `afs_stat` to get metadata without content");
|
|
47
|
+
lines.push("- Use `afs_explain` to get documentation for any path");
|
|
48
|
+
lines.push("- Use `afs_search` to find content by pattern");
|
|
49
|
+
lines.push("- Use `afs_write` to create or update content");
|
|
50
|
+
lines.push("- Use `afs_delete` to remove files or nodes");
|
|
51
|
+
lines.push("- Use `afs_exec` to execute actions (e.g., `/.actions/mount`)");
|
|
52
|
+
lines.push("");
|
|
53
|
+
lines.push("Start with `afs_list /` to see all mounted providers, or `afs_explain /` for a complete overview.");
|
|
54
|
+
return lines.join("\n");
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Create an MCP Server that exposes AFS operations as tools,
|
|
58
|
+
* resources, and prompts.
|
|
59
|
+
*
|
|
60
|
+
* If `options.server` is provided, registers on that server instead of creating a new one.
|
|
61
|
+
*/
|
|
62
|
+
function createAFSMcpServer(options) {
|
|
63
|
+
const { afs } = options;
|
|
64
|
+
const server = options.server ?? createMcpServerInstance();
|
|
65
|
+
server.server._instructions = buildInstructions(afs);
|
|
66
|
+
require_tools.registerTools(server, afs);
|
|
67
|
+
require_resources.registerResources(server, afs);
|
|
68
|
+
require_prompts.registerPrompts(server, afs);
|
|
69
|
+
return { server };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
exports.createAFSMcpServer = createAFSMcpServer;
|
|
74
|
+
exports.createMcpServerInstance = createMcpServerInstance;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { VERSION } from "../version.mjs";
|
|
2
|
+
import { registerPrompts } from "./prompts.mjs";
|
|
3
|
+
import { registerResources } from "./resources.mjs";
|
|
4
|
+
import { registerTools } from "./tools.mjs";
|
|
5
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
|
+
|
|
7
|
+
//#region src/mcp/server.ts
|
|
8
|
+
/**
|
|
9
|
+
* Create a new McpServer instance with AFS capabilities.
|
|
10
|
+
* Useful when you need the server before AFS is created (e.g. for MCP auth context).
|
|
11
|
+
*/
|
|
12
|
+
function createMcpServerInstance() {
|
|
13
|
+
return new McpServer({
|
|
14
|
+
name: "afs",
|
|
15
|
+
version: VERSION
|
|
16
|
+
}, { capabilities: {
|
|
17
|
+
tools: {},
|
|
18
|
+
resources: {},
|
|
19
|
+
prompts: {}
|
|
20
|
+
} });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Build MCP instructions string from AFS instance.
|
|
24
|
+
* Includes base AFS description + dynamically mounted provider details.
|
|
25
|
+
*/
|
|
26
|
+
function buildInstructions(afs) {
|
|
27
|
+
const lines = [];
|
|
28
|
+
lines.push("AFS (Agentic File System) is a virtual filesystem that unifies different data sources into a single namespace.");
|
|
29
|
+
lines.push("All data sources are accessed through a consistent path-based API with standard operations: read, list, stat, explain, search, write, delete, exec.");
|
|
30
|
+
lines.push("");
|
|
31
|
+
lines.push("## Mounted Providers");
|
|
32
|
+
lines.push("");
|
|
33
|
+
const mounts = afs.getMounts(null);
|
|
34
|
+
if (mounts.length === 0) lines.push("No providers currently mounted.");
|
|
35
|
+
else for (const m of mounts) {
|
|
36
|
+
const desc = m.module.description;
|
|
37
|
+
lines.push(`### ${m.module.name} (${m.path})`);
|
|
38
|
+
if (desc) for (const line of desc.split("\n")) lines.push(line);
|
|
39
|
+
lines.push("");
|
|
40
|
+
}
|
|
41
|
+
lines.push("## Usage");
|
|
42
|
+
lines.push("");
|
|
43
|
+
lines.push("- Use `afs_list` to browse directories and discover content");
|
|
44
|
+
lines.push("- Use `afs_read` to read file/node content");
|
|
45
|
+
lines.push("- Use `afs_stat` to get metadata without content");
|
|
46
|
+
lines.push("- Use `afs_explain` to get documentation for any path");
|
|
47
|
+
lines.push("- Use `afs_search` to find content by pattern");
|
|
48
|
+
lines.push("- Use `afs_write` to create or update content");
|
|
49
|
+
lines.push("- Use `afs_delete` to remove files or nodes");
|
|
50
|
+
lines.push("- Use `afs_exec` to execute actions (e.g., `/.actions/mount`)");
|
|
51
|
+
lines.push("");
|
|
52
|
+
lines.push("Start with `afs_list /` to see all mounted providers, or `afs_explain /` for a complete overview.");
|
|
53
|
+
return lines.join("\n");
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Create an MCP Server that exposes AFS operations as tools,
|
|
57
|
+
* resources, and prompts.
|
|
58
|
+
*
|
|
59
|
+
* If `options.server` is provided, registers on that server instead of creating a new one.
|
|
60
|
+
*/
|
|
61
|
+
function createAFSMcpServer(options) {
|
|
62
|
+
const { afs } = options;
|
|
63
|
+
const server = options.server ?? createMcpServerInstance();
|
|
64
|
+
server.server._instructions = buildInstructions(afs);
|
|
65
|
+
registerTools(server, afs);
|
|
66
|
+
registerResources(server, afs);
|
|
67
|
+
registerPrompts(server, afs);
|
|
68
|
+
return { server };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { createAFSMcpServer, createMcpServerInstance };
|
|
73
|
+
//# sourceMappingURL=server.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.mjs","names":[],"sources":["../../src/mcp/server.ts"],"sourcesContent":["/**\n * AFS MCP Server\n *\n * Creates an MCP Server that exposes AFS operations as MCP tools,\n * resources, and prompts.\n */\n\nimport type { AFS } from \"@aigne/afs\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { VERSION } from \"../version.js\";\nimport { registerPrompts } from \"./prompts.js\";\nimport { registerResources } from \"./resources.js\";\nimport { registerTools } from \"./tools.js\";\n\nexport interface CreateAFSMcpServerOptions {\n /** AFS instance to expose */\n afs: AFS;\n /** Pre-created McpServer instance. If not provided, a new one is created. */\n server?: McpServer;\n}\n\nexport interface AFSMcpServerResult {\n /** The MCP server instance */\n server: McpServer;\n}\n\n/**\n * Create a new McpServer instance with AFS capabilities.\n * Useful when you need the server before AFS is created (e.g. for MCP auth context).\n */\nexport function createMcpServerInstance(): McpServer {\n return new McpServer(\n { name: \"afs\", version: VERSION },\n {\n capabilities: {\n tools: {},\n resources: {},\n prompts: {},\n },\n },\n );\n}\n\n/**\n * Build MCP instructions string from AFS instance.\n * Includes base AFS description + dynamically mounted provider details.\n */\nfunction buildInstructions(afs: AFS): string {\n const lines: string[] = [];\n\n lines.push(\n \"AFS (Agentic File System) is a virtual filesystem that unifies different data sources into a single namespace.\",\n );\n lines.push(\n \"All data sources are accessed through a consistent path-based API with standard operations: read, list, stat, explain, search, write, delete, exec.\",\n );\n lines.push(\"\");\n lines.push(\"## Mounted Providers\");\n lines.push(\"\");\n\n const mounts = afs.getMounts(null);\n if (mounts.length === 0) {\n lines.push(\"No providers currently mounted.\");\n } else {\n for (const m of mounts) {\n const desc = m.module.description;\n lines.push(`### ${m.module.name} (${m.path})`);\n if (desc) {\n for (const line of desc.split(\"\\n\")) {\n lines.push(line);\n }\n }\n lines.push(\"\");\n }\n }\n\n lines.push(\"## Usage\");\n lines.push(\"\");\n lines.push(\"- Use `afs_list` to browse directories and discover content\");\n lines.push(\"- Use `afs_read` to read file/node content\");\n lines.push(\"- Use `afs_stat` to get metadata without content\");\n lines.push(\"- Use `afs_explain` to get documentation for any path\");\n lines.push(\"- Use `afs_search` to find content by pattern\");\n lines.push(\"- Use `afs_write` to create or update content\");\n lines.push(\"- Use `afs_delete` to remove files or nodes\");\n lines.push(\"- Use `afs_exec` to execute actions (e.g., `/.actions/mount`)\");\n lines.push(\"\");\n lines.push(\n \"Start with `afs_list /` to see all mounted providers, or `afs_explain /` for a complete overview.\",\n );\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Create an MCP Server that exposes AFS operations as tools,\n * resources, and prompts.\n *\n * If `options.server` is provided, registers on that server instead of creating a new one.\n */\nexport function createAFSMcpServer(options: CreateAFSMcpServerOptions): AFSMcpServerResult {\n const { afs } = options;\n const server = options.server ?? createMcpServerInstance();\n\n // Set instructions dynamically — includes mounted provider info\n // Access the underlying Server's private _instructions field\n (server.server as unknown as Record<string, unknown>)._instructions = buildInstructions(afs);\n\n registerTools(server, afs);\n registerResources(server, afs);\n registerPrompts(server, afs);\n\n return { server };\n}\n"],"mappings":";;;;;;;;;;;AA8BA,SAAgB,0BAAqC;AACnD,QAAO,IAAI,UACT;EAAE,MAAM;EAAO,SAAS;EAAS,EACjC,EACE,cAAc;EACZ,OAAO,EAAE;EACT,WAAW,EAAE;EACb,SAAS,EAAE;EACZ,EACF,CACF;;;;;;AAOH,SAAS,kBAAkB,KAAkB;CAC3C,MAAM,QAAkB,EAAE;AAE1B,OAAM,KACJ,iHACD;AACD,OAAM,KACJ,sJACD;AACD,OAAM,KAAK,GAAG;AACd,OAAM,KAAK,uBAAuB;AAClC,OAAM,KAAK,GAAG;CAEd,MAAM,SAAS,IAAI,UAAU,KAAK;AAClC,KAAI,OAAO,WAAW,EACpB,OAAM,KAAK,kCAAkC;KAE7C,MAAK,MAAM,KAAK,QAAQ;EACtB,MAAM,OAAO,EAAE,OAAO;AACtB,QAAM,KAAK,OAAO,EAAE,OAAO,KAAK,IAAI,EAAE,KAAK,GAAG;AAC9C,MAAI,KACF,MAAK,MAAM,QAAQ,KAAK,MAAM,KAAK,CACjC,OAAM,KAAK,KAAK;AAGpB,QAAM,KAAK,GAAG;;AAIlB,OAAM,KAAK,WAAW;AACtB,OAAM,KAAK,GAAG;AACd,OAAM,KAAK,8DAA8D;AACzE,OAAM,KAAK,6CAA6C;AACxD,OAAM,KAAK,mDAAmD;AAC9D,OAAM,KAAK,wDAAwD;AACnE,OAAM,KAAK,gDAAgD;AAC3D,OAAM,KAAK,gDAAgD;AAC3D,OAAM,KAAK,8CAA8C;AACzD,OAAM,KAAK,gEAAgE;AAC3E,OAAM,KAAK,GAAG;AACd,OAAM,KACJ,oGACD;AAED,QAAO,MAAM,KAAK,KAAK;;;;;;;;AASzB,SAAgB,mBAAmB,SAAwD;CACzF,MAAM,EAAE,QAAQ;CAChB,MAAM,SAAS,QAAQ,UAAU,yBAAyB;AAI1D,CAAC,OAAO,OAA8C,gBAAgB,kBAAkB,IAAI;AAE5F,eAAc,QAAQ,IAAI;AAC1B,mBAAkB,QAAQ,IAAI;AAC9B,iBAAgB,QAAQ,IAAI;AAE5B,QAAO,EAAE,QAAQ"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_delete = require('../core/formatters/delete.cjs');
|
|
3
|
+
const require_exec = require('../core/formatters/exec.cjs');
|
|
4
|
+
const require_ls = require('../core/formatters/ls.cjs');
|
|
5
|
+
const require_read = require('../core/formatters/read.cjs');
|
|
6
|
+
const require_stat = require('../core/formatters/stat.cjs');
|
|
7
|
+
const require_write = require('../core/formatters/write.cjs');
|
|
8
|
+
const require_path_utils = require('../path-utils.cjs');
|
|
9
|
+
let zod = require("zod");
|
|
10
|
+
|
|
11
|
+
//#region src/mcp/tools.ts
|
|
12
|
+
/**
|
|
13
|
+
* Create a safe error result for MCP tools.
|
|
14
|
+
* Strips stack traces and internal details from error messages.
|
|
15
|
+
*/
|
|
16
|
+
function errorResult(error) {
|
|
17
|
+
return {
|
|
18
|
+
isError: true,
|
|
19
|
+
content: [{
|
|
20
|
+
type: "text",
|
|
21
|
+
text: (error instanceof Error ? error.message : String(error)).split("\n")[0] || "Operation failed"
|
|
22
|
+
}]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create a text result for MCP tools.
|
|
27
|
+
*/
|
|
28
|
+
function textResult(text) {
|
|
29
|
+
return { content: [{
|
|
30
|
+
type: "text",
|
|
31
|
+
text
|
|
32
|
+
}] };
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Register all AFS tools on the MCP server.
|
|
36
|
+
*/
|
|
37
|
+
function registerTools(server, afs) {
|
|
38
|
+
server.tool("afs_read", "Read content at an AFS path", { path: zod.z.string().describe("AFS path to read, e.g. /modules/fs/README.md or $afs:ns/path") }, async ({ path }) => {
|
|
39
|
+
try {
|
|
40
|
+
const canonicalPath = require_path_utils.cliPathToCanonical(path);
|
|
41
|
+
const result = await afs.read(canonicalPath);
|
|
42
|
+
if (!result.data) return {
|
|
43
|
+
isError: true,
|
|
44
|
+
content: [{
|
|
45
|
+
type: "text",
|
|
46
|
+
text: result.message || "Not found"
|
|
47
|
+
}]
|
|
48
|
+
};
|
|
49
|
+
return textResult(require_read.formatReadOutput(result, "llm", { path }));
|
|
50
|
+
} catch (error) {
|
|
51
|
+
return errorResult(error);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
server.tool("afs_list", "List directory contents at an AFS path", {
|
|
55
|
+
path: zod.z.string().describe("AFS path to list"),
|
|
56
|
+
depth: zod.z.number().optional().describe("Recursion depth, default 1"),
|
|
57
|
+
pattern: zod.z.string().optional().describe("Filter pattern, e.g. *.md"),
|
|
58
|
+
limit: zod.z.number().optional().describe("Max entries to return")
|
|
59
|
+
}, async ({ path, depth, pattern, limit }) => {
|
|
60
|
+
try {
|
|
61
|
+
const canonicalPath = require_path_utils.cliPathToCanonical(path);
|
|
62
|
+
const result = await afs.list(canonicalPath, {
|
|
63
|
+
maxDepth: depth ?? 1,
|
|
64
|
+
pattern,
|
|
65
|
+
limit
|
|
66
|
+
});
|
|
67
|
+
if (result.data.length === 0 && result.message) return {
|
|
68
|
+
isError: true,
|
|
69
|
+
content: [{
|
|
70
|
+
type: "text",
|
|
71
|
+
text: result.message
|
|
72
|
+
}]
|
|
73
|
+
};
|
|
74
|
+
return textResult(require_ls.formatLsOutput(result, "llm", { path }));
|
|
75
|
+
} catch (error) {
|
|
76
|
+
return errorResult(error);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
server.tool("afs_write", "Write content to an AFS path", {
|
|
80
|
+
path: zod.z.string().describe("AFS path to write to"),
|
|
81
|
+
content: zod.z.union([zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown())]).describe("Content to write (string or JSON object)")
|
|
82
|
+
}, async ({ path, content }) => {
|
|
83
|
+
try {
|
|
84
|
+
const canonicalPath = require_path_utils.cliPathToCanonical(path);
|
|
85
|
+
return textResult(require_write.formatWriteOutput(await afs.write(canonicalPath, { content }), "llm"));
|
|
86
|
+
} catch (error) {
|
|
87
|
+
return errorResult(error);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
server.tool("afs_delete", "Delete a file or directory at an AFS path", {
|
|
91
|
+
path: zod.z.string().describe("AFS path to delete"),
|
|
92
|
+
recursive: zod.z.boolean().optional().describe("Delete recursively")
|
|
93
|
+
}, async ({ path, recursive }) => {
|
|
94
|
+
try {
|
|
95
|
+
const canonicalPath = require_path_utils.cliPathToCanonical(path);
|
|
96
|
+
return textResult(require_delete.formatDeleteOutput(await afs.delete(canonicalPath, { recursive }), "llm", { path }));
|
|
97
|
+
} catch (error) {
|
|
98
|
+
return errorResult(error);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
server.tool("afs_search", "Search for content within an AFS path", {
|
|
102
|
+
path: zod.z.string().describe("Base path to search from"),
|
|
103
|
+
query: zod.z.string().describe("Search query"),
|
|
104
|
+
pattern: zod.z.string().optional().describe("File pattern filter"),
|
|
105
|
+
limit: zod.z.number().optional().describe("Max results")
|
|
106
|
+
}, async ({ path, query, limit }) => {
|
|
107
|
+
try {
|
|
108
|
+
const canonicalPath = require_path_utils.cliPathToCanonical(path);
|
|
109
|
+
return textResult(require_ls.formatLsOutput(await afs.search(canonicalPath, query, { limit }), "llm", { path }));
|
|
110
|
+
} catch (error) {
|
|
111
|
+
return errorResult(error);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
server.tool("afs_exec", "Execute an action. Use afs_list on {path}/.actions to discover available actions and their inputSchema.", {
|
|
115
|
+
path: zod.z.string().describe("Action path, e.g. /modules/sqlite/users/.actions/insert"),
|
|
116
|
+
args: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe("Action arguments matching the action's inputSchema")
|
|
117
|
+
}, async ({ path, args }) => {
|
|
118
|
+
try {
|
|
119
|
+
const canonicalPath = require_path_utils.cliPathToCanonical(path);
|
|
120
|
+
return textResult(require_exec.formatExecOutput(await afs.exec(canonicalPath, args ?? {}), "llm", { path }));
|
|
121
|
+
} catch (error) {
|
|
122
|
+
return errorResult(error);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
server.tool("afs_stat", "Get metadata for an AFS path", { path: zod.z.string().describe("AFS path to stat") }, async ({ path }) => {
|
|
126
|
+
try {
|
|
127
|
+
const canonicalPath = require_path_utils.cliPathToCanonical(path);
|
|
128
|
+
const result = await afs.stat(canonicalPath);
|
|
129
|
+
if (!result.data) return {
|
|
130
|
+
isError: true,
|
|
131
|
+
content: [{
|
|
132
|
+
type: "text",
|
|
133
|
+
text: result.message || "Not found"
|
|
134
|
+
}]
|
|
135
|
+
};
|
|
136
|
+
return textResult(require_stat.formatStatOutput(result, "llm"));
|
|
137
|
+
} catch (error) {
|
|
138
|
+
return errorResult(error);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
server.tool("afs_explain", "Get a human-readable explanation for an AFS path or topic", { path: zod.z.string().describe("AFS path or topic to explain") }, async ({ path }) => {
|
|
142
|
+
try {
|
|
143
|
+
const canonicalPath = require_path_utils.cliPathToCanonical(path);
|
|
144
|
+
return textResult((await afs.explain(canonicalPath)).content);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
return errorResult(error);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
//#endregion
|
|
152
|
+
exports.registerTools = registerTools;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { formatDeleteOutput } from "../core/formatters/delete.mjs";
|
|
2
|
+
import { formatExecOutput } from "../core/formatters/exec.mjs";
|
|
3
|
+
import { formatLsOutput } from "../core/formatters/ls.mjs";
|
|
4
|
+
import { formatReadOutput } from "../core/formatters/read.mjs";
|
|
5
|
+
import { formatStatOutput } from "../core/formatters/stat.mjs";
|
|
6
|
+
import { formatWriteOutput } from "../core/formatters/write.mjs";
|
|
7
|
+
import { cliPathToCanonical } from "../path-utils.mjs";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
|
|
10
|
+
//#region src/mcp/tools.ts
|
|
11
|
+
/**
|
|
12
|
+
* Create a safe error result for MCP tools.
|
|
13
|
+
* Strips stack traces and internal details from error messages.
|
|
14
|
+
*/
|
|
15
|
+
function errorResult(error) {
|
|
16
|
+
return {
|
|
17
|
+
isError: true,
|
|
18
|
+
content: [{
|
|
19
|
+
type: "text",
|
|
20
|
+
text: (error instanceof Error ? error.message : String(error)).split("\n")[0] || "Operation failed"
|
|
21
|
+
}]
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a text result for MCP tools.
|
|
26
|
+
*/
|
|
27
|
+
function textResult(text) {
|
|
28
|
+
return { content: [{
|
|
29
|
+
type: "text",
|
|
30
|
+
text
|
|
31
|
+
}] };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Register all AFS tools on the MCP server.
|
|
35
|
+
*/
|
|
36
|
+
function registerTools(server, afs) {
|
|
37
|
+
server.tool("afs_read", "Read content at an AFS path", { path: z.string().describe("AFS path to read, e.g. /modules/fs/README.md or $afs:ns/path") }, async ({ path }) => {
|
|
38
|
+
try {
|
|
39
|
+
const canonicalPath = cliPathToCanonical(path);
|
|
40
|
+
const result = await afs.read(canonicalPath);
|
|
41
|
+
if (!result.data) return {
|
|
42
|
+
isError: true,
|
|
43
|
+
content: [{
|
|
44
|
+
type: "text",
|
|
45
|
+
text: result.message || "Not found"
|
|
46
|
+
}]
|
|
47
|
+
};
|
|
48
|
+
return textResult(formatReadOutput(result, "llm", { path }));
|
|
49
|
+
} catch (error) {
|
|
50
|
+
return errorResult(error);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
server.tool("afs_list", "List directory contents at an AFS path", {
|
|
54
|
+
path: z.string().describe("AFS path to list"),
|
|
55
|
+
depth: z.number().optional().describe("Recursion depth, default 1"),
|
|
56
|
+
pattern: z.string().optional().describe("Filter pattern, e.g. *.md"),
|
|
57
|
+
limit: z.number().optional().describe("Max entries to return")
|
|
58
|
+
}, async ({ path, depth, pattern, limit }) => {
|
|
59
|
+
try {
|
|
60
|
+
const canonicalPath = cliPathToCanonical(path);
|
|
61
|
+
const result = await afs.list(canonicalPath, {
|
|
62
|
+
maxDepth: depth ?? 1,
|
|
63
|
+
pattern,
|
|
64
|
+
limit
|
|
65
|
+
});
|
|
66
|
+
if (result.data.length === 0 && result.message) return {
|
|
67
|
+
isError: true,
|
|
68
|
+
content: [{
|
|
69
|
+
type: "text",
|
|
70
|
+
text: result.message
|
|
71
|
+
}]
|
|
72
|
+
};
|
|
73
|
+
return textResult(formatLsOutput(result, "llm", { path }));
|
|
74
|
+
} catch (error) {
|
|
75
|
+
return errorResult(error);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
server.tool("afs_write", "Write content to an AFS path", {
|
|
79
|
+
path: z.string().describe("AFS path to write to"),
|
|
80
|
+
content: z.union([z.string(), z.record(z.string(), z.unknown())]).describe("Content to write (string or JSON object)")
|
|
81
|
+
}, async ({ path, content }) => {
|
|
82
|
+
try {
|
|
83
|
+
const canonicalPath = cliPathToCanonical(path);
|
|
84
|
+
return textResult(formatWriteOutput(await afs.write(canonicalPath, { content }), "llm"));
|
|
85
|
+
} catch (error) {
|
|
86
|
+
return errorResult(error);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
server.tool("afs_delete", "Delete a file or directory at an AFS path", {
|
|
90
|
+
path: z.string().describe("AFS path to delete"),
|
|
91
|
+
recursive: z.boolean().optional().describe("Delete recursively")
|
|
92
|
+
}, async ({ path, recursive }) => {
|
|
93
|
+
try {
|
|
94
|
+
const canonicalPath = cliPathToCanonical(path);
|
|
95
|
+
return textResult(formatDeleteOutput(await afs.delete(canonicalPath, { recursive }), "llm", { path }));
|
|
96
|
+
} catch (error) {
|
|
97
|
+
return errorResult(error);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
server.tool("afs_search", "Search for content within an AFS path", {
|
|
101
|
+
path: z.string().describe("Base path to search from"),
|
|
102
|
+
query: z.string().describe("Search query"),
|
|
103
|
+
pattern: z.string().optional().describe("File pattern filter"),
|
|
104
|
+
limit: z.number().optional().describe("Max results")
|
|
105
|
+
}, async ({ path, query, limit }) => {
|
|
106
|
+
try {
|
|
107
|
+
const canonicalPath = cliPathToCanonical(path);
|
|
108
|
+
return textResult(formatLsOutput(await afs.search(canonicalPath, query, { limit }), "llm", { path }));
|
|
109
|
+
} catch (error) {
|
|
110
|
+
return errorResult(error);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
server.tool("afs_exec", "Execute an action. Use afs_list on {path}/.actions to discover available actions and their inputSchema.", {
|
|
114
|
+
path: z.string().describe("Action path, e.g. /modules/sqlite/users/.actions/insert"),
|
|
115
|
+
args: z.record(z.string(), z.unknown()).optional().describe("Action arguments matching the action's inputSchema")
|
|
116
|
+
}, async ({ path, args }) => {
|
|
117
|
+
try {
|
|
118
|
+
const canonicalPath = cliPathToCanonical(path);
|
|
119
|
+
return textResult(formatExecOutput(await afs.exec(canonicalPath, args ?? {}), "llm", { path }));
|
|
120
|
+
} catch (error) {
|
|
121
|
+
return errorResult(error);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
server.tool("afs_stat", "Get metadata for an AFS path", { path: z.string().describe("AFS path to stat") }, async ({ path }) => {
|
|
125
|
+
try {
|
|
126
|
+
const canonicalPath = cliPathToCanonical(path);
|
|
127
|
+
const result = await afs.stat(canonicalPath);
|
|
128
|
+
if (!result.data) return {
|
|
129
|
+
isError: true,
|
|
130
|
+
content: [{
|
|
131
|
+
type: "text",
|
|
132
|
+
text: result.message || "Not found"
|
|
133
|
+
}]
|
|
134
|
+
};
|
|
135
|
+
return textResult(formatStatOutput(result, "llm"));
|
|
136
|
+
} catch (error) {
|
|
137
|
+
return errorResult(error);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
server.tool("afs_explain", "Get a human-readable explanation for an AFS path or topic", { path: z.string().describe("AFS path or topic to explain") }, async ({ path }) => {
|
|
141
|
+
try {
|
|
142
|
+
const canonicalPath = cliPathToCanonical(path);
|
|
143
|
+
return textResult((await afs.explain(canonicalPath)).content);
|
|
144
|
+
} catch (error) {
|
|
145
|
+
return errorResult(error);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
//#endregion
|
|
151
|
+
export { registerTools };
|
|
152
|
+
//# sourceMappingURL=tools.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.mjs","names":[],"sources":["../../src/mcp/tools.ts"],"sourcesContent":["/**\n * AFS MCP Tools Registration\n *\n * Registers all 10 AFS operations as MCP tools.\n */\n\nimport type { AFS } from \"@aigne/afs\";\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport { formatDeleteOutput } from \"../core/formatters/delete.js\";\nimport { formatExecOutput } from \"../core/formatters/exec.js\";\nimport { formatLsOutput } from \"../core/formatters/ls.js\";\nimport { formatReadOutput } from \"../core/formatters/read.js\";\nimport { formatStatOutput } from \"../core/formatters/stat.js\";\nimport { formatWriteOutput } from \"../core/formatters/write.js\";\nimport { cliPathToCanonical } from \"../path-utils.js\";\n\n/**\n * Create a safe error result for MCP tools.\n * Strips stack traces and internal details from error messages.\n */\nfunction errorResult(error: unknown) {\n const message = error instanceof Error ? error.message : String(error);\n const safeMessage = message.split(\"\\n\")[0] || \"Operation failed\";\n return {\n isError: true as const,\n content: [{ type: \"text\" as const, text: safeMessage }],\n };\n}\n\n/**\n * Create a text result for MCP tools.\n */\nfunction textResult(text: string) {\n return {\n content: [{ type: \"text\" as const, text }],\n };\n}\n\n/**\n * Register all AFS tools on the MCP server.\n */\nexport function registerTools(server: McpServer, afs: AFS): void {\n // afs_read - Read content at a path\n server.tool(\n \"afs_read\",\n \"Read content at an AFS path\",\n { path: z.string().describe(\"AFS path to read, e.g. /modules/fs/README.md or $afs:ns/path\") },\n async ({ path }) => {\n try {\n const canonicalPath = cliPathToCanonical(path);\n const result = await afs.read(canonicalPath);\n if (!result.data) {\n return {\n isError: true as const,\n content: [{ type: \"text\" as const, text: result.message || \"Not found\" }],\n };\n }\n const formatted = formatReadOutput(result, \"llm\", { path });\n return textResult(formatted);\n } catch (error) {\n return errorResult(error);\n }\n },\n );\n\n // afs_list - List directory contents\n server.tool(\n \"afs_list\",\n \"List directory contents at an AFS path\",\n {\n path: z.string().describe(\"AFS path to list\"),\n depth: z.number().optional().describe(\"Recursion depth, default 1\"),\n pattern: z.string().optional().describe(\"Filter pattern, e.g. *.md\"),\n limit: z.number().optional().describe(\"Max entries to return\"),\n },\n async ({ path, depth, pattern, limit }) => {\n try {\n const canonicalPath = cliPathToCanonical(path);\n const result = await afs.list(canonicalPath, {\n maxDepth: depth ?? 1,\n pattern,\n limit,\n });\n if (result.data.length === 0 && result.message) {\n return {\n isError: true as const,\n content: [{ type: \"text\" as const, text: result.message }],\n };\n }\n const formatted = formatLsOutput(result, \"llm\", { path });\n return textResult(formatted);\n } catch (error) {\n return errorResult(error);\n }\n },\n );\n\n // afs_write - Write content to a path\n server.tool(\n \"afs_write\",\n \"Write content to an AFS path\",\n {\n path: z.string().describe(\"AFS path to write to\"),\n content: z\n .union([z.string(), z.record(z.string(), z.unknown())])\n .describe(\"Content to write (string or JSON object)\"),\n },\n async ({ path, content }) => {\n try {\n const canonicalPath = cliPathToCanonical(path);\n const result = await afs.write(canonicalPath, { content });\n const formatted = formatWriteOutput(result, \"llm\");\n return textResult(formatted);\n } catch (error) {\n return errorResult(error);\n }\n },\n );\n\n // afs_delete - Delete a path\n server.tool(\n \"afs_delete\",\n \"Delete a file or directory at an AFS path\",\n {\n path: z.string().describe(\"AFS path to delete\"),\n recursive: z.boolean().optional().describe(\"Delete recursively\"),\n },\n async ({ path, recursive }) => {\n try {\n const canonicalPath = cliPathToCanonical(path);\n const result = await afs.delete(canonicalPath, { recursive });\n const formatted = formatDeleteOutput(result, \"llm\", { path });\n return textResult(formatted);\n } catch (error) {\n return errorResult(error);\n }\n },\n );\n\n // afs_search - Search for content\n server.tool(\n \"afs_search\",\n \"Search for content within an AFS path\",\n {\n path: z.string().describe(\"Base path to search from\"),\n query: z.string().describe(\"Search query\"),\n pattern: z.string().optional().describe(\"File pattern filter\"),\n limit: z.number().optional().describe(\"Max results\"),\n },\n async ({ path, query, limit }) => {\n try {\n const canonicalPath = cliPathToCanonical(path);\n const result = await afs.search(canonicalPath, query, { limit });\n // Search results use list formatter\n const formatted = formatLsOutput(result as any, \"llm\", { path });\n return textResult(formatted);\n } catch (error) {\n return errorResult(error);\n }\n },\n );\n\n // afs_exec - Execute an action\n server.tool(\n \"afs_exec\",\n \"Execute an action. Use afs_list on {path}/.actions to discover available actions and their inputSchema.\",\n {\n path: z.string().describe(\"Action path, e.g. /modules/sqlite/users/.actions/insert\"),\n args: z\n .record(z.string(), z.unknown())\n .optional()\n .describe(\"Action arguments matching the action's inputSchema\"),\n },\n async ({ path, args }) => {\n try {\n const canonicalPath = cliPathToCanonical(path);\n const result = await afs.exec(canonicalPath, args ?? {});\n const formatted = formatExecOutput(result, \"llm\", { path });\n return textResult(formatted);\n } catch (error) {\n return errorResult(error);\n }\n },\n );\n\n // afs_stat - Get path metadata\n server.tool(\n \"afs_stat\",\n \"Get metadata for an AFS path\",\n { path: z.string().describe(\"AFS path to stat\") },\n async ({ path }) => {\n try {\n const canonicalPath = cliPathToCanonical(path);\n const result = await afs.stat(canonicalPath);\n if (!result.data) {\n return {\n isError: true as const,\n content: [{ type: \"text\" as const, text: result.message || \"Not found\" }],\n };\n }\n const formatted = formatStatOutput(result, \"llm\");\n return textResult(formatted);\n } catch (error) {\n return errorResult(error);\n }\n },\n );\n\n // afs_explain - Get human-readable explanation\n server.tool(\n \"afs_explain\",\n \"Get a human-readable explanation for an AFS path or topic\",\n { path: z.string().describe(\"AFS path or topic to explain\") },\n async ({ path }) => {\n try {\n const canonicalPath = cliPathToCanonical(path);\n const result = await afs.explain(canonicalPath);\n // explain returns { format, content } directly\n return textResult(result.content);\n } catch (error) {\n return errorResult(error);\n }\n },\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAqBA,SAAS,YAAY,OAAgB;AAGnC,QAAO;EACL,SAAS;EACT,SAAS,CAAC;GAAE,MAAM;GAAiB,OAJrB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,EAC1C,MAAM,KAAK,CAAC,MAAM;GAGU,CAAC;EACxD;;;;;AAMH,SAAS,WAAW,MAAc;AAChC,QAAO,EACL,SAAS,CAAC;EAAE,MAAM;EAAiB;EAAM,CAAC,EAC3C;;;;;AAMH,SAAgB,cAAc,QAAmB,KAAgB;AAE/D,QAAO,KACL,YACA,+BACA,EAAE,MAAM,EAAE,QAAQ,CAAC,SAAS,+DAA+D,EAAE,EAC7F,OAAO,EAAE,WAAW;AAClB,MAAI;GACF,MAAM,gBAAgB,mBAAmB,KAAK;GAC9C,MAAM,SAAS,MAAM,IAAI,KAAK,cAAc;AAC5C,OAAI,CAAC,OAAO,KACV,QAAO;IACL,SAAS;IACT,SAAS,CAAC;KAAE,MAAM;KAAiB,MAAM,OAAO,WAAW;KAAa,CAAC;IAC1E;AAGH,UAAO,WADW,iBAAiB,QAAQ,OAAO,EAAE,MAAM,CAAC,CAC/B;WACrB,OAAO;AACd,UAAO,YAAY,MAAM;;GAG9B;AAGD,QAAO,KACL,YACA,0CACA;EACE,MAAM,EAAE,QAAQ,CAAC,SAAS,mBAAmB;EAC7C,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,6BAA6B;EACnE,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,4BAA4B;EACpE,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,wBAAwB;EAC/D,EACD,OAAO,EAAE,MAAM,OAAO,SAAS,YAAY;AACzC,MAAI;GACF,MAAM,gBAAgB,mBAAmB,KAAK;GAC9C,MAAM,SAAS,MAAM,IAAI,KAAK,eAAe;IAC3C,UAAU,SAAS;IACnB;IACA;IACD,CAAC;AACF,OAAI,OAAO,KAAK,WAAW,KAAK,OAAO,QACrC,QAAO;IACL,SAAS;IACT,SAAS,CAAC;KAAE,MAAM;KAAiB,MAAM,OAAO;KAAS,CAAC;IAC3D;AAGH,UAAO,WADW,eAAe,QAAQ,OAAO,EAAE,MAAM,CAAC,CAC7B;WACrB,OAAO;AACd,UAAO,YAAY,MAAM;;GAG9B;AAGD,QAAO,KACL,aACA,gCACA;EACE,MAAM,EAAE,QAAQ,CAAC,SAAS,uBAAuB;EACjD,SAAS,EACN,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CACtD,SAAS,2CAA2C;EACxD,EACD,OAAO,EAAE,MAAM,cAAc;AAC3B,MAAI;GACF,MAAM,gBAAgB,mBAAmB,KAAK;AAG9C,UAAO,WADW,kBADH,MAAM,IAAI,MAAM,eAAe,EAAE,SAAS,CAAC,EACd,MAAM,CACtB;WACrB,OAAO;AACd,UAAO,YAAY,MAAM;;GAG9B;AAGD,QAAO,KACL,cACA,6CACA;EACE,MAAM,EAAE,QAAQ,CAAC,SAAS,qBAAqB;EAC/C,WAAW,EAAE,SAAS,CAAC,UAAU,CAAC,SAAS,qBAAqB;EACjE,EACD,OAAO,EAAE,MAAM,gBAAgB;AAC7B,MAAI;GACF,MAAM,gBAAgB,mBAAmB,KAAK;AAG9C,UAAO,WADW,mBADH,MAAM,IAAI,OAAO,eAAe,EAAE,WAAW,CAAC,EAChB,OAAO,EAAE,MAAM,CAAC,CACjC;WACrB,OAAO;AACd,UAAO,YAAY,MAAM;;GAG9B;AAGD,QAAO,KACL,cACA,yCACA;EACE,MAAM,EAAE,QAAQ,CAAC,SAAS,2BAA2B;EACrD,OAAO,EAAE,QAAQ,CAAC,SAAS,eAAe;EAC1C,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,sBAAsB;EAC9D,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,cAAc;EACrD,EACD,OAAO,EAAE,MAAM,OAAO,YAAY;AAChC,MAAI;GACF,MAAM,gBAAgB,mBAAmB,KAAK;AAI9C,UAAO,WADW,eAFH,MAAM,IAAI,OAAO,eAAe,OAAO,EAAE,OAAO,CAAC,EAEhB,OAAO,EAAE,MAAM,CAAC,CACpC;WACrB,OAAO;AACd,UAAO,YAAY,MAAM;;GAG9B;AAGD,QAAO,KACL,YACA,2GACA;EACE,MAAM,EAAE,QAAQ,CAAC,SAAS,0DAA0D;EACpF,MAAM,EACH,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAC/B,UAAU,CACV,SAAS,qDAAqD;EAClE,EACD,OAAO,EAAE,MAAM,WAAW;AACxB,MAAI;GACF,MAAM,gBAAgB,mBAAmB,KAAK;AAG9C,UAAO,WADW,iBADH,MAAM,IAAI,KAAK,eAAe,QAAQ,EAAE,CAAC,EACb,OAAO,EAAE,MAAM,CAAC,CAC/B;WACrB,OAAO;AACd,UAAO,YAAY,MAAM;;GAG9B;AAGD,QAAO,KACL,YACA,gCACA,EAAE,MAAM,EAAE,QAAQ,CAAC,SAAS,mBAAmB,EAAE,EACjD,OAAO,EAAE,WAAW;AAClB,MAAI;GACF,MAAM,gBAAgB,mBAAmB,KAAK;GAC9C,MAAM,SAAS,MAAM,IAAI,KAAK,cAAc;AAC5C,OAAI,CAAC,OAAO,KACV,QAAO;IACL,SAAS;IACT,SAAS,CAAC;KAAE,MAAM;KAAiB,MAAM,OAAO,WAAW;KAAa,CAAC;IAC1E;AAGH,UAAO,WADW,iBAAiB,QAAQ,MAAM,CACrB;WACrB,OAAO;AACd,UAAO,YAAY,MAAM;;GAG9B;AAGD,QAAO,KACL,eACA,6DACA,EAAE,MAAM,EAAE,QAAQ,CAAC,SAAS,+BAA+B,EAAE,EAC7D,OAAO,EAAE,WAAW;AAClB,MAAI;GACF,MAAM,gBAAgB,mBAAmB,KAAK;AAG9C,UAAO,YAFQ,MAAM,IAAI,QAAQ,cAAc,EAEtB,QAAQ;WAC1B,OAAO;AACd,UAAO,YAAY,MAAM;;GAG9B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { URLPattern, URLPatternComponentResult, URLPatternResult } from "./types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.ts
|
|
4
|
+
declare global {
|
|
5
|
+
class URLPattern extends URLPattern {}
|
|
6
|
+
type URLPatternInit = undefined;
|
|
7
|
+
type URLPatternResult = URLPatternResult;
|
|
8
|
+
type URLPatternComponentResult = URLPatternComponentResult;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["Types","URLPattern","_0","URLPatternInit","URLPatternResult","URLPatternComponentResult","global","sideEffect"],"sources":["../../../../../../../../../node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.ts"],"x_google_ignoreList":[0],"mappings":";;;QAGQM,MAAAA;EAAAA,MACAL,UAAAA,SAAmBD,UAAAA;EAAAA,KACpBG,cAAAA,GAAiBH,SAAAA;EAAAA,KACjBI,gBAAAA,GAAmBJ,gBAAAA;EAAAA,KACnBK,yBAAAA,GAA4BL,yBAAAA;AAAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { URLPattern, URLPatternComponentResult, URLPatternResult } from "./types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.ts
|
|
4
|
+
declare global {
|
|
5
|
+
class URLPattern extends URLPattern {}
|
|
6
|
+
type URLPatternInit = undefined;
|
|
7
|
+
type URLPatternResult = URLPatternResult;
|
|
8
|
+
type URLPatternComponentResult = URLPatternComponentResult;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["Types","URLPattern","_0","URLPatternInit","URLPatternResult","URLPatternComponentResult","global","sideEffect"],"sources":["../../../../../../../../../node_modules/.pnpm/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/index.d.ts"],"x_google_ignoreList":[0],"mappings":";;;QAGQM,MAAAA;EAAAA,MACAL,UAAAA,SAAmBD,UAAAA;EAAAA,KACpBG,cAAAA,GAAiBH,SAAAA;EAAAA,KACjBI,gBAAAA,GAAmBJ,gBAAAA;EAAAA,KACnBK,yBAAAA,GAA4BL,yBAAAA;AAAAA"}
|