@compilr-dev/sdk 0.10.23 → 0.10.25

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/index.d.ts CHANGED
@@ -85,7 +85,7 @@ export { readMCPConfigFile, writeMCPConfigFile, resolveServerEntry, loadMCPServe
85
85
  export type { MCPServerEntry, MCPConfigFile, ResolvedMCPServer } from './mcp-config.js';
86
86
  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';
87
87
  export type { TechStack, CodingStandards, GeneratorRepoPattern, ProjectConfig, GenerationResult, CompilrConfig, DetectedProject, GitInfo, ImportProjectConfig, } from './project-generator/index.js';
88
- export { readFileTool, writeFileTool, createBashTool, bashTool, bashOutputTool, killShellTool, grepTool, globTool, editTool, todoWriteTool, todoReadTool, createTodoTools, TodoStore, webFetchTool, suggestTool, } from '@compilr-dev/agents';
88
+ export { readFileTool, writeFileTool, createBashTool, bashTool, bashOutputTool, killShellTool, grepTool, globTool, editTool, todoWriteTool, todoReadTool, createTodoTools, getDefaultTodoStore, TodoStore, webFetchTool, suggestTool, } from '@compilr-dev/agents';
89
89
  export { gitStatusTool, gitDiffTool, gitLogTool, gitCommitTool, gitBranchTool, gitStashTool, gitBlameTool, gitFileHistoryTool, detectProjectTool, findProjectRootTool, runTestsTool, runLintTool, runBuildTool, runFormatTool, findDefinitionTool, findReferencesTool, findTodosTool, checkOutdatedTool, findVulnerabilitiesTool, analyzeTestCoverageTool, getFileStructureTool, getComplexityTool, allCodingTools, unifiedTools, } from '@compilr-dev/agents-coding';
90
90
  export { createLogger, createSilentLogger } from '@compilr-dev/logger';
91
91
  export type { Logger, LoggerOptions, LogLevel } from '@compilr-dev/logger';
package/dist/index.js CHANGED
@@ -217,7 +217,7 @@ TECH_STACK_LABELS, CODING_STANDARDS_LABELS, REPO_PATTERN_LABELS, WORKFLOW_VERSIO
217
217
  // Individual Tool Re-exports (for consumers that build custom tool registries)
218
218
  // =============================================================================
219
219
  // Base tools from @compilr-dev/agents
220
- export { readFileTool, writeFileTool, createBashTool, bashTool, bashOutputTool, killShellTool, grepTool, globTool, editTool, todoWriteTool, todoReadTool, createTodoTools, TodoStore, webFetchTool, suggestTool, } from '@compilr-dev/agents';
220
+ export { readFileTool, writeFileTool, createBashTool, bashTool, bashOutputTool, killShellTool, grepTool, globTool, editTool, todoWriteTool, todoReadTool, createTodoTools, getDefaultTodoStore, TodoStore, webFetchTool, suggestTool, } from '@compilr-dev/agents';
221
221
  // Coding tools from @compilr-dev/agents-coding
222
222
  export {
223
223
  // Git
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Coding preset — batteries-included for software development
3
3
  */
4
- import { readFileTool, writeFileTool, editTool, bashTool, bashOutputTool, killShellTool, grepTool, globTool, todoWriteTool, todoReadTool, webFetchTool, suggestTool, } from '@compilr-dev/agents';
4
+ import { readFileTool, writeFileTool, editTool, bashTool, bashOutputTool, killShellTool, grepTool, globTool, createTodoTools, getDefaultTodoStore, webFetchTool, suggestTool, } from '@compilr-dev/agents';
5
5
  import { allCodingTools, unifiedTools, ts, python, go } from '@compilr-dev/agents-coding';
6
+ import { createLenientTodoWriteTool } from './lenient-todo.js';
6
7
  const CODING_SYSTEM_PROMPT = `You are a skilled software engineer. You help users with coding tasks including:
7
8
  - Writing, reviewing, and debugging code
8
9
  - Understanding codebases and architecture
@@ -35,10 +36,25 @@ export const shellTools = [bashTool, bashOutputTool, killShellTool];
35
36
  * Web tools
36
37
  */
37
38
  export const webTools = [webFetchTool];
39
+ /**
40
+ * Build the full todo tool set (write/read/claim/handoff) bound to the
41
+ * shared `defaultStore`. claim/handoff were missing from this preset prior
42
+ * to TODO-9 — see audit doc. The lenient wrapper normalises agent-input
43
+ * key aliases (title/description/task → content) so todos don't silently
44
+ * drop when the LLM picks the wrong key.
45
+ */
46
+ const todoTools = createTodoTools(getDefaultTodoStore());
47
+ const lenientTodoWrite = createLenientTodoWriteTool(todoTools.todoWrite);
38
48
  /**
39
49
  * Utility tools (always included in coding preset)
40
50
  */
41
- const utilityTools = [todoWriteTool, todoReadTool, suggestTool];
51
+ const utilityTools = [
52
+ lenientTodoWrite,
53
+ todoTools.todoRead,
54
+ todoTools.todoClaim,
55
+ todoTools.todoHandoff,
56
+ suggestTool,
57
+ ];
42
58
  /**
43
59
  * All coding preset tools combined
44
60
  */
@@ -5,7 +5,8 @@
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, todoWriteTool, todoReadTool, webFetchTool, suggestTool, } from '@compilr-dev/agents';
8
+ import { readFileTool, writeFileTool, editTool, bashTool, bashOutputTool, killShellTool, grepTool, globTool, createTodoTools, getDefaultTodoStore, webFetchTool, suggestTool, } from '@compilr-dev/agents';
9
+ import { createLenientTodoWriteTool } from './lenient-todo.js';
9
10
  const GENERAL_SYSTEM_PROMPT = `You are a versatile AI assistant. You adapt your approach to the user's needs and project context.
10
11
 
11
12
  You help users with a wide range of tasks including research, writing, analysis, planning, and problem solving.
@@ -16,6 +17,13 @@ Guidelines:
16
17
  - Follow the project's conventions and style
17
18
  - Follow any project-specific guidance provided in the system prompt
18
19
  - When uncertain, ask the user for clarification`;
20
+ // Build the full todo tool set (write/read/claim/handoff) bound to the
21
+ // shared defaultStore. claim/handoff were missing from this preset prior
22
+ // to TODO-9 — see audit doc. The lenient wrapper normalises agent-input
23
+ // key aliases (title/description/task → content) so todos don't silently
24
+ // drop when the LLM picks the wrong key.
25
+ const todoTools = createTodoTools(getDefaultTodoStore());
26
+ const lenientTodoWrite = createLenientTodoWriteTool(todoTools.todoWrite);
19
27
  export const generalPreset = {
20
28
  name: 'general',
21
29
  systemPrompt: GENERAL_SYSTEM_PROMPT,
@@ -28,8 +36,10 @@ export const generalPreset = {
28
36
  killShellTool,
29
37
  grepTool,
30
38
  globTool,
31
- todoWriteTool,
32
- todoReadTool,
39
+ lenientTodoWrite,
40
+ todoTools.todoRead,
41
+ todoTools.todoClaim,
42
+ todoTools.todoHandoff,
33
43
  webFetchTool,
34
44
  suggestTool,
35
45
  ],
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Lenient todo_write wrapper.
3
+ *
4
+ * LLMs frequently emit the wrong key for the todo's content field —
5
+ * `title`, `description`, `task`, or `text` instead of `content`. The
6
+ * strict builtin tool errors on those, which silently drops the todo
7
+ * (the LLM rarely retries with the right key — it just moves on). The
8
+ * lenient wrapper normalises the input before delegating to the strict
9
+ * tool, so the todo lands in the store regardless of which alias the
10
+ * LLM picked.
11
+ *
12
+ * History: this wrapper originated in `compilr-dev-cli/src/tools.ts:81`
13
+ * (commit 90c7fd5, 2026-02). It was lost from CLI's runtime when the
14
+ * SDK migration moved tool registration to the preset (commit af880c7,
15
+ * 2026-04). Moved to the SDK in commit ?? (TODO-9 fix) so every host
16
+ * benefits.
17
+ *
18
+ * Spec ref: project-docs/00-requirements/compilr-dev-sdk/architecture-audit-cli-vs-desktop.md
19
+ * TODO-9.
20
+ */
21
+ import { type Tool } from '@compilr-dev/agents';
22
+ interface LenientTodoInput {
23
+ todos: Array<{
24
+ content?: string;
25
+ title?: string;
26
+ description?: string;
27
+ task?: string;
28
+ text?: string;
29
+ status: 'pending' | 'in_progress' | 'completed';
30
+ activeForm?: string;
31
+ priority?: number;
32
+ owner?: string;
33
+ blockedBy?: number[];
34
+ }>;
35
+ }
36
+ interface StrictTodoInput {
37
+ todos: Array<{
38
+ content: string;
39
+ status: 'pending' | 'in_progress' | 'completed';
40
+ activeForm?: string;
41
+ priority?: number;
42
+ owner?: string;
43
+ blockedBy?: number[];
44
+ }>;
45
+ }
46
+ /**
47
+ * Wrap a strict `todo_write` tool with input-key normalisation.
48
+ *
49
+ * Pass the `todoWrite` from `createTodoTools(store)` (or the standalone
50
+ * `todoWriteTool` export). Returns a Tool with the same name (`todo_write`)
51
+ * and the same schema, but with an `execute` that normalises input
52
+ * before delegating.
53
+ */
54
+ export declare function createLenientTodoWriteTool(strictTool: Tool<StrictTodoInput>): Tool<LenientTodoInput>;
55
+ export {};
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Lenient todo_write wrapper.
3
+ *
4
+ * LLMs frequently emit the wrong key for the todo's content field —
5
+ * `title`, `description`, `task`, or `text` instead of `content`. The
6
+ * strict builtin tool errors on those, which silently drops the todo
7
+ * (the LLM rarely retries with the right key — it just moves on). The
8
+ * lenient wrapper normalises the input before delegating to the strict
9
+ * tool, so the todo lands in the store regardless of which alias the
10
+ * LLM picked.
11
+ *
12
+ * History: this wrapper originated in `compilr-dev-cli/src/tools.ts:81`
13
+ * (commit 90c7fd5, 2026-02). It was lost from CLI's runtime when the
14
+ * SDK migration moved tool registration to the preset (commit af880c7,
15
+ * 2026-04). Moved to the SDK in commit ?? (TODO-9 fix) so every host
16
+ * benefits.
17
+ *
18
+ * Spec ref: project-docs/00-requirements/compilr-dev-sdk/architecture-audit-cli-vs-desktop.md
19
+ * TODO-9.
20
+ */
21
+ import { defineTool } from '@compilr-dev/agents';
22
+ /**
23
+ * Wrap a strict `todo_write` tool with input-key normalisation.
24
+ *
25
+ * Pass the `todoWrite` from `createTodoTools(store)` (or the standalone
26
+ * `todoWriteTool` export). Returns a Tool with the same name (`todo_write`)
27
+ * and the same schema, but with an `execute` that normalises input
28
+ * before delegating.
29
+ */
30
+ export function createLenientTodoWriteTool(strictTool) {
31
+ return defineTool({
32
+ name: 'todo_write',
33
+ description: strictTool.definition.description,
34
+ inputSchema: strictTool.definition.inputSchema,
35
+ execute: async (input) => {
36
+ // Normalise — accept alternative property names that LLMs commonly emit.
37
+ const normalised = input.todos.map((todo) => ({
38
+ content: (todo.content ||
39
+ todo.title ||
40
+ todo.description ||
41
+ todo.task ||
42
+ todo.text ||
43
+ '').trim(),
44
+ status: todo.status,
45
+ activeForm: todo.activeForm,
46
+ priority: todo.priority,
47
+ owner: todo.owner,
48
+ blockedBy: todo.blockedBy,
49
+ }));
50
+ // Last-resort fallback so an empty content doesn't make the
51
+ // strict tool reject the entire array.
52
+ const valid = normalised.map((todo) => ({
53
+ ...todo,
54
+ content: todo.content || 'Untitled task',
55
+ }));
56
+ return strictTool.execute({ todos: valid });
57
+ },
58
+ });
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.10.23",
3
+ "version": "0.10.25",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",