sidekick-agent-hub 0.12.1 → 0.12.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/sidekick-cli.mjs +362 -249
- package/package.json +1 -1
package/dist/sidekick-cli.mjs
CHANGED
|
@@ -1157,8 +1157,8 @@ var require_command = __commonJS({
|
|
|
1157
1157
|
"node_modules/commander/lib/command.js"(exports) {
|
|
1158
1158
|
var EventEmitter3 = __require("node:events").EventEmitter;
|
|
1159
1159
|
var childProcess = __require("node:child_process");
|
|
1160
|
-
var
|
|
1161
|
-
var
|
|
1160
|
+
var path6 = __require("node:path");
|
|
1161
|
+
var fs6 = __require("node:fs");
|
|
1162
1162
|
var process14 = __require("node:process");
|
|
1163
1163
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1164
1164
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -2139,7 +2139,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2139
2139
|
* @param {string} subcommandName
|
|
2140
2140
|
*/
|
|
2141
2141
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
2142
|
-
if (
|
|
2142
|
+
if (fs6.existsSync(executableFile)) return;
|
|
2143
2143
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
2144
2144
|
const executableMissing = `'${executableFile}' does not exist
|
|
2145
2145
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
@@ -2157,11 +2157,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2157
2157
|
let launchWithNode = false;
|
|
2158
2158
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
2159
2159
|
function findFile(baseDir, baseName) {
|
|
2160
|
-
const localBin =
|
|
2161
|
-
if (
|
|
2162
|
-
if (sourceExt.includes(
|
|
2160
|
+
const localBin = path6.resolve(baseDir, baseName);
|
|
2161
|
+
if (fs6.existsSync(localBin)) return localBin;
|
|
2162
|
+
if (sourceExt.includes(path6.extname(baseName))) return void 0;
|
|
2163
2163
|
const foundExt = sourceExt.find(
|
|
2164
|
-
(ext) =>
|
|
2164
|
+
(ext) => fs6.existsSync(`${localBin}${ext}`)
|
|
2165
2165
|
);
|
|
2166
2166
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
2167
2167
|
return void 0;
|
|
@@ -2173,21 +2173,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2173
2173
|
if (this._scriptPath) {
|
|
2174
2174
|
let resolvedScriptPath;
|
|
2175
2175
|
try {
|
|
2176
|
-
resolvedScriptPath =
|
|
2176
|
+
resolvedScriptPath = fs6.realpathSync(this._scriptPath);
|
|
2177
2177
|
} catch {
|
|
2178
2178
|
resolvedScriptPath = this._scriptPath;
|
|
2179
2179
|
}
|
|
2180
|
-
executableDir =
|
|
2181
|
-
|
|
2180
|
+
executableDir = path6.resolve(
|
|
2181
|
+
path6.dirname(resolvedScriptPath),
|
|
2182
2182
|
executableDir
|
|
2183
2183
|
);
|
|
2184
2184
|
}
|
|
2185
2185
|
if (executableDir) {
|
|
2186
2186
|
let localFile = findFile(executableDir, executableFile);
|
|
2187
2187
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
2188
|
-
const legacyName =
|
|
2188
|
+
const legacyName = path6.basename(
|
|
2189
2189
|
this._scriptPath,
|
|
2190
|
-
|
|
2190
|
+
path6.extname(this._scriptPath)
|
|
2191
2191
|
);
|
|
2192
2192
|
if (legacyName !== this._name) {
|
|
2193
2193
|
localFile = findFile(
|
|
@@ -2198,7 +2198,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2198
2198
|
}
|
|
2199
2199
|
executableFile = localFile || executableFile;
|
|
2200
2200
|
}
|
|
2201
|
-
launchWithNode = sourceExt.includes(
|
|
2201
|
+
launchWithNode = sourceExt.includes(path6.extname(executableFile));
|
|
2202
2202
|
let proc;
|
|
2203
2203
|
if (process14.platform !== "win32") {
|
|
2204
2204
|
if (launchWithNode) {
|
|
@@ -3045,7 +3045,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3045
3045
|
* @return {Command}
|
|
3046
3046
|
*/
|
|
3047
3047
|
nameFromFilename(filename) {
|
|
3048
|
-
this._name =
|
|
3048
|
+
this._name = path6.basename(filename, path6.extname(filename));
|
|
3049
3049
|
return this;
|
|
3050
3050
|
}
|
|
3051
3051
|
/**
|
|
@@ -3059,9 +3059,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3059
3059
|
* @param {string} [path]
|
|
3060
3060
|
* @return {(string|null|Command)}
|
|
3061
3061
|
*/
|
|
3062
|
-
executableDir(
|
|
3063
|
-
if (
|
|
3064
|
-
this._executableDir =
|
|
3062
|
+
executableDir(path7) {
|
|
3063
|
+
if (path7 === void 0) return this._executableDir;
|
|
3064
|
+
this._executableDir = path7;
|
|
3065
3065
|
return this;
|
|
3066
3066
|
}
|
|
3067
3067
|
/**
|
|
@@ -3458,26 +3458,26 @@ var require_paths = __commonJS({
|
|
|
3458
3458
|
};
|
|
3459
3459
|
}();
|
|
3460
3460
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3461
|
-
exports.getConfigDir =
|
|
3461
|
+
exports.getConfigDir = getConfigDir2;
|
|
3462
3462
|
exports.getProjectDataPath = getProjectDataPath;
|
|
3463
3463
|
exports.getGlobalDataPath = getGlobalDataPath;
|
|
3464
3464
|
exports.encodeWorkspacePath = encodeWorkspacePath;
|
|
3465
3465
|
exports.getProjectSlug = getProjectSlug2;
|
|
3466
3466
|
exports.getProjectSlugRaw = getProjectSlugRaw2;
|
|
3467
|
-
var
|
|
3468
|
-
var
|
|
3467
|
+
var fs6 = __importStar(__require("fs"));
|
|
3468
|
+
var path6 = __importStar(__require("path"));
|
|
3469
3469
|
var os4 = __importStar(__require("os"));
|
|
3470
|
-
function
|
|
3470
|
+
function getConfigDir2() {
|
|
3471
3471
|
if (process.platform === "win32") {
|
|
3472
|
-
return
|
|
3472
|
+
return path6.join(process.env.APPDATA || os4.homedir(), "sidekick");
|
|
3473
3473
|
}
|
|
3474
|
-
return
|
|
3474
|
+
return path6.join(os4.homedir(), ".config", "sidekick");
|
|
3475
3475
|
}
|
|
3476
3476
|
function getProjectDataPath(slug, subdomain) {
|
|
3477
|
-
return
|
|
3477
|
+
return path6.join(getConfigDir2(), subdomain, `${slug}.json`);
|
|
3478
3478
|
}
|
|
3479
3479
|
function getGlobalDataPath(filename) {
|
|
3480
|
-
return
|
|
3480
|
+
return path6.join(getConfigDir2(), filename);
|
|
3481
3481
|
}
|
|
3482
3482
|
function encodeWorkspacePath(workspacePath) {
|
|
3483
3483
|
const normalized = workspacePath.replace(/\\/g, "/");
|
|
@@ -3487,15 +3487,15 @@ var require_paths = __commonJS({
|
|
|
3487
3487
|
const dir = cwd2 || process.cwd();
|
|
3488
3488
|
let resolved;
|
|
3489
3489
|
try {
|
|
3490
|
-
resolved =
|
|
3490
|
+
resolved = fs6.realpathSync(dir);
|
|
3491
3491
|
} catch {
|
|
3492
|
-
resolved =
|
|
3492
|
+
resolved = path6.resolve(dir);
|
|
3493
3493
|
}
|
|
3494
3494
|
return encodeWorkspacePath(resolved);
|
|
3495
3495
|
}
|
|
3496
3496
|
function getProjectSlugRaw2(cwd2) {
|
|
3497
3497
|
const dir = cwd2 || process.cwd();
|
|
3498
|
-
return encodeWorkspacePath(
|
|
3498
|
+
return encodeWorkspacePath(path6.resolve(dir));
|
|
3499
3499
|
}
|
|
3500
3500
|
}
|
|
3501
3501
|
});
|
|
@@ -3543,10 +3543,10 @@ var require_helpers = __commonJS({
|
|
|
3543
3543
|
}();
|
|
3544
3544
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3545
3545
|
exports.readJsonStore = readJsonStore;
|
|
3546
|
-
var
|
|
3546
|
+
var fs6 = __importStar(__require("fs"));
|
|
3547
3547
|
async function readJsonStore(filePath) {
|
|
3548
3548
|
try {
|
|
3549
|
-
const content = await
|
|
3549
|
+
const content = await fs6.promises.readFile(filePath, "utf-8");
|
|
3550
3550
|
return JSON.parse(content);
|
|
3551
3551
|
} catch {
|
|
3552
3552
|
return null;
|
|
@@ -3710,12 +3710,12 @@ var require_handoff = __commonJS({
|
|
|
3710
3710
|
}();
|
|
3711
3711
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3712
3712
|
exports.readLatestHandoff = readLatestHandoff;
|
|
3713
|
-
var
|
|
3713
|
+
var fs6 = __importStar(__require("fs"));
|
|
3714
3714
|
var paths_1 = require_paths();
|
|
3715
3715
|
async function readLatestHandoff(slug) {
|
|
3716
3716
|
const filePath = (0, paths_1.getProjectDataPath)(slug, "handoffs").replace(".json", "-latest.md");
|
|
3717
3717
|
try {
|
|
3718
|
-
const content = await
|
|
3718
|
+
const content = await fs6.promises.readFile(filePath, "utf-8");
|
|
3719
3719
|
return content.trim() || null;
|
|
3720
3720
|
} catch {
|
|
3721
3721
|
return null;
|
|
@@ -3768,30 +3768,30 @@ var require_detect = __commonJS({
|
|
|
3768
3768
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3769
3769
|
exports.getAllDetectedProviders = getAllDetectedProviders2;
|
|
3770
3770
|
exports.detectProvider = detectProvider2;
|
|
3771
|
-
var
|
|
3771
|
+
var fs6 = __importStar(__require("fs"));
|
|
3772
3772
|
var os4 = __importStar(__require("os"));
|
|
3773
|
-
var
|
|
3773
|
+
var path6 = __importStar(__require("path"));
|
|
3774
3774
|
function getOpenCodeDataDir() {
|
|
3775
3775
|
const xdg = process.env.XDG_DATA_HOME;
|
|
3776
3776
|
if (xdg)
|
|
3777
|
-
return
|
|
3778
|
-
return
|
|
3777
|
+
return path6.join(xdg, "opencode");
|
|
3778
|
+
return path6.join(os4.homedir(), ".local", "share", "opencode");
|
|
3779
3779
|
}
|
|
3780
3780
|
function getCodexHome() {
|
|
3781
3781
|
const envHome = process.env.CODEX_HOME;
|
|
3782
3782
|
if (envHome)
|
|
3783
3783
|
return envHome;
|
|
3784
|
-
return
|
|
3784
|
+
return path6.join(os4.homedir(), ".codex");
|
|
3785
3785
|
}
|
|
3786
3786
|
function getMostRecentMtime(dir) {
|
|
3787
3787
|
try {
|
|
3788
|
-
if (!
|
|
3788
|
+
if (!fs6.existsSync(dir))
|
|
3789
3789
|
return 0;
|
|
3790
3790
|
let latest = 0;
|
|
3791
|
-
const entries =
|
|
3791
|
+
const entries = fs6.readdirSync(dir);
|
|
3792
3792
|
for (const entry of entries) {
|
|
3793
3793
|
try {
|
|
3794
|
-
const stats =
|
|
3794
|
+
const stats = fs6.statSync(path6.join(dir, entry));
|
|
3795
3795
|
if (stats.mtime.getTime() > latest) {
|
|
3796
3796
|
latest = stats.mtime.getTime();
|
|
3797
3797
|
}
|
|
@@ -3805,41 +3805,41 @@ var require_detect = __commonJS({
|
|
|
3805
3805
|
}
|
|
3806
3806
|
function getOpenCodeActivityMtime() {
|
|
3807
3807
|
const dataDir = getOpenCodeDataDir();
|
|
3808
|
-
const dbPath =
|
|
3808
|
+
const dbPath = path6.join(dataDir, "opencode.db");
|
|
3809
3809
|
try {
|
|
3810
|
-
const dbMtime =
|
|
3810
|
+
const dbMtime = fs6.statSync(dbPath).mtime.getTime();
|
|
3811
3811
|
if (dbMtime > 0)
|
|
3812
3812
|
return dbMtime;
|
|
3813
3813
|
} catch {
|
|
3814
3814
|
}
|
|
3815
|
-
const storageDir =
|
|
3816
|
-
const sessionMtime = getMostRecentMtime(
|
|
3817
|
-
const messageMtime = getMostRecentMtime(
|
|
3818
|
-
const partMtime = getMostRecentMtime(
|
|
3815
|
+
const storageDir = path6.join(dataDir, "storage");
|
|
3816
|
+
const sessionMtime = getMostRecentMtime(path6.join(storageDir, "session"));
|
|
3817
|
+
const messageMtime = getMostRecentMtime(path6.join(storageDir, "message"));
|
|
3818
|
+
const partMtime = getMostRecentMtime(path6.join(storageDir, "part"));
|
|
3819
3819
|
return Math.max(sessionMtime, messageMtime, partMtime);
|
|
3820
3820
|
}
|
|
3821
3821
|
function getCodexActivityMtime() {
|
|
3822
3822
|
const codexHome = getCodexHome();
|
|
3823
|
-
const dbPath =
|
|
3823
|
+
const dbPath = path6.join(codexHome, "state.sqlite");
|
|
3824
3824
|
try {
|
|
3825
|
-
const dbMtime =
|
|
3825
|
+
const dbMtime = fs6.statSync(dbPath).mtime.getTime();
|
|
3826
3826
|
if (dbMtime > 0)
|
|
3827
3827
|
return dbMtime;
|
|
3828
3828
|
} catch {
|
|
3829
3829
|
}
|
|
3830
|
-
return getMostRecentMtime(
|
|
3830
|
+
return getMostRecentMtime(path6.join(codexHome, "sessions"));
|
|
3831
3831
|
}
|
|
3832
3832
|
function getAllDetectedProviders2() {
|
|
3833
|
-
const claudeBase =
|
|
3833
|
+
const claudeBase = path6.join(os4.homedir(), ".claude", "projects");
|
|
3834
3834
|
const openCodeDataDir = getOpenCodeDataDir();
|
|
3835
|
-
const openCodeDbPath =
|
|
3836
|
-
const openCodeStorageDir =
|
|
3835
|
+
const openCodeDbPath = path6.join(openCodeDataDir, "opencode.db");
|
|
3836
|
+
const openCodeStorageDir = path6.join(openCodeDataDir, "storage");
|
|
3837
3837
|
const codexHome = getCodexHome();
|
|
3838
|
-
const codexSessionsDir =
|
|
3839
|
-
const codexDbPath =
|
|
3840
|
-
const hasClaude =
|
|
3841
|
-
const hasOpenCode =
|
|
3842
|
-
const hasCodex =
|
|
3838
|
+
const codexSessionsDir = path6.join(codexHome, "sessions");
|
|
3839
|
+
const codexDbPath = path6.join(codexHome, "state.sqlite");
|
|
3840
|
+
const hasClaude = fs6.existsSync(claudeBase);
|
|
3841
|
+
const hasOpenCode = fs6.existsSync(openCodeStorageDir) || fs6.existsSync(openCodeDbPath);
|
|
3842
|
+
const hasCodex = fs6.existsSync(codexSessionsDir) || fs6.existsSync(codexDbPath);
|
|
3843
3843
|
const available = [];
|
|
3844
3844
|
if (hasClaude)
|
|
3845
3845
|
available.push({ id: "claude-code", mtime: getMostRecentMtime(claudeBase) });
|
|
@@ -3853,16 +3853,16 @@ var require_detect = __commonJS({
|
|
|
3853
3853
|
function detectProvider2(override) {
|
|
3854
3854
|
if (override && override !== "auto")
|
|
3855
3855
|
return override;
|
|
3856
|
-
const claudeBase =
|
|
3856
|
+
const claudeBase = path6.join(os4.homedir(), ".claude", "projects");
|
|
3857
3857
|
const openCodeDataDir = getOpenCodeDataDir();
|
|
3858
|
-
const openCodeDbPath =
|
|
3859
|
-
const openCodeStorageDir =
|
|
3858
|
+
const openCodeDbPath = path6.join(openCodeDataDir, "opencode.db");
|
|
3859
|
+
const openCodeStorageDir = path6.join(openCodeDataDir, "storage");
|
|
3860
3860
|
const codexHome = getCodexHome();
|
|
3861
|
-
const codexSessionsDir =
|
|
3862
|
-
const codexDbPath =
|
|
3863
|
-
const hasClaude =
|
|
3864
|
-
const hasOpenCode =
|
|
3865
|
-
const hasCodex =
|
|
3861
|
+
const codexSessionsDir = path6.join(codexHome, "sessions");
|
|
3862
|
+
const codexDbPath = path6.join(codexHome, "state.sqlite");
|
|
3863
|
+
const hasClaude = fs6.existsSync(claudeBase);
|
|
3864
|
+
const hasOpenCode = fs6.existsSync(openCodeStorageDir) || fs6.existsSync(openCodeDbPath);
|
|
3865
|
+
const hasCodex = fs6.existsSync(codexSessionsDir) || fs6.existsSync(codexDbPath);
|
|
3866
3866
|
const available = [];
|
|
3867
3867
|
if (hasClaude) {
|
|
3868
3868
|
available.push({ id: "claude-code", mtime: getMostRecentMtime(claudeBase) });
|
|
@@ -3983,9 +3983,9 @@ var require_claudeCode = __commonJS({
|
|
|
3983
3983
|
}();
|
|
3984
3984
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3985
3985
|
exports.ClaudeCodeProvider = void 0;
|
|
3986
|
-
var
|
|
3986
|
+
var fs6 = __importStar(__require("fs"));
|
|
3987
3987
|
var os4 = __importStar(__require("os"));
|
|
3988
|
-
var
|
|
3988
|
+
var path6 = __importStar(__require("path"));
|
|
3989
3989
|
var jsonl_1 = require_jsonl();
|
|
3990
3990
|
function encodeWorkspacePath(workspacePath) {
|
|
3991
3991
|
const normalized = workspacePath.replace(/\\/g, "/");
|
|
@@ -4004,20 +4004,20 @@ var require_claudeCode = __commonJS({
|
|
|
4004
4004
|
return encoded.replace(/-/g, "/");
|
|
4005
4005
|
}
|
|
4006
4006
|
function getProjectsBaseDir() {
|
|
4007
|
-
return
|
|
4007
|
+
return path6.join(os4.homedir(), ".claude", "projects");
|
|
4008
4008
|
}
|
|
4009
4009
|
function discoverSessionDirectory(workspacePath) {
|
|
4010
4010
|
const projectsDir = getProjectsBaseDir();
|
|
4011
4011
|
const encoded = encodeWorkspacePath(workspacePath);
|
|
4012
|
-
const computedDir =
|
|
4013
|
-
if (
|
|
4012
|
+
const computedDir = path6.join(projectsDir, encoded);
|
|
4013
|
+
if (fs6.existsSync(computedDir))
|
|
4014
4014
|
return computedDir;
|
|
4015
4015
|
try {
|
|
4016
|
-
if (
|
|
4016
|
+
if (fs6.existsSync(projectsDir)) {
|
|
4017
4017
|
const encodedPrefix = encoded.toLowerCase();
|
|
4018
|
-
const allDirs =
|
|
4018
|
+
const allDirs = fs6.readdirSync(projectsDir).filter((name) => {
|
|
4019
4019
|
try {
|
|
4020
|
-
return
|
|
4020
|
+
return fs6.statSync(path6.join(projectsDir, name)).isDirectory();
|
|
4021
4021
|
} catch {
|
|
4022
4022
|
return false;
|
|
4023
4023
|
}
|
|
@@ -4027,12 +4027,12 @@ var require_claudeCode = __commonJS({
|
|
|
4027
4027
|
let bestDir = null;
|
|
4028
4028
|
let bestMtime = 0;
|
|
4029
4029
|
for (const dir of subDirMatches) {
|
|
4030
|
-
const fullDir =
|
|
4030
|
+
const fullDir = path6.join(projectsDir, dir);
|
|
4031
4031
|
try {
|
|
4032
|
-
const files =
|
|
4032
|
+
const files = fs6.readdirSync(fullDir).filter((f) => f.endsWith(".jsonl"));
|
|
4033
4033
|
for (const file of files) {
|
|
4034
4034
|
try {
|
|
4035
|
-
const mtime =
|
|
4035
|
+
const mtime = fs6.statSync(path6.join(fullDir, file)).mtime.getTime();
|
|
4036
4036
|
if (mtime > bestMtime) {
|
|
4037
4037
|
bestMtime = mtime;
|
|
4038
4038
|
bestDir = fullDir;
|
|
@@ -4049,13 +4049,13 @@ var require_claudeCode = __commonJS({
|
|
|
4049
4049
|
const normalizedWorkspace = workspacePath.replace(/\\/g, "/").replace(/:/g, "-").replace(/_/g, "-").replace(/\//g, "-").toLowerCase();
|
|
4050
4050
|
for (const dir of allDirs) {
|
|
4051
4051
|
if (dir.toLowerCase() === normalizedWorkspace)
|
|
4052
|
-
return
|
|
4052
|
+
return path6.join(projectsDir, dir);
|
|
4053
4053
|
}
|
|
4054
|
-
const workspaceBasename =
|
|
4054
|
+
const workspaceBasename = path6.basename(workspacePath).replace(/_/g, "-").toLowerCase();
|
|
4055
4055
|
for (const dir of allDirs) {
|
|
4056
4056
|
const dirLower = dir.toLowerCase();
|
|
4057
4057
|
if (dirLower.endsWith("-" + workspaceBasename) || dirLower === workspaceBasename) {
|
|
4058
|
-
return
|
|
4058
|
+
return path6.join(projectsDir, dir);
|
|
4059
4059
|
}
|
|
4060
4060
|
}
|
|
4061
4061
|
}
|
|
@@ -4068,10 +4068,10 @@ var require_claudeCode = __commonJS({
|
|
|
4068
4068
|
if (!sessionDir)
|
|
4069
4069
|
return [];
|
|
4070
4070
|
try {
|
|
4071
|
-
return
|
|
4072
|
-
const fullPath =
|
|
4071
|
+
return fs6.readdirSync(sessionDir).filter((f) => f.endsWith(".jsonl")).map((f) => {
|
|
4072
|
+
const fullPath = path6.join(sessionDir, f);
|
|
4073
4073
|
try {
|
|
4074
|
-
const stats =
|
|
4074
|
+
const stats = fs6.statSync(fullPath);
|
|
4075
4075
|
return { path: fullPath, mtime: stats.mtime.getTime(), size: stats.size };
|
|
4076
4076
|
} catch {
|
|
4077
4077
|
return null;
|
|
@@ -4122,20 +4122,20 @@ var require_claudeCode = __commonJS({
|
|
|
4122
4122
|
const projectsDir = getProjectsBaseDir();
|
|
4123
4123
|
const folders = [];
|
|
4124
4124
|
try {
|
|
4125
|
-
if (!
|
|
4125
|
+
if (!fs6.existsSync(projectsDir))
|
|
4126
4126
|
return [];
|
|
4127
|
-
const entries =
|
|
4127
|
+
const entries = fs6.readdirSync(projectsDir);
|
|
4128
4128
|
for (const entry of entries) {
|
|
4129
|
-
const fullPath =
|
|
4129
|
+
const fullPath = path6.join(projectsDir, entry);
|
|
4130
4130
|
try {
|
|
4131
|
-
if (!
|
|
4131
|
+
if (!fs6.statSync(fullPath).isDirectory())
|
|
4132
4132
|
continue;
|
|
4133
|
-
const sessionFiles =
|
|
4133
|
+
const sessionFiles = fs6.readdirSync(fullPath).filter((f) => f.endsWith(".jsonl"));
|
|
4134
4134
|
let lastModified = /* @__PURE__ */ new Date(0);
|
|
4135
4135
|
let sessionCount = 0;
|
|
4136
4136
|
for (const sf of sessionFiles) {
|
|
4137
4137
|
try {
|
|
4138
|
-
const stats =
|
|
4138
|
+
const stats = fs6.statSync(path6.join(fullPath, sf));
|
|
4139
4139
|
if (stats.size > 0) {
|
|
4140
4140
|
sessionCount++;
|
|
4141
4141
|
if (stats.mtime > lastModified)
|
|
@@ -4179,8 +4179,8 @@ var require_claudeCode = __commonJS({
|
|
|
4179
4179
|
return folders;
|
|
4180
4180
|
}
|
|
4181
4181
|
readSessionStats(sessionPath) {
|
|
4182
|
-
const sessionId =
|
|
4183
|
-
const projectDir =
|
|
4182
|
+
const sessionId = path6.basename(sessionPath, ".jsonl");
|
|
4183
|
+
const projectDir = path6.basename(path6.dirname(sessionPath));
|
|
4184
4184
|
let messageCount = 0;
|
|
4185
4185
|
let startTime = "";
|
|
4186
4186
|
let endTime = "";
|
|
@@ -4191,7 +4191,7 @@ var require_claudeCode = __commonJS({
|
|
|
4191
4191
|
let truncationCount = 0;
|
|
4192
4192
|
let reportedCost = 0;
|
|
4193
4193
|
try {
|
|
4194
|
-
const content =
|
|
4194
|
+
const content = fs6.readFileSync(sessionPath, "utf8");
|
|
4195
4195
|
const lines = content.split("\n");
|
|
4196
4196
|
for (const line of lines) {
|
|
4197
4197
|
const trimmed = line.trim();
|
|
@@ -4264,10 +4264,10 @@ var require_claudeCode = __commonJS({
|
|
|
4264
4264
|
}
|
|
4265
4265
|
extractSessionLabel(sessionPath) {
|
|
4266
4266
|
try {
|
|
4267
|
-
const fd =
|
|
4267
|
+
const fd = fs6.openSync(sessionPath, "r");
|
|
4268
4268
|
const buffer = Buffer.alloc(8192);
|
|
4269
|
-
const bytesRead =
|
|
4270
|
-
|
|
4269
|
+
const bytesRead = fs6.readSync(fd, buffer, 0, 8192, 0);
|
|
4270
|
+
fs6.closeSync(fd);
|
|
4271
4271
|
if (bytesRead === 0)
|
|
4272
4272
|
return null;
|
|
4273
4273
|
const chunk = buffer.toString("utf-8", 0, bytesRead);
|
|
@@ -4307,9 +4307,9 @@ var require_claudeCode = __commonJS({
|
|
|
4307
4307
|
const results = [];
|
|
4308
4308
|
const queryLower = query.toLowerCase();
|
|
4309
4309
|
try {
|
|
4310
|
-
const content =
|
|
4310
|
+
const content = fs6.readFileSync(sessionPath, "utf8");
|
|
4311
4311
|
const lines = content.split("\n");
|
|
4312
|
-
const projectDir =
|
|
4312
|
+
const projectDir = path6.basename(path6.dirname(sessionPath));
|
|
4313
4313
|
const projectPath = decodeEncodedPath(projectDir);
|
|
4314
4314
|
for (const line of lines) {
|
|
4315
4315
|
if (results.length >= maxResults)
|
|
@@ -4392,17 +4392,17 @@ var require_openCodeDatabase = __commonJS({
|
|
|
4392
4392
|
}();
|
|
4393
4393
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4394
4394
|
exports.OpenCodeDatabase = void 0;
|
|
4395
|
-
var
|
|
4396
|
-
var
|
|
4395
|
+
var fs6 = __importStar(__require("fs"));
|
|
4396
|
+
var path6 = __importStar(__require("path"));
|
|
4397
4397
|
var child_process_1 = __require("child_process");
|
|
4398
4398
|
var OpenCodeDatabase = class {
|
|
4399
4399
|
dbPath;
|
|
4400
4400
|
sqlite3Available = null;
|
|
4401
4401
|
constructor(dataDir) {
|
|
4402
|
-
this.dbPath =
|
|
4402
|
+
this.dbPath = path6.join(dataDir, "opencode.db");
|
|
4403
4403
|
}
|
|
4404
4404
|
isAvailable() {
|
|
4405
|
-
return
|
|
4405
|
+
return fs6.existsSync(this.dbPath);
|
|
4406
4406
|
}
|
|
4407
4407
|
open() {
|
|
4408
4408
|
if (this.sqlite3Available !== null)
|
|
@@ -4460,7 +4460,7 @@ var require_openCodeDatabase = __commonJS({
|
|
|
4460
4460
|
const projPath = normalizePath(proj.worktree);
|
|
4461
4461
|
if (projPath === normalized)
|
|
4462
4462
|
return proj;
|
|
4463
|
-
if (normalized.startsWith(projPath +
|
|
4463
|
+
if (normalized.startsWith(projPath + path6.sep) || projPath.startsWith(normalized + path6.sep)) {
|
|
4464
4464
|
matches.push({ ...proj, pathLen: projPath.length });
|
|
4465
4465
|
}
|
|
4466
4466
|
}
|
|
@@ -4492,9 +4492,9 @@ var require_openCodeDatabase = __commonJS({
|
|
|
4492
4492
|
exports.OpenCodeDatabase = OpenCodeDatabase;
|
|
4493
4493
|
function normalizePath(input) {
|
|
4494
4494
|
try {
|
|
4495
|
-
return
|
|
4495
|
+
return fs6.realpathSync(input);
|
|
4496
4496
|
} catch {
|
|
4497
|
-
return
|
|
4497
|
+
return path6.resolve(input);
|
|
4498
4498
|
}
|
|
4499
4499
|
}
|
|
4500
4500
|
}
|
|
@@ -4543,19 +4543,19 @@ var require_openCode = __commonJS({
|
|
|
4543
4543
|
}();
|
|
4544
4544
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4545
4545
|
exports.OpenCodeProvider = void 0;
|
|
4546
|
-
var
|
|
4546
|
+
var fs6 = __importStar(__require("fs"));
|
|
4547
4547
|
var os4 = __importStar(__require("os"));
|
|
4548
|
-
var
|
|
4548
|
+
var path6 = __importStar(__require("path"));
|
|
4549
4549
|
var child_process_1 = __require("child_process");
|
|
4550
4550
|
var openCodeDatabase_1 = require_openCodeDatabase();
|
|
4551
4551
|
function getOpenCodeDataDir() {
|
|
4552
4552
|
const xdg = process.env.XDG_DATA_HOME;
|
|
4553
4553
|
if (xdg)
|
|
4554
|
-
return
|
|
4555
|
-
return
|
|
4554
|
+
return path6.join(xdg, "opencode");
|
|
4555
|
+
return path6.join(os4.homedir(), ".local", "share", "opencode");
|
|
4556
4556
|
}
|
|
4557
4557
|
function getStorageDir() {
|
|
4558
|
-
return
|
|
4558
|
+
return path6.join(getOpenCodeDataDir(), "storage");
|
|
4559
4559
|
}
|
|
4560
4560
|
var DB_SESSION_PREFIX = "db-sessions";
|
|
4561
4561
|
function resolveProjectId(workspacePath, db) {
|
|
@@ -4565,14 +4565,14 @@ var require_openCode = __commonJS({
|
|
|
4565
4565
|
return proj.id;
|
|
4566
4566
|
}
|
|
4567
4567
|
try {
|
|
4568
|
-
const projectDir =
|
|
4569
|
-
if (!
|
|
4568
|
+
const projectDir = path6.join(getStorageDir(), "project");
|
|
4569
|
+
if (!fs6.existsSync(projectDir))
|
|
4570
4570
|
return resolveProjectIdFromGit(workspacePath);
|
|
4571
4571
|
const normalizedWs = normalizePath(workspacePath);
|
|
4572
|
-
const files =
|
|
4572
|
+
const files = fs6.readdirSync(projectDir).filter((f) => f.endsWith(".json"));
|
|
4573
4573
|
for (const file of files) {
|
|
4574
4574
|
try {
|
|
4575
|
-
const proj = JSON.parse(
|
|
4575
|
+
const proj = JSON.parse(fs6.readFileSync(path6.join(projectDir, file), "utf-8"));
|
|
4576
4576
|
if (proj.path && normalizePath(proj.path) === normalizedWs)
|
|
4577
4577
|
return proj.id;
|
|
4578
4578
|
} catch {
|
|
@@ -4598,9 +4598,9 @@ var require_openCode = __commonJS({
|
|
|
4598
4598
|
}
|
|
4599
4599
|
function normalizePath(input) {
|
|
4600
4600
|
try {
|
|
4601
|
-
return
|
|
4601
|
+
return fs6.realpathSync(input);
|
|
4602
4602
|
} catch {
|
|
4603
|
-
return
|
|
4603
|
+
return path6.resolve(input);
|
|
4604
4604
|
}
|
|
4605
4605
|
}
|
|
4606
4606
|
var OpenCodeProvider3 = class {
|
|
@@ -4630,16 +4630,16 @@ var require_openCode = __commonJS({
|
|
|
4630
4630
|
const sessions = db.getSessionsForProject(projectId);
|
|
4631
4631
|
if (sessions.length > 0) {
|
|
4632
4632
|
const dataDir = getOpenCodeDataDir();
|
|
4633
|
-
return sessions.map((s) =>
|
|
4633
|
+
return sessions.map((s) => path6.join(dataDir, DB_SESSION_PREFIX, projectId, `${s.id}.json`));
|
|
4634
4634
|
}
|
|
4635
4635
|
}
|
|
4636
|
-
const sessionDir =
|
|
4636
|
+
const sessionDir = path6.join(getStorageDir(), "session", projectId);
|
|
4637
4637
|
try {
|
|
4638
|
-
if (!
|
|
4638
|
+
if (!fs6.existsSync(sessionDir))
|
|
4639
4639
|
return [];
|
|
4640
|
-
return
|
|
4640
|
+
return fs6.readdirSync(sessionDir).filter((f) => f.endsWith(".json")).map((f) => path6.join(sessionDir, f)).sort((a, b) => {
|
|
4641
4641
|
try {
|
|
4642
|
-
return
|
|
4642
|
+
return fs6.statSync(b).mtime.getTime() - fs6.statSync(a).mtime.getTime();
|
|
4643
4643
|
} catch {
|
|
4644
4644
|
return 0;
|
|
4645
4645
|
}
|
|
@@ -4649,7 +4649,7 @@ var require_openCode = __commonJS({
|
|
|
4649
4649
|
}
|
|
4650
4650
|
}
|
|
4651
4651
|
getProjectsBaseDir() {
|
|
4652
|
-
return
|
|
4652
|
+
return path6.join(getStorageDir(), "session");
|
|
4653
4653
|
}
|
|
4654
4654
|
getAllProjectFolders(workspacePath) {
|
|
4655
4655
|
const db = this.ensureDb();
|
|
@@ -4667,7 +4667,7 @@ var require_openCode = __commonJS({
|
|
|
4667
4667
|
if (!projStats || projStats.sessionCount === 0)
|
|
4668
4668
|
continue;
|
|
4669
4669
|
folders.push({
|
|
4670
|
-
dir:
|
|
4670
|
+
dir: path6.join(dataDir, DB_SESSION_PREFIX, project.id),
|
|
4671
4671
|
name: project.worktree || project.name || project.id,
|
|
4672
4672
|
encodedName: project.id,
|
|
4673
4673
|
sessionCount: projStats.sessionCount,
|
|
@@ -4689,7 +4689,7 @@ var require_openCode = __commonJS({
|
|
|
4689
4689
|
return folders;
|
|
4690
4690
|
}
|
|
4691
4691
|
readSessionStats(sessionPath) {
|
|
4692
|
-
const sessionId =
|
|
4692
|
+
const sessionId = path6.basename(sessionPath, ".json");
|
|
4693
4693
|
const db = this.ensureDb();
|
|
4694
4694
|
let messageCount = 0;
|
|
4695
4695
|
let startTime = "";
|
|
@@ -4759,7 +4759,7 @@ var require_openCode = __commonJS({
|
|
|
4759
4759
|
}
|
|
4760
4760
|
extractSessionLabel(sessionPath) {
|
|
4761
4761
|
const db = this.ensureDb();
|
|
4762
|
-
const sessionId =
|
|
4762
|
+
const sessionId = path6.basename(sessionPath, ".json");
|
|
4763
4763
|
if (db) {
|
|
4764
4764
|
const session = db.getSession(sessionId);
|
|
4765
4765
|
if (session?.title) {
|
|
@@ -4771,7 +4771,7 @@ var require_openCode = __commonJS({
|
|
|
4771
4771
|
}
|
|
4772
4772
|
searchInSession(sessionPath, query, maxResults) {
|
|
4773
4773
|
const db = this.ensureDb();
|
|
4774
|
-
const sessionId =
|
|
4774
|
+
const sessionId = path6.basename(sessionPath, ".json");
|
|
4775
4775
|
const queryLower = query.toLowerCase();
|
|
4776
4776
|
const results = [];
|
|
4777
4777
|
if (db) {
|
|
@@ -4850,20 +4850,20 @@ var require_codexDatabase = __commonJS({
|
|
|
4850
4850
|
}();
|
|
4851
4851
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4852
4852
|
exports.CodexDatabase = void 0;
|
|
4853
|
-
var
|
|
4854
|
-
var
|
|
4853
|
+
var fs6 = __importStar(__require("fs"));
|
|
4854
|
+
var path6 = __importStar(__require("path"));
|
|
4855
4855
|
var child_process_1 = __require("child_process");
|
|
4856
4856
|
var CodexDatabase = class {
|
|
4857
4857
|
dbPath;
|
|
4858
4858
|
sqlite3Available = null;
|
|
4859
4859
|
constructor(codexHome) {
|
|
4860
|
-
this.dbPath =
|
|
4860
|
+
this.dbPath = path6.join(codexHome, "state.sqlite");
|
|
4861
4861
|
}
|
|
4862
4862
|
isAvailable() {
|
|
4863
4863
|
try {
|
|
4864
|
-
if (!
|
|
4864
|
+
if (!fs6.existsSync(this.dbPath))
|
|
4865
4865
|
return false;
|
|
4866
|
-
return
|
|
4866
|
+
return fs6.statSync(this.dbPath).size > 0;
|
|
4867
4867
|
} catch {
|
|
4868
4868
|
return false;
|
|
4869
4869
|
}
|
|
@@ -4920,7 +4920,7 @@ var require_codexDatabase = __commonJS({
|
|
|
4920
4920
|
const all = this.query("SELECT * FROM threads ORDER BY updated_at DESC");
|
|
4921
4921
|
return all.filter((t) => {
|
|
4922
4922
|
const threadCwd = normalizePath(t.cwd);
|
|
4923
|
-
return threadCwd === normalized || normalized.startsWith(threadCwd +
|
|
4923
|
+
return threadCwd === normalized || normalized.startsWith(threadCwd + path6.sep) || threadCwd.startsWith(normalized + path6.sep);
|
|
4924
4924
|
});
|
|
4925
4925
|
}
|
|
4926
4926
|
getMostRecentThread(cwd2) {
|
|
@@ -4936,9 +4936,9 @@ var require_codexDatabase = __commonJS({
|
|
|
4936
4936
|
exports.CodexDatabase = CodexDatabase;
|
|
4937
4937
|
function normalizePath(input) {
|
|
4938
4938
|
try {
|
|
4939
|
-
return
|
|
4939
|
+
return fs6.realpathSync(input);
|
|
4940
4940
|
} catch {
|
|
4941
|
-
return
|
|
4941
|
+
return path6.resolve(input);
|
|
4942
4942
|
}
|
|
4943
4943
|
}
|
|
4944
4944
|
}
|
|
@@ -4987,24 +4987,24 @@ var require_codex = __commonJS({
|
|
|
4987
4987
|
}();
|
|
4988
4988
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4989
4989
|
exports.CodexProvider = void 0;
|
|
4990
|
-
var
|
|
4990
|
+
var fs6 = __importStar(__require("fs"));
|
|
4991
4991
|
var os4 = __importStar(__require("os"));
|
|
4992
|
-
var
|
|
4992
|
+
var path6 = __importStar(__require("path"));
|
|
4993
4993
|
var codexDatabase_1 = require_codexDatabase();
|
|
4994
4994
|
function getCodexHome() {
|
|
4995
4995
|
const envHome = process.env.CODEX_HOME;
|
|
4996
4996
|
if (envHome)
|
|
4997
4997
|
return envHome;
|
|
4998
|
-
return
|
|
4998
|
+
return path6.join(os4.homedir(), ".codex");
|
|
4999
4999
|
}
|
|
5000
5000
|
function getSessionsDir() {
|
|
5001
|
-
return
|
|
5001
|
+
return path6.join(getCodexHome(), "sessions");
|
|
5002
5002
|
}
|
|
5003
5003
|
function isRolloutFile(filename) {
|
|
5004
5004
|
return filename.startsWith("rollout-") && filename.endsWith(".jsonl");
|
|
5005
5005
|
}
|
|
5006
5006
|
function extractSessionId(filename) {
|
|
5007
|
-
const base =
|
|
5007
|
+
const base = path6.basename(filename, ".jsonl");
|
|
5008
5008
|
const parts = base.split("-");
|
|
5009
5009
|
if (parts.length >= 6) {
|
|
5010
5010
|
const possibleUuid = parts.slice(-5).join("-");
|
|
@@ -5017,16 +5017,16 @@ var require_codex = __commonJS({
|
|
|
5017
5017
|
function findRolloutFiles(dir) {
|
|
5018
5018
|
const results = [];
|
|
5019
5019
|
try {
|
|
5020
|
-
if (!
|
|
5020
|
+
if (!fs6.existsSync(dir))
|
|
5021
5021
|
return results;
|
|
5022
|
-
const entries =
|
|
5022
|
+
const entries = fs6.readdirSync(dir, { withFileTypes: true });
|
|
5023
5023
|
for (const entry of entries) {
|
|
5024
|
-
const fullPath =
|
|
5024
|
+
const fullPath = path6.join(dir, entry.name);
|
|
5025
5025
|
if (entry.isDirectory())
|
|
5026
5026
|
results.push(...findRolloutFiles(fullPath));
|
|
5027
5027
|
else if (entry.isFile() && isRolloutFile(entry.name)) {
|
|
5028
5028
|
try {
|
|
5029
|
-
const stats =
|
|
5029
|
+
const stats = fs6.statSync(fullPath);
|
|
5030
5030
|
if (stats.size > 0)
|
|
5031
5031
|
results.push({ path: fullPath, mtime: stats.mtime });
|
|
5032
5032
|
} catch {
|
|
@@ -5039,10 +5039,10 @@ var require_codex = __commonJS({
|
|
|
5039
5039
|
}
|
|
5040
5040
|
function readSessionMeta(rolloutPath) {
|
|
5041
5041
|
try {
|
|
5042
|
-
const fd =
|
|
5042
|
+
const fd = fs6.openSync(rolloutPath, "r");
|
|
5043
5043
|
const buf = Buffer.alloc(16384);
|
|
5044
|
-
const bytesRead =
|
|
5045
|
-
|
|
5044
|
+
const bytesRead = fs6.readSync(fd, buf, 0, 16384, 0);
|
|
5045
|
+
fs6.closeSync(fd);
|
|
5046
5046
|
if (bytesRead === 0)
|
|
5047
5047
|
return null;
|
|
5048
5048
|
const text = buf.toString("utf-8", 0, bytesRead);
|
|
@@ -5060,13 +5060,13 @@ var require_codex = __commonJS({
|
|
|
5060
5060
|
function cwdMatches(sessionCwd, workspacePath) {
|
|
5061
5061
|
const ns = normalizePath(sessionCwd);
|
|
5062
5062
|
const nw = normalizePath(workspacePath);
|
|
5063
|
-
return ns === nw || nw.startsWith(ns +
|
|
5063
|
+
return ns === nw || nw.startsWith(ns + path6.sep) || ns.startsWith(nw + path6.sep);
|
|
5064
5064
|
}
|
|
5065
5065
|
function normalizePath(input) {
|
|
5066
5066
|
try {
|
|
5067
|
-
return
|
|
5067
|
+
return fs6.realpathSync(input);
|
|
5068
5068
|
} catch {
|
|
5069
|
-
return
|
|
5069
|
+
return path6.resolve(input);
|
|
5070
5070
|
}
|
|
5071
5071
|
}
|
|
5072
5072
|
function truncate2(text, maxLen) {
|
|
@@ -5098,12 +5098,12 @@ var require_codex = __commonJS({
|
|
|
5098
5098
|
const db = this.ensureDb();
|
|
5099
5099
|
if (db) {
|
|
5100
5100
|
const threads = db.getThreadsByCwd(workspacePath);
|
|
5101
|
-
const dbPaths = threads.filter((t) => t.rollout_path &&
|
|
5101
|
+
const dbPaths = threads.filter((t) => t.rollout_path && fs6.existsSync(t.rollout_path)).map((t) => t.rollout_path);
|
|
5102
5102
|
if (dbPaths.length > 0)
|
|
5103
5103
|
return dbPaths;
|
|
5104
5104
|
}
|
|
5105
5105
|
const sessionsDir = getSessionsDir();
|
|
5106
|
-
if (!
|
|
5106
|
+
if (!fs6.existsSync(sessionsDir))
|
|
5107
5107
|
return [];
|
|
5108
5108
|
const files = findRolloutFiles(sessionsDir);
|
|
5109
5109
|
files.sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
|
|
@@ -5132,7 +5132,7 @@ var require_codex = __commonJS({
|
|
|
5132
5132
|
}
|
|
5133
5133
|
}
|
|
5134
5134
|
const sessionsDir = getSessionsDir();
|
|
5135
|
-
if (
|
|
5135
|
+
if (fs6.existsSync(sessionsDir)) {
|
|
5136
5136
|
const files = findRolloutFiles(sessionsDir);
|
|
5137
5137
|
for (const file of files) {
|
|
5138
5138
|
const meta = readSessionMeta(file.path);
|
|
@@ -5144,7 +5144,7 @@ var require_codex = __commonJS({
|
|
|
5144
5144
|
existing.lastModified = file.mtime;
|
|
5145
5145
|
} else {
|
|
5146
5146
|
seenCwds.set(meta.cwd, {
|
|
5147
|
-
dir:
|
|
5147
|
+
dir: path6.dirname(file.path),
|
|
5148
5148
|
name: meta.cwd,
|
|
5149
5149
|
encodedName: meta.cwd,
|
|
5150
5150
|
sessionCount: 1,
|
|
@@ -5169,7 +5169,7 @@ var require_codex = __commonJS({
|
|
|
5169
5169
|
return folders;
|
|
5170
5170
|
}
|
|
5171
5171
|
readSessionStats(sessionPath) {
|
|
5172
|
-
const sessionId = extractSessionId(
|
|
5172
|
+
const sessionId = extractSessionId(path6.basename(sessionPath));
|
|
5173
5173
|
let messageCount = 0;
|
|
5174
5174
|
let startTime = "";
|
|
5175
5175
|
let endTime = "";
|
|
@@ -5179,7 +5179,7 @@ var require_codex = __commonJS({
|
|
|
5179
5179
|
let compactionEstimate = 0;
|
|
5180
5180
|
let currentModel = "unknown";
|
|
5181
5181
|
try {
|
|
5182
|
-
const content =
|
|
5182
|
+
const content = fs6.readFileSync(sessionPath, "utf8");
|
|
5183
5183
|
const lines = content.split("\n");
|
|
5184
5184
|
for (const line of lines) {
|
|
5185
5185
|
const trimmed = line.trim();
|
|
@@ -5249,7 +5249,7 @@ var require_codex = __commonJS({
|
|
|
5249
5249
|
extractSessionLabel(sessionPath) {
|
|
5250
5250
|
const db = this.ensureDb();
|
|
5251
5251
|
if (db) {
|
|
5252
|
-
const sessionId = extractSessionId(
|
|
5252
|
+
const sessionId = extractSessionId(path6.basename(sessionPath));
|
|
5253
5253
|
const thread = db.getThread(sessionId);
|
|
5254
5254
|
if (thread?.title)
|
|
5255
5255
|
return truncate2(thread.title, 60);
|
|
@@ -5257,10 +5257,10 @@ var require_codex = __commonJS({
|
|
|
5257
5257
|
return truncate2(thread.first_user_message, 60);
|
|
5258
5258
|
}
|
|
5259
5259
|
try {
|
|
5260
|
-
const fd =
|
|
5260
|
+
const fd = fs6.openSync(sessionPath, "r");
|
|
5261
5261
|
const buf = Buffer.alloc(65536);
|
|
5262
|
-
const bytesRead =
|
|
5263
|
-
|
|
5262
|
+
const bytesRead = fs6.readSync(fd, buf, 0, 65536, 0);
|
|
5263
|
+
fs6.closeSync(fd);
|
|
5264
5264
|
const text = buf.toString("utf-8", 0, bytesRead);
|
|
5265
5265
|
const lines = text.split("\n").slice(0, 20);
|
|
5266
5266
|
for (const line of lines) {
|
|
@@ -5291,7 +5291,7 @@ var require_codex = __commonJS({
|
|
|
5291
5291
|
const results = [];
|
|
5292
5292
|
const queryLower = query.toLowerCase();
|
|
5293
5293
|
try {
|
|
5294
|
-
const content =
|
|
5294
|
+
const content = fs6.readFileSync(sessionPath, "utf8");
|
|
5295
5295
|
const lines = content.split("\n");
|
|
5296
5296
|
const cwd2 = readSessionMeta(sessionPath)?.cwd || sessionPath;
|
|
5297
5297
|
for (const line of lines) {
|
|
@@ -5402,14 +5402,14 @@ var require_sessionSearch = __commonJS({
|
|
|
5402
5402
|
}();
|
|
5403
5403
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5404
5404
|
exports.searchSessions = searchSessions;
|
|
5405
|
-
var
|
|
5406
|
-
var
|
|
5405
|
+
var fs6 = __importStar(__require("fs"));
|
|
5406
|
+
var path6 = __importStar(__require("path"));
|
|
5407
5407
|
async function searchSessions(provider, query, opts) {
|
|
5408
5408
|
const maxResults = opts?.maxResults ?? 50;
|
|
5409
5409
|
const results = [];
|
|
5410
5410
|
const baseDir = provider.getProjectsBaseDir();
|
|
5411
5411
|
try {
|
|
5412
|
-
if (!
|
|
5412
|
+
if (!fs6.existsSync(baseDir))
|
|
5413
5413
|
return results;
|
|
5414
5414
|
const folders = provider.getAllProjectFolders();
|
|
5415
5415
|
for (const folder of folders) {
|
|
@@ -5420,9 +5420,9 @@ var require_sessionSearch = __commonJS({
|
|
|
5420
5420
|
let sessionFiles = [];
|
|
5421
5421
|
try {
|
|
5422
5422
|
const dir = folder.dir;
|
|
5423
|
-
if (
|
|
5424
|
-
const entries =
|
|
5425
|
-
sessionFiles = entries.map((f) =>
|
|
5423
|
+
if (fs6.existsSync(dir)) {
|
|
5424
|
+
const entries = fs6.readdirSync(dir).filter((f) => f.endsWith(".jsonl") || f.endsWith(".json"));
|
|
5425
|
+
sessionFiles = entries.map((f) => path6.join(dir, f));
|
|
5426
5426
|
}
|
|
5427
5427
|
} catch {
|
|
5428
5428
|
}
|
|
@@ -5566,7 +5566,7 @@ var require_jsonlWatcher = __commonJS({
|
|
|
5566
5566
|
}();
|
|
5567
5567
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5568
5568
|
exports.JsonlSessionWatcher = void 0;
|
|
5569
|
-
var
|
|
5569
|
+
var fs6 = __importStar(__require("fs"));
|
|
5570
5570
|
var jsonl_1 = require_jsonl();
|
|
5571
5571
|
var DEBOUNCE_MS = 100;
|
|
5572
5572
|
var CATCHUP_INTERVAL_MS = 3e4;
|
|
@@ -5870,14 +5870,14 @@ var require_jsonlWatcher = __commonJS({
|
|
|
5870
5870
|
this.readNewBytes();
|
|
5871
5871
|
} else {
|
|
5872
5872
|
try {
|
|
5873
|
-
const stat =
|
|
5873
|
+
const stat = fs6.statSync(this.sessionPath);
|
|
5874
5874
|
this.filePosition = stat.size;
|
|
5875
5875
|
} catch {
|
|
5876
5876
|
this.filePosition = 0;
|
|
5877
5877
|
}
|
|
5878
5878
|
}
|
|
5879
5879
|
try {
|
|
5880
|
-
this.fsWatcher =
|
|
5880
|
+
this.fsWatcher = fs6.watch(this.sessionPath, { persistent: false }, () => {
|
|
5881
5881
|
this.debouncedRead();
|
|
5882
5882
|
});
|
|
5883
5883
|
this.fsWatcher.on("error", () => {
|
|
@@ -5920,18 +5920,18 @@ var require_jsonlWatcher = __commonJS({
|
|
|
5920
5920
|
return;
|
|
5921
5921
|
let fd = null;
|
|
5922
5922
|
try {
|
|
5923
|
-
const stat =
|
|
5923
|
+
const stat = fs6.statSync(this.sessionPath);
|
|
5924
5924
|
if (stat.size < this.filePosition) {
|
|
5925
5925
|
this.filePosition = 0;
|
|
5926
5926
|
this.parser.reset();
|
|
5927
5927
|
}
|
|
5928
5928
|
if (stat.size <= this.filePosition)
|
|
5929
5929
|
return;
|
|
5930
|
-
fd =
|
|
5930
|
+
fd = fs6.openSync(this.sessionPath, "r");
|
|
5931
5931
|
const bytesToRead = stat.size - this.filePosition;
|
|
5932
5932
|
const buffer = Buffer.alloc(bytesToRead);
|
|
5933
|
-
const bytesRead =
|
|
5934
|
-
|
|
5933
|
+
const bytesRead = fs6.readSync(fd, buffer, 0, bytesToRead, this.filePosition);
|
|
5934
|
+
fs6.closeSync(fd);
|
|
5935
5935
|
fd = null;
|
|
5936
5936
|
if (bytesRead > 0) {
|
|
5937
5937
|
this.filePosition += bytesRead;
|
|
@@ -5941,7 +5941,7 @@ var require_jsonlWatcher = __commonJS({
|
|
|
5941
5941
|
} catch (err) {
|
|
5942
5942
|
if (fd !== null) {
|
|
5943
5943
|
try {
|
|
5944
|
-
|
|
5944
|
+
fs6.closeSync(fd);
|
|
5945
5945
|
} catch {
|
|
5946
5946
|
}
|
|
5947
5947
|
}
|
|
@@ -6002,8 +6002,8 @@ var require_sqliteWatcher = __commonJS({
|
|
|
6002
6002
|
}();
|
|
6003
6003
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6004
6004
|
exports.SqliteSessionWatcher = void 0;
|
|
6005
|
-
var
|
|
6006
|
-
var
|
|
6005
|
+
var fs6 = __importStar(__require("fs"));
|
|
6006
|
+
var path6 = __importStar(__require("path"));
|
|
6007
6007
|
var openCodeDatabase_1 = require_openCodeDatabase();
|
|
6008
6008
|
var DEBOUNCE_MS = 200;
|
|
6009
6009
|
var POLL_INTERVAL_MS = 2e3;
|
|
@@ -6111,7 +6111,7 @@ var require_sqliteWatcher = __commonJS({
|
|
|
6111
6111
|
this.dbPath = dbPath;
|
|
6112
6112
|
this.sessionId = sessionId;
|
|
6113
6113
|
this.callbacks = callbacks;
|
|
6114
|
-
this.db = new openCodeDatabase_1.OpenCodeDatabase(
|
|
6114
|
+
this.db = new openCodeDatabase_1.OpenCodeDatabase(path6.dirname(dbPath));
|
|
6115
6115
|
}
|
|
6116
6116
|
get isActive() {
|
|
6117
6117
|
return this._isActive;
|
|
@@ -6165,9 +6165,9 @@ var require_sqliteWatcher = __commonJS({
|
|
|
6165
6165
|
}
|
|
6166
6166
|
watchFile(filePath, setter) {
|
|
6167
6167
|
try {
|
|
6168
|
-
if (!
|
|
6168
|
+
if (!fs6.existsSync(filePath))
|
|
6169
6169
|
return;
|
|
6170
|
-
const watcher =
|
|
6170
|
+
const watcher = fs6.watch(filePath, { persistent: false }, () => {
|
|
6171
6171
|
this.debouncedPoll();
|
|
6172
6172
|
});
|
|
6173
6173
|
watcher.on("error", () => {
|
|
@@ -6268,14 +6268,14 @@ var require_factory = __commonJS({
|
|
|
6268
6268
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6269
6269
|
exports.createWatcher = createWatcher2;
|
|
6270
6270
|
var os4 = __importStar(__require("os"));
|
|
6271
|
-
var
|
|
6271
|
+
var path6 = __importStar(__require("path"));
|
|
6272
6272
|
var jsonlWatcher_1 = require_jsonlWatcher();
|
|
6273
6273
|
var sqliteWatcher_1 = require_sqliteWatcher();
|
|
6274
6274
|
function getOpenCodeDataDir() {
|
|
6275
6275
|
const xdg = process.env.XDG_DATA_HOME;
|
|
6276
6276
|
if (xdg)
|
|
6277
|
-
return
|
|
6278
|
-
return
|
|
6277
|
+
return path6.join(xdg, "opencode");
|
|
6278
|
+
return path6.join(os4.homedir(), ".local", "share", "opencode");
|
|
6279
6279
|
}
|
|
6280
6280
|
function createWatcher2(options) {
|
|
6281
6281
|
const { provider, workspacePath, sessionId, callbacks } = options;
|
|
@@ -6287,7 +6287,7 @@ var require_factory = __commonJS({
|
|
|
6287
6287
|
if (sessionId) {
|
|
6288
6288
|
const match = sessions.find((s) => s.includes(sessionId));
|
|
6289
6289
|
if (!match) {
|
|
6290
|
-
throw new Error(`Session ${sessionId} not found. Available: ${sessions.slice(0, 5).map((s) =>
|
|
6290
|
+
throw new Error(`Session ${sessionId} not found. Available: ${sessions.slice(0, 5).map((s) => path6.basename(s)).join(", ")}`);
|
|
6291
6291
|
}
|
|
6292
6292
|
sessionPath = match;
|
|
6293
6293
|
} else {
|
|
@@ -6303,8 +6303,8 @@ var require_factory = __commonJS({
|
|
|
6303
6303
|
return new jsonlWatcher_1.JsonlSessionWatcher(providerId, sessionPath, callbacks);
|
|
6304
6304
|
case "opencode": {
|
|
6305
6305
|
const dataDir = getOpenCodeDataDir();
|
|
6306
|
-
const dbPath =
|
|
6307
|
-
const sid =
|
|
6306
|
+
const dbPath = path6.join(dataDir, "opencode.db");
|
|
6307
|
+
const sid = path6.basename(sessionPath, ".json");
|
|
6308
6308
|
return new sqliteWatcher_1.SqliteSessionWatcher(dbPath, sid, callbacks);
|
|
6309
6309
|
}
|
|
6310
6310
|
default:
|
|
@@ -7968,6 +7968,8 @@ var init_DashboardState = __esm({
|
|
|
7968
7968
|
};
|
|
7969
7969
|
// Quota
|
|
7970
7970
|
_quota = null;
|
|
7971
|
+
// Update availability
|
|
7972
|
+
_updateInfo = null;
|
|
7971
7973
|
// Compaction tracking
|
|
7972
7974
|
_compactionCount = 0;
|
|
7973
7975
|
_compactionEvents = [];
|
|
@@ -8014,6 +8016,7 @@ var init_DashboardState = __esm({
|
|
|
8014
8016
|
other: 0
|
|
8015
8017
|
};
|
|
8016
8018
|
this._quota = null;
|
|
8019
|
+
this._updateInfo = null;
|
|
8017
8020
|
this._compactionCount = 0;
|
|
8018
8021
|
this._compactionEvents = [];
|
|
8019
8022
|
this._previousContextSize = 0;
|
|
@@ -8097,6 +8100,10 @@ var init_DashboardState = __esm({
|
|
|
8097
8100
|
setQuota(quota) {
|
|
8098
8101
|
this._quota = quota;
|
|
8099
8102
|
}
|
|
8103
|
+
/** Set update availability info from UpdateCheckService. */
|
|
8104
|
+
setUpdateInfo(info) {
|
|
8105
|
+
this._updateInfo = info;
|
|
8106
|
+
}
|
|
8100
8107
|
/** Get the current snapshot of all metrics. */
|
|
8101
8108
|
getMetrics() {
|
|
8102
8109
|
this.detectParallelSubagents();
|
|
@@ -8125,7 +8132,8 @@ var init_DashboardState = __esm({
|
|
|
8125
8132
|
commands: Array.from(this._cmdMap.values()).sort((a, b) => b.count - a.count),
|
|
8126
8133
|
todos: [...this._todos],
|
|
8127
8134
|
plan: this._plan,
|
|
8128
|
-
contextAttribution: { ...this._contextAttribution }
|
|
8135
|
+
contextAttribution: { ...this._contextAttribution },
|
|
8136
|
+
updateInfo: this._updateInfo
|
|
8129
8137
|
};
|
|
8130
8138
|
}
|
|
8131
8139
|
// ── Private helpers ──
|
|
@@ -8732,6 +8740,95 @@ var init_QuotaService = __esm({
|
|
|
8732
8740
|
}
|
|
8733
8741
|
});
|
|
8734
8742
|
|
|
8743
|
+
// src/dashboard/UpdateCheckService.ts
|
|
8744
|
+
import * as fs2 from "fs";
|
|
8745
|
+
import * as path2 from "path";
|
|
8746
|
+
function isNewer(a, b) {
|
|
8747
|
+
const pa = a.split(".").map(Number);
|
|
8748
|
+
const pb = b.split(".").map(Number);
|
|
8749
|
+
for (let i = 0; i < 3; i++) {
|
|
8750
|
+
const va = pa[i] || 0;
|
|
8751
|
+
const vb = pb[i] || 0;
|
|
8752
|
+
if (va > vb) return true;
|
|
8753
|
+
if (va < vb) return false;
|
|
8754
|
+
}
|
|
8755
|
+
return false;
|
|
8756
|
+
}
|
|
8757
|
+
var import_sidekick_shared2, REGISTRY_URL, CACHE_FILE, CACHE_TTL_MS, UpdateCheckService;
|
|
8758
|
+
var init_UpdateCheckService = __esm({
|
|
8759
|
+
"src/dashboard/UpdateCheckService.ts"() {
|
|
8760
|
+
"use strict";
|
|
8761
|
+
import_sidekick_shared2 = __toESM(require_dist(), 1);
|
|
8762
|
+
REGISTRY_URL = "https://registry.npmjs.org/sidekick-agent-hub/latest";
|
|
8763
|
+
CACHE_FILE = "update-check.json";
|
|
8764
|
+
CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
8765
|
+
UpdateCheckService = class {
|
|
8766
|
+
_callback = null;
|
|
8767
|
+
/** Register a callback for the update check result. */
|
|
8768
|
+
onResult(cb) {
|
|
8769
|
+
this._callback = cb;
|
|
8770
|
+
}
|
|
8771
|
+
/** Run the update check (one-shot). */
|
|
8772
|
+
async check() {
|
|
8773
|
+
try {
|
|
8774
|
+
const current = "0.12.2";
|
|
8775
|
+
const cached = this.readCache();
|
|
8776
|
+
let latest;
|
|
8777
|
+
if (cached && Date.now() - cached.checkedAt < CACHE_TTL_MS) {
|
|
8778
|
+
latest = cached.latest;
|
|
8779
|
+
} else {
|
|
8780
|
+
latest = await this.fetchLatest();
|
|
8781
|
+
this.writeCache({ latest, checkedAt: Date.now() });
|
|
8782
|
+
}
|
|
8783
|
+
if (isNewer(latest, current)) {
|
|
8784
|
+
this._callback?.({ current, latest });
|
|
8785
|
+
} else {
|
|
8786
|
+
this._callback?.(null);
|
|
8787
|
+
}
|
|
8788
|
+
} catch {
|
|
8789
|
+
this._callback?.(null);
|
|
8790
|
+
}
|
|
8791
|
+
}
|
|
8792
|
+
async fetchLatest() {
|
|
8793
|
+
const res = await fetch(REGISTRY_URL, {
|
|
8794
|
+
headers: { "Accept": "application/json" },
|
|
8795
|
+
signal: AbortSignal.timeout(5e3)
|
|
8796
|
+
});
|
|
8797
|
+
if (!res.ok) throw new Error(`Registry returned ${res.status}`);
|
|
8798
|
+
const data = await res.json();
|
|
8799
|
+
return data.version;
|
|
8800
|
+
}
|
|
8801
|
+
readCache() {
|
|
8802
|
+
try {
|
|
8803
|
+
const cachePath = path2.join((0, import_sidekick_shared2.getConfigDir)(), CACHE_FILE);
|
|
8804
|
+
if (!fs2.existsSync(cachePath)) return null;
|
|
8805
|
+
const content = fs2.readFileSync(cachePath, "utf8");
|
|
8806
|
+
const parsed = JSON.parse(content);
|
|
8807
|
+
if (parsed.latest && typeof parsed.checkedAt === "number") {
|
|
8808
|
+
return parsed;
|
|
8809
|
+
}
|
|
8810
|
+
} catch {
|
|
8811
|
+
}
|
|
8812
|
+
return null;
|
|
8813
|
+
}
|
|
8814
|
+
writeCache(cache3) {
|
|
8815
|
+
try {
|
|
8816
|
+
const configDir = (0, import_sidekick_shared2.getConfigDir)();
|
|
8817
|
+
if (!fs2.existsSync(configDir)) {
|
|
8818
|
+
fs2.mkdirSync(configDir, { recursive: true });
|
|
8819
|
+
}
|
|
8820
|
+
fs2.writeFileSync(
|
|
8821
|
+
path2.join(configDir, CACHE_FILE),
|
|
8822
|
+
JSON.stringify(cache3),
|
|
8823
|
+
"utf8"
|
|
8824
|
+
);
|
|
8825
|
+
} catch {
|
|
8826
|
+
}
|
|
8827
|
+
}
|
|
8828
|
+
};
|
|
8829
|
+
}
|
|
8830
|
+
});
|
|
8831
|
+
|
|
8735
8832
|
// src/dashboard/formatters.ts
|
|
8736
8833
|
function shortenPath(p) {
|
|
8737
8834
|
const parts = p.replace(/\\/g, "/").split("/");
|
|
@@ -9335,12 +9432,12 @@ var init_MindMapBuilder = __esm({
|
|
|
9335
9432
|
|
|
9336
9433
|
// src/dashboard/GitDiffCache.ts
|
|
9337
9434
|
import { execSync } from "child_process";
|
|
9338
|
-
import * as
|
|
9339
|
-
var
|
|
9435
|
+
import * as path3 from "path";
|
|
9436
|
+
var CACHE_TTL_MS2, GitDiffCache;
|
|
9340
9437
|
var init_GitDiffCache = __esm({
|
|
9341
9438
|
"src/dashboard/GitDiffCache.ts"() {
|
|
9342
9439
|
"use strict";
|
|
9343
|
-
|
|
9440
|
+
CACHE_TTL_MS2 = 5e3;
|
|
9344
9441
|
GitDiffCache = class {
|
|
9345
9442
|
workspacePath;
|
|
9346
9443
|
cache = null;
|
|
@@ -9352,7 +9449,7 @@ var init_GitDiffCache = __esm({
|
|
|
9352
9449
|
}
|
|
9353
9450
|
getStats() {
|
|
9354
9451
|
const now = Date.now();
|
|
9355
|
-
if (this.cache && now - this.cacheTime <
|
|
9452
|
+
if (this.cache && now - this.cacheTime < CACHE_TTL_MS2) {
|
|
9356
9453
|
return this.cache;
|
|
9357
9454
|
}
|
|
9358
9455
|
this.cache = this.fetchStats();
|
|
@@ -9403,8 +9500,8 @@ var init_GitDiffCache = __esm({
|
|
|
9403
9500
|
toRelative(absolutePath) {
|
|
9404
9501
|
const root = this.getRepoRoot();
|
|
9405
9502
|
if (!root) return absolutePath;
|
|
9406
|
-
if (!
|
|
9407
|
-
const rel =
|
|
9503
|
+
if (!path3.isAbsolute(absolutePath)) return absolutePath;
|
|
9504
|
+
const rel = path3.relative(root, absolutePath);
|
|
9408
9505
|
if (rel.startsWith("..")) return absolutePath;
|
|
9409
9506
|
return rel;
|
|
9410
9507
|
}
|
|
@@ -13308,7 +13405,7 @@ var init_wrap_ansi = __esm({
|
|
|
13308
13405
|
// node_modules/terminal-size/index.js
|
|
13309
13406
|
import process3 from "node:process";
|
|
13310
13407
|
import { execFileSync } from "node:child_process";
|
|
13311
|
-
import
|
|
13408
|
+
import fs3 from "node:fs";
|
|
13312
13409
|
import tty from "node:tty";
|
|
13313
13410
|
function terminalSize() {
|
|
13314
13411
|
const { env: env3, stdout, stderr } = process3;
|
|
@@ -13364,7 +13461,7 @@ var init_terminal_size = __esm({
|
|
|
13364
13461
|
return true;
|
|
13365
13462
|
}
|
|
13366
13463
|
try {
|
|
13367
|
-
const statContents =
|
|
13464
|
+
const statContents = fs3.readFileSync("/proc/self/stat", "utf8");
|
|
13368
13465
|
const closingParenthesisIndex = statContents.lastIndexOf(") ");
|
|
13369
13466
|
if (closingParenthesisIndex === -1) {
|
|
13370
13467
|
return false;
|
|
@@ -13385,8 +13482,8 @@ var init_terminal_size = __esm({
|
|
|
13385
13482
|
};
|
|
13386
13483
|
devTty = () => {
|
|
13387
13484
|
try {
|
|
13388
|
-
const flags = process3.platform === "darwin" ?
|
|
13389
|
-
const { columns, rows } = tty.WriteStream(
|
|
13485
|
+
const flags = process3.platform === "darwin" ? fs3.constants.O_EVTONLY | fs3.constants.O_NONBLOCK : fs3.constants.O_NONBLOCK;
|
|
13486
|
+
const { columns, rows } = tty.WriteStream(fs3.openSync("/dev/tty", flags));
|
|
13390
13487
|
return { columns, rows };
|
|
13391
13488
|
} catch {
|
|
13392
13489
|
}
|
|
@@ -22158,10 +22255,10 @@ var require_react_reconciler_development = __commonJS({
|
|
|
22158
22255
|
fiber = fiber.next, id--;
|
|
22159
22256
|
return fiber;
|
|
22160
22257
|
}
|
|
22161
|
-
function copyWithSetImpl(obj,
|
|
22162
|
-
if (index >=
|
|
22163
|
-
var key =
|
|
22164
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
22258
|
+
function copyWithSetImpl(obj, path6, index, value) {
|
|
22259
|
+
if (index >= path6.length) return value;
|
|
22260
|
+
var key = path6[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
|
|
22261
|
+
updated[key] = copyWithSetImpl(obj[key], path6, index + 1, value);
|
|
22165
22262
|
return updated;
|
|
22166
22263
|
}
|
|
22167
22264
|
function copyWithRename(obj, oldPath, newPath) {
|
|
@@ -22188,11 +22285,11 @@ var require_react_reconciler_development = __commonJS({
|
|
|
22188
22285
|
);
|
|
22189
22286
|
return updated;
|
|
22190
22287
|
}
|
|
22191
|
-
function copyWithDeleteImpl(obj,
|
|
22192
|
-
var key =
|
|
22193
|
-
if (index + 1 ===
|
|
22288
|
+
function copyWithDeleteImpl(obj, path6, index) {
|
|
22289
|
+
var key = path6[index], updated = isArrayImpl(obj) ? obj.slice() : assign({}, obj);
|
|
22290
|
+
if (index + 1 === path6.length)
|
|
22194
22291
|
return isArrayImpl(updated) ? updated.splice(key, 1) : delete updated[key], updated;
|
|
22195
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
22292
|
+
updated[key] = copyWithDeleteImpl(obj[key], path6, index + 1);
|
|
22196
22293
|
return updated;
|
|
22197
22294
|
}
|
|
22198
22295
|
function shouldSuspendImpl() {
|
|
@@ -35469,29 +35566,29 @@ var require_react_reconciler_development = __commonJS({
|
|
|
35469
35566
|
var didWarnAboutNestedUpdates = false;
|
|
35470
35567
|
var didWarnAboutFindNodeInStrictMode = {};
|
|
35471
35568
|
var overrideHookState = null, overrideHookStateDeletePath = null, overrideHookStateRenamePath = null, overrideProps = null, overridePropsDeletePath = null, overridePropsRenamePath = null, scheduleUpdate = null, scheduleRetry = null, setErrorHandler = null, setSuspenseHandler = null;
|
|
35472
|
-
overrideHookState = function(fiber, id,
|
|
35569
|
+
overrideHookState = function(fiber, id, path6, value) {
|
|
35473
35570
|
id = findHook(fiber, id);
|
|
35474
|
-
null !== id && (
|
|
35571
|
+
null !== id && (path6 = copyWithSetImpl(id.memoizedState, path6, 0, value), id.memoizedState = path6, id.baseState = path6, fiber.memoizedProps = assign({}, fiber.memoizedProps), path6 = enqueueConcurrentRenderForLane(fiber, 2), null !== path6 && scheduleUpdateOnFiber(path6, fiber, 2));
|
|
35475
35572
|
};
|
|
35476
|
-
overrideHookStateDeletePath = function(fiber, id,
|
|
35573
|
+
overrideHookStateDeletePath = function(fiber, id, path6) {
|
|
35477
35574
|
id = findHook(fiber, id);
|
|
35478
|
-
null !== id && (
|
|
35575
|
+
null !== id && (path6 = copyWithDeleteImpl(id.memoizedState, path6, 0), id.memoizedState = path6, id.baseState = path6, fiber.memoizedProps = assign({}, fiber.memoizedProps), path6 = enqueueConcurrentRenderForLane(fiber, 2), null !== path6 && scheduleUpdateOnFiber(path6, fiber, 2));
|
|
35479
35576
|
};
|
|
35480
35577
|
overrideHookStateRenamePath = function(fiber, id, oldPath, newPath) {
|
|
35481
35578
|
id = findHook(fiber, id);
|
|
35482
35579
|
null !== id && (oldPath = copyWithRename(id.memoizedState, oldPath, newPath), id.memoizedState = oldPath, id.baseState = oldPath, fiber.memoizedProps = assign({}, fiber.memoizedProps), oldPath = enqueueConcurrentRenderForLane(fiber, 2), null !== oldPath && scheduleUpdateOnFiber(oldPath, fiber, 2));
|
|
35483
35580
|
};
|
|
35484
|
-
overrideProps = function(fiber,
|
|
35485
|
-
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps,
|
|
35581
|
+
overrideProps = function(fiber, path6, value) {
|
|
35582
|
+
fiber.pendingProps = copyWithSetImpl(fiber.memoizedProps, path6, 0, value);
|
|
35486
35583
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
35487
|
-
|
|
35488
|
-
null !==
|
|
35584
|
+
path6 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
35585
|
+
null !== path6 && scheduleUpdateOnFiber(path6, fiber, 2);
|
|
35489
35586
|
};
|
|
35490
|
-
overridePropsDeletePath = function(fiber,
|
|
35491
|
-
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps,
|
|
35587
|
+
overridePropsDeletePath = function(fiber, path6) {
|
|
35588
|
+
fiber.pendingProps = copyWithDeleteImpl(fiber.memoizedProps, path6, 0);
|
|
35492
35589
|
fiber.alternate && (fiber.alternate.pendingProps = fiber.pendingProps);
|
|
35493
|
-
|
|
35494
|
-
null !==
|
|
35590
|
+
path6 = enqueueConcurrentRenderForLane(fiber, 2);
|
|
35591
|
+
null !== path6 && scheduleUpdateOnFiber(path6, fiber, 2);
|
|
35495
35592
|
};
|
|
35496
35593
|
overridePropsRenamePath = function(fiber, oldPath, newPath) {
|
|
35497
35594
|
fiber.pendingProps = copyWithRename(
|
|
@@ -41133,8 +41230,8 @@ var init_devtools = __esm({
|
|
|
41133
41230
|
|
|
41134
41231
|
// node_modules/ink/build/reconciler.js
|
|
41135
41232
|
async function loadPackageJson() {
|
|
41136
|
-
const
|
|
41137
|
-
const content =
|
|
41233
|
+
const fs6 = await import("node:fs");
|
|
41234
|
+
const content = fs6.readFileSync(new URL("../package.json", import.meta.url), "utf8");
|
|
41138
41235
|
return JSON.parse(content);
|
|
41139
41236
|
}
|
|
41140
41237
|
var import_react_reconciler, import_constants, Scheduler, import_react, diff, cleanupYogaNode, currentUpdatePriority, currentRootNode, packageJson, reconciler_default;
|
|
@@ -45298,7 +45395,7 @@ var init_Text = __esm({
|
|
|
45298
45395
|
});
|
|
45299
45396
|
|
|
45300
45397
|
// node_modules/ink/build/components/ErrorOverview.js
|
|
45301
|
-
import * as
|
|
45398
|
+
import * as fs4 from "node:fs";
|
|
45302
45399
|
import { cwd } from "node:process";
|
|
45303
45400
|
function ErrorOverview({ error }) {
|
|
45304
45401
|
const stack = error.stack ? error.stack.split("\n").slice(1) : void 0;
|
|
@@ -45306,8 +45403,8 @@ function ErrorOverview({ error }) {
|
|
|
45306
45403
|
const filePath = cleanupPath(origin?.file);
|
|
45307
45404
|
let excerpt;
|
|
45308
45405
|
let lineWidth = 0;
|
|
45309
|
-
if (filePath && origin?.line &&
|
|
45310
|
-
const sourceCode =
|
|
45406
|
+
if (filePath && origin?.line && fs4.existsSync(filePath)) {
|
|
45407
|
+
const sourceCode = fs4.readFileSync(filePath, "utf8");
|
|
45311
45408
|
excerpt = dist_default3(sourceCode, origin.line);
|
|
45312
45409
|
if (excerpt) {
|
|
45313
45410
|
for (const { line } of excerpt) {
|
|
@@ -45408,8 +45505,8 @@ var init_ErrorOverview = __esm({
|
|
|
45408
45505
|
init_dist3();
|
|
45409
45506
|
init_Box();
|
|
45410
45507
|
init_Text();
|
|
45411
|
-
cleanupPath = (
|
|
45412
|
-
return
|
|
45508
|
+
cleanupPath = (path6) => {
|
|
45509
|
+
return path6?.replace(`file://${cwd()}/`, "");
|
|
45413
45510
|
};
|
|
45414
45511
|
stackUtils = new import_stack_utils.default({
|
|
45415
45512
|
cwd: cwd(),
|
|
@@ -47313,8 +47410,8 @@ var init_build2 = __esm({
|
|
|
47313
47410
|
});
|
|
47314
47411
|
|
|
47315
47412
|
// src/dashboard/SessionPickerHelpers.ts
|
|
47316
|
-
import * as
|
|
47317
|
-
import * as
|
|
47413
|
+
import * as fs5 from "fs";
|
|
47414
|
+
import * as path4 from "path";
|
|
47318
47415
|
function formatRelativeTime(mtime, now = /* @__PURE__ */ new Date()) {
|
|
47319
47416
|
const diffMs = now.getTime() - mtime.getTime();
|
|
47320
47417
|
if (diffMs < 0) return "just now";
|
|
@@ -47333,13 +47430,13 @@ function collectSessionItems(sessionPaths, provider, now = /* @__PURE__ */ new D
|
|
|
47333
47430
|
for (const sp of paths) {
|
|
47334
47431
|
let mtime;
|
|
47335
47432
|
try {
|
|
47336
|
-
mtime =
|
|
47433
|
+
mtime = fs5.statSync(sp).mtime;
|
|
47337
47434
|
} catch {
|
|
47338
47435
|
continue;
|
|
47339
47436
|
}
|
|
47340
47437
|
const rawLabel = provider.extractSessionLabel(sp);
|
|
47341
47438
|
const label = rawLabel || "Untitled session";
|
|
47342
|
-
const basename3 =
|
|
47439
|
+
const basename3 = path4.basename(sp, path4.extname(sp));
|
|
47343
47440
|
const sessionId = basename3.length > 8 ? basename3.substring(0, 8) : basename3;
|
|
47344
47441
|
const age = formatRelativeTime(mtime, now);
|
|
47345
47442
|
const isActive = now.getTime() - mtime.getTime() < ACTIVE_THRESHOLD_MS;
|
|
@@ -47354,13 +47451,13 @@ function collectMultiProviderItems(providers, now = /* @__PURE__ */ new Date())
|
|
|
47354
47451
|
for (const sp of paths) {
|
|
47355
47452
|
let mtime;
|
|
47356
47453
|
try {
|
|
47357
|
-
mtime =
|
|
47454
|
+
mtime = fs5.statSync(sp).mtime;
|
|
47358
47455
|
} catch {
|
|
47359
47456
|
continue;
|
|
47360
47457
|
}
|
|
47361
47458
|
const rawLabel = provider.extractSessionLabel(sp);
|
|
47362
47459
|
const label = rawLabel || "Untitled session";
|
|
47363
|
-
const basename3 =
|
|
47460
|
+
const basename3 = path4.basename(sp, path4.extname(sp));
|
|
47364
47461
|
const sessionId = basename3.length > 8 ? basename3.substring(0, 8) : basename3;
|
|
47365
47462
|
const age = formatRelativeTime(mtime, now);
|
|
47366
47463
|
const isActive = now.getTime() - mtime.getTime() < ACTIVE_THRESHOLD_MS;
|
|
@@ -49510,14 +49607,20 @@ function StatusBar({
|
|
|
49510
49607
|
sessionFilter,
|
|
49511
49608
|
filterString,
|
|
49512
49609
|
matchCount,
|
|
49513
|
-
totalCount
|
|
49610
|
+
totalCount,
|
|
49611
|
+
updateInfo
|
|
49514
49612
|
}) {
|
|
49515
49613
|
const evtLabel = eventCount > 0 ? `${eventCount} events` : "waiting...";
|
|
49516
49614
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { height: 1, width: "100%", children: [
|
|
49517
49615
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { bold: true, color: "magenta", children: "\u26A1 SIDEKICK" }),
|
|
49518
49616
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "gray", children: [
|
|
49519
49617
|
" v",
|
|
49520
|
-
"0.12.
|
|
49618
|
+
"0.12.2"
|
|
49619
|
+
] }),
|
|
49620
|
+
updateInfo && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "yellow", children: [
|
|
49621
|
+
" (v",
|
|
49622
|
+
updateInfo.latest,
|
|
49623
|
+
" available \u2014 npm i -g sidekick-agent-hub)"
|
|
49521
49624
|
] }),
|
|
49522
49625
|
providerName && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
49523
49626
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "gray", children: " | " }),
|
|
@@ -49647,7 +49750,7 @@ function SplashOverlay() {
|
|
|
49647
49750
|
" ",
|
|
49648
49751
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { color: "gray", children: [
|
|
49649
49752
|
"Terminal Dashboard v",
|
|
49650
|
-
"0.12.
|
|
49753
|
+
"0.12.2"
|
|
49651
49754
|
] })
|
|
49652
49755
|
] }),
|
|
49653
49756
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { children: [
|
|
@@ -50734,7 +50837,8 @@ function Dashboard({ panels, metrics, staticData, isPinned, pendingSessionPath,
|
|
|
50734
50837
|
sessionFilter: state.sessionFilter?.label ?? null,
|
|
50735
50838
|
filterString: state.filterString,
|
|
50736
50839
|
matchCount: currentItems.length,
|
|
50737
|
-
totalCount: panel.getItems(metrics, staticData).length
|
|
50840
|
+
totalCount: panel.getItems(metrics, staticData).length,
|
|
50841
|
+
updateInfo: metrics.updateInfo
|
|
50738
50842
|
}
|
|
50739
50843
|
),
|
|
50740
50844
|
state.overlay === "help" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(HelpOverlay, { panels, activePanelIndex: state.activePanelIndex }),
|
|
@@ -50846,16 +50950,16 @@ var dashboard_exports = {};
|
|
|
50846
50950
|
__export(dashboard_exports, {
|
|
50847
50951
|
dashboardAction: () => dashboardAction
|
|
50848
50952
|
});
|
|
50849
|
-
import * as
|
|
50953
|
+
import * as path5 from "path";
|
|
50850
50954
|
function createProviderById(id) {
|
|
50851
50955
|
switch (id) {
|
|
50852
50956
|
case "opencode":
|
|
50853
|
-
return new
|
|
50957
|
+
return new import_sidekick_shared4.OpenCodeProvider();
|
|
50854
50958
|
case "codex":
|
|
50855
|
-
return new
|
|
50959
|
+
return new import_sidekick_shared4.CodexProvider();
|
|
50856
50960
|
case "claude-code":
|
|
50857
50961
|
default:
|
|
50858
|
-
return new
|
|
50962
|
+
return new import_sidekick_shared4.ClaudeCodeProvider();
|
|
50859
50963
|
}
|
|
50860
50964
|
}
|
|
50861
50965
|
async function dashboardAction(_opts, cmd) {
|
|
@@ -50866,7 +50970,7 @@ async function dashboardAction(_opts, cmd) {
|
|
|
50866
50970
|
let sessionId = opts.session;
|
|
50867
50971
|
let replay = !!opts.replay;
|
|
50868
50972
|
let activeProvider = provider;
|
|
50869
|
-
const detectedIds = (0,
|
|
50973
|
+
const detectedIds = (0, import_sidekick_shared3.getAllDetectedProviders)();
|
|
50870
50974
|
const additionalProviders = detectedIds.filter((id) => id !== provider.id).map((id) => createProviderById(id));
|
|
50871
50975
|
if (!sessionId) {
|
|
50872
50976
|
const sessions = provider.findAllSessions(workspacePath);
|
|
@@ -50875,7 +50979,7 @@ async function dashboardAction(_opts, cmd) {
|
|
|
50875
50979
|
try {
|
|
50876
50980
|
const result = await showSessionPicker(provider, workspacePath, additionalProviders);
|
|
50877
50981
|
if (result.sessionPath) {
|
|
50878
|
-
sessionId =
|
|
50982
|
+
sessionId = path5.basename(result.sessionPath, path5.extname(result.sessionPath));
|
|
50879
50983
|
replay = true;
|
|
50880
50984
|
if (result.providerId && result.providerId !== provider.id) {
|
|
50881
50985
|
activeProvider = createProviderById(result.providerId);
|
|
@@ -50915,6 +51019,13 @@ async function dashboardAction(_opts, cmd) {
|
|
|
50915
51019
|
];
|
|
50916
51020
|
sessionsPanel.onNarrativeComplete = () => scheduleRender();
|
|
50917
51021
|
const quotaService = new QuotaService();
|
|
51022
|
+
const updateCheckService = new UpdateCheckService();
|
|
51023
|
+
updateCheckService.onResult((info) => {
|
|
51024
|
+
if (info) {
|
|
51025
|
+
state.setUpdateInfo(info);
|
|
51026
|
+
scheduleRender();
|
|
51027
|
+
}
|
|
51028
|
+
});
|
|
50918
51029
|
let lastNotifiedSessionPath = null;
|
|
50919
51030
|
const currentSessions = activeProvider.findAllSessions(workspacePath);
|
|
50920
51031
|
lastNotifiedSessionPath = currentSessions.length > 0 ? currentSessions[0] : null;
|
|
@@ -50927,9 +51038,9 @@ async function dashboardAction(_opts, cmd) {
|
|
|
50927
51038
|
}
|
|
50928
51039
|
state.reset();
|
|
50929
51040
|
pendingSessionPath = null;
|
|
50930
|
-
const newSessionId =
|
|
51041
|
+
const newSessionId = path5.basename(newSessionPath, path5.extname(newSessionPath));
|
|
50931
51042
|
try {
|
|
50932
|
-
const result = (0,
|
|
51043
|
+
const result = (0, import_sidekick_shared3.createWatcher)({
|
|
50933
51044
|
provider: activeProvider,
|
|
50934
51045
|
workspacePath,
|
|
50935
51046
|
sessionId: newSessionId,
|
|
@@ -51036,7 +51147,7 @@ async function dashboardAction(_opts, cmd) {
|
|
|
51036
51147
|
process.on("SIGTERM", cleanup);
|
|
51037
51148
|
let watcher = null;
|
|
51038
51149
|
try {
|
|
51039
|
-
const result = (0,
|
|
51150
|
+
const result = (0, import_sidekick_shared3.createWatcher)({
|
|
51040
51151
|
provider: activeProvider,
|
|
51041
51152
|
workspacePath,
|
|
51042
51153
|
sessionId,
|
|
@@ -51054,6 +51165,7 @@ async function dashboardAction(_opts, cmd) {
|
|
|
51054
51165
|
} catch {
|
|
51055
51166
|
}
|
|
51056
51167
|
quotaService.start();
|
|
51168
|
+
updateCheckService.check();
|
|
51057
51169
|
scheduleRender();
|
|
51058
51170
|
if (watcher) {
|
|
51059
51171
|
watcher.start(replay);
|
|
@@ -51062,17 +51174,18 @@ async function dashboardAction(_opts, cmd) {
|
|
|
51062
51174
|
cleanup();
|
|
51063
51175
|
process.exit(0);
|
|
51064
51176
|
}
|
|
51065
|
-
var import_react35,
|
|
51177
|
+
var import_react35, import_sidekick_shared3, import_sidekick_shared4;
|
|
51066
51178
|
var init_dashboard = __esm({
|
|
51067
51179
|
async "src/commands/dashboard.ts"() {
|
|
51068
51180
|
"use strict";
|
|
51069
51181
|
import_react35 = __toESM(require_react(), 1);
|
|
51070
|
-
import_sidekick_shared2 = __toESM(require_dist(), 1);
|
|
51071
51182
|
import_sidekick_shared3 = __toESM(require_dist(), 1);
|
|
51183
|
+
import_sidekick_shared4 = __toESM(require_dist(), 1);
|
|
51072
51184
|
init_cli();
|
|
51073
51185
|
init_DashboardState();
|
|
51074
51186
|
init_StaticDataLoader();
|
|
51075
51187
|
init_QuotaService();
|
|
51188
|
+
init_UpdateCheckService();
|
|
51076
51189
|
init_SessionsPanel();
|
|
51077
51190
|
init_TasksPanel();
|
|
51078
51191
|
init_KanbanPanel();
|
|
@@ -51087,25 +51200,25 @@ var init_dashboard = __esm({
|
|
|
51087
51200
|
// src/cli.ts
|
|
51088
51201
|
function resolveProvider(opts) {
|
|
51089
51202
|
const override = opts.provider && opts.provider !== "auto" ? opts.provider : void 0;
|
|
51090
|
-
const id = override || (0,
|
|
51203
|
+
const id = override || (0, import_sidekick_shared5.detectProvider)(override);
|
|
51091
51204
|
switch (id) {
|
|
51092
51205
|
case "opencode":
|
|
51093
|
-
return new
|
|
51206
|
+
return new import_sidekick_shared6.OpenCodeProvider();
|
|
51094
51207
|
case "codex":
|
|
51095
|
-
return new
|
|
51208
|
+
return new import_sidekick_shared6.CodexProvider();
|
|
51096
51209
|
case "claude-code":
|
|
51097
51210
|
default:
|
|
51098
|
-
return new
|
|
51211
|
+
return new import_sidekick_shared6.ClaudeCodeProvider();
|
|
51099
51212
|
}
|
|
51100
51213
|
}
|
|
51101
|
-
var
|
|
51214
|
+
var import_sidekick_shared5, import_sidekick_shared6, program2, dashCmd;
|
|
51102
51215
|
var init_cli = __esm({
|
|
51103
51216
|
"src/cli.ts"() {
|
|
51104
51217
|
init_esm();
|
|
51105
|
-
import_sidekick_shared4 = __toESM(require_dist(), 1);
|
|
51106
51218
|
import_sidekick_shared5 = __toESM(require_dist(), 1);
|
|
51219
|
+
import_sidekick_shared6 = __toESM(require_dist(), 1);
|
|
51107
51220
|
program2 = new Command();
|
|
51108
|
-
program2.name("sidekick").description("Query Sidekick project intelligence from the command line").version("0.12.
|
|
51221
|
+
program2.name("sidekick").description("Query Sidekick project intelligence from the command line").version("0.12.2").option("--json", "Output as JSON").option("--project <path>", "Override project path (default: cwd)").option("--provider <id>", "Provider: claude-code, opencode, codex, auto (default: auto)");
|
|
51109
51222
|
dashCmd = new Command("dashboard").description("Full-screen TUI dashboard with live session metrics").option("--session <id>", "Follow a specific session (default: most recent)").option("--replay", "Replay existing events before streaming new ones").action(async (_opts, cmd) => {
|
|
51110
51223
|
const { dashboardAction: dashboardAction2 } = await init_dashboard().then(() => dashboard_exports);
|
|
51111
51224
|
return dashboardAction2(_opts, cmd);
|