@cotal-ai/connector-opencode 0.55.0 → 0.56.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.
@@ -0,0 +1,5 @@
1
+ /** Parses `opencode --version` output into the major protocol line: 1 (opencode-ai) or 2
2
+ * (@opencode/cli). Pure so both serve.ts (the launcher) and extension.ts (the model catalog) can
3
+ * detect the line from the same rule with no fallback for anything else. */
4
+ export declare function opencodeLine(raw: string, bin: string): 1 | 2;
5
+ //# sourceMappingURL=opencode-line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode-line.d.ts","sourceRoot":"","sources":["../src/opencode-line.ts"],"names":[],"mappings":"AAAA;;6EAE6E;AAC7E,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,CAAC,CAO5D"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * The structural subset of the OpenCode 2.x plugin context this adapter reads, declared here
3
+ * rather than imported from `@opencode/plugin` (source: `@opencode/plugin@2.0.18`
4
+ * `dist/promise/{plugin,session,tool,registration}.d.ts`). `@opencode/plugin`'s peers are
5
+ * `solid-js`, `@opentui/*` and `@opencode/theme` — a real dependency would drag those into this
6
+ * bundle for types alone, the same reason `agui-source.ts` declares its own `OpenCodePart` rather
7
+ * than importing the SDK's `Part` union. This file describes what plugin2.ts actually reads, not
8
+ * everything OpenCode 2.x may hand it.
9
+ */
10
+ /** One event off `ctx.event.subscribe`. Same shape as `GET /api/event` (measurements.md). */
11
+ export interface OpenCode2Event {
12
+ id?: string;
13
+ type: string;
14
+ data?: Record<string, unknown>;
15
+ }
16
+ export interface OpenCode2EventSubscribe {
17
+ (opts: {
18
+ signal: AbortSignal;
19
+ }): AsyncIterable<OpenCode2Event>;
20
+ }
21
+ export interface OpenCode2PromptEvent {
22
+ sessionID: string;
23
+ messageID: string;
24
+ prompt: {
25
+ text: string;
26
+ };
27
+ metadata?: unknown;
28
+ delivery?: unknown;
29
+ }
30
+ export interface OpenCode2ModelRequestEvent {
31
+ model: {
32
+ id: string;
33
+ providerID: string;
34
+ };
35
+ kind: "primary" | "title";
36
+ agent: string;
37
+ }
38
+ export interface OpenCode2ToolExecuteBeforeEvent {
39
+ tool: string;
40
+ sessionID: string;
41
+ agent: string;
42
+ messageID: string;
43
+ id: string;
44
+ input: unknown;
45
+ }
46
+ export interface OpenCode2SessionHooks {
47
+ hook(name: "prompt", fn: (e: OpenCode2PromptEvent) => void | Promise<void>): Promise<void>;
48
+ hook(name: "model.request", fn: (e: OpenCode2ModelRequestEvent) => void | Promise<void>): Promise<void>;
49
+ }
50
+ export interface OpenCode2ToolEditor {
51
+ add(def: {
52
+ name: string;
53
+ description: string;
54
+ input: unknown;
55
+ execute(input: unknown): Promise<{
56
+ content: string;
57
+ }>;
58
+ }): void;
59
+ list(): Array<{
60
+ id: string;
61
+ }>;
62
+ }
63
+ export interface OpenCode2ToolHooks {
64
+ hook(name: "execute.before", fn: (e: OpenCode2ToolExecuteBeforeEvent) => void | Promise<void>): Promise<void>;
65
+ transform(fn: (ed: OpenCode2ToolEditor) => void | Promise<void>): Promise<void>;
66
+ }
67
+ /** The 2.x `setup(context)` argument, structurally, restricted to what plugin2.ts reads. */
68
+ export interface OpenCode2Context {
69
+ session: OpenCode2SessionHooks;
70
+ tool: OpenCode2ToolHooks;
71
+ event: {
72
+ subscribe: OpenCode2EventSubscribe;
73
+ };
74
+ }
75
+ //# sourceMappingURL=opencode2-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode2-types.d.ts","sourceRoot":"","sources":["../src/opencode2-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,6FAA6F;AAC7F,MAAM,WAAW,cAAc;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;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