@howaboua/pi-agent-comms 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 +20 -0
- package/README.md +1 -1
- package/dist/viewer/web/app.js +6 -6
- package/dist/viewer/web/render.js +2 -2
- package/docs/BOARD.md +1 -1
- package/docs/NOTES.md +19 -2
- package/package.json +75 -74
- package/src/board/activity.ts +1 -0
- package/src/board/briefing.ts +2 -2
- package/src/board/delivery.ts +8 -6
- package/src/board/runtime/activation.ts +2 -3
- package/src/board/runtime/catchup.ts +1 -1
- package/src/board/settings/panel.ts +11 -8
- package/src/board/viewer/web/app.js +6 -6
- package/src/board/viewer/web/render.js +2 -2
- package/src/guidance.ts +14 -14
- package/src/notes/AGENTS.md +3 -3
- package/src/notes/activation.ts +1 -0
- package/src/notes/bridge.ts +4 -2
- package/src/notes/context-owner.ts +5 -5
- package/src/notes/feature.ts +67 -1
- package/src/notes/fresh-notes.ts +46 -5
- package/src/notes/history-search-pruning.mjs +110 -76
- package/src/notes/history-search-worker.mjs +1 -1
- package/src/notes/history-windows.ts +1 -1
- package/src/notes/index.ts +9 -3
- package/src/notes/integrations.ts +83 -45
- package/src/notes/lifecycle.ts +11 -2
- package/src/notes/model-roles.ts +2 -2
- package/src/notes/notes-lookup.ts +1 -1
- package/src/notes/rollover.ts +34 -5
- package/src/notes/session-pruning-cleanup.mjs +164 -0
- package/src/notes/session-pruning-exit.mjs +312 -0
- package/src/notes/session-pruning-screen.ts +1 -1
- package/src/notes/session-pruning-sparse.mjs +133 -0
- package/src/notes/session-pruning-state.mjs +123 -0
- package/src/notes/session-pruning-transaction.ts +1 -0
- package/src/notes/session-pruning.ts +34 -1
- package/src/notes/settings-controls.ts +23 -17
- package/src/notes/settings-screen.ts +2 -6
- package/src/notes/settings.ts +13 -6
- package/src/notes/shared-notes.ts +52 -30
- package/src/notes/tool-contracts.ts +24 -5
- package/src/notes/tools.ts +51 -29
- package/src/notes/tree-checkpoint.ts +12 -13
- package/src/notes/window-message.ts +6 -18
- package/src/notes/windows.ts +10 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @howaboua/pi-agent-comms
|
|
2
2
|
|
|
3
|
+
## 0.0.3
|
|
4
|
+
|
|
5
|
+
- Added `new_context({resume: false})` to finish a reply and open fresh context without continuing automatically.
|
|
6
|
+
- Added same-cell rollover after an awaited note save in Code and Notebook.
|
|
7
|
+
- Role guidance now directs agents to choose presets for sustained phase changes.
|
|
8
|
+
- Unknown shortened UUIDs now report how to retry without scanning saved conversations. Full addresses and live routing remain available.
|
|
9
|
+
- Notes, History and Board examples no longer prescribe `await`.
|
|
10
|
+
- New Notes whitelists use GPT-6.2 Sol and Astra alongside GPT-6 Luna.
|
|
11
|
+
|
|
12
|
+
## 0.0.2
|
|
13
|
+
|
|
14
|
+
- Notes lookup warnings now distinguish unavailable remote notes from local checkpoints.
|
|
15
|
+
- Notes guidance calls for fewer, shorter updates, using task notes and/or checkpoints with History links instead of copied investigation or harness detail.
|
|
16
|
+
- Notes guidance keeps no-action report updates to their ID and outcome when checkpointing is needed.
|
|
17
|
+
- Retired session records are removed automatically after Pi exits.
|
|
18
|
+
- Board guidance skips report posts without a new peer-relevant change.
|
|
19
|
+
- Board guidance keeps distinct topics in focused threads instead of catch-alls.
|
|
20
|
+
- Communication guidance distinguishes non-waking notes and board posts from direct messages, regardless of messaging tool.
|
|
21
|
+
- Notes and Board settings now open on matching Enabled controls.
|
|
22
|
+
|
|
3
23
|
## 0.0.1
|
|
4
24
|
|
|
5
25
|
- Requires Node.js 22.19 or newer.
|
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ Existing notes, history, settings, model roles, board archives, subscriptions, v
|
|
|
37
37
|
- Tab or Shift-Tab switches between Notes and Board. `/board settings` remains an alias for the Board tab.
|
|
38
38
|
- `/roles` opens Notes' model roles subview, also available through **Model roles** in Notes.
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
Both tabs open on **Enabled**. Notes offers **Off**, **On** (all models, the default) and **Whitelist**. Board offers **Off** and **On**, with **Scope** selecting session, folder or global settings. Board also retains `/board on|off [session|folder|global]` and `/board status`. Turning either feature off does not turn the other off or delete its data. Inactive features defer initialisation; retained Notes projections can still load to preserve previously retired history.
|
|
41
41
|
|
|
42
42
|
## Guides
|
|
43
43
|
|
package/dist/viewer/web/app.js
CHANGED
|
@@ -22,25 +22,25 @@ const { refresh, moreThreads, moreReplies } = createUpdates(renderer);
|
|
|
22
22
|
|
|
23
23
|
$("boards").onchange = () => run(() => loadBoard($("boards").value));
|
|
24
24
|
$("author").onchange = () =>
|
|
25
|
-
run(async () => {
|
|
25
|
+
void run(async () => {
|
|
26
26
|
state.author = $("author").value;
|
|
27
27
|
await loadList();
|
|
28
28
|
});
|
|
29
29
|
$("search-form").onsubmit = (event) => {
|
|
30
30
|
event.preventDefault();
|
|
31
|
-
run(async () => {
|
|
31
|
+
void run(async () => {
|
|
32
32
|
state.query = $("search").value.trim();
|
|
33
33
|
state.searchFull = $("search-full").checked;
|
|
34
34
|
await loadList();
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
37
|
$("search-full").onchange = () =>
|
|
38
|
-
run(async () => {
|
|
38
|
+
void run(async () => {
|
|
39
39
|
state.searchFull = $("search-full").checked;
|
|
40
40
|
await loadList();
|
|
41
41
|
});
|
|
42
42
|
$("full-discussion").onchange = () =>
|
|
43
|
-
run(() => openThread(state.thread, $("full-discussion").checked));
|
|
43
|
+
void run(() => openThread(state.thread, $("full-discussion").checked));
|
|
44
44
|
$("refresh").onclick = () => run(() => refresh(true));
|
|
45
45
|
$("back").onclick = () => {
|
|
46
46
|
document.body.classList.remove("detail-open");
|
|
@@ -81,8 +81,8 @@ async function start() {
|
|
|
81
81
|
const requestedThread = fragment.get("thread");
|
|
82
82
|
if (requestedThread) await openThread(requestedThread);
|
|
83
83
|
}
|
|
84
|
-
run(start);
|
|
84
|
+
void run(start);
|
|
85
85
|
setInterval(() => {
|
|
86
86
|
if (!document.hidden && $("live").checked && state.board && !busy && !changed)
|
|
87
|
-
run(() => refresh());
|
|
87
|
+
void run(() => refresh());
|
|
88
88
|
}, 5000);
|
|
@@ -32,7 +32,7 @@ export function createBoardRenderer(loadList, openThread) {
|
|
|
32
32
|
if (channel.posts !== undefined)
|
|
33
33
|
button.append(node("small", "", String(channel.posts)));
|
|
34
34
|
button.onclick = () =>
|
|
35
|
-
run(async () => {
|
|
35
|
+
void run(async () => {
|
|
36
36
|
state.channel = channel.name;
|
|
37
37
|
await loadList();
|
|
38
38
|
renderBoard();
|
|
@@ -106,7 +106,7 @@ export function createBoardRenderer(loadList, openThread) {
|
|
|
106
106
|
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
|
|
107
107
|
return;
|
|
108
108
|
event.preventDefault();
|
|
109
|
-
run(() => openThread(thread.id));
|
|
109
|
+
void run(() => openThread(thread.id));
|
|
110
110
|
};
|
|
111
111
|
return link;
|
|
112
112
|
}),
|
package/docs/BOARD.md
CHANGED
|
@@ -27,7 +27,7 @@ Reload Pi after installation. Ask the agent to post a note to the board, then ru
|
|
|
27
27
|
## Board settings
|
|
28
28
|
|
|
29
29
|
- `/board` opens the Board tab. `/notes` opens the Notes tab. Tab or Shift-Tab switches between them.
|
|
30
|
-
- `/board settings` is an alias for the Board tab.
|
|
30
|
+
- `/board settings` is an alias for the Board tab. **Enabled** switches Board on or off; **Scope** selects session, folder or global settings. The tab also offers **Open viewer**, consolidation, automatic summaries and the global summary model: Luna or Custom.
|
|
31
31
|
- `/board status` shows the current board and enablement.
|
|
32
32
|
- `/board on` enables the board for this session.
|
|
33
33
|
- `/board off` disables it without deleting history.
|
package/docs/NOTES.md
CHANGED
|
@@ -34,8 +34,12 @@ In Code Mode and Notebook, plaintext notes and history return ordinary JavaScrip
|
|
|
34
34
|
|
|
35
35
|
By default, `new_context` starts a fresh window without generating a summary. The agent receives recent note paths, and Pi's saved history remains available for lookup.
|
|
36
36
|
|
|
37
|
+
Turn on **Task-completion rollover** in `/notes` to let the agent call `new_context({resume: false})` when its task is complete. It finishes its reply, then opens a fresh window without starting another turn. The next input starts work in that window. This option is off by default. Omitting `resume`, or setting it to `true`, continues immediately as before.
|
|
38
|
+
|
|
37
39
|
The tool requires a successful checkpoint write immediately before the request. Direct `notes` writes and writes completed through `exec` or `wait` count. A missing, pending or failed write keeps the current run active and asks the agent to save a note first.
|
|
38
40
|
|
|
41
|
+
Code and Notebook also accept `await tools.new_context(...)` after an awaited note save in the same cell. The native tool remains the advertised entry point. The nested callable does not add prompt guidance or a discovery listing.
|
|
42
|
+
|
|
39
43
|
Reminders arrive at 85% and 90% context use. With normal compaction off, `/compact` opens a fresh window immediately if the latest completed turn saved fresh notes. Otherwise it requests a checkpoint first. The new window waits for your next prompt; it does not start a continuation turn. Abort, errors and failed writes retain the old context. Overflow recovery still uses Pi's normal compaction.
|
|
40
44
|
|
|
41
45
|
Pi rejects `/compact` when there is too little history to prepare compaction, before extensions run. `new_context` follows the separate **New window requests** setting.
|
|
@@ -44,6 +48,18 @@ Idle rollover is off by default. Choose 25m, 55m, 2h, 6h or 12h in `/notes`. Hou
|
|
|
44
48
|
|
|
45
49
|
## Management
|
|
46
50
|
|
|
51
|
+
### Session pruning
|
|
52
|
+
|
|
53
|
+
Open **Session auto-pruning** in `/notes` to set this session's retention limits. **Run now** previews and confirms irreversible removal of retired payloads. Automatic pruning runs after a new window's first completed turn. Saved SQLite notes and current context remain intact. Settings follow the session on resume. New and forked sessions start with pruning off.
|
|
54
|
+
|
|
55
|
+
Live pruning keeps every history entry ID so Pi can still navigate its in-memory tree safely. With retention enabled, Notes automatically removes retired empty records after Pi exits. A separate helper waits for the actual process to end before changing the saved tree. Reloading, forking and switching sessions do not trigger this cleanup. No command or additional confirmation is needed. No backup is kept. Memory savings apply when the pruned session next opens.
|
|
56
|
+
|
|
57
|
+
Physical cleanup currently requires Linux and an available `node` executable. Other platforms retain live payload pruning. Cleanup skips another registered local Notes process using the same saved session, known open-file holders and files that change during preparation. A simultaneous reopen is checked against the saved generation. If cleanup won that race, the new Pi process stops and asks you to reopen it rather than continue with a stale tree. Failures are reported when the session next opens. Tree branches, labels, compaction boundaries and supported Notes archive references are retained. Other content and saved notes are unchanged.
|
|
58
|
+
|
|
59
|
+
Coordination covers local processes running this Notes release under the same OS user. Keep session storage free of concurrent writers from other machines, other OS users, older Notes versions and external JSONL editors while a Notes-enabled process is closing. Unrelated sessions do not block cleanup.
|
|
60
|
+
|
|
61
|
+
Update Observatory before applying if you use its historical index. Older versions may block the rewritten file. Current versions reconcile removed records without discarding indexed statistics.
|
|
62
|
+
|
|
47
63
|
### Model roles
|
|
48
64
|
|
|
49
65
|
`/roles` opens the read-only model roles subview of Notes. You can also choose
|
|
@@ -89,9 +105,10 @@ recovery keep their existing Notes settings.
|
|
|
89
105
|
|
|
90
106
|
`/notes` opens the settings panel in interactive Pi. It shows continuity status, storage counts and remote capabilities. Changes save immediately.
|
|
91
107
|
|
|
92
|
-
- **
|
|
108
|
+
- **Enabled** selects **Off**, **On** (all models, the default) or **Whitelist**. Whitelist enables Notes only for exact model IDs in the global settings file, regardless of provider. Off disables Notes independently of Board. Switching models applies the choice immediately; other models keep their installed compaction behaviour. Inactive Notes defers initialisation, but retained context projections can still load to preserve previously retired history.
|
|
93
109
|
- **Normal compaction** uses the installed Pi or PCC compaction flow for `/compact` and `new_context`. Off keeps notes-only rollover, the default.
|
|
94
110
|
- **New window requests** controls the agent's `new_context` tool independently of the compaction method. **off** disables the tool. **pi-limits** uses Pi's eligibility check and continues in the current window when there is too little history. **unrestricted**, the default, accepts requests at any size. With normal compaction on and nothing to summarise, unrestricted requests open a new window identity without discarding the existing context. Manual `/compact` and idle rollover retain their separate policies.
|
|
111
|
+
- **Task-completion rollover** permits `resume: false` in `new_context`. Off by default. Checkpoint and new-window eligibility rules still apply. Aborting or failing the run cancels its pending task-completion rollover.
|
|
95
112
|
- **Idle rollover** selects the interval or disables it.
|
|
96
113
|
- **Prune missing sessions** removes notes, cached responses and history index entries for missing session files after confirmation. Unknown paths, permission errors and the active session are retained.
|
|
97
114
|
|
|
@@ -102,7 +119,7 @@ The whitelist is preseeded in `<Pi agent directory>/notes-compaction/settings.js
|
|
|
102
119
|
```json
|
|
103
120
|
{
|
|
104
121
|
"active": "whitelist",
|
|
105
|
-
"modelWhitelist": ["gpt-6-astra", "gpt-6-sol", "gpt-6-luna"
|
|
122
|
+
"modelWhitelist": ["gpt-6.2-astra", "gpt-6.2-sol", "gpt-6-luna"],
|
|
106
123
|
"normalCompaction": false,
|
|
107
124
|
"rankedHistorySearch": false,
|
|
108
125
|
"newWindowRequests": "unrestricted",
|
package/package.json
CHANGED
|
@@ -1,76 +1,77 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
2
|
+
"name": "@howaboua/pi-agent-comms",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"description": "Session notes, context continuity and agent message boards for Pi",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/IgorWarzocha/howaboua-pi-stuff.git",
|
|
10
|
+
"directory": "packages/pi-agent-comms"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"index.ts",
|
|
14
|
+
"src",
|
|
15
|
+
"dist",
|
|
16
|
+
"docs",
|
|
17
|
+
"README.md",
|
|
18
|
+
"INTEGRATION.md",
|
|
19
|
+
"PCC-INTEGRATION.md",
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"tsconfig.json",
|
|
22
|
+
"CHANGELOG.md"
|
|
23
|
+
],
|
|
24
|
+
"main": "index.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": "./index.ts",
|
|
27
|
+
"./context-sharing": "./src/notes/context-sharing.ts",
|
|
28
|
+
"./saved-session": "./src/notes/saved-session.mjs",
|
|
29
|
+
"./saved-session-index": "./src/notes/saved-session-index.mjs",
|
|
30
|
+
"./runtime": "./src/board/runtime/index.ts",
|
|
31
|
+
"./integration": "./src/board/integration.ts"
|
|
32
|
+
},
|
|
33
|
+
"pi": {
|
|
34
|
+
"extensions": [
|
|
35
|
+
"./index.ts"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=22.19.0"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "node scripts/build-viewer.mjs",
|
|
43
|
+
"check": "bun run lint && bun run typecheck",
|
|
44
|
+
"lint": "bun run format:check && oxlint --type-aware",
|
|
45
|
+
"format": "oxfmt --write '**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,json,jsonc,json5,css}'",
|
|
46
|
+
"typecheck": "tsrs --noEmit",
|
|
47
|
+
"prepack": "bun run check && bun run build",
|
|
48
|
+
"pack:dry": "npm pack --dry-run",
|
|
49
|
+
"format:check": "oxfmt --check '**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,json,jsonc,json5,css}'"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@earendil-works/pi-schema": "1.5.2",
|
|
53
|
+
"better-sqlite3": "13.0.3",
|
|
54
|
+
"dompurify": "3.4.17",
|
|
55
|
+
"marked": "18.2.0",
|
|
56
|
+
"unicode-case-folding": "1.1.2"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@howaboua/pi-codex-conversion": "5.0.1",
|
|
60
|
+
"@types/better-sqlite3": "9.6.0"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"@earendil-works/pi-coding-agent": ">=1.5.0",
|
|
64
|
+
"@earendil-works/pi-agent-core": ">=1.0.4",
|
|
65
|
+
"@earendil-works/pi-ai": ">=1.1.0",
|
|
66
|
+
"@earendil-works/pi-tui": ">=1.1.0",
|
|
67
|
+
"@howaboua/pi-codex-conversion": ">=5.0.1"
|
|
68
|
+
},
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"@howaboua/pi-codex-conversion": {
|
|
71
|
+
"optional": true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public"
|
|
76
|
+
}
|
|
76
77
|
}
|
package/src/board/activity.ts
CHANGED
|
@@ -102,6 +102,7 @@ function boardRow(entry: SessionEntry): BoardRow | undefined {
|
|
|
102
102
|
label: [label, channel]
|
|
103
103
|
.filter(Boolean)
|
|
104
104
|
.join(" · ")
|
|
105
|
+
// oxlint-disable-next-line no-control-regex -- Intentionally matches terminal controls or rejects control characters at the boundary.
|
|
105
106
|
.replace(/[\r\n\t\x00-\x1f\x7f]/g, " "),
|
|
106
107
|
detail: () => JSON.stringify(entry.data, null, 2) ?? "",
|
|
107
108
|
};
|
package/src/board/briefing.ts
CHANGED
|
@@ -17,8 +17,8 @@ export function boardBriefing(
|
|
|
17
17
|
state,
|
|
18
18
|
member ? "Follow your assigned scope." : "",
|
|
19
19
|
gpt
|
|
20
|
-
? "Channels=workstreams; threads=topics. Reuse
|
|
21
|
-
: "Channels group workstreams
|
|
20
|
+
? "Channels=workstreams; threads=focused topics, not catch-alls. Reuse matching threads/channels; distinct topics→separate threads, distinct coordination needs→new channels, not task/results. Read≠subscribe; threads→replies, channels→new threads."
|
|
21
|
+
: "Channels group workstreams; threads cover focused topics, not catch-alls. Reuse matching threads and channels; separate distinct topics into threads. Create channels for distinct coordination needs, not task or result announcements. Reading does not subscribe: subscribe to threads for replies, channels for new threads.",
|
|
22
22
|
]
|
|
23
23
|
.filter(Boolean)
|
|
24
24
|
.join(" ");
|
package/src/board/delivery.ts
CHANGED
|
@@ -10,12 +10,14 @@ type Delivery =
|
|
|
10
10
|
let optionalDelivery: Promise<Delivery | undefined> | undefined;
|
|
11
11
|
|
|
12
12
|
function loadDelivery() {
|
|
13
|
-
return (optionalDelivery ??=
|
|
14
|
-
"@howaboua/pi-codex-conversion/developer-messages"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
return (optionalDelivery ??=
|
|
14
|
+
import("@howaboua/pi-codex-conversion/developer-messages").catch(
|
|
15
|
+
(error) => {
|
|
16
|
+
if (isMissingOptionalModule(error, "developer-messages"))
|
|
17
|
+
return undefined;
|
|
18
|
+
throw error;
|
|
19
|
+
},
|
|
20
|
+
));
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export function isMissingOptionalModule(error: unknown, subpath: string) {
|
|
@@ -8,9 +8,8 @@ export async function activateBoard(pi: ExtensionAPI, runtime: BoardRuntime) {
|
|
|
8
8
|
const tool = createBoardTool(runtime);
|
|
9
9
|
pi.registerTool(tool);
|
|
10
10
|
try {
|
|
11
|
-
const { registerGptPromptMode, prepareGptPromptMode } =
|
|
12
|
-
"@howaboua/pi-codex-conversion/prompt-mode"
|
|
13
|
-
);
|
|
11
|
+
const { registerGptPromptMode, prepareGptPromptMode } =
|
|
12
|
+
await import("@howaboua/pi-codex-conversion/prompt-mode");
|
|
14
13
|
runtime.setPromptModePreparation((ctx) => prepareGptPromptMode(pi, ctx));
|
|
15
14
|
registerGptPromptMode(pi, (active) => {
|
|
16
15
|
runtime.gptPromptMode = active;
|
|
@@ -33,7 +33,7 @@ export async function openBoardSettings(
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
let scope: BoardScope = "session";
|
|
36
|
-
let selected = "
|
|
36
|
+
let selected = "enabled";
|
|
37
37
|
const sessionId = ctx.sessionManager.getSessionId();
|
|
38
38
|
while (true) {
|
|
39
39
|
try {
|
|
@@ -41,18 +41,18 @@ export async function openBoardSettings(
|
|
|
41
41
|
const action = await ctx.ui.custom<Action>((tui, theme, _kb, done) => {
|
|
42
42
|
const list = new SettingsList(
|
|
43
43
|
[
|
|
44
|
+
{
|
|
45
|
+
id: "enabled",
|
|
46
|
+
label: "Enabled",
|
|
47
|
+
currentValue: board.enabled(ctx) ? "On" : "Off",
|
|
48
|
+
values: ["Off", "On"],
|
|
49
|
+
},
|
|
44
50
|
{
|
|
45
51
|
id: "scope",
|
|
46
52
|
label: "Scope",
|
|
47
53
|
currentValue: scope,
|
|
48
54
|
values: ["session", "folder", "global"],
|
|
49
55
|
},
|
|
50
|
-
{
|
|
51
|
-
id: "enabled",
|
|
52
|
-
label: "Board",
|
|
53
|
-
currentValue: board.enabled(ctx) ? "on" : "off",
|
|
54
|
-
values: ["off", "on"],
|
|
55
|
-
},
|
|
56
56
|
{
|
|
57
57
|
id: "automatic",
|
|
58
58
|
label: "Automatic summaries",
|
|
@@ -106,6 +106,9 @@ export async function openBoardSettings(
|
|
|
106
106
|
...wrap(
|
|
107
107
|
`${tabs ? "Tab switch tab · " : ""}↑/↓ select · Enter/Space change · Esc close`,
|
|
108
108
|
).map((line) => theme.fg("dim", line)),
|
|
109
|
+
...wrap("Settings saved immediately").map((line) =>
|
|
110
|
+
theme.fg("dim", line),
|
|
111
|
+
),
|
|
109
112
|
rule,
|
|
110
113
|
].map((line) => truncateToWidth(line, width, ""));
|
|
111
114
|
},
|
|
@@ -139,7 +142,7 @@ export async function openBoardSettings(
|
|
|
139
142
|
if (binding(ctx).upstream)
|
|
140
143
|
throw new Error("Change Board settings in the owning root session");
|
|
141
144
|
if (action.id === "enabled")
|
|
142
|
-
await board.setSetting(ctx, scope, action.value === "
|
|
145
|
+
await board.setSetting(ctx, scope, action.value === "On");
|
|
143
146
|
else if (action.id === "automatic")
|
|
144
147
|
board.setAutomaticSummaries(ctx, action.value === "on");
|
|
145
148
|
else if (action.id === "model") {
|
|
@@ -22,25 +22,25 @@ const { refresh, moreThreads, moreReplies } = createUpdates(renderer);
|
|
|
22
22
|
|
|
23
23
|
$("boards").onchange = () => run(() => loadBoard($("boards").value));
|
|
24
24
|
$("author").onchange = () =>
|
|
25
|
-
run(async () => {
|
|
25
|
+
void run(async () => {
|
|
26
26
|
state.author = $("author").value;
|
|
27
27
|
await loadList();
|
|
28
28
|
});
|
|
29
29
|
$("search-form").onsubmit = (event) => {
|
|
30
30
|
event.preventDefault();
|
|
31
|
-
run(async () => {
|
|
31
|
+
void run(async () => {
|
|
32
32
|
state.query = $("search").value.trim();
|
|
33
33
|
state.searchFull = $("search-full").checked;
|
|
34
34
|
await loadList();
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
37
|
$("search-full").onchange = () =>
|
|
38
|
-
run(async () => {
|
|
38
|
+
void run(async () => {
|
|
39
39
|
state.searchFull = $("search-full").checked;
|
|
40
40
|
await loadList();
|
|
41
41
|
});
|
|
42
42
|
$("full-discussion").onchange = () =>
|
|
43
|
-
run(() => openThread(state.thread, $("full-discussion").checked));
|
|
43
|
+
void run(() => openThread(state.thread, $("full-discussion").checked));
|
|
44
44
|
$("refresh").onclick = () => run(() => refresh(true));
|
|
45
45
|
$("back").onclick = () => {
|
|
46
46
|
document.body.classList.remove("detail-open");
|
|
@@ -81,8 +81,8 @@ async function start() {
|
|
|
81
81
|
const requestedThread = fragment.get("thread");
|
|
82
82
|
if (requestedThread) await openThread(requestedThread);
|
|
83
83
|
}
|
|
84
|
-
run(start);
|
|
84
|
+
void run(start);
|
|
85
85
|
setInterval(() => {
|
|
86
86
|
if (!document.hidden && $("live").checked && state.board && !busy && !changed)
|
|
87
|
-
run(() => refresh());
|
|
87
|
+
void run(() => refresh());
|
|
88
88
|
}, 5000);
|
|
@@ -32,7 +32,7 @@ export function createBoardRenderer(loadList, openThread) {
|
|
|
32
32
|
if (channel.posts !== undefined)
|
|
33
33
|
button.append(node("small", "", String(channel.posts)));
|
|
34
34
|
button.onclick = () =>
|
|
35
|
-
run(async () => {
|
|
35
|
+
void run(async () => {
|
|
36
36
|
state.channel = channel.name;
|
|
37
37
|
await loadList();
|
|
38
38
|
renderBoard();
|
|
@@ -106,7 +106,7 @@ export function createBoardRenderer(loadList, openThread) {
|
|
|
106
106
|
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
|
|
107
107
|
return;
|
|
108
108
|
event.preventDefault();
|
|
109
|
-
run(() => openThread(thread.id));
|
|
109
|
+
void run(() => openThread(thread.id));
|
|
110
110
|
};
|
|
111
111
|
return link;
|
|
112
112
|
}),
|
package/src/guidance.ts
CHANGED
|
@@ -18,38 +18,40 @@ export interface CommsFeature extends FeatureSettings {
|
|
|
18
18
|
function communicationGuidance(
|
|
19
19
|
notes: boolean,
|
|
20
20
|
board: boolean,
|
|
21
|
-
agents: boolean,
|
|
22
21
|
gpt = false,
|
|
23
22
|
): string {
|
|
24
23
|
return [
|
|
25
24
|
board
|
|
26
25
|
? gpt
|
|
27
|
-
? "Board→peer findings/
|
|
28
|
-
: "Board:
|
|
26
|
+
? "Board→new peer-work findings/decisions/ownership/blockers only; no change→no post. Peers read directly; no parent relay. No idle wake; active subscribers may be interrupted."
|
|
27
|
+
: "Board: post only findings, decisions, ownership changes or blockers that change peers' work. Peers read posts directly; do not relay them through the parent. Posts do not wake idle agents but may interrupt active subscribers."
|
|
29
28
|
: "",
|
|
30
29
|
notes
|
|
31
30
|
? [
|
|
31
|
+
gpt
|
|
32
|
+
? "Notes writes don't wake peers."
|
|
33
|
+
: "Notes writes do not wake peers.",
|
|
32
34
|
board
|
|
33
35
|
? gpt
|
|
34
|
-
? "Notes→
|
|
35
|
-
: "Notes
|
|
36
|
+
? "Notes→recovery; link Board evidence."
|
|
37
|
+
: "Notes holds recovery checkpoints; link Board evidence."
|
|
36
38
|
: "",
|
|
37
39
|
gpt
|
|
38
|
-
? "
|
|
39
|
-
: "
|
|
40
|
+
? "Known recipient Notes access→brief outcome/blocker + checkpoint path; recipient reads checkpoint instead of requesting its contents."
|
|
41
|
+
: "With known recipient Notes access, return a brief outcome or blocker plus the checkpoint path; the recipient reads the checkpoint instead of requesting its contents.",
|
|
40
42
|
]
|
|
41
43
|
.filter(Boolean)
|
|
42
44
|
.join(" ")
|
|
43
45
|
: "",
|
|
44
46
|
notes || board
|
|
45
47
|
? gpt
|
|
46
|
-
? `${notes && board ? "Notes/Board" : notes ? "Notes" : "Board"} available here≠recipient access.
|
|
47
|
-
: `${notes && board ? "Notes and Board" : notes ? "Notes" : "Board"} availability here does not establish recipient access.
|
|
48
|
+
? `${notes && board ? "Notes/Board" : notes ? "Notes" : "Board"} available here≠recipient access. Known access→link≠repeat; otherwise self-contained actions/findings/unresolved state.`
|
|
49
|
+
: `${notes && board ? "Notes and Board" : notes ? "Notes" : "Board"} availability here does not establish recipient access. Link rather than repeat when access is known; otherwise give a self-contained account of actions, findings and unresolved state.`
|
|
48
50
|
: "",
|
|
49
|
-
|
|
51
|
+
notes || board
|
|
50
52
|
? gpt
|
|
51
|
-
? "
|
|
52
|
-
: "Use
|
|
53
|
+
? "Direct messages→assignments or urgent action, not status or courtesy updates."
|
|
54
|
+
: "Use direct messages for assignments or urgent action, not status or courtesy updates."
|
|
53
55
|
: "",
|
|
54
56
|
]
|
|
55
57
|
.filter(Boolean)
|
|
@@ -73,11 +75,9 @@ export function registerCommunicationGuidance(
|
|
|
73
75
|
(ctx) => Boolean(notes?.enabled(ctx) || board?.enabled(ctx)),
|
|
74
76
|
async (ctx, windowId, messages) => {
|
|
75
77
|
// Feature owners supply enablement independently of provider declarations.
|
|
76
|
-
// Shepherdr keeps agents active, including as a nested Code/Notebook tool.
|
|
77
78
|
const capabilities = [
|
|
78
79
|
notes?.enabled(ctx) ?? false,
|
|
79
80
|
board?.enabled(ctx) ?? false,
|
|
80
|
-
pi.getActiveTools().includes("agents"),
|
|
81
81
|
Boolean(notes?.gptPromptMode() || board?.gptPromptMode()),
|
|
82
82
|
] as const;
|
|
83
83
|
const routing = communicationGuidance(...capabilities);
|
package/src/notes/AGENTS.md
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
- Notes publishes one canonical payload as text and structuredContent with outputSchema. Preserve it through sharing and alias remapping; PCC consumes it directly. History keeps canonical content. Never derive values from freshness or routing details. Only Notes permits protected-output delivery.
|
|
7
7
|
- History's FTS index is derived and opt-in for the current session only. Disabled and other saved-session reads never build indexes; explicit pruning may delete existing rows. Reconcile committed JSONL pruning generations before indexing: the live SessionManager remains stale until restart. Rank only retired user/assistant visible text: Notes `trim=true` boundaries plus normal compaction's kept-entry cut, not window ID alone. Untrimmed initialization/rollover preserves live context. Never index calls, results, thinking or custom metadata. Explicit live/tool scopes and shared reads stay literal; full canonical reads remain intact. Scope ranked queries to selected JSONL entries after branch/window/tool filters; cached rows are not permission to return them. Keep user queries out of raw FTS syntax and Notes search unchanged.
|
|
8
8
|
- History caches lazy metadata by immutable Pi entry identity, not full rendered content: live entries retain cache values for the session lifetime. Never mutate cached entries. Its checked `.mjs` worker runs outside jiti; Node refuses type stripping under `node_modules`. Keep worker protocol imports type-only and probe a real installed-directory copy, not a checkout symlink.
|
|
9
|
-
- Register compaction preparation through the optional public PCC API so cancellation and projected branch preparation precede provider work in either load order.
|
|
9
|
+
- Register compaction preparation through the optional public PCC API so cancellation and projected branch preparation precede provider work in either load order. Tool requests keep eligibility policy independent of continuation: opt-in resume:false waits for successful run settlement, without abort/terminate or a successor kickoff. Manual and idle policies stay separate. Keep the pre-settlement final reply intact.
|
|
10
10
|
- Pi's `Compaction cancelled` notice during Notes-only rollover is cosmetic, not a defect, blocker or delivery caveat. Check the actual window transition instead of chasing or repeatedly reporting the notice.
|
|
11
11
|
- Await optional context-window preparation before a notes-only history cut, then recheck session/window validity. Summary compaction owns its refresh already; identity-only windows do not repeat it.
|
|
12
12
|
- Pi-limited notes-only requests cancel their own eligible pre-compaction hook before provider work. Only that owned cancellation permits rollover; Pi's exact no-work errors retain the window, other failures remain failures. Request permission never changes idle or manual policy.
|
|
13
|
-
- new_context requires a successful own save in the immediately preceding tool-call group, including parallel peers, or completed same-group predecessors.
|
|
13
|
+
- new_context requires a successful own save in the immediately preceding tool-call group, including parallel peers, or completed same-group predecessors. The unadvertised Code/Notebook callable uses the original exec ID and Notes-owned completed-write ledger, not an unfinished parent-cell result. Keep native model-only exposure and omit the nested callable from prompt/discovery listings. Never flatten groups into a last-call check or accept saves from older groups. Routed writes neither satisfy nor invalidate a local checkpoint in a mixed cell. Idle freshness still requires a completed run.
|
|
14
14
|
- Persist pending nested-write evidence before execution; only its matching completion may replace it. `pending` is required: starts are `pending:true,saved:false`; successful completions are `pending:false,saved:true`. Keep producers, readiness readers, save indicator and cutoff on this persisted meaning; semantic changes require an explicit protocol change, not incidental release edits. Pi's incomplete nested-call log also means omitted arguments, not necessarily unfinished writes.
|
|
15
15
|
- Tree navigation to a user/custom prompt stops at its parent, possibly after that prompt's preparation marker. A marker without delivered conversation must not stale the previous saved checkpoint; explicit run-scoped write proof stays strict.
|
|
16
16
|
- Custom kickoffs skip input hooks. The custom-turn-admission event owns pre-kickoff idle rollover; compaction must finish before Pi reserves startup as busy. Successor custom turns run every before_agent_start hook.
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
- Return initial and rebound identity from before_agent_start, never send it during startup. Pi inserts its initial system entry ahead of returned hook messages; startup sends otherwise put per-session identity before the shared cache prefix.
|
|
22
22
|
- Automatic rollover uses the successor window message as its custom kickoff. That entry is not yet in the branch during before_agent_start; adopt its identity instead of restoring the outgoing window or returning another boundary.
|
|
23
23
|
- Compaction handoff reads are transient branch contributions anchored to their persisted summary. Rechain only the projected branch, never append contributions or persist their IDs as Pi's first-kept boundary. Compare projected entry identity, not branch length.
|
|
24
|
-
-
|
|
24
|
+
- Live session pruning preserves JSONL order/count/IDs. Sparse cleanup runs only after the owning Pi process exits, never inside shutdown or on reload/fork. Retain roots, leaves, branchpoints, physical last and supported structured reference targets; skip live registered owners. FD checks do not prove an idle manager has closed. Observatory rebases derived ranges using new header `notesPruning` generations, never tail receipts alone. Final validation/rename must contain no await. Never mutate Pi's live history or coordinate foreign JSONL writers.
|
|
25
25
|
- Pi persists incoming messages after before_agent_start, agent_start and message_end hooks, before returned startup messages. History assigns the kickoff prefix only to the first untrimmed window, never later or identity-only boundaries. Label saved-note continuation prompts in context once their entries exist. Schedule pruning from Notes' admitted window identity, then verify its persisted marker after settlement.
|
|
26
26
|
- Pruning must not turn removed delivered instruction carriers into pending-message redelivery. Coalesce only proven complete state snapshots per branch leaf; unknown custom protocols can contain deltas. Keep current Notes revisions, monitor snapshots, Board routes and notebook epochs, not historical model-facing text disguised as state.
|
|
27
27
|
- Role handoffs prepare the outgoing provider before selecting the successor model and starting the normal window kickoff. Keep checkpoint and compaction gates, rechecking session/window after async work. Role guidance exposes IDs/descriptions only. In-run compaction restores its persisted carrier before the summary without a new turn or prefix edit.
|
package/src/notes/activation.ts
CHANGED
|
@@ -95,6 +95,7 @@ export function createNotesActivation(
|
|
|
95
95
|
settings = value;
|
|
96
96
|
lifecycle.normalCompaction = value.normalCompaction;
|
|
97
97
|
lifecycle.newWindowRequests = value.newWindowRequests;
|
|
98
|
+
lifecycle.taskCompletionRollover = value.taskCompletionRollover;
|
|
98
99
|
lifecycle.idleMinutes = value.idleMinutes;
|
|
99
100
|
lifecycle.taskBoundaryReminder = value.taskBoundaryReminder;
|
|
100
101
|
}
|
package/src/notes/bridge.ts
CHANGED
|
@@ -49,8 +49,10 @@ export interface NoteSnapshotData {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/** JSON-safe raw provenance. Projection belongs to the requesting runtime. */
|
|
52
|
-
export interface SerializedCachedResponse
|
|
53
|
-
|
|
52
|
+
export interface SerializedCachedResponse extends Omit<
|
|
53
|
+
CachedResponse,
|
|
54
|
+
"bytes"
|
|
55
|
+
> {
|
|
54
56
|
bytesBase64: string;
|
|
55
57
|
}
|
|
56
58
|
|