@code-yeongyu/senpi-codemode 2026.9.6 → 2026.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 CHANGED
@@ -12,6 +12,18 @@
12
12
 
13
13
  ### Removed
14
14
 
15
+ ## [2026.9.7] - 2026-09-07
16
+
17
+ ### Breaking Changes
18
+
19
+ ### Added
20
+
21
+ ### Changed
22
+
23
+ ### Fixed
24
+
25
+ ### Removed
26
+
15
27
  ## [2026.9.6] - 2026-09-06
16
28
 
17
29
  ### Breaking Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-yeongyu/senpi-codemode",
3
- "version": "2026.9.6",
3
+ "version": "2026.9.7",
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.6",
33
+ "@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.9.7",
34
34
  "typebox": "1.3.18"
35
35
  },
36
36
  "peerDependencies": {
37
- "@code-yeongyu/senpi": "2026.9.6"
37
+ "@code-yeongyu/senpi": "2026.9.7"
38
38
  },
39
39
  "devDependencies": {
40
- "@code-yeongyu/senpi": "2026.9.6"
40
+ "@code-yeongyu/senpi": "2026.9.7"
41
41
  },
42
42
  "keywords": [
43
43
  "senpi",
@@ -1,6 +1,6 @@
1
1
  import { join } from "node:path";
2
2
  import type { BridgeConnectionConfig, KernelToHostMessage } from "../../bridge/protocol.ts";
3
- import { type CodemodeRuntimeAssetEnvironment, resolveCodemodeRuntimeAsset } from "../shared/runtime-asset.ts";
3
+ import { type CodemodeRuntimeAssetEnvironment, requireCodemodeRuntimeAsset } from "../shared/runtime-asset.ts";
4
4
  import { SubprocessKernel, type SubprocessSpawn } from "../shared/subprocess-kernel.ts";
5
5
 
6
6
  export interface JuliaKernelStartOptions {
@@ -17,7 +17,7 @@ export interface JuliaRunnerPathOptions extends CodemodeRuntimeAssetEnvironment
17
17
  }
18
18
 
19
19
  export function resolveJuliaRunnerPath(options: JuliaRunnerPathOptions = {}): string {
20
- return resolveCodemodeRuntimeAsset(
20
+ return requireCodemodeRuntimeAsset(
21
21
  options.localPath ?? join(import.meta.dirname, "runner.jl"),
22
22
  join("kernels", "jl", "runner.jl"),
23
23
  options,
@@ -1,7 +1,7 @@
1
1
  import { dirname, join } from "node:path";
2
2
  import { fileURLToPath, pathToFileURL } from "node:url";
3
3
  import type { HostToKernelMessage, KernelToHostMessage } from "../../bridge/protocol.ts";
4
- import { type CodemodeRuntimeAssetEnvironment, resolveCodemodeRuntimeAsset } from "../shared/runtime-asset.ts";
4
+ import { type CodemodeRuntimeAssetEnvironment, requireCodemodeRuntimeAsset } from "../shared/runtime-asset.ts";
5
5
  import type { JavaScriptKernelMode } from "./kernel-contract.ts";
6
6
  import { spawnNodeWorker } from "./worker-host.ts";
7
7
 
@@ -12,7 +12,7 @@ export interface JavaScriptInlineWorkerEntryUrlOptions extends CodemodeRuntimeAs
12
12
  export function resolveInlineWorkerEntryUrl(options: JavaScriptInlineWorkerEntryUrlOptions = {}): URL {
13
13
  const localPath = options.localPath ?? join(dirname(fileURLToPath(import.meta.url)), "inline-worker-entry.js");
14
14
  return pathToFileURL(
15
- resolveCodemodeRuntimeAsset(localPath, join("kernels", "js", "inline-worker-entry.js"), options),
15
+ requireCodemodeRuntimeAsset(localPath, join("kernels", "js", "inline-worker-entry.js"), options),
16
16
  );
17
17
  }
18
18
 
@@ -1,6 +1,6 @@
1
1
  import { dirname, join } from "node:path";
2
2
  import { fileURLToPath, pathToFileURL } from "node:url";
3
- import { type CodemodeRuntimeAssetEnvironment, resolveCodemodeRuntimeAsset } from "../shared/runtime-asset.ts";
3
+ import { type CodemodeRuntimeAssetEnvironment, requireCodemodeRuntimeAsset } from "../shared/runtime-asset.ts";
4
4
  import { createInlineWorker, type WorkerLike } from "./inline-worker.ts";
5
5
  import { type JavaScriptKernelOptions, localBridgeConnection } from "./local-module-loader.ts";
6
6
  import { spawnNodeWorker, WorkerStartupCancelledError, waitForReady } from "./worker-host.ts";
@@ -11,7 +11,7 @@ export interface JavaScriptWorkerEntryUrlOptions extends CodemodeRuntimeAssetEnv
11
11
 
12
12
  export function resolveJsWorkerEntryUrl(options: JavaScriptWorkerEntryUrlOptions = {}): URL {
13
13
  const localPath = options.localPath ?? join(dirname(fileURLToPath(import.meta.url)), "worker-entry.js");
14
- return pathToFileURL(resolveCodemodeRuntimeAsset(localPath, join("kernels", "js", "worker-entry.js"), options));
14
+ return pathToFileURL(requireCodemodeRuntimeAsset(localPath, join("kernels", "js", "worker-entry.js"), options));
15
15
  }
16
16
 
17
17
  export interface WorkerStartupHooks {
@@ -8,7 +8,7 @@ import {
8
8
  isKernelToHostMessage,
9
9
  type KernelToHostMessage,
10
10
  } from "../../bridge/protocol.ts";
11
- import { type CodemodeRuntimeAssetEnvironment, resolveCodemodeRuntimeAsset } from "../shared/runtime-asset.ts";
11
+ import { type CodemodeRuntimeAssetEnvironment, requireCodemodeRuntimeAsset } from "../shared/runtime-asset.ts";
12
12
  import {
13
13
  defaultSpawn,
14
14
  hardKill,
@@ -53,7 +53,7 @@ export interface PythonPreludePathOptions extends CodemodeRuntimeAssetEnvironmen
53
53
  }
54
54
 
55
55
  export function resolvePythonPreludePath(options: PythonPreludePathOptions = {}): string {
56
- return resolveCodemodeRuntimeAsset(
56
+ return requireCodemodeRuntimeAsset(
57
57
  options.localPath ?? join(dirname(fileURLToPath(import.meta.url)), "prelude.py"),
58
58
  join("kernels", "py", "prelude.py"),
59
59
  options,
@@ -1,6 +1,6 @@
1
1
  import { join } from "node:path";
2
2
  import type { BridgeConnectionConfig, KernelToHostMessage } from "../../bridge/protocol.ts";
3
- import { type CodemodeRuntimeAssetEnvironment, resolveCodemodeRuntimeAsset } from "../shared/runtime-asset.ts";
3
+ import { type CodemodeRuntimeAssetEnvironment, requireCodemodeRuntimeAsset } from "../shared/runtime-asset.ts";
4
4
  import { SubprocessKernel, type SubprocessSpawn } from "../shared/subprocess-kernel.ts";
5
5
 
6
6
  export interface RubyKernelStartOptions {
@@ -17,7 +17,7 @@ export interface RubyRunnerPathOptions extends CodemodeRuntimeAssetEnvironment {
17
17
  }
18
18
 
19
19
  export function resolveRubyRunnerPath(options: RubyRunnerPathOptions = {}): string {
20
- return resolveCodemodeRuntimeAsset(
20
+ return requireCodemodeRuntimeAsset(
21
21
  options.localPath ?? join(import.meta.dirname, "runner.rb"),
22
22
  join("kernels", "rb", "runner.rb"),
23
23
  options,
@@ -6,26 +6,52 @@ export interface CodemodeRuntimeAssetEnvironment {
6
6
  readonly executablePath?: string;
7
7
  }
8
8
 
9
+ export class CodemodeRuntimeAssetMissingError extends Error {
10
+ readonly packageRelativePath: string;
11
+ readonly localPath: string;
12
+ readonly sidecarPath: string;
13
+ readonly executablePath: string;
14
+
15
+ constructor(packageRelativePath: string, localPath: string, sidecarPath: string, executablePath: string) {
16
+ super(
17
+ `codemode runtime asset ${packageRelativePath} is unavailable: module-relative path ${localPath} is not readable and the codemode sidecar is missing beside the executable ${executablePath} (expected ${sidecarPath}). Ship node_modules/@code-yeongyu/senpi-codemode next to the executable.`,
18
+ );
19
+ this.name = "CodemodeRuntimeAssetMissingError";
20
+ this.packageRelativePath = packageRelativePath;
21
+ this.localPath = localPath;
22
+ this.sidecarPath = sidecarPath;
23
+ this.executablePath = executablePath;
24
+ }
25
+ }
26
+
27
+ export function isBunVirtualPath(path: string): boolean {
28
+ return path.includes("/$bunfs/") || path.includes("~BUN") || path.includes("%7EBUN");
29
+ }
30
+
31
+ function sidecarPathFor(packageRelativePath: string, executablePath: string): string {
32
+ return join(dirname(executablePath), "node_modules", "@code-yeongyu", "senpi-codemode", "src", packageRelativePath);
33
+ }
34
+
35
+ export function requireCodemodeRuntimeAsset(
36
+ localPath: string,
37
+ packageRelativePath: string,
38
+ { executablePath = process.execPath }: CodemodeRuntimeAssetEnvironment = {},
39
+ ): string {
40
+ const sidecarPath = sidecarPathFor(packageRelativePath, executablePath);
41
+ if (!isBunVirtualPath(localPath) && existsSync(localPath)) return localPath;
42
+ if (existsSync(sidecarPath)) return sidecarPath;
43
+ throw new CodemodeRuntimeAssetMissingError(packageRelativePath, localPath, sidecarPath, executablePath);
44
+ }
45
+
9
46
  export function resolveCodemodeRuntimeAsset(
10
47
  localPath: string,
11
48
  packageRelativePath: string,
12
49
  { bunVersion = process.versions.bun, executablePath = process.execPath }: CodemodeRuntimeAssetEnvironment = {},
13
50
  ): string {
14
- if (existsSync(localPath)) {
15
- return localPath;
16
- }
51
+ if (existsSync(localPath)) return localPath;
17
52
  if (bunVersion) {
18
- const sidecarPath = join(
19
- dirname(executablePath),
20
- "node_modules",
21
- "@code-yeongyu",
22
- "senpi-codemode",
23
- "src",
24
- packageRelativePath,
25
- );
26
- if (existsSync(sidecarPath)) {
27
- return sidecarPath;
28
- }
53
+ const sidecarPath = sidecarPathFor(packageRelativePath, executablePath);
54
+ if (existsSync(sidecarPath)) return sidecarPath;
29
55
  }
30
56
  return localPath;
31
57
  }