flockbay 0.10.17 → 0.10.20

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.
@@ -3,7 +3,7 @@
3
3
  var chalk = require('chalk');
4
4
  var os = require('node:os');
5
5
  var node_crypto = require('node:crypto');
6
- var types = require('./types-CGQhv7Z-.cjs');
6
+ var types = require('./types-BYHCKlu_.cjs');
7
7
  var node_child_process = require('node:child_process');
8
8
  var path = require('node:path');
9
9
  var node_readline = require('node:readline');
@@ -1272,7 +1272,7 @@ function buildDaemonSafeEnv(baseEnv, binPath) {
1272
1272
  env[pathKey] = [...prepend, ...existingParts].join(pathSep);
1273
1273
  return env;
1274
1274
  }
1275
- const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BxBuBx7C.cjs', document.baseURI).href)));
1275
+ const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-D_mglYG0.cjs', document.baseURI).href)));
1276
1276
  const __dirname$1 = path.join(__filename$1, "..");
1277
1277
  function getGlobalClaudeVersion(claudeExecutable) {
1278
1278
  try {
@@ -4603,7 +4603,13 @@ async function checkIfDaemonRunningAndCleanupStaleState() {
4603
4603
  return false;
4604
4604
  }
4605
4605
  }
4606
- return false;
4606
+ const lockPid = readDaemonLockPid();
4607
+ if (!lockPid) return false;
4608
+ if (!isProcessAlive(lockPid)) {
4609
+ await cleanupDaemonState();
4610
+ return false;
4611
+ }
4612
+ return true;
4607
4613
  }
4608
4614
  async function isDaemonRunningCurrentCliVersion() {
4609
4615
  types.logger.debug("[DAEMON CONTROL] Checking if daemon is running same version");
@@ -4659,7 +4665,43 @@ async function stopDaemon() {
4659
4665
  await cleanupDaemonState();
4660
4666
  return;
4661
4667
  }
4662
- types.logger.debug("No daemon state found");
4668
+ const lockPid = readDaemonLockPid();
4669
+ if (!lockPid) {
4670
+ types.logger.debug("No daemon state found");
4671
+ return;
4672
+ }
4673
+ if (!isProcessAlive(lockPid)) {
4674
+ types.logger.debug("[DAEMON RUN] Daemon lock PID not running, cleaning up state");
4675
+ await cleanupDaemonState();
4676
+ return;
4677
+ }
4678
+ const cmd = readProcessCommand(lockPid);
4679
+ const looksLikeDaemon = looksLikeFlockbayDaemonCommand(cmd, types.configuration.profile);
4680
+ if (!looksLikeDaemon) {
4681
+ types.logger.debug("[DAEMON RUN] Daemon lock is held by an unexpected process; refusing to kill", {
4682
+ lockPid,
4683
+ cmd: cmd || null
4684
+ });
4685
+ return;
4686
+ }
4687
+ types.logger.debug(`[DAEMON RUN] Stopping daemon by lock PID ${lockPid} (state file missing)`);
4688
+ try {
4689
+ process.kill(lockPid, "SIGTERM");
4690
+ } catch (error) {
4691
+ types.logger.debug("[DAEMON RUN] Failed to SIGTERM lock PID", { lockPid, error });
4692
+ }
4693
+ try {
4694
+ await waitForProcessDeath(lockPid, 2e3);
4695
+ } catch {
4696
+ }
4697
+ if (isProcessAlive(lockPid)) {
4698
+ try {
4699
+ process.kill(lockPid, "SIGKILL");
4700
+ } catch (error) {
4701
+ types.logger.debug("[DAEMON RUN] Failed to SIGKILL lock PID", { lockPid, error });
4702
+ }
4703
+ }
4704
+ await cleanupDaemonState();
4663
4705
  } catch (error) {
4664
4706
  types.logger.debug("Error stopping daemon", error);
4665
4707
  }
@@ -4676,6 +4718,39 @@ async function waitForProcessDeath(pid, timeout) {
4676
4718
  }
4677
4719
  throw new Error("Process did not die within timeout");
4678
4720
  }
4721
+ function isProcessAlive(pid) {
4722
+ try {
4723
+ process.kill(pid, 0);
4724
+ return true;
4725
+ } catch {
4726
+ return false;
4727
+ }
4728
+ }
4729
+ function readDaemonLockPid() {
4730
+ try {
4731
+ const raw = fs$3.readFileSync(types.configuration.daemonLockFile, "utf-8").trim();
4732
+ const pid = Number(raw);
4733
+ return Number.isFinite(pid) && pid > 0 ? pid : null;
4734
+ } catch {
4735
+ return null;
4736
+ }
4737
+ }
4738
+ function readProcessCommand(pid) {
4739
+ try {
4740
+ return String(node_child_process.execFileSync("ps", ["-p", String(pid), "-o", "command="], { encoding: "utf8" }) || "").trim();
4741
+ } catch {
4742
+ return null;
4743
+ }
4744
+ }
4745
+ function looksLikeFlockbayDaemonCommand(command, profile) {
4746
+ const cmd = String(command || "").trim();
4747
+ if (!cmd) return false;
4748
+ if (!cmd.includes("flockbay")) return false;
4749
+ if (!cmd.includes("daemon")) return false;
4750
+ if (!cmd.includes("start-sync")) return false;
4751
+ if (!cmd.includes("--profile")) return false;
4752
+ return cmd.includes(profile);
4753
+ }
4679
4754
 
4680
4755
  async function findAllFlockbayProcesses() {
4681
4756
  try {
@@ -4960,8 +5035,8 @@ async function loginWithClerkAndPairMachine() {
4960
5035
  types.logger.debug("[AUTH] Starting Clerk-based CLI login + machine pairing");
4961
5036
  const settings = await types.updateSettings(async (s) => {
4962
5037
  const machineId2 = s.machineId || node_crypto.randomUUID();
4963
- const serverUrl2 = s.serverUrl || types.configuration.serverUrl;
4964
- const webappUrl = s.webappUrl || types.configuration.webappUrl;
5038
+ const serverUrl2 = types.configuration.serverUrl;
5039
+ const webappUrl = types.configuration.webappUrl;
4965
5040
  return { ...s, machineId: machineId2, serverUrl: serverUrl2, webappUrl };
4966
5041
  });
4967
5042
  const serverUrl = types.configuration.serverUrl.replace(/\/+$/, "");
@@ -7155,7 +7230,8 @@ async function startFlockbayServer(client, options) {
7155
7230
  lastReachableAtMs: 0,
7156
7231
  lastIssueAtMs: 0,
7157
7232
  lastIssueKey: "",
7158
- launched: null
7233
+ launched: null,
7234
+ lastLaunch: null
7159
7235
  };
7160
7236
  const emitIssue = (event) => {
7161
7237
  const key = `${event.kind}:${event.severity}:${event.message}`;
@@ -7180,6 +7256,93 @@ async function startFlockbayServer(client, options) {
7180
7256
  }
7181
7257
  }
7182
7258
  };
7259
+ const tailText = (text, maxChars) => {
7260
+ const t = String(text || "").trim();
7261
+ if (!t) return "";
7262
+ if (t.length <= maxChars) return t;
7263
+ return t.slice(t.length - maxChars);
7264
+ };
7265
+ const findLatestFile = async (dir, filter) => {
7266
+ try {
7267
+ const entries = await fs$2.readdir(dir);
7268
+ let best = null;
7269
+ for (const name of entries) {
7270
+ if (!filter(name)) continue;
7271
+ const full = path.join(dir, name);
7272
+ let st;
7273
+ try {
7274
+ st = await fs$2.stat(full);
7275
+ } catch {
7276
+ continue;
7277
+ }
7278
+ if (!st?.isFile?.()) continue;
7279
+ const mtimeMs = Number(st.mtimeMs || 0);
7280
+ if (!best || mtimeMs > best.mtimeMs) best = { path: full, mtimeMs };
7281
+ }
7282
+ return best?.path ?? null;
7283
+ } catch {
7284
+ return null;
7285
+ }
7286
+ };
7287
+ const findLatestCrashDir = async (projectRoot) => {
7288
+ const crashesDir = path.join(projectRoot, "Saved", "Crashes");
7289
+ try {
7290
+ const entries = await fs$2.readdir(crashesDir);
7291
+ let best = null;
7292
+ for (const name of entries) {
7293
+ const full = path.join(crashesDir, name);
7294
+ let st;
7295
+ try {
7296
+ st = await fs$2.stat(full);
7297
+ } catch {
7298
+ continue;
7299
+ }
7300
+ if (!st?.isDirectory?.()) continue;
7301
+ const mtimeMs = Number(st.mtimeMs || 0);
7302
+ if (!best || mtimeMs > best.mtimeMs) best = { path: full, mtimeMs };
7303
+ }
7304
+ return best?.path ?? null;
7305
+ } catch {
7306
+ return null;
7307
+ }
7308
+ };
7309
+ const readFileTail = async (filePath, maxBytes) => {
7310
+ try {
7311
+ const buf = await fs$2.readFile(filePath);
7312
+ const slice = buf.length > maxBytes ? buf.subarray(buf.length - maxBytes) : buf;
7313
+ return slice.toString("utf8");
7314
+ } catch {
7315
+ return null;
7316
+ }
7317
+ };
7318
+ const gatherCrashDiagnosticsBestEffort = async (uprojectPath) => {
7319
+ const projectRoot = path.dirname(uprojectPath);
7320
+ const summary = [];
7321
+ const detail = { uprojectPath, projectRoot };
7322
+ const latestLog = await findLatestFile(path.join(projectRoot, "Saved", "Logs"), (n) => n.toLowerCase().endsWith(".log"));
7323
+ if (latestLog) {
7324
+ detail.projectLogPath = latestLog;
7325
+ const tail = await readFileTail(latestLog, 24e3);
7326
+ if (tail) {
7327
+ detail.projectLogTail = tailText(tail, 12e3);
7328
+ summary.push(`Latest log: ${latestLog}`);
7329
+ }
7330
+ }
7331
+ const latestCrashDir = await findLatestCrashDir(projectRoot);
7332
+ if (latestCrashDir) {
7333
+ detail.latestCrashDir = latestCrashDir;
7334
+ const crashContext = await findLatestFile(latestCrashDir, (n) => n.toLowerCase().includes("crashcontext") && n.toLowerCase().endsWith(".xml"));
7335
+ if (crashContext) {
7336
+ detail.crashContextPath = crashContext;
7337
+ const tail = await readFileTail(crashContext, 24e3);
7338
+ if (tail) {
7339
+ detail.crashContextTail = tailText(tail, 12e3);
7340
+ summary.push(`CrashContext: ${crashContext}`);
7341
+ }
7342
+ }
7343
+ }
7344
+ return { detail, summary };
7345
+ };
7183
7346
  const getUnrealEditorExe = (engineRoot) => {
7184
7347
  const root = engineRoot.trim().replace(/[\\/]+$/, "");
7185
7348
  if (process.platform === "darwin") {
@@ -7235,7 +7398,7 @@ ${res.stderr}`;
7235
7398
  kind: "unreachable",
7236
7399
  severity: "warning",
7237
7400
  detectedAtMs: now,
7238
- message: "Unreal Editor is no longer reachable (it was reachable earlier). It may have crashed or been closed.",
7401
+ message: "Unreal Editor is no longer reachable (it was reachable earlier). It may have crashed or been closed.\nNext: fix the issue, then relaunch via unreal_editor_relaunch_last (if you launched from this session) or unreal_editor_launch.",
7239
7402
  detail: {
7240
7403
  lastReachableAtMs: state.lastReachableAtMs
7241
7404
  }
@@ -7267,20 +7430,35 @@ ${res.stderr}`;
7267
7430
  engineRoot,
7268
7431
  startedAtMs: Date.now()
7269
7432
  };
7433
+ state.lastLaunch = {
7434
+ uprojectPath,
7435
+ engineRoot,
7436
+ extraArgs,
7437
+ startedAtMs: Date.now()
7438
+ };
7270
7439
  child.on("exit", (code, signal) => {
7271
- const now = Date.now();
7272
- const exitCode = typeof code === "number" ? code : null;
7273
- const sig = typeof signal === "string" ? signal : null;
7274
- const isCrash = sig !== null || exitCode !== null && exitCode !== 0;
7275
- state.launched = null;
7276
- if (!isCrash) return;
7277
- emitIssue({
7278
- kind: "process_exit",
7279
- severity: "crash",
7280
- detectedAtMs: now,
7281
- message: `Unreal Editor process exited unexpectedly (code=${exitCode ?? "null"} signal=${sig ?? "null"}).`,
7282
- detail: { exitCode, signal: sig, pid, uprojectPath }
7283
- });
7440
+ void (async () => {
7441
+ const now = Date.now();
7442
+ const exitCode = typeof code === "number" ? code : null;
7443
+ const sig = typeof signal === "string" ? signal : null;
7444
+ const isCrash = sig !== null || exitCode !== null && exitCode !== 0;
7445
+ state.launched = null;
7446
+ if (!isCrash) return;
7447
+ const diag = await gatherCrashDiagnosticsBestEffort(uprojectPath).catch(() => ({ detail: {}, summary: [] }));
7448
+ const msgParts = [
7449
+ `Unreal Editor process exited unexpectedly (code=${exitCode ?? "null"} signal=${sig ?? "null"}).`,
7450
+ `Project: ${uprojectPath}`,
7451
+ ...diag.summary,
7452
+ `Next: fix the issue, then relaunch via unreal_editor_relaunch_last (or unreal_editor_launch).`
7453
+ ];
7454
+ emitIssue({
7455
+ kind: "process_exit",
7456
+ severity: "crash",
7457
+ detectedAtMs: now,
7458
+ message: msgParts.filter(Boolean).join("\n"),
7459
+ detail: { exitCode, signal: sig, pid, uprojectPath, ...diag.detail }
7460
+ });
7461
+ })();
7284
7462
  });
7285
7463
  child.on("error", (err) => {
7286
7464
  const now = Date.now();
@@ -7289,7 +7467,9 @@ ${res.stderr}`;
7289
7467
  kind: "process_exit",
7290
7468
  severity: "crash",
7291
7469
  detectedAtMs: now,
7292
- message: `Failed to launch Unreal Editor: ${err instanceof Error ? err.message : String(err)}`,
7470
+ message: `Failed to launch Unreal Editor: ${err instanceof Error ? err.message : String(err)}
7471
+ Project: ${uprojectPath}
7472
+ Next: fix the issue, then relaunch via unreal_editor_relaunch_last (or unreal_editor_launch).`,
7293
7473
  detail: { pid, uprojectPath }
7294
7474
  });
7295
7475
  });
@@ -7299,6 +7479,12 @@ ${res.stderr}`;
7299
7479
  noteUnrealActivity,
7300
7480
  noteUnrealReachable,
7301
7481
  launchEditor,
7482
+ relaunchLast: async (extraArgs) => {
7483
+ const last = state.lastLaunch;
7484
+ if (!last) throw new Error("No known prior Unreal launch in this session. Use unreal_editor_launch with an explicit uprojectPath.");
7485
+ const mergedArgs = Array.isArray(extraArgs) && extraArgs.length > 0 ? extraArgs.filter((a) => typeof a === "string" && a.trim()) : last.extraArgs;
7486
+ return launchEditor({ uprojectPath: last.uprojectPath, engineRoot: last.engineRoot, extraArgs: mergedArgs });
7487
+ },
7302
7488
  stop: () => {
7303
7489
  try {
7304
7490
  interval.unref();
@@ -8805,6 +8991,32 @@ ${String(st.stdout || "").trim()}`
8805
8991
  isError: false
8806
8992
  };
8807
8993
  }));
8994
+ mcp.registerTool("unreal_editor_relaunch_last", {
8995
+ title: "Unreal Editor: Relaunch Last Project",
8996
+ description: "Relaunch the last Unreal project previously launched via unreal_editor_launch in this session (no auto-restart). Use this after a crash once you\u2019ve fixed files. If it crashes again, Flockbay will abort and report again.",
8997
+ inputSchema: {
8998
+ extraArgs: z.z.array(z.z.string()).optional().describe("Optional replacement UnrealEditor command-line args (advanced).")
8999
+ }
9000
+ }, async (args) => runWithMcpToolCard("unreal_editor_relaunch_last", args, async () => {
9001
+ const extraArgs = Array.isArray(args?.extraArgs) ? args.extraArgs : void 0;
9002
+ unrealEditorSupervisor.noteUnrealActivity();
9003
+ try {
9004
+ const launched = await unrealEditorSupervisor.relaunchLast(extraArgs);
9005
+ return {
9006
+ content: [
9007
+ { type: "text", text: `Relaunched Unreal Editor (last project).` },
9008
+ { type: "text", text: JSON.stringify({ pid: launched.pid, exePath: launched.exePath }, null, 2) },
9009
+ { type: "text", text: "Next: wait for the editor to finish loading, then re-run UnrealMCP tools." }
9010
+ ],
9011
+ isError: false
9012
+ };
9013
+ } catch (err) {
9014
+ return {
9015
+ content: [{ type: "text", text: err instanceof Error ? err.message : String(err) }],
9016
+ isError: true
9017
+ };
9018
+ }
9019
+ }));
8808
9020
  mcp.registerTool("unreal_build_project", {
8809
9021
  title: "Unreal Build Project (UBT)",
8810
9022
  description: "Build the project via Unreal Build Tool (via Engine/Build/BatchFiles/Build.*). Returns structured errors (file/line) and a log path for deep debugging.",
@@ -10230,6 +10442,7 @@ Fix: ${res.hint}` : "";
10230
10442
  "unreal_headless_screenshot",
10231
10443
  "unreal_latest_screenshots",
10232
10444
  "unreal_editor_launch",
10445
+ "unreal_editor_relaunch_last",
10233
10446
  "unreal_build_project",
10234
10447
  "unreal_mcp_command",
10235
10448
  "unreal_mcp_list_capabilities",
@@ -11597,6 +11810,51 @@ async function reauthForCurrentServerKeepingMachineId() {
11597
11810
  await types.clearCredentials();
11598
11811
  await loginWithClerkAndPairMachine();
11599
11812
  }
11813
+ function isLocalDevServerUrl(url) {
11814
+ try {
11815
+ const u = new URL(String(url || "").trim());
11816
+ const host = u.hostname.toLowerCase();
11817
+ return host === "localhost" || host === "127.0.0.1" || host === "0.0.0.0" || host.endsWith(".localhost");
11818
+ } catch {
11819
+ return false;
11820
+ }
11821
+ }
11822
+ async function isServerReachable(url) {
11823
+ const base = String(url || "").trim().replace(/\/+$/, "");
11824
+ if (!base) return false;
11825
+ try {
11826
+ const res = await fetch(`${base}/healthz`, { method: "GET", signal: AbortSignal.timeout(1200) });
11827
+ return res.ok;
11828
+ } catch {
11829
+ return false;
11830
+ }
11831
+ }
11832
+ async function ensureProdServerWhenLocalDevUnreachable() {
11833
+ if ((process.env.FLOCKBAY_SERVER_URL || "").trim()) return;
11834
+ const settings = await types.readSettings().catch(() => null);
11835
+ const configured = String(settings?.serverUrl || "").trim();
11836
+ if (!configured) return;
11837
+ const normalized = types.normalizeServerUrlForNode(configured);
11838
+ if (!isLocalDevServerUrl(normalized)) return;
11839
+ const reachable = await isServerReachable(normalized);
11840
+ if (reachable) return;
11841
+ const shouldSwitch = await promptYesNo(
11842
+ `This profile is configured to use a local server (${normalized}), but it isn't reachable.
11843
+
11844
+ Switch this profile to production (https://api.flockbay.com) and re-authenticate?`,
11845
+ { defaultYes: true }
11846
+ );
11847
+ if (!shouldSwitch) return;
11848
+ const nextWebappUrl = String(settings?.webappUrl || "").trim() || "https://flockbay.com";
11849
+ await types.updateSettings((s) => ({
11850
+ ...s,
11851
+ serverUrl: "https://api.flockbay.com",
11852
+ webappUrl: nextWebappUrl
11853
+ }));
11854
+ types.configuration.serverUrl = "https://api.flockbay.com";
11855
+ types.configuration.webappUrl = nextWebappUrl;
11856
+ await reauthForCurrentServerKeepingMachineId();
11857
+ }
11600
11858
  function openUrlBestEffort(url) {
11601
11859
  const u = String(url || "").trim();
11602
11860
  if (!u) return;
@@ -11715,11 +11973,19 @@ async function startDaemonDetachedOrExit(opts) {
11715
11973
  }
11716
11974
  console.error("");
11717
11975
  console.error(chalk.red("Daemon is running but not connected to the server."));
11976
+ console.error(chalk.gray(`Profile: ${types.configuration.profile}`));
11977
+ console.error(chalk.gray(`Server: ${types.configuration.serverUrl}`));
11718
11978
  if (typeof status?.connection?.lastHttpUpsertError === "string" && status.connection.lastHttpUpsertError.trim()) {
11719
11979
  console.error(chalk.gray(`Last upsert error: ${status.connection.lastHttpUpsertError.trim()}`));
11720
11980
  }
11721
11981
  if (lastConnectError) console.error(chalk.gray(`Last connect error: ${lastConnectError}`));
11722
- console.error(chalk.gray("Tip: if the backend is restarting, wait a moment and re-run `flockbay start`."));
11982
+ if (isLocalDevServerUrl(types.configuration.serverUrl)) {
11983
+ console.error(chalk.gray("Tip: if you meant to run against production, set the server URL or use a prod profile:"));
11984
+ console.error(chalk.gray(" FLOCKBAY_SERVER_URL=https://api.flockbay.com flockbay start"));
11985
+ console.error(chalk.gray(" flockbay start --profile prod"));
11986
+ } else {
11987
+ console.error(chalk.gray("Tip: if the backend is restarting, wait a moment and re-run `flockbay start`."));
11988
+ }
11723
11989
  process.exit(1);
11724
11990
  }
11725
11991
  }
@@ -11923,6 +12189,7 @@ async function authAndSetupMachineIfNeeded() {
11923
12189
  return;
11924
12190
  }
11925
12191
  try {
12192
+ await ensureProdServerWhenLocalDevUnreachable();
11926
12193
  await ensureMachineAuthOrLogin();
11927
12194
  const skipUnreal = startArgs.includes("--skip-unreal");
11928
12195
  if (!skipUnreal) {
@@ -11957,7 +12224,7 @@ ${engineRoot}`, {
11957
12224
  } else if (subcommand === "codex") {
11958
12225
  try {
11959
12226
  await chdirToNearestUprojectRootIfPresent();
11960
- const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-DuCGwO2K.cjs'); });
12227
+ const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-CXJW0tzo.cjs'); });
11961
12228
  let startedBy = void 0;
11962
12229
  let sessionId = void 0;
11963
12230
  for (let i = 1; i < args.length; i++) {
@@ -12052,7 +12319,7 @@ ${engineRoot}`, {
12052
12319
  }
12053
12320
  try {
12054
12321
  await chdirToNearestUprojectRootIfPresent();
12055
- const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-B25LZ4Cw.cjs'); });
12322
+ const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-FOBXtEU6.cjs'); });
12056
12323
  let startedBy = void 0;
12057
12324
  let sessionId = void 0;
12058
12325
  for (let i = 1; i < args.length; i++) {
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  require('chalk');
4
- require('./index-BxBuBx7C.cjs');
5
- require('./types-CGQhv7Z-.cjs');
4
+ require('./index-D_mglYG0.cjs');
5
+ require('./types-BYHCKlu_.cjs');
6
6
  require('zod');
7
7
  require('node:child_process');
8
8
  require('node:fs');
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import 'chalk';
2
- import './index-CHm9r89K.mjs';
3
- import './types-DuhcLxar.mjs';
2
+ import './index-CX0Z8pmz.mjs';
3
+ import './types-C4QeUggl.mjs';
4
4
  import 'zod';
5
5
  import 'node:child_process';
6
6
  import 'node:fs';
package/dist/lib.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var types = require('./types-CGQhv7Z-.cjs');
3
+ var types = require('./types-BYHCKlu_.cjs');
4
4
  require('axios');
5
5
  require('node:fs');
6
6
  require('node:os');
package/dist/lib.d.cts CHANGED
@@ -617,15 +617,9 @@ declare class Logger {
617
617
  }
618
618
  declare let logger: Logger;
619
619
 
620
- /**
621
- * Global configuration for Flockbay CLI
622
- *
623
- * Centralizes all configuration including environment variables and paths
624
- * Environment files should be loaded using Node's --env-file flag
625
- */
626
620
  declare class Configuration {
627
- readonly serverUrl: string;
628
- readonly webappUrl: string;
621
+ serverUrl: string;
622
+ webappUrl: string;
629
623
  readonly isDaemonProcess: boolean;
630
624
  readonly profile: string;
631
625
  readonly flockbayHomeDir: string;
package/dist/lib.d.mts CHANGED
@@ -617,15 +617,9 @@ declare class Logger {
617
617
  }
618
618
  declare let logger: Logger;
619
619
 
620
- /**
621
- * Global configuration for Flockbay CLI
622
- *
623
- * Centralizes all configuration including environment variables and paths
624
- * Environment files should be loaded using Node's --env-file flag
625
- */
626
620
  declare class Configuration {
627
- readonly serverUrl: string;
628
- readonly webappUrl: string;
621
+ serverUrl: string;
622
+ webappUrl: string;
629
623
  readonly isDaemonProcess: boolean;
630
624
  readonly profile: string;
631
625
  readonly flockbayHomeDir: string;
package/dist/lib.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-DuhcLxar.mjs';
1
+ export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-C4QeUggl.mjs';
2
2
  import 'axios';
3
3
  import 'node:fs';
4
4
  import 'node:os';
@@ -1,6 +1,6 @@
1
1
  import { useStdout, useInput, Box, Text, render } from 'ink';
2
2
  import React, { useState, useRef, useEffect, useCallback } from 'react';
3
- import { l as logger, A as ApiClient, r as readSettings, p as projectPath, c as configuration, b as packageJson } from './types-DuhcLxar.mjs';
3
+ import { l as logger, A as ApiClient, r as readSettings, p as projectPath, c as configuration, b as packageJson } from './types-C4QeUggl.mjs';
4
4
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
5
5
  import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
6
6
  import { z } from 'zod';
@@ -10,7 +10,7 @@ import fs__default from 'node:fs';
10
10
  import os from 'node:os';
11
11
  import path, { resolve, join } from 'node:path';
12
12
  import { spawnSync } from 'node:child_process';
13
- import { s as shouldCountToolCall, c as consumeToolQuota, f as formatQuotaDeniedReason, h as hashObject, i as initialMachineMetadata, E as ElicitationHub, n as notifyDaemonSessionStarted, M as MessageQueue2, P as PLATFORM_SYSTEM_PROMPT, a as setLatestUserImages, w as withUserImagesMarker, r as registerKillSessionHandler, b as MessageBuffer, d as startFlockbayServer, e as detectUnrealProject, g as buildProjectCapsule, t as trimIdent, j as autoFinalizeCoordinationWorkItem, k as detectScreenshotsForGate, l as applyCoordinationSideEffectsFromMcpToolResult, m as stopCaffeinate } from './index-CHm9r89K.mjs';
13
+ import { s as shouldCountToolCall, c as consumeToolQuota, f as formatQuotaDeniedReason, h as hashObject, i as initialMachineMetadata, E as ElicitationHub, n as notifyDaemonSessionStarted, M as MessageQueue2, P as PLATFORM_SYSTEM_PROMPT, a as setLatestUserImages, w as withUserImagesMarker, r as registerKillSessionHandler, b as MessageBuffer, d as startFlockbayServer, e as detectUnrealProject, g as buildProjectCapsule, t as trimIdent, j as autoFinalizeCoordinationWorkItem, k as detectScreenshotsForGate, l as applyCoordinationSideEffectsFromMcpToolResult, m as stopCaffeinate } from './index-CX0Z8pmz.mjs';
14
14
  import 'axios';
15
15
  import 'node:events';
16
16
  import 'socket.io-client';
@@ -2587,7 +2587,8 @@ async function runCodex(opts) {
2587
2587
  const push = (role, text) => {
2588
2588
  const t = String(text || "").trim();
2589
2589
  if (!t) return;
2590
- lines.push(`${role === "user" ? "User" : "Assistant"}: ${t}`);
2590
+ const label = role === "user" ? "User" : role === "assistant" ? "Assistant" : "System";
2591
+ lines.push(`${label}: ${t}`);
2591
2592
  };
2592
2593
  for (const row of rows.slice(-80)) {
2593
2594
  const content = row?.content;
@@ -2611,6 +2612,11 @@ async function runCodex(opts) {
2611
2612
  if (txt) push("assistant", txt);
2612
2613
  }
2613
2614
  }
2615
+ } else if (payload.type === "event") {
2616
+ const data = payload.data;
2617
+ if (data && typeof data === "object" && data.type === "message" && typeof data.message === "string") {
2618
+ push("system", data.message);
2619
+ }
2614
2620
  } else if (payload.type === "codex") {
2615
2621
  const data = payload.data;
2616
2622
  if (data && typeof data === "object" && data.type === "message" && typeof data.message === "string") {
@@ -2,7 +2,7 @@
2
2
 
3
3
  var ink = require('ink');
4
4
  var React = require('react');
5
- var types = require('./types-CGQhv7Z-.cjs');
5
+ var types = require('./types-BYHCKlu_.cjs');
6
6
  var index_js = require('@modelcontextprotocol/sdk/client/index.js');
7
7
  var stdio_js = require('@modelcontextprotocol/sdk/client/stdio.js');
8
8
  var z = require('zod');
@@ -12,7 +12,7 @@ var fs = require('node:fs');
12
12
  var os = require('node:os');
13
13
  var path = require('node:path');
14
14
  var node_child_process = require('node:child_process');
15
- var index = require('./index-BxBuBx7C.cjs');
15
+ var index = require('./index-D_mglYG0.cjs');
16
16
  require('axios');
17
17
  require('node:events');
18
18
  require('socket.io-client');
@@ -2589,7 +2589,8 @@ async function runCodex(opts) {
2589
2589
  const push = (role, text) => {
2590
2590
  const t = String(text || "").trim();
2591
2591
  if (!t) return;
2592
- lines.push(`${role === "user" ? "User" : "Assistant"}: ${t}`);
2592
+ const label = role === "user" ? "User" : role === "assistant" ? "Assistant" : "System";
2593
+ lines.push(`${label}: ${t}`);
2593
2594
  };
2594
2595
  for (const row of rows.slice(-80)) {
2595
2596
  const content = row?.content;
@@ -2613,6 +2614,11 @@ async function runCodex(opts) {
2613
2614
  if (txt) push("assistant", txt);
2614
2615
  }
2615
2616
  }
2617
+ } else if (payload.type === "event") {
2618
+ const data = payload.data;
2619
+ if (data && typeof data === "object" && data.type === "message" && typeof data.message === "string") {
2620
+ push("system", data.message);
2621
+ }
2616
2622
  } else if (payload.type === "codex") {
2617
2623
  const data = payload.data;
2618
2624
  if (data && typeof data === "object" && data.type === "message" && typeof data.message === "string") {
@@ -4,8 +4,8 @@ import { randomUUID, createHash } from 'node:crypto';
4
4
  import os from 'node:os';
5
5
  import path, { resolve, join as join$1, basename } from 'node:path';
6
6
  import { mkdir, writeFile, readFile } from 'node:fs/promises';
7
- import { l as logger, b as packageJson, A as ApiClient, r as readSettings, p as projectPath, c as configuration } from './types-DuhcLxar.mjs';
8
- import { s as shouldCountToolCall, c as consumeToolQuota, f as formatQuotaDeniedReason, h as hashObject, i as initialMachineMetadata, n as notifyDaemonSessionStarted, M as MessageQueue2, g as buildProjectCapsule, a as setLatestUserImages, b as MessageBuffer, w as withUserImagesMarker, P as PLATFORM_SYSTEM_PROMPT, r as registerKillSessionHandler, d as startFlockbayServer, o as extractUserImagesMarker, p as getLatestUserImages, j as autoFinalizeCoordinationWorkItem, E as ElicitationHub, k as detectScreenshotsForGate, m as stopCaffeinate } from './index-CHm9r89K.mjs';
7
+ import { l as logger, b as packageJson, A as ApiClient, r as readSettings, p as projectPath, c as configuration } from './types-C4QeUggl.mjs';
8
+ import { s as shouldCountToolCall, c as consumeToolQuota, f as formatQuotaDeniedReason, h as hashObject, i as initialMachineMetadata, n as notifyDaemonSessionStarted, M as MessageQueue2, g as buildProjectCapsule, a as setLatestUserImages, b as MessageBuffer, w as withUserImagesMarker, P as PLATFORM_SYSTEM_PROMPT, r as registerKillSessionHandler, d as startFlockbayServer, o as extractUserImagesMarker, p as getLatestUserImages, j as autoFinalizeCoordinationWorkItem, E as ElicitationHub, k as detectScreenshotsForGate, m as stopCaffeinate } from './index-CX0Z8pmz.mjs';
9
9
  import { spawn, spawnSync } from 'node:child_process';
10
10
  import { ndJsonStream, ClientSideConnection } from '@agentclientprotocol/sdk';
11
11
  import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
@@ -6,8 +6,8 @@ var node_crypto = require('node:crypto');
6
6
  var os = require('node:os');
7
7
  var path = require('node:path');
8
8
  var fs$2 = require('node:fs/promises');
9
- var types = require('./types-CGQhv7Z-.cjs');
10
- var index = require('./index-BxBuBx7C.cjs');
9
+ var types = require('./types-BYHCKlu_.cjs');
10
+ var index = require('./index-D_mglYG0.cjs');
11
11
  var node_child_process = require('node:child_process');
12
12
  var sdk = require('@agentclientprotocol/sdk');
13
13
  var fs = require('fs');
@@ -42,7 +42,7 @@ function _interopNamespaceDefault(e) {
42
42
  var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
43
43
 
44
44
  var name = "flockbay";
45
- var version = "0.10.17";
45
+ var version = "0.10.20";
46
46
  var description = "Flockbay CLI (local agent + daemon)";
47
47
  var author = "Eduardo Orellana";
48
48
  var license = "UNLICENSED";
@@ -266,7 +266,7 @@ class Configuration {
266
266
  }
267
267
  } catch {
268
268
  }
269
- const rawServerUrl = process.env.FLOCKBAY_SERVER_URL || persistedSettings?.serverUrl || "https://api-internal.flockbay.com";
269
+ const rawServerUrl = process.env.FLOCKBAY_SERVER_URL || persistedSettings?.serverUrl || "https://api.flockbay.com";
270
270
  this.serverUrl = normalizeServerUrlForNode(rawServerUrl);
271
271
  this.webappUrl = process.env.FLOCKBAY_WEBAPP_URL || persistedSettings?.webappUrl || "https://flockbay.com";
272
272
  this.isExperimentalEnabled = ["true", "1", "yes"].includes(
@@ -770,7 +770,7 @@ class RpcHandlerManager {
770
770
  }
771
771
  }
772
772
 
773
- const __dirname$1 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('types-CGQhv7Z-.cjs', document.baseURI).href))));
773
+ const __dirname$1 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('types-BYHCKlu_.cjs', document.baseURI).href))));
774
774
  function projectPath() {
775
775
  const path = path$1.resolve(__dirname$1, "..");
776
776
  return path;
@@ -3809,6 +3809,7 @@ exports.delay = delay;
3809
3809
  exports.getLatestDaemonLog = getLatestDaemonLog;
3810
3810
  exports.installUnrealMcpPluginToEngine = installUnrealMcpPluginToEngine;
3811
3811
  exports.logger = logger;
3812
+ exports.normalizeServerUrlForNode = normalizeServerUrlForNode;
3812
3813
  exports.packageJson = packageJson;
3813
3814
  exports.projectPath = projectPath;
3814
3815
  exports.readCredentials = readCredentials;