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.
Files changed (2) hide show
  1. package/dist/src/index.js +40 -42
  2. 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 = permissionMode === "read" ? "read-only" : "danger-full-access";
1103
- if (!this.currentThread) {
1104
- if (this.currentThreadId) {
1105
- this.currentThread = this.codex.resumeThread(this.currentThreadId, {
1106
- workingDirectory: this.workingDirectory,
1107
- skipGitRepoCheck: true,
1108
- sandboxMode,
1109
- model: model || DEFAULT_MODEL
1110
- });
1111
- } else {
1112
- this.currentThread = this.codex.startThread({
1113
- workingDirectory: this.workingDirectory,
1114
- skipGitRepoCheck: true,
1115
- sandboxMode,
1116
- model: model || DEFAULT_MODEL
1117
- });
1118
- const startHooksInstruction = this.getStartHooksInstruction();
1119
- const parts = [];
1120
- if (this.baseSystemPrompt) {
1121
- parts.push(this.baseSystemPrompt);
1122
- }
1123
- if (startHooksInstruction) {
1124
- parts.push(startHooksInstruction);
1125
- }
1126
- if (customInstructions) {
1127
- parts.push(customInstructions);
1128
- }
1129
- const combinedInstructions = parts.length > 0 ? parts.join("\n\n") : void 0;
1130
- if (combinedInstructions) {
1131
- message = combinedInstructions + "\n" + message;
1132
- }
1133
- const { events: events2 } = await this.currentThread.runStreamed("Hello");
1134
- for await (const event of events2) {
1135
- if (event.type === "thread.started") {
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 from thread.id: ${this.currentThreadId}`);
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",