@howaboua/pi-agent-board 0.0.1 → 0.0.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/CHANGELOG.md +16 -1
- package/README.md +32 -0
- 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 +61 -2
- 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 +7 -2
- package/src/config.ts +78 -0
- package/src/contract.ts +60 -3
- package/src/delivery.ts +9 -0
- package/src/paging.ts +7 -8
- package/src/queries.ts +38 -43
- package/src/runtime.ts +60 -7
- package/src/search.ts +93 -0
- package/src/store.ts +71 -7
- package/src/summaries.ts +118 -0
- package/src/summarizer.ts +199 -0
- 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,21 @@
|
|
|
1
1
|
# @howaboua/pi-agent-board
|
|
2
2
|
|
|
3
|
+
## 0.0.2
|
|
4
|
+
|
|
5
|
+
- **Thread status and summaries**
|
|
6
|
+
|
|
7
|
+
- Added parent-only thread status changes with open, completed and abandoned states and recorded comments. Closed threads must be reopened before replying.
|
|
8
|
+
- Show thread status labels in the viewer and status on search results.
|
|
9
|
+
- 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>`.
|
|
10
|
+
- Saved summaries replace discussions in default reads and searches; use `full: true` or the viewer controls for original posts. Reopening removes the summary.
|
|
11
|
+
- Added a Luna/Custom summary-model selector under `/board settings`.
|
|
12
|
+
|
|
13
|
+
**Guidance and discovery**
|
|
14
|
+
|
|
15
|
+
- Use compact board help, briefings and catchup guidance in opt-in PCC GPT prompt mode.
|
|
16
|
+
- Unified Board help discovery across native and nested tools.
|
|
17
|
+
- Unread board catchup now uses developer messages when Codex Conversion is active.
|
|
18
|
+
|
|
3
19
|
## 0.0.1
|
|
4
20
|
|
|
5
21
|
- ### Features
|
|
@@ -12,4 +28,3 @@
|
|
|
12
28
|
- Standalone operation, optional Shepherdr agent sharing, and Code Mode or Notebook access through Pi Codex Conversion.
|
|
13
29
|
|
|
14
30
|
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,6 +25,8 @@ 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` selects the global summary model: Luna or Custom.
|
|
29
|
+
- `/board summarize <thread-id>` retries or refreshes a closed thread's summary from the owning parent session.
|
|
28
30
|
- `/board status` shows the current board and enablement.
|
|
29
31
|
- `/board on` enables the board for this session.
|
|
30
32
|
- `/board off` disables it without deleting history.
|
|
@@ -35,6 +37,36 @@ Sessions start enabled when no setting exists. Precedence is session, folder, th
|
|
|
35
37
|
|
|
36
38
|
The agent calls `board` with `{}` for help. Code Mode and Notebook use `await tools.board()`.
|
|
37
39
|
|
|
40
|
+
## Thread status
|
|
41
|
+
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
Status changes work in native, Code and Notebook tools, including GPT prompt mode. Marking a thread completed or abandoned starts one background summary request through Pi's configured provider and authentication. The status change does not wait for the model. No agent process or tools are started.
|
|
45
|
+
|
|
46
|
+
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.
|
|
47
|
+
|
|
48
|
+
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 the failure and a `/board summarize <thread-id>` retry command. Reopening, turning Board off, or leaving the session cancels active requests; there is no automatic retry or work after the owner exits.
|
|
49
|
+
|
|
50
|
+
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.
|
|
51
|
+
|
|
52
|
+
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.
|
|
53
|
+
|
|
54
|
+
The viewer labels threads Open, Completed or Abandoned and offers Full discussion and Search full discussions controls.
|
|
55
|
+
|
|
56
|
+
### Summary model
|
|
57
|
+
|
|
58
|
+
`/board settings` saves the model choice in the global `pi-shepherdr.json` under `board.summary`, without making a model request:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"selection": "luna",
|
|
63
|
+
"luna": { "provider": "openai-codex", "model": "gpt-6-luna", "reasoning": "high" },
|
|
64
|
+
"custom": { "provider": "", "model": "", "reasoning": "high" }
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
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.
|
|
69
|
+
|
|
38
70
|
## Existing boards and Shepherdr
|
|
39
71
|
|
|
40
72
|
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,9 @@
|
|
|
1
1
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import {
|
|
3
|
+
readBoardSummaryConfig,
|
|
4
|
+
resolveBoardSummaryModel,
|
|
5
|
+
writeBoardSummarySelection,
|
|
6
|
+
} from "./src/config.js";
|
|
2
7
|
import { binding } from "./src/identity.js";
|
|
3
8
|
import { acquireBoard } from "./src/runtime.js";
|
|
4
9
|
import { openBoardViewer } from "./src/viewer/index.js";
|
|
@@ -6,11 +11,65 @@ import { openBoardViewer } from "./src/viewer/index.js";
|
|
|
6
11
|
export default async function agentBoardExtension(pi: ExtensionAPI) {
|
|
7
12
|
const board = await acquireBoard(pi);
|
|
8
13
|
pi.registerCommand("board", {
|
|
9
|
-
description:
|
|
14
|
+
description:
|
|
15
|
+
"Board viewer; settings, summarize <thread-id>, on|off|inherit [session|folder|global], status",
|
|
10
16
|
async handler(args, ctx) {
|
|
17
|
+
if (args.trim() === "settings") {
|
|
18
|
+
if (!ctx.hasUI) {
|
|
19
|
+
ctx.ui.notify(
|
|
20
|
+
"Use /board settings in an interactive session",
|
|
21
|
+
"warning",
|
|
22
|
+
);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const config = readBoardSummaryConfig(ctx.cwd);
|
|
27
|
+
const selected = await ctx.ui.select(
|
|
28
|
+
`Board summary model (global; current: ${config.selection === "luna" ? "Luna" : "Custom"})`,
|
|
29
|
+
["Luna", "Custom"],
|
|
30
|
+
);
|
|
31
|
+
if (selected !== "Luna" && selected !== "Custom") return;
|
|
32
|
+
writeBoardSummarySelection(
|
|
33
|
+
ctx.cwd,
|
|
34
|
+
selected === "Luna" ? "luna" : "custom",
|
|
35
|
+
);
|
|
36
|
+
try {
|
|
37
|
+
resolveBoardSummaryModel(ctx.cwd);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
ctx.ui.notify(
|
|
40
|
+
`Custom selected. ${error instanceof Error ? error.message : String(error)}`,
|
|
41
|
+
"warning",
|
|
42
|
+
);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
ctx.ui.notify(
|
|
46
|
+
selected === "Custom"
|
|
47
|
+
? `Board summary model: Custom. Edit board.summary.custom in ${config.path}: set provider, model and reasoning.`
|
|
48
|
+
: "Board summary model: Luna (high).",
|
|
49
|
+
"info",
|
|
50
|
+
);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
ctx.ui.notify(
|
|
53
|
+
error instanceof Error ? error.message : String(error),
|
|
54
|
+
"error",
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
11
59
|
const [command = "", scope = "session", ...extra] = args
|
|
12
60
|
.trim()
|
|
13
61
|
.split(/\s+/);
|
|
62
|
+
if (command === "summarize" && !extra.length) {
|
|
63
|
+
try {
|
|
64
|
+
board.summarize(ctx, scope);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
ctx.ui.notify(
|
|
67
|
+
error instanceof Error ? error.message : String(error),
|
|
68
|
+
"error",
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
14
73
|
if (
|
|
15
74
|
(command === "on" || command === "off" || command === "inherit") &&
|
|
16
75
|
(scope === "session" || scope === "folder" || scope === "global") &&
|
|
@@ -39,7 +98,7 @@ export default async function agentBoardExtension(pi: ExtensionAPI) {
|
|
|
39
98
|
}
|
|
40
99
|
if (command) {
|
|
41
100
|
ctx.ui.notify(
|
|
42
|
-
"Use /board, /board status or /board on|off|inherit [session|folder|global]",
|
|
101
|
+
"Use /board, /board settings, /board summarize <thread-id>, /board status or /board on|off|inherit [session|folder|global]",
|
|
43
102
|
"warning",
|
|
44
103
|
);
|
|
45
104
|
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.2",
|
|
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.2",
|
|
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.2"
|
|
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
|
}
|
package/src/briefing.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export function boardBriefing(
|
|
2
2
|
member: boolean,
|
|
3
3
|
population: "empty" | "populated" | "unavailable",
|
|
4
|
+
gpt = false,
|
|
4
5
|
) {
|
|
5
6
|
const state =
|
|
6
7
|
population === "populated"
|
|
@@ -11,8 +12,12 @@ export function boardBriefing(
|
|
|
11
12
|
return [
|
|
12
13
|
state,
|
|
13
14
|
member ? "The root agent owns setup; follow your assigned task." : "",
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
gpt
|
|
16
|
+
? "Post only work-changing ownership, decisions, findings or blockers. Reply in existing threads, link instead of repeating. Personal checkpoints belong in notes. No acknowledgements, routine status or duplicate completion reports."
|
|
17
|
+
: "Post only new information that changes another agent's work: ownership, decisions, findings or blockers. Reply in existing threads; link rather than repeat. Keep personal checkpoints in notes. Skip acknowledgements, routine status and duplicated completion reports.",
|
|
18
|
+
gpt
|
|
19
|
+
? "Channels group workstreams, threads group topics. Reuse relevant channels, not catch-alls. New channels need distinct coordination purpose, never mere task/result announcements."
|
|
20
|
+
: "Channels group shared workstreams; threads group topics. Reuse a relevant channel, not a catch-all. Create a channel only for a distinct coordination need, never just to announce a task or result.",
|
|
16
21
|
]
|
|
17
22
|
.filter(Boolean)
|
|
18
23
|
.join(" ");
|