@cotal-ai/connector-opencode 0.179.0 → 0.181.0

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.
@@ -5,10 +5,12 @@
5
5
  * has ended, so a dispatch resolves once that turn starts: OpenCode calls the
6
6
  * `command.execute.before` hook, stores the command's prompt, and reports the session busy. An
7
7
  * owner's turn goes out as a prompt, each image as a file part with a data URL, and `usage` reads
8
- * the session's messages the way T3 Code's OpenCode provider does.
8
+ * the session's messages the way T3 Code's OpenCode provider does. After an owner's `set-model`,
9
+ * every prompt and command names the model and variant they chose (model-switch.ts).
9
10
  */
10
11
  import { type CommandDispatcher } from "@cotal-ai/connector-core";
11
12
  import type { CommandEntry } from "@cotal-ai/core";
13
+ import { type PromptModel1 } from "./model-switch.js";
12
14
  export interface Commands1Deps {
13
15
  /** The plugin's OpenCode HTTP client. An answer that is not 2xx throws an Error with its `status`. */
14
16
  api<T>(path: string, init?: RequestInit, timeoutMs?: number): Promise<T>;
@@ -22,6 +24,11 @@ export interface Commands1Deps {
22
24
  firstTurnSystem(): string | undefined;
23
25
  /** A turn carrying the first-turn `system` field went out. */
24
26
  primed(): void;
27
+ /** The model and variant the launch pinned on the `cotal` agent, each absent when it pinned none. */
28
+ launch: {
29
+ model?: string;
30
+ variant?: string;
31
+ };
25
32
  warn(message: string): void;
26
33
  }
27
34
  export interface Commands1 {
@@ -32,6 +39,8 @@ export interface Commands1 {
32
39
  turnStarted(sessionID: string): void;
33
40
  /** Teardown began: stop waiting on a command's answer. */
34
41
  close(): void;
42
+ /** What every prompt the plugin sends names besides its parts. */
43
+ promptModel(): PromptModel1;
35
44
  }
36
45
  /** The entries of a `GET /command` answer, as a seat lists them and runs them by name. */
37
46
  export declare function opencode1CommandEntries(data: unknown): CommandEntry[];
@@ -1 +1 @@
1
- {"version":3,"file":"commands1.d.ts","sourceRoot":"","sources":["../src/commands1.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,E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BAAiB,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS,CAuIhE"}
@@ -2,7 +2,8 @@
2
2
  * The OpenCode 2.x dispatcher on the `agent` endpoint (SPEC 13.22): its commands and skills,
3
3
  * interrupt, the owner's turns with images, and usage. A turn goes out as a prompt, each image a file
4
4
  * attached by its data URL, and `usage` reads the session and its last model step the way T3 Code's
5
- * OpenCode 2 provider does, as measured on 2.0.24.
5
+ * OpenCode 2 provider does, as measured on 2.0.24. An owner's `set-model` sets the session's model
6
+ * (model-switch.ts).
6
7
  */
7
8
  import { type CommandDispatcher } from "@cotal-ai/connector-core";
8
9
  import { type OpenCodeApi } from "./opencode2-http.js";
@@ -18,11 +19,15 @@ export interface Commands2Deps {
18
19
  primed(): void;
19
20
  /** Aborted when teardown begins. */
20
21
  signal: AbortSignal;
22
+ /** The model the launch pinned, absent when it pinned none. */
23
+ launchModel?: string;
21
24
  }
22
25
  export interface Commands2 {
23
26
  readonly dispatcher: CommandDispatcher;
24
27
  /** Each event the plugin's event loop reads: a list's `loaded` event ends the first list's wait. */
25
28
  event(type: string): void;
29
+ /** OpenCode's `model.request` hook named the model a primary request runs on. */
30
+ modelRan(model: string): void;
26
31
  }
27
32
  export declare function opencode2Commands(deps: Commands2Deps): Commands2;
28
33
  //# sourceMappingURL=commands2.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"commands2.d.ts","sourceRoot":"","sources":["../src/commands2.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAmD,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAInH,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAiB1E,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,WAAW,CAAC;IACjB,+DAA+D;IAC/D,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,2DAA2D;IAC3D,OAAO,IAAI,MAAM,GAAG,SAAS,CAAC;IAC9B,+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