@oh-my-pi/pi-coding-agent 14.9.5 → 14.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/package.json +7 -7
- package/src/cli/setup-cli.ts +14 -161
- package/src/cli/stats-cli.ts +56 -2
- package/src/cli.ts +0 -1
- package/src/config/settings-schema.ts +0 -10
- package/src/eval/eval.lark +30 -10
- package/src/eval/js/context-manager.ts +334 -564
- package/src/eval/js/shared/helpers.ts +237 -0
- package/src/eval/js/shared/indirect-eval.ts +30 -0
- package/src/eval/js/shared/rewrite-imports.ts +211 -0
- package/src/eval/js/shared/runtime.ts +168 -0
- package/src/eval/js/shared/types.ts +18 -0
- package/src/eval/js/tool-bridge.ts +2 -4
- package/src/eval/js/worker-core.ts +146 -0
- package/src/eval/js/worker-entry.ts +24 -0
- package/src/eval/js/worker-protocol.ts +41 -0
- package/src/eval/parse.ts +218 -49
- package/src/eval/py/display.ts +71 -0
- package/src/eval/py/executor.ts +74 -89
- package/src/eval/py/index.ts +1 -2
- package/src/eval/py/kernel.ts +472 -900
- package/src/eval/py/prelude.py +95 -7
- package/src/eval/py/runner.py +879 -0
- package/src/eval/py/runtime.ts +3 -16
- package/src/eval/py/tool-bridge.ts +137 -0
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +93 -5
- package/src/internal-urls/docs-index.generated.ts +3 -3
- package/src/modes/controllers/command-controller.ts +0 -23
- package/src/prompts/tools/eval.md +14 -27
- package/src/session/agent-session.ts +0 -1
- package/src/session/history-storage.ts +77 -19
- package/src/tools/browser/tab-protocol.ts +4 -0
- package/src/tools/browser/tab-supervisor.ts +86 -5
- package/src/tools/browser/tab-worker.ts +104 -58
- package/src/tools/eval.ts +1 -1
- package/src/web/search/index.ts +6 -4
- package/src/cli/jupyter-cli.ts +0 -106
- package/src/commands/jupyter.ts +0 -32
- package/src/eval/py/cancellation.ts +0 -28
- package/src/eval/py/gateway-coordinator.ts +0 -424
- /package/src/eval/js/{prelude.ts → shared/prelude.ts} +0 -0
- /package/src/eval/js/{prelude.txt → shared/prelude.txt} +0 -0
|
@@ -1262,12 +1262,14 @@
|
|
|
1262
1262
|
return html;
|
|
1263
1263
|
}
|
|
1264
1264
|
|
|
1265
|
-
// Parse `***
|
|
1266
|
-
// `===== <info> =====`
|
|
1267
|
-
// before
|
|
1265
|
+
// Parse `*** Cell <attrs>` headers (canonical), plus legacy
|
|
1266
|
+
// `*** Begin <LANG>` headers and `===== <info> =====` bars used in
|
|
1267
|
+
// older transcripts. Cells emitted before each format cutover still
|
|
1268
|
+
// need to render in HTML exports.
|
|
1268
1269
|
function parseEvalCells(input) {
|
|
1269
1270
|
const text = String(input);
|
|
1270
|
-
if (/^[*]{2,}\s*
|
|
1271
|
+
if (/^[*]{2,}\s*Cell\b/im.test(text)) return parseEvalCellsCell(text);
|
|
1272
|
+
if (/^[*]{2,}\s*Begin\b/im.test(text)) return parseEvalCellsBegin(text);
|
|
1271
1273
|
return parseEvalCellsLegacy(text);
|
|
1272
1274
|
}
|
|
1273
1275
|
|
|
@@ -1279,7 +1281,93 @@
|
|
|
1279
1281
|
return null;
|
|
1280
1282
|
}
|
|
1281
1283
|
|
|
1282
|
-
|
|
1284
|
+
// Tokenize a `*** Cell` header attribute list, preserving quoted
|
|
1285
|
+
// segments. Mirrors `tokenizeCellAttrs` in src/eval/parse.ts.
|
|
1286
|
+
function tokenizeCellAttrsHtml(input) {
|
|
1287
|
+
const tokens = [];
|
|
1288
|
+
let i = 0;
|
|
1289
|
+
while (i < input.length) {
|
|
1290
|
+
while (i < input.length && /\s/.test(input[i])) i++;
|
|
1291
|
+
if (i >= input.length) break;
|
|
1292
|
+
let tok = '';
|
|
1293
|
+
while (i < input.length && !/\s/.test(input[i])) {
|
|
1294
|
+
const ch = input[i];
|
|
1295
|
+
if (ch === '"' || ch === "'") {
|
|
1296
|
+
tok += ch; i++;
|
|
1297
|
+
while (i < input.length && input[i] !== ch) { tok += input[i]; i++; }
|
|
1298
|
+
if (i < input.length) { tok += input[i]; i++; }
|
|
1299
|
+
} else { tok += ch; i++; }
|
|
1300
|
+
}
|
|
1301
|
+
tokens.push(tok);
|
|
1302
|
+
}
|
|
1303
|
+
return tokens;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
function parseEvalCellsCell(text) {
|
|
1307
|
+
const STARS = '\\*{2,}';
|
|
1308
|
+
const CELL = new RegExp('^' + STARS + '\\s*Cell\\b\\s*(.*)$', 'i');
|
|
1309
|
+
const END = new RegExp('^' + STARS + '\\s*End\\b.*$', 'i');
|
|
1310
|
+
const ATTR = /^([a-zA-Z][\w-]*)(?::(?:"([^"]*)"|'([^']*)'|(.*)))?$/;
|
|
1311
|
+
const DUR = /^\d+(?:ms|s|m)?$/;
|
|
1312
|
+
const ID_KEYS = ['id', 'title', 'name', 'cell', 'file', 'label'];
|
|
1313
|
+
const T_KEYS = ['t', 'timeout', 'duration', 'time'];
|
|
1314
|
+
const RST_KEYS = ['rst', 'reset'];
|
|
1315
|
+
const lines = text.split('\n');
|
|
1316
|
+
if (lines.length && lines[lines.length - 1] === '') lines.pop();
|
|
1317
|
+
const cells = [];
|
|
1318
|
+
let i = 0;
|
|
1319
|
+
while (i < lines.length && lines[i].trim() === '') i++;
|
|
1320
|
+
while (i < lines.length) {
|
|
1321
|
+
const m = CELL.exec(lines[i]);
|
|
1322
|
+
if (!m) { i++; continue; }
|
|
1323
|
+
const tokens = tokenizeCellAttrsHtml(m[1] || '');
|
|
1324
|
+
let lang = null;
|
|
1325
|
+
let title = '';
|
|
1326
|
+
const attrs = [];
|
|
1327
|
+
let bareReset = false;
|
|
1328
|
+
const titleParts = [];
|
|
1329
|
+
for (const tok of tokens) {
|
|
1330
|
+
const lower = tok.toLowerCase();
|
|
1331
|
+
if (RST_KEYS.indexOf(lower) >= 0) { bareReset = true; continue; }
|
|
1332
|
+
const am = ATTR.exec(tok);
|
|
1333
|
+
if (am && tok.indexOf(':') >= 0) {
|
|
1334
|
+
const key = am[1].toLowerCase();
|
|
1335
|
+
const value = am[2] !== undefined ? am[2] : am[3] !== undefined ? am[3] : (am[4] || '');
|
|
1336
|
+
const lc = evalLangAlias(key);
|
|
1337
|
+
if (lc) {
|
|
1338
|
+
if (!lang) lang = lc;
|
|
1339
|
+
if (!title && value) title = value;
|
|
1340
|
+
continue;
|
|
1341
|
+
}
|
|
1342
|
+
if (ID_KEYS.indexOf(key) >= 0) { if (!title) title = value; continue; }
|
|
1343
|
+
if (T_KEYS.indexOf(key) >= 0) { attrs.push('t=' + value); continue; }
|
|
1344
|
+
if (RST_KEYS.indexOf(key) >= 0) { attrs.push('rst'); continue; }
|
|
1345
|
+
continue;
|
|
1346
|
+
}
|
|
1347
|
+
const lc = evalLangAlias(tok);
|
|
1348
|
+
if (lc && !lang) { lang = lc; continue; }
|
|
1349
|
+
if (DUR.test(tok)) { attrs.push('t=' + tok); continue; }
|
|
1350
|
+
titleParts.push(tok);
|
|
1351
|
+
}
|
|
1352
|
+
if (!title && titleParts.length) title = titleParts.join(' ');
|
|
1353
|
+
if (bareReset) attrs.push('rst');
|
|
1354
|
+
lang = lang || 'py';
|
|
1355
|
+
i++;
|
|
1356
|
+
const codeLines = [];
|
|
1357
|
+
while (i < lines.length) {
|
|
1358
|
+
if (END.test(lines[i])) { i++; break; }
|
|
1359
|
+
if (CELL.test(lines[i])) break;
|
|
1360
|
+
codeLines.push(lines[i]);
|
|
1361
|
+
i++;
|
|
1362
|
+
}
|
|
1363
|
+
while (codeLines.length && codeLines[codeLines.length - 1].trim() === '') codeLines.pop();
|
|
1364
|
+
cells.push({ lang, title, attrs, code: codeLines.join('\n') });
|
|
1365
|
+
while (i < lines.length && lines[i].trim() === '') i++;
|
|
1366
|
+
}
|
|
1367
|
+
return cells;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
function parseEvalCellsBegin(text) {
|
|
1283
1371
|
const STARS = '\\*{2,}';
|
|
1284
1372
|
const BEGIN = new RegExp('^' + STARS + '\\s*Begin\\b\\s*(\\S+)?\\s*$', 'i');
|
|
1285
1373
|
const END = new RegExp('^' + STARS + '\\s*End\\b.*$', 'i');
|