@agent-native/core 0.232.0 → 0.233.0-nightly-20261124004026
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.
- package/dist/a2a/handlers.js +60 -1
- package/dist/a2a/server.js +9 -0
- package/dist/action-call-classification.d.ts +9 -0
- package/dist/action-call-classification.js +18 -0
- package/dist/action-conformance.d.ts +81 -0
- package/dist/action-conformance.js +392 -0
- package/dist/action.d.ts +18 -0
- package/dist/action.js +68 -5
- package/dist/agent/execution-fence.d.ts +3 -1
- package/dist/agent/execution-fence.js +13 -2
- package/dist/agent/production-agent.d.ts +3 -0
- package/dist/agent/production-agent.js +301 -145
- package/dist/agent/run-store.js +11 -0
- package/dist/agent/thread-data-builder.d.ts +2 -0
- package/dist/agent/thread-data-builder.js +5 -1
- package/dist/app-config/schema.d.ts +24 -1
- package/dist/application-state/handlers.d.ts +1 -1
- package/dist/application-state/navigate-write-guard.d.ts +4 -1
- package/dist/application-state/navigate-write-guard.js +15 -1
- package/dist/cli/design-connect.js +5 -1
- package/dist/cli/matched-check.d.ts +1 -0
- package/dist/cli/matched-check.js +76 -0
- package/dist/client/agent-chat/index.d.ts +1 -1
- package/dist/client/agent-chat/index.js +1 -1
- package/dist/client/analytics/index.d.ts +1 -1
- package/dist/client/analytics.d.ts +13 -1
- package/dist/client/analytics.js +5 -2
- package/dist/client/application-state.d.ts +11 -0
- package/dist/client/application-state.js +219 -23
- package/dist/client/chat/agentkit-agent-native.js +52 -11
- package/dist/client/chat/agentkit-protocol.js +23 -2
- package/dist/client/chat-first-state.d.ts +6 -0
- package/dist/client/chat-first-state.js +36 -1
- package/dist/client/feature-flags/use-feature-flag.js +14 -6
- package/dist/client/navigation/index.d.ts +2 -0
- package/dist/client/navigation/index.js +2 -0
- package/dist/client/route-state.js +60 -18
- package/dist/client/screen-settled.d.ts +71 -1
- package/dist/client/screen-settled.js +221 -3
- package/dist/client/sse-event-processor.d.ts +1 -0
- package/dist/client/sse-event-processor.js +89 -10
- package/dist/client/theme.d.ts +6 -0
- package/dist/client/theme.js +7 -1
- package/dist/client/use-action.js +32 -10
- package/dist/client/use-session.js +36 -18
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/db/client.js +2 -2
- package/dist/db/errors.d.ts +2 -0
- package/dist/db/errors.js +38 -6
- package/dist/feature-flags/actions/get-feature-flags.js +9 -2
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/framework-package-versions.json +8 -8
- package/dist/ingestion/index.d.ts +1 -0
- package/dist/ingestion/index.js +1 -0
- package/dist/ingestion/matched-capture.d.ts +173 -0
- package/dist/ingestion/matched-capture.js +574 -0
- package/dist/ingestion/pptx.d.ts +1 -0
- package/dist/ingestion/pptx.js +4 -2
- package/dist/labs/store.d.ts +3 -1
- package/dist/labs/store.js +8 -4
- package/dist/manifest/index.d.ts +142 -3
- package/dist/manifest/index.js +249 -19
- package/dist/mcp/build-server.d.ts +2 -0
- package/dist/mcp/build-server.js +8 -1
- package/dist/mcp/server.js +3 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/metrics.d.ts +2 -0
- package/dist/observability/metrics.js +7 -0
- package/dist/org/index.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +10 -10
- package/dist/provider-api/actions/provider-api.d.ts +14 -14
- package/dist/server/action-routes.js +9 -0
- package/dist/server/agent-chat/prompt-resources.js +107 -83
- package/dist/server/agent-run-context.d.ts +3 -0
- package/dist/server/agent-run-context.js +7 -0
- package/dist/server/builder-oauth.d.ts +1 -0
- package/dist/server/builder-oauth.js +40 -2
- package/dist/server/filesystem-action-entry.js +5 -0
- package/dist/server/first-touch-route.d.ts +2 -2
- package/dist/server/index.d.ts +2 -2
- package/dist/server/index.js +2 -2
- package/dist/server/open-route.js +10 -4
- package/dist/server/poll.d.ts +3 -0
- package/dist/server/poll.js +74 -14
- package/dist/server/request-context.d.ts +16 -6
- package/dist/server/request-context.js +4 -0
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/shared/analytics-events.d.ts +7 -0
- package/dist/shared/viewport-mode.d.ts +2 -0
- package/dist/shared/viewport-mode.js +9 -0
- package/dist/templates/chat/.agents/skills/actions/SKILL.md +1 -0
- package/dist/templates/chat/.agents/skills/build-an-app/SKILL.md +38 -17
- package/dist/templates/chat/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/dist/templates/default/.agents/skills/actions/SKILL.md +1 -0
- package/dist/templates/default/.agents/skills/build-an-app/SKILL.md +38 -17
- package/dist/templates/default/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/dist/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +3 -2
- package/dist/templates/headless/.agents/skills/actions/SKILL.md +1 -0
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +1 -0
- package/dist/templates/workspace-core/.agents/skills/build-an-app/SKILL.md +38 -17
- package/dist/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/dist/testing.d.ts +1 -0
- package/dist/testing.js +1 -0
- package/dist/tracking/action-lifecycle.d.ts +2 -0
- package/dist/tracking/action-lifecycle.js +16 -5
- package/docs/content/actions-defining.mdx +7 -0
- package/docs/content/custom-design-system.mdx +4 -2
- package/package.json +3 -3
- package/src/templates/chat/.agents/skills/actions/SKILL.md +1 -0
- package/src/templates/chat/.agents/skills/build-an-app/SKILL.md +38 -17
- package/src/templates/chat/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/src/templates/default/.agents/skills/actions/SKILL.md +1 -0
- package/src/templates/default/.agents/skills/build-an-app/SKILL.md +38 -17
- package/src/templates/default/.agents/skills/shadcn-ui/SKILL.md +3 -2
- package/src/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +3 -2
- package/src/templates/headless/.agents/skills/actions/SKILL.md +1 -0
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +1 -0
- package/src/templates/workspace-core/.agents/skills/build-an-app/SKILL.md +38 -17
- package/src/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +3 -2
|
@@ -303,8 +303,9 @@ do not claim new roots.
|
|
|
303
303
|
never count. For a purely visual fix, before and after screenshots are
|
|
304
304
|
evidence, not automated proof: before merging, a human must open both and
|
|
305
305
|
confirm they show the reported change. Put the evidence under the report in
|
|
306
|
-
the PR's `Reports` section. A test-only change (
|
|
307
|
-
`.changeset/`) needs only `fix-proof: test-only
|
|
306
|
+
the PR's `Reports` section. A test-only or docs-only change (tests, docs
|
|
307
|
+
pages, optional `.changeset/`) needs only `fix-proof: test-only` or
|
|
308
|
+
`docs-only`.
|
|
308
309
|
- **Two misses, then stop guessing.** If two attempts don't turn the check
|
|
309
310
|
green, stop editing and capture the real failure first (stack, logs, the
|
|
310
311
|
reporter's actual data). If that doesn't settle it within about 30
|
|
@@ -217,6 +217,7 @@ Everything else — CRUD, settings, search, list/detail reads, auth state, anyth
|
|
|
217
217
|
- **Do** validate inputs before the first write. A rejection raised before any write the framework can see is "nothing saved", so the agent can fix its request and retry. Don't reorder code just to add labels. See *Failed Writes*.
|
|
218
218
|
- **Do** render `actionErrorMessage(error) ?? yourCopy` in UI, never bare `error.message`. The message keeps an `Action <name> failed:` prefix that belongs in a console, so a toast built from it reads "Action update-brand-kit failed: That name is taken." The helper returns only what the action wrote, and `undefined` when nothing did (network drop, proxy HTML page), which is why the fallback is not optional.
|
|
219
219
|
- **Do** pass a real `errorCode` when the agent should branch on the failure rather than re-read it. Codes other than the default `action_failed` are appended to the tool result as `(errorCode: not_found)`, on both the in-app agent and MCP. `details` follow as an `Error details: {...}` JSON line, and as `structuredContent.error` over MCP, capped at 2,000 characters, so keep them to what the agent acts on next: ids, limits, field names. The status never reaches either.
|
|
220
|
+
- **Do** set `automatic: true` on a write the app makes with no user gesture behind it: on load, on mount, on a timer, or experiment and usage bookkeeping. Its action events then say `action_kind: "automatic"` instead of `"write"`, so it is not counted as product use. Only a call from the app's own UI can be automatic; a call from an agent, an MCP client, or the CLI stays `"write"`. When only some UI calls are automatic, pass a predicate of the input and the call's context instead (a background sync that is automatic unless a refresh button forces it). A call the action's `planMode` declares a read already says `"read"`. Never set `readOnly` on a write to keep it out of analytics.
|
|
220
221
|
- **Don't** re-export actions as REST — `/_agent-native/actions/:name` is already the REST surface; duplicating it under `/api/*` hides the operation from agents.
|
|
221
222
|
- **Don't** reach for provider integrations, `authorize`, `needsApproval`, or `_agentImages` without checking `references/` first — each has sharp edges covered there, not here.
|
|
222
223
|
|
|
@@ -217,6 +217,7 @@ Everything else — CRUD, settings, search, list/detail reads, auth state, anyth
|
|
|
217
217
|
- **Do** validate inputs before the first write. A rejection raised before any write the framework can see is "nothing saved", so the agent can fix its request and retry. Don't reorder code just to add labels. See *Failed Writes*.
|
|
218
218
|
- **Do** render `actionErrorMessage(error) ?? yourCopy` in UI, never bare `error.message`. The message keeps an `Action <name> failed:` prefix that belongs in a console, so a toast built from it reads "Action update-brand-kit failed: That name is taken." The helper returns only what the action wrote, and `undefined` when nothing did (network drop, proxy HTML page), which is why the fallback is not optional.
|
|
219
219
|
- **Do** pass a real `errorCode` when the agent should branch on the failure rather than re-read it. Codes other than the default `action_failed` are appended to the tool result as `(errorCode: not_found)`, on both the in-app agent and MCP. `details` follow as an `Error details: {...}` JSON line, and as `structuredContent.error` over MCP, capped at 2,000 characters, so keep them to what the agent acts on next: ids, limits, field names. The status never reaches either.
|
|
220
|
+
- **Do** set `automatic: true` on a write the app makes with no user gesture behind it: on load, on mount, on a timer, or experiment and usage bookkeeping. Its action events then say `action_kind: "automatic"` instead of `"write"`, so it is not counted as product use. Only a call from the app's own UI can be automatic; a call from an agent, an MCP client, or the CLI stays `"write"`. When only some UI calls are automatic, pass a predicate of the input and the call's context instead (a background sync that is automatic unless a refresh button forces it). A call the action's `planMode` declares a read already says `"read"`. Never set `readOnly` on a write to keep it out of analytics.
|
|
220
221
|
- **Don't** re-export actions as REST — `/_agent-native/actions/:name` is already the REST surface; duplicating it under `/api/*` hides the operation from agents.
|
|
221
222
|
- **Don't** reach for provider integrations, `authorize`, `needsApproval`, or `_agentImages` without checking `references/` first — each has sharp edges covered there, not here.
|
|
222
223
|
|
|
@@ -25,17 +25,23 @@ order and decisions; use the edit-point reference for the scaffold you have.
|
|
|
25
25
|
|
|
26
26
|
## 1. Orient
|
|
27
27
|
|
|
28
|
-
Read `AGENTS.md`, `DESIGN.md` if present, and `app-quality-bar`.
|
|
29
|
-
|
|
28
|
+
Read `AGENTS.md`, `DESIGN.md` if present, `product-judgment`, and `app-quality-bar`.
|
|
29
|
+
Run `product-judgment` Step 0 before writing code: grep `packages/core` and
|
|
30
|
+
`@agent-native/toolkit/craft` (plus `agent-native-toolkit` kits) so you reuse
|
|
31
|
+
existing primitives instead of rebuilding state boundaries, shortcut managers,
|
|
32
|
+
destructive dialogs, or optimistic hooks. Inspect the closest existing screen or
|
|
33
|
+
action and the files you will edit. Use the bundled docs/source commands in
|
|
30
34
|
`AGENTS.md` only to answer a concrete API question; do not web-research
|
|
31
35
|
framework APIs.
|
|
32
36
|
|
|
33
37
|
## 2. Decide
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
Run `product-judgment` Steps 1–2 before writing code: choose one or two
|
|
40
|
+
interaction patterns, write or update `DESIGN.md` as the single required design
|
|
41
|
+
contract with the 6-Axis Judgment Card and 3-Option Decision Block (chosen and
|
|
42
|
+
rejected UX options), and register `app.manifest.ts` with real screens,
|
|
43
|
+
entities, `viewPolicy`, and `suggestableCapabilities`. Choose these six things
|
|
44
|
+
before writing code:
|
|
39
45
|
|
|
40
46
|
1. **Slice**: the one workflow that proves the app. For a booking app: create a
|
|
41
47
|
booking, reject an overlap, cancel, weekly grid per room. Name what you are
|
|
@@ -119,16 +125,26 @@ The access table, the concurrency pattern, and the security rules are in
|
|
|
119
125
|
- Load and write data with `useActionQuery` and `useActionMutation` from
|
|
120
126
|
`@agent-native/core/client/hooks`. No `fetch`, and no `/api/*` routes for app
|
|
121
127
|
data. Those routes are only for uploads, webhooks, OAuth callbacks, and streaming.
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
`
|
|
128
|
+
- Use `@agent-native/toolkit/craft` primitives by default:
|
|
129
|
+
- `ResourceStateBoundary` for every async surface (requires a layout-matched
|
|
130
|
+
`skeleton`, an actionable `empty` CTA, and an `error` retry path — never a
|
|
131
|
+
spinner, bare `"Loading…"`, or dead-end `"Could not load"` screen).
|
|
132
|
+
- `useOptimisticAction` (or `onMutate` + `setQueryData` with `onError`
|
|
133
|
+
rollback and `toast.error(actionErrorMessage(error) ?? "<fallback>")`) so
|
|
134
|
+
writes acknowledge in `<100ms` and show a pending state within `<400ms`.
|
|
135
|
+
- `SafeDestructiveAction` for destructive verbs: instant optimistic action +
|
|
136
|
+
undo affordance when reversible, accessible `AlertDialog` confirmation when
|
|
137
|
+
irreversible — never `window.confirm`, `alert`, or `prompt`.
|
|
138
|
+
- `useCommandRegistry` for portable `Mod` (`Cmd`/`Ctrl`) shortcuts, `j`/`k`,
|
|
139
|
+
`Esc`, and `?` shortcut help that automatically ignore editable inputs.
|
|
140
|
+
- Style with semantic tokens from `@agent-native/toolkit/styles.css` (which
|
|
141
|
+
bundles `craft-tokens.css`: `--success`/`--warning`/`--info`, `--surface-0..3`,
|
|
142
|
+
`--density-*`, `--dur-instant`/`--dur-fast`/`--dur-panel`, `tabular-nums`, and
|
|
143
|
+
`640px` chat-companion `@container` utilities).
|
|
127
144
|
- Import controls from `@/components/ui/*`. When one is missing (dialog,
|
|
128
145
|
select, skeleton, alert-dialog), add a one-line re-export like `button.tsx`:
|
|
129
146
|
`export * from "@agent-native/toolkit/ui/dialog";`.
|
|
130
|
-
- Use Tabler icons only.
|
|
131
|
-
`alert`, or `prompt`.
|
|
147
|
+
- Use Tabler icons only.
|
|
132
148
|
- Don't add a page title that repeats the nav item, a subtitle under a title,
|
|
133
149
|
or a stats strip. The data is the page. For visual direction, see `frontend-design`.
|
|
134
150
|
- Follow the app's existing localization pattern for user-facing copy.
|
|
@@ -175,10 +191,13 @@ made from a stale view. See `real-time-sync`.
|
|
|
175
191
|
message; read back the saved state through the matching list/get action.
|
|
176
192
|
The CLI prints the failure message, not its structured `errorCode`, so also
|
|
177
193
|
verify any code-specific behavior in the action contract or browser.
|
|
178
|
-
4.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
review
|
|
194
|
+
4. Run the `$0` static craft audit (`pnpm tsx scripts/guard-craft-slop.ts <app-dir>`)
|
|
195
|
+
and review the 5 Human-Team Lenses from `product-judgment` before capturing
|
|
196
|
+
screenshots. Then apply the canonical 12-row visual rubric and capture loop
|
|
197
|
+
from `skills/turn-into-app/references/review-loop.md` and
|
|
198
|
+
`app-quality-bar/visual-review.md`. Give the screenshots, rubric, and brief to
|
|
199
|
+
a blind reviewer and use the lower score per row. Fix and recapture until the
|
|
200
|
+
review passes (mean >= 4.0, every row >= 3, zero automatic fails).
|
|
182
201
|
5. Run the 60-second automated Playwright walkthrough from `app-quality-bar`.
|
|
183
202
|
Cover empty, populated, split pane at 520 px or narrower, and error
|
|
184
203
|
recovery. Click every navigation item, create and edit, reload and verify
|
|
@@ -197,6 +216,8 @@ check you didn't run.
|
|
|
197
216
|
|
|
198
217
|
## Related
|
|
199
218
|
|
|
219
|
+
- `product-judgment`: 5-step pre-flight (primitive inventory, 6-Axis Judgment
|
|
220
|
+
Card, 3-Option Decision Block, 5 Human-Team Lenses, and escalation boundary).
|
|
200
221
|
- `adding-a-feature`: the feature checklist for each later feature in this app.
|
|
201
222
|
- `frontend-design`, `actions`, `sharing`, `real-time-sync`, and `security`:
|
|
202
223
|
go deeper on one area when the references aren't enough.
|
|
@@ -52,8 +52,9 @@ presentation seam.
|
|
|
52
52
|
|
|
53
53
|
Use the app's existing field components and validation pattern. Associate
|
|
54
54
|
errors with their inputs and expose invalid state to assistive technology.
|
|
55
|
-
Icon-only actions need an accessible name and a usable focus target. Use
|
|
56
|
-
|
|
55
|
+
Icon-only actions need an accessible name and a usable focus target. Use Tabler
|
|
56
|
+
Icons (`@tabler/icons-react`) for UI icons, except in Design, which uses Radix
|
|
57
|
+
Icons (`@radix-ui/react-icons`).
|
|
57
58
|
|
|
58
59
|
Do not recreate menus, popovers, dialogs, or confirmations with absolute
|
|
59
60
|
positioning and custom click-outside handlers. Never use browser `alert`,
|
package/dist/testing.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export { startLocalPlanBridge } from "./cli/plan-local.js";
|
|
|
4
4
|
export { prepareDesignConnectManifest, startDesignConnectBridge, type DesignConnectBridge, } from "./cli/design-connect.js";
|
|
5
5
|
export { assertNoInlineImageBytes } from "./shared/inline-bytes.js";
|
|
6
6
|
export { createMemorySearchVectorStore, type MemorySearchVectorStore, } from "./search/memory-vector-store.js";
|
|
7
|
+
export { ACTION_CONFORMANCE_SURFACES, ACTION_CONFORMANCE_TIMEOUT_MS, ACTION_CONFORMANCE_RUN_TIMEOUT_MS, actionContractFindings, assertActionConformance, checkActionConformance, type ActionConformanceFinding, type ActionConformanceFixture, type ActionConformanceReport, type ActionConformanceSurface, type ConformanceAction, type ConformanceAdapter, type ConformanceFocus, type ConformanceResponse, type ConformanceTool, } from "./action-conformance.js";
|
package/dist/testing.js
CHANGED
|
@@ -4,3 +4,4 @@ export { startLocalPlanBridge } from "./cli/plan-local.js";
|
|
|
4
4
|
export { prepareDesignConnectManifest, startDesignConnectBridge, } from "./cli/design-connect.js";
|
|
5
5
|
export { assertNoInlineImageBytes } from "./shared/inline-bytes.js";
|
|
6
6
|
export { createMemorySearchVectorStore, } from "./search/memory-vector-store.js";
|
|
7
|
+
export { ACTION_CONFORMANCE_SURFACES, ACTION_CONFORMANCE_TIMEOUT_MS, ACTION_CONFORMANCE_RUN_TIMEOUT_MS, actionContractFindings, assertActionConformance, checkActionConformance, } from "./action-conformance.js";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ActionRunContext } from "../action.js";
|
|
2
|
+
import { type AgentNativeActionKind } from "../shared/analytics-events.js";
|
|
2
3
|
export declare function wrapRunWithActionTracking(run: (args: any, ctx?: ActionRunContext) => any, readOnly: boolean | undefined, options?: {
|
|
3
4
|
includeOutputId?: boolean;
|
|
5
|
+
actionKind?: (args: unknown, ctx: ActionRunContext, fromAppUi: boolean) => AgentNativeActionKind | Promise<AgentNativeActionKind>;
|
|
4
6
|
}): (args: any, ctx?: ActionRunContext) => Promise<any>;
|
|
@@ -8,14 +8,14 @@ function shouldTrackAction(ctx) {
|
|
|
8
8
|
!IGNORED_ACTION_NAMES.has(actionName) &&
|
|
9
9
|
!IGNORED_ACTION_PATTERN.test(actionName));
|
|
10
10
|
}
|
|
11
|
-
function actionProperties(ctx, extra = {}) {
|
|
11
|
+
function actionProperties(ctx, kind, extra = {}) {
|
|
12
12
|
const appName = normalizeTrackingDimension(ctx.appId) ?? "framework";
|
|
13
13
|
return {
|
|
14
14
|
app_name: appName,
|
|
15
15
|
...(ctx.appId ? { template_name: appName } : {}),
|
|
16
16
|
action_name: ctx.actionName.trim(),
|
|
17
17
|
action_source: ctx.caller,
|
|
18
|
-
action_kind:
|
|
18
|
+
action_kind: kind,
|
|
19
19
|
...(ctx.userEmail ? { user_email: ctx.userEmail } : {}),
|
|
20
20
|
...(ctx.orgId ? { workspace_id: ctx.orgId } : {}),
|
|
21
21
|
...(ctx.threadId ? { thread_id: ctx.threadId } : {}),
|
|
@@ -45,24 +45,35 @@ function outputId(result) {
|
|
|
45
45
|
}
|
|
46
46
|
return undefined;
|
|
47
47
|
}
|
|
48
|
+
async function isAppUiCall(ctx) {
|
|
49
|
+
if (ctx.caller !== "frontend")
|
|
50
|
+
return false;
|
|
51
|
+
const { getRequestContext } = await import("../server/request-context.js");
|
|
52
|
+
return getRequestContext()?.appPageRequest === true;
|
|
53
|
+
}
|
|
48
54
|
export function wrapRunWithActionTracking(run, readOnly, options = {}) {
|
|
49
55
|
if (readOnly === true)
|
|
50
56
|
return run;
|
|
51
57
|
return async function trackedRun(args, ctx) {
|
|
52
58
|
if (!ctx || !shouldTrackAction(ctx))
|
|
53
59
|
return run(args, ctx);
|
|
60
|
+
const kind = (await options.actionKind?.(args, ctx, await isAppUiCall(ctx))) ??
|
|
61
|
+
"write";
|
|
54
62
|
const { track } = await import("./registry.js");
|
|
55
63
|
const startedAt = Date.now();
|
|
56
64
|
const operationId = globalThis.crypto?.randomUUID?.() ??
|
|
57
65
|
`${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
58
|
-
track(AGENT_NATIVE_ACTION_EVENTS.started, actionProperties(ctx,
|
|
66
|
+
track(AGENT_NATIVE_ACTION_EVENTS.started, actionProperties(ctx, kind, {
|
|
67
|
+
operation_id: operationId,
|
|
68
|
+
status: "started",
|
|
69
|
+
}), ctx);
|
|
59
70
|
try {
|
|
60
71
|
const result = await run(args, ctx);
|
|
61
72
|
const id = options.includeOutputId === false ||
|
|
62
73
|
ctx.omitFromPersistedHistory === true
|
|
63
74
|
? undefined
|
|
64
75
|
: outputId(result);
|
|
65
|
-
track(AGENT_NATIVE_ACTION_EVENTS.completed, actionProperties(ctx, {
|
|
76
|
+
track(AGENT_NATIVE_ACTION_EVENTS.completed, actionProperties(ctx, kind, {
|
|
66
77
|
operation_id: operationId,
|
|
67
78
|
status: "completed",
|
|
68
79
|
outcome: "success",
|
|
@@ -73,7 +84,7 @@ export function wrapRunWithActionTracking(run, readOnly, options = {}) {
|
|
|
73
84
|
return result;
|
|
74
85
|
}
|
|
75
86
|
catch (error) {
|
|
76
|
-
track(AGENT_NATIVE_ACTION_EVENTS.failed, actionProperties(ctx, {
|
|
87
|
+
track(AGENT_NATIVE_ACTION_EVENTS.failed, actionProperties(ctx, kind, {
|
|
77
88
|
operation_id: operationId,
|
|
78
89
|
status: "failed",
|
|
79
90
|
outcome: classifyTrackingFailure(error),
|
|
@@ -129,6 +129,13 @@ The framework auto-discovers every file in `actions/` and mounts it on startup.
|
|
|
129
129
|
description:
|
|
130
130
|
"When true (or when the predicate returns true), a failure after this action's own write is a known failure the model can correct and retry, instead of blocking the tool for the rest of the current turn. Reserve this for actions that are safe to re-run after any error. A rejection before any write needs no flag. See Retry-safe writes below.",
|
|
131
131
|
},
|
|
132
|
+
{
|
|
133
|
+
name: "automatic",
|
|
134
|
+
type: "boolean | ((input) => boolean)",
|
|
135
|
+
optional: true,
|
|
136
|
+
description:
|
|
137
|
+
'Marks a write the app makes on its own, with no user gesture: on load, on mount, on a timer, or experiment and usage bookkeeping. Its action_started, action_completed, and action_failed events carry action_kind "automatic" instead of "write", so product-use counts leave it out. A predicate labels only the calls it returns true for. It labels analytics only: never set readOnly to quiet a write.',
|
|
138
|
+
},
|
|
132
139
|
{
|
|
133
140
|
name: "agentTool",
|
|
134
141
|
type: "boolean",
|
|
@@ -188,12 +188,14 @@ visual vocabulary.
|
|
|
188
188
|
`Picker` covers select and combobox behavior only. Date picking is not part of
|
|
189
189
|
the version 1 semantic contract.
|
|
190
190
|
|
|
191
|
+
<!-- i18n-copy-ignore: the localized pages don't carry this paragraph yet, so there's no translated sentence to update. -->
|
|
192
|
+
|
|
191
193
|
The framework-owned sign-in shell is outside both the semantic bridge and the
|
|
192
194
|
build-time token tier in v1; the authenticated settings, sharing, history rail,
|
|
193
195
|
and agent-panel surfaces are useful design-system proving surfaces. The main
|
|
194
196
|
Chat canvas remains tokens-only because the assistant-ui renderer is a
|
|
195
|
-
documented v1 non-goal. Dark mode can be exercised from the
|
|
196
|
-
|
|
197
|
+
documented v1 non-goal. Dark mode can be exercised from the Theme row in
|
|
198
|
+
Settings → Appearance or the `Cmd/Ctrl+K` Appearance command.
|
|
197
199
|
|
|
198
200
|
## Overlays, portals, and focus
|
|
199
201
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.233.0-nightly-20261124004026",
|
|
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": {
|
|
@@ -823,7 +823,7 @@
|
|
|
823
823
|
"yaml": "^2.9.0",
|
|
824
824
|
"yjs": "^13.6.33",
|
|
825
825
|
"zod": "^4.3.6",
|
|
826
|
-
"@agent-native/agentkit": "^0.
|
|
826
|
+
"@agent-native/agentkit": "^0.233.0-nightly-20261124004026",
|
|
827
827
|
"@agent-native/recap-cli": "^0.5.107"
|
|
828
828
|
},
|
|
829
829
|
"devDependencies": {
|
|
@@ -898,7 +898,7 @@
|
|
|
898
898
|
"xlsx": "^0.18.5"
|
|
899
899
|
},
|
|
900
900
|
"peerDependencies": {
|
|
901
|
-
"@agent-native/core-corpus": "
|
|
901
|
+
"@agent-native/core-corpus": "0.233.0-nightly-20261124004026",
|
|
902
902
|
"@ai-sdk/anthropic": ">=3",
|
|
903
903
|
"@ai-sdk/cohere": ">=3",
|
|
904
904
|
"@ai-sdk/google": ">=3",
|
|
@@ -217,6 +217,7 @@ Everything else — CRUD, settings, search, list/detail reads, auth state, anyth
|
|
|
217
217
|
- **Do** validate inputs before the first write. A rejection raised before any write the framework can see is "nothing saved", so the agent can fix its request and retry. Don't reorder code just to add labels. See *Failed Writes*.
|
|
218
218
|
- **Do** render `actionErrorMessage(error) ?? yourCopy` in UI, never bare `error.message`. The message keeps an `Action <name> failed:` prefix that belongs in a console, so a toast built from it reads "Action update-brand-kit failed: That name is taken." The helper returns only what the action wrote, and `undefined` when nothing did (network drop, proxy HTML page), which is why the fallback is not optional.
|
|
219
219
|
- **Do** pass a real `errorCode` when the agent should branch on the failure rather than re-read it. Codes other than the default `action_failed` are appended to the tool result as `(errorCode: not_found)`, on both the in-app agent and MCP. `details` follow as an `Error details: {...}` JSON line, and as `structuredContent.error` over MCP, capped at 2,000 characters, so keep them to what the agent acts on next: ids, limits, field names. The status never reaches either.
|
|
220
|
+
- **Do** set `automatic: true` on a write the app makes with no user gesture behind it: on load, on mount, on a timer, or experiment and usage bookkeeping. Its action events then say `action_kind: "automatic"` instead of `"write"`, so it is not counted as product use. Only a call from the app's own UI can be automatic; a call from an agent, an MCP client, or the CLI stays `"write"`. When only some UI calls are automatic, pass a predicate of the input and the call's context instead (a background sync that is automatic unless a refresh button forces it). A call the action's `planMode` declares a read already says `"read"`. Never set `readOnly` on a write to keep it out of analytics.
|
|
220
221
|
- **Don't** re-export actions as REST — `/_agent-native/actions/:name` is already the REST surface; duplicating it under `/api/*` hides the operation from agents.
|
|
221
222
|
- **Don't** reach for provider integrations, `authorize`, `needsApproval`, or `_agentImages` without checking `references/` first — each has sharp edges covered there, not here.
|
|
222
223
|
|
|
@@ -25,17 +25,23 @@ order and decisions; use the edit-point reference for the scaffold you have.
|
|
|
25
25
|
|
|
26
26
|
## 1. Orient
|
|
27
27
|
|
|
28
|
-
Read `AGENTS.md`, `DESIGN.md` if present, and `app-quality-bar`.
|
|
29
|
-
|
|
28
|
+
Read `AGENTS.md`, `DESIGN.md` if present, `product-judgment`, and `app-quality-bar`.
|
|
29
|
+
Run `product-judgment` Step 0 before writing code: grep `packages/core` and
|
|
30
|
+
`@agent-native/toolkit/craft` (plus `agent-native-toolkit` kits) so you reuse
|
|
31
|
+
existing primitives instead of rebuilding state boundaries, shortcut managers,
|
|
32
|
+
destructive dialogs, or optimistic hooks. Inspect the closest existing screen or
|
|
33
|
+
action and the files you will edit. Use the bundled docs/source commands in
|
|
30
34
|
`AGENTS.md` only to answer a concrete API question; do not web-research
|
|
31
35
|
framework APIs.
|
|
32
36
|
|
|
33
37
|
## 2. Decide
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
Run `product-judgment` Steps 1–2 before writing code: choose one or two
|
|
40
|
+
interaction patterns, write or update `DESIGN.md` as the single required design
|
|
41
|
+
contract with the 6-Axis Judgment Card and 3-Option Decision Block (chosen and
|
|
42
|
+
rejected UX options), and register `app.manifest.ts` with real screens,
|
|
43
|
+
entities, `viewPolicy`, and `suggestableCapabilities`. Choose these six things
|
|
44
|
+
before writing code:
|
|
39
45
|
|
|
40
46
|
1. **Slice**: the one workflow that proves the app. For a booking app: create a
|
|
41
47
|
booking, reject an overlap, cancel, weekly grid per room. Name what you are
|
|
@@ -119,16 +125,26 @@ The access table, the concurrency pattern, and the security rules are in
|
|
|
119
125
|
- Load and write data with `useActionQuery` and `useActionMutation` from
|
|
120
126
|
`@agent-native/core/client/hooks`. No `fetch`, and no `/api/*` routes for app
|
|
121
127
|
data. Those routes are only for uploads, webhooks, OAuth callbacks, and streaming.
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
`
|
|
128
|
+
- Use `@agent-native/toolkit/craft` primitives by default:
|
|
129
|
+
- `ResourceStateBoundary` for every async surface (requires a layout-matched
|
|
130
|
+
`skeleton`, an actionable `empty` CTA, and an `error` retry path — never a
|
|
131
|
+
spinner, bare `"Loading…"`, or dead-end `"Could not load"` screen).
|
|
132
|
+
- `useOptimisticAction` (or `onMutate` + `setQueryData` with `onError`
|
|
133
|
+
rollback and `toast.error(actionErrorMessage(error) ?? "<fallback>")`) so
|
|
134
|
+
writes acknowledge in `<100ms` and show a pending state within `<400ms`.
|
|
135
|
+
- `SafeDestructiveAction` for destructive verbs: instant optimistic action +
|
|
136
|
+
undo affordance when reversible, accessible `AlertDialog` confirmation when
|
|
137
|
+
irreversible — never `window.confirm`, `alert`, or `prompt`.
|
|
138
|
+
- `useCommandRegistry` for portable `Mod` (`Cmd`/`Ctrl`) shortcuts, `j`/`k`,
|
|
139
|
+
`Esc`, and `?` shortcut help that automatically ignore editable inputs.
|
|
140
|
+
- Style with semantic tokens from `@agent-native/toolkit/styles.css` (which
|
|
141
|
+
bundles `craft-tokens.css`: `--success`/`--warning`/`--info`, `--surface-0..3`,
|
|
142
|
+
`--density-*`, `--dur-instant`/`--dur-fast`/`--dur-panel`, `tabular-nums`, and
|
|
143
|
+
`640px` chat-companion `@container` utilities).
|
|
127
144
|
- Import controls from `@/components/ui/*`. When one is missing (dialog,
|
|
128
145
|
select, skeleton, alert-dialog), add a one-line re-export like `button.tsx`:
|
|
129
146
|
`export * from "@agent-native/toolkit/ui/dialog";`.
|
|
130
|
-
- Use Tabler icons only.
|
|
131
|
-
`alert`, or `prompt`.
|
|
147
|
+
- Use Tabler icons only.
|
|
132
148
|
- Don't add a page title that repeats the nav item, a subtitle under a title,
|
|
133
149
|
or a stats strip. The data is the page. For visual direction, see `frontend-design`.
|
|
134
150
|
- Follow the app's existing localization pattern for user-facing copy.
|
|
@@ -175,10 +191,13 @@ made from a stale view. See `real-time-sync`.
|
|
|
175
191
|
message; read back the saved state through the matching list/get action.
|
|
176
192
|
The CLI prints the failure message, not its structured `errorCode`, so also
|
|
177
193
|
verify any code-specific behavior in the action contract or browser.
|
|
178
|
-
4.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
review
|
|
194
|
+
4. Run the `$0` static craft audit (`pnpm tsx scripts/guard-craft-slop.ts <app-dir>`)
|
|
195
|
+
and review the 5 Human-Team Lenses from `product-judgment` before capturing
|
|
196
|
+
screenshots. Then apply the canonical 12-row visual rubric and capture loop
|
|
197
|
+
from `skills/turn-into-app/references/review-loop.md` and
|
|
198
|
+
`app-quality-bar/visual-review.md`. Give the screenshots, rubric, and brief to
|
|
199
|
+
a blind reviewer and use the lower score per row. Fix and recapture until the
|
|
200
|
+
review passes (mean >= 4.0, every row >= 3, zero automatic fails).
|
|
182
201
|
5. Run the 60-second automated Playwright walkthrough from `app-quality-bar`.
|
|
183
202
|
Cover empty, populated, split pane at 520 px or narrower, and error
|
|
184
203
|
recovery. Click every navigation item, create and edit, reload and verify
|
|
@@ -197,6 +216,8 @@ check you didn't run.
|
|
|
197
216
|
|
|
198
217
|
## Related
|
|
199
218
|
|
|
219
|
+
- `product-judgment`: 5-step pre-flight (primitive inventory, 6-Axis Judgment
|
|
220
|
+
Card, 3-Option Decision Block, 5 Human-Team Lenses, and escalation boundary).
|
|
200
221
|
- `adding-a-feature`: the feature checklist for each later feature in this app.
|
|
201
222
|
- `frontend-design`, `actions`, `sharing`, `real-time-sync`, and `security`:
|
|
202
223
|
go deeper on one area when the references aren't enough.
|
|
@@ -52,8 +52,9 @@ presentation seam.
|
|
|
52
52
|
|
|
53
53
|
Use the app's existing field components and validation pattern. Associate
|
|
54
54
|
errors with their inputs and expose invalid state to assistive technology.
|
|
55
|
-
Icon-only actions need an accessible name and a usable focus target. Use
|
|
56
|
-
|
|
55
|
+
Icon-only actions need an accessible name and a usable focus target. Use Tabler
|
|
56
|
+
Icons (`@tabler/icons-react`) for UI icons, except in Design, which uses Radix
|
|
57
|
+
Icons (`@radix-ui/react-icons`).
|
|
57
58
|
|
|
58
59
|
Do not recreate menus, popovers, dialogs, or confirmations with absolute
|
|
59
60
|
positioning and custom click-outside handlers. Never use browser `alert`,
|
|
@@ -217,6 +217,7 @@ Everything else — CRUD, settings, search, list/detail reads, auth state, anyth
|
|
|
217
217
|
- **Do** validate inputs before the first write. A rejection raised before any write the framework can see is "nothing saved", so the agent can fix its request and retry. Don't reorder code just to add labels. See *Failed Writes*.
|
|
218
218
|
- **Do** render `actionErrorMessage(error) ?? yourCopy` in UI, never bare `error.message`. The message keeps an `Action <name> failed:` prefix that belongs in a console, so a toast built from it reads "Action update-brand-kit failed: That name is taken." The helper returns only what the action wrote, and `undefined` when nothing did (network drop, proxy HTML page), which is why the fallback is not optional.
|
|
219
219
|
- **Do** pass a real `errorCode` when the agent should branch on the failure rather than re-read it. Codes other than the default `action_failed` are appended to the tool result as `(errorCode: not_found)`, on both the in-app agent and MCP. `details` follow as an `Error details: {...}` JSON line, and as `structuredContent.error` over MCP, capped at 2,000 characters, so keep them to what the agent acts on next: ids, limits, field names. The status never reaches either.
|
|
220
|
+
- **Do** set `automatic: true` on a write the app makes with no user gesture behind it: on load, on mount, on a timer, or experiment and usage bookkeeping. Its action events then say `action_kind: "automatic"` instead of `"write"`, so it is not counted as product use. Only a call from the app's own UI can be automatic; a call from an agent, an MCP client, or the CLI stays `"write"`. When only some UI calls are automatic, pass a predicate of the input and the call's context instead (a background sync that is automatic unless a refresh button forces it). A call the action's `planMode` declares a read already says `"read"`. Never set `readOnly` on a write to keep it out of analytics.
|
|
220
221
|
- **Don't** re-export actions as REST — `/_agent-native/actions/:name` is already the REST surface; duplicating it under `/api/*` hides the operation from agents.
|
|
221
222
|
- **Don't** reach for provider integrations, `authorize`, `needsApproval`, or `_agentImages` without checking `references/` first — each has sharp edges covered there, not here.
|
|
222
223
|
|
|
@@ -25,17 +25,23 @@ order and decisions; use the edit-point reference for the scaffold you have.
|
|
|
25
25
|
|
|
26
26
|
## 1. Orient
|
|
27
27
|
|
|
28
|
-
Read `AGENTS.md`, `DESIGN.md` if present, and `app-quality-bar`.
|
|
29
|
-
|
|
28
|
+
Read `AGENTS.md`, `DESIGN.md` if present, `product-judgment`, and `app-quality-bar`.
|
|
29
|
+
Run `product-judgment` Step 0 before writing code: grep `packages/core` and
|
|
30
|
+
`@agent-native/toolkit/craft` (plus `agent-native-toolkit` kits) so you reuse
|
|
31
|
+
existing primitives instead of rebuilding state boundaries, shortcut managers,
|
|
32
|
+
destructive dialogs, or optimistic hooks. Inspect the closest existing screen or
|
|
33
|
+
action and the files you will edit. Use the bundled docs/source commands in
|
|
30
34
|
`AGENTS.md` only to answer a concrete API question; do not web-research
|
|
31
35
|
framework APIs.
|
|
32
36
|
|
|
33
37
|
## 2. Decide
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
Run `product-judgment` Steps 1–2 before writing code: choose one or two
|
|
40
|
+
interaction patterns, write or update `DESIGN.md` as the single required design
|
|
41
|
+
contract with the 6-Axis Judgment Card and 3-Option Decision Block (chosen and
|
|
42
|
+
rejected UX options), and register `app.manifest.ts` with real screens,
|
|
43
|
+
entities, `viewPolicy`, and `suggestableCapabilities`. Choose these six things
|
|
44
|
+
before writing code:
|
|
39
45
|
|
|
40
46
|
1. **Slice**: the one workflow that proves the app. For a booking app: create a
|
|
41
47
|
booking, reject an overlap, cancel, weekly grid per room. Name what you are
|
|
@@ -119,16 +125,26 @@ The access table, the concurrency pattern, and the security rules are in
|
|
|
119
125
|
- Load and write data with `useActionQuery` and `useActionMutation` from
|
|
120
126
|
`@agent-native/core/client/hooks`. No `fetch`, and no `/api/*` routes for app
|
|
121
127
|
data. Those routes are only for uploads, webhooks, OAuth callbacks, and streaming.
|
|
122
|
-
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
`
|
|
128
|
+
- Use `@agent-native/toolkit/craft` primitives by default:
|
|
129
|
+
- `ResourceStateBoundary` for every async surface (requires a layout-matched
|
|
130
|
+
`skeleton`, an actionable `empty` CTA, and an `error` retry path — never a
|
|
131
|
+
spinner, bare `"Loading…"`, or dead-end `"Could not load"` screen).
|
|
132
|
+
- `useOptimisticAction` (or `onMutate` + `setQueryData` with `onError`
|
|
133
|
+
rollback and `toast.error(actionErrorMessage(error) ?? "<fallback>")`) so
|
|
134
|
+
writes acknowledge in `<100ms` and show a pending state within `<400ms`.
|
|
135
|
+
- `SafeDestructiveAction` for destructive verbs: instant optimistic action +
|
|
136
|
+
undo affordance when reversible, accessible `AlertDialog` confirmation when
|
|
137
|
+
irreversible — never `window.confirm`, `alert`, or `prompt`.
|
|
138
|
+
- `useCommandRegistry` for portable `Mod` (`Cmd`/`Ctrl`) shortcuts, `j`/`k`,
|
|
139
|
+
`Esc`, and `?` shortcut help that automatically ignore editable inputs.
|
|
140
|
+
- Style with semantic tokens from `@agent-native/toolkit/styles.css` (which
|
|
141
|
+
bundles `craft-tokens.css`: `--success`/`--warning`/`--info`, `--surface-0..3`,
|
|
142
|
+
`--density-*`, `--dur-instant`/`--dur-fast`/`--dur-panel`, `tabular-nums`, and
|
|
143
|
+
`640px` chat-companion `@container` utilities).
|
|
127
144
|
- Import controls from `@/components/ui/*`. When one is missing (dialog,
|
|
128
145
|
select, skeleton, alert-dialog), add a one-line re-export like `button.tsx`:
|
|
129
146
|
`export * from "@agent-native/toolkit/ui/dialog";`.
|
|
130
|
-
- Use Tabler icons only.
|
|
131
|
-
`alert`, or `prompt`.
|
|
147
|
+
- Use Tabler icons only.
|
|
132
148
|
- Don't add a page title that repeats the nav item, a subtitle under a title,
|
|
133
149
|
or a stats strip. The data is the page. For visual direction, see `frontend-design`.
|
|
134
150
|
- Follow the app's existing localization pattern for user-facing copy.
|
|
@@ -175,10 +191,13 @@ made from a stale view. See `real-time-sync`.
|
|
|
175
191
|
message; read back the saved state through the matching list/get action.
|
|
176
192
|
The CLI prints the failure message, not its structured `errorCode`, so also
|
|
177
193
|
verify any code-specific behavior in the action contract or browser.
|
|
178
|
-
4.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
review
|
|
194
|
+
4. Run the `$0` static craft audit (`pnpm tsx scripts/guard-craft-slop.ts <app-dir>`)
|
|
195
|
+
and review the 5 Human-Team Lenses from `product-judgment` before capturing
|
|
196
|
+
screenshots. Then apply the canonical 12-row visual rubric and capture loop
|
|
197
|
+
from `skills/turn-into-app/references/review-loop.md` and
|
|
198
|
+
`app-quality-bar/visual-review.md`. Give the screenshots, rubric, and brief to
|
|
199
|
+
a blind reviewer and use the lower score per row. Fix and recapture until the
|
|
200
|
+
review passes (mean >= 4.0, every row >= 3, zero automatic fails).
|
|
182
201
|
5. Run the 60-second automated Playwright walkthrough from `app-quality-bar`.
|
|
183
202
|
Cover empty, populated, split pane at 520 px or narrower, and error
|
|
184
203
|
recovery. Click every navigation item, create and edit, reload and verify
|
|
@@ -197,6 +216,8 @@ check you didn't run.
|
|
|
197
216
|
|
|
198
217
|
## Related
|
|
199
218
|
|
|
219
|
+
- `product-judgment`: 5-step pre-flight (primitive inventory, 6-Axis Judgment
|
|
220
|
+
Card, 3-Option Decision Block, 5 Human-Team Lenses, and escalation boundary).
|
|
200
221
|
- `adding-a-feature`: the feature checklist for each later feature in this app.
|
|
201
222
|
- `frontend-design`, `actions`, `sharing`, `real-time-sync`, and `security`:
|
|
202
223
|
go deeper on one area when the references aren't enough.
|
|
@@ -52,8 +52,9 @@ presentation seam.
|
|
|
52
52
|
|
|
53
53
|
Use the app's existing field components and validation pattern. Associate
|
|
54
54
|
errors with their inputs and expose invalid state to assistive technology.
|
|
55
|
-
Icon-only actions need an accessible name and a usable focus target. Use
|
|
56
|
-
|
|
55
|
+
Icon-only actions need an accessible name and a usable focus target. Use Tabler
|
|
56
|
+
Icons (`@tabler/icons-react`) for UI icons, except in Design, which uses Radix
|
|
57
|
+
Icons (`@radix-ui/react-icons`).
|
|
57
58
|
|
|
58
59
|
Do not recreate menus, popovers, dialogs, or confirmations with absolute
|
|
59
60
|
positioning and custom click-outside handlers. Never use browser `alert`,
|
|
@@ -303,8 +303,9 @@ do not claim new roots.
|
|
|
303
303
|
never count. For a purely visual fix, before and after screenshots are
|
|
304
304
|
evidence, not automated proof: before merging, a human must open both and
|
|
305
305
|
confirm they show the reported change. Put the evidence under the report in
|
|
306
|
-
the PR's `Reports` section. A test-only change (
|
|
307
|
-
`.changeset/`) needs only `fix-proof: test-only
|
|
306
|
+
the PR's `Reports` section. A test-only or docs-only change (tests, docs
|
|
307
|
+
pages, optional `.changeset/`) needs only `fix-proof: test-only` or
|
|
308
|
+
`docs-only`.
|
|
308
309
|
- **Two misses, then stop guessing.** If two attempts don't turn the check
|
|
309
310
|
green, stop editing and capture the real failure first (stack, logs, the
|
|
310
311
|
reporter's actual data). If that doesn't settle it within about 30
|
|
@@ -217,6 +217,7 @@ Everything else — CRUD, settings, search, list/detail reads, auth state, anyth
|
|
|
217
217
|
- **Do** validate inputs before the first write. A rejection raised before any write the framework can see is "nothing saved", so the agent can fix its request and retry. Don't reorder code just to add labels. See *Failed Writes*.
|
|
218
218
|
- **Do** render `actionErrorMessage(error) ?? yourCopy` in UI, never bare `error.message`. The message keeps an `Action <name> failed:` prefix that belongs in a console, so a toast built from it reads "Action update-brand-kit failed: That name is taken." The helper returns only what the action wrote, and `undefined` when nothing did (network drop, proxy HTML page), which is why the fallback is not optional.
|
|
219
219
|
- **Do** pass a real `errorCode` when the agent should branch on the failure rather than re-read it. Codes other than the default `action_failed` are appended to the tool result as `(errorCode: not_found)`, on both the in-app agent and MCP. `details` follow as an `Error details: {...}` JSON line, and as `structuredContent.error` over MCP, capped at 2,000 characters, so keep them to what the agent acts on next: ids, limits, field names. The status never reaches either.
|
|
220
|
+
- **Do** set `automatic: true` on a write the app makes with no user gesture behind it: on load, on mount, on a timer, or experiment and usage bookkeeping. Its action events then say `action_kind: "automatic"` instead of `"write"`, so it is not counted as product use. Only a call from the app's own UI can be automatic; a call from an agent, an MCP client, or the CLI stays `"write"`. When only some UI calls are automatic, pass a predicate of the input and the call's context instead (a background sync that is automatic unless a refresh button forces it). A call the action's `planMode` declares a read already says `"read"`. Never set `readOnly` on a write to keep it out of analytics.
|
|
220
221
|
- **Don't** re-export actions as REST — `/_agent-native/actions/:name` is already the REST surface; duplicating it under `/api/*` hides the operation from agents.
|
|
221
222
|
- **Don't** reach for provider integrations, `authorize`, `needsApproval`, or `_agentImages` without checking `references/` first — each has sharp edges covered there, not here.
|
|
222
223
|
|
|
@@ -217,6 +217,7 @@ Everything else — CRUD, settings, search, list/detail reads, auth state, anyth
|
|
|
217
217
|
- **Do** validate inputs before the first write. A rejection raised before any write the framework can see is "nothing saved", so the agent can fix its request and retry. Don't reorder code just to add labels. See *Failed Writes*.
|
|
218
218
|
- **Do** render `actionErrorMessage(error) ?? yourCopy` in UI, never bare `error.message`. The message keeps an `Action <name> failed:` prefix that belongs in a console, so a toast built from it reads "Action update-brand-kit failed: That name is taken." The helper returns only what the action wrote, and `undefined` when nothing did (network drop, proxy HTML page), which is why the fallback is not optional.
|
|
219
219
|
- **Do** pass a real `errorCode` when the agent should branch on the failure rather than re-read it. Codes other than the default `action_failed` are appended to the tool result as `(errorCode: not_found)`, on both the in-app agent and MCP. `details` follow as an `Error details: {...}` JSON line, and as `structuredContent.error` over MCP, capped at 2,000 characters, so keep them to what the agent acts on next: ids, limits, field names. The status never reaches either.
|
|
220
|
+
- **Do** set `automatic: true` on a write the app makes with no user gesture behind it: on load, on mount, on a timer, or experiment and usage bookkeeping. Its action events then say `action_kind: "automatic"` instead of `"write"`, so it is not counted as product use. Only a call from the app's own UI can be automatic; a call from an agent, an MCP client, or the CLI stays `"write"`. When only some UI calls are automatic, pass a predicate of the input and the call's context instead (a background sync that is automatic unless a refresh button forces it). A call the action's `planMode` declares a read already says `"read"`. Never set `readOnly` on a write to keep it out of analytics.
|
|
220
221
|
- **Don't** re-export actions as REST — `/_agent-native/actions/:name` is already the REST surface; duplicating it under `/api/*` hides the operation from agents.
|
|
221
222
|
- **Don't** reach for provider integrations, `authorize`, `needsApproval`, or `_agentImages` without checking `references/` first — each has sharp edges covered there, not here.
|
|
222
223
|
|