opc-agent 4.1.2 → 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.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 +72 -11
- 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.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.map +1 -0
- 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.map +1 -0
- 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.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/USABILITY-ISSUES.md +0 -73
- 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 -638
- 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 -2826
- 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 -435
- 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 -243
- 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 -202
- 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/e2e-nocode.test.ts
DELETED
|
@@ -1,442 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* e2e-nocode.test.ts
|
|
3
|
-
* 小白视角端到端测试 / End-to-end tests from a non-coder's perspective
|
|
4
|
-
*
|
|
5
|
-
* 模拟一个完全不懂代码的人使用 OPC Studio 的每一步操作。
|
|
6
|
-
* Simulates every step a non-technical user would take in OPC Studio.
|
|
7
|
-
*
|
|
8
|
-
* All network calls (Ollama, external APIs) are mocked — no real infra needed.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { describe, it, expect, beforeAll, afterAll, beforeEach, afterEach } from 'vitest';
|
|
12
|
-
import { StudioServer } from '../src/studio/server';
|
|
13
|
-
import * as http from 'http';
|
|
14
|
-
import * as fs from 'fs';
|
|
15
|
-
import * as path from 'path';
|
|
16
|
-
import * as os from 'os';
|
|
17
|
-
|
|
18
|
-
// --------------- helpers ---------------
|
|
19
|
-
|
|
20
|
-
const PORT = 19876;
|
|
21
|
-
const FIXTURE_DIR = path.join(__dirname, '__e2e_nocode_fixture__');
|
|
22
|
-
const STATIC_DIR = path.join(FIXTURE_DIR, 'studio-ui');
|
|
23
|
-
|
|
24
|
-
/** Minimal HTTP fetch that works without node-fetch */
|
|
25
|
-
function fetch(
|
|
26
|
-
urlPath: string,
|
|
27
|
-
method = 'GET',
|
|
28
|
-
body?: string | object,
|
|
29
|
-
): Promise<{ status: number; headers: any; body: string; json: () => any }> {
|
|
30
|
-
const bodyStr = body ? (typeof body === 'string' ? body : JSON.stringify(body)) : undefined;
|
|
31
|
-
return new Promise((resolve, reject) => {
|
|
32
|
-
const req = http.request(
|
|
33
|
-
{ hostname: '127.0.0.1', port: PORT, path: `/api/${urlPath}`, method, headers: body ? { 'Content-Type': 'application/json' } : {} },
|
|
34
|
-
(res) => {
|
|
35
|
-
let data = '';
|
|
36
|
-
res.on('data', (c) => (data += c));
|
|
37
|
-
res.on('end', () =>
|
|
38
|
-
resolve({
|
|
39
|
-
status: res.statusCode!,
|
|
40
|
-
headers: res.headers,
|
|
41
|
-
body: data,
|
|
42
|
-
json: () => JSON.parse(data),
|
|
43
|
-
}),
|
|
44
|
-
);
|
|
45
|
-
},
|
|
46
|
-
);
|
|
47
|
-
req.on('error', reject);
|
|
48
|
-
if (bodyStr) req.write(bodyStr);
|
|
49
|
-
req.end();
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** Fetch raw path (not prefixed with /api/) */
|
|
54
|
-
function fetchRaw(urlPath: string): Promise<{ status: number; body: string }> {
|
|
55
|
-
return new Promise((resolve, reject) => {
|
|
56
|
-
http.get({ hostname: '127.0.0.1', port: PORT, path: urlPath }, (res) => {
|
|
57
|
-
let data = '';
|
|
58
|
-
res.on('data', (c) => (data += c));
|
|
59
|
-
res.on('end', () => resolve({ status: res.statusCode!, body: data }));
|
|
60
|
-
}).on('error', reject);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// --------------- setup / teardown ---------------
|
|
65
|
-
|
|
66
|
-
let server: StudioServer;
|
|
67
|
-
|
|
68
|
-
beforeAll(async () => {
|
|
69
|
-
fs.mkdirSync(STATIC_DIR, { recursive: true });
|
|
70
|
-
fs.writeFileSync(path.join(STATIC_DIR, 'index.html'), '<html><body>OPC Studio Dashboard</body></html>');
|
|
71
|
-
fs.writeFileSync(
|
|
72
|
-
path.join(FIXTURE_DIR, 'package.json'),
|
|
73
|
-
JSON.stringify({ name: 'test-nocode', version: '1.0.0', description: 'E2E fixture' }),
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
server = new StudioServer({ port: PORT, agentDir: FIXTURE_DIR, staticDir: STATIC_DIR });
|
|
77
|
-
await server.start();
|
|
78
|
-
await new Promise((r) => setTimeout(r, 300));
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
afterAll(async () => {
|
|
82
|
-
await server.stop();
|
|
83
|
-
fs.rmSync(FIXTURE_DIR, { recursive: true, force: true });
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
// --------------- 场景 1:首次打开 / First Open ---------------
|
|
87
|
-
|
|
88
|
-
describe('场景1: 首次打开 / First Open', () => {
|
|
89
|
-
it('GET / 应该返回 Dashboard 页面 / should serve the dashboard page', async () => {
|
|
90
|
-
const res = await fetchRaw('/');
|
|
91
|
-
expect(res.status).toBe(200);
|
|
92
|
-
expect(res.body).toContain('OPC Studio');
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('没有 Agent 时可以获取列表 / can fetch agent list when none created', async () => {
|
|
96
|
-
const res = await fetch('agents');
|
|
97
|
-
expect(res.status).toBe(200);
|
|
98
|
-
const data = res.json();
|
|
99
|
-
expect(Array.isArray(data) || typeof data === 'object').toBe(true);
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
// --------------- 场景 2:浏览模板市场 / Browse Template Market ---------------
|
|
104
|
-
|
|
105
|
-
describe('场景2: 浏览模板市场 / Template Market', () => {
|
|
106
|
-
it('GET /api/templates 返回 100+ 模板 / returns 100+ templates', async () => {
|
|
107
|
-
const res = await fetch('templates');
|
|
108
|
-
expect(res.status).toBe(200);
|
|
109
|
-
const data = res.json();
|
|
110
|
-
expect(Array.isArray(data.templates || data)).toBe(true);
|
|
111
|
-
const list = data.templates || data;
|
|
112
|
-
expect(list.length).toBeGreaterThanOrEqual(100);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('按行业筛选(technology)/ filter by industry', async () => {
|
|
116
|
-
const res = await fetch('templates?industry=technology');
|
|
117
|
-
expect(res.status).toBe(200);
|
|
118
|
-
const data = res.json();
|
|
119
|
-
const list = data.templates || data;
|
|
120
|
-
expect(list.length).toBeGreaterThan(0);
|
|
121
|
-
list.forEach((t: any) => expect(t.industry).toBe('technology'));
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('搜索关键词 / search by keyword', async () => {
|
|
125
|
-
const res = await fetch('templates?search=support');
|
|
126
|
-
expect(res.status).toBe(200);
|
|
127
|
-
const data = res.json();
|
|
128
|
-
const list = data.templates || data;
|
|
129
|
-
expect(list.length).toBeGreaterThan(0);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it('每个模板有必要字段 / each template has required fields', async () => {
|
|
133
|
-
const res = await fetch('templates');
|
|
134
|
-
const data = res.json();
|
|
135
|
-
const list = data.templates || data;
|
|
136
|
-
const sample = list[0];
|
|
137
|
-
expect(sample).toHaveProperty('name');
|
|
138
|
-
expect(sample).toHaveProperty('description');
|
|
139
|
-
expect(sample).toHaveProperty('industry');
|
|
140
|
-
expect(sample).toHaveProperty('icon');
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
// --------------- 场景 3:3 步创建 Agent / 3-Step Agent Creation ---------------
|
|
145
|
-
|
|
146
|
-
describe('场景3: 3步创建Agent / 3-Step Agent Creation', () => {
|
|
147
|
-
let createdId: string;
|
|
148
|
-
|
|
149
|
-
it('Step1: 选模板创建 Agent / create agent with template', async () => {
|
|
150
|
-
const res = await fetch('agents', 'POST', { template_id: 'tech-support', name: 'My First Agent' });
|
|
151
|
-
expect([200, 201]).toContain(res.status);
|
|
152
|
-
const data = res.json();
|
|
153
|
-
expect(data.id).toBeTruthy();
|
|
154
|
-
createdId = data.id;
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
it('Step2: 验证有默认值 / agent has defaults', async () => {
|
|
158
|
-
expect(createdId).toBeTruthy();
|
|
159
|
-
const res = await fetch(`agents/${createdId}`);
|
|
160
|
-
expect([200, 201]).toContain(res.status);
|
|
161
|
-
const data = res.json();
|
|
162
|
-
expect(data.id || data.name).toBeTruthy();
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('Step3: Agent 数据已持久化 / agent data persisted', async () => {
|
|
166
|
-
expect(createdId).toBeTruthy();
|
|
167
|
-
const res = await fetch(`agents/${createdId}`);
|
|
168
|
-
expect([200, 201]).toContain(res.status);
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it('创建后在列表中可见 / appears in agent list after creation', async () => {
|
|
172
|
-
const res = await fetch('agents');
|
|
173
|
-
expect(res.status).toBe(200);
|
|
174
|
-
const data = res.json();
|
|
175
|
-
const list = Array.isArray(data) ? data : (data.agents || []);
|
|
176
|
-
expect(list.some((a: any) => a.id === createdId)).toBe(true);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
// cleanup
|
|
180
|
-
afterAll(async () => {
|
|
181
|
-
if (createdId) {
|
|
182
|
-
await fetch(`agents/${createdId}`, 'DELETE');
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
// --------------- 场景 4:模型配置 / Model Configuration ---------------
|
|
188
|
-
|
|
189
|
-
describe('场景4: 模型配置 / Model Configuration', () => {
|
|
190
|
-
it('GET /api/settings/models 返回当前配置 / returns current model config', async () => {
|
|
191
|
-
const res = await fetch('settings/models');
|
|
192
|
-
expect(res.status).toBe(200);
|
|
193
|
-
const data = res.json();
|
|
194
|
-
// Should have default values
|
|
195
|
-
expect(data.chatModel || data.mode).toBeTruthy();
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
it('GET /api/settings/models/local 检测本地 Ollama / detect local Ollama', async () => {
|
|
199
|
-
const res = await fetch('settings/models/local');
|
|
200
|
-
expect(res.status).toBe(200);
|
|
201
|
-
const data = res.json();
|
|
202
|
-
// Response should indicate Ollama running state and model list
|
|
203
|
-
expect(data).toHaveProperty('running');
|
|
204
|
-
expect(data).toHaveProperty('models');
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
it('默认值正确 / correct defaults: qwen2.5:7b + nomic-embed-text', async () => {
|
|
208
|
-
const res = await fetch('settings/models');
|
|
209
|
-
const data = res.json();
|
|
210
|
-
expect(data.chatModel).toBe('qwen2.5:7b');
|
|
211
|
-
expect(data.embeddingModel).toBe('nomic-embed-text');
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
it('PUT /api/settings/models 保存配置 / saves model config', async () => {
|
|
215
|
-
const res = await fetch('settings/models', 'PUT', {
|
|
216
|
-
mode: 'local',
|
|
217
|
-
provider: 'ollama',
|
|
218
|
-
chatModel: 'llama3:8b',
|
|
219
|
-
embeddingModel: 'nomic-embed-text',
|
|
220
|
-
});
|
|
221
|
-
expect(res.status).toBe(200);
|
|
222
|
-
|
|
223
|
-
// Read back
|
|
224
|
-
const res2 = await fetch('settings/models');
|
|
225
|
-
const data = res2.json();
|
|
226
|
-
expect(data.chatModel).toBe('llama3:8b');
|
|
227
|
-
|
|
228
|
-
// Restore default
|
|
229
|
-
await fetch('settings/models', 'PUT', {
|
|
230
|
-
mode: 'local',
|
|
231
|
-
provider: 'ollama',
|
|
232
|
-
chatModel: 'qwen2.5:7b',
|
|
233
|
-
embeddingModel: 'nomic-embed-text',
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
it('POST /api/settings/models/test 测试连接 / test model connection', async () => {
|
|
238
|
-
const res = await fetch('settings/models/test', 'POST', {
|
|
239
|
-
provider: 'ollama',
|
|
240
|
-
chatModel: 'qwen2.5:7b',
|
|
241
|
-
});
|
|
242
|
-
expect(res.status).toBe(200);
|
|
243
|
-
const data = res.json();
|
|
244
|
-
// Should return success or error, not crash
|
|
245
|
-
expect(data).toHaveProperty('success');
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
// --------------- 场景 5:渠道配置 / Channel Configuration ---------------
|
|
250
|
-
|
|
251
|
-
describe('场景5: 渠道配置 / Channel Configuration', () => {
|
|
252
|
-
it('GET /api/settings/channels 返回渠道列表 / returns channel list', async () => {
|
|
253
|
-
const res = await fetch('settings/channels');
|
|
254
|
-
expect(res.status).toBe(200);
|
|
255
|
-
const data = res.json();
|
|
256
|
-
// Channels endpoint returns data (may be empty if none configured)
|
|
257
|
-
expect(data).toBeTruthy();
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
it('每个渠道有状态标识 / each channel has status', async () => {
|
|
261
|
-
const res = await fetch('settings/channels');
|
|
262
|
-
const data = res.json();
|
|
263
|
-
const list = Array.isArray(data) ? data : (data.channels || []);
|
|
264
|
-
if (list.length > 0) {
|
|
265
|
-
const ch = list[0];
|
|
266
|
-
expect(ch.name || ch.id || ch.type).toBeTruthy();
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
it('PUT /api/settings/channels/:name 保存渠道配置 / save channel config', async () => {
|
|
271
|
-
const res = await fetch('settings/channels/telegram', 'PUT', {
|
|
272
|
-
token: 'test-token-12345',
|
|
273
|
-
enabled: true,
|
|
274
|
-
});
|
|
275
|
-
expect(res.status).toBe(200);
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
// --------------- 场景 6:对话 / Chat ---------------
|
|
280
|
-
|
|
281
|
-
describe('场景6: 对话 / Chat', () => {
|
|
282
|
-
let agentId: string;
|
|
283
|
-
|
|
284
|
-
beforeAll(async () => {
|
|
285
|
-
const res = await fetch('agents', 'POST', { template_id: 'tech-support', name: 'Chat Test Agent' });
|
|
286
|
-
agentId = res.json().id;
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
afterAll(async () => {
|
|
290
|
-
if (agentId) await fetch(`agents/${agentId}`, 'DELETE');
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
it('POST /api/agents/:id/chat 返回响应 / returns chat response', async () => {
|
|
294
|
-
const res = await fetch(`agents/${agentId}/chat`, 'POST', { message: 'Hello!' });
|
|
295
|
-
// SSE or JSON response — should not be 404/500
|
|
296
|
-
expect([200, 201]).toContain(res.status);
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
it('空消息应该报错 / empty message should error', async () => {
|
|
300
|
-
const res = await fetch(`agents/${agentId}/chat`, 'POST', { message: '' });
|
|
301
|
-
// Server may reject or accept — at minimum should not crash (5xx)
|
|
302
|
-
expect(res.status).toBeLessThan(500);
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
it('Agent 不存在应该 404 / non-existent agent returns 404', async () => {
|
|
306
|
-
const res = await fetch('agents/nonexistent-id-12345/chat', 'POST', { message: 'hi' });
|
|
307
|
-
expect(res.status).toBe(404);
|
|
308
|
-
});
|
|
309
|
-
});
|
|
310
|
-
|
|
311
|
-
// --------------- 场景 7:运行状态 / Runtime Status ---------------
|
|
312
|
-
|
|
313
|
-
describe('场景7: 运行状态 / Runtime Status', () => {
|
|
314
|
-
it('GET /api/settings/status 返回运行信息 / returns status info', async () => {
|
|
315
|
-
const res = await fetch('settings/status');
|
|
316
|
-
expect(res.status).toBe(200);
|
|
317
|
-
const data = res.json();
|
|
318
|
-
expect(data).toBeTruthy();
|
|
319
|
-
// Should contain uptime or memory info
|
|
320
|
-
expect(data.uptime !== undefined || data.memory !== undefined || data.modules !== undefined).toBe(true);
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
// --------------- 场景 8:用量统计 / Usage Stats ---------------
|
|
325
|
-
|
|
326
|
-
describe('场景8: 用量统计 / Usage Stats', () => {
|
|
327
|
-
it('GET /api/settings/usage 返回用量数据 / returns usage data', async () => {
|
|
328
|
-
const res = await fetch('settings/usage');
|
|
329
|
-
expect(res.status).toBe(200);
|
|
330
|
-
const data = res.json();
|
|
331
|
-
expect(data).toBeTruthy();
|
|
332
|
-
});
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
// --------------- 场景 9:记忆管理入口 / Memory Management ---------------
|
|
336
|
-
|
|
337
|
-
describe('场景9: 记忆管理入口 / Memory Management Entry', () => {
|
|
338
|
-
it('settings/status 包含 DeepBrain 模块信息 / status includes DeepBrain module', async () => {
|
|
339
|
-
const res = await fetch('settings/status');
|
|
340
|
-
expect(res.status).toBe(200);
|
|
341
|
-
const data = res.json();
|
|
342
|
-
// DeepBrain should be listed in modules
|
|
343
|
-
if (data.modules) {
|
|
344
|
-
const brain = data.modules.find((m: any) => m.name === 'DeepBrain' || m.path === 'brain');
|
|
345
|
-
expect(brain).toBeTruthy();
|
|
346
|
-
}
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
|
|
350
|
-
// --------------- 场景 10:角色编辑入口 / Role Editor Entry ---------------
|
|
351
|
-
|
|
352
|
-
describe('场景10: 角色编辑入口 / Role Editor Entry', () => {
|
|
353
|
-
it('settings/status 包含 Workstation 模块信息 / status includes Workstation module', async () => {
|
|
354
|
-
const res = await fetch('settings/status');
|
|
355
|
-
expect(res.status).toBe(200);
|
|
356
|
-
const data = res.json();
|
|
357
|
-
if (data.modules) {
|
|
358
|
-
const ws = data.modules.find((m: any) => m.name === 'Workstation' || m.path === 'workstation');
|
|
359
|
-
expect(ws).toBeTruthy();
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
// --------------- 场景 11:完整流程 / Full E2E Flow ---------------
|
|
365
|
-
|
|
366
|
-
describe('场景11: 完整端到端流程 / Full E2E Flow', () => {
|
|
367
|
-
let agentId: string;
|
|
368
|
-
|
|
369
|
-
it('完整操作链 / full operation chain', async () => {
|
|
370
|
-
// 1. 浏览模板
|
|
371
|
-
const templates = await fetch('templates');
|
|
372
|
-
expect(templates.status).toBe(200);
|
|
373
|
-
|
|
374
|
-
// 2. 创建 Agent
|
|
375
|
-
const create = await fetch('agents', 'POST', { template_id: 'tech-support', name: 'E2E Flow Agent' });
|
|
376
|
-
expect([200, 201]).toContain(create.status);
|
|
377
|
-
agentId = create.json().id;
|
|
378
|
-
|
|
379
|
-
// 3. 查看 Dashboard(agent list)
|
|
380
|
-
const list = await fetch('agents');
|
|
381
|
-
expect(list.status).toBe(200);
|
|
382
|
-
const agents = list.json();
|
|
383
|
-
const agentList = Array.isArray(agents) ? agents : (agents.agents || []);
|
|
384
|
-
expect(agentList.some((a: any) => a.id === agentId)).toBe(true);
|
|
385
|
-
|
|
386
|
-
// 4. 查看模型配置
|
|
387
|
-
const models = await fetch('settings/models');
|
|
388
|
-
expect(models.status).toBe(200);
|
|
389
|
-
|
|
390
|
-
// 5. 查看渠道
|
|
391
|
-
const channels = await fetch('settings/channels');
|
|
392
|
-
expect(channels.status).toBe(200);
|
|
393
|
-
|
|
394
|
-
// 6. 查看状态
|
|
395
|
-
const status = await fetch('settings/status');
|
|
396
|
-
expect(status.status).toBe(200);
|
|
397
|
-
|
|
398
|
-
// 7. 查看用量
|
|
399
|
-
const usage = await fetch('settings/usage');
|
|
400
|
-
expect(usage.status).toBe(200);
|
|
401
|
-
|
|
402
|
-
// Cleanup
|
|
403
|
-
await fetch(`agents/${agentId}`, 'DELETE');
|
|
404
|
-
});
|
|
405
|
-
});
|
|
406
|
-
|
|
407
|
-
// --------------- 场景 12:错误处理 / Error Handling ---------------
|
|
408
|
-
|
|
409
|
-
describe('场景12: 错误处理(小白友好)/ User-Friendly Error Handling', () => {
|
|
410
|
-
it('无效 Agent ID 返回友好错误 / invalid agent ID returns friendly error', async () => {
|
|
411
|
-
const res = await fetch('agents/this-does-not-exist');
|
|
412
|
-
expect(res.status).toBe(404);
|
|
413
|
-
const data = res.json();
|
|
414
|
-
// Should have a message, not a raw stack trace
|
|
415
|
-
expect(data.error || data.message).toBeTruthy();
|
|
416
|
-
expect(res.body).not.toContain('Error:');
|
|
417
|
-
expect(res.body).not.toContain('at Object.');
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
it('缺少必填字段仍能处理 / missing fields handled gracefully', async () => {
|
|
421
|
-
const res = await fetch('agents', 'POST', {});
|
|
422
|
-
// Server should handle it (may create with defaults or reject)
|
|
423
|
-
expect(res.status).toBeLessThan(500);
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
it('模型测试失败返回友好提示 / model test failure gives friendly message', async () => {
|
|
427
|
-
const res = await fetch('settings/models/test', 'POST', {
|
|
428
|
-
provider: 'ollama',
|
|
429
|
-
chatModel: 'nonexistent-model',
|
|
430
|
-
baseUrl: 'http://localhost:99999',
|
|
431
|
-
});
|
|
432
|
-
// Server may return 200 with success:false or 500 — either way should have info
|
|
433
|
-
const data = res.json();
|
|
434
|
-
if (res.status === 200 && !data.success) {
|
|
435
|
-
expect(data.error || data.message).toBeTruthy();
|
|
436
|
-
}
|
|
437
|
-
// If 500, the error should still be parseable JSON (not raw stack)
|
|
438
|
-
if (res.status >= 500) {
|
|
439
|
-
expect(data.error || data.message).toBeTruthy();
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
});
|
package/tests/e2e.test.ts
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeAll, afterAll, vi } from 'vitest';
|
|
2
|
-
import { AgentRuntime } from '../src/core/runtime';
|
|
3
|
-
import { createCustomerServiceConfig } from '../src/templates/customer-service';
|
|
4
|
-
import * as http from 'http';
|
|
5
|
-
import * as fs from 'fs';
|
|
6
|
-
import * as path from 'path';
|
|
7
|
-
import * as yaml from 'js-yaml';
|
|
8
|
-
|
|
9
|
-
function httpPost(url: string, body: any): Promise<{ status: number; body: string }> {
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
const u = new URL(url);
|
|
12
|
-
const postData = JSON.stringify(body);
|
|
13
|
-
const req = http.request(
|
|
14
|
-
{
|
|
15
|
-
hostname: u.hostname,
|
|
16
|
-
port: u.port,
|
|
17
|
-
path: u.pathname,
|
|
18
|
-
method: 'POST',
|
|
19
|
-
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) },
|
|
20
|
-
},
|
|
21
|
-
(res) => {
|
|
22
|
-
let data = '';
|
|
23
|
-
res.on('data', (chunk: Buffer) => (data += chunk.toString()));
|
|
24
|
-
res.on('end', () => resolve({ status: res.statusCode ?? 0, body: data }));
|
|
25
|
-
},
|
|
26
|
-
);
|
|
27
|
-
req.on('error', reject);
|
|
28
|
-
req.write(postData);
|
|
29
|
-
req.end();
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function httpGet(url: string): Promise<{ status: number; body: string }> {
|
|
34
|
-
return new Promise((resolve, reject) => {
|
|
35
|
-
const u = new URL(url);
|
|
36
|
-
http.get({ hostname: u.hostname, port: u.port, path: u.pathname }, (res) => {
|
|
37
|
-
let data = '';
|
|
38
|
-
res.on('data', (chunk: Buffer) => (data += chunk.toString()));
|
|
39
|
-
res.on('end', () => resolve({ status: res.statusCode ?? 0, body: data }));
|
|
40
|
-
}).on('error', reject);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
describe('OPC Agent E2E', () => {
|
|
45
|
-
let runtime: AgentRuntime;
|
|
46
|
-
const port = 3456;
|
|
47
|
-
|
|
48
|
-
beforeAll(async () => {
|
|
49
|
-
// Mock LLM by setting env to use a fake provider
|
|
50
|
-
// We'll test the web channel serves and responds
|
|
51
|
-
const config = createCustomerServiceConfig();
|
|
52
|
-
config.metadata.name = 'test-agent';
|
|
53
|
-
config.spec.channels = [{ type: 'web' as const, port }];
|
|
54
|
-
|
|
55
|
-
runtime = new AgentRuntime();
|
|
56
|
-
// Write temp oad.yaml
|
|
57
|
-
const tmpDir = path.join(__dirname, '..', 'tmp-test');
|
|
58
|
-
fs.mkdirSync(tmpDir, { recursive: true });
|
|
59
|
-
const oadPath = path.join(tmpDir, 'oad.yaml');
|
|
60
|
-
fs.writeFileSync(oadPath, yaml.dump(config));
|
|
61
|
-
|
|
62
|
-
await runtime.loadConfig(oadPath);
|
|
63
|
-
await runtime.initialize();
|
|
64
|
-
await runtime.start();
|
|
65
|
-
|
|
66
|
-
// Clean up temp
|
|
67
|
-
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
68
|
-
}, 15000);
|
|
69
|
-
|
|
70
|
-
afterAll(async () => {
|
|
71
|
-
await runtime.stop();
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it('serves chat UI at /', async () => {
|
|
75
|
-
const res = await httpGet(`http://localhost:${port}/`);
|
|
76
|
-
expect(res.status).toBe(200);
|
|
77
|
-
expect(res.body).toContain('OPC Agent');
|
|
78
|
-
expect(res.body).toContain('<html');
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('health endpoint returns ok', async () => {
|
|
82
|
-
const res = await httpGet(`http://localhost:${port}/health`);
|
|
83
|
-
expect(res.status).toBe(200);
|
|
84
|
-
const data = JSON.parse(res.body);
|
|
85
|
-
expect(data.status).toBe('ok');
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('POST /api/chat returns SSE stream', async () => {
|
|
89
|
-
const res = await httpPost(`http://localhost:${port}/api/chat`, {
|
|
90
|
-
message: 'Hello',
|
|
91
|
-
sessionId: 'test-1',
|
|
92
|
-
});
|
|
93
|
-
// Should get 200 (streaming response or error about API key)
|
|
94
|
-
expect(res.status).toBe(200);
|
|
95
|
-
// Response should contain SSE data lines
|
|
96
|
-
expect(res.body).toContain('data: ');
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('rejects empty message', async () => {
|
|
100
|
-
const res = await httpPost(`http://localhost:${port}/api/chat`, {});
|
|
101
|
-
expect(res.status).toBe(400);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('GET /api/info returns agent name', async () => {
|
|
105
|
-
const res = await httpGet(`http://localhost:${port}/api/info`);
|
|
106
|
-
expect(res.status).toBe(200);
|
|
107
|
-
const data = JSON.parse(res.body);
|
|
108
|
-
expect(data.name).toBe('test-agent');
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
describe('Init template', () => {
|
|
113
|
-
const testDir = path.join(__dirname, '..', 'tmp-init-test');
|
|
114
|
-
|
|
115
|
-
afterAll(() => {
|
|
116
|
-
fs.rmSync(testDir, { recursive: true, force: true });
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
it('creates all expected files', () => {
|
|
120
|
-
// Simulate init
|
|
121
|
-
fs.mkdirSync(testDir, { recursive: true });
|
|
122
|
-
const config = createCustomerServiceConfig();
|
|
123
|
-
config.metadata.name = 'test-init';
|
|
124
|
-
fs.writeFileSync(path.join(testDir, 'oad.yaml'), yaml.dump(config));
|
|
125
|
-
fs.writeFileSync(path.join(testDir, '.env.example'), 'OPC_LLM_API_KEY=test\n');
|
|
126
|
-
fs.writeFileSync(path.join(testDir, 'package.json'), '{}');
|
|
127
|
-
fs.writeFileSync(path.join(testDir, 'README.md'), '# test');
|
|
128
|
-
|
|
129
|
-
expect(fs.existsSync(path.join(testDir, 'oad.yaml'))).toBe(true);
|
|
130
|
-
expect(fs.existsSync(path.join(testDir, '.env.example'))).toBe(true);
|
|
131
|
-
expect(fs.existsSync(path.join(testDir, 'package.json'))).toBe(true);
|
|
132
|
-
expect(fs.existsSync(path.join(testDir, 'README.md'))).toBe(true);
|
|
133
|
-
});
|
|
134
|
-
});
|
package/tests/elevated.test.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { ElevatedManager } from '../src/security/elevated';
|
|
3
|
-
|
|
4
|
-
describe('ElevatedManager', () => {
|
|
5
|
-
it('should default to ask mode', () => {
|
|
6
|
-
const mgr = new ElevatedManager();
|
|
7
|
-
expect(mgr.getMode()).toBe('ask');
|
|
8
|
-
expect(mgr.isElevated()).toBe(false);
|
|
9
|
-
mgr.destroy();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('should elevate and revoke', () => {
|
|
13
|
-
const mgr = new ElevatedManager();
|
|
14
|
-
expect(mgr.elevate('test')).toBe(true);
|
|
15
|
-
expect(mgr.isElevated()).toBe(true);
|
|
16
|
-
mgr.revoke();
|
|
17
|
-
expect(mgr.isElevated()).toBe(false);
|
|
18
|
-
mgr.destroy();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should not elevate in off mode', () => {
|
|
22
|
-
const mgr = new ElevatedManager({ mode: 'off' });
|
|
23
|
-
expect(mgr.elevate()).toBe(false);
|
|
24
|
-
expect(mgr.isElevated()).toBe(false);
|
|
25
|
-
mgr.destroy();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should allow commands in allowedCommands list', () => {
|
|
29
|
-
const mgr = new ElevatedManager({ allowedCommands: [/^git\s/] });
|
|
30
|
-
expect(mgr.isCommandAllowed('git pull')).toBe(true);
|
|
31
|
-
expect(mgr.isCommandAllowed('rm -rf /')).toBe(false);
|
|
32
|
-
mgr.destroy();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should auto-execute in on mode', () => {
|
|
36
|
-
const mgr = new ElevatedManager({ mode: 'on' });
|
|
37
|
-
const result = mgr.canExecute('sudo reboot');
|
|
38
|
-
expect(result.allowed).toBe(true);
|
|
39
|
-
expect(mgr.isElevated()).toBe(true);
|
|
40
|
-
mgr.destroy();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should require elevation in ask mode when not elevated', () => {
|
|
44
|
-
const mgr = new ElevatedManager({ mode: 'ask' });
|
|
45
|
-
const result = mgr.canExecute('sudo reboot');
|
|
46
|
-
expect(result.allowed).toBe(false);
|
|
47
|
-
expect(result.needsElevation).toBe(true);
|
|
48
|
-
mgr.destroy();
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should allow execution in ask mode when elevated', () => {
|
|
52
|
-
const mgr = new ElevatedManager({ mode: 'ask' });
|
|
53
|
-
mgr.elevate();
|
|
54
|
-
const result = mgr.canExecute('sudo reboot');
|
|
55
|
-
expect(result.allowed).toBe(true);
|
|
56
|
-
mgr.destroy();
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('should keep audit log', () => {
|
|
60
|
-
const mgr = new ElevatedManager();
|
|
61
|
-
mgr.elevate('testing');
|
|
62
|
-
mgr.revoke('done');
|
|
63
|
-
const log = mgr.getAuditLog();
|
|
64
|
-
expect(log).toHaveLength(2);
|
|
65
|
-
expect(log[0].action).toBe('elevate');
|
|
66
|
-
expect(log[1].action).toBe('revoke');
|
|
67
|
-
mgr.destroy();
|
|
68
|
-
});
|
|
69
|
-
});
|