Skip to content

Add Slack Block Kit authoring to Composer - #216

Merged
jgindin merged 9 commits into
a2ui-project:mainfrom
jerelvelarde:jerel/slack-preview-renderer
Nov 6, 2026
Merged

jgindin merged 9 commits into
a2ui-project:mainfrom
jerelvelarde:jerel/slack-preview-renderer

Conversation

@jerelvelarde

@jerelvelarde jerelvelarde commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Composer on the Slack renderer: the assistant switches from Angular to Slack and builds an approval message, the JSON editor adds a note field, the button sends its event, and the preview's Block Kit export

Watch or download the video. Recorded on Nov 2 at 592836d. The assistant's replies are scripted, because the recording uses the e2e tests' Gemini stand-in.

The problem

Composer previews A2UI in the Angular, Lit and React renderers, which all draw into a web page. An
agent that answers in Slack can't use any of them. A Slack message is a list of Block Kit blocks, with
its own limits: no nested layouts, at most 50 blocks, length caps on every text field, and only a few
input types. An author can't see what an A2UI surface turns into in Slack, or get the Block Kit to
send, until a real Slack app posts it.

The approach

A renderer, not a shell feature. samples/react-slack-catalog is a renderer like the other
samples. It owns a Slack catalog of 11 components, sends that catalog to Composer over the bridge,
and draws the preview. The shell has no Slack code: the renderer menu labels every renderer with its
configured displayName, and the Gallery reads the Slack examples over the bridge like any other
renderer's.

One message, drawn and exported. The renderer lowers each A2UI surface to Channels UI
components and renders them with renderBlockKit from @copilotkit/channels-slack. Channels is
CopilotKit's channel SDK, and the sample README defines its terms. The Tightknit renderer draws the
blocks the way Slack would, and Generated Block Kit exports those same blocks after validation.
TextField and date-only DateTimeInput become native Slack inputs with writable bindings, and
buttons dispatch their actions with the current values. Where Slack can't match A2UI, for example a
Row of mixed content, the preview approximates it and reports a diagnostic.

The assistant can switch renderers. The switchRenderer model tool lists the configured
renderers by ID and origin and calls Composer's renderer selection service directly, so the
coordinator doesn't need CopilotKit. Stopping the turn cancels the switch. If the origin
confirmation is still open, Stop closes it without allowing the origin, and nothing is selected. If
Settings has already committed the selection while the new renderer loads, the preview stays on the
new renderer and the conversation is kept. An edited canvas survives the switch, as it does when you
pick a renderer yourself.

Why each shared-code change is in this PR. Some changes outside the sample look general, so here
is what Slack needs from each:

  • The prompt's examples carry the active catalog's ID. The Slack renderer only knows its own
    catalog: web_core throws "Catalog not found" for any other catalogId. Main's condensed examples
    (Prompt reduction #270) now carry the active catalog's ID, and one getCatalogId() helper replaces every copy of that
    lookup, including the one the Gallery playground (feat(gallery): Add interactive playground to Component Gallery #265) added.
  • Icon and Image guidance comes from the catalog's schema. Main's prompt (Prompt reduction #270) suggests custom SVG when an
    image is attached, through an Icon svgPath or an Image data:image/svg+xml URL. The Slack catalog has no Icon,
    and Slack images take only HTTP(S) URLs, so that advice produced payloads Slack rejects. The Slack
    catalog now publishes a JSON-Schema pattern (^https?://) on Image.url. The prompt suggests SVG
    only when the Icon schema has svgPath, and limits Image URLs to the declared pattern when it
    rejects a data URL. It no longer matches words in a description.
  • The bridge re-requests a catalog when the renderer is replaced while it loads. The Slack sample
    sends its catalog inline and attaches in a React StrictMode effect. In development, which is what
    the e2e journeys run, that effect attaches, detaches and attaches again. A reply for the first
    attachment was dropped without a log, and the host then waited for its watchdog. The bridge now
    asks again for the current renderer's catalog, unless a newer request is already answering. This
    also hardens main's React sample, which uses StrictMode too.
  • A renderer switch no longer takes the previous page's catalog. When Settings commits a switch,
    the iframe already points at the new renderer, but the old page is still loaded and the host still
    reports it ready. The catalog wait from Switch renderers from the chat prompt, without a trip to Settings #244 then asked that page for its catalog again, and the old
    renderer's answer resolved the switch. A person rarely sends a prompt in that gap. The
    switchRenderer tool generates straight away, so its next request carried the previous catalog. The
    wait now asks again only if the page was already showing the renderer when the switch began.
  • Page-relative renderer URLs. The Slack profile is configured as samples/react-slack-catalog/,
    so it works at /composer/ on GitHub Pages and at /composer/pr/<n>/ in PR previews. Relative URLs
    resolve in one place, EnvironmentContextService.resolveRendererUrl(), which buildRendererUrl (the
    iframe URL for RenderedFrame and demo cards, through Extract a shared GuestFrame for RenderedFrame and DemoCard #294's GuestFrame), StartupResolution, RendererSelection, QueryParser (?renderer= links) and
    HostCommunication's origin checks all use.
  • The settings journeys serve this branch's renderer. The default profile is the GitHub Pages copy,
    which is built from main. These journeys would otherwise test main's bridge against this branch's
    shell.

Moved out of this PR: hiding a repeated canvas card in the CopilotKit panel. The repeat came from
shared code, and #276 fixes it for both panels. Also removed: the slack-dev profile,
which loaded the same copy as slack and carried a second inline payload, and the unused
@copilotkit/channels dependency.

What is not covered

  • Nothing is sent to Slack. Preview and export need no Slack workspace, app or token, and Slack
    delivery wasn't tested.
  • The Book a Car starter is still in two places: inline in config.json, and as the sample's
    car-booking.json, which booking-example.spec.ts checks it against. One copy would need a
    renderer to provide its starter content, either over the bridge or through a payload URL in the
    renderer config. That's a change for every renderer, so it should be its own PR.
  • The preview adjusts the DOM of slack-blocks-to-jsx 1.1.2 (useSlackInputBridge.ts), which ignores
    multiline, shows an Enter hint our inputs don't use, and labels every input "Select an item".
    Upstream issue feat: native @a2ui/angular rendering — custom catalog #121 covers the first two; an issue for the labels is drafted, not filed.
  • After an edit, Slack journeys wait for a render reported after it, then for 800ms with no
    preview messages. Handshakes repeat a render, and no bridge message marks the last render. The
    helper's comment names each source.
  • buildRendererUrl keeps main's fallback for a missing location, because main's SSR test needs it.
  • On main, closing the renderer menu with Escape sometimes leaves focus on the page body instead of
    the pill, with or without the theme toggle and with no Slack code (several failures in 8 runs).
    Both renderer-menu journeys here wait for focus to move into the menu before pressing Escape,
    which avoids it. The fix for the app belongs on main.

Rebased on main (Oct 29)

Main moved underneath this PR after #269 and #193 merged, so it's rebuilt on main 4a98989 as one commit, 32f767a, plus one fix, 6337c12. A commit-by-commit rebase stopped on 11 of the 46 commits, with chat-coordinator.ts, yarn.lock, the prompt factory and the preview frame conflicting again and again, so the rebuild applies this PR's whole diff once and resolves it there. The PR's review history is in the threads and the sections above.

  • Extract a shared GuestFrame for RenderedFrame and DemoCard #294 GuestFrame: main moved the iframe URL out of RenderedFrame into buildRendererUrl(). Page-relative renderer URLs are resolved there now, against the document base URI from EnvironmentContextService, and the base-path tests moved to renderer-url.spec.ts.
  • Prompt reduction #270 prompt reduction: kept. The renderer-switch tool, request IDs, the tool's abort controller and the cancellation guard are re-applied on top. A stopped response uses main's message. The second request after a tool switch uses the coordinator's systemPrompt(), so it gets the image guidelines when the conversation has images. The Icon and SVG guidance sits in main's image-only section, and the Image URL rule is an allowlist rule in every prompt, which the Slack journeys check.
  • build(deps): update vite, mcp sdk, markdown-it, angular, and @a2ui libraries #299 library updates: the Slack sample now uses @a2ui/web_core 0.10.7, which main's resolutions already pinned, and main's Vite. Since 0.10.6, web_core validates component props itself and reports A2UI_PROCESS_MESSAGE_ERROR, so the sample's own invalid-props check could no longer fire and is removed. Row and Column children are now published as a reference to ChildList.
  • fix(shell): register active A2UI_CATALOG schema for catalog.json in MonacoEditor #290 editor validation: Composer now validates the JSON editor against the active catalog as catalog.json, and common_types.json refers to catalog.json#/$defs/anyFunction. The Slack catalog had no $defs, so every Slack draft showed an unresolved reference. 6337c12 defines anyComponent and anyFunction; a call to openUrl, which the Slack catalog leaves out, no longer validates.
  • feat(gallery): Add interactive playground to Component Gallery #265 Gallery playground: the Slack Gallery journeys check the preview, then read the JSON on the "Edit JSON" tab and use "Copy JSON", as main's gallery.e2e.ts does.
  • Extract a shared GuestFrame for RenderedFrame and DemoCard #294 test helpers: RENDERER_URLS moved to preview/testing/renderer-urls.ts, which now lists the Slack renderer, and the Slack journeys use main's preview frame selectors.

Review round (Nov 2)

Your emailed review is answered finding by finding in a PR comment. Main was merged in at 6ad0013 (#311), and the fixes are five commits on top:

  • Trim the Slack sample's dependencies: Storybook is no longer installed, and there's one @slack/types.
  • Keep the conversation intact when the assistant switches renderers: B1, M1, M4 and M5.
  • Harden renderer links, catalog prompts and catalog replies: M2, M3, M6 and M7.
  • Tighten the Slack catalog, inputs and diagnostics: M8, M9 and the Minor findings in the sample.
  • Wait for the render an edit causes in Slack journeys: M10's settle helper and the test hygiene items.

Verification

On 592836d, on main 6ad0013, with Node 24:

  • Build, lint, typecheck and formatting: yarn build, yarn lint, yarn tsc, yarn prettier:check and the demo data check pass.
  • Unit tests: 2,730 pass: shell 2,232, Slack 195, bridge 227, scripts 34, and 42 across the other samples.
  • Full e2e (CI=1, one worker): 218 of 218 passed.
  • Main at 6ad0013, same settings: 166 passed, with one failure (gallery.e2e.ts:361) and two flaky tests (demo-card-commit-accuracy.e2e.ts:421 and demos.e2e.ts:247).
  • lower-surface.ts is split by concern into nine modules, and submitPrompt into its phases.
  • New unit specs:
    • host-render-messages.spec.tsx mounts the sample on the real bridge and posts RENDER_A2UI from the host window.
    • Prompt factory tests cover Image URL patterns on the property, in anyOf and in oneOf, a pattern that allows data URLs, and an invalid one.
    • QueryParser, StartupResolution, HostCommunication and buildRendererUrl tests cover page-relative URLs.
    • A cancelled renderer switch neither asks about the origin nor selects a renderer.
    • The Slack catalog's $defs resolve, and anyFunction accepts a Slack function and rejects openUrl.

Merge notes

#269 and #193 have merged. This PR is its original commit, the catalog fix, a merge of main, and the five review commits. This PR and #274, the #269 follow-up, both change the guard at the top of ChatCoordinator.cancelStream. This PR adds || this.cancelReason !== null, and #274 adds that check plus one that a response is streaming, so whichever lands second keeps #274's condition. #275, the React components PR, is stacked on an earlier head of this branch and needs a rebase onto 592836d.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new workspace package, react-slack-catalog, which serves as a credential-free React sample renderer for previewing A2UI surfaces as Slack Block Kit messages. It includes the core rendering and lowering logic, extensive unit and E2E tests, and integration into the main monorepo. The review feedback highlights several robustness improvements: adding defensive type guards in collectText to prevent runtime crashes on raw child nodes, using ActionSchema.safeParse in registerAction to gracefully handle incomplete actions during live editing, refactoring dispatchCurrentAction to safely catch synchronous errors, and appending the array index to React keys in SlackPreviewState to avoid key collisions.

Comment on lines +1159 to +1172
function collectText(nodes: ChannelNode[]): string {
return nodes
.flatMap(node => {
if (node.type === 'text' && typeof node.props.value === 'string') return [node.props.value];
if (typeof node.props.children === 'string' || typeof node.props.children === 'number') {
return [String(node.props.children)];
}
return Array.isArray(node.props.children)
? [collectText(node.props.children as ChannelNode[])]
: [];
})
.filter(Boolean)
.join(' ');
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The collectText function recursively traverses node.props.children. However, if node.props.children contains raw strings or numbers, node in the recursive call will be a string or number. Accessing node.props or node.type on a non-object will throw a TypeError. Adding a defensive type guard to ensure node and node.props are valid objects before accessing their properties prevents runtime crashes.

function collectText(nodes: ChannelNode[]): string {
  return nodes
    .flatMap(node => {
      if (!node || typeof node !== 'object') return [];
      const props = node.props;
      if (!props || typeof props !== 'object') return [];
      if (node.type === 'text' && typeof props.value === 'string') return [props.value];
      if (typeof props.children === 'string' || typeof props.children === 'number') {
        return [String(props.children)];
      }
      return Array.isArray(props.children)
        ? [collectText(props.children as ChannelNode[])]
        : [];
    })
    .filter(Boolean)
    .join(' ');
}
References
  1. When validating properties from untyped or external records, use a strict type guard before calling methods or accessing properties.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the guard in 113b372, reusing the existing isChannelNode helper rather than inline checks, so collectText matches channelChildNodes a few lines up in the same file.

For accuracy: this is not reachable today. collectText only ever runs on renderToIR output, and expand() normalizes every child — raw strings and numbers become {type: "text", props: {value}} nodes before collectText sees them. The one path that preserves raw scalars is expandNativeValue, and the sample's only native node (createNativeNode('slack', 'raw', ...)) carries a value prop with no children.

Taking it as defense-in-depth: the parameter type is only as good as the as ChannelNode[] cast that feeds the recursion, so the guard is worth having. No test, since there is no way to reach it through the public API.

Comment on lines +1174 to +1207
function registerAction(
state: LoweringState,
surface: SurfaceModel,
componentId: string,
basePath: string,
rawAction: unknown,
): string {
const parsedAction = ActionSchema.parse(rawAction) as Action;
const actionId = `a2ui-${state.revision}-${state.nextActionOrdinal}`;
state.nextActionOrdinal += 1;

const eventEntry = createEventActionDispatchEntry({
actionId,
revision: state.revision,
surface,
sourceComponentId: componentId,
basePath,
action: parsedAction,
});

state.actions.set(
actionId,
eventEntry ?? {
actionId,
revision: state.revision,
surface,
surfaceId: surface.id,
sourceComponentId: componentId,
basePath,
action: parsedAction,
},
);
return actionId;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

During live editing, components might have incomplete action properties. Calling ActionSchema.parse(rawAction) directly will throw a ZodError and crash the preview. Using ActionSchema.safeParse allows the preview to degrade gracefully and ignore incomplete actions instead of crashing.

function registerAction(
  state: LoweringState,
  surface: SurfaceModel,
  componentId: string,
  basePath: string,
  rawAction: unknown,
): string {
  if (!rawAction) return '';
  const parsedAction = ActionSchema.safeParse(rawAction);
  if (!parsedAction.success) return '';
  const actionId = `a2ui-${state.revision}-${state.nextActionOrdinal}`;
  state.nextActionOrdinal += 1;

  const eventEntry = createEventActionDispatchEntry({
    actionId,
    revision: state.revision,
    surface,
    sourceComponentId: componentId,
    basePath,
    action: parsedAction.data,
  });

  state.actions.set(
    actionId,
    eventEntry ?? {
      actionId,
      revision: state.revision,
      surface,
      surfaceId: surface.id,
      sourceComponentId: componentId,
      basePath,
      action: parsedAction.data,
    },
  );
  return actionId;
}
References
  1. When validating properties from untyped or external records, use a strict type guard or safe parsing before proceeding.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I switched to safeParse in 113b372, but not with this suggestion — two things in the premise do not hold here.

It does not crash the preview. rerender() already wraps the whole lowering pass in try/catch and converts any throw into an error diagnostic with status: 'error'. A ZodError is caught there today.

It cannot be reached. lowerComponent runs api.schema.safeParse(model.properties) before lowering, and ButtonApi.schema has action as a required union. A malformed action is rejected there first. Verified with a throwaway test — {action: {event: 42}} on a Button produces:

[{"level":"error","code":"A2UI_INVALID_PROPS",
  "message":"Invalid props for A2UI component \"root\": ...",
  "componentId":"root"}]

So registerAction never sees invalid input, and returning '' would not degrade gracefully — it would render a button wired to a dead action id with no diagnostic at all, which is the opposite of what the rest of this file does. Every other bad-input path here throws LoweringError(code, message, componentId).

What I did take is the underlying point that .parse is the wrong call. If the catalog schema and ActionSchema ever diverge, the old code surfaced an opaque ZodError as a generic A2UI_LOWERING_ERROR with no componentId. Now:

const parsed = ActionSchema.safeParse(rawAction);
if (!parsed.success) {
  throw new LoweringError('A2UI_INVALID_ACTION', `...${issues}`, componentId);
}

Same fail-loud behavior as the rest of the file, but the diagnostic names the component. No test, since the branch is unreachable behind A2UI_INVALID_PROPS.

Comment on lines +47 to +60
const dispatchCurrentAction = useCallback(
(actionId: string | undefined) => {
if (!actionId || !actionIds.has(actionId)) return;

setDispatchError(undefined);
void Promise.resolve(dispatch(actionId)).catch(error => {
setDispatchError({
level: 'error',
code: 'SLACK_ACTION_DISPATCH_FAILED',
message: error instanceof Error ? error.message : String(error),
});
});
},
[actionIds, dispatch],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In dispatchCurrentAction, Promise.resolve(dispatch(actionId)) is used to catch errors. However, if dispatch throws a synchronous error, it will execute before Promise.resolve wraps it, causing an unhandled exception. Refactoring dispatchCurrentAction to be an async function with a standard try/catch block ensures both synchronous and asynchronous errors are caught safely.

  const dispatchCurrentAction = useCallback(
    async (actionId: string | undefined) => {
      if (!actionId || !actionIds.has(actionId)) return;

      setDispatchError(undefined);
      try {
        await dispatch(actionId);
      } catch (error) {
        setDispatchError({
          level: 'error',
          code: 'SLACK_ACTION_DISPATCH_FAILED',
          message: error instanceof Error ? error.message : String(error),
        });
      }
    },
    [actionIds, dispatch],
  );

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed and fixed in 113b372. This one was a live bug: dispatch(actionId) is evaluated as the argument before Promise.resolve wraps it, so a synchronous throw escaped the React event handler entirely and never reached the diagnostics list.

I kept the callback synchronous instead of making it async, so the two call sites (handleNativeClick, handleInteraction) do not need void and the signature stays unchanged:

const reportDispatchFailure = (error: unknown) => { /* set diagnostic */ };
try {
  void Promise.resolve(dispatch(actionId)).catch(reportDispatchFailure);
} catch (error) {
  reportDispatchFailure(error);
}

Covered by a new regression test, renders diagnostics when action dispatch throws synchronously. Verified red before the fix (the error escaped as unhandled and the diagnostics element was absent) and green after.

Comment on lines +132 to +142
{snapshot.diagnostics.map(diagnostic => (
<li
key={`${snapshot.revision}-${diagnostic.level}-${diagnostic.code}-${
diagnostic.componentId ?? ''
}`}
>
<strong>{diagnostic.level}</strong> <code>{diagnostic.code}</code>{' '}
{diagnostic.componentId ? <span>{diagnostic.componentId} </span> : null}
<span>{diagnostic.message}</span>
</li>
))}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using only the revision, level, code, and componentId as the React key can lead to key collisions if multiple diagnostics share the same properties within the same revision. Appending the array index to the key ensures uniqueness and prevents potential React rendering bugs.

Suggested change
{snapshot.diagnostics.map(diagnostic => (
<li
key={`${snapshot.revision}-${diagnostic.level}-${diagnostic.code}-${
diagnostic.componentId ?? ''
}`}
>
<strong>{diagnostic.level}</strong> <code>{diagnostic.code}</code>{' '}
{diagnostic.componentId ? <span>{diagnostic.componentId} </span> : null}
<span>{diagnostic.message}</span>
</li>
))}
{snapshot.diagnostics.map((diagnostic, index) => (
<li
key={`${snapshot.revision}-${diagnostic.level}-${diagnostic.code}-${
diagnostic.componentId ?? ''
}-${index}`}
>
<strong>{diagnostic.level}</strong> <code>{diagnostic.code}</code>{' '}
{diagnostic.componentId ? <span>{diagnostic.componentId} </span> : null}
<span>{diagnostic.message}</span>
</li>
))}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the index to the key in 113b372.

Worth noting it is not currently reachable: pushDiagnostic dedupes by code, and the direct diagnostics.push sites either carry a distinct componentId (SLACK_LAYOUT_FLATTENED) or run once per revision (SLACK_ACTION_REGISTRY_FILTERED). Taking it anyway — the key is a hand-rolled identity for a list with no natural id, and the index makes it correct by construction at zero cost.

@jerelvelarde
jerelvelarde force-pushed the jerel/slack-preview-renderer branch from 0c750d1 to 113b372 Compare September 17, 2026 15:02
@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

⚡ A2UI Composer PR Preview

Your automated preview is successfully live (commit 298d015):
👉 Launch PR Preview

Note: This environment will be wiped automatically when the PR is merged or closed.

@jerelvelarde jerelvelarde changed the title Add Slack Block Kit preview and export renderer Add Slack message authoring with CopilotKit and Block Kit export Sep 18, 2026
@jerelvelarde
jerelvelarde force-pushed the jerel/slack-preview-renderer branch from 8d68ee6 to ee34f3c Compare September 18, 2026 11:38
@jerelvelarde jerelvelarde changed the title Add Slack message authoring with CopilotKit and Block Kit export Add Slack Block Kit authoring to Composer Sep 18, 2026
@jerelvelarde
jerelvelarde force-pushed the jerel/slack-preview-renderer branch from ee34f3c to b9a75e0 Compare September 18, 2026 13:19
@jerelvelarde
jerelvelarde force-pushed the jerel/slack-preview-renderer branch from b9a75e0 to dda6178 Compare September 18, 2026 13:38
@jerelvelarde
jerelvelarde force-pushed the jerel/slack-preview-renderer branch 2 times, most recently from feebd24 to 82bccaf Compare September 18, 2026 15:33
@jerelvelarde
jerelvelarde marked this pull request as ready for review September 23, 2026 13:41
@jerelvelarde

Copy link
Copy Markdown
Contributor Author

Synced with main through the whole stack. Head is now ca9df01.

  • Main's new ng-basic-with-mcp-catalog sample took port 3459, so the Slack sample now serves on 3460. That covers Vite, the Playwright web server, the e2e helper, and both READMEs.
  • The catalog-aware system prompt appends main's MCP tool instructions when the catalog supports MCP. Both sides' prompt tests are kept.
  • The Slack e2e helpers import the Monaco types from main's shared e2e/helpers.ts, where main moved them from e2e/types.ts.

On this head, the full e2e suite passes all 17 Slack journeys. The only failures are the data-model test that also fails on unchanged main, and main's React shrink test, which is flaky there too.

@jerelvelarde

Copy link
Copy Markdown
Contributor Author

Synced with the latest main (6794bc1: #197, #230) through the updated stack. Head is now 59bab0b.

  • Gallery tabs from feat(gallery): reorganize and edit selected-catalog examples #129. The Slack Gallery journey now reads examples from the Edit JSON tab instead of the removed read-only JSON block.
  • Main's malformed-stream chat test. It now uses this branch's panel title, Assistant.
  • Flaky Slack journeys, fixed. Under parallel load, three Slack tests (the shared-binding typing test, the simulator action, and the parent-to-iframe update flow) failed intermittently, and did on the previous head too. The cause: the editor feeds the preview through more than one debounced path, so one JSON replacement can render twice, and the late render could reset a field mid-typing or replace a surface the test had just posted. replaceMonacoJson now waits until the preview has been quiet for 800ms, and the direct-post flow waits the same way. All three passed three consecutive runs without retries.

Full e2e on this head: 103 of 103, with no flaky retries. Formatting, lint, typechecks, the production build, and 2,041 unit tests pass.

@jerelvelarde

Copy link
Copy Markdown
Contributor Author

Synced with main (834cafe) through the stack. Head is now 5763306. The catalog-aware system prompt now ends with main's custom instructions (#233). The Assistant panel picks up #231's width settings, and the README drops the removed MCP sample.

I also fixed two more parallel-load races in the Slack journeys:

  • Opening the Generated Block Kit panel resizes and scrolls the preview, so a click aimed before it settled could miss the copy button.
  • A test that moved straight to the Gallery could outlast the catalog watchdog on a cold dev server.

Full e2e: 103 pass. The one failure is main's custom-instructions journey, which fails the same way on unchanged main.

@jerelvelarde
jerelvelarde force-pushed the jerel/slack-preview-renderer branch from 5763306 to 5089b0f Compare September 25, 2026 16:04
@jerelvelarde

Copy link
Copy Markdown
Contributor Author

Rebuilt on the independent #215, so the merge order is now just #215 → #216, with no dependency on #129. The branch is #215's commit plus one commit for this PR on main. The Slack Gallery journey now reads examples and copies from main's Gallery. Unit tests (2,019) and the build pass. In the full e2e run the only other failure is main's custom-instructions journey, which fails the same way on unchanged main.


protected readonly rendererSelection = inject(RendererSelection);

protected readonly rendererLabel = computed(() => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can we abstract this such that we're not encoding any particular renderers?

We have others (there's an outstanding PR to add a renderer from TickTock) and also there are Google internal renderers. Having to maintain this list seems pretty fragile.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing encodes a particular renderer anymore:

  • The pill labels each renderer with its configured displayName, so there's no list of renderer IDs to maintain. That code lives in feat: pair Gemini + CopilotKit in the Composer assistant #215, so the change is there (1ac6882), and this PR builds on it.
  • The assistant's switchRenderer tool builds its choices and description from the configured renderers, and no longer names Slack (8594f3b).

TikTok's renderer or Google's internal renderers show up in the pill and the tool with no code change. The tool also no longer uses CopilotKit: it calls the renderer selection service directly, so the shared coordinator stays CopilotKit-free, matching the DI split in #215.

@jerelvelarde
jerelvelarde force-pushed the jerel/slack-preview-renderer branch 2 times, most recently from 8594f3b to 9c2c694 Compare September 25, 2026 22:15
@jerelvelarde
jerelvelarde force-pushed the jerel/slack-preview-renderer branch 5 times, most recently from a0000b6 to 1181af9 Compare October 5, 2026 15:28
jerelvelarde added a commit to jerelvelarde/a2ui-composer that referenced this pull request Oct 6, 2026
Nothing in this PR passed the optional AbortSignal that
RendererSelection, SettingsService and StartupResolution accepted; only
tests did. Its caller is a2ui-project#216's assistant tool, which cancels a pending
switch when the user stops the turn, so the signal moves to a2ui-project#216 with
it.

The rest stays: a selection is committed only once its origin is
allowed, a stale approval is rejected, and the renderer menu stays
locked while an approval is open, now covered by a timeout test instead
of a cancellation test.
@jerelvelarde
jerelvelarde force-pushed the jerel/slack-preview-renderer branch from fcc1912 to cd09e21 Compare October 6, 2026 23:11
jerelvelarde added a commit to jerelvelarde/a2ui-composer that referenced this pull request Oct 16, 2026
Nothing in this PR passed the optional AbortSignal that
RendererSelection, SettingsService and StartupResolution accepted; only
tests did. Its caller is a2ui-project#216's assistant tool, which cancels a pending
switch when the user stops the turn, so the signal moves to a2ui-project#216 with
it. Without it, nothing produces a DOMException, so a failed switch's
message is read from a plain Error.

The rest stays: a selection is committed only once its origin is
allowed, a stale approval is rejected, and the renderer menu stays
locked while an approval is open, now covered by a timeout test instead
of a cancellation test.
jerelvelarde added a commit to jerelvelarde/a2ui-composer that referenced this pull request Oct 16, 2026
a2ui-project#216 renamed the chat panel tab to "Assistant" and rewrote the title in
saved layouts. Nothing in the Slack work depends on the name, so the
rename, its unit test and the matching e2e locator are reverted. A
product-neutral title can be proposed on its own.
jerelvelarde added a commit to jerelvelarde/a2ui-composer that referenced this pull request Oct 16, 2026
a2ui-project#216 quoted the existing --base-href and --base arguments while adding
the Slack sample's build. The paths contain no spaces, so the quotes
changed nothing; the existing lines are restored and the new line
follows their style.
@jerelvelarde
jerelvelarde force-pushed the jerel/slack-preview-renderer branch from 084d018 to ac5178e Compare October 16, 2026 01:47
@jerelvelarde

Copy link
Copy Markdown
Contributor Author

Rebuilt on the updated #244 and #269 (head ac5178e), so the commits my thread replies named have new hashes: the review changes are now b96f4e0 and the license change 2aa4f3a. Before asking you to look again, I also cleaned up the Slack sample's API, made the system prompt read capabilities from the catalog schema, removed zod from the shell and reverted the "Gemini Assistant" title change. The description's Validation section lists each change. All 110 e2e tests pass locally.

jgindin pushed a commit that referenced this pull request Oct 16, 2026
* feat(chat): switch renderers from the chat panel's prompt pill

The CopilotKit panel's prompt pill gets a renderer menu, so switching
renderers doesn't need a trip to Settings.
The menu lists every configured renderer by its display name, keeps the typed
prompt, and holds Send until the selected renderer's catalog is active.

- RendererSelection switches the preview and waits for the new renderer's
  handshake and catalog. The wait is its own small class with a method per
  step. If Settings declines the renderer, the message says why and what to
  do, and the panel shows it under the menu.
- StartupResolution commits a selection only after its origin is allowed,
  cancels a pending confirmation when asked, and refuses non-HTTP(S) URLs.
  A selection that was overtaken while its confirmation was open is
  rejected by comparing the selection before and after.

* test(visual): update the CopilotKit panel baseline for the renderer menu

* refactor(chat): list the preview's URL parameters once and clarify docs

Addresses review feedback on the renderer menu:
- The preview's query parameters (origin, theme) live in one
  PreviewUrlParam enum, used where the preview adds them and where
  RendererSelection removes them before comparing URLs. A new test fails
  if the preview adds a parameter the enum doesn't list.
- submitPrompt's doc said it waited for a renderer switch, but it skips
  sending: the Send button is disabled during a switch, Enter repeats
  that check, and the prompt stays in the input.
- RendererSelection's doc says where to use it, and why the Settings
  page calls SettingsService.selectRenderer directly.
- The rendererSelection field uses a JSDoc comment.

* refactor(chat): leave renderer-switch cancellation to its first caller

Nothing in this PR passed the optional AbortSignal that
RendererSelection, SettingsService and StartupResolution accepted; only
tests did. Its caller is #216's assistant tool, which cancels a pending
switch when the user stops the turn, so the signal moves to #216 with
it. Without it, nothing produces a DOMException, so a failed switch's
message is read from a plain Error.

The rest stays: a selection is committed only once its origin is
allowed, a stale approval is rejected, and the renderer menu stays
locked while an approval is open, now covered by a timeout test instead
of a cancellation test.
jerelvelarde added a commit to jerelvelarde/a2ui-composer that referenced this pull request Oct 19, 2026
…ject#269 follow-up, snapshot-once

Recorded 2026-10-18 on each PR's branch with the e2e Gemini fixture
(browser recordings) or vhs (the a2ui-project#269 follow-up's test run).
jerelvelarde added a commit to jerelvelarde/a2ui-composer that referenced this pull request Oct 19, 2026
a2ui-project#216 renamed the chat panel tab to "Assistant" and rewrote the title in
saved layouts. Nothing in the Slack work depends on the name, so the
rename, its unit test and the matching e2e locator are reverted. A
product-neutral title can be proposed on its own.
jerelvelarde added a commit to jerelvelarde/a2ui-composer that referenced this pull request Oct 19, 2026
a2ui-project#216 quoted the existing --base-href and --base arguments while adding
the Slack sample's build. The paths contain no spaces, so the quotes
changed nothing; the existing lines are restored and the new line
follows their style.
@jerelvelarde
jerelvelarde force-pushed the jerel/slack-preview-renderer branch from ac5178e to 2ad2bbe Compare October 19, 2026 15:22
Composer previews A2UI only in renderers that draw a web page, so an
author can't see what a surface becomes as a Slack message, or get the
Block Kit to send, until a Slack app posts it. This adds a Slack
renderer and the shared changes it needs.

- samples/react-slack-catalog is a renderer like the other samples. It
  sends a Slack catalog of 11 components over the bridge, lowers each
  A2UI surface to Channels UI nodes and draws them with renderBlockKit
  from @copilotkit/channels-slack. The preview draws the blocks the way
  Slack would, and Generated Block Kit exports the same blocks after
  validation. TextField and date-only DateTimeInput become native Slack
  inputs with writable bindings, and buttons dispatch their actions
  with the current values. Where Slack can't match A2UI, the preview
  approximates it and reports a diagnostic. The renderer runs on port
  3460, is built into the shell's samples and the GitHub Pages and PR
  preview deployments, and is configured as the "slack" profile.
- The assistant can switch renderers with a switchRenderer model tool
  that calls RendererSelection. A prompt makes at most two model
  requests, so the model can't keep cycling between renderers. Stopping
  the turn cancels a pending switch: it closes an open origin
  confirmation without allowing the origin and never commits the
  selection.
- The prompt's examples use the active catalog's ID, which the Slack
  renderer needs because it rejects any other catalogId. One
  getCatalogId() helper replaces the copies of that lookup. Icon
  guidance in the multimodal guidelines comes from the catalog's
  schema, so custom SVG is suggested only when Icon declares svgPath. A
  catalog whose Image.url pattern rejects data URLs gets an allowlist
  rule, in every prompt, limiting Image URLs to that pattern.
- The bridge asks again for the current renderer's catalog when the
  renderer is replaced while its catalog loads, unless a newer request
  is already answering the host.
- A renderer switch no longer resolves with the previous page's
  catalog: the catalog wait asks again only if the page was already
  showing the renderer when the switch began.
- Page-relative renderer URLs resolve against the document's base URI
  in one place, EnvironmentContextService.resolveRendererUrl(). The
  iframe URL (buildRendererUrl), StartupResolution, RendererSelection,
  QueryParser (?renderer= links) and HostCommunication's origin checks
  all use it, so the Slack profile's relative URL works at /composer/
  and in PR previews.
- The settings journeys serve this branch's Angular renderer rather
  than the GitHub Pages copy, which is built from main.

The sample uses @a2ui/web_core 0.10.7 like the other workspaces. Its
message processor checks component props against the catalog, so the
Slack lowering no longer repeats that check.
Since a2ui-project#290, Composer validates the JSON editor against the active
renderer's catalog as `catalog.json`, and `common_types.json` refers to
`catalog.json#/$defs/anyFunction` for function calls. The Slack catalog
had no `$defs`, so the editor reported "$ref '/$defs/anyFunction' in
'file:///catalog.json' can not be resolved" on every Slack draft that the
JSON worker checked.

The catalog now defines `$defs.anyComponent`, referencing each component,
and `$defs.anyFunction`, a call to each of its functions shaped like the
basic catalog's entries. Its `functions` stays the inline catalog's list
that web_core's client capabilities produce, which a `$ref` can't address
by name, so `anyFunction` inlines the call schemas. A call to `openUrl`,
which the Slack catalog leaves out, no longer validates.
@jerelvelarde
jerelvelarde force-pushed the jerel/slack-preview-renderer branch from 2ad2bbe to 6337c12 Compare October 30, 2026 00:48
- Stop installing Storybook. The preview uses only the Renderer
  component of @tightknitai/storybook-addon-slack-block-kit, which
  doesn't import Storybook; .yarnrc.yml marks the addon's Storybook
  peer as optional instead. The lockfile loses about 1,000 lines.
- Pin @slack/types to 2.22.0, the version @copilotkit/channels-slack
  resolves, so the lockfile holds one copy.
- Run the sample with plain `vite`; its config already sets port 3460.
- Add re2js 2.8.7, the bridge's version, to the shell for checking
  catalog patterns.
- Say in tsconfig.json why the sample keeps skipLibCheck: two
  dependencies' typings don't compile in a browser-only project.
- While a response streams, StateSync no longer adds a canvas change to
  the conversation. The only change possible then is a reset to the
  renderer's sample, which used to land after the model turn: the
  CopilotKit panel stopped showing the turn as streaming, and the next
  prompt sent the sample as the current canvas.
- A renderer switch the model asks for keeps an edited canvas, as a
  switch the user makes does, so a second request that fails or is
  stopped doesn't lose it. An unedited sample is replaced, and the
  second request is sent without the previous renderer's sample.
- Renderer URLs are compared after resolving them, so a switch to the
  renderer a ?renderer= link already loaded isn't counted as a change.
  The expected URL stays set until the coordinator sees the preview
  switch to it.
- The renderer tool isn't offered when there's no other renderer, and
  names the renderer the preview shows.
- A switch cancelled by Stop no longer leaves "Cancelled" under the
  renderer menu.
- The model turn is cleared after a switch, so a failed second request
  doesn't leave the first request's text showing.
- Remove five tests that repeated main's.
- ?renderer= accepts a URL with a scheme or a path containing "/". An
  empty value or a single word is rejected, with a hint to use
  rendererId, instead of becoming a same-origin custom renderer.
- A catalog's Image.url pattern is checked with re2js, capped at 256
  characters and one line. The pattern and the catalog ID enter the
  system prompt as JSON strings, with backticks escaped.
- findPropertySchema searches only schema keywords that declare
  properties and follows local $defs refs. An Icon that takes only
  listed names is told to use them and not to draw SVG.
- Catalog.functions may be a list, as v0.9 inline catalogs send it;
  catalogDeclaresFunction reads both shapes.
- The bridge answers a GET_CATALOG left unanswered when a renderer
  detached before its replacement attached, instead of waiting for the
  host's watchdog.
- LlmToolDefinition's JSDoc says what the type is.
- String props publish common_types.json's DynamicString, so a function
  call must name a catalog function that returns a string. anyFunction
  now accepts bound and computed arguments.
- Button is a SlackButtonApi: action is required, the Checkable fields
  are gone, and variant is default or primary.
- One HTTP(S) rule (http-url.ts) serves Image and MarketSnapshot.
  MarketSnapshot sources are checked when drawn, with their own codes,
  and written as Slack <url|text> links.
- A single-line input turns pasted line breaks into spaces.
- Input lowering throws LoweringError with the component ID and a
  specific code. LoweringError takes an options object.
- Action failures are session diagnostics, so the preview shows one
  diagnostics list, and repeated failures aren't duplicated.
- The Vite server listens on localhost, as the other samples do.
- Add useSlackInputBridge tests; catalog tests load web_core's
  common_types.json.
- replaceMonacoJson waits for a render reported after the paste, and
  opening Generated Block Kit waits for the resize it causes, before
  waiting for a quiet preview.
- The renderer-menu journeys wait for focus inside the menu before
  pressing Escape, and both check focus returns to the pill.
- Restore two SettingsService tests this branch had dropped.
- Use the full license header, collect unexpected errors in the cursor
  journey, and post to the preview's origin instead of '*'.
jerelvelarde added a commit to jerelvelarde/a2ui-composer that referenced this pull request Nov 2, 2026
@jerelvelarde

Copy link
Copy Markdown
Contributor Author

@jgindin, here are answers to the review you emailed, in its order. The fixes are in five commits on top of a merge of main (6ad0013), and the head is 592836d.

Composer on the Slack renderer: the assistant switches from Angular to Slack and builds an approval message, the JSON editor adds a note field, the button sends its event with the note, and the bottom of the preview shows Interactions and Generated Block Kit

Watch or download the video (31s). The assistant's replies are scripted, because the recording uses the e2e tests' Gemini stand-in.

What's the stuff at the bottom?

The Data Model / Events / Errors / Raw Messages panel is main's inspector. This PR adds two things at the bottom of the Slack preview itself:

  • Interactions lists each input and button in the message with the action_id Slack would send. Its Simulate button fires the same action as clicking the element. It comes from the Renderer component of @tightknitai/storybook-addon-slack-block-kit, which draws the message the way Slack would. That component always draws this list, along with the toolbar above the message (Copy JSON, Open in Block Kit Builder, and the validation banner).
  • Generated Block Kit is this sample's export: the blocks the preview drew, as {"blocks": [...]}, with a Copy button.

The two overlap: Copy JSON and Copy Block Kit both copy the message's blocks, and Simulate repeats a click on the real button. If you'd rather the preview showed only the message and one export, I can draw it with slack-blocks-to-jsx's Message directly, as the empty state already does, and drop the addon. Want me to?

Blocker

B1. A canvas reset during a renderer switch went into the conversation. Fixed. While a response streams, StateSync no longer adds a canvas change to the conversation. The editor and preview are locked then, so the only change possible is a reset to the renderer's sample, and the response replaces it. The model turn stays last, so the CopilotKit panel keeps showing it as streaming, and the next prompt doesn't send the sample as the current canvas. Your other suggestions are in too:

  • hasEditedDraft() is read before the switch starts.
  • An edited canvas is no longer reset before the second request. It's kept, as when you pick a renderer yourself, so a second request that fails or is stopped leaves your work in place.
  • When the switch replaces an unedited sample, the previous renderer's sample is left out of the second request.

switchRendererForToolCall now takes the prompt's PromptRun, because it needed a sixth field from it: the prompt ID, used to clear the model turn (see Minor 5). New tests: state-sync.spec.ts holds a response open past the 300ms debounce, and chat-coordinator.spec.ts covers the edited and unedited cases. Each failed before the fix.

Major

M1. Raw vs. resolved renderer URLs. Fixed. EnvironmentContextService.isSameRendererUrl() compares URLs after resolving them, and RendererSelection and the coordinator both use it. A switch to the renderer a ?renderer= link already loaded no longer counts as a change. The expected URL stays set until the rendererUrl subscriber sees the preview switch to it, or until the switch ends without the preview switching. So a switch stopped right after Settings commits it no longer runs the renderer-change handling.

M2. ?renderer= with an empty or bare value. Fixed. QueryParser.parseRendererUrl keeps a value only if it has a URL scheme or contains a /, and the http(s) check still runs after it resolves. So ?renderer=, ?renderer=slack and ?renderer=not-a-url are rejected, and samples/react-slack-catalog/ still works. For a single word, the warning now ends with "Did you mean rendererId=slack?". The 'not-a-url' spec case is back. A StartupResolution test checks that a rejected value never reaches the origin check and saves nothing to CUSTOM_RENDERERS or SELECTED_RENDERER.

M3. Catalog pattern and catalogId in the prompt. Fixed.

  • patternRejectsDataUrl runs the pattern on re2js, as the bridge does. A pattern longer than 256 characters, or containing a line break, gets no guidance.
  • The pattern and both example catalogIds go into the prompt as JSON string literals. Backticks are written as \u0060, so they can't close a code span or fence. The rule now reads use only URLs matching "^https?://".
  • New specs cover a catastrophic-backtracking pattern, patterns just under and over the length cap, and a catalogId containing quotes, backticks and newlines.
  • One related gap is left, because it's on main and not new here: serializeCatalogForPrompt puts the whole catalog JSON in a code fence, and JSON.stringify doesn't escape backticks. Escaping them there would also change the basic catalog's descriptions, which use backticks.

M4. switchRenderer with fewer than two renderers. Fixed. RendererTool.definition() returns null when there's no other renderer, and the request then has no tools. "Current renderer" comes from activeRenderer(). It's left out when the preview shows a renderer that isn't configured, rather than naming a selected ID that might not match.

M5. "Cancelled" stays under the chat bar after Stop. Fixed. RendererSelection.selectRenderer no longer sets error when its caller cancelled the switch. The spec that asserted the old message now asserts no error.

M6. GET_CATALOG dropped on detach; $id. Fixed for GET_CATALOG. When handleSupersededCatalog finds no renderer attached, the bridge now remembers the unanswered request, and attachRenderer answers it right after RENDERER_READY. A new spec detaches and then attaches, and checks the catalog is sent exactly once. I left the catalogId / $id line alone: main has the same line (origin/main:bridge/src/preview-bridge.ts:1246), and the Slack catalog sets catalogId. It's a one-line follow-up for main. I can add it here if you'd rather.

M7. Array-shaped Catalog.functions. Fixed. Catalog.functions is now either a record or a list of the new CatalogFunctionSchema, whose name is required, as in v0.9's FunctionDefinition. A new catalogDeclaresFunction(catalog, name) reads both shapes, and doesCatalogSupportMcp uses it. Specs cover both. Nothing visible changes today, because the Slack catalog doesn't declare callMcpTool.

M8. Slack catalog schema gaps. Fixed, both parts.

  • Dynamic strings. Image description, the TextField and DateTimeInput labels, and Table headers and cells now publish common_types.json#/$defs/DynamicString. A function call there must name a catalog function that returns a string. So openUrl, an unknown name, missing required arguments or a number return type are rejected. Image.url keeps its ^https?:// pattern for literals, and its function-call branch is FunctionCall with returnType: 'string'. catalog.spec.ts now loads the common_types.json that web_core ships, instead of a hand-typed copy.
  • My own anyFunction fix in 6337c12 had a bug, which this change surfaced. It used each function's resolved parameters as args, so it rejected bound arguments such as formatNumber {value: {path}}. Each argument now also accepts a data binding or a function call.
  • Remaining gap. web_core's DynamicString doesn't require returnType, so a call that leaves it out still validates, as in the basic catalog. The preview reports it when it draws the component.
  • Button. It's now a SlackButtonApi built from web_core's ButtonApi: action is required, the Checkable fields are gone (a Slack button can't be disabled), and variant is default or primary. The published schema and the runtime check agree. A test covers each prop they reject.

M9. MarketSnapshot link, multi-line paste, useSlackInputBridge tests. Fixed, all three.

  • Source link. http-url.ts now holds the one HTTP(S) rule, used by Image and MarketSnapshot. The source is checked when the snapshot is drawn, as Image.url is. A bad sourceUrl or sourceName is reported with its own code and the component ID, not the generic A2UI_PROCESS_MESSAGE_ERROR. The published catalog still carries both patterns. The cell is written as a Slack <url|text> link, so parentheses in a URL need no escaping. |, [ and ], which RFC 3986 allows there only percent-encoded, are encoded. * is rejected, since encoding it could change the URL. I didn't use Slack's &amp; entity escaping, because channels-slack passes entities through to the link element literally, which would break query strings.
  • Multi-line paste. In a single-line input, line breaks become spaces before the value is committed, so a pasted address no longer resets the field. form-input.ts still rejects line breaks in values from elsewhere, such as bound data.
  • useSlackInputBridge.spec.tsx. It's new, with seven tests on the real renderer's DOM. They cover labels, tabindex, the Enter hint, IME composition, Enter and paste in single-line fields, line breaks kept in multi-line fields, and the cursor after a shared binding redraws the inputs.

M10. Vite host, settle helper, dependencies.

  • Vite host. Fixed. host: '127.0.0.1' is gone, and start/dev are plain vite, so the port comes from the config alone. I kept strictPort: true, so the server fails rather than moving to 3461 while Playwright waits on 3460.
  • waitForPreviewToSettle. Fixed. The helper counts the messages the preview sends. replaceMonacoJson waits for a RENDER_SUCCESS or RENDER_ERROR after the paste, and opening Generated Block Kit waits for the resize it causes, before either waits for 800ms of quiet. Recording starts once per page, so later waits no longer restart the 800ms.
  • Dependencies. Fixed.
    • Storybook is no longer installed. The addon's Renderer doesn't import it, so .yarnrc.yml uses packageExtensions to mark the addon's Storybook peer optional, as you suggested. That removes about 1,000 lockfile lines, including the @vitest/expect@3 split.
    • @slack/types is now 2.22.0, the version channels-slack resolves, so the lockfile holds one copy.
    • @tightknitai/[email protected] is still installed. The addon depends on it, and it draws the validation banner. The export doesn't depend on it: Generated Block Kit is checked against Slack's limits by the sample's own slack-output-validation.ts.

Minor

  1. LoweringError in form-input.ts. Fixed. Input lowering throws LoweringError with the component ID and a specific code: A2UI_INVALID_INPUT_BINDING, A2UI_INVALID_INPUT_LABEL or A2UI_INVALID_INPUT_VALUE. LoweringError now takes an options object {code, message, componentId} instead of three positional arguments. Those calls now pass the component ID too, and the two adjacent strings were easy to swap. That's why every throw new LoweringError in the sample changed.
  2. Duplicate diagnostics list; repeated dispatch errors. Fixed. A failed action is now one of the session's diagnostics, with the button's component ID, so the preview shows one diagnostics list. A test checks that a failed click on a render with warnings shows exactly one list. A repeated failure replaces the earlier one instead of adding another.
  3. findPropertySchema and iconGuidance. Fixed.
    • findPropertySchema searches only properties, the property schemas, allOf/anyOf/oneOf/items, and local #/$defs/... refs. It no longer looks inside not or examples.
    • The icon rules come from one private IconSupport enum (NONE, NAMED, NAMED_AND_CUSTOM_SVG). A catalog whose Icon takes only listed names is now told to use those names and not to draw SVG, which agrees with the visual affordance guidance.
  4. CI and test hygiene.
    • Samples built twice in deploy_pages.yml and pr_preview_build.yml: not changed here. Main already builds each sample twice, once inside the shell's build script and again with its --base, and this PR only adds the Slack sample to that pattern. Fixing it for all four samples belongs in its own PR on main. I can send one.
    • Menu focus. Both renderer-menu journeys now wait for the first menu item to have focus before pressing Escape. The dark-theme journey asserts focus on the pill again.
    • settings.service.spec.ts. Both deleted tests are back: the rendererOptions() one and the superseded-selection one. The cancellation test stays alongside them.
    • Duplicate test blocks. Removed. Three coordinator tests repeated main's imported-demo tests, and two StateSync tests repeated main's debounce tests. The three renderer-change race tests stay, because they cover throwIfRendererChanged, which only this PR adds.
    • Other e2e fixes. slack-renderer-forms.e2e.ts has the full license header, and the cursor journey collects unexpected errors. slack-renderer-actions.e2e.ts posts to the preview's origin instead of '*'.
    • skipLibCheck. Kept, with a comment in tsconfig.json saying why. Without it, tsc fails only on third-party typings: @slack/web-api (imported by channels-slack's render types) needs Node's types, and the Storybook addon's typings import @storybook/react-vite, which isn't installed. ng-basic-catalog sets it too.
  5. JSDoc, and the first request's text. Fixed. The JSDoc on LlmToolDefinition, LoweringError, InputDispatchEntry and OutputLimitEvidence now says what each type is, without implementation or provider details. The model turn is cleared once a switch is done, so a second request that fails no longer leaves the first request's text showing.
  6. Count a chat cancel once, and only while a response streams #274. It's still open. Whichever of the two lands second keeps Count a chat cancel once, and only while a response streams #274's condition in cancelStream.

Verification

All of this ran on 592836d, on main 6ad0013, with Node 24:

  • Build, lint, typecheck and formatting: yarn build, yarn lint, yarn tsc, yarn prettier:check and the demo data check pass.
  • Unit tests: 2,730 pass: shell 2,232, Slack 195, bridge 227, scripts 34, and 42 across the other samples.
  • Full e2e (CI=1, one worker): 218 of 218 passed.
  • Main at 6ad0013, same settings: 166 passed, with one failure (gallery.e2e.ts:361, the preview card's column height) and two flaky tests (demo-card-commit-accuracy.e2e.ts:421 and demos.e2e.ts:247). On this branch, the demo-card test flaked once in an earlier full run, and the gallery test passed in every run.
  • This commit's tree is exactly the one tested. I rebased and tested first, then rebuilt the branch as a merge of main plus the same five commits, so the push didn't rewrite history. git diff between the two heads is empty.

@jgindin
jgindin merged commit 5249a38 into a2ui-project:main Nov 6, 2026
13 checks passed
jerelvelarde added a commit to jerelvelarde/a2ui-composer that referenced this pull request Nov 10, 2026
The Tightknit renderer resolved its own slack-blocks-to-jsx range to
1.4.1 when a2ui-project#216's lockfile was rebuilt on main. 1.4 allowlists URL
schemes for every image src and drops blob: URLs, so the images drawn
for Chart and Scorecard showed no picture in the preview.

Pin it through resolutions to 1.1.2, the version the sample already
depends on, so both use one copy. The lockfile loses only the 1.4.1
entry and its react-markdown 10 dependency.
jerelvelarde added a commit to jerelvelarde/a2ui-composer that referenced this pull request Nov 20, 2026
The Tightknit renderer resolved its own slack-blocks-to-jsx range to
1.4.1 when a2ui-project#216's lockfile was rebuilt on main. 1.4 allowlists URL
schemes for every image src and drops blob: URLs, so the images drawn
for Chart and Scorecard showed no picture in the preview.

Pin it through resolutions to 1.1.2, the version the sample already
depends on, so both use one copy. The lockfile loses only the 1.4.1
entry and its react-markdown 10 dependency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants