@agent-native/dispatch 0.40.30-nightly-20261021093329 → 0.40.31
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 +15 -60
- 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-connected-agents.js +7 -3
- package/dist/actions/list-connected-agents.js.map +1 -1
- 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/list-workspace-connections.d.ts.map +1 -1
- package/dist/actions/list-workspace-connections.js +13 -18
- package/dist/actions/list-workspace-connections.js.map +1 -1
- 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/action-query-error.d.ts +2 -1
- package/dist/components/action-query-error.d.ts.map +1 -1
- package/dist/components/action-query-error.js +25 -2
- package/dist/components/action-query-error.js.map +1 -1
- package/dist/components/chat-home-apps.d.ts.map +1 -1
- package/dist/components/chat-home-apps.js +2 -2
- package/dist/components/chat-home-apps.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/dispatch-control-plane.d.ts.map +1 -1
- package/dist/components/dispatch-control-plane.js +1 -1
- package/dist/components/dispatch-control-plane.js.map +1 -1
- package/dist/components/layout/Layout.d.ts +1 -0
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +7 -0
- package/dist/components/layout/Layout.js.map +1 -1
- 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/$appId.d.ts.map +1 -1
- package/dist/routes/pages/$appId.js +1 -1
- package/dist/routes/pages/$appId.js.map +1 -1
- package/dist/routes/pages/apps.d.ts.map +1 -1
- package/dist/routes/pages/apps.js +3 -2
- 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 +379 -92
- 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-connected-agents.spec.ts +17 -1
- package/src/actions/list-connected-agents.ts +7 -2
- package/src/actions/list-curated-community-apps.ts +12 -0
- package/src/actions/list-workspace-connections.spec.ts +14 -3
- package/src/actions/list-workspace-connections.ts +13 -17
- package/src/actions/update-workspace-app-metadata.spec.ts +25 -0
- package/src/actions/update-workspace-app-metadata.ts +48 -24
- package/src/components/action-query-error.spec.tsx +20 -0
- package/src/components/action-query-error.tsx +40 -0
- package/src/components/chat-home-apps.spec.tsx +32 -1
- package/src/components/chat-home-apps.tsx +6 -1
- package/src/components/community-apps-section.tsx +224 -0
- package/src/components/dispatch-control-plane.tsx +1 -0
- package/src/components/layout/Layout.tsx +9 -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/$appId.tsx +1 -0
- package/src/routes/pages/apps.spec.tsx +227 -3
- package/src/routes/pages/apps.tsx +5 -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 +820 -16
- package/src/server/lib/app-creation-store.ts +504 -101
- 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
|
@@ -4,6 +4,8 @@ declare const _default: import("@agent-native/core/action").ActionDefinition<Rec
|
|
|
4
4
|
description: string;
|
|
5
5
|
url: string;
|
|
6
6
|
color: string;
|
|
7
|
+
whenToUse?: string[];
|
|
8
|
+
aliases?: string[];
|
|
7
9
|
cardUrl?: string;
|
|
8
10
|
auth?: import("@agent-native/core/resources/metadata").RemoteAgentAuth;
|
|
9
11
|
kind?: import("@agent-native/core/resources/metadata").RemoteAgentKind;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineAction } from "@agent-native/core/action";
|
|
1
|
+
import { defineAction, fail } from "@agent-native/core/action";
|
|
2
2
|
import { REMOTE_AGENT_RESOURCE_PREFIXES, parseRemoteAgentManifest, } from "@agent-native/core/resources/metadata";
|
|
3
3
|
import { resourceGet, resourceListAccessible, SHARED_OWNER, } from "@agent-native/core/resources/store";
|
|
4
4
|
import { getRequestUserEmail } from "@agent-native/core/server";
|
|
@@ -21,8 +21,12 @@ export default defineAction({
|
|
|
21
21
|
const builtinIds = new Set(builtins.map((agent) => agent.id).filter((id) => !workspaceIds.has(id)));
|
|
22
22
|
const builtinHomeUrls = new Map(builtins.map((agent) => [agent.id, agent.url]));
|
|
23
23
|
const ownerEmail = getRequestUserEmail();
|
|
24
|
-
if (!ownerEmail)
|
|
25
|
-
|
|
24
|
+
if (!ownerEmail) {
|
|
25
|
+
fail("Sign in to list connected agents.", {
|
|
26
|
+
errorCode: "dispatch_user_identity_missing",
|
|
27
|
+
statusCode: 401,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
26
30
|
const resources = [];
|
|
27
31
|
for (const prefix of [...REMOTE_AGENT_RESOURCE_PREFIXES].reverse()) {
|
|
28
32
|
resources.push(...(await resourceListAccessible(ownerEmail, prefix)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-connected-agents.js","sourceRoot":"","sources":["../../src/actions/list-connected-agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"list-connected-agents.js","sourceRoot":"","sources":["../../src/actions/list-connected-agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACL,8BAA8B,EAC9B,wB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AK,EAAE,MAAM,EAAE,KAAK;aACrB,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QAClE,KAAK,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;YACtC,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;gBAAE,SAAS;YACpC,SAAS,CAAC,IAAI,CAAC;gBACb,EAAE;gBACF,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,GAAG,EAAE,MAAM,CAAC,GAAG;gBACf,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,MAAM,EAAE,QAAQ;gBAChB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,KAAK,EAAE,MAAM,CAAC,KAAK;aACpB,CAAC,CAAC;QACL,CAAC;QAED,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACjE,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { defineAction, fail } from \"@agent-native/core/action\";\nimport {\n REMOTE_AGENT_RESOURCE_PREFIXES,\n parseRemoteAgentManifest,\n} from \"@agent-native/core/resources/metadata\";\nimport {\n resourceGet,\n resourceListAccessible,\n SHARED_OWNER,\n} from \"@agent-native/core/resources/store\";\nimport { getRequestUserEmail } from \"@agent-native/core/server\";\nimport {\n discoverAgents,\n getBuiltinAgents,\n isBuiltinAgentCatalogId,\n loadWorkspaceAppsManifest,\n normalizeAgentId,\n shouldIncludeRemoteAgentManifest,\n} from \"@agent-native/core/server/agent-discovery\";\nimport { z } from \"zod\";\n\nexport default defineAction({\n description:\n \"List agents available to dispatch for A2A delegation, including built-in apps and connected remote agents.\",\n schema: z.object({}),\n http: { method: \"GET\" },\n run: async () => {\n const { hiddenAgentIds = [] } = await import(\"../server/index.js\").then(\n (m) => m.getDispatchConfig(),\n );\n const [discovered, workspaceApps] = await Promise.all([\n discoverAgents(\"dispatch\"),\n loadWorkspaceAppsManifest(),\n ]);\n // A mounted workspace app with a built-in's id is a workspace app; the\n // built-in config never applies to it.\n const workspaceIds = new Set(\n (workspaceApps ?? []).map((app) => normalizeAgentId(app.id)),\n );\n const builtins = getBuiltinAgents(\"dispatch\");\n const builtinIds = new Set(\n builtins.map((agent) => agent.id).filter((id) => !workspaceIds.has(id)),\n );\n const builtinHomeUrls = new Map(\n builtins.map((agent) => [agent.id, agent.url]),\n );\n const ownerEmail = getRequestUserEmail();\n if (!ownerEmail) {\n fail(\"Sign in to list connected agents.\", {\n errorCode: \"dispatch_user_identity_missing\",\n statusCode: 401,\n });\n }\n const resources: Array<{ id: string; path: string; owner: string }> = [];\n for (const prefix of [...REMOTE_AGENT_RESOURCE_PREFIXES].reverse()) {\n resources.push(...(await resourceListAccessible(ownerEmail, prefix)));\n }\n const customById = new Map<\n string,\n {\n resourceId: string;\n path: string;\n scope: \"shared\" | \"personal\";\n name: string;\n description: string;\n url: string;\n color: string;\n }\n >();\n\n for (const resource of resources) {\n if (!resource.path.endsWith(\".json\")) continue;\n const full = await resourceGet(resource.id);\n if (!full) continue;\n const manifest = parseRemoteAgentManifest(full.content, resource.path);\n if (!manifest) continue;\n if (!shouldIncludeRemoteAgentManifest(manifest, \"dispatch\")) continue;\n const manifestId = normalizeAgentId(manifest.id);\n // Built-in ids stay under the workspace's built-in config even when a\n // seeded manifest for them exists in resources.\n if (isBuiltinAgentCatalogId(manifestId)) continue;\n customById.set(manifestId, {\n resourceId: resource.id,\n path: resource.path,\n scope: resource.owner === SHARED_OWNER ? \"shared\" : \"personal\",\n name: manifest.name,\n description: manifest.description || \"\",\n url: manifest.url,\n color: manifest.color || \"#6B7280\",\n });\n }\n\n const connected = discovered.map((agent) => {\n const custom = customById.get(agent.id);\n const isBuiltin = builtinIds.has(agent.id);\n const homeUrl = isBuiltin ? builtinHomeUrls.get(agent.id) : undefined;\n return {\n ...agent,\n ...(homeUrl ? { homeUrl } : {}),\n source: isBuiltin ? \"builtin\" : custom ? \"custom\" : \"workspace\",\n resourceId: custom?.resourceId,\n path: custom?.path,\n scope: custom?.scope,\n };\n });\n\n const discoveredIds = new Set(connected.map((agent) => agent.id));\n for (const [id, custom] of customById) {\n if (discoveredIds.has(id)) continue;\n connected.push({\n id,\n name: custom.name,\n description: custom.description,\n url: custom.url,\n color: custom.color,\n source: \"custom\",\n resourceId: custom.resourceId,\n path: custom.path,\n scope: custom.scope,\n });\n }\n\n return connected.filter((a) => !hiddenAgentIds.includes(a.id));\n },\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-curated-community-apps.d.ts","sourceRoot":"","sources":["../../src/actions/list-curated-community-apps.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { listCuratedCommunityApps } from "../server/lib/community-apps.js";
|
|
4
|
+
export default defineAction({
|
|
5
|
+
description: "List reviewed, pinned community app templates that can be installed in the associated workspace. This catalog is separate from deployed agents in Connect.",
|
|
6
|
+
schema: z.object({}),
|
|
7
|
+
http: { method: "GET" },
|
|
8
|
+
run: async () => listCuratedCommunityApps(),
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=list-curated-community-apps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-curated-community-apps.js","sourceRoot":"","sources":["../../src/actions/list-curated-community-apps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,4JAA4J;IAC9J,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACpB,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;IACvB,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,wBAAwB,EAAE;CAC5C,CAAC,CAAC","sourcesContent":["import { defineAction } from \"@agent-native/core/action\";\nimport { z } from \"zod\";\n\nimport { listCuratedCommunityApps } from \"../server/lib/community-apps.js\";\n\nexport default defineAction({\n description:\n \"List reviewed, pinned community app templates that can be installed in the associated workspace. This catalog is separate from deployed agents in Connect.\",\n schema: z.object({}),\n http: { method: \"GET\" },\n run: async () => listCuratedCommunityApps(),\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-workspace-connections.d.ts","sourceRoot":"","sources":["../../src/actions/list-workspace-connections.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACpC,MAAM,gCAAgC,CAAC;AA2BxC,KAAK,QAAQ,GAAG;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AASF,KAAK,YAAY,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,UAAU,GAAG,cAAc,GAAG,gBAAgB,CAAC;IACvD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,KAAK,uBAAuB,GAAG,YAAY,GAAG,cAAc,GAAG,aAAa,CAAC;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"list-workspace-connections.d.ts","sourceRoot":"","sources":["../../src/actions/list-workspace-connections.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACpC,MAAM,gCAAgC,CAAC;AA2BxC,KAAK,QAAQ,GAAG;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AASF,KAAK,YAAY,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,UAAU,GAAG,cAAc,GAAG,gBAAgB,CAAC;IACvD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAEF,KAAK,uBAAuB,GAAG,YAAY,GAAG,cAAc,GAAG,aAAa,CAAC;;;;;;;;;QAsOrE,WAAW;YACT,MAAM;YACN,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QASX,SAAS;QACT,WAAW;QACX,MAAM;QACN,iBAAiB;QAEjB,sBAAsB;QAGtB,cAAc"}
|
|
@@ -39,24 +39,19 @@ async function listGrantApps() {
|
|
|
39
39
|
const listWorkspaceApps = dispatchActions["list-workspace-apps"];
|
|
40
40
|
if (!listWorkspaceApps)
|
|
41
41
|
return [{ id: "dispatch", label: "Dispatch" }];
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
: [{ id: "dispatch", label: "Dispatch" }];
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
return [{ id: "dispatch", label: "Dispatch" }];
|
|
59
|
-
}
|
|
42
|
+
const apps = (await listWorkspaceApps.run({
|
|
43
|
+
includeAgentCards: false,
|
|
44
|
+
audience: "all",
|
|
45
|
+
}));
|
|
46
|
+
const grantApps = apps
|
|
47
|
+
.filter((app) => !app.archived && app.status !== "pending")
|
|
48
|
+
.map((app) => ({
|
|
49
|
+
id: app.id,
|
|
50
|
+
label: app.name || humanizeAppId(app.id),
|
|
51
|
+
}));
|
|
52
|
+
return grantApps.length > 0
|
|
53
|
+
? grantApps
|
|
54
|
+
: [{ id: "dispatch", label: "Dispatch" }];
|
|
60
55
|
}
|
|
61
56
|
export default defineAction({
|
|
62
57
|
description: "List the workspace integration provider catalog, saved shared connections, and app access grants.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-workspace-connections.js","sourceRoot":"","sources":["../../src/actions/list-workspace-connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,gCAAgC,GAGjC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,eAAe,EACf,sBAAsB,GACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,+BAA+B,EAC/B,oCAAoC,EACpC,8BAA8B,GAC/B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,+BAA+B,EAC/B,6BAA6B,EAC7B,+BAA+B,EAC/B,6CAA6C,GAC9C,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,EAAE;IACzC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC;QAAE,OAAO,IAAI,CAAC;IAC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cesContent":["import { defineAction } from \"@agent-native/core/action\";\nimport {\n listWorkspaceConnectionProviders,\n type WorkspaceConnectionCapability,\n type WorkspaceConnectionTemplateUse,\n} from \"@agent-native/core/connections\";\nimport {\n isProviderApiId,\n listProviderApiCatalog,\n} from \"@agent-native/core/provider-api\";\nimport {\n CredentialStoreUnavailableError,\n hasWorkspaceProviderOAuthCredentials,\n isGoogleWorkspaceOAuthProvider,\n} from \"@agent-native/core/server\";\nimport {\n getWorkspaceConnectionAppAccess,\n listWorkspaceConnectionGrants,\n listWorkspaceConnectionsForUser,\n summarizeWorkspaceConnectionProviderReadiness,\n} from \"@agent-native/core/workspace-connections\";\nimport { dispatchActions } from \"@agent-native/dispatch/actions\";\nimport { z } from \"zod\";\n\nconst httpBoolean = z.preprocess((value) => {\n if (typeof value !== \"string\") return value;\n const normalized = value.trim().toLowerCase();\n if ([\"true\", \"1\", \"yes\", \"on\"].includes(normalized)) return true;\n if ([\"false\", \"0\", \"no\", \"off\"].includes(normalized)) return false;\n return value;\n}, z.boolean());\n\ntype GrantApp = {\n id: string;\n label: string;\n};\n\ntype WorkspaceApp = {\n id: string;\n name?: string;\n status?: \"ready\" | \"pending\";\n archived?: boolean;\n};\n\ntype GrantSummary = {\n id: string;\n connectionId: string;\n provider: string;\n appId: string;\n access: \"all-apps\" | \"selected-app\" | \"explicit-grant\";\n lastUsedAt?: string | null;\n};\n\ntype GoogleOAuthAvailability = \"configured\" | \"unconfigured\" | \"unavailable\";\n\nfunction unique(values: string[]) {\n return Array.from(\n new Set(values.map((value) => value.trim()).filter(Boolean)),\n );\n}\n\nfunction optionalTimestamp(source: object, key: string) {\n if (!Object.prototype.hasOwnProperty.call(source, key)) return undefined;\n const value = (source as Record<string, unknown>)[key];\n if (value == null) return null;\n if (value instanceof Date) return value.toISOString();\n return typeof value === \"string\" ? value : (JSON.stringify(value) ?? \"\");\n}\n\nfunction humanizeAppId(appId: string): string {\n return appId\n .split(/[-_]/)\n .filter(Boolean)\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\" \");\n}\n\nasync function listGrantApps(): Promise<GrantApp[]> {\n const listWorkspaceApps = dispatchActions[\"list-workspace-apps\"];\n if (!listWorkspaceApps) return [{ id: \"dispatch\", label: \"Dispatch\" }];\n\n try {\n const apps = (await listWorkspaceApps.run({\n includeAgentCards: false,\n audience: \"all\",\n } as any)) as WorkspaceApp[];\n const grantApps = apps\n .filter((app) => !app.archived && app.status !== \"pending\")\n .map((app) => ({\n id: app.id,\n label: app.name || humanizeAppId(app.id),\n }));\n return grantApps.length > 0\n ? grantApps\n : [{ id: \"dispatch\", label: \"Dispatch\" }];\n } catch {\n return [{ id: \"dispatch\", label: \"Dispatch\" }];\n }\n}\n\nexport default defineAction({\n description:\n \"List the workspace integration provider catalog, saved shared connections, and app access grants.\",\n schema: z.object({\n provider: z\n .string()\n .optional()\n .describe(\"Optional provider ID such as slack, github, or notion.\"),\n appId: z\n .string()\n .optional()\n .describe(\"Only include connections available to this app ID.\"),\n includeDisabled: httpBoolean\n .default(false)\n .describe(\"Include disabled connections. Defaults to false.\"),\n capability: z\n .string()\n .optional()\n .describe(\"Optional capability filter such as search, import, or docs.\"),\n templateUse: z\n .string()\n .optional()\n .describe(\"Optional template-use filter such as brain or analytics.\"),\n }),\n http: { method: \"GET\" },\n run: async (args) => {\n const catalogProviders = listWorkspaceConnectionProviders({\n capability: args.capability as WorkspaceConnectionCapability | undefined,\n templateUse: args.templateUse as\n | WorkspaceConnectionTemplateUse\n | undefined,\n });\n let googleOAuthAvailability: GoogleOAuthAvailability;\n try {\n googleOAuthAvailability = (await hasWorkspaceProviderOAuthCredentials(\n \"gmail\",\n ))\n ? \"configured\"\n : \"unconfigured\";\n } catch (error) {\n if (!(error instanceof CredentialStoreUnavailableError)) throw error;\n googleOAuthAvailability = \"unavailable\";\n }\n const googleOAuthConfigured = googleOAuthAvailability === \"configured\";\n const providers = catalogProviders.filter(\n (provider) =>\n (!args.provider || provider.id === args.provider) &&\n (googleOAuthConfigured || !isGoogleWorkspaceOAuthProvider(provider.id)),\n );\n const allConnections = await listWorkspaceConnectionsForUser({\n provider: args.provider,\n appId: args.appId,\n includeDisabled: args.includeDisabled,\n });\n const connections = allConnections.filter(\n (connection) =>\n googleOAuthConfigured ||\n !isGoogleWorkspaceOAuthProvider(connection.provider),\n );\n const allExplicitGrants = await listWorkspaceConnectionGrants({\n provider: args.provider,\n appId: args.appId,\n });\n const visibleConnectionIds = new Set(\n connections.map((connection) => connection.id),\n );\n const explicitGrants = allExplicitGrants.filter(\n (grant) =>\n visibleConnectionIds.has(grant.connectionId) &&\n (googleOAuthConfigured ||\n !isGoogleWorkspaceOAuthProvider(grant.provider)),\n );\n const grantApps = await listGrantApps();\n const legacyGrants = connections.flatMap<GrantSummary>((connection) => {\n if (connection.allowedApps.length === 0) {\n return [\n {\n id: `${connection.id}:all-apps`,\n connectionId: connection.id,\n provider: connection.provider,\n appId: \"*\",\n access: \"all-apps\" as const,\n },\n ];\n }\n return connection.allowedApps.map(\n (appId): GrantSummary => ({\n id: `${connection.id}:${appId}`,\n connectionId: connection.id,\n provider: connection.provider,\n appId,\n access: \"selected-app\" as const,\n }),\n );\n });\n const grants: GrantSummary[] = [\n ...legacyGrants,\n ...explicitGrants.map((grant) => {\n const lastUsedAt = optionalTimestamp(grant, \"lastUsedAt\");\n return {\n id: grant.id,\n connectionId: grant.connectionId,\n provider: grant.provider,\n appId: grant.appId,\n access: \"explicit-grant\" as const,\n ...(lastUsedAt !== undefined ? { lastUsedAt } : {}),\n };\n }),\n ];\n const grantSummaries = connections.map((connection) => {\n const explicitGrantAppIds = unique(\n explicitGrants\n .filter((grant) => grant.connectionId === connection.id)\n .map((grant) => grant.appId),\n );\n const selectedAppIds = unique(connection.allowedApps);\n const allApps = selectedAppIds.length === 0;\n const effectiveAppIds = allApps\n ? [\"*\"]\n : unique([...selectedAppIds, ...explicitGrantAppIds]);\n\n return {\n connectionId: connection.id,\n provider: connection.provider,\n accessMode: allApps\n ? (\"all-apps\" as const)\n : (\"selected-apps\" as const),\n allApps,\n selectedAppIds,\n explicitGrantAppIds,\n effectiveAppIds,\n trackedApps: grantApps.map((app) => {\n const access = getWorkspaceConnectionAppAccess(\n connection,\n app.id,\n explicitGrants,\n );\n return {\n appId: app.id,\n label: app.label,\n granted: access.available,\n mode: access.mode,\n grantId: access.grantId,\n };\n }),\n };\n });\n\n const providersWithReadiness = providers.map((provider) => {\n const providerApi = isProviderApiId(provider.id)\n ? listProviderApiCatalog(provider.id)[0]\n : null;\n return {\n ...provider,\n readiness: summarizeWorkspaceConnectionProviderReadiness({\n provider,\n connections,\n grants: explicitGrants,\n appId: args.appId,\n includeConnections: \"all\",\n }),\n rawProviderApi: providerApi\n ? {\n available: true,\n actionNames: [\n \"provider-api-catalog\",\n \"provider-api-docs\",\n \"provider-api-request\",\n ],\n docsUrls: providerApi.docsUrls,\n specUrls: providerApi.specUrls,\n auth: providerApi.auth,\n examples: providerApi.examples,\n }\n : {\n available: false,\n actionNames: [],\n docsUrls: [],\n specUrls: [],\n auth: null,\n examples: [],\n },\n };\n });\n\n return {\n availability: {\n googleOAuth: {\n status: googleOAuthAvailability,\n retryable: googleOAuthAvailability === \"unavailable\",\n },\n },\n providers: providersWithReadiness,\n connections,\n grants,\n grantSummaries,\n suggestedApps: grantApps,\n counts: {\n providers: providersWithReadiness.length,\n connections: connections.length,\n grants: grants.length,\n allAppConnections: grantSummaries.filter((summary) => summary.allApps)\n .length,\n selectedAppConnections: grantSummaries.filter(\n (summary) => !summary.allApps,\n ).length,\n readyProviders: providersWithReadiness.filter(\n (provider) => provider.readiness.status === \"ready\",\n ).length,\n },\n };\n },\n});\n"]}
|
|
1
|
+
{"version":3,"file":"list-workspace-connections.js","sourceRoot":"","sources":["../../src/actions/list-workspace-connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,gCAAgC,GAGjC,MAAM,gCAAgC,CAAC;AACxC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BACN,SAAS,EAAE,sBAAsB,CAAC,MAAM;gBACxC,WAAW,EAAE,WAAW,CAAC,MAAM;gBAC/B,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,iBAAiB,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;qBACnE,MAAM;gBACT,sBAAsB,EAAE,cAAc,CAAC,MAAM,CAC3C,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAC9B,CAAC,MAAM;gBACR,cAAc,EAAE,sBAAsB,CAAC,MAAM,CAC3C,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,KAAK,OAAO,CACpD,CAAC,MAAM;aACT;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { defineAction } from \"@agent-native/core/action\";\nimport {\n listWorkspaceConnectionProviders,\n type WorkspaceConnectionCapability,\n type WorkspaceConnectionTemplateUse,\n} from \"@agent-native/core/connections\";\nimport {\n isProviderApiId,\n listProviderApiCatalog,\n} from \"@agent-native/core/provider-api\";\nimport {\n CredentialStoreUnavailableError,\n hasWorkspaceProviderOAuthCredentials,\n isGoogleWorkspaceOAuthProvider,\n} from \"@agent-native/core/server\";\nimport {\n getWorkspaceConnectionAppAccess,\n listWorkspaceConnectionGrants,\n listWorkspaceConnectionsForUser,\n summarizeWorkspaceConnectionProviderReadiness,\n} from \"@agent-native/core/workspace-connections\";\nimport { dispatchActions } from \"@agent-native/dispatch/actions\";\nimport { z } from \"zod\";\n\nconst httpBoolean = z.preprocess((value) => {\n if (typeof value !== \"string\") return value;\n const normalized = value.trim().toLowerCase();\n if ([\"true\", \"1\", \"yes\", \"on\"].includes(normalized)) return true;\n if ([\"false\", \"0\", \"no\", \"off\"].includes(normalized)) return false;\n return value;\n}, z.boolean());\n\ntype GrantApp = {\n id: string;\n label: string;\n};\n\ntype WorkspaceApp = {\n id: string;\n name?: string;\n status?: \"ready\" | \"pending\";\n archived?: boolean;\n};\n\ntype GrantSummary = {\n id: string;\n connectionId: string;\n provider: string;\n appId: string;\n access: \"all-apps\" | \"selected-app\" | \"explicit-grant\";\n lastUsedAt?: string | null;\n};\n\ntype GoogleOAuthAvailability = \"configured\" | \"unconfigured\" | \"unavailable\";\n\nfunction unique(values: string[]) {\n return Array.from(\n new Set(values.map((value) => value.trim()).filter(Boolean)),\n );\n}\n\nfunction optionalTimestamp(source: object, key: string) {\n if (!Object.prototype.hasOwnProperty.call(source, key)) return undefined;\n const value = (source as Record<string, unknown>)[key];\n if (value == null) return null;\n if (value instanceof Date) return value.toISOString();\n return typeof value === \"string\" ? value : (JSON.stringify(value) ?? \"\");\n}\n\nfunction humanizeAppId(appId: string): string {\n return appId\n .split(/[-_]/)\n .filter(Boolean)\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\" \");\n}\n\nasync function listGrantApps(): Promise<GrantApp[]> {\n const listWorkspaceApps = dispatchActions[\"list-workspace-apps\"];\n if (!listWorkspaceApps) return [{ id: \"dispatch\", label: \"Dispatch\" }];\n\n const apps = (await listWorkspaceApps.run({\n includeAgentCards: false,\n audience: \"all\",\n } as any)) as WorkspaceApp[];\n const grantApps = apps\n .filter((app) => !app.archived && app.status !== \"pending\")\n .map((app) => ({\n id: app.id,\n label: app.name || humanizeAppId(app.id),\n }));\n return grantApps.length > 0\n ? grantApps\n : [{ id: \"dispatch\", label: \"Dispatch\" }];\n}\n\nexport default defineAction({\n description:\n \"List the workspace integration provider catalog, saved shared connections, and app access grants.\",\n schema: z.object({\n provider: z\n .string()\n .optional()\n .describe(\"Optional provider ID such as slack, github, or notion.\"),\n appId: z\n .string()\n .optional()\n .describe(\"Only include connections available to this app ID.\"),\n includeDisabled: httpBoolean\n .default(false)\n .describe(\"Include disabled connections. Defaults to false.\"),\n capability: z\n .string()\n .optional()\n .describe(\"Optional capability filter such as search, import, or docs.\"),\n templateUse: z\n .string()\n .optional()\n .describe(\"Optional template-use filter such as brain or analytics.\"),\n }),\n http: { method: \"GET\" },\n run: async (args) => {\n const catalogProviders = listWorkspaceConnectionProviders({\n capability: args.capability as WorkspaceConnectionCapability | undefined,\n templateUse: args.templateUse as\n | WorkspaceConnectionTemplateUse\n | undefined,\n });\n let googleOAuthAvailability: GoogleOAuthAvailability;\n try {\n googleOAuthAvailability = (await hasWorkspaceProviderOAuthCredentials(\n \"gmail\",\n ))\n ? \"configured\"\n : \"unconfigured\";\n } catch (error) {\n if (!(error instanceof CredentialStoreUnavailableError)) throw error;\n googleOAuthAvailability = \"unavailable\";\n }\n const googleOAuthConfigured = googleOAuthAvailability === \"configured\";\n const providers = catalogProviders.filter(\n (provider) =>\n (!args.provider || provider.id === args.provider) &&\n (googleOAuthConfigured || !isGoogleWorkspaceOAuthProvider(provider.id)),\n );\n const allConnections = await listWorkspaceConnectionsForUser({\n provider: args.provider,\n appId: args.appId,\n includeDisabled: args.includeDisabled,\n });\n const connections = allConnections.filter(\n (connection) =>\n googleOAuthConfigured ||\n !isGoogleWorkspaceOAuthProvider(connection.provider),\n );\n const allExplicitGrants = await listWorkspaceConnectionGrants({\n provider: args.provider,\n appId: args.appId,\n });\n const visibleConnectionIds = new Set(\n connections.map((connection) => connection.id),\n );\n const explicitGrants = allExplicitGrants.filter(\n (grant) =>\n visibleConnectionIds.has(grant.connectionId) &&\n (googleOAuthConfigured ||\n !isGoogleWorkspaceOAuthProvider(grant.provider)),\n );\n const grantApps = await listGrantApps();\n const legacyGrants = connections.flatMap<GrantSummary>((connection) => {\n if (connection.allowedApps.length === 0) {\n return [\n {\n id: `${connection.id}:all-apps`,\n connectionId: connection.id,\n provider: connection.provider,\n appId: \"*\",\n access: \"all-apps\" as const,\n },\n ];\n }\n return connection.allowedApps.map(\n (appId): GrantSummary => ({\n id: `${connection.id}:${appId}`,\n connectionId: connection.id,\n provider: connection.provider,\n appId,\n access: \"selected-app\" as const,\n }),\n );\n });\n const grants: GrantSummary[] = [\n ...legacyGrants,\n ...explicitGrants.map((grant) => {\n const lastUsedAt = optionalTimestamp(grant, \"lastUsedAt\");\n return {\n id: grant.id,\n connectionId: grant.connectionId,\n provider: grant.provider,\n appId: grant.appId,\n access: \"explicit-grant\" as const,\n ...(lastUsedAt !== undefined ? { lastUsedAt } : {}),\n };\n }),\n ];\n const grantSummaries = connections.map((connection) => {\n const explicitGrantAppIds = unique(\n explicitGrants\n .filter((grant) => grant.connectionId === connection.id)\n .map((grant) => grant.appId),\n );\n const selectedAppIds = unique(connection.allowedApps);\n const allApps = selectedAppIds.length === 0;\n const effectiveAppIds = allApps\n ? [\"*\"]\n : unique([...selectedAppIds, ...explicitGrantAppIds]);\n\n return {\n connectionId: connection.id,\n provider: connection.provider,\n accessMode: allApps\n ? (\"all-apps\" as const)\n : (\"selected-apps\" as const),\n allApps,\n selectedAppIds,\n explicitGrantAppIds,\n effectiveAppIds,\n trackedApps: grantApps.map((app) => {\n const access = getWorkspaceConnectionAppAccess(\n connection,\n app.id,\n explicitGrants,\n );\n return {\n appId: app.id,\n label: app.label,\n granted: access.available,\n mode: access.mode,\n grantId: access.grantId,\n };\n }),\n };\n });\n\n const providersWithReadiness = providers.map((provider) => {\n const providerApi = isProviderApiId(provider.id)\n ? listProviderApiCatalog(provider.id)[0]\n : null;\n return {\n ...provider,\n readiness: summarizeWorkspaceConnectionProviderReadiness({\n provider,\n connections,\n grants: explicitGrants,\n appId: args.appId,\n includeConnections: \"all\",\n }),\n rawProviderApi: providerApi\n ? {\n available: true,\n actionNames: [\n \"provider-api-catalog\",\n \"provider-api-docs\",\n \"provider-api-request\",\n ],\n docsUrls: providerApi.docsUrls,\n specUrls: providerApi.specUrls,\n auth: providerApi.auth,\n examples: providerApi.examples,\n }\n : {\n available: false,\n actionNames: [],\n docsUrls: [],\n specUrls: [],\n auth: null,\n examples: [],\n },\n };\n });\n\n return {\n availability: {\n googleOAuth: {\n status: googleOAuthAvailability,\n retryable: googleOAuthAvailability === \"unavailable\",\n },\n },\n providers: providersWithReadiness,\n connections,\n grants,\n grantSummaries,\n suggestedApps: grantApps,\n counts: {\n providers: providersWithReadiness.length,\n connections: connections.length,\n grants: grants.length,\n allAppConnections: grantSummaries.filter((summary) => summary.allApps)\n .length,\n selectedAppConnections: grantSummaries.filter(\n (summary) => !summary.allApps,\n ).length,\n readyProviders: providersWithReadiness.filter(\n (provider) => provider.readiness.status === \"ready\",\n ).length,\n },\n };\n },\n});\n"]}
|
|
@@ -47,10 +47,7 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
47
47
|
notes?: string | undefined;
|
|
48
48
|
scope?: "org" | "user" | undefined;
|
|
49
49
|
}, {
|
|
50
|
-
message?: undefined;
|
|
51
50
|
provider?: undefined;
|
|
52
|
-
id?: undefined;
|
|
53
|
-
deleted?: undefined;
|
|
54
51
|
providers: {
|
|
55
52
|
id: string;
|
|
56
53
|
label: string;
|
|
@@ -62,44 +59,47 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
62
59
|
}[];
|
|
63
60
|
count: number;
|
|
64
61
|
found?: undefined;
|
|
62
|
+
deleted?: undefined;
|
|
65
63
|
registered?: undefined;
|
|
64
|
+
id?: undefined;
|
|
66
65
|
label?: undefined;
|
|
67
|
-
} | {
|
|
68
66
|
message?: undefined;
|
|
69
|
-
|
|
70
|
-
count?: undefined;
|
|
71
|
-
deleted?: undefined;
|
|
67
|
+
} | {
|
|
72
68
|
providers?: undefined;
|
|
69
|
+
count?: undefined;
|
|
73
70
|
found: boolean;
|
|
74
71
|
provider: import("node_modules/@agent-native/core/dist/provider-api").CustomProviderConfig;
|
|
72
|
+
deleted?: undefined;
|
|
75
73
|
registered?: undefined;
|
|
74
|
+
id?: undefined;
|
|
76
75
|
label?: undefined;
|
|
77
|
-
} | {
|
|
78
76
|
message?: undefined;
|
|
77
|
+
} | {
|
|
79
78
|
provider?: undefined;
|
|
80
|
-
count?: undefined;
|
|
81
|
-
deleted?: undefined;
|
|
82
79
|
providers?: undefined;
|
|
80
|
+
count?: undefined;
|
|
83
81
|
found: boolean;
|
|
84
82
|
id: string;
|
|
83
|
+
deleted?: undefined;
|
|
85
84
|
registered?: undefined;
|
|
86
85
|
label?: undefined;
|
|
87
|
-
} | {
|
|
88
86
|
message?: undefined;
|
|
87
|
+
} | {
|
|
89
88
|
provider?: undefined;
|
|
90
|
-
count?: undefined;
|
|
91
89
|
providers?: undefined;
|
|
90
|
+
count?: undefined;
|
|
92
91
|
found?: undefined;
|
|
93
92
|
deleted: boolean;
|
|
94
93
|
id: string;
|
|
95
94
|
registered?: undefined;
|
|
96
95
|
label?: undefined;
|
|
96
|
+
message?: undefined;
|
|
97
97
|
} | {
|
|
98
98
|
provider?: undefined;
|
|
99
|
-
count?: undefined;
|
|
100
|
-
deleted?: undefined;
|
|
101
99
|
providers?: undefined;
|
|
100
|
+
count?: undefined;
|
|
102
101
|
found?: undefined;
|
|
102
|
+
deleted?: undefined;
|
|
103
103
|
registered: boolean;
|
|
104
104
|
id: string;
|
|
105
105
|
label: string;
|
|
@@ -50,6 +50,12 @@ declare const _default: import("@agent-native/core/action").ActionDefinition<{
|
|
|
50
50
|
appId: string;
|
|
51
51
|
prompt: string;
|
|
52
52
|
message: string;
|
|
53
|
+
attachments?: Array<{
|
|
54
|
+
type: "file";
|
|
55
|
+
name: string;
|
|
56
|
+
contentType: string;
|
|
57
|
+
text: string;
|
|
58
|
+
}>;
|
|
53
59
|
sourceTemplate: import("../server/lib/curated-workspace-templates.js").CuratedWorkspaceTemplate;
|
|
54
60
|
}>;
|
|
55
61
|
export default _default;
|
|
@@ -2,6 +2,7 @@ declare const _default: import("@agent-native/core/action").ActionDefinition<{
|
|
|
2
2
|
appId: string;
|
|
3
3
|
name?: string | null | undefined;
|
|
4
4
|
description?: string | null | undefined;
|
|
5
|
+
whenToUse?: string[] | null | undefined;
|
|
5
6
|
}, import("../server/lib/app-creation-store.js").WorkspaceAppSummary>;
|
|
6
7
|
export default _default;
|
|
7
8
|
//# sourceMappingURL=update-workspace-app-metadata.d.ts.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { defineAction } from "@agent-native/core/action";
|
|
2
|
-
import { getWorkspaceAppIdValidationError } from "@agent-native/core/shared";
|
|
2
|
+
import { getWorkspaceAppIdValidationError, parseAgentProfileMetadata, } from "@agent-native/core/shared";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { updateWorkspaceAppMetadata } from "../server/lib/app-creation-store.js";
|
|
5
5
|
export default defineAction({
|
|
6
|
-
description: "Update
|
|
7
|
-
schema: z
|
|
6
|
+
description: "Update a workspace app's display name, description, and when-to-use profile. Only organization owners and admins can edit these shared details.",
|
|
7
|
+
schema: z
|
|
8
|
+
.object({
|
|
8
9
|
appId: z
|
|
9
10
|
.string()
|
|
10
11
|
.max(64)
|
|
@@ -20,10 +21,30 @@ export default defineAction({
|
|
|
20
21
|
.describe("Human-readable app name"),
|
|
21
22
|
description: z
|
|
22
23
|
.string()
|
|
23
|
-
.max(
|
|
24
|
+
.max(1000)
|
|
24
25
|
.optional()
|
|
25
26
|
.nullable()
|
|
26
|
-
.describe("Human-readable app description"),
|
|
27
|
+
.describe("Human-readable app description, up to 1,000 characters"),
|
|
28
|
+
whenToUse: z
|
|
29
|
+
.array(z.string())
|
|
30
|
+
.max(6)
|
|
31
|
+
.optional()
|
|
32
|
+
.nullable()
|
|
33
|
+
.describe("Example requests that indicate when this app is useful"),
|
|
34
|
+
})
|
|
35
|
+
.superRefine(({ description, whenToUse }, context) => {
|
|
36
|
+
if (description == null && whenToUse == null)
|
|
37
|
+
return;
|
|
38
|
+
const profile = parseAgentProfileMetadata({
|
|
39
|
+
...(description != null ? { description } : {}),
|
|
40
|
+
...(whenToUse != null ? { whenToUse } : {}),
|
|
41
|
+
});
|
|
42
|
+
if (!profile) {
|
|
43
|
+
context.addIssue({
|
|
44
|
+
code: "custom",
|
|
45
|
+
message: "Use a description up to 1,000 characters and up to 6 non-empty examples, each no longer than 140 characters.",
|
|
46
|
+
});
|
|
47
|
+
}
|
|
27
48
|
}),
|
|
28
49
|
run: async (args) => updateWorkspaceAppMetadata(args),
|
|
29
50
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-workspace-app-metadata.js","sourceRoot":"","sources":["../../src/actions/update-workspace-app-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,
|
|
1
|
+
{"version":3,"file":"update-workspace-app-metadata.js","sourceRoot":"","sources":["../../src/actions/update-workspace-app-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EACL,gCAAgC,EAChC,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,iJAAiJ;IACnJ,MAAM,EAAE,CAAC;SACN,MAAM,CAAC;QACN,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,GAAG,CAAC,EAAE,CAAC;aACP,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,gCAAgC,CAAC,KAAK,CAAC,EAAE;YAC3D,OAAO,EACL,yEAAyE;SAC5E,CAAC;aACD,QAAQ,CAAC,iDAAiD,CAAC;QAC9D,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,GAAG,CAAC,GAAG,CAAC;aACR,QAAQ,EAAE;aACV,QAAQ,EAAE;aACV,QAAQ,CAAC,yBAAyB,CAAC;QACtC,WAAW,EAAE,CAAC;aACX,MAAM,EAAE;aACR,GAAG,CAAC,IAAI,CAAC;aACT,QAAQ,EAAE;aACV,QAAQ,EAAE;aACV,QAAQ,CAAC,wDAAwD,CAAC;QACrE,SAAS,EAAE,CAAC;aACT,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;aACjB,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,EAAE;aACV,QAAQ,EAAE;aACV,QAAQ,CAAC,wDAAwD,CAAC;KACtE,CAAC;SACD,WAAW,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE;QACnD,IAAI,WAAW,IAAI,IAAI,IAAI,SAAS,IAAI,IAAI;YAAE,OAAO;QACrD,MAAM,OAAO,GAAG,yBAAyB,CAAC;YACxC,GAAG,CAAC,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/C,GAAG,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5C,CAAC,CAAC;QACH,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,CAAC,QAAQ,CAAC;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EACL,8GAA8G;aACjH,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;IACJ,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC;CACtD,CAAC,CAAC","sourcesContent":["import { defineAction } from \"@agent-native/core/action\";\nimport {\n getWorkspaceAppIdValidationError,\n parseAgentProfileMetadata,\n} from \"@agent-native/core/shared\";\nimport { z } from \"zod\";\n\nimport { updateWorkspaceAppMetadata } from \"../server/lib/app-creation-store.js\";\n\nexport default defineAction({\n description:\n \"Update a workspace app's display name, description, and when-to-use profile. Only organization owners and admins can edit these shared details.\",\n schema: z\n .object({\n appId: z\n .string()\n .max(64)\n .refine((appId) => !getWorkspaceAppIdValidationError(appId), {\n message:\n \"Use a non-reserved app id with lowercase letters, numbers, and hyphens.\",\n })\n .describe(\"Workspace app id, matching the apps/<id> folder\"),\n name: z\n .string()\n .max(120)\n .optional()\n .nullable()\n .describe(\"Human-readable app name\"),\n description: z\n .string()\n .max(1000)\n .optional()\n .nullable()\n .describe(\"Human-readable app description, up to 1,000 characters\"),\n whenToUse: z\n .array(z.string())\n .max(6)\n .optional()\n .nullable()\n .describe(\"Example requests that indicate when this app is useful\"),\n })\n .superRefine(({ description, whenToUse }, context) => {\n if (description == null && whenToUse == null) return;\n const profile = parseAgentProfileMetadata({\n ...(description != null ? { description } : {}),\n ...(whenToUse != null ? { whenToUse } : {}),\n });\n if (!profile) {\n context.addIssue({\n code: \"custom\",\n message:\n \"Use a description up to 1,000 characters and up to 6 non-empty examples, each no longer than 140 characters.\",\n });\n }\n }),\n run: async (args) => updateWorkspaceAppMetadata(args),\n});\n"]}
|
|
@@ -2,7 +2,8 @@ interface ActionQueryErrorProps {
|
|
|
2
2
|
error?: unknown;
|
|
3
3
|
onRetry: () => unknown;
|
|
4
4
|
className?: string;
|
|
5
|
+
queryName?: string;
|
|
5
6
|
}
|
|
6
|
-
export declare function ActionQueryError({ onRetry, className, }: ActionQueryErrorProps): import("node_modules/@types/react").JSX.Element;
|
|
7
|
+
export declare function ActionQueryError({ error, onRetry, className, queryName, }: ActionQueryErrorProps): import("node_modules/@types/react").JSX.Element;
|
|
7
8
|
export {};
|
|
8
9
|
//# sourceMappingURL=action-query-error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-query-error.d.ts","sourceRoot":"","sources":["../../src/components/action-query-error.tsx"],"names":[],"mappings":"AAMA,UAAU,qBAAqB;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"action-query-error.d.ts","sourceRoot":"","sources":["../../src/components/action-query-error.tsx"],"names":[],"mappings":"AAMA,UAAU,qBAAqB;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiCD,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,GACV,EAAE,qBAAqB,mDAsBvB"}
|
|
@@ -3,8 +3,31 @@ import { useT } from "@agent-native/core/client/i18n";
|
|
|
3
3
|
import { IconAlertTriangle, IconRefresh } from "@tabler/icons-react";
|
|
4
4
|
import { Alert, AlertDescription, AlertTitle } from "./ui/alert.js";
|
|
5
5
|
import { Button } from "./ui/button.js";
|
|
6
|
-
|
|
6
|
+
function actionQueryDiagnostic(error, queryName) {
|
|
7
|
+
const parts = [];
|
|
8
|
+
if (queryName)
|
|
9
|
+
parts.push(queryName);
|
|
10
|
+
if (error && typeof error === "object") {
|
|
11
|
+
const details = error;
|
|
12
|
+
const status = typeof details.statusCode === "number"
|
|
13
|
+
? details.statusCode
|
|
14
|
+
: details.status;
|
|
15
|
+
if (typeof status === "number" &&
|
|
16
|
+
Number.isInteger(status) &&
|
|
17
|
+
status >= 100 &&
|
|
18
|
+
status <= 599) {
|
|
19
|
+
parts.push(`HTTP ${status}`);
|
|
20
|
+
}
|
|
21
|
+
const code = details.errorCode ?? details.code;
|
|
22
|
+
if (typeof code === "string" && /^[a-zA-Z0-9_.-]{1,80}$/.test(code)) {
|
|
23
|
+
parts.push(code);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return parts.length > 0 ? parts.join(" · ") : null;
|
|
27
|
+
}
|
|
28
|
+
export function ActionQueryError({ error, onRetry, className, queryName, }) {
|
|
7
29
|
const t = useT();
|
|
8
|
-
|
|
30
|
+
const diagnostic = actionQueryDiagnostic(error, queryName);
|
|
31
|
+
return (_jsxs(Alert, { variant: "destructive", className: className, children: [_jsx(IconAlertTriangle, { className: "size-4" }), _jsx(AlertTitle, { children: t("dispatch.pages.dataLoadFailed") }), _jsxs(AlertDescription, { className: "flex flex-wrap items-center justify-between gap-3", children: [_jsx("span", { children: t("dispatch.pages.dataLoadFailedDescription") }), diagnostic ? (_jsx("code", { className: "w-full break-all text-xs text-muted-foreground", children: diagnostic })) : null, _jsxs(Button, { type: "button", variant: "outline", size: "sm", onClick: onRetry, children: [_jsx(IconRefresh, { className: "size-4" }), t("dispatch.pages.tryAgain")] })] })] }));
|
|
9
32
|
}
|
|
10
33
|
//# sourceMappingURL=action-query-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-query-error.js","sourceRoot":"","sources":["../../src/components/action-query-error.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"action-query-error.js","sourceRoot":"","sources":["../../src/components/action-query-error.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAErE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC,SAAS,qBAAqB,CAC5B,KAAc,EACd,SAA6B;IAE7B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAErC,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,KAAgC,CAAC;QACjD,MAAM,MAAM,GACV,OAAO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gD,YAC7D,UAAU,GACN,CACR,CAAC,CAAC,CAAC,IAAI,EACR,MAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,EAAE,OAAO,aAChE,KAAC,WAAW,IAAC,SAAS,EAAC,QAAQ,GAAG,EACjC,CAAC,CAAC,yBAAyB,CAAC,IACtB,IACQ,IACb,CACT,CAAC;AACJ,CAAC","sourcesContent":["import { useT } from \"@agent-native/core/client/i18n\";\nimport { IconAlertTriangle, IconRefresh } from \"@tabler/icons-react\";\n\nimport { Alert, AlertDescription, AlertTitle } from \"./ui/alert\";\nimport { Button } from \"./ui/button\";\n\ninterface ActionQueryErrorProps {\n error?: unknown;\n onRetry: () => unknown;\n className?: string;\n queryName?: string;\n}\n\nfunction actionQueryDiagnostic(\n error: unknown,\n queryName: string | undefined,\n): string | null {\n const parts: string[] = [];\n if (queryName) parts.push(queryName);\n\n if (error && typeof error === \"object\") {\n const details = error as Record<string, unknown>;\n const status =\n typeof details.statusCode === \"number\"\n ? details.statusCode\n : details.status;\n if (\n typeof status === \"number\" &&\n Number.isInteger(status) &&\n status >= 100 &&\n status <= 599\n ) {\n parts.push(`HTTP ${status}`);\n }\n\n const code = details.errorCode ?? details.code;\n if (typeof code === \"string\" && /^[a-zA-Z0-9_.-]{1,80}$/.test(code)) {\n parts.push(code);\n }\n }\n\n return parts.length > 0 ? parts.join(\" · \") : null;\n}\n\nexport function ActionQueryError({\n error,\n onRetry,\n className,\n queryName,\n}: ActionQueryErrorProps) {\n const t = useT();\n const diagnostic = actionQueryDiagnostic(error, queryName);\n\n return (\n <Alert variant=\"destructive\" className={className}>\n <IconAlertTriangle className=\"size-4\" />\n <AlertTitle>{t(\"dispatch.pages.dataLoadFailed\")}</AlertTitle>\n <AlertDescription className=\"flex flex-wrap items-center justify-between gap-3\">\n <span>{t(\"dispatch.pages.dataLoadFailedDescription\")}</span>\n {diagnostic ? (\n <code className=\"w-full break-all text-xs text-muted-foreground\">\n {diagnostic}\n </code>\n ) : null}\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={onRetry}>\n <IconRefresh className=\"size-4\" />\n {t(\"dispatch.pages.tryAgain\")}\n </Button>\n </AlertDescription>\n </Alert>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-home-apps.d.ts","sourceRoot":"","sources":["../../src/components/chat-home-apps.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"chat-home-apps.d.ts","sourceRoot":"","sources":["../../src/components/chat-home-apps.tsx"],"names":[],"mappings":"AA0BA,wBAAgB,oBAAoB,2DA4InC"}
|
|
@@ -29,11 +29,11 @@ export function DispatchChatHomeApps() {
|
|
|
29
29
|
if (!launcher)
|
|
30
30
|
return null;
|
|
31
31
|
if (launcher.error && launcher.workspaceApps.length === 0) {
|
|
32
|
-
return (_jsx("div", { className: "mx-auto w-full max-w-[1000px]", children: _jsx(ActionQueryError, { error: launcher.error, onRetry: launcher.retry }) }));
|
|
32
|
+
return (_jsx("div", { className: "mx-auto w-full max-w-[1000px]", children: _jsx(ActionQueryError, { error: launcher.error, onRetry: launcher.retry, queryName: launcher.errorQueryName }) }));
|
|
33
33
|
}
|
|
34
34
|
if (!launcher.isLoading && launcher.workspaceApps.length === 0)
|
|
35
35
|
return null;
|
|
36
|
-
return (_jsxs("div", { className: "mx-auto w-full max-w-[1000px]", children: [launcher.error ? (_jsx(ActionQueryError, { error: launcher.error, onRetry: launcher.retry, className: "mb-3" })) : null, _jsxs("section", { "aria-label": t("dispatch.nav.apps"), children: [_jsxs("header", { className: "mb-3 flex flex-wrap items-center justify-between gap-3", children: [_jsx("h2", { className: "text-sm font-semibold text-foreground", children: t("dispatch.nav.apps") }), _jsxs("div", { className: "flex min-w-0 flex-1 items-center justify-end gap-2 sm:flex-none", children: [_jsx(WorkspaceAppSearch, { query: query, onQueryChange: setQuery, className: "w-full max-w-[280px]" }), _jsx(CreateAppPopover, { align: "end", onCreated: launcher.retry, trigger: _jsxs(Button, { type: "button", size: "sm", variant: "outline", children: [_jsx(IconPlus, { size: 16, "aria-hidden": "true" }), t("dispatch.pages.chatFirstNewApp")] }) })] })] }), launcher.isLoading && launcher.workspaceApps.length === 0 ? (_jsx("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2", children: Array.from({ length: 6 }, (_, index) => (_jsxs("div", { className: "flex min-w-0 items-center gap-3 rounded-xl bg-muted/30 px-3 py-2.5", children: [_jsx(Skeleton, { className: "size-7 rounded-lg" }), _jsxs("div", { className: "min-w-0 flex-1 space-y-1.5", children: [_jsx(Skeleton, { className: "h-4 w-20" }), _jsx(Skeleton, { className: "h-3 w-40 max-w-full" })] }), _jsx(Skeleton, { className: "h-7 w-20" })] }, index))) })) : apps.length > 0 ? (_jsx("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2", children: apps.map(({ app, description }) => {
|
|
36
|
+
return (_jsxs("div", { className: "mx-auto w-full max-w-[1000px]", children: [launcher.error ? (_jsx(ActionQueryError, { error: launcher.error, onRetry: launcher.retry, className: "mb-3", queryName: launcher.errorQueryName })) : null, _jsxs("section", { "aria-label": t("dispatch.nav.apps"), children: [_jsxs("header", { className: "mb-3 flex flex-wrap items-center justify-between gap-3", children: [_jsx("h2", { className: "text-sm font-semibold text-foreground", children: t("dispatch.nav.apps") }), _jsxs("div", { className: "flex min-w-0 flex-1 items-center justify-end gap-2 sm:flex-none", children: [_jsx(WorkspaceAppSearch, { query: query, onQueryChange: setQuery, className: "w-full max-w-[280px]" }), _jsx(CreateAppPopover, { align: "end", onCreated: launcher.retry, trigger: _jsxs(Button, { type: "button", size: "sm", variant: "outline", children: [_jsx(IconPlus, { size: 16, "aria-hidden": "true" }), t("dispatch.pages.chatFirstNewApp")] }) })] })] }), launcher.isLoading && launcher.workspaceApps.length === 0 ? (_jsx("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2", children: Array.from({ length: 6 }, (_, index) => (_jsxs("div", { className: "flex min-w-0 items-center gap-3 rounded-xl bg-muted/30 px-3 py-2.5", children: [_jsx(Skeleton, { className: "size-7 rounded-lg" }), _jsxs("div", { className: "min-w-0 flex-1 space-y-1.5", children: [_jsx(Skeleton, { className: "h-4 w-20" }), _jsx(Skeleton, { className: "h-3 w-40 max-w-full" })] }), _jsx(Skeleton, { className: "h-7 w-20" })] }, index))) })) : apps.length > 0 ? (_jsx("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2", children: apps.map(({ app, description }) => {
|
|
37
37
|
const href = workspaceAppHref(app);
|
|
38
38
|
return (_jsxs("article", { className: "flex min-w-0 items-center gap-3 rounded-xl bg-muted/30 px-3 py-2.5 transition-colors hover:bg-muted/50", children: [_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [_jsx(AppIcon, { id: app.id, name: app.name, size: "sm" }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate text-sm font-semibold text-foreground", children: app.name }), description ? (_jsx("span", { className: "mt-0.5 block truncate text-xs text-muted-foreground", children: description })) : null] })] }), _jsx(AppOpenActions, { name: app.name, href: href, onOpen: () => launcher.openApp(app), showNewTabOption: Boolean(href), labels: {
|
|
39
39
|
openApp: t("dispatch.pages.openApp", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-home-apps.js","sourceRoot":"","sources":["../../src/components/chat-home-apps.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4DAA4D,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,q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AW,GACP,CACR,CAAC,CAAC,CAAC,IAAI,IACH,IACH,EACN,KAAC,cAAc,IACb,IAAI,EAAE,GAAG,CAAC,IAAI,EACd,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,EACnC,gBAAgB,EAAE,OAAO,CAAC,IAAI,CAAC,EAC/B,MAAM,EAAE;4CACN,OAAO,EAAE,CAAC,CAAC,wBAAwB,EAAE;gDACnC,YAAY,EAAE,MAAM;6CACrB,CAAC;4CACF,iBAAiB,EAAE,CAAC,CAAC,iCAAiC,EAAE;gDACtD,IAAI,EAAE,GAAG,CAAC,IAAI;6CACf,CAAC;4CACF,YAAY,EAAE,CAAC,CAAC,sCAAsC,CAAC;4CACvD,WAAW,EAAE,CAAC,CAAC,uBAAuB,EAAE;gDACtC,IAAI,EAAE,GAAG,CAAC,IAAI;6CACf,CAAC;yCACH,GACD,KAjCG,GAAG,CAAC,EAAE,CAkCH,CACX,CAAC;wBACJ,CAAC,CAAC,GACE,CACP,CAAC,CAAC,CAAC,CACF,KAAC,uBAAuB,IAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAI,CACvE,EACD,MAAC,IAAI,IACH,EAAE,EAAE,qBAAqB,CAAC,OAAO,CAAC,EAClC,SAAS,EAAC,qGAAqG,aAE9G,CAAC,CAAC,wBAAwB,CAAC,EAC5B,KAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,iBAAc,MAAM,GAAG,IAC5C,IACC,IACN,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useT } from \"@agent-native/core/client/i18n\";\nimport { AppOpenActions } from \"@agent-native/toolkit/app/chat/chat-first/app-open-actions\";\nimport { IconArrowUpRight, IconPlus } from \"@tabler/icons-react\";\nimport { useMemo, useState } from \"react\";\nimport { Link } from \"react-router\";\n\nimport {\n orderWorkspaceApps,\n useWorkspaceAppLayout,\n workspaceAppMatchesQuery,\n} from \"../lib/workspace-app-layout\";\nimport { workspaceAppHref } from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { AppIcon } from \"./app-icon\";\nimport { CreateAppPopover } from \"./create-app-popover\";\nimport {\n dispatchNavLinkTarget,\n useDispatchWorkspaceAppLauncher,\n} from \"./layout/Layout\";\nimport { Button } from \"./ui/button\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport {\n WorkspaceAppSearch,\n WorkspaceAppSearchEmpty,\n} from \"./workspace-app-search\";\n\nexport function DispatchChatHomeApps() {\n const t = useT();\n const launcher = useDispatchWorkspaceAppLauncher();\n const { layout } = useWorkspaceAppLayout();\n const [query, setQuery] = useState(\"\");\n const apps = useMemo(\n () =>\n orderWorkspaceApps(launcher?.workspaceApps ?? [], layout)\n .map((app) => ({\n app,\n description: app.defaultDescriptionKey\n ? t(app.defaultDescriptionKey)\n : app.description,\n }))\n .filter(({ app, description }) =>\n workspaceAppMatchesQuery({ ...app, description }, query),\n ),\n [launcher?.workspaceApps, layout, query, t],\n );\n if (!launcher) return null;\n\n if (launcher.error && launcher.workspaceApps.length === 0) {\n return (\n <div className=\"mx-auto w-full max-w-[1000px]\">\n <ActionQueryError error={launcher.error} onRetry={launcher.retry} />\n </div>\n );\n }\n if (!launcher.isLoading && launcher.workspaceApps.length === 0) return null;\n\n return (\n <div className=\"mx-auto w-full max-w-[1000px]\">\n {launcher.error ? (\n <ActionQueryError\n error={launcher.error}\n onRetry={launcher.retry}\n className=\"mb-3\"\n />\n ) : null}\n <section aria-label={t(\"dispatch.nav.apps\")}>\n <header className=\"mb-3 flex flex-wrap items-center justify-between gap-3\">\n <h2 className=\"text-sm font-semibold text-foreground\">\n {t(\"dispatch.nav.apps\")}\n </h2>\n <div className=\"flex min-w-0 flex-1 items-center justify-end gap-2 sm:flex-none\">\n <WorkspaceAppSearch\n query={query}\n onQueryChange={setQuery}\n className=\"w-full max-w-[280px]\"\n />\n <CreateAppPopover\n align=\"end\"\n onCreated={launcher.retry}\n trigger={\n <Button type=\"button\" size=\"sm\" variant=\"outline\">\n <IconPlus size={16} aria-hidden=\"true\" />\n {t(\"dispatch.pages.chatFirstNewApp\")}\n </Button>\n }\n />\n </div>\n </header>\n {launcher.isLoading && launcher.workspaceApps.length === 0 ? (\n <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-2\">\n {Array.from({ length: 6 }, (_, index) => (\n <div\n key={index}\n className=\"flex min-w-0 items-center gap-3 rounded-xl bg-muted/30 px-3 py-2.5\"\n >\n <Skeleton className=\"size-7 rounded-lg\" />\n <div className=\"min-w-0 flex-1 space-y-1.5\">\n <Skeleton className=\"h-4 w-20\" />\n <Skeleton className=\"h-3 w-40 max-w-full\" />\n </div>\n <Skeleton className=\"h-7 w-20\" />\n </div>\n ))}\n </div>\n ) : apps.length > 0 ? (\n <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-2\">\n {apps.map(({ app, description }) => {\n const href = workspaceAppHref(app);\n return (\n <article\n key={app.id}\n className=\"flex min-w-0 items-center gap-3 rounded-xl bg-muted/30 px-3 py-2.5 transition-colors hover:bg-muted/50\"\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n <AppIcon id={app.id} name={app.name} size=\"sm\" />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate text-sm font-semibold text-foreground\">\n {app.name}\n </span>\n {description ? (\n <span className=\"mt-0.5 block truncate text-xs text-muted-foreground\">\n {description}\n </span>\n ) : null}\n </span>\n </div>\n <AppOpenActions\n name={app.name}\n href={href}\n onOpen={() => launcher.openApp(app)}\n showNewTabOption={Boolean(href)}\n labels={{\n openApp: t(\"dispatch.pages.openApp\", {\n defaultValue: \"Open\",\n }),\n openAppAccessible: t(\"dispatch.pages.chatFirstOpenApp\", {\n name: app.name,\n }),\n openInNewTab: t(\"dispatch.pages.chatFirstOpenInNewTab\"),\n moreOptions: t(\"extensions.optionsFor\", {\n name: app.name,\n }),\n }}\n />\n </article>\n );\n })}\n </div>\n ) : (\n <WorkspaceAppSearchEmpty query={query} onClear={() => setQuery(\"\")} />\n )}\n <Link\n to={dispatchNavLinkTarget(\"/apps\")}\n className=\"mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground\"\n >\n {t(\"dispatch.pages.allApps\")}\n <IconArrowUpRight size={14} aria-hidden=\"true\" />\n </Link>\n </section>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chat-home-apps.js","sourceRoot":"","sources":["../../src/components/chat-home-apps.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,4DAA4D,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,qBAAqB,EACrB,+BAA+B,GAChC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,UAAU,oBAAoB;IAClC,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;IACjB,M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AAW,EAAE,CAAC,CAAC,uBAAuB,EAAE;gDACtC,IAAI,EAAE,GAAG,CAAC,IAAI;6CACf,CAAC;yCACH,GACD,KAjCG,GAAG,CAAC,EAAE,CAkCH,CACX,CAAC;wBACJ,CAAC,CAAC,GACE,CACP,CAAC,CAAC,CAAC,CACF,KAAC,uBAAuB,IAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAI,CACvE,EACD,MAAC,IAAI,IACH,EAAE,EAAE,qBAAqB,CAAC,OAAO,CAAC,EAClC,SAAS,EAAC,qGAAqG,aAE9G,CAAC,CAAC,wBAAwB,CAAC,EAC5B,KAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,iBAAc,MAAM,GAAG,IAC5C,IACC,IACN,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useT } from \"@agent-native/core/client/i18n\";\nimport { AppOpenActions } from \"@agent-native/toolkit/app/chat/chat-first/app-open-actions\";\nimport { IconArrowUpRight, IconPlus } from \"@tabler/icons-react\";\nimport { useMemo, useState } from \"react\";\nimport { Link } from \"react-router\";\n\nimport {\n orderWorkspaceApps,\n useWorkspaceAppLayout,\n workspaceAppMatchesQuery,\n} from \"../lib/workspace-app-layout\";\nimport { workspaceAppHref } from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { AppIcon } from \"./app-icon\";\nimport { CreateAppPopover } from \"./create-app-popover\";\nimport {\n dispatchNavLinkTarget,\n useDispatchWorkspaceAppLauncher,\n} from \"./layout/Layout\";\nimport { Button } from \"./ui/button\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport {\n WorkspaceAppSearch,\n WorkspaceAppSearchEmpty,\n} from \"./workspace-app-search\";\n\nexport function DispatchChatHomeApps() {\n const t = useT();\n const launcher = useDispatchWorkspaceAppLauncher();\n const { layout } = useWorkspaceAppLayout();\n const [query, setQuery] = useState(\"\");\n const apps = useMemo(\n () =>\n orderWorkspaceApps(launcher?.workspaceApps ?? [], layout)\n .map((app) => ({\n app,\n description: app.defaultDescriptionKey\n ? t(app.defaultDescriptionKey)\n : app.description,\n }))\n .filter(({ app, description }) =>\n workspaceAppMatchesQuery({ ...app, description }, query),\n ),\n [launcher?.workspaceApps, layout, query, t],\n );\n if (!launcher) return null;\n\n if (launcher.error && launcher.workspaceApps.length === 0) {\n return (\n <div className=\"mx-auto w-full max-w-[1000px]\">\n <ActionQueryError\n error={launcher.error}\n onRetry={launcher.retry}\n queryName={launcher.errorQueryName}\n />\n </div>\n );\n }\n if (!launcher.isLoading && launcher.workspaceApps.length === 0) return null;\n\n return (\n <div className=\"mx-auto w-full max-w-[1000px]\">\n {launcher.error ? (\n <ActionQueryError\n error={launcher.error}\n onRetry={launcher.retry}\n className=\"mb-3\"\n queryName={launcher.errorQueryName}\n />\n ) : null}\n <section aria-label={t(\"dispatch.nav.apps\")}>\n <header className=\"mb-3 flex flex-wrap items-center justify-between gap-3\">\n <h2 className=\"text-sm font-semibold text-foreground\">\n {t(\"dispatch.nav.apps\")}\n </h2>\n <div className=\"flex min-w-0 flex-1 items-center justify-end gap-2 sm:flex-none\">\n <WorkspaceAppSearch\n query={query}\n onQueryChange={setQuery}\n className=\"w-full max-w-[280px]\"\n />\n <CreateAppPopover\n align=\"end\"\n onCreated={launcher.retry}\n trigger={\n <Button type=\"button\" size=\"sm\" variant=\"outline\">\n <IconPlus size={16} aria-hidden=\"true\" />\n {t(\"dispatch.pages.chatFirstNewApp\")}\n </Button>\n }\n />\n </div>\n </header>\n {launcher.isLoading && launcher.workspaceApps.length === 0 ? (\n <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-2\">\n {Array.from({ length: 6 }, (_, index) => (\n <div\n key={index}\n className=\"flex min-w-0 items-center gap-3 rounded-xl bg-muted/30 px-3 py-2.5\"\n >\n <Skeleton className=\"size-7 rounded-lg\" />\n <div className=\"min-w-0 flex-1 space-y-1.5\">\n <Skeleton className=\"h-4 w-20\" />\n <Skeleton className=\"h-3 w-40 max-w-full\" />\n </div>\n <Skeleton className=\"h-7 w-20\" />\n </div>\n ))}\n </div>\n ) : apps.length > 0 ? (\n <div className=\"grid grid-cols-1 gap-2 sm:grid-cols-2\">\n {apps.map(({ app, description }) => {\n const href = workspaceAppHref(app);\n return (\n <article\n key={app.id}\n className=\"flex min-w-0 items-center gap-3 rounded-xl bg-muted/30 px-3 py-2.5 transition-colors hover:bg-muted/50\"\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n <AppIcon id={app.id} name={app.name} size=\"sm\" />\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate text-sm font-semibold text-foreground\">\n {app.name}\n </span>\n {description ? (\n <span className=\"mt-0.5 block truncate text-xs text-muted-foreground\">\n {description}\n </span>\n ) : null}\n </span>\n </div>\n <AppOpenActions\n name={app.name}\n href={href}\n onOpen={() => launcher.openApp(app)}\n showNewTabOption={Boolean(href)}\n labels={{\n openApp: t(\"dispatch.pages.openApp\", {\n defaultValue: \"Open\",\n }),\n openAppAccessible: t(\"dispatch.pages.chatFirstOpenApp\", {\n name: app.name,\n }),\n openInNewTab: t(\"dispatch.pages.chatFirstOpenInNewTab\"),\n moreOptions: t(\"extensions.optionsFor\", {\n name: app.name,\n }),\n }}\n />\n </article>\n );\n })}\n </div>\n ) : (\n <WorkspaceAppSearchEmpty query={query} onClear={() => setQuery(\"\")} />\n )}\n <Link\n to={dispatchNavLinkTarget(\"/apps\")}\n className=\"mt-3 inline-flex items-center gap-1 text-xs font-medium text-muted-foreground hover:text-foreground\"\n >\n {t(\"dispatch.pages.allApps\")}\n <IconArrowUpRight size={14} aria-hidden=\"true\" />\n </Link>\n </section>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"community-apps-section.d.ts","sourceRoot":"","sources":["../../src/components/community-apps-section.tsx"],"names":[],"mappings":"AAsDA,wBAAgB,oBAAoB,oEAyKnC"}
|