@bolloon/bolloon-agent 0.1.13 → 0.1.14
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/agents/pi-sdk.js +185 -0
- package/dist/agents/shell-guard.js +354 -0
- package/dist/agents/shell-tool.js +83 -0
- package/dist/agents/skill-loader.js +174 -0
- package/dist/bollharness-integration/context-chain-router.js +3 -3
- package/dist/bollharness-integration/context-router.js +1 -1
- package/dist/heartbeat/Watchdog.js +7 -5
- package/dist/heartbeat/index.js +1 -0
- package/dist/heartbeat/self-improve-bus.js +85 -0
- package/dist/pi-ecosystem-judgment/index.js +1 -2
- package/dist/utils/auto-update.js +44 -12
- package/dist/web/client.js +839 -103
- package/dist/web/components/p2p/P2PModal.js +188 -0
- package/dist/web/components/p2p/index.js +264 -226
- package/dist/web/components/p2p/p2p-modal.js +657 -0
- package/dist/web/components/p2p/p2p-tools.js +248 -0
- package/dist/web/index.html +88 -8
- package/dist/web/server.js +2360 -0
- package/dist/web/style.css +506 -9
- package/package.json +2 -2
- package/scripts/build-cli.js +11 -1
- package/src/agents/pi-sdk.ts +196 -0
- package/src/agents/shell-guard.ts +417 -0
- package/src/agents/shell-tool.ts +103 -0
- package/src/agents/skill-loader.ts +202 -0
- package/src/bollharness-integration/context-chain-router.ts +3 -3
- package/src/bollharness-integration/context-router.ts +1 -1
- package/src/heartbeat/Watchdog.ts +7 -5
- package/src/heartbeat/index.ts +1 -0
- package/src/heartbeat/self-improve-bus.ts +110 -0
- package/src/types.d.ts +12 -0
- package/src/utils/auto-update.ts +45 -14
- package/src/web/client.js +839 -103
- package/src/web/index.html +88 -8
- package/src/web/server.ts +427 -101
- package/src/web/style.css +506 -9
- package/dist/bollharness-integration/bollharness-integration/context-router-judgment.d.ts +0 -48
- package/dist/bollharness-integration/bollharness-integration/context-router-judgment.js +0 -261
- package/dist/bollharness-integration/bollharness-integration/context-router.d.ts +0 -110
- package/dist/bollharness-integration/bollharness-integration/context-router.js +0 -542
- package/dist/bollharness-integration/bollharness-integration/gate-state-machine.d.ts +0 -87
- package/dist/bollharness-integration/bollharness-integration/gate-state-machine.js +0 -231
- package/dist/bollharness-integration/bollharness-integration/gate-transition-hooks.d.ts +0 -30
- package/dist/bollharness-integration/bollharness-integration/gate-transition-hooks.js +0 -91
- package/dist/bollharness-integration/bollharness-integration/guard-checker.d.ts +0 -105
- package/dist/bollharness-integration/bollharness-integration/guard-checker.js +0 -353
- package/dist/bollharness-integration/bollharness-integration/index.d.ts +0 -66
- package/dist/bollharness-integration/bollharness-integration/index.js +0 -32
- package/dist/bollharness-integration/bollharness-integration/integration.d.ts +0 -219
- package/dist/bollharness-integration/bollharness-integration/integration.js +0 -420
- package/dist/bollharness-integration/bollharness-integration/skill-adapter.d.ts +0 -151
- package/dist/bollharness-integration/bollharness-integration/skill-adapter.js +0 -518
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Guard Checker - Port of Bollharness checks to Bolloon guardrails
|
|
3
|
-
*
|
|
4
|
-
* Transforms bollharness's 15+ check functions into Bolloon's guardrail system.
|
|
5
|
-
*
|
|
6
|
-
* Key concepts:
|
|
7
|
-
* - Finding: bollharness's issue report structure
|
|
8
|
-
* - Guardrail: Bolloon's pre/post execution check interface
|
|
9
|
-
* - Guard Map: Path → Check[] routing
|
|
10
|
-
*/
|
|
11
|
-
import * as fs from 'fs';
|
|
12
|
-
/**
|
|
13
|
-
* Port of bollharness's Finding interface
|
|
14
|
-
*/
|
|
15
|
-
export function createFinding(params) {
|
|
16
|
-
return {
|
|
17
|
-
severity: params.severity,
|
|
18
|
-
message: params.message,
|
|
19
|
-
file: params.file,
|
|
20
|
-
line: params.line,
|
|
21
|
-
blocking: params.blocking ?? false,
|
|
22
|
-
category: params.category ?? 'general',
|
|
23
|
-
problem_class: params.problem_class ?? 'unknown',
|
|
24
|
-
required_skills: params.required_skills ?? [],
|
|
25
|
-
required_reads: params.required_reads ?? [],
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Guard Map - Maps file paths to relevant checks
|
|
30
|
-
* Adapted from bollharness's guard_router.ts
|
|
31
|
-
*/
|
|
32
|
-
export const GUARD_MAP = {
|
|
33
|
-
'src/agents/': ['check_api_types', 'check_skill_parity'],
|
|
34
|
-
'src/documents/': ['check_doc_freshness', 'check_api_types'],
|
|
35
|
-
'src/network/': ['check_api_types', 'check_versions'],
|
|
36
|
-
'src/constraints/': ['check_api_types', 'check_versions'],
|
|
37
|
-
'src/social/': ['check_api_types', 'check_versions'],
|
|
38
|
-
'docs/': ['check_doc_freshness', 'check_doc_links'],
|
|
39
|
-
'CLAUDE.md': ['check_doc_freshness', 'check_artifact_link'],
|
|
40
|
-
'README.md': ['check_doc_freshness'],
|
|
41
|
-
'docs/decisions/': ['check_artifact_link', 'check_versions'],
|
|
42
|
-
'.boll/': ['check_hook_installed'],
|
|
43
|
-
'src/test/': ['check_api_types', 'check_versions'],
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Default guards that run for all files
|
|
47
|
-
*/
|
|
48
|
-
export const DEFAULT_GUARDS = [];
|
|
49
|
-
/**
|
|
50
|
-
* Category to Skills mapping
|
|
51
|
-
* Maps guard categories to required bollharness skills
|
|
52
|
-
*/
|
|
53
|
-
export const CATEGORY_TO_SKILLS = {
|
|
54
|
-
closure_semantics: ['lead', 'harness-ops'],
|
|
55
|
-
contract_drift: ['harness-eng', 'harness-eng-test'],
|
|
56
|
-
bridge_boundary: ['harness-bridge', 'harness-ops'],
|
|
57
|
-
policy_freeze: ['lead', 'arch', 'plan-lock'],
|
|
58
|
-
doc_integrity: ['harness-ops'],
|
|
59
|
-
version_drift: ['harness-ops'],
|
|
60
|
-
artifact_linkage: ['lead'],
|
|
61
|
-
governance_bootstrap: ['harness-ops'],
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Check implementations - Ported from bollharness checks
|
|
65
|
-
*/
|
|
66
|
-
// Check: API Types
|
|
67
|
-
export function checkApiTypes(filePath) {
|
|
68
|
-
const findings = [];
|
|
69
|
-
// Check if API types are consistent
|
|
70
|
-
if (filePath.endsWith('.ts')) {
|
|
71
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
72
|
-
// Check for TODO/FIXME that might indicate type issues
|
|
73
|
-
const todoMatches = content.match(/\/\/\s*(TODO|FIXME|HACK|XXX):/g);
|
|
74
|
-
if (todoMatches) {
|
|
75
|
-
findings.push(createFinding({
|
|
76
|
-
severity: 'P2',
|
|
77
|
-
message: `Found ${todoMatches.length} development markers in code`,
|
|
78
|
-
file: filePath,
|
|
79
|
-
blocking: false,
|
|
80
|
-
category: 'doc_integrity',
|
|
81
|
-
problem_class: 'technical_debt',
|
|
82
|
-
required_skills: ['harness-eng'],
|
|
83
|
-
}));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return findings;
|
|
87
|
-
}
|
|
88
|
-
// Check: Document Freshness
|
|
89
|
-
export function checkDocFreshness(filePath) {
|
|
90
|
-
const findings = [];
|
|
91
|
-
if (filePath.endsWith('.md')) {
|
|
92
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
93
|
-
// Check for outdated markers
|
|
94
|
-
const outdatedMatches = content.match(/\[OUTDATED\]|\[DEPRECATED\]/gi);
|
|
95
|
-
if (outdatedMatches) {
|
|
96
|
-
findings.push(createFinding({
|
|
97
|
-
severity: 'P1',
|
|
98
|
-
message: 'Document contains outdated/deprecated markers',
|
|
99
|
-
file: filePath,
|
|
100
|
-
blocking: false,
|
|
101
|
-
category: 'doc_integrity',
|
|
102
|
-
problem_class: 'stale_content',
|
|
103
|
-
required_skills: ['harness-ops'],
|
|
104
|
-
}));
|
|
105
|
-
}
|
|
106
|
-
// Check for broken links (simplified)
|
|
107
|
-
const linkMatches = content.match(/\[([^\]]+)\]\(([^)]+)\)/g);
|
|
108
|
-
if (linkMatches) {
|
|
109
|
-
for (const link of linkMatches) {
|
|
110
|
-
const urlMatch = link.match(/\(([^)]+)\)/);
|
|
111
|
-
if (urlMatch && urlMatch[1].startsWith('http')) {
|
|
112
|
-
// External links need verification
|
|
113
|
-
findings.push(createFinding({
|
|
114
|
-
severity: 'P2',
|
|
115
|
-
message: `External link needs verification: ${urlMatch[1]}`,
|
|
116
|
-
file: filePath,
|
|
117
|
-
blocking: false,
|
|
118
|
-
category: 'doc_integrity',
|
|
119
|
-
problem_class: 'link_verification',
|
|
120
|
-
required_skills: [],
|
|
121
|
-
}));
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return findings;
|
|
127
|
-
}
|
|
128
|
-
// Check: Skill Parity
|
|
129
|
-
export function checkSkillParity(filePath) {
|
|
130
|
-
const findings = [];
|
|
131
|
-
// Check if skills are properly exported
|
|
132
|
-
if (filePath.includes('skills')) {
|
|
133
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
134
|
-
// Check for missing exports
|
|
135
|
-
if (!content.includes('export')) {
|
|
136
|
-
findings.push(createFinding({
|
|
137
|
-
severity: 'P2',
|
|
138
|
-
message: 'Skill file should export functions',
|
|
139
|
-
file: filePath,
|
|
140
|
-
blocking: false,
|
|
141
|
-
category: 'contract_drift',
|
|
142
|
-
problem_class: 'missing_export',
|
|
143
|
-
required_skills: ['harness-eng'],
|
|
144
|
-
}));
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return findings;
|
|
148
|
-
}
|
|
149
|
-
// Check: Versions
|
|
150
|
-
export function checkVersions(filePath) {
|
|
151
|
-
const findings = [];
|
|
152
|
-
if (filePath === 'package.json') {
|
|
153
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
154
|
-
try {
|
|
155
|
-
const pkg = JSON.parse(content);
|
|
156
|
-
// Check for version consistency
|
|
157
|
-
if (!pkg.version) {
|
|
158
|
-
findings.push(createFinding({
|
|
159
|
-
severity: 'P1',
|
|
160
|
-
message: 'package.json missing version field',
|
|
161
|
-
file: filePath,
|
|
162
|
-
blocking: true,
|
|
163
|
-
category: 'version_drift',
|
|
164
|
-
problem_class: 'missing_version',
|
|
165
|
-
required_skills: ['harness-ops'],
|
|
166
|
-
}));
|
|
167
|
-
}
|
|
168
|
-
// Check for missing dependencies
|
|
169
|
-
if (!pkg.dependencies || Object.keys(pkg.dependencies).length === 0) {
|
|
170
|
-
findings.push(createFinding({
|
|
171
|
-
severity: 'P2',
|
|
172
|
-
message: 'package.json has no dependencies',
|
|
173
|
-
file: filePath,
|
|
174
|
-
blocking: false,
|
|
175
|
-
category: 'version_drift',
|
|
176
|
-
problem_class: 'missing_deps',
|
|
177
|
-
required_skills: [],
|
|
178
|
-
}));
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
catch {
|
|
182
|
-
findings.push(createFinding({
|
|
183
|
-
severity: 'P0',
|
|
184
|
-
message: 'package.json is invalid JSON',
|
|
185
|
-
file: filePath,
|
|
186
|
-
blocking: true,
|
|
187
|
-
category: 'governance_bootstrap',
|
|
188
|
-
problem_class: 'parse_error',
|
|
189
|
-
required_skills: ['harness-ops'],
|
|
190
|
-
}));
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return findings;
|
|
194
|
-
}
|
|
195
|
-
// Check: Hook Installed
|
|
196
|
-
export function checkHookInstalled(filePath) {
|
|
197
|
-
const findings = [];
|
|
198
|
-
if (filePath.includes('.boll/settings')) {
|
|
199
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
200
|
-
// Check for required hooks
|
|
201
|
-
const requiredHooks = ['PostToolUse', 'PreToolUse', 'Stop', 'SessionEnd'];
|
|
202
|
-
for (const hook of requiredHooks) {
|
|
203
|
-
if (!content.includes(hook)) {
|
|
204
|
-
findings.push(createFinding({
|
|
205
|
-
severity: 'P1',
|
|
206
|
-
message: `Required hook ${hook} not found in settings`,
|
|
207
|
-
file: filePath,
|
|
208
|
-
blocking: false,
|
|
209
|
-
category: 'governance_bootstrap',
|
|
210
|
-
problem_class: 'missing_hook',
|
|
211
|
-
required_skills: ['harness-ops'],
|
|
212
|
-
}));
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
return findings;
|
|
217
|
-
}
|
|
218
|
-
// Check: Artifact Linkage
|
|
219
|
-
export function checkArtifactLink(filePath) {
|
|
220
|
-
const findings = [];
|
|
221
|
-
if (filePath.endsWith('.md') || filePath.includes('decisions')) {
|
|
222
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
223
|
-
// Check for ADR references
|
|
224
|
-
const adrMatches = content.match(/ADR-\d+/gi);
|
|
225
|
-
if (adrMatches && adrMatches.length > 5) {
|
|
226
|
-
findings.push(createFinding({
|
|
227
|
-
severity: 'P2',
|
|
228
|
-
message: `Found ${adrMatches.length} ADR references - verify all are linked`,
|
|
229
|
-
file: filePath,
|
|
230
|
-
blocking: false,
|
|
231
|
-
category: 'artifact_linkage',
|
|
232
|
-
problem_class: 'link_verification',
|
|
233
|
-
required_skills: ['lead'],
|
|
234
|
-
}));
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
return findings;
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* All available checks
|
|
241
|
-
*/
|
|
242
|
-
export const ALL_CHECKS = {
|
|
243
|
-
check_api_types: checkApiTypes,
|
|
244
|
-
check_doc_freshness: checkDocFreshness,
|
|
245
|
-
check_skill_parity: checkSkillParity,
|
|
246
|
-
check_versions: checkVersions,
|
|
247
|
-
check_hook_installed: checkHookInstalled,
|
|
248
|
-
check_artifact_link: checkArtifactLink,
|
|
249
|
-
};
|
|
250
|
-
/**
|
|
251
|
-
* Route file path to relevant checks
|
|
252
|
-
* Adapted from bollharness's route() function
|
|
253
|
-
*/
|
|
254
|
-
export function route(filePath) {
|
|
255
|
-
const matched = [];
|
|
256
|
-
const sortedPatterns = Object.keys(GUARD_MAP).sort((a, b) => b.length - a.length);
|
|
257
|
-
for (const pattern of sortedPatterns) {
|
|
258
|
-
if (filePath.startsWith(pattern) || filePath === pattern.replace(/\/$/, '')) {
|
|
259
|
-
matched.push(...GUARD_MAP[pattern]);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
if (matched.length === 0) {
|
|
263
|
-
return [...DEFAULT_GUARDS];
|
|
264
|
-
}
|
|
265
|
-
return [...new Set(matched)];
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Run guards for a file
|
|
269
|
-
*/
|
|
270
|
-
export async function runGuards(filePath) {
|
|
271
|
-
const guardNames = route(filePath);
|
|
272
|
-
const findings = [];
|
|
273
|
-
for (const name of guardNames) {
|
|
274
|
-
const checkFn = ALL_CHECKS[name];
|
|
275
|
-
if (checkFn) {
|
|
276
|
-
try {
|
|
277
|
-
const result = checkFn(filePath);
|
|
278
|
-
for (const finding of result) {
|
|
279
|
-
findings.push({
|
|
280
|
-
...finding,
|
|
281
|
-
checkName: name,
|
|
282
|
-
checkPath: filePath,
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
catch (error) {
|
|
287
|
-
findings.push({
|
|
288
|
-
severity: 'P0',
|
|
289
|
-
message: `Guard ${name} failed: ${error}`,
|
|
290
|
-
file: filePath,
|
|
291
|
-
blocking: true,
|
|
292
|
-
category: 'governance_bootstrap',
|
|
293
|
-
problem_class: 'guard_error',
|
|
294
|
-
required_skills: ['harness-ops'],
|
|
295
|
-
required_reads: [],
|
|
296
|
-
checkName: name,
|
|
297
|
-
checkPath: filePath,
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
const blockingCount = findings.filter(f => f.blocking).length;
|
|
303
|
-
const severities = findings.map(f => f.severity);
|
|
304
|
-
const severityOrder = { P0: 0, P1: 1, P2: 2 };
|
|
305
|
-
const highestSeverity = severities.length > 0
|
|
306
|
-
? severities.sort((a, b) => severityOrder[a] - severityOrder[b])[0]
|
|
307
|
-
: null;
|
|
308
|
-
return {
|
|
309
|
-
passed: blockingCount === 0,
|
|
310
|
-
findings,
|
|
311
|
-
blockingCount,
|
|
312
|
-
highestSeverity,
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* GuardChecker class for integration with Bolloon's constraint system
|
|
317
|
-
*/
|
|
318
|
-
export class GuardChecker {
|
|
319
|
-
checksDir;
|
|
320
|
-
enabledChecks;
|
|
321
|
-
constructor(checksDir) {
|
|
322
|
-
this.checksDir = checksDir || process.cwd();
|
|
323
|
-
this.enabledChecks = new Set(Object.keys(ALL_CHECKS));
|
|
324
|
-
}
|
|
325
|
-
enableCheck(name) {
|
|
326
|
-
this.enabledChecks.add(name);
|
|
327
|
-
}
|
|
328
|
-
disableCheck(name) {
|
|
329
|
-
this.enabledChecks.delete(name);
|
|
330
|
-
}
|
|
331
|
-
async check(filePath) {
|
|
332
|
-
const guardNames = route(filePath).filter(name => this.enabledChecks.has(name));
|
|
333
|
-
const findings = [];
|
|
334
|
-
for (const name of guardNames) {
|
|
335
|
-
const checkFn = ALL_CHECKS[name];
|
|
336
|
-
if (checkFn) {
|
|
337
|
-
const result = checkFn(filePath);
|
|
338
|
-
findings.push(...result.map(f => ({
|
|
339
|
-
...f,
|
|
340
|
-
checkName: name,
|
|
341
|
-
checkPath: filePath,
|
|
342
|
-
})));
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
const blockingCount = findings.filter(f => f.blocking).length;
|
|
346
|
-
return {
|
|
347
|
-
passed: blockingCount === 0,
|
|
348
|
-
findings,
|
|
349
|
-
blockingCount,
|
|
350
|
-
highestSeverity: findings.length > 0 ? 'P1' : null,
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bollharness Integration for Bolloon - Enhanced with Pi Ecosystem
|
|
3
|
-
*
|
|
4
|
-
* This module provides compatibility between Bolloon's multi-agent system
|
|
5
|
-
* and Bollharness's governance framework, now with deep Pi ecosystem integration.
|
|
6
|
-
*
|
|
7
|
-
* Pi Ecosystem Integration:
|
|
8
|
-
* - MCP tools via pi-ecosystem-mcp (white-box tool calling)
|
|
9
|
-
* - Goal tracking via pi-ecosystem-goals (persistent workflow)
|
|
10
|
-
* - Subagents via pi-ecosystem-subagents (tmux-based light agents)
|
|
11
|
-
* - Ant Colony via pi-ecosystem-colony (multi-agent signal protocol)
|
|
12
|
-
*/
|
|
13
|
-
export { BollharnessIntegration, createBollharnessIntegration, BollharnessHooks } from './integration.js';
|
|
14
|
-
export { GateStateMachine, type Gate } from './gate-state-machine.js';
|
|
15
|
-
export { GuardChecker, type GuardFinding, type GuardResult } from './guard-checker.js';
|
|
16
|
-
export { ContextRouter } from './context-router.js';
|
|
17
|
-
export { SkillAdapter, type AdaptedSkill, type SkillTriggers, type HarnessSkillMetadata } from './skill-adapter.js';
|
|
18
|
-
export { initializeGateHooks, onGateTransition, offGateTransition, executeGateTransitionHooks, addGateHook, clearGateHooks, listGateHooks, type GateHookConfig, type GateTransitionEvent, } from './gate-transition-hooks.js';
|
|
19
|
-
export { getJudgmentsForPath, getJudgmentsForFragment, getJudgmentsForContextRequest, getCoreJudgmentsForSession, generateJudgmentInjection, type JudgmentInjectOptions, type JudgmentContextResult, } from './context-router-judgment.js';
|
|
20
|
-
export { initializeMcpAdapter, discoverMcpServers, registerServer, registerTool, listTools, hasTool, getTool, executeTool, getToolCallLog, getAdapterStatus, type McpTool, type McpServerConfig, } from '../pi-ecosystem-mcp/index.js';
|
|
21
|
-
export { createGoal, createGoalQueue, getCurrentGoal, startCurrentGoal, completeCurrentGoal, failCurrentGoal, cutoffCurrentGoal, pauseCurrentGoal, checkBudget, getGoalStats, getQueueSummary, loadGoals, clearGoals, compactQueue, loadTemplates, createFromTemplate, nudgeCurrentGoal, type Goal, type GoalBudget, type GoalQueue, type WorkflowTemplate, } from '../pi-ecosystem-goals/index.js';
|
|
22
|
-
export { createSubagent, startSubagent, delegateTask, getSubagent, listSubagents, listRunningSubagents, terminateSubagent, getStats as getSubagentStats, parallelDelegate, splitTask, type Subagent, type SubagentResult, } from '../pi-ecosystem-subagents/index.js';
|
|
23
|
-
export { registerAnt, antScouting, antWorking, antReviewing, antComplete, antFail, antAbort, antTick, createTask, dispatchTask, recordResult, getAnt, listAnts, listAntsByRole, listAntsBySignal, getActiveAnts, getTask, listTasks, getSignalHistory, getColonyStatus, getColonyDump, persistColony, loadColony, onColonyEvent, offColonyEvent, type Ant, type ColonyTask, type ColonySignalEvent, type ColonySignal, type AntRole, } from '../pi-ecosystem-colony/index.js';
|
|
24
|
-
export { createJudgment, getAllJudgments, getJudgmentsByType, getJudgmentsForContext, getCombinedJudgments, calculateConfidence, buildValueFunction, getValueFunction, getJudgmentStats, loadFragmentJudgments, } from '../pi-ecosystem-judgment/index.js';
|
|
25
|
-
export type { Judgment, JudgmentEvidence, DistillationRequest, ValueFunction, } from '../pi-ecosystem-judgment/index.js';
|
|
26
|
-
export { initializeDistillation, detectTrigger, isJudgmentSignal, distillInput, processFeedback, } from '../pi-ecosystem-judgment/distillation.js';
|
|
27
|
-
export { setConfidenceThreshold, evaluateDecision, submitDecisionResponse, parseDecisionResponse, queryInternalAgents, processHumanFeedback, getPendingDecisions, getDecisionRequest, } from '../pi-ecosystem-judgment/decision.js';
|
|
28
|
-
export type { DecisionLevel, DecisionRequest, DecisionResponse, AgentConsultationResult, } from '../pi-ecosystem-judgment/decision.js';
|
|
29
|
-
/**
|
|
30
|
-
* Pi Ecosystem Configuration
|
|
31
|
-
*/
|
|
32
|
-
export interface PiEcosystemConfig {
|
|
33
|
-
mcpEnabled: boolean;
|
|
34
|
-
goalsEnabled: boolean;
|
|
35
|
-
subagentsEnabled: boolean;
|
|
36
|
-
colonyEnabled: boolean;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Combined Pi Ecosystem status
|
|
40
|
-
*/
|
|
41
|
-
export interface PiEcosystemStatus {
|
|
42
|
-
initialized: boolean;
|
|
43
|
-
mcp: {
|
|
44
|
-
serverCount: number;
|
|
45
|
-
toolCount: number;
|
|
46
|
-
runningServers: string[];
|
|
47
|
-
};
|
|
48
|
-
goals: {
|
|
49
|
-
total: number;
|
|
50
|
-
pending: number;
|
|
51
|
-
inProgress: number;
|
|
52
|
-
completed: number;
|
|
53
|
-
};
|
|
54
|
-
subagents: {
|
|
55
|
-
total: number;
|
|
56
|
-
running: number;
|
|
57
|
-
completed: number;
|
|
58
|
-
failed: number;
|
|
59
|
-
};
|
|
60
|
-
colony: {
|
|
61
|
-
antCount: number;
|
|
62
|
-
activeAnts: number;
|
|
63
|
-
taskCount: number;
|
|
64
|
-
activeTasks: number;
|
|
65
|
-
};
|
|
66
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bollharness Integration for Bolloon - Enhanced with Pi Ecosystem
|
|
3
|
-
*
|
|
4
|
-
* This module provides compatibility between Bolloon's multi-agent system
|
|
5
|
-
* and Bollharness's governance framework, now with deep Pi ecosystem integration.
|
|
6
|
-
*
|
|
7
|
-
* Pi Ecosystem Integration:
|
|
8
|
-
* - MCP tools via pi-ecosystem-mcp (white-box tool calling)
|
|
9
|
-
* - Goal tracking via pi-ecosystem-goals (persistent workflow)
|
|
10
|
-
* - Subagents via pi-ecosystem-subagents (tmux-based light agents)
|
|
11
|
-
* - Ant Colony via pi-ecosystem-colony (multi-agent signal protocol)
|
|
12
|
-
*/
|
|
13
|
-
export { BollharnessIntegration, createBollharnessIntegration, BollharnessHooks } from './integration.js';
|
|
14
|
-
export { GateStateMachine } from './gate-state-machine.js';
|
|
15
|
-
export { GuardChecker } from './guard-checker.js';
|
|
16
|
-
export { ContextRouter } from './context-router.js';
|
|
17
|
-
export { SkillAdapter } from './skill-adapter.js';
|
|
18
|
-
// Gate transition hooks
|
|
19
|
-
export { initializeGateHooks, onGateTransition, offGateTransition, executeGateTransitionHooks, addGateHook, clearGateHooks, listGateHooks, } from './gate-transition-hooks.js';
|
|
20
|
-
// Judgment-aware context router exports
|
|
21
|
-
export { getJudgmentsForPath, getJudgmentsForFragment, getJudgmentsForContextRequest, getCoreJudgmentsForSession, generateJudgmentInjection, } from './context-router-judgment.js';
|
|
22
|
-
// Pi Ecosystem re-exports for convenience
|
|
23
|
-
export { initializeMcpAdapter, discoverMcpServers, registerServer, registerTool, listTools, hasTool, getTool, executeTool, getToolCallLog, getAdapterStatus, } from '../pi-ecosystem-mcp/index.js';
|
|
24
|
-
export { createGoal, createGoalQueue, getCurrentGoal, startCurrentGoal, completeCurrentGoal, failCurrentGoal, cutoffCurrentGoal, pauseCurrentGoal, checkBudget, getGoalStats, getQueueSummary, loadGoals, clearGoals, compactQueue, loadTemplates, createFromTemplate, nudgeCurrentGoal, } from '../pi-ecosystem-goals/index.js';
|
|
25
|
-
export { createSubagent, startSubagent, delegateTask, getSubagent, listSubagents, listRunningSubagents, terminateSubagent, getStats as getSubagentStats, parallelDelegate, splitTask, } from '../pi-ecosystem-subagents/index.js';
|
|
26
|
-
export { registerAnt, antScouting, antWorking, antReviewing, antComplete, antFail, antAbort, antTick, createTask, dispatchTask, recordResult, getAnt, listAnts, listAntsByRole, listAntsBySignal, getActiveAnts, getTask, listTasks, getSignalHistory, getColonyStatus, getColonyDump, persistColony, loadColony, onColonyEvent, offColonyEvent, } from '../pi-ecosystem-colony/index.js';
|
|
27
|
-
// Judgment exports
|
|
28
|
-
export { createJudgment, getAllJudgments, getJudgmentsByType, getJudgmentsForContext, getCombinedJudgments, calculateConfidence, buildValueFunction, getValueFunction, getJudgmentStats, loadFragmentJudgments, } from '../pi-ecosystem-judgment/index.js';
|
|
29
|
-
// Distillation exports
|
|
30
|
-
export { initializeDistillation, detectTrigger, isJudgmentSignal, distillInput, processFeedback, } from '../pi-ecosystem-judgment/distillation.js';
|
|
31
|
-
// Decision exports
|
|
32
|
-
export { setConfidenceThreshold, evaluateDecision, submitDecisionResponse, parseDecisionResponse, queryInternalAgents, processHumanFeedback, getPendingDecisions, getDecisionRequest, } from '../pi-ecosystem-judgment/decision.js';
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bollharness Integration for Bolloon
|
|
3
|
-
*
|
|
4
|
-
* Main integration class that combines:
|
|
5
|
-
* - Gate State Machine (8-gate workflow governance)
|
|
6
|
-
* - Guard Checker (code quality checks)
|
|
7
|
-
* - Context Router (automatic context injection)
|
|
8
|
-
* - Skill Adapter (bollharness skills in Bolloon)
|
|
9
|
-
*/
|
|
10
|
-
import { type Gate } from './gate-state-machine.js';
|
|
11
|
-
import { type GuardResult } from './guard-checker.js';
|
|
12
|
-
import { SkillAdapter } from './skill-adapter.js';
|
|
13
|
-
export interface BollharnessConfig {
|
|
14
|
-
enabled: boolean;
|
|
15
|
-
guardsEnabled: boolean;
|
|
16
|
-
contextEnabled: boolean;
|
|
17
|
-
skillsEnabled: boolean;
|
|
18
|
-
gatesEnabled: boolean;
|
|
19
|
-
}
|
|
20
|
-
export interface IntegrationResult {
|
|
21
|
-
success: boolean;
|
|
22
|
-
guards?: GuardResult;
|
|
23
|
-
context?: string[];
|
|
24
|
-
gatePack?: Record<string, unknown>;
|
|
25
|
-
skillResult?: string;
|
|
26
|
-
errors: string[];
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Session Archive Entry
|
|
30
|
-
*/
|
|
31
|
-
export interface SessionArchive {
|
|
32
|
-
id: string;
|
|
33
|
-
timestamp: number;
|
|
34
|
-
gate: number;
|
|
35
|
-
summary: string;
|
|
36
|
-
actionCount: number;
|
|
37
|
-
compressed: string;
|
|
38
|
-
keyDecisions: string[];
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Main integration class
|
|
42
|
-
*/
|
|
43
|
-
export declare class BollharnessIntegration {
|
|
44
|
-
private config;
|
|
45
|
-
private gateMachine;
|
|
46
|
-
private guardChecker;
|
|
47
|
-
private contextRouter;
|
|
48
|
-
private skillAdapter;
|
|
49
|
-
private sessionArchives;
|
|
50
|
-
private currentSessionId;
|
|
51
|
-
constructor(config?: Partial<BollharnessConfig>);
|
|
52
|
-
/**
|
|
53
|
-
* Process a file edit with all enabled checks
|
|
54
|
-
*/
|
|
55
|
-
processFileEdit(filePath: string): Promise<IntegrationResult>;
|
|
56
|
-
/**
|
|
57
|
-
* Check file before edit (pre-check)
|
|
58
|
-
*/
|
|
59
|
-
preEditCheck(filePath: string): Promise<IntegrationResult>;
|
|
60
|
-
/**
|
|
61
|
-
* Get context for a file
|
|
62
|
-
*/
|
|
63
|
-
getContext(filePath: string): string;
|
|
64
|
-
/**
|
|
65
|
-
* Get fragments for a file
|
|
66
|
-
*/
|
|
67
|
-
getFragments(filePath: string): string[];
|
|
68
|
-
/**
|
|
69
|
-
* Get current gate state
|
|
70
|
-
*/
|
|
71
|
-
getCurrentGate(): Gate;
|
|
72
|
-
/**
|
|
73
|
-
* Get gate pack for output
|
|
74
|
-
*/
|
|
75
|
-
getGatePack(): Record<string, unknown>;
|
|
76
|
-
/**
|
|
77
|
-
* Submit artifact to current gate
|
|
78
|
-
*/
|
|
79
|
-
submitGateArtifact(name: string, artifact: unknown): void;
|
|
80
|
-
/**
|
|
81
|
-
* Attempt gate transition
|
|
82
|
-
*/
|
|
83
|
-
transitionGate(reviewResult?: {
|
|
84
|
-
verdict: 'PASS' | 'BLOCK';
|
|
85
|
-
details?: string;
|
|
86
|
-
}): Promise<{
|
|
87
|
-
success: boolean;
|
|
88
|
-
transition: unknown;
|
|
89
|
-
}>;
|
|
90
|
-
/**
|
|
91
|
-
* Classify change type
|
|
92
|
-
*/
|
|
93
|
-
classifyChange(description: string): Record<string, unknown>;
|
|
94
|
-
/**
|
|
95
|
-
* Execute a bollharness skill
|
|
96
|
-
*/
|
|
97
|
-
executeSkill(skillName: string, params: Record<string, unknown>): Promise<{
|
|
98
|
-
success: boolean;
|
|
99
|
-
result?: string;
|
|
100
|
-
error?: string;
|
|
101
|
-
}>;
|
|
102
|
-
/**
|
|
103
|
-
* List available skills
|
|
104
|
-
*/
|
|
105
|
-
listSkills(): Array<{
|
|
106
|
-
name: string;
|
|
107
|
-
description: string;
|
|
108
|
-
}>;
|
|
109
|
-
/**
|
|
110
|
-
* Get skill registry
|
|
111
|
-
*/
|
|
112
|
-
getSkillAdapter(): SkillAdapter;
|
|
113
|
-
/**
|
|
114
|
-
* List harness-native skills (metadata from SKILL.md files)
|
|
115
|
-
*/
|
|
116
|
-
listHarnessSkills(): Array<{
|
|
117
|
-
name: string;
|
|
118
|
-
description: string;
|
|
119
|
-
tier: string;
|
|
120
|
-
}>;
|
|
121
|
-
/**
|
|
122
|
-
* Update configuration
|
|
123
|
-
*/
|
|
124
|
-
updateConfig(config: Partial<BollharnessConfig>): void;
|
|
125
|
-
/**
|
|
126
|
-
* Get current configuration
|
|
127
|
-
*/
|
|
128
|
-
getConfig(): BollharnessConfig;
|
|
129
|
-
/**
|
|
130
|
-
* Enable/disable specific checks
|
|
131
|
-
*/
|
|
132
|
-
enableCheck(checkName: string): void;
|
|
133
|
-
disableCheck(checkName: string): void;
|
|
134
|
-
/**
|
|
135
|
-
* Get integration metrics
|
|
136
|
-
*/
|
|
137
|
-
getMetrics(): Record<string, unknown>;
|
|
138
|
-
/**
|
|
139
|
-
* Archive current session operations with compression
|
|
140
|
-
*/
|
|
141
|
-
archiveSession(logs: Array<{
|
|
142
|
-
timestamp: number;
|
|
143
|
-
action: string;
|
|
144
|
-
details?: Record<string, unknown>;
|
|
145
|
-
status: string;
|
|
146
|
-
}>, options?: {
|
|
147
|
-
summary?: string;
|
|
148
|
-
keyDecisions?: string[];
|
|
149
|
-
}): SessionArchive;
|
|
150
|
-
/**
|
|
151
|
-
* Compress logs by removing redundancy
|
|
152
|
-
*/
|
|
153
|
-
private compressLogs;
|
|
154
|
-
/**
|
|
155
|
-
* Generate a brief summary of the session
|
|
156
|
-
*/
|
|
157
|
-
private generateSessionSummary;
|
|
158
|
-
/**
|
|
159
|
-
* Extract key decisions from logs
|
|
160
|
-
*/
|
|
161
|
-
private extractKeyDecisions;
|
|
162
|
-
/**
|
|
163
|
-
* Get session context for skills
|
|
164
|
-
*/
|
|
165
|
-
getSessionContext(sessionId?: string): string;
|
|
166
|
-
/**
|
|
167
|
-
* Get all session archives
|
|
168
|
-
*/
|
|
169
|
-
getSessionArchives(): SessionArchive[];
|
|
170
|
-
/**
|
|
171
|
-
* Start a new session
|
|
172
|
-
*/
|
|
173
|
-
startNewSession(): string;
|
|
174
|
-
/**
|
|
175
|
-
* Link current harness session to Pi SDK session
|
|
176
|
-
*/
|
|
177
|
-
linkSession(sessionId: string): void;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Create a default integration instance
|
|
181
|
-
*/
|
|
182
|
-
export declare function createBollharnessIntegration(config?: Partial<BollharnessConfig>): BollharnessIntegration;
|
|
183
|
-
export interface HookContext {
|
|
184
|
-
tool: string;
|
|
185
|
-
filePath?: string;
|
|
186
|
-
input?: Record<string, unknown>;
|
|
187
|
-
}
|
|
188
|
-
export interface HookResult {
|
|
189
|
-
allowed: boolean;
|
|
190
|
-
context?: string[];
|
|
191
|
-
findings?: Array<{
|
|
192
|
-
severity: string;
|
|
193
|
-
message: string;
|
|
194
|
-
}>;
|
|
195
|
-
blockReason?: string;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Integration hooks for Bolloon's execution pipeline
|
|
199
|
-
*/
|
|
200
|
-
export declare class BollharnessHooks {
|
|
201
|
-
private integration;
|
|
202
|
-
constructor(integration?: BollharnessIntegration);
|
|
203
|
-
/**
|
|
204
|
-
* Pre-tool-use hook
|
|
205
|
-
*/
|
|
206
|
-
preToolUse(context: HookContext): Promise<HookResult>;
|
|
207
|
-
/**
|
|
208
|
-
* Post-tool-use hook
|
|
209
|
-
*/
|
|
210
|
-
postToolUse(context: HookContext): Promise<HookResult>;
|
|
211
|
-
/**
|
|
212
|
-
* Session start hook
|
|
213
|
-
*/
|
|
214
|
-
sessionStart(): Promise<void>;
|
|
215
|
-
/**
|
|
216
|
-
* Session end hook
|
|
217
|
-
*/
|
|
218
|
-
sessionEnd(): Promise<void>;
|
|
219
|
-
}
|