@microvac/plugin-daytona 0.0.0-stage → 0.1.0-rc.15
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/README.md +98 -2
- package/dist/archive-stream-window.test.d.ts +2 -0
- package/dist/archive-stream-window.test.d.ts.map +1 -0
- package/dist/archive-stream-window.test.js +93 -0
- package/dist/archive-stream-window.test.js.map +1 -0
- package/dist/archive-stream.d.ts +10 -0
- package/dist/archive-stream.d.ts.map +1 -0
- package/dist/archive-stream.js +159 -0
- package/dist/archive-stream.js.map +1 -0
- package/dist/archive-stream.test.d.ts +2 -0
- package/dist/archive-stream.test.d.ts.map +1 -0
- package/dist/archive-stream.test.js +121 -0
- package/dist/archive-stream.test.js.map +1 -0
- package/dist/duplex-close-deadline.test.d.ts +2 -0
- package/dist/duplex-close-deadline.test.d.ts.map +1 -0
- package/dist/duplex-close-deadline.test.js +106 -0
- package/dist/duplex-close-deadline.test.js.map +1 -0
- package/dist/duplex-command-stream.d.ts +98 -0
- package/dist/duplex-command-stream.d.ts.map +1 -0
- package/dist/duplex-command-stream.js +218 -0
- package/dist/duplex-command-stream.js.map +1 -0
- package/dist/duplex-command-stream.live.test.d.ts +2 -0
- package/dist/duplex-command-stream.live.test.d.ts.map +1 -0
- package/dist/duplex-command-stream.live.test.js +324 -0
- package/dist/duplex-command-stream.live.test.js.map +1 -0
- package/dist/duplex-command-stream.test.d.ts +2 -0
- package/dist/duplex-command-stream.test.d.ts.map +1 -0
- package/dist/duplex-command-stream.test.js +519 -0
- package/dist/duplex-command-stream.test.js.map +1 -0
- package/dist/file-sync-capacity.live.test.d.ts +2 -0
- package/dist/file-sync-capacity.live.test.d.ts.map +1 -0
- package/dist/file-sync-capacity.live.test.js +122 -0
- package/dist/file-sync-capacity.live.test.js.map +1 -0
- package/dist/file-sync-capacity.test.d.ts +2 -0
- package/dist/file-sync-capacity.test.d.ts.map +1 -0
- package/dist/file-sync-capacity.test.js +337 -0
- package/dist/file-sync-capacity.test.js.map +1 -0
- package/dist/file-sync-diagnostics.test.d.ts +2 -0
- package/dist/file-sync-diagnostics.test.d.ts.map +1 -0
- package/dist/file-sync-diagnostics.test.js +165 -0
- package/dist/file-sync-diagnostics.test.js.map +1 -0
- package/dist/file-sync.d.ts +80 -0
- package/dist/file-sync.d.ts.map +1 -0
- package/dist/file-sync.js +1362 -0
- package/dist/file-sync.js.map +1 -0
- package/dist/file-sync.test.d.ts +2 -0
- package/dist/file-sync.test.d.ts.map +1 -0
- package/dist/file-sync.test.js +1214 -0
- package/dist/file-sync.test.js.map +1 -0
- package/dist/idle-activity.d.ts +40 -0
- package/dist/idle-activity.d.ts.map +1 -0
- package/dist/idle-activity.js +145 -0
- package/dist/idle-activity.js.map +1 -0
- package/dist/idle-activity.test.d.ts +2 -0
- package/dist/idle-activity.test.d.ts.map +1 -0
- package/dist/idle-activity.test.js +159 -0
- package/dist/idle-activity.test.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/lease-tracing.d.ts +7 -0
- package/dist/lease-tracing.d.ts.map +1 -0
- package/dist/lease-tracing.js +31 -0
- package/dist/lease-tracing.js.map +1 -0
- package/dist/lease-tracing.test.d.ts +2 -0
- package/dist/lease-tracing.test.d.ts.map +1 -0
- package/dist/lease-tracing.test.js +298 -0
- package/dist/lease-tracing.test.js.map +1 -0
- package/dist/login-pty.d.ts +162 -0
- package/dist/login-pty.d.ts.map +1 -0
- package/dist/login-pty.js +258 -0
- package/dist/login-pty.js.map +1 -0
- package/dist/login-pty.test.d.ts +2 -0
- package/dist/login-pty.test.d.ts.map +1 -0
- package/dist/login-pty.test.js +319 -0
- package/dist/login-pty.test.js.map +1 -0
- package/dist/manifest.d.ts +5 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +189 -0
- package/dist/manifest.js.map +1 -0
- package/dist/one-shot-exec-deadline.test.d.ts +2 -0
- package/dist/one-shot-exec-deadline.test.d.ts.map +1 -0
- package/dist/one-shot-exec-deadline.test.js +73 -0
- package/dist/one-shot-exec-deadline.test.js.map +1 -0
- package/dist/plugin.d.ts +103 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +3572 -0
- package/dist/plugin.js.map +1 -0
- package/dist/plugin.test.d.ts +2 -0
- package/dist/plugin.test.d.ts.map +1 -0
- package/dist/plugin.test.js +7276 -0
- package/dist/plugin.test.js.map +1 -0
- package/dist/pty-chunked-input.d.ts +48 -0
- package/dist/pty-chunked-input.d.ts.map +1 -0
- package/dist/pty-chunked-input.js +74 -0
- package/dist/pty-chunked-input.js.map +1 -0
- package/dist/pty-chunked-input.test.d.ts +2 -0
- package/dist/pty-chunked-input.test.d.ts.map +1 -0
- package/dist/pty-chunked-input.test.js +115 -0
- package/dist/pty-chunked-input.test.js.map +1 -0
- package/dist/runner-ingress.sdk-integration.d.ts +2 -0
- package/dist/runner-ingress.sdk-integration.d.ts.map +1 -0
- package/dist/runner-ingress.sdk-integration.js +87 -0
- package/dist/runner-ingress.sdk-integration.js.map +1 -0
- package/dist/session-command-completion.test.d.ts +2 -0
- package/dist/session-command-completion.test.d.ts.map +1 -0
- package/dist/session-command-completion.test.js +251 -0
- package/dist/session-command-completion.test.js.map +1 -0
- package/dist/session-stream-exit.d.ts +13 -0
- package/dist/session-stream-exit.d.ts.map +1 -0
- package/dist/session-stream-exit.js +48 -0
- package/dist/session-stream-exit.js.map +1 -0
- package/dist/tar-listing.test.d.ts +2 -0
- package/dist/tar-listing.test.d.ts.map +1 -0
- package/dist/tar-listing.test.js +220 -0
- package/dist/tar-listing.test.js.map +1 -0
- package/dist/worker.d.ts +3 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +5 -0
- package/dist/worker.js.map +1 -0
- package/package.json +42 -4
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
// The Daytona pseudo-terminal (PTY) session for the shared login flow. The login
|
|
2
|
+
// command needs a real pseudo-terminal: pipe stdio emits no login prompt. The
|
|
3
|
+
// Daytona SDK opens a PTY through `process.createPty`. This module binds that PTY
|
|
4
|
+
// to a small session that the login PTY transport consumes, so the login runner
|
|
5
|
+
// runs the command on a real terminal, streams the terminal output, and delivers
|
|
6
|
+
// the delayed browser code plus the Enter byte.
|
|
7
|
+
//
|
|
8
|
+
// Command contract: the host resolves a closed login command key and a validated
|
|
9
|
+
// session home, and it carries them in a launch descriptor. The descriptor holds
|
|
10
|
+
// no command string. This module maps the key to a compile-time command, so a
|
|
11
|
+
// caller cannot select or override the command. For the Codex key the module
|
|
12
|
+
// composes `exec env CODEX_HOME=<encoded-home> <fixed-codex-command>`. For the
|
|
13
|
+
// Grok key it composes `exec env GROK_HOME=<encoded-home> <fixed-grok-command>`.
|
|
14
|
+
// For the Claude key it composes `exec <fixed-claude-command>` with no home
|
|
15
|
+
// variable. The module encodes the dynamic home with a POSIX shell-argument
|
|
16
|
+
// encoder, so the home cannot add a second shell token or a second command.
|
|
17
|
+
//
|
|
18
|
+
// Session home: the module revalidates the descriptor and the home shape, then
|
|
19
|
+
// creates the session home directory with one `mkdir -p` command. The command
|
|
20
|
+
// runs inside the sandbox, so it holds no authority over a host file and no
|
|
21
|
+
// authority to call the Paperclip API. The sandbox contract in
|
|
22
|
+
// `SANDBOX-REQUIREMENTS.md` treats a check that only inspects state inside the
|
|
23
|
+
// sandbox as a non-boundary control, so this module keeps no owner check, no
|
|
24
|
+
// mode check, and no link-type check for the session home.
|
|
25
|
+
//
|
|
26
|
+
// Dependency boundary: this provider plugin ships standalone (the workspace
|
|
27
|
+
// excludes `packages/plugins/sandbox-providers/**`). So the module imports no
|
|
28
|
+
// workspace package. It declares the small session shape locally through
|
|
29
|
+
// {@link LoginPtySession}. The shape matches the `LoginPtySession` interface in
|
|
30
|
+
// `@paperclipai/adapter-utils`, so the transport factory `createLoginPtyTransport`
|
|
31
|
+
// accepts the session opener from this module with no adapter. The runner drives
|
|
32
|
+
// the transport; the transport drives this session.
|
|
33
|
+
//
|
|
34
|
+
// SDK boundary: the module holds no Daytona SDK type import. It declares the small
|
|
35
|
+
// subset of the SDK PTY and filesystem surfaces that it uses through
|
|
36
|
+
// {@link DaytonaPtyProcess}, {@link DaytonaPtyHandle}, and {@link DaytonaSandboxExec}.
|
|
37
|
+
// The SDK `Process` and `PtyHandle` satisfy those subsets, so a caller passes
|
|
38
|
+
// `sandbox.process` with no adapter. The narrow surface keeps the module
|
|
39
|
+
// unit-testable with a fake PTY and a fake filesystem.
|
|
40
|
+
//
|
|
41
|
+
// Security (secret handling): the login runner delivers the browser code and the
|
|
42
|
+
// Enter byte through {@link DaytonaPtyHandle.sendInput}. The SDK sends the input
|
|
43
|
+
// over the PTY socket, so the code never rides a command line and never reaches a
|
|
44
|
+
// process argument list. The session forwards the raw terminal bytes with no ANSI
|
|
45
|
+
// or OSC 8 handling; the login parser owns that handling.
|
|
46
|
+
import { randomUUID } from "node:crypto";
|
|
47
|
+
import { sendPtyInputInChunks } from "./pty-chunked-input.js";
|
|
48
|
+
/**
|
|
49
|
+
* The compile-time command for each login command key. The Daytona plugin ships
|
|
50
|
+
* standalone, so it holds its own copy of the fixed commands. A future change to
|
|
51
|
+
* a command lands here and in the adapter constant together.
|
|
52
|
+
*/
|
|
53
|
+
const LOGIN_COMMAND_BY_KEY = {
|
|
54
|
+
claude: "claude setup-token",
|
|
55
|
+
codex: "codex login --device-auth",
|
|
56
|
+
grok: "grok login --device-auth",
|
|
57
|
+
};
|
|
58
|
+
/** The fixed root for a login session home. */
|
|
59
|
+
const LOGIN_SESSION_HOME_ROOT = "/tmp/paperclip-adapter-login";
|
|
60
|
+
/**
|
|
61
|
+
* The exact absolute path shape for a login session home. The path is the fixed
|
|
62
|
+
* root, one slash, and one UUID. The anchors reject a relative path, a traversal,
|
|
63
|
+
* whitespace, a control character, and a shell metacharacter, because none of
|
|
64
|
+
* those match the UUID or the fixed root.
|
|
65
|
+
*/
|
|
66
|
+
const SESSION_HOME_PATTERN = /^\/tmp\/paperclip-adapter-login\/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
67
|
+
/** The fixed non-secret error a rejected launch descriptor or session home returns. */
|
|
68
|
+
export const LOGIN_PTY_DESCRIPTOR_REJECTED = "LOGIN_PTY_DESCRIPTOR_REJECTED";
|
|
69
|
+
/** The fixed non-secret error a rejected session home directory returns. */
|
|
70
|
+
export const LOGIN_PTY_HOME_REJECTED = "LOGIN_PTY_HOME_REJECTED";
|
|
71
|
+
/**
|
|
72
|
+
* Encodes one value as a single POSIX shell argument. It wraps the value in
|
|
73
|
+
* single quotes and escapes each embedded single quote. The shell treats every
|
|
74
|
+
* other character inside single quotes as a literal, so an encoded value cannot
|
|
75
|
+
* add a second shell token or a second command.
|
|
76
|
+
*/
|
|
77
|
+
export function encodePosixShellArg(value) {
|
|
78
|
+
return `'${value.split("'").join("'\\''")}'`;
|
|
79
|
+
}
|
|
80
|
+
/** Reports whether a value is a member of the closed login command key set. */
|
|
81
|
+
export function isLoginCommandKey(value) {
|
|
82
|
+
return value === "claude" || value === "codex" || value === "grok";
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Composes the launch line for the descriptor. The module reads only
|
|
86
|
+
* {@link LOGIN_COMMAND_BY_KEY} and the closed command key on the descriptor, so
|
|
87
|
+
* a command string smuggled onto the descriptor object confers no authority.
|
|
88
|
+
* For the Codex key it prefixes one safely encoded `CODEX_HOME` assignment with
|
|
89
|
+
* `env`. For the Grok key it prefixes one safely encoded `GROK_HOME` assignment
|
|
90
|
+
* with `env`. For the Claude key it adds no home variable. It replaces the
|
|
91
|
+
* interactive shell with the command through `exec`, so the pseudo-terminal
|
|
92
|
+
* runs the command directly and its exit code becomes the PTY exit code.
|
|
93
|
+
*/
|
|
94
|
+
export function composeLaunchLine(descriptor) {
|
|
95
|
+
const command = LOGIN_COMMAND_BY_KEY[descriptor.loginCommandKey];
|
|
96
|
+
const encodedHome = encodePosixShellArg(descriptor.sessionHome);
|
|
97
|
+
if (descriptor.loginCommandKey === "codex") {
|
|
98
|
+
return `exec env CODEX_HOME=${encodedHome} ${command}`;
|
|
99
|
+
}
|
|
100
|
+
if (descriptor.loginCommandKey === "grok") {
|
|
101
|
+
return `exec env GROK_HOME=${encodedHome} ${command}`;
|
|
102
|
+
}
|
|
103
|
+
return `exec ${command}`;
|
|
104
|
+
}
|
|
105
|
+
// The terminal size for the login PTY. The login UI prints a short prompt, so a
|
|
106
|
+
// standard terminal size is enough. A fixed size keeps the output stable.
|
|
107
|
+
const LOGIN_PTY_COLS = 120;
|
|
108
|
+
const LOGIN_PTY_ROWS = 30;
|
|
109
|
+
/**
|
|
110
|
+
* The input terminator that replaces the interactive shell with the login
|
|
111
|
+
* command. The `exec` builtin replaces the shell process image with the command,
|
|
112
|
+
* so the PTY runs the command directly. When the command ends, the PTY ends with
|
|
113
|
+
* the command exit code, and the delayed input reaches the command, not a shell.
|
|
114
|
+
* The terminal reads the carriage return as the Enter key.
|
|
115
|
+
*/
|
|
116
|
+
const PTY_COMMAND_TERMINATOR = "\r";
|
|
117
|
+
/**
|
|
118
|
+
* Revalidates the launch descriptor. It fails closed when the command key is
|
|
119
|
+
* outside the closed set or the session home shape is wrong. A unit test that
|
|
120
|
+
* bypasses the host boundary hits this check, so the provider never trusts an
|
|
121
|
+
* unvalidated descriptor.
|
|
122
|
+
*/
|
|
123
|
+
function assertDescriptor(descriptor) {
|
|
124
|
+
if (!isLoginCommandKey(descriptor.loginCommandKey)) {
|
|
125
|
+
throw new Error(LOGIN_PTY_DESCRIPTOR_REJECTED);
|
|
126
|
+
}
|
|
127
|
+
if (!SESSION_HOME_PATTERN.test(descriptor.sessionHome)) {
|
|
128
|
+
throw new Error(LOGIN_PTY_DESCRIPTOR_REJECTED);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Opens a Daytona PTY session for `descriptor` and returns it as a
|
|
133
|
+
* {@link LoginPtySession}. The function revalidates the descriptor and the home
|
|
134
|
+
* shape, creates the session home, opens a real pseudo-terminal, composes the
|
|
135
|
+
* safe launch line, and sends it. The session streams the raw terminal output,
|
|
136
|
+
* delivers delayed input, and stops the child.
|
|
137
|
+
*
|
|
138
|
+
* The function decodes the terminal bytes as a UTF-8 stream, so a multibyte
|
|
139
|
+
* character that splits across two output chunks stays whole. It buffers the
|
|
140
|
+
* output until the transport registers the listener, so no early chunk is lost.
|
|
141
|
+
*/
|
|
142
|
+
export async function openDaytonaLoginPtySession(process, fs, descriptor, options) {
|
|
143
|
+
assertDescriptor(descriptor);
|
|
144
|
+
// Create the session home. `mkdir -p` succeeds when the directory already
|
|
145
|
+
// exists, so a repeat login for the same home needs no extra check.
|
|
146
|
+
await fs.createDirectory(descriptor.sessionHome);
|
|
147
|
+
const decoder = new TextDecoder("utf-8");
|
|
148
|
+
let listener = null;
|
|
149
|
+
let buffered = "";
|
|
150
|
+
const handle = await process.createPty({
|
|
151
|
+
id: `paperclip-login-pty-${randomUUID()}`,
|
|
152
|
+
...(options?.cwd ? { cwd: options.cwd } : {}),
|
|
153
|
+
cols: LOGIN_PTY_COLS,
|
|
154
|
+
rows: LOGIN_PTY_ROWS,
|
|
155
|
+
onData: (data) => {
|
|
156
|
+
// Decode the terminal bytes as a stream, so a split multibyte character
|
|
157
|
+
// stays whole across two chunks. Forward the raw text; the parser owns the
|
|
158
|
+
// ANSI and OSC 8 handling.
|
|
159
|
+
const text = decoder.decode(data, { stream: true });
|
|
160
|
+
if (text.length === 0)
|
|
161
|
+
return;
|
|
162
|
+
if (listener)
|
|
163
|
+
listener(text);
|
|
164
|
+
else
|
|
165
|
+
buffered += text;
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
await handle.waitForConnection();
|
|
169
|
+
// Replace the interactive shell with the login command, so the pseudo-terminal
|
|
170
|
+
// runs the command directly. The runner then writes the delayed browser code
|
|
171
|
+
// to the command, not to a shell.
|
|
172
|
+
await handle.sendInput(composeLaunchLine(descriptor) + PTY_COMMAND_TERMINATOR);
|
|
173
|
+
// The tail of the write chain. The chunker awaits each chunk, so one write can
|
|
174
|
+
// suspend between its chunks. The chain runs each write after the previous
|
|
175
|
+
// write ends, so the chunks of two writes never interleave on the wire.
|
|
176
|
+
let writeChain = Promise.resolve();
|
|
177
|
+
return {
|
|
178
|
+
onData(next) {
|
|
179
|
+
listener = next;
|
|
180
|
+
if (buffered.length > 0) {
|
|
181
|
+
const pending = buffered;
|
|
182
|
+
buffered = "";
|
|
183
|
+
next(pending);
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
write(data) {
|
|
187
|
+
// Send the input as byte-bounded chunks under the provider message cap. The
|
|
188
|
+
// login input is short today, so the latent defect never fires, but the same
|
|
189
|
+
// unbounded write goes through the one chunker. The chain runs this write
|
|
190
|
+
// after the previous write ends, so two writes keep their order and never
|
|
191
|
+
// interleave their chunks. A write error must not throw into the runner, so
|
|
192
|
+
// the runner's fixed status stays the single result path.
|
|
193
|
+
writeChain = writeChain.then(() => sendPtyInputInChunks((chunk) => handle.sendInput(chunk), data));
|
|
194
|
+
},
|
|
195
|
+
async wait() {
|
|
196
|
+
const result = await handle.wait();
|
|
197
|
+
return { exitCode: typeof result.exitCode === "number" ? result.exitCode : null };
|
|
198
|
+
},
|
|
199
|
+
kill() {
|
|
200
|
+
void handle.kill().catch(() => undefined);
|
|
201
|
+
},
|
|
202
|
+
async close() {
|
|
203
|
+
await handle.disconnect().catch(() => undefined);
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The login-profile preamble for a sandbox exec command. Daytona's
|
|
209
|
+
* `executeCommand` runs the command in a non-login shell, so the shell does not
|
|
210
|
+
* source `/etc/profile` on its own. The Daytona reference image puts a CLI on the
|
|
211
|
+
* PATH through `/etc/profile.d`, which only a login profile sources. The login
|
|
212
|
+
* pseudo-terminal resolves the login command through the same profiles, so this
|
|
213
|
+
* preamble sources the login profiles first, and a non-login shell then resolves
|
|
214
|
+
* the same CLI set. The main exec path uses the same profile chain (see
|
|
215
|
+
* `buildLoginShellScript` in `plugin.ts`). Each source line fails open
|
|
216
|
+
* (`|| true`), so a missing profile does not fail the command.
|
|
217
|
+
*/
|
|
218
|
+
const LOGIN_PROFILE_PREAMBLE = [
|
|
219
|
+
"if [ -f /etc/profile ]; then . /etc/profile >/dev/null 2>&1 || true; fi",
|
|
220
|
+
'if [ -f "$HOME/.profile" ]; then . "$HOME/.profile" >/dev/null 2>&1 || true; fi',
|
|
221
|
+
'if [ -f "$HOME/.bash_profile" ]; then . "$HOME/.bash_profile" >/dev/null 2>&1 || true; elif [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" >/dev/null 2>&1 || true; fi',
|
|
222
|
+
'if [ -f "$HOME/.zprofile" ]; then . "$HOME/.zprofile" >/dev/null 2>&1 || true; fi',
|
|
223
|
+
].join(" && ");
|
|
224
|
+
/**
|
|
225
|
+
* Composes a sandbox exec command that runs after the login-profile preamble.
|
|
226
|
+
* The preamble runs first, then the `&&` chain runs `command`.
|
|
227
|
+
*/
|
|
228
|
+
function composeLoginProfileCommand(command) {
|
|
229
|
+
return `${LOGIN_PROFILE_PREAMBLE} && ${command}`;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Creates a {@link DaytonaLoginHomeFs} bound to a Daytona `process`. It runs one
|
|
233
|
+
* `mkdir -p` command on the sandbox to create the session home. The command runs
|
|
234
|
+
* inside the sandbox, so it holds no authority over a host file and no authority
|
|
235
|
+
* to call the Paperclip API. The real command lands against a live sandbox; a
|
|
236
|
+
* unit test injects a fake surface instead.
|
|
237
|
+
*/
|
|
238
|
+
export function createDaytonaLoginHomeFs(exec) {
|
|
239
|
+
return {
|
|
240
|
+
async createDirectory(path) {
|
|
241
|
+
const encodedPath = encodePosixShellArg(path);
|
|
242
|
+
const out = await exec.executeCommand(composeLoginProfileCommand(`mkdir -p ${encodedPath}`));
|
|
243
|
+
if ((out.exitCode ?? 0) !== 0) {
|
|
244
|
+
throw new Error(LOGIN_PTY_HOME_REJECTED);
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Creates a {@link LoginPtySessionOpener} bound to a Daytona `process` and a
|
|
251
|
+
* {@link DaytonaLoginHomeFs}. The opener runs the login command on a real
|
|
252
|
+
* pseudo-terminal, streams the terminal output, delivers the delayed browser code
|
|
253
|
+
* plus the Enter byte, and stops the child for a terminal state.
|
|
254
|
+
*/
|
|
255
|
+
export function createDaytonaLoginPtySessionOpener(process, fs, options) {
|
|
256
|
+
return (descriptor) => openDaytonaLoginPtySession(process, fs, descriptor, options);
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=login-pty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-pty.js","sourceRoot":"","sources":["../src/login-pty.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,8EAA8E;AAC9E,kFAAkF;AAClF,gFAAgF;AAChF,iFAAiF;AACjF,gDAAgD;AAChD,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,8EAA8E;AAC9E,6EAA6E;AAC7E,+EAA+E;AAC/E,iFAAiF;AACjF,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAC5E,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,+DAA+D;AAC/D,+EAA+E;AAC/E,6EAA6E;AAC7E,2DAA2D;AAC3D,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,mFAAmF;AACnF,iFAAiF;AACjF,oDAAoD;AACpD,EAAE;AACF,mFAAmF;AACnF,qEAAqE;AACrE,uFAAuF;AACvF,8EAA8E;AAC9E,yEAAyE;AACzE,uDAAuD;AACvD,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,kFAAkF;AAClF,kF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EAC1B,EAAsB,EACtB,OAAgC;IAEhC,OAAO,CAAC,UAAoC,EAAE,EAAE,CAC9C,0BAA0B,CAAC,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-pty.test.d.ts","sourceRoot":"","sources":["../src/login-pty.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { composeLaunchLine, createDaytonaLoginHomeFs, createDaytonaLoginPtySessionOpener, encodePosixShellArg, openDaytonaLoginPtySession, } from "./login-pty.js";
|
|
3
|
+
// The Enter byte the terminal login UI reads to submit the browser code.
|
|
4
|
+
const ENTER = "\r";
|
|
5
|
+
const HOME = "/tmp/paperclip-adapter-login/11111111-2222-4333-8444-555555555555";
|
|
6
|
+
const CLAUDE = { loginCommandKey: "claude", sessionHome: HOME };
|
|
7
|
+
const CODEX = { loginCommandKey: "codex", sessionHome: HOME };
|
|
8
|
+
const GROK = { loginCommandKey: "grok", sessionHome: HOME };
|
|
9
|
+
/**
|
|
10
|
+
* A fake login-home filesystem. It records each path the caller asks to create
|
|
11
|
+
* and never fails, matching the `mkdir -p` semantics of the real command: a
|
|
12
|
+
* repeat create for the same path succeeds the same as a fresh one.
|
|
13
|
+
*/
|
|
14
|
+
function createFakeHomeFs() {
|
|
15
|
+
const created = [];
|
|
16
|
+
return {
|
|
17
|
+
created,
|
|
18
|
+
async createDirectory(path) {
|
|
19
|
+
created.push(path);
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A fake Daytona PTY handle. It records each input write, drives the output
|
|
25
|
+
* stream on demand, and records the kill and the disconnect. The tests use it in
|
|
26
|
+
* place of the real SDK `PtyHandle`, so the session runs with no sandbox.
|
|
27
|
+
*/
|
|
28
|
+
function createFakePtyHandle(onData, onWaitForConnection) {
|
|
29
|
+
const encoder = new TextEncoder();
|
|
30
|
+
const inputs = [];
|
|
31
|
+
let resolveWait = null;
|
|
32
|
+
const waitPromise = new Promise((resolve) => {
|
|
33
|
+
resolveWait = resolve;
|
|
34
|
+
});
|
|
35
|
+
let killed = 0;
|
|
36
|
+
let disconnected = 0;
|
|
37
|
+
return {
|
|
38
|
+
async waitForConnection() {
|
|
39
|
+
onWaitForConnection?.();
|
|
40
|
+
},
|
|
41
|
+
async sendInput(data) {
|
|
42
|
+
inputs.push(typeof data === "string" ? data : new TextDecoder().decode(data));
|
|
43
|
+
},
|
|
44
|
+
wait() {
|
|
45
|
+
return waitPromise;
|
|
46
|
+
},
|
|
47
|
+
async kill() {
|
|
48
|
+
killed += 1;
|
|
49
|
+
},
|
|
50
|
+
async disconnect() {
|
|
51
|
+
disconnected += 1;
|
|
52
|
+
},
|
|
53
|
+
emitText(text) {
|
|
54
|
+
onData(encoder.encode(text));
|
|
55
|
+
},
|
|
56
|
+
emitBytes(bytes) {
|
|
57
|
+
onData(bytes);
|
|
58
|
+
},
|
|
59
|
+
finish(exitCode) {
|
|
60
|
+
resolveWait?.({ exitCode });
|
|
61
|
+
},
|
|
62
|
+
get inputs() {
|
|
63
|
+
return inputs;
|
|
64
|
+
},
|
|
65
|
+
get killed() {
|
|
66
|
+
return killed;
|
|
67
|
+
},
|
|
68
|
+
get disconnected() {
|
|
69
|
+
return disconnected;
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A fake Daytona process. It opens one fake PTY handle and records the create
|
|
75
|
+
* options, so a test asserts the terminal size and the launch line.
|
|
76
|
+
*/
|
|
77
|
+
function createFakeProcess() {
|
|
78
|
+
const state = { handle: null, createOptions: null, createCount: 0 };
|
|
79
|
+
return {
|
|
80
|
+
get handle() {
|
|
81
|
+
return state.handle;
|
|
82
|
+
},
|
|
83
|
+
get createOptions() {
|
|
84
|
+
return state.createOptions;
|
|
85
|
+
},
|
|
86
|
+
get createCount() {
|
|
87
|
+
return state.createCount;
|
|
88
|
+
},
|
|
89
|
+
async createPty(options) {
|
|
90
|
+
state.createCount += 1;
|
|
91
|
+
state.createOptions = options;
|
|
92
|
+
const handle = createFakePtyHandle(options.onData);
|
|
93
|
+
state.handle = handle;
|
|
94
|
+
return handle;
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
describe("encodePosixShellArg", () => {
|
|
99
|
+
it("wraps a value in single quotes and neutralizes metacharacters", () => {
|
|
100
|
+
expect(encodePosixShellArg("/tmp/x")).toBe("'/tmp/x'");
|
|
101
|
+
// A metacharacter, a space, and a semicolon stay literal inside the quotes.
|
|
102
|
+
expect(encodePosixShellArg("; rm -rf / #")).toBe("'; rm -rf / #'");
|
|
103
|
+
// An embedded single quote closes, escapes, and reopens the quote.
|
|
104
|
+
expect(encodePosixShellArg("a'b")).toBe("'a'\\''b'");
|
|
105
|
+
expect(encodePosixShellArg("$(id)")).toBe("'$(id)'");
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
describe("composeLaunchLine", () => {
|
|
109
|
+
it("composes the Claude line with no CODEX_HOME", () => {
|
|
110
|
+
const line = composeLaunchLine(CLAUDE);
|
|
111
|
+
expect(line).toBe("exec claude setup-token");
|
|
112
|
+
expect(line).not.toContain("CODEX_HOME");
|
|
113
|
+
});
|
|
114
|
+
it("composes the Codex line with exactly one encoded CODEX_HOME", () => {
|
|
115
|
+
const line = composeLaunchLine(CODEX);
|
|
116
|
+
expect(line).toBe(`exec env CODEX_HOME='${HOME}' codex login --device-auth`);
|
|
117
|
+
// Exactly one CODEX_HOME assignment, and the exact approved Codex command.
|
|
118
|
+
expect(line.match(/CODEX_HOME=/g)).toHaveLength(1);
|
|
119
|
+
expect(line.endsWith("codex login --device-auth")).toBe(true);
|
|
120
|
+
});
|
|
121
|
+
it("composes the Grok line with exactly one encoded GROK_HOME", () => {
|
|
122
|
+
const line = composeLaunchLine(GROK);
|
|
123
|
+
expect(line).toBe(`exec env GROK_HOME='${HOME}' grok login --device-auth`);
|
|
124
|
+
// Exactly one GROK_HOME assignment, and the exact approved Grok command.
|
|
125
|
+
expect(line.match(/GROK_HOME=/g)).toHaveLength(1);
|
|
126
|
+
expect(line.endsWith("grok login --device-auth")).toBe(true);
|
|
127
|
+
// The Codex encoded variable never leaks into the Grok line.
|
|
128
|
+
expect(line).not.toContain("CODEX_HOME");
|
|
129
|
+
});
|
|
130
|
+
it("composes the launch line from the closed command map only, and ignores a command string smuggled onto the descriptor", () => {
|
|
131
|
+
// Condition 4: a command string in the request confers no command
|
|
132
|
+
// authority. The module maps the closed key to its own fixed command, so a
|
|
133
|
+
// caller cannot select or override it.
|
|
134
|
+
const tampered = {
|
|
135
|
+
...GROK,
|
|
136
|
+
command: "rm -rf /",
|
|
137
|
+
};
|
|
138
|
+
const line = composeLaunchLine(tampered);
|
|
139
|
+
expect(line).toBe(`exec env GROK_HOME='${HOME}' grok login --device-auth`);
|
|
140
|
+
expect(line).not.toContain("rm -rf");
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
describe("openDaytonaLoginPtySession — session home", () => {
|
|
144
|
+
it("creates the session home directory", async () => {
|
|
145
|
+
const process = createFakeProcess();
|
|
146
|
+
const fs = createFakeHomeFs();
|
|
147
|
+
await openDaytonaLoginPtySession(process, fs, CLAUDE);
|
|
148
|
+
// The provider created the exact directory and opened the terminal.
|
|
149
|
+
expect(fs.created).toEqual([HOME]);
|
|
150
|
+
expect(process.createCount).toBe(1);
|
|
151
|
+
expect(process.handle?.inputs[0]).toBe("exec claude setup-token" + ENTER);
|
|
152
|
+
});
|
|
153
|
+
it("sends the Codex launch line with the encoded CODEX_HOME", async () => {
|
|
154
|
+
const process = createFakeProcess();
|
|
155
|
+
const fs = createFakeHomeFs();
|
|
156
|
+
await openDaytonaLoginPtySession(process, fs, CODEX);
|
|
157
|
+
expect(process.handle?.inputs[0]).toBe(`exec env CODEX_HOME='${HOME}' codex login --device-auth` + ENTER);
|
|
158
|
+
// The Claude line carries no CODEX_HOME; the Codex line carries exactly one.
|
|
159
|
+
expect((process.handle?.inputs[0]?.match(/CODEX_HOME=/g) ?? []).length).toBe(1);
|
|
160
|
+
});
|
|
161
|
+
it("opens the login session when the session home already exists", async () => {
|
|
162
|
+
const process = createFakeProcess();
|
|
163
|
+
const fs = createFakeHomeFs();
|
|
164
|
+
// A second login for the same home hits an existing directory. `mkdir -p`
|
|
165
|
+
// succeeds on an existing directory, so the second session opens the same
|
|
166
|
+
// as the first.
|
|
167
|
+
await openDaytonaLoginPtySession(process, fs, CLAUDE);
|
|
168
|
+
await openDaytonaLoginPtySession(process, fs, CLAUDE);
|
|
169
|
+
expect(fs.created).toEqual([HOME, HOME]);
|
|
170
|
+
expect(process.createCount).toBe(2);
|
|
171
|
+
});
|
|
172
|
+
it("rejects a descriptor with a command key outside the closed set", async () => {
|
|
173
|
+
const process = createFakeProcess();
|
|
174
|
+
const fs = createFakeHomeFs();
|
|
175
|
+
await expect(openDaytonaLoginPtySession(process, fs, {
|
|
176
|
+
loginCommandKey: "gemini",
|
|
177
|
+
sessionHome: HOME,
|
|
178
|
+
})).rejects.toThrow("LOGIN_PTY_DESCRIPTOR_REJECTED");
|
|
179
|
+
// The provider never touched the filesystem or the terminal.
|
|
180
|
+
expect(fs.created).toEqual([]);
|
|
181
|
+
expect(process.createCount).toBe(0);
|
|
182
|
+
});
|
|
183
|
+
it("rejects a descriptor whose session home shape is wrong", async () => {
|
|
184
|
+
const process = createFakeProcess();
|
|
185
|
+
const fs = createFakeHomeFs();
|
|
186
|
+
await expect(openDaytonaLoginPtySession(process, fs, {
|
|
187
|
+
loginCommandKey: "codex",
|
|
188
|
+
sessionHome: "/tmp/paperclip-adapter-login/../etc",
|
|
189
|
+
})).rejects.toThrow("LOGIN_PTY_DESCRIPTOR_REJECTED");
|
|
190
|
+
expect(process.createCount).toBe(0);
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
describe("openDaytonaLoginPtySession — session mechanics", () => {
|
|
194
|
+
it("starts the login command on a pseudo-terminal with a fixed size", async () => {
|
|
195
|
+
const process = createFakeProcess();
|
|
196
|
+
await openDaytonaLoginPtySession(process, createFakeHomeFs(), CLAUDE);
|
|
197
|
+
expect(process.createOptions?.cols).toBe(120);
|
|
198
|
+
expect(process.createOptions?.rows).toBe(30);
|
|
199
|
+
expect(process.handle?.inputs[0]).toBe("exec claude setup-token" + ENTER);
|
|
200
|
+
});
|
|
201
|
+
it("returns incremental terminal output to the listener", async () => {
|
|
202
|
+
const process = createFakeProcess();
|
|
203
|
+
const received = [];
|
|
204
|
+
const session = await openDaytonaLoginPtySession(process, createFakeHomeFs(), CLAUDE);
|
|
205
|
+
session.onData((chunk) => received.push(chunk));
|
|
206
|
+
process.handle?.emitText("the url below to sign in\n");
|
|
207
|
+
process.handle?.emitText("Paste code here if prompted\n");
|
|
208
|
+
expect(received).toEqual(["the url below to sign in\n", "Paste code here if prompted\n"]);
|
|
209
|
+
});
|
|
210
|
+
it("buffers early output until the listener registers", async () => {
|
|
211
|
+
const process = createFakeProcess();
|
|
212
|
+
const received = [];
|
|
213
|
+
const session = await openDaytonaLoginPtySession(process, createFakeHomeFs(), CLAUDE);
|
|
214
|
+
process.handle?.emitText("early output ");
|
|
215
|
+
process.handle?.emitText("more output");
|
|
216
|
+
expect(received).toEqual([]);
|
|
217
|
+
session.onData((chunk) => received.push(chunk));
|
|
218
|
+
expect(received).toEqual(["early output more output"]);
|
|
219
|
+
});
|
|
220
|
+
it("delivers the browser code plus the Enter byte to the command", async () => {
|
|
221
|
+
const process = createFakeProcess();
|
|
222
|
+
const session = await openDaytonaLoginPtySession(process, createFakeHomeFs(), CLAUDE);
|
|
223
|
+
session.write("BROWSERCODE" + ENTER);
|
|
224
|
+
// The write runs through the serialized chunk chain, so it lands on a later
|
|
225
|
+
// microtask. Flush the chain before the assertion.
|
|
226
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
227
|
+
expect(process.handle?.inputs[1]).toBe("BROWSERCODE" + ENTER);
|
|
228
|
+
expect(process.handle?.inputs[1]?.endsWith(ENTER)).toBe(true);
|
|
229
|
+
});
|
|
230
|
+
it("keeps a multibyte character whole across two output chunks", async () => {
|
|
231
|
+
const process = createFakeProcess();
|
|
232
|
+
const received = [];
|
|
233
|
+
const session = await openDaytonaLoginPtySession(process, createFakeHomeFs(), CLAUDE);
|
|
234
|
+
session.onData((chunk) => received.push(chunk));
|
|
235
|
+
const euro = new TextEncoder().encode("€");
|
|
236
|
+
process.handle?.emitBytes(euro.subarray(0, 2));
|
|
237
|
+
process.handle?.emitBytes(euro.subarray(2));
|
|
238
|
+
expect(received.join("")).toBe("€");
|
|
239
|
+
});
|
|
240
|
+
it("resolves wait with the command exit code", async () => {
|
|
241
|
+
const process = createFakeProcess();
|
|
242
|
+
const session = await openDaytonaLoginPtySession(process, createFakeHomeFs(), CLAUDE);
|
|
243
|
+
process.handle?.finish(9);
|
|
244
|
+
await expect(session.wait()).resolves.toEqual({ exitCode: 9 });
|
|
245
|
+
});
|
|
246
|
+
it("maps an absent exit code to null", async () => {
|
|
247
|
+
const process = createFakeProcess();
|
|
248
|
+
const session = await openDaytonaLoginPtySession(process, createFakeHomeFs(), CLAUDE);
|
|
249
|
+
process.handle?.finish(undefined);
|
|
250
|
+
await expect(session.wait()).resolves.toEqual({ exitCode: null });
|
|
251
|
+
});
|
|
252
|
+
it("kills the child and closes the session", async () => {
|
|
253
|
+
const process = createFakeProcess();
|
|
254
|
+
const session = await openDaytonaLoginPtySession(process, createFakeHomeFs(), CLAUDE);
|
|
255
|
+
session.kill();
|
|
256
|
+
expect(process.handle?.killed).toBe(1);
|
|
257
|
+
await session.close();
|
|
258
|
+
expect(process.handle?.disconnected).toBe(1);
|
|
259
|
+
});
|
|
260
|
+
it("passes the working directory to the pseudo-terminal", async () => {
|
|
261
|
+
const process = createFakeProcess();
|
|
262
|
+
await openDaytonaLoginPtySession(process, createFakeHomeFs(), CLAUDE, { cwd: "/workspace" });
|
|
263
|
+
expect(process.createOptions?.cwd).toBe("/workspace");
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
describe("createDaytonaLoginHomeFs — login-profile preamble", () => {
|
|
267
|
+
// A capturing exec surface. It records each command and returns a fixed result,
|
|
268
|
+
// so a test reads the exact command string the create runs.
|
|
269
|
+
function createCapturingExec(result) {
|
|
270
|
+
const commands = [];
|
|
271
|
+
return {
|
|
272
|
+
commands,
|
|
273
|
+
async executeCommand(command) {
|
|
274
|
+
commands.push(command);
|
|
275
|
+
return result;
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
it("sources the login profiles before it creates the session home directory", async () => {
|
|
280
|
+
// The command sources /etc/profile before it runs `mkdir -p`, so the create
|
|
281
|
+
// command stays consistent with the profile chain the rest of the sandbox
|
|
282
|
+
// exec commands use.
|
|
283
|
+
const exec = createCapturingExec({ exitCode: 0, result: "" });
|
|
284
|
+
const fs = createDaytonaLoginHomeFs(exec);
|
|
285
|
+
await fs.createDirectory(HOME);
|
|
286
|
+
const command = exec.commands.find((entry) => entry.includes("mkdir -p"));
|
|
287
|
+
expect(command).toBeDefined();
|
|
288
|
+
const profileIndex = command.indexOf("/etc/profile");
|
|
289
|
+
const mkdirIndex = command.indexOf("mkdir -p");
|
|
290
|
+
expect(profileIndex).toBeGreaterThanOrEqual(0);
|
|
291
|
+
expect(mkdirIndex).toBeGreaterThan(profileIndex);
|
|
292
|
+
});
|
|
293
|
+
it("rejects the session and opens no pseudo-terminal when the create command exits non-zero", async () => {
|
|
294
|
+
// The sandbox `mkdir -p` command fails (for example, a read-only mount).
|
|
295
|
+
// The session must fail closed before it opens a pseudo-terminal.
|
|
296
|
+
const exec = createCapturingExec({ exitCode: 1, result: "" });
|
|
297
|
+
const fs = createDaytonaLoginHomeFs(exec);
|
|
298
|
+
const process = createFakeProcess();
|
|
299
|
+
await expect(openDaytonaLoginPtySession(process, fs, CLAUDE)).rejects.toThrow("LOGIN_PTY_HOME_REJECTED");
|
|
300
|
+
expect(process.createCount).toBe(0);
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
describe("createDaytonaLoginPtySessionOpener", () => {
|
|
304
|
+
it("opens a session for the descriptor on each call", async () => {
|
|
305
|
+
const process = createFakeProcess();
|
|
306
|
+
const opener = createDaytonaLoginPtySessionOpener(process, createFakeHomeFs(), {
|
|
307
|
+
cwd: "/workspace",
|
|
308
|
+
});
|
|
309
|
+
const session = await opener(CLAUDE);
|
|
310
|
+
expect(process.createOptions?.cwd).toBe("/workspace");
|
|
311
|
+
expect(process.handle?.inputs[0]).toBe("exec claude setup-token" + ENTER);
|
|
312
|
+
expect(typeof session.onData).toBe("function");
|
|
313
|
+
expect(typeof session.write).toBe("function");
|
|
314
|
+
expect(typeof session.wait).toBe("function");
|
|
315
|
+
expect(typeof session.kill).toBe("function");
|
|
316
|
+
expect(typeof session.close).toBe("function");
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
//# sourceMappingURL=login-pty.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-pty.test.js","sourceRoot":"","sources":["../src/login-pty.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,kCAAkC,EAClC,mBAAmB,EACnB,0BAA0B,GAQ3B,MAAM,gBAAgB,CAAC;AAExB,yEAAyE;AACzE,MAAM,KAAK,GAAG,IAAI,CAAC;AAEnB,MAAM,IAAI,GAAG,mEAAmE,CAAC;AAEjF,MAAM,MAAM,GAA6B,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AAC1F,MAAM,KAAK,GAA6B,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AACxF,MAAM,IAAI,GAA6B,EAAE,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