@open-artifact/harness-kit 0.0.0-stage → 0.14.1

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,5 @@
1
+ Open Artifact
2
+ Copyright 2026 Jim Liu 宝玉
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+ It was formerly published as baoyu-design.
package/README.md CHANGED
@@ -1,3 +1,103 @@
1
- # Temporary Holding Version
1
+ # @open-artifact/harness-kit
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The SDK an agent app uses to integrate [Open Artifact](https://github.com/JimLiu/open-artifact). It finds or starts the
4
+ local daemon, holds a Harness API connection that reconnects by itself, gives the app's agent the tools, hands comment
5
+ wakes to the app's sessions and page opens to its UI, and reports the artifacts its sessions make.
6
+
7
+ It depends only on `@open-artifact/protocol` and Node built-ins (Node 22.18+, or Electron's Node), and bundles into a
8
+ single file. The guide is [docs/integrating.md](../../docs/integrating.md); this page is the summary of the package.
9
+
10
+ ## Use
11
+
12
+ ```ts
13
+ import { createHarness } from '@open-artifact/harness-kit';
14
+
15
+ const harness = await createHarness({
16
+ harness: 'my-app', // ^[a-z0-9][a-z0-9._-]{0,40}$
17
+ agentName: 'Assistant',
18
+ commands: ['artifact'],
19
+ runtime: { dir: '/path/to/@open-artifact/cli', version: '0.14.1' }, // starts the daemon when none runs
20
+ // Give a message to a session: 'delivered' | 'resumed' | 'drafted' | 'queued' | 'failed' (the daemon keeps it),
21
+ // or { status, session }. Only the owner's words (source.from.kind === 'owner') should become a user turn.
22
+ wake: async ({ session, text, source }) => ((await myApp.deliver(session, text, source)) ? 'delivered' : 'failed'),
23
+ // Show a page in the app's own UI; return false when it was not shown.
24
+ embed: { origins: [], mode: 'view', remote: 'ask' },
25
+ allowRemote: ({ origin, type }) => myApp.confirm(`Show a ${type} page from ${origin}?`),
26
+ open: ({ embedUrl, title }) => myApp.openTab(embedUrl, title),
27
+ });
28
+
29
+ await harness.attach({ session: 's1', workspace: '/path/to/project', title: 'Chat 1' });
30
+ const tools = await harness.tools(); // the daemon's, or the bundled definitions offline
31
+ const result = await harness.call('Artifact', args, { session: 's1', workspace: '/path/to/project' });
32
+ harness.on('artifact', ({ session, artifact, change }) => myApp.card(session, artifact, change));
33
+ ```
34
+
35
+ - The connection reconnects with backoff (1 s doubling to 30 s), says hello again and attaches every session again.
36
+ - What waited in a session's inbox goes to `wake` on attach; `attach()` returns what `wake` did not take.
37
+ - A `wake` callback that throws or takes longer than `wakeTimeoutMs` (25 s) answers `failed`.
38
+ - `caps` in `hello` follow from the callbacks: `wake` only with a `wake` callback, `open` only with an `open` callback
39
+ (`{ embed, origins, remote }` with `embed`). `options.caps` adds `tools`, `library`, `wake.resume`, `wake.mode`.
40
+ - Under `embed.remote: 'ask'` (the default) a remote type's page reaches `open` only after `allowRemote` said yes.
41
+ - Check `harness.features` by name before using anything newer than the base protocol.
42
+ - `daemon: { spawn }` starts the daemon process yourself. The kit passes `{ bin, args, env, logFile }` (no
43
+ `ELECTRON_RUN_AS_NODE` in `env`) and still chooses the runtime, waits for the daemon, checks its version and tries
44
+ the next runtime; return the process (anything with `once('exit')`) so a failed one is left at once. An Electron app
45
+ with its `RunAsNode` fuse off uses `utilityProcess.fork(bin, args, { env, stdio: 'pipe' })`; type servers then run
46
+ in worker threads of the daemon
47
+ ([runtime guide](../../docs/integrating/runtime.md#electron-apps-with-the-runasnode-fuse-off)).
48
+
49
+ ## The `Harness` object
50
+
51
+ | Member | Does |
52
+ | --- | --- |
53
+ | `ready()` | connects now (starting the daemon unless `autoStart: false`) |
54
+ | `connected`, `features`, `client` | the state, the daemon's features, the raw `HarnessClient` |
55
+ | `attach`, `status`, `detach`, `rename` | sessions |
56
+ | `tools()`, `call(name, args, caller)` | the tools |
57
+ | `wrote(paths, caller)` | files the agent wrote with its own tools |
58
+ | `open(url, caller)` | shows an artifact (through your `open` when you show pages) |
59
+ | `owns(args)` | whether a tool call is about an `open-artifact://` link |
60
+ | `viewUrl(url)`, `publicUrl(url)` | the local Shell page, and the site address when published |
61
+ | `embedOrigins()` | the origins a view may load (feature `embed.origins`) |
62
+ | `shellCommand(view, command)` | a host message to a top-level view's Shell (feature `shell.command`) |
63
+ | `context(url, caller)`, `contextBlock(context)` | what the person selected on the page, as prompt text (feature `view.context`) |
64
+ | `saveThumbnail(url, jpeg)` | a thumbnail for the library |
65
+ | `installSkill({ dir, … })`, `commands()` | the skill file and the command menu (features `skill.get`, `commands.list`; rendered by the kit without them). `opens` (`host` \| `agent-browser` \| `system` \| `link`) sets how the skill tells the agent to show a page; left out, `host` when you pass `open` (the daemon's rendering and, through `harness.installSkill`, the kit's own), else a general step; the standalone helpers take it only as given ([commands and the skill](../../docs/integrating.md#commands-and-the-skill)) |
66
+ | `runtime.status()`, `runtime.update(version?)` | the runtimes on this computer and which starts; the person's yes to an update (feature `runtime.update`; `update` is `not_granted` when updates are off) |
67
+ | `on('artifact' \| 'shell' \| 'event' \| 'state', listener)` | artifact reports, Shell messages, every daemon event, the connection state |
68
+ | `close()` | closes the connection for good |
69
+
70
+ A call that needs a feature the daemon does not list throws `unsupported`, fix line `Update the Open Artifact runtime
71
+ this computer runs.`
72
+
73
+ ## Testing an adapter
74
+
75
+ `@open-artifact/harness-kit/testing` runs a fake daemon in the test process: the Harness API over a real WebSocket on
76
+ an ephemeral port, and `daemon.json` in a temporary home.
77
+
78
+ ```ts
79
+ import { startFakeDaemon } from '@open-artifact/harness-kit/testing';
80
+
81
+ const fake = await startFakeDaemon(); // the real daemon's features; [] plays an older one
82
+ const harness = await createHarness({ harness: 'my-app', home: fake.home, autoStart: false, wake });
83
+ fake.queueInbox('s1', { text: 'Make it blue', source }); // handed to wake by the next attach
84
+ await fake.wake({ session: 's1', text: 'hi' }); // { status } as the adapter answered
85
+ fake.setArtifact({ id: 'art_…', title: 'Deck' });
86
+ fake.emit({ type: 'artifacts/changed', id: 'art_…' }); // on('artifact') reports it
87
+ fake.drop(); // the adapter reconnects and attaches again
88
+ fake.calls; // every call it took, in order
89
+ await fake.close();
90
+ ```
91
+
92
+ It answers `skill.get` (the protocol's template for your caps) and `commands.list` (one entry per `types`, default
93
+ `slides`); `onSkill` and `onCommands` replace them, and `handle` answers any other method. More in
94
+ [docs/integrating/testing.md](../../docs/integrating/testing.md).
95
+
96
+ ## Entry points
97
+
98
+ - `.`: `createHarness`, `HarnessClient`, `ensureDaemon`, `readDaemon`, `api`, `isOlderVersion`, `openArtifactHome`,
99
+ the runtime choice (`selectRuntime`, `rankRuntimes`, `runtimeCandidates`, …), `remoteGate`, `contextBlock`,
100
+ `installSkill`, `renderSkill`, `commands`.
101
+ - `./testing`: `startFakeDaemon`.
102
+ - `./embed`: browser code with no Node imports, for the app's renderer: `embedArtifact` (a Shell page in an iframe or a
103
+ top-level view) and `embedLibrary` (the home page). Reference: [docs/spec/embed.md](../../docs/spec/embed.md).
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
1
  {
2
2
  "name": "@open-artifact/harness-kit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.14.1",
4
+ "description": "The SDK an agent app uses to integrate Open Artifact: find or start the local daemon, hold a Harness API connection that reconnects, register the tools, take comment wakes and page opens, and follow the artifacts its sessions make.",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./src/index.d.ts",
9
+ "default": "./src/index.js"
10
+ },
11
+ "./testing": {
12
+ "types": "./src/testing.d.ts",
13
+ "default": "./src/testing.js"
14
+ },
15
+ "./embed": {
16
+ "types": "./src/embed/index.d.ts",
17
+ "default": "./src/embed/index.js"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "files": [
22
+ "src",
23
+ "LICENSE",
24
+ "NOTICE"
25
+ ],
26
+ "dependencies": {
27
+ "@open-artifact/protocol": "0.14.1"
28
+ },
29
+ "engines": {
30
+ "node": ">=22.18"
31
+ },
32
+ "sideEffects": false,
33
+ "license": "Apache-2.0",
34
+ "author": {
35
+ "name": "Jim Liu 宝玉",
36
+ "url": "https://github.com/JimLiu"
37
+ },
38
+ "homepage": "https://github.com/JimLiu/open-artifact#readme",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/JimLiu/open-artifact.git",
42
+ "directory": "packages/harness-kit"
43
+ },
44
+ "bugs": {
45
+ "url": "https://github.com/JimLiu/open-artifact/issues"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ }
50
+ }
@@ -0,0 +1,110 @@
1
+ /**
2
+ * A Harness API connection (`/__harness`, JSON-RPC 2.0 over a WebSocket): it says hello, answers the daemon's calls,
3
+ * and when the daemon goes away it reconnects with backoff and attaches its sessions again.
4
+ *
5
+ * Uses the global `WebSocket` (Node ≥ 22, Electron's Node).
6
+ */
7
+ import { type AdapterCaps, type AdapterToDaemon, type AttachParams, type DaemonCallHandlers, type DaemonState, type HarnessEvent, type HelloParams, type HelloResult, type SessionParams, type SessionStatus, type ToolCallResult, type ToolDefinition } from '@open-artifact/protocol';
8
+ import { type EnsureDaemonOptions } from './daemon.js';
9
+ /** Connection state reported to {@link HarnessClientOptions.onState}. */
10
+ export type HarnessConnectionState = 'connected' | 'disconnected';
11
+ /** What else `hello` says besides the harness, its caps and the token. `protocols` defaults to what this kit speaks. */
12
+ export type HelloExtras = Omit<HelloParams, 'harness' | 'token' | 'caps'>;
13
+ /** Options of {@link HarnessClient}. */
14
+ export interface HarnessClientOptions {
15
+ /** The harness name said in `hello`. */
16
+ harness: string;
17
+ caps?: AdapterCaps;
18
+ /** More of `hello`: `kit`, `profile`, `runtime`, `protocols`. */
19
+ hello?: HelloExtras;
20
+ /** Answers the daemon's calls (`wake.deliver`, `host.open`, `shell.event`). */
21
+ handlers?: DaemonCallHandlers;
22
+ /** Takes events; when set, the client subscribes after connecting. */
23
+ onEvent?: (event: HarnessEvent) => void;
24
+ onState?: (state: HarnessConnectionState) => void;
25
+ /**
26
+ * Called with what `session.attach` answered when the client attached a session again after a reconnect (its
27
+ * `inbox` holds what waited for the session meanwhile).
28
+ */
29
+ onReattach?: (params: AttachParams, result: AdapterToDaemon['session.attach']['result']) => void | Promise<void>;
30
+ /** Start the daemon when none runs (default `true`). */
31
+ autoStart?: boolean;
32
+ /** Passed to {@link ensureDaemon} (and its `home` to {@link readDaemon}). */
33
+ daemon?: EnsureDaemonOptions;
34
+ /**
35
+ * Delay before reconnecting, ms: `minMs` after a drop, doubling after each failed try up to `maxMs`. Default 2 s
36
+ * each, a steady retry.
37
+ */
38
+ reconnect?: {
39
+ minMs?: number;
40
+ maxMs?: number;
41
+ };
42
+ /** Diagnostic log. */
43
+ log?: (line: string) => void;
44
+ }
45
+ /**
46
+ * A Harness API connection. It reconnects when dropped, and says hello and attaches the sessions again.
47
+ */
48
+ export declare class HarnessClient {
49
+ readonly harness: string;
50
+ /** The daemon this client talks to, once connected. */
51
+ state: DaemonState | null;
52
+ /** What the last `hello` answered (`features` is `[]` from a daemon that does not say). */
53
+ hello: HelloResult | null;
54
+ private readonly options;
55
+ private readonly pending;
56
+ private readonly attached;
57
+ private nextId;
58
+ private closed;
59
+ private subscribed;
60
+ private ready;
61
+ private ws;
62
+ private retry;
63
+ private failures;
64
+ constructor(options: HarnessClientOptions);
65
+ /** Whether the connection is up and said hello. */
66
+ get connected(): boolean;
67
+ /** The daemon's features (see `HarnessFeature`), as the last `hello` answered them. */
68
+ get features(): readonly string[];
69
+ /** Connects (once); later calls share the same attempt. */
70
+ connect(): Promise<HelloResult>;
71
+ private open;
72
+ private onClose;
73
+ /**
74
+ * Tries to connect again later, and keeps trying with backoff until it is connected or closed. The client does this
75
+ * by itself after a drop; call it after a first {@link connect} failed to keep trying in the background.
76
+ */
77
+ reconnect(): void;
78
+ private onMessage;
79
+ private send;
80
+ /** Calls a daemon method on the current connection (without connecting). */
81
+ private call;
82
+ /** Connects if needed, then calls a daemon method. */
83
+ request<M extends keyof AdapterToDaemon>(method: M, params: AdapterToDaemon[M]['params']): Promise<AdapterToDaemon[M]['result']>;
84
+ /** Turns events on or off; a reconnect keeps the choice. */
85
+ subscribe(on: boolean): Promise<void>;
86
+ /** Attaches a session; a reconnect attaches it again. Returns what waited in its inbox. */
87
+ attach(params: AttachParams): Promise<AdapterToDaemon['session.attach']['result']>;
88
+ /** The session's agent is `running` or `idle` now; a reconnect attaches it with this status. */
89
+ status(params: SessionParams & {
90
+ status: SessionStatus;
91
+ }): Promise<{
92
+ ok: true;
93
+ }>;
94
+ /** Renames a session; a reconnect attaches it with this title. */
95
+ rename(params: SessionParams & {
96
+ title: string;
97
+ }): Promise<{
98
+ ok: true;
99
+ }>;
100
+ /** Detaches a session. */
101
+ detach(params: SessionParams): Promise<{
102
+ ok: true;
103
+ }>;
104
+ /** The tool definitions. */
105
+ tools(): Promise<ToolDefinition[]>;
106
+ /** Calls a tool as `caller`. */
107
+ callTool(name: string, args: Record<string, unknown>, caller?: SessionParams): Promise<ToolCallResult>;
108
+ /** Closes the connection for good. */
109
+ close(): void;
110
+ }