billion-context-pi 0.0.4 → 0.0.5
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/config.d.ts +1 -1
- package/dist/index.js +35 -227
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/rename-notice.d.ts +0 -14
package/dist/config.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface AdapterConfig {
|
|
|
9
9
|
modelContextLimit?: number;
|
|
10
10
|
protectedTools?: string[];
|
|
11
11
|
preserveRecentMessages?: number;
|
|
12
|
-
/** Check npm for a newer
|
|
12
|
+
/** Check npm for a newer billion-context-pi on startup and auto-install it. Default: true.
|
|
13
13
|
* Disable via `autoUpdate: false` or env `ACP_AUTO_UPDATE=0` to avoid all
|
|
14
14
|
* network calls on startup. */
|
|
15
15
|
autoUpdate?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -7532,7 +7532,7 @@ import { tmpdir as tmpdir2 } from "os";
|
|
|
7532
7532
|
import { join as join4 } from "path";
|
|
7533
7533
|
|
|
7534
7534
|
// src/fleet-widget.ts
|
|
7535
|
-
var DELEGATE_WIDGET_KEY = "
|
|
7535
|
+
var DELEGATE_WIDGET_KEY = "billion-context-pi-delegates";
|
|
7536
7536
|
var REFRESH_MS = 500;
|
|
7537
7537
|
var MAX_TASK_LEN = 48;
|
|
7538
7538
|
var ui;
|
|
@@ -8090,25 +8090,6 @@ function truncate2(s, n) {
|
|
|
8090
8090
|
}
|
|
8091
8091
|
|
|
8092
8092
|
// src/commands.ts
|
|
8093
|
-
import { readFileSync } from "fs";
|
|
8094
|
-
import { join as join5, dirname as dirname3 } from "path";
|
|
8095
|
-
import { fileURLToPath } from "url";
|
|
8096
|
-
function getDisplayName() {
|
|
8097
|
-
try {
|
|
8098
|
-
let dir = dirname3(fileURLToPath(import.meta.url));
|
|
8099
|
-
for (; ; ) {
|
|
8100
|
-
const pkg = JSON.parse(readFileSync(join5(dir, "package.json"), "utf-8"));
|
|
8101
|
-
if (pkg?.name === "pai-acp" || pkg?.name === "billion-context-pi") {
|
|
8102
|
-
return pkg.name;
|
|
8103
|
-
}
|
|
8104
|
-
const parent = dirname3(dir);
|
|
8105
|
-
if (parent === dir) break;
|
|
8106
|
-
dir = parent;
|
|
8107
|
-
}
|
|
8108
|
-
} catch {
|
|
8109
|
-
}
|
|
8110
|
-
return "pai-acp";
|
|
8111
|
-
}
|
|
8112
8093
|
function makeCommands(runtime) {
|
|
8113
8094
|
return [
|
|
8114
8095
|
{
|
|
@@ -8203,7 +8184,7 @@ async function statusReport(runtime, ctx) {
|
|
|
8203
8184
|
const activeBlocksList = state.blocks.filter((b) => b.active);
|
|
8204
8185
|
const totalBlocksList = state.blocks;
|
|
8205
8186
|
const lines = [];
|
|
8206
|
-
const versionStr = "0.0.
|
|
8187
|
+
const versionStr = "0.0.5" ? `billion-context-pi@${"0.0.5"}` : "";
|
|
8207
8188
|
lines.push("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E");
|
|
8208
8189
|
lines.push("\u2502 ACP Context Analysis \u2502");
|
|
8209
8190
|
lines.push("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F");
|
|
@@ -8347,27 +8328,15 @@ When a background delegate finishes, an automated completion notification is inj
|
|
|
8347
8328
|
|
|
8348
8329
|
// src/update.ts
|
|
8349
8330
|
import { readFile, writeFile as writeFile3, mkdir as mkdir3 } from "fs/promises";
|
|
8350
|
-
import { join as
|
|
8351
|
-
import { fileURLToPath
|
|
8331
|
+
import { join as join5, dirname as dirname3 } from "path";
|
|
8332
|
+
import { fileURLToPath } from "url";
|
|
8352
8333
|
import { execFile } from "child_process";
|
|
8353
|
-
var
|
|
8354
|
-
var
|
|
8334
|
+
var PACKAGE_NAME = "billion-context-pi";
|
|
8335
|
+
var REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
|
|
8355
8336
|
var SEMVER_RE = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z-.]+)?$/;
|
|
8356
8337
|
var CHECK_INTERVAL_MS = 3 * 60 * 1e3;
|
|
8357
|
-
|
|
8358
|
-
return `${process.env.HOME ?? ""}/.pi/agent/.${name}-update-check`;
|
|
8359
|
-
}
|
|
8360
|
-
var THROTTLE_FILE = `${process.env.HOME ?? ""}/.pi/agent/.pai-acp-update-check`;
|
|
8338
|
+
var THROTTLE_FILE = `${process.env.HOME ?? ""}/.pi/agent/.billion-context-pi-update-check`;
|
|
8361
8339
|
var updateInFlight = false;
|
|
8362
|
-
var cachedPackageName;
|
|
8363
|
-
async function getPackageName() {
|
|
8364
|
-
if (cachedPackageName !== void 0) return cachedPackageName;
|
|
8365
|
-
const dir = await findExtensionDir();
|
|
8366
|
-
if (!dir) return void 0;
|
|
8367
|
-
const pkg = await readPackageJson(join6(dir, "package.json"));
|
|
8368
|
-
cachedPackageName = pkg?.name;
|
|
8369
|
-
return cachedPackageName;
|
|
8370
|
-
}
|
|
8371
8340
|
function parseVersion(v) {
|
|
8372
8341
|
return v.replace(/^v/, "").split(".").map((n) => parseInt(n, 10) || 0);
|
|
8373
8342
|
}
|
|
@@ -8380,18 +8349,18 @@ function isNewer(latest, current) {
|
|
|
8380
8349
|
}
|
|
8381
8350
|
return false;
|
|
8382
8351
|
}
|
|
8383
|
-
async function readLastCheck(
|
|
8352
|
+
async function readLastCheck() {
|
|
8384
8353
|
try {
|
|
8385
|
-
const data = await readFile(
|
|
8354
|
+
const data = await readFile(THROTTLE_FILE, "utf-8");
|
|
8386
8355
|
return parseInt(data.trim(), 10) || 0;
|
|
8387
8356
|
} catch {
|
|
8388
8357
|
return 0;
|
|
8389
8358
|
}
|
|
8390
8359
|
}
|
|
8391
|
-
async function writeLastCheck(
|
|
8360
|
+
async function writeLastCheck(timestamp) {
|
|
8392
8361
|
try {
|
|
8393
|
-
await mkdir3(
|
|
8394
|
-
await writeFile3(
|
|
8362
|
+
await mkdir3(dirname3(THROTTLE_FILE), { recursive: true });
|
|
8363
|
+
await writeFile3(THROTTLE_FILE, String(timestamp), "utf-8");
|
|
8395
8364
|
} catch {
|
|
8396
8365
|
}
|
|
8397
8366
|
}
|
|
@@ -8404,19 +8373,19 @@ async function readPackageJson(path4) {
|
|
|
8404
8373
|
}
|
|
8405
8374
|
}
|
|
8406
8375
|
function findNpmRoot(extDir) {
|
|
8407
|
-
let dir =
|
|
8376
|
+
let dir = dirname3(extDir);
|
|
8408
8377
|
while (dir !== "/" && dir !== ".") {
|
|
8409
|
-
if (dir.endsWith("node_modules")) return
|
|
8410
|
-
dir =
|
|
8378
|
+
if (dir.endsWith("node_modules")) return dirname3(dir);
|
|
8379
|
+
dir = dirname3(dir);
|
|
8411
8380
|
}
|
|
8412
8381
|
return void 0;
|
|
8413
8382
|
}
|
|
8414
8383
|
async function findExtensionDir() {
|
|
8415
|
-
let dir =
|
|
8384
|
+
let dir = dirname3(fileURLToPath(import.meta.url));
|
|
8416
8385
|
for (; ; ) {
|
|
8417
|
-
const pkg = await readPackageJson(
|
|
8418
|
-
if (pkg?.name ===
|
|
8419
|
-
const parent =
|
|
8386
|
+
const pkg = await readPackageJson(join5(dir, "package.json"));
|
|
8387
|
+
if (pkg?.name === PACKAGE_NAME) return dir;
|
|
8388
|
+
const parent = dirname3(dir);
|
|
8420
8389
|
if (parent === dir) return void 0;
|
|
8421
8390
|
dir = parent;
|
|
8422
8391
|
}
|
|
@@ -8428,12 +8397,10 @@ async function autoInstallLatest(latest) {
|
|
|
8428
8397
|
const npmDir = findNpmRoot(extDir);
|
|
8429
8398
|
if (!npmDir) return false;
|
|
8430
8399
|
try {
|
|
8431
|
-
const packageName = await getPackageName();
|
|
8432
|
-
if (!packageName) return false;
|
|
8433
8400
|
const code = await new Promise((resolve2) => {
|
|
8434
8401
|
execFile(
|
|
8435
8402
|
"npm",
|
|
8436
|
-
["install", `${
|
|
8403
|
+
["install", `${PACKAGE_NAME}@${latest}`, "--silent", "--no-audit", "--no-fund"],
|
|
8437
8404
|
{ cwd: npmDir, timeout: 6e4, shell: process.platform === "win32" },
|
|
8438
8405
|
(err) => resolve2(err ? 1 : 0)
|
|
8439
8406
|
);
|
|
@@ -8451,14 +8418,12 @@ async function checkForUpdate(autoUpdate, notify) {
|
|
|
8451
8418
|
if (updateInFlight) return;
|
|
8452
8419
|
updateInFlight = true;
|
|
8453
8420
|
try {
|
|
8454
|
-
const packageName = await getPackageName();
|
|
8455
|
-
if (!packageName) return;
|
|
8456
8421
|
const now = Date.now();
|
|
8457
|
-
const lastCheck = await readLastCheck(
|
|
8422
|
+
const lastCheck = await readLastCheck();
|
|
8458
8423
|
if (now - lastCheck < CHECK_INTERVAL_MS) return;
|
|
8459
|
-
await writeLastCheck(
|
|
8424
|
+
await writeLastCheck(now);
|
|
8460
8425
|
const runtimeVersion = await getRuntimeVersion();
|
|
8461
|
-
const res = await fetch(
|
|
8426
|
+
const res = await fetch(REGISTRY_URL, {
|
|
8462
8427
|
signal: AbortSignal.timeout(5e3),
|
|
8463
8428
|
headers: { Accept: "application/json" }
|
|
8464
8429
|
});
|
|
@@ -8466,7 +8431,7 @@ async function checkForUpdate(autoUpdate, notify) {
|
|
|
8466
8431
|
const data = await res.json();
|
|
8467
8432
|
const latest = data.version;
|
|
8468
8433
|
if (!latest) return;
|
|
8469
|
-
const current = runtimeVersion ?? "0.0.
|
|
8434
|
+
const current = runtimeVersion ?? "0.0.5";
|
|
8470
8435
|
debug.event("update-check", {
|
|
8471
8436
|
current,
|
|
8472
8437
|
latest,
|
|
@@ -8480,7 +8445,7 @@ async function checkForUpdate(autoUpdate, notify) {
|
|
|
8480
8445
|
);
|
|
8481
8446
|
} else if (!installed && notify) {
|
|
8482
8447
|
notify(
|
|
8483
|
-
`${
|
|
8448
|
+
`${PACKAGE_NAME} ${latest} available (you have ${current}). Run: pi update --extension npm:${PACKAGE_NAME}`
|
|
8484
8449
|
);
|
|
8485
8450
|
}
|
|
8486
8451
|
}
|
|
@@ -8492,161 +8457,15 @@ async function checkForUpdate(autoUpdate, notify) {
|
|
|
8492
8457
|
async function getRuntimeVersion() {
|
|
8493
8458
|
const extDir = await findExtensionDir();
|
|
8494
8459
|
if (!extDir) return void 0;
|
|
8495
|
-
const pkg = await readPackageJson(
|
|
8460
|
+
const pkg = await readPackageJson(join5(extDir, "package.json"));
|
|
8496
8461
|
return pkg?.version;
|
|
8497
8462
|
}
|
|
8498
8463
|
|
|
8499
|
-
// src/rename-notice.ts
|
|
8500
|
-
import { readFileSync as readFileSync2, existsSync } from "fs";
|
|
8501
|
-
import { join as join7, dirname as dirname5 } from "path";
|
|
8502
|
-
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
8503
|
-
import { execFile as execFile2 } from "child_process";
|
|
8504
|
-
var LEGACY_NAME2 = "pai-acp";
|
|
8505
|
-
var NEW_NAME = "billion-context-pi";
|
|
8506
|
-
var NEW_REF = `npm:${NEW_NAME}`;
|
|
8507
|
-
var REGISTRY_URL = `https://registry.npmjs.org/${NEW_NAME}/latest`;
|
|
8508
|
-
function findExtensionDirSync() {
|
|
8509
|
-
let dir = dirname5(fileURLToPath3(import.meta.url));
|
|
8510
|
-
for (; ; ) {
|
|
8511
|
-
try {
|
|
8512
|
-
const data = JSON.parse(readFileSync2(join7(dir, "package.json"), "utf-8"));
|
|
8513
|
-
if (data?.name === LEGACY_NAME2 || data?.name === NEW_NAME) return dir;
|
|
8514
|
-
} catch {
|
|
8515
|
-
}
|
|
8516
|
-
const parent = dirname5(dir);
|
|
8517
|
-
if (parent === dir) return void 0;
|
|
8518
|
-
dir = parent;
|
|
8519
|
-
}
|
|
8520
|
-
}
|
|
8521
|
-
function findNpmRootSync(extDir) {
|
|
8522
|
-
let dir = dirname5(extDir);
|
|
8523
|
-
for (; ; ) {
|
|
8524
|
-
if (dir.endsWith("node_modules")) return dirname5(dir);
|
|
8525
|
-
const parent = dirname5(dir);
|
|
8526
|
-
if (parent === dir) return void 0;
|
|
8527
|
-
dir = parent;
|
|
8528
|
-
}
|
|
8529
|
-
}
|
|
8530
|
-
function isLegacyPackage() {
|
|
8531
|
-
const dir = findExtensionDirSync();
|
|
8532
|
-
if (!dir) return false;
|
|
8533
|
-
try {
|
|
8534
|
-
const data = JSON.parse(readFileSync2(join7(dir, "package.json"), "utf-8"));
|
|
8535
|
-
return data?.name === LEGACY_NAME2;
|
|
8536
|
-
} catch {
|
|
8537
|
-
return false;
|
|
8538
|
-
}
|
|
8539
|
-
}
|
|
8540
|
-
function isNewPackageInstalled() {
|
|
8541
|
-
const extDir = findExtensionDirSync();
|
|
8542
|
-
if (!extDir) return false;
|
|
8543
|
-
const npmDir = findNpmRootSync(extDir);
|
|
8544
|
-
if (!npmDir) return false;
|
|
8545
|
-
try {
|
|
8546
|
-
const data = JSON.parse(
|
|
8547
|
-
readFileSync2(join7(npmDir, "node_modules", NEW_NAME, "package.json"), "utf-8")
|
|
8548
|
-
);
|
|
8549
|
-
return data?.name === NEW_NAME && existsSync(join7(npmDir, "node_modules", NEW_NAME, "dist", "index.js"));
|
|
8550
|
-
} catch {
|
|
8551
|
-
return false;
|
|
8552
|
-
}
|
|
8553
|
-
}
|
|
8554
|
-
async function newPackageReady() {
|
|
8555
|
-
try {
|
|
8556
|
-
const res = await fetch(REGISTRY_URL, {
|
|
8557
|
-
signal: AbortSignal.timeout(5e3),
|
|
8558
|
-
headers: { Accept: "application/json" }
|
|
8559
|
-
});
|
|
8560
|
-
if (!res.ok) return false;
|
|
8561
|
-
const data = await res.json();
|
|
8562
|
-
const v = (data.version ?? "0.0.0").split(".").map((n) => parseInt(n, 10) || 0);
|
|
8563
|
-
return (v[0] ?? 0) > 0 || (v[1] ?? 0) > 0 || (v[2] ?? 0) > 1;
|
|
8564
|
-
} catch {
|
|
8565
|
-
return false;
|
|
8566
|
-
}
|
|
8567
|
-
}
|
|
8568
|
-
function runPi(args) {
|
|
8569
|
-
const cliEntry = process.argv[1];
|
|
8570
|
-
if (!cliEntry || !existsSync(cliEntry)) return Promise.resolve(1);
|
|
8571
|
-
return new Promise((resolve2) => {
|
|
8572
|
-
const child = execFile2(
|
|
8573
|
-
process.execPath,
|
|
8574
|
-
[cliEntry, ...args],
|
|
8575
|
-
{ timeout: 12e4, shell: process.platform === "win32" },
|
|
8576
|
-
(err) => resolve2(err ? 1 : 0)
|
|
8577
|
-
);
|
|
8578
|
-
child.stdin?.end();
|
|
8579
|
-
});
|
|
8580
|
-
}
|
|
8581
|
-
var GREEN = "\x1B[32m";
|
|
8582
|
-
var CYAN = "\x1B[36m";
|
|
8583
|
-
var RESET = "\x1B[0m";
|
|
8584
|
-
function manualNotice() {
|
|
8585
|
-
const body = [
|
|
8586
|
-
"\u2192 pai-acp has been renamed to billion-context-pi",
|
|
8587
|
-
"Your context tools are unchanged \u2014 same package, new name.",
|
|
8588
|
-
"Once billion-context-pi is published, it will install automatically.",
|
|
8589
|
-
"Your ~/.pi/acp.json config carries over."
|
|
8590
|
-
].join("\n");
|
|
8591
|
-
return `${CYAN}${body}${RESET}`;
|
|
8592
|
-
}
|
|
8593
|
-
function installingNotice() {
|
|
8594
|
-
return `${CYAN}Installing billion-context-pi\u2026${RESET}`;
|
|
8595
|
-
}
|
|
8596
|
-
function successNotice() {
|
|
8597
|
-
const body = [
|
|
8598
|
-
"\u2714 pai-acp \u2192 billion-context-pi (renamed, same tools).",
|
|
8599
|
-
"billion-context-pi has been installed. Restart Pi to switch over.",
|
|
8600
|
-
"Do NOT uninstall billion-context-pi \u2014 it is the replacement for pai-acp."
|
|
8601
|
-
].join("\n");
|
|
8602
|
-
return `${GREEN}${body}${RESET}`;
|
|
8603
|
-
}
|
|
8604
|
-
function canUninstallNotice() {
|
|
8605
|
-
const body = [
|
|
8606
|
-
"\u2714 You are now running billion-context-pi (formerly pai-acp).",
|
|
8607
|
-
"All your context tools (compress / decompress / search / delegate) are intact.",
|
|
8608
|
-
"pai-acp is now inert and safe to remove: pi uninstall pai-acp"
|
|
8609
|
-
].join("\n");
|
|
8610
|
-
return `${GREEN}${body}${RESET}`;
|
|
8611
|
-
}
|
|
8612
|
-
async function installNewPackage() {
|
|
8613
|
-
return await runPi(["install", NEW_REF]) === 0;
|
|
8614
|
-
}
|
|
8615
|
-
var migrateInFlight = false;
|
|
8616
|
-
async function checkRename(notify) {
|
|
8617
|
-
const safeNotify = (msg) => {
|
|
8618
|
-
try {
|
|
8619
|
-
notify(msg);
|
|
8620
|
-
} catch {
|
|
8621
|
-
}
|
|
8622
|
-
};
|
|
8623
|
-
if (migrateInFlight) return;
|
|
8624
|
-
migrateInFlight = true;
|
|
8625
|
-
try {
|
|
8626
|
-
if (isNewPackageInstalled()) {
|
|
8627
|
-
safeNotify(canUninstallNotice());
|
|
8628
|
-
return;
|
|
8629
|
-
}
|
|
8630
|
-
const ready = await newPackageReady();
|
|
8631
|
-
if (!ready) {
|
|
8632
|
-
safeNotify(manualNotice());
|
|
8633
|
-
return;
|
|
8634
|
-
}
|
|
8635
|
-
safeNotify(installingNotice());
|
|
8636
|
-
const ok = await installNewPackage();
|
|
8637
|
-
safeNotify(ok ? successNotice() : manualNotice());
|
|
8638
|
-
} catch {
|
|
8639
|
-
safeNotify(manualNotice());
|
|
8640
|
-
} finally {
|
|
8641
|
-
migrateInFlight = false;
|
|
8642
|
-
}
|
|
8643
|
-
}
|
|
8644
|
-
|
|
8645
8464
|
// src/setup-subagent-tools.ts
|
|
8646
8465
|
import { readFile as readFile2, writeFile as writeFile4, stat, copyFile, rename } from "fs/promises";
|
|
8647
|
-
import { existsSync
|
|
8466
|
+
import { existsSync } from "fs";
|
|
8648
8467
|
import { homedir } from "os";
|
|
8649
|
-
import { join as
|
|
8468
|
+
import { join as join6 } from "path";
|
|
8650
8469
|
var ACP_TOOLS = ["compress", "decompress", "search_context", "acp_status"];
|
|
8651
8470
|
var BUILTIN_DEFAULT_TOOLS = {
|
|
8652
8471
|
advisor: ["read", "grep", "find", "ls", "bash", "intercom"],
|
|
@@ -8662,8 +8481,8 @@ var BUILTIN_DEFAULT_TOOLS = {
|
|
|
8662
8481
|
function resolveAgentDir() {
|
|
8663
8482
|
const configured = process.env.PI_CODING_AGENT_DIR;
|
|
8664
8483
|
if (configured === "~") return homedir();
|
|
8665
|
-
if (configured?.startsWith("~/")) return
|
|
8666
|
-
return configured ||
|
|
8484
|
+
if (configured?.startsWith("~/")) return join6(homedir(), configured.slice(2));
|
|
8485
|
+
return configured || join6(homedir(), ".pi", "agent");
|
|
8667
8486
|
}
|
|
8668
8487
|
function desiredTools(existing, name) {
|
|
8669
8488
|
const base = Array.isArray(existing?.tools) && existing.tools.length > 0 ? [...existing.tools] : [...BUILTIN_DEFAULT_TOOLS[name] ?? []];
|
|
@@ -8673,7 +8492,7 @@ function desiredTools(existing, name) {
|
|
|
8673
8492
|
return { tools: base, changed: true };
|
|
8674
8493
|
}
|
|
8675
8494
|
async function ensureSubagentAcpTools(settingsPath) {
|
|
8676
|
-
const path4 = settingsPath ??
|
|
8495
|
+
const path4 = settingsPath ?? join6(resolveAgentDir(), "settings.json");
|
|
8677
8496
|
let raw;
|
|
8678
8497
|
let mtimeMs;
|
|
8679
8498
|
try {
|
|
@@ -8708,7 +8527,7 @@ async function ensureSubagentAcpTools(settingsPath) {
|
|
|
8708
8527
|
return { path: path4, action: "skipped", reason: "all builtin agents already have ACP tools" };
|
|
8709
8528
|
}
|
|
8710
8529
|
const backupPath = `${path4}.acp-bak`;
|
|
8711
|
-
if (!
|
|
8530
|
+
if (!existsSync(backupPath)) {
|
|
8712
8531
|
try {
|
|
8713
8532
|
await copyFile(path4, backupPath);
|
|
8714
8533
|
} catch {
|
|
@@ -8774,8 +8593,8 @@ import { CONFIG_DIR_NAME } from "@earendil-works/pi-coding-agent";
|
|
|
8774
8593
|
async function loadUserConfig(cwd) {
|
|
8775
8594
|
const home = process.env.HOME ?? "";
|
|
8776
8595
|
const merged = {};
|
|
8777
|
-
for (const base of [
|
|
8778
|
-
const file =
|
|
8596
|
+
for (const base of [join8(home, CONFIG_DIR_NAME), join8(cwd, CONFIG_DIR_NAME)]) {
|
|
8597
|
+
const file = join8(base, "acp.json");
|
|
8779
8598
|
try {
|
|
8780
8599
|
const raw = await fs3.readFile(file, "utf8");
|
|
8781
8600
|
const parsed = JSON.parse(raw);
|
|
@@ -8788,7 +8607,7 @@ async function loadUserConfig(cwd) {
|
|
|
8788
8607
|
}
|
|
8789
8608
|
return merged;
|
|
8790
8609
|
}
|
|
8791
|
-
function
|
|
8610
|
+
function join8(...parts) {
|
|
8792
8611
|
return path3.join(...parts);
|
|
8793
8612
|
}
|
|
8794
8613
|
var KNOWN = /* @__PURE__ */ new Set(["debug", "autoUpdate", "modelContextLimit", "delegate"]);
|
|
@@ -8814,14 +8633,6 @@ function applyUserConfig(adapter, user) {
|
|
|
8814
8633
|
// src/index.ts
|
|
8815
8634
|
function createAcpExtension(adapter = {}) {
|
|
8816
8635
|
return (pi) => {
|
|
8817
|
-
if (isLegacyPackage() && isNewPackageInstalled()) {
|
|
8818
|
-
pi.on("session_start", async (_event, ctx) => {
|
|
8819
|
-
if (ctx.hasUI) {
|
|
8820
|
-
checkRename((m) => ctx.ui.notify(m));
|
|
8821
|
-
}
|
|
8822
|
-
});
|
|
8823
|
-
return;
|
|
8824
|
-
}
|
|
8825
8636
|
const runtime = createRuntime(adapter);
|
|
8826
8637
|
wireCompactionDisable(pi);
|
|
8827
8638
|
wireSessionLifecycle(pi, runtime);
|
|
@@ -8858,9 +8669,6 @@ function wireSessionLifecycle(pi, runtime) {
|
|
|
8858
8669
|
void checkForUpdate(runtime.adapter.autoUpdate ?? true, (msg) => {
|
|
8859
8670
|
if (ctx.hasUI) ctx.ui.notify(msg);
|
|
8860
8671
|
});
|
|
8861
|
-
if (isLegacyPackage() && ctx.hasUI) {
|
|
8862
|
-
void checkRename((msg) => ctx.ui.notify(msg));
|
|
8863
|
-
}
|
|
8864
8672
|
void runSetupAndNotify(ctx.hasUI ? (m) => ctx.ui.notify(m) : void 0);
|
|
8865
8673
|
delegateStatusWidget.setContext(ctx, runningRunsSnapshot);
|
|
8866
8674
|
});
|