@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 +1 -1
- package/src/session/prompt.ts +23 -0
package/package.json
CHANGED
package/src/session/prompt.ts
CHANGED
|
@@ -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
|
|