@byfriends/agent-core 0.2.3 → 0.2.5
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.
|
@@ -214,6 +214,7 @@ declare const LoopControlSchema: z.ZodObject<{
|
|
|
214
214
|
type LoopControl = z.infer<typeof LoopControlSchema>;
|
|
215
215
|
declare const BackgroundConfigSchema: z.ZodObject<{
|
|
216
216
|
maxRunningTasks: z.ZodOptional<z.ZodNumber>;
|
|
217
|
+
maxConcurrentSubagents: z.ZodOptional<z.ZodNumber>;
|
|
217
218
|
keepAliveOnExit: z.ZodOptional<z.ZodBoolean>;
|
|
218
219
|
killGracePeriodMs: z.ZodOptional<z.ZodNumber>;
|
|
219
220
|
agentTaskTimeoutS: z.ZodOptional<z.ZodNumber>;
|
|
@@ -467,6 +468,7 @@ declare const ByfConfigSchema: z.ZodObject<{
|
|
|
467
468
|
}, z.core.$strip>>;
|
|
468
469
|
background: z.ZodOptional<z.ZodObject<{
|
|
469
470
|
maxRunningTasks: z.ZodOptional<z.ZodNumber>;
|
|
471
|
+
maxConcurrentSubagents: z.ZodOptional<z.ZodNumber>;
|
|
470
472
|
keepAliveOnExit: z.ZodOptional<z.ZodBoolean>;
|
|
471
473
|
killGracePeriodMs: z.ZodOptional<z.ZodNumber>;
|
|
472
474
|
agentTaskTimeoutS: z.ZodOptional<z.ZodNumber>;
|
|
@@ -605,6 +607,7 @@ declare const ByfConfigPatchSchema: z.ZodObject<{
|
|
|
605
607
|
}, z.core.$strip>>;
|
|
606
608
|
background: z.ZodOptional<z.ZodObject<{
|
|
607
609
|
maxRunningTasks: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
610
|
+
maxConcurrentSubagents: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
608
611
|
keepAliveOnExit: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
609
612
|
killGracePeriodMs: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
610
613
|
agentTaskTimeoutS: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
|
|
@@ -2574,10 +2577,13 @@ declare class SessionSubagentHost {
|
|
|
2574
2577
|
private readonly ownerAgentId;
|
|
2575
2578
|
readonly backgroundTaskTimeoutMs?: number | undefined;
|
|
2576
2579
|
private readonly activeChildren;
|
|
2577
|
-
|
|
2580
|
+
/** Maximum concurrent subagents; exposed for testing and config diagnostics. */
|
|
2581
|
+
readonly maxConcurrentSubagents: number;
|
|
2582
|
+
constructor(session: Session, ownerAgentId: string, backgroundTaskTimeoutMs?: number | undefined, maxConcurrentSubagents?: number | undefined);
|
|
2578
2583
|
spawn(profileName: string, options: RunSubagentOptions): Promise<SubagentHandle>;
|
|
2579
2584
|
resume(agentId: string, options: RunSubagentOptions): Promise<SubagentHandle>;
|
|
2580
2585
|
cancelAll(): void;
|
|
2586
|
+
private assertCanSpawn;
|
|
2581
2587
|
getProfileName(agentId: string): string | undefined;
|
|
2582
2588
|
private resolveProfile;
|
|
2583
2589
|
private runChild;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as AGENT_WIRE_PROTOCOL_VERSION } from "./index-DitEeLHK.mjs";
|
|
2
|
-
import { $ as CoreInfo, $n as SessionSkillConfig, $r as resolveByfHome, $t as BackgroundTaskUpdatedEvent, A as QuestionAnswers, Ai as ProviderType, An as TurnStepInterruptedEvent, Ar as LoopStepEndEvent, At as SetModelResult, B as SDKSessionAPI, Bi as LogEntry, Bn as ByfError, Br as BackgroundTaskStatus, Bt as Unsubscribe, C as SDKRPCClient, Ci as PermissionConfigSchema, Cn as ToolProgressEvent, Cr as PromptOrigin, Ct as ResumeSessionPayload, D as ApprovalResponse, Di as PermissionRuleScopeSchema, Dn as TurnEndedEvent, Dr as LoopContentPartEvent, Dt as SetActiveToolsPayload, E as ApprovalRequest, Ei as PermissionRuleSchema, En as TurnEndReason, Er as ToolStoreUpdate, Et as SessionSummary, F as QuestionResult, Fi as ThinkingConfigSchema, Fn as ByfErrorPayload, Fr as ExecutableToolSuccessResult, Ft as SkillSummary, G as AgentAPI, Gi as RootLogger, Gn as ErrorCodes, Gr as parseConfigString, Gt as AgentReplayRecord, H as ToolCallRequest, Hi as LogPayload, Hn as BYF_ERROR_INFO, Hr as OAuthTokenProviderResolver, Ht as WithAgentId, I as SDKAPI, Ii as formatConfigValidationError, In as fromByfErrorPayload, Ir as ToolInputDisplay, It as SteerPayload, J as ByfConfigPatch, Jn as SubagentHandle, Jr as writeConfigFile, Jt as AgentEvent, K as BeginCompactionPayload, Ki as SessionAttachInput, Kn as RuntimeConfig, Kr as readConfigFile, Kt as ResumeSessionResult, L as SDKAgentAPI, Li as getDefaultConfig, Ln as isByfError, Lr as BackgroundLifecycleEvent, Lt as StopBackgroundPayload, M as QuestionOption, Mi as ServicesConfig, Mn as TurnStepStartedEvent, Mr as LoopToolResultEvent, Mt as SetThinkingPayload, N as QuestionRequest, Ni as ServicesConfigSchema, Nn as UsageStatus, Nr as ExecutableToolErrorResult, Nt as ShellExecPayload, O as ApprovalScope, Oi as ProviderConfig, On as TurnStartedEvent, Or as LoopRecordedEvent, Ot as SetByfConfigPayload, P as QuestionResponse, Pi as ThinkingConfig, Pn as WarningEvent, Pr as ExecutableToolResult, Pt as ShellExecResult, Q as CoreAPI, Qn as SessionMeta, Qr as ensureByfHome, Qt as BackgroundTaskTerminatedEvent, R as SDKAgentRPC, Ri as validateConfig, Rn as makeErrorPayload, Rr as BackgroundTaskInfo, Rt as TextPromptPart, S as RPCMethods, Si as PermissionConfig, Sn as ToolListUpdatedReason, Sr as ContextMessage, St as RenameSessionPayload, T as ApprovalDecision, Ti as PermissionRuleDecisionSchema, Tn as ToolUpdate, Tr as UserPromptOrigin, Tt as SessionMetadataPatch, U as ToolCallResponse, Ui as Logger, Un as ByfErrorCode, Ur as configToTomlData, Ut as WithSessionId, V as SDKSessionRPC, Vi as LogLevel, Vn as ByfErrorOptions, Vr as BearerTokenProvider, Vt as UpdateSessionMetadataPayload, W as ActivateSkillPayload, Wi as LoggingConfig, Wn as ByfErrorInfo, Wr as ensureConfigFile, Wt as proxyWithExtraPayload, X as CancelPlanPayload, Xn as Session, Xr as parseBooleanEnv, Xt as AssistantDeltaEvent, Y as CancelPayload, Yn as AgentMeta, Yr as ResolveConfigValueInput, Yt as AgentStatusUpdatedEvent, Z as CloseSessionPayload, Zn as SessionConfig, Zr as resolveConfigValue, Zt as BackgroundTaskStartedEvent, _ as ByfCoreOptions, _i as McpServerStdioConfigSchema, _n as SubagentSpawnedEvent, _r as PermissionMode, _t as PromptPart, a as collectFilesRecursive, ai as ByfConfigSchema, an as Event, ar as redact, at as ForkSessionPayload, b as RPCCallOptions, bi as OAuthRef, bn as ToolCallStartedEvent, br as CompactionResult, bt as RegisterToolPayload, c as WIRE_PROTOCOL_VERSION, ci as HookDefConfig, cn as McpOAuthAuthorizationUrlUpdateData, cr as ToolInfo, ct as GetBackgroundPayload, d as normalizeTimestampMs, di as LoopControlSchema, dn as ObservationMaskingAppliedEvent, dr as AgentRecord, dt as JsonValue, ei as resolveConfigPath, en as CompactionBlockedEvent, er as TelemetryClient, et as CreateSessionPayload, f as scanSessionWire, fi as McpServerConfig, fn as PruningAppliedEvent, fr as AgentRecordEvents, ft as ListSessionsPayload, g as ByfCore, gi as McpServerStdioConfig, gn as SubagentFailedEvent, gr as PermissionApprovalResultRecord, gt as PromptInput, h as AgentType, hi as McpServerHttpConfigSchema, hn as SubagentCompletedEvent, hr as UsageRecordScope, ht as PlanData, i as ExtraZipEntry, ii as ByfConfigPatchSchema, in as ErrorEvent, ir as log, it as ExportSessionResult, j as QuestionItem, ji as ProviderTypeSchema, jn as TurnStepRetryingEvent, jr as LoopToolCallEvent, jt as SetPermissionPayload, k as QuestionAnswerMethod, ki as ProviderConfigSchema, kn as TurnStepCompletedEvent, kr as LoopStepBeginEvent, kt as SetModelPayload, l as buildExportManifest, li as HookDefSchema, ln as McpServerStatusEvent, lr as ToolSource, lt as JsonObject, m as AgentConfig, mi as McpServerHttpConfig, mn as SkillActivatedEvent, mr as AgentRecordPersistence, mt as McpStartupMetrics, n as ResolveLoggingInput, ni as BackgroundConfig, nn as CompactionCompletedEvent, nr as flushDiagnosticLogs, nt as ExportSessionManifest, o as writeExportZip, oi as ByfServiceConfig, on as HookResultEvent, or as resolveGlobalLogPath, ot as GetBackgroundOutputPathPayload, p as Agent, pi as McpServerConfigSchema, pn as SessionMetaUpdatedEvent, pr as AgentRecordOf, pt as McpServerInfo, q as ByfConfig, qi as SessionLogHandle, qn as SessionSubagentHost, qr as transformTomlData, qt as ResumedAgentState, r as resolveLoggingConfig, ri as BackgroundConfigSchema, rn as CompactionStartedEvent, rr as getRootLogger, rt as ExportSessionPayload, s as exportSessionDirectory, si as ByfServiceConfigSchema, sn as MCP_OAUTH_AUTHORIZATION_URL_TOOL_UPDATE, sr as BuiltinTool, st as GetBackgroundOutputPayload, t as buildPromptPlan, ti as mergeConfigPatch, tn as CompactionCancelledEvent, tr as TelemetryProperties, tt as EmptyPayload, u as SessionWireScan, ui as LoopControl, un as McpServerStatusPayload, ur as UserToolRegistration, ut as JsonPrimitive, v as CoreRPC, vi as ModelAlias, vn as ThinkingDeltaEvent, vr as AgentConfigUpdateData, vt as PromptPayload, w as createRPC, wi as PermissionModeSchema, wn as ToolResultEvent, wr as USER_PROMPT_ORIGIN, wt as SessionAPI, x as RPCClient, xi as OAuthRefSchema, xn as ToolListUpdatedEvent, xr as AgentContextData, xt as RemoveByfProviderPayload, y as CoreRPCClient, yi as ModelAliasSchema, yn as ToolCallDeltaEvent, yr as CompactionBeginData, yt as ReconnectMcpServerPayload, z as SDKRPC, zi as LogContext, zn as toByfErrorPayload, zr as BackgroundTaskKind, zt as UnregisterToolPayload } from "./index-
|
|
2
|
+
import { $ as CoreInfo, $n as SessionSkillConfig, $r as resolveByfHome, $t as BackgroundTaskUpdatedEvent, A as QuestionAnswers, Ai as ProviderType, An as TurnStepInterruptedEvent, Ar as LoopStepEndEvent, At as SetModelResult, B as SDKSessionAPI, Bi as LogEntry, Bn as ByfError, Br as BackgroundTaskStatus, Bt as Unsubscribe, C as SDKRPCClient, Ci as PermissionConfigSchema, Cn as ToolProgressEvent, Cr as PromptOrigin, Ct as ResumeSessionPayload, D as ApprovalResponse, Di as PermissionRuleScopeSchema, Dn as TurnEndedEvent, Dr as LoopContentPartEvent, Dt as SetActiveToolsPayload, E as ApprovalRequest, Ei as PermissionRuleSchema, En as TurnEndReason, Er as ToolStoreUpdate, Et as SessionSummary, F as QuestionResult, Fi as ThinkingConfigSchema, Fn as ByfErrorPayload, Fr as ExecutableToolSuccessResult, Ft as SkillSummary, G as AgentAPI, Gi as RootLogger, Gn as ErrorCodes, Gr as parseConfigString, Gt as AgentReplayRecord, H as ToolCallRequest, Hi as LogPayload, Hn as BYF_ERROR_INFO, Hr as OAuthTokenProviderResolver, Ht as WithAgentId, I as SDKAPI, Ii as formatConfigValidationError, In as fromByfErrorPayload, Ir as ToolInputDisplay, It as SteerPayload, J as ByfConfigPatch, Jn as SubagentHandle, Jr as writeConfigFile, Jt as AgentEvent, K as BeginCompactionPayload, Ki as SessionAttachInput, Kn as RuntimeConfig, Kr as readConfigFile, Kt as ResumeSessionResult, L as SDKAgentAPI, Li as getDefaultConfig, Ln as isByfError, Lr as BackgroundLifecycleEvent, Lt as StopBackgroundPayload, M as QuestionOption, Mi as ServicesConfig, Mn as TurnStepStartedEvent, Mr as LoopToolResultEvent, Mt as SetThinkingPayload, N as QuestionRequest, Ni as ServicesConfigSchema, Nn as UsageStatus, Nr as ExecutableToolErrorResult, Nt as ShellExecPayload, O as ApprovalScope, Oi as ProviderConfig, On as TurnStartedEvent, Or as LoopRecordedEvent, Ot as SetByfConfigPayload, P as QuestionResponse, Pi as ThinkingConfig, Pn as WarningEvent, Pr as ExecutableToolResult, Pt as ShellExecResult, Q as CoreAPI, Qn as SessionMeta, Qr as ensureByfHome, Qt as BackgroundTaskTerminatedEvent, R as SDKAgentRPC, Ri as validateConfig, Rn as makeErrorPayload, Rr as BackgroundTaskInfo, Rt as TextPromptPart, S as RPCMethods, Si as PermissionConfig, Sn as ToolListUpdatedReason, Sr as ContextMessage, St as RenameSessionPayload, T as ApprovalDecision, Ti as PermissionRuleDecisionSchema, Tn as ToolUpdate, Tr as UserPromptOrigin, Tt as SessionMetadataPatch, U as ToolCallResponse, Ui as Logger, Un as ByfErrorCode, Ur as configToTomlData, Ut as WithSessionId, V as SDKSessionRPC, Vi as LogLevel, Vn as ByfErrorOptions, Vr as BearerTokenProvider, Vt as UpdateSessionMetadataPayload, W as ActivateSkillPayload, Wi as LoggingConfig, Wn as ByfErrorInfo, Wr as ensureConfigFile, Wt as proxyWithExtraPayload, X as CancelPlanPayload, Xn as Session, Xr as parseBooleanEnv, Xt as AssistantDeltaEvent, Y as CancelPayload, Yn as AgentMeta, Yr as ResolveConfigValueInput, Yt as AgentStatusUpdatedEvent, Z as CloseSessionPayload, Zn as SessionConfig, Zr as resolveConfigValue, Zt as BackgroundTaskStartedEvent, _ as ByfCoreOptions, _i as McpServerStdioConfigSchema, _n as SubagentSpawnedEvent, _r as PermissionMode, _t as PromptPart, a as collectFilesRecursive, ai as ByfConfigSchema, an as Event, ar as redact, at as ForkSessionPayload, b as RPCCallOptions, bi as OAuthRef, bn as ToolCallStartedEvent, br as CompactionResult, bt as RegisterToolPayload, c as WIRE_PROTOCOL_VERSION, ci as HookDefConfig, cn as McpOAuthAuthorizationUrlUpdateData, cr as ToolInfo, ct as GetBackgroundPayload, d as normalizeTimestampMs, di as LoopControlSchema, dn as ObservationMaskingAppliedEvent, dr as AgentRecord, dt as JsonValue, ei as resolveConfigPath, en as CompactionBlockedEvent, er as TelemetryClient, et as CreateSessionPayload, f as scanSessionWire, fi as McpServerConfig, fn as PruningAppliedEvent, fr as AgentRecordEvents, ft as ListSessionsPayload, g as ByfCore, gi as McpServerStdioConfig, gn as SubagentFailedEvent, gr as PermissionApprovalResultRecord, gt as PromptInput, h as AgentType, hi as McpServerHttpConfigSchema, hn as SubagentCompletedEvent, hr as UsageRecordScope, ht as PlanData, i as ExtraZipEntry, ii as ByfConfigPatchSchema, in as ErrorEvent, ir as log, it as ExportSessionResult, j as QuestionItem, ji as ProviderTypeSchema, jn as TurnStepRetryingEvent, jr as LoopToolCallEvent, jt as SetPermissionPayload, k as QuestionAnswerMethod, ki as ProviderConfigSchema, kn as TurnStepCompletedEvent, kr as LoopStepBeginEvent, kt as SetModelPayload, l as buildExportManifest, li as HookDefSchema, ln as McpServerStatusEvent, lr as ToolSource, lt as JsonObject, m as AgentConfig, mi as McpServerHttpConfig, mn as SkillActivatedEvent, mr as AgentRecordPersistence, mt as McpStartupMetrics, n as ResolveLoggingInput, ni as BackgroundConfig, nn as CompactionCompletedEvent, nr as flushDiagnosticLogs, nt as ExportSessionManifest, o as writeExportZip, oi as ByfServiceConfig, on as HookResultEvent, or as resolveGlobalLogPath, ot as GetBackgroundOutputPathPayload, p as Agent, pi as McpServerConfigSchema, pn as SessionMetaUpdatedEvent, pr as AgentRecordOf, pt as McpServerInfo, q as ByfConfig, qi as SessionLogHandle, qn as SessionSubagentHost, qr as transformTomlData, qt as ResumedAgentState, r as resolveLoggingConfig, ri as BackgroundConfigSchema, rn as CompactionStartedEvent, rr as getRootLogger, rt as ExportSessionPayload, s as exportSessionDirectory, si as ByfServiceConfigSchema, sn as MCP_OAUTH_AUTHORIZATION_URL_TOOL_UPDATE, sr as BuiltinTool, st as GetBackgroundOutputPayload, t as buildPromptPlan, ti as mergeConfigPatch, tn as CompactionCancelledEvent, tr as TelemetryProperties, tt as EmptyPayload, u as SessionWireScan, ui as LoopControl, un as McpServerStatusPayload, ur as UserToolRegistration, ut as JsonPrimitive, v as CoreRPC, vi as ModelAlias, vn as ThinkingDeltaEvent, vr as AgentConfigUpdateData, vt as PromptPayload, w as createRPC, wi as PermissionModeSchema, wn as ToolResultEvent, wr as USER_PROMPT_ORIGIN, wt as SessionAPI, x as RPCClient, xi as OAuthRefSchema, xn as ToolListUpdatedEvent, xr as AgentContextData, xt as RemoveByfProviderPayload, y as CoreRPCClient, yi as ModelAliasSchema, yn as ToolCallDeltaEvent, yr as CompactionBeginData, yt as ReconnectMcpServerPayload, z as SDKRPC, zi as LogContext, zn as toByfErrorPayload, zr as BackgroundTaskKind, zt as UnregisterToolPayload } from "./index-Bi8MjEPf.mjs";
|
|
3
3
|
export { AGENT_WIRE_PROTOCOL_VERSION, ActivateSkillPayload, Agent, AgentAPI, AgentConfig, type AgentConfigUpdateData, type AgentContextData, AgentEvent, AgentMeta, type AgentRecord, type AgentRecordEvents, type AgentRecordOf, type AgentRecordPersistence, AgentReplayRecord, AgentStatusUpdatedEvent, AgentType, ApprovalDecision, ApprovalRequest, ApprovalResponse, ApprovalScope, AssistantDeltaEvent, BYF_ERROR_INFO, BackgroundConfig, BackgroundConfigSchema, type BackgroundLifecycleEvent, type BackgroundTaskInfo, type BackgroundTaskKind, BackgroundTaskStartedEvent, type BackgroundTaskStatus, BackgroundTaskTerminatedEvent, BackgroundTaskUpdatedEvent, type BearerTokenProvider, BeginCompactionPayload, type BuiltinTool, ByfConfigPatchSchema, ByfConfigSchema, ByfCore, ByfCoreOptions, ByfError, type ByfErrorCode, type ByfErrorInfo, type ByfErrorOptions, type ByfErrorPayload, ByfServiceConfig, ByfServiceConfigSchema, CancelPayload, CancelPlanPayload, CloseSessionPayload, type CompactionBeginData, CompactionBlockedEvent, CompactionCancelledEvent, CompactionCompletedEvent, CompactionResult, CompactionStartedEvent, type ContextMessage, CoreAPI, CoreInfo, CoreRPC, CoreRPCClient, CreateSessionPayload, EmptyPayload, ErrorCodes, ErrorEvent, Event, type ExecutableToolErrorResult, type ExecutableToolResult, type ExecutableToolSuccessResult, ExportSessionManifest, ExportSessionPayload, ExportSessionResult, ExtraZipEntry, ForkSessionPayload, GetBackgroundOutputPathPayload, GetBackgroundOutputPayload, GetBackgroundPayload, HookDefConfig, HookDefSchema, HookResultEvent, JsonObject, JsonPrimitive, JsonValue, ListSessionsPayload, type LogContext, type LogEntry, type LogLevel, type LogPayload, type Logger, type LoggingConfig, type LoopContentPartEvent, LoopControl, LoopControlSchema, type LoopRecordedEvent, type LoopStepBeginEvent, type LoopStepEndEvent, type LoopToolCallEvent, type LoopToolResultEvent, MCP_OAUTH_AUTHORIZATION_URL_TOOL_UPDATE, McpOAuthAuthorizationUrlUpdateData, McpServerConfig, McpServerConfigSchema, McpServerHttpConfig, McpServerHttpConfigSchema, McpServerInfo, McpServerStatusEvent, McpServerStatusPayload, McpServerStdioConfig, McpServerStdioConfigSchema, McpStartupMetrics, ModelAlias, ModelAliasSchema, OAuthRef, OAuthRefSchema, type OAuthTokenProviderResolver, ObservationMaskingAppliedEvent, type PermissionApprovalResultRecord, PermissionConfig, PermissionConfigSchema, type PermissionMode, PermissionModeSchema, PermissionRuleDecisionSchema, PermissionRuleSchema, PermissionRuleScopeSchema, PlanData, PromptInput, type PromptOrigin, PromptPart, PromptPayload, ProviderConfig, ProviderConfigSchema, ProviderType, ProviderTypeSchema, PruningAppliedEvent, QuestionAnswerMethod, QuestionAnswers, QuestionItem, QuestionOption, QuestionRequest, QuestionResponse, QuestionResult, RPCCallOptions, RPCClient, RPCMethods, ReconnectMcpServerPayload, RegisterToolPayload, RemoveByfProviderPayload, RenameSessionPayload, ResolveConfigValueInput, type ResolveLoggingInput, ResumeSessionPayload, ResumeSessionResult, ResumedAgentState, type RootLogger, type RuntimeConfig, SDKAPI, SDKAgentAPI, SDKAgentRPC, SDKRPC, SDKRPCClient, SDKSessionAPI, SDKSessionRPC, ServicesConfig, ServicesConfigSchema, Session, SessionAPI, type SessionAttachInput, SessionConfig, type SessionLogHandle, SessionMeta, SessionMetaUpdatedEvent, SessionMetadataPatch, SessionSkillConfig, SessionSubagentHost, SessionSummary, SessionWireScan, SetActiveToolsPayload, SetByfConfigPayload, SetModelPayload, SetModelResult, SetPermissionPayload, SetThinkingPayload, ShellExecPayload, ShellExecResult, SkillActivatedEvent, SkillSummary, SteerPayload, StopBackgroundPayload, SubagentCompletedEvent, SubagentFailedEvent, SubagentHandle, SubagentSpawnedEvent, type TelemetryClient, type TelemetryProperties, TextPromptPart, ThinkingConfig, ThinkingConfigSchema, ThinkingDeltaEvent, ToolCallDeltaEvent, ToolCallRequest, ToolCallResponse, ToolCallStartedEvent, type ToolInfo, type ToolInputDisplay, ToolListUpdatedEvent, ToolListUpdatedReason, ToolProgressEvent, ToolResultEvent, type ToolSource, type ToolStoreUpdate, ToolUpdate, TurnEndReason, TurnEndedEvent, TurnStartedEvent, TurnStepCompletedEvent, TurnStepInterruptedEvent, TurnStepRetryingEvent, TurnStepStartedEvent, USER_PROMPT_ORIGIN, UnregisterToolPayload, Unsubscribe, UpdateSessionMetadataPayload, type UsageRecordScope, UsageStatus, type UserPromptOrigin, type UserToolRegistration, WIRE_PROTOCOL_VERSION, WarningEvent, WithAgentId, WithSessionId, buildExportManifest, buildPromptPlan, collectFilesRecursive, configToTomlData, createRPC, ensureByfHome, ensureConfigFile, exportSessionDirectory, flushDiagnosticLogs, formatConfigValidationError, fromByfErrorPayload, getDefaultConfig, getRootLogger, isByfError, log, makeErrorPayload, mergeConfigPatch, normalizeTimestampMs, parseBooleanEnv, parseConfigString, proxyWithExtraPayload, readConfigFile, redact, resolveByfHome, resolveConfigPath, resolveConfigValue, resolveGlobalLogPath, resolveLoggingConfig, scanSessionWire, toByfErrorPayload, transformTomlData, validateConfig, writeConfigFile, writeExportZip };
|
package/dist/index.mjs
CHANGED
|
@@ -2612,7 +2612,7 @@ var agent_background_disabled_default = "Background agent execution is disabled
|
|
|
2612
2612
|
var agent_background_enabled_default = "When `run_in_background=true`, the subagent runs detached from this turn. The completion arrives in a later turn as a synthetic user-role message containing its result — you do not need to poll, sleep, or check on its progress. Continue with other work or respond to the user. Never fabricate or predict what the result will say.\n\nFor a background task, when `timeout` is omitted it falls back to the operator-configured background timeout, if one is set. If the operator has not configured a background timeout, an omitted `timeout` means the task runs with no time limit.\n";
|
|
2613
2613
|
//#endregion
|
|
2614
2614
|
//#region src/tools/builtin/collaboration/agent.md
|
|
2615
|
-
var agent_default = "Launch a subagent to handle a task. The subagent starts with zero context — it has not seen this conversation. Brief it with the goal, what you already know, and exact paths or commands.\n\n- When the task continues earlier work a subagent already did, prefer resuming that agent (pass its `resume` id) over spawning a fresh instance.\n- A subagent's result is only visible to you, not to the user. Summarize the relevant parts yourself when the user needs to see them.\n- Skip delegation for trivial work you can do directly — reading a known file, searching a small set of files, or any one-step task.\n- Once a subagent is running, do not redo its searches or reads in parallel, and do not abandon it midway and finish the job manually.\n";
|
|
2615
|
+
var agent_default = "Launch a subagent to handle a task. The subagent starts with zero context — it has not seen this conversation. Brief it with the goal, what you already know, and exact paths or commands.\n\n- When the task continues earlier work a subagent already did, prefer resuming that agent (pass its `resume` id) over spawning a fresh instance.\n- A subagent's result is only visible to you, not to the user. Summarize the relevant parts yourself when the user needs to see them.\n- Skip delegation for trivial work you can do directly — reading a known file, searching a small set of files, or any one-step task.\n- Once a subagent is running, do not redo its searches or reads in parallel, and do not abandon it midway and finish the job manually.\n- There is a concurrency limit on parallel subagents. If the limit is reached, wait for a running subagent to complete before launching another.\n";
|
|
2616
2616
|
//#endregion
|
|
2617
2617
|
//#region src/tools/builtin/collaboration/agent.ts
|
|
2618
2618
|
/**
|
|
@@ -11628,7 +11628,7 @@ var SkillManager = class {
|
|
|
11628
11628
|
const skill = this.registry.getSkill(input.name);
|
|
11629
11629
|
if (skill === void 0) throw new ByfError(ErrorCodes.SKILL_NOT_FOUND, `Skill "${input.name}" was not found`);
|
|
11630
11630
|
if (!isUserActivatableSkillType(skill.metadata.type)) throw new ByfError(ErrorCodes.SKILL_TYPE_UNSUPPORTED, `Skill "${skill.name}" cannot be activated by the user`);
|
|
11631
|
-
|
|
11631
|
+
const origin = {
|
|
11632
11632
|
kind: "skill_activation",
|
|
11633
11633
|
activationId: randomUUID(),
|
|
11634
11634
|
skillName: skill.name,
|
|
@@ -11637,10 +11637,13 @@ var SkillManager = class {
|
|
|
11637
11637
|
skillPath: skill.path,
|
|
11638
11638
|
skillSource: skill.source,
|
|
11639
11639
|
skillArgs: input.args
|
|
11640
|
-
}
|
|
11640
|
+
};
|
|
11641
|
+
const skillContent = this.registry.renderSkillPrompt(skill, input.args ?? "");
|
|
11642
|
+
this.recordActivation(origin, [{
|
|
11641
11643
|
type: "text",
|
|
11642
|
-
text:
|
|
11644
|
+
text: skillContent
|
|
11643
11645
|
}]);
|
|
11646
|
+
this.agent.context.appendSystemReminder(`<byf-skill-loaded name="${skill.name}">\n${skillContent}\n</byf-skill-loaded>`, origin);
|
|
11644
11647
|
}
|
|
11645
11648
|
recordActivation(origin, input) {
|
|
11646
11649
|
this.agent.emitEvent({
|
|
@@ -12404,9 +12407,8 @@ function createChatStreamingCallbacks(deps) {
|
|
|
12404
12407
|
* enforcement, usage aggregation, optional continuation after non-tool stops,
|
|
12405
12408
|
* and final `TurnResult` mapping. One-step execution lives in `turn-step.ts`.
|
|
12406
12409
|
*/
|
|
12407
|
-
const DEFAULT_MAX_STEPS = 1e3;
|
|
12408
12410
|
async function runTurn(input) {
|
|
12409
|
-
const { turnId, signal, llm, buildMessages, dispatchEvent, tools, hooks, log, maxSteps
|
|
12411
|
+
const { turnId, signal, llm, buildMessages, dispatchEvent, tools, hooks, log, maxSteps, maxRetryAttempts } = input;
|
|
12410
12412
|
let usage = emptyUsage();
|
|
12411
12413
|
let steps = 0;
|
|
12412
12414
|
let stopReason = "end_turn";
|
|
@@ -12417,7 +12419,7 @@ async function runTurn(input) {
|
|
|
12417
12419
|
try {
|
|
12418
12420
|
while (true) {
|
|
12419
12421
|
signal.throwIfAborted();
|
|
12420
|
-
if (steps >= maxSteps) throw createMaxStepsExceededError(maxSteps);
|
|
12422
|
+
if (maxSteps !== void 0 && steps >= maxSteps) throw createMaxStepsExceededError(maxSteps);
|
|
12421
12423
|
steps += 1;
|
|
12422
12424
|
activeStep = steps;
|
|
12423
12425
|
const stepResult = await executeLoopStep({
|
|
@@ -15083,7 +15085,7 @@ var Agent = class {
|
|
|
15083
15085
|
this.usage = new UsageRecorder(this);
|
|
15084
15086
|
this.tools = new ToolManager(this);
|
|
15085
15087
|
this.background = new BackgroundManager(this, {
|
|
15086
|
-
maxRunningTasks: config.backgroundMaxRunningTasks,
|
|
15088
|
+
maxRunningTasks: config.backgroundMaxRunningTasks ?? 10,
|
|
15087
15089
|
sessionDir: config.backgroundSessionDir
|
|
15088
15090
|
});
|
|
15089
15091
|
this.replayBuilder = new ReplayBuilder(this);
|
|
@@ -15455,6 +15457,7 @@ const LoopControlSchema = z.object({
|
|
|
15455
15457
|
});
|
|
15456
15458
|
const BackgroundConfigSchema = z.object({
|
|
15457
15459
|
maxRunningTasks: z.number().int().min(1).optional(),
|
|
15460
|
+
maxConcurrentSubagents: z.number().int().min(1).optional(),
|
|
15458
15461
|
keepAliveOnExit: z.boolean().optional(),
|
|
15459
15462
|
killGracePeriodMs: z.number().int().min(0).optional(),
|
|
15460
15463
|
agentTaskTimeoutS: z.number().int().min(1).optional(),
|
|
@@ -16838,18 +16841,27 @@ const SUMMARY_MAX_LENGTH = 8e3;
|
|
|
16838
16841
|
const SUMMARY_CONTINUATION_ATTEMPTS = 1;
|
|
16839
16842
|
const HOOK_TEXT_PREVIEW_LENGTH = 500;
|
|
16840
16843
|
const SUBAGENT_MAX_TOKENS_ERROR = "Subagent turn failed before completing its final summary: reason=max_tokens";
|
|
16844
|
+
/**
|
|
16845
|
+
* Maximum number of concurrently running subagents per parent.
|
|
16846
|
+
* Prevents cascading subagent proliferation that exhausts LLM bandwidth.
|
|
16847
|
+
*/
|
|
16848
|
+
const DEFAULT_MAX_CONCURRENT_SUBAGENTS = 5;
|
|
16841
16849
|
var SessionSubagentHost = class {
|
|
16842
16850
|
session;
|
|
16843
16851
|
ownerAgentId;
|
|
16844
16852
|
backgroundTaskTimeoutMs;
|
|
16845
16853
|
activeChildren = /* @__PURE__ */ new Map();
|
|
16846
|
-
|
|
16854
|
+
/** Maximum concurrent subagents; exposed for testing and config diagnostics. */
|
|
16855
|
+
maxConcurrentSubagents;
|
|
16856
|
+
constructor(session, ownerAgentId, backgroundTaskTimeoutMs, maxConcurrentSubagents = void 0) {
|
|
16847
16857
|
this.session = session;
|
|
16848
16858
|
this.ownerAgentId = ownerAgentId;
|
|
16849
16859
|
this.backgroundTaskTimeoutMs = backgroundTaskTimeoutMs;
|
|
16860
|
+
this.maxConcurrentSubagents = maxConcurrentSubagents ?? DEFAULT_MAX_CONCURRENT_SUBAGENTS;
|
|
16850
16861
|
}
|
|
16851
16862
|
async spawn(profileName, options) {
|
|
16852
16863
|
options.signal.throwIfAborted();
|
|
16864
|
+
this.assertCanSpawn();
|
|
16853
16865
|
const parent = this.session.agents.get(this.ownerAgentId);
|
|
16854
16866
|
if (parent === void 0) throw new Error(`Parent agent "${this.ownerAgentId}" was not found`);
|
|
16855
16867
|
const profile = this.resolveProfile(parent, profileName);
|
|
@@ -16879,6 +16891,7 @@ var SessionSubagentHost = class {
|
|
|
16879
16891
|
}
|
|
16880
16892
|
async resume(agentId, options) {
|
|
16881
16893
|
options.signal.throwIfAborted();
|
|
16894
|
+
this.assertCanSpawn();
|
|
16882
16895
|
const parent = this.session.agents.get(this.ownerAgentId);
|
|
16883
16896
|
if (parent === void 0) throw new Error(`Parent agent "${this.ownerAgentId}" was not found`);
|
|
16884
16897
|
const child = this.session.agents.get(agentId);
|
|
@@ -16917,6 +16930,9 @@ var SessionSubagentHost = class {
|
|
|
16917
16930
|
child.controller.abort();
|
|
16918
16931
|
}
|
|
16919
16932
|
}
|
|
16933
|
+
assertCanSpawn() {
|
|
16934
|
+
if (this.activeChildren.size >= this.maxConcurrentSubagents) throw new Error(`Too many concurrent subagents (${this.activeChildren.size} running, maximum ${this.maxConcurrentSubagents}).`);
|
|
16935
|
+
}
|
|
16920
16936
|
getProfileName(agentId) {
|
|
16921
16937
|
const metadata = this.session.metadata.agents[agentId];
|
|
16922
16938
|
if (metadata?.type !== "sub" || metadata.parentAgentId !== this.ownerAgentId) return;
|
|
@@ -17314,7 +17330,7 @@ var Session = class {
|
|
|
17314
17330
|
providerManager: this.config.providerManager,
|
|
17315
17331
|
sessionId: this.config.id,
|
|
17316
17332
|
hookEngine: config.hookEngine ?? this.hookEngine,
|
|
17317
|
-
subagentHost: config.subagentHost ?? new SessionSubagentHost(this, id, this.backgroundTaskTimeoutMs()),
|
|
17333
|
+
subagentHost: config.subagentHost ?? new SessionSubagentHost(this, id, this.backgroundTaskTimeoutMs(), this.config.background?.maxConcurrentSubagents),
|
|
17318
17334
|
mcp: this.mcp,
|
|
17319
17335
|
backgroundMaxRunningTasks: this.config.background?.maxRunningTasks,
|
|
17320
17336
|
backgroundSessionDir: homedir,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as SessionSummary, ft as ListSessionsPayload, lt as JsonObject } from "../../index-
|
|
1
|
+
import { Et as SessionSummary, ft as ListSessionsPayload, lt as JsonObject } from "../../index-Bi8MjEPf.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/session/store/session-store.d.ts
|
|
4
4
|
interface CreateSessionRecordInput {
|