chore: include pre-built dist for github install
This commit is contained in:
+4
@@ -0,0 +1,4 @@
|
||||
export { OPENCODE_STORAGE, MESSAGE_STORAGE, PART_STORAGE } from "../../shared";
|
||||
export declare const THINKING_TYPES: Set<string>;
|
||||
export declare const META_TYPES: Set<string>;
|
||||
export declare const CONTENT_TYPES: Set<string>;
|
||||
@@ -0,0 +1,4 @@
|
||||
export type RecoveryErrorType = "tool_result_missing" | "thinking_block_order" | "thinking_disabled_violation" | "assistant_prefill_unsupported" | "unavailable_tool" | null;
|
||||
export declare function extractMessageIndex(error: unknown): number | null;
|
||||
export declare function extractUnavailableToolName(error: unknown): string | null;
|
||||
export declare function detectErrorType(error: unknown): RecoveryErrorType;
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
import type { ExperimentalConfig } from "../../config";
|
||||
interface MessageInfo {
|
||||
id?: string;
|
||||
role?: string;
|
||||
sessionID?: string;
|
||||
parentID?: string;
|
||||
error?: unknown;
|
||||
}
|
||||
export interface SessionRecoveryOptions {
|
||||
experimental?: ExperimentalConfig;
|
||||
}
|
||||
export interface SessionRecoveryHook {
|
||||
handleSessionRecovery: (info: MessageInfo) => Promise<boolean>;
|
||||
isRecoverableError: (error: unknown) => boolean;
|
||||
setOnAbortCallback: (callback: (sessionID: string) => void) => void;
|
||||
setOnRecoveryCompleteCallback: (callback: (sessionID: string) => void) => void;
|
||||
}
|
||||
export declare function createSessionRecoveryHook(ctx: PluginInput, options?: SessionRecoveryOptions): SessionRecoveryHook;
|
||||
export {};
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
export { createSessionRecoveryHook } from "./hook";
|
||||
export type { SessionRecoveryHook, SessionRecoveryOptions } from "./hook";
|
||||
export { detectErrorType } from "./detect-error-type";
|
||||
export type { RecoveryErrorType } from "./detect-error-type";
|
||||
export type { MessageData, ResumeConfig } from "./types";
|
||||
@@ -0,0 +1,13 @@
|
||||
import type { createOpencodeClient } from "@opencode-ai/sdk";
|
||||
import type { MessageData } from "./types";
|
||||
type Client = ReturnType<typeof createOpencodeClient>;
|
||||
type ReplaceEmptyTextPartsAsync = (client: Client, sessionID: string, messageID: string, replacementText: string) => Promise<boolean>;
|
||||
type InjectTextPartAsync = (client: Client, sessionID: string, messageID: string, text: string) => Promise<boolean>;
|
||||
type FindMessagesWithEmptyTextPartsFromSDK = (client: Client, sessionID: string) => Promise<string[]>;
|
||||
export declare function recoverEmptyContentMessageFromSDK(client: Client, sessionID: string, failedAssistantMsg: MessageData, error: unknown, dependencies: {
|
||||
placeholderText: string;
|
||||
replaceEmptyTextPartsAsync: ReplaceEmptyTextPartsAsync;
|
||||
injectTextPartAsync: InjectTextPartAsync;
|
||||
findMessagesWithEmptyTextPartsFromSDK: FindMessagesWithEmptyTextPartsFromSDK;
|
||||
}): Promise<boolean>;
|
||||
export {};
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { createOpencodeClient } from "@opencode-ai/sdk";
|
||||
import type { MessageData } from "./types";
|
||||
type Client = ReturnType<typeof createOpencodeClient>;
|
||||
export declare function recoverThinkingBlockOrder(client: Client, sessionID: string, _failedAssistantMsg: MessageData, _directory: string, error: unknown): Promise<boolean>;
|
||||
export {};
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { createOpencodeClient } from "@opencode-ai/sdk";
|
||||
import type { MessageData } from "./types";
|
||||
type Client = ReturnType<typeof createOpencodeClient>;
|
||||
export declare function recoverThinkingDisabledViolation(client: Client, sessionID: string, _failedAssistantMsg: MessageData): Promise<boolean>;
|
||||
export {};
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { createOpencodeClient } from "@opencode-ai/sdk";
|
||||
import type { MessageData } from "./types";
|
||||
type Client = ReturnType<typeof createOpencodeClient>;
|
||||
export declare function recoverToolResultMissing(client: Client, sessionID: string, failedAssistantMsg: MessageData): Promise<boolean>;
|
||||
export {};
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { createOpencodeClient } from "@opencode-ai/sdk";
|
||||
import type { MessageData } from "./types";
|
||||
type Client = ReturnType<typeof createOpencodeClient>;
|
||||
export declare function recoverUnavailableTool(client: Client, sessionID: string, failedAssistantMsg: MessageData): Promise<boolean>;
|
||||
export {};
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import type { createOpencodeClient } from "@opencode-ai/sdk";
|
||||
import type { MessageData, ResumeConfig } from "./types";
|
||||
type Client = ReturnType<typeof createOpencodeClient>;
|
||||
export declare function findLastUserMessage(messages: MessageData[]): MessageData | undefined;
|
||||
export declare function extractResumeConfig(userMessage: MessageData | undefined, sessionID: string): ResumeConfig;
|
||||
export declare function resumeSession(client: Client, config: ResumeConfig): Promise<boolean>;
|
||||
export {};
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
export { generatePartId } from "./storage/part-id";
|
||||
export { getMessageDir } from "./storage/message-dir";
|
||||
export { readMessages } from "./storage/messages-reader";
|
||||
export { readMessagesFromSDK } from "./storage/messages-reader";
|
||||
export { readParts } from "./storage/parts-reader";
|
||||
export { readPartsFromSDK } from "./storage/parts-reader";
|
||||
export { hasContent, messageHasContent } from "./storage/part-content";
|
||||
export { injectTextPart } from "./storage/text-part-injector";
|
||||
export { injectTextPartAsync } from "./storage/text-part-injector";
|
||||
export { findEmptyMessages, findEmptyMessageByIndex, findFirstEmptyMessage, } from "./storage/empty-messages";
|
||||
export { findMessagesWithEmptyTextParts } from "./storage/empty-text";
|
||||
export { findMessagesWithEmptyTextPartsFromSDK } from "./storage/empty-text";
|
||||
export { findMessagesWithThinkingBlocks, findMessagesWithThinkingOnly, } from "./storage/thinking-block-search";
|
||||
export { findMessagesWithOrphanThinking, findMessageByIndexNeedingThinking, } from "./storage/orphan-thinking-search";
|
||||
export { prependThinkingPart } from "./storage/thinking-prepend";
|
||||
export { stripThinkingParts } from "./storage/thinking-strip";
|
||||
export { replaceEmptyTextParts } from "./storage/empty-text";
|
||||
export { prependThinkingPartAsync } from "./storage/thinking-prepend";
|
||||
export { stripThinkingPartsAsync } from "./storage/thinking-strip";
|
||||
export { replaceEmptyTextPartsAsync } from "./storage/empty-text";
|
||||
@@ -0,0 +1,3 @@
|
||||
export declare function findEmptyMessages(sessionID: string): string[];
|
||||
export declare function findEmptyMessageByIndex(sessionID: string, targetIndex: number): string | null;
|
||||
export declare function findFirstEmptyMessage(sessionID: string): string | null;
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
type OpencodeClient = PluginInput["client"];
|
||||
export declare function replaceEmptyTextParts(messageID: string, replacementText: string): boolean;
|
||||
export declare function replaceEmptyTextPartsAsync(client: OpencodeClient, sessionID: string, messageID: string, replacementText: string): Promise<boolean>;
|
||||
export declare function findMessagesWithEmptyTextParts(sessionID: string): string[];
|
||||
export declare function findMessagesWithEmptyTextPartsFromSDK(client: OpencodeClient, sessionID: string): Promise<string[]>;
|
||||
export {};
|
||||
@@ -0,0 +1 @@
|
||||
export { getMessageDir } from "../../../shared/opencode-message-dir";
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
import type { StoredMessageMeta } from "../types";
|
||||
type OpencodeClient = PluginInput["client"];
|
||||
export declare function readMessages(sessionID: string): StoredMessageMeta[];
|
||||
export declare function readMessagesFromSDK(client: OpencodeClient, sessionID: string): Promise<StoredMessageMeta[]>;
|
||||
export {};
|
||||
@@ -0,0 +1,2 @@
|
||||
export declare function findMessagesWithOrphanThinking(sessionID: string): string[];
|
||||
export declare function findMessageByIndexNeedingThinking(sessionID: string, targetIndex: number): string | null;
|
||||
@@ -0,0 +1,3 @@
|
||||
import type { StoredPart } from "../types";
|
||||
export declare function hasContent(part: StoredPart): boolean;
|
||||
export declare function messageHasContent(messageID: string): boolean;
|
||||
@@ -0,0 +1 @@
|
||||
export declare function generatePartId(): string;
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
import type { StoredPart } from "../types";
|
||||
type OpencodeClient = PluginInput["client"];
|
||||
export declare function readParts(messageID: string): StoredPart[];
|
||||
export declare function readPartsFromSDK(client: OpencodeClient, sessionID: string, messageID: string): Promise<StoredPart[]>;
|
||||
export {};
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
type OpencodeClient = PluginInput["client"];
|
||||
export declare function injectTextPart(sessionID: string, messageID: string, text: string): boolean;
|
||||
export declare function injectTextPartAsync(client: OpencodeClient, sessionID: string, messageID: string, text: string): Promise<boolean>;
|
||||
export {};
|
||||
@@ -0,0 +1,2 @@
|
||||
export declare function findMessagesWithThinkingBlocks(sessionID: string): string[];
|
||||
export declare function findMessagesWithThinkingOnly(sessionID: string): string[];
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
type OpencodeClient = PluginInput["client"];
|
||||
export declare function prependThinkingPart(sessionID: string, messageID: string): boolean;
|
||||
export declare function prependThinkingPartAsync(client: OpencodeClient, sessionID: string, messageID: string): Promise<boolean>;
|
||||
export {};
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin";
|
||||
type OpencodeClient = PluginInput["client"];
|
||||
export declare function stripThinkingParts(messageID: string): boolean;
|
||||
export declare function stripThinkingPartsAsync(client: OpencodeClient, sessionID: string, messageID: string): Promise<boolean>;
|
||||
export {};
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
export type ThinkingPartType = "thinking" | "redacted_thinking" | "reasoning";
|
||||
export type MetaPartType = "step-start" | "step-finish";
|
||||
export type ContentPartType = "text" | "tool" | "tool_use" | "tool_result";
|
||||
export interface StoredMessageMeta {
|
||||
id: string;
|
||||
sessionID: string;
|
||||
role: "user" | "assistant";
|
||||
parentID?: string;
|
||||
time?: {
|
||||
created: number;
|
||||
completed?: number;
|
||||
};
|
||||
error?: unknown;
|
||||
}
|
||||
export interface StoredTextPart {
|
||||
id: string;
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
type: "text";
|
||||
text: string;
|
||||
synthetic?: boolean;
|
||||
ignored?: boolean;
|
||||
}
|
||||
export interface StoredToolPart {
|
||||
id: string;
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
type: "tool";
|
||||
callID: string;
|
||||
tool: string;
|
||||
state: {
|
||||
status: "pending" | "running" | "completed" | "error";
|
||||
input: Record<string, unknown>;
|
||||
output?: string;
|
||||
error?: string;
|
||||
};
|
||||
}
|
||||
export interface StoredReasoningPart {
|
||||
id: string;
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
type: "reasoning";
|
||||
text: string;
|
||||
}
|
||||
export interface StoredStepPart {
|
||||
id: string;
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
type: "step-start" | "step-finish";
|
||||
}
|
||||
export type StoredPart = StoredTextPart | StoredToolPart | StoredReasoningPart | StoredStepPart | {
|
||||
id: string;
|
||||
sessionID: string;
|
||||
messageID: string;
|
||||
type: string;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
export interface MessageData {
|
||||
info?: {
|
||||
id?: string;
|
||||
role?: string;
|
||||
sessionID?: string;
|
||||
parentID?: string;
|
||||
error?: unknown;
|
||||
agent?: string;
|
||||
model?: {
|
||||
providerID: string;
|
||||
modelID: string;
|
||||
};
|
||||
system?: string;
|
||||
tools?: Record<string, boolean>;
|
||||
};
|
||||
parts?: Array<{
|
||||
type: string;
|
||||
id?: string;
|
||||
text?: string;
|
||||
thinking?: string;
|
||||
name?: string;
|
||||
input?: Record<string, unknown>;
|
||||
callID?: string;
|
||||
}>;
|
||||
}
|
||||
export interface ResumeConfig {
|
||||
sessionID: string;
|
||||
agent?: string;
|
||||
model?: {
|
||||
providerID: string;
|
||||
modelID: string;
|
||||
};
|
||||
tools?: Record<string, boolean>;
|
||||
}
|
||||
Reference in New Issue
Block a user