@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,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vercel Skills Compatibility Layer
|
|
3
|
+
*
|
|
4
|
+
* Ensures Vercel Skills work seamlessly with RevealUI's skill system.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Check if a skill from Vercel is compatible with RevealUI.
|
|
8
|
+
*
|
|
9
|
+
* @param skill - Skill to check
|
|
10
|
+
* @returns true if compatible, error message if not
|
|
11
|
+
*/
|
|
12
|
+
export function checkVercelCompatibility(skill) {
|
|
13
|
+
// Check if skill has required fields
|
|
14
|
+
if (!skill.metadata.name) {
|
|
15
|
+
return 'Skill must have a name';
|
|
16
|
+
}
|
|
17
|
+
if (!skill.metadata.description) {
|
|
18
|
+
return 'Skill must have a description';
|
|
19
|
+
}
|
|
20
|
+
// Check compatibility field
|
|
21
|
+
if (skill.metadata.compatibility) {
|
|
22
|
+
const hasRevealUICompat = skill.metadata.compatibility.includes('universal') ||
|
|
23
|
+
skill.metadata.compatibility.includes('claude-code') ||
|
|
24
|
+
skill.metadata.compatibility.includes('anthropic');
|
|
25
|
+
if (!hasRevealUICompat) {
|
|
26
|
+
return `Skill is not compatible with RevealUI. Compatible with: ${skill.metadata.compatibility.join(', ')}`;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Normalize a Vercel skill to RevealUI format.
|
|
33
|
+
*
|
|
34
|
+
* Some Vercel skills may use different conventions or formats.
|
|
35
|
+
* This function ensures they work with RevealUI's expectations.
|
|
36
|
+
*
|
|
37
|
+
* @param skill - Skill to normalize
|
|
38
|
+
* @returns Normalized skill
|
|
39
|
+
*/
|
|
40
|
+
export function normalizeVercelSkill(skill) {
|
|
41
|
+
const normalized = { ...skill };
|
|
42
|
+
// Ensure compatibility includes universal if not specified
|
|
43
|
+
if (!normalized.metadata.compatibility) {
|
|
44
|
+
normalized.metadata.compatibility = ['universal'];
|
|
45
|
+
}
|
|
46
|
+
// Normalize allowed-tools format
|
|
47
|
+
// Vercel skills might use different tool names
|
|
48
|
+
if (normalized.metadata.allowedTools) {
|
|
49
|
+
normalized.metadata.allowedTools = normalized.metadata.allowedTools.map((tool) => normalizeToolName(tool));
|
|
50
|
+
}
|
|
51
|
+
return normalized;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Map Vercel tool names to RevealUI tool names.
|
|
55
|
+
*/
|
|
56
|
+
const TOOL_NAME_MAP = {
|
|
57
|
+
// Vercel Skills CLI uses these names
|
|
58
|
+
bash: 'Bash',
|
|
59
|
+
read: 'Read',
|
|
60
|
+
write: 'Write',
|
|
61
|
+
edit: 'Edit',
|
|
62
|
+
glob: 'Glob',
|
|
63
|
+
grep: 'Grep',
|
|
64
|
+
// Common variations
|
|
65
|
+
'file-read': 'Read',
|
|
66
|
+
'file-write': 'Write',
|
|
67
|
+
'file-edit': 'Edit',
|
|
68
|
+
shell: 'Bash',
|
|
69
|
+
terminal: 'Bash',
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Normalize a tool name from Vercel format to RevealUI format.
|
|
73
|
+
*
|
|
74
|
+
* @param toolSpec - Tool specification (e.g., "bash(git:*)" or "read")
|
|
75
|
+
* @returns Normalized tool specification
|
|
76
|
+
*/
|
|
77
|
+
function normalizeToolName(toolSpec) {
|
|
78
|
+
// Extract tool name and filter
|
|
79
|
+
const match = toolSpec.match(/^([^(]+)(\(.*\))?$/);
|
|
80
|
+
if (!match) {
|
|
81
|
+
return toolSpec;
|
|
82
|
+
}
|
|
83
|
+
const [, toolName, filter] = match;
|
|
84
|
+
const name = toolName?.trim().toLowerCase() ?? '';
|
|
85
|
+
// Map to RevealUI tool name
|
|
86
|
+
const mappedName = TOOL_NAME_MAP[name] ?? capitalize(name);
|
|
87
|
+
// Reconstruct with filter if present
|
|
88
|
+
return filter ? `${mappedName}${filter}` : mappedName;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Capitalize first letter of a string.
|
|
92
|
+
*/
|
|
93
|
+
function capitalize(str) {
|
|
94
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Convert RevealUI skill metadata to Vercel format.
|
|
98
|
+
*
|
|
99
|
+
* Useful if we want to export RevealUI skills to the Vercel ecosystem.
|
|
100
|
+
*
|
|
101
|
+
* @param metadata - RevealUI skill metadata
|
|
102
|
+
* @returns Vercel-compatible metadata
|
|
103
|
+
*/
|
|
104
|
+
export function toVercelFormat(metadata) {
|
|
105
|
+
const vercel = {
|
|
106
|
+
name: metadata.name,
|
|
107
|
+
description: metadata.description,
|
|
108
|
+
};
|
|
109
|
+
if (metadata.version) {
|
|
110
|
+
vercel.version = metadata.version;
|
|
111
|
+
}
|
|
112
|
+
if (metadata.license) {
|
|
113
|
+
vercel.license = metadata.license;
|
|
114
|
+
}
|
|
115
|
+
if (metadata.author) {
|
|
116
|
+
vercel.author = metadata.author;
|
|
117
|
+
}
|
|
118
|
+
if (metadata.repository) {
|
|
119
|
+
vercel.repository = metadata.repository;
|
|
120
|
+
}
|
|
121
|
+
if (metadata.tags) {
|
|
122
|
+
vercel.tags = metadata.tags;
|
|
123
|
+
}
|
|
124
|
+
if (metadata.compatibility) {
|
|
125
|
+
vercel.compatibility = metadata.compatibility;
|
|
126
|
+
}
|
|
127
|
+
// Convert allowedTools to Vercel format
|
|
128
|
+
if (metadata.allowedTools) {
|
|
129
|
+
vercel['allowed-tools'] = metadata.allowedTools.map((tool) => tool.toLowerCase()).join(' ');
|
|
130
|
+
}
|
|
131
|
+
return vercel;
|
|
132
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Skills
|
|
3
|
+
*
|
|
4
|
+
* Implementation of the Agent Skills open standard (skills.sh).
|
|
5
|
+
* Allows RevealUI agents to install and use skill packages.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import {
|
|
10
|
+
* globalSkillRegistry,
|
|
11
|
+
* loadFromGitHub,
|
|
12
|
+
* SkillActivator,
|
|
13
|
+
* AgentSkillProvider,
|
|
14
|
+
* } from '@revealui/ai/skills'
|
|
15
|
+
*
|
|
16
|
+
* // Install a skill from GitHub
|
|
17
|
+
* await loadFromGitHub('vercel-labs/agent-skills/skills/react-best-practices', {
|
|
18
|
+
* targetDir: registry.getSkillDirectory('react-best-practices', 'local'),
|
|
19
|
+
* scope: 'local',
|
|
20
|
+
* registry: globalSkillRegistry,
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* // Activate skills based on context
|
|
24
|
+
* const activator = new SkillActivator({ registry: globalSkillRegistry })
|
|
25
|
+
* const provider = new AgentSkillProvider({ activator })
|
|
26
|
+
*
|
|
27
|
+
* const result = await provider.injectSkillInstructions(messages, {
|
|
28
|
+
* taskDescription: 'Refactor this React component',
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export { SkillActivator, type SkillActivatorConfig } from './activation/index.js';
|
|
33
|
+
export { type CatalogConfig, type CatalogMetadata, clearCatalogCache, fetchVercelCatalog, getSkillById, getSkillsByCompatibility, getSkillsByTag, getTrendingSkills, type SearchOptions, searchVercelCatalog, type VercelCatalog, type VercelCatalogSkill, type VercelSkillSearchResult, } from './catalog/index.js';
|
|
34
|
+
export { batchGenerateEmbeddings, checkVercelCompatibility, enhanceSkillMetadata, formatAllowedToolsString, generateEmbeddingsForVercelSkill, isToolSupported, mapRevealUIToolsToVercel, mapVercelToolsToRevealUI, normalizeVercelSkill, REVEALUI_TO_VERCEL, REVEALUI_TOOLS, type RevealUITool, toVercelFormat, VERCEL_TO_REVEALUI, VERCEL_TOOLS, type VercelTool, } from './compat/index.js';
|
|
35
|
+
export { type AgentMessage, AgentSkillProvider, type AgentSkillProviderConfig, createAgentSkillProvider, type SkillInjectionResult, } from './integration/index.js';
|
|
36
|
+
export { checkVercelSkillUpdates, createSkill, type GitHubLoadOptions, type GitHubSource, isVercelCliAvailable, type LocalLoadOptions, loadAllFromDirectory, loadFromGitHub, loadFromLocal, loadFromVercelSkills, parseGitHubSource, parseVercelSource, removeSkill, type SkillTemplate, type UpdateInfo, updateFromGitHub, updateVercelSkill, type VercelLoadOptions, type VercelSource, validateGitHubSource, } from './loader/index.js';
|
|
37
|
+
export { generateSkillMd, type ParsedSkillMd, parseAllowedToolsString, parseSkillMd, parseSkillMetadataOnly, validateSkillMd, } from './parser/index.js';
|
|
38
|
+
export { globalSkillRegistry, SkillRegistry, type SkillStorageConfig, } from './registry/index.js';
|
|
39
|
+
export { type AllowedTool, AllowedToolSchema, matchesAllowedTool, type ParsedAllowedTool, parseAllowedTool, type Skill, type SkillActivationContext, SkillActivationContextSchema, type SkillActivationResult, SkillActivationResultSchema, type SkillMetadata, SkillMetadataSchema, type SkillResource, SkillResourceSchema, SkillSchema, type SkillSource, SkillSourceSchema, } from './types.js';
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/skills/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAEjF,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,wBAAwB,EACxB,cAAc,EACd,iBAAiB,EACjB,KAAK,aAAa,EAClB,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,GAC7B,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,gCAAgC,EAChC,eAAe,EACf,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,KAAK,YAAY,EACjB,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,KAAK,UAAU,GAChB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,KAAK,YAAY,EACjB,kBAAkB,EAClB,KAAK,wBAAwB,EAC7B,wBAAwB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EACL,uBAAuB,EACvB,WAAW,EACX,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,oBAAoB,EACpB,KAAK,gBAAgB,EACrB,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,oBAAoB,GACrB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,eAAe,EACf,KAAK,aAAa,EAClB,uBAAuB,EACvB,YAAY,EACZ,sBAAsB,EACtB,eAAe,GAChB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,KAAK,WAAW,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,iBAAiB,EACtB,gBAAgB,EAChB,KAAK,KAAK,EACV,KAAK,sBAAsB,EAC3B,4BAA4B,EAC5B,KAAK,qBAAqB,EAC1B,2BAA2B,EAC3B,KAAK,aAAa,EAClB,mBAAmB,EACnB,KAAK,aAAa,EAClB,mBAAmB,EACnB,WAAW,EACX,KAAK,WAAW,EAChB,iBAAiB,GAClB,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Skills
|
|
3
|
+
*
|
|
4
|
+
* Implementation of the Agent Skills open standard (skills.sh).
|
|
5
|
+
* Allows RevealUI agents to install and use skill packages.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import {
|
|
10
|
+
* globalSkillRegistry,
|
|
11
|
+
* loadFromGitHub,
|
|
12
|
+
* SkillActivator,
|
|
13
|
+
* AgentSkillProvider,
|
|
14
|
+
* } from '@revealui/ai/skills'
|
|
15
|
+
*
|
|
16
|
+
* // Install a skill from GitHub
|
|
17
|
+
* await loadFromGitHub('vercel-labs/agent-skills/skills/react-best-practices', {
|
|
18
|
+
* targetDir: registry.getSkillDirectory('react-best-practices', 'local'),
|
|
19
|
+
* scope: 'local',
|
|
20
|
+
* registry: globalSkillRegistry,
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* // Activate skills based on context
|
|
24
|
+
* const activator = new SkillActivator({ registry: globalSkillRegistry })
|
|
25
|
+
* const provider = new AgentSkillProvider({ activator })
|
|
26
|
+
*
|
|
27
|
+
* const result = await provider.injectSkillInstructions(messages, {
|
|
28
|
+
* taskDescription: 'Refactor this React component',
|
|
29
|
+
* })
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
// Activation
|
|
33
|
+
export { SkillActivator } from './activation/index.js';
|
|
34
|
+
// Catalog
|
|
35
|
+
export { clearCatalogCache, fetchVercelCatalog, getSkillById, getSkillsByCompatibility, getSkillsByTag, getTrendingSkills, searchVercelCatalog, } from './catalog/index.js';
|
|
36
|
+
// Compatibility
|
|
37
|
+
export { batchGenerateEmbeddings, checkVercelCompatibility, enhanceSkillMetadata, formatAllowedToolsString, generateEmbeddingsForVercelSkill, isToolSupported, mapRevealUIToolsToVercel, mapVercelToolsToRevealUI, normalizeVercelSkill, REVEALUI_TO_VERCEL, REVEALUI_TOOLS, toVercelFormat, VERCEL_TO_REVEALUI, VERCEL_TOOLS, } from './compat/index.js';
|
|
38
|
+
// Integration
|
|
39
|
+
export { AgentSkillProvider, createAgentSkillProvider, } from './integration/index.js';
|
|
40
|
+
// Loaders
|
|
41
|
+
export { checkVercelSkillUpdates, createSkill, isVercelCliAvailable, loadAllFromDirectory, loadFromGitHub, loadFromLocal, loadFromVercelSkills, parseGitHubSource, parseVercelSource, removeSkill, updateFromGitHub, updateVercelSkill, validateGitHubSource, } from './loader/index.js';
|
|
42
|
+
// Parser
|
|
43
|
+
export { generateSkillMd, parseAllowedToolsString, parseSkillMd, parseSkillMetadataOnly, validateSkillMd, } from './parser/index.js';
|
|
44
|
+
// Registry
|
|
45
|
+
export { globalSkillRegistry, SkillRegistry, } from './registry/index.js';
|
|
46
|
+
// Types
|
|
47
|
+
export { AllowedToolSchema, matchesAllowedTool, parseAllowedTool, SkillActivationContextSchema, SkillActivationResultSchema, SkillMetadataSchema, SkillResourceSchema, SkillSchema, SkillSourceSchema, } from './types.js';
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Skill Provider
|
|
3
|
+
*
|
|
4
|
+
* Integrates skills into agent system prompts.
|
|
5
|
+
*/
|
|
6
|
+
import type { SkillActivator } from '../activation/index.js';
|
|
7
|
+
import type { Skill, SkillActivationContext, SkillActivationResult } from '../types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Configuration for the agent skill provider.
|
|
10
|
+
*/
|
|
11
|
+
export interface AgentSkillProviderConfig {
|
|
12
|
+
/** Skill activator instance */
|
|
13
|
+
activator: SkillActivator;
|
|
14
|
+
/** Maximum tokens to use for skill instructions */
|
|
15
|
+
maxTokenBudget?: number;
|
|
16
|
+
/** Template for wrapping skill instructions */
|
|
17
|
+
instructionTemplate?: (skill: Skill) => string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Message structure for agent communication.
|
|
21
|
+
*/
|
|
22
|
+
export interface AgentMessage {
|
|
23
|
+
role: 'system' | 'user' | 'assistant';
|
|
24
|
+
content: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Result of skill injection.
|
|
28
|
+
*/
|
|
29
|
+
export interface SkillInjectionResult {
|
|
30
|
+
/** Updated messages with skill instructions */
|
|
31
|
+
messages: AgentMessage[];
|
|
32
|
+
/** Skills that were activated */
|
|
33
|
+
activatedSkills: Skill[];
|
|
34
|
+
/** Activation reasons */
|
|
35
|
+
activationReasons: SkillActivationResult['activationReasons'];
|
|
36
|
+
/** Total tokens used for skills (approximate) */
|
|
37
|
+
estimatedTokens: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Provider for injecting skill instructions into agent prompts.
|
|
41
|
+
*/
|
|
42
|
+
export declare class AgentSkillProvider {
|
|
43
|
+
private activator;
|
|
44
|
+
private maxTokenBudget;
|
|
45
|
+
private instructionTemplate;
|
|
46
|
+
constructor(config: AgentSkillProviderConfig);
|
|
47
|
+
/**
|
|
48
|
+
* Inject activated skill instructions into agent messages.
|
|
49
|
+
*
|
|
50
|
+
* @param messages - Current agent messages
|
|
51
|
+
* @param context - Activation context
|
|
52
|
+
* @returns Updated messages with skill instructions
|
|
53
|
+
*/
|
|
54
|
+
injectSkillInstructions(messages: AgentMessage[], context: SkillActivationContext): Promise<SkillInjectionResult>;
|
|
55
|
+
/**
|
|
56
|
+
* Format multiple skill instructions into a single block.
|
|
57
|
+
*/
|
|
58
|
+
private formatSkillInstructions;
|
|
59
|
+
/**
|
|
60
|
+
* Estimate token count for text (rough approximation).
|
|
61
|
+
* Uses ~4 characters per token as a rough estimate.
|
|
62
|
+
*/
|
|
63
|
+
private estimateTokens;
|
|
64
|
+
/**
|
|
65
|
+
* Build a system prompt augmentation from activated skills.
|
|
66
|
+
*
|
|
67
|
+
* @param skills - Skills to include
|
|
68
|
+
* @returns Formatted skill instructions string
|
|
69
|
+
*/
|
|
70
|
+
buildSkillPromptAugmentation(skills: Skill[]): string;
|
|
71
|
+
/**
|
|
72
|
+
* Get skill-specific tool restrictions.
|
|
73
|
+
*
|
|
74
|
+
* @param skills - Activated skills
|
|
75
|
+
* @returns Combined allowed tools from all skills
|
|
76
|
+
*/
|
|
77
|
+
getToolRestrictions(skills: Skill[]): string[];
|
|
78
|
+
/**
|
|
79
|
+
* Check if a skill requires approval before execution.
|
|
80
|
+
*/
|
|
81
|
+
requiresApproval(skills: Skill[]): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Get available skills for the agent to reference.
|
|
84
|
+
*/
|
|
85
|
+
getAvailableSkills(): Array<{
|
|
86
|
+
name: string;
|
|
87
|
+
description: string;
|
|
88
|
+
}>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Create a skill provider with common defaults.
|
|
92
|
+
*/
|
|
93
|
+
export declare function createAgentSkillProvider(activator: SkillActivator, options?: Partial<AgentSkillProviderConfig>): AgentSkillProvider;
|
|
94
|
+
//# sourceMappingURL=agent-skill-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-skill-provider.d.ts","sourceRoot":"","sources":["../../../src/skills/integration/agent-skill-provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEvF;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,+BAA+B;IAC/B,SAAS,EAAE,cAAc,CAAA;IAEzB,mDAAmD;IACnD,cAAc,CAAC,EAAE,MAAM,CAAA;IAEvB,+CAA+C;IAC/C,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAA;CAC/C;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAA;IACrC,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,+CAA+C;IAC/C,QAAQ,EAAE,YAAY,EAAE,CAAA;IAExB,iCAAiC;IACjC,eAAe,EAAE,KAAK,EAAE,CAAA;IAExB,yBAAyB;IACzB,iBAAiB,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,CAAA;IAE7D,iDAAiD;IACjD,eAAe,EAAE,MAAM,CAAA;CACxB;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,cAAc,CAAQ;IAC9B,OAAO,CAAC,mBAAmB,CAA0B;gBAEzC,MAAM,EAAE,wBAAwB;IAM5C;;;;;;OAMG;IACG,uBAAuB,CAC3B,QAAQ,EAAE,YAAY,EAAE,EACxB,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,oBAAoB,CAAC;IA8ChC;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAQ/B;;;OAGG;IACH,OAAO,CAAC,cAAc;IAItB;;;;;OAKG;IACH,4BAA4B,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM;IAsBrD;;;;;OAKG;IACH,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE;IAc9C;;OAEG;IACH,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO;IAI1C;;OAEG;IACH,kBAAkB,IAAI,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CAGnE;AAuBD;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,cAAc,EACzB,OAAO,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAC1C,kBAAkB,CAKpB"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Skill Provider
|
|
3
|
+
*
|
|
4
|
+
* Integrates skills into agent system prompts.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Provider for injecting skill instructions into agent prompts.
|
|
8
|
+
*/
|
|
9
|
+
export class AgentSkillProvider {
|
|
10
|
+
activator;
|
|
11
|
+
maxTokenBudget;
|
|
12
|
+
instructionTemplate;
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.activator = config.activator;
|
|
15
|
+
this.maxTokenBudget = config.maxTokenBudget ?? 4000;
|
|
16
|
+
this.instructionTemplate = config.instructionTemplate ?? defaultInstructionTemplate;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Inject activated skill instructions into agent messages.
|
|
20
|
+
*
|
|
21
|
+
* @param messages - Current agent messages
|
|
22
|
+
* @param context - Activation context
|
|
23
|
+
* @returns Updated messages with skill instructions
|
|
24
|
+
*/
|
|
25
|
+
async injectSkillInstructions(messages, context) {
|
|
26
|
+
// Activate skills based on context
|
|
27
|
+
const { activatedSkills, activationReasons } = await this.activator.activate(context);
|
|
28
|
+
if (activatedSkills.length === 0) {
|
|
29
|
+
return {
|
|
30
|
+
messages,
|
|
31
|
+
activatedSkills: [],
|
|
32
|
+
activationReasons: {},
|
|
33
|
+
estimatedTokens: 0,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
// Format skill instructions
|
|
37
|
+
const skillInstructions = this.formatSkillInstructions(activatedSkills);
|
|
38
|
+
const estimatedTokens = this.estimateTokens(skillInstructions);
|
|
39
|
+
// Find system message or create one
|
|
40
|
+
const updatedMessages = [...messages];
|
|
41
|
+
const systemIndex = updatedMessages.findIndex((m) => m.role === 'system');
|
|
42
|
+
if (systemIndex >= 0) {
|
|
43
|
+
// Append to existing system message
|
|
44
|
+
const existingMessage = updatedMessages[systemIndex];
|
|
45
|
+
if (existingMessage) {
|
|
46
|
+
updatedMessages[systemIndex] = {
|
|
47
|
+
role: existingMessage.role,
|
|
48
|
+
content: `${existingMessage.content}\n\n${skillInstructions}`,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// Prepend new system message
|
|
54
|
+
updatedMessages.unshift({
|
|
55
|
+
role: 'system',
|
|
56
|
+
content: skillInstructions,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
messages: updatedMessages,
|
|
61
|
+
activatedSkills,
|
|
62
|
+
activationReasons,
|
|
63
|
+
estimatedTokens,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Format multiple skill instructions into a single block.
|
|
68
|
+
*/
|
|
69
|
+
formatSkillInstructions(skills) {
|
|
70
|
+
const skillBlocks = skills.map((skill) => this.instructionTemplate(skill));
|
|
71
|
+
return `<activated-skills>
|
|
72
|
+
${skillBlocks.join('\n\n')}
|
|
73
|
+
</activated-skills>`;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Estimate token count for text (rough approximation).
|
|
77
|
+
* Uses ~4 characters per token as a rough estimate.
|
|
78
|
+
*/
|
|
79
|
+
estimateTokens(text) {
|
|
80
|
+
return Math.ceil(text.length / 4);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Build a system prompt augmentation from activated skills.
|
|
84
|
+
*
|
|
85
|
+
* @param skills - Skills to include
|
|
86
|
+
* @returns Formatted skill instructions string
|
|
87
|
+
*/
|
|
88
|
+
buildSkillPromptAugmentation(skills) {
|
|
89
|
+
if (skills.length === 0)
|
|
90
|
+
return '';
|
|
91
|
+
let totalTokens = 0;
|
|
92
|
+
const includedSkills = [];
|
|
93
|
+
// Add skills until we hit token budget
|
|
94
|
+
for (const skill of skills) {
|
|
95
|
+
const formatted = this.instructionTemplate(skill);
|
|
96
|
+
const tokens = this.estimateTokens(formatted);
|
|
97
|
+
if (totalTokens + tokens <= this.maxTokenBudget) {
|
|
98
|
+
includedSkills.push(skill);
|
|
99
|
+
totalTokens += tokens;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return this.formatSkillInstructions(includedSkills);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get skill-specific tool restrictions.
|
|
109
|
+
*
|
|
110
|
+
* @param skills - Activated skills
|
|
111
|
+
* @returns Combined allowed tools from all skills
|
|
112
|
+
*/
|
|
113
|
+
getToolRestrictions(skills) {
|
|
114
|
+
const allTools = new Set();
|
|
115
|
+
for (const skill of skills) {
|
|
116
|
+
if (skill.metadata.allowedTools) {
|
|
117
|
+
for (const tool of skill.metadata.allowedTools) {
|
|
118
|
+
allTools.add(tool);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return Array.from(allTools);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Check if a skill requires approval before execution.
|
|
126
|
+
*/
|
|
127
|
+
requiresApproval(skills) {
|
|
128
|
+
return skills.some((s) => s.metadata.requiresApproval);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get available skills for the agent to reference.
|
|
132
|
+
*/
|
|
133
|
+
getAvailableSkills() {
|
|
134
|
+
return this.activator.getAvailableSkills();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Default template for formatting skill instructions.
|
|
139
|
+
*/
|
|
140
|
+
function defaultInstructionTemplate(skill) {
|
|
141
|
+
const parts = [];
|
|
142
|
+
parts.push(`<skill name="${skill.metadata.name}">`);
|
|
143
|
+
parts.push(`<description>${skill.metadata.description}</description>`);
|
|
144
|
+
if (skill.metadata.allowedTools?.length) {
|
|
145
|
+
parts.push(`<allowed-tools>${skill.metadata.allowedTools.join(', ')}</allowed-tools>`);
|
|
146
|
+
}
|
|
147
|
+
parts.push(`<instructions>`);
|
|
148
|
+
parts.push(skill.instructions);
|
|
149
|
+
parts.push(`</instructions>`);
|
|
150
|
+
parts.push(`</skill>`);
|
|
151
|
+
return parts.join('\n');
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Create a skill provider with common defaults.
|
|
155
|
+
*/
|
|
156
|
+
export function createAgentSkillProvider(activator, options) {
|
|
157
|
+
return new AgentSkillProvider({
|
|
158
|
+
activator,
|
|
159
|
+
...options,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Skill Integration
|
|
3
|
+
*
|
|
4
|
+
* Inject skill instructions into agent prompts.
|
|
5
|
+
*/
|
|
6
|
+
export { type AgentMessage, AgentSkillProvider, type AgentSkillProviderConfig, createAgentSkillProvider, type SkillInjectionResult, } from './agent-skill-provider.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/skills/integration/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,YAAY,EACjB,kBAAkB,EAClB,KAAK,wBAAwB,EAC7B,wBAAwB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Skill Loader
|
|
3
|
+
*
|
|
4
|
+
* Install skills from GitHub repositories.
|
|
5
|
+
*/
|
|
6
|
+
import type { SkillRegistry } from '../registry/index.js';
|
|
7
|
+
import type { Skill } from '../types.js';
|
|
8
|
+
/**
|
|
9
|
+
* GitHub skill source specification.
|
|
10
|
+
*
|
|
11
|
+
* Formats:
|
|
12
|
+
* - owner/repo - Clone entire repo
|
|
13
|
+
* - owner/repo/path/to/skill - Clone specific path
|
|
14
|
+
*/
|
|
15
|
+
export interface GitHubSource {
|
|
16
|
+
owner: string;
|
|
17
|
+
repo: string;
|
|
18
|
+
path?: string;
|
|
19
|
+
ref?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Parse a GitHub source string into components.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* parseGitHubSource("vercel-labs/agent-skills")
|
|
26
|
+
* // { owner: "vercel-labs", repo: "agent-skills" }
|
|
27
|
+
*
|
|
28
|
+
* parseGitHubSource("vercel-labs/agent-skills/skills/react-best-practices")
|
|
29
|
+
* // { owner: "vercel-labs", repo: "agent-skills", path: "skills/react-best-practices" }
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseGitHubSource(source: string): GitHubSource;
|
|
32
|
+
/**
|
|
33
|
+
* Options for loading from GitHub.
|
|
34
|
+
*/
|
|
35
|
+
export interface GitHubLoadOptions {
|
|
36
|
+
/** Target directory for installation */
|
|
37
|
+
targetDir: string;
|
|
38
|
+
/** Scope: local (project) or global */
|
|
39
|
+
scope: 'local' | 'global';
|
|
40
|
+
/** Registry to register skill with */
|
|
41
|
+
registry: SkillRegistry;
|
|
42
|
+
/** Generate embedding for semantic search */
|
|
43
|
+
generateEmbedding?: boolean;
|
|
44
|
+
/** Force reinstall if already exists */
|
|
45
|
+
force?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Load a skill from a GitHub repository.
|
|
49
|
+
*
|
|
50
|
+
* Uses git sparse checkout for efficiency when loading from a subdirectory.
|
|
51
|
+
*/
|
|
52
|
+
export declare function loadFromGitHub(source: string, options: GitHubLoadOptions): Promise<Skill>;
|
|
53
|
+
/**
|
|
54
|
+
* Update an installed skill from GitHub.
|
|
55
|
+
*/
|
|
56
|
+
export declare function updateFromGitHub(skillName: string, registry: SkillRegistry): Promise<Skill | undefined>;
|
|
57
|
+
/**
|
|
58
|
+
* Check if a GitHub source is valid and accessible.
|
|
59
|
+
*/
|
|
60
|
+
export declare function validateGitHubSource(source: string): Promise<boolean>;
|
|
61
|
+
//# sourceMappingURL=github-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-loader.d.ts","sourceRoot":"","sources":["../../../src/skills/loader/github-loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAIxC;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CA+B9D;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAA;IAEjB,uCAAuC;IACvC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAA;IAEzB,sCAAsC;IACtC,QAAQ,EAAE,aAAa,CAAA;IAEvB,6CAA6C;IAC7C,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAE3B,wCAAwC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,CA8D/F;AAwDD;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,aAAa,GACtB,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,CAS5B;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAW3E"}
|