@pmndre/pine 0.35.0 → 0.35.2
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/README.md +2 -2
- package/changes.json +12 -15
- package/docs/SKILL.md +4 -3
- package/docs/references/events.md +1 -1
- package/docs/references/operations.md +1 -1
- package/docs/references/setup.md +1 -1
- package/docs/references/source-types.md +498 -76
- package/docs/references/sources.md +75 -513
- package/docs/references/tui.md +4 -2
- package/package.json +1 -1
- package/src/cli.js +1 -1
- package/src/manual.d.ts +1 -1
- package/src/tools.js +1 -1
- package/src/tui/app.js +33 -8
package/docs/references/tui.md
CHANGED
|
@@ -369,10 +369,12 @@ answer the one before it or put it off.
|
|
|
369
369
|
| `esc` | Later: the request stays open until `security.approvalTimeout` (5 minutes) has passed and then counts as denied. Until then the status line keeps reminding you, `enter` on an empty line opens the dialog again, and `/approve` or `/deny` answer it A question in a tab that is not in front opens no dialog there: that tab gets a `!` in the tab bar, and the status line of the tab you are in says which tab waits (`alt+<n>` goes there) |
|
|
370
370
|
|
|
371
371
|
When the action needs something only you have (a bot's token, a device's password), the dialog
|
|
372
|
-
has a field for it
|
|
372
|
+
has a field for it: the value's name, under it what it is, and a bar to type into. When it needs
|
|
373
|
+
several (the two tokens of a Slack app), each is a block of its own, numbered "1 of 2", and the
|
|
374
|
+
name of the one you are typing into is in colour. Type or paste it: a secret is shown as dots, goes into pine's `.env` and is
|
|
373
375
|
never seen by the agent or its model. (Pairing a Telegram account uses the same dialog for the
|
|
374
376
|
six-digit code the bot sent to your phone; the code is shown as you type and is not stored.)
|
|
375
|
-
`enter` saves and allows, `tab` and `shift+tab
|
|
377
|
+
`enter` saves and allows, `tab` and `shift+tab`, the arrow keys or a click on a field move between fields, `ctrl+u`
|
|
376
378
|
empties one, `esc` leaves it for later, and `/approve` opens the dialog again. The letter keys
|
|
377
379
|
are part of what you type there, so `a` and `d` are not shortcuts in this dialog; Deny is a
|
|
378
380
|
button to click.
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -419,7 +419,7 @@ async function main() {
|
|
|
419
419
|
if (typeof flags.read === "string")
|
|
420
420
|
return out(showRead(manual, flags.read.split(",")));
|
|
421
421
|
if (!rest.length)
|
|
422
|
-
return out(`The parts of pine's manual. Search it (pine manual telegram pairing), or read a part (pine manual --read
|
|
422
|
+
return out(`The parts of pine's manual. Search it (pine manual telegram pairing), or read a part (pine manual --read source-types#telegram).\n${manual.contents()}`);
|
|
423
423
|
return out(showSearch(manual, [rest.join(" ")]));
|
|
424
424
|
}
|
|
425
425
|
if (cmd === "init") {
|
package/src/manual.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface Part {
|
|
2
|
-
/** What it is read by: "
|
|
2
|
+
/** What it is read by: "source-types#telegram", or "configuration#agent-json/globalmcp" for a row. */
|
|
3
3
|
id: string;
|
|
4
4
|
kind: "section" | "row";
|
|
5
5
|
/** The file it is from, without ".md". */
|
package/src/tools.js
CHANGED
|
@@ -1483,7 +1483,7 @@ ${found.description}`, `this takes away something ${found.scope === "global" ? "
|
|
|
1483
1483
|
description: `Look something up in pine's own manual: how pine works and how it is set up. It covers your tools and what each takes, event sources and the options of every type, schedules, MCP servers, skills, agents and sub-agents, the configuration files and every key in them, modes, approvals and what is asked when, the sandbox and what an agent can reach, the terminal UI and its commands, and the pine command. Use it before you answer a question about pine, before you tell your owner what to change or say that something is not possible, and when one of your tools refuses and you want to know why. "search": one or several short queries in plain words, one thing each ("telegram pairing", "who may add a source for all agents", "bashTimeoutSec"); the answer names the best parts with the line that matched. "read": the ids of parts to get in full. Search first, then read the one or two parts that fit. With neither, the list of the manual's parts.`,
|
|
1484
1484
|
parameters: Type.Object({
|
|
1485
1485
|
search: Type.Optional(Type.Union([Type.String(), Type.Array(Type.String())], { description: "What to look for: one query, or several (one thing each)" })),
|
|
1486
|
-
read: Type.Optional(Type.Union([Type.String(), Type.Array(Type.String())], { description: 'Ids of parts to read in full, as a search lists them, e.g. "
|
|
1486
|
+
read: Type.Optional(Type.Union([Type.String(), Type.Array(Type.String())], { description: 'Ids of parts to read in full, as a search lists them, e.g. "source-types#telegram"' })),
|
|
1487
1487
|
}),
|
|
1488
1488
|
execute: async (_id, p) => {
|
|
1489
1489
|
const list = (v) => (Array.isArray(v) ? v : v === undefined || v === "" ? [] : [v]).map(String).map((x) => x.trim()).filter(Boolean);
|
package/src/tui/app.js
CHANGED
|
@@ -818,6 +818,8 @@ class ApprovalDialog {
|
|
|
818
818
|
*/
|
|
819
819
|
fields;
|
|
820
820
|
field = 0;
|
|
821
|
+
/** The rows each value's block takes in the dialog, for a click on one. */
|
|
822
|
+
areas = [];
|
|
821
823
|
constructor(req, done) {
|
|
822
824
|
this.req = req;
|
|
823
825
|
this.done = done;
|
|
@@ -851,6 +853,10 @@ class ApprovalDialog {
|
|
|
851
853
|
const b = this.buttons.find((x) => e.y === x.row && e.x >= x.from && e.x < x.to);
|
|
852
854
|
if (b && e.type === "click" && e.button === "left")
|
|
853
855
|
this.answer(b.answer);
|
|
856
|
+
// A click on a value's block is where the typing goes next.
|
|
857
|
+
const area = this.areas.find((x) => e.y >= x.from && e.y < x.to);
|
|
858
|
+
if (area && e.type === "click" && e.button === "left")
|
|
859
|
+
this.field = area.field;
|
|
854
860
|
return { handled: true, render: true };
|
|
855
861
|
}
|
|
856
862
|
handleInput(data) {
|
|
@@ -895,11 +901,6 @@ class ApprovalDialog {
|
|
|
895
901
|
}
|
|
896
902
|
render(width) {
|
|
897
903
|
const inner = Math.max(20, width - 4);
|
|
898
|
-
const inputs = this.fields.flatMap((f, i) => [
|
|
899
|
-
...wrapTextWithAnsi(c.bold(f.label), inner),
|
|
900
|
-
// A secret is never shown: a dot for each character, so that you see it arrive.
|
|
901
|
-
`${i === this.field ? c.accent(">") : " "} ${c.yellow(f.secret ? "•".repeat(Math.min(f.value.length, inner - 6)) : f.value.slice(-(inner - 6)))}${i === this.field ? c.inverse(" ") : ""}`,
|
|
902
|
-
]);
|
|
903
904
|
const body = [
|
|
904
905
|
c.bold(c.yellow(this.fields.length ? "Approval needed, and something only you have" : "Approval needed")),
|
|
905
906
|
"",
|
|
@@ -911,9 +912,33 @@ class ApprovalDialog {
|
|
|
911
912
|
...(this.req.holds ? wrapTextWithAnsi(c.gray(`"Allow" holds for ${this.req.holds}: you are not asked about it again there.`), inner) : []),
|
|
912
913
|
...(this.req.remember ? wrapTextWithAnsi(c.gray(`"Always here" stops asking about ${this.req.remember} in this conversation.`), inner) : []),
|
|
913
914
|
...(!this.req.remember && !this.req.holds && !this.fields.length ? wrapTextWithAnsi(c.gray("This one is asked every time: there is no \"always\" for it."), inner) : []),
|
|
914
|
-
...(inputs.length ? ["", ...inputs, ...wrapTextWithAnsi(c.gray(this.fields.some((f) => f.secret) ? "Type or paste it here. It is not shown, goes into pine's .env file, and never reaches the agent or its model." : "Type it here and press enter. Without it, this cannot be allowed."), inner)] : []),
|
|
915
|
-
"",
|
|
916
915
|
];
|
|
916
|
+
// Each value is a block of its own: its name, what it is, and a bar to type into, with an empty
|
|
917
|
+
// line before it. Run together, two tokens read as one paragraph.
|
|
918
|
+
const bar = inner - 2;
|
|
919
|
+
this.areas = [];
|
|
920
|
+
this.fields.forEach((f, i) => {
|
|
921
|
+
const active = i === this.field;
|
|
922
|
+
// A label that reads "name: what it is" or "NAME (what it is)" is its name and, under it, the rest.
|
|
923
|
+
const [, name, about] = f.label.match(/^([\w.-]+): ([\s\S]+)$/) ?? f.label.match(/^([\w.-]+) \(([\s\S]+)\)$/) ?? [null, f.label, ""];
|
|
924
|
+
const count = this.fields.length > 1 ? `${i + 1} of ${this.fields.length}` : "";
|
|
925
|
+
// A secret is never shown: a dot for each character, so that you see it arrive.
|
|
926
|
+
const shown = f.secret ? "•".repeat(Math.min(f.value.length, bar - 2)) : f.value.slice(-(bar - 2));
|
|
927
|
+
const typed = shown || active ? `${c.yellow(shown)}${active ? c.inverse(" ") : ""}` : c.gray("empty");
|
|
928
|
+
body.push("");
|
|
929
|
+
const from = 1 + body.length;
|
|
930
|
+
body.push(...wrapTextWithAnsi(active ? c.bold(c.accent(name)) : c.bold(name), inner - count.length - 2).map((l, n) => (n || !count ? l : `${l}${" ".repeat(Math.max(2, inner - visibleWidth(l) - count.length))}${c.gray(count)}`)), ...(about ? wrapTextWithAnsi(about, inner) : []), `${active ? c.accent(">") : " "} ${c.bgPanel(`${typed}${" ".repeat(Math.max(0, bar - visibleWidth(typed)))}`)}`);
|
|
931
|
+
this.areas.push({ from, to: 1 + body.length, field: i });
|
|
932
|
+
});
|
|
933
|
+
if (this.fields.length) {
|
|
934
|
+
const hint = !this.fields.some((f) => f.secret)
|
|
935
|
+
? "Type it here and press enter. Without it, this cannot be allowed."
|
|
936
|
+
: this.fields.length > 1
|
|
937
|
+
? "Type or paste each one into its bar; tab goes to the next. They are not shown, go into pine's .env file, and never reach the agent or its model."
|
|
938
|
+
: "Type or paste it here. It is not shown, goes into pine's .env file, and never reaches the agent or its model.";
|
|
939
|
+
body.push("", ...wrapTextWithAnsi(c.gray(hint), inner));
|
|
940
|
+
}
|
|
941
|
+
body.push("");
|
|
917
942
|
// The buttons, wrapped onto a second line in a narrow window. Their places are kept for clicks:
|
|
918
943
|
// two columns of border and padding, then the labels.
|
|
919
944
|
const rows = [""];
|
|
@@ -2592,7 +2617,7 @@ export class PineTui {
|
|
|
2592
2617
|
const list = await this.client.sources();
|
|
2593
2618
|
const t = this.active;
|
|
2594
2619
|
if (!list.length)
|
|
2595
|
-
return void this.say(t, c.gray(`no event sources configured. They go into "sources" in pine.json (for every agent) or an agent.json; docs/references/
|
|
2620
|
+
return void this.say(t, c.gray(`no event sources configured. They go into "sources" in pine.json (for every agent) or an agent.json; docs/references/source-types.md has the types.`));
|
|
2596
2621
|
this.say(t, list.map((x) => `${c.bold(x.name)}${x.scope === "global" ? "" : c.gray(` (of ${x.scope})`)} ${c.gray(x.type)} ${x.error ? c.red(`not running: ${x.error}`) : x.running ? c.green("running") : c.gray("idle")}${x.description ? c.gray(` · ${x.description}`) : ""}${x.status ? `\n ${x.status}` : ""}\n${c.gray(` subscribers: ${x.subscribers.join(", ") || "none"} · ${x.last ? `last event ${new Date(x.last.ts).toLocaleTimeString("sv-SE")}, ${x.events} since start` : "no events since start"}`)}`).join("\n"));
|
|
2597
2622
|
this.say(t, c.gray("/subscribe <source> [what to do] wakes this tab's agent on its events · /unsubscribe <source> stops that"), false);
|
|
2598
2623
|
},
|