mongo.do 0.1.0 → 0.1.1
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/dist/cli/index.d.ts +1 -15
- package/dist/cli/index.js +4083 -196
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +2740 -20
- package/dist/index.js +9375 -27
- package/dist/index.js.map +1 -1
- package/dist/worker-entrypoint-BEW23Gmp.d.ts +1331 -0
- package/dist/worker.d.ts +6 -5
- package/dist/worker.js +5477 -18
- package/dist/worker.js.map +1 -1
- package/package.json +3 -2
- package/dist/agentfs/adapters/anthropic.d.ts +0 -176
- package/dist/agentfs/adapters/anthropic.d.ts.map +0 -1
- package/dist/agentfs/adapters/anthropic.js +0 -629
- package/dist/agentfs/adapters/anthropic.js.map +0 -1
- package/dist/agentfs/adapters/index.d.ts +0 -21
- package/dist/agentfs/adapters/index.d.ts.map +0 -1
- package/dist/agentfs/adapters/index.js +0 -23
- package/dist/agentfs/adapters/index.js.map +0 -1
- package/dist/agentfs/adapters/vercel.d.ts +0 -260
- package/dist/agentfs/adapters/vercel.d.ts.map +0 -1
- package/dist/agentfs/adapters/vercel.js +0 -288
- package/dist/agentfs/adapters/vercel.js.map +0 -1
- package/dist/agentfs/glob.d.ts +0 -116
- package/dist/agentfs/glob.d.ts.map +0 -1
- package/dist/agentfs/glob.js +0 -270
- package/dist/agentfs/glob.js.map +0 -1
- package/dist/agentfs/grep.d.ts +0 -83
- package/dist/agentfs/grep.d.ts.map +0 -1
- package/dist/agentfs/grep.js +0 -193
- package/dist/agentfs/grep.js.map +0 -1
- package/dist/agentfs/index.d.ts +0 -22
- package/dist/agentfs/index.d.ts.map +0 -1
- package/dist/agentfs/index.js +0 -18
- package/dist/agentfs/index.js.map +0 -1
- package/dist/agentfs/kv-store.d.ts +0 -128
- package/dist/agentfs/kv-store.d.ts.map +0 -1
- package/dist/agentfs/kv-store.js +0 -227
- package/dist/agentfs/kv-store.js.map +0 -1
- package/dist/agentfs/mondo-agent.d.ts +0 -255
- package/dist/agentfs/mondo-agent.d.ts.map +0 -1
- package/dist/agentfs/mondo-agent.js +0 -879
- package/dist/agentfs/mondo-agent.js.map +0 -1
- package/dist/agentfs/toolcalls.d.ts +0 -130
- package/dist/agentfs/toolcalls.d.ts.map +0 -1
- package/dist/agentfs/toolcalls.js +0 -178
- package/dist/agentfs/toolcalls.js.map +0 -1
- package/dist/agentfs/types.d.ts +0 -171
- package/dist/agentfs/types.d.ts.map +0 -1
- package/dist/agentfs/types.js +0 -7
- package/dist/agentfs/types.js.map +0 -1
- package/dist/agentfs/vfs.d.ts +0 -249
- package/dist/agentfs/vfs.d.ts.map +0 -1
- package/dist/agentfs/vfs.js +0 -469
- package/dist/agentfs/vfs.js.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/mcp.d.ts +0 -119
- package/dist/cli/mcp.d.ts.map +0 -1
- package/dist/cli/mcp.js +0 -418
- package/dist/cli/mcp.js.map +0 -1
- package/dist/cli/server.d.ts +0 -179
- package/dist/cli/server.d.ts.map +0 -1
- package/dist/cli/server.js +0 -441
- package/dist/cli/server.js.map +0 -1
- package/dist/client/Collection.d.ts +0 -199
- package/dist/client/Collection.d.ts.map +0 -1
- package/dist/client/Collection.js +0 -256
- package/dist/client/Collection.js.map +0 -1
- package/dist/client/Database.d.ts +0 -68
- package/dist/client/Database.d.ts.map +0 -1
- package/dist/client/Database.js +0 -105
- package/dist/client/Database.js.map +0 -1
- package/dist/client/MongoClient.d.ts +0 -165
- package/dist/client/MongoClient.d.ts.map +0 -1
- package/dist/client/MongoClient.js +0 -307
- package/dist/client/MongoClient.js.map +0 -1
- package/dist/client/aggregation-cursor.d.ts +0 -210
- package/dist/client/aggregation-cursor.d.ts.map +0 -1
- package/dist/client/aggregation-cursor.js +0 -509
- package/dist/client/aggregation-cursor.js.map +0 -1
- package/dist/client/bulk-write.d.ts +0 -216
- package/dist/client/bulk-write.d.ts.map +0 -1
- package/dist/client/bulk-write.js +0 -63
- package/dist/client/bulk-write.js.map +0 -1
- package/dist/client/change-stream.d.ts +0 -245
- package/dist/client/change-stream.d.ts.map +0 -1
- package/dist/client/change-stream.js +0 -429
- package/dist/client/change-stream.js.map +0 -1
- package/dist/client/cursor.d.ts +0 -85
- package/dist/client/cursor.d.ts.map +0 -1
- package/dist/client/cursor.js +0 -156
- package/dist/client/cursor.js.map +0 -1
- package/dist/client/http-cursor.d.ts +0 -233
- package/dist/client/http-cursor.d.ts.map +0 -1
- package/dist/client/http-cursor.js +0 -496
- package/dist/client/http-cursor.js.map +0 -1
- package/dist/client/index.d.ts +0 -18
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -24
- package/dist/client/index.js.map +0 -1
- package/dist/client/mongo-client.d.ts +0 -60
- package/dist/client/mongo-client.d.ts.map +0 -1
- package/dist/client/mongo-client.js +0 -190
- package/dist/client/mongo-client.js.map +0 -1
- package/dist/client/mongo-collection.d.ts +0 -359
- package/dist/client/mongo-collection.d.ts.map +0 -1
- package/dist/client/mongo-collection.js +0 -1641
- package/dist/client/mongo-collection.js.map +0 -1
- package/dist/client/mongo-cursor.d.ts +0 -257
- package/dist/client/mongo-cursor.d.ts.map +0 -1
- package/dist/client/mongo-cursor.js +0 -621
- package/dist/client/mongo-cursor.js.map +0 -1
- package/dist/client/mongo-database.d.ts +0 -88
- package/dist/client/mongo-database.d.ts.map +0 -1
- package/dist/client/mongo-database.js +0 -139
- package/dist/client/mongo-database.js.map +0 -1
- package/dist/client/session.d.ts +0 -210
- package/dist/client/session.d.ts.map +0 -1
- package/dist/client/session.js +0 -326
- package/dist/client/session.js.map +0 -1
- package/dist/durable-object/index-manager.d.ts +0 -173
- package/dist/durable-object/index-manager.d.ts.map +0 -1
- package/dist/durable-object/index-manager.js +0 -764
- package/dist/durable-object/index-manager.js.map +0 -1
- package/dist/durable-object/index.d.ts +0 -12
- package/dist/durable-object/index.d.ts.map +0 -1
- package/dist/durable-object/index.js +0 -8
- package/dist/durable-object/index.js.map +0 -1
- package/dist/durable-object/mcp-handler.d.ts +0 -52
- package/dist/durable-object/mcp-handler.d.ts.map +0 -1
- package/dist/durable-object/mcp-handler.js +0 -186
- package/dist/durable-object/mcp-handler.js.map +0 -1
- package/dist/durable-object/migrations.d.ts +0 -40
- package/dist/durable-object/migrations.d.ts.map +0 -1
- package/dist/durable-object/migrations.js +0 -121
- package/dist/durable-object/migrations.js.map +0 -1
- package/dist/durable-object/mondo-database.d.ts +0 -148
- package/dist/durable-object/mondo-database.d.ts.map +0 -1
- package/dist/durable-object/mondo-database.js +0 -621
- package/dist/durable-object/mondo-database.js.map +0 -1
- package/dist/durable-object/schema.d.ts +0 -192
- package/dist/durable-object/schema.d.ts.map +0 -1
- package/dist/durable-object/schema.js +0 -186
- package/dist/durable-object/schema.js.map +0 -1
- package/dist/embedding/document-serializer.d.ts +0 -118
- package/dist/embedding/document-serializer.d.ts.map +0 -1
- package/dist/embedding/document-serializer.js +0 -339
- package/dist/embedding/document-serializer.js.map +0 -1
- package/dist/embedding/embedding-manager.d.ts +0 -136
- package/dist/embedding/embedding-manager.d.ts.map +0 -1
- package/dist/embedding/embedding-manager.js +0 -176
- package/dist/embedding/embedding-manager.js.map +0 -1
- package/dist/embedding/index.d.ts +0 -9
- package/dist/embedding/index.d.ts.map +0 -1
- package/dist/embedding/index.js +0 -9
- package/dist/embedding/index.js.map +0 -1
- package/dist/executor/aggregation-executor.d.ts +0 -93
- package/dist/executor/aggregation-executor.d.ts.map +0 -1
- package/dist/executor/aggregation-executor.js +0 -275
- package/dist/executor/aggregation-executor.js.map +0 -1
- package/dist/executor/function-executor.d.ts +0 -39
- package/dist/executor/function-executor.d.ts.map +0 -1
- package/dist/executor/function-executor.js +0 -168
- package/dist/executor/function-executor.js.map +0 -1
- package/dist/executor/index.d.ts +0 -4
- package/dist/executor/index.d.ts.map +0 -1
- package/dist/executor/index.js +0 -4
- package/dist/executor/index.js.map +0 -1
- package/dist/executor/vector-search-executor.d.ts +0 -71
- package/dist/executor/vector-search-executor.d.ts.map +0 -1
- package/dist/executor/vector-search-executor.js +0 -113
- package/dist/executor/vector-search-executor.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/mcp/adapters/anthropic-adapter.d.ts +0 -256
- package/dist/mcp/adapters/anthropic-adapter.d.ts.map +0 -1
- package/dist/mcp/adapters/anthropic-adapter.js +0 -409
- package/dist/mcp/adapters/anthropic-adapter.js.map +0 -1
- package/dist/mcp/adapters/base-adapter.d.ts +0 -164
- package/dist/mcp/adapters/base-adapter.d.ts.map +0 -1
- package/dist/mcp/adapters/base-adapter.js +0 -277
- package/dist/mcp/adapters/base-adapter.js.map +0 -1
- package/dist/mcp/adapters/errors.d.ts +0 -173
- package/dist/mcp/adapters/errors.d.ts.map +0 -1
- package/dist/mcp/adapters/errors.js +0 -305
- package/dist/mcp/adapters/errors.js.map +0 -1
- package/dist/mcp/adapters/index.d.ts +0 -65
- package/dist/mcp/adapters/index.d.ts.map +0 -1
- package/dist/mcp/adapters/index.js +0 -92
- package/dist/mcp/adapters/index.js.map +0 -1
- package/dist/mcp/adapters/streaming.d.ts +0 -200
- package/dist/mcp/adapters/streaming.d.ts.map +0 -1
- package/dist/mcp/adapters/streaming.js +0 -381
- package/dist/mcp/adapters/streaming.js.map +0 -1
- package/dist/mcp/adapters/vercel-adapter.d.ts +0 -321
- package/dist/mcp/adapters/vercel-adapter.d.ts.map +0 -1
- package/dist/mcp/adapters/vercel-adapter.js +0 -487
- package/dist/mcp/adapters/vercel-adapter.js.map +0 -1
- package/dist/mcp/agent.d.ts +0 -192
- package/dist/mcp/agent.d.ts.map +0 -1
- package/dist/mcp/agent.js +0 -338
- package/dist/mcp/agent.js.map +0 -1
- package/dist/mcp/cli.d.ts +0 -71
- package/dist/mcp/cli.d.ts.map +0 -1
- package/dist/mcp/cli.js +0 -218
- package/dist/mcp/cli.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -15
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js +0 -20
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/sandbox/database-proxy.d.ts +0 -118
- package/dist/mcp/sandbox/database-proxy.d.ts.map +0 -1
- package/dist/mcp/sandbox/database-proxy.js +0 -154
- package/dist/mcp/sandbox/database-proxy.js.map +0 -1
- package/dist/mcp/sandbox/index.d.ts +0 -8
- package/dist/mcp/sandbox/index.d.ts.map +0 -1
- package/dist/mcp/sandbox/index.js +0 -7
- package/dist/mcp/sandbox/index.js.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts +0 -72
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.js +0 -379
- package/dist/mcp/sandbox/miniflare-evaluator.js.map +0 -1
- package/dist/mcp/sandbox/template.d.ts +0 -48
- package/dist/mcp/sandbox/template.d.ts.map +0 -1
- package/dist/mcp/sandbox/template.js +0 -147
- package/dist/mcp/sandbox/template.js.map +0 -1
- package/dist/mcp/sandbox/worker-evaluator.d.ts +0 -160
- package/dist/mcp/sandbox/worker-evaluator.d.ts.map +0 -1
- package/dist/mcp/sandbox/worker-evaluator.js +0 -217
- package/dist/mcp/sandbox/worker-evaluator.js.map +0 -1
- package/dist/mcp/server.d.ts +0 -75
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/mcp/server.js +0 -278
- package/dist/mcp/server.js.map +0 -1
- package/dist/mcp/tool-call-auditor.d.ts +0 -188
- package/dist/mcp/tool-call-auditor.d.ts.map +0 -1
- package/dist/mcp/tool-call-auditor.js +0 -198
- package/dist/mcp/tool-call-auditor.js.map +0 -1
- package/dist/mcp/tools/do.d.ts +0 -51
- package/dist/mcp/tools/do.d.ts.map +0 -1
- package/dist/mcp/tools/do.js +0 -113
- package/dist/mcp/tools/do.js.map +0 -1
- package/dist/mcp/tools/fetch.d.ts +0 -43
- package/dist/mcp/tools/fetch.d.ts.map +0 -1
- package/dist/mcp/tools/fetch.js +0 -127
- package/dist/mcp/tools/fetch.js.map +0 -1
- package/dist/mcp/tools/index.d.ts +0 -9
- package/dist/mcp/tools/index.d.ts.map +0 -1
- package/dist/mcp/tools/index.js +0 -9
- package/dist/mcp/tools/index.js.map +0 -1
- package/dist/mcp/tools/search.d.ts +0 -60
- package/dist/mcp/tools/search.d.ts.map +0 -1
- package/dist/mcp/tools/search.js +0 -278
- package/dist/mcp/tools/search.js.map +0 -1
- package/dist/mcp/transport/http.d.ts +0 -144
- package/dist/mcp/transport/http.d.ts.map +0 -1
- package/dist/mcp/transport/http.js +0 -545
- package/dist/mcp/transport/http.js.map +0 -1
- package/dist/mcp/transport/index.d.ts +0 -10
- package/dist/mcp/transport/index.d.ts.map +0 -1
- package/dist/mcp/transport/index.js +0 -12
- package/dist/mcp/transport/index.js.map +0 -1
- package/dist/mcp/transport/stdio.d.ts +0 -132
- package/dist/mcp/transport/stdio.d.ts.map +0 -1
- package/dist/mcp/transport/stdio.js +0 -466
- package/dist/mcp/transport/stdio.js.map +0 -1
- package/dist/mcp/types.d.ts +0 -476
- package/dist/mcp/types.d.ts.map +0 -1
- package/dist/mcp/types.js +0 -178
- package/dist/mcp/types.js.map +0 -1
- package/dist/olap/cdc/cdc-buffer.d.ts +0 -92
- package/dist/olap/cdc/cdc-buffer.d.ts.map +0 -1
- package/dist/olap/cdc/cdc-buffer.js +0 -146
- package/dist/olap/cdc/cdc-buffer.js.map +0 -1
- package/dist/olap/cdc/cdc-emitter.d.ts +0 -118
- package/dist/olap/cdc/cdc-emitter.d.ts.map +0 -1
- package/dist/olap/cdc/cdc-emitter.js +0 -217
- package/dist/olap/cdc/cdc-emitter.js.map +0 -1
- package/dist/olap/cdc/cdc-schema.d.ts +0 -119
- package/dist/olap/cdc/cdc-schema.d.ts.map +0 -1
- package/dist/olap/cdc/cdc-schema.js +0 -253
- package/dist/olap/cdc/cdc-schema.js.map +0 -1
- package/dist/olap/cdc/index.d.ts +0 -10
- package/dist/olap/cdc/index.d.ts.map +0 -1
- package/dist/olap/cdc/index.js +0 -10
- package/dist/olap/cdc/index.js.map +0 -1
- package/dist/olap/clickhouse/iceberg.d.ts +0 -164
- package/dist/olap/clickhouse/iceberg.d.ts.map +0 -1
- package/dist/olap/clickhouse/iceberg.js +0 -138
- package/dist/olap/clickhouse/iceberg.js.map +0 -1
- package/dist/olap/clickhouse/index.d.ts +0 -14
- package/dist/olap/clickhouse/index.d.ts.map +0 -1
- package/dist/olap/clickhouse/index.js +0 -14
- package/dist/olap/clickhouse/index.js.map +0 -1
- package/dist/olap/clickhouse/mapper.d.ts +0 -170
- package/dist/olap/clickhouse/mapper.d.ts.map +0 -1
- package/dist/olap/clickhouse/mapper.js +0 -654
- package/dist/olap/clickhouse/mapper.js.map +0 -1
- package/dist/olap/clickhouse/olap-backend.d.ts +0 -181
- package/dist/olap/clickhouse/olap-backend.d.ts.map +0 -1
- package/dist/olap/clickhouse/olap-backend.js +0 -1083
- package/dist/olap/clickhouse/olap-backend.js.map +0 -1
- package/dist/olap/clickhouse/query-executor.d.ts +0 -163
- package/dist/olap/clickhouse/query-executor.d.ts.map +0 -1
- package/dist/olap/clickhouse/query-executor.js +0 -560
- package/dist/olap/clickhouse/query-executor.js.map +0 -1
- package/dist/olap/clickhouse/query.d.ts +0 -134
- package/dist/olap/clickhouse/query.d.ts.map +0 -1
- package/dist/olap/clickhouse/query.js +0 -512
- package/dist/olap/clickhouse/query.js.map +0 -1
- package/dist/olap/stage/index.d.ts +0 -6
- package/dist/olap/stage/index.d.ts.map +0 -1
- package/dist/olap/stage/index.js +0 -6
- package/dist/olap/stage/index.js.map +0 -1
- package/dist/olap/stage/parser.d.ts +0 -68
- package/dist/olap/stage/parser.d.ts.map +0 -1
- package/dist/olap/stage/parser.js +0 -293
- package/dist/olap/stage/parser.js.map +0 -1
- package/dist/olap/stage/router.d.ts +0 -94
- package/dist/olap/stage/router.d.ts.map +0 -1
- package/dist/olap/stage/router.js +0 -390
- package/dist/olap/stage/router.js.map +0 -1
- package/dist/rpc/endpoint.d.ts +0 -52
- package/dist/rpc/endpoint.d.ts.map +0 -1
- package/dist/rpc/endpoint.js +0 -734
- package/dist/rpc/endpoint.js.map +0 -1
- package/dist/rpc/index.d.ts +0 -34
- package/dist/rpc/index.d.ts.map +0 -1
- package/dist/rpc/index.js +0 -45
- package/dist/rpc/index.js.map +0 -1
- package/dist/rpc/rpc-client.d.ts +0 -275
- package/dist/rpc/rpc-client.d.ts.map +0 -1
- package/dist/rpc/rpc-client.js +0 -735
- package/dist/rpc/rpc-client.js.map +0 -1
- package/dist/rpc/rpc-target.d.ts +0 -220
- package/dist/rpc/rpc-target.d.ts.map +0 -1
- package/dist/rpc/rpc-target.js +0 -500
- package/dist/rpc/rpc-target.js.map +0 -1
- package/dist/rpc/worker-entrypoint.d.ts +0 -159
- package/dist/rpc/worker-entrypoint.d.ts.map +0 -1
- package/dist/rpc/worker-entrypoint.js +0 -212
- package/dist/rpc/worker-entrypoint.js.map +0 -1
- package/dist/server.d.ts +0 -18
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -129
- package/dist/server.js.map +0 -1
- package/dist/studio/components/browser/CollectionItem.d.ts +0 -26
- package/dist/studio/components/browser/CollectionItem.d.ts.map +0 -1
- package/dist/studio/components/browser/CollectionItem.js +0 -143
- package/dist/studio/components/browser/CollectionItem.js.map +0 -1
- package/dist/studio/components/browser/CollectionTree.d.ts +0 -45
- package/dist/studio/components/browser/CollectionTree.d.ts.map +0 -1
- package/dist/studio/components/browser/CollectionTree.js +0 -207
- package/dist/studio/components/browser/CollectionTree.js.map +0 -1
- package/dist/studio/components/browser/ConnectedDatabaseBrowser.d.ts +0 -51
- package/dist/studio/components/browser/ConnectedDatabaseBrowser.d.ts.map +0 -1
- package/dist/studio/components/browser/ConnectedDatabaseBrowser.js +0 -185
- package/dist/studio/components/browser/ConnectedDatabaseBrowser.js.map +0 -1
- package/dist/studio/components/browser/DatabaseBrowser.d.ts +0 -46
- package/dist/studio/components/browser/DatabaseBrowser.d.ts.map +0 -1
- package/dist/studio/components/browser/DatabaseBrowser.js +0 -304
- package/dist/studio/components/browser/DatabaseBrowser.js.map +0 -1
- package/dist/studio/components/browser/__tests__/CollectionItem.test.d.ts +0 -5
- package/dist/studio/components/browser/__tests__/CollectionItem.test.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/CollectionItem.test.js +0 -169
- package/dist/studio/components/browser/__tests__/CollectionItem.test.js.map +0 -1
- package/dist/studio/components/browser/__tests__/CollectionTree.test.d.ts +0 -5
- package/dist/studio/components/browser/__tests__/CollectionTree.test.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/CollectionTree.test.js +0 -203
- package/dist/studio/components/browser/__tests__/CollectionTree.test.js.map +0 -1
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.e2e.test.d.ts +0 -8
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.e2e.test.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.e2e.test.js +0 -522
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.e2e.test.js.map +0 -1
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.test.d.ts +0 -5
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.test.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.test.js +0 -518
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.test.js.map +0 -1
- package/dist/studio/components/browser/__tests__/setup.d.ts +0 -5
- package/dist/studio/components/browser/__tests__/setup.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/setup.js +0 -22
- package/dist/studio/components/browser/__tests__/setup.js.map +0 -1
- package/dist/studio/components/browser/index.d.ts +0 -15
- package/dist/studio/components/browser/index.d.ts.map +0 -1
- package/dist/studio/components/browser/index.js +0 -10
- package/dist/studio/components/browser/index.js.map +0 -1
- package/dist/studio/components/browser/types.d.ts +0 -33
- package/dist/studio/components/browser/types.d.ts.map +0 -1
- package/dist/studio/components/browser/types.js +0 -5
- package/dist/studio/components/browser/types.js.map +0 -1
- package/dist/studio/components/connection/ConnectionForm.d.ts +0 -59
- package/dist/studio/components/connection/ConnectionForm.d.ts.map +0 -1
- package/dist/studio/components/connection/ConnectionForm.js +0 -274
- package/dist/studio/components/connection/ConnectionForm.js.map +0 -1
- package/dist/studio/components/connection/ConnectionList.d.ts +0 -59
- package/dist/studio/components/connection/ConnectionList.d.ts.map +0 -1
- package/dist/studio/components/connection/ConnectionList.js +0 -286
- package/dist/studio/components/connection/ConnectionList.js.map +0 -1
- package/dist/studio/components/connection/ConnectionPanel.d.ts +0 -132
- package/dist/studio/components/connection/ConnectionPanel.d.ts.map +0 -1
- package/dist/studio/components/connection/ConnectionPanel.js +0 -293
- package/dist/studio/components/connection/ConnectionPanel.js.map +0 -1
- package/dist/studio/components/connection/__tests__/ConnectionPanel.test.d.ts +0 -8
- package/dist/studio/components/connection/__tests__/ConnectionPanel.test.d.ts.map +0 -1
- package/dist/studio/components/connection/__tests__/ConnectionPanel.test.js +0 -632
- package/dist/studio/components/connection/__tests__/ConnectionPanel.test.js.map +0 -1
- package/dist/studio/components/connection/__tests__/setup.d.ts +0 -5
- package/dist/studio/components/connection/__tests__/setup.d.ts.map +0 -1
- package/dist/studio/components/connection/__tests__/setup.js +0 -11
- package/dist/studio/components/connection/__tests__/setup.js.map +0 -1
- package/dist/studio/components/connection/index.d.ts +0 -10
- package/dist/studio/components/connection/index.d.ts.map +0 -1
- package/dist/studio/components/connection/index.js +0 -7
- package/dist/studio/components/connection/index.js.map +0 -1
- package/dist/studio/components/crud/DeleteDocumentDialog.d.ts +0 -91
- package/dist/studio/components/crud/DeleteDocumentDialog.d.ts.map +0 -1
- package/dist/studio/components/crud/DeleteDocumentDialog.js +0 -273
- package/dist/studio/components/crud/DeleteDocumentDialog.js.map +0 -1
- package/dist/studio/components/crud/DocumentEditor.d.ts +0 -32
- package/dist/studio/components/crud/DocumentEditor.d.ts.map +0 -1
- package/dist/studio/components/crud/DocumentEditor.js +0 -546
- package/dist/studio/components/crud/DocumentEditor.js.map +0 -1
- package/dist/studio/components/crud/InsertDocumentDialog.d.ts +0 -78
- package/dist/studio/components/crud/InsertDocumentDialog.d.ts.map +0 -1
- package/dist/studio/components/crud/InsertDocumentDialog.js +0 -323
- package/dist/studio/components/crud/InsertDocumentDialog.js.map +0 -1
- package/dist/studio/components/crud/__tests__/DeleteDocumentDialog.test.d.ts +0 -5
- package/dist/studio/components/crud/__tests__/DeleteDocumentDialog.test.d.ts.map +0 -1
- package/dist/studio/components/crud/__tests__/DeleteDocumentDialog.test.js +0 -298
- package/dist/studio/components/crud/__tests__/DeleteDocumentDialog.test.js.map +0 -1
- package/dist/studio/components/crud/__tests__/DocumentEditor.test.d.ts +0 -8
- package/dist/studio/components/crud/__tests__/DocumentEditor.test.d.ts.map +0 -1
- package/dist/studio/components/crud/__tests__/DocumentEditor.test.js +0 -368
- package/dist/studio/components/crud/__tests__/DocumentEditor.test.js.map +0 -1
- package/dist/studio/components/crud/__tests__/InsertDocumentDialog.test.d.ts +0 -2
- package/dist/studio/components/crud/__tests__/InsertDocumentDialog.test.d.ts.map +0 -1
- package/dist/studio/components/crud/__tests__/InsertDocumentDialog.test.js +0 -352
- package/dist/studio/components/crud/__tests__/InsertDocumentDialog.test.js.map +0 -1
- package/dist/studio/components/crud/__tests__/setup.d.ts +0 -5
- package/dist/studio/components/crud/__tests__/setup.d.ts.map +0 -1
- package/dist/studio/components/crud/__tests__/setup.js +0 -22
- package/dist/studio/components/crud/__tests__/setup.js.map +0 -1
- package/dist/studio/components/crud/index.d.ts +0 -12
- package/dist/studio/components/crud/index.d.ts.map +0 -1
- package/dist/studio/components/crud/index.js +0 -11
- package/dist/studio/components/crud/index.js.map +0 -1
- package/dist/studio/hooks/useConnection.d.ts +0 -127
- package/dist/studio/hooks/useConnection.d.ts.map +0 -1
- package/dist/studio/hooks/useConnection.js +0 -414
- package/dist/studio/hooks/useConnection.js.map +0 -1
- package/dist/studio/hooks/useDatabaseBrowser.d.ts +0 -107
- package/dist/studio/hooks/useDatabaseBrowser.d.ts.map +0 -1
- package/dist/studio/hooks/useDatabaseBrowser.js +0 -294
- package/dist/studio/hooks/useDatabaseBrowser.js.map +0 -1
- package/dist/studio/index.d.ts +0 -16
- package/dist/studio/index.d.ts.map +0 -1
- package/dist/studio/index.js +0 -14
- package/dist/studio/index.js.map +0 -1
- package/dist/studio/types/connection.d.ts +0 -266
- package/dist/studio/types/connection.d.ts.map +0 -1
- package/dist/studio/types/connection.js +0 -159
- package/dist/studio/types/connection.js.map +0 -1
- package/dist/studio/vitest.config.d.ts +0 -3
- package/dist/studio/vitest.config.d.ts.map +0 -1
- package/dist/studio/vitest.config.js +0 -33
- package/dist/studio/vitest.config.js.map +0 -1
- package/dist/translator/aggregation-translator.d.ts +0 -51
- package/dist/translator/aggregation-translator.d.ts.map +0 -1
- package/dist/translator/aggregation-translator.js +0 -324
- package/dist/translator/aggregation-translator.js.map +0 -1
- package/dist/translator/dialect.d.ts +0 -131
- package/dist/translator/dialect.d.ts.map +0 -1
- package/dist/translator/dialect.js +0 -276
- package/dist/translator/dialect.js.map +0 -1
- package/dist/translator/geo-translator.d.ts +0 -91
- package/dist/translator/geo-translator.d.ts.map +0 -1
- package/dist/translator/geo-translator.js +0 -587
- package/dist/translator/geo-translator.js.map +0 -1
- package/dist/translator/hybrid-translator.d.ts +0 -70
- package/dist/translator/hybrid-translator.d.ts.map +0 -1
- package/dist/translator/hybrid-translator.js +0 -193
- package/dist/translator/hybrid-translator.js.map +0 -1
- package/dist/translator/index.d.ts +0 -13
- package/dist/translator/index.d.ts.map +0 -1
- package/dist/translator/index.js +0 -11
- package/dist/translator/index.js.map +0 -1
- package/dist/translator/query-translator.d.ts +0 -211
- package/dist/translator/query-translator.d.ts.map +0 -1
- package/dist/translator/query-translator.js +0 -1276
- package/dist/translator/query-translator.js.map +0 -1
- package/dist/translator/search-highlight.d.ts +0 -83
- package/dist/translator/search-highlight.d.ts.map +0 -1
- package/dist/translator/search-highlight.js +0 -83
- package/dist/translator/search-highlight.js.map +0 -1
- package/dist/translator/search-translator.d.ts +0 -155
- package/dist/translator/search-translator.d.ts.map +0 -1
- package/dist/translator/search-translator.js +0 -241
- package/dist/translator/search-translator.js.map +0 -1
- package/dist/translator/stages/add-fields-stage.d.ts +0 -7
- package/dist/translator/stages/add-fields-stage.d.ts.map +0 -1
- package/dist/translator/stages/add-fields-stage.js +0 -72
- package/dist/translator/stages/add-fields-stage.js.map +0 -1
- package/dist/translator/stages/bucket-stage.d.ts +0 -7
- package/dist/translator/stages/bucket-stage.d.ts.map +0 -1
- package/dist/translator/stages/bucket-stage.js +0 -87
- package/dist/translator/stages/bucket-stage.js.map +0 -1
- package/dist/translator/stages/count-stage.d.ts +0 -7
- package/dist/translator/stages/count-stage.d.ts.map +0 -1
- package/dist/translator/stages/count-stage.js +0 -12
- package/dist/translator/stages/count-stage.js.map +0 -1
- package/dist/translator/stages/expression-translator.d.ts +0 -68
- package/dist/translator/stages/expression-translator.d.ts.map +0 -1
- package/dist/translator/stages/expression-translator.js +0 -467
- package/dist/translator/stages/expression-translator.js.map +0 -1
- package/dist/translator/stages/facet-stage.d.ts +0 -13
- package/dist/translator/stages/facet-stage.d.ts.map +0 -1
- package/dist/translator/stages/facet-stage.js +0 -26
- package/dist/translator/stages/facet-stage.js.map +0 -1
- package/dist/translator/stages/fusion-stages.d.ts +0 -118
- package/dist/translator/stages/fusion-stages.d.ts.map +0 -1
- package/dist/translator/stages/fusion-stages.js +0 -201
- package/dist/translator/stages/fusion-stages.js.map +0 -1
- package/dist/translator/stages/group-stage.d.ts +0 -8
- package/dist/translator/stages/group-stage.d.ts.map +0 -1
- package/dist/translator/stages/group-stage.js +0 -123
- package/dist/translator/stages/group-stage.js.map +0 -1
- package/dist/translator/stages/index.d.ts +0 -24
- package/dist/translator/stages/index.d.ts.map +0 -1
- package/dist/translator/stages/index.js +0 -24
- package/dist/translator/stages/index.js.map +0 -1
- package/dist/translator/stages/join-optimizer.d.ts +0 -37
- package/dist/translator/stages/join-optimizer.d.ts.map +0 -1
- package/dist/translator/stages/join-optimizer.js +0 -93
- package/dist/translator/stages/join-optimizer.js.map +0 -1
- package/dist/translator/stages/limit-stage.d.ts +0 -7
- package/dist/translator/stages/limit-stage.d.ts.map +0 -1
- package/dist/translator/stages/limit-stage.js +0 -11
- package/dist/translator/stages/limit-stage.js.map +0 -1
- package/dist/translator/stages/lookup-stage.d.ts +0 -7
- package/dist/translator/stages/lookup-stage.d.ts.map +0 -1
- package/dist/translator/stages/lookup-stage.js +0 -73
- package/dist/translator/stages/lookup-stage.js.map +0 -1
- package/dist/translator/stages/match-stage.d.ts +0 -7
- package/dist/translator/stages/match-stage.d.ts.map +0 -1
- package/dist/translator/stages/match-stage.js +0 -14
- package/dist/translator/stages/match-stage.js.map +0 -1
- package/dist/translator/stages/optimizer.d.ts +0 -15
- package/dist/translator/stages/optimizer.d.ts.map +0 -1
- package/dist/translator/stages/optimizer.js +0 -249
- package/dist/translator/stages/optimizer.js.map +0 -1
- package/dist/translator/stages/parallel-facet.d.ts +0 -47
- package/dist/translator/stages/parallel-facet.d.ts.map +0 -1
- package/dist/translator/stages/parallel-facet.js +0 -57
- package/dist/translator/stages/parallel-facet.js.map +0 -1
- package/dist/translator/stages/project-stage.d.ts +0 -8
- package/dist/translator/stages/project-stage.d.ts.map +0 -1
- package/dist/translator/stages/project-stage.js +0 -145
- package/dist/translator/stages/project-stage.js.map +0 -1
- package/dist/translator/stages/search-stage.d.ts +0 -60
- package/dist/translator/stages/search-stage.d.ts.map +0 -1
- package/dist/translator/stages/search-stage.js +0 -89
- package/dist/translator/stages/search-stage.js.map +0 -1
- package/dist/translator/stages/skip-stage.d.ts +0 -7
- package/dist/translator/stages/skip-stage.d.ts.map +0 -1
- package/dist/translator/stages/skip-stage.js +0 -11
- package/dist/translator/stages/skip-stage.js.map +0 -1
- package/dist/translator/stages/sort-stage.d.ts +0 -7
- package/dist/translator/stages/sort-stage.d.ts.map +0 -1
- package/dist/translator/stages/sort-stage.js +0 -21
- package/dist/translator/stages/sort-stage.js.map +0 -1
- package/dist/translator/stages/types.d.ts +0 -136
- package/dist/translator/stages/types.d.ts.map +0 -1
- package/dist/translator/stages/types.js +0 -5
- package/dist/translator/stages/types.js.map +0 -1
- package/dist/translator/stages/unwind-stage.d.ts +0 -7
- package/dist/translator/stages/unwind-stage.d.ts.map +0 -1
- package/dist/translator/stages/unwind-stage.js +0 -61
- package/dist/translator/stages/unwind-stage.js.map +0 -1
- package/dist/translator/stages/vector-search-stage.d.ts +0 -53
- package/dist/translator/stages/vector-search-stage.d.ts.map +0 -1
- package/dist/translator/stages/vector-search-stage.js +0 -62
- package/dist/translator/stages/vector-search-stage.js.map +0 -1
- package/dist/translator/update-translator.d.ts +0 -148
- package/dist/translator/update-translator.d.ts.map +0 -1
- package/dist/translator/update-translator.js +0 -819
- package/dist/translator/update-translator.js.map +0 -1
- package/dist/translator/vector-translator.d.ts +0 -89
- package/dist/translator/vector-translator.d.ts.map +0 -1
- package/dist/translator/vector-translator.js +0 -106
- package/dist/translator/vector-translator.js.map +0 -1
- package/dist/types/env.d.ts +0 -31
- package/dist/types/env.d.ts.map +0 -1
- package/dist/types/env.js +0 -5
- package/dist/types/env.js.map +0 -1
- package/dist/types/function.d.ts +0 -65
- package/dist/types/function.d.ts.map +0 -1
- package/dist/types/function.js +0 -5
- package/dist/types/function.js.map +0 -1
- package/dist/types/index.d.ts +0 -137
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -13
- package/dist/types/index.js.map +0 -1
- package/dist/types/mongodb.d.ts +0 -258
- package/dist/types/mongodb.d.ts.map +0 -1
- package/dist/types/mongodb.js +0 -5
- package/dist/types/mongodb.js.map +0 -1
- package/dist/types/objectid.d.ts +0 -130
- package/dist/types/objectid.d.ts.map +0 -1
- package/dist/types/objectid.js +0 -314
- package/dist/types/objectid.js.map +0 -1
- package/dist/types/rpc.d.ts +0 -313
- package/dist/types/rpc.d.ts.map +0 -1
- package/dist/types/rpc.js +0 -136
- package/dist/types/rpc.js.map +0 -1
- package/dist/types/vectorize.d.ts +0 -136
- package/dist/types/vectorize.d.ts.map +0 -1
- package/dist/types/vectorize.js +0 -8
- package/dist/types/vectorize.js.map +0 -1
- package/dist/utils/sql-safety.d.ts +0 -64
- package/dist/utils/sql-safety.d.ts.map +0 -1
- package/dist/utils/sql-safety.js +0 -112
- package/dist/utils/sql-safety.js.map +0 -1
- package/dist/validation/document-validator.d.ts +0 -195
- package/dist/validation/document-validator.d.ts.map +0 -1
- package/dist/validation/document-validator.js +0 -529
- package/dist/validation/document-validator.js.map +0 -1
- package/dist/vectorize/document-serializer.d.ts +0 -119
- package/dist/vectorize/document-serializer.d.ts.map +0 -1
- package/dist/vectorize/document-serializer.js +0 -320
- package/dist/vectorize/document-serializer.js.map +0 -1
- package/dist/wire/auth/index.d.ts +0 -5
- package/dist/wire/auth/index.d.ts.map +0 -1
- package/dist/wire/auth/index.js +0 -5
- package/dist/wire/auth/index.js.map +0 -1
- package/dist/wire/auth/scram.d.ts +0 -160
- package/dist/wire/auth/scram.d.ts.map +0 -1
- package/dist/wire/auth/scram.js +0 -425
- package/dist/wire/auth/scram.js.map +0 -1
- package/dist/wire/backend/interface.d.ts +0 -168
- package/dist/wire/backend/interface.d.ts.map +0 -1
- package/dist/wire/backend/interface.js +0 -10
- package/dist/wire/backend/interface.js.map +0 -1
- package/dist/wire/backend/local-sqlite.d.ts +0 -89
- package/dist/wire/backend/local-sqlite.d.ts.map +0 -1
- package/dist/wire/backend/local-sqlite.js +0 -1002
- package/dist/wire/backend/local-sqlite.js.map +0 -1
- package/dist/wire/backend/query-router.d.ts +0 -197
- package/dist/wire/backend/query-router.d.ts.map +0 -1
- package/dist/wire/backend/query-router.js +0 -590
- package/dist/wire/backend/query-router.js.map +0 -1
- package/dist/wire/backend/validation.d.ts +0 -26
- package/dist/wire/backend/validation.d.ts.map +0 -1
- package/dist/wire/backend/validation.js +0 -79
- package/dist/wire/backend/validation.js.map +0 -1
- package/dist/wire/backend/workers-proxy.d.ts +0 -95
- package/dist/wire/backend/workers-proxy.d.ts.map +0 -1
- package/dist/wire/backend/workers-proxy.js +0 -429
- package/dist/wire/backend/workers-proxy.js.map +0 -1
- package/dist/wire/commands/admin.d.ts +0 -49
- package/dist/wire/commands/admin.d.ts.map +0 -1
- package/dist/wire/commands/admin.js +0 -272
- package/dist/wire/commands/admin.js.map +0 -1
- package/dist/wire/commands/aggregate.d.ts +0 -15
- package/dist/wire/commands/aggregate.d.ts.map +0 -1
- package/dist/wire/commands/aggregate.js +0 -98
- package/dist/wire/commands/aggregate.js.map +0 -1
- package/dist/wire/commands/auth.d.ts +0 -58
- package/dist/wire/commands/auth.d.ts.map +0 -1
- package/dist/wire/commands/auth.js +0 -158
- package/dist/wire/commands/auth.js.map +0 -1
- package/dist/wire/commands/crud.d.ts +0 -49
- package/dist/wire/commands/crud.d.ts.map +0 -1
- package/dist/wire/commands/crud.js +0 -336
- package/dist/wire/commands/crud.js.map +0 -1
- package/dist/wire/commands/hello.d.ts +0 -35
- package/dist/wire/commands/hello.d.ts.map +0 -1
- package/dist/wire/commands/hello.js +0 -204
- package/dist/wire/commands/hello.js.map +0 -1
- package/dist/wire/commands/index.d.ts +0 -24
- package/dist/wire/commands/index.d.ts.map +0 -1
- package/dist/wire/commands/index.js +0 -145
- package/dist/wire/commands/index.js.map +0 -1
- package/dist/wire/commands/router.d.ts +0 -46
- package/dist/wire/commands/router.d.ts.map +0 -1
- package/dist/wire/commands/router.js +0 -151
- package/dist/wire/commands/router.js.map +0 -1
- package/dist/wire/commands/types.d.ts +0 -51
- package/dist/wire/commands/types.d.ts.map +0 -1
- package/dist/wire/commands/types.js +0 -15
- package/dist/wire/commands/types.js.map +0 -1
- package/dist/wire/index.d.ts +0 -15
- package/dist/wire/index.d.ts.map +0 -1
- package/dist/wire/index.js +0 -19
- package/dist/wire/index.js.map +0 -1
- package/dist/wire/message.d.ts +0 -49
- package/dist/wire/message.d.ts.map +0 -1
- package/dist/wire/message.js +0 -299
- package/dist/wire/message.js.map +0 -1
- package/dist/wire/server.d.ts +0 -145
- package/dist/wire/server.d.ts.map +0 -1
- package/dist/wire/server.js +0 -284
- package/dist/wire/server.js.map +0 -1
- package/dist/wire/types.d.ts +0 -140
- package/dist/wire/types.d.ts.map +0 -1
- package/dist/wire/types.js +0 -64
- package/dist/wire/types.js.map +0 -1
- package/dist/worker.d.ts.map +0 -1
|
@@ -1,487 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vercel AI SDK Adapter for MCP
|
|
3
|
-
*
|
|
4
|
-
* Adapts MCP server tools to Vercel AI SDK's tool format.
|
|
5
|
-
* Compatible with the Vercel AI SDK's `tool` and `generateText` APIs.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Converts MCP tool definitions to Vercel AI SDK format
|
|
9
|
-
* - Supports both `tool()` and `CoreTool` interfaces
|
|
10
|
-
* - Handles streaming via Vercel's streaming responses
|
|
11
|
-
* - Integrates with `ai` package for Next.js compatibility
|
|
12
|
-
*
|
|
13
|
-
* @see https://sdk.vercel.ai/docs/ai-sdk-core/tools-and-tool-calling
|
|
14
|
-
*/
|
|
15
|
-
import { BaseAdapter } from './base-adapter';
|
|
16
|
-
import { McpError } from './errors';
|
|
17
|
-
import { streamTextContent, } from './streaming';
|
|
18
|
-
import { z } from 'zod';
|
|
19
|
-
// =============================================================================
|
|
20
|
-
// Constants
|
|
21
|
-
// =============================================================================
|
|
22
|
-
const DEFAULT_STREAMING_THRESHOLD = 50 * 1024; // 50KB
|
|
23
|
-
// =============================================================================
|
|
24
|
-
// Vercel Adapter Class
|
|
25
|
-
// =============================================================================
|
|
26
|
-
/**
|
|
27
|
-
* Vercel AI SDK Adapter
|
|
28
|
-
*
|
|
29
|
-
* Converts MCP tools to Vercel AI SDK's CoreTool format and handles
|
|
30
|
-
* tool execution with streaming support.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```typescript
|
|
34
|
-
* import { generateText, tool } from 'ai'
|
|
35
|
-
*
|
|
36
|
-
* const mcpServer = createMcpServer({ dbAccess })
|
|
37
|
-
* const adapter = new VercelAdapter({ server: mcpServer })
|
|
38
|
-
*
|
|
39
|
-
* await adapter.initialize()
|
|
40
|
-
*
|
|
41
|
-
* // Get tools for Vercel AI SDK
|
|
42
|
-
* const tools = await adapter.getTools()
|
|
43
|
-
*
|
|
44
|
-
* // Use with generateText
|
|
45
|
-
* const result = await generateText({
|
|
46
|
-
* model: openai('gpt-4'),
|
|
47
|
-
* tools,
|
|
48
|
-
* prompt: 'Search for documents about AI',
|
|
49
|
-
* })
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export class VercelAdapter extends BaseAdapter {
|
|
53
|
-
streamingThreshold;
|
|
54
|
-
defaultStreaming;
|
|
55
|
-
formatResult;
|
|
56
|
-
toolCache = new Map();
|
|
57
|
-
mcpToolNames = new Map(); // Vercel name -> MCP name
|
|
58
|
-
initialized = false;
|
|
59
|
-
constructor(config) {
|
|
60
|
-
super(config);
|
|
61
|
-
this.streamingThreshold = config.streamingThreshold ?? DEFAULT_STREAMING_THRESHOLD;
|
|
62
|
-
this.defaultStreaming = config.defaultStreaming ?? true;
|
|
63
|
-
this.formatResult = config.formatResult ?? this.defaultResultFormatter.bind(this);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Adapter name for logging
|
|
67
|
-
*/
|
|
68
|
-
get adapterName() {
|
|
69
|
-
return 'vercel';
|
|
70
|
-
}
|
|
71
|
-
// ===========================================================================
|
|
72
|
-
// Lifecycle
|
|
73
|
-
// ===========================================================================
|
|
74
|
-
/**
|
|
75
|
-
* Initialize the adapter
|
|
76
|
-
*
|
|
77
|
-
* Fetches all available tools from the MCP server and converts
|
|
78
|
-
* them to Vercel AI SDK format.
|
|
79
|
-
*/
|
|
80
|
-
async initialize() {
|
|
81
|
-
if (this.initialized) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
this.log('info', 'Initializing Vercel AI SDK adapter');
|
|
85
|
-
try {
|
|
86
|
-
const mcpTools = await this.server.listTools();
|
|
87
|
-
for (const tool of mcpTools) {
|
|
88
|
-
const vercelTool = this.convertTool(tool);
|
|
89
|
-
this.toolCache.set(tool.name, vercelTool);
|
|
90
|
-
this.mcpToolNames.set(tool.name, tool.name);
|
|
91
|
-
this.log('debug', `Registered tool: ${tool.name}`);
|
|
92
|
-
}
|
|
93
|
-
this.initialized = true;
|
|
94
|
-
this.log('info', `Vercel adapter initialized with ${this.toolCache.size} tools`);
|
|
95
|
-
}
|
|
96
|
-
catch (error) {
|
|
97
|
-
this.log('error', 'Failed to initialize Vercel adapter', { error });
|
|
98
|
-
throw McpError.fromError(error instanceof Error ? error : new Error(String(error)));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Cleanup adapter resources
|
|
103
|
-
*/
|
|
104
|
-
async cleanup() {
|
|
105
|
-
this.toolCache.clear();
|
|
106
|
-
this.mcpToolNames.clear();
|
|
107
|
-
this.initialized = false;
|
|
108
|
-
this.log('info', 'Vercel adapter cleaned up');
|
|
109
|
-
}
|
|
110
|
-
// ===========================================================================
|
|
111
|
-
// Tool Conversion
|
|
112
|
-
// ===========================================================================
|
|
113
|
-
/**
|
|
114
|
-
* Convert MCP tool definition to Vercel CoreTool format
|
|
115
|
-
*/
|
|
116
|
-
convertTool(mcpTool) {
|
|
117
|
-
const parameters = this.convertToZodSchema(mcpTool.inputSchema);
|
|
118
|
-
const toolName = mcpTool.name;
|
|
119
|
-
return {
|
|
120
|
-
description: mcpTool.description,
|
|
121
|
-
parameters,
|
|
122
|
-
execute: async (params) => {
|
|
123
|
-
const response = await this.callTool(toolName, params);
|
|
124
|
-
return this.formatResult(response);
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Convert JSON Schema to Zod schema
|
|
130
|
-
*
|
|
131
|
-
* Creates a Zod schema that validates the same structure as the
|
|
132
|
-
* original JSON Schema from the MCP tool definition.
|
|
133
|
-
*/
|
|
134
|
-
convertToZodSchema(schema) {
|
|
135
|
-
const shape = {};
|
|
136
|
-
if (schema.properties) {
|
|
137
|
-
for (const [key, prop] of Object.entries(schema.properties)) {
|
|
138
|
-
shape[key] = this.convertPropertyToZod(prop, schema.required?.includes(key) ?? false);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return z.object(shape);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Convert a single JSON Schema property to Zod
|
|
145
|
-
*/
|
|
146
|
-
convertPropertyToZod(prop, required) {
|
|
147
|
-
let zodType;
|
|
148
|
-
switch (prop.type) {
|
|
149
|
-
case 'string':
|
|
150
|
-
zodType = z.string();
|
|
151
|
-
if (prop.description) {
|
|
152
|
-
zodType = zodType.describe(prop.description);
|
|
153
|
-
}
|
|
154
|
-
if ('enum' in prop && prop.enum) {
|
|
155
|
-
zodType = z.enum(prop.enum);
|
|
156
|
-
}
|
|
157
|
-
break;
|
|
158
|
-
case 'number':
|
|
159
|
-
case 'integer':
|
|
160
|
-
zodType = z.number();
|
|
161
|
-
if (prop.description) {
|
|
162
|
-
zodType = zodType.describe(prop.description);
|
|
163
|
-
}
|
|
164
|
-
break;
|
|
165
|
-
case 'boolean':
|
|
166
|
-
zodType = z.boolean();
|
|
167
|
-
if (prop.description) {
|
|
168
|
-
zodType = zodType.describe(prop.description);
|
|
169
|
-
}
|
|
170
|
-
break;
|
|
171
|
-
case 'array':
|
|
172
|
-
if ('items' in prop && prop.items) {
|
|
173
|
-
zodType = z.array(this.convertPropertyToZod(prop.items, true));
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
zodType = z.array(z.unknown());
|
|
177
|
-
}
|
|
178
|
-
if (prop.description) {
|
|
179
|
-
zodType = zodType.describe(prop.description);
|
|
180
|
-
}
|
|
181
|
-
break;
|
|
182
|
-
case 'object':
|
|
183
|
-
if ('properties' in prop && prop.properties) {
|
|
184
|
-
const nestedShape = {};
|
|
185
|
-
for (const [key, value] of Object.entries(prop.properties)) {
|
|
186
|
-
const isRequired = 'required' in prop && prop.required?.includes(key);
|
|
187
|
-
nestedShape[key] = this.convertPropertyToZod(value, isRequired ?? false);
|
|
188
|
-
}
|
|
189
|
-
zodType = z.object(nestedShape);
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
zodType = z.record(z.string(), z.unknown());
|
|
193
|
-
}
|
|
194
|
-
if (prop.description) {
|
|
195
|
-
zodType = zodType.describe(prop.description);
|
|
196
|
-
}
|
|
197
|
-
break;
|
|
198
|
-
default:
|
|
199
|
-
zodType = z.unknown();
|
|
200
|
-
}
|
|
201
|
-
return required ? zodType : zodType.optional();
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Default result formatter
|
|
205
|
-
*/
|
|
206
|
-
defaultResultFormatter(response) {
|
|
207
|
-
if (response.isError) {
|
|
208
|
-
return JSON.stringify({ error: this.extractTextContent(response) });
|
|
209
|
-
}
|
|
210
|
-
return this.extractTextContent(response);
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Extract text content from MCP response
|
|
214
|
-
*/
|
|
215
|
-
extractTextContent(response) {
|
|
216
|
-
return response.content
|
|
217
|
-
.filter((c) => c.type === 'text')
|
|
218
|
-
.map((c) => c.text)
|
|
219
|
-
.join('\n');
|
|
220
|
-
}
|
|
221
|
-
// ===========================================================================
|
|
222
|
-
// Public API
|
|
223
|
-
// ===========================================================================
|
|
224
|
-
/**
|
|
225
|
-
* Get all tools in Vercel AI SDK format
|
|
226
|
-
*
|
|
227
|
-
* Returns a record of tool definitions suitable for use with
|
|
228
|
-
* the Vercel AI SDK's `generateText` or `streamText` functions.
|
|
229
|
-
*
|
|
230
|
-
* @returns Record of tool name to CoreTool
|
|
231
|
-
*
|
|
232
|
-
* @example
|
|
233
|
-
* ```typescript
|
|
234
|
-
* import { generateText } from 'ai'
|
|
235
|
-
*
|
|
236
|
-
* const tools = await adapter.getTools()
|
|
237
|
-
*
|
|
238
|
-
* const result = await generateText({
|
|
239
|
-
* model: openai('gpt-4'),
|
|
240
|
-
* tools,
|
|
241
|
-
* prompt: 'Search for users',
|
|
242
|
-
* })
|
|
243
|
-
* ```
|
|
244
|
-
*/
|
|
245
|
-
async getTools() {
|
|
246
|
-
if (!this.initialized) {
|
|
247
|
-
await this.initialize();
|
|
248
|
-
}
|
|
249
|
-
return Object.fromEntries(this.toolCache);
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Get a single tool by name
|
|
253
|
-
*
|
|
254
|
-
* @param name - Tool name
|
|
255
|
-
* @returns CoreTool or undefined
|
|
256
|
-
*/
|
|
257
|
-
async getTool(name) {
|
|
258
|
-
if (!this.initialized) {
|
|
259
|
-
await this.initialize();
|
|
260
|
-
}
|
|
261
|
-
return this.toolCache.get(name);
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Handle a tool call from model response
|
|
265
|
-
*
|
|
266
|
-
* Executes the requested tool and returns a tool result.
|
|
267
|
-
*
|
|
268
|
-
* @param toolCall - Tool call from model
|
|
269
|
-
* @returns Tool result
|
|
270
|
-
*
|
|
271
|
-
* @example
|
|
272
|
-
* ```typescript
|
|
273
|
-
* for (const toolCall of result.toolCalls) {
|
|
274
|
-
* const toolResult = await adapter.handleToolCall(toolCall)
|
|
275
|
-
* results.push(toolResult)
|
|
276
|
-
* }
|
|
277
|
-
* ```
|
|
278
|
-
*/
|
|
279
|
-
async handleToolCall(toolCall) {
|
|
280
|
-
const startTime = Date.now();
|
|
281
|
-
this.log('debug', `Handling tool call: ${toolCall.toolName}`, {
|
|
282
|
-
id: toolCall.toolCallId,
|
|
283
|
-
});
|
|
284
|
-
try {
|
|
285
|
-
const response = await this.callTool(toolCall.toolName, toolCall.args);
|
|
286
|
-
return {
|
|
287
|
-
toolCallId: toolCall.toolCallId,
|
|
288
|
-
toolName: toolCall.toolName,
|
|
289
|
-
result: this.formatResult(response),
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
catch (error) {
|
|
293
|
-
const mcpError = McpError.fromError(error instanceof Error ? error : new Error(String(error)));
|
|
294
|
-
this.log('error', `Tool call failed: ${toolCall.toolName}`, {
|
|
295
|
-
id: toolCall.toolCallId,
|
|
296
|
-
error: mcpError.message,
|
|
297
|
-
duration: Date.now() - startTime,
|
|
298
|
-
});
|
|
299
|
-
return {
|
|
300
|
-
toolCallId: toolCall.toolCallId,
|
|
301
|
-
toolName: toolCall.toolName,
|
|
302
|
-
result: JSON.stringify({
|
|
303
|
-
error: mcpError.message,
|
|
304
|
-
code: mcpError.code,
|
|
305
|
-
}),
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Handle multiple tool calls in parallel
|
|
311
|
-
*
|
|
312
|
-
* @param toolCalls - Array of tool calls
|
|
313
|
-
* @param concurrency - Maximum concurrent executions (default: 5)
|
|
314
|
-
* @returns Array of tool results
|
|
315
|
-
*/
|
|
316
|
-
async handleToolCalls(toolCalls, concurrency = 5) {
|
|
317
|
-
const results = [];
|
|
318
|
-
const executing = [];
|
|
319
|
-
for (const toolCall of toolCalls) {
|
|
320
|
-
const promise = this.handleToolCall(toolCall).then((result) => {
|
|
321
|
-
results.push(result);
|
|
322
|
-
});
|
|
323
|
-
executing.push(promise);
|
|
324
|
-
if (executing.length >= concurrency) {
|
|
325
|
-
await Promise.race(executing);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
await Promise.all(executing);
|
|
329
|
-
return results;
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Create a streaming tool executor
|
|
333
|
-
*
|
|
334
|
-
* Returns a function that executes a tool and streams the response.
|
|
335
|
-
* Compatible with Vercel AI SDK's streaming patterns.
|
|
336
|
-
*
|
|
337
|
-
* @param toolName - Name of the tool
|
|
338
|
-
* @returns Streaming executor function
|
|
339
|
-
*
|
|
340
|
-
* @example
|
|
341
|
-
* ```typescript
|
|
342
|
-
* const searchStream = adapter.createStreamingExecutor('search')
|
|
343
|
-
*
|
|
344
|
-
* const stream = searchStream({ query: 'AI documents' })
|
|
345
|
-
*
|
|
346
|
-
* for await (const chunk of stream) {
|
|
347
|
-
* process.stdout.write(chunk)
|
|
348
|
-
* }
|
|
349
|
-
* ```
|
|
350
|
-
*/
|
|
351
|
-
createStreamingExecutor(toolName) {
|
|
352
|
-
return (args, options) => {
|
|
353
|
-
return this.executeWithStreaming(toolName, args, options);
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Execute a tool with streaming response
|
|
358
|
-
*
|
|
359
|
-
* @param toolName - Tool name
|
|
360
|
-
* @param args - Tool arguments
|
|
361
|
-
* @param options - Stream options
|
|
362
|
-
* @yields String chunks of the response
|
|
363
|
-
*/
|
|
364
|
-
async *executeWithStreaming(toolName, args, options) {
|
|
365
|
-
const response = await this.callTool(toolName, args);
|
|
366
|
-
const content = this.extractTextContent(response);
|
|
367
|
-
const shouldStream = options?.stream ?? this.defaultStreaming;
|
|
368
|
-
const chunkSize = options?.chunkSize ?? 1024;
|
|
369
|
-
if (!shouldStream || content.length <= this.streamingThreshold) {
|
|
370
|
-
yield content;
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
for await (const chunk of streamTextContent(content, {
|
|
374
|
-
chunkSize,
|
|
375
|
-
...(options?.signal && { signal: options.signal }),
|
|
376
|
-
})) {
|
|
377
|
-
yield chunk.content;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Create a ReadableStream for a tool execution
|
|
382
|
-
*
|
|
383
|
-
* Returns a Web Streams API ReadableStream that can be used
|
|
384
|
-
* with Response objects for HTTP streaming.
|
|
385
|
-
*
|
|
386
|
-
* @param toolName - Tool name
|
|
387
|
-
* @param args - Tool arguments
|
|
388
|
-
* @returns ReadableStream of response chunks
|
|
389
|
-
*
|
|
390
|
-
* @example
|
|
391
|
-
* ```typescript
|
|
392
|
-
* // In a Next.js API route
|
|
393
|
-
* export async function POST(req: Request) {
|
|
394
|
-
* const { toolName, args } = await req.json()
|
|
395
|
-
* const stream = adapter.createReadableStream(toolName, args)
|
|
396
|
-
* return new Response(stream)
|
|
397
|
-
* }
|
|
398
|
-
* ```
|
|
399
|
-
*/
|
|
400
|
-
createReadableStream(toolName, args) {
|
|
401
|
-
const encoder = new TextEncoder();
|
|
402
|
-
const adapter = this;
|
|
403
|
-
return new ReadableStream({
|
|
404
|
-
async start(controller) {
|
|
405
|
-
try {
|
|
406
|
-
for await (const chunk of adapter.executeWithStreaming(toolName, args)) {
|
|
407
|
-
controller.enqueue(encoder.encode(chunk));
|
|
408
|
-
}
|
|
409
|
-
controller.close();
|
|
410
|
-
}
|
|
411
|
-
catch (error) {
|
|
412
|
-
controller.error(error);
|
|
413
|
-
}
|
|
414
|
-
},
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Create a tool wrapper compatible with Vercel AI SDK's `tool()` helper
|
|
419
|
-
*
|
|
420
|
-
* This creates a tool definition that can be used directly with the
|
|
421
|
-
* `tool()` helper from the `ai` package.
|
|
422
|
-
*
|
|
423
|
-
* @param mcpToolName - MCP tool name
|
|
424
|
-
* @returns Tool configuration object
|
|
425
|
-
*
|
|
426
|
-
* @example
|
|
427
|
-
* ```typescript
|
|
428
|
-
* import { tool } from 'ai'
|
|
429
|
-
*
|
|
430
|
-
* const searchTool = adapter.createToolWrapper('search')
|
|
431
|
-
*
|
|
432
|
-
* // Use with generateText
|
|
433
|
-
* const result = await generateText({
|
|
434
|
-
* model: openai('gpt-4'),
|
|
435
|
-
* tools: { search: searchTool },
|
|
436
|
-
* prompt: 'Find documents',
|
|
437
|
-
* })
|
|
438
|
-
* ```
|
|
439
|
-
*/
|
|
440
|
-
createToolWrapper(mcpToolName) {
|
|
441
|
-
return this.toolCache.get(mcpToolName);
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
// =============================================================================
|
|
445
|
-
// Factory Function
|
|
446
|
-
// =============================================================================
|
|
447
|
-
/**
|
|
448
|
-
* Create a Vercel AI SDK adapter for an MCP server
|
|
449
|
-
*
|
|
450
|
-
* @param config - Adapter configuration
|
|
451
|
-
* @returns Configured VercelAdapter instance
|
|
452
|
-
*
|
|
453
|
-
* @example
|
|
454
|
-
* ```typescript
|
|
455
|
-
* const adapter = createVercelAdapter({
|
|
456
|
-
* server: mcpServer,
|
|
457
|
-
* retry: { maxRetries: 3 },
|
|
458
|
-
* streamingThreshold: 10000,
|
|
459
|
-
* })
|
|
460
|
-
*
|
|
461
|
-
* await adapter.initialize()
|
|
462
|
-
* const tools = await adapter.getTools()
|
|
463
|
-
* ```
|
|
464
|
-
*/
|
|
465
|
-
export function createVercelAdapter(config) {
|
|
466
|
-
return new VercelAdapter(config);
|
|
467
|
-
}
|
|
468
|
-
// =============================================================================
|
|
469
|
-
// Utility Functions
|
|
470
|
-
// =============================================================================
|
|
471
|
-
/**
|
|
472
|
-
* Convert Vercel tool results to continuation messages
|
|
473
|
-
*
|
|
474
|
-
* Formats tool results for inclusion in the next model request.
|
|
475
|
-
*
|
|
476
|
-
* @param results - Array of tool results
|
|
477
|
-
* @returns Formatted tool results for API
|
|
478
|
-
*/
|
|
479
|
-
export function formatToolResults(results) {
|
|
480
|
-
return results.map((result) => ({
|
|
481
|
-
type: 'tool-result',
|
|
482
|
-
toolCallId: result.toolCallId,
|
|
483
|
-
toolName: result.toolName,
|
|
484
|
-
result: result.result,
|
|
485
|
-
}));
|
|
486
|
-
}
|
|
487
|
-
//# sourceMappingURL=vercel-adapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vercel-adapter.js","sourceRoot":"","sources":["../../../src/mcp/adapters/vercel-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,WAAW,EAA0B,MAAM,gBAAgB,CAAA;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,UA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|
-
* The MonDoAgent orchestrates:
|
|
5
|
-
* - MCP Server for tool handling (search, fetch, do)
|
|
6
|
-
* - AgentFS for file system operations
|
|
7
|
-
* - KV Store for key-value storage
|
|
8
|
-
* - Tool Call Auditing for logging
|
|
9
|
-
* - Code execution via Worker Loader or Miniflare fallback
|
|
10
|
-
*/
|
|
11
|
-
import { type CodeLoader, type McpServerConfig } from './server';
|
|
12
|
-
import { type AgentFSDatabase } from '../agentfs/vfs';
|
|
13
|
-
import { type KVStorageBackend } from '../agentfs/kv-store';
|
|
14
|
-
import { type AuditBackend } from '../agentfs/toolcalls';
|
|
15
|
-
import type { DatabaseAccess, McpToolResponse } from './types';
|
|
16
|
-
/**
|
|
17
|
-
* Execution result from tool or code execution
|
|
18
|
-
*/
|
|
19
|
-
export interface ExecutionResult<T = unknown> {
|
|
20
|
-
success: boolean;
|
|
21
|
-
value?: T;
|
|
22
|
-
error?: string;
|
|
23
|
-
logs?: string[];
|
|
24
|
-
duration?: number;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Search options for the search method
|
|
28
|
-
*/
|
|
29
|
-
export interface SearchOptions {
|
|
30
|
-
collection?: string;
|
|
31
|
-
database?: string;
|
|
32
|
-
limit?: number;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Search result in OpenAI Deep Research format
|
|
36
|
-
*/
|
|
37
|
-
export interface SearchResult {
|
|
38
|
-
id: string;
|
|
39
|
-
title: string;
|
|
40
|
-
url: string;
|
|
41
|
-
text: string;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Fetch result with document metadata
|
|
45
|
-
*/
|
|
46
|
-
export interface FetchResult {
|
|
47
|
-
id: string;
|
|
48
|
-
title: string;
|
|
49
|
-
url: string;
|
|
50
|
-
text: string;
|
|
51
|
-
metadata: {
|
|
52
|
-
database: string;
|
|
53
|
-
collection: string;
|
|
54
|
-
_id: string;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* MCP server interface exposed by the agent
|
|
59
|
-
*/
|
|
60
|
-
export interface McpServerLike {
|
|
61
|
-
listTools(): Promise<{
|
|
62
|
-
name: string;
|
|
63
|
-
description: string;
|
|
64
|
-
}[]>;
|
|
65
|
-
callTool(name: string, args: Record<string, unknown>): Promise<McpToolResponse>;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* File system interface exposed by the agent
|
|
69
|
-
*/
|
|
70
|
-
export interface FileSystemLike {
|
|
71
|
-
readFile(path: string): Promise<string>;
|
|
72
|
-
writeFile(path: string, content: string): Promise<void>;
|
|
73
|
-
deleteFile(path: string): Promise<boolean>;
|
|
74
|
-
exists(path: string): Promise<boolean>;
|
|
75
|
-
stat(path: string): Promise<{
|
|
76
|
-
type: string;
|
|
77
|
-
size: number;
|
|
78
|
-
} | null>;
|
|
79
|
-
readdir(path: string): Promise<string[]>;
|
|
80
|
-
mkdir(path: string): Promise<void>;
|
|
81
|
-
glob(pattern: string): Promise<string[]>;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Key-Value store interface exposed by the agent
|
|
85
|
-
*/
|
|
86
|
-
export interface KVStoreLike {
|
|
87
|
-
get<T>(key: string): Promise<T | null>;
|
|
88
|
-
set<T>(key: string, value: T): Promise<void>;
|
|
89
|
-
delete(key: string): Promise<boolean>;
|
|
90
|
-
has(key: string): Promise<boolean>;
|
|
91
|
-
keys(prefix?: string): Promise<string[]>;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Audit log interface exposed by the agent
|
|
95
|
-
*/
|
|
96
|
-
export interface AuditLogLike {
|
|
97
|
-
record(tool: string, inputs: unknown, outputs: unknown, durationMs?: number): Promise<string>;
|
|
98
|
-
list(options?: {
|
|
99
|
-
limit?: number;
|
|
100
|
-
offset?: number;
|
|
101
|
-
tool?: string;
|
|
102
|
-
}): Promise<{
|
|
103
|
-
id: string;
|
|
104
|
-
tool: string;
|
|
105
|
-
timestamp: Date;
|
|
106
|
-
}[]>;
|
|
107
|
-
count(): Promise<number>;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Configuration for creating a MonDoAgent
|
|
111
|
-
*/
|
|
112
|
-
export interface MonDoAgentConfig {
|
|
113
|
-
/** Unique agent identifier */
|
|
114
|
-
id?: string;
|
|
115
|
-
/** Database access for MCP tools */
|
|
116
|
-
dbAccess: DatabaseAccess;
|
|
117
|
-
/** Optional code loader for 'do' tool */
|
|
118
|
-
codeLoader?: CodeLoader;
|
|
119
|
-
/** Optional custom filesystem database */
|
|
120
|
-
fsDatabase?: AgentFSDatabase;
|
|
121
|
-
/** Optional custom KV storage backend */
|
|
122
|
-
kvBackend?: KVStorageBackend;
|
|
123
|
-
/** Optional custom audit storage backend */
|
|
124
|
-
auditBackend?: AuditBackend;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* MonDoAgent - AI Agent interface for mongo.do
|
|
128
|
-
*/
|
|
129
|
-
export interface MonDoAgent {
|
|
130
|
-
/** Agent identifier */
|
|
131
|
-
readonly id: string;
|
|
132
|
-
/** Access to MCP server for tool handling */
|
|
133
|
-
readonly mcp: McpServerLike;
|
|
134
|
-
/** Access to virtual filesystem */
|
|
135
|
-
readonly fs: FileSystemLike;
|
|
136
|
-
/** Access to key-value store */
|
|
137
|
-
readonly kv: KVStoreLike;
|
|
138
|
-
/** Access to tool call audit log */
|
|
139
|
-
readonly audit: AuditLogLike;
|
|
140
|
-
/**
|
|
141
|
-
* Execute a tool by name with given arguments
|
|
142
|
-
*/
|
|
143
|
-
execute<T = unknown>(toolName: string, args: Record<string, unknown>): Promise<ExecutionResult<T>>;
|
|
144
|
-
/**
|
|
145
|
-
* Execute code in the secure sandbox
|
|
146
|
-
*/
|
|
147
|
-
do(code: string, description?: string): Promise<ExecutionResult<unknown>>;
|
|
148
|
-
/**
|
|
149
|
-
* Search for documents
|
|
150
|
-
*/
|
|
151
|
-
search(query: string, options?: SearchOptions): Promise<SearchResult[]>;
|
|
152
|
-
/**
|
|
153
|
-
* Fetch a document by ID
|
|
154
|
-
*/
|
|
155
|
-
fetch(id: string): Promise<FetchResult | null>;
|
|
156
|
-
/**
|
|
157
|
-
* Dispose agent resources
|
|
158
|
-
*/
|
|
159
|
-
dispose(): Promise<void>;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Create a new MonDoAgent instance
|
|
163
|
-
*
|
|
164
|
-
* @param config - Agent configuration
|
|
165
|
-
* @returns MonDoAgent instance
|
|
166
|
-
*
|
|
167
|
-
* @example
|
|
168
|
-
* ```typescript
|
|
169
|
-
* const agent = createMonDoAgent({
|
|
170
|
-
* dbAccess: myDatabaseAccess,
|
|
171
|
-
* codeLoader: myCodeLoader,
|
|
172
|
-
* });
|
|
173
|
-
*
|
|
174
|
-
* // Execute code
|
|
175
|
-
* const result = await agent.do('return await db.collection("users").count()');
|
|
176
|
-
*
|
|
177
|
-
* // Search documents
|
|
178
|
-
* const results = await agent.search('users with admin role');
|
|
179
|
-
*
|
|
180
|
-
* // Use filesystem
|
|
181
|
-
* await agent.fs.writeFile('/data/output.json', JSON.stringify(data));
|
|
182
|
-
*
|
|
183
|
-
* // Use KV store
|
|
184
|
-
* await agent.kv.set('session-state', { step: 1 });
|
|
185
|
-
*
|
|
186
|
-
* // Clean up
|
|
187
|
-
* await agent.dispose();
|
|
188
|
-
* ```
|
|
189
|
-
*/
|
|
190
|
-
export declare function createMonDoAgent(config: MonDoAgentConfig): MonDoAgent;
|
|
191
|
-
export type { DatabaseAccess, CodeLoader, McpServerConfig };
|
|
192
|
-
//# sourceMappingURL=agent.d.ts.map
|