@cotal-ai/connector-opencode 0.188.0 → 0.190.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.
- package/dist/agui-source.d.ts +2 -0
- package/dist/agui-source.d.ts.map +1 -1
- package/dist/commands1.d.ts +6 -0
- package/dist/commands1.d.ts.map +1 -1
- package/dist/commands2.d.ts +6 -0
- package/dist/commands2.d.ts.map +1 -1
- package/dist/extension.d.ts.map +1 -1
- package/dist/index.js +14 -14
- package/dist/options2.d.ts +47 -0
- package/dist/options2.d.ts.map +1 -0
- package/dist/plugin/docs-bundle.bin +0 -0
- package/dist/plugin/docs-index.bin +0 -0
- package/dist/plugin/index.js +45 -45
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin2.d.ts.map +1 -1
- package/dist/sent-runs.d.ts +40 -0
- package/dist/sent-runs.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The OpenCode 2.x agent's session settings on its `agent` endpoint (SPEC 13.22, `options` and
|
|
3
|
+
* `set-option`).
|
|
4
|
+
*
|
|
5
|
+
* OpenCode's mode is the session's agent. The launch installs two primary agents, `cotal` and
|
|
6
|
+
* `cotal-plan`. `cotal-plan` is a copy of `cotal`, with the same model, variant and launch options,
|
|
7
|
+
* plus a plan instruction and with edit and bash denied. Switching between them changes what the next
|
|
8
|
+
* turn may do and nothing else (measured on OpenCode 2.4.3). The seat lists one setting:
|
|
9
|
+
*
|
|
10
|
+
* - `mode`: `default` (the `cotal` agent) or `plan` (`cotal-plan`), set with
|
|
11
|
+
* `POST /api/session/:id/agent` and applying from the next turn. OpenCode answers 204 to any name,
|
|
12
|
+
* unknown ones included, and a session on an unknown agent then runs no turn at all, so the seat
|
|
13
|
+
* writes only the two names it installed. Plan only takes tools away, so it widens nothing.
|
|
14
|
+
*
|
|
15
|
+
* OpenCode reports every switch, from this seat or its terminal, as `session.agent.selected` on the
|
|
16
|
+
* event stream. Each one moves `options.seq`, and a switch to an agent the seat did not install shows
|
|
17
|
+
* as that agent's name.
|
|
18
|
+
*/
|
|
19
|
+
import { type OptionDispatcher } from "@cotal-ai/connector-core";
|
|
20
|
+
import { type OpenCodeApi } from "./opencode2-http.js";
|
|
21
|
+
/** The agents the launch installs for each mode. */
|
|
22
|
+
export declare const MODE_AGENTS: {
|
|
23
|
+
readonly default: "cotal";
|
|
24
|
+
readonly plan: "cotal-plan";
|
|
25
|
+
};
|
|
26
|
+
export type OpenCodeMode = keyof typeof MODE_AGENTS;
|
|
27
|
+
/** The plan agent's own instruction, which the launch appends to the persona the seat already sends. */
|
|
28
|
+
export declare const PLAN_PROMPT = "You are in plan mode. Read, search and discuss, and write the plan for the change, but do not edit files or run shell commands. When the plan is agreed, the owner switches you back to default mode to carry it out.";
|
|
29
|
+
/** The launch's config for the plan agent: the cotal agent with the plan instruction and with edit
|
|
30
|
+
* and bash denied. A deny on the agent wins over the launch's own permission (measured). A cotal
|
|
31
|
+
* agent whose launch options set `permission` to one action for every tool keeps that action for the
|
|
32
|
+
* rest. */
|
|
33
|
+
export declare function planAgentConfig(cotalAgent: Record<string, unknown>): Record<string, unknown>;
|
|
34
|
+
export interface OpenCodeOptionDeps {
|
|
35
|
+
api: OpenCodeApi;
|
|
36
|
+
/** The owned session, created first when there is none yet. */
|
|
37
|
+
ensureSession(): Promise<string | undefined>;
|
|
38
|
+
/** The owned session, or undefined before there is one. */
|
|
39
|
+
session(): string | undefined;
|
|
40
|
+
}
|
|
41
|
+
export interface OpenCodeOptions {
|
|
42
|
+
readonly dispatcher: OptionDispatcher;
|
|
43
|
+
/** Each event the plugin's event loop reads. */
|
|
44
|
+
event(type: string, data: Record<string, unknown>): void;
|
|
45
|
+
}
|
|
46
|
+
export declare function opencodeOptions(deps: OpenCodeOptionDeps): OpenCodeOptions;
|
|
47
|
+
//# sourceMappingURL=options2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options2.d.ts","sourceRoot":"","sources":["../src/options2.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAiB,KAAK,gBAAgB,EAAuC,MAAM,0BAA0B,CAAC;AACrH,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE1E,oDAAoD;AACpD,eAAO,MAAM,WAAW;;;CAAoD,CAAC;AAC7E,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,WAAW,CAAC;AAEpD,wGAAwG;AACxG,eAAO,MAAM,WAAW,0NACiM,CAAC;AAE1N;;;YAGY;AACZ,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAK5F;AAED,MAAM,WAAW,kBAAkB;IACjC,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;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,gDAAgD;IAChD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC1D;AAeD,wBAAgB,eAAe,CAAC,IAAI,EAAE,kBAAkB,GAAG,eAAe,CAoDzE"}
|
|
Binary file
|
|
Binary file
|