adhdev 0.9.4 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +161 -282
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +142 -187
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1249,35 +1249,6 @@ var init_saved_sessions = __esm({
|
|
|
1249
1249
|
}
|
|
1250
1250
|
});
|
|
1251
1251
|
|
|
1252
|
-
// ../../oss/packages/daemon-core/src/providers/provider-session-id.ts
|
|
1253
|
-
function normalizeProviderSessionId(providerType, providerSessionId) {
|
|
1254
|
-
const normalizedProviderType = typeof providerType === "string" ? providerType.trim() : "";
|
|
1255
|
-
const normalizedId = typeof providerSessionId === "string" ? providerSessionId.trim() : "";
|
|
1256
|
-
if (!normalizedId) return "";
|
|
1257
|
-
const lowered = normalizedId.toLowerCase();
|
|
1258
|
-
if (lowered === "undefined" || lowered === "null") return "";
|
|
1259
|
-
if (normalizedProviderType === "hermes-cli" && !HERMES_SESSION_ID_RE.test(normalizedId)) {
|
|
1260
|
-
return "";
|
|
1261
|
-
}
|
|
1262
|
-
if (normalizedProviderType === "claude-cli" && !CLAUDE_SESSION_ID_RE.test(normalizedId)) {
|
|
1263
|
-
return "";
|
|
1264
|
-
}
|
|
1265
|
-
return normalizedId;
|
|
1266
|
-
}
|
|
1267
|
-
function isLegacyVolatileSessionReadKey(key) {
|
|
1268
|
-
const normalizedKey = typeof key === "string" ? key.trim() : "";
|
|
1269
|
-
if (!normalizedKey) return false;
|
|
1270
|
-
return normalizedKey.startsWith("provider:codex:vscode-webview://");
|
|
1271
|
-
}
|
|
1272
|
-
var HERMES_SESSION_ID_RE, CLAUDE_SESSION_ID_RE;
|
|
1273
|
-
var init_provider_session_id = __esm({
|
|
1274
|
-
"../../oss/packages/daemon-core/src/providers/provider-session-id.ts"() {
|
|
1275
|
-
"use strict";
|
|
1276
|
-
HERMES_SESSION_ID_RE = /^\d{8}_\d{6}_[a-z0-9]+$/i;
|
|
1277
|
-
CLAUDE_SESSION_ID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
1278
|
-
}
|
|
1279
|
-
});
|
|
1280
|
-
|
|
1281
1252
|
// ../../oss/packages/daemon-core/src/config/state-store.ts
|
|
1282
1253
|
function isPlainObject2(value) {
|
|
1283
1254
|
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
@@ -1289,31 +1260,24 @@ function normalizeState(raw) {
|
|
|
1289
1260
|
const parsed = isPlainObject2(raw) ? raw : {};
|
|
1290
1261
|
const recentActivity = (Array.isArray(parsed.recentActivity) ? parsed.recentActivity : []).filter((entry) => {
|
|
1291
1262
|
if (!isPlainObject2(entry)) return false;
|
|
1292
|
-
|
|
1293
|
-
typeof entry.providerType === "string" ? entry.providerType : "",
|
|
1294
|
-
typeof entry.providerSessionId === "string" ? entry.providerSessionId : ""
|
|
1295
|
-
);
|
|
1296
|
-
if (typeof entry.providerSessionId === "string" && !normalizedId) return false;
|
|
1263
|
+
if (typeof entry.providerSessionId === "string" && !entry.providerSessionId.trim()) return false;
|
|
1297
1264
|
return true;
|
|
1298
1265
|
});
|
|
1299
1266
|
const savedProviderSessions = (Array.isArray(parsed.savedProviderSessions) ? parsed.savedProviderSessions : []).filter((entry) => {
|
|
1300
1267
|
if (!isPlainObject2(entry)) return false;
|
|
1301
|
-
return !!
|
|
1302
|
-
typeof entry.providerType === "string" ? entry.providerType : "",
|
|
1303
|
-
typeof entry.providerSessionId === "string" ? entry.providerSessionId : ""
|
|
1304
|
-
);
|
|
1268
|
+
return typeof entry.providerSessionId === "string" && !!entry.providerSessionId.trim();
|
|
1305
1269
|
});
|
|
1306
1270
|
const sessionReads = Object.fromEntries(
|
|
1307
|
-
Object.entries(isPlainObject2(parsed.sessionReads) ? parsed.sessionReads : {}).filter(([
|
|
1271
|
+
Object.entries(isPlainObject2(parsed.sessionReads) ? parsed.sessionReads : {}).filter(([, value]) => typeof value === "number" && Number.isFinite(value))
|
|
1308
1272
|
);
|
|
1309
1273
|
const sessionReadMarkers = Object.fromEntries(
|
|
1310
|
-
Object.entries(isPlainObject2(parsed.sessionReadMarkers) ? parsed.sessionReadMarkers : {}).filter(([
|
|
1274
|
+
Object.entries(isPlainObject2(parsed.sessionReadMarkers) ? parsed.sessionReadMarkers : {}).filter(([, value]) => typeof value === "string")
|
|
1311
1275
|
);
|
|
1312
1276
|
const sessionNotificationDismissals = Object.fromEntries(
|
|
1313
|
-
Object.entries(isPlainObject2(parsed.sessionNotificationDismissals) ? parsed.sessionNotificationDismissals : {}).filter(([
|
|
1277
|
+
Object.entries(isPlainObject2(parsed.sessionNotificationDismissals) ? parsed.sessionNotificationDismissals : {}).filter(([, value]) => typeof value === "string" && value.length > 0)
|
|
1314
1278
|
);
|
|
1315
1279
|
const sessionNotificationUnreadOverrides = Object.fromEntries(
|
|
1316
|
-
Object.entries(isPlainObject2(parsed.sessionNotificationUnreadOverrides) ? parsed.sessionNotificationUnreadOverrides : {}).filter(([
|
|
1280
|
+
Object.entries(isPlainObject2(parsed.sessionNotificationUnreadOverrides) ? parsed.sessionNotificationUnreadOverrides : {}).filter(([, value]) => typeof value === "string" && value.length > 0)
|
|
1317
1281
|
);
|
|
1318
1282
|
return {
|
|
1319
1283
|
recentActivity,
|
|
@@ -1351,7 +1315,6 @@ var init_state_store = __esm({
|
|
|
1351
1315
|
import_fs2 = require("fs");
|
|
1352
1316
|
import_path2 = require("path");
|
|
1353
1317
|
init_config();
|
|
1354
|
-
init_provider_session_id();
|
|
1355
1318
|
DEFAULT_STATE = {
|
|
1356
1319
|
recentActivity: [],
|
|
1357
1320
|
savedProviderSessions: [],
|
|
@@ -4046,12 +4009,21 @@ var init_control_effects = __esm({
|
|
|
4046
4009
|
function normalizeHistoryComparable(text) {
|
|
4047
4010
|
return String(text || "").replace(/\s+/g, " ").trim();
|
|
4048
4011
|
}
|
|
4049
|
-
function cleanupHistoryContent(agentType, role, content) {
|
|
4012
|
+
function cleanupHistoryContent(agentType, role, content, historyBehavior) {
|
|
4050
4013
|
let value = String(content || "").replace(/\r\n/g, "\n").trim();
|
|
4051
4014
|
if (!value) return "";
|
|
4052
|
-
if (
|
|
4053
|
-
const
|
|
4054
|
-
|
|
4015
|
+
if (role === "assistant" && historyBehavior?.filterAssistantPatterns?.length) {
|
|
4016
|
+
const filters = historyBehavior.filterAssistantPatterns.map((p) => {
|
|
4017
|
+
try {
|
|
4018
|
+
return new RegExp(p, "i");
|
|
4019
|
+
} catch {
|
|
4020
|
+
return null;
|
|
4021
|
+
}
|
|
4022
|
+
}).filter(Boolean);
|
|
4023
|
+
if (filters.length > 0) {
|
|
4024
|
+
const filtered = value.split("\n").filter((line) => !filters.some((re) => re.test(line.trim()))).join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
4025
|
+
value = filtered;
|
|
4026
|
+
}
|
|
4055
4027
|
}
|
|
4056
4028
|
return value;
|
|
4057
4029
|
}
|
|
@@ -4068,8 +4040,8 @@ function isAdjacentHistoryDuplicate(agentType, previous, next) {
|
|
|
4068
4040
|
if (!previous || !next) return false;
|
|
4069
4041
|
return buildHistoryMessageSignature(agentType, previous) === buildHistoryMessageSignature(agentType, next);
|
|
4070
4042
|
}
|
|
4071
|
-
function collapseReplayAssistantTurns(
|
|
4072
|
-
if (
|
|
4043
|
+
function collapseReplayAssistantTurns(messages, historyBehavior) {
|
|
4044
|
+
if (!historyBehavior?.collapseConsecutiveAssistantTurns) return messages;
|
|
4073
4045
|
const collapsed = [];
|
|
4074
4046
|
let sawAssistantSinceLastUser = false;
|
|
4075
4047
|
for (const message of messages) {
|
|
@@ -4174,16 +4146,12 @@ function listHistoryFiles(dir, historySessionId) {
|
|
|
4174
4146
|
return true;
|
|
4175
4147
|
}).sort().reverse();
|
|
4176
4148
|
}
|
|
4177
|
-
function normalizeSavedHistorySessionId(
|
|
4178
|
-
|
|
4179
|
-
if (!normalizedId) return "";
|
|
4180
|
-
const strictProviderId = normalizeProviderSessionId(agentType, normalizedId);
|
|
4181
|
-
if (strictProviderId) return strictProviderId;
|
|
4182
|
-
return agentType === "hermes-cli" ? "" : normalizedId;
|
|
4149
|
+
function normalizeSavedHistorySessionId(historySessionId) {
|
|
4150
|
+
return String(historySessionId || "").trim();
|
|
4183
4151
|
}
|
|
4184
|
-
function extractSavedHistorySessionIdFromFile(
|
|
4152
|
+
function extractSavedHistorySessionIdFromFile(file2) {
|
|
4185
4153
|
const match = file2.match(/^([A-Za-z0-9_-]+)_\d{4}-\d{2}-\d{2}\.jsonl$/);
|
|
4186
|
-
return normalizeSavedHistorySessionId(
|
|
4154
|
+
return normalizeSavedHistorySessionId(match?.[1] || "");
|
|
4187
4155
|
}
|
|
4188
4156
|
function buildSavedHistoryFileSignatureMap(dir, files) {
|
|
4189
4157
|
return new Map(files.map((file2) => {
|
|
@@ -4362,7 +4330,7 @@ function persistSavedHistoryFileSummaryEntry(agentType, dir, file2, updater) {
|
|
|
4362
4330
|
}
|
|
4363
4331
|
}
|
|
4364
4332
|
function updateSavedHistoryIndexForSessionStart(agentType, dir, file2, historySessionId, workspace) {
|
|
4365
|
-
const normalizedSessionId = normalizeSavedHistorySessionId(
|
|
4333
|
+
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
|
|
4366
4334
|
const normalizedWorkspace = String(workspace || "").trim();
|
|
4367
4335
|
if (!normalizedSessionId || !normalizedWorkspace) return;
|
|
4368
4336
|
persistSavedHistoryFileSummaryEntry(agentType, dir, file2, (currentSummary) => ({
|
|
@@ -4377,7 +4345,7 @@ function updateSavedHistoryIndexForSessionStart(agentType, dir, file2, historySe
|
|
|
4377
4345
|
}));
|
|
4378
4346
|
}
|
|
4379
4347
|
function updateSavedHistoryIndexForAppendedMessages(agentType, dir, file2, historySessionId, messages) {
|
|
4380
|
-
const normalizedSessionId = normalizeSavedHistorySessionId(
|
|
4348
|
+
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId || "");
|
|
4381
4349
|
if (!normalizedSessionId || messages.length === 0) return;
|
|
4382
4350
|
persistSavedHistoryFileSummaryEntry(agentType, dir, file2, (currentSummary) => {
|
|
4383
4351
|
const nextSummary = {
|
|
@@ -4414,8 +4382,8 @@ function updateSavedHistoryIndexForAppendedMessages(agentType, dir, file2, histo
|
|
|
4414
4382
|
return nextSummary;
|
|
4415
4383
|
});
|
|
4416
4384
|
}
|
|
4417
|
-
function computeSavedHistoryFileSummary(
|
|
4418
|
-
const historySessionId = extractSavedHistorySessionIdFromFile(
|
|
4385
|
+
function computeSavedHistoryFileSummary(dir, file2) {
|
|
4386
|
+
const historySessionId = extractSavedHistorySessionIdFromFile(file2);
|
|
4419
4387
|
if (!historySessionId) return null;
|
|
4420
4388
|
const filePath = path7.join(dir, file2);
|
|
4421
4389
|
const content = fs3.readFileSync(filePath, "utf-8");
|
|
@@ -4509,7 +4477,7 @@ function computeSavedHistorySessionSummaries(agentType, dir, files, fileSignatur
|
|
|
4509
4477
|
const cached2 = savedHistoryFileSummaryCache.get(filePath);
|
|
4510
4478
|
const persisted = persistedEntries.get(file2);
|
|
4511
4479
|
const reusableEntry = cached2?.signature === signature ? cached2 : persisted?.signature === signature ? persisted : null;
|
|
4512
|
-
const fileSummary = reusableEntry?.summary || computeSavedHistoryFileSummary(
|
|
4480
|
+
const fileSummary = reusableEntry?.summary || computeSavedHistoryFileSummary(dir, file2);
|
|
4513
4481
|
const nextEntry = reusableEntry || {
|
|
4514
4482
|
signature,
|
|
4515
4483
|
summary: fileSummary
|
|
@@ -4555,7 +4523,7 @@ function computeSavedHistorySessionSummaries(agentType, dir, files, fileSignatur
|
|
|
4555
4523
|
persistedEntries: nextPersistedEntries
|
|
4556
4524
|
};
|
|
4557
4525
|
}
|
|
4558
|
-
function readChatHistory(agentType, offset = 0, limit = 30, historySessionId, excludeRecentCount = 0) {
|
|
4526
|
+
function readChatHistory(agentType, offset = 0, limit = 30, historySessionId, excludeRecentCount = 0, historyBehavior) {
|
|
4559
4527
|
try {
|
|
4560
4528
|
const sanitized = agentType.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
4561
4529
|
const dir = path7.join(HISTORY_DIR, sanitized);
|
|
@@ -4590,7 +4558,7 @@ function readChatHistory(agentType, offset = 0, limit = 30, historySessionId, ex
|
|
|
4590
4558
|
chronological.push(message);
|
|
4591
4559
|
if (message.role !== "system") lastTurn = message;
|
|
4592
4560
|
}
|
|
4593
|
-
const collapsed = collapseReplayAssistantTurns(
|
|
4561
|
+
const collapsed = collapseReplayAssistantTurns(chronological, historyBehavior);
|
|
4594
4562
|
const boundedLimit = Math.max(1, limit);
|
|
4595
4563
|
const boundedOffset = Math.max(0, offset);
|
|
4596
4564
|
const boundedExclude = Math.max(0, Math.min(excludeRecentCount, collapsed.length));
|
|
@@ -4603,7 +4571,7 @@ function readChatHistory(agentType, offset = 0, limit = 30, historySessionId, ex
|
|
|
4603
4571
|
return { messages: [], hasMore: false };
|
|
4604
4572
|
}
|
|
4605
4573
|
}
|
|
4606
|
-
function listSavedHistorySessions(agentType, options = {}) {
|
|
4574
|
+
function listSavedHistorySessions(agentType, options = {}, historyBehavior) {
|
|
4607
4575
|
try {
|
|
4608
4576
|
const sanitized = agentType.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
4609
4577
|
const dir = path7.join(HISTORY_DIR, sanitized);
|
|
@@ -4734,7 +4702,7 @@ function rewriteCanonicalSavedHistory(agentType, historySessionId, records) {
|
|
|
4734
4702
|
}
|
|
4735
4703
|
}
|
|
4736
4704
|
function rebuildHermesSavedHistoryFromCanonicalSession(historySessionId) {
|
|
4737
|
-
const normalizedSessionId = normalizeSavedHistorySessionId(
|
|
4705
|
+
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
|
|
4738
4706
|
if (!normalizedSessionId) return false;
|
|
4739
4707
|
try {
|
|
4740
4708
|
const sessionFilePath = path7.join(os6.homedir(), ".hermes", "sessions", `session_${normalizedSessionId}.json`);
|
|
@@ -4883,7 +4851,7 @@ function extractClaudeUserContentParts(content) {
|
|
|
4883
4851
|
return parts;
|
|
4884
4852
|
}
|
|
4885
4853
|
function rebuildClaudeSavedHistoryFromNativeProject(historySessionId, workspace) {
|
|
4886
|
-
const normalizedSessionId = normalizeSavedHistorySessionId(
|
|
4854
|
+
const normalizedSessionId = normalizeSavedHistorySessionId(historySessionId);
|
|
4887
4855
|
if (!normalizedSessionId) return false;
|
|
4888
4856
|
try {
|
|
4889
4857
|
const transcriptPath = resolveClaudeProjectTranscriptPath(normalizedSessionId, workspace);
|
|
@@ -4960,7 +4928,7 @@ function rebuildClaudeSavedHistoryFromNativeProject(historySessionId, workspace)
|
|
|
4960
4928
|
return false;
|
|
4961
4929
|
}
|
|
4962
4930
|
}
|
|
4963
|
-
var fs3, path7, os6, HISTORY_DIR, RETAIN_DAYS, SAVED_HISTORY_INDEX_VERSION, SAVED_HISTORY_INDEX_FILE, SAVED_HISTORY_INDEX_LOCK_SUFFIX, SAVED_HISTORY_INDEX_LOCK_WAIT_MS, SAVED_HISTORY_INDEX_LOCK_STALE_MS, SAVED_HISTORY_INDEX_LOCK_POLL_MS, SAVED_HISTORY_ROLLUP_THRESHOLD_BYTES, savedHistorySessionCache, savedHistoryFileSummaryCache, savedHistoryBackgroundRefresh, savedHistoryRollupInFlight,
|
|
4931
|
+
var fs3, path7, os6, HISTORY_DIR, RETAIN_DAYS, SAVED_HISTORY_INDEX_VERSION, SAVED_HISTORY_INDEX_FILE, SAVED_HISTORY_INDEX_LOCK_SUFFIX, SAVED_HISTORY_INDEX_LOCK_WAIT_MS, SAVED_HISTORY_INDEX_LOCK_STALE_MS, SAVED_HISTORY_INDEX_LOCK_POLL_MS, SAVED_HISTORY_ROLLUP_THRESHOLD_BYTES, savedHistorySessionCache, savedHistoryFileSummaryCache, savedHistoryBackgroundRefresh, savedHistoryRollupInFlight, ChatHistoryWriter;
|
|
4964
4932
|
var init_chat_history = __esm({
|
|
4965
4933
|
"../../oss/packages/daemon-core/src/config/chat-history.ts"() {
|
|
4966
4934
|
"use strict";
|
|
@@ -4968,7 +4936,6 @@ var init_chat_history = __esm({
|
|
|
4968
4936
|
path7 = __toESM(require("path"));
|
|
4969
4937
|
os6 = __toESM(require("os"));
|
|
4970
4938
|
init_chat_message_normalization();
|
|
4971
|
-
init_provider_session_id();
|
|
4972
4939
|
HISTORY_DIR = path7.join(os6.homedir(), ".adhdev", "history");
|
|
4973
4940
|
RETAIN_DAYS = 30;
|
|
4974
4941
|
SAVED_HISTORY_INDEX_VERSION = 1;
|
|
@@ -4982,7 +4949,6 @@ var init_chat_history = __esm({
|
|
|
4982
4949
|
savedHistoryFileSummaryCache = /* @__PURE__ */ new Map();
|
|
4983
4950
|
savedHistoryBackgroundRefresh = /* @__PURE__ */ new Set();
|
|
4984
4951
|
savedHistoryRollupInFlight = /* @__PURE__ */ new Set();
|
|
4985
|
-
CODEX_STARTER_PROMPT_RE = /^(?:[›❯]\s*)?(?:Find and fix a bug in @filename|Improve documentation in @filename|Write tests for @filename|Explain this codebase|Summarize recent commits|Implement \{feature\}|Use \/skills(?: to list available skills)?|Run \/review on my current changes)$/i;
|
|
4986
4952
|
ChatHistoryWriter = class {
|
|
4987
4953
|
/** Last seen message count per agent (deduplication) */
|
|
4988
4954
|
lastSeenCounts = /* @__PURE__ */ new Map();
|
|
@@ -5235,7 +5201,7 @@ var init_chat_history = __esm({
|
|
|
5235
5201
|
} catch {
|
|
5236
5202
|
}
|
|
5237
5203
|
}
|
|
5238
|
-
compactHistorySession(agentType, historySessionId) {
|
|
5204
|
+
compactHistorySession(agentType, historySessionId, historyBehavior) {
|
|
5239
5205
|
const sessionId = String(historySessionId || "").trim();
|
|
5240
5206
|
if (!sessionId) return;
|
|
5241
5207
|
try {
|
|
@@ -5273,7 +5239,7 @@ var init_chat_history = __esm({
|
|
|
5273
5239
|
dedupedAdjacent.push(entry);
|
|
5274
5240
|
if (entry.role !== "system") lastTurn = entry;
|
|
5275
5241
|
}
|
|
5276
|
-
const collapsed = collapseReplayAssistantTurns(
|
|
5242
|
+
const collapsed = collapseReplayAssistantTurns(dedupedAdjacent, historyBehavior);
|
|
5277
5243
|
if (collapsed.length === 0) {
|
|
5278
5244
|
fs3.unlinkSync(filePath);
|
|
5279
5245
|
continue;
|
|
@@ -9718,7 +9684,8 @@ async function executeProviderScript(h, args, scriptName) {
|
|
|
9718
9684
|
}
|
|
9719
9685
|
const managed = runtimeSessionId ? h.agentStream?.getManagedSession(runtimeSessionId) : null;
|
|
9720
9686
|
const targetSessionId = managed?.cdpSessionId || null;
|
|
9721
|
-
const
|
|
9687
|
+
const DEFAULT_IDE_LEVEL_SCRIPTS = ["listModes", "setMode", "listModels", "setModel"];
|
|
9688
|
+
const IDE_LEVEL_SCRIPTS = provider.ideLevelScripts ?? DEFAULT_IDE_LEVEL_SCRIPTS;
|
|
9722
9689
|
if (IDE_LEVEL_SCRIPTS.includes(scriptName)) {
|
|
9723
9690
|
if (targetSessionId) {
|
|
9724
9691
|
try {
|
|
@@ -14599,6 +14566,28 @@ ${data.message || ""}`.trim();
|
|
|
14599
14566
|
}
|
|
14600
14567
|
});
|
|
14601
14568
|
|
|
14569
|
+
// ../../oss/packages/daemon-core/src/providers/provider-session-id.ts
|
|
14570
|
+
function normalizeProviderSessionId(provider, providerSessionId) {
|
|
14571
|
+
const normalizedId = typeof providerSessionId === "string" ? providerSessionId.trim() : "";
|
|
14572
|
+
if (!normalizedId) return "";
|
|
14573
|
+
const lowered = normalizedId.toLowerCase();
|
|
14574
|
+
if (lowered === "undefined" || lowered === "null") return "";
|
|
14575
|
+
const sessionIdPattern = provider?.sessionIdPattern;
|
|
14576
|
+
if (sessionIdPattern) {
|
|
14577
|
+
try {
|
|
14578
|
+
const re = new RegExp(sessionIdPattern, "i");
|
|
14579
|
+
if (!re.test(normalizedId)) return "";
|
|
14580
|
+
} catch {
|
|
14581
|
+
}
|
|
14582
|
+
}
|
|
14583
|
+
return normalizedId;
|
|
14584
|
+
}
|
|
14585
|
+
var init_provider_session_id = __esm({
|
|
14586
|
+
"../../oss/packages/daemon-core/src/providers/provider-session-id.ts"() {
|
|
14587
|
+
"use strict";
|
|
14588
|
+
}
|
|
14589
|
+
});
|
|
14590
|
+
|
|
14602
14591
|
// ../../oss/packages/daemon-core/src/providers/cli-provider-instance.ts
|
|
14603
14592
|
function normalizePersistableCliHistoryContent(content) {
|
|
14604
14593
|
return flattenContent(content).replace(/\s+/g, " ").trim();
|
|
@@ -14776,32 +14765,10 @@ var init_cli_provider_instance = __esm({
|
|
|
14776
14765
|
}
|
|
14777
14766
|
async onTick() {
|
|
14778
14767
|
if (this.providerSessionId) return;
|
|
14779
|
-
if (this.
|
|
14780
|
-
let probedSessionId = null;
|
|
14768
|
+
if (this.provider.resume?.skipProbeOnNewSession && this.launchMode === "new") return;
|
|
14781
14769
|
const probeConfig = this.provider.sessionProbe;
|
|
14782
|
-
if (probeConfig)
|
|
14783
|
-
|
|
14784
|
-
} else {
|
|
14785
|
-
if (this.type === "opencode-cli") {
|
|
14786
|
-
probedSessionId = this.probeSessionIdFromConfig({
|
|
14787
|
-
dbPath: "~/.local/share/opencode/opencode.db",
|
|
14788
|
-
query: "select id from session where directory in ({dirs}) and time_created >= ? and time_archived is null order by time_updated desc limit 1",
|
|
14789
|
-
timestampFormat: "unix_ms"
|
|
14790
|
-
});
|
|
14791
|
-
} else if (this.type === "codex-cli") {
|
|
14792
|
-
probedSessionId = this.probeSessionIdFromConfig({
|
|
14793
|
-
dbPath: "~/.codex/state_5.sqlite",
|
|
14794
|
-
query: "select id from threads where cwd in ({dirs}) and updated_at >= ? and archived = 0 order by updated_at desc limit 1",
|
|
14795
|
-
timestampFormat: "unix_s"
|
|
14796
|
-
});
|
|
14797
|
-
} else if (this.type === "goose-cli") {
|
|
14798
|
-
probedSessionId = this.probeSessionIdFromConfig({
|
|
14799
|
-
dbPath: "~/.local/share/goose/sessions/sessions.db",
|
|
14800
|
-
query: "select id from sessions where working_dir in ({dirs}) and created_at >= ? order by updated_at desc limit 1",
|
|
14801
|
-
timestampFormat: "iso"
|
|
14802
|
-
});
|
|
14803
|
-
}
|
|
14804
|
-
}
|
|
14770
|
+
if (!probeConfig) return;
|
|
14771
|
+
const probedSessionId = this.probeSessionIdFromConfig(probeConfig);
|
|
14805
14772
|
if (probedSessionId) {
|
|
14806
14773
|
this.promoteProviderSessionId(probedSessionId);
|
|
14807
14774
|
}
|
|
@@ -14853,7 +14820,7 @@ var init_cli_provider_instance = __esm({
|
|
|
14853
14820
|
const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
|
|
14854
14821
|
const visibleStatus = parseErrorMessage ? "error" : autoApproveActive ? "generating" : adapterStatus.status;
|
|
14855
14822
|
const parsedProviderSessionId = normalizeProviderSessionId(
|
|
14856
|
-
this.
|
|
14823
|
+
this.provider,
|
|
14857
14824
|
typeof parsedStatus?.providerSessionId === "string" ? parsedStatus.providerSessionId : ""
|
|
14858
14825
|
);
|
|
14859
14826
|
if (parsedProviderSessionId) {
|
|
@@ -15143,7 +15110,7 @@ var init_cli_provider_instance = __esm({
|
|
|
15143
15110
|
applyProviderResponse(data, options) {
|
|
15144
15111
|
if (!data || typeof data !== "object") return;
|
|
15145
15112
|
const patchedProviderSessionId = normalizeProviderSessionId(
|
|
15146
|
-
this.
|
|
15113
|
+
this.provider,
|
|
15147
15114
|
typeof data.providerSessionId === "string" ? data.providerSessionId : ""
|
|
15148
15115
|
);
|
|
15149
15116
|
if (patchedProviderSessionId) {
|
|
@@ -15381,52 +15348,39 @@ ${effect.notification.body || ""}`.trim();
|
|
|
15381
15348
|
}
|
|
15382
15349
|
syncCanonicalSavedHistoryIfNeeded() {
|
|
15383
15350
|
if (!this.providerSessionId) return false;
|
|
15384
|
-
|
|
15385
|
-
|
|
15386
|
-
|
|
15387
|
-
|
|
15388
|
-
|
|
15351
|
+
const canonicalHistory = this.provider.canonicalHistory;
|
|
15352
|
+
if (!canonicalHistory) return false;
|
|
15353
|
+
try {
|
|
15354
|
+
let rebuilt = false;
|
|
15355
|
+
if (canonicalHistory.format === "hermes-json") {
|
|
15356
|
+
const watchPath = canonicalHistory.watchPath.replace(/^~/, os14.homedir()).replace("{{sessionId}}", this.providerSessionId);
|
|
15357
|
+
if (!fs5.existsSync(watchPath)) return false;
|
|
15358
|
+
const stat4 = fs5.statSync(watchPath);
|
|
15389
15359
|
if (stat4.mtimeMs <= this.lastCanonicalHermesSyncMtimeMs) return true;
|
|
15390
|
-
|
|
15391
|
-
if (
|
|
15392
|
-
|
|
15393
|
-
|
|
15394
|
-
|
|
15395
|
-
|
|
15396
|
-
|
|
15397
|
-
|
|
15398
|
-
|
|
15399
|
-
|
|
15400
|
-
|
|
15401
|
-
|
|
15402
|
-
|
|
15403
|
-
|
|
15404
|
-
|
|
15405
|
-
}
|
|
15406
|
-
|
|
15407
|
-
try {
|
|
15408
|
-
const rebuilt = rebuildClaudeSavedHistoryFromNativeProject(this.providerSessionId, this.workingDir);
|
|
15409
|
-
if (!rebuilt) return false;
|
|
15410
|
-
const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId);
|
|
15411
|
-
this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
|
|
15412
|
-
role: message.role,
|
|
15413
|
-
content: message.content,
|
|
15414
|
-
kind: message.kind,
|
|
15415
|
-
senderName: message.senderName,
|
|
15416
|
-
receivedAt: message.receivedAt
|
|
15417
|
-
}));
|
|
15418
|
-
return true;
|
|
15419
|
-
} catch {
|
|
15420
|
-
return false;
|
|
15421
|
-
}
|
|
15360
|
+
rebuilt = rebuildHermesSavedHistoryFromCanonicalSession(this.providerSessionId);
|
|
15361
|
+
if (rebuilt) this.lastCanonicalHermesSyncMtimeMs = stat4.mtimeMs;
|
|
15362
|
+
} else if (canonicalHistory.format === "claude-jsonl") {
|
|
15363
|
+
rebuilt = rebuildClaudeSavedHistoryFromNativeProject(this.providerSessionId, this.workingDir);
|
|
15364
|
+
}
|
|
15365
|
+
if (!rebuilt) return false;
|
|
15366
|
+
const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId, 0, this.provider.historyBehavior);
|
|
15367
|
+
this.lastPersistedHistoryMessages = restoredHistory.messages.map((message) => ({
|
|
15368
|
+
role: message.role,
|
|
15369
|
+
content: message.content,
|
|
15370
|
+
kind: message.kind,
|
|
15371
|
+
senderName: message.senderName,
|
|
15372
|
+
receivedAt: message.receivedAt
|
|
15373
|
+
}));
|
|
15374
|
+
return true;
|
|
15375
|
+
} catch {
|
|
15376
|
+
return false;
|
|
15422
15377
|
}
|
|
15423
|
-
return false;
|
|
15424
15378
|
}
|
|
15425
15379
|
restorePersistedHistoryFromCurrentSession() {
|
|
15426
15380
|
if (!this.providerSessionId) return;
|
|
15427
15381
|
this.syncCanonicalSavedHistoryIfNeeded();
|
|
15428
|
-
this.historyWriter.compactHistorySession(this.type, this.providerSessionId);
|
|
15429
|
-
const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId);
|
|
15382
|
+
this.historyWriter.compactHistorySession(this.type, this.providerSessionId, this.provider.historyBehavior);
|
|
15383
|
+
const restoredHistory = readChatHistory(this.type, 0, Number.MAX_SAFE_INTEGER, this.providerSessionId, 0, this.provider.historyBehavior);
|
|
15430
15384
|
this.historyWriter.seedSessionHistory(
|
|
15431
15385
|
this.type,
|
|
15432
15386
|
restoredHistory.messages,
|
|
@@ -32978,14 +32932,15 @@ function expandResumeArgs(template, sessionId) {
|
|
|
32978
32932
|
if (!Array.isArray(template) || template.length === 0) return void 0;
|
|
32979
32933
|
return template.map((part) => part === "{{id}}" ? sessionId : part);
|
|
32980
32934
|
}
|
|
32981
|
-
function
|
|
32982
|
-
const resumeIndex = args.findIndex((arg) => arg
|
|
32935
|
+
function readSubcommandSessionId(args, subcommands) {
|
|
32936
|
+
const resumeIndex = args.findIndex((arg) => subcommands.includes(arg));
|
|
32983
32937
|
if (resumeIndex < 0) return void 0;
|
|
32984
32938
|
const candidate = args[resumeIndex + 1];
|
|
32985
32939
|
if (!candidate || candidate.startsWith("-")) return void 0;
|
|
32986
32940
|
return candidate;
|
|
32987
32941
|
}
|
|
32988
|
-
function detectExplicitProviderSessionId(
|
|
32942
|
+
function detectExplicitProviderSessionId(provider, args) {
|
|
32943
|
+
const resume = provider?.resume;
|
|
32989
32944
|
const explicitResumeId = readArgValue(args, ["--resume", "-r"]);
|
|
32990
32945
|
if (explicitResumeId) {
|
|
32991
32946
|
return { providerSessionId: explicitResumeId, launchMode: "resume" };
|
|
@@ -32999,19 +32954,20 @@ function detectExplicitProviderSessionId(normalizedType, args) {
|
|
|
32999
32954
|
}
|
|
33000
32955
|
const explicitSessionId = readArgValue(args, ["--session-id"]);
|
|
33001
32956
|
if (explicitSessionId) {
|
|
33002
|
-
if (
|
|
32957
|
+
if (resume?.sessionIdIsNewByDefault && !hasArg(args, ["--resume", "-r"])) {
|
|
33003
32958
|
return { launchMode: "manual" };
|
|
33004
32959
|
}
|
|
33005
|
-
const isResume =
|
|
32960
|
+
const isResume = resume?.sessionIdIsNewByDefault ? hasArg(args, ["--resume", "-r"]) : hasArg(args, ["--continue"]) || hasArg(args, ["--resume", "-r"]);
|
|
33006
32961
|
return {
|
|
33007
32962
|
providerSessionId: explicitSessionId,
|
|
33008
32963
|
launchMode: isResume ? "resume" : "new"
|
|
33009
32964
|
};
|
|
33010
32965
|
}
|
|
33011
|
-
|
|
33012
|
-
|
|
33013
|
-
|
|
33014
|
-
|
|
32966
|
+
const subcommands = resume?.sessionIdFromSubcommand;
|
|
32967
|
+
if (Array.isArray(subcommands) && subcommands.length > 0) {
|
|
32968
|
+
const subcommandSessionId = readSubcommandSessionId(args, subcommands);
|
|
32969
|
+
if (subcommandSessionId) {
|
|
32970
|
+
return { providerSessionId: subcommandSessionId, launchMode: "resume" };
|
|
33015
32971
|
}
|
|
33016
32972
|
}
|
|
33017
32973
|
return { launchMode: "manual" };
|
|
@@ -33028,7 +32984,7 @@ function resolveCliSessionBinding(provider, normalizedType, cliArgs, requestedRe
|
|
|
33028
32984
|
if (!resume?.supported) {
|
|
33029
32985
|
return { cliArgs: baseArgs, launchMode: "manual" };
|
|
33030
32986
|
}
|
|
33031
|
-
const explicit = detectExplicitProviderSessionId(
|
|
32987
|
+
const explicit = detectExplicitProviderSessionId(provider, baseArgs || []);
|
|
33032
32988
|
if (explicit.providerSessionId) {
|
|
33033
32989
|
return {
|
|
33034
32990
|
cliArgs: baseArgs,
|
|
@@ -33036,6 +32992,12 @@ function resolveCliSessionBinding(provider, normalizedType, cliArgs, requestedRe
|
|
|
33036
32992
|
launchMode: explicit.launchMode
|
|
33037
32993
|
};
|
|
33038
32994
|
}
|
|
32995
|
+
if (explicit.launchMode === "manual" && hasArg(baseArgs || [], ["--session-id"])) {
|
|
32996
|
+
return {
|
|
32997
|
+
cliArgs: baseArgs,
|
|
32998
|
+
launchMode: "manual"
|
|
32999
|
+
};
|
|
33000
|
+
}
|
|
33039
33001
|
if (requestedResumeSessionId) {
|
|
33040
33002
|
if (resume.sessionIdFormat === "uuid" && !isUuid(requestedResumeSessionId)) {
|
|
33041
33003
|
throw new Error(`Invalid ${provider?.displayName || provider?.name || normalizedType} session ID: ${requestedResumeSessionId}`);
|
|
@@ -35638,6 +35600,11 @@ var init_provider_schema = __esm({
|
|
|
35638
35600
|
"resume",
|
|
35639
35601
|
"sessionProbe",
|
|
35640
35602
|
"approvalPositiveHints",
|
|
35603
|
+
"sessionIdPattern",
|
|
35604
|
+
"historyBehavior",
|
|
35605
|
+
"canonicalHistory",
|
|
35606
|
+
"autoFixProfile",
|
|
35607
|
+
"ideLevelScripts",
|
|
35641
35608
|
"scripts",
|
|
35642
35609
|
"vscodeCommands",
|
|
35643
35610
|
"inputMethod",
|
|
@@ -42989,20 +42956,13 @@ function tryKillAutoImplProcess(processRef, signal) {
|
|
|
42989
42956
|
} catch {
|
|
42990
42957
|
}
|
|
42991
42958
|
}
|
|
42959
|
+
function shouldScheduleAutoStopOnQuiet(options) {
|
|
42960
|
+
return !!options.verification && options.autoImpl?.autoStopOnQuiet === true;
|
|
42961
|
+
}
|
|
42992
42962
|
function getDefaultAutoImplReference(ctx, category, type) {
|
|
42993
|
-
|
|
42994
|
-
|
|
42995
|
-
|
|
42996
|
-
if (category === "extension") {
|
|
42997
|
-
const preferred = ["claude-code-vscode", "codex", "cline", "roo-code"];
|
|
42998
|
-
for (const ref of preferred) {
|
|
42999
|
-
if (ref === type) continue;
|
|
43000
|
-
if (ctx.providerLoader.resolve(ref) || ctx.providerLoader.getMeta(ref)) return ref;
|
|
43001
|
-
}
|
|
43002
|
-
const all = ctx.providerLoader.getAll();
|
|
43003
|
-
const fb = all.find((p) => p.category === "extension" && p.type !== type);
|
|
43004
|
-
if (fb?.type) return fb.type;
|
|
43005
|
-
}
|
|
42963
|
+
const all = ctx.providerLoader.getAll();
|
|
42964
|
+
const sameCategoryOther = all.find((p) => p.category === category && p.type !== type);
|
|
42965
|
+
if (sameCategoryOther?.type) return sameCategoryOther.type;
|
|
43006
42966
|
return "antigravity";
|
|
43007
42967
|
}
|
|
43008
42968
|
function resolveAutoImplReference(ctx, category, requestedReference, targetType) {
|
|
@@ -43320,37 +43280,33 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
43320
43280
|
return;
|
|
43321
43281
|
}
|
|
43322
43282
|
const command = spawn6.command;
|
|
43283
|
+
const autoImpl = spawn6.autoImpl;
|
|
43323
43284
|
const interactiveFlags = ["--yolo", "--interactive", "-i"];
|
|
43324
43285
|
const baseArgs = [...spawn6.args || []].filter((a) => !interactiveFlags.includes(a));
|
|
43325
43286
|
let shellCmd;
|
|
43326
43287
|
const isWin = os23.platform() === "win32";
|
|
43327
43288
|
const escapeArg = (a) => isWin ? `"${a.replace(/"/g, '""')}"` : `'${a.replace(/'/g, "'\\''")}'`;
|
|
43328
|
-
|
|
43329
|
-
|
|
43289
|
+
const promptMode = autoImpl?.promptMode ?? "stdin";
|
|
43290
|
+
const extraArgs = autoImpl?.extraArgs ?? [];
|
|
43291
|
+
const rawMetaPrompt = autoImpl?.metaPrompt ? autoImpl.metaPrompt.replace("{{promptFile}}", promptFile) : `Read the file at ${promptFile} and follow ALL the instructions in it exactly. Do not ask questions, just execute.`;
|
|
43292
|
+
if (promptMode === "flag") {
|
|
43293
|
+
const flag = autoImpl?.promptFlag ?? "-p";
|
|
43294
|
+
const args = [...baseArgs, ...extraArgs];
|
|
43330
43295
|
if (model) args.push("--model", model);
|
|
43331
43296
|
const escapedArgs = args.map(escapeArg).join(" ");
|
|
43332
|
-
|
|
43333
|
-
|
|
43334
|
-
|
|
43335
|
-
const args = [...baseArgs
|
|
43336
|
-
|
|
43337
|
-
|
|
43338
|
-
const metaPrompt = `Read the file at ${promptFile} and follow ALL the instructions in it exactly. Do not ask questions, just execute.`;
|
|
43339
|
-
shellCmd = `${command} ${escapedArgs} -p ${escapeArg(metaPrompt)}`;
|
|
43340
|
-
} else if (command === "codex") {
|
|
43341
|
-
const args = ["exec", ...baseArgs];
|
|
43342
|
-
if (!args.includes("--dangerously-bypass-approvals-and-sandbox")) {
|
|
43343
|
-
args.push("--dangerously-bypass-approvals-and-sandbox");
|
|
43344
|
-
}
|
|
43345
|
-
if (!args.includes("--skip-git-repo-check")) {
|
|
43346
|
-
args.push("--skip-git-repo-check");
|
|
43297
|
+
shellCmd = `${command} ${escapedArgs} ${flag} ${escapeArg(rawMetaPrompt)}`;
|
|
43298
|
+
} else if (promptMode === "subcommand") {
|
|
43299
|
+
const subcommand = autoImpl?.subcommand ?? "";
|
|
43300
|
+
const args = subcommand ? [subcommand, ...baseArgs] : [...baseArgs];
|
|
43301
|
+
for (const extra of extraArgs) {
|
|
43302
|
+
if (!args.includes(extra)) args.push(extra);
|
|
43347
43303
|
}
|
|
43348
43304
|
if (model) args.push("--model", model);
|
|
43349
43305
|
const escapedArgs = args.map(escapeArg).join(" ");
|
|
43350
|
-
|
|
43351
|
-
shellCmd = `${command} ${escapedArgs} ${escapeArg(metaPrompt)}`;
|
|
43306
|
+
shellCmd = `${command} ${escapedArgs} ${escapeArg(rawMetaPrompt)}`;
|
|
43352
43307
|
} else {
|
|
43353
|
-
const
|
|
43308
|
+
const args = [...baseArgs, ...extraArgs];
|
|
43309
|
+
const escapedArgs = args.map(escapeArg).join(" ");
|
|
43354
43310
|
if (isWin) {
|
|
43355
43311
|
shellCmd = `type "${promptFile}" | ${command} ${escapedArgs}`;
|
|
43356
43312
|
} else {
|
|
@@ -43385,8 +43341,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
43385
43341
|
stdio: ["pipe", "pipe", "pipe"],
|
|
43386
43342
|
env: {
|
|
43387
43343
|
...process.env,
|
|
43388
|
-
...spawn6.env || {}
|
|
43389
|
-
...command === "gemini" ? { SANDBOX: "1", GEMINI_CLI_NO_RELAUNCH: "1" } : {}
|
|
43344
|
+
...spawn6.env || {}
|
|
43390
43345
|
}
|
|
43391
43346
|
});
|
|
43392
43347
|
child.on("error", (err2) => {
|
|
@@ -43448,7 +43403,7 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
43448
43403
|
}
|
|
43449
43404
|
};
|
|
43450
43405
|
const scheduleAutoStopForVerification = () => {
|
|
43451
|
-
if (!verification
|
|
43406
|
+
if (!shouldScheduleAutoStopOnQuiet({ verification, autoImpl }) || completionSignalSeen || autoStopIssued) return;
|
|
43452
43407
|
const elapsed = Date.now() - spawnedAt;
|
|
43453
43408
|
if (elapsed < 3e4) return;
|
|
43454
43409
|
clearAutoStopTimer();
|
|
@@ -87175,7 +87130,7 @@ var init_adhdev_daemon = __esm({
|
|
|
87175
87130
|
init_version();
|
|
87176
87131
|
init_src();
|
|
87177
87132
|
init_runtime_defaults();
|
|
87178
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.
|
|
87133
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.5" });
|
|
87179
87134
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
87180
87135
|
localHttpServer = null;
|
|
87181
87136
|
localWss = null;
|
|
@@ -92539,105 +92494,24 @@ function getAutoFixFunctions(category) {
|
|
|
92539
92494
|
return IDE_AUTO_FIX_FUNCTIONS;
|
|
92540
92495
|
}
|
|
92541
92496
|
function getDefaultAutoFixReference(category, type, providers) {
|
|
92542
|
-
|
|
92543
|
-
|
|
92544
|
-
|
|
92545
|
-
(ref) => ref !== type && providers.some((p) => p.type === ref && p.category === "cli")
|
|
92546
|
-
);
|
|
92547
|
-
if (picked) return picked;
|
|
92548
|
-
const fallback2 = providers.find((p) => p.category === "cli" && p.type !== type);
|
|
92549
|
-
return fallback2?.type || "codex-cli";
|
|
92550
|
-
}
|
|
92551
|
-
if (category === "extension") {
|
|
92552
|
-
const preferred = ["claude-code-vscode", "codex", "cline", "roo-code"];
|
|
92553
|
-
const picked = preferred.find(
|
|
92554
|
-
(ref) => ref !== type && providers.some((p) => p.type === ref && p.category === "extension")
|
|
92555
|
-
);
|
|
92556
|
-
if (picked) return picked;
|
|
92557
|
-
const fallback2 = providers.find((p) => p.category === "extension" && p.type !== type);
|
|
92558
|
-
if (fallback2?.type) return fallback2.type;
|
|
92559
|
-
}
|
|
92497
|
+
const sameCategoryOther = providers.find((p) => p.category === category && p.type !== type);
|
|
92498
|
+
if (sameCategoryOther?.type) return sameCategoryOther.type;
|
|
92499
|
+
if (category === "extension") return "antigravity";
|
|
92560
92500
|
return "antigravity";
|
|
92561
92501
|
}
|
|
92562
92502
|
function escapeRegex2(value) {
|
|
92563
92503
|
return String(value || "").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
92564
92504
|
}
|
|
92565
92505
|
var CLI_PROVIDER_FIX_PROMPT = 'Create a file at tmp/adhdev_provider_fix_test.py that prints the current working directory and the squares of 1 through 5, then run python3 tmp/adhdev_provider_fix_test.py and tell me the exact output. Start the final answer with "Exact output:" and include the working directory plus the command stdout verbatim.';
|
|
92566
|
-
|
|
92567
|
-
|
|
92568
|
-
fixtureName: "codex-cli-provider-fix",
|
|
92569
|
-
inspectFields: [
|
|
92570
|
-
"debug.messages",
|
|
92571
|
-
"trace.entries[].payload.parsedLastAssistant",
|
|
92572
|
-
"trace.entries[].payload.detectStatus",
|
|
92573
|
-
"trace.entries[].payload.parsedStatus"
|
|
92574
|
-
],
|
|
92575
|
-
focusAreas: [
|
|
92576
|
-
"Startup or trust screens must be classified as approval/current chrome, not assistant transcript content.",
|
|
92577
|
-
"Prefer fixing provider.json submit/approval behavior before piling on parser heuristics.",
|
|
92578
|
-
"The final assistant transcript must preserve the exact stdout block and current working directory."
|
|
92579
|
-
],
|
|
92580
|
-
lastAssistantMustContainAny: [
|
|
92581
|
-
"Exact output:",
|
|
92582
|
-
"1",
|
|
92583
|
-
"4",
|
|
92584
|
-
"9",
|
|
92585
|
-
"16",
|
|
92586
|
-
"25"
|
|
92587
|
-
],
|
|
92588
|
-
lastAssistantMustNotContainAny: [
|
|
92589
|
-
"Do you trust the contents of this directory?",
|
|
92590
|
-
"OpenAI Codex",
|
|
92591
|
-
"Tip: New",
|
|
92592
|
-
"Summarize recent commits"
|
|
92593
|
-
],
|
|
92594
|
-
description: "Codex CLI must classify startup/trust screens correctly, transition idle -> generating -> idle, and preserve the exact stdout block in the final assistant transcript.",
|
|
92595
|
-
timeoutMs: 9e4
|
|
92596
|
-
},
|
|
92597
|
-
"claude-cli": {
|
|
92598
|
-
fixtureName: "claude-cli-provider-fix",
|
|
92599
|
-
inspectFields: [
|
|
92600
|
-
"statusesSeen",
|
|
92601
|
-
"approvalsResolved",
|
|
92602
|
-
"debug.messages",
|
|
92603
|
-
"trace.entries[].payload.detectStatus",
|
|
92604
|
-
"trace.entries[].payload.parsedStatus",
|
|
92605
|
-
"trace.entries[].payload.parsedLastAssistant",
|
|
92606
|
-
"trace.entries[].payload.approval"
|
|
92607
|
-
],
|
|
92608
|
-
focusAreas: [
|
|
92609
|
-
"Some environments show a startup trust or safety confirmation before the first prompt; treat that screen as waiting_approval, not assistant content.",
|
|
92610
|
-
"Single-action startup confirmations should resolve with Enter/confirm handling instead of assuming numbered approval options.",
|
|
92611
|
-
"Do not leak footer chrome like shortcuts help, version banners, /effort text, or startup trust wording into the parsed transcript."
|
|
92612
|
-
],
|
|
92613
|
-
lastAssistantMustContainAny: [
|
|
92614
|
-
"Exact output:",
|
|
92615
|
-
"1",
|
|
92616
|
-
"4",
|
|
92617
|
-
"9",
|
|
92618
|
-
"16",
|
|
92619
|
-
"25"
|
|
92620
|
-
],
|
|
92621
|
-
lastAssistantMustNotContainAny: [
|
|
92622
|
-
"Quick safety check",
|
|
92623
|
-
"Is this a project you trust",
|
|
92624
|
-
"Enter to confirm",
|
|
92625
|
-
"Claude Code",
|
|
92626
|
-
"Type your message"
|
|
92627
|
-
],
|
|
92628
|
-
description: "Claude CLI must survive startup trust/safety prompts, resolve them cleanly, transition back to generating/idle, and keep startup chrome out of the final assistant transcript.",
|
|
92629
|
-
timeoutMs: 12e4
|
|
92630
|
-
}
|
|
92631
|
-
};
|
|
92632
|
-
function getCliAutoFixVerification(type, providerDir) {
|
|
92633
|
-
const profile = CLI_AUTO_FIX_VERIFICATION_PROFILES[type];
|
|
92506
|
+
function getCliAutoFixVerification(provider, providerDir) {
|
|
92507
|
+
const profile = provider?.autoFixProfile;
|
|
92634
92508
|
if (!profile) return null;
|
|
92635
92509
|
const normalizedDir = providerDir.replace(/\\/g, "/");
|
|
92636
92510
|
const escapedDir = escapeRegex2(normalizedDir);
|
|
92637
92511
|
return {
|
|
92638
92512
|
fixtureName: profile.fixtureName,
|
|
92639
92513
|
request: {
|
|
92640
|
-
type,
|
|
92514
|
+
type: provider?.type,
|
|
92641
92515
|
workingDir: providerDir,
|
|
92642
92516
|
freshSession: true,
|
|
92643
92517
|
autoLaunch: true,
|
|
@@ -93007,21 +92881,26 @@ function registerProviderCommands(program2) {
|
|
|
93007
92881
|
console.log(source_default.green(`
|
|
93008
92882
|
\u2713 Writable local copy ready at [${targetDir2}]`));
|
|
93009
92883
|
}
|
|
93010
|
-
let agentName = options.agent
|
|
92884
|
+
let agentName = options.agent;
|
|
93011
92885
|
const modelName = options.model;
|
|
93012
92886
|
const reference = options.reference || getDefaultAutoFixReference(providerToFix.category, type, allProviders);
|
|
93013
|
-
if (!
|
|
92887
|
+
if (!agentName) {
|
|
93014
92888
|
const inquirer3 = (await Promise.resolve().then(() => (init_lib(), lib_exports))).default;
|
|
93015
92889
|
const { SUPPORTED_CLI_AGENTS: SUPPORTED_CLI_AGENTS2 } = await Promise.resolve().then(() => (init_supported(), supported_exports));
|
|
92890
|
+
const availableAgentChoices = SUPPORTED_CLI_AGENTS2.filter(
|
|
92891
|
+
(agent) => allProviders.some((provider2) => provider2.category === "cli" && provider2.type === agent.id)
|
|
92892
|
+
);
|
|
92893
|
+
const choices = (availableAgentChoices.length > 0 ? availableAgentChoices : SUPPORTED_CLI_AGENTS2).map((agent) => ({
|
|
92894
|
+
name: `${agent.icon} ${source_default.green(agent.name)}`,
|
|
92895
|
+
value: agent.id
|
|
92896
|
+
}));
|
|
92897
|
+
const defaultAgent = choices[0]?.value || "codex-cli";
|
|
93016
92898
|
const agentAnswer = await inquirer3.prompt([{
|
|
93017
92899
|
type: "list",
|
|
93018
92900
|
name: "selected",
|
|
93019
92901
|
message: "Select the AI agent to use for auto-fix:",
|
|
93020
|
-
choices
|
|
93021
|
-
|
|
93022
|
-
value: agent.id
|
|
93023
|
-
})),
|
|
93024
|
-
default: "codex-cli"
|
|
92902
|
+
choices,
|
|
92903
|
+
default: defaultAgent
|
|
93025
92904
|
}]);
|
|
93026
92905
|
agentName = agentAnswer.selected;
|
|
93027
92906
|
}
|
|
@@ -93071,7 +92950,7 @@ function registerProviderCommands(program2) {
|
|
|
93071
92950
|
console.log(source_default.gray(` \u{1F4AC} Comment: ${userComment}`));
|
|
93072
92951
|
}
|
|
93073
92952
|
try {
|
|
93074
|
-
const verification = providerToFix.category === "cli" ? getCliAutoFixVerification(
|
|
92953
|
+
const verification = providerToFix.category === "cli" ? getCliAutoFixVerification(providerToFix, targetDir) : null;
|
|
93075
92954
|
const postData = JSON.stringify({
|
|
93076
92955
|
functions: functionsToFix,
|
|
93077
92956
|
agent: agentName,
|