@agent-native/core 0.237.1 → 0.237.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/agent/actions/describe-models.js +22 -2
  2. package/dist/agent/actions/get-provider-models.js +7 -4
  3. package/dist/agent/actions/manage-provider-models.js +4 -2
  4. package/dist/agent/builder-gateway-models.d.ts +52 -0
  5. package/dist/agent/builder-gateway-models.js +180 -0
  6. package/dist/agent/engine/anthropic-engine.d.ts +1 -1
  7. package/dist/agent/engine/builder-engine.d.ts +1 -1
  8. package/dist/agent/engine/builder-engine.js +4 -1
  9. package/dist/agent/engine/builtin.js +5 -2
  10. package/dist/agent/model-catalog.d.ts +1 -1
  11. package/dist/agent/model-catalog.js +33 -9
  12. package/dist/agent/model-config.d.ts +10 -10
  13. package/dist/agent/model-config.js +29 -12
  14. package/dist/agent/production-agent.js +7 -0
  15. package/dist/agent/provider-model-selection.d.ts +6 -0
  16. package/dist/agent/provider-model-selection.js +28 -13
  17. package/dist/cli/workspace-dev.js +1 -0
  18. package/dist/framework-package-versions.json +13 -13
  19. package/dist/provider-api/actions/provider-api.d.ts +2 -2
  20. package/dist/scripts/agent-engines/list-agent-engines.js +26 -10
  21. package/dist/scripts/agent-engines/manage-agent-engine.js +1 -1
  22. package/dist/scripts/agent-engines/set-agent-engine.js +4 -0
  23. package/dist/server/agent-chat-plugin.js +7 -0
  24. package/dist/server/agent-engine-api-key-route.d.ts +2 -2
  25. package/dist/server/first-touch-route.d.ts +1 -1
  26. package/dist/shared/workspace-links.d.ts +64 -0
  27. package/dist/shared/workspace-links.js +217 -0
  28. package/dist/templates/builder-code-starter/actions/navigate.ts.patch +6 -7
  29. package/dist/templates/chat/actions/navigate.ts +4 -2
  30. package/dist/usage/store.js +32 -0
  31. package/docs/content/actions-package-servers.mdx +58 -0
  32. package/package.json +5 -4
  33. package/src/templates/builder-code-starter/actions/navigate.ts.patch +6 -7
  34. package/src/templates/chat/actions/navigate.ts +4 -2
@@ -0,0 +1,217 @@
1
+ import { normalizeWorkspaceAppHomePath } from "./workspace-app-audience.js";
2
+ /**
3
+ * Builds every cross-app workspace link from registry facts.
4
+ *
5
+ * Registry contract: `url` is the app's address (absolute, its own mount,
6
+ * never a Dispatch page) or absent, and `path` is its mount on the workspace
7
+ * origin. Routes such as Dispatch's `/apps/<id>` are derived here, never
8
+ * stored. Callers pass every input explicitly; nothing here reads the
9
+ * environment, so a missing input is a typed failure, never a guessed URL.
10
+ */
11
+ export const DISPATCH_PAGES = [
12
+ "overview",
13
+ "apps",
14
+ "vault",
15
+ "workspace",
16
+ "settings/integrations",
17
+ "settings/api-keys",
18
+ ];
19
+ export const WORKSPACE_APP_CHILD_PATH_PARAM = "__workspace_app_path";
20
+ function fail(reason, appId) {
21
+ return appId ? { ok: false, reason, appId } : { ok: false, reason };
22
+ }
23
+ function trimSlashes(pathname) {
24
+ return pathname.replace(/\/+$/, "");
25
+ }
26
+ function parseHttpUrl(value) {
27
+ try {
28
+ const url = new URL(value);
29
+ return url.protocol === "http:" || url.protocol === "https:" ? url : null;
30
+ }
31
+ catch {
32
+ // coercion-ok: callers turn null into the typed invalid-address failure.
33
+ return null;
34
+ }
35
+ }
36
+ function normalizeMountPath(value) {
37
+ const raw = value.trim();
38
+ if (!raw.startsWith("/") || raw.startsWith("//"))
39
+ return null;
40
+ if (/[\u0000- \u007f\\?#]/.test(raw))
41
+ return null;
42
+ return trimSlashes(raw.replace(/\/{2,}/g, "/"));
43
+ }
44
+ function appAddress(app, fallbackOrigin) {
45
+ const url = app.url?.trim();
46
+ if (url) {
47
+ const parsed = parseHttpUrl(url);
48
+ if (!parsed)
49
+ return { ok: false, reason: "invalid-address" };
50
+ return {
51
+ ok: true,
52
+ address: {
53
+ origin: parsed.origin,
54
+ pathname: trimSlashes(parsed.pathname),
55
+ },
56
+ };
57
+ }
58
+ const fallback = fallbackOrigin?.trim();
59
+ if (!fallback)
60
+ return { ok: false, reason: "no-address" };
61
+ const mount = normalizeMountPath(app.path ?? "");
62
+ if (mount === null)
63
+ return { ok: false, reason: "no-address" };
64
+ if (fallback === "same-origin") {
65
+ return { ok: true, address: { origin: "", pathname: mount } };
66
+ }
67
+ const origin = parseHttpUrl(fallback);
68
+ if (!origin)
69
+ return { ok: false, reason: "invalid-address" };
70
+ return { ok: true, address: { origin: origin.origin, pathname: mount } };
71
+ }
72
+ function join(address, suffix = "", search = "") {
73
+ const tail = suffix.replace(/^\/+/, "");
74
+ const pathname = tail ? `${address.pathname}/${tail}` : address.pathname;
75
+ return `${address.origin}${pathname || (address.origin ? "" : "/")}${search}`;
76
+ }
77
+ function findApp(apps, appId) {
78
+ const target = appId.trim().toLowerCase();
79
+ return apps.find((app) => app.id.trim().toLowerCase() === target);
80
+ }
81
+ /** Why a registry entry's `url` breaks the address contract, or null when it holds (absent is allowed). */
82
+ export function workspaceAppAddressProblem(app) {
83
+ const raw = app.url;
84
+ if (raw === null || raw === undefined)
85
+ return null;
86
+ const url = parseHttpUrl(raw);
87
+ if (!url)
88
+ return "url is not an absolute http(s) address";
89
+ if (url.search || url.hash || raw.includes("?") || raw.includes("#")) {
90
+ return "url carries a query or fragment";
91
+ }
92
+ if (raw.endsWith("/"))
93
+ return "url has a trailing slash";
94
+ const route = `/apps/${encodeURIComponent(app.id.trim())}`.toLowerCase();
95
+ if (url.pathname.toLowerCase().endsWith(route)) {
96
+ return "url is a Dispatch app page, not the app's address";
97
+ }
98
+ return null;
99
+ }
100
+ /** Reads registry entries from a `{ apps }` payload or a bare array, skipping malformed rows. */
101
+ export function parseWorkspaceLinkApps(payload) {
102
+ const wrapped = payload && typeof payload === "object" && "apps" in payload
103
+ ? payload.apps
104
+ : undefined;
105
+ const rows = Array.isArray(wrapped)
106
+ ? wrapped
107
+ : Array.isArray(payload)
108
+ ? payload
109
+ : [];
110
+ return rows.flatMap((row) => {
111
+ if (!row || typeof row !== "object")
112
+ return [];
113
+ const record = row;
114
+ const id = typeof record.id === "string" ? record.id.trim() : "";
115
+ if (!id)
116
+ return [];
117
+ return [
118
+ {
119
+ id,
120
+ path: typeof record.path === "string" ? record.path : null,
121
+ url: typeof record.url === "string" ? record.url : null,
122
+ homePath: typeof record.homePath === "string" ? record.homePath : null,
123
+ ...(typeof record.isDispatch === "boolean"
124
+ ? { isDispatch: record.isDispatch }
125
+ : {}),
126
+ },
127
+ ];
128
+ });
129
+ }
130
+ export function findDispatchApp(apps) {
131
+ return (apps.find((app) => app.isDispatch === true) ??
132
+ apps.find((app) => app.isDispatch === undefined &&
133
+ app.id.trim().toLowerCase() === "dispatch"));
134
+ }
135
+ function childRoute(address, childPath) {
136
+ if (!childPath.startsWith("/") ||
137
+ childPath.startsWith("//") ||
138
+ /[\u0000-\u001f\u007f]/.test(childPath)) {
139
+ return { ok: false };
140
+ }
141
+ let parsed;
142
+ try {
143
+ parsed = new URL(childPath, "https://agent-native.invalid");
144
+ }
145
+ catch {
146
+ // coercion-ok: reported as the typed invalid-child-path failure.
147
+ return { ok: false };
148
+ }
149
+ const mount = address.pathname;
150
+ const pathname = mount &&
151
+ (parsed.pathname === mount || parsed.pathname.startsWith(`${mount}/`))
152
+ ? parsed.pathname.slice(mount.length) || "/"
153
+ : parsed.pathname;
154
+ return { ok: true, route: `${pathname}${parsed.search}${parsed.hash}` };
155
+ }
156
+ export function resolveWorkspaceLink(context, link) {
157
+ if (link.kind === "dispatch-page") {
158
+ const dispatch = findDispatchApp(context.apps);
159
+ if (!dispatch)
160
+ return fail("no-dispatch");
161
+ const resolved = appAddress(dispatch, context.fallbackOrigin);
162
+ if (!resolved.ok)
163
+ return fail(resolved.reason, dispatch.id);
164
+ return { ok: true, url: join(resolved.address, link.page) };
165
+ }
166
+ const app = findApp(context.apps, link.appId);
167
+ if (!app)
168
+ return fail("unknown-app", link.appId);
169
+ const resolved = appAddress(app, context.fallbackOrigin);
170
+ if (!resolved.ok)
171
+ return fail(resolved.reason, app.id);
172
+ const address = resolved.address;
173
+ switch (link.kind) {
174
+ case "app-base":
175
+ return { ok: true, url: join(address) };
176
+ case "app-home": {
177
+ const homePath = normalizeWorkspaceAppHomePath(app.homePath);
178
+ return { ok: true, url: join(address, homePath === "/" ? "" : homePath) };
179
+ }
180
+ case "app-mcp":
181
+ return { ok: true, url: join(address, "mcp") };
182
+ case "app-path": {
183
+ const child = childRoute(address, link.path);
184
+ if (!child.ok)
185
+ return fail("invalid-child-path", app.id);
186
+ return {
187
+ ok: true,
188
+ url: child.route === "/" ? join(address) : join(address, child.route),
189
+ };
190
+ }
191
+ case "dispatch-app-page": {
192
+ const dispatch = findDispatchApp(context.apps);
193
+ if (!dispatch)
194
+ return fail("no-dispatch");
195
+ const dispatchAddress = appAddress(dispatch, context.fallbackOrigin);
196
+ if (!dispatchAddress.ok)
197
+ return fail(dispatchAddress.reason, dispatch.id);
198
+ const route = `apps/${encodeURIComponent(app.id)}`;
199
+ if (link.childPath === undefined) {
200
+ return { ok: true, url: join(dispatchAddress.address, route) };
201
+ }
202
+ const child = childRoute(address, link.childPath);
203
+ if (!child.ok)
204
+ return fail("invalid-child-path", app.id);
205
+ if (child.route === "/") {
206
+ return { ok: true, url: join(dispatchAddress.address, route) };
207
+ }
208
+ const search = new URLSearchParams([
209
+ [WORKSPACE_APP_CHILD_PATH_PARAM, child.route],
210
+ ]);
211
+ return {
212
+ ok: true,
213
+ url: join(dispatchAddress.address, route, `?${search}`),
214
+ };
215
+ }
216
+ }
217
+ }
@@ -1,8 +1,7 @@
1
1
  ===================================================================
2
2
  --- a/actions/navigate.ts
3
3
  +++ b/actions/navigate.ts
4
- @@ -1,30 +1,44 @@
5
- -import { defineAction } from "@agent-native/core/action";
4
+ @@ -1,4 +1,18 @@
6
5
  +/**
7
6
  + * Navigate the UI to a view.
8
7
  + *
@@ -17,11 +16,11 @@
17
16
  + * --path URL path to navigate to
18
17
  + */
19
18
  +
20
- +import { defineAction, fail } from "@agent-native/core/action";
19
+ import { defineAction, fail } from "@agent-native/core/action";
21
20
  import {
22
21
  navigationIntentSchema,
23
22
  writeAppStateForCurrentTab,
24
- } from "@agent-native/core/application-state";
23
+ @@ -6,27 +20,25 @@
25
24
  import { z } from "zod";
26
25
 
27
26
  export default defineAction({
@@ -38,10 +37,10 @@
38
37
  mcpTool: "search",
39
38
  run: async (args) => {
40
39
  if (!args.view && !args.path) {
41
- - throw new Error("At least --view or --path is required.");
42
- + fail("At least --view or --path is required.", {
40
+ fail("At least --view or --path is required.", {
41
+ - errorCode: "action_invalid_parameters",
43
42
  + errorCode: "navigate_target_required",
44
- + });
43
+ });
45
44
  }
46
45
  const nav: Record<string, string> = {};
47
46
  if (args.view) nav.view = args.view;
@@ -1,4 +1,4 @@
1
- import { defineAction } from "@agent-native/core/action";
1
+ import { defineAction, fail } from "@agent-native/core/action";
2
2
  import {
3
3
  navigationIntentSchema,
4
4
  writeAppStateForCurrentTab,
@@ -18,7 +18,9 @@ export default defineAction({
18
18
  mcpTool: "search",
19
19
  run: async (args) => {
20
20
  if (!args.view && !args.path) {
21
- throw new Error("At least --view or --path is required.");
21
+ fail("At least --view or --path is required.", {
22
+ errorCode: "action_invalid_parameters",
23
+ });
22
24
  }
23
25
  const nav: Record<string, string> = {};
24
26
  if (args.view) nav.view = args.view;
@@ -59,6 +59,10 @@ export function builderCreditsFromCostCents(cents) {
59
59
  return Math.ceil(credits * 1000) / 1000;
60
60
  }
61
61
  const PRICING = [
62
+ {
63
+ match: /fable-5[.-]2/i,
64
+ pricing: { input: 800, output: 4000, cacheRead: 20, cacheWrite: 1000 },
65
+ },
62
66
  {
63
67
  match: /fable-5/i,
64
68
  pricing: { input: 1000, output: 5000, cacheRead: 100, cacheWrite: 1250 },
@@ -75,6 +79,22 @@ const PRICING = [
75
79
  match: /haiku/i,
76
80
  pricing: { input: 100, output: 500, cacheRead: 10, cacheWrite: 125 },
77
81
  },
82
+ {
83
+ match: /gpt-6[.-]2-astra/i,
84
+ pricing: { input: 800, output: 4000, cacheRead: 40, cacheWrite: 1000 },
85
+ },
86
+ {
87
+ match: /gpt-6[.-][12]-sol/i,
88
+ pricing: { input: 200, output: 1000, cacheRead: 10, cacheWrite: 250 },
89
+ },
90
+ {
91
+ match: /gpt-6[.-]1-terra/i,
92
+ pricing: { input: 100, output: 500, cacheRead: 5, cacheWrite: 125 },
93
+ },
94
+ {
95
+ match: /gpt-6-luna/i,
96
+ pricing: { input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 },
97
+ },
78
98
  {
79
99
  match: /gpt-5[.-]6-sol/i,
80
100
  pricing: { input: 400, output: 2000, cacheRead: 40, cacheWrite: 500 },
@@ -91,6 +111,18 @@ const PRICING = [
91
111
  match: /gpt-5/i,
92
112
  pricing: { input: 125, output: 1000, cacheRead: 12.5, cacheWrite: 0 },
93
113
  },
114
+ {
115
+ match: /gemini-4-(?:argon|carbon)/i,
116
+ pricing: { input: 400, output: 2000, cacheRead: 20, cacheWrite: 0 },
117
+ },
118
+ {
119
+ match: /gemini-4-neon/i,
120
+ pricing: { input: 300, output: 1500, cacheRead: 15, cacheWrite: 0 },
121
+ },
122
+ {
123
+ match: /gemini-4-hydrogen/i,
124
+ pricing: { input: 150, output: 750, cacheRead: 7.5, cacheWrite: 0 },
125
+ },
94
126
  {
95
127
  match: /gemini-3[.-]1-pro/i,
96
128
  pricing: { input: 125, output: 1000, cacheRead: 31, cacheWrite: 0 },
@@ -78,6 +78,7 @@ npx @agent-native/actions mcp
78
78
  Call actions programmatically in scripts, cron jobs, workers, or tests:
79
79
 
80
80
  ```ts
81
+ // seed.ts
81
82
  import { createActions } from "@agent-native/actions";
82
83
  import createTodo from "./actions/create-todo";
83
84
 
@@ -88,6 +89,28 @@ const actions = createActions({
88
89
  const todo = await actions.call("create-todo", { title: "Ship docs" });
89
90
  ```
90
91
 
92
+ ### Run TypeScript Files {#run-typescript}
93
+
94
+ The CLI and the `stdio` MCP server load `actions/*.ts` themselves. Your own files, such as `seed.ts` above or a server, need a TypeScript runner. These examples use ES module imports without file extensions and top-level `await`, so make the project an ES module (`npm init -y` writes `"type": "commonjs"`) and run them with [tsx](https://tsx.is):
95
+
96
+ ```bash
97
+ npm pkg set type=module
98
+ pnpm add -D tsx
99
+ npx tsx seed.ts
100
+ ```
101
+
102
+ Plain `node seed.ts` fails with `ERR_MODULE_NOT_FOUND`: Node's built-in TypeScript support needs file extensions on relative imports, and `.generated/actions.ts` leaves them off.
103
+
104
+ ### Regenerate After Adding an Action {#generate}
105
+
106
+ With no dev server, nothing watches `actions/`. The CLI and `stdio` MCP scan it on every run, so a new action works there at once. Code that imports `.generated/actions`, such as a server or the `AppActions` type, sees it only after you regenerate:
107
+
108
+ ```bash
109
+ npx @agent-native/actions generate
110
+ ```
111
+
112
+ Run it after you add, rename, or remove an action, and before a production build.
113
+
91
114
  ## Server Adapters {#servers}
92
115
 
93
116
  Every registry exposes:
@@ -95,6 +118,7 @@ Every registry exposes:
95
118
  - `actions.handler` — combined Web Fetch handler serving `/actions/:name` and `/mcp`
96
119
  - `actions.fetchHandler` / `actions.mcpHandler` — separate handlers when HTTP and MCP need distinct mounts or auth middleware
97
120
  - `toNodeHandler(actions.handler)` — adapter for Node `IncomingMessage` / `ServerResponse` servers
121
+ - `actions.createHandler(options)` — the combined handler with your own `basePath`, MCP auth, or MCP allowlist
98
122
 
99
123
  ### Hono / Cloudflare Workers / Bun
100
124
 
@@ -112,6 +136,14 @@ app.all("/api/agent-native/*", (c) =>
112
136
  export default app;
113
137
  ```
114
138
 
139
+ Workers and Bun serve the default export. On Node, `export default app` starts nothing, so add `@hono/node-server` (`pnpm add @hono/node-server`) and serve the app yourself:
140
+
141
+ ```ts
142
+ import { serve } from "@hono/node-server";
143
+
144
+ serve({ fetch: app.fetch, port: 3000 });
145
+ ```
146
+
115
147
  ### Express
116
148
 
117
149
  ```ts
@@ -136,6 +168,32 @@ const handler = toNodeHandler(actions.handler);
136
168
  fastify.all("/api/agent-native/*", (req, reply) => handler(req.raw, reply.raw));
137
169
  ```
138
170
 
171
+ ## Production {#production}
172
+
173
+ Bundle the server before you deploy it. A bundler resolves the extensionless imports in your own files and `.generated/actions.ts` and leaves packages in `node_modules` alone. For a Node server in `server.ts`, with esbuild:
174
+
175
+ ```bash
176
+ npx @agent-native/actions generate
177
+ npx esbuild server.ts --bundle --platform=node --format=esm --packages=external --outfile=dist/server.mjs
178
+ NODE_ENV=production node dist/server.mjs
179
+ ```
180
+
181
+ Until you add auth, every action and the MCP endpoint answer anyone who can reach the server:
182
+
183
+ - Resolve the caller in `actions/context.ts` and check it in each action's `authorize` ([Auth & Migration](/docs/actions-package-auth-migration#auth-context)).
184
+ - Mount a handler built with `actions.createHandler()` in place of `actions.handler`, so only MCP clients you accept can list and call the actions you choose:
185
+
186
+ ```ts
187
+ const handler = actions.createHandler({
188
+ mcp: {
189
+ authenticate: async (request) => verifyBearerToken(request),
190
+ include: ["list-todos", "create-todo"],
191
+ },
192
+ });
193
+
194
+ app.all("/api/agent-native/*", (c) => handler(c.req.raw, { platform: c.env }));
195
+ ```
196
+
139
197
  ## Vanilla Client (`@agent-native/actions/client`) {#vanilla-client}
140
198
 
141
199
  Call actions with end-to-end TypeScript inference from React Native, Electron, Chrome extensions, browser scripts, or another service:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.237.1",
3
+ "version": "0.237.2",
4
4
  "description": "The agentic application framework for building autonomous agents with intuitive UIs",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -741,6 +741,7 @@
741
741
  "./shared/test-traffic": "./dist/shared/test-traffic.js",
742
742
  "./shared/workspace-app-audience": "./dist/shared/workspace-app-audience.js",
743
743
  "./shared/workspace-app-id": "./dist/shared/workspace-app-id.js",
744
+ "./shared/workspace-links": "./dist/shared/workspace-links.js",
744
745
  "./user-profile/shared": "./dist/user-profile/shared.js",
745
746
  "./workspace-connections/groups": "./dist/workspace-connections/groups.js",
746
747
  "./client/agentkit-chat": "./dist/client/tombstone/agentkit-chat.js",
@@ -834,9 +835,9 @@
834
835
  "yaml": "^2.9.0",
835
836
  "yjs": "^13.6.33",
836
837
  "zod": "^4.3.6",
837
- "@agent-native/recap-cli": "^0.5.114",
838
- "@agent-native/actions": "^0.1.3",
839
- "@agent-native/agentkit": "^0.237.1"
838
+ "@agent-native/actions": "^0.1.4",
839
+ "@agent-native/agentkit": "^0.237.2",
840
+ "@agent-native/recap-cli": "^0.5.115"
840
841
  },
841
842
  "devDependencies": {
842
843
  "@ai-sdk/anthropic": "^3.0.71",
@@ -1,8 +1,7 @@
1
1
  ===================================================================
2
2
  --- a/actions/navigate.ts
3
3
  +++ b/actions/navigate.ts
4
- @@ -1,30 +1,44 @@
5
- -import { defineAction } from "@agent-native/core/action";
4
+ @@ -1,4 +1,18 @@
6
5
  +/**
7
6
  + * Navigate the UI to a view.
8
7
  + *
@@ -17,11 +16,11 @@
17
16
  + * --path URL path to navigate to
18
17
  + */
19
18
  +
20
- +import { defineAction, fail } from "@agent-native/core/action";
19
+ import { defineAction, fail } from "@agent-native/core/action";
21
20
  import {
22
21
  navigationIntentSchema,
23
22
  writeAppStateForCurrentTab,
24
- } from "@agent-native/core/application-state";
23
+ @@ -6,27 +20,25 @@
25
24
  import { z } from "zod";
26
25
 
27
26
  export default defineAction({
@@ -38,10 +37,10 @@
38
37
  mcpTool: "search",
39
38
  run: async (args) => {
40
39
  if (!args.view && !args.path) {
41
- - throw new Error("At least --view or --path is required.");
42
- + fail("At least --view or --path is required.", {
40
+ fail("At least --view or --path is required.", {
41
+ - errorCode: "action_invalid_parameters",
43
42
  + errorCode: "navigate_target_required",
44
- + });
43
+ });
45
44
  }
46
45
  const nav: Record<string, string> = {};
47
46
  if (args.view) nav.view = args.view;
@@ -1,4 +1,4 @@
1
- import { defineAction } from "@agent-native/core/action";
1
+ import { defineAction, fail } from "@agent-native/core/action";
2
2
  import {
3
3
  navigationIntentSchema,
4
4
  writeAppStateForCurrentTab,
@@ -18,7 +18,9 @@ export default defineAction({
18
18
  mcpTool: "search",
19
19
  run: async (args) => {
20
20
  if (!args.view && !args.path) {
21
- throw new Error("At least --view or --path is required.");
21
+ fail("At least --view or --path is required.", {
22
+ errorCode: "action_invalid_parameters",
23
+ });
22
24
  }
23
25
  const nav: Record<string, string> = {};
24
26
  if (args.view) nav.view = args.view;