Skip to content

feat(frontend): endpoints page in /m behind the developer view switch - #7993

Merged
mmabrouk merged 13 commits into
release/v0.128.3from
feat/m-view-endpoints
Nov 2, 2026
Merged

mmabrouk merged 13 commits into
release/v0.128.3from
feat/m-view-endpoints

Conversation

@mmabrouk

@mmabrouk mmabrouk commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Context

The old app has an "API endpoint" page: pick an environment, then copy code that calls the app or fetches its config. /m has no such page. This PR adds it to /m as a developer view, behind the staged switch from #7985. It ships hidden, so no user sees it and the rail has no link.

Scope is the Overview tab only. The History tab and Revert are deployment work and belong to the revision and deployment milestone.

Changes

  • New view endpoints in DEVELOPER_VIEWS (stage hidden). Route /w/[workspace_id]/p/[project_id]/endpoints?app=<id>, wrapped in DeveloperViewGate. The rail link has no params, so the page has an app picker that writes ?app= with a shallow replace.
  • Page: environment buttons (production first), an accordion with "Invoke LLM App" and "Fetch Prompt/Config", a language picker (Python, cURL, TypeScript) and a copy button on each. States: loading skeleton, pick an app, not found, no variants, publish required, load error with retry.
  • @agenta/settings-ui gets pure snippet builders (buildAppEndpointParams, buildInvokeAppSnippets, buildFetchConfigSnippets) and exports CodeBlock. They replace the old js-beautify step with templates that are already formatted, so there is no new dependency. CodeBlock gets an optional onCopyError.
  • Only the selected environment's revision is read, so the page costs one revision request.
  • Nothing shared imports the view. The only shared change is the registry row.

Bugs in the old page, fixed here (each has a test)

  • A refetch reset the chosen environment to production. The choice now stays while the app stays the same.
  • While environments loaded, the page showed "Publish Required" with "undefined environment". It now shows a skeleton.
  • The fetch-config snippet used the environment name as its slug. It now uses the slug.
  • Snippets carried an empty API key (ApiKey ). They now carry YOUR_API_KEY, as the agent API panel does.
  • A failed load read as "No variants available" or "Publish Required". It now shows "Could not load endpoints" with a retry.

New user-facing text (needs Mahmoud's approval)

  • Empty state: "Pick an app" and "Choose an app to see how to call it."
  • Copy failure toast: "Couldn't copy the snippet"
  • Error state title: "Could not load endpoints" (the retry text is the shared one)
  • The Preferences switch for this view shows the registry label "Endpoints" and the description "Code to call an app and fetch its config, per environment." The switch only appears once the stage becomes preview.
  • Unchanged from the old page: "API endpoint", the intro line, "Publish Required" and its text, "No variants available".

Tests

  • pnpm --filter @agenta/settings-ui test: 29 files, 278 tests pass (10 new, in appEndpointSnippets.test.ts).
  • pnpm --filter @agenta/mobile test: 141 of 142 files pass (867 of 868 tests). The one failure is agentPermissions.render.test.tsx, which also fails on the base branch. The run includes endpointEnvironments.test.tsx (7), endpointsScreen.render.test.tsx (13) and a registry case in developerViews.render.test.tsx.
  • pnpm --filter @agenta/mobile types:check and lint: clean (lint shows only existing warnings).
  • speed:check does not exist on this branch (it is in a separate PR), so it was not run.
  • Stories: @agenta/mobile/Developer/Endpoints/EndpointsScreen (PickApp, Loading, NoVariants, PublishRequired, LoadError, Filled, FilledChat). Screenshots follow in a comment.

What to QA

Not reachable yet. To try it, set AGENTA_DEVELOPER_VIEWS=endpoints on the web container and open /m/w/<workspace>/p/<project>/endpoints.

  • No ?app=: "Pick an app" shows. Pick an app: the address gets ?app=<id>.
  • An app with a production deployment: the Python snippet shows. Switch to cURL and copy. The pasted text is the cURL code.
  • Click staging, then wait or reload the list: the choice stays on staging.
  • An environment with no deployment is disabled. If production has none, "Publish Required" names production.
  • Regression: with the switch off, the same URL shows "not found".

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 17 seconds.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 18e83cb and 9781774.

Files selected for processing: 35
  • web/mobile/src/features/archived-apps/ArchivedAppRowCells.tsx
  • web/mobile/src/features/archived-apps/ArchivedAppsScreen.tsx
  • web/mobile/src/features/archived-apps/ArchivedAppsTable.tsx
  • web/mobile/src/features/archived-apps/archivedAppsView.ts
  • web/mobile/src/features/archived-apps/states/ArchivedAppsEmpty.tsx
  • web/mobile/src/features/archived-apps/useArchivedApps.ts
  • web/mobile/src/features/archived-apps/useRestoreArchivedApp.ts
  • web/mobile/src/features/developer/developerViews.ts
  • web/mobile/src/features/endpoints/EndpointAppPicker.tsx
  • web/mobile/src/features/endpoints/EndpointEnvironmentPicker.tsx
  • web/mobile/src/features/endpoints/EndpointSnippetSection.tsx
  • web/mobile/src/features/endpoints/EndpointSnippets.tsx
  • web/mobile/src/features/endpoints/EndpointsScreen.tsx
  • web/mobile/src/features/endpoints/EndpointsView.tsx
  • web/mobile/src/features/endpoints/states/EndpointsNoVariants.tsx
  • web/mobile/src/features/endpoints/states/EndpointsPickApp.tsx
  • web/mobile/src/features/endpoints/states/EndpointsSkeleton.tsx
  • web/mobile/src/features/endpoints/useEndpointEnvironments.ts
  • web/mobile/src/features/endpoints/useEndpointSnippets.ts
  • web/mobile/src/pages/w/[workspace_id]/p/[project_id]/apps/archived.tsx
  • web/mobile/src/pages/w/[workspace_id]/p/[project_id]/endpoints/index.tsx
  • web/mobile/tests/unit/archivedApps.test.ts
  • web/mobile/tests/unit/archivedAppsScreen.render.test.tsx
  • web/mobile/tests/unit/archivedAppsTable.render.test.tsx
  • web/mobile/tests/unit/developerViews.render.test.tsx
  • web/mobile/tests/unit/endpointEnvironments.test.tsx
  • web/mobile/tests/unit/endpointsScreen.render.test.tsx
  • web/mobile/tests/unit/endpointsScreenFixtures.ts
  • web/packages/agenta-settings-ui/src/channels/CodeBlock.tsx
  • web/packages/agenta-settings-ui/src/index.ts
  • web/packages/agenta-settings-ui/src/publish/index.ts
  • web/packages/agenta-settings-ui/src/publish/snippets/appEndpoint.ts
  • web/packages/agenta-settings-ui/tests/unit/appEndpointSnippets.test.ts
  • web/storybook/stories/developer-views/ArchivedApps.stories.tsx
  • web/storybook/stories/developer-views/EndpointsScreen.stories.tsx
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Website preview

Preview URL: https://pr-7993-agenta-website-preview.mahmoud-637.workers.dev

Built from 97817743e2c7d916868f547c368b638cf58841db. This comment updates in place on every push.

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Item Value
Status stopped
Commit 70a1c1c3a77157b3c2459d1f41b6181a033a627f
Manual expiry (UTC) Not granted
CI deadline (UTC) Not granted
Workflow https://github.com/Agenta-AI/agenta/actions/runs/41504690266

Startup stopped or reached its deadline. Environment absence verified; retained storage requires separate provider accounting.

Post /preview as a new comment to request a one-hour preview. Repeating it while active does not extend the hour.
Preview data is disposable. Expiry is enforced by the next successful cleanup sweep, not an exact timer.
Environment deletion stops its compute. Provider-retained storage and permanent services may still be billed.

@mmabrouk

mmabrouk commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

🤖 The AI agent says:

Review loop result for head bd4971559d (base b192a1a5c1), 2 rounds.

Lens Round 1 Round 2
Slop (Opus, Codex) Medium Medium, fixed after the round
Simplify (Opus, Codex) Low not rerun
Correctness (Codex) Medium Medium, fixed after the round

Fixed: the page showed a snippet with an empty URL while the deployed revision loaded, and never errored if it failed; it now shows the skeleton, then the error state. Python snippets broke on true, false and null defaults and cURL broke on an apostrophe; both are escaped now. The builder took the chat flag by re-reading its own JSON; it now takes isChat. An explicit null default became a placeholder string; it is kept. Unused API_KEY_PLACEHOLDER export removed.
Left on purpose: retry invalidates the whole ["workflows"] key (same as the agent list retry). The apiKey input has no caller yet (later views will pass a created key). Round 2 asked for a separate input-schema loading state; the schema comes from the same entity as the revision, as on the old page, so no extra state was added. No third round was run, so the round 2 fixes were not reviewed again.

@mmabrouk

mmabrouk commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

🤖 The AI agent says:

Review loop result, round 3 for head 070f91d1be (base b192a1a5c1). Codex reviewed slop and correctness on the whole diff, focused on the generated snippets.

Lens Round 1 Round 2 Round 3
Slop Medium Medium Medium, fixed after the round
Simplify Low not rerun not rerun
Correctness Medium Medium Medium, fixed after the round

Fixed in round 3:

  • The snippets inserted the endpoint URL, the API key, and the app and environment slugs as raw text. An apostrophe or a double quote in any of them broke the snippet in one language or more. Every value is now written as a string literal (Python and TypeScript) or a single-quoted shell argument (cURL), also in the fetch config snippets.
  • A nested default with a __proto__ key was dropped by the TypeScript snippet. That snippet now reads the body with JSON.parse when the body has that key.
  • New tests cover number, string with quotes and backslash, nested object, array, boolean and null defaults, a URL with an apostrophe, and slugs with an apostrophe and a double quote.
  • Story text color: the load error and pick app titles were dark on dark in the dark story. The story now sets text-foreground.

Left on purpose: same as round 2. The loop stopped after three rounds, so the round 3 fixes were not reviewed again.

Checks: @agenta/mobile types pass. @agenta/settings-ui tests pass (280). Full mobile tests: 867 pass, only the known agentPermissions.render.test.tsx fails (it fails on the release branch too). Mobile and package lint have no errors. Storybook built once for this head. Seven stories at 1440 and 390 px, light and dark, all pass with no page errors and no horizontal overflow; I opened the 1440 light shots and the 390 dark shots and found no clipping or wrong colors after the fix.

@mmabrouk
mmabrouk force-pushed the feat/m-view-endpoints branch from 70a1c1c to b806125 Compare November 2, 2026 19:04
@mmabrouk
mmabrouk changed the base branch from feat/m-views-registry to release/v0.128.3 November 2, 2026 19:04
…feat/m-view-endpoints

# Conflicts:
#	web/mobile/src/features/developer/developerViews.ts
@mmabrouk
mmabrouk merged commit 723c729 into release/v0.128.3 Nov 2, 2026
63 of 64 checks passed
@mmabrouk mmabrouk added the lgtm This PR has been approved by a maintainer label Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant