From ffc483793791b549fb70999ecc93da3db0b1ccfa Mon Sep 17 00:00:00 2001 From: HamChowderr Date: Thu, 18 Jun 2026 13:05:52 -0700 Subject: [PATCH 001/251] fix(foreman): repair web chat end-to-end + sidebar/theme/delete polish Chat was broken by a stack of issues, all fixed: - Mastra dep mismatch (the killer): @mastra/deployer+server resolved to 1.43.0 (which calls mastra.getStudio()) while @mastra/core was pinned 1.42.0-alpha.3 (no getStudio) -> TypeError in checkRouteAuth -> EVERY authed HTTP route 500'd while agents worked in-process. Pinned deployer+server to 1.42.0-alpha.3 in root overrides + lockfile regen. - Removed strict:true from the 12 custom tools (forced Anthropic grammar mode + schema limits: additionalProperties/propertyNames/24-optional-param aggregate). - Image upload: split the data URL + forward explicit mediaType so the AI SDK doesn't default to image/jpeg (Anthropic rejected PNGs as a type mismatch). - server.onError now logs the errors Mastra's default handler swallows silently. - customMiddleware only pre-routes paths the custom Hono app owns, so it no longer consumes the body of Mastra-owned routes (/chat etc.). - Memory embeddings -> @mastra/fastembed (local ONNX, no OpenAI quota). Web: - Delete conversation: call the real agents /conversations/:id (the old /api/chat route never existed -> 404 -> deletes silently failed) + navigate to /chat instead of the marketing landing. - Settings sidebar double-highlight fixed (most-specific active match). - Sidebar nav: fixed the data-active presence-match CVA bug (solid pills -> clean ghost rows, sidebar-07 look); account-menu redesign; Color-theme submenu portal fix. - Color theme presets now tint the whole surface (send button, user bubble, active row, surface tokens), not just the sidebar nav. - Image attachments wired end-to-end (vision enabled, local capability read, data-URL file handling, route forwards image parts to the vision model). Co-Authored-By: Claude Opus 4.8 (1M context) --- .beads/export-state.json | 2 +- .beads/issues.jsonl | 18 + package-lock.json | 613 +++++++++++++++--- package.json | 4 +- packages/agents/package.json | 1 + packages/agents/src/lib/zapier/sdk.ts | 25 +- packages/agents/src/mastra/agents/foreman.ts | 4 +- .../agents/src/mastra/agents/supervisor.ts | 4 +- packages/agents/src/mastra/index.ts | 89 ++- .../agents/src/mastra/tools/attach-trigger.ts | 1 - .../agents/src/mastra/tools/connect-zapier.ts | 1 - .../src/mastra/tools/delete-workflow.ts | 1 - .../agents/src/mastra/tools/detach-trigger.ts | 1 - .../src/mastra/tools/fork-conversation.ts | 1 - .../agents/src/mastra/tools/get-workflow.ts | 1 - .../mastra/tools/list-workflow-triggers.ts | 1 - .../agents/src/mastra/tools/list-workflows.ts | 1 - .../agents/src/mastra/tools/run-workflow.ts | 1 - .../agents/src/mastra/tools/save-workflow.ts | 1 - .../agents/src/mastra/tools/search-history.ts | 1 - .../src/mastra/tools/update-workflow.ts | 1 - packages/web/src/app/globals.css | 25 +- packages/web/src/components/chat/message.tsx | 6 +- .../src/components/chat/multimodal-input.tsx | 6 +- .../chat/multimodal/attachments-button.tsx | 15 +- .../components/chat/multimodal/file-upload.ts | 131 ++-- .../multimodal/model-selector-compact.tsx | 17 +- .../components/chat/sidebar-history-item.tsx | 2 +- .../src/components/chat/sidebar-history.tsx | 49 +- .../src/components/chat/sidebar-user-nav.tsx | 44 +- .../src/components/chat/suggested-actions.tsx | 2 +- .../components/settings/settings-shell.tsx | 10 +- .../web/src/components/ui/dropdown-menu.tsx | 20 +- packages/web/src/components/ui/sidebar.tsx | 2 +- packages/web/src/lib/ai/models.ts | 9 +- 35 files changed, 821 insertions(+), 289 deletions(-) diff --git a/.beads/export-state.json b/.beads/export-state.json index 3905e1ce..c5cb245f 100644 --- a/.beads/export-state.json +++ b/.beads/export-state.json @@ -1 +1 @@ -{"last_dolt_commit":"o8vu7a0cluhbge8dvgcci6eteo0vknre","timestamp":"2026-06-16T10:04:37.662891-07:00","issues":256,"memories":0} \ No newline at end of file +{"last_dolt_commit":"7i2ikofoh6l5a5bsjhqehuu8jtclah6n","timestamp":"2026-06-18T12:51:47.0442749-07:00","issues":274,"memories":0} \ No newline at end of file diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index e76f425f..415aacae 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -1,6 +1,12 @@ {"_type":"issue","id":"foreman-dm3","title":"Use Mastra Memory APIs properly across the stack","description":"Replace custom message serialization with recall(), enable generateTitle, use Memory's native thread/message management instead of rolling our own. Fixes: GET /conversations/:id flattening messages, custom title generation in /chat endpoint, frontend proxy mangling message format.","status":"closed","priority":0,"issue_type":"bug","assignee":"HamChowderr","owner":"admin@otakusolutions.io","created_at":"2026-04-21T00:12:08Z","created_by":"HamChowderr","updated_at":"2026-04-21T00:17:31Z","closed_at":"2026-04-21T00:17:31Z","close_reason":"Implemented proper Mastra Memory patterns: generateTitle on agent config, recall() with raw messages in GET route, removed custom title gen from both /chat and /:id/messages endpoints, frontend proxy converts MastraDBMessage to UIMessage parts correctly, empty messages filtered","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"foreman-4m1","title":"EPIC: Zapier SDK MCP integration + tool architecture refactor","description":"Replace custom Zapier tools with SDK's built-in MCP server. Refactor agent tool architecture for reliability. Save SDK docs to repo.","status":"closed","priority":0,"issue_type":"epic","owner":"admin@otakusolutions.io","created_at":"2026-04-18T22:53:39Z","created_by":"HamChowderr","updated_at":"2026-04-19T00:48:03Z","closed_at":"2026-04-19T00:48:03Z","close_reason":"Epic complete. MCP server integrated (33 tools), 8 custom tools removed, 3 kept. Added: toModelOutput, requireApproval, ToolSearchProcessor, strict mode, savePerStep, prepareStep, dynamic credentials, lifecycle hooks, tool streaming, prompt rewrite. SDK docs saved to repo.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"foreman-ltn","title":"Fix generate endpoint: threadId required by observational memory","description":"POST /api/agents/foreman/generate fails with 'ObservationalMemory requires a threadId'. The Mastra built-in generate route doesn't auto-create threads. Either fix the request format or make observational memory lazy.","status":"closed","priority":0,"issue_type":"bug","owner":"admin@otakusolutions.io","created_at":"2026-04-18T04:14:36Z","created_by":"HamChowderr","updated_at":"2026-04-18T05:18:13Z","closed_at":"2026-04-18T05:18:13Z","close_reason":"Fixed earlier: title generate passes memory context (thread + resource). Verified in server test.","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-gld8","title":"Chat 500 root cause: invalid ANTHROPIC_API_KEY in agents/.env.local","description":"Every agent (foreman/discovery/execution/history/supervisor) and even GET /api/agents return 500 {error: Internal Server Error}. Real cause found via standalone repro (scripts/repro-agent-500.ts bypassing Mastra's console/pino mangling): Anthropic returns 401 'invalid x-api-key' on every model call. The key in packages/agents/.env.local is well-formed (sk-ant-api03-, 108 chars) but rejected = expired/revoked/wrong-workspace. Mastra wraps the 401 as generic 'Internal Server Error'. Earlier OpenAI-quota theory was a red herring from stale logs; fastembed fixed embeddings but model calls still fail. FIX: user must replace ANTHROPIC_API_KEY with a valid key, then restart agents dev server. Not something Claude can do (entering API keys is prohibited).","notes":"RESOLVED. Chat was THREE stacked bugs: (1) invalid ANTHROPIC_API_KEY -\u003e fixed via Infisical (otaku-internal/dev); keys commented out of agents/.env.local so Infisical supplies them; run agents with 'infisical run --projectId e56e0da5-... --env dev --recursive --silent -- npm run dev'. (2) custom tools set strict:true -\u003e Anthropic grammar mode + schema limits -\u003e removed strict:true from all 12 custom tools. (3) THE BIG ONE: @mastra/deployer + @mastra/server resolved to 1.43.0 (via ^1.42.0-alpha.3 range) while @mastra/core pinned to 1.42.0-alpha.3. deployer 1.43.0 calls this.mastra.getStudio() (added in core 1.43.0) which doesn't exist on core 1.42.0-alpha.3 -\u003e TypeError in checkRouteAuth -\u003e EVERY authed HTTP route 500s (built-in /api/agents AND custom /chat) while agents worked in-process. FIX: pinned @mastra/deployer + @mastra/server to 1.42.0-alpha.3 in root overrides + full reinstall. Found the real error by adding server.onError (Mastra's default silently swallows custom-route errors). VERIFIED: /chat/foreman streams 200, /api/agents 200, custom routes still 401. Also kept: prefix-based customMiddleware (avoids body-consumption for Mastra-owned paths), server.onError (logs swallowed errors).","status":"closed","priority":1,"issue_type":"bug","owner":"admin@otakusolutions.io","created_at":"2026-06-18T17:42:23Z","created_by":"HamChowderr","updated_at":"2026-06-18T19:39:44Z","closed_at":"2026-06-18T19:39:44Z","close_reason":"All 3 root causes fixed (key via Infisical, strict:true removed, @mastra/deployer+server pinned to 1.42.0-alpha.3 to match core). /chat streams 200, verified.","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-kpxf","title":"Chat image upload: enable vision + wire AI Elements/AI SDK file parts","description":"Paperclip greyed: models.ts vision:false, missing /api/models + /api/files/upload. Fix via existing AI Elements PromptInput + AI SDK v6 native file parts (no storage endpoint), like storycraft. Enable vision, fix capability read, route attachments through useProviderAttachments, render image parts.","status":"open","priority":1,"issue_type":"feature","owner":"admin@otakusolutions.io","created_at":"2026-06-18T16:21:14Z","created_by":"HamChowderr","updated_at":"2026-06-18T16:21:14Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-s3qd","title":"Onboarding 'test connection' fails on first connect (ZapierNotConnected race)","description":"step-try.tsx hits /chat/foreman right after OAuth; getSdkForUser reads zapier_identity before the write is visible -\u003e ZapierNotConnected, opaque error. Fix: read-after-write retry in zapier/sdk.ts + 'syncing connection' UX in step-try.tsx.","status":"open","priority":1,"issue_type":"bug","owner":"admin@otakusolutions.io","created_at":"2026-06-18T16:21:07Z","created_by":"HamChowderr","updated_at":"2026-06-18T16:21:07Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-dz3b","title":"Chore branch: zod resolves to 2 versions (4.4.3 + 4.3.6) — npm ci fails dep-uniqueness on PR #20","description":"On PR #20 (chore/zapier-sdk-0.70.4-durable-reverify -\u003e main) ALL CI jobs fail at npm ci because the dep-uniqueness postinstall check reports 'zod has 2 resolved versions: 4.4.3, 4.3.6'. The SDK 0.70.4 bump (and/or @mastra alpha) pulled in a transitive zod@4.3.6 alongside the pinned 4.4.3; the root override {zod:4.4.3} didn't collapse it because package-lock.json wasn't regenerated after the bump. Fix: regenerate the lockfile (npm install at root so the override applies), verify 'node scripts/check-dep-uniqueness.mjs' + 'npm ci' pass locally, commit the lockfile to the chore branch, push, re-run #20 CI. Blocks merging today's README/.env/versioning work to main and the v0.1.0 baseline tag.","status":"closed","priority":1,"issue_type":"bug","assignee":"HamChowderr","owner":"admin@otakusolutions.io","created_at":"2026-06-18T03:42:05Z","created_by":"HamChowderr","updated_at":"2026-06-18T04:05:39Z","started_at":"2026-06-18T03:44:39Z","closed_at":"2026-06-18T04:05:39Z","close_reason":"Fixed: aligned zod override to 4.3.6 (SDK 0.70.4's exact pin); single zod, dep-uniqueness + all CI green. Merged to main via PR #20.","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-xb68","title":"Full live-introspection sweep of @zapier/zapier-sdk 0.70.4","description":"Full SDK surface sweep — see session","status":"closed","priority":1,"issue_type":"task","assignee":"HamChowderr","owner":"admin@otakusolutions.io","created_at":"2026-06-17T04:01:27Z","created_by":"HamChowderr","updated_at":"2026-06-17T04:12:41Z","started_at":"2026-06-17T04:01:48Z","closed_at":"2026-06-17T04:12:41Z","close_reason":"Live-introspected @zapier/zapier-sdk@0.70.4 via new scripts/sdk-surface-sweep.ts. Verified: 4 entrypoints (., ./experimental, ./define, ./apps); main instance 39 methods / mcp registry 37; experimental 75/71; 36 experimental-only (18 trigger-inbox + 5 durable-run + 13 workflow); 208 named exports on main. Documented previously-missed surfaces: ./define durable authoring DSL (defineDurable/defineTool/defineComponent + step/wait/createCallback), the 208-export plugin/resolver/schema/telemetry runtime, getRegistry package-variant counts, full deprecated-alias map. Corrected Foreman tool count 20-\u003e28. Action-type enum still 8 (no Zap-creation). Durable wall unchanged (18/18). Refreshed docs/zapier-sdk-capability-map.md. Spawned foreman-f1ef (input-field categorization inverted) + foreman-3due (error coverage 12/19).","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-ykfu","title":"Full live-introspection sweep of @zapier/zapier-sdk 0.70.4 — every entrypoint, registry, export","description":"User wants complete, verified knowledge of the ENTIRE SDK surface (not just durable/workflows) to showcase to the Zapier community via Foreman. Prior capability map (docs/zapier-sdk-capability-map.md) is doc/changelog-derived and snapshotted at 0.69.3 — never live-introspected. This sweep introspects the installed 0.70.4 package directly: all 4 entrypoints (., ./experimental, ./define, ./apps), getRegistry() across all 'package' values, full SDK instance method list (main vs experimental), every named export (classes/constants/formatters/resolvers/services/utils), action-type enum, and the low-level API client surface. Then diff vs Foreman's READ_ONLY/APPROVAL_REQUIRED/EXCLUDED/PAGINATED sets to surface anything un-categorized (blind spots). Deliverable: refreshed capability map at 0.70.4 with live-verified counts.","status":"open","priority":1,"issue_type":"task","owner":"admin@otakusolutions.io","created_at":"2026-06-17T04:01:19Z","created_by":"HamChowderr","updated_at":"2026-06-17T04:01:19Z","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"foreman-2xdk","title":"[bump] Behavior-change verification checklist (approvalMode, auth, normalizeError, pagination, zod)","description":"Gate for the 0.48-\u003e0.69 bump (foreman-8ujc). Verify against real code: (1) 0.50 approvalMode collapse, no back-compat — Foreman leaves approvalMode unset so responses throw ZapierApprovalError; confirm handleSdkError in zapier-sdk-tools.ts still works. (2) 0.51 client-credentials auth default — CONFIRMED WORKING via probe (getProfile OK 2026-06-11); re-verify per-user PKCE path in lib/zapier/sdk.ts. (3) 0.67 normalizeError no longer wraps Error subclasses — check instanceof reliance in handleSdkError. (4) 0.69.1 pagination consume-once — check seed.ts/discovery.ts. (5) zod: SDK wants 4.3.6, repo overrides 4.4.3; npm run check:deps must pass.","acceptance_criteria":"All 5 checks verified; npm install + check:deps + build + test (mocked) + test:sdk green. Blocks foreman-8ujc.","notes":"DONE 2026-06-11. All 5 behavior checks PASS (static + 0.69.3 .d.ts inspection + a reverted trial install of 0.69.3). Full detail lives in docs/zapier-sdk-capability-map.md (Bump-verification checklist + Install mechanics). Summary: (1) approvalMode unset-\u003eserver default 'throw'-\u003eZapierApprovalError caught by handleSdkError catch-all (ZapierApprovalError extends ZapierError); follow-up filed for unsurfaced approval URL. (2) string credentials still valid (per-user PKCE path OK). (3) instanceof error handling intact; all 11 Zapier*Error classes present. (4) listApps {data,nextCursor} unchanged; zero .items() calls; consume-once-immune. (5) zod collapses to single 4.4.3 ONLY on a full clean reinstall, not incremental. Trial also discovered: a clean reinstall drifts @mastra (memory 1.17.5-\u003e1.20.2, pg 1.10.0-\u003e1.12.1) incompatible w/ pinned core@1.32.1 -\u003e 5 mocked-test failures unrelated to Zapier. Working tree restored to committed state (SDK 0.48.0, single zod, check:deps PASS, prev-failing tests 7/7 green). build+test+test:sdk-green AT 0.69.3 folded into 8ujc (can't be green without committing the bump + pinning @mastra).","status":"closed","priority":1,"issue_type":"task","assignee":"HamChowderr","owner":"admin@otakusolutions.io","created_at":"2026-06-11T08:30:12Z","created_by":"HamChowderr","updated_at":"2026-06-11T15:11:13Z","started_at":"2026-06-11T14:45:57Z","closed_at":"2026-06-11T15:11:13Z","close_reason":"All 5 behavior changes verified safe (static + 0.69.3 .d.ts + reverted trial install). check:deps proven green via clean reinstall. Install mechanics (zod clean-reinstall requirement + @mastra drift) + remaining gate-suite-green folded into foreman-8ujc; UX follow-up filed. Full record in docs/zapier-sdk-capability-map.md.","dependencies":[{"issue_id":"foreman-2xdk","depends_on_id":"foreman-8ujc","type":"discovered-from","created_at":"2026-06-11T01:30:12Z","created_by":"HamChowderr","metadata":"{}"}],"dependency_count":0,"dependent_count":1,"comment_count":0} {"_type":"issue","id":"foreman-1ey8","title":"Generate supabase types + fix schema.ts drift","description":"Replace hand-written schema.ts with supabase gen types output, fix UserRow camelCase, drop stale org_id refs, add WorkflowTriggerRow.","status":"closed","priority":1,"issue_type":"chore","owner":"admin@otakusolutions.io","created_at":"2026-05-10T20:38:59Z","created_by":"HamChowderr","updated_at":"2026-05-11T01:16:48Z","closed_at":"2026-05-11T01:16:48Z","close_reason":"Generated types replace hand-written schema.ts (deleted). New stored_agent migration ports tables that /editor needed. Typed client uncovered org_id→workspace_id stale ref in zapier/sdk.ts (fixed). CI job db-types runs supabase gen types and diffs against committed file.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"foreman-9zsp","title":"Wire AIMock GitHub Action — run agent tests on every PR","description":"Foreman has no CI workflows today. Local-only test runs via vitest globalSetup at packages/agents/tests/aimock-setup.ts work, but nothing watches PRs. Wire CopilotKit/aimock@v1 (or whatever the current pinned major is — verify on https://aimock.copilotkit.dev/github-action/ before writing) into .github/workflows/test.yml.\n\nScope:\n1. Read https://aimock.copilotkit.dev/github-action/ for current action API + version pin recommendation. Do not guess from training data.\n2. Create .github/workflows/test.yml with jobs:\n - agents: runs 'cd packages/agents \u0026\u0026 npm test' under aimock action with the local aimock.json\n - web: runs 'cd packages/web \u0026\u0026 npm run build' (+ lint)\n - root: runs 'npm run lint' and dep-uniqueness check\n3. Trigger on push to main + PR.\n4. Cache npm via actions/setup-node cache option.\n5. Confirm aimock action picks up packages/agents/aimock.json + packages/agents/tests/fixtures/aimock/ correctly.\n6. Open a throwaway PR to verify the workflow runs green, then merge.\n\nAcceptance:\n- New PRs show test status checks before merge\n- Failure on agent test breaks the build","notes":"Unblock CI on PR #14: (1) restored chat-adapter transitive deps (113 packages — discord.js, @octokit/*, @linear/sdk, @slack/*, @googleapis/*, @microsoft/teams.*) that broke mastra dev and npm ci; (2) added biome format step to supabase db:types codegen pipeline so generated database.types.ts conforms to project style — no workaround; (3) biome auto-formatted 7 other source files; (4) untracked fumadocs .source/ (already gitignored, regen on postinstall).","status":"closed","priority":1,"issue_type":"task","assignee":"HamChowderr","owner":"admin@otakusolutions.io","created_at":"2026-05-09T23:31:33Z","created_by":"HamChowderr","updated_at":"2026-06-11T19:41:22Z","started_at":"2026-05-09T23:31:55Z","closed_at":"2026-06-11T19:41:22Z","close_reason":"CI agent tests green on main (run 27372554494/040b6a6) via in-process AIMock — acceptance met. v4i4 (fixture-drift design, P4) is a future enhancement, not a prerequisite; unblock-dep over-scoped.","dependencies":[{"issue_id":"foreman-9zsp","depends_on_id":"foreman-v4i4","type":"blocks","created_at":"2026-05-09T16:31:49Z","created_by":"HamChowderr","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} @@ -92,6 +98,15 @@ {"_type":"issue","id":"foreman-b4m","title":"Monorepo extraction: standalone Mastra/Hono agent server + Next.js frontend","status":"closed","priority":1,"issue_type":"epic","owner":"admin@otakusolutions.io","created_at":"2026-04-18T02:44:42Z","created_by":"HamChowderr","updated_at":"2026-04-18T03:20:51Z","closed_at":"2026-04-18T03:20:51Z","close_reason":"Epic complete: monorepo extracted. packages/agents/ (Hono) + packages/web/ (Next.js). Web builds clean.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"foreman-m2m","title":"Monorepo extraction: standalone Mastra/Hono agent server + Next.js frontend","description":"Split the embedded Mastra agent out of Next.js into a standalone Hono server (packages/agents/) that exposes REST + A2A + MCP. Next.js frontend (packages/web/) becomes a thin UI layer. Follows Otaku Solutions canonical architecture.","status":"closed","priority":1,"issue_type":"epic","owner":"admin@otakusolutions.io","created_at":"2026-04-18T02:44:30Z","created_by":"HamChowderr","updated_at":"2026-04-18T03:50:20Z","closed_at":"2026-04-18T03:50:20Z","close_reason":"Epic complete: monorepo extracted, web builds, agent server configured with multi-target deploy.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"foreman-0zs","title":"Deploy to Vercel","description":"Env vars set, LibSQL hosted (Turso or self-hosted), domain configured. AC: Production URL responds. Can sign up, connect Zapier, run an action end-to-end.","status":"closed","priority":1,"issue_type":"task","assignee":"HamChowderr","owner":"admin@otakusolutions.io","created_at":"2026-04-17T18:28:13Z","created_by":"HamChowderr","updated_at":"2026-04-19T01:41:35Z","closed_at":"2026-04-19T01:41:35Z","close_reason":"Deployed both services. Web frontend on Vercel (foreman-three.vercel.app), agent server on Coolify/Hostinger VPS (foreman-agents.otakusolutions.io:4111). Coolify app UUID: oqshe32xh3v8zva7tt6r4aff. Dockerfile.agents uses multi-stage build with node:22-slim. 14 env vars configured. Using test Clerk keys (prod requires custom domain).","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-aj6m","title":"Delete conversation: wrong endpoint (404) + navigates to landing","description":"Frontend handleDelete (sidebar-history.tsx) DELETEs to /api/chat?id= which does NOT exist (only /api/history exists) -\u003e 404 -\u003e row never deleted -\u003e reappears on revalidation. Also router.replace('/') sends user to marketing landing. FIX: DELETE to agents ${agentUrl}/conversations/:id with auth (like Rename), optimistic mutate with revalidate:false, navigate to /chat not /. Also noted: 'Delete all' button hits no-op /api/history DELETE (same class, still broken).","status":"open","priority":2,"issue_type":"bug","owner":"admin@otakusolutions.io","created_at":"2026-06-18T18:47:20Z","created_by":"HamChowderr","updated_at":"2026-06-18T18:47:20Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-bk69","title":"Sidebar nav renders as solid-filled brand pills (data-active presence-match bug)","description":"app-sidebar nav items (New chat/Workflows/Settings/Delete all) rendered as solid saturated-colored pills at rest. Root cause: ui/sidebar.tsx sidebarMenuButtonVariants used Tailwind presence-form data-active:bg-sidebar-accent, but SidebarMenuButton renders data-active={isActive} with isActive=false default -\u003e data-active='false' attribute is PRESENT -\u003e presence variant fires on every inactive button. Template worked around it on history items (data-active:bg-transparent) but not nav items. Compounded by theme presets defining --sidebar-accent as a saturated brand color (shadcn expects a subtle hover gray). FIX: changed CVA to value-form data-[active=true]: (canonical shadcn). Verified: nav now clean ghost rows. Aligns with user's sidebar-07 preference.","status":"closed","priority":2,"issue_type":"bug","owner":"admin@otakusolutions.io","created_at":"2026-06-18T17:42:30Z","created_by":"HamChowderr","updated_at":"2026-06-18T17:42:41Z","closed_at":"2026-06-18T17:42:41Z","close_reason":"Fixed: ui/sidebar.tsx CVA changed data-active: -\u003e data-[active=true]:. Nav now renders clean ghost rows, verified in browser.","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-fkoh","title":"Color theme presets: tint main chat surfaces, not just sidebar nav","description":"The bottom-left color theme switcher works (tokens change on \u003chtml\u003e) but only visibly repaints the left sidebar nav buttons + focus rings. The whole center conversation area (background, cards, input, message bubbles, history rows) stays neutral near-black across every preset because presets only saturate --primary/--ring/--sidebar-*/--chart-*, leaving --background/--card/--muted/--border neutral. Also a default-vs-preset inconsistency: default --accent is brand orange, every preset --accent is neutral gray. Make the preset hue reach the surfaces the user actually looks at: subtle brand tint on elevated surface tokens via @theme inline color-mix, plus targeted --primary on send button, user message bubble, active conversation row, suggested-card hover.","notes":"Implemented bolder surface tinting (user chose 'tint surfaces'). 6 edits: (1) globals.css @theme inline surface tokens color-mix toward --primary [bg 3%, card/popover 5%, secondary/muted 7%, accent 20%, border/input 10%, sidebar 4%] - one DRY change auto-scales to every preset incl default. (2) send button bg-foreground-\u003ebg-primary. (3) user bubble bg-secondary-\u003ebg-primary. (4) active history row dashed-underline -\u003e bg-primary/10 pill. (5) suggested cards hover:border-primary/40. Verified live: ocean-breeze blue nav/send/bubble; rose-garden -\u003e nav+bubble+bg-wash all rose. Biome clean. NOT committed (awaiting user reaction). Unrelated chat-500 persists.","status":"open","priority":2,"issue_type":"feature","owner":"admin@otakusolutions.io","created_at":"2026-06-18T17:18:57Z","created_by":"HamChowderr","updated_at":"2026-06-18T17:23:42Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-v9z3","title":"Redesign bottom-left account menu (sidebar-user-nav) + fix nonsensical scroll","description":"DropdownMenuContent width pinned to narrow sidebar (w-(--radix-popper-anchor-width)), unpolished; Color theme preset submenu likely causes odd scroll. Fix: proper width (w-56), header row + icons, max-h on submenu.","status":"open","priority":2,"issue_type":"bug","owner":"admin@otakusolutions.io","created_at":"2026-06-18T16:21:17Z","created_by":"HamChowderr","updated_at":"2026-06-18T16:21:17Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-shg7","title":"Settings sidebar double-highlights Integrations + API Keys","description":"settings-shell.tsx active logic uses pathname.startsWith(href); API Keys route /settings/integrations/mcp is a sub-path of /settings/integrations so both highlight. Fix: most-specific match wins.","status":"open","priority":2,"issue_type":"bug","owner":"admin@otakusolutions.io","created_at":"2026-06-18T16:21:11Z","created_by":"HamChowderr","updated_at":"2026-06-18T16:21:11Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-x8rj","title":"CI: db-types Docker pull of postgres-meta hits AWS ECR rate-limit (toomanyrequests)","description":"The 'db types fresh' job runs 'supabase gen types --local', which pulls public.ecr.aws/supabase/postgres-meta unauthenticated. On shared runners this intermittently fails with 'docker: toomanyrequests: Rate exceeded' (exit 125), producing empty type output and a false diff failure. Distinct from foreman-fjl3 (the supabase-CLI GitHub-API rate-limit, fixed by pinning). Harden by authenticating Docker pulls (docker/login-action with a token) or pre-pulling/caching the postgres-meta image. Hit twice this session; a re-run currently clears it.","status":"open","priority":2,"issue_type":"task","owner":"admin@otakusolutions.io","created_at":"2026-06-18T04:06:29Z","created_by":"HamChowderr","updated_at":"2026-06-18T04:06:29Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-fjl3","title":"CI: pin/auth Supabase CLI in db-types job to stop rate-limit flakes","description":"The 'db types fresh' job uses supabase/setup-cli which resolves the LATEST release via an unauthenticated GitHub API call. That got rate-limited on PR #18 ('Failed to resolve latest Supabase CLI release: rate limit exceeded'), failing the job in 9s with no real type drift. Pin the CLI to a fixed version (and/or pass GITHUB_TOKEN to the setup action) so the job is deterministic and not subject to anonymous API rate limits.","status":"closed","priority":2,"issue_type":"task","owner":"admin@otakusolutions.io","created_at":"2026-06-18T02:10:09Z","created_by":"HamChowderr","updated_at":"2026-06-18T03:38:15Z","closed_at":"2026-06-18T03:38:15Z","close_reason":"Merged to main via PR #19 (squash); db-types verified green in CI with pinned supabase-cli 2.107.0.","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-g0tf","title":"README: document Zapier SDK CLI, login methods, sdk:check + add .env.example","description":"Update README for Zapier-community newcomers: new 'Working with the Zapier SDK' section (two packages, four login methods, npm run sdk:check, explore-yourself docs links), fix stale tool count 34-\u003e28 (x6) and 17-\u003e16 read-only, repoint dead 'see CLAUDE.md for env vars' pointer, and add packages/agents/.env.example + packages/web/.env.example (no .env.example existed).","status":"closed","priority":2,"issue_type":"task","owner":"admin@otakusolutions.io","created_at":"2026-06-17T22:54:14Z","created_by":"HamChowderr","updated_at":"2026-06-17T22:57:31Z","closed_at":"2026-06-17T22:57:31Z","close_reason":"Applied: new 'Working with the Zapier SDK' README section (CLI, 4 login methods, sdk:check, explore-yourself docs links), 34-\u003e28 (x6) + 17-\u003e16 count fixes, env-var pointer repointed, and packages/agents+web/.env.example created. Uncommitted pending user's commit decision.","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-f1ef","title":"F1: Zapier input-field tool categorization is inverted (canonical vs deprecated)","description":"Live sweep (foreman-xb68) proved the SDK's canonical input-field methods are getActionInputFieldsSchema/listActionInputFields/listActionInputFieldChoices; the *InputField* names are deprecated aliases (dist/plugins/deprecated/inputFields.js). zapier-sdk-tools.ts has it backwards: READ_ONLY holds the deprecated getInputFieldsSchema+listInputFieldChoices, EXCLUDED holds only listInputFields (1 of 3 aliases), and the 3 canonical methods are auto-surfaced as tools with readOnlyHint:false (wrong) and as duplicates. Agent sees 5 tools for 3 ops. Correct: canonical trio -\u003e READ_ONLY; all 7 deprecated aliases -\u003e EXCLUDED. BLAST RADIUS: deprecated kebab names get-input-fields-schema/list-input-field-choices are pinned in eval trajectories (scripts/datasets-label.ts, datasets-mini-experiment.ts), the live SDK test (tests/sdk/zapier-sdk.test.ts execs them by name), and web docs (tool-discovery.mdx). Must re-label in lockstep or live test + trajectory scorer break. Forward risk: alias removal by Zapier breaks them anyway.","status":"open","priority":2,"issue_type":"bug","owner":"admin@otakusolutions.io","created_at":"2026-06-17T04:11:47Z","created_by":"HamChowderr","updated_at":"2026-06-17T04:11:47Z","dependencies":[{"issue_id":"foreman-f1ef","depends_on_id":"foreman-xb68","type":"discovered-from","created_at":"2026-06-16T21:11:47Z","created_by":"HamChowderr","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"foreman-0yra","title":"Re-verify Zapier durable 403 on latest SDK 0.70.4 before sending engineer brief","description":"Bump @zapier/zapier-sdk 0.69.3 -\u003e 0.70.4 and re-run scripts/durable-pkce-probe.ts to confirm the runDurable userJwt 403 still reproduces on the latest SDK. Closes the 'are you on latest?' gap in docs/zapier-durable-questions-for-engineers.md. Changelog review (0.70.0-0.70.4) showed no durable-auth changes; this is the empirical confirmation.","status":"closed","priority":2,"issue_type":"task","assignee":"HamChowderr","owner":"admin@otakusolutions.io","created_at":"2026-06-16T16:58:24Z","created_by":"HamChowderr","updated_at":"2026-06-16T17:02:57Z","started_at":"2026-06-16T16:58:47Z","closed_at":"2026-06-16T17:02:57Z","close_reason":"Durable 403 reproduced on latest SDK 0.70.4; brief tightened. Version gap + endpoint-coverage honesty both addressed.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"foreman-sg23","title":"Vercel preview build fails (module_not_found) on alpha branch — align install with CI","description":"PR #17 Vercel preview deploy errors at buildStep with errorCode module_not_found ('cd packages/web \u0026\u0026 npm run build' exit 1), while all 5 GHA gating jobs (incl. web next build via npm ci) are GREEN on the same commit, and a clean local build passes. Install succeeds; .source self-regenerates via withMDX so it is not the cause. Build-log API is 403 (CLI token lacks build-log scope), so the exact module is dashboard-only. Divergence: Vercel installCommand 'npm install' (+ possible stale cached node_modules on a fresh branch) vs GHA 'npm ci'. Non-gating (main production deploys are Ready), does not block merge. Fix: set vercel.json installCommand to 'npm ci' to force a clean lockfile-exact install matching the proven-green CI path.","notes":"FIXED properly: root cause was a duplicated react in the alpha-regenerated lockfile — root node_modules/react 19.2.7 (ecosystem ^19.2.0) + nested packages/web/node_modules/react 19.2.4 (web's exact pin). next (hoisted to root) could not resolve react on Vercel's npm. Fix: root overrides react/react-dom=19.2.7 → clean reinstall dedupes to a SINGLE root react 19.2.7 (no nested copy), verified locally (lockfile single entry + web next build exit 0). Reverted the two wrong guesses (npm ci 3e8a5ec, rm -rf a5bb049); installCommand back to npm install.","status":"in_progress","priority":2,"issue_type":"bug","assignee":"HamChowderr","owner":"admin@otakusolutions.io","created_at":"2026-06-12T17:14:15Z","created_by":"HamChowderr","updated_at":"2026-06-12T17:59:22Z","started_at":"2026-06-12T17:14:36Z","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"foreman-hlh0","title":"[web] Surface run fired_by/error_message + fix failed-status badge","description":"The agent API (GET /workflows/:id/runs) now returns fired_by/error_message/trigger_id (foreman-2afc), but the web doesn't render them, and there's a pre-existing display bug: the engine writes status 'failed' but workflows-client WorkflowRun.status + the StatusBadge map only know 'error', so failed runs render as 'running'. Fix: (1) WorkflowRun.status -\u003e 'running'|'success'|'failed' + add fired_by/error_message/trigger_id; (2) [id]/page.tsx StatusBadge map key error-\u003efailed + show how each run fired; (3) run detail page show fired_by + error_message. First visible slice of the broader 'surface new backend in UI' work (foreman-tbjb/7am4/ezsm).","status":"closed","priority":2,"issue_type":"task","owner":"admin@otakusolutions.io","created_at":"2026-06-12T16:30:49Z","created_by":"HamChowderr","updated_at":"2026-06-12T16:34:48Z","closed_at":"2026-06-12T16:34:48Z","close_reason":"Done (ada01c9): WorkflowRun type gains status=failed + fired_by/error_message/trigger_id; run list shows how each run fired + inline error on failure; run detail shows 'started by' + an error box. Fixed the pre-existing bug where failed runs rendered as 'running' (engine writes 'failed', web only knew 'error'). next build green.","dependencies":[{"issue_id":"foreman-hlh0","depends_on_id":"foreman-2afc","type":"discovered-from","created_at":"2026-06-12T09:30:48Z","created_by":"HamChowderr","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} @@ -215,6 +230,9 @@ {"_type":"issue","id":"foreman-c9y","title":"Set up LibSQL + Drizzle ORM","description":"Single LibSQL database for app + Mastra data. Migrations runnable via script. AC: npm run db:migrate creates BetterAuth tables. Connection string in .env.","status":"closed","priority":2,"issue_type":"task","owner":"admin@otakusolutions.io","created_at":"2026-04-17T18:25:48Z","created_by":"HamChowderr","updated_at":"2026-04-17T18:28:37Z","closed_at":"2026-04-17T18:28:37Z","close_reason":"Completed in Phase 1 and Phase 2 (T1-T31 done)","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"foreman-s46","title":"Install and configure BetterAuth","description":"Email/password auth. Session stored in LibSQL. AC: /sign-up and /sign-in pages work. Authenticated session persists across reloads.","status":"closed","priority":2,"issue_type":"task","owner":"admin@otakusolutions.io","created_at":"2026-04-17T18:25:46Z","created_by":"HamChowderr","updated_at":"2026-04-17T18:28:37Z","closed_at":"2026-04-17T18:28:37Z","close_reason":"Completed in Phase 1 and Phase 2 (T1-T31 done)","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"foreman-5ld","title":"Initialize Next.js 15 project","description":"Scaffold Next.js 15 with App Router, TypeScript, Tailwind. AC: npm run dev serves a blank page at /. Project committed to git under C:\\Users\\HamCh\\code\\foreman.","status":"closed","priority":2,"issue_type":"task","owner":"admin@otakusolutions.io","created_at":"2026-04-17T18:25:38Z","created_by":"HamChowderr","updated_at":"2026-04-17T18:28:37Z","closed_at":"2026-04-17T18:28:37Z","close_reason":"Completed in Phase 1 and Phase 2 (T1-T31 done)","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-t6wc","title":"Persist chat uploads to Supabase Storage (follow-up to image upload)","description":"Optional enhancement after AI-Elements data-URL image upload works: add /api/files route (model on agents/routes/voice.ts) + chat-files bucket for history/audit/cross-channel persistence.","status":"open","priority":3,"issue_type":"feature","owner":"admin@otakusolutions.io","created_at":"2026-06-18T16:21:23Z","created_by":"HamChowderr","updated_at":"2026-06-18T16:21:23Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-mhxy","title":"Chat polish: screenshot capture + drag-drop + file-type icons","description":"Port from storycraft/myrp-build ai-elements: screenshot-button.tsx (captureScreenshot), drag-drop on input, file-type icons in preview-attachment, revoke blob URLs on remove.","status":"open","priority":3,"issue_type":"feature","owner":"admin@otakusolutions.io","created_at":"2026-06-18T16:21:20Z","created_by":"HamChowderr","updated_at":"2026-06-18T16:21:20Z","dependency_count":0,"dependent_count":0,"comment_count":0} +{"_type":"issue","id":"foreman-3due","title":"F2: handleSdkError covers 12/19 exported Zapier error classes","description":"Live sweep (foreman-xb68): SDK main entrypoint exports 19 error/signal classes; handleSdkError instanceof-checks 12. Uncovered real errors (ZapierApiError, ZapierBundleError, ZapierConflictError, ZapierUnknownError) fall through to the ZapierError catch-all (degrades fine, no crash). 3 are control-flow signals (ZapierSignal, ZapierAbortDrainSignal, ZapierReleaseTriggerMessageSignal), not errors to surface. Low priority. Only ZapierConflictError (409) plausibly warrants a specific user-facing message. No action required unless we want finer-grained messages.","status":"open","priority":3,"issue_type":"task","owner":"admin@otakusolutions.io","created_at":"2026-06-17T04:11:51Z","created_by":"HamChowderr","updated_at":"2026-06-17T04:11:51Z","dependencies":[{"issue_id":"foreman-3due","depends_on_id":"foreman-xb68","type":"discovered-from","created_at":"2026-06-16T21:11:51Z","created_by":"HamChowderr","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"foreman-hflh","title":"Add .gitattributes to normalize line endings (kill CRLF phantom diffs)","description":"Repo has no .gitattributes; on Windows (autocrlf=true) the working tree is CRLF while git stores LF, producing ~170 phantom modified files each session and blocking clean fast-forwards. Add .gitattributes '* text=auto eol=lf' (+ binary markers).","status":"open","priority":3,"issue_type":"chore","owner":"admin@otakusolutions.io","created_at":"2026-06-12T19:11:26Z","created_by":"HamChowderr","updated_at":"2026-06-12T19:11:26Z","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"foreman-c8fo","title":"[zapier] Poll-trigger connection resolution: normalizeAppKey + numeric-id/alias vs SDK uuid mismatch","description":"Live e2e (foreman-ueep) surfaced this. A poll trigger config storing a raw Zapier app_key (e.g. 'GitHubCLIAPI') fails the real read: runAction does normalizeAppKey('GitHubCLIAPI')='github', then auto-discover findFirstConnection({app:'github'}) does NOT match the connection whose app_key is 'GitHubCLIAPI' -\u003e no connection -\u003e 'access_token missing'. Separately, resolveConnection expects a numeric connection_id or a registered connection_alias, but sdk.findFirstConnection returns a UUID id (e.g. 0206dbe8-...), so passing that id as config.connection throws 'Unknown connection alias'. Net: for a poll trigger to read for real, the app key must be the normalized form AND the user's connection must be discoverable/aliased under it. CONFIRMED WORKING in isolation: sdk.runAction({app:'GitHubCLIAPI', connection:'\u003cuuid\u003e'}) returns {data:[100 repos]} and the poll driver's extractRecords parses it. So this is connection-resolution plumbing, not poll-driver logic (logic proven by tests/live/poll-driver.test.ts). Decide: normalize app keys at attach time, store the resolved connection id, and/or make auto-discover tolerant of raw app_key suffixes.","notes":"RESOLVED / MISDIAGNOSED earlier. There is NO poll-driver or connection-model bug. Proven: the full real poll fire works end-to-end (real Postgres + real Zapier GitHub read) when the poll config uses the CATALOG app key 'github' — baseline sets cursor from the real read, a new record fires one workflow_run (status=success, fired_by=poll, trigger_id set), and dedup prevents a second. Earlier failures were entirely my test input: I used the raw Zapier app_key 'GitHubCLIAPI', and normalizeAppKey('GitHubCLIAPI')='git-hub' (dashed), which Zapier doesn't match. normalize/resolveConnection/findFirstConnection are all fine. RESIDUAL (latent, low priority, NOT poll-specific): normalizeAppKey turns the raw Zapier key 'GitHubCLIAPI' into 'git-hub' rather than 'github', so feeding a raw Zapier app_key into any runAction breaks. Only matters if a caller uses raw Zapier keys instead of catalog keys; the agent/catalog uses normalized keys. Reduce to P3 / hardening.","status":"closed","priority":3,"issue_type":"bug","owner":"admin@otakusolutions.io","created_at":"2026-06-12T06:29:32Z","created_by":"HamChowderr","updated_at":"2026-06-12T16:18:06Z","closed_at":"2026-06-12T16:18:06Z","close_reason":"FIXED (37e324d): added catalog-backed resolveAppSlug (app_key OR slug -\u003e canonical slug; pass-through unchanged when not in catalog), wired into runAction + workflow-step save, replacing the buggy normalizeAppKey at both call sites. Live-verified: the raw 'GitHubCLIAPI' key (previously broke with 'No current_implementation_id') now fires a real workflow_run (status=success) against real Zapier + real Postgres. 5 unit tests; full suite 308 green.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"foreman-m9f6","title":"[channels] Thread real platform message ids into ChannelMessage.dedupeKey","description":"ChannelTriggerSignalProvider dedup falls back to a content hash (channel|room|from|text) when ChannelMessage.dedupeKey is absent, which coalesces a user sending the exact same text back-to-back. Pass each adapter's stable message id as dedupeKey from the ~10 channel-bot call sites (slack/discord/telegram/teams/whatsapp/gchat/github/linear onDirectMessage + onNewMention) where the Chat SDK message exposes one. Removes the false-positive edge; true per-delivery idempotency.","status":"closed","priority":3,"issue_type":"task","assignee":"HamChowderr","owner":"admin@otakusolutions.io","created_at":"2026-06-12T03:31:07Z","created_by":"HamChowderr","updated_at":"2026-06-12T16:46:33Z","started_at":"2026-06-12T16:39:12Z","closed_at":"2026-06-12T16:46:33Z","close_reason":"Threaded normalized Chat SDK message.id into ChannelMessage.dedupeKey across all 8 channel bots (16 call-sites). Provider now dedupes on the real platform message id; content-hash is fallback only. Type-clean, 308 mocked tests green, committed c942a92.","dependencies":[{"issue_id":"foreman-m9f6","depends_on_id":"foreman-tv5p","type":"discovered-from","created_at":"2026-06-11T20:31:07Z","created_by":"HamChowderr","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0} diff --git a/package-lock.json b/package-lock.json index 263ee7fd..6ea7857d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -234,6 +234,128 @@ "url": "https://github.com/sponsors/antfu" } }, + "node_modules/@anush008/tokenizers": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@anush008/tokenizers/-/tokenizers-0.6.0.tgz", + "integrity": "sha512-vbKFjlFM15Ljm6HMh2FSiyPq4236xHoe31XMveTMdwqowHf1/UCwySPT331wl/wRWpdHWdQ3eU5ENl5XbXnPQQ==", + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "optionalDependencies": { + "@anush008/tokenizers-darwin-universal": "0.6.0", + "@anush008/tokenizers-linux-arm64-gnu": "0.6.0", + "@anush008/tokenizers-linux-arm64-musl": "0.6.0", + "@anush008/tokenizers-linux-x64-gnu": "0.6.0", + "@anush008/tokenizers-linux-x64-musl": "0.6.0", + "@anush008/tokenizers-win32-x64-msvc": "0.6.0" + } + }, + "node_modules/@anush008/tokenizers-darwin-universal": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@anush008/tokenizers-darwin-universal/-/tokenizers-darwin-universal-0.6.0.tgz", + "integrity": "sha512-s27bL2x22NiDlhthi7UjGm+Is1tpAg4riLMBzna7Knzp26RdmnhbclWNEDd5UflRzFD49sdHzqv2XP0F2XFrqA==", + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@anush008/tokenizers-linux-arm64-gnu": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@anush008/tokenizers-linux-arm64-gnu/-/tokenizers-linux-arm64-gnu-0.6.0.tgz", + "integrity": "sha512-Go1ssG7AylDFpsDzLkh+nqXt1RcIGhL9pSpPH1nLF504lutxkCZcihESUt6vobtjnCONOAIwCWe1AVEoHui+9A==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@anush008/tokenizers-linux-arm64-musl": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@anush008/tokenizers-linux-arm64-musl/-/tokenizers-linux-arm64-musl-0.6.0.tgz", + "integrity": "sha512-xfnDkjmOUXkVp5jNCnFzd8hTfAbei6UnoYetiadqbfX1o/K+drCV6sHzKadhHuPQlqa+erXdSyQDOtWkAAjN8Q==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@anush008/tokenizers-linux-x64-gnu": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@anush008/tokenizers-linux-x64-gnu/-/tokenizers-linux-x64-gnu-0.6.0.tgz", + "integrity": "sha512-4C9KiC0tdsOJCyOE2sD23zZHW16RbytRfMf81bdkDOLOrvOy0dYT9ZTnpwEl2k7jgzSdSpk9YKCkfEpkqbVvVg==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@anush008/tokenizers-linux-x64-musl": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@anush008/tokenizers-linux-x64-musl/-/tokenizers-linux-x64-musl-0.6.0.tgz", + "integrity": "sha512-4CiqyQEFQpr7xTHv2IGZAoOKr/hIN7obTCaLvxUEjv3MHcpCGYBFpKa5RiRrcskY5k3w06dN9cRaxwsITeAHjw==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@anush008/tokenizers-win32-x64-msvc": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@anush008/tokenizers-win32-x64-msvc/-/tokenizers-win32-x64-msvc-0.6.0.tgz", + "integrity": "sha512-ydjCu4wLdtcS8xOr0uMbRAOHviuFNEMCFM/T/Sw4zxLb+iHS9QboSJZtxMN1VF2dOkjRchtQmLiKK0ttE1iJEQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@arcadeai/arcadejs": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@arcadeai/arcadejs/-/arcadejs-2.4.1.tgz", @@ -449,6 +571,13 @@ "semver": "bin/semver.js" } }, + "node_modules/@babel/helper-compilation-targets/node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "devOptional": true, + "license": "ISC" + }, "node_modules/@babel/helper-create-class-features-plugin": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.29.7.tgz", @@ -799,13 +928,13 @@ } }, "node_modules/@base-ui/react": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@base-ui/react/-/react-1.5.0.tgz", - "integrity": "sha512-z1gSAlced1yY+iM+mHDEtIkD8UI3Ebs52MuBPxvV6f5hRutk+xvCH/wuB7hDqDzK9JG5FoMz5nhrqtSs1wjt1A==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@base-ui/react/-/react-1.6.0.tgz", + "integrity": "sha512-/jzjTWJYXhRFO45Bev9lc3cHbmjzCMpUqbMZ2AgKy/z25mY9B6shGSNcXcjQar9n5doM0KYW1W8fcFv2jZBuMw==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.29.2", - "@base-ui/utils": "0.2.9", + "@base-ui/utils": "0.3.1", "@floating-ui/react-dom": "^2.1.8", "@floating-ui/utils": "^0.2.11", "use-sync-external-store": "^1.6.0" @@ -837,14 +966,14 @@ } }, "node_modules/@base-ui/utils": { - "version": "0.2.9", - "resolved": "https://registry.npmjs.org/@base-ui/utils/-/utils-0.2.9.tgz", - "integrity": "sha512-x/PDDCYzoqPpjrdyb3VcyylTI2IjUXEtYDGi5foh7KsnmNJIIaVwA2GLgDH1dps1GgXiJbA60hM+AyuTfQzIvw==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@base-ui/utils/-/utils-0.3.1.tgz", + "integrity": "sha512-gFFiltORVmW/N6IILTGxizP3PBpVpysqML1ALY5Vk0mH+7faVkCknOU31goYHN5Aoek2dkjxva1XOD2Ce9WuIg==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.29.2", "@floating-ui/utils": "^0.2.11", - "reselect": "^5.1.1", + "reselect": "^5.2.0", "use-sync-external-store": "^1.6.0" }, "peerDependencies": { @@ -2398,22 +2527,6 @@ "node": ">=18" } }, - "node_modules/@esbuild/win32-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", - "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, "node_modules/@exodus/bytes": { "version": "1.15.1", "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.15.1.tgz", @@ -2603,9 +2716,9 @@ } }, "node_modules/@hugeicons/core-free-icons": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@hugeicons/core-free-icons/-/core-free-icons-4.2.0.tgz", - "integrity": "sha512-V1G/Ph9TbmEow+pKnupZRWQjdORR/TGGr3JVRZOWkomdJ/5N6GgLuKPgBDs7G0kZ0//9LL34AGOUzWe3K+umNA==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@hugeicons/core-free-icons/-/core-free-icons-4.2.1.tgz", + "integrity": "sha512-75jYZKYyA9VwS35YRmmGUGzFedbY+Fl0Vxx5FzXR2CGDlIhNRumFeVqaaKoClf2MeYEJwPAVMEL9RwCYtOgnSw==", "license": "MIT" }, "node_modules/@hugeicons/react": { @@ -2617,6 +2730,47 @@ "react": ">=16.0.0" } }, + "node_modules/@huggingface/blake3-jit": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@huggingface/blake3-jit/-/blake3-jit-0.0.2.tgz", + "integrity": "sha512-Bq7B5qabyjrJfhBsl85Jd2QBtf+HzRD7h7A9GfN2lzrrsABhOa5evVPgzoCTxR7Ub0QFj7YDK1YkYRWBU25+2w==", + "license": "MIT" + }, + "node_modules/@huggingface/hub": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/@huggingface/hub/-/hub-2.13.1.tgz", + "integrity": "sha512-2eMXRsSvGSzayXAYKO27PoZdfREY20eNhSU4HRTFwBmKb0L2lAUO9tldJOIol1YtHahgI/cgcpJgCrZArHQtsw==", + "license": "MIT", + "dependencies": { + "@huggingface/tasks": "^0.21.8", + "@huggingface/xetchunk-wasm": "^0.0.6" + }, + "bin": { + "hfjs": "dist/cli.js" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "cli-progress": "^3.12.0" + } + }, + "node_modules/@huggingface/tasks": { + "version": "0.21.13", + "resolved": "https://registry.npmjs.org/@huggingface/tasks/-/tasks-0.21.13.tgz", + "integrity": "sha512-zW8gImE4dzConGeZdlGiLdTgb/mbFuuDdBNEe9fDsx8rv3KsG0OfDp0UY48+cYp/ZxYsBzNr890W22cKLvDLfA==", + "license": "MIT" + }, + "node_modules/@huggingface/xetchunk-wasm": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@huggingface/xetchunk-wasm/-/xetchunk-wasm-0.0.6.tgz", + "integrity": "sha512-LoYPl7jvUvOnkysrhMjAeBzK5mVe2GFu8O3IsZb1w7l7v+NqjDsyRduwct3yraPAGmzTxxdb/2aIORL98Y949g==", + "license": "MIT", + "dependencies": { + "@huggingface/blake3-jit": "0.0.2", + "gearhash-jit": "1.0.2" + } + }, "node_modules/@iconify/types": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz", @@ -3608,6 +3762,18 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/@isaacs/fs-minipass": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", + "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", + "license": "ISC", + "dependencies": { + "minipass": "^7.0.4" + }, + "engines": { + "node": ">=18.0.0" + } + }, "node_modules/@isaacs/ttlcache": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@isaacs/ttlcache/-/ttlcache-2.1.5.tgz", @@ -3797,9 +3963,9 @@ } }, "node_modules/@mastra/deployer": { - "version": "1.43.0", - "resolved": "https://registry.npmjs.org/@mastra/deployer/-/deployer-1.43.0.tgz", - "integrity": "sha512-bNb6z/dR34/CtKBGmurH2aRi1hDLAR0tCwSPcyfLquAa7F30//Mm+zcNXwNrH8ip609hYhu0oSIpjlF1iuvLEA==", + "version": "1.42.0-alpha.3", + "resolved": "https://registry.npmjs.org/@mastra/deployer/-/deployer-1.42.0-alpha.3.tgz", + "integrity": "sha512-fqKJ23+/3gsYWtuHFIJEMsJ5jI81tyslFk75O6lnzofDvkl5k8XS3TtdcCLMMpmUgO0MfAvUkzwTonq2j4R2Ww==", "devOptional": true, "license": "Apache-2.0", "dependencies": { @@ -3807,7 +3973,7 @@ "@babel/preset-typescript": "^7.29.7", "@babel/traverse": "^7.29.7", "@hono/node-ws": "^1.3.0", - "@mastra/server": "1.43.0", + "@mastra/server": "1.42.0-alpha.3", "@optimize-lodash/rollup-plugin": "^5.1.0", "@rollup/plugin-alias": "6.0.0", "@rollup/plugin-commonjs": "29.0.2", @@ -3818,16 +3984,16 @@ "@sindresorhus/slugify": "^2.2.1", "@types/babel__traverse": "^7.28.0", "empathic": "^2.0.0", - "esbuild": "^0.28.0", + "esbuild": "^0.27.4", "find-workspaces": "^0.3.1", - "fs-extra": "^11.3.5", + "fs-extra": "^11.3.4", "hono": "^4.12.8", "local-pkg": "^1.1.2", "resolve.exports": "^2.0.3", - "rollup": "^4.61.1", + "rollup": "^4.59.0", "rollup-plugin-esbuild": "^6.2.1", "strip-json-comments": "^5.0.3", - "tinyglobby": "^0.2.17", + "tinyglobby": "^0.2.16", "typescript-paths": "^1.5.2", "ws": "^8.20.0" }, @@ -3963,6 +4129,22 @@ "@mastra/core": ">=1.0.0-0 <2.0.0-0" } }, + "node_modules/@mastra/fastembed": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@mastra/fastembed/-/fastembed-1.1.2.tgz", + "integrity": "sha512-nddBp5UQScb+BY+fYx4czo4Ch8OPwFV9oc8sabeMvwzAEHttvY4kcKd1fKYBsaYTEwNrYw17Iy6eEcZJ1cfYOw==", + "license": "Apache-2.0", + "dependencies": { + "@anush008/tokenizers": "^0.6.0", + "@huggingface/hub": "^2.12.0", + "onnxruntime-node": "1.26.0", + "progress": "^2.0.3", + "tar": "^7.5.15" + }, + "engines": { + "node": ">=22.13.0" + } + }, "node_modules/@mastra/loggers": { "version": "1.1.2-alpha.0", "resolved": "https://registry.npmjs.org/@mastra/loggers/-/loggers-1.1.2-alpha.0.tgz", @@ -4073,9 +4255,9 @@ } }, "node_modules/@mastra/server": { - "version": "1.43.0", - "resolved": "https://registry.npmjs.org/@mastra/server/-/server-1.43.0.tgz", - "integrity": "sha512-axV2nGgy0yPfAzyX8OSdnewnng3dczvLmHLFLxekEc3Y8aDaSM5SpBk/a9N+JgVZmESlG6r7Fz0A4zreZvbleA==", + "version": "1.42.0-alpha.3", + "resolved": "https://registry.npmjs.org/@mastra/server/-/server-1.42.0-alpha.3.tgz", + "integrity": "sha512-InmbmY0tdITb6hINTZaoqNDbRshOYObeUrL50pWHobZzh0jXGce4X1p7oyZx9ApsPWWuZbWvjryhsOoHICYgpw==", "devOptional": true, "license": "Apache-2.0", "dependencies": { @@ -4696,22 +4878,6 @@ "node": ">= 10" } }, - "node_modules/@next/swc-win32-x64-msvc": { - "version": "16.2.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.2.4.tgz", - "integrity": "sha512-kMVGgsqhO5YTYODD9IPGGhA6iprWidQckK3LmPeW08PIFENRmgfb4MjXHO+p//d+ts2rpjvK5gXWzXSMrPl9cw==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, "node_modules/@noble/hashes": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", @@ -5209,12 +5375,12 @@ "license": "MIT" }, "node_modules/@posthog/core": { - "version": "1.35.1", - "resolved": "https://registry.npmjs.org/@posthog/core/-/core-1.35.1.tgz", - "integrity": "sha512-2a9JgJgR+Ow8lrUQHVZYXH9EgXskYDlpbgNW6UvtsVxp8pEEFD8PxjZMnzq73Dx3NhAwNUrnVpb8KeZzHAtoSA==", + "version": "1.35.2", + "resolved": "https://registry.npmjs.org/@posthog/core/-/core-1.35.2.tgz", + "integrity": "sha512-aV6nkkKCF//NnR9SyQD00+sPg0A4v1m3Xk/fcsnYs+z3qCRXgjwOhfQX2lceAKWlru3o5l9Yn/480GovLOnqKA==", "license": "MIT", "dependencies": { - "@posthog/types": "^1.389.0" + "@posthog/types": "^1.390.0" } }, "node_modules/@posthog/types": { @@ -7550,19 +7716,6 @@ "win32" ] }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.62.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.0.tgz", - "integrity": "sha512-5L+T1fMX4RIEBoZzT0+sQ0PhTS36NULFmMXtl1TZo44TMAROIMHbZufSOjVWt/Y622BtxgxtaNOokbTDvfsrZA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@sapphire/async-queue": { "version": "1.5.5", "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.5.tgz", @@ -8244,7 +8397,7 @@ "node": ">= 20" } }, - "node_modules/@tailwindcss/oxide-win32-x64-msvc": { + "node_modules/@tailwindcss/oxide/node_modules/@tailwindcss/oxide-win32-x64-msvc": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.3.1.tgz", "integrity": "sha512-xDEyu1rg290472FEGaKHnzyDyh5QH+AlWvsU5hMoMtPpzmKlRI0jaYKCgSHDYtaQWZOYbMaduSyCwFwY4n1HmA==", @@ -9190,6 +9343,15 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/adm-zip": { + "version": "0.5.17", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.17.tgz", + "integrity": "sha512-+Ut8d9LLqwEvHHJl1+PIHqoyDxFgVN847JTVM3Izi3xHDWPE4UtzzXysMZQs64DMcrJfBeS/uoEP4AD3HQHnQQ==", + "license": "MIT", + "engines": { + "node": ">=12.0" + } + }, "node_modules/agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -10322,11 +10484,13 @@ } }, "node_modules/chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", - "license": "ISC", - "optional": true + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", + "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } }, "node_modules/ci-info": { "version": "3.9.0", @@ -10391,6 +10555,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/cli-progress": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.12.0.tgz", + "integrity": "sha512-tRkV3HJ1ASwm19THiiLIXLO7Im7wlTuKnvkYaTkyoAPefqjNg7W7DHKUlGRxy9vxDvbyCYQkQozvptuMkGCg8A==", + "license": "MIT", + "optional": true, + "dependencies": { + "string-width": "^4.2.3" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/cli-spinners": { "version": "2.9.2", "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", @@ -11784,7 +11961,6 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "dev": true, "license": "MIT", "dependencies": { "es-define-property": "^1.0.0", @@ -11811,6 +11987,23 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/delaunator": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.1.0.tgz", @@ -12322,6 +12515,22 @@ "@esbuild/win32-x64": "0.28.1" } }, + "node_modules/esbuild/node_modules/@esbuild/win32-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", + "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -13634,6 +13843,12 @@ "node": ">=18" } }, + "node_modules/gearhash-jit": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/gearhash-jit/-/gearhash-jit-1.0.2.tgz", + "integrity": "sha512-UhzJL4KXSdqAKepy/tZwmi2Rcy0YMmtiC4DQS4SURCuIWdh8ECZtnXK2ePRMLigfB61hRKdLK/Vgg2bSw73izQ==", + "license": "MIT" + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", @@ -13803,6 +14018,21 @@ "node": ">= 6" } }, + "node_modules/global-agent": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-4.1.3.tgz", + "integrity": "sha512-KUJEViiuFT3I97t+GYMikLPJS2Lfo/S2F+DQuBWzuzaMPnvt5yyZePzArx36fBzpGTxZjIpDbXLeySLgh+k76g==", + "license": "BSD-3-Clause", + "dependencies": { + "globalthis": "^1.0.2", + "matcher": "^4.0.0", + "semver": "^7.3.5", + "serialize-error": "^8.1.0" + }, + "engines": { + "node": ">=10.0" + } + }, "node_modules/global-directory": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/global-directory/-/global-directory-4.0.1.tgz", @@ -13819,6 +14049,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "license": "MIT", + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/google-auth-library": { "version": "10.5.0", "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-10.5.0.tgz", @@ -13992,7 +14238,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "dev": true, "license": "MIT", "dependencies": { "es-define-property": "^1.0.0" @@ -15693,7 +15938,7 @@ "url": "https://opencollective.com/parcel" } }, - "node_modules/lightningcss-win32-x64-msvc": { + "node_modules/lightningcss/node_modules/lightningcss-win32-x64-msvc": { "version": "1.32.0", "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", @@ -15931,9 +16176,9 @@ "license": "ISC" }, "node_modules/lucide-react": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.20.0.tgz", - "integrity": "sha512-jhXLeC/7m0/tjL1nzMdKk6x256zWA6AtbhTVreHOiKPoeX2d6MK4FbyIQPpVq0E6iPWBisyy1TW+pEge/uMEuQ==", + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.21.0.tgz", + "integrity": "sha512-reEZMXq8Qdd5jg5XYkQ5TR1fB/GiQ7ih4vcrthYDtgjSDwh0i6/YLiGjsWsIwgN49gpAnd4J2elSNzncMEEUUQ==", "license": "ISC", "peerDependencies": { "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" @@ -16096,6 +16341,33 @@ "node": ">=20" } }, + "node_modules/matcher": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/matcher/-/matcher-4.0.0.tgz", + "integrity": "sha512-S6x5wmcDmsDRRU/c2dkccDwQPXoFczc5+HpQ2lON8pnvHlnvHAHj5WlLVvw6n6vNyHuVugYrFohYxbS+pvFpKQ==", + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/matcher/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", @@ -17510,6 +17782,18 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/minizlib": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz", + "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==", + "license": "MIT", + "dependencies": { + "minipass": "^7.1.2" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/mkdirp-classic": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", @@ -17605,9 +17889,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "5.1.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.11.tgz", - "integrity": "sha512-v+KEsUv2ps74PaSKv0gHTxTCgMXOIfBEbaqa6w6ISIGC7ZsvHN4N9oJ8d4cmf0n5oTzQz2SLmThbQWhjd/8eKg==", + "version": "5.1.14", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.14.tgz", + "integrity": "sha512-5c8l8kVzqpnDPaicbEop/fV0Q1w16FmbWtVhMqugTozAwYdlIQojWH5a/M7UfziFmGdQRrUdV+EPzc9Xng3VAQ==", "funding": [ { "type": "github", @@ -17746,6 +18030,22 @@ "react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc" } }, + "node_modules/next/node_modules/@next/swc-win32-x64-msvc": { + "version": "16.2.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.2.4.tgz", + "integrity": "sha512-kMVGgsqhO5YTYODD9IPGGhA6iprWidQckK3LmPeW08PIFENRmgfb4MjXHO+p//d+ts2rpjvK5gXWzXSMrPl9cw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/node-abi": { "version": "3.92.0", "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.92.0.tgz", @@ -17831,9 +18131,9 @@ } }, "node_modules/node-releases": { - "version": "2.0.47", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.47.tgz", - "integrity": "sha512-Uzmd6LXpouKo8EUK68IjH4+E01w/hXyV3R3g/geCJo+rXLNfh1xucB+LOzYEOQPSiUK3h/xZf0cQGcSsmyL2Og==", + "version": "2.0.48", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.48.tgz", + "integrity": "sha512-1uz8041X6LoI6ZSdZacM9lVY28vuzDlSKitnpbSNK0RfKoIJkX29NBPVEFXhnuSuEOA9Ww0xnPJ+ILWbGAv8DA==", "devOptional": true, "license": "MIT", "engines": { @@ -17912,7 +18212,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -18005,6 +18304,29 @@ "regex-recursion": "^6.0.2" } }, + "node_modules/onnxruntime-common": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/onnxruntime-common/-/onnxruntime-common-1.26.0.tgz", + "integrity": "sha512-qVyMR4lcWgbkc4getFV+GQijsTnbg/siteoqcDwa3sI/LxbrMSNw4ePyvCq/ymdQaRomCA7YuWmhzsswxvymdw==", + "license": "MIT" + }, + "node_modules/onnxruntime-node": { + "version": "1.26.0", + "resolved": "https://registry.npmjs.org/onnxruntime-node/-/onnxruntime-node-1.26.0.tgz", + "integrity": "sha512-OHl6PiOEOqxaLHL0N9eFrbzS7IGmu3BtJNH3RTEnRAheCIkfc3gjcjl4sGcjp9C22ZC9YTquDOxSdT/stBQ6BQ==", + "hasInstallScript": true, + "license": "MIT", + "os": [ + "win32", + "darwin", + "linux" + ], + "dependencies": { + "adm-zip": "^0.5.16", + "global-agent": "^4.1.3", + "onnxruntime-common": "1.26.0" + } + }, "node_modules/open": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/open/-/open-10.2.0.tgz", @@ -18731,9 +19053,9 @@ "license": "MIT" }, "node_modules/postcss/node_modules/nanoid": { - "version": "3.3.12", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", - "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", + "version": "3.3.13", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.13.tgz", + "integrity": "sha512-sPdqC6ByMVVGvF1ynvvMo0/o+oD1VX7DaHhijt1bFgjvBkHBib4t49GoNDhf2NDta4oeUNlaGbSt5K7qjZ955Q==", "funding": [ { "type": "github", @@ -18788,12 +19110,12 @@ } }, "node_modules/posthog-node": { - "version": "5.38.0", - "resolved": "https://registry.npmjs.org/posthog-node/-/posthog-node-5.38.0.tgz", - "integrity": "sha512-xEojUWq7ajYfsMPZIexG9xtvhewpqrPWvL/qRhnm8W3KVZi6BlXHe29tjywZJglrDwEQpqdtYKbRXyg2zF9MWw==", + "version": "5.38.1", + "resolved": "https://registry.npmjs.org/posthog-node/-/posthog-node-5.38.1.tgz", + "integrity": "sha512-qjcy8pGrgcycDjUOHv8xOPBJ/5PdjqmeB3LhwDt428LEwMgjLWjUdK6n+g0mjSXhLD9WO6NKFMZH85z4ukKM+w==", "license": "MIT", "dependencies": { - "@posthog/core": "^1.33.0" + "@posthog/core": "^1.35.2" }, "engines": { "node": "^20.20.0 || >=22.22.0" @@ -18904,6 +19226,15 @@ ], "license": "MIT" }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/proper-lockfile": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", @@ -19873,9 +20204,9 @@ } }, "node_modules/remark-cjk-friendly": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/remark-cjk-friendly/-/remark-cjk-friendly-2.2.0.tgz", - "integrity": "sha512-tJ+FkYnE6I+rl6DIQEarJLwvATHPmIE88ac0NWZjB24WR7hdwowvnystZK+df4mC53x0OJEtiexlKbFn9Zz0hA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/remark-cjk-friendly/-/remark-cjk-friendly-2.3.0.tgz", + "integrity": "sha512-o7Vbf9D0gQoUVHuugJbStMGMw8WMQzN784R72WqdafF76oX104efbErAry8RvPcnVojDCUhemixPSq539EYe3A==", "license": "MIT", "dependencies": { "mdast-util-to-markdown-cjk-friendly": "1.0.0", @@ -19895,9 +20226,9 @@ } }, "node_modules/remark-cjk-friendly-gfm-strikethrough": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/remark-cjk-friendly-gfm-strikethrough/-/remark-cjk-friendly-gfm-strikethrough-2.2.0.tgz", - "integrity": "sha512-sj+Jobl4pUmaE539dxuEBntTgkafi/Adl816dBdbpzyPe3n3DceTYokXFGtwX2vjfR4wv8yFJSZac5VUDzjocw==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/remark-cjk-friendly-gfm-strikethrough/-/remark-cjk-friendly-gfm-strikethrough-2.3.0.tgz", + "integrity": "sha512-V8CEeAys4tj8mZuHsL2yXLQrF5RKjBQ609LVXgqTR7wt41Bn5AEwd9ho04Ew7P/aPTl8zXZAcUgDsxw+wQPOwg==", "license": "MIT", "dependencies": { "mdast-util-to-markdown-cjk-friendly-gfm-strikethrough": "1.0.0", @@ -20231,6 +20562,19 @@ "rollup": "^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0" } }, + "node_modules/rollup/node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.62.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.0.tgz", + "integrity": "sha512-5L+T1fMX4RIEBoZzT0+sQ0PhTS36NULFmMXtl1TZo44TMAROIMHbZufSOjVWt/Y622BtxgxtaNOokbTDvfsrZA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/rope-sequence": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.4.tgz", @@ -20476,6 +20820,33 @@ "node": ">=8.0" } }, + "node_modules/serialize-error": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-8.1.0.tgz", + "integrity": "sha512-3NnuWfM6vBYoy5gZFvHiYsVbafvI9vZv/+jlIigFn4oP4zjNPK3LhcY0xSCgeb1a5L8jO71Mit9LlNoi2UfDDQ==", + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/serialize-error/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/serve": { "version": "14.2.6", "resolved": "https://registry.npmjs.org/serve/-/serve-14.2.6.tgz", @@ -21535,6 +21906,22 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/tar": { + "version": "7.5.16", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.16.tgz", + "integrity": "sha512-56adEpPMouktRlBLXiaYFFzZ/3+JXa8P9n7WbR+ibIjtviN55mEaOkiysCnPnWm+7kkui1Dn8J9l+g6zV8731w==", + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.1.0", + "yallist": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/tar-fs": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz", @@ -21548,6 +21935,13 @@ "tar-stream": "^2.1.4" } }, + "node_modules/tar-fs/node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "license": "ISC", + "optional": true + }, "node_modules/tar-fs/node_modules/readable-stream": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", @@ -23007,11 +23401,13 @@ "license": "MIT" }, "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "devOptional": true, - "license": "ISC" + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", + "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } }, "node_modules/yaml": { "version": "2.9.0", @@ -23192,6 +23588,7 @@ "@mastra/duckdb": "1.4.1-alpha.0", "@mastra/editor": "0.11.2-alpha.0", "@mastra/evals": "1.2.4-alpha.0", + "@mastra/fastembed": "^1.1.2", "@mastra/loggers": "1.1.2-alpha.0", "@mastra/memory": "1.20.2-alpha.0", "@mastra/observability": "1.14.1-alpha.1", diff --git a/package.json b/package.json index 3fa7989e..78f9a1eb 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,9 @@ "esbuild": ">=0.25.0", "zod": "4.3.6", "postcss": "^8.5.10", - "@mastra/core": "1.42.0-alpha.3" + "@mastra/core": "1.42.0-alpha.3", + "@mastra/deployer": "1.42.0-alpha.3", + "@mastra/server": "1.42.0-alpha.3" }, "devDependencies": { "@biomejs/biome": "^2.4.12", diff --git a/packages/agents/package.json b/packages/agents/package.json index 6b5af874..3ff5f2d2 100644 --- a/packages/agents/package.json +++ b/packages/agents/package.json @@ -52,6 +52,7 @@ "@mastra/duckdb": "1.4.1-alpha.0", "@mastra/editor": "0.11.2-alpha.0", "@mastra/evals": "1.2.4-alpha.0", + "@mastra/fastembed": "^1.1.2", "@mastra/loggers": "1.1.2-alpha.0", "@mastra/memory": "1.20.2-alpha.0", "@mastra/observability": "1.14.1-alpha.1", diff --git a/packages/agents/src/lib/zapier/sdk.ts b/packages/agents/src/lib/zapier/sdk.ts index 0c2a340e..56976c75 100644 --- a/packages/agents/src/lib/zapier/sdk.ts +++ b/packages/agents/src/lib/zapier/sdk.ts @@ -79,15 +79,24 @@ export async function getSdkForUser(userId: string, orgId?: string): Promise 0) { + await new Promise((resolve) => setTimeout(resolve, 300)); + } + const { data } = await supabase + .from("zapier_identity") + .select("*") + .eq("user_id", userId) + .limit(1) + .maybeSingle(); + identity = data; + } } if (!identity) { diff --git a/packages/agents/src/mastra/agents/foreman.ts b/packages/agents/src/mastra/agents/foreman.ts index bf60b787..c8a713b7 100644 --- a/packages/agents/src/mastra/agents/foreman.ts +++ b/packages/agents/src/mastra/agents/foreman.ts @@ -2,6 +2,7 @@ import { Agent } from "@mastra/core/agent"; import { ToolSearchProcessor } from "@mastra/core/processors"; import { LocalFilesystem, LocalSandbox, Workspace } from "@mastra/core/workspace"; import { createAnswerRelevancyScorer, createToxicityScorer } from "@mastra/evals/scorers/prebuilt"; +import { fastembed } from "@mastra/fastembed"; import { Memory } from "@mastra/memory"; import { PgVector, PostgresStore } from "@mastra/pg"; import { OpenAIVoice } from "@mastra/voice-openai"; @@ -208,7 +209,8 @@ export function createForemanAgent(databaseUrl: string) { id: "foreman-memory-vector", connectionString: databaseUrl, }), - embedder: "openai/text-embedding-3-small", + // Local ONNX embedder (bge-small, 384-dim) — no OpenAI key/quota needed. + embedder: fastembed, options: { lastMessages: 20, generateTitle: { diff --git a/packages/agents/src/mastra/agents/supervisor.ts b/packages/agents/src/mastra/agents/supervisor.ts index d35844bf..65039476 100644 --- a/packages/agents/src/mastra/agents/supervisor.ts +++ b/packages/agents/src/mastra/agents/supervisor.ts @@ -1,4 +1,5 @@ import { Agent } from "@mastra/core/agent"; +import { fastembed } from "@mastra/fastembed"; import { Memory } from "@mastra/memory"; import { PgVector, PostgresStore } from "@mastra/pg"; import { contextInjector, piiRedactor } from "../../lib/processors"; @@ -65,7 +66,8 @@ export function createSupervisorAgent({ id: "supervisor-memory-vector", connectionString: databaseUrl, }), - embedder: "openai/text-embedding-3-small", + // Local ONNX embedder (bge-small, 384-dim) — no OpenAI key/quota needed. + embedder: fastembed, options: { lastMessages: 20, workingMemory: { enabled: true }, diff --git a/packages/agents/src/mastra/index.ts b/packages/agents/src/mastra/index.ts index c5fe0486..d70be315 100644 --- a/packages/agents/src/mastra/index.ts +++ b/packages/agents/src/mastra/index.ts @@ -88,13 +88,48 @@ export function getMastra(): Mastra { historyAgent, }); + // Prefixes owned by the custom Hono app (src/routes). Only these are routed + // through `customRoutes.fetch()`. Everything else (Mastra's own /chat, + // /api/*, /a2a/*, /mcp/*) falls straight through to `next()` WITHOUT touching + // the request body. + // + // Why this matters: a Web `Request` body is a single-read ReadableStream that + // a `.clone()` does NOT duplicate (clone shares the same underlying stream). + // The previous fall-through pattern — `customRoutes.fetch(c.req.raw)` on every + // request, then `next()` on 404 — consumed the POST body, so when Mastra + // dispatched a registered apiRoute (e.g. POST /chat/:agentId) its own + // `c.req.raw.clone().json()` read an already-exhausted stream and 500'd + // *before* the handler ran. Mastra's server.middleware contract is + // headers/context only — it must not read the body of requests it doesn't own. + const CUSTOM_ROUTE_PREFIXES = [ + "/conversations", + "/proposals", + "/workflows", + "/stored", + "/zapier", + "/oauth", + "/webhooks", + "/capabilities", + "/guardrails", + "/voice", + "/api-keys", + "/channel-links", + "/telegram", + "/slack", + "/discord", + ]; const customMiddleware: MiddlewareHandler = async (c, next) => { - const { default: customRoutes } = await import("../routes"); - const response = await customRoutes.fetch(c.req.raw); - if (response.status !== 404) { - return response; + const p = c.req.path; + const owned = CUSTOM_ROUTE_PREFIXES.some( + (prefix) => p === prefix || p.startsWith(`${prefix}/`), + ); + if (!owned) { + // Not a custom route — let Mastra handle it with the body intact. + await next(); + return; } - await next(); + const { default: customRoutes } = await import("../routes"); + return customRoutes.fetch(c.req.raw); }; // Observability is always on so the Mastra Studio Observability tab works. @@ -177,6 +212,14 @@ export function getMastra(): Mastra { port: Number(process.env.PORT) || 4111, host: "0.0.0.0", middleware: [customMiddleware], + // Mastra's default custom-route error handler swallows the error silently + // (returns "Internal Server Error" with no log). This surfaces the real + // error to the server console so failures are debuggable; the client still + // gets a generic message (no stack leak). + onError: (err: any, c: any) => { + console.error("[server.onError]", err?.message, "\n", err?.stack?.slice(0, 1200)); + return c.json({ error: "Internal Server Error" }, 500); + }, apiRoutes: [ registerApiRoute("/chat/:agentId", { method: "POST", @@ -211,6 +254,40 @@ export function getMastra(): Mastra { ? body.messages : ""; + // Forward image attachments (AI SDK v6 `file` parts carrying data + // URLs) so the vision model can actually see them. Without this the + // handler would drop everything except text. + const partsList: any[] = Array.isArray(lastMsg?.parts) ? lastMsg.parts : []; + const imageParts = partsList.filter( + (p: any) => + p?.type === "file" && + typeof p.url === "string" && + String(p.mediaType ?? p.contentType ?? "").startsWith("image/"), + ); + const userContent: any = + imageParts.length > 0 + ? [ + ...imageParts.map((p: any) => { + // Split the data URL ourselves and pass raw base64 + the + // media type from the URL prefix. Passing the whole data + // URL let the AI SDK default the type to image/jpeg, which + // Anthropic rejects ("specified image/jpeg but the image + // appears to be image/png"). + const url = String(p.url); + const m = url.match(/^data:([^;,]+)(?:;base64)?,(.*)$/s); + const mediaType = ( + m?.[1] || + p.mediaType || + p.contentType || + "image/png" + ).trim(); + const image = m ? m[2] : url; + return { type: "image" as const, image, mediaType }; + }), + ...(text ? [{ type: "text" as const, text }] : []), + ] + : text; + const rid = body.resourceId || ""; const incomingTid = body.threadId || body.id; @@ -278,7 +355,7 @@ export function getMastra(): Mastra { ]); const result = await requestUserContext.run({ userId: rid }, () => - agent.stream([{ role: "user" as const, content: text }], { + agent.stream([{ role: "user" as const, content: userContent }], { stopWhen: stepCountIs(15), memory: { thread: tid, resource: rid }, savePerStep: true, diff --git a/packages/agents/src/mastra/tools/attach-trigger.ts b/packages/agents/src/mastra/tools/attach-trigger.ts index a367318f..747e590a 100644 --- a/packages/agents/src/mastra/tools/attach-trigger.ts +++ b/packages/agents/src/mastra/tools/attach-trigger.ts @@ -65,7 +65,6 @@ const pollConfig = z.object({ export const attachTriggerTool = createTool({ id: "attach_trigger", - strict: true, description: "Bind a saved workflow to an event source so it fires automatically. " + "Three trigger types are supported: 'cron' for scheduled runs (e.g. every " + diff --git a/packages/agents/src/mastra/tools/connect-zapier.ts b/packages/agents/src/mastra/tools/connect-zapier.ts index eaf838be..58a8edb6 100644 --- a/packages/agents/src/mastra/tools/connect-zapier.ts +++ b/packages/agents/src/mastra/tools/connect-zapier.ts @@ -37,7 +37,6 @@ function pickExactApp export const connectZapierTool = createTool({ id: "connect_zapier", - strict: true, description: "Generate a URL the user can click to connect an app on Zapier. " + "If appSlug is provided (e.g. 'gmail', 'slack', 'notion'), returns the " + diff --git a/packages/agents/src/mastra/tools/delete-workflow.ts b/packages/agents/src/mastra/tools/delete-workflow.ts index 7a157104..40a56a2a 100644 --- a/packages/agents/src/mastra/tools/delete-workflow.ts +++ b/packages/agents/src/mastra/tools/delete-workflow.ts @@ -4,7 +4,6 @@ import { getSupabase } from "@/lib/db"; export const deleteWorkflowTool = createTool({ id: "delete_workflow", - strict: true, description: "Permanently delete a saved workflow and all of its run history. " + "Cascades to workflow_step + workflow_run rows. This is irreversible. " + diff --git a/packages/agents/src/mastra/tools/detach-trigger.ts b/packages/agents/src/mastra/tools/detach-trigger.ts index af9bb6e7..ab81dea2 100644 --- a/packages/agents/src/mastra/tools/detach-trigger.ts +++ b/packages/agents/src/mastra/tools/detach-trigger.ts @@ -4,7 +4,6 @@ import { getSupabase } from "@/lib/db"; export const detachTriggerTool = createTool({ id: "detach_trigger", - strict: true, description: "Remove a trigger from a workflow. The workflow itself is not deleted. " + "Use when the user says 'stop the schedule', 'unbind this from Slack', " + diff --git a/packages/agents/src/mastra/tools/fork-conversation.ts b/packages/agents/src/mastra/tools/fork-conversation.ts index cae52c76..370a8874 100644 --- a/packages/agents/src/mastra/tools/fork-conversation.ts +++ b/packages/agents/src/mastra/tools/fork-conversation.ts @@ -3,7 +3,6 @@ import { z } from "zod"; export const forkConversationTool = createTool({ id: "fork_conversation", - strict: true, description: "Fork (clone) the current conversation thread to explore a different automation path. " + "Creates a copy of the conversation history so the user can try alternative approaches " + diff --git a/packages/agents/src/mastra/tools/get-workflow.ts b/packages/agents/src/mastra/tools/get-workflow.ts index d9992d66..cdddce1f 100644 --- a/packages/agents/src/mastra/tools/get-workflow.ts +++ b/packages/agents/src/mastra/tools/get-workflow.ts @@ -4,7 +4,6 @@ import { getSupabase } from "@/lib/db"; export const getWorkflowTool = createTool({ id: "get_workflow", - strict: true, description: "Fetch a single saved workflow with its ordered steps. Use this when the user " + "asks to inspect, edit, or run a specific workflow — call list_workflows first " + diff --git a/packages/agents/src/mastra/tools/list-workflow-triggers.ts b/packages/agents/src/mastra/tools/list-workflow-triggers.ts index a97dece1..b448853e 100644 --- a/packages/agents/src/mastra/tools/list-workflow-triggers.ts +++ b/packages/agents/src/mastra/tools/list-workflow-triggers.ts @@ -4,7 +4,6 @@ import { getSupabase } from "@/lib/db"; export const listWorkflowTriggersTool = createTool({ id: "list_workflow_triggers", - strict: true, description: "List the triggers bound to a saved workflow. Use before detaching, " + "or when the user asks 'is this scheduled?', 'what fires this?', or " + diff --git a/packages/agents/src/mastra/tools/list-workflows.ts b/packages/agents/src/mastra/tools/list-workflows.ts index 47022910..3110f426 100644 --- a/packages/agents/src/mastra/tools/list-workflows.ts +++ b/packages/agents/src/mastra/tools/list-workflows.ts @@ -4,7 +4,6 @@ import { getSupabase } from "@/lib/db"; export const listWorkflowsTool = createTool({ id: "list_workflows", - strict: true, description: "List the user's saved workflows. Returns id, name, and parameters for each. " + "Use this when the user asks 'what workflows do I have?', 'show my saved automations', " + diff --git a/packages/agents/src/mastra/tools/run-workflow.ts b/packages/agents/src/mastra/tools/run-workflow.ts index 5d76ac66..a9e94723 100644 --- a/packages/agents/src/mastra/tools/run-workflow.ts +++ b/packages/agents/src/mastra/tools/run-workflow.ts @@ -4,7 +4,6 @@ import { executeWorkflow } from "@/lib/workflows/engine"; export const runWorkflowTool = createTool({ id: "run_workflow", - strict: true, description: "Execute a previously saved workflow now. Drains the workflow's step generator " + "and returns a summary: runId, steps succeeded / failed, missing params if the " + diff --git a/packages/agents/src/mastra/tools/save-workflow.ts b/packages/agents/src/mastra/tools/save-workflow.ts index 57c3eaa9..b5773ec5 100644 --- a/packages/agents/src/mastra/tools/save-workflow.ts +++ b/packages/agents/src/mastra/tools/save-workflow.ts @@ -4,7 +4,6 @@ import { saveWorkflowFromConversation } from "@/lib/workflows/save"; export const saveWorkflowTool = createTool({ id: "save_workflow", - strict: true, description: "Save the current conversation's executed actions as a re-runnable workflow. " + "Captures every action proposal that the user approved and ran, in order, " + diff --git a/packages/agents/src/mastra/tools/search-history.ts b/packages/agents/src/mastra/tools/search-history.ts index 93b21373..927bf137 100644 --- a/packages/agents/src/mastra/tools/search-history.ts +++ b/packages/agents/src/mastra/tools/search-history.ts @@ -5,7 +5,6 @@ import { searchActionHistory } from "@/lib/rag"; export const searchHistoryTool = createTool({ id: "search_history", - strict: true, // Opt this read into Mastra background execution when FOREMAN_BACKGROUND_TOOLS=1. // Simple schema (3 fields) → safe for Studio introspection, unlike the Zapier // SDK tools whose schemas hang `mastra dev` when background is enabled. diff --git a/packages/agents/src/mastra/tools/update-workflow.ts b/packages/agents/src/mastra/tools/update-workflow.ts index 72949632..ea0a2e11 100644 --- a/packages/agents/src/mastra/tools/update-workflow.ts +++ b/packages/agents/src/mastra/tools/update-workflow.ts @@ -5,7 +5,6 @@ import type { Database } from "@/lib/db/database.types"; export const updateWorkflowTool = createTool({ id: "update_workflow", - strict: true, description: "Update metadata on a saved workflow — rename it, or mark it as a public " + "template that can be cloned by other users. Step content (the ordered " + diff --git a/packages/web/src/app/globals.css b/packages/web/src/app/globals.css index 25ac92b6..678fe905 100644 --- a/packages/web/src/app/globals.css +++ b/packages/web/src/app/globals.css @@ -97,24 +97,31 @@ } @theme inline { - --color-background: var(--background); + /* Surface tokens are blended a few percent toward the brand hue (--primary) + so the active color-theme preset reaches the whole UI — cards, inputs, + borders, hover/accent states — not just the sidebar nav + focus rings. + The mix is subtle on big surfaces (3-7%) and stronger on accent (20%) so + hovers clearly pick up the theme. Foreground/text tokens stay untinted for + contrast. Switching presets (or the default orange) now visibly recolors + the conversation area. See [data-theme-preset] blocks below for the hues. */ + --color-background: color-mix(in oklab, var(--background), var(--primary) 3%); --color-foreground: var(--foreground); - --color-card: var(--card); + --color-card: color-mix(in oklab, var(--card), var(--primary) 5%); --color-card-foreground: var(--card-foreground); - --color-popover: var(--popover); + --color-popover: color-mix(in oklab, var(--popover), var(--primary) 5%); --color-popover-foreground: var(--popover-foreground); --color-primary: var(--primary); --color-primary-foreground: var(--primary-foreground); - --color-secondary: var(--secondary); + --color-secondary: color-mix(in oklab, var(--secondary), var(--primary) 7%); --color-secondary-foreground: var(--secondary-foreground); - --color-muted: var(--muted); + --color-muted: color-mix(in oklab, var(--muted), var(--primary) 7%); --color-muted-foreground: var(--muted-foreground); - --color-accent: var(--accent); + --color-accent: color-mix(in oklab, var(--accent), var(--primary) 20%); --color-accent-foreground: var(--accent-foreground); --color-destructive: var(--destructive); --color-destructive-foreground: var(--destructive-foreground); - --color-border: var(--border); - --color-input: var(--input); + --color-border: color-mix(in oklab, var(--border), var(--primary) 10%); + --color-input: color-mix(in oklab, var(--input), var(--primary) 10%); --color-ring: var(--ring); --color-surface: var(--surface); --color-chart-1: var(--chart-1); @@ -122,7 +129,7 @@ --color-chart-3: var(--chart-3); --color-chart-4: var(--chart-4); --color-chart-5: var(--chart-5); - --color-sidebar: var(--sidebar); + --color-sidebar: color-mix(in oklab, var(--sidebar), var(--primary) 4%); --color-sidebar-foreground: var(--sidebar-foreground); --color-sidebar-primary: var(--sidebar-primary); --color-sidebar-primary-foreground: var(--sidebar-primary-foreground); diff --git a/packages/web/src/components/chat/message.tsx b/packages/web/src/components/chat/message.tsx index b15358ad..bf2abbf5 100644 --- a/packages/web/src/components/chat/message.tsx +++ b/packages/web/src/components/chat/message.tsx @@ -237,10 +237,10 @@ const PurePreviewMessage = ({ return ( 0 + ? "bg-primary text-primary-foreground hover:opacity-85 active:scale-95" : "bg-muted text-muted-foreground/25 cursor-not-allowed", )} data-testid="send-button" - disabled={!input.trim() || uploadQueue.length > 0} + disabled={(!input.trim() && attachments.length === 0) || uploadQueue.length > 0} status={status} variant="secondary" > diff --git a/packages/web/src/components/chat/multimodal/attachments-button.tsx b/packages/web/src/components/chat/multimodal/attachments-button.tsx index 7a4d11ec..04e4eae8 100644 --- a/packages/web/src/components/chat/multimodal/attachments-button.tsx +++ b/packages/web/src/components/chat/multimodal/attachments-button.tsx @@ -2,8 +2,7 @@ import type { UseChatHelpers } from "@ai-sdk/react"; import { memo } from "react"; -import useSWR from "swr"; -import type { ModelCapabilities } from "@/lib/ai/models"; +import { MODEL_CAPABILITIES } from "@/lib/ai/models"; import type { ChatMessage } from "@/lib/types"; import { cn } from "@/lib/utils"; import { Button } from "../../ui/button"; @@ -18,15 +17,9 @@ function PureAttachmentsButton({ status: UseChatHelpers["status"]; selectedModelId: string; }) { - const { data: modelsResponse } = useSWR( - `${process.env.NEXT_PUBLIC_BASE_PATH ?? ""}/api/models`, - (url: string) => fetch(url).then((r) => r.json()), - { revalidateOnFocus: false, dedupingInterval: 3_600_000 }, - ); - - const caps: Record | undefined = - modelsResponse?.capabilities ?? modelsResponse; - const hasVision = caps?.[selectedModelId]?.vision ?? false; + // Capabilities are static frontend config (models.ts) — read them directly + // instead of fetching a non-existent /api/models endpoint. + const hasVision = MODEL_CAPABILITIES[selectedModelId]?.vision ?? false; return (