@kernel.chat/kbot 3.95.0 → 3.97.1

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <p align="center">
4
4
  <strong>kbot</strong><br>
5
- Open-source terminal AI agent. 764+ tools. 35 agents. 20 providers. Dreams, learns, watches your system, controls your phone. $0 local.
5
+ Open-source terminal AI agent. 787+ tools. 35 agents. 20 providers. Dreams, learns, watches your system, controls your phone. $0 local.
6
6
  </p>
7
7
 
8
8
  <p align="center">
@@ -31,7 +31,7 @@ Most terminal AI agents lock you into one provider, one model, one way of workin
31
31
  - **Runs fully offline** — Embedded llama.cpp, Ollama, LM Studio, or Jan. $0, fully private.
32
32
  - **Learns your patterns** — Bayesian skill ratings + pattern extraction. Gets faster over time.
33
33
  - **35 specialist agents** — auto-routes your request to the right expert (coder, researcher, writer, guardian, quant, and 30 more).
34
- - **764+ tools** — files, bash, git, GitHub, web search, deploy, database, game dev, VFX, research, science, finance, security, music production, iPhone control, and more.
34
+ - **787+ tools** — files, bash, git, GitHub, web search, deploy, database, game dev, VFX, research, science, finance, security, music production, iPhone control, and more.
35
35
  - **Programmatic SDK** — use kbot as a library in your own apps.
36
36
  - **MCP server built in** — plug kbot into Claude Code, Cursor, VS Code, Zed, or Neovim as a tool provider.
37
37
 
@@ -142,7 +142,7 @@ Checks security, documentation, code quality, CI/CD, community health, and DevOp
142
142
  |---|---|---|---|---|---|
143
143
  | AI providers | 20 | 1 | 1 | 6 | 75+ |
144
144
  | Specialist agents | 35 | 0 | 0 | 0 | 0 |
145
- | Built-in tools | 764+ | ~20 | ~15 | ~10 | ~15 |
145
+ | Built-in tools | 787+ | ~20 | ~15 | ~10 | ~15 |
146
146
  | Science tools | 114 | 0 | 0 | 0 | 0 |
147
147
  | Memory system | 7-tier bidirectional | File-based | No | No | No |
148
148
  | Dream engine | Yes ($0 local) | Cloud API | No | No | No |
package/dist/agent.js CHANGED
@@ -54,6 +54,7 @@ import { generateReflections, getRelevantReflections, formatReflectionsForPrompt
54
54
  import { getSynthesisContext } from './memory-synthesis.js';
55
55
  import { getActiveCorrectionsPrompt } from './synthesis-engine.js';
56
56
  import { recordTrace, shouldEvolve, evolvePrompt, getPromptAmendment, updateMutationScore } from './prompt-evolution.js';
57
+ import { getCoordinator } from './coordinator.js';
57
58
  const MAX_TOOL_LOOPS = 75;
58
59
  /** Maximum cumulative cost (USD) before auto-stopping tool loops */
59
60
  const MAX_COST_CEILING = 1.00;
@@ -1102,6 +1103,18 @@ Always quote file paths that contain spaces. Never reference internal system nam
1102
1103
  const anticipated = anticipateNext([originalMessage], originalMessage);
1103
1104
  }
1104
1105
  catch { /* cognitive stack is non-critical — never block the agent loop */ }
1106
+ // ── Intelligence Coordinator: unified pre-processing ──
1107
+ let coordinatorContext = '';
1108
+ try {
1109
+ const coordinator = getCoordinator();
1110
+ const preResult = await coordinator.preProcess(originalMessage, sessionId);
1111
+ if (preResult.systemPromptAddition)
1112
+ coordinatorContext = preResult.systemPromptAddition;
1113
+ if (preResult.needsClarification) {
1114
+ telemetry.emit('tool_call_end', { tool: 'coordinator', duration_ms: 0, error: preResult.clarificationReason });
1115
+ }
1116
+ }
1117
+ catch { /* coordinator is non-critical */ }
1105
1118
  // Change 5: Apply cognitive policy to system prompt
1106
1119
  // explore → broader thinking, exploit → direct proven approaches
1107
1120
  try {
@@ -1115,6 +1128,8 @@ Always quote file paths that contain spaces. Never reference internal system nam
1115
1128
  if (cognitiveToolBias.preferred.length > 0) {
1116
1129
  systemContext += `\n\nPreferred tools based on learned patterns: ${cognitiveToolBias.preferred.join(', ')}`;
1117
1130
  }
1131
+ if (coordinatorContext)
1132
+ systemContext += `\n\n${coordinatorContext}`;
1118
1133
  }
1119
1134
  catch { /* cognitive prompt injection is non-critical */ }
1120
1135
  // ── Tool execution pipeline ──
@@ -1126,6 +1141,14 @@ Always quote file paths that contain spaces. Never reference internal system nam
1126
1141
  },
1127
1142
  runPostHook: (name, args, result) => { runPostToolHook(name, args, result, options.agent || 'kernel'); },
1128
1143
  executeTool: async (name, args) => {
1144
+ // Coordinator tool oversight
1145
+ try {
1146
+ const coord = getCoordinator();
1147
+ const eval_ = coord.evaluateToolCall(name, args);
1148
+ if (eval_.warn)
1149
+ process.stderr.write(`\n \x1b[2m[coordinator] ${eval_.warn}\x1b[0m\n`);
1150
+ }
1151
+ catch { /* non-critical */ }
1129
1152
  const r = await executeTool({ id: name, name, arguments: args });
1130
1153
  return { result: r.result, error: r.error ? r.result : undefined };
1131
1154
  },
@@ -1478,6 +1501,13 @@ Always quote file paths that contain spaces. Never reference internal system nam
1478
1501
  }
1479
1502
  catch { /* silent */ }
1480
1503
  }
1504
+ // ── Intelligence Coordinator: post-response self-evaluation ──
1505
+ try {
1506
+ const coord = getCoordinator();
1507
+ coord.postProcess(originalMessage, content, toolSequenceLog, sessionId)
1508
+ .catch(() => { });
1509
+ }
1510
+ catch { /* coordinator is non-critical */ }
1481
1511
  // ── Prompt Evolution (GEPA): record trace and evolve if threshold met ──
1482
1512
  try {
1483
1513
  const traceAgent = lastResponse.agent || 'kernel';
package/dist/cli.js CHANGED
@@ -102,7 +102,7 @@ async function main() {
102
102
  console.log(` ${chalk.cyan('https://github.com/isaacsight/kernel/issues')} ${chalk.dim('Bug reports')}`);
103
103
  console.log(` ${chalk.cyan('support@kernel.chat')} ${chalk.dim('Email (AI-assisted replies)')}`);
104
104
  console.log();
105
- console.log(` ${chalk.dim('35 specialist agents · 360+ tools · 20 providers · MIT licensed')}`);
105
+ console.log(` ${chalk.dim('35 specialist agents · 787+ tools · 20 providers · MIT licensed')}`);
106
106
  console.log();
107
107
  process.exit(0);
108
108
  });
@@ -0,0 +1,164 @@
1
+ export interface Goal {
2
+ id: string;
3
+ description: string;
4
+ priority: number;
5
+ status: 'active' | 'completed' | 'abandoned';
6
+ created: string;
7
+ toolsUsed: string[];
8
+ }
9
+ export interface Insight {
10
+ id: string;
11
+ content: string;
12
+ source: string;
13
+ confidence: number;
14
+ timestamp: string;
15
+ }
16
+ export interface Conflict {
17
+ modules: [string, string];
18
+ description: string;
19
+ resolution: string | null;
20
+ timestamp: string;
21
+ }
22
+ export interface SelfEval {
23
+ sessionId: string;
24
+ messageHash: string;
25
+ score: number;
26
+ toolSuccessRate: number;
27
+ responseAppropriate: boolean;
28
+ patternsMatched: number;
29
+ timestamp: string;
30
+ }
31
+ export interface PreProcessResult {
32
+ agent: string | null;
33
+ confidence: number;
34
+ graphContext: string;
35
+ reasoning: string;
36
+ toolHints: string[];
37
+ systemPromptAddition: string;
38
+ needsClarification: boolean;
39
+ clarificationReason?: string;
40
+ drives: {
41
+ dominant: string;
42
+ level: number;
43
+ } | null;
44
+ anticipation: string | null;
45
+ }
46
+ export interface ToolEvaluation {
47
+ allow: boolean;
48
+ warn?: string;
49
+ alternatives?: string[];
50
+ anticipated: boolean;
51
+ }
52
+ export interface PostProcessResult {
53
+ score: number;
54
+ patternsExtracted: number;
55
+ insightsGenerated: number;
56
+ graphUpdates: number;
57
+ consolidationTriggered: boolean;
58
+ }
59
+ export interface ConsolidationResult {
60
+ patternsConsolidated: number;
61
+ rulesAdded: number;
62
+ insightsFound: number;
63
+ graphPruned: {
64
+ nodes: number;
65
+ edges: number;
66
+ };
67
+ routingAccuracy: number;
68
+ }
69
+ export interface CoordinatorStats {
70
+ totalInteractions: number;
71
+ successRate: number;
72
+ patternsLearnedToday: number;
73
+ routingAccuracy: number;
74
+ activeGoals: number;
75
+ recentInsights: number;
76
+ conflicts: number;
77
+ lastConsolidation: string | null;
78
+ policy: 'explore' | 'exploit' | 'balanced';
79
+ confidenceThreshold: number;
80
+ uptimeMs: number;
81
+ }
82
+ export interface CoordinatorState {
83
+ lastPolicy: 'explore' | 'exploit' | 'balanced';
84
+ confidenceThreshold: number;
85
+ totalInteractions: number;
86
+ successRate: number;
87
+ activeGoals: Goal[];
88
+ recentInsights: Insight[];
89
+ conflictLog: Conflict[];
90
+ evalHistory: SelfEval[];
91
+ patternsLearnedToday: number;
92
+ patternsLearnedDate: string;
93
+ routingAccuracy: number;
94
+ lastConsolidation: string | null;
95
+ startedAt: string;
96
+ }
97
+ export declare class IntelligenceCoordinator {
98
+ private state;
99
+ private anticipatedTools;
100
+ private currentSessionId;
101
+ private pendingRouteAgent;
102
+ private initTime;
103
+ constructor();
104
+ preProcess(message: string, sessionId: string): Promise<PreProcessResult>;
105
+ evaluateToolCall(toolName: string, args: Record<string, unknown>, _context?: {
106
+ sessionId?: string;
107
+ agent?: string;
108
+ message?: string;
109
+ }): ToolEvaluation;
110
+ postProcess(message: string, response: string, toolsUsed: string[], sessionId: string): Promise<PostProcessResult>;
111
+ consolidate(): Promise<ConsolidationResult>;
112
+ private selfEvaluate;
113
+ private synthesizePolicy;
114
+ private logToolToGraph;
115
+ private addInsight;
116
+ addGoal(description: string, priority?: number): Goal;
117
+ completeGoal(goalId: string): void;
118
+ recordConflict(modules: [string, string], description: string, resolution?: string): void;
119
+ load(): void;
120
+ save(): void;
121
+ getStats(): CoordinatorStats;
122
+ getHealthReport(): string;
123
+ getState(): Readonly<CoordinatorState>;
124
+ /** Adjust the confidence threshold (e.g., user prefers fewer clarification requests) */
125
+ setConfidenceThreshold(threshold: number): void;
126
+ /** Reset all state (for testing or fresh start) */
127
+ reset(): void;
128
+ }
129
+ export declare function getCoordinator(): IntelligenceCoordinator;
130
+ /** Register coordinator tools with the kbot tool registry */
131
+ export declare function registerCoordinatorTools(): void;
132
+ export interface Task {
133
+ id: string;
134
+ goal: string;
135
+ status: 'pending' | 'running' | 'done' | 'failed';
136
+ agent: string;
137
+ dependencies: string[];
138
+ result?: string;
139
+ error?: string;
140
+ }
141
+ export interface CoordinatorPlan {
142
+ id: string;
143
+ goal: string;
144
+ tasks: Task[];
145
+ createdAt: string;
146
+ completedAt?: string;
147
+ status: 'planning' | 'executing' | 'done' | 'failed';
148
+ }
149
+ /**
150
+ * Decompose a high-level goal into ordered sub-tasks with dependencies.
151
+ * Uses the LLM (via runAgent) to break the goal into 2-6 concrete tasks.
152
+ */
153
+ export declare function decompose(goal: string): Promise<CoordinatorPlan>;
154
+ /**
155
+ * Execute a plan's tasks in dependency order (sequential for now).
156
+ * Tasks whose dependencies are all 'done' are eligible to run.
157
+ */
158
+ export declare function execute(plan: CoordinatorPlan): Promise<CoordinatorPlan>;
159
+ /**
160
+ * Convenience: decompose a goal, execute the plan, and synthesize results.
161
+ * Returns a human-readable summary of what was accomplished.
162
+ */
163
+ export declare function coordinate(goal: string): Promise<string>;
164
+ //# sourceMappingURL=coordinator.d.ts.map