@sonnechasser/ntrp 2.1.12 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -33264,6 +33264,7 @@ var init_smoke_protocol = __esm({
33264
33264
  // src/cli/nl.ts
33265
33265
  var nl_exports = {};
33266
33266
  __export(nl_exports, {
33267
+ runExploreExpandAnswer: () => runExploreExpandAnswer,
33267
33268
  runNaturalLanguage: () => runNaturalLanguage
33268
33269
  });
33269
33270
  import chalk31 from "chalk";
@@ -33271,16 +33272,16 @@ async function runNaturalLanguage(input, ctx) {
33271
33272
  if (isSmokeProtocolTrigger(input)) {
33272
33273
  recordMessage(ctx, "user", input);
33273
33274
  console.log();
33274
- const spinner2 = makeSpinner("Running smoke protocol\u2026");
33275
+ const spinner = makeSpinner("Running smoke protocol\u2026");
33275
33276
  try {
33276
33277
  const result = await runSmokeProtocol(input, ctx);
33277
- spinner2.succeed("Smoke protocol complete");
33278
+ spinner.succeed("Smoke protocol complete");
33278
33279
  printAnswer(result.answer);
33279
33280
  recordMessage(ctx, "agent", result.answer);
33280
33281
  console.log();
33281
33282
  return extractSummary2(result.answer);
33282
33283
  } catch (err) {
33283
- spinner2.fail("Smoke protocol failed");
33284
+ spinner.fail("Smoke protocol failed");
33284
33285
  console.error(" " + chalk31.red(String(err.message ?? err)));
33285
33286
  console.log();
33286
33287
  return;
@@ -33295,6 +33296,22 @@ async function runNaturalLanguage(input, ctx) {
33295
33296
  return;
33296
33297
  }
33297
33298
  recordMessage(ctx, "user", input);
33299
+ const responseMode = resolveExploreResponseMode(input, ctx, ctx.conversation.length);
33300
+ return runExploreAgent(ctx, {
33301
+ userQuestion: input,
33302
+ responseMode,
33303
+ showExpandHint: responseMode === "brief"
33304
+ });
33305
+ }
33306
+ async function runExploreExpandAnswer(ctx, question) {
33307
+ return runExploreAgent(ctx, {
33308
+ userQuestion: question,
33309
+ responseMode: "deep",
33310
+ showExpandHint: false
33311
+ });
33312
+ }
33313
+ async function runExploreAgent(ctx, opts) {
33314
+ const { userQuestion, responseMode, showExpandHint } = opts;
33298
33315
  let snapshot = ctx.snapshot.computeResult;
33299
33316
  if (!snapshot) {
33300
33317
  const metricsFirst = prefersMetricsFirstContext(ctx);
@@ -33311,7 +33328,7 @@ async function runNaturalLanguage(input, ctx) {
33311
33328
  }
33312
33329
  }
33313
33330
  console.log();
33314
- const memoryBlock = await buildMemoryBlock(input).catch((err) => {
33331
+ const memoryBlock = await buildMemoryBlock(userQuestion).catch((err) => {
33315
33332
  debugError("nl.buildMemoryBlock", err);
33316
33333
  return "";
33317
33334
  });
@@ -33322,13 +33339,12 @@ async function runNaturalLanguage(input, ctx) {
33322
33339
  setAgentContext(ctx);
33323
33340
  try {
33324
33341
  const analysisBlock = buildAnalysisBlock(ctx);
33325
- const responseMode = resolveExploreResponseMode(input, ctx, ctx.conversation.length);
33326
33342
  const conversationBlock = getConversationPhaseBlock(ctx, { responseMode });
33327
33343
  const bundle = await loadSessionAnalysisBundle();
33328
33344
  const sessionArtifact = hasAnyAnalysis(bundle) ? buildExploreContextBlock(bundle, ctx) : "";
33329
33345
  for await (const event of agenticFindings(snapshot, ctx.snapshot.divergences, {
33330
33346
  mode: "fresh",
33331
- userQuestion: input,
33347
+ userQuestion,
33332
33348
  sessionContext: ctx.resumedSessionSummary,
33333
33349
  includeMetrics: true,
33334
33350
  analysisBlock,
@@ -33369,7 +33385,7 @@ async function runNaturalLanguage(input, ctx) {
33369
33385
  const { isLlmAuthError: isLlmAuthError2 } = await Promise.resolve().then(() => (init_errors2(), errors_exports2));
33370
33386
  if (isLlmAuthError2(err)) {
33371
33387
  const { queuePendingAsk: queuePendingAsk2 } = await Promise.resolve().then(() => (init_pending_ask(), pending_ask_exports));
33372
- if (!ctx.pendingAsk) queuePendingAsk2(ctx, input, "explore");
33388
+ if (!ctx.pendingAsk) queuePendingAsk2(ctx, userQuestion, "explore");
33373
33389
  const { recoverFromAuthFailure: recoverFromAuthFailure2 } = await Promise.resolve().then(() => (init_auth_recovery(), auth_recovery_exports));
33374
33390
  await recoverFromAuthFailure2(ctx, err);
33375
33391
  return;
@@ -33394,8 +33410,18 @@ async function runNaturalLanguage(input, ctx) {
33394
33410
  saveSessionState(ctx);
33395
33411
  }
33396
33412
  creditNlAnswer(ctx, Math.floor(ctx.messages.length / 2));
33397
- recordAnalysis({ question: input, answer: lastAnswer, tools: toolsUsed, session_id: ctx.sessionId });
33398
- ctx.lastExchange = { question: input, answer: lastAnswer };
33413
+ recordAnalysis({
33414
+ question: userQuestion,
33415
+ answer: lastAnswer,
33416
+ tools: toolsUsed,
33417
+ session_id: ctx.sessionId
33418
+ });
33419
+ ctx.lastExchange = { question: userQuestion, answer: lastAnswer, mode: responseMode };
33420
+ if (showExpandHint) {
33421
+ console.log(
33422
+ " " + chalk31.dim("Type ") + chalk31.cyan("expand") + chalk31.dim(" for more reasoning.")
33423
+ );
33424
+ }
33399
33425
  }
33400
33426
  console.log();
33401
33427
  const { promptQueuedAiStrategist: promptQueuedAiStrategist2 } = await Promise.resolve().then(() => (init_strategist_flow(), strategist_flow_exports));
@@ -45975,12 +46001,68 @@ var init_gate2 = __esm({
45975
46001
  }
45976
46002
  });
45977
46003
 
46004
+ // src/conversation/explore-expand.ts
46005
+ import chalk92 from "chalk";
46006
+ function isExploreExpandInput(input) {
46007
+ return /^expand\s*[.!]?\s*$/i.test(input.trim());
46008
+ }
46009
+ function resolveExploreExpand(lastExchange) {
46010
+ const question = lastExchange?.question?.trim();
46011
+ if (!question) return { kind: "ask_first" };
46012
+ if (lastExchange?.mode === "deep") return { kind: "already_deep" };
46013
+ return { kind: "run", question };
46014
+ }
46015
+ async function handleExploreExpand(ctx, line) {
46016
+ const trimmed = line.trim();
46017
+ recordMessage(ctx, "user", trimmed);
46018
+ const decision = resolveExploreExpand(ctx.lastExchange);
46019
+ if (decision.kind === "ask_first") {
46020
+ console.log();
46021
+ console.log(" " + chalk92.dim(EXPLORE_EXPAND_ASK_FIRST));
46022
+ console.log();
46023
+ recordMessage(ctx, "agent", EXPLORE_EXPAND_ASK_FIRST);
46024
+ return EXPLORE_EXPAND_ASK_FIRST;
46025
+ }
46026
+ if (decision.kind === "already_deep") {
46027
+ console.log();
46028
+ console.log(" " + chalk92.dim(EXPLORE_EXPAND_ALREADY_DEEP));
46029
+ console.log();
46030
+ recordMessage(ctx, "agent", EXPLORE_EXPAND_ALREADY_DEEP);
46031
+ return EXPLORE_EXPAND_ALREADY_DEEP;
46032
+ }
46033
+ const runner = expandRunnerForTests;
46034
+ if (!runner && !canUseReplAi(ctx)) {
46035
+ console.log();
46036
+ console.log(
46037
+ " " + chalk92.dim("Type ") + chalk92.cyan("/connect") + chalk92.dim(" to connect a key. Then type expand.")
46038
+ );
46039
+ console.log();
46040
+ recordMessage(ctx, "agent", "Expand needs a key");
46041
+ return "Expand needs a key";
46042
+ }
46043
+ const run2 = runner ?? (await Promise.resolve().then(() => (init_nl(), nl_exports))).runExploreExpandAnswer;
46044
+ const summary = await run2(ctx, decision.question);
46045
+ saveSessionState(ctx);
46046
+ return typeof summary === "string" ? summary : "Expanded answer";
46047
+ }
46048
+ var EXPLORE_EXPAND_ASK_FIRST, EXPLORE_EXPAND_ALREADY_DEEP, expandRunnerForTests;
46049
+ var init_explore_expand = __esm({
46050
+ "src/conversation/explore-expand.ts"() {
46051
+ "use strict";
46052
+ init_repl_api();
46053
+ init_context2();
46054
+ EXPLORE_EXPAND_ASK_FIRST = "Ask a question first.";
46055
+ EXPLORE_EXPAND_ALREADY_DEEP = "Already the long version.";
46056
+ expandRunnerForTests = null;
46057
+ }
46058
+ });
46059
+
45978
46060
  // src/conversation/router.ts
45979
46061
  var router_exports = {};
45980
46062
  __export(router_exports, {
45981
46063
  conversationRouter: () => conversationRouter
45982
46064
  });
45983
- import chalk92 from "chalk";
46065
+ import chalk93 from "chalk";
45984
46066
  function popModalState(ctx) {
45985
46067
  const popped = [];
45986
46068
  if (ctx.strategistState) {
@@ -46013,7 +46095,7 @@ function handleBackNavigation(ctx, line) {
46013
46095
  }
46014
46096
  if (phase === "scope") {
46015
46097
  console.log();
46016
- console.log(" " + chalk92.dim("What should we focus on instead?"));
46098
+ console.log(" " + chalk93.dim("What should we focus on instead?"));
46017
46099
  ctx.scope = void 0;
46018
46100
  clearPendingAsk(ctx);
46019
46101
  saveSessionState(ctx);
@@ -46033,7 +46115,7 @@ function handleBackNavigation(ctx, line) {
46033
46115
  printScopeProposal(ctx);
46034
46116
  if (hadData || hadAnalysis) {
46035
46117
  console.log(
46036
- " " + chalk92.dim(
46118
+ " " + chalk93.dim(
46037
46119
  "Focus gate rewound \u2014 loaded data and any analysis stay. `b` does not unload demo data or undo compute."
46038
46120
  )
46039
46121
  );
@@ -46049,7 +46131,7 @@ function handleBackNavigation(ctx, line) {
46049
46131
  recordMessage(ctx, "user", line);
46050
46132
  recordMessage(ctx, "agent", "Strategy objective adjust (back)");
46051
46133
  console.log();
46052
- console.log(" " + chalk92.dim("What is the objective? State a finish line."));
46134
+ console.log(" " + chalk93.dim("What is the objective? State a finish line."));
46053
46135
  console.log();
46054
46136
  return { handled: true, summary: "Awaiting objective" };
46055
46137
  }
@@ -46061,7 +46143,7 @@ function handleBackNavigation(ctx, line) {
46061
46143
  const backTo = formatPhaseLabel(resolveConversationPhase(ctx));
46062
46144
  console.log();
46063
46145
  console.log(
46064
- " " + chalk92.dim(`Back \u2014 dropped ${popped.join(" and ")}. At `) + chalk92.cyan(backTo) + chalk92.dim(".")
46146
+ " " + chalk93.dim(`Back \u2014 dropped ${popped.join(" and ")}. At `) + chalk93.cyan(backTo) + chalk93.dim(".")
46065
46147
  );
46066
46148
  console.log();
46067
46149
  return { handled: true, summary: "Back" };
@@ -46075,7 +46157,7 @@ function handleBackNavigation(ctx, line) {
46075
46157
  const backTo = formatPhaseLabel(resolveConversationPhase(ctx));
46076
46158
  console.log();
46077
46159
  console.log(
46078
- " " + chalk92.dim(`Back \u2014 dropped ${popped.join(" and ")}. At `) + chalk92.cyan(backTo) + chalk92.dim(".")
46160
+ " " + chalk93.dim(`Back \u2014 dropped ${popped.join(" and ")}. At `) + chalk93.cyan(backTo) + chalk93.dim(".")
46079
46161
  );
46080
46162
  console.log();
46081
46163
  return { handled: true, summary: "Back" };
@@ -46089,6 +46171,9 @@ function handleBriefExpand(ctx, line) {
46089
46171
  if (phase === "scope" || phase === "awaiting_data" || phase === "strategize" || phase === "think" || phase === "deliver") {
46090
46172
  return null;
46091
46173
  }
46174
+ if (phase === "explore" && isExploreExpandInput(line) && ctx.lastExchange?.question) {
46175
+ return null;
46176
+ }
46092
46177
  recordMessage(ctx, "user", line);
46093
46178
  expandLastStrategyBrief(ctx);
46094
46179
  recordMessage(ctx, "agent", "Full strategy brief");
@@ -46116,7 +46201,7 @@ async function conversationRouter(input, ctx) {
46116
46201
  if (!ok) {
46117
46202
  console.log();
46118
46203
  console.log(
46119
- " " + chalk92.dim("Staying on this session. Type ") + chalk92.cyan("/home") + chalk92.dim(" for the dashboard.")
46204
+ " " + chalk93.dim("Staying on this session. Type ") + chalk93.cyan("/home") + chalk93.dim(" for the dashboard.")
46120
46205
  );
46121
46206
  console.log();
46122
46207
  return { handled: true };
@@ -46131,7 +46216,7 @@ async function conversationRouter(input, ctx) {
46131
46216
  }
46132
46217
  console.log();
46133
46218
  console.log(
46134
- " " + chalk92.dim("Start a fresh analysis with ") + chalk92.cyan("/new") + chalk92.dim(" \u2014 or ") + chalk92.cyan("/home") + chalk92.dim(" for the dashboard.")
46219
+ " " + chalk93.dim("Start a fresh analysis with ") + chalk93.cyan("/new") + chalk93.dim(" \u2014 or ") + chalk93.cyan("/home") + chalk93.dim(" for the dashboard.")
46135
46220
  );
46136
46221
  console.log();
46137
46222
  return { handled: true };
@@ -46145,7 +46230,7 @@ async function conversationRouter(input, ctx) {
46145
46230
  const backTo = formatPhaseLabel(resolveConversationPhase(ctx));
46146
46231
  console.log();
46147
46232
  console.log(
46148
- " " + chalk92.dim(`Cancelled \u2014 dropped ${popped.join(" and ")}. Back to `) + chalk92.cyan(backTo) + chalk92.dim(".")
46233
+ " " + chalk93.dim(`Cancelled \u2014 dropped ${popped.join(" and ")}. Back to `) + chalk93.cyan(backTo) + chalk93.dim(".")
46149
46234
  );
46150
46235
  console.log();
46151
46236
  return { handled: true, summary: "Cancelled" };
@@ -46227,7 +46312,7 @@ async function conversationRouter(input, ctx) {
46227
46312
  }
46228
46313
  if (phase === "compute") {
46229
46314
  console.log();
46230
- console.log(" " + chalk92.dim("Analysis running \u2014 wait for it to finish before typing another question."));
46315
+ console.log(" " + chalk93.dim("Analysis running \u2014 wait for it to finish before typing another question."));
46231
46316
  console.log();
46232
46317
  return { handled: true };
46233
46318
  }
@@ -46240,6 +46325,10 @@ async function conversationRouter(input, ctx) {
46240
46325
  return { handled: true, summary };
46241
46326
  }
46242
46327
  if (phase === "explore") {
46328
+ if (isExploreExpandInput(line)) {
46329
+ const summary = await handleExploreExpand(ctx, line);
46330
+ return { handled: true, summary };
46331
+ }
46243
46332
  if (!canUseReplAi(ctx)) {
46244
46333
  await handleExploreWithoutKey(ctx, line);
46245
46334
  return { handled: true };
@@ -46267,6 +46356,7 @@ var init_router = __esm({
46267
46356
  init_scope();
46268
46357
  init_pending_ask();
46269
46358
  init_strategy_brief();
46359
+ init_explore_expand();
46270
46360
  FRESH_START_RE = /\b(start (over|fresh)|new analysis|start again|reset session)\b/i;
46271
46361
  CANCEL_ESCAPE_RE = /^(cancel|stop|abort|quit|never\s?mind|nevermind|forget it)\s*[.!]?\s*$/i;
46272
46362
  }
@@ -46278,7 +46368,7 @@ __export(dispatch_exports, {
46278
46368
  dispatch: () => dispatch,
46279
46369
  replayPendingBlockedLine: () => replayPendingBlockedLine
46280
46370
  });
46281
- import chalk93 from "chalk";
46371
+ import chalk94 from "chalk";
46282
46372
  function printLicenseRequired(command) {
46283
46373
  printLicenseBlocked(command);
46284
46374
  }
@@ -46296,7 +46386,7 @@ async function replayPendingBlockedLine(ctx) {
46296
46386
  if (!hasValidLicense()) return false;
46297
46387
  ctx.pendingBlockedLine = void 0;
46298
46388
  console.log();
46299
- console.log(" " + chalk93.dim("Picking up where you left off\u2026"));
46389
+ console.log(" " + chalk94.dim("Picking up where you left off\u2026"));
46300
46390
  console.log();
46301
46391
  await dispatch(line, ctx);
46302
46392
  return true;
@@ -46366,7 +46456,7 @@ async function dispatch(input, ctx) {
46366
46456
  if (tokens.length === 1) {
46367
46457
  if (/^\d$/.test(first)) {
46368
46458
  console.log(
46369
- " " + chalk93.dim("Looks like a menu pick \u2014 run ") + paint("accent", "/new") + chalk93.dim(" to start (pick Demo, then choose your analysis type).")
46459
+ " " + chalk94.dim("Looks like a menu pick \u2014 run ") + paint("accent", "/new") + chalk94.dim(" to start (pick Demo, then choose your analysis type).")
46370
46460
  );
46371
46461
  return { kind: "handled" };
46372
46462
  }
@@ -46389,19 +46479,19 @@ async function dispatch(input, ctx) {
46389
46479
  return { kind: "handled", summary };
46390
46480
  }
46391
46481
  console.log(
46392
- " " + chalk93.dim("Not in Q&A yet. Confirm the scope, load data, and run analysis first. Type ") + paint("accent", "/home") + chalk93.dim(" for status.")
46482
+ " " + chalk94.dim("Not in Q&A yet. Confirm the scope, load data, and run analysis first. Type ") + paint("accent", "/home") + chalk94.dim(" for status.")
46393
46483
  );
46394
46484
  return { kind: "handled" };
46395
46485
  }
46396
46486
  console.log(
46397
- " " + chalk93.dim("Natural-language questions run inside ntrp. Start with ") + paint("accent", "ntrp") + chalk93.dim(" and type a question after analysis.")
46487
+ " " + chalk94.dim("Natural-language questions run inside ntrp. Start with ") + paint("accent", "ntrp") + chalk94.dim(" and type a question after analysis.")
46398
46488
  );
46399
46489
  return { kind: "handled" };
46400
46490
  }
46401
46491
  async function runSlashCommand(name, args, ctx) {
46402
46492
  const handler53 = await resolveHandler(name);
46403
46493
  if (!handler53) {
46404
- console.error(chalk93.red(` Unknown command: /${name}`));
46494
+ console.error(chalk94.red(` Unknown command: /${name}`));
46405
46495
  return void 0;
46406
46496
  }
46407
46497
  const result = await handler53(args, ctx);
@@ -46438,7 +46528,7 @@ var init_inline_suggestion = __esm({
46438
46528
  });
46439
46529
 
46440
46530
  // src/conversation/loop-guard.ts
46441
- import chalk94 from "chalk";
46531
+ import chalk95 from "chalk";
46442
46532
  function createLoopGuardState() {
46443
46533
  return { phase: null, stuckTurns: 0 };
46444
46534
  }
@@ -46470,10 +46560,10 @@ function printLoopEscalation(phase) {
46470
46560
  if (!guide) return;
46471
46561
  console.log();
46472
46562
  console.log(
46473
- " " + chalk94.yellow("We seem to be going in circles \u2014 you're in ") + paint("accent", guide.mode) + chalk94.yellow(" mode.")
46563
+ " " + chalk95.yellow("We seem to be going in circles \u2014 you're in ") + paint("accent", guide.mode) + chalk95.yellow(" mode.")
46474
46564
  );
46475
- console.log(" " + chalk94.dim("Right now I can only accept: ") + guide.accepts);
46476
- console.log(" " + chalk94.dim("To leave: ") + guide.leave);
46565
+ console.log(" " + chalk95.dim("Right now I can only accept: ") + guide.accepts);
46566
+ console.log(" " + chalk95.dim("To leave: ") + guide.leave);
46477
46567
  console.log();
46478
46568
  }
46479
46569
  var LOOP_GUARD_THRESHOLD, MODAL_PHASES, PHASE_GUIDES;
@@ -46517,7 +46607,7 @@ __export(welcome_exports, {
46517
46607
  resolveWelcomeNextAction: () => resolveWelcomeNextAction,
46518
46608
  staleProcessHomeNotice: () => staleProcessHomeNotice
46519
46609
  });
46520
- import chalk95 from "chalk";
46610
+ import chalk96 from "chalk";
46521
46611
  function formatHomeEntityCounts(counts) {
46522
46612
  const parts = [];
46523
46613
  const people = counts.people ?? 0;
@@ -46531,11 +46621,11 @@ function formatHomeEntityCounts(counts) {
46531
46621
  return parts.join(" \xB7 ");
46532
46622
  }
46533
46623
  function formatEmptyDataHomeHint(savedSessionCount, opts = {}) {
46534
- const onboard = opts.includeOnboard === true ? chalk95.dim(", or ") + paint("accent", "/onboard") + chalk95.dim(" to calibrate") : "";
46624
+ const onboard = opts.includeOnboard === true ? chalk96.dim(", or ") + paint("accent", "/onboard") + chalk96.dim(" to calibrate") : "";
46535
46625
  if (savedSessionCount > 0) {
46536
- return chalk95.dim("Type ") + paint("accent", "use demo data") + chalk95.dim(" to load a sample") + onboard + chalk95.dim(". Type ") + paint("accent", "/session") + chalk95.dim(" to open a saved session");
46626
+ return chalk96.dim("Type ") + paint("accent", "use demo data") + chalk96.dim(" to load a sample") + onboard + chalk96.dim(". Type ") + paint("accent", "/session") + chalk96.dim(" to open a saved session");
46537
46627
  }
46538
- return chalk95.dim("Type ") + paint("accent", "use demo data") + chalk95.dim(" to load a sample pipeline") + onboard;
46628
+ return chalk96.dim("Type ") + paint("accent", "use demo data") + chalk96.dim(" to load a sample pipeline") + onboard;
46539
46629
  }
46540
46630
  function staleProcessHomeNotice() {
46541
46631
  const running = getInstalledVersion();
@@ -46577,19 +46667,19 @@ function sessionSummaryText(s) {
46577
46667
  summary: s.summary,
46578
46668
  dataset: s.dataset
46579
46669
  });
46580
- return summary === NO_SUMMARY ? chalk95.dim(summary) : summary;
46670
+ return summary === NO_SUMMARY ? chalk96.dim(summary) : summary;
46581
46671
  }
46582
46672
  function formatLastSessionLine(s, colW, ctx, opts) {
46583
46673
  const phase = sessionPhaseLabel(s, ctx);
46584
- const current = opts?.markCurrent && s.id === ctx?.sessionId ? chalk95.dim(" \xB7 current") : "";
46585
- const meta = `${formatSessionId(s.id, s.name)} ${chalk95.dim("\xB7")} ${chalk95.dim(lensBadgeLabel(s.analysis))} ${chalk95.dim("\xB7")} ${paint("accent", phase)} ${chalk95.dim("\xB7")} ${sessionSummaryText(s)}${current}`;
46674
+ const current = opts?.markCurrent && s.id === ctx?.sessionId ? chalk96.dim(" \xB7 current") : "";
46675
+ const meta = `${formatSessionId(s.id, s.name)} ${chalk96.dim("\xB7")} ${chalk96.dim(lensBadgeLabel(s.analysis))} ${chalk96.dim("\xB7")} ${paint("accent", phase)} ${chalk96.dim("\xB7")} ${sessionSummaryText(s)}${current}`;
46586
46676
  return truncateVisible(` ${meta}`, colW);
46587
46677
  }
46588
46678
  function formatActiveSessionLine(s, colW, ctx, opts) {
46589
46679
  const indent = " ";
46590
46680
  const idPart = formatSessionId(s.id, s.name);
46591
- const status = chalk95.dim(` \xB7 ${sessionStatusSuffix(s)}`);
46592
- const current = opts?.markCurrent && s.id === ctx?.sessionId ? chalk95.dim(" \xB7 current") : "";
46681
+ const status = chalk96.dim(` \xB7 ${sessionStatusSuffix(s)}`);
46682
+ const current = opts?.markCurrent && s.id === ctx?.sessionId ? chalk96.dim(" \xB7 current") : "";
46593
46683
  const suffix = `${status}${current}`;
46594
46684
  const summaryBudget = Math.max(8, colW - visibleWidth(indent) - visibleWidth(idPart) - visibleWidth(suffix) - 2);
46595
46685
  const summaryPart = truncateVisible(sessionSummaryText(s), summaryBudget);
@@ -46630,13 +46720,13 @@ function buildSystemLines(colW, statusRows, recent) {
46630
46720
  lines.push(sectionHeading("System"));
46631
46721
  const labelW = Math.max(...statusRows.map((r) => r.label.length), "last used".length);
46632
46722
  for (const item of statusRows) {
46633
- const label = chalk95.dim(padRight(item.label, labelW));
46723
+ const label = chalk96.dim(padRight(item.label, labelW));
46634
46724
  const state2 = padRight(item.state, 10);
46635
46725
  const detailW = Math.max(1, colW - labelW - 13);
46636
- lines.push(`${label} ${state2} ${chalk95.dim(truncateVisible(item.detail, detailW))}`);
46726
+ lines.push(`${label} ${state2} ${chalk96.dim(truncateVisible(item.detail, detailW))}`);
46637
46727
  }
46638
46728
  if (recent) {
46639
- lines.push(`${chalk95.dim(padRight("last used", labelW))} ${chalk95.dim(recent)}`);
46729
+ lines.push(`${chalk96.dim(padRight("last used", labelW))} ${chalk96.dim(recent)}`);
46640
46730
  }
46641
46731
  return lines;
46642
46732
  }
@@ -46644,10 +46734,10 @@ function buildLastSessionLines(colW, ctx, lastSession, nextAction, emptyDataHint
46644
46734
  const lines = [""];
46645
46735
  lines.push(sectionHeading("Last Session"));
46646
46736
  if (!lastSession) {
46647
- lines.push(` ${chalk95.dim("(none)")}`);
46737
+ lines.push(` ${chalk96.dim("(none)")}`);
46648
46738
  lines.push(
46649
46739
  truncateVisible(
46650
- ` ${nextAction.command ? actionHint(nextAction.label, nextAction.command, nextAction.detail) : `${chalk95.dim(nextAction.label)} ${chalk95.dim(nextAction.detail)}`}`,
46740
+ ` ${nextAction.command ? actionHint(nextAction.label, nextAction.command, nextAction.detail) : `${chalk96.dim(nextAction.label)} ${chalk96.dim(nextAction.detail)}`}`,
46651
46741
  colW
46652
46742
  )
46653
46743
  );
@@ -46661,7 +46751,7 @@ function buildLastSessionLines(colW, ctx, lastSession, nextAction, emptyDataHint
46661
46751
  if (!isCurrent) {
46662
46752
  lines.push(
46663
46753
  truncateVisible(
46664
- ` ${chalk95.dim("Resume:")} ${paint("accent", `/session ${lastSession.id.slice(-4)}`)}`,
46754
+ ` ${chalk96.dim("Resume:")} ${paint("accent", `/session ${lastSession.id.slice(-4)}`)}`,
46665
46755
  colW
46666
46756
  )
46667
46757
  );
@@ -46670,7 +46760,7 @@ function buildLastSessionLines(colW, ctx, lastSession, nextAction, emptyDataHint
46670
46760
  truncateVisible(` ${actionHint(nextAction.label, nextAction.command, nextAction.detail)}`, colW)
46671
46761
  );
46672
46762
  } else {
46673
- lines.push(truncateVisible(` ${chalk95.dim(nextAction.label)} ${chalk95.dim(nextAction.detail)}`, colW));
46763
+ lines.push(truncateVisible(` ${chalk96.dim(nextAction.label)} ${chalk96.dim(nextAction.detail)}`, colW));
46674
46764
  }
46675
46765
  if (isCurrent && emptyDataHint) {
46676
46766
  lines.push(truncateVisible(` ${emptyDataHint}`, colW));
@@ -46681,14 +46771,14 @@ function buildActiveSessionsLines(colW, ctx, activeSessions) {
46681
46771
  const lines = [""];
46682
46772
  lines.push(sectionHeading("Active Sessions"));
46683
46773
  if (activeSessions.length === 0) {
46684
- lines.push(` ${chalk95.dim("(none in progress)")}`);
46774
+ lines.push(` ${chalk96.dim("(none in progress)")}`);
46685
46775
  return lines;
46686
46776
  }
46687
46777
  for (const s of activeSessions.slice(0, 5)) {
46688
46778
  lines.push(formatActiveSessionLine(s, colW, ctx, { markCurrent: true }));
46689
46779
  }
46690
46780
  if (activeSessions.length > 5) {
46691
- lines.push(` ${chalk95.dim(`+${activeSessions.length - 5} more \xB7 `)}${paint("accent", "/session")}`);
46781
+ lines.push(` ${chalk96.dim(`+${activeSessions.length - 5} more \xB7 `)}${paint("accent", "/session")}`);
46692
46782
  }
46693
46783
  return lines;
46694
46784
  }
@@ -46776,7 +46866,7 @@ async function printWelcome(ctx, version) {
46776
46866
  const gap = Math.max(0, innerW - versionTag.length);
46777
46867
  const gapL = Math.floor(gap / 2);
46778
46868
  push(
46779
- border(`\u256D${"\u2500".repeat(gapL)}`) + chalk95.dim(versionTag) + border(`${"\u2500".repeat(gap - gapL)}\u256E`)
46869
+ border(`\u256D${"\u2500".repeat(gapL)}`) + chalk96.dim(versionTag) + border(`${"\u2500".repeat(gap - gapL)}\u256E`)
46780
46870
  );
46781
46871
  if (useWideLayout) {
46782
46872
  const leftLines = systemLines;
@@ -46803,7 +46893,7 @@ async function printWelcome(ctx, version) {
46803
46893
  push(border(`\u2570${"\u2500".repeat(innerW)}\u256F`));
46804
46894
  push(
46805
46895
  truncateVisible(
46806
- license.valid ? ` ${paint("accent", "/help")}${chalk95.dim(" commands \xB7 ")}${paint("accent", "/deepdive")}${chalk95.dim(" tour \xB7 ")}${paint("accent", "/progress")}${chalk95.dim(" hours \xB7 ")}${paint("accent", "/session")}${chalk95.dim(" resume")}` : ` ${paint("accent", "/help")}${chalk95.dim(" commands \xB7 ")}${paint("accent", "/activate")}${chalk95.dim(" paste a key \xB7 ")}${paint("accent", "/checkout")}${chalk95.dim(" signup \xB7 ")}${paint("accent", "/progress")}${chalk95.dim(" hours")}`,
46896
+ license.valid ? ` ${paint("accent", "/help")}${chalk96.dim(" commands \xB7 ")}${paint("accent", "/deepdive")}${chalk96.dim(" tour \xB7 ")}${paint("accent", "/progress")}${chalk96.dim(" hours \xB7 ")}${paint("accent", "/session")}${chalk96.dim(" resume")}` : ` ${paint("accent", "/help")}${chalk96.dim(" commands \xB7 ")}${paint("accent", "/activate")}${chalk96.dim(" paste a key \xB7 ")}${paint("accent", "/checkout")}${chalk96.dim(" signup \xB7 ")}${paint("accent", "/progress")}${chalk96.dim(" hours")}`,
46807
46897
  cardW
46808
46898
  )
46809
46899
  );
@@ -46814,14 +46904,14 @@ async function printWelcome(ctx, version) {
46814
46904
  if (strategyNudge) {
46815
46905
  push(
46816
46906
  truncateVisible(
46817
- ` ${paint("warning", "\u2691")} ${chalk95.dim(strategyNudge.text)} ${chalk95.dim("\xB7")} ${paint("accent", strategyNudge.command)}`,
46907
+ ` ${paint("warning", "\u2691")} ${chalk96.dim(strategyNudge.text)} ${chalk96.dim("\xB7")} ${paint("accent", strategyNudge.command)}`,
46818
46908
  cardW
46819
46909
  )
46820
46910
  );
46821
46911
  } else if (deepdiveNudge) {
46822
46912
  push(
46823
46913
  truncateVisible(
46824
- ` ${paint("warning", "\u2691")} ${chalk95.dim(deepdiveNudge.text)} ${chalk95.dim("\xB7")} ${paint("accent", deepdiveNudge.command)}`,
46914
+ ` ${paint("warning", "\u2691")} ${chalk96.dim(deepdiveNudge.text)} ${chalk96.dim("\xB7")} ${paint("accent", deepdiveNudge.command)}`,
46825
46915
  cardW
46826
46916
  )
46827
46917
  );
@@ -46829,7 +46919,7 @@ async function printWelcome(ctx, version) {
46829
46919
  } else if (voiceNudge) {
46830
46920
  push(
46831
46921
  truncateVisible(
46832
- ` ${paint("warning", "\u2691")} ${chalk95.dim(voiceNudge.text)} ${chalk95.dim("\xB7")} ${paint("accent", voiceNudge.command)}`,
46922
+ ` ${paint("warning", "\u2691")} ${chalk96.dim(voiceNudge.text)} ${chalk96.dim("\xB7")} ${paint("accent", voiceNudge.command)}`,
46833
46923
  cardW
46834
46924
  )
46835
46925
  );
@@ -47017,7 +47107,7 @@ __export(repl_exports, {
47017
47107
  });
47018
47108
  import { createInterface as createInterface2 } from "readline/promises";
47019
47109
  import { clearLine as clearLine2, cursorTo as cursorTo2 } from "readline";
47020
- import chalk96 from "chalk";
47110
+ import chalk97 from "chalk";
47021
47111
  import { join as join42 } from "path";
47022
47112
  function buildPrompt(ctx) {
47023
47113
  return buildConversationPrompt(ctx);
@@ -47109,12 +47199,12 @@ function renderInlineSuggestion(rl, prompt, ctx) {
47109
47199
  suggestionPainted = suffix !== null;
47110
47200
  clearLine2(process.stdout, 0);
47111
47201
  cursorTo2(process.stdout, 0);
47112
- process.stdout.write(prompt + line + (suffix ? chalk96.dim(suffix) : ""));
47202
+ process.stdout.write(prompt + line + (suffix ? chalk97.dim(suffix) : ""));
47113
47203
  cursorTo2(process.stdout, promptWidth + cursor);
47114
47204
  }
47115
47205
  function appendTurnLine(current, promptLabel, currentSummary) {
47116
- const currentLine = currentSummary ? `${promptLabel} ${current} ${chalk96.white("\u2192")} ${currentSummary}` : `${promptLabel} ${current}`;
47117
- console.log(" " + chalk96.dim(currentLine));
47206
+ const currentLine = currentSummary ? `${promptLabel} ${current} ${chalk97.white("\u2192")} ${currentSummary}` : `${promptLabel} ${current}`;
47207
+ console.log(" " + chalk97.dim(currentLine));
47118
47208
  console.log();
47119
47209
  }
47120
47210
  async function goHome(ctx, version, history, opts) {
@@ -47124,7 +47214,7 @@ async function goHome(ctx, version, history, opts) {
47124
47214
  clearTerminalHome();
47125
47215
  if (opts?.banner) {
47126
47216
  console.log();
47127
- console.log(" " + paint("accent", "\u2713") + " " + chalk96.dim(opts.banner));
47217
+ console.log(" " + paint("accent", "\u2713") + " " + chalk97.dim(opts.banner));
47128
47218
  }
47129
47219
  await printWelcome(ctx, version);
47130
47220
  }
@@ -47147,11 +47237,11 @@ async function handleDispatchResult(result, ctx, version, history) {
47147
47237
  case "unknown":
47148
47238
  if (result.suggestion) {
47149
47239
  console.log(
47150
- " " + chalk96.red(`Unknown command: ${result.token}.`) + chalk96.dim(" Did you mean ") + paint("accent", result.suggestion) + chalk96.dim("?")
47240
+ " " + chalk97.red(`Unknown command: ${result.token}.`) + chalk97.dim(" Did you mean ") + paint("accent", result.suggestion) + chalk97.dim("?")
47151
47241
  );
47152
47242
  } else {
47153
47243
  console.log(
47154
- " " + chalk96.red(`Unknown command: ${result.token}`) + chalk96.dim(" Type ") + paint("accent", "/help") + chalk96.dim(" to see available commands.")
47244
+ " " + chalk97.red(`Unknown command: ${result.token}`) + chalk97.dim(" Type ") + paint("accent", "/help") + chalk97.dim(" to see available commands.")
47155
47245
  );
47156
47246
  }
47157
47247
  break;
@@ -47175,7 +47265,7 @@ async function runRepl(ctx, version) {
47175
47265
  });
47176
47266
  ctx.rl = rl;
47177
47267
  console.log();
47178
- console.log(" " + chalk96.dim("What do you want to look at?"));
47268
+ console.log(" " + chalk97.dim("What do you want to look at?"));
47179
47269
  console.log();
47180
47270
  if (ctx.pendingUpdateCheck) {
47181
47271
  void ctx.pendingUpdateCheck.then((result) => {
@@ -47217,7 +47307,7 @@ async function runRepl(ctx, version) {
47217
47307
  return;
47218
47308
  }
47219
47309
  sigintPrimed = true;
47220
- console.log("\n " + chalk96.dim("Type /exit to quit, or press Ctrl+C again."));
47310
+ console.log("\n " + chalk97.dim("Type /exit to quit, or press Ctrl+C again."));
47221
47311
  };
47222
47312
  rl.on("SIGINT", sigintHandler);
47223
47313
  function shutdownRepl() {
@@ -47254,7 +47344,7 @@ async function runRepl(ctx, version) {
47254
47344
  if (!typed && !enterAction) {
47255
47345
  clearGhostRowAfterSubmit();
47256
47346
  const coach = consumeOrientEmptyEnterCoach(ctx);
47257
- if (coach) console.log(" " + chalk96.dim(coach));
47347
+ if (coach) console.log(" " + chalk97.dim(coach));
47258
47348
  continue;
47259
47349
  }
47260
47350
  const line = typed || enterAction.submit;
@@ -47305,11 +47395,11 @@ async function runRepl(ctx, version) {
47305
47395
  ctx.wizardDepth = 0;
47306
47396
  ctx.secretInputActive = false;
47307
47397
  if (err instanceof Error && err.message === "Cancelled") {
47308
- console.log(" " + chalk96.dim("Cancelled."));
47398
+ console.log(" " + chalk97.dim("Cancelled."));
47309
47399
  } else {
47310
47400
  const { tryRecoverLlmAuthFailure: tryRecoverLlmAuthFailure2 } = await Promise.resolve().then(() => (init_auth_recovery(), auth_recovery_exports));
47311
47401
  if (!await tryRecoverLlmAuthFailure2(ctx, err)) {
47312
- console.error(" " + chalk96.red("Error: " + String(err.message ?? err)));
47402
+ console.error(" " + chalk97.red("Error: " + String(err.message ?? err)));
47313
47403
  }
47314
47404
  }
47315
47405
  }
@@ -47336,10 +47426,10 @@ async function runRepl(ctx, version) {
47336
47426
  await closeSession(ctx);
47337
47427
  }
47338
47428
  if (isTranscriptActive(ctx.sessionId)) {
47339
- console.log(" " + chalk96.dim("Transcript: ") + chalk96.dim(transcriptPathForSession(ctx.sessionId)));
47340
- console.log(" " + chalk96.dim("Context brief: ") + chalk96.dim(contextDocPathForSession(ctx.sessionId)));
47429
+ console.log(" " + chalk97.dim("Transcript: ") + chalk97.dim(transcriptPathForSession(ctx.sessionId)));
47430
+ console.log(" " + chalk97.dim("Context brief: ") + chalk97.dim(contextDocPathForSession(ctx.sessionId)));
47341
47431
  }
47342
- console.log(" " + chalk96.dim(randomGoodbye()));
47432
+ console.log(" " + chalk97.dim(randomGoodbye()));
47343
47433
  }
47344
47434
  function printHelpOneShot() {
47345
47435
  printHelp();
@@ -47347,38 +47437,43 @@ function printHelpOneShot() {
47347
47437
  function printHelp() {
47348
47438
  console.log();
47349
47439
  console.log(" " + sectionHeading("Conversation"));
47350
- console.log(" " + chalk96.dim("Type the question. You do not need a slash command."));
47351
- console.log(" " + chalk96.dim("Paste a CSV path or type ") + paint("accent", '"use demo data"') + chalk96.dim(" to load data."));
47352
- console.log(" " + chalk96.dim("After analysis, type questions in English."));
47353
- console.log(" " + chalk96.dim("Type ") + paint("accent", '"how should we fix this?"') + chalk96.dim(" to make a strategy. Type ") + paint("accent", "keep going") + chalk96.dim(" at confirm to keep working until the plan is ready."));
47354
- console.log(" " + chalk96.dim("Type ") + paint("accent", '"ship a board deck"') + chalk96.dim(" to write a handoff."));
47355
- console.log(" " + chalk96.dim("The ") + paint("accent", "\u203A") + chalk96.dim(" prompt shows brief or deep after analysis. Brief is the default."));
47440
+ console.log(" " + chalk97.dim("Type the question. You do not need a slash command."));
47441
+ console.log(" " + chalk97.dim("Paste a CSV path or type ") + paint("accent", '"use demo data"') + chalk97.dim(" to load data."));
47442
+ console.log(" " + chalk97.dim("After analysis, type questions in English."));
47443
+ console.log(" " + chalk97.dim("Type ") + paint("accent", '"how should we fix this?"') + chalk97.dim(" to make a strategy. Type ") + paint("accent", "keep going") + chalk97.dim(" at confirm to keep working until the plan is ready."));
47444
+ console.log(" " + chalk97.dim("Type ") + paint("accent", '"ship a board deck"') + chalk97.dim(" to write a handoff."));
47445
+ console.log(" " + chalk97.dim("The ") + paint("accent", "\u203A") + chalk97.dim(" prompt shows brief or deep after analysis. Brief is the default."));
47356
47446
  console.log();
47357
47447
  console.log(" " + sectionHeading("Keys"));
47358
47448
  console.log(
47359
- " " + paint("accent", "\u23CE") + chalk96.dim(
47449
+ " " + paint("accent", "\u23CE") + chalk97.dim(
47360
47450
  " Accepts the default. At the main prompt it runs the armed action (yes, use demo data, go ahead, /connect, /update, keep going)."
47361
47451
  )
47362
47452
  );
47363
47453
  console.log(
47364
- " " + chalk96.dim(
47454
+ " " + chalk97.dim(
47365
47455
  " On yes/no questions and menus it accepts yes (or the recommended option). Type something else to decline or pick another path."
47366
47456
  )
47367
47457
  );
47368
47458
  console.log(
47369
- " " + paint("accent", "b") + chalk96.dim(" / ") + paint("accent", "back") + chalk96.dim(" Steps back one confirm gate, or leaves a modal. Does not unload data or undo compute.")
47459
+ " " + paint("accent", "b") + chalk97.dim(" / ") + paint("accent", "back") + chalk97.dim(" Steps back one confirm gate, or leaves a modal. Does not unload data or undo compute.")
47460
+ );
47461
+ console.log(
47462
+ " " + chalk97.dim("On ") + paint("accent", "/settings") + chalk97.dim(" menus, ") + paint("accent", "b") + chalk97.dim(" leaves the hub (same as Done).")
47370
47463
  );
47371
47464
  console.log(
47372
- " " + chalk96.dim("On ") + paint("accent", "/settings") + chalk96.dim(" menus, ") + paint("accent", "b") + chalk96.dim(" leaves the hub (same as Done).")
47465
+ " " + paint("accent", "more") + chalk97.dim(" Shows the full strategy brief after the short summary.")
47373
47466
  );
47374
47467
  console.log(
47375
- " " + paint("accent", "more") + chalk96.dim(" / ") + paint("accent", "expand") + chalk96.dim(" Shows the full strategy brief after the short summary.")
47468
+ " " + paint("accent", "expand") + chalk97.dim(
47469
+ " After a short Q&A answer, shows more reasoning for that same answer. With no last answer, expands the strategy brief when one is on screen."
47470
+ )
47376
47471
  );
47377
47472
  console.log(
47378
- " " + paint("accent", "cancel") + chalk96.dim(" Drops the current modal overlay (strategy, think, ship, unconfirmed scope).")
47473
+ " " + paint("accent", "cancel") + chalk97.dim(" Drops the current modal overlay (strategy, think, ship, unconfirmed scope).")
47379
47474
  );
47380
47475
  console.log(
47381
- " " + chalk96.dim("On ") + paint("accent", "/deepdive") + chalk96.dim(" slides, ") + paint("accent", "b") + chalk96.dim(" moves to the previous slide.")
47476
+ " " + chalk97.dim("On ") + paint("accent", "/deepdive") + chalk97.dim(" slides, ") + paint("accent", "b") + chalk97.dim(" moves to the previous slide.")
47382
47477
  );
47383
47478
  console.log();
47384
47479
  console.log(" " + sectionHeading("Shortcuts"));
@@ -47406,11 +47501,11 @@ function printHelp() {
47406
47501
  ];
47407
47502
  const maxW = Math.max(...shortcuts.map(([c]) => c.length)) + 2;
47408
47503
  for (const [cmd, desc] of shortcuts) {
47409
- console.log(` ${paint("accent", padRight(cmd, maxW))} ${chalk96.dim(desc)}`);
47504
+ console.log(` ${paint("accent", padRight(cmd, maxW))} ${chalk97.dim(desc)}`);
47410
47505
  }
47411
47506
  console.log();
47412
47507
  console.log(" " + sectionHeading("Teach NTRP"));
47413
- console.log(" " + chalk96.dim("NTRP learns your business over time. There are three ways to teach it:"));
47508
+ console.log(" " + chalk97.dim("NTRP learns your business over time. There are three ways to teach it:"));
47414
47509
  const teach = [
47415
47510
  ["/remember <fact>", "Store a fact, a decision, or a preference"],
47416
47511
  ["/recall [topic]", "Show what NTRP stores about your business"],
@@ -47419,13 +47514,13 @@ function printHelp() {
47419
47514
  ];
47420
47515
  const teachMaxW = Math.max(...teach.map(([c]) => c.length)) + 2;
47421
47516
  for (const [cmd, desc] of teach) {
47422
- console.log(` ${paint("accent", padRight(cmd, teachMaxW))} ${chalk96.dim(desc)}`);
47517
+ console.log(` ${paint("accent", padRight(cmd, teachMaxW))} ${chalk97.dim(desc)}`);
47423
47518
  }
47424
- console.log(" " + chalk96.dim("When a key is connected, NTRP stores a small number of facts when you close a session."));
47519
+ console.log(" " + chalk97.dim("When a key is connected, NTRP stores a small number of facts when you close a session."));
47425
47520
  console.log();
47426
- console.log(" " + chalk96.dim("Factory reset: type ") + paint("accent", "/scratch") + chalk96.dim("."));
47521
+ console.log(" " + chalk97.dim("Factory reset: type ") + paint("accent", "/scratch") + chalk97.dim("."));
47427
47522
  console.log();
47428
- console.log(" " + chalk96.dim("These commands also work: ") + paint("accent", "/new") + chalk96.dim(", ") + paint("accent", "/diagnose") + chalk96.dim(", ") + paint("accent", "/metrics") + chalk96.dim(", ") + paint("accent", "/session") + chalk96.dim("."));
47523
+ console.log(" " + chalk97.dim("These commands also work: ") + paint("accent", "/new") + chalk97.dim(", ") + paint("accent", "/diagnose") + chalk97.dim(", ") + paint("accent", "/metrics") + chalk97.dim(", ") + paint("accent", "/session") + chalk97.dim("."));
47429
47524
  console.log();
47430
47525
  }
47431
47526
  var REPL_BUILTINS, ANSI_PATTERN, GOODBYES, GHOST_HINTS, ghostHintTurn, activeGhostHint, suggestionPainted;
@@ -47525,7 +47620,7 @@ init_errors();
47525
47620
  init_diagnostics();
47526
47621
  init_types();
47527
47622
  init_version();
47528
- import chalk97 from "chalk";
47623
+ import chalk98 from "chalk";
47529
47624
  var VERSION = getInstalledVersion();
47530
47625
  function exitIfVersionFlag(argv) {
47531
47626
  const rest = argv.slice(2).filter((a) => a === "--version" || a === "-v");
@@ -47563,7 +47658,7 @@ async function main() {
47563
47658
  debug: args.globals.debug
47564
47659
  });
47565
47660
  if (!ctx.execution.color) {
47566
- chalk97.level = 0;
47661
+ chalk98.level = 0;
47567
47662
  }
47568
47663
  fatalReporting = {
47569
47664
  command: firstToken(args.input) || "ntrp",
@@ -47580,16 +47675,16 @@ async function main() {
47580
47675
  if (isStructuredOutput(ctx.execution)) {
47581
47676
  emitError(cmd || "ntrp", new NtrpError("license_invalid", lic.message, 3 /* Auth */));
47582
47677
  }
47583
- console.error(chalk97.red(`
47678
+ console.error(chalk98.red(`
47584
47679
  ${lic.message}`));
47585
- console.error(chalk97.dim(" Trial's over \u2014 /upgrade and paste your key.\n"));
47680
+ console.error(chalk98.dim(" Trial's over \u2014 /upgrade and paste your key.\n"));
47586
47681
  process.exit(1);
47587
47682
  }
47588
47683
  }
47589
47684
  const PROFILE_HINT_SKIP = /* @__PURE__ */ new Set(["onboard", "setup", "config", "connect", "activate", "help", "home", "exit", "quit", "clear", "profile", "progress", "deepdive", "settings", "voice", "logs"]);
47590
47685
  if (!isProfileConfigured() && !PROFILE_HINT_SKIP.has(cmd) && !ctx.execution.quiet) {
47591
47686
  console.error(
47592
- " " + chalk97.dim("Tip: run ") + paint("accent", "ntrp") + chalk97.dim(" interactively to set up your company profile for richer answers.")
47687
+ " " + chalk98.dim("Tip: run ") + paint("accent", "ntrp") + chalk98.dim(" interactively to set up your company profile for richer answers.")
47593
47688
  );
47594
47689
  }
47595
47690
  const result = await dispatch(args.input, ctx);
@@ -47601,12 +47696,12 @@ async function main() {
47601
47696
  }
47602
47697
  if (result.suggestion) {
47603
47698
  console.error(
47604
- chalk97.red(` Unknown command: ${result.token}.`) + chalk97.dim(" Did you mean ") + paint("accent", result.suggestion) + chalk97.dim("?")
47699
+ chalk98.red(` Unknown command: ${result.token}.`) + chalk98.dim(" Did you mean ") + paint("accent", result.suggestion) + chalk98.dim("?")
47605
47700
  );
47606
47701
  } else {
47607
- console.error(chalk97.red(` Unknown command: ${result.token}`));
47702
+ console.error(chalk98.red(` Unknown command: ${result.token}`));
47608
47703
  }
47609
- console.error(chalk97.dim(" Run 'ntrp' for the interactive prompt."));
47704
+ console.error(chalk98.dim(" Run 'ntrp' for the interactive prompt."));
47610
47705
  process.exit(1);
47611
47706
  break;
47612
47707
  case "help":
@@ -47659,7 +47754,7 @@ async function main() {
47659
47754
  if (justUpdated) {
47660
47755
  clearTerminalHome();
47661
47756
  console.log();
47662
- console.log(" " + paint("accent", "\u2713") + " " + chalk97.dim(`Now running v${justUpdated.to}`));
47757
+ console.log(" " + paint("accent", "\u2713") + " " + chalk98.dim(`Now running v${justUpdated.to}`));
47663
47758
  }
47664
47759
  await printWelcome2(ctx, VERSION);
47665
47760
  await runRepl(ctx, VERSION);
@@ -47673,9 +47768,9 @@ async function die(err, scope) {
47673
47768
  if (fatalReporting.structured) {
47674
47769
  emitError(fatalReporting.command, err);
47675
47770
  }
47676
- console.error(chalk97.red(` ${describeError(err)}`));
47771
+ console.error(chalk98.red(` ${describeError(err)}`));
47677
47772
  if (!(err instanceof NtrpError) && err instanceof Error && err.stack) {
47678
- console.error(chalk97.dim(err.stack.split("\n").slice(1).join("\n")));
47773
+ console.error(chalk98.dim(err.stack.split("\n").slice(1).join("\n")));
47679
47774
  }
47680
47775
  process.exit(err instanceof NtrpError ? err.exitCode : 1 /* RuntimeError */);
47681
47776
  }
@@ -26395,6 +26395,7 @@ var init_smoke_protocol = __esm({
26395
26395
  // src/cli/nl.ts
26396
26396
  var nl_exports = {};
26397
26397
  __export(nl_exports, {
26398
+ runExploreExpandAnswer: () => runExploreExpandAnswer,
26398
26399
  runNaturalLanguage: () => runNaturalLanguage
26399
26400
  });
26400
26401
  import chalk25 from "chalk";
@@ -26402,16 +26403,16 @@ async function runNaturalLanguage(input, ctx) {
26402
26403
  if (isSmokeProtocolTrigger(input)) {
26403
26404
  recordMessage(ctx, "user", input);
26404
26405
  console.log();
26405
- const spinner2 = makeSpinner("Running smoke protocol\u2026");
26406
+ const spinner = makeSpinner("Running smoke protocol\u2026");
26406
26407
  try {
26407
26408
  const result = await runSmokeProtocol(input, ctx);
26408
- spinner2.succeed("Smoke protocol complete");
26409
+ spinner.succeed("Smoke protocol complete");
26409
26410
  printAnswer(result.answer);
26410
26411
  recordMessage(ctx, "agent", result.answer);
26411
26412
  console.log();
26412
26413
  return extractSummary2(result.answer);
26413
26414
  } catch (err) {
26414
- spinner2.fail("Smoke protocol failed");
26415
+ spinner.fail("Smoke protocol failed");
26415
26416
  console.error(" " + chalk25.red(String(err.message ?? err)));
26416
26417
  console.log();
26417
26418
  return;
@@ -26426,6 +26427,22 @@ async function runNaturalLanguage(input, ctx) {
26426
26427
  return;
26427
26428
  }
26428
26429
  recordMessage(ctx, "user", input);
26430
+ const responseMode = resolveExploreResponseMode(input, ctx, ctx.conversation.length);
26431
+ return runExploreAgent(ctx, {
26432
+ userQuestion: input,
26433
+ responseMode,
26434
+ showExpandHint: responseMode === "brief"
26435
+ });
26436
+ }
26437
+ async function runExploreExpandAnswer(ctx, question) {
26438
+ return runExploreAgent(ctx, {
26439
+ userQuestion: question,
26440
+ responseMode: "deep",
26441
+ showExpandHint: false
26442
+ });
26443
+ }
26444
+ async function runExploreAgent(ctx, opts) {
26445
+ const { userQuestion, responseMode, showExpandHint } = opts;
26429
26446
  let snapshot = ctx.snapshot.computeResult;
26430
26447
  if (!snapshot) {
26431
26448
  const metricsFirst = prefersMetricsFirstContext(ctx);
@@ -26442,7 +26459,7 @@ async function runNaturalLanguage(input, ctx) {
26442
26459
  }
26443
26460
  }
26444
26461
  console.log();
26445
- const memoryBlock = await buildMemoryBlock(input).catch((err) => {
26462
+ const memoryBlock = await buildMemoryBlock(userQuestion).catch((err) => {
26446
26463
  debugError("nl.buildMemoryBlock", err);
26447
26464
  return "";
26448
26465
  });
@@ -26453,13 +26470,12 @@ async function runNaturalLanguage(input, ctx) {
26453
26470
  setAgentContext(ctx);
26454
26471
  try {
26455
26472
  const analysisBlock = buildAnalysisBlock(ctx);
26456
- const responseMode = resolveExploreResponseMode(input, ctx, ctx.conversation.length);
26457
26473
  const conversationBlock = getConversationPhaseBlock(ctx, { responseMode });
26458
26474
  const bundle = await loadSessionAnalysisBundle();
26459
26475
  const sessionArtifact = hasAnyAnalysis(bundle) ? buildExploreContextBlock(bundle, ctx) : "";
26460
26476
  for await (const event of agenticFindings(snapshot, ctx.snapshot.divergences, {
26461
26477
  mode: "fresh",
26462
- userQuestion: input,
26478
+ userQuestion,
26463
26479
  sessionContext: ctx.resumedSessionSummary,
26464
26480
  includeMetrics: true,
26465
26481
  analysisBlock,
@@ -26500,7 +26516,7 @@ async function runNaturalLanguage(input, ctx) {
26500
26516
  const { isLlmAuthError: isLlmAuthError2 } = await Promise.resolve().then(() => (init_errors2(), errors_exports));
26501
26517
  if (isLlmAuthError2(err)) {
26502
26518
  const { queuePendingAsk: queuePendingAsk2 } = await Promise.resolve().then(() => (init_pending_ask(), pending_ask_exports));
26503
- if (!ctx.pendingAsk) queuePendingAsk2(ctx, input, "explore");
26519
+ if (!ctx.pendingAsk) queuePendingAsk2(ctx, userQuestion, "explore");
26504
26520
  const { recoverFromAuthFailure: recoverFromAuthFailure2 } = await Promise.resolve().then(() => (init_auth_recovery(), auth_recovery_exports));
26505
26521
  await recoverFromAuthFailure2(ctx, err);
26506
26522
  return;
@@ -26525,8 +26541,18 @@ async function runNaturalLanguage(input, ctx) {
26525
26541
  saveSessionState(ctx);
26526
26542
  }
26527
26543
  creditNlAnswer(ctx, Math.floor(ctx.messages.length / 2));
26528
- recordAnalysis({ question: input, answer: lastAnswer, tools: toolsUsed, session_id: ctx.sessionId });
26529
- ctx.lastExchange = { question: input, answer: lastAnswer };
26544
+ recordAnalysis({
26545
+ question: userQuestion,
26546
+ answer: lastAnswer,
26547
+ tools: toolsUsed,
26548
+ session_id: ctx.sessionId
26549
+ });
26550
+ ctx.lastExchange = { question: userQuestion, answer: lastAnswer, mode: responseMode };
26551
+ if (showExpandHint) {
26552
+ console.log(
26553
+ " " + chalk25.dim("Type ") + chalk25.cyan("expand") + chalk25.dim(" for more reasoning.")
26554
+ );
26555
+ }
26530
26556
  }
26531
26557
  console.log();
26532
26558
  const { promptQueuedAiStrategist: promptQueuedAiStrategist2 } = await Promise.resolve().then(() => (init_strategist_flow(), strategist_flow_exports));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonnechasser/ntrp",
3
- "version": "2.1.12",
3
+ "version": "2.2.0",
4
4
  "description": "GTM Health Diagnostic CLI — local pipeline analysis tool",
5
5
  "homepage": "https://ntrp.sonnechasser.com",
6
6
  "repository": {