@agent-native/dispatch 0.2.10 → 0.2.12
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.js +4 -4
- package/dist/actions/create-workspace-resource.js.map +1 -1
- package/dist/actions/grant-workspace-resources-to-app.d.ts +3 -0
- package/dist/actions/grant-workspace-resources-to-app.d.ts.map +1 -0
- package/dist/actions/grant-workspace-resources-to-app.js +15 -0
- package/dist/actions/grant-workspace-resources-to-app.js.map +1 -0
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +4 -0
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/list-workspace-resource-options.d.ts +3 -0
- package/dist/actions/list-workspace-resource-options.d.ts.map +1 -0
- package/dist/actions/list-workspace-resource-options.js +15 -0
- package/dist/actions/list-workspace-resource-options.js.map +1 -0
- package/dist/actions/list-workspace-resources.js +2 -2
- package/dist/actions/list-workspace-resources.js.map +1 -1
- package/dist/actions/start-workspace-app-creation.d.ts.map +1 -1
- package/dist/actions/start-workspace-app-creation.js +5 -0
- package/dist/actions/start-workspace-app-creation.js.map +1 -1
- package/dist/actions/view-screen.d.ts.map +1 -1
- package/dist/actions/view-screen.js +4 -0
- package/dist/actions/view-screen.js.map +1 -1
- package/dist/components/create-app-popover.d.ts +1 -1
- package/dist/components/create-app-popover.d.ts.map +1 -1
- package/dist/components/create-app-popover.js +63 -20
- package/dist/components/create-app-popover.js.map +1 -1
- package/dist/db/schema.js +2 -2
- package/dist/db/schema.js.map +1 -1
- package/dist/routes/pages/overview.d.ts.map +1 -1
- package/dist/routes/pages/overview.js +6 -6
- package/dist/routes/pages/overview.js.map +1 -1
- package/dist/routes/pages/workspace.d.ts.map +1 -1
- package/dist/routes/pages/workspace.js +17 -6
- package/dist/routes/pages/workspace.js.map +1 -1
- package/dist/server/lib/app-creation-store.d.ts +1 -0
- package/dist/server/lib/app-creation-store.d.ts.map +1 -1
- package/dist/server/lib/app-creation-store.js +33 -0
- package/dist/server/lib/app-creation-store.js.map +1 -1
- package/dist/server/lib/workspace-resources-store.d.ts +29 -1
- package/dist/server/lib/workspace-resources-store.d.ts.map +1 -1
- package/dist/server/lib/workspace-resources-store.js +46 -0
- package/dist/server/lib/workspace-resources-store.js.map +1 -1
- package/package.json +2 -3
- package/src/actions/create-workspace-resource.ts +4 -4
- package/src/actions/grant-workspace-resources-to-app.ts +16 -0
- package/src/actions/index.ts +4 -0
- package/src/actions/list-workspace-resource-options.ts +16 -0
- package/src/actions/list-workspace-resources.ts +2 -2
- package/src/actions/start-workspace-app-creation.ts +7 -0
- package/src/actions/view-screen.ts +4 -0
- package/src/components/create-app-popover.tsx +152 -21
- package/src/db/schema.ts +2 -2
- package/src/routes/pages/overview.tsx +21 -19
- package/src/routes/pages/workspace.tsx +31 -5
- package/src/server/lib/app-creation-store.ts +49 -0
- package/src/server/lib/workspace-resources-store.ts +75 -1
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { useActionMutation, useActionQuery } from "@agent-native/core/client";
|
|
4
4
|
import { toast } from "sonner";
|
|
5
|
-
import { IconBook, IconChevronDown, IconChevronRight, IconCode, IconPlus, IconRefresh, IconTrash, IconUser, IconX, } from "@tabler/icons-react";
|
|
5
|
+
import { IconBook, IconChevronDown, IconChevronRight, IconCode, IconFileText, IconPlus, IconRefresh, IconTrash, IconUser, IconX, } from "@tabler/icons-react";
|
|
6
6
|
import { DispatchShell } from "../../components/dispatch-shell.js";
|
|
7
7
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "../../components/ui/alert-dialog.js";
|
|
8
8
|
import { Badge } from "../../components/ui/badge.js";
|
|
@@ -35,6 +35,12 @@ const KIND_CONFIG = {
|
|
|
35
35
|
pathPrefix: "agents/",
|
|
36
36
|
description: "Reusable agent profiles — specialist agents shared across apps",
|
|
37
37
|
},
|
|
38
|
+
knowledge: {
|
|
39
|
+
label: "Knowledge",
|
|
40
|
+
icon: IconFileText,
|
|
41
|
+
pathPrefix: "context/",
|
|
42
|
+
description: "Knowledge packs — reusable GTM, product, and domain context for apps",
|
|
43
|
+
},
|
|
38
44
|
};
|
|
39
45
|
function AddResourceDialog() {
|
|
40
46
|
const [open, setOpen] = useState(false);
|
|
@@ -58,15 +64,19 @@ function AddResourceDialog() {
|
|
|
58
64
|
onError: (err) => toast.error(String(err)),
|
|
59
65
|
});
|
|
60
66
|
const kindInfo = KIND_CONFIG[kind];
|
|
61
|
-
return (_jsxs(Dialog, { open: open, onOpenChange: setOpen, children: [_jsx(DialogTrigger, { asChild: true, children: _jsxs(Button, { children: [_jsx(IconPlus, { size: 16, className: "mr-1.5" }), "Add resource"] }) }), _jsxs(DialogContent, { className: "max-w-2xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Add workspace resource" }), _jsx(DialogDescription, { children: "Create a skill, instruction, or agent profile that can be shared across workspace apps." })] }), _jsxs("div", { className: "space-y-4 py-2", children: [_jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: "Kind" }), _jsxs(Select, { value: kind, onValueChange: setKind, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "skill", children: "Skill" }), _jsx(SelectItem, { value: "instruction", children: "Instruction" }), _jsx(SelectItem, { value: "agent", children: "Agent" })] })] })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: "Scope" }), _jsxs(Select, { value: scope, onValueChange: setScope, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "all", children: "All apps" }), _jsx(SelectItem, { value: "selected", children: "Selected apps only" })] })] })] })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: "Name" }), _jsx(Input, { placeholder: kind === "skill"
|
|
67
|
+
return (_jsxs(Dialog, { open: open, onOpenChange: setOpen, children: [_jsx(DialogTrigger, { asChild: true, children: _jsxs(Button, { children: [_jsx(IconPlus, { size: 16, className: "mr-1.5" }), "Add resource"] }) }), _jsxs(DialogContent, { className: "max-w-2xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Add workspace resource" }), _jsx(DialogDescription, { children: "Create a skill, instruction, or agent profile that can be shared across workspace apps." })] }), _jsxs("div", { className: "space-y-4 py-2", children: [_jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: "Kind" }), _jsxs(Select, { value: kind, onValueChange: setKind, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "skill", children: "Skill" }), _jsx(SelectItem, { value: "instruction", children: "Instruction" }), _jsx(SelectItem, { value: "agent", children: "Agent" }), _jsx(SelectItem, { value: "knowledge", children: "Knowledge pack" })] })] })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: "Scope" }), _jsxs(Select, { value: scope, onValueChange: setScope, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "all", children: "All apps" }), _jsx(SelectItem, { value: "selected", children: "Selected apps only" })] })] })] })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: "Name" }), _jsx(Input, { placeholder: kind === "skill"
|
|
62
68
|
? "Frontend Designer"
|
|
63
69
|
: kind === "agent"
|
|
64
70
|
? "Research Specialist"
|
|
65
|
-
:
|
|
71
|
+
: kind === "knowledge"
|
|
72
|
+
? "Core GTM Messaging"
|
|
73
|
+
: "Code Style Guide", value: name, onChange: (e) => setName(e.target.value) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: "Path" }), _jsx(Input, { placeholder: `${kindInfo?.pathPrefix || ""}${name.toLowerCase().replace(/\s+/g, "-") || "example"}.md`, value: path, onChange: (e) => setPath(e.target.value), className: "font-mono text-sm" }), _jsx("p", { className: "text-xs text-muted-foreground", children: "Resource path in target apps. Skills go in skills/, agents in agents/, knowledge packs in context/." })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: "Description (optional)" }), _jsx(Input, { placeholder: "Short description of what this resource does", value: description, onChange: (e) => setDescription(e.target.value) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: "Content" }), _jsx(Textarea, { placeholder: kind === "skill"
|
|
66
74
|
? "---\nname: my-skill\ndescription: What this skill teaches\n---\n\n# My Skill\n\n..."
|
|
67
75
|
: kind === "agent"
|
|
68
76
|
? "---\nname: Research Specialist\ndescription: Handles research tasks\n---\n\n# Instructions\n\n..."
|
|
69
|
-
:
|
|
77
|
+
: kind === "knowledge"
|
|
78
|
+
? "# Core GTM Messaging\n\n## Positioning\n\n## ICP\n\n## Proof points\n\n## Source\n\n"
|
|
79
|
+
: "# Instructions\n\nBehavioral rules and guidance for agents across apps...", value: content, onChange: (e) => setContent(e.target.value), rows: 12, className: "font-mono text-sm" })] })] }), _jsx(DialogFooter, { children: _jsx(Button, { onClick: () => create.mutate({
|
|
70
80
|
kind: kind,
|
|
71
81
|
name,
|
|
72
82
|
description: description || undefined,
|
|
@@ -136,14 +146,15 @@ export default function WorkspaceRoute() {
|
|
|
136
146
|
const skills = (resources || []).filter((r) => r.kind === "skill");
|
|
137
147
|
const instructions = (resources || []).filter((r) => r.kind === "instruction");
|
|
138
148
|
const agents = (resources || []).filter((r) => r.kind === "agent");
|
|
149
|
+
const knowledge = (resources || []).filter((r) => r.kind === "knowledge");
|
|
139
150
|
function ResourceList({ items, emptyText, }) {
|
|
140
151
|
if (items.length === 0) {
|
|
141
152
|
return (_jsx("div", { className: "rounded-2xl border border-dashed px-6 py-12 text-center text-sm text-muted-foreground", children: emptyText }));
|
|
142
153
|
}
|
|
143
154
|
return (_jsx("div", { className: "space-y-3", children: items.map((resource) => (_jsx(ResourceRow, { resource: resource, grants: grantsByResource[resource.id] || [] }, resource.id))) }));
|
|
144
155
|
}
|
|
145
|
-
return (_jsxs(DispatchShell, { title: "Workspace Resources", description: "Share skills, instructions,
|
|
156
|
+
return (_jsxs(DispatchShell, { title: "Workspace Resources", description: "Share skills, instructions, agent profiles, and knowledge packs across workspace apps. Scope to all apps or grant per-app.", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "text-sm text-muted-foreground", children: isLoading
|
|
146
157
|
? "Loading..."
|
|
147
|
-
: `${resources?.length || 0} resource${(resources?.length || 0) !== 1 ? "s" : ""}` }), _jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { variant: "outline", onClick: () => syncAll.mutate({}), disabled: syncAll.isPending || (resources?.length || 0) === 0, children: [_jsx(IconRefresh, { size: 16, className: syncAll.isPending ? "mr-1.5 animate-spin" : "mr-1.5" }), "Sync all"] }), _jsx(AddResourceDialog, {})] })] }), _jsxs(Tabs, { defaultValue: "skills", children: [_jsxs(TabsList, { children: [_jsxs(TabsTrigger, { value: "skills", children: ["Skills ", skills.length > 0 && `(${skills.length})`] }), _jsxs(TabsTrigger, { value: "instructions", children: ["Instructions ", instructions.length > 0 && `(${instructions.length})`] }), _jsxs(TabsTrigger, { value: "agents", children: ["Agents ", agents.length > 0 && `(${agents.length})`] })] }), _jsx(TabsContent, { value: "skills", className: "mt-4", children: _jsx(ResourceList, { items: skills, emptyText: "No workspace skills yet. Add a skill to share agent guidance across apps." }) }), _jsx(TabsContent, { value: "instructions", className: "mt-4", children: _jsx(ResourceList, { items: instructions, emptyText: "No workspace instructions yet. Add instructions to set behavioral rules across apps." }) }), _jsx(TabsContent, { value: "agents", className: "mt-4", children: _jsx(ResourceList, { items: agents, emptyText: "No workspace agents yet. Add a reusable agent profile to share specialist agents across apps." }) })] })] }));
|
|
158
|
+
: `${resources?.length || 0} resource${(resources?.length || 0) !== 1 ? "s" : ""}` }), _jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { variant: "outline", onClick: () => syncAll.mutate({}), disabled: syncAll.isPending || (resources?.length || 0) === 0, children: [_jsx(IconRefresh, { size: 16, className: syncAll.isPending ? "mr-1.5 animate-spin" : "mr-1.5" }), "Sync all"] }), _jsx(AddResourceDialog, {})] })] }), _jsxs(Tabs, { defaultValue: "skills", children: [_jsxs(TabsList, { children: [_jsxs(TabsTrigger, { value: "skills", children: ["Skills ", skills.length > 0 && `(${skills.length})`] }), _jsxs(TabsTrigger, { value: "instructions", children: ["Instructions ", instructions.length > 0 && `(${instructions.length})`] }), _jsxs(TabsTrigger, { value: "agents", children: ["Agents ", agents.length > 0 && `(${agents.length})`] }), _jsxs(TabsTrigger, { value: "knowledge", children: ["Knowledge ", knowledge.length > 0 && `(${knowledge.length})`] })] }), _jsx(TabsContent, { value: "skills", className: "mt-4", children: _jsx(ResourceList, { items: skills, emptyText: "No workspace skills yet. Add a skill to share agent guidance across apps." }) }), _jsx(TabsContent, { value: "instructions", className: "mt-4", children: _jsx(ResourceList, { items: instructions, emptyText: "No workspace instructions yet. Add instructions to set behavioral rules across apps." }) }), _jsx(TabsContent, { value: "agents", className: "mt-4", children: _jsx(ResourceList, { items: agents, emptyText: "No workspace agents yet. Add a reusable agent profile to share specialist agents across apps." }) }), _jsx(TabsContent, { value: "knowledge", className: "mt-4", children: _jsx(ResourceList, { items: knowledge, emptyText: "No knowledge packs yet. Add GTM, product, or domain context that apps can reuse." }) })] })] }));
|
|
148
159
|
}
|
|
149
160
|
//# sourceMappingURL=workspace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../src/routes/pages/workspace.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,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,YAC1C,KAAC,YAAY,IACX,KAAK,EAAE,MAAM,EACb,SAAS,EAAC,+FAA+F,GACzG,GACU,IACT,IACO,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import { useState } from \"react\";\nimport { useActionMutation, useActionQuery } from \"@agent-native/core/client\";\nimport { toast } from \"sonner\";\nimport {\n IconBook,\n IconChevronDown,\n IconChevronRight,\n IconCode,\n IconPlus,\n IconRefresh,\n IconTrash,\n IconUser,\n IconX,\n} from \"@tabler/icons-react\";\nimport { DispatchShell } from \"@/components/dispatch-shell\";\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from \"@/components/ui/alert-dialog\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"@/components/ui/dialog\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"@/components/ui/tabs\";\nimport { Textarea } from \"@/components/ui/textarea\";\n\nexport function meta() {\n return [{ title: \"Workspace Resources — Dispatch\" }];\n}\n\nconst KIND_CONFIG = {\n skill: {\n label: \"Skill\",\n icon: IconCode,\n pathPrefix: \"skills/\",\n description: \"Agent skills — detailed guidance for patterns and workflows\",\n },\n instruction: {\n label: \"Instruction\",\n icon: IconBook,\n pathPrefix: \"\",\n description:\n \"Agent instructions — operational rules and behavioral guidance\",\n },\n agent: {\n label: \"Agent\",\n icon: IconUser,\n pathPrefix: \"agents/\",\n description:\n \"Reusable agent profiles — specialist agents shared across apps\",\n },\n} as const;\n\nfunction AddResourceDialog() {\n const [open, setOpen] = useState(false);\n const [kind, setKind] = useState<string>(\"skill\");\n const [name, setName] = useState(\"\");\n const [description, setDescription] = useState(\"\");\n const [path, setPath] = useState(\"\");\n const [content, setContent] = useState(\"\");\n const [scope, setScope] = useState<string>(\"all\");\n\n const create = useActionMutation(\"create-workspace-resource\", {\n onSuccess: () => {\n toast.success(\"Resource created\");\n setOpen(false);\n setKind(\"skill\");\n setName(\"\");\n setDescription(\"\");\n setPath(\"\");\n setContent(\"\");\n setScope(\"all\");\n },\n onError: (err) => toast.error(String(err)),\n });\n\n const kindInfo = KIND_CONFIG[kind as keyof typeof KIND_CONFIG];\n\n return (\n <Dialog open={open} onOpenChange={setOpen}>\n <DialogTrigger asChild>\n <Button>\n <IconPlus size={16} className=\"mr-1.5\" />\n Add resource\n </Button>\n </DialogTrigger>\n <DialogContent className=\"max-w-2xl\">\n <DialogHeader>\n <DialogTitle>Add workspace resource</DialogTitle>\n <DialogDescription>\n Create a skill, instruction, or agent profile that can be shared\n across workspace apps.\n </DialogDescription>\n </DialogHeader>\n <div className=\"space-y-4 py-2\">\n <div className=\"grid grid-cols-2 gap-4\">\n <div className=\"space-y-2\">\n <Label>Kind</Label>\n <Select value={kind} onValueChange={setKind}>\n <SelectTrigger>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"skill\">Skill</SelectItem>\n <SelectItem value=\"instruction\">Instruction</SelectItem>\n <SelectItem value=\"agent\">Agent</SelectItem>\n </SelectContent>\n </Select>\n </div>\n <div className=\"space-y-2\">\n <Label>Scope</Label>\n <Select value={scope} onValueChange={setScope}>\n <SelectTrigger>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"all\">All apps</SelectItem>\n <SelectItem value=\"selected\">Selected apps only</SelectItem>\n </SelectContent>\n </Select>\n </div>\n </div>\n <div className=\"space-y-2\">\n <Label>Name</Label>\n <Input\n placeholder={\n kind === \"skill\"\n ? \"Frontend Designer\"\n : kind === \"agent\"\n ? \"Research Specialist\"\n : \"Code Style Guide\"\n }\n value={name}\n onChange={(e) => setName(e.target.value)}\n />\n </div>\n <div className=\"space-y-2\">\n <Label>Path</Label>\n <Input\n placeholder={`${kindInfo?.pathPrefix || \"\"}${name.toLowerCase().replace(/\\s+/g, \"-\") || \"example\"}.md`}\n value={path}\n onChange={(e) => setPath(e.target.value)}\n className=\"font-mono text-sm\"\n />\n <p className=\"text-xs text-muted-foreground\">\n Resource path in target apps. Skills go in skills/, agents in\n agents/.\n </p>\n </div>\n <div className=\"space-y-2\">\n <Label>Description (optional)</Label>\n <Input\n placeholder=\"Short description of what this resource does\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n />\n </div>\n <div className=\"space-y-2\">\n <Label>Content</Label>\n <Textarea\n placeholder={\n kind === \"skill\"\n ? \"---\\nname: my-skill\\ndescription: What this skill teaches\\n---\\n\\n# My Skill\\n\\n...\"\n : kind === \"agent\"\n ? \"---\\nname: Research Specialist\\ndescription: Handles research tasks\\n---\\n\\n# Instructions\\n\\n...\"\n : \"# Instructions\\n\\nBehavioral rules and guidance for agents across apps...\"\n }\n value={content}\n onChange={(e) => setContent(e.target.value)}\n rows={12}\n className=\"font-mono text-sm\"\n />\n </div>\n </div>\n <DialogFooter>\n <Button\n onClick={() =>\n create.mutate({\n kind: kind as \"skill\" | \"instruction\" | \"agent\",\n name,\n description: description || undefined,\n path:\n path ||\n `${kindInfo?.pathPrefix || \"\"}${name.toLowerCase().replace(/\\s+/g, \"-\")}.md`,\n content,\n scope: scope as \"all\" | \"selected\",\n })\n }\n disabled={!name || !content || create.isPending}\n >\n {create.isPending ? \"Creating...\" : \"Create resource\"}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction GrantDialog({\n resourceId,\n resourceName,\n}: {\n resourceId: string;\n resourceName: string;\n}) {\n const [open, setOpen] = useState(false);\n const [appId, setAppId] = useState(\"\");\n const { data: catalog } = useActionQuery(\"list-integrations-catalog\", {});\n\n const grant = useActionMutation(\"create-workspace-resource-grant\", {\n onSuccess: () => {\n toast.success(`Granted to ${appId}`);\n setOpen(false);\n setAppId(\"\");\n },\n onError: (err) => toast.error(String(err)),\n });\n\n const apps = (catalog || []).map((a: any) => ({\n id: a.appId,\n name: a.appName,\n }));\n\n return (\n <Dialog open={open} onOpenChange={setOpen}>\n <DialogTrigger asChild>\n <Button variant=\"outline\" size=\"sm\">\n <IconPlus size={14} className=\"mr-1\" />\n Grant\n </Button>\n </DialogTrigger>\n <DialogContent>\n <DialogHeader>\n <DialogTitle>Grant \"{resourceName}\" to an app</DialogTitle>\n <DialogDescription>\n Choose which app should receive this resource.\n </DialogDescription>\n </DialogHeader>\n <div className=\"py-2\">\n <Select value={appId} onValueChange={setAppId}>\n <SelectTrigger>\n <SelectValue placeholder=\"Select an app...\" />\n </SelectTrigger>\n <SelectContent>\n {apps.map((app: any) => (\n <SelectItem key={app.id} value={app.id}>\n {app.name}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <DialogFooter>\n <Button\n onClick={() => grant.mutate({ resourceId, appId })}\n disabled={!appId || grant.isPending}\n >\n {grant.isPending ? \"Granting...\" : \"Grant access\"}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction ResourceRow({ resource, grants }: { resource: any; grants: any[] }) {\n const [expanded, setExpanded] = useState(false);\n\n const deleteResource = useActionMutation(\"delete-workspace-resource\", {\n onSuccess: () => toast.success(\"Resource deleted\"),\n onError: (err) => toast.error(String(err)),\n });\n const revokeGrant = useActionMutation(\"revoke-workspace-resource-grant\", {\n onSuccess: () => toast.success(\"Grant revoked\"),\n onError: (err) => toast.error(String(err)),\n });\n const syncToApp = useActionMutation(\"sync-workspace-resources-to-app\", {\n onSuccess: (data: any) =>\n toast.success(`Synced ${data.synced} resource(s) to ${data.appId}`),\n onError: (err) => toast.error(String(err)),\n });\n\n const kindInfo = KIND_CONFIG[resource.kind as keyof typeof KIND_CONFIG];\n const KindIcon = kindInfo?.icon || IconCode;\n const activeGrants = grants.filter((g) => g.status === \"active\");\n\n return (\n <div className=\"rounded-xl border bg-card\">\n <button\n type=\"button\"\n className=\"flex w-full items-center gap-3 px-4 py-3 text-left cursor-pointer\"\n onClick={() => setExpanded(!expanded)}\n >\n {expanded ? (\n <IconChevronDown size={16} className=\"text-muted-foreground\" />\n ) : (\n <IconChevronRight size={16} className=\"text-muted-foreground\" />\n )}\n <KindIcon size={16} className=\"text-muted-foreground\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-medium text-foreground\">\n {resource.name}\n </span>\n <Badge variant=\"secondary\" className=\"text-xs\">\n {kindInfo?.label || resource.kind}\n </Badge>\n <Badge\n variant=\"outline\"\n className={\n resource.scope === \"all\"\n ? \"text-xs bg-green-500/10 text-green-700 dark:text-green-400\"\n : \"text-xs\"\n }\n >\n {resource.scope === \"all\" ? \"All apps\" : \"Selected\"}\n </Badge>\n </div>\n <div className=\"mt-0.5 font-mono text-xs text-muted-foreground\">\n {resource.path}\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n {resource.scope === \"selected\" && (\n <Badge variant=\"outline\" className=\"text-xs\">\n {activeGrants.length} grant\n {activeGrants.length !== 1 ? \"s\" : \"\"}\n </Badge>\n )}\n </div>\n </button>\n\n {expanded && (\n <div className=\"border-t px-4 py-3 space-y-3\">\n {resource.description && (\n <p className=\"text-sm text-muted-foreground\">\n {resource.description}\n </p>\n )}\n\n <div className=\"rounded-lg border bg-muted/30 p-3\">\n <pre className=\"whitespace-pre-wrap text-xs font-mono text-foreground max-h-64 overflow-y-auto\">\n {resource.content}\n </pre>\n </div>\n\n {resource.scope === \"selected\" && (\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between\">\n <span className=\"text-xs font-medium text-foreground\">\n Grants\n </span>\n <GrantDialog\n resourceId={resource.id}\n resourceName={resource.name}\n />\n </div>\n {activeGrants.length > 0 ? (\n <div className=\"space-y-1.5\">\n {activeGrants.map((grant: any) => (\n <div\n key={grant.id}\n className=\"flex items-center justify-between rounded-lg border px-3 py-2\"\n >\n <div>\n <span className=\"text-sm font-medium text-foreground\">\n {grant.appId}\n </span>\n <span className=\"ml-2 text-xs text-muted-foreground\">\n {grant.syncedAt\n ? `synced ${new Date(grant.syncedAt).toLocaleString()}`\n : \"not synced\"}\n </span>\n </div>\n <div className=\"flex gap-1.5\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() =>\n syncToApp.mutate({ appId: grant.appId })\n }\n disabled={syncToApp.isPending}\n >\n <IconRefresh size={14} />\n </Button>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() =>\n revokeGrant.mutate({ grantId: grant.id })\n }\n disabled={revokeGrant.isPending}\n >\n <IconX size={14} />\n </Button>\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div className=\"rounded-lg border border-dashed px-3 py-4 text-center text-xs text-muted-foreground\">\n No grants yet. Grant this resource to specific apps.\n </div>\n )}\n </div>\n )}\n\n <div className=\"flex justify-between border-t pt-3\">\n <div className=\"text-xs text-muted-foreground\">\n Created by {resource.createdBy} ·{\" \"}\n {new Date(resource.createdAt).toLocaleString()}\n </div>\n <AlertDialog>\n <AlertDialogTrigger asChild>\n <Button\n variant=\"destructive\"\n size=\"sm\"\n disabled={deleteResource.isPending}\n >\n <IconTrash size={14} className=\"mr-1\" />\n Delete\n </Button>\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Delete this resource?</AlertDialogTitle>\n <AlertDialogDescription>\n Removing \"{resource.name}\" revokes all of its grants. Apps\n that depended on this resource will lose access on the next\n sync. This cannot be undone.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction\n onClick={() => deleteResource.mutate({ id: resource.id })}\n >\n Delete resource\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n </div>\n )}\n </div>\n );\n}\n\nexport default function WorkspaceRoute() {\n const { data: resources, isLoading } = useActionQuery(\n \"list-workspace-resources\",\n {},\n );\n const { data: grants } = useActionQuery(\"list-workspace-resource-grants\", {});\n\n const syncAll = useActionMutation(\"sync-workspace-resources-to-all\", {\n onSuccess: (data: any) => {\n const total = (data || []).reduce(\n (sum: number, r: any) => sum + r.synced,\n 0,\n );\n toast.success(\n `Synced resources to ${data?.length || 0} apps (${total} total pushes)`,\n );\n },\n onError: (err) => toast.error(String(err)),\n });\n\n const grantsByResource = (grants || []).reduce(\n (acc: Record<string, any[]>, g: any) => {\n if (!acc[g.resourceId]) acc[g.resourceId] = [];\n acc[g.resourceId].push(g);\n return acc;\n },\n {} as Record<string, any[]>,\n );\n\n const skills = (resources || []).filter((r: any) => r.kind === \"skill\");\n const instructions = (resources || []).filter(\n (r: any) => r.kind === \"instruction\",\n );\n const agents = (resources || []).filter((r: any) => r.kind === \"agent\");\n\n function ResourceList({\n items,\n emptyText,\n }: {\n items: any[];\n emptyText: string;\n }) {\n if (items.length === 0) {\n return (\n <div className=\"rounded-2xl border border-dashed px-6 py-12 text-center text-sm text-muted-foreground\">\n {emptyText}\n </div>\n );\n }\n return (\n <div className=\"space-y-3\">\n {items.map((resource: any) => (\n <ResourceRow\n key={resource.id}\n resource={resource}\n grants={grantsByResource[resource.id] || []}\n />\n ))}\n </div>\n );\n }\n\n return (\n <DispatchShell\n title=\"Workspace Resources\"\n description=\"Share skills, instructions, and agent profiles across workspace apps. Scope to all apps or grant per-app.\"\n >\n <div className=\"flex items-center justify-between\">\n <div className=\"text-sm text-muted-foreground\">\n {isLoading\n ? \"Loading...\"\n : `${resources?.length || 0} resource${(resources?.length || 0) !== 1 ? \"s\" : \"\"}`}\n </div>\n <div className=\"flex gap-2\">\n <Button\n variant=\"outline\"\n onClick={() => syncAll.mutate({})}\n disabled={syncAll.isPending || (resources?.length || 0) === 0}\n >\n <IconRefresh\n size={16}\n className={syncAll.isPending ? \"mr-1.5 animate-spin\" : \"mr-1.5\"}\n />\n Sync all\n </Button>\n <AddResourceDialog />\n </div>\n </div>\n\n <Tabs defaultValue=\"skills\">\n <TabsList>\n <TabsTrigger value=\"skills\">\n Skills {skills.length > 0 && `(${skills.length})`}\n </TabsTrigger>\n <TabsTrigger value=\"instructions\">\n Instructions {instructions.length > 0 && `(${instructions.length})`}\n </TabsTrigger>\n <TabsTrigger value=\"agents\">\n Agents {agents.length > 0 && `(${agents.length})`}\n </TabsTrigger>\n </TabsList>\n\n <TabsContent value=\"skills\" className=\"mt-4\">\n <ResourceList\n items={skills}\n emptyText=\"No workspace skills yet. Add a skill to share agent guidance across apps.\"\n />\n </TabsContent>\n\n <TabsContent value=\"instructions\" className=\"mt-4\">\n <ResourceList\n items={instructions}\n emptyText=\"No workspace instructions yet. Add instructions to set behavioral rules across apps.\"\n />\n </TabsContent>\n\n <TabsContent value=\"agents\" className=\"mt-4\">\n <ResourceList\n items={agents}\n emptyText=\"No workspace agents yet. Add a reusable agent profile to share specialist agents across apps.\"\n />\n </TabsContent>\n </Tabs>\n </DispatchShell>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../src/routes/pages/workspace.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EACL,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,SAAS,EACT,QAAQ,EACR,KAAK,GACN,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB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ACb,SAAS,EAAC,2EAA2E,GACrF,GACU,EAEd,KAAC,WAAW,IAAC,KAAK,EAAC,cAAc,EAAC,SAAS,EAAC,MAAM,YAChD,KAAC,YAAY,IACX,KAAK,EAAE,YAAY,EACnB,SAAS,EAAC,sFAAsF,GAChG,GACU,EAEd,KAAC,WAAW,IAAC,KAAK,EAAC,QAAQ,EAAC,SAAS,EAAC,MAAM,YAC1C,KAAC,YAAY,IACX,KAAK,EAAE,MAAM,EACb,SAAS,EAAC,+FAA+F,GACzG,GACU,EAEd,KAAC,WAAW,IAAC,KAAK,EAAC,WAAW,EAAC,SAAS,EAAC,MAAM,YAC7C,KAAC,YAAY,IACX,KAAK,EAAE,SAAS,EAChB,SAAS,EAAC,kFAAkF,GAC5F,GACU,IACT,IACO,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import { useState } from \"react\";\nimport { useActionMutation, useActionQuery } from \"@agent-native/core/client\";\nimport { toast } from \"sonner\";\nimport {\n IconBook,\n IconChevronDown,\n IconChevronRight,\n IconCode,\n IconFileText,\n IconPlus,\n IconRefresh,\n IconTrash,\n IconUser,\n IconX,\n} from \"@tabler/icons-react\";\nimport { DispatchShell } from \"@/components/dispatch-shell\";\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from \"@/components/ui/alert-dialog\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n DialogTrigger,\n} from \"@/components/ui/dialog\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@/components/ui/select\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"@/components/ui/tabs\";\nimport { Textarea } from \"@/components/ui/textarea\";\n\nexport function meta() {\n return [{ title: \"Workspace Resources — Dispatch\" }];\n}\n\nconst KIND_CONFIG = {\n skill: {\n label: \"Skill\",\n icon: IconCode,\n pathPrefix: \"skills/\",\n description: \"Agent skills — detailed guidance for patterns and workflows\",\n },\n instruction: {\n label: \"Instruction\",\n icon: IconBook,\n pathPrefix: \"\",\n description:\n \"Agent instructions — operational rules and behavioral guidance\",\n },\n agent: {\n label: \"Agent\",\n icon: IconUser,\n pathPrefix: \"agents/\",\n description:\n \"Reusable agent profiles — specialist agents shared across apps\",\n },\n knowledge: {\n label: \"Knowledge\",\n icon: IconFileText,\n pathPrefix: \"context/\",\n description:\n \"Knowledge packs — reusable GTM, product, and domain context for apps\",\n },\n} as const;\n\nfunction AddResourceDialog() {\n const [open, setOpen] = useState(false);\n const [kind, setKind] = useState<string>(\"skill\");\n const [name, setName] = useState(\"\");\n const [description, setDescription] = useState(\"\");\n const [path, setPath] = useState(\"\");\n const [content, setContent] = useState(\"\");\n const [scope, setScope] = useState<string>(\"all\");\n\n const create = useActionMutation(\"create-workspace-resource\", {\n onSuccess: () => {\n toast.success(\"Resource created\");\n setOpen(false);\n setKind(\"skill\");\n setName(\"\");\n setDescription(\"\");\n setPath(\"\");\n setContent(\"\");\n setScope(\"all\");\n },\n onError: (err) => toast.error(String(err)),\n });\n\n const kindInfo = KIND_CONFIG[kind as keyof typeof KIND_CONFIG];\n\n return (\n <Dialog open={open} onOpenChange={setOpen}>\n <DialogTrigger asChild>\n <Button>\n <IconPlus size={16} className=\"mr-1.5\" />\n Add resource\n </Button>\n </DialogTrigger>\n <DialogContent className=\"max-w-2xl\">\n <DialogHeader>\n <DialogTitle>Add workspace resource</DialogTitle>\n <DialogDescription>\n Create a skill, instruction, or agent profile that can be shared\n across workspace apps.\n </DialogDescription>\n </DialogHeader>\n <div className=\"space-y-4 py-2\">\n <div className=\"grid grid-cols-2 gap-4\">\n <div className=\"space-y-2\">\n <Label>Kind</Label>\n <Select value={kind} onValueChange={setKind}>\n <SelectTrigger>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"skill\">Skill</SelectItem>\n <SelectItem value=\"instruction\">Instruction</SelectItem>\n <SelectItem value=\"agent\">Agent</SelectItem>\n <SelectItem value=\"knowledge\">Knowledge pack</SelectItem>\n </SelectContent>\n </Select>\n </div>\n <div className=\"space-y-2\">\n <Label>Scope</Label>\n <Select value={scope} onValueChange={setScope}>\n <SelectTrigger>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"all\">All apps</SelectItem>\n <SelectItem value=\"selected\">Selected apps only</SelectItem>\n </SelectContent>\n </Select>\n </div>\n </div>\n <div className=\"space-y-2\">\n <Label>Name</Label>\n <Input\n placeholder={\n kind === \"skill\"\n ? \"Frontend Designer\"\n : kind === \"agent\"\n ? \"Research Specialist\"\n : kind === \"knowledge\"\n ? \"Core GTM Messaging\"\n : \"Code Style Guide\"\n }\n value={name}\n onChange={(e) => setName(e.target.value)}\n />\n </div>\n <div className=\"space-y-2\">\n <Label>Path</Label>\n <Input\n placeholder={`${kindInfo?.pathPrefix || \"\"}${name.toLowerCase().replace(/\\s+/g, \"-\") || \"example\"}.md`}\n value={path}\n onChange={(e) => setPath(e.target.value)}\n className=\"font-mono text-sm\"\n />\n <p className=\"text-xs text-muted-foreground\">\n Resource path in target apps. Skills go in skills/, agents in\n agents/, knowledge packs in context/.\n </p>\n </div>\n <div className=\"space-y-2\">\n <Label>Description (optional)</Label>\n <Input\n placeholder=\"Short description of what this resource does\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n />\n </div>\n <div className=\"space-y-2\">\n <Label>Content</Label>\n <Textarea\n placeholder={\n kind === \"skill\"\n ? \"---\\nname: my-skill\\ndescription: What this skill teaches\\n---\\n\\n# My Skill\\n\\n...\"\n : kind === \"agent\"\n ? \"---\\nname: Research Specialist\\ndescription: Handles research tasks\\n---\\n\\n# Instructions\\n\\n...\"\n : kind === \"knowledge\"\n ? \"# Core GTM Messaging\\n\\n## Positioning\\n\\n## ICP\\n\\n## Proof points\\n\\n## Source\\n\\n\"\n : \"# Instructions\\n\\nBehavioral rules and guidance for agents across apps...\"\n }\n value={content}\n onChange={(e) => setContent(e.target.value)}\n rows={12}\n className=\"font-mono text-sm\"\n />\n </div>\n </div>\n <DialogFooter>\n <Button\n onClick={() =>\n create.mutate({\n kind: kind as \"skill\" | \"instruction\" | \"agent\" | \"knowledge\",\n name,\n description: description || undefined,\n path:\n path ||\n `${kindInfo?.pathPrefix || \"\"}${name.toLowerCase().replace(/\\s+/g, \"-\")}.md`,\n content,\n scope: scope as \"all\" | \"selected\",\n })\n }\n disabled={!name || !content || create.isPending}\n >\n {create.isPending ? \"Creating...\" : \"Create resource\"}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction GrantDialog({\n resourceId,\n resourceName,\n}: {\n resourceId: string;\n resourceName: string;\n}) {\n const [open, setOpen] = useState(false);\n const [appId, setAppId] = useState(\"\");\n const { data: catalog } = useActionQuery(\"list-integrations-catalog\", {});\n\n const grant = useActionMutation(\"create-workspace-resource-grant\", {\n onSuccess: () => {\n toast.success(`Granted to ${appId}`);\n setOpen(false);\n setAppId(\"\");\n },\n onError: (err) => toast.error(String(err)),\n });\n\n const apps = (catalog || []).map((a: any) => ({\n id: a.appId,\n name: a.appName,\n }));\n\n return (\n <Dialog open={open} onOpenChange={setOpen}>\n <DialogTrigger asChild>\n <Button variant=\"outline\" size=\"sm\">\n <IconPlus size={14} className=\"mr-1\" />\n Grant\n </Button>\n </DialogTrigger>\n <DialogContent>\n <DialogHeader>\n <DialogTitle>Grant \"{resourceName}\" to an app</DialogTitle>\n <DialogDescription>\n Choose which app should receive this resource.\n </DialogDescription>\n </DialogHeader>\n <div className=\"py-2\">\n <Select value={appId} onValueChange={setAppId}>\n <SelectTrigger>\n <SelectValue placeholder=\"Select an app...\" />\n </SelectTrigger>\n <SelectContent>\n {apps.map((app: any) => (\n <SelectItem key={app.id} value={app.id}>\n {app.name}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <DialogFooter>\n <Button\n onClick={() => grant.mutate({ resourceId, appId })}\n disabled={!appId || grant.isPending}\n >\n {grant.isPending ? \"Granting...\" : \"Grant access\"}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n\nfunction ResourceRow({ resource, grants }: { resource: any; grants: any[] }) {\n const [expanded, setExpanded] = useState(false);\n\n const deleteResource = useActionMutation(\"delete-workspace-resource\", {\n onSuccess: () => toast.success(\"Resource deleted\"),\n onError: (err) => toast.error(String(err)),\n });\n const revokeGrant = useActionMutation(\"revoke-workspace-resource-grant\", {\n onSuccess: () => toast.success(\"Grant revoked\"),\n onError: (err) => toast.error(String(err)),\n });\n const syncToApp = useActionMutation(\"sync-workspace-resources-to-app\", {\n onSuccess: (data: any) =>\n toast.success(`Synced ${data.synced} resource(s) to ${data.appId}`),\n onError: (err) => toast.error(String(err)),\n });\n\n const kindInfo = KIND_CONFIG[resource.kind as keyof typeof KIND_CONFIG];\n const KindIcon = kindInfo?.icon || IconCode;\n const activeGrants = grants.filter((g) => g.status === \"active\");\n\n return (\n <div className=\"rounded-xl border bg-card\">\n <button\n type=\"button\"\n className=\"flex w-full items-center gap-3 px-4 py-3 text-left cursor-pointer\"\n onClick={() => setExpanded(!expanded)}\n >\n {expanded ? (\n <IconChevronDown size={16} className=\"text-muted-foreground\" />\n ) : (\n <IconChevronRight size={16} className=\"text-muted-foreground\" />\n )}\n <KindIcon size={16} className=\"text-muted-foreground\" />\n <div className=\"min-w-0 flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-medium text-foreground\">\n {resource.name}\n </span>\n <Badge variant=\"secondary\" className=\"text-xs\">\n {kindInfo?.label || resource.kind}\n </Badge>\n <Badge\n variant=\"outline\"\n className={\n resource.scope === \"all\"\n ? \"text-xs bg-green-500/10 text-green-700 dark:text-green-400\"\n : \"text-xs\"\n }\n >\n {resource.scope === \"all\" ? \"All apps\" : \"Selected\"}\n </Badge>\n </div>\n <div className=\"mt-0.5 font-mono text-xs text-muted-foreground\">\n {resource.path}\n </div>\n </div>\n <div className=\"flex items-center gap-2\">\n {resource.scope === \"selected\" && (\n <Badge variant=\"outline\" className=\"text-xs\">\n {activeGrants.length} grant\n {activeGrants.length !== 1 ? \"s\" : \"\"}\n </Badge>\n )}\n </div>\n </button>\n\n {expanded && (\n <div className=\"border-t px-4 py-3 space-y-3\">\n {resource.description && (\n <p className=\"text-sm text-muted-foreground\">\n {resource.description}\n </p>\n )}\n\n <div className=\"rounded-lg border bg-muted/30 p-3\">\n <pre className=\"whitespace-pre-wrap text-xs font-mono text-foreground max-h-64 overflow-y-auto\">\n {resource.content}\n </pre>\n </div>\n\n {resource.scope === \"selected\" && (\n <div className=\"space-y-2\">\n <div className=\"flex items-center justify-between\">\n <span className=\"text-xs font-medium text-foreground\">\n Grants\n </span>\n <GrantDialog\n resourceId={resource.id}\n resourceName={resource.name}\n />\n </div>\n {activeGrants.length > 0 ? (\n <div className=\"space-y-1.5\">\n {activeGrants.map((grant: any) => (\n <div\n key={grant.id}\n className=\"flex items-center justify-between rounded-lg border px-3 py-2\"\n >\n <div>\n <span className=\"text-sm font-medium text-foreground\">\n {grant.appId}\n </span>\n <span className=\"ml-2 text-xs text-muted-foreground\">\n {grant.syncedAt\n ? `synced ${new Date(grant.syncedAt).toLocaleString()}`\n : \"not synced\"}\n </span>\n </div>\n <div className=\"flex gap-1.5\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() =>\n syncToApp.mutate({ appId: grant.appId })\n }\n disabled={syncToApp.isPending}\n >\n <IconRefresh size={14} />\n </Button>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() =>\n revokeGrant.mutate({ grantId: grant.id })\n }\n disabled={revokeGrant.isPending}\n >\n <IconX size={14} />\n </Button>\n </div>\n </div>\n ))}\n </div>\n ) : (\n <div className=\"rounded-lg border border-dashed px-3 py-4 text-center text-xs text-muted-foreground\">\n No grants yet. Grant this resource to specific apps.\n </div>\n )}\n </div>\n )}\n\n <div className=\"flex justify-between border-t pt-3\">\n <div className=\"text-xs text-muted-foreground\">\n Created by {resource.createdBy} ·{\" \"}\n {new Date(resource.createdAt).toLocaleString()}\n </div>\n <AlertDialog>\n <AlertDialogTrigger asChild>\n <Button\n variant=\"destructive\"\n size=\"sm\"\n disabled={deleteResource.isPending}\n >\n <IconTrash size={14} className=\"mr-1\" />\n Delete\n </Button>\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Delete this resource?</AlertDialogTitle>\n <AlertDialogDescription>\n Removing \"{resource.name}\" revokes all of its grants. Apps\n that depended on this resource will lose access on the next\n sync. This cannot be undone.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction\n onClick={() => deleteResource.mutate({ id: resource.id })}\n >\n Delete resource\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n </div>\n )}\n </div>\n );\n}\n\nexport default function WorkspaceRoute() {\n const { data: resources, isLoading } = useActionQuery(\n \"list-workspace-resources\",\n {},\n );\n const { data: grants } = useActionQuery(\"list-workspace-resource-grants\", {});\n\n const syncAll = useActionMutation(\"sync-workspace-resources-to-all\", {\n onSuccess: (data: any) => {\n const total = (data || []).reduce(\n (sum: number, r: any) => sum + r.synced,\n 0,\n );\n toast.success(\n `Synced resources to ${data?.length || 0} apps (${total} total pushes)`,\n );\n },\n onError: (err) => toast.error(String(err)),\n });\n\n const grantsByResource = (grants || []).reduce(\n (acc: Record<string, any[]>, g: any) => {\n if (!acc[g.resourceId]) acc[g.resourceId] = [];\n acc[g.resourceId].push(g);\n return acc;\n },\n {} as Record<string, any[]>,\n );\n\n const skills = (resources || []).filter((r: any) => r.kind === \"skill\");\n const instructions = (resources || []).filter(\n (r: any) => r.kind === \"instruction\",\n );\n const agents = (resources || []).filter((r: any) => r.kind === \"agent\");\n const knowledge = (resources || []).filter(\n (r: any) => r.kind === \"knowledge\",\n );\n\n function ResourceList({\n items,\n emptyText,\n }: {\n items: any[];\n emptyText: string;\n }) {\n if (items.length === 0) {\n return (\n <div className=\"rounded-2xl border border-dashed px-6 py-12 text-center text-sm text-muted-foreground\">\n {emptyText}\n </div>\n );\n }\n return (\n <div className=\"space-y-3\">\n {items.map((resource: any) => (\n <ResourceRow\n key={resource.id}\n resource={resource}\n grants={grantsByResource[resource.id] || []}\n />\n ))}\n </div>\n );\n }\n\n return (\n <DispatchShell\n title=\"Workspace Resources\"\n description=\"Share skills, instructions, agent profiles, and knowledge packs across workspace apps. Scope to all apps or grant per-app.\"\n >\n <div className=\"flex items-center justify-between\">\n <div className=\"text-sm text-muted-foreground\">\n {isLoading\n ? \"Loading...\"\n : `${resources?.length || 0} resource${(resources?.length || 0) !== 1 ? \"s\" : \"\"}`}\n </div>\n <div className=\"flex gap-2\">\n <Button\n variant=\"outline\"\n onClick={() => syncAll.mutate({})}\n disabled={syncAll.isPending || (resources?.length || 0) === 0}\n >\n <IconRefresh\n size={16}\n className={syncAll.isPending ? \"mr-1.5 animate-spin\" : \"mr-1.5\"}\n />\n Sync all\n </Button>\n <AddResourceDialog />\n </div>\n </div>\n\n <Tabs defaultValue=\"skills\">\n <TabsList>\n <TabsTrigger value=\"skills\">\n Skills {skills.length > 0 && `(${skills.length})`}\n </TabsTrigger>\n <TabsTrigger value=\"instructions\">\n Instructions {instructions.length > 0 && `(${instructions.length})`}\n </TabsTrigger>\n <TabsTrigger value=\"agents\">\n Agents {agents.length > 0 && `(${agents.length})`}\n </TabsTrigger>\n <TabsTrigger value=\"knowledge\">\n Knowledge {knowledge.length > 0 && `(${knowledge.length})`}\n </TabsTrigger>\n </TabsList>\n\n <TabsContent value=\"skills\" className=\"mt-4\">\n <ResourceList\n items={skills}\n emptyText=\"No workspace skills yet. Add a skill to share agent guidance across apps.\"\n />\n </TabsContent>\n\n <TabsContent value=\"instructions\" className=\"mt-4\">\n <ResourceList\n items={instructions}\n emptyText=\"No workspace instructions yet. Add instructions to set behavioral rules across apps.\"\n />\n </TabsContent>\n\n <TabsContent value=\"agents\" className=\"mt-4\">\n <ResourceList\n items={agents}\n emptyText=\"No workspace agents yet. Add a reusable agent profile to share specialist agents across apps.\"\n />\n </TabsContent>\n\n <TabsContent value=\"knowledge\" className=\"mt-4\">\n <ResourceList\n items={knowledge}\n emptyText=\"No knowledge packs yet. Add GTM, product, or domain context that apps can reuse.\"\n />\n </TabsContent>\n </Tabs>\n </DispatchShell>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-creation-store.d.ts","sourceRoot":"","sources":["../../../src/server/lib/app-creation-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-creation-store.d.ts","sourceRoot":"","sources":["../../../src/server/lib/app-creation-store.ts"],"names":[],"mappings":"AAmCA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM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AC;IACzB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgIA"}
|
|
@@ -8,6 +8,7 @@ import { assertValidWorkspaceAppId } from "@agent-native/core/shared";
|
|
|
8
8
|
import { currentOrgId, currentOwnerEmail, recordAudit, resolveLinkedOwner, } from "./dispatch-store.js";
|
|
9
9
|
import { identityKeyForIncoming } from "./dispatch-integrations.js";
|
|
10
10
|
import { createRequest, listSecrets } from "./vault-store.js";
|
|
11
|
+
import { grantWorkspaceResourcesToApp, listWorkspaceResourceOptions, } from "./workspace-resources-store.js";
|
|
11
12
|
const SETTINGS_KEY = "dispatch-app-creation-settings";
|
|
12
13
|
const WORKSPACE_APPS_ENV_KEY = "AGENT_NATIVE_WORKSPACE_APPS_JSON";
|
|
13
14
|
const WORKSPACE_APPS_MANIFEST_FILE = "workspace-apps.json";
|
|
@@ -646,6 +647,12 @@ function buildWorkspaceAppPrompt(input) {
|
|
|
646
647
|
slugify(input.prompt.replace(/\b(build|create|make|an?|the|app|tool)\b/gi, " ")) ||
|
|
647
648
|
"new-app";
|
|
648
649
|
const selectedKeys = input.selectedKeys || [];
|
|
650
|
+
const selectedResources = input.selectedResources || [];
|
|
651
|
+
const resourceList = selectedResources.length
|
|
652
|
+
? selectedResources
|
|
653
|
+
.map((resource) => `- ${resource.name} (${resource.kind}, ${resource.path})`)
|
|
654
|
+
.join("\n")
|
|
655
|
+
: "none";
|
|
649
656
|
return {
|
|
650
657
|
appId,
|
|
651
658
|
prompt: [
|
|
@@ -657,11 +664,15 @@ function buildWorkspaceAppPrompt(input) {
|
|
|
657
664
|
selectedKeys.length
|
|
658
665
|
? `Dispatch vault keys selected for this app: ${selectedKeys.join(", ")}`
|
|
659
666
|
: "Dispatch vault keys selected for this app: none",
|
|
667
|
+
`Dispatch workspace resources selected for this app:\n${resourceList}`,
|
|
660
668
|
"",
|
|
661
669
|
`Use the workspace app layout: create it under apps/${appId}, mount it at /${appId}, keep it on the shared workspace database/hosting model, and avoid table-name collisions by namespacing any new domain tables to the app.`,
|
|
662
670
|
selectedKeys.length
|
|
663
671
|
? `Dispatch will create pending vault requests for the selected keys for appId "${appId}" after this app creation request is accepted. Do not grant or sync vault keys directly from the app-creation branch.`
|
|
664
672
|
: "Do not grant or request any Dispatch vault keys unless the user asks later.",
|
|
673
|
+
selectedResources.length
|
|
674
|
+
? `Dispatch will create workspace resource grants for the selected resources for appId "${appId}". After the app exists, sync workspace resources so the app receives those shared resources. Add a short note to apps/${appId}/AGENTS.md telling the app agent to read relevant shared resources under context/ or the selected resource paths before doing GTM/domain work.`
|
|
675
|
+
: "Do not grant any Dispatch workspace resources unless the user asks later.",
|
|
665
676
|
"",
|
|
666
677
|
"Agent-native rules (these are the framework's contract — not optional):",
|
|
667
678
|
`- Persist ALL data in SQL via Drizzle. Add tables to apps/${appId}/server/db/schema.ts and migrations to apps/${appId}/server/plugins/db.ts. NEVER use localStorage, sessionStorage, IndexedDB, or in-memory state for anything the user expects to persist — agent and UI must read the same source of truth.`,
|
|
@@ -691,6 +702,18 @@ async function requestSelectedVaultKeys(input) {
|
|
|
691
702
|
reason: `Requested during workspace app creation for ${input.appId}.`,
|
|
692
703
|
}))));
|
|
693
704
|
}
|
|
705
|
+
async function selectedWorkspaceResourcesForIds(resourceIds) {
|
|
706
|
+
if (!resourceIds?.length)
|
|
707
|
+
return [];
|
|
708
|
+
const requested = new Set(resourceIds);
|
|
709
|
+
const resources = await listWorkspaceResourceOptions();
|
|
710
|
+
return resources.filter((resource) => requested.has(resource.id));
|
|
711
|
+
}
|
|
712
|
+
async function grantSelectedWorkspaceResources(input) {
|
|
713
|
+
if (input.resourceIds.length === 0)
|
|
714
|
+
return;
|
|
715
|
+
await grantWorkspaceResourcesToApp(input);
|
|
716
|
+
}
|
|
694
717
|
export async function startWorkspaceAppCreation(input) {
|
|
695
718
|
const initial = buildWorkspaceAppPrompt({
|
|
696
719
|
prompt: input.prompt,
|
|
@@ -714,11 +737,13 @@ export async function startWorkspaceAppCreation(input) {
|
|
|
714
737
|
.filter((secret) => input.secretIds?.includes(secret.id))
|
|
715
738
|
.map((secret) => secret.credentialKey)
|
|
716
739
|
: [];
|
|
740
|
+
const selectedResources = await selectedWorkspaceResourcesForIds(input.resourceIds);
|
|
717
741
|
const built = buildWorkspaceAppPrompt({
|
|
718
742
|
prompt: input.prompt,
|
|
719
743
|
appId: input.appId,
|
|
720
744
|
template: input.template,
|
|
721
745
|
selectedKeys,
|
|
746
|
+
selectedResources,
|
|
722
747
|
});
|
|
723
748
|
const prompt = built.prompt;
|
|
724
749
|
if (isLocal) {
|
|
@@ -726,6 +751,10 @@ export async function startWorkspaceAppCreation(input) {
|
|
|
726
751
|
appId: built.appId,
|
|
727
752
|
selectedKeys,
|
|
728
753
|
});
|
|
754
|
+
await grantSelectedWorkspaceResources({
|
|
755
|
+
appId: built.appId,
|
|
756
|
+
resourceIds: selectedResources.map((resource) => resource.id),
|
|
757
|
+
});
|
|
729
758
|
return {
|
|
730
759
|
mode: "local-agent",
|
|
731
760
|
appId: built.appId,
|
|
@@ -776,6 +805,10 @@ export async function startWorkspaceAppCreation(input) {
|
|
|
776
805
|
appId: built.appId,
|
|
777
806
|
selectedKeys,
|
|
778
807
|
});
|
|
808
|
+
await grantSelectedWorkspaceResources({
|
|
809
|
+
appId: built.appId,
|
|
810
|
+
resourceIds: selectedResources.map((resource) => resource.id),
|
|
811
|
+
});
|
|
779
812
|
return {
|
|
780
813
|
mode: "builder",
|
|
781
814
|
appId: built.appId,
|