crewswarm 0.8.1-beta
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/.env.example +155 -0
- package/LICENSE +21 -0
- package/README.md +316 -0
- package/apps/dashboard/dist/assets/chat-core-BwSoInmZ.js +1 -0
- package/apps/dashboard/dist/assets/chat-core-BwSoInmZ.js.br +0 -0
- package/apps/dashboard/dist/assets/cli-process-COMRNPqr.js +1 -0
- package/apps/dashboard/dist/assets/cli-process-COMRNPqr.js.br +0 -0
- package/apps/dashboard/dist/assets/components-CSUb80ze.js +1 -0
- package/apps/dashboard/dist/assets/components-CSUb80ze.js.br +0 -0
- package/apps/dashboard/dist/assets/core-utils-CAVnDoe1.js +1 -0
- package/apps/dashboard/dist/assets/core-utils-CAVnDoe1.js.br +0 -0
- package/apps/dashboard/dist/assets/index-CF0aJRtC.css +1 -0
- package/apps/dashboard/dist/assets/index-CF0aJRtC.css.br +0 -0
- package/apps/dashboard/dist/assets/index-Px49zu76.js +2 -0
- package/apps/dashboard/dist/assets/index-Px49zu76.js.br +0 -0
- package/apps/dashboard/dist/assets/orchestration-Ca2DLWN-.js +1 -0
- package/apps/dashboard/dist/assets/orchestration-Ca2DLWN-.js.br +0 -0
- package/apps/dashboard/dist/assets/setup-wizard-i3eEixlo.js +1 -0
- package/apps/dashboard/dist/assets/setup-wizard-i3eEixlo.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-agents-tab-BThdsdJY.js +1 -0
- package/apps/dashboard/dist/assets/tab-agents-tab-BThdsdJY.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-benchmarks-tab-DfCuAClu.js +1 -0
- package/apps/dashboard/dist/assets/tab-comms-tab-eHpOSBhG.js +1 -0
- package/apps/dashboard/dist/assets/tab-comms-tab-eHpOSBhG.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-contacts-tab-yEegNyO4.js +1 -0
- package/apps/dashboard/dist/assets/tab-contacts-tab-yEegNyO4.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-engines-tab-C3DYxTwy.js +1 -0
- package/apps/dashboard/dist/assets/tab-engines-tab-C3DYxTwy.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-memory-tab-C59BYFQD.js +1 -0
- package/apps/dashboard/dist/assets/tab-memory-tab-C59BYFQD.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-models-tab-9Ur7pXWA.js +1 -0
- package/apps/dashboard/dist/assets/tab-models-tab-9Ur7pXWA.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-pm-loop-tab-D7mnDelU.js +1 -0
- package/apps/dashboard/dist/assets/tab-pm-loop-tab-D7mnDelU.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-projects-tab-C6h2Mv1K.js +1 -0
- package/apps/dashboard/dist/assets/tab-projects-tab-C6h2Mv1K.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-prompts-tab-C0wZvWK3.js +1 -0
- package/apps/dashboard/dist/assets/tab-prompts-tab-C0wZvWK3.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-services-tab-DBj_w3bc.js +1 -0
- package/apps/dashboard/dist/assets/tab-services-tab-DBj_w3bc.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-settings-tab-ezeqAjZk.js +1 -0
- package/apps/dashboard/dist/assets/tab-settings-tab-ezeqAjZk.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-skills-tab-BYdU2whk.js +1 -0
- package/apps/dashboard/dist/assets/tab-skills-tab-BYdU2whk.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-spending-tab-Bg6w9t_p.js +1 -0
- package/apps/dashboard/dist/assets/tab-spending-tab-Bg6w9t_p.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-swarm-chat-tab-BBV9HB2X.js +1 -0
- package/apps/dashboard/dist/assets/tab-swarm-chat-tab-BBV9HB2X.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-swarm-tab-ChqLlEVs.js +1 -0
- package/apps/dashboard/dist/assets/tab-swarm-tab-ChqLlEVs.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-usage-tab-B2UWXenJ.js +1 -0
- package/apps/dashboard/dist/assets/tab-usage-tab-B2UWXenJ.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-waves-tab-SaJDkb4x.js +1 -0
- package/apps/dashboard/dist/assets/tab-waves-tab-SaJDkb4x.js.br +0 -0
- package/apps/dashboard/dist/assets/tab-workflows-tab-6QSXLJ0i.js +1 -0
- package/apps/dashboard/dist/assets/tab-workflows-tab-6QSXLJ0i.js.br +0 -0
- package/apps/dashboard/dist/favicon.png +0 -0
- package/apps/dashboard/dist/index.html +6466 -0
- package/apps/dashboard/dist/index.html.br +0 -0
- package/apps/dashboard/dist/index.html.gz +0 -0
- package/apps/dashboard/dist/signup.html +446 -0
- package/apps/dashboard/index.html +6442 -0
- package/apps/dashboard/package.json +15 -0
- package/apps/dashboard/src/app.js +2823 -0
- package/apps/dashboard/src/app.js.br +0 -0
- package/apps/dashboard/src/app.js.gz +0 -0
- package/apps/dashboard/src/chat/chat-actions.js +1847 -0
- package/apps/dashboard/src/chat/chat-actions.js.br +0 -0
- package/apps/dashboard/src/chat/unified-messages.js +327 -0
- package/apps/dashboard/src/chat/unified-messages.js.br +0 -0
- package/apps/dashboard/src/cli-process.js +208 -0
- package/apps/dashboard/src/cli-process.js.br +0 -0
- package/apps/dashboard/src/cli-process.js.gz +0 -0
- package/apps/dashboard/src/components/active-tasks-panel.js +175 -0
- package/apps/dashboard/src/components/active-tasks-panel.js.br +0 -0
- package/apps/dashboard/src/core/api.js +18 -0
- package/apps/dashboard/src/core/api.js.br +0 -0
- package/apps/dashboard/src/core/dom.js +220 -0
- package/apps/dashboard/src/core/dom.js.br +0 -0
- package/apps/dashboard/src/core/state.js +91 -0
- package/apps/dashboard/src/core/state.js.br +0 -0
- package/apps/dashboard/src/core/task-manager.js +134 -0
- package/apps/dashboard/src/core/task-manager.js.br +0 -0
- package/apps/dashboard/src/orchestration-status.js +127 -0
- package/apps/dashboard/src/orchestration-status.js.br +0 -0
- package/apps/dashboard/src/setup-wizard.js +555 -0
- package/apps/dashboard/src/setup-wizard.js.br +0 -0
- package/apps/dashboard/src/styles.css +2085 -0
- package/apps/dashboard/src/styles.css.br +0 -0
- package/apps/dashboard/src/styles.css.gz +0 -0
- package/apps/dashboard/src/tabs/agents-tab.js +2237 -0
- package/apps/dashboard/src/tabs/agents-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/benchmarks-tab.js +229 -0
- package/apps/dashboard/src/tabs/benchmarks-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/comms-tab.js +955 -0
- package/apps/dashboard/src/tabs/comms-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/contacts-tab.js +654 -0
- package/apps/dashboard/src/tabs/contacts-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/engines-tab.js +175 -0
- package/apps/dashboard/src/tabs/engines-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/memory-tab.js +182 -0
- package/apps/dashboard/src/tabs/memory-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/models-tab.js +441 -0
- package/apps/dashboard/src/tabs/models-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/pm-loop-tab.js +185 -0
- package/apps/dashboard/src/tabs/pm-loop-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/projects-tab.js +663 -0
- package/apps/dashboard/src/tabs/projects-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/projects-tab.js.gz +0 -0
- package/apps/dashboard/src/tabs/prompts-tab.js +160 -0
- package/apps/dashboard/src/tabs/prompts-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/services-tab.js +202 -0
- package/apps/dashboard/src/tabs/services-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/settings-tab.js +803 -0
- package/apps/dashboard/src/tabs/settings-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/skills-tab.js +284 -0
- package/apps/dashboard/src/tabs/skills-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/spending-tab.js +173 -0
- package/apps/dashboard/src/tabs/spending-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/swarm-chat-tab.js +660 -0
- package/apps/dashboard/src/tabs/swarm-chat-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/swarm-tab.js +538 -0
- package/apps/dashboard/src/tabs/swarm-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/usage-tab.js +390 -0
- package/apps/dashboard/src/tabs/usage-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/waves-tab.js +238 -0
- package/apps/dashboard/src/tabs/waves-tab.js.br +0 -0
- package/apps/dashboard/src/tabs/workflows-tab.js +747 -0
- package/apps/dashboard/src/tabs/workflows-tab.js.br +0 -0
- package/apps/vibe/.crew/agent-memory/pipeline.json +249 -0
- package/apps/vibe/.crew/cost.json +17 -0
- package/apps/vibe/.crew/json-parse-metrics.jsonl +22 -0
- package/apps/vibe/.crew/pipeline-metrics.jsonl +22 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-0f90c392-2425-4ae5-850c-bd9d17b1d690.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-1c269dd9-a63f-4fba-af81-5cf08048ef06.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-288a7765-da24-4a22-89bc-1f3cc9b0562c.jsonl +1 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-2c78fd22-a657-4bd1-bc49-0679fb384409.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-3e6fe08d-3264-404a-8df3-aab7efef10e7.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-42eec610-57fe-4e09-9e7e-b315038495c2.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-4438eb4c-ae13-42b1-90e2-b043d8983be8.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-4740a9f5-86e7-44b6-a394-de433e291727.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-49e1da6a-957e-48fd-9220-415019e4f8e2.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-4c9251db-be68-427b-a3fc-a264f2b5778d.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-65e29a57-664d-4196-8109-017e364f182e.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-6aa04bc5-9593-4b1f-b58d-3bf2978cb602.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-6e1cba53-9b70-457e-99e0-59199149dd21.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-749f41cc-4dac-4204-be64-873a6080a0d2.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-74d68121-e181-4864-bd9a-c3211341dfaf.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-8509bc24-142d-4e07-b44a-a50bf99d1103.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-960339c6-07ca-43ce-9900-f6e1702b39b9.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-9c6480a9-7031-4146-b241-825b9a2d1de1.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-9fd42426-8492-4157-9d5f-e1537c060489.jsonl +2 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-ad6d40a3-2f5e-46a9-a345-47caaccc51aa.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-bc606133-8d5b-4535-8d85-f1a29cdaa981.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-c1a13ccd-634a-4d01-a4a7-1177b8a752ff.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-c7d27b42-249e-4bd4-8f26-6aa998110b8a.jsonl +5 -0
- package/apps/vibe/.crew/pipeline-runs/pipeline-cca2e9b9-4a34-4d25-a311-5c793fa7e91e.jsonl +5 -0
- package/apps/vibe/.crew/sandbox.json +7 -0
- package/apps/vibe/.crew/session.json +285 -0
- package/apps/vibe/.crew/training-data.jsonl +0 -0
- package/apps/vibe/.github/workflows/studio-quality.yml +37 -0
- package/apps/vibe/.studio-data/project-messages/chuck-norris.jsonl +12 -0
- package/apps/vibe/.studio-data/project-messages/general.jsonl +54 -0
- package/apps/vibe/.studio-data/project-messages/studio-local.jsonl +10 -0
- package/apps/vibe/ARCHITECTURE.md +3393 -0
- package/apps/vibe/QUICK-REFERENCE.md +211 -0
- package/apps/vibe/README.md +76 -0
- package/apps/vibe/ROADMAP.md +41 -0
- package/apps/vibe/STUDIO-SETUP-COMPLETE.md +35 -0
- package/apps/vibe/VISUAL-GUIDE.md +378 -0
- package/apps/vibe/capture-demo.mjs +160 -0
- package/apps/vibe/capture-vibe-assets.mjs +71 -0
- package/apps/vibe/capture-vibe-video.mjs +260 -0
- package/apps/vibe/check-buttons.js +41 -0
- package/apps/vibe/diagnose.html +106 -0
- package/apps/vibe/fix-buttons.js +103 -0
- package/apps/vibe/index.html +3401 -0
- package/apps/vibe/package-lock.json +920 -0
- package/apps/vibe/package.json +31 -0
- package/apps/vibe/public/favicon.png +0 -0
- package/apps/vibe/scripts/studio-pty-host.py +117 -0
- package/apps/vibe/server.mjs +1835 -0
- package/apps/vibe/src/main.js +2846 -0
- package/apps/vibe/src/register-all-languages.js +98 -0
- package/apps/vibe/start-studio.sh +11 -0
- package/apps/vibe/test/accessibility-tests.js +77 -0
- package/apps/vibe/test/browser-performance-audit.mjs +205 -0
- package/apps/vibe/test/performance-tests.js +120 -0
- package/apps/vibe/test/security-tests.js +213 -0
- package/apps/vibe/tests/e2e.local.mjs +54 -0
- package/apps/vibe/tests/server.smoke.mjs +106 -0
- package/apps/vibe/update_website.mjs +74 -0
- package/apps/vibe/vite.config.js +19 -0
- package/apps/vibe/watch-server.mjs +108 -0
- package/contrib/openclaw-plugin/README.md +199 -0
- package/contrib/openclaw-plugin/index.ts +306 -0
- package/contrib/openclaw-plugin/openclaw.plugin.json +41 -0
- package/contrib/openclaw-plugin/package.json +27 -0
- package/contrib/openclaw-plugin/skills/crewswarm/SKILL.md +88 -0
- package/crew-lead.mjs +649 -0
- package/engines/claude-code.json +36 -0
- package/engines/codex.json +37 -0
- package/engines/crew-cli.json +42 -0
- package/engines/cursor.json +40 -0
- package/engines/docker-sandbox.json +38 -0
- package/engines/gemini-cli.json +75 -0
- package/engines/opencode.json +31 -0
- package/gateway-bridge.mjs +1575 -0
- package/install.sh +738 -0
- package/lib/agent-registry.mjs +232 -0
- package/lib/agents/daemon.mjs +121 -0
- package/lib/agents/dispatch.mjs +225 -0
- package/lib/agents/permissions.mjs +90 -0
- package/lib/agents/platform-formatting.mjs +102 -0
- package/lib/agents/registry.mjs +81 -0
- package/lib/agents/tool-instructions.mjs +257 -0
- package/lib/agents/validation.mjs +75 -0
- package/lib/approval/policy-manager.mjs +221 -0
- package/lib/autoharness/index.mjs +391 -0
- package/lib/bridges/cli-executor.mjs +332 -0
- package/lib/bridges/gateway-ws.mjs +345 -0
- package/lib/bridges/integration.mjs +229 -0
- package/lib/bridges/rag-helper.mjs +90 -0
- package/lib/browser/opencode-passthrough-filter.js +44 -0
- package/lib/browser/passthrough-stderr.js +109 -0
- package/lib/chat/autonomous-mentions.mjs +373 -0
- package/lib/chat/history.mjs +82 -0
- package/lib/chat/mention-routing-intent.mjs +136 -0
- package/lib/chat/participants.mjs +95 -0
- package/lib/chat/project-messages-rag.mjs +265 -0
- package/lib/chat/project-messages.mjs +479 -0
- package/lib/chat/shared-chat-prompt-overlay.mjs +52 -0
- package/lib/chat/thread-binding.mjs +34 -0
- package/lib/chat/unified-history.mjs +223 -0
- package/lib/chat/unified-wrapper.mjs +41 -0
- package/lib/cli-process-tracker.mjs +228 -0
- package/lib/collections/index.mjs +433 -0
- package/lib/contacts/identity-linker.mjs +248 -0
- package/lib/contacts/index.mjs +341 -0
- package/lib/crew-judge/PROMPT.md +93 -0
- package/lib/crew-judge/judge.mjs +260 -0
- package/lib/crew-lead/agent-manager.mjs +125 -0
- package/lib/crew-lead/background.mjs +270 -0
- package/lib/crew-lead/brain.mjs +110 -0
- package/lib/crew-lead/chat-handler.mjs +2603 -0
- package/lib/crew-lead/chat-handler.mjs.bak +1274 -0
- package/lib/crew-lead/classifier.mjs +83 -0
- package/lib/crew-lead/http-server.mjs +4824 -0
- package/lib/crew-lead/intent.mjs +102 -0
- package/lib/crew-lead/interval-manager.mjs +41 -0
- package/lib/crew-lead/llm-caller.mjs +544 -0
- package/lib/crew-lead/prompts.mjs +392 -0
- package/lib/crew-lead/retry-manager.mjs +118 -0
- package/lib/crew-lead/tools.mjs +318 -0
- package/lib/crew-lead/wave-dispatcher.mjs +798 -0
- package/lib/crew-lead/waves-config.json +73 -0
- package/lib/crew-lead/waves-loader.mjs +110 -0
- package/lib/crew-lead/ws-router.mjs +428 -0
- package/lib/dispatch/parsers.mjs +299 -0
- package/lib/domain-planning/detector.mjs +196 -0
- package/lib/domain-planning/prompts/crew-pm-cli.md +96 -0
- package/lib/domain-planning/prompts/crew-pm-core.md +122 -0
- package/lib/domain-planning/prompts/crew-pm-frontend.md +111 -0
- package/lib/engines/crew-cli-sandbox.mjs +422 -0
- package/lib/engines/crew-cli.mjs +155 -0
- package/lib/engines/cursor-launcher.mjs +110 -0
- package/lib/engines/engine-registry.mjs +253 -0
- package/lib/engines/llm-direct.mjs +184 -0
- package/lib/engines/opencode.mjs +256 -0
- package/lib/engines/ouroboros.mjs +114 -0
- package/lib/engines/rt-envelope.mjs +1643 -0
- package/lib/engines/rt-envelope.mjs.backup-current +870 -0
- package/lib/engines/runners.mjs +1367 -0
- package/lib/gemini-cli-passthrough-noise.mjs +37 -0
- package/lib/integrations/code-search.mjs +259 -0
- package/lib/integrations/greptile.mjs +148 -0
- package/lib/integrations/multimodal.mjs +313 -0
- package/lib/integrations/telegram-streaming.mjs +153 -0
- package/lib/integrations/tts.mjs +312 -0
- package/lib/integrations/twitter-links.mjs +294 -0
- package/lib/memory/shared-adapter.mjs +296 -0
- package/lib/pipeline/manager.mjs +539 -0
- package/lib/preferences/extractor.mjs +347 -0
- package/lib/project-dir.mjs +20 -0
- package/lib/runtime/config.mjs +388 -0
- package/lib/runtime/dlq.mjs +170 -0
- package/lib/runtime/log-rotation.mjs +82 -0
- package/lib/runtime/logger.mjs +58 -0
- package/lib/runtime/memory.mjs +421 -0
- package/lib/runtime/paths.mjs +76 -0
- package/lib/runtime/project-dir.mjs +127 -0
- package/lib/runtime/spending.mjs +204 -0
- package/lib/runtime/startup-guard.mjs +291 -0
- package/lib/runtime/task-lease.mjs +234 -0
- package/lib/runtime/telemetry-schema.mjs +208 -0
- package/lib/runtime/telemetry.mjs +101 -0
- package/lib/runtime/utils.mjs +64 -0
- package/lib/skills/index.mjs +265 -0
- package/lib/tools/browser.mjs +135 -0
- package/lib/tools/executor.mjs +913 -0
- package/lib/types.d.ts +57 -0
- package/package.json +106 -0
- package/pm-loop.mjs +1626 -0
- package/prompts/coder-back.md +27 -0
- package/prompts/coder-front.md +27 -0
- package/prompts/coder.md +28 -0
- package/prompts/copywriter.md +17 -0
- package/prompts/fixer.md +39 -0
- package/prompts/frontend.md +23 -0
- package/prompts/github.md +24 -0
- package/prompts/main.md +39 -0
- package/prompts/pm-cli.md +95 -0
- package/prompts/pm-core.md +121 -0
- package/prompts/pm-frontend.md +110 -0
- package/prompts/pm.md +234 -0
- package/prompts/qa.md +44 -0
- package/prompts/security.md +19 -0
- package/scripts/build-crew-chat.sh +28 -0
- package/scripts/build-llms-full.mjs +52 -0
- package/scripts/chatmock-login.sh +16 -0
- package/scripts/chatmock-serve.sh +16 -0
- package/scripts/check-dashboard.mjs +88 -0
- package/scripts/crew-scribe.mjs +326 -0
- package/scripts/dashboard-helpers.mjs +391 -0
- package/scripts/dashboard-validation.mjs +198 -0
- package/scripts/dashboard.mjs +9717 -0
- package/scripts/dlq-replay.mjs +61 -0
- package/scripts/doctor.mjs +196 -0
- package/scripts/file-lock.mjs +186 -0
- package/scripts/fresh-machine-smoke.sh +323 -0
- package/scripts/generate-changelog.mjs +227 -0
- package/scripts/generate-openapi.mjs +334 -0
- package/scripts/health-check.mjs +229 -0
- package/scripts/install-docker.sh +213 -0
- package/scripts/mcp-server.mjs +1625 -0
- package/scripts/opencrew-rt-daemon.mjs +568 -0
- package/scripts/openswitchctl +646 -0
- package/scripts/refactor-configs.mjs +39 -0
- package/scripts/release-check.sh +46 -0
- package/scripts/resolve-node-bin.sh +25 -0
- package/scripts/restart-all-from-repo.sh +329 -0
- package/scripts/restart-crew-lead.sh +98 -0
- package/scripts/restart-dashboard.sh +104 -0
- package/scripts/restart-service.sh +274 -0
- package/scripts/run-accessibility-audit.mjs +356 -0
- package/scripts/run-integration-bounded.mjs +188 -0
- package/scripts/run-scheduled-pipeline.mjs +230 -0
- package/scripts/run.mjs +41 -0
- package/scripts/scan-skills.mjs +79 -0
- package/scripts/setup-firewall.sh +128 -0
- package/scripts/smoke-dispatch.mjs +149 -0
- package/scripts/smoke.sh +163 -0
- package/scripts/start-crew.mjs +328 -0
- package/scripts/start.mjs +146 -0
- package/scripts/swiftbar-restart-service.sh +19 -0
- package/scripts/sync-agents.mjs +152 -0
- package/scripts/sync-prompts.mjs +79 -0
- package/scripts/validate-config.mjs +337 -0
- package/scripts/wow.mjs +89 -0
- package/telegram-bridge.mjs +2421 -0
- package/unified-orchestrator.mjs +519 -0
- package/whatsapp-bridge.mjs +1481 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bridge Integration — Modular Project Message Saving
|
|
3
|
+
*
|
|
4
|
+
* Provides a unified interface for all bridges (Telegram, WhatsApp, Slack, Discord)
|
|
5
|
+
* to save conversations to project RAG automatically.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { saveBridgeMessage } from './lib/bridges/integration.mjs';
|
|
9
|
+
* saveBridgeMessage('telegram', projectId, chatId, role, content, agent, metadata);
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { saveProjectMessage } from '../chat/project-messages.mjs';
|
|
13
|
+
import { indexProjectMessage } from '../chat/project-messages-rag.mjs';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Platform-specific configuration
|
|
17
|
+
*/
|
|
18
|
+
const PLATFORM_CONFIG = {
|
|
19
|
+
telegram: {
|
|
20
|
+
enabled: true,
|
|
21
|
+
sourcePrefix: 'telegram-topic',
|
|
22
|
+
excludeAgents: ['crew-loco'], // Chat-only agents
|
|
23
|
+
icon: '📱'
|
|
24
|
+
},
|
|
25
|
+
whatsapp: {
|
|
26
|
+
enabled: true,
|
|
27
|
+
sourcePrefix: 'whatsapp',
|
|
28
|
+
excludeAgents: ['crew-loco'],
|
|
29
|
+
icon: '💬'
|
|
30
|
+
},
|
|
31
|
+
slack: {
|
|
32
|
+
enabled: true,
|
|
33
|
+
sourcePrefix: 'slack-channel',
|
|
34
|
+
excludeAgents: [],
|
|
35
|
+
icon: '🔷'
|
|
36
|
+
},
|
|
37
|
+
discord: {
|
|
38
|
+
enabled: true,
|
|
39
|
+
sourcePrefix: 'discord-channel',
|
|
40
|
+
excludeAgents: [],
|
|
41
|
+
icon: '💜'
|
|
42
|
+
},
|
|
43
|
+
'crew-chat': {
|
|
44
|
+
enabled: true,
|
|
45
|
+
sourcePrefix: 'crew-chat',
|
|
46
|
+
excludeAgents: [],
|
|
47
|
+
icon: '💻'
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Save a message from any bridge to project RAG
|
|
53
|
+
*
|
|
54
|
+
* @param {string} platform - Platform name (telegram, whatsapp, slack, discord)
|
|
55
|
+
* @param {string} projectId - Project ID (or null for multi-project detection)
|
|
56
|
+
* @param {string} chatId - Platform-specific chat/channel ID
|
|
57
|
+
* @param {string} role - 'user' or 'assistant'
|
|
58
|
+
* @param {string} content - Message content
|
|
59
|
+
* @param {string|null} agent - Agent ID if from an agent (e.g., 'crew-pm')
|
|
60
|
+
* @param {object} metadata - Additional metadata (threadId, username, etc.)
|
|
61
|
+
* @returns {boolean} true if saved, false if skipped
|
|
62
|
+
*/
|
|
63
|
+
export function saveBridgeMessage(platform, projectId, chatId, role, content, agent = null, metadata = {}) {
|
|
64
|
+
// Get platform config
|
|
65
|
+
const config = PLATFORM_CONFIG[platform];
|
|
66
|
+
if (!config || !config.enabled) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Skip if agent is excluded (e.g., crew-loco chat-only mode)
|
|
71
|
+
if (agent && config.excludeAgents.includes(agent)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Skip if no project context
|
|
76
|
+
if (!projectId || projectId === 'general' || projectId === 'none') {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
// Build message object
|
|
82
|
+
const message = {
|
|
83
|
+
source: config.sourcePrefix,
|
|
84
|
+
role,
|
|
85
|
+
content,
|
|
86
|
+
agent: agent || null,
|
|
87
|
+
metadata: {
|
|
88
|
+
platform,
|
|
89
|
+
chatId,
|
|
90
|
+
...metadata
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// Save to project messages
|
|
95
|
+
saveProjectMessage(projectId, message);
|
|
96
|
+
|
|
97
|
+
// Index for semantic search
|
|
98
|
+
indexProjectMessage(projectId, message);
|
|
99
|
+
|
|
100
|
+
console.log(`[bridge-integration] ${config.icon} Saved ${platform} message to project "${projectId}" (agent: ${agent || 'user'})`);
|
|
101
|
+
|
|
102
|
+
return true;
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error(`[bridge-integration] Failed to save ${platform} message:`, error.message);
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Check if a platform/agent should save to project RAG
|
|
111
|
+
*
|
|
112
|
+
* @param {string} platform - Platform name
|
|
113
|
+
* @param {string|null} agent - Agent ID
|
|
114
|
+
* @returns {boolean} true if should save
|
|
115
|
+
*/
|
|
116
|
+
export function shouldSaveToProjectRAG(platform, agent = null) {
|
|
117
|
+
const config = PLATFORM_CONFIG[platform];
|
|
118
|
+
if (!config || !config.enabled) return false;
|
|
119
|
+
if (agent && config.excludeAgents.includes(agent)) return false;
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Get all enabled platforms
|
|
125
|
+
* @returns {string[]} List of platform names
|
|
126
|
+
*/
|
|
127
|
+
export function getEnabledPlatforms() {
|
|
128
|
+
return Object.entries(PLATFORM_CONFIG)
|
|
129
|
+
.filter(([_, config]) => config.enabled)
|
|
130
|
+
.map(([platform, _]) => platform);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Register a new platform (for dynamic bridge loading)
|
|
135
|
+
*
|
|
136
|
+
* @param {string} platform - Platform name
|
|
137
|
+
* @param {object} config - Platform configuration
|
|
138
|
+
*/
|
|
139
|
+
export function registerPlatform(platform, config) {
|
|
140
|
+
PLATFORM_CONFIG[platform] = {
|
|
141
|
+
enabled: true,
|
|
142
|
+
sourcePrefix: config.sourcePrefix || platform,
|
|
143
|
+
excludeAgents: config.excludeAgents || [],
|
|
144
|
+
icon: config.icon || '📡'
|
|
145
|
+
};
|
|
146
|
+
console.log(`[bridge-integration] Registered platform: ${platform}`);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Multi-project detection for platforms without explicit project selection
|
|
151
|
+
*
|
|
152
|
+
* When a message mentions a project name or uses dispatch syntax,
|
|
153
|
+
* automatically detect and route to that project.
|
|
154
|
+
*
|
|
155
|
+
* @param {string} content - Message content
|
|
156
|
+
* @param {Array} allProjects - List of all projects { id, name, outputDir }
|
|
157
|
+
* @returns {string|null} Detected project ID or null
|
|
158
|
+
*/
|
|
159
|
+
export function detectProjectFromMessage(content, allProjects) {
|
|
160
|
+
if (!content || !allProjects?.length) return null;
|
|
161
|
+
|
|
162
|
+
const lowerContent = content.toLowerCase();
|
|
163
|
+
|
|
164
|
+
// Pattern 1: Explicit dispatch with project
|
|
165
|
+
// "dispatch crew-coder to website project: implement feature"
|
|
166
|
+
const dispatchMatch = lowerContent.match(/(?:dispatch|send|ask).*?(?:to|for)\s+(\w+[\w-]*)\s+project/i);
|
|
167
|
+
if (dispatchMatch) {
|
|
168
|
+
const projectName = dispatchMatch[1];
|
|
169
|
+
const match = allProjects.find(p =>
|
|
170
|
+
p.name.toLowerCase() === projectName.toLowerCase() ||
|
|
171
|
+
p.id.toLowerCase() === projectName.toLowerCase()
|
|
172
|
+
);
|
|
173
|
+
if (match) return match.id;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Pattern 2: Project mention
|
|
177
|
+
// "work on the api-server project"
|
|
178
|
+
// "in the website project"
|
|
179
|
+
for (const project of allProjects) {
|
|
180
|
+
const projectPattern = new RegExp(`\\b${project.name}\\s+project\\b`, 'i');
|
|
181
|
+
if (projectPattern.test(content)) {
|
|
182
|
+
return project.id;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Pattern 3: File path mentions
|
|
187
|
+
// "edit website/src/index.html"
|
|
188
|
+
for (const project of allProjects) {
|
|
189
|
+
if (project.outputDir) {
|
|
190
|
+
const dirName = project.outputDir.split('/').pop();
|
|
191
|
+
const pathPattern = new RegExp(`\\b${dirName}/`, 'i');
|
|
192
|
+
if (pathPattern.test(content)) {
|
|
193
|
+
return project.id;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Batch save multiple messages (for history sync)
|
|
203
|
+
*
|
|
204
|
+
* @param {string} platform - Platform name
|
|
205
|
+
* @param {string} projectId - Project ID
|
|
206
|
+
* @param {Array} messages - Array of { role, content, agent, metadata }
|
|
207
|
+
* @returns {number} Number of messages saved
|
|
208
|
+
*/
|
|
209
|
+
export function saveBridgeMessages(platform, projectId, messages) {
|
|
210
|
+
if (!projectId || projectId === 'general') return 0;
|
|
211
|
+
|
|
212
|
+
let saved = 0;
|
|
213
|
+
for (const msg of messages) {
|
|
214
|
+
if (saveBridgeMessage(platform, projectId, msg.chatId, msg.role, msg.content, msg.agent, msg.metadata)) {
|
|
215
|
+
saved++;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return saved;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export default {
|
|
223
|
+
saveBridgeMessage,
|
|
224
|
+
shouldSaveToProjectRAG,
|
|
225
|
+
getEnabledPlatforms,
|
|
226
|
+
registerPlatform,
|
|
227
|
+
detectProjectFromMessage,
|
|
228
|
+
saveBridgeMessages
|
|
229
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RAG Helper — fetch codebase context from crew-cli RAG API
|
|
3
|
+
* Shared by: crew-lead, Telegram, WhatsApp, dashboard
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Fetch codebase context from crew-cli RAG API
|
|
8
|
+
* Returns context string or empty string if RAG not available
|
|
9
|
+
*/
|
|
10
|
+
export async function fetchCrewCliRagContext(query, projectDir = process.cwd()) {
|
|
11
|
+
try {
|
|
12
|
+
// Check if coding keywords present
|
|
13
|
+
const codingKeywords = [
|
|
14
|
+
'implement', 'create', 'build', 'write', 'fix', 'refactor',
|
|
15
|
+
'modify', 'update', 'add', 'endpoint', 'function', 'class',
|
|
16
|
+
'component', 'how does', 'where is', 'show me', 'explain'
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const lowerQuery = query.toLowerCase();
|
|
20
|
+
const needsRag = codingKeywords.some(kw => lowerQuery.includes(kw));
|
|
21
|
+
|
|
22
|
+
if (!needsRag) return '';
|
|
23
|
+
|
|
24
|
+
const ragPort = process.env.CREW_CLI_RAG_PORT || process.env.CREW_API_PORT || '4317';
|
|
25
|
+
const ragUrl = `http://127.0.0.1:${ragPort}/api/rag/search?q=${encodeURIComponent(query)}&projectDir=${encodeURIComponent(projectDir)}&mode=import-graph`;
|
|
26
|
+
|
|
27
|
+
// Get auth token if available
|
|
28
|
+
const authToken = getAuthToken();
|
|
29
|
+
const headers = authToken ? { 'Authorization': `Bearer ${authToken}` } : {};
|
|
30
|
+
|
|
31
|
+
const response = await fetch(ragUrl, {
|
|
32
|
+
signal: AbortSignal.timeout(5000), // 5s timeout
|
|
33
|
+
headers
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (!response.ok) {
|
|
37
|
+
console.warn(`[rag-helper] RAG API error: ${response.status}`);
|
|
38
|
+
return '';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const result = await response.json();
|
|
42
|
+
|
|
43
|
+
if (result.filesLoaded?.length > 0) {
|
|
44
|
+
console.log(`[rag-helper] RAG loaded ${result.filesLoaded.length} files: ${result.filesLoaded.slice(0, 3).join(', ')}${result.filesLoaded.length > 3 ? '...' : ''}`);
|
|
45
|
+
return `\n\n## Relevant Code Files (Auto-RAG)\n${result.context}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return '';
|
|
49
|
+
} catch (error) {
|
|
50
|
+
// RAG server not running or timeout - silently skip
|
|
51
|
+
if (error.name === 'TimeoutError' || error.code === 'ECONNREFUSED') {
|
|
52
|
+
// Expected when crew serve is not running
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
55
|
+
console.warn('[rag-helper] RAG API call failed:', error.message);
|
|
56
|
+
return '';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
import { readFileSync } from 'node:fs';
|
|
61
|
+
import { join } from 'node:path';
|
|
62
|
+
import { homedir } from 'node:os';
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Get auth token from config
|
|
66
|
+
*/
|
|
67
|
+
function getAuthToken() {
|
|
68
|
+
try {
|
|
69
|
+
const configPath = join(homedir(), '.crewswarm', 'crewswarm.json');
|
|
70
|
+
const config = JSON.parse(readFileSync(configPath, 'utf8'));
|
|
71
|
+
return config?.rt?.authToken || '';
|
|
72
|
+
} catch {
|
|
73
|
+
return '';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Check if RAG server is available
|
|
79
|
+
*/
|
|
80
|
+
export async function isRagServerAvailable() {
|
|
81
|
+
try {
|
|
82
|
+
const ragPort = process.env.CREW_CLI_RAG_PORT || process.env.CREW_API_PORT || '4317';
|
|
83
|
+
const response = await fetch(`http://127.0.0.1:${ragPort}/health`, {
|
|
84
|
+
signal: AbortSignal.timeout(2000)
|
|
85
|
+
});
|
|
86
|
+
return response.ok;
|
|
87
|
+
} catch {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strip OpenCode / Ink status lines from dashboard passthrough chunks (belt-and-suspenders
|
|
3
|
+
* with crew-lead filtering). See lib/crew-lead/http-server.mjs shouldSkipOpenCodePassthroughLine.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
function stripAnsiPassthrough(text) {
|
|
7
|
+
return String(text || "")
|
|
8
|
+
.replace(/\u001b\[[\d;?]*[ -/]*[@-~]/g, "")
|
|
9
|
+
.replace(/\u001b\][^\u0007]*(?:\u0007|\u001b\\)/g, "");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} line
|
|
14
|
+
* @returns {boolean} true = drop this line from chat
|
|
15
|
+
*/
|
|
16
|
+
export function shouldFilterOpenCodePassthroughLine(line) {
|
|
17
|
+
const t = stripAnsiPassthrough(String(line || "").replace(/\r/g, "")).trim();
|
|
18
|
+
if (!t) return true;
|
|
19
|
+
// "> build", "> run", etc. (allow no space after >)
|
|
20
|
+
if (/^>\s*(build|run|eval|install|pack|starting|sync|watch|plan)\b/i.test(t))
|
|
21
|
+
return true;
|
|
22
|
+
// Same + model id path segment (e.g. moonshotai/kimi-…)
|
|
23
|
+
if (
|
|
24
|
+
/^>\s*(build|run|eval|install|pack|starting|sync|watch|plan)\b.*\/[\w.-]+/i.test(
|
|
25
|
+
t,
|
|
26
|
+
)
|
|
27
|
+
)
|
|
28
|
+
return true;
|
|
29
|
+
// "> label · rest" with common bullet glyphs (U+00B7 middle dot, U+2022 bullet, etc.)
|
|
30
|
+
if (/^>\s*[^\n]+[\u00B7\u2022\u22C5\u2027\u30FB‧⋅]\s*\S/u.test(t)) return true;
|
|
31
|
+
if (/^[─═━\-]{3,}$/.test(t)) return true;
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param {string} engine
|
|
37
|
+
* @param {string} text
|
|
38
|
+
*/
|
|
39
|
+
export function filterOpenCodePassthroughTextChunk(engine, text) {
|
|
40
|
+
if (engine !== "opencode" && engine !== "antigravity") return String(text ?? "");
|
|
41
|
+
const s = String(text ?? "");
|
|
42
|
+
if (!s) return s;
|
|
43
|
+
return s.split("\n").filter((ln) => !shouldFilterOpenCodePassthroughLine(ln)).join("\n");
|
|
44
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared UI helpers for engine CLI passthrough stderr (dashboard + Studio).
|
|
3
|
+
* Mirrors lib/crew-lead/http-server.mjs filtering; adds line buffering for split TCP chunks.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
function normalizeStderrLine(line) {
|
|
7
|
+
return String(line || "").replace(/\r$/, "");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** @param {string} engine */
|
|
11
|
+
export function shouldDropPassthroughStderrLine(engine, line) {
|
|
12
|
+
const l = normalizeStderrLine(line);
|
|
13
|
+
if (!l.trim()) return true;
|
|
14
|
+
if (/rmcp::/i.test(l)) return true;
|
|
15
|
+
if (/error decoding response body.*initialized notification/i.test(l))
|
|
16
|
+
return true;
|
|
17
|
+
if (
|
|
18
|
+
engine === "codex" &&
|
|
19
|
+
/worker quit with fatal/i.test(l) &&
|
|
20
|
+
/rmcp|mcp/i.test(l)
|
|
21
|
+
)
|
|
22
|
+
return true;
|
|
23
|
+
if (
|
|
24
|
+
engine === "codex" &&
|
|
25
|
+
/\/mcp/i.test(l) &&
|
|
26
|
+
/127\.0\.0\.1:\d+|localhost:\d+/i.test(l) &&
|
|
27
|
+
/Connection refused|ConnectError|Transport channel closed|tcp connect error/i.test(l)
|
|
28
|
+
)
|
|
29
|
+
return true;
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function stripAnsi(text) {
|
|
34
|
+
return String(text || "")
|
|
35
|
+
.replace(/\u001b\[[\d;?]*[ -/]*[@-~]/g, "")
|
|
36
|
+
.replace(/\u001b\][^\u0007]*(?:\u0007|\u001b\\)/g, "");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} engine
|
|
41
|
+
* @returns {{ push: (chunk: string) => string, flush: () => string }}
|
|
42
|
+
*/
|
|
43
|
+
export function createPassthroughStderrLineFilter(engine) {
|
|
44
|
+
let partial = "";
|
|
45
|
+
return {
|
|
46
|
+
push(chunk) {
|
|
47
|
+
partial += String(chunk || "");
|
|
48
|
+
const parts = partial.split("\n");
|
|
49
|
+
partial = parts.pop() ?? "";
|
|
50
|
+
const out = [];
|
|
51
|
+
for (const line of parts) {
|
|
52
|
+
if (shouldDropPassthroughStderrLine(engine, line)) continue;
|
|
53
|
+
const cleaned = stripAnsi(normalizeStderrLine(line)).trimEnd();
|
|
54
|
+
if (cleaned) out.push(cleaned);
|
|
55
|
+
}
|
|
56
|
+
return out.length ? `${out.join("\n")}\n` : "";
|
|
57
|
+
},
|
|
58
|
+
flush() {
|
|
59
|
+
const tail = partial;
|
|
60
|
+
partial = "";
|
|
61
|
+
if (!tail) return "";
|
|
62
|
+
if (shouldDropPassthroughStderrLine(engine, tail)) return "";
|
|
63
|
+
const cleaned = stripAnsi(normalizeStderrLine(tail)).trimEnd();
|
|
64
|
+
return cleaned ? `${cleaned}\n` : "";
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function scoreErrorLine(line) {
|
|
70
|
+
const l = String(line || "");
|
|
71
|
+
let s = 0;
|
|
72
|
+
if (/SecItemCopyMatching|keychain|Keychain/i.test(l)) s += 100;
|
|
73
|
+
if (/ERROR:\s|^ERROR\s|error:\s|FATAL|fatal|panic/i.test(l)) s += 45;
|
|
74
|
+
if (/authentication|unauthorized|\b401\b|\b403\b|not logged in/i.test(l))
|
|
75
|
+
s += 30;
|
|
76
|
+
if (/ENOTFOUND|ECONNREFUSED|ECONNRESET|certificate|TLS|SSL/i.test(l))
|
|
77
|
+
s += 25;
|
|
78
|
+
if (/command not found|No such file|ENOENT/i.test(l)) s += 20;
|
|
79
|
+
return s;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Best single line to show when exit !== 0 (after noise filter).
|
|
84
|
+
* @param {string} engine
|
|
85
|
+
*/
|
|
86
|
+
export function summarizePassthroughTopErrorLine(accumulated, engine) {
|
|
87
|
+
const raw = String(accumulated || "");
|
|
88
|
+
const parts = raw.split("\n");
|
|
89
|
+
const kept = [];
|
|
90
|
+
for (const line of parts) {
|
|
91
|
+
if (shouldDropPassthroughStderrLine(engine, line)) continue;
|
|
92
|
+
const c = stripAnsi(normalizeStderrLine(line)).trim();
|
|
93
|
+
if (c) kept.push(c);
|
|
94
|
+
}
|
|
95
|
+
if (!kept.length) return "";
|
|
96
|
+
let best = kept[0];
|
|
97
|
+
let bestScore = scoreErrorLine(best);
|
|
98
|
+
for (const line of kept) {
|
|
99
|
+
const sc = scoreErrorLine(line);
|
|
100
|
+
if (sc > bestScore) {
|
|
101
|
+
bestScore = sc;
|
|
102
|
+
best = line;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (bestScore === 0 && kept.length > 4) {
|
|
106
|
+
return `${kept[0]} (${kept.length} lines)`;
|
|
107
|
+
}
|
|
108
|
+
return best;
|
|
109
|
+
}
|