@agimon-ai/po-codemode 0.0.1-alpha.13 → 0.0.1-alpha.15
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/README.md +1 -1
- package/dist/{codemodeTools-gfHLLrAt.mjs → codemodeTools-D8hq2sv2.mjs} +70 -17
- package/dist/codemodeTools-D8hq2sv2.mjs.map +1 -0
- package/dist/{codemodeTools-A-6aAXeW.cjs → codemodeTools-DS37CHwZ.cjs} +70 -17
- package/dist/codemodeTools-DS37CHwZ.cjs.map +1 -0
- package/dist/extensions/native.mjs +419 -0
- package/dist/extensions/native.mjs.map +1 -0
- package/dist/extensions/server.cjs +1 -1
- package/dist/extensions/server.mjs +1 -1
- package/dist/extensions/web.mjs +214 -117
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +36 -10
- package/dist/codemodeTools-A-6aAXeW.cjs.map +0 -1
- package/dist/codemodeTools-gfHLLrAt.mjs.map +0 -1
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import { defineNativePlugin, defineToolRenderer } from "@agimon-ai/po-core/native";
|
|
2
|
+
import { View } from "react-native-unistyles/components/native/View";
|
|
3
|
+
import { Text } from "react-native-unistyles/components/native/Text";
|
|
4
|
+
import { Pressable } from "react-native-unistyles/components/native/Pressable";
|
|
5
|
+
import { Image } from "react-native-unistyles/components/native/Image";
|
|
6
|
+
import { CodeBlock, Markdown, MessageItem, MessageItemBody, MessageItemHeader, fontOf, toolTone } from "@agimon-ai/po-native-components";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { StyleSheet } from "react-native-unistyles";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/_lib/execToolView.ts
|
|
11
|
+
/** Tool names this package registers (registerTool's `name`). */
|
|
12
|
+
const execToolName = "exec";
|
|
13
|
+
const SUMMARY_MAX = 120;
|
|
14
|
+
const ARGS_MAX = 160;
|
|
15
|
+
const CALLS_MAX = 50;
|
|
16
|
+
const IMAGE_TYPES = /^image\/(?:png|jpeg|webp|gif)$/u;
|
|
17
|
+
const SAVED_LINE = /^Saved as (\S+) \((.+)\)$/u;
|
|
18
|
+
const DOCUMENT_LINE = /^(?:#{1,6} |```)/mu;
|
|
19
|
+
function record(value) {
|
|
20
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
21
|
+
}
|
|
22
|
+
function clip(text, max) {
|
|
23
|
+
return text.length <= max ? text : `${text.slice(0, max - 1)}…`;
|
|
24
|
+
}
|
|
25
|
+
/** The script the call ran, exactly as the agent wrote it. */
|
|
26
|
+
function execCode(args) {
|
|
27
|
+
return typeof args.code === "string" ? args.code : "";
|
|
28
|
+
}
|
|
29
|
+
/** The header line: the script's first line, with a leading `//` comment marker dropped. */
|
|
30
|
+
function execSummary(args) {
|
|
31
|
+
const first = execCode(args).split("\n").map((line) => line.trim()).find((line) => line !== "");
|
|
32
|
+
if (first === void 0) return "script";
|
|
33
|
+
return clip(first.replace(/^\/\/+\s*/u, ""), SUMMARY_MAX);
|
|
34
|
+
}
|
|
35
|
+
function callOf(value) {
|
|
36
|
+
const call = record(value);
|
|
37
|
+
if (call === void 0 || typeof call.name !== "string" || call.name === "") return void 0;
|
|
38
|
+
const result = record(call.result);
|
|
39
|
+
return {
|
|
40
|
+
name: call.name,
|
|
41
|
+
args: record(call.args) ?? {},
|
|
42
|
+
ok: call.ok !== false,
|
|
43
|
+
ms: typeof call.ms === "number" && Number.isFinite(call.ms) && call.ms >= 0 ? Math.round(call.ms) : 0,
|
|
44
|
+
...typeof call.tool === "string" && call.tool !== "" ? { tool: call.tool } : {},
|
|
45
|
+
...typeof call.error === "string" && call.error !== "" ? { error: call.error } : {},
|
|
46
|
+
...result !== void 0 && Array.isArray(result.content) ? { result: {
|
|
47
|
+
content: result.content,
|
|
48
|
+
details: result.details
|
|
49
|
+
} } : {}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** The nested calls recorded in a result's details; anything malformed is skipped. */
|
|
53
|
+
function execCalls(details) {
|
|
54
|
+
const calls = record(details)?.calls;
|
|
55
|
+
if (!Array.isArray(calls)) return [];
|
|
56
|
+
return calls.slice(0, CALLS_MAX).map(callOf).filter((call) => call !== void 0);
|
|
57
|
+
}
|
|
58
|
+
/** A call's arguments on one line, for a row that has no card of its own. */
|
|
59
|
+
function callArgsSummary(args) {
|
|
60
|
+
return Object.keys(args).length === 0 ? "" : clip(JSON.stringify(args), ARGS_MAX);
|
|
61
|
+
}
|
|
62
|
+
/** What a result holds, with the saved-script footer and the pictures taken out of the text. */
|
|
63
|
+
function execResultView(result) {
|
|
64
|
+
if (result === null) return {
|
|
65
|
+
lines: [],
|
|
66
|
+
images: []
|
|
67
|
+
};
|
|
68
|
+
let saved;
|
|
69
|
+
const texts = [];
|
|
70
|
+
const images = [];
|
|
71
|
+
for (const block of result.content) {
|
|
72
|
+
const item = record(block);
|
|
73
|
+
if (item?.type === "text" && typeof item.text === "string") {
|
|
74
|
+
const match = SAVED_LINE.exec(item.text.trim());
|
|
75
|
+
if (match?.[1] !== void 0 && match[2] !== void 0) saved = {
|
|
76
|
+
id: match[1],
|
|
77
|
+
path: match[2]
|
|
78
|
+
};
|
|
79
|
+
else texts.push(item.text);
|
|
80
|
+
} else if (item?.type === "image" && typeof item.data === "string" && typeof item.mimeType === "string" && IMAGE_TYPES.test(item.mimeType)) images.push({
|
|
81
|
+
mimeType: item.mimeType,
|
|
82
|
+
data: item.data
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const lines = texts.join("\n").replaceAll("\r\n", "\n").replaceAll("\r", "\n").replaceAll(" ", " ").split("\n");
|
|
86
|
+
while (lines.length > 0 && lines.at(-1)?.trim() === "") lines.pop();
|
|
87
|
+
return {
|
|
88
|
+
lines,
|
|
89
|
+
...saved === void 0 ? {} : { saved },
|
|
90
|
+
images
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/** Whether result text is a document, such as a report or a mermaid diagram, to draw rather than print. */
|
|
94
|
+
function readsAsDocument(text) {
|
|
95
|
+
return DOCUMENT_LINE.test(text);
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/_components/ExecToolCard.native.tsx
|
|
99
|
+
/** Pictures and documents stay on screen whether or not their row is open: they are the point of the call. */
|
|
100
|
+
function Visuals({ text, images, label }) {
|
|
101
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [readsAsDocument(text) ? /* @__PURE__ */ jsx(Markdown, { text }) : null, images.map((image, index) => /* @__PURE__ */ jsx(Image, {
|
|
102
|
+
source: { uri: `data:${image.mimeType};base64,${image.data}` },
|
|
103
|
+
accessibilityLabel: `${label} image ${String(index + 1)}`,
|
|
104
|
+
resizeMode: "contain",
|
|
105
|
+
style: styles.image
|
|
106
|
+
}, `${image.mimeType}-${String(index)}`))] });
|
|
107
|
+
}
|
|
108
|
+
/** One call on the rail. Tapping it opens its whole args and result; its pictures and documents show either way. */
|
|
109
|
+
function CallRow({ call }) {
|
|
110
|
+
const [open, setOpen] = useState(false);
|
|
111
|
+
const view = execResultView(call.result ?? null);
|
|
112
|
+
const text = view.lines.join("\n");
|
|
113
|
+
const printed = text !== "" && !readsAsDocument(text);
|
|
114
|
+
const hasArgs = Object.keys(call.args).length > 0;
|
|
115
|
+
const opens = hasArgs || printed;
|
|
116
|
+
return /* @__PURE__ */ jsxs(View, {
|
|
117
|
+
testID: "exec-call",
|
|
118
|
+
style: styles.card,
|
|
119
|
+
children: [
|
|
120
|
+
/* @__PURE__ */ jsxs(Pressable, {
|
|
121
|
+
disabled: !opens,
|
|
122
|
+
onPress: () => setOpen((value) => !value),
|
|
123
|
+
accessibilityRole: opens ? "button" : void 0,
|
|
124
|
+
accessibilityState: opens ? { expanded: open } : void 0,
|
|
125
|
+
accessibilityHint: opens ? "Shows the whole arguments and result" : void 0,
|
|
126
|
+
style: styles.press,
|
|
127
|
+
children: [/* @__PURE__ */ jsxs(View, {
|
|
128
|
+
style: styles.argsLine,
|
|
129
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
130
|
+
numberOfLines: 1,
|
|
131
|
+
style: [
|
|
132
|
+
styles.mono,
|
|
133
|
+
styles.name,
|
|
134
|
+
styles.shrink
|
|
135
|
+
],
|
|
136
|
+
children: call.name
|
|
137
|
+
}), opens ? /* @__PURE__ */ jsx(Text, {
|
|
138
|
+
style: [
|
|
139
|
+
styles.sans,
|
|
140
|
+
styles.dim,
|
|
141
|
+
styles.keep
|
|
142
|
+
],
|
|
143
|
+
children: open ? "⌄" : "›"
|
|
144
|
+
}) : null]
|
|
145
|
+
}), /* @__PURE__ */ jsxs(View, {
|
|
146
|
+
style: styles.argsLine,
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ jsx(Text, {
|
|
149
|
+
numberOfLines: 1,
|
|
150
|
+
style: [styles.mono, styles.args],
|
|
151
|
+
children: open ? "" : callArgsSummary(call.args)
|
|
152
|
+
}),
|
|
153
|
+
/* @__PURE__ */ jsx(Text, {
|
|
154
|
+
accessibilityLabel: call.ok ? "completed" : "failed",
|
|
155
|
+
style: [styles.sans, call.ok ? styles.ok : styles.error],
|
|
156
|
+
children: call.ok ? "✓" : "✗"
|
|
157
|
+
}),
|
|
158
|
+
/* @__PURE__ */ jsxs(Text, {
|
|
159
|
+
style: [styles.sans, styles.dim],
|
|
160
|
+
children: [call.ms, " ms"]
|
|
161
|
+
})
|
|
162
|
+
]
|
|
163
|
+
})]
|
|
164
|
+
}),
|
|
165
|
+
open && hasArgs ? /* @__PURE__ */ jsx(CodeBlock, {
|
|
166
|
+
text: JSON.stringify(call.args, null, 2),
|
|
167
|
+
language: "json"
|
|
168
|
+
}) : null,
|
|
169
|
+
open && printed ? /* @__PURE__ */ jsx(Text, {
|
|
170
|
+
testID: "exec-call-output",
|
|
171
|
+
selectable: true,
|
|
172
|
+
style: [styles.mono, styles.text],
|
|
173
|
+
children: text
|
|
174
|
+
}) : null,
|
|
175
|
+
call.error === void 0 ? null : /* @__PURE__ */ jsx(Text, {
|
|
176
|
+
style: [styles.sans, styles.error],
|
|
177
|
+
children: call.error
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ jsx(Visuals, {
|
|
180
|
+
text,
|
|
181
|
+
images: view.images,
|
|
182
|
+
label: call.name
|
|
183
|
+
})
|
|
184
|
+
]
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
/** The script's outcome as the rail's last leaf: one line while the card is folded, all of it once opened. */
|
|
188
|
+
function Returned({ result, isError, expanded }) {
|
|
189
|
+
const view = execResultView(result);
|
|
190
|
+
const text = view.lines.join("\n");
|
|
191
|
+
const document = readsAsDocument(text);
|
|
192
|
+
const whole = expanded || isError;
|
|
193
|
+
return /* @__PURE__ */ jsxs(View, {
|
|
194
|
+
testID: `tool-result-${execToolName}`,
|
|
195
|
+
style: styles.leaf,
|
|
196
|
+
children: [view.lines.length === 0 ? /* @__PURE__ */ jsx(Text, {
|
|
197
|
+
style: [styles.sans, styles.dim],
|
|
198
|
+
children: isError ? "Failed with no output." : "Returned nothing."
|
|
199
|
+
}) : document ? /* @__PURE__ */ jsx(Text, {
|
|
200
|
+
style: [
|
|
201
|
+
styles.sans,
|
|
202
|
+
styles.dim,
|
|
203
|
+
styles.label
|
|
204
|
+
],
|
|
205
|
+
children: isError ? "Error" : "Returned"
|
|
206
|
+
}) : /* @__PURE__ */ jsxs(View, {
|
|
207
|
+
style: whole ? styles.stack : styles.argsLine,
|
|
208
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
209
|
+
style: [
|
|
210
|
+
styles.sans,
|
|
211
|
+
styles.dim,
|
|
212
|
+
styles.label
|
|
213
|
+
],
|
|
214
|
+
children: isError ? "Error" : "Returned"
|
|
215
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
216
|
+
selectable: true,
|
|
217
|
+
numberOfLines: whole ? void 0 : 1,
|
|
218
|
+
style: [
|
|
219
|
+
styles.mono,
|
|
220
|
+
styles.args,
|
|
221
|
+
isError ? styles.error : styles.text
|
|
222
|
+
],
|
|
223
|
+
children: whole ? text : view.lines.join(" ")
|
|
224
|
+
})]
|
|
225
|
+
}), /* @__PURE__ */ jsx(Visuals, {
|
|
226
|
+
text,
|
|
227
|
+
images: view.images,
|
|
228
|
+
label: "Script"
|
|
229
|
+
})]
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The exec tool's timeline item on native, as the web's ExecToolCard: the
|
|
234
|
+
* calls the script made hang under it on a rail, with what it returned as the
|
|
235
|
+
* last leaf. Opening the item shows the script itself.
|
|
236
|
+
*/
|
|
237
|
+
function ExecToolCard({ args, result, running, isError, defaultExpanded = false }) {
|
|
238
|
+
const code = execCode(args);
|
|
239
|
+
const calls = execCalls(result?.details);
|
|
240
|
+
const failed = calls.filter((call) => !call.ok).length;
|
|
241
|
+
const settled = !running || result !== null;
|
|
242
|
+
return /* @__PURE__ */ jsx(MessageItem, {
|
|
243
|
+
tone: toolTone({
|
|
244
|
+
running,
|
|
245
|
+
isError
|
|
246
|
+
}),
|
|
247
|
+
expandable: code !== "",
|
|
248
|
+
defaultExpanded,
|
|
249
|
+
children: ({ expanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
250
|
+
/* @__PURE__ */ jsx(MessageItemHeader, {
|
|
251
|
+
title: execToolName,
|
|
252
|
+
children: /* @__PURE__ */ jsxs(View, {
|
|
253
|
+
testID: `tool-call-${execToolName}`,
|
|
254
|
+
style: styles.summary,
|
|
255
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
256
|
+
numberOfLines: 1,
|
|
257
|
+
style: [
|
|
258
|
+
styles.sans,
|
|
259
|
+
styles.text,
|
|
260
|
+
styles.shrink
|
|
261
|
+
],
|
|
262
|
+
children: execSummary(args)
|
|
263
|
+
}), calls.length > 0 ? /* @__PURE__ */ jsxs(Text, {
|
|
264
|
+
numberOfLines: 1,
|
|
265
|
+
style: [
|
|
266
|
+
styles.sans,
|
|
267
|
+
styles.dim,
|
|
268
|
+
styles.keep
|
|
269
|
+
],
|
|
270
|
+
children: [
|
|
271
|
+
calls.length,
|
|
272
|
+
" ",
|
|
273
|
+
calls.length === 1 ? "call" : "calls",
|
|
274
|
+
failed > 0 ? /* @__PURE__ */ jsxs(Text, {
|
|
275
|
+
style: styles.error,
|
|
276
|
+
children: [
|
|
277
|
+
", ",
|
|
278
|
+
failed,
|
|
279
|
+
" failed"
|
|
280
|
+
]
|
|
281
|
+
}) : null
|
|
282
|
+
]
|
|
283
|
+
}) : null]
|
|
284
|
+
})
|
|
285
|
+
}),
|
|
286
|
+
expanded ? /* @__PURE__ */ jsx(MessageItemBody, { children: /* @__PURE__ */ jsx(CodeBlock, {
|
|
287
|
+
text: code,
|
|
288
|
+
language: "ts"
|
|
289
|
+
}) }) : null,
|
|
290
|
+
settled ? /* @__PURE__ */ jsxs(View, {
|
|
291
|
+
accessibilityLabel: "Script calls",
|
|
292
|
+
style: styles.rail,
|
|
293
|
+
children: [calls.map((call, index) => /* @__PURE__ */ jsx(CallRow, { call }, `${String(index)}-${call.name}`)), /* @__PURE__ */ jsx(Returned, {
|
|
294
|
+
result,
|
|
295
|
+
isError,
|
|
296
|
+
expanded
|
|
297
|
+
})]
|
|
298
|
+
}) : null
|
|
299
|
+
] })
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
const styles = StyleSheet.create((theme) => ({
|
|
303
|
+
summary: {
|
|
304
|
+
flex: 1,
|
|
305
|
+
flexDirection: "row",
|
|
306
|
+
alignItems: "center",
|
|
307
|
+
gap: theme.spacing(2),
|
|
308
|
+
minWidth: 0,
|
|
309
|
+
uni__dependencies: [0]
|
|
310
|
+
},
|
|
311
|
+
shrink: { flexShrink: 1 },
|
|
312
|
+
keep: { flexShrink: 0 },
|
|
313
|
+
rail: {
|
|
314
|
+
gap: theme.spacing(2),
|
|
315
|
+
marginHorizontal: theme.spacing(4),
|
|
316
|
+
marginBottom: theme.spacing(3),
|
|
317
|
+
paddingLeft: theme.spacing(3),
|
|
318
|
+
borderLeftWidth: 1,
|
|
319
|
+
borderColor: theme.colors["border-soft"],
|
|
320
|
+
uni__dependencies: [0]
|
|
321
|
+
},
|
|
322
|
+
card: {
|
|
323
|
+
gap: theme.spacing(2),
|
|
324
|
+
paddingHorizontal: theme.spacing(3),
|
|
325
|
+
paddingVertical: theme.spacing(1),
|
|
326
|
+
borderWidth: 1,
|
|
327
|
+
borderRadius: theme.borderRadius.lg,
|
|
328
|
+
borderColor: theme.colors["border-soft"],
|
|
329
|
+
uni__dependencies: [0]
|
|
330
|
+
},
|
|
331
|
+
press: {
|
|
332
|
+
minHeight: 44,
|
|
333
|
+
justifyContent: "center",
|
|
334
|
+
gap: theme.spacing(.5),
|
|
335
|
+
paddingVertical: theme.spacing(1),
|
|
336
|
+
uni__dependencies: [0]
|
|
337
|
+
},
|
|
338
|
+
argsLine: {
|
|
339
|
+
flexDirection: "row",
|
|
340
|
+
alignItems: "center",
|
|
341
|
+
gap: theme.spacing(2),
|
|
342
|
+
uni__dependencies: [0]
|
|
343
|
+
},
|
|
344
|
+
stack: {
|
|
345
|
+
gap: theme.spacing(1),
|
|
346
|
+
uni__dependencies: [0]
|
|
347
|
+
},
|
|
348
|
+
leaf: {
|
|
349
|
+
gap: theme.spacing(2),
|
|
350
|
+
uni__dependencies: [0]
|
|
351
|
+
},
|
|
352
|
+
sans: {
|
|
353
|
+
fontFamily: fontOf(theme.fontFamily.sans),
|
|
354
|
+
fontSize: theme.fontSize.sm,
|
|
355
|
+
lineHeight: theme.lineHeight.sm,
|
|
356
|
+
uni__dependencies: [0]
|
|
357
|
+
},
|
|
358
|
+
mono: {
|
|
359
|
+
fontFamily: fontOf(theme.fontFamily.mono),
|
|
360
|
+
fontSize: theme.fontSize.sm,
|
|
361
|
+
lineHeight: theme.lineHeight.sm,
|
|
362
|
+
uni__dependencies: [0]
|
|
363
|
+
},
|
|
364
|
+
name: {
|
|
365
|
+
fontWeight: "600",
|
|
366
|
+
color: theme.colors.text,
|
|
367
|
+
uni__dependencies: [0]
|
|
368
|
+
},
|
|
369
|
+
args: {
|
|
370
|
+
flex: 1,
|
|
371
|
+
minWidth: 0,
|
|
372
|
+
color: theme.colors.dim,
|
|
373
|
+
uni__dependencies: [0]
|
|
374
|
+
},
|
|
375
|
+
label: { fontWeight: "600" },
|
|
376
|
+
text: {
|
|
377
|
+
color: theme.colors.text,
|
|
378
|
+
uni__dependencies: [0]
|
|
379
|
+
},
|
|
380
|
+
dim: {
|
|
381
|
+
color: theme.colors.dim,
|
|
382
|
+
uni__dependencies: [0]
|
|
383
|
+
},
|
|
384
|
+
ok: {
|
|
385
|
+
color: theme.colors.green,
|
|
386
|
+
uni__dependencies: [0]
|
|
387
|
+
},
|
|
388
|
+
error: {
|
|
389
|
+
color: theme.colors.red,
|
|
390
|
+
uni__dependencies: [0]
|
|
391
|
+
},
|
|
392
|
+
image: {
|
|
393
|
+
width: "100%",
|
|
394
|
+
aspectRatio: 16 / 9,
|
|
395
|
+
borderWidth: 1,
|
|
396
|
+
borderRadius: theme.borderRadius.md,
|
|
397
|
+
borderColor: theme.colors["border-soft"],
|
|
398
|
+
uni__dependencies: [0]
|
|
399
|
+
}
|
|
400
|
+
}));
|
|
401
|
+
//#endregion
|
|
402
|
+
//#region src/extensions/workspaces/sessions/(frontend)/tool/exec.native.tsx
|
|
403
|
+
var exec_native_default = defineToolRenderer({ message: ExecToolCard });
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region generated/native.ts
|
|
406
|
+
const via = (identity, value) => value === void 0 ? void 0 : {
|
|
407
|
+
...identity,
|
|
408
|
+
...value
|
|
409
|
+
};
|
|
410
|
+
const nativePlugin = defineNativePlugin({
|
|
411
|
+
id: "codemode",
|
|
412
|
+
session: { get toolRenderers() {
|
|
413
|
+
return [via({ tools: ["exec"] }, exec_native_default)];
|
|
414
|
+
} }
|
|
415
|
+
});
|
|
416
|
+
//#endregion
|
|
417
|
+
export { nativePlugin };
|
|
418
|
+
|
|
419
|
+
//# sourceMappingURL=native.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.mjs","names":["ToolMessageRenderProps","CodeBlock","fontOf","Markdown","MessageItem","MessageItemBody","MessageItemHeader","toolTone","PoNativeTheme","useState","StyleSheet","callArgsSummary","execCalls","execCode","execResultView","execSummary","execToolName","readsAsDocument","ExecCall","ExecImage","ExecToolCardProps","defaultExpanded","Visuals","text","images","label","map","image","index","mimeType","String","uri","data","styles","CallRow","call","open","setOpen","view","result","lines","join","printed","hasArgs","Object","keys","args","length","opens","card","value","undefined","expanded","press","argsLine","mono","name","shrink","sans","dim","keep","ok","error","ms","JSON","stringify","Returned","isError","document","whole","leaf","stack","ExecToolCard","running","code","calls","details","failed","filter","settled","summary","rail","create","theme","flex","flexDirection","alignItems","gap","spacing","minWidth","uni__dependencies","flexShrink","marginHorizontal","marginBottom","paddingLeft","borderLeftWidth","borderColor","colors","paddingHorizontal","paddingVertical","borderWidth","borderRadius","lg","minHeight","justifyContent","fontFamily","fontSize","sm","lineHeight","fontWeight","color","green","red","width","aspectRatio","md","toolExec"],"sources":["../../src/extensions/workspaces/sessions/(frontend)/tool/_lib/execToolView.ts","../../src/extensions/workspaces/sessions/(frontend)/tool/_components/ExecToolCard.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/tool/exec.native.tsx","../../generated/native.ts"],"sourcesContent":["// Imports nothing at runtime: the web and native cards share it, and the native\n// bundle may not load the web contract.\nimport type { ToolResultView } from '@agimon-ai/po-core/web';\n\n/** Tool names this package registers (registerTool's `name`). */\nexport const execToolName = 'exec' as const;\nexport const discoverToolName = 'discover' as const;\n\nconst SUMMARY_MAX = 120;\nconst ARGS_MAX = 160;\nconst CALLS_MAX = 50;\nconst IMAGE_TYPES = /^image\\/(?:png|jpeg|webp|gif)$/u;\nconst SAVED_LINE = /^Saved as (\\S+) \\((.+)\\)$/u;\n// A heading or a fence starts a line of Markdown, never one of JSON or a log.\nconst DOCUMENT_LINE = /^(?:#{1,6} |```)/mu;\n\nfunction record(value: unknown): Record<string, unknown> | undefined {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\nfunction clip(text: string, max: number): string {\n return text.length <= max ? text : `${text.slice(0, max - 1)}…`;\n}\n\n/** The script the call ran, exactly as the agent wrote it. */\nexport function execCode(args: Readonly<Record<string, unknown>>): string {\n return typeof args.code === 'string' ? args.code : '';\n}\n\n/** The header line: the script's first line, with a leading `//` comment marker dropped. */\nexport function execSummary(args: Readonly<Record<string, unknown>>): string {\n const first = execCode(args)\n .split('\\n')\n .map((line) => line.trim())\n .find((line) => line !== '');\n if (first === undefined) return 'script';\n return clip(first.replace(/^\\/\\/+\\s*/u, ''), SUMMARY_MAX);\n}\n\n/** One namespace call the script made, as exec reports it in the result's details. */\nexport interface ExecCall {\n /** The member called, such as `browser.click` or `mcp.github.search_issues`. */\n name: string;\n args: Record<string, unknown>;\n ok: boolean;\n ms: number;\n /** The tool name whose own card shows this call, when another package has one. */\n tool?: string;\n error?: string;\n result?: ToolResultView;\n}\n\nfunction callOf(value: unknown): ExecCall | undefined {\n const call = record(value);\n if (call === undefined || typeof call.name !== 'string' || call.name === '') return undefined;\n const result = record(call.result);\n return {\n name: call.name,\n args: record(call.args) ?? {},\n ok: call.ok !== false,\n ms: typeof call.ms === 'number' && Number.isFinite(call.ms) && call.ms >= 0 ? Math.round(call.ms) : 0,\n ...(typeof call.tool === 'string' && call.tool !== '' ? { tool: call.tool } : {}),\n ...(typeof call.error === 'string' && call.error !== '' ? { error: call.error } : {}),\n ...(result !== undefined && Array.isArray(result.content)\n ? { result: { content: result.content, details: result.details } }\n : {}),\n };\n}\n\n/** The nested calls recorded in a result's details; anything malformed is skipped. */\nexport function execCalls(details: unknown): ExecCall[] {\n const calls = record(details)?.calls;\n if (!Array.isArray(calls)) return [];\n return calls\n .slice(0, CALLS_MAX)\n .map(callOf)\n .filter((call): call is ExecCall => call !== undefined);\n}\n\n/** A call's arguments on one line, for a row that has no card of its own. */\nexport function callArgsSummary(args: Readonly<Record<string, unknown>>): string {\n return Object.keys(args).length === 0 ? '' : clip(JSON.stringify(args), ARGS_MAX);\n}\n\nexport interface ExecImage {\n mimeType: string;\n data: string;\n}\n\nexport interface ExecResultView {\n lines: string[];\n /** The saved-script footer exec appends: the id to import it by, and where it lives. */\n saved?: { id: string; path: string };\n images: ExecImage[];\n}\n\n/** What a result holds, with the saved-script footer and the pictures taken out of the text. */\nexport function execResultView(result: ToolResultView | null): ExecResultView {\n if (result === null) return { lines: [], images: [] };\n let saved: ExecResultView['saved'];\n const texts: string[] = [];\n const images: ExecImage[] = [];\n for (const block of result.content) {\n const item = record(block);\n if (item?.type === 'text' && typeof item.text === 'string') {\n const match = SAVED_LINE.exec(item.text.trim());\n if (match?.[1] !== undefined && match[2] !== undefined) saved = { id: match[1], path: match[2] };\n else texts.push(item.text);\n } else if (\n item?.type === 'image' &&\n typeof item.data === 'string' &&\n typeof item.mimeType === 'string' &&\n IMAGE_TYPES.test(item.mimeType)\n ) {\n images.push({ mimeType: item.mimeType, data: item.data });\n }\n }\n // As po-core's toolResultTextLines: CRLF folded, tabs widened, trailing blank lines dropped.\n const lines = texts.join('\\n').replaceAll('\\r\\n', '\\n').replaceAll('\\r', '\\n').replaceAll('\\t', ' ').split('\\n');\n while (lines.length > 0 && lines.at(-1)?.trim() === '') lines.pop();\n return { lines, ...(saved === undefined ? {} : { saved }), images };\n}\n\n/** Whether result text is a document, such as a report or a mermaid diagram, to draw rather than print. */\nexport function readsAsDocument(text: string): boolean {\n return DOCUMENT_LINE.test(text);\n}\n\n/** The header line for discover: what was asked for. */\nexport function discoverSummary(args: Readonly<Record<string, unknown>>): string {\n if (typeof args.namespace === 'string' && args.namespace !== '') return args.namespace;\n if (typeof args.query === 'string' && args.query !== '') return `find \"${clip(args.query, SUMMARY_MAX)}\"`;\n return 'namespaces and scripts';\n}\n","import type { ToolMessageRenderProps } from '@agimon-ai/po-core/native';\nimport {\n CodeBlock,\n fontOf,\n Markdown,\n MessageItem,\n MessageItemBody,\n MessageItemHeader,\n toolTone,\n} from '@agimon-ai/po-native-components';\nimport type { PoNativeTheme } from '@agimon-ai/po-web-components/nativeTheme';\nimport { useState } from 'react';\nimport { Image, Pressable, Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport {\n callArgsSummary,\n execCalls,\n execCode,\n execResultView,\n execSummary,\n execToolName,\n readsAsDocument,\n type ExecCall,\n type ExecImage,\n} from '../_lib/execToolView';\n\nexport type ExecToolCardProps = ToolMessageRenderProps & { defaultExpanded?: boolean };\n\n/** Pictures and documents stay on screen whether or not their row is open: they are the point of the call. */\nfunction Visuals({ text, images, label }: { text: string; images: readonly ExecImage[]; label: string }) {\n return (\n <>\n {readsAsDocument(text) ? <Markdown text={text} /> : null}\n {images.map((image, index) => (\n <Image\n key={`${image.mimeType}-${String(index)}`}\n source={{ uri: `data:${image.mimeType};base64,${image.data}` }}\n accessibilityLabel={`${label} image ${String(index + 1)}`}\n resizeMode=\"contain\"\n style={styles.image}\n />\n ))}\n </>\n );\n}\n\n/** One call on the rail. Tapping it opens its whole args and result; its pictures and documents show either way. */\nfunction CallRow({ call }: { call: ExecCall }) {\n const [open, setOpen] = useState(false);\n const view = execResultView(call.result ?? null);\n const text = view.lines.join('\\n');\n const printed = text !== '' && !readsAsDocument(text);\n const hasArgs = Object.keys(call.args).length > 0;\n const opens = hasArgs || printed;\n return (\n <View testID=\"exec-call\" style={styles.card}>\n <Pressable\n disabled={!opens}\n onPress={() => setOpen((value) => !value)}\n accessibilityRole={opens ? 'button' : undefined}\n accessibilityState={opens ? { expanded: open } : undefined}\n accessibilityHint={opens ? 'Shows the whole arguments and result' : undefined}\n style={styles.press}\n >\n <View style={styles.argsLine}>\n <Text numberOfLines={1} style={[styles.mono, styles.name, styles.shrink]}>\n {call.name}\n </Text>\n {opens ? <Text style={[styles.sans, styles.dim, styles.keep]}>{open ? '\\u2304' : '\\u203a'}</Text> : null}\n </View>\n <View style={styles.argsLine}>\n <Text numberOfLines={1} style={[styles.mono, styles.args]}>\n {open ? '' : callArgsSummary(call.args)}\n </Text>\n <Text\n accessibilityLabel={call.ok ? 'completed' : 'failed'}\n style={[styles.sans, call.ok ? styles.ok : styles.error]}\n >\n {call.ok ? '\\u2713' : '\\u2717'}\n </Text>\n <Text style={[styles.sans, styles.dim]}>{call.ms} ms</Text>\n </View>\n </Pressable>\n {open && hasArgs ? <CodeBlock text={JSON.stringify(call.args, null, 2)} language=\"json\" /> : null}\n {open && printed ? (\n <Text testID=\"exec-call-output\" selectable style={[styles.mono, styles.text]}>\n {text}\n </Text>\n ) : null}\n {call.error === undefined ? null : <Text style={[styles.sans, styles.error]}>{call.error}</Text>}\n <Visuals text={text} images={view.images} label={call.name} />\n </View>\n );\n}\n\n/** The script's outcome as the rail's last leaf: one line while the card is folded, all of it once opened. */\nfunction Returned({\n result,\n isError,\n expanded,\n}: {\n result: ExecToolCardProps['result'];\n isError: boolean;\n expanded: boolean;\n}) {\n const view = execResultView(result);\n const text = view.lines.join('\\n');\n const document = readsAsDocument(text);\n const whole = expanded || isError;\n return (\n <View testID={`tool-result-${execToolName}`} style={styles.leaf}>\n {view.lines.length === 0 ? (\n <Text style={[styles.sans, styles.dim]}>{isError ? 'Failed with no output.' : 'Returned nothing.'}</Text>\n ) : document ? (\n <Text style={[styles.sans, styles.dim, styles.label]}>{isError ? 'Error' : 'Returned'}</Text>\n ) : (\n <View style={whole ? styles.stack : styles.argsLine}>\n <Text style={[styles.sans, styles.dim, styles.label]}>{isError ? 'Error' : 'Returned'}</Text>\n <Text\n selectable\n numberOfLines={whole ? undefined : 1}\n style={[styles.mono, styles.args, isError ? styles.error : styles.text]}\n >\n {whole ? text : view.lines.join(' ')}\n </Text>\n </View>\n )}\n <Visuals text={text} images={view.images} label=\"Script\" />\n </View>\n );\n}\n\n/**\n * The exec tool's timeline item on native, as the web's ExecToolCard: the\n * calls the script made hang under it on a rail, with what it returned as the\n * last leaf. Opening the item shows the script itself.\n */\nexport function ExecToolCard({ args, result, running, isError, defaultExpanded = false }: ExecToolCardProps) {\n const code = execCode(args);\n const calls = execCalls(result?.details);\n const failed = calls.filter((call) => !call.ok).length;\n const settled = !running || result !== null;\n return (\n <MessageItem tone={toolTone({ running, isError })} expandable={code !== ''} defaultExpanded={defaultExpanded}>\n {({ expanded }) => (\n <>\n <MessageItemHeader title={execToolName}>\n <View testID={`tool-call-${execToolName}`} style={styles.summary}>\n <Text numberOfLines={1} style={[styles.sans, styles.text, styles.shrink]}>\n {execSummary(args)}\n </Text>\n {calls.length > 0 ? (\n <Text numberOfLines={1} style={[styles.sans, styles.dim, styles.keep]}>\n {calls.length} {calls.length === 1 ? 'call' : 'calls'}\n {failed > 0 ? <Text style={styles.error}>, {failed} failed</Text> : null}\n </Text>\n ) : null}\n </View>\n </MessageItemHeader>\n {expanded ? (\n <MessageItemBody>\n <CodeBlock text={code} language=\"ts\" />\n </MessageItemBody>\n ) : null}\n {settled ? (\n <View accessibilityLabel=\"Script calls\" style={styles.rail}>\n {calls.map((call, index) => (\n <CallRow key={`${String(index)}-${call.name}`} call={call} />\n ))}\n <Returned result={result} isError={isError} expanded={expanded} />\n </View>\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 shrink: { flexShrink: 1 },\n keep: { flexShrink: 0 },\n rail: {\n gap: theme.spacing(2),\n marginHorizontal: theme.spacing(4),\n marginBottom: theme.spacing(3),\n paddingLeft: theme.spacing(3),\n borderLeftWidth: 1,\n borderColor: theme.colors['border-soft'],\n },\n card: {\n gap: theme.spacing(2),\n paddingHorizontal: theme.spacing(3),\n paddingVertical: theme.spacing(1),\n borderWidth: 1,\n borderRadius: theme.borderRadius.lg,\n borderColor: theme.colors['border-soft'],\n },\n // 44pt: the smallest comfortable touch target.\n press: { minHeight: 44, justifyContent: 'center', gap: theme.spacing(0.5), paddingVertical: theme.spacing(1) },\n argsLine: { flexDirection: 'row', alignItems: 'center', gap: theme.spacing(2) },\n stack: { gap: theme.spacing(1) },\n leaf: { gap: theme.spacing(2) },\n sans: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n mono: {\n fontFamily: fontOf(theme.fontFamily.mono),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n },\n name: { fontWeight: '600', color: theme.colors.text },\n args: { flex: 1, minWidth: 0, color: theme.colors.dim },\n label: { fontWeight: '600' },\n text: { color: theme.colors.text },\n dim: { color: theme.colors.dim },\n ok: { color: theme.colors.green },\n error: { color: theme.colors.red },\n image: {\n width: '100%',\n aspectRatio: 16 / 9,\n borderWidth: 1,\n borderRadius: theme.borderRadius.md,\n borderColor: theme.colors['border-soft'],\n },\n}));\n","import { defineToolRenderer } from '@agimon-ai/po-core/native';\n\nimport { ExecToolCard } from './_components/ExecToolCard.native';\n\nexport default defineToolRenderer({ message: ExecToolCard });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineNativePlugin, type WebPluginContributions } from '@agimon-ai/po-core/native';\n\nimport toolExec from '../src/extensions/workspaces/sessions/(frontend)/tool/exec.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: 'codemode',\n session: {\n get toolRenderers(): WebPluginContributions['toolRenderers'] { return [via({ tools: ['exec'] }, toolExec)]; },\n },\n});\n"],"mappings":";;;;;;;;;;;AAKA,MAAa,eAAe;AAG5B,MAAM,cAAc;AACpB,MAAM,WAAW;AACjB,MAAM,YAAY;AAClB,MAAM,cAA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AAclB,MAAMkB,aAAac;EACjCnB,aAAab,MAAMc,OAAO;EAAcP,mBAAA,CAAA,CAAA;CAC1C;AACF,EAAE;;;AChOF,IAAA,sBAAe,mBAAmB,EAAE,SAAS,aAAa,CAAC;;;ACC3D,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,eAAe,mBAAmB;CAC7C,IAAI;CACJ,SAAS,EACP,IAAI,gBAAyD;EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG0B,mBAAQ,CAAC;CAAG,EAC9G;AACF,CAAC"}
|
|
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_codemodeTools = require("../codemodeTools-
|
|
5
|
+
const require_codemodeTools = require("../codemodeTools-DS37CHwZ.cjs");
|
|
6
6
|
let _agimon_ai_po_core_codemode = require("@agimon-ai/po-core/codemode");
|
|
7
7
|
let typebox = require("typebox");
|
|
8
8
|
let _agimon_ai_po_core_serverPlugin = require("@agimon-ai/po-core/serverPlugin");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createCodemodeRegistry, t as createCodemodeTools } from "../codemodeTools-
|
|
1
|
+
import { n as createCodemodeRegistry, t as createCodemodeTools } from "../codemodeTools-D8hq2sv2.mjs";
|
|
2
2
|
import { PO_CODEMODE_CONTRACT, PO_CODEMODE_SERVICE } from "@agimon-ai/po-core/codemode";
|
|
3
3
|
import { Type } from "typebox";
|
|
4
4
|
import { PO_SERVER_SCOPE_SERVICE, composeServerProviderOverrides, defineServerPlugin, packageResourcePath, readPackageResource, requirePoServerScope } from "@agimon-ai/po-core/serverPlugin";
|