@opencode/plugin 2.2.2 → 2.2.4

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,42 @@
1
+ import type { Artifact } from "@opencode/schema/artifact";
2
+ import type { Session } from "@opencode/schema/session";
3
+ import type { Effect } from "effect";
4
+ import type { Transform } from "./registration.js";
5
+ export interface ArtifactProviderCreateInput {
6
+ readonly id: Artifact.ID;
7
+ readonly title: string;
8
+ readonly entry: string;
9
+ readonly files: Readonly<Record<string, Uint8Array>>;
10
+ readonly sessionID?: Session.ID;
11
+ }
12
+ export interface ArtifactProviderUpdateInput {
13
+ readonly title: string;
14
+ readonly entry: string;
15
+ readonly files: Readonly<Record<string, Uint8Array>>;
16
+ readonly sessionID?: Session.ID;
17
+ }
18
+ export interface ArtifactProviderResult {
19
+ readonly url?: string;
20
+ }
21
+ export interface ArtifactProviderDefinition {
22
+ readonly id: string;
23
+ readonly name: string;
24
+ readonly capabilities: readonly Artifact.Capability[];
25
+ readonly prompt: string;
26
+ readonly create: (input: ArtifactProviderCreateInput) => Effect.Effect<ArtifactProviderResult, unknown>;
27
+ readonly read: (id: Artifact.ID) => Effect.Effect<Readonly<Record<string, Uint8Array>>, unknown>;
28
+ readonly update: (id: Artifact.ID, input: ArtifactProviderUpdateInput) => Effect.Effect<ArtifactProviderResult, unknown>;
29
+ readonly delete: (id: Artifact.ID) => Effect.Effect<void, unknown>;
30
+ }
31
+ export interface ArtifactEditor {
32
+ add(definition: ArtifactProviderDefinition): void;
33
+ remove(id: string): void;
34
+ readonly default: {
35
+ get(): string | undefined;
36
+ set(providerID: string | undefined): void;
37
+ };
38
+ }
39
+ export interface ExperimentalArtifactDomain {
40
+ readonly transform: Transform<ArtifactEditor>;
41
+ readonly reload: () => Effect.Effect<void>;
42
+ }
File without changes
@@ -1,6 +1,7 @@
1
1
  export * as Plugin from "./plugin.js";
2
2
  export type { StorageEntry, StorageScanOptions, StorageScanResult } from "../storage.js";
3
3
  export { Agent } from "@opencode/schema/agent";
4
+ export { Artifact } from "@opencode/schema/artifact";
4
5
  export { Command } from "@opencode/schema/command";
5
6
  export { Connection } from "@opencode/schema/connection";
6
7
  export { Credential } from "@opencode/schema/credential";
@@ -1,5 +1,6 @@
1
1
  export * as Plugin from "./plugin.js";
2
2
  export { Agent } from "@opencode/schema/agent";
3
+ export { Artifact } from "@opencode/schema/artifact";
3
4
  export { Command } from "@opencode/schema/command";
4
5
  export { Connection } from "@opencode/schema/connection";
5
6
  export { Credential } from "@opencode/schema/credential";
@@ -4,6 +4,7 @@ import type { Effect, Scope } from "effect";
4
4
  import type { PluginOptions } from "../options.js";
5
5
  import type { App } from "../app.js";
6
6
  import type { AgentDomain } from "./agent.js";
7
+ import type { ExperimentalArtifactDomain } from "./artifact.js";
7
8
  import type { AISDKDomain } from "./aisdk.js";
8
9
  import type { CommandDomain } from "./command.js";
9
10
  import type { EventDomain } from "./event.js";
@@ -35,6 +36,7 @@ export interface Context {
35
36
  readonly terminal: Pick<ExperimentalApi<unknown>["persistentPty"], "read">;
36
37
  /** Stateless generation with a model and a prompt: no session, history or tools. */
37
38
  readonly generate: ExperimentalGenerateApi<unknown>;
39
+ readonly artifact: ExperimentalArtifactDomain;
38
40
  };
39
41
  readonly integration: IntegrationDomain;
40
42
  readonly mcp: MCPDomain;
@@ -22,6 +22,10 @@ export type SessionRequestOptions = Types.DeepMutable<GenerationOptionsFields> &
22
22
  export interface SessionRequest {
23
23
  readonly sessionID: Session.ID;
24
24
  readonly model: Model.Ref;
25
+ /**
26
+ * The instructions part keeps each source's text in `metadata.experimental.instructions` as `{ key, text }`. It is
27
+ * not updated when a hook edits `text`. Experimental.
28
+ */
25
29
  system: Array<SystemPart>;
26
30
  messages: Array<Message>;
27
31
  options: SessionRequestOptions;
@@ -22,7 +22,7 @@ export interface ServerRef {
22
22
  readonly client: OpenCodeClient;
23
23
  /** The server's synced data (sessions, projects, …). Reactive. */
24
24
  readonly data: Data;
25
- /** The built-in local server or a loopback http server. */
25
+ /** The app's own local server, or a loopback http connection to its port. */
26
26
  readonly local: boolean;
27
27
  /** The app's own server, the desktop sidecar. */
28
28
  readonly builtin: boolean;
@@ -654,6 +654,12 @@ export interface SlotMap {
654
654
  readonly session: MountedSession;
655
655
  /** The timeline is the one on screen. */
656
656
  readonly active: boolean;
657
+ /**
658
+ * The title does not fit beside the actions, even with the location collapsed. Show the compact form of what you
659
+ * render, without its details (for example an icon that opens them in a menu), so the title keeps the room. The
660
+ * header returns to false once the title fits beside your expanded content again.
661
+ */
662
+ readonly compact: boolean;
657
663
  };
658
664
  /** Items in the project/location menu, after its location details. Omitted on loading headers without a screen. */
659
665
  readonly "session.location.menu": {
@@ -238,6 +238,25 @@ export function fromPromise(plugin) {
238
238
  image: adaptApiMethod(GenerateEndpoints["generate.image"], host.experimental.generate.image),
239
239
  decisions: adaptApiMethod(GenerateEndpoints["generate.decisions"], host.experimental.generate.decisions),
240
240
  },
241
+ artifact: {
242
+ reload: () => run(host.experimental.artifact.reload()),
243
+ transform: (callback) => register(host.experimental.artifact.transform((editor) => {
244
+ callback({
245
+ add: (definition) => editor.add({
246
+ id: definition.id,
247
+ name: definition.name,
248
+ capabilities: definition.capabilities,
249
+ prompt: definition.prompt,
250
+ create: (input) => attempt((signal) => definition.create(input, { signal })),
251
+ read: (id) => attempt((signal) => definition.read(id, { signal })),
252
+ update: (id, input) => attempt((signal) => definition.update(id, input, { signal })),
253
+ delete: (id) => attempt((signal) => definition.delete(id, { signal })),
254
+ }),
255
+ remove: editor.remove,
256
+ default: editor.default,
257
+ });
258
+ })),
259
+ },
241
260
  },
242
261
  generate: {
243
262
  text: adaptApiMethod(GenerateEndpoints["generate.text"], host.generate.text),
@@ -0,0 +1,49 @@
1
+ import type { Artifact } from "@opencode/schema/artifact";
2
+ import type { Session } from "@opencode/schema/session";
3
+ import type { Transform } from "./registration.js";
4
+ export interface ArtifactProviderCreateInput {
5
+ readonly id: Artifact.ID;
6
+ readonly title: string;
7
+ readonly entry: string;
8
+ readonly files: Readonly<Record<string, Uint8Array>>;
9
+ readonly sessionID?: Session.ID;
10
+ }
11
+ export interface ArtifactProviderUpdateInput {
12
+ readonly title: string;
13
+ readonly entry: string;
14
+ readonly files: Readonly<Record<string, Uint8Array>>;
15
+ readonly sessionID?: Session.ID;
16
+ }
17
+ export interface ArtifactProviderResult {
18
+ readonly url?: string;
19
+ }
20
+ export interface ArtifactProviderDefinition {
21
+ readonly id: string;
22
+ readonly name: string;
23
+ readonly capabilities: readonly Artifact.Capability[];
24
+ readonly prompt: string;
25
+ readonly create: (input: ArtifactProviderCreateInput, context: {
26
+ readonly signal: AbortSignal;
27
+ }) => Promise<ArtifactProviderResult>;
28
+ readonly read: (id: Artifact.ID, context: {
29
+ readonly signal: AbortSignal;
30
+ }) => Promise<Readonly<Record<string, Uint8Array>>>;
31
+ readonly update: (id: Artifact.ID, input: ArtifactProviderUpdateInput, context: {
32
+ readonly signal: AbortSignal;
33
+ }) => Promise<ArtifactProviderResult>;
34
+ readonly delete: (id: Artifact.ID, context: {
35
+ readonly signal: AbortSignal;
36
+ }) => Promise<void>;
37
+ }
38
+ export interface ArtifactEditor {
39
+ add(definition: ArtifactProviderDefinition): void;
40
+ remove(id: string): void;
41
+ readonly default: {
42
+ get(): string | undefined;
43
+ set(providerID: string | undefined): void;
44
+ };
45
+ }
46
+ export interface ExperimentalArtifactDomain {
47
+ readonly transform: Transform<ArtifactEditor>;
48
+ readonly reload: () => Promise<void>;
49
+ }
File without changes
@@ -2,6 +2,7 @@ export type { PluginOptions } from "../options.js";
2
2
  export type { StorageEntry, StorageScanOptions, StorageScanResult } from "../storage.js";
3
3
  export * as Plugin from "./plugin.js";
4
4
  export { Agent } from "@opencode/schema/agent";
5
+ export { Artifact } from "@opencode/schema/artifact";
5
6
  export { Command } from "@opencode/schema/command";
6
7
  export { Connection } from "@opencode/schema/connection";
7
8
  export { Credential } from "@opencode/schema/credential";
@@ -1,5 +1,6 @@
1
1
  export * as Plugin from "./plugin.js";
2
2
  export { Agent } from "@opencode/schema/agent";
3
+ export { Artifact } from "@opencode/schema/artifact";
3
4
  export { Command } from "@opencode/schema/command";
4
5
  export { Connection } from "@opencode/schema/connection";
5
6
  export { Credential } from "@opencode/schema/credential";
@@ -4,6 +4,7 @@ import type { Location } from "@opencode/schema/location";
4
4
  import type { PluginOptions } from "../options.js";
5
5
  import type { App } from "../app.js";
6
6
  import type { AgentDomain } from "./agent.js";
7
+ import type { ExperimentalArtifactDomain } from "./artifact.js";
7
8
  import type { AISDKDomain } from "./aisdk.js";
8
9
  import type { CommandDomain } from "./command.js";
9
10
  import type { EventDomain } from "./event.js";
@@ -35,6 +36,7 @@ export interface Context {
35
36
  readonly terminal: Pick<OpenCodeClient["experimental"]["persistentPty"], "read">;
36
37
  /** Stateless generation with a model and a prompt: no session, history or tools. */
37
38
  readonly generate: ExperimentalGenerateApi;
39
+ readonly artifact: ExperimentalArtifactDomain;
38
40
  };
39
41
  readonly integration: IntegrationDomain;
40
42
  readonly mcp: MCPDomain;
@@ -22,6 +22,10 @@ export type SessionRequestOptions = Types.DeepMutable<GenerationOptionsFields> &
22
22
  export interface SessionRequest {
23
23
  readonly sessionID: Session.ID;
24
24
  readonly model: Model.Ref;
25
+ /**
26
+ * The instructions part keeps each source's text in `metadata.experimental.instructions` as `{ key, text }`. It is
27
+ * not updated when a hook edits `text`. Experimental.
28
+ */
25
29
  system: Array<SystemPart>;
26
30
  messages: Array<Message>;
27
31
  options: SessionRequestOptions;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/plugin",
4
- "version": "2.2.2",
4
+ "version": "2.2.4",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -78,17 +78,17 @@
78
78
  ],
79
79
  "dependencies": {
80
80
  "@ai-sdk/provider": "3.0.8",
81
- "@opencode/ai": "2.2.2",
82
- "@opencode/client": "2.2.2",
83
- "@opencode/protocol": "2.2.2",
84
- "@opencode/schema": "2.2.2",
85
- "@opencode/util": "2.2.2",
81
+ "@opencode/ai": "2.2.4",
82
+ "@opencode/client": "2.2.4",
83
+ "@opencode/protocol": "2.2.4",
84
+ "@opencode/schema": "2.2.4",
85
+ "@opencode/util": "2.2.4",
86
86
  "effect": "4.0.6"
87
87
  },
88
88
  "peerDependencies": {
89
- "@opencode/theme": "2.2.2",
90
- "@opentui/core": "0.7.0",
91
- "@opentui/solid": "0.7.0",
89
+ "@opencode/theme": "2.2.4",
90
+ "@opentui/core": ">=0.8.0",
91
+ "@opentui/solid": ">=0.8.0",
92
92
  "electron": "*",
93
93
  "solid-js": ">=1.9.0",
94
94
  "vite": ">=6",
@@ -118,9 +118,9 @@
118
118
  }
119
119
  },
120
120
  "devDependencies": {
121
- "@opencode/theme": "2.2.2",
122
- "@opentui/core": "0.7.0",
123
- "@opentui/solid": "0.7.0",
121
+ "@opencode/theme": "2.2.4",
122
+ "@opentui/core": "0.8.0",
123
+ "@opentui/solid": "0.8.0",
124
124
  "@tsconfig/bun": "1.0.9",
125
125
  "@types/bun": "1.4.3",
126
126
  "@types/node": "24.12.2",