replicas-engine 0.1.31 → 0.1.32

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.
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
+ }) : x)(function(x) {
6
+ if (typeof require !== "undefined") return require.apply(this, arguments);
7
+ throw Error('Dynamic require of "' + x + '" is not supported');
8
+ });
9
+ var __commonJS = (cb, mod) => function __require2() {
10
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
+ };
12
+
13
+ export {
14
+ __require,
15
+ __commonJS
16
+ };
package/dist/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import "./chunk-ZXMDA7VB.js";
2
3
 
3
4
  // src/index.ts
4
5
  import "dotenv/config";
@@ -784,6 +785,23 @@ async function normalizeImages(images) {
784
785
  return normalized;
785
786
  }
786
787
 
788
+ // ../shared/src/sandbox.ts
789
+ var SANDBOX_LIFECYCLE = {
790
+ AUTO_STOP_MINUTES: 60,
791
+ AUTO_ARCHIVE_MINUTES: 60 * 24 * 7,
792
+ AUTO_DELETE_MINUTES: -1,
793
+ SSH_TOKEN_EXPIRATION_MINUTES: 3 * 60
794
+ };
795
+
796
+ // ../shared/src/prompts.ts
797
+ var GENERAL_INSTRUCTIONS_TAG = "general_instructions";
798
+ var CODEX_USER_INSTRUCTION_TAG = "user_instruction";
799
+ function wrapInTag(content, tag) {
800
+ return `<${tag}>
801
+ ${content}
802
+ </${tag}>`;
803
+ }
804
+
787
805
  // src/services/replicas-config.ts
788
806
  import { readFile as readFile3, appendFile, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
789
807
  import { existsSync as existsSync2 } from "fs";
@@ -961,7 +979,8 @@ Commands: ${hooks.length}
961
979
  * Get the system prompt from replicas.json
962
980
  */
963
981
  getSystemPrompt() {
964
- return this.config?.systemPrompt;
982
+ if (!this.config?.systemPrompt) return void 0;
983
+ return wrapInTag(this.config.systemPrompt, GENERAL_INSTRUCTIONS_TAG);
965
984
  }
966
985
  /**
967
986
  * Get the full config object
@@ -1127,9 +1146,11 @@ var CodexManager = class {
1127
1146
  }
1128
1147
  const combinedInstructions = parts.length > 0 ? parts.join("\n\n") : void 0;
1129
1148
  if (combinedInstructions) {
1130
- message = combinedInstructions + "\n\n\n" + message;
1149
+ message = combinedInstructions + "\n\n\n" + wrapInTag(message, CODEX_USER_INSTRUCTION_TAG);
1150
+ } else {
1151
+ message = wrapInTag(message, CODEX_USER_INSTRUCTION_TAG);
1131
1152
  }
1132
- const { events: events2 } = await this.currentThread.runStreamed("Hello");
1153
+ const { events: events2 } = await this.currentThread.runStreamed(wrapInTag("Hello", CODEX_USER_INSTRUCTION_TAG));
1133
1154
  for await (const event of events2) {
1134
1155
  if (event.type === "thread.started") {
1135
1156
  this.currentThreadId = event.thread_id;
@@ -1143,15 +1164,16 @@ var CodexManager = class {
1143
1164
  console.log(`[CodexManager] Captured and persisted thread ID from thread.id: ${this.currentThreadId}`);
1144
1165
  }
1145
1166
  }
1167
+ const wrappedMessage = this.currentThreadId && !message.includes(`<${CODEX_USER_INSTRUCTION_TAG}>`) ? wrapInTag(message, CODEX_USER_INSTRUCTION_TAG) : message;
1146
1168
  let input;
1147
1169
  if (tempImagePaths.length > 0) {
1148
1170
  const inputItems = [
1149
- { type: "text", text: message },
1171
+ { type: "text", text: wrappedMessage },
1150
1172
  ...tempImagePaths.map((path5) => ({ type: "local_image", path: path5 }))
1151
1173
  ];
1152
1174
  input = inputItems;
1153
1175
  } else {
1154
- input = message;
1176
+ input = wrappedMessage;
1155
1177
  }
1156
1178
  const { events } = await this.currentThread.runStreamed(input);
1157
1179
  let latestThoughtEvent = null;