refactor(coding-agent): replace AgentSessionRuntimeHost with closure-based AgentSessionRuntime
- Replace AgentSessionRuntimeHost and bootstrap abstractions with AgentSessionRuntime - Runtime creation is now closure-based via CreateAgentSessionRuntimeFactory - Factory closes over process-global fixed inputs, recreates cwd-bound services per effective cwd - Session config (model, thinking, tools, scoped models) re-resolved per target cwd - CLI resource paths resolved once at startup as absolute paths - Swap lifecycle: teardown old, create next, apply next (hard fail on creation error) - Unified diagnostics model (info/warning/error) for args, services, session resolution, resources - No logging or process exits inside creation/parsing logic - Removed session_directory support - Removed session_switch and session_fork extension events (use session_start with reason) - Moved package/config CLI to package-manager-cli.ts - Fixed theme init for --resume session picker - Fixed flaky reftable footer test (content-based polling) - Fixed silent drop of unknown single-dash CLI flags - Added error diagnostics for missing explicit CLI resource paths - Updated SDK docs, examples, plans, exports, tests, changelog fixes #2753
This commit is contained in:
@@ -2,7 +2,9 @@ import * as fs from "node:fs";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { KeybindingsManager, migrateKeybindingsConfigFile } from "../src/core/keybindings.js";
|
||||
import { ENV_AGENT_DIR } from "../src/config.js";
|
||||
import { KeybindingsManager } from "../src/core/keybindings.js";
|
||||
import { runMigrations } from "../src/migrations.js";
|
||||
|
||||
describe("keybindings migration", () => {
|
||||
const tempDirs: string[] = [];
|
||||
@@ -25,8 +27,14 @@ describe("keybindings migration", () => {
|
||||
cursorUp: ["up", "ctrl+p"],
|
||||
expandTools: "ctrl+x",
|
||||
});
|
||||
|
||||
expect(migrateKeybindingsConfigFile(agentDir)).toBe(true);
|
||||
const previousAgentDir = process.env[ENV_AGENT_DIR];
|
||||
process.env[ENV_AGENT_DIR] = agentDir;
|
||||
runMigrations(agentDir);
|
||||
if (previousAgentDir === undefined) {
|
||||
delete process.env[ENV_AGENT_DIR];
|
||||
} else {
|
||||
process.env[ENV_AGENT_DIR] = previousAgentDir;
|
||||
}
|
||||
|
||||
const migrated = JSON.parse(fs.readFileSync(path.join(agentDir, "keybindings.json"), "utf-8")) as Record<
|
||||
string,
|
||||
@@ -43,8 +51,14 @@ describe("keybindings migration", () => {
|
||||
expandTools: "ctrl+x",
|
||||
"app.tools.expand": "ctrl+y",
|
||||
});
|
||||
|
||||
expect(migrateKeybindingsConfigFile(agentDir)).toBe(true);
|
||||
const previousAgentDir = process.env[ENV_AGENT_DIR];
|
||||
process.env[ENV_AGENT_DIR] = agentDir;
|
||||
runMigrations(agentDir);
|
||||
if (previousAgentDir === undefined) {
|
||||
delete process.env[ENV_AGENT_DIR];
|
||||
} else {
|
||||
process.env[ENV_AGENT_DIR] = previousAgentDir;
|
||||
}
|
||||
|
||||
const migrated = JSON.parse(fs.readFileSync(path.join(agentDir, "keybindings.json"), "utf-8")) as Record<
|
||||
string,
|
||||
|
||||
Reference in New Issue
Block a user