@sonnechasser/ntrp 0.1.7 → 0.1.8
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 +15 -1
- package/dist/index.js +182 -80
- package/dist/index.js.map +1 -1
- package/dist/investigation/verbosity-cli.js.map +1 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/whimsy/time-bank-smoke.js +131 -15
- package/dist/whimsy/time-bank-smoke.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1623,6 +1623,9 @@ function ensureInstall() {
|
|
|
1623
1623
|
function getInstallId() {
|
|
1624
1624
|
return ensureInstall().install_id;
|
|
1625
1625
|
}
|
|
1626
|
+
function clearInstallCache() {
|
|
1627
|
+
cachedInstall = null;
|
|
1628
|
+
}
|
|
1626
1629
|
var cachedInstall;
|
|
1627
1630
|
var init_install = __esm({
|
|
1628
1631
|
"src/config/install.ts"() {
|
|
@@ -1774,6 +1777,12 @@ import { join as join5 } from "path";
|
|
|
1774
1777
|
function progressPath2() {
|
|
1775
1778
|
return join5(ntrpHome(), "progress.json");
|
|
1776
1779
|
}
|
|
1780
|
+
function legacyStatePath2() {
|
|
1781
|
+
return join5(ntrpHome(), "state.json");
|
|
1782
|
+
}
|
|
1783
|
+
function legacyStateBackupPath2() {
|
|
1784
|
+
return join5(ntrpHome(), "state.json.bak");
|
|
1785
|
+
}
|
|
1777
1786
|
function ensureDir4() {
|
|
1778
1787
|
const dir = ntrpHome();
|
|
1779
1788
|
if (!existsSync5(dir)) {
|
|
@@ -1852,6 +1861,18 @@ function saveProgress(state) {
|
|
|
1852
1861
|
};
|
|
1853
1862
|
writeFileSync4(progressPath2(), JSON.stringify(next, null, 2) + "\n");
|
|
1854
1863
|
}
|
|
1864
|
+
function wipeProgressFiles() {
|
|
1865
|
+
installMismatchWarned = false;
|
|
1866
|
+
for (const path of [progressPath2(), legacyStatePath2(), legacyStateBackupPath2()]) {
|
|
1867
|
+
if (existsSync5(path)) {
|
|
1868
|
+
unlinkSync2(path);
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
function resetProgress() {
|
|
1873
|
+
ensureInstall();
|
|
1874
|
+
wipeProgressFiles();
|
|
1875
|
+
}
|
|
1855
1876
|
function appendCredit(state, credit) {
|
|
1856
1877
|
const credits = [...state.credits, credit];
|
|
1857
1878
|
if (credits.length > CREDIT_HISTORY_CAP) {
|
|
@@ -3625,7 +3646,7 @@ var init_admin_confirm = __esm({
|
|
|
3625
3646
|
// src/services/scratch-wipe.ts
|
|
3626
3647
|
import { existsSync as existsSync7, rmSync as rmSync3, unlinkSync as unlinkSync3 } from "fs";
|
|
3627
3648
|
import { join as join7 } from "path";
|
|
3628
|
-
async function performScratchWipe() {
|
|
3649
|
+
async function performScratchWipe(opts = {}) {
|
|
3629
3650
|
const home = ntrpHome();
|
|
3630
3651
|
const removed = [];
|
|
3631
3652
|
try {
|
|
@@ -3644,6 +3665,13 @@ async function performScratchWipe() {
|
|
|
3644
3665
|
{ path: join7(home, "sessions"), kind: "dir" },
|
|
3645
3666
|
{ path: join7(home, "datasets"), kind: "dir" }
|
|
3646
3667
|
];
|
|
3668
|
+
if (opts.includeProgress) {
|
|
3669
|
+
targets.push(
|
|
3670
|
+
{ path: join7(home, "install.json"), kind: "file" },
|
|
3671
|
+
{ path: join7(home, "progress.json"), kind: "file" },
|
|
3672
|
+
{ path: join7(home, "state.json"), kind: "file" }
|
|
3673
|
+
);
|
|
3674
|
+
}
|
|
3647
3675
|
for (const { path, kind } of targets) {
|
|
3648
3676
|
if (!existsSync7(path)) continue;
|
|
3649
3677
|
try {
|
|
@@ -3656,12 +3684,18 @@ async function performScratchWipe() {
|
|
|
3656
3684
|
} catch {
|
|
3657
3685
|
}
|
|
3658
3686
|
}
|
|
3687
|
+
if (opts.includeProgress) {
|
|
3688
|
+
wipeProgressFiles();
|
|
3689
|
+
clearInstallCache();
|
|
3690
|
+
}
|
|
3659
3691
|
resetConfigCache();
|
|
3660
3692
|
return { removed };
|
|
3661
3693
|
}
|
|
3662
3694
|
var init_scratch_wipe = __esm({
|
|
3663
3695
|
"src/services/scratch-wipe.ts"() {
|
|
3664
3696
|
"use strict";
|
|
3697
|
+
init_install();
|
|
3698
|
+
init_progress();
|
|
3665
3699
|
init_store();
|
|
3666
3700
|
}
|
|
3667
3701
|
});
|
|
@@ -6055,15 +6089,22 @@ __export(scratch_exports, {
|
|
|
6055
6089
|
handler: () => handler3
|
|
6056
6090
|
});
|
|
6057
6091
|
import chalk9 from "chalk";
|
|
6058
|
-
function printScratchPreamble() {
|
|
6092
|
+
function printScratchPreamble(includeProgress) {
|
|
6059
6093
|
console.log();
|
|
6060
6094
|
console.log(" " + chalk9.yellow.bold("This will permanently remove:"));
|
|
6061
6095
|
console.log(" " + chalk9.dim(" \u2022 API key and all config.json settings"));
|
|
6062
6096
|
console.log(" " + chalk9.dim(" \u2022 Company profile (you'll re-onboard on next use)"));
|
|
6063
6097
|
console.log(" " + chalk9.dim(" \u2022 All sessions and datasets"));
|
|
6064
6098
|
console.log(" " + chalk9.dim(" \u2022 Demo taxonomy cache"));
|
|
6099
|
+
if (includeProgress) {
|
|
6100
|
+
console.log(" " + chalk9.dim(" \u2022 Progress (hours saved) and install identity"));
|
|
6101
|
+
}
|
|
6065
6102
|
console.log();
|
|
6066
|
-
|
|
6103
|
+
if (includeProgress) {
|
|
6104
|
+
console.log(" " + chalk9.dim("Preserved: memory, strategies, wins, knowledge, exports, audit"));
|
|
6105
|
+
} else {
|
|
6106
|
+
console.log(" " + chalk9.dim("Preserved: progress (hours saved), memory, strategies, wins, knowledge, exports, audit"));
|
|
6107
|
+
}
|
|
6067
6108
|
console.log();
|
|
6068
6109
|
}
|
|
6069
6110
|
function resetContextAfterScratch(ctx) {
|
|
@@ -6085,24 +6126,26 @@ function resetContextAfterScratch(ctx) {
|
|
|
6085
6126
|
ctx.lastExchange = void 0;
|
|
6086
6127
|
}
|
|
6087
6128
|
async function handler3(args, ctx) {
|
|
6088
|
-
const { flags } = parseArgs2(args, ["confirm"]);
|
|
6129
|
+
const { flags } = parseArgs2(args, ["confirm", "include-progress"]);
|
|
6089
6130
|
const confirmedFlag = getBool(flags, "confirm");
|
|
6131
|
+
const includeProgress = getBool(flags, "include-progress");
|
|
6090
6132
|
const ok = await requireTypedWord(ctx, {
|
|
6091
|
-
title: "Factory reset",
|
|
6133
|
+
title: includeProgress ? "Factory reset (including progress)" : "Factory reset",
|
|
6092
6134
|
word: "scratch",
|
|
6093
6135
|
confirmedFlag,
|
|
6094
|
-
preamble: printScratchPreamble
|
|
6136
|
+
preamble: () => printScratchPreamble(includeProgress)
|
|
6095
6137
|
});
|
|
6096
6138
|
if (!ok) {
|
|
6097
6139
|
printAdminCancelled("Scratch", 'Type "scratch" exactly to confirm.');
|
|
6098
6140
|
return "Scratch cancelled";
|
|
6099
6141
|
}
|
|
6100
|
-
await performScratchWipe();
|
|
6142
|
+
await performScratchWipe({ includeProgress });
|
|
6101
6143
|
resetContextAfterScratch(ctx);
|
|
6102
6144
|
await rotateToFreshSession(ctx);
|
|
6103
6145
|
await initSchema();
|
|
6104
6146
|
console.log();
|
|
6105
|
-
|
|
6147
|
+
const detail = includeProgress ? " \u2014 local config, data, and progress wiped." : " \u2014 local config and data wiped.";
|
|
6148
|
+
console.log(" " + paint("accent", "\u2713 Scratch complete") + chalk9.dim(detail));
|
|
6106
6149
|
console.log();
|
|
6107
6150
|
if (ctx.oneShot) {
|
|
6108
6151
|
console.log(
|
|
@@ -23661,7 +23704,18 @@ var progress_exports = {};
|
|
|
23661
23704
|
__export(progress_exports, {
|
|
23662
23705
|
handler: () => handler44
|
|
23663
23706
|
});
|
|
23664
|
-
|
|
23707
|
+
import chalk62 from "chalk";
|
|
23708
|
+
function printProgressResetPreamble() {
|
|
23709
|
+
console.log();
|
|
23710
|
+
console.log(" " + chalk62.yellow.bold("This will permanently remove:"));
|
|
23711
|
+
console.log(" " + chalk62.dim(" \u2022 Hours saved and milestone unlocks"));
|
|
23712
|
+
console.log(" " + chalk62.dim(" \u2022 Usage counters and weekly activity rollups"));
|
|
23713
|
+
console.log(" " + chalk62.dim(" \u2022 Credit history used for dedup"));
|
|
23714
|
+
console.log();
|
|
23715
|
+
console.log(" " + chalk62.dim("Preserved: install identity (install.json)"));
|
|
23716
|
+
console.log();
|
|
23717
|
+
}
|
|
23718
|
+
function showProgress() {
|
|
23665
23719
|
const bank = getTimeBankSummary();
|
|
23666
23720
|
if (bank.total_minutes <= 0) {
|
|
23667
23721
|
console.log();
|
|
@@ -23672,10 +23726,53 @@ async function handler44(_args, _ctx) {
|
|
|
23672
23726
|
renderProgressReport();
|
|
23673
23727
|
return `Progress: ${bank.total_hours.toFixed(1)}h saved`;
|
|
23674
23728
|
}
|
|
23729
|
+
async function handleReset(ctx, confirmedFlag) {
|
|
23730
|
+
const bank = getTimeBankSummary();
|
|
23731
|
+
if (bank.total_minutes <= 0) {
|
|
23732
|
+
console.log();
|
|
23733
|
+
console.log(" " + chalk62.dim("No progress to reset."));
|
|
23734
|
+
console.log();
|
|
23735
|
+
return "No progress to reset";
|
|
23736
|
+
}
|
|
23737
|
+
const ok = await requireTypedWord(ctx, {
|
|
23738
|
+
title: "Reset progress",
|
|
23739
|
+
word: "reset",
|
|
23740
|
+
confirmedFlag,
|
|
23741
|
+
preamble: printProgressResetPreamble,
|
|
23742
|
+
oneShotHint: "Re-run with: ntrp progress reset --confirm"
|
|
23743
|
+
});
|
|
23744
|
+
if (!ok) {
|
|
23745
|
+
printAdminCancelled("Progress reset", 'Type "reset" exactly to confirm.');
|
|
23746
|
+
return "Progress reset cancelled";
|
|
23747
|
+
}
|
|
23748
|
+
resetProgress();
|
|
23749
|
+
console.log();
|
|
23750
|
+
console.log(" " + paint("accent", "\u2713 Progress reset") + chalk62.dim(" \u2014 hours and milestones cleared."));
|
|
23751
|
+
console.log();
|
|
23752
|
+
return "Progress reset";
|
|
23753
|
+
}
|
|
23754
|
+
async function handler44(args, ctx) {
|
|
23755
|
+
const { positional, flags } = parseArgs2(args, ["confirm"]);
|
|
23756
|
+
const sub = positional[0]?.toLowerCase();
|
|
23757
|
+
if (sub === "reset") {
|
|
23758
|
+
return handleReset(ctx, getBool(flags, "confirm"));
|
|
23759
|
+
}
|
|
23760
|
+
if (sub && sub !== "reset") {
|
|
23761
|
+
console.log();
|
|
23762
|
+
console.log(" " + chalk62.dim("Unknown subcommand. Try ") + paint("accent", "/progress") + chalk62.dim(" or ") + paint("accent", "/progress reset") + chalk62.dim("."));
|
|
23763
|
+
console.log();
|
|
23764
|
+
return;
|
|
23765
|
+
}
|
|
23766
|
+
return showProgress();
|
|
23767
|
+
}
|
|
23675
23768
|
var init_progress2 = __esm({
|
|
23676
23769
|
"src/commands/progress.ts"() {
|
|
23677
23770
|
"use strict";
|
|
23771
|
+
init_argparse();
|
|
23772
|
+
init_admin_confirm();
|
|
23773
|
+
init_progress();
|
|
23678
23774
|
init_progress_report();
|
|
23775
|
+
init_theme();
|
|
23679
23776
|
init_time_bank();
|
|
23680
23777
|
}
|
|
23681
23778
|
});
|
|
@@ -24269,11 +24366,13 @@ Export the most recent diagnosis as terminal output, markdown, or JSON. Use
|
|
|
24269
24366
|
name: progress
|
|
24270
24367
|
description: Usage stats and milestone ladder
|
|
24271
24368
|
section: Navigation
|
|
24369
|
+
args: [reset] [--confirm]
|
|
24272
24370
|
handler: ../commands/progress.ts
|
|
24273
24371
|
---
|
|
24274
24372
|
|
|
24275
24373
|
Hours saved, weekly activity trend, session counts, AI token usage, and the
|
|
24276
|
-
full milestone ladder with progress bars
|
|
24374
|
+
full milestone ladder with progress bars. Use reset (type "reset" to confirm)
|
|
24375
|
+
to clear hours and milestones while keeping this install's identity.`
|
|
24277
24376
|
},
|
|
24278
24377
|
{
|
|
24279
24378
|
name: "status",
|
|
@@ -24293,15 +24392,17 @@ diagnosis, if any.`
|
|
|
24293
24392
|
name: scratch
|
|
24294
24393
|
description: Wipe config, profile, and all datasets
|
|
24295
24394
|
section: Admin
|
|
24296
|
-
args: [--confirm]
|
|
24395
|
+
args: [--confirm] [--include-progress]
|
|
24297
24396
|
handler: ../commands/scratch.ts
|
|
24298
24397
|
hidden: true
|
|
24299
24398
|
---
|
|
24300
24399
|
|
|
24301
24400
|
Minimal factory reset: removes API key, config, company profile, all sessions,
|
|
24302
|
-
per-session datasets, and demo taxonomy cache. Preserves progress (hours saved)
|
|
24303
|
-
|
|
24304
|
-
|
|
24401
|
+
per-session datasets, and demo taxonomy cache. Preserves progress (hours saved)
|
|
24402
|
+
by default. Pass \`--include-progress\` to also wipe install identity and hours.
|
|
24403
|
+
Also preserves memory, strategies, wins, knowledge, exports, and audit. Requires
|
|
24404
|
+
typing \`scratch\` in the REPL or passing \`--confirm\` one-shot. Triggers
|
|
24405
|
+
onboarding on next interactive use.`
|
|
24305
24406
|
},
|
|
24306
24407
|
{
|
|
24307
24408
|
name: "cleanup",
|
|
@@ -24532,7 +24633,7 @@ paragraph that flows into all AI surfaces.`
|
|
|
24532
24633
|
});
|
|
24533
24634
|
|
|
24534
24635
|
// src/license/activation.ts
|
|
24535
|
-
import
|
|
24636
|
+
import chalk63 from "chalk";
|
|
24536
24637
|
function hasValidLicense() {
|
|
24537
24638
|
return checkLicense().valid;
|
|
24538
24639
|
}
|
|
@@ -24540,10 +24641,10 @@ async function ensureLicenseActivated(ctx) {
|
|
|
24540
24641
|
if (hasValidLicense()) return false;
|
|
24541
24642
|
if (!process.stdin.isTTY) {
|
|
24542
24643
|
console.error();
|
|
24543
|
-
console.error(
|
|
24544
|
-
console.error(
|
|
24545
|
-
console.error(
|
|
24546
|
-
console.error(
|
|
24644
|
+
console.error(chalk63.red(" A license key is required."));
|
|
24645
|
+
console.error(chalk63.dim(` Sign up: ${getCheckoutUrl()}`));
|
|
24646
|
+
console.error(chalk63.dim(" Then run: ntrp activate <key>"));
|
|
24647
|
+
console.error(chalk63.dim(" Or set NTRP_LICENSE_KEY for headless use."));
|
|
24547
24648
|
console.error();
|
|
24548
24649
|
process.exit(1);
|
|
24549
24650
|
}
|
|
@@ -24553,7 +24654,7 @@ async function ensureLicenseActivated(ctx) {
|
|
|
24553
24654
|
}
|
|
24554
24655
|
printCenteredLogo();
|
|
24555
24656
|
console.log(" " + bold("Activate your license"));
|
|
24556
|
-
console.log(" " +
|
|
24657
|
+
console.log(" " + chalk63.dim("Don't have a key yet? Sign up (free trial or Pro), then paste it below."));
|
|
24557
24658
|
console.log();
|
|
24558
24659
|
await promptOpenCheckout(ctx);
|
|
24559
24660
|
return promptForLicenseKey(ctx);
|
|
@@ -24593,7 +24694,8 @@ var init_gate2 = __esm({
|
|
|
24593
24694
|
"deactivate-demo",
|
|
24594
24695
|
"update",
|
|
24595
24696
|
"upgrade",
|
|
24596
|
-
"checkout"
|
|
24697
|
+
"checkout",
|
|
24698
|
+
"progress"
|
|
24597
24699
|
]);
|
|
24598
24700
|
}
|
|
24599
24701
|
});
|
|
@@ -24603,7 +24705,7 @@ var router_exports = {};
|
|
|
24603
24705
|
__export(router_exports, {
|
|
24604
24706
|
conversationRouter: () => conversationRouter
|
|
24605
24707
|
});
|
|
24606
|
-
import
|
|
24708
|
+
import chalk64 from "chalk";
|
|
24607
24709
|
async function conversationRouter(input, ctx) {
|
|
24608
24710
|
if (ctx.oneShot || (ctx.wizardDepth ?? 0) > 0) {
|
|
24609
24711
|
return { handled: false };
|
|
@@ -24613,7 +24715,7 @@ async function conversationRouter(input, ctx) {
|
|
|
24613
24715
|
if (FRESH_START_RE.test(line)) {
|
|
24614
24716
|
console.log();
|
|
24615
24717
|
console.log(
|
|
24616
|
-
" " +
|
|
24718
|
+
" " + chalk64.dim("Start a fresh analysis? This keeps prior sessions \u2014 say ") + chalk64.cyan("yes") + chalk64.dim(" to confirm or ") + chalk64.cyan("/home") + chalk64.dim(" for the dashboard.")
|
|
24617
24719
|
);
|
|
24618
24720
|
console.log();
|
|
24619
24721
|
return { handled: true };
|
|
@@ -24647,7 +24749,7 @@ async function conversationRouter(input, ctx) {
|
|
|
24647
24749
|
}
|
|
24648
24750
|
if (phase === "compute") {
|
|
24649
24751
|
console.log();
|
|
24650
|
-
console.log(" " +
|
|
24752
|
+
console.log(" " + chalk64.dim("Analysis running \u2014 wait for it to finish before typing another question."));
|
|
24651
24753
|
console.log();
|
|
24652
24754
|
return { handled: true };
|
|
24653
24755
|
}
|
|
@@ -24687,7 +24789,7 @@ var init_router = __esm({
|
|
|
24687
24789
|
});
|
|
24688
24790
|
|
|
24689
24791
|
// src/cli/dispatch.ts
|
|
24690
|
-
import
|
|
24792
|
+
import chalk65 from "chalk";
|
|
24691
24793
|
function printLicenseRequired(command) {
|
|
24692
24794
|
printLicenseBlocked(command);
|
|
24693
24795
|
}
|
|
@@ -24753,7 +24855,7 @@ async function dispatch(input, ctx) {
|
|
|
24753
24855
|
if (tokens.length === 1) {
|
|
24754
24856
|
if (/^\d$/.test(first)) {
|
|
24755
24857
|
console.log(
|
|
24756
|
-
" " +
|
|
24858
|
+
" " + chalk65.dim("Looks like a menu pick \u2014 run ") + paint("accent", "/new") + chalk65.dim(" to start (pick Demo, then choose your analysis type).")
|
|
24757
24859
|
);
|
|
24758
24860
|
return { kind: "handled" };
|
|
24759
24861
|
}
|
|
@@ -24776,19 +24878,19 @@ async function dispatch(input, ctx) {
|
|
|
24776
24878
|
return { kind: "handled", summary };
|
|
24777
24879
|
}
|
|
24778
24880
|
console.log(
|
|
24779
|
-
" " +
|
|
24881
|
+
" " + chalk65.dim("Not in Q&A yet \u2014 confirm scope, load data, and run analysis first. Type ") + paint("accent", "/home") + chalk65.dim(" for status.")
|
|
24780
24882
|
);
|
|
24781
24883
|
return { kind: "handled" };
|
|
24782
24884
|
}
|
|
24783
24885
|
console.log(
|
|
24784
|
-
" " +
|
|
24886
|
+
" " + chalk65.dim("Natural-language questions run in the interactive REPL. Start with ") + paint("accent", "ntrp") + chalk65.dim(" and ask after analysis.")
|
|
24785
24887
|
);
|
|
24786
24888
|
return { kind: "handled" };
|
|
24787
24889
|
}
|
|
24788
24890
|
async function runSlashCommand(name, args, ctx) {
|
|
24789
24891
|
const handler45 = await resolveHandler(name);
|
|
24790
24892
|
if (!handler45) {
|
|
24791
|
-
console.error(
|
|
24893
|
+
console.error(chalk65.red(` Unknown command: /${name}`));
|
|
24792
24894
|
return void 0;
|
|
24793
24895
|
}
|
|
24794
24896
|
const result = await handler45(args, ctx);
|
|
@@ -24820,7 +24922,7 @@ __export(welcome_exports, {
|
|
|
24820
24922
|
GRADIENT: () => GRADIENT,
|
|
24821
24923
|
printWelcome: () => printWelcome
|
|
24822
24924
|
});
|
|
24823
|
-
import
|
|
24925
|
+
import chalk66 from "chalk";
|
|
24824
24926
|
function resolveSessionSummary(input) {
|
|
24825
24927
|
if (input.scope?.intent_summary?.trim()) return input.scope.intent_summary.trim();
|
|
24826
24928
|
if (input.summary?.trim()) return input.summary.trim();
|
|
@@ -24854,19 +24956,19 @@ function sessionSummaryText(s) {
|
|
|
24854
24956
|
summary: s.summary,
|
|
24855
24957
|
dataset: s.dataset
|
|
24856
24958
|
});
|
|
24857
|
-
return summary === NO_SUMMARY ?
|
|
24959
|
+
return summary === NO_SUMMARY ? chalk66.dim(summary) : summary;
|
|
24858
24960
|
}
|
|
24859
24961
|
function formatLastSessionLine(s, colW, ctx, opts) {
|
|
24860
24962
|
const phase = sessionPhaseLabel(s, ctx);
|
|
24861
|
-
const current = opts?.markCurrent && s.id === ctx?.sessionId ?
|
|
24862
|
-
const meta = `${formatSessionId(s.id, s.name)} ${
|
|
24963
|
+
const current = opts?.markCurrent && s.id === ctx?.sessionId ? chalk66.dim(" \xB7 current") : "";
|
|
24964
|
+
const meta = `${formatSessionId(s.id, s.name)} ${chalk66.dim("\xB7")} ${chalk66.dim(lensBadgeLabel(s.analysis))} ${chalk66.dim("\xB7")} ${paint("accent", phase)} ${chalk66.dim("\xB7")} ${sessionSummaryText(s)}${current}`;
|
|
24863
24965
|
return truncateVisible(` ${meta}`, colW);
|
|
24864
24966
|
}
|
|
24865
24967
|
function formatActiveSessionLine(s, colW, ctx, opts) {
|
|
24866
24968
|
const indent = " ";
|
|
24867
24969
|
const idPart = formatSessionId(s.id, s.name);
|
|
24868
|
-
const status =
|
|
24869
|
-
const current = opts?.markCurrent && s.id === ctx?.sessionId ?
|
|
24970
|
+
const status = chalk66.dim(` \xB7 ${sessionStatusSuffix(s)}`);
|
|
24971
|
+
const current = opts?.markCurrent && s.id === ctx?.sessionId ? chalk66.dim(" \xB7 current") : "";
|
|
24870
24972
|
const suffix = `${status}${current}`;
|
|
24871
24973
|
const summaryBudget = Math.max(8, colW - visibleWidth(indent) - visibleWidth(idPart) - visibleWidth(suffix) - 2);
|
|
24872
24974
|
const summaryPart = truncateVisible(sessionSummaryText(s), summaryBudget);
|
|
@@ -24903,13 +25005,13 @@ function buildSystemLines(colW, statusRows, recent) {
|
|
|
24903
25005
|
const lines = [""];
|
|
24904
25006
|
lines.push(sectionHeading("System"));
|
|
24905
25007
|
for (const item of statusRows) {
|
|
24906
|
-
const label =
|
|
25008
|
+
const label = chalk66.dim(padRight(item.label, 8));
|
|
24907
25009
|
const state = padRight(item.state, 10);
|
|
24908
25010
|
const detailW = Math.max(1, colW - 21);
|
|
24909
|
-
lines.push(`${label} ${state} ${
|
|
25011
|
+
lines.push(`${label} ${state} ${chalk66.dim(truncateVisible(item.detail, detailW))}`);
|
|
24910
25012
|
}
|
|
24911
25013
|
if (recent) {
|
|
24912
|
-
lines.push(`${
|
|
25014
|
+
lines.push(`${chalk66.dim(padRight("last used", 8))} ${chalk66.dim(recent)}`);
|
|
24913
25015
|
}
|
|
24914
25016
|
return lines;
|
|
24915
25017
|
}
|
|
@@ -24919,7 +25021,7 @@ function buildHelpLines(colW, unfinishedCount) {
|
|
|
24919
25021
|
lines.push(sectionHeading(section.heading));
|
|
24920
25022
|
for (const entry of section.entries) {
|
|
24921
25023
|
const desc = entry.dynamicDescription ? entry.dynamicDescription(unfinishedCount) : entry.description;
|
|
24922
|
-
const text = ` ${paint("accent", entry.command)} ${
|
|
25024
|
+
const text = ` ${paint("accent", entry.command)} ${chalk66.dim(desc)}`;
|
|
24923
25025
|
lines.push(truncateVisible(text, colW));
|
|
24924
25026
|
}
|
|
24925
25027
|
}
|
|
@@ -24929,10 +25031,10 @@ function buildLastSessionLines(colW, ctx, lastSession, nextAction, emptyDataHint
|
|
|
24929
25031
|
const lines = [""];
|
|
24930
25032
|
lines.push(sectionHeading("Last Session"));
|
|
24931
25033
|
if (!lastSession) {
|
|
24932
|
-
lines.push(` ${
|
|
25034
|
+
lines.push(` ${chalk66.dim("(none yet)")}`);
|
|
24933
25035
|
lines.push(
|
|
24934
25036
|
truncateVisible(
|
|
24935
|
-
` ${nextAction.command ? actionHint(nextAction.label, nextAction.command, nextAction.detail) : `${
|
|
25037
|
+
` ${nextAction.command ? actionHint(nextAction.label, nextAction.command, nextAction.detail) : `${chalk66.dim(nextAction.label)} ${chalk66.dim(nextAction.detail)}`}`,
|
|
24936
25038
|
colW
|
|
24937
25039
|
)
|
|
24938
25040
|
);
|
|
@@ -24943,7 +25045,7 @@ function buildLastSessionLines(colW, ctx, lastSession, nextAction, emptyDataHint
|
|
|
24943
25045
|
if (!isCurrent) {
|
|
24944
25046
|
lines.push(
|
|
24945
25047
|
truncateVisible(
|
|
24946
|
-
` ${
|
|
25048
|
+
` ${chalk66.dim("Resume:")} ${paint("accent", `/session ${lastSession.id.slice(-4)}`)}`,
|
|
24947
25049
|
colW
|
|
24948
25050
|
)
|
|
24949
25051
|
);
|
|
@@ -24952,7 +25054,7 @@ function buildLastSessionLines(colW, ctx, lastSession, nextAction, emptyDataHint
|
|
|
24952
25054
|
truncateVisible(` ${actionHint(nextAction.label, nextAction.command, nextAction.detail)}`, colW)
|
|
24953
25055
|
);
|
|
24954
25056
|
} else {
|
|
24955
|
-
lines.push(truncateVisible(` ${
|
|
25057
|
+
lines.push(truncateVisible(` ${chalk66.dim(nextAction.label)} ${chalk66.dim(nextAction.detail)}`, colW));
|
|
24956
25058
|
}
|
|
24957
25059
|
if (isCurrent && emptyDataHint) {
|
|
24958
25060
|
lines.push(truncateVisible(` ${emptyDataHint}`, colW));
|
|
@@ -24963,14 +25065,14 @@ function buildActiveSessionsLines(colW, ctx, activeSessions) {
|
|
|
24963
25065
|
const lines = [""];
|
|
24964
25066
|
lines.push(sectionHeading("Active Sessions"));
|
|
24965
25067
|
if (activeSessions.length === 0) {
|
|
24966
|
-
lines.push(` ${
|
|
25068
|
+
lines.push(` ${chalk66.dim("(none in progress)")}`);
|
|
24967
25069
|
return lines;
|
|
24968
25070
|
}
|
|
24969
25071
|
for (const s of activeSessions.slice(0, 5)) {
|
|
24970
25072
|
lines.push(formatActiveSessionLine(s, colW, ctx, { markCurrent: true }));
|
|
24971
25073
|
}
|
|
24972
25074
|
if (activeSessions.length > 5) {
|
|
24973
|
-
lines.push(` ${
|
|
25075
|
+
lines.push(` ${chalk66.dim(`+${activeSessions.length - 5} more \xB7 `)}${paint("accent", "/session")}`);
|
|
24974
25076
|
}
|
|
24975
25077
|
return lines;
|
|
24976
25078
|
}
|
|
@@ -24978,7 +25080,7 @@ function buildProgressLines(colW) {
|
|
|
24978
25080
|
const summary = getTimeBankSummary();
|
|
24979
25081
|
const lines = [""];
|
|
24980
25082
|
const heading = sectionHeading("Progress");
|
|
24981
|
-
const hint = `${paint("accent", "/progress")}${
|
|
25083
|
+
const hint = `${paint("accent", "/progress")}${chalk66.dim(" for usage metrics")}`;
|
|
24982
25084
|
const gap = colW - visibleWidth(heading) - visibleWidth(hint);
|
|
24983
25085
|
if (gap > 2) {
|
|
24984
25086
|
lines.push(truncateVisible(`${heading}${" ".repeat(gap)}${hint}`, colW));
|
|
@@ -24988,7 +25090,7 @@ function buildProgressLines(colW) {
|
|
|
24988
25090
|
if (summary.total_minutes <= 0) {
|
|
24989
25091
|
lines.push(
|
|
24990
25092
|
truncateVisible(
|
|
24991
|
-
` ${
|
|
25093
|
+
` ${chalk66.dim("Run /diagnose or ask a question to start banking hours.")}`,
|
|
24992
25094
|
colW
|
|
24993
25095
|
)
|
|
24994
25096
|
);
|
|
@@ -24999,7 +25101,7 @@ function buildProgressLines(colW) {
|
|
|
24999
25101
|
const bar = inlineBar(summary.progress_pct, 16);
|
|
25000
25102
|
lines.push(truncateVisible(` ${bar} ${nextLabel}`, colW));
|
|
25001
25103
|
if (summary.perspective_line) {
|
|
25002
|
-
lines.push(truncateVisible(` ${
|
|
25104
|
+
lines.push(truncateVisible(` ${chalk66.dim.italic(summary.perspective_line)}`, colW));
|
|
25003
25105
|
}
|
|
25004
25106
|
return lines;
|
|
25005
25107
|
}
|
|
@@ -25009,7 +25111,7 @@ async function printWelcome(ctx, version) {
|
|
|
25009
25111
|
const innerW = cardW - 2;
|
|
25010
25112
|
const contentW = innerW - 2;
|
|
25011
25113
|
const outerPad = " ".repeat(Math.max(0, Math.floor((width - cardW) / 2)));
|
|
25012
|
-
const border = (ch) =>
|
|
25114
|
+
const border = (ch) => chalk66.dim(ch);
|
|
25013
25115
|
const push = (line) => console.log(outerPad + line);
|
|
25014
25116
|
const fitCell = (content, width2) => {
|
|
25015
25117
|
if (visibleWidth(content) > width2) return truncateVisible(content, width2);
|
|
@@ -25107,7 +25209,7 @@ async function printWelcome(ctx, version) {
|
|
|
25107
25209
|
ctx,
|
|
25108
25210
|
unfinishedCount: unfinishedSessions.length
|
|
25109
25211
|
});
|
|
25110
|
-
const emptyDataHint = !hasData ? savedSessions.length > 0 ?
|
|
25212
|
+
const emptyDataHint = !hasData ? savedSessions.length > 0 ? chalk66.dim("Run ") + paint("accent", "/session") + chalk66.dim(" to resume a saved analysis, or ") + paint("accent", "/new") + chalk66.dim(" for a fresh start") : chalk66.dim("Run ") + paint("accent", "/new") + chalk66.dim(" \u2192 pick Demo to explore sample data") : null;
|
|
25111
25213
|
const colW = useWideLayout ? leftW : contentW;
|
|
25112
25214
|
const rightColW = useWideLayout ? rightW : contentW;
|
|
25113
25215
|
const systemLines = buildSystemLines(colW, statusRows, recent);
|
|
@@ -25123,14 +25225,14 @@ async function printWelcome(ctx, version) {
|
|
|
25123
25225
|
const logoOffset = " ".repeat(Math.max(0, Math.floor((cardW - maxLogoW) / 2)));
|
|
25124
25226
|
for (const line of logo) push(logoOffset + line);
|
|
25125
25227
|
const taglineOffset = " ".repeat(Math.max(0, Math.floor((cardW - visibleWidth(TAGLINE)) / 2)));
|
|
25126
|
-
push(taglineOffset +
|
|
25228
|
+
push(taglineOffset + chalk66.dim(TAGLINE));
|
|
25127
25229
|
push("");
|
|
25128
25230
|
}
|
|
25129
25231
|
const versionTag = ` v${version} `;
|
|
25130
25232
|
const gap = Math.max(0, innerW - versionTag.length);
|
|
25131
25233
|
const gapL = Math.floor(gap / 2);
|
|
25132
25234
|
push(
|
|
25133
|
-
border(`\u256D${"\u2500".repeat(gapL)}`) +
|
|
25235
|
+
border(`\u256D${"\u2500".repeat(gapL)}`) + chalk66.dim(versionTag) + border(`${"\u2500".repeat(gap - gapL)}\u256E`)
|
|
25134
25236
|
);
|
|
25135
25237
|
if (useWideLayout) {
|
|
25136
25238
|
const leftLines = [...systemLines, ...helpLines];
|
|
@@ -25231,7 +25333,7 @@ __export(repl_exports, {
|
|
|
25231
25333
|
import { createInterface as createInterface2 } from "readline/promises";
|
|
25232
25334
|
import { clearLine as clearLine2, cursorTo as cursorTo2 } from "readline";
|
|
25233
25335
|
import ora16 from "ora";
|
|
25234
|
-
import
|
|
25336
|
+
import chalk67 from "chalk";
|
|
25235
25337
|
function buildPrompt(ctx) {
|
|
25236
25338
|
return buildConversationPrompt(ctx);
|
|
25237
25339
|
}
|
|
@@ -25268,12 +25370,12 @@ function renderInlineSuggestion(rl, prompt) {
|
|
|
25268
25370
|
const suffix = cursor === line.length ? inlineCommandSuggestion(line) : null;
|
|
25269
25371
|
clearLine2(process.stdout, 0);
|
|
25270
25372
|
cursorTo2(process.stdout, 0);
|
|
25271
|
-
process.stdout.write(prompt + line + (suffix ?
|
|
25373
|
+
process.stdout.write(prompt + line + (suffix ? chalk67.dim(suffix) : ""));
|
|
25272
25374
|
cursorTo2(process.stdout, visibleLength(prompt) + cursor);
|
|
25273
25375
|
}
|
|
25274
25376
|
function appendTurnLine(current, promptLabel, currentSummary) {
|
|
25275
|
-
const currentLine = currentSummary ? `${promptLabel} ${current} ${
|
|
25276
|
-
console.log(" " +
|
|
25377
|
+
const currentLine = currentSummary ? `${promptLabel} ${current} ${chalk67.white("\u2192")} ${currentSummary}` : `${promptLabel} ${current}`;
|
|
25378
|
+
console.log(" " + chalk67.dim(currentLine));
|
|
25277
25379
|
console.log();
|
|
25278
25380
|
}
|
|
25279
25381
|
async function goHome(ctx, version, history, opts) {
|
|
@@ -25283,7 +25385,7 @@ async function goHome(ctx, version, history, opts) {
|
|
|
25283
25385
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
25284
25386
|
if (opts?.banner) {
|
|
25285
25387
|
console.log();
|
|
25286
|
-
console.log(" " + paint("accent", "\u2713") + " " +
|
|
25388
|
+
console.log(" " + paint("accent", "\u2713") + " " + chalk67.dim(opts.banner));
|
|
25287
25389
|
}
|
|
25288
25390
|
await printWelcome(ctx, version);
|
|
25289
25391
|
}
|
|
@@ -25306,11 +25408,11 @@ async function handleDispatchResult(result, ctx, version, history) {
|
|
|
25306
25408
|
case "unknown":
|
|
25307
25409
|
if (result.suggestion) {
|
|
25308
25410
|
console.log(
|
|
25309
|
-
" " +
|
|
25411
|
+
" " + chalk67.red(`Unknown command: ${result.token}.`) + chalk67.dim(" Did you mean ") + paint("accent", result.suggestion) + chalk67.dim("?")
|
|
25310
25412
|
);
|
|
25311
25413
|
} else {
|
|
25312
25414
|
console.log(
|
|
25313
|
-
" " +
|
|
25415
|
+
" " + chalk67.red(`Unknown command: ${result.token}`) + chalk67.dim(" Type ") + paint("accent", "/help") + chalk67.dim(" to see available commands.")
|
|
25314
25416
|
);
|
|
25315
25417
|
}
|
|
25316
25418
|
break;
|
|
@@ -25334,7 +25436,7 @@ async function runRepl(ctx, version) {
|
|
|
25334
25436
|
ctx.rl = rl;
|
|
25335
25437
|
console.log();
|
|
25336
25438
|
console.log(
|
|
25337
|
-
" " +
|
|
25439
|
+
" " + chalk67.dim("What do you want to look at? ") + chalk67.dim('(e.g. "pipeline health", "is NRR real?", "board deck on Q3")')
|
|
25338
25440
|
);
|
|
25339
25441
|
console.log();
|
|
25340
25442
|
if (ctx.pendingUpdateCheck) {
|
|
@@ -25364,7 +25466,7 @@ async function runRepl(ctx, version) {
|
|
|
25364
25466
|
return;
|
|
25365
25467
|
}
|
|
25366
25468
|
sigintPrimed = true;
|
|
25367
|
-
console.log("\n " +
|
|
25469
|
+
console.log("\n " + chalk67.dim("Type /exit to quit, or press Ctrl+C again."));
|
|
25368
25470
|
};
|
|
25369
25471
|
rl.on("SIGINT", sigintHandler);
|
|
25370
25472
|
function shutdownRepl() {
|
|
@@ -25435,7 +25537,7 @@ async function runRepl(ctx, version) {
|
|
|
25435
25537
|
}
|
|
25436
25538
|
}
|
|
25437
25539
|
} else {
|
|
25438
|
-
console.error(" " +
|
|
25540
|
+
console.error(" " + chalk67.red("Error: " + String(err.message ?? err)));
|
|
25439
25541
|
}
|
|
25440
25542
|
}
|
|
25441
25543
|
history.push({ input: line, summary });
|
|
@@ -25453,7 +25555,7 @@ async function runRepl(ctx, version) {
|
|
|
25453
25555
|
} else {
|
|
25454
25556
|
await closeSession(ctx);
|
|
25455
25557
|
}
|
|
25456
|
-
console.log(" " +
|
|
25558
|
+
console.log(" " + chalk67.dim(randomGoodbye()));
|
|
25457
25559
|
}
|
|
25458
25560
|
function printHelpOneShot() {
|
|
25459
25561
|
printHelp();
|
|
@@ -25461,10 +25563,10 @@ function printHelpOneShot() {
|
|
|
25461
25563
|
function printHelp() {
|
|
25462
25564
|
console.log();
|
|
25463
25565
|
console.log(" " + sectionHeading("Conversation"));
|
|
25464
|
-
console.log(" " +
|
|
25465
|
-
console.log(" " +
|
|
25466
|
-
console.log(" " +
|
|
25467
|
-
console.log(" " +
|
|
25566
|
+
console.log(" " + chalk67.dim("Type what you want to investigate \u2014 no slash needed."));
|
|
25567
|
+
console.log(" " + chalk67.dim("Paste a CSV path or say ") + paint("accent", '"use demo data"') + chalk67.dim(" to load data."));
|
|
25568
|
+
console.log(" " + chalk67.dim("After analysis, ask questions in plain English."));
|
|
25569
|
+
console.log(" " + chalk67.dim("Say ") + paint("accent", '"ship a board deck"') + chalk67.dim(" to draft a handoff prompt."));
|
|
25468
25570
|
console.log();
|
|
25469
25571
|
console.log(" " + sectionHeading("Shortcuts"));
|
|
25470
25572
|
const shortcuts = [
|
|
@@ -25479,21 +25581,21 @@ function printHelp() {
|
|
|
25479
25581
|
];
|
|
25480
25582
|
const maxW = Math.max(...shortcuts.map(([c]) => c.length)) + 2;
|
|
25481
25583
|
for (const [cmd, desc] of shortcuts) {
|
|
25482
|
-
console.log(` ${paint("accent", padRight(cmd, maxW))} ${
|
|
25584
|
+
console.log(` ${paint("accent", padRight(cmd, maxW))} ${chalk67.dim(desc)}`);
|
|
25483
25585
|
}
|
|
25484
25586
|
console.log();
|
|
25485
25587
|
console.log(" " + sectionHeading("Admin"));
|
|
25486
25588
|
const admin = [
|
|
25487
|
-
["/scratch", "Wipe config, profile, and datasets"],
|
|
25589
|
+
["/scratch", "Wipe config, profile, and datasets (--include-progress to wipe hours)"],
|
|
25488
25590
|
["/cleanup", "Close all active sessions"],
|
|
25489
25591
|
["/deactivate-demo", "Disable demo data generators"]
|
|
25490
25592
|
];
|
|
25491
25593
|
const adminMaxW = Math.max(...admin.map(([c]) => c.length)) + 2;
|
|
25492
25594
|
for (const [cmd, desc] of admin) {
|
|
25493
|
-
console.log(` ${paint("accent", padRight(cmd, adminMaxW))} ${
|
|
25595
|
+
console.log(` ${paint("accent", padRight(cmd, adminMaxW))} ${chalk67.dim(desc)}`);
|
|
25494
25596
|
}
|
|
25495
25597
|
console.log();
|
|
25496
|
-
console.log(" " +
|
|
25598
|
+
console.log(" " + chalk67.dim("Power-user commands (") + paint("accent", "/new") + chalk67.dim(", ") + paint("accent", "/diagnose") + chalk67.dim(", ") + paint("accent", "/metrics") + chalk67.dim(") remain available."));
|
|
25497
25599
|
console.log();
|
|
25498
25600
|
}
|
|
25499
25601
|
var REPL_BUILTINS, ANSI_PATTERN, GOODBYES;
|
|
@@ -25576,7 +25678,7 @@ init_emit();
|
|
|
25576
25678
|
init_errors2();
|
|
25577
25679
|
init_types2();
|
|
25578
25680
|
init_version();
|
|
25579
|
-
import
|
|
25681
|
+
import chalk68 from "chalk";
|
|
25580
25682
|
var VERSION = getInstalledVersion();
|
|
25581
25683
|
var UNGATED = UNGATED_COMMANDS;
|
|
25582
25684
|
var DB_COMMANDS = /* @__PURE__ */ new Set(["actions", "ask", "backmeup", "demo", "diagnose", "export", "handoff", "ingest", "metrics", "new", "playbook", "publish", "report", "reset", "segment", "session", "status", "strategy"]);
|
|
@@ -25603,7 +25705,7 @@ async function main() {
|
|
|
25603
25705
|
quiet: args.globals.quiet
|
|
25604
25706
|
});
|
|
25605
25707
|
if (!ctx.execution.color) {
|
|
25606
|
-
|
|
25708
|
+
chalk68.level = 0;
|
|
25607
25709
|
}
|
|
25608
25710
|
if (args.globals.stdin) {
|
|
25609
25711
|
args.input = (await readStdin()).trim();
|
|
@@ -25616,16 +25718,16 @@ async function main() {
|
|
|
25616
25718
|
if (isStructuredOutput(ctx.execution)) {
|
|
25617
25719
|
emitError(cmd || "ntrp", new NtrpError("license_invalid", lic2.message, 3 /* Auth */));
|
|
25618
25720
|
}
|
|
25619
|
-
console.error(
|
|
25721
|
+
console.error(chalk68.red(`
|
|
25620
25722
|
${lic2.message}`));
|
|
25621
|
-
console.error(
|
|
25723
|
+
console.error(chalk68.dim(" Trial's over \u2014 /upgrade and paste your key.\n"));
|
|
25622
25724
|
process.exit(1);
|
|
25623
25725
|
}
|
|
25624
25726
|
}
|
|
25625
|
-
const PROFILE_HINT_SKIP = /* @__PURE__ */ new Set(["onboard", "setup", "config", "activate", "help", "home", "exit", "quit", "clear", "profile"]);
|
|
25727
|
+
const PROFILE_HINT_SKIP = /* @__PURE__ */ new Set(["onboard", "setup", "config", "activate", "help", "home", "exit", "quit", "clear", "profile", "progress"]);
|
|
25626
25728
|
if (!isProfileConfigured() && !PROFILE_HINT_SKIP.has(cmd) && !ctx.execution.quiet) {
|
|
25627
25729
|
console.error(
|
|
25628
|
-
" " +
|
|
25730
|
+
" " + chalk68.dim("Tip: run ") + paint("accent", "ntrp") + chalk68.dim(" interactively to set up your company profile for richer answers.")
|
|
25629
25731
|
);
|
|
25630
25732
|
}
|
|
25631
25733
|
const result = await dispatch(args.input, ctx);
|
|
@@ -25637,12 +25739,12 @@ async function main() {
|
|
|
25637
25739
|
}
|
|
25638
25740
|
if (result.suggestion) {
|
|
25639
25741
|
console.error(
|
|
25640
|
-
|
|
25742
|
+
chalk68.red(` Unknown command: ${result.token}.`) + chalk68.dim(" Did you mean ") + paint("accent", result.suggestion) + chalk68.dim("?")
|
|
25641
25743
|
);
|
|
25642
25744
|
} else {
|
|
25643
|
-
console.error(
|
|
25745
|
+
console.error(chalk68.red(` Unknown command: ${result.token}`));
|
|
25644
25746
|
}
|
|
25645
|
-
console.error(
|
|
25747
|
+
console.error(chalk68.dim(" Run 'ntrp' for the interactive prompt."));
|
|
25646
25748
|
process.exit(1);
|
|
25647
25749
|
break;
|
|
25648
25750
|
case "help":
|