replicas-engine 0.1.218 → 0.1.220

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 +46 -2
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -283,6 +283,8 @@ function buildPaths(homeDir) {
283
283
  }
284
284
  var DAYTONA_PATHS = buildPaths("/home/ubuntu");
285
285
  var E2B_PATHS = buildPaths("/home/user");
286
+ var WORKSPACE_SIZES = ["small", "large"];
287
+ var INVALID_WORKSPACE_SIZE_ERROR = `Invalid size: must be one of ${WORKSPACE_SIZES.join(", ")}`;
286
288
 
287
289
  // ../shared/src/runtime-env.ts
288
290
  function parsePosixEnvFile(content) {
@@ -1759,7 +1761,7 @@ function parseReplicasConfigString(content, filename) {
1759
1761
  }
1760
1762
 
1761
1763
  // ../shared/src/engine/environment.ts
1762
- var DAYTONA_SNAPSHOT_ID = "26-05-2026-royal-york-v5";
1764
+ var DAYTONA_SNAPSHOT_ID = "27-05-2026-royal-york-v2";
1763
1765
 
1764
1766
  // ../shared/src/engine/types.ts
1765
1767
  var DEFAULT_CHAT_TITLES = {
@@ -8260,10 +8262,11 @@ import { join as join19 } from "path";
8260
8262
 
8261
8263
  // src/services/warm-hook-logs-service.ts
8262
8264
  import { createHash as createHash2 } from "crypto";
8263
- import { mkdir as mkdir12, readFile as readFile11, writeFile as writeFile10, readdir as readdir5 } from "fs/promises";
8265
+ import { mkdir as mkdir12, readFile as readFile11, writeFile as writeFile10, readdir as readdir5, appendFile as appendFile6, unlink as unlink3 } from "fs/promises";
8264
8266
  import { homedir as homedir15 } from "os";
8265
8267
  import { join as join18 } from "path";
8266
8268
  var LOGS_DIR2 = join18(homedir15(), ".replicas", "warm-hook-logs");
8269
+ var CURRENT_RUN_LOG = join18(LOGS_DIR2, "current-run.log");
8267
8270
  function sanitizeFilename2(name) {
8268
8271
  const safe = name.replace(/[^a-zA-Z0-9._-]/g, "_");
8269
8272
  const hash = createHash2("sha256").update(name).digest("hex").slice(0, 8);
@@ -8347,6 +8350,26 @@ var WarmHookLogsService = class {
8347
8350
  });
8348
8351
  return logs;
8349
8352
  }
8353
+ async resetCurrentRunLog() {
8354
+ await this.ensureDir();
8355
+ try {
8356
+ await unlink3(CURRENT_RUN_LOG);
8357
+ } catch (err) {
8358
+ if (err.code !== "ENOENT") throw err;
8359
+ }
8360
+ }
8361
+ async appendCurrentRunLog(chunk) {
8362
+ if (!chunk) return;
8363
+ await appendFile6(CURRENT_RUN_LOG, chunk, "utf-8");
8364
+ }
8365
+ async getCurrentRunLog() {
8366
+ try {
8367
+ return await readFile11(CURRENT_RUN_LOG, "utf-8");
8368
+ } catch (err) {
8369
+ if (err.code === "ENOENT") return null;
8370
+ throw err;
8371
+ }
8372
+ }
8350
8373
  async getFullOutput(hookType, hookName) {
8351
8374
  const filename = hookType === "global" ? globalFilename() : hookType === "environment" ? environmentFilename() : repoFilename2(hookName);
8352
8375
  try {
@@ -8473,6 +8496,16 @@ async function executeHookScriptStreaming(params) {
8473
8496
  });
8474
8497
  }
8475
8498
  async function runWarmHooksStreaming(params) {
8499
+ await warmHookLogsService.resetCurrentRunLog();
8500
+ const originalOnEvent = params.onEvent;
8501
+ const onEvent = (event) => {
8502
+ if (event.type === "output" && event.data) {
8503
+ void warmHookLogsService.appendCurrentRunLog(event.data).catch(() => {
8504
+ });
8505
+ }
8506
+ originalOnEvent(event);
8507
+ };
8508
+ params = { ...params, onEvent };
8476
8509
  const outputBlocks = [];
8477
8510
  const globalHook = (params.globalWarmHook ?? params.organizationWarmHook)?.trim();
8478
8511
  const environmentHook = params.environmentWarmHook?.trim();
@@ -9066,6 +9099,17 @@ function createV1Routes(deps) {
9066
9099
  );
9067
9100
  }
9068
9101
  });
9102
+ app2.get("/warm-hooks/current-run/log", async (c) => {
9103
+ try {
9104
+ const output = await warmHookLogsService.getCurrentRunLog();
9105
+ return c.json({ output: output ?? "" });
9106
+ } catch (error) {
9107
+ return c.json(
9108
+ jsonError("Failed to read current warm hook run log", error instanceof Error ? error.message : "Unknown error"),
9109
+ 500
9110
+ );
9111
+ }
9112
+ });
9069
9113
  app2.get("/warm-hooks/logs/:hookType/:hookName/full", async (c) => {
9070
9114
  try {
9071
9115
  const hookType = c.req.param("hookType");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.218",
3
+ "version": "0.1.220",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",