@agent-native/core 0.58.5 → 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.
Files changed (57) hide show
  1. package/dist/client/AgentPanel.js +1 -1
  2. package/dist/client/AgentPanel.js.map +1 -1
  3. package/dist/client/AssistantChat.d.ts.map +1 -1
  4. package/dist/client/AssistantChat.js +12 -53
  5. package/dist/client/AssistantChat.js.map +1 -1
  6. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  7. package/dist/client/MultiTabAssistantChat.js +84 -88
  8. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  9. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  10. package/dist/client/agent-chat-adapter.js +65 -12
  11. package/dist/client/agent-chat-adapter.js.map +1 -1
  12. package/dist/client/agent-chat.d.ts +28 -0
  13. package/dist/client/agent-chat.d.ts.map +1 -1
  14. package/dist/client/agent-chat.js +84 -3
  15. package/dist/client/agent-chat.js.map +1 -1
  16. package/dist/client/chat/run-recovery.d.ts +2 -1
  17. package/dist/client/chat/run-recovery.d.ts.map +1 -1
  18. package/dist/client/chat/run-recovery.js +4 -2
  19. package/dist/client/chat/run-recovery.js.map +1 -1
  20. package/dist/client/extensions/ExtensionViewer.js +1 -1
  21. package/dist/client/extensions/ExtensionViewer.js.map +1 -1
  22. package/dist/client/index.d.ts +3 -1
  23. package/dist/client/index.d.ts.map +1 -1
  24. package/dist/client/index.js +3 -1
  25. package/dist/client/index.js.map +1 -1
  26. package/dist/client/notifications/NotificationsBell.d.ts +3 -1
  27. package/dist/client/notifications/NotificationsBell.d.ts.map +1 -1
  28. package/dist/client/notifications/NotificationsBell.js +7 -3
  29. package/dist/client/notifications/NotificationsBell.js.map +1 -1
  30. package/dist/client/terminal/AgentTerminal.d.ts.map +1 -1
  31. package/dist/client/terminal/AgentTerminal.js +6 -7
  32. package/dist/client/terminal/AgentTerminal.js.map +1 -1
  33. package/dist/client/use-agent-engine-configured.d.ts +16 -0
  34. package/dist/client/use-agent-engine-configured.d.ts.map +1 -0
  35. package/dist/client/use-agent-engine-configured.js +60 -0
  36. package/dist/client/use-agent-engine-configured.js.map +1 -0
  37. package/dist/org/auto-join-domain.d.ts +11 -3
  38. package/dist/org/auto-join-domain.d.ts.map +1 -1
  39. package/dist/org/auto-join-domain.js +7 -6
  40. package/dist/org/auto-join-domain.js.map +1 -1
  41. package/dist/org/context.d.ts.map +1 -1
  42. package/dist/org/context.js +68 -32
  43. package/dist/org/context.js.map +1 -1
  44. package/dist/org/migrations.d.ts.map +1 -1
  45. package/dist/org/migrations.js +6 -0
  46. package/dist/org/migrations.js.map +1 -1
  47. package/dist/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +9 -0
  48. package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +11 -1
  49. package/dist/vite/client.d.ts +2 -1
  50. package/dist/vite/client.d.ts.map +1 -1
  51. package/dist/vite/client.js +121 -2
  52. package/dist/vite/client.js.map +1 -1
  53. package/docs/content/context-awareness.md +14 -2
  54. package/docs/content/creating-templates.md +6 -0
  55. package/package.json +1 -1
  56. package/src/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +9 -0
  57. 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.58.5",
3
+ "version": "0.59.1",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -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 semantic agent-initiated navigation
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.