caveat-cli 0.19.5 → 0.19.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +29 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32988,7 +32988,7 @@ ${failureText}`).join("\n");
|
|
|
32988
32988
|
function pendingCleanupFailureText(host) {
|
|
32989
32989
|
return `[${host.stderrTag}] pending reminder cleanup failed`;
|
|
32990
32990
|
}
|
|
32991
|
-
function peekForSession(host, sessionId) {
|
|
32991
|
+
function peekForSession(host, sessionId, discardSession = false) {
|
|
32992
32992
|
const ctx = buildContextSafely(host);
|
|
32993
32993
|
if (!ctx) return { contexts: [], paths: [], caveatHome: null };
|
|
32994
32994
|
const local = peekPendingRemindersDetailed(ctx.caveatHome, sessionId);
|
|
@@ -32997,7 +32997,15 @@ function peekForSession(host, sessionId) {
|
|
|
32997
32997
|
process.stderr.write(`${pendingCleanupFailureText(host)}
|
|
32998
32998
|
`);
|
|
32999
32999
|
}
|
|
33000
|
-
|
|
33000
|
+
if (discardSession) {
|
|
33001
|
+
try {
|
|
33002
|
+
acknowledgePendingReminders(ctx.caveatHome, local.reminders.map(({ path }) => path));
|
|
33003
|
+
} catch (error51) {
|
|
33004
|
+
process.stderr.write(`[${host.stderrTag}] pending reminder cleanup failed: ${errorMessage4(error51)}
|
|
33005
|
+
`);
|
|
33006
|
+
}
|
|
33007
|
+
}
|
|
33008
|
+
const reminders = discardSession ? global.reminders : [...local.reminders, ...global.reminders];
|
|
33001
33009
|
return { contexts: reminders.map(({ text }) => text), paths: reminders.map(({ path }) => path), caveatHome: ctx.caveatHome };
|
|
33002
33010
|
}
|
|
33003
33011
|
function acknowledgeSessionReminders(host, peeked) {
|
|
@@ -33200,7 +33208,7 @@ ${hitLines.map((line) => `- ${line}`).join("\n")}
|
|
|
33200
33208
|
var MODEL = "jev-1.13.0";
|
|
33201
33209
|
var API_URL = "https://api.typesafe.ai/v1/systemone";
|
|
33202
33210
|
var STRUGGLE_THRESHOLD = 0.85;
|
|
33203
|
-
var MATCH_THRESHOLD = 0.
|
|
33211
|
+
var MATCH_THRESHOLD = 0.8;
|
|
33204
33212
|
var MAX_TERMS = 48;
|
|
33205
33213
|
var MAX_CANDIDATES = 20;
|
|
33206
33214
|
async function callJev(key, state, questions, fetcher = fetch) {
|
|
@@ -33517,6 +33525,7 @@ async function runWorker(workFile) {
|
|
|
33517
33525
|
process.exit(0);
|
|
33518
33526
|
}
|
|
33519
33527
|
if (!job.failureText || !job.sessionId) process.exit(0);
|
|
33528
|
+
if (buildContextSafely(CLAUDE_HOST)?.config.jevEnabled) process.exit(0);
|
|
33520
33529
|
const hits = searchCaveatsSafely(CLAUDE_HOST, {
|
|
33521
33530
|
topicText: job.topicText,
|
|
33522
33531
|
failureText: job.failureText,
|
|
@@ -33728,10 +33737,10 @@ async function runHook(name, arg) {
|
|
|
33728
33737
|
}
|
|
33729
33738
|
const payload = parsePayload(CLAUDE_HOST, raw);
|
|
33730
33739
|
const sessionId = getSessionId(payload);
|
|
33731
|
-
const pending = name === "stop" ? null : peekForSession(CLAUDE_HOST, sessionId);
|
|
33732
|
-
const contexts = pending?.contexts ?? [];
|
|
33733
33740
|
if (name === "user-prompt-submit") {
|
|
33734
33741
|
const ctx = buildContextSafely(CLAUDE_HOST);
|
|
33742
|
+
const pending = peekForSession(CLAUDE_HOST, sessionId, ctx?.config.jevEnabled === true);
|
|
33743
|
+
const contexts = pending.contexts;
|
|
33735
33744
|
let jevNotice = null;
|
|
33736
33745
|
if (ctx?.config.jevEnabled) {
|
|
33737
33746
|
try {
|
|
@@ -33742,10 +33751,10 @@ async function runHook(name, arg) {
|
|
|
33742
33751
|
`);
|
|
33743
33752
|
}
|
|
33744
33753
|
}
|
|
33745
|
-
|
|
33746
|
-
|
|
33747
|
-
|
|
33748
|
-
contexts.push(userPromptSubmitReminderText(hits));
|
|
33754
|
+
if (ctx && !ctx.config.jevEnabled) {
|
|
33755
|
+
const prompt = typeof payload.prompt === "string" ? payload.prompt : "";
|
|
33756
|
+
const hits = searchCaveatsSafely(CLAUDE_HOST, { topicText: prompt, failureText: prompt, surface: "user_prompt" });
|
|
33757
|
+
if (hits.length > 0) contexts.push(userPromptSubmitReminderText(hits));
|
|
33749
33758
|
}
|
|
33750
33759
|
if (ctx) {
|
|
33751
33760
|
try {
|
|
@@ -33766,6 +33775,9 @@ async function runHook(name, arg) {
|
|
|
33766
33775
|
}
|
|
33767
33776
|
if (name === "post-tool-use") {
|
|
33768
33777
|
const ctx = buildContextSafely(CLAUDE_HOST);
|
|
33778
|
+
if (ctx?.config.jevEnabled) process.exit(0);
|
|
33779
|
+
const pending = peekForSession(CLAUDE_HOST, sessionId);
|
|
33780
|
+
const contexts = pending.contexts;
|
|
33769
33781
|
if (ctx) {
|
|
33770
33782
|
try {
|
|
33771
33783
|
const prepared = prepareSessionDelivery(ctx.caveatHome, sessionId, contexts);
|
|
@@ -33973,6 +33985,7 @@ async function waitForTranscriptOutput(transcriptPath, toolUseId) {
|
|
|
33973
33985
|
return null;
|
|
33974
33986
|
}
|
|
33975
33987
|
async function processCodexWorkerJob(job, opts = { waitForTranscript: true }) {
|
|
33988
|
+
if (buildContextSafely(CODEX_HOST)?.config.jevEnabled) return;
|
|
33976
33989
|
if (!job.topicText && !job.failureText || !job.sessionId) return;
|
|
33977
33990
|
let failureText = job.failureText;
|
|
33978
33991
|
let knownError = job.knownError === true;
|
|
@@ -34077,9 +34090,9 @@ async function runCodexHook(name, arg) {
|
|
|
34077
34090
|
const sessionId = codexSessionId(payload);
|
|
34078
34091
|
if (!sessionId) process.stderr.write("[caveat:codex-hook] missing session_id; pending drain disabled\n");
|
|
34079
34092
|
if (name === "user-prompt-submit") {
|
|
34080
|
-
const pending = sessionId ? peekForSession(CODEX_HOST, sessionId) : null;
|
|
34081
|
-
const contexts = pending?.contexts ?? [];
|
|
34082
34093
|
const ctx = buildContextSafely(CODEX_HOST);
|
|
34094
|
+
const pending = sessionId ? peekForSession(CODEX_HOST, sessionId, ctx?.config.jevEnabled === true) : null;
|
|
34095
|
+
const contexts = pending?.contexts ?? [];
|
|
34083
34096
|
let jevNotice = null;
|
|
34084
34097
|
if (ctx?.config.jevEnabled) {
|
|
34085
34098
|
try {
|
|
@@ -34090,10 +34103,10 @@ async function runCodexHook(name, arg) {
|
|
|
34090
34103
|
`);
|
|
34091
34104
|
}
|
|
34092
34105
|
}
|
|
34093
|
-
|
|
34094
|
-
|
|
34095
|
-
|
|
34096
|
-
contexts.push(userPromptSubmitReminderText(hits, "native-cli"));
|
|
34106
|
+
if (ctx && !ctx.config.jevEnabled) {
|
|
34107
|
+
const prompt = typeof payload.prompt === "string" ? payload.prompt : "";
|
|
34108
|
+
const hits = searchCaveatsSafely(CODEX_HOST, { topicText: prompt, failureText: prompt, surface: "user_prompt" });
|
|
34109
|
+
if (hits.length > 0) contexts.push(userPromptSubmitReminderText(hits, "native-cli"));
|
|
34097
34110
|
}
|
|
34098
34111
|
if (ctx) {
|
|
34099
34112
|
try {
|
|
@@ -34113,6 +34126,7 @@ async function runCodexHook(name, arg) {
|
|
|
34113
34126
|
process.exit(0);
|
|
34114
34127
|
}
|
|
34115
34128
|
if (name === "post-tool-use") {
|
|
34129
|
+
if (buildContextSafely(CODEX_HOST)?.config.jevEnabled) process.exit(0);
|
|
34116
34130
|
const job = buildCodexPostToolUseWorkerJob(payload);
|
|
34117
34131
|
if (job) await processCodexWorkerJob(job, { waitForTranscript: false });
|
|
34118
34132
|
process.exit(0);
|