@code-yeongyu/senpi-codemode 2026.11.22 → 2026.11.24
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
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2026.11.24] - 2026-11-24
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
### Removed
|
|
14
|
+
|
|
15
|
+
## [2026.11.23] - 2026-11-23
|
|
16
|
+
|
|
17
|
+
### Breaking Changes
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
### Removed
|
|
26
|
+
|
|
27
|
+
## [2026.11.22-2] - 2026-11-22
|
|
28
|
+
|
|
29
|
+
### Breaking Changes
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- JS eval reports the original line and column for malformed cells when the parser can locate the error ([#7201](https://github.com/code-yeongyu/senpi/pull/7201)).
|
|
38
|
+
|
|
39
|
+
### Removed
|
|
40
|
+
|
|
3
41
|
## [2026.11.22] - 2026-11-22
|
|
4
42
|
|
|
5
43
|
### Breaking Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-yeongyu/senpi-codemode",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.24",
|
|
4
4
|
"description": "Source-only senpi extension package for codemode evaluation tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/parser": "8.0.4",
|
|
36
|
-
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.11.
|
|
37
|
-
"@earendil-works/pi-realm-registry": "npm:@code-yeongyu/senpi-realm-registry@2026.11.
|
|
36
|
+
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.11.24",
|
|
37
|
+
"@earendil-works/pi-realm-registry": "npm:@code-yeongyu/senpi-realm-registry@2026.11.24",
|
|
38
38
|
"quickjs-wasi": "3.6.2",
|
|
39
39
|
"typebox": "1.3.34"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@code-yeongyu/senpi": "2026.11.
|
|
42
|
+
"@code-yeongyu/senpi": "2026.11.24"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@code-yeongyu/senpi": "2026.11.
|
|
45
|
+
"@code-yeongyu/senpi": "2026.11.24"
|
|
46
46
|
},
|
|
47
47
|
"keywords": [
|
|
48
48
|
"senpi",
|
|
@@ -81,7 +81,15 @@ export class JsWorkerRuntime {
|
|
|
81
81
|
const shadowed = [];
|
|
82
82
|
const source = bindKernelBun(wrapUserCode(cellCode, shadowed));
|
|
83
83
|
if (shadowed.length > 0) this.#emitText("stderr", shadowNote(shadowed));
|
|
84
|
-
|
|
84
|
+
let pending;
|
|
85
|
+
try {
|
|
86
|
+
pending = indirectEval(source, sourceName);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
// User code runs inside an async function: its exceptions reject the promise instead.
|
|
89
|
+
if (error instanceof SyntaxError) error.code = "js_cell_parse_error";
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
const value = await awaitMaybePromise(pending);
|
|
85
93
|
await this.#drainPendingDisplays();
|
|
86
94
|
return value;
|
|
87
95
|
} finally {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { parse } from "@babel/parser";
|
|
2
|
+
|
|
3
|
+
/** Only consulted after the kernel fails to compile. Locate the error in submitted, not rewritten, code. */
|
|
4
|
+
export function jsCellParseMessage(code: string, message: string): string {
|
|
5
|
+
try {
|
|
6
|
+
parse(code, { sourceType: "unambiguous", allowReturnOutsideFunction: true, allowAwaitOutsideFunction: true });
|
|
7
|
+
} catch (error) {
|
|
8
|
+
if (!(error instanceof SyntaxError) || !("loc" in error)) return message;
|
|
9
|
+
const loc = error.loc;
|
|
10
|
+
if (
|
|
11
|
+
!loc ||
|
|
12
|
+
typeof loc !== "object" ||
|
|
13
|
+
!("line" in loc) ||
|
|
14
|
+
typeof loc.line !== "number" ||
|
|
15
|
+
!("column" in loc) ||
|
|
16
|
+
typeof loc.column !== "number"
|
|
17
|
+
)
|
|
18
|
+
return message;
|
|
19
|
+
const line = code.split(/\r\n|[\r\n\u2028\u2029]/u)[loc.line - 1] ?? "";
|
|
20
|
+
const start = Math.max(0, loc.column - 60);
|
|
21
|
+
const excerpt = line.slice(start, loc.column + 60);
|
|
22
|
+
const caret = excerpt.slice(0, loc.column - start).replace(/[^\t]/gu, " ");
|
|
23
|
+
const hint =
|
|
24
|
+
/<<-?[ \t]*(['"])[A-Za-z_]\w*\1[ \t]*(?:\r?\n|$)/u.test(code) && code.includes("`")
|
|
25
|
+
? "\nFor a shell heredoc in a JS template literal, escape literal backticks and ${ with a backslash, or use ordinary quoted JS strings."
|
|
26
|
+
: "";
|
|
27
|
+
return `${message}\nJS cell line ${loc.line}, column ${loc.column + 1}:\n${excerpt}\n${caret}^${hint}`;
|
|
28
|
+
}
|
|
29
|
+
return message;
|
|
30
|
+
}
|
|
@@ -22,6 +22,7 @@ import { EvalBackgroundCapacityError, resultAfterDetach, resultForDetachedState
|
|
|
22
22
|
import { buildEvalExecutionEventPayload, type EvalExecutionSettleOutcome } from "./eval-execution-event.ts";
|
|
23
23
|
import { EvalKernelResetRefusedError } from "./eval-kernel-reset-refused-error.ts";
|
|
24
24
|
import { evalTimeoutBehavior } from "./eval-request.ts";
|
|
25
|
+
import { jsCellParseMessage } from "./js-cell-parse-message.ts";
|
|
25
26
|
import type { CreateEvalToolOptions, EvalCellInvocation } from "./eval-tool-options.ts";
|
|
26
27
|
import { describeTimeoutState } from "./interrupt-note.ts";
|
|
27
28
|
import { loadCell } from "./load-cell.ts";
|
|
@@ -319,6 +320,15 @@ async function executeCell(
|
|
|
319
320
|
);
|
|
320
321
|
if (result.ok && state.pendingBridgeCalls.length > 0)
|
|
321
322
|
await execution.wait(Promise.all(state.pendingBridgeCalls));
|
|
323
|
+
if (
|
|
324
|
+
!result.ok &&
|
|
325
|
+
result.error.code === "js_cell_parse_error" &&
|
|
326
|
+
invocation.input.language === "js" &&
|
|
327
|
+
magic.kind === "ordinary"
|
|
328
|
+
) {
|
|
329
|
+
const message = jsCellParseMessage(invocation.input.code, result.error.message);
|
|
330
|
+
return await handler.finalize({ ...result, error: { ...result.error, message } });
|
|
331
|
+
}
|
|
322
332
|
return await handler.finalize(result);
|
|
323
333
|
};
|
|
324
334
|
return kernelTools ? await kernelToolsStorage.run(kernelTools, runBound) : await runBound();
|