@osdlc/agent-seat 0.0.0-stage → 0.0.1-stage

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/CHANGELOG.md ADDED
@@ -0,0 +1,127 @@
1
+ # @osdlc/agent-seat
2
+
3
+ ## History before the first public release
4
+
5
+ These versions were never published. They are rebuilt from the git history.
6
+
7
+ ### [0.7.0] - 2026-10-22 (unpublished)
8
+
9
+ #### Added
10
+
11
+ - The `openWorkspace` part, `OpenWorkspaceQuery`, `OpenedWorkspace` and `ensureWorkspace`;
12
+ `JetbrainsSettings`.
13
+
14
+ #### Changed
15
+
16
+ - Breaking: the JetBrains host requires companion plugin protocol 2 and skips older plugins.
17
+
18
+ ### [0.6.5] - 2026-10-19 (unpublished)
19
+
20
+ #### Fixed
21
+
22
+ - `harnessAvailable` finds the harness binary with the same PATH lookup on every platform.
23
+
24
+ ### [0.6.4] - 2026-10-18 (unpublished)
25
+
26
+ #### Added
27
+
28
+ - `SessionRequest.wait`, `WaitRequest`, `WAIT_TIMEOUT_EXIT` and `hostCanWait`: tmux can hold a
29
+ launch until the session exits.
30
+
31
+ ### [0.6.3] - 2026-10-16 (unpublished)
32
+
33
+ #### Added
34
+
35
+ - `FindQuery.harness`: Orca delivers to the one terminal running that harness.
36
+
37
+ ### [0.6.2] - 2026-10-11 (unpublished)
38
+
39
+ #### Added
40
+
41
+ - The `close` part; `SendRequest` and `FindQuery` take `sessionId`, and hosts bind a pane to the
42
+ session id it was opened for.
43
+
44
+ ### [0.6.1] - 2026-10-11 (unpublished)
45
+
46
+ #### Added
47
+
48
+ - `SessionRequest.wrap`: run the harness under a wrapper command.
49
+
50
+ ### [0.6.0] - 2026-10-11 (unpublished)
51
+
52
+ #### Changed
53
+
54
+ - Breaking: `harnessArgv(harness, binary, prompt, ...)` and `harnessAvailable(harness, binary)`
55
+ take the binary; `SessionRequest.binary` is required; `Harness` is any tool id, validated by
56
+ `HarnessSchema`. Model, effort and launch-mode fields on `SessionRequest`.
57
+
58
+ ### [0.5.0] - 2026-10-11 (unpublished)
59
+
60
+ #### Added
61
+
62
+ - Hosts `herdr`, `otty`, `wezterm`, `vscode` and `jetbrains`; the `capture` part;
63
+ `supportsPlatform`; Claude hook settings (`claudeHookSettings`, `CLAUDE_HOOK_EVENTS`).
64
+
65
+ #### Changed
66
+
67
+ - Breaking: `Host.platforms` is required; `SendReceipt.deliveryKnown` is now `ack`, with
68
+ `uncertain`.
69
+
70
+ ### [0.4.1] - 2026-10-10 (unpublished)
71
+
72
+ #### Fixed
73
+
74
+ - Hosts read command results through the command seam's helpers; no behaviour change.
75
+
76
+ ### [0.4.0] - 2026-10-07 (unpublished)
77
+
78
+ #### Changed
79
+
80
+ - Breaking: the `session` part returns `harnessSessionId` instead of `hostSessionId`.
81
+
82
+ ### [0.3.4] - 2026-10-06 (unpublished)
83
+
84
+ #### Added
85
+
86
+ - Claude session flags: `ClaudeSessionFlagsSchema`, `claudeSessionArgv`, `claudeResumeArgv`, and
87
+ plugins and a system prompt on `SessionRequest`. An `env` entry can unset a variable.
88
+
89
+ ### [0.3.3] - 2026-10-06 (unpublished)
90
+
91
+ #### Added
92
+
93
+ - The `focus` part, `SessionRequest.env`, `withEnv` and `insideTmux`. Orca sends by terminal
94
+ handle.
95
+
96
+ ### [0.3.2] - 2026-09-28 (unpublished)
97
+
98
+ #### Added
99
+
100
+ - `makeTerminalHost`, taking a streaming runner.
101
+
102
+ ### [0.3.1] - 2026-09-28 (unpublished)
103
+
104
+ #### Added
105
+
106
+ - `walkRolloutFiles`.
107
+
108
+ ### [0.3.0] - 2026-09-28 (unpublished)
109
+
110
+ #### Changed
111
+
112
+ - Breaking: `SessionRequest.engine` is `harness`, and hosts are wrappers that run any harness; the
113
+ per-harness host names are gone. The tmux host, the `pi` harness, the `send` and `find` parts,
114
+ and `HostRegistry`, `SendReceipt` and `FoundSession`.
115
+
116
+ ### [0.2.0] - 2026-09-27 (unpublished)
117
+
118
+ #### Changed
119
+
120
+ - Breaking: the `session` part returns `{ exitCode, hostSessionId }`; `HostNameSchema`.
121
+
122
+ ### [0.1.0] - 2026-09-10 (unpublished)
123
+
124
+ #### Added
125
+
126
+ - The host contract (`Host`, `HostParts`, `requirePart`, `HostPartMissing`, `HOST_NAMES`,
127
+ `onPath`) with the `terminal`, `orca` and `cmux` hosts.
@@ -0,0 +1,44 @@
1
+ # Contributing
2
+
3
+ Thanks for your interest in this package.
4
+
5
+ ## Issues
6
+
7
+ Report bugs and ask for features in the issue tracker of the repository that
8
+ hosts this package. For a bug, include the package version, your runtime and
9
+ its version, your operating system, the host and harness, and the call and
10
+ inputs that misbehave. Report security problems privately. See
11
+ [SECURITY.md](./SECURITY.md).
12
+
13
+ ## Pull requests
14
+
15
+ Open pull requests against the repository that hosts this package. They are
16
+ reviewed and merged there.
17
+
18
+ ## Running the tests
19
+
20
+ The tests run under [Vitest](https://vitest.dev) on Node. The package lives in the pnpm workspace of
21
+ [osdlc/osdlc](https://github.com/osdlc/osdlc). Build it and the libraries it
22
+ depends on first, then run the checks from the package directory:
23
+
24
+ ```sh
25
+ pnpm --filter @osdlc/agent-seat... build
26
+ pnpm test
27
+ pnpm run typecheck
28
+ pnpm run lint
29
+ pnpm run format:check
30
+ pnpm run smoke
31
+ ```
32
+
33
+ The tests need no terminal app: every host is driven through a fake command
34
+ runner. `tests/tmux-live.test.ts` also runs against a real tmux server when
35
+ `tmux` is installed, and is skipped otherwise.
36
+
37
+ ## Code style
38
+
39
+ - TypeScript and ES modules, compiled to `dist/` by `tsc -p tsconfig.build.json`.
40
+ - A change users can see comes with a changeset (`pnpm changeset` at the
41
+ repository root).
42
+ - Prettier formats the code and oxlint checks it.
43
+ - Every subprocess goes through an injected `CommandRunner`.
44
+ - Add a test for each behaviour change or bug fix.
package/LICENSE-APACHE 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 2026 sksizer
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/LICENSE-MIT ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 sksizer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,182 @@
1
- # Temporary Holding Version
1
+ # @osdlc/agent-seat
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
+ Open an interactive coding-agent session where a person already works.
4
+
5
+ A tool that starts coding agents for a person (a task runner, a review bot,
6
+ an orchestrator) has to put each session somewhere the person can see and
7
+ answer it: a new terminal tab, a tmux session, a WezTerm pane, a VS Code
8
+ terminal. Each of those places has its own CLI or protocol, its own way to
9
+ name a pane, and its own failure modes. This package gives them one contract.
10
+
11
+ - A **host** is one place a session can open. Nine are built in: `terminal`,
12
+ `tmux`, `wezterm`, `cmux`, `herdr`, `orca`, `otty`, `vscode` and `jetbrains`.
13
+ - A **harness** is the agent CLI that runs in it: `claude`, `codex`, `cursor`,
14
+ `pi` and `opencode` have an interactive launch.
15
+ - The two are independent. Every host runs any harness, so where a session
16
+ opens and which agent runs in it are separate choices.
17
+
18
+ A host fulfils the contract in parts: open a session, run a command, send text
19
+ into an open session, find, focus, capture its screen, close it, open a
20
+ workspace. A host offers only the parts its app supports. A caller asks for the
21
+ part it needs with `requirePart` and gets a `HostPartMissing` error naming the
22
+ host and the part when it is missing, never a silent fallback to another host.
23
+
24
+ **Not for:** headless agent runs whose output a program reads (`claude -p`,
25
+ `codex exec`); use [`@osdlc/agent-call`](https://www.npmjs.com/package/@osdlc/agent-call)
26
+ for those. Not for embedding a terminal in your own UI either: a host drives
27
+ an app the person already has.
28
+
29
+ ## Install
30
+
31
+ ```sh
32
+ npm install @osdlc/agent-seat
33
+ ```
34
+
35
+ ESM only, with type declarations. Node.js 22.22.2 or later on the 22 line, 24.15.0 or
36
+ later on the 24 line, or 26 and later.
37
+
38
+ ## Quick start
39
+
40
+ ```ts
41
+ import { hostRegistry, requirePart } from '@osdlc/agent-seat'
42
+
43
+ // Hosts that remember panes keep their files under <runtimeDir>/hosts/<name>.
44
+ const hosts = hostRegistry({ runtimeDir: '/tmp/my-tool/run' })
45
+
46
+ const tmux = hosts.tmux
47
+ if (tmux.available()) {
48
+ const open = requirePart(tmux, 'session')
49
+ const { exitCode } = open({
50
+ cwd: process.cwd(),
51
+ harness: 'claude',
52
+ binary: 'claude',
53
+ prompt: 'Summarise the open TODOs in this repository.',
54
+ title: 'todo review',
55
+ sessionId: 'todo-review', // your id; later calls reach this pane by it
56
+ })
57
+ }
58
+ ```
59
+
60
+ Later, type into the same session and read it back:
61
+
62
+ ```ts
63
+ const query = { cwd: process.cwd(), sessionId: 'todo-review' }
64
+
65
+ const receipt = requirePart(tmux, 'send')({ ...query, text: 'Also check FIXME comments.' })
66
+ // { accepted: true, ack: false }: typed and submitted; tmux cannot confirm the agent read it
67
+
68
+ const screen = requirePart(tmux, 'capture')(query) // what the pane shows now
69
+ ```
70
+
71
+ `examples/readme.test.ts` and `examples/guide.test.ts` run these examples
72
+ against a recording command runner.
73
+
74
+ ## Guide
75
+
76
+ - [Getting started](./docs/guide/getting-started.md): hosts, harnesses and parts;
77
+ opening a session; choosing a host.
78
+ - [Working with open sessions](./docs/guide/sessions.md): send, find, focus,
79
+ capture and close, and what a send receipt means.
80
+ - [Hosts](./docs/guide/hosts.md): what each host needs and how it behaves.
81
+ - [Testing](./docs/guide/testing.md): fake command runners and fake hosts.
82
+
83
+ Why the package has the shape it has, and the research on each host app, are in
84
+ [docs/planning/](./docs/planning/README.md).
85
+
86
+ ## Hosts
87
+
88
+ | Host | Platforms | Needs | Parts beyond `session` and `terminal` |
89
+ |---|---|---|---|
90
+ | `terminal` | all | nothing; runs in the caller's own terminal and blocks until the session exits | none |
91
+ | `tmux` | macOS, Linux | `tmux` on `PATH` | send, find, focus, capture, close; can wait for the session to exit |
92
+ | `wezterm` | all | `wezterm` on `PATH` and a running WezTerm | send, find, focus, capture, close |
93
+ | `cmux` | macOS | the cmux app and its CLI | send, find, focus, capture, close |
94
+ | `herdr` | macOS, Linux | `herdr` on `PATH` | send, find, focus, capture, close |
95
+ | `orca` | macOS | the Orca app (its bundled CLI is found) | send, find, focus, close |
96
+ | `otty` | macOS | the otty app and its CLI | send, find, focus, capture, close |
97
+ | `vscode` | all | a VS Code, Cursor or Windsurf window with the `sdlc-host` extension | send, find, focus, close |
98
+ | `jetbrains` | macOS | a JetBrains IDE with the companion plugin, and `curl` | send, find, focus, open workspace |
99
+
100
+ `host.platforms` and `supportsPlatform(host)` say where a host runs;
101
+ `available()` says whether it can open a session right now.
102
+
103
+ The `vscode` and `jetbrains` hosts talk to a companion extension or plugin
104
+ over a local socket or loopback HTTP. The companions are not published yet, so
105
+ outside the project that builds them these two hosts report themselves
106
+ unavailable.
107
+
108
+ ## Sessions, panes and state
109
+
110
+ A launch can carry a session id (`SessionRequest.sessionId`). A host binds
111
+ the pane it opens to that id, so a later `send`, `find`, `focus`, `capture` or
112
+ `close` reaches that pane even when another session shares the working
113
+ directory. Hosts that cannot name a pane by itself remember the binding in a
114
+ file under `<runtimeDir>/hosts/<name>/sessions/`; the VS Code and JetBrains
115
+ companions register their windows under `<runtimeDir>/hosts/<name>/`. Pass the
116
+ same `runtimeDir` to every process that should see the same sessions.
117
+
118
+ Each stateful host factory (`makeOrcaHost`, `makeHerdrHost`, `makeWeztermHost`,
119
+ `makeVscodeHost`, `makeJetbrainsHost`) takes `runtimeDir`, or `registryDir`
120
+ for the host's own directory.
121
+
122
+ ## Harnesses
123
+
124
+ `harnessArgv(harness, binary, prompt, claudeFlags?, choice?)` builds the argv
125
+ for an interactive launch: the bare CLI with the first message, plus the model
126
+ and effort flags of a resolved `choice`. `harnessAvailable(harness, binary)` asks
127
+ whether `binary` is on PATH. `claudeSessionArgv` and `claudeHookSettings` build
128
+ the Claude Code flags a session can carry (plugins, a system prompt, hook
129
+ settings). `findCodexSessionId` finds the id of a codex session from its
130
+ rollout file.
131
+
132
+ ## Compared with other tools
133
+
134
+ | Tool | Difference |
135
+ |---|---|
136
+ | [`@osdlc/agent-call`](https://www.npmjs.com/package/@osdlc/agent-call) | Runs an agent headless and returns its output to your program. This package opens a session a person sees and can answer. |
137
+ | `pi-terminal-mux` | One API over terminal multiplexers (tmux, zellij, WezTerm, herdr, cmux, otty, Orca). No caller's own terminal, no editors, no find, focus or open-workspace, and no notion of which agent runs where. |
138
+ | tmux wrappers (`node-tmux`, `libtmux`) | One multiplexer only. |
139
+ | Agent managers (claude-squad, ccmanager, uzi) | Applications with their own UI, mostly tmux-only, not libraries. |
140
+ | `node-pty` | Embeds a terminal in your own process. This package drives an app the person already has open. |
141
+
142
+ ## Shell-outs
143
+
144
+ Every host runs its app's CLI through an injectable
145
+ [`@osdlc/command-seam`](https://www.npmjs.com/package/@osdlc/command-seam)
146
+ `CommandRunner` (the `runner` option), never through a shell string, so a test
147
+ can replace the app with a recording fake.
148
+
149
+ ## API
150
+
151
+ The package entry exports the host contract (`Host`, `HostParts`,
152
+ `requirePart`, `HostPartMissing`, `supportsPlatform`, `HOST_NAMES`), one
153
+ factory per host, `hostRegistry`, the harness argv builders and
154
+ `ensureWorkspace`. Each export carries TSDoc; the [guide](#guide) shows them in
155
+ use.
156
+
157
+ ## Stability
158
+
159
+ The package is at 0.x: a minor release may change any item. The items below are
160
+ experimental as well: they may change or go away in any release, and their TSDoc
161
+ says why.
162
+
163
+ - Hosts that need a companion that is not published yet: `makeVscodeHost`,
164
+ `makeJetbrainsHost`, `JetbrainsSettings`, `JETBRAINS_PROTOCOL`,
165
+ `liveWindows`, `subprocessTransport`, `VscodeWindow`, `VscodeReply`,
166
+ `VscodeTransport`.
167
+ - tmux attach helpers, to be replaced by an `attach` part: `tmuxSessionName`,
168
+ `tmuxIdSessionName`, `tmuxAttachArgv`, `tmuxSwitchClientArgv`, `insideTmux`.
169
+ - `hostCanWait`, to become a declaration on the host.
170
+
171
+ ## Known limits
172
+
173
+ - Windows: not yet run on Windows. Env overrides (`withEnv`) and hosts that hand
174
+ a terminal one command line go through Windows PowerShell 5.1, which passes
175
+ an argument containing `"` to the program without escaping it and drops an
176
+ empty argument; `powershell -Command` also reports the program's exit code
177
+ only as 0 or 1.
178
+
179
+ ## Licence
180
+
181
+ `MIT OR Apache-2.0`, at your option. See [LICENSE-MIT](./LICENSE-MIT) and
182
+ [LICENSE-APACHE](./LICENSE-APACHE).
package/SECURITY.md ADDED
@@ -0,0 +1,41 @@
1
+ # Security policy
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ Please report vulnerabilities privately. Do not open a public issue.
6
+
7
+ Use GitHub private vulnerability reporting on the repository that hosts this
8
+ package: open its Security tab and choose "Report a vulnerability".
9
+
10
+ Include the version, a short description, and steps to reproduce. A minimal
11
+ code sample helps.
12
+
13
+ ## Supported versions
14
+
15
+ Only the latest release gets security fixes. While the version is 0.x, that
16
+ is the latest minor release. Upgrade to it.
17
+
18
+ ## What this package runs
19
+
20
+ - Each host runs its app's CLI (`tmux`, `wezterm`, `cmux`, `herdr`, `orca`,
21
+ `otty`, `curl`) as an argument vector through the command runner it is
22
+ given. No shell parses the arguments, except where a host must hand one
23
+ command line to a terminal app; that line is quoted for the target shell
24
+ (POSIX `sh`, or PowerShell on Windows).
25
+ - The text a caller sends into a session (`send`) is typed into that session as
26
+ is. The agent there reads it as a person's input.
27
+ - The `vscode` and `jetbrains` hosts read registry files under the caller's
28
+ `runtimeDir` and talk to the window or IDE named there, on a local socket or
29
+ on `127.0.0.1`, with the per-window token from that file. They send that
30
+ window each session's command line (environment values included) and the
31
+ text sent into it. `runtimeDir` must be private to the user (mode `0700`).
32
+ On POSIX a registry directory or file that another user owns, or that its
33
+ group or others can write, is ignored; the JetBrains host names it among the
34
+ IDEs it skipped. Windows has no such check.
35
+ - Pane bindings are written under `<runtimeDir>/hosts/<name>/sessions/`.
36
+
37
+ ## What to expect
38
+
39
+ This is a small project. We aim to reply within a week. We will tell you
40
+ whether we accept the report and keep you updated until a fix is released.
41
+ We will credit you in the release notes if you want that.