codex-relay 1.4.11 → 1.4.12

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/src.js +15 -3
  2. package/package.json +1 -1
package/dist/src.js CHANGED
@@ -4636,7 +4636,7 @@ function appServerUserMessageText(item) {
4636
4636
  const skills = appServerUserMessageSkills(item);
4637
4637
  return promptMarkdownWithSkills(promptWithAppServerImageReferences(item.content.map((content) => {
4638
4638
  switch (content.type) {
4639
- case "text": return content.text;
4639
+ case "text": return isCodexInjectedContextBlock(content.text) ? "" : content.text;
4640
4640
  case "image":
4641
4641
  case "localImage":
4642
4642
  case "document":
@@ -4647,6 +4647,15 @@ function appServerUserMessageText(item) {
4647
4647
  }
4648
4648
  }).filter(Boolean).join("\n\n"), item.content), skills);
4649
4649
  }
4650
+ function isAppServerInjectedContextMessage(item) {
4651
+ if (item.type !== "userMessage" || !("content" in item) || !Array.isArray(item.content)) return false;
4652
+ const content = item.content;
4653
+ return content.length > 0 && content.every((input) => input.type === "text" && isCodexInjectedContextBlock(input.text));
4654
+ }
4655
+ function isCodexInjectedContextBlock(value) {
4656
+ const text = value.trim();
4657
+ return text.startsWith("<recommended_plugins>") && text.endsWith("</recommended_plugins>") || text.startsWith("# AGENTS.md instructions for ") && text.includes("\n\n<INSTRUCTIONS>") && text.endsWith("</INSTRUCTIONS>") || text.startsWith("<environment_context>") && text.endsWith("</environment_context>");
4658
+ }
4650
4659
  function appServerUserMessageDetails(item) {
4651
4660
  const attachments = item.content.flatMap((content) => {
4652
4661
  switch (content.type) {
@@ -5696,7 +5705,9 @@ function rolloutResponseItemMessageContent(payload, role) {
5696
5705
  const text = payload.content.flatMap((item) => {
5697
5706
  if (!item || typeof item !== "object") return [];
5698
5707
  const contentItem = item;
5699
- return contentItem.type === expectedType && typeof contentItem.text === "string" ? [contentItem.text] : [];
5708
+ if (contentItem.type !== expectedType || typeof contentItem.text !== "string") return [];
5709
+ if (role === "user" && isCodexInjectedContextBlock(contentItem.text)) return [];
5710
+ return [contentItem.text];
5700
5711
  });
5701
5712
  return text.length > 0 ? text.join("\n\n") : void 0;
5702
5713
  }
@@ -5913,6 +5924,7 @@ function mapAppServerItem(threadId, turn, item) {
5913
5924
  };
5914
5925
  switch (item.type) {
5915
5926
  case "userMessage": {
5927
+ if (isAppServerInjectedContextMessage(item)) return;
5916
5928
  const userItem = item;
5917
5929
  return ChatMessageSchema.parse({
5918
5930
  ...base,
@@ -6248,7 +6260,7 @@ function normalizeAppServerStatus(status) {
6248
6260
  return status.toLowerCase().replace(/[^a-z0-9]/g, "");
6249
6261
  }
6250
6262
  function countThreadMessages(thread) {
6251
- return thread.turns?.reduce((count, turn) => count + turn.items.filter((item) => item.type === "userMessage" || item.type === "agentMessage").length, 0) ?? 0;
6263
+ return thread.turns?.reduce((count, turn) => count + turn.items.filter((item) => item.type === "agentMessage" || item.type === "userMessage" && !isAppServerInjectedContextMessage(item)).length, 0) ?? 0;
6252
6264
  }
6253
6265
  function fromUnixSeconds(value) {
6254
6266
  return (/* @__PURE__ */ new Date(value * 1e3)).toISOString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-relay",
3
- "version": "1.4.11",
3
+ "version": "1.4.12",
4
4
  "description": "Local Codex Relay CLI bridge for the Codex Relay mobile app.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {