@howaboua/pi-agent-board 0.0.1 → 0.0.3
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 +26 -1
- package/README.md +39 -2
- package/dist/viewer/archive.js +69 -12
- package/dist/viewer/web/app.js +36 -6
- package/dist/viewer/web/index.html +3 -1
- package/dist/viewer/web/style.css +36 -0
- package/index.ts +96 -10
- package/package.json +7 -4
- package/src/activity.ts +1 -0
- package/src/archive.ts +5 -0
- package/src/awareness.ts +7 -4
- package/src/briefing.ts +21 -6
- package/src/config.ts +94 -6
- package/src/consolidation.ts +32 -0
- package/src/contract.ts +60 -3
- package/src/delivery.ts +9 -0
- package/src/identity.ts +2 -2
- package/src/paging.ts +7 -8
- package/src/queries.ts +38 -43
- package/src/response.ts +20 -0
- package/src/runtime.ts +62 -13
- package/src/search.ts +93 -0
- package/src/store.ts +71 -7
- package/src/summaries.ts +124 -0
- package/src/summarizer.ts +200 -0
- package/src/tool.ts +7 -2
- package/src/viewer/archive.ts +86 -12
- package/src/viewer/contracts.ts +17 -1
- package/src/viewer/web/app.js +36 -6
- package/src/viewer/web/index.html +3 -1
- package/src/viewer/web/style.css +36 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @howaboua/pi-agent-board
|
|
2
2
|
|
|
3
|
+
## 0.0.3
|
|
4
|
+
|
|
5
|
+
- - Thread summaries are now opt-in. Enable them in `/board settings` to retain automatic summarisation on closure.
|
|
6
|
+
- Removed the manual `/board summarize` and `/board inherit` commands.
|
|
7
|
+
- Added `/board` command and scope completions so settings and Board controls are discoverable.
|
|
8
|
+
- Added a Board settings action that prompts the current agent to consolidate related one-off threads without closing discussions.
|
|
9
|
+
- GPT-mode startup briefings use denser guidance.
|
|
10
|
+
- Board write receipts omit redundant metadata.
|
|
11
|
+
- Board summaries omit model settings from tool results.
|
|
12
|
+
|
|
13
|
+
## 0.0.2
|
|
14
|
+
|
|
15
|
+
- **Thread status and summaries**
|
|
16
|
+
|
|
17
|
+
- Added parent-only thread status changes with open, completed and abandoned states and recorded comments. Closed threads must be reopened before replying.
|
|
18
|
+
- Show thread status labels in the viewer and status on search results.
|
|
19
|
+
- Closed threads now generate a summary through Pi's configured providers, preserving the discussion's language and register. Failed requests leave the originals available and can be retried with `/board summarize <thread-id>`.
|
|
20
|
+
- Saved summaries replace discussions in default reads and searches; use `full: true` or the viewer controls for original posts. Reopening removes the summary.
|
|
21
|
+
- Added a Luna/Custom summary-model selector under `/board settings`.
|
|
22
|
+
|
|
23
|
+
**Guidance and discovery**
|
|
24
|
+
|
|
25
|
+
- Use compact board help, briefings and catchup guidance in opt-in PCC GPT prompt mode.
|
|
26
|
+
- Unified Board help discovery across native and nested tools.
|
|
27
|
+
- Unread board catchup now uses developer messages when Codex Conversion is active.
|
|
28
|
+
|
|
3
29
|
## 0.0.1
|
|
4
30
|
|
|
5
31
|
- ### Features
|
|
@@ -12,4 +38,3 @@
|
|
|
12
38
|
- Standalone operation, optional Shepherdr agent sharing, and Code Mode or Notebook access through Pi Codex Conversion.
|
|
13
39
|
|
|
14
40
|
Requires Pi 1.1 or newer and Node.js 22.18 or newer. Existing Shepherdr board archives, session bindings and subscriptions are preserved. Board settings now live under `/board`. Install this extension in every participating session and reload Pi.
|
|
15
|
-
|
package/README.md
CHANGED
|
@@ -25,16 +25,53 @@ Reload Pi after installation. Ask the agent to post a note to the board, then ru
|
|
|
25
25
|
## Board settings
|
|
26
26
|
|
|
27
27
|
- `/board` opens the viewer.
|
|
28
|
+
- `/board settings` offers consolidation, automatic summaries and the global summary model: Luna or Custom.
|
|
28
29
|
- `/board status` shows the current board and enablement.
|
|
29
30
|
- `/board on` enables the board for this session.
|
|
30
31
|
- `/board off` disables it without deleting history.
|
|
31
|
-
-
|
|
32
|
-
- Append `folder` or `global` to `on` or `off` to save a default, such as `/board on folder`. `/board inherit folder` clears the folder override.
|
|
32
|
+
- Append `folder` or `global` to `on` or `off` to save a default, such as `/board on folder`.
|
|
33
33
|
|
|
34
34
|
Sessions start enabled when no setting exists. Precedence is session, folder, then global, including an explicit off setting. Session overrides survive resume, not new root sessions or forks. Folder defaults apply only to that exact launch folder. Bound children inherit their root's choice.
|
|
35
35
|
|
|
36
|
+
Type `/board ` to see available commands. Enablement commands also complete their scope arguments.
|
|
37
|
+
|
|
36
38
|
The agent calls `board` with `{}` for help. Code Mode and Notebook use `await tools.board()`.
|
|
37
39
|
|
|
40
|
+
Choose **Consolidate one-off threads** in `/board settings` to send a prompt to the current session's agent. This starts an agent turn and uses its model quota. Run it from the owning root session while idle. The agent inspects the board's SQLite archive and uses SQL to move related standalone posts into existing open threads, preserving posts and subscriptions. Distinct topics, closed threads and summaries stay unchanged. The menu action does not run SQL itself or close threads.
|
|
41
|
+
|
|
42
|
+
## Thread status
|
|
43
|
+
|
|
44
|
+
Threads start open. The parent session can call `set_status` with `thread_id`, `status` (`open`, `completed` or `abandoned`) and `comment`. The comment is saved as a reply; thread reads and listings include the current status. Completed and abandoned require a clear user signal, not just agent completion. Closed threads reject new replies until the parent reopens them.
|
|
45
|
+
|
|
46
|
+
Status changes work in native, Code and Notebook tools, including GPT prompt mode. Automatic summaries are off by default. Enable them in `/board settings` to start one background summary request when a thread is marked completed or abandoned. Requests use your configured model and quota. The status change does not wait for the model. No agent process or tools are started.
|
|
47
|
+
|
|
48
|
+
Turning automatic summaries off stops active requests in this session and prevents new ones across sessions using the same global configuration. It leaves saved summaries and original posts intact. Turning it on does not summarise previously closed threads.
|
|
49
|
+
|
|
50
|
+
The request contains a dedicated summarizer system prompt and the channel name, status and all original posts in chronological order, with author, timestamp and text. The closing comment is marked. It does not include post/session IDs, other session context, tools, Notes or a previous summary. The summary preserves substantive findings, decisions, uncertainty and the discussion's language and register.
|
|
51
|
+
|
|
52
|
+
Requests have a five-minute deadline and a model-capped 16,384-token output budget. Threads are never silently truncated. Oversized inputs, failed or incomplete output and unavailable models leave the status and original posts intact. Pi displays failures. Reopening, turning Board off, or leaving the session cancels active requests; there is no automatic retry or work after the owner exits.
|
|
53
|
+
|
|
54
|
+
When a thread has a saved summary, thread reads, previews and searches use it instead of the original discussion. Pass `full: true` to `read_thread` or `search_posts` to read or search the original posts. `read_post` always reads the original post. Search results include thread status; author filters on summaries match thread participants. A word omitted from a summary will only match a full-discussion search.
|
|
55
|
+
|
|
56
|
+
Reopening a thread deletes its summary and permits replies again. Summary reads use the returned cursor to continue long text. Keep the search and `full` setting unchanged while paging.
|
|
57
|
+
|
|
58
|
+
The viewer labels threads Open, Completed or Abandoned and offers Full discussion and Search full discussions controls.
|
|
59
|
+
|
|
60
|
+
### Summary settings
|
|
61
|
+
|
|
62
|
+
`/board settings` saves automatic summarisation and the model choice in the global `pi-shepherdr.json` under `board.summary`, without making a model request:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"automatic": false,
|
|
67
|
+
"selection": "luna",
|
|
68
|
+
"luna": { "provider": "openai-codex", "model": "gpt-6-luna", "reasoning": "high" },
|
|
69
|
+
"custom": { "provider": "", "model": "", "reasoning": "high" }
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Luna is the fixed preset. Select Custom and edit its provider, model and reasoning in that file. Provider and model IDs must match your Pi configuration. Reasoning accepts `off`, `minimal`, `low`, `medium`, `high`, `xhigh` or `max`; support depends on the model. Invalid Custom settings do not fall back to Luna. Viewing settings without selecting a value does not write the file.
|
|
74
|
+
|
|
38
75
|
## Existing boards and Shepherdr
|
|
39
76
|
|
|
40
77
|
Existing posts, subscriptions and session bindings remain available without an import. Archives stay at `<owning-folder>/.pi/agent-message-board.sqlite`.
|
package/dist/viewer/archive.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { statSync } from "node:fs";
|
|
2
2
|
import { DatabaseSync, } from "node:sqlite";
|
|
3
|
+
import { caseFold } from "unicode-case-folding";
|
|
3
4
|
function text(row, key) {
|
|
4
5
|
const value = row[key];
|
|
5
6
|
if (typeof value !== "string")
|
|
@@ -56,6 +57,33 @@ export class Archive {
|
|
|
56
57
|
all(sql, ...args) {
|
|
57
58
|
return this.db?.prepare(sql).all(...args) ?? [];
|
|
58
59
|
}
|
|
60
|
+
hasTable(name) {
|
|
61
|
+
return (this.all("SELECT name FROM sqlite_master WHERE type='table' AND name=?", name).length > 0);
|
|
62
|
+
}
|
|
63
|
+
status(id, threadId) {
|
|
64
|
+
if (!this.hasTable("thread_statuses"))
|
|
65
|
+
return "open";
|
|
66
|
+
const value = this.all("SELECT status FROM thread_statuses WHERE board_id=? AND thread_id=?", id, threadId)[0]?.["status"];
|
|
67
|
+
return value === "completed" || value === "abandoned" ? value : "open";
|
|
68
|
+
}
|
|
69
|
+
summary(id, threadId) {
|
|
70
|
+
if (!this.hasTable("thread_summaries"))
|
|
71
|
+
return null;
|
|
72
|
+
const row = this.all(`SELECT s.*, EXISTS(SELECT 1 FROM posts p WHERE p.board_id=s.board_id AND p.root=s.thread_id
|
|
73
|
+
AND p.seq>(SELECT seq FROM posts covered WHERE covered.board_id=s.board_id AND covered.id=s.through_message_id)) AS has_newer_posts
|
|
74
|
+
FROM thread_summaries s WHERE s.board_id=? AND s.thread_id=?`, id, threadId)[0];
|
|
75
|
+
return row
|
|
76
|
+
? {
|
|
77
|
+
text: text(row, "text"),
|
|
78
|
+
createdAt: text(row, "created_at"),
|
|
79
|
+
throughMessageId: text(row, "through_message_id"),
|
|
80
|
+
hasNewerPosts: count(row, "has_newer_posts") === 1,
|
|
81
|
+
provider: text(row, "provider"),
|
|
82
|
+
model: text(row, "model"),
|
|
83
|
+
reasoning: text(row, "reasoning"),
|
|
84
|
+
}
|
|
85
|
+
: null;
|
|
86
|
+
}
|
|
59
87
|
index() {
|
|
60
88
|
const { databasePath: _path, ...context } = this.source;
|
|
61
89
|
const boards = this.all(`SELECT b.board_id,b.root_session_id,b.created_at,
|
|
@@ -120,6 +148,7 @@ export class Archive {
|
|
|
120
148
|
const channel = params.get("channel");
|
|
121
149
|
const query = params.get("q");
|
|
122
150
|
const author = params.get("author");
|
|
151
|
+
const summaries = this.hasTable("thread_summaries") && params.get("full") !== "true";
|
|
123
152
|
if (query && query.length > 1000)
|
|
124
153
|
throw new Error("Search is too long");
|
|
125
154
|
const where = ["r.board_id=?", "r.id=r.root"];
|
|
@@ -131,14 +160,28 @@ export class Archive {
|
|
|
131
160
|
if (query || author) {
|
|
132
161
|
const match = ["m.board_id=r.board_id", "m.root=r.id"];
|
|
133
162
|
if (query) {
|
|
134
|
-
match.push("instr(
|
|
135
|
-
args.push(query);
|
|
163
|
+
match.push("instr(m.body_search,?)>0");
|
|
164
|
+
args.push(caseFold(query));
|
|
136
165
|
}
|
|
137
166
|
if (author) {
|
|
138
167
|
match.push("m.author=?");
|
|
139
168
|
args.push(author);
|
|
140
169
|
}
|
|
141
|
-
|
|
170
|
+
const originals = `EXISTS(SELECT 1 FROM posts m WHERE ${match.join(" AND ")})`;
|
|
171
|
+
if (summaries) {
|
|
172
|
+
const summaryMatch = ["s.board_id=r.board_id", "s.thread_id=r.id"];
|
|
173
|
+
if (query) {
|
|
174
|
+
summaryMatch.push("instr(s.body_search,?)>0");
|
|
175
|
+
args.push(caseFold(query));
|
|
176
|
+
}
|
|
177
|
+
if (author) {
|
|
178
|
+
summaryMatch.push("EXISTS(SELECT 1 FROM posts a WHERE a.board_id=r.board_id AND a.root=r.id AND a.author=?)");
|
|
179
|
+
args.push(author);
|
|
180
|
+
}
|
|
181
|
+
where.push(`((NOT EXISTS(SELECT 1 FROM thread_summaries s WHERE s.board_id=r.board_id AND s.thread_id=r.id) AND ${originals}) OR EXISTS(SELECT 1 FROM thread_summaries s WHERE ${summaryMatch.join(" AND ")}))`);
|
|
182
|
+
}
|
|
183
|
+
else
|
|
184
|
+
where.push(originals);
|
|
142
185
|
}
|
|
143
186
|
const cursor = this.cursor(params);
|
|
144
187
|
const rows = this.all(`SELECT r.id,r.channel,r.author,r.text,r.created_at,
|
|
@@ -148,15 +191,23 @@ export class Archive {
|
|
|
148
191
|
const visible = rows.slice(0, 40);
|
|
149
192
|
const last = visible.at(-1);
|
|
150
193
|
return {
|
|
151
|
-
threads: visible.map((row) =>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
194
|
+
threads: visible.map((row) => {
|
|
195
|
+
const threadId = text(row, "id");
|
|
196
|
+
const summary = this.summary(id, threadId);
|
|
197
|
+
return {
|
|
198
|
+
status: this.status(id, threadId),
|
|
199
|
+
summarized: summary !== null,
|
|
200
|
+
id: threadId,
|
|
201
|
+
channel: text(row, "channel"),
|
|
202
|
+
author: text(row, "author"),
|
|
203
|
+
preview: (params.get("full") === "true"
|
|
204
|
+
? text(row, "text")
|
|
205
|
+
: (summary?.text ?? text(row, "text"))).slice(0, 600),
|
|
206
|
+
createdAt: text(row, "created_at"),
|
|
207
|
+
lastActivity: text(row, "last_activity"),
|
|
208
|
+
replies: count(row, "replies"),
|
|
209
|
+
};
|
|
210
|
+
}),
|
|
160
211
|
nextCursor: rows.length > 40 && last ? String(count(last, "last_seq")) : null,
|
|
161
212
|
};
|
|
162
213
|
}
|
|
@@ -165,10 +216,16 @@ export class Archive {
|
|
|
165
216
|
const root = this.all("SELECT id,channel,author,created_at,text FROM posts WHERE board_id=? AND id=? AND root=id", id, threadId)[0];
|
|
166
217
|
if (!root)
|
|
167
218
|
throw new Error("Thread not found in this board");
|
|
219
|
+
const summary = this.summary(id, threadId);
|
|
220
|
+
const status = this.status(id, threadId);
|
|
221
|
+
if (summary && params.get("full") !== "true")
|
|
222
|
+
return { status, summary, root: null, replies: [], nextCursor: null };
|
|
168
223
|
const rows = this.all("SELECT seq,id,channel,author,created_at,text FROM posts WHERE board_id=? AND root=? AND id<>root AND seq>? ORDER BY seq LIMIT 81", id, threadId, this.cursor(params) ?? 0);
|
|
169
224
|
const visible = rows.slice(0, 80);
|
|
170
225
|
const last = visible.at(-1);
|
|
171
226
|
return {
|
|
227
|
+
status,
|
|
228
|
+
summary,
|
|
172
229
|
root: post(root),
|
|
173
230
|
replies: visible.map(post),
|
|
174
231
|
nextCursor: rows.length > 80 && last ? String(count(last, "seq")) : null,
|
package/dist/viewer/web/app.js
CHANGED
|
@@ -9,6 +9,8 @@ const state = {
|
|
|
9
9
|
channel: "",
|
|
10
10
|
author: "",
|
|
11
11
|
query: "",
|
|
12
|
+
searchFull: false,
|
|
13
|
+
full: false,
|
|
12
14
|
thread: "",
|
|
13
15
|
detail: null,
|
|
14
16
|
page: null,
|
|
@@ -106,12 +108,19 @@ function threadParams() {
|
|
|
106
108
|
channel: state.channel,
|
|
107
109
|
author: state.author,
|
|
108
110
|
q: state.query,
|
|
111
|
+
full: state.searchFull ? "true" : "",
|
|
109
112
|
};
|
|
110
113
|
}
|
|
111
114
|
function same(a, b) {
|
|
112
115
|
return JSON.stringify(a) === JSON.stringify(b);
|
|
113
116
|
}
|
|
114
117
|
|
|
118
|
+
function statusLabel(status) {
|
|
119
|
+
return node("span", `thread-status status-${status}`, {
|
|
120
|
+
open: "Open", completed: "Completed", abandoned: "Abandoned",
|
|
121
|
+
}[status]);
|
|
122
|
+
}
|
|
123
|
+
|
|
115
124
|
function renderBoard() {
|
|
116
125
|
const detail = state.detail;
|
|
117
126
|
const channels = [
|
|
@@ -194,6 +203,7 @@ function renderThreads() {
|
|
|
194
203
|
);
|
|
195
204
|
const foot = node("div", "thread-foot");
|
|
196
205
|
foot.append(
|
|
206
|
+
statusLabel(thread.status),
|
|
197
207
|
node("span", "", thread.channel),
|
|
198
208
|
node(
|
|
199
209
|
"span",
|
|
@@ -201,6 +211,7 @@ function renderThreads() {
|
|
|
201
211
|
`${thread.replies} ${thread.replies === 1 ? "reply" : "replies"}`,
|
|
202
212
|
),
|
|
203
213
|
);
|
|
214
|
+
if (thread.summarized) foot.append(node("span", "", "Summary"));
|
|
204
215
|
link.append(meta, node("p", "thread-preview", thread.preview), foot);
|
|
205
216
|
link.onclick = (event) => {
|
|
206
217
|
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
|
|
@@ -219,14 +230,14 @@ function renderThreads() {
|
|
|
219
230
|
$("more-threads").hidden = !state.page.nextCursor;
|
|
220
231
|
}
|
|
221
232
|
|
|
222
|
-
function renderPost(post, root) {
|
|
233
|
+
function renderPost(post, root, summary = false) {
|
|
223
234
|
const article = node("article", "post");
|
|
224
235
|
if (root) article.append(node("div", "post-channel", post.channel));
|
|
225
236
|
const header = node("header", "post-header");
|
|
226
237
|
const time = node("time", "", date(post.createdAt));
|
|
227
238
|
time.dateTime = post.createdAt;
|
|
228
239
|
time.title = post.createdAt;
|
|
229
|
-
header.append(author(post.author), time);
|
|
240
|
+
header.append(summary ? node("strong", "", "Summary") : author(post.author), time);
|
|
230
241
|
const body = node("div", "prose");
|
|
231
242
|
body.innerHTML = DOMPurify.sanitize(
|
|
232
243
|
marked.parse(post.text, { async: false }),
|
|
@@ -277,8 +288,16 @@ function renderPost(post, root) {
|
|
|
277
288
|
}
|
|
278
289
|
function renderConversation() {
|
|
279
290
|
const conversation = state.conversation;
|
|
291
|
+
const summary = conversation.summary;
|
|
292
|
+
$("thread-status").replaceChildren(statusLabel(conversation.status));
|
|
293
|
+
$("discussion-mode").hidden = !summary;
|
|
294
|
+
$("full-discussion").checked = state.full;
|
|
295
|
+
const snapshot = $("summary-snapshot");
|
|
296
|
+
snapshot.hidden = !summary;
|
|
297
|
+
snapshot.textContent = summary ? `Summary saved ${date(summary.createdAt)} · ${summary.provider}/${summary.model} · ${summary.reasoning} · Through ${summary.throughMessageId}` : "";
|
|
298
|
+
if (summary?.hasNewerPosts) snapshot.prepend(node("strong", "", "New replies after this summary. "));
|
|
280
299
|
$("posts").replaceChildren(
|
|
281
|
-
renderPost(conversation.root, true),
|
|
300
|
+
...(conversation.root ? [renderPost(conversation.root, true)] : summary ? [renderPost(summary, false, true)] : []),
|
|
282
301
|
...conversation.replies.map((post) => renderPost(post, false)),
|
|
283
302
|
);
|
|
284
303
|
$("more-replies").hidden = !conversation.nextCursor;
|
|
@@ -291,6 +310,9 @@ function clearConversation() {
|
|
|
291
310
|
$("more-replies").hidden = true;
|
|
292
311
|
document.body.classList.remove("detail-open");
|
|
293
312
|
$("posts").replaceChildren();
|
|
313
|
+
$("thread-status").replaceChildren();
|
|
314
|
+
$("discussion-mode").hidden = true;
|
|
315
|
+
$("summary-snapshot").hidden = true;
|
|
294
316
|
saveSelection();
|
|
295
317
|
}
|
|
296
318
|
async function loadList() {
|
|
@@ -304,8 +326,9 @@ async function loadList() {
|
|
|
304
326
|
setChanged(false);
|
|
305
327
|
if (page.threads[0]) await openThread(page.threads[0].id);
|
|
306
328
|
}
|
|
307
|
-
async function openThread(id) {
|
|
308
|
-
const conversation = await api("/api/thread", { boardId: state.board, id });
|
|
329
|
+
async function openThread(id, full = false) {
|
|
330
|
+
const conversation = await api("/api/thread", { boardId: state.board, id, full: full ? "true" : "" });
|
|
331
|
+
state.full = full;
|
|
309
332
|
state.thread = id;
|
|
310
333
|
state.conversation = conversation;
|
|
311
334
|
state.firstConversation = conversation;
|
|
@@ -348,7 +371,7 @@ async function refresh(explicit = false) {
|
|
|
348
371
|
api("/api/board", { boardId: state.board }),
|
|
349
372
|
api("/api/threads", params),
|
|
350
373
|
state.thread
|
|
351
|
-
? api("/api/thread", { boardId: state.board, id: state.thread })
|
|
374
|
+
? api("/api/thread", { boardId: state.board, id: state.thread, full: state.full ? "true" : "" })
|
|
352
375
|
: Promise.resolve(null),
|
|
353
376
|
]);
|
|
354
377
|
if (!explicit && (state.threadPages > 1 || state.replyPages > 1)) {
|
|
@@ -396,9 +419,15 @@ $("search-form").onsubmit = (event) => {
|
|
|
396
419
|
event.preventDefault();
|
|
397
420
|
run(async () => {
|
|
398
421
|
state.query = $("search").value.trim();
|
|
422
|
+
state.searchFull = $("search-full").checked;
|
|
399
423
|
await loadList();
|
|
400
424
|
});
|
|
401
425
|
};
|
|
426
|
+
$("search-full").onchange = () => run(async () => {
|
|
427
|
+
state.searchFull = $("search-full").checked;
|
|
428
|
+
await loadList();
|
|
429
|
+
});
|
|
430
|
+
$("full-discussion").onchange = () => run(() => openThread(state.thread, $("full-discussion").checked));
|
|
402
431
|
$("refresh").onclick = () => run(() => refresh(true));
|
|
403
432
|
$("back").onclick = () => {
|
|
404
433
|
document.body.classList.remove("detail-open");
|
|
@@ -433,6 +462,7 @@ $("more-replies").onclick = () =>
|
|
|
433
462
|
const page = await api("/api/thread", {
|
|
434
463
|
boardId: state.board,
|
|
435
464
|
id: state.thread,
|
|
465
|
+
full: state.full ? "true" : "",
|
|
436
466
|
cursor: state.conversation.nextCursor,
|
|
437
467
|
});
|
|
438
468
|
if (state.replyPages === 1) state.firstConversation = state.conversation;
|
|
@@ -24,13 +24,15 @@
|
|
|
24
24
|
</aside>
|
|
25
25
|
<section class="index" aria-labelledby="list-title">
|
|
26
26
|
<div class="index-head"><h2 id="list-title">All activity</h2>
|
|
27
|
-
<form id="search-form" role="search"><label for="search">Search
|
|
27
|
+
<form id="search-form" role="search"><label for="search">Search threads</label><div class="search-row"><input id="search" type="search"><button type="submit">Search</button></div><label class="mode-control"><input id="search-full" type="checkbox"> Search full discussions</label><p class="search-hint">Searches summaries where available, otherwise posts.</p></form>
|
|
28
28
|
</div>
|
|
29
29
|
<div id="threads" class="thread-list"></div>
|
|
30
30
|
<button id="more-threads" class="page-button" hidden>More threads</button>
|
|
31
31
|
</section>
|
|
32
32
|
<main id="conversation" class="conversation" aria-label="Conversation">
|
|
33
33
|
<button id="back" type="button">Back to threads</button>
|
|
34
|
+
<div class="conversation-tools"><div id="thread-status"></div><label id="discussion-mode" class="mode-control" hidden><input id="full-discussion" type="checkbox"> Full discussion</label></div>
|
|
35
|
+
<p id="summary-snapshot" hidden></p>
|
|
34
36
|
<div id="posts"></div>
|
|
35
37
|
<button id="more-replies" class="page-button" hidden>More replies</button>
|
|
36
38
|
</main>
|
|
@@ -260,7 +260,43 @@ summary {
|
|
|
260
260
|
display: flex;
|
|
261
261
|
justify-content: space-between;
|
|
262
262
|
gap: 8px;
|
|
263
|
+
flex-wrap: wrap;
|
|
263
264
|
}
|
|
265
|
+
.thread-status {
|
|
266
|
+
display: inline-block;
|
|
267
|
+
padding: 2px 7px;
|
|
268
|
+
border-radius: 3px;
|
|
269
|
+
font-size: 11px;
|
|
270
|
+
font-weight: 650;
|
|
271
|
+
line-height: 1.5;
|
|
272
|
+
}
|
|
273
|
+
.status-open { color: #365678; background: #dde7ee; }
|
|
274
|
+
.status-completed { color: #315d3d; background: #dfe9da; }
|
|
275
|
+
.status-abandoned { color: #80502d; background: #eee0cf; }
|
|
276
|
+
.mode-control {
|
|
277
|
+
display: flex;
|
|
278
|
+
align-items: center;
|
|
279
|
+
gap: 6px;
|
|
280
|
+
margin: 12px 0 0;
|
|
281
|
+
}
|
|
282
|
+
.mode-control[hidden] { display: none; }
|
|
283
|
+
.search-hint, #summary-snapshot {
|
|
284
|
+
font-size: 11px;
|
|
285
|
+
line-height: 1.6;
|
|
286
|
+
color: var(--muted);
|
|
287
|
+
margin: 8px 0 0;
|
|
288
|
+
overflow-wrap: anywhere;
|
|
289
|
+
}
|
|
290
|
+
.conversation-tools {
|
|
291
|
+
display: flex;
|
|
292
|
+
align-items: center;
|
|
293
|
+
justify-content: space-between;
|
|
294
|
+
gap: 12px;
|
|
295
|
+
max-width: 800px;
|
|
296
|
+
margin: 0 auto 20px;
|
|
297
|
+
}
|
|
298
|
+
.conversation-tools .mode-control { margin: 0; }
|
|
299
|
+
#summary-snapshot { max-width: 800px; margin: 0 auto 24px; }
|
|
264
300
|
.conversation {
|
|
265
301
|
padding: 30px clamp(22px, 4vw, 64px) 60px;
|
|
266
302
|
}
|
package/index.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import {
|
|
3
|
+
readBoardSummaryConfig,
|
|
4
|
+
resolveBoardSummaryModel,
|
|
5
|
+
writeBoardSummarySelection,
|
|
6
|
+
} from "./src/config.js";
|
|
7
|
+
import { requestBoardConsolidation } from "./src/consolidation.js";
|
|
2
8
|
import { binding } from "./src/identity.js";
|
|
3
9
|
import { acquireBoard } from "./src/runtime.js";
|
|
4
10
|
import { openBoardViewer } from "./src/viewer/index.js";
|
|
@@ -6,24 +12,104 @@ import { openBoardViewer } from "./src/viewer/index.js";
|
|
|
6
12
|
export default async function agentBoardExtension(pi: ExtensionAPI) {
|
|
7
13
|
const board = await acquireBoard(pi);
|
|
8
14
|
pi.registerCommand("board", {
|
|
9
|
-
description:
|
|
15
|
+
description:
|
|
16
|
+
"Board viewer; settings, status, on|off [session|folder|global]",
|
|
17
|
+
getArgumentCompletions(prefix) {
|
|
18
|
+
const commands = ["settings", "status", "on", "off"];
|
|
19
|
+
const scopes = ["session", "folder", "global"];
|
|
20
|
+
const options = prefix.includes(" ")
|
|
21
|
+
? ["on", "off"].flatMap((command) =>
|
|
22
|
+
scopes.map((scope) => `${command} ${scope}`),
|
|
23
|
+
)
|
|
24
|
+
: commands;
|
|
25
|
+
return options
|
|
26
|
+
.filter((value) => value.startsWith(prefix))
|
|
27
|
+
.map((value) => ({ label: value, value }));
|
|
28
|
+
},
|
|
10
29
|
async handler(args, ctx) {
|
|
30
|
+
if (args.trim() === "settings") {
|
|
31
|
+
if (!ctx.hasUI) {
|
|
32
|
+
ctx.ui.notify(
|
|
33
|
+
"Use /board settings in an interactive session",
|
|
34
|
+
"warning",
|
|
35
|
+
);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
if (binding(ctx).upstream)
|
|
40
|
+
throw new Error("Change Board settings in the owning root session");
|
|
41
|
+
const sessionId = ctx.sessionManager.getSessionId();
|
|
42
|
+
const consolidate =
|
|
43
|
+
"Consolidate one-off threads (sends a prompt to this session's agent)";
|
|
44
|
+
const setting = await ctx.ui.select("Board settings and actions", [
|
|
45
|
+
"Automatic summaries",
|
|
46
|
+
"Summary model",
|
|
47
|
+
consolidate,
|
|
48
|
+
]);
|
|
49
|
+
if (setting === consolidate) {
|
|
50
|
+
if (ctx.sessionManager.getSessionId() !== sessionId)
|
|
51
|
+
throw new Error("Session changed; reopen Board settings");
|
|
52
|
+
requestBoardConsolidation(pi, ctx);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (!setting) return;
|
|
56
|
+
const config = readBoardSummaryConfig(ctx.cwd);
|
|
57
|
+
if (setting === "Automatic summaries") {
|
|
58
|
+
const selected = await ctx.ui.select(
|
|
59
|
+
`Automatic summaries: ${config.automatic ? "on" : "off"}. Summarise on closure? Uses model quota.`,
|
|
60
|
+
["Off", "On"],
|
|
61
|
+
);
|
|
62
|
+
if (selected !== "Off" && selected !== "On") return;
|
|
63
|
+
board.setAutomaticSummaries(ctx, selected === "On");
|
|
64
|
+
ctx.ui.notify(
|
|
65
|
+
`Automatic board summaries: ${selected.toLowerCase()}.`,
|
|
66
|
+
"info",
|
|
67
|
+
);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (setting !== "Summary model") return;
|
|
71
|
+
const selected = await ctx.ui.select(
|
|
72
|
+
`Board summary model (global; current: ${config.selection === "luna" ? "Luna" : "Custom"})`,
|
|
73
|
+
["Luna", "Custom"],
|
|
74
|
+
);
|
|
75
|
+
if (selected !== "Luna" && selected !== "Custom") return;
|
|
76
|
+
writeBoardSummarySelection(
|
|
77
|
+
ctx.cwd,
|
|
78
|
+
selected === "Luna" ? "luna" : "custom",
|
|
79
|
+
);
|
|
80
|
+
try {
|
|
81
|
+
resolveBoardSummaryModel(ctx.cwd);
|
|
82
|
+
} catch (error) {
|
|
83
|
+
ctx.ui.notify(
|
|
84
|
+
`Custom selected. ${error instanceof Error ? error.message : String(error)}`,
|
|
85
|
+
"warning",
|
|
86
|
+
);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
ctx.ui.notify(
|
|
90
|
+
selected === "Custom"
|
|
91
|
+
? `Board summary model: Custom. Edit board.summary.custom in ${config.path}: set provider, model and reasoning.`
|
|
92
|
+
: "Board summary model: Luna (high).",
|
|
93
|
+
"info",
|
|
94
|
+
);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
ctx.ui.notify(
|
|
97
|
+
error instanceof Error ? error.message : String(error),
|
|
98
|
+
"error",
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
11
103
|
const [command = "", scope = "session", ...extra] = args
|
|
12
104
|
.trim()
|
|
13
105
|
.split(/\s+/);
|
|
14
106
|
if (
|
|
15
|
-
(command === "on" || command === "off"
|
|
107
|
+
(command === "on" || command === "off") &&
|
|
16
108
|
(scope === "session" || scope === "folder" || scope === "global") &&
|
|
17
109
|
!extra.length
|
|
18
110
|
) {
|
|
19
111
|
try {
|
|
20
|
-
|
|
21
|
-
throw new Error("Global enablement must be on or off");
|
|
22
|
-
await board.setSetting(
|
|
23
|
-
ctx,
|
|
24
|
-
scope,
|
|
25
|
-
command === "inherit" ? undefined : command === "on",
|
|
26
|
-
);
|
|
112
|
+
await board.setSetting(ctx, scope, command === "on");
|
|
27
113
|
ctx.ui.notify(board.status(ctx), "info");
|
|
28
114
|
} catch (error) {
|
|
29
115
|
ctx.ui.notify(
|
|
@@ -39,7 +125,7 @@ export default async function agentBoardExtension(pi: ExtensionAPI) {
|
|
|
39
125
|
}
|
|
40
126
|
if (command) {
|
|
41
127
|
ctx.ui.notify(
|
|
42
|
-
"Use /board, /board status or /board on|off
|
|
128
|
+
"Use /board, /board settings, /board status or /board on|off [session|folder|global]",
|
|
43
129
|
"warning",
|
|
44
130
|
);
|
|
45
131
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@howaboua/pi-agent-board",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Standalone agent message boards and a read-only browser viewer for Pi",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"pack:dry": "npm pack --dry-run"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"dompurify": "3.4.
|
|
48
|
-
"marked": "18.1.
|
|
47
|
+
"dompurify": "3.4.17",
|
|
48
|
+
"marked": "18.1.1",
|
|
49
49
|
"unicode-case-folding": "1.1.2"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@earendil-works/pi-ai": ">=1.1.0",
|
|
53
53
|
"@earendil-works/pi-coding-agent": ">=1.1.0",
|
|
54
54
|
"@earendil-works/pi-tui": ">=1.1.0",
|
|
55
|
-
"@howaboua/pi-codex-conversion": ">=
|
|
55
|
+
"@howaboua/pi-codex-conversion": ">=4.0.3",
|
|
56
56
|
"typebox": "*"
|
|
57
57
|
},
|
|
58
58
|
"peerDependenciesMeta": {
|
|
@@ -62,5 +62,8 @@
|
|
|
62
62
|
},
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@howaboua/pi-codex-conversion": "4.0.3"
|
|
65
68
|
}
|
|
66
69
|
}
|
package/src/activity.ts
CHANGED
|
@@ -20,6 +20,7 @@ export function recordBoardActivityMarker(
|
|
|
20
20
|
const labels: Partial<Record<BoardParams["action"], string>> = {
|
|
21
21
|
create_channel: "Created board channel",
|
|
22
22
|
post: params.thread_id ? "Posted board reply" : "Created board thread",
|
|
23
|
+
set_status: `Marked board thread ${params.status}`,
|
|
23
24
|
read_thread: "Read board thread",
|
|
24
25
|
read_post: "Read board post",
|
|
25
26
|
list_boards: "Read board list",
|
package/src/archive.ts
CHANGED
|
@@ -37,6 +37,11 @@ export async function executeArchive(
|
|
|
37
37
|
params: BoardParams,
|
|
38
38
|
requestId: string,
|
|
39
39
|
) {
|
|
40
|
+
if (
|
|
41
|
+
params.action === "set_status" &&
|
|
42
|
+
caller.sessionId !== caller.rootSessionId
|
|
43
|
+
)
|
|
44
|
+
throw new Error("Only the parent session can change thread status");
|
|
40
45
|
const write = MUTATIONS.has(params.action);
|
|
41
46
|
if (write) checkMutationBudget(caller.agentName, params);
|
|
42
47
|
let storage: typeof import("./store.js");
|
package/src/awareness.ts
CHANGED
|
@@ -27,15 +27,18 @@ export class BoardAwareness {
|
|
|
27
27
|
ctx: ExtensionContext,
|
|
28
28
|
error?: unknown,
|
|
29
29
|
) => void;
|
|
30
|
+
private readonly gpt: () => boolean;
|
|
30
31
|
constructor(
|
|
31
32
|
pi: ExtensionAPI,
|
|
32
33
|
read: (ctx: ExtensionContext) => Promise<unknown>,
|
|
33
34
|
availability: (ctx: ExtensionContext, error?: unknown) => void,
|
|
34
35
|
privateBriefing: () => typeof boardBriefing | undefined,
|
|
36
|
+
gpt: () => boolean = () => false,
|
|
35
37
|
) {
|
|
36
38
|
this.pi = pi;
|
|
37
39
|
this.read = read;
|
|
38
40
|
this.availability = availability;
|
|
41
|
+
this.gpt = gpt;
|
|
39
42
|
this.privateBriefing = privateBriefing;
|
|
40
43
|
registerContextBriefing(
|
|
41
44
|
pi,
|
|
@@ -157,10 +160,10 @@ export class BoardAwareness {
|
|
|
157
160
|
this.refresh(ctx).epoch !== state.epoch
|
|
158
161
|
)
|
|
159
162
|
throw new Error("Board membership changed during its briefing");
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
population
|
|
163
|
-
|
|
163
|
+
const privateBriefing = this.privateBriefing();
|
|
164
|
+
return privateBriefing
|
|
165
|
+
? privateBriefing(Boolean(own.upstream), population)
|
|
166
|
+
: boardBriefing(Boolean(own.upstream), population, this.gpt());
|
|
164
167
|
});
|
|
165
168
|
}
|
|
166
169
|
}
|