kaizen-agent 1.55.0 → 1.56.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/cli/chat.ts +8 -1
- package/package.json +1 -1
- package/web/board/home.ts +2 -2
- package/web/board/panel.ts +13 -4
- package/web/board.html +4 -4
- package/web/board.js +18 -18
- package/web/notebook.js +1 -1
- package/web/term.js +21 -21
- package/web/term.ts +54 -35
- package/web/video.js +1 -1
package/web/term.ts
CHANGED
|
@@ -82,9 +82,10 @@ function mountTerm(el: HTMLElement, key: string, onEnd?: () => void): () => void
|
|
|
82
82
|
onEnd?.();
|
|
83
83
|
};
|
|
84
84
|
};
|
|
85
|
-
// Phone/tablet: a
|
|
86
|
-
//
|
|
87
|
-
//
|
|
85
|
+
// Phone/tablet: a row of chips for the keys a soft keyboard lacks, and a message box
|
|
86
|
+
// that types into the agent and presses Enter. Alt is sticky for the next key. Ctrl
|
|
87
|
+
// opens its own a-z pad instead of waiting on the native keyboard, whose IME can
|
|
88
|
+
// deliver the letter without the modifier. ⋯ holds Search, Paste and Raw keyboard.
|
|
88
89
|
const mods = { alt: false };
|
|
89
90
|
const typed = term.onData((d) => {
|
|
90
91
|
if (mods.alt) d = "\x1b" + d;
|
|
@@ -96,24 +97,27 @@ function mountTerm(el: HTMLElement, key: string, onEnd?: () => void): () => void
|
|
|
96
97
|
if (matchMedia("(pointer: coarse)").matches) {
|
|
97
98
|
const arrow = (c: string) => () => `\x1b${term.modes.applicationCursorKeysMode ? "O" : "["}${c}`;
|
|
98
99
|
const paste = () => navigator.clipboard?.readText().then((t) => t && term.paste(t), () => {});
|
|
99
|
-
//
|
|
100
|
-
const keys: [string, string | (() => unknown) | "alt" | "ctrl" | ""][] = [
|
|
101
|
-
["
|
|
102
|
-
["
|
|
100
|
+
// 1-3 answer the agent's numbered prompts; the rest are the keys it asks for most.
|
|
101
|
+
const keys: [string, string | (() => unknown) | "alt" | "ctrl" | "more"][] = [
|
|
102
|
+
["1", "1"], ["2", "2"], ["3", "3"], ["Esc", "\x1b"], ["^C", "\x03"], ["↑", arrow("A")], ["↓", arrow("B")],
|
|
103
|
+
["←", arrow("D")], ["→", arrow("C")], ["↵", "\r"], ["⇧⇥", "\x1b[Z"], ["Ctrl", "ctrl"], ["Alt", "alt"], ["⋯", "more"],
|
|
103
104
|
];
|
|
104
105
|
bar = document.createElement("div");
|
|
105
106
|
bar.className = "termkeys";
|
|
106
|
-
|
|
107
|
+
const msg = document.createElement("input");
|
|
108
|
+
// pointerdown + preventDefault: a tap must not move focus off the terminal, nor
|
|
109
|
+
// close the soft keyboard while the message box is being typed in. The key itself
|
|
110
|
+
// fires on click, which the browser drops when the touch becomes a swipe of the row.
|
|
107
111
|
const key = (label: string, fn: () => void) => {
|
|
108
112
|
const b = document.createElement("button");
|
|
109
113
|
b.type = "button";
|
|
110
114
|
b.textContent = label;
|
|
111
|
-
b.addEventListener("pointerdown", (e) =>
|
|
115
|
+
b.addEventListener("pointerdown", (e) => e.preventDefault());
|
|
116
|
+
b.addEventListener("click", () => { fn(); if (document.activeElement !== msg) term.focus(); });
|
|
112
117
|
return b;
|
|
113
118
|
};
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
const setPad = (on: boolean) => { pad.hidden = !on; grid.hidden = on; };
|
|
119
|
+
const chips = document.createElement("div");
|
|
120
|
+
chips.className = "chips";
|
|
117
121
|
const pad = document.createElement("div");
|
|
118
122
|
pad.className = "ctrlpad";
|
|
119
123
|
pad.hidden = true;
|
|
@@ -122,40 +126,55 @@ function mountTerm(el: HTMLElement, key: string, onEnd?: () => void): () => void
|
|
|
122
126
|
const r = document.createElement("div");
|
|
123
127
|
for (const c of row) r.append(key(c, () => {
|
|
124
128
|
if (c !== "✕") send({ t: "i", d: String.fromCharCode(c.charCodeAt(0) & 31) });
|
|
125
|
-
|
|
129
|
+
pad.hidden = true;
|
|
126
130
|
}));
|
|
127
131
|
pad.append(r);
|
|
128
132
|
}
|
|
133
|
+
// The native keyboard stays shut over the terminal (inputmode none) until Raw keyboard
|
|
134
|
+
// asks for it; the message box below has its own.
|
|
135
|
+
const ta = term.textarea;
|
|
136
|
+
if (ta) ta.inputMode = "none";
|
|
137
|
+
const more = document.createElement("div");
|
|
138
|
+
more.className = "tmore";
|
|
139
|
+
more.hidden = true;
|
|
140
|
+
const raw = key("Raw keyboard", () => {
|
|
141
|
+
more.hidden = true;
|
|
142
|
+
if (!ta) return;
|
|
143
|
+
const on = raw.classList.toggle("on");
|
|
144
|
+
ta.inputMode = on ? "text" : "none";
|
|
145
|
+
ta.blur(); // inputmode is read on focus; the key's term.focus() reopens it
|
|
146
|
+
});
|
|
147
|
+
more.append(key("Search", () => { more.hidden = true; openSearch(); }), key("Paste", () => { more.hidden = true; paste(); }), raw);
|
|
129
148
|
for (const [label, v] of keys) {
|
|
130
|
-
if (!label) { grid.append(document.createElement("i")); continue; }
|
|
131
149
|
const b = key(label, () => {
|
|
132
150
|
if (v === "alt") b.classList.toggle("on", (mods.alt = !mods.alt));
|
|
133
|
-
else if (v === "ctrl")
|
|
151
|
+
else if (v === "ctrl") { pad.hidden = !pad.hidden; more.hidden = true; }
|
|
152
|
+
else if (v === "more") { more.hidden = !more.hidden; pad.hidden = true; }
|
|
134
153
|
else send({ t: "i", d: (typeof v === "function" ? v() : v) as string });
|
|
135
154
|
});
|
|
136
155
|
if (v === "alt") b.classList.add(v);
|
|
137
|
-
|
|
156
|
+
chips.append(b);
|
|
138
157
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
158
|
+
// Send types the text, then Enter a beat later: sent together, a TUI agent reads the
|
|
159
|
+
// pair as a paste and keeps the newline in its input instead of submitting.
|
|
160
|
+
const form = document.createElement("form");
|
|
161
|
+
form.className = "compose";
|
|
162
|
+
msg.placeholder = "Message the agent…";
|
|
163
|
+
msg.enterKeyHint = "send";
|
|
164
|
+
msg.autocomplete = "off";
|
|
165
|
+
msg.setAttribute("aria-label", "Message the agent");
|
|
166
|
+
const go = document.createElement("button");
|
|
167
|
+
go.textContent = "➤";
|
|
168
|
+
go.setAttribute("aria-label", "Send");
|
|
169
|
+
go.addEventListener("pointerdown", (e) => e.preventDefault()); // keep the keyboard up
|
|
170
|
+
form.append(msg, go);
|
|
171
|
+
form.addEventListener("submit", (e) => {
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
if (msg.value) send({ t: "i", d: msg.value });
|
|
174
|
+
msg.value = "";
|
|
175
|
+
setTimeout(() => send({ t: "i", d: "\r" }), 60);
|
|
154
176
|
});
|
|
155
|
-
|
|
156
|
-
top.className = "keytop";
|
|
157
|
-
top.append(hide, kbd);
|
|
158
|
-
bar.append(top, pad, grid);
|
|
177
|
+
bar.append(pad, more, chips, form);
|
|
159
178
|
el.after(bar);
|
|
160
179
|
}
|
|
161
180
|
// xterm.js has no touch scrolling, so on a phone a swipe did nothing. Each line's
|
package/web/video.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* kaizen video page
|
|
1
|
+
/* kaizen video page 06830d1016861613 -- generated by bun run build:web from web/video.ts; do not edit */
|
|
2
2
|
(()=>{var W={TikTok:"9x16","Instagram Reels":"9x16","YouTube Shorts":"9x16","WhatsApp Status":"9x16",YouTube:"16x9","Instagram feed":"4x5"},de={"9x16":[1080,1920],"16x9":[1920,1080],"4x5":[1080,1350]},X=["#b4462f","#a8720a","#2d50a5","#0f8fa3","#1f9d55","#7a4fb5","#c2416b","#5b6b8c"],p=(e)=>document.getElementById(e),l=(e)=>String(e??"").replace(/[&<>"']/g,(t)=>`&#${t.charCodeAt(0)};`),E=(e)=>e==null?"":`${Math.floor(e/60)}:${String(Math.round(e%60)).padStart(2,"0")}`,O=(e)=>(e??"9x16").replace("x",":"),I=(e,t)=>`/video/f/${e.place}/${encodeURIComponent(e.name)}/${t.split("/").map(encodeURIComponent).join("/")}`,ce={draft:"Draft",queued:"Queued",building:"Building preview",rendering:"Rendering",ready:"Ready",failed:"Failed"},_=[],ue=[],pe=[],He=(e,t)=>ue.filter((n)=>n.place===e&&n.name===t).sort((n,i)=>i.at-n.at)[0],D="",Ee;function h(e){let t=p("toast");t.textContent=e,t.classList.add("on"),clearTimeout(Ee),Ee=setTimeout(()=>t.classList.remove("on"),3200)}async function M(e,t){let n=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),i=await n.json().catch(()=>({}));if(!n.ok)throw Error(i.error||i.why||`${n.status}`);return i}async function R(){let e;try{e=await fetch("/video/list")}catch{h("The board is not running");return}let t=await e.json();if(_=t.videos,ue=t.agents??[],pe=t.places,p("emptyhow").innerHTML=`Videos are folders under <code>videos/</code> in ${t.places.map((n)=>`<code>${l(n.dir)}</code>`).join(" or ")}. Ask the kaizen-video skill to make one, and it shows up here.`,me(),y)xe(),Ae();ye()}function De(){return _.flatMap((e)=>{let t=e.outputs.filter((s)=>s.kind!=="history"&&s.kind!=="trying"),n=t.length?t:[null],i=new Map;for(let s of n)if(!i.has(s?.format??e.formats[0]))i.set(s?.format??e.formats[0],s);return[...i].map(([s,a])=>({v:e,f:s,o:a}))})}function me(){let e=p("q").value.trim().toLowerCase().split(/\s+/).filter(Boolean),t=De(),n=t.filter(({v:s})=>{let a=[s.title,s.name,s.text,s.preset,s.where,s.mode,...s.platforms].join(" ").toLowerCase();return(D==="busy"?["queued","building","rendering"].includes(s.status):!D||s.status===D)&&e.every((o)=>a.includes(o))}),i=ue.filter((s)=>s.alive&&!_.some((a)=>a.place===s.place&&a.name===s.name)&&e.every((a)=>s.name.includes(a))&&(!D||D==="busy"||D==="draft"));p("grid").removeAttribute("aria-busy"),p("grid").innerHTML=i.map((s)=>`<article class="vid" tabindex="0" data-p="${s.place}" data-n="${l(s.name)}" aria-label="${l(s.name)}, being made">
|
|
3
3
|
<div class="thumb making" style="--ar:9/16"><span class="t">${s.asking?"Claude is asking you something":"Claude is making this"}</span></div>
|
|
4
4
|
<div class="meta"><b>${l(s.name)}</b><div class="plats"><i class="where">${l(pe[s.place]?.label??"")}</i></div>
|