@agent-native/core 0.59.0 → 0.59.1
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/client/AgentPanel.js +1 -1
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +8 -2
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +65 -12
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/extensions/ExtensionViewer.js +1 -1
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/notifications/NotificationsBell.d.ts +3 -1
- package/dist/client/notifications/NotificationsBell.d.ts.map +1 -1
- package/dist/client/notifications/NotificationsBell.js +7 -3
- package/dist/client/notifications/NotificationsBell.js.map +1 -1
- package/dist/org/auto-join-domain.d.ts +11 -3
- package/dist/org/auto-join-domain.d.ts.map +1 -1
- package/dist/org/auto-join-domain.js +7 -6
- package/dist/org/auto-join-domain.js.map +1 -1
- package/dist/org/context.d.ts.map +1 -1
- package/dist/org/context.js +68 -32
- package/dist/org/context.js.map +1 -1
- package/dist/org/migrations.d.ts.map +1 -1
- package/dist/org/migrations.js +6 -0
- package/dist/org/migrations.js.map +1 -1
- package/dist/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +9 -0
- package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +11 -1
- package/dist/vite/client.d.ts +2 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +121 -2
- package/dist/vite/client.js.map +1 -1
- package/docs/content/context-awareness.md +14 -2
- package/docs/content/creating-templates.md +6 -0
- package/package.json +1 -1
- package/src/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +9 -0
- package/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +11 -1
|
@@ -234,12 +234,17 @@ export function useNavigationState() {
|
|
|
234
234
|
selectedId: searchParams.get("id"),
|
|
235
235
|
}),
|
|
236
236
|
getCommandPath: (command: any) => command.path ?? "/",
|
|
237
|
+
navigateOptions: { replace: true, flushSync: true },
|
|
237
238
|
});
|
|
238
239
|
}
|
|
239
240
|
```
|
|
240
241
|
|
|
241
242
|
Keep shareable filters in URL query params. The framework exposes them to the agent as `<current-url>` and the built-in agent can change them with `set-search-params`; `navigation` should hold semantic IDs and aliases, not a second copy of the full query string.
|
|
242
243
|
|
|
244
|
+
For app navigation, prefer one `navigate` command that includes a same-origin
|
|
245
|
+
`path` when the URL is known. Do not also write `__set_url__` for the same move;
|
|
246
|
+
that key is reserved for the framework URL tools and URL-only filter changes.
|
|
247
|
+
|
|
243
248
|
```ts
|
|
244
249
|
// actions/navigate.ts
|
|
245
250
|
import { defineAction } from "@agent-native/core";
|
|
@@ -251,6 +256,7 @@ export default defineAction({
|
|
|
251
256
|
schema: z.object({
|
|
252
257
|
view: z.enum(["home", "project"]),
|
|
253
258
|
projectId: z.string().optional(),
|
|
259
|
+
path: z.string().optional(),
|
|
254
260
|
}),
|
|
255
261
|
run: async (args) => {
|
|
256
262
|
await writeAppState("navigate", args);
|
package/package.json
CHANGED
|
@@ -66,6 +66,15 @@ export default function Settings() {
|
|
|
66
66
|
|
|
67
67
|
If a page needs per-route data (e.g. sidebar highlighting the active document), derive it inside the layout from `useParams()` / `useLocation()` — don't pass it as a prop through every route file.
|
|
68
68
|
|
|
69
|
+
## Chat-First Routes
|
|
70
|
+
|
|
71
|
+
If `/` is a full-page chat such as `AgentChatHome`, keep the app shell mounted
|
|
72
|
+
around it when possible so `AgentSidebar` URL sync and route warmup stay active.
|
|
73
|
+
If the chat route intentionally lives outside the shell, add a tiny app-owned
|
|
74
|
+
prewarm for the routes agents commonly open from that chat. In local dev,
|
|
75
|
+
React Router can update the address bar before a cold Vite route chunk commits,
|
|
76
|
+
which makes navigation look broken even when the URL is correct.
|
|
77
|
+
|
|
69
78
|
## Adding a New Route
|
|
70
79
|
|
|
71
80
|
- **Pattern #1** (AppLayout in `root.tsx`): just render page content — nothing else.
|
|
@@ -125,6 +125,15 @@ await writeAppState("navigate", { view: "inbox", threadId: "abc123" });
|
|
|
125
125
|
**UI side** — use `useAgentRouteState`, shown above. It polls command keys,
|
|
126
126
|
dedupes `_writeId`, deletes consumed commands, and applies app-local routing.
|
|
127
127
|
|
|
128
|
+
When a destination has a real URL, let the `navigate` command carry that local
|
|
129
|
+
`path` (plus semantic fields when useful) and have the UI prefer `path` before
|
|
130
|
+
falling back to semantic routing. Keep app navigation single-channel: do not
|
|
131
|
+
also write `__set_url__` for the same navigation. `__set_url__` belongs to the
|
|
132
|
+
framework URL tools (`set-url-path`, `set-search-params`) and URL-only filter
|
|
133
|
+
changes. If a command can arrive while a chat stream is rendering, prefer
|
|
134
|
+
`navigate(path, { replace: true, flushSync: true })` over a view-transition
|
|
135
|
+
wrapper so the URL and visible route commit together.
|
|
136
|
+
|
|
128
137
|
## Jitter Prevention
|
|
129
138
|
|
|
130
139
|
When the agent writes to application-state via script helpers (`writeAppState`), the write is tagged with `requestSource: "agent"`. The UI uses the `ignoreSource` option on `useDbSync()` with a per-tab ID so it ignores its own writes while still picking up changes from agents, other tabs, and scripts.
|
|
@@ -171,7 +180,7 @@ The mail template demonstrates these patterns working together:
|
|
|
171
180
|
- Keep shareable filters in URL query params so `<current-url>` and `set-search-params` work
|
|
172
181
|
- Update `view-screen` when adding new features — it should return data for every view
|
|
173
182
|
- Use `useAgentRouteState` or `useSemanticNavigationState` for UI-side navigation sync and command consumption
|
|
174
|
-
- Use the one-shot `navigate` command pattern for
|
|
183
|
+
- Use the one-shot `navigate` command pattern for app navigation; include a same-origin `path` when the target URL is known
|
|
175
184
|
- Tag agent writes with `requestSource: "agent"` (the script helpers do this automatically)
|
|
176
185
|
|
|
177
186
|
## Don't
|
|
@@ -179,6 +188,7 @@ The mail template demonstrates these patterns working together:
|
|
|
179
188
|
- Don't assume the user is on a specific page — always check navigation state
|
|
180
189
|
- Don't hardcode navigation paths in scripts — read the current state and branch
|
|
181
190
|
- Don't write to the `navigation` key from the agent — it belongs to the UI. Use `navigate` instead.
|
|
191
|
+
- Don't write both `navigate` and `__set_url__` for one app navigation; competing consumers can make the browser URL change before React Router commits the page.
|
|
182
192
|
- Don't ignore the `<current-screen>` block — it tells you where the user is
|
|
183
193
|
- Don't duplicate whole URL query strings into `navigation` when `<current-url>` already exposes them
|
|
184
194
|
- Don't store fetched data in navigation state — it holds IDs and semantic UI state only. The `view-screen` script fetches the actual data.
|