@ai-matrx/alchemy 0.12.3 → 0.13.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/CHANGELOG.md +17 -0
- package/dist/actions.cjs.map +1 -1
- package/dist/actions.d.cts +1 -1
- package/dist/actions.d.ts +1 -1
- package/dist/actions.js.map +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.js.map +1 -1
- package/dist/declare.cjs.map +1 -1
- package/dist/declare.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/menu.d.cts +1 -1
- package/dist/menu.d.ts +1 -1
- package/dist/operate.cjs.map +1 -1
- package/dist/operate.js.map +1 -1
- package/dist/react-bar.cjs.map +1 -1
- package/dist/react-bar.d.cts +1 -1
- package/dist/react-bar.d.ts +1 -1
- package/dist/react-bar.js.map +1 -1
- package/dist/react-host.d.cts +1 -1
- package/dist/react-host.d.ts +1 -1
- package/dist/react-menu.cjs.map +1 -1
- package/dist/react-menu.d.cts +1 -1
- package/dist/react-menu.d.ts +1 -1
- package/dist/react-menu.js.map +1 -1
- package/dist/react-overflow.cjs.map +1 -1
- package/dist/react-overflow.d.cts +1 -1
- package/dist/react-overflow.d.ts +1 -1
- package/dist/react-overflow.js.map +1 -1
- package/dist/react-palette.cjs.map +1 -1
- package/dist/react-palette.d.cts +1 -1
- package/dist/react-palette.d.ts +1 -1
- package/dist/react-palette.js.map +1 -1
- package/dist/react-selection.cjs.map +1 -1
- package/dist/react-selection.d.cts +1 -1
- package/dist/react-selection.d.ts +1 -1
- package/dist/react-selection.js.map +1 -1
- package/dist/react-sheet.cjs.map +1 -1
- package/dist/react-sheet.d.cts +1 -1
- package/dist/react-sheet.d.ts +1 -1
- package/dist/react-sheet.js.map +1 -1
- package/dist/react-workspace.cjs +7 -0
- package/dist/react-workspace.cjs.map +1 -0
- package/dist/react-workspace.d.cts +441 -0
- package/dist/react-workspace.d.ts +441 -0
- package/dist/react-workspace.js +7 -0
- package/dist/react-workspace.js.map +1 -0
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/dist/surface.cjs.map +1 -1
- package/dist/surface.js.map +1 -1
- package/package.json +13 -3
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AgentPayloadInput, Payload, Artifact, TransferOutcome, FormatAdapter, PageAction, AiPreparation, Transport, TransferPreferenceOverrides, Source, ExportProjection, Section, SurfaceHandle, TransferScope } from '@ai-matrx/alchemy/operate';
|
|
3
|
+
import { AlchemyIcon } from '@ai-matrx/design-system/content-transfer/icon';
|
|
4
|
+
export { ALCHEMY_COPY_TRANSFORM_SVG, ALCHEMY_GLYPH_SVG, AlchemyIcon } from '@ai-matrx/design-system/content-transfer/icon';
|
|
5
|
+
import { ContentTransferReference, TableCopyController, CopyControlProps } from '@ai-matrx/design-system/data-table/host';
|
|
6
|
+
export { ContentTransferReference } from '@ai-matrx/design-system/data-table/host';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Host levers (Preparation parity PP-02, PP-03, PP-05): the controls a screen declares for its own
|
|
10
|
+
* data — "tool results", "last N messages", "per-message cap", a groomer section's Full / Compact /
|
|
11
|
+
* Brief / Off — and how a lever value becomes the payload the workspace prepares.
|
|
12
|
+
*
|
|
13
|
+
* The levers live INSIDE the one preparation workspace, beside the preview: changing one rebuilds
|
|
14
|
+
* the payload from the host builder and the preview follows. There is no second dialog and no
|
|
15
|
+
* "Prepare in Alchemy" handoff that loses them.
|
|
16
|
+
*
|
|
17
|
+
* Text stays text (PP-09): a builder that returns text becomes a text payload whose AI envelope
|
|
18
|
+
* carries it as `<data format="text">`, never one escaped JSON string.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
type AlchemyOptionValues = Record<string, boolean | number>;
|
|
22
|
+
type AlchemySourceOption = {
|
|
23
|
+
kind: "toggle";
|
|
24
|
+
key: string;
|
|
25
|
+
label: string;
|
|
26
|
+
hint?: string;
|
|
27
|
+
default: boolean;
|
|
28
|
+
} | {
|
|
29
|
+
kind: "preset";
|
|
30
|
+
key: string;
|
|
31
|
+
label: string;
|
|
32
|
+
options: {
|
|
33
|
+
label: string;
|
|
34
|
+
value: number;
|
|
35
|
+
}[];
|
|
36
|
+
default: number;
|
|
37
|
+
} | {
|
|
38
|
+
kind: "slider";
|
|
39
|
+
key: string;
|
|
40
|
+
label: string;
|
|
41
|
+
hint?: string;
|
|
42
|
+
stops: number[];
|
|
43
|
+
default: number;
|
|
44
|
+
formatValue: (value: number) => string;
|
|
45
|
+
} | {
|
|
46
|
+
kind: "number";
|
|
47
|
+
key: string;
|
|
48
|
+
label: string;
|
|
49
|
+
hint?: string;
|
|
50
|
+
min?: number;
|
|
51
|
+
step?: number;
|
|
52
|
+
presets?: {
|
|
53
|
+
label: string;
|
|
54
|
+
value: number;
|
|
55
|
+
}[];
|
|
56
|
+
default: number;
|
|
57
|
+
};
|
|
58
|
+
type LeverMeta = Record<string, string | number | boolean | undefined>;
|
|
59
|
+
interface AlchemyCustomSource {
|
|
60
|
+
label?: string;
|
|
61
|
+
hint?: string;
|
|
62
|
+
options: AlchemySourceOption[];
|
|
63
|
+
build(values: AlchemyOptionValues): {
|
|
64
|
+
text: string;
|
|
65
|
+
meta?: LeverMeta;
|
|
66
|
+
};
|
|
67
|
+
wrap(text: string, values: AlchemyOptionValues, meta?: LeverMeta): AgentPayloadInput;
|
|
68
|
+
dialogTitle?: string;
|
|
69
|
+
dialogDescription?: string;
|
|
70
|
+
}
|
|
71
|
+
type AlchemyDetail = "full" | "compact" | "brief";
|
|
72
|
+
interface AlchemyGroomerSection {
|
|
73
|
+
id: string;
|
|
74
|
+
title: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
cuttable?: boolean;
|
|
77
|
+
levelLabels?: Partial<Record<AlchemyDetail, string>>;
|
|
78
|
+
build(level: AlchemyDetail): unknown;
|
|
79
|
+
defaultSelection?: AlchemyDetail | "off";
|
|
80
|
+
}
|
|
81
|
+
interface AlchemyGroomerConfig {
|
|
82
|
+
label: string;
|
|
83
|
+
kind: string;
|
|
84
|
+
location: string;
|
|
85
|
+
description: string;
|
|
86
|
+
attributes?: AgentPayloadInput["attributes"];
|
|
87
|
+
context?: AgentPayloadInput["context"];
|
|
88
|
+
summary?: string;
|
|
89
|
+
sections: AlchemyGroomerSection[];
|
|
90
|
+
}
|
|
91
|
+
/** Who a piece of content is, for the AI envelope — everything but the body. */
|
|
92
|
+
type EnvelopeMeta = Omit<AgentPayloadInput, "data" | "dataFormat" | "instructions">;
|
|
93
|
+
type LeverValue = boolean | number | string;
|
|
94
|
+
type LeverValues = Record<string, LeverValue>;
|
|
95
|
+
type SectionLevel = AlchemyDetail | "off";
|
|
96
|
+
interface LeverBuild {
|
|
97
|
+
payload: Payload;
|
|
98
|
+
envelope: EnvelopeMeta;
|
|
99
|
+
meta?: LeverMeta;
|
|
100
|
+
/** Per groomer section: its size in the prepared JSON at its current level (PP-04). */
|
|
101
|
+
sectionSizes?: Record<string, number>;
|
|
102
|
+
}
|
|
103
|
+
/** The levers one workspace session carries: the host's controls and the one builder they feed. */
|
|
104
|
+
interface WorkspaceLevers {
|
|
105
|
+
/** Source options (custom levers), shown in Settings. */
|
|
106
|
+
options?: readonly AlchemySourceOption[];
|
|
107
|
+
/** Groomer sections, shown in Structure with their level control. */
|
|
108
|
+
sections?: readonly AlchemyGroomerSection[];
|
|
109
|
+
initial: LeverValues;
|
|
110
|
+
build(values: LeverValues): LeverBuild;
|
|
111
|
+
}
|
|
112
|
+
/** Presets over groomer sections (O4's Everything / Balanced / Minimal). */
|
|
113
|
+
type AlchemyGroomerPreset = "everything" | "balanced" | "minimal";
|
|
114
|
+
declare function applyGroomerPreset(preset: AlchemyGroomerPreset, sections: readonly AlchemyGroomerSection[]): Record<string, SectionLevel>;
|
|
115
|
+
|
|
116
|
+
type SerializableFormat = "plain" | "markdown" | "html" | "json" | "compact-json" | "csv" | "tsv";
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* THE preparation workspace (Preparation parity PP-01b, PP-01c, PP-02, PP-03, PP-04, PP-09, PP-10).
|
|
120
|
+
*
|
|
121
|
+
* One surface: the source's structure (sections, groomer sections, columns and rows) on the left,
|
|
122
|
+
* ONE read-only preview of the exact sealed bytes in the middle, and the host's own levers,
|
|
123
|
+
* instructions, AI preparation and destinations on the right. The envelope toggle (Text / For AI)
|
|
124
|
+
* chooses the one artifact the preview shows and the one Copy writes — preview = copy = download.
|
|
125
|
+
*
|
|
126
|
+
* Frames: inside a host window (`ContentTransferCapabilities.window`, the host's `WindowPort`) the
|
|
127
|
+
* host draws the title bar and the close control; without one it is a near-full-screen dialog.
|
|
128
|
+
* Below 768px of its own width it is three tabs (Structure / Preview / Settings) with Copy in a
|
|
129
|
+
* footer every tab shares.
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
/** Structural twin of `@ai-matrx/alchemy/ports` `WindowPort` (design-system sits below alchemy). */
|
|
133
|
+
interface WorkspaceWindowHandle {
|
|
134
|
+
readonly instanceId: string;
|
|
135
|
+
close(): void;
|
|
136
|
+
focus(): void;
|
|
137
|
+
isOpen(): boolean;
|
|
138
|
+
}
|
|
139
|
+
interface WorkspaceWindowPort {
|
|
140
|
+
readonly presentation: "window" | "dialog";
|
|
141
|
+
readonly multiInstance: boolean;
|
|
142
|
+
open(render: (window: WorkspaceWindowHandle) => unknown, options: {
|
|
143
|
+
title: string;
|
|
144
|
+
size?: {
|
|
145
|
+
width: number;
|
|
146
|
+
height: number;
|
|
147
|
+
} | "full";
|
|
148
|
+
instanceId?: string;
|
|
149
|
+
onClose?: () => void;
|
|
150
|
+
}): WorkspaceWindowHandle;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
type ContentTransferReferencePort = {
|
|
154
|
+
supports(reference: ContentTransferReference): boolean;
|
|
155
|
+
build(reference: ContentTransferReference): string | Promise<string>;
|
|
156
|
+
};
|
|
157
|
+
type ContentTransferEmailPort = {
|
|
158
|
+
send(artifact: Artifact, context: {
|
|
159
|
+
label: string;
|
|
160
|
+
signal: AbortSignal;
|
|
161
|
+
}): Promise<TransferOutcome>;
|
|
162
|
+
};
|
|
163
|
+
/** A sealed, projection-safe representation of a tabular draft's declared schema and values. */
|
|
164
|
+
declare const tableSchemaFormat: FormatAdapter;
|
|
165
|
+
/** Flat row JSON keyed by user-facing display labels, never raw table records. */
|
|
166
|
+
declare const tableDataFormat: FormatAdapter;
|
|
167
|
+
type TransferEmailAction = PageAction & {
|
|
168
|
+
prepared: true;
|
|
169
|
+
group: "email";
|
|
170
|
+
};
|
|
171
|
+
/** Prepared-only delivery actions always serialize the current draft, never a host source. */
|
|
172
|
+
declare function createTransferEmailActions(email: ContentTransferEmailPort, options?: {
|
|
173
|
+
jsonFormat?: FormatAdapter;
|
|
174
|
+
}): TransferEmailAction[];
|
|
175
|
+
|
|
176
|
+
interface AlchemyCopyVariant {
|
|
177
|
+
id: string;
|
|
178
|
+
label: string;
|
|
179
|
+
hint?: string;
|
|
180
|
+
icon?: React.ComponentType<{
|
|
181
|
+
className?: string;
|
|
182
|
+
}>;
|
|
183
|
+
section?: "copy" | "ai";
|
|
184
|
+
ariaLabel?: string;
|
|
185
|
+
successMessage?: string;
|
|
186
|
+
build?: () => AgentPayloadInput | string | Promise<AgentPayloadInput | string>;
|
|
187
|
+
onSelect?: () => void | Promise<void>;
|
|
188
|
+
modal?: (props: {
|
|
189
|
+
open: boolean;
|
|
190
|
+
onOpenChange: (open: boolean) => void;
|
|
191
|
+
}) => React.ReactNode;
|
|
192
|
+
/** Opens THE preparation workspace on this content (the rows tree for rows, PP-08). */
|
|
193
|
+
prepare?: () => {
|
|
194
|
+
payload: Payload;
|
|
195
|
+
label: string;
|
|
196
|
+
envelope?: EnvelopeMeta;
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
interface AlchemyExportItem {
|
|
200
|
+
id: string;
|
|
201
|
+
label: string;
|
|
202
|
+
build?: () => {
|
|
203
|
+
content: BlobPart;
|
|
204
|
+
extension: string;
|
|
205
|
+
mime: string;
|
|
206
|
+
/** Optional exact safe basename captured with bytes; omission derives a default, invalid values error. */
|
|
207
|
+
filename?: string;
|
|
208
|
+
};
|
|
209
|
+
onSelect?: () => void | Promise<void>;
|
|
210
|
+
}
|
|
211
|
+
type Resolvable<T> = T | (() => T);
|
|
212
|
+
interface MatrxCopyMenuProps {
|
|
213
|
+
label: string;
|
|
214
|
+
/** Stable record identity when this mounted control can switch between records. */
|
|
215
|
+
sourceId?: string;
|
|
216
|
+
references?: readonly ContentTransferReference[];
|
|
217
|
+
referenceActions?: readonly ContentTransferReferenceAction[];
|
|
218
|
+
/** Prepare the tabular view while keeping raw JSON and human copy formats. */
|
|
219
|
+
primarySource?: "table";
|
|
220
|
+
human?: Resolvable<string>;
|
|
221
|
+
/**
|
|
222
|
+
* What `human` is. "markdown" makes it rich text: the main Copy click writes text/plain = the
|
|
223
|
+
* markdown plus text/html = formatted, and the panel leads with "Copy markdown" and "Copy text".
|
|
224
|
+
* Default "plain": a plain string, the existing Text / Markdown tiles.
|
|
225
|
+
*/
|
|
226
|
+
contentFlavor?: "plain" | "markdown";
|
|
227
|
+
/**
|
|
228
|
+
* The host's own rich copy, so one implementation serves every surface (matrx-frontend injects
|
|
229
|
+
* `copyRichContent`). Absent: the package writes the main click and Copy markdown through the session
|
|
230
|
+
* transport and offers no Copy text tile (readable text is the host's one projection).
|
|
231
|
+
*/
|
|
232
|
+
richCopy?: (markdown: string, flavor: RichCopyFlavor) => Promise<TransferOutcome | boolean | void> | TransferOutcome | boolean | void;
|
|
233
|
+
json?: Resolvable<unknown>;
|
|
234
|
+
agent?: Resolvable<AgentPayloadInput | string>;
|
|
235
|
+
aiVariants?: AlchemyCopyVariant[];
|
|
236
|
+
aiCustom?: AlchemyCustomSource;
|
|
237
|
+
groomer?: () => AlchemyGroomerConfig;
|
|
238
|
+
agentVariant?: {
|
|
239
|
+
id?: string;
|
|
240
|
+
label?: string;
|
|
241
|
+
hint?: string;
|
|
242
|
+
position?: "first" | "last";
|
|
243
|
+
};
|
|
244
|
+
export?: {
|
|
245
|
+
items: AlchemyExportItem[];
|
|
246
|
+
/** May be async: a server-paged host hands its whole selected result, read when a format is picked. */
|
|
247
|
+
sheetRows?: () => Array<Record<string, unknown>> | Promise<Array<Record<string, unknown>>>;
|
|
248
|
+
sheetColumns?: () => Array<{
|
|
249
|
+
id: string;
|
|
250
|
+
label: string;
|
|
251
|
+
}>;
|
|
252
|
+
};
|
|
253
|
+
/** Host-owned authenticated destination, not a second export serializer. */
|
|
254
|
+
sendToSheet?: (rows: Array<Record<string, unknown>>, label: string) => Promise<TransferOutcome>;
|
|
255
|
+
hide?: Array<"copy" | "ai" | "export">;
|
|
256
|
+
disabled?: boolean;
|
|
257
|
+
className?: string;
|
|
258
|
+
stopPropagation?: boolean;
|
|
259
|
+
size?: "xs" | "icon" | "sm" | "toolbar";
|
|
260
|
+
appearance?: "bare" | "segmented";
|
|
261
|
+
unified?: boolean;
|
|
262
|
+
grouped?: boolean;
|
|
263
|
+
icon?: AlchemyIcon;
|
|
264
|
+
triggerVariant?: "transparent" | "glass" | "outline";
|
|
265
|
+
/** The full controller, or the table's subset (`TableCopyController`, design-system's copy contract). */
|
|
266
|
+
controllerRef?: React.Ref<ContentTransferController> | React.Ref<TableCopyController>;
|
|
267
|
+
triggerHidden?: boolean;
|
|
268
|
+
}
|
|
269
|
+
/** Opinionated bridge for Matrx's existing content builders, with one transfer UI. */
|
|
270
|
+
declare function MatrxCopyMenu(props: MatrxCopyMenuProps): React.JSX.Element;
|
|
271
|
+
declare const GROOMER_LEVELS: AlchemyDetail[];
|
|
272
|
+
declare function defaultGroomerSelections(sections: AlchemyGroomerSection[]): Record<string, AlchemyDetail | "off">;
|
|
273
|
+
declare function buildGroomerPresetPayload(config: AlchemyGroomerConfig, preset: AlchemyGroomerPreset): AgentPayloadInput;
|
|
274
|
+
declare function groomerPresetVariants(getConfig: () => AlchemyGroomerConfig): AlchemyCopyVariant[];
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* THE table copy control (ALC-16): what a host binds as `MatrxDataTableHost.CopyControls`.
|
|
278
|
+
* design-system's table sits below alchemy, so it speaks only the copy contract
|
|
279
|
+
* (`CopyControlProps`); this answers it with the one Alchemy menu.
|
|
280
|
+
*/
|
|
281
|
+
declare function AlchemyTableCopyControls(props: CopyControlProps): React.JSX.Element;
|
|
282
|
+
|
|
283
|
+
type ContentTransferReferenceAction = {
|
|
284
|
+
id: string;
|
|
285
|
+
label: string;
|
|
286
|
+
run(): void | Promise<void>;
|
|
287
|
+
};
|
|
288
|
+
declare function AlchemyGlyph({ icon, ...props }: React.SVGAttributes<SVGSVGElement> & {
|
|
289
|
+
icon?: AlchemyIcon;
|
|
290
|
+
}): React.JSX.Element;
|
|
291
|
+
/** What a host injects into the menu: lazy format adapters (`@ai-matrx/alchemy/operate`) and AI preparation. */
|
|
292
|
+
type TransferCapabilities = {
|
|
293
|
+
formats?: FormatAdapter[];
|
|
294
|
+
ai?: AiPreparation;
|
|
295
|
+
};
|
|
296
|
+
type ContentTransferCapabilities = TransferCapabilities & {
|
|
297
|
+
/** Opaque host session boundary. It is used only to reset local menu state. */
|
|
298
|
+
identityKey?: string;
|
|
299
|
+
transport?: Transport;
|
|
300
|
+
reference?: ContentTransferReferencePort;
|
|
301
|
+
email?: ContentTransferEmailPort;
|
|
302
|
+
actions?: PageAction[];
|
|
303
|
+
preferences?: TransferPreferenceOverrides;
|
|
304
|
+
onOutcome?: (outcome: TransferOutcome) => void;
|
|
305
|
+
/**
|
|
306
|
+
* The host's window system (structurally `@ai-matrx/alchemy/ports` `WindowPort`, PP-01a). Bound:
|
|
307
|
+
* the preparation workspace opens inside a host window (WindowPanel in the web app, an honest
|
|
308
|
+
* full-screen dialog in the dashboard). Unbound: a near-full-screen dialog.
|
|
309
|
+
*/
|
|
310
|
+
window?: WorkspaceWindowPort;
|
|
311
|
+
};
|
|
312
|
+
declare function ContentTransferCapabilitiesProvider({ value, children }: {
|
|
313
|
+
value: ContentTransferCapabilities;
|
|
314
|
+
children: React.ReactNode;
|
|
315
|
+
}): React.JSX.Element;
|
|
316
|
+
declare const useContentTransferCapabilities: () => ContentTransferCapabilities;
|
|
317
|
+
declare function ContentTransferSurfaceProvider({ handle, children }: {
|
|
318
|
+
handle: SurfaceHandle;
|
|
319
|
+
children: React.ReactNode;
|
|
320
|
+
}): React.JSX.Element;
|
|
321
|
+
declare const useContentTransferSurface: () => SurfaceHandle | null;
|
|
322
|
+
interface TransferMenuPresentation {
|
|
323
|
+
group?: "save" | "chat" | "email";
|
|
324
|
+
prepared?: boolean;
|
|
325
|
+
hint?: string;
|
|
326
|
+
icon?: React.ComponentType<{
|
|
327
|
+
className?: string;
|
|
328
|
+
}>;
|
|
329
|
+
ariaLabel?: string;
|
|
330
|
+
/**
|
|
331
|
+
* Download-only actions join the shared format palette instead of a second menu. A "prepare"
|
|
332
|
+
* action opens THE preparation workspace (the table's "Filter & sort before copying…" door) and
|
|
333
|
+
* sits in "Edit and prepare", where people look for it — never under a heading of its own.
|
|
334
|
+
*/
|
|
335
|
+
placement?: "download" | "prepare";
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* THE PALETTE'S HEADINGS — a closed list. A host never supplies a heading: an action picks one of
|
|
339
|
+
* the named `group`s or its row shows INLINE with no heading (the approved-heading rule of
|
|
340
|
+
* `@ai-matrx/alchemy/menu`; a container word such as "Actions" or "More…" is never a heading).
|
|
341
|
+
*/
|
|
342
|
+
declare const PALETTE_HEADINGS: readonly ["Copy as", "Download as", "Quick copy", "Copy for AI", "Edit and prepare", "Other sources", "References", "Save to Matrx", "Continue with AI", "Email to me"];
|
|
343
|
+
type PaletteHeading = (typeof PALETTE_HEADINGS)[number];
|
|
344
|
+
interface TransferMenuVariant extends TransferMenuPresentation {
|
|
345
|
+
id: string;
|
|
346
|
+
label: string;
|
|
347
|
+
source: Source | Payload;
|
|
348
|
+
copyLabel?: string;
|
|
349
|
+
section?: "copy" | "ai";
|
|
350
|
+
successMessage?: string;
|
|
351
|
+
}
|
|
352
|
+
interface ContentTransferMenuProps {
|
|
353
|
+
source?: Payload | Source;
|
|
354
|
+
projection?: ExportProjection;
|
|
355
|
+
sections?: Section[];
|
|
356
|
+
preferences?: TransferPreferenceOverrides;
|
|
357
|
+
enabled?: boolean;
|
|
358
|
+
surface?: SurfaceHandle;
|
|
359
|
+
label?: string;
|
|
360
|
+
/**
|
|
361
|
+
* Tabular sources. `size` is the live size the host knows ("1,240 rows · 12 columns"): the
|
|
362
|
+
* palette's "Filter & sort before copying…" door shows it (PP-08).
|
|
363
|
+
*/
|
|
364
|
+
table?: {
|
|
365
|
+
availableScopes: TransferScope[];
|
|
366
|
+
initialScope: TransferScope;
|
|
367
|
+
scopeLabels?: Partial<Record<TransferScope, string>>;
|
|
368
|
+
size?: string;
|
|
369
|
+
};
|
|
370
|
+
references?: readonly ContentTransferReference[];
|
|
371
|
+
referenceActions?: readonly ContentTransferReferenceAction[];
|
|
372
|
+
/** A quick format may explicitly capture a different representation. */
|
|
373
|
+
formatSources?: Partial<Record<SerializableFormat, Source | Payload>>;
|
|
374
|
+
/** Set false for action-only hosts; source formats and adapters are then omitted. */
|
|
375
|
+
sourceFormats?: boolean;
|
|
376
|
+
/** Named alternate sources open this same preparation workspace. */
|
|
377
|
+
variants?: readonly TransferMenuVariant[];
|
|
378
|
+
actions?: (PageAction & TransferMenuPresentation)[];
|
|
379
|
+
capabilities?: ContentTransferCapabilities;
|
|
380
|
+
disabled?: boolean;
|
|
381
|
+
/** Portal is the default Alchemy mark; copy-transform remains opt-in. */
|
|
382
|
+
icon?: AlchemyIcon;
|
|
383
|
+
/** Uses the canonical TapTargetButton presentation. */
|
|
384
|
+
triggerVariant?: "transparent" | "glass" | "outline";
|
|
385
|
+
triggerSize?: "default" | "compact";
|
|
386
|
+
/** Mount the transfer session without a visible trigger for a host-owned menu command. */
|
|
387
|
+
triggerHidden?: boolean;
|
|
388
|
+
className?: string;
|
|
389
|
+
stopPropagation?: boolean;
|
|
390
|
+
hide?: readonly ("copy" | "prepare" | "download")[];
|
|
391
|
+
controllerRef?: React.Ref<ContentTransferController>;
|
|
392
|
+
/** Who the primary source is, for the AI envelope (PP-10); read when the workspace opens. */
|
|
393
|
+
envelope?: () => EnvelopeMeta | undefined;
|
|
394
|
+
/**
|
|
395
|
+
* Rich-text hosts: one implementation of the three copies. The main Copy click runs "default"
|
|
396
|
+
* (text/plain = markdown AND text/html = formatted); the panel leads with "Copy markdown" and
|
|
397
|
+
* "Copy text". When set, the plain / Markdown tiles give way to those two.
|
|
398
|
+
*/
|
|
399
|
+
richCopy?: RichCopyRunner;
|
|
400
|
+
/** The flavors the runner can honestly produce as tiles (default both). A host with no readable-text projection omits "text". */
|
|
401
|
+
richCopyFlavors?: readonly Exclude<RichCopyFlavor, "default">[];
|
|
402
|
+
}
|
|
403
|
+
type RichCopyFlavor = "default" | "markdown" | "text";
|
|
404
|
+
type RichCopyRunner = (flavor: RichCopyFlavor) => Promise<TransferOutcome | boolean | void> | TransferOutcome | boolean | void;
|
|
405
|
+
interface ContentTransferController {
|
|
406
|
+
focusTrigger(): void;
|
|
407
|
+
/** Mount the one canonical Alchemy palette in a host-owned menu surface. */
|
|
408
|
+
mountPalette(target: HTMLElement | null, onClose?: () => void, restoreFocus?: () => void): void;
|
|
409
|
+
preparePrimary(options?: {
|
|
410
|
+
restoreFocus?: () => void;
|
|
411
|
+
}): Promise<void>;
|
|
412
|
+
prepare(source: Source | Payload, options?: {
|
|
413
|
+
id?: string;
|
|
414
|
+
label?: string;
|
|
415
|
+
envelope?: EnvelopeMeta;
|
|
416
|
+
}): Promise<void>;
|
|
417
|
+
/** Open the workspace on a host's own levers (aiCustom / groomer): the levers live beside the preview (PP-02). */
|
|
418
|
+
prepareLevers(levers: WorkspaceLevers, options: {
|
|
419
|
+
id: string;
|
|
420
|
+
label: string;
|
|
421
|
+
}): Promise<void>;
|
|
422
|
+
}
|
|
423
|
+
declare function ContentTransferMenu(props: ContentTransferMenuProps): React.JSX.Element;
|
|
424
|
+
/**
|
|
425
|
+
* What a source can say about itself without being built: its payload kind (and a text's language),
|
|
426
|
+
* and whether building it is cheap. The menu inspects a source that declares its shape by the shape
|
|
427
|
+
* alone, so opening the menu never builds the content — a person's pick does (sec_8f1a9be1…: a
|
|
428
|
+
* 1,636-organization page capture froze its page for 4.1 s on open). `cheap` sources (a short,
|
|
429
|
+
* already-built string) still take part in the twin check (PP-09); anything else is never built
|
|
430
|
+
* to decide which items to show.
|
|
431
|
+
*/
|
|
432
|
+
type SourceShape = {
|
|
433
|
+
kind: "text" | "markdown" | "json";
|
|
434
|
+
language?: string;
|
|
435
|
+
cheap?: boolean;
|
|
436
|
+
};
|
|
437
|
+
type ShapedSource = Source & {
|
|
438
|
+
shape?: SourceShape;
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
export { type AlchemyCopyVariant, type AlchemyCustomSource, type AlchemyDetail, type AlchemyExportItem, AlchemyGlyph, type AlchemyGroomerConfig, type AlchemyGroomerPreset, type AlchemyGroomerSection, type AlchemyOptionValues, type AlchemySourceOption, AlchemyTableCopyControls, type ContentTransferCapabilities, ContentTransferCapabilitiesProvider, type ContentTransferController, type ContentTransferEmailPort, ContentTransferMenu, type ContentTransferMenuProps, type ContentTransferReferenceAction, type ContentTransferReferencePort, ContentTransferSurfaceProvider, type EnvelopeMeta, GROOMER_LEVELS, MatrxCopyMenu, type MatrxCopyMenuProps, PALETTE_HEADINGS, type PaletteHeading, type RichCopyFlavor, type RichCopyRunner, type SerializableFormat, type ShapedSource, type SourceShape, type TransferCapabilities, type TransferMenuPresentation, type TransferMenuVariant, type WorkspaceLevers, type WorkspaceWindowHandle, type WorkspaceWindowPort, applyGroomerPreset, buildGroomerPresetPayload, createTransferEmailActions, defaultGroomerSelections, groomerPresetVariants, tableDataFormat, tableSchemaFormat, useContentTransferCapabilities, useContentTransferSurface };
|