replicas-engine 0.1.218 → 0.1.219

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