replicas-cli 0.3.173 → 0.3.174

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.cjs +41 -0
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -23022,6 +23022,7 @@ var CODEX_ASP_ITEM_ID_PAYLOAD_KEY = "codexAspItemId";
23022
23022
  var CODEX_ITEM_EVENT_TYPE = "codex-item";
23023
23023
  var CODEX_ITEM_PARTIAL_EVENT_TYPE = "codex-item-partial";
23024
23024
  var CODEX_TURN_EVENT_TYPE = "codex-turn";
23025
+ var CODEX_TURN_RETRY_EVENT_TYPE = "codex-turn-retry";
23025
23026
  var CODEX_QUOTA_STATUS_EVENT_TYPE = "codex-quota-status";
23026
23027
  var CHAT_INTERRUPTED_EVENT_TYPE = "replicas-interrupted";
23027
23028
  var CHAT_MESSAGE_REJECTED_EVENT_TYPE = "replicas-message-rejected";
@@ -23047,6 +23048,10 @@ function coerceAuthFallbackPayload(payload) {
23047
23048
  ...typeof detail === "string" && detail ? { detail } : {}
23048
23049
  };
23049
23050
  }
23051
+ function parseCodexTurnRetryPayload(payload) {
23052
+ const { attempt, maxAttempts, [CODEX_ASP_ITEM_ID_PAYLOAD_KEY]: turnId } = payload;
23053
+ return typeof attempt === "number" && typeof maxAttempts === "number" && typeof turnId === "string" ? { attempt, maxAttempts, [CODEX_ASP_ITEM_ID_PAYLOAD_KEY]: turnId } : void 0;
23054
+ }
23050
23055
 
23051
23056
  // ../shared/src/engine/v1.ts
23052
23057
  var MERGED_MESSAGE_SEPARATOR = "\n\n<!-- replicas:merged -->\n\n";
@@ -27188,13 +27193,42 @@ function parseCodexEvents(events) {
27188
27193
  const pendingCommands = /* @__PURE__ */ new Map();
27189
27194
  const pendingToolCalls = /* @__PURE__ */ new Map();
27190
27195
  const pendingPatches = /* @__PURE__ */ new Map();
27196
+ const retriedTurnIds = /* @__PURE__ */ new Set();
27197
+ let pendingRetry = null;
27191
27198
  events.forEach((event, eventIndex) => {
27192
27199
  const turnId = codexItemFromEvent(event)?.turnId ?? codexTurnFromEvent(event)?.turnId;
27193
27200
  if (turnId !== void 0) {
27194
27201
  if (!turnInsertions.has(turnId)) turnInsertions.set(turnId, messages.length);
27202
+ if (pendingRetry && !retriedTurnIds.has(turnId)) {
27203
+ pendingRetry.status = "completed";
27204
+ pendingRetry = null;
27205
+ }
27206
+ return;
27207
+ }
27208
+ if (event.type === CHAT_INTERRUPTED_EVENT_TYPE) {
27209
+ pendingRetry = null;
27210
+ return;
27211
+ }
27212
+ if (event.type === CODEX_TURN_RETRY_EVENT_TYPE) {
27213
+ const retry = parseCodexTurnRetryPayload(event.payload);
27214
+ if (!retry) return;
27215
+ retriedTurnIds.add(retry[CODEX_ASP_ITEM_ID_PAYLOAD_KEY]);
27216
+ pendingRetry = {
27217
+ id: displayId(event, eventIndex, "capacity-retry"),
27218
+ type: "capacity_retry",
27219
+ attempt: retry.attempt,
27220
+ maxAttempts: retry.maxAttempts,
27221
+ status: "in_progress",
27222
+ timestamp: event.timestamp
27223
+ };
27224
+ messages.push(pendingRetry);
27195
27225
  return;
27196
27226
  }
27197
27227
  if (event.type === "codex-asp-error") {
27228
+ if (pendingRetry) {
27229
+ pendingRetry.status = "completed";
27230
+ pendingRetry = null;
27231
+ }
27198
27232
  const failedTurnId = getPayloadString(event, CODEX_ASP_ITEM_ID_PAYLOAD_KEY);
27199
27233
  if (!(failedTurnId && turns.has(failedTurnId))) {
27200
27234
  messages.push({
@@ -27376,6 +27410,13 @@ function parseCodexEvents(events) {
27376
27410
  if (!turn) continue;
27377
27411
  const kept = [];
27378
27412
  for (const message2 of messagesForCodexTurn(turn)) {
27413
+ if (retriedTurnIds.has(turnId)) {
27414
+ if (message2.type === "error") continue;
27415
+ if (message2.type === "reasoning" && message2.status === "in_progress") {
27416
+ kept.push({ ...message2, status: "failed" });
27417
+ continue;
27418
+ }
27419
+ }
27379
27420
  if (message2.type !== "user") {
27380
27421
  kept.push(message2);
27381
27422
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.173",
3
+ "version": "0.3.174",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {