@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/index.d.ts
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import type { TerminalAttachment } from './substrate/tmux-stream.js';
|
|
2
|
+
import type { NativeSessionIdleProof } from './substrate/native-host.js';
|
|
3
|
+
import type { TerminalInputDelivery, TmuxCommand, TmuxWindowSize } from './substrate/tmux.js';
|
|
4
|
+
import type { SessionDescriptor } from '@volter/supercode-harness-sdk';
|
|
5
|
+
|
|
6
|
+
export type TerminalAttachmentGrant = Readonly<{
|
|
7
|
+
expiresAt: number;
|
|
8
|
+
id: string;
|
|
9
|
+
mode: 'observe' | 'control';
|
|
10
|
+
}>;
|
|
11
|
+
|
|
12
|
+
export type EmbeddedTerminalAttachmentGrant = TerminalAttachmentGrant & Readonly<{
|
|
13
|
+
baseUrl: string;
|
|
14
|
+
}>;
|
|
15
|
+
|
|
16
|
+
export type TerminalSession = Readonly<{
|
|
17
|
+
activeCommand: string | null;
|
|
18
|
+
/** Opaque application context association; never a native harness or tmux handle. */
|
|
19
|
+
contextKey: string | null;
|
|
20
|
+
cwd: string | null;
|
|
21
|
+
id: string;
|
|
22
|
+
label: string;
|
|
23
|
+
owned: boolean;
|
|
24
|
+
/** The pane's root process (its shell), for finding what runs beneath it. */
|
|
25
|
+
rootPid: number | null;
|
|
26
|
+
size: Readonly<{ columns: number; rows: number }> | null;
|
|
27
|
+
}>;
|
|
28
|
+
|
|
29
|
+
export type StructuredLaunch = Readonly<{
|
|
30
|
+
arguments: string[];
|
|
31
|
+
env: Readonly<Record<string, string>>;
|
|
32
|
+
program: string;
|
|
33
|
+
}>;
|
|
34
|
+
|
|
35
|
+
export type TmuxTerminalHostOptions = {
|
|
36
|
+
allowUnownedControl?: boolean;
|
|
37
|
+
attachmentTtlMs?: number;
|
|
38
|
+
contextOption?: string;
|
|
39
|
+
ownerId?: string;
|
|
40
|
+
ownerOption?: string;
|
|
41
|
+
openLocalTerminal?: (launch: StructuredLaunch) => Promise<void>;
|
|
42
|
+
socket?: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export class TmuxTerminalHost {
|
|
46
|
+
constructor(options?: TmuxTerminalHostOptions);
|
|
47
|
+
listSessions(): Promise<TerminalSession[]>;
|
|
48
|
+
createSession(input: {
|
|
49
|
+
command: TmuxCommand;
|
|
50
|
+
contextKey?: string;
|
|
51
|
+
cwd?: string;
|
|
52
|
+
env?: Record<string, string>;
|
|
53
|
+
name?: string;
|
|
54
|
+
}): Promise<TerminalSession>;
|
|
55
|
+
capture(sessionId: string, options?: { lines?: number; preserveEscapes?: boolean }): string;
|
|
56
|
+
sendInput(
|
|
57
|
+
sessionId: string,
|
|
58
|
+
data: string,
|
|
59
|
+
options?: { deadlineMs?: number; submitMode?: 'retry' | 'single' },
|
|
60
|
+
): Promise<TerminalInputDelivery>;
|
|
61
|
+
/** Persist an opaque application context association on a session owned by this host. */
|
|
62
|
+
bindContext(sessionId: string, contextKey: string): Promise<TerminalSession>;
|
|
63
|
+
issueAttachment(sessionId: string, options?: { mode?: 'observe' | 'control' }): TerminalAttachmentGrant;
|
|
64
|
+
attachSocket(
|
|
65
|
+
attachmentId: string,
|
|
66
|
+
socket: unknown,
|
|
67
|
+
size?: { cols?: number; rows?: number },
|
|
68
|
+
): Promise<TerminalAttachment>;
|
|
69
|
+
localAttachLaunch(sessionId: string): StructuredLaunch;
|
|
70
|
+
openLocalTerminal(sessionId: string): Promise<void>;
|
|
71
|
+
closeSession(sessionId: string): void;
|
|
72
|
+
dispose(): void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export class TerminalWebSocketBridge {
|
|
76
|
+
constructor(options: {
|
|
77
|
+
host: Pick<TmuxTerminalHost, 'issueAttachment' | 'attachSocket'>;
|
|
78
|
+
allowedOrigins: string | readonly string[];
|
|
79
|
+
});
|
|
80
|
+
readonly baseUrl: string;
|
|
81
|
+
start(): Promise<string>;
|
|
82
|
+
issueAttachment(sessionId: string, options?: { mode?: 'observe' | 'control' }): EmbeddedTerminalAttachmentGrant;
|
|
83
|
+
stop(): Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type SupercodeTerminalHarness = 'claude-code' | 'codex' | 'gemini' | 'grok';
|
|
87
|
+
|
|
88
|
+
export type SupercodeTerminalLaunch = Readonly<{
|
|
89
|
+
arguments?: readonly string[];
|
|
90
|
+
cwd: string;
|
|
91
|
+
env?: Readonly<Record<string, string>>;
|
|
92
|
+
program: string;
|
|
93
|
+
}>;
|
|
94
|
+
|
|
95
|
+
export type SupercodeTerminalAttachment = EmbeddedTerminalAttachmentGrant & Readonly<{
|
|
96
|
+
conversationKey: string | null;
|
|
97
|
+
sessionId: string;
|
|
98
|
+
}>;
|
|
99
|
+
|
|
100
|
+
export type SupercodeTerminalSnapshot = Readonly<{
|
|
101
|
+
attachment: SupercodeTerminalAttachment | null;
|
|
102
|
+
available: boolean;
|
|
103
|
+
bindings: readonly Readonly<{ conversationKey: string; sessionId: string }>[];
|
|
104
|
+
canOpenLocal: boolean;
|
|
105
|
+
error: string | null;
|
|
106
|
+
sessions: readonly TerminalSession[];
|
|
107
|
+
}>;
|
|
108
|
+
|
|
109
|
+
export type SupercodeTerminalControllerOptions = Readonly<{
|
|
110
|
+
allowedOrigins: string | readonly string[];
|
|
111
|
+
formatCwd?: (cwd: string) => string | null | undefined;
|
|
112
|
+
host?: TmuxTerminalHostOptions;
|
|
113
|
+
nativeHost?: { socket?: string; home?: string; claudeConfigDir?: string };
|
|
114
|
+
sessionNamePrefix?: string;
|
|
115
|
+
}>;
|
|
116
|
+
|
|
117
|
+
export class SupercodeTerminalController {
|
|
118
|
+
constructor(options: SupercodeTerminalControllerOptions);
|
|
119
|
+
start(): Promise<void>;
|
|
120
|
+
snapshot(): Promise<SupercodeTerminalSnapshot>;
|
|
121
|
+
create(harness: SupercodeTerminalHarness, cwd: string): Promise<SupercodeTerminalSnapshot>;
|
|
122
|
+
launchSession(
|
|
123
|
+
harness: string,
|
|
124
|
+
launch: SupercodeTerminalLaunch,
|
|
125
|
+
conversationKey?: string | null,
|
|
126
|
+
initialInput?: string,
|
|
127
|
+
options?: Readonly<{
|
|
128
|
+
conversationDiscovery?: Readonly<{
|
|
129
|
+
knownConversationKeys: readonly string[];
|
|
130
|
+
prompt: string;
|
|
131
|
+
startedAtMs?: number;
|
|
132
|
+
}>;
|
|
133
|
+
}>,
|
|
134
|
+
): Promise<SupercodeTerminalSnapshot>;
|
|
135
|
+
attach(sessionId: string, mode: 'observe' | 'control'): Promise<SupercodeTerminalSnapshot>;
|
|
136
|
+
bindContext(sessionId: string, conversationKey: string): Promise<SupercodeTerminalSnapshot>;
|
|
137
|
+
reconcileConversationBindings(
|
|
138
|
+
descriptors: readonly SessionDescriptor[],
|
|
139
|
+
keyForDescriptor: (descriptor: SessionDescriptor) => string,
|
|
140
|
+
options?: Readonly<{ now?: number }>,
|
|
141
|
+
): Promise<Readonly<{
|
|
142
|
+
bindings: readonly Readonly<{ conversationKey: string; sessionId: string }>[];
|
|
143
|
+
snapshot: SupercodeTerminalSnapshot;
|
|
144
|
+
}>>;
|
|
145
|
+
close(sessionId: string): Promise<SupercodeTerminalSnapshot>;
|
|
146
|
+
openLocal(sessionId: string): Promise<SupercodeTerminalSnapshot>;
|
|
147
|
+
dismiss(): Promise<SupercodeTerminalSnapshot>;
|
|
148
|
+
refreshNativeSessions(): Promise<void>;
|
|
149
|
+
canMoveSession(harness: string, sessionId: string, cwd: string): boolean;
|
|
150
|
+
prepareMoveSession(
|
|
151
|
+
harness: string,
|
|
152
|
+
sessionId: string,
|
|
153
|
+
cwd: string,
|
|
154
|
+
proof: NativeSessionIdleProof | null,
|
|
155
|
+
): Promise<NativeSessionIdleProof | null>;
|
|
156
|
+
moveSession(
|
|
157
|
+
harness: string,
|
|
158
|
+
sessionId: string,
|
|
159
|
+
launch: SupercodeTerminalLaunch,
|
|
160
|
+
conversationKey: string,
|
|
161
|
+
proof: NativeSessionIdleProof,
|
|
162
|
+
): Promise<SupercodeTerminalSnapshot>;
|
|
163
|
+
stop(): Promise<void>;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export class TerminalHostError extends Error {
|
|
167
|
+
readonly code: string;
|
|
168
|
+
constructor(code: string, message: string);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Is the program of this kind showing its idle composer on this captured screen?
|
|
173
|
+
* `null` means this package has no composer pattern for that kind — never read
|
|
174
|
+
* it as "not ready yet".
|
|
175
|
+
*/
|
|
176
|
+
export function composerReadyForInput(kind: string, screen: string | undefined): boolean | null;
|
|
177
|
+
/** Does the composer hold a typed draft? `screen` is a capture with escapes; null when no composer is on screen. */
|
|
178
|
+
export function composerHoldsDraft(kind: string, screen: string | undefined): boolean | null;
|
|
179
|
+
|
|
180
|
+
export { classifyAttentionSignal, observeLifecycle, gatherLifecycleObservation, createLifecycleStore, snapshotProcessTree, snapshotProcessTreeAsync } from './substrate/session-lifecycle.js';
|
|
181
|
+
export type {
|
|
182
|
+
LifecycleSnapshot,
|
|
183
|
+
LifecycleStore,
|
|
184
|
+
PaneLifecycle,
|
|
185
|
+
PaneProcessLifecycle,
|
|
186
|
+
PaneProcessObservation,
|
|
187
|
+
SessionAttentionSignal,
|
|
188
|
+
SessionDerivation,
|
|
189
|
+
DerivationConfidence,
|
|
190
|
+
DerivationSource,
|
|
191
|
+
SessionLifecycle,
|
|
192
|
+
SessionLifecycleState,
|
|
193
|
+
} from './substrate/session-lifecycle.js';
|
|
194
|
+
|
|
195
|
+
export type { TerminalInputDelivery, TmuxCommand, TmuxWindowSize };
|