@thothdev/pink 1.0.10 → 1.0.12
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/CHANGELOG.md +57 -27
- package/NOTICE.md +4 -0
- package/dist/bundle/chunks/chunk-MM3LKT73.js +3 -3
- package/dist/bundle/chunks/chunk-T726RZZU.js +2 -2
- package/examples/extensions/subagent/agents.ts +7 -0
- package/examples/extensions/subagent/background.ts +9 -1
- package/examples/extensions/subagent/external.ts +82 -2
- package/examples/extensions/subagent/pink-i18n.ts +17 -0
- package/extensions/pink-agente.ts +208 -26
- package/extensions/pink-i18n.ts +17 -0
- package/extensions/pink-memory.ts +10 -3
- package/extensions/pink-microfone-lock.json +221 -0
- package/extensions/pink-microfone.ts +393 -0
- package/extensions/pink-sandbox.ts +11 -2
- package/extensions/pink-shell-bg.ts +9 -1
- package/extensions/pink-tela.ts +11 -3
- package/extensions/pink-ui.ts +112 -18
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// A ferramenta continua se chamando bash/powershell e a execução é a original (createBashToolDefinition), então
|
|
6
6
|
// permissões, hooks, RTK e modo plano valem igual. Ao fechar, trocar ou recarregar a sessão os processos são encerrados.
|
|
7
7
|
// Sem tela (pink -p, subagente) o processo acabaria antes do resultado: o comando espera como antes.
|
|
8
|
-
import { t } from "./pink-i18n.ts";
|
|
8
|
+
import { choose, t } from "./pink-i18n.ts";
|
|
9
9
|
import { createBashToolDefinition, createPowerShellToolDefinition, SettingsManager } from "@earendil-works/pi-coding-agent";
|
|
10
10
|
import { Type } from "typebox";
|
|
11
11
|
|
|
@@ -202,6 +202,14 @@ export function createShellJobs(pink: any, { now = Date.now, write = muxWrite }
|
|
|
202
202
|
getArgumentCompletions: (prefix: string) =>
|
|
203
203
|
["encerrar todos", ...[...jobs.keys()].map((id) => `encerrar ${id}`)].filter((item) => item.startsWith(prefix)).map((value) => ({ value, label: value })),
|
|
204
204
|
handler: async (args: string, ctx: any) => {
|
|
205
|
+
if (!args.trim() && jobs.size) {
|
|
206
|
+
const choice = await choose(ctx, "/processos", [
|
|
207
|
+
{ value: "listar", description: t("mostra os que estão rodando", "muestra los que están corriendo", "shows the running ones") },
|
|
208
|
+
...["encerrar todos", ...[...jobs.keys()].map((id) => `encerrar ${id}`)].map((value) => ({ value })),
|
|
209
|
+
]);
|
|
210
|
+
if (choice === undefined) return;
|
|
211
|
+
args = choice === "listar" ? "" : choice;
|
|
212
|
+
}
|
|
205
213
|
const [verb, target] = args.trim().split(/\s+/);
|
|
206
214
|
if (verb === "encerrar" || verb === "stop") {
|
|
207
215
|
const targets = target === "todos" || target === "all" ? [...jobs.values()] : ([find(target)].filter(Boolean) as Job[]);
|
package/extensions/pink-tela.ts
CHANGED
|
@@ -14,7 +14,14 @@ import os from "node:os";
|
|
|
14
14
|
import path from "node:path";
|
|
15
15
|
import { fileURLToPath } from "node:url";
|
|
16
16
|
import { Type } from "typebox";
|
|
17
|
-
import { t } from "./pink-i18n.ts";
|
|
17
|
+
import { type Choice, choose, completeFrom, t } from "./pink-i18n.ts";
|
|
18
|
+
|
|
19
|
+
const TELA_CHOICES = (): Choice[] => [
|
|
20
|
+
{ value: "status", description: t("ligada ou desligada?", "¿activada o desactivada?", "on or off?") },
|
|
21
|
+
{ value: "ligar", description: t("o agente passa a ver e usar a tela", "el agente pasa a ver y usar la pantalla", "the agent can see and use the screen") },
|
|
22
|
+
{ value: "desligar", description: t("o agente para de usar a tela", "el agente deja de usar la pantalla", "the agent stops using the screen") },
|
|
23
|
+
{ value: "instalar", description: t("baixa o cua-driver, uma vez", "descarga el cua-driver, una vez", "downloads the cua-driver, once") },
|
|
24
|
+
];
|
|
18
25
|
|
|
19
26
|
export const READ = ["get_desktop_state", "get_window_state", "list_windows", "list_apps", "get_screen_size", "get_cursor_position"] as const;
|
|
20
27
|
export const ACT = ["click", "double_click", "right_click", "drag", "scroll", "type_text", "press_key", "hotkey", "set_value", "bring_to_front", "launch_app"] as const;
|
|
@@ -636,9 +643,10 @@ export function createTela(pink: any, { env = process.env, run = mcpRun as Run,
|
|
|
636
643
|
|
|
637
644
|
pink.registerCommand("tela", {
|
|
638
645
|
description: t("Acesso à tela do PC: instalar, ligar, desligar ou status (desligado por padrão)", "Acceso a la pantalla del PC: instalar, activar, desactivar o status (apagado por defecto)", "PC screen access: install, on, off or status (off by default)"),
|
|
639
|
-
getArgumentCompletions: (
|
|
646
|
+
getArgumentCompletions: completeFrom(TELA_CHOICES),
|
|
640
647
|
handler: async (args: string, ctx: any) => {
|
|
641
|
-
|
|
648
|
+
let verb: string | undefined = String(args ?? "").trim().split(/\s+/)[0];
|
|
649
|
+
if (!verb && (verb = await choose(ctx, "/tela", TELA_CHOICES())) === undefined) return;
|
|
642
650
|
if (verb === "instalar" || verb === "install") {
|
|
643
651
|
if (on) return ctx.ui.notify(t("Desligue a tela antes de reinstalar (/tela desligar).", "Desactiva la pantalla antes de reinstalar (/tela desactivar).", "Turn the screen off before reinstalling (/tela off)."), "warning");
|
|
644
652
|
const ok = await ctx.ui.confirm(
|
package/extensions/pink-ui.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// The layout functions are pure and exported for tests.
|
|
12
12
|
|
|
13
13
|
import { t } from "./pink-i18n.ts";
|
|
14
|
+
import { micBar } from "./pink-microfone.ts";
|
|
14
15
|
export const LOGO = [
|
|
15
16
|
"██████╗ ██╗███╗ ██╗██╗ ██╗",
|
|
16
17
|
"██╔══██╗██║████╗ ██║██║ ██╔╝",
|
|
@@ -84,7 +85,7 @@ export function homeBottomPad(rows, headerHeight, editorHeight) {
|
|
|
84
85
|
return Math.max(0, rows - 1 - headerHeight - editorHeight);
|
|
85
86
|
}
|
|
86
87
|
|
|
87
|
-
export function inputBox({ theme, content, width, label, inline = false, hints = BOX_HINTS }) {
|
|
88
|
+
export function inputBox({ theme, content, width, label, inline = false, hints = BOX_HINTS, mic = "" }) {
|
|
88
89
|
// `content` are the lines of the built-in editor without its top and bottom borders; the box is exactly `width` wide.
|
|
89
90
|
// Barra rosa cheia à esquerda + fundo, como a barra do OpenCode (owner 2026-10-29, pink.3; antes era a borda inteira);
|
|
90
91
|
// `inline`: o rótulo "Build · modelo" fica à direita da primeira linha (o editor foi desenhado mais estreito para caber);
|
|
@@ -96,15 +97,23 @@ export function inputBox({ theme, content, width, label, inline = false, hints =
|
|
|
96
97
|
const open = theme.bg ? theme.bg("userMessageBg", "\u0000").split("\u0000")[0] : "";
|
|
97
98
|
const keep = (value) => (open ? value.replace(/\x1b\[(?:0|49)?m/g, (reset) => reset + open) : value);
|
|
98
99
|
const row = (value) => `${theme.fg("accent", BAR)}${panel(keep(` ${pad(fit(value, text), text)} `))}`;
|
|
99
|
-
const
|
|
100
|
+
const hint = theme.fg("dim", hints);
|
|
100
101
|
const lines = inline && label ? [footerLine({ theme, width: text, left: content[0] ?? "", right: label }), ...content.slice(1)] : content;
|
|
101
|
-
|
|
102
|
+
const own = !inline && label && visible(label) + 1 + visible(hint) > text;
|
|
103
|
+
const left = inline || !label || own ? "" : theme.fg("muted", label);
|
|
104
|
+
// os botões do microfone (opcional) vão antes das dicas; sem lugar para os dois, as dicas saem
|
|
105
|
+
const tip = mic ? (visible(left) + 1 + visible(mic) + 3 + visible(hint) <= text ? `${mic} ${hint}` : mic) : hint;
|
|
106
|
+
// a coluna onde os botões começam dentro da caixa (a barra e um espaço vêm antes), para o clique
|
|
107
|
+
const at = (rowIndex) => Object.assign(out, mic ? { micAt: { y: rowIndex, x: 2 + Math.max(visible(left) + 1, text - visible(tip)) } } : {});
|
|
108
|
+
let out;
|
|
109
|
+
if (own) {
|
|
102
110
|
// rótulo e dicas não cabem juntos: o rótulo ganha a linha dele, em vez de cortar as dicas
|
|
103
|
-
|
|
111
|
+
out = [row(""), ...lines.map(row), row(""), row(theme.fg("muted", label)), row(footerLine({ theme, width: text, left: "", right: tip })), row("")];
|
|
112
|
+
return at(out.length - 2);
|
|
104
113
|
}
|
|
105
|
-
const last = inline || !label ? footerLine({ theme, width: text, left: "", right: tip }) : footerLine({ theme, width: text, left: theme.fg("muted", label), right: tip });
|
|
106
114
|
// linha vazia também embaixo do rótulo, como a caixa do OpenCode (owner 2026-11-24)
|
|
107
|
-
|
|
115
|
+
out = [row(""), ...lines.map(row), row(""), row(footerLine({ theme, width: text, left, right: tip })), row("")];
|
|
116
|
+
return at(out.length - 2);
|
|
108
117
|
}
|
|
109
118
|
|
|
110
119
|
export function footerLine({ theme, width, left, right }) {
|
|
@@ -282,9 +291,12 @@ export async function savedSnapshot(entries, entryId, cwd, run = runGit) {
|
|
|
282
291
|
// raiz com quatro espaços (top, left, right, bottom) que chamam globalThis.__pinkFrame; sem a extensão, eles ficam invisíveis.
|
|
283
292
|
export const LEFT_WIDTH = 32; // com a borda (pink.3: +2 para o horário de cada sessão)
|
|
284
293
|
export const RIGHT_WIDTH = 36; // com a borda
|
|
294
|
+
const ABOVE_BOX = "pink-acima-da-caixa";
|
|
285
295
|
export const THREE_COLUMNS = 150; // >= 150: sessões, conversa e contexto
|
|
286
296
|
export const TWO_COLUMNS = 115; // 115-149: some a coluna de sessões; < 115: só a conversa
|
|
287
297
|
export const PLACEHOLDER = t("Peça a próxima etapa...", "Pide el siguiente paso...", "Ask for the next step...");
|
|
298
|
+
// enquanto o agente trabalha, como o "esc interrupt" do OpenCode (owner 2026-11-25)
|
|
299
|
+
export const WORK_HINTS = t("esc interromper · ctrl+enter enviar agora", "esc interrumpir · ctrl+enter enviar ya", "esc interrupt · ctrl+enter send now");
|
|
288
300
|
export const BOX_HINTS = t("Enter enviar · shift+tab pensar · ctrl+t ver pensamento", "Enter enviar · shift+tab pensar · ctrl+t ver razonamiento", "Enter send · shift+tab think · ctrl+t show thinking");
|
|
289
301
|
|
|
290
302
|
export function frameColumns(width, { home = false, on = true, sessions = true } = {}) {
|
|
@@ -371,15 +383,6 @@ export function rightColumn({ theme, width, height, data }) {
|
|
|
371
383
|
} else {
|
|
372
384
|
out.push(theme.fg("dim", t("ainda sem medida", "todavía sin medir", "not measured yet")));
|
|
373
385
|
}
|
|
374
|
-
const agents = data.agents ?? [];
|
|
375
|
-
if (agents.length) {
|
|
376
|
-
out.push("", rule(theme, inner), heading(theme, t("SUBAGENTES", "SUBAGENTES", "SUBAGENTS"), theme.fg("muted", ` ${agents.length}`)));
|
|
377
|
-
for (const item of agents) {
|
|
378
|
-
const clock = theme.fg("dim", elapsedLabel((data.now ?? Date.now()) - item.started));
|
|
379
|
-
const text = `${theme.fg("accent", "●")} ${theme.fg("text", String(item.agent ?? "?"))} ${theme.fg("muted", String(item.task ?? "").replace(/\s+/g, " ").trim())}`;
|
|
380
|
-
out.push(footerLine({ theme, width: inner, left: fit(text, Math.max(1, inner - visible(clock) - 1)), right: clock }));
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
386
|
if (data.thoth) out.push("", rule(theme, inner), heading(theme, "THOTH"), ...thothLines({ theme, thoth: data.thoth, width: inner }));
|
|
384
387
|
if (data.plan) out.push("", rule(theme, inner), heading(theme, t("COTA", "CUOTA", "QUOTA")), ...planLines({ theme, plan: data.plan, width: inner }));
|
|
385
388
|
if (data.mcp) {
|
|
@@ -411,10 +414,32 @@ export function rightColumn({ theme, width, height, data }) {
|
|
|
411
414
|
if (data.models?.length) out.push(theme.fg("muted", `${t("modelo", "modelo", "model")} ${data.models.map(shortModel).join(", ")}`));
|
|
412
415
|
if (data.cost > 0) out.push(theme.fg("muted", `$${data.cost.toFixed(2)} ${t("gasto", "gastado", "spent")}`));
|
|
413
416
|
if (data.project) out.push(theme.fg("muted", `${t("projeto", "proyecto", "project")} ${data.project}`));
|
|
417
|
+
// SUBAGENTES por último, abaixo da SESSÃO (owner 2026-11-25): a lista cresce no espaço livre do fim da coluna
|
|
418
|
+
const agents = data.agents ?? [];
|
|
419
|
+
if (agents.length) {
|
|
420
|
+
out.push("", rule(theme, inner), heading(theme, t("SUBAGENTES", "SUBAGENTES", "SUBAGENTS"), theme.fg("muted", ` ${agents.length}`)));
|
|
421
|
+
for (const item of agents) out.push(agentLine(theme, item, inner, data.now));
|
|
422
|
+
}
|
|
414
423
|
const lines = out.slice(0, height).map((line) => pad(fit(line, inner), inner));
|
|
415
424
|
return [...lines, ...Array(Math.max(0, height - lines.length)).fill(" ".repeat(inner))].map((line) => `${theme.fg("borderMuted", "│")} ${line} `);
|
|
416
425
|
}
|
|
417
426
|
|
|
427
|
+
// uma linha de SUBAGENTES: "● persona tarefa ........ 12s" (coluna da direita e a lista acima da caixa)
|
|
428
|
+
export function agentLine(theme, item, width, now = Date.now()) {
|
|
429
|
+
const clock = theme.fg("dim", item.clock ?? elapsedLabel(now - item.started));
|
|
430
|
+
const text = `${theme.fg(item.mark === "✗" ? "error" : item.mark === "✓" ? "success" : "accent", item.mark ?? "●")} ${theme.fg("text", String(item.agent ?? "?"))} ${theme.fg("muted", String(item.task ?? "").replace(/\s+/g, " ").trim())}`;
|
|
431
|
+
return footerLine({ theme, width, left: fit(text, Math.max(1, width - visible(clock) - 1)), right: clock });
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Acima da caixa enquanto o Pink trabalha (owner 2026-11-25): os subagentes quando a coluna da direita não está na tela
|
|
435
|
+
// (modo regular ou terminal estreito) e, por último, uma linha vazia que separa o "Trabalhando" da caixa de digitar.
|
|
436
|
+
// Os de segundo plano não entram: o pink-subagent-bg já os lista embaixo da caixa sem a coluna.
|
|
437
|
+
export function aboveBox(theme, width, { agents = [], side = false, now = Date.now() } = {}) {
|
|
438
|
+
const shown = side ? [] : agents;
|
|
439
|
+
const head = shown.length ? [` ${theme.fg("muted", `${t("SUBAGENTES", "SUBAGENTES", "SUBAGENTS")} ${shown.length}`)}`, ...shown.map((item) => ` ${agentLine(theme, item, Math.max(10, width - 2), now)}`)] : [];
|
|
440
|
+
return [...head, ""];
|
|
441
|
+
}
|
|
442
|
+
|
|
418
443
|
export const MAX_CHANGES = 5;
|
|
419
444
|
|
|
420
445
|
// subagentes rodando agora: os de segundo plano (pink-subagent-bg) e os que a conversa está esperando (ferramenta subagent)
|
|
@@ -426,6 +451,36 @@ export function trackSubagent(map, event) {
|
|
|
426
451
|
const items = Array.isArray(input.tasks) ? input.tasks : Array.isArray(input.chain) ? input.chain : [{ agent: input.agent, task: input.task }];
|
|
427
452
|
map.set(event.toolCallId, items.map((item) => ({ agent: item?.agent, task: item?.task, started: Date.now() })));
|
|
428
453
|
}
|
|
454
|
+
// DAG do Thoth (thoth-client dag run) grava .thoth/dag/live.json enquanto roda: cada persona aparece em SUBAGENTES, como os
|
|
455
|
+
// subagentes do Pink (owner 2026-11-25). Some 15 s depois do fim, ou quando o processo do DAG morre sem terminar.
|
|
456
|
+
const DAG_STATE = { waiting: ["·", "esperando"], running: ["●", "rodando"], ok: ["✓", "pronto"], failed: ["✗", "falhou"], skipped: ["−", "pulou"] };
|
|
457
|
+
export function dagAgents(cwd, now = Date.now(), read = (file) => process.getBuiltinModule?.("node:fs")?.readFileSync(file, "utf8"), alive = (pid) => {
|
|
458
|
+
try {
|
|
459
|
+
process.kill(pid, 0);
|
|
460
|
+
return true;
|
|
461
|
+
} catch (error) {
|
|
462
|
+
return error?.code === "EPERM";
|
|
463
|
+
}
|
|
464
|
+
}) {
|
|
465
|
+
let live;
|
|
466
|
+
try {
|
|
467
|
+
live = JSON.parse(read(`${cwd}/.thoth/dag/live.json`));
|
|
468
|
+
} catch {
|
|
469
|
+
return [];
|
|
470
|
+
}
|
|
471
|
+
if (!live || !Array.isArray(live.nodes)) return [];
|
|
472
|
+
if (live.finished ? now - live.finished * 1000 > 15000 : !alive(Number(live.pid))) return [];
|
|
473
|
+
return live.nodes.map((node) => {
|
|
474
|
+
const [mark, label] = DAG_STATE[node.state] ?? DAG_STATE.waiting;
|
|
475
|
+
const running = node.state === "running" && node.started;
|
|
476
|
+
return { agent: node.persona || node.id, task: t(label, label, node.state), mark, started: running ? node.started * 1000 : now, clock: running ? undefined : node.seconds ? `${node.seconds}s` : "" };
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
let dagCache = { at: 0, cwd: "", items: [] };
|
|
480
|
+
function dagAgentsCached(cwd, now = Date.now()) {
|
|
481
|
+
if (cwd && (now - dagCache.at > 1000 || dagCache.cwd !== cwd)) dagCache = { at: now, cwd, items: dagAgents(cwd, now) }; // um arquivo lido por segundo, não por quadro
|
|
482
|
+
return cwd ? dagCache.items : [];
|
|
483
|
+
}
|
|
429
484
|
export function runningSubagents(waiting, background) {
|
|
430
485
|
return [...[...(background?.values?.() ?? [])].map((job) => ({ agent: job.agent, task: job.task, started: job.started })), ...[...(waiting?.values?.() ?? [])].flat()];
|
|
431
486
|
}
|
|
@@ -822,10 +877,33 @@ export function install(pink, ctx, { CustomEditor, SessionManager, version = "",
|
|
|
822
877
|
if (matchesKey?.(data, "ctrl+n")) return void runCommand("/new");
|
|
823
878
|
const step = matchesKey?.(data, "alt+up") ? -1 : matchesKey?.(data, "alt+down") ? 1 : 0;
|
|
824
879
|
if (step && !this.pinkKeys?.matches?.(data, "app.message.dequeue")) return void openNeighbour(step);
|
|
880
|
+
// ctrl+enter: com o /agente trabalhando, interrompe e manda já (com a fila); no Pink, é o Enter, que já entra no meio
|
|
881
|
+
if (matchesKey?.(data, "ctrl+enter")) {
|
|
882
|
+
const text = String(this.getText?.() ?? "");
|
|
883
|
+
if (globalThis.__pinkAgentSendNow?.(text)) return void this.setText("");
|
|
884
|
+
return void super.handleInput("\r");
|
|
885
|
+
}
|
|
825
886
|
super.handleInput(data);
|
|
826
887
|
}
|
|
827
888
|
|
|
889
|
+
// clique nos botões do microfone (◉ falar, ‖ pausar, ■ parar, ➤ enviar); o resto segue para o editor
|
|
890
|
+
handleMouse(event) {
|
|
891
|
+
const hits = state.micHits;
|
|
892
|
+
const span = event?.type === "click" && event.button === "left" && hits && event.y === hits.y ? hits.spans.find((item) => event.x >= item.from && event.x < item.to) : undefined;
|
|
893
|
+
if (!span) return super.handleMouse?.(event);
|
|
894
|
+
const mic = globalThis.__pinkMicrofone;
|
|
895
|
+
void mic
|
|
896
|
+
?.act(span.action, this, redraw)
|
|
897
|
+
.then(() => {
|
|
898
|
+
const why = mic.view().error;
|
|
899
|
+
if (why) ctx.ui.notify?.(t(`Microfone: ${why}`, `Micrófono: ${why}`, `Microphone: ${why}`), "error");
|
|
900
|
+
})
|
|
901
|
+
.catch((error) => ctx.ui.notify?.(String(error?.message ?? error), "error"));
|
|
902
|
+
return { handled: true };
|
|
903
|
+
}
|
|
904
|
+
|
|
828
905
|
render(width) {
|
|
906
|
+
globalThis.__pinkMicTarget = { editor: this, redraw }; // o /microfone falar grava nesta caixa
|
|
829
907
|
try {
|
|
830
908
|
return this.pinkRender(width);
|
|
831
909
|
} catch {
|
|
@@ -843,9 +921,18 @@ export function install(pink, ctx, { CustomEditor, SessionManager, version = "",
|
|
|
843
921
|
// ~35 colunas na tela inicial (owner 2026-11-15)
|
|
844
922
|
const inline = false;
|
|
845
923
|
const raw = super.render(Math.max(1, text));
|
|
846
|
-
|
|
924
|
+
// the built-in editor draws its own top and bottom borders; the autocomplete list comes AFTER the bottom border, so
|
|
925
|
+
// cutting the last line ate the last suggestion (with one match, "/resu", the whole list vanished; owner 2026-11-25)
|
|
926
|
+
const below = Math.max(0, Math.min(raw.length - 2, Number(this.renderedAutocompleteHeight) || 0));
|
|
927
|
+
let content = raw.length >= 3 ? [...raw.slice(1, raw.length - 1 - below), ...raw.slice(raw.length - below)] : raw;
|
|
847
928
|
if (typeof this.getText === "function" && this.getText() === "" && content.length) content = [`${content[0].replace(/\s+$/, "")}${theme.fg("dim", PLACEHOLDER)}`, ...content.slice(1)];
|
|
848
|
-
|
|
929
|
+
// o botão do microfone só aparece instalado e na tela cheia (fora dela o terminal não entrega o clique)
|
|
930
|
+
const mic = globalThis.__pinkMicrofone;
|
|
931
|
+
const bar = framed() && mic ? micBar(theme, mic.view()) : undefined;
|
|
932
|
+
const working = globalThis.__pinkAgentBusy === true || (typeof ctx.isIdle === "function" && !ctx.isIdle());
|
|
933
|
+
const box = inputBox({ theme, content, width: outer, label, inline, mic: bar?.text, ...(working ? { hints: WORK_HINTS } : {}) });
|
|
934
|
+
state.micHits = bar && box.micAt ? { y: box.micAt.y, spans: bar.spans.map((span) => ({ ...span, from: margin + box.micAt.x + span.from, to: margin + box.micAt.x + span.to })) } : undefined;
|
|
935
|
+
const lines = box.map((line) => " ".repeat(margin) + line);
|
|
849
936
|
if (!state.home) return lines;
|
|
850
937
|
const body = [...lines, "", hintsLine({ theme, width })];
|
|
851
938
|
return [...body, ...Array(homeBottomPad(homeRows(), homeTop(homeRows()) + HEADER_BODY, body.length)).fill("")];
|
|
@@ -988,7 +1075,8 @@ export function install(pink, ctx, { CustomEditor, SessionManager, version = "",
|
|
|
988
1075
|
if (PINK.thothOn) startThoth();
|
|
989
1076
|
const stats = sessionStats(ctx.sessionManager?.getEntries?.());
|
|
990
1077
|
const total = stats.models.reduce((sum, item) => ({ input: sum.input + item.input, output: sum.output + item.output }), { input: 0, output: 0 });
|
|
991
|
-
|
|
1078
|
+
globalThis.__pinkSideAt = Date.now(); // pink-agente: com a lateral na tela, os subagentes ficam só nela
|
|
1079
|
+
return rightColumn({ theme, width: RIGHT_WIDTH, height, data: { ...total, cost: stats.cost, models: stats.models.map((item) => item.model).filter((model) => model && model !== "?"), project, context: bars().context, todos: PINK.todos, thoth: PINK.thothOn ? PINK.thoth.data : { ad: true }, plan: PINK.thothOn ? PINK.plan.data : undefined, mcp: globalThis.__pinkMcp?.(), mcpOpen: PINK.mcpOpen, hits: (PINK.rightHits = {}), changes: changesFromBranch(ctx.sessionManager?.getBranch?.(), PINK.created), agents: [...runningSubagents(PINK.subagents, globalThis.__pinkSubagentJobs), ...dagAgentsCached(ctx.cwd), ...(globalThis.__pinkAgentChildren ?? [])] } });
|
|
992
1080
|
}, []),
|
|
993
1081
|
};
|
|
994
1082
|
// tarefas sobre a caixa de digitar quando a coluna da direita não cabe (com ela, as tarefas aparecem no PLANO)
|
|
@@ -1485,11 +1573,17 @@ function registerOpenCodeFunctions(pink) {
|
|
|
1485
1573
|
PINK.runShow = show; // o message_update também atualiza (tokens), o relógio só o tempo
|
|
1486
1574
|
PINK.runTimer = setInterval(show, 1000);
|
|
1487
1575
|
PINK.runTimer.unref?.();
|
|
1576
|
+
// o relógio de cima (1 s) redesenha a tela, e esta lista junto
|
|
1577
|
+
ctx.ui.setWidget?.(ABOVE_BOX, (_tui, theme) => ({
|
|
1578
|
+
render: (width) => aboveBox(theme, width, { agents: [...runningSubagents(PINK.subagents), ...dagAgentsCached(ctx.cwd)], side: Date.now() - (globalThis.__pinkSideAt ?? 0) < 5000 }),
|
|
1579
|
+
invalidate() {},
|
|
1580
|
+
}), { placement: "aboveEditor" });
|
|
1488
1581
|
});
|
|
1489
1582
|
pink.on("agent_end", async (_event, ctx) => {
|
|
1490
1583
|
clearInterval(PINK.runTimer);
|
|
1491
1584
|
PINK.subagents.clear(); // ferramenta bloqueada ou interrompida não manda tool_result
|
|
1492
1585
|
ctx.ui.setWorkingMessage?.();
|
|
1586
|
+
ctx.ui.setWidget?.(ABOVE_BOX, undefined);
|
|
1493
1587
|
if (PINK.run?.last !== undefined) PINK.runOf.set(PINK.run.last, PINK.run.summary());
|
|
1494
1588
|
[PINK.lastRun, PINK.lastRunEnd, PINK.run, PINK.runShow] = [PINK.run, Date.now(), undefined, undefined];
|
|
1495
1589
|
});
|