@agent-native/dispatch 0.26.0 → 0.27.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 (32) hide show
  1. package/dist/actions/provider-api-register.d.ts +12 -12
  2. package/dist/components/app-keys-popover.d.ts.map +1 -1
  3. package/dist/components/app-keys-popover.js +16 -9
  4. package/dist/components/app-keys-popover.js.map +1 -1
  5. package/dist/components/create-app-popover.d.ts.map +1 -1
  6. package/dist/components/create-app-popover.js +7 -1
  7. package/dist/components/create-app-popover.js.map +1 -1
  8. package/dist/components/layout/Layout.d.ts.map +1 -1
  9. package/dist/components/layout/Layout.js +14 -10
  10. package/dist/components/layout/Layout.js.map +1 -1
  11. package/dist/components/workspace-app-host.d.ts.map +1 -1
  12. package/dist/components/workspace-app-host.js +111 -12
  13. package/dist/components/workspace-app-host.js.map +1 -1
  14. package/dist/lib/workspace-apps.d.ts.map +1 -1
  15. package/dist/lib/workspace-apps.js +6 -2
  16. package/dist/lib/workspace-apps.js.map +1 -1
  17. package/dist/server/lib/vault-store.d.ts.map +1 -1
  18. package/dist/server/lib/vault-store.js +1 -1
  19. package/dist/server/lib/vault-store.js.map +1 -1
  20. package/package.json +3 -3
  21. package/src/components/app-keys-popover.spec.tsx +60 -2
  22. package/src/components/app-keys-popover.tsx +23 -10
  23. package/src/components/create-app-popover.spec.tsx +20 -0
  24. package/src/components/create-app-popover.tsx +7 -1
  25. package/src/components/layout/Layout.spec.tsx +27 -0
  26. package/src/components/layout/Layout.tsx +35 -30
  27. package/src/components/workspace-app-host.spec.tsx +129 -25
  28. package/src/components/workspace-app-host.tsx +163 -10
  29. package/src/lib/workspace-apps.spec.ts +51 -0
  30. package/src/lib/workspace-apps.ts +7 -2
  31. package/src/server/lib/vault-store.spec.ts +5 -3
  32. package/src/server/lib/vault-store.ts +5 -2
@@ -4,6 +4,7 @@ import {
4
4
  isDefaultWorkspaceAppHiddenId,
5
5
  isDispatchWorkspaceAppId,
6
6
  isWorkspaceAppVisibleInDefaultLaunchers,
7
+ mergeChatFirstWorkspaceApps,
7
8
  workspaceAppIdFromRoute,
8
9
  workspaceAppRoute,
9
10
  } from "./workspace-apps";
@@ -41,4 +42,54 @@ describe("workspace app routes", () => {
41
42
  ).toBe(false);
42
43
  expect(isWorkspaceAppVisibleInDefaultLaunchers({ id: "mail" })).toBe(true);
43
44
  });
45
+
46
+ it("maps default first-party apps to their canonical hosted origins", () => {
47
+ const apps = mergeChatFirstWorkspaceApps(undefined);
48
+ expect(apps).toEqual(
49
+ expect.arrayContaining([
50
+ expect.objectContaining({
51
+ id: "content",
52
+ path: "/",
53
+ url: "https://content.agent-native.com",
54
+ }),
55
+ expect.objectContaining({
56
+ id: "design",
57
+ path: "/",
58
+ url: "https://design.agent-native.com",
59
+ }),
60
+ expect.objectContaining({
61
+ id: "mail",
62
+ path: "/",
63
+ url: "https://mail.agent-native.com",
64
+ }),
65
+ expect.objectContaining({
66
+ id: "calendar",
67
+ path: "/",
68
+ url: "https://calendar.agent-native.com",
69
+ }),
70
+ expect.objectContaining({
71
+ id: "clips",
72
+ path: "/",
73
+ url: "https://clips.agent-native.com",
74
+ }),
75
+ ]),
76
+ );
77
+ });
78
+
79
+ it("lets a mounted workspace app override a default row", () => {
80
+ const apps = mergeChatFirstWorkspaceApps([
81
+ {
82
+ id: "mail",
83
+ name: "Internal Mail",
84
+ path: "/internal-mail",
85
+ url: null,
86
+ status: "ready",
87
+ },
88
+ ]);
89
+ expect(apps.find((app) => app.id === "mail")).toMatchObject({
90
+ name: "Internal Mail",
91
+ path: "/internal-mail",
92
+ url: null,
93
+ });
94
+ });
44
95
  });
@@ -1,6 +1,8 @@
1
1
  import { CHAT_FIRST_DEFAULT_APP_IDS } from "@agent-native/core/client/chat-first";
2
2
  import { withBuilderUtmTrackingParams } from "@agent-native/core/shared/builder-link-tracking";
3
3
 
4
+ import { CANONICAL_WORKSPACE_SSO_APP_ORIGINS } from "../shared/workspace-sso";
5
+
4
6
  export interface WorkspaceAppSummary {
5
7
  id: string;
6
8
  name: string;
@@ -169,8 +171,11 @@ export function mergeChatFirstWorkspaceApps(
169
171
  merged.set(id, {
170
172
  id,
171
173
  name: id.charAt(0).toUpperCase() + id.slice(1),
172
- path: `/${id}`,
173
- url: null,
174
+ // The five default rows are hosted sibling apps, not routes owned by
175
+ // Dispatch. Keep a mounted path for legacy callers, but give embed
176
+ // session resolution the exact canonical origin.
177
+ path: "/",
178
+ url: CANONICAL_WORKSPACE_SSO_APP_ORIGINS[id],
174
179
  status: "ready",
175
180
  });
176
181
  }
@@ -102,9 +102,11 @@ describe("vault authorization", () => {
102
102
  execute: vi.fn().mockResolvedValue({ rows: [{ role: "member" }] }),
103
103
  });
104
104
 
105
- await expect(assertCanManageVault()).rejects.toThrow(
106
- "Only organization owners and admins can manage the workspace vault.",
107
- );
105
+ await expect(assertCanManageVault()).rejects.toMatchObject({
106
+ message:
107
+ "Only organization owners and admins can manage the workspace vault.",
108
+ statusCode: 403,
109
+ });
108
110
  });
109
111
 
110
112
  it("rejects organization members before listing or reading grants", async () => {
@@ -173,8 +173,11 @@ export async function assertCanManageVault(): Promise<void> {
173
173
  }
174
174
 
175
175
  if (role !== "owner" && role !== "admin") {
176
- throw new Error(
177
- "Only organization owners and admins can manage the workspace vault.",
176
+ throw Object.assign(
177
+ new Error(
178
+ "Only organization owners and admins can manage the workspace vault.",
179
+ ),
180
+ { statusCode: 403 },
178
181
  );
179
182
  }
180
183
  }