pipeup 0.9.0 → 1.0.0
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 +3 -3
- package/cli/browser-host.mjs +43 -0
- package/cli/browser.mjs +144 -0
- package/cli/check.mjs +14 -1
- package/cli/pipeup.mjs +54 -2
- package/cli/read.mjs +1 -1
- package/dist/addons.json +12 -12
- package/dist/pipeup.agents.js +1 -1
- package/dist/pipeup.core.js +1 -1
- package/dist/pipeup.esm.js +1 -1
- package/dist/pipeup.min.js +1 -1
- package/dist/types/anchor/clues.d.ts +16 -0
- package/dist/types/anchor/resolve.d.ts +2 -0
- package/dist/types/core.d.ts +2 -2
- package/dist/types/document.d.ts +6 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/model/ops.d.ts +3 -0
- package/dist/types/model/types.d.ts +22 -2
- package/dist/types/ui/addons.d.ts +13 -0
- package/dist/types/ui/app.d.ts +21 -0
- package/dist/types/ui/column.d.ts +2 -0
- package/dist/types/ui/context.d.ts +11 -0
- package/dist/types/ui/field.d.ts +22 -0
- package/dist/types/ui/host.d.ts +1 -1
- package/dist/types/ui/mount.d.ts +42 -0
- package/dist/types/ui/styles.d.ts +1 -1
- package/dist/types/ui/thread-view.d.ts +4 -0
- package/package.json +3 -2
- package/skills/pipeup-add/SKILL.md +2 -2
- package/skills/pipeup-apply/SKILL.md +14 -9
- package/skills/pipeup-integrate/SKILL.md +40 -8
- package/skills/pipeup-send-to-git-setup/SKILL.md +1 -1
- package/skills/pipeup-summarise/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Comments and feedback right on any HTML page: documents, slide decks and whole sites.
|
|
4
4
|
|
|
5
|
-
> **Alpha (0.
|
|
5
|
+
> **Alpha (1.0.0).** The API and the stored comment format may change before 1.0; pin an exact version.
|
|
6
6
|
> Website and Try pages: https://pipeup-ai.github.io/pipeup/ · Source: https://github.com/pipeup-ai/pipeup
|
|
7
7
|
|
|
8
8
|
Pipeup: signed comment operations, threads with one-level replies, anchors that survive page changes,
|
|
@@ -23,7 +23,7 @@ its address:
|
|
|
23
23
|
```html
|
|
24
24
|
<html data-pipeup-doc="<id>:<key>">
|
|
25
25
|
...
|
|
26
|
-
<script src="https://cdn.jsdelivr.net/npm/pipeup@0.
|
|
26
|
+
<script src="https://cdn.jsdelivr.net/npm/pipeup@1.0.0/dist/pipeup.min.js" integrity="sha384-…" crossorigin="anonymous" defer></script>
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
On a host that writes its own `<html>` (claude.ai Artifacts, for example), put the same settings on the script
|
|
@@ -45,7 +45,7 @@ Install with `npm i pipeup`. From a bundler (no side effects; call `mount` yours
|
|
|
45
45
|
|
|
46
46
|
```js
|
|
47
47
|
import { mount } from "pipeup";
|
|
48
|
-
const pipeup = await mount({ name: "Sam" }); // options: root, name, store, slides, doc, layout, theme, select
|
|
48
|
+
const pipeup = await mount({ name: "Sam" }); // options: root, name, store, prefs, keep, closed, field, ui, slides, doc, layout, theme, select, control
|
|
49
49
|
await pipeup.flush(); // write any unsaved changes now (this also happens when the page is hidden)
|
|
50
50
|
pipeup.unmount(); // remove Pipeup from the page; the comments stay saved
|
|
51
51
|
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The program the browser starts when the Pipeup extension talks to this computer (native messaging): one message in,
|
|
3
|
+
// one answer out, each a 4-byte length (in the computer's byte order) then JSON. See browser.mjs.
|
|
4
|
+
import { receive, replies } from "./browser.mjs";
|
|
5
|
+
|
|
6
|
+
let buffer = Buffer.alloc(0);
|
|
7
|
+
|
|
8
|
+
function answer(message) {
|
|
9
|
+
const body = Buffer.from(JSON.stringify(message));
|
|
10
|
+
const head = Buffer.alloc(4);
|
|
11
|
+
head.writeUInt32LE(body.length, 0);
|
|
12
|
+
process.stdout.write(Buffer.concat([head, body]));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function handle(m) {
|
|
16
|
+
try {
|
|
17
|
+
if (m?.type === "hello") return answer({ ok: true });
|
|
18
|
+
if (m?.type === "send") return answer({ ok: true, ...(await receive(m)) });
|
|
19
|
+
if (m?.type === "replies") return answer({ ok: true, replies: await replies(m.doc) });
|
|
20
|
+
answer({ ok: false, error: `unknown message ${JSON.stringify(m?.type)}` });
|
|
21
|
+
} catch (e) {
|
|
22
|
+
answer({ ok: false, error: String(e?.message ?? e) });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
process.stdin.on("data", (chunk) => {
|
|
27
|
+
buffer = Buffer.concat([buffer, chunk]);
|
|
28
|
+
while (buffer.length >= 4) {
|
|
29
|
+
const size = buffer.readUInt32LE(0);
|
|
30
|
+
if (buffer.length < 4 + size) return;
|
|
31
|
+
const text = buffer.subarray(4, 4 + size).toString("utf8");
|
|
32
|
+
buffer = buffer.subarray(4 + size);
|
|
33
|
+
let message;
|
|
34
|
+
try {
|
|
35
|
+
message = JSON.parse(text);
|
|
36
|
+
} catch {
|
|
37
|
+
answer({ ok: false, error: "not JSON" });
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
void handle(message);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
process.stdin.on("end", () => process.exit(0));
|
package/cli/browser.mjs
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// pipeup browser: the browser extension's link to agents on this computer. The extension sends a page's comments here
|
|
2
|
+
// (through Chrome's native messaging, to browser-host.mjs), an agent reads them with `pipeup browser read` and answers
|
|
3
|
+
// with `pipeup browser reply`, and the extension puts the replies into their threads. Everything stays in
|
|
4
|
+
// ~/.pipeup/browser, one folder per page; nothing leaves this computer.
|
|
5
|
+
import { chmod, mkdir, readdir, readFile, writeFile } from "node:fs/promises";
|
|
6
|
+
import { homedir, platform } from "node:os";
|
|
7
|
+
import { dirname, join } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
|
|
10
|
+
/** The name the extension asks the browser for. */
|
|
11
|
+
export const HOST = "ai.pipeup.browser";
|
|
12
|
+
/** The extension's id in Firefox, which (unlike Chrome's) is the same on every computer. */
|
|
13
|
+
export const FIREFOX_ID = "extension@pipeup.ai";
|
|
14
|
+
/** Where pages sent from the browser are kept. */
|
|
15
|
+
export const inbox = () => process.env.PIPEUP_BROWSER_DIR || join(homedir(), ".pipeup", "browser");
|
|
16
|
+
/** A document id as a folder name: Pipeup's ids are letters, digits, "-", "_" and ":" (kept as "_"). */
|
|
17
|
+
const folderOf = (doc) =>
|
|
18
|
+
join(
|
|
19
|
+
inbox(),
|
|
20
|
+
String(doc)
|
|
21
|
+
.replace(/[^A-Za-z0-9_-]/g, "_")
|
|
22
|
+
.slice(0, 120),
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
/** Where each browser looks for native messaging hosts, per platform. */
|
|
26
|
+
const PLACES = {
|
|
27
|
+
darwin: {
|
|
28
|
+
chrome: "Library/Application Support/Google/Chrome/NativeMessagingHosts",
|
|
29
|
+
chromium: "Library/Application Support/Chromium/NativeMessagingHosts",
|
|
30
|
+
edge: "Library/Application Support/Microsoft Edge/NativeMessagingHosts",
|
|
31
|
+
brave: "Library/Application Support/BraveSoftware/Brave-Browser/NativeMessagingHosts",
|
|
32
|
+
firefox: "Library/Application Support/Mozilla/NativeMessagingHosts",
|
|
33
|
+
},
|
|
34
|
+
linux: {
|
|
35
|
+
chrome: ".config/google-chrome/NativeMessagingHosts",
|
|
36
|
+
chromium: ".config/chromium/NativeMessagingHosts",
|
|
37
|
+
edge: ".config/microsoft-edge/NativeMessagingHosts",
|
|
38
|
+
brave: ".config/BraveSoftware/Brave-Browser/NativeMessagingHosts",
|
|
39
|
+
firefox: ".mozilla/native-messaging-hosts",
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Lets the extension reach this computer's agents: writes a small launcher (with this Node's own path, since a
|
|
45
|
+
* browser starts programs without the terminal's PATH) and the browser's host file, allowing only Pipeup's extension:
|
|
46
|
+
* `extensionId` in Chrome and its kin (each computer's copy has its own), Pipeup's fixed id in Firefox.
|
|
47
|
+
*/
|
|
48
|
+
export async function install({ extensionId, browser = "chrome" }) {
|
|
49
|
+
const firefox = browser === "firefox";
|
|
50
|
+
if (!firefox && !/^[a-p]{32}$/.test(extensionId ?? ""))
|
|
51
|
+
throw new Error(
|
|
52
|
+
"give the extension's id: chrome://extensions shows it on Pipeup's card (32 letters a to p)",
|
|
53
|
+
);
|
|
54
|
+
const place = PLACES[platform()]?.[browser];
|
|
55
|
+
if (!place)
|
|
56
|
+
throw new Error(`setting up ${browser} on ${platform()} isn't supported yet (macOS and Linux are)`);
|
|
57
|
+
const host = fileURLToPath(new URL("./browser-host.mjs", import.meta.url));
|
|
58
|
+
const launcher = join(homedir(), ".pipeup", "browser-host.sh");
|
|
59
|
+
await mkdir(dirname(launcher), { recursive: true });
|
|
60
|
+
await writeFile(launcher, `#!/bin/sh\nexec "${process.execPath}" "${host}" "$@"\n`);
|
|
61
|
+
await chmod(launcher, 0o755);
|
|
62
|
+
const file = join(homedir(), place, `${HOST}.json`);
|
|
63
|
+
await mkdir(dirname(file), { recursive: true });
|
|
64
|
+
const manifest = {
|
|
65
|
+
name: HOST,
|
|
66
|
+
description: "Pipeup: comments from the browser for agents on this computer",
|
|
67
|
+
path: launcher,
|
|
68
|
+
type: "stdio",
|
|
69
|
+
...(firefox
|
|
70
|
+
? { allowed_extensions: [FIREFOX_ID] }
|
|
71
|
+
: { allowed_origins: [`chrome-extension://${extensionId}/`] }),
|
|
72
|
+
};
|
|
73
|
+
await writeFile(file, JSON.stringify(manifest, null, 2) + "\n");
|
|
74
|
+
return { file, launcher };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** What the extension sent: the page, its comments as Markdown for an AI, and as a Pipeup comments file. */
|
|
78
|
+
export async function receive({ doc, url, title, markdown, file }) {
|
|
79
|
+
if (!doc || typeof markdown !== "string") throw new Error("nothing to keep: no page or comments");
|
|
80
|
+
const dir = folderOf(doc);
|
|
81
|
+
await mkdir(dir, { recursive: true });
|
|
82
|
+
await writeFile(
|
|
83
|
+
join(dir, "page.json"),
|
|
84
|
+
JSON.stringify({ doc, url, title, at: Date.now() }, null, 2) + "\n",
|
|
85
|
+
);
|
|
86
|
+
await writeFile(join(dir, "comments.md"), markdown);
|
|
87
|
+
if (typeof file === "string") await writeFile(join(dir, "comments.json"), file);
|
|
88
|
+
return { folder: dir };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** The replies agents left for a page, oldest first. */
|
|
92
|
+
export async function replies(doc) {
|
|
93
|
+
try {
|
|
94
|
+
return JSON.parse(await readFile(join(folderOf(doc), "replies.json"), "utf8"));
|
|
95
|
+
} catch {
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** Every page sent from the browser, newest first. */
|
|
101
|
+
export async function pages() {
|
|
102
|
+
const names = await readdir(inbox()).catch(() => []);
|
|
103
|
+
const out = [];
|
|
104
|
+
for (const n of names) {
|
|
105
|
+
try {
|
|
106
|
+
out.push(JSON.parse(await readFile(join(inbox(), n, "page.json"), "utf8")));
|
|
107
|
+
} catch {
|
|
108
|
+
// Not a page's folder.
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return out.sort((a, b) => b.at - a.at);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** The page whose doc, address or title contains `which` (the newest when there are several), or null. */
|
|
115
|
+
export async function find(which) {
|
|
116
|
+
const all = await pages();
|
|
117
|
+
if (!which) return all[0] ?? null;
|
|
118
|
+
const w = String(which).toLowerCase();
|
|
119
|
+
return (
|
|
120
|
+
all.find((p) =>
|
|
121
|
+
[p.doc, p.url, p.title].some((v) =>
|
|
122
|
+
String(v ?? "")
|
|
123
|
+
.toLowerCase()
|
|
124
|
+
.includes(w),
|
|
125
|
+
),
|
|
126
|
+
) ?? null
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** A page's comments, as the extension last sent them. */
|
|
131
|
+
export async function readComments(doc) {
|
|
132
|
+
return readFile(join(folderOf(doc), "comments.md"), "utf8");
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Adds an agent's reply to a thread; the extension puts it in the thread the next time it looks. */
|
|
136
|
+
export async function reply({ doc, thread, agent, text }) {
|
|
137
|
+
if (!thread || !text?.trim()) throw new Error("a reply needs --thread <id> and the words");
|
|
138
|
+
const list = await replies(doc);
|
|
139
|
+
const id = `${Date.now().toString(36)}-${list.length}`;
|
|
140
|
+
list.push({ id, thread, agent: agent || "Agent", text: text.trim(), at: Date.now() });
|
|
141
|
+
await mkdir(folderOf(doc), { recursive: true });
|
|
142
|
+
await writeFile(join(folderOf(doc), "replies.json"), JSON.stringify(list, null, 2) + "\n");
|
|
143
|
+
return id;
|
|
144
|
+
}
|
package/cli/check.mjs
CHANGED
|
@@ -50,6 +50,8 @@ const inspect = async () => {
|
|
|
50
50
|
addons: [],
|
|
51
51
|
appearance: null,
|
|
52
52
|
tabbable: false,
|
|
53
|
+
pageOwned: false,
|
|
54
|
+
opensMenu: false,
|
|
53
55
|
agents: document.documentElement.getAttribute("data-pipeup-agents") || "",
|
|
54
56
|
viewport: Boolean(document.querySelector('meta[name="viewport"]')),
|
|
55
57
|
};
|
|
@@ -76,6 +78,9 @@ const inspect = async () => {
|
|
|
76
78
|
}
|
|
77
79
|
const control = document.querySelector("pipeup-root")?.shadowRoot?.querySelector(".launch .mode");
|
|
78
80
|
out.tabbable = Boolean(control) && control.tabIndex >= 0;
|
|
81
|
+
// The page has its own way to start commenting and hides Pipeup's control: something must open Pipeup's menu.
|
|
82
|
+
out.pageOwned = Boolean(document.querySelector("pipeup-root")?.shadowRoot?.querySelector(".launch.off"));
|
|
83
|
+
out.opensMenu = [...document.scripts].some((s) => /\.openMenu\s*\(/.test(s.textContent || ""));
|
|
79
84
|
return out;
|
|
80
85
|
};
|
|
81
86
|
|
|
@@ -219,7 +224,15 @@ export async function check({ page, widths = WIDTHS, log = () => {} }) {
|
|
|
219
224
|
? `${o.blocks} without data-pipeup-id: comments on them may lose their place when the page changes`
|
|
220
225
|
: "",
|
|
221
226
|
);
|
|
222
|
-
|
|
227
|
+
if (o.pageOwned)
|
|
228
|
+
add(
|
|
229
|
+
o.opensMenu ? "pass" : "warn",
|
|
230
|
+
"Reviewers can reach Pipeup's menu",
|
|
231
|
+
o.opensMenu
|
|
232
|
+
? ""
|
|
233
|
+
: 'Pipeup\'s control is hidden (data-pipeup-control="off") and no script on the page calls openMenu(): reviewers copy and send their comments from that menu',
|
|
234
|
+
);
|
|
235
|
+
else add(o.tabbable ? "pass" : "fail", "Pipeup's button can be reached with the keyboard");
|
|
223
236
|
add(
|
|
224
237
|
o.viewport ? "pass" : "warn",
|
|
225
238
|
"The page suits phones",
|
package/cli/pipeup.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { check, table } from "./check.mjs";
|
|
|
9
9
|
import { apply, htmlAttr, init, InitError, survey } from "./init.mjs";
|
|
10
10
|
import { read, ReadError } from "./read.mjs";
|
|
11
11
|
import { comments, watch } from "./link.mjs";
|
|
12
|
+
import * as browser from "./browser.mjs";
|
|
12
13
|
import * as skills from "./skills.mjs";
|
|
13
14
|
|
|
14
15
|
// The page library, loaded only by the commands that sign or read a page: `skills` and `comments` need nothing built.
|
|
@@ -66,10 +67,22 @@ pipeup reply --print (--doc <document id> | --page <file.html>) --thread <id> "<
|
|
|
66
67
|
Prints the same signed reply as a replies block for the person to paste into the page (Paste my agent's replies),
|
|
67
68
|
for an agent that can't write next to the page. Copy for my agent gives the document id. Nothing is written.
|
|
68
69
|
|
|
69
|
-
|
|
70
|
+
pipeup browser install --extension-id <id> [--browser chrome|edge|chromium|brave]
|
|
71
|
+
pipeup browser install --browser firefox
|
|
72
|
+
Lets the Pipeup browser extension send comments to agents on this computer (macOS and Linux). Run it once; in Chrome
|
|
73
|
+
and its kin the id is on Pipeup's card in chrome://extensions; Firefox needs none.
|
|
74
|
+
|
|
75
|
+
pipeup browser [read <page>]
|
|
76
|
+
Lists the pages whose comments were sent from the browser (Send to my agent), newest first; read prints one page's
|
|
77
|
+
comments as Markdown (<page> is part of its address, title or document id; the newest when left out).
|
|
78
|
+
|
|
79
|
+
pipeup browser reply <page> --thread <id> [--agent <name>] "<words>"
|
|
80
|
+
Answers a thread on a page sent from the browser; the extension puts the reply in the thread.
|
|
81
|
+
|
|
82
|
+
Agents run these as \`npx --yes pipeup@1 …\`: any 1.x release answers agent, reply and comments the same way.`;
|
|
70
83
|
|
|
71
84
|
/** How agents are told to run this command line: never stopping to ask, and any release npm will give. */
|
|
72
|
-
const RUN = "npx --yes pipeup@
|
|
85
|
+
const RUN = "npx --yes pipeup@1";
|
|
73
86
|
/** A path as the person typed it, or relative to where they are. */
|
|
74
87
|
const shown = (file) => relative(process.cwd(), resolve(file)) || file;
|
|
75
88
|
const DOC = /<html\b[^>]*\sdata-pipeup-doc\s*=\s*["']([^"']+)["']/i;
|
|
@@ -466,6 +479,45 @@ else if (command === "skills") {
|
|
|
466
479
|
const stop = () => link.close().then(() => process.exit(0));
|
|
467
480
|
process.on("SIGINT", stop);
|
|
468
481
|
process.on("SIGTERM", stop);
|
|
482
|
+
} else if (command === "browser") {
|
|
483
|
+
const [sub, which] = args._;
|
|
484
|
+
try {
|
|
485
|
+
if (sub === "install") {
|
|
486
|
+
const { file } = await browser.install({
|
|
487
|
+
extensionId: typeof args["extension-id"] === "string" ? args["extension-id"] : "",
|
|
488
|
+
browser: typeof args.browser === "string" ? args.browser : "chrome",
|
|
489
|
+
});
|
|
490
|
+
console.log(
|
|
491
|
+
`Done: the extension can now send comments here (${file}). Reload the extension to use it.`,
|
|
492
|
+
);
|
|
493
|
+
} else if (sub === "read") {
|
|
494
|
+
const page = await browser.find(which);
|
|
495
|
+
if (!page) fail("no page has been sent from the browser yet: press Send to my agent in Pipeup's menu");
|
|
496
|
+
console.log(await browser.readComments(page.doc));
|
|
497
|
+
} else if (sub === "reply") {
|
|
498
|
+
const page = await browser.find(which);
|
|
499
|
+
if (!page) fail("no page with that address, title or id has been sent from the browser");
|
|
500
|
+
const text = args._.slice(2).join(" ");
|
|
501
|
+
await browser.reply({
|
|
502
|
+
doc: page.doc,
|
|
503
|
+
thread: typeof args.thread === "string" ? args.thread : "",
|
|
504
|
+
agent: typeof args.agent === "string" ? args.agent : AI,
|
|
505
|
+
text,
|
|
506
|
+
});
|
|
507
|
+
console.log(
|
|
508
|
+
`Reply kept for "${page.title || page.url}"; it shows in the thread when the page is next open.`,
|
|
509
|
+
);
|
|
510
|
+
} else {
|
|
511
|
+
const all = await browser.pages();
|
|
512
|
+
if (!all.length) console.log("No pages sent from the browser yet.");
|
|
513
|
+
for (const p of all)
|
|
514
|
+
console.log(
|
|
515
|
+
`${new Date(p.at).toISOString().slice(0, 16).replace("T", " ")} ${p.title || ""} ${p.url}`,
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
} catch (e) {
|
|
519
|
+
fail(e.message);
|
|
520
|
+
}
|
|
469
521
|
} else {
|
|
470
522
|
console.log(USAGE);
|
|
471
523
|
process.exit(command ? 1 : 0);
|
package/cli/read.mjs
CHANGED
|
@@ -53,7 +53,7 @@ async function filesIn(dir, deep) {
|
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* The share add-on's headless reader, if it is installed: beside this package, or in the project the command runs in
|
|
56
|
-
* (as with `npx --yes pipeup@
|
|
56
|
+
* (as with `npx --yes pipeup@1 read` in a folder where `@pipeup/share` is installed). It is never a dependency of `pipeup`.
|
|
57
57
|
*/
|
|
58
58
|
async function shareReader() {
|
|
59
59
|
try {
|
package/dist/addons.json
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"share": {
|
|
3
|
-
"integrity": "sha384-
|
|
3
|
+
"integrity": "sha384-w4RYzEq5wRn8eDBAX921njKaVpWBX7kR7X9E1G0qQVt14N7JN9xCGx+goBw9o6Kz",
|
|
4
4
|
"says": "Sends the comments you choose to share, sealed so only people with this page can read them, to the sharing service the page names. That service sees when and how much is sent, and your network address."
|
|
5
5
|
},
|
|
6
6
|
"voice": {
|
|
7
|
-
"integrity": "sha384-
|
|
7
|
+
"integrity": "sha384-gOs/8ApOEJZ9xo5pku1gxug3iQ5C2BUDM2eYArjjqU4pNNKfW86u4ly0l4v3J82r",
|
|
8
8
|
"says": "Only when you press the microphone: your browser may download a speech pack once, and, only if it can't work on this device, your voice goes to the browser maker's speech service."
|
|
9
9
|
},
|
|
10
10
|
"live": {
|
|
11
|
-
"integrity": "sha384-
|
|
11
|
+
"integrity": "sha384-utHEBGBribe/S/s/CKS1jYc7PA1JPyGIcJjOMaI4Ebk3qtuREwV5aGGZOFZTGNlO",
|
|
12
12
|
"says": "When you go live, you connect directly to other people viewing this page. They see your network address; the meeting-point services see your network address and when you connect, never your comments."
|
|
13
13
|
},
|
|
14
14
|
"assist": {
|
|
15
|
-
"integrity": "sha384-
|
|
15
|
+
"integrity": "sha384-uErGyE6xJUAMUFaiIBXVnb1w60kuQkNA60ewOxSMwo571U7OoxqY3F6m3EO7gmwh",
|
|
16
16
|
"says": "Only after you turn it on: your browser may download a small AI model once. Comments and the page are read on this device and never sent anywhere; if the page's author named notes files, they are read from this site."
|
|
17
17
|
},
|
|
18
18
|
"agents": {
|
|
19
|
-
"integrity": "sha384-
|
|
19
|
+
"integrity": "sha384-qPyenmXi+daHEYBvdxD8daUnzVVidLWKzvK8v7pxkv4SdJC5XYf2c12m6KRuqYcC",
|
|
20
20
|
"says": "Reads a replies file next to this page, and replies you paste from your agent. When the page is shown through pipeup watch, and only after you switch it on, it sends this page's comments to the program running on this computer. Nothing leaves this computer."
|
|
21
21
|
},
|
|
22
22
|
"emoji": {
|
|
23
|
-
"integrity": "sha384-
|
|
23
|
+
"integrity": "sha384-kxynJAvc6pIXLeGULqM1QlscllYFQe5pUR7guCwJFXHjSRANazDissD8eiJ0PQei",
|
|
24
24
|
"says": "Nothing is sent anywhere: the emoji are part of this script."
|
|
25
25
|
},
|
|
26
26
|
"github": {
|
|
27
|
-
"integrity": "sha384-
|
|
28
|
-
"says": "Only when you press Mention on GitHub: your browser opens GitHub's new-issue page with the person's @name
|
|
27
|
+
"integrity": "sha384-1ya3Hiu034B+ovYc4Fmr965dYJDeHdN9Pc3yA7qmHKLtK5ZU0j9vrRJmLI42sIdf",
|
|
28
|
+
"says": "Only when you press Mention on GitHub: your browser opens GitHub's new-issue page with the person's @name, your name, the comment's words and this page's title and address filled in, so GitHub receives them as the page opens; nothing is filed until you submit it there.",
|
|
29
29
|
"asks": {
|
|
30
30
|
"attr": "data-pipeup-github-repo",
|
|
31
31
|
"flag": "github-repo",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"updates": {
|
|
37
|
-
"integrity": "sha384-
|
|
37
|
+
"integrity": "sha384-ZjxhI+0agw31MWfQqwTIyIOX/+NR+VEkdDpyzZW15Mu6w7XCh2pv/MpBJHiMGM/9",
|
|
38
38
|
"says": "Checks the Pipeup project's published update list (GitHub Pages) once a day, only on this computer or where the page's author asked; that service can see your network address."
|
|
39
39
|
},
|
|
40
40
|
"inbox": {
|
|
41
|
-
"integrity": "sha384-
|
|
41
|
+
"integrity": "sha384-ofJo54CchllZPT8dAHOmJ4GTmUNYNNUgscQqOUfTG9ag1MhLlwxkOkQUKlsxGuoe",
|
|
42
42
|
"says": "Only after you switch on Mentions by inbox: when you mention someone, a short note (who, your words, the page's address) is left for them at the page's inbox service, sealed so only they can read it; and your own inbox is checked there. The service sees that a note arrived, its size and when, and your network address, never who it is from or what it says.",
|
|
43
43
|
"asks": {
|
|
44
44
|
"attr": "data-pipeup-inbox",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"identity": {
|
|
51
|
-
"integrity": "sha384-
|
|
51
|
+
"integrity": "sha384-x/uWzQfOpExQ6nvR9e92j0ZvesjYqo/YKfOeF8u5reRSJmMRkbIHFgbitDRV2ka7",
|
|
52
52
|
"says": "Nothing. Your recovery code stays on this device unless you copy it or save it as a file yourself."
|
|
53
53
|
},
|
|
54
54
|
"inline": {
|
|
55
|
-
"integrity": "sha384-
|
|
55
|
+
"integrity": "sha384-PDr1VOWqQ32NPlqk7mUfLO0uY77SRA4/KwFOzkU+n/ULMRfikon4fjd1cN2c0Dj2",
|
|
56
56
|
"says": "Sends nothing: answers to asks are ordinary comments, kept and sent the way the page's other comments are."
|
|
57
57
|
}
|
|
58
58
|
}
|
package/dist/pipeup.agents.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";(()=>{function x(e){let t=globalThis;(t.pipeupAddons||=[]).push(e),typeof addEventListener=="function"&&addEventListener("load",()=>{t.Pipeup||console.error(`pipeup: the "${e.id}" add-on needs Pipeup on the page too; load pipeup.min.js.`)},{once:!0})}var w=(e,t)=>t?t.getAttribute(e):globalThis.Pipeup?.setting?.(e)??globalThis.document?.documentElement.getAttribute(e)??null;var Ie=2n**256n-2n**32n-977n;var X=/^\/__pipeup\/[A-Za-z0-9_-]{16,}$/;function I(e){let t=document.documentElement,s=t.getAttribute("data-pipeup-link")??"",r=X.test(s),n=!1,i=0,p=()=>{};async function c(){let l=!1;try{l=(await fetch(`${s}/comments`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(await e.snapshot())})).ok}catch{}if(!l)throw new Error("pipeup: the link to your agent isn't reachable; your comments are safe here")}let a=()=>{window.clearTimeout(i),p(),p=()=>{},n=!1};return{enabled:r,agent:t.getAttribute("data-pipeup-link-agent")??"",file:t.getAttribute("data-pipeup-link-file")??"",on:()=>n,set:async l=>{if(r){if(!l){a(),e.refresh();return}await c(),n=!0,p=e.changes(()=>{window.clearTimeout(i),i=window.setTimeout(()=>{c().catch(o=>{a(),e.refresh(),globalThis.reportError?.(o)})},300)}),e.refresh()}},destroy:a}}var Q=/```[ \t]*pipeup-replies[^\n]*\n([\s\S]*?)(?:\n[ \t]*```|$)/g,ee=/^[ \t]*(agent|thread|reply|addressed|signed)[ \t]*:[ \t]?(.*)$/i,L="Agent";function M(e){let t=[];for(let[,s]of e.replace(/\r\n?/g,`
|
|
2
2
|
`).matchAll(Q)){let r=L,n=null,i=null;for(let p of s.split(`
|
|
3
3
|
`)){let c=ee.exec(p);if(c){let a=c[1].toLowerCase(),l=c[2].trim();a==="agent"?(r=l||L,i=null):a==="thread"?(n={agent:r,thread:l,reply:"",addressed:"",signed:""},t.push(n),i=null):n&&(n[a]=l,i=a)}else n&&i&&i!=="signed"&&p.trim()?n[i]=`${n[i]}
|
|
4
|
-
${p.trim()}`:n&&i==="signed"&&(n.signed+=p.trim())}}return t.filter(s=>s.thread&&s.reply)}var O=(e,t)=>e.replace(/\s+/g," ").trim()===t.replace(/\s+/g," ").trim();function te(e){try{let t=e.replace(/-/g,"+").replace(/_/g,"/"),s=Uint8Array.from(atob(t+"=".repeat((4-t.length%4)%4)),r=>r.charCodeAt(0));return JSON.parse(new TextDecoder().decode(s))}catch{return null}}async function D(e,t){let s=new Set(t.threads.map(n=>n.id)),r=[];for(let n of e){if(!s.has(n.thread)){r.push({kind:"gone",entry:n});continue}if(!n.signed){r.push({kind:"unsigned",entry:n,why:"none"});continue}let i=te(n.signed),p=Array.isArray(i)?i:[],c=p.find(d=>d?.body?.kind==="reply"),a=p.find(d=>d?.body?.kind==="addressed"),l=c?.body.author??"";!!c&&p.length===(a?2:1)&&p.every(d=>d.body.doc===t.doc&&d.body.thread===n.thread&&d.body.author===l)&&O(c.body.text??"",n.reply)&&(a?O(a.body.text??"",n.addressed):!n.addressed)&&(await Promise.all(p.map(t.check))).every(Boolean)?t.listed.includes(l)?r.push({kind:"signed",entry:n,ops:p,author:l}):r.push({kind:"unsigned",entry:n,why:"unlisted"}):r.push({kind:"unsigned",entry:n,why:"changed"})}return r}var $=(e,t,s)=>`${e} ${e===1?t:s}`,C=e=>{let t=[...new Set(e)];return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t.at(-1)}`};function R(e){let t=e.filter(a=>a.kind==="signed"),s=e.filter(a=>a.kind==="unsigned"),r=e.filter(a=>a.kind==="gone"),n=t.length+s.length,i=[];t.length&&i.push(`${$(t.length,"reply","replies")} signed by ${C(t.map(a=>a.entry.agent))}, whom this page lists`);let p=(a,l)=>a==="none"?`${l?"is":"are"} not signed`:a==="unlisted"?`${l?"is":"are"} signed with a key this page doesn't list`:l?"was changed after it was signed":"were changed after they were signed";for(let a of["none","changed","unlisted"]){let l=s.filter(f=>f.why===a);if(!l.length)continue;let o=C(l.map(f=>f.entry.agent)),d=l.length===1;i.push(`${$(l.length,"reply","replies")} from ${o} ${p(a,d)}, so ${d?"it":"they"} will show as pasted by you`)}let c=[...t,...s].filter(a=>a.entry.addressed).length;return c&&i.push(`${c} of them ${c===1?"says":"say"} the comment is addressed`),r.length&&i.push(`${$(r.length,"reply is","replies are")} for a comment that's no longer here, so ${r.length===1?"it":"they"} will be left out`),{lines:i,adds:n}}function ne(e){if(!e)return{cli:"npx --yes pipeup@
|
|
4
|
+
${p.trim()}`:n&&i==="signed"&&(n.signed+=p.trim())}}return t.filter(s=>s.thread&&s.reply)}var O=(e,t)=>e.replace(/\s+/g," ").trim()===t.replace(/\s+/g," ").trim();function te(e){try{let t=e.replace(/-/g,"+").replace(/_/g,"/"),s=Uint8Array.from(atob(t+"=".repeat((4-t.length%4)%4)),r=>r.charCodeAt(0));return JSON.parse(new TextDecoder().decode(s))}catch{return null}}async function D(e,t){let s=new Set(t.threads.map(n=>n.id)),r=[];for(let n of e){if(!s.has(n.thread)){r.push({kind:"gone",entry:n});continue}if(!n.signed){r.push({kind:"unsigned",entry:n,why:"none"});continue}let i=te(n.signed),p=Array.isArray(i)?i:[],c=p.find(d=>d?.body?.kind==="reply"),a=p.find(d=>d?.body?.kind==="addressed"),l=c?.body.author??"";!!c&&p.length===(a?2:1)&&p.every(d=>d.body.doc===t.doc&&d.body.thread===n.thread&&d.body.author===l)&&O(c.body.text??"",n.reply)&&(a?O(a.body.text??"",n.addressed):!n.addressed)&&(await Promise.all(p.map(t.check))).every(Boolean)?t.listed.includes(l)?r.push({kind:"signed",entry:n,ops:p,author:l}):r.push({kind:"unsigned",entry:n,why:"unlisted"}):r.push({kind:"unsigned",entry:n,why:"changed"})}return r}var $=(e,t,s)=>`${e} ${e===1?t:s}`,C=e=>{let t=[...new Set(e)];return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t.at(-1)}`};function R(e){let t=e.filter(a=>a.kind==="signed"),s=e.filter(a=>a.kind==="unsigned"),r=e.filter(a=>a.kind==="gone"),n=t.length+s.length,i=[];t.length&&i.push(`${$(t.length,"reply","replies")} signed by ${C(t.map(a=>a.entry.agent))}, whom this page lists`);let p=(a,l)=>a==="none"?`${l?"is":"are"} not signed`:a==="unlisted"?`${l?"is":"are"} signed with a key this page doesn't list`:l?"was changed after it was signed":"were changed after they were signed";for(let a of["none","changed","unlisted"]){let l=s.filter(f=>f.why===a);if(!l.length)continue;let o=C(l.map(f=>f.entry.agent)),d=l.length===1;i.push(`${$(l.length,"reply","replies")} from ${o} ${p(a,d)}, so ${d?"it":"they"} will show as pasted by you`)}let c=[...t,...s].filter(a=>a.entry.addressed).length;return c&&i.push(`${c} of them ${c===1?"says":"say"} the comment is addressed`),r.length&&i.push(`${$(r.length,"reply is","replies are")} for a comment that's no longer here, so ${r.length===1?"it":"they"} will be left out`),{lines:i,adds:n}}function ne(e){if(!e)return{cli:"npx --yes pipeup@1",fallback:null};let s=`npx --yes pipeup@${e.split(".")[0]??"0"}`;return e.includes("-")?{cli:`npx --yes pipeup@${e}`,fallback:s}:{cli:s,fallback:null}}function re(e,t=""){if(t)return{page:t,served:!1};try{let s=new URL(e),r=decodeURIComponent(s.pathname);return r.endsWith("/")&&(r+="index.html"),s.protocol==="file:"?{page:/^\/[A-Za-z]:\//.test(r)?r.slice(1):r,served:!1}:{page:r,served:!0}}catch{return{page:"<the page's HTML file>",served:!1}}}var oe=e=>{try{let t=new URL(e);return t.protocol==="file:"?decodeURIComponent(t.pathname).replace(/^\/([A-Za-z]:\/)/,"$1"):t.href}catch{return e}},T=e=>e.replace(/\s+/g," ").trim();function _(e){let{cli:t,fallback:s}=ne(e.version),r=`https://pipeup-ai.github.io/pipeup/${e.version?.includes("-")?"next/":""}`,{page:n,served:i}=re(e.url,e.file),p=i?`<the HTML file your site serves at ${n}>`:n,c=`\`${t} reply --print --doc ${e.doc} --thread <thread id> "what you changed and where" --addressed "short note"\``;return[`Please act on my review comments on ${T(e.title)} (${T(e.url)}). The page uses Pipeup.`,"The comments were left in my browser. They are not in the page's file, so don't look for them there. Everything you need is below.","",`## ${e.open} open comment${e.open===1?"":"s"}${e.edition?` on the ${e.edition} edition`:""}`,"",e.comments.trim(),...e.resolved||e.earlier?["",`(${[e.resolved?`${e.resolved} resolved comment${e.resolved===1?"":"s"}`:"",e.earlier?`${e.earlier} open comment${e.earlier===1?"":"s"} on earlier editions`:""].filter(Boolean).join(" and ")} left out.)`]:[],"","## How to answer","","- For each thread, make the change I approved, or say why you didn't. Answer a question with an answer. Ask me before changing anything I haven't approved.","- Reply in one block I can paste back into the page with Paste my agent's replies, and tell me what you changed and where. Don't say the page was updated unless you updated it.","","```pipeup-replies","agent: <your name>","thread: <thread id>","reply: what you changed and where","addressed: short note, only if you made the change","```","",e.listed?`- This page lists an agent's key. If it's yours, sign the block so it shows as yours, not as pasted by me: ${c} prints each reply signed with the key you keep (in ~/.pipeup/agent.json). Without your key, send the same block unsigned.`:`- If you keep a Pipeup key between sessions, sign the block with ${c}, and ask me whether to list you on the page (\`${t} agent\` prints the line to add). If you can't keep a key, don't ask to be listed: the plain block works.`,...e.file?[`- You're on this computer, with a live link running: \`${t} comments ${e.file}\` reads the comments and \`${t} reply --page ${p} --thread <thread id> "\u2026" --addressed "\u2026"\` answers in the page by itself.`]:e.replies?[`- If you can write next to the page on this computer, \`${t} reply --page ${p} --thread <thread id> "\u2026" --addressed "\u2026"\` writes ${T(oe(e.replies))}, and your replies appear by themselves. Pass the HTML file that runs Pipeup, not a file it shows.`]:[],...(e.file||e.replies)&&!e.listed?[`- The page doesn't list you yet. Ask me first; after my yes, run \`${t} agent --name <your name> --page ${p} --yes\`.`]:[],...s?[`- If npm refuses ${t.split(" ").at(-1)}, use ${s.split(" ").at(-1)}: it answers these commands the same way.`]:[],"- Only mark a thread addressed. Never resolve, reopen, edit or delete: I close threads. Never answer as me, and keep your key out of the page and its folder.","",`Guide: ${r}skills/pipeup-apply/SKILL.md`].join(`
|
|
5
5
|
`)}var H=()=>["Please send your replies again in one block I can paste into the page, like this:","","```pipeup-replies","agent: <your name>","thread: <thread id>","reply: what you changed and where","addressed: short note, only if you made the change","```"].join(`
|
|
6
6
|
`);var se=/^[A-Za-z0-9_-]{43}$/,ie="pipeupReplies",ae=4e3,de=4e3,pe=/^AI assistant\s*·?\s*/;function k(e){let t=w("data-pipeup-agents",e)??"";return[...new Set(t.split(/[\s,]+/).filter(s=>se.test(s)))]}function E(e=location,t){let s=w("data-pipeup-replies",t);try{let r=e.href.split(/[?#]/)[0],n=new URL(s??(/\/$/.test(r)?`${r}index.replies.js`:r.replace(/\.[^./]*$/,"")+".replies.js"),e.href),i=n.protocol==="file:"?e.protocol==="file:":n.origin===e.origin;return i||console.warn("pipeup: the replies file must be on this site or this computer; ignoring it"),i?n.href:null}catch{return null}}function N(e){let t=k(),s=0,r="",n=null;async function i(){let d=globalThis[ie];if(!Array.isArray(d))return 0;let f=d.splice(0),h=[];for(let u of f){let y=u;if(!(y?.format!=="pipeup-replies"||y.doc!==e.document.id||!Array.isArray(y.ops)))for(let g of y.ops){let m=g?.body;m&&t.includes(m.author)&&(m.kind==="reply"||m.kind==="addressed"||m.kind==="react"||m.kind==="unreact")?(h.push(g),(m.name==="AI assistant"||m.name.startsWith("AI assistant "))&&(r=m.name.replace(pe,""))):s++}}return h.length?e.merge(h):0}function p(){let d=E();return d?(n?.remove(),new Promise((f,h)=>{let u=document.createElement("script");n=u,u.src=`${d}?${Date.now()}`;let y=m=>{window.clearTimeout(g),u.remove(),n===u&&(n=null),m?h(new Error(`pipeup: ${m}`)):f()},g=window.setTimeout(()=>y("the replies file didn't answer"),ae);u.addEventListener("load",()=>y()),u.addEventListener("error",()=>y("there is no replies file yet")),e.overlay().append(u)})):Promise.reject(new Error("pipeup: the replies file can't be read from here"))}async function c(){if(!t.length)return 0;let d=await i();return await p(),d+await i()}let a=!1,l=()=>{a||document.hidden||(a=!0,c().catch(()=>{}).finally(()=>a=!1))},o=0;return t.length?(l(),o=window.setInterval(l,de),document.addEventListener("visibilitychange",l)):i(),{enabled:t.length>0,ignored:()=>s,who:()=>r,check:c,tally:d=>{let f=d.filter(g=>!g.resolved),h=g=>g.root.replies.some(m=>t.includes(m.author)||m.name.startsWith("AI assistant \xB7 ")),u=new Set(d.map(g=>g.id));return{stray:new Set(e.document.ops().filter(g=>t.includes(g.body.author)&&!u.has(g.body.thread)).map(g=>g.body.thread)).size,open:f.length,answered:f.filter(h).length,addressed:f.filter(g=>g.addressed).length}},destroy:()=>{window.clearInterval(o),document.removeEventListener("visibilitychange",l),n?.remove()}}}var z=`.ag-t{margin:0 0 8px;font-size:15px;font-weight:600}
|
|
7
7
|
.ag-f{display:block;width:100%;height:96px;margin:4px 0 8px;padding:8px;border:1px solid var(--ln);border-radius:8px;background:var(--so);color:var(--k);font:12px/1.5 ui-monospace,monospace;resize:vertical}
|