@sonnechasser/ntrp 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +147 -56
- package/dist/mcp/server.js +21 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9887,11 +9887,15 @@ function resolveCardWidth(opts = {}) {
|
|
|
9887
9887
|
const usable = Math.max(20, termWidth() - margin);
|
|
9888
9888
|
return Math.max(Math.min(min, usable), Math.min(usable, max));
|
|
9889
9889
|
}
|
|
9890
|
-
|
|
9890
|
+
function clearTerminalHome() {
|
|
9891
|
+
process.stdout.write(TERMINAL_HOME_CLEAR);
|
|
9892
|
+
}
|
|
9893
|
+
var ANSI_RE, TERMINAL_HOME_CLEAR;
|
|
9891
9894
|
var init_layout = __esm({
|
|
9892
9895
|
"src/ui/layout.ts"() {
|
|
9893
9896
|
"use strict";
|
|
9894
9897
|
ANSI_RE = /\u001b\[[0-9;]*m/g;
|
|
9898
|
+
TERMINAL_HOME_CLEAR = "\x1B[2J\x1B[H";
|
|
9895
9899
|
}
|
|
9896
9900
|
});
|
|
9897
9901
|
|
|
@@ -22445,9 +22449,9 @@ async function handleGetSessionBrief(input) {
|
|
|
22445
22449
|
if (!target) {
|
|
22446
22450
|
return { error: `No session matching "${raw}".` };
|
|
22447
22451
|
}
|
|
22448
|
-
const { existsSync:
|
|
22452
|
+
const { existsSync: existsSync35, readFileSync: readFileSync24 } = await import("fs");
|
|
22449
22453
|
const briefPath = contextDocPathForSession2(target.id);
|
|
22450
|
-
if (!
|
|
22454
|
+
if (!existsSync35(briefPath)) {
|
|
22451
22455
|
return {
|
|
22452
22456
|
session_id: target.id,
|
|
22453
22457
|
error: "No context brief on disk for this session (created before brief storage existed).",
|
|
@@ -34629,22 +34633,29 @@ var init_update_check = __esm({
|
|
|
34629
34633
|
import { existsSync as existsSync30, readFileSync as readFileSync22 } from "fs";
|
|
34630
34634
|
import { dirname as dirname6, join as join34 } from "path";
|
|
34631
34635
|
import { fileURLToPath } from "url";
|
|
34636
|
+
function readVersionFromPackageJson(packageJsonPath) {
|
|
34637
|
+
if (!existsSync30(packageJsonPath)) return null;
|
|
34638
|
+
try {
|
|
34639
|
+
const pkg = JSON.parse(readFileSync22(packageJsonPath, "utf-8"));
|
|
34640
|
+
if (typeof pkg.version === "string" && pkg.version.length > 0) return pkg.version;
|
|
34641
|
+
} catch {
|
|
34642
|
+
}
|
|
34643
|
+
return null;
|
|
34644
|
+
}
|
|
34645
|
+
function readVersionNearEntry(entryPath) {
|
|
34646
|
+
const start = dirname6(entryPath);
|
|
34647
|
+
for (const rel of [join34(start, "..", "package.json"), join34(start, "../..", "package.json")]) {
|
|
34648
|
+
const version = readVersionFromPackageJson(rel);
|
|
34649
|
+
if (version) return version;
|
|
34650
|
+
}
|
|
34651
|
+
return null;
|
|
34652
|
+
}
|
|
34653
|
+
function readInstalledVersionFromDisk() {
|
|
34654
|
+
return readVersionNearEntry(fileURLToPath(import.meta.url));
|
|
34655
|
+
}
|
|
34632
34656
|
function getInstalledVersion() {
|
|
34633
34657
|
if (cachedVersion) return cachedVersion;
|
|
34634
|
-
|
|
34635
|
-
for (const rel of ["../package.json", "../../package.json"]) {
|
|
34636
|
-
const path = join34(start, rel);
|
|
34637
|
-
if (!existsSync30(path)) continue;
|
|
34638
|
-
try {
|
|
34639
|
-
const pkg = JSON.parse(readFileSync22(path, "utf-8"));
|
|
34640
|
-
if (typeof pkg.version === "string" && pkg.version.length > 0) {
|
|
34641
|
-
cachedVersion = pkg.version;
|
|
34642
|
-
return cachedVersion;
|
|
34643
|
-
}
|
|
34644
|
-
} catch {
|
|
34645
|
-
}
|
|
34646
|
-
}
|
|
34647
|
-
cachedVersion = "0.0.0";
|
|
34658
|
+
cachedVersion = readInstalledVersionFromDisk() ?? "0.0.0";
|
|
34648
34659
|
return cachedVersion;
|
|
34649
34660
|
}
|
|
34650
34661
|
var cachedVersion;
|
|
@@ -34756,9 +34767,16 @@ __export(relaunch_exports, {
|
|
|
34756
34767
|
JUST_UPDATED_ENV: () => JUST_UPDATED_ENV,
|
|
34757
34768
|
consumeJustUpdatedEnv: () => consumeJustUpdatedEnv,
|
|
34758
34769
|
encodeJustUpdated: () => encodeJustUpdated,
|
|
34770
|
+
reclaimStdinAfterFailedRelaunch: () => reclaimStdinAfterFailedRelaunch,
|
|
34771
|
+
relaunchArgv: () => relaunchArgv,
|
|
34759
34772
|
relaunchIntoHome: () => relaunchIntoHome,
|
|
34773
|
+
releaseStdinForRelaunch: () => releaseStdinForRelaunch,
|
|
34774
|
+
resolveRelaunchEntry: () => resolveRelaunchEntry,
|
|
34760
34775
|
updateRestartSummary: () => updateRestartSummary
|
|
34761
34776
|
});
|
|
34777
|
+
import { existsSync as existsSync31 } from "fs";
|
|
34778
|
+
import { join as join35 } from "path";
|
|
34779
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
34762
34780
|
import { spawnSync } from "child_process";
|
|
34763
34781
|
function encodeJustUpdated(fromVersion, toVersion) {
|
|
34764
34782
|
return `${fromVersion}\u2192${toVersion}`;
|
|
@@ -34778,16 +34796,53 @@ function consumeJustUpdatedEnv() {
|
|
|
34778
34796
|
function updateRestartSummary(toVersion) {
|
|
34779
34797
|
return `Restart NTRP to use v${toVersion}`;
|
|
34780
34798
|
}
|
|
34799
|
+
function npmGlobalEntry() {
|
|
34800
|
+
const listed = spawnSync("npm", ["root", "-g"], { encoding: "utf-8" });
|
|
34801
|
+
if (listed.status !== 0) return null;
|
|
34802
|
+
const entry = join35(listed.stdout.trim(), NPM_PACKAGE, "dist/index.js");
|
|
34803
|
+
return existsSync31(entry) ? entry : null;
|
|
34804
|
+
}
|
|
34805
|
+
function thisBundleEntry() {
|
|
34806
|
+
return fileURLToPath2(import.meta.url);
|
|
34807
|
+
}
|
|
34808
|
+
function resolveRelaunchEntry(toVersion) {
|
|
34809
|
+
const candidates = [thisBundleEntry(), npmGlobalEntry(), process.argv[1]].filter(
|
|
34810
|
+
(p) => Boolean(p)
|
|
34811
|
+
);
|
|
34812
|
+
for (const entry of candidates) {
|
|
34813
|
+
if (!existsSync31(entry)) continue;
|
|
34814
|
+
if (readVersionNearEntry(entry) === toVersion) return entry;
|
|
34815
|
+
}
|
|
34816
|
+
return candidates.find((p) => existsSync31(p)) ?? thisBundleEntry();
|
|
34817
|
+
}
|
|
34818
|
+
function relaunchArgv(toVersion) {
|
|
34819
|
+
return [resolveRelaunchEntry(toVersion)];
|
|
34820
|
+
}
|
|
34821
|
+
function releaseStdinForRelaunch(rl) {
|
|
34822
|
+
try {
|
|
34823
|
+
if (process.stdin.isTTY && process.stdin.isRaw === true) {
|
|
34824
|
+
process.stdin.setRawMode(false);
|
|
34825
|
+
}
|
|
34826
|
+
} catch {
|
|
34827
|
+
}
|
|
34828
|
+
try {
|
|
34829
|
+
rl?.pause();
|
|
34830
|
+
} catch {
|
|
34831
|
+
}
|
|
34832
|
+
}
|
|
34833
|
+
function reclaimStdinAfterFailedRelaunch(rl) {
|
|
34834
|
+
try {
|
|
34835
|
+
rl?.resume();
|
|
34836
|
+
} catch {
|
|
34837
|
+
}
|
|
34838
|
+
}
|
|
34781
34839
|
async function relaunchIntoHome(opts) {
|
|
34782
34840
|
const { stopSessionTranscript: stopSessionTranscript2 } = await Promise.resolve().then(() => (init_transcript(), transcript_exports));
|
|
34783
34841
|
const { close: close2 } = await Promise.resolve().then(() => (init_connection(), connection_exports));
|
|
34784
34842
|
stopSessionTranscript2();
|
|
34785
34843
|
await close2();
|
|
34786
|
-
|
|
34787
|
-
|
|
34788
|
-
} catch {
|
|
34789
|
-
}
|
|
34790
|
-
const result = spawnSync(process.execPath, process.argv.slice(1), {
|
|
34844
|
+
releaseStdinForRelaunch(opts.rl);
|
|
34845
|
+
const result = spawnSync(process.execPath, relaunchArgv(opts.toVersion), {
|
|
34791
34846
|
stdio: "inherit",
|
|
34792
34847
|
env: {
|
|
34793
34848
|
...process.env,
|
|
@@ -34795,10 +34850,7 @@ async function relaunchIntoHome(opts) {
|
|
|
34795
34850
|
}
|
|
34796
34851
|
});
|
|
34797
34852
|
if (result.error) {
|
|
34798
|
-
|
|
34799
|
-
opts.rl?.resume();
|
|
34800
|
-
} catch {
|
|
34801
|
-
}
|
|
34853
|
+
reclaimStdinAfterFailedRelaunch(opts.rl);
|
|
34802
34854
|
return "failed";
|
|
34803
34855
|
}
|
|
34804
34856
|
process.exit(result.status ?? 0);
|
|
@@ -34808,6 +34860,8 @@ var JUST_UPDATED_ENV;
|
|
|
34808
34860
|
var init_relaunch = __esm({
|
|
34809
34861
|
"src/update/relaunch.ts"() {
|
|
34810
34862
|
"use strict";
|
|
34863
|
+
init_version();
|
|
34864
|
+
init_registry();
|
|
34811
34865
|
JUST_UPDATED_ENV = "NTRP_JUST_UPDATED";
|
|
34812
34866
|
}
|
|
34813
34867
|
});
|
|
@@ -34864,6 +34918,7 @@ async function handler44(_args, ctx) {
|
|
|
34864
34918
|
return;
|
|
34865
34919
|
}
|
|
34866
34920
|
console.log();
|
|
34921
|
+
console.log(chalk73.dim(` Starting v${latest}\u2026`));
|
|
34867
34922
|
const failed = await relaunchIntoHome({
|
|
34868
34923
|
fromVersion: current,
|
|
34869
34924
|
toVersion: latest,
|
|
@@ -34872,6 +34927,7 @@ async function handler44(_args, ctx) {
|
|
|
34872
34927
|
if (failed) {
|
|
34873
34928
|
const restart = updateRestartSummary(latest);
|
|
34874
34929
|
console.log(chalk73.green(` \u2713 Updated! ${restart}`));
|
|
34930
|
+
console.log(chalk73.dim(" Type /exit, then ntrp. This window is still the old process."));
|
|
34875
34931
|
console.log();
|
|
34876
34932
|
return restart;
|
|
34877
34933
|
}
|
|
@@ -35280,8 +35336,8 @@ __export(exports_exports, {
|
|
|
35280
35336
|
handler: () => handler48
|
|
35281
35337
|
});
|
|
35282
35338
|
import chalk78 from "chalk";
|
|
35283
|
-
import { existsSync as
|
|
35284
|
-
import { join as
|
|
35339
|
+
import { existsSync as existsSync32 } from "fs";
|
|
35340
|
+
import { join as join36 } from "path";
|
|
35285
35341
|
function usage4() {
|
|
35286
35342
|
console.log(chalk78.dim(" Usage:"));
|
|
35287
35343
|
console.log(chalk78.dim(" /exports list [kind]"));
|
|
@@ -35338,7 +35394,7 @@ function printInboxShow() {
|
|
|
35338
35394
|
console.log(" " + paint("accent", "AI inbox: ") + inbox);
|
|
35339
35395
|
const latest = inboxLatestHandoffPath();
|
|
35340
35396
|
if (latest) console.log(" " + chalk78.dim("Latest handoff: ") + latest);
|
|
35341
|
-
console.log(" " + chalk78.dim("Finder skill: ") +
|
|
35397
|
+
console.log(" " + chalk78.dim("Finder skill: ") + join36(inbox, "SKILL.md"));
|
|
35342
35398
|
console.log(" " + chalk78.dim("Reprint: ") + paint("accent", "/inbox skill"));
|
|
35343
35399
|
} else {
|
|
35344
35400
|
console.log(" " + chalk78.dim("AI inbox: (not set). Type ") + paint("accent", "/inbox set <folder>"));
|
|
@@ -35360,8 +35416,8 @@ function printOpen() {
|
|
|
35360
35416
|
console.log(" " + chalk78.dim("AI inbox: ") + inbox);
|
|
35361
35417
|
const latest = inboxLatestHandoffPath();
|
|
35362
35418
|
if (latest) console.log(" " + chalk78.dim("Inbox latest: ") + latest);
|
|
35363
|
-
console.log(" " + chalk78.dim("Pickup skill: ") +
|
|
35364
|
-
console.log(" " + chalk78.dim("Finder skill: ") +
|
|
35419
|
+
console.log(" " + chalk78.dim("Pickup skill: ") + join36(inbox, "latest-pickup.md"));
|
|
35420
|
+
console.log(" " + chalk78.dim("Finder skill: ") + join36(inbox, "SKILL.md"));
|
|
35365
35421
|
} else {
|
|
35366
35422
|
console.log(" " + chalk78.dim("AI inbox is not set. Type ") + paint("accent", "/inbox set <folder>"));
|
|
35367
35423
|
const loc = handoffLocations();
|
|
@@ -35439,7 +35495,7 @@ function runMove(args, ctx) {
|
|
|
35439
35495
|
}
|
|
35440
35496
|
try {
|
|
35441
35497
|
const destDir = resolveUserPath(dest);
|
|
35442
|
-
if (!
|
|
35498
|
+
if (!existsSync32(destDir)) {
|
|
35443
35499
|
}
|
|
35444
35500
|
const event = moveExport(idOrName, destDir);
|
|
35445
35501
|
console.log();
|
|
@@ -36471,8 +36527,8 @@ Remaining nuances merge into a custom_context paragraph that flows into all AI s
|
|
|
36471
36527
|
});
|
|
36472
36528
|
|
|
36473
36529
|
// src/ai/prompt-parts.ts
|
|
36474
|
-
import { existsSync as
|
|
36475
|
-
import { join as
|
|
36530
|
+
import { existsSync as existsSync33, readFileSync as readFileSync23 } from "fs";
|
|
36531
|
+
import { join as join37 } from "path";
|
|
36476
36532
|
function buildCompanyProfileBlock() {
|
|
36477
36533
|
const p = loadProfile();
|
|
36478
36534
|
if (!p) return "";
|
|
@@ -36490,9 +36546,9 @@ function buildCompanyProfileBlock() {
|
|
|
36490
36546
|
return lines.join("\n");
|
|
36491
36547
|
}
|
|
36492
36548
|
function loadAnalystFile() {
|
|
36493
|
-
const path =
|
|
36549
|
+
const path = join37(ntrpHome(), ANALYST_FILE_NAME);
|
|
36494
36550
|
try {
|
|
36495
|
-
if (!
|
|
36551
|
+
if (!existsSync33(path)) return null;
|
|
36496
36552
|
const raw = sanitizeExternalText(readFileSync23(path, "utf-8").trim());
|
|
36497
36553
|
if (!raw) return null;
|
|
36498
36554
|
if (raw.length <= ANALYST_FILE_MAX_CHARS) return raw;
|
|
@@ -36998,7 +37054,7 @@ __export(ingest_chat_exports, {
|
|
|
36998
37054
|
loadDemoFromChat: () => loadDemoFromChat,
|
|
36999
37055
|
looksLikeFilePath: () => looksLikeFilePath
|
|
37000
37056
|
});
|
|
37001
|
-
import { existsSync as
|
|
37057
|
+
import { existsSync as existsSync34 } from "fs";
|
|
37002
37058
|
import { basename as basename9, resolve as resolve9 } from "path";
|
|
37003
37059
|
import { homedir as homedir8 } from "os";
|
|
37004
37060
|
import chalk80 from "chalk";
|
|
@@ -37018,11 +37074,11 @@ function extractFilePath(input) {
|
|
|
37018
37074
|
const m = trimmed.match(re);
|
|
37019
37075
|
if (m?.[1]) {
|
|
37020
37076
|
const p = expandPath(m[1]);
|
|
37021
|
-
if (
|
|
37077
|
+
if (existsSync34(p)) return p;
|
|
37022
37078
|
}
|
|
37023
37079
|
if (!m?.[1] && re.test(trimmed) && trimmed.toLowerCase().endsWith(".csv")) {
|
|
37024
37080
|
const p = expandPath(trimmed.replace(/^["']|["']$/g, ""));
|
|
37025
|
-
if (
|
|
37081
|
+
if (existsSync34(p)) return p;
|
|
37026
37082
|
}
|
|
37027
37083
|
}
|
|
37028
37084
|
return null;
|
|
@@ -38264,7 +38320,8 @@ __export(welcome_exports, {
|
|
|
38264
38320
|
formatEmptyDataHomeHint: () => formatEmptyDataHomeHint,
|
|
38265
38321
|
formatHomeEntityCounts: () => formatHomeEntityCounts,
|
|
38266
38322
|
printWelcome: () => printWelcome,
|
|
38267
|
-
resolveWelcomeNextAction: () => resolveWelcomeNextAction
|
|
38323
|
+
resolveWelcomeNextAction: () => resolveWelcomeNextAction,
|
|
38324
|
+
staleProcessHomeNotice: () => staleProcessHomeNotice
|
|
38268
38325
|
});
|
|
38269
38326
|
import chalk87 from "chalk";
|
|
38270
38327
|
function formatHomeEntityCounts(counts) {
|
|
@@ -38287,19 +38344,41 @@ function formatEmptyDataHomeHint(savedSessionCount, opts = {}) {
|
|
|
38287
38344
|
return chalk87.dim("Type ") + paint("accent", "use demo data") + chalk87.dim(" to load a sample pipeline") + onboard;
|
|
38288
38345
|
}
|
|
38289
38346
|
function ntrpStatusRow(version, update) {
|
|
38347
|
+
const disk = readInstalledVersionFromDisk();
|
|
38290
38348
|
if (update && isNewerVersion(update.latest, version)) {
|
|
38349
|
+
if (disk && !isNewerVersion(update.latest, disk)) {
|
|
38350
|
+
return {
|
|
38351
|
+
label: "ntrp",
|
|
38352
|
+
state: badge("RESTART", "warning"),
|
|
38353
|
+
detail: `v${disk} installed \xB7 type /exit`
|
|
38354
|
+
};
|
|
38355
|
+
}
|
|
38291
38356
|
return {
|
|
38292
38357
|
label: "ntrp",
|
|
38293
38358
|
state: badge("UPDATE", "warning"),
|
|
38294
38359
|
detail: `v${update.latest} \xB7 type /update`
|
|
38295
38360
|
};
|
|
38296
38361
|
}
|
|
38362
|
+
if (disk && isNewerVersion(disk, getInstalledVersion())) {
|
|
38363
|
+
return {
|
|
38364
|
+
label: "ntrp",
|
|
38365
|
+
state: badge("RESTART", "warning"),
|
|
38366
|
+
detail: `v${disk} installed \xB7 type /exit`
|
|
38367
|
+
};
|
|
38368
|
+
}
|
|
38297
38369
|
return {
|
|
38298
38370
|
label: "ntrp",
|
|
38299
38371
|
state: chalk87.dim(`v${version}`),
|
|
38300
38372
|
detail: ""
|
|
38301
38373
|
};
|
|
38302
38374
|
}
|
|
38375
|
+
function staleProcessHomeNotice() {
|
|
38376
|
+
const running = getInstalledVersion();
|
|
38377
|
+
const disk = readInstalledVersionFromDisk();
|
|
38378
|
+
if (!disk || disk === running) return null;
|
|
38379
|
+
if (!isNewerVersion(disk, running)) return null;
|
|
38380
|
+
return `This window is still v${running}. Type /exit, then ntrp (v${disk} is installed).`;
|
|
38381
|
+
}
|
|
38303
38382
|
function resolveSessionSummary(input) {
|
|
38304
38383
|
if (input.scope?.intent_summary?.trim()) return input.scope.intent_summary.trim();
|
|
38305
38384
|
if (input.summary?.trim()) return input.summary.trim();
|
|
@@ -38612,6 +38691,10 @@ async function printWelcome(ctx, version) {
|
|
|
38612
38691
|
cardW
|
|
38613
38692
|
)
|
|
38614
38693
|
);
|
|
38694
|
+
const stale = staleProcessHomeNotice();
|
|
38695
|
+
if (stale) {
|
|
38696
|
+
push(truncateVisible(` ${paint("warning", "\u2691")} ${stale}`, cardW));
|
|
38697
|
+
}
|
|
38615
38698
|
if (strategyNudge) {
|
|
38616
38699
|
push(
|
|
38617
38700
|
truncateVisible(
|
|
@@ -38654,6 +38737,7 @@ var init_welcome = __esm({
|
|
|
38654
38737
|
init_queries();
|
|
38655
38738
|
init_schema();
|
|
38656
38739
|
init_registry();
|
|
38740
|
+
init_version();
|
|
38657
38741
|
NO_SUMMARY = "(no summary)";
|
|
38658
38742
|
CARD_MAX_W = 128;
|
|
38659
38743
|
CARD_SIDE_MARGIN = 6;
|
|
@@ -38818,7 +38902,7 @@ __export(repl_exports, {
|
|
|
38818
38902
|
import { createInterface as createInterface2 } from "readline/promises";
|
|
38819
38903
|
import { clearLine as clearLine2, cursorTo as cursorTo2 } from "readline";
|
|
38820
38904
|
import chalk88 from "chalk";
|
|
38821
|
-
import { join as
|
|
38905
|
+
import { join as join38 } from "path";
|
|
38822
38906
|
function buildPrompt(ctx) {
|
|
38823
38907
|
return buildConversationPrompt(ctx);
|
|
38824
38908
|
}
|
|
@@ -38921,7 +39005,7 @@ async function goHome(ctx, version, history, opts) {
|
|
|
38921
39005
|
ctx.wizardDepth = 0;
|
|
38922
39006
|
ctx.secretInputActive = false;
|
|
38923
39007
|
history.length = 0;
|
|
38924
|
-
|
|
39008
|
+
clearTerminalHome();
|
|
38925
39009
|
if (opts?.banner) {
|
|
38926
39010
|
console.log();
|
|
38927
39011
|
console.log(" " + paint("accent", "\u2713") + " " + chalk88.dim(opts.banner));
|
|
@@ -39183,7 +39267,7 @@ function printHelp() {
|
|
|
39183
39267
|
["/remember <fact>", "Store a fact, a decision, or a preference"],
|
|
39184
39268
|
["/recall [topic]", "Show what NTRP stores about your business"],
|
|
39185
39269
|
["/rate good|bad <note>", "Correct the last answer. A bad note becomes a calibration"],
|
|
39186
|
-
[`${
|
|
39270
|
+
[`${join38(ntrpHome(), ANALYST_FILE_NAME)}`, "Standing operator instructions (tone, priorities, house rules)"]
|
|
39187
39271
|
];
|
|
39188
39272
|
const teachMaxW = Math.max(...teach.map(([c]) => c.length)) + 2;
|
|
39189
39273
|
for (const [cmd, desc] of teach) {
|
|
@@ -39301,6 +39385,7 @@ init_activation();
|
|
|
39301
39385
|
init_gate2();
|
|
39302
39386
|
init_profile();
|
|
39303
39387
|
init_theme();
|
|
39388
|
+
init_layout();
|
|
39304
39389
|
init_emit();
|
|
39305
39390
|
init_errors2();
|
|
39306
39391
|
init_types2();
|
|
@@ -39348,13 +39433,13 @@ async function main() {
|
|
|
39348
39433
|
if (args.oneShot) {
|
|
39349
39434
|
const cmd = firstToken(args.input);
|
|
39350
39435
|
if (!UNGATED.has(cmd)) {
|
|
39351
|
-
const
|
|
39352
|
-
if (!
|
|
39436
|
+
const lic = await refreshLicenseOnline();
|
|
39437
|
+
if (!lic.valid) {
|
|
39353
39438
|
if (isStructuredOutput(ctx.execution)) {
|
|
39354
|
-
emitError(cmd || "ntrp", new NtrpError("license_invalid",
|
|
39439
|
+
emitError(cmd || "ntrp", new NtrpError("license_invalid", lic.message, 3 /* Auth */));
|
|
39355
39440
|
}
|
|
39356
39441
|
console.error(chalk89.red(`
|
|
39357
|
-
${
|
|
39442
|
+
${lic.message}`));
|
|
39358
39443
|
console.error(chalk89.dim(" Trial's over \u2014 /upgrade and paste your key.\n"));
|
|
39359
39444
|
process.exit(1);
|
|
39360
39445
|
}
|
|
@@ -39400,31 +39485,37 @@ async function main() {
|
|
|
39400
39485
|
}
|
|
39401
39486
|
return DB_COMMANDS.has(cmd);
|
|
39402
39487
|
}
|
|
39403
|
-
const
|
|
39404
|
-
const
|
|
39405
|
-
|
|
39406
|
-
|
|
39407
|
-
|
|
39488
|
+
const { consumeJustUpdatedEnv: consumeJustUpdatedEnv2 } = await Promise.resolve().then(() => (init_relaunch(), relaunch_exports));
|
|
39489
|
+
const justUpdated = consumeJustUpdatedEnv2();
|
|
39490
|
+
let showedActivation = false;
|
|
39491
|
+
if (!justUpdated) {
|
|
39492
|
+
showedActivation = await ensureLicenseActivated(ctx);
|
|
39493
|
+
const lic = await refreshLicenseOnline();
|
|
39494
|
+
if (lic.shouldNudgeUpgrade) {
|
|
39495
|
+
const { printTrialNudge: printTrialNudge2 } = await Promise.resolve().then(() => (init_upgrade(), upgrade_exports));
|
|
39496
|
+
printTrialNudge2(lic);
|
|
39497
|
+
}
|
|
39408
39498
|
}
|
|
39409
39499
|
void Promise.resolve().then(() => (init_discovery(), discovery_exports)).then((m) => m.refreshStaleProviderCaches()).catch(() => void 0);
|
|
39410
39500
|
const { setActiveDbPath: setActiveDbPath2 } = await Promise.resolve().then(() => (init_connection(), connection_exports));
|
|
39411
39501
|
const { datasetPathForSession: datasetPathForSession2 } = await Promise.resolve().then(() => (init_context2(), context_exports));
|
|
39412
39502
|
ctx.datasetPath = datasetPathForSession2(ctx.sessionId);
|
|
39413
39503
|
await setActiveDbPath2(ctx.datasetPath);
|
|
39414
|
-
const { completeInteractiveSetup: completeInteractiveSetup2 } = await Promise.resolve().then(() => (init_first_run(), first_run_exports));
|
|
39415
39504
|
const {
|
|
39416
39505
|
hydrateUpdateAvailableFromCache: hydrateUpdateAvailableFromCache2,
|
|
39417
39506
|
startBackgroundUpdateCheck: startBackgroundUpdateCheck2
|
|
39418
39507
|
} = await Promise.resolve().then(() => (init_registry(), registry_exports));
|
|
39419
|
-
const { consumeJustUpdatedEnv: consumeJustUpdatedEnv2 } = await Promise.resolve().then(() => (init_relaunch(), relaunch_exports));
|
|
39420
39508
|
ctx.updateAvailable = hydrateUpdateAvailableFromCache2(VERSION);
|
|
39421
39509
|
startBackgroundUpdateCheck2(ctx);
|
|
39422
|
-
|
|
39510
|
+
if (!justUpdated) {
|
|
39511
|
+
const { completeInteractiveSetup: completeInteractiveSetup2 } = await Promise.resolve().then(() => (init_first_run(), first_run_exports));
|
|
39512
|
+
await completeInteractiveSetup2(ctx, { skipBrand: showedActivation });
|
|
39513
|
+
}
|
|
39423
39514
|
const { startSessionTranscript: startSessionTranscript2, stopSessionTranscript: stopSessionTranscript2 } = await Promise.resolve().then(() => (init_transcript(), transcript_exports));
|
|
39424
39515
|
startSessionTranscript2(ctx);
|
|
39425
39516
|
const { printWelcome: printWelcome2 } = await Promise.resolve().then(() => (init_welcome(), welcome_exports));
|
|
39426
|
-
const justUpdated = consumeJustUpdatedEnv2();
|
|
39427
39517
|
if (justUpdated) {
|
|
39518
|
+
clearTerminalHome();
|
|
39428
39519
|
console.log();
|
|
39429
39520
|
console.log(" " + paint("accent", "\u2713") + " " + chalk89.dim(`Now running v${justUpdated.to}`));
|
|
39430
39521
|
}
|
package/dist/mcp/server.js
CHANGED
|
@@ -26282,22 +26282,29 @@ var init_setup = __esm({
|
|
|
26282
26282
|
import { existsSync as existsSync26, readFileSync as readFileSync22 } from "fs";
|
|
26283
26283
|
import { dirname as dirname5, join as join26 } from "path";
|
|
26284
26284
|
import { fileURLToPath } from "url";
|
|
26285
|
+
function readVersionFromPackageJson(packageJsonPath) {
|
|
26286
|
+
if (!existsSync26(packageJsonPath)) return null;
|
|
26287
|
+
try {
|
|
26288
|
+
const pkg = JSON.parse(readFileSync22(packageJsonPath, "utf-8"));
|
|
26289
|
+
if (typeof pkg.version === "string" && pkg.version.length > 0) return pkg.version;
|
|
26290
|
+
} catch {
|
|
26291
|
+
}
|
|
26292
|
+
return null;
|
|
26293
|
+
}
|
|
26294
|
+
function readVersionNearEntry(entryPath) {
|
|
26295
|
+
const start = dirname5(entryPath);
|
|
26296
|
+
for (const rel of [join26(start, "..", "package.json"), join26(start, "../..", "package.json")]) {
|
|
26297
|
+
const version = readVersionFromPackageJson(rel);
|
|
26298
|
+
if (version) return version;
|
|
26299
|
+
}
|
|
26300
|
+
return null;
|
|
26301
|
+
}
|
|
26302
|
+
function readInstalledVersionFromDisk() {
|
|
26303
|
+
return readVersionNearEntry(fileURLToPath(import.meta.url));
|
|
26304
|
+
}
|
|
26285
26305
|
function getInstalledVersion() {
|
|
26286
26306
|
if (cachedVersion) return cachedVersion;
|
|
26287
|
-
|
|
26288
|
-
for (const rel of ["../package.json", "../../package.json"]) {
|
|
26289
|
-
const path = join26(start, rel);
|
|
26290
|
-
if (!existsSync26(path)) continue;
|
|
26291
|
-
try {
|
|
26292
|
-
const pkg = JSON.parse(readFileSync22(path, "utf-8"));
|
|
26293
|
-
if (typeof pkg.version === "string" && pkg.version.length > 0) {
|
|
26294
|
-
cachedVersion = pkg.version;
|
|
26295
|
-
return cachedVersion;
|
|
26296
|
-
}
|
|
26297
|
-
} catch {
|
|
26298
|
-
}
|
|
26299
|
-
}
|
|
26300
|
-
cachedVersion = "0.0.0";
|
|
26307
|
+
cachedVersion = readInstalledVersionFromDisk() ?? "0.0.0";
|
|
26301
26308
|
return cachedVersion;
|
|
26302
26309
|
}
|
|
26303
26310
|
var cachedVersion;
|