summaryrefslogtreecommitdiffhomepage
path: root/packages/plugin/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/plugin/src/index.ts')
-rw-r--r--packages/plugin/src/index.ts51
1 files changed, 51 insertions, 0 deletions
diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts
index 1afb55daa..d53c23a89 100644
--- a/packages/plugin/src/index.ts
+++ b/packages/plugin/src/index.ts
@@ -24,11 +24,44 @@ export type ProviderContext = {
options: Record<string, any>
}
+export type WorkspaceInfo = {
+ id: string
+ type: string
+ name: string
+ branch: string | null
+ directory: string | null
+ extra: unknown | null
+ projectID: string
+}
+
+export type WorkspaceTarget =
+ | {
+ type: "local"
+ directory: string
+ }
+ | {
+ type: "remote"
+ url: string | URL
+ headers?: HeadersInit
+ }
+
+export type WorkspaceAdaptor = {
+ name: string
+ description: string
+ configure(config: WorkspaceInfo): WorkspaceInfo | Promise<WorkspaceInfo>
+ create(config: WorkspaceInfo, from?: WorkspaceInfo): Promise<void>
+ remove(config: WorkspaceInfo): Promise<void>
+ target(config: WorkspaceInfo): WorkspaceTarget | Promise<WorkspaceTarget>
+}
+
export type PluginInput = {
client: ReturnType<typeof createOpencodeClient>
project: Project
directory: string
worktree: string
+ experimental_workspace: {
+ register(type: string, adaptor: WorkspaceAdaptor): void
+ }
serverUrl: URL
$: BunShell
}
@@ -271,6 +304,24 @@ export interface Hooks {
input: { sessionID: string },
output: { context: string[]; prompt?: string },
) => Promise<void>
+ /**
+ * Called after compaction succeeds and before a synthetic user
+ * auto-continue message is added.
+ *
+ * - `enabled`: Defaults to `true`. Set to `false` to skip the synthetic
+ * user "continue" turn.
+ */
+ "experimental.compaction.autocontinue"?: (
+ input: {
+ sessionID: string
+ agent: string
+ model: Model
+ provider: ProviderContext
+ message: UserMessage
+ overflow: boolean
+ },
+ output: { enabled: boolean },
+ ) => Promise<void>
"experimental.text.complete"?: (
input: { sessionID: string; messageID: string; partID: string },
output: { text: string },