@akanjs/code 0.0.0 → 3.3.0-rc.71

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.
Files changed (109) hide show
  1. package/README.ko.md +31 -0
  2. package/README.md +26 -4
  3. package/agent/AkanCodeCompaction.ts +49 -0
  4. package/agent/AkanCodeServices.ts +122 -0
  5. package/agent/AkanContextFiles.ts +94 -0
  6. package/agent/CodeAgent.ts +598 -0
  7. package/agent/CodeAgentAllowed.ts +35 -0
  8. package/agent/CodeAgentAsks.ts +66 -0
  9. package/agent/CodeAgentCommandLine.ts +372 -0
  10. package/agent/CodeAgentEventMapper.ts +225 -0
  11. package/agent/CodeAgentFrames.ts +57 -0
  12. package/agent/CodeAgentGate.ts +258 -0
  13. package/agent/CodeAgentProxy.ts +83 -0
  14. package/agent/CodeAgentRpcHost.ts +109 -0
  15. package/agent/CodeAgentRpcListener.ts +195 -0
  16. package/agent/CodeAgentStreamPrinter.ts +86 -0
  17. package/agent/CodeAgentSuspended.ts +85 -0
  18. package/agent/CodeAgentUi.ts +47 -0
  19. package/agent/CodeMailbox.ts +148 -0
  20. package/agent/CodeSessionFork.ts +56 -0
  21. package/agent/CodeSessionIndex.ts +78 -0
  22. package/agent/SubagentPool.ts +222 -0
  23. package/agent/WorkspaceTrust.ts +200 -0
  24. package/agent/akanCodeCompaction.test.ts +36 -0
  25. package/agent/akanCodeModel.ts +47 -0
  26. package/agent/akanCodeServices.test.ts +54 -0
  27. package/agent/akanContextFiles.test.ts +116 -0
  28. package/agent/akanSystemPrompt.ts +50 -0
  29. package/agent/codeAgent.test.ts +337 -0
  30. package/agent/codeAgentCommandLine.test.ts +212 -0
  31. package/agent/codeAgentContract.test.ts +757 -0
  32. package/agent/codeAgentHosts.ts +30 -0
  33. package/agent/codeAgentProxy.test.ts +125 -0
  34. package/agent/codeAgentRpcListener.test.ts +215 -0
  35. package/agent/codeAgentSuspended.test.ts +47 -0
  36. package/agent/codeMailbox.test.ts +76 -0
  37. package/agent/codeSessionFork.test.ts +58 -0
  38. package/agent/codeSessionIndex.test.ts +77 -0
  39. package/agent/consoleToStderr.ts +8 -0
  40. package/agent/jsonLines.ts +29 -0
  41. package/agent/stringArg.ts +5 -0
  42. package/bunfig.toml +2 -0
  43. package/feedback/DevLogFeedback.ts +82 -0
  44. package/feedback/PreviewFeedback.ts +46 -0
  45. package/feedback/TurnFeedback.ts +98 -0
  46. package/feedback/VerifyFeedback.ts +39 -0
  47. package/host/AkanCodeRunner.ts +297 -0
  48. package/host/CodeTrustPrompt.ts +57 -0
  49. package/host/codeRunnerPrompt.test.ts +181 -0
  50. package/host/hostGraph.test.ts +33 -0
  51. package/host/index.ts +2 -0
  52. package/index.ts +49 -0
  53. package/package.json +43 -9
  54. package/piDependencyPins.test.ts +45 -0
  55. package/test/preload.ts +3 -0
  56. package/tools/AkanCli.ts +56 -0
  57. package/tools/AkanCodePlugins.ts +145 -0
  58. package/tools/AkanEditScope.ts +53 -0
  59. package/tools/AkanEnvKeys.ts +50 -0
  60. package/tools/AkanToolPack.ts +87 -0
  61. package/tools/AkanVerifier.ts +30 -0
  62. package/tools/AskToolPack.ts +99 -0
  63. package/tools/DeepSeekWeb.ts +127 -0
  64. package/tools/MailToolPack.ts +76 -0
  65. package/tools/McpClient.ts +209 -0
  66. package/tools/McpOAuth.ts +233 -0
  67. package/tools/McpOAuthLoopback.ts +64 -0
  68. package/tools/McpServerConfig.ts +131 -0
  69. package/tools/McpSignIn.ts +158 -0
  70. package/tools/McpTokenStore.ts +128 -0
  71. package/tools/McpToolPack.ts +206 -0
  72. package/tools/SessionToolPack.ts +91 -0
  73. package/tools/WebToolPack.ts +315 -0
  74. package/tools/akanCodePlugins.test.ts +954 -0
  75. package/tools/askToolPack.test.ts +116 -0
  76. package/tools/deepSeekWeb.test.ts +113 -0
  77. package/tools/mcpOAuth.test.ts +648 -0
  78. package/tools/mcpServerConfig.test.ts +341 -0
  79. package/tsconfig.json +29 -0
  80. package/tui/CodeTui.tsx +394 -0
  81. package/tui/CodeTuiAgents.ts +65 -0
  82. package/tui/CodeTuiApp.test.tsx +251 -0
  83. package/tui/CodeTuiApp.tsx +312 -0
  84. package/tui/CodeTuiAutoCompact.ts +33 -0
  85. package/tui/CodeTuiClipboard.ts +94 -0
  86. package/tui/CodeTuiCommandRunner.ts +242 -0
  87. package/tui/CodeTuiCommands.ts +59 -0
  88. package/tui/CodeTuiEditor.ts +168 -0
  89. package/tui/CodeTuiFiles.ts +45 -0
  90. package/tui/CodeTuiFrame.ts +133 -0
  91. package/tui/CodeTuiLines.ts +117 -0
  92. package/tui/CodeTuiMarkdown.ts +159 -0
  93. package/tui/CodeTuiMcp.ts +111 -0
  94. package/tui/CodeTuiModels.ts +82 -0
  95. package/tui/CodeTuiMouse.ts +39 -0
  96. package/tui/CodeTuiOverlay.ts +148 -0
  97. package/tui/CodeTuiParts.ts +168 -0
  98. package/tui/CodeTuiPrompt.ts +271 -0
  99. package/tui/CodeTuiQuestion.ts +170 -0
  100. package/tui/codeTranscript.test.ts +445 -0
  101. package/tui/codeTui.test.tsx +1104 -0
  102. package/tui/codeTuiAgents.test.ts +61 -0
  103. package/tui/codeTuiClipboard.test.ts +16 -0
  104. package/tui/codeTuiCommands.test.ts +38 -0
  105. package/tui/codeTuiEditor.test.ts +122 -0
  106. package/tui/codeTuiFiles.test.ts +43 -0
  107. package/tui/codeTuiMarkdown.test.ts +91 -0
  108. package/tui/codeTuiMcp.test.ts +160 -0
  109. package/tui/codeTuiMouse.test.ts +61 -0
package/README.ko.md ADDED
@@ -0,0 +1,31 @@
1
+ # @akanjs/code
2
+
3
+ [English](https://github.com/akan-team/akanjs/blob/main/pkgs/@akanjs/code/README.md) | [Docs](https://akanjs.com/docs) | [npm](https://www.npmjs.com/package/@akanjs/code) | [CLI](https://www.npmjs.com/package/@akanjs/cli)
4
+
5
+ `akan code` 뒤의 코딩 에이전트입니다. 엔진, 에이전트가 쓰는 도구, 터미널 UI가 들어 있습니다.
6
+
7
+ `akan code` 명령은 `@akanjs/cli`에 있지만, 에이전트와 에이전트가 쓰는 LLM 공급자 SDK는 이 패키지로 배포됩니다.
8
+ 그래서 `akan code`를 쓰지 않는 워크스페이스는 그 SDK를 설치하지 않습니다.
9
+
10
+ ## 설치
11
+
12
+ 워크스페이스에 `@akanjs/cli`와 정확히 같은 버전으로 설치합니다.
13
+
14
+ ```bash
15
+ bun add -d @akanjs/code@<akan 버전>
16
+ ```
17
+
18
+ 패키지가 없거나 버전이 다르면 `akan code`가 이 명령을 알려 주고, 터미널에서는 대신 실행할지 묻고, 그 밖에는 이
19
+ 명령과 함께 종료합니다.
20
+
21
+ ## 사용
22
+
23
+ ```ts
24
+ import { CodeAgent } from "@akanjs/code";
25
+ ```
26
+
27
+ `@akanjs/code`는 에이전트를 직접 품는 SDK 진입점이며, 가져오면 엔진이 로드됩니다. `@akanjs/code/host`는
28
+ `akan code`가 먼저 로드하는 가벼운 진입점으로, 실행 모드에 필요한 엔진만 띄웁니다.
29
+
30
+ 함께 배포되는 akan 스킬은 `@akanjs/devkit`(`@akanjs/devkit/codeAgent`)에 남아 있으므로 `akan agent install`은 이
31
+ 패키지 없이도 동작합니다.
package/README.md CHANGED
@@ -1,9 +1,31 @@
1
1
  # @akanjs/code
2
2
 
3
- This version is a placeholder that reserves the package name. It holds no code.
3
+ [한국어](https://github.com/akan-team/akanjs/blob/main/pkgs/@akanjs/code/README.ko.md) | [Docs](https://akanjs.com/docs) | [npm](https://www.npmjs.com/package/@akanjs/code) | [CLI](https://www.npmjs.com/package/@akanjs/cli)
4
4
 
5
- The coding agent behind `akan code` ships from `3.3.0-rc.70`. Install it at the version of `@akanjs/cli`:
5
+ The coding agent behind `akan code`: its engine, the tools it is given, and its terminal UI.
6
6
 
7
- ```sh
8
- bun add -d @akanjs/code@<version of @akanjs/cli>
7
+ `@akanjs/cli` defines the `akan code` command, but the agent and the LLM provider SDKs it needs ship here, so a
8
+ workspace that never runs `akan code` never installs them.
9
+
10
+ ## Install
11
+
12
+ Install it in the workspace at exactly the version of `@akanjs/cli`:
13
+
14
+ ```bash
15
+ bun add -d @akanjs/code@<akan version>
9
16
  ```
17
+
18
+ `akan code` names that command when the package is missing or at another version, offers to run it in a terminal,
19
+ and otherwise exits with it.
20
+
21
+ ## Usage
22
+
23
+ ```ts
24
+ import { CodeAgent } from "@akanjs/code";
25
+ ```
26
+
27
+ `@akanjs/code` is the SDK entry for embedding the agent; importing it loads the engine. `@akanjs/code/host` is the
28
+ light entry `akan code` loads first, which starts the engine only for the mode it runs in.
29
+
30
+ The shipped akan skills stay in `@akanjs/devkit` (`@akanjs/devkit/codeAgent`), so `akan agent install` works without
31
+ this package.
@@ -0,0 +1,49 @@
1
+ import type { SettingsManager } from "@earendil-works/pi-coding-agent";
2
+ import type { CodeAgentModel } from "./akanCodeModel";
3
+
4
+ type CompactedModel = Pick<CodeAgentModel, "provider" | "id" | "contextWindow">;
5
+
6
+ // The engine compacts above `contextWindow - reserveTokens`, so a share of the window becomes a reserve per model.
7
+ export class AkanCodeCompaction {
8
+ // Twice the engine's 16,384: at 16k a reasoning model stops mid-thought at the compaction threshold,
9
+ // and the recovery re-sends a near-full window to retry the turn.
10
+ static readonly reserveFloor = 32_768;
11
+ static readonly steps = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] as const;
12
+
13
+ static isStep(percent: number) {
14
+ return AkanCodeCompaction.steps.some((step) => step === percent);
15
+ }
16
+
17
+ /** `100` is the default itself, so it is stored as no choice at all. */
18
+ static normalize(percent: number | undefined) {
19
+ if (percent === undefined) return undefined;
20
+ if (!AkanCodeCompaction.isStep(percent))
21
+ throw new Error(`Autocompact takes a percent in steps of 10: ${AkanCodeCompaction.steps.join(", ")}.`);
22
+ return percent === 100 ? undefined : percent;
23
+ }
24
+
25
+ static thresholdOf(contextWindow: number, percent: number | undefined) {
26
+ const share = percent ? Math.floor((contextWindow * percent) / 100) : contextWindow;
27
+ return Math.min(share, contextWindow - AkanCodeCompaction.reserveFloor);
28
+ }
29
+
30
+ static apply(settings: SettingsManager, model: CompactedModel, percent: number | undefined) {
31
+ const threshold = AkanCodeCompaction.thresholdOf(model.contextWindow, percent);
32
+ // Keyed by model, so the next model is never checked against a reserve sized for this one's window.
33
+ settings.applyOverrides({
34
+ compaction: {
35
+ modelOverrides: { [`${model.provider}/${model.id}`]: { reserveTokens: model.contextWindow - threshold } },
36
+ },
37
+ });
38
+ }
39
+
40
+ /** Why `percent` cannot work on `model`, or undefined when it can. */
41
+ static problemOf(model: CompactedModel, percent: number, keepRecentTokens: number) {
42
+ const name = `${model.provider}/${model.id}`;
43
+ if (model.contextWindow <= 0) return `${name} declares no context window, so it has no share to compact at.`;
44
+ const threshold = AkanCodeCompaction.thresholdOf(model.contextWindow, percent);
45
+ if (threshold >= keepRecentTokens) return undefined;
46
+ const k = (tokens: number) => `${Math.round(tokens / 1000)}k`;
47
+ return `Compacting at ${percent}% of the ${k(model.contextWindow)} window of ${name} starts at ${k(threshold)}, under the ${k(keepRecentTokens)} of recent turns every compaction keeps, so every turn would compact again.`;
48
+ }
49
+ }
@@ -0,0 +1,122 @@
1
+ import { existsSync, mkdirSync, mkdtempSync } from "node:fs";
2
+ import { tmpdir } from "node:os";
3
+ import path from "node:path";
4
+ import { akanCodePaths } from "@akanjs/devkit/codeAgent";
5
+ import { type InlineExtension, ModelRuntime, SessionManager, SettingsManager } from "@earendil-works/pi-coding-agent";
6
+ import type { CodeAgentProfile } from "akanjs/common";
7
+ import { AkanEnvKeys } from "../tools/AkanEnvKeys";
8
+ import { AkanCodeCompaction } from "./AkanCodeCompaction";
9
+ import { type AkanContextFile, AkanContextFiles } from "./AkanContextFiles";
10
+ import { akanSystemPrompt } from "./akanSystemPrompt";
11
+ import type { CodeAgentProxy } from "./CodeAgentProxy";
12
+ import { CodeSessionIndex } from "./CodeSessionIndex";
13
+ import { WorkspaceTrust } from "./WorkspaceTrust";
14
+
15
+ type PrepareRequest = (
16
+ model: unknown,
17
+ options?: Record<string, unknown>,
18
+ ) => Promise<{ model: { compat?: Record<string, unknown> } }>;
19
+
20
+ export interface AkanCodeServicesOptions {
21
+ workspaceRoot: string;
22
+ cwd: string;
23
+ profile: CodeAgentProfile;
24
+ extensions: InlineExtension[];
25
+ sessionId?: string;
26
+ }
27
+
28
+ // All four engine services are injected explicitly: any one left out makes the engine fall back to `~/.pi/`.
29
+ export class AkanCodeServices {
30
+ static settings() {
31
+ // In memory on purpose: file settings would be a second configuration surface beside the profile.
32
+ // `enableInstallTelemetry` defaults to true and adds pi-branded headers to OpenRouter/NVIDIA/Cloudflare calls.
33
+ return SettingsManager.inMemory({
34
+ enableInstallTelemetry: false,
35
+ enableAnalytics: false,
36
+ quietStartup: true,
37
+ compaction: { reserveTokens: AkanCodeCompaction.reserveFloor },
38
+ // pi 1.5 defaults to "idle", which sends billed cache refreshes for up to 30 minutes between turns.
39
+ cacheWarming: "streaming",
40
+ });
41
+ }
42
+
43
+ // The engine locks and rewrites `authPath` itself, so two `akan code` refreshing a token at once cannot clobber it.
44
+ static async runtime(workspaceRoot: string, proxy: CodeAgentProxy | null = null) {
45
+ akanCodePaths.ensureGlobalDir();
46
+ const runtime = await ModelRuntime.create({
47
+ //* Behind a proxy no real key may reach a request, so credentials live in a throwaway file.
48
+ authPath: proxy
49
+ ? path.join(mkdtempSync(path.join(tmpdir(), "akan-code-proxy-")), "auth.json")
50
+ : akanCodePaths.authFile(),
51
+ modelsPath: akanCodePaths.modelsFile(),
52
+ });
53
+ AkanCodeServices.#holdMessageThreadsOff(runtime);
54
+ if (proxy) await proxy.apply(runtime);
55
+ else await AkanEnvKeys.apply(runtime, workspaceRoot);
56
+ return runtime;
57
+ }
58
+
59
+ // pi 1.5 turned Anthropic message threads on for api.anthropic.com; a models.json `compat` that names it still wins.
60
+ static #holdMessageThreadsOff(runtime: ModelRuntime) {
61
+ const target = runtime as unknown as { prepareRequest?: PrepareRequest };
62
+ const original = target.prepareRequest?.bind(runtime);
63
+ if (!original) throw new Error("The model runtime no longer exposes prepareRequest; update AkanCodeServices");
64
+ target.prepareRequest = async (model, options) => {
65
+ const prepared = await original(model, options);
66
+ if (prepared.model.compat?.supportsMessageThreads !== undefined) return prepared;
67
+ return {
68
+ ...prepared,
69
+ model: { ...prepared.model, compat: { ...prepared.model.compat, supportsMessageThreads: false } },
70
+ };
71
+ };
72
+ }
73
+
74
+ static sessions(workspaceRoot: string, cwd: string, profile: CodeAgentProfile, resume?: string) {
75
+ //* `remote` has no store of its own yet, so it keeps a file session: a pod worker's suspended asks need it.
76
+ if (profile.session.store === "memory") return SessionManager.inMemory(cwd);
77
+ const dir = akanCodePaths.sessionsDir(workspaceRoot);
78
+ mkdirSync(dir, { recursive: true });
79
+ const manager = SessionManager.create(cwd, dir);
80
+ if (!resume) return manager;
81
+ const file = CodeSessionIndex.fileOf(dir, resume);
82
+ // A mistyped id that quietly opened a new session would look like a session that lost its history.
83
+ if (!file) throw new Error(`No stored session ${resume} in ${dir}`);
84
+ manager.setSessionFile(file);
85
+ return manager;
86
+ }
87
+
88
+ // Skills are text, never code that runs, so unlike extensions they may come from the home directory too.
89
+ static #skillPaths(profile: CodeAgentProfile, workspaceRoot: string) {
90
+ if (!profile.context.skills) return [];
91
+ const dirs = [
92
+ akanCodePaths.builtinSkillsDir(),
93
+ akanCodePaths.globalSkillsDir(),
94
+ akanCodePaths.skillsDir(workspaceRoot),
95
+ ];
96
+ return dirs.filter((dir): dir is string => !!dir && existsSync(dir));
97
+ }
98
+
99
+ static resourceOptions(options: AkanCodeServicesOptions) {
100
+ // A path that does not exist is reported as a load error rather than skipped, and these two are optional.
101
+ const present = (dir: string) => (existsSync(dir) ? [dir] : []);
102
+ return {
103
+ noExtensions: true,
104
+ // Disables only the engine's default skill locations (`~/.pi/skills`, `.pi/`); `additionalSkillPaths` merge.
105
+ noSkills: true,
106
+ noPromptTemplates: true,
107
+ noThemes: true,
108
+ noContextFiles: !options.profile.context.projectFiles,
109
+ agentsFilesOverride: ({ agentsFiles }: { agentsFiles: AkanContextFile[] }) => ({
110
+ agentsFiles: options.profile.context.projectFiles
111
+ ? AkanContextFiles.extend(agentsFiles, { workspaceRoot: options.workspaceRoot, cwd: options.cwd })
112
+ : agentsFiles,
113
+ }),
114
+ appendSystemPrompt: [akanSystemPrompt(options.profile)],
115
+ additionalExtensionPaths: WorkspaceTrust.isTrusted(options.workspaceRoot, "extensions")
116
+ ? present(akanCodePaths.extensionsDir(options.workspaceRoot))
117
+ : [],
118
+ additionalSkillPaths: AkanCodeServices.#skillPaths(options.profile, options.workspaceRoot),
119
+ extensionFactories: options.extensions,
120
+ };
121
+ }
122
+ }
@@ -0,0 +1,94 @@
1
+ import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
2
+ import path from "node:path";
3
+
4
+ export interface AkanContextFile {
5
+ path: string;
6
+ content: string;
7
+ }
8
+
9
+ export interface AkanContextFilesOptions {
10
+ workspaceRoot: string;
11
+ cwd: string;
12
+ }
13
+
14
+ // The engine takes only the first of `AGENTS.override.md · AGENTS.md · CLAUDE.md` per directory and never reads
15
+ // `.cursor/rules`; this appends what it drops, after the engine's own list.
16
+ export class AkanContextFiles {
17
+ /** Cursor's frontmatter block, which is metadata for its own rule picker and not instruction for a model. */
18
+ static readonly #frontmatter = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/;
19
+
20
+ static extend(base: AkanContextFile[], options: AkanContextFilesOptions): AkanContextFile[] {
21
+ const seen = new Set(base.map((file) => file.path));
22
+ // Keyed by content too: the usual way to carry both names is a symlink or a one-line pointer.
23
+ const contents = new Set(base.map((file) => file.content.trim()));
24
+ const added: AkanContextFile[] = [];
25
+ for (const file of [...AkanContextFiles.#claude(base), ...AkanContextFiles.#cursor(options)]) {
26
+ if (seen.has(file.path) || contents.has(file.content.trim()) || !file.content.trim()) continue;
27
+ seen.add(file.path);
28
+ contents.add(file.content.trim());
29
+ added.push(file);
30
+ }
31
+ return [...base, ...added];
32
+ }
33
+
34
+ // Not beside an `AGENTS.override.md`: that file exists to displace the others in its directory.
35
+ static #claude(base: AkanContextFile[]) {
36
+ const files: AkanContextFile[] = [];
37
+ for (const file of base) {
38
+ if (!/^AGENTS\.(md|MD)$/.test(path.basename(file.path))) continue;
39
+ for (const name of ["CLAUDE.md", "CLAUDE.MD"]) {
40
+ const candidate = path.join(path.dirname(file.path), name);
41
+ const content = AkanContextFiles.#read(candidate);
42
+ if (content !== undefined) files.push({ path: candidate, content });
43
+ }
44
+ }
45
+ return files;
46
+ }
47
+
48
+ // Only `alwaysApply: true` or frontmatter-less rules: Cursor's `globs`/`description`/manual kinds are scoped.
49
+ static #cursor(options: AkanContextFilesOptions) {
50
+ const files: AkanContextFile[] = [];
51
+ const roots = [...new Set([options.workspaceRoot, options.cwd])];
52
+ for (const root of roots) {
53
+ const legacy = AkanContextFiles.#read(path.join(root, ".cursorrules"));
54
+ if (legacy !== undefined) files.push({ path: path.join(root, ".cursorrules"), content: legacy });
55
+ for (const file of AkanContextFiles.#mdcFiles(path.join(root, ".cursor", "rules"))) {
56
+ const raw = AkanContextFiles.#read(file);
57
+ if (raw === undefined) continue;
58
+ const body = AkanContextFiles.#applied(raw);
59
+ if (body !== undefined) files.push({ path: file, content: body });
60
+ }
61
+ }
62
+ return files;
63
+ }
64
+
65
+ static #applied(raw: string) {
66
+ const match = AkanContextFiles.#frontmatter.exec(raw);
67
+ if (!match) return raw;
68
+ if (!/^\s*alwaysApply\s*:\s*true\s*$/m.test(match[1] ?? "")) return undefined;
69
+ return raw.slice(match[0].length);
70
+ }
71
+
72
+ /** Sorted, because the order rules reach the model in is otherwise the order a directory happens to list. */
73
+ static #mdcFiles(dir: string) {
74
+ if (!existsSync(dir)) return [];
75
+ try {
76
+ return readdirSync(dir, { recursive: true, withFileTypes: true })
77
+ .filter((entry) => entry.isFile() && entry.name.endsWith(".mdc"))
78
+ .map((entry) => path.join(entry.parentPath ?? dir, entry.name))
79
+ .sort();
80
+ } catch {
81
+ return [];
82
+ }
83
+ }
84
+
85
+ static #read(file: string) {
86
+ try {
87
+ if (!existsSync(file) || !statSync(file).isFile()) return undefined;
88
+ return readFileSync(file, "utf8").replace(/^/, "");
89
+ } catch {
90
+ // A rule file that cannot be read costs its own rules. It must not cost the session its start.
91
+ return undefined;
92
+ }
93
+ }
94
+ }