@volter/supercode-terminal 0.2.30
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/CAPABILITIES.md +57 -0
- package/LICENSE-SUBSTRATE +201 -0
- package/NOTICE-SUBSTRATE +14 -0
- package/README.md +190 -0
- package/client.d.ts +17 -0
- package/client.mjs +32 -0
- package/index.d.ts +195 -0
- package/index.mjs +981 -0
- package/package.json +156 -0
- package/react/stream.d.ts +3 -0
- package/react/stream.mjs +446 -0
- package/react/ui.d.ts +136 -0
- package/react/ui.mjs +892 -0
- package/stream.d.ts +3 -0
- package/stream.mjs +446 -0
- package/styles.css +160 -0
- package/substrate/attach.d.ts +29 -0
- package/substrate/attach.js +147 -0
- package/substrate/client.d.ts +62 -0
- package/substrate/client.js +138 -0
- package/substrate/docker-exec.d.ts +41 -0
- package/substrate/docker-exec.js +101 -0
- package/substrate/internal/exec.d.ts +15 -0
- package/substrate/internal/exec.js +192 -0
- package/substrate/internal/process-tree.d.ts +1 -0
- package/substrate/internal/process-tree.js +41 -0
- package/substrate/local-terminal.d.ts +13 -0
- package/substrate/local-terminal.js +41 -0
- package/substrate/native-host.d.ts +57 -0
- package/substrate/native-host.js +529 -0
- package/substrate/session-lifecycle.d.ts +162 -0
- package/substrate/session-lifecycle.js +1344 -0
- package/substrate/session-roll.d.ts +14 -0
- package/substrate/session-roll.js +407 -0
- package/substrate/tmux-stream.d.ts +32 -0
- package/substrate/tmux-stream.js +212 -0
- package/substrate/tmux.d.ts +144 -0
- package/substrate/tmux.js +899 -0
- package/ui.d.ts +136 -0
- package/ui.mjs +892 -0
package/CAPABILITIES.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Terminal capability contract
|
|
2
|
+
|
|
3
|
+
This package aims for the terminal-client workflows people rely on in iTerm2, not a claim that a
|
|
4
|
+
browser frame is macOS iTerm2. Every row is assigned to one of four owners so browser products can
|
|
5
|
+
compose the package without duplicating or pretending to own behavior.
|
|
6
|
+
|
|
7
|
+
- **UI** — reusable behavior supplied here.
|
|
8
|
+
- **tmux** — durable terminal behavior supplied by this package's shared substrate and tmux.
|
|
9
|
+
- **host** — browser/extension policy that must be supplied by the embedding product.
|
|
10
|
+
- **excluded** — platform-specific iTerm2 functionality that does not belong in a Volter Harness glue UI.
|
|
11
|
+
|
|
12
|
+
`verified` means the behavior executes today. `partial` names the remaining residue. `missing`
|
|
13
|
+
means it must not be presented as supported.
|
|
14
|
+
|
|
15
|
+
| Capability family | Owner | State | Contract / residue |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| Native Claude `/clear` identity rollover | host substrate | verified | Bounded transcript-edge evidence shared across iTerm and Terminal; ambiguous/claimed successors refused, chain history retained, stale mappings revoked. Controlled native-command tests; arbitrary interior transcript rewrites are not guaranteed. |
|
|
18
|
+
| VT screen, alternate screen, color, mouse reporting, IME | UI/xterm | verified | xterm.js is the emulator; the package does not reinterpret terminal bytes. |
|
|
19
|
+
| Unicode, emoji, CJK and IME input | UI/xterm | verified | Supplied by stable xterm.js behavior. Experimental grapheme clustering is not enabled by default. |
|
|
20
|
+
| Tabs and instant switching | UI | verified | Open viewers stay mounted; switching does not reconnect or replay output. |
|
|
21
|
+
| New, attach, detach, stop, open in local terminal | UI/tmux | verified | Detach never stops tmux. Stop remains explicit and ownership-gated. |
|
|
22
|
+
| Browser-safe shortcuts and discovery | UI | verified | Option/Alt+Shift namespace only; browser Command/Ctrl bindings are never claimed. |
|
|
23
|
+
| Scrollback, selection and copy | UI/xterm | verified | Bounded scrollback and native xterm selection. |
|
|
24
|
+
| Find in one terminal, next/previous match | UI | verified | Search covers the active xterm buffer. Cross-tab search is missing. |
|
|
25
|
+
| URL detection | UI | partial | The stable xterm web-link provider is active; host policy and end-to-end link opening still need a dedicated proof. |
|
|
26
|
+
| Paste and bracketed paste | UI | verified | Multiline or large pastes require confirmation; history is memory-only. Advanced transforms and slow paste are missing. |
|
|
27
|
+
| Save terminal contents | UI | partial | The normal buffer is projected to a bounded plain-text download; the browser download boundary and continuous logging still need dedicated proof. |
|
|
28
|
+
| Bell and background activity | UI | verified | A controlled tmux shell proved active visual bell plus inactive activity/bell tab state. System notifications are host policy. |
|
|
29
|
+
| Dynamic terminal title | UI/tmux | partial | Direct xterm title events are wired, but OSC titles do not currently survive the tmux attachment path. |
|
|
30
|
+
| Durable process survival and reconnect | tmux | verified | The tmux session outlives the viewer; a disconnected viewer can request a fresh grant. |
|
|
31
|
+
| New-session conversation recovery | host/tmux | verified | A bounded ten-minute ledger binds only one unambiguous new native descriptor by harness, workspace, first user prompt, and pre-launch catalog baseline. |
|
|
32
|
+
| Read-only mirroring without terminal reflow | tmux | verified | Observers inherit the pane's live dimensions and cannot send input. |
|
|
33
|
+
| Live PTY resize | UI/tmux | verified | Control attachments refit and send bounded resize frames; an isolated real tmux proof resized the PTY to 113×37. Observers never resize. |
|
|
34
|
+
| Split panes and draggable layout | UI/tmux | missing | tmux may contain panes, but this UI cannot create, address, or arrange them yet. |
|
|
35
|
+
| Window/pane dashboard and rename/reorder | UI/tmux | partial | Sessions are listed and tabs can be selected; windows, panes, rename, and drag reorder are missing. |
|
|
36
|
+
| Workspace/layout restoration | UI/host | missing | tmux preserves jobs, but open tabs, active tab, layout, and scrollback are not restored after the UI is destroyed. |
|
|
37
|
+
| Profiles, themes, fonts, cursor, scrollback settings | UI/host | missing | The default is tokenized, but there is no user profile model or settings surface yet. |
|
|
38
|
+
| Transparent embeddable surface | UI/host | verified | Shell and xterm layers preserve alpha; one tokenized backing layer prevents nested opacity from compounding. |
|
|
39
|
+
| Fit versus simulated viewport | UI/host | partial | The workspace exposes an explicit scale/fit policy and control attachments reflow in fit mode. Embedding hosts must supply the two presentation geometries and prove their boundary. |
|
|
40
|
+
| Font zoom, fullscreen and popout | host | missing | These alter host geometry or profile settings and require explicit embedding-host commands. |
|
|
41
|
+
| Search across tabs / terminal Exposé | UI | missing | Per-terminal search exists; no workspace-wide result navigator exists. |
|
|
42
|
+
| Command history, recent directories, prompt navigation | host/shell integration | missing | Requires a shell-integration event model rather than scraping rendered text. |
|
|
43
|
+
| Smart file/path selection and semantic history | UI/host | missing | URLs work. Files, line numbers, command URLs, and host open policy are not modeled. |
|
|
44
|
+
| Notifications for bell, activity, idle, exit, job completion | host | partial | UI events exist; browser notification permission and agent-status policy belong to the host. |
|
|
45
|
+
| Broadcast input | UI/tmux | missing | Must include an unmistakable armed state and explicit target scope before shipping. |
|
|
46
|
+
| Triggers, captured output, annotations, badges | host | missing | Requires a declarative event/action layer; never infer these from fragile DOM text. |
|
|
47
|
+
| Inline images / sixel / iTerm image protocol | UI/xterm | missing | xterm has an image addon, but it is not loaded or validated here. |
|
|
48
|
+
| Paste history persistence, password manager, secure keyboard entry | host/platform | partial | Paste history is deliberately memory-only. Secrets and secure input require native host policy. |
|
|
49
|
+
| Save/restore arrangements, undo close, instant replay | UI/host | missing | No layout journal or serialized screen timeline exists yet. |
|
|
50
|
+
| Dynamic profiles, Python/AppleScript API, coprocesses | excluded | excluded | These are iTerm2 automation/platform features, not Volter Harness's cross-harness glue role. |
|
|
51
|
+
| Touch Bar, native menu bar, macOS window transparency | excluded | excluded | A browser overlay uses browser/Widget Shell equivalents. |
|
|
52
|
+
| iTerm web browser and AI Chat | excluded | excluded | Vibewaiting already supplies browser context and semantic agent chat; duplicating them in the terminal package is out of scope. |
|
|
53
|
+
|
|
54
|
+
The next parity gates are ordered by user impact: live resize and pane addressing; restorable
|
|
55
|
+
workspace state; profiles/settings and explicit zoom/popout; cross-tab search and semantic shell
|
|
56
|
+
events; logging/replay and guarded broadcast input. A feature remains `missing` until its real
|
|
57
|
+
boundary is exercised—dependency presence or registry wiring is not proof.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 termfleet contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE-SUBSTRATE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
The terminal substrate in src/substrate/ and its compiled substrate/ outputs
|
|
2
|
+
was originally moved without runtime changes from @termfleet/terminal, authored
|
|
3
|
+
by Volter AI, and is now maintained in this package.
|
|
4
|
+
Original source: https://github.com/volter-ai/termfleet
|
|
5
|
+
Source revision: d6b28d9866a5efee5a8ba698fb47ccf8232b299d
|
|
6
|
+
|
|
7
|
+
These files remain licensed under Apache License 2.0; see LICENSE-SUBSTRATE.
|
|
8
|
+
The session-roll implementation and its reference invariants were adapted from
|
|
9
|
+
Termfleet core agent-session-roll at 089d58c48e34c609a31dfa8ce8f7111b6dff90c0,
|
|
10
|
+
also authored by Volter AI; subsequent native integration is owned here.
|
|
11
|
+
The containing package's alternative MIT license does not relicense this code.
|
|
12
|
+
|
|
13
|
+
Existing .termfleet paths, environment variables, tmux ownership markers, and
|
|
14
|
+
public wire names are compatibility contracts and are intentionally retained.
|
package/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# `@volter/supercode-terminal`
|
|
2
|
+
|
|
3
|
+
## Native Claude rollover evidence
|
|
4
|
+
|
|
5
|
+
`NativeTerminalSessionHost` (also used by `SupercodeTerminalController`) follows
|
|
6
|
+
Claude `/clear` transcript successors while the process keeps its original argv
|
|
7
|
+
session ID. iTerm and Terminal observations share one ownership batch. Ambiguous
|
|
8
|
+
co-located predecessors and successors claimed by another pane are not adopted;
|
|
9
|
+
later predecessor activity or a missing successor revokes the mapping.
|
|
10
|
+
|
|
11
|
+
The rollover store defaults to `CLAUDE_CONFIG_DIR`, then `~/.claude`. An explicit
|
|
12
|
+
`nativeHost.home` isolates discovery to that home's `.claude`; an explicit
|
|
13
|
+
`nativeHost.claudeConfigDir` takes precedence. Both rollover evidence and the
|
|
14
|
+
existing PID-only Claude fallback use this same native store.
|
|
15
|
+
|
|
16
|
+
Embedders can gather the same evidence with `createSessionRollTracker` from the
|
|
17
|
+
existing `./substrate/session-lifecycle.js` export and supply its map as
|
|
18
|
+
`ObserveIo.sessionRolls` (or pass the tracker to `gatherLifecycleObservation`).
|
|
19
|
+
|
|
20
|
+
Evidence is asynchronous: 16 KiB transcript head/tail reads, a 50-entry head
|
|
21
|
+
inspection bound, 500-entry edge caches, and a 15-second successor-scan cadence.
|
|
22
|
+
Directory enumeration still scales with the native project inventory. No new
|
|
23
|
+
watcher, timer, subprocess, transcript copy, or persistent state is introduced.
|
|
24
|
+
Closed-pane chains are pruned; over-capacity evidence fails closed. These are
|
|
25
|
+
conservative append-oriented observations, not proof of arbitrary interior
|
|
26
|
+
transcript rewrites. Native routing tests use isolated command fixtures, not
|
|
27
|
+
live user terminals.
|
|
28
|
+
|
|
29
|
+
## Overview
|
|
30
|
+
|
|
31
|
+
Optional terminal/tmux hosting for Volter Harness frontends. It complements
|
|
32
|
+
Volter Harness's semantic transcript and runtime APIs with the familiar live terminal
|
|
33
|
+
screen; it does not turn terminal bytes into canonical conversation history.
|
|
34
|
+
|
|
35
|
+
This package owns the shared terminal substrate. `src/substrate/` is its source;
|
|
36
|
+
`substrate/` contains the compiled runtime and declarations. The existing host,
|
|
37
|
+
controller, and browser client consume these modules directly, without a
|
|
38
|
+
the fleet tool package dependency. Advanced hosts and legacy adapters may import
|
|
39
|
+
`/substrate/attach.js`, `/substrate/client.js`, `/substrate/local-terminal.js`,
|
|
40
|
+
`/substrate/native-host.js`, `/substrate/session-lifecycle.js`,
|
|
41
|
+
`/substrate/tmux-stream.js`, and `/substrate/tmux.js`; the two internal helper
|
|
42
|
+
subpaths are exported only for compatibility. Prefer the controller/client APIs
|
|
43
|
+
above this layer for new applications.
|
|
44
|
+
|
|
45
|
+
The substrate was moved from a retired package without behavioral changes.
|
|
46
|
+
Its existing home paths, environment variables, and tmux ownership markers stay
|
|
47
|
+
compatible. Those files retain Apache-2.0 licensing; see `NOTICE-SUBSTRATE` and
|
|
48
|
+
`LICENSE-SUBSTRATE`.
|
|
49
|
+
|
|
50
|
+
The server-side `TmuxTerminalHost` can discover existing tmux sessions, create a
|
|
51
|
+
session from a structured command, capture its display, submit input to a
|
|
52
|
+
session it owns, prepare a local `tmux
|
|
53
|
+
attach-session` launch, open that launch through the trusted local-terminal
|
|
54
|
+
adapter, and issue a one-use embedded attachment grant. Existing
|
|
55
|
+
sessions are read-only by default. Control and close are allowed only for
|
|
56
|
+
sessions bearing this host's ownership mark unless the embedding host explicitly
|
|
57
|
+
opts into unowned control.
|
|
58
|
+
|
|
59
|
+
Most Volter Harness frontends should use `SupercodeTerminalController`, which composes that low-level
|
|
60
|
+
host with the loopback bridge, persistent context recovery, native Claude Code/Codex handoff, and
|
|
61
|
+
harness-aware initial-input delivery. The embedding product supplies allowed browser origins and
|
|
62
|
+
optional display-path formatting; it should not create a second terminal registry or scrape agent
|
|
63
|
+
prompts itself. `TmuxTerminalHost` remains public for applications that deliberately need only the
|
|
64
|
+
lower-level primitive.
|
|
65
|
+
|
|
66
|
+
An embedding host may pass an opaque `contextKey` when it creates a session.
|
|
67
|
+
The host stores that association in a namespaced tmux user option and returns it
|
|
68
|
+
with future catalog reads, so a semantic conversation can recover its terminal
|
|
69
|
+
after the browser or native bridge restarts. The value is application-defined;
|
|
70
|
+
native harness session ids, tmux targets, sockets, and process handles should
|
|
71
|
+
never be used as context keys.
|
|
72
|
+
|
|
73
|
+
For a brand-new interactive launch, the native session does not exist when tmux is created.
|
|
74
|
+
`conversationDiscovery` records the pre-launch opaque catalog keys and first user prompt;
|
|
75
|
+
`reconcileConversationBindings` later binds the terminal only when exactly one new descriptor has
|
|
76
|
+
the same harness, workspace, and user prompt. Ambiguous matches remain unbound. This recovery
|
|
77
|
+
state is bounded, expires after ten minutes, and never exposes a tmux target to the product.
|
|
78
|
+
|
|
79
|
+
Browser and extension hosts can pair it with `TerminalWebSocketBridge`, which binds an ephemeral
|
|
80
|
+
loopback port, requires an exact configured origin on every WebSocket upgrade, and accepts only
|
|
81
|
+
one-use attachment grants. The embedding product supplies its allowed origin and never handles a
|
|
82
|
+
tmux socket or target. `normalizeTerminalUiState` performs the matching untrusted-wire projection
|
|
83
|
+
before state reaches the reusable terminal components.
|
|
84
|
+
|
|
85
|
+
Browser code imports `@volter/supercode-terminal/client`. It contains only
|
|
86
|
+
the terminal WebSocket client and protocol types; it never imports tmux,
|
|
87
|
+
`node-pty`, filesystem, or process APIs.
|
|
88
|
+
|
|
89
|
+
Frontends that want the default terminal experience can import the optional
|
|
90
|
+
Preact components from `@volter/supercode-terminal/ui` and its tokenized
|
|
91
|
+
stylesheet from `@volter/supercode-terminal/ui/styles.css`. `TerminalWorkspace`
|
|
92
|
+
is the terminal-app surface: retained live tabs, one-click session attachment,
|
|
93
|
+
keyboard tab switching, direct terminal focus, connection state, and separate detach/open/stop
|
|
94
|
+
actions. `TerminalPanel`, `TerminalViewer`, and `TerminalPath` remain independently reusable for
|
|
95
|
+
constrained hosts. The surfaces take
|
|
96
|
+
callbacks rather than a transport implementation, so a host can map its own
|
|
97
|
+
validated intents without exposing native handles. The heavy xterm runtime is a
|
|
98
|
+
dynamic import and is loaded only when a viewer is actually opened.
|
|
99
|
+
|
|
100
|
+
The workspace deliberately leaves browser-owned Command/Ctrl shortcuts alone. While it has focus,
|
|
101
|
+
its default namespace is Option/Alt+Shift: `T` opens the session menu, `D` detaches the active tab,
|
|
102
|
+
digits 1–9 select tabs, and brackets rotate between tabs.
|
|
103
|
+
|
|
104
|
+
Hosts with both a fixed simulated viewport and a responsive viewport can pass `viewportMode` and
|
|
105
|
+
`onViewportModeChange`. The workspace then exposes one compact scale/fit control for writable
|
|
106
|
+
attachments; read-only mirrors never offer a control that could reflow the source pane. The full,
|
|
107
|
+
evidence-scoped parity boundary is recorded in [CAPABILITIES.md](CAPABILITIES.md).
|
|
108
|
+
|
|
109
|
+
The terminal canvas and internal layout layers are transparent over one
|
|
110
|
+
`--sctui-terminal-background` backing layer (the Volter brand's `surface.media` by default). Embedders
|
|
111
|
+
can set that token to any valid transparent or opaque CSS color without forking the component; the
|
|
112
|
+
color is intentionally applied once so nested alpha does not compound back into an opaque card.
|
|
113
|
+
|
|
114
|
+
Colours and fonts default to the [Volter brand's roles](https://brand.volter.ai/tokens), read as
|
|
115
|
+
`var(--volter-<role>, <brand value>)`: a host that sets `--volter-*` (the brand's `tokens.css`)
|
|
116
|
+
governs them, and `--sctui-*` or `--scui-*` overrides the one it sets. The terminal is a dark media
|
|
117
|
+
surface in either page scheme, so its inks (the ANSI palette, foreground, cursor and the viewer's
|
|
118
|
+
own controls) use the brand's dark values. `styles.css` is generated from `src/styles.css`, which
|
|
119
|
+
names each role as `brand(<role>)`; `npm run build` resolves them.
|
|
120
|
+
|
|
121
|
+
Safety properties:
|
|
122
|
+
|
|
123
|
+
- browser actions use opaque catalog ids rather than tmux targets;
|
|
124
|
+
- embedded attachment grants are random, short-lived, and consumed once;
|
|
125
|
+
- the tmux socket and session target never appear in an embedded grant;
|
|
126
|
+
- detaching disposes the ephemeral PTY/WebSocket resources but cannot stop the
|
|
127
|
+
durable tmux session;
|
|
128
|
+
- closing is a separate explicit operation and checks the ownership mark;
|
|
129
|
+
- structured commands and argument arrays are passed without shell-string
|
|
130
|
+
construction.
|
|
131
|
+
|
|
132
|
+
## Use the xterm UI with a browser runtime
|
|
133
|
+
|
|
134
|
+
The optional `/stream` and `/react/stream` entries export `TerminalStreamViewer`.
|
|
135
|
+
They use the same search, links, paste controls, download, status, and keyboard
|
|
136
|
+
behavior as `TerminalViewer`, with a caller-supplied connector instead of a
|
|
137
|
+
WebSocket. Import `/ui/styles.css` and `@xterm/xterm/css/xterm.css`; install the
|
|
138
|
+
xterm, fit, search, and web-links peer packages for this surface.
|
|
139
|
+
|
|
140
|
+
```jsx
|
|
141
|
+
<TerminalStreamViewer
|
|
142
|
+
attachment={{ id: 'workspace-shell', sessionId: 'workspace', baseUrl: '', mode: 'control' }}
|
|
143
|
+
connect={(attachment, events, { cols, rows }) => {
|
|
144
|
+
// Subscribe to process output, report readiness with events.onOpen(),
|
|
145
|
+
// forward output through events.onOutput(data), and report exit/close.
|
|
146
|
+
return { write, resize, close: unsubscribe };
|
|
147
|
+
}}
|
|
148
|
+
convertEol={true}
|
|
149
|
+
onReady={({ focus }) => { /* retain focus for the host's terminal tab */ }}
|
|
150
|
+
/>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
`connect` returns synchronously and must keep its function identity stable for
|
|
154
|
+
one attachment. Unmount closes the attachment; the host retains ownership of
|
|
155
|
+
process termination. Use `convertEol` for streams without PTY newline processing;
|
|
156
|
+
the default preserves terminal bytes. Theme foreground and cursor through
|
|
157
|
+
`--sctui-terminal-foreground` and `--sctui-terminal-cursor`, and the ANSI palette through
|
|
158
|
+
`--sctui-terminal-black`, `-red`, `-green`, `-yellow`, `-blue`, `-magenta`, `-cyan`, `-white` and
|
|
159
|
+
their `-bright-*` forms (defaults: the brand's `terminal.*` roles). xterm reads the resolved colours
|
|
160
|
+
when the viewer mounts. `/stream` does not
|
|
161
|
+
load the tmux or WebSocket implementation. Existing `TerminalViewer` consumers
|
|
162
|
+
keep the default WebSocket connector, also exported as `/client`'s
|
|
163
|
+
`connectTerminal`.
|
|
164
|
+
|
|
165
|
+
## Shells over a Docker exec wire
|
|
166
|
+
|
|
167
|
+
`/docker-exec` exports `dockerExecTerminal`, a controller for an environment that
|
|
168
|
+
offers Docker's Engine API and no session service: a container, a Conduit
|
|
169
|
+
`docker/engine-api` binding, or a browser tab's container. Each New terminal is
|
|
170
|
+
an exec of `sh` with a TTY. The controller holds the exec's stream and a bounded
|
|
171
|
+
buffer of its output, so a view that detaches leaves its shell running and one
|
|
172
|
+
that attaches replays the newest output. `stop` ends a shell or dismisses one
|
|
173
|
+
that exited. Nothing outlives the page: Docker offers no way back into an exec's
|
|
174
|
+
stream once its socket closes, so say so where the shells are listed.
|
|
175
|
+
|
|
176
|
+
```js
|
|
177
|
+
import { dockerExecTerminal } from '@volter/supercode-terminal/docker-exec';
|
|
178
|
+
|
|
179
|
+
const shells = dockerExecTerminal({
|
|
180
|
+
base: 'https://agent.example/v1.51', containerId,
|
|
181
|
+
headers: { authorization: `Bearer ${token}` },
|
|
182
|
+
// in a tab, the page's own socket onto the exec's stream
|
|
183
|
+
socket: (url) => daemon.socket(url),
|
|
184
|
+
});
|
|
185
|
+
// shells.getState() and shells.subscribe() feed TerminalWorkspace;
|
|
186
|
+
// shells.connector is the viewer's `connect`.
|
|
187
|
+
const id = await shells.create();
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
It loads neither xterm nor a UI framework.
|
package/client.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export {
|
|
2
|
+
directTerminalUrlResolver,
|
|
3
|
+
TerminalClient,
|
|
4
|
+
webSocketBaseUrl,
|
|
5
|
+
} from './substrate/client.js';
|
|
6
|
+
export type {
|
|
7
|
+
TerminalClientOptions,
|
|
8
|
+
TerminalErrorMessage,
|
|
9
|
+
TerminalExitMessage,
|
|
10
|
+
TerminalHelloMessage,
|
|
11
|
+
TerminalInputRejectedMessage,
|
|
12
|
+
TerminalMessage,
|
|
13
|
+
TerminalOutputMessage,
|
|
14
|
+
TerminalUrlResolver,
|
|
15
|
+
} from './substrate/client.js';
|
|
16
|
+
|
|
17
|
+
export const connectTerminal: import('./ui.js').TerminalConnector;
|
package/client.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export {
|
|
2
|
+
directTerminalUrlResolver,
|
|
3
|
+
TerminalClient,
|
|
4
|
+
webSocketBaseUrl,
|
|
5
|
+
} from './substrate/client.js';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
import { TerminalClient } from './substrate/client.js';
|
|
9
|
+
|
|
10
|
+
/** The default connector; local runtimes may supply the same callback contract. */
|
|
11
|
+
export function connectTerminal(attachment, handlers, size) {
|
|
12
|
+
const client = new TerminalClient({ baseUrl: attachment.baseUrl, terminalId: attachment.id,
|
|
13
|
+
...(attachment.mode === 'control' ? size : {}) });
|
|
14
|
+
const socket = client.connect();
|
|
15
|
+
socket.onopen = () => handlers.onOpen();
|
|
16
|
+
socket.onmessage = (event) => {
|
|
17
|
+
try {
|
|
18
|
+
const message = client.parse(String(event.data));
|
|
19
|
+
if (message.type === 'output') handlers.onOutput(message.data);
|
|
20
|
+
else if (message.type === 'hello') handlers.onResize(message.cols, message.rows);
|
|
21
|
+
else if (message.type === 'error' || message.type === 'input-rejected') handlers.onError(message.message);
|
|
22
|
+
else if (message.type === 'exit') handlers.onExit();
|
|
23
|
+
} catch (error) { handlers.onError(error instanceof Error ? error.message : 'Terminal stream failed'); }
|
|
24
|
+
};
|
|
25
|
+
socket.onerror = () => handlers.onError('Terminal connection failed');
|
|
26
|
+
socket.onclose = () => handlers.onClose();
|
|
27
|
+
return {
|
|
28
|
+
write: (data) => client.write(data),
|
|
29
|
+
resize: (cols, rows) => client.resize(cols, rows),
|
|
30
|
+
close() { socket.onopen = socket.onmessage = socket.onerror = socket.onclose = null; client.close(); },
|
|
31
|
+
};
|
|
32
|
+
}
|