@kernel.chat/kbot 2.21.0 → 2.22.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/dist/autopoiesis.d.ts +93 -0
- package/dist/autopoiesis.d.ts.map +1 -0
- package/dist/autopoiesis.js +222 -0
- package/dist/autopoiesis.js.map +1 -0
- package/dist/cli.js +8 -7
- package/dist/cli.js.map +1 -1
- package/dist/free-energy.d.ts +95 -0
- package/dist/free-energy.d.ts.map +1 -0
- package/dist/free-energy.js +180 -0
- package/dist/free-energy.js.map +1 -0
- package/dist/integrated-information.d.ts +56 -0
- package/dist/integrated-information.d.ts.map +1 -0
- package/dist/integrated-information.js +165 -0
- package/dist/integrated-information.js.map +1 -0
- package/dist/predictive-processing.d.ts +79 -0
- package/dist/predictive-processing.d.ts.map +1 -0
- package/dist/predictive-processing.js +250 -0
- package/dist/predictive-processing.js.map +1 -0
- package/dist/strange-loops.d.ts +89 -0
- package/dist/strange-loops.d.ts.map +1 -0
- package/dist/strange-loops.js +199 -0
- package/dist/strange-loops.js.map +1 -0
- package/dist/tutorial.d.ts.map +1 -1
- package/dist/tutorial.js +11 -8
- package/dist/tutorial.js.map +1 -1
- package/dist/ui.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export interface SystemComponent {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
type: 'provider' | 'tool' | 'memory' | 'model' | 'connection';
|
|
5
|
+
status: 'healthy' | 'degraded' | 'failed' | 'unknown';
|
|
6
|
+
lastChecked: number;
|
|
7
|
+
failureCount: number;
|
|
8
|
+
/** How critical is this component? 0-1 */
|
|
9
|
+
criticality: number;
|
|
10
|
+
/** Can the system compensate if this fails? */
|
|
11
|
+
compensable: boolean;
|
|
12
|
+
/** What compensates for this component */
|
|
13
|
+
fallback?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface HealthReport {
|
|
16
|
+
/** Overall system viability (0-1) */
|
|
17
|
+
viability: number;
|
|
18
|
+
/** Components by status */
|
|
19
|
+
healthy: string[];
|
|
20
|
+
degraded: string[];
|
|
21
|
+
failed: string[];
|
|
22
|
+
/** Self-healing actions taken */
|
|
23
|
+
healingActions: string[];
|
|
24
|
+
/** Is the system in a viable state? */
|
|
25
|
+
isViable: boolean;
|
|
26
|
+
/** Boundary integrity: are internal/external correctly distinguished? */
|
|
27
|
+
boundaryIntact: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface AdaptiveResponse {
|
|
30
|
+
/** Action taken to maintain viability */
|
|
31
|
+
action: string;
|
|
32
|
+
/** Component affected */
|
|
33
|
+
component: string;
|
|
34
|
+
/** Was the action successful? */
|
|
35
|
+
success: boolean;
|
|
36
|
+
/** New state after action */
|
|
37
|
+
newStatus: SystemComponent['status'];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Autopoietic System — self-maintaining operational integrity.
|
|
41
|
+
*
|
|
42
|
+
* The system continuously:
|
|
43
|
+
* 1. Monitors its own components (providers, tools, memory, models)
|
|
44
|
+
* 2. Detects degradation before failure
|
|
45
|
+
* 3. Self-heals by activating fallbacks
|
|
46
|
+
* 4. Maintains its operational boundary
|
|
47
|
+
*
|
|
48
|
+
* If viability drops below threshold, it signals for external help
|
|
49
|
+
* rather than continuing in a degraded state.
|
|
50
|
+
*/
|
|
51
|
+
export declare class AutopoieticSystem {
|
|
52
|
+
private components;
|
|
53
|
+
private healingLog;
|
|
54
|
+
private readonly viabilityThreshold;
|
|
55
|
+
constructor();
|
|
56
|
+
/** Register the core components that constitute kbot */
|
|
57
|
+
private initializeComponents;
|
|
58
|
+
/**
|
|
59
|
+
* Report a component's health status.
|
|
60
|
+
* Called by the agent loop after each operation.
|
|
61
|
+
*/
|
|
62
|
+
reportHealth(componentId: string, healthy: boolean): void;
|
|
63
|
+
/**
|
|
64
|
+
* Attempt self-healing for a degraded or failed component.
|
|
65
|
+
* Returns the adaptive response taken.
|
|
66
|
+
*/
|
|
67
|
+
selfHeal(componentId: string): AdaptiveResponse | null;
|
|
68
|
+
/**
|
|
69
|
+
* Compute overall system viability.
|
|
70
|
+
* Weighted average of component health, weighted by criticality.
|
|
71
|
+
*/
|
|
72
|
+
computeViability(): number;
|
|
73
|
+
/**
|
|
74
|
+
* Full health check — assess all components, self-heal if needed.
|
|
75
|
+
*/
|
|
76
|
+
healthCheck(): HealthReport;
|
|
77
|
+
/**
|
|
78
|
+
* Should the agent continue operating, or signal for help?
|
|
79
|
+
*/
|
|
80
|
+
shouldContinue(): {
|
|
81
|
+
continue: boolean;
|
|
82
|
+
reason?: string;
|
|
83
|
+
};
|
|
84
|
+
/** Get the healing log */
|
|
85
|
+
getHealingLog(): AdaptiveResponse[];
|
|
86
|
+
/** Get a specific component's status */
|
|
87
|
+
getComponent(id: string): SystemComponent | undefined;
|
|
88
|
+
/** Register a new component (e.g., when an MCP server connects) */
|
|
89
|
+
registerComponent(component: Omit<SystemComponent, 'status' | 'lastChecked' | 'failureCount'>): void;
|
|
90
|
+
/** Reset for new session */
|
|
91
|
+
reset(): void;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=autopoiesis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autopoiesis.d.ts","sourceRoot":"","sources":["../src/autopoiesis.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAA;IAC7D,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAA;IACrD,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,0CAA0C;IAC1C,WAAW,EAAE,MAAM,CAAA;IACnB,+CAA+C;IAC/C,WAAW,EAAE,OAAO,CAAA;IACpB,0CAA0C;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ACxC,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAIrD,mEAAmE;IACnE,iBAAiB,CAAC,SAAS,EAAE,IAAI,CAAC,eAAe,EAAE,QAAQ,GAAG,aAAa,GAAG,cAAc,CAAC,GAAG,IAAI;IASpG,4BAA4B;IAC5B,KAAK,IAAI,IAAI;CAQd"}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
// K:BOT Autopoiesis — Self-Maintaining System
|
|
2
|
+
//
|
|
3
|
+
// Based on Maturana & Varela's Autopoiesis theory (1972):
|
|
4
|
+
// Living systems are "self-making" — they continuously produce and
|
|
5
|
+
// maintain the components that constitute them. An autopoietic system
|
|
6
|
+
// is organizationally closed but structurally coupled to its environment.
|
|
7
|
+
//
|
|
8
|
+
// For kbot: the agent monitors its own health, detects degradation,
|
|
9
|
+
// self-heals broken components, and maintains its operational boundary.
|
|
10
|
+
// kbot doesn't just run — it actively maintains its ability to run.
|
|
11
|
+
//
|
|
12
|
+
// References:
|
|
13
|
+
// - Maturana, H.R. & Varela, F.J. (1980). Autopoiesis and Cognition.
|
|
14
|
+
// - Varela, F.J. (1979). Principles of Biological Autonomy.
|
|
15
|
+
// - Thompson, E. (2007). Mind in Life: Biology, Phenomenology, and the Sciences of Mind.
|
|
16
|
+
// - Di Paolo, E.A. (2005). Autopoiesis, adaptivity, teleology, agency.
|
|
17
|
+
/**
|
|
18
|
+
* Autopoietic System — self-maintaining operational integrity.
|
|
19
|
+
*
|
|
20
|
+
* The system continuously:
|
|
21
|
+
* 1. Monitors its own components (providers, tools, memory, models)
|
|
22
|
+
* 2. Detects degradation before failure
|
|
23
|
+
* 3. Self-heals by activating fallbacks
|
|
24
|
+
* 4. Maintains its operational boundary
|
|
25
|
+
*
|
|
26
|
+
* If viability drops below threshold, it signals for external help
|
|
27
|
+
* rather than continuing in a degraded state.
|
|
28
|
+
*/
|
|
29
|
+
export class AutopoieticSystem {
|
|
30
|
+
components = new Map();
|
|
31
|
+
healingLog = [];
|
|
32
|
+
viabilityThreshold = 0.4;
|
|
33
|
+
constructor() {
|
|
34
|
+
this.initializeComponents();
|
|
35
|
+
}
|
|
36
|
+
/** Register the core components that constitute kbot */
|
|
37
|
+
initializeComponents() {
|
|
38
|
+
const defaults = [
|
|
39
|
+
// Providers
|
|
40
|
+
{ id: 'anthropic', name: 'Anthropic API', type: 'provider', criticality: 0.9, compensable: true, fallback: 'openai' },
|
|
41
|
+
{ id: 'openai', name: 'OpenAI API', type: 'provider', criticality: 0.7, compensable: true, fallback: 'ollama' },
|
|
42
|
+
{ id: 'ollama', name: 'Ollama (local)', type: 'provider', criticality: 0.5, compensable: true, fallback: 'embedded' },
|
|
43
|
+
{ id: 'embedded', name: 'Embedded llama.cpp', type: 'model', criticality: 0.4, compensable: false },
|
|
44
|
+
// Core tools
|
|
45
|
+
{ id: 'filesystem', name: 'File System Access', type: 'tool', criticality: 1.0, compensable: false },
|
|
46
|
+
{ id: 'bash', name: 'Shell Execution', type: 'tool', criticality: 0.9, compensable: false },
|
|
47
|
+
{ id: 'git', name: 'Git Operations', type: 'tool', criticality: 0.7, compensable: false },
|
|
48
|
+
// Memory
|
|
49
|
+
{ id: 'local-memory', name: 'Local Memory (~/.kbot/memory/)', type: 'memory', criticality: 0.6, compensable: true, fallback: 'session-context' },
|
|
50
|
+
{ id: 'session-context', name: 'Session Context', type: 'memory', criticality: 0.8, compensable: false },
|
|
51
|
+
// External connections
|
|
52
|
+
{ id: 'internet', name: 'Internet Connectivity', type: 'connection', criticality: 0.5, compensable: true, fallback: 'ollama' },
|
|
53
|
+
{ id: 'mcp-servers', name: 'MCP Server Connections', type: 'connection', criticality: 0.3, compensable: true },
|
|
54
|
+
];
|
|
55
|
+
for (const d of defaults) {
|
|
56
|
+
this.components.set(d.id, {
|
|
57
|
+
...d,
|
|
58
|
+
status: 'unknown',
|
|
59
|
+
lastChecked: 0,
|
|
60
|
+
failureCount: 0,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Report a component's health status.
|
|
66
|
+
* Called by the agent loop after each operation.
|
|
67
|
+
*/
|
|
68
|
+
reportHealth(componentId, healthy) {
|
|
69
|
+
const comp = this.components.get(componentId);
|
|
70
|
+
if (!comp)
|
|
71
|
+
return;
|
|
72
|
+
comp.lastChecked = Date.now();
|
|
73
|
+
if (healthy) {
|
|
74
|
+
comp.status = 'healthy';
|
|
75
|
+
// Gradually reduce failure count on success
|
|
76
|
+
comp.failureCount = Math.max(0, comp.failureCount - 1);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
comp.failureCount++;
|
|
80
|
+
comp.status = comp.failureCount >= 3 ? 'failed' : 'degraded';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Attempt self-healing for a degraded or failed component.
|
|
85
|
+
* Returns the adaptive response taken.
|
|
86
|
+
*/
|
|
87
|
+
selfHeal(componentId) {
|
|
88
|
+
const comp = this.components.get(componentId);
|
|
89
|
+
if (!comp || comp.status === 'healthy')
|
|
90
|
+
return null;
|
|
91
|
+
// If compensable, activate fallback
|
|
92
|
+
if (comp.compensable && comp.fallback) {
|
|
93
|
+
const fallback = this.components.get(comp.fallback);
|
|
94
|
+
if (fallback && fallback.status !== 'failed') {
|
|
95
|
+
const response = {
|
|
96
|
+
action: `Activated fallback: ${comp.name} → ${fallback.name}`,
|
|
97
|
+
component: componentId,
|
|
98
|
+
success: true,
|
|
99
|
+
newStatus: 'degraded',
|
|
100
|
+
};
|
|
101
|
+
comp.status = 'degraded';
|
|
102
|
+
this.healingLog.push(response);
|
|
103
|
+
return response;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// If not compensable, report inability to self-heal
|
|
107
|
+
const response = {
|
|
108
|
+
action: `Cannot self-heal: ${comp.name} has no viable fallback`,
|
|
109
|
+
component: componentId,
|
|
110
|
+
success: false,
|
|
111
|
+
newStatus: comp.status,
|
|
112
|
+
};
|
|
113
|
+
this.healingLog.push(response);
|
|
114
|
+
return response;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Compute overall system viability.
|
|
118
|
+
* Weighted average of component health, weighted by criticality.
|
|
119
|
+
*/
|
|
120
|
+
computeViability() {
|
|
121
|
+
let weightedHealth = 0;
|
|
122
|
+
let totalWeight = 0;
|
|
123
|
+
for (const comp of this.components.values()) {
|
|
124
|
+
const healthScore = comp.status === 'healthy' ? 1.0 :
|
|
125
|
+
comp.status === 'degraded' ? 0.5 :
|
|
126
|
+
comp.status === 'failed' ? 0.0 : 0.3; // unknown
|
|
127
|
+
weightedHealth += healthScore * comp.criticality;
|
|
128
|
+
totalWeight += comp.criticality;
|
|
129
|
+
}
|
|
130
|
+
return totalWeight > 0 ? weightedHealth / totalWeight : 0;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Full health check — assess all components, self-heal if needed.
|
|
134
|
+
*/
|
|
135
|
+
healthCheck() {
|
|
136
|
+
const healthy = [];
|
|
137
|
+
const degraded = [];
|
|
138
|
+
const failed = [];
|
|
139
|
+
const healingActions = [];
|
|
140
|
+
for (const [id, comp] of this.components) {
|
|
141
|
+
switch (comp.status) {
|
|
142
|
+
case 'healthy':
|
|
143
|
+
healthy.push(comp.name);
|
|
144
|
+
break;
|
|
145
|
+
case 'degraded':
|
|
146
|
+
degraded.push(comp.name);
|
|
147
|
+
// Attempt self-healing for degraded components
|
|
148
|
+
const healResult = this.selfHeal(id);
|
|
149
|
+
if (healResult)
|
|
150
|
+
healingActions.push(healResult.action);
|
|
151
|
+
break;
|
|
152
|
+
case 'failed':
|
|
153
|
+
failed.push(comp.name);
|
|
154
|
+
// Attempt self-healing for failed components
|
|
155
|
+
const failHeal = this.selfHeal(id);
|
|
156
|
+
if (failHeal)
|
|
157
|
+
healingActions.push(failHeal.action);
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const viability = this.computeViability();
|
|
162
|
+
// Boundary check: are we correctly distinguishing internal from external?
|
|
163
|
+
const internalOk = ['filesystem', 'session-context'].every(id => {
|
|
164
|
+
const c = this.components.get(id);
|
|
165
|
+
return c && c.status !== 'failed';
|
|
166
|
+
});
|
|
167
|
+
return {
|
|
168
|
+
viability,
|
|
169
|
+
healthy,
|
|
170
|
+
degraded,
|
|
171
|
+
failed,
|
|
172
|
+
healingActions,
|
|
173
|
+
isViable: viability >= this.viabilityThreshold,
|
|
174
|
+
boundaryIntact: internalOk,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Should the agent continue operating, or signal for help?
|
|
179
|
+
*/
|
|
180
|
+
shouldContinue() {
|
|
181
|
+
const viability = this.computeViability();
|
|
182
|
+
if (viability < this.viabilityThreshold) {
|
|
183
|
+
return {
|
|
184
|
+
continue: false,
|
|
185
|
+
reason: `System viability critically low (${(viability * 100).toFixed(0)}%). Core components degraded.`,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
// Check if filesystem is available (absolute requirement)
|
|
189
|
+
const fs = this.components.get('filesystem');
|
|
190
|
+
if (fs && fs.status === 'failed') {
|
|
191
|
+
return { continue: false, reason: 'File system access lost — cannot operate.' };
|
|
192
|
+
}
|
|
193
|
+
return { continue: true };
|
|
194
|
+
}
|
|
195
|
+
/** Get the healing log */
|
|
196
|
+
getHealingLog() {
|
|
197
|
+
return [...this.healingLog];
|
|
198
|
+
}
|
|
199
|
+
/** Get a specific component's status */
|
|
200
|
+
getComponent(id) {
|
|
201
|
+
return this.components.get(id);
|
|
202
|
+
}
|
|
203
|
+
/** Register a new component (e.g., when an MCP server connects) */
|
|
204
|
+
registerComponent(component) {
|
|
205
|
+
this.components.set(component.id, {
|
|
206
|
+
...component,
|
|
207
|
+
status: 'unknown',
|
|
208
|
+
lastChecked: 0,
|
|
209
|
+
failureCount: 0,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
/** Reset for new session */
|
|
213
|
+
reset() {
|
|
214
|
+
for (const comp of this.components.values()) {
|
|
215
|
+
comp.status = 'unknown';
|
|
216
|
+
comp.failureCount = 0;
|
|
217
|
+
comp.lastChecked = 0;
|
|
218
|
+
}
|
|
219
|
+
this.healingLog = [];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=autopoiesis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autopoiesis.js","sourceRoot":"","sources":["../src/autopoiesis.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,EAAE;AACF,0DAA0D;AAC1D,mEAAmE;AACnE,sEAAsE;AACtE,0EAA0E;AAC1E,EAAE;AACF,oEAAoE;AACpE,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,cAAc;AACd,uEAAuE;AACvE,8DAA8D;AAC9D,2FAA2F;AAC3F,yEAAyE;AA2CzE;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,iBAAiB;IACpB,UAAU,GAAG,IAAI,GAAG,EAA2B,CAAA;IAC/C,UAAU,GAAuB,EAAE,CAAA;IAC1B,kBAAkB,GAAG,GAAG,CAAA;IAEzC;QACE,IAAI,CAAC,oBAAoB,EAAE,CAAA;IAC7B,CAAC;IAED,wDAAwD;IAChD,oBAAoB;QAC1B,MAAM,QAAQ,GAA4E;YACxF,YAAY;YACZ,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE;YACrH,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE;YAC/G,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EA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2E;QAC3F,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE;YAChC,GAAG,SAAS;YACZ,MAAM,EAAE,SAAS;YACjB,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,CAAC;SAChB,CAAC,CAAA;IACJ,CAAC;IAED,4BAA4B;IAC5B,KAAK;QACH,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;YAC5C,IAAI,CAAC,MAAM,GAAG,SAAS,CAAA;YACvB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAA;YACrB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAA;QACtB,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,EAAE,CAAA;IACtB,CAAC;CACF"}
|
package/dist/cli.js
CHANGED
|
@@ -34,7 +34,7 @@ async function main() {
|
|
|
34
34
|
.name('kbot')
|
|
35
35
|
.description('K:BOT — Open-source terminal AI agent. Bring your own key, pick your model, run locally.')
|
|
36
36
|
.version(VERSION)
|
|
37
|
-
.option('-a, --agent <agent>', 'Force a specific agent (
|
|
37
|
+
.option('-a, --agent <agent>', 'Force a specific agent (run kbot agents to see all 22)')
|
|
38
38
|
.option('-m, --model <model>', 'Override AI model (auto, sonnet, haiku)')
|
|
39
39
|
.option('-s, --stream', 'Stream the response')
|
|
40
40
|
.option('-p, --pipe', 'Pipe mode — raw text output for scripting')
|
|
@@ -100,7 +100,7 @@ async function main() {
|
|
|
100
100
|
});
|
|
101
101
|
program
|
|
102
102
|
.command('byok')
|
|
103
|
-
.description('Bring Your Own Key — configure your LLM API key (
|
|
103
|
+
.description('Bring Your Own Key — configure your LLM API key (20 providers)')
|
|
104
104
|
.option('--off', 'Disable BYOK mode')
|
|
105
105
|
.action(async (opts) => {
|
|
106
106
|
if (opts.off) {
|
|
@@ -422,7 +422,7 @@ async function main() {
|
|
|
422
422
|
});
|
|
423
423
|
program
|
|
424
424
|
.command('serve')
|
|
425
|
-
.description('Start HTTP server — expose all
|
|
425
|
+
.description('Start HTTP server — expose all 223 tools for kernel.chat or any client')
|
|
426
426
|
.option('-p, --port <port>', 'Port to listen on', '7437')
|
|
427
427
|
.option('--token <token>', 'Require auth token for all requests')
|
|
428
428
|
.option('--computer-use', 'Enable computer use tools')
|
|
@@ -1037,12 +1037,13 @@ async function byokFlow() {
|
|
|
1037
1037
|
printInfo('Use your own LLM API key. You pay the provider directly for tokens.');
|
|
1038
1038
|
printInfo('Kernel routing + tools + collective intelligence are free.');
|
|
1039
1039
|
console.log();
|
|
1040
|
-
printInfo('Supported providers (
|
|
1040
|
+
printInfo('Supported providers (20):');
|
|
1041
1041
|
printInfo(' Anthropic (Claude) OpenAI (GPT) Google (Gemini)');
|
|
1042
1042
|
printInfo(' Mistral AI xAI (Grok) DeepSeek');
|
|
1043
1043
|
printInfo(' Groq Together AI Fireworks AI');
|
|
1044
1044
|
printInfo(' Perplexity Cohere NVIDIA NIM');
|
|
1045
|
-
printInfo('
|
|
1045
|
+
printInfo(' SambaNova Cerebras OpenRouter');
|
|
1046
|
+
printInfo(' Ollama (local, free) LM Studio (local) Embedded llama.cpp');
|
|
1046
1047
|
console.log();
|
|
1047
1048
|
printInfo('Paste your API key (auto-detected by prefix):');
|
|
1048
1049
|
console.log();
|
|
@@ -1097,7 +1098,7 @@ async function byokFlow() {
|
|
|
1097
1098
|
console.log();
|
|
1098
1099
|
printSuccess(`BYOK mode enabled — ${providerConfig.name}`);
|
|
1099
1100
|
printInfo('You pay the provider directly. No message limits. No restrictions.');
|
|
1100
|
-
printInfo('All
|
|
1101
|
+
printInfo('All 223 tools + 22 agents + learning system = yours.');
|
|
1101
1102
|
console.log();
|
|
1102
1103
|
printSuccess('Ready. Run `kbot` to start.');
|
|
1103
1104
|
}
|
|
@@ -1342,7 +1343,7 @@ async function startRepl(agentOpts, context, tier, byokActive = false, localActi
|
|
|
1342
1343
|
const suggestions = await detectProjectSuggestions();
|
|
1343
1344
|
console.log();
|
|
1344
1345
|
console.log(chalk.dim(' ┌─────────────────────────────────────────────────┐'));
|
|
1345
|
-
console.log(chalk.dim(' │') + chalk.bold('
|
|
1346
|
+
console.log(chalk.dim(' │') + chalk.bold(' 22 agents. 223 tools. Just say what you need. ') + chalk.dim(' │'));
|
|
1346
1347
|
console.log(chalk.dim(' │ │'));
|
|
1347
1348
|
if (suggestions.length > 0) {
|
|
1348
1349
|
for (const s of suggestions.slice(0, 4)) {
|