Files
oh-my-pi/packages/coding-agent/src/tools/context.ts
T
can1357 f66e5dba9b build(config): refactored build and TypeScript configuration with Bun loaders
- Removed WASM generation script; use Bun `wasm?raw` loader for imports.
- Added bunfig.toml with loaders for `.md`, `.py`, and `.wasm?raw` text imports.
- Added types/assets/index.d.ts for global TypeScript module declarations.
- Unified TypeScript configuration with tsgo-based checking across monorepo.
- Removed build and WASM steps from install and publish pipelines.
2026-01-24 00:03:52 +01:00

40 lines
1.0 KiB
TypeScript

import type { AgentToolContext, ToolCallContext } from "@oh-my-pi/pi-agent-core";
import type { CustomToolContext } from "../extensibility/custom-tools/types";
import type { ExtensionUIContext } from "../extensibility/extensions/types";
declare module "@oh-my-pi/pi-agent-core" {
interface AgentToolContext extends CustomToolContext {
ui?: ExtensionUIContext;
hasUI?: boolean;
toolNames?: string[];
toolCall?: ToolCallContext;
}
}
export class ToolContextStore {
private uiContext: ExtensionUIContext | undefined;
private hasUI = false;
private toolNames: string[] = [];
constructor(private readonly getBaseContext: () => CustomToolContext) {}
getContext(toolCall?: ToolCallContext): AgentToolContext {
return {
...this.getBaseContext(),
ui: this.uiContext,
hasUI: this.hasUI,
toolNames: this.toolNames,
toolCall,
};
}
setUIContext(uiContext: ExtensionUIContext, hasUI: boolean): void {
this.uiContext = uiContext;
this.hasUI = hasUI;
}
setToolNames(names: string[]): void {
this.toolNames = names;
}
}