@compilr-dev/sdk 0.10.29 → 0.10.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.
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Shared delegation defaults for tool result auto-summarization.
3
+ *
4
+ * `DelegationConfig` controls when large tool results get summarized
5
+ * by a delegate agent (instead of being inlined into the conversation
6
+ * context) — a per-turn token economy win that the agents library wires
7
+ * via the AfterToolHook.
8
+ *
9
+ * Each host (CLI, Desktop) used to keep its own copy of this config.
10
+ * The two had drifted: identical baselines (8000 default threshold etc.)
11
+ * but diverged tool overrides — Desktop had 6 extra tools tuned
12
+ * (run_tests, run_lint, run_build, web_fetch, artifact_get,
13
+ * find_references, propose_alternatives) plus a tighter `git_diff`
14
+ * threshold (4000 vs CLI's 6000). The baseline below converges to
15
+ * Desktop's set since it's the more recently tuned version, and hosts
16
+ * spread + override per-tool as needed.
17
+ *
18
+ * Audit ref: TODO-13.
19
+ */
20
+ import type { DelegationConfig } from '@compilr-dev/agents';
21
+ export declare const DEFAULT_DELEGATION_CONFIG: DelegationConfig;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Shared delegation defaults for tool result auto-summarization.
3
+ *
4
+ * `DelegationConfig` controls when large tool results get summarized
5
+ * by a delegate agent (instead of being inlined into the conversation
6
+ * context) — a per-turn token economy win that the agents library wires
7
+ * via the AfterToolHook.
8
+ *
9
+ * Each host (CLI, Desktop) used to keep its own copy of this config.
10
+ * The two had drifted: identical baselines (8000 default threshold etc.)
11
+ * but diverged tool overrides — Desktop had 6 extra tools tuned
12
+ * (run_tests, run_lint, run_build, web_fetch, artifact_get,
13
+ * find_references, propose_alternatives) plus a tighter `git_diff`
14
+ * threshold (4000 vs CLI's 6000). The baseline below converges to
15
+ * Desktop's set since it's the more recently tuned version, and hosts
16
+ * spread + override per-tool as needed.
17
+ *
18
+ * Audit ref: TODO-13.
19
+ */
20
+ export const DEFAULT_DELEGATION_CONFIG = {
21
+ enabled: true,
22
+ delegationThreshold: 8000,
23
+ summaryMaxTokens: 800,
24
+ resultTTL: 600_000,
25
+ maxStoredResults: 50,
26
+ strategy: 'auto',
27
+ toolOverrides: {
28
+ // Bash often produces large output; allow a higher inline budget
29
+ // before summarising.
30
+ bash: { threshold: 12000 },
31
+ grep: { threshold: 4000 },
32
+ // Large-output tools — tighter thresholds for earlier summarisation
33
+ git_diff: { threshold: 4000 },
34
+ run_tests: { threshold: 6000 },
35
+ run_lint: { threshold: 4000 },
36
+ run_build: { threshold: 6000 },
37
+ web_fetch: { threshold: 6000 },
38
+ artifact_get: { threshold: 6000 },
39
+ find_references: { threshold: 4000 },
40
+ // Disable delegation on small / interactive / read-only tools where
41
+ // the round-trip cost would exceed the saving.
42
+ get_tool_info: { enabled: false },
43
+ list_tools: { enabled: false },
44
+ ask_user: { enabled: false },
45
+ ask_user_simple: { enabled: false },
46
+ propose_alternatives: { enabled: false },
47
+ todo_read: { enabled: false },
48
+ },
49
+ };
package/dist/index.d.ts CHANGED
@@ -81,6 +81,7 @@ export { defineTool, createSuccessResult, createErrorResult, mergeHooks, createL
81
81
  export type { Tool, HooksConfig, AgentEvent, Message, LLMProvider, AnchorInput, ToolExecutionResult, AgentRunResult, PermissionHandler, PermissionHandlerResponse, ToolPermission, AgentTypeConfig, GuardrailTriggeredHandler, BeforeLLMHookResult, BeforeToolHook, BeforeToolHookResult, AfterToolHook, AgentState, AgentConfig, SessionInfo, Anchor, AnchorScope, AnchorClearOptions, AnchorPriority, AnchorQueryOptions, FileAccessType, FileAccess, GuardrailResult, GuardrailContext, MCPClient, MCPToolDefinition, } from '@compilr-dev/agents';
82
82
  export { DEFAULT_PERMISSION_RULES, findMatchingRule, permissionModeLabel, permissionLevelLabel, } from './permissions.js';
83
83
  export type { PermissionRule, PermissionMode, PermissionLevel } from './permissions.js';
84
+ export { DEFAULT_DELEGATION_CONFIG } from './delegation.js';
84
85
  export { readMCPConfigFile, writeMCPConfigFile, resolveServerEntry, loadMCPServers, saveMCPServerEntry, deleteMCPServerEntry, getServerNames, } from './mcp-config.js';
85
86
  export type { MCPServerEntry, MCPConfigFile, ResolvedMCPServer } from './mcp-config.js';
86
87
  export { generateProject, isGitConfigured, generateCompilrMd, generateConfigJson, generateReadmeMd, generateCodingStandardsMd, generatePackageJson, generateTsconfig, generateGitignore, generateCompilrMdForImport, detectProjectInfo, detectGitInfo, prettifyName, getLanguageLabel, getFrameworkLabel, validateImportPath, isValidProjectName, projectExists, TECH_STACK_LABELS, CODING_STANDARDS_LABELS, REPO_PATTERN_LABELS, WORKFLOW_VERSION, } from './project-generator/index.js';
package/dist/index.js CHANGED
@@ -198,6 +198,10 @@ AgentError, ProviderError, ToolError, ToolTimeoutError, MaxIterationsError, Abor
198
198
  // =============================================================================
199
199
  export { DEFAULT_PERMISSION_RULES, findMatchingRule, permissionModeLabel, permissionLevelLabel, } from './permissions.js';
200
200
  // =============================================================================
201
+ // Shared Delegation Config Defaults
202
+ // =============================================================================
203
+ export { DEFAULT_DELEGATION_CONFIG } from './delegation.js';
204
+ // =============================================================================
201
205
  // Shared MCP Configuration
202
206
  // =============================================================================
203
207
  export { readMCPConfigFile, writeMCPConfigFile, resolveServerEntry, loadMCPServers, saveMCPServerEntry, deleteMCPServerEntry, getServerNames, } from './mcp-config.js';
@@ -1,7 +1,12 @@
1
1
  /**
2
2
  * Coding preset — batteries-included for software development
3
3
  */
4
- import { readFileTool, writeFileTool, editTool, bashTool, bashOutputTool, killShellTool, grepTool, globTool, createTodoTools, getDefaultTodoStore, webFetchTool, suggestTool, } from '@compilr-dev/agents';
4
+ import { readFileTool, writeFileTool, editTool, createBashTool, bashOutputTool, killShellTool, grepTool, globTool, createTodoTools, getDefaultTodoStore, webFetchTool, suggestTool, } from '@compilr-dev/agents';
5
+ // 120s default — long-running coding commands (npm run build, pytest -k …,
6
+ // large test suites, factory scaffolds) frequently exceed the agents-library
7
+ // default of 60s. Audit TODO-2 fix: applied at the preset layer so both CLI
8
+ // and Desktop inherit the same value without each host having to override.
9
+ const bashTool = createBashTool({ timeout: 120000 });
5
10
  import { allCodingTools, unifiedTools, ts, python, go } from '@compilr-dev/agents-coding';
6
11
  import { createLenientTodoWriteTool, createLenientTodoClaimTool, createLenientTodoHandoffTool, } from './lenient-todo.js';
7
12
  const CODING_SYSTEM_PROMPT = `You are a skilled software engineer. You help users with coding tasks including:
@@ -5,7 +5,9 @@
5
5
  * The project-type-specific identity comes from the systemPromptSection
6
6
  * in the ProjectTypeConfig, not from the preset.
7
7
  */
8
- import { readFileTool, writeFileTool, editTool, bashTool, bashOutputTool, killShellTool, grepTool, globTool, createTodoTools, getDefaultTodoStore, webFetchTool, suggestTool, } from '@compilr-dev/agents';
8
+ import { readFileTool, writeFileTool, editTool, createBashTool, bashOutputTool, killShellTool, grepTool, globTool, createTodoTools, getDefaultTodoStore, webFetchTool, suggestTool, } from '@compilr-dev/agents';
9
+ // 120s default — see coding preset for full rationale (audit TODO-2).
10
+ const bashTool = createBashTool({ timeout: 120000 });
9
11
  import { createLenientTodoWriteTool, createLenientTodoClaimTool, createLenientTodoHandoffTool, } from './lenient-todo.js';
10
12
  const GENERAL_SYSTEM_PROMPT = `You are a versatile AI assistant. You adapt your approach to the user's needs and project context.
11
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.10.29",
3
+ "version": "0.10.31",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",