@howaboua/pi-agent-board 0.0.5 → 0.0.7
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 -0
- package/README.md +4 -2
- 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 +196 -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
|
+
gpt = false,
|
|
22
|
+
): string {
|
|
23
|
+
return [
|
|
24
|
+
board
|
|
25
|
+
? gpt
|
|
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."
|
|
28
|
+
: "",
|
|
29
|
+
notes
|
|
30
|
+
? [
|
|
31
|
+
gpt
|
|
32
|
+
? "Notes writes don't wake peers."
|
|
33
|
+
: "Notes writes do not wake peers.",
|
|
34
|
+
board
|
|
35
|
+
? gpt
|
|
36
|
+
? "Notes→recovery; link Board evidence."
|
|
37
|
+
: "Notes holds recovery checkpoints; link Board evidence."
|
|
38
|
+
: "",
|
|
39
|
+
gpt
|
|
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.",
|
|
42
|
+
]
|
|
43
|
+
.filter(Boolean)
|
|
44
|
+
.join(" ")
|
|
45
|
+
: "",
|
|
46
|
+
notes || board
|
|
47
|
+
? gpt
|
|
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.`
|
|
50
|
+
: "",
|
|
51
|
+
notes || board
|
|
52
|
+
? gpt
|
|
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."
|
|
55
|
+
: "",
|
|
56
|
+
]
|
|
57
|
+
.filter(Boolean)
|
|
58
|
+
.join(" ");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function registerCommunicationGuidance(
|
|
62
|
+
pi: ExtensionAPI,
|
|
63
|
+
notes?: CommsFeature,
|
|
64
|
+
board?: CommsFeature,
|
|
65
|
+
): void {
|
|
66
|
+
const owner =
|
|
67
|
+
notes && board
|
|
68
|
+
? "agent-comms-routing"
|
|
69
|
+
: notes
|
|
70
|
+
? "notes-routing"
|
|
71
|
+
: "board-routing";
|
|
72
|
+
registerContextBriefing(
|
|
73
|
+
pi,
|
|
74
|
+
"communication",
|
|
75
|
+
(ctx) => Boolean(notes?.enabled(ctx) || board?.enabled(ctx)),
|
|
76
|
+
async (ctx, windowId, messages) => {
|
|
77
|
+
// Feature owners supply enablement independently of provider declarations.
|
|
78
|
+
const capabilities = [
|
|
79
|
+
notes?.enabled(ctx) ?? false,
|
|
80
|
+
board?.enabled(ctx) ?? false,
|
|
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
|