@makerbi/remodex 3.2.0 → 3.4.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/package.json +1 -1
- package/src/bridge.js +160 -30
- package/src/codex-desktop-refresher.js +8 -8
- package/src/codex-runtime-settings.js +113 -0
- package/src/desktop-ipc-action-follower.js +289 -95
- package/src/desktop-ipc-conversation-adapter.js +56 -51
- package/src/desktop-ipc-conversation-projector.js +1 -0
- package/src/desktop-ipc-live-owner.js +189 -164
- package/src/desktop-ipc-shared.js +35 -1
- package/src/git-handler.js +20 -17
- package/src/rollout-live-mirror.js +3 -4
- package/src/runtime-provider-router.js +10 -2
- package/src/thread-activity-projector.js +694 -0
- package/src/thread-activity-store.js +325 -0
- package/src/thread-runtime-settings-store.js +60 -74
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// Depends on: crypto, ./desktop-ipc-shared
|
|
6
6
|
|
|
7
7
|
const { randomUUID } = require("crypto");
|
|
8
|
+
const { applyRuntimeSettingsToConversation } = require("./codex-runtime-settings");
|
|
8
9
|
|
|
9
10
|
const {
|
|
10
11
|
cloneJSON,
|
|
@@ -190,11 +191,15 @@ function applyAppServerMessageToConversationState({
|
|
|
190
191
|
return null;
|
|
191
192
|
}
|
|
192
193
|
const conversation = ensureConversationInMap(conversations, threadId, { hostId, now });
|
|
193
|
-
|
|
194
|
+
const title = readString(message.params?.threadName)
|
|
194
195
|
|| readString(message.params?.thread_name)
|
|
195
196
|
|| readString(message.params?.name)
|
|
196
197
|
|| readString(message.params?.title)
|
|
197
198
|
|| conversation.title;
|
|
199
|
+
if (title === conversation.title) {
|
|
200
|
+
return { threadId, changed: false };
|
|
201
|
+
}
|
|
202
|
+
conversation.title = title;
|
|
198
203
|
conversation.updatedAt = now();
|
|
199
204
|
return { threadId, changed: true };
|
|
200
205
|
}
|
|
@@ -446,7 +451,8 @@ function buildConversationStateFromThread(thread, {
|
|
|
446
451
|
const createdAtMs = timestampSecondsToMs(thread?.createdAt) || previous?.createdAt || now();
|
|
447
452
|
const updatedAtMs = timestampSecondsToMs(thread?.updatedAt) || now();
|
|
448
453
|
const cwd = readString(thread?.cwd) || previous?.cwd || "";
|
|
449
|
-
const latestModel = readString(
|
|
454
|
+
const latestModel = readString(previous?.latestThreadSettings?.model)
|
|
455
|
+
|| readString(thread?.model) || previous?.latestModel || "";
|
|
450
456
|
const turns = mergeConversationTurnsFromThread(thread?.turns, {
|
|
451
457
|
previousTurns: previous?.turns,
|
|
452
458
|
threadId,
|
|
@@ -473,8 +479,9 @@ function buildConversationStateFromThread(thread, {
|
|
|
473
479
|
threadStartKind: previous?.threadStartKind || "default",
|
|
474
480
|
modelProvider: readString(thread?.modelProvider) || previous?.modelProvider || "openai",
|
|
475
481
|
latestModel,
|
|
476
|
-
latestReasoningEffort: previous?.latestReasoningEffort
|
|
477
|
-
latestServiceTier: previous?.latestServiceTier
|
|
482
|
+
latestReasoningEffort: previous?.latestReasoningEffort ?? null,
|
|
483
|
+
latestServiceTier: previous?.latestServiceTier ?? null,
|
|
484
|
+
latestThreadSettings: cloneJSON(previous?.latestThreadSettings || null),
|
|
478
485
|
previousTurnModel: previous?.previousTurnModel || null,
|
|
479
486
|
latestCollaborationMode: previous?.latestCollaborationMode || {
|
|
480
487
|
mode: "default",
|
|
@@ -625,7 +632,7 @@ function synchronizeDesktopConversationCompatibility(state) {
|
|
|
625
632
|
turn.params = normalizeTurnParamsCompatibility(turn.params, {
|
|
626
633
|
cwd: readString(turn.params?.cwd) || readString(state.cwd),
|
|
627
634
|
});
|
|
628
|
-
turn.items = Array.isArray(turn.items) ? turn.items : [];
|
|
635
|
+
turn.items = Array.isArray(turn.items) ? turn.items.map(normalizeDesktopItemCompatibility) : [];
|
|
629
636
|
turn.hookRuns = Array.isArray(turn.hookRuns) ? turn.hookRuns : [];
|
|
630
637
|
const key = `turn:${turnId}`;
|
|
631
638
|
entries.push({ key, value: key });
|
|
@@ -716,14 +723,12 @@ function synchronizeDesktopConversationCompatibility(state) {
|
|
|
716
723
|
modelProvider: readString(state.latestThreadSettings?.modelProvider)
|
|
717
724
|
|| readString(state.modelProvider)
|
|
718
725
|
|| "openai",
|
|
719
|
-
serviceTier:
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
?? state.latestReasoningEffort
|
|
726
|
-
?? null,
|
|
726
|
+
serviceTier: Object.prototype.hasOwnProperty.call(state.latestThreadSettings || {}, "serviceTier")
|
|
727
|
+
? state.latestThreadSettings.serviceTier
|
|
728
|
+
: latestParams?.serviceTier ?? state.latestServiceTier ?? null,
|
|
729
|
+
effort: Object.prototype.hasOwnProperty.call(state.latestThreadSettings || {}, "effort")
|
|
730
|
+
? state.latestThreadSettings.effort
|
|
731
|
+
: latestParams?.effort ?? state.latestReasoningEffort ?? null,
|
|
727
732
|
summary: latestParams?.summary ?? state.latestThreadSettings?.summary ?? "none",
|
|
728
733
|
collaborationMode: cloneJSON(
|
|
729
734
|
state.latestThreadSettings?.collaborationMode
|
|
@@ -745,7 +750,7 @@ function normalizeTurnParamsCompatibility(params, { cwd = "" } = {}) {
|
|
|
745
750
|
const normalized = params && typeof params === "object" && !Array.isArray(params)
|
|
746
751
|
? params
|
|
747
752
|
: {};
|
|
748
|
-
normalized.input =
|
|
753
|
+
normalized.input = normalizeDesktopInputEntries(normalized.input);
|
|
749
754
|
normalized.attachments = Array.isArray(normalized.attachments) ? normalized.attachments : [];
|
|
750
755
|
normalized.cwd = readString(normalized.cwd) || readString(cwd) || null;
|
|
751
756
|
normalized.summary ??= "none";
|
|
@@ -894,35 +899,8 @@ function applyTurnRuntimeMetadata(conversation, turnParams) {
|
|
|
894
899
|
if (!conversation || !turnParams) {
|
|
895
900
|
return;
|
|
896
901
|
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
const serviceTier = readString(turnParams.serviceTier) || null;
|
|
900
|
-
if (model) {
|
|
901
|
-
conversation.previousTurnModel = conversation.latestModel || null;
|
|
902
|
-
conversation.latestModel = model;
|
|
903
|
-
}
|
|
904
|
-
if (effort) {
|
|
905
|
-
conversation.latestReasoningEffort = effort;
|
|
906
|
-
}
|
|
907
|
-
conversation.latestServiceTier = serviceTier;
|
|
908
|
-
if (turnParams.collaborationMode && typeof turnParams.collaborationMode === "object") {
|
|
909
|
-
conversation.latestCollaborationMode = cloneJSON(turnParams.collaborationMode);
|
|
910
|
-
return;
|
|
911
|
-
}
|
|
912
|
-
if (!model && !effort) {
|
|
913
|
-
return;
|
|
914
|
-
}
|
|
915
|
-
const settings = conversation.latestCollaborationMode?.settings;
|
|
916
|
-
conversation.latestCollaborationMode = {
|
|
917
|
-
mode: conversation.latestCollaborationMode?.mode || "default",
|
|
918
|
-
settings: {
|
|
919
|
-
...(settings && typeof settings === "object" ? settings : {
|
|
920
|
-
developer_instructions: null,
|
|
921
|
-
}),
|
|
922
|
-
model: model || settings?.model || "",
|
|
923
|
-
reasoning_effort: effort || settings?.reasoning_effort || null,
|
|
924
|
-
},
|
|
925
|
-
};
|
|
902
|
+
if (readString(turnParams.model)) conversation.previousTurnModel = conversation.latestModel || null;
|
|
903
|
+
applyRuntimeSettingsToConversation(conversation, turnParams);
|
|
926
904
|
}
|
|
927
905
|
|
|
928
906
|
function turnHasUserMessageItem(turn) {
|
|
@@ -962,7 +940,22 @@ function extractUserText(entries) {
|
|
|
962
940
|
}
|
|
963
941
|
|
|
964
942
|
function sanitizeUserInputEntries(entries) {
|
|
965
|
-
return sanitizeSharedUserInputEntries(entries).map(cloneJSON);
|
|
943
|
+
return normalizeDesktopInputEntries(sanitizeSharedUserInputEntries(entries)).map(cloneJSON);
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// App-server defaults text_elements, but Desktop 26.903 reads its length
|
|
947
|
+
// directly in IPC snapshots. Preserve existing spans and their byte offsets.
|
|
948
|
+
function normalizeDesktopInputEntries(entries) {
|
|
949
|
+
if (!Array.isArray(entries)) {
|
|
950
|
+
return [];
|
|
951
|
+
}
|
|
952
|
+
return entries.map((entry) => {
|
|
953
|
+
if (!entry || typeof entry !== "object" || entry.type !== "text"
|
|
954
|
+
|| Array.isArray(entry.text_elements)) {
|
|
955
|
+
return entry;
|
|
956
|
+
}
|
|
957
|
+
return { ...entry, text_elements: [] };
|
|
958
|
+
});
|
|
966
959
|
}
|
|
967
960
|
|
|
968
961
|
function sanitizeUserMessageItem(item) {
|
|
@@ -983,15 +976,22 @@ function sanitizeUserMessageItem(item) {
|
|
|
983
976
|
};
|
|
984
977
|
}
|
|
985
978
|
|
|
986
|
-
//
|
|
987
|
-
// while the matching Desktop renderer reads that collection without a fallback.
|
|
988
|
-
// Keep the richer snapshots unchanged and synthesize lightweight references from
|
|
989
|
-
// receiverThreadIds for older/CLI-owned rollouts so opening them cannot crash.
|
|
979
|
+
// Normalize optional app-server fields required by Desktop's snapshot renderer.
|
|
990
980
|
function normalizeDesktopItemCompatibility(item) {
|
|
991
|
-
if (!item || typeof item !== "object"
|
|
981
|
+
if (!item || typeof item !== "object") {
|
|
982
|
+
return item;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
if (item.type === "userMessage" || item.type === "steeringUserMessage") {
|
|
986
|
+
const inputKey = item.type === "userMessage" ? "content" : "input";
|
|
987
|
+
return { ...item, [inputKey]: normalizeDesktopInputEntries(item[inputKey]) };
|
|
988
|
+
}
|
|
989
|
+
if (normalizeToken(item.type) !== "collabagenttoolcall") {
|
|
992
990
|
return item;
|
|
993
991
|
}
|
|
994
992
|
|
|
993
|
+
// Codex CLI 0.144.1 can omit receiverThreads from persisted collab tool calls.
|
|
994
|
+
// Keep richer snapshots and synthesize references for older/CLI-owned rollouts.
|
|
995
995
|
const receiverThreads = Array.isArray(item.receiverThreads)
|
|
996
996
|
? item.receiverThreads
|
|
997
997
|
: [];
|
|
@@ -1085,14 +1085,19 @@ function normalizeTurnInitialPrompt(turn) {
|
|
|
1085
1085
|
function userMessageContentFromTurnInput(entry) {
|
|
1086
1086
|
if (typeof entry === "string") {
|
|
1087
1087
|
const text = readString(entry);
|
|
1088
|
-
return text ? { type: "text", text } : null;
|
|
1088
|
+
return text ? { type: "text", text, text_elements: [] } : null;
|
|
1089
1089
|
}
|
|
1090
1090
|
if (!entry || typeof entry !== "object") {
|
|
1091
1091
|
return null;
|
|
1092
1092
|
}
|
|
1093
1093
|
const type = normalizeToken(entry.type);
|
|
1094
1094
|
if (type === "inputtext" || type === "text") {
|
|
1095
|
-
return {
|
|
1095
|
+
return {
|
|
1096
|
+
...cloneJSON(entry),
|
|
1097
|
+
type: "text",
|
|
1098
|
+
text: typeof entry.text === "string" ? entry.text : "",
|
|
1099
|
+
text_elements: Array.isArray(entry.text_elements) ? cloneJSON(entry.text_elements) : [],
|
|
1100
|
+
};
|
|
1096
1101
|
}
|
|
1097
1102
|
return cloneJSON(entry);
|
|
1098
1103
|
}
|
|
@@ -203,6 +203,7 @@ function projectConversationState(threadId, rawState, {
|
|
|
203
203
|
|| readString(rawState?.latest_model)
|
|
204
204
|
|| "",
|
|
205
205
|
...(runtimeSettings ? {
|
|
206
|
+
runtimeSettings: cloneJSON(runtimeSettings),
|
|
206
207
|
reasoningEffort: readString(runtimeSettings.reasoningEffort) || null,
|
|
207
208
|
serviceTier: readString(runtimeSettings.serviceTier) || null,
|
|
208
209
|
runtimeSettingsRevision: Number(runtimeSettings.revision) || 0,
|