chore: include pre-built dist for github install
This commit is contained in:
@@ -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>;
|
||||
Reference in New Issue
Block a user