@agent-native/dispatch 0.27.17 → 0.27.21

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 (31) hide show
  1. package/dist/actions/create_workspace_app_embed_session.d.ts.map +1 -1
  2. package/dist/actions/create_workspace_app_embed_session.js +9 -1
  3. package/dist/actions/create_workspace_app_embed_session.js.map +1 -1
  4. package/dist/actions/provider-api-register.d.ts +2 -2
  5. package/dist/actions/view-screen.js +50 -1
  6. package/dist/actions/view-screen.js.map +1 -1
  7. package/dist/components/layout/Layout.d.ts.map +1 -1
  8. package/dist/components/layout/Layout.js +1 -1
  9. package/dist/components/layout/Layout.js.map +1 -1
  10. package/dist/hooks/use-navigation-state.d.ts +2 -0
  11. package/dist/hooks/use-navigation-state.d.ts.map +1 -1
  12. package/dist/hooks/use-navigation-state.js +18 -0
  13. package/dist/hooks/use-navigation-state.js.map +1 -1
  14. package/dist/shared/chat-first-pane.d.ts +8 -0
  15. package/dist/shared/chat-first-pane.d.ts.map +1 -0
  16. package/dist/shared/chat-first-pane.js +8 -0
  17. package/dist/shared/chat-first-pane.js.map +1 -0
  18. package/dist/shared/feature-flags.d.ts +2 -2
  19. package/dist/shared/feature-flags.d.ts.map +1 -1
  20. package/dist/shared/feature-flags.js +1 -1
  21. package/dist/shared/feature-flags.js.map +1 -1
  22. package/package.json +2 -2
  23. package/src/actions/create_workspace_app_embed_session.spec.ts +12 -0
  24. package/src/actions/create_workspace_app_embed_session.ts +11 -1
  25. package/src/actions/view-screen.spec.ts +93 -1
  26. package/src/actions/view-screen.ts +74 -1
  27. package/src/components/layout/Layout.tsx +1 -1
  28. package/src/hooks/use-navigation-state.spec.ts +33 -0
  29. package/src/hooks/use-navigation-state.ts +28 -1
  30. package/src/shared/chat-first-pane.ts +7 -0
  31. package/src/shared/feature-flags.ts +1 -1
@@ -16,10 +16,16 @@ import type {
16
16
  DispatchExtensionConfig,
17
17
  DispatchNavItem,
18
18
  } from "../components/index.js";
19
+ import {
20
+ workspaceAppIdFromRoute,
21
+ workspaceAppRoute,
22
+ } from "../lib/workspace-apps.js";
19
23
 
20
24
  export interface NavigationState {
21
25
  view: string;
22
26
  path?: string;
27
+ workspaceAppId?: string;
28
+ workspaceAppPath?: string;
23
29
  extensionId?: string;
24
30
  extensionSlug?: string;
25
31
  dreamId?: string;
@@ -153,6 +159,14 @@ export function buildDispatchNavigationState(
153
159
  return state;
154
160
  }
155
161
 
162
+ if (state.view === "workspace-app") {
163
+ const workspaceAppId = workspaceAppIdFromRoute(pathname);
164
+ if (workspaceAppId) {
165
+ state.workspaceAppId = workspaceAppId;
166
+ state.workspaceAppPath = pathname.replace(/^\/apps\/[^/]+/, "") || "/";
167
+ }
168
+ }
169
+
156
170
  if (state.view === "dreams") {
157
171
  const params = new URLSearchParams(search);
158
172
  const dreamId = params.get("dreamId");
@@ -265,6 +279,12 @@ function resolveView(
265
279
  }
266
280
  if (pathname.startsWith("/browser-chat")) return "browser-chat";
267
281
  if (pathname.startsWith("/chat")) return "chat";
282
+ // A route below /apps/ always embeds one app, so it must not collapse to the
283
+ // apps list. An id that fails to decode still resolves here without a
284
+ // `workspaceAppId`, which view-screen reports as an unknown app.
285
+ if (pathname.startsWith("/apps/") && pathname !== "/apps/") {
286
+ return "workspace-app";
287
+ }
268
288
  if (pathname.startsWith("/apps")) return "apps";
269
289
  if (pathname.startsWith("/operations")) return "operations";
270
290
  if (pathname.startsWith("/metrics")) return "metrics";
@@ -291,7 +311,10 @@ function resolveView(
291
311
  function resolvePath(
292
312
  view?: string,
293
313
  extensions?: DispatchExtensionConfig,
294
- command?: Pick<NavigationState, "extensionId" | "threadId">,
314
+ command?: Pick<
315
+ NavigationState,
316
+ "extensionId" | "threadId" | "workspaceAppId"
317
+ >,
295
318
  ): string | undefined {
296
319
  switch (view) {
297
320
  case "admin":
@@ -305,6 +328,10 @@ function resolvePath(
305
328
  return "/overview";
306
329
  case "apps":
307
330
  return "/apps";
331
+ case "workspace-app":
332
+ return command?.workspaceAppId
333
+ ? workspaceAppRoute(command.workspaceAppId)
334
+ : "/apps";
308
335
  case "operations":
309
336
  case "monitoring":
310
337
  case "observability":
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Application-state key holding the workspace app the chat-first shell has on
3
+ * screen. In chat-first mode the app opens as a surface tab while the route
4
+ * stays on /chat, so this key is the only signal that names the open app.
5
+ * Written by the layout, read by view-screen — keep them on this one constant.
6
+ */
7
+ export const CHAT_FIRST_PANE_STATE_KEY = "chat-first-pane";
@@ -1,4 +1,4 @@
1
- import { defineFeatureFlag } from "@agent-native/core/feature-flags";
1
+ import { defineFeatureFlag } from "@agent-native/core/feature-flags/registry";
2
2
 
3
3
  /**
4
4
  * Browser-only rollout for app-scoped sessions in Dispatch panes. The server