@hasna/assistants 1.1.70 → 1.1.71
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/index.js +47 -832
- package/dist/index.js.map +17 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -558,19 +558,6 @@ var init_config = __esm(async () => {
|
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
},
|
|
561
|
-
energy: {
|
|
562
|
-
enabled: true,
|
|
563
|
-
regenRate: 500,
|
|
564
|
-
lowEnergyThreshold: 3000,
|
|
565
|
-
criticalThreshold: 1000,
|
|
566
|
-
maxEnergy: 1e4,
|
|
567
|
-
costs: {
|
|
568
|
-
message: 200,
|
|
569
|
-
toolCall: 500,
|
|
570
|
-
llmCall: 300,
|
|
571
|
-
longContext: 1000
|
|
572
|
-
}
|
|
573
|
-
},
|
|
574
561
|
validation: {
|
|
575
562
|
mode: "strict",
|
|
576
563
|
maxUserMessageLength: 1e5,
|
|
@@ -1222,13 +1209,6 @@ var init_schema = __esm(() => {
|
|
|
1222
1209
|
heartbeat TEXT NOT NULL,
|
|
1223
1210
|
context TEXT NOT NULL,
|
|
1224
1211
|
timestamp TEXT NOT NULL
|
|
1225
|
-
)`,
|
|
1226
|
-
`CREATE TABLE IF NOT EXISTS energy_state (
|
|
1227
|
-
id TEXT PRIMARY KEY DEFAULT 'default',
|
|
1228
|
-
current_energy REAL NOT NULL,
|
|
1229
|
-
max_energy REAL NOT NULL,
|
|
1230
|
-
regen_rate REAL NOT NULL,
|
|
1231
|
-
last_update TEXT NOT NULL
|
|
1232
1212
|
)`,
|
|
1233
1213
|
`CREATE TABLE IF NOT EXISTS capability_chains (
|
|
1234
1214
|
entity_id TEXT PRIMARY KEY,
|
|
@@ -12276,15 +12256,6 @@ var init_config2 = __esm(async () => {
|
|
|
12276
12256
|
"context.injection.enabled",
|
|
12277
12257
|
"context.injection.maxTokens",
|
|
12278
12258
|
"context.injection.format",
|
|
12279
|
-
"energy.enabled",
|
|
12280
|
-
"energy.regenRate",
|
|
12281
|
-
"energy.lowEnergyThreshold",
|
|
12282
|
-
"energy.criticalThreshold",
|
|
12283
|
-
"energy.maxEnergy",
|
|
12284
|
-
"energy.costs.message",
|
|
12285
|
-
"energy.costs.toolCall",
|
|
12286
|
-
"energy.costs.llmCall",
|
|
12287
|
-
"energy.costs.longContext",
|
|
12288
12259
|
"validation.mode",
|
|
12289
12260
|
"validation.maxUserMessageLength",
|
|
12290
12261
|
"validation.maxToolOutputLength",
|
|
@@ -12334,11 +12305,6 @@ var init_config2 = __esm(async () => {
|
|
|
12334
12305
|
"context.preserveLastToolCalls",
|
|
12335
12306
|
"context.injection.enabled",
|
|
12336
12307
|
"context.injection.maxTokens",
|
|
12337
|
-
"energy.enabled",
|
|
12338
|
-
"energy.regenRate",
|
|
12339
|
-
"energy.lowEnergyThreshold",
|
|
12340
|
-
"energy.criticalThreshold",
|
|
12341
|
-
"energy.maxEnergy",
|
|
12342
12308
|
"memory.enabled",
|
|
12343
12309
|
"memory.injection.enabled",
|
|
12344
12310
|
"memory.injection.maxTokens",
|
|
@@ -20379,157 +20345,6 @@ var init_model = __esm(() => {
|
|
|
20379
20345
|
];
|
|
20380
20346
|
});
|
|
20381
20347
|
|
|
20382
|
-
// packages/core/src/tools/energy.ts
|
|
20383
|
-
function getEnergyLevelInfo(percentage) {
|
|
20384
|
-
if (percentage >= 80) {
|
|
20385
|
-
return {
|
|
20386
|
-
level: "energetic",
|
|
20387
|
-
recommendation: "Energy is high. Continue working normally."
|
|
20388
|
-
};
|
|
20389
|
-
} else if (percentage >= 60) {
|
|
20390
|
-
return {
|
|
20391
|
-
level: "normal",
|
|
20392
|
-
recommendation: "Energy is good. No rest needed yet."
|
|
20393
|
-
};
|
|
20394
|
-
} else if (percentage >= 30) {
|
|
20395
|
-
return {
|
|
20396
|
-
level: "low",
|
|
20397
|
-
recommendation: "Energy is getting low. Consider taking a rest soon."
|
|
20398
|
-
};
|
|
20399
|
-
} else if (percentage >= 10) {
|
|
20400
|
-
return {
|
|
20401
|
-
level: "tired",
|
|
20402
|
-
recommendation: "Energy is low. Responses may be affected. Rest recommended."
|
|
20403
|
-
};
|
|
20404
|
-
} else {
|
|
20405
|
-
return {
|
|
20406
|
-
level: "exhausted",
|
|
20407
|
-
recommendation: "Energy is critically low. Rest immediately to restore normal function."
|
|
20408
|
-
};
|
|
20409
|
-
}
|
|
20410
|
-
}
|
|
20411
|
-
function createEnergyToolExecutors(context) {
|
|
20412
|
-
return {
|
|
20413
|
-
energy_rest: async (input) => {
|
|
20414
|
-
const manager = context.getEnergyManager();
|
|
20415
|
-
if (!manager) {
|
|
20416
|
-
return JSON.stringify({
|
|
20417
|
-
success: false,
|
|
20418
|
-
error: "Energy system not enabled"
|
|
20419
|
-
});
|
|
20420
|
-
}
|
|
20421
|
-
const stateBefore = context.getEnergyState();
|
|
20422
|
-
if (!stateBefore) {
|
|
20423
|
-
return JSON.stringify({
|
|
20424
|
-
success: false,
|
|
20425
|
-
error: "Unable to get energy state"
|
|
20426
|
-
});
|
|
20427
|
-
}
|
|
20428
|
-
const defaultAmount = Math.floor(stateBefore.max * 0.2);
|
|
20429
|
-
const amount = typeof input.amount === "number" && input.amount > 0 ? Math.min(input.amount, stateBefore.max) : defaultAmount;
|
|
20430
|
-
context.restEnergy(amount);
|
|
20431
|
-
const stateAfter = context.getEnergyState();
|
|
20432
|
-
if (!stateAfter) {
|
|
20433
|
-
return JSON.stringify({
|
|
20434
|
-
success: true,
|
|
20435
|
-
message: "Rested successfully",
|
|
20436
|
-
restored: amount
|
|
20437
|
-
});
|
|
20438
|
-
}
|
|
20439
|
-
const actualRestored = stateAfter.current - stateBefore.current;
|
|
20440
|
-
const percentage = Math.round(stateAfter.current / stateAfter.max * 100);
|
|
20441
|
-
const { level } = getEnergyLevelInfo(percentage);
|
|
20442
|
-
return JSON.stringify({
|
|
20443
|
-
success: true,
|
|
20444
|
-
message: `Restored ${actualRestored} energy points`,
|
|
20445
|
-
before: {
|
|
20446
|
-
current: stateBefore.current,
|
|
20447
|
-
percentage: Math.round(stateBefore.current / stateBefore.max * 100)
|
|
20448
|
-
},
|
|
20449
|
-
after: {
|
|
20450
|
-
current: stateAfter.current,
|
|
20451
|
-
max: stateAfter.max,
|
|
20452
|
-
percentage,
|
|
20453
|
-
level
|
|
20454
|
-
}
|
|
20455
|
-
});
|
|
20456
|
-
},
|
|
20457
|
-
energy_info: async () => {
|
|
20458
|
-
const state = context.getEnergyState();
|
|
20459
|
-
if (!state) {
|
|
20460
|
-
return JSON.stringify({
|
|
20461
|
-
success: false,
|
|
20462
|
-
error: "Energy system not enabled or unavailable"
|
|
20463
|
-
});
|
|
20464
|
-
}
|
|
20465
|
-
const manager = context.getEnergyManager();
|
|
20466
|
-
const effects = manager?.getEffects();
|
|
20467
|
-
const percentage = Math.round(state.current / state.max * 100);
|
|
20468
|
-
const { level, recommendation } = getEnergyLevelInfo(percentage);
|
|
20469
|
-
const response = {
|
|
20470
|
-
success: true,
|
|
20471
|
-
energy: {
|
|
20472
|
-
current: state.current,
|
|
20473
|
-
max: state.max,
|
|
20474
|
-
percentage,
|
|
20475
|
-
level,
|
|
20476
|
-
regenRate: state.regenRate,
|
|
20477
|
-
lastUpdate: state.lastUpdate
|
|
20478
|
-
},
|
|
20479
|
-
recommendation
|
|
20480
|
-
};
|
|
20481
|
-
if (effects) {
|
|
20482
|
-
response.effects = {
|
|
20483
|
-
level: effects.level,
|
|
20484
|
-
promptModifier: effects.promptModifier || null,
|
|
20485
|
-
responseLengthFactor: effects.responseLengthFactor,
|
|
20486
|
-
processingDelayMs: effects.processingDelayMs
|
|
20487
|
-
};
|
|
20488
|
-
if (effects.message) {
|
|
20489
|
-
response.statusMessage = effects.message;
|
|
20490
|
-
}
|
|
20491
|
-
}
|
|
20492
|
-
return JSON.stringify(response);
|
|
20493
|
-
}
|
|
20494
|
-
};
|
|
20495
|
-
}
|
|
20496
|
-
function registerEnergyTools(registry, context) {
|
|
20497
|
-
const executors = createEnergyToolExecutors(context);
|
|
20498
|
-
for (const tool of energyTools) {
|
|
20499
|
-
registry.register(tool, executors[tool.name]);
|
|
20500
|
-
}
|
|
20501
|
-
}
|
|
20502
|
-
var energyRestTool, energyStatusTool, energyTools;
|
|
20503
|
-
var init_energy = __esm(() => {
|
|
20504
|
-
energyRestTool = {
|
|
20505
|
-
name: "energy_rest",
|
|
20506
|
-
description: "Recharge energy by resting. Restores a specified amount of energy points (default: 20% of max energy). Use when energy is low to avoid tired responses.",
|
|
20507
|
-
parameters: {
|
|
20508
|
-
type: "object",
|
|
20509
|
-
properties: {
|
|
20510
|
-
amount: {
|
|
20511
|
-
type: "number",
|
|
20512
|
-
description: "Amount of energy to restore (default: 20% of max, which is typically 2000 points)"
|
|
20513
|
-
}
|
|
20514
|
-
},
|
|
20515
|
-
required: []
|
|
20516
|
-
}
|
|
20517
|
-
};
|
|
20518
|
-
energyStatusTool = {
|
|
20519
|
-
name: "energy_info",
|
|
20520
|
-
description: "Get detailed information about the current energy state including level, effects, and recommendations.",
|
|
20521
|
-
parameters: {
|
|
20522
|
-
type: "object",
|
|
20523
|
-
properties: {},
|
|
20524
|
-
required: []
|
|
20525
|
-
}
|
|
20526
|
-
};
|
|
20527
|
-
energyTools = [
|
|
20528
|
-
energyRestTool,
|
|
20529
|
-
energyStatusTool
|
|
20530
|
-
];
|
|
20531
|
-
});
|
|
20532
|
-
|
|
20533
20348
|
// packages/core/src/heartbeat/history.ts
|
|
20534
20349
|
function getDb() {
|
|
20535
20350
|
return getDatabase();
|
|
@@ -80236,7 +80051,6 @@ class BuiltinCommands {
|
|
|
80236
80051
|
loader.register(this.projectsCommand());
|
|
80237
80052
|
loader.register(this.plansCommand());
|
|
80238
80053
|
loader.register(this.summarizeCommand());
|
|
80239
|
-
loader.register(this.restCommand());
|
|
80240
80054
|
loader.register(this.voiceCommand());
|
|
80241
80055
|
loader.register(this.talkCommand());
|
|
80242
80056
|
loader.register(this.assistantCommand());
|
|
@@ -86174,40 +85988,6 @@ Not enough context to summarize yet.
|
|
|
86174
85988
|
}
|
|
86175
85989
|
};
|
|
86176
85990
|
}
|
|
86177
|
-
restCommand() {
|
|
86178
|
-
return {
|
|
86179
|
-
name: "rest",
|
|
86180
|
-
description: "Recharge assistant energy (optional: amount, e.g. /rest 5000)",
|
|
86181
|
-
builtin: true,
|
|
86182
|
-
selfHandled: true,
|
|
86183
|
-
content: "",
|
|
86184
|
-
handler: async (args, context) => {
|
|
86185
|
-
if (!context.restEnergy) {
|
|
86186
|
-
context.emit("text", `
|
|
86187
|
-
Energy system is not available.
|
|
86188
|
-
`);
|
|
86189
|
-
context.emit("done");
|
|
86190
|
-
return { handled: true };
|
|
86191
|
-
}
|
|
86192
|
-
const parsed = parseInt(args.trim(), 10);
|
|
86193
|
-
const amount = Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;
|
|
86194
|
-
context.restEnergy(amount);
|
|
86195
|
-
const state = context.getEnergyState?.();
|
|
86196
|
-
if (state) {
|
|
86197
|
-
const percent = Math.round(state.current / Math.max(1, state.max) * 100);
|
|
86198
|
-
context.emit("text", `
|
|
86199
|
-
Energy restored. Current level: ${percent}% (${state.current}/${state.max}).
|
|
86200
|
-
`);
|
|
86201
|
-
} else {
|
|
86202
|
-
context.emit("text", `
|
|
86203
|
-
Energy restored.
|
|
86204
|
-
`);
|
|
86205
|
-
}
|
|
86206
|
-
context.emit("done");
|
|
86207
|
-
return { handled: true };
|
|
86208
|
-
}
|
|
86209
|
-
};
|
|
86210
|
-
}
|
|
86211
85991
|
skillsCommand(loader) {
|
|
86212
85992
|
return {
|
|
86213
85993
|
name: "skills",
|
|
@@ -86482,7 +86262,7 @@ Options for install/uninstall:
|
|
|
86482
86262
|
statusCommand() {
|
|
86483
86263
|
return {
|
|
86484
86264
|
name: "status",
|
|
86485
|
-
description: "Show session overview: status,
|
|
86265
|
+
description: "Show session overview: status, identity, tokens, and runtime info",
|
|
86486
86266
|
builtin: true,
|
|
86487
86267
|
selfHandled: true,
|
|
86488
86268
|
content: "",
|
|
@@ -86506,14 +86286,6 @@ Options for install/uninstall:
|
|
|
86506
86286
|
message += ` \xB7 ${identity.name}`;
|
|
86507
86287
|
}
|
|
86508
86288
|
message += `
|
|
86509
|
-
`;
|
|
86510
|
-
}
|
|
86511
|
-
const energyState = context.getEnergyState?.();
|
|
86512
|
-
if (energyState) {
|
|
86513
|
-
const energyPercent = Math.round(energyState.current / Math.max(1, energyState.max) * 100);
|
|
86514
|
-
const energyBar = "\u2588".repeat(Math.round(energyPercent / 10)) + "\u2591".repeat(10 - Math.round(energyPercent / 10));
|
|
86515
|
-
const energyEmoji = energyPercent > 70 ? "\u26A1" : energyPercent > 30 ? "\uD83D\uDD0B" : "\uD83E\uDEAB";
|
|
86516
|
-
message += `**Energy:** ${energyEmoji} [${energyBar}] ${energyPercent}% (${energyState.current}/${energyState.max})
|
|
86517
86289
|
`;
|
|
86518
86290
|
}
|
|
86519
86291
|
const voiceState = context.getVoiceState?.();
|
|
@@ -86614,7 +86386,7 @@ Format the summary as a brief bullet-point list. This summary will replace the c
|
|
|
86614
86386
|
configCommand() {
|
|
86615
86387
|
return {
|
|
86616
86388
|
name: "config",
|
|
86617
|
-
description: "View and edit configuration interactively (model, context,
|
|
86389
|
+
description: "View and edit configuration interactively (model, context, etc.)",
|
|
86618
86390
|
builtin: true,
|
|
86619
86391
|
selfHandled: true,
|
|
86620
86392
|
content: "",
|
|
@@ -89245,7 +89017,7 @@ Not a git repository or git not available.
|
|
|
89245
89017
|
context.setProjectContext(projectContext);
|
|
89246
89018
|
}
|
|
89247
89019
|
}
|
|
89248
|
-
var VERSION2 = "1.1.
|
|
89020
|
+
var VERSION2 = "1.1.71";
|
|
89249
89021
|
var init_builtin = __esm(async () => {
|
|
89250
89022
|
init_src2();
|
|
89251
89023
|
init_context3();
|
|
@@ -94688,218 +94460,6 @@ var init_heartbeat2 = __esm(async () => {
|
|
|
94688
94460
|
]);
|
|
94689
94461
|
});
|
|
94690
94462
|
|
|
94691
|
-
// packages/core/src/energy/types.ts
|
|
94692
|
-
function buildEnergyConfig(config) {
|
|
94693
|
-
return {
|
|
94694
|
-
enabled: config?.enabled ?? DEFAULT_ENERGY_CONFIG.enabled,
|
|
94695
|
-
costs: {
|
|
94696
|
-
...DEFAULT_ENERGY_COSTS,
|
|
94697
|
-
...config?.costs || {}
|
|
94698
|
-
},
|
|
94699
|
-
regenRate: config?.regenRate ?? DEFAULT_ENERGY_CONFIG.regenRate,
|
|
94700
|
-
lowEnergyThreshold: config?.lowEnergyThreshold ?? DEFAULT_ENERGY_CONFIG.lowEnergyThreshold,
|
|
94701
|
-
criticalThreshold: config?.criticalThreshold ?? DEFAULT_ENERGY_CONFIG.criticalThreshold,
|
|
94702
|
-
maxEnergy: config?.maxEnergy ?? DEFAULT_ENERGY_CONFIG.maxEnergy
|
|
94703
|
-
};
|
|
94704
|
-
}
|
|
94705
|
-
function createInitialEnergyState(config) {
|
|
94706
|
-
return {
|
|
94707
|
-
current: config.maxEnergy,
|
|
94708
|
-
max: config.maxEnergy,
|
|
94709
|
-
regenRate: config.regenRate,
|
|
94710
|
-
lastUpdate: new Date().toISOString()
|
|
94711
|
-
};
|
|
94712
|
-
}
|
|
94713
|
-
var DEFAULT_ENERGY_COSTS, DEFAULT_ENERGY_CONFIG;
|
|
94714
|
-
var init_types6 = __esm(() => {
|
|
94715
|
-
DEFAULT_ENERGY_COSTS = {
|
|
94716
|
-
message: 200,
|
|
94717
|
-
toolCall: 500,
|
|
94718
|
-
llmCall: 300,
|
|
94719
|
-
longContext: 1000
|
|
94720
|
-
};
|
|
94721
|
-
DEFAULT_ENERGY_CONFIG = {
|
|
94722
|
-
enabled: true,
|
|
94723
|
-
costs: DEFAULT_ENERGY_COSTS,
|
|
94724
|
-
regenRate: 500,
|
|
94725
|
-
lowEnergyThreshold: 3000,
|
|
94726
|
-
criticalThreshold: 1000,
|
|
94727
|
-
maxEnergy: 1e4
|
|
94728
|
-
};
|
|
94729
|
-
});
|
|
94730
|
-
|
|
94731
|
-
// packages/core/src/energy/personality.ts
|
|
94732
|
-
function effectsForLevel(level) {
|
|
94733
|
-
const effect = PERSONALITIES[level];
|
|
94734
|
-
return {
|
|
94735
|
-
level,
|
|
94736
|
-
promptModifier: effect.promptModifier,
|
|
94737
|
-
responseLengthFactor: effect.responseLengthFactor,
|
|
94738
|
-
processingDelayMs: effect.processingDelayMs,
|
|
94739
|
-
message: effect.message ?? null
|
|
94740
|
-
};
|
|
94741
|
-
}
|
|
94742
|
-
function applyPersonality(systemPrompt, effects) {
|
|
94743
|
-
if (!effects.promptModifier)
|
|
94744
|
-
return systemPrompt;
|
|
94745
|
-
return `${systemPrompt}
|
|
94746
|
-
|
|
94747
|
-
${effects.promptModifier}`;
|
|
94748
|
-
}
|
|
94749
|
-
var PERSONALITIES;
|
|
94750
|
-
var init_personality = __esm(() => {
|
|
94751
|
-
PERSONALITIES = {
|
|
94752
|
-
energetic: {
|
|
94753
|
-
responseLengthFactor: 1,
|
|
94754
|
-
processingDelayMs: 0,
|
|
94755
|
-
message: null
|
|
94756
|
-
},
|
|
94757
|
-
tired: {
|
|
94758
|
-
promptModifier: "You are feeling a bit tired. Keep responses concise and focused.",
|
|
94759
|
-
responseLengthFactor: 0.85,
|
|
94760
|
-
processingDelayMs: 200,
|
|
94761
|
-
message: "Getting a bit tired... responses may be shorter."
|
|
94762
|
-
},
|
|
94763
|
-
exhausted: {
|
|
94764
|
-
promptModifier: "You are very tired. Provide minimal but helpful responses.",
|
|
94765
|
-
responseLengthFactor: 0.6,
|
|
94766
|
-
processingDelayMs: 500,
|
|
94767
|
-
message: "*yawns* Running low on energy. Responses will be brief."
|
|
94768
|
-
}
|
|
94769
|
-
};
|
|
94770
|
-
});
|
|
94771
|
-
|
|
94772
|
-
// packages/core/src/energy/manager.ts
|
|
94773
|
-
class EnergyManager {
|
|
94774
|
-
config;
|
|
94775
|
-
state;
|
|
94776
|
-
storage;
|
|
94777
|
-
regenInterval;
|
|
94778
|
-
constructor(config, storage) {
|
|
94779
|
-
this.config = buildEnergyConfig(config);
|
|
94780
|
-
this.storage = storage;
|
|
94781
|
-
this.state = createInitialEnergyState(this.config);
|
|
94782
|
-
}
|
|
94783
|
-
async initialize() {
|
|
94784
|
-
const saved = await this.storage.load();
|
|
94785
|
-
if (saved) {
|
|
94786
|
-
this.state = saved;
|
|
94787
|
-
this.applyOfflineRegen();
|
|
94788
|
-
this.storage.save(this.state);
|
|
94789
|
-
}
|
|
94790
|
-
this.startRegen();
|
|
94791
|
-
}
|
|
94792
|
-
consume(action) {
|
|
94793
|
-
if (!this.config.enabled)
|
|
94794
|
-
return true;
|
|
94795
|
-
const cost = this.config.costs[action] ?? 0;
|
|
94796
|
-
const enough = this.state.current >= cost;
|
|
94797
|
-
this.state.current = Math.max(0, this.state.current - cost);
|
|
94798
|
-
this.state.lastUpdate = new Date().toISOString();
|
|
94799
|
-
this.storage.save(this.state);
|
|
94800
|
-
return enough;
|
|
94801
|
-
}
|
|
94802
|
-
rest(amount = 20) {
|
|
94803
|
-
this.state.current = Math.min(this.state.max, this.state.current + amount);
|
|
94804
|
-
this.state.lastUpdate = new Date().toISOString();
|
|
94805
|
-
this.storage.save(this.state);
|
|
94806
|
-
}
|
|
94807
|
-
getState() {
|
|
94808
|
-
return { ...this.state };
|
|
94809
|
-
}
|
|
94810
|
-
getEffects() {
|
|
94811
|
-
if (!this.config.enabled) {
|
|
94812
|
-
return effectsForLevel("energetic");
|
|
94813
|
-
}
|
|
94814
|
-
const level = this.state.current;
|
|
94815
|
-
if (level <= this.config.criticalThreshold) {
|
|
94816
|
-
return effectsForLevel("exhausted");
|
|
94817
|
-
}
|
|
94818
|
-
if (level <= this.config.lowEnergyThreshold) {
|
|
94819
|
-
return effectsForLevel("tired");
|
|
94820
|
-
}
|
|
94821
|
-
return effectsForLevel("energetic");
|
|
94822
|
-
}
|
|
94823
|
-
stop() {
|
|
94824
|
-
if (this.regenInterval) {
|
|
94825
|
-
clearInterval(this.regenInterval);
|
|
94826
|
-
}
|
|
94827
|
-
}
|
|
94828
|
-
startRegen() {
|
|
94829
|
-
if (!this.config.enabled)
|
|
94830
|
-
return;
|
|
94831
|
-
if (this.config.regenRate <= 0)
|
|
94832
|
-
return;
|
|
94833
|
-
if (this.regenInterval)
|
|
94834
|
-
return;
|
|
94835
|
-
const intervalMs = Math.max(1000, Math.floor(60000 / this.config.regenRate));
|
|
94836
|
-
this.regenInterval = setInterval(() => {
|
|
94837
|
-
if (this.state.current < this.state.max) {
|
|
94838
|
-
this.state.current = Math.min(this.state.max, this.state.current + 1);
|
|
94839
|
-
this.state.lastUpdate = new Date().toISOString();
|
|
94840
|
-
this.storage.save(this.state);
|
|
94841
|
-
}
|
|
94842
|
-
}, intervalMs);
|
|
94843
|
-
if (typeof this.regenInterval.unref === "function") {
|
|
94844
|
-
this.regenInterval.unref();
|
|
94845
|
-
}
|
|
94846
|
-
}
|
|
94847
|
-
applyOfflineRegen() {
|
|
94848
|
-
const lastUpdate = new Date(this.state.lastUpdate).getTime();
|
|
94849
|
-
const now2 = Date.now();
|
|
94850
|
-
const minutesElapsed = Math.max(0, (now2 - lastUpdate) / 60000);
|
|
94851
|
-
const regenAmount = Math.floor(minutesElapsed * this.config.regenRate);
|
|
94852
|
-
if (regenAmount > 0) {
|
|
94853
|
-
this.state.current = Math.min(this.state.max, this.state.current + regenAmount);
|
|
94854
|
-
this.state.lastUpdate = new Date().toISOString();
|
|
94855
|
-
}
|
|
94856
|
-
}
|
|
94857
|
-
}
|
|
94858
|
-
var init_manager3 = __esm(() => {
|
|
94859
|
-
init_types6();
|
|
94860
|
-
init_personality();
|
|
94861
|
-
});
|
|
94862
|
-
|
|
94863
|
-
// packages/core/src/energy/storage.ts
|
|
94864
|
-
class EnergyStorage {
|
|
94865
|
-
db;
|
|
94866
|
-
constructor(db) {
|
|
94867
|
-
this.db = db || getDatabase();
|
|
94868
|
-
}
|
|
94869
|
-
async save(state) {
|
|
94870
|
-
try {
|
|
94871
|
-
this.db.prepare(`INSERT OR REPLACE INTO energy_state (id, current_energy, max_energy, regen_rate, last_update)
|
|
94872
|
-
VALUES ('default', ?, ?, ?, ?)`).run(state.current, state.max, state.regenRate, state.lastUpdate);
|
|
94873
|
-
} catch {}
|
|
94874
|
-
}
|
|
94875
|
-
async load() {
|
|
94876
|
-
try {
|
|
94877
|
-
const row = this.db.query(`SELECT * FROM energy_state WHERE id = 'default'`).get();
|
|
94878
|
-
if (!row)
|
|
94879
|
-
return null;
|
|
94880
|
-
return {
|
|
94881
|
-
current: row.current_energy,
|
|
94882
|
-
max: row.max_energy,
|
|
94883
|
-
regenRate: row.regen_rate,
|
|
94884
|
-
lastUpdate: row.last_update
|
|
94885
|
-
};
|
|
94886
|
-
} catch {
|
|
94887
|
-
return null;
|
|
94888
|
-
}
|
|
94889
|
-
}
|
|
94890
|
-
}
|
|
94891
|
-
var init_storage = __esm(async () => {
|
|
94892
|
-
await init_database();
|
|
94893
|
-
});
|
|
94894
|
-
|
|
94895
|
-
// packages/core/src/energy/index.ts
|
|
94896
|
-
var init_energy2 = __esm(async () => {
|
|
94897
|
-
init_manager3();
|
|
94898
|
-
init_personality();
|
|
94899
|
-
init_types6();
|
|
94900
|
-
await init_storage();
|
|
94901
|
-
});
|
|
94902
|
-
|
|
94903
94463
|
// packages/core/src/validation/llm-response.ts
|
|
94904
94464
|
function validateToolCalls(toolCalls, tools) {
|
|
94905
94465
|
const toolMap = new Map;
|
|
@@ -95765,7 +95325,7 @@ class VoiceManager {
|
|
|
95765
95325
|
});
|
|
95766
95326
|
}
|
|
95767
95327
|
}
|
|
95768
|
-
var
|
|
95328
|
+
var init_manager3 = __esm(() => {
|
|
95769
95329
|
init_stt();
|
|
95770
95330
|
init_tts();
|
|
95771
95331
|
init_player();
|
|
@@ -107736,7 +107296,7 @@ More information can be found at: https://a.co/c895JFp`);
|
|
|
107736
107296
|
|
|
107737
107297
|
// node_modules/.bun/@aws-sdk+middleware-flexible-checksums@3.972.8/node_modules/@aws-sdk/middleware-flexible-checksums/dist-es/types.js
|
|
107738
107298
|
var CLIENT_SUPPORTED_ALGORITHMS, PRIORITY_ORDER_ALGORITHMS;
|
|
107739
|
-
var
|
|
107299
|
+
var init_types6 = __esm(() => {
|
|
107740
107300
|
init_constants2();
|
|
107741
107301
|
CLIENT_SUPPORTED_ALGORITHMS = [
|
|
107742
107302
|
ChecksumAlgorithm.CRC32,
|
|
@@ -107770,7 +107330,7 @@ var getChecksumAlgorithmForRequest = (input, { requestChecksumRequired, requestA
|
|
|
107770
107330
|
};
|
|
107771
107331
|
var init_getChecksumAlgorithmForRequest = __esm(() => {
|
|
107772
107332
|
init_constants2();
|
|
107773
|
-
|
|
107333
|
+
init_types6();
|
|
107774
107334
|
});
|
|
107775
107335
|
|
|
107776
107336
|
// node_modules/.bun/@aws-sdk+middleware-flexible-checksums@3.972.8/node_modules/@aws-sdk/middleware-flexible-checksums/dist-es/getChecksumLocationName.js
|
|
@@ -108917,7 +108477,7 @@ var getChecksumAlgorithmListForResponse = (responseAlgorithms = []) => {
|
|
|
108917
108477
|
return validChecksumAlgorithms;
|
|
108918
108478
|
};
|
|
108919
108479
|
var init_getChecksumAlgorithmListForResponse = __esm(() => {
|
|
108920
|
-
|
|
108480
|
+
init_types6();
|
|
108921
108481
|
});
|
|
108922
108482
|
|
|
108923
108483
|
// node_modules/.bun/@aws-sdk+middleware-flexible-checksums@3.972.8/node_modules/@aws-sdk/middleware-flexible-checksums/dist-es/isChecksumWithPartNumber.js
|
|
@@ -117869,7 +117429,7 @@ var init_fromInstanceMetadata = __esm(() => {
|
|
|
117869
117429
|
});
|
|
117870
117430
|
|
|
117871
117431
|
// node_modules/.bun/@smithy+credential-provider-imds@4.2.8/node_modules/@smithy/credential-provider-imds/dist-es/types.js
|
|
117872
|
-
var
|
|
117432
|
+
var init_types7 = () => {};
|
|
117873
117433
|
|
|
117874
117434
|
// node_modules/.bun/@smithy+credential-provider-imds@4.2.8/node_modules/@smithy/credential-provider-imds/dist-es/index.js
|
|
117875
117435
|
var exports_dist_es2 = {};
|
|
@@ -117892,7 +117452,7 @@ var init_dist_es10 = __esm(() => {
|
|
|
117892
117452
|
init_Endpoint();
|
|
117893
117453
|
init_fromContainerMetadata();
|
|
117894
117454
|
init_fromInstanceMetadata();
|
|
117895
|
-
|
|
117455
|
+
init_types7();
|
|
117896
117456
|
});
|
|
117897
117457
|
|
|
117898
117458
|
// node_modules/.bun/@aws-sdk+credential-provider-http@3.972.10/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/checkUrl.js
|
|
@@ -122260,7 +121820,7 @@ var init_fromSSO = __esm(() => {
|
|
|
122260
121820
|
});
|
|
122261
121821
|
|
|
122262
121822
|
// node_modules/.bun/@aws-sdk+credential-provider-sso@3.972.8/node_modules/@aws-sdk/credential-provider-sso/dist-es/types.js
|
|
122263
|
-
var
|
|
121823
|
+
var init_types8 = () => {};
|
|
122264
121824
|
|
|
122265
121825
|
// node_modules/.bun/@aws-sdk+credential-provider-sso@3.972.8/node_modules/@aws-sdk/credential-provider-sso/dist-es/index.js
|
|
122266
121826
|
var exports_dist_es4 = {};
|
|
@@ -122271,7 +121831,7 @@ __export(exports_dist_es4, {
|
|
|
122271
121831
|
});
|
|
122272
121832
|
var init_dist_es14 = __esm(() => {
|
|
122273
121833
|
init_fromSSO();
|
|
122274
|
-
|
|
121834
|
+
init_types8();
|
|
122275
121835
|
init_validateSsoProfile();
|
|
122276
121836
|
});
|
|
122277
121837
|
|
|
@@ -124169,12 +123729,12 @@ var init_fromLoginCredentials = __esm(() => {
|
|
|
124169
123729
|
});
|
|
124170
123730
|
|
|
124171
123731
|
// node_modules/.bun/@aws-sdk+credential-provider-login@3.972.8/node_modules/@aws-sdk/credential-provider-login/dist-es/types.js
|
|
124172
|
-
var
|
|
123732
|
+
var init_types9 = () => {};
|
|
124173
123733
|
|
|
124174
123734
|
// node_modules/.bun/@aws-sdk+credential-provider-login@3.972.8/node_modules/@aws-sdk/credential-provider-login/dist-es/index.js
|
|
124175
123735
|
var init_dist_es15 = __esm(() => {
|
|
124176
123736
|
init_fromLoginCredentials();
|
|
124177
|
-
|
|
123737
|
+
init_types9();
|
|
124178
123738
|
});
|
|
124179
123739
|
|
|
124180
123740
|
// node_modules/.bun/@aws-sdk+credential-provider-ini@3.972.8/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveLoginCredentials.js
|
|
@@ -152209,7 +151769,7 @@ function createWebhooksManager(assistantId, config) {
|
|
|
152209
151769
|
config
|
|
152210
151770
|
});
|
|
152211
151771
|
}
|
|
152212
|
-
var
|
|
151772
|
+
var init_manager4 = __esm(async () => {
|
|
152213
151773
|
init_crypto();
|
|
152214
151774
|
await __promiseAll([
|
|
152215
151775
|
init_local_storage2(),
|
|
@@ -152547,7 +152107,7 @@ var init_webhooks4 = __esm(async () => {
|
|
|
152547
152107
|
init_crypto();
|
|
152548
152108
|
init_tools9();
|
|
152549
152109
|
await __promiseAll([
|
|
152550
|
-
|
|
152110
|
+
init_manager4(),
|
|
152551
152111
|
init_local_storage2(),
|
|
152552
152112
|
init_watcher2()
|
|
152553
152113
|
]);
|
|
@@ -153053,7 +152613,7 @@ function createChannelsManager(assistantId, assistantName, config, options) {
|
|
|
153053
152613
|
dbPath: options?.dbPath
|
|
153054
152614
|
});
|
|
153055
152615
|
}
|
|
153056
|
-
var
|
|
152616
|
+
var init_manager5 = __esm(async () => {
|
|
153057
152617
|
await init_store7();
|
|
153058
152618
|
});
|
|
153059
152619
|
|
|
@@ -174280,9 +173840,6 @@ class ClaudeAgentLoop {
|
|
|
174280
173840
|
getContextInfo() {
|
|
174281
173841
|
return null;
|
|
174282
173842
|
}
|
|
174283
|
-
getEnergyState() {
|
|
174284
|
-
return null;
|
|
174285
|
-
}
|
|
174286
173843
|
getVoiceState() {
|
|
174287
173844
|
return null;
|
|
174288
173845
|
}
|
|
@@ -174960,9 +174517,6 @@ class CodexAgentLoop {
|
|
|
174960
174517
|
getContextInfo() {
|
|
174961
174518
|
return null;
|
|
174962
174519
|
}
|
|
174963
|
-
getEnergyState() {
|
|
174964
|
-
return null;
|
|
174965
|
-
}
|
|
174966
174520
|
getVoiceState() {
|
|
174967
174521
|
return null;
|
|
174968
174522
|
}
|
|
@@ -175335,12 +174889,6 @@ class EmbeddedClient {
|
|
|
175335
174889
|
getTokenUsage() {
|
|
175336
174890
|
return this.assistantLoop.getTokenUsage();
|
|
175337
174891
|
}
|
|
175338
|
-
getEnergyState() {
|
|
175339
|
-
if (typeof this.assistantLoop.getEnergyState === "function") {
|
|
175340
|
-
return this.assistantLoop.getEnergyState();
|
|
175341
|
-
}
|
|
175342
|
-
return null;
|
|
175343
|
-
}
|
|
175344
174892
|
getVoiceState() {
|
|
175345
174893
|
if (typeof this.assistantLoop.getVoiceState === "function") {
|
|
175346
174894
|
return this.assistantLoop.getVoiceState();
|
|
@@ -175982,7 +175530,7 @@ var init_tools10 = __esm(() => {
|
|
|
175982
175530
|
var init_channels = __esm(async () => {
|
|
175983
175531
|
init_tools10();
|
|
175984
175532
|
await __promiseAll([
|
|
175985
|
-
|
|
175533
|
+
init_manager5(),
|
|
175986
175534
|
init_agent_pool(),
|
|
175987
175535
|
init_store7()
|
|
175988
175536
|
]);
|
|
@@ -176203,7 +175751,7 @@ async function createPeopleManager() {
|
|
|
176203
175751
|
await manager.initialize();
|
|
176204
175752
|
return manager;
|
|
176205
175753
|
}
|
|
176206
|
-
var
|
|
175754
|
+
var init_manager6 = __esm(async () => {
|
|
176207
175755
|
await init_store8();
|
|
176208
175756
|
});
|
|
176209
175757
|
|
|
@@ -176531,7 +176079,7 @@ var init_people = __esm(async () => {
|
|
|
176531
176079
|
init_tools11();
|
|
176532
176080
|
await __promiseAll([
|
|
176533
176081
|
init_store8(),
|
|
176534
|
-
|
|
176082
|
+
init_manager6()
|
|
176535
176083
|
]);
|
|
176536
176084
|
});
|
|
176537
176085
|
|
|
@@ -178107,7 +177655,7 @@ function createTelephonyManager(assistantId, assistantName, config2) {
|
|
|
178107
177655
|
config: config2
|
|
178108
177656
|
});
|
|
178109
177657
|
}
|
|
178110
|
-
var
|
|
177658
|
+
var init_manager7 = __esm(async () => {
|
|
178111
177659
|
init_voice_bridge();
|
|
178112
177660
|
await init_store9();
|
|
178113
177661
|
});
|
|
@@ -178611,7 +178159,7 @@ var init_telephony = __esm(async () => {
|
|
|
178611
178159
|
init_voice_bridge();
|
|
178612
178160
|
init_tools12();
|
|
178613
178161
|
await __promiseAll([
|
|
178614
|
-
|
|
178162
|
+
init_manager7(),
|
|
178615
178163
|
init_store9()
|
|
178616
178164
|
]);
|
|
178617
178165
|
});
|
|
@@ -179079,7 +178627,7 @@ function createOrdersManager(assistantId, assistantName, config2) {
|
|
|
179079
178627
|
config: config2
|
|
179080
178628
|
});
|
|
179081
178629
|
}
|
|
179082
|
-
var
|
|
178630
|
+
var init_manager8 = __esm(async () => {
|
|
179083
178631
|
await init_store10();
|
|
179084
178632
|
});
|
|
179085
178633
|
|
|
@@ -179630,7 +179178,7 @@ var init_tools13 = __esm(() => {
|
|
|
179630
179178
|
var init_orders = __esm(async () => {
|
|
179631
179179
|
init_tools13();
|
|
179632
179180
|
await __promiseAll([
|
|
179633
|
-
|
|
179181
|
+
init_manager8(),
|
|
179634
179182
|
init_store10()
|
|
179635
179183
|
]);
|
|
179636
179184
|
});
|
|
@@ -180094,7 +179642,7 @@ function createContactsManager() {
|
|
|
180094
179642
|
return new ContactsManager;
|
|
180095
179643
|
}
|
|
180096
179644
|
var VALID_RELATIONSHIPS, EMAIL_REGEX, ISO_DATE_REGEX;
|
|
180097
|
-
var
|
|
179645
|
+
var init_manager9 = __esm(async () => {
|
|
180098
179646
|
await init_store11();
|
|
180099
179647
|
VALID_RELATIONSHIPS = ["friend", "colleague", "vendor", "client", "family", "other"];
|
|
180100
179648
|
EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
@@ -180702,7 +180250,7 @@ var init_contacts = __esm(async () => {
|
|
|
180702
180250
|
init_tools14();
|
|
180703
180251
|
await __promiseAll([
|
|
180704
180252
|
init_store11(),
|
|
180705
|
-
|
|
180253
|
+
init_manager9()
|
|
180706
180254
|
]);
|
|
180707
180255
|
});
|
|
180708
180256
|
|
|
@@ -182228,40 +181776,6 @@ function createSelfAwarenessToolExecutors(context) {
|
|
|
182228
181776
|
}
|
|
182229
181777
|
return JSON.stringify(response, null, 2);
|
|
182230
181778
|
},
|
|
182231
|
-
energy_status: async () => {
|
|
182232
|
-
const energyManager = context.getEnergyManager?.();
|
|
182233
|
-
const energyState = context.getEnergyState?.();
|
|
182234
|
-
if (!energyManager || !energyState) {
|
|
182235
|
-
return JSON.stringify({
|
|
182236
|
-
error: "Energy system not available",
|
|
182237
|
-
current: 0,
|
|
182238
|
-
max: 0,
|
|
182239
|
-
percentage: 0,
|
|
182240
|
-
level: "energetic",
|
|
182241
|
-
regenRate: 0,
|
|
182242
|
-
effects: {
|
|
182243
|
-
promptModifier: null,
|
|
182244
|
-
responseLengthFactor: 1,
|
|
182245
|
-
processingDelayMs: 0
|
|
182246
|
-
}
|
|
182247
|
-
});
|
|
182248
|
-
}
|
|
182249
|
-
const effects = energyManager.getEffects();
|
|
182250
|
-
const percentage = energyState.max > 0 ? Math.round(energyState.current / energyState.max * 100) : 0;
|
|
182251
|
-
const response = {
|
|
182252
|
-
current: energyState.current,
|
|
182253
|
-
max: energyState.max,
|
|
182254
|
-
percentage,
|
|
182255
|
-
level: effects.level,
|
|
182256
|
-
regenRate: energyState.regenRate,
|
|
182257
|
-
effects: {
|
|
182258
|
-
promptModifier: effects.promptModifier ?? null,
|
|
182259
|
-
responseLengthFactor: effects.responseLengthFactor,
|
|
182260
|
-
processingDelayMs: effects.processingDelayMs
|
|
182261
|
-
}
|
|
182262
|
-
};
|
|
182263
|
-
return JSON.stringify(response, null, 2);
|
|
182264
|
-
},
|
|
182265
181779
|
resource_limits: async () => {
|
|
182266
181780
|
const contextInfo = context.getContextInfo?.();
|
|
182267
181781
|
const walletManager = context.getWalletManager?.();
|
|
@@ -182272,12 +181786,6 @@ function createSelfAwarenessToolExecutors(context) {
|
|
|
182272
181786
|
maxMessages: 500,
|
|
182273
181787
|
keepRecentMessages: 10
|
|
182274
181788
|
};
|
|
182275
|
-
const defaultEnergyCosts = {
|
|
182276
|
-
message: 200,
|
|
182277
|
-
toolCall: 500,
|
|
182278
|
-
llmCall: 300,
|
|
182279
|
-
longContext: 1000
|
|
182280
|
-
};
|
|
182281
181789
|
const response = {
|
|
182282
181790
|
context: {
|
|
182283
181791
|
maxTokens: contextConfig.maxContextTokens,
|
|
@@ -182286,13 +181794,6 @@ function createSelfAwarenessToolExecutors(context) {
|
|
|
182286
181794
|
maxMessages: contextConfig.maxMessages,
|
|
182287
181795
|
keepRecentMessages: contextConfig.keepRecentMessages
|
|
182288
181796
|
},
|
|
182289
|
-
energy: {
|
|
182290
|
-
enabled: true,
|
|
182291
|
-
maxEnergy: 1e4,
|
|
182292
|
-
lowThreshold: 3000,
|
|
182293
|
-
criticalThreshold: 1000,
|
|
182294
|
-
costs: defaultEnergyCosts
|
|
182295
|
-
},
|
|
182296
181797
|
wallet: {
|
|
182297
181798
|
configured: walletManager?.isConfigured() ?? false
|
|
182298
181799
|
}
|
|
@@ -182636,7 +182137,7 @@ function registerSelfAwarenessTools(registry2, context) {
|
|
|
182636
182137
|
registry2.register(tool2, executors[tool2.name]);
|
|
182637
182138
|
}
|
|
182638
182139
|
}
|
|
182639
|
-
var contextGetTool, contextStatsTool, whoamiTool, identityGetTool2,
|
|
182140
|
+
var contextGetTool, contextStatsTool, whoamiTool, identityGetTool2, resourceLimitsTool, sessionStatsTool, toolStatsTool, statsSummaryTool, sessionStateTool, workspaceMapTool, messageIndexTool, uiStateTool, selfAwarenessTools;
|
|
182640
182141
|
var init_self_awareness = __esm(() => {
|
|
182641
182142
|
contextGetTool = {
|
|
182642
182143
|
name: "context_get",
|
|
@@ -182674,18 +182175,9 @@ var init_self_awareness = __esm(() => {
|
|
|
182674
182175
|
required: []
|
|
182675
182176
|
}
|
|
182676
182177
|
};
|
|
182677
|
-
energyStatusTool2 = {
|
|
182678
|
-
name: "energy_status",
|
|
182679
|
-
description: "Get current energy state, level, and any effects (like response modifications). Check before expensive operations.",
|
|
182680
|
-
parameters: {
|
|
182681
|
-
type: "object",
|
|
182682
|
-
properties: {},
|
|
182683
|
-
required: []
|
|
182684
|
-
}
|
|
182685
|
-
};
|
|
182686
182178
|
resourceLimitsTool = {
|
|
182687
182179
|
name: "resource_limits",
|
|
182688
|
-
description: "Get current resource limits including context window
|
|
182180
|
+
description: "Get current resource limits including context window and wallet rate limits. Use for planning multi-step operations.",
|
|
182689
182181
|
parameters: {
|
|
182690
182182
|
type: "object",
|
|
182691
182183
|
properties: {},
|
|
@@ -182796,7 +182288,6 @@ var init_self_awareness = __esm(() => {
|
|
|
182796
182288
|
contextStatsTool,
|
|
182797
182289
|
whoamiTool,
|
|
182798
182290
|
identityGetTool2,
|
|
182799
|
-
energyStatusTool2,
|
|
182800
182291
|
resourceLimitsTool,
|
|
182801
182292
|
sessionStatsTool,
|
|
182802
182293
|
toolStatsTool,
|
|
@@ -185396,7 +184887,7 @@ Use for complex tasks that benefit from parallel processing or multiple perspect
|
|
|
185396
184887
|
|
|
185397
184888
|
// packages/core/src/memory/types.ts
|
|
185398
184889
|
var DEFAULT_MEMORY_CONFIG;
|
|
185399
|
-
var
|
|
184890
|
+
var init_types10 = __esm(() => {
|
|
185400
184891
|
DEFAULT_MEMORY_CONFIG = {
|
|
185401
184892
|
enabled: true,
|
|
185402
184893
|
injection: {
|
|
@@ -186030,7 +185521,7 @@ class GlobalMemoryManager {
|
|
|
186030
185521
|
var MAX_KEY_LENGTH2 = 256, MAX_VALUE_SIZE = 65536, MAX_SUMMARY_LENGTH2 = 500;
|
|
186031
185522
|
var init_global_memory = __esm(async () => {
|
|
186032
185523
|
init_src2();
|
|
186033
|
-
|
|
185524
|
+
init_types10();
|
|
186034
185525
|
await __promiseAll([
|
|
186035
185526
|
init_database(),
|
|
186036
185527
|
init_runtime()
|
|
@@ -186220,7 +185711,7 @@ var init_memory3 = __esm(async () => {
|
|
|
186220
185711
|
init_store13(),
|
|
186221
185712
|
init_global_memory()
|
|
186222
185713
|
]);
|
|
186223
|
-
|
|
185714
|
+
init_types10();
|
|
186224
185715
|
});
|
|
186225
185716
|
|
|
186226
185717
|
// packages/core/src/agent/subagent-manager.ts
|
|
@@ -186575,7 +186066,7 @@ var init_subagent_manager = __esm(() => {
|
|
|
186575
186066
|
|
|
186576
186067
|
// packages/core/src/capabilities/types.ts
|
|
186577
186068
|
var ORCHESTRATION_DEFAULTS, DEFAULT_CAPABILITY_SET, RESTRICTED_CAPABILITY_SET, COORDINATOR_CAPABILITY_SET;
|
|
186578
|
-
var
|
|
186069
|
+
var init_types11 = __esm(() => {
|
|
186579
186070
|
ORCHESTRATION_DEFAULTS = {
|
|
186580
186071
|
none: {
|
|
186581
186072
|
level: "none",
|
|
@@ -186891,7 +186382,7 @@ function extendCapabilityChain(chain3, scope, capabilities) {
|
|
|
186891
186382
|
};
|
|
186892
186383
|
}
|
|
186893
186384
|
var init_resolver = __esm(() => {
|
|
186894
|
-
|
|
186385
|
+
init_types11();
|
|
186895
186386
|
});
|
|
186896
186387
|
|
|
186897
186388
|
// packages/core/src/capabilities/storage.ts
|
|
@@ -187069,8 +186560,8 @@ function resetGlobalCapabilityStorage() {
|
|
|
187069
186560
|
}
|
|
187070
186561
|
}
|
|
187071
186562
|
var DEFAULT_STORAGE_CONFIG, globalStorage = null;
|
|
187072
|
-
var
|
|
187073
|
-
|
|
186563
|
+
var init_storage = __esm(async () => {
|
|
186564
|
+
init_types11();
|
|
187074
186565
|
await init_database();
|
|
187075
186566
|
DEFAULT_STORAGE_CONFIG = {
|
|
187076
186567
|
enabled: true,
|
|
@@ -187326,17 +186817,17 @@ function resetGlobalCapabilityEnforcer() {
|
|
|
187326
186817
|
var globalEnforcer = null;
|
|
187327
186818
|
var init_enforcer = __esm(async () => {
|
|
187328
186819
|
init_resolver();
|
|
187329
|
-
await
|
|
186820
|
+
await init_storage();
|
|
187330
186821
|
});
|
|
187331
186822
|
|
|
187332
186823
|
// packages/core/src/capabilities/index.ts
|
|
187333
186824
|
var init_capabilities2 = __esm(async () => {
|
|
187334
186825
|
init_resolver();
|
|
187335
186826
|
await __promiseAll([
|
|
187336
|
-
|
|
186827
|
+
init_storage(),
|
|
187337
186828
|
init_enforcer()
|
|
187338
186829
|
]);
|
|
187339
|
-
|
|
186830
|
+
init_types11();
|
|
187340
186831
|
});
|
|
187341
186832
|
|
|
187342
186833
|
// packages/core/src/agent/loop.ts
|
|
@@ -187359,7 +186850,6 @@ var init_loop = __esm(async () => {
|
|
|
187359
186850
|
init_assistant();
|
|
187360
186851
|
init_identity();
|
|
187361
186852
|
init_model();
|
|
187362
|
-
init_energy();
|
|
187363
186853
|
init_security();
|
|
187364
186854
|
init_web();
|
|
187365
186855
|
init_image();
|
|
@@ -187370,7 +186860,7 @@ var init_loop = __esm(async () => {
|
|
|
187370
186860
|
init_errors();
|
|
187371
186861
|
init_limits();
|
|
187372
186862
|
init_llm_response();
|
|
187373
|
-
|
|
186863
|
+
init_manager3();
|
|
187374
186864
|
init_self_awareness();
|
|
187375
186865
|
init_memory2();
|
|
187376
186866
|
init_agents();
|
|
@@ -187405,7 +186895,6 @@ var init_loop = __esm(async () => {
|
|
|
187405
186895
|
init_backup(),
|
|
187406
186896
|
init_migrate(),
|
|
187407
186897
|
init_heartbeat2(),
|
|
187408
|
-
init_energy2(),
|
|
187409
186898
|
init_store3(),
|
|
187410
186899
|
init_auto_refresh(),
|
|
187411
186900
|
init_identity2(),
|
|
@@ -187441,9 +186930,6 @@ var init_loop = __esm(async () => {
|
|
|
187441
186930
|
lastUserMessage = null;
|
|
187442
186931
|
lastToolName = null;
|
|
187443
186932
|
pendingToolCalls = new Map;
|
|
187444
|
-
energyManager = null;
|
|
187445
|
-
energyEffects = null;
|
|
187446
|
-
lastEnergyLevel = null;
|
|
187447
186933
|
toolRegistry;
|
|
187448
186934
|
connectorBridge;
|
|
187449
186935
|
skillLoader;
|
|
@@ -187837,8 +187323,6 @@ var init_loop = __esm(async () => {
|
|
|
187837
187323
|
getContextInfo: () => this.getContextInfo(),
|
|
187838
187324
|
getAssistantManager: () => this.assistantManager,
|
|
187839
187325
|
getIdentityManager: () => this.identityManager,
|
|
187840
|
-
getEnergyManager: () => this.energyManager,
|
|
187841
|
-
getEnergyState: () => this.getEnergyState(),
|
|
187842
187326
|
getWalletManager: () => this.walletManager,
|
|
187843
187327
|
sessionId: this.sessionId,
|
|
187844
187328
|
model: this.config?.llm?.model
|
|
@@ -187871,16 +187355,6 @@ var init_loop = __esm(async () => {
|
|
|
187871
187355
|
switchModel: async (modelId) => this.switchModel(modelId),
|
|
187872
187356
|
getLLMConfig: () => this.config?.llm ?? null
|
|
187873
187357
|
});
|
|
187874
|
-
registerEnergyTools(this.toolRegistry, {
|
|
187875
|
-
getEnergyManager: () => this.energyManager,
|
|
187876
|
-
getEnergyState: () => this.getEnergyState(),
|
|
187877
|
-
restEnergy: (amount) => {
|
|
187878
|
-
if (this.energyManager) {
|
|
187879
|
-
this.energyManager.rest(amount);
|
|
187880
|
-
this.refreshEnergyEffects();
|
|
187881
|
-
}
|
|
187882
|
-
}
|
|
187883
|
-
});
|
|
187884
187358
|
registerHeartbeatTools(this.toolRegistry, {
|
|
187885
187359
|
sessionId: this.sessionId,
|
|
187886
187360
|
getHeartbeatState: () => this.getHeartbeatState(),
|
|
@@ -188045,7 +187519,6 @@ You are running in **autonomous mode**. You manage your own wakeup schedule.
|
|
|
188045
187519
|
});
|
|
188046
187520
|
this.startHeartbeat();
|
|
188047
187521
|
await this.startAssistantHeartbeat();
|
|
188048
|
-
await this.startEnergySystem();
|
|
188049
187522
|
}
|
|
188050
187523
|
async process(userMessage) {
|
|
188051
187524
|
if (this.isRunning) {
|
|
@@ -188099,7 +187572,6 @@ You are running in **autonomous mode**. You manage your own wakeup schedule.
|
|
|
188099
187572
|
const beforeCount = this.context.getMessages().length;
|
|
188100
187573
|
this.lastUserMessage = userMessage;
|
|
188101
187574
|
this.recordHeartbeatActivity("message");
|
|
188102
|
-
this.consumeEnergy("message");
|
|
188103
187575
|
try {
|
|
188104
187576
|
if (source === "user") {
|
|
188105
187577
|
const promptHookResult = await this.hookExecutor.execute(this.hookLoader.getHooks("UserPromptSubmit"), {
|
|
@@ -188293,16 +187765,8 @@ You are running in **autonomous mode**. You manage your own wakeup schedule.
|
|
|
188293
187765
|
}
|
|
188294
187766
|
await this.maybeSummarizeContext();
|
|
188295
187767
|
const messages = this.context.getMessages();
|
|
188296
|
-
this.consumeEnergy("llmCall");
|
|
188297
|
-
if (this.contextConfig && this.contextManager) {
|
|
188298
|
-
const contextTokens = this.contextManager.getState().totalTokens;
|
|
188299
|
-
if (contextTokens > this.contextConfig.maxContextTokens * 0.8) {
|
|
188300
|
-
this.consumeEnergy("longContext");
|
|
188301
|
-
}
|
|
188302
|
-
}
|
|
188303
|
-
await this.applyEnergyDelay();
|
|
188304
187768
|
const tools = this.filterAllowedTools(this.toolRegistry.getTools());
|
|
188305
|
-
const systemPrompt = this.
|
|
187769
|
+
const systemPrompt = this.buildSystemPrompt(messages);
|
|
188306
187770
|
let responseText = "";
|
|
188307
187771
|
let toolCalls = [];
|
|
188308
187772
|
for await (const chunk of this.llmClient.chat(messages, tools, systemPrompt)) {
|
|
@@ -188746,7 +188210,6 @@ You are running in **autonomous mode**. You manage your own wakeup schedule.
|
|
|
188746
188210
|
results.push(askResult);
|
|
188747
188211
|
continue;
|
|
188748
188212
|
}
|
|
188749
|
-
this.consumeEnergy("toolCall");
|
|
188750
188213
|
this.recordHeartbeatActivity("tool");
|
|
188751
188214
|
this.lastToolName = toolCall.name;
|
|
188752
188215
|
this.pendingToolCalls.set(toolCall.id, toolCall.name);
|
|
@@ -188848,7 +188311,6 @@ You are running in **autonomous mode**. You manage your own wakeup schedule.
|
|
|
188848
188311
|
}
|
|
188849
188312
|
return result2;
|
|
188850
188313
|
},
|
|
188851
|
-
getEnergyState: () => this.getEnergyState(),
|
|
188852
188314
|
getAssistantManager: () => this.assistantManager,
|
|
188853
188315
|
getIdentityManager: () => this.identityManager,
|
|
188854
188316
|
getInboxManager: () => this.inboxManager,
|
|
@@ -188938,12 +188400,6 @@ You are running in **autonomous mode**. You manage your own wakeup schedule.
|
|
|
188938
188400
|
setAutoSend: (enabled) => {
|
|
188939
188401
|
this.voiceManager?.setAutoSend(enabled);
|
|
188940
188402
|
},
|
|
188941
|
-
restEnergy: (amount) => {
|
|
188942
|
-
if (this.energyManager) {
|
|
188943
|
-
this.energyManager.rest(amount);
|
|
188944
|
-
this.refreshEnergyEffects();
|
|
188945
|
-
}
|
|
188946
|
-
},
|
|
188947
188403
|
refreshConnectors: async () => {
|
|
188948
188404
|
const connectors = await this.connectorBridge.refresh();
|
|
188949
188405
|
return {
|
|
@@ -189161,7 +188617,6 @@ You are running in **autonomous mode**. You manage your own wakeup schedule.
|
|
|
189161
188617
|
}
|
|
189162
188618
|
this.heartbeatManager?.stop();
|
|
189163
188619
|
this.deregisterFromRegistry();
|
|
189164
|
-
this.energyManager?.stop();
|
|
189165
188620
|
this.voiceManager?.stopTalking();
|
|
189166
188621
|
this.messagesManager?.stopWatching();
|
|
189167
188622
|
this.webhooksManager?.stopWatching();
|
|
@@ -189386,9 +188841,6 @@ You are running in **autonomous mode**. You manage your own wakeup schedule.
|
|
|
189386
188841
|
state: this.contextManager.getState()
|
|
189387
188842
|
};
|
|
189388
188843
|
}
|
|
189389
|
-
getEnergyState() {
|
|
189390
|
-
return this.energyManager ? this.energyManager.getState() : null;
|
|
189391
|
-
}
|
|
189392
188844
|
updateTokenUsage(usage) {
|
|
189393
188845
|
this.builtinCommands.updateTokenUsage(usage);
|
|
189394
188846
|
this.onTokenUsage?.(this.builtinCommands.getTokenUsage());
|
|
@@ -189640,46 +189092,6 @@ ${content.trim()}`);
|
|
|
189640
189092
|
recordHeartbeatActivity(type) {
|
|
189641
189093
|
this.heartbeatManager?.recordActivity(type);
|
|
189642
189094
|
}
|
|
189643
|
-
async startEnergySystem() {
|
|
189644
|
-
if (!this.config || this.config.energy?.enabled === false)
|
|
189645
|
-
return;
|
|
189646
|
-
this.energyManager = new EnergyManager(this.config.energy, new EnergyStorage);
|
|
189647
|
-
await this.energyManager.initialize();
|
|
189648
|
-
this.refreshEnergyEffects();
|
|
189649
|
-
}
|
|
189650
|
-
consumeEnergy(action) {
|
|
189651
|
-
if (!this.energyManager)
|
|
189652
|
-
return;
|
|
189653
|
-
this.energyManager.consume(action);
|
|
189654
|
-
this.refreshEnergyEffects();
|
|
189655
|
-
}
|
|
189656
|
-
refreshEnergyEffects() {
|
|
189657
|
-
if (!this.energyManager)
|
|
189658
|
-
return;
|
|
189659
|
-
const effects = this.energyManager.getEffects();
|
|
189660
|
-
this.energyEffects = effects;
|
|
189661
|
-
if (this.lastEnergyLevel !== effects.level) {
|
|
189662
|
-
this.lastEnergyLevel = effects.level;
|
|
189663
|
-
if (effects.message) {
|
|
189664
|
-
this.emit({ type: "text", content: `
|
|
189665
|
-
${effects.message}
|
|
189666
|
-
` });
|
|
189667
|
-
}
|
|
189668
|
-
}
|
|
189669
|
-
}
|
|
189670
|
-
async applyEnergyDelay() {
|
|
189671
|
-
const delay = this.energyEffects?.processingDelayMs ?? 0;
|
|
189672
|
-
if (delay <= 0)
|
|
189673
|
-
return;
|
|
189674
|
-
await new Promise((resolve6) => setTimeout(resolve6, delay));
|
|
189675
|
-
}
|
|
189676
|
-
applyEnergyPersonality(systemPrompt) {
|
|
189677
|
-
if (!systemPrompt)
|
|
189678
|
-
return systemPrompt;
|
|
189679
|
-
if (!this.energyEffects)
|
|
189680
|
-
return systemPrompt;
|
|
189681
|
-
return applyPersonality(systemPrompt, this.energyEffects);
|
|
189682
|
-
}
|
|
189683
189095
|
async injectPendingMessages() {
|
|
189684
189096
|
if (!this.messagesManager)
|
|
189685
189097
|
return;
|
|
@@ -190874,7 +190286,7 @@ function inferToolMetadata(tool2) {
|
|
|
190874
190286
|
category = "interaction";
|
|
190875
190287
|
} else if (name === "display_image") {
|
|
190876
190288
|
category = "media";
|
|
190877
|
-
} else if (["context_get", "context_stats", "whoami", "identity_get", "
|
|
190289
|
+
} else if (["context_get", "context_stats", "whoami", "identity_get", "resource_limits"].includes(name)) {
|
|
190878
190290
|
category = "self-awareness";
|
|
190879
190291
|
} else if (name.startsWith("connector") || name === "connectors_list" || name === "connectors_search") {
|
|
190880
190292
|
category = "connectors";
|
|
@@ -191373,7 +190785,7 @@ function getCommandHistory() {
|
|
|
191373
190785
|
return globalHistory;
|
|
191374
190786
|
}
|
|
191375
190787
|
var MAX_HISTORY_SIZE = 1000, globalHistory = null;
|
|
191376
|
-
var
|
|
190788
|
+
var init_storage2 = __esm(async () => {
|
|
191377
190789
|
await init_database();
|
|
191378
190790
|
});
|
|
191379
190791
|
|
|
@@ -191802,10 +191214,8 @@ __export(exports_src3, {
|
|
|
191802
191214
|
ensureDefaultProject: () => ensureDefaultProject,
|
|
191803
191215
|
enforceToolOutputLimit: () => enforceToolOutputLimit,
|
|
191804
191216
|
enforceMessageLimit: () => enforceMessageLimit,
|
|
191805
|
-
energyStatusTool: () => energyStatusTool2,
|
|
191806
191217
|
encodeTwilioPayload: () => encodeTwilioPayload,
|
|
191807
191218
|
elevenLabsToTwilio: () => elevenLabsToTwilio,
|
|
191808
|
-
effectsForLevel: () => effectsForLevel,
|
|
191809
191219
|
downsample16kTo8k: () => downsample16kTo8k,
|
|
191810
191220
|
deleteTask: () => deleteTask,
|
|
191811
191221
|
deleteSkill: () => deleteSkill,
|
|
@@ -191915,7 +191325,6 @@ __export(exports_src3, {
|
|
|
191915
191325
|
buildToolsSystemPrompt: () => buildToolsSystemPrompt,
|
|
191916
191326
|
buildSystemAssistant: () => buildSystemAssistant,
|
|
191917
191327
|
buildProjectContext: () => buildProjectContext,
|
|
191918
|
-
buildEnergyConfig: () => buildEnergyConfig,
|
|
191919
191328
|
buildContextInjection: () => buildContextInjection,
|
|
191920
191329
|
backupIfNeeded: () => backupIfNeeded,
|
|
191921
191330
|
assistantTools: () => assistantTools2,
|
|
@@ -191925,7 +191334,6 @@ __export(exports_src3, {
|
|
|
191925
191334
|
assistantJobStatusTool: () => assistantJobStatusTool,
|
|
191926
191335
|
assistantDelegateTool: () => assistantDelegateTool,
|
|
191927
191336
|
assertNoExistingTarget: () => assertNoExistingTarget,
|
|
191928
|
-
applyPersonality: () => applyPersonality,
|
|
191929
191337
|
appendToHistory: () => appendToHistory,
|
|
191930
191338
|
aggregateTaskResults: () => aggregateTaskResults,
|
|
191931
191339
|
addTask: () => addTask,
|
|
@@ -192038,8 +191446,6 @@ __export(exports_src3, {
|
|
|
192038
191446
|
FeedbackTool: () => FeedbackTool,
|
|
192039
191447
|
ErrorCodes: () => ErrorCodes,
|
|
192040
191448
|
ErrorAggregator: () => ErrorAggregator,
|
|
192041
|
-
EnergyStorage: () => EnergyStorage,
|
|
192042
|
-
EnergyManager: () => EnergyManager,
|
|
192043
191449
|
EmbeddedClient: () => EmbeddedClient,
|
|
192044
191450
|
EmailParser: () => EmailParser,
|
|
192045
191451
|
ElevenLabsTTS: () => ElevenLabsTTS,
|
|
@@ -192061,8 +191467,6 @@ __export(exports_src3, {
|
|
|
192061
191467
|
DEFAULT_MEMORY_CONFIG: () => DEFAULT_MEMORY_CONFIG,
|
|
192062
191468
|
DEFAULT_MAX_SLEEP_MS: () => DEFAULT_MAX_SLEEP_MS,
|
|
192063
191469
|
DEFAULT_GUARDRAILS_CONFIG: () => DEFAULT_GUARDRAILS_CONFIG,
|
|
192064
|
-
DEFAULT_ENERGY_COSTS: () => DEFAULT_ENERGY_COSTS,
|
|
192065
|
-
DEFAULT_ENERGY_CONFIG: () => DEFAULT_ENERGY_CONFIG,
|
|
192066
191470
|
DEFAULT_DISPATCHER_CONFIG: () => DEFAULT_DISPATCHER_CONFIG,
|
|
192067
191471
|
DEFAULT_DEPTH_POLICY: () => DEFAULT_DEPTH_POLICY,
|
|
192068
191472
|
DEFAULT_DECISION_POLICY: () => DEFAULT_DECISION_POLICY,
|
|
@@ -192130,10 +191534,10 @@ var init_src3 = __esm(async () => {
|
|
|
192130
191534
|
init_native();
|
|
192131
191535
|
init_scope_context();
|
|
192132
191536
|
init_injector();
|
|
192133
|
-
|
|
191537
|
+
init_types10();
|
|
192134
191538
|
init_memory2();
|
|
192135
191539
|
init_voice();
|
|
192136
|
-
|
|
191540
|
+
init_manager3();
|
|
192137
191541
|
init_player();
|
|
192138
191542
|
init_recorder();
|
|
192139
191543
|
init_stt();
|
|
@@ -192182,11 +191586,10 @@ var init_src3 = __esm(async () => {
|
|
|
192182
191586
|
init_store12(),
|
|
192183
191587
|
init_sessions3(),
|
|
192184
191588
|
init_logger2(),
|
|
192185
|
-
|
|
191589
|
+
init_storage2()
|
|
192186
191590
|
]);
|
|
192187
191591
|
init_context2();
|
|
192188
191592
|
init_heartbeat2();
|
|
192189
|
-
init_energy2();
|
|
192190
191593
|
init_identity2();
|
|
192191
191594
|
init_migration();
|
|
192192
191595
|
init_inbox();
|
|
@@ -236913,7 +236316,6 @@ function Status({
|
|
|
236913
236316
|
cwd: cwd3,
|
|
236914
236317
|
queueLength = 0,
|
|
236915
236318
|
tokenUsage,
|
|
236916
|
-
energyState,
|
|
236917
236319
|
voiceState,
|
|
236918
236320
|
heartbeatState,
|
|
236919
236321
|
identityInfo,
|
|
@@ -236985,7 +236387,6 @@ function Status({
|
|
|
236985
236387
|
}
|
|
236986
236388
|
const sessionInfo = sessionCount && sessionCount > 1 && sessionIndex !== undefined ? `${sessionIndex + 1}/${sessionCount}` : "";
|
|
236987
236389
|
const bgIndicator = backgroundProcessingCount > 0 ? ` +${backgroundProcessingCount}` : "";
|
|
236988
|
-
const energyInfo = energyState ? `${Math.round(energyState.current / energyState.max * 100)}%` : "";
|
|
236989
236390
|
const voiceLabel = voiceState?.enabled ? voiceState.isTalking ? "talk" : voiceState.isListening ? "mic" : voiceState.isSpeaking ? "spk" : "voice" : "";
|
|
236990
236391
|
const heartbeatLabel = heartbeatState?.enabled ? heartbeatState.isStale ? "hb!" : "hb" : "";
|
|
236991
236392
|
const heartbeatDisplay = heartbeatLabel ? `${heartbeatLabel}${heartbeatCountdown ? ` ${heartbeatCountdown}` : ""}` : "";
|
|
@@ -237028,8 +236429,6 @@ function Status({
|
|
|
237028
236429
|
rightParts.push(formatDuration4(elapsed));
|
|
237029
236430
|
if (sessionInfo)
|
|
237030
236431
|
rightParts.push(`${sessionInfo}${bgIndicator}`);
|
|
237031
|
-
if (energyInfo)
|
|
237032
|
-
rightParts.push(energyInfo);
|
|
237033
236432
|
if (contextInfo)
|
|
237034
236433
|
rightParts.push(contextInfo);
|
|
237035
236434
|
if (verboseLabel)
|
|
@@ -244301,7 +243700,6 @@ var SECTIONS = [
|
|
|
244301
243700
|
{ id: "memory", name: "Memory" },
|
|
244302
243701
|
{ id: "subassistants", name: "Subassistants" },
|
|
244303
243702
|
{ id: "voice", name: "Voice" },
|
|
244304
|
-
{ id: "energy", name: "Energy" },
|
|
244305
243703
|
{ id: "statusLine", name: "Status Line" }
|
|
244306
243704
|
];
|
|
244307
243705
|
function ConfigPanel({
|
|
@@ -244324,9 +243722,6 @@ function ConfigPanel({
|
|
|
244324
243722
|
const defaultModelIndex = Math.max(0, ALL_MODELS.findIndex((m5) => m5.id === DEFAULT_MODEL));
|
|
244325
243723
|
const [selectedModelIndex, setSelectedModelIndex] = import_react55.useState(configModelIndex >= 0 ? configModelIndex : defaultModelIndex);
|
|
244326
243724
|
const [maxTokens, setMaxTokens] = import_react55.useState(config2.llm?.maxTokens ?? 8192);
|
|
244327
|
-
const [selectedEnergyField, setSelectedEnergyField] = import_react55.useState(0);
|
|
244328
|
-
const [energyMaxEnergy, setEnergyMaxEnergy] = import_react55.useState(config2.energy?.maxEnergy ?? 1e4);
|
|
244329
|
-
const [energyRegenRate, setEnergyRegenRate] = import_react55.useState(config2.energy?.regenRate ?? 500);
|
|
244330
243725
|
import_react55.useEffect(() => {
|
|
244331
243726
|
if (message) {
|
|
244332
243727
|
const timer = setTimeout(() => setMessage(null), 3000);
|
|
@@ -244399,8 +243794,6 @@ function ConfigPanel({
|
|
|
244399
243794
|
handleSaveField("memory.enabled", !config2.memory?.enabled);
|
|
244400
243795
|
} else if (section.id === "voice") {
|
|
244401
243796
|
handleSaveField("voice.enabled", !config2.voice?.enabled);
|
|
244402
|
-
} else if (section.id === "energy") {
|
|
244403
|
-
handleSaveField("energy.enabled", !config2.energy?.enabled);
|
|
244404
243797
|
}
|
|
244405
243798
|
return;
|
|
244406
243799
|
}
|
|
@@ -244427,37 +243820,6 @@ function ConfigPanel({
|
|
|
244427
243820
|
}
|
|
244428
243821
|
return;
|
|
244429
243822
|
}
|
|
244430
|
-
if (section.id === "energy" && !editingField && input !== "t" && input !== "T") {
|
|
244431
|
-
if (key.upArrow) {
|
|
244432
|
-
setSelectedEnergyField((prev) => prev === 0 ? 1 : 0);
|
|
244433
|
-
return;
|
|
244434
|
-
}
|
|
244435
|
-
if (key.downArrow) {
|
|
244436
|
-
setSelectedEnergyField((prev) => prev === 1 ? 0 : 1);
|
|
244437
|
-
return;
|
|
244438
|
-
}
|
|
244439
|
-
if (key.leftArrow) {
|
|
244440
|
-
if (selectedEnergyField === 0) {
|
|
244441
|
-
setEnergyMaxEnergy((prev) => Math.max(1000, prev - 1000));
|
|
244442
|
-
} else {
|
|
244443
|
-
setEnergyRegenRate((prev) => Math.max(100, prev - 100));
|
|
244444
|
-
}
|
|
244445
|
-
return;
|
|
244446
|
-
}
|
|
244447
|
-
if (key.rightArrow) {
|
|
244448
|
-
if (selectedEnergyField === 0) {
|
|
244449
|
-
setEnergyMaxEnergy((prev) => Math.min(1e5, prev + 1000));
|
|
244450
|
-
} else {
|
|
244451
|
-
setEnergyRegenRate((prev) => Math.min(5000, prev + 100));
|
|
244452
|
-
}
|
|
244453
|
-
return;
|
|
244454
|
-
}
|
|
244455
|
-
if (key.return || input === "s" || input === "S") {
|
|
244456
|
-
setMode("location-select");
|
|
244457
|
-
return;
|
|
244458
|
-
}
|
|
244459
|
-
return;
|
|
244460
|
-
}
|
|
244461
243823
|
if (section.id === "statusLine" && !editingField) {
|
|
244462
243824
|
const sl = config2.statusLine || {};
|
|
244463
243825
|
const toggleField = (field, current) => {
|
|
@@ -244562,15 +243924,6 @@ function ConfigPanel({
|
|
|
244562
243924
|
}
|
|
244563
243925
|
};
|
|
244564
243926
|
}
|
|
244565
|
-
if (!saveUpdates && section.id === "energy") {
|
|
244566
|
-
saveUpdates = {
|
|
244567
|
-
energy: {
|
|
244568
|
-
...config2.energy,
|
|
244569
|
-
maxEnergy: energyMaxEnergy,
|
|
244570
|
-
regenRate: energyRegenRate
|
|
244571
|
-
}
|
|
244572
|
-
};
|
|
244573
|
-
}
|
|
244574
243927
|
if (saveUpdates) {
|
|
244575
243928
|
await onSave(location, saveUpdates);
|
|
244576
243929
|
setMessage({ type: "success", text: `Saved to ${location} config` });
|
|
@@ -245165,132 +244518,6 @@ function ConfigPanel({
|
|
|
245165
244518
|
}, undefined, false, undefined, this)
|
|
245166
244519
|
]
|
|
245167
244520
|
}, undefined, true, undefined, this);
|
|
245168
|
-
case "energy":
|
|
245169
|
-
return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
|
|
245170
|
-
flexDirection: "column",
|
|
245171
|
-
children: [
|
|
245172
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245173
|
-
bold: true,
|
|
245174
|
-
children: "Energy Settings"
|
|
245175
|
-
}, undefined, false, undefined, this),
|
|
245176
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
|
|
245177
|
-
marginTop: 1,
|
|
245178
|
-
flexDirection: "column",
|
|
245179
|
-
children: [
|
|
245180
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245181
|
-
children: [
|
|
245182
|
-
"Enabled: ",
|
|
245183
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245184
|
-
color: config2.energy?.enabled ? "green" : "red",
|
|
245185
|
-
children: config2.energy?.enabled ? "Yes" : "No"
|
|
245186
|
-
}, undefined, false, undefined, this),
|
|
245187
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245188
|
-
dimColor: true,
|
|
245189
|
-
children: [
|
|
245190
|
-
" (t to toggle) ",
|
|
245191
|
-
getSource("energy.enabled")
|
|
245192
|
-
]
|
|
245193
|
-
}, undefined, true, undefined, this)
|
|
245194
|
-
]
|
|
245195
|
-
}, undefined, true, undefined, this),
|
|
245196
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
|
|
245197
|
-
children: [
|
|
245198
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245199
|
-
inverse: selectedEnergyField === 0,
|
|
245200
|
-
children: [
|
|
245201
|
-
selectedEnergyField === 0 ? ">" : " ",
|
|
245202
|
-
" Max Energy: ",
|
|
245203
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245204
|
-
color: "cyan",
|
|
245205
|
-
children: energyMaxEnergy
|
|
245206
|
-
}, undefined, false, undefined, this)
|
|
245207
|
-
]
|
|
245208
|
-
}, undefined, true, undefined, this),
|
|
245209
|
-
selectedEnergyField === 0 && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245210
|
-
dimColor: true,
|
|
245211
|
-
children: " (\u2190\u2192 adjust)"
|
|
245212
|
-
}, undefined, false, undefined, this)
|
|
245213
|
-
]
|
|
245214
|
-
}, undefined, true, undefined, this),
|
|
245215
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
|
|
245216
|
-
children: [
|
|
245217
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245218
|
-
inverse: selectedEnergyField === 1,
|
|
245219
|
-
children: [
|
|
245220
|
-
selectedEnergyField === 1 ? ">" : " ",
|
|
245221
|
-
" Regen Rate: ",
|
|
245222
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245223
|
-
color: "cyan",
|
|
245224
|
-
children: energyRegenRate
|
|
245225
|
-
}, undefined, false, undefined, this),
|
|
245226
|
-
"/min"
|
|
245227
|
-
]
|
|
245228
|
-
}, undefined, true, undefined, this),
|
|
245229
|
-
selectedEnergyField === 1 && /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245230
|
-
dimColor: true,
|
|
245231
|
-
children: " (\u2190\u2192 adjust)"
|
|
245232
|
-
}, undefined, false, undefined, this)
|
|
245233
|
-
]
|
|
245234
|
-
}, undefined, true, undefined, this),
|
|
245235
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245236
|
-
children: [
|
|
245237
|
-
"Low Threshold: ",
|
|
245238
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245239
|
-
color: "cyan",
|
|
245240
|
-
children: config2.energy?.lowEnergyThreshold ?? 3000
|
|
245241
|
-
}, undefined, false, undefined, this)
|
|
245242
|
-
]
|
|
245243
|
-
}, undefined, true, undefined, this),
|
|
245244
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245245
|
-
children: [
|
|
245246
|
-
"Critical Threshold: ",
|
|
245247
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245248
|
-
color: "cyan",
|
|
245249
|
-
children: config2.energy?.criticalThreshold ?? 1000
|
|
245250
|
-
}, undefined, false, undefined, this)
|
|
245251
|
-
]
|
|
245252
|
-
}, undefined, true, undefined, this)
|
|
245253
|
-
]
|
|
245254
|
-
}, undefined, true, undefined, this),
|
|
245255
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
|
|
245256
|
-
marginTop: 1,
|
|
245257
|
-
children: [
|
|
245258
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245259
|
-
dimColor: true,
|
|
245260
|
-
children: "Costs:"
|
|
245261
|
-
}, undefined, false, undefined, this),
|
|
245262
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245263
|
-
dimColor: true,
|
|
245264
|
-
children: [
|
|
245265
|
-
" Message: ",
|
|
245266
|
-
config2.energy?.costs?.message ?? 200
|
|
245267
|
-
]
|
|
245268
|
-
}, undefined, true, undefined, this),
|
|
245269
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245270
|
-
dimColor: true,
|
|
245271
|
-
children: [
|
|
245272
|
-
" Tool Call: ",
|
|
245273
|
-
config2.energy?.costs?.toolCall ?? 500
|
|
245274
|
-
]
|
|
245275
|
-
}, undefined, true, undefined, this),
|
|
245276
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245277
|
-
dimColor: true,
|
|
245278
|
-
children: [
|
|
245279
|
-
" LLM Call: ",
|
|
245280
|
-
config2.energy?.costs?.llmCall ?? 300
|
|
245281
|
-
]
|
|
245282
|
-
}, undefined, true, undefined, this)
|
|
245283
|
-
]
|
|
245284
|
-
}, undefined, true, undefined, this),
|
|
245285
|
-
/* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Box_default, {
|
|
245286
|
-
marginTop: 1,
|
|
245287
|
-
children: /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(Text, {
|
|
245288
|
-
dimColor: true,
|
|
245289
|
-
children: "\u2191\u2193 select | \u2190\u2192 adjust | t toggle | Enter/s save | Esc back"
|
|
245290
|
-
}, undefined, false, undefined, this)
|
|
245291
|
-
}, undefined, false, undefined, this)
|
|
245292
|
-
]
|
|
245293
|
-
}, undefined, true, undefined, this);
|
|
245294
244521
|
case "statusLine": {
|
|
245295
244522
|
const sl = config2.statusLine || {};
|
|
245296
244523
|
const showIcon = (v5) => v5 ?? true ? "Yes" : "No";
|
|
@@ -264842,7 +264069,6 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
264842
264069
|
const [inlinePending, setInlinePending] = import_react86.useState([]);
|
|
264843
264070
|
const [activityLog, setActivityLog] = import_react86.useState([]);
|
|
264844
264071
|
const [tokenUsage, setTokenUsage] = import_react86.useState();
|
|
264845
|
-
const [energyState, setEnergyState] = import_react86.useState();
|
|
264846
264072
|
const [voiceState, setVoiceState] = import_react86.useState();
|
|
264847
264073
|
const [heartbeatState, setHeartbeatState] = import_react86.useState();
|
|
264848
264074
|
const [identityInfo, setIdentityInfo] = import_react86.useState();
|
|
@@ -265340,7 +264566,6 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
265340
264566
|
toolCalls: toolCallsRef.current,
|
|
265341
264567
|
toolResults: toolResultsRef.current,
|
|
265342
264568
|
tokenUsage,
|
|
265343
|
-
energyState,
|
|
265344
264569
|
voiceState,
|
|
265345
264570
|
heartbeatState,
|
|
265346
264571
|
identityInfo,
|
|
@@ -265350,7 +264575,7 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
265350
264575
|
lastWorkedFor
|
|
265351
264576
|
});
|
|
265352
264577
|
}
|
|
265353
|
-
}, [activeSessionId, messages2, tokenUsage,
|
|
264578
|
+
}, [activeSessionId, messages2, tokenUsage, voiceState, heartbeatState, identityInfo, processingStartTime, currentTurnTokens, error4, lastWorkedFor]);
|
|
265354
264579
|
const loadSessionState = import_react86.useCallback((sessionId) => {
|
|
265355
264580
|
const state = sessionUIStates.current.get(sessionId);
|
|
265356
264581
|
const askState = askUserStateRef.current.get(sessionId) || null;
|
|
@@ -265365,7 +264590,6 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
265365
264590
|
toolResultsRef.current = state.toolResults;
|
|
265366
264591
|
setCurrentToolCall(undefined);
|
|
265367
264592
|
setTokenUsage(state.tokenUsage);
|
|
265368
|
-
setEnergyState(state.energyState);
|
|
265369
264593
|
setVoiceState(state.voiceState);
|
|
265370
264594
|
setHeartbeatState(state.heartbeatState);
|
|
265371
264595
|
setIdentityInfo(state.identityInfo);
|
|
@@ -265386,7 +264610,6 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
265386
264610
|
toolResultsRef.current = [];
|
|
265387
264611
|
setCurrentToolCall(undefined);
|
|
265388
264612
|
setTokenUsage(undefined);
|
|
265389
|
-
setEnergyState(undefined);
|
|
265390
264613
|
setVoiceState(undefined);
|
|
265391
264614
|
setHeartbeatState(undefined);
|
|
265392
264615
|
setIdentityInfo(undefined);
|
|
@@ -265448,7 +264671,6 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
265448
264671
|
if (session) {
|
|
265449
264672
|
setIsProcessing(session.isProcessing);
|
|
265450
264673
|
isProcessingRef.current = session.isProcessing;
|
|
265451
|
-
setEnergyState(session.client.getEnergyState() ?? undefined);
|
|
265452
264674
|
setVoiceState(session.client.getVoiceState() ?? undefined);
|
|
265453
264675
|
setHeartbeatState(session.client.getHeartbeatState?.() ?? undefined);
|
|
265454
264676
|
setIdentityInfo(session.client.getIdentityInfo() ?? undefined);
|
|
@@ -265482,7 +264704,6 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
265482
264704
|
loadSessionState(newSession.id);
|
|
265483
264705
|
setIsProcessing(false);
|
|
265484
264706
|
isProcessingRef.current = false;
|
|
265485
|
-
setEnergyState(newSession.client.getEnergyState() ?? undefined);
|
|
265486
264707
|
setVoiceState(newSession.client.getVoiceState() ?? undefined);
|
|
265487
264708
|
setHeartbeatState(newSession.client.getHeartbeatState?.() ?? undefined);
|
|
265488
264709
|
setIdentityInfo(newSession.client.getIdentityInfo() ?? undefined);
|
|
@@ -265512,7 +264733,6 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
265512
264733
|
toolCalls: [],
|
|
265513
264734
|
toolResults: [],
|
|
265514
264735
|
tokenUsage: undefined,
|
|
265515
|
-
energyState: undefined,
|
|
265516
264736
|
voiceState: undefined,
|
|
265517
264737
|
heartbeatState: undefined,
|
|
265518
264738
|
identityInfo: undefined,
|
|
@@ -265588,7 +264808,6 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
265588
264808
|
toolResultsRef.current = [];
|
|
265589
264809
|
setCurrentToolCall(undefined);
|
|
265590
264810
|
setTokenUsage(undefined);
|
|
265591
|
-
setEnergyState(undefined);
|
|
265592
264811
|
setVoiceState(undefined);
|
|
265593
264812
|
setHeartbeatState(undefined);
|
|
265594
264813
|
setIdentityInfo(undefined);
|
|
@@ -265778,7 +264997,6 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
265778
264997
|
const activeSession2 = registry3.getActiveSession();
|
|
265779
264998
|
if (activeSession2) {
|
|
265780
264999
|
setTokenUsage(activeSession2.client.getTokenUsage());
|
|
265781
|
-
setEnergyState(activeSession2.client.getEnergyState() ?? undefined);
|
|
265782
265000
|
setVoiceState(activeSession2.client.getVoiceState() ?? undefined);
|
|
265783
265001
|
setHeartbeatState(activeSession2.client.getHeartbeatState?.() ?? undefined);
|
|
265784
265002
|
setIdentityInfo(activeSession2.client.getIdentityInfo() ?? undefined);
|
|
@@ -266150,7 +265368,6 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
266150
265368
|
session.client.setAskUserHandler((request2) => beginAskUser(session.id, request2));
|
|
266151
265369
|
session.client.setInterviewHandler((request2) => beginInterview(session.id, request2));
|
|
266152
265370
|
await loadSessionMetadata(session);
|
|
266153
|
-
setEnergyState(session.client.getEnergyState() ?? undefined);
|
|
266154
265371
|
setVoiceState(session.client.getVoiceState() ?? undefined);
|
|
266155
265372
|
setHeartbeatState(session.client.getHeartbeatState?.() ?? undefined);
|
|
266156
265373
|
setIdentityInfo(session.client.getIdentityInfo() ?? undefined);
|
|
@@ -267016,7 +266233,6 @@ function App2({ cwd: cwd3, version: version4 }) {
|
|
|
267016
266233
|
toolCalls: [],
|
|
267017
266234
|
toolResults: [],
|
|
267018
266235
|
tokenUsage: { inputTokens: 0, outputTokens: 0, totalTokens: 0, maxContextTokens: tokenUsage?.maxContextTokens || 200000 },
|
|
267019
|
-
energyState,
|
|
267020
266236
|
voiceState,
|
|
267021
266237
|
heartbeatState,
|
|
267022
266238
|
identityInfo,
|
|
@@ -268966,7 +268182,6 @@ ${msg.body || msg.preview}`);
|
|
|
268966
268182
|
cwd: activeSession?.cwd || cwd3,
|
|
268967
268183
|
queueLength: activeQueue.length + inlineCount,
|
|
268968
268184
|
tokenUsage,
|
|
268969
|
-
energyState,
|
|
268970
268185
|
voiceState,
|
|
268971
268186
|
heartbeatState,
|
|
268972
268187
|
identityInfo,
|
|
@@ -269453,7 +268668,7 @@ process.on("unhandledRejection", (reason) => {
|
|
|
269453
268668
|
cleanup();
|
|
269454
268669
|
process.exit(1);
|
|
269455
268670
|
});
|
|
269456
|
-
var VERSION4 = "1.1.
|
|
268671
|
+
var VERSION4 = "1.1.71";
|
|
269457
268672
|
var SYNC_START = "\x1B[?2026h";
|
|
269458
268673
|
var SYNC_END = "\x1B[?2026l";
|
|
269459
268674
|
function enableSynchronizedOutput() {
|
|
@@ -269594,4 +268809,4 @@ export {
|
|
|
269594
268809
|
main
|
|
269595
268810
|
};
|
|
269596
268811
|
|
|
269597
|
-
//# debugId=
|
|
268812
|
+
//# debugId=8C3BA3A5477FA3B564756E2164756E21
|