@dreb/coding-agent 2.60.0 → 2.60.1
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/README.md +1 -1
- package/dist/core/agent-session.d.ts +2 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +25 -6
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/model-registry.d.ts +4 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +74 -3
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/settings-manager.d.ts +1 -4
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/docs/models.md +26 -8
- package/docs/settings.md +11 -3
- package/package.json +1 -1
|
@@ -1217,6 +1217,17 @@ export class AgentSession {
|
|
|
1217
1217
|
_getFilteredSkills() {
|
|
1218
1218
|
return this.getFilteredSkills();
|
|
1219
1219
|
}
|
|
1220
|
+
_resolveModelPromptSettings(model) {
|
|
1221
|
+
if (!model)
|
|
1222
|
+
return undefined;
|
|
1223
|
+
const modelRef = `${model.provider}/${model.id}`;
|
|
1224
|
+
const modelsJsonSettings = this._modelRegistry.getModelPromptSettings(model.provider, model.id);
|
|
1225
|
+
const settingsJsonSettings = this.settingsManager.getModelPromptSettings(model.provider, model.id);
|
|
1226
|
+
if (modelsJsonSettings && settingsJsonSettings) {
|
|
1227
|
+
throw new Error(`System prompt behavior for ${modelRef} is configured in both models.json and settings.json; remove one source`);
|
|
1228
|
+
}
|
|
1229
|
+
return modelsJsonSettings ?? settingsJsonSettings;
|
|
1230
|
+
}
|
|
1220
1231
|
_rebuildSystemPrompt(toolNames) {
|
|
1221
1232
|
const validToolNames = toolNames.filter((name) => this._toolRegistry.has(name));
|
|
1222
1233
|
const toolSnippets = {};
|
|
@@ -1233,9 +1244,7 @@ export class AgentSession {
|
|
|
1233
1244
|
}
|
|
1234
1245
|
const loaderSystemPrompt = this._resourceLoader.getSystemPrompt();
|
|
1235
1246
|
const loaderAppendSystemPrompt = this._resourceLoader.getAppendSystemPrompt();
|
|
1236
|
-
const modelPromptSettings = this.model
|
|
1237
|
-
? this.settingsManager.getModelPromptSettings(this.model.provider, this.model.id)
|
|
1238
|
-
: undefined;
|
|
1247
|
+
const modelPromptSettings = this._resolveModelPromptSettings(this.model);
|
|
1239
1248
|
const customPrompt = loaderSystemPrompt ?? modelPromptSettings?.systemPrompt;
|
|
1240
1249
|
const appendPromptParts = [...loaderAppendSystemPrompt];
|
|
1241
1250
|
if (modelPromptSettings?.appendSystemPrompt) {
|
|
@@ -1753,9 +1762,9 @@ export class AgentSession {
|
|
|
1753
1762
|
_refreshThinkingDisplay(model) {
|
|
1754
1763
|
this.agent.thinkingDisplay = resolveThinkingDisplay(model, this.settingsManager.getModelThinkingDisplay(model.id));
|
|
1755
1764
|
}
|
|
1756
|
-
/** Reject malformed target-model prompt settings before
|
|
1765
|
+
/** Reject malformed or conflicting target-model prompt settings before mutating session state. */
|
|
1757
1766
|
_validateModelPromptSettings(model) {
|
|
1758
|
-
this.
|
|
1767
|
+
this._resolveModelPromptSettings(model);
|
|
1759
1768
|
}
|
|
1760
1769
|
/**
|
|
1761
1770
|
* Cycle to next/previous model.
|
|
@@ -2720,9 +2729,19 @@ export class AgentSession {
|
|
|
2720
2729
|
});
|
|
2721
2730
|
}
|
|
2722
2731
|
async reload() {
|
|
2732
|
+
// Refresh and validate prompt configuration before tearing down the active runtime.
|
|
2733
|
+
// A bad external edit must leave the current prompt and extension runtime usable.
|
|
2734
|
+
this.settingsManager.reload();
|
|
2735
|
+
this._modelRegistry.refresh();
|
|
2736
|
+
const modelRegistryError = this._modelRegistry.getError();
|
|
2737
|
+
if (modelRegistryError) {
|
|
2738
|
+
throw new Error(modelRegistryError);
|
|
2739
|
+
}
|
|
2740
|
+
if (this.model) {
|
|
2741
|
+
this._validateModelPromptSettings(this.model);
|
|
2742
|
+
}
|
|
2723
2743
|
const previousFlagValues = this._extensionRunner?.getFlagValues();
|
|
2724
2744
|
await this._extensionRunner?.emit({ type: "session_shutdown" });
|
|
2725
|
-
this.settingsManager.reload();
|
|
2726
2745
|
resetApiProviders();
|
|
2727
2746
|
await this._resourceLoader.reload();
|
|
2728
2747
|
this._buildRuntime({
|