lody 0.44.2-next.1 → 0.45.1

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/index.js +28 -43
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -22780,7 +22780,7 @@ Event: ${getEventDescription(event)}`);
22780
22780
  const mergedOptions = {
22781
22781
  ...options,
22782
22782
  dsn: options.dsn ?? "https://080f9de535ff335a1a0440d0e385f796@o4510491299086336.ingest.us.sentry.io/4510559045681152",
22783
- environment: options.environment ?? "staging",
22783
+ environment: options.environment ?? "production",
22784
22784
  sendClientReports: options.sendClientReports ?? true,
22785
22785
  transport: options.transport ?? makeNodeTransport,
22786
22786
  stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),
@@ -36820,7 +36820,7 @@ Mongoose Error Code: ${error2.code}` : ""}`
36820
36820
  return client;
36821
36821
  }
36822
36822
  const name = "lody";
36823
- const version$4 = "0.44.2-next.1";
36823
+ const version$4 = "0.45.1";
36824
36824
  const description = "Lody Agent CLI tool for managing remote command execution";
36825
36825
  const type = "module";
36826
36826
  const main$3 = "dist/index.js";
@@ -37068,15 +37068,15 @@ Mongoose Error Code: ${error2.code}` : ""}`
37068
37068
  return "dev";
37069
37069
  }
37070
37070
  };
37071
- const getRuntimeEnv = () => normalizeRuntimeEnv("staging");
37071
+ const getRuntimeEnv = () => normalizeRuntimeEnv("production");
37072
37072
  const isDevEnv = () => getRuntimeEnv() === "dev";
37073
37073
  const runtimeEnv = getRuntimeEnv();
37074
- const environment$1 = "staging";
37074
+ const environment$1 = "production";
37075
37075
  const dsn = "https://080f9de535ff335a1a0440d0e385f796@o4510491299086336.ingest.us.sentry.io/4510559045681152";
37076
37076
  const postHogHost = process.env.LODY_POSTHOG_HOST ?? "https://us.i.posthog.com";
37077
37077
  const postHogKey = process.env.LODY_POSTHOG_KEY ?? "phc_LFS5i5WIwg4irAhrG5oJR04iYPhReVZ3DdFZOKqCkjG";
37078
- const tracesSampleRate = Number(process.env.SENTRY_TRACES_SAMPLE_RATE) || 1;
37079
- const profilesSampleRate = Number(process.env.SENTRY_PROFILES_SAMPLE_RATE) || 0.25;
37078
+ const tracesSampleRate = Number(process.env.SENTRY_TRACES_SAMPLE_RATE) || 0.2;
37079
+ const profilesSampleRate = Number(process.env.SENTRY_PROFILES_SAMPLE_RATE) || 0.1;
37080
37080
  const sentryEnabled = runtimeEnv !== "dev" && true;
37081
37081
  const postHogEnabled = runtimeEnv !== "dev" && process.env.LODY_POSTHOG_DISABLED !== "1";
37082
37082
  const release = `${name}@${version$4}`;
@@ -64608,16 +64608,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
64608
64608
  }
64609
64609
  return _v4(options, buf, offset2);
64610
64610
  }
64611
- let LODY_AUTH_URL = "https://impressive-guineapig-165.convex.cloud";
64611
+ let LODY_AUTH_URL = "https://nautical-curlew-181.convex.cloud";
64612
64612
  let LODY_AUTH_SITE_URL = "";
64613
- let LODY_SERVER_URL = "https://lody-server.lz-9c5.workers.dev";
64614
- let SITE_URL = "https://main.lody.pages.dev";
64613
+ let LODY_SERVER_URL = "https://api.lody.ai";
64614
+ let SITE_URL = "https://lody.ai";
64615
64615
  let SITE_APP_BASE_PATH = "";
64616
64616
  const loadEnv = () => {
64617
- LODY_AUTH_URL = "https://impressive-guineapig-165.convex.cloud";
64617
+ LODY_AUTH_URL = "https://nautical-curlew-181.convex.cloud";
64618
64618
  LODY_AUTH_SITE_URL = "";
64619
- LODY_SERVER_URL = "https://lody-server.lz-9c5.workers.dev";
64620
- SITE_URL = "https://main.lody.pages.dev";
64619
+ LODY_SERVER_URL = "https://api.lody.ai";
64620
+ SITE_URL = "https://lody.ai";
64621
64621
  SITE_APP_BASE_PATH = process.env["SITE_APP_BASE_PATH"] ?? "";
64622
64622
  };
64623
64623
  const MACHINE_ID_FILE_NAME = "machine-id";
@@ -122333,23 +122333,20 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
122333
122333
  }
122334
122334
  return Boolean(meta.latestUserMsgId && meta.latestUserMsgId !== meta.lastHandledUserMsgId);
122335
122335
  }
122336
- async setHistorySyncWaitStatus(sessionId, sessionDoc, detail) {
122337
- try {
122338
- await sessionDoc.setStatus(SessionStatusFactory.initializing(void 0, detail));
122339
- } catch (error2) {
122340
- this.deps.logger.debug(`[${sessionId}] Failed to set history sync wait status (${detail}): ${formatErrorMessage(error2)}`);
122341
- }
122342
- }
122343
122336
  async waitForPendingUserTurnHistorySync(sessionId, sessionDoc, meta) {
122344
122337
  this.deps.logger.debug(`[${sessionId}] Pending user turn metadata is visible but history is missing it; waiting up to ${SessionDispatchWatcher.HISTORY_SYNC_WAIT_TIMEOUT_MS / 1e3}s for history CRDT sync`);
122345
- let currentWaitDetail = "joining-history";
122346
- await this.setHistorySyncWaitStatus(sessionId, sessionDoc, currentWaitDetail);
122347
122338
  try {
122348
122339
  await sessionDoc.ensureDocRoomJoined();
122349
122340
  } catch (error2) {
122350
122341
  this.deps.logger.debug(`[${sessionId}] Failed to ensure session history room is joined before waiting: ${formatErrorMessage(error2)}`);
122351
122342
  }
122352
- const turnAfterJoin = await this.checkHistoryAndQueue(sessionDoc, meta);
122343
+ await sessionDoc.waitUntilSynced();
122344
+ const freshMeta = await sessionDoc.getMetaState() ?? meta;
122345
+ if (!this.hasPendingUserTurnSignal(freshMeta)) {
122346
+ this.deps.logger.debug(`[${sessionId}] Pending user turn pointer cleared during pre-wait sync; exiting wait`);
122347
+ return null;
122348
+ }
122349
+ const turnAfterJoin = await this.checkHistoryAndQueue(sessionDoc, freshMeta);
122353
122350
  if (turnAfterJoin) {
122354
122351
  return turnAfterJoin;
122355
122352
  }
@@ -122367,18 +122364,11 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
122367
122364
  unsubscribeMirror?.();
122368
122365
  unsubscribeStatus?.();
122369
122366
  };
122370
- const updateWaitStatus = (detail) => {
122371
- if (currentWaitDetail === detail) {
122372
- return;
122373
- }
122374
- currentWaitDetail = detail;
122375
- void this.setHistorySyncWaitStatus(sessionId, sessionDoc, detail);
122376
- };
122377
122367
  const checkForTurn = () => {
122378
122368
  if (settled) {
122379
122369
  return;
122380
122370
  }
122381
- void this.checkHistoryAndQueue(sessionDoc, meta).then((turn) => {
122371
+ void this.checkHistoryAndQueue(sessionDoc, freshMeta).then((turn) => {
122382
122372
  if (settled || !turn) {
122383
122373
  return;
122384
122374
  }
@@ -122398,7 +122388,6 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
122398
122388
  }
122399
122389
  reconnectAttempted = true;
122400
122390
  void (async () => {
122401
- updateWaitStatus("reconnecting-history");
122402
122391
  const jitterMs = SessionDispatchWatcher.getReconnectJitterMs();
122403
122392
  this.deps.logger.debug(`[${sessionId}] Session history room ${reason}; attempting one rejoin in ${jitterMs}ms`);
122404
122393
  await SessionDispatchWatcher.sleep(jitterMs);
@@ -122417,14 +122406,6 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
122417
122406
  if (settled || !status) {
122418
122407
  return;
122419
122408
  }
122420
- if (status === "connecting" || status === "joined") {
122421
- updateWaitStatus("joining-history");
122422
- return;
122423
- }
122424
- if (status === "reconnecting") {
122425
- updateWaitStatus("reconnecting-history");
122426
- return;
122427
- }
122428
122409
  if (status === "disconnected" || status === "error") {
122429
122410
  attemptReconnectOnce(status);
122430
122411
  }
@@ -122461,16 +122442,20 @@ The postId is ${normalizedFeedbackPostId}. Use the feedback-progress-reporter sk
122461
122442
  if (meta.machineId !== this.deps.machineId || meta.isArchived || !this.hasPendingUserTurnSignal(meta)) {
122462
122443
  return;
122463
122444
  }
122464
- await this.deps.workspaceDocument.repo.upsertDocMeta?.(roomId, {
122445
+ const pendingUserMsgId = meta.processingUserMsgId ?? meta.latestUserMsgId ?? meta.lastHandledUserMsgId;
122446
+ const recoveryPatch = {
122465
122447
  status: SessionStatusFactory.idle(),
122466
- latestUserMsgId: void 0,
122467
- processingUserMsgId: void 0,
122468
122448
  dispatchError: {
122469
122449
  code: SessionDispatchWatcher.DISPATCH_HISTORY_SYNC_TIMEOUT_CODE,
122470
122450
  message: "Dispatch recovery could not reconnect to this session after 5 minutes. Send a new message to retry.",
122471
122451
  at: getServerNow()
122472
122452
  }
122473
- });
122453
+ };
122454
+ if (pendingUserMsgId) {
122455
+ recoveryPatch.lastHandledUserMsgId = pendingUserMsgId;
122456
+ recoveryPatch.latestUserMsgId = pendingUserMsgId;
122457
+ }
122458
+ await this.deps.workspaceDocument.repo.upsertDocMeta?.(roomId, recoveryPatch);
122474
122459
  const watched = this.watchedSessions.get(sessionId);
122475
122460
  watched?.unsubscribe();
122476
122461
  this.watchedSessions.delete(sessionId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lody",
3
- "version": "0.44.2-next.1",
3
+ "version": "0.45.1",
4
4
  "description": "Lody Agent CLI tool for managing remote command execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -73,9 +73,9 @@
73
73
  "ws": "^8.18.3",
74
74
  "zod": "^4.1.5",
75
75
  "@lody/cli-supervisor": "0.0.1",
76
+ "@lody/shared": "0.0.1",
76
77
  "@lody/convex": "0.0.1",
77
78
  "@lody/loro-streams-rpc": "0.0.1",
78
- "@lody/shared": "0.0.1",
79
79
  "loro-code": "0.0.1"
80
80
  },
81
81
  "files": [