@adaptic/maestro 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/init-agent.md +99 -0
- package/.claude/commands/init-maestro.md +565 -0
- package/.claude/settings.json +114 -0
- package/.env.example +152 -0
- package/README.md +491 -0
- package/agents/board-prep/agent.md +80 -0
- package/agents/browser-operator/agent.md +52 -0
- package/agents/calendar-ops/agent.md +50 -0
- package/agents/capital-raising/agent.md +69 -0
- package/agents/ceo-briefing/agent.md +72 -0
- package/agents/communications/agent.md +69 -0
- package/agents/competitive-intelligence/agent.md +49 -0
- package/agents/corporate-development/agent.md +66 -0
- package/agents/decision-log/agent.md +65 -0
- package/agents/desktop-operator/agent.md +59 -0
- package/agents/engineering-coordination/agent.md +51 -0
- package/agents/founder-voice/agent.md +72 -0
- package/agents/fund-ops/agent.md +52 -0
- package/agents/gmail-operator/agent.md +62 -0
- package/agents/hiring-org-design/agent.md +119 -0
- package/agents/inbound-dispatcher/agent.md +66 -0
- package/agents/legal-structuring/agent.md +65 -0
- package/agents/market-research/agent.md +48 -0
- package/agents/partnerships/agent.md +59 -0
- package/agents/platform-architecture/agent.md +57 -0
- package/agents/pmo-execution/agent.md +60 -0
- package/agents/product-strategy/agent.md +50 -0
- package/agents/regulatory-dfsa/agent.md +96 -0
- package/agents/risk-register/agent.md +62 -0
- package/agents/rollup-target-sourcing/agent.md +59 -0
- package/agents/session-spawner/agent.md +64 -0
- package/agents/slack-operator/agent.md +60 -0
- package/agents/sophie-chief-of-staff/agent.md +134 -0
- package/agents/strategic-planning/agent.md +54 -0
- package/agents/whatsapp-operator/agent.md +60 -0
- package/agents/workflow-automation/agent.md +61 -0
- package/bin/maestro.mjs +388 -0
- package/desktop-control/README.md +56 -0
- package/desktop-control/app-profiles/gmail.yaml +120 -0
- package/desktop-control/app-profiles/slack.yaml +315 -0
- package/desktop-control/app-profiles/whatsapp.yaml +107 -0
- package/docs/architecture/agent-topology.md +2222 -0
- package/docs/architecture/continuous-monitoring.md +221 -0
- package/docs/architecture/mcp-capability-map.md +560 -0
- package/docs/architecture/system-architecture.md +1273 -0
- package/docs/business-synthesis/ADAPTIC-GROUP-FINAL-OWNERSHIP-STRUCTURE.pdf +13667 -10
- package/docs/business-synthesis/adaptic-overview.md +296 -0
- package/docs/business-synthesis/executive-operating-model.md +261 -0
- package/docs/governance/action-approval-model.md +331 -0
- package/docs/governance/communications-policy.md +410 -0
- package/docs/governance/desktop-control-safety.md +499 -0
- package/docs/guides/agent-persona-setup.md +600 -0
- package/docs/operating-charter.md +87 -0
- package/docs/prompts/board-pack-cover-template.md +37 -0
- package/docs/prompts/decision-recommendation-template.md +88 -0
- package/docs/prompts/followup-message-template.md +141 -0
- package/docs/prompts/investor-letter-template.md +52 -0
- package/docs/prompts/morning-brief-template.md +82 -0
- package/docs/prompts/presentation-template.md +58 -0
- package/docs/prompts/weekly-strategic-memo-template.md +104 -0
- package/docs/runbooks/mac-mini-bootstrap.md +404 -0
- package/docs/runbooks/perpetual-operations.md +505 -0
- package/docs/runbooks/recovery-and-failover.md +588 -0
- package/docs/superpowers/plans/2026-04-02-phase0-operational-foundation.md +2550 -0
- package/docs/superpowers/plans/2026-04-03-phase1-executive-core.md +1085 -0
- package/docs/superpowers/plans/2026-04-03-phase2-people-product-commercial.md +739 -0
- package/docs/superpowers/plans/2026-04-05-information-barrier-implementation.md +926 -0
- package/docs/superpowers/plans/2026-04-06-session-context-dedup.md +1994 -0
- package/docs/superpowers/specs/2026-04-02-phase0-operational-foundation-design.md +842 -0
- package/docs/superpowers/specs/2026-04-03-phase1-executive-core-design.md +516 -0
- package/docs/superpowers/specs/2026-04-03-phase2-people-product-commercial-design.md +452 -0
- package/docs/superpowers/specs/2026-04-03-phase3-4-final-towers-design.md +129 -0
- package/docs/superpowers/specs/2026-04-05-information-barrier-design.md +678 -0
- package/docs/superpowers/specs/2026-04-05-reactive-daemon-design.md +237 -0
- package/docs/superpowers/specs/2026-04-06-session-context-dedup-design.md +369 -0
- package/docs/workflows/executive-cadence.md +218 -0
- package/ingest/README.md +87 -0
- package/mcp/README.md +51 -0
- package/package.json +48 -0
- package/plugins/maestro-skills/plugin.json +55 -0
- package/plugins/maestro-skills/skills/board-deck.md +68 -0
- package/plugins/maestro-skills/skills/decision-brief.md +89 -0
- package/plugins/maestro-skills/skills/draft-comms.md +84 -0
- package/plugins/maestro-skills/skills/evening-wrap.md +53 -0
- package/plugins/maestro-skills/skills/hiring-triage.md +74 -0
- package/plugins/maestro-skills/skills/inbox-triage.md +61 -0
- package/plugins/maestro-skills/skills/morning-brief.md +54 -0
- package/plugins/maestro-skills/skills/pipeline-review.md +76 -0
- package/plugins/maestro-skills/skills/regulatory-status.md +81 -0
- package/plugins/maestro-skills/skills/schedule-meeting.md +91 -0
- package/plugins/maestro-skills/skills/slack-followup.md +64 -0
- package/plugins/maestro-skills/skills/weekly-memo.md +70 -0
- package/policies/action-classification.yaml +110 -0
- package/policies/information-barriers.yaml +119 -0
- package/policies/prompt-injection-defence.yaml +138 -0
- package/public/assets/adaptic-icon-dark.png +0 -0
- package/public/assets/adaptic-icon-dark.svg +4 -0
- package/public/assets/adaptic-icon-light.svg +4 -0
- package/public/assets/adaptic-logo-dark.svg +17 -0
- package/public/assets/adaptic-logo-light.svg +17 -0
- package/scaffold/CLAUDE.md +21 -0
- package/scaffold/config/agent.ts +69 -0
- package/scaffold/config/agent.ts.example +218 -0
- package/schedules/README.md +49 -0
- package/schedules/triggers/backlog-executor.md +102 -0
- package/schedules/triggers/daily-evening-wrap.md +142 -0
- package/schedules/triggers/daily-midday-sweep.md +58 -0
- package/schedules/triggers/daily-morning-brief.md +55 -0
- package/schedules/triggers/inbox-processor.md +115 -0
- package/schedules/triggers/meeting-action-capture.md +60 -0
- package/schedules/triggers/meeting-prep.md +69 -0
- package/schedules/triggers/quarterly-self-assessment.md +54 -0
- package/schedules/triggers/weekly-engineering-health.md +37 -0
- package/schedules/triggers/weekly-execution.md +67 -0
- package/schedules/triggers/weekly-hiring.md +53 -0
- package/schedules/triggers/weekly-priorities.md +38 -0
- package/schedules/triggers/weekly-strategic-memo.md +124 -0
- package/scripts/__pycache__/disclosure_assessment.cpython-313.pyc +0 -0
- package/scripts/__pycache__/disclosure_boundaries.cpython-313.pyc +0 -0
- package/scripts/__pycache__/email_quote_thread.cpython-313.pyc +0 -0
- package/scripts/__pycache__/email_thread_dedup.cpython-313.pyc +0 -0
- package/scripts/__pycache__/mehran-inbox-poller.cpython-313.pyc +0 -0
- package/scripts/__pycache__/outbound_dedup.cpython-313.pyc +0 -0
- package/scripts/__pycache__/pre-draft-context.cpython-313.pyc +0 -0
- package/scripts/__pycache__/pre_draft_lookup.cpython-313.pyc +0 -0
- package/scripts/__pycache__/send-email-as-mehran.cpython-313.pyc +0 -0
- package/scripts/__pycache__/send-email-threaded.cpython-313.pyc +0 -0
- package/scripts/__pycache__/send-email-with-attachment.cpython-313.pyc +0 -0
- package/scripts/__pycache__/validate_outbound.cpython-313.pyc +0 -0
- package/scripts/airtable-crm-populate.md +99 -0
- package/scripts/archive-email.sh +41 -0
- package/scripts/comms-monitor.sh +285 -0
- package/scripts/configure-whatsapp-sandbox.sh +201 -0
- package/scripts/continuous-monitor.sh +86 -0
- package/scripts/daemon/classifier.mjs +355 -0
- package/scripts/daemon/context-compiler.mjs +490 -0
- package/scripts/daemon/dispatcher.mjs +385 -0
- package/scripts/daemon/health.mjs +72 -0
- package/scripts/daemon/prompt-builder.mjs +426 -0
- package/scripts/daemon/responder.mjs +547 -0
- package/scripts/daemon/session-lock.mjs +520 -0
- package/scripts/daemon/sophie-daemon.mjs +521 -0
- package/scripts/daemon/test-context-compiler.mjs +238 -0
- package/scripts/daemon/test-integration.mjs +130 -0
- package/scripts/daemon/test-session-lock.mjs +215 -0
- package/scripts/disclosure_assessment.py +873 -0
- package/scripts/disclosure_boundaries.py +562 -0
- package/scripts/email-signature-mehran.html +52 -0
- package/scripts/email-signature.html +44 -0
- package/scripts/email_quote_thread.py +167 -0
- package/scripts/email_thread_dedup.py +361 -0
- package/scripts/emergency-stop.sh +41 -0
- package/scripts/healthcheck.sh +110 -0
- package/scripts/hooks/block-mcp-slack-send.sh +7 -0
- package/scripts/hooks/post-action-log.sh +17 -0
- package/scripts/hooks/pre-send-audit.sh +57 -0
- package/scripts/hooks/session-end-log.sh +27 -0
- package/scripts/huddle/audio-bridge.mjs +664 -0
- package/scripts/huddle/boot-slack-cdp.sh +102 -0
- package/scripts/huddle/huddle-controller.mjs +942 -0
- package/scripts/huddle/huddle-server.mjs +1059 -0
- package/scripts/huddle/launch-slack.sh +232 -0
- package/scripts/huddle/node_modules/.package-lock.json +50 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/CHANGELOG.md +1677 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/LICENSE +8 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/README.md +674 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.d.mts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.d.ts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.js +226 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.mjs +223 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/api-promise.d.mts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/api-promise.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/api-promise.d.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/api-promise.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/api-promise.js +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/api-promise.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/api-promise.mjs +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/api-promise.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/bin/cli +53 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/bin/migration-config.json +7 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/client.d.mts +225 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/client.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/client.d.ts +225 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/client.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/client.js +536 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/client.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/client.mjs +531 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/client.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/api-promise.d.mts +49 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/api-promise.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/api-promise.d.ts +49 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/api-promise.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/api-promise.js +76 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/api-promise.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/api-promise.mjs +72 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/api-promise.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/error.d.mts +47 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/error.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/error.d.ts +47 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/error.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/error.js +114 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/error.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/error.mjs +98 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/error.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/pagination.d.mts +63 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/pagination.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/pagination.d.ts +63 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/pagination.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/pagination.js +123 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/pagination.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/pagination.mjs +117 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/pagination.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/resource.d.mts +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/resource.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/resource.d.ts +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/resource.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/resource.js +11 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/resource.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/resource.mjs +7 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/resource.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/streaming.d.mts +31 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/streaming.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/streaming.d.ts +31 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/streaming.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/streaming.js +282 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/streaming.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/streaming.mjs +277 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/streaming.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/uploads.d.mts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/uploads.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/uploads.d.ts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/uploads.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/uploads.js +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/uploads.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/uploads.mjs +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/core/uploads.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/error.d.mts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/error.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/error.d.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/error.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/error.js +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/error.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/error.mjs +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/error.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/index.d.mts +7 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/index.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/index.d.ts +7 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/index.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/index.js +35 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/index.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/index.mjs +8 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/index.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/builtin-types.d.mts +73 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/builtin-types.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/builtin-types.d.ts +73 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/builtin-types.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/builtin-types.js +4 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/builtin-types.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/builtin-types.mjs +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/builtin-types.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/constants.d.mts +5 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/constants.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/constants.d.ts +5 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/constants.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/constants.js +15 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/constants.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/constants.mjs +12 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/constants.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.d.mts +10 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.d.ts +10 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.js +39 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.mjs +35 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/line.d.mts +17 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/line.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/line.d.ts +17 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/line.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/line.js +113 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/line.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/line.mjs +108 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/decoders/line.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/detect-platform.d.mts +15 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/detect-platform.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/detect-platform.d.ts +15 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/detect-platform.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/detect-platform.js +162 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/detect-platform.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs +157 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/errors.d.mts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/errors.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/errors.d.ts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/errors.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/errors.js +41 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/errors.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/errors.mjs +36 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/errors.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/headers.d.mts +22 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/headers.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/headers.d.ts +22 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/headers.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/headers.js +79 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/headers.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/headers.mjs +74 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/headers.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/parse.d.mts +17 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/parse.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/parse.d.ts +17 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/parse.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/parse.js +55 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/parse.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/parse.mjs +51 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/parse.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/request-options.d.mts +34 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/request-options.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/request-options.d.ts +34 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/request-options.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/request-options.js +14 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/request-options.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/request-options.mjs +10 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/request-options.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/shim-types.d.mts +28 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/shim-types.d.ts +28 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/shims.d.mts +20 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/shims.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/shims.d.ts +20 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/shims.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/shims.js +92 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/shims.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/shims.mjs +85 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/shims.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/stream-utils.d.mts +8 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/stream-utils.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/stream-utils.d.ts +8 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/stream-utils.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/stream-utils.js +38 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/stream-utils.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/stream-utils.mjs +35 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/stream-utils.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/to-file.d.mts +45 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/to-file.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/to-file.d.ts +45 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/to-file.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/to-file.js +96 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/to-file.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/to-file.mjs +93 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/to-file.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/tslib.js +81 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/tslib.mjs +17 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/types.d.mts +67 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/types.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/types.d.ts +67 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/types.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/types.js +4 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/types.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/types.mjs +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/types.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/uploads.d.mts +42 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/uploads.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/uploads.d.ts +42 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/uploads.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/uploads.js +146 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/uploads.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/uploads.mjs +136 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/uploads.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/base64.d.mts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/base64.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/base64.d.ts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/base64.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/base64.js +38 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/base64.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/base64.mjs +33 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/base64.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/bytes.d.mts +4 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/bytes.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/bytes.d.ts +4 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/bytes.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/bytes.js +31 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/bytes.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/bytes.mjs +26 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/bytes.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/env.d.mts +9 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/env.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/env.d.ts +9 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/env.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/env.js +22 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/env.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/env.mjs +18 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/env.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/log.d.mts +37 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/log.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/log.d.ts +37 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/log.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/log.js +86 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/log.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/log.mjs +80 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/log.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/path.d.mts +15 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/path.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/path.d.ts +15 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/path.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/path.js +58 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/path.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/path.mjs +53 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/path.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.mts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/sleep.js +7 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/sleep.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/uuid.d.mts +5 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/uuid.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/uuid.d.ts +5 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/uuid.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/uuid.js +19 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/uuid.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/uuid.mjs +15 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/uuid.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/values.d.mts +16 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/values.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/values.d.ts +16 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/values.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/values.js +109 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/values.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs +92 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils.d.mts +7 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils.d.ts +7 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils.js +11 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils.mjs +8 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/internal/utils.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.mts +114 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.ts +114 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js +553 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs +549 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.mts +114 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.ts +114 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/MessageStream.js +553 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/MessageStream.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs +549 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/package.json +185 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/pagination.d.mts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/pagination.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/pagination.d.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/pagination.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/pagination.js +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/pagination.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/pagination.mjs +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/pagination.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resource.d.mts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resource.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resource.d.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resource.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resource.js +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resource.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resource.mjs +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resource.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts +61 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts +61 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/beta.js +25 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/beta.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs +20 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts +151 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts +151 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/files.js +122 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/files.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs +118 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts +5 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts +5 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/index.js +13 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/index.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.mts +343 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.ts +343 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.js +204 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.mjs +200 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.js +9 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.mjs +4 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts +1561 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts +1561 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js +86 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs +81 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages.d.mts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages.d.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages.js +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages.mjs +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/messages.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/models.d.mts +74 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/models.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/models.d.ts +74 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/models.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/models.js +60 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/models.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/models.mjs +56 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta/models.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta.d.mts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta.d.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta.js +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta.mjs +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/beta.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/completions.d.mts +183 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/completions.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/completions.d.ts +183 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/completions.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/completions.js +23 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/completions.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/completions.mjs +19 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/completions.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/index.d.mts +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/index.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/index.d.ts +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/index.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/index.js +15 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/index.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/index.mjs +7 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/index.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.mts +304 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.ts +304 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/batches.js +153 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/batches.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/batches.mjs +149 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/batches.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/index.d.mts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/index.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/index.d.ts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/index.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/index.js +9 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/index.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/index.mjs +4 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/index.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts +1264 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts +1264 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/messages.js +72 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/messages.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs +67 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages.d.mts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages.d.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages.js +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages.mjs +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/messages.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/models.d.mts +59 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/models.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/models.d.ts +59 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/models.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/models.js +45 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/models.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/models.mjs +41 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/models.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/shared.d.mts +42 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/shared.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/shared.d.ts +42 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/shared.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/shared.js +4 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/shared.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/shared.mjs +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/shared.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/top-level.d.mts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/top-level.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/top-level.d.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/top-level.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/top-level.js +4 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/top-level.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/top-level.mjs +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources/top-level.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources.d.mts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources.d.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources.js +5 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources.mjs +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/resources.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/_vendor/partial-json-parser/README.md +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/_vendor/partial-json-parser/parser.ts +264 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/api-promise.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/client.ts +1070 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/core/README.md +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/core/api-promise.ts +101 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/core/error.ts +133 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/core/pagination.ts +201 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/core/resource.ts +11 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/core/streaming.ts +331 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/core/uploads.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/error.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/index.ts +23 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/README.md +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/builtin-types.ts +93 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/constants.ts +12 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/decoders/jsonl.ts +48 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/decoders/line.ts +135 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/detect-platform.ts +196 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/errors.ts +33 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/headers.ts +99 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/parse.ts +84 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/request-options.ts +39 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/shim-types.d.ts +28 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/shims.ts +107 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/stream-utils.ts +32 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/to-file.ts +159 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/types.ts +92 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/uploads.ts +193 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/utils/base64.ts +40 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/utils/bytes.ts +32 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/utils/env.ts +18 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/utils/log.ts +127 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/utils/path.ts +65 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/utils/sleep.ts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/utils/uuid.ts +17 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/utils/values.ts +102 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/internal/utils.ts +8 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/lib/.keep +4 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/lib/BetaMessageStream.ts +683 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/lib/MessageStream.ts +684 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/pagination.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resource.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/beta/beta.ts +380 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/beta/files.ts +258 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/beta/index.ts +148 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/batches.ts +502 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/index.ts +135 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/messages.ts +2249 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/beta/messages.ts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/beta/models.ts +118 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/beta.ts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/completions.ts +231 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/index.ts +121 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/messages/batches.ts +396 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/messages/index.ts +110 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/messages/messages.ts +1783 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/messages.ts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/models.ts +103 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/shared.ts +72 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources/top-level.ts +3 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/resources.ts +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/streaming.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/tsconfig.json +11 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/uploads.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/src/version.ts +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/streaming.d.mts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/streaming.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/streaming.d.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/streaming.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/streaming.js +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/streaming.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/streaming.mjs +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/streaming.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/uploads.d.mts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/uploads.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/uploads.d.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/uploads.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/uploads.js +6 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/uploads.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/uploads.mjs +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/uploads.mjs.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/version.d.mts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/version.d.mts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/version.d.ts +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/version.d.ts.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/version.js +5 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/version.js.map +1 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/version.mjs +2 -0
- package/scripts/huddle/node_modules/@anthropic-ai/sdk/version.mjs.map +1 -0
- package/scripts/huddle/node_modules/dotenv/CHANGELOG.md +520 -0
- package/scripts/huddle/node_modules/dotenv/LICENSE +23 -0
- package/scripts/huddle/node_modules/dotenv/README-es.md +411 -0
- package/scripts/huddle/node_modules/dotenv/README.md +645 -0
- package/scripts/huddle/node_modules/dotenv/SECURITY.md +1 -0
- package/scripts/huddle/node_modules/dotenv/config.d.ts +1 -0
- package/scripts/huddle/node_modules/dotenv/config.js +9 -0
- package/scripts/huddle/node_modules/dotenv/lib/cli-options.js +17 -0
- package/scripts/huddle/node_modules/dotenv/lib/env-options.js +28 -0
- package/scripts/huddle/node_modules/dotenv/lib/main.d.ts +162 -0
- package/scripts/huddle/node_modules/dotenv/lib/main.js +386 -0
- package/scripts/huddle/node_modules/dotenv/package.json +62 -0
- package/scripts/huddle/node_modules/ws/LICENSE +20 -0
- package/scripts/huddle/node_modules/ws/README.md +548 -0
- package/scripts/huddle/node_modules/ws/browser.js +8 -0
- package/scripts/huddle/node_modules/ws/index.js +22 -0
- package/scripts/huddle/node_modules/ws/lib/buffer-util.js +131 -0
- package/scripts/huddle/node_modules/ws/lib/constants.js +19 -0
- package/scripts/huddle/node_modules/ws/lib/event-target.js +292 -0
- package/scripts/huddle/node_modules/ws/lib/extension.js +203 -0
- package/scripts/huddle/node_modules/ws/lib/limiter.js +55 -0
- package/scripts/huddle/node_modules/ws/lib/permessage-deflate.js +528 -0
- package/scripts/huddle/node_modules/ws/lib/receiver.js +706 -0
- package/scripts/huddle/node_modules/ws/lib/sender.js +602 -0
- package/scripts/huddle/node_modules/ws/lib/stream.js +161 -0
- package/scripts/huddle/node_modules/ws/lib/subprotocol.js +62 -0
- package/scripts/huddle/node_modules/ws/lib/validation.js +152 -0
- package/scripts/huddle/node_modules/ws/lib/websocket-server.js +554 -0
- package/scripts/huddle/node_modules/ws/lib/websocket.js +1393 -0
- package/scripts/huddle/node_modules/ws/package.json +70 -0
- package/scripts/huddle/node_modules/ws/wrapper.mjs +21 -0
- package/scripts/huddle/package-lock.json +62 -0
- package/scripts/huddle/package.json +22 -0
- package/scripts/huddle/setup-audio.sh +239 -0
- package/scripts/huddle/start-call.mjs +318 -0
- package/scripts/huddle/test-pipeline.mjs +263 -0
- package/scripts/llm_email_dedup.py +434 -0
- package/scripts/local-triggers/install-all.sh +43 -0
- package/scripts/local-triggers/plists/ai.adaptic.slack-events-server.plist +45 -0
- package/scripts/local-triggers/plists/ai.adaptic.sophie-backlog-executor.plist +21 -0
- package/scripts/local-triggers/plists/ai.adaptic.sophie-daemon.plist +32 -0
- package/scripts/local-triggers/plists/ai.adaptic.sophie-inbox-processor.plist +21 -0
- package/scripts/local-triggers/plists/ai.adaptic.sophie-meeting-action-capture.plist +21 -0
- package/scripts/local-triggers/plists/ai.adaptic.sophie-meeting-prep.plist +21 -0
- package/scripts/local-triggers/plists/ai.adaptic.sophie-midday-sweep.plist +26 -0
- package/scripts/local-triggers/plists/ai.adaptic.sophie-quarterly-self-assessment.plist +62 -0
- package/scripts/local-triggers/plists/ai.adaptic.sophie-weekly-engineering-health.plist +28 -0
- package/scripts/local-triggers/plists/ai.adaptic.sophie-weekly-execution.plist +28 -0
- package/scripts/local-triggers/plists/ai.adaptic.sophie-weekly-hiring.plist +28 -0
- package/scripts/local-triggers/plists/ai.adaptic.sophie-weekly-priorities.plist +28 -0
- package/scripts/local-triggers/plists/ai.adaptic.sophie-weekly-strategic-memo.plist +28 -0
- package/scripts/local-triggers/run-trigger.sh +44 -0
- package/scripts/media-generation/README.md +103 -0
- package/scripts/media-generation/gemini-image-client.mjs +173 -0
- package/scripts/media-generation/generate-assets.mjs +289 -0
- package/scripts/media-generation/veo-video-client.mjs +219 -0
- package/scripts/mehran-inbox-poller.py +437 -0
- package/scripts/outbound-dedup-cleanup.sh +43 -0
- package/scripts/outbound-dedup.sh +476 -0
- package/scripts/outbound_dedup.py +115 -0
- package/scripts/parse-voice-transcript.mjs +486 -0
- package/scripts/pdf-generation/README.md +61 -0
- package/scripts/pdf-generation/build-document.mjs +230 -0
- package/scripts/pdf-generation/templates/board-pack.latex +136 -0
- package/scripts/pdf-generation/templates/corporate-letter.latex +126 -0
- package/scripts/pdf-generation/templates/memo.latex +114 -0
- package/scripts/poll-slack-events.sh +33 -0
- package/scripts/poller/calendar-poller.mjs +12 -0
- package/scripts/poller/gmail-poller.mjs +156 -0
- package/scripts/poller/imap-client.mjs +286 -0
- package/scripts/poller/index.mjs +73 -0
- package/scripts/poller/intra-session-check.mjs +267 -0
- package/scripts/poller/mehran-gmail-poller.mjs +98 -0
- package/scripts/poller/slack-poller.mjs +716 -0
- package/scripts/poller/trigger.mjs +47 -0
- package/scripts/poller/utils.mjs +253 -0
- package/scripts/poller-launchd/ai.adaptic.sophie-poller.plist +40 -0
- package/scripts/poller-launchd/ai.adaptic.sophie-whatsapp-handler.plist +39 -0
- package/scripts/poller-launchd/install.sh +38 -0
- package/scripts/post-interaction-indexer.py +1598 -0
- package/scripts/pre-draft-context.py +994 -0
- package/scripts/pre_draft_lookup.py +258 -0
- package/scripts/rag-indexer.py +629 -0
- package/scripts/resume-operations.sh +40 -0
- package/scripts/search-mehran-inbox.py +181 -0
- package/scripts/self-optimization/compute-metrics.py +377 -0
- package/scripts/send-difc-rfp.sh +98 -0
- package/scripts/send-email-as-mehran.py +369 -0
- package/scripts/send-email-threaded.py +336 -0
- package/scripts/send-email-with-attachment.py +360 -0
- package/scripts/send-email.sh +93 -0
- package/scripts/send-sms.sh +151 -0
- package/scripts/send-whatsapp.sh +261 -0
- package/scripts/session-start.sh +106 -0
- package/scripts/setup/configure-macos.sh +508 -0
- package/scripts/setup/init-agent.sh +450 -0
- package/scripts/slack-events-ctl.sh +177 -0
- package/scripts/slack-events-server.mjs +989 -0
- package/scripts/slack-react.mjs +89 -0
- package/scripts/slack-responded.sh +185 -0
- package/scripts/slack-send.sh +190 -0
- package/scripts/slack-typing.mjs +196 -0
- package/scripts/slack-upload-v2.py +95 -0
- package/scripts/sms-handler.mjs +436 -0
- package/scripts/sophie-inbox-poller.py +406 -0
- package/scripts/spawn-session.sh +85 -0
- package/scripts/system-verify.sh +171 -0
- package/scripts/test-email-thread-dedup.py +239 -0
- package/scripts/test-information-barriers.py +484 -0
- package/scripts/test-llm-email-dedup.py +251 -0
- package/scripts/test-pre-draft-integration.py +203 -0
- package/scripts/test-rag-phase2.sh +442 -0
- package/scripts/test-rag-search.sh +251 -0
- package/scripts/test-voice-parser.mjs +316 -0
- package/scripts/user-context-search.py +660 -0
- package/scripts/validate-outbound.py +1493 -0
- package/scripts/whatsapp-handler.mjs +525 -0
- package/teams/desktop-operations.yaml +34 -0
- package/teams/executive-office.yaml +27 -0
- package/teams/legal-and-regulatory.yaml +24 -0
- package/teams/platform-and-engineering.yaml +23 -0
- package/teams/strategy-and-growth.yaml +29 -0
- package/workflows/continuous/inbound-monitor.yaml +168 -0
- package/workflows/daily/applicant-triage.yaml +197 -0
- package/workflows/daily/comms-triage.yaml +80 -0
- package/workflows/daily/evening-wrap.yaml +65 -0
- package/workflows/daily/morning-brief.yaml +147 -0
- package/workflows/daily/slack-followup-sweep.yaml +87 -0
- package/workflows/event-driven/README.md +50 -0
- package/workflows/monthly/board-readiness.yaml +76 -0
- package/workflows/quarterly/strategic-scenario-analysis.yaml +85 -0
- package/workflows/session-protocol.md +171 -0
- package/workflows/weekly/hiring-review.yaml +169 -0
- package/workflows/weekly/rollup-pipeline-review.yaml +76 -0
- package/workflows/weekly/strategic-memo.yaml +79 -0
|
@@ -0,0 +1,989 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Slack Events API Server — Real-Time Event Receiver for Sophie
|
|
4
|
+
*
|
|
5
|
+
* Receives real-time events from Slack via the bot's Event Subscriptions.
|
|
6
|
+
* Writes inbound events to state/inbox/slack/ in YAML format (matching poller output).
|
|
7
|
+
* Creates priority trigger files for CEO DMs.
|
|
8
|
+
*
|
|
9
|
+
* This replaces polling — Slack pushes events to us instantly.
|
|
10
|
+
*
|
|
11
|
+
* Events handled:
|
|
12
|
+
* - message (DM, channel messages, thread replies — all channel types)
|
|
13
|
+
* - app_mention (Sophie @mentioned)
|
|
14
|
+
* - reaction_added (emoji reactions)
|
|
15
|
+
*
|
|
16
|
+
* Deduplication:
|
|
17
|
+
* - Tracks event_id in state/locks/slack-events/ to prevent duplicate processing
|
|
18
|
+
* - Also deduplicates against the poller's tracker in state/slack-thread-tracker/
|
|
19
|
+
*
|
|
20
|
+
* Usage: node scripts/slack-events-server.mjs
|
|
21
|
+
* Requires: SLACK_BOT_TOKEN (or SLACK_TOKEN), SLACK_SIGNING_SECRET in .env
|
|
22
|
+
* Port: 3100 (configurable via SLACK_EVENTS_PORT)
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import http from "node:http";
|
|
26
|
+
import crypto from "node:crypto";
|
|
27
|
+
import fs from "node:fs";
|
|
28
|
+
import path from "node:path";
|
|
29
|
+
import { fileURLToPath } from "node:url";
|
|
30
|
+
|
|
31
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
32
|
+
const ROOT = path.resolve(__dirname, "..");
|
|
33
|
+
|
|
34
|
+
// ── Load environment ──────────────────────────────────────────────────────────
|
|
35
|
+
|
|
36
|
+
const envPath = path.join(ROOT, ".env");
|
|
37
|
+
if (fs.existsSync(envPath)) {
|
|
38
|
+
const envContent = fs.readFileSync(envPath, "utf-8");
|
|
39
|
+
for (const line of envContent.split("\n")) {
|
|
40
|
+
const match = line.match(/^([A-Z_][A-Z0-9_]*)=(.*)$/);
|
|
41
|
+
if (match) {
|
|
42
|
+
let val = match[2].trim();
|
|
43
|
+
// Strip surrounding quotes
|
|
44
|
+
if (
|
|
45
|
+
(val.startsWith('"') && val.endsWith('"')) ||
|
|
46
|
+
(val.startsWith("'") && val.endsWith("'"))
|
|
47
|
+
) {
|
|
48
|
+
val = val.slice(1, -1);
|
|
49
|
+
}
|
|
50
|
+
process.env[match[1]] = val;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ── Constants ─────────────────────────────────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
const PORT = parseInt(process.env.SLACK_EVENTS_PORT || "3100", 10);
|
|
58
|
+
const SIGNING_SECRET = process.env.SLACK_SIGNING_SECRET || "";
|
|
59
|
+
const INBOX_DIR = path.join(ROOT, "state/inbox/slack");
|
|
60
|
+
const DEDUP_DIR = path.join(ROOT, "state/locks/slack-events");
|
|
61
|
+
const POLLER_TRACKER_DIR = path.join(ROOT, "state/slack-thread-tracker");
|
|
62
|
+
const TRIGGER_DIR = path.join(ROOT, "state/triggers/priority");
|
|
63
|
+
const LOG_DIR = path.join(ROOT, "logs/polling");
|
|
64
|
+
|
|
65
|
+
const SOPHIE_USER_ID = "U099N1JFPRQ";
|
|
66
|
+
const MEHRAN_USER_ID = "U097N5R0M7U";
|
|
67
|
+
const MEHRAN_DM_CHANNEL = "D099N1JGKRQ";
|
|
68
|
+
|
|
69
|
+
// Known users for name/privilege resolution (matches poller/utils.mjs)
|
|
70
|
+
const KNOWN_USERS = {
|
|
71
|
+
U097N5R0M7U: { name: "mehran-granfar", privilege: "ceo" },
|
|
72
|
+
U099N1JFPRQ: { name: "sophie-nguyen", privilege: "system" },
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// Monitored channels (matches poller/slack-poller.mjs)
|
|
76
|
+
const CHANNEL_INFO = {
|
|
77
|
+
C0ARASMQE1W: { name: "ceo-office", priority: "critical" },
|
|
78
|
+
C099NT6NKK7: { name: "engineering", priority: "high" },
|
|
79
|
+
C097N5R8HUJ: { name: "all-adaptic", priority: "high" },
|
|
80
|
+
C09916RV399: { name: "adaptic-engine", priority: "high" },
|
|
81
|
+
C0AQEGXKYT0: { name: "dfsa-remediation", priority: "high" },
|
|
82
|
+
C0AQGK5TLNN: { name: "rollup-strategy", priority: "high" },
|
|
83
|
+
C0AQL7QL2G4: { name: "legal-compliance", priority: "high" },
|
|
84
|
+
C0996CRGF1S: { name: "adaptic-app", priority: "normal" },
|
|
85
|
+
C0992UF9469: { name: "platform", priority: "normal" },
|
|
86
|
+
C0ARAU328JU: { name: "general", priority: "normal" },
|
|
87
|
+
C09CTAFUB09: { name: "product", priority: "normal" },
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const ATTACHMENTS_DIR = path.join(ROOT, "state/inbox/attachments");
|
|
91
|
+
|
|
92
|
+
// Ensure attachments directory exists
|
|
93
|
+
fs.mkdirSync(ATTACHMENTS_DIR, { recursive: true });
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Extract attachment metadata from Slack event files array.
|
|
97
|
+
* Also attempts to download files for local access by Claude Code sessions.
|
|
98
|
+
*/
|
|
99
|
+
function extractAttachments(files) {
|
|
100
|
+
if (!files || !Array.isArray(files) || files.length === 0) return [];
|
|
101
|
+
const token = process.env.SLACK_BOT_TOKEN || process.env.SLACK_TOKEN || "";
|
|
102
|
+
return files.map((f) => {
|
|
103
|
+
const att = {
|
|
104
|
+
id: f.id || "",
|
|
105
|
+
name: f.name || "unnamed",
|
|
106
|
+
mimetype: f.mimetype || f.filetype || "unknown",
|
|
107
|
+
size: f.size || 0,
|
|
108
|
+
url_private: f.url_private || "",
|
|
109
|
+
local_path: null,
|
|
110
|
+
};
|
|
111
|
+
// Attempt synchronous-style download via fetch (non-blocking best-effort)
|
|
112
|
+
if (token && (f.url_private_download || f.url_private)) {
|
|
113
|
+
const safeId = (f.id || "unknown").replace(/[^a-zA-Z0-9_-]/g, "");
|
|
114
|
+
const safeName = (f.name || "file").replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
115
|
+
const localPath = path.join(ATTACHMENTS_DIR, `${safeId}-${safeName}`);
|
|
116
|
+
att.local_path = localPath; // Set optimistically; download happens async
|
|
117
|
+
// Fire-and-forget async download
|
|
118
|
+
downloadAttachment(f.url_private_download || f.url_private, localPath, token);
|
|
119
|
+
}
|
|
120
|
+
return att;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Download a Slack attachment to local storage (async, fire-and-forget).
|
|
126
|
+
*/
|
|
127
|
+
async function downloadAttachment(url, localPath, token) {
|
|
128
|
+
try {
|
|
129
|
+
if (fs.existsSync(localPath)) return; // Already downloaded
|
|
130
|
+
const res = await fetch(url, { headers: { Authorization: `Bearer ${token}` } });
|
|
131
|
+
if (!res.ok) {
|
|
132
|
+
log("WARN", `Attachment download failed: HTTP ${res.status}`, { url });
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const buffer = Buffer.from(await res.arrayBuffer());
|
|
136
|
+
fs.writeFileSync(localPath, buffer);
|
|
137
|
+
log("INFO", `Attachment downloaded: ${path.basename(localPath)}`, { size: buffer.length });
|
|
138
|
+
} catch (err) {
|
|
139
|
+
log("WARN", `Attachment download error: ${err.message}`, { url });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// ── Edit Deduplication ───────────────────────────────────────────────────────
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Calculate word-level similarity between two strings (Jaccard-like).
|
|
147
|
+
* Returns 0.0 (completely different) to 1.0 (identical).
|
|
148
|
+
* Used to distinguish typo fixes from material edits.
|
|
149
|
+
*/
|
|
150
|
+
function wordSimilarity(a, b) {
|
|
151
|
+
if (a === b) return 1.0;
|
|
152
|
+
if (!a && !b) return 1.0;
|
|
153
|
+
if (!a || !b) return 0.0;
|
|
154
|
+
|
|
155
|
+
const wordsA = a.toLowerCase().split(/\s+/).filter(Boolean);
|
|
156
|
+
const wordsB = b.toLowerCase().split(/\s+/).filter(Boolean);
|
|
157
|
+
|
|
158
|
+
if (wordsA.length === 0 && wordsB.length === 0) return 1.0;
|
|
159
|
+
if (wordsA.length === 0 || wordsB.length === 0) return 0.0;
|
|
160
|
+
|
|
161
|
+
const setA = new Set(wordsA);
|
|
162
|
+
const setB = new Set(wordsB);
|
|
163
|
+
const intersection = new Set([...setA].filter((w) => setB.has(w)));
|
|
164
|
+
const union = new Set([...setA, ...setB]);
|
|
165
|
+
|
|
166
|
+
return intersection.size / union.size;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Mark an existing inbox item as superseded by a message edit.
|
|
171
|
+
* Renames the YAML file with a .superseded suffix so the inbox processor
|
|
172
|
+
* skips it and processes only the new version.
|
|
173
|
+
*/
|
|
174
|
+
function supersedeInboxItem(channelId, messageTs) {
|
|
175
|
+
try {
|
|
176
|
+
const tsFormatted = messageTs.replace(".", "-");
|
|
177
|
+
const files = fs.readdirSync(INBOX_DIR);
|
|
178
|
+
for (const file of files) {
|
|
179
|
+
if (file.includes(tsFormatted) && file.endsWith(".yaml") && !file.endsWith(".superseded")) {
|
|
180
|
+
const oldPath = path.join(INBOX_DIR, file);
|
|
181
|
+
const newPath = path.join(INBOX_DIR, file + ".superseded");
|
|
182
|
+
fs.renameSync(oldPath, newPath);
|
|
183
|
+
log("INFO", `Superseded inbox item: ${file}`, { channel: channelId, ts: messageTs });
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
} catch (err) {
|
|
187
|
+
log("WARN", `Failed to supersede inbox item: ${err.message}`, { channel: channelId, ts: messageTs });
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Dedup cache: keep event_ids in memory for fast lookup (last 10,000)
|
|
192
|
+
const eventIdCache = new Set();
|
|
193
|
+
const MAX_CACHE_SIZE = 10000;
|
|
194
|
+
|
|
195
|
+
// Stats for health endpoint
|
|
196
|
+
const stats = {
|
|
197
|
+
started_at: new Date().toISOString(),
|
|
198
|
+
events_received: 0,
|
|
199
|
+
events_processed: 0,
|
|
200
|
+
events_deduplicated: 0,
|
|
201
|
+
events_skipped_bot: 0,
|
|
202
|
+
last_event_at: null,
|
|
203
|
+
errors: 0,
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// ── Ensure directories exist ──────────────────────────────────────────────────
|
|
207
|
+
|
|
208
|
+
for (const dir of [INBOX_DIR, DEDUP_DIR, TRIGGER_DIR, LOG_DIR]) {
|
|
209
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// ── Helpers ───────────────────────────────────────────────────────────────────
|
|
213
|
+
|
|
214
|
+
function resolveName(userId) {
|
|
215
|
+
return KNOWN_USERS[userId]?.name || userId;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function resolvePrivilege(userId) {
|
|
219
|
+
return KNOWN_USERS[userId]?.privilege || "unknown";
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function resolveChannelName(channelId, channelType) {
|
|
223
|
+
if (CHANNEL_INFO[channelId]) {
|
|
224
|
+
return CHANNEL_INFO[channelId].name;
|
|
225
|
+
}
|
|
226
|
+
if (channelType === "im") {
|
|
227
|
+
return `dm/${channelId}`;
|
|
228
|
+
}
|
|
229
|
+
return channelId;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Verify Slack request signature (v0 HMAC-SHA256)
|
|
234
|
+
* Returns true if valid, false if invalid.
|
|
235
|
+
* Skips verification if SIGNING_SECRET is not configured (dev mode).
|
|
236
|
+
*/
|
|
237
|
+
function verifySlackSignature(timestamp, body, signature) {
|
|
238
|
+
if (!SIGNING_SECRET) return true;
|
|
239
|
+
|
|
240
|
+
// Reject requests older than 5 minutes (replay protection)
|
|
241
|
+
const now = Math.floor(Date.now() / 1000);
|
|
242
|
+
if (Math.abs(now - parseInt(timestamp, 10)) > 300) {
|
|
243
|
+
log("WARN", "Request timestamp too old, possible replay attack");
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const sigBasestring = `v0:${timestamp}:${body}`;
|
|
248
|
+
const mySignature =
|
|
249
|
+
"v0=" +
|
|
250
|
+
crypto
|
|
251
|
+
.createHmac("sha256", SIGNING_SECRET)
|
|
252
|
+
.update(sigBasestring, "utf8")
|
|
253
|
+
.digest("hex");
|
|
254
|
+
|
|
255
|
+
try {
|
|
256
|
+
return crypto.timingSafeEqual(
|
|
257
|
+
Buffer.from(mySignature),
|
|
258
|
+
Buffer.from(signature || ""),
|
|
259
|
+
);
|
|
260
|
+
} catch {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Check if an event has already been processed.
|
|
267
|
+
* Uses both in-memory cache and filesystem dedup directory.
|
|
268
|
+
*/
|
|
269
|
+
function isDuplicate(eventId) {
|
|
270
|
+
if (!eventId) return false;
|
|
271
|
+
|
|
272
|
+
// Check memory cache first
|
|
273
|
+
if (eventIdCache.has(eventId)) return true;
|
|
274
|
+
|
|
275
|
+
// Check filesystem
|
|
276
|
+
const dedupFile = path.join(DEDUP_DIR, eventId);
|
|
277
|
+
if (fs.existsSync(dedupFile)) {
|
|
278
|
+
eventIdCache.add(eventId);
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Mark an event as processed for deduplication.
|
|
287
|
+
*/
|
|
288
|
+
function markProcessed(eventId) {
|
|
289
|
+
if (!eventId) return;
|
|
290
|
+
|
|
291
|
+
// Add to memory cache
|
|
292
|
+
eventIdCache.add(eventId);
|
|
293
|
+
|
|
294
|
+
// Evict oldest entries if cache is too large
|
|
295
|
+
if (eventIdCache.size > MAX_CACHE_SIZE) {
|
|
296
|
+
const iterator = eventIdCache.values();
|
|
297
|
+
for (let i = 0; i < 1000; i++) {
|
|
298
|
+
eventIdCache.delete(iterator.next().value);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// Write to filesystem
|
|
303
|
+
try {
|
|
304
|
+
fs.writeFileSync(path.join(DEDUP_DIR, eventId), String(Date.now()));
|
|
305
|
+
} catch (err) {
|
|
306
|
+
log("ERROR", `Failed to write dedup file for ${eventId}: ${err.message}`);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Also mark in the poller's tracker so the comms-monitor.sh doesn't re-process.
|
|
312
|
+
*/
|
|
313
|
+
function markInPollerTracker(messageTs) {
|
|
314
|
+
if (!messageTs) return;
|
|
315
|
+
try {
|
|
316
|
+
const trackerFile = path.join(POLLER_TRACKER_DIR, messageTs);
|
|
317
|
+
if (!fs.existsSync(trackerFile)) {
|
|
318
|
+
fs.mkdirSync(POLLER_TRACKER_DIR, { recursive: true });
|
|
319
|
+
fs.writeFileSync(trackerFile, messageTs);
|
|
320
|
+
}
|
|
321
|
+
} catch {
|
|
322
|
+
// Non-critical — poller will just reprocess
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Write structured log entry
|
|
328
|
+
*/
|
|
329
|
+
function log(level, message, data = {}) {
|
|
330
|
+
const entry = {
|
|
331
|
+
timestamp: new Date().toISOString(),
|
|
332
|
+
service: "slack-events-server",
|
|
333
|
+
level,
|
|
334
|
+
message,
|
|
335
|
+
...data,
|
|
336
|
+
};
|
|
337
|
+
const line = JSON.stringify(entry);
|
|
338
|
+
console.log(`[${level}] ${message}`);
|
|
339
|
+
|
|
340
|
+
// Append to daily log file
|
|
341
|
+
try {
|
|
342
|
+
const today = new Date().toISOString().split("T")[0];
|
|
343
|
+
const logFile = path.join(LOG_DIR, `${today}-slack-events.jsonl`);
|
|
344
|
+
fs.appendFileSync(logFile, line + "\n");
|
|
345
|
+
} catch {
|
|
346
|
+
// Logging failure should not break event processing
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// ── Inbox Writers ─────────────────────────────────────────────────────────────
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Write an inbox item in YAML format — matching the poller's output exactly.
|
|
354
|
+
* This ensures the inbox processor handles events from both sources identically.
|
|
355
|
+
*/
|
|
356
|
+
function writeInboxYaml(item) {
|
|
357
|
+
const ts = (item.timestamp || new Date().toISOString()).replace(/[:.]/g, "-");
|
|
358
|
+
const filename = `${ts}-${item.id}.yaml`;
|
|
359
|
+
const filepath = path.join(INBOX_DIR, filename);
|
|
360
|
+
|
|
361
|
+
const content = (item.content || "").replace(/\n/g, "\n ");
|
|
362
|
+
let yaml = `id: "${item.id}"
|
|
363
|
+
service: "${item.service}"
|
|
364
|
+
channel: "${item.channel}"
|
|
365
|
+
sender: "${item.sender}"
|
|
366
|
+
sender_privilege: "${item.sender_privilege}"
|
|
367
|
+
timestamp: "${item.timestamp}"
|
|
368
|
+
subject: "${item.subject || ""}"
|
|
369
|
+
content: |
|
|
370
|
+
${content}
|
|
371
|
+
thread_id: "${item.thread_id || ""}"
|
|
372
|
+
is_reply: ${item.is_reply || false}
|
|
373
|
+
is_voice_transcript: false
|
|
374
|
+
priority_signals:
|
|
375
|
+
from_ceo: ${item.priority_signals?.from_ceo || false}
|
|
376
|
+
tagged_urgent: ${item.priority_signals?.tagged_urgent || false}
|
|
377
|
+
contains_deadline: ${item.priority_signals?.contains_deadline || false}
|
|
378
|
+
mentions_sophie: ${item.priority_signals?.mentions_sophie || false}
|
|
379
|
+
raw_ref: "${item.raw_ref || ""}"
|
|
380
|
+
source: "events-api"
|
|
381
|
+
`;
|
|
382
|
+
|
|
383
|
+
// Add attachments if present
|
|
384
|
+
if (item.attachments && item.attachments.length > 0) {
|
|
385
|
+
yaml += `attachments:\n`;
|
|
386
|
+
for (const att of item.attachments) {
|
|
387
|
+
yaml += ` - id: "${att.id}"\n`;
|
|
388
|
+
yaml += ` name: "${att.name}"\n`;
|
|
389
|
+
yaml += ` mimetype: "${att.mimetype}"\n`;
|
|
390
|
+
yaml += ` size: ${att.size}\n`;
|
|
391
|
+
if (att.local_path) {
|
|
392
|
+
yaml += ` local_path: "${att.local_path}"\n`;
|
|
393
|
+
}
|
|
394
|
+
if (att.url_private) {
|
|
395
|
+
yaml += ` url_private: "${att.url_private}"\n`;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
fs.writeFileSync(filepath, yaml);
|
|
401
|
+
log("INFO", `Inbox item written: ${filename}`, {
|
|
402
|
+
event_type: item._eventType,
|
|
403
|
+
sender: item.sender,
|
|
404
|
+
channel: item.channel,
|
|
405
|
+
});
|
|
406
|
+
return filepath;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Write a priority trigger file for CEO DMs and urgent items.
|
|
411
|
+
* This triggers immediate session pickup by the inbox processor.
|
|
412
|
+
*/
|
|
413
|
+
function writePriorityTrigger(event, reason) {
|
|
414
|
+
const ts = Date.now();
|
|
415
|
+
const triggerFile = path.join(TRIGGER_DIR, `ceo-dm-${ts}.yaml`);
|
|
416
|
+
const content = (event.text || "").replace(/\n/g, "\n ");
|
|
417
|
+
const triggerContent = `type: priority_trigger
|
|
418
|
+
reason: "${reason}"
|
|
419
|
+
source: "slack:${event.channel}:${event.ts}"
|
|
420
|
+
sender: "${resolveName(event.user)}"
|
|
421
|
+
channel: "${resolveChannelName(event.channel, event.channel_type)}"
|
|
422
|
+
timestamp: "${new Date().toISOString()}"
|
|
423
|
+
detected_by: slack-events-server
|
|
424
|
+
content: |
|
|
425
|
+
${content}
|
|
426
|
+
`;
|
|
427
|
+
fs.writeFileSync(triggerFile, triggerContent);
|
|
428
|
+
log("INFO", `Priority trigger written: ceo-dm-${ts}.yaml`, { reason });
|
|
429
|
+
return triggerFile;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
// ── Event Handlers ────────────────────────────────────────────────────────────
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Process a message event (DM, channel, thread reply — any channel type).
|
|
436
|
+
*/
|
|
437
|
+
function handleMessageEvent(event) {
|
|
438
|
+
const userId = event.user || "";
|
|
439
|
+
// Skip Sophie's own messages — defensive check (outer dispatch also filters,
|
|
440
|
+
// but message_changed normalization can bypass it)
|
|
441
|
+
if (userId === SOPHIE_USER_ID) return;
|
|
442
|
+
|
|
443
|
+
const msgText = event.text || "";
|
|
444
|
+
const channelId = event.channel || "";
|
|
445
|
+
const channelType = event.channel_type || "";
|
|
446
|
+
const isThread = !!event.thread_ts && event.thread_ts !== event.ts;
|
|
447
|
+
const isDM = channelType === "im";
|
|
448
|
+
const isMehran = userId === MEHRAN_USER_ID;
|
|
449
|
+
const isMehranDmChannel = channelId === MEHRAN_DM_CHANNEL;
|
|
450
|
+
const mentionsSophie =
|
|
451
|
+
msgText.toLowerCase().includes("sophie") ||
|
|
452
|
+
msgText.includes(`<@${SOPHIE_USER_ID}>`);
|
|
453
|
+
const isUrgent = /\b(urgent|emergency|asap|blocker|critical)\b/i.test(
|
|
454
|
+
msgText,
|
|
455
|
+
);
|
|
456
|
+
|
|
457
|
+
// Determine channel name and subject
|
|
458
|
+
let channelName, subject;
|
|
459
|
+
if (isDM) {
|
|
460
|
+
channelName = `dm/${resolveName(userId)}`;
|
|
461
|
+
subject = `DM from ${resolveName(userId)}`;
|
|
462
|
+
} else {
|
|
463
|
+
channelName = resolveChannelName(channelId, channelType);
|
|
464
|
+
subject = `#${channelName}`;
|
|
465
|
+
if (isThread) {
|
|
466
|
+
subject += " (thread reply)";
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
log("INFO", `Message event`, {
|
|
471
|
+
from: resolveName(userId),
|
|
472
|
+
channel: channelName,
|
|
473
|
+
isDM,
|
|
474
|
+
isThread,
|
|
475
|
+
isMehran,
|
|
476
|
+
mentionsSophie,
|
|
477
|
+
isUrgent,
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
// Extract attachment metadata from event.files (Slack Events API includes these)
|
|
481
|
+
const attachments = extractAttachments(event.files);
|
|
482
|
+
|
|
483
|
+
// Build inbox item matching poller format
|
|
484
|
+
const msgTs = event.ts || "";
|
|
485
|
+
const inboxItem = {
|
|
486
|
+
id: msgTs.replace(".", "-"),
|
|
487
|
+
service: "slack",
|
|
488
|
+
channel: channelName,
|
|
489
|
+
sender: resolveName(userId),
|
|
490
|
+
sender_privilege: resolvePrivilege(userId),
|
|
491
|
+
timestamp: new Date(parseFloat(msgTs) * 1000).toISOString(),
|
|
492
|
+
subject,
|
|
493
|
+
content: msgText,
|
|
494
|
+
thread_id: event.thread_ts || "",
|
|
495
|
+
is_reply: isThread,
|
|
496
|
+
attachments: attachments.length > 0 ? attachments : undefined,
|
|
497
|
+
priority_signals: {
|
|
498
|
+
from_ceo: isMehran,
|
|
499
|
+
tagged_urgent: isUrgent,
|
|
500
|
+
contains_deadline: false,
|
|
501
|
+
mentions_sophie: mentionsSophie || isDM,
|
|
502
|
+
},
|
|
503
|
+
raw_ref: `slack:${channelId}:${msgTs}`,
|
|
504
|
+
_eventType: isThread ? "thread_reply" : isDM ? "dm" : "channel_message",
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
writeInboxYaml(inboxItem);
|
|
508
|
+
|
|
509
|
+
// Mark in poller tracker to prevent comms-monitor.sh from re-processing
|
|
510
|
+
markInPollerTracker(msgTs);
|
|
511
|
+
|
|
512
|
+
// Write priority trigger for CEO DMs, @mentions, and urgent messages
|
|
513
|
+
if (isMehran && (isDM || isMehranDmChannel)) {
|
|
514
|
+
writePriorityTrigger(event, "CEO DM via Events API");
|
|
515
|
+
} else if (isMehran && !isDM) {
|
|
516
|
+
writePriorityTrigger(event, "CEO channel message via Events API");
|
|
517
|
+
} else if (mentionsSophie) {
|
|
518
|
+
writePriorityTrigger(event, "Sophie @mentioned via Events API");
|
|
519
|
+
} else if (isUrgent) {
|
|
520
|
+
writePriorityTrigger(event, "Urgent message via Events API");
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Process an app_mention event (@Sophie or @Adaptic COO).
|
|
526
|
+
*/
|
|
527
|
+
function handleMentionEvent(event) {
|
|
528
|
+
const msgText = event.text || "";
|
|
529
|
+
const userId = event.user || "";
|
|
530
|
+
const channelId = event.channel || "";
|
|
531
|
+
const isMehran = userId === MEHRAN_USER_ID;
|
|
532
|
+
const isUrgent = /\b(urgent|emergency|asap|blocker|critical)\b/i.test(
|
|
533
|
+
msgText,
|
|
534
|
+
);
|
|
535
|
+
const channelName = resolveChannelName(channelId, "channel");
|
|
536
|
+
const msgTs = event.ts || "";
|
|
537
|
+
|
|
538
|
+
log("INFO", `App mention event`, {
|
|
539
|
+
from: resolveName(userId),
|
|
540
|
+
channel: channelName,
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
const inboxItem = {
|
|
544
|
+
id: msgTs.replace(".", "-"),
|
|
545
|
+
service: "slack",
|
|
546
|
+
channel: channelName,
|
|
547
|
+
sender: resolveName(userId),
|
|
548
|
+
sender_privilege: resolvePrivilege(userId),
|
|
549
|
+
timestamp: new Date(parseFloat(msgTs) * 1000).toISOString(),
|
|
550
|
+
subject: `@Sophie in #${channelName}`,
|
|
551
|
+
content: msgText,
|
|
552
|
+
thread_id: event.thread_ts || "",
|
|
553
|
+
is_reply: !!event.thread_ts && event.thread_ts !== event.ts,
|
|
554
|
+
priority_signals: {
|
|
555
|
+
from_ceo: isMehran,
|
|
556
|
+
tagged_urgent: isUrgent,
|
|
557
|
+
contains_deadline: false,
|
|
558
|
+
mentions_sophie: true,
|
|
559
|
+
},
|
|
560
|
+
raw_ref: `slack:${channelId}:${msgTs}`,
|
|
561
|
+
_eventType: "mention",
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
writeInboxYaml(inboxItem);
|
|
565
|
+
markInPollerTracker(msgTs);
|
|
566
|
+
|
|
567
|
+
// Mentions always get a priority trigger
|
|
568
|
+
writePriorityTrigger(
|
|
569
|
+
event,
|
|
570
|
+
isMehran
|
|
571
|
+
? "CEO @mention via Events API"
|
|
572
|
+
: "Sophie @mentioned via Events API",
|
|
573
|
+
);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Process a reaction_added event.
|
|
578
|
+
*/
|
|
579
|
+
function handleReactionEvent(event) {
|
|
580
|
+
const userId = event.user || "";
|
|
581
|
+
const reaction = event.reaction || "";
|
|
582
|
+
const itemTs = event.item?.ts || "";
|
|
583
|
+
const itemChannel = event.item?.channel || "";
|
|
584
|
+
const isMehran = userId === MEHRAN_USER_ID;
|
|
585
|
+
const channelName = resolveChannelName(itemChannel, "channel");
|
|
586
|
+
|
|
587
|
+
log("INFO", `Reaction event: :${reaction}: from ${resolveName(userId)}`, {
|
|
588
|
+
channel: channelName,
|
|
589
|
+
on_message: itemTs,
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
// Write reaction as inbox item — reactions from CEO are priority signals
|
|
593
|
+
const inboxItem = {
|
|
594
|
+
id: `${itemTs}-${reaction}-${userId}`.replace(/\./g, "-"),
|
|
595
|
+
service: "slack",
|
|
596
|
+
channel: channelName,
|
|
597
|
+
sender: resolveName(userId),
|
|
598
|
+
sender_privilege: resolvePrivilege(userId),
|
|
599
|
+
timestamp: new Date().toISOString(),
|
|
600
|
+
subject: `:${reaction}: on message in #${channelName}`,
|
|
601
|
+
content: `Reaction :${reaction}: added by ${resolveName(userId)} on message ${itemTs}`,
|
|
602
|
+
thread_id: "",
|
|
603
|
+
is_reply: false,
|
|
604
|
+
priority_signals: {
|
|
605
|
+
from_ceo: isMehran,
|
|
606
|
+
tagged_urgent: false,
|
|
607
|
+
contains_deadline: false,
|
|
608
|
+
mentions_sophie: false,
|
|
609
|
+
},
|
|
610
|
+
raw_ref: `slack:${itemChannel}:${itemTs}:reaction:${reaction}`,
|
|
611
|
+
_eventType: "reaction",
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
writeInboxYaml(inboxItem);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
// ── Huddle Event Handler ──────────────────────────────────────────────────────
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Handle user_huddle_changed events — forwarded to the huddle server
|
|
621
|
+
* for real-time huddle detection and auto-join.
|
|
622
|
+
*/
|
|
623
|
+
function handleHuddleEvent(event) {
|
|
624
|
+
const userId = event.user || "";
|
|
625
|
+
const huddleState = event.huddle_state || "";
|
|
626
|
+
|
|
627
|
+
// Don't react to Sophie's own huddle changes
|
|
628
|
+
if (userId === SOPHIE_USER_ID) return;
|
|
629
|
+
|
|
630
|
+
const userName = resolveName(userId);
|
|
631
|
+
|
|
632
|
+
log("INFO", `Huddle event: ${userName} → ${huddleState}`, {
|
|
633
|
+
user: userId,
|
|
634
|
+
huddle_state: huddleState,
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
// Forward to huddle server's event listener
|
|
638
|
+
const huddleServerUrl = `http://127.0.0.1:${process.env.HUDDLE_EVENTS_PORT || 3200}/huddle-event`;
|
|
639
|
+
|
|
640
|
+
const payload = JSON.stringify({
|
|
641
|
+
user: userId,
|
|
642
|
+
user_name: userName,
|
|
643
|
+
huddle_state: huddleState,
|
|
644
|
+
// user_huddle_changed doesn't include channel info directly,
|
|
645
|
+
// but we can derive it from context if available
|
|
646
|
+
channel: event.channel || null,
|
|
647
|
+
channel_type: event.channel_type || null,
|
|
648
|
+
timestamp: new Date().toISOString(),
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
// Fire-and-forget POST to huddle server
|
|
652
|
+
fetch(huddleServerUrl, {
|
|
653
|
+
method: "POST",
|
|
654
|
+
headers: { "Content-Type": "application/json" },
|
|
655
|
+
body: payload,
|
|
656
|
+
}).catch((err) => {
|
|
657
|
+
// Huddle server may not be running — that's fine
|
|
658
|
+
log("DEBUG", `Huddle server unreachable: ${err.message}`);
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
// ── Main Event Router ─────────────────────────────────────────────────────────
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Route an incoming Slack event to the appropriate handler.
|
|
666
|
+
*/
|
|
667
|
+
function handleEvent(payload) {
|
|
668
|
+
const event = payload.event;
|
|
669
|
+
if (!event) return;
|
|
670
|
+
|
|
671
|
+
const eventId = payload.event_id;
|
|
672
|
+
|
|
673
|
+
// Deduplication check
|
|
674
|
+
if (isDuplicate(eventId)) {
|
|
675
|
+
stats.events_deduplicated++;
|
|
676
|
+
log("DEBUG", `Duplicate event skipped: ${eventId}`);
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
stats.events_received++;
|
|
681
|
+
stats.last_event_at = new Date().toISOString();
|
|
682
|
+
|
|
683
|
+
// Skip bot messages (including Sophie's own messages)
|
|
684
|
+
if (event.bot_id || event.subtype === "bot_message") {
|
|
685
|
+
stats.events_skipped_bot++;
|
|
686
|
+
log("DEBUG", `Bot message skipped`, {
|
|
687
|
+
bot_id: event.bot_id,
|
|
688
|
+
subtype: event.subtype,
|
|
689
|
+
});
|
|
690
|
+
markProcessed(eventId);
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// Skip Sophie's own messages
|
|
695
|
+
if (event.user === SOPHIE_USER_ID) {
|
|
696
|
+
stats.events_skipped_bot++;
|
|
697
|
+
markProcessed(eventId);
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
// Handle message_changed: Slack sends both old and new text.
|
|
702
|
+
// Compare to determine if the edit is material (rewrite) or immaterial (typo fix).
|
|
703
|
+
if (event.subtype === "message_changed" && event.message) {
|
|
704
|
+
const oldText = event.previous_message?.text || "";
|
|
705
|
+
const newText = event.message.text || "";
|
|
706
|
+
const similarity = wordSimilarity(oldText, newText);
|
|
707
|
+
|
|
708
|
+
if (similarity >= 0.90) {
|
|
709
|
+
// Immaterial edit (typo fix, formatting) — skip reprocessing
|
|
710
|
+
stats.events_deduplicated++;
|
|
711
|
+
log("INFO", `Immaterial edit skipped (${(similarity * 100).toFixed(0)}% similar)`, {
|
|
712
|
+
channel: event.channel,
|
|
713
|
+
ts: event.message.ts,
|
|
714
|
+
});
|
|
715
|
+
markProcessed(eventId);
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
// Material edit — supersede the old inbox item and process the new version
|
|
720
|
+
log("INFO", `Material edit detected (${(similarity * 100).toFixed(0)}% similar)`, {
|
|
721
|
+
channel: event.channel,
|
|
722
|
+
ts: event.message.ts,
|
|
723
|
+
});
|
|
724
|
+
supersedeInboxItem(event.channel, event.message.ts);
|
|
725
|
+
|
|
726
|
+
// Normalize event shape for the message handler
|
|
727
|
+
event.text = newText;
|
|
728
|
+
event.user = event.message.user || event.user;
|
|
729
|
+
event.ts = event.message.ts || event.ts;
|
|
730
|
+
event.thread_ts = event.message.thread_ts || event.thread_ts;
|
|
731
|
+
event.files = event.message.files || event.files;
|
|
732
|
+
event._is_edit = true;
|
|
733
|
+
|
|
734
|
+
// Re-check after normalization: the original event.user for
|
|
735
|
+
// message_changed is often empty/system; the real author is in
|
|
736
|
+
// event.message.user. Without this, Sophie's own edited messages
|
|
737
|
+
// bypass the earlier SOPHIE_USER_ID filter and trigger self-replies.
|
|
738
|
+
if (event.user === SOPHIE_USER_ID) {
|
|
739
|
+
stats.events_skipped_bot++;
|
|
740
|
+
markProcessed(eventId);
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
// Fall through to message handler with updated content
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
// Skip message subtypes that are not actual user messages
|
|
747
|
+
// (channel_join, channel_leave, channel_topic, etc.)
|
|
748
|
+
const ignoredSubtypes = new Set([
|
|
749
|
+
"channel_join",
|
|
750
|
+
"channel_leave",
|
|
751
|
+
"channel_topic",
|
|
752
|
+
"channel_purpose",
|
|
753
|
+
"channel_name",
|
|
754
|
+
"channel_archive",
|
|
755
|
+
"channel_unarchive",
|
|
756
|
+
"bot_add",
|
|
757
|
+
"bot_remove",
|
|
758
|
+
"pinned_item",
|
|
759
|
+
"unpinned_item",
|
|
760
|
+
]);
|
|
761
|
+
if (event.subtype && ignoredSubtypes.has(event.subtype)) {
|
|
762
|
+
markProcessed(eventId);
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
// Route by event type
|
|
767
|
+
try {
|
|
768
|
+
switch (event.type) {
|
|
769
|
+
case "message":
|
|
770
|
+
handleMessageEvent(event);
|
|
771
|
+
break;
|
|
772
|
+
case "app_mention":
|
|
773
|
+
handleMentionEvent(event);
|
|
774
|
+
break;
|
|
775
|
+
case "reaction_added":
|
|
776
|
+
handleReactionEvent(event);
|
|
777
|
+
break;
|
|
778
|
+
case "user_huddle_changed":
|
|
779
|
+
handleHuddleEvent(event);
|
|
780
|
+
break;
|
|
781
|
+
default:
|
|
782
|
+
log("WARN", `Unhandled event type: ${event.type}`);
|
|
783
|
+
}
|
|
784
|
+
stats.events_processed++;
|
|
785
|
+
} catch (err) {
|
|
786
|
+
stats.errors++;
|
|
787
|
+
log("ERROR", `Failed to process event: ${err.message}`, {
|
|
788
|
+
event_type: event.type,
|
|
789
|
+
event_id: eventId,
|
|
790
|
+
stack: err.stack,
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
// Mark as processed after handling
|
|
795
|
+
markProcessed(eventId);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// ── Dedup Cleanup (runs hourly) ───────────────────────────────────────────────
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Clean up old dedup files (older than 24 hours) to prevent disk bloat.
|
|
802
|
+
*/
|
|
803
|
+
function cleanupDedupFiles() {
|
|
804
|
+
try {
|
|
805
|
+
const files = fs.readdirSync(DEDUP_DIR);
|
|
806
|
+
const cutoff = Date.now() - 24 * 60 * 60 * 1000; // 24 hours ago
|
|
807
|
+
let cleaned = 0;
|
|
808
|
+
|
|
809
|
+
for (const file of files) {
|
|
810
|
+
const filepath = path.join(DEDUP_DIR, file);
|
|
811
|
+
try {
|
|
812
|
+
const content = fs.readFileSync(filepath, "utf-8").trim();
|
|
813
|
+
const ts = parseInt(content, 10);
|
|
814
|
+
if (!isNaN(ts) && ts < cutoff) {
|
|
815
|
+
fs.unlinkSync(filepath);
|
|
816
|
+
cleaned++;
|
|
817
|
+
}
|
|
818
|
+
} catch {
|
|
819
|
+
// If we can't read it, check mtime instead
|
|
820
|
+
try {
|
|
821
|
+
const stat = fs.statSync(filepath);
|
|
822
|
+
if (stat.mtimeMs < cutoff) {
|
|
823
|
+
fs.unlinkSync(filepath);
|
|
824
|
+
cleaned++;
|
|
825
|
+
}
|
|
826
|
+
} catch {
|
|
827
|
+
// Skip
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
if (cleaned > 0) {
|
|
833
|
+
log("INFO", `Dedup cleanup: removed ${cleaned} old entries`);
|
|
834
|
+
}
|
|
835
|
+
} catch (err) {
|
|
836
|
+
log("ERROR", `Dedup cleanup failed: ${err.message}`);
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
// Run cleanup every hour
|
|
841
|
+
setInterval(cleanupDedupFiles, 60 * 60 * 1000);
|
|
842
|
+
|
|
843
|
+
// ── HTTP Server ───────────────────────────────────────────────────────────────
|
|
844
|
+
|
|
845
|
+
const server = http.createServer((req, res) => {
|
|
846
|
+
// Health check endpoint
|
|
847
|
+
if (req.method === "GET" && req.url === "/health") {
|
|
848
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
849
|
+
res.end(
|
|
850
|
+
JSON.stringify({
|
|
851
|
+
status: "ok",
|
|
852
|
+
service: "slack-events-server",
|
|
853
|
+
port: PORT,
|
|
854
|
+
uptime: process.uptime(),
|
|
855
|
+
...stats,
|
|
856
|
+
}),
|
|
857
|
+
);
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
// Slack events endpoint
|
|
862
|
+
if (req.method === "POST" && req.url === "/slack/events") {
|
|
863
|
+
let body = "";
|
|
864
|
+
req.on("data", (chunk) => {
|
|
865
|
+
body += chunk;
|
|
866
|
+
});
|
|
867
|
+
req.on("end", () => {
|
|
868
|
+
// Check for Slack retry header — if this is a retry and we already
|
|
869
|
+
// processed it, acknowledge immediately
|
|
870
|
+
const retryNum = req.headers["x-slack-retry-num"];
|
|
871
|
+
const retryReason = req.headers["x-slack-retry-reason"];
|
|
872
|
+
if (retryNum) {
|
|
873
|
+
log("WARN", `Slack retry #${retryNum} (reason: ${retryReason})`);
|
|
874
|
+
// If Slack is retrying because we were slow, just ack
|
|
875
|
+
// The original event was likely already processed
|
|
876
|
+
if (retryReason === "http_timeout") {
|
|
877
|
+
res.writeHead(200, { "X-Slack-No-Retry": "1" });
|
|
878
|
+
res.end("ok");
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
// Verify Slack signature
|
|
884
|
+
const timestamp = req.headers["x-slack-request-timestamp"];
|
|
885
|
+
const signature = req.headers["x-slack-signature"];
|
|
886
|
+
if (SIGNING_SECRET && !verifySlackSignature(timestamp, body, signature)) {
|
|
887
|
+
log("ERROR", "Invalid Slack signature — rejecting request");
|
|
888
|
+
stats.errors++;
|
|
889
|
+
res.writeHead(401);
|
|
890
|
+
res.end("Invalid signature");
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
let payload;
|
|
895
|
+
try {
|
|
896
|
+
payload = JSON.parse(body);
|
|
897
|
+
} catch {
|
|
898
|
+
res.writeHead(400);
|
|
899
|
+
res.end("Bad JSON");
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
// URL verification challenge (one-time setup when registering the endpoint)
|
|
904
|
+
if (payload.type === "url_verification") {
|
|
905
|
+
log("INFO", "URL verification challenge received");
|
|
906
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
907
|
+
res.end(JSON.stringify({ challenge: payload.challenge }));
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
// Event callback — respond 200 immediately, then process async
|
|
912
|
+
// Slack requires response within 3 seconds or it retries
|
|
913
|
+
res.writeHead(200, { "X-Slack-No-Retry": "1" });
|
|
914
|
+
res.end("ok");
|
|
915
|
+
|
|
916
|
+
// Process event asynchronously (after we've already sent 200)
|
|
917
|
+
if (payload.type === "event_callback") {
|
|
918
|
+
// Use setImmediate to ensure the response is sent before processing
|
|
919
|
+
setImmediate(() => {
|
|
920
|
+
try {
|
|
921
|
+
handleEvent(payload);
|
|
922
|
+
} catch (err) {
|
|
923
|
+
stats.errors++;
|
|
924
|
+
log("ERROR", `Unhandled error processing event: ${err.message}`, {
|
|
925
|
+
stack: err.stack,
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
// Any other route
|
|
935
|
+
res.writeHead(404, { "Content-Type": "application/json" });
|
|
936
|
+
res.end(
|
|
937
|
+
JSON.stringify({
|
|
938
|
+
error: "Not found",
|
|
939
|
+
endpoints: ["/slack/events", "/health"],
|
|
940
|
+
}),
|
|
941
|
+
);
|
|
942
|
+
});
|
|
943
|
+
|
|
944
|
+
// ── Startup ───────────────────────────────────────────────────────────────────
|
|
945
|
+
|
|
946
|
+
server.listen(PORT, () => {
|
|
947
|
+
log("INFO", `Slack Events Server started`, { port: PORT });
|
|
948
|
+
console.log(`[SLACK-EVENTS] Listening on port ${PORT}`);
|
|
949
|
+
console.log(
|
|
950
|
+
`[SLACK-EVENTS] Webhook URL: http://localhost:${PORT}/slack/events`,
|
|
951
|
+
);
|
|
952
|
+
console.log(`[SLACK-EVENTS] Health: http://localhost:${PORT}/health`);
|
|
953
|
+
console.log(`[SLACK-EVENTS] Dedup dir: ${DEDUP_DIR}`);
|
|
954
|
+
console.log(`[SLACK-EVENTS] Inbox dir: ${INBOX_DIR}`);
|
|
955
|
+
console.log(`[SLACK-EVENTS] Trigger dir: ${TRIGGER_DIR}`);
|
|
956
|
+
});
|
|
957
|
+
|
|
958
|
+
// ── Graceful Shutdown ─────────────────────────────────────────────────────────
|
|
959
|
+
|
|
960
|
+
function shutdown(signal) {
|
|
961
|
+
log("INFO", `Received ${signal}, shutting down gracefully...`);
|
|
962
|
+
server.close(() => {
|
|
963
|
+
log("INFO", "Server closed");
|
|
964
|
+
process.exit(0);
|
|
965
|
+
});
|
|
966
|
+
// Force exit after 5 seconds if server hasn't closed
|
|
967
|
+
setTimeout(() => {
|
|
968
|
+
log("WARN", "Forced shutdown after timeout");
|
|
969
|
+
process.exit(1);
|
|
970
|
+
}, 5000);
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
974
|
+
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
975
|
+
|
|
976
|
+
// Prevent unhandled rejections from crashing the server
|
|
977
|
+
process.on("unhandledRejection", (err) => {
|
|
978
|
+
stats.errors++;
|
|
979
|
+
log("ERROR", `Unhandled rejection: ${err.message || err}`, {
|
|
980
|
+
stack: err.stack,
|
|
981
|
+
});
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
process.on("uncaughtException", (err) => {
|
|
985
|
+
stats.errors++;
|
|
986
|
+
log("ERROR", `Uncaught exception: ${err.message}`, { stack: err.stack });
|
|
987
|
+
// For uncaught exceptions, exit after logging — let launchd restart us
|
|
988
|
+
setTimeout(() => process.exit(1), 1000);
|
|
989
|
+
});
|