@agent-native/core 0.168.11 → 0.168.12

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.
@@ -48,26 +48,51 @@ export function useOpenMobileSidebar() {
48
48
  const BARE_PREFIXES = ["/present/"];
49
49
 
50
50
  /**
51
- * Routes where the page renders its own toolbar instead of the global Header.
52
- * The Header is hidden so the page can supply richer custom chrome (e.g.
53
- * DesignEditor mode/zoom/device, shared ExtensionViewer / ExtensionsListPage
54
- * chrome). The editor owns its agent surface inside its Figma-style left rail.
51
+ * Routes where the page renders its own toolbar instead of the global Header
52
+ * on a standalone page. Embedded app surfaces keep the global shell so the
53
+ * host-provided chat rail can still be reopened from the app header.
55
54
  */
56
55
  const EDITOR_PREFIXES = ["/design/", "/visual-edit/", "/extensions"];
57
56
 
57
+ type DesignLayoutMode = "host-bare" | "standalone-editor" | "app-shell";
58
+
59
+ function resolveDesignLayoutMode(input: {
60
+ builderHostEmbed: boolean;
61
+ embedded: boolean;
62
+ hasSession: boolean;
63
+ isDesignEditor: boolean;
64
+ }): DesignLayoutMode {
65
+ if (
66
+ input.builderHostEmbed ||
67
+ (input.isDesignEditor && !input.hasSession && !input.embedded)
68
+ ) {
69
+ return "host-bare";
70
+ }
71
+ if (input.isDesignEditor && !input.embedded) return "standalone-editor";
72
+ return "app-shell";
73
+ }
74
+
58
75
  export function Layout({ children }: LayoutProps) {
59
76
  const location = useLocation();
60
77
  const t = useT();
61
78
  const { session } = useSession();
62
79
  const hasSession = Boolean(session?.email);
80
+ const builderHostEmbed = isBuilderHostEmbed();
63
81
  // The shell canvas is embedded without a session, so this cannot be the token
64
82
  // check alone or it renders Design's own nav inside Builder.
65
- const embedded = isBuilderHostEmbed() || isEmbedAuthActive();
83
+ const embedded = builderHostEmbed || isEmbedAuthActive();
66
84
  useNavigationState(hasSession);
67
85
  const [mobileSidebarOpen, setMobileSidebarOpen] = useState(false);
68
86
  const openMobileSidebar = useCallback(() => setMobileSidebarOpen(true), []);
69
87
  const isDesignEditor = isDesignEditorRoute(location.pathname);
70
- const showMobileTopBar = !isDesignEditor;
88
+ const layoutMode = resolveDesignLayoutMode({
89
+ builderHostEmbed,
90
+ embedded,
91
+ hasSession,
92
+ isDesignEditor,
93
+ });
94
+ const standaloneEditor = layoutMode === "standalone-editor";
95
+ const showMobileTopBar = !standaloneEditor;
71
96
  const browserTabId = getBrowserTabId();
72
97
  const {
73
98
  link: detectedFigmaComposerLink,
@@ -109,11 +134,10 @@ export function Layout({ children }: LayoutProps) {
109
134
  return <>{children}</>;
110
135
  }
111
136
 
112
- const hideHeader = EDITOR_PREFIXES.some((p) =>
113
- location.pathname.startsWith(p),
114
- );
137
+ const hideHeader =
138
+ !embedded && EDITOR_PREFIXES.some((p) => location.pathname.startsWith(p));
115
139
 
116
- if (embedded || (isDesignEditor && !hasSession)) {
140
+ if (layoutMode === "host-bare") {
117
141
  return (
118
142
  <HeaderActionsProvider>
119
143
  <MobileSidebarContext.Provider value={null}>
@@ -132,7 +156,7 @@ export function Layout({ children }: LayoutProps) {
132
156
  );
133
157
  }
134
158
 
135
- if (isDesignEditor) {
159
+ if (layoutMode === "standalone-editor") {
136
160
  return (
137
161
  <HeaderActionsProvider>
138
162
  <MobileSidebarContext.Provider value={null}>
@@ -151,7 +175,7 @@ export function Layout({ children }: LayoutProps) {
151
175
  return (
152
176
  <HeaderActionsProvider>
153
177
  <MobileSidebarContext.Provider
154
- value={isDesignEditor ? null : openMobileSidebar}
178
+ value={standaloneEditor ? null : openMobileSidebar}
155
179
  >
156
180
  <AgentSidebar
157
181
  position="right"
@@ -178,13 +202,13 @@ export function Layout({ children }: LayoutProps) {
178
202
  }
179
203
  >
180
204
  <div className="agent-layout-shell flex h-dvh w-full overflow-hidden bg-background text-foreground">
181
- {!isDesignEditor && mobileSidebarOpen && (
205
+ {!standaloneEditor && mobileSidebarOpen && (
182
206
  <div
183
207
  className="fixed inset-0 z-40 bg-black/50 md:hidden"
184
208
  onClick={() => setMobileSidebarOpen(false)}
185
209
  />
186
210
  )}
187
- {!isDesignEditor && (
211
+ {!standaloneEditor && (
188
212
  <div
189
213
  className={cn(
190
214
  "agent-layout-left-drawer fixed inset-y-0 start-0 z-50 transition-transform duration-200 ease-out md:static md:z-auto md:transition-none motion-reduce:transition-none",
@@ -62,11 +62,11 @@ export declare const postAwareness: import("h3").EventHandlerWithFetch<import("h
62
62
  error: string;
63
63
  states?: undefined;
64
64
  } | {
65
+ error?: undefined;
65
66
  states: {
66
67
  clientId: number;
67
68
  state: string;
68
69
  }[];
69
- error?: undefined;
70
70
  }>>;
71
71
  /**
72
72
  * GET /_agent-native/collab/:docId/users
@@ -77,9 +77,9 @@ export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("
77
77
  error: string;
78
78
  users?: undefined;
79
79
  } | {
80
+ error?: undefined;
80
81
  users: {
81
82
  clientId: number;
82
83
  lastSeen: number;
83
84
  }[];
84
- error?: undefined;
85
85
  }>>;
@@ -26,8 +26,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
26
26
  * Body: { update: string (base64), requestSource?: string }
27
27
  */
28
28
  export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
29
- ok?: undefined;
30
29
  error: string;
30
+ ok?: undefined;
31
31
  } | {
32
32
  error?: undefined;
33
33
  ok: boolean;
@@ -11,14 +11,14 @@
11
11
  * DELETE /_agent-native/notifications/:id — delete
12
12
  */
13
13
  export declare function createNotificationsHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<"" | import("./types.js").Notification[] | {
14
+ error?: undefined;
14
15
  count: number;
15
16
  updated?: undefined;
16
- error?: undefined;
17
17
  ok?: undefined;
18
18
  } | {
19
+ error?: undefined;
19
20
  count?: undefined;
20
21
  updated: number;
21
- error?: undefined;
22
22
  ok?: undefined;
23
23
  } | {
24
24
  count?: undefined;
@@ -26,8 +26,8 @@ export declare function createNotificationsHandler(): import("h3").EventHandlerW
26
26
  error: string;
27
27
  ok?: undefined;
28
28
  } | {
29
+ error?: undefined;
29
30
  count?: undefined;
30
31
  updated?: undefined;
31
- error?: undefined;
32
32
  ok: boolean;
33
33
  }>>;
@@ -41,16 +41,16 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
41
41
  thumbsUpRate: number;
42
42
  avgEvalScore: number;
43
43
  } | {
44
+ error?: undefined;
44
45
  summary: import("./types.js").TraceSummary;
45
46
  spans: import("./types.js").TraceSpan[];
46
47
  id?: undefined;
47
- error?: undefined;
48
48
  ok?: undefined;
49
49
  } | {
50
+ error?: undefined;
50
51
  summary?: undefined;
51
52
  spans?: undefined;
52
53
  id: string;
53
- error?: undefined;
54
54
  ok?: undefined;
55
55
  } | {
56
56
  summary?: undefined;
@@ -59,9 +59,9 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
59
59
  error: any;
60
60
  ok?: undefined;
61
61
  } | {
62
+ error?: undefined;
62
63
  summary?: undefined;
63
64
  spans?: undefined;
64
65
  id?: undefined;
65
- error?: undefined;
66
66
  ok: boolean;
67
67
  }>>;
@@ -48,8 +48,8 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
48
48
  }>;
49
49
  /** DELETE /_agent-native/resources/:id — delete a resource */
50
50
  export declare function handleDeleteResource(event: any): Promise<{
51
- ok?: undefined;
52
51
  error: string;
52
+ ok?: undefined;
53
53
  } | {
54
54
  error?: undefined;
55
55
  ok: boolean;
@@ -37,17 +37,17 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
37
37
  ok?: undefined;
38
38
  status?: undefined;
39
39
  } | {
40
+ error?: undefined;
40
41
  ok: boolean;
41
42
  status: string;
42
- error?: undefined;
43
43
  } | {
44
44
  ok?: undefined;
45
45
  error: string;
46
46
  removed?: undefined;
47
47
  } | {
48
+ error?: undefined;
48
49
  ok: boolean;
49
50
  removed: boolean;
50
- error?: undefined;
51
51
  }>>;
52
52
  /**
53
53
  * POST /_agent-native/secrets/:key/test — validate an optional candidate value
@@ -58,13 +58,13 @@ export declare function createTestSecretHandler(): import("h3").EventHandlerWith
58
58
  error: string;
59
59
  note?: undefined;
60
60
  } | {
61
+ error?: undefined;
61
62
  ok: boolean;
62
63
  note?: undefined;
63
- error?: undefined;
64
64
  } | {
65
+ error?: undefined;
65
66
  ok: boolean;
66
67
  note: string;
67
- error?: undefined;
68
68
  } | {
69
69
  note?: undefined;
70
70
  ok: boolean;
@@ -95,11 +95,11 @@ export interface AdHocSecretPayload {
95
95
  export declare function createAdHocSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<AdHocSecretPayload[] | {
96
96
  error: string;
97
97
  } | {
98
+ error?: undefined;
98
99
  ok: boolean;
99
100
  key: string;
100
- error?: undefined;
101
101
  } | {
102
+ error?: undefined;
102
103
  ok: boolean;
103
104
  removed: boolean;
104
- error?: undefined;
105
105
  }>>;
@@ -26,8 +26,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
26
26
  expiresAt?: undefined;
27
27
  ttlSeconds?: undefined;
28
28
  } | {
29
+ error?: undefined;
29
30
  token: string;
30
31
  expiresAt: string;
31
32
  ttlSeconds: number;
32
- error?: undefined;
33
33
  }>>;
@@ -20,6 +20,6 @@ export declare function createTranscribeVoiceHandler(): import("h3").EventHandle
20
20
  error: string;
21
21
  text?: undefined;
22
22
  } | {
23
- text: string;
24
23
  error?: undefined;
24
+ text: string;
25
25
  }>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.168.11",
3
+ "version": "0.168.12",
4
4
  "description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {