@agimon-ai/po-image-gen 0.0.0-alpha.21 → 0.0.0-alpha.22
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/extensions/native.mjs +518 -0
- package/dist/extensions/native.mjs.map +1 -0
- package/dist/extensions/server.cjs +15 -8
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.mjs +15 -8
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +5 -7
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/{imagegenTool-h52TFcyE.mjs → imagegenTool-BAbloo9g.mjs} +7 -3
- package/dist/imagegenTool-BAbloo9g.mjs.map +1 -0
- package/dist/{imagegenTool-BPayinSe.cjs → imagegenTool-BKyyKu6T.cjs} +12 -2
- package/dist/imagegenTool-BKyyKu6T.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +35 -9
- package/dist/imagegenTool-BPayinSe.cjs.map +0 -1
- package/dist/imagegenTool-h52TFcyE.mjs.map +0 -1
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
import { createApiClient, defineActivityGroup, defineFill, defineNativePlugin, defineToolRenderer, nativeApiTransport, sessionApiAddress } from "@agimon-ai/po-core/native";
|
|
2
|
+
import { Button, ImageIcon, MessageItem, MessageItemBody, MessageItemHeader, MessageItemStatus, fontOf, resultTextLines, toolTone } from "@agimon-ai/po-native-components";
|
|
3
|
+
import { createElement, useEffect, useState } from "react";
|
|
4
|
+
import { Text } from "react-native-unistyles/components/native/Text";
|
|
5
|
+
import { ScrollView } from "react-native-unistyles/components/native/ScrollView";
|
|
6
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
7
|
+
import { View } from "react-native-unistyles/components/native/View";
|
|
8
|
+
import { Pressable } from "react-native-unistyles/components/native/Pressable";
|
|
9
|
+
import { Image } from "react-native-unistyles/components/native/Image";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
const api = createApiClient({
|
|
12
|
+
listImages: {
|
|
13
|
+
method: "GET",
|
|
14
|
+
path: "/artifacts",
|
|
15
|
+
query: ["limit", "cursor"],
|
|
16
|
+
response: void 0
|
|
17
|
+
},
|
|
18
|
+
readImage: {
|
|
19
|
+
method: "GET",
|
|
20
|
+
path: "/artifact",
|
|
21
|
+
query: ["id", "toolCallId"],
|
|
22
|
+
response: void 0
|
|
23
|
+
}
|
|
24
|
+
}, {
|
|
25
|
+
scopes: ["session"],
|
|
26
|
+
basePath: "images",
|
|
27
|
+
transport: nativeApiTransport,
|
|
28
|
+
sessionAddress: sessionApiAddress
|
|
29
|
+
});
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/_components/SessionImagesView.native.tsx
|
|
32
|
+
/** Tiles the activity row shows; the web grid shows the same six. */
|
|
33
|
+
const ACTIVITY_TILES = 6;
|
|
34
|
+
/**
|
|
35
|
+
* Presentation only, as the web's ImagesGridView. The activity row is a 3x2
|
|
36
|
+
* thumbnail grid; the gallery is two labelled columns, so each tile clears a
|
|
37
|
+
* 44pt target on a phone.
|
|
38
|
+
*/
|
|
39
|
+
function ImagesGridView({ images, state, error, onOpen, variant, hasMore, onMore }) {
|
|
40
|
+
if (state === "error") return /* @__PURE__ */ jsx(Text, {
|
|
41
|
+
accessibilityRole: "alert",
|
|
42
|
+
style: [styles$2.sans, styles$2.error],
|
|
43
|
+
children: error ?? "Images could not be loaded."
|
|
44
|
+
});
|
|
45
|
+
if (state === "ready" && images.length === 0) return /* @__PURE__ */ jsx(Text, {
|
|
46
|
+
style: [styles$2.sans, styles$2.dim],
|
|
47
|
+
children: "Images generated in this session will appear here."
|
|
48
|
+
});
|
|
49
|
+
const visible = variant === "activity" ? images.slice(0, ACTIVITY_TILES) : images;
|
|
50
|
+
const tileStyle = variant === "activity" ? styles$2.activityTile : styles$2.galleryTile;
|
|
51
|
+
return /* @__PURE__ */ jsxs(View, {
|
|
52
|
+
style: styles$2.grid,
|
|
53
|
+
children: [/* @__PURE__ */ jsx(View, {
|
|
54
|
+
style: styles$2.tiles,
|
|
55
|
+
children: state === "loading" && visible.length === 0 ? Array.from({ length: ACTIVITY_TILES }, (_, index) => /* @__PURE__ */ jsx(View, { style: [tileStyle, styles$2.placeholder] }, index)) : visible.map((image) => /* @__PURE__ */ jsxs(Pressable, {
|
|
56
|
+
testID: `image-thumbnail-${image.id}`,
|
|
57
|
+
accessibilityRole: "button",
|
|
58
|
+
accessibilityLabel: `Open ${image.label}`,
|
|
59
|
+
onPress: () => onOpen(image.id),
|
|
60
|
+
style: ({ pressed }) => [
|
|
61
|
+
tileStyle,
|
|
62
|
+
styles$2.tile,
|
|
63
|
+
pressed && styles$2.pressed
|
|
64
|
+
],
|
|
65
|
+
children: [image.src ? /* @__PURE__ */ jsx(Image, {
|
|
66
|
+
source: { uri: image.src },
|
|
67
|
+
resizeMode: "cover",
|
|
68
|
+
style: styles$2.thumbnail
|
|
69
|
+
}) : /* @__PURE__ */ jsx(View, { style: [styles$2.thumbnail, styles$2.placeholder] }), variant === "gallery" ? /* @__PURE__ */ jsx(Text, {
|
|
70
|
+
numberOfLines: 1,
|
|
71
|
+
style: [styles$2.sans, styles$2.label],
|
|
72
|
+
children: image.label
|
|
73
|
+
}) : null]
|
|
74
|
+
}, image.id))
|
|
75
|
+
}), hasMore ? /* @__PURE__ */ jsx(Button, {
|
|
76
|
+
variant: "outline",
|
|
77
|
+
onPress: onMore,
|
|
78
|
+
disabled: state === "loading",
|
|
79
|
+
children: "Load more images"
|
|
80
|
+
}) : null]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/** Full width at the PNG's own aspect ratio, so it is never letterboxed. */
|
|
84
|
+
function FittedImage({ src, accessibilityLabel, maxHeight }) {
|
|
85
|
+
const [aspectRatio, setAspectRatio] = useState(1);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
let live = true;
|
|
88
|
+
Image.getSize(src, (width, height) => {
|
|
89
|
+
if (live && width > 0 && height > 0) setAspectRatio(width / height);
|
|
90
|
+
});
|
|
91
|
+
return () => {
|
|
92
|
+
live = false;
|
|
93
|
+
};
|
|
94
|
+
}, [src]);
|
|
95
|
+
return /* @__PURE__ */ jsx(Image, {
|
|
96
|
+
source: { uri: src },
|
|
97
|
+
accessibilityLabel,
|
|
98
|
+
resizeMode: "contain",
|
|
99
|
+
style: [styles$2.fittedImage, {
|
|
100
|
+
aspectRatio,
|
|
101
|
+
maxHeight
|
|
102
|
+
}]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/** The full image with its title. Read only: native has no Author feedback panel yet. */
|
|
106
|
+
function ImageViewerView({ image }) {
|
|
107
|
+
return /* @__PURE__ */ jsxs(ScrollView, {
|
|
108
|
+
testID: "session-image-viewer",
|
|
109
|
+
contentContainerStyle: styles$2.viewer,
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ jsx(Text, {
|
|
112
|
+
accessibilityRole: "header",
|
|
113
|
+
numberOfLines: 1,
|
|
114
|
+
style: [styles$2.sans, styles$2.heading],
|
|
115
|
+
children: image.label
|
|
116
|
+
}),
|
|
117
|
+
image.src ? /* @__PURE__ */ jsx(FittedImage, {
|
|
118
|
+
src: image.src,
|
|
119
|
+
accessibilityLabel: image.label
|
|
120
|
+
}) : /* @__PURE__ */ jsx(Text, {
|
|
121
|
+
accessibilityRole: "alert",
|
|
122
|
+
style: [styles$2.sans, styles$2.error],
|
|
123
|
+
children: "This image could not be loaded."
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ jsx(Text, {
|
|
126
|
+
style: [styles$2.sans, styles$2.dim],
|
|
127
|
+
children: "Original image, read only."
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
const styles$2 = StyleSheet.create((theme) => ({
|
|
133
|
+
sans: {
|
|
134
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
135
|
+
fontSize: theme.fontSize.base,
|
|
136
|
+
lineHeight: theme.lineHeight.base,
|
|
137
|
+
uni__dependencies: [0]
|
|
138
|
+
},
|
|
139
|
+
dim: {
|
|
140
|
+
color: theme.colors.dim,
|
|
141
|
+
uni__dependencies: [0]
|
|
142
|
+
},
|
|
143
|
+
error: {
|
|
144
|
+
color: theme.colors.red,
|
|
145
|
+
uni__dependencies: [0]
|
|
146
|
+
},
|
|
147
|
+
grid: {
|
|
148
|
+
gap: theme.spacing(3),
|
|
149
|
+
uni__dependencies: [0]
|
|
150
|
+
},
|
|
151
|
+
tiles: {
|
|
152
|
+
flexDirection: "row",
|
|
153
|
+
flexWrap: "wrap",
|
|
154
|
+
gap: theme.spacing(2),
|
|
155
|
+
uni__dependencies: [0]
|
|
156
|
+
},
|
|
157
|
+
activityTile: {
|
|
158
|
+
width: "31%",
|
|
159
|
+
aspectRatio: 1
|
|
160
|
+
},
|
|
161
|
+
galleryTile: { width: "48%" },
|
|
162
|
+
tile: {
|
|
163
|
+
overflow: "hidden",
|
|
164
|
+
borderRadius: theme.borderRadius.md,
|
|
165
|
+
borderWidth: 1,
|
|
166
|
+
borderColor: theme.colors.border,
|
|
167
|
+
backgroundColor: theme.colors.deep,
|
|
168
|
+
uni__dependencies: [0]
|
|
169
|
+
},
|
|
170
|
+
pressed: { opacity: .8 },
|
|
171
|
+
thumbnail: {
|
|
172
|
+
width: "100%",
|
|
173
|
+
aspectRatio: 1
|
|
174
|
+
},
|
|
175
|
+
placeholder: {
|
|
176
|
+
borderRadius: theme.borderRadius.md,
|
|
177
|
+
backgroundColor: theme.colors.deep,
|
|
178
|
+
uni__dependencies: [0]
|
|
179
|
+
},
|
|
180
|
+
label: {
|
|
181
|
+
paddingHorizontal: theme.spacing(2),
|
|
182
|
+
paddingVertical: theme.spacing(2),
|
|
183
|
+
color: theme.colors.text,
|
|
184
|
+
uni__dependencies: [0]
|
|
185
|
+
},
|
|
186
|
+
viewer: {
|
|
187
|
+
gap: theme.spacing(3),
|
|
188
|
+
padding: theme.spacing(4),
|
|
189
|
+
uni__dependencies: [0]
|
|
190
|
+
},
|
|
191
|
+
heading: {
|
|
192
|
+
color: theme.colors.hi,
|
|
193
|
+
fontSize: theme.fontSize.lg,
|
|
194
|
+
lineHeight: theme.lineHeight.lg,
|
|
195
|
+
fontWeight: theme.fontWeight.semibold,
|
|
196
|
+
uni__dependencies: [0]
|
|
197
|
+
},
|
|
198
|
+
fittedImage: {
|
|
199
|
+
width: "100%",
|
|
200
|
+
borderRadius: theme.borderRadius.md,
|
|
201
|
+
uni__dependencies: [0]
|
|
202
|
+
}
|
|
203
|
+
}));
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/_components/SessionImages.native.tsx
|
|
206
|
+
function imagesGalleryTab() {
|
|
207
|
+
return {
|
|
208
|
+
id: "image-gen-gallery",
|
|
209
|
+
label: "Images",
|
|
210
|
+
panel: ImagesGallery
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* The viewer shows bytes the caller already holds: the tool result's inline PNG
|
|
215
|
+
* or a gallery tile's artifact data.
|
|
216
|
+
*
|
|
217
|
+
* ponytail: no durable-artifact lookup, because the web only needs it for the
|
|
218
|
+
* Author feedback panel and no native package contributes one. Resolve it as
|
|
219
|
+
* the web's transcriptImageTab does once native Author feedback exists.
|
|
220
|
+
*/
|
|
221
|
+
function imageViewerTab(sessionId, image) {
|
|
222
|
+
return {
|
|
223
|
+
id: `image-gen-image-${encodeURIComponent(image.id)}`,
|
|
224
|
+
label: image.label,
|
|
225
|
+
panel: (props) => props.sessionId === sessionId ? /* @__PURE__ */ jsx(ImageViewerView, { image }) : null
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function ImagesActivity(props) {
|
|
229
|
+
return /* @__PURE__ */ jsx(SessionImages, {
|
|
230
|
+
...props,
|
|
231
|
+
variant: "activity"
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
function ImagesGallery(props) {
|
|
235
|
+
return /* @__PURE__ */ jsxs(ScrollView, {
|
|
236
|
+
testID: "session-images-gallery",
|
|
237
|
+
contentContainerStyle: styles$1.gallery,
|
|
238
|
+
children: [
|
|
239
|
+
/* @__PURE__ */ jsx(Text, {
|
|
240
|
+
accessibilityRole: "header",
|
|
241
|
+
style: [styles$1.sans, styles$1.heading],
|
|
242
|
+
children: "Images"
|
|
243
|
+
}),
|
|
244
|
+
/* @__PURE__ */ jsx(Text, {
|
|
245
|
+
style: [styles$1.sans, styles$1.dim],
|
|
246
|
+
children: "Generated in this session, newest first."
|
|
247
|
+
}),
|
|
248
|
+
/* @__PURE__ */ jsx(SessionImages, {
|
|
249
|
+
...props,
|
|
250
|
+
variant: "gallery"
|
|
251
|
+
})
|
|
252
|
+
]
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
function SessionImages(props) {
|
|
256
|
+
if (props.sessionId === null) return null;
|
|
257
|
+
return /* @__PURE__ */ jsx(ImagesPage, {
|
|
258
|
+
...props,
|
|
259
|
+
sessionId: props.sessionId
|
|
260
|
+
}, `${props.sessionId}:${props.statuses["image-gen.images"] ?? ""}`);
|
|
261
|
+
}
|
|
262
|
+
function ImagesPage(props) {
|
|
263
|
+
const [images, setImages] = useState([]);
|
|
264
|
+
const [cursor, setCursor] = useState("0");
|
|
265
|
+
const [nextCursor, setNextCursor] = useState(null);
|
|
266
|
+
const [state, setState] = useState("loading");
|
|
267
|
+
const [error, setError] = useState("");
|
|
268
|
+
useEffect(() => {
|
|
269
|
+
const controller = new AbortController();
|
|
270
|
+
setState("loading");
|
|
271
|
+
(async () => {
|
|
272
|
+
const session = api.session(props.sessionId);
|
|
273
|
+
const response = await session.listImages({
|
|
274
|
+
query: {
|
|
275
|
+
limit: "6",
|
|
276
|
+
cursor
|
|
277
|
+
},
|
|
278
|
+
signal: controller.signal
|
|
279
|
+
});
|
|
280
|
+
if (!response.ok) throw new Error(response.error || "Images could not be loaded.");
|
|
281
|
+
if (response.data.sessionId !== props.sessionId) throw new Error("Image history belongs to another session.");
|
|
282
|
+
const artifacts = await Promise.all(response.data.items.map(async ({ id }) => {
|
|
283
|
+
const result = await session.readImage({
|
|
284
|
+
query: { id },
|
|
285
|
+
signal: controller.signal
|
|
286
|
+
});
|
|
287
|
+
if (!result.ok) {
|
|
288
|
+
if (result.status === 404) return null;
|
|
289
|
+
throw new Error(result.error || "An image could not be loaded.");
|
|
290
|
+
}
|
|
291
|
+
if (result.data.sessionId !== props.sessionId) throw new Error("Image belongs to another session.");
|
|
292
|
+
return result.data;
|
|
293
|
+
}));
|
|
294
|
+
if (controller.signal.aborted) return;
|
|
295
|
+
const tiles = artifacts.flatMap((artifact) => artifact ? [{
|
|
296
|
+
id: artifact.id,
|
|
297
|
+
label: `Image ${artifact.id}`,
|
|
298
|
+
src: `data:image/png;base64,${artifact.data}`
|
|
299
|
+
}] : []);
|
|
300
|
+
setImages((previous) => cursor === "0" ? tiles : [...previous, ...tiles.filter((tile) => !previous.some(({ id }) => id === tile.id))]);
|
|
301
|
+
setNextCursor(response.data.nextCursor);
|
|
302
|
+
setState("ready");
|
|
303
|
+
})().catch((reason) => {
|
|
304
|
+
if (controller.signal.aborted) return;
|
|
305
|
+
setError(reason instanceof Error ? reason.message : "Images could not be loaded.");
|
|
306
|
+
setState("error");
|
|
307
|
+
});
|
|
308
|
+
return () => controller.abort();
|
|
309
|
+
}, [props.sessionId, cursor]);
|
|
310
|
+
return /* @__PURE__ */ jsx(ImagesGridView, {
|
|
311
|
+
images,
|
|
312
|
+
state,
|
|
313
|
+
error,
|
|
314
|
+
variant: props.variant,
|
|
315
|
+
onOpen: (id) => {
|
|
316
|
+
const image = images.find((tile) => tile.id === id);
|
|
317
|
+
if (image) props.openTransientTab(imageViewerTab(props.sessionId, image));
|
|
318
|
+
},
|
|
319
|
+
hasMore: props.variant === "gallery" && nextCursor !== null,
|
|
320
|
+
onMore: () => {
|
|
321
|
+
if (nextCursor !== null && state !== "loading") setCursor(nextCursor);
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
const styles$1 = StyleSheet.create((theme) => ({
|
|
326
|
+
gallery: {
|
|
327
|
+
gap: theme.spacing(2),
|
|
328
|
+
padding: theme.spacing(4),
|
|
329
|
+
uni__dependencies: [0]
|
|
330
|
+
},
|
|
331
|
+
sans: {
|
|
332
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
333
|
+
fontSize: theme.fontSize.base,
|
|
334
|
+
lineHeight: theme.lineHeight.base,
|
|
335
|
+
uni__dependencies: [0]
|
|
336
|
+
},
|
|
337
|
+
heading: {
|
|
338
|
+
color: theme.colors.hi,
|
|
339
|
+
fontSize: theme.fontSize.lg,
|
|
340
|
+
lineHeight: theme.lineHeight.lg,
|
|
341
|
+
fontWeight: theme.fontWeight.semibold,
|
|
342
|
+
uni__dependencies: [0]
|
|
343
|
+
},
|
|
344
|
+
dim: {
|
|
345
|
+
color: theme.colors.dim,
|
|
346
|
+
uni__dependencies: [0]
|
|
347
|
+
}
|
|
348
|
+
}));
|
|
349
|
+
//#endregion
|
|
350
|
+
//#region src/extensions/workspaces/sessions/(frontend)/activity-group/images.native.ts
|
|
351
|
+
var images_native_default = defineActivityGroup({
|
|
352
|
+
name: "Images",
|
|
353
|
+
keys: "",
|
|
354
|
+
icon: () => createElement(ImageIcon),
|
|
355
|
+
activeSource: {
|
|
356
|
+
subscribe: () => () => void 0,
|
|
357
|
+
isActive: () => false
|
|
358
|
+
},
|
|
359
|
+
marksBackgroundWork: false,
|
|
360
|
+
transientTab: imagesGalleryTab,
|
|
361
|
+
order: 35
|
|
362
|
+
});
|
|
363
|
+
//#endregion
|
|
364
|
+
//#region src/extensions/workspaces/sessions/(frontend)/fill/Images.activity.Images.native.tsx
|
|
365
|
+
var Images_activity_Images_native_default = defineFill({
|
|
366
|
+
slot: "activity.Images",
|
|
367
|
+
component: ImagesActivity
|
|
368
|
+
});
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/_lib/imagegenToolView.ts
|
|
371
|
+
function imagegenToolView({ args, result }) {
|
|
372
|
+
const prompt = typeof args.prompt === "string" ? args.prompt : "";
|
|
373
|
+
const editing = Array.isArray(args.referenced_image_paths) && args.referenced_image_paths.length > 0;
|
|
374
|
+
const image = result?.content.find((block) => block !== null && typeof block === "object" && "type" in block && block.type === "image" && "mimeType" in block && block.mimeType === "image/png" && "data" in block && typeof block.data === "string");
|
|
375
|
+
const src = image ? `data:image/png;base64,${image.data}` : void 0;
|
|
376
|
+
const details = result?.details;
|
|
377
|
+
return {
|
|
378
|
+
prompt,
|
|
379
|
+
editing,
|
|
380
|
+
src,
|
|
381
|
+
inlineOnly: details !== null && typeof details === "object" && "saveWarning" in details && typeof details.saveWarning === "string"
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/_components/ImagegenToolMessage.native.tsx
|
|
386
|
+
/** Tallest the image gets in the card; the web caps it at 24rem. */
|
|
387
|
+
const IMAGE_MAX_HEIGHT = 384;
|
|
388
|
+
/**
|
|
389
|
+
* The imagegen tool's timeline item on native, as the web's ImagegenToolMessage:
|
|
390
|
+
* the prompt in the header and, expanded by default, the image full width with
|
|
391
|
+
* the tool's own lines under it. Tapping the image opens it full size.
|
|
392
|
+
*/
|
|
393
|
+
function ImagegenToolMessage(props) {
|
|
394
|
+
const { result, output, running, isError, sessionId } = props;
|
|
395
|
+
const view = imagegenToolView(props);
|
|
396
|
+
const label = view.prompt || "Generated image";
|
|
397
|
+
return /* @__PURE__ */ jsx(MessageItem, {
|
|
398
|
+
tone: toolTone({
|
|
399
|
+
running,
|
|
400
|
+
isError
|
|
401
|
+
}),
|
|
402
|
+
expandable: true,
|
|
403
|
+
defaultExpanded: true,
|
|
404
|
+
children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
405
|
+
title: "imagegen",
|
|
406
|
+
children: /* @__PURE__ */ jsxs(View, {
|
|
407
|
+
testID: "tool-call-imagegen",
|
|
408
|
+
style: styles.summary,
|
|
409
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
410
|
+
numberOfLines: 1,
|
|
411
|
+
style: [styles.sans, styles.prompt],
|
|
412
|
+
children: view.prompt
|
|
413
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
414
|
+
style: [styles.sans, styles.faint],
|
|
415
|
+
children: view.editing ? "edit" : "generate"
|
|
416
|
+
})]
|
|
417
|
+
})
|
|
418
|
+
}), expanded ? /* @__PURE__ */ jsxs(MessageItemBody, {
|
|
419
|
+
testID: "tool-result-imagegen",
|
|
420
|
+
children: [
|
|
421
|
+
running ? /* @__PURE__ */ jsx(MessageItemStatus, {
|
|
422
|
+
tone: "running",
|
|
423
|
+
children: "creating image"
|
|
424
|
+
}) : null,
|
|
425
|
+
isError ? /* @__PURE__ */ jsx(MessageItemStatus, {
|
|
426
|
+
tone: "error",
|
|
427
|
+
children: "failed"
|
|
428
|
+
}) : null,
|
|
429
|
+
!isError && view.src ? /* @__PURE__ */ jsx(Pressable, {
|
|
430
|
+
accessibilityRole: "button",
|
|
431
|
+
accessibilityLabel: `Open ${label}`,
|
|
432
|
+
disabled: sessionId === null,
|
|
433
|
+
onPress: () => {
|
|
434
|
+
if (sessionId !== null && view.src) props.openTransientTab(imageViewerTab(sessionId, {
|
|
435
|
+
id: `transcript-${props.toolCallId}`,
|
|
436
|
+
label,
|
|
437
|
+
src: view.src
|
|
438
|
+
}));
|
|
439
|
+
},
|
|
440
|
+
children: /* @__PURE__ */ jsx(FittedImage, {
|
|
441
|
+
src: view.src,
|
|
442
|
+
maxHeight: IMAGE_MAX_HEIGHT
|
|
443
|
+
})
|
|
444
|
+
}) : null,
|
|
445
|
+
resultTextLines(result, output).map((line, index) => /* @__PURE__ */ jsx(Text, {
|
|
446
|
+
selectable: true,
|
|
447
|
+
style: [styles.sans, isError ? styles.error : styles.dim],
|
|
448
|
+
children: line
|
|
449
|
+
}, `${String(index)}-${line}`))
|
|
450
|
+
]
|
|
451
|
+
}) : null] })
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
const styles = StyleSheet.create((theme) => ({
|
|
455
|
+
summary: {
|
|
456
|
+
flex: 1,
|
|
457
|
+
flexDirection: "row",
|
|
458
|
+
alignItems: "center",
|
|
459
|
+
gap: theme.spacing(2),
|
|
460
|
+
minWidth: 0,
|
|
461
|
+
uni__dependencies: [0]
|
|
462
|
+
},
|
|
463
|
+
sans: {
|
|
464
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
465
|
+
fontSize: theme.fontSize.base,
|
|
466
|
+
lineHeight: theme.lineHeight.base,
|
|
467
|
+
uni__dependencies: [0]
|
|
468
|
+
},
|
|
469
|
+
prompt: {
|
|
470
|
+
flex: 1,
|
|
471
|
+
minWidth: 0,
|
|
472
|
+
color: theme.colors.text,
|
|
473
|
+
uni__dependencies: [0]
|
|
474
|
+
},
|
|
475
|
+
faint: {
|
|
476
|
+
flexShrink: 0,
|
|
477
|
+
color: theme.colors.faint,
|
|
478
|
+
uni__dependencies: [0]
|
|
479
|
+
},
|
|
480
|
+
dim: {
|
|
481
|
+
color: theme.colors.dim,
|
|
482
|
+
uni__dependencies: [0]
|
|
483
|
+
},
|
|
484
|
+
error: {
|
|
485
|
+
color: theme.colors.red,
|
|
486
|
+
uni__dependencies: [0]
|
|
487
|
+
}
|
|
488
|
+
}));
|
|
489
|
+
//#endregion
|
|
490
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/imagegen.native.tsx
|
|
491
|
+
var imagegen_native_default = defineToolRenderer({ message: ImagegenToolMessage });
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region generated/native.ts
|
|
494
|
+
const via = (identity, value) => value === void 0 ? void 0 : {
|
|
495
|
+
...identity,
|
|
496
|
+
...value
|
|
497
|
+
};
|
|
498
|
+
const nativePlugin = defineNativePlugin({
|
|
499
|
+
id: "image-gen",
|
|
500
|
+
session: {
|
|
501
|
+
get activityGroups() {
|
|
502
|
+
return [via({ name: "images" }, images_native_default)];
|
|
503
|
+
},
|
|
504
|
+
get fills() {
|
|
505
|
+
return [via({
|
|
506
|
+
slot: "activity.Images",
|
|
507
|
+
id: "images"
|
|
508
|
+
}, Images_activity_Images_native_default)];
|
|
509
|
+
},
|
|
510
|
+
get toolRenderers() {
|
|
511
|
+
return [via({ tools: ["imagegen"] }, imagegen_native_default)];
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
//#endregion
|
|
516
|
+
export { nativePlugin };
|
|
517
|
+
|
|
518
|
+
//# sourceMappingURL=native.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.mjs","names":["Button","fontOf","PoNativeTheme","useEffect","useState","StyleSheet","ImageTile","id","label","src","ImagesGridViewProps","images","state","error","onOpen","variant","hasMore","onMore","ACTIVITY_TILES","ImagesGridView","styles","sans","length","dim","visible","slice","tileStyle","activityTile","galleryTile","grid","tiles","Array","from","_","index","placeholder","map","image","pressed","tile","uri","thumbnail","FittedImageProps","accessibilityLabel","maxHeight","FittedImage","aspectRatio","setAspectRatio","live","Image","getSize","width","height","fittedImage","ImageViewerViewProps","ImageViewerView","viewer","heading","create","theme","fontFamily","fontSize","base","lineHeight","uni__dependencies","color","colors","red","gap","spacing","flexDirection","flexWrap","overflow","borderRadius","md","borderWidth","borderColor","border","backgroundColor","deep","opacity","paddingHorizontal","paddingVertical","text","padding","hi","lg","fontWeight","semibold","styles","WebPluginSlotProps","fontOf","PoNativeTheme","useEffect","useState","StyleSheet","api","ImagesGridView","ImageViewerView","ImageTile","TransientTab","Parameters","imagesGalleryTab","id","label","panel","ImagesGallery","imageViewerTab","sessionId","image","encodeURIComponent","props","ImagesActivity","styles","gallery","sans","heading","dim","SessionImages","variant","statuses","ImagesPage","images","setImages","cursor","setCursor","nextCursor","setNextCursor","state","setState","error","setError","controller","AbortController","session","response","listImages","query","limit","signal","ok","Error","data","artifacts","Promise","all","items","map","result","readImage","status","aborted","tiles","flatMap","artifact","src","previous","filter","tile","some","catch","reason","message","abort","find","openTransientTab","create","theme","gap","spacing","padding","uni__dependencies","fontFamily","fontSize","base","lineHeight","color","colors","hi","lg","fontWeight","semibold","styles","ToolMessageRenderProps","fontOf","MessageItem","MessageItemBody","MessageItemHeader","MessageItemStatus","resultTextLines","toolTone","PoNativeTheme","StyleSheet","imagegenToolView","imageViewerTab","FittedImage","IMAGE_MAX_HEIGHT","ImagegenToolMessage","props","result","output","running","isError","sessionId","view","label","prompt","expanded","styles","summary","sans","faint","editing","src","openTransientTab","id","toolCallId","map","line","index","String","error","dim","create","theme","flex","flexDirection","alignItems","gap","spacing","minWidth","uni__dependencies","fontFamily","fontSize","base","lineHeight","color","colors","text","flexShrink","red","activityGroupImages","fillImages","toolImagegen"],"sources":["../../src/types/apiRoutes.ts","../../generated/client.native.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/SessionImagesView.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/SessionImages.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/activity-group/images.native.ts","../../src/extensions/workspaces/sessions/(frontend)/fill/Images.activity.Images.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/imagegenToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/ImagegenToolMessage.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/imagegen.native.tsx","../../generated/native.ts"],"sourcesContent":["// Type-only imports: the native bundle loads this file and may not import po-core/web at runtime.\nimport type { ApiResponseOf, ApiRoutes } from '@agimon-ai/po-core/web';\n\nimport type { ImageArtifact, ImageArtifactList } from './imageArtifacts';\n\nexport const routes = {\n listImages: {\n method: 'GET',\n path: '/artifacts',\n query: ['limit', 'cursor'],\n response: undefined as unknown as ApiResponseOf<ImageArtifactList>,\n },\n readImage: {\n method: 'GET',\n path: '/artifact',\n query: ['id', 'toolCallId'],\n response: undefined as unknown as ApiResponseOf<ImageArtifact>,\n },\n} as const satisfies ApiRoutes;\nexport default routes;\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { createApiClient, nativeApiTransport, sessionApiAddress } from '@agimon-ai/po-core/native';\n\nimport routes from '../src/types/apiRoutes';\n\n/** Scopes the tree mounts 'images' at. */\nexport const apiScopes = ['session'] as const;\n\nexport const api = createApiClient(routes, {\n scopes: apiScopes,\n basePath: 'images',\n transport: nativeApiTransport,\n sessionAddress: sessionApiAddress,\n});\n","import { Button, fontOf } from '@agimon-ai/po-native-components';\nimport type { PoNativeTheme } from '@agimon-ai/po-web-components/nativeTheme';\nimport { useEffect, useState } from 'react';\nimport { Image, Pressable, ScrollView, Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nexport interface ImageTile {\n id: string;\n label: string;\n /** A `data:image/png;base64,` URI, never a remote URL. */\n src?: string;\n}\n\nexport interface ImagesGridViewProps {\n images: readonly ImageTile[];\n state: 'ready' | 'loading' | 'error';\n error?: string;\n onOpen: (id: string) => void;\n variant: 'activity' | 'gallery';\n hasMore?: boolean;\n onMore?: () => void;\n}\n\n/** Tiles the activity row shows; the web grid shows the same six. */\nconst ACTIVITY_TILES = 6;\n\n/**\n * Presentation only, as the web's ImagesGridView. The activity row is a 3x2\n * thumbnail grid; the gallery is two labelled columns, so each tile clears a\n * 44pt target on a phone.\n */\nexport function ImagesGridView({ images, state, error, onOpen, variant, hasMore, onMore }: ImagesGridViewProps) {\n if (state === 'error')\n return (\n <Text accessibilityRole=\"alert\" style={[styles.sans, styles.error]}>\n {error ?? 'Images could not be loaded.'}\n </Text>\n );\n if (state === 'ready' && images.length === 0)\n return <Text style={[styles.sans, styles.dim]}>Images generated in this session will appear here.</Text>;\n const visible = variant === 'activity' ? images.slice(0, ACTIVITY_TILES) : images;\n const tileStyle = variant === 'activity' ? styles.activityTile : styles.galleryTile;\n return (\n <View style={styles.grid}>\n <View style={styles.tiles}>\n {state === 'loading' && visible.length === 0\n ? Array.from({ length: ACTIVITY_TILES }, (_, index) => (\n <View key={index} style={[tileStyle, styles.placeholder]} />\n ))\n : visible.map((image) => (\n <Pressable\n key={image.id}\n testID={`image-thumbnail-${image.id}`}\n accessibilityRole=\"button\"\n accessibilityLabel={`Open ${image.label}`}\n onPress={() => onOpen(image.id)}\n style={({ pressed }) => [tileStyle, styles.tile, pressed && styles.pressed]}\n >\n {image.src ? (\n <Image source={{ uri: image.src }} resizeMode=\"cover\" style={styles.thumbnail} />\n ) : (\n <View style={[styles.thumbnail, styles.placeholder]} />\n )}\n {variant === 'gallery' ? (\n <Text numberOfLines={1} style={[styles.sans, styles.label]}>\n {image.label}\n </Text>\n ) : null}\n </Pressable>\n ))}\n </View>\n {hasMore ? (\n <Button variant=\"outline\" onPress={onMore} disabled={state === 'loading'}>\n Load more images\n </Button>\n ) : null}\n </View>\n );\n}\n\nexport interface FittedImageProps {\n src: string;\n accessibilityLabel?: string;\n maxHeight?: number;\n}\n\n/** Full width at the PNG's own aspect ratio, so it is never letterboxed. */\nexport function FittedImage({ src, accessibilityLabel, maxHeight }: FittedImageProps) {\n const [aspectRatio, setAspectRatio] = useState(1);\n useEffect(() => {\n let live = true;\n // getSize works on React Native and React Native Web alike; onLoad's event shape differs.\n // An unreadable image keeps the square and shows nothing worse than before.\n Image.getSize(src, (width, height) => {\n if (live && width > 0 && height > 0) setAspectRatio(width / height);\n });\n return () => {\n live = false;\n };\n }, [src]);\n return (\n <Image\n source={{ uri: src }}\n accessibilityLabel={accessibilityLabel}\n resizeMode=\"contain\"\n style={[styles.fittedImage, { aspectRatio, maxHeight }]}\n />\n );\n}\n\nexport interface ImageViewerViewProps {\n image: ImageTile;\n}\n\n/** The full image with its title. Read only: native has no Author feedback panel yet. */\nexport function ImageViewerView({ image }: ImageViewerViewProps) {\n return (\n <ScrollView testID=\"session-image-viewer\" contentContainerStyle={styles.viewer}>\n <Text accessibilityRole=\"header\" numberOfLines={1} style={[styles.sans, styles.heading]}>\n {image.label}\n </Text>\n {image.src ? (\n <FittedImage src={image.src} accessibilityLabel={image.label} />\n ) : (\n <Text accessibilityRole=\"alert\" style={[styles.sans, styles.error]}>\n This image could not be loaded.\n </Text>\n )}\n <Text style={[styles.sans, styles.dim]}>Original image, read only.</Text>\n </ScrollView>\n );\n}\n\nconst styles = StyleSheet.create((theme: PoNativeTheme) => ({\n sans: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n },\n dim: { color: theme.colors.dim },\n error: { color: theme.colors.red },\n grid: { gap: theme.spacing(3) },\n tiles: { flexDirection: 'row', flexWrap: 'wrap', gap: theme.spacing(2) },\n // Percent widths leave room for the row gaps: three across, or two.\n activityTile: { width: '31%', aspectRatio: 1 },\n galleryTile: { width: '48%' },\n tile: {\n overflow: 'hidden',\n borderRadius: theme.borderRadius.md,\n borderWidth: 1,\n borderColor: theme.colors.border,\n backgroundColor: theme.colors.deep,\n },\n pressed: { opacity: 0.8 },\n thumbnail: { width: '100%', aspectRatio: 1 },\n placeholder: { borderRadius: theme.borderRadius.md, backgroundColor: theme.colors.deep },\n label: { paddingHorizontal: theme.spacing(2), paddingVertical: theme.spacing(2), color: theme.colors.text },\n viewer: { gap: theme.spacing(3), padding: theme.spacing(4) },\n heading: {\n color: theme.colors.hi,\n fontSize: theme.fontSize.lg,\n lineHeight: theme.lineHeight.lg,\n fontWeight: theme.fontWeight.semibold,\n },\n fittedImage: { width: '100%', borderRadius: theme.borderRadius.md },\n}));\n","import type { WebPluginSlotProps } from '@agimon-ai/po-core/native';\nimport { fontOf } from '@agimon-ai/po-native-components';\nimport type { PoNativeTheme } from '@agimon-ai/po-web-components/nativeTheme';\nimport { useEffect, useState } from 'react';\nimport { ScrollView, Text } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { api } from '../../../../../../../generated/client.native';\nimport { ImagesGridView, ImageViewerView, type ImageTile } from './SessionImagesView.native';\n\ntype TransientTab = Parameters<WebPluginSlotProps['openTransientTab']>[0];\n\nexport function imagesGalleryTab(): TransientTab {\n return { id: 'image-gen-gallery', label: 'Images', panel: ImagesGallery };\n}\n\n/**\n * The viewer shows bytes the caller already holds: the tool result's inline PNG\n * or a gallery tile's artifact data.\n *\n * ponytail: no durable-artifact lookup, because the web only needs it for the\n * Author feedback panel and no native package contributes one. Resolve it as\n * the web's transcriptImageTab does once native Author feedback exists.\n */\nexport function imageViewerTab(sessionId: string, image: ImageTile): TransientTab {\n return {\n id: `image-gen-image-${encodeURIComponent(image.id)}`,\n label: image.label,\n panel: (props) => (props.sessionId === sessionId ? <ImageViewerView image={image} /> : null),\n };\n}\n\nexport function ImagesActivity(props: WebPluginSlotProps) {\n return <SessionImages {...props} variant=\"activity\" />;\n}\n\nfunction ImagesGallery(props: WebPluginSlotProps) {\n return (\n <ScrollView testID=\"session-images-gallery\" contentContainerStyle={styles.gallery}>\n <Text accessibilityRole=\"header\" style={[styles.sans, styles.heading]}>\n Images\n </Text>\n <Text style={[styles.sans, styles.dim]}>Generated in this session, newest first.</Text>\n <SessionImages {...props} variant=\"gallery\" />\n </ScrollView>\n );\n}\n\nfunction SessionImages(props: WebPluginSlotProps & { variant: 'activity' | 'gallery' }) {\n if (props.sessionId === null) return null;\n return (\n <ImagesPage\n key={`${props.sessionId}:${props.statuses['image-gen.images'] ?? ''}`}\n {...props}\n sessionId={props.sessionId}\n />\n );\n}\n\nfunction ImagesPage(props: WebPluginSlotProps & { sessionId: string; variant: 'activity' | 'gallery' }) {\n const [images, setImages] = useState<ImageTile[]>([]);\n const [cursor, setCursor] = useState('0');\n const [nextCursor, setNextCursor] = useState<string | null>(null);\n const [state, setState] = useState<'ready' | 'loading' | 'error'>('loading');\n const [error, setError] = useState('');\n useEffect(() => {\n const controller = new AbortController();\n setState('loading');\n void (async () => {\n const session = api.session(props.sessionId);\n const response = await session.listImages({ query: { limit: '6', cursor }, signal: controller.signal });\n if (!response.ok) throw new Error(response.error || 'Images could not be loaded.');\n if (response.data.sessionId !== props.sessionId) throw new Error('Image history belongs to another session.');\n const artifacts = await Promise.all(\n response.data.items.map(async ({ id }) => {\n const result = await session.readImage({ query: { id }, signal: controller.signal });\n if (!result.ok) {\n if (result.status === 404) return null;\n throw new Error(result.error || 'An image could not be loaded.');\n }\n if (result.data.sessionId !== props.sessionId) throw new Error('Image belongs to another session.');\n return result.data;\n }),\n );\n if (controller.signal.aborted) return;\n const tiles = artifacts.flatMap((artifact) =>\n artifact\n ? [{ id: artifact.id, label: `Image ${artifact.id}`, src: `data:image/png;base64,${artifact.data}` }]\n : [],\n );\n setImages((previous) =>\n cursor === '0' ? tiles : [...previous, ...tiles.filter((tile) => !previous.some(({ id }) => id === tile.id))],\n );\n setNextCursor(response.data.nextCursor);\n setState('ready');\n })().catch((reason: unknown) => {\n if (controller.signal.aborted) return;\n setError(reason instanceof Error ? reason.message : 'Images could not be loaded.');\n setState('error');\n });\n return () => controller.abort();\n }, [props.sessionId, cursor]);\n return (\n <ImagesGridView\n images={images}\n state={state}\n error={error}\n variant={props.variant}\n onOpen={(id) => {\n const image = images.find((tile) => tile.id === id);\n if (image) props.openTransientTab(imageViewerTab(props.sessionId, image));\n }}\n hasMore={props.variant === 'gallery' && nextCursor !== null}\n onMore={() => {\n if (nextCursor !== null && state !== 'loading') setCursor(nextCursor);\n }}\n />\n );\n}\n\nconst styles = StyleSheet.create((theme: PoNativeTheme) => ({\n gallery: { gap: theme.spacing(2), padding: theme.spacing(4) },\n sans: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n },\n heading: {\n color: theme.colors.hi,\n fontSize: theme.fontSize.lg,\n lineHeight: theme.lineHeight.lg,\n fontWeight: theme.fontWeight.semibold,\n },\n dim: { color: theme.colors.dim },\n}));\n","import { defineActivityGroup } from '@agimon-ai/po-core/native';\nimport { ImageIcon } from '@agimon-ai/po-native-components';\nimport { createElement } from 'react';\n\nimport { imagesGalleryTab } from '../tool/_components/SessionImages.native';\n\nexport default defineActivityGroup({\n name: 'Images',\n keys: '',\n icon: () => createElement(ImageIcon),\n activeSource: { subscribe: () => () => undefined, isActive: () => false },\n marksBackgroundWork: false,\n transientTab: imagesGalleryTab,\n order: 35,\n});\n","import { defineFill } from '@agimon-ai/po-core/native';\n\nimport { ImagesActivity } from '../tool/_components/SessionImages.native';\n\nexport default defineFill({ slot: 'activity.Images', component: ImagesActivity });\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/web';\n\nexport function imagegenToolView({ args, result }: Pick<ToolMessageRenderProps, 'args' | 'result'>) {\n const prompt = typeof args.prompt === 'string' ? args.prompt : '';\n const editing = Array.isArray(args.referenced_image_paths) && args.referenced_image_paths.length > 0;\n // Only inline PNG results from this tool, never a URL supplied in details.\n const image = result?.content.find(\n (block): block is { type: 'image'; data: string; mimeType: 'image/png' } =>\n block !== null &&\n typeof block === 'object' &&\n 'type' in block &&\n block.type === 'image' &&\n 'mimeType' in block &&\n block.mimeType === 'image/png' &&\n 'data' in block &&\n typeof block.data === 'string',\n );\n const src = image ? `data:image/png;base64,${image.data}` : undefined;\n const details = result?.details;\n const inlineOnly =\n details !== null &&\n typeof details === 'object' &&\n 'saveWarning' in details &&\n typeof details.saveWarning === 'string';\n return { prompt, editing, src, inlineOnly };\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/native';\nimport {\n fontOf,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n MessageItemStatus,\n resultTextLines,\n toolTone,\n} from '@agimon-ai/po-native-components';\nimport type { PoNativeTheme } from '@agimon-ai/po-web-components/nativeTheme';\nimport { Pressable, Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { imagegenToolView } from '../_lib/imagegenToolView';\nimport { imageViewerTab } from './SessionImages.native';\nimport { FittedImage } from './SessionImagesView.native';\n\n/** Tallest the image gets in the card; the web caps it at 24rem. */\nconst IMAGE_MAX_HEIGHT = 384;\n\n/**\n * The imagegen tool's timeline item on native, as the web's ImagegenToolMessage:\n * the prompt in the header and, expanded by default, the image full width with\n * the tool's own lines under it. Tapping the image opens it full size.\n */\nexport function ImagegenToolMessage(props: ToolMessageRenderProps) {\n const { result, output, running, isError, sessionId } = props;\n const view = imagegenToolView(props);\n const label = view.prompt || 'Generated image';\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable defaultExpanded>\n {({ expanded }) => (\n <>\n <MessageItemHeader title=\"imagegen\">\n <View testID=\"tool-call-imagegen\" style={styles.summary}>\n <Text numberOfLines={1} style={[styles.sans, styles.prompt]}>\n {view.prompt}\n </Text>\n <Text style={[styles.sans, styles.faint]}>{view.editing ? 'edit' : 'generate'}</Text>\n </View>\n </MessageItemHeader>\n {expanded ? (\n <MessageItemBody testID=\"tool-result-imagegen\">\n {running ? <MessageItemStatus tone=\"running\">creating image</MessageItemStatus> : null}\n {isError ? <MessageItemStatus tone=\"error\">failed</MessageItemStatus> : null}\n {!isError && view.src ? (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={`Open ${label}`}\n disabled={sessionId === null}\n onPress={() => {\n if (sessionId !== null && view.src)\n props.openTransientTab(\n imageViewerTab(sessionId, { id: `transcript-${props.toolCallId}`, label, src: view.src }),\n );\n }}\n >\n <FittedImage src={view.src} maxHeight={IMAGE_MAX_HEIGHT} />\n </Pressable>\n ) : null}\n {resultTextLines(result, output).map((line, index) => (\n <Text\n key={`${String(index)}-${line}`}\n selectable\n style={[styles.sans, isError ? styles.error : styles.dim]}\n >\n {line}\n </Text>\n ))}\n </MessageItemBody>\n ) : null}\n </>\n )}\n </MessageItem>\n );\n}\n\nconst styles = StyleSheet.create((theme: PoNativeTheme) => ({\n summary: { flex: 1, flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2), minWidth: 0 },\n sans: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n },\n prompt: { flex: 1, minWidth: 0, color: theme.colors.text },\n faint: { flexShrink: 0, color: theme.colors.faint },\n dim: { color: theme.colors.dim },\n error: { color: theme.colors.red },\n}));\n","import { defineToolRenderer } from '@agimon-ai/po-core/native';\n\nimport { ImagegenToolMessage } from './_components/ImagegenToolMessage.native';\n\nexport default defineToolRenderer({ message: ImagegenToolMessage });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineNativePlugin, type WebPluginContributions } from '@agimon-ai/po-core/native';\n\nimport activityGroupImages from '../src/extensions/workspaces/sessions/(frontend)/activity-group/images.native';\nimport fillImages from '../src/extensions/workspaces/sessions/(frontend)/fill/Images.activity.Images.native';\nimport toolImagegen from '../src/extensions/workspaces/sessions/(frontend)/tool/imagegen.native';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const nativePlugin = defineNativePlugin({\n id: 'image-gen',\n session: {\n get activityGroups(): WebPluginContributions['activityGroups'] { return [via({ name: 'images' }, activityGroupImages)]; },\n get fills(): WebPluginContributions['fills'] { return [via({ slot: 'activity.Images', id: 'images' }, fillImages)]; },\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['imagegen'] }, toolImagegen)]; },\n },\n});\n"],"mappings":";;;;;;;;;;ACQA,MAAa,MAAM,gBAAgB;CDFjC,YAAY;EACV,QAAQ;EACR,MAAM;EACN,OAAO,CAAC,SAAS,QAAQ;EACzB,UAAU,KAAA;CACZ;CACA,WAAW;EACT,QAAQ;EACR,MAAM;EACN,OAAO,CAAC,MAAM,YAAY;EAC1B,UAAU,KAAA;CACZ;ACTiC,GAAQ;CACzC,QAAQ,CAHgB,SAGhB;CACR,UAAU;CACV,WAAW;CACX,gBAAgB;AAClB,CAAC;;;;ACWD,MAAMkB,iBAAiB;;;;;;AAOvB,SAAgBC,eAAe,EAAER,QAAQC,OAAOC,OAAOC,QAAQC,SAASC,SAASC,UAA+B;CAC9G,IAAIL,UAAU,SACZ,OACE,oBA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GAAGC,uBAAY,CAAC;EAAG;CACtH;AACF,CAAC"}
|
|
@@ -2,27 +2,27 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_imagegenTool = require("../imagegenTool-
|
|
5
|
+
const require_imagegenTool = require("../imagegenTool-BKyyKu6T.cjs");
|
|
6
6
|
let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
|
|
7
7
|
let _agimon_ai_po_core_extensionFile = require("@agimon-ai/po-core/extensionFile");
|
|
8
8
|
let _agimon_ai_po_core_piSettings = require("@agimon-ai/po-core/piSettings");
|
|
9
|
-
let _agimon_ai_po_core_web = require("@agimon-ai/po-core/web");
|
|
10
9
|
let _agimon_ai_po_core_help = require("@agimon-ai/po-core/help");
|
|
10
|
+
let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
|
|
11
11
|
//#region src/types/apiRoutes.ts
|
|
12
|
-
const routes =
|
|
12
|
+
const routes = {
|
|
13
13
|
listImages: {
|
|
14
14
|
method: "GET",
|
|
15
15
|
path: "/artifacts",
|
|
16
16
|
query: ["limit", "cursor"],
|
|
17
|
-
response:
|
|
17
|
+
response: void 0
|
|
18
18
|
},
|
|
19
19
|
readImage: {
|
|
20
20
|
method: "GET",
|
|
21
21
|
path: "/artifact",
|
|
22
22
|
query: ["id", "toolCallId"],
|
|
23
|
-
response:
|
|
23
|
+
response: void 0
|
|
24
24
|
}
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/extensions/workspaces/sessions/(backend)/api/images/_lib/imageApi.ts
|
|
28
28
|
/** Owner authentication and session admission are enforced by the host mount. */
|
|
@@ -87,9 +87,16 @@ var po_use_image_gen_server_default = (0, _agimon_ai_po_core_extensionFile.defin
|
|
|
87
87
|
});
|
|
88
88
|
//#endregion
|
|
89
89
|
//#region src/extensions/workspaces/sessions/(backend)/tool/imagegen.server.ts
|
|
90
|
-
var imagegen_server_default = (0, _agimon_ai_po_core_extensionFile.defineServerTool)(({ host }) => {
|
|
90
|
+
var imagegen_server_default = (0, _agimon_ai_po_core_extensionFile.defineServerTool)(({ host, context }) => {
|
|
91
91
|
if (!host.context.homeDirectory) throw new Error("Image generation requires the configured server home.");
|
|
92
|
-
|
|
92
|
+
const home = (0, _agimon_ai_po_core_piSettings.poHomeDirectory)(host.context.homeDirectory, host.context.environment ?? {});
|
|
93
|
+
const temporaryDirectory = host.context.environment?.PO_SESSION_TEMP_DIR;
|
|
94
|
+
const fileAccess = (0, _agimon_ai_po_core_platform.readPoFileAccess)(context);
|
|
95
|
+
if (fileAccess !== void 0 && host.context.sessionId !== void 0) {
|
|
96
|
+
const close = fileAccess.register(require_imagegenTool.imageArtifactDirectory(home, host.context.sessionId, temporaryDirectory));
|
|
97
|
+
context.effect(() => close, "image generation file access");
|
|
98
|
+
}
|
|
99
|
+
return require_imagegenTool.createImagegenTool(home, temporaryDirectory);
|
|
93
100
|
});
|
|
94
101
|
//#endregion
|
|
95
102
|
//#region generated/server.ts
|