@thothdev/pink 1.0.0 → 1.0.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/CHANGELOG.md +7 -0
- package/README.md +130 -95
- package/extensions/pink-agente.ts +68 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
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.1] - 2026-11-23
|
|
7
|
+
|
|
8
|
+
- `/agente`: aparece "<agente> trabalhando · Ns" embaixo da caixa enquanto o agente responde; com um agente ligado, o
|
|
9
|
+
primeiro item do menu é "Voltar ao Pink" (o mesmo que `/agente off`); as mensagens aparecem como "Você → opencode" e
|
|
10
|
+
"opencode · modelo", em vez dos tipos crus `[pink-agente-pedido]` e `[pink-agente]`.
|
|
11
|
+
- README em inglês, com o logo e a tela.
|
|
12
|
+
|
|
6
13
|
## [1.0.0] - 2026-11-23
|
|
7
14
|
|
|
8
15
|
Primeira versão pública: código aberto (MIT) em https://github.com/ricardopiresqa/pink e pacote `@thothdev/pink` no npm. As
|
package/README.md
CHANGED
|
@@ -1,95 +1,130 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
- **
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/ricardopiresqa/pink/main/docs/images/pink-logo.png" alt="PINK" width="360">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<b>The coding agent for your terminal that works where you can see it.</b><br>
|
|
7
|
+
Plan, changed files and context on screen, many sessions side by side, a real undo,
|
|
8
|
+
and the agents you already pay for, all in one place.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/@thothdev/pink"><img src="https://img.shields.io/npm/v/@thothdev/pink?color=ff6eb4&label=npm" alt="npm"></a>
|
|
13
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-ff6eb4" alt="MIT license"></a>
|
|
14
|
+
<a href="https://pink.thothdev.ia.br"><img src="https://img.shields.io/badge/site-pink.thothdev.ia.br-ff6eb4" alt="website"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<img src="https://raw.githubusercontent.com/ricardopiresqa/pink/main/docs/images/pink-screen.png" alt="Pink in the terminal: sessions on the left, the conversation in the middle, context, plan and changed files on the right" width="900">
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g @thothdev/pink
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then run `pink` inside your project folder. Needs Node.js 22.19 or newer.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pink # interactive session
|
|
31
|
+
pink -p "explain this repository" # one-shot answer
|
|
32
|
+
pink --help
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## What only Pink does
|
|
36
|
+
|
|
37
|
+
| | |
|
|
38
|
+
|---|---|
|
|
39
|
+
| **Use the agents you already have** | `/agente claude`, `/agente codex`, `/agente opencode`... hands the session to Claude Code, Codex, opencode, Gemini, Qwen, Cline, Goose or Copilot, with their own login and plan. No new API key. A menu picks the model; `/agente off` comes back. |
|
|
40
|
+
| **Your rules come along** | The chosen agent gets Pink's MCP servers, `AGENTS.md` and skills, and can call Pink itself as an MCP tool (`pink_tarefa`). |
|
|
41
|
+
| **Sees and uses your screen** | On Windows, `/tela ligar` lets the agent see your windows and click or type in them. Seeing never asks; every click asks for your OK, and typing into a terminal asks twice. Off by default. |
|
|
42
|
+
| **Sessions side by side** | Each session runs in its own process in the left sidebar. If one hangs, the others keep going. A spinner shows who is working and `!` who is waiting for you. |
|
|
43
|
+
| **A real `/undo`** | Rolls back the last message, the replies and the file changes, and puts your text back in the box, without touching your git index, stash or commits. |
|
|
44
|
+
|
|
45
|
+
## Everything else
|
|
46
|
+
|
|
47
|
+
- **Build and Plan agents.** `tab` on an empty box switches. Plan only reads and plans: it asks before running a command and never edits files.
|
|
48
|
+
- **Subagents.** The `subagent` tool hands work to a separate `pink` process, alone, in parallel or in a chain. Custom agents live in `~/.pink/agent/agents/*.md`.
|
|
49
|
+
- **Guard before danger.** Destructive commands ask first; `.env`, `.git` and keys are protected. Rules go in `permissions.json` (`allow` / `ask` / `deny`), and hooks in `hooks.json` use the Claude Code format.
|
|
50
|
+
- **MCP and the web.** `/mcp` connects MCP servers. `web_search` and `web_fetch` work with no key and no extra server.
|
|
51
|
+
- **Compact transcript.** Each read, edit and command becomes one short line. `ctrl+o` opens the full tool output with the diff, `ctrl+t` opens the thinking.
|
|
52
|
+
- **Adapts to the width.** Three columns from 150 columns up, two from 115, just the conversation below that.
|
|
53
|
+
- **Questions with options**, a todo list in the sidebar, and a system notification when an answer finishes while the window is in the background.
|
|
54
|
+
|
|
55
|
+
## Keys and commands
|
|
56
|
+
|
|
57
|
+
| Key / command | What it does |
|
|
58
|
+
|---|---|
|
|
59
|
+
| `ctrl+p` | Command palette (also `/help`) |
|
|
60
|
+
| `tab` (empty box) | Switch between Build and Plan |
|
|
61
|
+
| `f2` / `shift+f2` | Next / previous model |
|
|
62
|
+
| `ctrl+t` / `ctrl+o` | Open thinking / full tool output |
|
|
63
|
+
| `ctrl+n` | New session |
|
|
64
|
+
| `/agente [name] [model]` | Talk to an installed agent; `/agente off` returns to Pink |
|
|
65
|
+
| `/tela ligar` | Let the agent see and use the screen (Windows) |
|
|
66
|
+
| `/undo` / `/redo` | Undo / redo the last message and its file changes |
|
|
67
|
+
| `/sessions`, `/themes`, `/mcp` | Switch session, pick a theme, manage MCP servers |
|
|
68
|
+
| `/lateral` | Hide or show the side columns |
|
|
69
|
+
|
|
70
|
+
## Configuration
|
|
71
|
+
|
|
72
|
+
- Settings live in `~/.pink/agent/` (or `$PINK_CODING_AGENT_DIR`) and in `.pink/` inside the project. Environment variables start with `PINK_`.
|
|
73
|
+
- Providers and models: `~/.pink/agent/models.json` (see `docs/models.md`).
|
|
74
|
+
- No sidebar of sessions: `pink --sem-sessoes` or `PINK_NO_MUX=1`. The sidebar needs the optional `node-pty`; without it Pink runs as a single session.
|
|
75
|
+
- Plain look without Pink's interface: `PINK_NO_BUILTIN_UI=1 pink --tui-mode regular`.
|
|
76
|
+
|
|
77
|
+
## Thoth in the sidebar (optional)
|
|
78
|
+
|
|
79
|
+
If [Thoth](https://thothdev.ia.br) runs on the same machine, the right column gets a **THOTH** section with the approvals waiting for you, the card in progress for this folder and the model that answered the last Thoth gateway call. It only reads, in the background, every 30 seconds. Without Thoth the section says it is unavailable and Pink works as usual.
|
|
80
|
+
|
|
81
|
+
## Privacy
|
|
82
|
+
|
|
83
|
+
Pink sends no install telemetry and checks no versions on third-party servers. What leaves your machine is what you send to your model provider.
|
|
84
|
+
|
|
85
|
+
<details>
|
|
86
|
+
<summary><b>Pink colors in Windows Terminal</b></summary>
|
|
87
|
+
|
|
88
|
+
Pink uses your terminal's background. For the dark `#100d13` of the screenshots, add this scheme to `"schemes"` in Windows Terminal's `settings.json` and pick **Pink** under Profile → Appearance → Color scheme.
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"name": "Pink",
|
|
93
|
+
"background": "#100D13",
|
|
94
|
+
"foreground": "#F2EDF4",
|
|
95
|
+
"cursorColor": "#FF6EB4",
|
|
96
|
+
"selectionBackground": "#49243D",
|
|
97
|
+
"black": "#17131B",
|
|
98
|
+
"red": "#E05555",
|
|
99
|
+
"green": "#8DE0B1",
|
|
100
|
+
"yellow": "#F0C487",
|
|
101
|
+
"blue": "#6AA6F8",
|
|
102
|
+
"purple": "#B7A4FF",
|
|
103
|
+
"cyan": "#56C2C9",
|
|
104
|
+
"white": "#D7CEDB",
|
|
105
|
+
"brightBlack": "#6B6170",
|
|
106
|
+
"brightRed": "#FF6E8A",
|
|
107
|
+
"brightGreen": "#A8F0C6",
|
|
108
|
+
"brightYellow": "#FFD9A3",
|
|
109
|
+
"brightBlue": "#8FBCFF",
|
|
110
|
+
"brightPurple": "#FF9BCE",
|
|
111
|
+
"brightCyan": "#7FDDE3",
|
|
112
|
+
"brightWhite": "#F2EDF4"
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
</details>
|
|
117
|
+
|
|
118
|
+
## Building from source
|
|
119
|
+
|
|
120
|
+
The fork is a reproducible patch (`rebrand.json`) over a pinned upstream tarball, not a copy of its code:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
python -X utf8 build_pink.py --out out # builds out/thothdev-pink-<version>.tgz
|
|
124
|
+
npm install -g out/thothdev-pink-*.tgz
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
Pink is a fork of [Pi](https://github.com/earendil-works/pi-mono) (MIT, copyright (c) 2025 Mario Zechner): the agent loop, providers, terminal UI, sessions and compaction come from it, with Pink's own interface, theme and extensions on top.
|
|
130
|
+
License: MIT (see `LICENSE`); the upstream license is in `LICENSE-PI.txt`, and `NOTICE.md` lists what changed.
|
|
@@ -36,6 +36,8 @@ export function gatherExtras(pink: any, dir = process.env.PINK_CODING_AGENT_DIR
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const STATUS = "pink-agente";
|
|
39
|
+
const WIDGET = "pink-agente-trabalhando";
|
|
40
|
+
const FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
39
41
|
|
|
40
42
|
const fresh = () => ({ messages: [] as any[], stderr: "", exitCode: 0, usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, contextTokens: 0, turns: 0 } });
|
|
41
43
|
|
|
@@ -59,28 +61,81 @@ export function render(result: any): string {
|
|
|
59
61
|
|
|
60
62
|
const label = (agent: any) => (agent.model ? `${agent.name} · ${agent.model}` : agent.name);
|
|
61
63
|
|
|
62
|
-
|
|
64
|
+
const loadTui = () => Promise.all([import("@earendil-works/pi-tui"), import("@earendil-works/pi-coding-agent")]);
|
|
65
|
+
|
|
66
|
+
export default function (pink: any, list: typeof externalAgents = externalAgents, run: typeof runExternal = runExternal, models: typeof listModels = listModels, extras: () => any = () => gatherExtras(pink), load: () => Promise<any[]> = loadTui) {
|
|
63
67
|
let active: { agent: any; resume: { id?: string }; controller?: AbortController } | undefined;
|
|
68
|
+
let ticker: ReturnType<typeof setInterval> | undefined;
|
|
69
|
+
let lastUi: any;
|
|
70
|
+
|
|
71
|
+
// "trabalhando" embaixo da caixa: o carregador do Pink só aparece quando o modelo dele está respondendo
|
|
72
|
+
const idle = () => {
|
|
73
|
+
if (ticker) clearInterval(ticker);
|
|
74
|
+
ticker = undefined;
|
|
75
|
+
lastUi?.setWidget?.(WIDGET, undefined);
|
|
76
|
+
};
|
|
77
|
+
const busy = (ui: any, name: string, tool: () => string | undefined) => {
|
|
78
|
+
idle();
|
|
79
|
+
lastUi = ui;
|
|
80
|
+
if (!ui?.setWidget) return;
|
|
81
|
+
const started = Date.now();
|
|
82
|
+
let frame = 0;
|
|
83
|
+
const draw = () => {
|
|
84
|
+
const secs = Math.floor((Date.now() - started) / 1000);
|
|
85
|
+
const what = tool();
|
|
86
|
+
ui.setWidget(WIDGET, [`${FRAMES[frame++ % FRAMES.length]} ${name} ${t("trabalhando", "trabajando", "working")} · ${secs}s${what ? ` · ${what}` : ""} ${t("/agente off cancela", "/agente off cancela", "/agente off cancels")}`], { placement: "belowEditor" });
|
|
87
|
+
};
|
|
88
|
+
draw();
|
|
89
|
+
ticker = setInterval(draw, 120);
|
|
90
|
+
ticker.unref?.();
|
|
91
|
+
};
|
|
64
92
|
|
|
65
93
|
const stop = (ctx?: any) => {
|
|
66
94
|
active?.controller?.abort();
|
|
67
95
|
active = undefined;
|
|
96
|
+
idle();
|
|
68
97
|
(globalThis as any).__pinkExternalAgent = undefined; // o rótulo da caixa volta a "Build · modelo" (pink-ui)
|
|
69
98
|
ctx?.ui?.setStatus?.(STATUS, undefined);
|
|
70
99
|
};
|
|
71
100
|
|
|
101
|
+
// mensagens desenhadas como as da conversa ("Você → opencode" e "opencode · modelo"), não com o tipo cru
|
|
102
|
+
let tui: any;
|
|
103
|
+
let coding: any;
|
|
104
|
+
void load().then(([a, b]) => {
|
|
105
|
+
tui = a;
|
|
106
|
+
coding = b;
|
|
107
|
+
}).catch(() => undefined);
|
|
108
|
+
const textOf = (message: any) => (typeof message.content === "string" ? message.content : (message.content ?? []).map((part: any) => part.text ?? "").join(""));
|
|
109
|
+
pink.registerMessageRenderer?.("pink-agente-pedido", (message: any, options: any, theme: any) => {
|
|
110
|
+
if (!tui) return undefined;
|
|
111
|
+
const details = message.details ?? {};
|
|
112
|
+
const box = new tui.Box(options.outputPad, 1, (line: string) => theme.bg("userMessageBg", line));
|
|
113
|
+
box.addChild(new tui.Text(`${theme.fg("accent", theme.bold(`${t("Você", "Tú", "You")} → ${details.agent ?? ""}`))}\n${details.text ?? textOf(message)}`, 0, 0));
|
|
114
|
+
return box;
|
|
115
|
+
});
|
|
116
|
+
pink.registerMessageRenderer?.("pink-agente", (message: any, options: any, theme: any) => {
|
|
117
|
+
if (!tui || !coding?.getMarkdownTheme) return undefined;
|
|
118
|
+
const details = message.details ?? {};
|
|
119
|
+
const box = new tui.Box(options.outputPad, 0);
|
|
120
|
+
box.addChild(new tui.Text(theme.fg(details.error ? "error" : "accent", theme.bold(details.model ? `${details.agent} · ${details.model}` : details.agent ?? t("agente", "agente", "agent"))), 0, 0));
|
|
121
|
+
box.addChild(new tui.Markdown(textOf(message), 0, 0, coding.getMarkdownTheme()));
|
|
122
|
+
return box;
|
|
123
|
+
});
|
|
124
|
+
|
|
72
125
|
const send = async (text: string, ctx: any) => {
|
|
73
126
|
const current = active!;
|
|
74
127
|
const controller = new AbortController();
|
|
75
128
|
current.controller = controller;
|
|
76
129
|
const name = current.agent.name;
|
|
77
|
-
pink.sendMessage({ customType: "pink-agente-pedido", display: true, content: `› ${name}: ${text}`, details: { agent: name } });
|
|
130
|
+
pink.sendMessage({ customType: "pink-agente-pedido", display: true, content: `› ${name}: ${text}`, details: { agent: name, text } });
|
|
78
131
|
const result = fresh();
|
|
132
|
+
const lastTool = () => result.messages.at(-1)?.content?.find((part: any) => part.type === "toolCall")?.name;
|
|
79
133
|
const status = () => {
|
|
80
|
-
const last =
|
|
81
|
-
ctx.ui?.setStatus?.(STATUS, `${name} ${t("trabalhando", "trabajando", "working")}${last ? `: ${last
|
|
134
|
+
const last = lastTool();
|
|
135
|
+
ctx.ui?.setStatus?.(STATUS, `${name} ${t("trabalhando", "trabajando", "working")}${last ? `: ${last}` : "…"}`);
|
|
82
136
|
};
|
|
83
137
|
status();
|
|
138
|
+
if (ctx.hasUI) busy(ctx.ui, name, lastTool);
|
|
84
139
|
(globalThis as any).__pinkExternalAsk = ctx.hasUI ? (title: string, body: string) => ctx.ui.confirm(title, body) : undefined;
|
|
85
140
|
try {
|
|
86
141
|
await run(current.agent, text, ctx.cwd, controller.signal, result, status, undefined, undefined, current.resume);
|
|
@@ -89,6 +144,7 @@ export default function (pink: any, list: typeof externalAgents = externalAgents
|
|
|
89
144
|
result.errorMessage = controller.signal.aborted ? t("cancelado", "cancelado", "cancelled") : String(error?.message ?? error);
|
|
90
145
|
}
|
|
91
146
|
if (current.controller === controller) current.controller = undefined;
|
|
147
|
+
if (active === current || !active) idle();
|
|
92
148
|
if (active === current) ctx.ui?.setStatus?.(STATUS, `${t("agente", "agente", "agent")}: ${label(current.agent)}`);
|
|
93
149
|
pink.sendMessage({ customType: "pink-agente", display: true, content: render(result), details: { agent: name, model: result.model, usage: result.usage, error: result.stopReason === "error" } });
|
|
94
150
|
};
|
|
@@ -109,8 +165,15 @@ export default function (pink: any, list: typeof externalAgents = externalAgents
|
|
|
109
165
|
let name = wanted;
|
|
110
166
|
if (!name) {
|
|
111
167
|
if (!agents.length) return ctx.ui?.notify?.(t("Nenhum agente instalado encontrado (claude, codex, opencode, cline, copilot, qwen, goose, gemini).", "No se encontró ningún agente instalado (claude, codex, opencode, cline, copilot, qwen, goose, gemini).", "No installed agent found (claude, codex, opencode, cline, copilot, qwen, goose, gemini)."), "warning");
|
|
112
|
-
|
|
168
|
+
// com um agente ligado, o primeiro item volta ao modelo/provedor do Pink (o mesmo que /agente off)
|
|
169
|
+
const back = active ? t(`Voltar ao Pink (desliga o ${active.agent.name})`, `Volver a Pink (apaga ${active.agent.name})`, `Back to Pink (turns ${active.agent.name} off)`) : undefined;
|
|
170
|
+
name = ctx.hasUI ? ((await ctx.ui.select(t("Conversar com qual agente?", "¿Con qué agente conversar?", "Talk to which agent?"), [...(back ? [back] : []), ...agents.map((agent) => agent.name)])) ?? "") : "";
|
|
113
171
|
if (!name) return;
|
|
172
|
+
if (name === back) {
|
|
173
|
+
const was = active?.agent.name;
|
|
174
|
+
stop(ctx);
|
|
175
|
+
return ctx.ui?.notify?.(t(`Voltou ao Pink (${was} desligado).`, `Volviste a Pink (${was} apagado).`, `Back to Pink (${was} off).`), "info");
|
|
176
|
+
}
|
|
114
177
|
}
|
|
115
178
|
const agent = agents.find((item) => item.name === name);
|
|
116
179
|
if (!agent) return ctx.ui?.notify?.(t(`${name} não está instalado. Disponíveis: ${agents.map((a) => a.name).join(", ") || "nenhum"}.`, `${name} no está instalado. Disponibles: ${agents.map((a) => a.name).join(", ") || "ninguno"}.`, `${name} is not installed. Available: ${agents.map((a) => a.name).join(", ") || "none"}.`), "warning");
|