@zelari/core 0.7.9
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/LICENSE +21 -0
- package/dist/agents/advancedTools.d.ts +7 -0
- package/dist/agents/advancedTools.d.ts.map +1 -0
- package/dist/agents/advancedTools.js +115 -0
- package/dist/agents/advancedTools.js.map +1 -0
- package/dist/agents/councilApi.d.ts +328 -0
- package/dist/agents/councilApi.d.ts.map +1 -0
- package/dist/agents/councilApi.js +952 -0
- package/dist/agents/councilApi.js.map +1 -0
- package/dist/agents/councilDirectives.d.ts +26 -0
- package/dist/agents/councilDirectives.d.ts.map +1 -0
- package/dist/agents/councilDirectives.js +98 -0
- package/dist/agents/councilDirectives.js.map +1 -0
- package/dist/agents/harnessToolBridge.d.ts +26 -0
- package/dist/agents/harnessToolBridge.d.ts.map +1 -0
- package/dist/agents/harnessToolBridge.js +60 -0
- package/dist/agents/harnessToolBridge.js.map +1 -0
- package/dist/agents/promoteMember.d.ts +77 -0
- package/dist/agents/promoteMember.d.ts.map +1 -0
- package/dist/agents/promoteMember.js +210 -0
- package/dist/agents/promoteMember.js.map +1 -0
- package/dist/agents/promptModules.d.ts +20 -0
- package/dist/agents/promptModules.d.ts.map +1 -0
- package/dist/agents/promptModules.js +139 -0
- package/dist/agents/promptModules.js.map +1 -0
- package/dist/agents/roles.d.ts +40 -0
- package/dist/agents/roles.d.ts.map +1 -0
- package/dist/agents/roles.js +352 -0
- package/dist/agents/roles.js.map +1 -0
- package/dist/agents/skills/builtin/debugging.d.ts +2 -0
- package/dist/agents/skills/builtin/debugging.d.ts.map +1 -0
- package/dist/agents/skills/builtin/debugging.js +248 -0
- package/dist/agents/skills/builtin/debugging.js.map +1 -0
- package/dist/agents/skills/builtin/docs.d.ts +2 -0
- package/dist/agents/skills/builtin/docs.d.ts.map +1 -0
- package/dist/agents/skills/builtin/docs.js +291 -0
- package/dist/agents/skills/builtin/docs.js.map +1 -0
- package/dist/agents/skills/builtin/git-ops.d.ts +2 -0
- package/dist/agents/skills/builtin/git-ops.d.ts.map +1 -0
- package/dist/agents/skills/builtin/git-ops.js +301 -0
- package/dist/agents/skills/builtin/git-ops.js.map +1 -0
- package/dist/agents/skills/builtin/planning.d.ts +2 -0
- package/dist/agents/skills/builtin/planning.d.ts.map +1 -0
- package/dist/agents/skills/builtin/planning.js +335 -0
- package/dist/agents/skills/builtin/planning.js.map +1 -0
- package/dist/agents/skills/builtin/refactoring.d.ts +2 -0
- package/dist/agents/skills/builtin/refactoring.d.ts.map +1 -0
- package/dist/agents/skills/builtin/refactoring.js +261 -0
- package/dist/agents/skills/builtin/refactoring.js.map +1 -0
- package/dist/agents/skills/builtin/review.d.ts +2 -0
- package/dist/agents/skills/builtin/review.d.ts.map +1 -0
- package/dist/agents/skills/builtin/review.js +302 -0
- package/dist/agents/skills/builtin/review.js.map +1 -0
- package/dist/agents/skills/builtin/testing.d.ts +2 -0
- package/dist/agents/skills/builtin/testing.d.ts.map +1 -0
- package/dist/agents/skills/builtin/testing.js +245 -0
- package/dist/agents/skills/builtin/testing.js.map +1 -0
- package/dist/agents/skills.d.ts +138 -0
- package/dist/agents/skills.d.ts.map +1 -0
- package/dist/agents/skills.js +277 -0
- package/dist/agents/skills.js.map +1 -0
- package/dist/agents/systemPromptBuilder.d.ts +45 -0
- package/dist/agents/systemPromptBuilder.d.ts.map +1 -0
- package/dist/agents/systemPromptBuilder.js +159 -0
- package/dist/agents/systemPromptBuilder.js.map +1 -0
- package/dist/agents/toolSchemas.d.ts +55 -0
- package/dist/agents/toolSchemas.d.ts.map +1 -0
- package/dist/agents/toolSchemas.js +316 -0
- package/dist/agents/toolSchemas.js.map +1 -0
- package/dist/agents/tools.d.ts +67 -0
- package/dist/agents/tools.d.ts.map +1 -0
- package/dist/agents/tools.js +225 -0
- package/dist/agents/tools.js.map +1 -0
- package/dist/agents/vaultTools.d.ts +9 -0
- package/dist/agents/vaultTools.d.ts.map +1 -0
- package/dist/agents/vaultTools.js +134 -0
- package/dist/agents/vaultTools.js.map +1 -0
- package/dist/core/AgentHarness.d.ts +250 -0
- package/dist/core/AgentHarness.d.ts.map +1 -0
- package/dist/core/AgentHarness.js +614 -0
- package/dist/core/AgentHarness.js.map +1 -0
- package/dist/core/providerStream.d.ts +61 -0
- package/dist/core/providerStream.d.ts.map +1 -0
- package/dist/core/providerStream.js +99 -0
- package/dist/core/providerStream.js.map +1 -0
- package/dist/core/sessionJsonl.d.ts +50 -0
- package/dist/core/sessionJsonl.d.ts.map +1 -0
- package/dist/core/sessionJsonl.js +99 -0
- package/dist/core/sessionJsonl.js.map +1 -0
- package/dist/core/tools/auditLog.d.ts +14 -0
- package/dist/core/tools/auditLog.d.ts.map +1 -0
- package/dist/core/tools/auditLog.js +26 -0
- package/dist/core/tools/auditLog.js.map +1 -0
- package/dist/core/tools/builtin/_walk.d.ts +40 -0
- package/dist/core/tools/builtin/_walk.d.ts.map +1 -0
- package/dist/core/tools/builtin/_walk.js +129 -0
- package/dist/core/tools/builtin/_walk.js.map +1 -0
- package/dist/core/tools/builtin/diff.d.ts +45 -0
- package/dist/core/tools/builtin/diff.d.ts.map +1 -0
- package/dist/core/tools/builtin/diff.js +477 -0
- package/dist/core/tools/builtin/diff.js.map +1 -0
- package/dist/core/tools/builtin/filesystem.d.ts +45 -0
- package/dist/core/tools/builtin/filesystem.d.ts.map +1 -0
- package/dist/core/tools/builtin/filesystem.js +110 -0
- package/dist/core/tools/builtin/filesystem.js.map +1 -0
- package/dist/core/tools/builtin/listFiles.d.ts +18 -0
- package/dist/core/tools/builtin/listFiles.d.ts.map +1 -0
- package/dist/core/tools/builtin/listFiles.js +48 -0
- package/dist/core/tools/builtin/listFiles.js.map +1 -0
- package/dist/core/tools/builtin/search.d.ts +49 -0
- package/dist/core/tools/builtin/search.d.ts.map +1 -0
- package/dist/core/tools/builtin/search.js +148 -0
- package/dist/core/tools/builtin/search.js.map +1 -0
- package/dist/core/tools/builtin/shell.d.ts +27 -0
- package/dist/core/tools/builtin/shell.d.ts.map +1 -0
- package/dist/core/tools/builtin/shell.js +98 -0
- package/dist/core/tools/builtin/shell.js.map +1 -0
- package/dist/core/tools/builtin/shellResolver.d.ts +25 -0
- package/dist/core/tools/builtin/shellResolver.d.ts.map +1 -0
- package/dist/core/tools/builtin/shellResolver.js +117 -0
- package/dist/core/tools/builtin/shellResolver.js.map +1 -0
- package/dist/core/tools/builtin/web.d.ts +43 -0
- package/dist/core/tools/builtin/web.d.ts.map +1 -0
- package/dist/core/tools/builtin/web.js +208 -0
- package/dist/core/tools/builtin/web.js.map +1 -0
- package/dist/core/tools/registry.d.ts +31 -0
- package/dist/core/tools/registry.d.ts.map +1 -0
- package/dist/core/tools/registry.js +115 -0
- package/dist/core/tools/registry.js.map +1 -0
- package/dist/core/tools/toolTypes.d.ts +60 -0
- package/dist/core/tools/toolTypes.d.ts.map +1 -0
- package/dist/core/tools/toolTypes.js +8 -0
- package/dist/core/tools/toolTypes.js.map +1 -0
- package/dist/core/tools/zodBridge.d.ts +6 -0
- package/dist/core/tools/zodBridge.d.ts.map +1 -0
- package/dist/core/tools/zodBridge.js +56 -0
- package/dist/core/tools/zodBridge.js.map +1 -0
- package/dist/council/index.d.ts +14 -0
- package/dist/council/index.d.ts.map +1 -0
- package/dist/council/index.js +14 -0
- package/dist/council/index.js.map +1 -0
- package/dist/council/modeBanners.d.ts +5 -0
- package/dist/council/modeBanners.d.ts.map +1 -0
- package/dist/council/modeBanners.js +10 -0
- package/dist/council/modeBanners.js.map +1 -0
- package/dist/council/runMode.d.ts +25 -0
- package/dist/council/runMode.d.ts.map +1 -0
- package/dist/council/runMode.js +41 -0
- package/dist/council/runMode.js.map +1 -0
- package/dist/events/index.d.ts +6 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +6 -0
- package/dist/events/index.js.map +1 -0
- package/dist/harness/index.d.ts +9 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +9 -0
- package/dist/harness/index.js.map +1 -0
- package/dist/harness/tools/index.d.ts +20 -0
- package/dist/harness/tools/index.d.ts.map +1 -0
- package/dist/harness/tools/index.js +19 -0
- package/dist/harness/tools/index.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/shared/eventBus.d.ts +58 -0
- package/dist/shared/eventBus.d.ts.map +1 -0
- package/dist/shared/eventBus.js +104 -0
- package/dist/shared/eventBus.js.map +1 -0
- package/dist/shared/events.d.ts +230 -0
- package/dist/shared/events.d.ts.map +1 -0
- package/dist/shared/events.js +76 -0
- package/dist/shared/events.js.map +1 -0
- package/dist/shared/index.d.ts +8 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +8 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/skills/index.d.ts +10 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +10 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/types/context.d.ts +54 -0
- package/dist/types/context.d.ts.map +1 -0
- package/dist/types/context.js +3 -0
- package/dist/types/context.js.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +12 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/knowledge.d.ts +79 -0
- package/dist/types/knowledge.d.ts.map +1 -0
- package/dist/types/knowledge.js +5 -0
- package/dist/types/knowledge.js.map +1 -0
- package/dist/types/legacy.d.ts +466 -0
- package/dist/types/legacy.d.ts.map +1 -0
- package/dist/types/legacy.js +2 -0
- package/dist/types/legacy.js.map +1 -0
- package/dist/types/systemTypes.d.ts +113 -0
- package/dist/types/systemTypes.d.ts.map +1 -0
- package/dist/types/systemTypes.js +10 -0
- package/dist/types/systemTypes.js.map +1 -0
- package/package.json +151 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 N-THEM Studio
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { EnhancedToolDefinition } from '../types/systemTypes.js';
|
|
2
|
+
/**
|
|
3
|
+
* Advanced tools: RAG search, mind-map node creation, milestones, task updates
|
|
4
|
+
* and idea clustering.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ADVANCED_TOOL_DEFINITIONS: EnhancedToolDefinition[];
|
|
7
|
+
//# sourceMappingURL=advancedTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advancedTools.d.ts","sourceRoot":"","sources":["../../src/agents/advancedTools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAiB,MAAM,yBAAyB,CAAC;AAcrF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,sBAAsB,EAgG7D,CAAC"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/** Helper to build a ToolParameter concisely. */
|
|
2
|
+
function p(name, type, description, required, extra) {
|
|
3
|
+
return { name, type, description, required, ...extra };
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Advanced tools: RAG search, mind-map node creation, milestones, task updates
|
|
7
|
+
* and idea clustering.
|
|
8
|
+
*/
|
|
9
|
+
export const ADVANCED_TOOL_DEFINITIONS = [
|
|
10
|
+
{
|
|
11
|
+
name: 'searchRAG',
|
|
12
|
+
description: 'Query the hybrid RAG knowledge base and return the most relevant chunks.',
|
|
13
|
+
category: 'analysis',
|
|
14
|
+
parameters: [
|
|
15
|
+
p('query', 'string', 'Natural-language query', true),
|
|
16
|
+
p('topK', 'number', 'Number of results to return', false, { default: 6 }),
|
|
17
|
+
],
|
|
18
|
+
execute: (args, ctx) => {
|
|
19
|
+
if (!ctx.ragQuery)
|
|
20
|
+
return 'RAG search not available in this context.';
|
|
21
|
+
const query = args['query'] ?? '';
|
|
22
|
+
const topK = args['topK'] ?? 6;
|
|
23
|
+
const results = ctx.ragQuery(query, topK);
|
|
24
|
+
if (results.length === 0)
|
|
25
|
+
return 'No relevant knowledge found in RAG index.';
|
|
26
|
+
return results
|
|
27
|
+
.map((r, i) => `${i + 1}. ${r.title} (score: ${r.score.toFixed(2)})\n ${r.content.slice(0, 160)}`)
|
|
28
|
+
.join('\n');
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'createMindMapNode',
|
|
33
|
+
description: 'Add a single node to the current mind map.',
|
|
34
|
+
category: 'mindmap',
|
|
35
|
+
parameters: [
|
|
36
|
+
p('label', 'string', 'Node label', true),
|
|
37
|
+
p('content', 'string', 'Short node content/description', false),
|
|
38
|
+
],
|
|
39
|
+
execute: (args, ctx) => {
|
|
40
|
+
if (!ctx.createMindMapNode)
|
|
41
|
+
return 'Mind map not available in this context.';
|
|
42
|
+
ctx.createMindMapNode({
|
|
43
|
+
label: args['label'] ?? 'Node',
|
|
44
|
+
content: args['content'] ?? '',
|
|
45
|
+
});
|
|
46
|
+
return `Mind map node "${args['label']}" added.`;
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'createMilestone',
|
|
51
|
+
description: 'Create a milestone in the active project.',
|
|
52
|
+
category: 'project',
|
|
53
|
+
parameters: [
|
|
54
|
+
p('title', 'string', 'Milestone title', true),
|
|
55
|
+
p('description', 'string', 'Milestone description', false),
|
|
56
|
+
p('dueDate', 'string', 'Due date (ISO string)', false),
|
|
57
|
+
],
|
|
58
|
+
execute: (args, ctx) => {
|
|
59
|
+
if (!ctx.createMilestone)
|
|
60
|
+
return 'Project milestones not available in this context.';
|
|
61
|
+
ctx.createMilestone({
|
|
62
|
+
title: args['title'] ?? 'Milestone',
|
|
63
|
+
description: args['description'] ?? '',
|
|
64
|
+
dueDate: args['dueDate'],
|
|
65
|
+
});
|
|
66
|
+
ctx.addActivity('project', 'milestone created', args['title'] ?? 'Milestone');
|
|
67
|
+
return `Milestone "${args['title']}" created.`;
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'updateTask',
|
|
72
|
+
description: 'Update an existing task (status, priority, description).',
|
|
73
|
+
category: 'project',
|
|
74
|
+
parameters: [
|
|
75
|
+
p('taskId', 'string', 'Task id to update', true),
|
|
76
|
+
p('status', 'string', 'New status', false, { enum: ['todo', 'in-progress', 'done', 'blocked'] }),
|
|
77
|
+
p('priority', 'string', 'New priority', false, { enum: ['low', 'medium', 'high', 'critical'] }),
|
|
78
|
+
p('description', 'string', 'New description', false),
|
|
79
|
+
],
|
|
80
|
+
execute: (args, ctx) => {
|
|
81
|
+
if (!ctx.updateTask)
|
|
82
|
+
return 'Task updates not available in this context.';
|
|
83
|
+
const taskId = args['taskId'] ?? '';
|
|
84
|
+
const updates = {};
|
|
85
|
+
if (args['status'] !== undefined)
|
|
86
|
+
updates.status = args['status'];
|
|
87
|
+
if (args['priority'] !== undefined)
|
|
88
|
+
updates.priority = args['priority'];
|
|
89
|
+
if (args['description'] !== undefined)
|
|
90
|
+
updates.description = args['description'];
|
|
91
|
+
ctx.updateTask(taskId, updates);
|
|
92
|
+
return `Task ${taskId} updated.`;
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'clusterIdeas',
|
|
97
|
+
description: 'Group ideas by similarity into a named cluster.',
|
|
98
|
+
category: 'ideas',
|
|
99
|
+
parameters: [
|
|
100
|
+
p('ideaIds', 'string[]', 'Idea ids to cluster', true),
|
|
101
|
+
p('clusterName', 'string', 'Name for the new cluster', true),
|
|
102
|
+
p('color', 'string', 'Cluster color (hex)', false, { default: '#3b82f6' }),
|
|
103
|
+
],
|
|
104
|
+
execute: (args, ctx) => {
|
|
105
|
+
if (!ctx.clusterIdeas)
|
|
106
|
+
return 'Idea clustering not available in this context.';
|
|
107
|
+
const ideaIds = args['ideaIds'] ?? [];
|
|
108
|
+
const clusterName = args['clusterName'] ?? 'Cluster';
|
|
109
|
+
const color = args['color'] ?? '#3b82f6';
|
|
110
|
+
ctx.clusterIdeas(ideaIds, clusterName, color);
|
|
111
|
+
return `Clustered ${ideaIds.length} ideas into "${clusterName}".`;
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
];
|
|
115
|
+
//# sourceMappingURL=advancedTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advancedTools.js","sourceRoot":"","sources":["../../src/agents/advancedTools.ts"],"names":[],"mappings":"AAGA,iDAAiD;AACjD,SAAS,CAAC,CACR,IAAY,EACZ,IAA2B,EAC3B,WAAmB,EACnB,QAAiB,EACjB,KAA8B;IAE9B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,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QACnC,CAAC;KACF;IACD;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,iDAAiD;QAC9D,QAAQ,EAAE,OAAO;QACjB,UAAU,EAAE;YACV,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,qBAAqB,EAAE,IAAI,CAAC;YACrD,CAAC,CAAC,aAAa,EAAE,QAAQ,EAAE,0BAA0B,EAAE,IAAI,CAAC;YAC5D,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;SAC3E;QACD,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACrB,IAAI,CAAC,GAAG,CAAC,YAAY;gBAAE,OAAO,gDAAgD,CAAC;YAC/E,MAAM,OAAO,GAAI,IAAI,CAAC,SAAS,CAAc,IAAI,EAAE,CAAC;YACpD,MAAM,WAAW,GAAI,IAAI,CAAC,aAAa,CAAY,IAAI,SAAS,CAAC;YACjE,MAAM,KAAK,GAAI,IAAI,CAAC,OAAO,CAAY,IAAI,SAAS,CAAC;YACrD,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;YAC9C,OAAO,aAAa,OAAO,CAAC,MAAM,gBAAgB,WAAW,IAAI,CAAC;QACpE,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import type { AgentRole } from '../types/index.js';
|
|
2
|
+
import { type ParsedToolCall } from './toolSchemas.js';
|
|
3
|
+
import type { SystemPromptConfig } from '../types/systemTypes.js';
|
|
4
|
+
import type { BrainEvent } from '../shared/events.js';
|
|
5
|
+
import type { ProviderStreamFn } from '../core/AgentHarness.js';
|
|
6
|
+
import { ToolRegistry } from '../core/tools/registry.js';
|
|
7
|
+
import type { CouncilRunMode } from '../council/runMode.js';
|
|
8
|
+
/**
|
|
9
|
+
* Council members whose tool-emission retry is DISABLED.
|
|
10
|
+
*
|
|
11
|
+
* v0.7.7 Opzione B put 'nettun' here because its contract (12 createTask
|
|
12
|
+
* + 1 createMilestone = 13+ sequential calls) exceeded what composer-2.5
|
|
13
|
+
* could persist in the 240s budget, making the retry a pure waste.
|
|
14
|
+
*
|
|
15
|
+
* v0.7.8 removes 'nettun': the plan contract is now satisfiable with a
|
|
16
|
+
* SINGLE `createPlan` batch call (phases + nested tasks + milestone in
|
|
17
|
+
* one emission), so the forced retry has the same 1-call budget that
|
|
18
|
+
* already works reliably for Minosse and Lucifero. The set stays
|
|
19
|
+
* exported as the opt-out mechanism for future members.
|
|
20
|
+
*/
|
|
21
|
+
export declare const NON_RETRY_AGENTS: ReadonlySet<string>;
|
|
22
|
+
export type { BrainEvent } from '../shared/events.js';
|
|
23
|
+
export type { AgentMessage, AgentToolSpec, ProviderStreamFn, ProviderDelta, } from '../core/AgentHarness.js';
|
|
24
|
+
/**
|
|
25
|
+
* Minimal structural interface for a feedback store — matches the
|
|
26
|
+
* `FeedbackStore` class in `electron/cli/councilFeedback.ts` without
|
|
27
|
+
* importing it (keeps the core free of CLI-side deps).
|
|
28
|
+
*
|
|
29
|
+
* Used by `runCouncilPure` to opt-in to feedback-driven specialist ordering
|
|
30
|
+
* via the `.ranked()` method (Task: council integration, v3-I deferred).
|
|
31
|
+
*/
|
|
32
|
+
export interface FeedbackStoreLike {
|
|
33
|
+
/**
|
|
34
|
+
* Return a NEW array sorted by feedback score, descending.
|
|
35
|
+
* Members with no feedback are placed last, ordered by id ascending.
|
|
36
|
+
*/
|
|
37
|
+
ranked<T extends {
|
|
38
|
+
id: string;
|
|
39
|
+
}>(items: T[]): T[];
|
|
40
|
+
}
|
|
41
|
+
export interface PureCouncilConfig {
|
|
42
|
+
apiKey: string;
|
|
43
|
+
glmApiKey?: string;
|
|
44
|
+
provider?: string;
|
|
45
|
+
model: string;
|
|
46
|
+
councilSize: number;
|
|
47
|
+
debateMode: boolean;
|
|
48
|
+
ragContext: string;
|
|
49
|
+
workspaceContext: string;
|
|
50
|
+
completedAgentIds?: string[];
|
|
51
|
+
existingOutputs?: {
|
|
52
|
+
name: string;
|
|
53
|
+
role: string;
|
|
54
|
+
content: string;
|
|
55
|
+
}[];
|
|
56
|
+
aiConfig?: SystemPromptConfig;
|
|
57
|
+
agentModels?: Record<string, {
|
|
58
|
+
providerId: string;
|
|
59
|
+
model: string;
|
|
60
|
+
}>;
|
|
61
|
+
customProviders?: Array<{
|
|
62
|
+
id: string;
|
|
63
|
+
baseUrl: string;
|
|
64
|
+
authStyle: 'openai' | 'anthropic';
|
|
65
|
+
models: string[];
|
|
66
|
+
}>;
|
|
67
|
+
providerApiKeys?: Record<string, string>;
|
|
68
|
+
/**
|
|
69
|
+
* Optional per-call member remap (Task I.3 close-out).
|
|
70
|
+
*
|
|
71
|
+
* When set (non-empty), `swapMembers(agents, memberSwap)` is applied
|
|
72
|
+
* immediately after `getCouncilAgents()` and BEFORE filtering into
|
|
73
|
+
* specialists / oracle / chairman. Useful for replacing `oracle` with a
|
|
74
|
+
* custom critic on the fly. Throws `UnknownMemberError` on typo in either
|
|
75
|
+
* side of the mapping.
|
|
76
|
+
*
|
|
77
|
+
* Backward-compat: when omitted, behavior is identical to pre-integration.
|
|
78
|
+
*
|
|
79
|
+
* @see swapMembers in src/agents/roles.ts
|
|
80
|
+
*/
|
|
81
|
+
memberSwap?: Record<string, string>;
|
|
82
|
+
/**
|
|
83
|
+
* Optional feedback store for specialist ordering (Task I.2 close-out).
|
|
84
|
+
*
|
|
85
|
+
* When set, `feedbackStore.ranked(specialists)` is applied AFTER the swap
|
|
86
|
+
* filter and BEFORE the specialists loop. Only specialists are ranked —
|
|
87
|
+
* oracle (debate-mode review) and chairman (synthesis) keep their fixed
|
|
88
|
+
* positions. This preserves the existing semantics of the council while
|
|
89
|
+
* letting good-rated specialists go first.
|
|
90
|
+
*
|
|
91
|
+
* Backward-compat: when omitted, specialists run in their default order.
|
|
92
|
+
*/
|
|
93
|
+
feedbackStore?: FeedbackStoreLike;
|
|
94
|
+
/** Provider stream function (injected for testability). MUST yield ProviderDelta. */
|
|
95
|
+
providerStream: ProviderStreamFn;
|
|
96
|
+
/** Optional event bus for emitting BrainEvents alongside the returned iterable. */
|
|
97
|
+
eventBus?: import('../shared/eventBus.js').EventBus;
|
|
98
|
+
/** Optional session id. Defaults to a UUID. */
|
|
99
|
+
sessionId?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Optional tool registry. When provided, each council member (specialist
|
|
102
|
+
* and oracle) is given access to the registry via AgentHarness — tool_call
|
|
103
|
+
* deltas trigger real tool execution and emit tool_execution_end events.
|
|
104
|
+
* Without it, the council is text-only (legacy behavior).
|
|
105
|
+
*
|
|
106
|
+
* @see electron/main/core/AgentHarness.ts — `toolRegistry` field
|
|
107
|
+
* @see electron/cli/toolRegistry.ts — `createBuiltinToolRegistry()`
|
|
108
|
+
*/
|
|
109
|
+
tools?: ToolRegistry;
|
|
110
|
+
/**
|
|
111
|
+
* Max tool calls per member per turn. Enforced by truncating extra
|
|
112
|
+
* tool_execution_start events to `tool_call_skipped` after this limit.
|
|
113
|
+
* Default: 5. Set to 0 to disable tools entirely (overrides `tools`).
|
|
114
|
+
*/
|
|
115
|
+
maxToolCallsPerTurn?: number;
|
|
116
|
+
/** Council run mode. Default: `implementation`. */
|
|
117
|
+
runMode?: CouncilRunMode;
|
|
118
|
+
}
|
|
119
|
+
export interface PureCouncilCallbacks {
|
|
120
|
+
onAgentStart?: (agent: AgentRole) => void;
|
|
121
|
+
onAgentChunk?: (agent: AgentRole, chunk: string) => void;
|
|
122
|
+
onAgentDone?: (agent: AgentRole, content: string, thinking?: string) => void;
|
|
123
|
+
onSynthesisStart?: () => void;
|
|
124
|
+
onSynthesisChunk?: (chunk: string) => void;
|
|
125
|
+
onSynthesisDone?: (content: string, toolCalls?: ParsedToolCall[], thinking?: string) => void;
|
|
126
|
+
/**
|
|
127
|
+
* Fired after every council member (specialist, oracle, chairman) completes
|
|
128
|
+
* its run, with the accumulated cost for that member (Task I.1, v3-I).
|
|
129
|
+
* The same payload is also yielded as a `member_cost` BrainEvent in the
|
|
130
|
+
* main event stream so JSONL sidecars and live consumers stay consistent.
|
|
131
|
+
*
|
|
132
|
+
* When the provider does not send `usage` (some don't honor
|
|
133
|
+
* `stream_options.include_usage`), the token fields are 0. Tool calls
|
|
134
|
+
* are counted from `tool_execution_start` events. Duration is wall-clock
|
|
135
|
+
* around the member's AgentHarness run.
|
|
136
|
+
*/
|
|
137
|
+
onMemberCost?: (cost: {
|
|
138
|
+
memberId: string;
|
|
139
|
+
name: string;
|
|
140
|
+
promptTokens: number;
|
|
141
|
+
completionTokens: number;
|
|
142
|
+
totalTokens: number;
|
|
143
|
+
durationMs: number;
|
|
144
|
+
toolCalls: number;
|
|
145
|
+
errored: boolean;
|
|
146
|
+
}) => void;
|
|
147
|
+
}
|
|
148
|
+
export interface ClarificationRequest {
|
|
149
|
+
question: string;
|
|
150
|
+
choices?: string[];
|
|
151
|
+
context?: string;
|
|
152
|
+
}
|
|
153
|
+
export declare function parseClarificationRequest(text: string): ClarificationRequest | null;
|
|
154
|
+
export declare function parseThinking(text: string): string;
|
|
155
|
+
export declare function cleanAgentContent(text: string): string;
|
|
156
|
+
/**
|
|
157
|
+
* PURE council orchestration. Loops through specialists, optionally runs
|
|
158
|
+
* the oracle (debate mode), then runs the chairman synthesis.
|
|
159
|
+
*
|
|
160
|
+
* Each agent invocation creates an AgentHarness internally that consumes
|
|
161
|
+
* the providerStream and emits BrainEvents. The orchestrator aggregates
|
|
162
|
+
* text deltas into a single message per agent.
|
|
163
|
+
*
|
|
164
|
+
* Returns AsyncIterable<BrainEvent> for the full council run.
|
|
165
|
+
*/
|
|
166
|
+
export declare function runCouncilPure(userMessage: string, config: PureCouncilConfig, callbacks?: PureCouncilCallbacks): AsyncIterable<BrainEvent>;
|
|
167
|
+
export interface ToolEmissionRequirement {
|
|
168
|
+
/** Tool name, e.g. 'createDocument'. */
|
|
169
|
+
name: string;
|
|
170
|
+
/** Minimum number of times this tool must have been emitted. */
|
|
171
|
+
min: number;
|
|
172
|
+
}
|
|
173
|
+
export interface ToolEmissionCheckResult {
|
|
174
|
+
/** True when every requirement is satisfied. */
|
|
175
|
+
ok: boolean;
|
|
176
|
+
/** Human-readable list of unmet requirements (empty when ok=true). */
|
|
177
|
+
missing: string[];
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Pure helper: given the list of tool names a member emitted during its
|
|
181
|
+
* turn, and a list of requirements, return whether all requirements are
|
|
182
|
+
* met.
|
|
183
|
+
*/
|
|
184
|
+
export declare function checkMemberToolEmissions(_memberId: string, emittedToolNames: string[], requirements: ToolEmissionRequirement[]): ToolEmissionCheckResult;
|
|
185
|
+
/**
|
|
186
|
+
* v0.7.8 — Per-member tool-emission requirement SETS for the design-phase
|
|
187
|
+
* council run. The outer array is an OR of alternatives: the member's turn
|
|
188
|
+
* is complete when ANY one set is fully satisfied. The FIRST set is the
|
|
189
|
+
* preferred contract — its unmet requirements drive the warning message
|
|
190
|
+
* and the forced-retry tool list.
|
|
191
|
+
*
|
|
192
|
+
* Nettuno has two ways to satisfy its contract:
|
|
193
|
+
* 1. (preferred) ONE `createPlan` batch call — phases + nested tasks +
|
|
194
|
+
* milestone in a single emission. Retry budget: 1 call, which
|
|
195
|
+
* composer-2.5 handles reliably (same shape as the Minosse/Lucifero
|
|
196
|
+
* retries that already work).
|
|
197
|
+
* 2. (legacy) the itemized trio — kept so stronger models (e.g. Opus)
|
|
198
|
+
* that emit createPhase/createTask/createMilestone directly are not
|
|
199
|
+
* flagged or retried.
|
|
200
|
+
*/
|
|
201
|
+
export declare const DESIGN_PHASE_REQUIREMENT_SETS: Record<string, ToolEmissionRequirement[][]>;
|
|
202
|
+
/**
|
|
203
|
+
* Preferred (first) requirement set per member — kept as the flat map the
|
|
204
|
+
* council loops pass to `applyRetryIfMissing` for the retry budget. For
|
|
205
|
+
* Nettuno this is `createPlan min 1`, so the forced retry advertises ONE
|
|
206
|
+
* tool with a 1-call budget instead of the old 13+-call itemized contract.
|
|
207
|
+
*/
|
|
208
|
+
export declare const DESIGN_PHASE_REQUIREMENTS: Record<string, ToolEmissionRequirement[]>;
|
|
209
|
+
/**
|
|
210
|
+
* Pure helper: OR-of-sets variant of {@link checkMemberToolEmissions}.
|
|
211
|
+
* Returns ok when ANY set is fully satisfied. When none is, the missing
|
|
212
|
+
* list reflects the FIRST (preferred) set so the warning and the retry
|
|
213
|
+
* point the model at the cheapest way to comply.
|
|
214
|
+
*/
|
|
215
|
+
export declare function checkMemberToolEmissionSets(memberId: string, emittedToolNames: string[], sets: ToolEmissionRequirement[][]): ToolEmissionCheckResult;
|
|
216
|
+
/**
|
|
217
|
+
* Run the post-condition check for a member and emit a console.warn when
|
|
218
|
+
* any required tool was not emitted the minimum number of times. Returns
|
|
219
|
+
* the check result so callers can act on it (Pass 3 may add automatic
|
|
220
|
+
* retry; for now we only warn).
|
|
221
|
+
*/
|
|
222
|
+
export declare function enforceDesignPhaseToolEmissions(memberId: string, emittedToolNames: string[]): ToolEmissionCheckResult;
|
|
223
|
+
/**
|
|
224
|
+
* Maximum number of forced retry turns per council member. Cap of 1
|
|
225
|
+
* keeps the worst-case council latency bounded (a single extra turn per
|
|
226
|
+
* member × 4 design-phase members ≈ 30-60 s on top of the base run).
|
|
227
|
+
* Going above 1 tends to produce hallucinated tool arguments because
|
|
228
|
+
* the model has already spent its "tool budget" on exploration.
|
|
229
|
+
*/
|
|
230
|
+
export declare const MAX_RETRY_PER_MEMBER = 1;
|
|
231
|
+
/**
|
|
232
|
+
* Pure helper: should the council loop spin up one more forced turn for
|
|
233
|
+
* this member to recover the missing tool emissions?
|
|
234
|
+
*
|
|
235
|
+
* Returns true when:
|
|
236
|
+
* - at least one tool is still missing after the post-condition check, AND
|
|
237
|
+
* - the retry budget for this member has not been exhausted.
|
|
238
|
+
*
|
|
239
|
+
* Returns false otherwise. Tested as a pure function so the council
|
|
240
|
+
* loop can branch on the answer without coupling to AgentHarness.
|
|
241
|
+
*/
|
|
242
|
+
export declare function shouldRetryMember(missingToolNames: string[], attemptsSoFar: number): boolean;
|
|
243
|
+
/**
|
|
244
|
+
* Build the one-line prompt that the retry turn sends to the model.
|
|
245
|
+
* The shape matters: the model is primed by its role prompt to produce
|
|
246
|
+
* prose, so the retry prompt must be unambiguous, imperative, and
|
|
247
|
+
* scoped to ONLY the missing tools.
|
|
248
|
+
*
|
|
249
|
+
* Format: "You did not emit: <names>. Call <names> NOW with concrete
|
|
250
|
+
* arguments. No prose."
|
|
251
|
+
*
|
|
252
|
+
* Multiple tools are listed comma-separated in the same call so the
|
|
253
|
+
* model can satisfy them in a single tool_calls turn (which is the
|
|
254
|
+
* cheapest path through AgentHarness).
|
|
255
|
+
*/
|
|
256
|
+
export declare function buildRetryPrompt(missingToolNames: string[]): string;
|
|
257
|
+
export declare function runRetryTurnForMember(args: {
|
|
258
|
+
agent: AgentRole;
|
|
259
|
+
missingToolNames: string[];
|
|
260
|
+
/**
|
|
261
|
+
* Per-tool minimum emission count. The retry budget is the SUM of these
|
|
262
|
+
* values (not just the number of distinct missing tools), because
|
|
263
|
+
* requirements like `createTask min: 12` need 12 separate calls even
|
|
264
|
+
* though only 1 distinct tool is missing. If omitted, the budget
|
|
265
|
+
* defaults to `missingToolNames.length` (suitable for tools like
|
|
266
|
+
* createDocument that need only one call).
|
|
267
|
+
*/
|
|
268
|
+
minPerTool?: Record<string, number>;
|
|
269
|
+
executableTools: ReadonlySet<string> | null;
|
|
270
|
+
userMessage: string;
|
|
271
|
+
ragContext: string;
|
|
272
|
+
workspaceContext: string;
|
|
273
|
+
priorOutputs: {
|
|
274
|
+
name: string;
|
|
275
|
+
role: string;
|
|
276
|
+
content: string;
|
|
277
|
+
}[];
|
|
278
|
+
aiConfig?: SystemPromptConfig;
|
|
279
|
+
sessionId: string;
|
|
280
|
+
effectiveModel: string;
|
|
281
|
+
effectiveProvider: string;
|
|
282
|
+
eventBus?: BrainEvent['sessionId'] extends string ? unknown : never;
|
|
283
|
+
toolRegistry?: unknown;
|
|
284
|
+
providerStream: ProviderStreamFn;
|
|
285
|
+
runMode?: CouncilRunMode;
|
|
286
|
+
}): AsyncGenerator<BrainEvent, string[], void>;
|
|
287
|
+
/**
|
|
288
|
+
* Shared retry orchestrator used by specialist, oracle, and chairman
|
|
289
|
+
* loops. Given the post-condition check result, decides whether to
|
|
290
|
+
* spin up a forced retry turn, and if so yields the events from that
|
|
291
|
+
* turn back to the caller (so the UI sees them) while mutating the
|
|
292
|
+
* shared `emittedToolNames` array (so the next post-condition check
|
|
293
|
+
* sees the union of original + retry emissions).
|
|
294
|
+
*
|
|
295
|
+
* The retry turn is skipped when:
|
|
296
|
+
* - the check passed (no missing tools), OR
|
|
297
|
+
* - the retry budget for this member is exhausted (shouldRetryMember).
|
|
298
|
+
*
|
|
299
|
+
* On retry failure (network error, model error, etc.) the function logs
|
|
300
|
+
* the error and continues — it never throws. The next post-condition
|
|
301
|
+
* check will simply re-warn.
|
|
302
|
+
*/
|
|
303
|
+
export declare function applyRetryIfMissing(args: {
|
|
304
|
+
agent: AgentRole;
|
|
305
|
+
check: ToolEmissionCheckResult;
|
|
306
|
+
/**
|
|
307
|
+
* Original per-member requirements. Used to compute the retry budget
|
|
308
|
+
* (sum of `min` for each missing tool) so the model can satisfy all
|
|
309
|
+
* minimums in one tool_calls turn. If omitted, defaults to 1 per
|
|
310
|
+
* distinct missing tool.
|
|
311
|
+
*/
|
|
312
|
+
requirements?: ToolEmissionRequirement[];
|
|
313
|
+
emittedToolNames: string[];
|
|
314
|
+
executableNames: ReadonlySet<string> | null;
|
|
315
|
+
sessionId: string;
|
|
316
|
+
userMessage: string;
|
|
317
|
+
agentOutputs: {
|
|
318
|
+
name: string;
|
|
319
|
+
role: string;
|
|
320
|
+
content: string;
|
|
321
|
+
}[];
|
|
322
|
+
config: PureCouncilConfig;
|
|
323
|
+
effectiveProvider: string;
|
|
324
|
+
effectiveModel: string;
|
|
325
|
+
/** Callback to bump the per-member tool-call counter on each retry emission. */
|
|
326
|
+
onToolCall: () => void;
|
|
327
|
+
}): AsyncGenerator<BrainEvent, void, void>;
|
|
328
|
+
//# sourceMappingURL=councilApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"councilApi.d.ts","sourceRoot":"","sources":["../../src/agents/councilApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,qBAAqB,CAAC;AAEtE,OAAO,KAAK,EAGV,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI5D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAe,CAAC;AAEjE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,aAAa,GACd,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,MAAM,CAAC,CAAC,SAAS;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;CACnD;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,O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