Commit Graph

17 Commits

Author SHA1 Message Date
github-actions[bot] 6ebadc510a style: auto-fix formatting 2026-05-13 16:50:16 +00:00
Alem Tuzlak 2c6f0c38ff chore(showcase): slow aimock SSE streaming to feel like a real LLM
Default aimock config flushes the entire fixture body as fast as the
client can drain — totally fine for unit tests but visually wrong on
demos, where chats jump from "thinking" to a complete answer in a
single frame and break the suspension of disbelief.

Adds --chunk-size 8 --latency 60 to the local docker-compose so each
SSE frame carries 8 chars and waits 60 ms between frames. Net throughput
is ~130 chars/sec (~30-40 tokens/sec), the lower end of Gemini 2.5-flash
and Claude Sonnet real streaming rates. Verified end-to-end via the
langgraph-python runtime: 2.6 KB / 15-chunk response now arrives over
1.24 s vs essentially 0 ms before, matching what a human watches in the
real product.

Wall-clock impact for the longest fixture (~500 chars body) is ~4 s,
comfortably inside the 30 s default test timeout. CI integration-docs
and Railway production aimock are intentionally unchanged — CI doesn't
benefit from pacing and Railway runs its own command line.
2026-05-13 18:48:46 +02:00
Tyler Slaton f5741619f0 feat(showcase/google-adk): align agentic-chat with langgraph-python reference
Reduce google-adk's agentic-chat to the minimum-viable CopilotChat surface
matching langgraph-python: vanilla <CopilotChat /> + three starter
suggestion pills. Strip useFrontendTool (change_background), useRenderTool
(get_weather — was silently failing, no backend tool registered), and
useAgentContext (Bob's name). These concepts already have dedicated demos
(frontend-tools, tool-rendering, readonly-state-agent-context).

Also: make GOOGLE_GEMINI_BASE_URL overridable via .env so the same
container can flip between aimock (deterministic D5 probes) and real
Gemini (manual verification) without editing the compose file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 11:53:35 -07:00
Alem Tuzlak 7c3edca2b7 fix(showcase): unbreak multimodal demo end-to-end (sample buttons auto-send, dedupe, proxy)
The langgraph-python multimodal-attachments demo had a stack of bugs
that compounded each other. Fixing them required touching the local
docker-compose, the aimock fixtures, the LangChain middleware, the
client-side AG-UI shim, and the sample-attachment buttons. This
commit lands the full set together because they only make sense as
a unit — verified end-to-end against `showcase up langgraph-python`
in a headed browser. New e2e suite pins each regression.

Supersedes #4584 (the original fix from May 1 that never landed —
this is a fresh port onto the post-refactor file layout where
page.tsx is split into legacy-converter-shim.tsx, multimodal-chat.tsx,
file-to-data-attachment.ts).

What was broken and what changed:

1. Random uploads crashed with `Failed to fetch`. aimock returned
   HTTP 404 on no-match, the LangGraph SDK surfaced `NotFoundError`,
   the AG-UI stream surfaced a `RUN_ERROR`, the demo crashed.
   Added `--proxy-only` + `--provider-openai https://api.openai.com`
   to the local aimock command so unmatched user prompts fall through
   to real OpenAI (mirrors the Railway aimock setup).

2. Bundled-sample fixtures keyed on user-visible canned prompts.
   The auto-prompts are deliberately long, specific, and natural-
   reading ("can you tell me what is in this demo image/pdf I just
   attached") so they (a) render cleanly as the user message bubble,
   and (b) can't collide with arbitrary user prompts — random
   uploads phrase questions differently and fall through to the
   proxy.

3. Sample buttons now auto-send via `useAgent`. The previous
   DataTransfer-based path queued the attachment via the chat's
   hidden file input, then required clicking send while the
   attachment was still uploading — `CopilotChat.onSubmitInput`
   rejects submits during upload AND clears the input regardless,
   so the canned prompt was eaten. Rewrite to call
   `agent.addMessage(...)` + `copilotkit.runAgent({ agent })`
   directly with the base64'd content part, sidestepping the
   upload race entirely.

4. PDF flattened text bled into the rendered user message.
   `_PdfFlattenMiddleware` ran in `before_model` and returned
   `{"messages": rewritten}`, which persisted to agent state. The
   chat UI then rendered the `[Attached document]\n<pdf body>` text
   part inline with the user prompt. Switched to `wrap_model_call`
   so the PDF→text rewrite is scoped to the outgoing model request
   only and never pollutes state.

5. Attachments doubled (and PDFs rendered as broken `<img>`). The
   `@ag-ui/langgraph` round-trip translates outgoing `binary` parts
   to LangChain `image_url` and incoming `image_url` back to `image`
   AG-UI parts — regardless of mimeType, so PDFs came back as
   `type: "image"` with `mimeType: "application/pdf"` and were
   forced into `ImageAttachment`, where the load failed and the
   chat showed two "Failed to load image" boxes. Plus the user's
   original modern part survived alongside the round-tripped one,
   doubling visible chips.

   Added a `dedupeUserMessageMedia` subscriber on both
   `onMessagesSnapshotEvent` and `onRunFinalized` to:
   - dedupe media parts by `source.value` so the local + round-
     tripped copy collapse to one chip
   - re-key part `type` from `mimeType` so PDFs route to
     `DocumentAttachment` (icon + filename) and images to
     `ImageAttachment`.

   Also flipped the `onRunInitialized` shim from REPLACE to APPEND
   — keep the modern part for the UI AND emit a legacy `binary`
   sibling for the converter.

6. Regression suite (`tests/e2e/multimodal.spec.ts`). Replaces the
   pre-rewrite suite with five focused tests:
   - page loads with all expected affordances
   - sample image: auto-sends, EXACTLY ONE `<img>`, assistant
     references the logo
   - sample PDF: auto-sends, EXACTLY ONE `DocumentAttachment` chip
     ("PDF" label), NO `<img>`, no `[Attached document]` text bleed
   - image then PDF in the same session: each message keeps its own
     single chip, no cross-contamination
   - PDF then image in the same session: symmetric

   All 5 pass against the live local stack (15.4s).
2026-05-11 14:54:38 +02:00
Alem Tuzlak 6b2bdbcfa9 chore(showcase/dashboard): plumb NEXT_PUBLIC_* build args in local compose
The dashboard image was being built with only `OPS_BASE_URL` set; the
two other compile-time env vars used by the matrix view stayed unset:

- NEXT_PUBLIC_POCKETBASE_URL — left at the dev fallback in production
  builds, which surfaces a "FATAL-CONFIG: NEXT_PUBLIC_POCKETBASE_URL
  was unset at build time" banner in the browser console and causes
  the matrix's PB SSE subscription to fail (no live updates).
- NEXT_PUBLIC_SHELL_URL — left unset, so every Demo / Code link in
  the matrix renders as `about:blank#shell-url-missing`.

Pin both at build time:
- POCKETBASE_URL → http://localhost:8090 (host port the user's browser
  reaches; container-internal `pocketbase:8090` is unresolvable from
  outside the compose network).
- SHELL_URL → http://localhost:3100 (langgraph-python integration
  host port; no shared "shell" service in the local stack).
2026-05-06 16:26:17 +02:00
Jordan Ritter 76ba243a70 fix(showcase): add OPS_BASE_URL build arg to dashboard in docker-compose
The dashboard needs OPS_BASE_URL at build time to connect to the local
harness. Without this, the dashboard container builds with no API URL
and cannot display probe results locally.
2026-05-01 00:52:55 -07:00
Jordan Ritter aea980526e fix(showcase): use repo root as dashboard build context in docker-compose
The dashboard Dockerfile uses COPY paths prefixed with `showcase/...`
which expect the repo root as build context. The compose entry was
using `build: ./shell-dashboard` which set context to
showcase/shell-dashboard/, causing COPY failures in worktrees.

Split into explicit context (../ relative to compose file = repo root)
and dockerfile path so COPY paths resolve correctly.
2026-04-30 17:04:56 -07:00
Jordan Ritter b355acd56c fix(runtime): stop converting TanStack stream after RUN_FINISHED
TanStack's chat() engine runs a multi-turn agent loop: after the model
returns tool calls, it tries to execute them via processToolCalls().
Frontend-only tools (like render_pie_chart) are unknown to TanStack, so
executeToolCalls() treats them as errors and buildToolResultChunks()
re-emits TOOL_CALL_END without a preceding TOOL_CALL_START. The ag-ui
verify middleware rejects this duplicate.

Fix: track a runFinished flag in convertTanStackStream and discard all
events after the first RUN_FINISHED, which marks the boundary between
the streaming pass and TanStack's internal tool execution loop.

Also adds built-in-agent to docker-compose.local.yml and local-ports.json.
2026-04-29 22:41:58 -07:00
Jordan Ritter 49efc3f0e6 fix(showcase): preserve langgraph-typescript agent node_modules in compose
The host bind mount `src:/app/src` in docker-compose.local.yml overlays
the container's /app/src directory, clobbering src/agent/node_modules
that was installed during the Docker build. This causes `node --import tsx`
to fail with ERR_MODULE_NOT_FOUND at container startup.

Add an anonymous volume for /app/src/agent/node_modules so Docker
preserves the image's copy even when the parent directory is bind-mounted.
2026-04-29 22:09:14 -07:00
Jordan Ritter e4a332e095 fix: add showcase-aimock to CI build & deploy pipeline
Production showcase-aimock was running a week-old image because fixture
file changes in showcase/aimock/ did not trigger a CI rebuild. This adds
showcase-aimock to the Build & Deploy workflow matrix so it auto-deploys
on merge, creates a thin Dockerfile that bakes fixture files into the
image, documents the local-vs-production parity requirement in
docker-compose.local.yml, and adds an aimock fixture deployment section
to the RUNBOOK.
2026-04-29 20:23:41 -07:00
Jordan Ritter d0212f2bf1 fix(showcase): add dev volume mounts to docker-compose.local.yml
Bind-mount source directories into all 17 integration containers so
code changes only need a container restart, not a full image rebuild.
2026-04-29 19:40:11 -07:00
github-actions[bot] 4ac99af525 style: auto-fix formatting 2026-04-29 06:04:39 +00:00
Jordan Ritter 5bee392385 fix(showcase): fix docker-compose.local.yml aimock config + remove dev-local.sh
- Mount D5/smoke/feature-parity fixtures into aimock via volumes
- Add --host 0.0.0.0 so other containers can reach aimock
- Switch healthcheck from curl to node fetch (aimock image has no curl)
- Delete dev-local.sh (redundant with bin/showcase CLI)
2026-04-28 22:53:49 -07:00
Jordan Ritter 2a22fc32a8 fix(showcase): harden docker-compose.local.yml for CLI parity testing
Add x-integration-defaults YAML anchor to DRY 17 service definitions.
Switch aimock from local build to ghcr.io/copilotkit/aimock:latest.
Add healthchecks to all 20 services (internal ports, not host-mapped).
Add pocketbase and dashboard infra services with proper depends_on
conditions. Add profiles to every service so compose enumeration works.
2026-04-28 17:06:38 -07:00
Jordan Ritter d4736a911a fix(showcase): update CI workflows, Dockerfiles, and configs
for integrations/ rename

Update GitHub Actions workflows to reference
showcase/integrations/ instead of showcase/packages/.
Fix Dockerfiles to dereference symlinks during COPY.
Remove obsolete showcase_template-drift workflow.
Update docker-compose, shell Dockerfiles, and registry paths.
2026-04-28 07:51:06 -07:00
Jordan Ritter 44622440fe feat(showcase): add local smoke target (aimock + 17 packages in Docker)
Wires up a single-command path to run the full integration smoke suite
against a local Docker stack instead of Railway. Useful when Railway is
degraded (OOM, rate limits) or when testing changes that haven't been
deployed yet.

Additions:
- showcase/docker-compose.local.yml: add `aimock` as 18th service so
  integration containers can reach http://aimock:4010 on the compose
  network, mirroring the Railway setup where they call showcase-aimock.
- showcase/tests/e2e/integration-smoke.spec.ts: `LOCAL_PORTS=1` env
  rewrites each integration's Railway URL to http://localhost:<port>
  via showcase/shared/local-ports.json. Starters are skipped under this
  flag because they aren't in local-ports.json.
- showcase/scripts/smoke-local.sh: orchestrates build → up → wait → run
  Playwright → tear down. Supports --level=L1/L2/L3/L4, --keep, --no-build.
- showcase/tests/package.json: `pnpm smoke:local[:L1|:keep|:nobuild]`
  scripts delegate to the helper.
- showcase/.env.example: document optional OPENAI_BASE_URL +
  ANTHROPIC_BASE_URL (route through local aimock) and package-specific
  GitHubToken + GOOGLE_API_KEY (ms-agent-dotnet, google-adk).

Verified locally: `pnpm smoke:local:L1` → 17/17 L1 green against the
local stack.
2026-04-18 15:56:19 -07:00
Atai Barkai 099c105272 feat(showcase): Docker-based local dev for Railway parity
Adds a single command to spin up the exact image Railway deploys,
for any of the 17 showcase packages, with a single shared .env:

  ./showcase/scripts/dev-local.sh up [<slug> ...]   # all if empty
  ./showcase/scripts/dev-local.sh down|build|logs|ps|ports

Pieces:
- `docker-compose.local.yml` with a service per package. Ports come
  from `shared/local-ports.json` (langgraph-python -> 3100, ...).
- `.env.example` as a commit-safe template. Real `.env` is gitignored
  and fed to every container via `env_file`, so keys (OPENAI_API_KEY,
  etc.) live in one place.
- `dev-local.sh` wraps `docker compose` and handles the
  `shared_python/` / `shared_typescript/` staging step that CI does
  before `docker build` (see showcase_deploy.yml).
- Staged `shared_*` dirs added to .gitignore.

Shell wiring:
- `shell/next.config.ts` reads `shared/local-ports.json` when
  `SHOWCASE_LOCAL=1` is set and injects it as a public env.
- `/integrations/[slug]/[demo]/preview` uses that map to iframe
  `http://localhost:<port>` instead of `integration.backend_url`.
  Per-slug; any slug not running locally falls back to Railway.
  Unset SHOWCASE_LOCAL -> prod behavior, unchanged.

Full workflow + prerequisites (Colima / Docker Desktop) documented in
showcase/README.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-17 17:37:37 -07:00