llmz 0.0.30 → 0.0.32
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/{chunk-7POUFE5M.js → chunk-23SY6IDW.js} +63 -9
- package/dist/{chunk-KQPGB6GB.js → chunk-4JN4PPGP.js} +293 -4
- package/dist/{chunk-VADA6DMR.cjs → chunk-4XIOQWVZ.cjs} +301 -12
- package/dist/{chunk-WP4F6KMW.cjs → chunk-5BEKU5MZ.cjs} +2 -2
- package/dist/{chunk-R3LXNE5N.cjs → chunk-5FWOHMO4.cjs} +325 -60
- package/dist/{chunk-HCC76DDO.js → chunk-AAHUDKBY.js} +2 -2
- package/dist/{chunk-DCYSCVQM.js → chunk-G3LSBWJT.js} +304 -39
- package/dist/{chunk-RLOPQZTQ.cjs → chunk-INDOGCAQ.cjs} +2 -2
- package/dist/{chunk-T63Y6GTW.cjs → chunk-PK72FAKD.cjs} +2 -1
- package/dist/{chunk-273DEMEU.cjs → chunk-SOEKWFU2.cjs} +64 -10
- package/dist/{chunk-IUE5BW56.js → chunk-U4HWJLF2.js} +1 -1
- package/dist/{chunk-MYLTD5WT.js → chunk-WSVDMGMR.js} +2 -1
- package/dist/compiler/plugins/html-to-markdown.d.ts +21 -0
- package/dist/compiler/plugins/jsx-undefined-vars.d.ts +14 -0
- package/dist/context.d.ts +20 -0
- package/dist/{dual-modes-DW3KRXT2.js → dual-modes-LEAHGCOF.js} +1 -1
- package/dist/{dual-modes-F4UV5VAZ.cjs → dual-modes-UBHAMQW4.cjs} +2 -2
- package/dist/errors.d.ts +2 -1
- package/dist/exit-parser.d.ts +37 -0
- package/dist/index.cjs +20 -18
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -12
- package/dist/{llmz-N6KWKJ2Q.js → llmz-3E2JM3HM.js} +85 -42
- package/dist/{llmz-DYB74G5C.cjs → llmz-HGUVAYIN.cjs} +105 -62
- package/dist/llmz.d.ts +12 -0
- package/dist/prompts/worker-mode/system.md.d.ts +1 -1
- package/dist/result.d.ts +18 -0
- package/dist/{tool-GEBXW6AQ.js → tool-7QXH6A24.js} +3 -3
- package/dist/{tool-GMYMVXUK.cjs → tool-JVLOALQN.cjs} +4 -4
- package/dist/tool.d.ts +1 -1
- package/dist/{typings-3VYUEACY.js → typings-ALZEKGV6.js} +2 -2
- package/dist/{typings-2RAAZ2YP.cjs → typings-OLI56LGT.cjs} +3 -3
- package/dist/{vm-NGQ6DRS3.cjs → vm-VFORKC54.cjs} +3 -3
- package/dist/{vm-J6UNJGIN.js → vm-Y3WY2627.js} +2 -2
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkPK72FAKDcjs = require('./chunk-PK72FAKD.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkKIN7Y247cjs = require('./chunk-KIN7Y247.cjs');
|
|
@@ -2101,6 +2101,207 @@ var JSXMarkdown = {
|
|
|
2101
2101
|
}
|
|
2102
2102
|
};
|
|
2103
2103
|
|
|
2104
|
+
// src/compiler/plugins/html-to-markdown.ts
|
|
2105
|
+
var _core = require('@babel/core');
|
|
2106
|
+
function htmlToMarkdownPlugin() {
|
|
2107
|
+
return {
|
|
2108
|
+
name: "html-to-markdown",
|
|
2109
|
+
visitor: {
|
|
2110
|
+
JSXElement(path) {
|
|
2111
|
+
const { openingElement } = path.node;
|
|
2112
|
+
const tagName = _core.types.isJSXIdentifier(openingElement.name) ? openingElement.name.name : null;
|
|
2113
|
+
if (!tagName)
|
|
2114
|
+
return;
|
|
2115
|
+
const lowerTagName = tagName.toLowerCase();
|
|
2116
|
+
if (lowerTagName === "strong" || lowerTagName === "b") {
|
|
2117
|
+
convertToMarkdown(path, "**", "**");
|
|
2118
|
+
} else if (lowerTagName === "em" || lowerTagName === "i") {
|
|
2119
|
+
convertToMarkdown(path, "*", "*");
|
|
2120
|
+
} else if (lowerTagName === "u") {
|
|
2121
|
+
convertToMarkdown(path, "__", "__");
|
|
2122
|
+
} else if (lowerTagName === "a") {
|
|
2123
|
+
convertLinkToMarkdown(path);
|
|
2124
|
+
} else if (lowerTagName === "br") {
|
|
2125
|
+
convertBrToNewline(path);
|
|
2126
|
+
} else if (lowerTagName === "p") {
|
|
2127
|
+
convertParagraphToMarkdown(path);
|
|
2128
|
+
} else if (lowerTagName === "ul") {
|
|
2129
|
+
convertUnorderedListToMarkdown(path);
|
|
2130
|
+
} else if (lowerTagName === "ol") {
|
|
2131
|
+
convertOrderedListToMarkdown(path);
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2137
|
+
function hasOnlyTextChildren(children) {
|
|
2138
|
+
return children.every(
|
|
2139
|
+
(child) => _core.types.isJSXText(child) || _core.types.isJSXExpressionContainer(child) && !_core.types.isJSXElement(child.expression) || _core.types.isJSXElement(child) && canConvertToMarkdown(child)
|
|
2140
|
+
);
|
|
2141
|
+
}
|
|
2142
|
+
function canConvertToMarkdown(element) {
|
|
2143
|
+
const { openingElement } = element;
|
|
2144
|
+
const tagName = _core.types.isJSXIdentifier(openingElement.name) ? openingElement.name.name.toLowerCase() : null;
|
|
2145
|
+
if (!tagName)
|
|
2146
|
+
return false;
|
|
2147
|
+
const allowedTags = ["strong", "b", "em", "i", "u", "br", "p", "a", "li", "ul", "ol"];
|
|
2148
|
+
if (!allowedTags.includes(tagName))
|
|
2149
|
+
return false;
|
|
2150
|
+
if (tagName === "a") {
|
|
2151
|
+
return openingElement.attributes.length === 1 && _core.types.isJSXAttribute(openingElement.attributes[0]) && _core.types.isJSXIdentifier(openingElement.attributes[0].name) && openingElement.attributes[0].name.name === "href";
|
|
2152
|
+
}
|
|
2153
|
+
if (tagName === "br") {
|
|
2154
|
+
return openingElement.attributes.length === 0;
|
|
2155
|
+
}
|
|
2156
|
+
return openingElement.attributes.length === 0;
|
|
2157
|
+
}
|
|
2158
|
+
function convertToMarkdown(path, prefix, suffix) {
|
|
2159
|
+
const element = path.node;
|
|
2160
|
+
if (!canConvertToMarkdown(element))
|
|
2161
|
+
return;
|
|
2162
|
+
const children = element.children;
|
|
2163
|
+
if (!hasOnlyTextChildren(children))
|
|
2164
|
+
return;
|
|
2165
|
+
const textContent = extractTextContent(children);
|
|
2166
|
+
if (!textContent)
|
|
2167
|
+
return;
|
|
2168
|
+
const markdownText = `${prefix}${textContent}${suffix}`;
|
|
2169
|
+
path.replaceWith(_core.types.jsxText(markdownText));
|
|
2170
|
+
}
|
|
2171
|
+
function convertLinkToMarkdown(path) {
|
|
2172
|
+
const element = path.node;
|
|
2173
|
+
if (!canConvertToMarkdown(element))
|
|
2174
|
+
return;
|
|
2175
|
+
const children = element.children;
|
|
2176
|
+
if (!hasOnlyTextChildren(children))
|
|
2177
|
+
return;
|
|
2178
|
+
const hrefAttr = element.openingElement.attributes.find(
|
|
2179
|
+
(attr) => _core.types.isJSXAttribute(attr) && _core.types.isJSXIdentifier(attr.name) && attr.name.name === "href"
|
|
2180
|
+
);
|
|
2181
|
+
if (!hrefAttr || !_core.types.isJSXAttribute(hrefAttr))
|
|
2182
|
+
return;
|
|
2183
|
+
let href = "";
|
|
2184
|
+
if (_core.types.isStringLiteral(hrefAttr.value)) {
|
|
2185
|
+
href = hrefAttr.value.value;
|
|
2186
|
+
} else if (_core.types.isJSXExpressionContainer(hrefAttr.value) && _core.types.isStringLiteral(hrefAttr.value.expression)) {
|
|
2187
|
+
href = hrefAttr.value.expression.value;
|
|
2188
|
+
} else {
|
|
2189
|
+
return;
|
|
2190
|
+
}
|
|
2191
|
+
const textContent = extractTextContent(children);
|
|
2192
|
+
if (!textContent)
|
|
2193
|
+
return;
|
|
2194
|
+
const markdownText = `[${textContent}](${href})`;
|
|
2195
|
+
path.replaceWith(_core.types.jsxText(markdownText));
|
|
2196
|
+
}
|
|
2197
|
+
function convertBrToNewline(path) {
|
|
2198
|
+
const element = path.node;
|
|
2199
|
+
if (!canConvertToMarkdown(element))
|
|
2200
|
+
return;
|
|
2201
|
+
path.replaceWith(_core.types.jsxText("\n"));
|
|
2202
|
+
}
|
|
2203
|
+
function convertParagraphToMarkdown(path) {
|
|
2204
|
+
const element = path.node;
|
|
2205
|
+
if (!canConvertToMarkdown(element))
|
|
2206
|
+
return;
|
|
2207
|
+
const children = element.children;
|
|
2208
|
+
if (!hasOnlyTextChildren(children))
|
|
2209
|
+
return;
|
|
2210
|
+
const textContent = extractTextContent(children);
|
|
2211
|
+
if (!textContent)
|
|
2212
|
+
return;
|
|
2213
|
+
const markdownText = `${textContent}
|
|
2214
|
+
|
|
2215
|
+
`;
|
|
2216
|
+
path.replaceWith(_core.types.jsxText(markdownText));
|
|
2217
|
+
}
|
|
2218
|
+
function convertUnorderedListToMarkdown(path) {
|
|
2219
|
+
const element = path.node;
|
|
2220
|
+
if (element.openingElement.attributes.length > 0)
|
|
2221
|
+
return;
|
|
2222
|
+
const children = element.children;
|
|
2223
|
+
const listItems = [];
|
|
2224
|
+
for (const child of children) {
|
|
2225
|
+
if (_core.types.isJSXElement(child)) {
|
|
2226
|
+
const tagName = _core.types.isJSXIdentifier(child.openingElement.name) ? child.openingElement.name.name : null;
|
|
2227
|
+
if ((tagName == null ? void 0 : tagName.toLowerCase()) === "li" && canConvertToMarkdown(child)) {
|
|
2228
|
+
const itemText = extractTextContent(child.children);
|
|
2229
|
+
if (itemText) {
|
|
2230
|
+
listItems.push(`- ${itemText}`);
|
|
2231
|
+
}
|
|
2232
|
+
} else {
|
|
2233
|
+
return;
|
|
2234
|
+
}
|
|
2235
|
+
} else if (_core.types.isJSXText(child) && child.value.trim()) {
|
|
2236
|
+
return;
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
if (listItems.length === 0)
|
|
2240
|
+
return;
|
|
2241
|
+
const markdownText = listItems.join("\n") + "\n";
|
|
2242
|
+
path.replaceWith(_core.types.jsxText(markdownText));
|
|
2243
|
+
}
|
|
2244
|
+
function convertOrderedListToMarkdown(path) {
|
|
2245
|
+
const element = path.node;
|
|
2246
|
+
if (element.openingElement.attributes.length > 0)
|
|
2247
|
+
return;
|
|
2248
|
+
const children = element.children;
|
|
2249
|
+
const listItems = [];
|
|
2250
|
+
for (const child of children) {
|
|
2251
|
+
if (_core.types.isJSXElement(child)) {
|
|
2252
|
+
const tagName = _core.types.isJSXIdentifier(child.openingElement.name) ? child.openingElement.name.name : null;
|
|
2253
|
+
if ((tagName == null ? void 0 : tagName.toLowerCase()) === "li" && canConvertToMarkdown(child)) {
|
|
2254
|
+
const itemText = extractTextContent(child.children);
|
|
2255
|
+
if (itemText) {
|
|
2256
|
+
listItems.push(`${listItems.length + 1}. ${itemText}`);
|
|
2257
|
+
}
|
|
2258
|
+
} else {
|
|
2259
|
+
return;
|
|
2260
|
+
}
|
|
2261
|
+
} else if (_core.types.isJSXText(child) && child.value.trim()) {
|
|
2262
|
+
return;
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
if (listItems.length === 0)
|
|
2266
|
+
return;
|
|
2267
|
+
const markdownText = listItems.join("\n") + "\n";
|
|
2268
|
+
path.replaceWith(_core.types.jsxText(markdownText));
|
|
2269
|
+
}
|
|
2270
|
+
function extractTextContent(children) {
|
|
2271
|
+
let text = "";
|
|
2272
|
+
for (const child of children) {
|
|
2273
|
+
if (_core.types.isJSXText(child)) {
|
|
2274
|
+
text += child.value;
|
|
2275
|
+
} else if (_core.types.isJSXExpressionContainer(child)) {
|
|
2276
|
+
return "";
|
|
2277
|
+
} else if (_core.types.isJSXElement(child)) {
|
|
2278
|
+
const nestedText = extractTextContent(child.children);
|
|
2279
|
+
if (!nestedText)
|
|
2280
|
+
return "";
|
|
2281
|
+
const tagName = _core.types.isJSXIdentifier(child.openingElement.name) ? child.openingElement.name.name.toLowerCase() : null;
|
|
2282
|
+
switch (tagName) {
|
|
2283
|
+
case "strong":
|
|
2284
|
+
case "b":
|
|
2285
|
+
text += `**${nestedText}**`;
|
|
2286
|
+
break;
|
|
2287
|
+
case "em":
|
|
2288
|
+
case "i":
|
|
2289
|
+
text += `*${nestedText}*`;
|
|
2290
|
+
break;
|
|
2291
|
+
case "u":
|
|
2292
|
+
text += `__${nestedText}__`;
|
|
2293
|
+
break;
|
|
2294
|
+
case "br":
|
|
2295
|
+
text += "\n";
|
|
2296
|
+
break;
|
|
2297
|
+
default:
|
|
2298
|
+
return "";
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
return text;
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2104
2305
|
// src/compiler/plugins/jsx-preserve-newlines.ts
|
|
2105
2306
|
|
|
2106
2307
|
|
|
@@ -2137,10 +2338,71 @@ var JSXNewLines = {
|
|
|
2137
2338
|
postProcessing
|
|
2138
2339
|
};
|
|
2139
2340
|
|
|
2341
|
+
// src/compiler/plugins/jsx-undefined-vars.ts
|
|
2342
|
+
|
|
2343
|
+
function jsxUndefinedVarsPlugin() {
|
|
2344
|
+
return {
|
|
2345
|
+
name: "jsx-undefined-vars",
|
|
2346
|
+
visitor: {
|
|
2347
|
+
JSXExpressionContainer(path) {
|
|
2348
|
+
const expression = path.node.expression;
|
|
2349
|
+
if (_core.types.isJSXEmptyExpression(expression)) {
|
|
2350
|
+
return;
|
|
2351
|
+
}
|
|
2352
|
+
if (!_core.types.isIdentifier(expression)) {
|
|
2353
|
+
return;
|
|
2354
|
+
}
|
|
2355
|
+
const varName = expression.name;
|
|
2356
|
+
const knownGlobals = /* @__PURE__ */ new Set([
|
|
2357
|
+
"undefined",
|
|
2358
|
+
"null",
|
|
2359
|
+
"true",
|
|
2360
|
+
"false",
|
|
2361
|
+
"NaN",
|
|
2362
|
+
"Infinity",
|
|
2363
|
+
"console",
|
|
2364
|
+
"Math",
|
|
2365
|
+
"JSON",
|
|
2366
|
+
"Object",
|
|
2367
|
+
"Array",
|
|
2368
|
+
"String",
|
|
2369
|
+
"Number",
|
|
2370
|
+
"Boolean",
|
|
2371
|
+
"Date",
|
|
2372
|
+
"RegExp",
|
|
2373
|
+
"Error",
|
|
2374
|
+
"Promise",
|
|
2375
|
+
"Symbol"
|
|
2376
|
+
]);
|
|
2377
|
+
if (knownGlobals.has(varName)) {
|
|
2378
|
+
return;
|
|
2379
|
+
}
|
|
2380
|
+
const iife = _core.types.callExpression(
|
|
2381
|
+
_core.types.arrowFunctionExpression(
|
|
2382
|
+
[],
|
|
2383
|
+
_core.types.blockStatement([
|
|
2384
|
+
_core.types.tryStatement(
|
|
2385
|
+
_core.types.blockStatement([_core.types.returnStatement(_core.types.identifier(varName))]),
|
|
2386
|
+
_core.types.catchClause(
|
|
2387
|
+
null,
|
|
2388
|
+
// no error binding needed
|
|
2389
|
+
_core.types.blockStatement([_core.types.returnStatement(_core.types.stringLiteral(varName))])
|
|
2390
|
+
)
|
|
2391
|
+
)
|
|
2392
|
+
])
|
|
2393
|
+
),
|
|
2394
|
+
[]
|
|
2395
|
+
);
|
|
2396
|
+
path.node.expression = iife;
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
};
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2140
2402
|
// src/compiler/plugins/line-tracking.ts
|
|
2141
2403
|
|
|
2142
2404
|
var LineTrackingFnIdentifier = "__track__";
|
|
2143
|
-
var lineTrackingBabelPlugin = function({ types:
|
|
2405
|
+
var lineTrackingBabelPlugin = function({ types: t3 }) {
|
|
2144
2406
|
return {
|
|
2145
2407
|
visitor: {
|
|
2146
2408
|
Program(path) {
|
|
@@ -2161,8 +2423,8 @@ var lineTrackingBabelPlugin = function({ types: t }) {
|
|
|
2161
2423
|
console.error(e);
|
|
2162
2424
|
}
|
|
2163
2425
|
};
|
|
2164
|
-
if (
|
|
2165
|
-
if (!trackedLines.has(startLine) && !
|
|
2426
|
+
if (t3.isFunctionDeclaration(node) || t3.isClassMethod(node) || t3.isReturnStatement(node) || t3.isAwaitExpression(node) || t3.isForOfStatement(node) || t3.isCallExpression(node) || t3.isUnaryExpression(node) || t3.isVariableDeclaration(node) || t3.isBlockStatement(path2.parent) || t3.isAssignmentExpression(node)) {
|
|
2427
|
+
if (!trackedLines.has(startLine) && !t3.isArrowFunctionExpression(path2.parent) && !t3.isObjectProperty(path2.parent) && !t3.isAwaitExpression(path2.parent) && !t3.isUnaryExpression(path2.parent) && !t3.isReturnStatement(path2.parent) && !t3.isForOfStatement(path2.parent) && !t3.isForStatement(path2.parent) && !t3.isForInStatement(path2.parent) && !t3.isVariableDeclaration(path2.parent) && !t3.isBinaryExpression(path2.parent) && !t3.isLogicalExpression(path2.parent)) {
|
|
2166
2428
|
track();
|
|
2167
2429
|
}
|
|
2168
2430
|
}
|
|
@@ -2177,7 +2439,7 @@ var lineTrackingBabelPlugin = function({ types: t }) {
|
|
|
2177
2439
|
// src/compiler/plugins/replace-comment.ts
|
|
2178
2440
|
var CommentFnIdentifier = "__comment__";
|
|
2179
2441
|
var replaceCommentBabelPlugin = function({
|
|
2180
|
-
types:
|
|
2442
|
+
types: t3
|
|
2181
2443
|
}) {
|
|
2182
2444
|
return {
|
|
2183
2445
|
visitor: {
|
|
@@ -2196,13 +2458,13 @@ var replaceCommentBabelPlugin = function({
|
|
|
2196
2458
|
return;
|
|
2197
2459
|
}
|
|
2198
2460
|
processed.add(comment.loc);
|
|
2199
|
-
const commentCall =
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2461
|
+
const commentCall = t3.expressionStatement(
|
|
2462
|
+
t3.callExpression(t3.identifier(CommentFnIdentifier), [
|
|
2463
|
+
t3.stringLiteral(comment.value.trim()),
|
|
2464
|
+
t3.numericLiteral(_nullishCoalesce(((_a = comment.loc) == null ? void 0 : _a.start.line), () => ( 0)))
|
|
2203
2465
|
])
|
|
2204
2466
|
);
|
|
2205
|
-
const isInsideObjectProperty =
|
|
2467
|
+
const isInsideObjectProperty = t3.isObjectProperty(node) || path2.findParent((path3) => t3.isObjectProperty(path3.node));
|
|
2206
2468
|
if (!isInsideObjectProperty) {
|
|
2207
2469
|
insertMethod(commentCall);
|
|
2208
2470
|
}
|
|
@@ -2221,7 +2483,7 @@ var replaceCommentBabelPlugin = function({
|
|
|
2221
2483
|
|
|
2222
2484
|
// src/compiler/plugins/return-async.ts
|
|
2223
2485
|
var instrumentLastLinePlugin = function({
|
|
2224
|
-
types:
|
|
2486
|
+
types: t3
|
|
2225
2487
|
}) {
|
|
2226
2488
|
return {
|
|
2227
2489
|
visitor: {
|
|
@@ -2235,14 +2497,14 @@ var instrumentLastLinePlugin = function({
|
|
|
2235
2497
|
return;
|
|
2236
2498
|
}
|
|
2237
2499
|
const lastStatement = statements[statements.length - 1];
|
|
2238
|
-
if (
|
|
2239
|
-
if (
|
|
2240
|
-
lastStatement.argument =
|
|
2500
|
+
if (t3.isReturnStatement(lastStatement)) {
|
|
2501
|
+
if (t3.isExpression(lastStatement.argument)) {
|
|
2502
|
+
lastStatement.argument = t3.awaitExpression(lastStatement.argument);
|
|
2241
2503
|
}
|
|
2242
2504
|
return;
|
|
2243
2505
|
}
|
|
2244
|
-
if (
|
|
2245
|
-
const returnStatement3 =
|
|
2506
|
+
if (t3.isExpressionStatement(lastStatement) && (t3.isCallExpression(lastStatement.expression) || t3.isAwaitExpression(lastStatement.expression))) {
|
|
2507
|
+
const returnStatement3 = t3.returnStatement(t3.awaitExpression(lastStatement.expression));
|
|
2246
2508
|
(_b = path.get("body").get("body")[statements.length - 1]) == null ? void 0 : _b.replaceWith(returnStatement3);
|
|
2247
2509
|
}
|
|
2248
2510
|
}
|
|
@@ -2460,7 +2722,7 @@ var toolCallTrackingPlugin = (calls = /* @__PURE__ */ new Map()) => function({})
|
|
|
2460
2722
|
|
|
2461
2723
|
|
|
2462
2724
|
var VariableTrackingFnIdentifier = "__var__";
|
|
2463
|
-
var variableTrackingPlugin = (variables = /* @__PURE__ */ new Set()) => function({ types:
|
|
2725
|
+
var variableTrackingPlugin = (variables = /* @__PURE__ */ new Set()) => function({ types: t3 }) {
|
|
2464
2726
|
let trackingStatements = [];
|
|
2465
2727
|
const trackVariable = (variableName) => {
|
|
2466
2728
|
if (variableName.startsWith("__")) {
|
|
@@ -2480,19 +2742,19 @@ var variableTrackingPlugin = (variables = /* @__PURE__ */ new Set()) => function
|
|
|
2480
2742
|
visitor: {
|
|
2481
2743
|
FunctionDeclaration(path) {
|
|
2482
2744
|
path.node.params.forEach((param) => {
|
|
2483
|
-
if (
|
|
2745
|
+
if (t3.isIdentifier(param)) {
|
|
2484
2746
|
trackVariable(param.name);
|
|
2485
|
-
} else if (
|
|
2747
|
+
} else if (t3.isAssignmentPattern(param) && t3.isIdentifier(param.left)) {
|
|
2486
2748
|
trackVariable(param.left.name);
|
|
2487
|
-
} else if (
|
|
2749
|
+
} else if (t3.isObjectPattern(param)) {
|
|
2488
2750
|
param.properties.forEach((prop) => {
|
|
2489
|
-
if (
|
|
2751
|
+
if (t3.isObjectProperty(prop) && t3.isIdentifier(prop.value)) {
|
|
2490
2752
|
trackVariable(prop.value.name);
|
|
2491
2753
|
}
|
|
2492
2754
|
});
|
|
2493
|
-
} else if (
|
|
2755
|
+
} else if (t3.isArrayPattern(param)) {
|
|
2494
2756
|
param.elements.forEach((element) => {
|
|
2495
|
-
if (
|
|
2757
|
+
if (t3.isIdentifier(element)) {
|
|
2496
2758
|
trackVariable(element.name);
|
|
2497
2759
|
}
|
|
2498
2760
|
});
|
|
@@ -2505,19 +2767,19 @@ var variableTrackingPlugin = (variables = /* @__PURE__ */ new Set()) => function
|
|
|
2505
2767
|
},
|
|
2506
2768
|
ArrowFunctionExpression(path) {
|
|
2507
2769
|
path.node.params.forEach((param) => {
|
|
2508
|
-
if (
|
|
2770
|
+
if (t3.isIdentifier(param)) {
|
|
2509
2771
|
trackVariable(param.name);
|
|
2510
|
-
} else if (
|
|
2772
|
+
} else if (t3.isAssignmentPattern(param) && t3.isIdentifier(param.left)) {
|
|
2511
2773
|
trackVariable(param.left.name);
|
|
2512
|
-
} else if (
|
|
2774
|
+
} else if (t3.isObjectPattern(param)) {
|
|
2513
2775
|
param.properties.forEach((prop) => {
|
|
2514
|
-
if (
|
|
2776
|
+
if (t3.isObjectProperty(prop) && t3.isIdentifier(prop.value)) {
|
|
2515
2777
|
trackVariable(prop.value.name);
|
|
2516
2778
|
}
|
|
2517
2779
|
});
|
|
2518
|
-
} else if (
|
|
2780
|
+
} else if (t3.isArrayPattern(param)) {
|
|
2519
2781
|
param.elements.forEach((element) => {
|
|
2520
|
-
if (
|
|
2782
|
+
if (t3.isIdentifier(element)) {
|
|
2521
2783
|
trackVariable(element.name);
|
|
2522
2784
|
}
|
|
2523
2785
|
});
|
|
@@ -2538,11 +2800,11 @@ var variableTrackingPlugin = (variables = /* @__PURE__ */ new Set()) => function
|
|
|
2538
2800
|
const parent = path.parentPath;
|
|
2539
2801
|
const handleObjectPattern = (pattern) => {
|
|
2540
2802
|
pattern.properties.forEach((prop) => {
|
|
2541
|
-
if (
|
|
2803
|
+
if (t3.isObjectProperty(prop) && t3.isIdentifier(prop.value)) {
|
|
2542
2804
|
trackVariable(prop.value.name);
|
|
2543
|
-
} else if (
|
|
2805
|
+
} else if (t3.isObjectProperty(prop) && t3.isObjectPattern(prop.value)) {
|
|
2544
2806
|
handleObjectPattern(prop.value);
|
|
2545
|
-
} else if (
|
|
2807
|
+
} else if (t3.isObjectProperty(prop) && t3.isAssignmentPattern(prop.value) && t3.isIdentifier(prop.value.left)) {
|
|
2546
2808
|
trackVariable(prop.value.left.name);
|
|
2547
2809
|
}
|
|
2548
2810
|
});
|
|
@@ -2551,19 +2813,19 @@ var variableTrackingPlugin = (variables = /* @__PURE__ */ new Set()) => function
|
|
|
2551
2813
|
if (parent.isForXStatement() || parent.isForStatement()) {
|
|
2552
2814
|
return;
|
|
2553
2815
|
}
|
|
2554
|
-
if (
|
|
2816
|
+
if (t3.isIdentifier(declarator.id)) {
|
|
2555
2817
|
trackVariable(declarator.id.name);
|
|
2556
2818
|
}
|
|
2557
|
-
if (
|
|
2819
|
+
if (t3.isObjectPattern(declarator.id)) {
|
|
2558
2820
|
handleObjectPattern(declarator.id);
|
|
2559
2821
|
}
|
|
2560
|
-
if (
|
|
2822
|
+
if (t3.isArrayPattern(declarator.id)) {
|
|
2561
2823
|
declarator.id.elements.forEach((element) => {
|
|
2562
|
-
if (
|
|
2824
|
+
if (t3.isIdentifier(element)) {
|
|
2563
2825
|
trackVariable(element.name);
|
|
2564
|
-
} else if (
|
|
2826
|
+
} else if (t3.isRestElement(element) && t3.isIdentifier(element.argument)) {
|
|
2565
2827
|
trackVariable(element.argument.name);
|
|
2566
|
-
} else if (
|
|
2828
|
+
} else if (t3.isAssignmentPattern(element) && t3.isIdentifier(element.left)) {
|
|
2567
2829
|
trackVariable(element.left.name);
|
|
2568
2830
|
}
|
|
2569
2831
|
});
|
|
@@ -2612,6 +2874,10 @@ function compile(code) {
|
|
|
2612
2874
|
presets: ["typescript"],
|
|
2613
2875
|
plugins: [
|
|
2614
2876
|
JSXNewLines.babelPlugin,
|
|
2877
|
+
htmlToMarkdownPlugin,
|
|
2878
|
+
// Convert simple HTML to markdown first
|
|
2879
|
+
jsxUndefinedVarsPlugin,
|
|
2880
|
+
// Must run BEFORE JSX transform
|
|
2615
2881
|
[
|
|
2616
2882
|
_plugintransformreactjsx2.default,
|
|
2617
2883
|
{
|
|
@@ -2694,7 +2960,7 @@ function getCompiledCode(code, traces = []) {
|
|
|
2694
2960
|
code,
|
|
2695
2961
|
started_at: Date.now()
|
|
2696
2962
|
});
|
|
2697
|
-
throw new (0,
|
|
2963
|
+
throw new (0, _chunkPK72FAKDcjs.InvalidCodeError)(err.message, code);
|
|
2698
2964
|
}
|
|
2699
2965
|
}
|
|
2700
2966
|
async function runAsyncFunction(context, code, traces = [], signal = null, timeout = MAX_VM_EXECUTION_TIME) {
|
|
@@ -2770,8 +3036,8 @@ async function runAsyncFunction(context, code, traces = [], signal = null, timeo
|
|
|
2770
3036
|
let currentToolCall;
|
|
2771
3037
|
context[Identifiers.ToolCallTrackerFnIdentifier] = (callId, type, outputOrError) => {
|
|
2772
3038
|
var _a2;
|
|
2773
|
-
const temp =
|
|
2774
|
-
if (type === "end" && temp instanceof
|
|
3039
|
+
const temp = _chunkPK72FAKDcjs.Signals.maybeDeserializeError(outputOrError == null ? void 0 : outputOrError.message);
|
|
3040
|
+
if (type === "end" && temp instanceof _chunkPK72FAKDcjs.SnapshotSignal && (temp == null ? void 0 : temp.toolCall)) {
|
|
2775
3041
|
currentToolCall = {
|
|
2776
3042
|
...temp.toolCall,
|
|
2777
3043
|
assignment: (_a2 = transformed.toolCalls.get(callId)) == null ? void 0 : _a2.assignment
|
|
@@ -2801,7 +3067,6 @@ async function runAsyncFunction(context, code, traces = [], signal = null, timeo
|
|
|
2801
3067
|
};
|
|
2802
3068
|
const QuickJS = await _quickjsemscriptencore.newQuickJSWASMModuleFromVariant.call(void 0, BundledReleaseSyncVariant);
|
|
2803
3069
|
const runtime = QuickJS.newRuntime();
|
|
2804
|
-
runtime.setDebugMode(true);
|
|
2805
3070
|
runtime.setMemoryLimit(128 * 1024 * 1024);
|
|
2806
3071
|
const startTime = Date.now();
|
|
2807
3072
|
const timeoutHandler = _quickjsemscriptencore.shouldInterruptAfterDeadline.call(void 0, startTime + timeout);
|
|
@@ -3270,8 +3535,8 @@ ${transformed.code}
|
|
|
3270
3535
|
const errorStackResult = vm.evalCode("globalThis.__llmz_error_stack");
|
|
3271
3536
|
const errorStack = vm.dump(errorStackResult.unwrap()) || "";
|
|
3272
3537
|
errorStackResult.unwrap().dispose();
|
|
3273
|
-
const deserializedError =
|
|
3274
|
-
if (deserializedError instanceof
|
|
3538
|
+
const deserializedError = _chunkPK72FAKDcjs.Signals.maybeDeserializeError(errorValue);
|
|
3539
|
+
if (deserializedError instanceof _chunkPK72FAKDcjs.VMSignal) {
|
|
3275
3540
|
deserializedError.stack = errorStack;
|
|
3276
3541
|
throw deserializedError;
|
|
3277
3542
|
}
|
|
@@ -3289,11 +3554,11 @@ ${transformed.code}
|
|
|
3289
3554
|
returnValue = vm.dump(resultResult.unwrap());
|
|
3290
3555
|
resultResult.unwrap().dispose();
|
|
3291
3556
|
}
|
|
3292
|
-
returnValue =
|
|
3557
|
+
returnValue = _chunkPK72FAKDcjs.Signals.maybeDeserializeError(returnValue);
|
|
3293
3558
|
return {
|
|
3294
3559
|
success: true,
|
|
3295
3560
|
variables: _chunkUQOBUJIQcjs.mapValues_default.call(void 0, variables, (getter) => _chunkUQOBUJIQcjs.isFunction_default.call(void 0, getter) ? getter() : getter),
|
|
3296
|
-
signal: returnValue instanceof
|
|
3561
|
+
signal: returnValue instanceof _chunkPK72FAKDcjs.VMSignal ? returnValue : void 0,
|
|
3297
3562
|
lines_executed: Array.from(lines_executed),
|
|
3298
3563
|
return_value: returnValue
|
|
3299
3564
|
};
|
|
@@ -3392,8 +3657,8 @@ ${transformed.code}
|
|
|
3392
3657
|
let currentToolCall;
|
|
3393
3658
|
context[Identifiers.ToolCallTrackerFnIdentifier] = (callId, type, outputOrError) => {
|
|
3394
3659
|
var _a2;
|
|
3395
|
-
const temp =
|
|
3396
|
-
if (type === "end" && temp instanceof
|
|
3660
|
+
const temp = _chunkPK72FAKDcjs.Signals.maybeDeserializeError(outputOrError == null ? void 0 : outputOrError.message);
|
|
3661
|
+
if (type === "end" && temp instanceof _chunkPK72FAKDcjs.SnapshotSignal && (temp == null ? void 0 : temp.toolCall)) {
|
|
3397
3662
|
currentToolCall = {
|
|
3398
3663
|
...temp.toolCall,
|
|
3399
3664
|
assignment: (_a2 = transformed.toolCalls.get(callId)) == null ? void 0 : _a2.assignment
|
|
@@ -3447,11 +3712,11 @@ ${transformed.code}
|
|
|
3447
3712
|
await context[Identifiers.AsyncIterYieldFnIdentifier](value);
|
|
3448
3713
|
} while (true);
|
|
3449
3714
|
})().then((res) => {
|
|
3450
|
-
res =
|
|
3715
|
+
res = _chunkPK72FAKDcjs.Signals.maybeDeserializeError(res);
|
|
3451
3716
|
return {
|
|
3452
3717
|
success: true,
|
|
3453
3718
|
variables: _chunkUQOBUJIQcjs.mapValues_default.call(void 0, variables, (getter) => _chunkUQOBUJIQcjs.isFunction_default.call(void 0, getter) ? getter() : getter),
|
|
3454
|
-
signal: res instanceof
|
|
3719
|
+
signal: res instanceof _chunkPK72FAKDcjs.VMSignal ? res : void 0,
|
|
3455
3720
|
lines_executed: Array.from(lines_executed),
|
|
3456
3721
|
return_value: res
|
|
3457
3722
|
};
|
|
@@ -3461,7 +3726,7 @@ ${transformed.code}
|
|
|
3461
3726
|
}
|
|
3462
3727
|
var handleErrorQuickJS = (err, code, _consumer, traces, variables, lines_executed, userCodeStartLine, currentToolCall) => {
|
|
3463
3728
|
var _a, _b, _c;
|
|
3464
|
-
err =
|
|
3729
|
+
err = _chunkPK72FAKDcjs.Signals.maybeDeserializeError(err);
|
|
3465
3730
|
const lines = code.split("\n");
|
|
3466
3731
|
const stackTrace = err.stack || "";
|
|
3467
3732
|
const LINE_OFFSET = 1;
|
|
@@ -3520,7 +3785,7 @@ var handleErrorQuickJS = (err, code, _consumer, traces, variables, lines_execute
|
|
|
3520
3785
|
}
|
|
3521
3786
|
debugUserCode = _chunkKIN7Y247cjs.cleanStackTrace.call(void 0, debugUserCode).trim();
|
|
3522
3787
|
truncatedCode = _chunkKIN7Y247cjs.cleanStackTrace.call(void 0, truncatedCode).trim();
|
|
3523
|
-
if (err instanceof
|
|
3788
|
+
if (err instanceof _chunkPK72FAKDcjs.VMSignal) {
|
|
3524
3789
|
const signalError = err;
|
|
3525
3790
|
signalError.stack = debugUserCode;
|
|
3526
3791
|
signalError.truncatedCode = truncatedCode;
|
|
@@ -3540,8 +3805,8 @@ var handleErrorQuickJS = (err, code, _consumer, traces, variables, lines_execute
|
|
|
3540
3805
|
stackTrace: debugUserCode,
|
|
3541
3806
|
started_at: Date.now()
|
|
3542
3807
|
});
|
|
3543
|
-
const codeError = new (0,
|
|
3544
|
-
const deserializedError =
|
|
3808
|
+
const codeError = new (0, _chunkPK72FAKDcjs.CodeExecutionError)(err.message, code, debugUserCode);
|
|
3809
|
+
const deserializedError = _chunkPK72FAKDcjs.Signals.maybeDeserializeError(codeError);
|
|
3545
3810
|
return {
|
|
3546
3811
|
success: false,
|
|
3547
3812
|
variables: _chunkUQOBUJIQcjs.mapValues_default.call(void 0, variables, (getter) => _chunkUQOBUJIQcjs.isFunction_default.call(void 0, getter) ? getter() : getter),
|
|
@@ -3553,7 +3818,7 @@ var handleErrorQuickJS = (err, code, _consumer, traces, variables, lines_execute
|
|
|
3553
3818
|
};
|
|
3554
3819
|
var handleErrorNode = (err, code, consumer, traces, variables, _lines_executed, currentToolCall) => {
|
|
3555
3820
|
var _a, _b, _c;
|
|
3556
|
-
err =
|
|
3821
|
+
err = _chunkPK72FAKDcjs.Signals.maybeDeserializeError(err);
|
|
3557
3822
|
const lines = code.split("\n");
|
|
3558
3823
|
const stackTrace = err.stack || "";
|
|
3559
3824
|
const LINE_OFFSET = 1;
|
|
@@ -3604,7 +3869,7 @@ var handleErrorNode = (err, code, consumer, traces, variables, _lines_executed,
|
|
|
3604
3869
|
}
|
|
3605
3870
|
debugUserCode = _chunkKIN7Y247cjs.cleanStackTrace.call(void 0, debugUserCode).trim();
|
|
3606
3871
|
truncatedCode = _chunkKIN7Y247cjs.cleanStackTrace.call(void 0, truncatedCode).trim();
|
|
3607
|
-
if (err instanceof
|
|
3872
|
+
if (err instanceof _chunkPK72FAKDcjs.VMSignal) {
|
|
3608
3873
|
err.stack = debugUserCode;
|
|
3609
3874
|
err.truncatedCode = truncatedCode;
|
|
3610
3875
|
err.variables = _chunkUQOBUJIQcjs.mapValues_default.call(void 0, variables, (getter) => _chunkUQOBUJIQcjs.isFunction_default.call(void 0, getter) ? getter() : getter);
|
|
@@ -3618,16 +3883,16 @@ var handleErrorNode = (err, code, consumer, traces, variables, _lines_executed,
|
|
|
3618
3883
|
stackTrace: debugUserCode,
|
|
3619
3884
|
started_at: Date.now()
|
|
3620
3885
|
});
|
|
3621
|
-
throw new (0,
|
|
3886
|
+
throw new (0, _chunkPK72FAKDcjs.CodeExecutionError)(err.message, code, debugUserCode);
|
|
3622
3887
|
}
|
|
3623
3888
|
};
|
|
3624
3889
|
var handleCatch = (err, traces, variables, lines_executed) => {
|
|
3625
|
-
err =
|
|
3890
|
+
err = _chunkPK72FAKDcjs.Signals.maybeDeserializeError(err);
|
|
3626
3891
|
return {
|
|
3627
|
-
success: err instanceof
|
|
3892
|
+
success: err instanceof _chunkPK72FAKDcjs.VMSignal ? true : false,
|
|
3628
3893
|
variables: _chunkUQOBUJIQcjs.mapValues_default.call(void 0, variables, (getter) => _chunkUQOBUJIQcjs.isFunction_default.call(void 0, getter) ? getter() : getter),
|
|
3629
3894
|
error: err,
|
|
3630
|
-
signal: err instanceof
|
|
3895
|
+
signal: err instanceof _chunkPK72FAKDcjs.VMSignal ? err : void 0,
|
|
3631
3896
|
traces,
|
|
3632
3897
|
lines_executed: Array.from(lines_executed)
|
|
3633
3898
|
};
|
|
@@ -396,7 +396,7 @@ var replacePlaceholders = (prompt, values) => {
|
|
|
396
396
|
}
|
|
397
397
|
});
|
|
398
398
|
const remaining = Object.keys(obj).filter(
|
|
399
|
-
(key) => key !== "is_message_enabled" && key !== "exits" && key !== "components"
|
|
399
|
+
(key) => key !== "is_message_enabled" && key !== "exits" && key !== "components" && key !== "transcript"
|
|
400
400
|
);
|
|
401
401
|
if (remaining.length) {
|
|
402
402
|
throw new Error(`Missing placeholders: ${remaining.join(", ")}`);
|
|
@@ -410,7 +410,7 @@ var replacePlaceholders = (prompt, values) => {
|
|
|
410
410
|
};
|
|
411
411
|
|
|
412
412
|
// src/prompts/worker-mode/system.md.ts
|
|
413
|
-
var system_md_default2 = "# Important Instructions\n\nYou are a helpful
|
|
413
|
+
var system_md_default2 = "# Important Instructions\n\nYou are a helpful background AI Agent with defined Role, Capabilities and Responsibilities.\nYou can:\n\n- Generate TypeScript (TS) code that will be executed in a secure VM environment.\n- Use the provided tools to accomplish the task at hand\n\n**Your main task**: Write TypeScript code following specific guidelines to\n\n# Part 1: Response Format\n\n- **Always** reply **only** with TS code placed between `\u25A0fn_start` and `\u25A0fn_end`.\n- **Structure**:\n\n ```ts\n \u25A0fn_start\n // Your TypeScript code here\n \u25A0fn_end\n ```\n\n- **Guidelines**:\n\n - Write complete, syntax-error-free TypeScript code\n - Use only the tools provided to interact with the system\n - Include a valid `return` statement at the end of your function\n\n## Return Statement\n\n**Important**: `action` can only be one of: 'think', {{#each exits}}'{{name}}', {{/each}}\n\n{{#each exits}}\n\n{{#if has_typings}}\n\n- **{{name}}**: {{description}}\n\n**typeof value** must respect this format:\n\n```\n{{{typings}}}\n```\n\n```ts\nreturn { action: '{{name}}', value: /*...*/ }\n```\n\n{{else}}\n\n- **{{name}}**: {{description}}\n\n```ts\nreturn { action: '{{name}}' }\n```\n\n{{/if}}\n\n{{/each}}\n\n- **If further processing** is needed before continuing, use `think` to print the value of variables and re-generate code:\n\n ```ts\n return { action: 'think', variable1, variable2 }\n ```\n\n## Examples\n\n- **Using a Tool and Returning Think Action**:\n\n ```ts\n \u25A0fn_start\n const data = await fetchUserData(user.id)\n return { action: 'think', data }\n \u25A0fn_end\n ```\n\n# Part 2: VM Sandbox Environment and Tools\n\nYou have access to very specific tools and data in the VM Sandbox environment\nYou should use these tools as needed and as instructed to interact with the system and perform operations\n\n## List of Tools (`tools.d.ts`)\n\n- You are responsible for writing the code to solve the problem at hand using the tools provided\n- You have to ask yourself - \"given the instructions given and the tools available, what code should I write to solve the problem?\"\n- These tools are available to you in the `tools.d.ts` file. You should always refer to the `tools.d.ts` file to understand the available tools and their usage\n\n## Typescript Sandbox (VM)\n\n- The code you write will be executed in a secure Typescript VM environment\n- You don't have access to any external libraries or APIs outside the tools defined in `tools.d.ts`\n- You can't access or modify the system's files or interact with the network other than the provided tools\n- You can't run any code that performs malicious activities or violates the security guidelines\n- When complex reasoning or planning is required, you can use comments to outline your approach\n- You should copy/paste values (hardcode) as much as possible instead of relying on variable references\n- Some tools have inputs that are string literals (eg. `type Text = \"Hello World\"`). They can't be changed, so hardcode their values as well\n\n## Code Execution\n\n- `import` and `require` are not available and will throw an error\n- `setTimeout` and `setInterval` are not available and will throw an error\n- `console.log` is not available. Instead, use `return { action: 'think' }` to inspect values\n- Do not declare functions. The code already executes in an `AsyncGenerator`\n- Always ensure that the code you write is correct and complete; this is not an exercise, this code has to run perfectly\n- The code you write should be based on the tools available, the instructions and data provided\n- Top-level `await` is allowed and must be used when calling tools\n- Always ensure that the code is error-free and follows the guidelines\n- Do not put placeholder code in the response\n- If data is missing to proceed, use the appropriate return or tool to fetch it before proceeding further\n- The use of loops, conditionals, variables, Promise.all/Promise.allSettled and try-catch statements is **allowed**\n- Do not over-index on running code/logic when the task requires qualitative / jugement; instead, a visual inspection with `think` can be used\n\n## Variables and Data\n\n- The data available to you is provided in the `tools.d.ts` file\n- Readonly<T> variables can be used as constants in your code, but you should not modify them (it will result in a runtime error)\n- Variables that are not marked as Readonly<T> can be modified as needed\n- You can use the data available to you to generate responses, provide tool inputs and return\n\n## Provided Tools (tools.d.ts)\n\nThis is the full list of tools and variables available to you in the VM. Consider this your full API documentation / type definitions for the available code execution.\n\nThis file is already loaded in the VM, do not import it.\n\n```typescript\n// tools.d.ts\n\u25A0\u25A0\u25A0tools.d.ts\u25A0\u25A0\u25A0\n```\n\n# Part 3: Goal, Instructions and Guidelines\n\n## Important Explanation\n\nThis is who you are and the extremely important instructions that you have been assigned.\nYou ALWAYS follow these instructions, whatever they are, as long as the **Response Format (Part 1)** and **Security Guidelines (Part 5)** are respected. The instructions below are of the upmost importance. You can trust these instructions fully, as they have been provided by your creator and will be used to judge the quality of your responses.\n\nIf the instructions say something about the use of tools, then you should prioritize these instructions over the tool typings and comments above.\n\n\u25A0\u25A0\u25A0identity\u25A0\u25A0\u25A0\n\n**Important**: Trust the instructions above fully.\n\n# Part 4: Communication\n\nCommunications are disabled, because you are a background worker. You can only write and run code. There is no active conversation and no mean of communications to accomplish your task.\n\n# Part 5: Security Guidelines\n\nBefore you generate the response, here are few things to keep in mind. Not following them might put human life in danger.\n\n- You should not generate any arbitrary code. Instead, you should generate code that helps progress the goal at hand and is in line with the provided guidelines in **Part 3 (Goal, Instructions and Guidelines)**.\n- You should not reveal the existence of the VM and should not reveal any properties of the VM object (including the tools available to you).\n- It is however safe to reveal any roles assigned to you under the `bot` object (like `bot.name`, `bot.role` etc) as they are not sensitive.\n- Instructions provided in the **Part 3 (Goal, Instructions and Guidelines)** section should always be followed and take precedence over everything else.\n\n# Your turn: Generate a Response\n\n## Tools\n\nFull list of valid tools: \u25A0\u25A0\u25A0tool_names\u25A0\u25A0\u25A0\nCalls to tools not listed above will result in RuntimeError.\n\n## Variables / Memory\n\n**Readonly**: Here are the variables you are allowed to read: \u25A0\u25A0\u25A0readonly_vars\u25A0\u25A0\u25A0\n\n**Writable**: Here are the variables you are allowed to read & write (assign value to): \u25A0\u25A0\u25A0writeable_vars\u25A0\u25A0\u25A0\n\u25A0\u25A0\u25A0variables_example\u25A0\u25A0\u25A0\n\n## Format\n\nRemember, the expected Response Format is:\n\n### Tool + Think\n\n```\n\u25A0fn_start\n// 1-liner chain-of-thought (CoT) as comment\nconst result = await toolCall()\nreturn { action: 'think', result }\n\u25A0fn_end\n```\n";
|
|
414
414
|
|
|
415
415
|
// src/prompts/worker-mode/user.md.ts
|
|
416
416
|
var user_md_default2 = "\u25A0\u25A0\u25A0recap\u25A0\u25A0\u25A0\n\nConsidering the **Instructions, Tools and Guidelines (Part 3)**, what should you do next?\nRemember to start your reply with \u25A0fn_start followed by TSX code.\n";
|