holomime 3.4.0 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/cli.js +544 -343
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9,6 +9,38 @@ var __export = (target, all) => {
|
|
|
9
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
// src/ui/branding.ts
|
|
13
|
+
import chalk from "chalk";
|
|
14
|
+
import gradientString from "gradient-string";
|
|
15
|
+
function printBanner() {
|
|
16
|
+
console.log();
|
|
17
|
+
console.log(holomimeGradient(LOGO));
|
|
18
|
+
console.log();
|
|
19
|
+
console.log(` ${chalk.dim("Behavioral intelligence for AI agents and humanoid robots")} ${chalk.bgCyan.black(` v${VERSION} `)}`);
|
|
20
|
+
console.log();
|
|
21
|
+
}
|
|
22
|
+
function printHeader(title) {
|
|
23
|
+
const line = "\u2550".repeat(title.length + 4);
|
|
24
|
+
console.log();
|
|
25
|
+
console.log(holomimeGradient(` ${line}`));
|
|
26
|
+
console.log(holomimeGradient(` \u2551 ${title} \u2551`));
|
|
27
|
+
console.log(holomimeGradient(` ${line}`));
|
|
28
|
+
console.log();
|
|
29
|
+
}
|
|
30
|
+
var VERSION, LOGO, holomimeGradient;
|
|
31
|
+
var init_branding = __esm({
|
|
32
|
+
"src/ui/branding.ts"() {
|
|
33
|
+
"use strict";
|
|
34
|
+
VERSION = "3.5.1";
|
|
35
|
+
LOGO = ` _ _ _
|
|
36
|
+
| |__ ___ | | ___ _ __ (_)_ __ ___ ___
|
|
37
|
+
| '_ \\ / _ \\| |/ _ \\| '_ \\| | '_ \` _ \\ / _ \\
|
|
38
|
+
| | | | (_) | | (_) | | | | | | | | | | __/
|
|
39
|
+
|_| |_|\\___/|_|\\___/|_| |_|_|_| |_| |_|\\___|`;
|
|
40
|
+
holomimeGradient = gradientString("#00d4ff", "#b347d9");
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
12
44
|
// src/core/embodiment-types.ts
|
|
13
45
|
import { z } from "zod";
|
|
14
46
|
var modalitySchema, morphologySchema, safetyEnvelopeSchema, embodimentSchema, gazePolicySchema, proxemicZoneSchema, hapticPolicySchema, prosodySchema, gestureSchema, expressionSchema, physicalSafetySchema, motionParametersSchema, compiledEmbodiedConfigSchema;
|
|
@@ -3587,34 +3619,164 @@ var init_generic_adapter = __esm({
|
|
|
3587
3619
|
}
|
|
3588
3620
|
});
|
|
3589
3621
|
|
|
3590
|
-
// src/
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
function
|
|
3622
|
+
// src/commands/config.ts
|
|
3623
|
+
var config_exports = {};
|
|
3624
|
+
__export(config_exports, {
|
|
3625
|
+
configCommand: () => configCommand,
|
|
3626
|
+
getConfigDir: () => getConfigDir,
|
|
3627
|
+
getConfigPath: () => getConfigPath,
|
|
3628
|
+
loadConfig: () => loadConfig2,
|
|
3629
|
+
saveConfig: () => saveConfig
|
|
3630
|
+
});
|
|
3631
|
+
import { readFileSync as readFileSync45, writeFileSync as writeFileSync37, existsSync as existsSync41, mkdirSync as mkdirSync26 } from "fs";
|
|
3632
|
+
import { join as join37 } from "path";
|
|
3633
|
+
import { homedir as homedir8 } from "os";
|
|
3634
|
+
import chalk44 from "chalk";
|
|
3635
|
+
function getConfigPath() {
|
|
3636
|
+
return join37(homedir8(), ".holomime", "config.json");
|
|
3637
|
+
}
|
|
3638
|
+
function getConfigDir() {
|
|
3639
|
+
return join37(homedir8(), ".holomime");
|
|
3640
|
+
}
|
|
3641
|
+
function loadConfig2() {
|
|
3642
|
+
const configPath = getConfigPath();
|
|
3643
|
+
if (!existsSync41(configPath)) return null;
|
|
3644
|
+
try {
|
|
3645
|
+
const data = JSON.parse(readFileSync45(configPath, "utf-8"));
|
|
3646
|
+
if (data.provider && data.apiKey) return data;
|
|
3647
|
+
return null;
|
|
3648
|
+
} catch {
|
|
3649
|
+
return null;
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
function saveConfig(config) {
|
|
3653
|
+
const configDir = getConfigDir();
|
|
3654
|
+
mkdirSync26(configDir, { recursive: true });
|
|
3655
|
+
writeFileSync37(getConfigPath(), JSON.stringify(config, null, 2));
|
|
3656
|
+
}
|
|
3657
|
+
async function configCommand(options) {
|
|
3658
|
+
printHeader("Config");
|
|
3659
|
+
if (options.show) {
|
|
3660
|
+
const config = loadConfig2();
|
|
3661
|
+
if (config) {
|
|
3662
|
+
const mask = (k) => k.slice(0, 8) + "..." + k.slice(-4);
|
|
3663
|
+
console.log(chalk44.dim(" Provider: ") + chalk44.cyan(config.provider));
|
|
3664
|
+
console.log(chalk44.dim(" API Key: ") + chalk44.cyan(mask(config.apiKey)));
|
|
3665
|
+
if (config.openaiKey) {
|
|
3666
|
+
console.log(chalk44.dim(" OpenAI Key: ") + chalk44.cyan(mask(config.openaiKey)));
|
|
3667
|
+
}
|
|
3668
|
+
if (config.hfToken) {
|
|
3669
|
+
console.log(chalk44.dim(" HF Token: ") + chalk44.cyan(mask(config.hfToken)));
|
|
3670
|
+
}
|
|
3671
|
+
if (config.model) {
|
|
3672
|
+
console.log(chalk44.dim(" Model: ") + chalk44.cyan(config.model));
|
|
3673
|
+
}
|
|
3674
|
+
console.log(chalk44.dim(" Config: ") + getConfigPath());
|
|
3675
|
+
} else {
|
|
3676
|
+
console.log(chalk44.yellow(" No config found. Run `holomime config` to set up."));
|
|
3677
|
+
}
|
|
3678
|
+
console.log();
|
|
3679
|
+
return;
|
|
3680
|
+
}
|
|
3681
|
+
if (options.provider && options.key) {
|
|
3682
|
+
const config = {
|
|
3683
|
+
provider: options.provider,
|
|
3684
|
+
apiKey: options.key
|
|
3685
|
+
};
|
|
3686
|
+
saveConfig(config);
|
|
3687
|
+
console.log(chalk44.green(" Config saved!"));
|
|
3688
|
+
console.log(chalk44.dim(` Provider: ${config.provider}`));
|
|
3689
|
+
console.log(chalk44.dim(` Location: ${getConfigPath()}`));
|
|
3690
|
+
console.log();
|
|
3691
|
+
printNextSteps();
|
|
3692
|
+
return;
|
|
3693
|
+
}
|
|
3694
|
+
console.log(chalk44.dim(" Set up your API key so every command just works."));
|
|
3695
|
+
console.log(chalk44.dim(" This saves to ~/.holomime/config.json (one-time setup)."));
|
|
3604
3696
|
console.log();
|
|
3605
|
-
|
|
3697
|
+
const readline = await import("readline");
|
|
3698
|
+
const rl = readline.createInterface({
|
|
3699
|
+
input: process.stdin,
|
|
3700
|
+
output: process.stdout
|
|
3701
|
+
});
|
|
3702
|
+
const ask = (question) => new Promise((resolve57) => rl.question(question, resolve57));
|
|
3703
|
+
try {
|
|
3704
|
+
console.log(chalk44.dim(" 1) anthropic") + chalk44.dim(" enter your sk-ant-... key"));
|
|
3705
|
+
console.log(chalk44.dim(" 2) openai") + chalk44.dim(" enter your sk-... key"));
|
|
3706
|
+
console.log();
|
|
3707
|
+
const providerInput = (await ask(" Select provider (1 or 2): ")).trim();
|
|
3708
|
+
let provider;
|
|
3709
|
+
if (providerInput === "1" || providerInput.toLowerCase() === "anthropic") {
|
|
3710
|
+
provider = "anthropic";
|
|
3711
|
+
} else if (providerInput === "2" || providerInput.toLowerCase() === "openai") {
|
|
3712
|
+
provider = "openai";
|
|
3713
|
+
} else if (providerInput === "") {
|
|
3714
|
+
console.log(chalk44.dim(" Skipped. Run `holomime config` when ready."));
|
|
3715
|
+
rl.close();
|
|
3716
|
+
return;
|
|
3717
|
+
} else {
|
|
3718
|
+
console.log(chalk44.red(` Invalid selection: ${providerInput}`));
|
|
3719
|
+
rl.close();
|
|
3720
|
+
return;
|
|
3721
|
+
}
|
|
3722
|
+
console.log(chalk44.dim(` Selected: ${provider}`));
|
|
3723
|
+
console.log();
|
|
3724
|
+
const keyHint = provider === "anthropic" ? "sk-ant-..." : "sk-...";
|
|
3725
|
+
const apiKey = (await ask(` API Key (${keyHint}): `)).trim();
|
|
3726
|
+
if (!apiKey) {
|
|
3727
|
+
console.log(chalk44.dim(" Skipped. Run `holomime config` when ready."));
|
|
3728
|
+
rl.close();
|
|
3729
|
+
return;
|
|
3730
|
+
}
|
|
3731
|
+
const config = { provider, apiKey };
|
|
3732
|
+
console.log();
|
|
3733
|
+
if (provider === "anthropic") {
|
|
3734
|
+
console.log(chalk44.dim(" Optional: OpenAI key for fine-tuning (press enter to skip)"));
|
|
3735
|
+
const openaiKey = (await ask(" OpenAI Key (sk-...): ")).trim();
|
|
3736
|
+
if (openaiKey) config.openaiKey = openaiKey;
|
|
3737
|
+
}
|
|
3738
|
+
console.log(chalk44.dim(" Optional: HuggingFace token for dataset export (press enter to skip)"));
|
|
3739
|
+
const hfToken = (await ask(" HF Token (hf_...): ")).trim();
|
|
3740
|
+
if (hfToken) config.hfToken = hfToken;
|
|
3741
|
+
saveConfig(config);
|
|
3742
|
+
console.log();
|
|
3743
|
+
console.log(chalk44.green(" Config saved!"));
|
|
3744
|
+
console.log(chalk44.dim(` Location: ${getConfigPath()}`));
|
|
3745
|
+
if (provider === "anthropic" && !config.openaiKey) {
|
|
3746
|
+
console.log(chalk44.dim(" Note: Add an OpenAI key later for fine-tuning: holomime config"));
|
|
3747
|
+
}
|
|
3748
|
+
console.log();
|
|
3749
|
+
printNextSteps();
|
|
3750
|
+
rl.close();
|
|
3751
|
+
} catch {
|
|
3752
|
+
rl.close();
|
|
3753
|
+
}
|
|
3754
|
+
}
|
|
3755
|
+
function printNextSteps() {
|
|
3756
|
+
console.log(chalk44.bold(" NEXT STEP") + chalk44.dim(" \u2014 profile your agent:"));
|
|
3606
3757
|
console.log();
|
|
3607
|
-
console.log(
|
|
3758
|
+
console.log(chalk44.dim(" Already have an agent?"));
|
|
3759
|
+
console.log(chalk44.cyan(" holomime personality") + chalk44.dim(" Define how it should behave"));
|
|
3760
|
+
console.log(chalk44.cyan(" holomime diagnose") + chalk44.dim(" Analyze its conversation logs"));
|
|
3608
3761
|
console.log();
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
const line = "\u2550".repeat(title.length + 4);
|
|
3762
|
+
console.log(chalk44.dim(" Building for a robot?"));
|
|
3763
|
+
console.log(chalk44.cyan(" holomime identity") + chalk44.dim(" Full 8-file identity stack with body.api"));
|
|
3612
3764
|
console.log();
|
|
3613
|
-
console.log(
|
|
3614
|
-
console.log(
|
|
3615
|
-
console.log(
|
|
3765
|
+
console.log(chalk44.dim(" Then fix and verify:"));
|
|
3766
|
+
console.log(chalk44.cyan(" holomime therapy") + chalk44.dim(" Run in background \u2014 generate data, detect regression"));
|
|
3767
|
+
console.log(chalk44.cyan(" holomime cure") + chalk44.dim(" Full pipeline \u2014 diagnose, fine-tune, verify"));
|
|
3616
3768
|
console.log();
|
|
3617
3769
|
}
|
|
3770
|
+
var init_config = __esm({
|
|
3771
|
+
"src/commands/config.ts"() {
|
|
3772
|
+
"use strict";
|
|
3773
|
+
init_branding();
|
|
3774
|
+
}
|
|
3775
|
+
});
|
|
3776
|
+
|
|
3777
|
+
// src/cli.ts
|
|
3778
|
+
init_branding();
|
|
3779
|
+
import { Command } from "commander";
|
|
3618
3780
|
|
|
3619
3781
|
// src/ui/tier.ts
|
|
3620
3782
|
import chalk2 from "chalk";
|
|
@@ -6161,6 +6323,9 @@ function compileTiered(spec, tier, surface = "chat") {
|
|
|
6161
6323
|
}
|
|
6162
6324
|
}
|
|
6163
6325
|
|
|
6326
|
+
// src/commands/compile.ts
|
|
6327
|
+
init_branding();
|
|
6328
|
+
|
|
6164
6329
|
// src/ui/boxes.ts
|
|
6165
6330
|
import boxen3 from "boxen";
|
|
6166
6331
|
import chalk4 from "chalk";
|
|
@@ -6387,6 +6552,7 @@ init_types();
|
|
|
6387
6552
|
import chalk7 from "chalk";
|
|
6388
6553
|
import figures2 from "figures";
|
|
6389
6554
|
import { resolve as resolve4 } from "path";
|
|
6555
|
+
init_branding();
|
|
6390
6556
|
async function validateCommand() {
|
|
6391
6557
|
const specPath = resolve4(process.cwd(), ".personality.json");
|
|
6392
6558
|
let json;
|
|
@@ -6458,6 +6624,7 @@ import chalk8 from "chalk";
|
|
|
6458
6624
|
import figures3 from "figures";
|
|
6459
6625
|
import { resolve as resolve5 } from "path";
|
|
6460
6626
|
import { writeFileSync as writeFileSync4 } from "fs";
|
|
6627
|
+
init_branding();
|
|
6461
6628
|
async function profileCommand(options = {}) {
|
|
6462
6629
|
const specPath = resolve5(process.cwd(), ".personality.json");
|
|
6463
6630
|
let raw;
|
|
@@ -6721,6 +6888,7 @@ import { resolve as resolve7 } from "path";
|
|
|
6721
6888
|
init_recovery();
|
|
6722
6889
|
init_formality();
|
|
6723
6890
|
init_retrieval_quality();
|
|
6891
|
+
init_branding();
|
|
6724
6892
|
|
|
6725
6893
|
// src/ui/progress.ts
|
|
6726
6894
|
import chalk9 from "chalk";
|
|
@@ -7223,6 +7391,7 @@ function prescribeDPOPairs(patterns, corpus, limit = 20) {
|
|
|
7223
7391
|
}
|
|
7224
7392
|
|
|
7225
7393
|
// src/commands/assess.ts
|
|
7394
|
+
init_branding();
|
|
7226
7395
|
init_log_adapter();
|
|
7227
7396
|
async function assessCommand(options) {
|
|
7228
7397
|
const specPath = resolve8(process.cwd(), options.personality);
|
|
@@ -10456,6 +10625,9 @@ function createProvider(config) {
|
|
|
10456
10625
|
}
|
|
10457
10626
|
}
|
|
10458
10627
|
|
|
10628
|
+
// src/commands/session.ts
|
|
10629
|
+
init_branding();
|
|
10630
|
+
|
|
10459
10631
|
// src/ui/chat.ts
|
|
10460
10632
|
import chalk13 from "chalk";
|
|
10461
10633
|
function printTherapistMessage(content) {
|
|
@@ -10802,6 +10974,7 @@ import chalk16 from "chalk";
|
|
|
10802
10974
|
import figures8 from "figures";
|
|
10803
10975
|
import { readdirSync as readdirSync2, readFileSync as readFileSync14, existsSync as existsSync13 } from "fs";
|
|
10804
10976
|
import { resolve as resolve16, join as join12 } from "path";
|
|
10977
|
+
init_branding();
|
|
10805
10978
|
|
|
10806
10979
|
// src/analysis/evolution-history.ts
|
|
10807
10980
|
import { readFileSync as readFileSync13, writeFileSync as writeFileSync12, mkdirSync as mkdirSync8, existsSync as existsSync12 } from "fs";
|
|
@@ -11461,6 +11634,7 @@ function getMarketplaceClient() {
|
|
|
11461
11634
|
}
|
|
11462
11635
|
|
|
11463
11636
|
// src/commands/browse.ts
|
|
11637
|
+
init_branding();
|
|
11464
11638
|
async function browseCommand(options) {
|
|
11465
11639
|
const assetType = options.type ?? void 0;
|
|
11466
11640
|
const sortField = options.sort ?? "downloads";
|
|
@@ -11578,6 +11752,7 @@ import figures9 from "figures";
|
|
|
11578
11752
|
import { writeFileSync as writeFileSync14, existsSync as existsSync16 } from "fs";
|
|
11579
11753
|
import { resolve as resolve18 } from "path";
|
|
11580
11754
|
import { select as select2 } from "@inquirer/prompts";
|
|
11755
|
+
init_branding();
|
|
11581
11756
|
async function useCommand(handle, options) {
|
|
11582
11757
|
printHeader("Use Personality");
|
|
11583
11758
|
const registry = await withSpinner("Fetching registry...", async () => {
|
|
@@ -11640,6 +11815,7 @@ import chalk19 from "chalk";
|
|
|
11640
11815
|
import figures10 from "figures";
|
|
11641
11816
|
import { readFileSync as readFileSync18 } from "fs";
|
|
11642
11817
|
import { resolve as resolve19 } from "path";
|
|
11818
|
+
init_branding();
|
|
11643
11819
|
async function publishCommand(options) {
|
|
11644
11820
|
const assetType = options.type ?? "personality";
|
|
11645
11821
|
if (assetType !== "personality" || options.path) {
|
|
@@ -11869,6 +12045,7 @@ async function runAutopilot(spec, messages, provider, options) {
|
|
|
11869
12045
|
}
|
|
11870
12046
|
|
|
11871
12047
|
// src/commands/autopilot.ts
|
|
12048
|
+
init_branding();
|
|
11872
12049
|
async function autopilotCommand(options) {
|
|
11873
12050
|
const specPath = resolve20(process.cwd(), options.personality);
|
|
11874
12051
|
let spec;
|
|
@@ -12021,6 +12198,7 @@ async function autopilotCommand(options) {
|
|
|
12021
12198
|
}
|
|
12022
12199
|
|
|
12023
12200
|
// src/commands/export.ts
|
|
12201
|
+
init_branding();
|
|
12024
12202
|
import chalk21 from "chalk";
|
|
12025
12203
|
import figures12 from "figures";
|
|
12026
12204
|
import { writeFileSync as writeFileSync16 } from "fs";
|
|
@@ -12178,6 +12356,7 @@ This is the closed-loop behavioral alignment system.`,
|
|
|
12178
12356
|
}
|
|
12179
12357
|
|
|
12180
12358
|
// src/commands/train.ts
|
|
12359
|
+
init_branding();
|
|
12181
12360
|
import chalk22 from "chalk";
|
|
12182
12361
|
import figures13 from "figures";
|
|
12183
12362
|
import { readFileSync as readFileSync23, writeFileSync as writeFileSync19, mkdirSync as mkdirSync12, readdirSync as readdirSync5, existsSync as existsSync19 } from "fs";
|
|
@@ -12512,6 +12691,7 @@ Fine-tuned model: ${chalk22.cyan(result.modelId)}`,
|
|
|
12512
12691
|
// src/commands/eval.ts
|
|
12513
12692
|
init_log_adapter();
|
|
12514
12693
|
init_outcome_eval();
|
|
12694
|
+
init_branding();
|
|
12515
12695
|
import chalk23 from "chalk";
|
|
12516
12696
|
import figures14 from "figures";
|
|
12517
12697
|
import { readFileSync as readFileSync24 } from "fs";
|
|
@@ -13162,6 +13342,7 @@ function extractRegenerationDPOPairs(beforeMessages, afterMessages, agentName) {
|
|
|
13162
13342
|
}
|
|
13163
13343
|
|
|
13164
13344
|
// src/commands/evolve.ts
|
|
13345
|
+
init_branding();
|
|
13165
13346
|
async function evolveCommand(options) {
|
|
13166
13347
|
const specPath = resolve28(process.cwd(), options.personality);
|
|
13167
13348
|
let spec;
|
|
@@ -13671,6 +13852,7 @@ function compareBenchmarks(before, after) {
|
|
|
13671
13852
|
}
|
|
13672
13853
|
|
|
13673
13854
|
// src/commands/benchmark.ts
|
|
13855
|
+
init_branding();
|
|
13674
13856
|
async function benchmarkCommand(options) {
|
|
13675
13857
|
const specPath = resolve29(process.cwd(), options.personality);
|
|
13676
13858
|
let spec;
|
|
@@ -13985,6 +14167,7 @@ function startWatch(spec, options) {
|
|
|
13985
14167
|
}
|
|
13986
14168
|
|
|
13987
14169
|
// src/commands/watch.ts
|
|
14170
|
+
init_branding();
|
|
13988
14171
|
async function watchCommand(options) {
|
|
13989
14172
|
const specPath = resolve31(process.cwd(), options.personality);
|
|
13990
14173
|
let spec;
|
|
@@ -14249,6 +14432,9 @@ function saveCredential(credential, outputDir) {
|
|
|
14249
14432
|
return filepath;
|
|
14250
14433
|
}
|
|
14251
14434
|
|
|
14435
|
+
// src/commands/certify.ts
|
|
14436
|
+
init_branding();
|
|
14437
|
+
|
|
14252
14438
|
// src/compliance/iso-mappings.ts
|
|
14253
14439
|
import { readFileSync as readFileSync31, existsSync as existsSync25 } from "fs";
|
|
14254
14440
|
import { join as join23, resolve as resolve33, dirname as dirname4 } from "path";
|
|
@@ -14742,6 +14928,7 @@ async function certifyCommand(options) {
|
|
|
14742
14928
|
}
|
|
14743
14929
|
|
|
14744
14930
|
// src/commands/daemon.ts
|
|
14931
|
+
init_branding();
|
|
14745
14932
|
import chalk29 from "chalk";
|
|
14746
14933
|
import { writeFileSync as writeFileSync26, readFileSync as readFileSync33, mkdirSync as mkdirSync18, existsSync as existsSync27 } from "fs";
|
|
14747
14934
|
import { resolve as resolve35 } from "path";
|
|
@@ -14971,6 +15158,7 @@ Log: ${getDaemonLogPath()}`,
|
|
|
14971
15158
|
}
|
|
14972
15159
|
|
|
14973
15160
|
// src/commands/fleet.ts
|
|
15161
|
+
init_branding();
|
|
14974
15162
|
import chalk30 from "chalk";
|
|
14975
15163
|
import figures20 from "figures";
|
|
14976
15164
|
import { writeFileSync as writeFileSync27, mkdirSync as mkdirSync19, existsSync as existsSync29 } from "fs";
|
|
@@ -15339,6 +15527,7 @@ Press Ctrl+C for fleet summary`,
|
|
|
15339
15527
|
}
|
|
15340
15528
|
|
|
15341
15529
|
// src/commands/fleet-therapy.ts
|
|
15530
|
+
init_branding();
|
|
15342
15531
|
import chalk31 from "chalk";
|
|
15343
15532
|
import figures21 from "figures";
|
|
15344
15533
|
import { resolve as resolve39 } from "path";
|
|
@@ -15736,6 +15925,7 @@ ${report.errorCount > 0 ? `${report.errorCount} error(s) \u2014 check agent logs
|
|
|
15736
15925
|
}
|
|
15737
15926
|
|
|
15738
15927
|
// src/commands/network.ts
|
|
15928
|
+
init_branding();
|
|
15739
15929
|
import chalk32 from "chalk";
|
|
15740
15930
|
import figures22 from "figures";
|
|
15741
15931
|
import { resolve as resolve41 } from "path";
|
|
@@ -16343,6 +16533,7 @@ async function networkCommand(options) {
|
|
|
16343
16533
|
}
|
|
16344
16534
|
|
|
16345
16535
|
// src/commands/share.ts
|
|
16536
|
+
init_branding();
|
|
16346
16537
|
import chalk33 from "chalk";
|
|
16347
16538
|
import figures23 from "figures";
|
|
16348
16539
|
import { resolve as resolve42 } from "path";
|
|
@@ -16431,6 +16622,7 @@ Run ${chalk33.cyan("holomime align")} or ${chalk33.cyan("holomime network")} fir
|
|
|
16431
16622
|
}
|
|
16432
16623
|
|
|
16433
16624
|
// src/commands/prescribe.ts
|
|
16625
|
+
init_branding();
|
|
16434
16626
|
import chalk34 from "chalk";
|
|
16435
16627
|
import figures24 from "figures";
|
|
16436
16628
|
import { readFileSync as readFileSync37, writeFileSync as writeFileSync29 } from "fs";
|
|
@@ -16529,6 +16721,7 @@ async function prescribeCommand(options) {
|
|
|
16529
16721
|
import chalk35 from "chalk";
|
|
16530
16722
|
import figures25 from "figures";
|
|
16531
16723
|
import { resolve as resolve44 } from "path";
|
|
16724
|
+
init_branding();
|
|
16532
16725
|
async function interviewCommand(options) {
|
|
16533
16726
|
const specPath = resolve44(process.cwd(), options.personality);
|
|
16534
16727
|
let spec;
|
|
@@ -16642,6 +16835,7 @@ function displayResults(result) {
|
|
|
16642
16835
|
}
|
|
16643
16836
|
|
|
16644
16837
|
// src/commands/activate.ts
|
|
16838
|
+
init_branding();
|
|
16645
16839
|
import chalk37 from "chalk";
|
|
16646
16840
|
import figures26 from "figures";
|
|
16647
16841
|
import { writeFileSync as writeFileSync31, mkdirSync as mkdirSync22, existsSync as existsSync33 } from "fs";
|
|
@@ -16835,6 +17029,7 @@ async function activateCommand(key) {
|
|
|
16835
17029
|
// src/commands/telemetry-cmd.ts
|
|
16836
17030
|
import chalk38 from "chalk";
|
|
16837
17031
|
import figures27 from "figures";
|
|
17032
|
+
init_branding();
|
|
16838
17033
|
async function telemetryCommand(action) {
|
|
16839
17034
|
printHeader("Telemetry");
|
|
16840
17035
|
if (action === "enable") {
|
|
@@ -17534,6 +17729,7 @@ var IsaacSimAdapter = class {
|
|
|
17534
17729
|
};
|
|
17535
17730
|
|
|
17536
17731
|
// src/commands/embody.ts
|
|
17732
|
+
init_branding();
|
|
17537
17733
|
async function embodyCommand(options) {
|
|
17538
17734
|
const provider = options.provider ?? "anthropic";
|
|
17539
17735
|
const adapterType = options.adapter;
|
|
@@ -17829,6 +18025,7 @@ function createAdapter(type, options) {
|
|
|
17829
18025
|
}
|
|
17830
18026
|
|
|
17831
18027
|
// src/commands/init-stack.ts
|
|
18028
|
+
init_branding();
|
|
17832
18029
|
import chalk40 from "chalk";
|
|
17833
18030
|
import figures29 from "figures";
|
|
17834
18031
|
import { writeFileSync as writeFileSync33, mkdirSync as mkdirSync23, existsSync as existsSync35 } from "fs";
|
|
@@ -18082,6 +18279,7 @@ async function createFullStack(outputDir) {
|
|
|
18082
18279
|
}
|
|
18083
18280
|
|
|
18084
18281
|
// src/commands/compile-stack.ts
|
|
18282
|
+
init_branding();
|
|
18085
18283
|
import chalk41 from "chalk";
|
|
18086
18284
|
import figures30 from "figures";
|
|
18087
18285
|
import { writeFileSync as writeFileSync34, readFileSync as readFileSync41, existsSync as existsSync36 } from "fs";
|
|
@@ -18213,6 +18411,12 @@ function detectProvider() {
|
|
|
18213
18411
|
} else if (config.provider === "openai") {
|
|
18214
18412
|
process.env.OPENAI_API_KEY = config.apiKey;
|
|
18215
18413
|
}
|
|
18414
|
+
if (config.openaiKey && !process.env.OPENAI_API_KEY) {
|
|
18415
|
+
process.env.OPENAI_API_KEY = config.openaiKey;
|
|
18416
|
+
}
|
|
18417
|
+
if (config.hfToken && !process.env.HF_TOKEN) {
|
|
18418
|
+
process.env.HF_TOKEN = config.hfToken;
|
|
18419
|
+
}
|
|
18216
18420
|
const defaultModel = config.provider === "anthropic" ? "claude-haiku-4-5-20251001" : "gpt-4o-mini";
|
|
18217
18421
|
return {
|
|
18218
18422
|
provider: config.provider,
|
|
@@ -18247,6 +18451,7 @@ function autoDetect(options) {
|
|
|
18247
18451
|
}
|
|
18248
18452
|
|
|
18249
18453
|
// src/commands/voice.ts
|
|
18454
|
+
init_branding();
|
|
18250
18455
|
import chalk42 from "chalk";
|
|
18251
18456
|
import figures31 from "figures";
|
|
18252
18457
|
import { resolve as resolve48 } from "path";
|
|
@@ -18881,6 +19086,7 @@ import figures32 from "figures";
|
|
|
18881
19086
|
import { existsSync as existsSync39, mkdirSync as mkdirSync24, writeFileSync as writeFileSync35 } from "fs";
|
|
18882
19087
|
import { join as join35, resolve as resolve49 } from "path";
|
|
18883
19088
|
import { select as select3 } from "@inquirer/prompts";
|
|
19089
|
+
init_branding();
|
|
18884
19090
|
var INSTALL_DIRS = {
|
|
18885
19091
|
"personality": ".",
|
|
18886
19092
|
"detector": ".holomime/detectors",
|
|
@@ -18972,10 +19178,11 @@ async function installCommand(handle, options) {
|
|
|
18972
19178
|
}
|
|
18973
19179
|
|
|
18974
19180
|
// src/commands/cure.ts
|
|
18975
|
-
|
|
19181
|
+
init_branding();
|
|
19182
|
+
import chalk45 from "chalk";
|
|
18976
19183
|
import figures33 from "figures";
|
|
18977
|
-
import { readFileSync as
|
|
18978
|
-
import { resolve as resolve51, join as
|
|
19184
|
+
import { readFileSync as readFileSync46, writeFileSync as writeFileSync38, existsSync as existsSync42, mkdirSync as mkdirSync27 } from "fs";
|
|
19185
|
+
import { resolve as resolve51, join as join38 } from "path";
|
|
18979
19186
|
|
|
18980
19187
|
// src/analysis/training-pipeline.ts
|
|
18981
19188
|
import { writeFileSync as writeFileSync36, mkdirSync as mkdirSync25, readFileSync as readFileSync44, existsSync as existsSync40 } from "fs";
|
|
@@ -19273,7 +19480,7 @@ var STAGE_DESCRIPTIONS = {
|
|
|
19273
19480
|
};
|
|
19274
19481
|
function getAgentName2(personalityPath) {
|
|
19275
19482
|
try {
|
|
19276
|
-
const spec = JSON.parse(
|
|
19483
|
+
const spec = JSON.parse(readFileSync46(personalityPath, "utf-8"));
|
|
19277
19484
|
return spec.name ?? "Agent";
|
|
19278
19485
|
} catch {
|
|
19279
19486
|
return "Agent";
|
|
@@ -19281,15 +19488,15 @@ function getAgentName2(personalityPath) {
|
|
|
19281
19488
|
}
|
|
19282
19489
|
async function cureCommand(options) {
|
|
19283
19490
|
const cwd = process.cwd();
|
|
19284
|
-
const hasBodyApi =
|
|
19491
|
+
const hasBodyApi = existsSync42(resolve51(cwd, "body.api")) || existsSync42(resolve51(cwd, ".holomime/body.api")) || existsSync42(resolve51(cwd, "identity/body.api"));
|
|
19285
19492
|
const isRobotFlow = options.exportOnly || hasBodyApi && options.provider === "openai";
|
|
19286
19493
|
if (isRobotFlow) {
|
|
19287
19494
|
let bodyName = "robot";
|
|
19288
19495
|
try {
|
|
19289
19496
|
for (const p of ["body.api", ".holomime/body.api", "identity/body.api"]) {
|
|
19290
19497
|
const bp = resolve51(cwd, p);
|
|
19291
|
-
if (
|
|
19292
|
-
const body = JSON.parse(
|
|
19498
|
+
if (existsSync42(bp)) {
|
|
19499
|
+
const body = JSON.parse(readFileSync46(bp, "utf-8"));
|
|
19293
19500
|
bodyName = body.hardware_profile?.model ?? body.morphology ?? "robot";
|
|
19294
19501
|
break;
|
|
19295
19502
|
}
|
|
@@ -19298,8 +19505,8 @@ async function cureCommand(options) {
|
|
|
19298
19505
|
}
|
|
19299
19506
|
printHeader("Cure \u2014 Robotics Training Pipeline");
|
|
19300
19507
|
console.log();
|
|
19301
|
-
console.log(
|
|
19302
|
-
console.log(
|
|
19508
|
+
console.log(chalk45.dim(` Robot identity detected`) + chalk45.cyan(` (${bodyName})`));
|
|
19509
|
+
console.log(chalk45.dim(" Generating behavioral training data for your pipeline."));
|
|
19303
19510
|
console.log();
|
|
19304
19511
|
options.skipTrain = true;
|
|
19305
19512
|
options.skipVerify = true;
|
|
@@ -19307,30 +19514,63 @@ async function cureCommand(options) {
|
|
|
19307
19514
|
} else {
|
|
19308
19515
|
printHeader("Cure \u2014 End-to-End Behavioral Fix");
|
|
19309
19516
|
}
|
|
19310
|
-
|
|
19517
|
+
try {
|
|
19518
|
+
const { loadConfig: loadConfig3 } = await Promise.resolve().then(() => (init_config(), config_exports));
|
|
19519
|
+
const cfg = loadConfig3();
|
|
19520
|
+
if (cfg) {
|
|
19521
|
+
if (cfg.provider === "anthropic" && cfg.apiKey && !process.env.ANTHROPIC_API_KEY) {
|
|
19522
|
+
process.env.ANTHROPIC_API_KEY = cfg.apiKey;
|
|
19523
|
+
}
|
|
19524
|
+
if (cfg.provider === "openai" && cfg.apiKey && !process.env.OPENAI_API_KEY) {
|
|
19525
|
+
process.env.OPENAI_API_KEY = cfg.apiKey;
|
|
19526
|
+
}
|
|
19527
|
+
if (cfg.openaiKey && !process.env.OPENAI_API_KEY) {
|
|
19528
|
+
process.env.OPENAI_API_KEY = cfg.openaiKey;
|
|
19529
|
+
}
|
|
19530
|
+
if (cfg.hfToken && !process.env.HF_TOKEN) {
|
|
19531
|
+
process.env.HF_TOKEN = cfg.hfToken;
|
|
19532
|
+
}
|
|
19533
|
+
}
|
|
19534
|
+
} catch {
|
|
19535
|
+
}
|
|
19536
|
+
let provider = options.provider;
|
|
19537
|
+
const hasOpenAIKey = !!process.env.OPENAI_API_KEY;
|
|
19538
|
+
const hasHFToken = !!process.env.HF_TOKEN;
|
|
19539
|
+
if (!isRobotFlow && provider === "openai" && !hasOpenAIKey) {
|
|
19540
|
+
if (hasHFToken) {
|
|
19541
|
+
provider = "huggingface";
|
|
19542
|
+
console.log(chalk45.dim(" No OpenAI key found. Using HuggingFace for training."));
|
|
19543
|
+
} else {
|
|
19544
|
+
console.log(chalk45.dim(" No training provider key found. Exporting training data only."));
|
|
19545
|
+
console.log(chalk45.dim(" Run ") + chalk45.cyan("holomime config") + chalk45.dim(" to add keys for fine-tuning."));
|
|
19546
|
+
console.log();
|
|
19547
|
+
options.skipTrain = true;
|
|
19548
|
+
options.skipVerify = true;
|
|
19549
|
+
}
|
|
19550
|
+
}
|
|
19311
19551
|
if (provider !== "openai" && provider !== "huggingface") {
|
|
19312
|
-
|
|
19313
|
-
|
|
19314
|
-
|
|
19315
|
-
|
|
19316
|
-
|
|
19552
|
+
provider = "openai";
|
|
19553
|
+
if (!hasOpenAIKey) {
|
|
19554
|
+
options.skipTrain = true;
|
|
19555
|
+
options.skipVerify = true;
|
|
19556
|
+
}
|
|
19317
19557
|
}
|
|
19318
19558
|
const personalityPath = resolve51(process.cwd(), options.personality);
|
|
19319
19559
|
let logPath;
|
|
19320
|
-
if (!
|
|
19321
|
-
console.error(
|
|
19560
|
+
if (!existsSync42(personalityPath)) {
|
|
19561
|
+
console.error(chalk45.red(` Personality file not found: ${options.personality}`));
|
|
19322
19562
|
process.exit(1);
|
|
19323
19563
|
return;
|
|
19324
19564
|
}
|
|
19325
19565
|
if (options.log) {
|
|
19326
19566
|
logPath = resolve51(process.cwd(), options.log);
|
|
19327
|
-
if (!
|
|
19328
|
-
console.error(
|
|
19567
|
+
if (!existsSync42(logPath)) {
|
|
19568
|
+
console.error(chalk45.red(` Log file not found: ${options.log}`));
|
|
19329
19569
|
process.exit(1);
|
|
19330
19570
|
return;
|
|
19331
19571
|
}
|
|
19332
19572
|
} else {
|
|
19333
|
-
console.log(
|
|
19573
|
+
console.log(chalk45.dim(" No --log provided. Generating conversations from benchmark scenarios..."));
|
|
19334
19574
|
console.log();
|
|
19335
19575
|
const scenarios = getBenchmarkScenarios();
|
|
19336
19576
|
const syntheticMessages = [];
|
|
@@ -19344,8 +19584,8 @@ async function cureCommand(options) {
|
|
|
19344
19584
|
}
|
|
19345
19585
|
}
|
|
19346
19586
|
const pipelineDir = resolve51(process.cwd(), ".holomime/pipeline");
|
|
19347
|
-
|
|
19348
|
-
logPath =
|
|
19587
|
+
mkdirSync27(pipelineDir, { recursive: true });
|
|
19588
|
+
logPath = join38(pipelineDir, "auto-generated-log.json");
|
|
19349
19589
|
const syntheticLog = {
|
|
19350
19590
|
conversations: [
|
|
19351
19591
|
{
|
|
@@ -19354,41 +19594,39 @@ async function cureCommand(options) {
|
|
|
19354
19594
|
}
|
|
19355
19595
|
]
|
|
19356
19596
|
};
|
|
19357
|
-
|
|
19358
|
-
console.log(
|
|
19359
|
-
console.log(
|
|
19597
|
+
writeFileSync38(logPath, JSON.stringify(syntheticLog, null, 2));
|
|
19598
|
+
console.log(chalk45.dim(` Generated ${syntheticMessages.length} messages from ${scenarios.length} scenarios`));
|
|
19599
|
+
console.log(chalk45.dim(` Saved to: ${logPath}`));
|
|
19360
19600
|
console.log();
|
|
19361
19601
|
}
|
|
19362
|
-
if (
|
|
19363
|
-
|
|
19364
|
-
|
|
19365
|
-
console.
|
|
19366
|
-
console.log(
|
|
19367
|
-
|
|
19368
|
-
|
|
19369
|
-
}
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
|
|
19373
|
-
|
|
19374
|
-
|
|
19375
|
-
process.exit(1);
|
|
19376
|
-
return;
|
|
19602
|
+
if (!options.skipTrain) {
|
|
19603
|
+
if (provider === "openai" && !process.env.OPENAI_API_KEY) {
|
|
19604
|
+
console.log(chalk45.dim(" No OpenAI key configured. Switching to export-only mode."));
|
|
19605
|
+
console.log(chalk45.dim(" Run ") + chalk45.cyan("holomime config") + chalk45.dim(" to add an OpenAI key for fine-tuning."));
|
|
19606
|
+
console.log();
|
|
19607
|
+
options.skipTrain = true;
|
|
19608
|
+
options.skipVerify = true;
|
|
19609
|
+
} else if (provider === "huggingface" && !(process.env.HF_TOKEN ?? process.env.HUGGING_FACE_HUB_TOKEN)) {
|
|
19610
|
+
console.log(chalk45.dim(" No HuggingFace token configured. Switching to export-only mode."));
|
|
19611
|
+
console.log(chalk45.dim(" Run ") + chalk45.cyan("holomime config") + chalk45.dim(" to add a HuggingFace token."));
|
|
19612
|
+
console.log();
|
|
19613
|
+
options.skipTrain = true;
|
|
19614
|
+
options.skipVerify = true;
|
|
19377
19615
|
}
|
|
19378
19616
|
}
|
|
19379
19617
|
const agentName = getAgentName2(personalityPath);
|
|
19380
19618
|
const passThreshold = options.passThreshold ? parseInt(options.passThreshold, 10) : 50;
|
|
19381
19619
|
console.log();
|
|
19382
|
-
console.log(
|
|
19383
|
-
console.log(
|
|
19384
|
-
console.log(
|
|
19385
|
-
console.log(
|
|
19386
|
-
console.log(
|
|
19387
|
-
if (options.method) console.log(
|
|
19388
|
-
if (options.suffix) console.log(
|
|
19389
|
-
if (options.skipTrain) console.log(
|
|
19390
|
-
if (options.skipVerify) console.log(
|
|
19391
|
-
if (options.dryRun) console.log(
|
|
19620
|
+
console.log(chalk45.dim(` Agent: ${agentName}`));
|
|
19621
|
+
console.log(chalk45.dim(` Personality: ${options.personality}`));
|
|
19622
|
+
console.log(chalk45.dim(` Log: ${options.log ?? "(auto-generated)"}`));
|
|
19623
|
+
console.log(chalk45.dim(` Provider: ${provider === "huggingface" ? "HuggingFace AutoTrain" : "OpenAI"}`));
|
|
19624
|
+
console.log(chalk45.dim(` Base Model: ${options.baseModel}`));
|
|
19625
|
+
if (options.method) console.log(chalk45.dim(` Method: ${options.method}`));
|
|
19626
|
+
if (options.suffix) console.log(chalk45.dim(` Suffix: ${options.suffix}`));
|
|
19627
|
+
if (options.skipTrain) console.log(chalk45.dim(` Skip: training`));
|
|
19628
|
+
if (options.skipVerify) console.log(chalk45.dim(` Skip: verification`));
|
|
19629
|
+
if (options.dryRun) console.log(chalk45.dim(` Mode: dry run`));
|
|
19392
19630
|
console.log();
|
|
19393
19631
|
const stages = ["diagnose", "export"];
|
|
19394
19632
|
if (!options.skipTrain) stages.push("train");
|
|
@@ -19406,9 +19644,9 @@ async function cureCommand(options) {
|
|
|
19406
19644
|
printBox(
|
|
19407
19645
|
`Dry run complete.
|
|
19408
19646
|
|
|
19409
|
-
` + stages.map((s, i) => ` ${i + 1}. ${
|
|
19647
|
+
` + stages.map((s, i) => ` ${i + 1}. ${chalk45.cyan(STAGE_LABELS[s])} \u2014 ${STAGE_DESCRIPTIONS[s]}`).join("\n") + `
|
|
19410
19648
|
|
|
19411
|
-
Remove ${
|
|
19649
|
+
Remove ${chalk45.cyan("--dry-run")} to execute the full pipeline.`,
|
|
19412
19650
|
"info",
|
|
19413
19651
|
"Dry Run"
|
|
19414
19652
|
);
|
|
@@ -19435,20 +19673,20 @@ Remove ${chalk44.cyan("--dry-run")} to execute the full pipeline.`,
|
|
|
19435
19673
|
currentStage = stage;
|
|
19436
19674
|
console.log();
|
|
19437
19675
|
console.log(
|
|
19438
|
-
` ${
|
|
19676
|
+
` ${chalk45.cyan(figures33.pointer)} ${chalk45.bold(STAGE_LABELS[stage])} ` + chalk45.dim(`[${index + 1}/${total}] ${STAGE_DESCRIPTIONS[stage]}...`)
|
|
19439
19677
|
);
|
|
19440
19678
|
},
|
|
19441
19679
|
onStageEnd: (stage, success, message) => {
|
|
19442
|
-
const icon = success ?
|
|
19680
|
+
const icon = success ? chalk45.green(figures33.tick) : chalk45.red(figures33.cross);
|
|
19443
19681
|
console.log(` ${icon} ${message}`);
|
|
19444
19682
|
stageStatus[stage] = success ? "passed" : "failed";
|
|
19445
19683
|
},
|
|
19446
19684
|
onProgress: (progress) => {
|
|
19447
19685
|
if (progress.stage !== currentStage) return;
|
|
19448
|
-
console.log(` ${
|
|
19686
|
+
console.log(` ${chalk45.dim(figures33.pointer)} ${progress.message}`);
|
|
19449
19687
|
},
|
|
19450
19688
|
onError: (stage, error) => {
|
|
19451
|
-
console.log(` ${
|
|
19689
|
+
console.log(` ${chalk45.red(figures33.cross)} ${STAGE_LABELS[stage]} failed: ${error}`);
|
|
19452
19690
|
stageStatus[stage] = "failed";
|
|
19453
19691
|
}
|
|
19454
19692
|
}
|
|
@@ -19458,7 +19696,7 @@ Remove ${chalk44.cyan("--dry-run")} to execute the full pipeline.`,
|
|
|
19458
19696
|
printBox(
|
|
19459
19697
|
`Pipeline failed: ${pipelineResult.error ?? "Unknown error"}
|
|
19460
19698
|
|
|
19461
|
-
Intermediate results saved to ${
|
|
19699
|
+
Intermediate results saved to ${chalk45.cyan(".holomime/pipeline/")}`,
|
|
19462
19700
|
"warning",
|
|
19463
19701
|
"Cure Failed"
|
|
19464
19702
|
);
|
|
@@ -19475,21 +19713,21 @@ Intermediate results saved to ${chalk44.cyan(".holomime/pipeline/")}`,
|
|
|
19475
19713
|
}
|
|
19476
19714
|
if (pipelineResult.stages.train) {
|
|
19477
19715
|
const train = pipelineResult.stages.train;
|
|
19478
|
-
summaryLines.push(`Model: ${
|
|
19716
|
+
summaryLines.push(`Model: ${chalk45.cyan(train.modelId)}`);
|
|
19479
19717
|
summaryLines.push(`Method: ${train.method === "dpo" ? "DPO" : "SFT"} | Examples: ${train.examples}`);
|
|
19480
19718
|
}
|
|
19481
19719
|
if (pipelineResult.stages.verify) {
|
|
19482
19720
|
const verify = pipelineResult.stages.verify;
|
|
19483
19721
|
const gradeColors = {
|
|
19484
|
-
A:
|
|
19485
|
-
B:
|
|
19486
|
-
C:
|
|
19487
|
-
D:
|
|
19488
|
-
F:
|
|
19722
|
+
A: chalk45.green,
|
|
19723
|
+
B: chalk45.cyan,
|
|
19724
|
+
C: chalk45.yellow,
|
|
19725
|
+
D: chalk45.hex("#ff8800"),
|
|
19726
|
+
F: chalk45.red
|
|
19489
19727
|
};
|
|
19490
|
-
const colorize = gradeColors[verify.grade] ??
|
|
19728
|
+
const colorize = gradeColors[verify.grade] ?? chalk45.white;
|
|
19491
19729
|
summaryLines.push(
|
|
19492
|
-
`Verification: ${verify.passed ?
|
|
19730
|
+
`Verification: ${verify.passed ? chalk45.green("PASSED") : chalk45.red("FAILED")} (${colorize(`${verify.fineTunedScore}/100`)} Grade ${colorize(verify.grade)})`
|
|
19493
19731
|
);
|
|
19494
19732
|
if (verify.patternsImproved.length > 0) {
|
|
19495
19733
|
summaryLines.push(
|
|
@@ -19498,13 +19736,13 @@ Intermediate results saved to ${chalk44.cyan(".holomime/pipeline/")}`,
|
|
|
19498
19736
|
}
|
|
19499
19737
|
if (verify.patternsRegressed.length > 0) {
|
|
19500
19738
|
summaryLines.push(
|
|
19501
|
-
`${
|
|
19739
|
+
`${chalk45.red("Regressed")}: ${verify.patternsRegressed.map((p) => p.patternName).join(", ")}`
|
|
19502
19740
|
);
|
|
19503
19741
|
}
|
|
19504
19742
|
if (verify.regressionWarnings.length > 0) {
|
|
19505
|
-
console.log(
|
|
19743
|
+
console.log(chalk45.bold(" Regression Warnings:"));
|
|
19506
19744
|
for (const warning of verify.regressionWarnings) {
|
|
19507
|
-
console.log(` ${
|
|
19745
|
+
console.log(` ${chalk45.yellow(figures33.warning)} ${warning}`);
|
|
19508
19746
|
}
|
|
19509
19747
|
console.log();
|
|
19510
19748
|
}
|
|
@@ -19517,20 +19755,20 @@ Intermediate results saved to ${chalk44.cyan(".holomime/pipeline/")}`,
|
|
|
19517
19755
|
`Cure Complete \u2014 ${agentName}`
|
|
19518
19756
|
);
|
|
19519
19757
|
console.log();
|
|
19520
|
-
console.log(
|
|
19758
|
+
console.log(chalk45.dim(` Pipeline results: .holomime/pipeline/`));
|
|
19521
19759
|
console.log();
|
|
19522
19760
|
if (isRobotFlow) {
|
|
19523
19761
|
const exportPath = ".holomime/pipeline/";
|
|
19524
19762
|
const nextSteps = [
|
|
19525
|
-
`Training data exported to ${
|
|
19763
|
+
`Training data exported to ${chalk45.cyan(exportPath)}`,
|
|
19526
19764
|
"",
|
|
19527
19765
|
" Import into your training pipeline:",
|
|
19528
|
-
` ${
|
|
19766
|
+
` ${chalk45.dim("$")} ${chalk45.cyan("huggingface-cli download")} ${chalk45.dim(options.hubRepo ?? "<your-org/dataset>")}`,
|
|
19529
19767
|
"",
|
|
19530
19768
|
" Or use the local JSONL directly:",
|
|
19531
|
-
` ${
|
|
19769
|
+
` ${chalk45.dim("$")} ${chalk45.cyan("ls .holomime/pipeline/*.jsonl")}`,
|
|
19532
19770
|
"",
|
|
19533
|
-
` ${
|
|
19771
|
+
` ${chalk45.dim("Run")} ${chalk45.cyan("holomime certify")} ${chalk45.dim("for ISO compliance report.")}`
|
|
19534
19772
|
];
|
|
19535
19773
|
printBox(nextSteps.join("\n"), "success", "Training Data Ready");
|
|
19536
19774
|
console.log();
|
|
@@ -19538,10 +19776,10 @@ Intermediate results saved to ${chalk44.cyan(".holomime/pipeline/")}`,
|
|
|
19538
19776
|
printBox(
|
|
19539
19777
|
`The behavioral fix has been applied:
|
|
19540
19778
|
|
|
19541
|
-
Model: ${
|
|
19779
|
+
Model: ${chalk45.cyan(pipelineResult.stages.train.modelId)}
|
|
19542
19780
|
Update your agent's model reference to use the fine-tuned version.
|
|
19543
19781
|
|
|
19544
|
-
${
|
|
19782
|
+
${chalk45.dim("Run")} ${chalk45.cyan("holomime benchmark")} ${chalk45.dim("to stress-test the fixed model.")}`,
|
|
19545
19783
|
"info",
|
|
19546
19784
|
"Next Steps"
|
|
19547
19785
|
);
|
|
@@ -19572,22 +19810,22 @@ function generateProblematicResponse(targetPattern, userMessage) {
|
|
|
19572
19810
|
}
|
|
19573
19811
|
|
|
19574
19812
|
// src/commands/live.ts
|
|
19575
|
-
import
|
|
19813
|
+
import chalk46 from "chalk";
|
|
19576
19814
|
|
|
19577
19815
|
// src/live/agent-detector.ts
|
|
19578
|
-
import { existsSync as
|
|
19579
|
-
import { join as
|
|
19580
|
-
import { homedir as
|
|
19816
|
+
import { existsSync as existsSync43, readdirSync as readdirSync11, statSync } from "fs";
|
|
19817
|
+
import { join as join39, resolve as resolve52 } from "path";
|
|
19818
|
+
import { homedir as homedir9 } from "os";
|
|
19581
19819
|
var RECENCY_THRESHOLD_MS = 12e4;
|
|
19582
19820
|
function findNewestFile(baseDir, extensions, maxDepth = 3, depth = 0) {
|
|
19583
19821
|
if (depth > maxDepth) return null;
|
|
19584
|
-
if (!
|
|
19822
|
+
if (!existsSync43(baseDir)) return null;
|
|
19585
19823
|
let best = null;
|
|
19586
19824
|
try {
|
|
19587
19825
|
const entries = readdirSync11(baseDir);
|
|
19588
19826
|
for (const entry of entries) {
|
|
19589
19827
|
if (entry.startsWith(".")) continue;
|
|
19590
|
-
const fullPath =
|
|
19828
|
+
const fullPath = join39(baseDir, entry);
|
|
19591
19829
|
try {
|
|
19592
19830
|
const stat = statSync(fullPath);
|
|
19593
19831
|
if (stat.isDirectory()) {
|
|
@@ -19613,7 +19851,7 @@ function isRecent(mtimeMs) {
|
|
|
19613
19851
|
return Date.now() - mtimeMs <= RECENCY_THRESHOLD_MS;
|
|
19614
19852
|
}
|
|
19615
19853
|
function findClaudeCodeSession() {
|
|
19616
|
-
const claudeDir =
|
|
19854
|
+
const claudeDir = join39(homedir9(), ".claude", "projects");
|
|
19617
19855
|
const result = findNewestFile(claudeDir, [".jsonl"], 2);
|
|
19618
19856
|
if (!result || !isRecent(result.mtimeMs)) return null;
|
|
19619
19857
|
return {
|
|
@@ -19624,8 +19862,8 @@ function findClaudeCodeSession() {
|
|
|
19624
19862
|
}
|
|
19625
19863
|
function findClineSession() {
|
|
19626
19864
|
const searchDirs = [
|
|
19627
|
-
|
|
19628
|
-
|
|
19865
|
+
join39(process.cwd(), ".cline", "tasks"),
|
|
19866
|
+
join39(homedir9(), ".cline", "tasks")
|
|
19629
19867
|
];
|
|
19630
19868
|
for (const tasksDir of searchDirs) {
|
|
19631
19869
|
const result = findNewestFile(tasksDir, [".json", ".jsonl"], 2);
|
|
@@ -19640,7 +19878,7 @@ function findClineSession() {
|
|
|
19640
19878
|
return null;
|
|
19641
19879
|
}
|
|
19642
19880
|
function findCodexSession() {
|
|
19643
|
-
const codexDir =
|
|
19881
|
+
const codexDir = join39(homedir9(), ".codex", "sessions");
|
|
19644
19882
|
const result = findNewestFile(codexDir, [".jsonl"], 4);
|
|
19645
19883
|
if (!result || !isRecent(result.mtimeMs)) return null;
|
|
19646
19884
|
return {
|
|
@@ -19650,7 +19888,7 @@ function findCodexSession() {
|
|
|
19650
19888
|
};
|
|
19651
19889
|
}
|
|
19652
19890
|
function findCursorSession() {
|
|
19653
|
-
const cursorProjects =
|
|
19891
|
+
const cursorProjects = join39(homedir9(), ".cursor", "projects");
|
|
19654
19892
|
const result = findNewestFile(cursorProjects, [".json", ".jsonl"], 3);
|
|
19655
19893
|
if (result && isRecent(result.mtimeMs)) {
|
|
19656
19894
|
return {
|
|
@@ -19797,8 +20035,8 @@ function readFile(filePath, startByte) {
|
|
|
19797
20035
|
|
|
19798
20036
|
// src/live/server.ts
|
|
19799
20037
|
import { createServer as createServer3 } from "http";
|
|
19800
|
-
import { readFileSync as
|
|
19801
|
-
import { join as
|
|
20038
|
+
import { readFileSync as readFileSync47, existsSync as existsSync44 } from "fs";
|
|
20039
|
+
import { join as join40, extname } from "path";
|
|
19802
20040
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
19803
20041
|
import { WebSocketServer } from "ws";
|
|
19804
20042
|
var __bundleDir = fileURLToPath4(new URL(".", import.meta.url));
|
|
@@ -19812,15 +20050,15 @@ var MIME_TYPES = {
|
|
|
19812
20050
|
".ico": "image/x-icon"
|
|
19813
20051
|
};
|
|
19814
20052
|
function startServer(port) {
|
|
19815
|
-
const staticDir =
|
|
20053
|
+
const staticDir = join40(__bundleDir, "neuralspace");
|
|
19816
20054
|
const clients = /* @__PURE__ */ new Set();
|
|
19817
20055
|
let lastEvent = null;
|
|
19818
20056
|
let initMessage = null;
|
|
19819
20057
|
return new Promise((resolve57, reject) => {
|
|
19820
20058
|
const server = createServer3((req, res) => {
|
|
19821
20059
|
const url = req.url === "/" ? "/index.html" : req.url || "/index.html";
|
|
19822
|
-
const filePath =
|
|
19823
|
-
if (!
|
|
20060
|
+
const filePath = join40(staticDir, url);
|
|
20061
|
+
if (!existsSync44(filePath)) {
|
|
19824
20062
|
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
19825
20063
|
res.end("Not found");
|
|
19826
20064
|
return;
|
|
@@ -19828,7 +20066,7 @@ function startServer(port) {
|
|
|
19828
20066
|
const ext = extname(filePath);
|
|
19829
20067
|
const contentType = MIME_TYPES[ext] || "application/octet-stream";
|
|
19830
20068
|
try {
|
|
19831
|
-
const content =
|
|
20069
|
+
const content = readFileSync47(filePath);
|
|
19832
20070
|
res.writeHead(200, {
|
|
19833
20071
|
"Content-Type": contentType,
|
|
19834
20072
|
"Cache-Control": "no-cache"
|
|
@@ -19898,38 +20136,38 @@ async function liveCommand(options) {
|
|
|
19898
20136
|
if (options.watchPath) {
|
|
19899
20137
|
agent = manualAgent(options.watchPath);
|
|
19900
20138
|
console.log(
|
|
19901
|
-
|
|
20139
|
+
chalk46.green(" \u2713") + ` Manual watch: ${chalk46.dim(agent.logPath)}`
|
|
19902
20140
|
);
|
|
19903
20141
|
} else {
|
|
19904
|
-
console.log(
|
|
20142
|
+
console.log(chalk46.dim(" Scanning for active agents..."));
|
|
19905
20143
|
agent = detectAgent();
|
|
19906
20144
|
if (!agent) {
|
|
19907
20145
|
console.log("");
|
|
19908
|
-
console.log(
|
|
20146
|
+
console.log(chalk46.red(" \u2717 No active agent detected."));
|
|
19909
20147
|
console.log("");
|
|
19910
20148
|
console.log(
|
|
19911
|
-
|
|
20149
|
+
chalk46.dim(
|
|
19912
20150
|
" Make sure an AI coding agent is running, or specify a path:"
|
|
19913
20151
|
)
|
|
19914
20152
|
);
|
|
19915
20153
|
console.log(
|
|
19916
|
-
|
|
20154
|
+
chalk46.cyan(" holomime brain --watch <path-to-conversation-log>")
|
|
19917
20155
|
);
|
|
19918
20156
|
console.log("");
|
|
19919
20157
|
console.log(
|
|
19920
|
-
|
|
20158
|
+
chalk46.dim(" Supported agents: Claude Code, Cline, OpenClaw, Codex, Cursor")
|
|
19921
20159
|
);
|
|
19922
20160
|
process.exit(1);
|
|
19923
20161
|
}
|
|
19924
20162
|
console.log(
|
|
19925
|
-
|
|
20163
|
+
chalk46.green(" \u2713") + ` Detected ${chalk46.bold(agent.agent)} session`
|
|
19926
20164
|
);
|
|
19927
20165
|
console.log(
|
|
19928
|
-
|
|
20166
|
+
chalk46.green(" \u2713") + ` Watching: ${chalk46.dim(agent.logPath)}`
|
|
19929
20167
|
);
|
|
19930
20168
|
}
|
|
19931
20169
|
if (options.share) {
|
|
19932
|
-
console.log(
|
|
20170
|
+
console.log(chalk46.dim(" Running diagnosis for snapshot..."));
|
|
19933
20171
|
let resolved = false;
|
|
19934
20172
|
await new Promise((resolve57) => {
|
|
19935
20173
|
const watcher2 = startWatcher(agent, {
|
|
@@ -19944,7 +20182,7 @@ async function liveCommand(options) {
|
|
|
19944
20182
|
resolve57();
|
|
19945
20183
|
},
|
|
19946
20184
|
onError(err) {
|
|
19947
|
-
console.error(
|
|
20185
|
+
console.error(chalk46.red(`
|
|
19948
20186
|
\u2717 Error: ${err.message}`));
|
|
19949
20187
|
process.exit(1);
|
|
19950
20188
|
},
|
|
@@ -19956,7 +20194,7 @@ async function liveCommand(options) {
|
|
|
19956
20194
|
resolved = true;
|
|
19957
20195
|
watcher2.stop();
|
|
19958
20196
|
console.log(
|
|
19959
|
-
|
|
20197
|
+
chalk46.red(" \u2717 No diagnosis data available. Is the agent active?")
|
|
19960
20198
|
);
|
|
19961
20199
|
process.exit(1);
|
|
19962
20200
|
}
|
|
@@ -19968,10 +20206,10 @@ async function liveCommand(options) {
|
|
|
19968
20206
|
try {
|
|
19969
20207
|
server = await startServer(port);
|
|
19970
20208
|
console.log(
|
|
19971
|
-
|
|
20209
|
+
chalk46.green(" \u2713") + ` NeuralSpace: ${chalk46.cyan(`http://localhost:${server.port}`)}`
|
|
19972
20210
|
);
|
|
19973
20211
|
} catch (err) {
|
|
19974
|
-
console.log(
|
|
20212
|
+
console.log(chalk46.red(` \u2717 ${err.message}`));
|
|
19975
20213
|
process.exit(1);
|
|
19976
20214
|
}
|
|
19977
20215
|
server.broadcast({
|
|
@@ -19984,7 +20222,7 @@ async function liveCommand(options) {
|
|
|
19984
20222
|
try {
|
|
19985
20223
|
const open = (await import("open")).default;
|
|
19986
20224
|
await open(`http://localhost:${server.port}`);
|
|
19987
|
-
console.log(
|
|
20225
|
+
console.log(chalk46.dim(" Opening browser..."));
|
|
19988
20226
|
} catch {
|
|
19989
20227
|
}
|
|
19990
20228
|
}
|
|
@@ -19995,26 +20233,26 @@ async function liveCommand(options) {
|
|
|
19995
20233
|
server.broadcast(event);
|
|
19996
20234
|
lastEvent = event;
|
|
19997
20235
|
msgCount = event.messageCount;
|
|
19998
|
-
const healthColor = event.health >= 85 ?
|
|
20236
|
+
const healthColor = event.health >= 85 ? chalk46.green : event.health >= 70 ? chalk46.yellow : event.health >= 50 ? chalk46.hex("#f97316") : chalk46.red;
|
|
19999
20237
|
const patternStr = event.patterns.length > 0 ? event.patterns.map((p) => {
|
|
20000
|
-
const c = p.severity === "concern" ?
|
|
20238
|
+
const c = p.severity === "concern" ? chalk46.red : p.severity === "warning" ? chalk46.yellow : chalk46.dim;
|
|
20001
20239
|
return c(p.id);
|
|
20002
|
-
}).join(", ") :
|
|
20240
|
+
}).join(", ") : chalk46.green("none");
|
|
20003
20241
|
process.stdout.write(
|
|
20004
|
-
`\r ${
|
|
20242
|
+
`\r ${chalk46.dim("\u2502")} Health: ${healthColor(`${event.health}/100`)} (${event.grade}) ${chalk46.dim("\u2502")} Patterns: ${patternStr} ${chalk46.dim("\u2502")} Messages: ${chalk46.white(String(msgCount))} `
|
|
20005
20243
|
);
|
|
20006
20244
|
},
|
|
20007
20245
|
onError(err) {
|
|
20008
|
-
console.error(
|
|
20246
|
+
console.error(chalk46.red(`
|
|
20009
20247
|
\u2717 Watcher error: ${err.message}`));
|
|
20010
20248
|
},
|
|
20011
20249
|
onReady() {
|
|
20012
20250
|
console.log("");
|
|
20013
20251
|
console.log(
|
|
20014
|
-
|
|
20252
|
+
chalk46.green(" \u25CF ") + chalk46.bold("Monitoring agent behavior in real-time")
|
|
20015
20253
|
);
|
|
20016
20254
|
console.log(
|
|
20017
|
-
|
|
20255
|
+
chalk46.dim(" \u2502 Press Ctrl+C to stop") + chalk46.dim(" \xB7 Press s to share snapshot")
|
|
20018
20256
|
);
|
|
20019
20257
|
console.log("");
|
|
20020
20258
|
}
|
|
@@ -20037,7 +20275,7 @@ async function liveCommand(options) {
|
|
|
20037
20275
|
});
|
|
20038
20276
|
}
|
|
20039
20277
|
const shutdown = () => {
|
|
20040
|
-
console.log(
|
|
20278
|
+
console.log(chalk46.dim("\n\n Stopping..."));
|
|
20041
20279
|
if (process.stdin.isTTY) process.stdin.setRawMode(false);
|
|
20042
20280
|
watcher.stop();
|
|
20043
20281
|
server.close();
|
|
@@ -20048,7 +20286,7 @@ async function liveCommand(options) {
|
|
|
20048
20286
|
}
|
|
20049
20287
|
|
|
20050
20288
|
// src/commands/adversarial.ts
|
|
20051
|
-
import
|
|
20289
|
+
import chalk47 from "chalk";
|
|
20052
20290
|
import figures34 from "figures";
|
|
20053
20291
|
import { resolve as resolve53 } from "path";
|
|
20054
20292
|
|
|
@@ -20783,13 +21021,14 @@ function formatGapSummary(gaps) {
|
|
|
20783
21021
|
}
|
|
20784
21022
|
|
|
20785
21023
|
// src/commands/adversarial.ts
|
|
21024
|
+
init_branding();
|
|
20786
21025
|
async function adversarialCommand(options) {
|
|
20787
21026
|
const specPath = resolve53(process.cwd(), options.personality);
|
|
20788
21027
|
let spec;
|
|
20789
21028
|
try {
|
|
20790
21029
|
spec = loadSpec(specPath);
|
|
20791
21030
|
} catch {
|
|
20792
|
-
console.error(
|
|
21031
|
+
console.error(chalk47.red(` Could not read personality file: ${options.personality}`));
|
|
20793
21032
|
process.exit(1);
|
|
20794
21033
|
return;
|
|
20795
21034
|
}
|
|
@@ -20802,50 +21041,50 @@ async function adversarialCommand(options) {
|
|
|
20802
21041
|
try {
|
|
20803
21042
|
const models = await getOllamaModels();
|
|
20804
21043
|
if (models.length === 0) {
|
|
20805
|
-
console.log(
|
|
20806
|
-
console.log(
|
|
21044
|
+
console.log(chalk47.yellow(" Ollama is running but no models are installed."));
|
|
21045
|
+
console.log(chalk47.dim(" Run: ollama pull llama3"));
|
|
20807
21046
|
console.log();
|
|
20808
21047
|
return;
|
|
20809
21048
|
}
|
|
20810
21049
|
const modelName = options.model ?? models[0].name;
|
|
20811
21050
|
llmProvider = new OllamaProvider(modelName);
|
|
20812
|
-
console.log(
|
|
21051
|
+
console.log(chalk47.dim(` Provider: Ollama (${modelName})`));
|
|
20813
21052
|
} catch {
|
|
20814
|
-
console.log(
|
|
20815
|
-
console.log(
|
|
21053
|
+
console.log(chalk47.yellow(" Ollama is not running."));
|
|
21054
|
+
console.log(chalk47.dim(" Install Ollama (ollama.com) or use --provider anthropic/openai"));
|
|
20816
21055
|
console.log();
|
|
20817
21056
|
return;
|
|
20818
21057
|
}
|
|
20819
21058
|
} else if (providerName === "anthropic") {
|
|
20820
21059
|
const apiKey = process.env.ANTHROPIC_API_KEY;
|
|
20821
21060
|
if (!apiKey) {
|
|
20822
|
-
console.log(
|
|
20823
|
-
console.log(
|
|
21061
|
+
console.log(chalk47.yellow(" ANTHROPIC_API_KEY not set."));
|
|
21062
|
+
console.log(chalk47.dim(" Set it: export ANTHROPIC_API_KEY=sk-ant-..."));
|
|
20824
21063
|
console.log();
|
|
20825
21064
|
return;
|
|
20826
21065
|
}
|
|
20827
21066
|
llmProvider = createProvider({ provider: "anthropic", apiKey, model: options.model });
|
|
20828
|
-
console.log(
|
|
21067
|
+
console.log(chalk47.dim(` Provider: Anthropic (${llmProvider.modelName})`));
|
|
20829
21068
|
} else if (providerName === "openai") {
|
|
20830
21069
|
const apiKey = process.env.OPENAI_API_KEY;
|
|
20831
21070
|
if (!apiKey) {
|
|
20832
|
-
console.log(
|
|
20833
|
-
console.log(
|
|
21071
|
+
console.log(chalk47.yellow(" OPENAI_API_KEY not set."));
|
|
21072
|
+
console.log(chalk47.dim(" Set it: export OPENAI_API_KEY=sk-..."));
|
|
20834
21073
|
console.log();
|
|
20835
21074
|
return;
|
|
20836
21075
|
}
|
|
20837
21076
|
llmProvider = createProvider({ provider: "openai", apiKey, model: options.model });
|
|
20838
|
-
console.log(
|
|
21077
|
+
console.log(chalk47.dim(` Provider: OpenAI (${llmProvider.modelName})`));
|
|
20839
21078
|
} else {
|
|
20840
|
-
console.log(
|
|
21079
|
+
console.log(chalk47.yellow(` Unknown provider: ${providerName}`));
|
|
20841
21080
|
console.log();
|
|
20842
21081
|
return;
|
|
20843
21082
|
}
|
|
20844
21083
|
if (categoryFilter) {
|
|
20845
|
-
console.log(
|
|
21084
|
+
console.log(chalk47.dim(` Categories: ${categoryFilter.join(", ")}`));
|
|
20846
21085
|
}
|
|
20847
21086
|
if (mutationCount > 0) {
|
|
20848
|
-
console.log(
|
|
21087
|
+
console.log(chalk47.dim(` Mutations: +${mutationCount} randomized variants`));
|
|
20849
21088
|
}
|
|
20850
21089
|
console.log();
|
|
20851
21090
|
const report = await runAdversarialSuite(spec, llmProvider, {
|
|
@@ -20854,53 +21093,53 @@ async function adversarialCommand(options) {
|
|
|
20854
21093
|
skipNormal: options.skipNormal,
|
|
20855
21094
|
callbacks: {
|
|
20856
21095
|
onNormalBenchmarkStart: () => {
|
|
20857
|
-
console.log(
|
|
20858
|
-
console.log(
|
|
21096
|
+
console.log(chalk47.bold(" Phase 1: Normal Benchmark (baseline)"));
|
|
21097
|
+
console.log(chalk47.dim(" Running 8 standard scenarios..."));
|
|
20859
21098
|
console.log();
|
|
20860
21099
|
},
|
|
20861
21100
|
onNormalBenchmarkEnd: (normalReport) => {
|
|
20862
|
-
const color = normalReport.grade === "A" ?
|
|
21101
|
+
const color = normalReport.grade === "A" ? chalk47.green : normalReport.grade === "B" ? chalk47.cyan : normalReport.grade === "C" ? chalk47.yellow : chalk47.red;
|
|
20863
21102
|
console.log(` Normal Grade: ${color(normalReport.grade)} (${normalReport.score}/100)`);
|
|
20864
21103
|
console.log();
|
|
20865
|
-
console.log(
|
|
21104
|
+
console.log(chalk47.bold(" Phase 2: Adversarial Pressure"));
|
|
20866
21105
|
console.log();
|
|
20867
21106
|
},
|
|
20868
21107
|
onScenarioStart: (scenario, index, total) => {
|
|
20869
|
-
const progress =
|
|
20870
|
-
const catTag =
|
|
20871
|
-
console.log(` ${progress} ${catTag} ${
|
|
20872
|
-
console.log(
|
|
21108
|
+
const progress = chalk47.dim(`[${index + 1}/${total}]`);
|
|
21109
|
+
const catTag = chalk47.magenta(`[${scenario.category}]`);
|
|
21110
|
+
console.log(` ${progress} ${catTag} ${chalk47.bold(scenario.name)}`);
|
|
21111
|
+
console.log(chalk47.dim(` ${scenario.description}`));
|
|
20873
21112
|
},
|
|
20874
21113
|
onScenarioEnd: (result, _index) => {
|
|
20875
|
-
const icon = result.passed ?
|
|
20876
|
-
const detail = result.passed ?
|
|
20877
|
-
console.log(` ${icon} ${detail} \u2014 ${
|
|
21114
|
+
const icon = result.passed ? chalk47.green(figures34.tick) : chalk47.red(figures34.cross);
|
|
21115
|
+
const detail = result.passed ? chalk47.dim("Resisted") : chalk47.yellow(result.detectedSeverity);
|
|
21116
|
+
console.log(` ${icon} ${detail} \u2014 ${chalk47.dim(result.details)}`);
|
|
20878
21117
|
console.log();
|
|
20879
21118
|
},
|
|
20880
21119
|
onThinking: (label) => showTypingIndicator(label)
|
|
20881
21120
|
}
|
|
20882
21121
|
});
|
|
20883
|
-
const normalColor = report.normalGrade === "A" ?
|
|
20884
|
-
const adversarialColor = report.adversarialGrade === "A" ?
|
|
21122
|
+
const normalColor = report.normalGrade === "A" ? chalk47.green : report.normalGrade === "B" ? chalk47.cyan : report.normalGrade === "C" ? chalk47.yellow : chalk47.red;
|
|
21123
|
+
const adversarialColor = report.adversarialGrade === "A" ? chalk47.green : report.adversarialGrade === "B" ? chalk47.cyan : report.adversarialGrade === "C" ? chalk47.yellow : chalk47.red;
|
|
20885
21124
|
const boxContent = [
|
|
20886
21125
|
`Normal Grade: ${normalColor(report.normalGrade)}`,
|
|
20887
21126
|
`Adversarial Grade: ${adversarialColor(report.adversarialGrade)}`,
|
|
20888
21127
|
"",
|
|
20889
|
-
`${
|
|
20890
|
-
`${
|
|
21128
|
+
`${chalk47.green(figures34.tick)} Resisted: ${report.passed}/${report.totalScenarios}`,
|
|
21129
|
+
`${chalk47.red(figures34.cross)} Collapsed: ${report.failed}/${report.totalScenarios}`,
|
|
20891
21130
|
`Coverage: ${report.coveragePct.toFixed(1)}%`
|
|
20892
21131
|
];
|
|
20893
21132
|
const boxStyle = report.adversarialGrade === "A" || report.adversarialGrade === "B" ? "success" : report.adversarialGrade === "C" ? "warning" : "concern";
|
|
20894
21133
|
printBox(boxContent.join("\n"), boxStyle, `Adversarial Report \u2014 ${spec.name ?? "Agent"}`);
|
|
20895
21134
|
console.log();
|
|
20896
21135
|
if (report.gaps.length > 0) {
|
|
20897
|
-
console.log(
|
|
21136
|
+
console.log(chalk47.bold(" Behavioral Gaps Found:"));
|
|
20898
21137
|
console.log(formatGapSummary(report.gaps));
|
|
20899
21138
|
console.log();
|
|
20900
21139
|
printBox(
|
|
20901
21140
|
[
|
|
20902
|
-
`Run ${
|
|
20903
|
-
`Or run ${
|
|
21141
|
+
`Run ${chalk47.cyan("holomime evolve")} to address these gaps through recursive alignment.`,
|
|
21142
|
+
`Or run ${chalk47.cyan("holomime align")} targeting specific patterns.`
|
|
20904
21143
|
].join("\n"),
|
|
20905
21144
|
"info"
|
|
20906
21145
|
);
|
|
@@ -20913,12 +21152,12 @@ async function adversarialCommand(options) {
|
|
|
20913
21152
|
console.log();
|
|
20914
21153
|
}
|
|
20915
21154
|
const seconds = (report.durationMs / 1e3).toFixed(1);
|
|
20916
|
-
console.log(
|
|
21155
|
+
console.log(chalk47.dim(` Completed in ${seconds}s. ${report.categoriesTested.length} categories tested.`));
|
|
20917
21156
|
console.log();
|
|
20918
21157
|
}
|
|
20919
21158
|
|
|
20920
21159
|
// src/commands/policy.ts
|
|
20921
|
-
import
|
|
21160
|
+
import chalk48 from "chalk";
|
|
20922
21161
|
|
|
20923
21162
|
// src/analysis/nl-to-policy.ts
|
|
20924
21163
|
var PATTERN_KEYWORDS = {
|
|
@@ -21210,54 +21449,55 @@ function listPresets() {
|
|
|
21210
21449
|
}
|
|
21211
21450
|
|
|
21212
21451
|
// src/commands/policy.ts
|
|
21452
|
+
init_branding();
|
|
21213
21453
|
async function policyCommand(requirements, options) {
|
|
21214
21454
|
printHeader("NL-to-Policy \u2014 Behavioral Rule Generator");
|
|
21215
21455
|
if (options.listPresets) {
|
|
21216
21456
|
const presets = listPresets();
|
|
21217
|
-
console.log(
|
|
21457
|
+
console.log(chalk48.bold(" Available Presets:"));
|
|
21218
21458
|
console.log();
|
|
21219
21459
|
for (const preset of presets) {
|
|
21220
|
-
console.log(` ${
|
|
21221
|
-
console.log(` ${
|
|
21222
|
-
console.log(` ${
|
|
21460
|
+
console.log(` ${chalk48.cyan(preset.key)}`);
|
|
21461
|
+
console.log(` ${chalk48.dim(preset.description)}`);
|
|
21462
|
+
console.log(` ${chalk48.dim(`${preset.rules.length} rules`)}`);
|
|
21223
21463
|
console.log();
|
|
21224
21464
|
}
|
|
21225
21465
|
printBox(
|
|
21226
|
-
`Use a preset: ${
|
|
21466
|
+
`Use a preset: ${chalk48.cyan('holomime policy "enterprise_cs"')}`,
|
|
21227
21467
|
"info"
|
|
21228
21468
|
);
|
|
21229
21469
|
console.log();
|
|
21230
21470
|
return;
|
|
21231
21471
|
}
|
|
21232
21472
|
if (!requirements) {
|
|
21233
|
-
console.log(
|
|
21234
|
-
console.log(
|
|
21473
|
+
console.log(chalk48.yellow(" No requirements provided."));
|
|
21474
|
+
console.log(chalk48.dim(' Usage: holomime policy "Never be sycophantic with enterprise customers"'));
|
|
21235
21475
|
console.log();
|
|
21236
21476
|
return;
|
|
21237
21477
|
}
|
|
21238
|
-
console.log(
|
|
21478
|
+
console.log(chalk48.dim(` Input: "${requirements}"`));
|
|
21239
21479
|
console.log();
|
|
21240
21480
|
const policy = generateBehavioralPolicy(requirements, options.name);
|
|
21241
|
-
const confColor = policy.confidence >= 0.7 ?
|
|
21481
|
+
const confColor = policy.confidence >= 0.7 ? chalk48.green : policy.confidence >= 0.4 ? chalk48.yellow : chalk48.red;
|
|
21242
21482
|
const confLabel = policy.confidence >= 0.7 ? "HIGH" : policy.confidence >= 0.4 ? "MEDIUM" : "LOW";
|
|
21243
21483
|
console.log(` Confidence: ${confColor(`${confLabel} (${(policy.confidence * 100).toFixed(0)}%)`)}`);
|
|
21244
21484
|
if (policy.preset) {
|
|
21245
|
-
console.log(` Preset: ${
|
|
21485
|
+
console.log(` Preset: ${chalk48.cyan(policy.preset)}`);
|
|
21246
21486
|
}
|
|
21247
|
-
console.log(` Rules generated: ${
|
|
21487
|
+
console.log(` Rules generated: ${chalk48.bold(String(policy.rules.length))}`);
|
|
21248
21488
|
console.log();
|
|
21249
|
-
console.log(
|
|
21489
|
+
console.log(chalk48.bold(" Generated Policy:"));
|
|
21250
21490
|
console.log();
|
|
21251
21491
|
const yaml = formatPolicyYaml(policy);
|
|
21252
21492
|
for (const line of yaml.split("\n")) {
|
|
21253
|
-
console.log(` ${
|
|
21493
|
+
console.log(` ${chalk48.dim("\u2502")} ${line}`);
|
|
21254
21494
|
}
|
|
21255
21495
|
console.log();
|
|
21256
21496
|
for (const rule of policy.rules) {
|
|
21257
|
-
const effectColor = rule.effect === "deny" ?
|
|
21497
|
+
const effectColor = rule.effect === "deny" ? chalk48.red : rule.effect === "enforce" ? chalk48.cyan : chalk48.yellow;
|
|
21258
21498
|
const effectIcon = rule.effect === "deny" ? "\u2715" : rule.effect === "enforce" ? "\u25B8" : "\u25C9";
|
|
21259
|
-
console.log(` ${effectColor(effectIcon)} ${effectColor(rule.effect)} ${
|
|
21260
|
-
console.log(` ${
|
|
21499
|
+
console.log(` ${effectColor(effectIcon)} ${effectColor(rule.effect)} ${chalk48.bold(rule.pattern)} ${chalk48.dim(`(${rule.threshold}, risk ${rule.riskScore})`)}`);
|
|
21500
|
+
console.log(` ${chalk48.dim(rule.description)}`);
|
|
21261
21501
|
}
|
|
21262
21502
|
console.log();
|
|
21263
21503
|
if (policy.confidence < 0.4) {
|
|
@@ -21275,13 +21515,13 @@ async function policyCommand(requirements, options) {
|
|
|
21275
21515
|
}
|
|
21276
21516
|
|
|
21277
21517
|
// src/commands/compliance.ts
|
|
21278
|
-
import
|
|
21279
|
-
import { writeFileSync as
|
|
21518
|
+
import chalk49 from "chalk";
|
|
21519
|
+
import { writeFileSync as writeFileSync40 } from "fs";
|
|
21280
21520
|
import { resolve as resolve55 } from "path";
|
|
21281
21521
|
|
|
21282
21522
|
// src/compliance/audit-trail.ts
|
|
21283
|
-
import { readFileSync as
|
|
21284
|
-
import { join as
|
|
21523
|
+
import { readFileSync as readFileSync48, appendFileSync as appendFileSync2, existsSync as existsSync45, mkdirSync as mkdirSync28 } from "fs";
|
|
21524
|
+
import { join as join41, resolve as resolve54 } from "path";
|
|
21285
21525
|
function djb2(str) {
|
|
21286
21526
|
let hash = 5381;
|
|
21287
21527
|
for (let i = 0; i < str.length; i++) {
|
|
@@ -21295,14 +21535,14 @@ function hashEntry(entry) {
|
|
|
21295
21535
|
}
|
|
21296
21536
|
function auditLogPath(agentHandle) {
|
|
21297
21537
|
const dir = resolve54(process.cwd(), ".holomime", "audit");
|
|
21298
|
-
if (!
|
|
21538
|
+
if (!existsSync45(dir)) mkdirSync28(dir, { recursive: true });
|
|
21299
21539
|
const filename = agentHandle ? `${agentHandle}-audit.jsonl` : "audit.jsonl";
|
|
21300
|
-
return
|
|
21540
|
+
return join41(dir, filename);
|
|
21301
21541
|
}
|
|
21302
21542
|
function loadAuditLog(agentHandle) {
|
|
21303
21543
|
const logPath = auditLogPath(agentHandle);
|
|
21304
|
-
if (!
|
|
21305
|
-
return
|
|
21544
|
+
if (!existsSync45(logPath)) return [];
|
|
21545
|
+
return readFileSync48(logPath, "utf-8").trim().split("\n").filter(Boolean).map((line) => {
|
|
21306
21546
|
try {
|
|
21307
21547
|
return JSON.parse(line);
|
|
21308
21548
|
} catch {
|
|
@@ -21751,6 +21991,7 @@ function formatReACTReportMarkdown(report) {
|
|
|
21751
21991
|
}
|
|
21752
21992
|
|
|
21753
21993
|
// src/commands/compliance.ts
|
|
21994
|
+
init_branding();
|
|
21754
21995
|
async function complianceCommand(options) {
|
|
21755
21996
|
printHeader("Compliance Report \u2014 ReACT Behavioral Audit");
|
|
21756
21997
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -21758,13 +21999,13 @@ async function complianceCommand(options) {
|
|
|
21758
21999
|
const from = options.from ?? thirtyDaysAgo.toISOString().split("T")[0];
|
|
21759
22000
|
const to = options.to ?? now.toISOString().split("T")[0];
|
|
21760
22001
|
const frameworks = options.framework ? options.framework.split(",").map((s) => s.trim()) : void 0;
|
|
21761
|
-
console.log(
|
|
21762
|
-
console.log(
|
|
22002
|
+
console.log(chalk49.dim(` Agent: ${options.agent}`));
|
|
22003
|
+
console.log(chalk49.dim(` Period: ${from} to ${to}`));
|
|
21763
22004
|
if (frameworks) {
|
|
21764
|
-
console.log(
|
|
22005
|
+
console.log(chalk49.dim(` Frameworks: ${frameworks.join(", ")}`));
|
|
21765
22006
|
}
|
|
21766
22007
|
console.log();
|
|
21767
|
-
console.log(
|
|
22008
|
+
console.log(chalk49.dim(" Generating ReACT compliance report..."));
|
|
21768
22009
|
console.log();
|
|
21769
22010
|
const report = generateReACTReport({
|
|
21770
22011
|
agent: options.agent,
|
|
@@ -21773,183 +22014,65 @@ async function complianceCommand(options) {
|
|
|
21773
22014
|
to,
|
|
21774
22015
|
frameworks
|
|
21775
22016
|
});
|
|
21776
|
-
console.log(
|
|
22017
|
+
console.log(chalk49.bold(" ReACT Reasoning Trace:"));
|
|
21777
22018
|
for (const step of report.steps) {
|
|
21778
|
-
const phaseColor = step.phase === "reason" ?
|
|
22019
|
+
const phaseColor = step.phase === "reason" ? chalk49.cyan : step.phase === "act" ? chalk49.yellow : chalk49.green;
|
|
21779
22020
|
console.log(` ${phaseColor(`[${step.phase.toUpperCase()}]`)} ${step.action}`);
|
|
21780
|
-
console.log(` ${
|
|
22021
|
+
console.log(` ${chalk49.dim(step.result)}`);
|
|
21781
22022
|
}
|
|
21782
22023
|
console.log();
|
|
21783
|
-
const chainIcon = report.chainIntegrity.verified ?
|
|
22024
|
+
const chainIcon = report.chainIntegrity.verified ? chalk49.green("\u2713") : chalk49.red("\u2715");
|
|
21784
22025
|
console.log(` Audit Chain: ${chainIcon} ${report.chainIntegrity.verified ? "Verified" : "FAILED"} (${report.chainIntegrity.totalEntries} entries)`);
|
|
21785
22026
|
console.log();
|
|
21786
|
-
console.log(
|
|
21787
|
-
console.log(` ${
|
|
21788
|
-
console.log(` ${
|
|
22027
|
+
console.log(chalk49.bold(" Statistics:"));
|
|
22028
|
+
console.log(` ${chalk49.dim("Events:")} ${report.statistics.totalEvents} ${chalk49.dim("Diagnoses:")} ${report.statistics.diagnoses} ${chalk49.dim("Sessions:")} ${report.statistics.sessions}`);
|
|
22029
|
+
console.log(` ${chalk49.dim("Drift:")} ${report.statistics.driftEvents} ${chalk49.dim("Violations:")} ${report.statistics.guardViolations} ${chalk49.dim("Avg Score:")} ${report.statistics.averageScore}/100`);
|
|
21789
22030
|
console.log();
|
|
21790
22031
|
if (report.riskFindings.length > 0) {
|
|
21791
|
-
console.log(
|
|
22032
|
+
console.log(chalk49.bold(" Risk Findings:"));
|
|
21792
22033
|
for (const finding of report.riskFindings) {
|
|
21793
|
-
const sevColor = finding.severity === "critical" ?
|
|
22034
|
+
const sevColor = finding.severity === "critical" ? chalk49.red : finding.severity === "high" ? chalk49.yellow : finding.severity === "medium" ? chalk49.cyan : chalk49.dim;
|
|
21794
22035
|
console.log(` ${sevColor(`[${finding.severity.toUpperCase()}]`)} ${finding.title}`);
|
|
21795
|
-
console.log(` ${
|
|
22036
|
+
console.log(` ${chalk49.dim(finding.recommendation)}`);
|
|
21796
22037
|
}
|
|
21797
22038
|
console.log();
|
|
21798
22039
|
}
|
|
21799
|
-
console.log(
|
|
22040
|
+
console.log(chalk49.bold(" Framework Compliance:"));
|
|
21800
22041
|
for (const section of report.frameworkSections) {
|
|
21801
|
-
const statusColor = section.status === "compliant" ?
|
|
22042
|
+
const statusColor = section.status === "compliant" ? chalk49.green : section.status === "partial" ? chalk49.yellow : section.status === "non_compliant" ? chalk49.red : chalk49.dim;
|
|
21802
22043
|
const statusLabel = section.status === "non_compliant" ? "NON-COMPLIANT" : section.status.toUpperCase().replace("_", " ");
|
|
21803
22044
|
console.log(` ${statusColor("\u25CF")} ${section.framework}: ${statusColor(statusLabel)}`);
|
|
21804
22045
|
}
|
|
21805
22046
|
console.log();
|
|
21806
22047
|
if (report.recommendations.length > 0) {
|
|
21807
|
-
console.log(
|
|
22048
|
+
console.log(chalk49.bold(" Recommendations:"));
|
|
21808
22049
|
for (let i = 0; i < report.recommendations.length; i++) {
|
|
21809
|
-
console.log(` ${
|
|
22050
|
+
console.log(` ${chalk49.cyan(`${i + 1}.`)} ${report.recommendations[i]}`);
|
|
21810
22051
|
}
|
|
21811
22052
|
console.log();
|
|
21812
22053
|
}
|
|
21813
22054
|
if (options.output) {
|
|
21814
22055
|
const outputPath = resolve55(process.cwd(), options.output);
|
|
21815
22056
|
const markdown = formatReACTReportMarkdown(report);
|
|
21816
|
-
|
|
21817
|
-
printBox(`Report saved to ${
|
|
22057
|
+
writeFileSync40(outputPath, markdown, "utf-8");
|
|
22058
|
+
printBox(`Report saved to ${chalk49.cyan(options.output)}`, "success");
|
|
21818
22059
|
console.log();
|
|
21819
22060
|
} else {
|
|
21820
22061
|
printBox(
|
|
21821
|
-
`Save full report: ${
|
|
22062
|
+
`Save full report: ${chalk49.cyan(`holomime compliance --agent ${options.agent} -o report.md`)}`,
|
|
21822
22063
|
"info"
|
|
21823
22064
|
);
|
|
21824
22065
|
console.log();
|
|
21825
22066
|
}
|
|
21826
22067
|
}
|
|
21827
22068
|
|
|
21828
|
-
// src/
|
|
21829
|
-
|
|
21830
|
-
import { join as join41 } from "path";
|
|
21831
|
-
import { homedir as homedir9 } from "os";
|
|
21832
|
-
import chalk49 from "chalk";
|
|
21833
|
-
function getConfigPath() {
|
|
21834
|
-
return join41(homedir9(), ".holomime", "config.json");
|
|
21835
|
-
}
|
|
21836
|
-
function getConfigDir() {
|
|
21837
|
-
return join41(homedir9(), ".holomime");
|
|
21838
|
-
}
|
|
21839
|
-
function loadConfig2() {
|
|
21840
|
-
const configPath = getConfigPath();
|
|
21841
|
-
if (!existsSync45(configPath)) return null;
|
|
21842
|
-
try {
|
|
21843
|
-
const data = JSON.parse(readFileSync48(configPath, "utf-8"));
|
|
21844
|
-
if (data.provider && data.apiKey) return data;
|
|
21845
|
-
return null;
|
|
21846
|
-
} catch {
|
|
21847
|
-
return null;
|
|
21848
|
-
}
|
|
21849
|
-
}
|
|
21850
|
-
function saveConfig(config) {
|
|
21851
|
-
const configDir = getConfigDir();
|
|
21852
|
-
mkdirSync28(configDir, { recursive: true });
|
|
21853
|
-
writeFileSync40(getConfigPath(), JSON.stringify(config, null, 2));
|
|
21854
|
-
}
|
|
21855
|
-
async function configCommand(options) {
|
|
21856
|
-
printHeader("Config");
|
|
21857
|
-
if (options.show) {
|
|
21858
|
-
const config = loadConfig2();
|
|
21859
|
-
if (config) {
|
|
21860
|
-
console.log(chalk49.dim(" Provider: ") + chalk49.cyan(config.provider));
|
|
21861
|
-
console.log(chalk49.dim(" API Key: ") + chalk49.cyan(config.apiKey.slice(0, 12) + "..." + config.apiKey.slice(-4)));
|
|
21862
|
-
if (config.model) {
|
|
21863
|
-
console.log(chalk49.dim(" Model: ") + chalk49.cyan(config.model));
|
|
21864
|
-
}
|
|
21865
|
-
console.log(chalk49.dim(" Config: ") + getConfigPath());
|
|
21866
|
-
} else {
|
|
21867
|
-
console.log(chalk49.yellow(" No config found. Run `holomime config` to set up."));
|
|
21868
|
-
}
|
|
21869
|
-
console.log();
|
|
21870
|
-
return;
|
|
21871
|
-
}
|
|
21872
|
-
if (options.provider && options.key) {
|
|
21873
|
-
const config = {
|
|
21874
|
-
provider: options.provider,
|
|
21875
|
-
apiKey: options.key
|
|
21876
|
-
};
|
|
21877
|
-
saveConfig(config);
|
|
21878
|
-
console.log(chalk49.green(" Config saved!"));
|
|
21879
|
-
console.log(chalk49.dim(` Provider: ${config.provider}`));
|
|
21880
|
-
console.log(chalk49.dim(` Location: ${getConfigPath()}`));
|
|
21881
|
-
console.log();
|
|
21882
|
-
printNextSteps();
|
|
21883
|
-
return;
|
|
21884
|
-
}
|
|
21885
|
-
console.log(chalk49.dim(" Set up your API key so every command just works."));
|
|
21886
|
-
console.log(chalk49.dim(" This saves to ~/.holomime/config.json (one-time setup)."));
|
|
21887
|
-
console.log();
|
|
21888
|
-
const readline = await import("readline");
|
|
21889
|
-
const rl = readline.createInterface({
|
|
21890
|
-
input: process.stdin,
|
|
21891
|
-
output: process.stdout
|
|
21892
|
-
});
|
|
21893
|
-
const ask = (question) => new Promise((resolve57) => rl.question(question, resolve57));
|
|
21894
|
-
try {
|
|
21895
|
-
console.log(chalk49.dim(" 1) anthropic") + chalk49.dim(" enter your sk-ant-... key"));
|
|
21896
|
-
console.log(chalk49.dim(" 2) openai") + chalk49.dim(" enter your sk-... key"));
|
|
21897
|
-
console.log();
|
|
21898
|
-
const providerInput = (await ask(" Select provider (1 or 2): ")).trim();
|
|
21899
|
-
let provider;
|
|
21900
|
-
if (providerInput === "1" || providerInput.toLowerCase() === "anthropic") {
|
|
21901
|
-
provider = "anthropic";
|
|
21902
|
-
} else if (providerInput === "2" || providerInput.toLowerCase() === "openai") {
|
|
21903
|
-
provider = "openai";
|
|
21904
|
-
} else if (providerInput === "") {
|
|
21905
|
-
console.log(chalk49.dim(" Skipped. Run `holomime config` when ready."));
|
|
21906
|
-
rl.close();
|
|
21907
|
-
return;
|
|
21908
|
-
} else {
|
|
21909
|
-
console.log(chalk49.red(` Invalid selection: ${providerInput}`));
|
|
21910
|
-
rl.close();
|
|
21911
|
-
return;
|
|
21912
|
-
}
|
|
21913
|
-
console.log(chalk49.dim(` Selected: ${provider}`));
|
|
21914
|
-
console.log();
|
|
21915
|
-
const keyHint = provider === "anthropic" ? "sk-ant-..." : "sk-...";
|
|
21916
|
-
const apiKey = (await ask(` API Key (${keyHint}): `)).trim();
|
|
21917
|
-
if (!apiKey) {
|
|
21918
|
-
console.log(chalk49.dim(" Skipped. Run `holomime config` when ready."));
|
|
21919
|
-
rl.close();
|
|
21920
|
-
return;
|
|
21921
|
-
}
|
|
21922
|
-
const config = { provider, apiKey };
|
|
21923
|
-
saveConfig(config);
|
|
21924
|
-
console.log();
|
|
21925
|
-
console.log(chalk49.green(" Config saved!"));
|
|
21926
|
-
console.log(chalk49.dim(` Location: ${getConfigPath()}`));
|
|
21927
|
-
console.log();
|
|
21928
|
-
printNextSteps();
|
|
21929
|
-
rl.close();
|
|
21930
|
-
} catch {
|
|
21931
|
-
rl.close();
|
|
21932
|
-
}
|
|
21933
|
-
}
|
|
21934
|
-
function printNextSteps() {
|
|
21935
|
-
console.log(chalk49.bold(" NEXT STEP") + chalk49.dim(" \u2014 profile your agent:"));
|
|
21936
|
-
console.log();
|
|
21937
|
-
console.log(chalk49.dim(" Already have an agent?"));
|
|
21938
|
-
console.log(chalk49.cyan(" holomime personality") + chalk49.dim(" Define how it should behave"));
|
|
21939
|
-
console.log(chalk49.cyan(" holomime diagnose") + chalk49.dim(" Analyze its conversation logs"));
|
|
21940
|
-
console.log();
|
|
21941
|
-
console.log(chalk49.dim(" Building for a robot?"));
|
|
21942
|
-
console.log(chalk49.cyan(" holomime identity") + chalk49.dim(" Full 8-file identity stack with body.api"));
|
|
21943
|
-
console.log();
|
|
21944
|
-
console.log(chalk49.dim(" Then fix and verify:"));
|
|
21945
|
-
console.log(chalk49.cyan(" holomime therapy") + chalk49.dim(" Run in background \u2014 generate data, detect regression"));
|
|
21946
|
-
console.log(chalk49.cyan(" holomime cure") + chalk49.dim(" Full pipeline \u2014 diagnose, fine-tune, verify"));
|
|
21947
|
-
console.log();
|
|
21948
|
-
}
|
|
22069
|
+
// src/cli.ts
|
|
22070
|
+
init_config();
|
|
21949
22071
|
|
|
21950
22072
|
// src/commands/mira-cmd.ts
|
|
22073
|
+
init_branding();
|
|
21951
22074
|
import chalk50 from "chalk";
|
|
21952
|
-
import { writeFileSync as writeFileSync41, readFileSync as readFileSync49, mkdirSync as mkdirSync29, existsSync as existsSync46 } from "fs";
|
|
22075
|
+
import { writeFileSync as writeFileSync41, readFileSync as readFileSync49, mkdirSync as mkdirSync29, existsSync as existsSync46, appendFileSync as appendFileSync3 } from "fs";
|
|
21953
22076
|
import { resolve as resolve56, join as join42 } from "path";
|
|
21954
22077
|
|
|
21955
22078
|
// src/analysis/ego-tracker.ts
|
|
@@ -22123,6 +22246,25 @@ function getShadowLogPath() {
|
|
|
22123
22246
|
function getEgoStatePath() {
|
|
22124
22247
|
return resolve56(process.cwd(), HOLOMIME_DIR4, "ego-state.json");
|
|
22125
22248
|
}
|
|
22249
|
+
function getBenchmarkHistoryPath() {
|
|
22250
|
+
return resolve56(process.cwd(), HOLOMIME_DIR4, "benchmark-history.jsonl");
|
|
22251
|
+
}
|
|
22252
|
+
function appendBenchmarkEntry(entry) {
|
|
22253
|
+
const dir = resolve56(process.cwd(), HOLOMIME_DIR4);
|
|
22254
|
+
mkdirSync29(dir, { recursive: true });
|
|
22255
|
+
appendFileSync3(getBenchmarkHistoryPath(), JSON.stringify(entry) + "\n");
|
|
22256
|
+
}
|
|
22257
|
+
function loadBenchmarkHistory() {
|
|
22258
|
+
const path = getBenchmarkHistoryPath();
|
|
22259
|
+
if (!existsSync46(path)) return [];
|
|
22260
|
+
try {
|
|
22261
|
+
const content = readFileSync49(path, "utf-8").trim();
|
|
22262
|
+
if (!content) return [];
|
|
22263
|
+
return content.split("\n").map((line) => JSON.parse(line));
|
|
22264
|
+
} catch {
|
|
22265
|
+
return [];
|
|
22266
|
+
}
|
|
22267
|
+
}
|
|
22126
22268
|
function loadTherapyState() {
|
|
22127
22269
|
const path = getTherapyStatePath();
|
|
22128
22270
|
if (!existsSync46(path)) return null;
|
|
@@ -22243,11 +22385,26 @@ async function therapyStart(options) {
|
|
|
22243
22385
|
console.log();
|
|
22244
22386
|
const scenarios = getBenchmarkScenarios();
|
|
22245
22387
|
let cycleCount = 0;
|
|
22388
|
+
let totalViolationsCaught = 0;
|
|
22389
|
+
let totalViolationsPassed = 0;
|
|
22246
22390
|
const runCycle = async () => {
|
|
22247
22391
|
if (cycleCount >= maxCycles) {
|
|
22248
|
-
|
|
22249
|
-
|
|
22250
|
-
|
|
22392
|
+
const now = /* @__PURE__ */ new Date();
|
|
22393
|
+
const tomorrow = new Date(now);
|
|
22394
|
+
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
22395
|
+
tomorrow.setHours(0, 0, 0, 0);
|
|
22396
|
+
const sleepMs = tomorrow.getTime() - now.getTime();
|
|
22397
|
+
const sleepHours = (sleepMs / 36e5).toFixed(1);
|
|
22398
|
+
console.log(
|
|
22399
|
+
chalk50.dim(` [${now.toLocaleTimeString()}] `) + chalk50.yellow(`Daily limit reached (${maxCycles} cycles). Sleeping ${sleepHours}h until midnight.`) + chalk50.dim(` Total DPO pairs: ${state.dpoPairsGenerated}`)
|
|
22400
|
+
);
|
|
22401
|
+
cycleCount = 0;
|
|
22402
|
+
totalViolationsCaught = 0;
|
|
22403
|
+
totalViolationsPassed = 0;
|
|
22404
|
+
await new Promise((resolve57) => setTimeout(resolve57, sleepMs));
|
|
22405
|
+
console.log(
|
|
22406
|
+
chalk50.dim(` [${(/* @__PURE__ */ new Date()).toLocaleTimeString()}] `) + chalk50.green("New day started. Resuming therapy cycles.")
|
|
22407
|
+
);
|
|
22251
22408
|
return;
|
|
22252
22409
|
}
|
|
22253
22410
|
cycleCount++;
|
|
@@ -22283,7 +22440,6 @@ async function therapyStart(options) {
|
|
|
22283
22440
|
}));
|
|
22284
22441
|
const corpusPath = resolve56(process.cwd(), HOLOMIME_DIR4, "dpo-corpus.jsonl");
|
|
22285
22442
|
const corpusLines = dpoPairs.map((p) => JSON.stringify(p)).join("\n") + "\n";
|
|
22286
|
-
const { appendFileSync: appendFileSync3 } = await import("fs");
|
|
22287
22443
|
appendFileSync3(corpusPath, corpusLines);
|
|
22288
22444
|
const pattern = scenario.targetPattern;
|
|
22289
22445
|
const existing = shadow.detected_patterns.find((p) => p.name === pattern);
|
|
@@ -22313,6 +22469,11 @@ async function therapyStart(options) {
|
|
|
22313
22469
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
22314
22470
|
});
|
|
22315
22471
|
saveShadowLog(shadow);
|
|
22472
|
+
if (therapyResult === "improved") {
|
|
22473
|
+
totalViolationsCaught += dpoPairs.length;
|
|
22474
|
+
} else {
|
|
22475
|
+
totalViolationsPassed += dpoPairs.length;
|
|
22476
|
+
}
|
|
22316
22477
|
egoTracker.logDecision({
|
|
22317
22478
|
situation: `therapy-cycle-${cycleCount}: ${pattern}`,
|
|
22318
22479
|
decision: "modified",
|
|
@@ -22337,6 +22498,21 @@ async function therapyStart(options) {
|
|
|
22337
22498
|
chalk50.dim(` [${(/* @__PURE__ */ new Date()).toLocaleTimeString()}] `) + chalk50.magenta(`Ego self-adjustment: ${adjustments.map((a) => `${a.parameter} \u2192 ${a.suggestedValue}`).join(", ")}`)
|
|
22338
22499
|
);
|
|
22339
22500
|
}
|
|
22501
|
+
const totalActions = totalViolationsCaught + totalViolationsPassed;
|
|
22502
|
+
const reliabilityScore = totalActions > 0 ? totalViolationsCaught / totalActions : 0;
|
|
22503
|
+
const entry = {
|
|
22504
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
22505
|
+
cycle: cycleCount,
|
|
22506
|
+
reliability_score: Math.round(reliabilityScore * 1e4) / 1e4,
|
|
22507
|
+
violations_caught: totalViolationsCaught,
|
|
22508
|
+
violations_passed: totalViolationsPassed,
|
|
22509
|
+
shadow_patterns: shadow.detected_patterns.length,
|
|
22510
|
+
ego_adjustments: state.egoAdjustments + adjustmentCount
|
|
22511
|
+
};
|
|
22512
|
+
appendBenchmarkEntry(entry);
|
|
22513
|
+
console.log(
|
|
22514
|
+
chalk50.dim(` [${(/* @__PURE__ */ new Date()).toLocaleTimeString()}] `) + chalk50.cyan(`Reliability: ${(reliabilityScore * 100).toFixed(1)}%`) + chalk50.dim(` (caught: ${totalViolationsCaught}, passed: ${totalViolationsPassed})`)
|
|
22515
|
+
);
|
|
22340
22516
|
}
|
|
22341
22517
|
saveEgoTracker(egoTracker);
|
|
22342
22518
|
state.cyclesCompleted = cycleCount;
|
|
@@ -22435,6 +22611,31 @@ function therapyStatus() {
|
|
|
22435
22611
|
console.log(chalk50.dim(" Best strat: ") + chalk50.cyan(egoStats.mostEffectiveStrategy));
|
|
22436
22612
|
}
|
|
22437
22613
|
}
|
|
22614
|
+
const benchmarkHistory = loadBenchmarkHistory();
|
|
22615
|
+
if (benchmarkHistory.length > 0) {
|
|
22616
|
+
console.log();
|
|
22617
|
+
console.log(chalk50.dim(" Reliability trend:"));
|
|
22618
|
+
const scores = benchmarkHistory.map((e) => e.reliability_score);
|
|
22619
|
+
const scoreLabels = scores.map((s) => `${(s * 100).toFixed(1)}%`);
|
|
22620
|
+
const display = scoreLabels.length <= 5 ? scoreLabels.join(" \u2192 ") : [...scoreLabels.slice(0, 2), "...", ...scoreLabels.slice(-2)].join(" \u2192 ");
|
|
22621
|
+
let trendLabel;
|
|
22622
|
+
if (scores.length >= 2) {
|
|
22623
|
+
const first = scores[0];
|
|
22624
|
+
const last = scores[scores.length - 1];
|
|
22625
|
+
if (last > first + 0.01) {
|
|
22626
|
+
trendLabel = chalk50.green("(improving)");
|
|
22627
|
+
} else if (last < first - 0.01) {
|
|
22628
|
+
trendLabel = chalk50.red("(declining)");
|
|
22629
|
+
} else {
|
|
22630
|
+
trendLabel = chalk50.dim("(stable)");
|
|
22631
|
+
}
|
|
22632
|
+
} else {
|
|
22633
|
+
trendLabel = chalk50.dim("(baseline)");
|
|
22634
|
+
}
|
|
22635
|
+
console.log(chalk50.dim(" Reliability: ") + chalk50.cyan(display) + " " + trendLabel);
|
|
22636
|
+
const latest = benchmarkHistory[benchmarkHistory.length - 1];
|
|
22637
|
+
console.log(chalk50.dim(" Last check: ") + chalk50.dim(`cycle ${latest.cycle}, ${new Date(latest.timestamp).toLocaleString()}`));
|
|
22638
|
+
}
|
|
22438
22639
|
console.log();
|
|
22439
22640
|
if (state.status === "practicing") {
|
|
22440
22641
|
console.log(chalk50.dim(" Run ") + chalk50.cyan("holomime therapy stop") + chalk50.dim(" to stop therapy."));
|