@dreb/coding-agent 2.12.1 → 2.13.0
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/dist/core/agent-session.d.ts +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +9 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/git-repo-state.d.ts +19 -0
- package/dist/core/git-repo-state.d.ts.map +1 -0
- package/dist/core/git-repo-state.js +85 -0
- package/dist/core/git-repo-state.js.map +1 -0
- package/dist/core/system-prompt.d.ts +3 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +33 -0
- package/dist/core/system-prompt.js.map +1 -1
- package/package.json +1 -1
|
@@ -25,6 +25,7 @@ import { exportSessionToHtml } from "./export-html/index.js";
|
|
|
25
25
|
import { createToolHtmlRenderer } from "./export-html/tool-renderer.js";
|
|
26
26
|
import { ExtensionRunner, wrapRegisteredTools, } from "./extensions/index.js";
|
|
27
27
|
import { checkScriptContent, extractScriptPaths, isForbiddenCommand } from "./forbidden-commands.js";
|
|
28
|
+
import { getGitRepoState } from "./git-repo-state.js";
|
|
28
29
|
import { expandPromptTemplate } from "./prompt-templates.js";
|
|
29
30
|
import { scrubSecrets } from "./secret-scrubber.js";
|
|
30
31
|
import { isSensitivePath } from "./sensitive-paths.js";
|
|
@@ -124,6 +125,8 @@ export class AgentSession {
|
|
|
124
125
|
// Base system prompt (without extension appends) - used to apply fresh appends each turn
|
|
125
126
|
_baseSystemPrompt = "";
|
|
126
127
|
_uiType;
|
|
128
|
+
// Git repo state captured once at session start
|
|
129
|
+
_gitRepoState;
|
|
127
130
|
constructor(config) {
|
|
128
131
|
this.agent = config.agent;
|
|
129
132
|
this.sessionManager = config.sessionManager;
|
|
@@ -137,6 +140,8 @@ export class AgentSession {
|
|
|
137
140
|
this._initialActiveToolNames = config.initialActiveToolNames;
|
|
138
141
|
this._baseToolsOverride = config.baseToolsOverride;
|
|
139
142
|
this._uiType = config.uiType;
|
|
143
|
+
// Capture git repo state once at session start (before building runtime/system prompt)
|
|
144
|
+
this._gitRepoState = getGitRepoState(this._cwd) ?? undefined;
|
|
140
145
|
// Always subscribe to agent events for internal handling
|
|
141
146
|
// (session persistence, extensions, auto-compaction, retry logic)
|
|
142
147
|
this._unsubscribeAgent = this.agent.subscribe(this._handleAgentEvent);
|
|
@@ -958,6 +963,7 @@ export class AgentSession {
|
|
|
958
963
|
toolSnippets,
|
|
959
964
|
promptGuidelines,
|
|
960
965
|
uiType: this._uiType,
|
|
966
|
+
gitRepoState: this._gitRepoState,
|
|
961
967
|
});
|
|
962
968
|
}
|
|
963
969
|
// =========================================================================
|
|
@@ -2562,6 +2568,9 @@ export class AgentSession {
|
|
|
2562
2568
|
this.agent.setThinkingLevel(effectiveLevel);
|
|
2563
2569
|
this.sessionManager.appendThinkingLevelChange(effectiveLevel);
|
|
2564
2570
|
}
|
|
2571
|
+
// Refresh git state for the resumed session
|
|
2572
|
+
this._gitRepoState = getGitRepoState(this._cwd) ?? undefined;
|
|
2573
|
+
this._baseSystemPrompt = this._rebuildSystemPrompt(this.getActiveToolNames());
|
|
2565
2574
|
this._reconnectToAgent();
|
|
2566
2575
|
return true;
|
|
2567
2576
|
}
|