Dashboard › opencode › Distillation
e6ae0e07-49cb-433f-9cd7-b57f495c6181["lore_tm_v1_stvH7Gk92nJHnaP9O2030BP3JUuw5SBu335iqBeWpjc","lore_tm_v1_uujJi9Lsh-E885N_XXONSs-B6oGuBWFuutjBWdGYEaI","lore_tm_v1_YyOMXl6rBna-pYNJOBYfxx-TZqYnSWmsyfnNoehLiZw","lore_tm_v1_NPuz7RBvPqa0N7-rdS10iQNKh33HFuYqVQL-Sm1257Y","lore_tm_v1_caSGtTIjabzun2FktemcYf7BJGzXIlJArauGPK415m0"]
Date: Sep 8, 2026
/home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts for the current exact review findings; services and repository files must not be touched./tmp/opencode/pty-plugin-smoke.ts may be updated only as necessary, and that tabs must be used in both the plugin and smoke harness.tsgo validation via /tmp/opencode/pty-tsconfig.json and smoke testing via /tmp/opencode/pty-plugin-smoke.ts.ctx.permission.assert immediately before the pty_write and pty_kill side effects, using the canonical tool source.save.await./proc/self/fd/<fd> on Linux, with the handle closed after child spawn.SIGKILL./home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts was provided at 528 lines. It defines tools pty_spawn, pty_write, pty_read, pty_list, and pty_kill; uses /usr/bin/script for PTY spawning and /usr/bin/grep for regex filtering.MAX_BUFFER_SIZE=1_000_000, MAX_SESSIONS=25, 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=2_147_483, KILL_GRACE_MS=1_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, and MAX_REGEX_WORKERS=4.authorize() resolves the requested workdir and project with realpath(), asserts external_directory when needed, then asserts shell using resource=shellCommand(command, args) and save=[resource]; it re-resolves the workdir and checks stat(current).isDirectory() afterward.pty_spawn performs authorization and session-limit checks before spawning /usr/bin/script with cwd: workdir; it attaches the main close listener only after awaiting the child’s "spawn" event and includes notification completion in session.closed.pty_spawn, pty_read, and synthetic exit notifications expose control-like XML strings: <pty_spawned>, <pty_output>, <pty_exited>, and <system_reminder>. Spawn/read reminders include instructions to wait for <pty_exited> and “never poll with sleep and pty_read.”pty_write decodes escapes with decodeEscapes(), writes directly to session.process.stdin, and reports data.length as bytes; its schema bounds the encoded input by characters using Schema.isMaxLength(MAX_WRITE_SIZE).linePage() loops with index <= input.length, allowing an empty trailing page entry when input ends in a newline; lineCount() separately avoids counting a trailing newline as an additional line.matchingLines() starts /usr/bin/grep directly, has a 250 ms kill timer and output bounds, but the declared regexWorkers counter is not used to enforce MAX_REGEX_WORKERS.for await subscription loop and awaits Promise.all(...map(remove)) for session.deleted; a deletion cleanup rejection can therefore escape and terminate the subscription.terminate() sends SIGTERM, waits up to KILL_GRACE_MS=1_000, sends SIGKILL if needed, and then awaits session.closed without a post-SIGKILL bound.deleted, reservations, pending, closing, and regexWorkers, but the provided implementation does not yet use them to enforce deletion/closing admission, spawn reservations, in-flight cleanup, or regex concurrency./tmp/opencode/pty-plugin-smoke.ts was provided at 174 lines. It checks: exact tools pty_spawn, pty_write, pty_read, pty_list, pty_kill; shell permission metadata on spawn/write/kill; explicit shell denial; symlink-based external-directory denial; cross-session isolation for write/read/kill/list; interactive input; exit notification; timeout reporting; listing and cleanup; forced SIGTERM→SIGKILL escalation; process-group removal; session deletion; and plugin cleanup./ID: (pty_[a-f0-9]+)/ and /PID: (\d+)/, and verifies notification text using "Exit Code: 0" and "Timed Out: yes"; these expectations need adjustment for JSON-only envelopes.{"tools":["pty_spawn","pty_write","pty_read","pty_list","pty_kill"],"permissions":true,"ownership":true,"interactive":true,"notification":true,"timeout":true,"escalation":true,"sessionDeletion":true,"cleanup":true}./tmp/opencode/pty-tsconfig.json uses strict: true, noEmit: true, target: "ESNext", module: "Preserve", moduleResolution: "Bundler", and checks only /home/byk/.local/share/opencode-v2-pilot/config/opencode/plugins/pty.ts; it maps @opencode/plugin into /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/.PermissionDomain in /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/permission.ts line 32 and the adapter’s assert implementation in /home/byk/Code/opencode-v2-pilot/packages/plugin/src/promise/adapter.ts line 437.