@opencode-ai/plugin 1.4.3 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from "@opencode-ai/plugin";
2
+ export declare const FolderWorkspacePlugin: Plugin;
3
+ export default FolderWorkspacePlugin;
@@ -0,0 +1,30 @@
1
+ import { mkdir, rm } from "node:fs/promises";
2
+ export const FolderWorkspacePlugin = async ({ experimental_workspace }) => {
3
+ experimental_workspace.register("folder", {
4
+ name: "Folder",
5
+ description: "Create a blank folder",
6
+ configure(config) {
7
+ const rand = "" + Math.random();
8
+ return {
9
+ ...config,
10
+ directory: `/tmp/folder/folder-${rand}`,
11
+ };
12
+ },
13
+ async create(config) {
14
+ if (!config.directory)
15
+ return;
16
+ await mkdir(config.directory, { recursive: true });
17
+ },
18
+ async remove(config) {
19
+ await rm(config.directory, { recursive: true, force: true });
20
+ },
21
+ target(config) {
22
+ return {
23
+ type: "local",
24
+ directory: config.directory,
25
+ };
26
+ },
27
+ });
28
+ return {};
29
+ };
30
+ export default FolderWorkspacePlugin;
package/dist/index.d.ts CHANGED
@@ -8,11 +8,39 @@ export type ProviderContext = {
8
8
  info: Provider;
9
9
  options: Record<string, any>;
10
10
  };
11
+ export type WorkspaceInfo = {
12
+ id: string;
13
+ type: string;
14
+ name: string;
15
+ branch: string | null;
16
+ directory: string | null;
17
+ extra: unknown | null;
18
+ projectID: string;
19
+ };
20
+ export type WorkspaceTarget = {
21
+ type: "local";
22
+ directory: string;
23
+ } | {
24
+ type: "remote";
25
+ url: string | URL;
26
+ headers?: HeadersInit;
27
+ };
28
+ export type WorkspaceAdaptor = {
29
+ name: string;
30
+ description: string;
31
+ configure(config: WorkspaceInfo): WorkspaceInfo | Promise<WorkspaceInfo>;
32
+ create(config: WorkspaceInfo, from?: WorkspaceInfo): Promise<void>;
33
+ remove(config: WorkspaceInfo): Promise<void>;
34
+ target(config: WorkspaceInfo): WorkspaceTarget | Promise<WorkspaceTarget>;
35
+ };
11
36
  export type PluginInput = {
12
37
  client: ReturnType<typeof createOpencodeClient>;
13
38
  project: Project;
14
39
  directory: string;
15
40
  worktree: string;
41
+ experimental_workspace: {
42
+ register(type: string, adaptor: WorkspaceAdaptor): void;
43
+ };
16
44
  serverUrl: URL;
17
45
  $: BunShell;
18
46
  };
@@ -249,6 +277,23 @@ export interface Hooks {
249
277
  context: string[];
250
278
  prompt?: string;
251
279
  }) => Promise<void>;
280
+ /**
281
+ * Called after compaction succeeds and before a synthetic user
282
+ * auto-continue message is added.
283
+ *
284
+ * - `enabled`: Defaults to `true`. Set to `false` to skip the synthetic
285
+ * user "continue" turn.
286
+ */
287
+ "experimental.compaction.autocontinue"?: (input: {
288
+ sessionID: string;
289
+ agent: string;
290
+ model: Model;
291
+ provider: ProviderContext;
292
+ message: UserMessage;
293
+ overflow: boolean;
294
+ }, output: {
295
+ enabled: boolean;
296
+ }) => Promise<void>;
252
297
  "experimental.text.complete"?: (input: {
253
298
  sessionID: string;
254
299
  messageID: string;
package/dist/tool.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { Effect } from "effect";
2
3
  export type ToolContext = {
3
4
  sessionID: string;
4
5
  messageID: string;
@@ -20,7 +21,7 @@ export type ToolContext = {
20
21
  [key: string]: any;
21
22
  };
22
23
  }): void;
23
- ask(input: AskInput): Promise<void>;
24
+ ask(input: AskInput): Effect.Effect<void>;
24
25
  };
25
26
  type AskInput = {
26
27
  permission: string;
package/dist/tui.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AgentPart, OpencodeClient, Event, FilePart, LspStatus, McpStatus, Todo, Message, Part, Provider, PermissionRequest, QuestionRequest, SessionStatus, TextPart, Workspace, Config as SdkConfig } from "@opencode-ai/sdk/v2";
1
+ import type { AgentPart, OpencodeClient, Event, FilePart, LspStatus, McpStatus, Todo, Message, Part, Provider, PermissionRequest, QuestionRequest, SessionStatus, TextPart, Config as SdkConfig } from "@opencode-ai/sdk/v2";
2
2
  import type { CliRenderer, ParsedKey, RGBA, SlotMode } from "@opentui/core";
3
3
  import type { JSX, SolidPlugin } from "@opentui/solid";
4
4
  import type { Config as PluginConfig, PluginOptions } from "./index.js";
@@ -230,10 +230,6 @@ export type TuiState = {
230
230
  readonly vcs: {
231
231
  branch?: string;
232
232
  } | undefined;
233
- readonly workspace: {
234
- list: () => ReadonlyArray<Workspace>;
235
- get: (workspaceID: string) => Workspace | undefined;
236
- };
237
233
  session: {
238
234
  count: () => number;
239
235
  diff: (sessionID: string) => ReadonlyArray<TuiSidebarFileItem>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode-ai/plugin",
4
- "version": "1.4.3",
4
+ "version": "1.4.5",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -26,12 +26,13 @@
26
26
  "dist"
27
27
  ],
28
28
  "dependencies": {
29
- "@opencode-ai/sdk": "1.4.3",
29
+ "@opencode-ai/sdk": "1.4.5",
30
+ "effect": "4.0.0-beta.48",
30
31
  "zod": "4.1.8"
31
32
  },
32
33
  "peerDependencies": {
33
- "@opentui/core": ">=0.1.97",
34
- "@opentui/solid": ">=0.1.97"
34
+ "@opentui/core": ">=0.1.99",
35
+ "@opentui/solid": ">=0.1.99"
35
36
  },
36
37
  "peerDependenciesMeta": {
37
38
  "@opentui/core": {
@@ -42,8 +43,8 @@
42
43
  }
43
44
  },
44
45
  "devDependencies": {
45
- "@opentui/core": "0.1.97",
46
- "@opentui/solid": "0.1.97",
46
+ "@opentui/core": "0.1.99",
47
+ "@opentui/solid": "0.1.99",
47
48
  "@tsconfig/node22": "22.0.2",
48
49
  "@types/node": "22.13.9",
49
50
  "typescript": "5.8.2",