@iinm/plain-agent
Advanced tools
+1
-1
| { | ||
| "name": "@iinm/plain-agent", | ||
| "version": "1.14.2", | ||
| "version": "1.14.3", | ||
| "description": "A lightweight terminal-based coding agent focused on safety and low token cost", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
+17
-1
| # Plain Agent | ||
| [](https://github.com/iinm/plain-agent/actions/workflows/github-code-scanning/codeql) | ||
| [](https://socket.dev/npm/package/@iinm/plain-agent) | ||
| [](https://socket.dev/npm/package/@iinm/plain-agent) | ||
| [](https://packagephobia.com/result?p=@iinm/plain-agent) | ||
@@ -458,2 +458,10 @@ | ||
| } | ||
| }, | ||
| // Required for soft limit (auto-compact) to work | ||
| "autoCompact": { | ||
| "inputTokensKeys": [ | ||
| "input_tokens", | ||
| "cache_read_input_tokens", | ||
| "cache_creation_input_tokens" | ||
| ] | ||
| } | ||
@@ -486,2 +494,10 @@ }, | ||
| } | ||
| }, | ||
| // Required for soft limit (auto-compact) to work | ||
| "autoCompact": { | ||
| "inputTokensKeys": [ | ||
| "input_tokens", | ||
| "cache_read_input_tokens", | ||
| "cache_creation_input_tokens" | ||
| ] | ||
| } | ||
@@ -488,0 +504,0 @@ } |
+14
-0
@@ -238,2 +238,16 @@ /** | ||
| /** | ||
| * Check whether auto-compact is effectively disabled because the model | ||
| * definition lacks `autoCompact.inputTokensKeys`. | ||
| * | ||
| * @param {number | undefined} contextSoftLimit | ||
| * @param {string[] | undefined} inputTokensKeys | ||
| * @returns {boolean} | ||
| */ | ||
| export function isAutoCompactMisconfigured(contextSoftLimit, inputTokensKeys) { | ||
| return Boolean( | ||
| contextSoftLimit && (!inputTokensKeys || inputTokensKeys.length === 0), | ||
| ); | ||
| } | ||
| /** | ||
| * Resolve the effective context soft limit for the given model. | ||
@@ -240,0 +254,0 @@ * |
+16
-2
@@ -19,3 +19,7 @@ /** | ||
| import { runTestApprovalCommand } from "./cli/testApproval.mjs"; | ||
| import { loadAppConfig, resolveContextSoftLimit } from "./config.mjs"; | ||
| import { | ||
| isAutoCompactMisconfigured, | ||
| loadAppConfig, | ||
| resolveContextSoftLimit, | ||
| } from "./config.mjs"; | ||
| import { loadAgentRoles } from "./context/loadAgentRoles.mjs"; | ||
@@ -438,2 +442,12 @@ import { loadPrompts } from "./context/loadPrompts.mjs"; | ||
| const inputTokensKeys = modelDef.autoCompact?.inputTokensKeys; | ||
| if (isAutoCompactMisconfigured(contextSoftLimit, inputTokensKeys)) { | ||
| console.error( | ||
| styleText( | ||
| "yellow", | ||
| `⚠️ autoCompact.softLimit is set but model "${modelNameWithVariant}" has no autoCompact.inputTokensKeys.`, | ||
| ), | ||
| ); | ||
| } | ||
| const { userEventEmitter, agentEventEmitter, agentCommands } = createAgent({ | ||
@@ -454,3 +468,3 @@ callModel: agentCallModel, | ||
| contextSoftLimit, | ||
| inputTokensKeys: modelDef.autoCompact?.inputTokensKeys, | ||
| inputTokensKeys, | ||
| }); | ||
@@ -457,0 +471,0 @@ |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
581498
0.21%16353
0.16%1044
1.56%43
-2.27%