@compilr-dev/sdk 0.10.24 → 0.10.26

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
@@ -3,7 +3,7 @@
3
3
  */
4
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
+ import { createLenientTodoWriteTool, createLenientTodoClaimTool, createLenientTodoHandoffTool, } from './lenient-todo.js';
7
7
  const CODING_SYSTEM_PROMPT = `You are a skilled software engineer. You help users with coding tasks including:
8
8
  - Writing, reviewing, and debugging code
9
9
  - Understanding codebases and architecture
@@ -43,16 +43,19 @@ export const webTools = [webFetchTool];
43
43
  * key aliases (title/description/task → content) so todos don't silently
44
44
  * drop when the LLM picks the wrong key.
45
45
  */
46
- const todoTools = createTodoTools(getDefaultTodoStore());
46
+ const todoStore = getDefaultTodoStore();
47
+ const todoTools = createTodoTools(todoStore);
47
48
  const lenientTodoWrite = createLenientTodoWriteTool(todoTools.todoWrite);
49
+ const lenientTodoClaim = createLenientTodoClaimTool(todoTools.todoClaim, todoStore);
50
+ const lenientTodoHandoff = createLenientTodoHandoffTool(todoTools.todoHandoff, todoStore);
48
51
  /**
49
52
  * Utility tools (always included in coding preset)
50
53
  */
51
54
  const utilityTools = [
52
55
  lenientTodoWrite,
53
56
  todoTools.todoRead,
54
- todoTools.todoClaim,
55
- todoTools.todoHandoff,
57
+ lenientTodoClaim,
58
+ lenientTodoHandoff,
56
59
  suggestTool,
57
60
  ];
58
61
  /**
@@ -6,7 +6,7 @@
6
6
  * in the ProjectTypeConfig, not from the preset.
7
7
  */
8
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
+ import { createLenientTodoWriteTool, createLenientTodoClaimTool, createLenientTodoHandoffTool, } from './lenient-todo.js';
10
10
  const GENERAL_SYSTEM_PROMPT = `You are a versatile AI assistant. You adapt your approach to the user's needs and project context.
11
11
 
12
12
  You help users with a wide range of tasks including research, writing, analysis, planning, and problem solving.
@@ -22,8 +22,11 @@ Guidelines:
22
22
  // to TODO-9 — see audit doc. The lenient wrapper normalises agent-input
23
23
  // key aliases (title/description/task → content) so todos don't silently
24
24
  // drop when the LLM picks the wrong key.
25
- const todoTools = createTodoTools(getDefaultTodoStore());
25
+ const todoStore = getDefaultTodoStore();
26
+ const todoTools = createTodoTools(todoStore);
26
27
  const lenientTodoWrite = createLenientTodoWriteTool(todoTools.todoWrite);
28
+ const lenientTodoClaim = createLenientTodoClaimTool(todoTools.todoClaim, todoStore);
29
+ const lenientTodoHandoff = createLenientTodoHandoffTool(todoTools.todoHandoff, todoStore);
27
30
  export const generalPreset = {
28
31
  name: 'general',
29
32
  systemPrompt: GENERAL_SYSTEM_PROMPT,
@@ -38,8 +41,8 @@ export const generalPreset = {
38
41
  globTool,
39
42
  lenientTodoWrite,
40
43
  todoTools.todoRead,
41
- todoTools.todoClaim,
42
- todoTools.todoHandoff,
44
+ lenientTodoClaim,
45
+ lenientTodoHandoff,
43
46
  webFetchTool,
44
47
  suggestTool,
45
48
  ],
@@ -18,7 +18,7 @@
18
18
  * Spec ref: project-docs/00-requirements/compilr-dev-sdk/architecture-audit-cli-vs-desktop.md
19
19
  * TODO-9.
20
20
  */
21
- import { type Tool } from '@compilr-dev/agents';
21
+ import { type Tool, type TodoStore } from '@compilr-dev/agents';
22
22
  interface LenientTodoInput {
23
23
  todos: Array<{
24
24
  content?: string;
@@ -52,4 +52,30 @@ interface StrictTodoInput {
52
52
  * before delegating.
53
53
  */
54
54
  export declare function createLenientTodoWriteTool(strictTool: Tool<StrictTodoInput>): Tool<LenientTodoInput>;
55
+ interface LenientTodoClaimInput {
56
+ todoId: string | number;
57
+ agentId: string;
58
+ }
59
+ interface StrictTodoClaimInput {
60
+ todoId: string;
61
+ agentId: string;
62
+ }
63
+ interface LenientTodoHandoffInput {
64
+ todoId: string | number;
65
+ toAgentId: string;
66
+ notes?: string;
67
+ }
68
+ interface StrictTodoHandoffInput {
69
+ todoId: string;
70
+ toAgentId: string;
71
+ notes?: string;
72
+ }
73
+ /**
74
+ * Wrap a strict `todo_claim` tool with todoId normalisation.
75
+ */
76
+ export declare function createLenientTodoClaimTool(strictTool: Tool<StrictTodoClaimInput>, store: TodoStore): Tool<LenientTodoClaimInput>;
77
+ /**
78
+ * Wrap a strict `todo_handoff` tool with todoId normalisation.
79
+ */
80
+ export declare function createLenientTodoHandoffTool(strictTool: Tool<StrictTodoHandoffInput>, store: TodoStore): Tool<LenientTodoHandoffInput>;
55
81
  export {};
@@ -18,7 +18,7 @@
18
18
  * Spec ref: project-docs/00-requirements/compilr-dev-sdk/architecture-audit-cli-vs-desktop.md
19
19
  * TODO-9.
20
20
  */
21
- import { defineTool } from '@compilr-dev/agents';
21
+ import { defineTool, } from '@compilr-dev/agents';
22
22
  /**
23
23
  * Wrap a strict `todo_write` tool with input-key normalisation.
24
24
  *
@@ -57,3 +57,87 @@ export function createLenientTodoWriteTool(strictTool) {
57
57
  },
58
58
  });
59
59
  }
60
+ /**
61
+ * Resolve a lenient todoId reference to a concrete store key.
62
+ * Returns null if no plausible match exists.
63
+ */
64
+ function resolveTodoId(rawId, store) {
65
+ const all = store.getAll();
66
+ const ids = all.map((t) => t.id);
67
+ // String coercion + trim.
68
+ const id = String(rawId).trim();
69
+ // Direct match — handles "todo-1" as-is.
70
+ if (ids.includes(id))
71
+ return id;
72
+ // Bare positional reference: "1" or 1 → "todo-1".
73
+ if (/^\d+$/.test(id)) {
74
+ const candidate = `todo-${id}`;
75
+ if (ids.includes(candidate))
76
+ return candidate;
77
+ }
78
+ // Allow "todo_1" variant.
79
+ const underscoreToHyphen = id.replace(/^todo_/, 'todo-');
80
+ if (ids.includes(underscoreToHyphen))
81
+ return underscoreToHyphen;
82
+ // Last resort: content-prefix match (case-insensitive). Only commits to
83
+ // a hit if exactly one todo's content starts with the given string.
84
+ const lower = id.toLowerCase();
85
+ const contentHits = all.filter((t) => t.content.toLowerCase().startsWith(lower));
86
+ if (contentHits.length === 1)
87
+ return contentHits[0].id;
88
+ return null;
89
+ }
90
+ /**
91
+ * Wrap a strict `todo_claim` tool with todoId normalisation.
92
+ */
93
+ export function createLenientTodoClaimTool(strictTool, store) {
94
+ return defineTool({
95
+ name: 'todo_claim',
96
+ description: `${strictTool.definition.description} ` +
97
+ 'The todoId can be the full id ("todo-1"), a positional number ("1"), or a content prefix.',
98
+ inputSchema: strictTool.definition.inputSchema,
99
+ execute: async (input) => {
100
+ const resolved = resolveTodoId(input.todoId, store);
101
+ if (!resolved) {
102
+ return {
103
+ success: false,
104
+ error: `Todo "${String(input.todoId)}" not found. ` +
105
+ `Available ids: ${store
106
+ .getAll()
107
+ .map((t) => t.id)
108
+ .join(', ') || '(none)'}.`,
109
+ };
110
+ }
111
+ return strictTool.execute({ todoId: resolved, agentId: input.agentId });
112
+ },
113
+ });
114
+ }
115
+ /**
116
+ * Wrap a strict `todo_handoff` tool with todoId normalisation.
117
+ */
118
+ export function createLenientTodoHandoffTool(strictTool, store) {
119
+ return defineTool({
120
+ name: 'todo_handoff',
121
+ description: `${strictTool.definition.description} ` +
122
+ 'The todoId can be the full id ("todo-1"), a positional number ("1"), or a content prefix.',
123
+ inputSchema: strictTool.definition.inputSchema,
124
+ execute: async (input) => {
125
+ const resolved = resolveTodoId(input.todoId, store);
126
+ if (!resolved) {
127
+ return {
128
+ success: false,
129
+ error: `Todo "${String(input.todoId)}" not found. ` +
130
+ `Available ids: ${store
131
+ .getAll()
132
+ .map((t) => t.id)
133
+ .join(', ') || '(none)'}.`,
134
+ };
135
+ }
136
+ return strictTool.execute({
137
+ todoId: resolved,
138
+ toAgentId: input.toAgentId,
139
+ notes: input.notes,
140
+ });
141
+ },
142
+ });
143
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.10.24",
3
+ "version": "0.10.26",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",