replicas-engine 0.1.287 → 0.1.289

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 +149 -70
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -116,9 +116,9 @@ var EXT_TO_LANGUAGE = {
116
116
  function detectLanguageByPath(filePath) {
117
117
  const dot = filePath.lastIndexOf(".");
118
118
  if (dot === -1) {
119
- const basename2 = filePath.split("/").pop() ?? "";
120
- if (basename2 === "Dockerfile") return "dockerfile";
121
- if (basename2 === "Makefile") return "makefile";
119
+ const basename3 = filePath.split("/").pop() ?? "";
120
+ if (basename3 === "Dockerfile") return "dockerfile";
121
+ if (basename3 === "Makefile") return "makefile";
122
122
  return null;
123
123
  }
124
124
  const ext = filePath.slice(dot).toLowerCase();
@@ -286,7 +286,7 @@ var WORKSPACE_SIZES = ["small", "large"];
286
286
  var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
287
287
 
288
288
  // ../shared/src/e2b.ts
289
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-06-09-v1";
289
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-06-09-v3";
290
290
 
291
291
  // ../shared/src/runtime-env.ts
292
292
  function parsePosixEnvFile(content) {
@@ -1991,6 +1991,7 @@ var DEFAULT_CHAT_TITLES = {
1991
1991
  };
1992
1992
  var CLAUDE_OPUS_1M_MODEL = "opus[1m]";
1993
1993
  var LEGACY_CLAUDE_OPUS_1M_MODEL = "opus-1m";
1994
+ var CLAUDE_FABLE_5_MODEL = "claude-fable-5";
1994
1995
  var DEFAULT_CODEX_MODEL = "gpt-5.5";
1995
1996
  function normalizeClaudeModel(model) {
1996
1997
  if (model === LEGACY_CLAUDE_OPUS_1M_MODEL) {
@@ -1998,11 +1999,17 @@ function normalizeClaudeModel(model) {
1998
1999
  }
1999
2000
  return model;
2000
2001
  }
2002
+ var AGENT_MODELS = {
2003
+ claude: [CLAUDE_OPUS_1M_MODEL, CLAUDE_FABLE_5_MODEL, "sonnet", "haiku"],
2004
+ codex: [DEFAULT_CODEX_MODEL, "gpt-5.4", "gpt-5.4-mini", "gpt-5.3-codex", "gpt-5.3-codex-spark", "gpt-5.2-codex", "gpt-5.2", "gpt-5.1-codex-max", "gpt-5.1-codex", "gpt-5.1", "gpt-5-codex", "gpt-5"],
2005
+ relay: [CLAUDE_OPUS_1M_MODEL, CLAUDE_FABLE_5_MODEL, "sonnet"]
2006
+ };
2001
2007
  var MODEL_LABELS = {
2002
2008
  sonnet: "Sonnet 4.5",
2003
2009
  opus: "Opus 4.8",
2004
2010
  [CLAUDE_OPUS_1M_MODEL]: "Opus 4.8 (1M)",
2005
2011
  [LEGACY_CLAUDE_OPUS_1M_MODEL]: "Opus 4.8 (1M)",
2012
+ [CLAUDE_FABLE_5_MODEL]: "Fable 5",
2006
2013
  haiku: "Haiku 4.5",
2007
2014
  [DEFAULT_CODEX_MODEL]: "GPT-5.5",
2008
2015
  "gpt-5.4": "GPT-5.4",
@@ -2502,10 +2509,35 @@ function areSameUserMessageEvents(a, b) {
2502
2509
  if (aItemId || bItemId) return aItemId === bItemId;
2503
2510
  return Math.abs(getEventTimestampMs(a) - getEventTimestampMs(b)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
2504
2511
  }
2512
+ function parseAgentEventJsonl(content, options = {}) {
2513
+ const events = [];
2514
+ for (const line of content.split("\n")) {
2515
+ const trimmed = line.trim();
2516
+ if (!trimmed) continue;
2517
+ try {
2518
+ const parsed = JSON.parse(trimmed);
2519
+ if (isAgentBackendEvent(parsed)) {
2520
+ events.push(parsed);
2521
+ } else {
2522
+ options.onInvalidLine?.({ line: trimmed });
2523
+ }
2524
+ } catch (error) {
2525
+ options.onInvalidLine?.({ line: trimmed, error });
2526
+ }
2527
+ }
2528
+ return events;
2529
+ }
2505
2530
 
2506
2531
  // ../shared/src/display-message/parsers/codex-asp-parser.ts
2507
2532
  var DUPLICATE_WINDOW_MS = 5 * 60 * 1e3;
2508
2533
 
2534
+ // ../shared/src/display-message/parsers/index.ts
2535
+ function isAgentBackendEvent(value) {
2536
+ if (!value || typeof value !== "object") return false;
2537
+ const candidate = value;
2538
+ return typeof candidate.timestamp === "string" && typeof candidate.type === "string" && typeof candidate.payload === "object" && candidate.payload !== null;
2539
+ }
2540
+
2509
2541
  // ../shared/src/object-store/types.ts
2510
2542
  var MEDIA_KIND = {
2511
2543
  IMAGE: "image",
@@ -2739,14 +2771,16 @@ async function monolithRequest(path4, init = {}) {
2739
2771
  if (!ENGINE_ENV.WORKSPACE_ID) {
2740
2772
  throw new Error("WORKSPACE_ID is not set; cannot call monolith");
2741
2773
  }
2774
+ const isFormData = init.body instanceof FormData;
2775
+ const headers = {
2776
+ Authorization: `Bearer ${ENGINE_ENV.REPLICAS_ENGINE_SECRET}`,
2777
+ "X-Workspace-Id": ENGINE_ENV.WORKSPACE_ID
2778
+ };
2779
+ if (!isFormData) headers["Content-Type"] = "application/json";
2742
2780
  return fetch(`${ENGINE_ENV.MONOLITH_URL}${path4}`, {
2743
2781
  method: init.method ?? "POST",
2744
- headers: {
2745
- Authorization: `Bearer ${ENGINE_ENV.REPLICAS_ENGINE_SECRET}`,
2746
- "X-Workspace-Id": ENGINE_ENV.WORKSPACE_ID,
2747
- "Content-Type": "application/json"
2748
- },
2749
- body: init.body === void 0 ? void 0 : JSON.stringify(init.body),
2782
+ headers,
2783
+ body: init.body === void 0 ? void 0 : isFormData ? init.body : JSON.stringify(init.body),
2750
2784
  signal: init.signal
2751
2785
  });
2752
2786
  }
@@ -4729,30 +4763,10 @@ import { homedir as homedir11 } from "os";
4729
4763
 
4730
4764
  // src/utils/jsonl-reader.ts
4731
4765
  import { readFile as readFile7 } from "fs/promises";
4732
- function isJsonlEvent(value) {
4733
- if (!isRecord4(value)) {
4734
- return false;
4735
- }
4736
- return typeof value.timestamp === "string" && typeof value.type === "string" && isRecord4(value.payload);
4737
- }
4738
- function parseJsonlEvents(lines) {
4739
- const events = [];
4740
- for (const line of lines) {
4741
- try {
4742
- const parsed = JSON.parse(line);
4743
- if (isJsonlEvent(parsed)) {
4744
- events.push(parsed);
4745
- }
4746
- } catch {
4747
- }
4748
- }
4749
- return events;
4750
- }
4751
4766
  async function readJSONL(filePath) {
4752
4767
  try {
4753
4768
  const content = await readFile7(filePath, "utf-8");
4754
- const lines = content.split("\n").filter((line) => line.trim());
4755
- return parseJsonlEvents(lines);
4769
+ return parseAgentEventJsonl(content);
4756
4770
  } catch (error) {
4757
4771
  return [];
4758
4772
  }
@@ -6580,7 +6594,7 @@ var AspClient = class {
6580
6594
  // src/managers/codex-asp/app-server-process.ts
6581
6595
  var DEFAULT_CODEX_BINARY = "codex";
6582
6596
  var DEFAULT_CODEX_ARGS = ["app-server", "--listen", "stdio://"];
6583
- var ENGINE_PACKAGE_VERSION = "0.1.287";
6597
+ var ENGINE_PACKAGE_VERSION = "0.1.289";
6584
6598
  var INITIALIZE_METHOD = "initialize";
6585
6599
  var INITIALIZED_NOTIFICATION = "initialized";
6586
6600
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -8363,7 +8377,7 @@ You will also receive the chatId so you can send follow-up messages or clean up
8363
8377
  {
8364
8378
  provider: providerEnum.describe(providerDesc),
8365
8379
  prompt: z.string().describe("The full prompt/instructions for the subagent. Be detailed - it has no context from your conversation."),
8366
- model: z.string().optional().describe(codexAvailable ? "Model override. Claude: opus[1m] (default, 1M context, use for very large codebases or huge context tasks), sonnet, haiku. Codex: gpt-5.5, gpt-5.4, gpt-5.3-codex, etc." : "Model override. Claude: opus[1m] (default, 1M context, use for very large codebases or huge context tasks), sonnet, haiku."),
8380
+ model: z.string().optional().describe(codexAvailable ? `Model override. Claude: ${AGENT_MODELS.claude.join(", ")} (opus[1m] is the default, 1M context, use for very large codebases or huge context tasks). Codex: gpt-5.5, gpt-5.4, gpt-5.3-codex, etc.` : `Model override. Claude: ${AGENT_MODELS.claude.join(", ")} (opus[1m] is the default, 1M context, use for very large codebases or huge context tasks).`),
8367
8381
  thinking_level: z.enum(["low", "medium", "high", "max"]).optional().describe(
8368
8382
  "Controls how much thinking/reasoning the subagent applies. low = light thinking, medium = moderate, high = deep reasoning, max = maximum effort. Defaults: Claude = high, Codex = medium."
8369
8383
  ),
@@ -8600,9 +8614,10 @@ function getUsingToolsSection() {
8600
8614
  function getDelegationSection(codexAvailable) {
8601
8615
  const providerList = codexAvailable ? "claude, codex, or relay" : "claude or relay";
8602
8616
  const spawnDesc = `Create a new subagent with a specific provider (${providerList}), send it a prompt, and wait for its response. Returns the chatId and the agent's final response. You can set a custom timeout via the timeout_minutes parameter (default: 10 minutes).`;
8617
+ const claudeModelList = AGENT_MODELS.claude.join(", ");
8603
8618
  const agentSelectionLines = codexAvailable ? `Use provider 'codex' for heavy code writing, implementation, and large refactors. Suggested models: gpt-5.5 (default), gpt-5.4, gpt-5.3-codex.
8604
8619
 
8605
- Use provider 'claude' for codebase exploration, code review, planning, complex debugging, and tasks requiring nuanced architectural understanding. Suggested models: opus[1m] (default, 1M context window, use for very large codebases), sonnet (faster).` : `Use provider 'claude' for all tasks including code writing, codebase exploration, code review, planning, complex debugging, and tasks requiring nuanced architectural understanding. Suggested models: opus[1m] (default, 1M context window, use for very large codebases), sonnet (faster).`;
8620
+ Use provider 'claude' for codebase exploration, code review, planning, complex debugging, and tasks requiring nuanced architectural understanding. Suggested models: ${claudeModelList} (opus[1m] is the default, 1M context window, use for very large codebases; sonnet is faster).` : `Use provider 'claude' for all tasks including code writing, codebase exploration, code review, planning, complex debugging, and tasks requiring nuanced architectural understanding. Suggested models: ${claudeModelList} (opus[1m] is the default, 1M context window, use for very large codebases; sonnet is faster).`;
8606
8621
  return `# Delegation
8607
8622
 
8608
8623
  You have three subagent tools for spawning and managing agents that run in separate context windows:
@@ -9592,11 +9607,11 @@ function scoreMatch(query2, filePath) {
9592
9607
  const lowerQuery = query2.toLowerCase();
9593
9608
  const lowerPath = filePath.toLowerCase();
9594
9609
  const segments = lowerPath.split("/");
9595
- const basename2 = segments[segments.length - 1] ?? "";
9596
- if (basename2 === lowerQuery) return 100;
9597
- if (basename2.startsWith(lowerQuery)) return 90;
9610
+ const basename3 = segments[segments.length - 1] ?? "";
9611
+ if (basename3 === lowerQuery) return 100;
9612
+ if (basename3.startsWith(lowerQuery)) return 90;
9598
9613
  if (segments.some((seg) => seg === lowerQuery)) return 80;
9599
- if (basename2.includes(lowerQuery)) return 70;
9614
+ if (basename3.includes(lowerQuery)) return 70;
9600
9615
  if (segments.some((seg) => seg.includes(lowerQuery))) return 60;
9601
9616
  if (lowerPath.includes(lowerQuery)) return 50;
9602
9617
  return 0;
@@ -9799,23 +9814,76 @@ var RepoFileService = class {
9799
9814
  // src/v1-routes.ts
9800
9815
  import { Hono } from "hono";
9801
9816
  import { z as z2 } from "zod";
9802
- import { readdir as readdir5, stat as stat4, readFile as readFile13 } from "fs/promises";
9803
- import { join as join19, resolve as resolve2 } from "path";
9817
+ import { readdir as readdir6, stat as stat4, readFile as readFile14 } from "fs/promises";
9818
+ import { join as join20, resolve as resolve2 } from "path";
9804
9819
 
9805
- // src/services/canvas-service.ts
9806
- import { readdir as readdir3, readFile as readFile10, stat as stat3 } from "fs/promises";
9807
- import { homedir as homedir13 } from "os";
9820
+ // src/services/upload-chat-transcripts.ts
9821
+ import { readdir as readdir3, readFile as readFile10 } from "fs/promises";
9808
9822
  import { basename, join as join16 } from "path";
9823
+ import { homedir as homedir13 } from "os";
9824
+ var ENGINE_DIR3 = join16(homedir13(), ".replicas", "engine");
9825
+ var HISTORY_DIRS = [
9826
+ join16(ENGINE_DIR3, "claude-histories"),
9827
+ join16(ENGINE_DIR3, "relay-histories")
9828
+ ];
9829
+ async function flushAllChatTranscripts() {
9830
+ let flushed = 0;
9831
+ let failed = 0;
9832
+ const tasks = [];
9833
+ for (const dir of HISTORY_DIRS) {
9834
+ let entries;
9835
+ try {
9836
+ entries = await readdir3(dir);
9837
+ } catch {
9838
+ continue;
9839
+ }
9840
+ for (const entry of entries) {
9841
+ if (!entry.endsWith(".jsonl")) continue;
9842
+ const chatId = basename(entry, ".jsonl");
9843
+ tasks.push(
9844
+ uploadOne(chatId, join16(dir, entry)).then(() => {
9845
+ flushed++;
9846
+ }).catch((err) => {
9847
+ failed++;
9848
+ console.error("[ChatTranscriptUploader] upload failed:", { chatId, err });
9849
+ })
9850
+ );
9851
+ }
9852
+ }
9853
+ await Promise.all(tasks);
9854
+ return { flushed, failed };
9855
+ }
9856
+ async function uploadOne(chatId, filePath) {
9857
+ const bytes = await readFile10(filePath);
9858
+ if (bytes.byteLength === 0) return;
9859
+ const form = new FormData();
9860
+ form.append("chat_id", chatId);
9861
+ form.append(
9862
+ "file",
9863
+ new Blob([new Uint8Array(bytes)], { type: "application/x-ndjson" }),
9864
+ "transcript.jsonl"
9865
+ );
9866
+ const response = await monolithRequest("/v1/engine/chat-transcripts", { body: form });
9867
+ if (!response.ok) {
9868
+ const errorText = await response.text();
9869
+ throw new Error(`upload failed: ${response.status} ${errorText}`);
9870
+ }
9871
+ }
9872
+
9873
+ // src/services/canvas-service.ts
9874
+ import { readdir as readdir4, readFile as readFile11, stat as stat3 } from "fs/promises";
9875
+ import { homedir as homedir14 } from "os";
9876
+ import { basename as basename2, join as join17 } from "path";
9809
9877
  var CANVAS_DIRECTORIES = [
9810
- join16(homedir13(), ".claude", "plans"),
9811
- join16(homedir13(), ".replicas", "canvas")
9878
+ join17(homedir14(), ".claude", "plans"),
9879
+ join17(homedir14(), ".replicas", "canvas")
9812
9880
  ];
9813
9881
  var MAX_CANVAS_FILE_BYTES = 5 * 1024 * 1024;
9814
9882
  function isTextKind(kind) {
9815
9883
  return kind === "markdown" || kind === "html";
9816
9884
  }
9817
9885
  function sanitizeFilename(filename) {
9818
- return basename(filename);
9886
+ return basename2(filename);
9819
9887
  }
9820
9888
  var CanvasService = class {
9821
9889
  async listItems() {
@@ -9823,7 +9891,7 @@ var CanvasService = class {
9823
9891
  for (const directory of CANVAS_DIRECTORIES) {
9824
9892
  let entries;
9825
9893
  try {
9826
- entries = await readdir3(directory, { withFileTypes: true });
9894
+ entries = await readdir4(directory, { withFileTypes: true });
9827
9895
  } catch {
9828
9896
  continue;
9829
9897
  }
@@ -9834,7 +9902,7 @@ var CanvasService = class {
9834
9902
  const { kind } = classifyCanvasFilename(entry.name);
9835
9903
  let sizeBytes = 0;
9836
9904
  try {
9837
- const s = await stat3(join16(directory, entry.name));
9905
+ const s = await stat3(join17(directory, entry.name));
9838
9906
  sizeBytes = s.size;
9839
9907
  } catch {
9840
9908
  continue;
@@ -9849,7 +9917,7 @@ var CanvasService = class {
9849
9917
  if (!safe || safe !== filename || safe.startsWith(".")) return null;
9850
9918
  const { kind, mimeType } = classifyCanvasFilename(safe);
9851
9919
  for (const directory of CANVAS_DIRECTORIES) {
9852
- const filePath = join16(directory, safe);
9920
+ const filePath = join17(directory, safe);
9853
9921
  let sizeBytes = 0;
9854
9922
  try {
9855
9923
  const s = await stat3(filePath);
@@ -9868,10 +9936,10 @@ var CanvasService = class {
9868
9936
  }
9869
9937
  try {
9870
9938
  if (isTextKind(kind)) {
9871
- const content = await readFile10(filePath, "utf-8");
9939
+ const content = await readFile11(filePath, "utf-8");
9872
9940
  return { filename: safe, kind, sizeBytes, mimeType, content };
9873
9941
  }
9874
- const buf = await readFile10(filePath);
9942
+ const buf = await readFile11(filePath);
9875
9943
  return { filename: safe, kind, sizeBytes, mimeType, base64: buf.toString("base64") };
9876
9944
  } catch {
9877
9945
  continue;
@@ -9884,16 +9952,16 @@ var canvasService = new CanvasService();
9884
9952
 
9885
9953
  // src/services/warm-hooks-service.ts
9886
9954
  import { spawn as spawn4 } from "child_process";
9887
- import { readFile as readFile12 } from "fs/promises";
9955
+ import { readFile as readFile13 } from "fs/promises";
9888
9956
  import { existsSync as existsSync8 } from "fs";
9889
- import { join as join18 } from "path";
9957
+ import { join as join19 } from "path";
9890
9958
 
9891
9959
  // src/services/warm-hook-logs-service.ts
9892
- import { mkdir as mkdir12, readFile as readFile11, writeFile as writeFile6, readdir as readdir4, appendFile as appendFile4, unlink as unlink3 } from "fs/promises";
9893
- import { homedir as homedir14 } from "os";
9894
- import { join as join17 } from "path";
9895
- var LOGS_DIR2 = join17(homedir14(), ".replicas", "warm-hook-logs");
9896
- var CURRENT_RUN_LOG = join17(LOGS_DIR2, "current-run.log");
9960
+ import { mkdir as mkdir12, readFile as readFile12, writeFile as writeFile6, readdir as readdir5, appendFile as appendFile4, unlink as unlink3 } from "fs/promises";
9961
+ import { homedir as homedir15 } from "os";
9962
+ import { join as join18 } from "path";
9963
+ var LOGS_DIR2 = join18(homedir15(), ".replicas", "warm-hook-logs");
9964
+ var CURRENT_RUN_LOG = join18(LOGS_DIR2, "current-run.log");
9897
9965
  var GLOBAL_FILENAME = "global.json";
9898
9966
  function withPreview2(stored) {
9899
9967
  const preview = buildHookOutputPreview(stored.output);
@@ -9910,7 +9978,7 @@ var WarmHookLogsService = class {
9910
9978
  hookName: "organization",
9911
9979
  ...entry
9912
9980
  };
9913
- await writeFile6(join17(LOGS_DIR2, GLOBAL_FILENAME), `${JSON.stringify(log, null, 2)}
9981
+ await writeFile6(join18(LOGS_DIR2, GLOBAL_FILENAME), `${JSON.stringify(log, null, 2)}
9914
9982
  `, "utf-8");
9915
9983
  }
9916
9984
  async saveEnvironmentHookLog(entry) {
@@ -9920,7 +9988,7 @@ var WarmHookLogsService = class {
9920
9988
  hookName: "environment",
9921
9989
  ...entry
9922
9990
  };
9923
- await writeFile6(join17(LOGS_DIR2, ENVIRONMENT_HOOK_LOG_FILENAME), `${JSON.stringify(log, null, 2)}
9991
+ await writeFile6(join18(LOGS_DIR2, ENVIRONMENT_HOOK_LOG_FILENAME), `${JSON.stringify(log, null, 2)}
9924
9992
  `, "utf-8");
9925
9993
  }
9926
9994
  async saveRepoHookLog(repoName, entry) {
@@ -9930,13 +9998,13 @@ var WarmHookLogsService = class {
9930
9998
  hookName: repoName,
9931
9999
  ...entry
9932
10000
  };
9933
- await writeFile6(join17(LOGS_DIR2, repoHookLogFilename(repoName)), `${JSON.stringify(log, null, 2)}
10001
+ await writeFile6(join18(LOGS_DIR2, repoHookLogFilename(repoName)), `${JSON.stringify(log, null, 2)}
9934
10002
  `, "utf-8");
9935
10003
  }
9936
10004
  async getAllLogs() {
9937
10005
  let files;
9938
10006
  try {
9939
- files = await readdir4(LOGS_DIR2);
10007
+ files = await readdir5(LOGS_DIR2);
9940
10008
  } catch (err) {
9941
10009
  if (err.code === "ENOENT") {
9942
10010
  return [];
@@ -9949,7 +10017,7 @@ var WarmHookLogsService = class {
9949
10017
  continue;
9950
10018
  }
9951
10019
  try {
9952
- const raw = await readFile11(join17(LOGS_DIR2, file), "utf-8");
10020
+ const raw = await readFile12(join18(LOGS_DIR2, file), "utf-8");
9953
10021
  const stored = JSON.parse(raw);
9954
10022
  logs.push(withPreview2(stored));
9955
10023
  } catch {
@@ -9978,7 +10046,7 @@ var WarmHookLogsService = class {
9978
10046
  }
9979
10047
  async getCurrentRunLog() {
9980
10048
  try {
9981
- return await readFile11(CURRENT_RUN_LOG, "utf-8");
10049
+ return await readFile12(CURRENT_RUN_LOG, "utf-8");
9982
10050
  } catch (err) {
9983
10051
  if (err.code === "ENOENT") return null;
9984
10052
  throw err;
@@ -9987,7 +10055,7 @@ var WarmHookLogsService = class {
9987
10055
  async getFullOutput(hookType, hookName) {
9988
10056
  const filename = hookType === "global" ? GLOBAL_FILENAME : hookType === "environment" ? ENVIRONMENT_HOOK_LOG_FILENAME : repoHookLogFilename(hookName);
9989
10057
  try {
9990
- const raw = await readFile11(join17(LOGS_DIR2, filename), "utf-8");
10058
+ const raw = await readFile12(join18(LOGS_DIR2, filename), "utf-8");
9991
10059
  const stored = JSON.parse(raw);
9992
10060
  if (stored.hookType !== hookType || stored.hookName !== hookName) {
9993
10061
  return null;
@@ -10006,12 +10074,12 @@ var warmHookLogsService = new WarmHookLogsService();
10006
10074
  // src/services/warm-hooks-service.ts
10007
10075
  async function readRepoWarmHook(repoPath) {
10008
10076
  for (const filename of REPLICAS_CONFIG_FILENAMES) {
10009
- const configPath = join18(repoPath, filename);
10077
+ const configPath = join19(repoPath, filename);
10010
10078
  if (!existsSync8(configPath)) {
10011
10079
  continue;
10012
10080
  }
10013
10081
  try {
10014
- const raw = await readFile12(configPath, "utf-8");
10082
+ const raw = await readFile13(configPath, "utf-8");
10015
10083
  const config = parseReplicasConfigString(raw, filename);
10016
10084
  if (!config.warmHook) {
10017
10085
  return null;
@@ -10487,6 +10555,17 @@ function createV1Routes(deps) {
10487
10555
  return c.json(jsonError("Failed to clear goal", error instanceof Error ? error.message : "Unknown error"), 404);
10488
10556
  }
10489
10557
  });
10558
+ app2.post("/chat-transcripts/flush-all", async (c) => {
10559
+ try {
10560
+ const result = await flushAllChatTranscripts();
10561
+ return c.json(result);
10562
+ } catch (error) {
10563
+ return c.json(
10564
+ jsonError("Failed to flush transcripts", error instanceof Error ? error.message : "Unknown error"),
10565
+ 500
10566
+ );
10567
+ }
10568
+ });
10490
10569
  app2.get("/chats/:chatId/queue", (c) => {
10491
10570
  try {
10492
10571
  const result = deps.chatService.getChatQueue(c.req.param("chatId"));
@@ -10922,11 +11001,11 @@ function createV1Routes(deps) {
10922
11001
  });
10923
11002
  app2.get("/logs", async (c) => {
10924
11003
  try {
10925
- const files = await readdir5(LOG_DIR).catch(() => []);
11004
+ const files = await readdir6(LOG_DIR).catch(() => []);
10926
11005
  const logFiles = files.filter((f) => f.endsWith(".log"));
10927
11006
  const sessions = await Promise.all(
10928
11007
  logFiles.map(async (filename) => {
10929
- const filePath = join19(LOG_DIR, filename);
11008
+ const filePath = join20(LOG_DIR, filename);
10930
11009
  const fileStat = await stat4(filePath);
10931
11010
  const sessionId = filename.replace(/\.log$/, "");
10932
11011
  return {
@@ -10963,7 +11042,7 @@ function createV1Routes(deps) {
10963
11042
  const limit = Math.min(parseInt(c.req.query("limit") || "500", 10), 5e3);
10964
11043
  let content;
10965
11044
  try {
10966
- content = await readFile13(filePath, "utf-8");
11045
+ content = await readFile14(filePath, "utf-8");
10967
11046
  } catch {
10968
11047
  return c.json(jsonError("Log session not found"), 404);
10969
11048
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.287",
3
+ "version": "0.1.289",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",