@code-yeongyu/senpi-codemode 2026.8.31 → 2026.9.2-4

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
@@ -12,6 +12,63 @@
12
12
 
13
13
  ### Removed
14
14
 
15
+ ## [2026.9.2-4] - 2026-09-02
16
+
17
+ ### Breaking Changes
18
+
19
+ ### Added
20
+
21
+ ### Changed
22
+
23
+ ### Fixed
24
+
25
+ ### Removed
26
+
27
+ ## [2026.9.2-3] - 2026-09-02
28
+
29
+ ### Breaking Changes
30
+
31
+ ### Added
32
+
33
+ ### Changed
34
+
35
+ - The eval prompt's JS runtime line is now runtime-aware: on a bun kernel it names `Bun <version>` and
36
+ `Bun.*` builtins, and only while the bundled `bun-1-4` skill is active it adds a MUST READ pointer to
37
+ that skill's absolute path before the first js cell; node kernels keep the Node.js worker wording.
38
+ `activeBunSkillPath()` exposes the same gate the `resources_discover` contribution uses.
39
+ - The bundled `bun-1-4` skill description is rewritten as a fact-framed MUST READ notice with
40
+ English-only copy (Korean trigger words removed; the `Bun.stringWidth` example no longer uses Hangul).
41
+
42
+ ### Fixed
43
+
44
+ - 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.
45
+
46
+ ### Removed
47
+
48
+ ## [2026.9.2-2] - 2026-09-02
49
+
50
+ ### Breaking Changes
51
+
52
+ ### Added
53
+
54
+ ### Changed
55
+
56
+ ### Fixed
57
+
58
+ ### Removed
59
+
60
+ ## [2026.9.2] - 2026-09-02
61
+
62
+ ### Breaking Changes
63
+
64
+ ### Added
65
+
66
+ ### Changed
67
+
68
+ ### Fixed
69
+
70
+ ### Removed
71
+
15
72
  ## [2026.8.31] - 2026-08-31
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 worker.
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 | Node.js worker | Requires Node.js 24 or newer; supports top-level `await` and `return`. |
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.8.31",
3
+ "version": "2026.9.2-4",
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.8.31",
33
+ "@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.9.2-4",
34
34
  "typebox": "1.3.18"
35
35
  },
36
36
  "peerDependencies": {
37
- "@code-yeongyu/senpi": "2026.8.31"
37
+ "@code-yeongyu/senpi": "2026.9.2-4"
38
38
  },
39
39
  "devDependencies": {
40
- "@code-yeongyu/senpi": "2026.8.31"
40
+ "@code-yeongyu/senpi": "2026.9.2-4"
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
- /** Absolute path of the bundled bun-1-4 SKILL.md, or undefined (logged once) when it is not shipped. */
31
- export function bundledBunSkillPath(baseDir: string = BUN_SKILL_BASE_DIR): string | undefined {
32
- const candidate = join(baseDir, "..", "skill", "bun-1-4", "SKILL.md");
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
- console.debug(`[senpi-codemode] bundled bun-1-4 skill not found at ${candidate}; skipping contribution`);
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
- * Builds the `resources_discover` handler that contributes the bundled bun-1-4 skill
43
- * only when the in-process js eval kernel itself runs bun >= 1.4 (`process.versions.bun`).
44
- * A node kernel never receives the skill, regardless of any bun binary on PATH.
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
- if (!bunVersionSupportsSkill(getKernelBunVersion())) return undefined;
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 USE whenever writing or running JavaScript/TypeScript with Bun including JS through the eval tool, bun -e one-liners, scratch scripts, servers, CLIs, tests, bundling, or package management. Bun 1.4 replaced 15+ npm deps with builtins: consult BEFORE npm-installing sharp, puppeteer/playwright (scraping), marked, node-cron, node-pty, concurrently, serve-static, tar, json5, fast-xml-parser, string-width — Bun ships it. Triggers: bun, Bun.serve, bun test, bun build, bun install, bun run, JS 스크립트, 번들링, 이미지 리사이즈, 헤드리스 브라우저, 크론, PTY, eval js."
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("한글 text"); // terminal columns, ANSI + grapheme aware
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 {
@@ -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 =