@howaboua/pi-agent-board 0.0.5 → 0.0.6
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 +9 -0
- package/README.md +3 -1
- package/dist/viewer/archive.js +24 -17
- package/dist/viewer/web/posts.js +0 -1
- package/index.ts +5 -69
- package/package.json +14 -11
- package/runtime.ts +2 -0
- package/scripts/build-viewer.mjs +9 -0
- package/src/board/AGENTS.md +12 -0
- package/src/{awareness.ts → board/awareness.ts} +4 -10
- package/src/board/briefing.ts +25 -0
- package/src/{contract.ts → board/contract.ts} +31 -27
- package/src/board/feature.ts +91 -0
- package/src/{identity.ts → board/identity.ts} +50 -30
- package/src/board/protocol.ts +117 -0
- package/src/{queries.ts → board/queries.ts} +9 -11
- package/src/{response.ts → board/response.ts} +7 -1
- package/src/board/runtime/activation.ts +50 -0
- package/src/{runtime → board/runtime}/coordinator.ts +76 -43
- package/src/board/runtime/engine.ts +40 -0
- package/src/board/runtime/index.ts +63 -0
- package/src/{runtime → board/runtime}/owner.ts +16 -12
- package/src/{runtime → board/runtime}/routing.ts +2 -2
- package/src/{runtime → board/runtime}/turns.ts +9 -1
- package/src/{search.ts → board/search.ts} +5 -5
- package/src/board/settings/panel.ts +193 -0
- package/src/{store.ts → board/store.ts} +5 -4
- package/src/{summarizer.ts → board/summarizer.ts} +3 -2
- package/src/{tool.ts → board/tool.ts} +5 -0
- package/src/board/viewer/AGENTS.md +1 -0
- package/src/{viewer → board/viewer}/archive.ts +24 -17
- package/src/{viewer → board/viewer}/index.ts +5 -1
- package/src/{viewer → board/viewer}/web/posts.js +0 -1
- package/src/guidance.ts +121 -0
- package/src/settings-navigation.ts +11 -0
- package/src/timestamps.ts +3 -0
- package/tsconfig.json +6 -2
- package/tsconfig.viewer.json +11 -0
- package/src/briefing.ts +0 -32
- package/src/protocol.ts +0 -78
- package/src/runtime/index.ts +0 -113
- package/src/settings/panel.ts +0 -87
- /package/src/{activity.ts → board/activity.ts} +0 -0
- /package/src/{archive.ts → board/archive.ts} +0 -0
- /package/src/{config.ts → board/config.ts} +0 -0
- /package/src/{consolidation.ts → board/consolidation.ts} +0 -0
- /package/src/{context-briefing.ts → board/context-briefing.ts} +0 -0
- /package/src/{delivery.ts → board/delivery.ts} +0 -0
- /package/src/{integration.ts → board/integration.ts} +0 -0
- /package/src/{paging.ts → board/paging.ts} +0 -0
- /package/src/{runtime → board/runtime}/catchup.ts +0 -0
- /package/src/{summaries.ts → board/summaries.ts} +0 -0
- /package/src/{viewer → board/viewer}/config.ts +0 -0
- /package/src/{viewer → board/viewer}/contracts.ts +0 -0
- /package/src/{viewer → board/viewer}/server.ts +0 -0
- /package/src/{viewer → board/viewer}/source.ts +0 -0
- /package/src/{viewer → board/viewer}/web/app.js +0 -0
- /package/src/{viewer → board/viewer}/web/index.html +0 -0
- /package/src/{viewer → board/viewer}/web/navigation.js +0 -0
- /package/src/{viewer → board/viewer}/web/render.js +0 -0
- /package/src/{viewer → board/viewer}/web/session.js +0 -0
- /package/src/{viewer → board/viewer}/web/style.css +0 -0
- /package/src/{viewer → board/viewer}/web/updates.js +0 -0
package/src/guidance.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ExtensionAPI,
|
|
3
|
+
ExtensionContext,
|
|
4
|
+
} from "@earendil-works/pi-coding-agent";
|
|
5
|
+
import {
|
|
6
|
+
contextBriefingWindow,
|
|
7
|
+
recordContextBriefing,
|
|
8
|
+
registerContextBriefing,
|
|
9
|
+
} from "./board/context-briefing.js";
|
|
10
|
+
import type { FeatureSettings } from "./settings-navigation.js";
|
|
11
|
+
|
|
12
|
+
export interface CommsFeature extends FeatureSettings {
|
|
13
|
+
enabled(ctx: ExtensionContext): boolean;
|
|
14
|
+
gptPromptMode(): boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Routing belongs here; feature carriers retain identity, recovery and navigation. */
|
|
18
|
+
function communicationGuidance(
|
|
19
|
+
notes: boolean,
|
|
20
|
+
board: boolean,
|
|
21
|
+
agents: boolean,
|
|
22
|
+
gpt = false,
|
|
23
|
+
): string {
|
|
24
|
+
return [
|
|
25
|
+
board
|
|
26
|
+
? gpt
|
|
27
|
+
? "Board→peer findings/discovery, ownership/decisions/blockers affecting peers. Self-contained detail welcome; direct discovery≠parent relay. Existing thread replies; known shared peers→link≠repeat. No ack/status spam/duplicate completion reports."
|
|
28
|
+
: "Board: share findings, discoveries, ownership, decisions and blockers that change peers' work. Self-contained detail lets peers read directly, without a parent relay. Reply in existing threads. Link rather than repeat for peers with known Board access. Skip acknowledgements, routine status and duplicate completion reports."
|
|
29
|
+
: "",
|
|
30
|
+
notes
|
|
31
|
+
? [
|
|
32
|
+
board
|
|
33
|
+
? gpt
|
|
34
|
+
? "Notes→current work/progress/recovery + Board references."
|
|
35
|
+
: "Notes: current work, progress and recovery, with Board references."
|
|
36
|
+
: "",
|
|
37
|
+
gpt
|
|
38
|
+
? "Keep Notes checkpoints. Known recipient access→brief outcome/blocker + path; recipient READS checkpoint≠request full report."
|
|
39
|
+
: "Keep checkpoints in Notes. When the recipient is known to have access, return a brief outcome or blocker plus its path. The recipient reads the checkpoint for details rather than asking for a full report.",
|
|
40
|
+
]
|
|
41
|
+
.filter(Boolean)
|
|
42
|
+
.join(" ")
|
|
43
|
+
: "",
|
|
44
|
+
notes || board
|
|
45
|
+
? gpt
|
|
46
|
+
? `${notes && board ? "Notes/Board" : notes ? "Notes" : "Board"} available here≠recipient access. Unknown/unshared access→self-contained actions taken/findings/unresolved state, not bare references.`
|
|
47
|
+
: `${notes && board ? "Notes and Board" : notes ? "Notes" : "Board"} availability here does not establish recipient access. If access is unknown or unshared, send a self-contained account of what you did, found and left unresolved, not just private references.`
|
|
48
|
+
: "",
|
|
49
|
+
agents && notes && board
|
|
50
|
+
? gpt
|
|
51
|
+
? "agents→assignments/urgent action≠default peer knowledge bus."
|
|
52
|
+
: "Use agents for assignments and urgent action, not as the default peer knowledge relay."
|
|
53
|
+
: "",
|
|
54
|
+
]
|
|
55
|
+
.filter(Boolean)
|
|
56
|
+
.join(" ");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function registerCommunicationGuidance(
|
|
60
|
+
pi: ExtensionAPI,
|
|
61
|
+
notes?: CommsFeature,
|
|
62
|
+
board?: CommsFeature,
|
|
63
|
+
): void {
|
|
64
|
+
const owner =
|
|
65
|
+
notes && board
|
|
66
|
+
? "agent-comms-routing"
|
|
67
|
+
: notes
|
|
68
|
+
? "notes-routing"
|
|
69
|
+
: "board-routing";
|
|
70
|
+
registerContextBriefing(
|
|
71
|
+
pi,
|
|
72
|
+
"communication",
|
|
73
|
+
(ctx) => Boolean(notes?.enabled(ctx) || board?.enabled(ctx)),
|
|
74
|
+
async (ctx, windowId, messages) => {
|
|
75
|
+
// Feature owners supply enablement independently of provider declarations.
|
|
76
|
+
// Shepherdr keeps agents active, including as a nested Code/Notebook tool.
|
|
77
|
+
const capabilities = [
|
|
78
|
+
notes?.enabled(ctx) ?? false,
|
|
79
|
+
board?.enabled(ctx) ?? false,
|
|
80
|
+
pi.getActiveTools().includes("agents"),
|
|
81
|
+
Boolean(notes?.gptPromptMode() || board?.gptPromptMode()),
|
|
82
|
+
] as const;
|
|
83
|
+
const routing = communicationGuidance(...capabilities);
|
|
84
|
+
const previous = messages
|
|
85
|
+
?.flatMap((message) => {
|
|
86
|
+
if (
|
|
87
|
+
message.role !== "custom" ||
|
|
88
|
+
message.customType !== "codex-context-briefing"
|
|
89
|
+
)
|
|
90
|
+
return [];
|
|
91
|
+
const details = message.details;
|
|
92
|
+
return details &&
|
|
93
|
+
typeof details === "object" &&
|
|
94
|
+
"owner" in details &&
|
|
95
|
+
details.owner === owner &&
|
|
96
|
+
"id" in details &&
|
|
97
|
+
typeof details.id === "string"
|
|
98
|
+
? [{ id: details.id, content: message.content }]
|
|
99
|
+
: [];
|
|
100
|
+
})
|
|
101
|
+
.at(-1);
|
|
102
|
+
if (!routing && !previous) return;
|
|
103
|
+
const content =
|
|
104
|
+
routing ||
|
|
105
|
+
`${notes && board ? "Notes and Board are" : notes ? "Notes is" : "Board is"} currently inactive. Earlier communication routing no longer applies.`;
|
|
106
|
+
if (previous?.content === content) return;
|
|
107
|
+
await recordContextBriefing(
|
|
108
|
+
pi,
|
|
109
|
+
ctx,
|
|
110
|
+
owner,
|
|
111
|
+
JSON.stringify([
|
|
112
|
+
ctx.sessionManager.getSessionId(),
|
|
113
|
+
contextBriefingWindow(ctx, windowId),
|
|
114
|
+
...capabilities,
|
|
115
|
+
previous?.id,
|
|
116
|
+
]),
|
|
117
|
+
async () => content,
|
|
118
|
+
);
|
|
119
|
+
},
|
|
120
|
+
);
|
|
121
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
|
|
3
|
+
export type SettingsTab = "notes" | "board";
|
|
4
|
+
export type OpenSettings = (
|
|
5
|
+
ctx: ExtensionCommandContext,
|
|
6
|
+
tab: SettingsTab,
|
|
7
|
+
) => Promise<void>;
|
|
8
|
+
|
|
9
|
+
export interface FeatureSettings {
|
|
10
|
+
openSettings(ctx: ExtensionCommandContext): Promise<SettingsTab | undefined>;
|
|
11
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"allowJs": true,
|
|
5
|
+
"checkJs": true,
|
|
6
|
+
"allowImportingTsExtensions": true
|
|
7
|
+
},
|
|
8
|
+
"include": ["*.ts", "src/**/*.ts", "src/**/*.mjs"]
|
|
5
9
|
}
|
package/src/briefing.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export function boardBriefing(
|
|
2
|
-
member: boolean,
|
|
3
|
-
population: "empty" | "populated" | "unavailable",
|
|
4
|
-
gpt = false,
|
|
5
|
-
) {
|
|
6
|
-
const state =
|
|
7
|
-
population === "populated"
|
|
8
|
-
? "Read relevant board threads."
|
|
9
|
-
: population === "empty"
|
|
10
|
-
? gpt
|
|
11
|
-
? "Shared board available; posts=none."
|
|
12
|
-
: "Shared board available; no posts yet."
|
|
13
|
-
: gpt
|
|
14
|
-
? "Shared board status unavailable; board help→retry read when available."
|
|
15
|
-
: "Shared board status unavailable. Check board help and retry reading when available.";
|
|
16
|
-
return [
|
|
17
|
-
state,
|
|
18
|
-
member
|
|
19
|
-
? gpt
|
|
20
|
-
? "Root owns setup; follow assigned task."
|
|
21
|
-
: "The root agent owns setup; follow your assigned task."
|
|
22
|
-
: "",
|
|
23
|
-
gpt
|
|
24
|
-
? "Posts=work-changing ownership/decisions/findings/blockers only. Existing thread replies; link≠repeat. Personal checkpoints→notes. No ack/status spam/duplicate completion reports."
|
|
25
|
-
: "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.",
|
|
26
|
-
gpt
|
|
27
|
-
? "Channels=workstreams; threads=topics. Reuse relevant channels≠catchalls. New channel requires distinct coordination purpose; never task/result announcement only."
|
|
28
|
-
: "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.",
|
|
29
|
-
]
|
|
30
|
-
.filter(Boolean)
|
|
31
|
-
.join(" ");
|
|
32
|
-
}
|
package/src/protocol.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { type Static, Type } from "typebox";
|
|
2
|
-
import { Check } from "typebox/value";
|
|
3
|
-
import { BindingSchema } from "./identity.js";
|
|
4
|
-
|
|
5
|
-
const NoticeSchema = Type.Object(
|
|
6
|
-
{
|
|
7
|
-
message_id: Type.String(),
|
|
8
|
-
channel_name: Type.String(),
|
|
9
|
-
author: Type.String(),
|
|
10
|
-
thread_id: Type.String(),
|
|
11
|
-
created_at: Type.String(),
|
|
12
|
-
text_preview: Type.String({ maxLength: 300 }),
|
|
13
|
-
n_chars: Type.Integer({ minimum: 0 }),
|
|
14
|
-
truncated: Type.Boolean(),
|
|
15
|
-
},
|
|
16
|
-
{ additionalProperties: false },
|
|
17
|
-
);
|
|
18
|
-
const Protocol = Type.Union([
|
|
19
|
-
Type.Object({
|
|
20
|
-
operation: Type.Literal("board-catchup"),
|
|
21
|
-
caller: BindingSchema,
|
|
22
|
-
seen: Type.Array(Type.String()),
|
|
23
|
-
}),
|
|
24
|
-
Type.Object({
|
|
25
|
-
operation: Type.Literal("board-bind"),
|
|
26
|
-
binding: BindingSchema,
|
|
27
|
-
}),
|
|
28
|
-
Type.Object({
|
|
29
|
-
operation: Type.Literal("board-register"),
|
|
30
|
-
caller: BindingSchema,
|
|
31
|
-
member: BindingSchema,
|
|
32
|
-
}),
|
|
33
|
-
Type.Object({
|
|
34
|
-
operation: Type.Literal("board-unregister"),
|
|
35
|
-
caller: BindingSchema,
|
|
36
|
-
member: BindingSchema,
|
|
37
|
-
}),
|
|
38
|
-
Type.Object({
|
|
39
|
-
operation: Type.Literal("board-enabled"),
|
|
40
|
-
boardId: Type.String(),
|
|
41
|
-
enabled: Type.Boolean(),
|
|
42
|
-
}),
|
|
43
|
-
Type.Object({
|
|
44
|
-
operation: Type.Literal("board-active"),
|
|
45
|
-
caller: BindingSchema,
|
|
46
|
-
turnId: Type.Union([Type.String(), Type.Null()]),
|
|
47
|
-
previousTurnId: Type.Optional(Type.String()),
|
|
48
|
-
}),
|
|
49
|
-
Type.Object({
|
|
50
|
-
operation: Type.Literal("board-call"),
|
|
51
|
-
caller: BindingSchema,
|
|
52
|
-
params: Type.Unknown(),
|
|
53
|
-
requestId: Type.String(),
|
|
54
|
-
}),
|
|
55
|
-
Type.Object({
|
|
56
|
-
operation: Type.Literal("board-notify"),
|
|
57
|
-
boardId: Type.String(),
|
|
58
|
-
target: Type.String(),
|
|
59
|
-
route: Type.Optional(Type.Array(Type.String())),
|
|
60
|
-
sessionId: Type.String(),
|
|
61
|
-
turnId: Type.String(),
|
|
62
|
-
notice: NoticeSchema,
|
|
63
|
-
}),
|
|
64
|
-
]);
|
|
65
|
-
export type BoardEnvelope = Static<typeof Protocol>;
|
|
66
|
-
export function parseEnvelope(value: unknown): BoardEnvelope {
|
|
67
|
-
if (!Check(Protocol, value)) throw new Error("Invalid board host request");
|
|
68
|
-
return value as BoardEnvelope;
|
|
69
|
-
}
|
|
70
|
-
export function isBoardEnvelope(value: unknown): boolean {
|
|
71
|
-
return (
|
|
72
|
-
!!value &&
|
|
73
|
-
typeof value === "object" &&
|
|
74
|
-
"operation" in value &&
|
|
75
|
-
typeof value.operation === "string" &&
|
|
76
|
-
value.operation.startsWith("board-")
|
|
77
|
-
);
|
|
78
|
-
}
|
package/src/runtime/index.ts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { registerBoardActivityRenderer } from "../activity.js";
|
|
3
|
-
import { initializeDelivery, isMissingOptionalModule } from "../delivery.js";
|
|
4
|
-
import { createBoardTool } from "../tool.js";
|
|
5
|
-
import { BoardRuntime } from "./coordinator.js";
|
|
6
|
-
|
|
7
|
-
export { BoardRuntime };
|
|
8
|
-
|
|
9
|
-
const CLAIM = "@howaboua/pi-agent-board.owner/v1";
|
|
10
|
-
const AVAILABLE = "@howaboua/pi-agent-board.available/v1";
|
|
11
|
-
interface OwnerClaim {
|
|
12
|
-
runtime: Promise<BoardRuntime>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/** Discover an explicitly loaded owner, including one loaded after this adapter. */
|
|
16
|
-
export function discoverBoard(
|
|
17
|
-
pi: ExtensionAPI,
|
|
18
|
-
attach: (runtime: BoardRuntime) => void,
|
|
19
|
-
) {
|
|
20
|
-
let attached = false;
|
|
21
|
-
const accept = (runtime: BoardRuntime) => {
|
|
22
|
-
if (attached) return;
|
|
23
|
-
attached = true;
|
|
24
|
-
attach(runtime);
|
|
25
|
-
};
|
|
26
|
-
const request = () =>
|
|
27
|
-
pi.events.emit(CLAIM, {
|
|
28
|
-
accept: (claim: OwnerClaim) => {
|
|
29
|
-
void claim.runtime.then(accept);
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
const stop = pi.events.on(AVAILABLE, request);
|
|
33
|
-
request();
|
|
34
|
-
pi.on("session_shutdown", stop);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Only the standalone extension creates and registers the board engine. */
|
|
38
|
-
export async function acquireBoard(pi: ExtensionAPI): Promise<BoardRuntime> {
|
|
39
|
-
let claim: OwnerClaim | undefined;
|
|
40
|
-
pi.events.emit(CLAIM, {
|
|
41
|
-
accept(value: OwnerClaim) {
|
|
42
|
-
claim = value;
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
if (!claim) {
|
|
46
|
-
const created: OwnerClaim = {
|
|
47
|
-
runtime: createRuntime(pi),
|
|
48
|
-
};
|
|
49
|
-
claim = created;
|
|
50
|
-
const stop = pi.events.on(CLAIM, (value) => {
|
|
51
|
-
if (
|
|
52
|
-
value &&
|
|
53
|
-
typeof value === "object" &&
|
|
54
|
-
"accept" in value &&
|
|
55
|
-
typeof value.accept === "function"
|
|
56
|
-
)
|
|
57
|
-
value.accept(created);
|
|
58
|
-
});
|
|
59
|
-
pi.on("session_shutdown", stop);
|
|
60
|
-
}
|
|
61
|
-
const runtime = await claim.runtime;
|
|
62
|
-
pi.events.emit(AVAILABLE, undefined);
|
|
63
|
-
return runtime;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async function createRuntime(pi: ExtensionAPI) {
|
|
67
|
-
await initializeDelivery();
|
|
68
|
-
const runtime = new BoardRuntime(pi);
|
|
69
|
-
const tool = createBoardTool(runtime);
|
|
70
|
-
pi.registerTool(tool);
|
|
71
|
-
try {
|
|
72
|
-
const { registerGptPromptMode, prepareGptPromptMode } = await import(
|
|
73
|
-
"@howaboua/pi-codex-conversion/prompt-mode"
|
|
74
|
-
);
|
|
75
|
-
runtime.setPromptModePreparation((ctx) => prepareGptPromptMode(pi, ctx));
|
|
76
|
-
registerGptPromptMode(pi, (active) => {
|
|
77
|
-
runtime.gptPromptMode = active;
|
|
78
|
-
return [tool];
|
|
79
|
-
});
|
|
80
|
-
} catch (error) {
|
|
81
|
-
if (!isMissingOptionalModule(error, "prompt-mode")) throw error;
|
|
82
|
-
}
|
|
83
|
-
registerBoardActivityRenderer(pi);
|
|
84
|
-
try {
|
|
85
|
-
const { adaptToolForCodeMode, registerCodeModeExtensionTools } =
|
|
86
|
-
await import("@howaboua/pi-codex-conversion/code-mode");
|
|
87
|
-
const registration = registerCodeModeExtensionTools(
|
|
88
|
-
pi,
|
|
89
|
-
() => [
|
|
90
|
-
adaptToolForCodeMode(tool, {
|
|
91
|
-
prepareInput: (input) =>
|
|
92
|
-
input === undefined || input === null ? {} : input,
|
|
93
|
-
discovery: "help",
|
|
94
|
-
}),
|
|
95
|
-
],
|
|
96
|
-
{ isActive: (ctx) => runtime.enabled(ctx) },
|
|
97
|
-
);
|
|
98
|
-
runtime.setToolRefresh(() => registration.refresh());
|
|
99
|
-
pi.on("session_shutdown", () => registration.unregister());
|
|
100
|
-
} catch (error) {
|
|
101
|
-
if (!isMissingOptionalModule(error, "code-mode")) throw error;
|
|
102
|
-
if (
|
|
103
|
-
error instanceof Error &&
|
|
104
|
-
"code" in error &&
|
|
105
|
-
error.code === "ERR_PACKAGE_PATH_NOT_EXPORTED"
|
|
106
|
-
)
|
|
107
|
-
throw new Error(
|
|
108
|
-
"Update Codex Conversion to use its Code and Notebook board tools",
|
|
109
|
-
{ cause: error },
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
return runtime;
|
|
113
|
-
}
|
package/src/settings/panel.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ExtensionAPI,
|
|
3
|
-
ExtensionContext,
|
|
4
|
-
} from "@earendil-works/pi-coding-agent";
|
|
5
|
-
import {
|
|
6
|
-
readBoardSummaryConfig,
|
|
7
|
-
resolveBoardSummaryModel,
|
|
8
|
-
writeBoardSummarySelection,
|
|
9
|
-
} from "../config.js";
|
|
10
|
-
import { requestBoardConsolidation } from "../consolidation.js";
|
|
11
|
-
import { binding } from "../identity.js";
|
|
12
|
-
import type { BoardRuntime } from "../runtime/coordinator.js";
|
|
13
|
-
|
|
14
|
-
export async function openBoardSettings(
|
|
15
|
-
pi: ExtensionAPI,
|
|
16
|
-
ctx: ExtensionContext,
|
|
17
|
-
board: BoardRuntime,
|
|
18
|
-
) {
|
|
19
|
-
if (!ctx.hasUI) {
|
|
20
|
-
ctx.ui.notify("Use /board settings in an interactive session", "warning");
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
if (binding(ctx).upstream)
|
|
25
|
-
throw new Error("Change Board settings in the owning root session");
|
|
26
|
-
const sessionId = ctx.sessionManager.getSessionId();
|
|
27
|
-
const consolidate =
|
|
28
|
-
"Consolidate one-off threads (sends a prompt to this session's agent)";
|
|
29
|
-
const setting = await ctx.ui.select("Board settings and actions", [
|
|
30
|
-
"Automatic summaries",
|
|
31
|
-
"Summary model",
|
|
32
|
-
consolidate,
|
|
33
|
-
]);
|
|
34
|
-
if (setting === consolidate) {
|
|
35
|
-
if (ctx.sessionManager.getSessionId() !== sessionId)
|
|
36
|
-
throw new Error("Session changed; reopen Board settings");
|
|
37
|
-
requestBoardConsolidation(pi, ctx);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (!setting) return;
|
|
41
|
-
const config = readBoardSummaryConfig(ctx.cwd);
|
|
42
|
-
if (setting === "Automatic summaries") {
|
|
43
|
-
const selected = await ctx.ui.select(
|
|
44
|
-
`Automatic summaries: ${config.automatic ? "on" : "off"}. Summarise on closure? Uses model quota.`,
|
|
45
|
-
["Off", "On"],
|
|
46
|
-
);
|
|
47
|
-
if (selected !== "Off" && selected !== "On") return;
|
|
48
|
-
board.setAutomaticSummaries(ctx, selected === "On");
|
|
49
|
-
ctx.ui.notify(
|
|
50
|
-
`Automatic board summaries: ${selected.toLowerCase()}.`,
|
|
51
|
-
"info",
|
|
52
|
-
);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (setting !== "Summary model") return;
|
|
56
|
-
const selected = await ctx.ui.select(
|
|
57
|
-
`Board summary model (global; current: ${config.selection === "luna" ? "Luna" : "Custom"})`,
|
|
58
|
-
["Luna", "Custom"],
|
|
59
|
-
);
|
|
60
|
-
if (selected !== "Luna" && selected !== "Custom") return;
|
|
61
|
-
writeBoardSummarySelection(
|
|
62
|
-
ctx.cwd,
|
|
63
|
-
selected === "Luna" ? "luna" : "custom",
|
|
64
|
-
);
|
|
65
|
-
try {
|
|
66
|
-
resolveBoardSummaryModel(ctx.cwd);
|
|
67
|
-
} catch (error) {
|
|
68
|
-
ctx.ui.notify(
|
|
69
|
-
`Custom selected. ${error instanceof Error ? error.message : String(error)}`,
|
|
70
|
-
"warning",
|
|
71
|
-
);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
ctx.ui.notify(
|
|
75
|
-
selected === "Custom"
|
|
76
|
-
? `Board summary model: Custom. Edit board.summary.custom in ${config.path}: set provider, model and reasoning.`
|
|
77
|
-
: "Board summary model: Luna (high).",
|
|
78
|
-
"info",
|
|
79
|
-
);
|
|
80
|
-
} catch (error) {
|
|
81
|
-
ctx.ui.notify(
|
|
82
|
-
error instanceof Error ? error.message : String(error),
|
|
83
|
-
"error",
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|