chapterhouse 0.3.6 → 0.3.8
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/dist/api/ralph.js +153 -0
- package/dist/api/ralph.test.js +101 -0
- package/dist/api/server.js +76 -1
- package/dist/copilot/agents.js +6 -1
- package/dist/copilot/hooks.js +157 -0
- package/dist/copilot/hooks.test.js +315 -0
- package/dist/copilot/orchestrator.js +61 -26
- package/dist/copilot/session-manager.js +3 -0
- package/dist/copilot/session-manager.test.js +70 -0
- package/dist/copilot/squad-event-bus.js +27 -0
- package/dist/copilot/tools.js +2 -0
- package/dist/daemon.js +9 -0
- package/dist/squad/charter.js +18 -1
- package/dist/squad/discovery.js +31 -43
- package/package.json +1 -1
- package/web/dist/assets/{index-Dp72-ITT.js → index-0dDxvEWK.js} +82 -79
- package/web/dist/assets/index-0dDxvEWK.js.map +1 -0
- package/web/dist/assets/index-26ooi9MH.css +10 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-C6ZKr0jC.css +0 -10
- package/web/dist/assets/index-Dp72-ITT.js.map +0 -1
package/dist/squad/charter.js
CHANGED
|
@@ -80,7 +80,16 @@ export async function getSquadCoordinatorSystemMessage(projectRoot) {
|
|
|
80
80
|
const teamContent = existsSync(teamMdPath)
|
|
81
81
|
? readFileSync(teamMdPath, 'utf-8')
|
|
82
82
|
: '(not found — create .squad/team.md to provide project charter context)';
|
|
83
|
-
// 3.
|
|
83
|
+
// 3. Identity files — what the team is focused on and what patterns we use
|
|
84
|
+
const nowMdPath = `${projectRoot}/.squad/identity/now.md`;
|
|
85
|
+
const nowContent = existsSync(nowMdPath)
|
|
86
|
+
? readFileSync(nowMdPath, 'utf-8')
|
|
87
|
+
: '(not found — create .squad/identity/now.md to share current focus)';
|
|
88
|
+
const wisdomMdPath = `${projectRoot}/.squad/identity/wisdom.md`;
|
|
89
|
+
const wisdomContent = existsSync(wisdomMdPath)
|
|
90
|
+
? readFileSync(wisdomMdPath, 'utf-8')
|
|
91
|
+
: '(not found — create .squad/identity/wisdom.md to capture team patterns)';
|
|
92
|
+
// 4. Recent decisions — last ~4000 chars
|
|
84
93
|
const decisionsMdPath = `${projectRoot}/.squad/decisions.md`;
|
|
85
94
|
let decisionsContent = '(no decisions recorded yet)';
|
|
86
95
|
if (existsSync(decisionsMdPath)) {
|
|
@@ -100,6 +109,14 @@ export async function getSquadCoordinatorSystemMessage(projectRoot) {
|
|
|
100
109
|
'',
|
|
101
110
|
teamContent,
|
|
102
111
|
'',
|
|
112
|
+
'## Team Current Focus (What We\'re Doing Now)',
|
|
113
|
+
'',
|
|
114
|
+
nowContent,
|
|
115
|
+
'',
|
|
116
|
+
'## Team Wisdom (Patterns & Lessons)',
|
|
117
|
+
'',
|
|
118
|
+
wisdomContent,
|
|
119
|
+
'',
|
|
103
120
|
'## Recent Decisions',
|
|
104
121
|
'',
|
|
105
122
|
decisionsContent,
|
package/dist/squad/discovery.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { existsSync
|
|
1
|
+
import { existsSync } from 'fs';
|
|
2
2
|
import { join } from 'path';
|
|
3
|
+
import { FSStorageProvider, SquadState, NotFoundError } from '@bradygaster/squad-sdk';
|
|
3
4
|
import { getDb } from '../store/db.js';
|
|
4
5
|
// ---------------------------------------------------------------------------
|
|
5
6
|
// DB schema — created lazily on first use
|
|
@@ -101,47 +102,38 @@ export async function resolveProjectSquad(projectPath) {
|
|
|
101
102
|
catch {
|
|
102
103
|
// SDK not available — use manual path resolution
|
|
103
104
|
}
|
|
104
|
-
// Enumerate agents from .squad/agents/
|
|
105
|
-
|
|
105
|
+
// Enumerate agents from .squad/agents/ via SDK AgentsCollection.
|
|
106
|
+
// FSStorageProvider wraps the same fs calls with typed returns and ENOENT safety.
|
|
106
107
|
const agents = [];
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
continue;
|
|
118
|
-
}
|
|
119
|
-
catch {
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
const charterPath = join(agentDir, 'charter.md');
|
|
123
|
-
if (!existsSync(charterPath))
|
|
124
|
-
continue;
|
|
125
|
-
let charterContent = '';
|
|
108
|
+
const stateRoot = resolvedSquadDir.endsWith('/.squad')
|
|
109
|
+
? resolvedSquadDir.slice(0, -'/.squad'.length)
|
|
110
|
+
: projectPath;
|
|
111
|
+
try {
|
|
112
|
+
const storage = new FSStorageProvider();
|
|
113
|
+
const state = SquadState.fromStorage(storage, stateRoot);
|
|
114
|
+
const agentNames = await state.agents.list();
|
|
115
|
+
for (const name of agentNames) {
|
|
116
|
+
const charterPath = join(resolvedSquadDir, 'agents', name, 'charter.md');
|
|
117
|
+
let charterContent;
|
|
126
118
|
try {
|
|
127
|
-
charterContent =
|
|
119
|
+
charterContent = await state.agents.get(name).charter();
|
|
128
120
|
}
|
|
129
|
-
catch {
|
|
121
|
+
catch (err) {
|
|
122
|
+
if (err instanceof NotFoundError)
|
|
123
|
+
continue; // no charter.md — not a valid agent
|
|
130
124
|
continue;
|
|
131
125
|
}
|
|
132
|
-
const slug = entry;
|
|
133
|
-
const role = extractRoleFromCharter(charterContent);
|
|
134
|
-
const description = extractDescriptionFromCharter(charterContent);
|
|
135
126
|
agents.push({
|
|
136
|
-
slug,
|
|
137
|
-
mention: `@${
|
|
138
|
-
role,
|
|
139
|
-
description,
|
|
127
|
+
slug: name,
|
|
128
|
+
mention: `@${name}`,
|
|
129
|
+
role: extractRoleFromCharter(charterContent),
|
|
130
|
+
description: extractDescriptionFromCharter(charterContent),
|
|
140
131
|
charterPath,
|
|
141
132
|
origin: 'project-squad',
|
|
142
133
|
});
|
|
143
134
|
}
|
|
144
135
|
}
|
|
136
|
+
catch { /* SDK unavailable — agents list stays empty */ }
|
|
145
137
|
// Load squad config via SDK with fallback to empty config
|
|
146
138
|
let squadConfig = {};
|
|
147
139
|
try {
|
|
@@ -228,25 +220,21 @@ export async function loadProjectSquad(projectPath) {
|
|
|
228
220
|
: undefined,
|
|
229
221
|
origin: 'project-squad',
|
|
230
222
|
}));
|
|
231
|
-
// Repo wins: re-sync any new agents that appeared since last cache
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
catch {
|
|
239
|
-
return false;
|
|
240
|
-
}
|
|
241
|
-
});
|
|
223
|
+
// Repo wins: re-sync any new agents that appeared since last cache.
|
|
224
|
+
// Use SDK AgentsCollection.list() so we stay consistent with resolveProjectSquad().
|
|
225
|
+
try {
|
|
226
|
+
const cacheStorage = new FSStorageProvider();
|
|
227
|
+
const cacheState = SquadState.fromStorage(cacheStorage, row.project_root);
|
|
228
|
+
const repoAgentNames = await cacheState.agents.list();
|
|
242
229
|
const cachedSlugs = new Set(agents.map(a => a.slug));
|
|
243
|
-
for (const slug of
|
|
230
|
+
for (const slug of repoAgentNames) {
|
|
244
231
|
if (!cachedSlugs.has(slug)) {
|
|
245
232
|
// New agent in repo not in cache — trigger full reload
|
|
246
233
|
return resolveProjectSquad(projectPath);
|
|
247
234
|
}
|
|
248
235
|
}
|
|
249
236
|
}
|
|
237
|
+
catch { /* SDK unavailable — skip new-agent check */ }
|
|
250
238
|
return {
|
|
251
239
|
projectRoot: row.project_root,
|
|
252
240
|
squadDir: row.squad_dir,
|
package/package.json
CHANGED