@link-assistant/agent 0.1.3 → 0.1.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/agent",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "A minimal, public domain AI CLI agent compatible with OpenCode's JSON interface. Bun-only runtime.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -704,7 +704,30 @@ export namespace SessionPrompt {
704
704
  // When --system-message is provided, use it exclusively without any
705
705
  // additional context (no environment, no custom instructions, no header).
706
706
  // This is critical for models with low token limits (e.g., qwen3-32b with 6K TPM).
707
+ //
708
+ // Exception: For Anthropic providers using OAuth credentials, we must preserve
709
+ // the "You are Claude Code" header when the system message doesn't contain it.
710
+ // This header is required for OAuth token authorization.
711
+ // See: https://github.com/link-assistant/agent/issues/62
707
712
  if (input.system !== undefined) {
713
+ // Filter out empty strings to prevent cache_control errors
714
+ if (input.system.trim() === '') {
715
+ // For Anthropic providers with empty system message, preserve the OAuth header
716
+ if (input.providerID.includes('anthropic')) {
717
+ return SystemPrompt.header(input.providerID);
718
+ }
719
+ return [];
720
+ }
721
+
722
+ // For Anthropic providers, ensure "Claude Code" header is present
723
+ if (input.providerID.includes('anthropic')) {
724
+ const hasClaudeCode = input.system.includes('Claude Code');
725
+ if (!hasClaudeCode) {
726
+ // Prepend the OAuth header if not present
727
+ return [...SystemPrompt.header(input.providerID), input.system];
728
+ }
729
+ }
730
+
708
731
  return [input.system];
709
732
  }
710
733