chapterhouse 0.4.3 → 0.5.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/agents/bellonda.agent.md +11 -0
- package/agents/hwi-noree.agent.md +12 -0
- package/dist/api/server.js +39 -2
- package/dist/api/server.test.js +20 -0
- package/dist/api/turn-sse.integration.test.js +12 -0
- package/dist/copilot/agents.js +13 -2
- package/dist/copilot/agents.test.js +43 -1
- package/dist/copilot/orchestrator.js +132 -29
- package/dist/copilot/orchestrator.test.js +183 -12
- package/dist/copilot/session-manager.js +11 -2
- package/dist/copilot/session-manager.test.js +25 -0
- package/dist/copilot/tools.agent.test.js +52 -4
- package/dist/copilot/tools.js +82 -11
- package/dist/copilot/tools.memory.test.js +50 -1
- package/dist/memory/active-scope.js +9 -0
- package/dist/memory/index.js +1 -1
- package/dist/store/db.js +27 -1
- package/package.json +1 -1
- package/web/dist/assets/{index-D4-uRAi6.js → index-BfHqP3-C.js} +87 -87
- package/web/dist/assets/index-BfHqP3-C.js.map +1 -0
- package/web/dist/assets/index-_O6AoWOS.css +10 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-BTI_m0OE.css +0 -10
- package/web/dist/assets/index-D4-uRAi6.js.map +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
1
2
|
import { getDb } from "../store/db.js";
|
|
2
3
|
import { getScope, listScopes } from "./scopes.js";
|
|
3
4
|
const ACTIVE_SCOPE_KEY = "current_scope_slug";
|
|
5
|
+
const activeScopeOverride = new AsyncLocalStorage();
|
|
4
6
|
function setSetting(key, value) {
|
|
5
7
|
getDb().prepare(`
|
|
6
8
|
INSERT INTO mem_settings (key, value)
|
|
@@ -20,6 +22,10 @@ function clearSetting(key) {
|
|
|
20
22
|
getDb().prepare(`DELETE FROM mem_settings WHERE key = ?`).run(key);
|
|
21
23
|
}
|
|
22
24
|
export function getActiveScope() {
|
|
25
|
+
const override = activeScopeOverride.getStore();
|
|
26
|
+
if (override !== undefined) {
|
|
27
|
+
return override === null ? null : (getScope(override) ?? null);
|
|
28
|
+
}
|
|
23
29
|
const slug = getSetting(ACTIVE_SCOPE_KEY);
|
|
24
30
|
if (!slug)
|
|
25
31
|
return null;
|
|
@@ -30,6 +36,9 @@ export function getActiveScope() {
|
|
|
30
36
|
}
|
|
31
37
|
return scope;
|
|
32
38
|
}
|
|
39
|
+
export function withActiveScope(slug, fn) {
|
|
40
|
+
return activeScopeOverride.run(slug, fn);
|
|
41
|
+
}
|
|
33
42
|
export function setActiveScope(slug) {
|
|
34
43
|
if (slug === null) {
|
|
35
44
|
clearSetting(ACTIVE_SCOPE_KEY);
|
package/dist/memory/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { completeActionItem, dropActionItem, getActionItem, listActionItems, recordActionItem, snoozeActionItem, } from "./action-items.js";
|
|
2
|
-
export { getActiveScope, inferScopeFromText, setActiveScope } from "./active-scope.js";
|
|
2
|
+
export { getActiveScope, inferScopeFromText, setActiveScope, withActiveScope } from "./active-scope.js";
|
|
3
3
|
export { recordDecision, getDecision, listDecisions, supersedeDecision } from "./decisions.js";
|
|
4
4
|
export { getEntity, findEntityByName, listEntities, upsertEntity } from "./entities.js";
|
|
5
5
|
export { getHotTierEntries, renderHotTierForActiveScope, renderHotTierXML } from "./hot-tier.js";
|
package/dist/store/db.js
CHANGED
|
@@ -628,13 +628,39 @@ export function getDb() {
|
|
|
628
628
|
db.exec(`
|
|
629
629
|
CREATE TABLE IF NOT EXISTS copilot_sessions (
|
|
630
630
|
session_key TEXT PRIMARY KEY,
|
|
631
|
-
mode TEXT NOT NULL CHECK(mode IN ('default', 'project')),
|
|
631
|
+
mode TEXT NOT NULL CHECK(mode IN ('default', 'project', 'agent')),
|
|
632
632
|
project_root TEXT,
|
|
633
633
|
copilot_session_id TEXT NOT NULL,
|
|
634
634
|
model TEXT,
|
|
635
635
|
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
636
636
|
)
|
|
637
637
|
`);
|
|
638
|
+
try {
|
|
639
|
+
db.prepare(`
|
|
640
|
+
INSERT INTO copilot_sessions (session_key, mode, copilot_session_id)
|
|
641
|
+
VALUES ('__mode_probe__', 'agent', '__probe__')
|
|
642
|
+
`).run();
|
|
643
|
+
db.prepare(`DELETE FROM copilot_sessions WHERE session_key = '__mode_probe__'`).run();
|
|
644
|
+
}
|
|
645
|
+
catch {
|
|
646
|
+
db.exec(`ALTER TABLE copilot_sessions RENAME TO copilot_sessions_old`);
|
|
647
|
+
db.exec(`
|
|
648
|
+
CREATE TABLE copilot_sessions (
|
|
649
|
+
session_key TEXT PRIMARY KEY,
|
|
650
|
+
mode TEXT NOT NULL CHECK(mode IN ('default', 'project', 'agent')),
|
|
651
|
+
project_root TEXT,
|
|
652
|
+
copilot_session_id TEXT NOT NULL,
|
|
653
|
+
model TEXT,
|
|
654
|
+
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
655
|
+
)
|
|
656
|
+
`);
|
|
657
|
+
db.exec(`
|
|
658
|
+
INSERT INTO copilot_sessions (session_key, mode, project_root, copilot_session_id, model, updated_at)
|
|
659
|
+
SELECT session_key, mode, project_root, copilot_session_id, model, updated_at
|
|
660
|
+
FROM copilot_sessions_old
|
|
661
|
+
`);
|
|
662
|
+
db.exec(`DROP TABLE copilot_sessions_old`);
|
|
663
|
+
}
|
|
638
664
|
// Migrate: add metadata columns to conversation_log if not present
|
|
639
665
|
const convCols = db.prepare(`PRAGMA table_info(conversation_log)`).all();
|
|
640
666
|
if (!convCols.some((c) => c.name === 'session_key')) {
|
package/package.json
CHANGED