codex-to-im 1.0.33 → 1.0.35
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/daemon.mjs +57 -11
- package/package.json +1 -1
package/dist/daemon.mjs
CHANGED
|
@@ -16201,6 +16201,19 @@ function toUserVisibleCommandError(command, error) {
|
|
|
16201
16201
|
}
|
|
16202
16202
|
return `${command} \u6267\u884C\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002`;
|
|
16203
16203
|
}
|
|
16204
|
+
function pad2(value) {
|
|
16205
|
+
return String(value).padStart(2, "0");
|
|
16206
|
+
}
|
|
16207
|
+
function formatCommandDateTime(value) {
|
|
16208
|
+
const trimmed = value?.trim();
|
|
16209
|
+
if (!trimmed) return "-";
|
|
16210
|
+
const date = new Date(trimmed);
|
|
16211
|
+
if (Number.isNaN(date.getTime())) return trimmed;
|
|
16212
|
+
return [
|
|
16213
|
+
`${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())}`,
|
|
16214
|
+
`${pad2(date.getHours())}:${pad2(date.getMinutes())}:${pad2(date.getSeconds())}`
|
|
16215
|
+
].join(" ");
|
|
16216
|
+
}
|
|
16204
16217
|
function stripStoredAttachmentMarker(content) {
|
|
16205
16218
|
return content.replace(/\n?<!--files:[\s\S]*?-->$/u, "").trim();
|
|
16206
16219
|
}
|
|
@@ -16258,7 +16271,7 @@ function formatRuntimeStatus(session) {
|
|
|
16258
16271
|
}
|
|
16259
16272
|
function formatMirrorStatus(session) {
|
|
16260
16273
|
if (session?.mirror_status === "watching") {
|
|
16261
|
-
return session.mirror_last_event_at ? `\u76D1\u542C\u4E2D \xB7 \u6700\u8FD1\u540C\u6B65 ${session.mirror_last_event_at}` : "\u76D1\u542C\u4E2D";
|
|
16274
|
+
return session.mirror_last_event_at ? `\u76D1\u542C\u4E2D \xB7 \u6700\u8FD1\u540C\u6B65 ${formatCommandDateTime(session.mirror_last_event_at)}` : "\u76D1\u542C\u4E2D";
|
|
16262
16275
|
}
|
|
16263
16276
|
if (session?.mirror_status === "stale") {
|
|
16264
16277
|
return "\u5F85\u6062\u590D\uFF08\u6682\u65F6\u6CA1\u5B9A\u4F4D\u5230\u684C\u9762 thread \u6587\u4EF6\uFF09";
|
|
@@ -16294,14 +16307,15 @@ function formatCommandTimestamp(value) {
|
|
|
16294
16307
|
if (!trimmed) return "-";
|
|
16295
16308
|
const parsed = Date.parse(trimmed);
|
|
16296
16309
|
if (!Number.isFinite(parsed)) return trimmed;
|
|
16310
|
+
const localized = formatCommandDateTime(trimmed);
|
|
16297
16311
|
const diffMs = Math.max(0, Date.now() - parsed);
|
|
16298
16312
|
const diffMinutes = Math.floor(diffMs / 6e4);
|
|
16299
|
-
if (diffMinutes < 1) return `${
|
|
16300
|
-
if (diffMinutes < 60) return `${
|
|
16313
|
+
if (diffMinutes < 1) return `${localized}\uFF08\u521A\u521A\uFF09`;
|
|
16314
|
+
if (diffMinutes < 60) return `${localized}\uFF08${diffMinutes} \u5206\u949F\u524D\uFF09`;
|
|
16301
16315
|
const diffHours = Math.floor(diffMinutes / 60);
|
|
16302
|
-
if (diffHours < 24) return `${
|
|
16316
|
+
if (diffHours < 24) return `${localized}\uFF08${diffHours} \u5C0F\u65F6\u524D\uFF09`;
|
|
16303
16317
|
const diffDays = Math.floor(diffHours / 24);
|
|
16304
|
-
return `${
|
|
16318
|
+
return `${localized}\uFF08${diffDays} \u5929\u524D\uFF09`;
|
|
16305
16319
|
}
|
|
16306
16320
|
function formatHealthProcessProbe(diagnosis) {
|
|
16307
16321
|
if (!diagnosis.processProbe) {
|
|
@@ -16718,20 +16732,39 @@ function settleMirrorSuppression(store, sessionId, config2, suppressionId, durat
|
|
|
16718
16732
|
}
|
|
16719
16733
|
target.until = nowMs + durationMs;
|
|
16720
16734
|
}
|
|
16735
|
+
function abortMirrorSuppression(store, sessionId, config2, suppressionId, nowMs = Date.now()) {
|
|
16736
|
+
const suppressions = getMirrorSuppressionStates(store, sessionId, nowMs);
|
|
16737
|
+
if (suppressions.length === 0) return;
|
|
16738
|
+
const target = suppressionId ? suppressions.find((suppression) => suppression.id === suppressionId) : suppressions[suppressions.length - 1];
|
|
16739
|
+
if (!target) return;
|
|
16740
|
+
const trackedTurnId = target.activeTurnId || target.candidateTurnId;
|
|
16741
|
+
if (trackedTurnId) {
|
|
16742
|
+
markIgnoredMirrorTurn(
|
|
16743
|
+
store,
|
|
16744
|
+
sessionId,
|
|
16745
|
+
trackedTurnId,
|
|
16746
|
+
config2.promptMatchGraceMs,
|
|
16747
|
+
nowMs
|
|
16748
|
+
);
|
|
16749
|
+
clearMirrorSuppression(store, sessionId, target.id);
|
|
16750
|
+
return;
|
|
16751
|
+
}
|
|
16752
|
+
target.until = nowMs + config2.suppressionWindowMs;
|
|
16753
|
+
}
|
|
16721
16754
|
function isMirrorSuppressed(store, sessionId, nowMs = Date.now()) {
|
|
16722
16755
|
return getMirrorSuppressionStates(store, sessionId, nowMs).length > 0;
|
|
16723
16756
|
}
|
|
16724
16757
|
function filterSuppressedMirrorRecords(store, sessionId, records, config2, nowMs = Date.now()) {
|
|
16725
16758
|
const suppressions = getMirrorSuppressionStates(store, sessionId, nowMs);
|
|
16726
|
-
|
|
16759
|
+
const ignoredTurnIds = cleanupIgnoredMirrorTurns(store, sessionId, nowMs);
|
|
16760
|
+
if (suppressions.length === 0 && ignoredTurnIds.size === 0 || records.length === 0) return records;
|
|
16727
16761
|
const filtered = [];
|
|
16728
|
-
cleanupIgnoredMirrorTurns(store, sessionId, nowMs);
|
|
16729
16762
|
for (const record of records) {
|
|
16730
16763
|
const normalizedContent = record.type === "message" ? normalizeMirrorPromptText(record.content || "") : "";
|
|
16731
16764
|
let handled = false;
|
|
16732
16765
|
while (true) {
|
|
16733
|
-
const
|
|
16734
|
-
if (record.turnId &&
|
|
16766
|
+
const ignoredTurnIds2 = cleanupIgnoredMirrorTurns(store, sessionId, nowMs);
|
|
16767
|
+
if (record.turnId && ignoredTurnIds2.has(record.turnId)) {
|
|
16735
16768
|
if (record.type === "task_complete") {
|
|
16736
16769
|
clearIgnoredMirrorTurn(store, sessionId, record.turnId, nowMs);
|
|
16737
16770
|
}
|
|
@@ -17872,7 +17905,7 @@ async function handleBridgeCommand(adapter, msg, text2, deps) {
|
|
|
17872
17905
|
[
|
|
17873
17906
|
["\u6807\u9898", getSessionDisplayName(draftSession, draftSession.working_directory)],
|
|
17874
17907
|
["\u76EE\u5F55", formatCommandPath(draftSession.working_directory)],
|
|
17875
|
-
["\u8FC7\u671F\u65F6\u95F4", draftSession.expires_at
|
|
17908
|
+
["\u8FC7\u671F\u65F6\u95F4", formatCommandDateTime(draftSession.expires_at)],
|
|
17876
17909
|
["\u6A21\u5F0F", "ask"]
|
|
17877
17910
|
],
|
|
17878
17911
|
["\u8FD9\u662F\u9690\u85CF\u7684\u8349\u7A3F\u7EBF\u7A0B\uFF0C\u4E0D\u4F1A\u51FA\u73B0\u5728\u5E38\u89C4\u4F1A\u8BDD\u5217\u8868\u4E2D\u3002"],
|
|
@@ -18990,7 +19023,11 @@ async function runInteractiveMessage(adapter, msg, text2, attachments, deps) {
|
|
|
18990
19023
|
);
|
|
18991
19024
|
}
|
|
18992
19025
|
if (taskState.mirrorSuppressionId) {
|
|
18993
|
-
|
|
19026
|
+
if (taskAbort.signal.aborted) {
|
|
19027
|
+
deps.abortMirrorSuppression(binding.codepilotSessionId, taskState.mirrorSuppressionId);
|
|
19028
|
+
} else {
|
|
19029
|
+
deps.settleMirrorSuppression(binding.codepilotSessionId, taskState.mirrorSuppressionId);
|
|
19030
|
+
}
|
|
18994
19031
|
taskState.mirrorSuppressionId = null;
|
|
18995
19032
|
}
|
|
18996
19033
|
if (shouldRecordHealthEnd) {
|
|
@@ -20394,6 +20431,14 @@ function getMirrorSuppressionStore() {
|
|
|
20394
20431
|
function beginMirrorSuppression2(sessionId, promptText) {
|
|
20395
20432
|
return beginMirrorSuppression(getMirrorSuppressionStore(), sessionId, promptText);
|
|
20396
20433
|
}
|
|
20434
|
+
function abortMirrorSuppression2(sessionId, suppressionId) {
|
|
20435
|
+
abortMirrorSuppression(
|
|
20436
|
+
getMirrorSuppressionStore(),
|
|
20437
|
+
sessionId,
|
|
20438
|
+
MIRROR_SUPPRESSION_CONFIG,
|
|
20439
|
+
suppressionId
|
|
20440
|
+
);
|
|
20441
|
+
}
|
|
20397
20442
|
function settleMirrorSuppression2(sessionId, suppressionId, durationMs = MIRROR_SUPPRESSION_WINDOW_MS) {
|
|
20398
20443
|
settleMirrorSuppression(
|
|
20399
20444
|
getMirrorSuppressionStore(),
|
|
@@ -20852,6 +20897,7 @@ async function handleMessage(adapter, msg) {
|
|
|
20852
20897
|
},
|
|
20853
20898
|
recordInteractiveHealthEnd: (sessionId, outcome, detail) => SESSION_HEALTH_RUNTIME.recordInteractiveEnd(sessionId, outcome, detail),
|
|
20854
20899
|
beginMirrorSuppression: beginMirrorSuppression2,
|
|
20900
|
+
abortMirrorSuppression: abortMirrorSuppression2,
|
|
20855
20901
|
settleMirrorSuppression: settleMirrorSuppression2,
|
|
20856
20902
|
releaseInteractiveTask: (sessionId, taskId) => INTERACTIVE_RUNTIME.releaseInteractiveTask(sessionId, taskId),
|
|
20857
20903
|
deliverResponse,
|
package/package.json
CHANGED