opc-agent 4.1.1 → 4.1.3
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/analytics/index.d.ts.map +1 -0
- package/dist/analytics/index.js.map +1 -0
- package/dist/channels/dingtalk.d.ts.map +1 -0
- package/dist/channels/dingtalk.js.map +1 -0
- package/dist/channels/discord.d.ts.map +1 -0
- package/dist/channels/discord.js.map +1 -0
- package/dist/channels/email.d.ts.map +1 -0
- package/dist/channels/email.js.map +1 -0
- package/dist/channels/feishu.d.ts.map +1 -0
- package/dist/channels/feishu.js.map +1 -0
- package/dist/channels/googlechat.d.ts.map +1 -0
- package/dist/channels/googlechat.js.map +1 -0
- package/dist/channels/imessage.d.ts.map +1 -0
- package/dist/channels/imessage.js.map +1 -0
- package/dist/channels/index.d.ts.map +1 -0
- package/dist/channels/index.js.map +1 -0
- package/dist/channels/irc.d.ts.map +1 -0
- package/dist/channels/irc.js.map +1 -0
- package/dist/channels/line.d.ts.map +1 -0
- package/dist/channels/line.js.map +1 -0
- package/dist/channels/matrix.d.ts.map +1 -0
- package/dist/channels/matrix.js.map +1 -0
- package/dist/channels/mattermost.d.ts.map +1 -0
- package/dist/channels/mattermost.js.map +1 -0
- package/dist/channels/msteams.d.ts.map +1 -0
- package/dist/channels/msteams.js.map +1 -0
- package/dist/channels/nostr.d.ts.map +1 -0
- package/dist/channels/nostr.js.map +1 -0
- package/dist/channels/qq.d.ts.map +1 -0
- package/dist/channels/qq.js.map +1 -0
- package/dist/channels/signal.d.ts.map +1 -0
- package/dist/channels/signal.js.map +1 -0
- package/dist/channels/slack.d.ts.map +1 -0
- package/dist/channels/slack.js.map +1 -0
- package/dist/channels/sms.d.ts.map +1 -0
- package/dist/channels/sms.js.map +1 -0
- package/dist/channels/telegram.d.ts.map +1 -0
- package/dist/channels/telegram.js.map +1 -0
- package/dist/channels/twitch.d.ts.map +1 -0
- package/dist/channels/twitch.js.map +1 -0
- package/dist/channels/voice-call.d.ts.map +1 -0
- package/dist/channels/voice-call.js.map +1 -0
- package/dist/channels/voice.d.ts.map +1 -0
- package/dist/channels/voice.js.map +1 -0
- package/dist/channels/web.d.ts.map +1 -0
- package/dist/channels/web.js +8 -2
- package/dist/channels/web.js.map +1 -0
- package/dist/channels/webhook.d.ts.map +1 -0
- package/dist/channels/webhook.js.map +1 -0
- package/dist/channels/websocket.d.ts.map +1 -0
- package/dist/channels/websocket.js.map +1 -0
- package/dist/channels/wechat.d.ts.map +1 -0
- package/dist/channels/wechat.js.map +1 -0
- package/dist/channels/whatsapp.d.ts.map +1 -0
- package/dist/channels/whatsapp.js.map +1 -0
- package/dist/cli/chat.d.ts.map +1 -0
- package/dist/cli/chat.js.map +1 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +261 -85
- package/dist/cli.js.map +1 -0
- package/dist/core/a2a.d.ts.map +1 -0
- package/dist/core/a2a.js.map +1 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/analytics-engine.d.ts.map +1 -0
- package/dist/core/analytics-engine.js.map +1 -0
- package/dist/core/api-server.d.ts.map +1 -0
- package/dist/core/api-server.js.map +1 -0
- package/dist/core/audio.d.ts.map +1 -0
- package/dist/core/audio.js.map +1 -0
- package/dist/core/auth.d.ts.map +1 -0
- package/dist/core/auth.js.map +1 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/cache.js.map +1 -0
- package/dist/core/collaboration.d.ts.map +1 -0
- package/dist/core/collaboration.js.map +1 -0
- package/dist/core/compose.d.ts.map +1 -0
- package/dist/core/compose.js.map +1 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/context-discovery.d.ts.map +1 -0
- package/dist/core/context-discovery.js.map +1 -0
- package/dist/core/context-refs.d.ts.map +1 -0
- package/dist/core/context-refs.js.map +1 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/gateway.d.ts.map +1 -0
- package/dist/core/gateway.js.map +1 -0
- package/dist/core/heartbeat.d.ts.map +1 -0
- package/dist/core/heartbeat.js.map +1 -0
- package/dist/core/hitl.d.ts.map +1 -0
- package/dist/core/hitl.js.map +1 -0
- package/dist/core/hooks.d.ts.map +1 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/ide-bridge.d.ts.map +1 -0
- package/dist/core/ide-bridge.js.map +1 -0
- package/dist/core/knowledge.d.ts.map +1 -0
- package/dist/core/knowledge.js.map +1 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/node-network.d.ts.map +1 -0
- package/dist/core/node-network.js.map +1 -0
- package/dist/core/orchestrator.d.ts.map +1 -0
- package/dist/core/orchestrator.js.map +1 -0
- package/dist/core/performance.d.ts.map +1 -0
- package/dist/core/performance.js.map +1 -0
- package/dist/core/profiles.d.ts.map +1 -0
- package/dist/core/profiles.js.map +1 -0
- package/dist/core/rate-limiter.d.ts.map +1 -0
- package/dist/core/rate-limiter.js.map +1 -0
- package/dist/core/room.d.ts.map +1 -0
- package/dist/core/room.js.map +1 -0
- package/dist/core/runtime.d.ts.map +1 -0
- package/dist/core/runtime.js +37 -15
- package/dist/core/runtime.js.map +1 -0
- package/dist/core/sandbox.d.ts.map +1 -0
- package/dist/core/sandbox.js.map +1 -0
- package/dist/core/scheduler.d.ts.map +1 -0
- package/dist/core/scheduler.js.map +1 -0
- package/dist/core/security.d.ts.map +1 -0
- package/dist/core/security.js.map +1 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/streaming.d.ts.map +1 -0
- package/dist/core/streaming.js.map +1 -0
- package/dist/core/subagent.d.ts.map +1 -0
- package/dist/core/subagent.js.map +1 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/versioning.d.ts.map +1 -0
- package/dist/core/versioning.js.map +1 -0
- package/dist/core/vision.d.ts.map +1 -0
- package/dist/core/vision.js.map +1 -0
- package/dist/core/watch.d.ts.map +1 -0
- package/dist/core/watch.js.map +1 -0
- package/dist/core/workflow-graph.d.ts.map +1 -0
- package/dist/core/workflow-graph.js.map +1 -0
- package/dist/core/workflow.d.ts.map +1 -0
- package/dist/core/workflow.js.map +1 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js.map +1 -0
- package/dist/deploy/hermes.d.ts.map +1 -0
- package/dist/deploy/hermes.js.map +1 -0
- package/dist/deploy/index.d.ts.map +1 -0
- package/dist/deploy/index.js.map +1 -0
- package/dist/deploy/openclaw.d.ts.map +1 -0
- package/dist/deploy/openclaw.js.map +1 -0
- package/dist/doctor.d.ts +1 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +105 -10
- package/dist/doctor.js.map +1 -0
- package/dist/eval/index.d.ts.map +1 -0
- package/dist/eval/index.js.map +1 -0
- package/dist/hub/brain-seed.d.ts.map +1 -0
- package/dist/hub/brain-seed.js.map +1 -0
- package/dist/hub/client.d.ts.map +1 -0
- package/dist/hub/client.js.map +1 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/servers/calculator-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/calculator-mcp.js.map +1 -0
- package/dist/mcp/servers/crypto-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/crypto-mcp.js.map +1 -0
- package/dist/mcp/servers/database-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/database-mcp.js.map +1 -0
- package/dist/mcp/servers/datetime-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/datetime-mcp.js.map +1 -0
- package/dist/mcp/servers/filesystem.d.ts.map +1 -0
- package/dist/mcp/servers/filesystem.js.map +1 -0
- package/dist/mcp/servers/github-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/github-mcp.js.map +1 -0
- package/dist/mcp/servers/index.d.ts.map +1 -0
- package/dist/mcp/servers/index.js.map +1 -0
- package/dist/mcp/servers/json-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/json-mcp.js.map +1 -0
- package/dist/mcp/servers/memory-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/memory-mcp.js.map +1 -0
- package/dist/mcp/servers/regex-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/regex-mcp.js.map +1 -0
- package/dist/mcp/servers/web-mcp.d.ts.map +1 -0
- package/dist/mcp/servers/web-mcp.js.map +1 -0
- package/dist/memory/context-compressor.d.ts.map +1 -0
- package/dist/memory/context-compressor.js.map +1 -0
- package/dist/memory/deepbrain.d.ts +1 -1
- package/dist/memory/deepbrain.d.ts.map +1 -0
- package/dist/memory/deepbrain.js +95 -4
- package/dist/memory/deepbrain.js.map +1 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/seed-loader.d.ts.map +1 -0
- package/dist/memory/seed-loader.js.map +1 -0
- package/dist/memory/user-profiler.d.ts.map +1 -0
- package/dist/memory/user-profiler.js.map +1 -0
- package/dist/plugins/content-filter.d.ts.map +1 -0
- package/dist/plugins/content-filter.js.map +1 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/logger.d.ts.map +1 -0
- package/dist/plugins/logger.js.map +1 -0
- package/dist/plugins/rate-limiter.d.ts.map +1 -0
- package/dist/plugins/rate-limiter.js.map +1 -0
- package/dist/protocols/a2a/client.d.ts.map +1 -0
- package/dist/protocols/a2a/client.js.map +1 -0
- package/dist/protocols/a2a/index.d.ts.map +1 -0
- package/dist/protocols/a2a/index.js.map +1 -0
- package/dist/protocols/a2a/server.d.ts.map +1 -0
- package/dist/protocols/a2a/server.js.map +1 -0
- package/dist/protocols/a2a/types.d.ts.map +1 -0
- package/dist/protocols/a2a/types.js.map +1 -0
- package/dist/protocols/a2a/utils.d.ts.map +1 -0
- package/dist/protocols/a2a/utils.js.map +1 -0
- package/dist/protocols/agui/client.d.ts.map +1 -0
- package/dist/protocols/agui/client.js.map +1 -0
- package/dist/protocols/agui/index.d.ts.map +1 -0
- package/dist/protocols/agui/index.js.map +1 -0
- package/dist/protocols/agui/server.d.ts.map +1 -0
- package/dist/protocols/agui/server.js.map +1 -0
- package/dist/protocols/agui/types.d.ts.map +1 -0
- package/dist/protocols/agui/types.js.map +1 -0
- package/dist/protocols/index.d.ts.map +1 -0
- package/dist/protocols/index.js.map +1 -0
- package/dist/protocols/mcp/agent-tools.d.ts.map +1 -0
- package/dist/protocols/mcp/agent-tools.js.map +1 -0
- package/dist/protocols/mcp/index.d.ts.map +1 -0
- package/dist/protocols/mcp/index.js.map +1 -0
- package/dist/protocols/mcp/server.d.ts.map +1 -0
- package/dist/protocols/mcp/server.js.map +1 -0
- package/dist/protocols/mcp/types.d.ts.map +1 -0
- package/dist/protocols/mcp/types.js.map +1 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/publish/index.d.ts.map +1 -0
- package/dist/publish/index.js.map +1 -0
- package/dist/scheduler/cron-engine.d.ts.map +1 -0
- package/dist/scheduler/cron-engine.js +3 -36
- package/dist/scheduler/cron-engine.js.map +1 -0
- package/dist/scheduler/index.d.ts.map +1 -0
- package/dist/scheduler/index.js.map +1 -0
- package/dist/schema/oad.d.ts.map +1 -0
- package/dist/schema/oad.js.map +1 -0
- package/dist/security/approval.d.ts.map +1 -0
- package/dist/security/approval.js.map +1 -0
- package/dist/security/approvals.d.ts.map +1 -0
- package/dist/security/approvals.js.map +1 -0
- package/dist/security/elevated.d.ts.map +1 -0
- package/dist/security/elevated.js.map +1 -0
- package/dist/security/guardrails.d.ts.map +1 -0
- package/dist/security/guardrails.js.map +1 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/keys.d.ts.map +1 -0
- package/dist/security/keys.js.map +1 -0
- package/dist/security/secrets.d.ts.map +1 -0
- package/dist/security/secrets.js.map +1 -0
- package/dist/skills/auto-learn.d.ts.map +1 -0
- package/dist/skills/auto-learn.js.map +1 -0
- package/dist/skills/base.d.ts.map +1 -0
- package/dist/skills/base.js.map +1 -0
- package/dist/skills/builtin/index.d.ts.map +1 -0
- package/dist/skills/builtin/index.js.map +1 -0
- package/dist/skills/document.d.ts.map +1 -0
- package/dist/skills/document.js.map +1 -0
- package/dist/skills/http.d.ts.map +1 -0
- package/dist/skills/http.js.map +1 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/marketplace.d.ts.map +1 -0
- package/dist/skills/marketplace.js.map +1 -0
- package/dist/skills/scheduler.d.ts.map +1 -0
- package/dist/skills/scheduler.js.map +1 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/skills/webhook-trigger.d.ts.map +1 -0
- package/dist/skills/webhook-trigger.js.map +1 -0
- package/dist/studio/server.d.ts.map +1 -0
- package/dist/studio/server.js.map +1 -0
- package/dist/studio/templates-data.d.ts.map +1 -0
- package/dist/studio/templates-data.js.map +1 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/templates/code-reviewer.d.ts.map +1 -0
- package/dist/templates/code-reviewer.js.map +1 -0
- package/dist/templates/content-writer.d.ts.map +1 -0
- package/dist/templates/content-writer.js.map +1 -0
- package/dist/templates/customer-service.d.ts.map +1 -0
- package/dist/templates/customer-service.js.map +1 -0
- package/dist/templates/data-analyst.d.ts.map +1 -0
- package/dist/templates/data-analyst.js.map +1 -0
- package/dist/templates/executive-assistant.d.ts.map +1 -0
- package/dist/templates/executive-assistant.js.map +1 -0
- package/dist/templates/financial-advisor.d.ts.map +1 -0
- package/dist/templates/financial-advisor.js.map +1 -0
- package/dist/templates/hr-recruiter.d.ts.map +1 -0
- package/dist/templates/hr-recruiter.js.map +1 -0
- package/dist/templates/knowledge-base.d.ts.map +1 -0
- package/dist/templates/knowledge-base.js.map +1 -0
- package/dist/templates/legal-assistant.d.ts.map +1 -0
- package/dist/templates/legal-assistant.js.map +1 -0
- package/dist/templates/project-manager.d.ts.map +1 -0
- package/dist/templates/project-manager.js.map +1 -0
- package/dist/templates/sales-assistant.d.ts.map +1 -0
- package/dist/templates/sales-assistant.js.map +1 -0
- package/dist/templates/teacher.d.ts.map +1 -0
- package/dist/templates/teacher.js.map +1 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tools/builtin/browser.d.ts.map +1 -0
- package/dist/tools/builtin/browser.js.map +1 -0
- package/dist/tools/builtin/datetime.d.ts.map +1 -0
- package/dist/tools/builtin/datetime.js.map +1 -0
- package/dist/tools/builtin/file.d.ts.map +1 -0
- package/dist/tools/builtin/file.js.map +1 -0
- package/dist/tools/builtin/home-assistant.d.ts.map +1 -0
- package/dist/tools/builtin/home-assistant.js.map +1 -0
- package/dist/tools/builtin/index.d.ts.map +1 -0
- package/dist/tools/builtin/index.js.map +1 -0
- package/dist/tools/builtin/rl-tools.d.ts.map +1 -0
- package/dist/tools/builtin/rl-tools.js.map +1 -0
- package/dist/tools/builtin/shell.d.ts.map +1 -0
- package/dist/tools/builtin/shell.js.map +1 -0
- package/dist/tools/builtin/vision.d.ts.map +1 -0
- package/dist/tools/builtin/vision.js.map +1 -0
- package/dist/tools/builtin/web-search.d.ts.map +1 -0
- package/dist/tools/builtin/web-search.js.map +1 -0
- package/dist/tools/builtin/web.d.ts.map +1 -0
- package/dist/tools/builtin/web.js.map +1 -0
- package/dist/tools/calculator.d.ts.map +1 -0
- package/dist/tools/calculator.js.map +1 -0
- package/dist/tools/datetime.d.ts.map +1 -0
- package/dist/tools/datetime.js.map +1 -0
- package/dist/tools/document-processor.d.ts.map +1 -0
- package/dist/tools/document-processor.js.map +1 -0
- package/dist/tools/gateway.d.ts.map +1 -0
- package/dist/tools/gateway.js.map +1 -0
- package/dist/tools/image-generator.d.ts.map +1 -0
- package/dist/tools/image-generator.js.map +1 -0
- package/dist/tools/integrations/calendar.d.ts.map +1 -0
- package/dist/tools/integrations/calendar.js.map +1 -0
- package/dist/tools/integrations/code-exec.d.ts.map +1 -0
- package/dist/tools/integrations/code-exec.js.map +1 -0
- package/dist/tools/integrations/csv-analyzer.d.ts.map +1 -0
- package/dist/tools/integrations/csv-analyzer.js.map +1 -0
- package/dist/tools/integrations/database.d.ts.map +1 -0
- package/dist/tools/integrations/database.js.map +1 -0
- package/dist/tools/integrations/email-send.d.ts.map +1 -0
- package/dist/tools/integrations/email-send.js.map +1 -0
- package/dist/tools/integrations/git-tool.d.ts.map +1 -0
- package/dist/tools/integrations/git-tool.js.map +1 -0
- package/dist/tools/integrations/github-tool.d.ts.map +1 -0
- package/dist/tools/integrations/github-tool.js.map +1 -0
- package/dist/tools/integrations/image-gen.d.ts.map +1 -0
- package/dist/tools/integrations/image-gen.js.map +1 -0
- package/dist/tools/integrations/index.d.ts.map +1 -0
- package/dist/tools/integrations/index.js.map +1 -0
- package/dist/tools/integrations/jira.d.ts.map +1 -0
- package/dist/tools/integrations/jira.js.map +1 -0
- package/dist/tools/integrations/notion.d.ts.map +1 -0
- package/dist/tools/integrations/notion.js.map +1 -0
- package/dist/tools/integrations/npm-tool.d.ts.map +1 -0
- package/dist/tools/integrations/npm-tool.js.map +1 -0
- package/dist/tools/integrations/pdf-reader.d.ts.map +1 -0
- package/dist/tools/integrations/pdf-reader.js.map +1 -0
- package/dist/tools/integrations/slack.d.ts.map +1 -0
- package/dist/tools/integrations/slack.js.map +1 -0
- package/dist/tools/integrations/summarizer.d.ts.map +1 -0
- package/dist/tools/integrations/summarizer.js.map +1 -0
- package/dist/tools/integrations/translator.d.ts.map +1 -0
- package/dist/tools/integrations/translator.js.map +1 -0
- package/dist/tools/integrations/trello.d.ts.map +1 -0
- package/dist/tools/integrations/trello.js.map +1 -0
- package/dist/tools/integrations/vector-search.d.ts.map +1 -0
- package/dist/tools/integrations/vector-search.js.map +1 -0
- package/dist/tools/integrations/web-scraper.d.ts.map +1 -0
- package/dist/tools/integrations/web-scraper.js.map +1 -0
- package/dist/tools/integrations/web-search.d.ts.map +1 -0
- package/dist/tools/integrations/web-search.js.map +1 -0
- package/dist/tools/integrations/webhook.d.ts.map +1 -0
- package/dist/tools/integrations/webhook.js.map +1 -0
- package/dist/tools/json-transform.d.ts.map +1 -0
- package/dist/tools/json-transform.js.map +1 -0
- package/dist/tools/mcp-client.d.ts.map +1 -0
- package/dist/tools/mcp-client.js.map +1 -0
- package/dist/tools/mcp.d.ts.map +1 -0
- package/dist/tools/mcp.js.map +1 -0
- package/dist/tools/text-analysis.d.ts.map +1 -0
- package/dist/tools/text-analysis.js.map +1 -0
- package/dist/tools/web-scraper.d.ts.map +1 -0
- package/dist/tools/web-scraper.js.map +1 -0
- package/dist/tools/web-search.d.ts.map +1 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/traces/index.d.ts.map +1 -0
- package/dist/traces/index.js.map +1 -0
- package/dist/ui/components.d.ts.map +1 -0
- package/dist/ui/components.js.map +1 -0
- package/package.json +1 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -20
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -14
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -13
- package/.github/workflows/ci.yml +0 -24
- package/docs/.vitepress/config.ts +0 -103
- package/docs/api/cli.md +0 -48
- package/docs/api/oad-schema.md +0 -64
- package/docs/api/sdk.md +0 -80
- package/docs/guide/concepts.md +0 -51
- package/docs/guide/configuration.md +0 -79
- package/docs/guide/deployment.md +0 -42
- package/docs/guide/getting-started.md +0 -44
- package/docs/guide/templates.md +0 -28
- package/docs/guide/testing.md +0 -84
- package/docs/index.md +0 -27
- package/docs/zh/api/cli.md +0 -54
- package/docs/zh/api/oad-schema.md +0 -87
- package/docs/zh/api/sdk.md +0 -102
- package/docs/zh/guide/concepts.md +0 -104
- package/docs/zh/guide/configuration.md +0 -135
- package/docs/zh/guide/deployment.md +0 -81
- package/docs/zh/guide/getting-started.md +0 -82
- package/docs/zh/guide/templates.md +0 -84
- package/docs/zh/guide/testing.md +0 -88
- package/docs/zh/index.md +0 -27
- package/fix-sidebar.mjs +0 -188
- package/serve-studio.js +0 -13
- package/serve-test.js +0 -25
- package/src/analytics/index.ts +0 -66
- package/src/channels/dingtalk.ts +0 -46
- package/src/channels/discord.ts +0 -192
- package/src/channels/email.ts +0 -351
- package/src/channels/feishu.ts +0 -349
- package/src/channels/googlechat.ts +0 -42
- package/src/channels/imessage.ts +0 -32
- package/src/channels/index.ts +0 -15
- package/src/channels/irc.ts +0 -82
- package/src/channels/line.ts +0 -33
- package/src/channels/matrix.ts +0 -34
- package/src/channels/mattermost.ts +0 -57
- package/src/channels/msteams.ts +0 -33
- package/src/channels/nostr.ts +0 -33
- package/src/channels/qq.ts +0 -34
- package/src/channels/signal.ts +0 -33
- package/src/channels/slack.ts +0 -217
- package/src/channels/sms.ts +0 -34
- package/src/channels/telegram.ts +0 -616
- package/src/channels/twitch.ts +0 -65
- package/src/channels/voice-call.ts +0 -100
- package/src/channels/voice.ts +0 -471
- package/src/channels/web.ts +0 -632
- package/src/channels/webhook.ts +0 -199
- package/src/channels/websocket.ts +0 -399
- package/src/channels/wechat.ts +0 -329
- package/src/channels/whatsapp.ts +0 -33
- package/src/cli/chat.ts +0 -99
- package/src/cli/setup.ts +0 -314
- package/src/cli.ts +0 -2723
- package/src/core/a2a.ts +0 -203
- package/src/core/agent.ts +0 -476
- package/src/core/analytics-engine.ts +0 -186
- package/src/core/api-server.ts +0 -277
- package/src/core/audio.ts +0 -98
- package/src/core/auth.ts +0 -57
- package/src/core/cache.ts +0 -141
- package/src/core/collaboration.ts +0 -275
- package/src/core/compose.ts +0 -77
- package/src/core/config.ts +0 -14
- package/src/core/context-discovery.ts +0 -85
- package/src/core/context-refs.ts +0 -140
- package/src/core/errors.ts +0 -148
- package/src/core/gateway.ts +0 -106
- package/src/core/heartbeat.ts +0 -51
- package/src/core/hitl.ts +0 -138
- package/src/core/hooks.ts +0 -105
- package/src/core/ide-bridge.ts +0 -133
- package/src/core/knowledge.ts +0 -255
- package/src/core/logger.ts +0 -57
- package/src/core/node-network.ts +0 -86
- package/src/core/orchestrator.ts +0 -215
- package/src/core/performance.ts +0 -187
- package/src/core/profiles.ts +0 -122
- package/src/core/rate-limiter.ts +0 -128
- package/src/core/room.ts +0 -109
- package/src/core/runtime.ts +0 -410
- package/src/core/sandbox.ts +0 -344
- package/src/core/scheduler.ts +0 -187
- package/src/core/security.ts +0 -171
- package/src/core/session-manager.ts +0 -137
- package/src/core/streaming.ts +0 -195
- package/src/core/subagent.ts +0 -98
- package/src/core/types.ts +0 -68
- package/src/core/versioning.ts +0 -106
- package/src/core/vision.ts +0 -180
- package/src/core/watch.ts +0 -178
- package/src/core/workflow-graph.ts +0 -365
- package/src/core/workflow.ts +0 -235
- package/src/daemon.ts +0 -96
- package/src/deploy/hermes.ts +0 -156
- package/src/deploy/index.ts +0 -255
- package/src/deploy/openclaw.ts +0 -190
- package/src/doctor.ts +0 -156
- package/src/eval/index.ts +0 -211
- package/src/eval/suites/basic.json +0 -16
- package/src/eval/suites/memory.json +0 -12
- package/src/eval/suites/safety.json +0 -14
- package/src/hub/brain-seed.ts +0 -54
- package/src/hub/client.ts +0 -60
- package/src/i18n/index.ts +0 -216
- package/src/index.ts +0 -283
- package/src/mcp/servers/calculator-mcp.ts +0 -65
- package/src/mcp/servers/crypto-mcp.ts +0 -73
- package/src/mcp/servers/database-mcp.ts +0 -72
- package/src/mcp/servers/datetime-mcp.ts +0 -69
- package/src/mcp/servers/filesystem.ts +0 -66
- package/src/mcp/servers/github-mcp.ts +0 -58
- package/src/mcp/servers/index.ts +0 -63
- package/src/mcp/servers/json-mcp.ts +0 -102
- package/src/mcp/servers/memory-mcp.ts +0 -56
- package/src/mcp/servers/regex-mcp.ts +0 -53
- package/src/mcp/servers/web-mcp.ts +0 -49
- package/src/memory/context-compressor.ts +0 -189
- package/src/memory/deepbrain.ts +0 -108
- package/src/memory/index.ts +0 -41
- package/src/memory/seed-loader.ts +0 -212
- package/src/memory/user-profiler.ts +0 -215
- package/src/plugins/content-filter.ts +0 -23
- package/src/plugins/index.ts +0 -339
- package/src/plugins/logger.ts +0 -18
- package/src/plugins/rate-limiter.ts +0 -38
- package/src/protocols/a2a/client.ts +0 -132
- package/src/protocols/a2a/index.ts +0 -8
- package/src/protocols/a2a/server.ts +0 -333
- package/src/protocols/a2a/types.ts +0 -88
- package/src/protocols/a2a/utils.ts +0 -50
- package/src/protocols/agui/client.ts +0 -83
- package/src/protocols/agui/index.ts +0 -4
- package/src/protocols/agui/server.ts +0 -218
- package/src/protocols/agui/types.ts +0 -153
- package/src/protocols/index.ts +0 -2
- package/src/protocols/mcp/agent-tools.ts +0 -134
- package/src/protocols/mcp/index.ts +0 -8
- package/src/protocols/mcp/server.ts +0 -262
- package/src/protocols/mcp/types.ts +0 -69
- package/src/providers/index.ts +0 -632
- package/src/publish/index.ts +0 -376
- package/src/scheduler/cron-engine.ts +0 -191
- package/src/scheduler/index.ts +0 -2
- package/src/schema/oad.ts +0 -217
- package/src/security/approval.ts +0 -131
- package/src/security/approvals.ts +0 -143
- package/src/security/elevated.ts +0 -105
- package/src/security/guardrails.ts +0 -248
- package/src/security/index.ts +0 -9
- package/src/security/keys.ts +0 -87
- package/src/security/secrets.ts +0 -129
- package/src/skills/auto-learn.ts +0 -262
- package/src/skills/base.ts +0 -16
- package/src/skills/builtin/index.ts +0 -408
- package/src/skills/document.ts +0 -100
- package/src/skills/http.ts +0 -35
- package/src/skills/index.ts +0 -27
- package/src/skills/marketplace.ts +0 -113
- package/src/skills/scheduler.ts +0 -80
- package/src/skills/types.ts +0 -42
- package/src/skills/webhook-trigger.ts +0 -59
- package/src/studio/server.ts +0 -1791
- package/src/studio/templates-data.ts +0 -178
- package/src/studio-ui/index.html +0 -3076
- package/src/telemetry/index.ts +0 -324
- package/src/templates/code-reviewer.ts +0 -30
- package/src/templates/content-writer.ts +0 -58
- package/src/templates/customer-service.ts +0 -76
- package/src/templates/data-analyst.ts +0 -66
- package/src/templates/executive-assistant.ts +0 -71
- package/src/templates/financial-advisor.ts +0 -60
- package/src/templates/hr-recruiter.ts +0 -58
- package/src/templates/knowledge-base.ts +0 -27
- package/src/templates/legal-assistant.ts +0 -71
- package/src/templates/project-manager.ts +0 -58
- package/src/templates/sales-assistant.ts +0 -75
- package/src/templates/teacher.ts +0 -75
- package/src/testing/index.ts +0 -181
- package/src/tools/builtin/browser.ts +0 -299
- package/src/tools/builtin/datetime.ts +0 -41
- package/src/tools/builtin/file.ts +0 -107
- package/src/tools/builtin/home-assistant.ts +0 -116
- package/src/tools/builtin/index.ts +0 -37
- package/src/tools/builtin/rl-tools.ts +0 -243
- package/src/tools/builtin/shell.ts +0 -43
- package/src/tools/builtin/vision.ts +0 -64
- package/src/tools/builtin/web-search.ts +0 -126
- package/src/tools/builtin/web.ts +0 -35
- package/src/tools/calculator.ts +0 -73
- package/src/tools/datetime.ts +0 -149
- package/src/tools/document-processor.ts +0 -213
- package/src/tools/gateway.ts +0 -220
- package/src/tools/image-generator.ts +0 -150
- package/src/tools/integrations/calendar.ts +0 -73
- package/src/tools/integrations/code-exec.ts +0 -39
- package/src/tools/integrations/csv-analyzer.ts +0 -92
- package/src/tools/integrations/database.ts +0 -44
- package/src/tools/integrations/email-send.ts +0 -76
- package/src/tools/integrations/git-tool.ts +0 -42
- package/src/tools/integrations/github-tool.ts +0 -76
- package/src/tools/integrations/image-gen.ts +0 -56
- package/src/tools/integrations/index.ts +0 -92
- package/src/tools/integrations/jira.ts +0 -83
- package/src/tools/integrations/notion.ts +0 -71
- package/src/tools/integrations/npm-tool.ts +0 -48
- package/src/tools/integrations/pdf-reader.ts +0 -58
- package/src/tools/integrations/slack.ts +0 -65
- package/src/tools/integrations/summarizer.ts +0 -49
- package/src/tools/integrations/translator.ts +0 -48
- package/src/tools/integrations/trello.ts +0 -60
- package/src/tools/integrations/vector-search.ts +0 -42
- package/src/tools/integrations/web-scraper.ts +0 -47
- package/src/tools/integrations/web-search.ts +0 -58
- package/src/tools/integrations/webhook.ts +0 -38
- package/src/tools/json-transform.ts +0 -187
- package/src/tools/mcp-client.ts +0 -131
- package/src/tools/mcp.ts +0 -76
- package/src/tools/text-analysis.ts +0 -116
- package/src/tools/web-scraper.ts +0 -179
- package/src/tools/web-search.ts +0 -180
- package/src/traces/index.ts +0 -132
- package/src/types/agent-workstation.d.ts +0 -2
- package/src/ui/components.ts +0 -127
- package/srv-err.txt +0 -0
- package/srv-out.txt +0 -1
- package/test-agent/Dockerfile +0 -9
- package/test-agent/README.md +0 -50
- package/test-agent/agent.yaml +0 -23
- package/test-agent/docker-compose.yml +0 -11
- package/test-agent/oad.yaml +0 -31
- package/test-agent/package-lock.json +0 -1492
- package/test-agent/package.json +0 -18
- package/test-agent/src/index.ts +0 -24
- package/test-agent/src/skills/echo.ts +0 -15
- package/test-agent/tsconfig.json +0 -25
- package/test-full.js +0 -43
- package/test-sidebar.js +0 -22
- package/test-studio3.js +0 -75
- package/test-studio4.js +0 -41
- package/tests/a2a-protocol.test.ts +0 -285
- package/tests/a2a.test.ts +0 -66
- package/tests/agent.test.ts +0 -72
- package/tests/agui-protocol.test.ts +0 -246
- package/tests/analytics.test.ts +0 -50
- package/tests/api-server.test.ts +0 -148
- package/tests/approvals.test.ts +0 -89
- package/tests/audio.test.ts +0 -40
- package/tests/auto-learn.test.ts +0 -105
- package/tests/brain-seed-extended.test.ts +0 -490
- package/tests/brain-seed.test.ts +0 -239
- package/tests/browser.test.ts +0 -179
- package/tests/builtin-tools.test.ts +0 -83
- package/tests/channel.test.ts +0 -39
- package/tests/channels/discord.test.ts +0 -79
- package/tests/channels/email.test.ts +0 -148
- package/tests/channels/feishu.test.ts +0 -123
- package/tests/channels/telegram.test.ts +0 -129
- package/tests/channels/websocket.test.ts +0 -53
- package/tests/channels/wechat.test.ts +0 -170
- package/tests/channels-extra.test.ts +0 -45
- package/tests/chat-cli.test.ts +0 -160
- package/tests/cli.test.ts +0 -46
- package/tests/collaboration.test.ts +0 -319
- package/tests/context-compressor.test.ts +0 -172
- package/tests/context-refs.test.ts +0 -121
- package/tests/cron-engine.test.ts +0 -101
- package/tests/daemon.test.ts +0 -135
- package/tests/deepbrain-wire.test.ts +0 -234
- package/tests/deploy-and-dag.test.ts +0 -196
- package/tests/doctor.test.ts +0 -38
- package/tests/document-processor.test.ts +0 -69
- package/tests/e2e-nocode.test.ts +0 -442
- package/tests/e2e.test.ts +0 -134
- package/tests/elevated.test.ts +0 -69
- package/tests/errors.test.ts +0 -83
- package/tests/eval.test.ts +0 -173
- package/tests/gateway.test.ts +0 -63
- package/tests/guardrails.test.ts +0 -177
- package/tests/hitl.test.ts +0 -71
- package/tests/home-assistant.test.ts +0 -40
- package/tests/hooks.test.ts +0 -79
- package/tests/i18n.test.ts +0 -41
- package/tests/ide-bridge.test.ts +0 -38
- package/tests/image-generator.test.ts +0 -84
- package/tests/init-role.test.ts +0 -124
- package/tests/integrations.test.ts +0 -249
- package/tests/mcp-client.test.ts +0 -92
- package/tests/mcp-server.test.ts +0 -178
- package/tests/mcp-servers.test.ts +0 -260
- package/tests/mcp.test.ts +0 -54
- package/tests/node-network.test.ts +0 -74
- package/tests/oad.test.ts +0 -68
- package/tests/performance.test.ts +0 -115
- package/tests/plugin-a2a-enhanced.test.ts +0 -230
- package/tests/plugin.test.ts +0 -74
- package/tests/profiles.test.ts +0 -61
- package/tests/publish.test.ts +0 -231
- package/tests/rl-tools.test.ts +0 -93
- package/tests/room.test.ts +0 -106
- package/tests/runtime.test.ts +0 -42
- package/tests/sandbox-manager.test.ts +0 -46
- package/tests/sandbox.test.ts +0 -46
- package/tests/scheduler.test.ts +0 -200
- package/tests/secrets.test.ts +0 -107
- package/tests/security-enhanced.test.ts +0 -233
- package/tests/security.test.ts +0 -60
- package/tests/settings-api.test.ts +0 -148
- package/tests/setup.test.ts +0 -73
- package/tests/skill-learner.test.ts +0 -161
- package/tests/streaming.test.ts +0 -109
- package/tests/studio.test.ts +0 -402
- package/tests/subagent.test.ts +0 -193
- package/tests/telegram-discord.test.ts +0 -60
- package/tests/telemetry.test.ts +0 -186
- package/tests/templates.test.ts +0 -77
- package/tests/tools/builtin-extended.test.ts +0 -138
- package/tests/user-profiler.test.ts +0 -169
- package/tests/v070.test.ts +0 -76
- package/tests/v090-features.test.ts +0 -254
- package/tests/versioning.test.ts +0 -75
- package/tests/vision.test.ts +0 -61
- package/tests/voice-call.test.ts +0 -47
- package/tests/voice-enhanced.test.ts +0 -169
- package/tests/voice-interaction.test.ts +0 -38
- package/tests/voice.test.ts +0 -61
- package/tests/web-search.test.ts +0 -155
- package/tests/webhook.test.ts +0 -29
- package/tests/workflow-graph.test.ts +0 -279
- package/tests/workflow.test.ts +0 -143
- package/tmp-js-test.js +0 -1532
- package/tmp-sc.js +0 -1716
- package/tutorial/customer-service-agent/README.md +0 -612
- package/tutorial/customer-service-agent/SOUL.md +0 -26
- package/tutorial/customer-service-agent/agent.yaml +0 -63
- package/tutorial/customer-service-agent/package.json +0 -19
- package/tutorial/customer-service-agent/src/index.ts +0 -69
- package/tutorial/customer-service-agent/src/skills/faq.ts +0 -27
- package/tutorial/customer-service-agent/src/skills/ticket.ts +0 -22
- package/tutorial/customer-service-agent/tsconfig.json +0 -14
- package/vitest.config.ts +0 -9
package/tests/agent.test.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { BaseAgent } from '../src/core/agent';
|
|
3
|
-
|
|
4
|
-
describe('BaseAgent', () => {
|
|
5
|
-
it('should start in init state', () => {
|
|
6
|
-
const agent = new BaseAgent({ name: 'test' });
|
|
7
|
-
expect(agent.state).toBe('init');
|
|
8
|
-
expect(agent.name).toBe('test');
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('should transition through lifecycle', async () => {
|
|
12
|
-
const agent = new BaseAgent({ name: 'test' });
|
|
13
|
-
const states: string[] = [];
|
|
14
|
-
agent.on('state:change', (_from, to) => states.push(to));
|
|
15
|
-
|
|
16
|
-
await agent.init();
|
|
17
|
-
expect(agent.state).toBe('ready');
|
|
18
|
-
|
|
19
|
-
await agent.start();
|
|
20
|
-
expect(agent.state).toBe('running');
|
|
21
|
-
|
|
22
|
-
await agent.stop();
|
|
23
|
-
expect(agent.state).toBe('stopped');
|
|
24
|
-
|
|
25
|
-
expect(states).toEqual(['ready', 'running', 'stopped']);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should not start if not ready', async () => {
|
|
29
|
-
const agent = new BaseAgent({ name: 'test' });
|
|
30
|
-
await expect(agent.start()).rejects.toThrow('Cannot start agent in state: init');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should handle messages with stub provider', async () => {
|
|
34
|
-
const agent = new BaseAgent({ name: 'test', systemPrompt: 'Be helpful' });
|
|
35
|
-
await agent.init();
|
|
36
|
-
|
|
37
|
-
const response = await agent.handleMessage({
|
|
38
|
-
id: 'msg_1',
|
|
39
|
-
role: 'user',
|
|
40
|
-
content: 'Hello',
|
|
41
|
-
timestamp: Date.now(),
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
expect(response.role).toBe('assistant');
|
|
45
|
-
expect(response.content).toContain('Hello');
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('should use skills before LLM fallback', async () => {
|
|
49
|
-
const agent = new BaseAgent({ name: 'test' });
|
|
50
|
-
await agent.init();
|
|
51
|
-
|
|
52
|
-
agent.registerSkill({
|
|
53
|
-
name: 'greeter',
|
|
54
|
-
description: 'Greets users',
|
|
55
|
-
execute: async (_ctx, msg) => {
|
|
56
|
-
if (msg.content.toLowerCase().includes('hello')) {
|
|
57
|
-
return { handled: true, response: 'Hi there!', confidence: 1.0 };
|
|
58
|
-
}
|
|
59
|
-
return { handled: false, confidence: 0 };
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const response = await agent.handleMessage({
|
|
64
|
-
id: 'msg_1',
|
|
65
|
-
role: 'user',
|
|
66
|
-
content: 'Hello!',
|
|
67
|
-
timestamp: Date.now(),
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
expect(response.content).toBe('Hi there!');
|
|
71
|
-
});
|
|
72
|
-
});
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
// AG-UI Protocol Tests
|
|
2
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
3
|
-
import {
|
|
4
|
-
AGUIEventEmitter,
|
|
5
|
-
AGUIServer,
|
|
6
|
-
AGUIClient,
|
|
7
|
-
AGUI_EVENT_TYPES,
|
|
8
|
-
isValidEventType,
|
|
9
|
-
} from '../src/protocols/agui';
|
|
10
|
-
import type { AGUIEvent, AGUIRunRequest } from '../src/protocols/agui';
|
|
11
|
-
|
|
12
|
-
// ─── Mock ServerResponse ─────────────────────────────────────
|
|
13
|
-
|
|
14
|
-
function createMockRes() {
|
|
15
|
-
const chunks: string[] = [];
|
|
16
|
-
return {
|
|
17
|
-
chunks,
|
|
18
|
-
writeHead: vi.fn(),
|
|
19
|
-
write: vi.fn((data: string) => { chunks.push(data); return true; }),
|
|
20
|
-
end: vi.fn(),
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function parseSSEChunks(chunks: string[]): AGUIEvent[] {
|
|
25
|
-
return chunks
|
|
26
|
-
.filter(c => c.startsWith('data: '))
|
|
27
|
-
.map(c => JSON.parse(c.slice(6).trim()));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// ─── Tests ───────────────────────────────────────────────────
|
|
31
|
-
|
|
32
|
-
describe('AG-UI Protocol', () => {
|
|
33
|
-
describe('isValidEventType', () => {
|
|
34
|
-
it('should validate known event types', () => {
|
|
35
|
-
expect(isValidEventType('TEXT_MESSAGE_START')).toBe(true);
|
|
36
|
-
expect(isValidEventType('RUN_FINISHED')).toBe(true);
|
|
37
|
-
expect(isValidEventType('CUSTOM')).toBe(true);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should reject unknown event types', () => {
|
|
41
|
-
expect(isValidEventType('UNKNOWN')).toBe(false);
|
|
42
|
-
expect(isValidEventType('')).toBe(false);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('should have all 15 event types', () => {
|
|
46
|
-
expect(AGUI_EVENT_TYPES.length).toBe(15);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
describe('AGUIEventEmitter', () => {
|
|
51
|
-
let res: ReturnType<typeof createMockRes>;
|
|
52
|
-
let emitter: AGUIEventEmitter;
|
|
53
|
-
|
|
54
|
-
beforeEach(() => {
|
|
55
|
-
res = createMockRes();
|
|
56
|
-
emitter = new AGUIEventEmitter(res as any);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('should emit SSE-formatted events', () => {
|
|
60
|
-
emitter.emit({ type: 'RUN_STARTED', runId: 'r1', timestamp: '2025-01-01T00:00:00Z' });
|
|
61
|
-
expect(res.chunks.length).toBe(1);
|
|
62
|
-
expect(res.chunks[0]).toMatch(/^data: \{.*\}\n\n$/);
|
|
63
|
-
const parsed = JSON.parse(res.chunks[0].slice(6));
|
|
64
|
-
expect(parsed.type).toBe('RUN_STARTED');
|
|
65
|
-
expect(parsed.runId).toBe('r1');
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('should emit textStart/textContent/textEnd flow', () => {
|
|
69
|
-
emitter.textStart('msg1');
|
|
70
|
-
emitter.textContent('msg1', 'Hello');
|
|
71
|
-
emitter.textContent('msg1', ' world');
|
|
72
|
-
emitter.textEnd('msg1');
|
|
73
|
-
const events = parseSSEChunks(res.chunks);
|
|
74
|
-
expect(events.length).toBe(4);
|
|
75
|
-
expect(events[0].type).toBe('TEXT_MESSAGE_START');
|
|
76
|
-
expect(events[0].messageId).toBe('msg1');
|
|
77
|
-
expect((events[0] as any).role).toBe('assistant');
|
|
78
|
-
expect(events[1].type).toBe('TEXT_MESSAGE_CONTENT');
|
|
79
|
-
expect((events[1] as any).delta).toBe('Hello');
|
|
80
|
-
expect(events[2].type).toBe('TEXT_MESSAGE_CONTENT');
|
|
81
|
-
expect((events[2] as any).delta).toBe(' world');
|
|
82
|
-
expect(events[3].type).toBe('TEXT_MESSAGE_END');
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('should emit tool call flow', () => {
|
|
86
|
-
emitter.toolCallStart('tc1', 'search');
|
|
87
|
-
emitter.toolCallArgs('tc1', '{"q":"test"}');
|
|
88
|
-
emitter.toolCallEnd('tc1');
|
|
89
|
-
const events = parseSSEChunks(res.chunks);
|
|
90
|
-
expect(events.length).toBe(3);
|
|
91
|
-
expect(events[0].type).toBe('TOOL_CALL_START');
|
|
92
|
-
expect((events[0] as any).toolCallName).toBe('search');
|
|
93
|
-
expect(events[1].type).toBe('TOOL_CALL_ARGS');
|
|
94
|
-
expect(events[2].type).toBe('TOOL_CALL_END');
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('should emit runStarted/runFinished', () => {
|
|
98
|
-
emitter.runStarted('r1', 'thread1');
|
|
99
|
-
emitter.runFinished('r1');
|
|
100
|
-
const events = parseSSEChunks(res.chunks);
|
|
101
|
-
expect(events[0].type).toBe('RUN_STARTED');
|
|
102
|
-
expect((events[0] as any).threadId).toBe('thread1');
|
|
103
|
-
expect(events[1].type).toBe('RUN_FINISHED');
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('should emit runError', () => {
|
|
107
|
-
emitter.runError('r1', 'Something went wrong', 'INTERNAL');
|
|
108
|
-
const events = parseSSEChunks(res.chunks);
|
|
109
|
-
expect(events[0].type).toBe('RUN_ERROR');
|
|
110
|
-
expect((events[0] as any).message).toBe('Something went wrong');
|
|
111
|
-
expect((events[0] as any).code).toBe('INTERNAL');
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('should emit stateSnapshot', () => {
|
|
115
|
-
emitter.stateSnapshot({ count: 42 });
|
|
116
|
-
const events = parseSSEChunks(res.chunks);
|
|
117
|
-
expect(events[0].type).toBe('STATE_SNAPSHOT');
|
|
118
|
-
expect((events[0] as any).snapshot.count).toBe(42);
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
it('should emit stateDelta', () => {
|
|
122
|
-
emitter.stateDelta([{ op: 'replace', path: '/count', value: 43 }]);
|
|
123
|
-
const events = parseSSEChunks(res.chunks);
|
|
124
|
-
expect(events[0].type).toBe('STATE_DELTA');
|
|
125
|
-
expect((events[0] as any).delta[0].op).toBe('replace');
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('should not emit after close', () => {
|
|
129
|
-
emitter.close();
|
|
130
|
-
emitter.textStart('msg1');
|
|
131
|
-
expect(res.chunks.length).toBe(0);
|
|
132
|
-
expect(res.end).toHaveBeenCalled();
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
it('should include timestamp on convenience methods', () => {
|
|
136
|
-
emitter.textStart('msg1');
|
|
137
|
-
const events = parseSSEChunks(res.chunks);
|
|
138
|
-
expect(events[0].timestamp).toBeDefined();
|
|
139
|
-
expect(typeof events[0].timestamp).toBe('string');
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
it('should emit step events', () => {
|
|
143
|
-
emitter.stepStarted('s1', 'process');
|
|
144
|
-
emitter.stepFinished('s1');
|
|
145
|
-
const events = parseSSEChunks(res.chunks);
|
|
146
|
-
expect(events[0].type).toBe('STEP_STARTED');
|
|
147
|
-
expect((events[0] as any).stepName).toBe('process');
|
|
148
|
-
expect(events[1].type).toBe('STEP_FINISHED');
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('should emit custom events', () => {
|
|
152
|
-
emitter.custom('my_event', { foo: 'bar' });
|
|
153
|
-
const events = parseSSEChunks(res.chunks);
|
|
154
|
-
expect(events[0].type).toBe('CUSTOM');
|
|
155
|
-
expect((events[0] as any).name).toBe('my_event');
|
|
156
|
-
expect((events[0] as any).value.foo).toBe('bar');
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it('should emit messagesSnapshot', () => {
|
|
160
|
-
emitter.messagesSnapshot([{ id: 'm1', role: 'user', content: 'hi' }]);
|
|
161
|
-
const events = parseSSEChunks(res.chunks);
|
|
162
|
-
expect(events[0].type).toBe('MESSAGES_SNAPSHOT');
|
|
163
|
-
expect((events[0] as any).messages[0].content).toBe('hi');
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
describe('AGUIServer', () => {
|
|
168
|
-
it('should construct with default path', () => {
|
|
169
|
-
const mockAgent = { handleMessage: vi.fn(), handleMessageStream: vi.fn() };
|
|
170
|
-
const server = new AGUIServer(mockAgent as any);
|
|
171
|
-
expect(server).toBeDefined();
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
it('should handle run request with mock agent', async () => {
|
|
175
|
-
const mockAgent = {
|
|
176
|
-
handleMessage: vi.fn().mockResolvedValue({ content: 'Hello!' }),
|
|
177
|
-
handleMessageStream: async function* () { yield 'Hel'; yield 'lo!'; },
|
|
178
|
-
};
|
|
179
|
-
const server = new AGUIServer(mockAgent as any);
|
|
180
|
-
const res = createMockRes();
|
|
181
|
-
|
|
182
|
-
// Simulate request
|
|
183
|
-
const body = JSON.stringify({
|
|
184
|
-
messages: [{ id: 'msg1', role: 'user', content: 'Hi' }],
|
|
185
|
-
});
|
|
186
|
-
const req = {
|
|
187
|
-
[Symbol.asyncIterator]: async function* () { yield body; },
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
await server.handleRun(req as any, res as any);
|
|
191
|
-
|
|
192
|
-
expect(res.writeHead).toHaveBeenCalledWith(200, expect.objectContaining({
|
|
193
|
-
'Content-Type': 'text/event-stream',
|
|
194
|
-
}));
|
|
195
|
-
|
|
196
|
-
const events = parseSSEChunks(res.chunks);
|
|
197
|
-
const types = events.map(e => e.type);
|
|
198
|
-
expect(types).toContain('RUN_STARTED');
|
|
199
|
-
expect(types).toContain('TEXT_MESSAGE_START');
|
|
200
|
-
expect(types).toContain('TEXT_MESSAGE_CONTENT');
|
|
201
|
-
expect(types).toContain('TEXT_MESSAGE_END');
|
|
202
|
-
expect(types).toContain('RUN_FINISHED');
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
it('should return 400 for invalid JSON', async () => {
|
|
206
|
-
const mockAgent = { handleMessage: vi.fn() };
|
|
207
|
-
const server = new AGUIServer(mockAgent as any);
|
|
208
|
-
const res = createMockRes();
|
|
209
|
-
const req = { [Symbol.asyncIterator]: async function* () { yield 'not json'; } };
|
|
210
|
-
|
|
211
|
-
await server.handleRun(req as any, res as any);
|
|
212
|
-
expect(res.writeHead).toHaveBeenCalledWith(400, expect.any(Object));
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
it('should return 400 for missing messages', async () => {
|
|
216
|
-
const mockAgent = { handleMessage: vi.fn() };
|
|
217
|
-
const server = new AGUIServer(mockAgent as any);
|
|
218
|
-
const res = createMockRes();
|
|
219
|
-
const req = { [Symbol.asyncIterator]: async function* () { yield '{}'; } };
|
|
220
|
-
|
|
221
|
-
await server.handleRun(req as any, res as any);
|
|
222
|
-
expect(res.writeHead).toHaveBeenCalledWith(400, expect.any(Object));
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
describe('AGUIClient', () => {
|
|
227
|
-
it('should construct with endpoint', () => {
|
|
228
|
-
const client = new AGUIClient('http://localhost:3000/agui');
|
|
229
|
-
expect(client).toBeDefined();
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
it('should abort cleanly', () => {
|
|
233
|
-
const client = new AGUIClient('http://localhost:3000/agui');
|
|
234
|
-
// Should not throw when no active request
|
|
235
|
-
client.abort();
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
describe('Protocol list includes agui', () => {
|
|
240
|
-
it('should have agui in AGUI_EVENT_TYPES constants', () => {
|
|
241
|
-
expect(AGUI_EVENT_TYPES).toContain('TEXT_MESSAGE_START');
|
|
242
|
-
expect(AGUI_EVENT_TYPES).toContain('RUN_STARTED');
|
|
243
|
-
expect(AGUI_EVENT_TYPES).toContain('TOOL_CALL_START');
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
});
|
package/tests/analytics.test.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { Analytics } from '../src/analytics';
|
|
3
|
-
|
|
4
|
-
describe('Analytics', () => {
|
|
5
|
-
it('should track messages', () => {
|
|
6
|
-
const analytics = new Analytics();
|
|
7
|
-
analytics.recordMessage(100);
|
|
8
|
-
analytics.recordMessage(200);
|
|
9
|
-
const snap = analytics.getSnapshot();
|
|
10
|
-
expect(snap.messagesProcessed).toBe(2);
|
|
11
|
-
expect(snap.avgResponseTimeMs).toBe(150);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('should track skill usage', () => {
|
|
15
|
-
const analytics = new Analytics();
|
|
16
|
-
analytics.recordSkillUsage('faq');
|
|
17
|
-
analytics.recordSkillUsage('faq');
|
|
18
|
-
analytics.recordSkillUsage('handoff');
|
|
19
|
-
const snap = analytics.getSnapshot();
|
|
20
|
-
expect(snap.skillUsage['faq']).toBe(2);
|
|
21
|
-
expect(snap.skillUsage['handoff']).toBe(1);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should track errors', () => {
|
|
25
|
-
const analytics = new Analytics();
|
|
26
|
-
analytics.recordError();
|
|
27
|
-
analytics.recordError();
|
|
28
|
-
expect(analytics.getSnapshot().errorCount).toBe(2);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('should track token usage', () => {
|
|
32
|
-
const analytics = new Analytics();
|
|
33
|
-
analytics.recordTokens(100, 50);
|
|
34
|
-
analytics.recordTokens(200, 100);
|
|
35
|
-
const snap = analytics.getSnapshot();
|
|
36
|
-
expect(snap.tokenUsage.input).toBe(300);
|
|
37
|
-
expect(snap.tokenUsage.output).toBe(150);
|
|
38
|
-
expect(snap.tokenUsage.total).toBe(450);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('should reset analytics', () => {
|
|
42
|
-
const analytics = new Analytics();
|
|
43
|
-
analytics.recordMessage(100);
|
|
44
|
-
analytics.recordError();
|
|
45
|
-
analytics.reset();
|
|
46
|
-
const snap = analytics.getSnapshot();
|
|
47
|
-
expect(snap.messagesProcessed).toBe(0);
|
|
48
|
-
expect(snap.errorCount).toBe(0);
|
|
49
|
-
});
|
|
50
|
-
});
|
package/tests/api-server.test.ts
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
2
|
-
import { APIServer } from '../src/core/api-server';
|
|
3
|
-
|
|
4
|
-
function createMockAgent(overrides: any = {}) {
|
|
5
|
-
return {
|
|
6
|
-
name: 'test-agent',
|
|
7
|
-
state: 'running',
|
|
8
|
-
config: { model: 'test-model', name: 'test-agent' },
|
|
9
|
-
chat: async (msg: string) => `echo: ${msg}`,
|
|
10
|
-
...overrides,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async function request(port: number, method: string, path: string, body?: any, headers?: Record<string, string>) {
|
|
15
|
-
const res = await fetch(`http://127.0.0.1:${port}${path}`, {
|
|
16
|
-
method,
|
|
17
|
-
headers: { 'Content-Type': 'application/json', ...headers },
|
|
18
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
19
|
-
});
|
|
20
|
-
return res;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
describe('APIServer', () => {
|
|
24
|
-
let server: APIServer;
|
|
25
|
-
const port = 19876;
|
|
26
|
-
|
|
27
|
-
beforeAll(async () => {
|
|
28
|
-
server = new APIServer({ port, host: '127.0.0.1', agent: createMockAgent() });
|
|
29
|
-
await server.start();
|
|
30
|
-
});
|
|
31
|
-
afterAll(async () => { await server.stop(); });
|
|
32
|
-
|
|
33
|
-
it('GET /health returns ok', async () => {
|
|
34
|
-
const res = await request(port, 'GET', '/health');
|
|
35
|
-
expect(res.status).toBe(200);
|
|
36
|
-
const data: any = await res.json();
|
|
37
|
-
expect(data.status).toBe('ok');
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('GET /v1/models lists models', async () => {
|
|
41
|
-
const res = await request(port, 'GET', '/v1/models');
|
|
42
|
-
const data: any = await res.json();
|
|
43
|
-
expect(data.object).toBe('list');
|
|
44
|
-
expect(data.data[0].id).toBe('test-model');
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('GET /v1/agent/status returns agent info', async () => {
|
|
48
|
-
const res = await request(port, 'GET', '/v1/agent/status');
|
|
49
|
-
const data: any = await res.json();
|
|
50
|
-
expect(data.name).toBe('test-agent');
|
|
51
|
-
expect(data.state).toBe('running');
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('POST /v1/chat/completions non-streaming', async () => {
|
|
55
|
-
const res = await request(port, 'POST', '/v1/chat/completions', {
|
|
56
|
-
model: 'test-model',
|
|
57
|
-
messages: [{ role: 'user', content: 'hello' }],
|
|
58
|
-
});
|
|
59
|
-
expect(res.status).toBe(200);
|
|
60
|
-
const data: any = await res.json();
|
|
61
|
-
expect(data.choices[0].message.content).toBe('echo: hello');
|
|
62
|
-
expect(data.choices[0].finish_reason).toBe('stop');
|
|
63
|
-
expect(data.id).toMatch(/^chatcmpl-/);
|
|
64
|
-
expect(data.object).toBe('chat.completion');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('POST /v1/chat/completions streaming', async () => {
|
|
68
|
-
const res = await request(port, 'POST', '/v1/chat/completions', {
|
|
69
|
-
messages: [{ role: 'user', content: 'hi' }],
|
|
70
|
-
stream: true,
|
|
71
|
-
});
|
|
72
|
-
expect(res.status).toBe(200);
|
|
73
|
-
expect(res.headers.get('content-type')).toBe('text/event-stream');
|
|
74
|
-
const text = await res.text();
|
|
75
|
-
expect(text).toContain('data: ');
|
|
76
|
-
expect(text).toContain('[DONE]');
|
|
77
|
-
// Parse SSE chunks
|
|
78
|
-
const chunks = text.split('\n').filter(l => l.startsWith('data: ') && !l.includes('[DONE]'));
|
|
79
|
-
expect(chunks.length).toBeGreaterThan(0);
|
|
80
|
-
const first = JSON.parse(chunks[0].slice(6));
|
|
81
|
-
expect(first.object).toBe('chat.completion.chunk');
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('POST /v1/chat/completions rejects missing messages', async () => {
|
|
85
|
-
const res = await request(port, 'POST', '/v1/chat/completions', { model: 'x' });
|
|
86
|
-
expect(res.status).toBe(400);
|
|
87
|
-
const data: any = await res.json();
|
|
88
|
-
expect(data.error.type).toBe('invalid_request_error');
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('POST /v1/chat/completions rejects invalid JSON', async () => {
|
|
92
|
-
const res = await fetch(`http://127.0.0.1:${port}/v1/chat/completions`, {
|
|
93
|
-
method: 'POST',
|
|
94
|
-
headers: { 'Content-Type': 'application/json' },
|
|
95
|
-
body: 'not json',
|
|
96
|
-
});
|
|
97
|
-
expect(res.status).toBe(400);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('OPTIONS returns CORS headers', async () => {
|
|
101
|
-
const res = await fetch(`http://127.0.0.1:${port}/v1/models`, { method: 'OPTIONS' });
|
|
102
|
-
expect(res.status).toBe(204);
|
|
103
|
-
expect(res.headers.get('access-control-allow-origin')).toBe('*');
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('unknown route returns 404', async () => {
|
|
107
|
-
const res = await request(port, 'GET', '/v1/unknown');
|
|
108
|
-
expect(res.status).toBe(404);
|
|
109
|
-
const data: any = await res.json();
|
|
110
|
-
expect(data.error.code).toBe(404);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('POST /v1/embeddings returns 501 without embed provider', async () => {
|
|
114
|
-
const res = await request(port, 'POST', '/v1/embeddings', { input: 'hello' });
|
|
115
|
-
expect(res.status).toBe(501);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it('POST /v1/embeddings rejects missing input', async () => {
|
|
119
|
-
const res = await request(port, 'POST', '/v1/embeddings', { model: 'x' });
|
|
120
|
-
expect(res.status).toBe(400);
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
describe('APIServer with auth', () => {
|
|
125
|
-
let server: APIServer;
|
|
126
|
-
const port = 19877;
|
|
127
|
-
|
|
128
|
-
beforeAll(async () => {
|
|
129
|
-
server = new APIServer({ port, host: '127.0.0.1', apiKey: 'secret-key', agent: createMockAgent() });
|
|
130
|
-
await server.start();
|
|
131
|
-
});
|
|
132
|
-
afterAll(async () => { await server.stop(); });
|
|
133
|
-
|
|
134
|
-
it('rejects unauthenticated requests', async () => {
|
|
135
|
-
const res = await request(port, 'GET', '/v1/models');
|
|
136
|
-
expect(res.status).toBe(401);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('accepts valid Bearer token', async () => {
|
|
140
|
-
const res = await request(port, 'GET', '/v1/models', undefined, { Authorization: 'Bearer secret-key' });
|
|
141
|
-
expect(res.status).toBe(200);
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it('health check works without auth', async () => {
|
|
145
|
-
const res = await request(port, 'GET', '/health');
|
|
146
|
-
expect(res.status).toBe(200);
|
|
147
|
-
});
|
|
148
|
-
});
|
package/tests/approvals.test.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { ExecApprovalManager } from '../src/security/approvals';
|
|
3
|
-
|
|
4
|
-
describe('ExecApprovalManager', () => {
|
|
5
|
-
it('should default to elevated-only policy', () => {
|
|
6
|
-
const mgr = new ExecApprovalManager();
|
|
7
|
-
expect(mgr.getPolicy()).toBe('elevated-only');
|
|
8
|
-
mgr.destroy();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('should require approval for elevated commands in elevated-only mode', () => {
|
|
12
|
-
const mgr = new ExecApprovalManager({ policy: 'elevated-only' });
|
|
13
|
-
expect(mgr.needsApproval('ls', true)).toBe(true);
|
|
14
|
-
expect(mgr.needsApproval('ls', false)).toBe(false);
|
|
15
|
-
mgr.destroy();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should always require approval in always mode', () => {
|
|
19
|
-
const mgr = new ExecApprovalManager({ policy: 'always' });
|
|
20
|
-
expect(mgr.needsApproval('ls', false)).toBe(true);
|
|
21
|
-
mgr.destroy();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should never require approval in never mode', () => {
|
|
25
|
-
const mgr = new ExecApprovalManager({ policy: 'never' });
|
|
26
|
-
expect(mgr.needsApproval('rm -rf /', true)).toBe(false);
|
|
27
|
-
mgr.destroy();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('should skip approval for allowlisted commands', () => {
|
|
31
|
-
const mgr = new ExecApprovalManager({ policy: 'allowlist', allowedCommands: ['git ', 'npm test'] });
|
|
32
|
-
expect(mgr.needsApproval('git pull', false)).toBe(false);
|
|
33
|
-
expect(mgr.needsApproval('rm -rf /', false)).toBe(true);
|
|
34
|
-
mgr.destroy();
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('should create and approve requests', () => {
|
|
38
|
-
const mgr = new ExecApprovalManager();
|
|
39
|
-
const req = mgr.request('sudo reboot', true);
|
|
40
|
-
expect(req.status).toBe('pending');
|
|
41
|
-
expect(mgr.getPending()).toHaveLength(1);
|
|
42
|
-
const approved = mgr.approve(req.id, 'admin');
|
|
43
|
-
expect(approved.status).toBe('approved');
|
|
44
|
-
expect(mgr.getPending()).toHaveLength(0);
|
|
45
|
-
expect(mgr.getHistory()).toHaveLength(1);
|
|
46
|
-
mgr.destroy();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should deny requests', () => {
|
|
50
|
-
const mgr = new ExecApprovalManager();
|
|
51
|
-
const req = mgr.request('rm -rf /', true);
|
|
52
|
-
const denied = mgr.deny(req.id, 'admin', 'too dangerous');
|
|
53
|
-
expect(denied.status).toBe('denied');
|
|
54
|
-
expect(denied.reason).toBe('too dangerous');
|
|
55
|
-
mgr.destroy();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('should throw on double approve', () => {
|
|
59
|
-
const mgr = new ExecApprovalManager();
|
|
60
|
-
const req = mgr.request('test', false);
|
|
61
|
-
mgr.approve(req.id, 'admin');
|
|
62
|
-
expect(() => mgr.approve(req.id, 'admin')).toThrow();
|
|
63
|
-
mgr.destroy();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('should expire pending requests', () => {
|
|
67
|
-
const mgr = new ExecApprovalManager({ expiryMs: 1 });
|
|
68
|
-
const req = mgr.request('test', false);
|
|
69
|
-
// Wait a tick then check
|
|
70
|
-
return new Promise<void>(resolve => {
|
|
71
|
-
setTimeout(() => {
|
|
72
|
-
mgr.checkExpiry();
|
|
73
|
-
expect(mgr.getPending()).toHaveLength(0);
|
|
74
|
-
const found = mgr.getRequest(req.id);
|
|
75
|
-
expect(found?.status).toBe('expired');
|
|
76
|
-
mgr.destroy();
|
|
77
|
-
resolve();
|
|
78
|
-
}, 10);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('should fire onRequest callback', () => {
|
|
83
|
-
let called = false;
|
|
84
|
-
const mgr = new ExecApprovalManager({ onRequest: () => { called = true; } });
|
|
85
|
-
mgr.request('test', false);
|
|
86
|
-
expect(called).toBe(true);
|
|
87
|
-
mgr.destroy();
|
|
88
|
-
});
|
|
89
|
-
});
|
package/tests/audio.test.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { AudioProcessor } from '../src/core/audio';
|
|
3
|
-
|
|
4
|
-
describe('AudioProcessor', () => {
|
|
5
|
-
it('should detect WAV format', () => {
|
|
6
|
-
const wav = Buffer.from('RIFF\x00\x00\x00\x00WAVEfmt ');
|
|
7
|
-
expect(AudioProcessor.detectFormat(wav)).toBe('wav');
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it('should detect MP3 format (ID3)', () => {
|
|
11
|
-
const mp3 = Buffer.from('ID3\x04\x00\x00\x00\x00\x00\x00');
|
|
12
|
-
expect(AudioProcessor.detectFormat(mp3)).toBe('mp3');
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('should return unknown for unrecognized format', () => {
|
|
16
|
-
const unknown = Buffer.from('NOTAFORMAT');
|
|
17
|
-
expect(AudioProcessor.detectFormat(unknown)).toBe('unknown');
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should split buffer into chunks', () => {
|
|
21
|
-
const buf = Buffer.alloc(100, 0x42);
|
|
22
|
-
const chunks = AudioProcessor.split(buf, 30);
|
|
23
|
-
expect(chunks).toHaveLength(4);
|
|
24
|
-
expect(chunks[0].length).toBe(30);
|
|
25
|
-
expect(chunks[3].length).toBe(10);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should throw without provider on transcribe', async () => {
|
|
29
|
-
const proc = new AudioProcessor();
|
|
30
|
-
await expect(proc.transcribe(Buffer.alloc(0))).rejects.toThrow('No transcribe provider');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should call transcribe provider', async () => {
|
|
34
|
-
const proc = new AudioProcessor({
|
|
35
|
-
transcribe: async () => ({ text: 'hello world' }),
|
|
36
|
-
});
|
|
37
|
-
const result = await proc.transcribe(Buffer.alloc(10));
|
|
38
|
-
expect(result.text).toBe('hello world');
|
|
39
|
-
});
|
|
40
|
-
});
|