@tangle-network/agent-app 0.35.0 → 0.36.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.
@@ -0,0 +1,193 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, SelectHTMLAttributes } from 'react';
3
+ import { Generation } from '../studio/index.js';
4
+ import { IntegrationConnection } from '@tangle-network/sandbox-ui/integrations';
5
+ import { Image } from 'lucide-react';
6
+
7
+ type StudioRole = 'owner' | 'admin' | 'editor' | 'viewer';
8
+ interface StudioWorkspaceProps {
9
+ generations: Generation[];
10
+ totalCost: number;
11
+ workspaceId?: string;
12
+ role: StudioRole;
13
+ /** Polling endpoint override (default `/api/generations`). */
14
+ generationsEndpoint?: string;
15
+ /** Build a vault link, optionally to a specific file. Defaults to `/app/<workspaceId>/vault`. */
16
+ vaultHref?: (filePath?: string | null) => string;
17
+ /** Integrations page href for the publish-package "Connect" link. Defaults to `/app/<workspaceId>/integrations`. */
18
+ integrationsHref?: string;
19
+ }
20
+ /**
21
+ * The full studio surface: header + composer + result canvas + library drawer,
22
+ * with the generation orchestrator (merge/poll/revalidate) wired in. The host
23
+ * route owns the loader (auth, RBAC, the generation query) and the server
24
+ * endpoints (`/api/generate`, `/api/media-models`, `/api/generations`); this
25
+ * shell renders that data and drives the live UI. Role gates the composer
26
+ * (viewers get a read-only library) and the integration-management affordances.
27
+ */
28
+ declare function StudioWorkspace({ generations, totalCost, workspaceId, role, generationsEndpoint, vaultHref, integrationsHref, }: StudioWorkspaceProps): react.JSX.Element;
29
+
30
+ /**
31
+ * The generation orchestrator behind a studio surface: it merges the loader's
32
+ * rows with in-flight live generations, computes the latest batch for the
33
+ * canvas, polls running generations until they settle, and revalidates the
34
+ * route loader when a status changes.
35
+ *
36
+ * The merge keeps the canvas, the library, and the polling path looking at the
37
+ * same full list. Polling hits `generationsEndpoint` (default `/api/generations`,
38
+ * the convention both apps already serve); pass an override if a product routes
39
+ * it elsewhere. `onGenerated` is wired to the composer's per-result callback.
40
+ */
41
+ declare function useStudioGenerations(loaderGenerations: Generation[], options?: {
42
+ workspaceId?: string;
43
+ generationsEndpoint?: string;
44
+ }): {
45
+ mergedGenerations: Generation[];
46
+ latestBatch: Generation[];
47
+ onGenerated: (generation: Generation) => void;
48
+ };
49
+
50
+ declare function ComposerHero({ workspaceId, integrationsHref, canManageIntegrations, onGenerated, }: {
51
+ workspaceId?: string;
52
+ integrationsHref?: string;
53
+ canManageIntegrations: boolean;
54
+ onGenerated: (generation: Generation) => void;
55
+ }): react.JSX.Element;
56
+
57
+ declare function Field({ label, htmlFor, className, children, }: {
58
+ label: string;
59
+ htmlFor?: string;
60
+ className?: string;
61
+ children: ReactNode;
62
+ }): react.JSX.Element;
63
+ declare function ComposerDisclosure({ summary, children }: {
64
+ summary: ReactNode;
65
+ children: ReactNode;
66
+ }): react.JSX.Element;
67
+ declare function NativeSelect(props: SelectHTMLAttributes<HTMLSelectElement>): react.JSX.Element;
68
+
69
+ declare function StudioHeader({ count, onOpenLibrary, canGenerate, }: {
70
+ count: number;
71
+ onOpenLibrary: () => void;
72
+ canGenerate: boolean;
73
+ }): react.JSX.Element;
74
+
75
+ /**
76
+ * Right-side overlay sheet built on Radix Dialog — gives focus-trap, scroll-lock,
77
+ * and Escape-to-close for free. Slide/fade come from the studio-sheet-* classes in
78
+ * ./studio.css (driven by Radix data-state), not tailwindcss-animate.
79
+ */
80
+ declare function StudioSheet({ open, onOpenChange, title, children, }: {
81
+ open: boolean;
82
+ onOpenChange: (open: boolean) => void;
83
+ title: string;
84
+ children: ReactNode;
85
+ }): react.JSX.Element;
86
+
87
+ declare function ResultCanvas({ batch, onOpenLibrary, onSelect, }: {
88
+ batch: Generation[];
89
+ onOpenLibrary: () => void;
90
+ onSelect: (generation: Generation) => void;
91
+ }): react.JSX.Element;
92
+
93
+ declare function LibraryDrawer({ open, onOpenChange, generations, totalCost, typeFilter, onFilterChange, vaultHref, selected, onSelect, }: {
94
+ open: boolean;
95
+ onOpenChange: (open: boolean) => void;
96
+ generations: Generation[];
97
+ totalCost: number;
98
+ typeFilter: string | null;
99
+ onFilterChange: (type: string | null) => void;
100
+ vaultHref?: (filePath?: string | null) => string;
101
+ selected: Generation | null;
102
+ onSelect: (generation: Generation | null) => void;
103
+ }): react.JSX.Element;
104
+
105
+ declare function GenerationCard({ generation, onSelect, }: {
106
+ generation: Generation;
107
+ onSelect: (generation: Generation) => void;
108
+ }): react.JSX.Element;
109
+ declare function GenerationStatusBadge({ generation, inline, }: {
110
+ generation: Generation;
111
+ inline?: boolean;
112
+ }): react.JSX.Element | null;
113
+
114
+ declare function GenerationDetail({ generation, vaultHref, onNavigate, }: {
115
+ generation: Generation;
116
+ vaultHref?: (filePath?: string | null) => string;
117
+ onNavigate?: () => void;
118
+ }): react.JSX.Element;
119
+
120
+ declare function PublishPackageComposer({ caption, postDescription, mentions, cadence, selectedDestinations, connections, connectionError, connectionsLoading, integrationsHref, canManageIntegrations, onCaptionChange, onDescriptionChange, onMentionsChange, onCadenceChange, onDestinationToggle, }: {
121
+ caption: string;
122
+ postDescription: string;
123
+ mentions: string;
124
+ cadence: string;
125
+ selectedDestinations: string[];
126
+ connections: IntegrationConnection[];
127
+ connectionError: Error | null;
128
+ connectionsLoading: boolean;
129
+ integrationsHref?: string;
130
+ canManageIntegrations: boolean;
131
+ onCaptionChange: (value: string) => void;
132
+ onDescriptionChange: (value: string) => void;
133
+ onMentionsChange: (value: string) => void;
134
+ onCadenceChange: (value: string) => void;
135
+ onDestinationToggle: (destination: string) => void;
136
+ }): react.JSX.Element;
137
+
138
+ interface TypeConfig {
139
+ label: string;
140
+ icon: typeof Image;
141
+ color: string;
142
+ }
143
+ declare const TYPE_CONFIG: Record<string, TypeConfig>;
144
+ declare function typeConfigFor(type: string): TypeConfig;
145
+
146
+ declare function ImageComposer({ size, quality, imageCount, onSizeChange, onQualityChange, onImageCountChange, }: {
147
+ size: string;
148
+ quality: string;
149
+ imageCount: number;
150
+ onSizeChange: (value: string) => void;
151
+ onQualityChange: (value: string) => void;
152
+ onImageCountChange: (value: number) => void;
153
+ }): react.JSX.Element;
154
+
155
+ declare function VideoComposer({ duration, resolution, aspectRatio, referenceImageUrl, onDurationChange, onResolutionChange, onAspectRatioChange, onReferenceImageUrlChange, }: {
156
+ duration: string;
157
+ resolution: string;
158
+ aspectRatio: string;
159
+ referenceImageUrl: string;
160
+ onDurationChange: (value: string) => void;
161
+ onResolutionChange: (value: string) => void;
162
+ onAspectRatioChange: (value: string) => void;
163
+ onReferenceImageUrlChange: (value: string) => void;
164
+ }): react.JSX.Element;
165
+
166
+ declare function SpeechComposer({ voice, onVoiceChange, }: {
167
+ voice: string;
168
+ onVoiceChange: (value: string) => void;
169
+ }): react.JSX.Element;
170
+
171
+ declare function AvatarComposer({ audioUrl, imageUrl, avatarId, onAudioUrlChange, onImageUrlChange, onAvatarIdChange, }: {
172
+ audioUrl: string;
173
+ imageUrl: string;
174
+ avatarId: string;
175
+ onAudioUrlChange: (value: string) => void;
176
+ onImageUrlChange: (value: string) => void;
177
+ onAvatarIdChange: (value: string) => void;
178
+ }): react.JSX.Element;
179
+
180
+ declare function TranscriptionComposer({ audioUrl, language, onAudioUrlChange, onLanguageChange, }: {
181
+ audioUrl: string;
182
+ language: string;
183
+ onAudioUrlChange: (value: string) => void;
184
+ onLanguageChange: (value: string) => void;
185
+ }): react.JSX.Element;
186
+ declare function TranscriptionOptions({ responseFormat, temperature, onResponseFormatChange, onTemperatureChange, }: {
187
+ responseFormat: string;
188
+ temperature: string;
189
+ onResponseFormatChange: (value: string) => void;
190
+ onTemperatureChange: (value: string) => void;
191
+ }): react.JSX.Element;
192
+
193
+ export { AvatarComposer, ComposerDisclosure, ComposerHero, Field, GenerationCard, GenerationDetail, GenerationStatusBadge, ImageComposer, LibraryDrawer, NativeSelect, PublishPackageComposer, ResultCanvas, SpeechComposer, StudioHeader, type StudioRole, StudioSheet, StudioWorkspace, type StudioWorkspaceProps, TYPE_CONFIG, TranscriptionComposer, TranscriptionOptions, type TypeConfig, VideoComposer, typeConfigFor, useStudioGenerations };