replicas-engine 0.1.1188 → 0.1.1189

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.
@@ -8,9 +8,9 @@ import {
8
8
  listRunningCodexModels,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-DCCLTZ2Z.js";
11
+ } from "./chunk-NRFMMDOT.js";
12
12
  import "./chunk-VXPWAQR2.js";
13
- import "./chunk-WJLWPHUO.js";
13
+ import "./chunk-QPVTETVI.js";
14
14
  import "./chunk-R6I3LT27.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
16
  import "./chunk-4T2K6OBK.js";
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  AppServerProcess,
16
16
  buildCodexAgentEnv
17
- } from "./chunk-WJLWPHUO.js";
17
+ } from "./chunk-QPVTETVI.js";
18
18
  import {
19
19
  SUBPROCESS_MAX_BUFFER,
20
20
  execFileAsync
@@ -291,7 +291,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
291
291
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
292
292
  await this.applyCredentialsResponse(data);
293
293
  setAgentCredentialSnapshot("codex", data);
294
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-LSWA5KWR.js");
294
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-IY4BPGYV.js");
295
295
  await restartCodexAspHostIfRunning2();
296
296
  });
297
297
  await this.start(true);
@@ -313,7 +313,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
313
313
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
314
314
  await this.applyCredentialsResponse(data);
315
315
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
316
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-LSWA5KWR.js");
316
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-IY4BPGYV.js");
317
317
  await restartCodexAspHostIfRunning2();
318
318
  }
319
319
  setAgentCredentialSnapshot("codex", data);
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
240
240
  if (method === "foundry") return "azure";
241
241
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
242
242
  }
243
- var ENGINE_PACKAGE_VERSION = "0.1.1188";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1189";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  AspClient
6
- } from "./chunk-WJLWPHUO.js";
6
+ } from "./chunk-QPVTETVI.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -13,11 +13,11 @@ import {
13
13
  recoverCompletedTurn,
14
14
  spawnMuseMsp,
15
15
  startMuseSession
16
- } from "./chunk-TBMJWQJX.js";
16
+ } from "./chunk-W5ERK2HR.js";
17
17
  import {
18
18
  AppServerProcess,
19
19
  buildCodexAgentEnv
20
- } from "./chunk-WJLWPHUO.js";
20
+ } from "./chunk-QPVTETVI.js";
21
21
  import "./chunk-R6I3LT27.js";
22
22
  import {
23
23
  AGENT,
package/dist/src/index.js CHANGED
@@ -64,7 +64,7 @@ import {
64
64
  spawnMuseMsp,
65
65
  startMuseSession,
66
66
  uuidV7
67
- } from "./chunk-TBMJWQJX.js";
67
+ } from "./chunk-W5ERK2HR.js";
68
68
  import {
69
69
  publishedPullRequestUrls
70
70
  } from "./chunk-NIT22CZW.js";
@@ -139,7 +139,7 @@ import {
139
139
  timestampFromSeconds,
140
140
  upsertCredentialFileLines,
141
141
  writeSecureCredentialFile
142
- } from "./chunk-DCCLTZ2Z.js";
142
+ } from "./chunk-NRFMMDOT.js";
143
143
  import {
144
144
  ENGINE_ENV,
145
145
  monolithRequest,
@@ -151,7 +151,7 @@ import {
151
151
  } from "./chunk-VXPWAQR2.js";
152
152
  import {
153
153
  getCodexModelProvider
154
- } from "./chunk-WJLWPHUO.js";
154
+ } from "./chunk-QPVTETVI.js";
155
155
  import {
156
156
  SUBPROCESS_MAX_BUFFER,
157
157
  execAsync,
@@ -11418,6 +11418,9 @@ var CodingAgentManager = class {
11418
11418
  unreadSteers = /* @__PURE__ */ new Map();
11419
11419
  steersInFlight = /* @__PURE__ */ new Map();
11420
11420
  lastSenderKey;
11421
+ // Unset until this process sends a turn, so a restart can't mistake the first one for a change.
11422
+ sentTurn = false;
11423
+ lastCustomInstructions;
11421
11424
  onLastSenderKeyChanged;
11422
11425
  constructor(options) {
11423
11426
  this.workingDirectory = options.workingDirectory ?? ENGINE_ENV.WORKSPACE_ROOT;
@@ -11513,7 +11516,14 @@ var CodingAgentManager = class {
11513
11516
  const stopped = signal.aborted;
11514
11517
  if (stopped && !await this.keepStoppedRequest(delivered)) return;
11515
11518
  await this.saveLastSenderKey(senderKey);
11516
- if (!stopped) await processMessage(delivered, signal);
11519
+ if (stopped) return;
11520
+ const instructionsChanged = this.sentTurn && this.lastCustomInstructions !== request.customInstructions && !request.goalMode && !request.message.trimStart().startsWith("/");
11521
+ this.sentTurn = true;
11522
+ this.lastCustomInstructions = request.customInstructions;
11523
+ const note = wrapInTag("Your instructions changed since your previous turn. Earlier turns followed the old version: follow the current instructions from here on, and leave earlier replies as they are.", REPLICAS_INSTRUCTIONS_TAG);
11524
+ await processMessage(instructionsChanged ? { ...delivered, message: `${delivered.message}
11525
+
11526
+ ${note}` } : delivered, signal);
11517
11527
  },
11518
11528
  this.onProcessingChanged,
11519
11529
  this.onMessageStarted,
@@ -13407,7 +13417,9 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13407
13417
  const systemPrompt = {
13408
13418
  type: "preset",
13409
13419
  preset: "claude_code",
13410
- append: combinedInstructions
13420
+ append: combinedInstructions,
13421
+ // A recorded prompt ignores a new append on resume, so edited instructions would never apply.
13422
+ snapshot: false
13411
13423
  };
13412
13424
  const shared = await this.buildSharedQueryOptions();
13413
13425
  const interactiveAllowed = enableInteractiveTools && resolvedPermissionMode === "plan";
@@ -14567,6 +14579,12 @@ var CodexAspManager = class extends CodingAgentManager {
14567
14579
  );
14568
14580
  this.currentThreadId = response.thread.id;
14569
14581
  this.activeServiceTier = response.serviceTier;
14582
+ if (this.attachedClient === host.client && developerInstructions && developerInstructions !== this.attachedDeveloperInstructions) {
14583
+ await host.client.request(THREAD_INJECT_ITEMS_METHOD, {
14584
+ threadId: this.currentThreadId,
14585
+ items: [{ type: "message", role: "developer", content: [{ type: "input_text", text: developerInstructions }] }]
14586
+ });
14587
+ }
14570
14588
  this.attachedClient = host.client;
14571
14589
  this.attachedModel = requestedModel;
14572
14590
  this.attachedDeveloperInstructions = developerInstructions ?? null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1188",
3
+ "version": "0.1.1189",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",