olakai-cli 0.9.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-B44Y3ZQP.js → chunk-KSWV3C7D.js} +2 -2
- package/dist/{chunk-E33XD5CO.js → chunk-ULJXILXR.js} +212 -77
- package/dist/chunk-ULJXILXR.js.map +1 -0
- package/dist/{doctor-TIVMQBE3.js → doctor-7Q7SPMVD.js} +3 -3
- package/dist/index.js +208 -20
- package/dist/index.js.map +1 -1
- package/dist/{repair-JYRH2ES4.js → repair-NIKAW7NS.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-E33XD5CO.js.map +0 -1
- /package/dist/{chunk-B44Y3ZQP.js.map → chunk-KSWV3C7D.js.map} +0 -0
- /package/dist/{doctor-TIVMQBE3.js.map → doctor-7Q7SPMVD.js.map} +0 -0
- /package/dist/{repair-JYRH2ES4.js.map → repair-NIKAW7NS.js.map} +0 -0
|
@@ -372,10 +372,11 @@ function shouldReportTurn(existing, currentUserTimestamp) {
|
|
|
372
372
|
import * as fs3 from "fs";
|
|
373
373
|
|
|
374
374
|
// src/monitor/self-monitor-provision.ts
|
|
375
|
-
import
|
|
375
|
+
import path4 from "path";
|
|
376
376
|
|
|
377
377
|
// src/lib/git.ts
|
|
378
378
|
import { spawnSync } from "child_process";
|
|
379
|
+
import * as path3 from "path";
|
|
379
380
|
function getGitConfigEmail() {
|
|
380
381
|
let result;
|
|
381
382
|
try {
|
|
@@ -402,6 +403,86 @@ function getGitConfigEmail() {
|
|
|
402
403
|
if (raw.length > 320) return null;
|
|
403
404
|
return raw;
|
|
404
405
|
}
|
|
406
|
+
var MAX_PROBED_DIRECTORIES = 64;
|
|
407
|
+
var GIT_CALL_TIMEOUT_MS = 2e3;
|
|
408
|
+
var GIT_CALL_MAX_BUFFER = 65536;
|
|
409
|
+
function sanitizeRemoteUrl(url) {
|
|
410
|
+
return url.trim().replace(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)[^/]*@/, "$1");
|
|
411
|
+
}
|
|
412
|
+
function runGit(args) {
|
|
413
|
+
let result;
|
|
414
|
+
try {
|
|
415
|
+
result = spawnSync("git", args, {
|
|
416
|
+
encoding: "utf8",
|
|
417
|
+
maxBuffer: GIT_CALL_MAX_BUFFER,
|
|
418
|
+
timeout: GIT_CALL_TIMEOUT_MS,
|
|
419
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
420
|
+
});
|
|
421
|
+
} catch {
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
424
|
+
if (result.error) return null;
|
|
425
|
+
if (result.status !== 0) return null;
|
|
426
|
+
const raw = (result.stdout || "").toString().trim();
|
|
427
|
+
return raw ? raw : null;
|
|
428
|
+
}
|
|
429
|
+
function resolveRepoRemotesFromPaths(filePaths, cwd) {
|
|
430
|
+
const dirToRoot = /* @__PURE__ */ new Map();
|
|
431
|
+
const rootToRemote = /* @__PURE__ */ new Map();
|
|
432
|
+
const remoteForDir = (dir) => {
|
|
433
|
+
let root;
|
|
434
|
+
if (dirToRoot.has(dir)) {
|
|
435
|
+
root = dirToRoot.get(dir) ?? null;
|
|
436
|
+
} else {
|
|
437
|
+
root = runGit(["-C", dir, "rev-parse", "--show-toplevel"]);
|
|
438
|
+
dirToRoot.set(dir, root);
|
|
439
|
+
}
|
|
440
|
+
if (!root) return null;
|
|
441
|
+
let remote;
|
|
442
|
+
if (rootToRemote.has(root)) {
|
|
443
|
+
remote = rootToRemote.get(root) ?? null;
|
|
444
|
+
} else {
|
|
445
|
+
const raw = runGit([
|
|
446
|
+
"-C",
|
|
447
|
+
root,
|
|
448
|
+
"config",
|
|
449
|
+
"--get",
|
|
450
|
+
"remote.origin.url"
|
|
451
|
+
]);
|
|
452
|
+
remote = raw ? sanitizeRemoteUrl(raw) : null;
|
|
453
|
+
rootToRemote.set(root, remote);
|
|
454
|
+
}
|
|
455
|
+
return remote;
|
|
456
|
+
};
|
|
457
|
+
const directories = [];
|
|
458
|
+
const seenDirs = /* @__PURE__ */ new Set();
|
|
459
|
+
const addDir = (dir) => {
|
|
460
|
+
if (!dir || seenDirs.has(dir)) return;
|
|
461
|
+
seenDirs.add(dir);
|
|
462
|
+
directories.push(dir);
|
|
463
|
+
};
|
|
464
|
+
const trimmedCwd = typeof cwd === "string" && cwd.trim() ? cwd.trim() : null;
|
|
465
|
+
if (trimmedCwd) addDir(trimmedCwd);
|
|
466
|
+
for (const fp of filePaths) {
|
|
467
|
+
if (typeof fp !== "string" || !fp.trim()) continue;
|
|
468
|
+
addDir(path3.dirname(fp.trim()));
|
|
469
|
+
}
|
|
470
|
+
const probed = directories.slice(0, MAX_PROBED_DIRECTORIES);
|
|
471
|
+
const repoHints = [];
|
|
472
|
+
const seenRemotes = /* @__PURE__ */ new Set();
|
|
473
|
+
let gitRemoteUrl = null;
|
|
474
|
+
for (const dir of probed) {
|
|
475
|
+
const remote = remoteForDir(dir);
|
|
476
|
+
if (trimmedCwd && dir === trimmedCwd) {
|
|
477
|
+
gitRemoteUrl = remote;
|
|
478
|
+
}
|
|
479
|
+
if (remote && !seenRemotes.has(remote)) {
|
|
480
|
+
seenRemotes.add(remote);
|
|
481
|
+
repoHints.push(remote);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
return { repoHints, gitRemoteUrl };
|
|
485
|
+
}
|
|
405
486
|
|
|
406
487
|
// src/monitor/prompt.ts
|
|
407
488
|
import * as readline from "readline";
|
|
@@ -425,7 +506,7 @@ function isInteractive() {
|
|
|
425
506
|
async function provisionSelfMonitorAgent(opts) {
|
|
426
507
|
const me = await getCurrentUser();
|
|
427
508
|
const localPart = (me.email.split("@")[0] ?? "user").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
428
|
-
const workspaceName =
|
|
509
|
+
const workspaceName = path4.basename(opts.projectRoot).toLowerCase();
|
|
429
510
|
const defaultName = `${workspaceName}-${localPart}`;
|
|
430
511
|
let existing = [];
|
|
431
512
|
try {
|
|
@@ -514,7 +595,7 @@ An agent named "${agentName}" already exists on this account (created by someone
|
|
|
514
595
|
}
|
|
515
596
|
|
|
516
597
|
// src/monitor/plugins/claude-code/install.ts
|
|
517
|
-
import
|
|
598
|
+
import path5 from "path";
|
|
518
599
|
var CLAUDE_CODE_SOURCE = "claude-code";
|
|
519
600
|
var CLAUDE_CODE_AGENT_SOURCE = "CLAUDE_CODE";
|
|
520
601
|
var CLAUDE_CODE_AGENT_CATEGORY = "CODING";
|
|
@@ -562,7 +643,7 @@ async function installClaudeCode(opts) {
|
|
|
562
643
|
};
|
|
563
644
|
writeClaudeCodeConfig(projectRoot, monitorConfig);
|
|
564
645
|
const configPath = getClaudeCodeConfigPath(projectRoot);
|
|
565
|
-
const configRel =
|
|
646
|
+
const configRel = path5.relative(projectRoot, configPath);
|
|
566
647
|
console.log("");
|
|
567
648
|
console.log(`\u2713 Agent "${agent.name}" configured (ID: ${agent.id})`);
|
|
568
649
|
if (agent.apiKey?.key) {
|
|
@@ -617,13 +698,13 @@ async function uninstallClaudeCode(opts) {
|
|
|
617
698
|
}
|
|
618
699
|
if (!opts.keepConfig) {
|
|
619
700
|
const configPath = getClaudeCodeConfigPath(projectRoot);
|
|
620
|
-
const configRel =
|
|
701
|
+
const configRel = path5.relative(projectRoot, configPath);
|
|
621
702
|
if (deleteClaudeCodeConfig(projectRoot)) {
|
|
622
703
|
console.log(`\u2713 Monitor config removed (${configRel})`);
|
|
623
704
|
}
|
|
624
705
|
} else {
|
|
625
706
|
const configPath = getClaudeCodeConfigPath(projectRoot);
|
|
626
|
-
const configRel =
|
|
707
|
+
const configRel = path5.relative(projectRoot, configPath);
|
|
627
708
|
console.log(`Monitor config retained at ${configRel}`);
|
|
628
709
|
}
|
|
629
710
|
console.log("");
|
|
@@ -642,6 +723,8 @@ var FILE_EDITING_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
|
642
723
|
"MultiEdit"
|
|
643
724
|
]);
|
|
644
725
|
var BASH_TOOL_NAME = "Bash";
|
|
726
|
+
var EXIT_PLAN_MODE_TOOL_NAME = "ExitPlanMode";
|
|
727
|
+
var TODO_WRITE_TOOL_NAME = "TodoWrite";
|
|
645
728
|
var SKILL_REGEX = /^\/([\w-]+)(?:\s|$)/;
|
|
646
729
|
function detectSkill(userMessage) {
|
|
647
730
|
if (typeof userMessage !== "string") return void 0;
|
|
@@ -687,7 +770,11 @@ function parseTranscript(raw) {
|
|
|
687
770
|
numTurns: 0,
|
|
688
771
|
toolCallCount: 0,
|
|
689
772
|
filesEditedCount: 0,
|
|
690
|
-
|
|
773
|
+
editedFilePaths: [],
|
|
774
|
+
bashCommandCount: 0,
|
|
775
|
+
planMode: false,
|
|
776
|
+
todoWrite: false,
|
|
777
|
+
turnsBeforeFirstEdit: null
|
|
691
778
|
};
|
|
692
779
|
if (!raw) return empty;
|
|
693
780
|
const lines = raw.split("\n");
|
|
@@ -704,6 +791,9 @@ function parseTranscript(raw) {
|
|
|
704
791
|
let toolCallCount = 0;
|
|
705
792
|
let bashCommandCount = 0;
|
|
706
793
|
let editedFilePaths = /* @__PURE__ */ new Set();
|
|
794
|
+
let planMode = false;
|
|
795
|
+
let todoWrite = false;
|
|
796
|
+
let turnsBeforeFirstEdit = null;
|
|
707
797
|
for (const rawLine of lines) {
|
|
708
798
|
if (!rawLine) continue;
|
|
709
799
|
let parsed;
|
|
@@ -723,6 +813,9 @@ function parseTranscript(raw) {
|
|
|
723
813
|
toolCallCount = 0;
|
|
724
814
|
bashCommandCount = 0;
|
|
725
815
|
editedFilePaths = /* @__PURE__ */ new Set();
|
|
816
|
+
planMode = false;
|
|
817
|
+
todoWrite = false;
|
|
818
|
+
turnsBeforeFirstEdit = null;
|
|
726
819
|
lastUserTimestampRaw = typeof parsed.timestamp === "string" && parsed.timestamp ? parsed.timestamp : void 0;
|
|
727
820
|
} else if (parsed.type === "assistant" && parsed.message) {
|
|
728
821
|
const text = extractTextContent(parsed.message.content);
|
|
@@ -738,11 +831,22 @@ function parseTranscript(raw) {
|
|
|
738
831
|
if (!block || block.type !== "tool_use") continue;
|
|
739
832
|
toolCallCount += 1;
|
|
740
833
|
const name = typeof block.name === "string" ? block.name : "";
|
|
834
|
+
if (name === EXIT_PLAN_MODE_TOOL_NAME) {
|
|
835
|
+
planMode = true;
|
|
836
|
+
continue;
|
|
837
|
+
}
|
|
838
|
+
if (name === TODO_WRITE_TOOL_NAME) {
|
|
839
|
+
todoWrite = true;
|
|
840
|
+
continue;
|
|
841
|
+
}
|
|
741
842
|
if (name === BASH_TOOL_NAME) {
|
|
742
843
|
bashCommandCount += 1;
|
|
743
844
|
continue;
|
|
744
845
|
}
|
|
745
846
|
if (FILE_EDITING_TOOL_NAMES.has(name)) {
|
|
847
|
+
if (turnsBeforeFirstEdit === null) {
|
|
848
|
+
turnsBeforeFirstEdit = numTurns;
|
|
849
|
+
}
|
|
746
850
|
const input = block.input;
|
|
747
851
|
if (input !== null && typeof input === "object" && "file_path" in input) {
|
|
748
852
|
const filePath = input.file_path;
|
|
@@ -778,7 +882,11 @@ function parseTranscript(raw) {
|
|
|
778
882
|
numTurns,
|
|
779
883
|
toolCallCount,
|
|
780
884
|
filesEditedCount: editedFilePaths.size,
|
|
781
|
-
|
|
885
|
+
editedFilePaths: [...editedFilePaths],
|
|
886
|
+
bashCommandCount,
|
|
887
|
+
planMode,
|
|
888
|
+
todoWrite,
|
|
889
|
+
turnsBeforeFirstEdit
|
|
782
890
|
};
|
|
783
891
|
if (!Number.isNaN(currentTurnUserTimestamp) && !Number.isNaN(lastAssistantTimestamp) && lastAssistantTimestamp >= currentTurnUserTimestamp) {
|
|
784
892
|
result.latencyMs = Math.round(
|
|
@@ -809,7 +917,11 @@ function extractFromTranscript(transcriptPath, debugLog6 = noopDebug) {
|
|
|
809
917
|
numTurns: 0,
|
|
810
918
|
toolCallCount: 0,
|
|
811
919
|
filesEditedCount: 0,
|
|
812
|
-
|
|
920
|
+
editedFilePaths: [],
|
|
921
|
+
bashCommandCount: 0,
|
|
922
|
+
planMode: false,
|
|
923
|
+
todoWrite: false,
|
|
924
|
+
turnsBeforeFirstEdit: null
|
|
813
925
|
};
|
|
814
926
|
if (!transcriptPath) return empty;
|
|
815
927
|
let raw;
|
|
@@ -838,7 +950,7 @@ function extractSubagentName(event) {
|
|
|
838
950
|
}
|
|
839
951
|
return void 0;
|
|
840
952
|
}
|
|
841
|
-
function buildClaudeCodePayload(event, eventData, config) {
|
|
953
|
+
function buildClaudeCodePayload(event, eventData, config, repoSignals) {
|
|
842
954
|
const sessionId = eventData.session_id ?? `claude-code-${Date.now()}`;
|
|
843
955
|
switch (event) {
|
|
844
956
|
case "stop":
|
|
@@ -864,6 +976,19 @@ function buildClaudeCodePayload(event, eventData, config) {
|
|
|
864
976
|
if (typeof extracted.latencyMs === "number") {
|
|
865
977
|
customData.latencyMs = extracted.latencyMs;
|
|
866
978
|
}
|
|
979
|
+
if (extracted.planMode) customData.planMode = true;
|
|
980
|
+
if (extracted.todoWrite) customData.todoWrite = true;
|
|
981
|
+
if (extracted.turnsBeforeFirstEdit !== null) {
|
|
982
|
+
customData.turnsBeforeFirstEdit = extracted.turnsBeforeFirstEdit;
|
|
983
|
+
}
|
|
984
|
+
if (repoSignals) {
|
|
985
|
+
if (repoSignals.repoHints.length > 0) {
|
|
986
|
+
customData.repoHints = repoSignals.repoHints;
|
|
987
|
+
}
|
|
988
|
+
if (repoSignals.gitRemoteUrl) {
|
|
989
|
+
customData.gitRemoteUrl = repoSignals.gitRemoteUrl;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
867
992
|
if (isSubagent) {
|
|
868
993
|
const subagent = extractSubagentName(eventData);
|
|
869
994
|
if (subagent) {
|
|
@@ -943,14 +1068,24 @@ var claudeCodePlugin = {
|
|
|
943
1068
|
debugLog("config-load-failed", { projectRoot });
|
|
944
1069
|
return null;
|
|
945
1070
|
}
|
|
946
|
-
const payload = buildClaudeCodePayload(event, eventData, config);
|
|
947
|
-
if (!payload) return null;
|
|
948
|
-
debugLog("payload-built", payload);
|
|
949
|
-
const sessionId = typeof eventData.session_id === "string" && eventData.session_id || void 0;
|
|
950
1071
|
const extracted = extractFromTranscript(
|
|
951
1072
|
eventData.transcript_path,
|
|
952
1073
|
debugLog
|
|
953
1074
|
);
|
|
1075
|
+
const repoSignals = resolveRepoRemotesFromPaths(
|
|
1076
|
+
extracted.editedFilePaths,
|
|
1077
|
+
typeof eventData.cwd === "string" && eventData.cwd.trim() ? eventData.cwd : null
|
|
1078
|
+
);
|
|
1079
|
+
debugLog("repo-signals-resolved", repoSignals);
|
|
1080
|
+
const payload = buildClaudeCodePayload(
|
|
1081
|
+
event,
|
|
1082
|
+
eventData,
|
|
1083
|
+
config,
|
|
1084
|
+
repoSignals
|
|
1085
|
+
);
|
|
1086
|
+
if (!payload) return null;
|
|
1087
|
+
debugLog("payload-built", payload);
|
|
1088
|
+
const sessionId = typeof eventData.session_id === "string" && eventData.session_id || void 0;
|
|
954
1089
|
const userTurnTimestamp = extracted.userTurnTimestamp;
|
|
955
1090
|
if (extracted.prompt.trim() === "" && extracted.response.trim() === "" && extracted.numTurns === 0) {
|
|
956
1091
|
debugLog("empty-parse-skip", {
|
|
@@ -1027,23 +1162,23 @@ import { spawnSync as spawnSync3 } from "child_process";
|
|
|
1027
1162
|
|
|
1028
1163
|
// src/monitor/plugins/codex/install.ts
|
|
1029
1164
|
import * as fs7 from "fs";
|
|
1030
|
-
import * as
|
|
1165
|
+
import * as path8 from "path";
|
|
1031
1166
|
import * as TOML from "@iarna/toml";
|
|
1032
1167
|
|
|
1033
1168
|
// src/monitor/plugins/codex/paths.ts
|
|
1034
1169
|
import * as os3 from "os";
|
|
1035
|
-
import * as
|
|
1170
|
+
import * as path6 from "path";
|
|
1036
1171
|
var CODEX_HOME_DIRNAME = ".codex";
|
|
1037
1172
|
var CODEX_CONFIG_FILENAME = "config.toml";
|
|
1038
1173
|
var CODEX_SESSIONS_DIRNAME = "sessions";
|
|
1039
1174
|
function getCodexHomeDir() {
|
|
1040
|
-
return
|
|
1175
|
+
return path6.join(os3.homedir(), CODEX_HOME_DIRNAME);
|
|
1041
1176
|
}
|
|
1042
1177
|
function getCodexConfigPath() {
|
|
1043
|
-
return
|
|
1178
|
+
return path6.join(getCodexHomeDir(), CODEX_CONFIG_FILENAME);
|
|
1044
1179
|
}
|
|
1045
1180
|
function getCodexSessionsDir() {
|
|
1046
|
-
return
|
|
1181
|
+
return path6.join(getCodexHomeDir(), CODEX_SESSIONS_DIRNAME);
|
|
1047
1182
|
}
|
|
1048
1183
|
|
|
1049
1184
|
// src/monitor/plugins/codex/hooks.ts
|
|
@@ -1119,7 +1254,7 @@ function hasOlakaiHooksInstalled(parsed) {
|
|
|
1119
1254
|
|
|
1120
1255
|
// src/monitor/plugins/codex/config.ts
|
|
1121
1256
|
import * as fs6 from "fs";
|
|
1122
|
-
import * as
|
|
1257
|
+
import * as path7 from "path";
|
|
1123
1258
|
function getCodexConfigPath2(projectRoot) {
|
|
1124
1259
|
return getMonitorConfigPath(projectRoot, "codex");
|
|
1125
1260
|
}
|
|
@@ -1135,7 +1270,7 @@ function loadCodexConfig(projectRoot) {
|
|
|
1135
1270
|
}
|
|
1136
1271
|
function writeCodexConfig(projectRoot, config) {
|
|
1137
1272
|
const filePath = getCodexConfigPath2(projectRoot);
|
|
1138
|
-
const dir =
|
|
1273
|
+
const dir = path7.dirname(filePath);
|
|
1139
1274
|
if (!fs6.existsSync(dir)) {
|
|
1140
1275
|
fs6.mkdirSync(dir, { recursive: true });
|
|
1141
1276
|
}
|
|
@@ -1193,7 +1328,7 @@ async function installCodex(opts) {
|
|
|
1193
1328
|
};
|
|
1194
1329
|
writeCodexConfig(projectRoot, monitorConfig);
|
|
1195
1330
|
const configPath = getCodexConfigPath2(projectRoot);
|
|
1196
|
-
const configRel =
|
|
1331
|
+
const configRel = path8.relative(projectRoot, configPath);
|
|
1197
1332
|
console.log("");
|
|
1198
1333
|
console.log(`\u2713 Agent "${agent.name}" configured (ID: ${agent.id})`);
|
|
1199
1334
|
if (agent.apiKey?.key) {
|
|
@@ -1257,13 +1392,13 @@ async function uninstallCodex(opts) {
|
|
|
1257
1392
|
}
|
|
1258
1393
|
if (!opts.keepConfig) {
|
|
1259
1394
|
const configPath = getCodexConfigPath2(projectRoot);
|
|
1260
|
-
const configRel =
|
|
1395
|
+
const configRel = path8.relative(projectRoot, configPath);
|
|
1261
1396
|
if (deleteCodexConfig(projectRoot)) {
|
|
1262
1397
|
console.log(`\u2713 Monitor config removed (${configRel})`);
|
|
1263
1398
|
}
|
|
1264
1399
|
} else {
|
|
1265
1400
|
const configPath = getCodexConfigPath2(projectRoot);
|
|
1266
|
-
const configRel =
|
|
1401
|
+
const configRel = path8.relative(projectRoot, configPath);
|
|
1267
1402
|
console.log(`Monitor config retained at ${configRel}`);
|
|
1268
1403
|
}
|
|
1269
1404
|
console.log("");
|
|
@@ -1301,7 +1436,7 @@ function readCodexConfigToml(configPath) {
|
|
|
1301
1436
|
}
|
|
1302
1437
|
}
|
|
1303
1438
|
function writeCodexConfigToml(configPath, data) {
|
|
1304
|
-
const dir =
|
|
1439
|
+
const dir = path8.dirname(configPath);
|
|
1305
1440
|
if (!fs7.existsSync(dir)) {
|
|
1306
1441
|
fs7.mkdirSync(dir, { recursive: true });
|
|
1307
1442
|
}
|
|
@@ -1310,7 +1445,7 @@ function writeCodexConfigToml(configPath, data) {
|
|
|
1310
1445
|
}
|
|
1311
1446
|
|
|
1312
1447
|
// src/monitor/plugins/codex/status.ts
|
|
1313
|
-
import
|
|
1448
|
+
import path9 from "path";
|
|
1314
1449
|
import * as fs8 from "fs";
|
|
1315
1450
|
async function getCodexStatus(opts) {
|
|
1316
1451
|
const projectRoot = opts?.projectRoot ?? process.cwd();
|
|
@@ -1350,7 +1485,7 @@ function isHooksBlockInstalled() {
|
|
|
1350
1485
|
|
|
1351
1486
|
// src/monitor/plugins/codex/transcript.ts
|
|
1352
1487
|
import * as fs9 from "fs";
|
|
1353
|
-
import * as
|
|
1488
|
+
import * as path10 from "path";
|
|
1354
1489
|
function emptyRollout() {
|
|
1355
1490
|
return {
|
|
1356
1491
|
prompt: "",
|
|
@@ -1390,7 +1525,7 @@ function findRolloutPathForSession(sessionId, sessionsDir = getCodexSessionsDir(
|
|
|
1390
1525
|
}
|
|
1391
1526
|
for (const entry of entries) {
|
|
1392
1527
|
if (filesScanned++ > merged.maxFiles) break;
|
|
1393
|
-
const full =
|
|
1528
|
+
const full = path10.join(dir, entry.name);
|
|
1394
1529
|
if (entry.isDirectory()) {
|
|
1395
1530
|
queue.push(full);
|
|
1396
1531
|
continue;
|
|
@@ -1708,11 +1843,11 @@ import * as os8 from "os";
|
|
|
1708
1843
|
// src/monitor/plugins/cursor/install.ts
|
|
1709
1844
|
import * as fs12 from "fs";
|
|
1710
1845
|
import * as os5 from "os";
|
|
1711
|
-
import * as
|
|
1846
|
+
import * as path13 from "path";
|
|
1712
1847
|
|
|
1713
1848
|
// src/monitor/plugins/cursor/config.ts
|
|
1714
1849
|
import * as fs11 from "fs";
|
|
1715
|
-
import * as
|
|
1850
|
+
import * as path11 from "path";
|
|
1716
1851
|
function getCursorConfigPath(projectRoot) {
|
|
1717
1852
|
return getMonitorConfigPath(projectRoot, "cursor");
|
|
1718
1853
|
}
|
|
@@ -1728,7 +1863,7 @@ function loadCursorConfig(projectRoot) {
|
|
|
1728
1863
|
}
|
|
1729
1864
|
function writeCursorConfig(projectRoot, config) {
|
|
1730
1865
|
const filePath = getCursorConfigPath(projectRoot);
|
|
1731
|
-
const dir =
|
|
1866
|
+
const dir = path11.dirname(filePath);
|
|
1732
1867
|
if (!fs11.existsSync(dir)) {
|
|
1733
1868
|
fs11.mkdirSync(dir, { recursive: true });
|
|
1734
1869
|
}
|
|
@@ -1751,14 +1886,14 @@ function deleteCursorConfig(projectRoot) {
|
|
|
1751
1886
|
|
|
1752
1887
|
// src/monitor/plugins/cursor/paths.ts
|
|
1753
1888
|
import * as os4 from "os";
|
|
1754
|
-
import * as
|
|
1889
|
+
import * as path12 from "path";
|
|
1755
1890
|
var CURSOR_DIR_NAME = ".cursor";
|
|
1756
1891
|
var CURSOR_HOOKS_FILE = "hooks.json";
|
|
1757
1892
|
function getCursorUserDir(homeDir = os4.homedir()) {
|
|
1758
|
-
return
|
|
1893
|
+
return path12.join(homeDir, CURSOR_DIR_NAME);
|
|
1759
1894
|
}
|
|
1760
1895
|
function getCursorHooksPath(homeDir = os4.homedir()) {
|
|
1761
|
-
return
|
|
1896
|
+
return path12.join(getCursorUserDir(homeDir), CURSOR_HOOKS_FILE);
|
|
1762
1897
|
}
|
|
1763
1898
|
|
|
1764
1899
|
// src/monitor/plugins/cursor/hooks-config.ts
|
|
@@ -1856,7 +1991,7 @@ function readJsonFileTolerant(filePath) {
|
|
|
1856
1991
|
}
|
|
1857
1992
|
}
|
|
1858
1993
|
function writeJsonFileWithDir(filePath, data) {
|
|
1859
|
-
const dir =
|
|
1994
|
+
const dir = path13.dirname(filePath);
|
|
1860
1995
|
if (!fs12.existsSync(dir)) {
|
|
1861
1996
|
fs12.mkdirSync(dir, { recursive: true });
|
|
1862
1997
|
}
|
|
@@ -1910,8 +2045,8 @@ async function installCursor(opts) {
|
|
|
1910
2045
|
};
|
|
1911
2046
|
writeCursorConfig(projectRoot, monitorConfig);
|
|
1912
2047
|
const configPath = getCursorConfigPath(projectRoot);
|
|
1913
|
-
const configRel =
|
|
1914
|
-
const hooksDisplay = `~/${
|
|
2048
|
+
const configRel = path13.relative(projectRoot, configPath);
|
|
2049
|
+
const hooksDisplay = `~/${path13.join(CURSOR_DIR_NAME, CURSOR_HOOKS_FILE)}`;
|
|
1915
2050
|
console.log("");
|
|
1916
2051
|
console.log(`\u2713 Agent "${agent.name}" configured (ID: ${agent.id})`);
|
|
1917
2052
|
if (agent.apiKey?.key) {
|
|
@@ -1961,20 +2096,20 @@ async function uninstallCursor(opts) {
|
|
|
1961
2096
|
writeJsonFileWithDir(hooksPath, cleaned);
|
|
1962
2097
|
}
|
|
1963
2098
|
console.log(
|
|
1964
|
-
`\u2713 Olakai hooks removed from ~/${
|
|
2099
|
+
`\u2713 Olakai hooks removed from ~/${path13.join(CURSOR_DIR_NAME, CURSOR_HOOKS_FILE)}`
|
|
1965
2100
|
);
|
|
1966
2101
|
} else {
|
|
1967
2102
|
console.log("No Cursor hooks file found.");
|
|
1968
2103
|
}
|
|
1969
2104
|
if (!opts.keepConfig) {
|
|
1970
2105
|
const configPath = getCursorConfigPath(projectRoot);
|
|
1971
|
-
const configRel =
|
|
2106
|
+
const configRel = path13.relative(projectRoot, configPath);
|
|
1972
2107
|
if (deleteCursorConfig(projectRoot)) {
|
|
1973
2108
|
console.log(`\u2713 Monitor config removed (${configRel})`);
|
|
1974
2109
|
}
|
|
1975
2110
|
} else {
|
|
1976
2111
|
const configPath = getCursorConfigPath(projectRoot);
|
|
1977
|
-
const configRel =
|
|
2112
|
+
const configRel = path13.relative(projectRoot, configPath);
|
|
1978
2113
|
console.log(`Monitor config retained at ${configRel}`);
|
|
1979
2114
|
}
|
|
1980
2115
|
console.log("");
|
|
@@ -1987,7 +2122,7 @@ async function uninstallCursor(opts) {
|
|
|
1987
2122
|
// src/monitor/plugins/cursor/status.ts
|
|
1988
2123
|
import * as fs13 from "fs";
|
|
1989
2124
|
import * as os6 from "os";
|
|
1990
|
-
import * as
|
|
2125
|
+
import * as path14 from "path";
|
|
1991
2126
|
async function getCursorStatus(opts) {
|
|
1992
2127
|
const projectRoot = opts?.projectRoot ?? process.cwd();
|
|
1993
2128
|
const homeDir = opts?.homeDir ?? os6.homedir();
|
|
@@ -2179,10 +2314,10 @@ function extractCursorMeta(payload) {
|
|
|
2179
2314
|
// src/monitor/plugins/cursor/pairing-state.ts
|
|
2180
2315
|
import * as fs14 from "fs";
|
|
2181
2316
|
import * as os7 from "os";
|
|
2182
|
-
import * as
|
|
2317
|
+
import * as path15 from "path";
|
|
2183
2318
|
var STATE_DIR_SEGMENTS2 = [".olakai", "cursor-pairings"];
|
|
2184
2319
|
function getPairingsDir(homeDir) {
|
|
2185
|
-
return
|
|
2320
|
+
return path15.join(homeDir, ...STATE_DIR_SEGMENTS2);
|
|
2186
2321
|
}
|
|
2187
2322
|
function sanitizeKeyFragment(value) {
|
|
2188
2323
|
return value.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
@@ -2193,7 +2328,7 @@ function getPairingKey(conversationId, generationId) {
|
|
|
2193
2328
|
return `${conv}__${sanitizeKeyFragment(generationId)}`;
|
|
2194
2329
|
}
|
|
2195
2330
|
function getPairingFile(conversationId, generationId, homeDir) {
|
|
2196
|
-
return
|
|
2331
|
+
return path15.join(
|
|
2197
2332
|
getPairingsDir(homeDir),
|
|
2198
2333
|
`${getPairingKey(conversationId, generationId)}.json`
|
|
2199
2334
|
);
|
|
@@ -2259,7 +2394,7 @@ function listPendingPrompts(homeDir = os7.homedir()) {
|
|
|
2259
2394
|
const result = [];
|
|
2260
2395
|
for (const name of files) {
|
|
2261
2396
|
if (!name.endsWith(".json")) continue;
|
|
2262
|
-
const filePath =
|
|
2397
|
+
const filePath = path15.join(dir, name);
|
|
2263
2398
|
try {
|
|
2264
2399
|
const raw = fs14.readFileSync(filePath, "utf-8");
|
|
2265
2400
|
const parsed = JSON.parse(raw);
|
|
@@ -2548,11 +2683,11 @@ import { spawnSync as spawnSync4 } from "child_process";
|
|
|
2548
2683
|
// src/monitor/plugins/gemini-cli/install.ts
|
|
2549
2684
|
import * as fs18 from "fs";
|
|
2550
2685
|
import * as os10 from "os";
|
|
2551
|
-
import * as
|
|
2686
|
+
import * as path19 from "path";
|
|
2552
2687
|
|
|
2553
2688
|
// src/monitor/plugins/gemini-cli/config.ts
|
|
2554
2689
|
import * as fs16 from "fs";
|
|
2555
|
-
import * as
|
|
2690
|
+
import * as path16 from "path";
|
|
2556
2691
|
function getGeminiCliConfigPath(projectRoot) {
|
|
2557
2692
|
return getMonitorConfigPath(projectRoot, "gemini-cli");
|
|
2558
2693
|
}
|
|
@@ -2568,7 +2703,7 @@ function loadGeminiCliConfig(projectRoot) {
|
|
|
2568
2703
|
}
|
|
2569
2704
|
function writeGeminiCliConfig(projectRoot, config) {
|
|
2570
2705
|
const filePath = getGeminiCliConfigPath(projectRoot);
|
|
2571
|
-
const dir =
|
|
2706
|
+
const dir = path16.dirname(filePath);
|
|
2572
2707
|
if (!fs16.existsSync(dir)) {
|
|
2573
2708
|
fs16.mkdirSync(dir, { recursive: true });
|
|
2574
2709
|
}
|
|
@@ -2591,19 +2726,19 @@ function deleteGeminiCliConfig(projectRoot) {
|
|
|
2591
2726
|
|
|
2592
2727
|
// src/monitor/plugins/gemini-cli/paths.ts
|
|
2593
2728
|
import * as os9 from "os";
|
|
2594
|
-
import * as
|
|
2729
|
+
import * as path17 from "path";
|
|
2595
2730
|
var GEMINI_HOME_DIRNAME = ".gemini";
|
|
2596
2731
|
var GEMINI_SETTINGS_FILENAME = "settings.json";
|
|
2597
2732
|
function getGeminiHomeDir(homeDir = os9.homedir()) {
|
|
2598
|
-
return
|
|
2733
|
+
return path17.join(homeDir, GEMINI_HOME_DIRNAME);
|
|
2599
2734
|
}
|
|
2600
2735
|
function getGeminiSettingsPath(homeDir = os9.homedir()) {
|
|
2601
|
-
return
|
|
2736
|
+
return path17.join(getGeminiHomeDir(homeDir), GEMINI_SETTINGS_FILENAME);
|
|
2602
2737
|
}
|
|
2603
2738
|
|
|
2604
2739
|
// src/monitor/plugins/gemini-cli/settings.ts
|
|
2605
2740
|
import * as fs17 from "fs";
|
|
2606
|
-
import * as
|
|
2741
|
+
import * as path18 from "path";
|
|
2607
2742
|
var OLAKAI_HOOK_MARKER4 = "olakai monitor hook --tool gemini-cli";
|
|
2608
2743
|
var GEMINI_HOOK_TIMEOUT_MS = 5e3;
|
|
2609
2744
|
var SUPPORTED_GEMINI_HOOK_EVENTS = [
|
|
@@ -2696,7 +2831,7 @@ function readJsonFile2(filePath) {
|
|
|
2696
2831
|
}
|
|
2697
2832
|
}
|
|
2698
2833
|
function writeJsonFile2(filePath, data) {
|
|
2699
|
-
const dir =
|
|
2834
|
+
const dir = path18.dirname(filePath);
|
|
2700
2835
|
if (!fs17.existsSync(dir)) {
|
|
2701
2836
|
fs17.mkdirSync(dir, { recursive: true });
|
|
2702
2837
|
}
|
|
@@ -2759,8 +2894,8 @@ async function installGeminiCli(opts) {
|
|
|
2759
2894
|
};
|
|
2760
2895
|
writeGeminiCliConfig(projectRoot, monitorConfig);
|
|
2761
2896
|
const configPath = getGeminiCliConfigPath(projectRoot);
|
|
2762
|
-
const configRel =
|
|
2763
|
-
const settingsDisplay = `~/${
|
|
2897
|
+
const configRel = path19.relative(projectRoot, configPath);
|
|
2898
|
+
const settingsDisplay = `~/${path19.join(GEMINI_HOME_DIRNAME, GEMINI_SETTINGS_FILENAME)}`;
|
|
2764
2899
|
console.log("");
|
|
2765
2900
|
console.log(`\u2713 Agent "${agent.name}" configured (ID: ${agent.id})`);
|
|
2766
2901
|
if (agent.apiKey?.key) {
|
|
@@ -2814,20 +2949,20 @@ async function uninstallGeminiCli(opts) {
|
|
|
2814
2949
|
writeJsonFile2(settingsPath, next);
|
|
2815
2950
|
}
|
|
2816
2951
|
console.log(
|
|
2817
|
-
`\u2713 Olakai hooks removed from ~/${
|
|
2952
|
+
`\u2713 Olakai hooks removed from ~/${path19.join(GEMINI_HOME_DIRNAME, GEMINI_SETTINGS_FILENAME)}`
|
|
2818
2953
|
);
|
|
2819
2954
|
} else {
|
|
2820
2955
|
console.log("No Olakai hooks found in Gemini CLI settings.");
|
|
2821
2956
|
}
|
|
2822
2957
|
if (!opts.keepConfig) {
|
|
2823
2958
|
const configPath = getGeminiCliConfigPath(projectRoot);
|
|
2824
|
-
const configRel =
|
|
2959
|
+
const configRel = path19.relative(projectRoot, configPath);
|
|
2825
2960
|
if (deleteGeminiCliConfig(projectRoot)) {
|
|
2826
2961
|
console.log(`\u2713 Monitor config removed (${configRel})`);
|
|
2827
2962
|
}
|
|
2828
2963
|
} else {
|
|
2829
2964
|
const configPath = getGeminiCliConfigPath(projectRoot);
|
|
2830
|
-
const configRel =
|
|
2965
|
+
const configRel = path19.relative(projectRoot, configPath);
|
|
2831
2966
|
console.log(`Monitor config retained at ${configRel}`);
|
|
2832
2967
|
}
|
|
2833
2968
|
console.log("");
|
|
@@ -2838,7 +2973,7 @@ async function uninstallGeminiCli(opts) {
|
|
|
2838
2973
|
|
|
2839
2974
|
// src/monitor/plugins/gemini-cli/status.ts
|
|
2840
2975
|
import * as os11 from "os";
|
|
2841
|
-
import * as
|
|
2976
|
+
import * as path20 from "path";
|
|
2842
2977
|
async function getGeminiCliStatus(opts) {
|
|
2843
2978
|
const projectRoot = opts?.projectRoot ?? process.cwd();
|
|
2844
2979
|
const homeDir = opts?.homeDir ?? os11.homedir();
|
|
@@ -2874,16 +3009,16 @@ async function getGeminiCliStatus(opts) {
|
|
|
2874
3009
|
// src/monitor/plugins/gemini-cli/pairing-state.ts
|
|
2875
3010
|
import * as fs19 from "fs";
|
|
2876
3011
|
import * as os12 from "os";
|
|
2877
|
-
import * as
|
|
3012
|
+
import * as path21 from "path";
|
|
2878
3013
|
var STATE_DIR_SEGMENTS3 = [".olakai", "gemini-pairings"];
|
|
2879
3014
|
function getPairingsDir2(homeDir) {
|
|
2880
|
-
return
|
|
3015
|
+
return path21.join(homeDir, ...STATE_DIR_SEGMENTS3);
|
|
2881
3016
|
}
|
|
2882
3017
|
function sanitizeKeyFragment2(value) {
|
|
2883
3018
|
return value.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
2884
3019
|
}
|
|
2885
3020
|
function getPairingFile2(sessionId, homeDir) {
|
|
2886
|
-
return
|
|
3021
|
+
return path21.join(
|
|
2887
3022
|
getPairingsDir2(homeDir),
|
|
2888
3023
|
`${sanitizeKeyFragment2(sessionId)}.json`
|
|
2889
3024
|
);
|
|
@@ -3360,11 +3495,11 @@ import { spawnSync as spawnSync5 } from "child_process";
|
|
|
3360
3495
|
// src/monitor/plugins/antigravity/install.ts
|
|
3361
3496
|
import * as fs23 from "fs";
|
|
3362
3497
|
import * as os14 from "os";
|
|
3363
|
-
import * as
|
|
3498
|
+
import * as path25 from "path";
|
|
3364
3499
|
|
|
3365
3500
|
// src/monitor/plugins/antigravity/config.ts
|
|
3366
3501
|
import * as fs21 from "fs";
|
|
3367
|
-
import * as
|
|
3502
|
+
import * as path22 from "path";
|
|
3368
3503
|
function getAntigravityConfigPath(projectRoot) {
|
|
3369
3504
|
return getMonitorConfigPath(projectRoot, "antigravity");
|
|
3370
3505
|
}
|
|
@@ -3380,7 +3515,7 @@ function loadAntigravityConfig(projectRoot) {
|
|
|
3380
3515
|
}
|
|
3381
3516
|
function writeAntigravityConfig(projectRoot, config) {
|
|
3382
3517
|
const filePath = getAntigravityConfigPath(projectRoot);
|
|
3383
|
-
const dir =
|
|
3518
|
+
const dir = path22.dirname(filePath);
|
|
3384
3519
|
if (!fs21.existsSync(dir)) {
|
|
3385
3520
|
fs21.mkdirSync(dir, { recursive: true });
|
|
3386
3521
|
}
|
|
@@ -3403,27 +3538,27 @@ function deleteAntigravityConfig(projectRoot) {
|
|
|
3403
3538
|
|
|
3404
3539
|
// src/monitor/plugins/antigravity/paths.ts
|
|
3405
3540
|
import * as os13 from "os";
|
|
3406
|
-
import * as
|
|
3541
|
+
import * as path23 from "path";
|
|
3407
3542
|
var GEMINI_HOME_DIRNAME2 = ".gemini";
|
|
3408
3543
|
var ANTIGRAVITY_CONFIG_DIRNAME = "config";
|
|
3409
3544
|
var ANTIGRAVITY_HOOKS_FILENAME = "hooks.json";
|
|
3410
3545
|
var ANTIGRAVITY_CLI_DIRNAME = "antigravity-cli";
|
|
3411
3546
|
function getGeminiHomeDir2(homeDir = os13.homedir()) {
|
|
3412
|
-
return
|
|
3547
|
+
return path23.join(homeDir, GEMINI_HOME_DIRNAME2);
|
|
3413
3548
|
}
|
|
3414
3549
|
function getGeminiConfigDir(homeDir = os13.homedir()) {
|
|
3415
|
-
return
|
|
3550
|
+
return path23.join(getGeminiHomeDir2(homeDir), ANTIGRAVITY_CONFIG_DIRNAME);
|
|
3416
3551
|
}
|
|
3417
3552
|
function getGeminiConfigHooksPath(homeDir = os13.homedir()) {
|
|
3418
|
-
return
|
|
3553
|
+
return path23.join(getGeminiConfigDir(homeDir), ANTIGRAVITY_HOOKS_FILENAME);
|
|
3419
3554
|
}
|
|
3420
3555
|
function getAntigravityCliDir(homeDir = os13.homedir()) {
|
|
3421
|
-
return
|
|
3556
|
+
return path23.join(getGeminiHomeDir2(homeDir), ANTIGRAVITY_CLI_DIRNAME);
|
|
3422
3557
|
}
|
|
3423
3558
|
|
|
3424
3559
|
// src/monitor/plugins/antigravity/settings.ts
|
|
3425
3560
|
import * as fs22 from "fs";
|
|
3426
|
-
import * as
|
|
3561
|
+
import * as path24 from "path";
|
|
3427
3562
|
var OLAKAI_HOOK_NAME = "olakai-monitor";
|
|
3428
3563
|
var OLAKAI_HOOK_MARKER5 = "olakai monitor hook --tool antigravity";
|
|
3429
3564
|
var ANTIGRAVITY_HOOK_TIMEOUT_SECONDS = 30;
|
|
@@ -3501,7 +3636,7 @@ function readJsonFile3(filePath) {
|
|
|
3501
3636
|
}
|
|
3502
3637
|
}
|
|
3503
3638
|
function writeJsonFile3(filePath, data) {
|
|
3504
|
-
const dir =
|
|
3639
|
+
const dir = path24.dirname(filePath);
|
|
3505
3640
|
if (!fs22.existsSync(dir)) {
|
|
3506
3641
|
fs22.mkdirSync(dir, { recursive: true });
|
|
3507
3642
|
}
|
|
@@ -3561,7 +3696,7 @@ async function installAntigravity(opts) {
|
|
|
3561
3696
|
};
|
|
3562
3697
|
writeAntigravityConfig(projectRoot, monitorConfig);
|
|
3563
3698
|
const configPath = getAntigravityConfigPath(projectRoot);
|
|
3564
|
-
const configRel =
|
|
3699
|
+
const configRel = path25.relative(projectRoot, configPath);
|
|
3565
3700
|
console.log("");
|
|
3566
3701
|
console.log(`\u2713 Agent "${agent.name}" configured (ID: ${agent.id})`);
|
|
3567
3702
|
if (agent.apiKey?.key) {
|
|
@@ -3615,13 +3750,13 @@ async function uninstallAntigravity(opts) {
|
|
|
3615
3750
|
}
|
|
3616
3751
|
if (!opts.keepConfig) {
|
|
3617
3752
|
const configPath = getAntigravityConfigPath(projectRoot);
|
|
3618
|
-
const configRel =
|
|
3753
|
+
const configRel = path25.relative(projectRoot, configPath);
|
|
3619
3754
|
if (deleteAntigravityConfig(projectRoot)) {
|
|
3620
3755
|
console.log(`\u2713 Monitor config removed (${configRel})`);
|
|
3621
3756
|
}
|
|
3622
3757
|
} else {
|
|
3623
3758
|
const configPath = getAntigravityConfigPath(projectRoot);
|
|
3624
|
-
const configRel =
|
|
3759
|
+
const configRel = path25.relative(projectRoot, configPath);
|
|
3625
3760
|
console.log(`Monitor config retained at ${configRel}`);
|
|
3626
3761
|
}
|
|
3627
3762
|
console.log("");
|
|
@@ -3632,7 +3767,7 @@ async function uninstallAntigravity(opts) {
|
|
|
3632
3767
|
|
|
3633
3768
|
// src/monitor/plugins/antigravity/status.ts
|
|
3634
3769
|
import * as os15 from "os";
|
|
3635
|
-
import * as
|
|
3770
|
+
import * as path26 from "path";
|
|
3636
3771
|
var HOOKS_DISPLAY2 = "~/.gemini/config/hooks.json";
|
|
3637
3772
|
async function getAntigravityStatus(opts) {
|
|
3638
3773
|
const projectRoot = opts?.projectRoot ?? process.cwd();
|
|
@@ -3950,4 +4085,4 @@ export {
|
|
|
3950
4085
|
formatRegistryTable,
|
|
3951
4086
|
runMonitorInstall
|
|
3952
4087
|
};
|
|
3953
|
-
//# sourceMappingURL=chunk-
|
|
4088
|
+
//# sourceMappingURL=chunk-ULJXILXR.js.map
|