@caupulican/pi-adaptative 0.78.3 → 0.79.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/CHANGELOG.md +17 -0
- package/README.md +4 -4
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +16 -13
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +20 -10
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/settings-manager.d.ts +2 -2
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +16 -2
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +8 -12
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +8 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +13 -2
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +346 -1
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +24 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +419 -2
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/extensions.md +2 -2
- package/docs/quickstart.md +4 -4
- package/docs/sdk.md +3 -3
- package/docs/settings.md +4 -0
- package/docs/usage.md +5 -5
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/sdk/07-context-files.ts +2 -2
- package/npm-shrinkwrap.json +15 -18
- package/package.json +4 -4
|
@@ -183,26 +183,29 @@ export class AgentSession {
|
|
|
183
183
|
this.agent.transformContext = async (messages, signal) => {
|
|
184
184
|
const transformed = previousTransformContext ? await previousTransformContext(messages, signal) : messages;
|
|
185
185
|
const authoritativeMessages = this.agent.state.messages.length > 0 ? this.agent.state.messages : transformed;
|
|
186
|
+
let currentMessages = authoritativeMessages;
|
|
186
187
|
try {
|
|
187
188
|
const settings = this.settingsManager.getCompactionSettings();
|
|
188
189
|
const contextWindow = this.model?.contextWindow ?? 0;
|
|
189
|
-
if (
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
190
|
+
if (settings.enabled && contextWindow > 0 && !this.isCompacting) {
|
|
191
|
+
const contextTokens = this._estimateCurrentContextTokens(authoritativeMessages);
|
|
192
|
+
if (shouldCompact(contextTokens, contextWindow, settings)) {
|
|
193
|
+
const latestBefore = getLatestCompactionEntry(this.sessionManager.getBranch())?.id;
|
|
194
|
+
await this._runAutoCompaction("threshold", false);
|
|
195
|
+
const latestAfter = getLatestCompactionEntry(this.sessionManager.getBranch())?.id;
|
|
196
|
+
if (latestAfter && latestAfter !== latestBefore) {
|
|
197
|
+
currentMessages = this.agent.state.messages.slice();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
195
200
|
}
|
|
196
|
-
const latestBefore = getLatestCompactionEntry(this.sessionManager.getBranch())?.id;
|
|
197
|
-
await this._runAutoCompaction("threshold", false);
|
|
198
|
-
const latestAfter = getLatestCompactionEntry(this.sessionManager.getBranch())?.id;
|
|
199
|
-
return latestAfter && latestAfter !== latestBefore
|
|
200
|
-
? this.agent.state.messages.slice()
|
|
201
|
-
: authoritativeMessages;
|
|
202
201
|
}
|
|
203
202
|
catch {
|
|
204
|
-
|
|
203
|
+
currentMessages = authoritativeMessages;
|
|
204
|
+
}
|
|
205
|
+
if (this._extensionRunner.hasHandlers("context")) {
|
|
206
|
+
return await this._extensionRunner.emitContext(currentMessages);
|
|
205
207
|
}
|
|
208
|
+
return currentMessages;
|
|
206
209
|
};
|
|
207
210
|
}
|
|
208
211
|
_installAgentTurnRefresh() {
|