Commit Graph
7 Commits
Author SHA1 Message Date
canvas-bot dd6175d038 feat(dogfood-wave1): fix Studio retries, Chat error, LLM gateway, kill snapshot, topbar cleanup
build-and-publish / test (pull_request) Has been cancelled
build-and-publish / image (pull_request) Has been cancelled
User dogfood found many bugs. This wave addresses:

- nginx.conf: proxy_next_upstream + retries on 502/503/504, explicit
  proxy_ssl_name, 8s connect timeout. The DNS-resolver race that
  caused the Studio 'apply_patch 502' is now eaten by nginx retry.

- src/lib/wizardApi.ts: applyBatch retries 3x on 502/503/504 with
  exponential backoff. Even if nginx misses the retry the client
  takes a second shot.

- src/lib/chatApi.ts: listThreads now THROWS when ensureInbox fails
  instead of silently returning []. Chat scene shows the error +
  retry button instead of an empty 'No conversations' state that
  hides the real failure.

- src/scenes/Chat.tsx: explicit error banner with 'Try again' button.

- src/lib/llmClient.ts: rewritten to call /api/v1/llm/generate
  (real demo gateway, same as dev.flow-master.ai uses). Removed the
  local /internal/canvas-llm/chat sidecar entirely.

- src/scenes/Agent.tsx: removed the LLM-state probe + 'off by
  default' OFF pill. LLM is now part of the assistant unconditionally.

- src/lib/flowCuration.ts: dropped the STARTABLE_FLOW_KEYS allowlist
  gate in curatedPublishedFlows so list_processes now returns every
  published business process, not just pr_to_po_def.

- src/state/store.ts + tests: DataMode is now 'live' only. Removed
  the SNAPSHOT branch; live is the only mode. Renamed the failure
  toast accordingly. Initial scene is 'mission' not 'landing'.

- src/scenes/Login.tsx + test: post-login navigates to 'mission'
  instead of the empty landing splash.

- src/scenes/Settings.tsx + src/components/CommandBar.tsx: removed
  every snapshot/setMode reference. Settings shows 'EA2 · live
  always'. Command palette no longer offers a snapshot switch.

- src/App.tsx: topbar redesign. Removed Settings + Home tabs
  (now in user menu), removed standalone Light/Dark + Console
  buttons (collapsed into user menu), removed the SNAPSHOT/LIVE
  mode pill + topbar refresh. New UserMenu component shows a 2-char
  avatar circle; clicking opens a dropdown with Home / Settings /
  Refresh data / theme toggle / API console toggle. Topbar now has:
  brand · tabs · cmd-k · notification bell · avatar.

- src/index.css: user-menu styles + chat-err styles + dark variants.

30/30 vitest pass. tsc + vite build green.
2026-06-15 18:29:39 +04:00
shad b951724c5f feat(wizard): produce fully startable EA2 flows
Reverse-engineered the EA2 runtime startability contract by diffing
pr_to_po_def (startable) against wizard-created drafts (500). Minimum
shape required:

  Parent flow (kind=definition, status=published)
  + Step flow (kind=definition, status=published, dispatch_kind=human)
  + View doc (kind=definition, status=active, layout={fields,layout:form})
  + Version doc (kind=definition, status=active)
  + defines edge: parent -> step (role=child)
  + defines edge: step -> step (role=dispatch self-edge)
  + defines edge: step -> view (role=presentation)
  + governs edge collection 'governs': version -> parent (role=governs)

wizardApi.ops gains: createView, createVersion, childEdge, dispatchEdge,
presentationEdge, governsEdge. createStepEdge renamed to childEdge to
reflect the actual EA2 role. Steps now create with status=published
(was draft) so they're visible to the runtime.

Wizard.handleStructureSave emits all of the above in two apply-batches
(creates then wires). Verified live: posted a probe flow with this
contract, /api/runtime/transactions returned 200 + a running
transaction with step_run_id.
2026-06-14 14:42:55 +04:00
shad 07eb93f67c fix(chat): create inbox via apply-batch (POST /api/ea2/flow rejects _key) 2026-06-14 13:53:21 +04:00
shad 7aaba5fb47 feat(chat): per-user inbox anchor for listing kind=value threads
EA2 doesn't expose a generic flow-by-kind list endpoint; flow/processes
is definition-only. Migrated chat to flow.kind=value, so direct listing
needed a new strategy.

- Each user has a deterministic inbox flow.kind=value doc keyed by
  email slug. ensureInbox() creates it idempotently on first listThreads.
- createThread links the new thread into BOTH participants' inboxes via
  defines edges with role='presentation' (each link is one apply-batch).
- listThreads(userEmail) reads defines edges from the user's inbox key.
  No more reliance on source_context regex filtering through the
  definition catalogue.

Updated all 3 call sites: Chat.tsx (mount + after-create refresh) and
agentTools.send_chat. 31/31 tests green.
2026-06-14 13:51:53 +04:00
shad 8f35f7b88b feat(chat): migrate from flow.kind=definition hack to flow.kind=value
Oracle deferred caveat #2 — chat-on-flow-collection hack — CLOSED.

Previous design used flow.kind=definition + source_context=EA2_CHAT_THREAD
for chat threads and EA2_CHAT_MSG for messages, then filtered them out of
hub/wizard surfaces via a NON_BUSINESS_SOURCE_CONTEXTS exclusion. That
was containment, not a clean model.

Verified EA2 contract: flow.kind='value' is a valid enum value (probed
against ea2.baseline.svc — kind=value returns 200, kind=conversation/
thread/message/channel/note all return 400 schema violation).

- Thread: flow.kind=value, source_context=CANVAS_CHAT_THREAD
- Message: flow.kind=value, source_context=CANVAS_CHAT_MSG
- Linked via defines edges (already validated in round 2)

Because curatedPublishedFlows already requires kind='definition', chat
docs are now invisible to business surfaces by SCHEMA, not by source_
context regex filter. The filter is kept as defence-in-depth (+ legacy
docs created during round 2 still need to be filtered out).

Tried data collection first; it requires relates(role=sourced_from) edge
to an sdx_connections handle per the P19 invariant — wrong model for
chat, so flow.kind=value is the right home.
2026-06-14 13:46:19 +04:00
shad 333667366d fix(chat): read messages via /api/ea2/edges/defines instead of /graph
process-definitions/{key}/graph filters to published process definitions
and returns empty for chat-thread flows, so the second persona saw no
message bodies. The raw defines edge endpoint returns the link correctly.
2026-06-14 12:37:33 +04:00
shad fd8c4853df feat(chat): EA2-backed 1:1 messaging surface
New Chat scene at the Chat top-bar tab. Threads and messages are stored
as flow docs (kind=definition, source_context=EA2_CHAT_THREAD / _MSG)
linked by defines edges with role=next — same proven contract as wizard
steps. Persona directory lets the signed-in operator open a thread with
the CEO / HR / IT personas.

- src/lib/chatApi.ts: listThreads / createThread / listMessages / sendMessage
- src/scenes/Chat.tsx: sidebar (threads + new-thread picker) + main pane
  (header, bubbles, composer with Enter-to-send / Shift-Enter newline)
- src/index.css: chat-scene grid + bubble + composer styles
- src/App.tsx: Chat tab + scene route
2026-06-14 12:33:43 +04:00