@sonnechasser/ntrp 1.3.9 → 1.4.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.
Files changed (3) hide show
  1. package/dist/index.js +1107 -324
  2. package/dist/mcp/server.js +797 -131
  3. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -1685,6 +1685,26 @@ function buildSessionContextDoc(file, opts = {}) {
1685
1685
  if (file.strategist.origin) lines.push(`- Origin: ${file.strategist.origin}`);
1686
1686
  lines.push("");
1687
1687
  }
1688
+ if (file.think) {
1689
+ lines.push("## Think (in flight)");
1690
+ lines.push("");
1691
+ lines.push(`- Step: ${file.think.step}`);
1692
+ if (file.think.seed) lines.push(`- Seed: ${file.think.seed}`);
1693
+ if (file.think.origin) lines.push(`- Origin: ${file.think.origin}`);
1694
+ if (file.think.open_questions?.length) {
1695
+ lines.push("- Open questions:");
1696
+ for (const q of file.think.open_questions) lines.push(` - ${q}`);
1697
+ }
1698
+ if (file.think.challenged_assumptions?.length) {
1699
+ lines.push("- Challenged assumptions:");
1700
+ for (const a of file.think.challenged_assumptions) lines.push(` - ${a}`);
1701
+ }
1702
+ if (file.think.working_hypotheses?.length) {
1703
+ lines.push("- Working hypotheses:");
1704
+ for (const h of file.think.working_hypotheses) lines.push(` - ${h}`);
1705
+ }
1706
+ lines.push("");
1707
+ }
1688
1708
  lines.push("## Deliverables");
1689
1709
  lines.push("");
1690
1710
  if (file.deliverables && file.deliverables.length > 0) {
@@ -8767,6 +8787,7 @@ function initContext(oneShot, execution) {
8767
8787
  snapshot: { computeResult: null, divergences: [] },
8768
8788
  messages: [],
8769
8789
  conversation: [],
8790
+ thinkConversation: [],
8770
8791
  stage: "new",
8771
8792
  deliverables: [],
8772
8793
  analysis: defaultSessionAnalysis(),
@@ -8787,12 +8808,14 @@ function buildSessionFileSnapshot(ctx) {
8787
8808
  if (ctx.dataset) file.dataset = ctx.dataset;
8788
8809
  if (ctx.deliverables.length > 0) file.deliverables = ctx.deliverables;
8789
8810
  if (ctx.conversation.length > 0) file.thread = ctx.conversation;
8811
+ if (ctx.thinkConversation.length > 0) file.think_thread = ctx.thinkConversation;
8790
8812
  if (ctx.resumedFromId) file.resumed_from = ctx.resumedFromId;
8791
8813
  if (ctx.analysis) file.analysis = ctx.analysis;
8792
8814
  if (ctx.scope) file.scope = ctx.scope;
8793
8815
  if (ctx.attachments && ctx.attachments.length > 0) file.attachments = ctx.attachments;
8794
8816
  if (ctx.llm && Object.keys(ctx.llm).length > 0) file.llm = ctx.llm;
8795
8817
  if (ctx.strategistState) file.strategist = ctx.strategistState;
8818
+ if (ctx.thinkState) file.think = ctx.thinkState;
8796
8819
  if (ctx.pendingAsk) file.pending_ask = ctx.pendingAsk;
8797
8820
  return file;
8798
8821
  }
@@ -8919,6 +8942,9 @@ function loadSessionFile(id) {
8919
8942
  if (session.thread?.length) {
8920
8943
  session.thread = normalizeThread(session.thread);
8921
8944
  }
8945
+ if (session.think_thread?.length) {
8946
+ session.think_thread = normalizeThread(session.think_thread);
8947
+ }
8922
8948
  return session;
8923
8949
  } catch {
8924
8950
  return null;
@@ -9121,6 +9147,9 @@ async function finalizeSession(ctx, stage) {
9121
9147
  if (ctx.conversation.length > 0) {
9122
9148
  file.thread = ctx.conversation;
9123
9149
  }
9150
+ if (ctx.thinkConversation.length > 0) {
9151
+ file.think_thread = ctx.thinkConversation;
9152
+ }
9124
9153
  if (ctx.analysis) {
9125
9154
  file.analysis = ctx.analysis;
9126
9155
  }
@@ -9136,6 +9165,9 @@ async function finalizeSession(ctx, stage) {
9136
9165
  if (ctx.strategistState) {
9137
9166
  file.strategist = ctx.strategistState;
9138
9167
  }
9168
+ if (ctx.thinkState) {
9169
+ file.think = ctx.thinkState;
9170
+ }
9139
9171
  if (ctx.pendingAsk) {
9140
9172
  file.pending_ask = ctx.pendingAsk;
9141
9173
  }
@@ -9197,6 +9229,7 @@ function resetContextForSwitch(ctx, opts) {
9197
9229
  ctx.sessionName = opts.sessionName;
9198
9230
  ctx.messages = opts.messages;
9199
9231
  ctx.conversation = opts.conversation ?? [];
9232
+ ctx.thinkConversation = opts.thinkConversation ?? [];
9200
9233
  ctx.resumedFromId = opts.resumedFromId;
9201
9234
  ctx.resumedSessionSummary = opts.resumedSessionSummary;
9202
9235
  ctx.stage = opts.stage ?? "new";
@@ -9207,6 +9240,7 @@ function resetContextForSwitch(ctx, opts) {
9207
9240
  ctx.attachments = opts.attachments ?? [];
9208
9241
  ctx.llm = opts.llm;
9209
9242
  ctx.strategistState = opts.strategistState;
9243
+ ctx.thinkState = opts.thinkState;
9210
9244
  ctx.pendingAsk = opts.pendingAsk;
9211
9245
  ctx.gapAudit = void 0;
9212
9246
  ctx.deliverIntent = false;
@@ -15310,6 +15344,8 @@ function resolveRecommendedAction(ctx) {
15310
15344
  return { submit: "yes", hint: "yes" };
15311
15345
  case "strategize":
15312
15346
  return ctx.strategistState?.step === "objective_confirm" ? { submit: "yes", hint: "yes" } : null;
15347
+ case "think":
15348
+ return null;
15313
15349
  default:
15314
15350
  return null;
15315
15351
  }
@@ -15344,6 +15380,9 @@ function resolveConversationPhase(ctx) {
15344
15380
  if (ctx.strategistState && ctx.strategistState.step !== "awaiting_analysis" && ctx.strategistState.step !== "awaiting_connect") {
15345
15381
  return "strategize";
15346
15382
  }
15383
+ if (ctx.thinkState?.step === "active") {
15384
+ return "think";
15385
+ }
15347
15386
  if (isAnalysisReady(ctx)) return "explore";
15348
15387
  const scope = ctx.scope;
15349
15388
  if (scope?.confirmed_at) {
@@ -15368,6 +15407,8 @@ function formatPhaseLabel(phase) {
15368
15407
  return "setup";
15369
15408
  case "explore":
15370
15409
  return "ready to ask";
15410
+ case "think":
15411
+ return "thinking together";
15371
15412
  default:
15372
15413
  return phase.replace(/_/g, " ");
15373
15414
  }
@@ -15386,8 +15427,14 @@ function buildConversationPrompt(ctx) {
15386
15427
  const modeTag = mode === "brief" ? "brief" : "deep";
15387
15428
  const stack = canUseReplAi(ctx) ? formatActiveStackShort(ctx) : "no engine";
15388
15429
  const strategyWait = ctx.strategistState?.step === "awaiting_connect" ? chalk11.dim(" \xB7 strategy after /connect") : "";
15430
+ const thinkWait = ctx.thinkState?.step === "awaiting_connect" ? chalk11.dim(" \xB7 think after /connect") : "";
15389
15431
  const enterHint2 = action ? chalk11.dim(` \xB7 \u23CE ${action.hint}`) : "";
15390
- return paint("accent", `ask${scope} \u203A `) + chalk11.dim(`${modeTag} \xB7 ${stack}`) + strategyWait + enterHint2 + " ";
15432
+ return paint("accent", `ask${scope} \u203A `) + chalk11.dim(`${modeTag} \xB7 ${stack}`) + strategyWait + thinkWait + enterHint2 + " ";
15433
+ }
15434
+ if (phase === "think") {
15435
+ const stack = canUseReplAi(ctx) ? formatActiveStackShort(ctx) : "no engine";
15436
+ const enterHint2 = action ? chalk11.dim(` \xB7 \u23CE ${action.hint}`) : "";
15437
+ return paint("accent", `think${scope} \u203A `) + chalk11.dim(stack) + enterHint2 + " ";
15391
15438
  }
15392
15439
  const enterHint = action ? chalk11.dim(`\u23CE ${action.hint} `) : "";
15393
15440
  return paint("accent", `${label.replace(" \u203A", "")}${scope} \u203A `) + enterHint;
@@ -15428,6 +15475,7 @@ var init_phase = __esm({
15428
15475
  awaiting_data: "data \u203A",
15429
15476
  compute: "\u2026",
15430
15477
  explore: "ask \u203A",
15478
+ think: "think \u203A",
15431
15479
  strategize: "strategy \u203A",
15432
15480
  deliver: "ship \u203A"
15433
15481
  };
@@ -20541,13 +20589,21 @@ function buildFreshNlTools() {
20541
20589
  if (isWebRetrievalEnabled()) tools.push(WEB_SEARCH_TOOL);
20542
20590
  return tools;
20543
20591
  }
20592
+ function buildThinkTools() {
20593
+ const tools = [
20594
+ ...AGENTIC_TOOLS,
20595
+ ...THINK_CHANNEL_TOOLS
20596
+ ];
20597
+ if (isWebRetrievalEnabled()) tools.push(WEB_SEARCH_TOOL);
20598
+ return tools;
20599
+ }
20544
20600
  function allRegisteredToolSchemas() {
20545
- return [...AGENTIC_TOOLS, ...CONVERSATION_TOOLS, WEB_SEARCH_TOOL];
20601
+ return [...AGENTIC_TOOLS, ...CONVERSATION_TOOLS, ...THINK_CHANNEL_TOOLS, WEB_SEARCH_TOOL];
20546
20602
  }
20547
20603
  function getToolSchema(name) {
20548
20604
  return allRegisteredToolSchemas().find((t) => t.name === name);
20549
20605
  }
20550
- var WEB_SEARCH_TOOL, CONVERSATION_TOOLS, AGENTIC_TOOLS;
20606
+ var WEB_SEARCH_TOOL, CONVERSATION_TOOLS, THINK_CHANNEL_TOOLS, AGENTIC_TOOLS;
20551
20607
  var init_tool_schemas = __esm({
20552
20608
  "src/ai/tool-schemas.ts"() {
20553
20609
  "use strict";
@@ -20624,6 +20680,64 @@ var init_tool_schemas = __esm({
20624
20680
  }
20625
20681
  }
20626
20682
  ];
20683
+ THINK_CHANNEL_TOOLS = [
20684
+ {
20685
+ name: "draft_handoff",
20686
+ description: "Draft a handoff prompt combining analysis numbers and conversation thread.",
20687
+ parameters: {
20688
+ type: "object",
20689
+ properties: {
20690
+ target: {
20691
+ type: "string",
20692
+ enum: ["deck", "asana", "clay", "plan"],
20693
+ description: "Deliverable type. Defaults to plan."
20694
+ }
20695
+ }
20696
+ }
20697
+ },
20698
+ {
20699
+ name: "draft_strategy",
20700
+ description: "Hand off to the strategist brain from the think channel when the user is ready to commit to a plan. Do not improvise a multi-week roadmap inline \u2014 call this instead.",
20701
+ parameters: {
20702
+ type: "object",
20703
+ properties: {
20704
+ objective: {
20705
+ type: "string",
20706
+ maxLength: 2e3,
20707
+ description: "The measurable objective to plan toward, in the user's terms."
20708
+ }
20709
+ },
20710
+ required: ["objective"]
20711
+ }
20712
+ },
20713
+ {
20714
+ name: "update_think_scratch",
20715
+ description: "Update the think-channel working scratch: open questions, challenged assumptions, and working hypotheses. Pass only the arrays you want to replace; omitted fields stay unchanged. Call when the conversation advances a question, surfaces a challenged assumption, or forms a hypothesis.",
20716
+ parameters: {
20717
+ type: "object",
20718
+ properties: {
20719
+ open_questions: {
20720
+ type: "array",
20721
+ items: { type: "string", maxLength: 500 },
20722
+ maxItems: 12,
20723
+ description: "Current open questions (replaces the list when provided)."
20724
+ },
20725
+ challenged_assumptions: {
20726
+ type: "array",
20727
+ items: { type: "string", maxLength: 500 },
20728
+ maxItems: 12,
20729
+ description: "Assumptions that have been pressure-tested (replaces when provided)."
20730
+ },
20731
+ working_hypotheses: {
20732
+ type: "array",
20733
+ items: { type: "string", maxLength: 500 },
20734
+ maxItems: 12,
20735
+ description: "Working hypotheses under consideration (replaces when provided)."
20736
+ }
20737
+ }
20738
+ }
20739
+ }
20740
+ ];
20627
20741
  AGENTIC_TOOLS = [
20628
20742
  {
20629
20743
  name: "get_health_summary",
@@ -21790,6 +21904,7 @@ async function handleDraftStrategy(input) {
21790
21904
  if (!objective) return { error: "objective is required." };
21791
21905
  if (!isAnalysisReady2(ctx)) {
21792
21906
  ctx.strategistState = { step: "awaiting_analysis", objective, origin: "ai" };
21907
+ if (ctx.thinkState) ctx.thinkState = void 0;
21793
21908
  saveSessionState2(ctx);
21794
21909
  return {
21795
21910
  queued: true,
@@ -21798,6 +21913,7 @@ async function handleDraftStrategy(input) {
21798
21913
  };
21799
21914
  }
21800
21915
  ctx.strategistState = { step: "objective_confirm", objective, origin: "ai" };
21916
+ if (ctx.thinkState) ctx.thinkState = void 0;
21801
21917
  saveSessionState2(ctx);
21802
21918
  return {
21803
21919
  launched: true,
@@ -21805,6 +21921,32 @@ async function handleDraftStrategy(input) {
21805
21921
  note: "Strategist handoff armed. After your reply the user sees an objective confirmation card and the engine runs a full grounding/backcast/stress-test session. Keep your reply to one or two sentences introducing the handoff \u2014 do NOT write the plan yourself."
21806
21922
  };
21807
21923
  }
21924
+ async function handleUpdateThinkScratch(input) {
21925
+ const { getAgentContext: getAgentContext2 } = await Promise.resolve().then(() => (init_agent_context(), agent_context_exports));
21926
+ const { saveSessionState: saveSessionState2 } = await Promise.resolve().then(() => (init_context2(), context_exports));
21927
+ const ctx = getAgentContext2();
21928
+ if (!ctx) return { error: "No active session context." };
21929
+ if (!ctx.thinkState || ctx.thinkState.step !== "active") {
21930
+ return { error: "Think channel is not active." };
21931
+ }
21932
+ const asStringList = (value) => {
21933
+ if (!Array.isArray(value)) return void 0;
21934
+ return value.filter((v) => typeof v === "string").map((s) => s.trim()).filter(Boolean).slice(0, 12);
21935
+ };
21936
+ const open = asStringList(input.open_questions);
21937
+ const challenged = asStringList(input.challenged_assumptions);
21938
+ const hypotheses = asStringList(input.working_hypotheses);
21939
+ if (open) ctx.thinkState.open_questions = open;
21940
+ if (challenged) ctx.thinkState.challenged_assumptions = challenged;
21941
+ if (hypotheses) ctx.thinkState.working_hypotheses = hypotheses;
21942
+ saveSessionState2(ctx);
21943
+ return {
21944
+ updated: true,
21945
+ open_questions: ctx.thinkState.open_questions ?? [],
21946
+ challenged_assumptions: ctx.thinkState.challenged_assumptions ?? [],
21947
+ working_hypotheses: ctx.thinkState.working_hypotheses ?? []
21948
+ };
21949
+ }
21808
21950
  async function handleGetSessionBrief(input) {
21809
21951
  const raw = typeof input.session_id === "string" ? input.session_id.trim() : "";
21810
21952
  if (!raw) return { error: "session_id is required." };
@@ -21854,8 +21996,8 @@ function boundResultJson(resultJson) {
21854
21996
  }
21855
21997
  async function executeToolCall(name, input, ctx, policy = {}) {
21856
21998
  const start = Date.now();
21857
- const handler49 = HANDLERS[name];
21858
- if (!handler49) {
21999
+ const handler50 = HANDLERS[name];
22000
+ if (!handler50) {
21859
22001
  const stopNote = policy.guard?.recordUnknownTool(name) ?? null;
21860
22002
  const resultJson2 = JSON.stringify(
21861
22003
  stopNote ? { error: `Unknown tool '${name}'`, guidance: stopNote } : { error: `Unknown tool '${name}'` }
@@ -21886,7 +22028,7 @@ async function executeToolCall(name, input, ctx, policy = {}) {
21886
22028
  auditDenied(name, input, resultJson2, start);
21887
22029
  return resultJson2;
21888
22030
  }
21889
- const rawResult = await handler49(input, ctx);
22031
+ const rawResult = await handler50(input, ctx);
21890
22032
  const safeResult = stripPII(rawResult);
21891
22033
  const withGuidance = loopVerdict.verdict === "warn" && safeResult && typeof safeResult === "object" && !Array.isArray(safeResult) ? { ...safeResult, loop_warning: loopVerdict.note } : safeResult;
21892
22034
  const resultJson = boundResultJson(JSON.stringify(withGuidance));
@@ -21930,7 +22072,8 @@ var init_tool_handlers = __esm({
21930
22072
  audit_data_gaps: (_, __) => handleAuditDataGaps(),
21931
22073
  run_compute: (_, __) => handleRunCompute(),
21932
22074
  draft_handoff: (input, _) => handleDraftHandoff(input),
21933
- draft_strategy: (input, _) => handleDraftStrategy(input)
22075
+ draft_strategy: (input, _) => handleDraftStrategy(input),
22076
+ update_think_scratch: (input, _) => handleUpdateThinkScratch(input)
21934
22077
  };
21935
22078
  }
21936
22079
  });
@@ -22079,8 +22222,171 @@ var init_thread = __esm({
22079
22222
  }
22080
22223
  });
22081
22224
 
22082
- // src/ai/agentic-loop.ts
22225
+ // src/ai/think-prompt.ts
22083
22226
  function companyContextSection2() {
22227
+ const block = buildCompanyProfileBlock();
22228
+ return block ? `COMPANY CONTEXT:
22229
+ ${block}
22230
+
22231
+ ` : "";
22232
+ }
22233
+ function operatorSection2() {
22234
+ const block = buildOperatorBlock();
22235
+ return block ? `${block}
22236
+
22237
+ ` : "";
22238
+ }
22239
+ function buildScratchBlock(state2) {
22240
+ if (!state2) return "";
22241
+ const lines = [];
22242
+ if (state2.seed) lines.push(`Seed topic: ${state2.seed}`);
22243
+ if (state2.open_questions?.length) {
22244
+ lines.push("Open questions:");
22245
+ for (const q of state2.open_questions) lines.push(`- ${q}`);
22246
+ }
22247
+ if (state2.challenged_assumptions?.length) {
22248
+ lines.push("Challenged assumptions:");
22249
+ for (const a of state2.challenged_assumptions) lines.push(`- ${a}`);
22250
+ }
22251
+ if (state2.working_hypotheses?.length) {
22252
+ lines.push("Working hypotheses:");
22253
+ for (const h of state2.working_hypotheses) lines.push(`- ${h}`);
22254
+ }
22255
+ if (lines.length === 0) return "";
22256
+ return `
22257
+ THINK SCRATCH (session working memory \u2014 update via update_think_scratch):
22258
+ ${lines.join("\n")}
22259
+ `;
22260
+ }
22261
+ function buildThinkWithMeSystemPrompt(opts = {}) {
22262
+ const sessionBlock = opts.sessionContext ? `
22263
+ PREVIOUS SESSION CONTEXT:
22264
+ The user resumed an earlier session. Here is what they were investigating before:
22265
+ ${opts.sessionContext}
22266
+ Treat this as already-established background. Pick up where it left off \u2014 do not re-introduce it as if it were new.
22267
+
22268
+ ` : "";
22269
+ const memorySection = opts.memoryBlock ? `
22270
+ WHAT YOU ALREADY KNOW ABOUT THIS BUSINESS (durable memory):
22271
+ ${opts.memoryBlock}
22272
+ Reference this naturally. Do not re-derive things you already know; build on them.
22273
+
22274
+ ` : "";
22275
+ const analysisSection = opts.analysisBlock ? `
22276
+ SESSION ANALYSIS CONTEXT:
22277
+ ${opts.analysisBlock}
22278
+ Use get_revenue_metrics and get_revenue_metrics_timeseries when the user asks about SaaS metrics, retention, or period trends.
22279
+
22280
+ ` : "";
22281
+ const artifactSection = opts.sessionArtifact ? `
22282
+ COMPLETED SESSION ANALYSIS:
22283
+ ${opts.sessionArtifact}
22284
+ Cite numbers from here; call tools when you need a new cut or to pressure-test a claim.
22285
+
22286
+ ` : "";
22287
+ const conversationSection = opts.conversationBlock ? `
22288
+ CONVERSATION STATE:
22289
+ ${opts.conversationBlock}
22290
+
22291
+ ` : "";
22292
+ const scratchSection = buildScratchBlock(opts.thinkState);
22293
+ const socraticCraft = `HOW YOU THINK WITH THE USER (socratic partner \u2014 not a search box, not a strategist):
22294
+ - You are a thinking partner. Prefer sharp questions that unlock the user's idea over dumping answers.
22295
+ - Protect imagination: give "what if" space before the smell-test \u2014 do not kill creativity in the first sentence.
22296
+ - Steelman the user's position before you attack it; then deliver one hard pushback grounded in evidence when possible.
22297
+ - Ground claims about THIS pipeline in tool results. Label speculation explicitly ("hypothesis:", "speculation:").
22298
+ - Each turn should ADVANCE the thread: a new question, a challenge, a synthesis, or a fork \u2014 never rehash.
22299
+ - If the question is ambiguous, ask at most ONE clarifying question. Otherwise choose a fork and state it.
22300
+ - Never invent a multi-week roadmap inline. When they want commitment, call draft_strategy with a crisp objective.
22301
+ - Keep open_questions, challenged_assumptions, and working_hypotheses current via update_think_scratch.
22302
+ - You have continuity via prior think-channel messages. Never repeat an angle already covered unless asked.`;
22303
+ const jobSection = `YOUR JOB (THINK CHANNEL \u2014 always deep):
22304
+ - Decide whether you need tools, a direct answer, or both. Do not re-call a tool whose result you already have.
22305
+ - Lead with the answer or the question that matters most, then structure.
22306
+ - When you use numbers, include dollar values where available and lead with financial impact.
22307
+ - Descriptive exploration stays in this channel; plan-of-attack questions hand off via draft_strategy.
22308
+ - After a successful draft_strategy tool result: reply with at most 1\u20132 sentences introducing the handoff. Do not write the plan.`;
22309
+ const formattingSection = `
22310
+ FORMATTING (your answer is rendered in a terminal via a small markdown renderer):
22311
+ - Use **bold** for every dollar figure, score, play name, and person name.
22312
+ - Use *italics* for conversational asides and your closing follow-up question.
22313
+ - Use ### for section headings \u2014 never # or ##. The renderer flattens depth.
22314
+ - For multi-point answers, prefer a one-line lead + bullet list over long paragraph blocks.
22315
+ - Keep paragraphs to 3-4 sentences.
22316
+ - Prefer short tables (\u22643 columns, \u22645 rows, cells \u226430 chars).
22317
+ - End with a dim horizontal rule (---) followed by one italicized follow-up question or fork.
22318
+
22319
+ ${USER_VISIBLE_STE_BLOCK}
22320
+ `;
22321
+ const commandSection = `PRESET COMMANDS (slash commands the user can type \u2014 you may SUGGEST these; you cannot run them):
22322
+ ${buildCommandCatalogBlock()}
22323
+
22324
+ COMMAND SUGGESTION RULES:
22325
+ - Suggest at most ONE command when it adds capability beyond your answer (e.g. \`/strategy\`, \`/handoff\`).
22326
+ - Never claim a command was run. Never invent flags.
22327
+ - Type \`done\` or \`cancel\` leaves the think channel back to ask \u203A.`;
22328
+ const stable = `You are a world-class GTM operating partner in a dedicated THINK WITH ME channel. The user wants collaborative exploration \u2014 imagination, pressure-testing, and evidence \u2014 not a slide deck and not a finished strategy plan.
22329
+
22330
+ ${companyContextSection2()}${operatorSection2()}${socraticCraft}
22331
+
22332
+ ANALYST INSTINCT (judgment a CEO pays for \u2014 apply by default):
22333
+ ${ANALYST_INSTINCT_BLOCK}
22334
+
22335
+ ${jobSection}
22336
+
22337
+ EXECUTION BIAS (how you work):
22338
+ ${EXECUTION_BIAS_BLOCK}
22339
+
22340
+ GTM ENGINEERING (how recommendations become systems):
22341
+ ${GTM_ENGINEERING_BLOCK}
22342
+
22343
+ OUTPUT DOCTRINE (how answers are structured for recall):
22344
+ ${PYRAMID_OUTPUT_BLOCK}
22345
+
22346
+ ${USER_VISIBLE_STE_BLOCK}
22347
+
22348
+ CONTEXT:
22349
+ The user's health scores and top divergences were included as JSON at the start of this conversation. Use them, the think-channel history, and SESSION STATE as background and as hints for which tools to call.
22350
+
22351
+ VITAL SIGNS EXPLAINED (with dollar translations):
22352
+ ${VITAL_SIGNS_BLOCK}
22353
+
22354
+ PLAYBOOK \u2014 name a play when it helps the user act (not a full program):
22355
+ ${buildPlaybookBlock()}
22356
+
22357
+ ${commandSection}
22358
+ ${formattingSection}
22359
+ OUTPUT RULES:
22360
+ - Respond in plain text markdown (not JSON). You do NOT need to emit the findings schema.
22361
+ - Include specific numbers from tool results, never guess.
22362
+ - When you have enough information, answer or ask \u2014 don't call tools you don't need.
22363
+
22364
+ SAFETY & EVIDENCE (non-negotiable):
22365
+ ${SAFETY_BLOCK}`;
22366
+ const dynamicSections = [
22367
+ sessionBlock,
22368
+ memorySection,
22369
+ analysisSection,
22370
+ artifactSection,
22371
+ conversationSection,
22372
+ scratchSection
22373
+ ].map((s) => s.trim()).filter(Boolean);
22374
+ const dynamic = [
22375
+ "SESSION STATE (current \u2014 changes as the session progresses):",
22376
+ ...dynamicSections,
22377
+ buildRuntimeBlock()
22378
+ ].join("\n\n");
22379
+ return { stable, dynamic };
22380
+ }
22381
+ var init_think_prompt = __esm({
22382
+ "src/ai/think-prompt.ts"() {
22383
+ "use strict";
22384
+ init_prompt_parts();
22385
+ }
22386
+ });
22387
+
22388
+ // src/ai/agentic-loop.ts
22389
+ function companyContextSection3() {
22084
22390
  const block = buildCompanyProfileBlock();
22085
22391
  if (!block) return "";
22086
22392
  return `COMPANY CONTEXT (use this to make every answer specific to the business \u2014 use industry-appropriate language, anchor dollar figures to their deal size):
@@ -22088,7 +22394,7 @@ ${block}
22088
22394
 
22089
22395
  `;
22090
22396
  }
22091
- function operatorSection2() {
22397
+ function operatorSection3() {
22092
22398
  const block = buildOperatorBlock();
22093
22399
  if (!block) return "";
22094
22400
  return `${block}
@@ -22098,7 +22404,7 @@ function operatorSection2() {
22098
22404
  function buildSystemPrompt() {
22099
22405
  const stable = `You are an expert GTM health investigator. You have tools to query a local database of CRM and pipeline data. Your job is to investigate the health scores you've been given and discover the specific root causes behind any problems.
22100
22406
 
22101
- ${companyContextSection2()}${operatorSection2()}INVESTIGATION APPROACH:
22407
+ ${companyContextSection3()}${operatorSection3()}INVESTIGATION APPROACH:
22102
22408
  1. Start by examining the health summary to understand the overall picture
22103
22409
  2. Drill into the lowest-scoring vital signs using get_vital_sign_detail
22104
22410
  3. Check divergences to find segments that are significantly worse than average
@@ -22287,7 +22593,7 @@ ${buildPlaybookBlock()}
22287
22593
  ${commandSection}`;
22288
22594
  const stable = `You are a world-class GTM operating partner \u2014 the kind of analyst a CEO keeps on speed dial. You are exceptionally well-read, rigorous, and commercially sharp, and you have tools to query a local database of this company's CRM and pipeline data. The user is having an ongoing, free-form conversation with you about their go-to-market health and SaaS metrics.
22289
22595
 
22290
- ${companyContextSection2()}${operatorSection2()}${conversationRules}
22596
+ ${companyContextSection3()}${operatorSection3()}${conversationRules}
22291
22597
 
22292
22598
  ${analystSection}
22293
22599
 
@@ -22333,20 +22639,27 @@ async function* agenticFindings(computeResult, divergences, options) {
22333
22639
  assertReplAi(options.ctx);
22334
22640
  const mode = options.mode ?? "investigation";
22335
22641
  const experiment = options.experiment ?? "production";
22336
- const responseMode = experiment === "baseline" || experiment === "a" || experiment === "b" ? "deep" : options.responseMode ?? (options.sessionArtifact ? "brief" : "deep");
22337
- const useTools = mode === "investigation" || responseMode === "deep";
22642
+ const responseMode = mode === "think" ? "deep" : experiment === "baseline" || experiment === "a" || experiment === "b" ? "deep" : options.responseMode ?? (options.sessionArtifact ? "brief" : "deep");
22643
+ const useTools = mode === "investigation" || mode === "think" || responseMode === "deep";
22338
22644
  const maxTokens = mode === "fresh" && responseMode === "brief" ? BRIEF_MAX_TOKENS : DEEP_MAX_TOKENS;
22339
22645
  const surface = mode === "fresh" ? responseMode === "brief" ? "agentic_fresh_brief" : "agentic_investigation" : "agentic_investigation";
22340
22646
  const llmCfg = loadLlmConfig();
22341
22647
  const tier = tierForSurface(surface, llmCfg.tier);
22342
- const systemPrompt = mode === "fresh" ? buildFreshNlSystemPrompt(
22648
+ const systemPrompt = mode === "think" ? buildThinkWithMeSystemPrompt({
22649
+ sessionContext: options.sessionContext,
22650
+ memoryBlock: options.memoryBlock,
22651
+ analysisBlock: options.analysisBlock,
22652
+ conversationBlock: options.conversationBlock,
22653
+ sessionArtifact: options.sessionArtifact,
22654
+ thinkState: options.ctx.thinkState
22655
+ }) : mode === "fresh" ? buildFreshNlSystemPrompt(
22343
22656
  options.sessionContext,
22344
22657
  options.memoryBlock,
22345
22658
  options.analysisBlock,
22346
22659
  options.conversationBlock,
22347
22660
  { responseMode, sessionArtifact: options.sessionArtifact, experiment }
22348
22661
  ) : buildSystemPrompt();
22349
- const tools = useTools ? mode === "fresh" ? buildFreshNlTools() : buildInvestigationTools() : [];
22662
+ const tools = useTools ? mode === "think" ? buildThinkTools() : mode === "fresh" ? buildFreshNlTools() : buildInvestigationTools() : [];
22350
22663
  const toolCtx = { computeResult, divergences };
22351
22664
  if (options.includeMetrics) {
22352
22665
  try {
@@ -22358,7 +22671,8 @@ async function* agenticFindings(computeResult, divergences, options) {
22358
22671
  const initialContext = buildInitialContext(computeResult, divergences, options.userQuestion);
22359
22672
  const priorRaw = options.priorMessages ?? [];
22360
22673
  const priorMessages = priorRaw.length > 0 && typeof priorRaw[0] === "object" && priorRaw[0] !== null && "content" in priorRaw[0] ? normalizeThread(priorRaw) : priorRaw;
22361
- const messages = mode === "fresh" && priorMessages.length > 0 && options.userQuestion ? [...priorMessages, { role: "user", content: options.userQuestion }] : [{ role: "user", content: initialContext }];
22674
+ const conversational = mode === "fresh" || mode === "think";
22675
+ const messages = conversational && priorMessages.length > 0 && options.userQuestion ? [...priorMessages, { role: "user", content: options.userQuestion }] : [{ role: "user", content: initialContext }];
22362
22676
  let lastMeta = { provider_used: "anthropic", model_used: "unknown" };
22363
22677
  const loopGuard = new ToolLoopGuard();
22364
22678
  const allowedTools = new Set(tools.map((t) => t.name));
@@ -22388,7 +22702,7 @@ async function* agenticFindings(computeResult, divergences, options) {
22388
22702
  const response = await callLlm(messages, maxTokens, true);
22389
22703
  if (response.tool_calls.length === 0) {
22390
22704
  const fullText = response.text;
22391
- if (mode === "fresh") {
22705
+ if (conversational) {
22392
22706
  const findings3 = parseFindings(fullText);
22393
22707
  if (findings3.length > 0) {
22394
22708
  for (const finding of findings3) yield { type: "finding", finding };
@@ -22436,7 +22750,7 @@ async function* agenticFindings(computeResult, divergences, options) {
22436
22750
  });
22437
22751
  }
22438
22752
  }
22439
- if (mode === "fresh") {
22753
+ if (conversational) {
22440
22754
  messages.push({
22441
22755
  role: "user",
22442
22756
  content: "You've reached the tool budget. Please answer the user's question now with what you've learned."
@@ -22512,6 +22826,7 @@ var init_agentic_loop = __esm({
22512
22826
  init_thread();
22513
22827
  init_untrusted();
22514
22828
  init_prompt_parts();
22829
+ init_think_prompt();
22515
22830
  MAX_ITERATIONS = 10;
22516
22831
  INVESTIGATION_EVIDENCE_NUDGE_AFTER = 5;
22517
22832
  BRIEF_MAX_TOKENS = 768;
@@ -24646,6 +24961,7 @@ async function pickUp(idArg, ctx) {
24646
24961
  sessionName: session.name,
24647
24962
  messages: [...session.messages],
24648
24963
  conversation: session.thread ? [...session.thread] : [],
24964
+ thinkConversation: session.think_thread ? [...session.think_thread] : [],
24649
24965
  resumedSessionSummary: session.summary,
24650
24966
  stage: session.stage ?? (session.messages.length > 0 ? "analyzed" : "new"),
24651
24967
  dataset: session.dataset,
@@ -24655,6 +24971,7 @@ async function pickUp(idArg, ctx) {
24655
24971
  attachments: session.attachments,
24656
24972
  llm: session.llm ? { ...session.llm } : void 0,
24657
24973
  strategistState: session.strategist,
24974
+ thinkState: session.think,
24658
24975
  pendingAsk: session.pending_ask
24659
24976
  });
24660
24977
  ctx.datasetPath = datasetPathForSession(target.id);
@@ -24676,6 +24993,12 @@ async function pickUp(idArg, ctx) {
24676
24993
  " " + chalk27.yellow("Resuming mid-strategy") + (objective ? chalk27.dim(`: "${objective}"`) : "") + chalk27.dim(" \u2014 say ") + chalk27.cyan("yes") + chalk27.dim(" to continue or ") + chalk27.cyan("cancel") + chalk27.dim(" to drop it.")
24677
24994
  );
24678
24995
  }
24996
+ if (session.think && session.think.step === "active") {
24997
+ const seed = session.think.seed;
24998
+ console.log(
24999
+ " " + chalk27.yellow("Resuming think channel") + (seed ? chalk27.dim(`: "${seed}"`) : "") + chalk27.dim(" \u2014 keep exploring or type ") + chalk27.cyan("done") + chalk27.dim(" / ") + chalk27.cyan("cancel") + chalk27.dim(" to leave.")
25000
+ );
25001
+ }
24679
25002
  const contextPath = contextDocPathForSession(target.id);
24680
25003
  if (existsSync26(contextPath)) {
24681
25004
  console.log(" " + chalk27.dim("Context brief: ") + chalk27.dim(contextPath));
@@ -27180,7 +27503,7 @@ var init_strategist = __esm({
27180
27503
  });
27181
27504
 
27182
27505
  // src/ai/strategist-prompt.ts
27183
- function companyContextSection3() {
27506
+ function companyContextSection4() {
27184
27507
  const block = buildCompanyProfileBlock();
27185
27508
  if (!block) return "";
27186
27509
  return `COMPANY CONTEXT (ground every constraint, timeline, and dollar figure in this business):
@@ -27188,7 +27511,7 @@ ${block}
27188
27511
 
27189
27512
  `;
27190
27513
  }
27191
- function operatorSection3() {
27514
+ function operatorSection4() {
27192
27515
  const block = buildOperatorBlock();
27193
27516
  if (!block) return "";
27194
27517
  return `${block}
@@ -27200,7 +27523,7 @@ function buildStrategistSystemPrompt(todayIso) {
27200
27523
 
27201
27524
  Today's date is ${todayIso}. All milestone and check dates must be real future calendar dates computed from today.
27202
27525
 
27203
- ${companyContextSection3()}${operatorSection3()}HOW YOU THINK (the strategist method \u2014 reverse operator thinking):
27526
+ ${companyContextSection4()}${operatorSection4()}HOW YOU THINK (the strategist method \u2014 reverse operator thinking):
27204
27527
  1. DEFINE THE DESTINATION. A strategy starts from a measurable objective, not from a list of problems.
27205
27528
  2. GROUND IN VERIFIED REALITY. Every number you use must come from a tool call or provided context. If you didn't verify it, it is an assumption and must be labeled as one.
27206
27529
  3. BACKCAST THE DEPENDENCY CHAIN. Work backwards from the objective: what must be true immediately before it holds? And before that? Sequence by dependency, not by severity.
@@ -32608,39 +32931,368 @@ var init_privacy_notice = __esm({
32608
32931
  }
32609
32932
  });
32610
32933
 
32934
+ // src/services/think.ts
32935
+ var think_exports = {};
32936
+ __export(think_exports, {
32937
+ runThinkTurn: () => runThinkTurn
32938
+ });
32939
+ import chalk65 from "chalk";
32940
+ async function runThinkTurn(input, ctx) {
32941
+ assertReplAi(ctx);
32942
+ let snapshot = ctx.snapshot.computeResult;
32943
+ if (!snapshot) {
32944
+ const metricsFirst = prefersMetricsFirstContext(ctx);
32945
+ const spinner2 = makeSpinner(metricsFirst ? "Loading session context\u2026" : "Computing vital signs\u2026");
32946
+ try {
32947
+ snapshot = await computeFullHealth();
32948
+ ctx.snapshot.computeResult = snapshot;
32949
+ const divInput = snapshot.segments.map((s) => ({
32950
+ segmentId: s.segment.id,
32951
+ segmentName: s.segment.name,
32952
+ result: s.result
32953
+ }));
32954
+ ctx.snapshot.divergences = detectDivergences(snapshot.aggregate, divInput).divergences;
32955
+ spinner2.succeed(metricsFirst ? "Session context ready" : "Health snapshot ready");
32956
+ } catch (err) {
32957
+ spinner2.fail("Could not compute health snapshot");
32958
+ console.error(" " + chalk65.red(String(err.message ?? err)));
32959
+ console.log(" " + chalk65.dim("Run ") + paint("accent", "/new") + chalk65.dim(" \u2192 pick Demo to load sample data."));
32960
+ console.log();
32961
+ return;
32962
+ }
32963
+ }
32964
+ console.log();
32965
+ const memoryBlock = await buildMemoryBlock(input).catch(() => "");
32966
+ const spinner = makeSpinner("Thinking with you\u2026");
32967
+ let lastAnswer = "";
32968
+ let rawHistory = [];
32969
+ const toolsUsed = [];
32970
+ setAgentContext(ctx);
32971
+ try {
32972
+ const analysisBlock = buildAnalysisBlock(ctx);
32973
+ const conversationBlock = getConversationPhaseBlock(ctx);
32974
+ const bundle = await loadSessionAnalysisBundle();
32975
+ const sessionArtifact = hasAnyAnalysis(bundle) ? buildExploreContextBlock(bundle, ctx) : "";
32976
+ for await (const event of agenticFindings(snapshot, ctx.snapshot.divergences, {
32977
+ mode: "think",
32978
+ userQuestion: input,
32979
+ sessionContext: ctx.resumedSessionSummary,
32980
+ includeMetrics: true,
32981
+ analysisBlock,
32982
+ conversationBlock,
32983
+ sessionArtifact,
32984
+ priorMessages: ctx.thinkConversation,
32985
+ memoryBlock,
32986
+ ctx
32987
+ })) {
32988
+ switch (event.type) {
32989
+ case "tool_call":
32990
+ toolsUsed.push(event.name);
32991
+ spinner.text = `Querying ${event.name}\u2026`;
32992
+ break;
32993
+ case "thinking":
32994
+ spinner.stop();
32995
+ console.log(" " + chalk65.dim.italic(event.text));
32996
+ spinner.start("Thinking with you\u2026");
32997
+ break;
32998
+ case "answer":
32999
+ spinner.stop();
33000
+ lastAnswer = event.text;
33001
+ printMarkdown(event.text, { indent: 2 });
33002
+ break;
33003
+ case "finding":
33004
+ spinner.stop();
33005
+ printFindingInline2(event.finding);
33006
+ break;
33007
+ case "done":
33008
+ spinner.stop();
33009
+ rawHistory = event.conversation_history;
33010
+ break;
33011
+ }
33012
+ }
33013
+ } catch (err) {
33014
+ spinner.fail("Error while thinking");
33015
+ console.error(" " + chalk65.red(String(err.message ?? err)));
33016
+ console.log();
33017
+ return;
33018
+ } finally {
33019
+ setAgentContext(null);
33020
+ }
33021
+ if (rawHistory.length > 0) {
33022
+ ctx.thinkConversation = distillThread(rawHistory);
33023
+ }
33024
+ if (!lastAnswer) {
33025
+ console.log(" " + chalk65.dim("(no answer returned)"));
33026
+ } else {
33027
+ recordMessage(ctx, "agent", lastAnswer);
33028
+ saveSessionState(ctx);
33029
+ creditNlAnswer(ctx, Math.floor(ctx.messages.length / 2));
33030
+ recordAnalysis({
33031
+ question: `[think] ${input}`,
33032
+ answer: lastAnswer,
33033
+ tools: toolsUsed,
33034
+ session_id: ctx.sessionId
33035
+ });
33036
+ ctx.lastExchange = { question: input, answer: lastAnswer };
33037
+ }
33038
+ console.log();
33039
+ return lastAnswer ? extractSummary2(lastAnswer) : void 0;
33040
+ }
33041
+ function extractSummary2(text) {
33042
+ const plain = text.replace(/#{1,6}\s+/g, "").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/`([^`]+)`/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/^[-*]\s+/gm, "").trim();
33043
+ const sentenceMatch = plain.match(/^(.+?[.!?])(?:\s|$)/);
33044
+ const sentence = sentenceMatch ? sentenceMatch[1] : plain.split("\n")[0];
33045
+ if (sentence.length <= 60) return sentence;
33046
+ return sentence.slice(0, 60).replace(/\s+\S*$/, "") + "\u2026";
33047
+ }
33048
+ function printFindingInline2(finding) {
33049
+ const sev = finding.severity;
33050
+ console.log();
33051
+ console.log(
33052
+ " " + severityPaint(sev)(sev.toUpperCase()) + " " + (finding.finding ?? "").slice(0, 120)
33053
+ );
33054
+ }
33055
+ var init_think = __esm({
33056
+ "src/services/think.ts"() {
33057
+ "use strict";
33058
+ init_spinner();
33059
+ init_context2();
33060
+ init_phase();
33061
+ init_agent_context();
33062
+ init_agentic_loop();
33063
+ init_thread();
33064
+ init_store2();
33065
+ init_health_score();
33066
+ init_divergence();
33067
+ init_repl_api();
33068
+ init_theme();
33069
+ init_markdown();
33070
+ init_session_analysis();
33071
+ init_time_bank();
33072
+ }
33073
+ });
33074
+
33075
+ // src/conversation/think-flow.ts
33076
+ var think_flow_exports = {};
33077
+ __export(think_flow_exports, {
33078
+ clearThinkFlow: () => clearThinkFlow,
33079
+ extractThinkSeed: () => extractThinkSeed,
33080
+ handleThinkFlow: () => handleThinkFlow,
33081
+ isThinkIntent: () => isThinkIntent,
33082
+ queueThinkForAnalysis: () => queueThinkForAnalysis,
33083
+ resumeThinkAfterCompute: () => resumeThinkAfterCompute,
33084
+ resumeThinkAfterConnect: () => resumeThinkAfterConnect,
33085
+ startThinkFlow: () => startThinkFlow
33086
+ });
33087
+ import chalk66 from "chalk";
33088
+ function isThinkIntent(input) {
33089
+ const line = input.trim();
33090
+ if (!line) return false;
33091
+ if (isShipIntent(line)) return false;
33092
+ if (isStrategistIntent(line)) return false;
33093
+ return THINK_INTENT_RE.test(line);
33094
+ }
33095
+ function extractThinkSeed(input) {
33096
+ const cleaned = input.trim().replace(/^(hey|ok|okay|please|can you|could you|help me|let'?s|i want to|i'?d like to)\s+/i, "").replace(/^(think\s+with\s+me|pressure[- ]?test|dig\s+into|think\s+through)\s*(about|on|around|this|:)?\s*/i, "").replace(/^(what\s+am\s+i\s+missing\s*(about|on|with|here)?)\s*/i, "").trim();
33097
+ return cleaned.length >= 4 ? cleaned : input.trim();
33098
+ }
33099
+ function queueThinkForAnalysis(ctx, opts) {
33100
+ ctx.thinkState = {
33101
+ step: "awaiting_analysis",
33102
+ seed: opts.seed,
33103
+ origin: opts.origin,
33104
+ started_at: (/* @__PURE__ */ new Date()).toISOString()
33105
+ };
33106
+ saveSessionState(ctx);
33107
+ console.log();
33108
+ console.log(
33109
+ " " + chalk66.dim("Think session queued. NTRP opens the channel after analysis.")
33110
+ );
33111
+ if (opts.origin !== "nl") {
33112
+ console.log(
33113
+ " " + chalk66.dim("Type what to look at. Paste a CSV path. Or type ") + chalk66.cyan("use demo data") + chalk66.dim(".")
33114
+ );
33115
+ }
33116
+ console.log();
33117
+ }
33118
+ function printChannelIntro(seed) {
33119
+ console.log();
33120
+ console.log(" " + paint("accent", "Think with me"));
33121
+ console.log(
33122
+ " " + chalk66.dim(
33123
+ "Socratic channel \u2014 explore, challenge assumptions, pull evidence. Type "
33124
+ ) + chalk66.cyan("done") + chalk66.dim(" or ") + chalk66.cyan("cancel") + chalk66.dim(" to return to ask \u203A.")
33125
+ );
33126
+ if (seed) {
33127
+ console.log(" " + chalk66.dim("Seed: ") + seed);
33128
+ }
33129
+ console.log();
33130
+ }
33131
+ function armKeylessThink(ctx, opts) {
33132
+ ctx.thinkState = {
33133
+ step: "awaiting_connect",
33134
+ seed: opts.seed,
33135
+ origin: opts.origin,
33136
+ started_at: (/* @__PURE__ */ new Date()).toISOString()
33137
+ };
33138
+ saveSessionState(ctx);
33139
+ console.log();
33140
+ console.log(" " + chalk66.dim("Think channel needs an AI key."));
33141
+ console.log(
33142
+ " " + chalk66.dim("Type ") + paint("accent", "/connect") + chalk66.dim(" and paste a key. Seed kept \u2014 the channel opens after connect.")
33143
+ );
33144
+ console.log();
33145
+ }
33146
+ async function startThinkFlow(ctx, opts) {
33147
+ if (!isAnalysisReady(ctx)) {
33148
+ queueThinkForAnalysis(ctx, opts);
33149
+ return "Think queued";
33150
+ }
33151
+ if (!canUseReplAi(ctx)) {
33152
+ armKeylessThink(ctx, opts);
33153
+ return "Think awaiting connect";
33154
+ }
33155
+ const seed = opts.seed?.trim() || void 0;
33156
+ ctx.thinkState = {
33157
+ step: "active",
33158
+ seed,
33159
+ origin: opts.origin,
33160
+ started_at: (/* @__PURE__ */ new Date()).toISOString(),
33161
+ open_questions: [],
33162
+ challenged_assumptions: [],
33163
+ working_hypotheses: []
33164
+ };
33165
+ if (ctx.thinkConversation.length === 0 && seed) {
33166
+ }
33167
+ saveSessionState(ctx);
33168
+ printChannelIntro(seed);
33169
+ recordMessage(ctx, "agent", seed ? `Think channel opened: ${seed}` : "Think channel opened");
33170
+ if (seed) {
33171
+ recordMessage(ctx, "user", seed);
33172
+ const { runThinkTurn: runThinkTurn2 } = await Promise.resolve().then(() => (init_think(), think_exports));
33173
+ await runThinkTurn2(seed, ctx);
33174
+ }
33175
+ return "Think channel open";
33176
+ }
33177
+ async function resumeThinkAfterCompute(ctx) {
33178
+ const state2 = ctx.thinkState;
33179
+ if (!state2 || state2.step !== "awaiting_analysis") return;
33180
+ if (ctx.strategistState && ctx.strategistState.step !== "awaiting_analysis" && ctx.strategistState.step !== "awaiting_connect") {
33181
+ return;
33182
+ }
33183
+ if (ctx.strategistState?.step === "awaiting_analysis") return;
33184
+ console.log();
33185
+ console.log(" " + paint("accent", "Analysis is ready. The think channel continues."));
33186
+ await startThinkFlow(ctx, {
33187
+ seed: state2.seed,
33188
+ origin: state2.origin ?? "nl"
33189
+ });
33190
+ }
33191
+ async function resumeThinkAfterConnect(ctx) {
33192
+ const state2 = ctx.thinkState;
33193
+ if (!state2 || state2.step !== "awaiting_connect") return false;
33194
+ if (!canUseReplAi(ctx)) return false;
33195
+ console.log();
33196
+ console.log(" " + paint("accent", "Key connected. Opening the think channel."));
33197
+ await startThinkFlow(ctx, {
33198
+ seed: state2.seed,
33199
+ origin: state2.origin ?? "nl"
33200
+ });
33201
+ return true;
33202
+ }
33203
+ function clearThinkFlow(ctx, reason) {
33204
+ ctx.thinkState = void 0;
33205
+ saveSessionState(ctx);
33206
+ if (reason === "handoff") return;
33207
+ console.log();
33208
+ console.log(
33209
+ " " + chalk66.dim(
33210
+ reason === "done" ? "Think channel closed. Back to ask \u203A." : "Think session cancelled. Continue exploration."
33211
+ )
33212
+ );
33213
+ console.log();
33214
+ }
33215
+ async function handleThinkFlow(input, ctx) {
33216
+ const state2 = ctx.thinkState;
33217
+ if (!state2 || state2.step !== "active") return;
33218
+ const line = input.trim();
33219
+ recordMessage(ctx, "user", line);
33220
+ if (CANCEL_RE2.test(line) || DONE_RE.test(line)) {
33221
+ clearThinkFlow(ctx, CANCEL_RE2.test(line) ? "cancel" : "done");
33222
+ recordMessage(ctx, "agent", "Think channel closed");
33223
+ return "Think closed";
33224
+ }
33225
+ if (isStrategistIntent(line)) {
33226
+ clearThinkFlow(ctx, "handoff");
33227
+ const summary = await startStrategistFlow(ctx, {
33228
+ seed: extractObjectiveSeed(line),
33229
+ origin: "nl"
33230
+ }) ?? void 0;
33231
+ return summary ?? "Handed off to strategist";
33232
+ }
33233
+ if (!canUseReplAi(ctx)) {
33234
+ armKeylessThink(ctx, { seed: state2.seed ?? line, origin: state2.origin ?? "nl" });
33235
+ return "Think awaiting connect";
33236
+ }
33237
+ const { runThinkTurn: runThinkTurn2 } = await Promise.resolve().then(() => (init_think(), think_exports));
33238
+ await runThinkTurn2(line, ctx);
33239
+ if (ctx.strategistState && ctx.strategistState.step !== "awaiting_analysis" && ctx.strategistState.step !== "awaiting_connect") {
33240
+ clearThinkFlow(ctx, "handoff");
33241
+ const { promptQueuedAiStrategist: promptQueuedAiStrategist2 } = await Promise.resolve().then(() => (init_strategist_flow(), strategist_flow_exports));
33242
+ promptQueuedAiStrategist2(ctx);
33243
+ }
33244
+ return "Think turn";
33245
+ }
33246
+ var THINK_INTENT_RE, CANCEL_RE2, DONE_RE;
33247
+ var init_think_flow = __esm({
33248
+ "src/conversation/think-flow.ts"() {
33249
+ "use strict";
33250
+ init_context2();
33251
+ init_repl_api();
33252
+ init_theme();
33253
+ init_handoff_draft();
33254
+ init_strategist_flow();
33255
+ THINK_INTENT_RE = /\b(think\s+with\s+me|pressure[- ]?test|what\s+am\s+i\s+missing|challenge\s+(my\s+)?(assumption|thinking|hypothesis)|let'?s\s+(dig|explore|think|pressure)|dig\s+into|steelman|devil'?s\s+advocate|think\s+through|brainstorm\s+(with\s+me|this)|socratic)\b/i;
33256
+ CANCEL_RE2 = /^(cancel|stop|quit|abort|never\s?mind|nevermind|forget it)\s*[.!]?\s*$/i;
33257
+ DONE_RE = /^(done|enough|enough for now|that'?s enough|leave|exit think)\s*[.!]?\s*$/i;
33258
+ }
33259
+ });
33260
+
32611
33261
  // src/commands/connect.ts
32612
33262
  var connect_exports2 = {};
32613
33263
  __export(connect_exports2, {
32614
33264
  handler: () => handler39
32615
33265
  });
32616
- import chalk65 from "chalk";
33266
+ import chalk67 from "chalk";
32617
33267
  function usage2() {
32618
- console.log(chalk65.dim(" Paste a key inside ntrp. Type /connect and press Enter."));
32619
- console.log(chalk65.dim(" Scripts: ntrp connect --key <key>"));
32620
- console.log(chalk65.dim(" Named provider: /connect anthropic (or ollama, no key)"));
32621
- console.log(chalk65.dim(" Custom endpoint (scripts): --base-url <url> [--id <name>]"));
33268
+ console.log(chalk67.dim(" Paste a key inside ntrp. Type /connect and press Enter."));
33269
+ console.log(chalk67.dim(" Scripts: ntrp connect --key <key>"));
33270
+ console.log(chalk67.dim(" Named provider: /connect anthropic (or ollama, no key)"));
33271
+ console.log(chalk67.dim(" Custom endpoint (scripts): --base-url <url> [--id <name>]"));
32622
33272
  }
32623
33273
  function printOutcome(outcome, ctx) {
32624
33274
  console.log();
32625
33275
  const [headline, ...rest] = describeConnectOutcome(outcome);
32626
- console.log(" " + paint("success", "\u2713") + " " + chalk65.bold(headline ?? ""));
33276
+ console.log(" " + paint("success", "\u2713") + " " + chalk67.bold(headline ?? ""));
32627
33277
  for (const line of rest) {
32628
- console.log(" " + chalk65.dim(line));
33278
+ console.log(" " + chalk67.dim(line));
32629
33279
  }
32630
33280
  console.log();
32631
- console.log(" " + chalk65.dim(`Using ${formatActiveStack(ctx)}`));
32632
- console.log(" " + chalk65.dim("Type a question to try it. Type /provider to switch providers."));
33281
+ console.log(" " + chalk67.dim(`Using ${formatActiveStack(ctx)}`));
33282
+ console.log(" " + chalk67.dim("Type a question to try it. Type /provider to switch providers."));
32633
33283
  console.log();
32634
- console.log(" " + chalk65.dim("What leaves this machine"));
33284
+ console.log(" " + chalk67.dim("What leaves this machine"));
32635
33285
  for (const line of PRIVACY_NOTICE_LINES.slice(0, 8)) {
32636
- console.log(" " + chalk65.dim(line));
33286
+ console.log(" " + chalk67.dim(line));
32637
33287
  }
32638
- console.log(" " + chalk65.dim("Type /privacy to read the full notice."));
33288
+ console.log(" " + chalk67.dim("Type /privacy to read the full notice."));
32639
33289
  console.log();
32640
33290
  }
32641
33291
  async function replayAfterConnect(ctx) {
32642
33292
  const { resumeStrategistAfterConnect: resumeStrategistAfterConnect2 } = await Promise.resolve().then(() => (init_strategist_flow(), strategist_flow_exports));
32643
33293
  if (await resumeStrategistAfterConnect2(ctx)) return;
33294
+ const { resumeThinkAfterConnect: resumeThinkAfterConnect2 } = await Promise.resolve().then(() => (init_think_flow(), think_flow_exports));
33295
+ if (await resumeThinkAfterConnect2(ctx)) return;
32644
33296
  if (!ctx.pendingAsk?.text) return;
32645
33297
  const { isAnalysisReady: isAnalysisReady2 } = await Promise.resolve().then(() => (init_context2(), context_exports));
32646
33298
  if (!isAnalysisReady2(ctx)) return;
@@ -32650,14 +33302,14 @@ async function replayAfterConnect(ctx) {
32650
33302
  function printError(err, ctx) {
32651
33303
  const message = err instanceof Error ? err.message : String(err);
32652
33304
  console.log();
32653
- console.log(" " + chalk65.red(message));
33305
+ console.log(" " + chalk67.red(message));
32654
33306
  console.log();
32655
33307
  if (ctx.oneShot) process.exit(1);
32656
33308
  }
32657
33309
  async function promptKey(session, label, opts = {}) {
32658
33310
  console.log();
32659
33311
  console.log(
32660
- " " + chalk65.dim("Paste once, press Enter. Stored in ") + paint("accent", "~/.ntrp/config.json") + chalk65.dim(" only.")
33312
+ " " + chalk67.dim("Paste once, press Enter. Stored in ") + paint("accent", "~/.ntrp/config.json") + chalk67.dim(" only.")
32661
33313
  );
32662
33314
  return session.askSecret(label, { confirm: false, allowEmpty: opts.allowEmpty });
32663
33315
  }
@@ -32690,7 +33342,7 @@ async function handler39(args, ctx) {
32690
33342
  if (baseUrl && !forcedSpec) {
32691
33343
  const id = customId ?? forcedProvider ?? hostToId(baseUrl);
32692
33344
  for (const warning of customEndpointWarnings(baseUrl)) {
32693
- console.log(" " + chalk65.yellow(warning));
33345
+ console.log(" " + chalk67.yellow(warning));
32694
33346
  }
32695
33347
  let key2 = inlineKey;
32696
33348
  if (!key2 && !ctx.oneShot && process.stdin.isTTY) {
@@ -32701,7 +33353,7 @@ async function handler39(args, ctx) {
32701
33353
  true
32702
33354
  );
32703
33355
  if (!proceed) {
32704
- console.log(" " + chalk65.dim("Cancelled."));
33356
+ console.log(" " + chalk67.dim("Cancelled."));
32705
33357
  console.log();
32706
33358
  return;
32707
33359
  }
@@ -32709,7 +33361,7 @@ async function handler39(args, ctx) {
32709
33361
  if (needsKey) key2 = await promptKey(session2, `API key for ${id}`);
32710
33362
  } catch (err) {
32711
33363
  if (err instanceof Error && err.message === "Cancelled") {
32712
- console.log(" " + chalk65.dim("Cancelled."));
33364
+ console.log(" " + chalk67.dim("Cancelled."));
32713
33365
  console.log();
32714
33366
  return;
32715
33367
  }
@@ -32732,11 +33384,11 @@ async function handler39(args, ctx) {
32732
33384
  }
32733
33385
  if (forcedProvider && !forcedSpec) {
32734
33386
  console.log();
32735
- console.log(" " + chalk65.red(`Unknown provider: ${forcedProvider}`));
33387
+ console.log(" " + chalk67.red(`Unknown provider: ${forcedProvider}`));
32736
33388
  console.log(
32737
- " " + chalk65.dim("Built-ins: anthropic, openai, google, groq, mistral, deepseek, xai, openrouter, together, fireworks, ollama")
33389
+ " " + chalk67.dim("Built-ins: anthropic, openai, google, groq, mistral, deepseek, xai, openrouter, together, fireworks, ollama")
32738
33390
  );
32739
- console.log(" " + chalk65.dim(`Custom endpoint: /connect --base-url <url> --id ${forcedProvider}`));
33391
+ console.log(" " + chalk67.dim(`Custom endpoint: /connect --base-url <url> --id ${forcedProvider}`));
32740
33392
  console.log();
32741
33393
  if (ctx.oneShot) process.exit(1);
32742
33394
  return;
@@ -32759,7 +33411,7 @@ async function handler39(args, ctx) {
32759
33411
  } catch (err) {
32760
33412
  session.close();
32761
33413
  if (err instanceof Error && err.message === "Cancelled") {
32762
- console.log(" " + chalk65.dim("Cancelled."));
33414
+ console.log(" " + chalk67.dim("Cancelled."));
32763
33415
  console.log();
32764
33416
  return;
32765
33417
  }
@@ -32767,7 +33419,7 @@ async function handler39(args, ctx) {
32767
33419
  }
32768
33420
  if (!key) {
32769
33421
  session.close();
32770
- console.log(" " + chalk65.dim("No key pasted \u2014 cancelled. Run ") + paint("accent", "/connect") + chalk65.dim(" when you have one."));
33422
+ console.log(" " + chalk67.dim("No key pasted \u2014 cancelled. Run ") + paint("accent", "/connect") + chalk67.dim(" when you have one."));
32771
33423
  console.log();
32772
33424
  return;
32773
33425
  }
@@ -32797,7 +33449,7 @@ async function handler39(args, ctx) {
32797
33449
  } catch (err) {
32798
33450
  spinner.stop();
32799
33451
  if (err instanceof ConnectCancelled) {
32800
- console.log(" " + chalk65.dim("Cancelled."));
33452
+ console.log(" " + chalk67.dim("Cancelled."));
32801
33453
  console.log();
32802
33454
  } else {
32803
33455
  printError(err, ctx);
@@ -32833,7 +33485,7 @@ var provider_exports = {};
32833
33485
  __export(provider_exports, {
32834
33486
  handler: () => handler40
32835
33487
  });
32836
- import chalk66 from "chalk";
33488
+ import chalk68 from "chalk";
32837
33489
  async function handler40(args, ctx) {
32838
33490
  const { positional, flags } = parseArgs2(args, ["default"]);
32839
33491
  const sub = positional[0]?.toLowerCase();
@@ -32846,7 +33498,7 @@ async function handler40(args, ctx) {
32846
33498
  if (!ctx.oneShot) saveSessionState(ctx);
32847
33499
  console.log();
32848
33500
  console.log(" " + paint("success", "\u2713") + " Session engine reset \u2014 using config defaults.");
32849
- console.log(" " + chalk66.dim(`Default: ${loadLlmConfig().primary}`));
33501
+ console.log(" " + chalk68.dim(`Default: ${loadLlmConfig().primary}`));
32850
33502
  console.log();
32851
33503
  return;
32852
33504
  }
@@ -32859,7 +33511,7 @@ async function handler40(args, ctx) {
32859
33511
  setConfigValue("llm-auto-failover", session.autoFailover ? "on" : "off");
32860
33512
  }
32861
33513
  console.log();
32862
- console.log(" " + paint("success", "\u2713") + ` Saved ${chalk66.bold(active)} as default engine.`);
33514
+ console.log(" " + paint("success", "\u2713") + ` Saved ${chalk68.bold(active)} as default engine.`);
32863
33515
  console.log();
32864
33516
  return;
32865
33517
  }
@@ -32878,28 +33530,28 @@ async function handler40(args, ctx) {
32878
33530
  }
32879
33531
  console.log();
32880
33532
  console.log(
32881
- " " + paint("success", "\u2713") + ` Auto-failover ${session.autoFailover ? chalk66.bold("on") : chalk66.bold("off")} for this session.`
33533
+ " " + paint("success", "\u2713") + ` Auto-failover ${session.autoFailover ? chalk68.bold("on") : chalk68.bold("off")} for this session.`
32882
33534
  );
32883
- if (persist) console.log(" " + chalk66.dim("Also saved as config default."));
33535
+ if (persist) console.log(" " + chalk68.dim("Also saved as config default."));
32884
33536
  console.log();
32885
33537
  return;
32886
33538
  }
32887
33539
  const spec = getProviderSpec(sub);
32888
33540
  if (!spec || RESERVED.has(sub)) {
32889
33541
  console.log();
32890
- console.log(" " + chalk66.red(`Unknown engine: ${sub}`));
32891
- console.log(" " + chalk66.dim("Usage: /provider [<id>|list|reset|save|failover on|off]"));
32892
- console.log(" " + chalk66.dim("Connected: ") + (availableEngineLabels().join(", ") || chalk66.dim("none")));
32893
- console.log(" " + chalk66.dim("Add one with ") + paint("accent", "/connect"));
33542
+ console.log(" " + chalk68.red(`Unknown engine: ${sub}`));
33543
+ console.log(" " + chalk68.dim("Usage: /provider [<id>|list|reset|save|failover on|off]"));
33544
+ console.log(" " + chalk68.dim("Connected: ") + (availableEngineLabels().join(", ") || chalk68.dim("none")));
33545
+ console.log(" " + chalk68.dim("Add one with ") + paint("accent", "/connect"));
32894
33546
  console.log();
32895
33547
  return;
32896
33548
  }
32897
33549
  const provider = spec.id;
32898
33550
  if (!hasProviderKey(provider)) {
32899
33551
  console.log();
32900
- console.log(" " + chalk66.red(`${spec.label} is not connected.`));
33552
+ console.log(" " + chalk68.red(`${spec.label} is not connected.`));
32901
33553
  console.log(
32902
- " " + chalk66.dim("Type ") + paint("accent", `/connect ${provider}`) + chalk66.dim(" (or ") + paint("accent", `/config set ${spec.key_config_name}`) + chalk66.dim(").")
33554
+ " " + chalk68.dim("Type ") + paint("accent", `/connect ${provider}`) + chalk68.dim(" (or ") + paint("accent", `/config set ${spec.key_config_name}`) + chalk68.dim(").")
32903
33555
  );
32904
33556
  console.log();
32905
33557
  return;
@@ -32907,11 +33559,11 @@ async function handler40(args, ctx) {
32907
33559
  ensureLlmSession(ctx).provider = provider;
32908
33560
  if (!ctx.oneShot) saveSessionState(ctx);
32909
33561
  console.log();
32910
- console.log(" " + paint("success", "\u2713") + ` Active engine: ${chalk66.bold(provider)}`);
32911
- console.log(" " + chalk66.dim(`Stack: ${formatActiveStack(ctx)}`));
33562
+ console.log(" " + paint("success", "\u2713") + ` Active engine: ${chalk68.bold(provider)}`);
33563
+ console.log(" " + chalk68.dim(`Stack: ${formatActiveStack(ctx)}`));
32912
33564
  const others = availableEngineLabels().filter((p) => p !== provider);
32913
33565
  if (others.length > 0) {
32914
- console.log(" " + chalk66.dim(`Also available: ${others.join(", ")}`));
33566
+ console.log(" " + chalk68.dim(`Also available: ${others.join(", ")}`));
32915
33567
  }
32916
33568
  console.log();
32917
33569
  }
@@ -32922,30 +33574,30 @@ function printStatus(ctx) {
32922
33574
  const autoFailover = resolveAutoFailoverEnabled(ctx);
32923
33575
  const engines = countAvailableEngines();
32924
33576
  console.log();
32925
- console.log(chalk66.bold(" LLM engines"));
33577
+ console.log(chalk68.bold(" LLM engines"));
32926
33578
  console.log(` Connected: ${engines} engine${engines === 1 ? "" : "s"}`);
32927
33579
  const configured = listProviderSpecs().filter((s) => hasProviderKey(s.id));
32928
33580
  for (const s of configured) {
32929
33581
  const marker2 = s.id === active ? paint("accent", " \u25BA active") : "";
32930
- console.log(` ${paint("success", "\u2713")} ${s.id}${s.custom ? chalk66.dim(" (custom)") : ""}${marker2}`);
33582
+ console.log(` ${paint("success", "\u2713")} ${s.id}${s.custom ? chalk68.dim(" (custom)") : ""}${marker2}`);
32931
33583
  }
32932
33584
  if (configured.length === 0) {
32933
- console.log(" " + chalk66.dim("none \u2014 run /connect and paste any provider key"));
33585
+ console.log(" " + chalk68.dim("none \u2014 run /connect and paste any provider key"));
32934
33586
  }
32935
33587
  console.log();
32936
- console.log(chalk66.bold(" Active stack"));
33588
+ console.log(chalk68.bold(" Active stack"));
32937
33589
  console.log(` ${formatActiveStack(ctx)}`);
32938
33590
  if (sessionOverride) {
32939
- console.log(chalk66.dim(" (session override \u2014 /provider reset to use default)"));
33591
+ console.log(chalk68.dim(" (session override \u2014 /provider reset to use default)"));
32940
33592
  } else {
32941
- console.log(chalk66.dim(` (config default: ${cfg.primary})`));
33593
+ console.log(chalk68.dim(` (config default: ${cfg.primary})`));
32942
33594
  }
32943
33595
  console.log();
32944
- console.log(` Auto-failover: ${autoFailover ? paint("success", "on") : chalk66.dim("off")}`);
32945
- console.log(chalk66.dim(` /provider <id> \u2014 switch engine (${configured.map((s) => s.id).join(", ") || "none connected"})`));
32946
- console.log(chalk66.dim(" /provider failover on|off \u2014 rate-limit safety net"));
32947
- console.log(chalk66.dim(" /provider save \u2014 persist active engine to config"));
32948
- console.log(chalk66.dim(" /connect \u2014 add another provider (any API key)"));
33596
+ console.log(` Auto-failover: ${autoFailover ? paint("success", "on") : chalk68.dim("off")}`);
33597
+ console.log(chalk68.dim(` /provider <id> \u2014 switch engine (${configured.map((s) => s.id).join(", ") || "none connected"})`));
33598
+ console.log(chalk68.dim(" /provider failover on|off \u2014 rate-limit safety net"));
33599
+ console.log(chalk68.dim(" /provider save \u2014 persist active engine to config"));
33600
+ console.log(chalk68.dim(" /connect \u2014 add another provider (any API key)"));
32949
33601
  console.log();
32950
33602
  }
32951
33603
  var RESERVED;
@@ -32968,7 +33620,7 @@ var tier_exports = {};
32968
33620
  __export(tier_exports, {
32969
33621
  handler: () => handler41
32970
33622
  });
32971
- import chalk67 from "chalk";
33623
+ import chalk69 from "chalk";
32972
33624
  async function handler41(args, ctx) {
32973
33625
  const { positional, flags } = parseArgs2(args, ["default"]);
32974
33626
  const sub = positional[0]?.toLowerCase();
@@ -32978,8 +33630,8 @@ async function handler41(args, ctx) {
32978
33630
  }
32979
33631
  if (!TIERS.includes(sub)) {
32980
33632
  console.log();
32981
- console.log(" " + chalk67.red(`Unknown tier: ${sub}`));
32982
- console.log(" " + chalk67.dim("Usage: /tier [high|medium|low|list] [--default]"));
33633
+ console.log(" " + chalk69.red(`Unknown tier: ${sub}`));
33634
+ console.log(" " + chalk69.dim("Usage: /tier [high|medium|low|list] [--default]"));
32983
33635
  console.log();
32984
33636
  return;
32985
33637
  }
@@ -32993,9 +33645,9 @@ async function handler41(args, ctx) {
32993
33645
  }
32994
33646
  console.log();
32995
33647
  console.log(
32996
- " " + paint("success", "\u2713") + ` Inference tier set to ${chalk67.bold(tier.toUpperCase())}` + (persist ? chalk67.dim(" (saved as default)") : chalk67.dim(" (this session)"))
33648
+ " " + paint("success", "\u2713") + ` Inference tier set to ${chalk69.bold(tier.toUpperCase())}` + (persist ? chalk69.dim(" (saved as default)") : chalk69.dim(" (this session)"))
32997
33649
  );
32998
- console.log(" " + chalk67.dim(`Stack: ${formatActiveStack(ctx)}`));
33650
+ console.log(" " + chalk69.dim(`Stack: ${formatActiveStack(ctx)}`));
32999
33651
  console.log();
33000
33652
  }
33001
33653
  function printCatalog(ctx) {
@@ -33004,37 +33656,37 @@ function printCatalog(ctx) {
33004
33656
  const sessionTier = ctx.llm?.tier;
33005
33657
  const providers = getAvailableProviders();
33006
33658
  console.log();
33007
- console.log(chalk67.bold(" Inference settings"));
33659
+ console.log(chalk69.bold(" Inference settings"));
33008
33660
  console.log(` Active: ${paint("accent", formatActiveStack(ctx))}`);
33009
33661
  if (sessionTier) {
33010
- console.log(chalk67.dim(" (session tier override)"));
33662
+ console.log(chalk69.dim(" (session tier override)"));
33011
33663
  } else {
33012
- console.log(chalk67.dim(` Config default tier: ${cfg.tier.toUpperCase()}`));
33664
+ console.log(chalk69.dim(` Config default tier: ${cfg.tier.toUpperCase()}`));
33013
33665
  }
33014
33666
  console.log();
33015
33667
  if (providers.length === 0) {
33016
- console.log(" " + chalk67.dim("No engines connected \u2014 run /connect and paste any provider key."));
33668
+ console.log(" " + chalk69.dim("No engines connected \u2014 run /connect and paste any provider key."));
33017
33669
  console.log();
33018
33670
  }
33019
33671
  for (const tier of TIERS) {
33020
- console.log(chalk67.bold(` ${tier.toUpperCase()}`));
33672
+ console.log(chalk69.bold(` ${tier.toUpperCase()}`));
33021
33673
  for (const provider of providers) {
33022
33674
  const modelId = resolveModelSafe(provider, tier);
33023
33675
  if (!modelId) {
33024
- console.log(` ${provider}/${chalk67.dim("no models \u2014 /model refresh")}`);
33676
+ console.log(` ${provider}/${chalk69.dim("no models \u2014 /model refresh")}`);
33025
33677
  continue;
33026
33678
  }
33027
33679
  const isActive = provider === active.provider && tier === active.tier && modelId === active.modelId;
33028
33680
  const marker2 = isActive ? paint("accent", "\u25BA ") : " ";
33029
33681
  const discovered = !!getProviderModels(provider);
33030
- const source = discovered ? "" : chalk67.dim(" [bundled fallback]");
33682
+ const source = discovered ? "" : chalk69.dim(" [bundled fallback]");
33031
33683
  console.log(`${marker2}${provider}/${modelId}${source}`);
33032
33684
  }
33033
33685
  console.log();
33034
33686
  }
33035
- console.log(chalk67.dim(" /tier high|medium|low \u2014 set tier for this session"));
33036
- console.log(chalk67.dim(" /tier high --default \u2014 also save as config default"));
33037
- console.log(chalk67.dim(" /provider <id> \u2014 switch engine \xB7 /model list \u2014 browse models"));
33687
+ console.log(chalk69.dim(" /tier high|medium|low \u2014 set tier for this session"));
33688
+ console.log(chalk69.dim(" /tier high --default \u2014 also save as config default"));
33689
+ console.log(chalk69.dim(" /provider <id> \u2014 switch engine \xB7 /model list \u2014 browse models"));
33038
33690
  console.log();
33039
33691
  }
33040
33692
  var TIERS;
@@ -33058,7 +33710,7 @@ var model_exports = {};
33058
33710
  __export(model_exports, {
33059
33711
  handler: () => handler42
33060
33712
  });
33061
- import chalk68 from "chalk";
33713
+ import chalk70 from "chalk";
33062
33714
  async function handler42(args, ctx) {
33063
33715
  const { positional, flags } = parseArgs2(args, ["default", "all"]);
33064
33716
  const sub = positional[0]?.toLowerCase();
@@ -33077,7 +33729,7 @@ async function handler42(args, ctx) {
33077
33729
  if (!ctx.oneShot) saveSessionState(ctx);
33078
33730
  console.log();
33079
33731
  console.log(" " + paint("success", "\u2713") + " Model override cleared \u2014 using tier defaults.");
33080
- console.log(" " + chalk68.dim(`Stack: ${formatActiveStack(ctx)}`));
33732
+ console.log(" " + chalk70.dim(`Stack: ${formatActiveStack(ctx)}`));
33081
33733
  console.log();
33082
33734
  return;
33083
33735
  }
@@ -33085,7 +33737,7 @@ async function handler42(args, ctx) {
33085
33737
  const modelId = positional[1];
33086
33738
  if (!modelId) {
33087
33739
  console.log();
33088
- console.log(" " + chalk68.red("Usage: /model set <model-id> [--default]"));
33740
+ console.log(" " + chalk70.red("Usage: /model set <model-id> [--default]"));
33089
33741
  console.log();
33090
33742
  return;
33091
33743
  }
@@ -33093,7 +33745,7 @@ async function handler42(args, ctx) {
33093
33745
  const providerErr = validateModelForProvider(modelId, active);
33094
33746
  if (providerErr) {
33095
33747
  console.log();
33096
- console.log(" " + chalk68.red(providerErr));
33748
+ console.log(" " + chalk70.red(providerErr));
33097
33749
  console.log();
33098
33750
  return;
33099
33751
  }
@@ -33102,11 +33754,11 @@ async function handler42(args, ctx) {
33102
33754
  if (cache2 && !known) {
33103
33755
  console.log();
33104
33756
  console.log(
33105
- " " + chalk68.yellow("\u26A0") + ` ${modelId} isn't in ${active}'s discovered list (` + paint("accent", "/model list") + `) \u2014 saving anyway.`
33757
+ " " + chalk70.yellow("\u26A0") + ` ${modelId} isn't in ${active}'s discovered list (` + paint("accent", "/model list") + `) \u2014 saving anyway.`
33106
33758
  );
33107
33759
  } else if (!cache2) {
33108
33760
  console.log();
33109
- console.log(" " + chalk68.yellow("\u26A0") + ` No discovered models for ${active} yet (` + paint("accent", "/model refresh") + `) \u2014 saving anyway.`);
33761
+ console.log(" " + chalk70.yellow("\u26A0") + ` No discovered models for ${active} yet (` + paint("accent", "/model refresh") + `) \u2014 saving anyway.`);
33110
33762
  }
33111
33763
  const persist = getBool(flags, "default");
33112
33764
  if (persist) {
@@ -33117,25 +33769,25 @@ async function handler42(args, ctx) {
33117
33769
  }
33118
33770
  console.log();
33119
33771
  console.log(
33120
- " " + paint("success", "\u2713") + ` Model: ${chalk68.bold(modelId)}` + (persist ? chalk68.dim(" (saved as default)") : chalk68.dim(" (this session)"))
33772
+ " " + paint("success", "\u2713") + ` Model: ${chalk70.bold(modelId)}` + (persist ? chalk70.dim(" (saved as default)") : chalk70.dim(" (this session)"))
33121
33773
  );
33122
- console.log(" " + chalk68.dim(`Stack: ${formatActiveStack(ctx)}`));
33774
+ console.log(" " + chalk70.dim(`Stack: ${formatActiveStack(ctx)}`));
33123
33775
  console.log();
33124
33776
  return;
33125
33777
  }
33126
33778
  const sessionOverride = ctx.llm?.modelOverride;
33127
33779
  const globalOverride = getConfigValue("llm-model-override");
33128
33780
  console.log();
33129
- console.log(chalk68.bold(" Model"));
33781
+ console.log(chalk70.bold(" Model"));
33130
33782
  if (sessionOverride) {
33131
33783
  console.log(` Session override: ${paint("accent", sessionOverride)}`);
33132
33784
  } else if (globalOverride) {
33133
33785
  console.log(` Config default: ${paint("accent", globalOverride)}`);
33134
33786
  } else {
33135
- console.log(" " + chalk68.dim("No override \u2014 tier defaults apply."));
33787
+ console.log(" " + chalk70.dim("No override \u2014 tier defaults apply."));
33136
33788
  }
33137
33789
  console.log(` Active stack: ${formatActiveStack(ctx)}`);
33138
- console.log(chalk68.dim(" /model list \xB7 /model set <id> \xB7 /model refresh \xB7 /model clear"));
33790
+ console.log(chalk70.dim(" /model list \xB7 /model set <id> \xB7 /model refresh \xB7 /model clear"));
33139
33791
  console.log();
33140
33792
  }
33141
33793
  function tierMarkers(cache2, modelId) {
@@ -33146,28 +33798,28 @@ function printModelList(ctx, showAll) {
33146
33798
  const active = resolveActiveProvider(ctx);
33147
33799
  const cache2 = getProviderModels(active);
33148
33800
  console.log();
33149
- console.log(chalk68.bold(` Models \u2014 ${active}`));
33801
+ console.log(chalk70.bold(` Models \u2014 ${active}`));
33150
33802
  if (!cache2) {
33151
- console.log(" " + chalk68.dim("Nothing discovered yet."));
33152
- console.log(" " + chalk68.dim("Run ") + paint("accent", "/model refresh") + chalk68.dim(" (or ") + paint("accent", "/connect") + chalk68.dim(" to add the provider)."));
33803
+ console.log(" " + chalk70.dim("Nothing discovered yet."));
33804
+ console.log(" " + chalk70.dim("Run ") + paint("accent", "/model refresh") + chalk70.dim(" (or ") + paint("accent", "/connect") + chalk70.dim(" to add the provider)."));
33153
33805
  console.log();
33154
33806
  return;
33155
33807
  }
33156
33808
  const fetchedAt = cache2.fetched_at.slice(0, 10);
33157
- console.log(" " + chalk68.dim(`${cache2.models.length} chat models \xB7 discovered ${fetchedAt} \xB7 /model refresh to update`));
33809
+ console.log(" " + chalk70.dim(`${cache2.models.length} chat models \xB7 discovered ${fetchedAt} \xB7 /model refresh to update`));
33158
33810
  console.log();
33159
33811
  const models = showAll ? cache2.models : cache2.models.slice(0, LIST_LIMIT);
33160
33812
  const noTools = new Set(cache2.quirks?.no_tools ?? []);
33161
33813
  for (const m of models) {
33162
- const name = m.display_name && m.display_name !== m.id ? chalk68.dim(` \u2014 ${m.display_name}`) : "";
33163
- const quirk = noTools.has(m.id) ? chalk68.yellow(" [no tools]") : "";
33814
+ const name = m.display_name && m.display_name !== m.id ? chalk70.dim(` \u2014 ${m.display_name}`) : "";
33815
+ const quirk = noTools.has(m.id) ? chalk70.yellow(" [no tools]") : "";
33164
33816
  console.log(` ${m.id}${name}${tierMarkers(cache2, m.id)}${quirk}`);
33165
33817
  }
33166
33818
  if (!showAll && cache2.models.length > models.length) {
33167
- console.log(" " + chalk68.dim(`\u2026 and ${cache2.models.length - models.length} more (/model list --all)`));
33819
+ console.log(" " + chalk70.dim(`\u2026 and ${cache2.models.length - models.length} more (/model list --all)`));
33168
33820
  }
33169
33821
  console.log();
33170
- console.log(" " + chalk68.dim("/model set <id> \u2014 pin one for this session (--default to persist)"));
33822
+ console.log(" " + chalk70.dim("/model set <id> \u2014 pin one for this session (--default to persist)"));
33171
33823
  console.log();
33172
33824
  }
33173
33825
  async function refreshModels(ctx) {
@@ -33176,13 +33828,13 @@ async function refreshModels(ctx) {
33176
33828
  const entry = await refreshProviderModels(active, { force: true });
33177
33829
  if (!entry) {
33178
33830
  spinner.fail(`Couldn't reach ${active} to refresh models.`);
33179
- console.log(" " + chalk68.dim("Check your connection and key, then retry. Cached models remain in use."));
33831
+ console.log(" " + chalk70.dim("Check your connection and key, then retry. Cached models remain in use."));
33180
33832
  console.log();
33181
33833
  return;
33182
33834
  }
33183
33835
  spinner.succeed(`${active}: ${entry.models.length} chat models discovered.`);
33184
- console.log(" " + chalk68.dim(`high ${entry.tier_stack.high} \xB7 medium ${entry.tier_stack.medium} \xB7 low ${entry.tier_stack.low}`));
33185
- console.log(" " + chalk68.dim(`Stack: ${formatActiveStack(ctx)}`));
33836
+ console.log(" " + chalk70.dim(`high ${entry.tier_stack.high} \xB7 medium ${entry.tier_stack.medium} \xB7 low ${entry.tier_stack.low}`));
33837
+ console.log(" " + chalk70.dim(`Stack: ${formatActiveStack(ctx)}`));
33186
33838
  console.log();
33187
33839
  }
33188
33840
  var LIST_LIMIT;
@@ -33442,7 +34094,7 @@ __export(update_exports, {
33442
34094
  handler: () => handler43
33443
34095
  });
33444
34096
  import { spawnSync as spawnSync2 } from "child_process";
33445
- import chalk69 from "chalk";
34097
+ import chalk71 from "chalk";
33446
34098
  function tailLines(text, count = 5) {
33447
34099
  return text.split("\n").map((line) => line.trimEnd()).filter((line) => line.length > 0).slice(-count).join("\n");
33448
34100
  }
@@ -33466,14 +34118,14 @@ async function handler43(_args, ctx) {
33466
34118
  const latest = await fetchLatestVersion(1e4);
33467
34119
  if (!latest) {
33468
34120
  console.log();
33469
- console.log(chalk69.yellow(" Could not reach the npm registry."));
33470
- console.log(chalk69.dim(` Try manually: npm install -g ${NPM_PACKAGE}`));
34121
+ console.log(chalk71.yellow(" Could not reach the npm registry."));
34122
+ console.log(chalk71.dim(` Try manually: npm install -g ${NPM_PACKAGE}`));
33471
34123
  console.log();
33472
34124
  return;
33473
34125
  }
33474
34126
  if (!isNewerVersion(latest, current)) {
33475
34127
  console.log();
33476
- console.log(chalk69.green(` \u2713 You are on the latest version (v${current})`));
34128
+ console.log(chalk71.green(` \u2713 You are on the latest version (v${current})`));
33477
34129
  console.log();
33478
34130
  return;
33479
34131
  }
@@ -33483,7 +34135,7 @@ async function handler43(_args, ctx) {
33483
34135
  if (ok) {
33484
34136
  invalidateUpdateCheckCache();
33485
34137
  if (ctx.oneShot) {
33486
- console.log(chalk69.green(` \u2713 Updated! ${updateRestartSummary(latest)}`));
34138
+ console.log(chalk71.green(` \u2713 Updated! ${updateRestartSummary(latest)}`));
33487
34139
  console.log();
33488
34140
  return;
33489
34141
  }
@@ -33495,7 +34147,7 @@ async function handler43(_args, ctx) {
33495
34147
  });
33496
34148
  if (failed) {
33497
34149
  const restart = updateRestartSummary(latest);
33498
- console.log(chalk69.green(` \u2713 Updated! ${restart}`));
34150
+ console.log(chalk71.green(` \u2713 Updated! ${restart}`));
33499
34151
  console.log();
33500
34152
  return restart;
33501
34153
  }
@@ -33503,18 +34155,18 @@ async function handler43(_args, ctx) {
33503
34155
  }
33504
34156
  const lower = output.toLowerCase();
33505
34157
  if (lower.includes("eacces") || lower.includes("permission denied") || lower.includes("eperm")) {
33506
- console.log(chalk69.red(` Could not install ${NPM_PACKAGE} (permission denied).`));
33507
- console.log(chalk69.dim(` Try: sudo npm install -g ${NPM_PACKAGE}`));
33508
- console.log(chalk69.dim(` Or fix npm global permissions: ${PERMISSIONS_URL}`));
34158
+ console.log(chalk71.red(` Could not install ${NPM_PACKAGE} (permission denied).`));
34159
+ console.log(chalk71.dim(` Try: sudo npm install -g ${NPM_PACKAGE}`));
34160
+ console.log(chalk71.dim(` Or fix npm global permissions: ${PERMISSIONS_URL}`));
33509
34161
  console.log();
33510
34162
  return;
33511
34163
  }
33512
34164
  const detail = tailLines(output);
33513
- console.log(chalk69.red(` Could not install ${NPM_PACKAGE}.`));
34165
+ console.log(chalk71.red(` Could not install ${NPM_PACKAGE}.`));
33514
34166
  if (detail) {
33515
- console.log(chalk69.dim(` ${detail.split("\n").join("\n ")}`));
34167
+ console.log(chalk71.dim(` ${detail.split("\n").join("\n ")}`));
33516
34168
  }
33517
- console.log(chalk69.dim(` Try manually: npm install -g ${NPM_PACKAGE}`));
34169
+ console.log(chalk71.dim(` Try manually: npm install -g ${NPM_PACKAGE}`));
33518
34170
  console.log();
33519
34171
  }
33520
34172
  var PERMISSIONS_URL;
@@ -33530,10 +34182,10 @@ var init_update = __esm({
33530
34182
  });
33531
34183
 
33532
34184
  // src/output/progress-report.ts
33533
- import chalk70 from "chalk";
34185
+ import chalk72 from "chalk";
33534
34186
  function printCard(title, rows) {
33535
34187
  const inner = CARD_W - 4;
33536
- const border = chalk70.dim;
34188
+ const border = chalk72.dim;
33537
34189
  console.log();
33538
34190
  console.log(` ${border(`\u256D${"\u2500".repeat(CARD_W - 2)}\u256E`)}`);
33539
34191
  console.log(` ${border("\u2502 ")}${padRight(sectionHeading(title), inner)}${border(" \u2502")}`);
@@ -33549,7 +34201,7 @@ function formatTokens(n) {
33549
34201
  return String(n);
33550
34202
  }
33551
34203
  function sparkline(values) {
33552
- if (values.length === 0) return chalk70.dim("(no activity yet)");
34204
+ if (values.length === 0) return chalk72.dim("(no activity yet)");
33553
34205
  const max = Math.max(...values, 1);
33554
34206
  const blocks = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
33555
34207
  return values.map((v) => {
@@ -33558,7 +34210,7 @@ function sparkline(values) {
33558
34210
  }).join("");
33559
34211
  }
33560
34212
  function formatMemberSince(iso) {
33561
- if (!iso) return chalk70.dim("\u2014");
34213
+ if (!iso) return chalk72.dim("\u2014");
33562
34214
  const d = new Date(iso);
33563
34215
  return d.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
33564
34216
  }
@@ -33580,25 +34232,25 @@ function renderProgressReport() {
33580
34232
  const nextLabel = bank.next_milestone ? `${formatHoursLabel(bank.total_hours)} \u2192 ${formatHoursLabel(bank.next_milestone.hours)}` : `${formatHoursLabel(bank.total_hours)} saved`;
33581
34233
  const bar = inlineBar(bank.progress_pct, 18);
33582
34234
  printCard("Progress", [
33583
- `${chalk70.dim("Hours saved")} ${paint("accent", formatHoursLabel(bank.total_hours))} ${bar}`,
33584
- `${chalk70.dim("Next milestone")} ${bank.next_milestone ? paint("accent", bank.next_milestone.title) : chalk70.dim("all complete")}`,
33585
- `${chalk70.dim("Member since")} ${formatMemberSince(usage4.first_active_at)}`,
33586
- `${chalk70.dim("Last active")} ${formatMemberSince(usage4.last_active_at)}`
34235
+ `${chalk72.dim("Hours saved")} ${paint("accent", formatHoursLabel(bank.total_hours))} ${bar}`,
34236
+ `${chalk72.dim("Next milestone")} ${bank.next_milestone ? paint("accent", bank.next_milestone.title) : chalk72.dim("all complete")}`,
34237
+ `${chalk72.dim("Member since")} ${formatMemberSince(usage4.first_active_at)}`,
34238
+ `${chalk72.dim("Last active")} ${formatMemberSince(usage4.last_active_at)}`
33587
34239
  ]);
33588
34240
  if (bank.perspective_line) {
33589
- console.log(` ${chalk70.dim(bank.perspective_line)}`);
34241
+ console.log(` ${chalk72.dim(bank.perspective_line)}`);
33590
34242
  }
33591
34243
  printCard("Activity", [
33592
- `${chalk70.dim("Sessions")} ${chalk70.bold(String(summary.total_sessions_on_disk))} total \xB7 ${summary.sessions_with_work} with analysis \xB7 ${usage4.sessions_closed} closed`,
33593
- `${chalk70.dim("Diagnoses")} ${chalk70.bold(String(usage4.diagnoses))}`,
33594
- `${chalk70.dim("Metrics runs")} ${chalk70.bold(String(usage4.metrics_runs))}`,
33595
- `${chalk70.dim("Deliverables")} ${chalk70.bold(String(usage4.deliverables))}`,
33596
- `${chalk70.dim("AI exchanges")} ${chalk70.bold(String(usage4.nl_exchanges))}`
34244
+ `${chalk72.dim("Sessions")} ${chalk72.bold(String(summary.total_sessions_on_disk))} total \xB7 ${summary.sessions_with_work} with analysis \xB7 ${usage4.sessions_closed} closed`,
34245
+ `${chalk72.dim("Diagnoses")} ${chalk72.bold(String(usage4.diagnoses))}`,
34246
+ `${chalk72.dim("Metrics runs")} ${chalk72.bold(String(usage4.metrics_runs))}`,
34247
+ `${chalk72.dim("Deliverables")} ${chalk72.bold(String(usage4.deliverables))}`,
34248
+ `${chalk72.dim("AI exchanges")} ${chalk72.bold(String(usage4.nl_exchanges))}`
33597
34249
  ]);
33598
34250
  const totalTokens = usage4.input_tokens + usage4.output_tokens;
33599
34251
  printCard("AI usage", [
33600
- `${chalk70.dim("LLM calls")} ${chalk70.bold(String(usage4.llm_calls))}`,
33601
- `${chalk70.dim("Tokens")} ${chalk70.bold(formatTokens(totalTokens))} in+out (${formatTokens(usage4.input_tokens)} in \xB7 ${formatTokens(usage4.output_tokens)} out)`
34252
+ `${chalk72.dim("LLM calls")} ${chalk72.bold(String(usage4.llm_calls))}`,
34253
+ `${chalk72.dim("Tokens")} ${chalk72.bold(formatTokens(totalTokens))} in+out (${formatTokens(usage4.input_tokens)} in \xB7 ${formatTokens(usage4.output_tokens)} out)`
33602
34254
  ]);
33603
34255
  const weeks = [...usage4.weekly].sort((a, b) => a.week.localeCompare(b.week)).slice(-8);
33604
34256
  const weekHours = weeks.map((w) => w.minutes_saved / 60);
@@ -33607,25 +34259,25 @@ function renderProgressReport() {
33607
34259
  console.log(` ${sectionHeading("Weekly hours saved")}`);
33608
34260
  console.log(` ${sparkline(weekHours)}`);
33609
34261
  if (weeks.length > 0) {
33610
- console.log(` ${chalk70.dim(weekLabels.join(" "))}`);
34262
+ console.log(` ${chalk72.dim(weekLabels.join(" "))}`);
33611
34263
  }
33612
34264
  console.log();
33613
34265
  console.log(` ${sectionHeading("Onboarding")}`);
33614
34266
  for (const m of ACTIVITY_MILESTONES) {
33615
34267
  const unlocked = state2.milestones_unlocked.includes(m.id);
33616
- const mark = unlocked ? badge("DONE", "success") : chalk70.dim("\u25CB");
33617
- console.log(` ${mark} ${chalk70.dim(m.title.padEnd(16))} ${unlocked ? chalk70.dim(m.message) : chalk70.dim("Type /deepdive")}`);
34268
+ const mark = unlocked ? badge("DONE", "success") : chalk72.dim("\u25CB");
34269
+ console.log(` ${mark} ${chalk72.dim(m.title.padEnd(16))} ${unlocked ? chalk72.dim(m.message) : chalk72.dim("Type /deepdive")}`);
33618
34270
  }
33619
34271
  console.log();
33620
34272
  console.log(` ${sectionHeading("Milestones")}`);
33621
34273
  for (const m of TIME_MILESTONES) {
33622
34274
  const unlocked = state2.milestones_unlocked.includes(m.id);
33623
34275
  const pct = Math.min(100, bank.total_hours / m.hours * 100);
33624
- const mark = unlocked ? badge("DONE", "success") : bank.total_hours >= m.hours * 0.85 ? badge("NEAR", "warning") : chalk70.dim("\u25CB");
34276
+ const mark = unlocked ? badge("DONE", "success") : bank.total_hours >= m.hours * 0.85 ? badge("NEAR", "warning") : chalk72.dim("\u25CB");
33625
34277
  const barW = 12;
33626
- const mBar = unlocked ? chalk70.hex("#22c55e")("\u2588".repeat(barW)) : scoreBar(pct, bank.total_hours >= m.hours ? "green" : pct >= 50 ? "yellow" : "red", barW);
34278
+ const mBar = unlocked ? chalk72.hex("#22c55e")("\u2588".repeat(barW)) : scoreBar(pct, bank.total_hours >= m.hours ? "green" : pct >= 50 ? "yellow" : "red", barW);
33627
34279
  const label = `${m.title}`.padEnd(16);
33628
- console.log(` ${mark} ${chalk70.dim(label)} ${mBar} ${chalk70.dim(`${m.hours}h`)}`);
34280
+ console.log(` ${mark} ${chalk72.dim(label)} ${mBar} ${chalk72.dim(`${m.hours}h`)}`);
33629
34281
  }
33630
34282
  console.log();
33631
34283
  }
@@ -33649,15 +34301,15 @@ var progress_exports = {};
33649
34301
  __export(progress_exports, {
33650
34302
  handler: () => handler44
33651
34303
  });
33652
- import chalk71 from "chalk";
34304
+ import chalk73 from "chalk";
33653
34305
  function printProgressResetPreamble() {
33654
34306
  console.log();
33655
- console.log(" " + chalk71.yellow.bold("This will permanently remove:"));
33656
- console.log(" " + chalk71.dim(" \u2022 Hours saved and milestone unlocks"));
33657
- console.log(" " + chalk71.dim(" \u2022 Usage counters and weekly activity totals"));
33658
- console.log(" " + chalk71.dim(" \u2022 Credit history used to prevent duplicates"));
34307
+ console.log(" " + chalk73.yellow.bold("This will permanently remove:"));
34308
+ console.log(" " + chalk73.dim(" \u2022 Hours saved and milestone unlocks"));
34309
+ console.log(" " + chalk73.dim(" \u2022 Usage counters and weekly activity totals"));
34310
+ console.log(" " + chalk73.dim(" \u2022 Credit history used to prevent duplicates"));
33659
34311
  console.log();
33660
- console.log(" " + chalk71.dim("Kept: install identity (install.json)"));
34312
+ console.log(" " + chalk73.dim("Kept: install identity (install.json)"));
33661
34313
  console.log();
33662
34314
  }
33663
34315
  function showProgress() {
@@ -33675,7 +34327,7 @@ async function handleReset(ctx, confirmedFlag) {
33675
34327
  const bank = getTimeBankSummary();
33676
34328
  if (bank.total_minutes <= 0) {
33677
34329
  console.log();
33678
- console.log(" " + chalk71.dim("No progress to reset."));
34330
+ console.log(" " + chalk73.dim("No progress to reset."));
33679
34331
  console.log();
33680
34332
  return "No progress to reset";
33681
34333
  }
@@ -33692,7 +34344,7 @@ async function handleReset(ctx, confirmedFlag) {
33692
34344
  }
33693
34345
  resetProgress();
33694
34346
  console.log();
33695
- console.log(" " + paint("accent", "\u2713 Progress reset") + chalk71.dim(" \u2014 hours and milestones are cleared."));
34347
+ console.log(" " + paint("accent", "\u2713 Progress reset") + chalk73.dim(" \u2014 hours and milestones are cleared."));
33696
34348
  console.log();
33697
34349
  return "Progress reset";
33698
34350
  }
@@ -33704,7 +34356,7 @@ async function handler44(args, ctx) {
33704
34356
  }
33705
34357
  if (sub && sub !== "reset") {
33706
34358
  console.log();
33707
- console.log(" " + chalk71.dim("Unknown subcommand. Type ") + paint("accent", "/progress") + chalk71.dim(" or ") + paint("accent", "/progress reset") + chalk71.dim("."));
34359
+ console.log(" " + chalk73.dim("Unknown subcommand. Type ") + paint("accent", "/progress") + chalk73.dim(" or ") + paint("accent", "/progress reset") + chalk73.dim("."));
33708
34360
  console.log();
33709
34361
  return;
33710
34362
  }
@@ -33727,7 +34379,7 @@ var deepdive_exports = {};
33727
34379
  __export(deepdive_exports, {
33728
34380
  handler: () => handler45
33729
34381
  });
33730
- import chalk72 from "chalk";
34382
+ import chalk74 from "chalk";
33731
34383
  function printCatalog2() {
33732
34384
  console.log();
33733
34385
  console.log(" " + sectionHeading("Vital signs"));
@@ -33737,7 +34389,7 @@ function printCatalog2() {
33737
34389
  console.log();
33738
34390
  console.log(" " + sectionHeading("SaaS metrics"));
33739
34391
  console.log(
33740
- " " + chalk72.dim("Core tour: ") + CORE_DECK_IDS.filter((id) => getMetricExplainer(id)?.kind === "saas").map((id) => paint("accent", id)).join(chalk72.dim(" \xB7 "))
34392
+ " " + chalk74.dim("Core tour: ") + CORE_DECK_IDS.filter((id) => getMetricExplainer(id)?.kind === "saas").map((id) => paint("accent", id)).join(chalk74.dim(" \xB7 "))
33741
34393
  );
33742
34394
  console.log();
33743
34395
  for (const e of listMetricExplainers("saas")) {
@@ -33746,7 +34398,7 @@ function printCatalog2() {
33746
34398
  console.log();
33747
34399
  console.log(" " + sectionHeading("How to use NTRP"));
33748
34400
  console.log(
33749
- " " + chalk72.dim("After vitals in the tour: ") + GUIDE_DECK_IDS.map((id) => paint("accent", id)).join(chalk72.dim(" \xB7 ")) + chalk72.dim(" \xB7 ") + paint("accent", "/deepdive guide")
34401
+ " " + chalk74.dim("After vitals in the tour: ") + GUIDE_DECK_IDS.map((id) => paint("accent", id)).join(chalk74.dim(" \xB7 ")) + chalk74.dim(" \xB7 ") + paint("accent", "/deepdive guide")
33750
34402
  );
33751
34403
  console.log();
33752
34404
  for (const s of listGuideSlides()) {
@@ -33754,14 +34406,14 @@ function printCatalog2() {
33754
34406
  }
33755
34407
  console.log();
33756
34408
  console.log(
33757
- " " + chalk72.dim("Usage: ") + paint("accent", "/deepdive") + chalk72.dim(" \xB7 ") + paint("accent", "/deepdive <metric>") + chalk72.dim(" \xB7 ") + paint("accent", "/deepdive guide") + chalk72.dim(" \xB7 ") + paint("accent", "/deepdive list")
34409
+ " " + chalk74.dim("Usage: ") + paint("accent", "/deepdive") + chalk74.dim(" \xB7 ") + paint("accent", "/deepdive <metric>") + chalk74.dim(" \xB7 ") + paint("accent", "/deepdive guide") + chalk74.dim(" \xB7 ") + paint("accent", "/deepdive list")
33758
34410
  );
33759
34411
  console.log();
33760
34412
  }
33761
34413
  function printUnknown(query) {
33762
34414
  console.log();
33763
34415
  console.log(
33764
- " " + chalk72.dim("Unknown slide ") + bold(query) + chalk72.dim(" \u2014 try ") + paint("accent", "/deepdive list") + chalk72.dim(" or ") + paint("accent", "/deepdive guide") + chalk72.dim(".")
34416
+ " " + chalk74.dim("Unknown slide ") + bold(query) + chalk74.dim(" \u2014 try ") + paint("accent", "/deepdive list") + chalk74.dim(" or ") + paint("accent", "/deepdive guide") + chalk74.dim(".")
33765
34417
  );
33766
34418
  console.log();
33767
34419
  }
@@ -33830,22 +34482,90 @@ var init_deepdive = __esm({
33830
34482
  }
33831
34483
  });
33832
34484
 
34485
+ // src/commands/thinkwithme.ts
34486
+ var thinkwithme_exports = {};
34487
+ __export(thinkwithme_exports, {
34488
+ handler: () => handler46
34489
+ });
34490
+ import chalk75 from "chalk";
34491
+ async function handler46(args, ctx) {
34492
+ const seedRaw = args.join(" ").trim();
34493
+ const seed = seedRaw ? extractThinkSeed(seedRaw) : void 0;
34494
+ if (ctx.oneShot) {
34495
+ await runOneShot(ctx, seed);
34496
+ return;
34497
+ }
34498
+ await startThinkFlow(ctx, { seed, origin: "command" });
34499
+ }
34500
+ async function runOneShot(ctx, seed) {
34501
+ if (!seed) {
34502
+ console.log();
34503
+ console.log(
34504
+ " " + chalk75.dim("Usage: ") + paint("accent", "ntrp thinkwithme <topic>") + chalk75.dim(" \u2014 or open the REPL and type ") + chalk75.cyan("/thinkwithme") + chalk75.dim(".")
34505
+ );
34506
+ console.log();
34507
+ return;
34508
+ }
34509
+ if (!isAnalysisReady(ctx)) {
34510
+ console.log();
34511
+ console.log(
34512
+ " " + chalk75.dim("No analysis yet. Run ") + chalk75.cyan("ntrp demo --scenario hidden_crisis --no-profile") + chalk75.dim(" then ") + chalk75.cyan("ntrp diagnose") + chalk75.dim(", or use the interactive REPL.")
34513
+ );
34514
+ console.log();
34515
+ process.exitCode = 1;
34516
+ return;
34517
+ }
34518
+ if (!canUseReplAi(ctx)) {
34519
+ console.log();
34520
+ console.log(
34521
+ " " + chalk75.dim("Connect an AI key first: ") + chalk75.cyan("ntrp connect --key <key>")
34522
+ );
34523
+ console.log();
34524
+ process.exitCode = 1;
34525
+ return;
34526
+ }
34527
+ ctx.thinkState = {
34528
+ step: "active",
34529
+ seed,
34530
+ origin: "command",
34531
+ started_at: (/* @__PURE__ */ new Date()).toISOString(),
34532
+ open_questions: [],
34533
+ challenged_assumptions: [],
34534
+ working_hypotheses: []
34535
+ };
34536
+ console.log();
34537
+ console.log(" " + paint("accent", "Think with me"));
34538
+ console.log(" " + chalk75.dim("Seed: ") + seed);
34539
+ console.log();
34540
+ const { runThinkTurn: runThinkTurn2 } = await Promise.resolve().then(() => (init_think(), think_exports));
34541
+ await runThinkTurn2(seed, ctx);
34542
+ }
34543
+ var init_thinkwithme = __esm({
34544
+ "src/commands/thinkwithme.ts"() {
34545
+ "use strict";
34546
+ init_context2();
34547
+ init_repl_api();
34548
+ init_theme();
34549
+ init_think_flow();
34550
+ }
34551
+ });
34552
+
33833
34553
  // src/commands/exports.ts
33834
34554
  var exports_exports = {};
33835
34555
  __export(exports_exports, {
33836
- handler: () => handler46
34556
+ handler: () => handler47
33837
34557
  });
33838
- import chalk73 from "chalk";
34558
+ import chalk76 from "chalk";
33839
34559
  import { existsSync as existsSync31 } from "fs";
33840
34560
  import { join as join35 } from "path";
33841
34561
  function usage3() {
33842
- console.log(chalk73.dim(" Usage:"));
33843
- console.log(chalk73.dim(" /exports list [kind]"));
33844
- console.log(chalk73.dim(" /exports open"));
33845
- console.log(chalk73.dim(" /exports move <id|filename> <dest-dir>"));
33846
- console.log(chalk73.dim(" /inbox show | set <path> | skill | clear"));
34562
+ console.log(chalk76.dim(" Usage:"));
34563
+ console.log(chalk76.dim(" /exports list [kind]"));
34564
+ console.log(chalk76.dim(" /exports open"));
34565
+ console.log(chalk76.dim(" /exports move <id|filename> <dest-dir>"));
34566
+ console.log(chalk76.dim(" /inbox show | set <path> | skill | clear"));
33847
34567
  }
33848
- async function handler46(args, ctx) {
34568
+ async function handler47(args, ctx) {
33849
34569
  const sub = (args[0] ?? "").toLowerCase();
33850
34570
  if (!sub) {
33851
34571
  printInboxShow();
@@ -33872,7 +34592,7 @@ async function handler46(args, ctx) {
33872
34592
  return await runInboxSet(args.slice(1), ctx);
33873
34593
  case "clear":
33874
34594
  clearAiInboxDir();
33875
- console.log(" " + chalk73.dim("AI inbox cleared. Files on disk were kept."));
34595
+ console.log(" " + chalk76.dim("AI inbox cleared. Files on disk were kept."));
33876
34596
  return "AI inbox cleared";
33877
34597
  default:
33878
34598
  if (!["help", "-h", "--help"].includes(sub)) {
@@ -33888,40 +34608,40 @@ function printInboxShow() {
33888
34608
  const inbox = getAiInboxDir();
33889
34609
  console.log();
33890
34610
  console.log(" " + bold("Exports"));
33891
- console.log(" " + chalk73.dim("Archive: ") + archive);
33892
- console.log(" " + chalk73.dim("Index: ") + archiveIndexPath());
34611
+ console.log(" " + chalk76.dim("Archive: ") + archive);
34612
+ console.log(" " + chalk76.dim("Index: ") + archiveIndexPath());
33893
34613
  if (inbox) {
33894
34614
  console.log(" " + paint("accent", "AI inbox: ") + inbox);
33895
34615
  const latest = inboxLatestHandoffPath();
33896
- if (latest) console.log(" " + chalk73.dim("Latest handoff: ") + latest);
33897
- console.log(" " + chalk73.dim("Finder skill: ") + join35(inbox, "SKILL.md"));
33898
- console.log(" " + chalk73.dim("Reprint: ") + paint("accent", "/inbox skill"));
34616
+ if (latest) console.log(" " + chalk76.dim("Latest handoff: ") + latest);
34617
+ console.log(" " + chalk76.dim("Finder skill: ") + join35(inbox, "SKILL.md"));
34618
+ console.log(" " + chalk76.dim("Reprint: ") + paint("accent", "/inbox skill"));
33899
34619
  } else {
33900
- console.log(" " + chalk73.dim("AI inbox: (not set). Type ") + paint("accent", "/inbox set <folder>"));
34620
+ console.log(" " + chalk76.dim("AI inbox: (not set). Type ") + paint("accent", "/inbox set <folder>"));
33901
34621
  }
33902
34622
  const archLatest = archiveLatestHandoffPath();
33903
34623
  if (archLatest) {
33904
- console.log(" " + chalk73.dim("Archive latest: ") + archLatest);
34624
+ console.log(" " + chalk76.dim("Archive latest: ") + archLatest);
33905
34625
  }
33906
34626
  console.log();
33907
34627
  }
33908
34628
  function printOpen() {
33909
34629
  console.log();
33910
34630
  console.log(" " + bold("Open these paths"));
33911
- console.log(" " + chalk73.dim("INDEX: ") + archiveIndexPath());
34631
+ console.log(" " + chalk76.dim("INDEX: ") + archiveIndexPath());
33912
34632
  const arch = archiveLatestHandoffPath();
33913
- if (arch) console.log(" " + chalk73.dim("Latest handoff: ") + arch);
34633
+ if (arch) console.log(" " + chalk76.dim("Latest handoff: ") + arch);
33914
34634
  const inbox = getAiInboxDir();
33915
34635
  if (inbox) {
33916
- console.log(" " + chalk73.dim("AI inbox: ") + inbox);
34636
+ console.log(" " + chalk76.dim("AI inbox: ") + inbox);
33917
34637
  const latest = inboxLatestHandoffPath();
33918
- if (latest) console.log(" " + chalk73.dim("Inbox latest: ") + latest);
33919
- console.log(" " + chalk73.dim("Pickup skill: ") + join35(inbox, "latest-pickup.md"));
33920
- console.log(" " + chalk73.dim("Finder skill: ") + join35(inbox, "SKILL.md"));
34638
+ if (latest) console.log(" " + chalk76.dim("Inbox latest: ") + latest);
34639
+ console.log(" " + chalk76.dim("Pickup skill: ") + join35(inbox, "latest-pickup.md"));
34640
+ console.log(" " + chalk76.dim("Finder skill: ") + join35(inbox, "SKILL.md"));
33921
34641
  } else {
33922
- console.log(" " + chalk73.dim("AI inbox is not set. Type ") + paint("accent", "/inbox set <folder>"));
34642
+ console.log(" " + chalk76.dim("AI inbox is not set. Type ") + paint("accent", "/inbox set <folder>"));
33923
34643
  const loc = handoffLocations();
33924
- console.log(" " + chalk73.dim("Finder skill: ") + loc.archiveSkill);
34644
+ console.log(" " + chalk76.dim("Finder skill: ") + loc.archiveSkill);
33925
34645
  }
33926
34646
  console.log();
33927
34647
  }
@@ -33929,17 +34649,17 @@ function printList(kind) {
33929
34649
  const items = listExports({ limit: 20, kind: kind || void 0 });
33930
34650
  console.log(" " + bold(kind ? `Recent exports (${kind})` : "Recent exports"));
33931
34651
  if (items.length === 0) {
33932
- console.log(" " + chalk73.dim("None yet. Type /handoff prompt deck to write a handoff."));
34652
+ console.log(" " + chalk76.dim("None yet. Type /handoff prompt deck to write a handoff."));
33933
34653
  console.log();
33934
34654
  return;
33935
34655
  }
33936
34656
  for (const e of items) {
33937
- const title = e.title ? chalk73.dim(` \u2014 ${e.title}`) : "";
33938
- console.log(` ${paint("accent", e.id)} ${e.kind} ${chalk73.dim(e.at)}${title}`);
34657
+ const title = e.title ? chalk76.dim(` \u2014 ${e.title}`) : "";
34658
+ console.log(` ${paint("accent", e.id)} ${e.kind} ${chalk76.dim(e.at)}${title}`);
33939
34659
  console.log(` ${e.path}`);
33940
- if (e.inbox_path) console.log(` ${chalk73.dim("inbox:")} ${e.inbox_path}`);
34660
+ if (e.inbox_path) console.log(` ${chalk76.dim("inbox:")} ${e.inbox_path}`);
33941
34661
  if (e.previous_paths && e.previous_paths.length > 0) {
33942
- console.log(` ${chalk73.dim("was:")} ${e.previous_paths[e.previous_paths.length - 1]}`);
34662
+ console.log(` ${chalk76.dim("was:")} ${e.previous_paths[e.previous_paths.length - 1]}`);
33943
34663
  }
33944
34664
  }
33945
34665
  console.log();
@@ -33947,8 +34667,8 @@ function printList(kind) {
33947
34667
  async function runInboxSet(args, ctx) {
33948
34668
  const pathArg = args.join(" ").trim();
33949
34669
  if (!pathArg) {
33950
- console.error(chalk73.red(" Usage: /inbox set <path>"));
33951
- console.error(chalk73.dim(" Example: /inbox set ~/Documents/Claude/ntrp-inbox"));
34670
+ console.error(chalk76.red(" Usage: /inbox set <path>"));
34671
+ console.error(chalk76.dim(" Example: /inbox set ~/Documents/Claude/ntrp-inbox"));
33952
34672
  if (ctx.oneShot) process.exit(1);
33953
34673
  return;
33954
34674
  }
@@ -33962,25 +34682,25 @@ async function runInboxSet(args, ctx) {
33962
34682
  true
33963
34683
  );
33964
34684
  if (!ok) {
33965
- console.log(" " + chalk73.dim("Cancelled."));
34685
+ console.log(" " + chalk76.dim("Cancelled."));
33966
34686
  return;
33967
34687
  }
33968
34688
  } finally {
33969
34689
  prompts.close();
33970
34690
  }
33971
34691
  } else {
33972
- console.log(" " + chalk73.yellow(`Inbox is outside ~/.ntrp: ${resolved}`));
33973
- console.log(" " + chalk73.dim("Handoffs with analysis text will be written here."));
34692
+ console.log(" " + chalk76.yellow(`Inbox is outside ~/.ntrp: ${resolved}`));
34693
+ console.log(" " + chalk76.dim("Handoffs with analysis text will be written here."));
33974
34694
  }
33975
34695
  }
33976
34696
  const setTo = setAiInboxDir(pathArg);
33977
34697
  const n = syncRecentToInbox(10);
33978
34698
  console.log();
33979
34699
  console.log(" " + paint("accent", "AI inbox set"));
33980
- console.log(" " + chalk73.dim(setTo));
33981
- console.log(" " + chalk73.dim("Point Claude Desktop or another desktop AI at this folder."));
34700
+ console.log(" " + chalk76.dim(setTo));
34701
+ console.log(" " + chalk76.dim("Point Claude Desktop or another desktop AI at this folder."));
33982
34702
  if (n > 0) {
33983
- console.log(" " + chalk73.dim(`Synced ${n} recent export${n === 1 ? "" : "s"} into the inbox.`));
34703
+ console.log(" " + chalk76.dim(`Synced ${n} recent export${n === 1 ? "" : "s"} into the inbox.`));
33984
34704
  }
33985
34705
  printStandingSkill();
33986
34706
  return `AI inbox \u2192 ${setTo}`;
@@ -33989,7 +34709,7 @@ function runMove(args, ctx) {
33989
34709
  const idOrName = args[0];
33990
34710
  const dest = args.slice(1).join(" ").trim();
33991
34711
  if (!idOrName || !dest) {
33992
- console.error(chalk73.red(" Usage: /exports move <id|filename> <dest-dir>"));
34712
+ console.error(chalk76.red(" Usage: /exports move <id|filename> <dest-dir>"));
33993
34713
  if (ctx.oneShot) process.exit(1);
33994
34714
  return;
33995
34715
  }
@@ -34001,16 +34721,16 @@ function runMove(args, ctx) {
34001
34721
  console.log();
34002
34722
  console.log(" " + paint("accent", "Moved export"));
34003
34723
  for (const line of formatExportLocationLines(event)) {
34004
- console.log(" " + chalk73.dim(line));
34724
+ console.log(" " + chalk76.dim(line));
34005
34725
  }
34006
34726
  if (event.previous_paths?.length) {
34007
- console.log(" " + chalk73.dim("Was: ") + event.previous_paths[event.previous_paths.length - 1]);
34727
+ console.log(" " + chalk76.dim("Was: ") + event.previous_paths[event.previous_paths.length - 1]);
34008
34728
  }
34009
- console.log(" " + chalk73.dim(`Trail recorded in ${archiveIndexPath()}`));
34729
+ console.log(" " + chalk76.dim(`Trail recorded in ${archiveIndexPath()}`));
34010
34730
  console.log();
34011
34731
  return `Moved to ${event.path}`;
34012
34732
  } catch (err) {
34013
- console.error(chalk73.red(` ${err instanceof Error ? err.message : String(err)}`));
34733
+ console.error(chalk76.red(` ${err instanceof Error ? err.message : String(err)}`));
34014
34734
  if (ctx.oneShot) process.exit(1);
34015
34735
  }
34016
34736
  }
@@ -34029,9 +34749,9 @@ var init_exports = __esm({
34029
34749
  // src/commands/privacy.ts
34030
34750
  var privacy_exports = {};
34031
34751
  __export(privacy_exports, {
34032
- handler: () => handler47
34752
+ handler: () => handler48
34033
34753
  });
34034
- async function handler47(_args, _ctx) {
34754
+ async function handler48(_args, _ctx) {
34035
34755
  console.log();
34036
34756
  console.log(" " + bold("What leaves this machine"));
34037
34757
  for (const line of PRIVACY_NOTICE_LINES) {
@@ -34136,10 +34856,10 @@ async function resolveHandler(name) {
34136
34856
  try {
34137
34857
  const mod = await importHandler(runtimePath);
34138
34858
  if (!mod) return null;
34139
- const handler49 = mod.handler;
34140
- if (typeof handler49 !== "function") return null;
34141
- entry.handler = handler49;
34142
- return handler49;
34859
+ const handler50 = mod.handler;
34860
+ if (typeof handler50 !== "function") return null;
34861
+ entry.handler = handler50;
34862
+ return handler50;
34143
34863
  } catch (err) {
34144
34864
  console.error(`Failed to load handler for /${name}:`, err);
34145
34865
  return null;
@@ -34239,6 +34959,8 @@ async function importHandler(runtimePath) {
34239
34959
  return Promise.resolve().then(() => (init_progress2(), progress_exports));
34240
34960
  case "../commands/deepdive.js":
34241
34961
  return Promise.resolve().then(() => (init_deepdive(), deepdive_exports));
34962
+ case "../commands/thinkwithme.js":
34963
+ return Promise.resolve().then(() => (init_thinkwithme(), thinkwithme_exports));
34242
34964
  case "../commands/exports.js":
34243
34965
  return Promise.resolve().then(() => (init_exports(), exports_exports));
34244
34966
  case "../commands/privacy.js":
@@ -34705,6 +35427,21 @@ Bare \`/deepdive\` runs the full onboarding tour. Type \`/deepdive guide\` to ju
34705
35427
  Type \`/deepdive handoff\` for the ship-to-Claude slide. Type \`/deepdive <metric>\` to jump to one metric card.
34706
35428
  Type \`/deepdive list\` to print the catalog. Works without an AI key. Re-run anytime from the homescreen.
34707
35429
  Live values overlay when an analysis exists.`
35430
+ },
35431
+ {
35432
+ name: "thinkwithme",
35433
+ raw: `---
35434
+ name: thinkwithme
35435
+ description: Socratic co-thinking channel \u2014 explore and pressure-test
35436
+ section: Navigation
35437
+ args: [topic]
35438
+ handler: ../commands/thinkwithme.ts
35439
+ ---
35440
+
35441
+ Open a dedicated \`think \u203A\` channel to explore ideas, challenge assumptions, and pull evidence from your data.
35442
+ Bare \`/thinkwithme\` enters the channel. Type \`/thinkwithme <topic>\` to seed the first turn.
35443
+ Requires an analysis and an AI key (\`/connect\`). Type \`done\` or \`cancel\` to return to ask \u203A.
35444
+ When you are ready to commit to a plan, say so or the partner can hand off to \`/strategy\`.`
34708
35445
  },
34709
35446
  {
34710
35447
  name: "status",
@@ -35427,11 +36164,11 @@ __export(compute_exports2, {
35427
36164
  isComputeIntent: () => isComputeIntent,
35428
36165
  runConversationCompute: () => runConversationCompute
35429
36166
  });
35430
- import chalk74 from "chalk";
36167
+ import chalk77 from "chalk";
35431
36168
  async function runConversationCompute(ctx) {
35432
36169
  const lens = ctx.scope?.primary_lens ?? ctx.analysis.primary;
35433
36170
  ctx.computeInProgress = true;
35434
- const willAnswer = Boolean(ctx.pendingAsk?.text) && !ctx.strategistState;
36171
+ const willAnswer = Boolean(ctx.pendingAsk?.text) && !ctx.strategistState && ctx.thinkState?.step !== "awaiting_analysis";
35435
36172
  try {
35436
36173
  if (lens === "revenue_metrics") {
35437
36174
  const { runMetricsAnalysis: runMetricsAnalysis2, extractHeadlineMetrics: extractHeadlineMetrics2 } = await Promise.resolve().then(() => (init_metrics_analysis(), metrics_analysis_exports));
@@ -35459,6 +36196,7 @@ async function runConversationCompute(ctx) {
35459
36196
  interactive: !willAnswer
35460
36197
  });
35461
36198
  await resumeQueuedStrategist(ctx);
36199
+ await resumeQueuedThink(ctx);
35462
36200
  await closeComputeTurn(ctx, willAnswer, "revenue_metrics");
35463
36201
  creditGapCompute(ctx);
35464
36202
  creditMetricsComplete(ctx, false);
@@ -35478,11 +36216,12 @@ async function runConversationCompute(ctx) {
35478
36216
  invalidateGapAudit(ctx);
35479
36217
  saveSessionState(ctx);
35480
36218
  await resumeQueuedStrategist(ctx);
36219
+ await resumeQueuedThink(ctx);
35481
36220
  await closeComputeTurn(ctx, willAnswer, "gtm_health");
35482
36221
  creditGapCompute(ctx);
35483
36222
  return typeof summary === "string" ? summary : "Health analysis ready";
35484
36223
  } catch (err) {
35485
- console.error(" " + chalk74.red(String(err.message ?? err)));
36224
+ console.error(" " + chalk77.red(String(err.message ?? err)));
35486
36225
  return;
35487
36226
  } finally {
35488
36227
  ctx.computeInProgress = false;
@@ -35495,9 +36234,16 @@ async function resumeQueuedStrategist(ctx) {
35495
36234
  const { resumeStrategistAfterCompute: resumeStrategistAfterCompute2 } = await Promise.resolve().then(() => (init_strategist_flow(), strategist_flow_exports));
35496
36235
  await resumeStrategistAfterCompute2(ctx);
35497
36236
  }
36237
+ async function resumeQueuedThink(ctx) {
36238
+ if (ctx.thinkState?.step !== "awaiting_analysis") return;
36239
+ ctx.computeInProgress = false;
36240
+ const { resumeThinkAfterCompute: resumeThinkAfterCompute2 } = await Promise.resolve().then(() => (init_think_flow(), think_flow_exports));
36241
+ await resumeThinkAfterCompute2(ctx);
36242
+ }
35498
36243
  async function resumePendingAskAfterCompute(ctx) {
35499
36244
  if (!ctx.pendingAsk?.text) return false;
35500
36245
  if (ctx.strategistState) return false;
36246
+ if (ctx.thinkState?.step === "active" || ctx.thinkState?.step === "awaiting_analysis") return false;
35501
36247
  const { resumePendingAsk: resumePendingAsk2 } = await Promise.resolve().then(() => (init_pending_ask(), pending_ask_exports));
35502
36248
  return resumePendingAsk2(ctx);
35503
36249
  }
@@ -35534,7 +36280,7 @@ __export(ingest_chat_exports, {
35534
36280
  import { existsSync as existsSync33 } from "fs";
35535
36281
  import { basename as basename9, resolve as resolve9 } from "path";
35536
36282
  import { homedir as homedir8 } from "os";
35537
- import chalk75 from "chalk";
36283
+ import chalk78 from "chalk";
35538
36284
  function extractFilePath(input) {
35539
36285
  const trimmed = input.trim();
35540
36286
  const patterns = [
@@ -35569,7 +36315,7 @@ function looksLikeFilePath(input) {
35569
36315
  }
35570
36316
  async function ingestFromChat(ctx, filePath) {
35571
36317
  if (!ctx.rl) {
35572
- console.log(" " + chalk75.red("Ingest confirm requires interactive mode."));
36318
+ console.log(" " + chalk78.red("Ingest confirm requires interactive mode."));
35573
36319
  return false;
35574
36320
  }
35575
36321
  const name = basename9(filePath);
@@ -35577,7 +36323,7 @@ async function ingestFromChat(ctx, filePath) {
35577
36323
  try {
35578
36324
  const ok = await prompts.confirm(`Ingest ${name} as CRM export?`, true);
35579
36325
  if (!ok) {
35580
- console.log(" " + chalk75.dim("Ingest cancelled."));
36326
+ console.log(" " + chalk78.dim("Ingest cancelled."));
35581
36327
  return false;
35582
36328
  }
35583
36329
  } finally {
@@ -35605,7 +36351,7 @@ async function ingestFromChat(ctx, filePath) {
35605
36351
  true
35606
36352
  );
35607
36353
  if (useAi) {
35608
- console.log(" " + chalk75.dim("AI column mapping is not wired to ingest yet \u2014 trying standard ingest."));
36354
+ console.log(" " + chalk78.dim("AI column mapping is not wired to ingest yet \u2014 trying standard ingest."));
35609
36355
  }
35610
36356
  } finally {
35611
36357
  prompts2.close();
@@ -35632,7 +36378,7 @@ async function ingestFromChat(ctx, filePath) {
35632
36378
  invalidateGapAudit(ctx);
35633
36379
  saveSessionState(ctx);
35634
36380
  console.log();
35635
- console.log(" " + paint("accent", "\u2713 Data loaded") + chalk75.dim(` \u2014 ${name}`));
36381
+ console.log(" " + paint("accent", "\u2713 Data loaded") + chalk78.dim(` \u2014 ${name}`));
35636
36382
  recordMessage(ctx, "user", `[ingested ${name}]`);
35637
36383
  recordMessage(ctx, "agent", `Loaded ${name}. Checking what we can analyze\u2026`);
35638
36384
  const audit = await refreshGapAudit(ctx);
@@ -35640,7 +36386,7 @@ async function ingestFromChat(ctx, filePath) {
35640
36386
  if (audit.can_compute && ctx.scope?.confirmed_at) {
35641
36387
  if (ctx.pendingAsk) {
35642
36388
  console.log();
35643
- console.log(" " + chalk75.dim("Computing so I can answer\u2026"));
36389
+ console.log(" " + chalk78.dim("Computing so I can answer\u2026"));
35644
36390
  await runConversationCompute(ctx);
35645
36391
  return true;
35646
36392
  }
@@ -35688,7 +36434,7 @@ async function loadDemoFromChat(ctx, scenario, opts = {}) {
35688
36434
  const { getScenario: getScenario2 } = await Promise.resolve().then(() => (init_scenarios(), scenarios_exports));
35689
36435
  const s = getScenario2(chosen);
35690
36436
  console.log();
35691
- console.log(" " + paint("accent", "Fitting ") + s.label + chalk75.dim(" \u2014 " + s.hook));
36437
+ console.log(" " + paint("accent", "Fitting ") + s.label + chalk78.dim(" \u2014 " + s.hook));
35692
36438
  }
35693
36439
  const { handler: demo } = await Promise.resolve().then(() => (init_generate(), generate_exports));
35694
36440
  const args = ["--no-profile", "--brief"];
@@ -35724,7 +36470,7 @@ async function loadDemoFromChat(ctx, scenario, opts = {}) {
35724
36470
  const shouldAuto = opts.autoCompute || Boolean(ctx.pendingAsk && audit.can_compute && ctx.scope?.confirmed_at);
35725
36471
  if (shouldAuto && audit.can_compute) {
35726
36472
  console.log();
35727
- console.log(" " + chalk75.dim("Computing so I can answer\u2026"));
36473
+ console.log(" " + chalk78.dim("Computing so I can answer\u2026"));
35728
36474
  await runConversationCompute(ctx);
35729
36475
  return true;
35730
36476
  }
@@ -35836,13 +36582,13 @@ __export(demo_fit_exports, {
35836
36582
  resolveDemoScenarioForLoad: () => resolveDemoScenarioForLoad,
35837
36583
  runDemoFitQuiz: () => runDemoFitQuiz
35838
36584
  });
35839
- import chalk76 from "chalk";
36585
+ import chalk79 from "chalk";
35840
36586
  async function runDemoFitQuiz(session, opts = {}) {
35841
36587
  if (opts.intro !== false) {
35842
36588
  console.log();
35843
36589
  console.log(" " + bold("Fit a sample book of business"));
35844
36590
  console.log(
35845
- " " + chalk76.dim(
36591
+ " " + chalk79.dim(
35846
36592
  "No API key needed. Two questions about how you sell, then you pick which of seven sample pipelines feels closest."
35847
36593
  )
35848
36594
  );
@@ -35860,8 +36606,8 @@ async function runDemoFitQuiz(session, opts = {}) {
35860
36606
  );
35861
36607
  const recommended = inferDemoScenario({ salesMotion: motion, dealBand });
35862
36608
  console.log();
35863
- console.log(" " + chalk76.dim("Recommended: ") + paint("accent", getScenario(recommended.scenario).label));
35864
- console.log(" " + chalk76.dim(recommended.reason));
36609
+ console.log(" " + chalk79.dim("Recommended: ") + paint("accent", getScenario(recommended.scenario).label));
36610
+ console.log(" " + chalk79.dim(recommended.reason));
35865
36611
  const scenario = await session.choose(
35866
36612
  "Which of these sample books feels closest to the one you manage?",
35867
36613
  scenarioMenuChoices(),
@@ -35881,8 +36627,8 @@ async function offerFittedDemoAfterOnboard(session, ctx, profile) {
35881
36627
  const s = getScenario(fit.scenario);
35882
36628
  console.log();
35883
36629
  console.log(" " + bold("A sample pipeline that looks like you"));
35884
- console.log(" " + paint("accent", s.label) + chalk76.dim(" \u2014 " + s.hook));
35885
- console.log(" " + chalk76.dim(fit.reason));
36630
+ console.log(" " + paint("accent", s.label) + chalk79.dim(" \u2014 " + s.hook));
36631
+ console.log(" " + chalk79.dim(fit.reason));
35886
36632
  console.log();
35887
36633
  const action = await session.choose(
35888
36634
  "Try NTRP on that book of business?",
@@ -35939,8 +36685,8 @@ async function resolveDemoScenarioForLoad(ctx, opts = {}) {
35939
36685
  if (!opts.forceQuiz && isProfileConfigured(profile) && profile) {
35940
36686
  const fit = await resolveProfileFit(profile, ctx);
35941
36687
  console.log();
35942
- console.log(" " + chalk76.dim("Recommended: ") + paint("accent", getScenario(fit.scenario).label));
35943
- console.log(" " + chalk76.dim(fit.reason));
36688
+ console.log(" " + chalk79.dim("Recommended: ") + paint("accent", getScenario(fit.scenario).label));
36689
+ console.log(" " + chalk79.dim(fit.reason));
35944
36690
  const scenario = await session.choose(
35945
36691
  "Which sample book of business?",
35946
36692
  scenarioMenuChoices(),
@@ -36004,7 +36750,7 @@ __export(first_run_exports, {
36004
36750
  runFirstRunFork: () => runFirstRunFork,
36005
36751
  shouldOfferFirstRunFork: () => shouldOfferFirstRunFork
36006
36752
  });
36007
- import chalk77 from "chalk";
36753
+ import chalk80 from "chalk";
36008
36754
  function hasCompletedFirstRun() {
36009
36755
  return Boolean(getConfigValue(FIRST_RUN_KEY));
36010
36756
  }
@@ -36030,7 +36776,7 @@ async function runFirstRunFork(ctx, options = {}) {
36030
36776
  if (!options.skipBrand) printCenteredLogo();
36031
36777
  console.log();
36032
36778
  console.log(" " + bold("Welcome to NTRP"));
36033
- console.log(" " + chalk77.dim(TAGLINE));
36779
+ console.log(" " + chalk80.dim(TAGLINE));
36034
36780
  console.log();
36035
36781
  try {
36036
36782
  const { offerFirstRunTour: offerFirstRunTour2 } = await Promise.resolve().then(() => (init_metric_tour(), metric_tour_exports));
@@ -36068,18 +36814,18 @@ async function runFirstRunFork(ctx, options = {}) {
36068
36814
  await offerInboxSkillSetup2(session, { beat: "demo" });
36069
36815
  const s = getScenario(picked.scenario);
36070
36816
  console.log();
36071
- console.log(" " + paint("accent", "Loading demo\u2026") + chalk77.dim(" " + s.label + " \u2014 " + s.hook));
36817
+ console.log(" " + paint("accent", "Loading demo\u2026") + chalk80.dim(" " + s.label + " \u2014 " + s.hook));
36072
36818
  console.log();
36073
36819
  markFirstRunCompleted();
36074
36820
  return { choice: "demo", scenario: picked.scenario };
36075
36821
  }
36076
36822
  if (choice === "onboard") {
36077
- console.log(" " + chalk77.dim("Starting guided setup \u2014 key first, then your company profile."));
36823
+ console.log(" " + chalk80.dim("Starting guided setup \u2014 key first, then your company profile."));
36078
36824
  console.log();
36079
36825
  markFirstRunCompleted();
36080
36826
  return { choice: "onboard" };
36081
36827
  }
36082
- console.log(" " + chalk77.dim("Type what you want to look at."));
36828
+ console.log(" " + chalk80.dim("Type what you want to look at."));
36083
36829
  console.log();
36084
36830
  markFirstRunCompleted();
36085
36831
  return { choice: "skip" };
@@ -36089,7 +36835,7 @@ async function runFirstRunFork(ctx, options = {}) {
36089
36835
  }
36090
36836
  function printFirstRunChip() {
36091
36837
  console.log(
36092
- " " + chalk77.dim("No profile yet \u2014 ask a question, type ") + chalk77.cyan("use demo data") + chalk77.dim(", or ") + paint("accent", "/onboard") + chalk77.dim(" to calibrate.")
36838
+ " " + chalk80.dim("No profile yet \u2014 ask a question, type ") + chalk80.cyan("use demo data") + chalk80.dim(", or ") + paint("accent", "/onboard") + chalk80.dim(" to calibrate.")
36093
36839
  );
36094
36840
  console.log();
36095
36841
  }
@@ -36177,24 +36923,24 @@ var init_first_run = __esm({
36177
36923
  // src/commands/scratch.ts
36178
36924
  var scratch_exports = {};
36179
36925
  __export(scratch_exports, {
36180
- handler: () => handler48
36926
+ handler: () => handler49
36181
36927
  });
36182
- import chalk78 from "chalk";
36928
+ import chalk81 from "chalk";
36183
36929
  function printScratchPreamble(includeProgress) {
36184
36930
  console.log();
36185
- console.log(" " + chalk78.yellow.bold("This will permanently remove:"));
36186
- console.log(" " + chalk78.dim(" \u2022 API key and all config.json settings"));
36187
- console.log(" " + chalk78.dim(" \u2022 Company profile (you will set up again in this session)"));
36188
- console.log(" " + chalk78.dim(" \u2022 All sessions and datasets"));
36189
- console.log(" " + chalk78.dim(" \u2022 Demo taxonomy cache"));
36931
+ console.log(" " + chalk81.yellow.bold("This will permanently remove:"));
36932
+ console.log(" " + chalk81.dim(" \u2022 API key and all config.json settings"));
36933
+ console.log(" " + chalk81.dim(" \u2022 Company profile (you will set up again in this session)"));
36934
+ console.log(" " + chalk81.dim(" \u2022 All sessions and datasets"));
36935
+ console.log(" " + chalk81.dim(" \u2022 Demo taxonomy cache"));
36190
36936
  if (includeProgress) {
36191
- console.log(" " + chalk78.dim(" \u2022 Progress (hours saved) and install identity"));
36937
+ console.log(" " + chalk81.dim(" \u2022 Progress (hours saved) and install identity"));
36192
36938
  }
36193
36939
  console.log();
36194
36940
  if (includeProgress) {
36195
- console.log(" " + chalk78.dim("Preserved: memory, strategies, wins, knowledge, exports, audit"));
36941
+ console.log(" " + chalk81.dim("Preserved: memory, strategies, wins, knowledge, exports, audit"));
36196
36942
  } else {
36197
- console.log(" " + chalk78.dim("Preserved: progress (hours saved), memory, strategies, wins, knowledge, exports, audit"));
36943
+ console.log(" " + chalk81.dim("Preserved: progress (hours saved), memory, strategies, wins, knowledge, exports, audit"));
36198
36944
  }
36199
36945
  console.log();
36200
36946
  }
@@ -36217,7 +36963,7 @@ function resetContextAfterScratch(ctx) {
36217
36963
  ctx.lastExchange = void 0;
36218
36964
  ctx.pendingBlockedLine = void 0;
36219
36965
  }
36220
- async function handler48(args, ctx) {
36966
+ async function handler49(args, ctx) {
36221
36967
  const { flags } = parseArgs2(args, ["confirm", "include-progress"]);
36222
36968
  const confirmedFlag = getBool(flags, "confirm");
36223
36969
  const includeProgress = getBool(flags, "include-progress");
@@ -36238,10 +36984,10 @@ async function handler48(args, ctx) {
36238
36984
  if (ctx.oneShot) {
36239
36985
  console.log();
36240
36986
  const detail = includeProgress ? " \u2014 local config, data, and progress wiped." : " \u2014 local config and data wiped.";
36241
- console.log(" " + paint("accent", "\u2713 Scratch complete") + chalk78.dim(detail));
36987
+ console.log(" " + paint("accent", "\u2713 Scratch complete") + chalk81.dim(detail));
36242
36988
  console.log();
36243
36989
  console.log(
36244
- " " + chalk78.dim("Run ") + paint("accent", "ntrp") + chalk78.dim(" interactively to complete onboarding.\n")
36990
+ " " + chalk81.dim("Run ") + paint("accent", "ntrp") + chalk81.dim(" interactively to complete onboarding.\n")
36245
36991
  );
36246
36992
  return "Scratch complete";
36247
36993
  }
@@ -36279,16 +37025,16 @@ async function runGlobalAdminCommand(command, line, ctx) {
36279
37025
  const args = tokens.slice(1);
36280
37026
  switch (command) {
36281
37027
  case "scratch": {
36282
- const { handler: handler49 } = await Promise.resolve().then(() => (init_scratch(), scratch_exports));
36283
- return handler49(args, ctx);
37028
+ const { handler: handler50 } = await Promise.resolve().then(() => (init_scratch(), scratch_exports));
37029
+ return handler50(args, ctx);
36284
37030
  }
36285
37031
  case "cleanup": {
36286
- const { handler: handler49 } = await Promise.resolve().then(() => (init_cleanup(), cleanup_exports));
36287
- return handler49(args, ctx);
37032
+ const { handler: handler50 } = await Promise.resolve().then(() => (init_cleanup(), cleanup_exports));
37033
+ return handler50(args, ctx);
36288
37034
  }
36289
37035
  case "deactivate-demo": {
36290
- const { handler: handler49 } = await Promise.resolve().then(() => (init_deactivate_demo(), deactivate_demo_exports));
36291
- return handler49(args, ctx);
37036
+ const { handler: handler50 } = await Promise.resolve().then(() => (init_deactivate_demo(), deactivate_demo_exports));
37037
+ return handler50(args, ctx);
36292
37038
  }
36293
37039
  default:
36294
37040
  return void 0;
@@ -36372,13 +37118,17 @@ var router_exports = {};
36372
37118
  __export(router_exports, {
36373
37119
  conversationRouter: () => conversationRouter
36374
37120
  });
36375
- import chalk79 from "chalk";
37121
+ import chalk82 from "chalk";
36376
37122
  function popModalState(ctx) {
36377
37123
  const popped = [];
36378
37124
  if (ctx.strategistState) {
36379
37125
  ctx.strategistState = void 0;
36380
37126
  popped.push("strategy session");
36381
37127
  }
37128
+ if (ctx.thinkState) {
37129
+ ctx.thinkState = void 0;
37130
+ popped.push("think channel");
37131
+ }
36382
37132
  if (ctx.deliverIntent) {
36383
37133
  ctx.deliverIntent = false;
36384
37134
  popped.push("handoff draft");
@@ -36402,7 +37152,7 @@ async function conversationRouter(input, ctx) {
36402
37152
  if (FRESH_START_RE.test(line)) {
36403
37153
  console.log();
36404
37154
  console.log(
36405
- " " + chalk79.dim("Start a fresh analysis? This keeps prior sessions \u2014 say ") + chalk79.cyan("yes") + chalk79.dim(" to confirm or ") + chalk79.cyan("/home") + chalk79.dim(" for the dashboard.")
37155
+ " " + chalk82.dim("Start a fresh analysis? This keeps prior sessions \u2014 say ") + chalk82.cyan("yes") + chalk82.dim(" to confirm or ") + chalk82.cyan("/home") + chalk82.dim(" for the dashboard.")
36406
37156
  );
36407
37157
  console.log();
36408
37158
  return { handled: true };
@@ -36416,7 +37166,7 @@ async function conversationRouter(input, ctx) {
36416
37166
  const backTo = formatPhaseLabel(resolveConversationPhase(ctx));
36417
37167
  console.log();
36418
37168
  console.log(
36419
- " " + chalk79.dim(`Cancelled \u2014 dropped ${popped.join(" and ")}. Back to `) + chalk79.cyan(backTo) + chalk79.dim(".")
37169
+ " " + chalk82.dim(`Cancelled \u2014 dropped ${popped.join(" and ")}. Back to `) + chalk82.cyan(backTo) + chalk82.dim(".")
36420
37170
  );
36421
37171
  console.log();
36422
37172
  return { handled: true, summary: "Cancelled" };
@@ -36451,6 +37201,10 @@ async function conversationRouter(input, ctx) {
36451
37201
  const summary = await handleStrategizeFlow(line, ctx) ?? void 0;
36452
37202
  return { handled: true, summary };
36453
37203
  }
37204
+ if (phase === "think") {
37205
+ const summary = await handleThinkFlow(line, ctx) ?? void 0;
37206
+ return { handled: true, summary };
37207
+ }
36454
37208
  if (isStrategistIntent(line)) {
36455
37209
  if (phase === "explore" || isAnalysisReady(ctx)) {
36456
37210
  const summary = await startStrategistFlow(ctx, { seed: extractObjectiveSeed(line), origin: "nl" }) ?? void 0;
@@ -36460,6 +37214,15 @@ async function conversationRouter(input, ctx) {
36460
37214
  queueStrategistForAnalysis(ctx, { seed: extractObjectiveSeed(line), origin: "nl" });
36461
37215
  }
36462
37216
  }
37217
+ if (isThinkIntent(line)) {
37218
+ if (phase === "explore" || isAnalysisReady(ctx)) {
37219
+ const summary = await startThinkFlow(ctx, { seed: extractThinkSeed(line), origin: "nl" }) ?? void 0;
37220
+ return { handled: true, summary };
37221
+ }
37222
+ if (phase === "orient" || phase === "scope" || phase === "awaiting_data") {
37223
+ queueThinkForAnalysis(ctx, { seed: extractThinkSeed(line), origin: "nl" });
37224
+ }
37225
+ }
36463
37226
  if (isShipIntent(line) && (phase === "explore" || isAnalysisReady(ctx))) {
36464
37227
  ctx.deliverIntent = true;
36465
37228
  const summary = await handleDeliverFlow(line, ctx) ?? void 0;
@@ -36476,7 +37239,7 @@ async function conversationRouter(input, ctx) {
36476
37239
  }
36477
37240
  if (phase === "compute") {
36478
37241
  console.log();
36479
- console.log(" " + chalk79.dim("Analysis running \u2014 wait for it to finish before typing another question."));
37242
+ console.log(" " + chalk82.dim("Analysis running \u2014 wait for it to finish before typing another question."));
36480
37243
  console.log();
36481
37244
  return { handled: true };
36482
37245
  }
@@ -36510,6 +37273,7 @@ var init_router = __esm({
36510
37273
  init_orchestrator();
36511
37274
  init_handoff_draft();
36512
37275
  init_strategist_flow();
37276
+ init_think_flow();
36513
37277
  init_context2();
36514
37278
  init_demo();
36515
37279
  FRESH_START_RE = /\b(start (over|fresh)|new analysis|start again|reset session)\b/i;
@@ -36523,7 +37287,7 @@ __export(dispatch_exports, {
36523
37287
  dispatch: () => dispatch,
36524
37288
  replayPendingBlockedLine: () => replayPendingBlockedLine
36525
37289
  });
36526
- import chalk80 from "chalk";
37290
+ import chalk83 from "chalk";
36527
37291
  function printLicenseRequired(command) {
36528
37292
  printLicenseBlocked(command);
36529
37293
  }
@@ -36541,7 +37305,7 @@ async function replayPendingBlockedLine(ctx) {
36541
37305
  if (!hasValidLicense()) return false;
36542
37306
  ctx.pendingBlockedLine = void 0;
36543
37307
  console.log();
36544
- console.log(" " + chalk80.dim("Picking up where you left off\u2026"));
37308
+ console.log(" " + chalk83.dim("Picking up where you left off\u2026"));
36545
37309
  console.log();
36546
37310
  await dispatch(line, ctx);
36547
37311
  return true;
@@ -36611,7 +37375,7 @@ async function dispatch(input, ctx) {
36611
37375
  if (tokens.length === 1) {
36612
37376
  if (/^\d$/.test(first)) {
36613
37377
  console.log(
36614
- " " + chalk80.dim("Looks like a menu pick \u2014 run ") + paint("accent", "/new") + chalk80.dim(" to start (pick Demo, then choose your analysis type).")
37378
+ " " + chalk83.dim("Looks like a menu pick \u2014 run ") + paint("accent", "/new") + chalk83.dim(" to start (pick Demo, then choose your analysis type).")
36615
37379
  );
36616
37380
  return { kind: "handled" };
36617
37381
  }
@@ -36634,22 +37398,22 @@ async function dispatch(input, ctx) {
36634
37398
  return { kind: "handled", summary };
36635
37399
  }
36636
37400
  console.log(
36637
- " " + chalk80.dim("Not in Q&A yet. Confirm the scope, load data, and run analysis first. Type ") + paint("accent", "/home") + chalk80.dim(" for status.")
37401
+ " " + chalk83.dim("Not in Q&A yet. Confirm the scope, load data, and run analysis first. Type ") + paint("accent", "/home") + chalk83.dim(" for status.")
36638
37402
  );
36639
37403
  return { kind: "handled" };
36640
37404
  }
36641
37405
  console.log(
36642
- " " + chalk80.dim("Natural-language questions run inside ntrp. Start with ") + paint("accent", "ntrp") + chalk80.dim(" and type a question after analysis.")
37406
+ " " + chalk83.dim("Natural-language questions run inside ntrp. Start with ") + paint("accent", "ntrp") + chalk83.dim(" and type a question after analysis.")
36643
37407
  );
36644
37408
  return { kind: "handled" };
36645
37409
  }
36646
37410
  async function runSlashCommand(name, args, ctx) {
36647
- const handler49 = await resolveHandler(name);
36648
- if (!handler49) {
36649
- console.error(chalk80.red(` Unknown command: /${name}`));
37411
+ const handler50 = await resolveHandler(name);
37412
+ if (!handler50) {
37413
+ console.error(chalk83.red(` Unknown command: /${name}`));
36650
37414
  return void 0;
36651
37415
  }
36652
- const result = await handler49(args, ctx);
37416
+ const result = await handler50(args, ctx);
36653
37417
  return result ?? void 0;
36654
37418
  }
36655
37419
  async function runNaturalLanguage2(input, ctx) {
@@ -36683,7 +37447,7 @@ var init_inline_suggestion = __esm({
36683
37447
  });
36684
37448
 
36685
37449
  // src/conversation/loop-guard.ts
36686
- import chalk81 from "chalk";
37450
+ import chalk84 from "chalk";
36687
37451
  function createLoopGuardState() {
36688
37452
  return { phase: null, stuckTurns: 0 };
36689
37453
  }
@@ -36715,10 +37479,10 @@ function printLoopEscalation(phase) {
36715
37479
  if (!guide) return;
36716
37480
  console.log();
36717
37481
  console.log(
36718
- " " + chalk81.yellow("We seem to be going in circles \u2014 you're in ") + paint("accent", guide.mode) + chalk81.yellow(" mode.")
37482
+ " " + chalk84.yellow("We seem to be going in circles \u2014 you're in ") + paint("accent", guide.mode) + chalk84.yellow(" mode.")
36719
37483
  );
36720
- console.log(" " + chalk81.dim("Right now I can only accept: ") + guide.accepts);
36721
- console.log(" " + chalk81.dim("To leave: ") + guide.leave);
37484
+ console.log(" " + chalk84.dim("Right now I can only accept: ") + guide.accepts);
37485
+ console.log(" " + chalk84.dim("To leave: ") + guide.leave);
36722
37486
  console.log();
36723
37487
  }
36724
37488
  var LOOP_GUARD_THRESHOLD, MODAL_PHASES, PHASE_GUIDES;
@@ -36761,7 +37525,7 @@ __export(welcome_exports, {
36761
37525
  printWelcome: () => printWelcome,
36762
37526
  resolveWelcomeNextAction: () => resolveWelcomeNextAction
36763
37527
  });
36764
- import chalk82 from "chalk";
37528
+ import chalk85 from "chalk";
36765
37529
  function formatHomeEntityCounts(counts) {
36766
37530
  const parts = [];
36767
37531
  const people = counts.people ?? 0;
@@ -36775,11 +37539,11 @@ function formatHomeEntityCounts(counts) {
36775
37539
  return parts.join(" \xB7 ");
36776
37540
  }
36777
37541
  function formatEmptyDataHomeHint(savedSessionCount, opts = {}) {
36778
- const onboard = opts.includeOnboard === true ? chalk82.dim(", or ") + paint("accent", "/onboard") + chalk82.dim(" to calibrate") : "";
37542
+ const onboard = opts.includeOnboard === true ? chalk85.dim(", or ") + paint("accent", "/onboard") + chalk85.dim(" to calibrate") : "";
36779
37543
  if (savedSessionCount > 0) {
36780
- return chalk82.dim("Type ") + paint("accent", "use demo data") + chalk82.dim(" to load a sample") + onboard + chalk82.dim(". Type ") + paint("accent", "/session") + chalk82.dim(" to open a saved session");
37544
+ return chalk85.dim("Type ") + paint("accent", "use demo data") + chalk85.dim(" to load a sample") + onboard + chalk85.dim(". Type ") + paint("accent", "/session") + chalk85.dim(" to open a saved session");
36781
37545
  }
36782
- return chalk82.dim("Type ") + paint("accent", "use demo data") + chalk82.dim(" to load a sample pipeline") + onboard;
37546
+ return chalk85.dim("Type ") + paint("accent", "use demo data") + chalk85.dim(" to load a sample pipeline") + onboard;
36783
37547
  }
36784
37548
  function ntrpStatusRow(version, update) {
36785
37549
  if (update && isNewerVersion(update.latest, version)) {
@@ -36791,7 +37555,7 @@ function ntrpStatusRow(version, update) {
36791
37555
  }
36792
37556
  return {
36793
37557
  label: "ntrp",
36794
- state: chalk82.dim(`v${version}`),
37558
+ state: chalk85.dim(`v${version}`),
36795
37559
  detail: ""
36796
37560
  };
36797
37561
  }
@@ -36828,19 +37592,19 @@ function sessionSummaryText(s) {
36828
37592
  summary: s.summary,
36829
37593
  dataset: s.dataset
36830
37594
  });
36831
- return summary === NO_SUMMARY ? chalk82.dim(summary) : summary;
37595
+ return summary === NO_SUMMARY ? chalk85.dim(summary) : summary;
36832
37596
  }
36833
37597
  function formatLastSessionLine(s, colW, ctx, opts) {
36834
37598
  const phase = sessionPhaseLabel(s, ctx);
36835
- const current = opts?.markCurrent && s.id === ctx?.sessionId ? chalk82.dim(" \xB7 current") : "";
36836
- const meta = `${formatSessionId(s.id, s.name)} ${chalk82.dim("\xB7")} ${chalk82.dim(lensBadgeLabel(s.analysis))} ${chalk82.dim("\xB7")} ${paint("accent", phase)} ${chalk82.dim("\xB7")} ${sessionSummaryText(s)}${current}`;
37599
+ const current = opts?.markCurrent && s.id === ctx?.sessionId ? chalk85.dim(" \xB7 current") : "";
37600
+ const meta = `${formatSessionId(s.id, s.name)} ${chalk85.dim("\xB7")} ${chalk85.dim(lensBadgeLabel(s.analysis))} ${chalk85.dim("\xB7")} ${paint("accent", phase)} ${chalk85.dim("\xB7")} ${sessionSummaryText(s)}${current}`;
36837
37601
  return truncateVisible(` ${meta}`, colW);
36838
37602
  }
36839
37603
  function formatActiveSessionLine(s, colW, ctx, opts) {
36840
37604
  const indent = " ";
36841
37605
  const idPart = formatSessionId(s.id, s.name);
36842
- const status = chalk82.dim(` \xB7 ${sessionStatusSuffix(s)}`);
36843
- const current = opts?.markCurrent && s.id === ctx?.sessionId ? chalk82.dim(" \xB7 current") : "";
37606
+ const status = chalk85.dim(` \xB7 ${sessionStatusSuffix(s)}`);
37607
+ const current = opts?.markCurrent && s.id === ctx?.sessionId ? chalk85.dim(" \xB7 current") : "";
36844
37608
  const suffix = `${status}${current}`;
36845
37609
  const summaryBudget = Math.max(8, colW - visibleWidth(indent) - visibleWidth(idPart) - visibleWidth(suffix) - 2);
36846
37610
  const summaryPart = truncateVisible(sessionSummaryText(s), summaryBudget);
@@ -36881,13 +37645,13 @@ function buildSystemLines(colW, statusRows, recent) {
36881
37645
  lines.push(sectionHeading("System"));
36882
37646
  const labelW = Math.max(...statusRows.map((r) => r.label.length), "last used".length);
36883
37647
  for (const item of statusRows) {
36884
- const label = chalk82.dim(padRight(item.label, labelW));
37648
+ const label = chalk85.dim(padRight(item.label, labelW));
36885
37649
  const state2 = padRight(item.state, 10);
36886
37650
  const detailW = Math.max(1, colW - labelW - 13);
36887
- lines.push(`${label} ${state2} ${chalk82.dim(truncateVisible(item.detail, detailW))}`);
37651
+ lines.push(`${label} ${state2} ${chalk85.dim(truncateVisible(item.detail, detailW))}`);
36888
37652
  }
36889
37653
  if (recent) {
36890
- lines.push(`${chalk82.dim(padRight("last used", labelW))} ${chalk82.dim(recent)}`);
37654
+ lines.push(`${chalk85.dim(padRight("last used", labelW))} ${chalk85.dim(recent)}`);
36891
37655
  }
36892
37656
  return lines;
36893
37657
  }
@@ -36895,10 +37659,10 @@ function buildLastSessionLines(colW, ctx, lastSession, nextAction, emptyDataHint
36895
37659
  const lines = [""];
36896
37660
  lines.push(sectionHeading("Last Session"));
36897
37661
  if (!lastSession) {
36898
- lines.push(` ${chalk82.dim("(none)")}`);
37662
+ lines.push(` ${chalk85.dim("(none)")}`);
36899
37663
  lines.push(
36900
37664
  truncateVisible(
36901
- ` ${nextAction.command ? actionHint(nextAction.label, nextAction.command, nextAction.detail) : `${chalk82.dim(nextAction.label)} ${chalk82.dim(nextAction.detail)}`}`,
37665
+ ` ${nextAction.command ? actionHint(nextAction.label, nextAction.command, nextAction.detail) : `${chalk85.dim(nextAction.label)} ${chalk85.dim(nextAction.detail)}`}`,
36902
37666
  colW
36903
37667
  )
36904
37668
  );
@@ -36912,7 +37676,7 @@ function buildLastSessionLines(colW, ctx, lastSession, nextAction, emptyDataHint
36912
37676
  if (!isCurrent) {
36913
37677
  lines.push(
36914
37678
  truncateVisible(
36915
- ` ${chalk82.dim("Resume:")} ${paint("accent", `/session ${lastSession.id.slice(-4)}`)}`,
37679
+ ` ${chalk85.dim("Resume:")} ${paint("accent", `/session ${lastSession.id.slice(-4)}`)}`,
36916
37680
  colW
36917
37681
  )
36918
37682
  );
@@ -36921,7 +37685,7 @@ function buildLastSessionLines(colW, ctx, lastSession, nextAction, emptyDataHint
36921
37685
  truncateVisible(` ${actionHint(nextAction.label, nextAction.command, nextAction.detail)}`, colW)
36922
37686
  );
36923
37687
  } else {
36924
- lines.push(truncateVisible(` ${chalk82.dim(nextAction.label)} ${chalk82.dim(nextAction.detail)}`, colW));
37688
+ lines.push(truncateVisible(` ${chalk85.dim(nextAction.label)} ${chalk85.dim(nextAction.detail)}`, colW));
36925
37689
  }
36926
37690
  if (isCurrent && emptyDataHint) {
36927
37691
  lines.push(truncateVisible(` ${emptyDataHint}`, colW));
@@ -36932,14 +37696,14 @@ function buildActiveSessionsLines(colW, ctx, activeSessions) {
36932
37696
  const lines = [""];
36933
37697
  lines.push(sectionHeading("Active Sessions"));
36934
37698
  if (activeSessions.length === 0) {
36935
- lines.push(` ${chalk82.dim("(none in progress)")}`);
37699
+ lines.push(` ${chalk85.dim("(none in progress)")}`);
36936
37700
  return lines;
36937
37701
  }
36938
37702
  for (const s of activeSessions.slice(0, 5)) {
36939
37703
  lines.push(formatActiveSessionLine(s, colW, ctx, { markCurrent: true }));
36940
37704
  }
36941
37705
  if (activeSessions.length > 5) {
36942
- lines.push(` ${chalk82.dim(`+${activeSessions.length - 5} more \xB7 `)}${paint("accent", "/session")}`);
37706
+ lines.push(` ${chalk85.dim(`+${activeSessions.length - 5} more \xB7 `)}${paint("accent", "/session")}`);
36943
37707
  }
36944
37708
  return lines;
36945
37709
  }
@@ -36996,7 +37760,7 @@ async function printWelcome(ctx, version) {
36996
37760
  const { countAvailableEngines: countAvailableEngines2, formatActiveStack: formatActiveStack2 } = await Promise.resolve().then(() => (init_session_state(), session_state_exports));
36997
37761
  const engineCount = countAvailableEngines2();
36998
37762
  const llmDetail = engineCount === 0 ? "paste a key. Type /connect" : formatActiveStack2(ctx);
36999
- const llmState = engineCount > 0 ? badge("READY", "success") : chalk82.dim("\u2014");
37763
+ const llmState = engineCount > 0 ? badge("READY", "success") : chalk85.dim("\u2014");
37000
37764
  const license = checkLicense();
37001
37765
  let licenseState;
37002
37766
  let licenseDetail;
@@ -37061,14 +37825,14 @@ async function printWelcome(ctx, version) {
37061
37825
  const logoOffset = " ".repeat(Math.max(0, Math.floor((cardW - maxLogoW) / 2)));
37062
37826
  for (const line of logo) push(logoOffset + line);
37063
37827
  const taglineOffset = " ".repeat(Math.max(0, Math.floor((cardW - visibleWidth(TAGLINE)) / 2)));
37064
- push(taglineOffset + chalk82.dim(TAGLINE));
37828
+ push(taglineOffset + chalk85.dim(TAGLINE));
37065
37829
  push("");
37066
37830
  }
37067
37831
  const versionTag = ` v${version} `;
37068
37832
  const gap = Math.max(0, innerW - versionTag.length);
37069
37833
  const gapL = Math.floor(gap / 2);
37070
37834
  push(
37071
- border(`\u256D${"\u2500".repeat(gapL)}`) + chalk82.dim(versionTag) + border(`${"\u2500".repeat(gap - gapL)}\u256E`)
37835
+ border(`\u256D${"\u2500".repeat(gapL)}`) + chalk85.dim(versionTag) + border(`${"\u2500".repeat(gap - gapL)}\u256E`)
37072
37836
  );
37073
37837
  if (useWideLayout) {
37074
37838
  const leftLines = systemLines;
@@ -37095,21 +37859,21 @@ async function printWelcome(ctx, version) {
37095
37859
  push(border(`\u2570${"\u2500".repeat(innerW)}\u256F`));
37096
37860
  push(
37097
37861
  truncateVisible(
37098
- license.valid ? ` ${paint("accent", "/help")}${chalk82.dim(" commands \xB7 ")}${paint("accent", "/deepdive")}${chalk82.dim(" tour \xB7 ")}${paint("accent", "/progress")}${chalk82.dim(" hours \xB7 ")}${paint("accent", "/session")}${chalk82.dim(" resume")}` : ` ${paint("accent", "/help")}${chalk82.dim(" commands \xB7 ")}${paint("accent", "/activate")}${chalk82.dim(" paste a key \xB7 ")}${paint("accent", "/checkout")}${chalk82.dim(" signup \xB7 ")}${paint("accent", "/progress")}${chalk82.dim(" hours")}`,
37862
+ license.valid ? ` ${paint("accent", "/help")}${chalk85.dim(" commands \xB7 ")}${paint("accent", "/deepdive")}${chalk85.dim(" tour \xB7 ")}${paint("accent", "/progress")}${chalk85.dim(" hours \xB7 ")}${paint("accent", "/session")}${chalk85.dim(" resume")}` : ` ${paint("accent", "/help")}${chalk85.dim(" commands \xB7 ")}${paint("accent", "/activate")}${chalk85.dim(" paste a key \xB7 ")}${paint("accent", "/checkout")}${chalk85.dim(" signup \xB7 ")}${paint("accent", "/progress")}${chalk85.dim(" hours")}`,
37099
37863
  cardW
37100
37864
  )
37101
37865
  );
37102
37866
  if (strategyNudge) {
37103
37867
  push(
37104
37868
  truncateVisible(
37105
- ` ${paint("warning", "\u2691")} ${chalk82.dim(strategyNudge.text)} ${chalk82.dim("\xB7")} ${paint("accent", strategyNudge.command)}`,
37869
+ ` ${paint("warning", "\u2691")} ${chalk85.dim(strategyNudge.text)} ${chalk85.dim("\xB7")} ${paint("accent", strategyNudge.command)}`,
37106
37870
  cardW
37107
37871
  )
37108
37872
  );
37109
37873
  } else if (deepdiveNudge) {
37110
37874
  push(
37111
37875
  truncateVisible(
37112
- ` ${paint("warning", "\u2691")} ${chalk82.dim(deepdiveNudge.text)} ${chalk82.dim("\xB7")} ${paint("accent", deepdiveNudge.command)}`,
37876
+ ` ${paint("warning", "\u2691")} ${chalk85.dim(deepdiveNudge.text)} ${chalk85.dim("\xB7")} ${paint("accent", deepdiveNudge.command)}`,
37113
37877
  cardW
37114
37878
  )
37115
37879
  );
@@ -37191,6 +37955,21 @@ var init_deepdive_complete = __esm({
37191
37955
  }
37192
37956
  });
37193
37957
 
37958
+ // src/conversation/thinkwithme-complete.ts
37959
+ function thinkwithmeGhostSuffix(line) {
37960
+ if (!/^\/?thinkwithme/i.test(line)) return null;
37961
+ if (/\s/.test(line)) return null;
37962
+ const full = line.startsWith("/") ? "/thinkwithme" : "thinkwithme";
37963
+ if (full.toLowerCase() === line.toLowerCase()) return null;
37964
+ if (!full.toLowerCase().startsWith(line.toLowerCase())) return null;
37965
+ return full.slice(line.length);
37966
+ }
37967
+ var init_thinkwithme_complete = __esm({
37968
+ "src/conversation/thinkwithme-complete.ts"() {
37969
+ "use strict";
37970
+ }
37971
+ });
37972
+
37194
37973
  // src/cli/repl.ts
37195
37974
  var repl_exports = {};
37196
37975
  __export(repl_exports, {
@@ -37202,7 +37981,7 @@ __export(repl_exports, {
37202
37981
  });
37203
37982
  import { createInterface as createInterface2 } from "readline/promises";
37204
37983
  import { clearLine as clearLine2, cursorTo as cursorTo2 } from "readline";
37205
- import chalk83 from "chalk";
37984
+ import chalk86 from "chalk";
37206
37985
  import { join as join37 } from "path";
37207
37986
  function buildPrompt(ctx) {
37208
37987
  return buildConversationPrompt(ctx);
@@ -37235,6 +38014,9 @@ function inlineCommandSuggestion(line) {
37235
38014
  if (/^\/deepdive(\s|$)/i.test(line)) {
37236
38015
  return deepdiveGhostSuffix(line);
37237
38016
  }
38017
+ if (/^\/thinkwithme/i.test(line)) {
38018
+ return thinkwithmeGhostSuffix(line);
38019
+ }
37238
38020
  if (/\s/.test(line)) return null;
37239
38021
  const matches = commandCompletionCandidates().filter((command) => command.startsWith(line));
37240
38022
  if (matches.length === 0) return null;
@@ -37286,12 +38068,12 @@ function renderInlineSuggestion(rl, prompt, ctx) {
37286
38068
  suggestionPainted = suffix !== null;
37287
38069
  clearLine2(process.stdout, 0);
37288
38070
  cursorTo2(process.stdout, 0);
37289
- process.stdout.write(prompt + line + (suffix ? chalk83.dim(suffix) : ""));
38071
+ process.stdout.write(prompt + line + (suffix ? chalk86.dim(suffix) : ""));
37290
38072
  cursorTo2(process.stdout, promptWidth + cursor);
37291
38073
  }
37292
38074
  function appendTurnLine(current, promptLabel, currentSummary) {
37293
- const currentLine = currentSummary ? `${promptLabel} ${current} ${chalk83.white("\u2192")} ${currentSummary}` : `${promptLabel} ${current}`;
37294
- console.log(" " + chalk83.dim(currentLine));
38075
+ const currentLine = currentSummary ? `${promptLabel} ${current} ${chalk86.white("\u2192")} ${currentSummary}` : `${promptLabel} ${current}`;
38076
+ console.log(" " + chalk86.dim(currentLine));
37295
38077
  console.log();
37296
38078
  }
37297
38079
  async function goHome(ctx, version, history, opts) {
@@ -37301,7 +38083,7 @@ async function goHome(ctx, version, history, opts) {
37301
38083
  process.stdout.write("\x1B[2J\x1B[H");
37302
38084
  if (opts?.banner) {
37303
38085
  console.log();
37304
- console.log(" " + paint("accent", "\u2713") + " " + chalk83.dim(opts.banner));
38086
+ console.log(" " + paint("accent", "\u2713") + " " + chalk86.dim(opts.banner));
37305
38087
  }
37306
38088
  await printWelcome(ctx, version);
37307
38089
  }
@@ -37324,11 +38106,11 @@ async function handleDispatchResult(result, ctx, version, history) {
37324
38106
  case "unknown":
37325
38107
  if (result.suggestion) {
37326
38108
  console.log(
37327
- " " + chalk83.red(`Unknown command: ${result.token}.`) + chalk83.dim(" Did you mean ") + paint("accent", result.suggestion) + chalk83.dim("?")
38109
+ " " + chalk86.red(`Unknown command: ${result.token}.`) + chalk86.dim(" Did you mean ") + paint("accent", result.suggestion) + chalk86.dim("?")
37328
38110
  );
37329
38111
  } else {
37330
38112
  console.log(
37331
- " " + chalk83.red(`Unknown command: ${result.token}`) + chalk83.dim(" Type ") + paint("accent", "/help") + chalk83.dim(" to see available commands.")
38113
+ " " + chalk86.red(`Unknown command: ${result.token}`) + chalk86.dim(" Type ") + paint("accent", "/help") + chalk86.dim(" to see available commands.")
37332
38114
  );
37333
38115
  }
37334
38116
  break;
@@ -37352,7 +38134,7 @@ async function runRepl(ctx, version) {
37352
38134
  });
37353
38135
  ctx.rl = rl;
37354
38136
  console.log();
37355
- console.log(" " + chalk83.dim("What do you want to look at?"));
38137
+ console.log(" " + chalk86.dim("What do you want to look at?"));
37356
38138
  console.log();
37357
38139
  if (ctx.pendingUpdateCheck) {
37358
38140
  void ctx.pendingUpdateCheck.then((result) => {
@@ -37394,7 +38176,7 @@ async function runRepl(ctx, version) {
37394
38176
  return;
37395
38177
  }
37396
38178
  sigintPrimed = true;
37397
- console.log("\n " + chalk83.dim("Type /exit to quit, or press Ctrl+C again."));
38179
+ console.log("\n " + chalk86.dim("Type /exit to quit, or press Ctrl+C again."));
37398
38180
  };
37399
38181
  rl.on("SIGINT", sigintHandler);
37400
38182
  function shutdownRepl() {
@@ -37430,7 +38212,7 @@ async function runRepl(ctx, version) {
37430
38212
  if (!typed && !enterAction) {
37431
38213
  clearGhostRowAfterSubmit();
37432
38214
  const coach = consumeOrientEmptyEnterCoach(ctx);
37433
- if (coach) console.log(" " + chalk83.dim(coach));
38215
+ if (coach) console.log(" " + chalk86.dim(coach));
37434
38216
  continue;
37435
38217
  }
37436
38218
  const line = typed || enterAction.submit;
@@ -37481,9 +38263,9 @@ async function runRepl(ctx, version) {
37481
38263
  ctx.wizardDepth = 0;
37482
38264
  ctx.secretInputActive = false;
37483
38265
  if (err instanceof Error && err.message === "Cancelled") {
37484
- console.log(" " + chalk83.dim("Cancelled."));
38266
+ console.log(" " + chalk86.dim("Cancelled."));
37485
38267
  } else {
37486
- console.error(" " + chalk83.red("Error: " + String(err.message ?? err)));
38268
+ console.error(" " + chalk86.red("Error: " + String(err.message ?? err)));
37487
38269
  }
37488
38270
  }
37489
38271
  }
@@ -37509,10 +38291,10 @@ async function runRepl(ctx, version) {
37509
38291
  await closeSession(ctx);
37510
38292
  }
37511
38293
  if (isTranscriptActive(ctx.sessionId)) {
37512
- console.log(" " + chalk83.dim("Transcript: ") + chalk83.dim(transcriptPathForSession(ctx.sessionId)));
37513
- console.log(" " + chalk83.dim("Context brief: ") + chalk83.dim(contextDocPathForSession(ctx.sessionId)));
38294
+ console.log(" " + chalk86.dim("Transcript: ") + chalk86.dim(transcriptPathForSession(ctx.sessionId)));
38295
+ console.log(" " + chalk86.dim("Context brief: ") + chalk86.dim(contextDocPathForSession(ctx.sessionId)));
37514
38296
  }
37515
- console.log(" " + chalk83.dim(randomGoodbye()));
38297
+ console.log(" " + chalk86.dim(randomGoodbye()));
37516
38298
  }
37517
38299
  function printHelpOneShot() {
37518
38300
  printHelp();
@@ -37520,12 +38302,12 @@ function printHelpOneShot() {
37520
38302
  function printHelp() {
37521
38303
  console.log();
37522
38304
  console.log(" " + sectionHeading("Conversation"));
37523
- console.log(" " + chalk83.dim("Type the question. You do not need a slash command."));
37524
- console.log(" " + chalk83.dim("Paste a CSV path or type ") + paint("accent", '"use demo data"') + chalk83.dim(" to load data."));
37525
- console.log(" " + chalk83.dim("After analysis, type questions in English."));
37526
- console.log(" " + chalk83.dim("Type ") + paint("accent", '"how should we fix this?"') + chalk83.dim(" to make a strategy."));
37527
- console.log(" " + chalk83.dim("Type ") + paint("accent", '"ship a board deck"') + chalk83.dim(" to write a handoff."));
37528
- console.log(" " + chalk83.dim("The ") + paint("accent", "ask \u203A") + chalk83.dim(" prompt shows brief or deep. Brief is the default after analysis."));
38305
+ console.log(" " + chalk86.dim("Type the question. You do not need a slash command."));
38306
+ console.log(" " + chalk86.dim("Paste a CSV path or type ") + paint("accent", '"use demo data"') + chalk86.dim(" to load data."));
38307
+ console.log(" " + chalk86.dim("After analysis, type questions in English."));
38308
+ console.log(" " + chalk86.dim("Type ") + paint("accent", '"how should we fix this?"') + chalk86.dim(" to make a strategy."));
38309
+ console.log(" " + chalk86.dim("Type ") + paint("accent", '"ship a board deck"') + chalk86.dim(" to write a handoff."));
38310
+ console.log(" " + chalk86.dim("The ") + paint("accent", "ask \u203A") + chalk86.dim(" prompt shows brief or deep. Brief is the default after analysis."));
37529
38311
  console.log();
37530
38312
  console.log(" " + sectionHeading("Shortcuts"));
37531
38313
  const shortcuts = [
@@ -37550,11 +38332,11 @@ function printHelp() {
37550
38332
  ];
37551
38333
  const maxW = Math.max(...shortcuts.map(([c]) => c.length)) + 2;
37552
38334
  for (const [cmd, desc] of shortcuts) {
37553
- console.log(` ${paint("accent", padRight(cmd, maxW))} ${chalk83.dim(desc)}`);
38335
+ console.log(` ${paint("accent", padRight(cmd, maxW))} ${chalk86.dim(desc)}`);
37554
38336
  }
37555
38337
  console.log();
37556
38338
  console.log(" " + sectionHeading("Teach NTRP"));
37557
- console.log(" " + chalk83.dim("NTRP learns your business over time. There are three ways to teach it:"));
38339
+ console.log(" " + chalk86.dim("NTRP learns your business over time. There are three ways to teach it:"));
37558
38340
  const teach = [
37559
38341
  ["/remember <fact>", "Store a fact, a decision, or a preference"],
37560
38342
  ["/recall [topic]", "Show what NTRP stores about your business"],
@@ -37563,13 +38345,13 @@ function printHelp() {
37563
38345
  ];
37564
38346
  const teachMaxW = Math.max(...teach.map(([c]) => c.length)) + 2;
37565
38347
  for (const [cmd, desc] of teach) {
37566
- console.log(` ${paint("accent", padRight(cmd, teachMaxW))} ${chalk83.dim(desc)}`);
38348
+ console.log(` ${paint("accent", padRight(cmd, teachMaxW))} ${chalk86.dim(desc)}`);
37567
38349
  }
37568
- console.log(" " + chalk83.dim("When a key is connected, NTRP stores a small number of facts when you close a session."));
38350
+ console.log(" " + chalk86.dim("When a key is connected, NTRP stores a small number of facts when you close a session."));
37569
38351
  console.log();
37570
- console.log(" " + chalk83.dim("Factory reset: type ") + paint("accent", "/scratch") + chalk83.dim("."));
38352
+ console.log(" " + chalk86.dim("Factory reset: type ") + paint("accent", "/scratch") + chalk86.dim("."));
37571
38353
  console.log();
37572
- console.log(" " + chalk83.dim("These commands also work: ") + paint("accent", "/new") + chalk83.dim(", ") + paint("accent", "/diagnose") + chalk83.dim(", ") + paint("accent", "/metrics") + chalk83.dim(", ") + paint("accent", "/session") + chalk83.dim("."));
38354
+ console.log(" " + chalk86.dim("These commands also work: ") + paint("accent", "/new") + chalk86.dim(", ") + paint("accent", "/diagnose") + chalk86.dim(", ") + paint("accent", "/metrics") + chalk86.dim(", ") + paint("accent", "/session") + chalk86.dim("."));
37573
38355
  console.log();
37574
38356
  }
37575
38357
  var REPL_BUILTINS, ANSI_PATTERN, GOODBYES, GHOST_HINTS, ghostHintTurn, activeGhostHint, suggestionPainted;
@@ -37597,6 +38379,7 @@ var init_repl = __esm({
37597
38379
  init_welcome();
37598
38380
  init_registry();
37599
38381
  init_deepdive_complete();
38382
+ init_thinkwithme_complete();
37600
38383
  init_inline_suggestion();
37601
38384
  REPL_BUILTINS = [
37602
38385
  "/help",
@@ -37679,7 +38462,7 @@ init_emit();
37679
38462
  init_errors2();
37680
38463
  init_types2();
37681
38464
  init_version();
37682
- import chalk84 from "chalk";
38465
+ import chalk87 from "chalk";
37683
38466
  var VERSION = getInstalledVersion();
37684
38467
  function exitIfVersionFlag(argv) {
37685
38468
  const rest = argv.slice(2).filter((a) => a === "--version" || a === "-v");
@@ -37714,7 +38497,7 @@ async function main() {
37714
38497
  quiet: args.globals.quiet
37715
38498
  });
37716
38499
  if (!ctx.execution.color) {
37717
- chalk84.level = 0;
38500
+ chalk87.level = 0;
37718
38501
  }
37719
38502
  if (args.globals.stdin) {
37720
38503
  args.input = (await readStdin()).trim();
@@ -37727,16 +38510,16 @@ async function main() {
37727
38510
  if (isStructuredOutput(ctx.execution)) {
37728
38511
  emitError(cmd || "ntrp", new NtrpError("license_invalid", lic2.message, 3 /* Auth */));
37729
38512
  }
37730
- console.error(chalk84.red(`
38513
+ console.error(chalk87.red(`
37731
38514
  ${lic2.message}`));
37732
- console.error(chalk84.dim(" Trial's over \u2014 /upgrade and paste your key.\n"));
38515
+ console.error(chalk87.dim(" Trial's over \u2014 /upgrade and paste your key.\n"));
37733
38516
  process.exit(1);
37734
38517
  }
37735
38518
  }
37736
38519
  const PROFILE_HINT_SKIP = /* @__PURE__ */ new Set(["onboard", "setup", "config", "connect", "activate", "help", "home", "exit", "quit", "clear", "profile", "progress", "deepdive"]);
37737
38520
  if (!isProfileConfigured() && !PROFILE_HINT_SKIP.has(cmd) && !ctx.execution.quiet) {
37738
38521
  console.error(
37739
- " " + chalk84.dim("Tip: run ") + paint("accent", "ntrp") + chalk84.dim(" interactively to set up your company profile for richer answers.")
38522
+ " " + chalk87.dim("Tip: run ") + paint("accent", "ntrp") + chalk87.dim(" interactively to set up your company profile for richer answers.")
37740
38523
  );
37741
38524
  }
37742
38525
  const result = await dispatch(args.input, ctx);
@@ -37748,12 +38531,12 @@ async function main() {
37748
38531
  }
37749
38532
  if (result.suggestion) {
37750
38533
  console.error(
37751
- chalk84.red(` Unknown command: ${result.token}.`) + chalk84.dim(" Did you mean ") + paint("accent", result.suggestion) + chalk84.dim("?")
38534
+ chalk87.red(` Unknown command: ${result.token}.`) + chalk87.dim(" Did you mean ") + paint("accent", result.suggestion) + chalk87.dim("?")
37752
38535
  );
37753
38536
  } else {
37754
- console.error(chalk84.red(` Unknown command: ${result.token}`));
38537
+ console.error(chalk87.red(` Unknown command: ${result.token}`));
37755
38538
  }
37756
- console.error(chalk84.dim(" Run 'ntrp' for the interactive prompt."));
38539
+ console.error(chalk87.dim(" Run 'ntrp' for the interactive prompt."));
37757
38540
  process.exit(1);
37758
38541
  break;
37759
38542
  case "help":
@@ -37800,7 +38583,7 @@ async function main() {
37800
38583
  const justUpdated = consumeJustUpdatedEnv2();
37801
38584
  if (justUpdated) {
37802
38585
  console.log();
37803
- console.log(" " + paint("accent", "\u2713") + " " + chalk84.dim(`Now running v${justUpdated.to}`));
38586
+ console.log(" " + paint("accent", "\u2713") + " " + chalk87.dim(`Now running v${justUpdated.to}`));
37804
38587
  }
37805
38588
  await printWelcome2(ctx, VERSION);
37806
38589
  await runRepl(ctx, VERSION);