replicas-engine 0.1.1659 → 0.1.1661

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.
@@ -1116,17 +1116,17 @@ var require_luxon = __commonJS({
1116
1116
  constructor(dt, intl, opts) {
1117
1117
  this.opts = opts;
1118
1118
  this.originalZone = void 0;
1119
- let z45 = void 0;
1119
+ let z46 = void 0;
1120
1120
  if (this.opts.timeZone) {
1121
1121
  this.dt = dt;
1122
1122
  } else if (dt.zone.type === "fixed") {
1123
1123
  const gmtOffset = -1 * (dt.offset / 60);
1124
1124
  const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
1125
1125
  if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {
1126
- z45 = offsetZ;
1126
+ z46 = offsetZ;
1127
1127
  this.dt = dt;
1128
1128
  } else {
1129
- z45 = "UTC";
1129
+ z46 = "UTC";
1130
1130
  this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({
1131
1131
  minutes: dt.offset
1132
1132
  });
@@ -1136,9 +1136,9 @@ var require_luxon = __commonJS({
1136
1136
  this.dt = dt;
1137
1137
  } else if (dt.zone.type === "iana") {
1138
1138
  this.dt = dt;
1139
- z45 = dt.zone.name;
1139
+ z46 = dt.zone.name;
1140
1140
  } else {
1141
- z45 = "UTC";
1141
+ z46 = "UTC";
1142
1142
  this.dt = dt.setZone("UTC").plus({
1143
1143
  minutes: dt.offset
1144
1144
  });
@@ -1147,7 +1147,7 @@ var require_luxon = __commonJS({
1147
1147
  const intlOpts = {
1148
1148
  ...this.opts
1149
1149
  };
1150
- intlOpts.timeZone = intlOpts.timeZone || z45;
1150
+ intlOpts.timeZone = intlOpts.timeZone || z46;
1151
1151
  this.dtf = getCachedDTF(intl, intlOpts);
1152
1152
  }
1153
1153
  format() {
@@ -7220,26 +7220,26 @@ var require_CronDate = __commonJS({
7220
7220
  * @param {CronDate | Date | number | string} [timestamp] - The timestamp to initialize the CronDate with.
7221
7221
  * @param {string} [tz] - The timezone to use for the CronDate.
7222
7222
  */
7223
- constructor(timestamp, tz) {
7223
+ constructor(timestamp2, tz) {
7224
7224
  const dateOpts = { zone: tz };
7225
- if (!timestamp) {
7225
+ if (!timestamp2) {
7226
7226
  this.#date = luxon_1.DateTime.local();
7227
- } else if (timestamp instanceof _CronDate) {
7228
- this.#date = timestamp.#date;
7229
- this.#dstStart = timestamp.#dstStart;
7230
- this.#dstEnd = timestamp.#dstEnd;
7231
- } else if (timestamp instanceof Date) {
7232
- this.#date = luxon_1.DateTime.fromJSDate(timestamp, dateOpts);
7233
- } else if (typeof timestamp === "number") {
7234
- this.#date = luxon_1.DateTime.fromMillis(timestamp, dateOpts);
7227
+ } else if (timestamp2 instanceof _CronDate) {
7228
+ this.#date = timestamp2.#date;
7229
+ this.#dstStart = timestamp2.#dstStart;
7230
+ this.#dstEnd = timestamp2.#dstEnd;
7231
+ } else if (timestamp2 instanceof Date) {
7232
+ this.#date = luxon_1.DateTime.fromJSDate(timestamp2, dateOpts);
7233
+ } else if (typeof timestamp2 === "number") {
7234
+ this.#date = luxon_1.DateTime.fromMillis(timestamp2, dateOpts);
7235
7235
  } else {
7236
- this.#date = luxon_1.DateTime.fromISO(timestamp, dateOpts);
7237
- this.#date.isValid || (this.#date = luxon_1.DateTime.fromRFC2822(timestamp, dateOpts));
7238
- this.#date.isValid || (this.#date = luxon_1.DateTime.fromSQL(timestamp, dateOpts));
7239
- this.#date.isValid || (this.#date = luxon_1.DateTime.fromFormat(timestamp, "EEE, d MMM yyyy HH:mm:ss", dateOpts));
7236
+ this.#date = luxon_1.DateTime.fromISO(timestamp2, dateOpts);
7237
+ this.#date.isValid || (this.#date = luxon_1.DateTime.fromRFC2822(timestamp2, dateOpts));
7238
+ this.#date.isValid || (this.#date = luxon_1.DateTime.fromSQL(timestamp2, dateOpts));
7239
+ this.#date.isValid || (this.#date = luxon_1.DateTime.fromFormat(timestamp2, "EEE, d MMM yyyy HH:mm:ss", dateOpts));
7240
7240
  }
7241
7241
  if (!this.#date.isValid) {
7242
- throw new Error(`CronDate: unhandled timestamp: ${timestamp}`);
7242
+ throw new Error(`CronDate: unhandled timestamp: ${timestamp2}`);
7243
7243
  }
7244
7244
  if (tz && tz !== this.#date.zoneName) {
7245
7245
  this.#date = this.#date.setZone(tz);
@@ -9812,10 +9812,10 @@ async function fetchOpenCodeGoCatalog(agent, fallbackModelIds = [DEFAULT_OPENCOD
9812
9812
 
9813
9813
  // ../shared/src/api-casing.ts
9814
9814
  var toCamel = (key) => key.replace(/_([a-z0-9])/g, (_, char) => char.toUpperCase());
9815
- function withCamelCaseKeys(body) {
9816
- if (!isRecord(body)) return body;
9817
- const aliases = Object.entries(body).filter(([key]) => key.includes("_") && !(toCamel(key) in body));
9818
- return aliases.length ? { ...body, ...Object.fromEntries(aliases.map(([key, entry]) => [toCamel(key), entry])) } : body;
9815
+ function withCamelCaseKeys(body2) {
9816
+ if (!isRecord(body2)) return body2;
9817
+ const aliases = Object.entries(body2).filter(([key]) => key.includes("_") && !(toCamel(key) in body2));
9818
+ return aliases.length ? { ...body2, ...Object.fromEntries(aliases.map(([key, entry]) => [toCamel(key), entry])) } : body2;
9819
9819
  }
9820
9820
 
9821
9821
  // ../shared/src/engine/types.ts
@@ -11280,10 +11280,10 @@ function imageContentToUserMessageImages(images) {
11280
11280
  }
11281
11281
  return userImages.length > 0 ? userImages : void 0;
11282
11282
  }
11283
- function createAcceptedUserMessageEvent(message2, messageId, timestamp, images, replacesMessageId) {
11283
+ function createAcceptedUserMessageEvent(message2, messageId, timestamp2, images, replacesMessageId) {
11284
11284
  const eventImages = imageContentToUserMessageImages(images);
11285
11285
  return {
11286
- timestamp,
11286
+ timestamp: timestamp2,
11287
11287
  type: "event_msg",
11288
11288
  payload: {
11289
11289
  type: "user_message",
@@ -11309,9 +11309,9 @@ function codexItemEvent(turnId, item, partial = false) {
11309
11309
  payload: { turnId, item: payloadItem }
11310
11310
  };
11311
11311
  }
11312
- function codexTurnEvent(turnId, status, timestamp, error) {
11312
+ function codexTurnEvent(turnId, status, timestamp2, error) {
11313
11313
  return {
11314
- timestamp,
11314
+ timestamp: timestamp2,
11315
11315
  type: CODEX_TURN_EVENT_TYPE,
11316
11316
  payload: { turnId, status, ...error ? { error } : {} }
11317
11317
  };
@@ -12123,14 +12123,14 @@ var HEADER_BYTES = 9;
12123
12123
  var encoder = new TextEncoder();
12124
12124
  var decoder = new TextDecoder();
12125
12125
  function encodeExecFrame(type, id, json = {}, payload) {
12126
- const body = encoder.encode(JSON.stringify(json));
12127
- const frame = new Uint8Array(HEADER_BYTES + body.length + (payload?.length ?? 0));
12126
+ const body2 = encoder.encode(JSON.stringify(json));
12127
+ const frame = new Uint8Array(HEADER_BYTES + body2.length + (payload?.length ?? 0));
12128
12128
  const view = new DataView(frame.buffer);
12129
12129
  view.setUint8(0, type);
12130
12130
  view.setUint32(1, id);
12131
- view.setUint32(5, body.length);
12132
- frame.set(body, HEADER_BYTES);
12133
- if (payload) frame.set(payload, HEADER_BYTES + body.length);
12131
+ view.setUint32(5, body2.length);
12132
+ frame.set(body2, HEADER_BYTES);
12133
+ if (payload) frame.set(payload, HEADER_BYTES + body2.length);
12134
12134
  return frame;
12135
12135
  }
12136
12136
  function decodeExecFrame(data) {
@@ -12179,7 +12179,7 @@ var execRequestSchema = z15.object({
12179
12179
  /** Kill after this long with nobody attached. */
12180
12180
  idleTtlMs: z15.number().int().positive().max(EXEC_MAX_IDLE_TTL_MS).optional(),
12181
12181
  stdin: z15.boolean().optional()
12182
- }).refine((body) => [body.command, body.argv, body.mcpServer].filter((value) => value !== void 0).length === 1, { message: "Pass exactly one of command, argv or mcpServer" });
12182
+ }).refine((body2) => [body2.command, body2.argv, body2.mcpServer].filter((value) => value !== void 0).length === 1, { message: "Pass exactly one of command, argv or mcpServer" });
12183
12183
  var execStartedSchema = z15.object({ processId: z15.string(), pid: z15.number() });
12184
12184
  var execExitSchema = z15.object({ exitCode: z15.number(), signal: z15.string().nullable(), reason: z15.enum(["exit", "timeout", "killed", "idle"]) });
12185
12185
  var execReplySchemas = {
@@ -12235,8 +12235,8 @@ function parseSseChunk(chunk) {
12235
12235
  return null;
12236
12236
  }
12237
12237
  }
12238
- async function* iterateSseStream(body, onChunk) {
12239
- const reader = body.getReader();
12238
+ async function* iterateSseStream(body2, onChunk) {
12239
+ const reader = body2.getReader();
12240
12240
  const decoder3 = new TextDecoder();
12241
12241
  let buffer = "";
12242
12242
  let searchFrom = 0;
@@ -12255,9 +12255,9 @@ async function* iterateSseStream(body, onChunk) {
12255
12255
  searchFrom = Math.max(0, buffer.length - 1);
12256
12256
  }
12257
12257
  }
12258
- async function readSseStream(body, onEvent, shouldContinue = () => true, onChunk) {
12258
+ async function readSseStream(body2, onEvent, shouldContinue = () => true, onChunk) {
12259
12259
  if (!shouldContinue()) return;
12260
- for await (const event of iterateSseStream(body, onChunk)) {
12260
+ for await (const event of iterateSseStream(body2, onChunk)) {
12261
12261
  if (!shouldContinue()) break;
12262
12262
  await onEvent(event);
12263
12263
  }
@@ -16112,8 +16112,8 @@ function parseAutomationRun(raw) {
16112
16112
  }
16113
16113
  if (!isRecord(run) || typeof run.id !== "string" || typeof run.name !== "string") return null;
16114
16114
  const rest = raw.slice(match[0].length);
16115
- const body = stripReplicasInstructionBlock(rest.replace(SCHEDULED_FOLLOW_UP, ""));
16116
- return { kind: "automation", id: run.id, name: run.name, body, ...typeof run.firedAt === "string" ? { firedAt: run.firedAt } : {} };
16115
+ const body2 = stripReplicasInstructionBlock(rest.replace(SCHEDULED_FOLLOW_UP, ""));
16116
+ return { kind: "automation", id: run.id, name: run.name, body: body2, ...typeof run.firedAt === "string" ? { firedAt: run.firedAt } : {} };
16117
16117
  }
16118
16118
  function parseMessageOrigin(raw) {
16119
16119
  const run = parseAutomationRun(raw);
@@ -16168,9 +16168,9 @@ function truncateManagerEventResponse(response, readTool) {
16168
16168
  function formatManagerEvents(events) {
16169
16169
  return events.map((event) => {
16170
16170
  const attributes = { id: event.id, at: event.at, kind: event.kind, agent: event.agentName, agent_id: event.agentId, ...event.chatId ? { chat_id: event.chatId } : {}, ...event.ticket ? { ticket_id: event.ticket.id, ticket: event.ticket.title } : {}, ...event.noticed ? { noticed: "true" } : {} };
16171
- const body = [event.summary, event.detail].filter(Boolean).join("\n\n").replaceAll(`</${TAG}`, `<\\/${TAG}`);
16171
+ const body2 = [event.summary, event.detail].filter(Boolean).join("\n\n").replaceAll(`</${TAG}`, `<\\/${TAG}`);
16172
16172
  return `<${TAG}${Object.entries(attributes).map(([key, value]) => ` ${key}="${escapeAttribute(value)}"`).join("")}>
16173
- ${body}
16173
+ ${body2}
16174
16174
  </${TAG}>`;
16175
16175
  }).join("\n\n");
16176
16176
  }
@@ -16313,7 +16313,7 @@ function formatChatForkHandoffMessage(handoff) {
16313
16313
  const reason = describeChatForkReason(handoff.reason, handoff.source.provider);
16314
16314
  const why = handoff.trigger === "auto" ? `until ${reason ?? "it stopped"}, so Replicas moved the conversation to you automatically` : `until the user ${handoff.trigger === "switch" ? "switched" : "forked"} it to you`;
16315
16315
  const side = handoff.trigger === "side";
16316
- const body = [
16316
+ const body2 = [
16317
16317
  side ? "# Side chat" : handoff.subagent ? "# Delegated task context" : `# Continuing a ${sourceName} chat`,
16318
16318
  "",
16319
16319
  side ? `You are a side chat the user opened next to the main chat "${handoff.source.title}" (${sourceName}) in this same workspace, to talk about it without interrupting it. The main chat may still be working, and nothing you say reaches it or its agent. Answer from its transcript and the workspace. The recent turns below are a snapshot from when you were opened and the main chat has likely moved on, so re-read the transcript file before answering anything about what it is doing or has done. Its agent works in the same files, so don't edit files, change git state, or start or stop processes unless the user explicitly asks you to.` : handoff.subagent ? `You are a subagent of the chat "${handoff.source.title}" in this same workspace. The inherited transcript is background for your assigned task below. Follow that task and report your result to the parent; do not take over the parent's entire request. Workspace files and git state are shared and authoritative.` : `You are picking up the chat "${handoff.source.title}" in this same workspace. It was running on ${sourceName} ${why}. Everything the previous agent changed is already on disk: the workspace files and git state are authoritative.`,
@@ -16333,7 +16333,7 @@ function formatChatForkHandoffMessage(handoff) {
16333
16333
 
16334
16334
  ${handoff.resumeRequest.trim().replace(/^/gm, "> ")}` : "Review the recent turns and the current workspace state, then continue where the previous agent left off. If nothing is pending, confirm in a sentence or two what you know and wait for the next request.");
16335
16335
  return `${OPEN_MARKER}${JSON.stringify(meta)}${OPEN_MARKER_END}
16336
- ${body}
16336
+ ${body2}
16337
16337
  ${CLOSE_MARKER}
16338
16338
 
16339
16339
  ${instruction}`;
@@ -16859,7 +16859,7 @@ function getDisplayMessageActivity(message2) {
16859
16859
  ${operation.diff}` : ""}`).join("\n\n");
16860
16860
  return { kind: "file", title: "Apply patch", summary: message2.operations.map((operation) => operation.path).join(", "), content: [operations, message2.output].filter(Boolean).join("\n\n") };
16861
16861
  }
16862
- if (message2.type === "file_change") return { kind: "file", title: "File changes", summary: message2.changes.map((change) => change.path).join(", "), content: message2.changes.map((change) => `${change.kind.toUpperCase()} ${change.path}`).join("\n") };
16862
+ if (message2.type === "file_change") return { kind: "file", title: "File changes", summary: message2.changes.map((change2) => change2.path).join(", "), content: message2.changes.map((change2) => `${change2.kind.toUpperCase()} ${change2.path}`).join("\n") };
16863
16863
  if (message2.type === "tool_call") return { kind: "tool", title: `Tool \xB7 ${message2.tool}`, summary: message2.server, content: [stringifyDisplayValue(message2.input), message2.output].filter(Boolean).join("\n\n") };
16864
16864
  if (message2.type === "web_search") return { kind: "search", title: "Web search", summary: message2.query, content: "" };
16865
16865
  if (message2.type === "todo_list") {
@@ -17359,14 +17359,14 @@ var linearIssueSummariesRequestSchema = z30.object({ identifiers: z30.array(line
17359
17359
 
17360
17360
  // ../shared/src/user-message-matching.ts
17361
17361
  var parsedTimestamps = /* @__PURE__ */ new Map();
17362
- function parseTimestampMs(timestamp) {
17363
- if (typeof timestamp === "number") return Number.isFinite(timestamp) ? timestamp : 0;
17364
- let value = parsedTimestamps.get(timestamp);
17362
+ function parseTimestampMs(timestamp2) {
17363
+ if (typeof timestamp2 === "number") return Number.isFinite(timestamp2) ? timestamp2 : 0;
17364
+ let value = parsedTimestamps.get(timestamp2);
17365
17365
  if (value === void 0) {
17366
- const parsed = Date.parse(timestamp);
17366
+ const parsed = Date.parse(timestamp2);
17367
17367
  value = Number.isFinite(parsed) ? parsed : 0;
17368
17368
  if (parsedTimestamps.size >= 5e4) parsedTimestamps.clear();
17369
- parsedTimestamps.set(timestamp, value);
17369
+ parsedTimestamps.set(timestamp2, value);
17370
17370
  }
17371
17371
  return value;
17372
17372
  }
@@ -17484,9 +17484,9 @@ function describeMessageSteps(message2, durationMs, background) {
17484
17484
  };
17485
17485
  });
17486
17486
  case "file_change":
17487
- return message2.changes.map((change, index) => {
17488
- const [live, done, icon] = OPERATION_VERBS[change.kind] ?? OPERATION_VERBS.update;
17489
- return { ...base, key: `${message2.id}-${index}`, category: "edit", icon, live, done, target: { text: change.path, path: change.path } };
17487
+ return message2.changes.map((change2, index) => {
17488
+ const [live, done, icon] = OPERATION_VERBS[change2.kind] ?? OPERATION_VERBS.update;
17489
+ return { ...base, key: `${message2.id}-${index}`, category: "edit", icon, live, done, target: { text: change2.path, path: change2.path } };
17490
17490
  });
17491
17491
  case "web_search":
17492
17492
  return [{ ...base, key: message2.id, category: "web", icon: "globe", live: "Searching the web for", done: "Searched the web for", target: { text: message2.query } }];
@@ -17705,8 +17705,8 @@ function describeSteps(message2, { durations, backgroundTasks }) {
17705
17705
  var NO_DURATIONS = /* @__PURE__ */ new Map();
17706
17706
  function plainStepLabel(step) {
17707
17707
  const { message: message2 } = step;
17708
- const description = message2.type === "command" ? message2.description : message2.type === "tool_call" && step.category === "command" ? inputString(parseToolCallInput(message2.input).inputObject, "description") : void 0;
17709
- if (description) return description;
17708
+ const description2 = message2.type === "command" ? message2.description : message2.type === "tool_call" && step.category === "command" ? inputString(parseToolCallInput(message2.input).inputObject, "description") : void 0;
17709
+ if (description2) return description2;
17710
17710
  if (step.category === "command" || step.category === "search" && message2.type === "command") return void 0;
17711
17711
  if (step.category === "tool" && step.scope) {
17712
17712
  const server = step.scope.replace(/^(claude_ai|plugin_[^_]+)_/, "").replace(/[-_]+/g, " ").replace(/ mcp$/i, "");
@@ -17755,8 +17755,8 @@ function findAnnotationsNote(content) {
17755
17755
  }
17756
17756
  return null;
17757
17757
  }
17758
- function parseAnnotationsNote(body) {
17759
- return body.split(ANNOTATION_HEADER_REGEX).slice(1).map((entry) => {
17758
+ function parseAnnotationsNote(body2) {
17759
+ return body2.split(ANNOTATION_HEADER_REGEX).slice(1).map((entry) => {
17760
17760
  const lines = entry.trim().split("\n");
17761
17761
  const file = lines[0]?.match(ANNOTATION_FILE_REGEX);
17762
17762
  if (file) lines.shift();
@@ -17826,12 +17826,12 @@ function stripAttachmentNote(text4) {
17826
17826
  function isBytes(a) {
17827
17827
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array" && "BYTES_PER_ELEMENT" in a && a.BYTES_PER_ELEMENT === 1;
17828
17828
  }
17829
- function abytes(value, length, title2 = "") {
17829
+ function abytes(value, length, title3 = "") {
17830
17830
  const bytes = isBytes(value);
17831
17831
  const len = value?.length;
17832
17832
  const needsLen = length !== void 0;
17833
17833
  if (!bytes || needsLen && len !== length) {
17834
- const prefix = title2 && `"${title2}" `;
17834
+ const prefix = title3 && `"${title3}" `;
17835
17835
  const ofLen = needsLen ? ` of length ${length}` : "";
17836
17836
  const got = bytes ? `length=${len}` : `type=${typeof value}`;
17837
17837
  const message2 = prefix + "expected Uint8Array" + ofLen + ", got " + got;
@@ -19003,17 +19003,17 @@ var INFERENCE_ERROR_RETRY_HINT = "This is usually temporary \u2014 retry the mes
19003
19003
  function formatInferenceError(message2, context = {}) {
19004
19004
  const label = context.provider ? INFERENCE_PROVIDER_LABELS[context.provider] ?? context.provider : null;
19005
19005
  const source = label ? `${label}${context.model ? ` (${context.model})` : ""} request failed${typeof context.status === "number" ? ` with HTTP ${context.status}` : ""}` : null;
19006
- let body = source ? message2 ? `${source}: ${message2}` : `${source}.` : message2;
19006
+ let body2 = source ? message2 ? `${source}: ${message2}` : `${source}.` : message2;
19007
19007
  const detail = context.detail?.trim();
19008
- if (detail && !body.includes(detail)) {
19009
- body = `${body}
19008
+ if (detail && !body2.includes(detail)) {
19009
+ body2 = `${body2}
19010
19010
  ${detail.length > INFERENCE_ERROR_DETAIL_MAX ? `${detail.slice(0, INFERENCE_ERROR_DETAIL_MAX)}\u2026` : detail}`;
19011
19011
  }
19012
19012
  const sniffText = `${message2}
19013
19013
  ${detail ?? ""}`;
19014
19014
  const transient = context.retryable ?? (typeof context.status === "number" ? TRANSIENT_HTTP_STATUSES.includes(context.status) || context.status >= 500 : isTransientErrorText(sniffText, { httpStatuses: TRANSIENT_HTTP_STATUSES, includeRateLimit: true }) || SERVER_ERROR_TEXT_PATTERN.test(sniffText));
19015
- return transient ? `${body}
19016
- ${INFERENCE_ERROR_RETRY_HINT}` : body;
19015
+ return transient ? `${body2}
19016
+ ${INFERENCE_ERROR_RETRY_HINT}` : body2;
19017
19017
  }
19018
19018
 
19019
19019
  // ../shared/src/display-message/parsers/opencode-parser.ts
@@ -19043,9 +19043,9 @@ function parseOpencodeEvents(events) {
19043
19043
  const messages = [];
19044
19044
  const inputState = { requests: /* @__PURE__ */ new Map(), resolutions: /* @__PURE__ */ new Map(), requestedAt: /* @__PURE__ */ new Map() };
19045
19045
  const streamedParts = /* @__PURE__ */ new Map();
19046
- const upsertStreamedPart = ({ id, type, text: text4, completed, timestamp }) => {
19046
+ const upsertStreamedPart = ({ id, type, text: text4, completed, timestamp: timestamp2 }) => {
19047
19047
  if (!text4.trim()) return;
19048
- upsertDisplayMessage(messages, type === "text" ? { id, type: "agent", content: text4, timestamp } : { id, type: "reasoning", content: text4, status: completed ? "completed" : "in_progress", timestamp });
19048
+ upsertDisplayMessage(messages, type === "text" ? { id, type: "agent", content: text4, timestamp: timestamp2 } : { id, type: "reasoning", content: text4, status: completed ? "completed" : "in_progress", timestamp: timestamp2 });
19049
19049
  };
19050
19050
  for (const event of events) {
19051
19051
  if (event.type === "event_msg" && event.payload.type === "user_message") {
@@ -19118,14 +19118,14 @@ function parseOpencodeEvents(events) {
19118
19118
  if (typeof part.callID === "string") id = `opencode-tool-${part.callID}`;
19119
19119
  else if (typeof part.id === "string") id = `opencode-${part.id}`;
19120
19120
  const time = isRecord(part.time) ? part.time : null;
19121
- const timestamp = timestampFromMs(time?.start, event.timestamp);
19121
+ const timestamp2 = timestampFromMs(time?.start, event.timestamp);
19122
19122
  if ((part.type === "text" || part.type === "reasoning") && typeof part.id === "string") {
19123
19123
  const streamed = {
19124
19124
  id,
19125
19125
  type: part.type,
19126
19126
  text: typeof part.text === "string" ? part.text : "",
19127
19127
  completed: Boolean(time?.end),
19128
- timestamp
19128
+ timestamp: timestamp2
19129
19129
  };
19130
19130
  streamedParts.set(part.id, streamed);
19131
19131
  upsertStreamedPart(streamed);
@@ -19145,7 +19145,7 @@ function parseOpencodeEvents(events) {
19145
19145
  input: isRecord(input) ? input : stringifyDisplayValue(input),
19146
19146
  output,
19147
19147
  status,
19148
- timestamp
19148
+ timestamp: timestamp2
19149
19149
  }));
19150
19150
  continue;
19151
19151
  }
@@ -19157,7 +19157,7 @@ function parseOpencodeEvents(events) {
19157
19157
  type: "file_change",
19158
19158
  changes: files.map((path) => ({ path, kind: "update" })),
19159
19159
  status: "completed",
19160
- timestamp
19160
+ timestamp: timestamp2
19161
19161
  });
19162
19162
  }
19163
19163
  }
@@ -19487,16 +19487,16 @@ function contentBlocks(value) {
19487
19487
  function blockImages(blocks) {
19488
19488
  return blocks.flatMap((block) => block.type === "image" && typeof block.data === "string" && typeof block.mimeType === "string" ? [{ type: "image", mediaType: block.mimeType, data: block.data }] : []);
19489
19489
  }
19490
- function toolCallMessage(id, name, args, timestamp, result) {
19490
+ function toolCallMessage(id, name, args, timestamp2, result) {
19491
19491
  const status = !result ? "in_progress" : result.isError ? "failed" : "completed";
19492
19492
  if (name === "bash" && typeof args.command === "string") {
19493
- return { id, type: "command", command: args.command, output: result?.output, ...result?.exitCode !== void 0 ? { exitCode: result.exitCode } : {}, status, timestamp };
19493
+ return { id, type: "command", command: args.command, output: result?.output, ...result?.exitCode !== void 0 ? { exitCode: result.exitCode } : {}, status, timestamp: timestamp2 };
19494
19494
  }
19495
19495
  if ((name === "write" || name === "edit") && typeof args.path === "string") {
19496
- return { id, type: "file_change", changes: [{ path: args.path, kind: name === "write" ? "add" : "update" }], status, timestamp };
19496
+ return { id, type: "file_change", changes: [{ path: args.path, kind: name === "write" ? "add" : "update" }], status, timestamp: timestamp2 };
19497
19497
  }
19498
19498
  if (name === "web_search" && typeof args.query === "string") {
19499
- return { id, type: "web_search", query: args.query, status, timestamp };
19499
+ return { id, type: "web_search", query: args.query, status, timestamp: timestamp2 };
19500
19500
  }
19501
19501
  if (name === "spawn_agent") {
19502
19502
  const spawned = result?.output ? (() => {
@@ -19506,9 +19506,9 @@ function toolCallMessage(id, name, args, timestamp, result) {
19506
19506
  return null;
19507
19507
  }
19508
19508
  })() : null;
19509
- return { id, type: "subagent", toolUseId: id, description: typeof args.title === "string" ? args.title : "Replicas subagent", prompt: typeof args.prompt === "string" ? args.prompt : "", subagentType: "replicas", model: typeof args.model === "string" ? args.model : void 0, receiverThreadIds: isRecord(spawned) && typeof spawned.agentId === "string" ? [spawned.agentId] : void 0, status: result?.isError ? "failed" : "in_progress", nestedEvents: [], timestamp };
19509
+ return { id, type: "subagent", toolUseId: id, description: typeof args.title === "string" ? args.title : "Replicas subagent", prompt: typeof args.prompt === "string" ? args.prompt : "", subagentType: "replicas", model: typeof args.model === "string" ? args.model : void 0, receiverThreadIds: isRecord(spawned) && typeof spawned.agentId === "string" ? [spawned.agentId] : void 0, status: result?.isError ? "failed" : "in_progress", nestedEvents: [], timestamp: timestamp2 };
19510
19510
  }
19511
- return createCallDisplayMessage({ id, server: "replicas", tool: name, input: args, output: result?.output, status, timestamp });
19511
+ return createCallDisplayMessage({ id, server: "replicas", tool: name, input: args, output: result?.output, status, timestamp: timestamp2 });
19512
19512
  }
19513
19513
  function parseReplicasEvents(events) {
19514
19514
  const messages = [];
@@ -19517,20 +19517,20 @@ function parseReplicasEvents(events) {
19517
19517
  const streamEndedMs = latestMs(["assistant_message", "error", "status"].map((type) => `${HARNESS_EVENT_TYPE_PREFIX}${type}`));
19518
19518
  const livePartialMs = latestMs([CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE]);
19519
19519
  events.forEach((event) => {
19520
- const { payload, timestamp } = event;
19520
+ const { payload, timestamp: timestamp2 } = event;
19521
19521
  const message2 = isRecord(payload.message) ? payload.message : {};
19522
19522
  switch (event.type) {
19523
19523
  // The client's copy of a sent prompt, shown until the worker saves it under the same message id.
19524
19524
  case "event_msg": {
19525
19525
  if (payload.type !== "user_message" || typeof payload.message !== "string") return;
19526
19526
  const images = userMessageImages(payload.images);
19527
- messages.push({ id: getUserMessageId(event) ?? `replicas-pending-${timestamp}`, type: "user", content: payload.message, ...images ? { images } : {}, timestamp });
19527
+ messages.push({ id: getUserMessageId(event) ?? `replicas-pending-${timestamp2}`, type: "user", content: payload.message, ...images ? { images } : {}, timestamp: timestamp2 });
19528
19528
  return;
19529
19529
  }
19530
19530
  case `${HARNESS_EVENT_TYPE_PREFIX}cancelled_message`:
19531
19531
  case `${HARNESS_EVENT_TYPE_PREFIX}user_message`: {
19532
19532
  if (isRecord(payload.agentOutcome)) {
19533
- messages.push({ id: `replicas-peer-${String(payload.seq)}`, type: "peer_message", direction: "received", chat: typeof payload.agentOutcome.agentId === "string" ? payload.agentOutcome.agentId : void 0, content: extractToolResultText(message2.content), timestamp });
19533
+ messages.push({ id: `replicas-peer-${String(payload.seq)}`, type: "peer_message", direction: "received", chat: typeof payload.agentOutcome.agentId === "string" ? payload.agentOutcome.agentId : void 0, content: extractToolResultText(message2.content), timestamp: timestamp2 });
19534
19534
  for (const item of messages) {
19535
19535
  if (item.type === "subagent" && item.receiverThreadIds?.includes(String(payload.agentOutcome.agentId))) {
19536
19536
  item.status = payload.agentOutcome.status === "completed" ? "completed" : payload.agentOutcome.status === "help" ? "in_progress" : "failed";
@@ -19546,19 +19546,19 @@ function parseReplicasEvents(events) {
19546
19546
  type: "user",
19547
19547
  content: `${event.type === `${HARNESS_EVENT_TYPE_PREFIX}cancelled_message` ? "[Cancelled before it started]\n\n" : ""}${extractToolResultText(message2.content)}`,
19548
19548
  ...images.length ? { images } : {},
19549
- timestamp
19549
+ timestamp: timestamp2
19550
19550
  });
19551
19551
  return;
19552
19552
  }
19553
19553
  case `${HARNESS_EVENT_TYPE_PREFIX}assistant_message`: {
19554
19554
  contentBlocks(message2.content).forEach((block, blockIndex) => {
19555
19555
  const id = `replicas-${String(payload.seq)}-${blockIndex}`;
19556
- if (block.type === "text" && typeof block.text === "string" && block.text) messages.push({ id, type: "agent", content: block.text, timestamp });
19557
- if (block.type === "thinking" && typeof block.thinking === "string" && block.thinking) messages.push({ id, type: "reasoning", content: block.thinking, status: "completed", timestamp });
19556
+ if (block.type === "text" && typeof block.text === "string" && block.text) messages.push({ id, type: "agent", content: block.text, timestamp: timestamp2 });
19557
+ if (block.type === "thinking" && typeof block.thinking === "string" && block.thinking) messages.push({ id, type: "reasoning", content: block.thinking, status: "completed", timestamp: timestamp2 });
19558
19558
  if (block.type === "toolCall" && typeof block.id === "string" && typeof block.name === "string") {
19559
- const call = { name: block.name, args: isRecord(block.arguments) ? block.arguments : {}, timestamp };
19559
+ const call = { name: block.name, args: isRecord(block.arguments) ? block.arguments : {}, timestamp: timestamp2 };
19560
19560
  toolCalls.set(block.id, call);
19561
- messages.push(toolCallMessage(`replicas-tool-${block.id}`, call.name, call.args, timestamp));
19561
+ messages.push(toolCallMessage(`replicas-tool-${block.id}`, call.name, call.args, timestamp2));
19562
19562
  }
19563
19563
  });
19564
19564
  if (message2.stopReason === "error") {
@@ -19569,14 +19569,14 @@ function parseReplicasEvents(events) {
19569
19569
  ...typeof message2.provider === "string" ? { provider: message2.provider } : {},
19570
19570
  ...typeof message2.model === "string" ? { model: message2.model } : {}
19571
19571
  }),
19572
- timestamp
19572
+ timestamp: timestamp2
19573
19573
  });
19574
19574
  }
19575
19575
  return;
19576
19576
  }
19577
19577
  case `${HARNESS_EVENT_TYPE_PREFIX}tool_result`: {
19578
19578
  if (typeof message2.toolCallId !== "string") return;
19579
- const call = toolCalls.get(message2.toolCallId) ?? { name: typeof message2.toolName === "string" ? message2.toolName : "tool", args: {}, timestamp };
19579
+ const call = toolCalls.get(message2.toolCallId) ?? { name: typeof message2.toolName === "string" ? message2.toolName : "tool", args: {}, timestamp: timestamp2 };
19580
19580
  const exitCode = isRecord(message2.details) && typeof message2.details.exitCode === "number" ? message2.details.exitCode : void 0;
19581
19581
  upsertDisplayMessage(messages, toolCallMessage(`replicas-tool-${message2.toolCallId}`, call.name, call.args, call.timestamp, {
19582
19582
  output: extractToolResultText(message2.content) || void 0,
@@ -19586,16 +19586,16 @@ function parseReplicasEvents(events) {
19586
19586
  return;
19587
19587
  }
19588
19588
  case `${HARNESS_EVENT_TYPE_PREFIX}compaction`:
19589
- messages.push({ id: `replicas-compaction-${String(payload.seq)}`, type: "reasoning", content: COMPACTION_CONTENT, status: "completed", timestamp, completedAt: timestamp });
19589
+ messages.push({ id: `replicas-compaction-${String(payload.seq)}`, type: "reasoning", content: COMPACTION_CONTENT, status: "completed", timestamp: timestamp2, completedAt: timestamp2 });
19590
19590
  return;
19591
19591
  case `${HARNESS_EVENT_TYPE_PREFIX}error`:
19592
- messages.push({ id: `replicas-error-${String(payload.seq)}`, type: "error", message: stringifyDisplayValue(payload.message) ?? "The agent stopped with an error", timestamp });
19592
+ messages.push({ id: `replicas-error-${String(payload.seq)}`, type: "error", message: stringifyDisplayValue(payload.message) ?? "The agent stopped with an error", timestamp: timestamp2 });
19593
19593
  return;
19594
19594
  case CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE: {
19595
19595
  const partial = coerceClaudePartialMessagePayload(payload);
19596
19596
  if (!partial || Date.parse(event.timestamp) <= streamEndedMs || Date.parse(event.timestamp) < livePartialMs) return;
19597
- if (partial.thinking) upsertDisplayMessage(messages, { id: `replicas-partial-${partial.streamId}-thinking`, type: "reasoning", content: partial.thinking, status: "in_progress", timestamp });
19598
- if (partial.text) upsertDisplayMessage(messages, { id: `replicas-partial-${partial.streamId}`, type: "agent", content: partial.text, timestamp });
19597
+ if (partial.thinking) upsertDisplayMessage(messages, { id: `replicas-partial-${partial.streamId}-thinking`, type: "reasoning", content: partial.thinking, status: "in_progress", timestamp: timestamp2 });
19598
+ if (partial.text) upsertDisplayMessage(messages, { id: `replicas-partial-${partial.streamId}`, type: "agent", content: partial.text, timestamp: timestamp2 });
19599
19599
  return;
19600
19600
  }
19601
19601
  }
@@ -19609,14 +19609,14 @@ var COMMAND_TOOL_NAMES = /* @__PURE__ */ new Set(["Bash", "bash", "shell"]);
19609
19609
  var FILE_TOOL_NAMES = /* @__PURE__ */ new Set(["Write", "Edit"]);
19610
19610
  var toolMessageTemplates = /* @__PURE__ */ new WeakMap();
19611
19611
  var toolResults = /* @__PURE__ */ new WeakMap();
19612
- function fileOrCommandMessage(block, timestamp) {
19612
+ function fileOrCommandMessage(block, timestamp2) {
19613
19613
  let template = toolMessageTemplates.get(block);
19614
19614
  if (!template) {
19615
19615
  const input = typeof block.input === "string" ? safeJsonParse(block.input, {}) : block.input ?? {};
19616
19616
  template = toolMessageTemplate(block.name ?? "", block.id ?? "", input);
19617
19617
  toolMessageTemplates.set(block, template);
19618
19618
  }
19619
- return { ...template, timestamp };
19619
+ return { ...template, timestamp: timestamp2 };
19620
19620
  }
19621
19621
  function toolMessageTemplate(toolName, toolUseId, input) {
19622
19622
  if (COMMAND_TOOL_NAMES.has(toolName)) {
@@ -19660,17 +19660,17 @@ function toolMessageTemplate(toolName, toolUseId, input) {
19660
19660
  status: "in_progress"
19661
19661
  };
19662
19662
  }
19663
- function createSubagentMessage(timestamp, fields) {
19664
- return { id: `subagent-${fields.toolUseId}`, type: "subagent", ...fields, timestamp };
19663
+ function createSubagentMessage(timestamp2, fields) {
19664
+ return { id: `subagent-${fields.toolUseId}`, type: "subagent", ...fields, timestamp: timestamp2 };
19665
19665
  }
19666
19666
  function groupNestedEvents(events) {
19667
19667
  const nested = /* @__PURE__ */ new Map();
19668
- for (const { timestamp, type, payload } of events) {
19668
+ for (const { timestamp: timestamp2, type, payload } of events) {
19669
19669
  const parent = payload.parent_tool_use_id;
19670
19670
  if (typeof parent !== "string") continue;
19671
19671
  const siblings = nested.get(parent);
19672
- if (siblings) siblings.push({ timestamp, type, payload });
19673
- else nested.set(parent, [{ timestamp, type, payload }]);
19672
+ if (siblings) siblings.push({ timestamp: timestamp2, type, payload });
19673
+ else nested.set(parent, [{ timestamp: timestamp2, type, payload }]);
19674
19674
  }
19675
19675
  return nested;
19676
19676
  }
@@ -19784,14 +19784,14 @@ function parseClaudeEvents(events, parentToolUseId) {
19784
19784
  const canonicalUserMessageIndexes = /* @__PURE__ */ new Set();
19785
19785
  const supersededUserMessageIndexes = /* @__PURE__ */ new Set();
19786
19786
  const stampedUserMessages = /* @__PURE__ */ new Set();
19787
- const findMatchingUserMessageIndex = (indexes, content, timestamp, messageId) => {
19787
+ const findMatchingUserMessageIndex = (indexes, content, timestamp2, messageId) => {
19788
19788
  if (typeof messageId === "string") {
19789
19789
  const byId = indexesOf(messageId).find((index) => messages[index].type === "user" && !supersededUserMessageIndexes.has(index));
19790
19790
  if (byId !== void 0) return byId;
19791
19791
  }
19792
19792
  for (const index of indexes) {
19793
19793
  const message2 = messages[index];
19794
- if (message2?.type === "user" && !(typeof messageId === "string" && stampedUserMessages.has(message2)) && areUserMessagesWithinMatchWindow(message2, { content, timestamp })) return index;
19794
+ if (message2?.type === "user" && !(typeof messageId === "string" && stampedUserMessages.has(message2)) && areUserMessagesWithinMatchWindow(message2, { content, timestamp: timestamp2 })) return index;
19795
19795
  }
19796
19796
  return void 0;
19797
19797
  };
@@ -19864,8 +19864,8 @@ function parseClaudeEvents(events, parentToolUseId) {
19864
19864
  return;
19865
19865
  }
19866
19866
  if (event.type === CLAUDE_PEER_MESSAGE_EVENT_TYPE) {
19867
- const { name, from, body } = event.payload;
19868
- if (typeof body !== "string") return;
19867
+ const { name, from, body: body2 } = event.payload;
19868
+ if (typeof body2 !== "string") return;
19869
19869
  if (typeof name === "string" && typeof from === "string") peerNames.set(from, name);
19870
19870
  const sameTime = peerTimestamps.get(event.timestamp) ?? 0;
19871
19871
  peerTimestamps.set(event.timestamp, sameTime + 1);
@@ -19874,7 +19874,7 @@ function parseClaudeEvents(events, parentToolUseId) {
19874
19874
  type: "peer_message",
19875
19875
  direction: "received",
19876
19876
  ...typeof name === "string" ? { chat: name } : {},
19877
- content: body,
19877
+ content: body2,
19878
19878
  timestamp: event.timestamp
19879
19879
  });
19880
19880
  return;
@@ -20177,10 +20177,10 @@ function parseClaudeEvents(events, parentToolUseId) {
20177
20177
  };
20178
20178
  }
20179
20179
  });
20180
- for (const [streamId, { tool, timestamp }] of streamingTools) {
20180
+ for (const [streamId, { tool, timestamp: timestamp2 }] of streamingTools) {
20181
20181
  if (toolCallMap.has(tool.id) || supersededStreamIds.has(streamId)) continue;
20182
20182
  if (!COMMAND_TOOL_NAMES.has(tool.name) && !FILE_TOOL_NAMES.has(tool.name)) continue;
20183
- messages.push(fileOrCommandMessage({ type: "tool_use", id: tool.id, name: tool.name, input: "filePath" in tool ? { file_path: tool.filePath } : { command: tool.command } }, timestamp));
20183
+ messages.push(fileOrCommandMessage({ type: "tool_use", id: tool.id, name: tool.name, input: "filePath" in tool ? { file_path: tool.filePath } : { command: tool.command } }, timestamp2));
20184
20184
  }
20185
20185
  filteredEvents.forEach((event) => {
20186
20186
  const result = readToolResult(event);
@@ -20986,8 +20986,8 @@ ${details.join("\n")}` : ""}`;
20986
20986
  function lastUserBlockText(blocks) {
20987
20987
  const block = blocks.findLast((entry) => entry.startsWith("## User"));
20988
20988
  if (!block) return null;
20989
- const body = block.slice(block.indexOf("\n") + 1).trim();
20990
- return body || null;
20989
+ const body2 = block.slice(block.indexOf("\n") + 1).trim();
20990
+ return body2 || null;
20991
20991
  }
20992
20992
 
20993
20993
  // ../shared/src/transcript-condense.ts
@@ -21074,7 +21074,7 @@ function buildCodexTokenUsageContextUsagePayload(usage) {
21074
21074
  updatedAt: usage.updatedAt
21075
21075
  };
21076
21076
  }
21077
- function coerceContextUsagePayload(payload, timestamp) {
21077
+ function coerceContextUsagePayload(payload, timestamp2) {
21078
21078
  const provider2 = payload.provider;
21079
21079
  if (typeof provider2 !== "string" || !isValidAgentProvider(provider2)) return null;
21080
21080
  const rawTotalTokens = numberOrNull(payload.totalTokens);
@@ -21113,7 +21113,7 @@ function coerceContextUsagePayload(payload, timestamp) {
21113
21113
  ...compactsAutomatically !== void 0 ? { compactsAutomatically } : {},
21114
21114
  ...autoCompactThreshold !== null ? { autoCompactThreshold } : {},
21115
21115
  categories,
21116
- updatedAt: typeof payload.updatedAt === "string" ? payload.updatedAt : timestamp
21116
+ updatedAt: typeof payload.updatedAt === "string" ? payload.updatedAt : timestamp2
21117
21117
  };
21118
21118
  }
21119
21119
  function codexTokenCountToContextUsage(event) {
@@ -21193,7 +21193,7 @@ async function withRetry(label, fn, options) {
21193
21193
  }
21194
21194
 
21195
21195
  // ../shared/src/tensorlake.ts
21196
- var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-20-v4";
21196
+ var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-20-v6";
21197
21197
  var TENSORLAKE_DISK_MB = 100 * 1024;
21198
21198
 
21199
21199
  // ../shared/src/egress.ts
@@ -21301,10 +21301,10 @@ function normalizeSlashCommandName(name) {
21301
21301
  if (!command || /\s/.test(command)) return null;
21302
21302
  return `/${command}`;
21303
21303
  }
21304
- function createProviderSlashCommand(provider2, name, description, argumentHint) {
21304
+ function createProviderSlashCommand(provider2, name, description2, argumentHint) {
21305
21305
  const command = normalizeSlashCommandName(name);
21306
21306
  if (!command) return null;
21307
- const trimmedDescription = description?.trim();
21307
+ const trimmedDescription = description2?.trim();
21308
21308
  const trimmedArgumentHint = argumentHint?.trim();
21309
21309
  return {
21310
21310
  command,
@@ -22544,7 +22544,7 @@ var scoutDeleteChannelPresetToolInputSchema = scoutSettingsConfirmationSchema.ex
22544
22544
  preset_id: z36.string().describe(`Id of the preset to delete, from \`${REPLICAS_MCP_TOOLS.listChannelSettings}\`.`)
22545
22545
  });
22546
22546
  var RESET_TO_DEFAULT = "default";
22547
- var resettable = (schema, description) => z36.union([schema, z36.literal(RESET_TO_DEFAULT)]).optional().describe(`${description} \`${RESET_TO_DEFAULT}\` falls back to the organization default. Omit to keep it.`);
22547
+ var resettable = (schema, description2) => z36.union([schema, z36.literal(RESET_TO_DEFAULT)]).optional().describe(`${description2} \`${RESET_TO_DEFAULT}\` falls back to the organization default. Omit to keep it.`);
22548
22548
  var scoutSetSlackAgentDefaultsToolInputSchema = scoutSettingsConfirmationSchema.extend({
22549
22549
  agent_provider: resettable(z36.enum(VALID_AGENT_PROVIDERS), "Agent for Slack-triggered workspaces. Changing it without `model` resets the model to that agent's default."),
22550
22550
  model: resettable(z36.string(), "Model id for that agent; the default is the agent's own."),
@@ -22685,6 +22685,7 @@ var workspaceEventSchemaByType = z41.discriminatedUnion("type", [
22685
22685
  ts: z41.string()
22686
22686
  }),
22687
22687
  z41.object({ type: z41.enum(["manager.board.changed", "mothership.board.changed"]), workspaceId: z41.string(), ts: z41.string() }),
22688
+ z41.object({ type: z41.literal("issues.synced"), syncId: z41.number(), ts: z41.string() }),
22688
22689
  z41.object({ type: z41.literal("needs-you.changed"), workspaceId: z41.string().nullable(), userId: z41.string().optional(), ts: z41.string() }),
22689
22690
  z41.object({
22690
22691
  type: z41.literal("workspace.shared"),
@@ -23164,6 +23165,217 @@ var SCHEDULE_TIMEZONES = typeof Intl.supportedValuesOf === "function" ? ["UTC",
23164
23165
  // ../shared/src/automations/form.ts
23165
23166
  var AUTOMATION_AUTO_STOP_RANGE_LABEL = `${AUTOMATION_WORKSPACE_AUTO_STOP_MINUTES_MIN}-${AUTOMATION_WORKSPACE_AUTO_STOP_MINUTES_MAX}`;
23166
23167
 
23168
+ // ../shared/src/routes/issues.ts
23169
+ import { z as z43 } from "zod";
23170
+ var ISSUE_STATUSES = ["backlog", "todo", "in_progress", "in_review", "done", "canceled", "duplicate"];
23171
+ var ISSUE_PRIORITIES = ["none", "urgent", "high", "medium", "low"];
23172
+ var ISSUE_ACTOR_TYPES = ["user", "workspace"];
23173
+ var ISSUE_SUBSCRIBER_ROLES = ["assignee", "creator", "mentioned", "manual"];
23174
+ var ISSUE_RELATION_TYPES = ["blocks", "duplicate_of"];
23175
+ var ISSUE_PULL_REQUEST_STATES = ["draft", "open", "merged", "closed"];
23176
+ var issueStatusSchema = z43.enum(ISSUE_STATUSES);
23177
+ var issuePrioritySchema = z43.enum(ISSUE_PRIORITIES);
23178
+ var issueSubscriberRoleSchema = z43.enum(ISSUE_SUBSCRIBER_ROLES);
23179
+ var issueRelationTypeSchema = z43.enum(ISSUE_RELATION_TYPES);
23180
+ var issuePullRequestStateSchema = z43.enum(ISSUE_PULL_REQUEST_STATES);
23181
+ var issueActorSchema = z43.object({
23182
+ type: z43.enum(ISSUE_ACTOR_TYPES),
23183
+ id: z43.string().toLowerCase().uuid()
23184
+ });
23185
+ var ISSUE_KEY_RE = /^[A-Z][A-Z0-9]{0,9}$/;
23186
+ var timestamp = z43.string();
23187
+ var nullableTimestamp = timestamp.nullable();
23188
+ var issueSchema2 = z43.object({
23189
+ id: z43.string().uuid(),
23190
+ organization_id: z43.string().uuid(),
23191
+ number: z43.number().int(),
23192
+ identifier: z43.string(),
23193
+ title: z43.string(),
23194
+ description: z43.string(),
23195
+ status: issueStatusSchema,
23196
+ priority: issuePrioritySchema,
23197
+ parent_id: z43.string().uuid().nullable(),
23198
+ manager_id: z43.string().uuid().nullable(),
23199
+ creator: issueActorSchema,
23200
+ /** Fractional: to move an issue between two others, send the midpoint of their sort orders. */
23201
+ sort_order: z43.number(),
23202
+ created_at: timestamp,
23203
+ updated_at: timestamp,
23204
+ completed_at: nullableTimestamp,
23205
+ canceled_at: nullableTimestamp,
23206
+ archived_at: nullableTimestamp
23207
+ });
23208
+ var issueSubscriberSchema = z43.object({
23209
+ issue_id: z43.string().uuid(),
23210
+ subscriber: issueActorSchema,
23211
+ role: issueSubscriberRoleSchema,
23212
+ created_at: timestamp
23213
+ });
23214
+ var issueRelationSchema = z43.object({
23215
+ id: z43.string().uuid(),
23216
+ type: issueRelationTypeSchema,
23217
+ issue_id: z43.string().uuid(),
23218
+ related_issue_id: z43.string().uuid(),
23219
+ created_at: timestamp
23220
+ });
23221
+ var issuePullRequestSchema = z43.object({
23222
+ id: z43.string().uuid(),
23223
+ issue_id: z43.string().uuid(),
23224
+ url: z43.string(),
23225
+ pull_request_id: z43.string().uuid().nullable(),
23226
+ title: z43.string().nullable(),
23227
+ state: issuePullRequestStateSchema,
23228
+ created_at: timestamp,
23229
+ updated_at: timestamp
23230
+ });
23231
+ var issueCommentSchema = z43.object({
23232
+ id: z43.string().uuid(),
23233
+ issue_id: z43.string().uuid(),
23234
+ author: issueActorSchema,
23235
+ body: z43.string(),
23236
+ created_at: timestamp,
23237
+ updated_at: timestamp
23238
+ });
23239
+ var change = (value) => z43.object({ from: value, to: value });
23240
+ var nullableId = z43.string().uuid().nullable();
23241
+ var ISSUE_EVENT_TYPES = [
23242
+ "created",
23243
+ "title_changed",
23244
+ "description_changed",
23245
+ "status_changed",
23246
+ "priority_changed",
23247
+ "parent_changed",
23248
+ "manager_changed",
23249
+ "sort_order_changed",
23250
+ "assignee_added",
23251
+ "assignee_removed",
23252
+ "subscriber_added",
23253
+ "subscriber_removed",
23254
+ "relation_added",
23255
+ "relation_removed",
23256
+ "pr_linked",
23257
+ "pr_unlinked",
23258
+ "pr_state_changed",
23259
+ "comment_added",
23260
+ "comment_edited",
23261
+ "comment_deleted",
23262
+ "archived",
23263
+ "restored"
23264
+ ];
23265
+ var issueEventDataSchemas = {
23266
+ created: z43.object({ issue: issueSchema2 }),
23267
+ title_changed: change(z43.string()),
23268
+ description_changed: change(z43.string()),
23269
+ status_changed: change(issueStatusSchema).extend({ completed_at: nullableTimestamp, canceled_at: nullableTimestamp }),
23270
+ priority_changed: change(issuePrioritySchema),
23271
+ parent_changed: change(nullableId),
23272
+ manager_changed: change(nullableId),
23273
+ sort_order_changed: change(z43.number()),
23274
+ /** `subscriber` is the row after the change: an unassigned principal stays subscribed with role `manual`. */
23275
+ assignee_added: z43.object({ subscriber: issueSubscriberSchema }),
23276
+ assignee_removed: z43.object({ subscriber: issueSubscriberSchema }),
23277
+ subscriber_added: z43.object({ subscriber: issueSubscriberSchema }),
23278
+ subscriber_removed: z43.object({ subscriber: issueSubscriberSchema }),
23279
+ relation_added: z43.object({ relation: issueRelationSchema }),
23280
+ relation_removed: z43.object({ relation: issueRelationSchema }),
23281
+ pr_linked: z43.object({ pull_request: issuePullRequestSchema }),
23282
+ pr_unlinked: z43.object({ pull_request: issuePullRequestSchema }),
23283
+ pr_state_changed: z43.object({ pull_request: issuePullRequestSchema, from: issuePullRequestStateSchema }),
23284
+ comment_added: z43.object({ comment: issueCommentSchema }),
23285
+ comment_edited: z43.object({ comment: issueCommentSchema, from: z43.string() }),
23286
+ comment_deleted: z43.object({ comment: issueCommentSchema }),
23287
+ archived: z43.object({ archived_at: timestamp }),
23288
+ restored: z43.object({
23289
+ issue: issueSchema2,
23290
+ subscribers: z43.array(issueSubscriberSchema),
23291
+ relations: z43.array(issueRelationSchema),
23292
+ pull_requests: z43.array(issuePullRequestSchema)
23293
+ })
23294
+ };
23295
+ var issueEventBase = z43.object({
23296
+ sync_id: z43.number().int(),
23297
+ issue_id: z43.string().uuid(),
23298
+ actor: issueActorSchema,
23299
+ /** Echo of the `client_mutation_id` sent with the write, so the writer can settle its optimistic change. */
23300
+ client_mutation_id: z43.string().nullable(),
23301
+ created_at: timestamp
23302
+ });
23303
+ var issueEventVariant = (type) => issueEventBase.extend({ type: z43.literal(type), data: issueEventDataSchemas[type] });
23304
+ var issueEventSchema = z43.discriminatedUnion("type", [issueEventVariant(ISSUE_EVENT_TYPES[0]), ...ISSUE_EVENT_TYPES.slice(1).map(issueEventVariant)]);
23305
+ var clientMutationId = z43.string().min(1).max(128).optional();
23306
+ var title2 = z43.string().trim().min(1).max(500);
23307
+ var description = z43.string().max(1e5);
23308
+ var body = z43.string().trim().min(1).max(1e5);
23309
+ var createIssueRequestSchema = z43.object({
23310
+ /** Client-generated id, so an optimistic create can be referenced before the server answers. */
23311
+ id: z43.string().uuid().optional(),
23312
+ title: title2,
23313
+ description: description.optional(),
23314
+ status: issueStatusSchema.optional(),
23315
+ priority: issuePrioritySchema.optional(),
23316
+ parent_id: z43.string().uuid().optional(),
23317
+ manager_id: z43.string().uuid().optional(),
23318
+ sort_order: z43.number().finite().optional(),
23319
+ assignees: z43.array(issueActorSchema).max(20).optional(),
23320
+ subscribers: z43.array(issueActorSchema).max(50).optional(),
23321
+ client_mutation_id: clientMutationId
23322
+ });
23323
+ var updateIssueRequestSchema = z43.object({
23324
+ title: title2.optional(),
23325
+ description: description.optional(),
23326
+ status: issueStatusSchema.optional(),
23327
+ priority: issuePrioritySchema.optional(),
23328
+ // PATCH semantics: null clears the parent or Manager, omitting it leaves it unchanged.
23329
+ parent_id: nullableId.optional(),
23330
+ manager_id: nullableId.optional(),
23331
+ sort_order: z43.number().finite().optional(),
23332
+ client_mutation_id: clientMutationId
23333
+ });
23334
+ var issueActorRequestSchema = issueActorSchema.partial().extend({ client_mutation_id: clientMutationId });
23335
+ var createIssueCommentRequestSchema = z43.object({
23336
+ id: z43.string().uuid().optional(),
23337
+ body,
23338
+ client_mutation_id: clientMutationId
23339
+ });
23340
+ var updateIssueCommentRequestSchema = z43.object({ body, client_mutation_id: clientMutationId });
23341
+ var createIssueRelationRequestSchema = z43.object({
23342
+ id: z43.string().uuid().optional(),
23343
+ type: issueRelationTypeSchema,
23344
+ related_issue: z43.string().min(1),
23345
+ client_mutation_id: clientMutationId
23346
+ });
23347
+ var linkIssuePullRequestRequestSchema = z43.object({
23348
+ id: z43.string().uuid().optional(),
23349
+ url: z43.string().url().max(2e3),
23350
+ title: z43.string().max(500).optional(),
23351
+ state: issuePullRequestStateSchema.optional(),
23352
+ pull_request_id: z43.string().uuid().optional(),
23353
+ client_mutation_id: clientMutationId
23354
+ });
23355
+ var updateIssuePullRequestRequestSchema = z43.object({
23356
+ state: issuePullRequestStateSchema,
23357
+ client_mutation_id: clientMutationId
23358
+ });
23359
+ var issueMutationRequestSchema = z43.object({ client_mutation_id: clientMutationId });
23360
+ var updateIssueSettingsRequestSchema = z43.object({ issue_key: z43.string().trim().toUpperCase().regex(ISSUE_KEY_RE) });
23361
+ var listIssuesQuerySchema = z43.object({
23362
+ status: z43.string().optional(),
23363
+ priority: z43.string().optional(),
23364
+ assignee: z43.string().optional(),
23365
+ subscriber: z43.string().optional(),
23366
+ creator: z43.string().optional(),
23367
+ manager_id: z43.string().optional(),
23368
+ parent_id: z43.string().optional(),
23369
+ q: z43.string().max(200).optional(),
23370
+ include_archived: z43.enum(["true", "false"]).optional(),
23371
+ limit: z43.coerce.number().int().min(1).max(200).optional(),
23372
+ cursor: z43.coerce.number().int().min(0).max(2147483647).optional()
23373
+ });
23374
+ var issuesDeltaQuerySchema = z43.object({
23375
+ after: z43.coerce.number().int().min(0).max(Number.MAX_SAFE_INTEGER),
23376
+ limit: z43.coerce.number().int().min(1).max(1e3).optional()
23377
+ });
23378
+
23167
23379
  // ../shared/src/routes/repo-files.ts
23168
23380
  var MAX_REPO_FILE_CONTENT_BYTES = 256 * 1024;
23169
23381
  function searchRepoFileIndex(repos, params, multiRepo) {
@@ -23309,7 +23521,7 @@ function normalizeChatTranscriptMetadata(value) {
23309
23521
  credentialSource,
23310
23522
  environmentAuthMethod,
23311
23523
  model: model2,
23312
- title: title2,
23524
+ title: title3,
23313
23525
  displayName,
23314
23526
  createdAt,
23315
23527
  updatedAt,
@@ -23331,7 +23543,7 @@ function normalizeChatTranscriptMetadata(value) {
23331
23543
  const authMethod = Object.values(CREDENTIAL_METHOD).find((method) => method === environmentAuthMethod);
23332
23544
  if (authMethod) metadata.environmentAuthMethod = authMethod;
23333
23545
  if (typeof model2 === "string") metadata.model = model2;
23334
- if (typeof title2 === "string") metadata.title = title2;
23546
+ if (typeof title3 === "string") metadata.title = title3;
23335
23547
  if (typeof displayName === "string") metadata.displayName = displayName;
23336
23548
  if (typeof createdAt === "string") metadata.createdAt = createdAt;
23337
23549
  if (typeof updatedAt === "string") metadata.updatedAt = updatedAt;
@@ -23440,40 +23652,40 @@ function isSkillRegistryManifest(value) {
23440
23652
  }
23441
23653
 
23442
23654
  // ../shared/src/routes/variable-requests.ts
23443
- import { z as z43 } from "zod";
23655
+ import { z as z44 } from "zod";
23444
23656
  var VARIABLE_REQUEST_WAIT = { defaultMs: 10 * 6e4, maxMs: 30 * 6e4, pollMs: 3e3, waiterStaleMs: 15e3 };
23445
23657
  var VARIABLE_REQUEST_DESTINATIONS = ["environment", "workspace"];
23446
- var requestedVariableSchema = z43.object({
23447
- key: z43.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(ENVIRONMENT_SETUP_LIMITS.variableKeyChars),
23448
- required: z43.boolean(),
23449
- replace: z43.boolean().optional()
23658
+ var requestedVariableSchema = z44.object({
23659
+ key: z44.string().regex(VARIABLE_KEY_RE, "must be a valid environment variable name").max(ENVIRONMENT_SETUP_LIMITS.variableKeyChars),
23660
+ required: z44.boolean(),
23661
+ replace: z44.boolean().optional()
23450
23662
  });
23451
- var requestedVariablesSchema = z43.array(requestedVariableSchema).min(1, "must not be empty").max(ENVIRONMENT_SETUP_LIMITS.variables).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys");
23452
- var createVariableRequestSchema = z43.object({
23663
+ var requestedVariablesSchema = z44.array(requestedVariableSchema).min(1, "must not be empty").max(ENVIRONMENT_SETUP_LIMITS.variables).refine((variables) => new Set(variables.map((variable) => variable.key)).size === variables.length, "must have unique keys");
23664
+ var createVariableRequestSchema = z44.object({
23453
23665
  variables: requestedVariablesSchema,
23454
- reason: z43.string().trim().max(500).nullish().transform((value) => value || null),
23455
- wait: z43.boolean().default(true)
23666
+ reason: z44.string().trim().max(500).nullish().transform((value) => value || null),
23667
+ wait: z44.boolean().default(true)
23456
23668
  });
23457
- var respondVariableRequestSchema = z43.discriminatedUnion("action", [
23458
- z43.object({
23459
- action: z43.literal("provide"),
23460
- destination: z43.enum(VARIABLE_REQUEST_DESTINATIONS),
23669
+ var respondVariableRequestSchema = z44.discriminatedUnion("action", [
23670
+ z44.object({
23671
+ action: z44.literal("provide"),
23672
+ destination: z44.enum(VARIABLE_REQUEST_DESTINATIONS),
23461
23673
  /** Defaults to the workspace's environment, so older clients keep saving there. */
23462
- environment_ids: z43.array(z43.string().uuid()).optional(),
23463
- overwrite: z43.boolean().optional(),
23464
- values: z43.record(z43.string().regex(VARIABLE_KEY_RE), z43.string())
23674
+ environment_ids: z44.array(z44.string().uuid()).optional(),
23675
+ overwrite: z44.boolean().optional(),
23676
+ values: z44.record(z44.string().regex(VARIABLE_KEY_RE), z44.string())
23465
23677
  }),
23466
- z43.object({ action: z43.literal("skip") })
23678
+ z44.object({ action: z44.literal("skip") })
23467
23679
  ]);
23468
23680
 
23469
23681
  // ../shared/src/routes/local-control-requests.ts
23470
- import { z as z44 } from "zod";
23471
- var createLocalControlRequestSchema = z44.object({
23472
- reason: z44.string().trim().max(500).optional().transform((value) => value || null),
23473
- wait: z44.boolean().default(true)
23682
+ import { z as z45 } from "zod";
23683
+ var createLocalControlRequestSchema = z45.object({
23684
+ reason: z45.string().trim().max(500).optional().transform((value) => value || null),
23685
+ wait: z45.boolean().default(true)
23474
23686
  });
23475
- var respondLocalControlRequestSchema = z44.object({ action: z44.enum(["allow", "dismiss"]) });
23476
- var setLocalControlSchema = z44.object({ enabled: z44.boolean() });
23687
+ var respondLocalControlRequestSchema = z45.object({ action: z45.enum(["allow", "dismiss"]) });
23688
+ var setLocalControlSchema = z45.object({ enabled: z45.boolean() });
23477
23689
 
23478
23690
  export {
23479
23691
  ENGINE_SEND_MESSAGE_FAILED_ERROR,