@thothdev/pink 1.0.34 → 1.0.37
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
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
O Pink é um fork do Pi (MIT, veja `LICENSE-PI.txt` e `NOTICE.md`). Aqui só entra o que mudou no Pink; a base de cada
|
|
4
4
|
versão está no campo `upstream` do `rebrand.json` do repositório.
|
|
5
5
|
|
|
6
|
+
## [1.0.37] - 2026-11-29
|
|
7
|
+
|
|
8
|
+
- Ponto de conexão com o provedor antes do modelo (verde quando responde; com problema mostra a causa: cota ou limite esgotado, sem acesso, sem conexão, pedido recusado) e aviso curto acima da caixa quando a resposta falha, a conversa é compactada ou a compactação falha. Vale no Pink e no `/agente`.
|
|
9
|
+
- A barra da caixa muda de cor com o modo: âmbar (pergunta tudo), azul (plano), vermelho (permite tudo); no padrão continua rosa.
|
|
10
|
+
- Subagente trabalhando ganha um ícone girando no lugar da bolinha parada.
|
|
11
|
+
|
|
12
|
+
## [1.0.36] - 2026-11-29
|
|
13
|
+
|
|
14
|
+
- Mensagem na fila, como no Claude Code: embaixo dela aparece "└ Na fila · ctrl+enter envia agora" no `/agente` (interrompe o agente e manda a fila) e "└ Na fila · entra no próximo passo" no modelo logado. O texto da fila do modelo logado saiu do inglês.
|
|
15
|
+
|
|
16
|
+
## [1.0.35] - 2026-11-29
|
|
17
|
+
|
|
18
|
+
- As etapas ficam alinhadas com as linhas de ferramenta logo abaixo (um espaço a menos à esquerda).
|
|
19
|
+
|
|
6
20
|
## [1.0.34] - 2026-11-29
|
|
7
21
|
|
|
8
22
|
- Enquanto trabalha, só a etapa atual anima e traz o tempo e os tokens; a linha "Trabalhando" de baixo saiu (modelo logado e `/agente`).
|
|
@@ -3837,15 +3837,15 @@ export class InteractiveMode {
|
|
|
3837
3837
|
if (steeringMessages.length > 0 || followUpMessages.length > 0) {
|
|
3838
3838
|
this.pendingMessagesContainer.addChild(new Spacer(1));
|
|
3839
3839
|
for (const message of steeringMessages) {
|
|
3840
|
-
const text = theme.fg("dim", `Steering: ${message}`);
|
|
3840
|
+
const text = theme.fg("dim", globalThis.__pinkQueue ? `> ${message}` : `Steering: ${message}`);
|
|
3841
3841
|
this.pendingMessagesContainer.addChild(new TruncatedText(text, 1, 0));
|
|
3842
3842
|
}
|
|
3843
3843
|
for (const message of followUpMessages) {
|
|
3844
|
-
const text = theme.fg("dim", `Follow-up: ${message}`);
|
|
3844
|
+
const text = theme.fg("dim", globalThis.__pinkQueue ? `> ${message}${globalThis.__pinkQueue.followUp}` : `Follow-up: ${message}`);
|
|
3845
3845
|
this.pendingMessagesContainer.addChild(new TruncatedText(text, 1, 0));
|
|
3846
3846
|
}
|
|
3847
3847
|
const dequeueHint = this.getAppKeyDisplay("app.message.dequeue");
|
|
3848
|
-
const hintText = theme.fg("dim", `↳ ${dequeueHint} to edit all queued messages`);
|
|
3848
|
+
const hintText = theme.fg("dim", globalThis.__pinkQueue ? globalThis.__pinkQueue.hint(dequeueHint) : `↳ ${dequeueHint} to edit all queued messages`);
|
|
3849
3849
|
this.pendingMessagesContainer.addChild(new TruncatedText(hintText, 1, 0));
|
|
3850
3850
|
}
|
|
3851
3851
|
}
|
|
@@ -11,7 +11,7 @@ import os from "node:os";
|
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import { fileURLToPath } from "node:url";
|
|
13
13
|
import { closeKept, externalAgents, listModels, pinkExtras, runExternal, subagentEnd, warmKept } from "../examples/extensions/subagent/external.ts";
|
|
14
|
-
import { bulleted, elapsedLabel, fit, runLabel, shortModel, stallNote, streamedTokens, thinkingLabel, cleanLine as clean, tailLine, thinkingNow, stripThothRules, thothConfigured, toolSummary, userLines, workingLabel, clearDone, showDone, stageLines, trailOf, framedAsk, outputTail, tailRows, exitFailed } from "./pink-ui.ts";
|
|
14
|
+
import { bulleted, elapsedLabel, fit, runLabel, shortModel, stallNote, streamedTokens, thinkingLabel, cleanLine as clean, tailLine, thinkingNow, stripThothRules, thothConfigured, toolSummary, userLines, workingLabel, clearDone, showDone, stageLines, trailOf, framedAsk, outputTail, tailRows, exitFailed, QUEUE_HINT } from "./pink-ui.ts";
|
|
15
15
|
|
|
16
16
|
// reabrir o Pink volta ao último usado, modelo logado ou agente (owner 2026-11-28). O agente fica neste arquivo; o modelo
|
|
17
17
|
// logado o motor grava como padrão a cada troca (rebrand.json, remember-last-model-module)
|
|
@@ -446,7 +446,11 @@ export default function (pink: any, list: typeof externalAgents = externalAgents
|
|
|
446
446
|
(globalThis as any).__pinkAgentBusy = false; // a caixa volta às dicas de sempre (pink-ui)
|
|
447
447
|
};
|
|
448
448
|
// a fila em cinza fica em cima do "Trabalhando" e uma linha vazia o separa da caixa (owner 2026-11-25, como o Claude Code)
|
|
449
|
-
|
|
449
|
+
// embaixo da fila, como mandar já (owner 2026-11-29, como o Claude Code)
|
|
450
|
+
const around = (lines: string[], width: number, theme: any) => {
|
|
451
|
+
const queue = queueLines(active?.queue ?? [], width);
|
|
452
|
+
return [...[...queue, ...(queue.length ? [fit(QUEUE_HINT, width)] : [])].map((line) => theme.fg("dim", line)), ...lines, ""];
|
|
453
|
+
};
|
|
450
454
|
// a etapa atual leva o tempo e os tokens e é a única linha animada (owner 2026-11-29): o Loader segue vivo só para
|
|
451
455
|
// redesenhar a tela, sem a linha "Trabalhando" embaixo
|
|
452
456
|
const busy = (ui: any, output: () => number, doing: (width: number, theme: any, status: string) => string[]) => {
|
|
@@ -702,6 +706,8 @@ export default function (pink: any, list: typeof externalAgents = externalAgents
|
|
|
702
706
|
if (!current.agent.model && result.model && result.model !== name) (globalThis as any).__pinkExternalAgent = { name, model: result.model, effort: current.agent.effort };
|
|
703
707
|
}
|
|
704
708
|
const error = result.stopReason === "error" ? String(result.errorMessage ?? t("erro", "error", "error")) : undefined;
|
|
709
|
+
// o ponto de conexão e o aviso são os do Pink (pink-ui)
|
|
710
|
+
if (!controller.signal.aborted) (globalThis as any).__pinkReportLink?.(ctx.ui, error !== undefined ? { error } : { status: 200 });
|
|
705
711
|
pink.sendMessage({ customType: "pink-agente", display: true, content: render(result, ctx.cwd), details: { agent: name, session: current.resume?.id, model: result.model, usage: result.usage, error, steps: steps(result, ctx.cwd), changes: fileChanges(result, ctx.cwd), ms: Date.now() - started, output: outputOf(result) } });
|
|
706
712
|
pink.events?.emit?.("pink:agent_settled", { ctx, aborted: controller.signal.aborted });
|
|
707
713
|
// trocaram o modelo do Pink no meio: o que o agente fez já está na sessão; o novo modelo continua o pedido
|
package/extensions/pink-ui.ts
CHANGED
|
@@ -162,8 +162,12 @@ export function footerLine({ theme, width, left, right }) {
|
|
|
162
162
|
// "thoth thoth off" dizia modelo, provedor e nível sem explicar nada: agora o nome do modelo, o provedor só quando é
|
|
163
163
|
// outro, e o nível só quando está ligado ("Sonnet 5.5 · medium", o nível sempre na palavra em inglês)
|
|
164
164
|
// como no OpenCode, o agente (Build/Plano) vem antes do modelo, na cor da marca
|
|
165
|
-
export function modelLabel({ theme, model, thinking, agent, permission = "edits", external = Reflect.get(globalThis, "__pinkExternalAgent") }) {
|
|
166
|
-
const
|
|
165
|
+
export function modelLabel({ theme, model, thinking, agent, permission = "edits", external = Reflect.get(globalThis, "__pinkExternalAgent"), link = undefined }) {
|
|
166
|
+
const dot = linkLabel(theme, link);
|
|
167
|
+
return dot + modelName({ theme, model, thinking, agent, permission, external });
|
|
168
|
+
}
|
|
169
|
+
function modelName({ theme, model, thinking, agent, permission, external }) {
|
|
170
|
+
const mode =agent !== "build" ? "" : permission === "ask" ? t(" (pergunta tudo)", " (pregunta todo)", " (ask everything)") : permission === "all" ? t(" (permite tudo)", " (permite todo)", " (allows everything)") : "";
|
|
167
171
|
const who = AGENTS[agent] ? `${theme.fg("accent", `${AGENTS[agent].label}${mode}`)}${theme.fg("muted", " · ")}` : "";
|
|
168
172
|
// /agente ligado (card 1dfwh7kgfjr): o Build fica; no lugar do modelo do Pink, o agente instalado e o modelo dele
|
|
169
173
|
if (external?.name) return `${who}${external.name}${theme.fg("muted", ` · ${external.model ?? t("modelo padrão", "modelo predeterminado", "default model")}${external.effort ? ` · ${external.effort}` : ""}`)}`;
|
|
@@ -383,10 +387,65 @@ const still = () => !!process.env.PINK_REDUCED_MOTION; // NO_COLOR tira só a c
|
|
|
383
387
|
const mix = (a, b, k) => a.map((v, i) => Math.round(v + (b[i] - v) * k));
|
|
384
388
|
|
|
385
389
|
// barra que respira (Renoir): enquanto o agente trabalha, a ▌ vai do rosa da marca ao rosa escuro em ciclos de 1,6 s
|
|
386
|
-
export function breathe(now = Date.now(), period = 1600) {
|
|
390
|
+
export function breathe(now = Date.now(), period = 1600, base = PINK_RGB) {
|
|
387
391
|
const step = Math.floor(now / FRAME_MS) * FRAME_MS;
|
|
388
|
-
|
|
392
|
+
const dark = base === PINK_RGB ? [194, 69, 127] : base.map((v) => Math.round(v * 0.76));
|
|
393
|
+
return mix(base, dark, (1 - Math.cos((2 * Math.PI * (step % period)) / period)) / 2);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// a cor da barra da caixa diz o modo de permissão (owner 2026-11-29); "aceita edições" é o padrão e fica rosa
|
|
397
|
+
export const MODE_RGB = { ask: [255, 179, 0], plan: [90, 170, 255], all: [255, 82, 82] };
|
|
398
|
+
|
|
399
|
+
// conexão com o provedor (Connection Pulse): o status da última resposta ou o erro da última mensagem
|
|
400
|
+
export function classifyLink({ status, error } = {}) {
|
|
401
|
+
if (error !== undefined) {
|
|
402
|
+
const text = String(error);
|
|
403
|
+
if (/429|quota|cota|rate.?limit|usage.?limit|limit.?exceeded|insufficient|exhaust|too many/i.test(text)) return "limit";
|
|
404
|
+
if (/401|403|unauthori[sz]ed|forbidden|api.?key|not.?logged|sign.?in|login/i.test(text)) return "auth";
|
|
405
|
+
if (/econn|enotfound|etimedout|fetch failed|network|socket|timed? ?out|offline/i.test(text)) return "net";
|
|
406
|
+
return "fail";
|
|
407
|
+
}
|
|
408
|
+
if (status >= 200 && status < 300) return "ok";
|
|
409
|
+
return status === 429 ? "limit" : status === 401 || status === 403 ? "auth" : "fail";
|
|
410
|
+
}
|
|
411
|
+
export const LINKS = {
|
|
412
|
+
ok: { tone: "success", text: "" },
|
|
413
|
+
limit: { tone: "warning", text: t("cota ou limite esgotado", "cuota o límite agotado", "quota or limit reached"), tip: t("Troque de modelo com /model ou espere a cota voltar.", "Cambia de modelo con /model o espera a que vuelva la cuota.", "Switch model with /model or wait for the quota to return.") },
|
|
414
|
+
auth: { tone: "error", text: t("sem acesso ao provedor", "sin acceso al proveedor", "no access to the provider"), tip: t("Refaça o /login desse provedor.", "Rehaz el /login de ese proveedor.", "Redo /login for that provider.") },
|
|
415
|
+
net: { tone: "warning", text: t("sem conexão com o provedor", "sin conexión con el proveedor", "cannot reach the provider"), tip: t("Confira a internet e envie de novo.", "Revisa internet y envía de nuevo.", "Check the network and send again.") },
|
|
416
|
+
fail: { tone: "error", text: t("o provedor recusou o pedido", "el proveedor rechazó el pedido", "the provider rejected the request"), tip: t("Envie de novo ou troque de modelo com /model.", "Envía de nuevo o cambia de modelo con /model.", "Send again or switch model with /model.") },
|
|
417
|
+
};
|
|
418
|
+
// o ponto antes do modelo: verde quando responde; com problema, vem a causa
|
|
419
|
+
export function linkLabel(theme, kind) {
|
|
420
|
+
const link = LINKS[kind];
|
|
421
|
+
if (!link) return "";
|
|
422
|
+
return link.text ? `${theme.fg(link.tone, `● ${link.text}`)}${theme.fg("muted", " · ")}` : `${theme.fg(link.tone, "●")} `;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// aviso curto dentro do Pink (toast): uma linha acima da caixa que some sozinha
|
|
426
|
+
let toastTimer;
|
|
427
|
+
export function toast(ui, text, tone = "warning", ms = 7000) {
|
|
428
|
+
if (!ui?.setWidget) return;
|
|
429
|
+
clearTimeout(toastTimer);
|
|
430
|
+
ui.setWidget("pink-toast", (_screen, theme) => ({ render: (width) => [fit(` ${theme.fg(tone, "●")} ${theme.fg("text", text)}`, width)], invalidate() {} }), { placement: "aboveEditor" });
|
|
431
|
+
toastTimer = setTimeout(() => {
|
|
432
|
+
try {
|
|
433
|
+
ui.setWidget("pink-toast", undefined);
|
|
434
|
+
} catch {
|
|
435
|
+
/* tela já fechada */
|
|
436
|
+
}
|
|
437
|
+
}, ms);
|
|
438
|
+
toastTimer.unref?.();
|
|
389
439
|
}
|
|
440
|
+
// o Pink e o /agente contam o resultado de cada resposta por aqui: o ponto e o aviso são os mesmos nos dois
|
|
441
|
+
export function reportLink(ui, input) {
|
|
442
|
+
const kind = classifyLink(input);
|
|
443
|
+
globalThis.__pinkLink = kind;
|
|
444
|
+
if (kind !== "ok" && input.error !== undefined) toast(ui, `${LINKS[kind].text}. ${LINKS[kind].tip}`, LINKS[kind].tone);
|
|
445
|
+
return kind;
|
|
446
|
+
}
|
|
447
|
+
globalThis.__pinkReportLink = reportLink;
|
|
448
|
+
globalThis.__pinkToast = toast;
|
|
390
449
|
|
|
391
450
|
// brilho (shimmer): uma faixa de 3 letras, a cor da etapa com 35% de branco, percorre o rótulo da etapa atual
|
|
392
451
|
export function shimmer(text, color, now = Date.now()) {
|
|
@@ -464,24 +523,32 @@ export const DONE_GREEN_MS = 2000;
|
|
|
464
523
|
export function stageLines(theme, trail, { now = Date.now(), still: stopped = still(), width = 80, done = undefined, status = "" } = {}) {
|
|
465
524
|
setAppearance(theme);
|
|
466
525
|
const ready = done ? `${t("Pronto", "Listo", "Done")}${done.summary ? ` · ${done.summary}` : ""}` : "";
|
|
467
|
-
|
|
526
|
+
// 1 espaço de recuo, como as linhas de ferramenta (→, + Pensou) logo abaixo (owner 2026-11-29)
|
|
527
|
+
if (done && now - done.at >= DONE_GREEN_MS) return [fit(` ${theme.fg("muted", `✓ ${ready}`)}`, width)];
|
|
468
528
|
const lit = done ? (stopped ? trail.length : Math.floor((now - done.at) / Math.min(40, 300 / Math.max(1, trail.length)))) : trail.length - 1;
|
|
469
529
|
const mark = (stage) => (stage.failed ? rgb(248, 113, 113)("✗") : GREEN("✓"));
|
|
470
530
|
const lines = trail.map((stage, index) => {
|
|
471
531
|
const spec = STAGES[stage.key] ?? STAGES.investigate;
|
|
472
|
-
if (done) return fit(`
|
|
473
|
-
if (index < lit) return fit(`
|
|
532
|
+
if (done) return fit(` ${index < lit ? mark(stage) : theme.fg("dim", "·")} ${theme.fg("muted", spec.label)}`, width);
|
|
533
|
+
if (index < lit) return fit(` ${mark(stage)} ${theme.fg("muted", spec.label)}`, width);
|
|
474
534
|
const icon = spec.frames[stopped ? 0 : Math.floor(now / FRAME_MS) % spec.frames.length];
|
|
475
535
|
const label = stopped ? spec.color(`${spec.label}...`) : `${shimmer(spec.label, spec.color.rgb, now)}${spec.color("...")}`;
|
|
476
|
-
return fit(`
|
|
536
|
+
return fit(` ${spec.color(icon)} ${label}${status ? theme.fg("dim", ` (${status})`) : ""}`, width);
|
|
477
537
|
});
|
|
478
|
-
return done ? [...lines, fit(`
|
|
538
|
+
return done ? [...lines, fit(` ${GREEN(`✓ ${ready}`)}`, width)] : lines;
|
|
479
539
|
}
|
|
480
540
|
const BELOW_BOX = "pink-subagentes-embaixo";
|
|
481
541
|
export const THREE_COLUMNS = 150; // >= 150: sessões, conversa e contexto
|
|
482
542
|
export const TWO_COLUMNS = 115; // 115-149: some a coluna de sessões; < 115: só a conversa
|
|
483
543
|
export const PLACEHOLDER = t("Peça a próxima etapa...", "Pide el siguiente paso...", "Ask for the next step...");
|
|
484
544
|
// enquanto o agente trabalha, como o "esc interrupt" do OpenCode (owner 2026-11-25)
|
|
545
|
+
// mensagem na fila (owner 2026-11-29, como o Claude Code): logo abaixo dela, como mandar já. No modelo logado o Enter já
|
|
546
|
+
// entra no próximo passo do agente; o texto do Pi vem por patch (rebrand.json, queued-*-module) e lê isto
|
|
547
|
+
globalThis.__pinkQueue = {
|
|
548
|
+
followUp: t(" (no fim)", " (al final)", " (at the end)"),
|
|
549
|
+
hint: (key) => t(` └ Na fila · entra no próximo passo · ${key} edita`, ` └ En cola · entra en el próximo paso · ${key} edita`, ` └ Queued · goes in at the next step · ${key} edits`),
|
|
550
|
+
};
|
|
551
|
+
export const QUEUE_HINT = t(" └ Na fila · ctrl+enter envia agora", " └ En cola · ctrl+enter envía ya", " └ Queued · ctrl+enter to send now");
|
|
485
552
|
export const WORK_HINTS = t("esc interromper · ctrl+enter enviar agora", "esc interrumpir · ctrl+enter enviar ya", "esc interrupt · ctrl+enter send now");
|
|
486
553
|
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");
|
|
487
554
|
|
|
@@ -619,9 +686,11 @@ export function rightColumn({ theme, width, height, data }) {
|
|
|
619
686
|
}
|
|
620
687
|
|
|
621
688
|
// uma linha de SUBAGENTES: "● persona tarefa ........ 12s" (coluna da direita e a lista acima da caixa)
|
|
689
|
+
const AGENT_FRAMES = ["⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷"]; // anel de braille girando; só o subagente trabalhando o usa (owner 2026-11-29)
|
|
622
690
|
export function agentLine(theme, item, width, now = Date.now()) {
|
|
623
691
|
const clock = theme.fg("dim", item.clock ?? elapsedLabel(now - item.started));
|
|
624
|
-
const
|
|
692
|
+
const mark = item.mark ?? (still() ? "●" : AGENT_FRAMES[Math.floor(now / FRAME_MS) % AGENT_FRAMES.length]);
|
|
693
|
+
const text = `${theme.fg(item.mark === "✗" ? "error" : item.mark === "✓" ? "success" : "accent", mark)}${theme.fg("text", String(item.agent ?? "?"))} ${theme.fg("muted", String(item.task ?? "").replace(/\s+/g, " ").trim())}`;
|
|
625
694
|
return footerLine({ theme, width, left: fit(text, Math.max(1, width - visible(clock) - 1)), right: clock });
|
|
626
695
|
}
|
|
627
696
|
|
|
@@ -1191,7 +1260,7 @@ export function install(pink, ctx, { CustomEditor, SessionManager, version = "",
|
|
|
1191
1260
|
const outer = state.home ? Math.min(width, HOME_WIDTH) : width;
|
|
1192
1261
|
const margin = state.home ? Math.floor((width - outer) / 2) : 0;
|
|
1193
1262
|
const theme = ctx.ui.theme;
|
|
1194
|
-
const label = modelLabel({ theme, model: ctx.model, thinking: pink.getThinkingLevel?.(), agent: PINK.agent, permission: PINK.permission });
|
|
1263
|
+
const label = modelLabel({ theme, model: ctx.model, thinking: pink.getThinkingLevel?.(), agent: PINK.agent, permission: PINK.permission, link: globalThis.__pinkLink });
|
|
1195
1264
|
const text = outer - 4;
|
|
1196
1265
|
// o rótulo fica embaixo, na linha das dicas: à direita da 1ª linha ele estreitava o editor e o pedido quebrava em
|
|
1197
1266
|
// ~35 colunas na tela inicial (owner 2026-11-15)
|
|
@@ -1208,7 +1277,10 @@ export function install(pink, ctx, { CustomEditor, SessionManager, version = "",
|
|
|
1208
1277
|
const working = globalThis.__pinkAgentBusy === true || (typeof ctx.isIdle === "function" && !ctx.isIdle());
|
|
1209
1278
|
// tela inicial: a linha de atalhos embaixo já tem as dicas; na caixa ficam só o modelo e o microfone (owner 2026-11-28)
|
|
1210
1279
|
const box = inputBox({ theme, content, width: outer, label, inline, mic: bar?.text, ...(working ? { hints: WORK_HINTS } : state.home ? { hints: "" } : {}),
|
|
1211
|
-
...(
|
|
1280
|
+
...(() => {
|
|
1281
|
+
const tint = MODE_RGB[currentMode()]; // a cor da barra é a do modo; só no padrão ela é rosa
|
|
1282
|
+
return working && !still() ? { barRgb: breathe(Date.now(), 1600, tint ?? PINK_RGB) } : tint ? { barRgb: tint } : {}; // a barra respira só com o agente trabalhando
|
|
1283
|
+
})() });
|
|
1212
1284
|
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;
|
|
1213
1285
|
const lines = box.map((line) => " ".repeat(margin) + line);
|
|
1214
1286
|
if (!state.home) return lines;
|
|
@@ -1999,6 +2071,13 @@ function registerOpenCodeFunctions(pink) {
|
|
|
1999
2071
|
else if (runs.length && runs.at(-1).ms === undefined) runs.at(-1).ms = Date.now() - runs.at(-1).start;
|
|
2000
2072
|
PINK.thinking.set(key, runs);
|
|
2001
2073
|
});
|
|
2074
|
+
pink.on("after_provider_response", async (event) => {
|
|
2075
|
+
globalThis.__pinkLink = classifyLink({ status: event?.status });
|
|
2076
|
+
});
|
|
2077
|
+
pink.on("session_compact", async (event, ctx) => toast(ctx?.ui, event?.reason === "overflow" ? t("Contexto estourou: conversa compactada, tento de novo.", "El contexto se desbordó: conversación compactada, reintento.", "Context overflowed: conversation compacted, retrying.") : t("Conversa compactada para caber no contexto.", "Conversación compactada para caber en el contexto.", "Conversation compacted to fit the context."), "info"));
|
|
2078
|
+
pink.on("session_compact_failed", async (event, ctx) => {
|
|
2079
|
+
if (!event?.aborted) toast(ctx?.ui, t(`Não deu para compactar: ${String(event?.errorMessage ?? "erro").slice(0, 80)}`, `No se pudo compactar: ${String(event?.errorMessage ?? "error").slice(0, 80)}`, `Could not compact: ${String(event?.errorMessage ?? "error").slice(0, 80)}`), "error");
|
|
2080
|
+
});
|
|
2002
2081
|
pink.on("turn_start", async () => {
|
|
2003
2082
|
PINK.turnStart = Date.now();
|
|
2004
2083
|
});
|
|
@@ -2007,7 +2086,11 @@ function registerOpenCodeFunctions(pink) {
|
|
|
2007
2086
|
for (const run of PINK.thinking.get(event?.message?.timestamp) ?? []) run.ms ??= Date.now() - run.start; // interrompido no meio: não fica "Pensando" para sempre
|
|
2008
2087
|
const hint = chatgptLimitHint(event?.message?.errorMessage);
|
|
2009
2088
|
if (hint) ctx?.ui?.notify?.(hint, "warning");
|
|
2010
|
-
|
|
2089
|
+
if (event?.message?.role === "assistant") {
|
|
2090
|
+
if (event.message.stopReason === "error") reportLink(ctx?.ui, { error: event.message.errorMessage ?? "" });
|
|
2091
|
+
else if (event.message.stopReason !== "aborted") globalThis.__pinkLink = "ok";
|
|
2092
|
+
}
|
|
2093
|
+
const timing =event?.message?.role === "assistant" ? PINK.timing.get(event.message.timestamp) : undefined;
|
|
2011
2094
|
if (timing?.start) timing.ms = Date.now() - timing.start;
|
|
2012
2095
|
});
|
|
2013
2096
|
pink.on("tool_result", async (event) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thothdev/pink",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"description": "Open-source AI coding agent for the terminal that also drives Claude Code, Codex, OpenCode and other agents, with parallel sessions, visible plan and changes, and real undo.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"piConfig": {
|