@revealui/ai 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/LICENSE.commercial +112 -0
- package/README.md +314 -0
- package/dist/a2a/card.d.ts +26 -0
- package/dist/a2a/card.d.ts.map +1 -0
- package/dist/a2a/card.js +173 -0
- package/dist/a2a/handler.d.ts +26 -0
- package/dist/a2a/handler.d.ts.map +1 -0
- package/dist/a2a/handler.js +170 -0
- package/dist/a2a/index.d.ts +10 -0
- package/dist/a2a/index.d.ts.map +1 -0
- package/dist/a2a/index.js +9 -0
- package/dist/a2a/task-store.d.ts +42 -0
- package/dist/a2a/task-store.d.ts.map +1 -0
- package/dist/a2a/task-store.js +99 -0
- package/dist/audit/emitter.d.ts +34 -0
- package/dist/audit/emitter.d.ts.map +1 -0
- package/dist/audit/emitter.js +34 -0
- package/dist/audit/index.d.ts +44 -0
- package/dist/audit/index.d.ts.map +1 -0
- package/dist/audit/index.js +48 -0
- package/dist/audit/observer.d.ts +108 -0
- package/dist/audit/observer.d.ts.map +1 -0
- package/dist/audit/observer.js +271 -0
- package/dist/audit/policy.d.ts +70 -0
- package/dist/audit/policy.d.ts.map +1 -0
- package/dist/audit/policy.js +209 -0
- package/dist/audit/store.d.ts +42 -0
- package/dist/audit/store.d.ts.map +1 -0
- package/dist/audit/store.js +80 -0
- package/dist/audit/types.d.ts +169 -0
- package/dist/audit/types.d.ts.map +1 -0
- package/dist/audit/types.js +80 -0
- package/dist/client/hooks/index.d.ts +22 -0
- package/dist/client/hooks/index.d.ts.map +1 -0
- package/dist/client/hooks/index.js +21 -0
- package/dist/client/hooks/useAgentContext.d.ts +30 -0
- package/dist/client/hooks/useAgentContext.d.ts.map +1 -0
- package/dist/client/hooks/useAgentContext.js +161 -0
- package/dist/client/hooks/useAgentEvents.d.ts +126 -0
- package/dist/client/hooks/useAgentEvents.d.ts.map +1 -0
- package/dist/client/hooks/useAgentEvents.js +232 -0
- package/dist/client/hooks/useAgentStream.d.ts +44 -0
- package/dist/client/hooks/useAgentStream.d.ts.map +1 -0
- package/dist/client/hooks/useAgentStream.js +101 -0
- package/dist/client/hooks/useEpisodicMemory.d.ts +25 -0
- package/dist/client/hooks/useEpisodicMemory.d.ts.map +1 -0
- package/dist/client/hooks/useEpisodicMemory.js +174 -0
- package/dist/client/hooks/useWorkingMemory.d.ts +57 -0
- package/dist/client/hooks/useWorkingMemory.d.ts.map +1 -0
- package/dist/client/hooks/useWorkingMemory.js +276 -0
- package/dist/client/index.d.ts +14 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +13 -0
- package/dist/embeddings/index.d.ts +51 -0
- package/dist/embeddings/index.d.ts.map +1 -0
- package/dist/embeddings/index.js +73 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +103 -0
- package/dist/inference/context-assembly.d.ts +27 -0
- package/dist/inference/context-assembly.d.ts.map +1 -0
- package/dist/inference/context-assembly.js +81 -0
- package/dist/inference/overflow-compressor.d.ts +17 -0
- package/dist/inference/overflow-compressor.d.ts.map +1 -0
- package/dist/inference/overflow-compressor.js +40 -0
- package/dist/inference/runRag.d.ts +35 -0
- package/dist/inference/runRag.d.ts.map +1 -0
- package/dist/inference/runRag.js +53 -0
- package/dist/ingestion/bm25.d.ts +29 -0
- package/dist/ingestion/bm25.d.ts.map +1 -0
- package/dist/ingestion/bm25.js +161 -0
- package/dist/ingestion/cms-indexer.d.ts +39 -0
- package/dist/ingestion/cms-indexer.d.ts.map +1 -0
- package/dist/ingestion/cms-indexer.js +74 -0
- package/dist/ingestion/file-parsers.d.ts +51 -0
- package/dist/ingestion/file-parsers.d.ts.map +1 -0
- package/dist/ingestion/file-parsers.js +247 -0
- package/dist/ingestion/hybrid-search.d.ts +22 -0
- package/dist/ingestion/hybrid-search.d.ts.map +1 -0
- package/dist/ingestion/hybrid-search.js +63 -0
- package/dist/ingestion/index.d.ts +9 -0
- package/dist/ingestion/index.d.ts.map +1 -0
- package/dist/ingestion/index.js +8 -0
- package/dist/ingestion/pipeline.d.ts +35 -0
- package/dist/ingestion/pipeline.d.ts.map +1 -0
- package/dist/ingestion/pipeline.js +114 -0
- package/dist/ingestion/rag-vector-service.d.ts +34 -0
- package/dist/ingestion/rag-vector-service.d.ts.map +1 -0
- package/dist/ingestion/rag-vector-service.js +98 -0
- package/dist/ingestion/reranker.d.ts +10 -0
- package/dist/ingestion/reranker.d.ts.map +1 -0
- package/dist/ingestion/reranker.js +41 -0
- package/dist/ingestion/text-splitter.d.ts +25 -0
- package/dist/ingestion/text-splitter.d.ts.map +1 -0
- package/dist/ingestion/text-splitter.js +119 -0
- package/dist/llm/cache-utils.d.ts +146 -0
- package/dist/llm/cache-utils.d.ts.map +1 -0
- package/dist/llm/cache-utils.js +204 -0
- package/dist/llm/client.d.ts +134 -0
- package/dist/llm/client.d.ts.map +1 -0
- package/dist/llm/client.js +497 -0
- package/dist/llm/key-validator.d.ts +25 -0
- package/dist/llm/key-validator.d.ts.map +1 -0
- package/dist/llm/key-validator.js +101 -0
- package/dist/llm/provider-health.d.ts +40 -0
- package/dist/llm/provider-health.d.ts.map +1 -0
- package/dist/llm/provider-health.js +97 -0
- package/dist/llm/providers/anthropic.d.ts +31 -0
- package/dist/llm/providers/anthropic.d.ts.map +1 -0
- package/dist/llm/providers/anthropic.js +248 -0
- package/dist/llm/providers/base.d.ts +111 -0
- package/dist/llm/providers/base.d.ts.map +1 -0
- package/dist/llm/providers/base.js +6 -0
- package/dist/llm/providers/groq.d.ts +23 -0
- package/dist/llm/providers/groq.d.ts.map +1 -0
- package/dist/llm/providers/groq.js +27 -0
- package/dist/llm/providers/ollama.d.ts +27 -0
- package/dist/llm/providers/ollama.d.ts.map +1 -0
- package/dist/llm/providers/ollama.js +48 -0
- package/dist/llm/providers/openai.d.ts +19 -0
- package/dist/llm/providers/openai.d.ts.map +1 -0
- package/dist/llm/providers/openai.js +245 -0
- package/dist/llm/providers/vultr.d.ts +18 -0
- package/dist/llm/providers/vultr.d.ts.map +1 -0
- package/dist/llm/providers/vultr.js +168 -0
- package/dist/llm/response-cache.d.ts +166 -0
- package/dist/llm/response-cache.d.ts.map +1 -0
- package/dist/llm/response-cache.js +233 -0
- package/dist/llm/semantic-cache.d.ts +179 -0
- package/dist/llm/semantic-cache.d.ts.map +1 -0
- package/dist/llm/semantic-cache.js +306 -0
- package/dist/llm/server.d.ts +14 -0
- package/dist/llm/server.d.ts.map +1 -0
- package/dist/llm/server.js +15 -0
- package/dist/llm/token-counter.d.ts +48 -0
- package/dist/llm/token-counter.d.ts.map +1 -0
- package/dist/llm/token-counter.js +77 -0
- package/dist/llm/workspace-provider-config.d.ts +38 -0
- package/dist/llm/workspace-provider-config.d.ts.map +1 -0
- package/dist/llm/workspace-provider-config.js +47 -0
- package/dist/memory/agent/context-manager.d.ts +148 -0
- package/dist/memory/agent/context-manager.d.ts.map +1 -0
- package/dist/memory/agent/context-manager.js +284 -0
- package/dist/memory/agent/index.d.ts +7 -0
- package/dist/memory/agent/index.d.ts.map +1 -0
- package/dist/memory/agent/index.js +6 -0
- package/dist/memory/crdt/index.d.ts +13 -0
- package/dist/memory/crdt/index.d.ts.map +1 -0
- package/dist/memory/crdt/index.js +12 -0
- package/dist/memory/crdt/lww-register.d.ts +108 -0
- package/dist/memory/crdt/lww-register.d.ts.map +1 -0
- package/dist/memory/crdt/lww-register.js +169 -0
- package/dist/memory/crdt/or-set.d.ts +141 -0
- package/dist/memory/crdt/or-set.d.ts.map +1 -0
- package/dist/memory/crdt/or-set.js +291 -0
- package/dist/memory/crdt/pn-counter.d.ts +116 -0
- package/dist/memory/crdt/pn-counter.d.ts.map +1 -0
- package/dist/memory/crdt/pn-counter.js +174 -0
- package/dist/memory/crdt/vector-clock.d.ts +115 -0
- package/dist/memory/crdt/vector-clock.d.ts.map +1 -0
- package/dist/memory/crdt/vector-clock.js +179 -0
- package/dist/memory/errors/index.d.ts +56 -0
- package/dist/memory/errors/index.d.ts.map +1 -0
- package/dist/memory/errors/index.js +85 -0
- package/dist/memory/index.d.ts +21 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +20 -0
- package/dist/memory/persistence/crdt-persistence.d.ts +85 -0
- package/dist/memory/persistence/crdt-persistence.d.ts.map +1 -0
- package/dist/memory/persistence/crdt-persistence.js +204 -0
- package/dist/memory/persistence/index.d.ts +7 -0
- package/dist/memory/persistence/index.d.ts.map +1 -0
- package/dist/memory/persistence/index.js +6 -0
- package/dist/memory/preferences/index.d.ts +7 -0
- package/dist/memory/preferences/index.d.ts.map +1 -0
- package/dist/memory/preferences/index.js +6 -0
- package/dist/memory/preferences/user-preferences-manager.d.ts +133 -0
- package/dist/memory/preferences/user-preferences-manager.d.ts.map +1 -0
- package/dist/memory/preferences/user-preferences-manager.js +342 -0
- package/dist/memory/services/index.d.ts +8 -0
- package/dist/memory/services/index.d.ts.map +1 -0
- package/dist/memory/services/index.js +6 -0
- package/dist/memory/services/node-id-service.d.ts +75 -0
- package/dist/memory/services/node-id-service.d.ts.map +1 -0
- package/dist/memory/services/node-id-service.js +190 -0
- package/dist/memory/stores/episodic-memory.d.ts +182 -0
- package/dist/memory/stores/episodic-memory.d.ts.map +1 -0
- package/dist/memory/stores/episodic-memory.js +378 -0
- package/dist/memory/stores/index.d.ts +16 -0
- package/dist/memory/stores/index.d.ts.map +1 -0
- package/dist/memory/stores/index.js +15 -0
- package/dist/memory/stores/procedural-memory.d.ts +89 -0
- package/dist/memory/stores/procedural-memory.d.ts.map +1 -0
- package/dist/memory/stores/procedural-memory.js +152 -0
- package/dist/memory/stores/semantic-memory.d.ts +92 -0
- package/dist/memory/stores/semantic-memory.d.ts.map +1 -0
- package/dist/memory/stores/semantic-memory.js +155 -0
- package/dist/memory/stores/working-memory.d.ts +225 -0
- package/dist/memory/stores/working-memory.d.ts.map +1 -0
- package/dist/memory/stores/working-memory.js +336 -0
- package/dist/memory/utils/deep-clone.d.ts +10 -0
- package/dist/memory/utils/deep-clone.d.ts.map +1 -0
- package/dist/memory/utils/deep-clone.js +9 -0
- package/dist/memory/utils/index.d.ts +8 -0
- package/dist/memory/utils/index.d.ts.map +1 -0
- package/dist/memory/utils/index.js +7 -0
- package/dist/memory/utils/logger.d.ts +21 -0
- package/dist/memory/utils/logger.d.ts.map +1 -0
- package/dist/memory/utils/logger.js +62 -0
- package/dist/memory/utils/sql-helpers.d.ts +97 -0
- package/dist/memory/utils/sql-helpers.d.ts.map +1 -0
- package/dist/memory/utils/sql-helpers.js +214 -0
- package/dist/memory/utils/validation.d.ts +62 -0
- package/dist/memory/utils/validation.d.ts.map +1 -0
- package/dist/memory/utils/validation.js +244 -0
- package/dist/memory/vector/index.d.ts +12 -0
- package/dist/memory/vector/index.d.ts.map +1 -0
- package/dist/memory/vector/index.js +14 -0
- package/dist/memory/vector/vector-memory-service.d.ts +88 -0
- package/dist/memory/vector/vector-memory-service.d.ts.map +1 -0
- package/dist/memory/vector/vector-memory-service.js +335 -0
- package/dist/observability/logger.d.ts +79 -0
- package/dist/observability/logger.d.ts.map +1 -0
- package/dist/observability/logger.js +165 -0
- package/dist/observability/metrics.d.ts +43 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +197 -0
- package/dist/observability/query.d.ts +150 -0
- package/dist/observability/query.d.ts.map +1 -0
- package/dist/observability/query.js +339 -0
- package/dist/observability/types.d.ts +140 -0
- package/dist/observability/types.d.ts.map +1 -0
- package/dist/observability/types.js +6 -0
- package/dist/orchestration/agent.d.ts +98 -0
- package/dist/orchestration/agent.d.ts.map +1 -0
- package/dist/orchestration/agent.js +6 -0
- package/dist/orchestration/defaults.d.ts +21 -0
- package/dist/orchestration/defaults.d.ts.map +1 -0
- package/dist/orchestration/defaults.js +22 -0
- package/dist/orchestration/memory-integration.d.ts +58 -0
- package/dist/orchestration/memory-integration.d.ts.map +1 -0
- package/dist/orchestration/memory-integration.js +130 -0
- package/dist/orchestration/orchestrator.d.ts +67 -0
- package/dist/orchestration/orchestrator.d.ts.map +1 -0
- package/dist/orchestration/orchestrator.js +174 -0
- package/dist/orchestration/runtime.d.ts +82 -0
- package/dist/orchestration/runtime.d.ts.map +1 -0
- package/dist/orchestration/runtime.js +251 -0
- package/dist/orchestration/streaming-runtime.d.ts +36 -0
- package/dist/orchestration/streaming-runtime.d.ts.map +1 -0
- package/dist/orchestration/streaming-runtime.js +175 -0
- package/dist/orchestration/ticket-agent.d.ts +70 -0
- package/dist/orchestration/ticket-agent.d.ts.map +1 -0
- package/dist/orchestration/ticket-agent.js +146 -0
- package/dist/skills/activation/index.d.ts +7 -0
- package/dist/skills/activation/index.d.ts.map +1 -0
- package/dist/skills/activation/index.js +6 -0
- package/dist/skills/activation/skill-activator.d.ts +68 -0
- package/dist/skills/activation/skill-activator.d.ts.map +1 -0
- package/dist/skills/activation/skill-activator.js +224 -0
- package/dist/skills/catalog/catalog-search.d.ts +55 -0
- package/dist/skills/catalog/catalog-search.d.ts.map +1 -0
- package/dist/skills/catalog/catalog-search.js +111 -0
- package/dist/skills/catalog/catalog-types.d.ts +81 -0
- package/dist/skills/catalog/catalog-types.d.ts.map +1 -0
- package/dist/skills/catalog/catalog-types.js +66 -0
- package/dist/skills/catalog/index.d.ts +9 -0
- package/dist/skills/catalog/index.d.ts.map +1 -0
- package/dist/skills/catalog/index.js +7 -0
- package/dist/skills/catalog/vercel-catalog.d.ts +42 -0
- package/dist/skills/catalog/vercel-catalog.d.ts.map +1 -0
- package/dist/skills/catalog/vercel-catalog.js +189 -0
- package/dist/skills/compat/index.d.ts +9 -0
- package/dist/skills/compat/index.d.ts.map +1 -0
- package/dist/skills/compat/index.js +8 -0
- package/dist/skills/compat/skill-enhancer.d.ts +37 -0
- package/dist/skills/compat/skill-enhancer.d.ts.map +1 -0
- package/dist/skills/compat/skill-enhancer.js +76 -0
- package/dist/skills/compat/tool-mapper.d.ts +61 -0
- package/dist/skills/compat/tool-mapper.d.ts.map +1 -0
- package/dist/skills/compat/tool-mapper.js +168 -0
- package/dist/skills/compat/vercel-compat.d.ts +33 -0
- package/dist/skills/compat/vercel-compat.d.ts.map +1 -0
- package/dist/skills/compat/vercel-compat.js +132 -0
- package/dist/skills/index.d.ts +40 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +47 -0
- package/dist/skills/integration/agent-skill-provider.d.ts +94 -0
- package/dist/skills/integration/agent-skill-provider.d.ts.map +1 -0
- package/dist/skills/integration/agent-skill-provider.js +161 -0
- package/dist/skills/integration/index.d.ts +7 -0
- package/dist/skills/integration/index.d.ts.map +1 -0
- package/dist/skills/integration/index.js +6 -0
- package/dist/skills/loader/github-loader.d.ts +61 -0
- package/dist/skills/loader/github-loader.d.ts.map +1 -0
- package/dist/skills/loader/github-loader.js +176 -0
- package/dist/skills/loader/index.d.ts +10 -0
- package/dist/skills/loader/index.d.ts.map +1 -0
- package/dist/skills/loader/index.js +9 -0
- package/dist/skills/loader/local-loader.d.ts +56 -0
- package/dist/skills/loader/local-loader.d.ts.map +1 -0
- package/dist/skills/loader/local-loader.js +186 -0
- package/dist/skills/loader/vercel-loader.d.ts +64 -0
- package/dist/skills/loader/vercel-loader.d.ts.map +1 -0
- package/dist/skills/loader/vercel-loader.js +313 -0
- package/dist/skills/loader/vercel-types.d.ts +64 -0
- package/dist/skills/loader/vercel-types.d.ts.map +1 -0
- package/dist/skills/loader/vercel-types.js +55 -0
- package/dist/skills/parser/index.d.ts +7 -0
- package/dist/skills/parser/index.d.ts.map +1 -0
- package/dist/skills/parser/index.js +6 -0
- package/dist/skills/parser/skill-md-parser.d.ts +64 -0
- package/dist/skills/parser/skill-md-parser.d.ts.map +1 -0
- package/dist/skills/parser/skill-md-parser.js +242 -0
- package/dist/skills/registry/index.d.ts +7 -0
- package/dist/skills/registry/index.d.ts.map +1 -0
- package/dist/skills/registry/index.js +6 -0
- package/dist/skills/registry/skill-registry.d.ts +133 -0
- package/dist/skills/registry/skill-registry.d.ts.map +1 -0
- package/dist/skills/registry/skill-registry.js +373 -0
- package/dist/skills/types.d.ts +216 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +176 -0
- package/dist/templates/agent-spec.d.ts +138 -0
- package/dist/templates/agent-spec.d.ts.map +1 -0
- package/dist/templates/agent-spec.js +138 -0
- package/dist/templates/index.d.ts +56 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +58 -0
- package/dist/templates/prompt-spec.d.ts +140 -0
- package/dist/templates/prompt-spec.d.ts.map +1 -0
- package/dist/templates/prompt-spec.js +210 -0
- package/dist/templates/skill-spec.d.ts +106 -0
- package/dist/templates/skill-spec.d.ts.map +1 -0
- package/dist/templates/skill-spec.js +119 -0
- package/dist/tools/base.d.ts +74 -0
- package/dist/tools/base.d.ts.map +1 -0
- package/dist/tools/base.js +6 -0
- package/dist/tools/cms/collection-tools.d.ts +36 -0
- package/dist/tools/cms/collection-tools.d.ts.map +1 -0
- package/dist/tools/cms/collection-tools.js +178 -0
- package/dist/tools/cms/factory.d.ts +89 -0
- package/dist/tools/cms/factory.d.ts.map +1 -0
- package/dist/tools/cms/factory.js +462 -0
- package/dist/tools/cms/global-tools.d.ts +21 -0
- package/dist/tools/cms/global-tools.d.ts.map +1 -0
- package/dist/tools/cms/global-tools.js +92 -0
- package/dist/tools/cms/index.d.ts +11 -0
- package/dist/tools/cms/index.d.ts.map +1 -0
- package/dist/tools/cms/index.js +11 -0
- package/dist/tools/cms/media-tools.d.ts +31 -0
- package/dist/tools/cms/media-tools.d.ts.map +1 -0
- package/dist/tools/cms/media-tools.js +140 -0
- package/dist/tools/cms/user-tools.d.ts +31 -0
- package/dist/tools/cms/user-tools.d.ts.map +1 -0
- package/dist/tools/cms/user-tools.js +135 -0
- package/dist/tools/deduplicator.d.ts +19 -0
- package/dist/tools/deduplicator.d.ts.map +1 -0
- package/dist/tools/deduplicator.js +53 -0
- package/dist/tools/document-summarizer.d.ts +11 -0
- package/dist/tools/document-summarizer.d.ts.map +1 -0
- package/dist/tools/document-summarizer.js +82 -0
- package/dist/tools/mcp-adapter.d.ts +66 -0
- package/dist/tools/mcp-adapter.d.ts.map +1 -0
- package/dist/tools/mcp-adapter.js +152 -0
- package/dist/tools/memory/index.d.ts +3 -0
- package/dist/tools/memory/index.d.ts.map +1 -0
- package/dist/tools/memory/index.js +1 -0
- package/dist/tools/memory/store-memory.d.ts +39 -0
- package/dist/tools/memory/store-memory.d.ts.map +1 -0
- package/dist/tools/memory/store-memory.js +94 -0
- package/dist/tools/registry.d.ts +14 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +48 -0
- package/dist/tools/ticket-tools.d.ts +31 -0
- package/dist/tools/ticket-tools.d.ts.map +1 -0
- package/dist/tools/ticket-tools.js +74 -0
- package/dist/tools/web/duck-duck-go.d.ts +52 -0
- package/dist/tools/web/duck-duck-go.d.ts.map +1 -0
- package/dist/tools/web/duck-duck-go.js +202 -0
- package/dist/tools/web/exa.d.ts +34 -0
- package/dist/tools/web/exa.d.ts.map +1 -0
- package/dist/tools/web/exa.js +80 -0
- package/dist/tools/web/index.d.ts +6 -0
- package/dist/tools/web/index.d.ts.map +1 -0
- package/dist/tools/web/index.js +4 -0
- package/dist/tools/web/scraper.d.ts +9 -0
- package/dist/tools/web/scraper.d.ts.map +1 -0
- package/dist/tools/web/scraper.js +118 -0
- package/dist/tools/web/tavily.d.ts +32 -0
- package/dist/tools/web/tavily.d.ts.map +1 -0
- package/dist/tools/web/tavily.js +73 -0
- package/dist/tools/web/types.d.ts +31 -0
- package/dist/tools/web/types.d.ts.map +1 -0
- package/dist/tools/web/types.js +9 -0
- package/package.json +143 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Adapter
|
|
3
|
+
*
|
|
4
|
+
* Bridges MCP (Model Context Protocol) servers to the tool system
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod/v4';
|
|
7
|
+
/**
|
|
8
|
+
* Create a Tool from an MCP tool definition
|
|
9
|
+
*/
|
|
10
|
+
export function createToolFromMCP(mcpTool, mcpClient) {
|
|
11
|
+
// Convert JSON Schema to Zod schema (simplified)
|
|
12
|
+
const zodSchema = jsonSchemaToZod(mcpTool.inputSchema);
|
|
13
|
+
return {
|
|
14
|
+
name: mcpTool.name,
|
|
15
|
+
description: mcpTool.description,
|
|
16
|
+
parameters: zodSchema,
|
|
17
|
+
execute: async (params) => {
|
|
18
|
+
try {
|
|
19
|
+
const result = await mcpClient.callTool(mcpTool.name, params);
|
|
20
|
+
return {
|
|
21
|
+
success: true,
|
|
22
|
+
data: result,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
return {
|
|
27
|
+
success: false,
|
|
28
|
+
error: error instanceof Error ? error.message : String(error),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Register all MCP tools in the registry
|
|
36
|
+
*/
|
|
37
|
+
export async function registerMCPTools(mcpClient, registry) {
|
|
38
|
+
const tools = await mcpClient.listTools();
|
|
39
|
+
for (const mcpTool of tools) {
|
|
40
|
+
const tool = createToolFromMCP(mcpTool, mcpClient);
|
|
41
|
+
registry.register(tool);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Serialize an MCP tool result safely:
|
|
46
|
+
* - bigint values → string (JSON.stringify fails on bigint)
|
|
47
|
+
* - Circular references → replaced with "[Circular]"
|
|
48
|
+
*/
|
|
49
|
+
export function serializeMCPResult(value) {
|
|
50
|
+
const seen = new WeakSet();
|
|
51
|
+
function replacer(_key, val) {
|
|
52
|
+
if (typeof val === 'bigint')
|
|
53
|
+
return val.toString();
|
|
54
|
+
if (typeof val === 'object' && val !== null) {
|
|
55
|
+
if (seen.has(val))
|
|
56
|
+
return '[Circular]';
|
|
57
|
+
seen.add(val);
|
|
58
|
+
}
|
|
59
|
+
return val;
|
|
60
|
+
}
|
|
61
|
+
return JSON.parse(JSON.stringify(value, replacer));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Discover all tools from a running MCPHypervisor (or any MCPToolSource)
|
|
65
|
+
* and return them as RevealUI Tool instances.
|
|
66
|
+
*
|
|
67
|
+
* Tool names use the hypervisor's namespacing (@@mcp_{server}_{tool}) so
|
|
68
|
+
* collisions across servers are impossible.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* import { MCPHypervisor } from '@revealui/mcp'
|
|
73
|
+
* import { discoverMCPTools } from '@revealui/ai'
|
|
74
|
+
*
|
|
75
|
+
* const hypervisor = MCPHypervisor.getInstance()
|
|
76
|
+
* const tools = discoverMCPTools(hypervisor)
|
|
77
|
+
* agent.tools.push(...tools)
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export function discoverMCPTools(source) {
|
|
81
|
+
return source.getAllTools().map(({ namespacedName, serverName, tool }) => {
|
|
82
|
+
const zodSchema = jsonSchemaToZod(tool.inputSchema);
|
|
83
|
+
const agentTool = {
|
|
84
|
+
name: namespacedName,
|
|
85
|
+
description: tool.description,
|
|
86
|
+
parameters: zodSchema,
|
|
87
|
+
async execute(params) {
|
|
88
|
+
// Validate params against the schema
|
|
89
|
+
const validated = zodSchema.parse(params);
|
|
90
|
+
try {
|
|
91
|
+
const callResult = await source.callTool(serverName, tool.name, validated);
|
|
92
|
+
return {
|
|
93
|
+
success: true,
|
|
94
|
+
data: serializeMCPResult(callResult),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
return {
|
|
99
|
+
success: false,
|
|
100
|
+
error: error instanceof Error ? error.message : String(error),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
getMetadata() {
|
|
105
|
+
return { category: 'mcp', version: '1.0.0' };
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
return agentTool;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Convert JSON Schema to Zod schema (simplified version)
|
|
113
|
+
* For production, use a proper library like json-schema-to-zod
|
|
114
|
+
*/
|
|
115
|
+
function jsonSchemaToZod(schema) {
|
|
116
|
+
if (schema.type !== 'object') {
|
|
117
|
+
return z.unknown();
|
|
118
|
+
}
|
|
119
|
+
const shape = {};
|
|
120
|
+
if (schema.properties) {
|
|
121
|
+
for (const [key, prop] of Object.entries(schema.properties)) {
|
|
122
|
+
const propSchema = prop;
|
|
123
|
+
let zodType;
|
|
124
|
+
switch (propSchema.type) {
|
|
125
|
+
case 'string':
|
|
126
|
+
zodType = z.string();
|
|
127
|
+
break;
|
|
128
|
+
case 'number':
|
|
129
|
+
case 'integer':
|
|
130
|
+
zodType = z.number();
|
|
131
|
+
break;
|
|
132
|
+
case 'boolean':
|
|
133
|
+
zodType = z.boolean();
|
|
134
|
+
break;
|
|
135
|
+
case 'array':
|
|
136
|
+
zodType = z.array(z.unknown());
|
|
137
|
+
break;
|
|
138
|
+
case 'object':
|
|
139
|
+
zodType = z.record(z.string(), z.unknown());
|
|
140
|
+
break;
|
|
141
|
+
default:
|
|
142
|
+
zodType = z.unknown();
|
|
143
|
+
}
|
|
144
|
+
// Make optional if not in required array
|
|
145
|
+
if (!schema.required?.includes(key)) {
|
|
146
|
+
zodType = zodType.optional();
|
|
147
|
+
}
|
|
148
|
+
shape[key] = zodType;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return z.object(shape);
|
|
152
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/memory/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createStoreMemoryTool } from './store-memory.js';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store Memory Tool
|
|
3
|
+
*
|
|
4
|
+
* Explicit memory storage tool that agents must call to persist information
|
|
5
|
+
* to long-term episodic memory. Agents are never auto-enrolled into memory
|
|
6
|
+
* writes — they must invoke this tool with a clear reason.
|
|
7
|
+
*
|
|
8
|
+
* GDPR rationale: Requiring explicit intent aligns with the data minimisation
|
|
9
|
+
* principle (GDPR Art. 5(1)(c)) and purpose limitation principle (Art. 5(1)(b)).
|
|
10
|
+
* Only information an agent actively decides to store is persisted.
|
|
11
|
+
*
|
|
12
|
+
* See AgentMemoryIntegrationConfig.requireExplicitStore for the gate that
|
|
13
|
+
* blocks auto-writes at the integration layer.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod/v4';
|
|
16
|
+
import type { EpisodicMemory } from '../../memory/stores/episodic-memory.js';
|
|
17
|
+
import type { Tool } from '../base.js';
|
|
18
|
+
declare const StoreMemoryParamsSchema: z.ZodObject<{
|
|
19
|
+
content: z.ZodString;
|
|
20
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
21
|
+
reason: z.ZodString;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export type StoreMemoryParams = z.infer<typeof StoreMemoryParamsSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Create an explicit store-memory tool bound to an EpisodicMemory instance.
|
|
26
|
+
*
|
|
27
|
+
* Agents must call this tool to persist information. Auto-store via
|
|
28
|
+
* AgentMemoryIntegration.storeContext() is blocked when
|
|
29
|
+
* `requireExplicitStore: true` (default).
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const tool = createStoreMemoryTool(episodicMemory, agent.id)
|
|
34
|
+
* agent.tools.push(tool)
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function createStoreMemoryTool(memory: EpisodicMemory, agentId: string): Tool;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=store-memory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-memory.d.ts","sourceRoot":"","sources":["../../../src/tools/memory/store-memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAA;AAElD,QAAA,MAAM,uBAAuB;;;;iBAI3B,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAEvE;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAkEnF"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Store Memory Tool
|
|
3
|
+
*
|
|
4
|
+
* Explicit memory storage tool that agents must call to persist information
|
|
5
|
+
* to long-term episodic memory. Agents are never auto-enrolled into memory
|
|
6
|
+
* writes — they must invoke this tool with a clear reason.
|
|
7
|
+
*
|
|
8
|
+
* GDPR rationale: Requiring explicit intent aligns with the data minimisation
|
|
9
|
+
* principle (GDPR Art. 5(1)(c)) and purpose limitation principle (Art. 5(1)(b)).
|
|
10
|
+
* Only information an agent actively decides to store is persisted.
|
|
11
|
+
*
|
|
12
|
+
* See AgentMemoryIntegrationConfig.requireExplicitStore for the gate that
|
|
13
|
+
* blocks auto-writes at the integration layer.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod/v4';
|
|
16
|
+
const StoreMemoryParamsSchema = z.object({
|
|
17
|
+
content: z.string().min(1).describe('The information to store in long-term memory'),
|
|
18
|
+
tags: z.array(z.string()).optional().describe('Optional tags to categorize the memory'),
|
|
19
|
+
reason: z.string().min(1).describe('Why this information should be remembered across sessions'),
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Create an explicit store-memory tool bound to an EpisodicMemory instance.
|
|
23
|
+
*
|
|
24
|
+
* Agents must call this tool to persist information. Auto-store via
|
|
25
|
+
* AgentMemoryIntegration.storeContext() is blocked when
|
|
26
|
+
* `requireExplicitStore: true` (default).
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const tool = createStoreMemoryTool(episodicMemory, agent.id)
|
|
31
|
+
* agent.tools.push(tool)
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export function createStoreMemoryTool(memory, agentId) {
|
|
35
|
+
return {
|
|
36
|
+
name: 'store_memory',
|
|
37
|
+
description: 'Explicitly store important information in long-term memory for future sessions. ' +
|
|
38
|
+
'Only call this when information is genuinely valuable to retain. ' +
|
|
39
|
+
'Provide a clear reason — this is required for privacy compliance.',
|
|
40
|
+
parameters: StoreMemoryParamsSchema,
|
|
41
|
+
async execute(params) {
|
|
42
|
+
const { content, tags, reason } = StoreMemoryParamsSchema.parse(params);
|
|
43
|
+
try {
|
|
44
|
+
const memoryId = `explicit-${agentId}-${Date.now()}`;
|
|
45
|
+
const memoryEntry = {
|
|
46
|
+
id: memoryId,
|
|
47
|
+
version: 1,
|
|
48
|
+
content,
|
|
49
|
+
type: 'fact',
|
|
50
|
+
source: {
|
|
51
|
+
type: 'agent',
|
|
52
|
+
id: agentId,
|
|
53
|
+
confidence: 1,
|
|
54
|
+
},
|
|
55
|
+
metadata: {
|
|
56
|
+
importance: 0.7,
|
|
57
|
+
agentId,
|
|
58
|
+
storeReason: reason,
|
|
59
|
+
explicit: true,
|
|
60
|
+
...(tags && tags.length > 0 && { tags }),
|
|
61
|
+
},
|
|
62
|
+
createdAt: new Date().toISOString(),
|
|
63
|
+
accessedAt: new Date().toISOString(),
|
|
64
|
+
accessCount: 0,
|
|
65
|
+
verified: false,
|
|
66
|
+
};
|
|
67
|
+
await memory.add(memoryEntry);
|
|
68
|
+
await memory.save();
|
|
69
|
+
return {
|
|
70
|
+
success: true,
|
|
71
|
+
data: {
|
|
72
|
+
stored: true,
|
|
73
|
+
memoryId,
|
|
74
|
+
message: `Memory stored: "${content.length > 80 ? `${content.substring(0, 80)}…` : content}"`,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
return {
|
|
80
|
+
success: false,
|
|
81
|
+
error: `Failed to store memory: ${error instanceof Error ? error.message : String(error)}`,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
getMetadata() {
|
|
86
|
+
return {
|
|
87
|
+
category: 'memory',
|
|
88
|
+
version: '1.0.0',
|
|
89
|
+
author: 'RevealUI',
|
|
90
|
+
gdprAligned: true,
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ToolDefinition } from '../llm/providers/base.js';
|
|
2
|
+
import type { Tool, ToolResult } from './base.js';
|
|
3
|
+
export declare class ToolRegistry {
|
|
4
|
+
private tools;
|
|
5
|
+
register(tool: Tool): void;
|
|
6
|
+
unregister(name: string): void;
|
|
7
|
+
get(name: string): Tool | undefined;
|
|
8
|
+
getAll(): Tool[];
|
|
9
|
+
has(name: string): boolean;
|
|
10
|
+
getToolDefinitions(): ToolDefinition[];
|
|
11
|
+
execute(name: string, params: unknown): Promise<ToolResult>;
|
|
12
|
+
}
|
|
13
|
+
export declare const globalToolRegistry: ToolRegistry;
|
|
14
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEjD,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAA+B;IAE5C,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAO1B,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI9B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAInC,MAAM,IAAI,IAAI,EAAE;IAIhB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,kBAAkB,IAAI,cAAc,EAAE;IAWhC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;CAgBlE;AAED,eAAO,MAAM,kBAAkB,cAAqB,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export class ToolRegistry {
|
|
2
|
+
tools = new Map();
|
|
3
|
+
register(tool) {
|
|
4
|
+
if (this.tools.has(tool.name)) {
|
|
5
|
+
throw new Error(`Tool with name "${tool.name}" is already registered`);
|
|
6
|
+
}
|
|
7
|
+
this.tools.set(tool.name, tool);
|
|
8
|
+
}
|
|
9
|
+
unregister(name) {
|
|
10
|
+
this.tools.delete(name);
|
|
11
|
+
}
|
|
12
|
+
get(name) {
|
|
13
|
+
return this.tools.get(name);
|
|
14
|
+
}
|
|
15
|
+
getAll() {
|
|
16
|
+
return Array.from(this.tools.values());
|
|
17
|
+
}
|
|
18
|
+
has(name) {
|
|
19
|
+
return this.tools.has(name);
|
|
20
|
+
}
|
|
21
|
+
getToolDefinitions() {
|
|
22
|
+
return Array.from(this.tools.values()).map((tool) => ({
|
|
23
|
+
type: 'function',
|
|
24
|
+
function: {
|
|
25
|
+
name: tool.name,
|
|
26
|
+
description: tool.description,
|
|
27
|
+
parameters: tool.parameters.toJSONSchema(), // Native Zod v4 method
|
|
28
|
+
},
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
async execute(name, params) {
|
|
32
|
+
const tool = this.tools.get(name);
|
|
33
|
+
if (!tool) {
|
|
34
|
+
return { success: false, error: `Tool "${name}" not found` };
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const validatedParams = tool.parameters.parse(params);
|
|
38
|
+
return await tool.execute(validatedParams);
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
return {
|
|
42
|
+
success: false,
|
|
43
|
+
error: `Parameter validation failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export const globalToolRegistry = new ToolRegistry();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ticket Mutation Tools
|
|
3
|
+
*
|
|
4
|
+
* Tools that allow an agent to update ticket state as it works —
|
|
5
|
+
* closing a ticket when done, moving it between columns, and writing
|
|
6
|
+
* its results back as a comment.
|
|
7
|
+
*
|
|
8
|
+
* These are injected by createTicketTools() and are always paired with
|
|
9
|
+
* CMS tools so agents can act on content AND report back through the ticket.
|
|
10
|
+
*/
|
|
11
|
+
import type { Tool } from './base.js';
|
|
12
|
+
/**
|
|
13
|
+
* Minimal interface for ticket mutations an agent can perform.
|
|
14
|
+
* Matches the subset of ticketQueries used in the tickets route.
|
|
15
|
+
*/
|
|
16
|
+
export interface TicketMutationClient {
|
|
17
|
+
updateTicket(ticketId: string, data: {
|
|
18
|
+
status?: string;
|
|
19
|
+
columnId?: string;
|
|
20
|
+
metadata?: Record<string, unknown>;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
id: string;
|
|
23
|
+
status: string;
|
|
24
|
+
} | null>;
|
|
25
|
+
createComment(ticketId: string, body: Record<string, unknown>): Promise<{
|
|
26
|
+
id: string;
|
|
27
|
+
ticketId: string;
|
|
28
|
+
} | null | undefined>;
|
|
29
|
+
}
|
|
30
|
+
export declare function createTicketTools(ticketId: string, client: TicketMutationClient): Tool[];
|
|
31
|
+
//# sourceMappingURL=ticket-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ticket-tools.d.ts","sourceRoot":"","sources":["../../src/tools/ticket-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,WAAW,CAAA;AAEjD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,YAAY,CACV,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE;QACJ,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KACnC,GACA,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC,CAAA;IAEjD,aAAa,CACX,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;CAChE;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,GAAG,IAAI,EAAE,CAgExF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ticket Mutation Tools
|
|
3
|
+
*
|
|
4
|
+
* Tools that allow an agent to update ticket state as it works —
|
|
5
|
+
* closing a ticket when done, moving it between columns, and writing
|
|
6
|
+
* its results back as a comment.
|
|
7
|
+
*
|
|
8
|
+
* These are injected by createTicketTools() and are always paired with
|
|
9
|
+
* CMS tools so agents can act on content AND report back through the ticket.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod/v4';
|
|
12
|
+
export function createTicketTools(ticketId, client) {
|
|
13
|
+
const updateStatusTool = {
|
|
14
|
+
name: 'update_ticket_status',
|
|
15
|
+
description: 'Update the status of the current ticket. Call this when work is complete (status="done") or if you cannot proceed (status="blocked"). Valid statuses: open, in_progress, done, blocked, cancelled.',
|
|
16
|
+
parameters: z.object({
|
|
17
|
+
status: z.enum(['open', 'in_progress', 'done', 'blocked', 'cancelled']),
|
|
18
|
+
reason: z.string().optional().describe('Brief reason for the status change'),
|
|
19
|
+
}),
|
|
20
|
+
async execute(params) {
|
|
21
|
+
const { status, reason } = params;
|
|
22
|
+
try {
|
|
23
|
+
const metadata = reason ? { agentStatusReason: reason } : {};
|
|
24
|
+
const ticket = await client.updateTicket(ticketId, { status, metadata });
|
|
25
|
+
if (!ticket) {
|
|
26
|
+
return { success: false, error: `Ticket ${ticketId} not found` };
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
success: true,
|
|
30
|
+
data: { ticketId: ticket.id, status: ticket.status },
|
|
31
|
+
metadata: { message: `Ticket status updated to "${status}"` },
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
success: false,
|
|
37
|
+
error: `Failed to update ticket status: ${error instanceof Error ? error.message : String(error)}`,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const addCommentTool = {
|
|
43
|
+
name: 'add_ticket_comment',
|
|
44
|
+
description: 'Write a comment on the current ticket. Use this to report what you did, what changed in the CMS, or why you could not complete the task.',
|
|
45
|
+
parameters: z.object({
|
|
46
|
+
text: z.string().min(1).describe('The comment text to add to the ticket'),
|
|
47
|
+
}),
|
|
48
|
+
async execute(params) {
|
|
49
|
+
const { text } = params;
|
|
50
|
+
try {
|
|
51
|
+
const body = {
|
|
52
|
+
type: 'doc',
|
|
53
|
+
content: [{ type: 'paragraph', content: [{ type: 'text', text }] }],
|
|
54
|
+
};
|
|
55
|
+
const comment = await client.createComment(ticketId, body);
|
|
56
|
+
if (!comment) {
|
|
57
|
+
return { success: false, error: 'Failed to create comment' };
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
success: true,
|
|
61
|
+
data: { commentId: comment.id, ticketId: comment.ticketId },
|
|
62
|
+
metadata: { message: 'Comment added to ticket' },
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
return {
|
|
67
|
+
success: false,
|
|
68
|
+
error: `Failed to add comment: ${error instanceof Error ? error.message : String(error)}`,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
return [updateStatusTool, addCommentTool];
|
|
74
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DuckDuckGo Web Search Tool
|
|
3
|
+
*
|
|
4
|
+
* Uses the DuckDuckGo Instant Answer API (no API key required).
|
|
5
|
+
* Returns structured results suitable for agent consumption.
|
|
6
|
+
*
|
|
7
|
+
* Part of the WebSearch skill family — see types.ts for the
|
|
8
|
+
* WebSearchProvider interface used by future Tavily/Exa backends (P4-3).
|
|
9
|
+
*/
|
|
10
|
+
import type { Tool } from '../base.js';
|
|
11
|
+
import type { WebSearchProvider, WebSearchResponse } from './types.js';
|
|
12
|
+
/**
|
|
13
|
+
* DuckDuckGo search provider — zero-config, no API key required.
|
|
14
|
+
*
|
|
15
|
+
* Uses the DuckDuckGo Instant Answer API to retrieve the abstract summary
|
|
16
|
+
* and related topics for a query.
|
|
17
|
+
*/
|
|
18
|
+
export declare class DuckDuckGoProvider implements WebSearchProvider {
|
|
19
|
+
readonly name = "duckduckgo";
|
|
20
|
+
search(query: string, maxResults: number): Promise<WebSearchResponse>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Factory that creates a `web_search` tool backed by any WebSearchProvider.
|
|
24
|
+
*
|
|
25
|
+
* The singleton `webSearchTool` uses DuckDuckGo. Pass a TavilyProvider or
|
|
26
|
+
* ExaProvider here to get the same tool with a premium BYOK backend.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* import { createWebSearchTool, TavilyProvider } from '@revealui/ai'
|
|
31
|
+
*
|
|
32
|
+
* const tool = createWebSearchTool(new TavilyProvider(apiKey))
|
|
33
|
+
* agent.tools.push(tool)
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function createWebSearchTool(provider: WebSearchProvider): Tool;
|
|
37
|
+
/**
|
|
38
|
+
* Web search tool backed by DuckDuckGo (zero-config).
|
|
39
|
+
*
|
|
40
|
+
* Register this on any agent that needs live web access. Requires no
|
|
41
|
+
* API key — backed by the DuckDuckGo Instant Answer API.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* import { webSearchTool } from '@revealui/ai'
|
|
46
|
+
*
|
|
47
|
+
* agent.tools.push(webSearchTool)
|
|
48
|
+
* // Agent can now call web_search({ query: '...', maxResults: 5 })
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare const webSearchTool: Tool;
|
|
52
|
+
//# sourceMappingURL=duck-duck-go.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duck-duck-go.d.ts","sourceRoot":"","sources":["../../../src/tools/web/duck-duck-go.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAmB,MAAM,YAAY,CAAA;AAiCvF;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,iBAAiB;IAC1D,QAAQ,CAAC,IAAI,gBAAe;IAEtB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAwD5E;AAiBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CA8CrE;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,EAAE,IA+C3B,CAAA"}
|