@compilr-dev/sdk 0.9.23 → 0.9.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
@@ -74,7 +74,7 @@ export { PROJECT_TYPES, getProjectTypeConfig, getEnrichedProjectTypeConfig, getP
74
74
  export type { ActionMeta, SkillMeta } from './project-types/index.js';
75
75
  export type { ProjectTypeConfig, ProjectPhase, SuggestedAgent, DocumentTemplate, } from './project-types/index.js';
76
76
  export { defineTool, createSuccessResult, createErrorResult, mergeHooks, createLoggingHooks, createClaudeProvider, createOpenAIProvider, createGeminiNativeProvider, createOllamaProvider, createTogetherProvider, createGroqProvider, createFireworksProvider, createPerplexityProvider, createOpenRouterProvider, createMockProvider, MockProvider, Agent, ContextManager, DEFAULT_CONTEXT_CONFIG, createTaskTool, createSuggestTool, defaultAgentTypes, TOOL_SETS, BUILTIN_GUARDRAILS, TOOL_NAMES, getDefaultShellManager, builtinSkills, AnchorManager, MCPManager, AgentError, ProviderError, ToolError, ToolTimeoutError, MaxIterationsError, AbortError, } from '@compilr-dev/agents';
77
- export type { Tool, HooksConfig, AgentEvent, Message, LLMProvider, AnchorInput, ToolExecutionResult, AgentRunResult, PermissionHandler, 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';
77
+ 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';
78
78
  export { DEFAULT_PERMISSION_RULES, findMatchingRule, permissionModeLabel, permissionLevelLabel, } from './permissions.js';
79
79
  export type { PermissionRule, PermissionMode, PermissionLevel } from './permissions.js';
80
80
  export { readMCPConfigFile, writeMCPConfigFile, resolveServerEntry, loadMCPServers, saveMCPServerEntry, deleteMCPServerEntry, getServerNames, } from './mcp-config.js';
@@ -168,10 +168,11 @@ export const TOOL_USAGE_HINTS_MODULE = {
168
168
  export const PLATFORM_TOOL_HINTS_MODULE = {
169
169
  id: 'platform-tool-hints',
170
170
  name: 'Platform Tool Hints',
171
- estimatedTokens: 120,
171
+ estimatedTokens: 200,
172
172
  conditions: { enableMetaTools: true },
173
173
  content: `## Platform Tool Hints
174
174
 
175
+ - **CRITICAL — Filesystem vs Database**: Project documents (PRD, design, outline, analysis, plan, session-notes) and backlog items live in the **database**, not the filesystem. Use \`project_document_*\` and \`workitem_*\` tools — NEVER \`write_file\` / \`bash mkdir\` / \`edit\` for project artifacts. Source code uses filesystem tools as normal. See the "Filesystem vs Database (Hard Rule)" section below for the wrong-vs-right table.
175
176
  - **workitem_* vs todo_***: workitem_* tools manage PERSISTENT backlog items (database). todo_* tools manage ephemeral session tasks (footer display). Use workitem_claim/workitem_handoff for persistent ownership, todo_claim/todo_handoff for session tasks.
176
177
  - **project_id**: All project/workitem/document/plan tools default to the active project. Only pass project_id to target a different project.
177
178
  - **Plan status flow**: draft → approved → in_progress → completed. Any → abandoned. abandoned → draft.
@@ -206,7 +207,7 @@ Common operations:
206
207
  export const TOOL_USAGE_META_MODULE = {
207
208
  id: 'tool-usage-meta',
208
209
  name: 'Tool Usage (Meta)',
209
- estimatedTokens: 250,
210
+ estimatedTokens: 450,
210
211
  conditions: { enableMetaTools: true },
211
212
  content: `### Specialized Tools
212
213
 
@@ -221,20 +222,44 @@ Key categories:
221
222
  - **Runners**: run_tests, run_lint
222
223
  - **Anchors**: anchor_add, anchor_list, anchor_remove
223
224
 
224
- ### Document Storage (CRITICAL)
225
-
226
- Project documents (drafts, outlines, analyses, plans) are stored in the **database**, not the filesystem.
227
- - **Read**: \`project_document_get({ doc_type: "outline" })\` or \`project_document_list()\`
228
- - **Write (new)**: \`project_document_add({ doc_type: "outline", title: "...", content: "..." })\`
229
- - **Patch (update without reading)**: \`project_document_patch({ doc_type: "draft", operation: "append", content: "## New Section\\n..." })\`
230
- - Operations: \`append\`, \`prepend\`, \`replace_section\` (with \`section_heading\`)
231
- - Prefer patch over add when updating large documents — avoids reading the full content into context
232
- - Do NOT use write_file or edit for project documents always use these database tools
233
- - **Software doc_types**: prd, architecture, design, notes, plan
234
- - **Research doc_types**: outline, literature-review, abstract, methodology, bibliography
235
- - **Business doc_types**: executive-summary, market-analysis, financial-model, pitch
236
- - **Content doc_types**: editorial-calendar, article
237
- - **General doc_types**: draft, review, session-notes, chapter, notes`,
225
+ ### CRITICAL: Filesystem vs Database (Hard Rule)
226
+
227
+ **Project documents and project data live in the DATABASE. Source code lives in the FILESYSTEM. Never mix these.**
228
+
229
+ This is a non-negotiable project standard. Using filesystem tools (\`write_file\`, \`edit\`, \`bash mkdir\`) for project artifacts is a violation that breaks the integration with the rest of the workspace (no Documents panel visibility, no agent shared context, no exports, no version tracking).
230
+
231
+ **Decision heuristic ask before writing:**
232
+
233
+ 1. *"Is this source code or a config file (e.g., \`src/main.ts\`, \`package.json\`, \`.env\`)?"*
234
+ If YES, use filesystem tools (\`write_file\`, \`edit\`, \`bash\`).
235
+ 2. *"Is this a project artifact (PRD, design doc, draft, outline, analysis, plan, backlog item, session notes)?"*
236
+ If YES, you **MUST** use the corresponding database tool (\`project_document_*\`, \`workitem_*\`). Filesystem ops for these are forbidden.
237
+
238
+ **Wrong vs Right:**
239
+
240
+ | Task | ❌ WRONG | ✅ RIGHT |
241
+ |------|----------|---------|
242
+ | Create PRD | \`bash mkdir -p .compilr/requirements\` + \`write_file ".compilr/PRD.md"\` | \`project_document_add({ doc_type: "prd", title: "...", content: "..." })\` |
243
+ | Read design doc | \`read_file "docs/design.md"\` | \`project_document_get({ doc_type: "design" })\` |
244
+ | Update outline | \`edit "outline.md" ...\` | \`project_document_patch({ doc_type: "outline", operation: "append", content: "..." })\` |
245
+ | Save session notes | \`write_file "notes.md" ...\` | \`project_document_add({ doc_type: "session-notes", ... })\` |
246
+ | List backlog | \`read_file "backlog.csv"\` | \`workitem_query()\` |
247
+ | Add backlog item | \`edit "backlog.md" ...\` | \`workitem_add({ ... })\` |
248
+
249
+ **Operations:**
250
+ - **Read**: \`project_document_get({ doc_type: "..." })\` or \`project_document_list()\`
251
+ - **Write (new)**: \`project_document_add({ doc_type: "...", title: "...", content: "..." })\`
252
+ - **Patch (update without reading)**: \`project_document_patch({ doc_type: "...", operation: "append" | "prepend" | "replace_section", content: "...", section_heading?: "..." })\`
253
+ - Prefer patch over add when updating large documents — avoids loading full content into context
254
+
255
+ **Always query before writing.** Before adding a document or work item, run \`project_document_list()\` or \`workitem_query()\` first to check for existing entries — avoids duplicates.
256
+
257
+ **doc_types by project type:**
258
+ - **Software**: prd, architecture, design, notes, plan
259
+ - **Research**: outline, literature-review, abstract, methodology, bibliography
260
+ - **Business**: executive-summary, market-analysis, financial-model, pitch
261
+ - **Content**: editorial-calendar, article
262
+ - **General**: draft, review, session-notes, chapter, notes`,
238
263
  };
239
264
  /**
240
265
  * Token delegation module - always included
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.9.23",
3
+ "version": "0.9.25",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -56,7 +56,7 @@
56
56
  "node": ">=20.0.0"
57
57
  },
58
58
  "dependencies": {
59
- "@compilr-dev/agents": "^0.5.5",
59
+ "@compilr-dev/agents": "^0.5.7",
60
60
  "@compilr-dev/logger": "^0.1.0",
61
61
  "ajv": "^6.14.0"
62
62
  },