fix(cli-rs): keep a JS plugin's dialog mounted across a reload

sensitive-encrypt's panel registers a keymap layer as it mounts, which
reloads the plugin's registrations on the JS host. The reload ended the
dialog surface's mount and nothing mounted it again, so the dialog
showed an empty body. The dialog now stays and mounts again from the
new registration under the same key, as a docked panel does (CT-29),
and the JS host adopts what it rendered.

ui.dialog.show also sends its dialog at once again: a plugin that shows
it after an await runs in no call, and a dialog.set right after resends
it under the same key, which the host changes in place.

P.8/sensitive-encrypt records CT-37 end to end: the field of the
plugin's own dialog takes the focus and the user's typing, equal to TS
in text. The colors of the plugin's uncolored text and fields, and the
RPC's location query, differ as F16-v2-compat-layer records.
This commit is contained in:
Simon Klee
2026-11-18 09:54:21 +01:00
Unverified
parent 198ff642a8
commit d35db0551c
16 changed files with 356 additions and 28 deletions
File diff suppressed because one or more lines are too long
@@ -1673,8 +1673,12 @@ test("each dialog settles once, and clear closes it", async () => {
ctx.ui.dialog.show(() => h("text", { children: "small" }))
await turn()
const dialogs = fake.effects.filter((effect) => effect.dialog?.type === "surface").map((effect) => effect.dialog)
// The first opened large and centered, with the `set` right after it; the next is the host's own size.
expect(dialogs.map((dialog) => [dialog.size, dialog.centered])).toEqual([["large", true], [undefined, undefined]])
// The first opened, then the `set` right after it sized it under its key; the next is the host's own size.
expect(dialogs.map((dialog) => [dialog.key, dialog.size, dialog.centered])).toEqual([
["compat.dialog.1", undefined, undefined],
["compat.dialog.1", "large", true],
["compat.dialog.2", undefined, undefined],
])
})
// A select's footer actions are the contract's (session-time's "Close ctrl+a"): each with its key, side and selection,
@@ -702,7 +702,7 @@ export function context(base: Base, carrier: Carrier) {
// apart from the one it replaced, and the mount renders that show's JSX; a `dialog.set` changes its frame in place.
const DIALOG = "compat.dialog"
let shows = 0
let shown: { key: string; onClose?: () => void; opened: boolean; sent: boolean } | undefined
let shown: { key: string; onClose?: () => void; opened: boolean } | undefined
// The renders of the shows, by their key, until each closes.
const dialogs = new Map<string, () => unknown>()
let presentation = { size: "medium", centered: false }
@@ -722,7 +722,6 @@ export function context(base: Base, carrier: Carrier) {
}
const sendShown = () => {
if (!shown) return
shown.sent = true
void carrier.effect({ type: "dialog", dialog: { type: "surface", surface: DIALOG, key: shown.key, ...presented() } })
}
// A dialog of the plugin's own ends with its activation, and a dialog it asked answers nothing (carbon-5).
@@ -1750,20 +1749,16 @@ export function context(base: Base, carrier: Carrier) {
presentation = { size: "medium", centered: false }
const key = `compat.dialog.${++shows}`
dialogs.set(key, render)
shown = { key, onClose, opened: false, sent: false }
shown = { key, onClose, opened: false }
untrack(() => read(`dialog-open:${key}`, { type: "dialog-open", key }))
// Sent a microtask later, so a `dialog.set` right after sizes the dialog as it opens, as TS's sizes the
// dialog shown; a `show` or a `clear` before then sends nothing of this one.
queueMicrotask(() => {
if (shown?.key === key) sendShown()
})
// Sent at once, also from a plugin's code after an `await`, which runs in no call of the host's; a `dialog.set`
// right after sends it again under its key, which the host changes in place.
sendShown()
},
set(options: Json) {
presentation = { size: options?.size ?? "medium", centered: !!options?.centered }
// A dialog of the plugin's own shown already changes its frame in place; one not sent yet opens so.
if (shown) {
if (shown.sent) sendShown()
}
// A dialog of the plugin's own changes its frame in place.
if (shown) sendShown()
// A select's, an alert's and a confirm's size and centering are the contract's (contract 2.x, addition 4): a
// `dialog.set` right after them sizes the dialog, which is built a microtask later. One after the host showed
// it is not carried: the contract's dialogs are whole values, and sent again it would answer nothing.
@@ -201,6 +201,9 @@ impl Host for Tui {
fn revoked(&self, id: &str) {
super::panel::close(self, id);
// A dialog surface on screen mounts again from the registration that replaced the one that ended.
let reloaded = id.to_owned();
self.app.defer(bind!(self, |tui, _| super::panel::remount(&tui, &reloaded)));
// A reload of the plugin's registrations replaced the one that ended, which has the panel too: the panel stays
// open and mounts again from the new one, as TS takes a registration without closing it (CT-29). A plugin that
// failed or ended loses it.
@@ -892,6 +892,21 @@ fn surface(tui: &Tui, owner: Owner, shown: abi::DialogSurface) {
tui.dialogs.set_centered(centered);
}
/// A reload of plugin `id`'s registrations ended the mount of its dialog surface on screen: the dialog stays and mounts
/// again from the registration that replaced it, under the same key, so the JS host adopts what it rendered, as a
/// panel does (CT-29). Its handler hears no close.
pub fn remount(tui: &Rc<Tui>, id: &str) {
let Some(body) = tui.reads.surface.borrow().clone() else { return };
if body.owner.borrow().0 != id || !open(tui, id, &body.named) || !tui.plugins.has_dialog(id, &body.surface) {
return;
}
let old = body.mount.borrow_mut().take();
body.body.clear();
drop(old);
let host = super::host::host(tui);
*body.mount.borrow_mut() = tui.plugins.dialog(&*host, id, &body.surface, &body.named, &body.body);
}
impl Body {
/// The frame in the build `cx`: the mount the first time, the same mount in the new theme after.
fn build(self: &Rc<Self>, tui: &Rc<Tui>, cx: &Rc<DialogCx>) -> View {
@@ -124,15 +124,19 @@ four published packages P8 runs draw cell for cell as TS draws them at the check
`focus-input`), as the request of the mount whose render holds it, whichever call runs: what the user types goes
into it, as in TS (`P.8/file-browser`'s `typed`). A field the mount's tree does not hold yet takes the focus if the
mount's next revision shows it, and the focus is dropped if that revision does not (nor does a later one apply it);
a mount that closed takes nothing. A field in no mount (in a dialog of the plugin's own, removed from its mount, or
never added) has no focus on the host, which is reported once. While the plugin's focused
field sits in a route or a panel,
a mount that closed takes nothing. A field in a dialog of the plugin's own is in that dialog's mount and takes the
focus as in TS (CT-37, `P.8/sensitive-encrypt`'s `typed`); a field in no mount (removed from its mount, or never
added) has no focus on the host, which is reported once. While the plugin's focused
field sits in a route, a panel or its dialog,
each key there is its `onKeyDown`, through a listener layer of the surface, which takes it with `preventDefault`
(contract gaps 2); one it does not take goes on to the host's field and keys once the JS host answered, as below.
Only an `onKeyDown` that can take a key holds one for the JS host's answer (below); a field without one, or with one
that only hears keys, holds none, and its typing goes to the host's field at once (cg2-1). A key it declines goes past
the plugin's own commands, which TS's keymap ran before the field's `onKeyDown`, in the state before it ran. TS's `<scrollbox>` draws a scrollbar beside its content
and a field its placeholder in OpenTUI's color; the contract's scroll and field draw the host's (`P.8/file-browser`).
the plugin's own commands, which TS's keymap ran before the field's `onKeyDown`, in the state before it ran. A
`<scrollbox>` draws its scrollbar while its content overflows, in OpenTUI's colors, as TS's does
(`P.8/sidebar-prompt`), and its `focused` prop gives it the host's focus, so the arrows scroll it. A field draws its
placeholder and its colors as the host's (`P.8/file-browser`), and the plugin's text without a color is the host's
white-ish text, where TS's is white (`P.8/sensitive-encrypt`'s panel).
Other field events (`onPaste`, `onKeyUp` and the rest) are reported once.
- **Keys** (CT-11): `renderer.keyInput` is an emitter whose `keypress` listeners hear each key as an OpenTUI key event,
through one global listener layer the plugin registers with its first listener (a listener after setup reloads its
@@ -157,9 +161,10 @@ four published packages P8 runs draw cell for cell as TS draws them at the check
contract's (`P.8/session-manager` `rename`). A select's `actions` are the contract's footer actions, with their
keys, side and selection, and the select stays open as one runs (`P.8/session-time`'s timeline); past 4 the rest are
reported. `ui.dialog.show` shows the plugin's JSX
in the host's panel dialog, bare (only the dialog's frame, as TS's), in the size and place `ui.dialog.set` gives, and
a render that throws closes it. A panel's body is a render tree (`RenderNode`): a `<scrollbox>` in it is a box that does not
scroll (the scroll keys say so, once), an `<input>` in it is its text, and its colors take the dialog's surface.
as the body of the host's dialog (contract ergonomics 2.7): a mount of the plugin's dialog surface, with only the
dialog's frame around it, as TS's, in the size and place `ui.dialog.set` gives, which changes it in place. Its
`<scrollbox>` scrolls and its `<input>` is a field (`P.8/sidebar-prompt`, `P.8/sensitive-encrypt`); a reload of the
plugin's registrations mounts it again and keeps it open, and a render that throws closes it.
- **Pointer**: `onMouseDown`, `onMouseUp` and `onClick` on a box or a text run as a click of the node, with an event
that has its kind and the left button but no position; a node with both a press and a release handler keeps the
press (reported). `onMouseOver`, `onMouseOut`, `onMouseScroll` and `onMouseDrag` are not mapped.
+72
View File
@@ -0,0 +1,72 @@
{
"scenario": "P.8/sensitive-encrypt",
"width": 140,
"height": 34,
"directory": "/tmp/opencode/packages/tui",
"config": {
"experimental": {"new-designs":true},
"plugins": ["./out/npm/node_modules/@max10240/opencode-plugin-sensitive-encrypt"],
"animations": false
},
"args": {
"sessionID": "ses_e"
},
"env": {
"OPENCODE_PARITY_PLUGIN": "npm"
},
"routes": [
{"path":"/api/session/ses_e","json":{"data":{"id":"ses_e","title":"Secrets","projectID":"proj_test","cost":0,"tokens":{"input":0,"output":0,"reasoning":0,"cache":{"read":0,"write":0}},"time":{"created":2,"updated":2},"location":{"directory":"/tmp/opencode/packages/tui"}}}},
{"path":"/api/session","json":{"data":[{"id":"ses_e","title":"Secrets","projectID":"proj_test","cost":0,"tokens":{"input":0,"output":0,"reasoning":0,"cache":{"read":0,"write":0}},"time":{"created":2,"updated":2},"location":{"directory":"/tmp/opencode/packages/tui"}}],"cursor":{}}},
{"path":"/api/session/ses_e/message","json":{"data":[{"id":"msg_2","type":"assistant","agent":"build","model":{"providerID":"provider","id":"model"},"content":[{"type":"text","text":"Done."}],"finish":"stop","time":{"created":2000,"completed":2001}},{"id":"msg_1","type":"user","text":"Hide it","time":{"created":1000}}],"cursor":{}}},
{"path":"/api/session/ses_e/inbox","json":{"data":[]}},
{"method":"POST","path":"/api/rpc/max10240.sensitive-encrypt/keys","json":{"output":{"keys":[{"role":"encrypt","keyID":"key-0001"}],"defaultRole":"encrypt"}}}
],
"steps": [
{"checkpoint":"session","until":"Hide it","fixture":"P.8/sensitive-encrypt/session"},
{"type":"/encrypt-sensitive"},
{"checkpoint":"slash","until":"configured public key","fixture":"P.8/sensitive-encrypt/slash"},
{"keys":["enter"]},
{"checkpoint":"panel","until":"ctrl+t switch","deviation":[{"file":"F16-v2-compat-layer","cells":900,"styleOnly":true}],"fixture":"P.8/sensitive-encrypt/panel"},
{"wait":300},
{"type":"hunter2"},
{"checkpoint":"typed","until":"hunter2","deviation":[{"file":"F16-v2-compat-layer","cells":900,"styleOnly":true}],"fixture":"P.8/sensitive-encrypt/typed"},
{"keys":["escape"]},
{"checkpoint":"closed","until":"Hide it","fixture":"P.8/sensitive-encrypt/closed"}
],
"deviation": "F16-v2-compat-layer",
"requests": {
"writes": [
{"method":"POST","path":"/api/rpc/max10240.sensitive-encrypt/keys","query":{"location[directory]":["/tmp/opencode/packages/tui"],"location[project][canonical]":["/tmp/opencode"],"location[project][directory]":["/tmp/opencode"],"location[project][id]":["proj_test"]},"body":{"input":{}},"status":200,"json":{"output":{"keys":[{"role":"encrypt","keyID":"key-0001"}],"defaultRole":"encrypt"}}}
],
"reads": [
{"method":"GET","path":"/api/agent","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}},
{"method":"GET","path":"/api/command","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}},
{"method":"GET","path":"/api/config","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":[]},
{"method":"GET","path":"/api/experimental/migration/v1","query":{},"status":200,"json":{"status":"completed"}},
{"method":"GET","path":"/api/experimental/session/ses_e/terminal","query":{},"status":200,"json":{"data":[]}},
{"method":"GET","path":"/api/form","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode"}},"data":[]}},
{"method":"GET","path":"/api/fs/list","query":{"location[directory]":["<cwd>"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}},
{"method":"GET","path":"/api/info","query":{},"status":200,"json":{"version":"test","pid":0,"urls":[],"paths":{"tmp":"/tmp"},"capabilities":{"persistentPty":true}}},
{"method":"GET","path":"/api/integration","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}},
{"method":"GET","path":"/api/location","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}}},
{"method":"GET","path":"/api/mcp","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}},
{"method":"GET","path":"/api/mcp/resource","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":{"resources":[],"templates":[]}}},
{"method":"GET","path":"/api/model","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}},
{"method":"GET","path":"/api/plugin","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}},
{"method":"GET","path":"/api/project","query":{},"status":200,"json":[]},
{"method":"GET","path":"/api/provider","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}},
{"method":"GET","path":"/api/reference","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode/packages/tui","canonical":"/tmp/opencode/packages/tui"}},"data":[]}},
{"method":"GET","path":"/api/session","query":{"limit":["200"],"order":["desc"],"parentID":["ses_e"]},"status":200,"json":{"data":[{"id":"ses_e","title":"Secrets","projectID":"proj_test","cost":0,"tokens":{"input":0,"output":0,"reasoning":0,"cache":{"read":0,"write":0}},"time":{"created":2,"updated":2},"location":{"directory":"/tmp/opencode/packages/tui"}}],"cursor":{}}},
{"method":"GET","path":"/api/session/active","query":{},"status":200,"json":{"data":{}}},
{"method":"GET","path":"/api/session/ses_e","query":{},"status":200,"json":{"data":{"id":"ses_e","title":"Secrets","projectID":"proj_test","cost":0,"tokens":{"input":0,"output":0,"reasoning":0,"cache":{"read":0,"write":0}},"time":{"created":2,"updated":2},"location":{"directory":"/tmp/opencode/packages/tui"}}}},
{"method":"GET","path":"/api/session/ses_e/form","query":{},"status":200,"json":{"data":[]}},
{"method":"GET","path":"/api/session/ses_e/inbox","query":{},"status":200,"json":{"data":[]}},
{"method":"GET","path":"/api/session/ses_e/message","query":{"limit":["20"],"order":["desc"]},"status":200,"json":{"data":[{"id":"msg_2","type":"assistant","agent":"build","model":{"providerID":"provider","id":"model"},"content":[{"type":"text","text":"Done."}],"finish":"stop","time":{"created":2000,"completed":2001}},{"id":"msg_1","type":"user","text":"Hide it","time":{"created":1000}}],"cursor":{}}},
{"method":"GET","path":"/api/session/ses_e/permission","query":{},"status":200,"json":{"data":[]}},
{"method":"GET","path":"/api/shell","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}},
{"method":"GET","path":"/api/skill","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":[]}},
{"method":"GET","path":"/api/vcs","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"status":200,"json":{"location":{"directory":"/tmp/opencode/packages/tui","project":{"id":"proj_test","directory":"/tmp/opencode","canonical":"/tmp/opencode"}},"data":{"branch":{"current":"main","default":"main"}}}},
{"method":"POST","path":"/api/rpc/opencode.goal/get","query":{"location[directory]":["/tmp/opencode/packages/tui"]},"body":{"input":{"sessionID":"ses_e"}},"status":200,"json":{"output":null}}
]
}
}
+36
View File
@@ -0,0 +1,36 @@
{"width":140,"height":34,"styles":["#ffffffff #1e1e1eff 0","#eeeeeeff #1e1e1eff 1","#808080ff #0a0a0aff 0","#ffffffff #0a0a0aff 0","#ffffffff #141414ff 0","#3c70b8ff #141414ff 0","#eeeeeeff #141414ff 1","#eeeeeeff #141414ff 0","#eeeeeeff #0a0a0aff 0","#3c70b8ff #0a0a0aff 0","#eeeeeeff #1e1e1eff 0","#808080ff #1e1e1eff 0","#484848ff #0a0a0aff 0","#1e1e1eff #0a0a0aff 0","#808080ff #141414ff 0"],"lines":[
[" Secrets + ",[[0,3],[1,7],[0,22],[2,3],[3,105]]],
[" ",[[3,98],[4,42]]],
[" ┃ Secrets ",[[3,2],[5,1],[4,93],[3,2],[4,2],[6,7],[4,33]]],
[" ┃ Hide it ",[[3,2],[5,1],[4,2],[7,7],[4,84],[3,2],[4,42]]],
[" ┃ ",[[3,2],[5,1],[4,93],[3,2],[4,42]]],
[" ",[[3,98],[4,42]]],
[" Done. ",[[3,5],[8,5],[3,88],[4,42]]],
[" ",[[3,98],[4,42]]],
[" Build · provider/model · 1.0s ",[[3,5],[9,5],[2,24],[3,64],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,2],[0,38],[4,2]]],
[" ⬖ Getting started ✕ ",[[3,98],[4,2],[0,2],[10,1],[0,1],[1,15],[0,16],[11,1],[0,2],[4,2]]],
[" ",[[3,98],[4,2],[0,38],[4,2]]],
[" OpenCode includes free models so ",[[3,98],[4,2],[0,4],[11,32],[0,2],[4,2]]],
[" you can start immediately. ",[[3,98],[4,2],[0,4],[11,26],[0,8],[4,2]]],
[" ",[[3,98],[4,2],[0,38],[4,2]]],
[" Connect from 75+ providers to ",[[3,98],[4,2],[0,4],[11,30],[0,4],[4,2]]],
[" use other models, including ",[[3,98],[4,2],[0,4],[11,28],[0,6],[4,2]]],
[" ┃ Claude, GPT, Gemini etc ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,4],[11,23],[0,11],[4,2]]],
[" ┃ ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,38],[4,2]]],
[" ┃ Connect provider /connect ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,4],[10,16],[0,8],[11,8],[0,2],[4,2]]],
[" ┃ ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,38],[4,2]]],
[" ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ",[[3,2],[12,1],[13,93],[3,2],[4,42]]],
[" /tmp/opencode/packages/tui:main shift+tab agents ctrl+p commands /tmp/opencode/packages/tui:main ",[[3,2],[2,31],[3,30],[8,10],[2,6],[3,2],[8,7],[2,8],[3,2],[4,2],[14,31],[4,9]]],
[" ",[[3,98],[4,42]]]
]}
+36
View File
@@ -0,0 +1,36 @@
{"width":140,"height":34,"styles":["#ffffffff #0c0c0cff 0","#626262ff #0c0c0cff 1","#ffffffff #040404ff 0","#353535ff #040404ff 0","#ffffffff #080808ff 0","#192e4cff #080808ff 0","#626262ff #080808ff 1","#626262ff #080808ff 0","#626262ff #040404ff 0","#192e4cff #040404ff 0","#ffffffff #141414ff 0","#ffffffff #141414ff 1","#666666ff #141414ff 0","#353535ff #0c0c0cff 0","#1e1e1eff #040404ff 0","#626262ff #0c0c0cff 0","#0c0c0cff #040404ff 0","#353535ff #080808ff 0"],"lines":[
[" Secrets + ",[[0,3],[1,7],[0,22],[2,1],[3,1],[2,106]]],
[" ",[[2,98],[4,42]]],
[" ┃ Secrets ",[[2,2],[5,1],[4,93],[2,2],[4,2],[6,7],[4,33]]],
[" ┃ Hide it ",[[2,2],[5,1],[4,2],[7,4],[4,1],[7,2],[4,84],[2,2],[4,42]]],
[" ┃ ",[[2,2],[5,1],[4,93],[2,2],[4,42]]],
[" ",[[2,98],[4,42]]],
[" Done. ",[[2,5],[8,5],[2,88],[4,42]]],
[" ",[[2,98],[4,42]]],
[" Build · provider/mode ",[[2,5],[9,5],[2,1],[3,1],[2,1],[3,13],[10,88],[4,26]]],
[" Encrypt sensitive data esc close ",[[2,26],[10,2],[11,22],[10,64],[4,26]]],
[" ",[[2,26],[10,88],[4,26]]],
[" [Text] File ctrl+t switch ",[[2,26],[10,88],[4,26]]],
[" ",[[2,26],[10,88],[4,26]]],
[" Type any text to encrypt… ",[[2,26],[10,2],[12,25],[10,61],[4,26]]],
[" ",[[2,26],[10,88],[4,26]]],
[" ",[[2,26],[10,88],[4,26]]],
[" ",[[2,26],[10,88],[4,26]]],
[" ",[[2,26],[10,88],[4,26]]],
[" ",[[2,26],[10,88],[4,26]]],
[" ",[[2,26],[10,88],[0,24],[4,2]]],
[" arted ✕ ",[[2,26],[10,88],[1,5],[0,16],[13,1],[0,2],[4,2]]],
[" ",[[2,26],[10,88],[0,24],[4,2]]],
[" Ciphertext output (optional, under $TMPDIR) ncludes free models so ",[[2,26],[10,2],[12,43],[10,43],[13,7],[0,1],[13,4],[0,1],[13,6],[0,1],[13,2],[0,2],[4,2]]],
[" art immediately. ",[[2,26],[10,88],[13,3],[0,1],[13,12],[0,8],[4,2]]],
[" Key: Encrypt (key-0001…) ",[[2,26],[10,88],[0,24],[4,2]]],
[" om 75+ providers to ",[[2,26],[10,88],[13,2],[0,1],[13,3],[0,1],[13,9],[0,1],[13,2],[0,5],[4,2]]],
[" f2 encrypt · ctrl+t text/file · tab output/key · esc close models, including ",[[2,26],[10,88],[13,7],[0,1],[13,9],[0,7],[4,2]]],
[" ┃ Claude, GPT, Gemini etc ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,4],[13,7],[0,1],[13,4],[0,1],[13,6],[0,1],[13,3],[0,11],[4,2]]],
[" ┃ ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,38],[4,2]]],
[" ┃ Connect provider /connect ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,4],[15,7],[0,1],[15,8],[0,8],[13,8],[0,2],[4,2]]],
[" ┃ ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,38],[4,2]]],
[" ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ",[[2,2],[14,1],[16,93],[2,2],[4,42]]],
[" /tmp/opencode/packages/tui:main shift+tab agents ctrl+p commands /tmp/opencode/packages/tui:main ",[[2,2],[3,31],[2,30],[8,9],[2,1],[3,6],[2,2],[8,6],[2,1],[3,8],[2,2],[4,2],[17,31],[4,9]]],
[" ",[[2,98],[4,42]]]
]}
+36
View File
@@ -0,0 +1,36 @@
{"width":140,"height":34,"styles":["#ffffffff #1e1e1eff 0","#eeeeeeff #1e1e1eff 1","#808080ff #0a0a0aff 0","#ffffffff #0a0a0aff 0","#ffffffff #141414ff 0","#3c70b8ff #141414ff 0","#eeeeeeff #141414ff 1","#eeeeeeff #141414ff 0","#eeeeeeff #0a0a0aff 0","#3c70b8ff #0a0a0aff 0","#eeeeeeff #1e1e1eff 0","#808080ff #1e1e1eff 0","#484848ff #0a0a0aff 0","#1e1e1eff #0a0a0aff 0","#808080ff #141414ff 0"],"lines":[
[" Secrets + ",[[0,3],[1,7],[0,22],[2,3],[3,105]]],
[" ",[[3,98],[4,42]]],
[" ┃ Secrets ",[[3,2],[5,1],[4,93],[3,2],[4,2],[6,7],[4,33]]],
[" ┃ Hide it ",[[3,2],[5,1],[4,2],[7,7],[4,84],[3,2],[4,42]]],
[" ┃ ",[[3,2],[5,1],[4,93],[3,2],[4,42]]],
[" ",[[3,98],[4,42]]],
[" Done. ",[[3,5],[8,5],[3,88],[4,42]]],
[" ",[[3,98],[4,42]]],
[" Build · provider/model · 1.0s ",[[3,5],[9,5],[2,24],[3,64],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,2],[0,38],[4,2]]],
[" ⬖ Getting started ✕ ",[[3,98],[4,2],[0,2],[10,1],[0,1],[1,15],[0,16],[11,1],[0,2],[4,2]]],
[" ",[[3,98],[4,2],[0,38],[4,2]]],
[" OpenCode includes free models so ",[[3,98],[4,2],[0,4],[11,32],[0,2],[4,2]]],
[" you can start immediately. ",[[3,98],[4,2],[0,4],[11,26],[0,8],[4,2]]],
[" ",[[3,98],[4,2],[0,38],[4,2]]],
[" Connect from 75+ providers to ",[[3,98],[4,2],[0,4],[11,30],[0,4],[4,2]]],
[" use other models, including ",[[3,98],[4,2],[0,4],[11,28],[0,6],[4,2]]],
[" ┃ Claude, GPT, Gemini etc ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,4],[11,23],[0,11],[4,2]]],
[" ┃ ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,38],[4,2]]],
[" ┃ Connect provider /connect ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,4],[10,16],[0,8],[11,8],[0,2],[4,2]]],
[" ┃ ",[[3,2],[12,1],[0,93],[3,2],[4,2],[0,38],[4,2]]],
[" ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ",[[3,2],[12,1],[13,93],[3,2],[4,42]]],
[" /tmp/opencode/packages/tui:main shift+tab agents ctrl+p commands /tmp/opencode/packages/tui:main ",[[3,2],[2,31],[3,30],[8,10],[2,6],[3,2],[8,7],[2,8],[3,2],[4,2],[14,31],[4,9]]],
[" ",[[3,98],[4,42]]]
]}
+36
View File
@@ -0,0 +1,36 @@
{"width":140,"height":34,"styles":["#ffffffff #1e1e1eff 0","#eeeeeeff #1e1e1eff 1","#808080ff #0a0a0aff 0","#ffffffff #0a0a0aff 0","#ffffffff #141414ff 0","#3c70b8ff #141414ff 0","#eeeeeeff #141414ff 1","#eeeeeeff #141414ff 0","#eeeeeeff #0a0a0aff 0","#3c70b8ff #0a0a0aff 0","#eeeeeeff #1e1e1eff 0","#808080ff #1e1e1eff 0","#fab283ff #0a0a0aff 0","#ffffffff #fab283ff 0","#0a0a0aff #fab283ff 0","#484848ff #0a0a0aff 0","#1e1e1eff #0a0a0aff 0","#808080ff #141414ff 0"],"lines":[
[" Secrets + ",[[0,3],[1,7],[0,22],[2,3],[3,105]]],
[" ",[[3,98],[4,42]]],
[" ┃ Secrets ",[[3,2],[5,1],[4,93],[3,2],[4,2],[6,7],[4,33]]],
[" ┃ Hide it ",[[3,2],[5,1],[4,2],[7,7],[4,84],[3,2],[4,42]]],
[" ┃ ",[[3,2],[5,1],[4,93],[3,2],[4,42]]],
[" ",[[3,98],[4,42]]],
[" Done. ",[[3,5],[8,5],[3,88],[4,42]]],
[" ",[[3,98],[4,42]]],
[" Build · provider/model · 1.0s ",[[3,5],[9,5],[2,24],[3,64],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,42]]],
[" ",[[3,98],[4,2],[0,38],[4,2]]],
[" ⬖ Getting started ✕ ",[[3,98],[4,2],[0,2],[10,1],[0,1],[1,15],[0,16],[11,1],[0,2],[4,2]]],
[" ",[[3,98],[4,2],[0,38],[4,2]]],
[" OpenCode includes free models so ",[[3,98],[4,2],[0,4],[11,32],[0,2],[4,2]]],
[" you can start immediately. ",[[3,98],[4,2],[0,4],[11,26],[0,8],[4,2]]],
[" ",[[3,98],[4,2],[0,38],[4,2]]],
[" Connect from 75+ providers to ",[[3,98],[4,2],[0,4],[11,30],[0,4],[4,2]]],
[" ┃ /encrypt-sensitive Encrypt in-memory text or a file with the configured public key ┃ use other models, including ",[[3,2],[12,1],[13,1],[14,84],[13,7],[15,1],[3,2],[4,2],[0,4],[11,28],[0,6],[4,2]]],
[" ┃ Claude, GPT, Gemini etc ",[[3,2],[15,1],[0,93],[3,2],[4,2],[0,4],[11,23],[0,11],[4,2]]],
[" ┃ /encrypt-sensitive ",[[3,2],[15,1],[0,2],[10,18],[0,73],[3,2],[4,2],[0,38],[4,2]]],
[" ┃ Connect provider /connect ",[[3,2],[15,1],[0,93],[3,2],[4,2],[0,4],[10,16],[0,8],[11,8],[0,2],[4,2]]],
[" ┃ ",[[3,2],[15,1],[0,93],[3,2],[4,2],[0,38],[4,2]]],
[" ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ",[[3,2],[15,1],[16,93],[3,2],[4,42]]],
[" /tmp/opencode/packages/tui:main shift+tab agents ctrl+p commands /tmp/opencode/packages/tui:main ",[[3,2],[2,31],[3,30],[8,10],[2,6],[3,2],[8,7],[2,8],[3,2],[4,2],[17,31],[4,9]]],
[" ",[[3,98],[4,42]]]
]}
+36
View File
@@ -0,0 +1,36 @@
{"width":140,"height":34,"styles":["#ffffffff #0c0c0cff 0","#626262ff #0c0c0cff 1","#ffffffff #040404ff 0","#353535ff #040404ff 0","#ffffffff #080808ff 0","#192e4cff #080808ff 0","#626262ff #080808ff 1","#626262ff #080808ff 0","#626262ff #040404ff 0","#192e4cff #040404ff 0","#ffffffff #141414ff 0","#ffffffff #141414ff 1","#353535ff #0c0c0cff 0","#666666ff #141414ff 0","#1e1e1eff #040404ff 0","#626262ff #0c0c0cff 0","#0c0c0cff #040404ff 0","#353535ff #080808ff 0"],"lines":[
[" Secrets + ",[[0,3],[1,7],[0,22],[2,1],[3,1],[2,106]]],
[" ",[[2,98],[4,42]]],
[" ┃ Secrets ",[[2,2],[5,1],[4,93],[2,2],[4,2],[6,7],[4,33]]],
[" ┃ Hide it ",[[2,2],[5,1],[4,2],[7,4],[4,1],[7,2],[4,84],[2,2],[4,42]]],
[" ┃ ",[[2,2],[5,1],[4,93],[2,2],[4,42]]],
[" ",[[2,98],[4,42]]],
[" Done. ",[[2,5],[8,5],[2,88],[4,42]]],
[" ",[[2,98],[4,42]]],
[" Build · provider/mode ",[[2,5],[9,5],[2,1],[3,1],[2,1],[3,13],[10,88],[4,26]]],
[" Encrypt sensitive data esc close ",[[2,26],[10,2],[11,22],[10,64],[4,26]]],
[" ",[[2,26],[10,88],[4,26]]],
[" [Text] File ctrl+t switch ",[[2,26],[10,88],[4,26]]],
[" ",[[2,26],[10,88],[4,26]]],
[" hunter2 ",[[2,26],[10,88],[4,26]]],
[" ",[[2,26],[10,88],[4,26]]],
[" ",[[2,26],[10,88],[4,26]]],
[" ",[[2,26],[10,88],[4,26]]],
[" ",[[2,26],[10,88],[4,26]]],
[" ",[[2,26],[10,88],[4,26]]],
[" ",[[2,26],[10,88],[0,24],[4,2]]],
[" arted ✕ ",[[2,26],[10,88],[1,5],[0,16],[12,1],[0,2],[4,2]]],
[" ",[[2,26],[10,88],[0,24],[4,2]]],
[" Ciphertext output (optional, under $TMPDIR) ncludes free models so ",[[2,26],[10,2],[13,43],[10,43],[12,7],[0,1],[12,4],[0,1],[12,6],[0,1],[12,2],[0,2],[4,2]]],
[" art immediately. ",[[2,26],[10,88],[12,3],[0,1],[12,12],[0,8],[4,2]]],
[" Key: Encrypt (key-0001…) ",[[2,26],[10,88],[0,24],[4,2]]],
[" om 75+ providers to ",[[2,26],[10,88],[12,2],[0,1],[12,3],[0,1],[12,9],[0,1],[12,2],[0,5],[4,2]]],
[" f2 encrypt · ctrl+t text/file · tab output/key · esc close models, including ",[[2,26],[10,88],[12,7],[0,1],[12,9],[0,7],[4,2]]],
[" ┃ Claude, GPT, Gemini etc ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,4],[12,7],[0,1],[12,4],[0,1],[12,6],[0,1],[12,3],[0,11],[4,2]]],
[" ┃ ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,38],[4,2]]],
[" ┃ Connect provider /connect ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,4],[15,7],[0,1],[15,8],[0,8],[12,8],[0,2],[4,2]]],
[" ┃ ",[[2,2],[14,1],[0,93],[2,2],[4,2],[0,38],[4,2]]],
[" ╹▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ",[[2,2],[14,1],[16,93],[2,2],[4,42]]],
[" /tmp/opencode/packages/tui:main shift+tab agents ctrl+p commands /tmp/opencode/packages/tui:main ",[[2,2],[3,31],[2,30],[8,9],[2,1],[3,6],[2,2],[8,6],[2,1],[3,8],[2,2],[4,2],[17,31],[4,9]]],
[" ",[[2,98],[4,42]]]
]}
@@ -36,6 +36,7 @@ host through the V2 compatibility layer. Before a scenario runs, each side unpac
| `@prevalentware__opencode-goal-plugin.tgz` | `@prevalentware/opencode-goal-plugin@0.1.98` (ports-trio) | `sha512-XjpdkZYOo4RHYgLOC6OW6mod4j5BtO6I0YATgpwDJATx+p9+Dvj/Mam6/DS/X1SjNPYt8Sk5/9lQG/EFCHmFgQ==` |
| `opencode-session-time.tgz` | `opencode-session-time@0.4.0` (contract 2.x, addition 4) | `sha512-3dqk6Ok8TkvyMkN1qh8MMsw47v+XsNv20cdbaMtzc1OMZHKi5sMHp5NQuAGRviKU5pULEKz3iqCYXYX5U8bP2w==` |
| `opencode-good-fences.tgz` | `opencode-good-fences@0.1.0` (contract 2.x, addition 3) | `sha512-JgzWS0Fsx3WeFvQQC8v7ohjvkgB0T2U35yx96HoihfECEozv79ROjPZdhSWzWC5qaqoplXk5/lI1/kIsLQDvZA==` |
| `@max10240__opencode-plugin-sensitive-encrypt.tgz` | `@max10240/opencode-plugin-sensitive-encrypt@1.0.31` (catalog CT-37) | `sha512-mPYwVvaZ7aBpzjkcr4BZ9KNCcLJr6gkB267UOUqtDZNaPSKtjLQKmC9UGfp9Lvq8/kGebcmolE+xow1SbF8WWA==` |
`integrity.json` pins the same digests; TS's recorder (`parity/app/scenarios.test.tsx`) and the Rust rows
(`crates/tui/tests/all/{app,plugin_published}.rs`) refuse a tarball whose SHA-512 is not its pin before they unpack it.
@@ -26,5 +26,6 @@
"@bybrawe__opencode-queue-manager.tgz": "sha512-rrRhrULk2R35EU4hpklzLfXxC0TA6SPPWGVfmDAcftjVF2TIsqpEswgEaW051+Z3X0n+9zzUYWsATbT6Lijj4w==",
"@prevalentware__opencode-goal-plugin.tgz": "sha512-XjpdkZYOo4RHYgLOC6OW6mod4j5BtO6I0YATgpwDJATx+p9+Dvj/Mam6/DS/X1SjNPYt8Sk5/9lQG/EFCHmFgQ==",
"opencode-session-time.tgz": "sha512-3dqk6Ok8TkvyMkN1qh8MMsw47v+XsNv20cdbaMtzc1OMZHKi5sMHp5NQuAGRviKU5pULEKz3iqCYXYX5U8bP2w==",
"opencode-good-fences.tgz": "sha512-JgzWS0Fsx3WeFvQQC8v7ohjvkgB0T2U35yx96HoihfECEozv79ROjPZdhSWzWC5qaqoplXk5/lI1/kIsLQDvZA=="
"opencode-good-fences.tgz": "sha512-JgzWS0Fsx3WeFvQQC8v7ohjvkgB0T2U35yx96HoihfECEozv79ROjPZdhSWzWC5qaqoplXk5/lI1/kIsLQDvZA==",
"@max10240__opencode-plugin-sensitive-encrypt.tgz": "sha512-mPYwVvaZ7aBpzjkcr4BZ9KNCcLJr6gkB267UOUqtDZNaPSKtjLQKmC9UGfp9Lvq8/kGebcmolE+xow1SbF8WWA=="
}
@@ -0,0 +1,52 @@
// CT-37: `@max10240/opencode-plugin-sensitive-encrypt@1.0.31`, unmodified from npm: `/encrypt-sensitive` asks its
// server part for the keys, then shows a panel of its own (`ui.dialog.show`) whose text field takes the focus, so what
// the user types is the field's. The field was in no mount, so it took no focus and the typing was lost; the dialog's
// body is now a mount (contract ergonomics 2.7). TS loads the package from node_modules; the Rust client runs the
// same files on the JS host through the V2 compatibility layer. Its server part is not running: the scenario answers
// its `keys`.
import { assistant, defineApp, session, user } from "../../lib/app"
const id = "ses_e"
const colors = [{ file: "F16-v2-compat-layer", cells: 900, styleOnly: true }]
export default defineApp({
width: 140,
height: 34,
config: {
experimental: { "new-designs": true },
plugins: ["./out/npm/node_modules/@max10240/opencode-plugin-sensitive-encrypt"],
},
env: { OPENCODE_PARITY_PLUGIN: "npm" },
args: { sessionID: id },
routes: [
{ path: `/api/session/${id}`, json: { data: session(id, "Secrets", { updated: 2 }) } },
{ path: "/api/session", json: { data: [session(id, "Secrets", { updated: 2 })], cursor: {} } },
{
path: `/api/session/${id}/message`,
json: { data: [assistant("msg_2", "Done.", 2000), user("msg_1", "Hide it", 1000)], cursor: {} },
},
{ path: `/api/session/${id}/inbox`, json: { data: [] } },
{
method: "POST",
path: "/api/rpc/max10240.sensitive-encrypt/keys",
json: { output: { keys: [{ role: "encrypt", keyID: "key-0001" }], defaultRole: "encrypt" } },
},
],
// The context's location sends its directory alone in the RPC's query (F16-v2-compat-layer).
requests: { deviation: "F16-v2-compat-layer" },
steps: [
{ checkpoint: "session", until: "Hide it" },
{ type: "/encrypt-sensitive" },
// The completion lists the plugin's command before Enter (file-browser-flake).
{ checkpoint: "slash", until: "configured public key" },
{ keys: ["enter"] },
// The plugin's text without a color, and its fields, draw in the host's colors (F16-v2-compat-layer).
{ checkpoint: "panel", until: "ctrl+t switch", deviation: colors },
// The field takes the focus a moment after the panel mounts (the plugin's own 50 ms timer).
{ wait: 300 },
{ type: "hunter2" },
{ checkpoint: "typed", until: "hunter2", deviation: colors },
{ keys: ["escape"] },
{ checkpoint: "closed", until: "Hide it" },
],
})