chore: include pre-built dist for github install
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
export declare function getAstGrepPath(): Promise<string | null>;
|
||||
export declare function startBackgroundInit(): void;
|
||||
export declare function isCliAvailable(): boolean;
|
||||
export declare function ensureCliAvailable(): Promise<boolean>;
|
||||
export declare function getResolvedSgCliPath(): string | null;
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
import type { CliLanguage, SgResult } from "./types";
|
||||
export { ensureCliAvailable, getAstGrepPath, isCliAvailable, startBackgroundInit, } from "./cli-binary-path-resolution";
|
||||
export interface RunOptions {
|
||||
pattern: string;
|
||||
lang: CliLanguage;
|
||||
paths?: string[];
|
||||
globs?: string[];
|
||||
rewrite?: string;
|
||||
context?: number;
|
||||
updateAll?: boolean;
|
||||
}
|
||||
export declare function runSg(options: RunOptions): Promise<SgResult>;
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export type { EnvironmentCheckResult } from "./environment-check";
|
||||
export { checkEnvironment, formatEnvironmentCheck } from "./environment-check";
|
||||
export { CLI_LANGUAGES, NAPI_LANGUAGES, LANG_EXTENSIONS } from "./language-support";
|
||||
export { DEFAULT_TIMEOUT_MS, DEFAULT_MAX_OUTPUT_BYTES, DEFAULT_MAX_MATCHES } from "./language-support";
|
||||
export { findSgCliPathSync, getSgCliPath, setSgCliPath } from "./sg-cli-path";
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export declare function getCacheDir(): string;
|
||||
export declare function getBinaryName(): string;
|
||||
export declare function getCachedBinaryPath(): string | null;
|
||||
export declare function downloadAstGrep(version?: string): Promise<string | null>;
|
||||
export declare function ensureAstGrepBinary(): Promise<string | null>;
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
export interface EnvironmentCheckResult {
|
||||
cli: {
|
||||
available: boolean;
|
||||
path: string;
|
||||
error?: string;
|
||||
};
|
||||
napi: {
|
||||
available: boolean;
|
||||
error?: string;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Check if ast-grep CLI and NAPI are available.
|
||||
* Call this at startup to provide early feedback about missing dependencies.
|
||||
*/
|
||||
export declare function checkEnvironment(): EnvironmentCheckResult;
|
||||
/**
|
||||
* Format environment check result as user-friendly message.
|
||||
*/
|
||||
export declare function formatEnvironmentCheck(result: EnvironmentCheckResult): string;
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export { createAstGrepTools } from "./tools";
|
||||
export { ensureAstGrepBinary, getCachedBinaryPath, getCacheDir } from "./downloader";
|
||||
export { getAstGrepPath, isCliAvailable, ensureCliAvailable, startBackgroundInit } from "./cli";
|
||||
export { checkEnvironment, formatEnvironmentCheck } from "./constants";
|
||||
export type { EnvironmentCheckResult } from "./constants";
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
export declare const CLI_LANGUAGES: readonly ["bash", "c", "cpp", "csharp", "css", "elixir", "go", "haskell", "html", "java", "javascript", "json", "kotlin", "lua", "nix", "php", "python", "ruby", "rust", "scala", "solidity", "swift", "typescript", "tsx", "yaml"];
|
||||
export declare const NAPI_LANGUAGES: readonly ["html", "javascript", "tsx", "css", "typescript"];
|
||||
export declare const DEFAULT_TIMEOUT_MS = 300000;
|
||||
export declare const DEFAULT_MAX_OUTPUT_BYTES: number;
|
||||
export declare const DEFAULT_MAX_MATCHES = 500;
|
||||
export declare const LANG_EXTENSIONS: Record<string, string[]>;
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
type SpawnedProcess = {
|
||||
stdout: ReadableStream | null;
|
||||
stderr: ReadableStream | null;
|
||||
exited: Promise<number>;
|
||||
kill: () => void;
|
||||
};
|
||||
export declare function collectProcessOutputWithTimeout(process: SpawnedProcess, timeoutMs: number): Promise<{
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
exitCode: number;
|
||||
}>;
|
||||
export {};
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import type { AnalyzeResult, SgResult } from "./types";
|
||||
export declare function formatSearchResult(result: SgResult): string;
|
||||
export declare function formatReplaceResult(result: SgResult, isDryRun: boolean): string;
|
||||
export declare function formatAnalyzeResult(results: AnalyzeResult[], extractedMetaVars: boolean): string;
|
||||
export declare function formatTransformResult(_original: string, transformed: string, editCount: number): string;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
export declare function findSgCliPathSync(): string | null;
|
||||
export declare function getSgCliPath(): string | null;
|
||||
export declare function setSgCliPath(path: string): void;
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { SgResult } from "./types";
|
||||
export declare function createSgResultFromStdout(stdout: string): SgResult;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
import { type ToolDefinition } from "@opencode-ai/plugin/tool";
|
||||
export declare function createAstGrepTools(ctx: PluginInput): Record<string, ToolDefinition>;
|
||||
Vendored
+58
@@ -0,0 +1,58 @@
|
||||
import type { CLI_LANGUAGES, NAPI_LANGUAGES } from "./constants";
|
||||
export type CliLanguage = (typeof CLI_LANGUAGES)[number];
|
||||
export type NapiLanguage = (typeof NAPI_LANGUAGES)[number];
|
||||
export interface Position {
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
export interface Range {
|
||||
start: Position;
|
||||
end: Position;
|
||||
}
|
||||
export interface CliMatch {
|
||||
text: string;
|
||||
range: {
|
||||
byteOffset: {
|
||||
start: number;
|
||||
end: number;
|
||||
};
|
||||
start: Position;
|
||||
end: Position;
|
||||
};
|
||||
file: string;
|
||||
lines: string;
|
||||
charCount: {
|
||||
leading: number;
|
||||
trailing: number;
|
||||
};
|
||||
language: string;
|
||||
}
|
||||
export interface SearchMatch {
|
||||
file: string;
|
||||
text: string;
|
||||
range: Range;
|
||||
lines: string;
|
||||
}
|
||||
export interface MetaVariable {
|
||||
name: string;
|
||||
text: string;
|
||||
kind: string;
|
||||
}
|
||||
export interface AnalyzeResult {
|
||||
text: string;
|
||||
range: Range;
|
||||
kind: string;
|
||||
metaVariables: MetaVariable[];
|
||||
}
|
||||
export interface TransformResult {
|
||||
original: string;
|
||||
transformed: string;
|
||||
editCount: number;
|
||||
}
|
||||
export interface SgResult {
|
||||
matches: CliMatch[];
|
||||
totalMatches: number;
|
||||
truncated: boolean;
|
||||
truncatedReason?: "max_matches" | "max_output_bytes" | "timeout";
|
||||
error?: string;
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
import type { BackgroundManager } from "../../features/background-agent";
|
||||
export type BackgroundOutputMessage = {
|
||||
id?: string;
|
||||
info?: {
|
||||
role?: string;
|
||||
time?: string | {
|
||||
created?: number;
|
||||
};
|
||||
agent?: string;
|
||||
};
|
||||
parts?: Array<{
|
||||
type?: string;
|
||||
text?: string;
|
||||
thinking?: string;
|
||||
content?: string | Array<{
|
||||
type: string;
|
||||
text?: string;
|
||||
}>;
|
||||
output?: string;
|
||||
name?: string;
|
||||
}>;
|
||||
};
|
||||
export type BackgroundOutputMessagesResult = {
|
||||
data?: BackgroundOutputMessage[];
|
||||
error?: unknown;
|
||||
} | BackgroundOutputMessage[];
|
||||
export type BackgroundOutputClient = {
|
||||
session: {
|
||||
messages: (args: {
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
}) => Promise<BackgroundOutputMessagesResult>;
|
||||
};
|
||||
};
|
||||
export type BackgroundCancelClient = {
|
||||
session: {
|
||||
abort: (args: {
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
}) => Promise<unknown>;
|
||||
};
|
||||
};
|
||||
export type BackgroundOutputManager = Pick<BackgroundManager, "getTask">;
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
export declare const BACKGROUND_TASK_DESCRIPTION = "Run agent task in background. Returns task_id immediately; notifies on completion.\n\nUse `background_output` to get results. Prompts MUST be in English.";
|
||||
export declare const BACKGROUND_OUTPUT_DESCRIPTION = "Get output from background task. Use full_session=true to fetch session messages with filters. System notifies on completion, so block=true rarely needed. - Timeout values are in milliseconds (ms), NOT seconds.";
|
||||
export declare const BACKGROUND_CANCEL_DESCRIPTION = "Cancel running background task(s). Use all=true to cancel ALL before final answer.";
|
||||
@@ -0,0 +1,4 @@
|
||||
import { type ToolDefinition } from "@opencode-ai/plugin";
|
||||
import type { BackgroundManager } from "../../features/background-agent";
|
||||
import type { BackgroundCancelClient } from "./clients";
|
||||
export declare function createBackgroundCancel(manager: BackgroundManager, _client: BackgroundCancelClient): ToolDefinition;
|
||||
@@ -0,0 +1,3 @@
|
||||
import { type ToolDefinition } from "@opencode-ai/plugin";
|
||||
import type { BackgroundOutputClient, BackgroundOutputManager } from "./clients";
|
||||
export declare function createBackgroundOutput(manager: BackgroundOutputManager, client: BackgroundOutputClient): ToolDefinition;
|
||||
@@ -0,0 +1,3 @@
|
||||
import { type PluginInput, type ToolDefinition } from "@opencode-ai/plugin";
|
||||
import type { BackgroundManager } from "../../features/background-agent";
|
||||
export declare function createBackgroundTask(manager: BackgroundManager, client: PluginInput["client"]): ToolDefinition;
|
||||
+1
@@ -0,0 +1 @@
|
||||
export declare function delay(ms: number): Promise<void>;
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { BackgroundTask } from "../../features/background-agent";
|
||||
import type { BackgroundOutputClient } from "./clients";
|
||||
export declare function formatFullSession(task: BackgroundTask, client: BackgroundOutputClient, options: {
|
||||
includeThinking: boolean;
|
||||
messageLimit?: number;
|
||||
sinceMessageId?: string;
|
||||
includeToolResults: boolean;
|
||||
thinkingMaxChars?: number;
|
||||
}): Promise<string>;
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
export { createBackgroundTask, createBackgroundOutput, createBackgroundCancel, } from "./tools";
|
||||
export type * from "./types";
|
||||
export * from "./constants";
|
||||
+1
@@ -0,0 +1 @@
|
||||
export { getMessageDir } from "../../shared/opencode-message-dir";
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { BackgroundOutputMessage, BackgroundOutputMessagesResult } from "./clients";
|
||||
export declare function getErrorMessage(value: BackgroundOutputMessagesResult): string | null;
|
||||
export declare function extractMessages(value: BackgroundOutputMessagesResult): BackgroundOutputMessage[];
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { BackgroundTask } from "../../features/background-agent";
|
||||
import type { BackgroundOutputClient } from "./clients";
|
||||
export declare function formatTaskResult(task: BackgroundTask, client: BackgroundOutputClient): Promise<string>;
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { BackgroundTask } from "../../features/background-agent";
|
||||
export declare function formatTaskStatus(task: BackgroundTask): string;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export declare function formatDuration(start: Date, end?: Date): string;
|
||||
export declare function formatMessageTime(value: unknown): string;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
export type { BackgroundCancelClient, BackgroundOutputClient, BackgroundOutputManager, BackgroundOutputMessage, BackgroundOutputMessagesResult, } from "./clients";
|
||||
export { createBackgroundTask } from "./create-background-task";
|
||||
export { createBackgroundOutput } from "./create-background-output";
|
||||
export { createBackgroundCancel } from "./create-background-cancel";
|
||||
@@ -0,0 +1 @@
|
||||
export declare function truncateText(text: string, maxLength: number): string;
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
export interface BackgroundTaskArgs {
|
||||
description: string;
|
||||
prompt: string;
|
||||
agent: string;
|
||||
}
|
||||
export interface BackgroundOutputArgs {
|
||||
task_id: string;
|
||||
block?: boolean;
|
||||
timeout?: number;
|
||||
full_session?: boolean;
|
||||
include_thinking?: boolean;
|
||||
message_limit?: number;
|
||||
since_message_id?: string;
|
||||
include_tool_results?: boolean;
|
||||
thinking_max_chars?: number;
|
||||
}
|
||||
export interface BackgroundCancelArgs {
|
||||
taskId?: string;
|
||||
all?: boolean;
|
||||
}
|
||||
export type BackgroundOutputMessage = {
|
||||
info?: {
|
||||
role?: string;
|
||||
time?: string | {
|
||||
created?: number;
|
||||
};
|
||||
agent?: string;
|
||||
};
|
||||
parts?: Array<{
|
||||
type?: string;
|
||||
text?: string;
|
||||
content?: string | Array<{
|
||||
type: string;
|
||||
text?: string;
|
||||
}>;
|
||||
name?: string;
|
||||
}>;
|
||||
};
|
||||
export type BackgroundOutputMessagesResult = {
|
||||
data?: BackgroundOutputMessage[];
|
||||
error?: unknown;
|
||||
} | BackgroundOutputMessage[];
|
||||
export type BackgroundOutputClient = {
|
||||
session: {
|
||||
messages: (args: {
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
}) => Promise<BackgroundOutputMessagesResult>;
|
||||
};
|
||||
};
|
||||
export type BackgroundCancelClient = {
|
||||
session: {
|
||||
abort: (args: {
|
||||
path: {
|
||||
id: string;
|
||||
};
|
||||
}) => Promise<unknown>;
|
||||
};
|
||||
};
|
||||
export type BackgroundOutputManager = Pick<import("../../features/background-agent").BackgroundManager, "getTask">;
|
||||
export type FullSessionMessagePart = {
|
||||
type?: string;
|
||||
text?: string;
|
||||
thinking?: string;
|
||||
content?: string | Array<{
|
||||
type?: string;
|
||||
text?: string;
|
||||
}>;
|
||||
output?: string;
|
||||
};
|
||||
export type FullSessionMessage = {
|
||||
id?: string;
|
||||
info?: {
|
||||
role?: string;
|
||||
time?: string;
|
||||
agent?: string;
|
||||
};
|
||||
parts?: FullSessionMessagePart[];
|
||||
};
|
||||
export type ToolContextWithMetadata = {
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
agent: string;
|
||||
abort: AbortSignal;
|
||||
metadata?: (input: {
|
||||
title?: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
}) => void;
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { BackgroundManager } from "../../features/background-agent";
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
import type { CallOmoAgentArgs } from "./types";
|
||||
import type { ToolContextWithMetadata } from "./tool-context-with-metadata";
|
||||
export declare function executeBackgroundAgent(args: CallOmoAgentArgs, toolContext: ToolContextWithMetadata, manager: BackgroundManager, client: PluginInput["client"]): Promise<string>;
|
||||
@@ -0,0 +1,14 @@
|
||||
import type { CallOmoAgentArgs } from "./types";
|
||||
import type { BackgroundManager } from "../../features/background-agent";
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
import type { FallbackEntry } from "../../shared/model-requirements";
|
||||
export declare function executeBackground(args: CallOmoAgentArgs, toolContext: {
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
agent: string;
|
||||
abort: AbortSignal;
|
||||
metadata?: (input: {
|
||||
title?: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
}) => void;
|
||||
}, manager: BackgroundManager, client: PluginInput["client"], fallbackChain?: FallbackEntry[]): Promise<string>;
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
export declare function waitForCompletion(sessionID: string, toolContext: {
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
agent: string;
|
||||
abort: AbortSignal;
|
||||
metadata?: (input: {
|
||||
title?: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
}) => void;
|
||||
}, ctx: PluginInput): Promise<void>;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export declare const ALLOWED_AGENTS: readonly ["explore", "librarian", "oracle", "hephaestus", "metis", "momus", "multimodal-looker"];
|
||||
export declare const CALL_OMO_AGENT_DESCRIPTION = "Spawn explore/librarian agent. run_in_background REQUIRED (true=async with task_id, false=sync).\n\nAvailable: {agents}\n\nPass `session_id=<id>` to continue previous agent with full context. Nested subagent depth is tracked automatically and blocked past the configured limit. Prompts MUST be in English. Use `background_output` for async results.";
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
export * from "./types";
|
||||
export * from "./constants";
|
||||
export { createCallOmoAgent } from "./tools";
|
||||
+1
@@ -0,0 +1 @@
|
||||
export { getMessageDir } from "../../shared/opencode-message-dir";
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
export declare function processMessages(sessionID: string, ctx: PluginInput): Promise<string>;
|
||||
@@ -0,0 +1 @@
|
||||
export { getMessageDir } from "../../shared";
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import type { CallOmoAgentArgs } from "./types";
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
export declare function createOrGetSession(args: CallOmoAgentArgs, toolContext: {
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
agent: string;
|
||||
abort: AbortSignal;
|
||||
metadata?: (input: {
|
||||
title?: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
}) => void;
|
||||
}, ctx: PluginInput): Promise<{
|
||||
sessionID: string;
|
||||
isNew: boolean;
|
||||
}>;
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
import type { CallOmoAgentArgs } from "./types";
|
||||
import type { ToolContextWithMetadata } from "./tool-context-with-metadata";
|
||||
export declare function resolveOrCreateSessionId(ctx: PluginInput, args: CallOmoAgentArgs, toolContext: ToolContextWithMetadata): Promise<{
|
||||
ok: true;
|
||||
sessionID: string;
|
||||
} | {
|
||||
ok: false;
|
||||
error: string;
|
||||
}>;
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import type { CallOmoAgentArgs } from "./types";
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
import { clearSessionFallbackChain, setSessionFallbackChain } from "../../hooks/model-fallback/hook";
|
||||
import type { FallbackEntry } from "../../shared/model-requirements";
|
||||
import { waitForCompletion } from "./completion-poller";
|
||||
import { processMessages } from "./message-processor";
|
||||
import { createOrGetSession } from "./session-creator";
|
||||
type ExecuteSyncDeps = {
|
||||
createOrGetSession: typeof createOrGetSession;
|
||||
waitForCompletion: typeof waitForCompletion;
|
||||
processMessages: typeof processMessages;
|
||||
setSessionFallbackChain: typeof setSessionFallbackChain;
|
||||
clearSessionFallbackChain: typeof clearSessionFallbackChain;
|
||||
};
|
||||
type SpawnReservation = {
|
||||
commit: () => number;
|
||||
rollback: () => void;
|
||||
};
|
||||
export declare function executeSync(args: CallOmoAgentArgs, toolContext: {
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
agent: string;
|
||||
abort: AbortSignal;
|
||||
metadata?: (input: {
|
||||
title?: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
}) => void | Promise<void>;
|
||||
}, ctx: PluginInput, deps?: ExecuteSyncDeps, fallbackChain?: FallbackEntry[], spawnReservation?: SpawnReservation): Promise<string>;
|
||||
export {};
|
||||
@@ -0,0 +1,10 @@
|
||||
export type ToolContextWithMetadata = {
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
agent: string;
|
||||
abort: AbortSignal;
|
||||
metadata?: (input: {
|
||||
title?: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
}) => void;
|
||||
};
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
import { type PluginInput, type ToolDefinition } from "@opencode-ai/plugin";
|
||||
import type { BackgroundManager } from "../../features/background-agent";
|
||||
import type { CategoriesConfig, AgentOverrides } from "../../config/schema";
|
||||
export declare function createCallOmoAgent(ctx: PluginInput, backgroundManager: BackgroundManager, disabledAgents?: string[], agentOverrides?: AgentOverrides, userCategories?: CategoriesConfig): ToolDefinition;
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
import type { ALLOWED_AGENTS } from "./constants";
|
||||
export type AllowedAgentType = (typeof ALLOWED_AGENTS)[number];
|
||||
export interface CallOmoAgentArgs {
|
||||
description: string;
|
||||
prompt: string;
|
||||
subagent_type: string;
|
||||
run_in_background: boolean;
|
||||
session_id?: string;
|
||||
}
|
||||
export interface CallOmoAgentSyncResult {
|
||||
title: string;
|
||||
metadata: {
|
||||
summary?: Array<{
|
||||
id: string;
|
||||
tool: string;
|
||||
state: {
|
||||
status: string;
|
||||
title?: string;
|
||||
};
|
||||
}>;
|
||||
sessionId: string;
|
||||
};
|
||||
output: string;
|
||||
}
|
||||
export type ToolContextWithMetadata = {
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
agent: string;
|
||||
abort: AbortSignal;
|
||||
metadata?: (input: {
|
||||
title?: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
}) => void;
|
||||
};
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { OpencodeClient } from "./types";
|
||||
export declare function getAvailableModelsForDelegateTask(client: OpencodeClient): Promise<Set<string>>;
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { DelegateTaskArgs, ToolContextWithMetadata } from "./types";
|
||||
import type { ExecutorContext, ParentContext } from "./executor-types";
|
||||
export declare function executeBackgroundContinuation(args: DelegateTaskArgs, ctx: ToolContextWithMetadata, executorCtx: ExecutorContext, parentContext: ParentContext): Promise<string>;
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { DelegateTaskArgs, ToolContextWithMetadata } from "./types";
|
||||
import type { ExecutorContext, ParentContext } from "./executor-types";
|
||||
import type { FallbackEntry } from "../../shared/model-requirements";
|
||||
export declare function executeBackgroundTask(args: DelegateTaskArgs, ctx: ToolContextWithMetadata, executorCtx: ExecutorContext, parentContext: ParentContext, agentToUse: string, categoryModel: {
|
||||
providerID: string;
|
||||
modelID: string;
|
||||
variant?: string;
|
||||
} | undefined, systemContent: string | undefined, fallbackChain?: FallbackEntry[]): Promise<string>;
|
||||
@@ -0,0 +1,2 @@
|
||||
import type { ExecutorContext } from "./executor-types";
|
||||
export declare function cancelUnstableAgentTask(manager: ExecutorContext["manager"], taskID: string | undefined, reason: string): Promise<void>;
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import type { CategoryConfig, CategoriesConfig } from "../../config/schema";
|
||||
export interface ResolveCategoryConfigOptions {
|
||||
userCategories?: CategoriesConfig;
|
||||
inheritedModel?: string;
|
||||
systemDefaultModel?: string;
|
||||
availableModels?: Set<string>;
|
||||
}
|
||||
export interface ResolveCategoryConfigResult {
|
||||
config: CategoryConfig;
|
||||
promptAppend: string;
|
||||
model: string | undefined;
|
||||
}
|
||||
/**
|
||||
* Resolve the configuration for a given category name.
|
||||
* Merges default and user configurations, handles model resolution.
|
||||
*/
|
||||
export declare function resolveCategoryConfig(categoryName: string, options: ResolveCategoryConfigOptions): ResolveCategoryConfigResult | null;
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import type { ModelFallbackInfo } from "../../features/task-toast-manager/types";
|
||||
import type { DelegateTaskArgs } from "./types";
|
||||
import type { ExecutorContext } from "./executor-types";
|
||||
import type { FallbackEntry } from "../../shared/model-requirements";
|
||||
export interface CategoryResolutionResult {
|
||||
agentToUse: string;
|
||||
categoryModel: {
|
||||
providerID: string;
|
||||
modelID: string;
|
||||
variant?: string;
|
||||
} | undefined;
|
||||
categoryPromptAppend: string | undefined;
|
||||
maxPromptTokens?: number;
|
||||
modelInfo: ModelFallbackInfo | undefined;
|
||||
actualModel: string | undefined;
|
||||
isUnstableAgent: boolean;
|
||||
fallbackChain?: FallbackEntry[];
|
||||
error?: string;
|
||||
}
|
||||
export declare function resolveCategoryExecution(args: DelegateTaskArgs, executorCtx: ExecutorContext, inheritedModel: string | undefined, systemDefaultModel: string | undefined): Promise<CategoryResolutionResult>;
|
||||
+42
File diff suppressed because one or more lines are too long
+15
@@ -0,0 +1,15 @@
|
||||
import type { DelegateTaskArgs } from "./types";
|
||||
/**
|
||||
* Context for error formatting.
|
||||
*/
|
||||
export interface ErrorContext {
|
||||
operation: string;
|
||||
args?: DelegateTaskArgs;
|
||||
sessionID?: string;
|
||||
agent?: string;
|
||||
category?: string;
|
||||
}
|
||||
/**
|
||||
* Format an error with detailed context for debugging.
|
||||
*/
|
||||
export declare function formatDetailedError(error: unknown, ctx: ErrorContext): string;
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
import type { BackgroundManager } from "../../features/background-agent";
|
||||
import type { CategoriesConfig, GitMasterConfig, BrowserAutomationProvider, AgentOverrides } from "../../config/schema";
|
||||
import type { OpencodeClient } from "./types";
|
||||
export interface ExecutorContext {
|
||||
manager: BackgroundManager;
|
||||
client: OpencodeClient;
|
||||
directory: string;
|
||||
userCategories?: CategoriesConfig;
|
||||
gitMasterConfig?: GitMasterConfig;
|
||||
sisyphusJuniorModel?: string;
|
||||
browserProvider?: BrowserAutomationProvider;
|
||||
agentOverrides?: AgentOverrides;
|
||||
onSyncSessionCreated?: (event: {
|
||||
sessionID: string;
|
||||
parentID: string;
|
||||
title: string;
|
||||
}) => Promise<void>;
|
||||
syncPollTimeoutMs?: number;
|
||||
}
|
||||
export interface ParentContext {
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
agent?: string;
|
||||
model?: {
|
||||
providerID: string;
|
||||
modelID: string;
|
||||
variant?: string;
|
||||
};
|
||||
}
|
||||
export interface SessionMessage {
|
||||
info?: {
|
||||
id?: string;
|
||||
role?: string;
|
||||
time?: {
|
||||
created?: number;
|
||||
};
|
||||
finish?: string;
|
||||
agent?: string;
|
||||
model?: {
|
||||
providerID: string;
|
||||
modelID: string;
|
||||
variant?: string;
|
||||
};
|
||||
modelID?: string;
|
||||
providerID?: string;
|
||||
variant?: string;
|
||||
};
|
||||
parts?: Array<{
|
||||
type?: string;
|
||||
text?: string;
|
||||
}>;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
export type { ExecutorContext, ParentContext } from "./executor-types";
|
||||
export { resolveSkillContent } from "./skill-resolver";
|
||||
export { resolveParentContext } from "./parent-context-resolver";
|
||||
export { executeBackgroundContinuation } from "./background-continuation";
|
||||
export { executeSyncContinuation } from "./sync-continuation";
|
||||
export { executeUnstableAgentTask } from "./unstable-agent-task";
|
||||
export { executeBackgroundTask } from "./background-task";
|
||||
export { executeSyncTask } from "./sync-task";
|
||||
export { resolveCategoryExecution } from "./category-resolver";
|
||||
export type { CategoryResolutionResult } from "./category-resolver";
|
||||
export { resolveSubagentExecution } from "./subagent-resolver";
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export { createDelegateTask, resolveCategoryConfig, buildSystemContent, buildTaskPrompt } from "./tools";
|
||||
export type { DelegateTaskToolOptions, SyncSessionCreatedEvent, BuildSystemContentInput } from "./tools";
|
||||
export type * from "./types";
|
||||
export * from "./constants";
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import type { FallbackEntry } from "../../shared/model-requirements";
|
||||
export declare function resolveModelForDelegateTask(input: {
|
||||
userModel?: string;
|
||||
userFallbackModels?: string[];
|
||||
categoryDefaultModel?: string;
|
||||
fallbackChain?: FallbackEntry[];
|
||||
availableModels: Set<string>;
|
||||
systemDefaultModel?: string;
|
||||
}): {
|
||||
model: string;
|
||||
variant?: string;
|
||||
} | undefined;
|
||||
@@ -0,0 +1,5 @@
|
||||
export declare function parseModelString(model: string): {
|
||||
providerID: string;
|
||||
modelID: string;
|
||||
variant?: string;
|
||||
} | undefined;
|
||||
@@ -0,0 +1,4 @@
|
||||
import type { ToolContextWithMetadata } from "./types";
|
||||
import type { OpencodeClient } from "./types";
|
||||
import type { ParentContext } from "./executor-types";
|
||||
export declare function resolveParentContext(ctx: ToolContextWithMetadata, client: OpencodeClient): Promise<ParentContext>;
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { BuildSystemContentInput } from "./types";
|
||||
/**
|
||||
* Build the system content to inject into the agent prompt.
|
||||
* Combines skill content, category prompt append, and plan agent system prepend.
|
||||
*/
|
||||
export declare function buildSystemContent(input: BuildSystemContentInput): string | undefined;
|
||||
export declare function buildTaskPrompt(prompt: string, agentName: string | undefined): string;
|
||||
@@ -0,0 +1 @@
|
||||
export declare const SISYPHUS_JUNIOR_AGENT: string;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import type { GitMasterConfig, BrowserAutomationProvider } from "../../config/schema";
|
||||
export declare function resolveSkillContent(skills: string[], options: {
|
||||
gitMasterConfig?: GitMasterConfig;
|
||||
browserProvider?: BrowserAutomationProvider;
|
||||
disabledSkills?: Set<string>;
|
||||
directory?: string;
|
||||
}): Promise<{
|
||||
content: string | undefined;
|
||||
contents: string[];
|
||||
error: string | null;
|
||||
}>;
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import type { DelegateTaskArgs } from "./types";
|
||||
import type { ExecutorContext } from "./executor-types";
|
||||
import type { FallbackEntry } from "../../shared/model-requirements";
|
||||
export declare function resolveSubagentExecution(args: DelegateTaskArgs, executorCtx: ExecutorContext, parentAgent: string | undefined, categoryExamples: string): Promise<{
|
||||
agentToUse: string;
|
||||
categoryModel: {
|
||||
providerID: string;
|
||||
modelID: string;
|
||||
variant?: string;
|
||||
} | undefined;
|
||||
fallbackChain?: FallbackEntry[];
|
||||
error?: string;
|
||||
}>;
|
||||
@@ -0,0 +1,7 @@
|
||||
import { pollSyncSession } from "./sync-session-poller";
|
||||
import { fetchSyncResult } from "./sync-result-fetcher";
|
||||
export declare const syncContinuationDeps: {
|
||||
pollSyncSession: typeof pollSyncSession;
|
||||
fetchSyncResult: typeof fetchSyncResult;
|
||||
};
|
||||
export type SyncContinuationDeps = typeof syncContinuationDeps;
|
||||
@@ -0,0 +1,4 @@
|
||||
import type { DelegateTaskArgs, ToolContextWithMetadata } from "./types";
|
||||
import type { ExecutorContext } from "./executor-types";
|
||||
import { type SyncContinuationDeps } from "./sync-continuation-deps";
|
||||
export declare function executeSyncContinuation(args: DelegateTaskArgs, ctx: ToolContextWithMetadata, executorCtx: ExecutorContext, deps?: SyncContinuationDeps): Promise<string>;
|
||||
@@ -0,0 +1,22 @@
|
||||
import type { DelegateTaskArgs, OpencodeClient } from "./types";
|
||||
import { promptSyncWithModelSuggestionRetry, promptWithModelSuggestionRetry } from "../../shared/model-suggestion-retry";
|
||||
type SendSyncPromptDeps = {
|
||||
promptWithModelSuggestionRetry: typeof promptWithModelSuggestionRetry;
|
||||
promptSyncWithModelSuggestionRetry: typeof promptSyncWithModelSuggestionRetry;
|
||||
};
|
||||
export declare function sendSyncPrompt(client: OpencodeClient, input: {
|
||||
sessionID: string;
|
||||
agentToUse: string;
|
||||
args: DelegateTaskArgs;
|
||||
systemContent: string | undefined;
|
||||
categoryModel: {
|
||||
providerID: string;
|
||||
modelID: string;
|
||||
variant?: string;
|
||||
} | undefined;
|
||||
toastManager: {
|
||||
removeTask: (id: string) => void;
|
||||
} | null | undefined;
|
||||
taskId: string | undefined;
|
||||
}, deps?: SendSyncPromptDeps): Promise<string | null>;
|
||||
export {};
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { OpencodeClient } from "./types";
|
||||
export declare function fetchSyncResult(client: OpencodeClient, sessionID: string, anchorMessageCount?: number): Promise<{
|
||||
ok: true;
|
||||
textContent: string;
|
||||
} | {
|
||||
ok: false;
|
||||
error: string;
|
||||
}>;
|
||||
@@ -0,0 +1,14 @@
|
||||
import type { OpencodeClient } from "./types";
|
||||
export declare function createSyncSession(client: OpencodeClient, input: {
|
||||
parentSessionID: string;
|
||||
agentToUse: string;
|
||||
description: string;
|
||||
defaultDirectory: string;
|
||||
}): Promise<{
|
||||
ok: true;
|
||||
sessionID: string;
|
||||
parentDirectory: string;
|
||||
} | {
|
||||
ok: false;
|
||||
error: string;
|
||||
}>;
|
||||
@@ -0,0 +1,12 @@
|
||||
import type { ToolContextWithMetadata, OpencodeClient } from "./types";
|
||||
import type { SessionMessage } from "./executor-types";
|
||||
export declare function isSessionComplete(messages: SessionMessage[]): boolean;
|
||||
export declare function pollSyncSession(ctx: ToolContextWithMetadata, client: OpencodeClient, input: {
|
||||
sessionID: string;
|
||||
agentToUse: string;
|
||||
toastManager: {
|
||||
removeTask: (id: string) => void;
|
||||
} | null | undefined;
|
||||
taskId: string | undefined;
|
||||
anchorMessageCount?: number;
|
||||
}, timeoutMs?: number): Promise<string | null>;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import { createSyncSession } from "./sync-session-creator";
|
||||
import { sendSyncPrompt } from "./sync-prompt-sender";
|
||||
import { pollSyncSession } from "./sync-session-poller";
|
||||
import { fetchSyncResult } from "./sync-result-fetcher";
|
||||
export declare const syncTaskDeps: {
|
||||
createSyncSession: typeof createSyncSession;
|
||||
sendSyncPrompt: typeof sendSyncPrompt;
|
||||
pollSyncSession: typeof pollSyncSession;
|
||||
fetchSyncResult: typeof fetchSyncResult;
|
||||
};
|
||||
export type SyncTaskDeps = typeof syncTaskDeps;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import type { ModelFallbackInfo } from "../../features/task-toast-manager/types";
|
||||
import type { DelegateTaskArgs, ToolContextWithMetadata } from "./types";
|
||||
import type { ExecutorContext, ParentContext } from "./executor-types";
|
||||
import { type SyncTaskDeps } from "./sync-task-deps";
|
||||
export declare function executeSyncTask(args: DelegateTaskArgs, ctx: ToolContextWithMetadata, executorCtx: ExecutorContext, parentContext: ParentContext, agentToUse: string, categoryModel: {
|
||||
providerID: string;
|
||||
modelID: string;
|
||||
variant?: string;
|
||||
} | undefined, systemContent: string | undefined, modelInfo?: ModelFallbackInfo, fallbackChain?: import("../../shared/model-requirements").FallbackEntry[], deps?: SyncTaskDeps): Promise<string>;
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* Format a duration between two dates as a human-readable string.
|
||||
*/
|
||||
export declare function formatDuration(start: Date, end?: Date): string;
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
export declare const DEFAULT_SYNC_POLL_TIMEOUT_MS: number;
|
||||
export declare function getDefaultSyncPollTimeoutMs(): number;
|
||||
export declare function getTimingConfig(): {
|
||||
POLL_INTERVAL_MS: number;
|
||||
MIN_STABILITY_TIME_MS: number;
|
||||
STABILITY_POLLS_REQUIRED: number;
|
||||
WAIT_FOR_SESSION_INTERVAL_MS: number;
|
||||
WAIT_FOR_SESSION_TIMEOUT_MS: number;
|
||||
MAX_POLL_TIME_MS: number;
|
||||
SESSION_CONTINUATION_STABILITY_MS: number;
|
||||
};
|
||||
export declare function __resetTimingConfig(): void;
|
||||
export declare function __setTimingConfig(overrides: Partial<ReturnType<typeof getTimingConfig>>): void;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import type { BuildSystemContentInput } from "./types";
|
||||
export declare function estimateTokenCount(text: string): number;
|
||||
export declare function truncateToTokenBudget(content: string, maxTokens: number): string;
|
||||
export declare function buildSystemContentWithTokenLimit(input: BuildSystemContentInput, maxTokens: number | undefined): string | undefined;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
import { type ToolDefinition } from "@opencode-ai/plugin";
|
||||
import type { DelegateTaskToolOptions } from "./types";
|
||||
export { resolveCategoryConfig } from "./categories";
|
||||
export type { SyncSessionCreatedEvent, DelegateTaskToolOptions, BuildSystemContentInput } from "./types";
|
||||
export { buildSystemContent, buildTaskPrompt } from "./prompt-builder";
|
||||
export declare function createDelegateTask(options: DelegateTaskToolOptions): ToolDefinition;
|
||||
Vendored
+83
@@ -0,0 +1,83 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
import type { BackgroundManager } from "../../features/background-agent";
|
||||
import type { CategoriesConfig, GitMasterConfig, BrowserAutomationProvider, AgentOverrides } from "../../config/schema";
|
||||
import type { AvailableCategory, AvailableSkill } from "../../agents/dynamic-agent-prompt-builder";
|
||||
export type OpencodeClient = PluginInput["client"];
|
||||
export interface DelegateTaskArgs {
|
||||
description: string;
|
||||
prompt: string;
|
||||
category?: string;
|
||||
subagent_type?: string;
|
||||
run_in_background: boolean;
|
||||
session_id?: string;
|
||||
command?: string;
|
||||
load_skills: string[];
|
||||
execute?: {
|
||||
task_id: string;
|
||||
task_dir?: string;
|
||||
};
|
||||
}
|
||||
export interface ToolContextWithMetadata {
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
agent: string;
|
||||
abort: AbortSignal;
|
||||
metadata?: (input: {
|
||||
title?: string;
|
||||
metadata?: Record<string, unknown>;
|
||||
}) => void | Promise<void>;
|
||||
/**
|
||||
* Tool call ID injected by OpenCode's internal context (not in plugin ToolContext type,
|
||||
* but present at runtime via spread in fromPlugin()). Used for metadata store keying.
|
||||
*/
|
||||
callID?: string;
|
||||
/** @deprecated OpenCode internal naming may vary across versions */
|
||||
callId?: string;
|
||||
/** @deprecated OpenCode internal naming may vary across versions */
|
||||
call_id?: string;
|
||||
}
|
||||
export interface SyncSessionCreatedEvent {
|
||||
sessionID: string;
|
||||
parentID: string;
|
||||
title: string;
|
||||
}
|
||||
export interface DelegateTaskToolOptions {
|
||||
manager: BackgroundManager;
|
||||
client: OpencodeClient;
|
||||
directory: string;
|
||||
/**
|
||||
* Test hook: bypass global cache reads (Bun runs tests in parallel).
|
||||
* If provided, resolveCategoryExecution/resolveSubagentExecution uses this instead of reading from disk cache.
|
||||
*/
|
||||
connectedProvidersOverride?: string[] | null;
|
||||
/**
|
||||
* Test hook: bypass fetchAvailableModels() by providing an explicit available model set.
|
||||
*/
|
||||
availableModelsOverride?: Set<string>;
|
||||
userCategories?: CategoriesConfig;
|
||||
gitMasterConfig?: GitMasterConfig;
|
||||
sisyphusJuniorModel?: string;
|
||||
browserProvider?: BrowserAutomationProvider;
|
||||
disabledSkills?: Set<string>;
|
||||
availableCategories?: AvailableCategory[];
|
||||
availableSkills?: AvailableSkill[];
|
||||
agentOverrides?: AgentOverrides;
|
||||
onSyncSessionCreated?: (event: SyncSessionCreatedEvent) => Promise<void>;
|
||||
syncPollTimeoutMs?: number;
|
||||
}
|
||||
export interface BuildSystemContentInput {
|
||||
skillContent?: string;
|
||||
skillContents?: string[];
|
||||
categoryPromptAppend?: string;
|
||||
agentsContext?: string;
|
||||
planAgentPrepend?: string;
|
||||
maxPromptTokens?: number;
|
||||
model?: {
|
||||
providerID: string;
|
||||
modelID: string;
|
||||
variant?: string;
|
||||
};
|
||||
agentName?: string;
|
||||
availableCategories?: AvailableCategory[];
|
||||
availableSkills?: AvailableSkill[];
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { DelegateTaskArgs, ToolContextWithMetadata } from "./types";
|
||||
import type { ExecutorContext, ParentContext } from "./executor-types";
|
||||
export declare function executeUnstableAgentTask(args: DelegateTaskArgs, ctx: ToolContextWithMetadata, executorCtx: ExecutorContext, parentContext: ParentContext, agentToUse: string, categoryModel: {
|
||||
providerID: string;
|
||||
modelID: string;
|
||||
variant?: string;
|
||||
} | undefined, systemContent: string | undefined, actualModel: string | undefined): Promise<string>;
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
import { type GrepBackend } from "./constants";
|
||||
import type { GlobOptions, GlobResult } from "./types";
|
||||
export interface ResolvedCli {
|
||||
path: string;
|
||||
backend: GrepBackend;
|
||||
}
|
||||
declare function buildRgArgs(options: GlobOptions): string[];
|
||||
declare function buildFindArgs(options: GlobOptions): string[];
|
||||
declare function buildPowerShellCommand(options: GlobOptions): string[];
|
||||
export { buildRgArgs, buildFindArgs, buildPowerShellCommand };
|
||||
export declare function runRgFiles(options: GlobOptions, resolvedCli?: ResolvedCli): Promise<GlobResult>;
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
export { resolveGrepCli, resolveGrepCliWithAutoInstall, type GrepBackend, DEFAULT_RG_THREADS } from "../grep/constants";
|
||||
export declare const DEFAULT_TIMEOUT_MS = 60000;
|
||||
export declare const DEFAULT_LIMIT = 100;
|
||||
export declare const DEFAULT_MAX_DEPTH = 20;
|
||||
export declare const DEFAULT_MAX_OUTPUT_BYTES: number;
|
||||
export declare const RG_FILES_FLAGS: readonly ["--files", "--color=never", "--glob=!.git/*"];
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export { createGlobTools } from "./tools";
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import type { GlobResult } from "./types";
|
||||
export declare function formatGlobResult(result: GlobResult): string;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
import { type ToolDefinition } from "@opencode-ai/plugin/tool";
|
||||
export declare function createGlobTools(ctx: PluginInput): Record<string, ToolDefinition>;
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
export interface FileMatch {
|
||||
path: string;
|
||||
mtime: number;
|
||||
}
|
||||
export interface GlobResult {
|
||||
files: FileMatch[];
|
||||
totalFiles: number;
|
||||
truncated: boolean;
|
||||
error?: string;
|
||||
}
|
||||
export interface GlobOptions {
|
||||
pattern: string;
|
||||
paths?: string[];
|
||||
hidden?: boolean;
|
||||
follow?: boolean;
|
||||
noIgnore?: boolean;
|
||||
maxDepth?: number;
|
||||
timeout?: number;
|
||||
limit?: number;
|
||||
threads?: number;
|
||||
}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import type { GrepOptions, GrepResult, CountResult } from "./types";
|
||||
export declare function runRg(options: GrepOptions): Promise<GrepResult>;
|
||||
export declare function runRgCount(options: Omit<GrepOptions, "context">): Promise<CountResult[]>;
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
export type GrepBackend = "rg" | "grep";
|
||||
interface ResolvedCli {
|
||||
path: string;
|
||||
backend: GrepBackend;
|
||||
}
|
||||
export declare function resolveGrepCli(): ResolvedCli;
|
||||
export declare function resolveGrepCliWithAutoInstall(): Promise<ResolvedCli>;
|
||||
export declare const DEFAULT_MAX_DEPTH = 20;
|
||||
export declare const DEFAULT_MAX_FILESIZE = "10M";
|
||||
export declare const DEFAULT_MAX_COUNT = 500;
|
||||
export declare const DEFAULT_MAX_COLUMNS = 1000;
|
||||
export declare const DEFAULT_CONTEXT = 2;
|
||||
export declare const DEFAULT_TIMEOUT_MS = 60000;
|
||||
export declare const DEFAULT_MAX_OUTPUT_BYTES: number;
|
||||
export declare const DEFAULT_RG_THREADS = 4;
|
||||
export declare const RG_SAFETY_FLAGS: readonly ["--no-follow", "--color=never", "--no-heading", "--line-number", "--with-filename"];
|
||||
export declare const GREP_SAFETY_FLAGS: readonly ["-n", "-H", "--color=never"];
|
||||
export {};
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
export declare function findFileRecursive(dir: string, filename: string): string | null;
|
||||
export declare function downloadAndInstallRipgrep(): Promise<string>;
|
||||
export declare function getInstalledRipgrepPath(): string | null;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export { createGrepTools } from "./tools";
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import type { GrepResult, CountResult } from "./types";
|
||||
export declare function formatGrepResult(result: GrepResult): string;
|
||||
export declare function formatCountResult(results: CountResult[]): string;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
import { type ToolDefinition } from "@opencode-ai/plugin/tool";
|
||||
export declare function createGrepTools(ctx: PluginInput): Record<string, ToolDefinition>;
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
export interface GrepMatch {
|
||||
file: string;
|
||||
line: number;
|
||||
column?: number;
|
||||
text: string;
|
||||
}
|
||||
export interface GrepResult {
|
||||
matches: GrepMatch[];
|
||||
totalMatches: number;
|
||||
filesSearched: number;
|
||||
truncated: boolean;
|
||||
error?: string;
|
||||
}
|
||||
export interface GrepOptions {
|
||||
pattern: string;
|
||||
paths?: string[];
|
||||
globs?: string[];
|
||||
excludeGlobs?: string[];
|
||||
context?: number;
|
||||
maxDepth?: number;
|
||||
maxFilesize?: string;
|
||||
maxCount?: number;
|
||||
maxColumns?: number;
|
||||
caseSensitive?: boolean;
|
||||
wholeWord?: boolean;
|
||||
fixedStrings?: boolean;
|
||||
multiline?: boolean;
|
||||
hidden?: boolean;
|
||||
noIgnore?: boolean;
|
||||
fileType?: string[];
|
||||
timeout?: number;
|
||||
threads?: number;
|
||||
outputMode?: "content" | "files_with_matches" | "count";
|
||||
headLimit?: number;
|
||||
}
|
||||
export interface CountResult {
|
||||
file: string;
|
||||
count: number;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export declare function stripTrailingContinuationTokens(text: string): string;
|
||||
export declare function stripMergeOperatorChars(text: string): string;
|
||||
export declare function restoreOldWrappedLines(originalLines: string[], replacementLines: string[]): string[];
|
||||
export declare function maybeExpandSingleLineMerge(originalLines: string[], replacementLines: string[]): string[];
|
||||
export declare function restoreIndentForPairedReplacement(originalLines: string[], replacementLines: string[]): string[];
|
||||
export declare function autocorrectReplacementLines(originalLines: string[], replacementLines: string[]): string[];
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
export declare const NIBBLE_STR = "ZPMQVRWSNKTXJBYH";
|
||||
export declare const HASHLINE_DICT: string[];
|
||||
export declare const HASHLINE_REF_PATTERN: RegExp;
|
||||
export declare const HASHLINE_OUTPUT_PATTERN: RegExp;
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
export declare function toHashlineContent(content: string): string;
|
||||
export declare function generateUnifiedDiff(oldContent: string, newContent: string, filePath: string): string;
|
||||
export declare function countLineDiffs(oldContent: string, newContent: string): {
|
||||
additions: number;
|
||||
deletions: number;
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { HashlineEdit } from "./types";
|
||||
export declare function dedupeEdits(edits: HashlineEdit[]): {
|
||||
edits: HashlineEdit[];
|
||||
deduplicatedEdits: number;
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
interface EditApplyOptions {
|
||||
skipValidation?: boolean;
|
||||
}
|
||||
export declare function applySetLine(lines: string[], anchor: string, newText: string | string[], options?: EditApplyOptions): string[];
|
||||
export declare function applyReplaceLines(lines: string[], startAnchor: string, endAnchor: string, newText: string | string[], options?: EditApplyOptions): string[];
|
||||
export declare function applyInsertAfter(lines: string[], anchor: string, text: string | string[], options?: EditApplyOptions): string[];
|
||||
export declare function applyInsertBefore(lines: string[], anchor: string, text: string | string[], options?: EditApplyOptions): string[];
|
||||
export declare function applyAppend(lines: string[], text: string | string[]): string[];
|
||||
export declare function applyPrepend(lines: string[], text: string | string[]): string[];
|
||||
export {};
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { HashlineEdit } from "./types";
|
||||
export interface HashlineApplyReport {
|
||||
content: string;
|
||||
noopEdits: number;
|
||||
deduplicatedEdits: number;
|
||||
}
|
||||
export declare function applyHashlineEditsWithReport(content: string, edits: HashlineEdit[]): HashlineApplyReport;
|
||||
export declare function applyHashlineEdits(content: string, edits: HashlineEdit[]): string;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import type { HashlineEdit } from "./types";
|
||||
export declare function getEditLineNumber(edit: HashlineEdit): number;
|
||||
export declare function collectLineRefs(edits: HashlineEdit[]): string[];
|
||||
export declare function detectOverlappingRanges(edits: HashlineEdit[]): string | null;
|
||||
@@ -0,0 +1,7 @@
|
||||
export declare function stripLinePrefixes(lines: string[]): string[];
|
||||
export declare function toNewLines(input: string | string[]): string[];
|
||||
export declare function restoreLeadingIndent(templateLine: string, line: string): string;
|
||||
export declare function stripInsertAnchorEcho(anchorLine: string, newLines: string[]): string[];
|
||||
export declare function stripInsertBeforeEcho(anchorLine: string, newLines: string[]): string[];
|
||||
export declare function stripInsertBoundaryEcho(afterLine: string, beforeLine: string, newLines: string[]): string[];
|
||||
export declare function stripRangeBoundaryEcho(lines: string[], startLine: number, endLine: number, newLines: string[]): string[];
|
||||
@@ -0,0 +1,7 @@
|
||||
export interface FileTextEnvelope {
|
||||
content: string;
|
||||
hadBom: boolean;
|
||||
lineEnding: "\n" | "\r\n";
|
||||
}
|
||||
export declare function canonicalizeFileText(content: string): FileTextEnvelope;
|
||||
export declare function restoreFileText(content: string, envelope: FileTextEnvelope): string;
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
export declare function computeLineHash(lineNumber: number, content: string): string;
|
||||
export declare function formatHashLine(lineNumber: number, content: string): string;
|
||||
export declare function formatHashLines(content: string): string;
|
||||
export interface HashlineStreamOptions {
|
||||
startLine?: number;
|
||||
maxChunkLines?: number;
|
||||
maxChunkBytes?: number;
|
||||
}
|
||||
export declare function streamHashLinesFromUtf8(source: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>, options?: HashlineStreamOptions): AsyncGenerator<string>;
|
||||
export declare function streamHashLinesFromLines(lines: Iterable<string> | AsyncIterable<string>, options?: HashlineStreamOptions): AsyncGenerator<string>;
|
||||
@@ -0,0 +1,10 @@
|
||||
export interface HashlineChunkFormatter {
|
||||
push(formattedLine: string): string[];
|
||||
flush(): string | undefined;
|
||||
}
|
||||
interface HashlineChunkFormatterOptions {
|
||||
maxChunkLines: number;
|
||||
maxChunkBytes: number;
|
||||
}
|
||||
export declare function createHashlineChunkFormatter(options: HashlineChunkFormatterOptions): HashlineChunkFormatter;
|
||||
export {};
|
||||
@@ -0,0 +1 @@
|
||||
export declare function generateHashlineDiff(oldContent: string, newContent: string, filePath: string): string;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user