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:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user