ai-advisory-board 0.11.0 → 0.12.0
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 +17 -0
- package/dist/bin/aab.js +105 -44
- package/dist/bin/aab.js.map +1 -1
- package/gui/app.js +153 -42
- package/gui/style.css +43 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# CHANGELOG — AI Advisory Board CLI
|
|
2
2
|
|
|
3
|
+
## 0.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f1b1edc: Decision Coach × Business Wiki: the **📚 wiki badge now explains itself**.
|
|
8
|
+
|
|
9
|
+
- **Sources used** — the badge expands ("📚 wiki · N sources ▸") to list exactly which wiki pages the coach read for that reply (each links to the Knowledge view), plus what it searched for. Captured per turn as `DecisionMessage.wikiUsage`.
|
|
10
|
+
- **Added to your wiki** — when your message is ingested back into the wiki, the user turn shows a **📥 Added to your wiki (N)** note listing the new/updated pages (or "nothing new to add"). Captured as `DecisionMessage.wikiIngest` and streamed live via a new `coach_wiki_ingested` event.
|
|
11
|
+
|
|
12
|
+
## 0.11.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- f462786: Decision Coach × Business Wiki: make the **"📚 Use Business Wiki" toggle directly available** — no Settings step.
|
|
17
|
+
|
|
18
|
+
The toggle now appears right in the **New Coach Session modal** (start a session with the wiki already wired) and in the **composer** (flip it any turn). The previous `knowledgeWiki.exposeToCoach` global opt-in has been removed — the per-session toggle is the sole control, default OFF per session. `aab coach --wiki` / `aab coach send … --wiki` just set the session flag (no opt-in to enable first).
|
|
19
|
+
|
|
3
20
|
## 0.11.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/dist/bin/aab.js
CHANGED
|
@@ -1875,7 +1875,6 @@ var DEFAULT_KNOWLEDGE_WIKI_SETTINGS = {
|
|
|
1875
1875
|
summarySoftCap: 200,
|
|
1876
1876
|
exposeToMemberAgents: true,
|
|
1877
1877
|
exposeToOrchestrator: true,
|
|
1878
|
-
exposeToCoach: false,
|
|
1879
1878
|
recommendFoam: true,
|
|
1880
1879
|
slugMapInIndex: true,
|
|
1881
1880
|
maxAliasesGlobal: 100,
|
|
@@ -4251,7 +4250,7 @@ function createIngestQueue(runner = ingestUserFacts) {
|
|
|
4251
4250
|
const batch = state.pending.splice(0, state.pending.length);
|
|
4252
4251
|
for (const group of coalesce(batch)) {
|
|
4253
4252
|
try {
|
|
4254
|
-
await runner({
|
|
4253
|
+
const result = await runner({
|
|
4255
4254
|
text: group.text,
|
|
4256
4255
|
kind: group.kind,
|
|
4257
4256
|
workspace: group.workspace,
|
|
@@ -4260,8 +4259,20 @@ function createIngestQueue(runner = ingestUserFacts) {
|
|
|
4260
4259
|
sparringSessionId: group.sparringSessionId,
|
|
4261
4260
|
coachSessionId: group.coachSessionId
|
|
4262
4261
|
});
|
|
4262
|
+
if (group.onResult) {
|
|
4263
|
+
try {
|
|
4264
|
+
await group.onResult(result);
|
|
4265
|
+
} catch {
|
|
4266
|
+
}
|
|
4267
|
+
}
|
|
4263
4268
|
} catch (error) {
|
|
4264
4269
|
logger.warn("[ingest-queue] user-fact ingest failed (non-blocking):", error);
|
|
4270
|
+
if (group.onResult) {
|
|
4271
|
+
try {
|
|
4272
|
+
await group.onResult(null);
|
|
4273
|
+
} catch {
|
|
4274
|
+
}
|
|
4275
|
+
}
|
|
4265
4276
|
}
|
|
4266
4277
|
}
|
|
4267
4278
|
}
|
|
@@ -4329,7 +4340,8 @@ function maybeEnqueueUserInput(opts) {
|
|
|
4329
4340
|
discussionId: opts.discussionId,
|
|
4330
4341
|
sparringSessionId: opts.sparringSessionId,
|
|
4331
4342
|
coachSessionId: opts.coachSessionId,
|
|
4332
|
-
eventId: opts.eventId
|
|
4343
|
+
eventId: opts.eventId,
|
|
4344
|
+
onResult: opts.onResult
|
|
4333
4345
|
});
|
|
4334
4346
|
} catch (error) {
|
|
4335
4347
|
logger.debug("[ingest-queue] enqueue failed (non-blocking):", error);
|
|
@@ -11289,13 +11301,25 @@ function makeCoachEventForwarder(passthrough, onTool) {
|
|
|
11289
11301
|
if (event.type === "assistant" && event.message?.content) {
|
|
11290
11302
|
for (const block of event.message.content) {
|
|
11291
11303
|
if (block.type === "tool_use" && typeof block.name === "string") {
|
|
11292
|
-
onTool(block.name.toLowerCase());
|
|
11304
|
+
onTool(block.name.toLowerCase(), block.input);
|
|
11293
11305
|
}
|
|
11294
11306
|
}
|
|
11295
11307
|
}
|
|
11296
11308
|
passthrough?.(event);
|
|
11297
11309
|
};
|
|
11298
11310
|
}
|
|
11311
|
+
function toWikiRelPath(input) {
|
|
11312
|
+
if (typeof input !== "string" || !input) return void 0;
|
|
11313
|
+
const posix = input.replace(/\\/g, "/");
|
|
11314
|
+
const idx = posix.toLowerCase().lastIndexOf("/wiki/");
|
|
11315
|
+
let rel = idx >= 0 ? posix.slice(idx + 1) : posix.startsWith("wiki/") ? posix : void 0;
|
|
11316
|
+
if (!rel) return void 0;
|
|
11317
|
+
const tail = rel.replace(/^wiki\//, "");
|
|
11318
|
+
if (tail === "index.md" || tail === "log.md" || tail === "KNOWLEDGE.md" || tail.startsWith(".aab/") || !tail.endsWith(".md")) {
|
|
11319
|
+
return void 0;
|
|
11320
|
+
}
|
|
11321
|
+
return rel;
|
|
11322
|
+
}
|
|
11299
11323
|
function renderPrincipleForPrompt(p) {
|
|
11300
11324
|
const lines = [`**${p.title}** (priority ${p.priority}/10, ${p.category})`];
|
|
11301
11325
|
lines.push(`Description: ${p.description}`);
|
|
@@ -11352,8 +11376,18 @@ ${transcript}
|
|
|
11352
11376
|
Respond now as the Decision Coach. Use markdown. Reference principles by their **Title**. Always end with a question or call to reflection.`;
|
|
11353
11377
|
const model = opts.model ?? settings.primaryModel ?? "sonnet";
|
|
11354
11378
|
let usedWiki = false;
|
|
11355
|
-
const
|
|
11356
|
-
|
|
11379
|
+
const sourcesRead = [];
|
|
11380
|
+
const queries = [];
|
|
11381
|
+
const onEvent = makeCoachEventForwarder(opts.onEvent, (tool, input) => {
|
|
11382
|
+
if (tool !== "read" && tool !== "grep" && tool !== "glob") return;
|
|
11383
|
+
usedWiki = true;
|
|
11384
|
+
if (tool === "read") {
|
|
11385
|
+
const rel = toWikiRelPath(input?.file_path);
|
|
11386
|
+
if (rel && !sourcesRead.includes(rel)) sourcesRead.push(rel);
|
|
11387
|
+
} else {
|
|
11388
|
+
const q = typeof input?.pattern === "string" ? input.pattern : void 0;
|
|
11389
|
+
if (q && !queries.includes(q)) queries.push(q);
|
|
11390
|
+
}
|
|
11357
11391
|
});
|
|
11358
11392
|
const allowedTools = useWiki ? ["WebSearch", "WebFetch", "Read", "Grep", "Glob"] : ["WebSearch", "WebFetch"];
|
|
11359
11393
|
const addDirs = useWiki && opts.workspaceRoot ? [opts.workspaceRoot] : void 0;
|
|
@@ -11399,6 +11433,7 @@ Respond now as the Decision Coach. Use markdown. Reference principles by their *
|
|
|
11399
11433
|
content: cleaned,
|
|
11400
11434
|
principlesReferenced: referenced.length > 0 ? referenced : void 0,
|
|
11401
11435
|
usedWiki: usedWiki || void 0,
|
|
11436
|
+
wikiUsage: sourcesRead.length > 0 || queries.length > 0 ? { sourcesRead, queries } : void 0,
|
|
11402
11437
|
createdAt: nowIso()
|
|
11403
11438
|
};
|
|
11404
11439
|
const newMessages = [...session.messages];
|
|
@@ -14795,10 +14830,25 @@ async function startUiServer(opts) {
|
|
|
14795
14830
|
sendError(res, 500, error);
|
|
14796
14831
|
}
|
|
14797
14832
|
});
|
|
14798
|
-
const coachWikiOpts = (session
|
|
14833
|
+
const coachWikiOpts = (session) => {
|
|
14799
14834
|
const root = opts.storage.getWorkspaceRoot();
|
|
14800
|
-
|
|
14801
|
-
|
|
14835
|
+
return { useWiki: !!session.useBusinessWiki, workspaceRoot: root, wikiDir: paths(root).wiki };
|
|
14836
|
+
};
|
|
14837
|
+
const recordCoachWikiIngest = async (storage, sessionId, messageId, result) => {
|
|
14838
|
+
if (!messageId) return null;
|
|
14839
|
+
const r = result ?? {};
|
|
14840
|
+
const ingest = {
|
|
14841
|
+
producedPages: Array.isArray(r.producedPages) ? r.producedPages : [],
|
|
14842
|
+
updatedPages: Array.isArray(r.updatedPages) ? r.updatedPages : [],
|
|
14843
|
+
notes: typeof r.notes === "string" ? r.notes : void 0
|
|
14844
|
+
};
|
|
14845
|
+
const session = await storage.loadDecisionSessionById(sessionId);
|
|
14846
|
+
if (!session) return null;
|
|
14847
|
+
const msg = session.messages.find((m) => m.id === messageId);
|
|
14848
|
+
if (!msg) return null;
|
|
14849
|
+
msg.wikiIngest = ingest;
|
|
14850
|
+
await storage.updateDecisionSession({ ...session, updatedAt: nowIso() });
|
|
14851
|
+
return ingest;
|
|
14802
14852
|
};
|
|
14803
14853
|
app.get("/api/coach/sessions", async (_req, res) => {
|
|
14804
14854
|
try {
|
|
@@ -14872,7 +14922,7 @@ async function startUiServer(opts) {
|
|
|
14872
14922
|
const settings = await opts.storage.loadSettings();
|
|
14873
14923
|
const principles = await opts.storage.loadPrinciples();
|
|
14874
14924
|
broadcast({ type: "coach_thinking", sessionId: session.id });
|
|
14875
|
-
const { session: updated, reply } = await coachReply(session, principles, "", settings, coachWikiOpts(session
|
|
14925
|
+
const { session: updated, reply } = await coachReply(session, principles, "", settings, coachWikiOpts(session));
|
|
14876
14926
|
await opts.storage.updateDecisionSession(updated);
|
|
14877
14927
|
broadcast({ type: "coach_message", sessionId: updated.id, message: reply, session: updated });
|
|
14878
14928
|
} catch (error) {
|
|
@@ -14915,16 +14965,27 @@ async function startUiServer(opts) {
|
|
|
14915
14965
|
const settings = await opts.storage.loadSettings();
|
|
14916
14966
|
const principles = await opts.storage.loadPrinciples();
|
|
14917
14967
|
const content = body.content.trim();
|
|
14918
|
-
const { session: updated, reply } = await coachReply(session, principles, content, settings, coachWikiOpts(session
|
|
14968
|
+
const { session: updated, reply } = await coachReply(session, principles, content, settings, coachWikiOpts(session));
|
|
14919
14969
|
await opts.storage.updateDecisionSession(updated);
|
|
14920
14970
|
broadcast({ type: "coach_message", sessionId: updated.id, message: reply, session: updated });
|
|
14921
|
-
if (updated.useBusinessWiki
|
|
14971
|
+
if (updated.useBusinessWiki) {
|
|
14972
|
+
const userMsg = [...updated.messages].reverse().find((m) => m.role === "user");
|
|
14922
14973
|
maybeEnqueueUserInput({
|
|
14923
14974
|
text: content,
|
|
14924
14975
|
kind: "coach_message",
|
|
14925
14976
|
settings,
|
|
14926
14977
|
storage: opts.storage,
|
|
14927
|
-
coachSessionId: updated.id
|
|
14978
|
+
coachSessionId: updated.id,
|
|
14979
|
+
onResult: async (result) => {
|
|
14980
|
+
try {
|
|
14981
|
+
const ingest = await recordCoachWikiIngest(opts.storage, updated.id, userMsg?.id, result);
|
|
14982
|
+
if (ingest) {
|
|
14983
|
+
broadcast({ type: "coach_wiki_ingested", sessionId: updated.id, messageId: userMsg?.id, wikiIngest: ingest });
|
|
14984
|
+
}
|
|
14985
|
+
} catch (err) {
|
|
14986
|
+
logger.debug("[coach] record wiki ingest failed (non-blocking):", err);
|
|
14987
|
+
}
|
|
14988
|
+
}
|
|
14928
14989
|
});
|
|
14929
14990
|
}
|
|
14930
14991
|
} catch (error) {
|
|
@@ -18636,14 +18697,11 @@ function registerCoachCommand(program) {
|
|
|
18636
18697
|
`);
|
|
18637
18698
|
}
|
|
18638
18699
|
const settings = await ctx.storage.loadSettings();
|
|
18639
|
-
if (opts.wiki) {
|
|
18640
|
-
|
|
18641
|
-
|
|
18642
|
-
session.useBusinessWiki = true;
|
|
18643
|
-
await ctx.storage.updateDecisionSession(session);
|
|
18644
|
-
}
|
|
18700
|
+
if (opts.wiki && !session.useBusinessWiki) {
|
|
18701
|
+
session.useBusinessWiki = true;
|
|
18702
|
+
await ctx.storage.updateDecisionSession(session);
|
|
18645
18703
|
}
|
|
18646
|
-
if (session.useBusinessWiki
|
|
18704
|
+
if (session.useBusinessWiki) {
|
|
18647
18705
|
process.stdout.write(c.hint("\u{1F4DA} Business Wiki is ON for this session.\n"));
|
|
18648
18706
|
}
|
|
18649
18707
|
const principles = await ctx.storage.loadPrinciples();
|
|
@@ -18662,7 +18720,7 @@ function registerCoachCommand(program) {
|
|
|
18662
18720
|
principles,
|
|
18663
18721
|
"",
|
|
18664
18722
|
settings,
|
|
18665
|
-
coachWikiRunOpts(session,
|
|
18723
|
+
coachWikiRunOpts(session, ctx.workspace.root)
|
|
18666
18724
|
);
|
|
18667
18725
|
sp.stop();
|
|
18668
18726
|
session = updated;
|
|
@@ -18690,7 +18748,7 @@ function registerCoachCommand(program) {
|
|
|
18690
18748
|
principles,
|
|
18691
18749
|
trimmed,
|
|
18692
18750
|
settings,
|
|
18693
|
-
coachWikiRunOpts(session,
|
|
18751
|
+
coachWikiRunOpts(session, ctx.workspace.root)
|
|
18694
18752
|
);
|
|
18695
18753
|
sp.stop();
|
|
18696
18754
|
session = updated;
|
|
@@ -18719,7 +18777,6 @@ function registerCoachCommand(program) {
|
|
|
18719
18777
|
}
|
|
18720
18778
|
const settings = await ctx.storage.loadSettings();
|
|
18721
18779
|
if (sendOpts.wiki) {
|
|
18722
|
-
assertWikiOptIn(settings);
|
|
18723
18780
|
session = { ...session, useBusinessWiki: true };
|
|
18724
18781
|
}
|
|
18725
18782
|
const principles = await ctx.storage.loadPrinciples();
|
|
@@ -18728,7 +18785,7 @@ function registerCoachCommand(program) {
|
|
|
18728
18785
|
principles,
|
|
18729
18786
|
message,
|
|
18730
18787
|
settings,
|
|
18731
|
-
coachWikiRunOpts(session,
|
|
18788
|
+
coachWikiRunOpts(session, ctx.workspace.root)
|
|
18732
18789
|
);
|
|
18733
18790
|
await ctx.storage.updateDecisionSession(updated);
|
|
18734
18791
|
fireCoachIngest(updated, settings, ctx.storage, message);
|
|
@@ -18846,28 +18903,32 @@ ${c.bold(session.title ?? "Decision session")} ${c.hint("\xB7 " + session.id.sli
|
|
|
18846
18903
|
}
|
|
18847
18904
|
});
|
|
18848
18905
|
}
|
|
18849
|
-
function coachWikiRunOpts(session,
|
|
18850
|
-
|
|
18851
|
-
return { useWiki, workspaceRoot: root, wikiDir: paths(root).wiki };
|
|
18852
|
-
}
|
|
18853
|
-
function assertWikiOptIn(settings) {
|
|
18854
|
-
if (settings.knowledgeWiki?.exposeToCoach !== true) {
|
|
18855
|
-
throw new UserError(
|
|
18856
|
-
"The Business Wiki is not enabled for the Decision Coach.",
|
|
18857
|
-
"Enable it first: set `knowledgeWiki.exposeToCoach` to true (Settings in the web UI, or edit the workspace settings.json), then retry with --wiki."
|
|
18858
|
-
);
|
|
18859
|
-
}
|
|
18906
|
+
function coachWikiRunOpts(session, root) {
|
|
18907
|
+
return { useWiki: !!session.useBusinessWiki, workspaceRoot: root, wikiDir: paths(root).wiki };
|
|
18860
18908
|
}
|
|
18861
18909
|
function fireCoachIngest(session, settings, storage, text) {
|
|
18862
|
-
if (session.useBusinessWiki
|
|
18863
|
-
|
|
18864
|
-
|
|
18865
|
-
|
|
18866
|
-
|
|
18867
|
-
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
|
|
18910
|
+
if (!session.useBusinessWiki) return;
|
|
18911
|
+
const userMsg = [...session.messages].reverse().find((m) => m.role === "user");
|
|
18912
|
+
maybeEnqueueUserInput({
|
|
18913
|
+
text,
|
|
18914
|
+
kind: "coach_message",
|
|
18915
|
+
settings,
|
|
18916
|
+
storage,
|
|
18917
|
+
coachSessionId: session.id,
|
|
18918
|
+
onResult: async (result) => {
|
|
18919
|
+
if (!userMsg) return;
|
|
18920
|
+
const r = result ?? {};
|
|
18921
|
+
const fresh = await storage.loadDecisionSessionById(session.id);
|
|
18922
|
+
const msg = fresh?.messages.find((m) => m.id === userMsg.id);
|
|
18923
|
+
if (!fresh || !msg) return;
|
|
18924
|
+
msg.wikiIngest = {
|
|
18925
|
+
producedPages: Array.isArray(r.producedPages) ? r.producedPages : [],
|
|
18926
|
+
updatedPages: Array.isArray(r.updatedPages) ? r.updatedPages : [],
|
|
18927
|
+
notes: typeof r.notes === "string" ? r.notes : void 0
|
|
18928
|
+
};
|
|
18929
|
+
await storage.updateDecisionSession({ ...fresh, updatedAt: nowIso() });
|
|
18930
|
+
}
|
|
18931
|
+
});
|
|
18871
18932
|
}
|
|
18872
18933
|
function renderMessage(role, content) {
|
|
18873
18934
|
if (role === "user") {
|