replicas-engine 0.1.30 → 0.1.31
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/src/index.js +40 -42
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -1099,51 +1099,49 @@ var CodexManager = class {
|
|
|
1099
1099
|
const normalizedImages = await normalizeImages(images);
|
|
1100
1100
|
tempImagePaths = await this.saveImagesToTempFiles(normalizedImages);
|
|
1101
1101
|
}
|
|
1102
|
-
const sandboxMode =
|
|
1103
|
-
if (
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
this.currentThreadId = event.thread_id;
|
|
1137
|
-
await saveEngineState({ codexThreadId: this.currentThreadId });
|
|
1138
|
-
console.log(`[CodexManager] Captured and persisted thread ID: ${this.currentThreadId}`);
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
if (!this.currentThreadId && this.currentThread.id) {
|
|
1142
|
-
this.currentThreadId = this.currentThread.id;
|
|
1102
|
+
const sandboxMode = "danger-full-access";
|
|
1103
|
+
if (this.currentThreadId) {
|
|
1104
|
+
this.currentThread = this.codex.resumeThread(this.currentThreadId, {
|
|
1105
|
+
workingDirectory: this.workingDirectory,
|
|
1106
|
+
skipGitRepoCheck: true,
|
|
1107
|
+
sandboxMode,
|
|
1108
|
+
model: model || DEFAULT_MODEL
|
|
1109
|
+
});
|
|
1110
|
+
} else {
|
|
1111
|
+
this.currentThread = this.codex.startThread({
|
|
1112
|
+
workingDirectory: this.workingDirectory,
|
|
1113
|
+
skipGitRepoCheck: true,
|
|
1114
|
+
sandboxMode,
|
|
1115
|
+
model: model || DEFAULT_MODEL
|
|
1116
|
+
});
|
|
1117
|
+
const startHooksInstruction = this.getStartHooksInstruction();
|
|
1118
|
+
const parts = [];
|
|
1119
|
+
if (this.baseSystemPrompt) {
|
|
1120
|
+
parts.push(this.baseSystemPrompt);
|
|
1121
|
+
}
|
|
1122
|
+
if (startHooksInstruction) {
|
|
1123
|
+
parts.push(startHooksInstruction);
|
|
1124
|
+
}
|
|
1125
|
+
if (customInstructions) {
|
|
1126
|
+
parts.push(customInstructions);
|
|
1127
|
+
}
|
|
1128
|
+
const combinedInstructions = parts.length > 0 ? parts.join("\n\n") : void 0;
|
|
1129
|
+
if (combinedInstructions) {
|
|
1130
|
+
message = combinedInstructions + "\n\n\n" + message;
|
|
1131
|
+
}
|
|
1132
|
+
const { events: events2 } = await this.currentThread.runStreamed("Hello");
|
|
1133
|
+
for await (const event of events2) {
|
|
1134
|
+
if (event.type === "thread.started") {
|
|
1135
|
+
this.currentThreadId = event.thread_id;
|
|
1143
1136
|
await saveEngineState({ codexThreadId: this.currentThreadId });
|
|
1144
|
-
console.log(`[CodexManager] Captured and persisted thread ID
|
|
1137
|
+
console.log(`[CodexManager] Captured and persisted thread ID: ${this.currentThreadId}`);
|
|
1145
1138
|
}
|
|
1146
1139
|
}
|
|
1140
|
+
if (!this.currentThreadId && this.currentThread.id) {
|
|
1141
|
+
this.currentThreadId = this.currentThread.id;
|
|
1142
|
+
await saveEngineState({ codexThreadId: this.currentThreadId });
|
|
1143
|
+
console.log(`[CodexManager] Captured and persisted thread ID from thread.id: ${this.currentThreadId}`);
|
|
1144
|
+
}
|
|
1147
1145
|
}
|
|
1148
1146
|
let input;
|
|
1149
1147
|
if (tempImagePaths.length > 0) {
|