feat(agent): auto-enable GLM-4.7 thinking mode
Add automatic thinking mode support for Z.AI GLM-4.x models:
- GLM-4.7: Preserved thinking (clear_thinking: false)
- GLM-4.5/4.6: Interleaved thinking (clear_thinking: true)
Uses Z.AI Cloud API format: thinking: { type: "enabled", clear_thinking: boolean }
Includes patches for pi-ai, pi-agent-core, and pi-coding-agent to pass
extraParams through the stream pipeline. User can override via config
or disable via --thinking off.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Peter Steinberger
parent
3f93781b4b
commit
f7b32195cb
28
patches/@mariozechner__pi-coding-agent.patch
Normal file
28
patches/@mariozechner__pi-coding-agent.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
diff --git a/dist/core/sdk.js b/dist/core/sdk.js
|
||||
index 0000000..1111111 100644
|
||||
--- a/dist/core/sdk.js
|
||||
+++ b/dist/core/sdk.js
|
||||
@@ -441,6 +441,8 @@ export async function createAgentSession(options = {}) {
|
||||
}
|
||||
return key;
|
||||
},
|
||||
+ // PATCH: Pass extraParams through for provider-specific features (e.g., GLM-4.7 thinking mode)
|
||||
+ extraParams: options.extraParams,
|
||||
});
|
||||
time("createAgent");
|
||||
// Restore messages if session has existing data
|
||||
diff --git a/dist/core/sdk.d.ts b/dist/core/sdk.d.ts
|
||||
index 0000000..1111111 100644
|
||||
--- a/dist/core/sdk.d.ts
|
||||
+++ b/dist/core/sdk.d.ts
|
||||
@@ -79,6 +79,10 @@ export interface CreateAgentSessionOptions {
|
||||
sessionManager?: SessionManager;
|
||||
/** Settings manager. Default: SettingsManager.create(cwd, agentDir) */
|
||||
settingsManager?: SettingsManager;
|
||||
+ /**
|
||||
+ * Extra params to pass to the provider API (e.g., Z.AI GLM thinking mode params).
|
||||
+ */
|
||||
+ extraParams?: Record<string, unknown>;
|
||||
}
|
||||
/** Result from createAgentSession */
|
||||
export interface CreateAgentSessionResult {
|
||||
Reference in New Issue
Block a user