@humain/terminal 0.2.2 → 0.2.3
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/CHANGELOG.md +2 -0
- package/dist/bundle/chunks/{chunk-ADQYVZ6A.js → chunk-LYOOYM65.js} +8 -8
- package/dist/bundle/chunks/{chunk-NMPIM7MN.js → chunk-U75GS4NL.js} +1 -1
- package/dist/bundle/chunks/{compat-CN7WN6DA.js → compat-22OQ5DBK.js} +1 -1
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/tools/subagent.d.ts +2 -0
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +46 -16
- package/dist/core/tools/subagent.js.map +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{ANTHROPIC_API_KEY_ENV,ANTHROPIC_AUTH_TOKEN_ENV,ANTHROPIC_OAUTH_TOKEN_ENV,anthropicMessagesApi,azureOpenAIResponsesApi,bedrockConverseStreamApi,complete,completeSimple,findEnvKeys,generateImages,generateImagesOpenRouter,getApiProvider,getApiProviders,getEnvApiKey,getImageModel,getImageModels,getImageProviders,getImagesApiProvider,getModel,getModels,getProviders,googleGenerativeAIApi,googleVertexApi,mistralConversationsApi,openAICodexResponsesApi,openAICompletionsApi,openAIResponsesApi,piMessagesApi,registerApiProvider,registerBuiltInApiProviders,registerBuiltInImagesApiProviders,registerFauxProvider,registerImagesApiProvider,resetApiProviders,setBedrockProviderModule,stream,streamAnthropic,streamAzureOpenAIResponses,streamGoogle,streamGoogleVertex,streamMistral,streamOpenAICodexResponses,streamOpenAICompletions,streamOpenAIResponses,streamSimple,streamSimpleAnthropic,streamSimpleAzureOpenAIResponses,streamSimpleGoogle,streamSimpleGoogleVertex,streamSimpleMistral,streamSimpleOpenAICodexResponses,streamSimpleOpenAICompletions,streamSimpleOpenAIResponses,unregisterApiProviders}from"./chunk-
|
|
2
|
+
import{ANTHROPIC_API_KEY_ENV,ANTHROPIC_AUTH_TOKEN_ENV,ANTHROPIC_OAUTH_TOKEN_ENV,anthropicMessagesApi,azureOpenAIResponsesApi,bedrockConverseStreamApi,complete,completeSimple,findEnvKeys,generateImages,generateImagesOpenRouter,getApiProvider,getApiProviders,getEnvApiKey,getImageModel,getImageModels,getImageProviders,getImagesApiProvider,getModel,getModels,getProviders,googleGenerativeAIApi,googleVertexApi,mistralConversationsApi,openAICodexResponsesApi,openAICompletionsApi,openAIResponsesApi,piMessagesApi,registerApiProvider,registerBuiltInApiProviders,registerBuiltInImagesApiProviders,registerFauxProvider,registerImagesApiProvider,resetApiProviders,setBedrockProviderModule,stream,streamAnthropic,streamAzureOpenAIResponses,streamGoogle,streamGoogleVertex,streamMistral,streamOpenAICodexResponses,streamOpenAICompletions,streamOpenAIResponses,streamSimple,streamSimpleAnthropic,streamSimpleAzureOpenAIResponses,streamSimpleGoogle,streamSimpleGoogleVertex,streamSimpleMistral,streamSimpleOpenAICodexResponses,streamSimpleOpenAICompletions,streamSimpleOpenAIResponses,unregisterApiProviders}from"./chunk-U75GS4NL.js";import{AssistantMessageFrameEncoder,StringEnum,contentText,createFauxCore,createImagesModels,createImagesProvider,envApiKeyAuth,fauxAssistantMessage,fauxProvider,fauxText,fauxThinking,fauxToolCall,getAssistantRetryDelayMs,getOverflowPatterns,isContextOverflow,isRecoverableLength,isRetryableAssistantError,lazyOAuth,reduceAssistantMessageFrames,retryAssistantCall,typebox_exports,validateToolArguments,validateToolCall}from"./chunk-7T6XCLJF.js";import{cleanupSessionResources,registerSessionResourceCleanup,uuidv7}from"./chunk-USJZMAIR.js";import"./chunk-7DDKXS2Q.js";import{parseJsonWithRepair,parseStreamingJson,repairJson}from"./chunk-D7XAASZM.js";import{InMemoryCredentialStore,InMemoryModelsStore,ModelsError,calculateCost,clampThinkingLevel,createModels,createProvider,defaultProviderAuthContext,getSupportedThinkingLevels,hasApi,lazyApi,lazyStream,modelsAreEqual}from"./chunk-E6KP6V7F.js";import{AssistantMessageEventStream,EventStream,appendAssistantMessageDiagnostic,createAssistantMessageDiagnostic,createAssistantMessageEventStream,extractDiagnosticError,formatThrownValue}from"./chunk-72KO4OMP.js";import"./chunk-JXWJOIH4.js";export{ANTHROPIC_API_KEY_ENV,ANTHROPIC_AUTH_TOKEN_ENV,ANTHROPIC_OAUTH_TOKEN_ENV,AssistantMessageEventStream,AssistantMessageFrameEncoder,EventStream,InMemoryCredentialStore,InMemoryModelsStore,ModelsError,StringEnum,typebox_exports as Type,anthropicMessagesApi,appendAssistantMessageDiagnostic,azureOpenAIResponsesApi,bedrockConverseStreamApi,calculateCost,clampThinkingLevel,cleanupSessionResources,complete,completeSimple,contentText,createAssistantMessageDiagnostic,createAssistantMessageEventStream,createFauxCore,createImagesModels,createImagesProvider,createModels,createProvider,defaultProviderAuthContext,envApiKeyAuth,extractDiagnosticError,fauxAssistantMessage,fauxProvider,fauxText,fauxThinking,fauxToolCall,findEnvKeys,formatThrownValue,generateImages,generateImagesOpenRouter,getApiProvider,getApiProviders,getAssistantRetryDelayMs,getEnvApiKey,getImageModel,getImageModels,getImageProviders,getImagesApiProvider,getModel,getModels,getOverflowPatterns,getProviders,getSupportedThinkingLevels,googleGenerativeAIApi,googleVertexApi,hasApi,isContextOverflow,isRecoverableLength,isRetryableAssistantError,lazyApi,lazyOAuth,lazyStream,mistralConversationsApi,modelsAreEqual,openAICodexResponsesApi,openAICompletionsApi,openAIResponsesApi,parseJsonWithRepair,parseStreamingJson,piMessagesApi,reduceAssistantMessageFrames,registerApiProvider,registerBuiltInApiProviders,registerBuiltInImagesApiProviders,registerFauxProvider,registerImagesApiProvider,registerSessionResourceCleanup,repairJson,resetApiProviders,retryAssistantCall,setBedrockProviderModule,stream,streamAnthropic,streamAzureOpenAIResponses,streamGoogle,streamGoogleVertex,streamMistral,streamOpenAICodexResponses,streamOpenAICompletions,streamOpenAIResponses,streamSimple,streamSimpleAnthropic,streamSimpleAzureOpenAIResponses,streamSimpleGoogle,streamSimpleGoogleVertex,streamSimpleMistral,streamSimpleOpenAICodexResponses,streamSimpleOpenAICompletions,streamSimpleOpenAIResponses,unregisterApiProviders,uuidv7,validateToolArguments,validateToolCall};
|
package/dist/bundle/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
3
|
-
import{configureHttpDispatcher,main}from"./chunks/chunk-
|
|
3
|
+
import{configureHttpDispatcher,main}from"./chunks/chunk-LYOOYM65.js";import"./chunks/chunk-D6HHRSB5.js";import{APP_NAME,ENV_PREFIX}from"./chunks/chunk-LI2YVPWP.js";import"./chunks/chunk-U75GS4NL.js";import"./chunks/chunk-SGTGQNNP.js";import"./chunks/chunk-ECWELYBH.js";import"./chunks/chunk-74NVHVNZ.js";import"./chunks/chunk-PL7O7J4J.js";import"./chunks/chunk-7T6XCLJF.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-D7XAASZM.js";import"./chunks/chunk-E6KP6V7F.js";import"./chunks/chunk-72KO4OMP.js";import"./chunks/chunk-JXWJOIH4.js";function setupCli(){process.title=APP_NAME,process.env.PI_CODING_AGENT="true",process.env[`${ENV_PREFIX}_CODING_AGENT`]="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),configureHttpDispatcher()}setupCli();main(process.argv.slice(2));
|
package/dist/bundle/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
2
|
-
import{AgentExecInputError,AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,HUMAIN_AGENT_EXECUTION_FAILURE_CODES,HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION,HumainAgentArtifactSchema,HumainAgentExecutionClaimSchema,HumainAgentExecutionControlsSchema,HumainAgentExecutionOutcomeSchema,HumainAgentExecutionRequestSchema,HumainAgentExecutionResponseSchema,HumainAgentRouteRefSchema,HumainAgentUsageSchema,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,ProjectTrustStore,RpcClient,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,buildContextEntries,buildSessionContext,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createPiAgentExecutionHost,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,executeHumainAgentRequest,findCutPoint,findTurnStartIndex,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPowerShellConfig,getSelectListTheme,getSettingsListTheme,getShellConfig,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,keyHint,keyText,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseHumainAgentExecutionRequest,parseHumainAgentExecutionResponse,parseSessionEntries,parseSkillBlock,prepareBranchEntries,rawKeyHint,readStoredCredential,renderDiff,resolveCliModel,resolveModelScopeWithDiagnostics,runAgentExecMode,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-
|
|
2
|
+
import{AgentExecInputError,AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,HUMAIN_AGENT_EXECUTION_FAILURE_CODES,HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION,HumainAgentArtifactSchema,HumainAgentExecutionClaimSchema,HumainAgentExecutionControlsSchema,HumainAgentExecutionOutcomeSchema,HumainAgentExecutionRequestSchema,HumainAgentExecutionResponseSchema,HumainAgentRouteRefSchema,HumainAgentUsageSchema,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,ProjectTrustStore,RpcClient,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UserMessageComponent,UserMessageSelectorComponent,buildContextEntries,buildSessionContext,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createPiAgentExecutionHost,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,executeHumainAgentRequest,findCutPoint,findTurnStartIndex,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPowerShellConfig,getSelectListTheme,getSettingsListTheme,getShellConfig,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,keyHint,keyText,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseHumainAgentExecutionRequest,parseHumainAgentExecutionResponse,parseSessionEntries,parseSkillBlock,prepareBranchEntries,rawKeyHint,readStoredCredential,renderDiff,resolveCliModel,resolveModelScopeWithDiagnostics,runAgentExecMode,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools}from"./chunks/chunk-LYOOYM65.js";import"./chunks/chunk-D6HHRSB5.js";import{CONFIG_DIR_NAME,UPSTREAM_PI_VERSION,VERSION,formatDimensionNote,getAgentDir,getDocsPath,getExamplesPath,getPackageDir,getReadmePath,resizeImage}from"./chunks/chunk-LI2YVPWP.js";import"./chunks/chunk-U75GS4NL.js";import"./chunks/chunk-SGTGQNNP.js";import"./chunks/chunk-ECWELYBH.js";import"./chunks/chunk-74NVHVNZ.js";import"./chunks/chunk-PL7O7J4J.js";import"./chunks/chunk-7T6XCLJF.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-D7XAASZM.js";import"./chunks/chunk-E6KP6V7F.js";import"./chunks/chunk-72KO4OMP.js";import"./chunks/chunk-JXWJOIH4.js";export{AgentExecInputError,AgentSession,AgentSessionRuntime,ArminComponent,AssistantMessageComponent,BashExecutionComponent,BorderedLoader,BranchSummaryMessageComponent,CONFIG_DIR_NAME,CURRENT_SESSION_VERSION,CompactionSummaryMessageComponent,CredentialSynchronizationError,CustomEditor,CustomMessageComponent,DEFAULT_COMPACTION_SETTINGS,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,DefaultPackageManager,DefaultResourceLoader,DynamicBorder,ExtensionEditorComponent,ExtensionInputComponent,ExtensionRunner,ExtensionSelectorComponent,FooterComponent,HUMAIN_AGENT_EXECUTION_FAILURE_CODES,HUMAIN_AGENT_EXECUTION_SCHEMA_VERSION,HumainAgentArtifactSchema,HumainAgentExecutionClaimSchema,HumainAgentExecutionControlsSchema,HumainAgentExecutionOutcomeSchema,HumainAgentExecutionRequestSchema,HumainAgentExecutionResponseSchema,HumainAgentRouteRefSchema,HumainAgentUsageSchema,InteractiveMode,LoginDialogComponent,ModelRegistry,ModelRuntime,ModelSelectorComponent,OAuthSelectorComponent,ProjectTrustStore,RpcClient,SessionManager,SessionSelectorComponent,SettingsManager,SettingsSelectorComponent,ShowImagesSelectorComponent,SkillInvocationMessageComponent,Theme,ThemeSelectorComponent,ThinkingSelectorComponent,ToolExecutionComponent,TreeSelectorComponent,UPSTREAM_PI_VERSION,UserMessageComponent,UserMessageSelectorComponent,VERSION,buildContextEntries,buildSessionContext,calculateContextTokens,collectEntriesForBranchSummary,compact,convertToLlm,convertToPng,copyToClipboard,createAgentSession,createAgentSessionFromServices,createAgentSessionRuntime,createAgentSessionServices,createBashTool,createBashToolDefinition,createCodingTools,createEditTool,createEditToolDefinition,createEventBus,createExtensionRuntime,createFindTool,createFindToolDefinition,createGrepTool,createGrepToolDefinition,createLocalBashOperations,createLocalPowerShellOperations,createLsTool,createLsToolDefinition,createPiAgentExecutionHost,createPowerShellTool,createPowerShellToolDefinition,createReadOnlyTools,createReadTool,createReadToolDefinition,createSyntheticSourceInfo,createWriteTool,createWriteToolDefinition,defineTool,detectSupportedImageMimeTypeFromFile,discoverAndLoadExtensions,estimateTokens,executeHumainAgentRequest,findCutPoint,findTurnStartIndex,formatDimensionNote,formatSize,formatSkillsForPrompt,generateBranchSummary,generateDiffString,generateSummary,generateSummaryWithUsage,generateUnifiedPatch,getAgentDir,getDocsPath,getExamplesPath,getLanguageFromPath,getLastAssistantUsage,getLatestCompactionEntry,getMarkdownTheme,getPackageDir,getPowerShellConfig,getReadmePath,getSelectListTheme,getSettingsListTheme,getShellConfig,hasTrustRequiringProjectResources,highlightCode,initTheme,isBashToolResult,isEditToolResult,isFindToolResult,isGrepToolResult,isLsToolResult,isPowerShellToolResult,isReadToolResult,isToolCallEventType,isWriteToolResult,keyHint,keyText,loadProjectContextFiles,loadSkills,loadSkillsFromDir,main,migrateSessionEntries,parseArgs,parseFrontmatter,parseHumainAgentExecutionRequest,parseHumainAgentExecutionResponse,parseSessionEntries,parseSkillBlock,prepareBranchEntries,rawKeyHint,readStoredCredential,renderDiff,resizeImage,resolveCliModel,resolveModelScopeWithDiagnostics,runAgentExecMode,runPrintMode,runRpcMode,serializeConversation,sessionEntryToContextMessages,shouldCompact,stripFrontmatter,truncateHead,truncateLine,truncateTail,truncateToVisualLines,withFileMutationQueue,wrapRegisteredTool,wrapRegisteredTools};
|
package/dist/bundle/rpc-entry.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
|
|
3
|
-
import{configureHttpDispatcher,main}from"./chunks/chunk-
|
|
3
|
+
import{configureHttpDispatcher,main}from"./chunks/chunk-LYOOYM65.js";import"./chunks/chunk-D6HHRSB5.js";import{APP_NAME}from"./chunks/chunk-LI2YVPWP.js";import"./chunks/chunk-U75GS4NL.js";import"./chunks/chunk-SGTGQNNP.js";import"./chunks/chunk-ECWELYBH.js";import"./chunks/chunk-74NVHVNZ.js";import"./chunks/chunk-PL7O7J4J.js";import"./chunks/chunk-7T6XCLJF.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-D7XAASZM.js";import"./chunks/chunk-E6KP6V7F.js";import"./chunks/chunk-72KO4OMP.js";import"./chunks/chunk-JXWJOIH4.js";process.title=`${APP_NAME}-rpc`;process.env.PI_CODING_AGENT="true";process.env.AI_AGENT="pi";process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import type { Message } from "@earendil-works/pi-ai";
|
|
15
15
|
import { Type } from "typebox";
|
|
16
|
+
import type { ResourceDiagnostic } from "../diagnostics.ts";
|
|
16
17
|
import type { ToolDefinition } from "../extensions/types.ts";
|
|
17
18
|
export { SUBAGENT_DEPTH_ENV } from "./subagent-env.ts";
|
|
18
19
|
import { type SubagentIsolation, type SubagentMergeOutcome } from "./subagent-worktree.ts";
|
|
@@ -29,6 +30,7 @@ export interface AgentConfig {
|
|
|
29
30
|
export interface AgentDiscoveryResult {
|
|
30
31
|
agents: AgentConfig[];
|
|
31
32
|
projectAgentsDir: string | null;
|
|
33
|
+
diagnostics: ResourceDiagnostic[];
|
|
32
34
|
}
|
|
33
35
|
export declare function discoverAgents(cwd: string, scope: AgentScope): AgentDiscoveryResult;
|
|
34
36
|
export interface SubagentUsageStats {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent.d.ts","sourceRoot":"","sources":["../../../src/core/tools/subagent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,OAAO,KAAK,EAAO,OAAO,EAAS,MAAM,uBAAuB,CAAC;AAGjE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAI/B,OAAO,KAAK,EAAoB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAiB/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAGN,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAEzB,MAAM,wBAAwB,CAAC;AAQhC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAErD,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACpC,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"subagent.d.ts","sourceRoot":"","sources":["../../../src/core/tools/subagent.ts"],"names":[],"mappings":"AAAA;;;;;;;;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AOjF;AA0XD,uJAAuJ;AACvJ,MAAM,WAAW,WAAW;IAC3B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAkFD,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBlB,CAAC;AAEH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,cAAc,EAAE,eAAe,CAAC,CAywBhH;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,2EAE7C"}
|
|
@@ -32,15 +32,16 @@ const COLLAPSED_ITEM_COUNT = 10;
|
|
|
32
32
|
const PER_TASK_OUTPUT_CAP = 50 * 1024;
|
|
33
33
|
function loadAgentsFromDir(dir, source) {
|
|
34
34
|
const agents = [];
|
|
35
|
+
const diagnostics = [];
|
|
35
36
|
if (!fs.existsSync(dir)) {
|
|
36
|
-
return agents;
|
|
37
|
+
return { agents, diagnostics };
|
|
37
38
|
}
|
|
38
39
|
let entries;
|
|
39
40
|
try {
|
|
40
41
|
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
41
42
|
}
|
|
42
43
|
catch {
|
|
43
|
-
return agents;
|
|
44
|
+
return { agents, diagnostics };
|
|
44
45
|
}
|
|
45
46
|
for (const entry of entries) {
|
|
46
47
|
if (!entry.name.endsWith(".md"))
|
|
@@ -55,8 +56,27 @@ function loadAgentsFromDir(dir, source) {
|
|
|
55
56
|
catch {
|
|
56
57
|
continue;
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
+
let frontmatter;
|
|
60
|
+
let body;
|
|
61
|
+
try {
|
|
62
|
+
({ frontmatter, body } = parseFrontmatter(content));
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
// Malformed frontmatter (e.g. invalid YAML) must not take down the whole
|
|
66
|
+
// directory — skip this one file and surface a diagnostic instead.
|
|
67
|
+
const message = error instanceof Error ? error.message : "failed to parse agent file";
|
|
68
|
+
diagnostics.push({ type: "warning", message, path: filePath });
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
59
71
|
if (!frontmatter.name || !frontmatter.description) {
|
|
72
|
+
const missing = [!frontmatter.name && "name", !frontmatter.description && "description"]
|
|
73
|
+
.filter(Boolean)
|
|
74
|
+
.join(" and ");
|
|
75
|
+
diagnostics.push({
|
|
76
|
+
type: "warning",
|
|
77
|
+
message: `missing required frontmatter field(s): ${missing}`,
|
|
78
|
+
path: filePath,
|
|
79
|
+
});
|
|
60
80
|
continue;
|
|
61
81
|
}
|
|
62
82
|
const tools = frontmatter.tools
|
|
@@ -73,7 +93,7 @@ function loadAgentsFromDir(dir, source) {
|
|
|
73
93
|
filePath,
|
|
74
94
|
});
|
|
75
95
|
}
|
|
76
|
-
return agents;
|
|
96
|
+
return { agents, diagnostics };
|
|
77
97
|
}
|
|
78
98
|
function isDirectory(p) {
|
|
79
99
|
try {
|
|
@@ -98,24 +118,29 @@ function findNearestProjectAgentsDir(cwd) {
|
|
|
98
118
|
export function discoverAgents(cwd, scope) {
|
|
99
119
|
const userDir = path.join(getAgentDir(), "agents");
|
|
100
120
|
const projectAgentsDir = findNearestProjectAgentsDir(cwd);
|
|
101
|
-
const
|
|
102
|
-
const
|
|
121
|
+
const emptyResult = { agents: [], diagnostics: [] };
|
|
122
|
+
const userResult = scope === "project" ? emptyResult : loadAgentsFromDir(userDir, "user");
|
|
123
|
+
const projectResult = scope === "user" || !projectAgentsDir ? emptyResult : loadAgentsFromDir(projectAgentsDir, "project");
|
|
103
124
|
const agentMap = new Map();
|
|
104
125
|
if (scope === "both") {
|
|
105
|
-
for (const agent of
|
|
126
|
+
for (const agent of userResult.agents)
|
|
106
127
|
agentMap.set(agent.name, agent);
|
|
107
|
-
for (const agent of
|
|
128
|
+
for (const agent of projectResult.agents)
|
|
108
129
|
agentMap.set(agent.name, agent);
|
|
109
130
|
}
|
|
110
131
|
else if (scope === "user") {
|
|
111
|
-
for (const agent of
|
|
132
|
+
for (const agent of userResult.agents)
|
|
112
133
|
agentMap.set(agent.name, agent);
|
|
113
134
|
}
|
|
114
135
|
else {
|
|
115
|
-
for (const agent of
|
|
136
|
+
for (const agent of projectResult.agents)
|
|
116
137
|
agentMap.set(agent.name, agent);
|
|
117
138
|
}
|
|
118
|
-
return {
|
|
139
|
+
return {
|
|
140
|
+
agents: Array.from(agentMap.values()),
|
|
141
|
+
projectAgentsDir,
|
|
142
|
+
diagnostics: [...userResult.diagnostics, ...projectResult.diagnostics],
|
|
143
|
+
};
|
|
119
144
|
}
|
|
120
145
|
// --- Formatting helpers ---
|
|
121
146
|
function formatTokens(count) {
|
|
@@ -285,12 +310,17 @@ function getCliInvocation(args) {
|
|
|
285
310
|
}
|
|
286
311
|
return { command: "humain-terminal", args };
|
|
287
312
|
}
|
|
288
|
-
async function runSingleAgent(defaultCwd, agents, agentName, task, cwd, isolation, step, model, parentModel, signal, onUpdate, makeDetails, toolCallId, childIndex, options) {
|
|
313
|
+
async function runSingleAgent(defaultCwd, agents, agentDiagnostics, agentName, task, cwd, isolation, step, model, parentModel, signal, onUpdate, makeDetails, toolCallId, childIndex, options) {
|
|
289
314
|
const childDepth = currentSubagentDepth() + 1;
|
|
290
315
|
const parentTaskId = currentTaskId() ?? toolCallId;
|
|
291
316
|
const agent = agents.find((a) => a.name === agentName);
|
|
292
317
|
if (!agent) {
|
|
293
318
|
const available = agents.map((a) => `"${a.name}"`).join(", ") || "none";
|
|
319
|
+
const skippedNote = agentDiagnostics.length > 0
|
|
320
|
+
? ` ${agentDiagnostics.length} agent file(s) failed to load and were skipped: ${agentDiagnostics
|
|
321
|
+
.map((d) => `${d.path ?? "(unknown path)"} (${d.message})`)
|
|
322
|
+
.join("; ")}.`
|
|
323
|
+
: "";
|
|
294
324
|
return {
|
|
295
325
|
agent: agentName,
|
|
296
326
|
agentSource: "unknown",
|
|
@@ -300,7 +330,7 @@ async function runSingleAgent(defaultCwd, agents, agentName, task, cwd, isolatio
|
|
|
300
330
|
depth: childDepth,
|
|
301
331
|
exitCode: 1,
|
|
302
332
|
messages: [],
|
|
303
|
-
stderr: `Unknown agent: "${agentName}". Available agents: ${available}
|
|
333
|
+
stderr: `Unknown agent: "${agentName}". Available agents: ${available}.${skippedNote}`,
|
|
304
334
|
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, contextTokens: 0, turns: 0 },
|
|
305
335
|
step,
|
|
306
336
|
isolation: "shared",
|
|
@@ -773,7 +803,7 @@ export function createSubagentToolDefinition(cwd) {
|
|
|
773
803
|
}
|
|
774
804
|
}
|
|
775
805
|
: undefined;
|
|
776
|
-
const result = await runSingleAgent(defaultCwd, agents, step.agent, taskWithContext, step.cwd, undefined, i + 1, step.model, parentModel, signal, chainUpdate, makeDetails("chain"), toolCallId, i, { taskId: `${toolCallId}-${i}`, thinking: step.thinking });
|
|
806
|
+
const result = await runSingleAgent(defaultCwd, agents, discovery.diagnostics, step.agent, taskWithContext, step.cwd, undefined, i + 1, step.model, parentModel, signal, chainUpdate, makeDetails("chain"), toolCallId, i, { taskId: `${toolCallId}-${i}`, thinking: step.thinking });
|
|
777
807
|
results.push(result);
|
|
778
808
|
const isError = isFailedResult(result);
|
|
779
809
|
if (isError) {
|
|
@@ -873,7 +903,7 @@ export function createSubagentToolDefinition(cwd) {
|
|
|
873
903
|
let result;
|
|
874
904
|
for (;;) {
|
|
875
905
|
emitTaskEvent({ type: "start", taskId: g.id, attempt, at: now() });
|
|
876
|
-
result = await runSingleAgent(defaultCwd, agents, g.agent, g.task, g.cwd, g.isolation, undefined, model, parentModel, signal, (partial) => {
|
|
906
|
+
result = await runSingleAgent(defaultCwd, agents, discovery.diagnostics, g.agent, g.task, g.cwd, g.isolation, undefined, model, parentModel, signal, (partial) => {
|
|
877
907
|
if (partial.details?.results[0]) {
|
|
878
908
|
allResults[index] = partial.details.results[0];
|
|
879
909
|
emitParallelUpdate();
|
|
@@ -957,7 +987,7 @@ export function createSubagentToolDefinition(cwd) {
|
|
|
957
987
|
};
|
|
958
988
|
}
|
|
959
989
|
if (params.agent && params.task) {
|
|
960
|
-
const result = await runSingleAgent(defaultCwd, agents, params.agent, params.task, params.cwd, params.isolation, undefined, params.model, parentModel, signal, onUpdate, makeDetails("single"), toolCallId, 0, { taskId: `${toolCallId}-0`, thinking: params.thinking });
|
|
990
|
+
const result = await runSingleAgent(defaultCwd, agents, discovery.diagnostics, params.agent, params.task, params.cwd, params.isolation, undefined, params.model, parentModel, signal, onUpdate, makeDetails("single"), toolCallId, 0, { taskId: `${toolCallId}-0`, thinking: params.thinking });
|
|
961
991
|
const isError = isFailedResult(result);
|
|
962
992
|
if (isError) {
|
|
963
993
|
const errorMsg = getResultOutput(result);
|