Skip to content

Commit b1c6ec9

Browse files
xuyushun441-sysos-zhuangclaude
authored
feat(spec): ActionSchema gains opensInNewTab + newTabUrl zero-roundtrip contract (#1787)
Documents the existing opensInNewTab renderer behavior in the schema and adds newTabUrl: a direct new-tab URL template ({recordId} placeholder) the renderer navigates the pre-opened tab to immediately on click, skipping the action POST. The target endpoint must enforce all auth/authz itself (e.g. the cloud /sso-open endpoint, which re-runs every check the POST half would have done). Removes one full network round trip of white-screen latency from click-to-popup on actions like sys_environment sso_as_owner. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent d100707 commit b1c6ec9

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

packages/spec/src/ui/action.zod.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,25 @@ export const ActionSchema = lazySchema(() => z.object({
421421
*/
422422
mode: z.enum(['create', 'edit', 'delete', 'custom']).optional().describe('Semantic mode of the action.'),
423423

424+
/**
425+
* Open the action's result in a NEW TAB. The renderer pre-opens the tab
426+
* synchronously on click (preserving the user gesture so popup blockers
427+
* don't fire), paints a progress page, then drives the tab to the
428+
* handler's returned `redirectUrl` — or, when `newTabUrl` is set, straight
429+
* to that URL with no server round trip.
430+
*/
431+
opensInNewTab: z.boolean().optional().describe('Open the action result in a new tab. The renderer pre-opens the tab synchronously on click (popup-blocker-safe) and navigates it to the handler\'s redirectUrl.'),
432+
433+
/**
434+
* Zero-roundtrip new-tab target. A path template the renderer navigates
435+
* the pre-opened tab to IMMEDIATELY on click, skipping the action POST
436+
* entirely. Only valid together with `opensInNewTab`. The target endpoint
437+
* MUST perform all auth/authz itself (e.g. the cloud `/sso-open` endpoint,
438+
* which re-runs every check the POST half would have done). Supports the
439+
* `{recordId}` placeholder, URL-encoded on substitution.
440+
*/
441+
newTabUrl: z.string().optional().describe('Direct new-tab URL template ({recordId} placeholder). When set with opensInNewTab, the renderer navigates the pre-opened tab here immediately — no action POST. The endpoint must enforce auth itself.'),
442+
424443
/** Execution */
425444
timeout: z.number().optional().describe('Maximum execution time in milliseconds for the action'),
426445

0 commit comments

Comments
 (0)