@agent-native/dispatch 0.18.0 → 0.19.0
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/dist/actions/create-workspace-resource.d.ts +13 -13
- package/dist/actions/delete-workspace-resource.d.ts +13 -13
- package/dist/actions/grant-vault-secrets-to-app.js +1 -1
- package/dist/actions/grant-vault-secrets-to-app.js.map +1 -1
- package/dist/actions/list-vault-audit.js +1 -1
- package/dist/actions/list-vault-audit.js.map +1 -1
- package/dist/actions/list-vault-secret-options.js +2 -9
- package/dist/actions/list-vault-secret-options.js.map +1 -1
- package/dist/actions/list-vault-secrets.js +1 -1
- package/dist/actions/list-vault-secrets.js.map +1 -1
- package/dist/actions/provider-api-register.d.ts +7 -7
- package/dist/actions/set-app-creation-settings.js +1 -1
- package/dist/actions/set-app-creation-settings.js.map +1 -1
- package/dist/actions/set-vault-access-settings.js +1 -1
- package/dist/actions/set-vault-access-settings.js.map +1 -1
- package/dist/actions/sync-vault-to-app.js +1 -1
- package/dist/actions/sync-vault-to-app.js.map +1 -1
- package/dist/actions/view-screen.js +4 -3
- package/dist/actions/view-screen.js.map +1 -1
- package/dist/components/admin-navigation.d.ts +15 -0
- package/dist/components/admin-navigation.d.ts.map +1 -0
- package/dist/components/admin-navigation.js +174 -0
- package/dist/components/admin-navigation.js.map +1 -0
- package/dist/components/automation-run-history-dialog.js +1 -1
- package/dist/components/automation-run-history-dialog.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/layout/Header.d.ts.map +1 -1
- package/dist/components/layout/Header.js +9 -0
- package/dist/components/layout/Header.js.map +1 -1
- package/dist/components/layout/Layout.d.ts +4 -1
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +14 -117
- package/dist/components/layout/Layout.js.map +1 -1
- package/dist/components/layout/workspace-apps-rail.d.ts +5 -0
- package/dist/components/layout/workspace-apps-rail.d.ts.map +1 -0
- package/dist/components/layout/workspace-apps-rail.js +76 -0
- package/dist/components/layout/workspace-apps-rail.js.map +1 -0
- package/dist/hooks/use-navigation-state.js +39 -16
- package/dist/hooks/use-navigation-state.js.map +1 -1
- package/dist/lib/automation-display.js +1 -1
- package/dist/lib/automation-display.js.map +1 -1
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/routes/index.js +22 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/pages/admin._index.d.ts +5 -0
- package/dist/routes/pages/admin._index.d.ts.map +1 -0
- package/dist/routes/pages/admin._index.js +19 -0
- package/dist/routes/pages/admin._index.js.map +1 -0
- package/dist/routes/pages/admin.d.ts +5 -0
- package/dist/routes/pages/admin.d.ts.map +1 -0
- package/dist/routes/pages/admin.js +10 -0
- package/dist/routes/pages/admin.js.map +1 -0
- package/dist/routes/pages/approval.js +2 -2
- package/dist/routes/pages/approval.js.map +1 -1
- package/dist/routes/pages/apps.$appId.d.ts.map +1 -1
- package/dist/routes/pages/apps.$appId.js +3 -2
- package/dist/routes/pages/apps.$appId.js.map +1 -1
- package/dist/routes/pages/integrations.d.ts.map +1 -1
- package/dist/routes/pages/integrations.js +2 -1
- package/dist/routes/pages/integrations.js.map +1 -1
- package/dist/routes/pages/operations.js +3 -3
- package/dist/routes/pages/operations.js.map +1 -1
- package/dist/routes/pages/settings.d.ts.map +1 -1
- package/dist/routes/pages/settings.js +1 -1
- package/dist/routes/pages/settings.js.map +1 -1
- package/dist/routes/pages/team.js +1 -1
- package/dist/routes/pages/team.js.map +1 -1
- package/dist/routes/pages/transactional-email.$appId.$id.d.ts.map +1 -1
- package/dist/routes/pages/transactional-email.$appId.$id.js +5 -2
- package/dist/routes/pages/transactional-email.$appId.$id.js.map +1 -1
- package/dist/routes/pages/transactional-email.d.ts.map +1 -1
- package/dist/routes/pages/transactional-email.js +6 -2
- package/dist/routes/pages/transactional-email.js.map +1 -1
- package/dist/routes/pages/vault.d.ts.map +1 -1
- package/dist/routes/pages/vault.js +20 -16
- package/dist/routes/pages/vault.js.map +1 -1
- package/dist/server/lib/app-creation-store.js +2 -2
- package/dist/server/lib/app-creation-store.js.map +1 -1
- package/dist/server/lib/thread-debug-store.d.ts.map +1 -1
- package/dist/server/lib/thread-debug-store.js +2 -1
- package/dist/server/lib/thread-debug-store.js.map +1 -1
- package/dist/server/lib/vault-store.d.ts +15 -0
- package/dist/server/lib/vault-store.d.ts.map +1 -1
- package/dist/server/lib/vault-store.js +110 -17
- package/dist/server/lib/vault-store.js.map +1 -1
- package/package.json +3 -3
- package/src/actions/grant-vault-secrets-to-app.ts +1 -1
- package/src/actions/list-vault-audit.ts +1 -1
- package/src/actions/list-vault-secret-options.ts +2 -9
- package/src/actions/list-vault-secrets.ts +1 -1
- package/src/actions/set-app-creation-settings.ts +1 -1
- package/src/actions/set-vault-access-settings.ts +1 -1
- package/src/actions/sync-vault-to-app.ts +1 -1
- package/src/actions/view-screen.spec.ts +1 -0
- package/src/actions/view-screen.ts +5 -3
- package/src/components/admin-navigation.tsx +278 -0
- package/src/components/automation-run-history-dialog.tsx +1 -1
- package/src/components/index.ts +1 -0
- package/src/components/layout/Header.tsx +8 -0
- package/src/components/layout/Layout.spec.tsx +85 -6
- package/src/components/layout/Layout.tsx +62 -206
- package/src/components/layout/workspace-apps-rail.tsx +154 -0
- package/src/hooks/use-navigation-state.spec.ts +11 -0
- package/src/hooks/use-navigation-state.ts +37 -16
- package/src/lib/automation-display.spec.ts +1 -1
- package/src/lib/automation-display.ts +1 -1
- package/src/routes/index.spec.ts +8 -0
- package/src/routes/index.ts +25 -0
- package/src/routes/pages/admin._index.tsx +39 -0
- package/src/routes/pages/admin.tsx +15 -0
- package/src/routes/pages/approval.tsx +2 -2
- package/src/routes/pages/apps.$appId.tsx +7 -2
- package/src/routes/pages/integrations.tsx +3 -2
- package/src/routes/pages/operations.tsx +3 -3
- package/src/routes/pages/settings.tsx +7 -3
- package/src/routes/pages/team.tsx +1 -1
- package/src/routes/pages/transactional-email.$appId.$id.tsx +9 -2
- package/src/routes/pages/transactional-email.tsx +6 -2
- package/src/routes/pages/vault.tsx +152 -89
- package/src/server/lib/app-creation-store.ts +2 -2
- package/src/server/lib/approval-fencing.spec.ts +69 -0
- package/src/server/lib/thread-debug-store.spec.ts +7 -3
- package/src/server/lib/thread-debug-store.ts +2 -1
- package/src/server/lib/vault-store.spec.ts +59 -0
- package/src/server/lib/vault-store.ts +123 -17
|
@@ -6,19 +6,6 @@ declare const _default: import("@agent-native/core").ActionDefinition<{
|
|
|
6
6
|
content: string;
|
|
7
7
|
scope: "all" | "selected";
|
|
8
8
|
}, {
|
|
9
|
-
id: string;
|
|
10
|
-
ownerEmail: string;
|
|
11
|
-
orgId: string | null;
|
|
12
|
-
kind: string;
|
|
13
|
-
name: string;
|
|
14
|
-
description: string | null;
|
|
15
|
-
path: string;
|
|
16
|
-
content: string;
|
|
17
|
-
scope: string;
|
|
18
|
-
createdBy: string;
|
|
19
|
-
createdAt: number;
|
|
20
|
-
updatedAt: number;
|
|
21
|
-
} | {
|
|
22
9
|
id: string;
|
|
23
10
|
ownerEmail: string;
|
|
24
11
|
orgId: string | null;
|
|
@@ -35,6 +22,19 @@ declare const _default: import("@agent-native/core").ActionDefinition<{
|
|
|
35
22
|
reviewedAt: number | null;
|
|
36
23
|
createdAt: number;
|
|
37
24
|
updatedAt: number;
|
|
25
|
+
} | {
|
|
26
|
+
id: string;
|
|
27
|
+
ownerEmail: string;
|
|
28
|
+
orgId: string | null;
|
|
29
|
+
kind: string;
|
|
30
|
+
name: string;
|
|
31
|
+
description: string | null;
|
|
32
|
+
path: string;
|
|
33
|
+
content: string;
|
|
34
|
+
scope: string;
|
|
35
|
+
createdBy: string;
|
|
36
|
+
createdAt: number;
|
|
37
|
+
updatedAt: number;
|
|
38
38
|
}>;
|
|
39
39
|
export default _default;
|
|
40
40
|
//# sourceMappingURL=create-workspace-resource.d.ts.map
|
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
declare const _default: import("@agent-native/core").ActionDefinition<{
|
|
2
2
|
id: string;
|
|
3
3
|
}, {
|
|
4
|
-
id: string;
|
|
5
|
-
ownerEmail: string;
|
|
6
|
-
orgId: string | null;
|
|
7
|
-
kind: string;
|
|
8
|
-
name: string;
|
|
9
|
-
description: string | null;
|
|
10
|
-
path: string;
|
|
11
|
-
content: string;
|
|
12
|
-
scope: string;
|
|
13
|
-
createdBy: string;
|
|
14
|
-
createdAt: number;
|
|
15
|
-
updatedAt: number;
|
|
16
|
-
} | {
|
|
17
4
|
id: string;
|
|
18
5
|
ownerEmail: string;
|
|
19
6
|
orgId: string | null;
|
|
@@ -30,6 +17,19 @@ declare const _default: import("@agent-native/core").ActionDefinition<{
|
|
|
30
17
|
reviewedAt: number | null;
|
|
31
18
|
createdAt: number;
|
|
32
19
|
updatedAt: number;
|
|
20
|
+
} | {
|
|
21
|
+
id: string;
|
|
22
|
+
ownerEmail: string;
|
|
23
|
+
orgId: string | null;
|
|
24
|
+
kind: string;
|
|
25
|
+
name: string;
|
|
26
|
+
description: string | null;
|
|
27
|
+
path: string;
|
|
28
|
+
content: string;
|
|
29
|
+
scope: string;
|
|
30
|
+
createdBy: string;
|
|
31
|
+
createdAt: number;
|
|
32
|
+
updatedAt: number;
|
|
33
33
|
}>;
|
|
34
34
|
export default _default;
|
|
35
35
|
//# sourceMappingURL=delete-workspace-resource.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { defineAction } from "@agent-native/core";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { grantSecretsToApp } from "../server/lib/vault-store.js";
|
|
4
4
|
export default defineAction({
|
|
5
|
-
description: "Grant multiple Dispatch vault secrets to a workspace app in manual vault access mode. Existing active grants are skipped.",
|
|
5
|
+
description: "Grant multiple Dispatch vault secrets to a workspace app in manual vault access mode. Admin only. Existing active grants are skipped.",
|
|
6
6
|
http: { method: "POST" },
|
|
7
7
|
schema: z.object({
|
|
8
8
|
appId: z
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grant-vault-secrets-to-app.js","sourceRoot":"","sources":["../../src/actions/grant-vault-secrets-to-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"grant-vault-secrets-to-app.js","sourceRoot":"","sources":["../../src/actions/grant-vault-secrets-to-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,uIAAuI;IACzI,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;IACxB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,KAAK,CAAC,wBAAwB,CAAC;aAC/B,QAAQ,CAAC,6CAA6C,CAAC;QAC1D,SAAS,EAAE,CAAC;aACT,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;aACjB,GAAG,CAAC,GAAG,CAAC;aACR,QAAQ,CAAC,sCAAsC,CAAC;KACpD,CAAC;IACF,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC;CACnE,CAAC,CAAC","sourcesContent":["import { defineAction } from \"@agent-native/core\";\nimport { z } from \"zod\";\n\nimport { grantSecretsToApp } from \"../server/lib/vault-store.js\";\n\nexport default defineAction({\n description:\n \"Grant multiple Dispatch vault secrets to a workspace app in manual vault access mode. Admin only. Existing active grants are skipped.\",\n http: { method: \"POST\" },\n schema: z.object({\n appId: z\n .string()\n .regex(/^[a-z][a-z0-9-]{0,63}$/)\n .describe(\"Workspace app id/path, e.g. customer-health\"),\n secretIds: z\n .array(z.string())\n .max(100)\n .describe(\"Vault secret IDs to grant to the app\"),\n }),\n run: async (args) => grantSecretsToApp(args.secretIds, args.appId),\n});\n"]}
|
|
@@ -2,7 +2,7 @@ import { defineAction } from "@agent-native/core";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { listVaultAudit } from "../server/lib/vault-store.js";
|
|
4
4
|
export default defineAction({
|
|
5
|
-
description: "View the vault audit log — secret access, grants, syncs, and requests.",
|
|
5
|
+
description: "View the vault audit log — secret access, grants, syncs, and requests. Admin only.",
|
|
6
6
|
schema: z.object({
|
|
7
7
|
limit: z.coerce
|
|
8
8
|
.number()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-vault-audit.js","sourceRoot":"","sources":["../../src/actions/list-vault-audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"list-vault-audit.js","sourceRoot":"","sources":["../../src/actions/list-vault-audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,oFAAoF;IACtF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,KAAK,EAAE,CAAC,CAAC,MAAM;aACZ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,oCAAoC,CAAC;KAClD,CAAC;IACF,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;IACvB,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC;CAChD,CAAC,CAAC","sourcesContent":["import { defineAction } from \"@agent-native/core\";\nimport { z } from \"zod\";\n\nimport { listVaultAudit } from \"../server/lib/vault-store.js\";\n\nexport default defineAction({\n description:\n \"View the vault audit log — secret access, grants, syncs, and requests. Admin only.\",\n schema: z.object({\n limit: z.coerce\n .number()\n .optional()\n .describe(\"Max entries to return (default 50)\"),\n }),\n http: { method: \"GET\" },\n run: async (args) => listVaultAudit(args.limit),\n});\n"]}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import { defineAction } from "@agent-native/core";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import {
|
|
3
|
+
import { listSecretOptions } from "../server/lib/vault-store.js";
|
|
4
4
|
export default defineAction({
|
|
5
5
|
description: "List vault secrets as safe picker options for creating a new app. Does not include secret values.",
|
|
6
6
|
schema: z.object({}),
|
|
7
7
|
http: { method: "GET" },
|
|
8
8
|
run: async () => {
|
|
9
|
-
|
|
10
|
-
return secrets.map((secret) => ({
|
|
11
|
-
id: secret.id,
|
|
12
|
-
name: secret.name,
|
|
13
|
-
credentialKey: secret.credentialKey,
|
|
14
|
-
provider: secret.provider,
|
|
15
|
-
description: secret.description,
|
|
16
|
-
}));
|
|
9
|
+
return listSecretOptions();
|
|
17
10
|
},
|
|
18
11
|
});
|
|
19
12
|
//# sourceMappingURL=list-vault-secret-options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-vault-secret-options.js","sourceRoot":"","sources":["../../src/actions/list-vault-secret-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"list-vault-secret-options.js","sourceRoot":"","sources":["../../src/actions/list-vault-secret-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,mGAAmG;IACrG,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACpB,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;IACvB,GAAG,EAAE,KAAK,IAAI,EAAE;QACd,OAAO,iBAAiB,EAAE,CAAC;IAC7B,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { defineAction } from \"@agent-native/core\";\nimport { z } from \"zod\";\n\nimport { listSecretOptions } from \"../server/lib/vault-store.js\";\n\nexport default defineAction({\n description:\n \"List vault secrets as safe picker options for creating a new app. Does not include secret values.\",\n schema: z.object({}),\n http: { method: \"GET\" },\n run: async () => {\n return listSecretOptions();\n },\n});\n"]}
|
|
@@ -2,7 +2,7 @@ import { defineAction } from "@agent-native/core";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { listSecrets } from "../server/lib/vault-store.js";
|
|
4
4
|
export default defineAction({
|
|
5
|
-
description: "List all secrets stored in the workspace vault. Includes raw values so the UI mask/unmask toggle works — masking is a UI concern, not a data concern. Agent responses should still mask values when echoing them to users.",
|
|
5
|
+
description: "List all secrets stored in the workspace vault. Admin only. Includes raw values so the UI mask/unmask toggle works — masking is a UI concern, not a data concern. Agent responses should still mask values when echoing them to users.",
|
|
6
6
|
schema: z.object({}),
|
|
7
7
|
http: { method: "GET" },
|
|
8
8
|
run: async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-vault-secrets.js","sourceRoot":"","sources":["../../src/actions/list-vault-secrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"list-vault-secrets.js","sourceRoot":"","sources":["../../src/actions/list-vault-secrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,wOAAwO;IAC1O,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACpB,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;IACvB,GAAG,EAAE,KAAK,IAAI,EAAE;QACd,MAAM,OAAO,GAAG,MAAM,WAAW,EAAE,CAAC;QACpC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACzB,EAAE,EAAE,CAAC,CAAC,EAAE;YACR,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,aAAa,EAAE,CAAC,CAAC,aAAa;YAC9B,mEAAmE;YACnE,gEAAgE;YAChE,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,WAAW,EAAE,CAAC,CAAC,WAAW;YAC1B,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,SAAS,EAAE,CAAC,CAAC,SAAS;SACvB,CAAC,CAAC,CAAC;IACN,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { defineAction } from \"@agent-native/core\";\nimport { z } from \"zod\";\n\nimport { listSecrets } from \"../server/lib/vault-store.js\";\n\nexport default defineAction({\n description:\n \"List all secrets stored in the workspace vault. Admin only. Includes raw values so the UI mask/unmask toggle works — masking is a UI concern, not a data concern. Agent responses should still mask values when echoing them to users.\",\n schema: z.object({}),\n http: { method: \"GET\" },\n run: async () => {\n const secrets = await listSecrets();\n return secrets.map((s) => ({\n id: s.id,\n name: s.name,\n credentialKey: s.credentialKey,\n // Included so the vault UI's eye-icon toggle can reveal the stored\n // value. Without this the \"unmask\" click shows an empty string.\n value: s.value,\n provider: s.provider,\n description: s.description,\n createdBy: s.createdBy,\n createdAt: s.createdAt,\n updatedAt: s.updatedAt,\n }));\n },\n});\n"]}
|
|
@@ -47,10 +47,8 @@ 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
|
-
deleted?: undefined;
|
|
51
50
|
id?: undefined;
|
|
52
|
-
|
|
53
|
-
found?: undefined;
|
|
51
|
+
deleted?: undefined;
|
|
54
52
|
providers: {
|
|
55
53
|
id: string;
|
|
56
54
|
label: string;
|
|
@@ -61,13 +59,15 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
61
59
|
updatedAt: number;
|
|
62
60
|
}[];
|
|
63
61
|
count: number;
|
|
62
|
+
provider?: undefined;
|
|
63
|
+
found?: undefined;
|
|
64
64
|
registered?: undefined;
|
|
65
65
|
label?: undefined;
|
|
66
66
|
message?: undefined;
|
|
67
67
|
} | {
|
|
68
|
+
id?: undefined;
|
|
68
69
|
deleted?: undefined;
|
|
69
70
|
count?: undefined;
|
|
70
|
-
id?: undefined;
|
|
71
71
|
providers?: undefined;
|
|
72
72
|
found: boolean;
|
|
73
73
|
provider: import("node_modules/@agent-native/core/dist/provider-api").CustomProviderConfig;
|
|
@@ -77,8 +77,8 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
77
77
|
} | {
|
|
78
78
|
deleted?: undefined;
|
|
79
79
|
count?: undefined;
|
|
80
|
-
provider?: undefined;
|
|
81
80
|
providers?: undefined;
|
|
81
|
+
provider?: undefined;
|
|
82
82
|
found: boolean;
|
|
83
83
|
id: string;
|
|
84
84
|
registered?: undefined;
|
|
@@ -86,9 +86,9 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
86
86
|
message?: undefined;
|
|
87
87
|
} | {
|
|
88
88
|
count?: undefined;
|
|
89
|
+
providers?: undefined;
|
|
89
90
|
provider?: undefined;
|
|
90
91
|
found?: undefined;
|
|
91
|
-
providers?: undefined;
|
|
92
92
|
deleted: boolean;
|
|
93
93
|
id: string;
|
|
94
94
|
registered?: undefined;
|
|
@@ -97,9 +97,9 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
97
97
|
} | {
|
|
98
98
|
deleted?: undefined;
|
|
99
99
|
count?: undefined;
|
|
100
|
+
providers?: undefined;
|
|
100
101
|
provider?: undefined;
|
|
101
102
|
found?: undefined;
|
|
102
|
-
providers?: undefined;
|
|
103
103
|
registered: boolean;
|
|
104
104
|
id: string;
|
|
105
105
|
label: string;
|
|
@@ -2,7 +2,7 @@ import { defineAction } from "@agent-native/core";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { setAppCreationSettings } from "../server/lib/app-creation-store.js";
|
|
4
4
|
export default defineAction({
|
|
5
|
-
description: "Set Dispatch settings for creating new workspace apps, and the Builder project this organization uses for cloud code changes. Stores the project id as an organization-scoped credential; does not write env vars or files.",
|
|
5
|
+
description: "Set Dispatch settings for creating new workspace apps, and the Builder project this organization uses for cloud code changes. Organization owners and admins only. Stores the project id as an organization-scoped credential; does not write env vars or files.",
|
|
6
6
|
schema: z.object({
|
|
7
7
|
builderProjectId: z
|
|
8
8
|
.string()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-app-creation-settings.js","sourceRoot":"","sources":["../../src/actions/set-app-creation-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"set-app-creation-settings.js","sourceRoot":"","sources":["../../src/actions/set-app-creation-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,kQAAkQ;IACpQ,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,gBAAgB,EAAE,CAAC;aAChB,MAAM,EAAE;aACR,IAAI,EAAE;aACN,GAAG,CAAC,CAAC,CAAC;aACN,GAAG,CAAC,GAAG,CAAC;aACR,QAAQ,EAAE;aACV,QAAQ,EAAE;aACV,QAAQ,CACP,6MAA6M,CAC9M;KACJ,CAAC;IACF,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,sBAAsB,CAAC,IAAI,CAAC;CAClD,CAAC,CAAC","sourcesContent":["import { defineAction } from \"@agent-native/core\";\nimport { z } from \"zod\";\n\nimport { setAppCreationSettings } from \"../server/lib/app-creation-store.js\";\n\nexport default defineAction({\n description:\n \"Set Dispatch settings for creating new workspace apps, and the Builder project this organization uses for cloud code changes. Organization owners and admins only. Stores the project id as an organization-scoped credential; does not write env vars or files.\",\n schema: z.object({\n builderProjectId: z\n .string()\n .trim()\n .min(1)\n .max(128)\n .optional()\n .nullable()\n .describe(\n \"Builder project ID used for app-creation branches and for cloud code-change branches across this organization's workspace apps. Pass null to clear it and return those apps to the connect/waitlist prompt.\",\n ),\n }),\n run: async (args) => setAppCreationSettings(args),\n});\n"]}
|
|
@@ -2,7 +2,7 @@ import { defineAction } from "@agent-native/core";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { setVaultAccessSettings } from "../server/lib/vault-store.js";
|
|
4
4
|
export default defineAction({
|
|
5
|
-
description: "Set the Dispatch vault access mode. Use all-apps for the default workspace-wide mode or manual to require explicit per-app grants.",
|
|
5
|
+
description: "Set the Dispatch vault access mode. Admin only. Use all-apps for the default workspace-wide mode or manual to require explicit per-app grants.",
|
|
6
6
|
schema: z.object({
|
|
7
7
|
mode: z
|
|
8
8
|
.enum(["all-apps", "manual"])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-vault-access-settings.js","sourceRoot":"","sources":["../../src/actions/set-vault-access-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"set-vault-access-settings.js","sourceRoot":"","sources":["../../src/actions/set-vault-access-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,gJAAgJ;IAClJ,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC;aACJ,IAAI,CAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;aAC5B,QAAQ,CACP,wEAAwE,CACzE;KACJ,CAAC;IACF,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,sBAAsB,CAAC,IAAI,CAAC;CAClD,CAAC,CAAC","sourcesContent":["import { defineAction } from \"@agent-native/core\";\nimport { z } from \"zod\";\n\nimport { setVaultAccessSettings } from \"../server/lib/vault-store.js\";\n\nexport default defineAction({\n description:\n \"Set the Dispatch vault access mode. Admin only. Use all-apps for the default workspace-wide mode or manual to require explicit per-app grants.\",\n schema: z.object({\n mode: z\n .enum([\"all-apps\", \"manual\"])\n .describe(\n \"all-apps shares every vault key with every app; manual requires grants\",\n ),\n }),\n run: async (args) => setVaultAccessSettings(args),\n});\n"]}
|
|
@@ -2,7 +2,7 @@ import { defineAction } from "@agent-native/core";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { syncGrantsToApp } from "../server/lib/vault-store.js";
|
|
4
4
|
export default defineAction({
|
|
5
|
-
description: "Push vault secrets to an app by calling its env-vars endpoint. In all-apps mode this syncs every vault key; in manual mode it syncs active grants.",
|
|
5
|
+
description: "Push vault secrets to an app by calling its env-vars endpoint. Admin only. In all-apps mode this syncs every vault key; in manual mode it syncs active grants.",
|
|
6
6
|
schema: z.object({
|
|
7
7
|
appId: z
|
|
8
8
|
.string()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-vault-to-app.js","sourceRoot":"","sources":["../../src/actions/sync-vault-to-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"sync-vault-to-app.js","sourceRoot":"","sources":["../../src/actions/sync-vault-to-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,eAAe,YAAY,CAAC;IAC1B,WAAW,EACT,gKAAgK;IAClK,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,CAAC,2DAA2D,CAAC;KACzE,CAAC;IACF,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC;CACjD,CAAC,CAAC","sourcesContent":["import { defineAction } from \"@agent-native/core\";\nimport { z } from \"zod\";\n\nimport { syncGrantsToApp } from \"../server/lib/vault-store.js\";\n\nexport default defineAction({\n description:\n \"Push vault secrets to an app by calling its env-vars endpoint. Admin only. In all-apps mode this syncs every vault key; in manual mode it syncs active grants.\",\n schema: z.object({\n appId: z\n .string()\n .describe(\"App ID to sync secrets to, e.g. mail, calendar, analytics\"),\n }),\n run: async (args) => syncGrantsToApp(args.appId),\n});\n"]}
|
|
@@ -13,7 +13,7 @@ import { listWorkspaceApps } from "../server/lib/app-creation-store.js";
|
|
|
13
13
|
import { listOverview } from "../server/lib/dispatch-store.js";
|
|
14
14
|
import { getAgentThreadDebug, listAgentRunFailures, listThreadDebugSources, searchAgentThreads, } from "../server/lib/thread-debug-store.js";
|
|
15
15
|
import { listDispatchUsageMetrics } from "../server/lib/usage-metrics-store.js";
|
|
16
|
-
import { listVaultOverview,
|
|
16
|
+
import { listVaultOverview, listSecretOptions, listGrants, listRequests, getVaultAccessSettings, canManageVault, } from "../server/lib/vault-store.js";
|
|
17
17
|
import { listWorkspaceResourceOptions, listWorkspaceResourcesForApp, } from "../server/lib/workspace-resources-store.js";
|
|
18
18
|
async function runLocalDispatchAction(name, args) {
|
|
19
19
|
const modulePath = `./${name}.js`;
|
|
@@ -133,9 +133,10 @@ export default defineAction({
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
if (navigation?.view === "vault" || navigation?.view === "new-app") {
|
|
136
|
+
const isVaultAdmin = await canManageVault();
|
|
136
137
|
const [secrets, grants, requests, access] = await Promise.all([
|
|
137
|
-
|
|
138
|
-
listGrants(),
|
|
138
|
+
listSecretOptions(),
|
|
139
|
+
isVaultAdmin ? listGrants() : Promise.resolve([]),
|
|
139
140
|
listRequests({ status: "pending" }),
|
|
140
141
|
getVaultAccessSettings(),
|
|
141
142
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-screen.js","sourceRoot":"","sources":["../../src/actions/view-screen.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,4CAA4C,CAAC;AAEpD,KAAK,UAAU,sBAAsB,CACnC,IAAY,EACZ,IAA6B;IAE7B,MAAM,UAAU,GAAG,KAAK,IAAI,KAAK,CAAC;IAClC,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAI1D,CAAC;IACF,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,IAAI,EAAE,CAA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,MAAM,CAAC,YAAY,GAAG,OAAO,CAAC;gBAC9B,MAAM,CAAC,eAAe,GAAG,UAAU,CAAC;gBACpC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC;gBAC7B,MAAM,CAAC,aAAa,GAAG,QAAQ,CAAC;gBAEhC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,EAAE,CAAC;gBACtC,IAAI,OAAO,EAAE,CAAC;oBACZ,MAAM,CAAC,WAAW,GAAG,MAAM,sBAAsB,CAAC,WAAW,EAAE;wBAC7D,EAAE,EAAE,OAAO;qBACZ,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,WAAW;oBAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrC,OAAO,iDAAiD,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC;CACF,CAAC,CAAC","sourcesContent":["/**\n * See what the user is currently looking at on screen.\n *\n * Reads and returns the current navigation state from application state.\n *\n * Usage:\n * pnpm action view-screen\n */\n\nimport { defineAction } from \"@agent-native/core\";\nimport { readAppState } from \"@agent-native/core/application-state\";\nimport { z } from \"zod\";\n\nimport { listWorkspaceApps } from \"../server/lib/app-creation-store.js\";\nimport { listOverview } from \"../server/lib/dispatch-store.js\";\nimport {\n getAgentThreadDebug,\n listAgentRunFailures,\n listThreadDebugSources,\n searchAgentThreads,\n} from \"../server/lib/thread-debug-store.js\";\nimport { listDispatchUsageMetrics } from \"../server/lib/usage-metrics-store.js\";\nimport {\n listVaultOverview,\n listSecrets,\n listGrants,\n listRequests,\n getVaultAccessSettings,\n} from \"../server/lib/vault-store.js\";\nimport {\n listWorkspaceResourceOptions,\n listWorkspaceResourcesForApp,\n} from \"../server/lib/workspace-resources-store.js\";\n\nasync function runLocalDispatchAction(\n name: string,\n args: Record<string, unknown>,\n) {\n const modulePath = `./${name}.js`;\n const module = (await import(/* @vite-ignore */ modulePath)) as {\n default?: {\n run: (args: Record<string, unknown>) => unknown | Promise<unknown>;\n };\n };\n if (!module.default) throw new Error(`Dispatch action not found: ${name}`);\n return module.default.run(stripUndefined(args));\n}\n\nfunction stripUndefined(args: Record<string, unknown>) {\n return Object.fromEntries(\n Object.entries(args).filter(([, value]) => value !== undefined),\n );\n}\n\nfunction threadDebugLookbackHours(value: unknown): number {\n if (value === \"7d\") return 168;\n if (value === \"30d\") return 720;\n return 24;\n}\n\nfunction threadDebugFailureStatus(\n value: unknown,\n): \"all\" | \"errored\" | \"aborted\" | \"truncated\" {\n return value === \"errored\" || value === \"aborted\" || value === \"truncated\"\n ? value\n : \"all\";\n}\n\nexport default defineAction({\n description:\n \"See what the user is currently looking at in the dispatch UI, including navigation state and a compact operational summary.\",\n schema: z.object({}),\n http: false,\n run: async () => {\n const [navigation, overview, vaultOverview] = await Promise.all([\n readAppState(\"navigation\"),\n listOverview(),\n listVaultOverview(),\n ]);\n\n const screen: Record<string, unknown> = {\n counts: { ...overview.counts, ...vaultOverview },\n approvalPolicy: overview.settings,\n };\n if (navigation) screen.navigation = navigation;\n if (navigation?.view === \"chat\" || navigation?.view === \"browser-chat\") {\n screen.chatSurface = {\n view:\n navigation.view === \"browser-chat\"\n ? \"embedded browser chat\"\n : \"full-page Dispatch chat\",\n purpose:\n \"Create apps, manage workspace resources, route work to connected agents, and continue Dispatch conversations.\",\n };\n }\n if (navigation?.view === \"overview\") {\n screen.recentAudit = overview.recentAudit.slice(0, 5);\n screen.recentApprovals = overview.recentApprovals.slice(0, 5);\n }\n if (navigation?.view === \"destinations\") {\n screen.recentDestinations = overview.recentDestinations;\n }\n if (navigation?.view === \"agents\") {\n const [connectedAgents, mcpAccess] = await Promise.all([\n runLocalDispatchAction(\"list-connected-agents\", {}),\n runLocalDispatchAction(\"list-mcp-app-access\", {}),\n ]);\n screen.connectedAgents = connectedAgents;\n screen.mcpAppAccess = mcpAccess;\n }\n if (navigation?.view === \"operations\") {\n const nav = navigation as { operationsView?: string };\n screen.operatorConsole = {\n view: nav.operationsView === \"database\" ? \"database\" : \"monitoring\",\n monitoring:\n \"The shared observability dashboard provides traces, conversations, evaluations, experiments, and feedback.\",\n database:\n \"The shared database admin is available in Code mode for table browsing and SQL inspection.\",\n relatedTools: [\"thread-debug\", \"audit\", \"destinations\", \"automations\"],\n };\n }\n if (\n navigation?.view === \"overview\" ||\n navigation?.view === \"metrics\" ||\n navigation?.view === \"apps\" ||\n navigation?.view === \"new-app\"\n ) {\n const workspaceApps = await listWorkspaceApps({\n includeAgentCards: true,\n });\n screen.workspaceApps = workspaceApps;\n if (navigation?.view === \"apps\") {\n screen.workspaceAppResources = await Promise.all(\n workspaceApps\n .filter((app) => !app.isDispatch)\n .slice(0, 12)\n .map(async (app) => {\n const result = await listWorkspaceResourcesForApp(app.id);\n return {\n appId: app.id,\n appName: app.name,\n counts: result.counts,\n resources: result.resources.map((resource) => ({\n name: resource.name,\n path: resource.path,\n kind: resource.kind,\n source: resource.source,\n autoLoaded: resource.autoLoaded,\n })),\n };\n }),\n );\n }\n }\n if (navigation?.view === \"metrics\") {\n try {\n const metrics = await listDispatchUsageMetrics({ sinceDays: 30 });\n screen.usageMetrics = {\n billing: metrics.billing,\n totals: metrics.totals,\n byApp: metrics.byApp.slice(0, 8),\n byUser: metrics.byUser.slice(0, 8),\n appAccess: metrics.appAccess\n .filter((app) => !app.isDispatch)\n .slice(0, 8),\n };\n } catch (error) {\n screen.usageMetricsError =\n error instanceof Error ? error.message : String(error);\n }\n }\n if (navigation?.view === \"vault\" || navigation?.view === \"new-app\") {\n const [secrets, grants, requests, access] = await Promise.all([\n listSecrets(),\n listGrants(),\n listRequests({ status: \"pending\" }),\n getVaultAccessSettings(),\n ]);\n screen.vaultAccessMode = access.mode;\n screen.vaultSecrets = secrets.map((s) => ({\n id: s.id,\n name: s.name,\n credentialKey: s.credentialKey,\n provider: s.provider,\n }));\n screen.vaultActiveGrants = grants\n .filter((g) => g.status === \"active\")\n .map((g) => ({ secretId: g.secretId, appId: g.appId }));\n screen.vaultPendingRequests = requests;\n }\n if (navigation?.view === \"workspace\" || navigation?.view === \"new-app\") {\n screen.workspaceResources = await listWorkspaceResourceOptions();\n screen.workspaceResourceEffectiveContext = {\n action: \"get-workspace-resource-effective-context\",\n description:\n \"Preview workspace -> organization/app -> personal precedence for a resource path and optional app/user. All-app resources are inherited at runtime; selected resources are app-specific exceptions.\",\n };\n screen.workspaceResourceImpactPreview = {\n action: \"preview-workspace-resource-change\",\n description:\n \"Preview All-app reach, overrides, and approval behavior before creating, updating, or deleting a workspace resource.\",\n };\n }\n if (navigation?.view === \"thread-debug\") {\n try {\n const nav = navigation as Record<string, any>;\n screen.threadDebugSources = await listThreadDebugSources();\n if (nav.threadDebugMode !== \"threads\") {\n screen.agentRunFailures = await listAgentRunFailures({\n sourceId: nav.sourceId ?? \"all\",\n ownerEmail: nav.ownerEmail,\n status: threadDebugFailureStatus(nav.failureStatus),\n lookbackHours: threadDebugLookbackHours(nav.range),\n limit: 10,\n });\n } else if (nav.query) {\n screen.threadDebugResults = await searchAgentThreads({\n sourceId: nav.sourceId,\n query: nav.query,\n ownerEmail: nav.ownerEmail,\n limit: 10,\n });\n }\n if (nav.threadId || nav.runId) {\n const detail = await getAgentThreadDebug({\n sourceId:\n nav.runId && nav.inspectSourceId\n ? nav.inspectSourceId\n : nav.sourceId,\n threadId: nav.runId ? undefined : nav.threadId,\n runId: nav.runId,\n ownerEmail: nav.ownerEmail,\n maxRuns: 5,\n maxEvents: 80,\n maxTraceSpans: 50,\n });\n screen.threadDebugSelection = {\n source: detail.source,\n thread: detail.thread,\n messageCount: detail.messages.length,\n runCount: detail.runs.length,\n debug: detail.debug,\n debugRuns: (detail as any).debugRuns?.slice(-5) ?? [],\n messages: detail.messages.slice(-6),\n runs: detail.runs\n .slice(0, 5)\n .map(({ events: _events, ...run }) => run),\n };\n }\n } catch (error) {\n screen.threadDebugError =\n error instanceof Error ? error.message : String(error);\n }\n }\n if (navigation?.view === \"dreams\") {\n try {\n const nav = navigation as Record<string, any>;\n const [sources, candidates, dreams, settings] = await Promise.all([\n listThreadDebugSources(),\n runLocalDispatchAction(\"list-dream-candidates\", {\n sourceId: nav.sourceId,\n ownerEmail: nav.ownerEmail,\n limit: 10,\n }),\n runLocalDispatchAction(\"list-dreams\", {\n status: nav.status,\n limit: 10,\n }),\n runLocalDispatchAction(\"get-dream-settings\", {}),\n ]);\n screen.dreamSources = sources;\n screen.dreamCandidates = candidates;\n screen.latestDreams = dreams;\n screen.dreamSettings = settings;\n\n const dreamId = nav.dreamId ?? nav.id;\n if (dreamId) {\n screen.dreamDetail = await runLocalDispatchAction(\"get-dream\", {\n id: dreamId,\n });\n }\n } catch (error) {\n screen.dreamsError =\n error instanceof Error ? error.message : String(error);\n }\n }\n\n if (Object.keys(screen).length === 0) {\n return \"No application state found. Is the app running?\";\n }\n return JSON.stringify(screen, null, 2);\n },\n});\n"]}
|
|
1
|
+
{"version":3,"file":"view-screen.js","sourceRoot":"","sources":["../../src/actions/view-screen.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,GAC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CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrC,OAAO,iDAAiD,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC;CACF,CAAC,CAAC","sourcesContent":["/**\n * See what the user is currently looking at on screen.\n *\n * Reads and returns the current navigation state from application state.\n *\n * Usage:\n * pnpm action view-screen\n */\n\nimport { defineAction } from \"@agent-native/core\";\nimport { readAppState } from \"@agent-native/core/application-state\";\nimport { z } from \"zod\";\n\nimport { listWorkspaceApps } from \"../server/lib/app-creation-store.js\";\nimport { listOverview } from \"../server/lib/dispatch-store.js\";\nimport {\n getAgentThreadDebug,\n listAgentRunFailures,\n listThreadDebugSources,\n searchAgentThreads,\n} from \"../server/lib/thread-debug-store.js\";\nimport { listDispatchUsageMetrics } from \"../server/lib/usage-metrics-store.js\";\nimport {\n listVaultOverview,\n listSecretOptions,\n listGrants,\n listRequests,\n getVaultAccessSettings,\n canManageVault,\n} from \"../server/lib/vault-store.js\";\nimport {\n listWorkspaceResourceOptions,\n listWorkspaceResourcesForApp,\n} from \"../server/lib/workspace-resources-store.js\";\n\nasync function runLocalDispatchAction(\n name: string,\n args: Record<string, unknown>,\n) {\n const modulePath = `./${name}.js`;\n const module = (await import(/* @vite-ignore */ modulePath)) as {\n default?: {\n run: (args: Record<string, unknown>) => unknown | Promise<unknown>;\n };\n };\n if (!module.default) throw new Error(`Dispatch action not found: ${name}`);\n return module.default.run(stripUndefined(args));\n}\n\nfunction stripUndefined(args: Record<string, unknown>) {\n return Object.fromEntries(\n Object.entries(args).filter(([, value]) => value !== undefined),\n );\n}\n\nfunction threadDebugLookbackHours(value: unknown): number {\n if (value === \"7d\") return 168;\n if (value === \"30d\") return 720;\n return 24;\n}\n\nfunction threadDebugFailureStatus(\n value: unknown,\n): \"all\" | \"errored\" | \"aborted\" | \"truncated\" {\n return value === \"errored\" || value === \"aborted\" || value === \"truncated\"\n ? value\n : \"all\";\n}\n\nexport default defineAction({\n description:\n \"See what the user is currently looking at in the dispatch UI, including navigation state and a compact operational summary.\",\n schema: z.object({}),\n http: false,\n run: async () => {\n const [navigation, overview, vaultOverview] = await Promise.all([\n readAppState(\"navigation\"),\n listOverview(),\n listVaultOverview(),\n ]);\n\n const screen: Record<string, unknown> = {\n counts: { ...overview.counts, ...vaultOverview },\n approvalPolicy: overview.settings,\n };\n if (navigation) screen.navigation = navigation;\n if (navigation?.view === \"chat\" || navigation?.view === \"browser-chat\") {\n screen.chatSurface = {\n view:\n navigation.view === \"browser-chat\"\n ? \"embedded browser chat\"\n : \"full-page Dispatch chat\",\n purpose:\n \"Create apps, manage workspace resources, route work to connected agents, and continue Dispatch conversations.\",\n };\n }\n if (navigation?.view === \"overview\") {\n screen.recentAudit = overview.recentAudit.slice(0, 5);\n screen.recentApprovals = overview.recentApprovals.slice(0, 5);\n }\n if (navigation?.view === \"destinations\") {\n screen.recentDestinations = overview.recentDestinations;\n }\n if (navigation?.view === \"agents\") {\n const [connectedAgents, mcpAccess] = await Promise.all([\n runLocalDispatchAction(\"list-connected-agents\", {}),\n runLocalDispatchAction(\"list-mcp-app-access\", {}),\n ]);\n screen.connectedAgents = connectedAgents;\n screen.mcpAppAccess = mcpAccess;\n }\n if (navigation?.view === \"operations\") {\n const nav = navigation as { operationsView?: string };\n screen.operatorConsole = {\n view: nav.operationsView === \"database\" ? \"database\" : \"monitoring\",\n monitoring:\n \"The shared observability dashboard provides traces, conversations, evaluations, experiments, and feedback.\",\n database:\n \"The shared database admin is available in Code mode for table browsing and SQL inspection.\",\n relatedTools: [\"thread-debug\", \"audit\", \"destinations\", \"automations\"],\n };\n }\n if (\n navigation?.view === \"overview\" ||\n navigation?.view === \"metrics\" ||\n navigation?.view === \"apps\" ||\n navigation?.view === \"new-app\"\n ) {\n const workspaceApps = await listWorkspaceApps({\n includeAgentCards: true,\n });\n screen.workspaceApps = workspaceApps;\n if (navigation?.view === \"apps\") {\n screen.workspaceAppResources = await Promise.all(\n workspaceApps\n .filter((app) => !app.isDispatch)\n .slice(0, 12)\n .map(async (app) => {\n const result = await listWorkspaceResourcesForApp(app.id);\n return {\n appId: app.id,\n appName: app.name,\n counts: result.counts,\n resources: result.resources.map((resource) => ({\n name: resource.name,\n path: resource.path,\n kind: resource.kind,\n source: resource.source,\n autoLoaded: resource.autoLoaded,\n })),\n };\n }),\n );\n }\n }\n if (navigation?.view === \"metrics\") {\n try {\n const metrics = await listDispatchUsageMetrics({ sinceDays: 30 });\n screen.usageMetrics = {\n billing: metrics.billing,\n totals: metrics.totals,\n byApp: metrics.byApp.slice(0, 8),\n byUser: metrics.byUser.slice(0, 8),\n appAccess: metrics.appAccess\n .filter((app) => !app.isDispatch)\n .slice(0, 8),\n };\n } catch (error) {\n screen.usageMetricsError =\n error instanceof Error ? error.message : String(error);\n }\n }\n if (navigation?.view === \"vault\" || navigation?.view === \"new-app\") {\n const isVaultAdmin = await canManageVault();\n const [secrets, grants, requests, access] = await Promise.all([\n listSecretOptions(),\n isVaultAdmin ? listGrants() : Promise.resolve([]),\n listRequests({ status: \"pending\" }),\n getVaultAccessSettings(),\n ]);\n screen.vaultAccessMode = access.mode;\n screen.vaultSecrets = secrets.map((s) => ({\n id: s.id,\n name: s.name,\n credentialKey: s.credentialKey,\n provider: s.provider,\n }));\n screen.vaultActiveGrants = grants\n .filter((g) => g.status === \"active\")\n .map((g) => ({ secretId: g.secretId, appId: g.appId }));\n screen.vaultPendingRequests = requests;\n }\n if (navigation?.view === \"workspace\" || navigation?.view === \"new-app\") {\n screen.workspaceResources = await listWorkspaceResourceOptions();\n screen.workspaceResourceEffectiveContext = {\n action: \"get-workspace-resource-effective-context\",\n description:\n \"Preview workspace -> organization/app -> personal precedence for a resource path and optional app/user. All-app resources are inherited at runtime; selected resources are app-specific exceptions.\",\n };\n screen.workspaceResourceImpactPreview = {\n action: \"preview-workspace-resource-change\",\n description:\n \"Preview All-app reach, overrides, and approval behavior before creating, updating, or deleting a workspace resource.\",\n };\n }\n if (navigation?.view === \"thread-debug\") {\n try {\n const nav = navigation as Record<string, any>;\n screen.threadDebugSources = await listThreadDebugSources();\n if (nav.threadDebugMode !== \"threads\") {\n screen.agentRunFailures = await listAgentRunFailures({\n sourceId: nav.sourceId ?? \"all\",\n ownerEmail: nav.ownerEmail,\n status: threadDebugFailureStatus(nav.failureStatus),\n lookbackHours: threadDebugLookbackHours(nav.range),\n limit: 10,\n });\n } else if (nav.query) {\n screen.threadDebugResults = await searchAgentThreads({\n sourceId: nav.sourceId,\n query: nav.query,\n ownerEmail: nav.ownerEmail,\n limit: 10,\n });\n }\n if (nav.threadId || nav.runId) {\n const detail = await getAgentThreadDebug({\n sourceId:\n nav.runId && nav.inspectSourceId\n ? nav.inspectSourceId\n : nav.sourceId,\n threadId: nav.runId ? undefined : nav.threadId,\n runId: nav.runId,\n ownerEmail: nav.ownerEmail,\n maxRuns: 5,\n maxEvents: 80,\n maxTraceSpans: 50,\n });\n screen.threadDebugSelection = {\n source: detail.source,\n thread: detail.thread,\n messageCount: detail.messages.length,\n runCount: detail.runs.length,\n debug: detail.debug,\n debugRuns: (detail as any).debugRuns?.slice(-5) ?? [],\n messages: detail.messages.slice(-6),\n runs: detail.runs\n .slice(0, 5)\n .map(({ events: _events, ...run }) => run),\n };\n }\n } catch (error) {\n screen.threadDebugError =\n error instanceof Error ? error.message : String(error);\n }\n }\n if (navigation?.view === \"dreams\") {\n try {\n const nav = navigation as Record<string, any>;\n const [sources, candidates, dreams, settings] = await Promise.all([\n listThreadDebugSources(),\n runLocalDispatchAction(\"list-dream-candidates\", {\n sourceId: nav.sourceId,\n ownerEmail: nav.ownerEmail,\n limit: 10,\n }),\n runLocalDispatchAction(\"list-dreams\", {\n status: nav.status,\n limit: 10,\n }),\n runLocalDispatchAction(\"get-dream-settings\", {}),\n ]);\n screen.dreamSources = sources;\n screen.dreamCandidates = candidates;\n screen.latestDreams = dreams;\n screen.dreamSettings = settings;\n\n const dreamId = nav.dreamId ?? nav.id;\n if (dreamId) {\n screen.dreamDetail = await runLocalDispatchAction(\"get-dream\", {\n id: dreamId,\n });\n }\n } catch (error) {\n screen.dreamsError =\n error instanceof Error ? error.message : String(error);\n }\n }\n\n if (Object.keys(screen).length === 0) {\n return \"No application state found. Is the app running?\";\n }\n return JSON.stringify(screen, null, 2);\n },\n});\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type DispatchNavItem } from "./layout/Layout.js";
|
|
3
|
+
interface AdminNavGroup {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
labelKey: string;
|
|
7
|
+
items: readonly DispatchNavItem[];
|
|
8
|
+
}
|
|
9
|
+
declare const BUILT_IN_ADMIN_NAV_GROUPS: readonly AdminNavGroup[];
|
|
10
|
+
export declare function AdminShell({ children, onNavigate, }: {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
onNavigate?: () => void;
|
|
13
|
+
}): import("node_modules/@types/react").JSX.Element;
|
|
14
|
+
export { BUILT_IN_ADMIN_NAV_GROUPS };
|
|
15
|
+
//# sourceMappingURL=admin-navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-navigation.d.ts","sourceRoot":"","sources":["../../src/components/admin-navigation.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE9E,UAAU,aAAa;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;CACnC;AAED,QAAA,MAAM,yBAAyB,EAAE,SAAS,aAAa,EAoItD,CAAC;AAwCF,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,mDAiEA;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useT } from "@agent-native/core/client/i18n";
|
|
3
|
+
import { IconActivity, IconArrowUpRight, IconBrain, IconBrandTelegram, IconChartBar, IconFingerprint, IconHistory, IconKey, IconLayersSubtract, IconMail, IconMessages, IconPlugConnected, IconPuzzle, IconSettingsAutomation, IconShield, IconShieldCheck, } from "@tabler/icons-react";
|
|
4
|
+
import { NavLink } from "react-router";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
import { useDispatchExtensions } from "./layout/Layout.js";
|
|
7
|
+
const BUILT_IN_ADMIN_NAV_GROUPS = [
|
|
8
|
+
{
|
|
9
|
+
id: "workspace",
|
|
10
|
+
label: "Workspace",
|
|
11
|
+
labelKey: "dispatch.pages.adminWorkspace",
|
|
12
|
+
items: [
|
|
13
|
+
{
|
|
14
|
+
id: "admin-overview",
|
|
15
|
+
to: "/admin",
|
|
16
|
+
label: "Overview",
|
|
17
|
+
icon: IconShield,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "admin-resources",
|
|
21
|
+
to: "/admin/workspace",
|
|
22
|
+
label: "Resources",
|
|
23
|
+
icon: IconLayersSubtract,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "operations",
|
|
29
|
+
label: "Operations",
|
|
30
|
+
labelKey: "dispatch.pages.adminOperations",
|
|
31
|
+
items: [
|
|
32
|
+
{
|
|
33
|
+
id: "operations",
|
|
34
|
+
to: "/admin/operations",
|
|
35
|
+
label: "Operations",
|
|
36
|
+
icon: IconActivity,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "metrics",
|
|
40
|
+
to: "/admin/metrics",
|
|
41
|
+
label: "Metrics",
|
|
42
|
+
icon: IconChartBar,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "audit",
|
|
46
|
+
to: "/admin/audit",
|
|
47
|
+
label: "Audit",
|
|
48
|
+
icon: IconHistory,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "thread-debug",
|
|
52
|
+
to: "/admin/thread-debug",
|
|
53
|
+
label: "Thread Debug",
|
|
54
|
+
icon: IconMessages,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "automation",
|
|
60
|
+
label: "Automation & delivery",
|
|
61
|
+
labelKey: "dispatch.pages.adminAutomation",
|
|
62
|
+
items: [
|
|
63
|
+
{
|
|
64
|
+
id: "automations",
|
|
65
|
+
to: "/admin/automations",
|
|
66
|
+
label: "Automations",
|
|
67
|
+
icon: IconSettingsAutomation,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: "approvals",
|
|
71
|
+
to: "/admin/approvals",
|
|
72
|
+
label: "Approvals",
|
|
73
|
+
icon: IconShieldCheck,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "destinations",
|
|
77
|
+
to: "/admin/destinations",
|
|
78
|
+
label: "Destinations",
|
|
79
|
+
icon: IconArrowUpRight,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "transactional-email",
|
|
83
|
+
to: "/admin/transactional-email",
|
|
84
|
+
label: "Transactional email",
|
|
85
|
+
icon: IconMail,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "connections",
|
|
91
|
+
label: "Connections",
|
|
92
|
+
labelKey: "dispatch.pages.adminConnections",
|
|
93
|
+
items: [
|
|
94
|
+
{
|
|
95
|
+
id: "integrations",
|
|
96
|
+
to: "/admin/integrations",
|
|
97
|
+
label: "Integrations",
|
|
98
|
+
icon: IconPuzzle,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: "vault",
|
|
102
|
+
to: "/admin/vault",
|
|
103
|
+
label: "Vault",
|
|
104
|
+
icon: IconKey,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: "messaging",
|
|
108
|
+
to: "/admin/messaging",
|
|
109
|
+
label: "Messaging",
|
|
110
|
+
icon: IconBrandTelegram,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: "identities",
|
|
114
|
+
to: "/admin/identities",
|
|
115
|
+
label: "Identities",
|
|
116
|
+
icon: IconFingerprint,
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: "agent-platform",
|
|
122
|
+
label: "Agent platform",
|
|
123
|
+
labelKey: "dispatch.pages.adminAgentPlatform",
|
|
124
|
+
items: [
|
|
125
|
+
{
|
|
126
|
+
id: "agents",
|
|
127
|
+
to: "/admin/agents",
|
|
128
|
+
label: "Agents",
|
|
129
|
+
icon: IconPlugConnected,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: "dreams",
|
|
133
|
+
to: "/admin/dreams",
|
|
134
|
+
label: "Dreams",
|
|
135
|
+
icon: IconBrain,
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
];
|
|
140
|
+
function itemLabel(t, item) {
|
|
141
|
+
return t(`dispatch.nav.${item.id}`, { defaultValue: item.label });
|
|
142
|
+
}
|
|
143
|
+
function AdminNavLink({ item, onNavigate, }) {
|
|
144
|
+
const t = useT();
|
|
145
|
+
const to = item.adminTo ?? item.to;
|
|
146
|
+
const label = itemLabel(t, item);
|
|
147
|
+
const Icon = item.icon;
|
|
148
|
+
return (_jsx("li", { children: _jsxs(NavLink, { to: to, end: item.id === "admin-overview", onClick: onNavigate, className: ({ isActive }) => cn("flex min-h-8 items-center gap-2 rounded-md px-2 text-sm transition-colors", isActive
|
|
149
|
+
? "bg-accent font-medium text-accent-foreground"
|
|
150
|
+
: "text-muted-foreground hover:bg-accent/60 hover:text-foreground"), children: [Icon ? _jsx(Icon, { size: 15, className: "shrink-0" }) : null, _jsx("span", { className: "truncate", children: label })] }) }));
|
|
151
|
+
}
|
|
152
|
+
export function AdminShell({ children, onNavigate, }) {
|
|
153
|
+
const t = useT();
|
|
154
|
+
const extensions = useDispatchExtensions();
|
|
155
|
+
const extensionItems = (extensions?.navItems ?? []).filter((item) => item.section === "operations");
|
|
156
|
+
const groups = extensionItems.length
|
|
157
|
+
? [
|
|
158
|
+
...BUILT_IN_ADMIN_NAV_GROUPS,
|
|
159
|
+
{
|
|
160
|
+
id: "workspace-extensions",
|
|
161
|
+
label: "Workspace extensions",
|
|
162
|
+
labelKey: "dispatch.pages.adminWorkspaceExtensions",
|
|
163
|
+
items: extensionItems,
|
|
164
|
+
},
|
|
165
|
+
]
|
|
166
|
+
: BUILT_IN_ADMIN_NAV_GROUPS;
|
|
167
|
+
return (_jsxs("div", { className: "grid min-w-0 gap-6 lg:grid-cols-[13rem_minmax(0,1fr)]", "data-dispatch-admin-shell": true, children: [_jsxs("aside", { className: "min-w-0 border-b pb-5 lg:sticky lg:top-2 lg:self-start lg:border-b-0 lg:border-e lg:pe-6", children: [_jsxs("div", { className: "px-2", children: [_jsx("div", { className: "text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: t("dispatch.nav.admin", { defaultValue: "Admin" }) }), _jsx("p", { className: "mt-1 text-xs leading-5 text-muted-foreground", children: t("dispatch.pages.adminDescription", {
|
|
168
|
+
defaultValue: "Workspace controls and operations",
|
|
169
|
+
}) })] }), _jsx("nav", { "aria-label": t("dispatch.pages.adminNavigation", {
|
|
170
|
+
defaultValue: "Admin navigation",
|
|
171
|
+
}), className: "mt-5 space-y-5", children: groups.map((group) => (_jsxs("section", { children: [_jsx("h2", { className: "px-2 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/70", children: t(group.labelKey, { defaultValue: group.label }) }), _jsx("ul", { className: "mt-1 space-y-0.5", children: group.items.map((item) => (_jsx(AdminNavLink, { item: item, onNavigate: onNavigate }, item.id))) })] }, group.id))) })] }), _jsx("section", { className: "min-w-0", "data-dispatch-admin-content": true, children: children })] }));
|
|
172
|
+
}
|
|
173
|
+
export { BUILT_IN_ADMIN_NAV_GROUPS };
|
|
174
|
+
//# sourceMappingURL=admin-navigation.js.map
|