@code-yeongyu/senpi-codemode 2026.9.2 → 2026.9.3
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 +57 -0
- package/README.md +4 -2
- package/package.json +4 -4
- package/src/extension/skill-contribution.ts +43 -9
- package/src/index.ts +4 -1
- package/src/prompt/eval-prompt.ts +10 -1
- package/src/skill/bun-1-4/SKILL.md +1 -1
- package/src/skill/bun-1-4/references/runtime-apis.md +1 -1
- package/src/tool/eval-tool-options.ts +3 -1
- package/src/tool/eval-tool.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,63 @@
|
|
|
12
12
|
|
|
13
13
|
### Removed
|
|
14
14
|
|
|
15
|
+
## [2026.9.3] - 2026-09-03
|
|
16
|
+
|
|
17
|
+
### Breaking Changes
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
### Removed
|
|
26
|
+
|
|
27
|
+
## [2026.9.2-4] - 2026-09-02
|
|
28
|
+
|
|
29
|
+
### Breaking Changes
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
### Removed
|
|
38
|
+
|
|
39
|
+
## [2026.9.2-3] - 2026-09-02
|
|
40
|
+
|
|
41
|
+
### Breaking Changes
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- The eval prompt's JS runtime line is now runtime-aware: on a bun kernel it names `Bun <version>` and
|
|
48
|
+
`Bun.*` builtins, and only while the bundled `bun-1-4` skill is active it adds a MUST READ pointer to
|
|
49
|
+
that skill's absolute path before the first js cell; node kernels keep the Node.js worker wording.
|
|
50
|
+
`activeBunSkillPath()` exposes the same gate the `resources_discover` contribution uses.
|
|
51
|
+
- The bundled `bun-1-4` skill description is rewritten as a fact-framed MUST READ notice with
|
|
52
|
+
English-only copy (Korean trigger words removed; the `Bun.stringWidth` example no longer uses Hangul).
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
- Compiled binaries now contribute the bundled `bun-1-4` skill by resolving the codemode sidecar shipped next to the executable, and a missing skill is reported on stderr so it can no longer corrupt the RPC protocol stream on stdout.
|
|
57
|
+
|
|
58
|
+
### Removed
|
|
59
|
+
|
|
60
|
+
## [2026.9.2-2] - 2026-09-02
|
|
61
|
+
|
|
62
|
+
### Breaking Changes
|
|
63
|
+
|
|
64
|
+
### Added
|
|
65
|
+
|
|
66
|
+
### Changed
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
|
|
70
|
+
### Removed
|
|
71
|
+
|
|
15
72
|
## [2026.9.2] - 2026-09-02
|
|
16
73
|
|
|
17
74
|
### Breaking Changes
|
package/README.md
CHANGED
|
@@ -36,7 +36,9 @@ task-tool names are known.
|
|
|
36
36
|
resolves absolute executable paths, and the eval prompt host line names the
|
|
37
37
|
JS runtime (`node`/`bun`).
|
|
38
38
|
- JavaScript import rewriting for supported local modules and package imports
|
|
39
|
-
in the persistent Node.js
|
|
39
|
+
in the persistent JS worker (Bun when senpi runs on bun, Node.js otherwise).
|
|
40
|
+
- On a Bun >= 1.4 kernel the eval prompt names the bundled `bun-1-4` skill as
|
|
41
|
+
MUST READ before the first js cell; node kernels keep the Node.js wording.
|
|
40
42
|
- GPT models receive a terse `eval` prompt dialect that prioritizes composing
|
|
41
43
|
active tools through `tool.<name>(args)` and documents detach-on-timeout.
|
|
42
44
|
|
|
@@ -44,7 +46,7 @@ task-tool names are known.
|
|
|
44
46
|
|
|
45
47
|
| Language | Default | Runtime | Notes |
|
|
46
48
|
| --- | --- | --- | --- |
|
|
47
|
-
| `js` | enabled |
|
|
49
|
+
| `js` | enabled | In-process worker on senpi's own runtime (Bun or Node.js 24+) | Supports top-level `await` and `return`; the eval prompt's runtime line follows the kernel. |
|
|
48
50
|
| `py` | enabled | `python3` or `python` | Optional interpreter detected at session start. |
|
|
49
51
|
| `rb` | disabled | `ruby` | Optional interpreter detected at session start. |
|
|
50
52
|
| `jl` | disabled | `julia` | Optional interpreter detected at session start. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-yeongyu/senpi-codemode",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.3",
|
|
4
4
|
"description": "Source-only senpi extension package for codemode evaluation tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/parser": "8.0.4",
|
|
33
|
-
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.9.
|
|
33
|
+
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.9.3",
|
|
34
34
|
"typebox": "1.3.18"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@code-yeongyu/senpi": "2026.9.
|
|
37
|
+
"@code-yeongyu/senpi": "2026.9.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@code-yeongyu/senpi": "2026.9.
|
|
40
|
+
"@code-yeongyu/senpi": "2026.9.3"
|
|
41
41
|
},
|
|
42
42
|
"keywords": [
|
|
43
43
|
"senpi",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { type CodemodeRuntimeAssetEnvironment, resolveCodemodeRuntimeAsset } from "../kernels/shared/runtime-asset.ts";
|
|
4
5
|
|
|
5
6
|
const BUN_SKILL_BASE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
6
7
|
|
|
@@ -27,29 +28,62 @@ export function bunVersionSupportsSkill(version: string | undefined): boolean {
|
|
|
27
28
|
return major > 1 || (major === 1 && minor >= 4);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const BUN_SKILL_PACKAGE_RELATIVE_PATH = join("skill", "bun-1-4", "SKILL.md");
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Absolute path of the bundled bun-1-4 SKILL.md, or undefined (logged once) when it is not shipped.
|
|
35
|
+
*
|
|
36
|
+
* A compiled Bun binary has no readable module-relative asset, so resolution falls back to the
|
|
37
|
+
* codemode sidecar shipped next to the executable, exactly as the Ruby and Julia kernel runners do.
|
|
38
|
+
* The miss is reported on stderr because stdout carries the RPC protocol stream.
|
|
39
|
+
*/
|
|
40
|
+
export function bundledBunSkillPath(
|
|
41
|
+
baseDir: string = BUN_SKILL_BASE_DIR,
|
|
42
|
+
environment: CodemodeRuntimeAssetEnvironment = {},
|
|
43
|
+
): string | undefined {
|
|
44
|
+
const localPath = join(baseDir, "..", "skill", "bun-1-4", "SKILL.md");
|
|
45
|
+
const candidate = resolveCodemodeRuntimeAsset(localPath, BUN_SKILL_PACKAGE_RELATIVE_PATH, environment);
|
|
33
46
|
if (existsSync(candidate)) return candidate;
|
|
34
47
|
if (!loggedMissingBunSkill) {
|
|
35
48
|
loggedMissingBunSkill = true;
|
|
36
|
-
|
|
49
|
+
// A compiled binary never has the module-relative asset, so naming only that path
|
|
50
|
+
// would hide the sidecar location an operator actually has to populate.
|
|
51
|
+
const executableDir = dirname(environment.executablePath ?? process.execPath);
|
|
52
|
+
const sidecarPath = join(
|
|
53
|
+
executableDir,
|
|
54
|
+
"node_modules",
|
|
55
|
+
"@code-yeongyu",
|
|
56
|
+
"senpi-codemode",
|
|
57
|
+
"src",
|
|
58
|
+
BUN_SKILL_PACKAGE_RELATIVE_PATH,
|
|
59
|
+
);
|
|
60
|
+
console.error(
|
|
61
|
+
`[senpi-codemode] bundled bun-1-4 skill not found at ${localPath} or ${sidecarPath}; skipping contribution`,
|
|
62
|
+
);
|
|
37
63
|
}
|
|
38
64
|
return undefined;
|
|
39
65
|
}
|
|
40
66
|
|
|
41
67
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* A node kernel never
|
|
68
|
+
* Absolute path of the bundled bun-1-4 SKILL.md when it is active for this process:
|
|
69
|
+
* the in-process js eval kernel itself runs bun >= 1.4 (`process.versions.bun`) and the
|
|
70
|
+
* asset is shipped. A node kernel never activates it, regardless of any bun binary on PATH.
|
|
45
71
|
*/
|
|
72
|
+
export function activeBunSkillPath(
|
|
73
|
+
getKernelBunVersion: BunKernelVersionSource = kernelBunVersion,
|
|
74
|
+
baseDir?: string,
|
|
75
|
+
): string | undefined {
|
|
76
|
+
if (!bunVersionSupportsSkill(getKernelBunVersion())) return undefined;
|
|
77
|
+
return bundledBunSkillPath(baseDir);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Builds the `resources_discover` handler that contributes the active bun-1-4 skill, if any. */
|
|
46
81
|
export function createBunSkillDiscoverHandler(
|
|
47
82
|
getKernelBunVersion: BunKernelVersionSource = kernelBunVersion,
|
|
48
83
|
baseDir?: string,
|
|
49
84
|
): () => { skillPaths: string[] } | undefined {
|
|
50
85
|
return () => {
|
|
51
|
-
|
|
52
|
-
const skillPath = bundledBunSkillPath(baseDir);
|
|
86
|
+
const skillPath = activeBunSkillPath(getKernelBunVersion, baseDir);
|
|
53
87
|
return skillPath === undefined ? undefined : { skillPaths: [skillPath] };
|
|
54
88
|
};
|
|
55
89
|
}
|
package/src/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import { jsRuntimeInfo, jsRuntimeLabel } from "./extension/runtime-info.ts";
|
|
17
17
|
import type { CodemodeSessionManager, CreateCodemodeSessionManagerOptions } from "./extension/session-manager.ts";
|
|
18
18
|
import { SessionManagerProxy } from "./extension/session-manager-proxy.ts";
|
|
19
|
-
import { registerBunSkillContribution } from "./extension/skill-contribution.ts";
|
|
19
|
+
import { activeBunSkillPath, registerBunSkillContribution } from "./extension/skill-contribution.ts";
|
|
20
20
|
import { WAKE_SOURCE_STATE_EVENT, type WakeSourceState } from "./extension/wake-source-state.ts";
|
|
21
21
|
import { EvalDetachedCellManager, type EvalDetachedCellStatusEntry } from "./tool/detached-cell-manager.ts";
|
|
22
22
|
import {
|
|
@@ -68,6 +68,7 @@ export default function senpiCodemode(pi: CodemodeExtensionAPI, options: SenpiCo
|
|
|
68
68
|
const manager = new SessionManagerProxy();
|
|
69
69
|
const complete = options.complete ?? ((request, ctx) => createCompletionHandler()(ctx)(request));
|
|
70
70
|
const renderers = { renderCall: renderEvalCall, renderResult: renderEvalResult };
|
|
71
|
+
const bunSkillPath = activeBunSkillPath();
|
|
71
72
|
let activeRuntime: SessionRuntime | undefined;
|
|
72
73
|
let activeModelId: string | undefined;
|
|
73
74
|
let activeContext: ExtensionContext | undefined;
|
|
@@ -125,6 +126,7 @@ export default function senpiCodemode(pi: CodemodeExtensionAPI, options: SenpiCo
|
|
|
125
126
|
spawnDefaultAgent: runtime.settings.taskTools.task,
|
|
126
127
|
hostLine: hostLine(),
|
|
127
128
|
runtimes: runtime.runtimes,
|
|
129
|
+
...(bunSkillPath === undefined ? {} : { bunSkillPath }),
|
|
128
130
|
...(modelId === undefined ? {} : { modelId }),
|
|
129
131
|
}),
|
|
130
132
|
);
|
|
@@ -159,6 +161,7 @@ export default function senpiCodemode(pi: CodemodeExtensionAPI, options: SenpiCo
|
|
|
159
161
|
renderers,
|
|
160
162
|
hostLine: hostLine(),
|
|
161
163
|
runtimes: { js: jsRuntimeInfo() },
|
|
164
|
+
...(bunSkillPath === undefined ? {} : { bunSkillPath }),
|
|
162
165
|
}),
|
|
163
166
|
);
|
|
164
167
|
pi.registerRemovedToolHint(
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { EvalRuntimeInfo } from "../tool/types.ts";
|
|
2
|
+
|
|
1
3
|
export interface EnabledLanguages {
|
|
2
4
|
readonly py: boolean;
|
|
3
5
|
readonly js: boolean;
|
|
@@ -18,6 +20,10 @@ export interface EvalPromptOptions {
|
|
|
18
20
|
readonly modelId?: string;
|
|
19
21
|
/** Preformatted host line (e.g. "darwin arm64 · Apple M5 Max · 18 cores"); enables the host-sizing note. */
|
|
20
22
|
readonly hostLine?: string;
|
|
23
|
+
/** Identity of the in-process js kernel; a bun runtime swaps the Node.js worker line for the Bun one. */
|
|
24
|
+
readonly jsRuntime?: EvalRuntimeInfo;
|
|
25
|
+
/** Absolute path of the active bun-1-4 skill; rendered as a MUST READ pointer only on a bun kernel. */
|
|
26
|
+
readonly bunSkillPath?: string;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
/** Prompt dialect for the eval-first batching emphasis. */
|
|
@@ -132,7 +138,7 @@ Fields:
|
|
|
132
138
|
A detached cell keeps its language kernel busy while it finishes; another language can continue. Do not re-run a detached cell: the same-language busy error names its cell id and output tail. Completion arrives as one notification with the final value/error and buffered output. Stopping a cell interrupts its kernel; the stop result states whether kernel state survived or the kernel was restarted and its variables lost.
|
|
133
139
|
|
|
134
140
|
{{#if py}}Live event loop: use top-level \`await\` directly; \`asyncio.run(…)\` raises "cannot be called from a running event loop".{{/if}}
|
|
135
|
-
{{#if js}}JS runs under Node.js worker: top-level \`await\`/\`return\` work; \`fetch\`/\`Buffer\` available.{{/if}}
|
|
141
|
+
{{#if js}}{{#if jsBun}}JS runs in-process on Bun {{jsVersion}}: top-level \`await\`/\`return\` work; \`Bun.*\` builtins available.{{#if bunSkillPath}} MUST READ the bun-1-4 skill at {{bunSkillPath}} before your first js cell — its builtins replace the npm packages you would otherwise install.{{/if}}{{else}}JS runs under Node.js worker: top-level \`await\`/\`return\` work; \`fetch\`/\`Buffer\` available.{{/if}}{{/if}}
|
|
136
142
|
{{#if rb}}Ruby: synchronous; helper options are keyword args{{#if spawns}} (e.g. \`output("id", limit: 2)\`){{/if}}; the last expression auto-displays unless it is \`nil\`, an assignment, or a definition (like IRB).{{/if}}
|
|
137
143
|
{{#if jl}}Julia: synchronous; helper options are standard keyword args{{#if spawns}} (e.g. \`output("id", limit=2)\`){{/if}}; the last expression auto-displays unless it is an assignment or a definition (like the Julia REPL).{{/if}}
|
|
138
144
|
On error, fix and re-run only the failing step. State usually survives a normal error, but a timeout or stop may have restarted the kernel — its message says which. Before rebuilding state, check a sentinel (a variable you defined earlier); only re-establish what is actually gone, since blind re-runs duplicate side effects.
|
|
@@ -212,6 +218,9 @@ export function buildEvalPrompt(
|
|
|
212
218
|
styleKimi: style === "kimi",
|
|
213
219
|
styleDefault: style === "default",
|
|
214
220
|
hostLine: options.hostLine ?? "",
|
|
221
|
+
jsBun: options.jsRuntime?.name === "bun",
|
|
222
|
+
jsVersion: options.jsRuntime?.version ?? "",
|
|
223
|
+
bunSkillPath: options.bunSkillPath ?? "",
|
|
215
224
|
};
|
|
216
225
|
const examples = REUSE_CHAIN_EXAMPLES.filter((example) => enabled[example.language])
|
|
217
226
|
.map((example) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: bun-1-4
|
|
3
|
-
description: "MUST
|
|
3
|
+
description: "MUST READ before your first js eval cell: this session's eval js kernel runs Bun 1.4+ (this skill is present only when it does). Also read before any bun -e, script, server, CLI, test, bundle, or package-management work. Bun 1.4 ships builtins that replace 15+ npm deps — check here BEFORE installing sharp, puppeteer/playwright (scraping), marked, node-cron, node-pty, concurrently, serve-static, tar, json5, fast-xml-parser, string-width. Triggers: eval js, bun, Bun.serve, bun test, bun build, bun install, bun run, image resize, headless browser, markdown render, cron, PTY."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Bun 1.4 — Use the Builtins First
|
|
@@ -139,7 +139,7 @@ Blog: [#also-built-in](https://bun.com/blog/bun-v1.4#also-built-in)
|
|
|
139
139
|
Docs: <https://bun.com/docs/runtime/utils>
|
|
140
140
|
|
|
141
141
|
```ts
|
|
142
|
-
Bun.stringWidth("
|
|
142
|
+
Bun.stringWidth("\x1b[32mgreen\x1b[0m e\u0301"); // terminal columns, ANSI + grapheme aware
|
|
143
143
|
Bun.sliceAnsi(str, 0, 20); // slice by columns, preserving ANSI codes
|
|
144
144
|
Bun.wrapAnsi(str, 80); // wrap by columns
|
|
145
145
|
```
|
|
@@ -39,8 +39,10 @@ export interface CreateEvalToolOptions {
|
|
|
39
39
|
readonly spawnDefaultAgent?: string;
|
|
40
40
|
readonly modelId?: string;
|
|
41
41
|
readonly hostLine?: string;
|
|
42
|
-
/** Display identity of each language's runtime, shown in headers and details. */
|
|
42
|
+
/** Display identity of each language's runtime, shown in headers and details; `js` also selects the prompt's runtime line. */
|
|
43
43
|
readonly runtimes?: EvalRuntimes;
|
|
44
|
+
/** Absolute path of the active bun-1-4 skill; the prompt names it as MUST READ on a bun kernel. */
|
|
45
|
+
readonly bunSkillPath?: string;
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
export interface EvalCellInvocation {
|
package/src/tool/eval-tool.ts
CHANGED
|
@@ -31,6 +31,8 @@ export function createEvalTool(options: CreateEvalToolOptions): ToolDefinition<E
|
|
|
31
31
|
...(options.spawnDefaultAgent === undefined ? {} : { spawnDefaultAgent: options.spawnDefaultAgent }),
|
|
32
32
|
...(options.modelId === undefined ? {} : { modelId: options.modelId }),
|
|
33
33
|
...(options.hostLine === undefined ? {} : { hostLine: options.hostLine }),
|
|
34
|
+
...(options.runtimes?.js === undefined ? {} : { jsRuntime: options.runtimes.js }),
|
|
35
|
+
...(options.bunSkillPath === undefined ? {} : { bunSkillPath: options.bunSkillPath }),
|
|
34
36
|
});
|
|
35
37
|
const languages = enabledLanguageList(options.enabledLanguages);
|
|
36
38
|
const cellManager =
|