@agent-native/core 0.210.0 → 0.210.1-nightly-20261020010058

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 (82) hide show
  1. package/dist/action.js +16 -1
  2. package/dist/agent/production-agent.d.ts +1 -0
  3. package/dist/agent/production-agent.js +2 -0
  4. package/dist/agent/reaped-run-thread.d.ts +1 -1
  5. package/dist/agent/reaped-run-thread.js +21 -6
  6. package/dist/agent/run-store.fencing.worker.js +58 -0
  7. package/dist/agent/run-store.js +7 -5
  8. package/dist/agent/run-thread-projector.d.ts +27 -0
  9. package/dist/agent/run-thread-projector.js +79 -0
  10. package/dist/agent/thread-data-builder.js +38 -13
  11. package/dist/automation/index.d.ts +1 -1
  12. package/dist/cli/create.d.ts +1 -1
  13. package/dist/cli/create.js +30 -27
  14. package/dist/cli/package-lifecycle.js +3 -2
  15. package/dist/cli/setup-agents.d.ts +5 -0
  16. package/dist/cli/setup-agents.js +91 -34
  17. package/dist/cli/skills.js +8 -14
  18. package/dist/cli/tar-command.d.ts +1 -0
  19. package/dist/cli/tar-command.js +9 -0
  20. package/dist/cli/template-baseline.js +6 -3
  21. package/dist/cli/template-sync.d.ts +2 -1
  22. package/dist/cli/template-sync.js +2 -1
  23. package/dist/client/agent-chat.d.ts +1 -0
  24. package/dist/client/agent-chat.js +1 -1
  25. package/dist/client/api-path.d.ts +1 -0
  26. package/dist/client/api-path.js +6 -0
  27. package/dist/client/chat/agentkit-agent-native.js +6 -2
  28. package/dist/client/chat/runtime.js +3 -0
  29. package/dist/client/use-agent-chat-context.js +6 -3
  30. package/dist/client/use-db-sync.js +3 -0
  31. package/dist/collab/awareness.d.ts +2 -2
  32. package/dist/collab/routes.d.ts +2 -2
  33. package/dist/deploy/immutable-assets.d.ts +1 -1
  34. package/dist/deploy/immutable-assets.js +1 -1
  35. package/dist/deploy/workspace-deploy.js +12 -5
  36. package/dist/file-upload/actions/upload-image.d.ts +3 -3
  37. package/dist/jobs/actions/manage-recurring-job.d.ts +1 -1
  38. package/dist/jobs/background-automation-runner.js +16 -7
  39. package/dist/mcp/build-server.js +5 -1
  40. package/dist/mcp/embed-app.js +84 -17
  41. package/dist/notifications/routes.d.ts +3 -3
  42. package/dist/observability/routes.d.ts +7 -7
  43. package/dist/org/actions/invite-organization-member.js +1 -0
  44. package/dist/org/actions/list-organization-members.js +1 -0
  45. package/dist/org/index.d.ts +1 -1
  46. package/dist/progress/routes.d.ts +1 -1
  47. package/dist/provider-api/actions/custom-provider-registration.d.ts +6 -6
  48. package/dist/provider-api/actions/provider-api.d.ts +8 -8
  49. package/dist/scripts/db/exec.js +18 -6
  50. package/dist/scripts/db/patch.js +20 -8
  51. package/dist/scripts/db/postgres-client.d.ts +2 -0
  52. package/dist/scripts/db/postgres-client.js +17 -1
  53. package/dist/scripts/db/query.js +7 -6
  54. package/dist/scripts/db/safety.js +2 -1
  55. package/dist/secrets/routes.d.ts +10 -10
  56. package/dist/server/agent-chat-plugin.js +17 -8
  57. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  58. package/dist/server/agent-engine-default-model-route.d.ts +1 -1
  59. package/dist/server/agent-teams.js +9 -3
  60. package/dist/server/framework-request-handler.js +19 -0
  61. package/dist/server/fusion-app.d.ts +7 -0
  62. package/dist/server/fusion-app.js +11 -2
  63. package/dist/templates/builder-code-starter/.agents/skills/actions/SKILL.md.patch +1 -1
  64. package/dist/templates/builder-code-starter/app/hooks/use-navigation-state.ts.patch +26 -45
  65. package/dist/templates/builder-code-starter/server/plugins/agent-chat.ts.patch +2 -1
  66. package/dist/templates/chat/.agents/skills/context-awareness/SKILL.md +5 -0
  67. package/dist/templates/chat/app/components/chat/ChatHomeRedirect.tsx +2 -2
  68. package/dist/templates/chat/app/hooks/use-navigation-state.ts +51 -22
  69. package/dist/templates/chat/server/plugins/agent-chat.ts +1 -0
  70. package/dist/templates/default/.agents/skills/context-awareness/SKILL.md +5 -0
  71. package/dist/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +5 -0
  72. package/dist/triggers/actions/manage-automation.d.ts +5 -5
  73. package/package.json +5 -5
  74. package/src/templates/builder-code-starter/.agents/skills/actions/SKILL.md.patch +1 -1
  75. package/src/templates/builder-code-starter/app/hooks/use-navigation-state.ts.patch +26 -45
  76. package/src/templates/builder-code-starter/server/plugins/agent-chat.ts.patch +2 -1
  77. package/src/templates/chat/.agents/skills/context-awareness/SKILL.md +5 -0
  78. package/src/templates/chat/app/components/chat/ChatHomeRedirect.tsx +2 -2
  79. package/src/templates/chat/app/hooks/use-navigation-state.ts +51 -22
  80. package/src/templates/chat/server/plugins/agent-chat.ts +1 -0
  81. package/src/templates/default/.agents/skills/context-awareness/SKILL.md +5 -0
  82. package/src/templates/workspace-core/.agents/skills/context-awareness/SKILL.md +5 -0
@@ -1,4 +1,4 @@
1
- import { appPath } from "@agent-native/core/client/api-path";
1
+ import { appPathFromLocalRoute } from "@agent-native/core/client/api-path";
2
2
  import { markAgentChatHomeHandoff } from "@agent-native/toolkit/app/chat/agentkit-chat/rail";
3
3
  import { useEffect, useRef, useState } from "react";
4
4
 
@@ -14,7 +14,7 @@ export default function ChatHomeRedirect() {
14
14
  handoffStartedRef.current = true;
15
15
  markAgentChatHomeHandoff("chat");
16
16
  try {
17
- window.location.replace(appPath(chatThreadPath(threadId)));
17
+ window.location.replace(appPathFromLocalRoute(chatThreadPath(threadId)));
18
18
  } catch (error) {
19
19
  handoffStartedRef.current = false;
20
20
  throw error;
@@ -1,4 +1,7 @@
1
- import { appBasePath, appPath } from "@agent-native/core/client/api-path";
1
+ import {
2
+ appBasePath,
3
+ appPathFromLocalRoute,
4
+ } from "@agent-native/core/client/api-path";
2
5
  import { useAgentRouteState } from "@agent-native/core/client/navigation";
3
6
 
4
7
  import {
@@ -11,8 +14,9 @@ import {
11
14
  import { TAB_ID } from "@/lib/tab-id";
12
15
 
13
16
  export interface NavigationState {
14
- view: string;
17
+ view?: string;
15
18
  path?: string;
19
+ publicPath?: string;
16
20
  threadId?: string;
17
21
  }
18
22
 
@@ -20,19 +24,54 @@ export function useNavigationState() {
20
24
  useAgentRouteState<NavigationState>({
21
25
  browserTabId: TAB_ID,
22
26
  requestSource: TAB_ID,
23
- getNavigationState: ({ pathname }) => {
24
- const threadId = threadIdFromPath(pathname);
25
- return {
26
- view: viewForPath(pathname),
27
- path: appPath(pathname),
28
- ...(threadId ? { threadId } : {}),
29
- };
30
- },
31
- getCommandPath: (command) =>
32
- routerPath(command.path || pathForCommand(command)),
27
+ getNavigationState: ({ pathname }) => navigationStateForPath(pathname),
28
+ getCommandPath: commandPathForNavigation,
33
29
  });
34
30
  }
35
31
 
32
+ export function commandPathForNavigation(command: NavigationState): string {
33
+ const fallbackPath = pathForCommand(command);
34
+ const path = typeof command?.path === "string" ? command.path : "";
35
+ if (!path) return fallbackPath;
36
+
37
+ const basePath = appBasePath();
38
+ if (!basePath) return path;
39
+
40
+ const suffixIndex = path.search(/[?#]/);
41
+ const pathname = suffixIndex === -1 ? path : path.slice(0, suffixIndex);
42
+ const suffix = suffixIndex === -1 ? "" : path.slice(suffixIndex);
43
+ const publicPath =
44
+ typeof command?.publicPath === "string" ? command.publicPath : "";
45
+ const publicPathSuffixIndex = publicPath.search(/[?#]/);
46
+ const declaredPublicPath =
47
+ publicPathSuffixIndex === -1
48
+ ? publicPath
49
+ : publicPath.slice(0, publicPathSuffixIndex);
50
+ const publicViewPath = appPathFromLocalRoute(pathForView(command?.view));
51
+ if (
52
+ matchesPathPrefix(pathname, basePath) &&
53
+ (matchesPathPrefix(pathname, publicViewPath) ||
54
+ (declaredPublicPath && declaredPublicPath === pathname))
55
+ ) {
56
+ return `${pathname.slice(basePath.length) || "/"}${suffix}`;
57
+ }
58
+ return path;
59
+ }
60
+
61
+ function matchesPathPrefix(pathname: string, prefix: string): boolean {
62
+ return pathname === prefix || pathname.startsWith(`${prefix}/`);
63
+ }
64
+
65
+ export function navigationStateForPath(pathname: string): NavigationState {
66
+ const threadId = threadIdFromPath(pathname);
67
+ return {
68
+ view: viewForPath(pathname),
69
+ path: pathname,
70
+ publicPath: appPathFromLocalRoute(pathname),
71
+ ...(threadId ? { threadId } : {}),
72
+ };
73
+ }
74
+
36
75
  function viewForPath(pathname: string): string {
37
76
  if (isChatPathname(pathname)) return "chat";
38
77
  if (pathname === HOME_PATH) return "home";
@@ -78,13 +117,3 @@ export function pathForCommand(command: any): string {
78
117
  typeof command?.threadId === "string" ? command.threadId.trim() : "";
79
118
  return threadId ? chatThreadPath(threadId) : path;
80
119
  }
81
-
82
- function routerPath(path: string): string {
83
- const basePath = appBasePath();
84
- if (!basePath) return path;
85
- if (path === basePath) return "/";
86
- if (path.startsWith(`${basePath}/`)) {
87
- return path.slice(basePath.length) || "/";
88
- }
89
- return path;
90
- }
@@ -16,6 +16,7 @@ const INITIAL_TOOL_NAMES = [
16
16
  export default createAgentChatPlugin({
17
17
  appId: "chat",
18
18
  actions: loadActionsFromStaticRegistry(actionsRegistry),
19
+ mcp: { connectorCatalog: [] },
19
20
  initialToolNames: INITIAL_TOOL_NAMES,
20
21
  resolveOrgId: async (event) => (await getOrgContext(event)).orgId,
21
22
  systemPrompt: `You are the Chat app agent.
@@ -196,6 +196,11 @@ changes. If a command can arrive while a chat stream is rendering, prefer
196
196
  `navigate(path, { replace: true, flushSync: true })` over a view-transition
197
197
  wrapper so the URL and visible route commit together.
198
198
 
199
+ Keep `path` router-local. A segment matching the app mount prefix remains part
200
+ of the local route unless a matching `view` route or explicit `publicPath`
201
+ identifies the mounted URL. Carry the mounted form separately in `publicPath`;
202
+ never infer that `path` is mounted from its prefix alone.
203
+
199
204
  ## Jitter Prevention
200
205
 
201
206
  Agent-side application-state writes are tagged with
@@ -196,6 +196,11 @@ changes. If a command can arrive while a chat stream is rendering, prefer
196
196
  `navigate(path, { replace: true, flushSync: true })` over a view-transition
197
197
  wrapper so the URL and visible route commit together.
198
198
 
199
+ Keep `path` router-local. A segment matching the app mount prefix remains part
200
+ of the local route unless a matching `view` route or explicit `publicPath`
201
+ identifies the mounted URL. Carry the mounted form separately in `publicPath`;
202
+ never infer that `path` is mounted from its prefix alone.
203
+
199
204
  ## Jitter Prevention
200
205
 
201
206
  Agent-side application-state writes are tagged with