@agent-native/dispatch 0.40.30-nightly-20261021064625 → 0.40.30
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.
- package/CHANGELOG.md +7 -47
- package/dist/actions/connect-external-agent.d.ts.map +1 -1
- package/dist/actions/connect-external-agent.js +12 -13
- package/dist/actions/connect-external-agent.js.map +1 -1
- package/dist/actions/create-workspace-resource.d.ts +13 -13
- package/dist/actions/delete-destination.d.ts +12 -12
- package/dist/actions/delete-workspace-resource.d.ts +13 -13
- package/dist/actions/import-agent.d.ts +13 -13
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +8 -0
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/inspect-connect-agent-card.d.ts +5 -0
- package/dist/actions/inspect-connect-agent-card.d.ts.map +1 -0
- package/dist/actions/inspect-connect-agent-card.js +15 -0
- package/dist/actions/inspect-connect-agent-card.js.map +1 -0
- package/dist/actions/install-curated-community-app.d.ts +36 -0
- package/dist/actions/install-curated-community-app.d.ts.map +1 -0
- package/dist/actions/install-curated-community-app.js +26 -0
- package/dist/actions/install-curated-community-app.js.map +1 -0
- package/dist/actions/list-connect-marketplace-apps.d.ts +3 -0
- package/dist/actions/list-connect-marketplace-apps.d.ts.map +1 -0
- package/dist/actions/list-connect-marketplace-apps.js +15 -0
- package/dist/actions/list-connect-marketplace-apps.js.map +1 -0
- package/dist/actions/list-connected-agents.d.ts +2 -0
- package/dist/actions/list-curated-community-apps.d.ts +3 -0
- package/dist/actions/list-curated-community-apps.d.ts.map +1 -0
- package/dist/actions/list-curated-community-apps.js +10 -0
- package/dist/actions/list-curated-community-apps.js.map +1 -0
- package/dist/actions/provider-api-register.d.ts +14 -14
- package/dist/actions/remix-workspace-template.d.ts +6 -0
- package/dist/actions/update-workspace-app-metadata.d.ts +1 -0
- package/dist/actions/update-workspace-app-metadata.js +26 -5
- package/dist/actions/update-workspace-app-metadata.js.map +1 -1
- package/dist/components/community-apps-section.d.ts +2 -0
- package/dist/components/community-apps-section.d.ts.map +1 -0
- package/dist/components/community-apps-section.js +90 -0
- package/dist/components/community-apps-section.js.map +1 -0
- package/dist/components/workspace-app-card.d.ts.map +1 -1
- package/dist/components/workspace-app-card.js +63 -9
- package/dist/components/workspace-app-card.js.map +1 -1
- package/dist/lib/connect-apps.d.ts +1 -2
- package/dist/lib/connect-apps.d.ts.map +1 -1
- package/dist/lib/connect-apps.js +41 -65
- package/dist/lib/connect-apps.js.map +1 -1
- package/dist/lib/workspace-apps.d.ts +1 -0
- package/dist/lib/workspace-apps.d.ts.map +1 -1
- package/dist/lib/workspace-apps.js.map +1 -1
- package/dist/routes/pages/apps.d.ts.map +1 -1
- package/dist/routes/pages/apps.js +2 -1
- package/dist/routes/pages/apps.js.map +1 -1
- package/dist/routes/pages/connect.d.ts.map +1 -1
- package/dist/routes/pages/connect.js +5 -7
- package/dist/routes/pages/connect.js.map +1 -1
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/lib/app-creation-store.d.ts +11 -1
- package/dist/server/lib/app-creation-store.d.ts.map +1 -1
- package/dist/server/lib/app-creation-store.js +258 -39
- package/dist/server/lib/app-creation-store.js.map +1 -1
- package/dist/server/lib/community-apps.d.ts +45 -0
- package/dist/server/lib/community-apps.d.ts.map +1 -0
- package/dist/server/lib/community-apps.js +267 -0
- package/dist/server/lib/community-apps.js.map +1 -0
- package/dist/server/lib/community-source.d.ts +19 -0
- package/dist/server/lib/community-source.d.ts.map +1 -0
- package/dist/server/lib/community-source.js +118 -0
- package/dist/server/lib/community-source.js.map +1 -0
- package/dist/server/lib/connect-apps.d.ts +4 -0
- package/dist/server/lib/connect-apps.d.ts.map +1 -0
- package/dist/server/lib/connect-apps.js +99 -0
- package/dist/server/lib/connect-apps.js.map +1 -0
- package/dist/server/lib/org-apps-directory-cache.d.ts +20 -0
- package/dist/server/lib/org-apps-directory-cache.d.ts.map +1 -0
- package/dist/server/lib/org-apps-directory-cache.js +44 -0
- package/dist/server/lib/org-apps-directory-cache.js.map +1 -0
- package/dist/server/plugins/integrations.js +3 -3
- package/dist/server/plugins/integrations.js.map +1 -1
- package/dist/shared/labs.d.ts +2 -0
- package/dist/shared/labs.d.ts.map +1 -0
- package/dist/shared/labs.js +8 -0
- package/dist/shared/labs.js.map +1 -0
- package/package.json +5 -4
- package/src/actions/connect-external-agent.spec.ts +101 -3
- package/src/actions/connect-external-agent.ts +12 -11
- package/src/actions/index.spec.ts +13 -0
- package/src/actions/index.ts +8 -0
- package/src/actions/inspect-connect-agent-card.ts +17 -0
- package/src/actions/install-curated-community-app.ts +32 -0
- package/src/actions/list-connect-marketplace-apps.ts +17 -0
- package/src/actions/list-curated-community-apps.ts +12 -0
- package/src/actions/update-workspace-app-metadata.spec.ts +25 -0
- package/src/actions/update-workspace-app-metadata.ts +48 -24
- package/src/components/community-apps-section.tsx +224 -0
- package/src/components/workspace-app-card.spec.tsx +226 -1
- package/src/components/workspace-app-card.tsx +115 -12
- package/src/lib/connect-apps.spec.ts +118 -66
- package/src/lib/connect-apps.ts +47 -82
- package/src/lib/workspace-apps.ts +1 -0
- package/src/routes/pages/apps.spec.tsx +201 -1
- package/src/routes/pages/apps.tsx +3 -0
- package/src/routes/pages/connect.spec.tsx +53 -6
- package/src/routes/pages/connect.tsx +14 -11
- package/src/server/index.ts +9 -0
- package/src/server/lib/app-creation-store.spec.ts +539 -11
- package/src/server/lib/app-creation-store.ts +332 -41
- package/src/server/lib/community-apps.spec.ts +367 -0
- package/src/server/lib/community-apps.ts +372 -0
- package/src/server/lib/community-source.spec.ts +151 -0
- package/src/server/lib/community-source.ts +186 -0
- package/src/server/lib/connect-apps.ts +149 -0
- package/src/server/lib/org-apps-directory-cache.spec.ts +71 -0
- package/src/server/lib/org-apps-directory-cache.ts +66 -0
- package/src/server/plugins/integrations.spec.ts +60 -0
- package/src/server/plugins/integrations.ts +3 -3
- package/src/shared/labs.ts +9 -0
|
@@ -11,12 +11,18 @@ const queryState = vi.hoisted(() => ({
|
|
|
11
11
|
connectedApps: [] as Array<Record<string, unknown>>,
|
|
12
12
|
connectedAppsError: null as Error | null,
|
|
13
13
|
connectedAppsLoading: false,
|
|
14
|
+
communityAppsEnabled: false,
|
|
15
|
+
communityApps: [] as Array<Record<string, unknown>>,
|
|
16
|
+
installCommunityApp: vi.fn(),
|
|
17
|
+
installCommunityAppResult: null as Record<string, unknown> | null,
|
|
18
|
+
sendToAgentChat: vi.fn(),
|
|
14
19
|
}));
|
|
15
20
|
|
|
16
21
|
vi.mock("@agent-native/core/client/hooks", () => ({
|
|
17
22
|
useActionQuery: (action: string) => {
|
|
18
23
|
const workspaceApps = action === "list-workspace-apps";
|
|
19
24
|
const connectedApps = action === "list-connected-agents";
|
|
25
|
+
const communityApps = action === "list-curated-community-apps";
|
|
20
26
|
const error = workspaceApps
|
|
21
27
|
? queryState.workspaceAppsError
|
|
22
28
|
: connectedApps
|
|
@@ -27,7 +33,9 @@ vi.mock("@agent-native/core/client/hooks", () => ({
|
|
|
27
33
|
? queryState.workspaceApps
|
|
28
34
|
: connectedApps
|
|
29
35
|
? queryState.connectedApps
|
|
30
|
-
:
|
|
36
|
+
: communityApps
|
|
37
|
+
? queryState.communityApps
|
|
38
|
+
: { name: null, displayName: null, appCount: 0 },
|
|
31
39
|
error,
|
|
32
40
|
isError: Boolean(error),
|
|
33
41
|
isLoading: workspaceApps
|
|
@@ -38,6 +46,30 @@ vi.mock("@agent-native/core/client/hooks", () => ({
|
|
|
38
46
|
refetch: vi.fn(),
|
|
39
47
|
};
|
|
40
48
|
},
|
|
49
|
+
useActionMutation: (
|
|
50
|
+
_action: string,
|
|
51
|
+
options?: { onSuccess?: (result: Record<string, unknown>) => void },
|
|
52
|
+
) => ({
|
|
53
|
+
mutate: (input: unknown) => {
|
|
54
|
+
queryState.installCommunityApp(input);
|
|
55
|
+
if (queryState.installCommunityAppResult) {
|
|
56
|
+
options?.onSuccess?.(queryState.installCommunityAppResult);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
isPending: false,
|
|
60
|
+
}),
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
vi.mock("@agent-native/core/client/agent-chat", () => ({
|
|
64
|
+
sendToAgentChat: queryState.sendToAgentChat,
|
|
65
|
+
}));
|
|
66
|
+
|
|
67
|
+
vi.mock("@agent-native/core/client/labs", () => ({
|
|
68
|
+
useLab: () => queryState.communityAppsEnabled,
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
vi.mock("../../shared/labs.js", () => ({
|
|
72
|
+
COMMUNITY_APPS_LAB: { key: "dispatch.community-apps", defaultEnabled: false },
|
|
41
73
|
}));
|
|
42
74
|
|
|
43
75
|
vi.mock("@agent-native/core/client/i18n", () => ({
|
|
@@ -92,6 +124,11 @@ describe("Dispatch apps route", () => {
|
|
|
92
124
|
queryState.connectedApps = [];
|
|
93
125
|
queryState.connectedAppsError = null;
|
|
94
126
|
queryState.connectedAppsLoading = false;
|
|
127
|
+
queryState.communityAppsEnabled = false;
|
|
128
|
+
queryState.communityApps = [];
|
|
129
|
+
queryState.installCommunityApp.mockReset();
|
|
130
|
+
queryState.installCommunityAppResult = null;
|
|
131
|
+
queryState.sendToAgentChat.mockReset();
|
|
95
132
|
container = document.createElement("div");
|
|
96
133
|
document.body.appendChild(container);
|
|
97
134
|
root = createRoot(container);
|
|
@@ -129,4 +166,167 @@ describe("Dispatch apps route", () => {
|
|
|
129
166
|
|
|
130
167
|
expect(container.textContent).toContain("No workspace apps");
|
|
131
168
|
});
|
|
169
|
+
|
|
170
|
+
it("hides community apps while the Lab is off", async () => {
|
|
171
|
+
await renderAppsRoute();
|
|
172
|
+
|
|
173
|
+
expect(container.textContent).not.toContain("dispatch.pages.communityApps");
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it("lists the reviewed catalog and starts the selected install", async () => {
|
|
177
|
+
queryState.communityAppsEnabled = true;
|
|
178
|
+
queryState.communityApps = [
|
|
179
|
+
{
|
|
180
|
+
id: "community-qr",
|
|
181
|
+
name: "QR",
|
|
182
|
+
description: "Generate QR images.",
|
|
183
|
+
appId: "community-qr",
|
|
184
|
+
repo: "BuilderIO/agent-native",
|
|
185
|
+
ref: "main",
|
|
186
|
+
license: "MIT",
|
|
187
|
+
provenance: "Reviewed source",
|
|
188
|
+
templatePath: "templates/community/qr",
|
|
189
|
+
installed: false,
|
|
190
|
+
pending: false,
|
|
191
|
+
installable: true,
|
|
192
|
+
},
|
|
193
|
+
];
|
|
194
|
+
|
|
195
|
+
await renderAppsRoute();
|
|
196
|
+
|
|
197
|
+
expect(container.textContent).toContain("QR");
|
|
198
|
+
expect(
|
|
199
|
+
container.querySelector<HTMLAnchorElement>("a[href*='github.com']")?.href,
|
|
200
|
+
).toContain("/tree/main/templates/community/qr");
|
|
201
|
+
const installButton = Array.from(
|
|
202
|
+
container.querySelectorAll<HTMLButtonElement>("button"),
|
|
203
|
+
).find((button) =>
|
|
204
|
+
button.textContent?.includes("dispatch.pages.communityAppsInstall"),
|
|
205
|
+
);
|
|
206
|
+
expect(installButton).toBeDefined();
|
|
207
|
+
await act(async () => installButton?.click());
|
|
208
|
+
expect(queryState.installCommunityApp).toHaveBeenCalledWith({
|
|
209
|
+
sourceId: "community-qr",
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it("sends verified source files to the local code agent", async () => {
|
|
214
|
+
queryState.communityAppsEnabled = true;
|
|
215
|
+
queryState.communityApps = [
|
|
216
|
+
{
|
|
217
|
+
id: "community-qr",
|
|
218
|
+
name: "QR",
|
|
219
|
+
description: "Generate QR images.",
|
|
220
|
+
appId: "community-qr",
|
|
221
|
+
repo: "BuilderIO/agent-native",
|
|
222
|
+
ref: "main",
|
|
223
|
+
license: "MIT",
|
|
224
|
+
provenance: "Reviewed source",
|
|
225
|
+
templatePath: "templates/community/qr",
|
|
226
|
+
installed: false,
|
|
227
|
+
pending: false,
|
|
228
|
+
installable: true,
|
|
229
|
+
},
|
|
230
|
+
];
|
|
231
|
+
queryState.installCommunityAppResult = {
|
|
232
|
+
mode: "local-agent",
|
|
233
|
+
prompt: "Create this app from the pinned files.",
|
|
234
|
+
attachments: [
|
|
235
|
+
{
|
|
236
|
+
type: "file",
|
|
237
|
+
name: "community-qr/README.md",
|
|
238
|
+
contentType: "text/plain",
|
|
239
|
+
text: "Verified source",
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
await renderAppsRoute();
|
|
245
|
+
const installButton = Array.from(
|
|
246
|
+
container.querySelectorAll<HTMLButtonElement>("button"),
|
|
247
|
+
).find((button) =>
|
|
248
|
+
button.textContent?.includes("dispatch.pages.communityAppsInstall"),
|
|
249
|
+
);
|
|
250
|
+
await act(async () => installButton?.click());
|
|
251
|
+
|
|
252
|
+
expect(queryState.sendToAgentChat).toHaveBeenCalledWith({
|
|
253
|
+
message: "Create this app from the pinned files.",
|
|
254
|
+
attachments: [
|
|
255
|
+
{
|
|
256
|
+
type: "file",
|
|
257
|
+
name: "community-qr/README.md",
|
|
258
|
+
contentType: "text/plain",
|
|
259
|
+
text: "Verified source",
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
submit: true,
|
|
263
|
+
type: "code",
|
|
264
|
+
newTab: true,
|
|
265
|
+
reuseEmptyTab: true,
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it("explains when a community app ID is already in use", async () => {
|
|
270
|
+
queryState.communityAppsEnabled = true;
|
|
271
|
+
queryState.communityApps = [
|
|
272
|
+
{
|
|
273
|
+
id: "community-qr",
|
|
274
|
+
name: "QR",
|
|
275
|
+
description: "Generate QR images.",
|
|
276
|
+
appId: "qr",
|
|
277
|
+
repo: "BuilderIO/agent-native",
|
|
278
|
+
ref: "main",
|
|
279
|
+
license: "MIT",
|
|
280
|
+
provenance: "Reviewed source",
|
|
281
|
+
templatePath: "templates/community/qr",
|
|
282
|
+
installed: false,
|
|
283
|
+
pending: false,
|
|
284
|
+
installable: false,
|
|
285
|
+
installUnavailableReason: "app-id-conflict",
|
|
286
|
+
},
|
|
287
|
+
];
|
|
288
|
+
|
|
289
|
+
await renderAppsRoute();
|
|
290
|
+
|
|
291
|
+
expect(container.textContent).toContain(
|
|
292
|
+
"dispatch.pages.communityAppsIdConflict",
|
|
293
|
+
);
|
|
294
|
+
expect(
|
|
295
|
+
Array.from(container.querySelectorAll("button")).some((button) =>
|
|
296
|
+
button.textContent?.includes("dispatch.pages.communityAppsInstall"),
|
|
297
|
+
),
|
|
298
|
+
).toBe(false);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
it("explains when Builder-mode community installs cannot be verified", async () => {
|
|
302
|
+
queryState.communityAppsEnabled = true;
|
|
303
|
+
queryState.communityApps = [
|
|
304
|
+
{
|
|
305
|
+
id: "community-qr",
|
|
306
|
+
name: "QR",
|
|
307
|
+
description: "Generate QR images.",
|
|
308
|
+
appId: "community-qr",
|
|
309
|
+
repo: "BuilderIO/agent-native",
|
|
310
|
+
ref: "main",
|
|
311
|
+
license: "MIT",
|
|
312
|
+
provenance: "Reviewed source",
|
|
313
|
+
templatePath: "templates/community/qr",
|
|
314
|
+
installed: false,
|
|
315
|
+
pending: false,
|
|
316
|
+
installable: false,
|
|
317
|
+
installUnavailableReason: "builder-install-unverified",
|
|
318
|
+
},
|
|
319
|
+
];
|
|
320
|
+
|
|
321
|
+
await renderAppsRoute();
|
|
322
|
+
|
|
323
|
+
expect(container.textContent).toContain(
|
|
324
|
+
"dispatch.pages.communityAppsBuilderInstallUnavailable",
|
|
325
|
+
);
|
|
326
|
+
expect(
|
|
327
|
+
Array.from(container.querySelectorAll("button")).some((button) =>
|
|
328
|
+
button.textContent?.includes("dispatch.pages.communityAppsInstall"),
|
|
329
|
+
),
|
|
330
|
+
).toBe(false);
|
|
331
|
+
});
|
|
132
332
|
});
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
APP_LIST_GRID_ROW_CLASS,
|
|
17
17
|
AppList,
|
|
18
18
|
} from "../../components/app-list-row";
|
|
19
|
+
import { CommunityAppsSection } from "../../components/community-apps-section";
|
|
19
20
|
import { ConnectedAppCard } from "../../components/connected-app-card";
|
|
20
21
|
import { CreateAppPopover } from "../../components/create-app-popover";
|
|
21
22
|
import { DispatchShell } from "../../components/dispatch-shell";
|
|
@@ -346,6 +347,8 @@ function AppsRoute() {
|
|
|
346
347
|
</section>
|
|
347
348
|
</Collapsible>
|
|
348
349
|
) : null}
|
|
350
|
+
|
|
351
|
+
<CommunityAppsSection />
|
|
349
352
|
</div>
|
|
350
353
|
</DispatchShell>
|
|
351
354
|
);
|
|
@@ -8,7 +8,8 @@ import ConnectRoute from "./connect";
|
|
|
8
8
|
const connectState = vi.hoisted(() => ({
|
|
9
9
|
enabled: false,
|
|
10
10
|
status: "ready" as "loading" | "ready",
|
|
11
|
-
|
|
11
|
+
useActionQuery: vi.fn(() => ({ data: [], isLoading: false, isError: false })),
|
|
12
|
+
useActionMutation: vi.fn(() => ({ mutateAsync: vi.fn() })),
|
|
12
13
|
}));
|
|
13
14
|
|
|
14
15
|
vi.mock("@agent-native/core/client/feature-flags", () => ({
|
|
@@ -23,8 +24,9 @@ vi.mock("../../components/dispatch-shell", () => ({
|
|
|
23
24
|
vi.mock("@agent-native/core/client/i18n", () => ({
|
|
24
25
|
useT: () => (key: string) => key,
|
|
25
26
|
}));
|
|
26
|
-
vi.mock("@
|
|
27
|
-
|
|
27
|
+
vi.mock("@agent-native/core/client/hooks", () => ({
|
|
28
|
+
useActionQuery: connectState.useActionQuery,
|
|
29
|
+
useActionMutation: connectState.useActionMutation,
|
|
28
30
|
}));
|
|
29
31
|
|
|
30
32
|
describe("ConnectRoute", () => {
|
|
@@ -34,7 +36,8 @@ describe("ConnectRoute", () => {
|
|
|
34
36
|
beforeEach(() => {
|
|
35
37
|
connectState.enabled = false;
|
|
36
38
|
connectState.status = "ready";
|
|
37
|
-
connectState.
|
|
39
|
+
connectState.useActionQuery.mockClear();
|
|
40
|
+
connectState.useActionMutation.mockClear();
|
|
38
41
|
container = document.createElement("div");
|
|
39
42
|
document.body.appendChild(container);
|
|
40
43
|
root = createRoot(container);
|
|
@@ -48,13 +51,57 @@ describe("ConnectRoute", () => {
|
|
|
48
51
|
it("renders nothing and does not fetch when the labs flag is off", async () => {
|
|
49
52
|
await act(async () => root.render(<ConnectRoute />));
|
|
50
53
|
expect(container.innerHTML).toBe("");
|
|
51
|
-
expect(connectState.
|
|
54
|
+
expect(connectState.useActionQuery).not.toHaveBeenCalled();
|
|
55
|
+
expect(connectState.useActionMutation).not.toHaveBeenCalled();
|
|
52
56
|
});
|
|
53
57
|
|
|
54
58
|
it("shows the page skeleton while the labs flag is loading", async () => {
|
|
55
59
|
connectState.status = "loading";
|
|
56
60
|
await act(async () => root.render(<ConnectRoute />));
|
|
57
61
|
expect(container.querySelector('[aria-busy="true"]')).not.toBeNull();
|
|
58
|
-
expect(connectState.
|
|
62
|
+
expect(connectState.useActionQuery).not.toHaveBeenCalled();
|
|
63
|
+
expect(connectState.useActionMutation).not.toHaveBeenCalled();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("inspects a URL through the server action and renders its card", async () => {
|
|
67
|
+
connectState.enabled = true;
|
|
68
|
+
const mutateAsync = vi.fn().mockResolvedValue({
|
|
69
|
+
name: "Slides",
|
|
70
|
+
description: "A slide workspace",
|
|
71
|
+
url: "https://slides.example.com/_agent-native/a2a",
|
|
72
|
+
connect: true,
|
|
73
|
+
});
|
|
74
|
+
connectState.useActionMutation.mockReturnValue({ mutateAsync } as never);
|
|
75
|
+
|
|
76
|
+
await act(async () => root.render(<ConnectRoute />));
|
|
77
|
+
expect(connectState.useActionQuery).toHaveBeenCalledWith(
|
|
78
|
+
"list-connect-marketplace-apps",
|
|
79
|
+
{},
|
|
80
|
+
{ staleTime: 5 * 60 * 1000, retry: 1 },
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const input = container.querySelector("input");
|
|
84
|
+
expect(input).not.toBeNull();
|
|
85
|
+
await act(async () => {
|
|
86
|
+
const setter = Object.getOwnPropertyDescriptor(
|
|
87
|
+
HTMLInputElement.prototype,
|
|
88
|
+
"value",
|
|
89
|
+
)?.set;
|
|
90
|
+
setter?.call(input, "https://slides.example.com");
|
|
91
|
+
input?.dispatchEvent(new Event("input", { bubbles: true }));
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const inspectButton = [...container.querySelectorAll("button")].find(
|
|
95
|
+
(button) => button.textContent?.includes("dispatch.pages.inspectApp"),
|
|
96
|
+
);
|
|
97
|
+
expect(inspectButton).toBeDefined();
|
|
98
|
+
await act(async () => inspectButton?.click());
|
|
99
|
+
|
|
100
|
+
expect(mutateAsync).toHaveBeenCalledWith({
|
|
101
|
+
url: "https://slides.example.com/",
|
|
102
|
+
});
|
|
103
|
+
expect(container.querySelector("[data-connect-card] h3")?.textContent).toBe(
|
|
104
|
+
"Slides",
|
|
105
|
+
);
|
|
59
106
|
});
|
|
60
107
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { useFeatureFlagState } from "@agent-native/core/client/feature-flags";
|
|
2
|
+
import {
|
|
3
|
+
useActionMutation,
|
|
4
|
+
useActionQuery,
|
|
5
|
+
} from "@agent-native/core/client/hooks";
|
|
2
6
|
import { useT } from "@agent-native/core/client/i18n";
|
|
3
7
|
import { IconExternalLink, IconPlugConnected } from "@tabler/icons-react";
|
|
4
|
-
import { useQuery } from "@tanstack/react-query";
|
|
5
8
|
import { useState } from "react";
|
|
6
9
|
|
|
7
10
|
import { AppIcon } from "../../components/app-icon";
|
|
@@ -11,8 +14,6 @@ import { Input } from "../../components/ui/input";
|
|
|
11
14
|
import { Skeleton } from "../../components/ui/skeleton";
|
|
12
15
|
import {
|
|
13
16
|
buildIdentityConnectUrl,
|
|
14
|
-
fetchConnectAgentCard,
|
|
15
|
-
fetchMarketplaceApps,
|
|
16
17
|
normalizeConnectUrl,
|
|
17
18
|
type ConnectAgentCard,
|
|
18
19
|
type MarketplaceApp,
|
|
@@ -143,13 +144,15 @@ function ConnectAppsContent() {
|
|
|
143
144
|
const [card, setCard] = useState<ConnectAgentCard | null>(null);
|
|
144
145
|
const [cardError, setCardError] = useState(false);
|
|
145
146
|
const [cardLoading, setCardLoading] = useState(false);
|
|
146
|
-
const feedQuery =
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
147
|
+
const feedQuery = useActionQuery(
|
|
148
|
+
"list-connect-marketplace-apps",
|
|
149
|
+
{},
|
|
150
|
+
{
|
|
151
|
+
staleTime: 5 * 60 * 1000,
|
|
152
|
+
retry: 1,
|
|
153
|
+
},
|
|
154
|
+
);
|
|
155
|
+
const inspectCard = useActionMutation("inspect-connect-agent-card");
|
|
153
156
|
|
|
154
157
|
const target = normalizeConnectUrl(url);
|
|
155
158
|
|
|
@@ -159,7 +162,7 @@ function ConnectAppsContent() {
|
|
|
159
162
|
setCardError(false);
|
|
160
163
|
setCard(null);
|
|
161
164
|
try {
|
|
162
|
-
setCard(await
|
|
165
|
+
setCard(await inspectCard.mutateAsync({ url: target.toString() }));
|
|
163
166
|
} catch {
|
|
164
167
|
setCardError(true);
|
|
165
168
|
} finally {
|
package/src/server/index.ts
CHANGED
|
@@ -7,6 +7,15 @@ import {
|
|
|
7
7
|
import { dispatchActions } from "../actions/index.js";
|
|
8
8
|
import type { DispatchConfig } from "../config.js";
|
|
9
9
|
import { dispatchAccessDescriptor } from "../shared/app-roles.js";
|
|
10
|
+
export {
|
|
11
|
+
listOrganizationVisibleWorkspaceApps,
|
|
12
|
+
listWorkspaceApps,
|
|
13
|
+
} from "./lib/app-creation-store.js";
|
|
14
|
+
export {
|
|
15
|
+
invalidateOrgAppsDirectoryCache,
|
|
16
|
+
orgAppsDirectoryAccessCache,
|
|
17
|
+
orgAppsDirectoryCache,
|
|
18
|
+
} from "./lib/org-apps-directory-cache.js";
|
|
10
19
|
|
|
11
20
|
defineAppRoles(dispatchAccessDescriptor, { allowOrgAdmins: true });
|
|
12
21
|
|