@caupulican/pi-adaptative 0.80.29 → 0.80.31

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.
@@ -15,6 +15,7 @@
15
15
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
16
16
  import { basename, dirname, join } from "node:path";
17
17
  import { clampThinkingLevel, cleanupSessionResources, getSupportedThinkingLevels, isContextOverflow, modelsAreEqual, resetApiProviders, streamSimple, } from "@caupulican/pi-ai";
18
+ import { getAgentDir } from "../config.js";
18
19
  import { theme } from "../modes/interactive/theme/theme.js";
19
20
  import { stripFrontmatter } from "../utils/frontmatter.js";
20
21
  import { resolvePath } from "../utils/paths.js";
@@ -100,6 +101,7 @@ export class AgentSession {
100
101
  _customTools;
101
102
  _baseToolDefinitions = new Map();
102
103
  _cwd;
104
+ _agentDir;
103
105
  _extensionRunnerRef;
104
106
  _initialActiveToolNames;
105
107
  _allowedToolNames;
@@ -132,6 +134,7 @@ export class AgentSession {
132
134
  this._resourceLoader = config.resourceLoader;
133
135
  this._customTools = config.customTools ?? [];
134
136
  this._cwd = config.cwd;
137
+ this._agentDir = config.agentDir ?? getAgentDir();
135
138
  this._modelRegistry = config.modelRegistry;
136
139
  this._extensionRunnerRef = config.extensionRunnerRef;
137
140
  this._initialActiveToolNames = config.initialActiveToolNames;
@@ -247,7 +250,7 @@ export class AgentSession {
247
250
  };
248
251
  }
249
252
  _contextGcStorageDir() {
250
- return join(this.sessionManager.getSessionDir(), "context-gc", this.sessionManager.getSessionId());
253
+ return join(this._agentDir, "context-gc", this.sessionManager.getSessionId());
251
254
  }
252
255
  _applyContextGc(messages, writePayloads) {
253
256
  try {