@magpie-community/opencode-factory-auth 0.1.13 → 0.1.14

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/index.mjs +15 -1
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -742,6 +742,20 @@ function anthropicBody(body) {
742
742
  }
743
743
  continue
744
744
  }
745
+ // Claude Code 2.1.288 also sends the same context as an array of text
746
+ // blocks (#658): each text block is adapted as the string would be,
747
+ // the blocks' other fields and any other block left as they are.
748
+ if (message?.role === "system" && Array.isArray(message.content)) {
749
+ for (const block of message.content) {
750
+ if (block?.type !== "text" || typeof block.text !== "string") continue
751
+ const adapted = systemContext(block.text)
752
+ if (adapted !== block.text) {
753
+ block.text = adapted
754
+ changed = true
755
+ }
756
+ }
757
+ continue
758
+ }
745
759
  if (message?.role !== "user" || !Array.isArray(message.content)) continue
746
760
  for (const block of message.content) {
747
761
  if (block?.type === "tool_result") {
@@ -767,7 +781,7 @@ function anthropicBody(body) {
767
781
  if (block.text.startsWith(INSTRUCTIONS_REMINDER) && block.text.includes(GLOBAL_INSTRUCTIONS)) {
768
782
  block.text = block.text.replaceAll(GLOBAL_INSTRUCTIONS, "(global instructions)")
769
783
  changed = true
770
- } else if (HOOK_OUTPUT.test(block.text)) {
784
+ } else if (HOOK_OUTPUT.test(block.text) || SYSTEM_ENV_CONTEXT.test(block.text)) {
771
785
  // a system message folded into the user's turn on its way here
772
786
  const adapted = systemContext(block.text)
773
787
  if (adapted !== block.text) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-factory-auth",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Sign in to a Factory (Droid) subscription from OpenCode or magpie",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",