replicas-engine 0.1.1032 → 0.1.1033

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.
@@ -5,9 +5,9 @@ import {
5
5
  getCodexAspHost,
6
6
  restartCodexAspHost,
7
7
  restartCodexAspHostIfRunning
8
- } from "./chunk-4LOZTMKD.js";
8
+ } from "./chunk-TOINZMHY.js";
9
9
  import "./chunk-EWPMMKGJ.js";
10
- import "./chunk-7HXLO5LH.js";
10
+ import "./chunk-GEAXVMEU.js";
11
11
  import "./chunk-JOX732WB.js";
12
12
  import "./chunk-UZSNFLDQ.js";
13
13
  import "./chunk-AXT547FH.js";
@@ -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.1032";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1033";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  AppServerProcess,
11
11
  buildCodexAgentEnv
12
- } from "./chunk-7HXLO5LH.js";
12
+ } from "./chunk-GEAXVMEU.js";
13
13
  import {
14
14
  SUBPROCESS_MAX_BUFFER,
15
15
  execFileAsync
@@ -264,7 +264,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
264
264
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
265
265
  await this.applyCredentialsResponse(data);
266
266
  setAgentCredentialSnapshot("codex", data);
267
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-2AILA3GI.js");
267
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-LOJZMJBA.js");
268
268
  await restartCodexAspHostIfRunning2();
269
269
  });
270
270
  await this.start(true);
@@ -285,7 +285,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
285
285
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
286
286
  await this.applyCredentialsResponse(data);
287
287
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
288
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-2AILA3GI.js");
288
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-LOJZMJBA.js");
289
289
  await restartCodexAspHostIfRunning2();
290
290
  }
291
291
  setAgentCredentialSnapshot("codex", data);
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  AppServerProcess,
9
9
  buildCodexAgentEnv
10
- } from "./chunk-7HXLO5LH.js";
10
+ } from "./chunk-GEAXVMEU.js";
11
11
  import "./chunk-JOX732WB.js";
12
12
  import {
13
13
  AGENT,
package/dist/src/index.js CHANGED
@@ -71,7 +71,7 @@ import {
71
71
  refreshDelayMs,
72
72
  restartCodexAspHost,
73
73
  routineRefreshRequest
74
- } from "./chunk-4LOZTMKD.js";
74
+ } from "./chunk-TOINZMHY.js";
75
75
  import {
76
76
  ENGINE_ENV,
77
77
  monolithRequest,
@@ -83,7 +83,7 @@ import {
83
83
  import {
84
84
  AspClient,
85
85
  getCodexModelProvider
86
- } from "./chunk-7HXLO5LH.js";
86
+ } from "./chunk-GEAXVMEU.js";
87
87
  import {
88
88
  SUBPROCESS_MAX_BUFFER,
89
89
  execAsync,
@@ -60638,30 +60638,42 @@ async function buildForkHandoff(input) {
60638
60638
  // src/services/chat/slack-activity-stream.ts
60639
60639
  var FLUSH_INTERVAL_MS = 3e3;
60640
60640
  var MAX_ACTIVITY_LENGTH = 100;
60641
+ var MAX_CODE_LENGTH = 40;
60641
60642
  var MAX_DONE_ATTEMPTS = 3;
60643
+ var GENERIC_STEPS = {
60644
+ read: "Reading a file",
60645
+ edit: "Editing a file",
60646
+ command: "Running a command",
60647
+ search: "Searching the code",
60648
+ web: "Browsing the web",
60649
+ tool: "Using a tool"
60650
+ };
60642
60651
  var sendQueue = Promise.resolve();
60643
60652
  var clean = (text) => {
60644
60653
  const line = text.replace(/\s+/g, " ").trim();
60645
60654
  return line.length > MAX_ACTIVITY_LENGTH ? `${line.slice(0, MAX_ACTIVITY_LENGTH - 1)}\u2026` : line;
60646
60655
  };
60647
- var code = (text) => `\`${clean(text).replace(/`/g, "'")}\``;
60648
- function describeActivity(message) {
60656
+ var code = (text) => {
60657
+ const line = text?.replace(/\s+/g, " ").trim();
60658
+ return line && line.length <= MAX_CODE_LENGTH ? `\`${line.replace(/`/g, "'")}\`` : void 0;
60659
+ };
60660
+ var basename4 = (path7) => path7.split("/").pop() || path7;
60661
+ function describeActivity(message, idle) {
60649
60662
  if (message.type === "agent" || message.type === "reasoning" && !isCompaction(message)) {
60650
60663
  const heading = message.type === "reasoning" ? [...message.content.matchAll(/^\*\*(.+?)\*\*$/gm)].at(-1)?.[1] : void 0;
60651
- const thought = clean((heading ?? message.content).replace(/\*\*/g, ""));
60652
- return thought ? { thought } : null;
60664
+ return { thought: clean(heading ?? "") || "Thinking" };
60653
60665
  }
60654
60666
  if (planItemsFromMessage(message) || message.type === "tool_call" && message.inputRequest) return null;
60655
- const step = describeMessageSteps(message).at(-1);
60667
+ const steps = describeMessageSteps(message);
60668
+ const step = steps.at(-1);
60656
60669
  if (!step) return null;
60657
- const target = step.target && (step.target.path?.split("/").pop() || step.target.text);
60658
- return {
60659
- step: [
60660
- step.running ? step.live : step.done,
60661
- target && (step.target?.plain ? clean(target) : code(target)),
60662
- step.scope && `in ${code(step.scope)}`
60663
- ].filter(Boolean).join(" ")
60664
- };
60670
+ if (idle && !steps.some((s) => s.running)) return { thought: "Thinking" };
60671
+ if (steps.length > 1) return { step: `${steps.every((s) => s.live === step.live) ? step.live : "Changing"} ${steps.length} files` };
60672
+ if (!step.target) return { step: step.live };
60673
+ const target = step.target.plain ? clean(step.target.text) : code(step.target.path ? basename4(step.target.path) : step.target.text);
60674
+ if (!target) return { step: GENERIC_STEPS[step.category] ?? step.live };
60675
+ const scope = step.scope && code(basename4(step.scope));
60676
+ return { step: [step.live, target, scope && `in ${scope}`].filter(Boolean).join(" ") };
60665
60677
  }
60666
60678
  var SlackActivityStream = class {
60667
60679
  constructor(turnId, provider) {
@@ -60677,6 +60689,7 @@ var SlackActivityStream = class {
60677
60689
  sent = null;
60678
60690
  attempted = false;
60679
60691
  dirty = false;
60692
+ settled = false;
60680
60693
  stopped = false;
60681
60694
  queued = false;
60682
60695
  noteEvent(event) {
@@ -60711,9 +60724,11 @@ var SlackActivityStream = class {
60711
60724
  }
60712
60725
  let activity = null;
60713
60726
  if (!done) {
60714
- if (!this.dirty) return true;
60727
+ const idle = !this.dirty;
60728
+ if (idle && this.settled) return true;
60729
+ this.settled = idle;
60715
60730
  this.dirty = false;
60716
- activity = parseDisplayMessages(this.events, this.provider).map(describeActivity).findLast(Boolean) ?? null;
60731
+ activity = parseDisplayMessages(this.events, this.provider).map((message) => describeActivity(message, idle)).findLast(Boolean) ?? null;
60717
60732
  if (!activity || JSON.stringify(activity) === this.sent) return true;
60718
60733
  }
60719
60734
  this.attempted = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1032",
3
+ "version": "0.1.1033",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",