replicas-engine 0.1.1142 → 0.1.1143

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-25OYZBXM.js";
11
+ } from "./chunk-CTIQ6YFN.js";
12
12
  import "./chunk-WIFD4BIP.js";
13
- import "./chunk-ZEKQ2ZY3.js";
13
+ import "./chunk-7TBZMUEO.js";
14
14
  import "./chunk-R7L4U6E6.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
16
  import "./chunk-JWY6JUCD.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.1142";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1143";
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-ZEKQ2ZY3.js";
6
+ } from "./chunk-7TBZMUEO.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  AppServerProcess,
16
16
  buildCodexAgentEnv
17
- } from "./chunk-ZEKQ2ZY3.js";
17
+ } from "./chunk-7TBZMUEO.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-QT75LTHA.js");
294
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-PDBXP3W5.js");
295
295
  await restartCodexAspHostIfRunning2();
296
296
  });
297
297
  await this.start(true);
@@ -312,7 +312,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
312
312
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
313
313
  await this.applyCredentialsResponse(data);
314
314
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
315
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-QT75LTHA.js");
315
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-PDBXP3W5.js");
316
316
  await restartCodexAspHostIfRunning2();
317
317
  }
318
318
  setAgentCredentialSnapshot("codex", data);
@@ -13,11 +13,11 @@ import {
13
13
  recoverCompletedTurn,
14
14
  spawnMuseMsp,
15
15
  startMuseSession
16
- } from "./chunk-3GJPIEW5.js";
16
+ } from "./chunk-CM34F3ZV.js";
17
17
  import {
18
18
  AppServerProcess,
19
19
  buildCodexAgentEnv
20
- } from "./chunk-ZEKQ2ZY3.js";
20
+ } from "./chunk-7TBZMUEO.js";
21
21
  import "./chunk-R7L4U6E6.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-3GJPIEW5.js";
67
+ } from "./chunk-CM34F3ZV.js";
68
68
  import {
69
69
  publishedPullRequestUrls
70
70
  } from "./chunk-Z23POTSA.js";
@@ -130,7 +130,7 @@ import {
130
130
  timestampFromSeconds,
131
131
  upsertCredentialFileLines,
132
132
  writeSecureCredentialFile
133
- } from "./chunk-25OYZBXM.js";
133
+ } from "./chunk-CTIQ6YFN.js";
134
134
  import {
135
135
  ENGINE_ENV,
136
136
  monolithRequest,
@@ -142,7 +142,7 @@ import {
142
142
  } from "./chunk-WIFD4BIP.js";
143
143
  import {
144
144
  getCodexModelProvider
145
- } from "./chunk-ZEKQ2ZY3.js";
145
+ } from "./chunk-7TBZMUEO.js";
146
146
  import {
147
147
  SUBPROCESS_MAX_BUFFER,
148
148
  execAsync,
@@ -9675,12 +9675,6 @@ var EnvironmentDetailsService = class {
9675
9675
  details.lastUpdatedAt = (/* @__PURE__ */ new Date()).toISOString();
9676
9676
  await writeDetails(details);
9677
9677
  }
9678
- async setGlobalWarmHook(status, details) {
9679
- const current = await readDetails();
9680
- current.globalWarmHookCompleted = { status, details: details ?? null };
9681
- current.lastUpdatedAt = (/* @__PURE__ */ new Date()).toISOString();
9682
- await writeDetails(current);
9683
- }
9684
9678
  async setEnvironmentWarmHook(status, details) {
9685
9679
  const current = await readDetails();
9686
9680
  current.environmentWarmHookCompleted = { status, details: details ?? null };
@@ -61355,7 +61349,6 @@ import { homedir as homedir12 } from "os";
61355
61349
  import { join as join32 } from "path";
61356
61350
  var LOGS_DIR2 = join32(homedir12(), ".replicas", "warm-hook-logs");
61357
61351
  var CURRENT_RUN_LOG = join32(LOGS_DIR2, "current-run.log");
61358
- var GLOBAL_FILENAME = "global.json";
61359
61352
  function withPreview2(stored) {
61360
61353
  const preview = buildHookOutputPreview(stored.output);
61361
61354
  return { ...stored, ...preview };
@@ -61364,16 +61357,6 @@ var WarmHookLogsService = class {
61364
61357
  async ensureDir() {
61365
61358
  await mkdir18(LOGS_DIR2, { recursive: true });
61366
61359
  }
61367
- async saveGlobalHookLog(entry) {
61368
- await this.ensureDir();
61369
- const log = {
61370
- hookType: "global",
61371
- hookName: "organization",
61372
- ...entry
61373
- };
61374
- await writeFile9(join32(LOGS_DIR2, GLOBAL_FILENAME), `${JSON.stringify(log, null, 2)}
61375
- `, "utf-8");
61376
- }
61377
61360
  async saveEnvironmentHookLog(entry) {
61378
61361
  await this.ensureDir();
61379
61362
  const log = {
@@ -61412,15 +61395,13 @@ var WarmHookLogsService = class {
61412
61395
  try {
61413
61396
  const raw = await readFile18(join32(LOGS_DIR2, file), "utf-8");
61414
61397
  const stored = JSON.parse(raw);
61398
+ if (stored.hookType !== "environment" && stored.hookType !== "repository") continue;
61415
61399
  logs.push(withPreview2(stored));
61416
61400
  } catch {
61417
61401
  }
61418
61402
  }
61419
61403
  logs.sort((a, b) => {
61420
- if (a.hookType !== b.hookType) {
61421
- const order = { global: 0, environment: 1, repository: 2 };
61422
- return order[a.hookType] - order[b.hookType];
61423
- }
61404
+ if (a.hookType !== b.hookType) return a.hookType === "environment" ? -1 : 1;
61424
61405
  return a.hookName.localeCompare(b.hookName);
61425
61406
  });
61426
61407
  return logs;
@@ -61446,7 +61427,7 @@ var WarmHookLogsService = class {
61446
61427
  }
61447
61428
  }
61448
61429
  async getFullOutput(hookType, hookName) {
61449
- const filename = hookType === "global" ? GLOBAL_FILENAME : hookType === "environment" ? ENVIRONMENT_HOOK_LOG_FILENAME : repoHookLogFilename(hookName);
61430
+ const filename = hookType === "environment" ? ENVIRONMENT_HOOK_LOG_FILENAME : repoHookLogFilename(hookName);
61450
61431
  try {
61451
61432
  const raw = await readFile18(join32(LOGS_DIR2, filename), "utf-8");
61452
61433
  const stored = JSON.parse(raw);
@@ -61582,36 +61563,7 @@ async function runWarmHooksStreaming(params) {
61582
61563
  };
61583
61564
  params = { ...params, onEvent };
61584
61565
  const outputBlocks = [];
61585
- const globalHook = params.globalWarmHook?.trim();
61586
61566
  const environmentHook = params.environmentWarmHook?.trim();
61587
- if (globalHook) {
61588
- const globalResult = await executeHookScriptStreaming({
61589
- label: "global-warm-hook",
61590
- cwd: gitService.getWorkspaceRoot(),
61591
- content: globalHook,
61592
- timeoutMs: params.timeoutMs,
61593
- onChunk: (chunk) => params.onEvent({ type: "output", data: chunk, label: "global-warm-hook" })
61594
- });
61595
- outputBlocks.push(globalResult.output);
61596
- await environmentDetailsService.setGlobalWarmHook(globalResult.exitCode === 0 ? "yes" : "no", globalResult.output);
61597
- await warmHookLogsService.saveGlobalHookLog({
61598
- hookScript: globalHook,
61599
- output: globalResult.output,
61600
- exitCode: globalResult.exitCode,
61601
- timedOut: globalResult.timedOut,
61602
- executedAt: (/* @__PURE__ */ new Date()).toISOString()
61603
- });
61604
- if (globalResult.exitCode !== 0) {
61605
- await environmentDetailsService.setEnvironmentWarmHook("n/a");
61606
- const result2 = {
61607
- exitCode: globalResult.exitCode,
61608
- output: outputBlocks.join("\n\n"),
61609
- timedOut: globalResult.timedOut
61610
- };
61611
- params.onEvent({ type: "complete", exitCode: result2.exitCode, timedOut: result2.timedOut });
61612
- return result2;
61613
- }
61614
- }
61615
61567
  if (environmentHook) {
61616
61568
  const envResult = await executeHookScriptStreaming({
61617
61569
  label: "environment-warm-hook",
@@ -61641,9 +61593,6 @@ async function runWarmHooksStreaming(params) {
61641
61593
  } else {
61642
61594
  await environmentDetailsService.setEnvironmentWarmHook("n/a");
61643
61595
  }
61644
- if (!globalHook) {
61645
- await environmentDetailsService.setGlobalWarmHook("n/a");
61646
- }
61647
61596
  const repoHooks = await collectRepoWarmHooks();
61648
61597
  const repoHookNames = new Set(repoHooks.map((repoHook) => repoHook.repoName));
61649
61598
  const discoveredRepos = await gitService.listRepositories();
@@ -62684,7 +62633,6 @@ data: ${JSON.stringify("Terminal session not found")}
62684
62633
  try {
62685
62634
  const body = await c.req.json();
62686
62635
  const result = await runWarmHooks({
62687
- globalWarmHook: body.globalWarmHook,
62688
62636
  environmentWarmHook: body.environmentWarmHook,
62689
62637
  timeoutMs: body.timeoutMs
62690
62638
  });
@@ -62705,7 +62653,6 @@ data: ${JSON.stringify("Terminal session not found")}
62705
62653
  const body = await c.req.json();
62706
62654
  return createJsonEventStream(
62707
62655
  (send) => runWarmHooksStreaming({
62708
- globalWarmHook: body.globalWarmHook,
62709
62656
  environmentWarmHook: body.environmentWarmHook,
62710
62657
  timeoutMs: body.timeoutMs,
62711
62658
  onEvent: (event) => {
@@ -62767,8 +62714,8 @@ data: ${JSON.stringify("Terminal session not found")}
62767
62714
  try {
62768
62715
  const hookType = c.req.param("hookType");
62769
62716
  const hookName = c.req.param("hookName");
62770
- if (hookType !== "global" && hookType !== "environment" && hookType !== "repository") {
62771
- return c.json(jsonError("Invalid hookType", 'Must be "global", "environment", or "repository"'), 400);
62717
+ if (hookType !== "environment" && hookType !== "repository") {
62718
+ return c.json(jsonError("Invalid hookType", 'Must be "environment" or "repository"'), 400);
62772
62719
  }
62773
62720
  const output = await warmHookLogsService.getFullOutput(hookType, hookName);
62774
62721
  if (output === null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1142",
3
+ "version": "0.1.1143",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",