@agent-native/core 0.78.0 → 0.78.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +9 -0
  3. package/corpus/core/package.json +1 -1
  4. package/corpus/core/src/agent/types.ts +22 -0
  5. package/corpus/core/src/client/AgentPanel.tsx +8 -0
  6. package/corpus/core/src/client/AssistantChat.tsx +40 -0
  7. package/corpus/core/src/client/agent-chat.ts +173 -0
  8. package/corpus/core/src/client/composer/TiptapComposer.tsx +316 -60
  9. package/corpus/core/src/client/composer/extensions/MentionReference.tsx +3 -0
  10. package/corpus/core/src/client/composer/types.ts +22 -0
  11. package/corpus/core/src/client/index.ts +5 -0
  12. package/corpus/core/src/server/agent-chat-plugin.ts +10 -0
  13. package/corpus/templates/assets/.agents/skills/asset-generation/SKILL.md +10 -2
  14. package/corpus/templates/assets/.agents/skills/image-generation/SKILL.md +14 -7
  15. package/corpus/templates/assets/.agents/skills/library-management/SKILL.md +12 -0
  16. package/corpus/templates/assets/AGENTS.md +18 -3
  17. package/corpus/templates/assets/actions/_image-model-default.ts +24 -0
  18. package/corpus/templates/assets/actions/dismiss-variant-slots.ts +15 -22
  19. package/corpus/templates/assets/actions/generate-asset.ts +30 -23
  20. package/corpus/templates/assets/actions/generate-image-batch.ts +76 -29
  21. package/corpus/templates/assets/actions/generate-image.ts +46 -30
  22. package/corpus/templates/assets/actions/generate-video.ts +18 -3
  23. package/corpus/templates/assets/actions/list-assets.ts +39 -8
  24. package/corpus/templates/assets/actions/list-libraries.ts +24 -2
  25. package/corpus/templates/assets/actions/navigate.ts +1 -1
  26. package/corpus/templates/assets/actions/open-asset-picker.ts +38 -1
  27. package/corpus/templates/assets/actions/refresh-generation-run.ts +10 -0
  28. package/corpus/templates/assets/actions/save-generated-image.ts +21 -19
  29. package/corpus/templates/assets/actions/variant-slots.ts +131 -28
  30. package/corpus/templates/assets/actions/view-screen.ts +9 -0
  31. package/corpus/templates/assets/app/components/generation/GenerationResults.tsx +425 -0
  32. package/corpus/templates/assets/app/components/layout/Header.tsx +3 -1
  33. package/corpus/templates/assets/app/components/layout/Layout.tsx +5 -0
  34. package/corpus/templates/assets/app/components/layout/Sidebar.tsx +4 -6
  35. package/corpus/templates/assets/app/hooks/use-navigation-state.ts +47 -21
  36. package/corpus/templates/assets/app/i18n-data.ts +1815 -0
  37. package/corpus/templates/assets/app/lib/libraries.ts +6 -0
  38. package/corpus/templates/assets/app/lib/picker-chat-handoff.ts +71 -0
  39. package/corpus/templates/assets/app/routes/_index.tsx +4 -0
  40. package/corpus/templates/assets/app/routes/asset.$id.tsx +2 -2
  41. package/corpus/templates/assets/app/routes/audit.tsx +1 -1
  42. package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +1557 -2164
  43. package/corpus/templates/assets/app/routes/brand-kits._index.tsx +7 -191
  44. package/corpus/templates/assets/app/routes/brand-kits.tsx +1 -5
  45. package/corpus/templates/assets/app/routes/libraries.tsx +4 -4
  46. package/corpus/templates/assets/app/routes/library.$id.tsx +9 -7
  47. package/corpus/templates/assets/app/routes/library.tsx +1454 -175
  48. package/corpus/templates/assets/server/db/index.ts +1 -1
  49. package/corpus/templates/assets/server/lib/generation.ts +86 -15
  50. package/corpus/templates/assets/server/plugins/agent-chat.ts +196 -0
  51. package/corpus/templates/assets/server/plugins/db.ts +5 -0
  52. package/corpus/templates/assets/shared/api.ts +6 -3
  53. package/dist/agent/types.d.ts +21 -0
  54. package/dist/agent/types.d.ts.map +1 -1
  55. package/dist/agent/types.js.map +1 -1
  56. package/dist/client/AgentPanel.d.ts +5 -1
  57. package/dist/client/AgentPanel.d.ts.map +1 -1
  58. package/dist/client/AgentPanel.js +2 -2
  59. package/dist/client/AgentPanel.js.map +1 -1
  60. package/dist/client/AssistantChat.d.ts +6 -0
  61. package/dist/client/AssistantChat.d.ts.map +1 -1
  62. package/dist/client/AssistantChat.js +15 -3
  63. package/dist/client/AssistantChat.js.map +1 -1
  64. package/dist/client/agent-chat.d.ts +32 -0
  65. package/dist/client/agent-chat.d.ts.map +1 -1
  66. package/dist/client/agent-chat.js +113 -0
  67. package/dist/client/agent-chat.js.map +1 -1
  68. package/dist/client/composer/TiptapComposer.d.ts +2 -1
  69. package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
  70. package/dist/client/composer/TiptapComposer.js +228 -56
  71. package/dist/client/composer/TiptapComposer.js.map +1 -1
  72. package/dist/client/composer/extensions/MentionReference.d.ts.map +1 -1
  73. package/dist/client/composer/extensions/MentionReference.js +3 -0
  74. package/dist/client/composer/extensions/MentionReference.js.map +1 -1
  75. package/dist/client/composer/types.d.ts +21 -0
  76. package/dist/client/composer/types.d.ts.map +1 -1
  77. package/dist/client/composer/types.js.map +1 -1
  78. package/dist/client/index.d.ts +1 -1
  79. package/dist/client/index.d.ts.map +1 -1
  80. package/dist/client/index.js +1 -1
  81. package/dist/client/index.js.map +1 -1
  82. package/dist/collab/routes.d.ts +2 -2
  83. package/dist/notifications/routes.d.ts +3 -3
  84. package/dist/observability/routes.d.ts +6 -6
  85. package/dist/progress/routes.d.ts +1 -1
  86. package/dist/resources/handlers.d.ts +3 -3
  87. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  88. package/dist/server/agent-chat-plugin.js +5 -0
  89. package/dist/server/agent-chat-plugin.js.map +1 -1
  90. package/dist/server/agent-engine-api-key-route.d.ts +2 -2
  91. package/dist/server/transcribe-voice.d.ts +1 -1
  92. package/package.json +1 -1
@@ -1,194 +1,10 @@
1
- import {
2
- useActionMutation,
3
- useActionQuery,
4
- useT,
5
- } from "@agent-native/core/client";
6
- import { IconPalette, IconPhotoPlus, IconSearch } from "@tabler/icons-react";
7
- import { useMemo, useState } from "react";
8
- import { Link, useNavigate } from "react-router";
9
- import { toast } from "sonner";
1
+ import { redirect, type LoaderFunctionArgs } from "react-router";
10
2
 
11
- import { PageShell } from "@/components/layout/PageShell";
12
- import { CreateLibraryDialog } from "@/components/library/CreateLibraryDialog";
13
- import { EditLibraryDialog } from "@/components/library/EditLibraryDialog";
14
- import { LibraryCard } from "@/components/library/LibraryCard";
15
- import { LibraryPresetGrid } from "@/components/library/LibraryPresetGrid";
16
- import { Button } from "@/components/ui/button";
17
- import {
18
- sortLibrariesByUsage,
19
- type ImageLibrarySummary,
20
- } from "@/lib/libraries";
21
-
22
- import type { LibraryPreset } from "../../shared/library-presets";
23
-
24
- export default function BrandKitsIndexPage() {
25
- const t = useT();
26
- const navigate = useNavigate();
27
- const { data, isLoading } = useActionQuery("list-libraries", {});
28
- const { data: presetData } = useActionQuery("list-library-presets", {});
29
- const createFromPreset = useActionMutation("create-library-from-preset");
30
- const duplicateLibrary = useActionMutation("duplicate-library");
31
- const [query, setQuery] = useState("");
32
- const [open, setOpen] = useState(false);
33
- const [editing, setEditing] = useState<ImageLibrarySummary | null>(null);
34
- const [creatingPresetId, setCreatingPresetId] = useState<string | null>(null);
35
- const [duplicatingId, setDuplicatingId] = useState<string | null>(null);
36
- const presets = ((presetData as any)?.presets ?? []) as LibraryPreset[];
37
-
38
- const libraries = useMemo(() => {
39
- const items = sortLibrariesByUsage(
40
- (((data as any)?.libraries ?? []) as ImageLibrarySummary[]).filter(
41
- Boolean,
42
- ),
43
- );
44
- const q = query.trim().toLowerCase();
45
- if (!q) return items;
46
- return items.filter((library) =>
47
- [library.title, library.description]
48
- .filter(Boolean)
49
- .join(" ")
50
- .toLowerCase()
51
- .includes(q),
52
- );
53
- }, [data, query]);
54
-
55
- function createPresetLibrary(presetId: string) {
56
- setCreatingPresetId(presetId);
57
- createFromPreset.mutate(
58
- { presetId },
59
- {
60
- onSuccess: (library: any) => {
61
- setCreatingPresetId(null);
62
- navigate(`/brand-kits/${library.id}`);
63
- },
64
- onError: (error: Error) => {
65
- setCreatingPresetId(null);
66
- toast.error(error.message || t("brandKits.presetCreateFailed"));
67
- },
68
- },
69
- );
70
- }
71
-
72
- function duplicateBrandKit(library: ImageLibrarySummary) {
73
- if (duplicatingId) return;
74
- setDuplicatingId(library.id);
75
- duplicateLibrary.mutate(
76
- { id: library.id },
77
- {
78
- onSuccess: (copy: any) => {
79
- setDuplicatingId(null);
80
- toast.success(t("brandKits.duplicateCreated"));
81
- navigate(`/brand-kits/${copy.id}`);
82
- },
83
- onError: (error: Error) => {
84
- setDuplicatingId(null);
85
- toast.error(error.message || t("brandKits.duplicateFailed"));
86
- },
87
- },
88
- );
89
- }
90
-
91
- return (
92
- <PageShell
93
- title={t("brandKits.title")}
94
- description={t("brandKits.description")}
95
- >
96
- <section className="space-y-4">
97
- <div>
98
- <h2 className="text-lg font-semibold tracking-tight">
99
- {t("brandKits.yourBrandKits")}
100
- </h2>
101
- <p className="mt-1 w-full text-sm text-muted-foreground">
102
- {t("brandKits.yourBrandKitsDescription")}
103
- </p>
104
- </div>
105
-
106
- <div className="flex flex-wrap items-center gap-4">
107
- <div className="flex h-10 flex-1 items-center gap-2 rounded-md border border-border bg-background px-3">
108
- <IconSearch className="h-4 w-4 text-muted-foreground" />
109
- <input
110
- value={query}
111
- onChange={(event) => setQuery(event.target.value)}
112
- placeholder={t("brandKits.searchPlaceholder")}
113
- className="h-full flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
114
- />
115
- </div>
116
- <Button
117
- variant="outline"
118
- onClick={() => setOpen(true)}
119
- className="gap-2"
120
- >
121
- <IconPhotoPlus className="h-4 w-4" />
122
- {t("brandKits.newBrandKit")}
123
- </Button>
124
- </div>
125
-
126
- {isLoading ? (
127
- <div className="grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3">
128
- {Array.from({ length: 6 }).map((_, index) => (
129
- <div
130
- key={index}
131
- className="h-64 animate-pulse rounded-lg border bg-card"
132
- />
133
- ))}
134
- </div>
135
- ) : libraries.length ? (
136
- <div className="grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3">
137
- {libraries.map((library) => (
138
- <LibraryCard
139
- key={library.id}
140
- library={library}
141
- to={`/brand-kits/${library.id}`}
142
- onEdit={() => setEditing(library)}
143
- onDuplicate={() => duplicateBrandKit(library)}
144
- duplicatePending={duplicatingId === library.id}
145
- showInstructions={false}
146
- />
147
- ))}
148
- </div>
149
- ) : (
150
- <div className="p-6">
151
- <div className="mx-auto max-w-2xl text-center">
152
- <IconPalette className="mx-auto h-10 w-10 text-muted-foreground" />
153
- <h3 className="mt-4 text-base font-semibold">
154
- {t("brandKits.emptyTitle")}
155
- </h3>
156
- <p className="mt-2 text-sm text-muted-foreground">
157
- {t("brandKits.emptyDescription")}
158
- </p>
159
- </div>
160
- <div className="mx-auto mt-6 max-w-4xl">
161
- <LibraryPresetGrid
162
- presets={presets}
163
- creatingId={creatingPresetId}
164
- onCreate={createPresetLibrary}
165
- />
166
- </div>
167
- <div className="mt-5 flex flex-wrap justify-center gap-2">
168
- <Button onClick={() => setOpen(true)} className="gap-2">
169
- <IconPhotoPlus className="h-4 w-4" />
170
- {t("brandKits.newBrandKitLower")}
171
- </Button>
172
- <Button asChild variant="outline">
173
- <Link to="/">{t("brandKits.createAsset")}</Link>
174
- </Button>
175
- </div>
176
- </div>
177
- )}
178
- </section>
3
+ export function loader({ request }: LoaderFunctionArgs) {
4
+ const url = new URL(request.url);
5
+ return redirect(`/library${url.search}`);
6
+ }
179
7
 
180
- <CreateLibraryDialog
181
- open={open}
182
- onOpenChange={setOpen}
183
- onCreated={(library) => navigate(`/brand-kits/${library.id}`)}
184
- />
185
- <EditLibraryDialog
186
- library={editing}
187
- open={!!editing}
188
- onOpenChange={(next) => {
189
- if (!next) setEditing(null);
190
- }}
191
- />
192
- </PageShell>
193
- );
8
+ export default function BrandKitsIndexRedirect() {
9
+ return null;
194
10
  }
@@ -6,11 +6,7 @@ export function meta() {
6
6
  return [{ title: messagesByLocale["en-US"].routeTitles.brandKits }];
7
7
  }
8
8
 
9
- // Layout for the Brand Kits section. The list lives in `brand-kits._index.tsx`
10
- // and a single kit's detail lives in `brand-kits.$id.tsx`; both render through
11
- // this `<Outlet/>`. Without this layout, flat-routes nests the `$id` detail
12
- // under the list page, which has no Outlet, so `/brand-kits/:id` rendered the
13
- // list instead of the detail (kits looked unviewable / uneditable).
9
+ // Legacy Brand Kits routes now redirect into the unified Library workspace.
14
10
  export default function BrandKitsLayout() {
15
11
  return <Outlet />;
16
12
  }
@@ -1,9 +1,9 @@
1
1
  import { redirect, type LoaderFunctionArgs } from "react-router";
2
2
 
3
- // Legacy redirect: brand containers moved from "Libraries" (/libraries) to
4
- // "Brand Kits" (/brand-kits).
5
- export function loader({ url }: LoaderFunctionArgs) {
6
- return redirect(`/brand-kits${url.search}`);
3
+ // Legacy redirect: brand containers now live in the unified Library workspace.
4
+ export function loader({ request }: LoaderFunctionArgs) {
5
+ const url = new URL(request.url);
6
+ return redirect(`/library${url.search}`);
7
7
  }
8
8
 
9
9
  export default function LibrariesRedirect() {
@@ -1,11 +1,13 @@
1
- import { redirect, type LoaderFunctionArgs } from "react-router";
1
+ import { useParams } from "react-router";
2
2
 
3
- // Legacy redirect: a single brand container's detail page moved from
4
- // /library/:id to /brand-kits/:id.
5
- export function loader({ params, url }: LoaderFunctionArgs) {
6
- return redirect(`/brand-kits/${params.id}${url.search}`);
3
+ import { messagesByLocale } from "../i18n-data";
4
+ import { LibraryWorkspace } from "./library";
5
+
6
+ export function meta() {
7
+ return [{ title: messagesByLocale["en-US"].routeTitles.library }];
7
8
  }
8
9
 
9
- export default function LibraryDetailRedirect() {
10
- return null;
10
+ export default function LibraryDetailPage() {
11
+ const { id } = useParams();
12
+ return <LibraryWorkspace selectedLibraryId={id ?? null} />;
11
13
  }