@compilr-dev/cli 0.5.16 → 0.6.0

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/agent.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * Agent Configuration
3
3
  *
4
- * Creates and configures the Agent instance with
5
- * ClaudeProvider, OllamaProvider, OpenAIProvider, or GeminiProvider
6
- * and available tools.
4
+ * Thin wrapper around createCompilrAgent() from @compilr-dev/sdk.
5
+ * Handles CLI-specific concerns: credential resolution, system prompt
6
+ * assembly, subagent callbacks, and token estimates.
7
7
  */
8
8
  import { Agent } from '@compilr-dev/sdk';
9
- import type { AgentEvent, PermissionHandler, Tool, GuardrailTriggeredHandler } from '@compilr-dev/sdk';
9
+ import type { AgentEvent, Tool, GuardrailTriggeredHandler } from '@compilr-dev/sdk';
10
+ import type { PermissionHandler } from '@compilr-dev/agents';
10
11
  import type { EpisodeRecorder } from './episodes/index.js';
11
12
  /**
12
13
  * Supported providers (re-exported from models/provider-types)
@@ -44,44 +45,21 @@ export interface AgentOptions {
44
45
  * or false to stop execution.
45
46
  */
46
47
  onIterationLimitReached?: (context: IterationLimitContext) => Promise<number | false>;
47
- /**
48
- * Active project display name (e.g. "Hr Manager").
49
- */
48
+ /** Active project display name */
50
49
  projectName?: string;
51
- /**
52
- * Active project slug — unique identifier (e.g. "hr-manager").
53
- */
50
+ /** Active project slug */
54
51
  projectSlug?: string;
55
- /**
56
- * Active project ID (numeric database identifier).
57
- */
52
+ /** Active project ID */
58
53
  projectId?: number;
59
- /**
60
- * Project context from COMPILR.md or CLAUDE.md.
61
- * This is appended to the system prompt to give the agent project-specific knowledge.
62
- */
54
+ /** Project context from COMPILR.md or CLAUDE.md */
63
55
  projectContext?: string;
64
- /**
65
- * Guided workflow context.
66
- * Appended to the system prompt when in guided mode.
67
- * Generated by the workflow module based on project/item state.
68
- */
56
+ /** Guided workflow context */
69
57
  guidedModeContext?: string;
70
- /**
71
- * Plan mode context.
72
- * Appended to the system prompt when in plan mode.
73
- * Instructs the agent to explore, plan, and wait for approval before implementing.
74
- */
58
+ /** Plan mode context */
75
59
  planModeContext?: string;
76
- /**
77
- * Enable anchors (critical info that survives compaction).
78
- * When true, agent is configured with AnchorManager.
79
- */
60
+ /** Enable anchors (critical info that survives compaction) */
80
61
  enableAnchors?: boolean;
81
- /**
82
- * Pre-loaded anchors to add to the agent at startup.
83
- * These are loaded from persisted files (global + project).
84
- */
62
+ /** Pre-loaded anchors to add at startup */
85
63
  persistedAnchors?: Array<{
86
64
  id?: string;
87
65
  content: string;
@@ -90,94 +68,37 @@ export interface AgentOptions {
90
68
  tags?: string[];
91
69
  projectId?: string;
92
70
  }>;
93
- /**
94
- * Enable guardrails (safety checks for risky operations).
95
- * When true, 15 built-in patterns are enabled for git, filesystem, database, etc.
96
- * Warnings are emitted as 'guardrail_warning' events on the agent.
97
- */
71
+ /** Enable guardrails (safety checks for risky operations) */
98
72
  enableGuardrails?: boolean;
99
- /**
100
- * Callback for guardrail confirmation prompts.
101
- * Called when a guardrail with action='confirm' is triggered.
102
- * Return true to proceed, false to block.
103
- */
73
+ /** Callback for guardrail confirmation prompts */
104
74
  onGuardrailTriggered?: GuardrailTriggeredHandler;
105
- /**
106
- * Callback when a subagent starts (task tool spawns agent).
107
- * @param toolUseId - Tool use ID for correlation (from task tool's tool_start event)
108
- * @param agentType - Type of agent being spawned
109
- * @param description - Task description
110
- */
75
+ /** Callback when a subagent starts */
111
76
  onSubagentStart?: (toolUseId: string, agentType: string, description: string) => void;
112
- /**
113
- * Callback when a subagent completes.
114
- * @param toolUseId - Tool use ID for correlation
115
- * @param success - Whether the subagent completed successfully
116
- * @param tokenCount - Total tokens used by the subagent
117
- * @param error - Error message if failed
118
- */
77
+ /** Callback when a subagent completes */
119
78
  onSubagentEnd?: (toolUseId: string, success: boolean, tokenCount: number, error?: string) => void;
120
- /**
121
- * Callback when a subagent uses a tool (for live updates).
122
- * @param toolUseId - Tool use ID for correlation
123
- * @param toolName - Name of the tool being used
124
- * @param summary - Optional summary of what the tool is doing
125
- */
79
+ /** Callback when a subagent uses a tool (for live updates) */
126
80
  onSubagentToolUse?: (toolUseId: string, toolName: string, summary?: string) => void;
127
- /**
128
- * Callback invoked when subagent tracking should be cleared (e.g., new run starting).
129
- * Returns a function to clear the tracking state.
130
- */
81
+ /** Callback for subagent tracking state clear */
131
82
  onSubagentTrackingReady?: (clearTracking: () => void) => void;
132
- /**
133
- * Enable meta-tools for token optimization (EXPERIMENTAL).
134
- * When true, only direct tools are declared normally.
135
- * Specialized tools are available via use_tool() meta-function.
136
- * Reduces token overhead from ~15K to ~5K per request.
137
- */
83
+ /** Enable meta-tools / capability loading for token optimization */
138
84
  enableMetaTools?: boolean;
139
- /**
140
- * Additional system prompt content for role-specific agents.
141
- * This is appended to the end of the built system prompt.
142
- * Used for team agents with specialized personas.
143
- */
85
+ /** Additional system prompt for role-specific agents */
144
86
  systemPromptAddition?: string;
145
- /**
146
- * Suppress startup console logs (provider info, meta-tools stats, system prompt stats).
147
- * Used for team agents created during runtime to avoid interfering with UI.
148
- */
87
+ /** Suppress startup logs (for team agents) */
149
88
  quiet?: boolean;
150
- /**
151
- * Use minimal system prompt - skip all modules and just use systemPromptAddition.
152
- * Used for testing role identity without module interference.
153
- */
89
+ /** Use minimal system prompt (just systemPromptAddition) */
154
90
  useMinimalSystemPrompt?: boolean;
155
- /**
156
- * Skip all tool registration - agent has no tools.
157
- * Used for testing role identity without tool interference.
158
- */
91
+ /** Skip all tool registration */
159
92
  noTools?: boolean;
160
- /**
161
- * Tool filter - limit which tools this agent can use.
162
- * When set, only tools in this list will be registered.
163
- * Applies to both direct tools and meta-registry tools.
164
- */
93
+ /** Tool filter — limit which tools this agent can use */
165
94
  toolFilter?: string[];
166
- /**
167
- * MCP tools discovered from external MCP servers.
168
- * These are registered alongside built-in tools.
169
- * The LLM sees them identically to native tools.
170
- */
95
+ /** MCP tools from external MCP servers */
171
96
  mcpTools?: Tool[];
172
- /**
173
- * Episode recorder for tracking work history.
174
- * When provided, its AfterToolHook is registered to observe tool calls.
175
- */
97
+ /** Episode recorder for work history tracking */
176
98
  episodeRecorder?: EpisodeRecorder;
177
99
  }
178
100
  /**
179
101
  * Get permission info for a tool by name.
180
- * Returns undefined if the tool doesn't require special permission (always allowed).
181
102
  */
182
103
  export declare function getToolPermissionInfo(toolName: string): {
183
104
  level: 'once' | 'always' | 'session';
@@ -185,7 +106,6 @@ export declare function getToolPermissionInfo(toolName: string): {
185
106
  } | undefined;
186
107
  /**
187
108
  * Get information about built-in guardrails.
188
- * Used for displaying guardrail info in /help or status overlays.
189
109
  */
190
110
  export declare function getBuiltinGuardrailInfo(): Array<{
191
111
  id: string;
@@ -194,11 +114,19 @@ export declare function getBuiltinGuardrailInfo(): Array<{
194
114
  action: 'warn' | 'confirm' | 'block';
195
115
  category: string;
196
116
  }>;
197
- /**
198
- * Derive profile group IDs from a tool filter (array of tool names).
199
- * A group is included if any of its tools are in the filter.
200
- */
201
117
  /**
202
118
  * Creates an Agent instance configured with all tools.
119
+ *
120
+ * Delegates to createCompilrAgent() from @compilr-dev/sdk for:
121
+ * - Provider creation, context management, observation masking
122
+ * - Smart windowing, tool output guards
123
+ * - Capability loading (meta-tools, dynamic prompt assembly)
124
+ * - Permission handling, guardrails, delegation
125
+ *
126
+ * CLI adds on top:
127
+ * - Credential resolution from CLI keystore
128
+ * - System prompt with project context and role identity
129
+ * - Subagent callbacks for UI updates
130
+ * - Token estimate logging
203
131
  */
204
132
  export declare function createAgent(options?: AgentOptions): Agent;