Dashboard › opencode › Distillation
82e6e46e-b654-4ae0-99c8-1c4f64cb7a4b["lore_tm_v1_wPLaa8zT1LBclZ39btvmKI8pk4om8jwv_fff-FNhL7M","lore_tm_v1_UNsnUb8xQXDLR75f2Ny3lyXYtgaj20NWSCaAlv6oZTY","lore_tm_v1_6AjGCayXV5NBLlz1zpqOBkOYPqDOPQhLNJoCrEER0iM","lore_tm_v1_-SxwFmZSTdDBmmyv2a01gYmCz-a62LXDhJUl0TeMpRg","lore_tm_v1_cOdAAmdoiSYo8H0axFhQKHOBE-x-589EJ-lMZM69y6A","lore_tm_v1_7Mz__A1zHD_M4O67Jvrj0auTHtg9psg0_KG3NHmERy8","lore_tm_v1_eCvuhWeiWjw5oTHuXOsBtHWjvFlzbFZmnyQ_apVd5hg","lore_tm_v1_UyBkgN0wCHhhp3yPeCgKoq58vLmt3K6eU5d7MAK9cpo","lore_tm_v1_pYT9AAqpzLWPXo3-GeWTnwzorDmFqvvZn6JfAh1SuE8","lore_tm_v1_KPRXkVCQGT4ANAjEdsYOCu8YNuzLfvW1jKU4ihZJOEo","lore_tm_v1_NdiFIXmIh9wb2jtiFQDcn7E_PTBBZxUc6wPMEPa3jxI"]
plugins/pty.ts=f2ac5193452ca7c471ec253f0c7d8759f2ac002d7015c023198603c856cf7dbf; test/pty.test.ts=94a64d0171a5c6f438dea0e8bfaf9fd00cab0de8553610af08e106702a6d42f6; plugins/followup.ts=8d51037989aa2cbfa10de82b56ef9512218a07544a5308a74890d59252f43bad; opencode.json=571a0730c86bde522edf63516b7fa69cb9cbf2ff8730e15e2a8ce064c33ad905; package.json=cbe806483294fe4b7fe9c5fa98723ccbfe0baa8ab202a030b08c0cdf097af2e9; tsconfig.json=07196988cfa0e34e77927d4ec5e208a5e7ea66192b70af0dde27a9a049ee92b5.byk:byk with mode 644./home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts defines PTY bounds: MAX_SESSIONS=16, MAX_SESSIONS_PER_OWNER=5, DEFAULT_READ_LIMIT=500, MAX_READ_LIMIT=2_000, MAX_READ_OFFSET=10_000, MAX_LINE_LENGTH=2_000, MAX_PATTERN_LENGTH=500, MAX_WRITE_SIZE=65_536, MAX_TIMEOUT_SECONDS=3_600, CLOSE_TIMEOUT_MS=27_000, NOTIFICATION_TIMEOUT_MS=5_000, MAX_COMMAND_LENGTH=4_096, MAX_ARGUMENTS=128, MAX_ARGUMENT_LENGTH=16_384, MAX_ARGUMENT_BYTES=65_536, MAX_PATH_LENGTH=4_096, MAX_TITLE_LENGTH=500, MAX_DESCRIPTION_LENGTH=2_000, MAX_REGEX_WORKERS=4, MAX_BUFFER_SIZE=1_000_000, and TERMINATE_TIMEOUT_MS=2_000.plugins/pty.ts pins SCRIPT_PATH="/usr/bin/script" and SHELL_PATH="/bin/sh" and uses a fixed environment: HOME=/home/byk, LANG=C.UTF-8, LOGNAME=byk, PATH=/usr/bin:/bin, SHELL=/bin/sh, TERM=xterm-256color, and USER=byk.plugins/pty.ts defines plugin ID local-pty and tools pty_spawn, pty_write, pty_read, pty_list, and pty_kill; shell permission is required for spawn, write, and kill, while read/list omit shell permission.pty_spawn validates command/argument lengths, rejects requests while closing or after the parent Session is deleted, enforces 5 sessions per owner and 16 per Location including reservations, evicts one inactive owner session when the owner limit is reached, authorizes the canonical work directory, creates IDs as pty_ plus the first 8 hex characters of a hyphen-stripped UUID, and retains only the last 1_000_000 output characters.reserved, reservations, pendingSpawns, and ownerSpawns; post-authorization and post-process-open checks terminate or reject a spawn if plugin shutdown begins or the parent Session is deleted."killing" to "killed" and otherwise to "exited"; failures set exitCode=1 and append the error to the bounded output buffer. Optional timeout marks timedOut=true and invokes terminate(session).notifyOnExit=true, plugins/pty.ts sends a ctx.session.synthetic notification with delivery:"steer" and JSON type "pty.exit" containing id, a description truncated to 100 characters, exitCode, exitSignal, timeoutSeconds, timedOut, outputLines, and the last nonblank line truncated to 200 characters; notification delivery is bounded by 5_000ms and suppressed during closing or after parent Session deletion.pty_write decodes supported escapes, rechecks the actual UTF-8 byte count against 65_536, performs canonical shell authorization, re-resolves ownership/status after authorization, and writes a Buffer; pty_read supports pagination and extended-regex filtering with at most 4 concurrent regex workers, truncates returned lines to 2_000 characters, and returns totalLines, hasMore, and nextOffset.session.deleted subscriber adds the parent ID to deleted, waits up to 27_000ms for that ownerβs pending spawns, then removes all owned PTY sessions with another 27_000ms bound; rejected cleanup operations are logged, while expected spawn rejection containing "Session has been deleted" is not logged as an error./usr/bin/grep with arguments ["-a", "-m", String(limit), "-nE", ...(ignoreCase ? ["-i"] : []), "--", pattern]; a SIGKILL outcome is interpreted as "PTY output pattern timed out.".SIGKILL, termination waited for the wrapper to close but did not verify that both ordinary process groups had disappeared. Planned fix was a bounded post-kill verification plus an adversarial regression; deliberately calling setsid() or daemonizing remains outside the stated cleanup guarantee./home/byk/.local/share/opencode-v2-pilot/config/opencode/test/pty.test.ts had exactly 5 tests in order: 1. fixed environment and pinned cwd plus interactive write/read; 2. argv preservation without shell evaluation using values "space value", "quote'value", "$(printf injected)", "semi;colon", and "Γ©"; 3. process-group kill escalation and JSON exit notification; 4. Session ownership plus canonical permission source validation; 5. active-session removal and late-spawn rejection after session.deleted.test/pty.test.ts uses setDefaultTimeout(15_000) and an afterEach hook that runs all registered cleanups via Promise.allSettled; its polling helper checks every 10ms, defaults to a 1_000ms timeout, and throws "Condition did not become true."./bin/sh -c "trap '' TERM; while :; do sleep 1; done" with notifyOnExit:true, expects pty_kill status "killed", verifies process.kill(session.pid, 0) throws, waits for exactly one notification, and validates notification fields type:"pty.exit", the PTY ID, and description "kill escalation".{ type:"session.deleted", data:{ sessionID:"top" } }, waits up to 5_000ms for pty_list to become empty, expects subsequent reads to fail with PTY session not found: <id>, and expects a late /bin/true spawn to fail with Session has been deleted: top.signalProcessGroup(pid, "SIGKILL"), signalProcessGroup(wrapperPID, "SIGKILL"), and the waitForClose(exited, TERMINATE_TIMEOUT_MS) check did not exactly match plugins/pty.ts./home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts and /home/byk/.local/share/opencode-v2-pilot/config/opencode/test/pty.test.ts./home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts, completing the source-side adjustment after the test/source patch.bun test v1.3.14 (0d9b296a) completed with exactly 5 pass, 0 fail, and 14 expect() calls across 5 tests in 1 file, duration 4.45s./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:471, host.tool.transform((editor) =>./home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts:467-504 adapts the tool host API: reload runs host.tool.reload(); transform is registered and exposes list, get, namespace, add, update, and remove; existing executors are wrapped with promiseExecutor, added/updated executors call executePromiseTool, updates preserve output and options, and hook converts callback results through Effect.promise(() => Promise.resolve(callback(event))).