fix: resolved AI/OAuth helper duplication via shared modules

- Standardized missing-file read errors and now return `File not found: <path>` for absent edit targets.
- Centralized AI provider, usage, and OAuth helpers into shared modules to remove duplicated logic.
- Migrated OAuth/API-key login flows to shared factory helpers and removed inline prompt/token-exchange code.
- Reused shared tools and formatter utilities for discovery, stream tails, LSP batching, and source formatting.
- Consolidated repeated test helpers and fixtures into shared modules, replacing inline helper duplicates.
This commit is contained in:
can1357
2026-04-23 21:02:14 +02:00
parent 359318f931
commit d24d11a274
122 changed files with 2926 additions and 2743 deletions
@@ -1,22 +1,7 @@
import { describe, expect, it } from "bun:test";
import { executePythonWithKernel, type PythonKernelExecutor } from "@oh-my-pi/pi-coding-agent/ipy/executor";
import type { KernelExecuteOptions, KernelExecuteResult } from "@oh-my-pi/pi-coding-agent/ipy/kernel";
import { executePythonWithKernel } from "@oh-my-pi/pi-coding-agent/ipy/executor";
import { DEFAULT_MAX_BYTES } from "@oh-my-pi/pi-coding-agent/session/streaming-output";
class FakeKernel implements PythonKernelExecutor {
private result: KernelExecuteResult;
private onExecute: (options?: KernelExecuteOptions) => Promise<void> | void;
constructor(result: KernelExecuteResult, onExecute: (options?: KernelExecuteOptions) => Promise<void> | void) {
this.result = result;
this.onExecute = onExecute;
}
async execute(_code: string, options?: KernelExecuteOptions): Promise<KernelExecuteResult> {
await this.onExecute(options);
return this.result;
}
}
import { FakeKernel } from "./helpers";
describe("executePythonWithKernel streaming", () => {
it("truncates large output and tracks totals", async () => {