kaizen-agent 1.85.0 → 1.85.1
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/package.json +1 -1
- package/web/board/home-ws.ts +20 -9
- package/web/board/phone.ts +8 -5
- package/web/board.html +7 -1
- package/web/board.js +108 -108
- package/web/notebook.js +1 -1
- package/web/term.js +1 -1
- package/web/video.js +1 -1
package/package.json
CHANGED
package/web/board/home-ws.ts
CHANGED
|
@@ -46,8 +46,8 @@ async function refresh() {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// No `yolo`: the server applies that agent's saved bypass setting, as a run workspace's + does by default.
|
|
49
|
-
async function start(agent?: string) {
|
|
50
|
-
const r = await fetch("/shell", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ home: true, ...(agent ? { agent } : {}) }) }).catch(() => null);
|
|
49
|
+
async function start(agent?: string, yolo?: boolean) {
|
|
50
|
+
const r = await fetch("/shell", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ home: true, ...(agent ? { agent, ...(yolo ? { yolo } : {}) } : {}) }) }).catch(() => null);
|
|
51
51
|
if (!r?.ok) {
|
|
52
52
|
let why = "";
|
|
53
53
|
try { why = (await r!.json()).error; } catch {}
|
|
@@ -172,29 +172,31 @@ function drag(el: HTMLElement, handle: HTMLElement, key: string, skip: (e: Point
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
// Search, the resource monitor and the phone's Agents list open a terminal by kz-open-term: a Home one
|
|
175
|
-
// opens in this panel
|
|
175
|
+
// opens in this panel (full screen on a phone). Registered at import, so ahead of the run view's
|
|
176
176
|
// listener (initRunView), which would open a workspace view that does not exist for it.
|
|
177
177
|
if (typeof window !== "undefined")
|
|
178
178
|
addEventListener("kz-open-term", (e: any) => {
|
|
179
179
|
if (!isHomeDir(e.detail?.dir)) return;
|
|
180
180
|
e.preventDefault();
|
|
181
181
|
e.stopImmediatePropagation();
|
|
182
|
-
if (
|
|
182
|
+
if (!$("hws")) return void (location.href = "/?view=terminal");
|
|
183
183
|
on = String(e.detail.key ?? "");
|
|
184
184
|
st = "open";
|
|
185
|
-
save();
|
|
185
|
+
if (!isPhone()) save(); // a phone opens Home only when asked, never on the next page load
|
|
186
186
|
void refresh();
|
|
187
187
|
});
|
|
188
188
|
|
|
189
189
|
export function initHomeWs() {
|
|
190
190
|
if (!$("plist")) return;
|
|
191
|
-
|
|
191
|
+
// A phone shows Home full screen, only when asked: it never opens by itself on a page load.
|
|
192
|
+
try { const v = localStorage.getItem(KEY); if (!isPhone() && (v === "open" || v === "min")) st = v; } catch {}
|
|
192
193
|
// Sent here by wsHref() for a Home terminal (Search on the notebook or video page).
|
|
193
194
|
const q = new URLSearchParams(location.search);
|
|
194
195
|
if (q.has("homews")) {
|
|
195
196
|
q.delete("homews");
|
|
196
197
|
history.replaceState(history.state, "", "/?" + q);
|
|
197
|
-
|
|
198
|
+
st = "open";
|
|
199
|
+
if (!isPhone()) save();
|
|
198
200
|
}
|
|
199
201
|
document.body.insertAdjacentHTML(
|
|
200
202
|
"beforeend",
|
|
@@ -206,11 +208,20 @@ export function initHomeWs() {
|
|
|
206
208
|
`<div class="plist hwsslot" id="hwsrow" hidden><div class="pgrp"><button type="button" class="proj" id="hwsopen" title="Home workspace: agents outside any project (Ctrl+Alt+A)"><svg class="plogo hwsico" aria-hidden="true"><use href="#i-home"/></svg><span class="pname">Home</span><span class="c"></span></button><button type="button" class="wadd hwsrx" id="hwsrx" title="Close the Home workspace" aria-label="Close the Home workspace"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 7l10 10M17 7 7 17" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button></div></div>`,
|
|
207
209
|
);
|
|
208
210
|
const p = $("hws");
|
|
209
|
-
drag(p, p.querySelector<HTMLElement>(".hwsh")!, "kz-home-ws-at", (e) => max || !!(e.target as Element).closest("button,summary,.menu-pop"));
|
|
211
|
+
drag(p, p.querySelector<HTMLElement>(".hwsh")!, "kz-home-ws-at", (e) => isPhone() || max || !!(e.target as Element).closest("button,summary,.menu-pop"));
|
|
210
212
|
drag($("hwsbtn"), $("hwsbtn"), "kz-home-ws-btn", () => false);
|
|
211
213
|
$("hwsbtn").onclick = () => (dragged ? (dragged = false) : toggleHome());
|
|
212
214
|
$("hwsopen").onclick = () => set("open");
|
|
213
|
-
$("hwsrx").onclick =
|
|
215
|
+
$("hwsrx").onclick = () => void closeAll();
|
|
216
|
+
// On a phone × goes back and leaves the agents running (a tab's × ends one); on a computer it ends them all.
|
|
217
|
+
$("hwsx").onclick = () => (isPhone() ? ((st = "closed"), draw()) : void closeAll());
|
|
218
|
+
// The phone's New sheet starts an agent or a shell here ("Home — no project").
|
|
219
|
+
addEventListener("kz-home-start", (e: any) => {
|
|
220
|
+
st = "open";
|
|
221
|
+
if (!isPhone()) save();
|
|
222
|
+
draw();
|
|
223
|
+
void start(e.detail?.agent || undefined, !!e.detail?.yolo);
|
|
224
|
+
});
|
|
214
225
|
$("hwsmin").onclick = () => set("min");
|
|
215
226
|
$("hwsmax").onclick = () => ((max = !max), draw());
|
|
216
227
|
const add = $("hwsadd") as HTMLDetailsElement;
|
package/web/board/phone.ts
CHANGED
|
@@ -80,19 +80,22 @@ function pickAgent(rows: { a: Agent; st: Status }[]) {
|
|
|
80
80
|
async function newSheet(dir?: string, ws?: string) {
|
|
81
81
|
const spots = (railData().projects ?? []).flatMap((p) => (p.workspaces ?? []).map((w) => ({ dir: p.dir as string, ws: w.path as string, name: w.branch || w.path.split(/[\\/]/).pop() })));
|
|
82
82
|
const first = agentGroups(Date.now())[0]?.rows[0].a;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const list = await fetch("/agents?dir=" + encodeURIComponent(on.dir)).then((r) => r.json(), () => null);
|
|
83
|
+
// Home (no project) is listed first; it is picked when no project workspace is in view.
|
|
84
|
+
const on = spots.find((x) => x.dir === (dir ?? first?.dir) && x.ws === (ws ?? first?.ws)) ?? null;
|
|
85
|
+
const list = await fetch(on ? "/agents?dir=" + encodeURIComponent(on.dir) : "/agents?home=1").then((r) => r.json(), () => null);
|
|
86
86
|
const kinds: { cmd: string; name: string; yolo?: boolean; bypassDefault?: boolean }[] = [...(list?.agents ?? []), { cmd: "", name: "Shell" }];
|
|
87
87
|
const d = document.createElement("dialog");
|
|
88
88
|
d.className = "pagsheet";
|
|
89
|
-
d.innerHTML = String(html`<h4>New in</h4><select class="sel" aria-label="Workspace">${spots.map((x, i) => html`<option value="${String(i)}"${raw(x === on ? " selected" : "")}>${projName(x.dir)} ${x.name}</option>`)}</select><label class="agent-yolo"><span>Yolo / bypass permissions<small>Run commands without permission prompts</small></span>${toggleSwitch(!!list?.agents?.find((a) => a.cmd === list.default)?.bypassDefault, { box: true, attrs: { "aria-label": "Yolo / bypass permissions" } })}</label>${kinds.map((k, i) => html`<button type="button" data-i="${String(i)}">${k.cmd ? agentIco({ agent: k.cmd } as Agent) : raw(`<svg class="pag-ico" aria-hidden="true"><use href="#i-term"/></svg>`)}${k.name}</button>`)}`);
|
|
89
|
+
d.innerHTML = String(html`<h4>New in</h4><select class="sel" aria-label="Workspace"><option value="home"${raw(on ? "" : " selected")}>Home — no project</option>${spots.map((x, i) => html`<option value="${String(i)}"${raw(x === on ? " selected" : "")}>${projName(x.dir)} ${x.name}</option>`)}</select><label class="agent-yolo"><span>Yolo / bypass permissions<small>Run commands without permission prompts</small></span>${toggleSwitch(!!list?.agents?.find((a) => a.cmd === list.default)?.bypassDefault, { box: true, attrs: { "aria-label": "Yolo / bypass permissions" } })}</label>${kinds.map((k, i) => html`<button type="button" data-i="${String(i)}">${k.cmd ? agentIco({ agent: k.cmd } as Agent) : raw(`<svg class="pag-ico" aria-hidden="true"><use href="#i-term"/></svg>`)}${k.name}</button>`)}`);
|
|
90
90
|
d.addEventListener("click", async (e) => {
|
|
91
91
|
const b = (e.target as HTMLElement).closest<HTMLButtonElement>("button");
|
|
92
92
|
if (e.target === d) return d.close();
|
|
93
93
|
if (!b) return;
|
|
94
|
-
const
|
|
94
|
+
const pick = d.querySelector("select")!.value, cmd = kinds[Number(b.dataset.i)].cmd;
|
|
95
95
|
d.close();
|
|
96
|
+
// Home: the Home window starts it (POST /shell {home:true}) and opens full screen.
|
|
97
|
+
if (pick === "home") return void dispatchEvent(new CustomEvent("kz-home-start", { detail: { agent: cmd, yolo: !!kinds[Number(b.dataset.i)].yolo && !!d.querySelector<HTMLInputElement>('input[type="checkbox"]')?.checked } }));
|
|
98
|
+
const at = spots[Number(pick)];
|
|
96
99
|
const r = await fetch("/shell", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ dir: at.dir, ws: at.ws, run: wsKey(at.dir, at.ws), ...(cmd ? { agent: cmd, yolo: !!kinds[Number(b.dataset.i)].yolo && d.querySelector<HTMLInputElement>('input[type="checkbox"]')!.checked } : {}) }) }).catch(() => null);
|
|
97
100
|
const sh = r?.ok ? await r.json() : null;
|
|
98
101
|
if (sh) openTerm({ dir: at.dir, ws: at.ws, key: sh.key } as Agent);
|
package/web/board.html
CHANGED
|
@@ -682,7 +682,11 @@ body.runv #runv{grid-area:1/1;display:flex;flex-direction:column;min-width:0;min
|
|
|
682
682
|
.hwsb{flex:1;min-height:0;display:flex;flex-direction:column;background:var(--bg)}.hwsb .term{flex:1;min-height:0;padding:6px 0 0 8px}.hwsb .term .xterm{height:100%}.hwsb .term .xterm-viewport{background:transparent!important}.hwsempty{margin:auto;color:var(--dim);font-size:var(--fs-s)}
|
|
683
683
|
.hwsbtn{position:fixed;z-index:34;right:16px;bottom:calc(var(--foot-h,0px) + 16px);width:40px;height:40px;display:grid;place-items:center;border-radius:50%;background:var(--bg-2);color:var(--ink);border:1px solid var(--line);box-shadow:var(--shadow-2)}.hwsbtn:hover{color:var(--ink-hi);background:color-mix(in srgb,var(--bg-2) 85%,var(--ink))}.hwsbtn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.hwsbtn[hidden]{display:none}.hwsbtn:focus-visible,.hws button:focus-visible{outline:2px solid var(--accent)}
|
|
684
684
|
.rail .plist.hwsslot{flex:none;min-height:0;overflow:visible}.rail .plist.hwsslot[hidden]{display:none}.hwsslot .proj .c{margin-left:auto}.hwsslot .wadd{opacity:.6}.hwsslot .plogo.hwsico{background:none;color:var(--ink);fill:none;stroke:currentColor;stroke-width:1.8;stroke-linejoin:round}[data-rail=min] .hwsslot .proj .hwsico use{display:inline}
|
|
685
|
-
@media(max-width:640px){.
|
|
685
|
+
@media(max-width:640px){.hwsbtn,.hwsslot{display:none!important}
|
|
686
|
+
/* On a phone Home opens full screen (from the New sheet or a tapped Home agent), over the page and its bars. */
|
|
687
|
+
.hws{position:fixed;inset:0!important;width:auto!important;height:auto!important;min-width:0;min-height:0;max-width:none;max-height:none;border:0;border-radius:0;box-shadow:none;z-index:60;resize:none;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}.hws[hidden]{display:none}
|
|
688
|
+
.hwsh{height:48px;cursor:default;padding:0 4px 0 12px}#hwsmin,#hwsmax{display:none}.hwsh #hwsx{width:40px;height:40px}.hwsh .radd>summary{width:40px;height:40px}
|
|
689
|
+
.hwstab{min-width:0;max-width:160px;padding:0 4px 0 10px}.hwstab i{width:28px;height:28px;opacity:.6}}
|
|
686
690
|
.radd{position:relative}.radd summary{list-style:none}.radd summary::-webkit-details-marker{display:none}
|
|
687
691
|
.radd .menu-pop{position:fixed;z-index:20;right:auto;bottom:auto;width:max-content;margin-top:0;min-width:250px;padding:5px;background:var(--bg-2);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--shadow-2);display:flex;flex-direction:column}
|
|
688
692
|
.radd .menu-pop button{display:grid;grid-template-columns:18px 1fr;gap:10px;align-items:start;text-align:left;padding:7px 9px;border-radius:var(--r)}.radd .menu-pop button:hover{background:var(--hover)}.radd .menu-pop svg{width:16px;height:16px;margin-top:1px}.radd small{display:block;color:var(--dim);font-size:11.5px}.radd .agent-yolo{margin:0 0 4px;padding:7px 9px;border-block:0;border-bottom:1px solid var(--line);border-radius:0;font-size:13px}
|
|
@@ -738,6 +742,8 @@ body.runv.rflip #panel::before{content:"";position:absolute;top:7px;left:50%;wid
|
|
|
738
742
|
#rtabs .rtab span{max-width:110px;overflow:hidden;text-overflow:ellipsis}}
|
|
739
743
|
/* A phone: the panel is a sheet opened from the run tab (#rside); compact tabs */
|
|
740
744
|
@media(max-width:640px){body.runv #rbar{height:40px;min-height:40px;padding:0 10px 4px 10px;border-bottom:1px solid var(--line)}body.runv #rtabs{height:36px;min-height:36px;padding:0;gap:4px}body.runv #rtabs .rtab{min-height:32px;height:32px;padding:0 10px;font-size:12px;border-radius:var(--r-s)}body.runv #rtabs .rtab i{padding:0 2px 0 6px}body.runv #rbar :is(.rbtn,.ib.xs){min-height:32px;height:32px;min-width:32px;width:32px;padding:0;border-radius:var(--r-s)}body.runv #rbar :is(.rbtn,.ib.xs) svg{width:16px;height:16px}body.runv #pnotes{width:44px;height:44px}body.runv #pfoot details button{min-height:44px}body .termtools button{min-width:40px;min-height:40px}body.runv #ptabs button{width:44px;height:44px}body.runv #pclose{width:44px;height:44px}body.runv #pfoot .btn{min-height:44px}}
|
|
745
|
+
/* Phone workspace tabs in the Orca style too: flat, an underline under the active one, × at the end, finger-sized. */
|
|
746
|
+
@media(max-width:640px){body.runv #rbar{padding-bottom:0}body.runv #rtabs{height:40px;min-height:40px;align-items:stretch;gap:0}body.runv #rtabs>:not(.rtab){align-self:center}body.runv #rtabs .rtab{height:auto;min-height:0;border-radius:0;background:none;color:var(--dim);gap:6px;padding:0 2px 0 10px}body.runv #rtabs .rtab i{display:grid;place-items:center;width:28px;height:28px;padding:0;margin-left:auto;opacity:.6}body.runv #rtabs .rtab.on{color:var(--ink-hi);background:none;box-shadow:inset 0 -2px var(--ink-hi)}}
|
|
741
747
|
/* Workspace tabs as Orca's: flat, the bar's full height, an underline under the active one, × at the end. */
|
|
742
748
|
@media(min-width:641px){#rtabs{align-items:stretch;gap:0}html body.runv #rtabs{padding-top:0;padding-bottom:0}#rtabs>:not(.rtab){align-self:center}#rtabs>.rtab+:not(.rtab){margin-left:4px}#rtabs .rtab{height:auto;min-width:140px;max-width:240px;padding:0 8px 0 12px;gap:8px;border-radius:0;background:none;color:var(--dim)}#rtabs .rtab span:not(.si){flex:1;min-width:0;max-width:none;text-align:left}#rtabs .rtab i{margin-left:auto;padding:0 4px;opacity:0}#rtabs .rtab:hover i,#rtabs .rtab.on i,#rtabs .rtab i:focus-visible{opacity:.6}#rtabs .rtab i:hover{opacity:1}#rtabs .rtab:hover{color:var(--ink);background:var(--hover)}#rtabs .rtab.on{color:var(--ink-hi);background:none;box-shadow:inset 0 -2px var(--ink-hi)}}
|
|
743
749
|
/* A terminal fills its pane in its own colours (--term-bg, set by web/term.ts from its palette), edge to edge;
|