hammer-ai 0.2.10 → 0.2.11
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 +60 -1
- package/dist/index.js +92 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2240,6 +2240,65 @@ declare abstract class Tool implements ToolLike {
|
|
|
2240
2240
|
toDefinition(): ToolDefinition;
|
|
2241
2241
|
}
|
|
2242
2242
|
|
|
2243
|
+
/**
|
|
2244
|
+
* SubAgentTool — a Tool that runs its own contained agentic loop.
|
|
2245
|
+
*
|
|
2246
|
+
* Subclasses define domain-specific logic in isolation so those rules
|
|
2247
|
+
* stay OUT of the main agent's context window:
|
|
2248
|
+
*
|
|
2249
|
+
* - `getSubAgentSystemPrompt()` — the sub-agent's dedicated system prompt
|
|
2250
|
+
* - `getSubAgentTools()` — tools available within the sub-agent loop
|
|
2251
|
+
* - `getSubAgentLLMProvider()` — LLM provider config for sub-agent inference
|
|
2252
|
+
*
|
|
2253
|
+
* The main agent calls a SubAgentTool like any other tool, passing a `task`
|
|
2254
|
+
* string. The sub-agent autonomously handles the task and returns the result.
|
|
2255
|
+
*/
|
|
2256
|
+
|
|
2257
|
+
interface SubAgentToolOptions {
|
|
2258
|
+
/** Maximum tool-call rounds before giving up. Default: 10. */
|
|
2259
|
+
maxSteps?: number;
|
|
2260
|
+
/** Temperature for LLM calls. Defaults to LLMClient's built-in default (0.2). */
|
|
2261
|
+
temperature?: number;
|
|
2262
|
+
}
|
|
2263
|
+
/**
|
|
2264
|
+
* A Tool that runs its own contained agentic loop.
|
|
2265
|
+
*
|
|
2266
|
+
* Domain-specific rules live in `getSubAgentSystemPrompt()` and are never
|
|
2267
|
+
* injected into the main agent's context — only the short tool description
|
|
2268
|
+
* is visible to the parent.
|
|
2269
|
+
*
|
|
2270
|
+
* @example
|
|
2271
|
+
* ```ts
|
|
2272
|
+
* class ImagePromptAgent extends SubAgentTool {
|
|
2273
|
+
* getName() { return "GenerateImage" }
|
|
2274
|
+
* getDescription() { return "Generate a slide background photo." }
|
|
2275
|
+
* getSchema() { return { task: { type: "string", required: true, ... } } }
|
|
2276
|
+
*
|
|
2277
|
+
* protected getSubAgentSystemPrompt() { return IMAGE_RULES_PROMPT }
|
|
2278
|
+
* protected getSubAgentTools() { return [new RawGenerateImage()] }
|
|
2279
|
+
* protected getSubAgentLLMProvider() { return getProviderConfig("qwen3.6-plus") }
|
|
2280
|
+
* }
|
|
2281
|
+
* ```
|
|
2282
|
+
*/
|
|
2283
|
+
declare abstract class SubAgentTool extends Tool {
|
|
2284
|
+
protected readonly subAgentOptions: SubAgentToolOptions;
|
|
2285
|
+
constructor(workspaceRoot?: string, options?: SubAgentToolOptions);
|
|
2286
|
+
/** Domain-specific system prompt for this sub-agent's dedicated loop. */
|
|
2287
|
+
protected abstract getSubAgentSystemPrompt(): string;
|
|
2288
|
+
/** Tools available within this sub-agent's loop. */
|
|
2289
|
+
protected abstract getSubAgentTools(): ToolLike[];
|
|
2290
|
+
/** LLM provider config used for this sub-agent's inference calls. */
|
|
2291
|
+
protected abstract getSubAgentLLMProvider(): LLMProviderConfig;
|
|
2292
|
+
getSchema(): ToolSchema;
|
|
2293
|
+
/**
|
|
2294
|
+
* Build the task string from raw execute params.
|
|
2295
|
+
* Override when `getSchema()` adds parameters beyond `task`.
|
|
2296
|
+
*/
|
|
2297
|
+
protected buildSubAgentTask(params: Record<string, any>): string;
|
|
2298
|
+
execute(params: Record<string, any>): Promise<ToolResult>;
|
|
2299
|
+
protected runSubAgentLoop(task: string): Promise<ToolResult>;
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2243
2302
|
/**
|
|
2244
2303
|
* Shared ToolRegistry infrastructure.
|
|
2245
2304
|
*
|
|
@@ -2395,4 +2454,4 @@ declare function runStructuredLLMCompaction<TMessage extends MemoryMessage, TSta
|
|
|
2395
2454
|
parseState: (obj: Record<string, unknown>) => TState | null;
|
|
2396
2455
|
}): Promise<TState | null>;
|
|
2397
2456
|
|
|
2398
|
-
export { AGENT_MACHINE_STATES, AgentLoop, type AgentLoopCallbacks, type AgentLoopDeps, type AgentMachineContext, type AgentMachineEvent, type AgentMachineState, type AgentMemoryCitation, type AgentMemoryConstraint, type AgentMemoryEvidence, type AgentMemoryFactoryOverrides, AgentMemoryLayer, type AgentMemoryLayerConfig, type AgentMemoryLogger, type AgentMemoryNote, type AgentMemoryTask, type AgentMessage, type AgentPhase, type AgentState, ApiError, type BackgroundBashAction, BackgroundBashRunCommand, BaseMemoryLayer, BaseValidationEnforcer, BashRunCommand, type BuildMemoryCompactionPromptOptions, CODE_QUALITY_RULE_LINE, CharTokenEstimator, type ChatMessage, type CommandRuntime, type CommandTargetInfo, type CompactionCursor, type CompactionLLMClient, type ConversationAdapter, type ConversationSink, type CreateWebRuntimeSetupOptions, DEFAULT_AGENT_FALLBACK_SYSTEM_PROMPT, DEFAULT_ALLOWED_RUN_TARGETS, DEFAULT_RUN_COMMAND_REGISTRY, DEFAULT_THREAD_AUTO_SCROLL_BOTTOM_THRESHOLD, DEFAULT_TOOL_MEMORY_EXTRACTOR, ERROR_RECOVERY_RULE_LINE, ERROR_TRUNCATED_RESPONSE, type EnforcerResult, type ExecuteWebLoopRunOptions, type FetchLike, type FetchResponseLike, type HammerAgentConfig, type HammerAgentProviderPreset, INCREMENTAL_TESTING_RULE_LINE, JUST_BASH_SCRIPT_EXECUTION_RESTRICTION_LINES, JUST_BASH_SHELL_NATIVE_WORKFLOW_COMMAND_EXAMPLES, LLMClient, type LLMClientResponse, type LLMProviderConfig, type LLMRequest, type LLMRequestOptions, type LLMResponse, LLMResponseSchema, type LoopOutcome, MAX_TOOL_RESULT_CHARS, type MemoryMessage, type MemoryProvenance, type MemoryStorage, PORT_CONFLICT_RULE_LINE, type ParseAgentResponseOptions, type ParsedAgentResponse, type ParsedBackgroundBashCommand, type ParsedStepInput, PendingAgentMessageBuffer, type PersistedMemoryData, type ProviderName, ProxyTool, type ProxyToolExecutor, ROOT_CAUSES_RULE_LINE, type RawMessage, RunCommand, type RunCommandParseResult, type RunCommandPromptAvailability, RunCommandRegistry, type RunInvocationTarget, type RuntimeController, type RuntimeSnapshotUpdater, type RuntimeStore, type RuntimeSubscriber, SHARED_TOOL_CALL_EXAMPLE_LINES, SHARED_TOOL_USAGE_RULE, SINGLE_TOOL_CALL_RUN_LINE_EXAMPLE, SKILL_INVOKE_READ_RULE_LINE, STANDARD_TOOL_CALL_FORMAT_RULES, SUPPORTED_RUN_TARGETS, type SkillSummaryLike, type StepResult, type StreamCallbacks, StreamingToolParser, type StreamingToolParserCallbacks, type SystemPromptBuildContext, type SystemPromptCustomizer, type SystemPromptSections, TODO_LIST_FIRST_RESPONSE_RULE_LINE, TOOL_CALL_SEPARATOR_RULE, type TodoItem, type TodoStatus, type TokenEstimator, Tool, type ToolCall, ToolCallSchema, type ToolDataPrimitive, type ToolDataSchema, type ToolDataValue, type ToolDefinition, type ToolDefinitionMetadata, type ToolExecutionResult, type ToolLike, ToolLoopAgentRuntime, type ToolLoopAgentRuntimeDeps, type ToolLoopRuntimeExecuteStepResult, type ToolLoopRuntimeHooks, type ToolLoopRuntimeInfrastructure, type ToolLoopRuntimeLLMRequest, type ToolLoopRuntimeLLMResponse, type ToolLoopRuntimeRunStepOptions, type ToolLoopRuntimeRunStepResult, type ToolLoopRuntimeSetup, type ToolLoopRuntimeStepContext, type ToolLoopStepExecutionResult, type ToolLoopStepExecutorCallbacks, type ToolLoopStepExecutorOptions, type ToolLoopStepExecutorResponse, type ToolMemoryCitationKind, type ToolMemoryEvidenceKind, type ToolMemoryEvidencePolicy, type ToolMemoryExtractor, type ToolMemoryMetadata, type ToolMemoryNoteKind, type ToolMemoryNotePolicy, type ToolMemoryNoteScope, type ToolMetadata, type ToolParameterDefinition, ToolRegistry, type ToolRegistryBeforeExecuteContext, type ToolRegistryMissingToolContext, type ToolRegistryOptions, type ToolResult, ToolRunCommand, type ToolSchema, type TruncatedToolInfo, VALIDATE_AFTER_CHANGES_RULE_LINE, type WebSearchToolActionInput, WebToolLoopAgentRuntime, type WebToolLoopAgentRuntimeConstructorOptions, type WebToolLoopRuntimeStateLike, WebValidationEnforcer, type WorkspaceCodingStaticRulesOptions, agentMachine, applyIdleWebAgentState, applyInitialWebAgentRunState, buildAgentIdentityLine, buildAgentSystemPrompt, buildCompactionEntry, buildCoreStaticRules, buildNoStructuredResponseFoundError, buildSkillAwareStaticContext, buildSkillsSection, buildStepUserMessage, buildToolLogRevealFrames, buildToolUsageExample, buildValidationErrorMessage, buildWebRuntimeRules, buildWorkspaceCodingStaticRules, canonicalizeCompactionText, coerceToolCallToDefinition, configure, containsStandaloneStructuredInvocationStart, createAgentMemoryLayer, createAppendToolsSectionCustomizer, createBackgroundBashDefinition, createConversationSink, createCustomRunCommandRegistry, createInitialWebAgentState, createRunCommandRuntimeBindings, createRuntimeStore, createToolAgentMessage, createToolRegistry, createToolsSectionOverrideCustomizer, createWebAgentMessageIdGenerator, createWebSearchToolActions, createWebToolLoopCallbacks, decodeEscapedShellText, defineRuntimeController, enrichToolResultWithUnixMetadata, executeBackgroundUnixCommandString, executeToolCallWithRunCommands, executeToolLoopStep, executeToolSafe, executeUnixCommandString, extractPrimaryCommandMetadata, extractTruncatedToolInfo, formatToolCallAsUnixCommand, formatToolDefinitions, formatToolResultMessage, formatToolsSection, formatUnixToolSurface, formatZodValidationError, getDiagnosticSummaryLine, getProviderConfig, getRunCommandPromptAvailability, getToolLogSummaryLine, isBackgroundBashToolCall, isBashToolCall, limitEntriesByRecency, machineStateToWebAgentPhase, mapConversationRoleToAgentRole, parseAgentResponse, parseResponseWithRecovery, parseStructuredAgentText, parseToolResultMessage, parseUnixToolCommand, readDiagnosticLevel, readDiagnosticSource, resolveToolDefinitionForInvocation, runStructuredLLMCompaction, selectLatestByKey, shouldAutoScrollThread, shouldSkipStepUserMessage, stripDiagnosticMessagePrefix, suppressWebValidationLog, tokenizeUnixCommand, truncateToolResult };
|
|
2457
|
+
export { AGENT_MACHINE_STATES, AgentLoop, type AgentLoopCallbacks, type AgentLoopDeps, type AgentMachineContext, type AgentMachineEvent, type AgentMachineState, type AgentMemoryCitation, type AgentMemoryConstraint, type AgentMemoryEvidence, type AgentMemoryFactoryOverrides, AgentMemoryLayer, type AgentMemoryLayerConfig, type AgentMemoryLogger, type AgentMemoryNote, type AgentMemoryTask, type AgentMessage, type AgentPhase, type AgentState, ApiError, type BackgroundBashAction, BackgroundBashRunCommand, BaseMemoryLayer, BaseValidationEnforcer, BashRunCommand, type BuildMemoryCompactionPromptOptions, CODE_QUALITY_RULE_LINE, CharTokenEstimator, type ChatMessage, type CommandRuntime, type CommandTargetInfo, type CompactionCursor, type CompactionLLMClient, type ConversationAdapter, type ConversationSink, type CreateWebRuntimeSetupOptions, DEFAULT_AGENT_FALLBACK_SYSTEM_PROMPT, DEFAULT_ALLOWED_RUN_TARGETS, DEFAULT_RUN_COMMAND_REGISTRY, DEFAULT_THREAD_AUTO_SCROLL_BOTTOM_THRESHOLD, DEFAULT_TOOL_MEMORY_EXTRACTOR, ERROR_RECOVERY_RULE_LINE, ERROR_TRUNCATED_RESPONSE, type EnforcerResult, type ExecuteWebLoopRunOptions, type FetchLike, type FetchResponseLike, type HammerAgentConfig, type HammerAgentProviderPreset, INCREMENTAL_TESTING_RULE_LINE, JUST_BASH_SCRIPT_EXECUTION_RESTRICTION_LINES, JUST_BASH_SHELL_NATIVE_WORKFLOW_COMMAND_EXAMPLES, LLMClient, type LLMClientResponse, type LLMProviderConfig, type LLMRequest, type LLMRequestOptions, type LLMResponse, LLMResponseSchema, type LoopOutcome, MAX_TOOL_RESULT_CHARS, type MemoryMessage, type MemoryProvenance, type MemoryStorage, PORT_CONFLICT_RULE_LINE, type ParseAgentResponseOptions, type ParsedAgentResponse, type ParsedBackgroundBashCommand, type ParsedStepInput, PendingAgentMessageBuffer, type PersistedMemoryData, type ProviderName, ProxyTool, type ProxyToolExecutor, ROOT_CAUSES_RULE_LINE, type RawMessage, RunCommand, type RunCommandParseResult, type RunCommandPromptAvailability, RunCommandRegistry, type RunInvocationTarget, type RuntimeController, type RuntimeSnapshotUpdater, type RuntimeStore, type RuntimeSubscriber, SHARED_TOOL_CALL_EXAMPLE_LINES, SHARED_TOOL_USAGE_RULE, SINGLE_TOOL_CALL_RUN_LINE_EXAMPLE, SKILL_INVOKE_READ_RULE_LINE, STANDARD_TOOL_CALL_FORMAT_RULES, SUPPORTED_RUN_TARGETS, type SkillSummaryLike, type StepResult, type StreamCallbacks, StreamingToolParser, type StreamingToolParserCallbacks, SubAgentTool, type SubAgentToolOptions, type SystemPromptBuildContext, type SystemPromptCustomizer, type SystemPromptSections, TODO_LIST_FIRST_RESPONSE_RULE_LINE, TOOL_CALL_SEPARATOR_RULE, type TodoItem, type TodoStatus, type TokenEstimator, Tool, type ToolCall, ToolCallSchema, type ToolDataPrimitive, type ToolDataSchema, type ToolDataValue, type ToolDefinition, type ToolDefinitionMetadata, type ToolExecutionResult, type ToolLike, ToolLoopAgentRuntime, type ToolLoopAgentRuntimeDeps, type ToolLoopRuntimeExecuteStepResult, type ToolLoopRuntimeHooks, type ToolLoopRuntimeInfrastructure, type ToolLoopRuntimeLLMRequest, type ToolLoopRuntimeLLMResponse, type ToolLoopRuntimeRunStepOptions, type ToolLoopRuntimeRunStepResult, type ToolLoopRuntimeSetup, type ToolLoopRuntimeStepContext, type ToolLoopStepExecutionResult, type ToolLoopStepExecutorCallbacks, type ToolLoopStepExecutorOptions, type ToolLoopStepExecutorResponse, type ToolMemoryCitationKind, type ToolMemoryEvidenceKind, type ToolMemoryEvidencePolicy, type ToolMemoryExtractor, type ToolMemoryMetadata, type ToolMemoryNoteKind, type ToolMemoryNotePolicy, type ToolMemoryNoteScope, type ToolMetadata, type ToolParameterDefinition, ToolRegistry, type ToolRegistryBeforeExecuteContext, type ToolRegistryMissingToolContext, type ToolRegistryOptions, type ToolResult, ToolRunCommand, type ToolSchema, type TruncatedToolInfo, VALIDATE_AFTER_CHANGES_RULE_LINE, type WebSearchToolActionInput, WebToolLoopAgentRuntime, type WebToolLoopAgentRuntimeConstructorOptions, type WebToolLoopRuntimeStateLike, WebValidationEnforcer, type WorkspaceCodingStaticRulesOptions, agentMachine, applyIdleWebAgentState, applyInitialWebAgentRunState, buildAgentIdentityLine, buildAgentSystemPrompt, buildCompactionEntry, buildCoreStaticRules, buildNoStructuredResponseFoundError, buildSkillAwareStaticContext, buildSkillsSection, buildStepUserMessage, buildToolLogRevealFrames, buildToolUsageExample, buildValidationErrorMessage, buildWebRuntimeRules, buildWorkspaceCodingStaticRules, canonicalizeCompactionText, coerceToolCallToDefinition, configure, containsStandaloneStructuredInvocationStart, createAgentMemoryLayer, createAppendToolsSectionCustomizer, createBackgroundBashDefinition, createConversationSink, createCustomRunCommandRegistry, createInitialWebAgentState, createRunCommandRuntimeBindings, createRuntimeStore, createToolAgentMessage, createToolRegistry, createToolsSectionOverrideCustomizer, createWebAgentMessageIdGenerator, createWebSearchToolActions, createWebToolLoopCallbacks, decodeEscapedShellText, defineRuntimeController, enrichToolResultWithUnixMetadata, executeBackgroundUnixCommandString, executeToolCallWithRunCommands, executeToolLoopStep, executeToolSafe, executeUnixCommandString, extractPrimaryCommandMetadata, extractTruncatedToolInfo, formatToolCallAsUnixCommand, formatToolDefinitions, formatToolResultMessage, formatToolsSection, formatUnixToolSurface, formatZodValidationError, getDiagnosticSummaryLine, getProviderConfig, getRunCommandPromptAvailability, getToolLogSummaryLine, isBackgroundBashToolCall, isBashToolCall, limitEntriesByRecency, machineStateToWebAgentPhase, mapConversationRoleToAgentRole, parseAgentResponse, parseResponseWithRecovery, parseStructuredAgentText, parseToolResultMessage, parseUnixToolCommand, readDiagnosticLevel, readDiagnosticSource, resolveToolDefinitionForInvocation, runStructuredLLMCompaction, selectLatestByKey, shouldAutoScrollThread, shouldSkipStepUserMessage, stripDiagnosticMessagePrefix, suppressWebValidationLog, tokenizeUnixCommand, truncateToolResult };
|
package/dist/index.js
CHANGED
|
@@ -7170,6 +7170,97 @@ var Tool = class {
|
|
|
7170
7170
|
}
|
|
7171
7171
|
};
|
|
7172
7172
|
|
|
7173
|
+
// src/sub-agent.ts
|
|
7174
|
+
var SubAgentTool = class extends Tool {
|
|
7175
|
+
subAgentOptions;
|
|
7176
|
+
constructor(workspaceRoot = "", options) {
|
|
7177
|
+
super(workspaceRoot);
|
|
7178
|
+
this.subAgentOptions = options ?? {};
|
|
7179
|
+
}
|
|
7180
|
+
// ---- default task schema (override to add extra params) ---------------
|
|
7181
|
+
getSchema() {
|
|
7182
|
+
return {
|
|
7183
|
+
task: {
|
|
7184
|
+
type: "string",
|
|
7185
|
+
required: true,
|
|
7186
|
+
positional: false,
|
|
7187
|
+
description: "The task for the sub-agent to complete."
|
|
7188
|
+
}
|
|
7189
|
+
};
|
|
7190
|
+
}
|
|
7191
|
+
/**
|
|
7192
|
+
* Build the task string from raw execute params.
|
|
7193
|
+
* Override when `getSchema()` adds parameters beyond `task`.
|
|
7194
|
+
*/
|
|
7195
|
+
buildSubAgentTask(params) {
|
|
7196
|
+
return typeof params.task === "string" ? params.task.trim() : "";
|
|
7197
|
+
}
|
|
7198
|
+
// ---- execute ---------------------------------------------------------
|
|
7199
|
+
async execute(params) {
|
|
7200
|
+
const task = this.buildSubAgentTask(params);
|
|
7201
|
+
if (!task) return { success: false, error: "task is required" };
|
|
7202
|
+
return this.runSubAgentLoop(task);
|
|
7203
|
+
}
|
|
7204
|
+
// ---- core loop -------------------------------------------------------
|
|
7205
|
+
async runSubAgentLoop(task) {
|
|
7206
|
+
const { maxSteps = 10, temperature } = this.subAgentOptions;
|
|
7207
|
+
const llmClient = new LLMClient(this.getSubAgentLLMProvider());
|
|
7208
|
+
const subTools = this.getSubAgentTools();
|
|
7209
|
+
const toolMap = new Map(subTools.map((t) => [t.getName(), t]));
|
|
7210
|
+
const toolDefs = subTools.map((t) => t.toDefinition());
|
|
7211
|
+
const systemPrompt = buildAgentSystemPrompt({
|
|
7212
|
+
identityLine: this.getSubAgentSystemPrompt(),
|
|
7213
|
+
tools: toolDefs,
|
|
7214
|
+
allowedRunTargets: ["tool"],
|
|
7215
|
+
supplementalRules: buildCoreStaticRules()
|
|
7216
|
+
});
|
|
7217
|
+
const messages = [
|
|
7218
|
+
{ role: "system", content: systemPrompt },
|
|
7219
|
+
{ role: "user", content: task }
|
|
7220
|
+
];
|
|
7221
|
+
for (let step = 0; step < maxSteps; step++) {
|
|
7222
|
+
const response = await llmClient.chat({ messages, temperature });
|
|
7223
|
+
messages.push({ role: "assistant", content: response.content });
|
|
7224
|
+
const parsed = parseAgentResponse(response.content, {
|
|
7225
|
+
// Allow "bash" so that exit 0 / exit 1 are intercepted as
|
|
7226
|
+
// success / failure signals without being executed.
|
|
7227
|
+
allowedRunTargets: ["tool", "bash"]
|
|
7228
|
+
});
|
|
7229
|
+
if (!parsed) {
|
|
7230
|
+
return { success: false, error: "Sub-agent produced no structured response" };
|
|
7231
|
+
}
|
|
7232
|
+
if (parsed.outcome === "success") {
|
|
7233
|
+
return { success: true, result: parsed.reasoning || "Done." };
|
|
7234
|
+
}
|
|
7235
|
+
if (parsed.outcome === "failure") {
|
|
7236
|
+
return { success: false, error: parsed.reasoning || "Sub-agent reported failure" };
|
|
7237
|
+
}
|
|
7238
|
+
if (parsed.selectedToolCall) {
|
|
7239
|
+
const raw = parsed.selectedToolCall;
|
|
7240
|
+
const toolCall = coerceToolCallToDefinition(raw, toolDefs) ?? raw;
|
|
7241
|
+
const tool = toolMap.get(toolCall.name);
|
|
7242
|
+
if (!tool) {
|
|
7243
|
+
const errResult = {
|
|
7244
|
+
success: false,
|
|
7245
|
+
error: `Unknown tool: ${toolCall.name}. Available: ${[...toolMap.keys()].join(", ")}`
|
|
7246
|
+
};
|
|
7247
|
+
messages.push({
|
|
7248
|
+
role: "tool",
|
|
7249
|
+
content: formatToolResultMessage(toolCall, errResult)
|
|
7250
|
+
});
|
|
7251
|
+
continue;
|
|
7252
|
+
}
|
|
7253
|
+
const result = await tool.execute(toolCall.parameters);
|
|
7254
|
+
messages.push({
|
|
7255
|
+
role: "tool",
|
|
7256
|
+
content: formatToolResultMessage(toolCall, result)
|
|
7257
|
+
});
|
|
7258
|
+
}
|
|
7259
|
+
}
|
|
7260
|
+
return { success: false, error: `Sub-agent did not complete within ${maxSteps} steps` };
|
|
7261
|
+
}
|
|
7262
|
+
};
|
|
7263
|
+
|
|
7173
7264
|
// src/registry.ts
|
|
7174
7265
|
function isToolRegistryOptions(value) {
|
|
7175
7266
|
if (!value || typeof value !== "object") {
|
|
@@ -7387,6 +7478,6 @@ async function executeToolLoopStep(options) {
|
|
|
7387
7478
|
};
|
|
7388
7479
|
}
|
|
7389
7480
|
|
|
7390
|
-
export { AGENT_MACHINE_STATES, AgentLoop, AgentMemoryLayer, ApiError, BackgroundBashRunCommand, BaseMemoryLayer, BaseValidationEnforcer, BashRunCommand, CODE_QUALITY_RULE_LINE, CharTokenEstimator, DEFAULT_AGENT_FALLBACK_SYSTEM_PROMPT, DEFAULT_ALLOWED_RUN_TARGETS, DEFAULT_RUN_COMMAND_REGISTRY, DEFAULT_THREAD_AUTO_SCROLL_BOTTOM_THRESHOLD, DEFAULT_TOOL_MEMORY_EXTRACTOR, ERROR_RECOVERY_RULE_LINE, ERROR_TRUNCATED_RESPONSE, INCREMENTAL_TESTING_RULE_LINE, JUST_BASH_SCRIPT_EXECUTION_RESTRICTION_LINES, JUST_BASH_SHELL_NATIVE_WORKFLOW_COMMAND_EXAMPLES, LLMClient, LLMResponseSchema, MAX_TOOL_RESULT_CHARS, PORT_CONFLICT_RULE_LINE, PendingAgentMessageBuffer, ProxyTool, ROOT_CAUSES_RULE_LINE, RunCommand, RunCommandRegistry, SHARED_TOOL_CALL_EXAMPLE_LINES, SHARED_TOOL_USAGE_RULE, SINGLE_TOOL_CALL_RUN_LINE_EXAMPLE, SKILL_INVOKE_READ_RULE_LINE, STANDARD_TOOL_CALL_FORMAT_RULES, SUPPORTED_RUN_TARGETS, StreamingToolParser, TODO_LIST_FIRST_RESPONSE_RULE_LINE, TOOL_CALL_SEPARATOR_RULE, Tool, ToolCallSchema, ToolLoopAgentRuntime, ToolRegistry, ToolRunCommand, VALIDATE_AFTER_CHANGES_RULE_LINE, WebToolLoopAgentRuntime, WebValidationEnforcer, agentMachine, applyIdleWebAgentState, applyInitialWebAgentRunState, buildAgentIdentityLine, buildAgentSystemPrompt, buildCompactionEntry, buildCoreStaticRules, buildNoStructuredResponseFoundError, buildSkillAwareStaticContext, buildSkillsSection, buildStepUserMessage, buildToolLogRevealFrames, buildToolUsageExample, buildValidationErrorMessage, buildWebRuntimeRules, buildWorkspaceCodingStaticRules, canonicalizeCompactionText, coerceToolCallToDefinition, configure, containsStandaloneStructuredInvocationStart, createAgentMemoryLayer, createAppendToolsSectionCustomizer, createBackgroundBashDefinition, createConversationSink, createCustomRunCommandRegistry, createInitialWebAgentState, createRunCommandRuntimeBindings, createRuntimeStore, createToolAgentMessage, createToolRegistry, createToolsSectionOverrideCustomizer, createWebAgentMessageIdGenerator, createWebSearchToolActions, createWebToolLoopCallbacks, decodeEscapedShellText, defineRuntimeController, enrichToolResultWithUnixMetadata, executeBackgroundUnixCommandString, executeToolCallWithRunCommands, executeToolLoopStep, executeToolSafe, executeUnixCommandString, extractPrimaryCommandMetadata, extractTruncatedToolInfo, formatToolCallAsUnixCommand, formatToolDefinitions, formatToolResultMessage, formatToolsSection, formatUnixToolSurface, formatZodValidationError, getDiagnosticSummaryLine, getProviderConfig, getRunCommandPromptAvailability, getToolLogSummaryLine, isBackgroundBashToolCall, isBashToolCall, limitEntriesByRecency, machineStateToWebAgentPhase, mapConversationRoleToAgentRole, parseAgentResponse, parseResponseWithRecovery, parseStructuredAgentText, parseToolResultMessage, parseUnixToolCommand, readDiagnosticLevel, readDiagnosticSource, resolveToolDefinitionForInvocation, runStructuredLLMCompaction, selectLatestByKey, shouldAutoScrollThread, shouldSkipStepUserMessage, stripDiagnosticMessagePrefix, suppressWebValidationLog, tokenizeUnixCommand, truncateToolResult };
|
|
7481
|
+
export { AGENT_MACHINE_STATES, AgentLoop, AgentMemoryLayer, ApiError, BackgroundBashRunCommand, BaseMemoryLayer, BaseValidationEnforcer, BashRunCommand, CODE_QUALITY_RULE_LINE, CharTokenEstimator, DEFAULT_AGENT_FALLBACK_SYSTEM_PROMPT, DEFAULT_ALLOWED_RUN_TARGETS, DEFAULT_RUN_COMMAND_REGISTRY, DEFAULT_THREAD_AUTO_SCROLL_BOTTOM_THRESHOLD, DEFAULT_TOOL_MEMORY_EXTRACTOR, ERROR_RECOVERY_RULE_LINE, ERROR_TRUNCATED_RESPONSE, INCREMENTAL_TESTING_RULE_LINE, JUST_BASH_SCRIPT_EXECUTION_RESTRICTION_LINES, JUST_BASH_SHELL_NATIVE_WORKFLOW_COMMAND_EXAMPLES, LLMClient, LLMResponseSchema, MAX_TOOL_RESULT_CHARS, PORT_CONFLICT_RULE_LINE, PendingAgentMessageBuffer, ProxyTool, ROOT_CAUSES_RULE_LINE, RunCommand, RunCommandRegistry, SHARED_TOOL_CALL_EXAMPLE_LINES, SHARED_TOOL_USAGE_RULE, SINGLE_TOOL_CALL_RUN_LINE_EXAMPLE, SKILL_INVOKE_READ_RULE_LINE, STANDARD_TOOL_CALL_FORMAT_RULES, SUPPORTED_RUN_TARGETS, StreamingToolParser, SubAgentTool, TODO_LIST_FIRST_RESPONSE_RULE_LINE, TOOL_CALL_SEPARATOR_RULE, Tool, ToolCallSchema, ToolLoopAgentRuntime, ToolRegistry, ToolRunCommand, VALIDATE_AFTER_CHANGES_RULE_LINE, WebToolLoopAgentRuntime, WebValidationEnforcer, agentMachine, applyIdleWebAgentState, applyInitialWebAgentRunState, buildAgentIdentityLine, buildAgentSystemPrompt, buildCompactionEntry, buildCoreStaticRules, buildNoStructuredResponseFoundError, buildSkillAwareStaticContext, buildSkillsSection, buildStepUserMessage, buildToolLogRevealFrames, buildToolUsageExample, buildValidationErrorMessage, buildWebRuntimeRules, buildWorkspaceCodingStaticRules, canonicalizeCompactionText, coerceToolCallToDefinition, configure, containsStandaloneStructuredInvocationStart, createAgentMemoryLayer, createAppendToolsSectionCustomizer, createBackgroundBashDefinition, createConversationSink, createCustomRunCommandRegistry, createInitialWebAgentState, createRunCommandRuntimeBindings, createRuntimeStore, createToolAgentMessage, createToolRegistry, createToolsSectionOverrideCustomizer, createWebAgentMessageIdGenerator, createWebSearchToolActions, createWebToolLoopCallbacks, decodeEscapedShellText, defineRuntimeController, enrichToolResultWithUnixMetadata, executeBackgroundUnixCommandString, executeToolCallWithRunCommands, executeToolLoopStep, executeToolSafe, executeUnixCommandString, extractPrimaryCommandMetadata, extractTruncatedToolInfo, formatToolCallAsUnixCommand, formatToolDefinitions, formatToolResultMessage, formatToolsSection, formatUnixToolSurface, formatZodValidationError, getDiagnosticSummaryLine, getProviderConfig, getRunCommandPromptAvailability, getToolLogSummaryLine, isBackgroundBashToolCall, isBashToolCall, limitEntriesByRecency, machineStateToWebAgentPhase, mapConversationRoleToAgentRole, parseAgentResponse, parseResponseWithRecovery, parseStructuredAgentText, parseToolResultMessage, parseUnixToolCommand, readDiagnosticLevel, readDiagnosticSource, resolveToolDefinitionForInvocation, runStructuredLLMCompaction, selectLatestByKey, shouldAutoScrollThread, shouldSkipStepUserMessage, stripDiagnosticMessagePrefix, suppressWebValidationLog, tokenizeUnixCommand, truncateToolResult };
|
|
7391
7482
|
//# sourceMappingURL=index.js.map
|
|
7392
7483
|
//# sourceMappingURL=index.js.map
|