chore(ts): use source import extensions
This commit is contained in:
@@ -20,7 +20,7 @@ import type {
|
|||||||
AgentToolCall,
|
AgentToolCall,
|
||||||
AgentToolResult,
|
AgentToolResult,
|
||||||
StreamFn,
|
StreamFn,
|
||||||
} from "./types.js";
|
} from "./types.ts";
|
||||||
|
|
||||||
export type AgentEventSink = (event: AgentEvent) => Promise<void> | void;
|
export type AgentEventSink = (event: AgentEvent) => Promise<void> | void;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
type ThinkingBudgets,
|
type ThinkingBudgets,
|
||||||
type Transport,
|
type Transport,
|
||||||
} from "@earendil-works/pi-ai";
|
} from "@earendil-works/pi-ai";
|
||||||
import { runAgentLoop, runAgentLoopContinue } from "./agent-loop.js";
|
import { runAgentLoop, runAgentLoopContinue } from "./agent-loop.ts";
|
||||||
import type {
|
import type {
|
||||||
AfterToolCallContext,
|
AfterToolCallContext,
|
||||||
AfterToolCallResult,
|
AfterToolCallResult,
|
||||||
@@ -24,9 +24,9 @@ import type {
|
|||||||
QueueMode,
|
QueueMode,
|
||||||
StreamFn,
|
StreamFn,
|
||||||
ToolExecutionMode,
|
ToolExecutionMode,
|
||||||
} from "./types.js";
|
} from "./types.ts";
|
||||||
|
|
||||||
export type { QueueMode } from "./types.js";
|
export type { QueueMode } from "./types.ts";
|
||||||
|
|
||||||
function defaultConvertToLlm(messages: AgentMessage[]): Message[] {
|
function defaultConvertToLlm(messages: AgentMessage[]): Message[] {
|
||||||
return messages.filter(
|
return messages.filter(
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
streamSimple,
|
streamSimple,
|
||||||
type UserMessage,
|
type UserMessage,
|
||||||
} from "@earendil-works/pi-ai";
|
} from "@earendil-works/pi-ai";
|
||||||
import { runAgentLoop } from "../agent-loop.js";
|
import { runAgentLoop } from "../agent-loop.ts";
|
||||||
import type {
|
import type {
|
||||||
AgentContext,
|
AgentContext,
|
||||||
AgentEvent,
|
AgentEvent,
|
||||||
@@ -15,12 +15,12 @@ import type {
|
|||||||
QueueMode,
|
QueueMode,
|
||||||
StreamFn,
|
StreamFn,
|
||||||
ThinkingLevel,
|
ThinkingLevel,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { collectEntriesForBranchSummary, generateBranchSummary } from "./compaction/branch-summarization.js";
|
import { collectEntriesForBranchSummary, generateBranchSummary } from "./compaction/branch-summarization.ts";
|
||||||
import { compact, DEFAULT_COMPACTION_SETTINGS, prepareCompaction } from "./compaction/compaction.js";
|
import { compact, DEFAULT_COMPACTION_SETTINGS, prepareCompaction } from "./compaction/compaction.ts";
|
||||||
import { convertToLlm } from "./messages.js";
|
import { convertToLlm } from "./messages.ts";
|
||||||
import { formatPromptTemplateInvocation } from "./prompt-templates.js";
|
import { formatPromptTemplateInvocation } from "./prompt-templates.ts";
|
||||||
import { formatSkillInvocation } from "./skills.js";
|
import { formatSkillInvocation } from "./skills.ts";
|
||||||
import type {
|
import type {
|
||||||
AbortResult,
|
AbortResult,
|
||||||
AgentHarnessEvent,
|
AgentHarnessEvent,
|
||||||
@@ -37,8 +37,8 @@ import type {
|
|||||||
PromptTemplate,
|
PromptTemplate,
|
||||||
Session,
|
Session,
|
||||||
Skill,
|
Skill,
|
||||||
} from "./types.js";
|
} from "./types.ts";
|
||||||
import { AgentHarnessError, BranchSummaryError, CompactionError, SessionError, toError } from "./types.js";
|
import { AgentHarnessError, BranchSummaryError, CompactionError, SessionError, toError } from "./types.ts";
|
||||||
|
|
||||||
function createUserMessage(text: string, images?: ImageContent[]): UserMessage {
|
function createUserMessage(text: string, images?: ImageContent[]): UserMessage {
|
||||||
const content: Array<{ type: "text"; text: string } | ImageContent> = [{ type: "text", text }];
|
const content: Array<{ type: "text"; text: string } | ImageContent> = [{ type: "text", text }];
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import type { Model } from "@earendil-works/pi-ai";
|
import type { Model } from "@earendil-works/pi-ai";
|
||||||
import { completeSimple } from "@earendil-works/pi-ai";
|
import { completeSimple } from "@earendil-works/pi-ai";
|
||||||
import type { AgentMessage } from "../../types.js";
|
import type { AgentMessage } from "../../types.ts";
|
||||||
import {
|
import {
|
||||||
convertToLlm,
|
convertToLlm,
|
||||||
createBranchSummaryMessage,
|
createBranchSummaryMessage,
|
||||||
createCompactionSummaryMessage,
|
createCompactionSummaryMessage,
|
||||||
createCustomMessage,
|
createCustomMessage,
|
||||||
} from "../messages.js";
|
} from "../messages.ts";
|
||||||
import type { BranchSummaryResult, Session, SessionTreeEntry } from "../types.js";
|
import type { BranchSummaryResult, Session, SessionTreeEntry } from "../types.ts";
|
||||||
import { BranchSummaryError, err, ok, type Result, SessionError } from "../types.js";
|
import { BranchSummaryError, err, ok, type Result, SessionError } from "../types.ts";
|
||||||
import { estimateTokens, SUMMARIZATION_SYSTEM_PROMPT } from "./compaction.js";
|
import { estimateTokens, SUMMARIZATION_SYSTEM_PROMPT } from "./compaction.ts";
|
||||||
import {
|
import {
|
||||||
computeFileLists,
|
computeFileLists,
|
||||||
createFileOps,
|
createFileOps,
|
||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
type FileOperations,
|
type FileOperations,
|
||||||
formatFileOperations,
|
formatFileOperations,
|
||||||
serializeConversation,
|
serializeConversation,
|
||||||
} from "./utils.js";
|
} from "./utils.ts";
|
||||||
|
|
||||||
/** File-operation details stored on generated branch summary entries. */
|
/** File-operation details stored on generated branch summary entries. */
|
||||||
export interface BranchSummaryDetails {
|
export interface BranchSummaryDetails {
|
||||||
@@ -27,7 +27,7 @@ export interface BranchSummaryDetails {
|
|||||||
modifiedFiles: string[];
|
modifiedFiles: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { FileOperations } from "./utils.js";
|
export type { FileOperations } from "./utils.ts";
|
||||||
|
|
||||||
/** Prepared branch content for summarization. */
|
/** Prepared branch content for summarization. */
|
||||||
export interface BranchPreparation {
|
export interface BranchPreparation {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import type { AssistantMessage, ImageContent, Model, TextContent, Usage } from "@earendil-works/pi-ai";
|
import type { AssistantMessage, ImageContent, Model, TextContent, Usage } from "@earendil-works/pi-ai";
|
||||||
import { completeSimple } from "@earendil-works/pi-ai";
|
import { completeSimple } from "@earendil-works/pi-ai";
|
||||||
import type { AgentMessage, ThinkingLevel } from "../../types.js";
|
import type { AgentMessage, ThinkingLevel } from "../../types.ts";
|
||||||
import {
|
import {
|
||||||
convertToLlm,
|
convertToLlm,
|
||||||
createBranchSummaryMessage,
|
createBranchSummaryMessage,
|
||||||
createCompactionSummaryMessage,
|
createCompactionSummaryMessage,
|
||||||
createCustomMessage,
|
createCustomMessage,
|
||||||
} from "../messages.js";
|
} from "../messages.ts";
|
||||||
import { buildSessionContext } from "../session/session.js";
|
import { buildSessionContext } from "../session/session.ts";
|
||||||
import { type CompactionEntry, CompactionError, err, ok, type Result, type SessionTreeEntry } from "../types.js";
|
import { type CompactionEntry, CompactionError, err, ok, type Result, type SessionTreeEntry } from "../types.ts";
|
||||||
import {
|
import {
|
||||||
computeFileLists,
|
computeFileLists,
|
||||||
createFileOps,
|
createFileOps,
|
||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
type FileOperations,
|
type FileOperations,
|
||||||
formatFileOperations,
|
formatFileOperations,
|
||||||
serializeConversation,
|
serializeConversation,
|
||||||
} from "./utils.js";
|
} from "./utils.ts";
|
||||||
|
|
||||||
/** File-operation details stored on generated compaction entries. */
|
/** File-operation details stored on generated compaction entries. */
|
||||||
export interface CompactionDetails {
|
export interface CompactionDetails {
|
||||||
@@ -620,7 +620,7 @@ Summarize the prefix to provide context for the retained suffix:
|
|||||||
|
|
||||||
Be concise. Focus on what's needed to understand the kept suffix.`;
|
Be concise. Focus on what's needed to understand the kept suffix.`;
|
||||||
|
|
||||||
export { serializeConversation } from "./utils.js";
|
export { serializeConversation } from "./utils.ts";
|
||||||
|
|
||||||
/** Generate compaction summary data from prepared session history. */
|
/** Generate compaction summary data from prepared session history. */
|
||||||
export async function compact(
|
export async function compact(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { Message } from "@earendil-works/pi-ai";
|
import type { Message } from "@earendil-works/pi-ai";
|
||||||
import type { AgentMessage } from "../../types.js";
|
import type { AgentMessage } from "../../types.ts";
|
||||||
|
|
||||||
/** File paths touched by a session branch or compaction range. */
|
/** File paths touched by a session branch or compaction range. */
|
||||||
export interface FileOperations {
|
export interface FileOperations {
|
||||||
|
|||||||
2
packages/agent/src/harness/env/nodejs.ts
vendored
2
packages/agent/src/harness/env/nodejs.ts
vendored
@@ -26,7 +26,7 @@ import {
|
|||||||
ok,
|
ok,
|
||||||
type Result,
|
type Result,
|
||||||
toError,
|
toError,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
|
|
||||||
function resolvePath(cwd: string, path: string): string {
|
function resolvePath(cwd: string, path: string): string {
|
||||||
return isAbsolute(path) ? path : resolve(cwd, path);
|
return isAbsolute(path) ? path : resolve(cwd, path);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { ImageContent, Message, TextContent } from "@earendil-works/pi-ai";
|
import type { ImageContent, Message, TextContent } from "@earendil-works/pi-ai";
|
||||||
import type { AgentMessage } from "../types.js";
|
import type { AgentMessage } from "../types.ts";
|
||||||
|
|
||||||
export const COMPACTION_SUMMARY_PREFIX = `The conversation history before this point was compacted into the following summary:
|
export const COMPACTION_SUMMARY_PREFIX = `The conversation history before this point was compacted into the following summary:
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ export interface CompactionSummaryMessage {
|
|||||||
timestamp: number;
|
timestamp: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module "../types.js" {
|
declare module "../types.ts" {
|
||||||
interface CustomAgentMessages {
|
interface CustomAgentMessages {
|
||||||
bashExecution: BashExecutionMessage;
|
bashExecution: BashExecutionMessage;
|
||||||
custom: CustomMessage;
|
custom: CustomMessage;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { parse } from "yaml";
|
import { parse } from "yaml";
|
||||||
import { type ExecutionEnv, type FileInfo, type PromptTemplate, type Result, toError } from "./types.js";
|
import { type ExecutionEnv, type FileInfo, type PromptTemplate, type Result, toError } from "./types.ts";
|
||||||
|
|
||||||
export type PromptTemplateDiagnosticCode = "file_info_failed" | "list_failed" | "read_failed" | "parse_failed";
|
export type PromptTemplateDiagnosticCode = "file_info_failed" | "list_failed" | "read_failed" | "parse_failed";
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ import type {
|
|||||||
JsonlSessionMetadata,
|
JsonlSessionMetadata,
|
||||||
JsonlSessionRepoApi,
|
JsonlSessionRepoApi,
|
||||||
Session,
|
Session,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { SessionError, toError } from "../types.js";
|
import { SessionError, toError } from "../types.ts";
|
||||||
import { JsonlSessionStorage, loadJsonlSessionMetadata } from "./jsonl-storage.js";
|
import { JsonlSessionStorage, loadJsonlSessionMetadata } from "./jsonl-storage.ts";
|
||||||
import {
|
import {
|
||||||
createSessionId,
|
createSessionId,
|
||||||
createTimestamp,
|
createTimestamp,
|
||||||
getEntriesToFork,
|
getEntriesToFork,
|
||||||
getFileSystemResultOrThrow,
|
getFileSystemResultOrThrow,
|
||||||
toSession,
|
toSession,
|
||||||
} from "./repo-utils.js";
|
} from "./repo-utils.ts";
|
||||||
|
|
||||||
type JsonlSessionRepoFileSystem = Pick<
|
type JsonlSessionRepoFileSystem = Pick<
|
||||||
FileSystem,
|
FileSystem,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { FileSystem, JsonlSessionMetadata, LeafEntry, SessionStorage, SessionTreeEntry } from "../types.js";
|
import type { FileSystem, JsonlSessionMetadata, LeafEntry, SessionStorage, SessionTreeEntry } from "../types.ts";
|
||||||
import { SessionError, toError } from "../types.js";
|
import { SessionError, toError } from "../types.ts";
|
||||||
import { getFileSystemResultOrThrow } from "./repo-utils.js";
|
import { getFileSystemResultOrThrow } from "./repo-utils.ts";
|
||||||
import { uuidv7 } from "./uuid.js";
|
import { uuidv7 } from "./uuid.ts";
|
||||||
|
|
||||||
type JsonlSessionStorageFileSystem = Pick<FileSystem, "readTextFile" | "readTextLines" | "writeFile" | "appendFile">;
|
type JsonlSessionStorageFileSystem = Pick<FileSystem, "readTextFile" | "readTextLines" | "writeFile" | "appendFile">;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { type Session, SessionError, type SessionMetadata, type SessionRepo } from "../types.js";
|
import { type Session, SessionError, type SessionMetadata, type SessionRepo } from "../types.ts";
|
||||||
import { InMemorySessionStorage } from "./memory-storage.js";
|
import { InMemorySessionStorage } from "./memory-storage.ts";
|
||||||
import { createSessionId, createTimestamp, getEntriesToFork, toSession } from "./repo-utils.js";
|
import { createSessionId, createTimestamp, getEntriesToFork, toSession } from "./repo-utils.ts";
|
||||||
|
|
||||||
export class InMemorySessionRepo implements SessionRepo<SessionMetadata, { id?: string }, void> {
|
export class InMemorySessionRepo implements SessionRepo<SessionMetadata, { id?: string }, void> {
|
||||||
private sessions = new Map<string, Session<SessionMetadata>>();
|
private sessions = new Map<string, Session<SessionMetadata>>();
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import {
|
|||||||
type SessionMetadata,
|
type SessionMetadata,
|
||||||
type SessionStorage,
|
type SessionStorage,
|
||||||
type SessionTreeEntry,
|
type SessionTreeEntry,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { uuidv7 } from "./uuid.js";
|
import { uuidv7 } from "./uuid.ts";
|
||||||
|
|
||||||
function updateLabelCache(labelsById: Map<string, string>, entry: SessionTreeEntry): void {
|
function updateLabelCache(labelsById: Map<string, string>, entry: SessionTreeEntry): void {
|
||||||
if (entry.type !== "label") return;
|
if (entry.type !== "label") return;
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import {
|
|||||||
type SessionMetadata,
|
type SessionMetadata,
|
||||||
type SessionStorage,
|
type SessionStorage,
|
||||||
type SessionTreeEntry,
|
type SessionTreeEntry,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { Session } from "./session.js";
|
import { Session } from "./session.ts";
|
||||||
import { uuidv7 } from "./uuid.js";
|
import { uuidv7 } from "./uuid.ts";
|
||||||
|
|
||||||
export function createSessionId(): string {
|
export function createSessionId(): string {
|
||||||
return uuidv7();
|
return uuidv7();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { ImageContent, TextContent } from "@earendil-works/pi-ai";
|
import type { ImageContent, TextContent } from "@earendil-works/pi-ai";
|
||||||
import type { AgentMessage } from "../../types.js";
|
import type { AgentMessage } from "../../types.ts";
|
||||||
import { createBranchSummaryMessage, createCompactionSummaryMessage, createCustomMessage } from "../messages.js";
|
import { createBranchSummaryMessage, createCompactionSummaryMessage, createCustomMessage } from "../messages.ts";
|
||||||
import type {
|
import type {
|
||||||
BranchSummaryEntry,
|
BranchSummaryEntry,
|
||||||
CompactionEntry,
|
CompactionEntry,
|
||||||
@@ -15,8 +15,8 @@ import type {
|
|||||||
SessionStorage,
|
SessionStorage,
|
||||||
SessionTreeEntry,
|
SessionTreeEntry,
|
||||||
ThinkingLevelChangeEntry,
|
ThinkingLevelChangeEntry,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { SessionError } from "../types.js";
|
import { SessionError } from "../types.ts";
|
||||||
|
|
||||||
export function buildSessionContext(pathEntries: SessionTreeEntry[]): SessionContext {
|
export function buildSessionContext(pathEntries: SessionTreeEntry[]): SessionContext {
|
||||||
let thinkingLevel = "off";
|
let thinkingLevel = "off";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import { parse } from "yaml";
|
import { parse } from "yaml";
|
||||||
import { type ExecutionEnv, type FileInfo, type Result, type Skill, toError } from "./types.js";
|
import { type ExecutionEnv, type FileInfo, type Result, type Skill, toError } from "./types.ts";
|
||||||
|
|
||||||
const MAX_NAME_LENGTH = 64;
|
const MAX_NAME_LENGTH = 64;
|
||||||
const MAX_DESCRIPTION_LENGTH = 1024;
|
const MAX_DESCRIPTION_LENGTH = 1024;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Skill } from "./types.js";
|
import type { Skill } from "./types.ts";
|
||||||
|
|
||||||
export function formatSkillsForSystemPrompt(skills: Skill[]): string {
|
export function formatSkillsForSystemPrompt(skills: Skill[]): string {
|
||||||
const visibleSkills = skills.filter((skill) => !skill.disableModelInvocation);
|
const visibleSkills = skills.filter((skill) => !skill.disableModelInvocation);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { ImageContent, Model, SimpleStreamOptions, TextContent, Transport } from "@earendil-works/pi-ai";
|
import type { ImageContent, Model, SimpleStreamOptions, TextContent, Transport } from "@earendil-works/pi-ai";
|
||||||
import type { AgentEvent, AgentMessage, AgentTool, QueueMode, ThinkingLevel } from "../index.js";
|
import type { AgentEvent, AgentMessage, AgentTool, QueueMode, ThinkingLevel } from "../index.ts";
|
||||||
import type { Session } from "./session/session.js";
|
import type { Session } from "./session/session.ts";
|
||||||
|
|
||||||
/** Result of a fallible operation. Expected failures are returned as `ok: false` instead of thrown. */
|
/** Result of a fallible operation. Expected failures are returned as `ok: false` instead of thrown. */
|
||||||
export type Result<TValue, TError> = { ok: true; value: TValue } | { ok: false; error: TError };
|
export type Result<TValue, TError> = { ok: true; value: TValue } | { ok: false; error: TError };
|
||||||
@@ -446,7 +446,7 @@ export interface SessionStorage<TMetadata extends SessionMetadata = SessionMetad
|
|||||||
getEntries(): Promise<SessionTreeEntry[]>;
|
getEntries(): Promise<SessionTreeEntry[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { Session } from "./session/session.js";
|
export type { Session } from "./session/session.ts";
|
||||||
|
|
||||||
export interface SessionCreateOptions {
|
export interface SessionCreateOptions {
|
||||||
id?: string;
|
id?: string;
|
||||||
@@ -812,4 +812,4 @@ export interface AgentHarnessOptions<
|
|||||||
followUpMode?: QueueMode;
|
followUpMode?: QueueMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { AgentHarness } from "./agent-harness.js";
|
export type { AgentHarness } from "./agent-harness.ts";
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import {
|
|||||||
ok,
|
ok,
|
||||||
type Result,
|
type Result,
|
||||||
toError,
|
toError,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { DEFAULT_MAX_BYTES, truncateTail } from "./truncate.js";
|
import { DEFAULT_MAX_BYTES, truncateTail } from "./truncate.ts";
|
||||||
|
|
||||||
export interface ShellCaptureOptions extends Omit<ExecutionEnvExecOptions, "onStdout" | "onStderr"> {
|
export interface ShellCaptureOptions extends Omit<ExecutionEnvExecOptions, "onStdout" | "onStderr"> {
|
||||||
onChunk?: (chunk: string) => void;
|
onChunk?: (chunk: string) => void;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
// Core Agent
|
// Core Agent
|
||||||
export * from "./agent.js";
|
export * from "./agent.ts";
|
||||||
// Loop functions
|
// Loop functions
|
||||||
export * from "./agent-loop.js";
|
export * from "./agent-loop.ts";
|
||||||
export * from "./harness/agent-harness.js";
|
export * from "./harness/agent-harness.ts";
|
||||||
export {
|
export {
|
||||||
type BranchPreparation,
|
type BranchPreparation,
|
||||||
type BranchSummaryDetails,
|
type BranchSummaryDetails,
|
||||||
@@ -10,7 +10,7 @@ export {
|
|||||||
collectEntriesForBranchSummary,
|
collectEntriesForBranchSummary,
|
||||||
generateBranchSummary,
|
generateBranchSummary,
|
||||||
prepareBranchEntries,
|
prepareBranchEntries,
|
||||||
} from "./harness/compaction/branch-summarization.js";
|
} from "./harness/compaction/branch-summarization.ts";
|
||||||
export {
|
export {
|
||||||
calculateContextTokens,
|
calculateContextTokens,
|
||||||
compact,
|
compact,
|
||||||
@@ -24,21 +24,21 @@ export {
|
|||||||
prepareCompaction,
|
prepareCompaction,
|
||||||
serializeConversation,
|
serializeConversation,
|
||||||
shouldCompact,
|
shouldCompact,
|
||||||
} from "./harness/compaction/compaction.js";
|
} from "./harness/compaction/compaction.ts";
|
||||||
export * from "./harness/messages.js";
|
export * from "./harness/messages.ts";
|
||||||
export * from "./harness/prompt-templates.js";
|
export * from "./harness/prompt-templates.ts";
|
||||||
export * from "./harness/session/jsonl-repo.js";
|
export * from "./harness/session/jsonl-repo.ts";
|
||||||
export * from "./harness/session/memory-repo.js";
|
export * from "./harness/session/memory-repo.ts";
|
||||||
export * from "./harness/session/repo-utils.js";
|
export * from "./harness/session/repo-utils.ts";
|
||||||
export * from "./harness/session/session.js";
|
export * from "./harness/session/session.ts";
|
||||||
export { uuidv7 } from "./harness/session/uuid.js";
|
export { uuidv7 } from "./harness/session/uuid.ts";
|
||||||
export * from "./harness/skills.js";
|
export * from "./harness/skills.ts";
|
||||||
export * from "./harness/system-prompt.js";
|
export * from "./harness/system-prompt.ts";
|
||||||
// Harness
|
// Harness
|
||||||
export * from "./harness/types.js";
|
export * from "./harness/types.ts";
|
||||||
export * from "./harness/utils/shell-output.js";
|
export * from "./harness/utils/shell-output.ts";
|
||||||
export * from "./harness/utils/truncate.js";
|
export * from "./harness/utils/truncate.ts";
|
||||||
// Proxy utilities
|
// Proxy utilities
|
||||||
export * from "./proxy.js";
|
export * from "./proxy.ts";
|
||||||
// Types
|
// Types
|
||||||
export * from "./types.js";
|
export * from "./types.ts";
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
export { NodeExecutionEnv } from "./harness/env/nodejs.js";
|
export { NodeExecutionEnv } from "./harness/env/nodejs.ts";
|
||||||
export * from "./index.js";
|
export * from "./index.ts";
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ function generateImageModelsFile(models: ImagesModel<"openrouter-images">[]): st
|
|||||||
return `// This file is auto-generated by scripts/generate-image-models.ts
|
return `// This file is auto-generated by scripts/generate-image-models.ts
|
||||||
// Do not edit manually - run 'npm run generate-image-models' to update
|
// Do not edit manually - run 'npm run generate-image-models' to update
|
||||||
|
|
||||||
import type { ImagesApi, ImagesModel } from "./types.js";
|
import type { ImagesApi, ImagesModel } from "./types.ts";
|
||||||
|
|
||||||
export const IMAGE_MODELS = {
|
export const IMAGE_MODELS = {
|
||||||
${providerEntries}
|
${providerEntries}
|
||||||
|
|||||||
@@ -1863,7 +1863,7 @@ async function generateModels() {
|
|||||||
let output = `// This file is auto-generated by scripts/generate-models.ts
|
let output = `// This file is auto-generated by scripts/generate-models.ts
|
||||||
// Do not edit manually - run 'npm run generate-models' to update
|
// Do not edit manually - run 'npm run generate-models' to update
|
||||||
|
|
||||||
import type { Model } from "./types.js";
|
import type { Model } from "./types.ts";
|
||||||
|
|
||||||
export const MODELS = {
|
export const MODELS = {
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import type {
|
|||||||
SimpleStreamOptions,
|
SimpleStreamOptions,
|
||||||
StreamFunction,
|
StreamFunction,
|
||||||
StreamOptions,
|
StreamOptions,
|
||||||
} from "./types.js";
|
} from "./types.ts";
|
||||||
|
|
||||||
export type ApiStreamFunction = (
|
export type ApiStreamFunction = (
|
||||||
model: Model<Api>,
|
model: Model<Api>,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { streamBedrock, streamSimpleBedrock } from "./providers/amazon-bedrock.js";
|
import { streamBedrock, streamSimpleBedrock } from "./providers/amazon-bedrock.ts";
|
||||||
|
|
||||||
export const bedrockProviderModule = {
|
export const bedrockProviderModule = {
|
||||||
streamBedrock,
|
streamBedrock,
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
import { createInterface } from "node:readline";
|
import { createInterface } from "node:readline";
|
||||||
import { existsSync, readFileSync, writeFileSync } from "fs";
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
||||||
import { getOAuthProvider, getOAuthProviders } from "./utils/oauth/index.js";
|
import { getOAuthProvider, getOAuthProviders } from "./utils/oauth/index.ts";
|
||||||
import type { OAuthCredentials, OAuthProviderId } from "./utils/oauth/types.js";
|
import type { OAuthCredentials, OAuthProviderId } from "./utils/oauth/types.ts";
|
||||||
|
|
||||||
const AUTH_FILE = "auth.json";
|
const AUTH_FILE = "auth.json";
|
||||||
const PROVIDERS = getOAuthProviders();
|
const PROVIDERS = getOAuthProviders();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ if (typeof process !== "undefined" && (process.versions?.node || process.version
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
import type { KnownProvider } from "./types.js";
|
import type { KnownProvider } from "./types.ts";
|
||||||
|
|
||||||
let _procEnvCache: Map<string, string> | null = null;
|
let _procEnvCache: Map<string, string> | null = null;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// This file is auto-generated by scripts/generate-image-models.ts
|
// This file is auto-generated by scripts/generate-image-models.ts
|
||||||
// Do not edit manually - run 'npm run generate-image-models' to update
|
// Do not edit manually - run 'npm run generate-image-models' to update
|
||||||
|
|
||||||
import type { ImagesApi, ImagesModel } from "./types.js";
|
import type { ImagesApi, ImagesModel } from "./types.ts";
|
||||||
|
|
||||||
export const IMAGE_MODELS = {
|
export const IMAGE_MODELS = {
|
||||||
openrouter: {
|
openrouter: {
|
||||||
@@ -425,5 +425,20 @@ export const IMAGE_MODELS = {
|
|||||||
cacheWrite: 0,
|
cacheWrite: 0,
|
||||||
},
|
},
|
||||||
} satisfies ImagesModel<"openrouter-images">,
|
} satisfies ImagesModel<"openrouter-images">,
|
||||||
|
"x-ai/grok-imagine-image-quality": {
|
||||||
|
id: "x-ai/grok-imagine-image-quality",
|
||||||
|
name: "xAI: Grok Imagine Image Quality",
|
||||||
|
api: "openrouter-images",
|
||||||
|
provider: "openrouter",
|
||||||
|
baseUrl: "https://openrouter.ai/api/v1",
|
||||||
|
input: ["text", "image"],
|
||||||
|
output: ["image"],
|
||||||
|
cost: {
|
||||||
|
input: 0,
|
||||||
|
output: 0,
|
||||||
|
cacheRead: 0,
|
||||||
|
cacheWrite: 0,
|
||||||
|
},
|
||||||
|
} satisfies ImagesModel<"openrouter-images">,
|
||||||
},
|
},
|
||||||
} as const satisfies Record<string, Record<string, ImagesModel<ImagesApi>>>;
|
} as const satisfies Record<string, Record<string, ImagesModel<ImagesApi>>>;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { IMAGE_MODELS } from "./image-models.generated.js";
|
import { IMAGE_MODELS } from "./image-models.generated.ts";
|
||||||
import type { ImagesApi, ImagesModel, KnownImagesProvider } from "./types.js";
|
import type { ImagesApi, ImagesModel, KnownImagesProvider } from "./types.ts";
|
||||||
|
|
||||||
const imageModelRegistry: Map<string, Map<string, ImagesModel<ImagesApi>>> = new Map();
|
const imageModelRegistry: Map<string, Map<string, ImagesModel<ImagesApi>>> = new Map();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { AssistantImages, ImagesApi, ImagesContext, ImagesFunction, ImagesModel, ImagesOptions } from "./types.js";
|
import type { AssistantImages, ImagesApi, ImagesContext, ImagesFunction, ImagesModel, ImagesOptions } from "./types.ts";
|
||||||
|
|
||||||
export type ImagesApiFunction = (
|
export type ImagesApiFunction = (
|
||||||
model: ImagesModel<ImagesApi>,
|
model: ImagesModel<ImagesApi>,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "./providers/images/register-builtins.js";
|
import "./providers/images/register-builtins.ts";
|
||||||
|
|
||||||
import { getImagesApiProvider } from "./images-api-registry.js";
|
import { getImagesApiProvider } from "./images-api-registry.ts";
|
||||||
import type { AssistantImages, ImagesApi, ImagesContext, ImagesModel, ProviderImagesOptions } from "./types.js";
|
import type { AssistantImages, ImagesApi, ImagesContext, ImagesModel, ProviderImagesOptions } from "./types.ts";
|
||||||
|
|
||||||
function resolveImagesApiProvider(api: ImagesApi) {
|
function resolveImagesApiProvider(api: ImagesApi) {
|
||||||
const provider = getImagesApiProvider(api);
|
const provider = getImagesApiProvider(api);
|
||||||
|
|||||||
@@ -1,34 +1,34 @@
|
|||||||
export type { Static, TSchema } from "typebox";
|
export type { Static, TSchema } from "typebox";
|
||||||
export { Type } from "typebox";
|
export { Type } from "typebox";
|
||||||
|
|
||||||
export * from "./api-registry.js";
|
export * from "./api-registry.ts";
|
||||||
export * from "./env-api-keys.js";
|
export * from "./env-api-keys.ts";
|
||||||
export * from "./image-models.js";
|
export * from "./image-models.ts";
|
||||||
export * from "./images.js";
|
export * from "./images.ts";
|
||||||
export * from "./images-api-registry.js";
|
export * from "./images-api-registry.ts";
|
||||||
export * from "./models.js";
|
export * from "./models.ts";
|
||||||
export type { BedrockOptions, BedrockThinkingDisplay } from "./providers/amazon-bedrock.js";
|
export type { BedrockOptions, BedrockThinkingDisplay } from "./providers/amazon-bedrock.ts";
|
||||||
export type { AnthropicEffort, AnthropicOptions, AnthropicThinkingDisplay } from "./providers/anthropic.js";
|
export type { AnthropicEffort, AnthropicOptions, AnthropicThinkingDisplay } from "./providers/anthropic.ts";
|
||||||
export type { AzureOpenAIResponsesOptions } from "./providers/azure-openai-responses.js";
|
export type { AzureOpenAIResponsesOptions } from "./providers/azure-openai-responses.ts";
|
||||||
export * from "./providers/faux.js";
|
export * from "./providers/faux.ts";
|
||||||
export type { GoogleOptions } from "./providers/google.js";
|
export type { GoogleOptions } from "./providers/google.ts";
|
||||||
export type { GoogleThinkingLevel } from "./providers/google-shared.js";
|
export type { GoogleThinkingLevel } from "./providers/google-shared.ts";
|
||||||
export type { GoogleVertexOptions } from "./providers/google-vertex.js";
|
export type { GoogleVertexOptions } from "./providers/google-vertex.ts";
|
||||||
export * from "./providers/images/register-builtins.js";
|
export * from "./providers/images/register-builtins.ts";
|
||||||
export type { MistralOptions } from "./providers/mistral.js";
|
export type { MistralOptions } from "./providers/mistral.ts";
|
||||||
export type {
|
export type {
|
||||||
OpenAICodexResponsesOptions,
|
OpenAICodexResponsesOptions,
|
||||||
OpenAICodexWebSocketDebugStats,
|
OpenAICodexWebSocketDebugStats,
|
||||||
} from "./providers/openai-codex-responses.js";
|
} from "./providers/openai-codex-responses.ts";
|
||||||
export type { OpenAICompletionsOptions } from "./providers/openai-completions.js";
|
export type { OpenAICompletionsOptions } from "./providers/openai-completions.ts";
|
||||||
export type { OpenAIResponsesOptions } from "./providers/openai-responses.js";
|
export type { OpenAIResponsesOptions } from "./providers/openai-responses.ts";
|
||||||
export * from "./providers/register-builtins.js";
|
export * from "./providers/register-builtins.ts";
|
||||||
export * from "./session-resources.js";
|
export * from "./session-resources.ts";
|
||||||
export * from "./stream.js";
|
export * from "./stream.ts";
|
||||||
export * from "./types.js";
|
export * from "./types.ts";
|
||||||
export * from "./utils/diagnostics.js";
|
export * from "./utils/diagnostics.ts";
|
||||||
export * from "./utils/event-stream.js";
|
export * from "./utils/event-stream.ts";
|
||||||
export * from "./utils/json-parse.js";
|
export * from "./utils/json-parse.ts";
|
||||||
export type {
|
export type {
|
||||||
OAuthAuthInfo,
|
OAuthAuthInfo,
|
||||||
OAuthCredentials,
|
OAuthCredentials,
|
||||||
@@ -40,7 +40,7 @@ export type {
|
|||||||
OAuthProviderInterface,
|
OAuthProviderInterface,
|
||||||
OAuthSelectOption,
|
OAuthSelectOption,
|
||||||
OAuthSelectPrompt,
|
OAuthSelectPrompt,
|
||||||
} from "./utils/oauth/types.js";
|
} from "./utils/oauth/types.ts";
|
||||||
export * from "./utils/overflow.js";
|
export * from "./utils/overflow.ts";
|
||||||
export * from "./utils/typebox-helpers.js";
|
export * from "./utils/typebox-helpers.ts";
|
||||||
export * from "./utils/validation.js";
|
export * from "./utils/validation.ts";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// This file is auto-generated by scripts/generate-models.ts
|
// This file is auto-generated by scripts/generate-models.ts
|
||||||
// Do not edit manually - run 'npm run generate-models' to update
|
// Do not edit manually - run 'npm run generate-models' to update
|
||||||
|
|
||||||
import type { Model } from "./types.js";
|
import type { Model } from "./types.ts";
|
||||||
|
|
||||||
export const MODELS = {
|
export const MODELS = {
|
||||||
"amazon-bedrock": {
|
"amazon-bedrock": {
|
||||||
@@ -911,8 +911,8 @@ export const MODELS = {
|
|||||||
cacheRead: 0,
|
cacheRead: 0,
|
||||||
cacheWrite: 0,
|
cacheWrite: 0,
|
||||||
},
|
},
|
||||||
contextWindow: 256000,
|
contextWindow: 262143,
|
||||||
maxTokens: 256000,
|
maxTokens: 16000,
|
||||||
} satisfies Model<"bedrock-converse-stream">,
|
} satisfies Model<"bedrock-converse-stream">,
|
||||||
"moonshotai.kimi-k2.5": {
|
"moonshotai.kimi-k2.5": {
|
||||||
id: "moonshotai.kimi-k2.5",
|
id: "moonshotai.kimi-k2.5",
|
||||||
@@ -928,8 +928,8 @@ export const MODELS = {
|
|||||||
cacheRead: 0,
|
cacheRead: 0,
|
||||||
cacheWrite: 0,
|
cacheWrite: 0,
|
||||||
},
|
},
|
||||||
contextWindow: 256000,
|
contextWindow: 262143,
|
||||||
maxTokens: 256000,
|
maxTokens: 16000,
|
||||||
} satisfies Model<"bedrock-converse-stream">,
|
} satisfies Model<"bedrock-converse-stream">,
|
||||||
"nvidia.nemotron-nano-12b-v2": {
|
"nvidia.nemotron-nano-12b-v2": {
|
||||||
id: "nvidia.nemotron-nano-12b-v2",
|
id: "nvidia.nemotron-nano-12b-v2",
|
||||||
@@ -3482,6 +3482,24 @@ export const MODELS = {
|
|||||||
contextWindow: 160000,
|
contextWindow: 160000,
|
||||||
maxTokens: 160000,
|
maxTokens: 160000,
|
||||||
} satisfies Model<"anthropic-messages">,
|
} satisfies Model<"anthropic-messages">,
|
||||||
|
"accounts/fireworks/models/deepseek-v4-flash": {
|
||||||
|
id: "accounts/fireworks/models/deepseek-v4-flash",
|
||||||
|
name: "DeepSeek V4 Flash",
|
||||||
|
api: "anthropic-messages",
|
||||||
|
provider: "fireworks",
|
||||||
|
baseUrl: "https://api.fireworks.ai/inference",
|
||||||
|
compat: {"sendSessionAffinityHeaders":true,"supportsEagerToolInputStreaming":false,"supportsCacheControlOnTools":false,"supportsLongCacheRetention":false},
|
||||||
|
reasoning: true,
|
||||||
|
input: ["text"],
|
||||||
|
cost: {
|
||||||
|
input: 0.14,
|
||||||
|
output: 0.28,
|
||||||
|
cacheRead: 0.03,
|
||||||
|
cacheWrite: 0,
|
||||||
|
},
|
||||||
|
contextWindow: 1000000,
|
||||||
|
maxTokens: 384000,
|
||||||
|
} satisfies Model<"anthropic-messages">,
|
||||||
"accounts/fireworks/models/deepseek-v4-pro": {
|
"accounts/fireworks/models/deepseek-v4-pro": {
|
||||||
id: "accounts/fireworks/models/deepseek-v4-pro",
|
id: "accounts/fireworks/models/deepseek-v4-pro",
|
||||||
name: "DeepSeek V4 Pro",
|
name: "DeepSeek V4 Pro",
|
||||||
@@ -4514,6 +4532,24 @@ export const MODELS = {
|
|||||||
contextWindow: 1048576,
|
contextWindow: 1048576,
|
||||||
maxTokens: 65536,
|
maxTokens: 65536,
|
||||||
} satisfies Model<"google-generative-ai">,
|
} satisfies Model<"google-generative-ai">,
|
||||||
|
"gemini-3.5-flash": {
|
||||||
|
id: "gemini-3.5-flash",
|
||||||
|
name: "Gemini 3.5 Flash",
|
||||||
|
api: "google-generative-ai",
|
||||||
|
provider: "google",
|
||||||
|
baseUrl: "https://generativelanguage.googleapis.com/v1beta",
|
||||||
|
reasoning: true,
|
||||||
|
thinkingLevelMap: {"off":null},
|
||||||
|
input: ["text", "image"],
|
||||||
|
cost: {
|
||||||
|
input: 1.5,
|
||||||
|
output: 9,
|
||||||
|
cacheRead: 0.15,
|
||||||
|
cacheWrite: 0,
|
||||||
|
},
|
||||||
|
contextWindow: 1048576,
|
||||||
|
maxTokens: 65536,
|
||||||
|
} satisfies Model<"google-generative-ai">,
|
||||||
"gemini-flash-latest": {
|
"gemini-flash-latest": {
|
||||||
id: "gemini-flash-latest",
|
id: "gemini-flash-latest",
|
||||||
name: "Gemini Flash Latest",
|
name: "Gemini Flash Latest",
|
||||||
@@ -9194,6 +9230,23 @@ export const MODELS = {
|
|||||||
contextWindow: 1048756,
|
contextWindow: 1048756,
|
||||||
maxTokens: 65536,
|
maxTokens: 65536,
|
||||||
} satisfies Model<"openai-completions">,
|
} satisfies Model<"openai-completions">,
|
||||||
|
"google/gemini-3.5-flash": {
|
||||||
|
id: "google/gemini-3.5-flash",
|
||||||
|
name: "Google: Gemini 3.5 Flash",
|
||||||
|
api: "openai-completions",
|
||||||
|
provider: "openrouter",
|
||||||
|
baseUrl: "https://openrouter.ai/api/v1",
|
||||||
|
reasoning: true,
|
||||||
|
input: ["text", "image"],
|
||||||
|
cost: {
|
||||||
|
input: 1.5,
|
||||||
|
output: 9,
|
||||||
|
cacheRead: 0.15,
|
||||||
|
cacheWrite: 0.08333333333333334,
|
||||||
|
},
|
||||||
|
contextWindow: 1048576,
|
||||||
|
maxTokens: 65536,
|
||||||
|
} satisfies Model<"openai-completions">,
|
||||||
"google/gemma-3-12b-it": {
|
"google/gemma-3-12b-it": {
|
||||||
id: "google/gemma-3-12b-it",
|
id: "google/gemma-3-12b-it",
|
||||||
name: "Google: Gemma 3 12B",
|
name: "Google: Gemma 3 12B",
|
||||||
@@ -11868,13 +11921,13 @@ export const MODELS = {
|
|||||||
reasoning: true,
|
reasoning: true,
|
||||||
input: ["text", "image"],
|
input: ["text", "image"],
|
||||||
cost: {
|
cost: {
|
||||||
input: 0.14,
|
input: 0.13899999999999998,
|
||||||
output: 1,
|
output: 1,
|
||||||
cacheRead: 0.049999999999999996,
|
cacheRead: 0,
|
||||||
cacheWrite: 0,
|
cacheWrite: 0,
|
||||||
},
|
},
|
||||||
contextWindow: 262144,
|
contextWindow: 262144,
|
||||||
maxTokens: 81920,
|
maxTokens: 4096,
|
||||||
} satisfies Model<"openai-completions">,
|
} satisfies Model<"openai-completions">,
|
||||||
"qwen/qwen3.5-397b-a17b": {
|
"qwen/qwen3.5-397b-a17b": {
|
||||||
id: "qwen/qwen3.5-397b-a17b",
|
id: "qwen/qwen3.5-397b-a17b",
|
||||||
@@ -12514,13 +12567,13 @@ export const MODELS = {
|
|||||||
reasoning: true,
|
reasoning: true,
|
||||||
input: ["text"],
|
input: ["text"],
|
||||||
cost: {
|
cost: {
|
||||||
input: 0.98,
|
input: 0,
|
||||||
output: 3.08,
|
output: 0,
|
||||||
cacheRead: 0.182,
|
cacheRead: 0,
|
||||||
cacheWrite: 0,
|
cacheWrite: 0,
|
||||||
},
|
},
|
||||||
contextWindow: 202752,
|
contextWindow: 202800,
|
||||||
maxTokens: 4096,
|
maxTokens: 202800,
|
||||||
} satisfies Model<"openai-completions">,
|
} satisfies Model<"openai-completions">,
|
||||||
"z-ai/glm-5v-turbo": {
|
"z-ai/glm-5v-turbo": {
|
||||||
id: "z-ai/glm-5v-turbo",
|
id: "z-ai/glm-5v-turbo",
|
||||||
@@ -12599,9 +12652,9 @@ export const MODELS = {
|
|||||||
reasoning: true,
|
reasoning: true,
|
||||||
input: ["text", "image"],
|
input: ["text", "image"],
|
||||||
cost: {
|
cost: {
|
||||||
input: 0.5,
|
input: 1.5,
|
||||||
output: 3,
|
output: 9,
|
||||||
cacheRead: 0.049999999999999996,
|
cacheRead: 0.15,
|
||||||
cacheWrite: 0.08333333333333334,
|
cacheWrite: 0.08333333333333334,
|
||||||
},
|
},
|
||||||
contextWindow: 1048576,
|
contextWindow: 1048576,
|
||||||
@@ -13868,6 +13921,23 @@ export const MODELS = {
|
|||||||
contextWindow: 1000000,
|
contextWindow: 1000000,
|
||||||
maxTokens: 64000,
|
maxTokens: 64000,
|
||||||
} satisfies Model<"anthropic-messages">,
|
} satisfies Model<"anthropic-messages">,
|
||||||
|
"google/gemini-3.5-flash": {
|
||||||
|
id: "google/gemini-3.5-flash",
|
||||||
|
name: "Gemini 3.5 Flash",
|
||||||
|
api: "anthropic-messages",
|
||||||
|
provider: "vercel-ai-gateway",
|
||||||
|
baseUrl: "https://ai-gateway.vercel.sh",
|
||||||
|
reasoning: true,
|
||||||
|
input: ["text", "image"],
|
||||||
|
cost: {
|
||||||
|
input: 1.5,
|
||||||
|
output: 9,
|
||||||
|
cacheRead: 0.15,
|
||||||
|
cacheWrite: 0,
|
||||||
|
},
|
||||||
|
contextWindow: 1000000,
|
||||||
|
maxTokens: 64000,
|
||||||
|
} satisfies Model<"anthropic-messages">,
|
||||||
"google/gemma-4-26b-a4b-it": {
|
"google/gemma-4-26b-a4b-it": {
|
||||||
id: "google/gemma-4-26b-a4b-it",
|
id: "google/gemma-4-26b-a4b-it",
|
||||||
name: "Gemma 4 26B A4B IT",
|
name: "Gemma 4 26B A4B IT",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { MODELS } from "./models.generated.js";
|
import { MODELS } from "./models.generated.ts";
|
||||||
import type { Api, KnownProvider, Model, ModelThinkingLevel, Usage } from "./types.js";
|
import type { Api, KnownProvider, Model, ModelThinkingLevel, Usage } from "./types.ts";
|
||||||
|
|
||||||
const modelRegistry: Map<string, Map<string, Model<Api>>> = new Map();
|
const modelRegistry: Map<string, Map<string, Model<Api>>> = new Map();
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
export * from "./utils/oauth/index.js";
|
export * from "./utils/oauth/index.ts";
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import {
|
|||||||
} from "@aws-sdk/client-bedrock-runtime";
|
} from "@aws-sdk/client-bedrock-runtime";
|
||||||
import { NodeHttpHandler } from "@smithy/node-http-handler";
|
import { NodeHttpHandler } from "@smithy/node-http-handler";
|
||||||
import type { DocumentType } from "@smithy/types";
|
import type { DocumentType } from "@smithy/types";
|
||||||
import { calculateCost } from "../models.js";
|
import { calculateCost } from "../models.ts";
|
||||||
import type {
|
import type {
|
||||||
Api,
|
Api,
|
||||||
AssistantMessage,
|
AssistantMessage,
|
||||||
@@ -40,13 +40,13 @@ import type {
|
|||||||
Tool,
|
Tool,
|
||||||
ToolCall,
|
ToolCall,
|
||||||
ToolResultMessage,
|
ToolResultMessage,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
import { AssistantMessageEventStream } from "../utils/event-stream.ts";
|
||||||
import { parseStreamingJson } from "../utils/json-parse.js";
|
import { parseStreamingJson } from "../utils/json-parse.ts";
|
||||||
import { createHttpProxyAgentsForTarget } from "../utils/node-http-proxy.js";
|
import { createHttpProxyAgentsForTarget } from "../utils/node-http-proxy.ts";
|
||||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.ts";
|
||||||
import { adjustMaxTokensForThinking, buildBaseOptions, clampReasoning } from "./simple-options.js";
|
import { adjustMaxTokensForThinking, buildBaseOptions, clampReasoning } from "./simple-options.ts";
|
||||||
import { transformMessages } from "./transform-messages.js";
|
import { transformMessages } from "./transform-messages.ts";
|
||||||
|
|
||||||
export type BedrockThinkingDisplay = "summarized" | "omitted";
|
export type BedrockThinkingDisplay = "summarized" | "omitted";
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import type {
|
|||||||
MessageParam,
|
MessageParam,
|
||||||
RawMessageStreamEvent,
|
RawMessageStreamEvent,
|
||||||
} from "@anthropic-ai/sdk/resources/messages.js";
|
} from "@anthropic-ai/sdk/resources/messages.js";
|
||||||
import { getEnvApiKey } from "../env-api-keys.js";
|
import { getEnvApiKey } from "../env-api-keys.ts";
|
||||||
import { calculateCost } from "../models.js";
|
import { calculateCost } from "../models.ts";
|
||||||
import type {
|
import type {
|
||||||
AnthropicMessagesCompat,
|
AnthropicMessagesCompat,
|
||||||
Api,
|
Api,
|
||||||
@@ -26,16 +26,16 @@ import type {
|
|||||||
Tool,
|
Tool,
|
||||||
ToolCall,
|
ToolCall,
|
||||||
ToolResultMessage,
|
ToolResultMessage,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
import { AssistantMessageEventStream } from "../utils/event-stream.ts";
|
||||||
import { headersToRecord } from "../utils/headers.js";
|
import { headersToRecord } from "../utils/headers.ts";
|
||||||
import { parseJsonWithRepair, parseStreamingJson } from "../utils/json-parse.js";
|
import { parseJsonWithRepair, parseStreamingJson } from "../utils/json-parse.ts";
|
||||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.ts";
|
||||||
|
|
||||||
import { resolveCloudflareBaseUrl } from "./cloudflare.js";
|
import { resolveCloudflareBaseUrl } from "./cloudflare.ts";
|
||||||
import { buildCopilotDynamicHeaders, hasCopilotVisionInput } from "./github-copilot-headers.js";
|
import { buildCopilotDynamicHeaders, hasCopilotVisionInput } from "./github-copilot-headers.ts";
|
||||||
import { adjustMaxTokensForThinking, buildBaseOptions } from "./simple-options.js";
|
import { adjustMaxTokensForThinking, buildBaseOptions } from "./simple-options.ts";
|
||||||
import { transformMessages } from "./transform-messages.js";
|
import { transformMessages } from "./transform-messages.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve cache retention preference.
|
* Resolve cache retention preference.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { AzureOpenAI } from "openai";
|
import { AzureOpenAI } from "openai";
|
||||||
import type { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
import type { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
||||||
import { getEnvApiKey } from "../env-api-keys.js";
|
import { getEnvApiKey } from "../env-api-keys.ts";
|
||||||
import { clampThinkingLevel } from "../models.js";
|
import { clampThinkingLevel } from "../models.ts";
|
||||||
import type {
|
import type {
|
||||||
Api,
|
Api,
|
||||||
AssistantMessage,
|
AssistantMessage,
|
||||||
@@ -10,12 +10,12 @@ import type {
|
|||||||
SimpleStreamOptions,
|
SimpleStreamOptions,
|
||||||
StreamFunction,
|
StreamFunction,
|
||||||
StreamOptions,
|
StreamOptions,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
import { AssistantMessageEventStream } from "../utils/event-stream.ts";
|
||||||
import { headersToRecord } from "../utils/headers.js";
|
import { headersToRecord } from "../utils/headers.ts";
|
||||||
import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.js";
|
import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.ts";
|
||||||
import { convertResponsesMessages, convertResponsesTools, processResponsesStream } from "./openai-responses-shared.js";
|
import { convertResponsesMessages, convertResponsesTools, processResponsesStream } from "./openai-responses-shared.ts";
|
||||||
import { buildBaseOptions } from "./simple-options.js";
|
import { buildBaseOptions } from "./simple-options.ts";
|
||||||
|
|
||||||
const DEFAULT_AZURE_API_VERSION = "v1";
|
const DEFAULT_AZURE_API_VERSION = "v1";
|
||||||
const AZURE_TOOL_CALL_PROVIDERS = new Set(["openai", "openai-codex", "opencode", "azure-openai-responses"]);
|
const AZURE_TOOL_CALL_PROVIDERS = new Set(["openai", "openai-codex", "opencode", "azure-openai-responses"]);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Api, Model } from "../types.js";
|
import type { Api, Model } from "../types.ts";
|
||||||
|
|
||||||
/** Workers AI direct endpoint. */
|
/** Workers AI direct endpoint. */
|
||||||
export const CLOUDFLARE_WORKERS_AI_BASE_URL =
|
export const CLOUDFLARE_WORKERS_AI_BASE_URL =
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { registerApiProvider, unregisterApiProviders } from "../api-registry.js";
|
import { registerApiProvider, unregisterApiProviders } from "../api-registry.ts";
|
||||||
import type {
|
import type {
|
||||||
AssistantMessage,
|
AssistantMessage,
|
||||||
AssistantMessageEventStream,
|
AssistantMessageEventStream,
|
||||||
@@ -14,8 +14,8 @@ import type {
|
|||||||
ToolCall,
|
ToolCall,
|
||||||
ToolResultMessage,
|
ToolResultMessage,
|
||||||
Usage,
|
Usage,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { createAssistantMessageEventStream } from "../utils/event-stream.js";
|
import { createAssistantMessageEventStream } from "../utils/event-stream.ts";
|
||||||
|
|
||||||
const DEFAULT_API = "faux";
|
const DEFAULT_API = "faux";
|
||||||
const DEFAULT_PROVIDER = "faux";
|
const DEFAULT_PROVIDER = "faux";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Message } from "../types.js";
|
import type { Message } from "../types.ts";
|
||||||
|
|
||||||
// Copilot expects X-Initiator to indicate whether the request is user-initiated
|
// Copilot expects X-Initiator to indicate whether the request is user-initiated
|
||||||
// or agent-initiated (e.g. follow-up after assistant/tool messages).
|
// or agent-initiated (e.g. follow-up after assistant/tool messages).
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { type Content, FinishReason, FunctionCallingConfigMode, type Part } from "@google/genai";
|
import { type Content, FinishReason, FunctionCallingConfigMode, type Part } from "@google/genai";
|
||||||
import type { Context, ImageContent, Model, StopReason, TextContent, Tool } from "../types.js";
|
import type { Context, ImageContent, Model, StopReason, TextContent, Tool } from "../types.ts";
|
||||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.ts";
|
||||||
import { transformMessages } from "./transform-messages.js";
|
import { transformMessages } from "./transform-messages.ts";
|
||||||
|
|
||||||
type GoogleApiType = "google-generative-ai" | "google-vertex";
|
type GoogleApiType = "google-generative-ai" | "google-vertex";
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
type ThinkingConfig,
|
type ThinkingConfig,
|
||||||
ThinkingLevel,
|
ThinkingLevel,
|
||||||
} from "@google/genai";
|
} from "@google/genai";
|
||||||
import { calculateCost, clampThinkingLevel } from "../models.js";
|
import { calculateCost, clampThinkingLevel } from "../models.ts";
|
||||||
import type {
|
import type {
|
||||||
Api,
|
Api,
|
||||||
AssistantMessage,
|
AssistantMessage,
|
||||||
@@ -21,10 +21,10 @@ import type {
|
|||||||
ThinkingBudgets,
|
ThinkingBudgets,
|
||||||
ThinkingContent,
|
ThinkingContent,
|
||||||
ToolCall,
|
ToolCall,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
import { AssistantMessageEventStream } from "../utils/event-stream.ts";
|
||||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.ts";
|
||||||
import type { GoogleThinkingLevel } from "./google-shared.js";
|
import type { GoogleThinkingLevel } from "./google-shared.ts";
|
||||||
import {
|
import {
|
||||||
convertMessages,
|
convertMessages,
|
||||||
convertTools,
|
convertTools,
|
||||||
@@ -32,8 +32,8 @@ import {
|
|||||||
mapStopReason,
|
mapStopReason,
|
||||||
mapToolChoice,
|
mapToolChoice,
|
||||||
retainThoughtSignature,
|
retainThoughtSignature,
|
||||||
} from "./google-shared.js";
|
} from "./google-shared.ts";
|
||||||
import { buildBaseOptions } from "./simple-options.js";
|
import { buildBaseOptions } from "./simple-options.ts";
|
||||||
|
|
||||||
export interface GoogleVertexOptions extends StreamOptions {
|
export interface GoogleVertexOptions extends StreamOptions {
|
||||||
toolChoice?: "auto" | "none" | "any";
|
toolChoice?: "auto" | "none" | "any";
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import {
|
|||||||
GoogleGenAI,
|
GoogleGenAI,
|
||||||
type ThinkingConfig,
|
type ThinkingConfig,
|
||||||
} from "@google/genai";
|
} from "@google/genai";
|
||||||
import { getEnvApiKey } from "../env-api-keys.js";
|
import { getEnvApiKey } from "../env-api-keys.ts";
|
||||||
import { calculateCost, clampThinkingLevel } from "../models.js";
|
import { calculateCost, clampThinkingLevel } from "../models.ts";
|
||||||
import type {
|
import type {
|
||||||
Api,
|
Api,
|
||||||
AssistantMessage,
|
AssistantMessage,
|
||||||
@@ -19,10 +19,10 @@ import type {
|
|||||||
ThinkingContent,
|
ThinkingContent,
|
||||||
ThinkingLevel,
|
ThinkingLevel,
|
||||||
ToolCall,
|
ToolCall,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
import { AssistantMessageEventStream } from "../utils/event-stream.ts";
|
||||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.ts";
|
||||||
import type { GoogleThinkingLevel } from "./google-shared.js";
|
import type { GoogleThinkingLevel } from "./google-shared.ts";
|
||||||
import {
|
import {
|
||||||
convertMessages,
|
convertMessages,
|
||||||
convertTools,
|
convertTools,
|
||||||
@@ -30,8 +30,8 @@ import {
|
|||||||
mapStopReason,
|
mapStopReason,
|
||||||
mapToolChoice,
|
mapToolChoice,
|
||||||
retainThoughtSignature,
|
retainThoughtSignature,
|
||||||
} from "./google-shared.js";
|
} from "./google-shared.ts";
|
||||||
import { buildBaseOptions } from "./simple-options.js";
|
import { buildBaseOptions } from "./simple-options.ts";
|
||||||
|
|
||||||
export interface GoogleOptions extends StreamOptions {
|
export interface GoogleOptions extends StreamOptions {
|
||||||
toolChoice?: "auto" | "none" | "any";
|
toolChoice?: "auto" | "none" | "any";
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import type {
|
|||||||
ChatCompletionContentPartText,
|
ChatCompletionContentPartText,
|
||||||
ChatCompletionCreateParamsNonStreaming,
|
ChatCompletionCreateParamsNonStreaming,
|
||||||
} from "openai/resources/chat/completions.js";
|
} from "openai/resources/chat/completions.js";
|
||||||
import { getEnvApiKey } from "../../env-api-keys.js";
|
import { getEnvApiKey } from "../../env-api-keys.ts";
|
||||||
import type {
|
import type {
|
||||||
AssistantImages,
|
AssistantImages,
|
||||||
ImageContent,
|
ImageContent,
|
||||||
@@ -15,9 +15,9 @@ import type {
|
|||||||
ImagesModel,
|
ImagesModel,
|
||||||
ImagesOptions,
|
ImagesOptions,
|
||||||
TextContent,
|
TextContent,
|
||||||
} from "../../types.js";
|
} from "../../types.ts";
|
||||||
import { headersToRecord } from "../../utils/headers.js";
|
import { headersToRecord } from "../../utils/headers.ts";
|
||||||
import { sanitizeSurrogates } from "../../utils/sanitize-unicode.js";
|
import { sanitizeSurrogates } from "../../utils/sanitize-unicode.ts";
|
||||||
|
|
||||||
interface OpenRouterGeneratedImage {
|
interface OpenRouterGeneratedImage {
|
||||||
image_url?: string | { url?: string };
|
image_url?: string | { url?: string };
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { registerImagesApiProvider } from "../../images-api-registry.js";
|
import { registerImagesApiProvider } from "../../images-api-registry.ts";
|
||||||
import type { AssistantImages, ImagesContext, ImagesFunction, ImagesModel, ImagesOptions } from "../../types.js";
|
import type { AssistantImages, ImagesContext, ImagesFunction, ImagesModel, ImagesOptions } from "../../types.ts";
|
||||||
import type { generateImagesOpenRouter as generateImagesOpenRouterFunction } from "./openrouter.js";
|
import type { generateImagesOpenRouter as generateImagesOpenRouterFunction } from "./openrouter.ts";
|
||||||
|
|
||||||
interface OpenRouterImagesProviderModule {
|
interface OpenRouterImagesProviderModule {
|
||||||
generateImagesOpenRouter: typeof generateImagesOpenRouterFunction;
|
generateImagesOpenRouter: typeof generateImagesOpenRouterFunction;
|
||||||
@@ -21,7 +21,7 @@ function createLazyLoadErrorImages(model: ImagesModel<"openrouter-images">, erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadOpenRouterImagesProviderModule(): Promise<OpenRouterImagesProviderModule> {
|
function loadOpenRouterImagesProviderModule(): Promise<OpenRouterImagesProviderModule> {
|
||||||
openRouterImagesProviderModulePromise ||= import("./openrouter.js").then(
|
openRouterImagesProviderModulePromise ||= import("./openrouter.ts").then(
|
||||||
(module) => module as OpenRouterImagesProviderModule,
|
(module) => module as OpenRouterImagesProviderModule,
|
||||||
);
|
);
|
||||||
return openRouterImagesProviderModulePromise;
|
return openRouterImagesProviderModulePromise;
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import type {
|
|||||||
ContentChunk,
|
ContentChunk,
|
||||||
FunctionTool,
|
FunctionTool,
|
||||||
} from "@mistralai/mistralai/models/components";
|
} from "@mistralai/mistralai/models/components";
|
||||||
import { getEnvApiKey } from "../env-api-keys.js";
|
import { getEnvApiKey } from "../env-api-keys.ts";
|
||||||
import { calculateCost, clampThinkingLevel } from "../models.js";
|
import { calculateCost, clampThinkingLevel } from "../models.ts";
|
||||||
import type {
|
import type {
|
||||||
AssistantMessage,
|
AssistantMessage,
|
||||||
Context,
|
Context,
|
||||||
@@ -21,13 +21,13 @@ import type {
|
|||||||
ThinkingContent,
|
ThinkingContent,
|
||||||
Tool,
|
Tool,
|
||||||
ToolCall,
|
ToolCall,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
import { AssistantMessageEventStream } from "../utils/event-stream.ts";
|
||||||
import { shortHash } from "../utils/hash.js";
|
import { shortHash } from "../utils/hash.ts";
|
||||||
import { parseStreamingJson } from "../utils/json-parse.js";
|
import { parseStreamingJson } from "../utils/json-parse.ts";
|
||||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.ts";
|
||||||
import { buildBaseOptions } from "./simple-options.js";
|
import { buildBaseOptions } from "./simple-options.ts";
|
||||||
import { transformMessages } from "./transform-messages.js";
|
import { transformMessages } from "./transform-messages.ts";
|
||||||
|
|
||||||
const MISTRAL_TOOL_CALL_ID_LENGTH = 9;
|
const MISTRAL_TOOL_CALL_ID_LENGTH = 9;
|
||||||
const MAX_MISTRAL_ERROR_BODY_CHARS = 4000;
|
const MAX_MISTRAL_ERROR_BODY_CHARS = 4000;
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ if (typeof process !== "undefined" && (process.versions?.node || process.version
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
import { getEnvApiKey } from "../env-api-keys.js";
|
import { getEnvApiKey } from "../env-api-keys.ts";
|
||||||
import { clampThinkingLevel } from "../models.js";
|
import { clampThinkingLevel } from "../models.ts";
|
||||||
import { registerSessionResourceCleanup } from "../session-resources.js";
|
import { registerSessionResourceCleanup } from "../session-resources.ts";
|
||||||
import type {
|
import type {
|
||||||
Api,
|
Api,
|
||||||
AssistantMessage,
|
AssistantMessage,
|
||||||
@@ -32,17 +32,17 @@ import type {
|
|||||||
StreamFunction,
|
StreamFunction,
|
||||||
StreamOptions,
|
StreamOptions,
|
||||||
Usage,
|
Usage,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import {
|
import {
|
||||||
appendAssistantMessageDiagnostic,
|
appendAssistantMessageDiagnostic,
|
||||||
createAssistantMessageDiagnostic,
|
createAssistantMessageDiagnostic,
|
||||||
formatThrownValue,
|
formatThrownValue,
|
||||||
} from "../utils/diagnostics.js";
|
} from "../utils/diagnostics.ts";
|
||||||
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
import { AssistantMessageEventStream } from "../utils/event-stream.ts";
|
||||||
import { headersToRecord } from "../utils/headers.js";
|
import { headersToRecord } from "../utils/headers.ts";
|
||||||
import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.js";
|
import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.ts";
|
||||||
import { convertResponsesMessages, convertResponsesTools, processResponsesStream } from "./openai-responses-shared.js";
|
import { convertResponsesMessages, convertResponsesTools, processResponsesStream } from "./openai-responses-shared.ts";
|
||||||
import { buildBaseOptions } from "./simple-options.js";
|
import { buildBaseOptions } from "./simple-options.ts";
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Configuration
|
// Configuration
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import type {
|
|||||||
ChatCompletionSystemMessageParam,
|
ChatCompletionSystemMessageParam,
|
||||||
ChatCompletionToolMessageParam,
|
ChatCompletionToolMessageParam,
|
||||||
} from "openai/resources/chat/completions.js";
|
} from "openai/resources/chat/completions.js";
|
||||||
import { getEnvApiKey } from "../env-api-keys.js";
|
import { getEnvApiKey } from "../env-api-keys.ts";
|
||||||
import { calculateCost, clampThinkingLevel } from "../models.js";
|
import { calculateCost, clampThinkingLevel } from "../models.ts";
|
||||||
import type {
|
import type {
|
||||||
AssistantMessage,
|
AssistantMessage,
|
||||||
CacheRetention,
|
CacheRetention,
|
||||||
@@ -29,16 +29,16 @@ import type {
|
|||||||
Tool,
|
Tool,
|
||||||
ToolCall,
|
ToolCall,
|
||||||
ToolResultMessage,
|
ToolResultMessage,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
import { AssistantMessageEventStream } from "../utils/event-stream.ts";
|
||||||
import { headersToRecord } from "../utils/headers.js";
|
import { headersToRecord } from "../utils/headers.ts";
|
||||||
import { parseStreamingJson } from "../utils/json-parse.js";
|
import { parseStreamingJson } from "../utils/json-parse.ts";
|
||||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.ts";
|
||||||
import { isCloudflareProvider, resolveCloudflareBaseUrl } from "./cloudflare.js";
|
import { isCloudflareProvider, resolveCloudflareBaseUrl } from "./cloudflare.ts";
|
||||||
import { buildCopilotDynamicHeaders, hasCopilotVisionInput } from "./github-copilot-headers.js";
|
import { buildCopilotDynamicHeaders, hasCopilotVisionInput } from "./github-copilot-headers.ts";
|
||||||
import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.js";
|
import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.ts";
|
||||||
import { buildBaseOptions } from "./simple-options.js";
|
import { buildBaseOptions } from "./simple-options.ts";
|
||||||
import { transformMessages } from "./transform-messages.js";
|
import { transformMessages } from "./transform-messages.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if conversation messages contain tool calls or tool results.
|
* Check if conversation messages contain tool calls or tool results.
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import type {
|
|||||||
ResponseReasoningItem,
|
ResponseReasoningItem,
|
||||||
ResponseStreamEvent,
|
ResponseStreamEvent,
|
||||||
} from "openai/resources/responses/responses.js";
|
} from "openai/resources/responses/responses.js";
|
||||||
import { calculateCost } from "../models.js";
|
import { calculateCost } from "../models.ts";
|
||||||
import type {
|
import type {
|
||||||
Api,
|
Api,
|
||||||
AssistantMessage,
|
AssistantMessage,
|
||||||
@@ -26,12 +26,12 @@ import type {
|
|||||||
Tool,
|
Tool,
|
||||||
ToolCall,
|
ToolCall,
|
||||||
Usage,
|
Usage,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import type { AssistantMessageEventStream } from "../utils/event-stream.js";
|
import type { AssistantMessageEventStream } from "../utils/event-stream.ts";
|
||||||
import { shortHash } from "../utils/hash.js";
|
import { shortHash } from "../utils/hash.ts";
|
||||||
import { parseStreamingJson } from "../utils/json-parse.js";
|
import { parseStreamingJson } from "../utils/json-parse.ts";
|
||||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.ts";
|
||||||
import { transformMessages } from "./transform-messages.js";
|
import { transformMessages } from "./transform-messages.ts";
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Utilities
|
// Utilities
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import OpenAI from "openai";
|
import OpenAI from "openai";
|
||||||
import type { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
import type { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
||||||
import { getEnvApiKey } from "../env-api-keys.js";
|
import { getEnvApiKey } from "../env-api-keys.ts";
|
||||||
import { clampThinkingLevel } from "../models.js";
|
import { clampThinkingLevel } from "../models.ts";
|
||||||
import type {
|
import type {
|
||||||
Api,
|
Api,
|
||||||
AssistantMessage,
|
AssistantMessage,
|
||||||
@@ -13,14 +13,14 @@ import type {
|
|||||||
StreamFunction,
|
StreamFunction,
|
||||||
StreamOptions,
|
StreamOptions,
|
||||||
Usage,
|
Usage,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
import { AssistantMessageEventStream } from "../utils/event-stream.ts";
|
||||||
import { headersToRecord } from "../utils/headers.js";
|
import { headersToRecord } from "../utils/headers.ts";
|
||||||
import { isCloudflareProvider, resolveCloudflareBaseUrl } from "./cloudflare.js";
|
import { isCloudflareProvider, resolveCloudflareBaseUrl } from "./cloudflare.ts";
|
||||||
import { buildCopilotDynamicHeaders, hasCopilotVisionInput } from "./github-copilot-headers.js";
|
import { buildCopilotDynamicHeaders, hasCopilotVisionInput } from "./github-copilot-headers.ts";
|
||||||
import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.js";
|
import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.ts";
|
||||||
import { convertResponsesMessages, convertResponsesTools, processResponsesStream } from "./openai-responses-shared.js";
|
import { convertResponsesMessages, convertResponsesTools, processResponsesStream } from "./openai-responses-shared.ts";
|
||||||
import { buildBaseOptions } from "./simple-options.js";
|
import { buildBaseOptions } from "./simple-options.ts";
|
||||||
|
|
||||||
const OPENAI_TOOL_CALL_PROVIDERS = new Set(["openai", "openai-codex", "opencode"]);
|
const OPENAI_TOOL_CALL_PROVIDERS = new Set(["openai", "openai-codex", "opencode"]);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { clearApiProviders, registerApiProvider } from "../api-registry.js";
|
import { clearApiProviders, registerApiProvider } from "../api-registry.ts";
|
||||||
import type {
|
import type {
|
||||||
Api,
|
Api,
|
||||||
AssistantMessage,
|
AssistantMessage,
|
||||||
@@ -8,17 +8,17 @@ import type {
|
|||||||
SimpleStreamOptions,
|
SimpleStreamOptions,
|
||||||
StreamFunction,
|
StreamFunction,
|
||||||
StreamOptions,
|
StreamOptions,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
import { AssistantMessageEventStream } from "../utils/event-stream.ts";
|
||||||
import type { BedrockOptions } from "./amazon-bedrock.js";
|
import type { BedrockOptions } from "./amazon-bedrock.ts";
|
||||||
import type { AnthropicOptions } from "./anthropic.js";
|
import type { AnthropicOptions } from "./anthropic.ts";
|
||||||
import type { AzureOpenAIResponsesOptions } from "./azure-openai-responses.js";
|
import type { AzureOpenAIResponsesOptions } from "./azure-openai-responses.ts";
|
||||||
import type { GoogleOptions } from "./google.js";
|
import type { GoogleOptions } from "./google.ts";
|
||||||
import type { GoogleVertexOptions } from "./google-vertex.js";
|
import type { GoogleVertexOptions } from "./google-vertex.ts";
|
||||||
import type { MistralOptions } from "./mistral.js";
|
import type { MistralOptions } from "./mistral.ts";
|
||||||
import type { OpenAICodexResponsesOptions } from "./openai-codex-responses.js";
|
import type { OpenAICodexResponsesOptions } from "./openai-codex-responses.ts";
|
||||||
import type { OpenAICompletionsOptions } from "./openai-completions.js";
|
import type { OpenAICompletionsOptions } from "./openai-completions.ts";
|
||||||
import type { OpenAIResponsesOptions } from "./openai-responses.js";
|
import type { OpenAIResponsesOptions } from "./openai-responses.ts";
|
||||||
|
|
||||||
interface LazyProviderModule<
|
interface LazyProviderModule<
|
||||||
TApi extends Api,
|
TApi extends Api,
|
||||||
@@ -86,7 +86,10 @@ interface BedrockProviderModule {
|
|||||||
) => AsyncIterable<AssistantMessageEvent>;
|
) => AsyncIterable<AssistantMessageEvent>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const importNodeOnlyProvider = (specifier: string): Promise<unknown> => import(specifier);
|
const importNodeOnlyProvider = (specifier: string): Promise<unknown> => {
|
||||||
|
const runtimeSpecifier = import.meta.url.endsWith(".js") ? specifier.replace(/\.ts$/, ".js") : specifier;
|
||||||
|
return import(runtimeSpecifier);
|
||||||
|
};
|
||||||
|
|
||||||
let anthropicProviderModulePromise:
|
let anthropicProviderModulePromise:
|
||||||
| Promise<LazyProviderModule<"anthropic-messages", AnthropicOptions, SimpleStreamOptions>>
|
| Promise<LazyProviderModule<"anthropic-messages", AnthropicOptions, SimpleStreamOptions>>
|
||||||
@@ -203,7 +206,7 @@ function createLazySimpleStream<
|
|||||||
function loadAnthropicProviderModule(): Promise<
|
function loadAnthropicProviderModule(): Promise<
|
||||||
LazyProviderModule<"anthropic-messages", AnthropicOptions, SimpleStreamOptions>
|
LazyProviderModule<"anthropic-messages", AnthropicOptions, SimpleStreamOptions>
|
||||||
> {
|
> {
|
||||||
anthropicProviderModulePromise ||= import("./anthropic.js").then((module) => {
|
anthropicProviderModulePromise ||= import("./anthropic.ts").then((module) => {
|
||||||
const provider = module as AnthropicProviderModule;
|
const provider = module as AnthropicProviderModule;
|
||||||
return {
|
return {
|
||||||
stream: provider.streamAnthropic,
|
stream: provider.streamAnthropic,
|
||||||
@@ -216,7 +219,7 @@ function loadAnthropicProviderModule(): Promise<
|
|||||||
function loadAzureOpenAIResponsesProviderModule(): Promise<
|
function loadAzureOpenAIResponsesProviderModule(): Promise<
|
||||||
LazyProviderModule<"azure-openai-responses", AzureOpenAIResponsesOptions, SimpleStreamOptions>
|
LazyProviderModule<"azure-openai-responses", AzureOpenAIResponsesOptions, SimpleStreamOptions>
|
||||||
> {
|
> {
|
||||||
azureOpenAIResponsesProviderModulePromise ||= import("./azure-openai-responses.js").then((module) => {
|
azureOpenAIResponsesProviderModulePromise ||= import("./azure-openai-responses.ts").then((module) => {
|
||||||
const provider = module as AzureOpenAIResponsesProviderModule;
|
const provider = module as AzureOpenAIResponsesProviderModule;
|
||||||
return {
|
return {
|
||||||
stream: provider.streamAzureOpenAIResponses,
|
stream: provider.streamAzureOpenAIResponses,
|
||||||
@@ -229,7 +232,7 @@ function loadAzureOpenAIResponsesProviderModule(): Promise<
|
|||||||
function loadGoogleProviderModule(): Promise<
|
function loadGoogleProviderModule(): Promise<
|
||||||
LazyProviderModule<"google-generative-ai", GoogleOptions, SimpleStreamOptions>
|
LazyProviderModule<"google-generative-ai", GoogleOptions, SimpleStreamOptions>
|
||||||
> {
|
> {
|
||||||
googleProviderModulePromise ||= import("./google.js").then((module) => {
|
googleProviderModulePromise ||= import("./google.ts").then((module) => {
|
||||||
const provider = module as GoogleProviderModule;
|
const provider = module as GoogleProviderModule;
|
||||||
return {
|
return {
|
||||||
stream: provider.streamGoogle,
|
stream: provider.streamGoogle,
|
||||||
@@ -242,7 +245,7 @@ function loadGoogleProviderModule(): Promise<
|
|||||||
function loadGoogleVertexProviderModule(): Promise<
|
function loadGoogleVertexProviderModule(): Promise<
|
||||||
LazyProviderModule<"google-vertex", GoogleVertexOptions, SimpleStreamOptions>
|
LazyProviderModule<"google-vertex", GoogleVertexOptions, SimpleStreamOptions>
|
||||||
> {
|
> {
|
||||||
googleVertexProviderModulePromise ||= import("./google-vertex.js").then((module) => {
|
googleVertexProviderModulePromise ||= import("./google-vertex.ts").then((module) => {
|
||||||
const provider = module as GoogleVertexProviderModule;
|
const provider = module as GoogleVertexProviderModule;
|
||||||
return {
|
return {
|
||||||
stream: provider.streamGoogleVertex,
|
stream: provider.streamGoogleVertex,
|
||||||
@@ -255,7 +258,7 @@ function loadGoogleVertexProviderModule(): Promise<
|
|||||||
function loadMistralProviderModule(): Promise<
|
function loadMistralProviderModule(): Promise<
|
||||||
LazyProviderModule<"mistral-conversations", MistralOptions, SimpleStreamOptions>
|
LazyProviderModule<"mistral-conversations", MistralOptions, SimpleStreamOptions>
|
||||||
> {
|
> {
|
||||||
mistralProviderModulePromise ||= import("./mistral.js").then((module) => {
|
mistralProviderModulePromise ||= import("./mistral.ts").then((module) => {
|
||||||
const provider = module as MistralProviderModule;
|
const provider = module as MistralProviderModule;
|
||||||
return {
|
return {
|
||||||
stream: provider.streamMistral,
|
stream: provider.streamMistral,
|
||||||
@@ -268,7 +271,7 @@ function loadMistralProviderModule(): Promise<
|
|||||||
function loadOpenAICodexResponsesProviderModule(): Promise<
|
function loadOpenAICodexResponsesProviderModule(): Promise<
|
||||||
LazyProviderModule<"openai-codex-responses", OpenAICodexResponsesOptions, SimpleStreamOptions>
|
LazyProviderModule<"openai-codex-responses", OpenAICodexResponsesOptions, SimpleStreamOptions>
|
||||||
> {
|
> {
|
||||||
openAICodexResponsesProviderModulePromise ||= import("./openai-codex-responses.js").then((module) => {
|
openAICodexResponsesProviderModulePromise ||= import("./openai-codex-responses.ts").then((module) => {
|
||||||
const provider = module as OpenAICodexResponsesProviderModule;
|
const provider = module as OpenAICodexResponsesProviderModule;
|
||||||
return {
|
return {
|
||||||
stream: provider.streamOpenAICodexResponses,
|
stream: provider.streamOpenAICodexResponses,
|
||||||
@@ -281,7 +284,7 @@ function loadOpenAICodexResponsesProviderModule(): Promise<
|
|||||||
function loadOpenAICompletionsProviderModule(): Promise<
|
function loadOpenAICompletionsProviderModule(): Promise<
|
||||||
LazyProviderModule<"openai-completions", OpenAICompletionsOptions, SimpleStreamOptions>
|
LazyProviderModule<"openai-completions", OpenAICompletionsOptions, SimpleStreamOptions>
|
||||||
> {
|
> {
|
||||||
openAICompletionsProviderModulePromise ||= import("./openai-completions.js").then((module) => {
|
openAICompletionsProviderModulePromise ||= import("./openai-completions.ts").then((module) => {
|
||||||
const provider = module as OpenAICompletionsProviderModule;
|
const provider = module as OpenAICompletionsProviderModule;
|
||||||
return {
|
return {
|
||||||
stream: provider.streamOpenAICompletions,
|
stream: provider.streamOpenAICompletions,
|
||||||
@@ -294,7 +297,7 @@ function loadOpenAICompletionsProviderModule(): Promise<
|
|||||||
function loadOpenAIResponsesProviderModule(): Promise<
|
function loadOpenAIResponsesProviderModule(): Promise<
|
||||||
LazyProviderModule<"openai-responses", OpenAIResponsesOptions, SimpleStreamOptions>
|
LazyProviderModule<"openai-responses", OpenAIResponsesOptions, SimpleStreamOptions>
|
||||||
> {
|
> {
|
||||||
openAIResponsesProviderModulePromise ||= import("./openai-responses.js").then((module) => {
|
openAIResponsesProviderModulePromise ||= import("./openai-responses.ts").then((module) => {
|
||||||
const provider = module as OpenAIResponsesProviderModule;
|
const provider = module as OpenAIResponsesProviderModule;
|
||||||
return {
|
return {
|
||||||
stream: provider.streamOpenAIResponses,
|
stream: provider.streamOpenAIResponses,
|
||||||
@@ -310,7 +313,7 @@ function loadBedrockProviderModule(): Promise<
|
|||||||
if (bedrockProviderModuleOverride) {
|
if (bedrockProviderModuleOverride) {
|
||||||
return Promise.resolve(bedrockProviderModuleOverride);
|
return Promise.resolve(bedrockProviderModuleOverride);
|
||||||
}
|
}
|
||||||
bedrockProviderModulePromise ||= importNodeOnlyProvider("./amazon-bedrock.js").then((module) => {
|
bedrockProviderModulePromise ||= importNodeOnlyProvider("./amazon-bedrock.ts").then((module) => {
|
||||||
const provider = module as BedrockProviderModule;
|
const provider = module as BedrockProviderModule;
|
||||||
return {
|
return {
|
||||||
stream: provider.streamBedrock,
|
stream: provider.streamBedrock,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Api, Model, SimpleStreamOptions, StreamOptions, ThinkingBudgets, ThinkingLevel } from "../types.js";
|
import type { Api, Model, SimpleStreamOptions, StreamOptions, ThinkingBudgets, ThinkingLevel } from "../types.ts";
|
||||||
|
|
||||||
export function buildBaseOptions(_model: Model<Api>, options?: SimpleStreamOptions, apiKey?: string): StreamOptions {
|
export function buildBaseOptions(_model: Model<Api>, options?: SimpleStreamOptions, apiKey?: string): StreamOptions {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import type {
|
|||||||
TextContent,
|
TextContent,
|
||||||
ToolCall,
|
ToolCall,
|
||||||
ToolResultMessage,
|
ToolResultMessage,
|
||||||
} from "../types.js";
|
} from "../types.ts";
|
||||||
|
|
||||||
const NON_VISION_USER_IMAGE_PLACEHOLDER = "(image omitted: model does not support images)";
|
const NON_VISION_USER_IMAGE_PLACEHOLDER = "(image omitted: model does not support images)";
|
||||||
const NON_VISION_TOOL_IMAGE_PLACEHOLDER = "(tool image omitted: model does not support images)";
|
const NON_VISION_TOOL_IMAGE_PLACEHOLDER = "(tool image omitted: model does not support images)";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import "./providers/register-builtins.js";
|
import "./providers/register-builtins.ts";
|
||||||
|
|
||||||
import { getApiProvider } from "./api-registry.js";
|
import { getApiProvider } from "./api-registry.ts";
|
||||||
import type {
|
import type {
|
||||||
Api,
|
Api,
|
||||||
AssistantMessage,
|
AssistantMessage,
|
||||||
@@ -10,9 +10,9 @@ import type {
|
|||||||
ProviderStreamOptions,
|
ProviderStreamOptions,
|
||||||
SimpleStreamOptions,
|
SimpleStreamOptions,
|
||||||
StreamOptions,
|
StreamOptions,
|
||||||
} from "./types.js";
|
} from "./types.ts";
|
||||||
|
|
||||||
export { getEnvApiKey } from "./env-api-keys.js";
|
export { getEnvApiKey } from "./env-api-keys.ts";
|
||||||
|
|
||||||
function resolveApiProvider(api: Api) {
|
function resolveApiProvider(api: Api) {
|
||||||
const provider = getApiProvider(api);
|
const provider = getApiProvider(api);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { AssistantMessageDiagnostic } from "./utils/diagnostics.js";
|
import type { AssistantMessageDiagnostic } from "./utils/diagnostics.ts";
|
||||||
import type { AssistantMessageEventStream } from "./utils/event-stream.js";
|
import type { AssistantMessageEventStream } from "./utils/event-stream.ts";
|
||||||
|
|
||||||
export type { AssistantMessageEventStream } from "./utils/event-stream.js";
|
export type { AssistantMessageEventStream } from "./utils/event-stream.ts";
|
||||||
|
|
||||||
export type KnownApi =
|
export type KnownApi =
|
||||||
| "openai-completions"
|
| "openai-completions"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { AssistantMessage, AssistantMessageEvent } from "../types.js";
|
import type { AssistantMessage, AssistantMessageEvent } from "../types.ts";
|
||||||
|
|
||||||
// Generic event stream class for async iteration
|
// Generic event stream class for async iteration
|
||||||
export class EventStream<T, R = T> implements AsyncIterable<T> {
|
export class EventStream<T, R = T> implements AsyncIterable<T> {
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Server } from "node:http";
|
import type { Server } from "node:http";
|
||||||
import { oauthErrorHtml, oauthSuccessHtml } from "./oauth-page.js";
|
import { oauthErrorHtml, oauthSuccessHtml } from "./oauth-page.ts";
|
||||||
import { generatePKCE } from "./pkce.js";
|
import { generatePKCE } from "./pkce.ts";
|
||||||
import type { OAuthCredentials, OAuthLoginCallbacks, OAuthPrompt, OAuthProviderInterface } from "./types.js";
|
import type { OAuthCredentials, OAuthLoginCallbacks, OAuthPrompt, OAuthProviderInterface } from "./types.ts";
|
||||||
|
|
||||||
type CallbackServerInfo = {
|
type CallbackServerInfo = {
|
||||||
server: Server;
|
server: Server;
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
* GitHub Copilot OAuth flow
|
* GitHub Copilot OAuth flow
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { getModels } from "../../models.js";
|
import { getModels } from "../../models.ts";
|
||||||
import type { Api, Model } from "../../types.js";
|
import type { Api, Model } from "../../types.ts";
|
||||||
import type { OAuthCredentials, OAuthLoginCallbacks, OAuthProviderInterface } from "./types.js";
|
import type { OAuthCredentials, OAuthLoginCallbacks, OAuthProviderInterface } from "./types.ts";
|
||||||
|
|
||||||
type CopilotCredentials = OAuthCredentials & {
|
type CopilotCredentials = OAuthCredentials & {
|
||||||
enterpriseUrl?: string;
|
enterpriseUrl?: string;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Anthropic
|
// Anthropic
|
||||||
export { anthropicOAuthProvider, loginAnthropic, refreshAnthropicToken } from "./anthropic.js";
|
export { anthropicOAuthProvider, loginAnthropic, refreshAnthropicToken } from "./anthropic.ts";
|
||||||
// GitHub Copilot
|
// GitHub Copilot
|
||||||
export {
|
export {
|
||||||
getGitHubCopilotBaseUrl,
|
getGitHubCopilotBaseUrl,
|
||||||
@@ -16,20 +16,20 @@ export {
|
|||||||
loginGitHubCopilot,
|
loginGitHubCopilot,
|
||||||
normalizeDomain,
|
normalizeDomain,
|
||||||
refreshGitHubCopilotToken,
|
refreshGitHubCopilotToken,
|
||||||
} from "./github-copilot.js";
|
} from "./github-copilot.ts";
|
||||||
// OpenAI Codex (ChatGPT OAuth)
|
// OpenAI Codex (ChatGPT OAuth)
|
||||||
export { loginOpenAICodex, openaiCodexOAuthProvider, refreshOpenAICodexToken } from "./openai-codex.js";
|
export { loginOpenAICodex, openaiCodexOAuthProvider, refreshOpenAICodexToken } from "./openai-codex.ts";
|
||||||
|
|
||||||
export * from "./types.js";
|
export * from "./types.ts";
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Provider Registry
|
// Provider Registry
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
import { anthropicOAuthProvider } from "./anthropic.js";
|
import { anthropicOAuthProvider } from "./anthropic.ts";
|
||||||
import { githubCopilotOAuthProvider } from "./github-copilot.js";
|
import { githubCopilotOAuthProvider } from "./github-copilot.ts";
|
||||||
import { openaiCodexOAuthProvider } from "./openai-codex.js";
|
import { openaiCodexOAuthProvider } from "./openai-codex.ts";
|
||||||
import type { OAuthCredentials, OAuthProviderId, OAuthProviderInfo, OAuthProviderInterface } from "./types.js";
|
import type { OAuthCredentials, OAuthProviderId, OAuthProviderInfo, OAuthProviderInterface } from "./types.ts";
|
||||||
|
|
||||||
const BUILT_IN_OAUTH_PROVIDERS: OAuthProviderInterface[] = [
|
const BUILT_IN_OAUTH_PROVIDERS: OAuthProviderInterface[] = [
|
||||||
anthropicOAuthProvider,
|
anthropicOAuthProvider,
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ if (typeof process !== "undefined" && (process.versions?.node || process.version
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
import { oauthErrorHtml, oauthSuccessHtml } from "./oauth-page.js";
|
import { oauthErrorHtml, oauthSuccessHtml } from "./oauth-page.ts";
|
||||||
import { generatePKCE } from "./pkce.js";
|
import { generatePKCE } from "./pkce.ts";
|
||||||
import type { OAuthCredentials, OAuthLoginCallbacks, OAuthPrompt, OAuthProviderInterface } from "./types.js";
|
import type { OAuthCredentials, OAuthLoginCallbacks, OAuthPrompt, OAuthProviderInterface } from "./types.ts";
|
||||||
|
|
||||||
const CALLBACK_HOST = process.env.PI_OAUTH_CALLBACK_HOST || "127.0.0.1";
|
const CALLBACK_HOST = process.env.PI_OAUTH_CALLBACK_HOST || "127.0.0.1";
|
||||||
const CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
|
const CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Api, Model } from "../../types.js";
|
import type { Api, Model } from "../../types.ts";
|
||||||
|
|
||||||
export type OAuthCredentials = {
|
export type OAuthCredentials = {
|
||||||
refresh: string;
|
refresh: string;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { AssistantMessage } from "../types.js";
|
import type { AssistantMessage } from "../types.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regex patterns to detect context overflow errors from different providers.
|
* Regex patterns to detect context overflow errors from different providers.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Compile } from "typebox/compile";
|
import { Compile } from "typebox/compile";
|
||||||
import type { TLocalizedValidationError } from "typebox/error";
|
import type { TLocalizedValidationError } from "typebox/error";
|
||||||
import { Value } from "typebox/value";
|
import { Value } from "typebox/value";
|
||||||
import type { Tool, ToolCall } from "../types.js";
|
import type { Tool, ToolCall } from "../types.ts";
|
||||||
|
|
||||||
const validatorCache = new WeakMap<object, ReturnType<typeof Compile>>();
|
const validatorCache = new WeakMap<object, ReturnType<typeof Compile>>();
|
||||||
const TYPEBOX_KIND = Symbol.for("TypeBox.Kind");
|
const TYPEBOX_KIND = Symbol.for("TypeBox.Kind");
|
||||||
|
|||||||
@@ -303,7 +303,11 @@ function sleep(ms: number): Promise<void> {
|
|||||||
|
|
||||||
// Base overlay component with common rendering
|
// Base overlay component with common rendering
|
||||||
abstract class BaseOverlay {
|
abstract class BaseOverlay {
|
||||||
constructor(protected theme: Theme) {}
|
protected theme: Theme;
|
||||||
|
|
||||||
|
constructor(theme: Theme) {
|
||||||
|
this.theme = theme;
|
||||||
|
}
|
||||||
|
|
||||||
protected box(lines: string[], width: number, title?: string): string[] {
|
protected box(lines: string[], width: number, title?: string): string[] {
|
||||||
const th = this.theme;
|
const th = this.theme;
|
||||||
@@ -330,12 +334,13 @@ abstract class BaseOverlay {
|
|||||||
|
|
||||||
// Anchor position test
|
// Anchor position test
|
||||||
class AnchorTestComponent extends BaseOverlay {
|
class AnchorTestComponent extends BaseOverlay {
|
||||||
constructor(
|
private anchor: OverlayAnchor;
|
||||||
theme: Theme,
|
private done: (result: "next" | "confirm" | "cancel") => void;
|
||||||
private anchor: OverlayAnchor,
|
|
||||||
private done: (result: "next" | "confirm" | "cancel") => void,
|
constructor(theme: Theme, anchor: OverlayAnchor, done: (result: "next" | "confirm" | "cancel") => void) {
|
||||||
) {
|
|
||||||
super(theme);
|
super(theme);
|
||||||
|
this.anchor = anchor;
|
||||||
|
this.done = done;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleInput(data: string): void {
|
handleInput(data: string): void {
|
||||||
@@ -368,12 +373,17 @@ class AnchorTestComponent extends BaseOverlay {
|
|||||||
|
|
||||||
// Margin/offset test
|
// Margin/offset test
|
||||||
class MarginTestComponent extends BaseOverlay {
|
class MarginTestComponent extends BaseOverlay {
|
||||||
|
private config: { name: string; options: OverlayOptions };
|
||||||
|
private done: (result: "next" | "close") => void;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
theme: Theme,
|
theme: Theme,
|
||||||
private config: { name: string; options: OverlayOptions },
|
config: { name: string; options: OverlayOptions },
|
||||||
private done: (result: "next" | "close") => void,
|
done: (result: "next" | "close") => void,
|
||||||
) {
|
) {
|
||||||
super(theme);
|
super(theme);
|
||||||
|
this.config = config;
|
||||||
|
this.done = done;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleInput(data: string): void {
|
handleInput(data: string): void {
|
||||||
@@ -403,13 +413,15 @@ class MarginTestComponent extends BaseOverlay {
|
|||||||
|
|
||||||
// Stacked overlay test
|
// Stacked overlay test
|
||||||
class StackOverlayComponent extends BaseOverlay {
|
class StackOverlayComponent extends BaseOverlay {
|
||||||
constructor(
|
private num: number;
|
||||||
theme: Theme,
|
private position: string;
|
||||||
private num: number,
|
private done: (result: string) => void;
|
||||||
private position: string,
|
|
||||||
private done: (result: string) => void,
|
constructor(theme: Theme, num: number, position: string, done: (result: string) => void) {
|
||||||
) {
|
|
||||||
super(theme);
|
super(theme);
|
||||||
|
this.num = num;
|
||||||
|
this.position = position;
|
||||||
|
this.done = done;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleInput(data: string): void {
|
handleInput(data: string): void {
|
||||||
@@ -446,19 +458,19 @@ class StackOverlayComponent extends BaseOverlay {
|
|||||||
|
|
||||||
// Streaming overflow test - spawns real process with colored output (original crash scenario)
|
// Streaming overflow test - spawns real process with colored output (original crash scenario)
|
||||||
class StreamingOverflowComponent extends BaseOverlay {
|
class StreamingOverflowComponent extends BaseOverlay {
|
||||||
|
private tui: TUI;
|
||||||
private lines: string[] = [];
|
private lines: string[] = [];
|
||||||
private proc: ReturnType<typeof spawn> | null = null;
|
private proc: ReturnType<typeof spawn> | null = null;
|
||||||
private scrollOffset = 0;
|
private scrollOffset = 0;
|
||||||
private maxVisibleLines = 15;
|
private maxVisibleLines = 15;
|
||||||
private finished = false;
|
private finished = false;
|
||||||
private disposed = false;
|
private disposed = false;
|
||||||
|
private done: () => void;
|
||||||
|
|
||||||
constructor(
|
constructor(tui: TUI, theme: Theme, done: () => void) {
|
||||||
private tui: TUI,
|
|
||||||
theme: Theme,
|
|
||||||
private done: () => void,
|
|
||||||
) {
|
|
||||||
super(theme);
|
super(theme);
|
||||||
|
this.tui = tui;
|
||||||
|
this.done = done;
|
||||||
this.startProcess();
|
this.startProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -579,11 +591,11 @@ class StreamingOverflowComponent extends BaseOverlay {
|
|||||||
|
|
||||||
// Edge position test
|
// Edge position test
|
||||||
class EdgeTestComponent extends BaseOverlay {
|
class EdgeTestComponent extends BaseOverlay {
|
||||||
constructor(
|
private done: () => void;
|
||||||
theme: Theme,
|
|
||||||
private done: () => void,
|
constructor(theme: Theme, done: () => void) {
|
||||||
) {
|
|
||||||
super(theme);
|
super(theme);
|
||||||
|
this.done = done;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleInput(data: string): void {
|
handleInput(data: string): void {
|
||||||
@@ -614,12 +626,17 @@ class EdgeTestComponent extends BaseOverlay {
|
|||||||
|
|
||||||
// Percentage positioning test
|
// Percentage positioning test
|
||||||
class PercentTestComponent extends BaseOverlay {
|
class PercentTestComponent extends BaseOverlay {
|
||||||
|
private config: { name: string; row: number; col: number };
|
||||||
|
private done: (result: "next" | "close") => void;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
theme: Theme,
|
theme: Theme,
|
||||||
private config: { name: string; row: number; col: number },
|
config: { name: string; row: number; col: number },
|
||||||
private done: (result: "next" | "close") => void,
|
done: (result: "next" | "close") => void,
|
||||||
) {
|
) {
|
||||||
super(theme);
|
super(theme);
|
||||||
|
this.config = config;
|
||||||
|
this.done = done;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleInput(data: string): void {
|
handleInput(data: string): void {
|
||||||
@@ -649,11 +666,11 @@ class PercentTestComponent extends BaseOverlay {
|
|||||||
|
|
||||||
// MaxHeight test - renders 20 lines, truncated to 10 by maxHeight
|
// MaxHeight test - renders 20 lines, truncated to 10 by maxHeight
|
||||||
class MaxHeightTestComponent extends BaseOverlay {
|
class MaxHeightTestComponent extends BaseOverlay {
|
||||||
constructor(
|
private done: () => void;
|
||||||
theme: Theme,
|
|
||||||
private done: () => void,
|
constructor(theme: Theme, done: () => void) {
|
||||||
) {
|
|
||||||
super(theme);
|
super(theme);
|
||||||
|
this.done = done;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleInput(data: string): void {
|
handleInput(data: string): void {
|
||||||
@@ -684,15 +701,15 @@ class MaxHeightTestComponent extends BaseOverlay {
|
|||||||
|
|
||||||
// Responsive sidepanel - demonstrates percentage width and visibility callback
|
// Responsive sidepanel - demonstrates percentage width and visibility callback
|
||||||
class SidepanelComponent extends BaseOverlay {
|
class SidepanelComponent extends BaseOverlay {
|
||||||
|
private tui: TUI;
|
||||||
private items = ["Dashboard", "Messages", "Settings", "Help", "About"];
|
private items = ["Dashboard", "Messages", "Settings", "Help", "About"];
|
||||||
private selectedIndex = 0;
|
private selectedIndex = 0;
|
||||||
|
private done: () => void;
|
||||||
|
|
||||||
constructor(
|
constructor(tui: TUI, theme: Theme, done: () => void) {
|
||||||
private tui: TUI,
|
|
||||||
theme: Theme,
|
|
||||||
private done: () => void,
|
|
||||||
) {
|
|
||||||
super(theme);
|
super(theme);
|
||||||
|
this.tui = tui;
|
||||||
|
this.done = done;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleInput(data: string): void {
|
handleInput(data: string): void {
|
||||||
@@ -745,18 +762,18 @@ class SidepanelComponent extends BaseOverlay {
|
|||||||
|
|
||||||
// Animation demo - proves overlays can handle real-time updates like pi-doom
|
// Animation demo - proves overlays can handle real-time updates like pi-doom
|
||||||
class AnimationDemoComponent extends BaseOverlay {
|
class AnimationDemoComponent extends BaseOverlay {
|
||||||
|
private tui: TUI;
|
||||||
private frame = 0;
|
private frame = 0;
|
||||||
private interval: ReturnType<typeof setInterval> | null = null;
|
private interval: ReturnType<typeof setInterval> | null = null;
|
||||||
private fps = 0;
|
private fps = 0;
|
||||||
private lastFpsUpdate = Date.now();
|
private lastFpsUpdate = Date.now();
|
||||||
private framesSinceLastFps = 0;
|
private framesSinceLastFps = 0;
|
||||||
|
private done: () => void;
|
||||||
|
|
||||||
constructor(
|
constructor(tui: TUI, theme: Theme, done: () => void) {
|
||||||
private tui: TUI,
|
|
||||||
theme: Theme,
|
|
||||||
private done: () => void,
|
|
||||||
) {
|
|
||||||
super(theme);
|
super(theme);
|
||||||
|
this.tui = tui;
|
||||||
|
this.done = done;
|
||||||
this.startAnimation();
|
this.startAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -860,15 +877,15 @@ function hslToRgb(h: number, s: number, l: number): [number, number, number] {
|
|||||||
|
|
||||||
// Toggle demo - demonstrates OverlayHandle.setHidden() via onHandle callback
|
// Toggle demo - demonstrates OverlayHandle.setHidden() via onHandle callback
|
||||||
class ToggleDemoComponent extends BaseOverlay {
|
class ToggleDemoComponent extends BaseOverlay {
|
||||||
|
private tui: TUI;
|
||||||
private toggleCount = 0;
|
private toggleCount = 0;
|
||||||
private isToggling = false;
|
private isToggling = false;
|
||||||
|
private done: () => void;
|
||||||
|
|
||||||
constructor(
|
constructor(tui: TUI, theme: Theme, done: () => void) {
|
||||||
private tui: TUI,
|
|
||||||
theme: Theme,
|
|
||||||
private done: () => void,
|
|
||||||
) {
|
|
||||||
super(theme);
|
super(theme);
|
||||||
|
this.tui = tui;
|
||||||
|
this.done = done;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleInput(data: string): void {
|
handleInput(data: string): void {
|
||||||
@@ -923,19 +940,19 @@ class ToggleDemoComponent extends BaseOverlay {
|
|||||||
|
|
||||||
class PassiveDemoController extends BaseOverlay {
|
class PassiveDemoController extends BaseOverlay {
|
||||||
focused = false;
|
focused = false;
|
||||||
|
private tui: TUI;
|
||||||
private typed = "";
|
private typed = "";
|
||||||
private timerComponent: TimerPanel;
|
private timerComponent: TimerPanel;
|
||||||
private timerHandle: OverlayHandle | null = null;
|
private timerHandle: OverlayHandle | null = null;
|
||||||
private interval: ReturnType<typeof setInterval> | null = null;
|
private interval: ReturnType<typeof setInterval> | null = null;
|
||||||
private inputCount = 0;
|
private inputCount = 0;
|
||||||
private lastInputDebug = "";
|
private lastInputDebug = "";
|
||||||
|
private done: () => void;
|
||||||
|
|
||||||
constructor(
|
constructor(tui: TUI, theme: Theme, done: () => void) {
|
||||||
private tui: TUI,
|
|
||||||
theme: Theme,
|
|
||||||
private done: () => void,
|
|
||||||
) {
|
|
||||||
super(theme);
|
super(theme);
|
||||||
|
this.tui = tui;
|
||||||
|
this.done = done;
|
||||||
this.timerComponent = new TimerPanel(theme);
|
this.timerComponent = new TimerPanel(theme);
|
||||||
this.timerHandle = this.tui.showOverlay(this.timerComponent, {
|
this.timerHandle = this.tui.showOverlay(this.timerComponent, {
|
||||||
nonCapturing: true,
|
nonCapturing: true,
|
||||||
@@ -1015,16 +1032,16 @@ class TimerPanel extends BaseOverlay {
|
|||||||
// === Focus cycling demo ===
|
// === Focus cycling demo ===
|
||||||
|
|
||||||
class FocusDemoController extends BaseOverlay {
|
class FocusDemoController extends BaseOverlay {
|
||||||
|
private tui: TUI;
|
||||||
private panels: FocusPanel[] = [];
|
private panels: FocusPanel[] = [];
|
||||||
private handles: OverlayHandle[] = [];
|
private handles: OverlayHandle[] = [];
|
||||||
private focusIndex = -1;
|
private focusIndex = -1;
|
||||||
|
private done: () => void;
|
||||||
|
|
||||||
constructor(
|
constructor(tui: TUI, theme: Theme, done: () => void) {
|
||||||
private tui: TUI,
|
|
||||||
theme: Theme,
|
|
||||||
private done: () => void,
|
|
||||||
) {
|
|
||||||
super(theme);
|
super(theme);
|
||||||
|
this.tui = tui;
|
||||||
|
this.done = done;
|
||||||
const colors = ["error", "success", "accent"] as const;
|
const colors = ["error", "success", "accent"] as const;
|
||||||
const labels = ["Alpha", "Beta", "Gamma"];
|
const labels = ["Alpha", "Beta", "Gamma"];
|
||||||
|
|
||||||
@@ -1107,16 +1124,22 @@ class FocusDemoController extends BaseOverlay {
|
|||||||
class FocusPanel extends BaseOverlay {
|
class FocusPanel extends BaseOverlay {
|
||||||
handle: OverlayHandle | null = null;
|
handle: OverlayHandle | null = null;
|
||||||
readonly label: string;
|
readonly label: string;
|
||||||
|
private color: "error" | "success" | "accent";
|
||||||
|
private onTab: () => void;
|
||||||
|
private onClose: () => void;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
theme: Theme,
|
theme: Theme,
|
||||||
label: string,
|
label: string,
|
||||||
private color: "error" | "success" | "accent",
|
color: "error" | "success" | "accent",
|
||||||
private onTab: () => void,
|
onTab: () => void,
|
||||||
private onClose: () => void,
|
onClose: () => void,
|
||||||
) {
|
) {
|
||||||
super(theme);
|
super(theme);
|
||||||
this.label = label;
|
this.label = label;
|
||||||
|
this.color = color;
|
||||||
|
this.onTab = onTab;
|
||||||
|
this.onClose = onClose;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleInput(data: string): void {
|
handleInput(data: string): void {
|
||||||
@@ -1155,19 +1178,19 @@ class FocusPanel extends BaseOverlay {
|
|||||||
// === Streaming input panel test (/overlay-streaming) ===
|
// === Streaming input panel test (/overlay-streaming) ===
|
||||||
|
|
||||||
class StreamingInputController extends BaseOverlay {
|
class StreamingInputController extends BaseOverlay {
|
||||||
|
private tui: TUI;
|
||||||
private panels: StreamingInputPanel[] = [];
|
private panels: StreamingInputPanel[] = [];
|
||||||
private handles: OverlayHandle[] = [];
|
private handles: OverlayHandle[] = [];
|
||||||
private focusIndex = -1; // -1 = controller focused, 0-2 = panel focused
|
private focusIndex = -1; // -1 = controller focused, 0-2 = panel focused
|
||||||
private streamLines: string[] = [];
|
private streamLines: string[] = [];
|
||||||
private streamInterval: ReturnType<typeof setInterval> | null = null;
|
private streamInterval: ReturnType<typeof setInterval> | null = null;
|
||||||
private lineCount = 0;
|
private lineCount = 0;
|
||||||
|
private done: () => void;
|
||||||
|
|
||||||
constructor(
|
constructor(tui: TUI, theme: Theme, done: () => void) {
|
||||||
private tui: TUI,
|
|
||||||
theme: Theme,
|
|
||||||
private done: () => void,
|
|
||||||
) {
|
|
||||||
super(theme);
|
super(theme);
|
||||||
|
this.tui = tui;
|
||||||
|
this.done = done;
|
||||||
|
|
||||||
// Create 3 input panels as non-capturing overlays
|
// Create 3 input panels as non-capturing overlays
|
||||||
const colors = ["error", "success", "accent"] as const;
|
const colors = ["error", "success", "accent"] as const;
|
||||||
@@ -1287,17 +1310,25 @@ class StreamingInputController extends BaseOverlay {
|
|||||||
|
|
||||||
class StreamingInputPanel implements Component {
|
class StreamingInputPanel implements Component {
|
||||||
handle: OverlayHandle | null = null;
|
handle: OverlayHandle | null = null;
|
||||||
|
private theme: Theme;
|
||||||
private typed = "";
|
private typed = "";
|
||||||
readonly label: string;
|
readonly label: string;
|
||||||
|
private color: "error" | "success" | "accent";
|
||||||
|
private onTab: () => void;
|
||||||
|
private onClose: () => void;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private theme: Theme,
|
theme: Theme,
|
||||||
label: string,
|
label: string,
|
||||||
private color: "error" | "success" | "accent",
|
color: "error" | "success" | "accent",
|
||||||
private onTab: () => void,
|
onTab: () => void,
|
||||||
private onClose: () => void,
|
onClose: () => void,
|
||||||
) {
|
) {
|
||||||
|
this.theme = theme;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
|
this.color = color;
|
||||||
|
this.onTab = onTab;
|
||||||
|
this.onClose = onClose;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleInput(data: string): void {
|
handleInput(data: string): void {
|
||||||
|
|||||||
@@ -42,10 +42,13 @@ class OverlayTestComponent implements Focusable {
|
|||||||
{ label: "Cancel", hasInput: false, text: "", cursor: 0 },
|
{ label: "Cancel", hasInput: false, text: "", cursor: 0 },
|
||||||
];
|
];
|
||||||
|
|
||||||
constructor(
|
private theme: Theme;
|
||||||
private theme: Theme,
|
private done: (result: { action: string; query?: string } | undefined) => void;
|
||||||
private done: (result: { action: string; query?: string } | undefined) => void,
|
|
||||||
) {}
|
constructor(theme: Theme, done: (result: { action: string; query?: string } | undefined) => void) {
|
||||||
|
this.theme = theme;
|
||||||
|
this.done = done;
|
||||||
|
}
|
||||||
|
|
||||||
handleInput(data: string): void {
|
handleInput(data: string): void {
|
||||||
if (matchesKey(data, "escape")) {
|
if (matchesKey(data, "escape")) {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
import { APP_NAME } from "../config.js";
|
import { APP_NAME } from "../config.ts";
|
||||||
|
|
||||||
process.title = APP_NAME;
|
process.title = APP_NAME;
|
||||||
process.emitWarning = (() => {}) as typeof process.emitWarning;
|
process.emitWarning = (() => {}) as typeof process.emitWarning;
|
||||||
|
|
||||||
import { restoreSandboxEnv } from "./restore-sandbox-env.js";
|
import { restoreSandboxEnv } from "./restore-sandbox-env.ts";
|
||||||
|
|
||||||
restoreSandboxEnv();
|
restoreSandboxEnv();
|
||||||
|
|
||||||
await import("./register-bedrock.js");
|
await import("./register-bedrock.ts");
|
||||||
await import("../cli.js");
|
await import("../cli.ts");
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
* Test with: npx tsx src/cli-new.ts [args...]
|
* Test with: npx tsx src/cli-new.ts [args...]
|
||||||
*/
|
*/
|
||||||
import * as undici from "undici";
|
import * as undici from "undici";
|
||||||
import { APP_NAME } from "./config.js";
|
import { APP_NAME } from "./config.ts";
|
||||||
import { main } from "./main.js";
|
import { main } from "./main.ts";
|
||||||
|
|
||||||
process.title = APP_NAME;
|
process.title = APP_NAME;
|
||||||
process.env.PI_CODING_AGENT = "true";
|
process.env.PI_CODING_AGENT = "true";
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
||||||
import chalk from "chalk";
|
import chalk from "chalk";
|
||||||
import { APP_NAME, CONFIG_DIR_NAME, ENV_AGENT_DIR, ENV_SESSION_DIR } from "../config.js";
|
import { APP_NAME, CONFIG_DIR_NAME, ENV_AGENT_DIR, ENV_SESSION_DIR } from "../config.ts";
|
||||||
import type { ExtensionFlag } from "../core/extensions/types.js";
|
import type { ExtensionFlag } from "../core/extensions/types.ts";
|
||||||
|
|
||||||
export type Mode = "text" | "json" | "rpc";
|
export type Mode = "text" | "json" | "rpc";
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ProcessTerminal, TUI } from "@earendil-works/pi-tui";
|
import { ProcessTerminal, TUI } from "@earendil-works/pi-tui";
|
||||||
import type { ResolvedPaths } from "../core/package-manager.js";
|
import type { ResolvedPaths } from "../core/package-manager.ts";
|
||||||
import type { SettingsManager } from "../core/settings-manager.js";
|
import type { SettingsManager } from "../core/settings-manager.ts";
|
||||||
import { ConfigSelectorComponent } from "../modes/interactive/components/config-selector.js";
|
import { ConfigSelectorComponent } from "../modes/interactive/components/config-selector.ts";
|
||||||
import { initTheme, stopThemeWatcher } from "../modes/interactive/theme/theme.js";
|
import { initTheme, stopThemeWatcher } from "../modes/interactive/theme/theme.ts";
|
||||||
|
|
||||||
export interface ConfigSelectorOptions {
|
export interface ConfigSelectorOptions {
|
||||||
resolvedPaths: ResolvedPaths;
|
resolvedPaths: ResolvedPaths;
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import { access, readFile, stat } from "node:fs/promises";
|
|||||||
import type { ImageContent } from "@earendil-works/pi-ai";
|
import type { ImageContent } from "@earendil-works/pi-ai";
|
||||||
import chalk from "chalk";
|
import chalk from "chalk";
|
||||||
import { resolve } from "path";
|
import { resolve } from "path";
|
||||||
import { resolveReadPath } from "../core/tools/path-utils.js";
|
import { resolveReadPath } from "../core/tools/path-utils.ts";
|
||||||
import { formatDimensionNote, resizeImage } from "../utils/image-resize.js";
|
import { formatDimensionNote, resizeImage } from "../utils/image-resize.ts";
|
||||||
import { detectSupportedImageMimeTypeFromFile } from "../utils/mime.js";
|
import { detectSupportedImageMimeTypeFromFile } from "../utils/mime.ts";
|
||||||
|
|
||||||
export interface ProcessedFiles {
|
export interface ProcessedFiles {
|
||||||
text: string;
|
text: string;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { ImageContent } from "@earendil-works/pi-ai";
|
import type { ImageContent } from "@earendil-works/pi-ai";
|
||||||
import type { Args } from "./args.js";
|
import type { Args } from "./args.ts";
|
||||||
|
|
||||||
export interface InitialMessageInput {
|
export interface InitialMessageInput {
|
||||||
parsed: Args;
|
parsed: Args;
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
import type { Api, Model } from "@earendil-works/pi-ai";
|
import type { Api, Model } from "@earendil-works/pi-ai";
|
||||||
import { fuzzyFilter } from "@earendil-works/pi-tui";
|
import { fuzzyFilter } from "@earendil-works/pi-tui";
|
||||||
import chalk from "chalk";
|
import chalk from "chalk";
|
||||||
import { formatNoModelsAvailableMessage } from "../core/auth-guidance.js";
|
import { formatNoModelsAvailableMessage } from "../core/auth-guidance.ts";
|
||||||
import type { ModelRegistry } from "../core/model-registry.js";
|
import type { ModelRegistry } from "../core/model-registry.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format a number as human-readable (e.g., 200000 -> "200K", 1000000 -> "1M")
|
* Format a number as human-readable (e.g., 200000 -> "200K", 1000000 -> "1M")
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ProcessTerminal, setKeybindings, TUI } from "@earendil-works/pi-tui";
|
import { ProcessTerminal, setKeybindings, TUI } from "@earendil-works/pi-tui";
|
||||||
import { KeybindingsManager } from "../core/keybindings.js";
|
import { KeybindingsManager } from "../core/keybindings.ts";
|
||||||
import type { SessionInfo, SessionListProgress } from "../core/session-manager.js";
|
import type { SessionInfo, SessionListProgress } from "../core/session-manager.ts";
|
||||||
import { SessionSelectorComponent } from "../modes/interactive/components/session-selector.js";
|
import { SessionSelectorComponent } from "../modes/interactive/components/session-selector.ts";
|
||||||
|
|
||||||
type SessionsLoader = (onProgress?: SessionListProgress) => Promise<SessionInfo[]>;
|
type SessionsLoader = (onProgress?: SessionListProgress) => Promise<SessionInfo[]>;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { accessSync, constants, existsSync, readFileSync, realpathSync } from "f
|
|||||||
import { homedir } from "os";
|
import { homedir } from "os";
|
||||||
import { basename, dirname, join, resolve, sep, win32 } from "path";
|
import { basename, dirname, join, resolve, sep, win32 } from "path";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
import { spawnProcessSync } from "./utils/child-process.js";
|
import { spawnProcessSync } from "./utils/child-process.ts";
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Package Detection
|
// Package Detection
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
|
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
|
||||||
import { basename, join, resolve } from "node:path";
|
import { basename, join, resolve } from "node:path";
|
||||||
import type { AgentSession } from "./agent-session.js";
|
import type { AgentSession } from "./agent-session.ts";
|
||||||
import type { AgentSessionRuntimeDiagnostic, AgentSessionServices } from "./agent-session-services.js";
|
import type { AgentSessionRuntimeDiagnostic, AgentSessionServices } from "./agent-session-services.ts";
|
||||||
import type { ReplacedSessionContext, SessionShutdownEvent, SessionStartEvent } from "./extensions/index.js";
|
import type { ReplacedSessionContext, SessionShutdownEvent, SessionStartEvent } from "./extensions/index.ts";
|
||||||
import { emitSessionShutdownEvent } from "./extensions/runner.js";
|
import { emitSessionShutdownEvent } from "./extensions/runner.ts";
|
||||||
import type { CreateAgentSessionResult } from "./sdk.js";
|
import type { CreateAgentSessionResult } from "./sdk.ts";
|
||||||
import { assertSessionCwdExists } from "./session-cwd.js";
|
import { assertSessionCwdExists } from "./session-cwd.ts";
|
||||||
import { SessionManager } from "./session-manager.js";
|
import { SessionManager } from "./session-manager.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Result returned by runtime creation.
|
* Result returned by runtime creation.
|
||||||
@@ -417,4 +417,4 @@ export {
|
|||||||
type CreateAgentSessionServicesOptions,
|
type CreateAgentSessionServicesOptions,
|
||||||
createAgentSessionFromServices,
|
createAgentSessionFromServices,
|
||||||
createAgentSessionServices,
|
createAgentSessionServices,
|
||||||
} from "./agent-session-services.js";
|
} from "./agent-session-services.ts";
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
||||||
import type { Model } from "@earendil-works/pi-ai";
|
import type { Model } from "@earendil-works/pi-ai";
|
||||||
import { getAgentDir } from "../config.js";
|
import { getAgentDir } from "../config.ts";
|
||||||
import { AuthStorage } from "./auth-storage.js";
|
import { AuthStorage } from "./auth-storage.ts";
|
||||||
import type { SessionStartEvent, ToolDefinition } from "./extensions/index.js";
|
import type { SessionStartEvent, ToolDefinition } from "./extensions/index.ts";
|
||||||
import { ModelRegistry } from "./model-registry.js";
|
import { ModelRegistry } from "./model-registry.ts";
|
||||||
import { DefaultResourceLoader, type DefaultResourceLoaderOptions, type ResourceLoader } from "./resource-loader.js";
|
import { DefaultResourceLoader, type DefaultResourceLoaderOptions, type ResourceLoader } from "./resource-loader.ts";
|
||||||
import { type CreateAgentSessionOptions, type CreateAgentSessionResult, createAgentSession } from "./sdk.js";
|
import { type CreateAgentSessionOptions, type CreateAgentSessionResult, createAgentSession } from "./sdk.ts";
|
||||||
import type { SessionManager } from "./session-manager.js";
|
import type { SessionManager } from "./session-manager.ts";
|
||||||
import { SettingsManager } from "./settings-manager.js";
|
import { SettingsManager } from "./settings-manager.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Non-fatal issues collected while creating services or sessions.
|
* Non-fatal issues collected while creating services or sessions.
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ import {
|
|||||||
resetApiProviders,
|
resetApiProviders,
|
||||||
streamSimple,
|
streamSimple,
|
||||||
} from "@earendil-works/pi-ai";
|
} from "@earendil-works/pi-ai";
|
||||||
import { theme } from "../modes/interactive/theme/theme.js";
|
import { theme } from "../modes/interactive/theme/theme.ts";
|
||||||
import { stripFrontmatter } from "../utils/frontmatter.js";
|
import { stripFrontmatter } from "../utils/frontmatter.ts";
|
||||||
import { sleep } from "../utils/sleep.js";
|
import { sleep } from "../utils/sleep.ts";
|
||||||
import { formatNoApiKeyFoundMessage, formatNoModelSelectedMessage } from "./auth-guidance.js";
|
import { formatNoApiKeyFoundMessage, formatNoModelSelectedMessage } from "./auth-guidance.ts";
|
||||||
import { type BashResult, executeBashWithOperations } from "./bash-executor.js";
|
import { type BashResult, executeBashWithOperations } from "./bash-executor.ts";
|
||||||
import {
|
import {
|
||||||
type CompactionResult,
|
type CompactionResult,
|
||||||
calculateContextTokens,
|
calculateContextTokens,
|
||||||
@@ -47,10 +47,10 @@ import {
|
|||||||
generateBranchSummary,
|
generateBranchSummary,
|
||||||
prepareCompaction,
|
prepareCompaction,
|
||||||
shouldCompact,
|
shouldCompact,
|
||||||
} from "./compaction/index.js";
|
} from "./compaction/index.ts";
|
||||||
import { DEFAULT_THINKING_LEVEL } from "./defaults.js";
|
import { DEFAULT_THINKING_LEVEL } from "./defaults.ts";
|
||||||
import { exportSessionToHtml, type ToolHtmlRenderer } from "./export-html/index.js";
|
import { exportSessionToHtml, type ToolHtmlRenderer } from "./export-html/index.ts";
|
||||||
import { createToolHtmlRenderer } from "./export-html/tool-renderer.js";
|
import { createToolHtmlRenderer } from "./export-html/tool-renderer.ts";
|
||||||
import {
|
import {
|
||||||
type ContextUsage,
|
type ContextUsage,
|
||||||
type ExtensionCommandContextActions,
|
type ExtensionCommandContextActions,
|
||||||
@@ -75,21 +75,21 @@ import {
|
|||||||
type TurnEndEvent,
|
type TurnEndEvent,
|
||||||
type TurnStartEvent,
|
type TurnStartEvent,
|
||||||
wrapRegisteredTools,
|
wrapRegisteredTools,
|
||||||
} from "./extensions/index.js";
|
} from "./extensions/index.ts";
|
||||||
import { emitSessionShutdownEvent } from "./extensions/runner.js";
|
import { emitSessionShutdownEvent } from "./extensions/runner.ts";
|
||||||
import type { BashExecutionMessage, CustomMessage } from "./messages.js";
|
import type { BashExecutionMessage, CustomMessage } from "./messages.ts";
|
||||||
import type { ModelRegistry } from "./model-registry.js";
|
import type { ModelRegistry } from "./model-registry.ts";
|
||||||
import { expandPromptTemplate, type PromptTemplate } from "./prompt-templates.js";
|
import { expandPromptTemplate, type PromptTemplate } from "./prompt-templates.ts";
|
||||||
import type { ResourceExtensionPaths, ResourceLoader } from "./resource-loader.js";
|
import type { ResourceExtensionPaths, ResourceLoader } from "./resource-loader.ts";
|
||||||
import type { BranchSummaryEntry, CompactionEntry, SessionManager } from "./session-manager.js";
|
import type { BranchSummaryEntry, CompactionEntry, SessionManager } from "./session-manager.ts";
|
||||||
import { CURRENT_SESSION_VERSION, getLatestCompactionEntry, type SessionHeader } from "./session-manager.js";
|
import { CURRENT_SESSION_VERSION, getLatestCompactionEntry, type SessionHeader } from "./session-manager.ts";
|
||||||
import type { SettingsManager } from "./settings-manager.js";
|
import type { SettingsManager } from "./settings-manager.ts";
|
||||||
import type { SlashCommandInfo } from "./slash-commands.js";
|
import type { SlashCommandInfo } from "./slash-commands.ts";
|
||||||
import { createSyntheticSourceInfo, type SourceInfo } from "./source-info.js";
|
import { createSyntheticSourceInfo, type SourceInfo } from "./source-info.ts";
|
||||||
import { type BuildSystemPromptOptions, buildSystemPrompt } from "./system-prompt.js";
|
import { type BuildSystemPromptOptions, buildSystemPrompt } from "./system-prompt.ts";
|
||||||
import { type BashOperations, createLocalBashOperations } from "./tools/bash.js";
|
import { type BashOperations, createLocalBashOperations } from "./tools/bash.ts";
|
||||||
import { createAllToolDefinitions } from "./tools/index.js";
|
import { createAllToolDefinitions } from "./tools/index.ts";
|
||||||
import { createToolDefinitionFromAgentTool } from "./tools/tool-definition-wrapper.js";
|
import { createToolDefinitionFromAgentTool } from "./tools/tool-definition-wrapper.ts";
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Skill Block Parsing
|
// Skill Block Parsing
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { getDocsPath } from "../config.js";
|
import { getDocsPath } from "../config.ts";
|
||||||
|
|
||||||
const UNKNOWN_PROVIDER = "unknown";
|
const UNKNOWN_PROVIDER = "unknown";
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import { getOAuthApiKey, getOAuthProvider, getOAuthProviders } from "@earendil-w
|
|||||||
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
||||||
import { dirname, join } from "path";
|
import { dirname, join } from "path";
|
||||||
import lockfile from "proper-lockfile";
|
import lockfile from "proper-lockfile";
|
||||||
import { getAgentDir } from "../config.js";
|
import { getAgentDir } from "../config.ts";
|
||||||
import { resolveConfigValue } from "./resolve-config-value.js";
|
import { resolveConfigValue } from "./resolve-config-value.ts";
|
||||||
|
|
||||||
export type ApiKeyCredential = {
|
export type ApiKeyCredential = {
|
||||||
type: "api_key";
|
type: "api_key";
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import { randomBytes } from "node:crypto";
|
|||||||
import { createWriteStream, type WriteStream } from "node:fs";
|
import { createWriteStream, type WriteStream } from "node:fs";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { stripAnsi } from "../utils/ansi.js";
|
import { stripAnsi } from "../utils/ansi.ts";
|
||||||
import { sanitizeBinaryOutput } from "../utils/shell.js";
|
import { sanitizeBinaryOutput } from "../utils/shell.ts";
|
||||||
import type { BashOperations } from "./tools/bash.js";
|
import type { BashOperations } from "./tools/bash.ts";
|
||||||
import { DEFAULT_MAX_BYTES, truncateTail } from "./tools/truncate.js";
|
import { DEFAULT_MAX_BYTES, truncateTail } from "./tools/truncate.ts";
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Types
|
// Types
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import {
|
|||||||
createBranchSummaryMessage,
|
createBranchSummaryMessage,
|
||||||
createCompactionSummaryMessage,
|
createCompactionSummaryMessage,
|
||||||
createCustomMessage,
|
createCustomMessage,
|
||||||
} from "../messages.js";
|
} from "../messages.ts";
|
||||||
import type { ReadonlySessionManager, SessionEntry } from "../session-manager.js";
|
import type { ReadonlySessionManager, SessionEntry } from "../session-manager.ts";
|
||||||
import { estimateTokens } from "./compaction.js";
|
import { estimateTokens } from "./compaction.ts";
|
||||||
import {
|
import {
|
||||||
computeFileLists,
|
computeFileLists,
|
||||||
createFileOps,
|
createFileOps,
|
||||||
@@ -24,7 +24,7 @@ import {
|
|||||||
formatFileOperations,
|
formatFileOperations,
|
||||||
SUMMARIZATION_SYSTEM_PROMPT,
|
SUMMARIZATION_SYSTEM_PROMPT,
|
||||||
serializeConversation,
|
serializeConversation,
|
||||||
} from "./utils.js";
|
} from "./utils.ts";
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Types
|
// Types
|
||||||
@@ -44,7 +44,7 @@ export interface BranchSummaryDetails {
|
|||||||
modifiedFiles: string[];
|
modifiedFiles: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export type { FileOperations } from "./utils.js";
|
export type { FileOperations } from "./utils.ts";
|
||||||
|
|
||||||
export interface BranchPreparation {
|
export interface BranchPreparation {
|
||||||
/** Messages extracted for summarization, in chronological order */
|
/** Messages extracted for summarization, in chronological order */
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import {
|
|||||||
createBranchSummaryMessage,
|
createBranchSummaryMessage,
|
||||||
createCompactionSummaryMessage,
|
createCompactionSummaryMessage,
|
||||||
createCustomMessage,
|
createCustomMessage,
|
||||||
} from "../messages.js";
|
} from "../messages.ts";
|
||||||
import { buildSessionContext, type CompactionEntry, type SessionEntry } from "../session-manager.js";
|
import { buildSessionContext, type CompactionEntry, type SessionEntry } from "../session-manager.ts";
|
||||||
import {
|
import {
|
||||||
computeFileLists,
|
computeFileLists,
|
||||||
createFileOps,
|
createFileOps,
|
||||||
@@ -23,7 +23,7 @@ import {
|
|||||||
formatFileOperations,
|
formatFileOperations,
|
||||||
SUMMARIZATION_SYSTEM_PROMPT,
|
SUMMARIZATION_SYSTEM_PROMPT,
|
||||||
serializeConversation,
|
serializeConversation,
|
||||||
} from "./utils.js";
|
} from "./utils.ts";
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// File Operation Tracking
|
// File Operation Tracking
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
* Compaction and summarization utilities.
|
* Compaction and summarization utilities.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export * from "./branch-summarization.js";
|
export * from "./branch-summarization.ts";
|
||||||
export * from "./compaction.js";
|
export * from "./compaction.ts";
|
||||||
export * from "./utils.js";
|
export * from "./utils.ts";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { spawn } from "node:child_process";
|
import { spawn } from "node:child_process";
|
||||||
import { waitForChildProcess } from "../utils/child-process.js";
|
import { waitForChildProcess } from "../utils/child-process.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Options for executing shell commands.
|
* Options for executing shell commands.
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import type { AgentState } from "@earendil-works/pi-agent-core";
|
import type { AgentState } from "@earendil-works/pi-agent-core";
|
||||||
import { existsSync, readFileSync, writeFileSync } from "fs";
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
||||||
import { basename, join } from "path";
|
import { basename, join } from "path";
|
||||||
import { APP_NAME, getExportTemplateDir } from "../../config.js";
|
import { APP_NAME, getExportTemplateDir } from "../../config.ts";
|
||||||
import { getResolvedThemeColors, getThemeExportColors } from "../../modes/interactive/theme/theme.js";
|
import { getResolvedThemeColors, getThemeExportColors } from "../../modes/interactive/theme/theme.ts";
|
||||||
import type { ToolDefinition } from "../extensions/types.js";
|
import type { ToolDefinition } from "../extensions/types.ts";
|
||||||
import type { SessionEntry } from "../session-manager.js";
|
import type { SessionEntry } from "../session-manager.ts";
|
||||||
import { SessionManager } from "../session-manager.js";
|
import { SessionManager } from "../session-manager.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for rendering custom tools to HTML.
|
* Interface for rendering custom tools to HTML.
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
|
|
||||||
import type { ImageContent, TextContent } from "@earendil-works/pi-ai";
|
import type { ImageContent, TextContent } from "@earendil-works/pi-ai";
|
||||||
import type { Component } from "@earendil-works/pi-tui";
|
import type { Component } from "@earendil-works/pi-tui";
|
||||||
import type { Theme } from "../../modes/interactive/theme/theme.js";
|
import type { Theme } from "../../modes/interactive/theme/theme.ts";
|
||||||
import type { ToolDefinition, ToolRenderContext } from "../extensions/types.js";
|
import type { ToolDefinition, ToolRenderContext } from "../extensions/types.ts";
|
||||||
import { ansiLinesToHtml } from "./ansi-to-html.js";
|
import { ansiLinesToHtml } from "./ansi-to-html.ts";
|
||||||
|
|
||||||
export interface ToolHtmlRendererDeps {
|
export interface ToolHtmlRendererDeps {
|
||||||
/** Function to look up tool definition by name */
|
/** Function to look up tool definition by name */
|
||||||
|
|||||||
@@ -2,14 +2,14 @@
|
|||||||
* Extension system for lifecycle events and custom tools.
|
* Extension system for lifecycle events and custom tools.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export type { SlashCommandInfo, SlashCommandSource } from "../slash-commands.js";
|
export type { SlashCommandInfo, SlashCommandSource } from "../slash-commands.ts";
|
||||||
export type { SourceInfo } from "../source-info.js";
|
export type { SourceInfo } from "../source-info.ts";
|
||||||
export {
|
export {
|
||||||
createExtensionRuntime,
|
createExtensionRuntime,
|
||||||
discoverAndLoadExtensions,
|
discoverAndLoadExtensions,
|
||||||
loadExtensionFromFactory,
|
loadExtensionFromFactory,
|
||||||
loadExtensions,
|
loadExtensions,
|
||||||
} from "./loader.js";
|
} from "./loader.ts";
|
||||||
export type {
|
export type {
|
||||||
ExtensionErrorListener,
|
ExtensionErrorListener,
|
||||||
ForkHandler,
|
ForkHandler,
|
||||||
@@ -17,8 +17,8 @@ export type {
|
|||||||
NewSessionHandler,
|
NewSessionHandler,
|
||||||
ShutdownHandler,
|
ShutdownHandler,
|
||||||
SwitchSessionHandler,
|
SwitchSessionHandler,
|
||||||
} from "./runner.js";
|
} from "./runner.ts";
|
||||||
export { ExtensionRunner } from "./runner.js";
|
export { ExtensionRunner } from "./runner.ts";
|
||||||
export type {
|
export type {
|
||||||
AfterProviderResponseEvent,
|
AfterProviderResponseEvent,
|
||||||
AgentEndEvent,
|
AgentEndEvent,
|
||||||
@@ -156,7 +156,7 @@ export type {
|
|||||||
WorkingIndicatorOptions,
|
WorkingIndicatorOptions,
|
||||||
WriteToolCallEvent,
|
WriteToolCallEvent,
|
||||||
WriteToolResultEvent,
|
WriteToolResultEvent,
|
||||||
} from "./types.js";
|
} from "./types.ts";
|
||||||
// Type guards
|
// Type guards
|
||||||
export {
|
export {
|
||||||
defineTool,
|
defineTool,
|
||||||
@@ -168,5 +168,5 @@ export {
|
|||||||
isReadToolResult,
|
isReadToolResult,
|
||||||
isToolCallEventType,
|
isToolCallEventType,
|
||||||
isWriteToolResult,
|
isWriteToolResult,
|
||||||
} from "./types.js";
|
} from "./types.ts";
|
||||||
export { wrapRegisteredTool, wrapRegisteredTools } from "./wrapper.js";
|
export { wrapRegisteredTool, wrapRegisteredTools } from "./wrapper.ts";
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ import { createJiti } from "jiti/static";
|
|||||||
import * as _bundledTypebox from "typebox";
|
import * as _bundledTypebox from "typebox";
|
||||||
import * as _bundledTypeboxCompile from "typebox/compile";
|
import * as _bundledTypeboxCompile from "typebox/compile";
|
||||||
import * as _bundledTypeboxValue from "typebox/value";
|
import * as _bundledTypeboxValue from "typebox/value";
|
||||||
import { CONFIG_DIR_NAME, getAgentDir, isBunBinary } from "../../config.js";
|
import { CONFIG_DIR_NAME, getAgentDir, isBunBinary } from "../../config.ts";
|
||||||
// NOTE: This import works because loader.ts exports are NOT re-exported from index.ts,
|
// NOTE: This import works because loader.ts exports are NOT re-exported from index.ts,
|
||||||
// avoiding a circular dependency. Extensions can import from @earendil-works/pi-coding-agent.
|
// avoiding a circular dependency. Extensions can import from @earendil-works/pi-coding-agent.
|
||||||
import * as _bundledPiCodingAgent from "../../index.js";
|
import * as _bundledPiCodingAgent from "../../index.ts";
|
||||||
import { createEventBus, type EventBus } from "../event-bus.js";
|
import { createEventBus, type EventBus } from "../event-bus.ts";
|
||||||
import type { ExecOptions } from "../exec.js";
|
import type { ExecOptions } from "../exec.ts";
|
||||||
import { execCommand } from "../exec.js";
|
import { execCommand } from "../exec.ts";
|
||||||
import { createSyntheticSourceInfo } from "../source-info.js";
|
import { createSyntheticSourceInfo } from "../source-info.ts";
|
||||||
import type {
|
import type {
|
||||||
Extension,
|
Extension,
|
||||||
ExtensionAPI,
|
ExtensionAPI,
|
||||||
@@ -38,7 +38,7 @@ import type {
|
|||||||
ProviderConfig,
|
ProviderConfig,
|
||||||
RegisteredCommand,
|
RegisteredCommand,
|
||||||
ToolDefinition,
|
ToolDefinition,
|
||||||
} from "./types.js";
|
} from "./types.ts";
|
||||||
|
|
||||||
/** Modules available to extensions via virtualModules (for compiled Bun binary) */
|
/** Modules available to extensions via virtualModules (for compiled Bun binary) */
|
||||||
const VIRTUAL_MODULES: Record<string, unknown> = {
|
const VIRTUAL_MODULES: Record<string, unknown> = {
|
||||||
@@ -236,7 +236,7 @@ function createExtensionAPI(
|
|||||||
shortcut: KeyId,
|
shortcut: KeyId,
|
||||||
options: {
|
options: {
|
||||||
description?: string;
|
description?: string;
|
||||||
handler: (ctx: import("./types.js").ExtensionContext) => Promise<void> | void;
|
handler: (ctx: import("./types.ts").ExtensionContext) => Promise<void> | void;
|
||||||
},
|
},
|
||||||
): void {
|
): void {
|
||||||
runtime.assertActive();
|
runtime.assertActive();
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
||||||
import type { ImageContent, Model } from "@earendil-works/pi-ai";
|
import type { ImageContent, Model } from "@earendil-works/pi-ai";
|
||||||
import type { KeyId } from "@earendil-works/pi-tui";
|
import type { KeyId } from "@earendil-works/pi-tui";
|
||||||
import { type Theme, theme } from "../../modes/interactive/theme/theme.js";
|
import { type Theme, theme } from "../../modes/interactive/theme/theme.ts";
|
||||||
import type { ResourceDiagnostic } from "../diagnostics.js";
|
import type { ResourceDiagnostic } from "../diagnostics.ts";
|
||||||
import type { KeybindingsConfig } from "../keybindings.js";
|
import type { KeybindingsConfig } from "../keybindings.ts";
|
||||||
import type { ModelRegistry } from "../model-registry.js";
|
import type { ModelRegistry } from "../model-registry.ts";
|
||||||
import type { SessionManager } from "../session-manager.js";
|
import type { SessionManager } from "../session-manager.ts";
|
||||||
import type { BuildSystemPromptOptions } from "../system-prompt.js";
|
import type { BuildSystemPromptOptions } from "../system-prompt.ts";
|
||||||
import type {
|
import type {
|
||||||
BeforeAgentStartEvent,
|
BeforeAgentStartEvent,
|
||||||
BeforeAgentStartEventResult,
|
BeforeAgentStartEventResult,
|
||||||
@@ -55,7 +55,7 @@ import type {
|
|||||||
ToolResultEventResult,
|
ToolResultEventResult,
|
||||||
UserBashEvent,
|
UserBashEvent,
|
||||||
UserBashEventResult,
|
UserBashEventResult,
|
||||||
} from "./types.js";
|
} from "./types.ts";
|
||||||
|
|
||||||
// Extension shortcuts compete with canonical keybinding ids from keybindings.json.
|
// Extension shortcuts compete with canonical keybinding ids from keybindings.json.
|
||||||
// Only editor-global shortcuts are reserved here. Picker-specific bindings are not.
|
// Only editor-global shortcuts are reserved here. Picker-specific bindings are not.
|
||||||
|
|||||||
@@ -40,27 +40,27 @@ import type {
|
|||||||
TUI,
|
TUI,
|
||||||
} from "@earendil-works/pi-tui";
|
} from "@earendil-works/pi-tui";
|
||||||
import type { Static, TSchema } from "typebox";
|
import type { Static, TSchema } from "typebox";
|
||||||
import type { Theme } from "../../modes/interactive/theme/theme.js";
|
import type { Theme } from "../../modes/interactive/theme/theme.ts";
|
||||||
import type { BashResult } from "../bash-executor.js";
|
import type { BashResult } from "../bash-executor.ts";
|
||||||
import type { CompactionPreparation, CompactionResult } from "../compaction/index.js";
|
import type { CompactionPreparation, CompactionResult } from "../compaction/index.ts";
|
||||||
import type { EventBus } from "../event-bus.js";
|
import type { EventBus } from "../event-bus.ts";
|
||||||
import type { ExecOptions, ExecResult } from "../exec.js";
|
import type { ExecOptions, ExecResult } from "../exec.ts";
|
||||||
import type { ReadonlyFooterDataProvider } from "../footer-data-provider.js";
|
import type { ReadonlyFooterDataProvider } from "../footer-data-provider.ts";
|
||||||
import type { KeybindingsManager } from "../keybindings.js";
|
import type { KeybindingsManager } from "../keybindings.ts";
|
||||||
import type { CustomMessage } from "../messages.js";
|
import type { CustomMessage } from "../messages.ts";
|
||||||
import type { ModelRegistry } from "../model-registry.js";
|
import type { ModelRegistry } from "../model-registry.ts";
|
||||||
import type {
|
import type {
|
||||||
BranchSummaryEntry,
|
BranchSummaryEntry,
|
||||||
CompactionEntry,
|
CompactionEntry,
|
||||||
ReadonlySessionManager,
|
ReadonlySessionManager,
|
||||||
SessionEntry,
|
SessionEntry,
|
||||||
SessionManager,
|
SessionManager,
|
||||||
} from "../session-manager.js";
|
} from "../session-manager.ts";
|
||||||
import type { SlashCommandInfo } from "../slash-commands.js";
|
import type { SlashCommandInfo } from "../slash-commands.ts";
|
||||||
import type { SourceInfo } from "../source-info.js";
|
import type { SourceInfo } from "../source-info.ts";
|
||||||
import type { BuildSystemPromptOptions } from "../system-prompt.js";
|
import type { BuildSystemPromptOptions } from "../system-prompt.ts";
|
||||||
import type { BashOperations } from "../tools/bash.js";
|
import type { BashOperations } from "../tools/bash.ts";
|
||||||
import type { EditToolDetails } from "../tools/edit.js";
|
import type { EditToolDetails } from "../tools/edit.ts";
|
||||||
import type {
|
import type {
|
||||||
BashToolDetails,
|
BashToolDetails,
|
||||||
BashToolInput,
|
BashToolInput,
|
||||||
@@ -74,12 +74,12 @@ import type {
|
|||||||
ReadToolDetails,
|
ReadToolDetails,
|
||||||
ReadToolInput,
|
ReadToolInput,
|
||||||
WriteToolInput,
|
WriteToolInput,
|
||||||
} from "../tools/index.js";
|
} from "../tools/index.ts";
|
||||||
|
|
||||||
export type { ExecOptions, ExecResult } from "../exec.js";
|
export type { ExecOptions, ExecResult } from "../exec.ts";
|
||||||
export type { BuildSystemPromptOptions } from "../system-prompt.js";
|
export type { BuildSystemPromptOptions } from "../system-prompt.ts";
|
||||||
export type { AgentToolResult, AgentToolUpdateCallback, ToolExecutionMode };
|
export type { AgentToolResult, AgentToolUpdateCallback, ToolExecutionMode };
|
||||||
export type { AppKeybinding, KeybindingsManager } from "../keybindings.js";
|
export type { AppKeybinding, KeybindingsManager } from "../keybindings.ts";
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// UI Context
|
// UI Context
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
import type { AgentTool } from "@earendil-works/pi-agent-core";
|
||||||
import { wrapToolDefinition, wrapToolDefinitions } from "../tools/tool-definition-wrapper.js";
|
import { wrapToolDefinition, wrapToolDefinitions } from "../tools/tool-definition-wrapper.ts";
|
||||||
import type { ExtensionRunner } from "./runner.js";
|
import type { ExtensionRunner } from "./runner.ts";
|
||||||
import type { RegisteredTool } from "./types.js";
|
import type { RegisteredTool } from "./types.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrap a RegisteredTool into an AgentTool.
|
* Wrap a RegisteredTool into an AgentTool.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { type ExecFileException, execFile, spawnSync } from "child_process";
|
import { type ExecFileException, execFile, spawnSync } from "child_process";
|
||||||
import { existsSync, type FSWatcher, readFileSync, statSync, unwatchFile, watchFile } from "fs";
|
import { existsSync, type FSWatcher, readFileSync, statSync, unwatchFile, watchFile } from "fs";
|
||||||
import { dirname, join, resolve } from "path";
|
import { dirname, join, resolve } from "path";
|
||||||
import { closeWatcher, FS_WATCH_RETRY_DELAY_MS, watchWithErrorHandler } from "../utils/fs-watch.js";
|
import { closeWatcher, FS_WATCH_RETRY_DELAY_MS, watchWithErrorHandler } from "../utils/fs-watch.ts";
|
||||||
|
|
||||||
type GitPaths = {
|
type GitPaths = {
|
||||||
repoDir: string;
|
repoDir: string;
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ export {
|
|||||||
type ModelCycleResult,
|
type ModelCycleResult,
|
||||||
type PromptOptions,
|
type PromptOptions,
|
||||||
type SessionStats,
|
type SessionStats,
|
||||||
} from "./agent-session.js";
|
} from "./agent-session.ts";
|
||||||
export {
|
export {
|
||||||
AgentSessionRuntime,
|
AgentSessionRuntime,
|
||||||
type CreateAgentSessionRuntimeFactory,
|
type CreateAgentSessionRuntimeFactory,
|
||||||
type CreateAgentSessionRuntimeResult,
|
type CreateAgentSessionRuntimeResult,
|
||||||
createAgentSessionRuntime,
|
createAgentSessionRuntime,
|
||||||
} from "./agent-session-runtime.js";
|
} from "./agent-session-runtime.ts";
|
||||||
export {
|
export {
|
||||||
type AgentSessionRuntimeDiagnostic,
|
type AgentSessionRuntimeDiagnostic,
|
||||||
type AgentSessionServices,
|
type AgentSessionServices,
|
||||||
@@ -24,10 +24,10 @@ export {
|
|||||||
type CreateAgentSessionServicesOptions,
|
type CreateAgentSessionServicesOptions,
|
||||||
createAgentSessionFromServices,
|
createAgentSessionFromServices,
|
||||||
createAgentSessionServices,
|
createAgentSessionServices,
|
||||||
} from "./agent-session-services.js";
|
} from "./agent-session-services.ts";
|
||||||
export { type BashExecutorOptions, type BashResult, executeBashWithOperations } from "./bash-executor.js";
|
export { type BashExecutorOptions, type BashResult, executeBashWithOperations } from "./bash-executor.ts";
|
||||||
export type { CompactionResult } from "./compaction/index.js";
|
export type { CompactionResult } from "./compaction/index.ts";
|
||||||
export { createEventBus, type EventBus, type EventBusController } from "./event-bus.js";
|
export { createEventBus, type EventBus, type EventBusController } from "./event-bus.ts";
|
||||||
// Extensions system
|
// Extensions system
|
||||||
export {
|
export {
|
||||||
type AgentEndEvent,
|
type AgentEndEvent,
|
||||||
@@ -73,5 +73,5 @@ export {
|
|||||||
type TurnEndEvent,
|
type TurnEndEvent,
|
||||||
type TurnStartEvent,
|
type TurnStartEvent,
|
||||||
type WorkingIndicatorOptions,
|
type WorkingIndicatorOptions,
|
||||||
} from "./extensions/index.js";
|
} from "./extensions/index.ts";
|
||||||
export { createSyntheticSourceInfo } from "./source-info.js";
|
export { createSyntheticSourceInfo } from "./source-info.ts";
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
} from "@earendil-works/pi-tui";
|
} from "@earendil-works/pi-tui";
|
||||||
import { existsSync, readFileSync } from "fs";
|
import { existsSync, readFileSync } from "fs";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import { getAgentDir } from "../config.js";
|
import { getAgentDir } from "../config.ts";
|
||||||
|
|
||||||
export interface AppKeybindings {
|
export interface AppKeybindings {
|
||||||
"app.interrupt": true;
|
"app.interrupt": true;
|
||||||
|
|||||||
@@ -24,15 +24,15 @@ import { join } from "path";
|
|||||||
import { type Static, Type } from "typebox";
|
import { type Static, Type } from "typebox";
|
||||||
import { Compile } from "typebox/compile";
|
import { Compile } from "typebox/compile";
|
||||||
import type { TLocalizedValidationError } from "typebox/error";
|
import type { TLocalizedValidationError } from "typebox/error";
|
||||||
import { getAgentDir } from "../config.js";
|
import { getAgentDir } from "../config.ts";
|
||||||
import type { AuthStatus, AuthStorage } from "./auth-storage.js";
|
import type { AuthStatus, AuthStorage } from "./auth-storage.ts";
|
||||||
import { BUILT_IN_PROVIDER_DISPLAY_NAMES } from "./provider-display-names.js";
|
import { BUILT_IN_PROVIDER_DISPLAY_NAMES } from "./provider-display-names.ts";
|
||||||
import {
|
import {
|
||||||
clearConfigValueCache,
|
clearConfigValueCache,
|
||||||
resolveConfigValueOrThrow,
|
resolveConfigValueOrThrow,
|
||||||
resolveConfigValueUncached,
|
resolveConfigValueUncached,
|
||||||
resolveHeadersOrThrow,
|
resolveHeadersOrThrow,
|
||||||
} from "./resolve-config-value.js";
|
} from "./resolve-config-value.ts";
|
||||||
|
|
||||||
// Schema for OpenRouter routing preferences
|
// Schema for OpenRouter routing preferences
|
||||||
const PercentileCutoffsSchema = Type.Object({
|
const PercentileCutoffsSchema = Type.Object({
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|||||||
import { type Api, type KnownProvider, type Model, modelsAreEqual } from "@earendil-works/pi-ai";
|
import { type Api, type KnownProvider, type Model, modelsAreEqual } from "@earendil-works/pi-ai";
|
||||||
import chalk from "chalk";
|
import chalk from "chalk";
|
||||||
import { minimatch } from "minimatch";
|
import { minimatch } from "minimatch";
|
||||||
import { isValidThinkingLevel } from "../cli/args.js";
|
import { isValidThinkingLevel } from "../cli/args.ts";
|
||||||
import { DEFAULT_THINKING_LEVEL } from "./defaults.js";
|
import { DEFAULT_THINKING_LEVEL } from "./defaults.ts";
|
||||||
import type { ModelRegistry } from "./model-registry.js";
|
import type { ModelRegistry } from "./model-registry.ts";
|
||||||
|
|
||||||
/** Default model IDs for each known provider */
|
/** Default model IDs for each known provider */
|
||||||
export const defaultModelPerProvider: Record<KnownProvider, string> = {
|
export const defaultModelPerProvider: Record<KnownProvider, string> = {
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ import type { Readable } from "node:stream";
|
|||||||
import { globSync } from "glob";
|
import { globSync } from "glob";
|
||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import { minimatch } from "minimatch";
|
import { minimatch } from "minimatch";
|
||||||
import { CONFIG_DIR_NAME } from "../config.js";
|
import { CONFIG_DIR_NAME } from "../config.ts";
|
||||||
import { spawnProcess, spawnProcessSync } from "../utils/child-process.js";
|
import { spawnProcess, spawnProcessSync } from "../utils/child-process.ts";
|
||||||
import { type GitSource, parseGitUrl } from "../utils/git.js";
|
import { type GitSource, parseGitUrl } from "../utils/git.ts";
|
||||||
import { canonicalizePath, isLocalPath } from "../utils/paths.js";
|
import { canonicalizePath, isLocalPath } from "../utils/paths.ts";
|
||||||
import { isStdoutTakenOver } from "./output-guard.js";
|
import { isStdoutTakenOver } from "./output-guard.ts";
|
||||||
import type { PackageSource, SettingsManager } from "./settings-manager.js";
|
import type { PackageSource, SettingsManager } from "./settings-manager.ts";
|
||||||
|
|
||||||
const NETWORK_TIMEOUT_MS = 10000;
|
const NETWORK_TIMEOUT_MS = 10000;
|
||||||
const UPDATE_CHECK_CONCURRENCY = 4;
|
const UPDATE_CHECK_CONCURRENCY = 4;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { existsSync, readdirSync, readFileSync, statSync } from "fs";
|
import { existsSync, readdirSync, readFileSync, statSync } from "fs";
|
||||||
import { homedir } from "os";
|
import { homedir } from "os";
|
||||||
import { basename, dirname, isAbsolute, join, resolve, sep } from "path";
|
import { basename, dirname, isAbsolute, join, resolve, sep } from "path";
|
||||||
import { CONFIG_DIR_NAME } from "../config.js";
|
import { CONFIG_DIR_NAME } from "../config.ts";
|
||||||
import { parseFrontmatter } from "../utils/frontmatter.js";
|
import { parseFrontmatter } from "../utils/frontmatter.ts";
|
||||||
import { createSyntheticSourceInfo, type SourceInfo } from "./source-info.js";
|
import { createSyntheticSourceInfo, type SourceInfo } from "./source-info.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a prompt template loaded from a markdown file
|
* Represents a prompt template loaded from a markdown file
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { execSync, spawnSync } from "child_process";
|
import { execSync, spawnSync } from "child_process";
|
||||||
import { getShellConfig } from "../utils/shell.js";
|
import { getShellConfig } from "../utils/shell.ts";
|
||||||
|
|
||||||
// Cache for shell command results (persists for process lifetime)
|
// Cache for shell command results (persists for process lifetime)
|
||||||
const commandResultCache = new Map<string, string | undefined>();
|
const commandResultCache = new Map<string, string | undefined>();
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user