@byfriends/agent-core 0.3.0 → 0.3.2
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.
|
@@ -2,17 +2,16 @@ import { CacheHitRate, ChatProvider, ContentPart, FinishReason, Message, ModelCa
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { OAuthClientProvider, OAuthDiscoveryState } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
4
4
|
import { Kaos, KaosProcess } from "@byfriends/kaos";
|
|
5
|
-
import { ActivateSkillPayload, AgentAPI, AgentEvent, SDKAgentRPC, SDKSessionRPC, UsageStatus } from "
|
|
5
|
+
import { ActivateSkillPayload, AgentAPI, AgentEvent, SDKAgentRPC, SDKSessionRPC, UsageStatus } from "./index-BNApCprm.mjs";
|
|
6
6
|
import { OAuthClientInformationMixed, OAuthClientMetadata, OAuthTokens } from "@modelcontextprotocol/sdk/shared/auth.js";
|
|
7
|
-
import { ByfConfig, ByfConfigPatch, OAuthRef } from "
|
|
8
|
-
import { AgentConfigData, AgentConfigUpdateData } from "
|
|
9
|
-
import { AgentContextData, ContextMessage } from "
|
|
10
|
-
import { PermissionApprovalResultRecord, PermissionData, PermissionMode } from "
|
|
11
|
-
import { ToolInfo } from "
|
|
12
|
-
import { AgentType } from "
|
|
13
|
-
import { SessionMeta } from "
|
|
14
|
-
import { BackgroundTaskInfo } from "
|
|
15
|
-
|
|
7
|
+
import { ByfConfig, ByfConfigPatch, OAuthRef } from "./index-BNApCprm.mjs";
|
|
8
|
+
import { AgentConfigData, AgentConfigUpdateData } from "./index-BNApCprm.mjs";
|
|
9
|
+
import { AgentContextData, ContextMessage } from "./index-BNApCprm.mjs";
|
|
10
|
+
import { PermissionApprovalResultRecord, PermissionData, PermissionMode } from "./index-BNApCprm.mjs";
|
|
11
|
+
import { ToolInfo } from "./index-BNApCprm.mjs";
|
|
12
|
+
import { AgentType } from "./index-BNApCprm.mjs";
|
|
13
|
+
import { SessionMeta } from "./index-BNApCprm.mjs";
|
|
14
|
+
import { BackgroundTaskInfo } from "./index-BNApCprm.mjs";
|
|
16
15
|
//#region src/logging/types.d.ts
|
|
17
16
|
type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug';
|
|
18
17
|
type LogContext = Record<string, unknown>;
|
|
@@ -255,20 +254,44 @@ declare const ByfServiceConfigSchema: z.ZodObject<{
|
|
|
255
254
|
customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
256
255
|
}, z.core.$strip>;
|
|
257
256
|
type ByfServiceConfig = z.infer<typeof ByfServiceConfigSchema>;
|
|
258
|
-
declare const
|
|
259
|
-
|
|
257
|
+
declare const WebSearchProviderConfigSchema: z.ZodObject<{
|
|
258
|
+
type: z.ZodEnum<{
|
|
259
|
+
exa: "exa";
|
|
260
|
+
brave: "brave";
|
|
261
|
+
firecrawl: "firecrawl";
|
|
262
|
+
}>;
|
|
263
|
+
apiKeys: z.ZodArray<z.ZodString>;
|
|
264
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
265
|
+
priority: z.ZodNumber;
|
|
266
|
+
}, z.core.$strip>;
|
|
267
|
+
type WebSearchProviderConfig = z.infer<typeof WebSearchProviderConfigSchema>;
|
|
268
|
+
declare const WebSearchConfigSchema: z.ZodObject<{
|
|
269
|
+
providers: z.ZodArray<z.ZodObject<{
|
|
270
|
+
type: z.ZodEnum<{
|
|
271
|
+
exa: "exa";
|
|
272
|
+
brave: "brave";
|
|
273
|
+
firecrawl: "firecrawl";
|
|
274
|
+
}>;
|
|
275
|
+
apiKeys: z.ZodArray<z.ZodString>;
|
|
260
276
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
277
|
+
priority: z.ZodNumber;
|
|
278
|
+
}, z.core.$strip>>;
|
|
279
|
+
}, z.core.$strip>;
|
|
280
|
+
type WebSearchConfig = z.infer<typeof WebSearchConfigSchema>;
|
|
281
|
+
declare const ServicesConfigSchema: z.ZodObject<{
|
|
282
|
+
webSearch: z.ZodOptional<z.ZodObject<{
|
|
283
|
+
providers: z.ZodArray<z.ZodObject<{
|
|
284
|
+
type: z.ZodEnum<{
|
|
285
|
+
exa: "exa";
|
|
286
|
+
brave: "brave";
|
|
287
|
+
firecrawl: "firecrawl";
|
|
266
288
|
}>;
|
|
267
|
-
|
|
289
|
+
apiKeys: z.ZodArray<z.ZodString>;
|
|
290
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
291
|
+
priority: z.ZodNumber;
|
|
268
292
|
}, z.core.$strip>>;
|
|
269
|
-
customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
270
293
|
}, z.core.$strip>>;
|
|
271
|
-
|
|
294
|
+
fetchUrl: z.ZodOptional<z.ZodObject<{
|
|
272
295
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
273
296
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
274
297
|
oauth: z.ZodOptional<z.ZodObject<{
|
|
@@ -432,19 +455,19 @@ declare const ByfConfigSchema: z.ZodObject<{
|
|
|
432
455
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
433
456
|
}, z.core.$strict>>>;
|
|
434
457
|
services: z.ZodOptional<z.ZodObject<{
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
keyring: "keyring";
|
|
458
|
+
webSearch: z.ZodOptional<z.ZodObject<{
|
|
459
|
+
providers: z.ZodArray<z.ZodObject<{
|
|
460
|
+
type: z.ZodEnum<{
|
|
461
|
+
exa: "exa";
|
|
462
|
+
brave: "brave";
|
|
463
|
+
firecrawl: "firecrawl";
|
|
442
464
|
}>;
|
|
443
|
-
|
|
465
|
+
apiKeys: z.ZodArray<z.ZodString>;
|
|
466
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
467
|
+
priority: z.ZodNumber;
|
|
444
468
|
}, z.core.$strip>>;
|
|
445
|
-
customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
446
469
|
}, z.core.$strip>>;
|
|
447
|
-
|
|
470
|
+
fetchUrl: z.ZodOptional<z.ZodObject<{
|
|
448
471
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
449
472
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
450
473
|
oauth: z.ZodOptional<z.ZodObject<{
|
|
@@ -571,19 +594,19 @@ declare const ByfConfigPatchSchema: z.ZodObject<{
|
|
|
571
594
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
572
595
|
}, z.core.$strict>>>;
|
|
573
596
|
services: z.ZodOptional<z.ZodObject<{
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
keyring: "keyring";
|
|
597
|
+
webSearch: z.ZodOptional<z.ZodObject<{
|
|
598
|
+
providers: z.ZodArray<z.ZodObject<{
|
|
599
|
+
type: z.ZodEnum<{
|
|
600
|
+
exa: "exa";
|
|
601
|
+
brave: "brave";
|
|
602
|
+
firecrawl: "firecrawl";
|
|
581
603
|
}>;
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
604
|
+
apiKeys: z.ZodArray<z.ZodString>;
|
|
605
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
606
|
+
priority: z.ZodNumber;
|
|
607
|
+
}, z.core.$strip>>;
|
|
585
608
|
}, z.core.$strip>>;
|
|
586
|
-
|
|
609
|
+
fetchUrl: z.ZodOptional<z.ZodObject<{
|
|
587
610
|
baseUrl: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
588
611
|
apiKey: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
589
612
|
oauth: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
@@ -2248,15 +2271,6 @@ interface AgentRecordEvents {
|
|
|
2248
2271
|
};
|
|
2249
2272
|
'permission.record_approval_result': PermissionApprovalResultRecord$1;
|
|
2250
2273
|
'full_compaction.begin': CompactionBeginData;
|
|
2251
|
-
'plan_mode.enter': {
|
|
2252
|
-
id: string;
|
|
2253
|
-
};
|
|
2254
|
-
'plan_mode.cancel': {
|
|
2255
|
-
id?: string;
|
|
2256
|
-
};
|
|
2257
|
-
'plan_mode.exit': {
|
|
2258
|
-
id?: string;
|
|
2259
|
-
};
|
|
2260
2274
|
'tools.register_user_tool': UserToolRegistration;
|
|
2261
2275
|
'tools.unregister_user_tool': {
|
|
2262
2276
|
name: string;
|
|
@@ -3413,9 +3427,6 @@ type Event = AgentEvent$1 & {
|
|
|
3413
3427
|
type AgentReplayRecord = {
|
|
3414
3428
|
type: 'message';
|
|
3415
3429
|
message: ContextMessage;
|
|
3416
|
-
} | {
|
|
3417
|
-
type: 'plan_updated';
|
|
3418
|
-
enabled: boolean;
|
|
3419
3430
|
} | {
|
|
3420
3431
|
type: 'config_updated';
|
|
3421
3432
|
config: AgentConfigUpdateData;
|
|
@@ -3432,7 +3443,6 @@ interface ResumedAgentState {
|
|
|
3432
3443
|
readonly context: AgentContextData;
|
|
3433
3444
|
readonly replay: readonly AgentReplayRecord[];
|
|
3434
3445
|
readonly permission: PermissionData;
|
|
3435
|
-
readonly plan: PlanData;
|
|
3436
3446
|
readonly usage: UsageStatus$1;
|
|
3437
3447
|
readonly tools: readonly ToolInfo[];
|
|
3438
3448
|
readonly toolStore?: Readonly<Record<string, unknown>>;
|
|
@@ -3463,7 +3473,6 @@ type WithSessionId<T> = WithExtraPayload<T, {
|
|
|
3463
3473
|
declare function proxyWithExtraPayload<T, U>(methods: RPCMethods<WithExtraPayload<T, U>>, extraPayload: U): RPCMethods<T>;
|
|
3464
3474
|
//#endregion
|
|
3465
3475
|
//#region src/rpc/core-api.d.ts
|
|
3466
|
-
type PlanData = null;
|
|
3467
3476
|
type JsonPrimitive = string | number | boolean | null;
|
|
3468
3477
|
type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
3469
3478
|
readonly [key: string]: JsonValue;
|
|
@@ -3574,9 +3583,6 @@ interface SetModelResult {
|
|
|
3574
3583
|
readonly model: string;
|
|
3575
3584
|
readonly providerName?: string | undefined;
|
|
3576
3585
|
}
|
|
3577
|
-
interface CancelPlanPayload {
|
|
3578
|
-
readonly id?: string;
|
|
3579
|
-
}
|
|
3580
3586
|
interface BeginCompactionPayload {
|
|
3581
3587
|
readonly instruction?: string;
|
|
3582
3588
|
}
|
|
@@ -3668,9 +3674,6 @@ interface AgentAPI$1 {
|
|
|
3668
3674
|
setPermission: (payload: SetPermissionPayload) => void;
|
|
3669
3675
|
setModel: (payload: SetModelPayload) => SetModelResult;
|
|
3670
3676
|
getModel: (payload: EmptyPayload) => string;
|
|
3671
|
-
enterPlan: (payload: EmptyPayload) => void;
|
|
3672
|
-
cancelPlan: (payload: CancelPlanPayload) => void;
|
|
3673
|
-
clearPlan: (payload: EmptyPayload) => void;
|
|
3674
3677
|
beginCompaction: (payload: BeginCompactionPayload) => void;
|
|
3675
3678
|
cancelCompaction: (payload: EmptyPayload) => void;
|
|
3676
3679
|
registerTool: (payload: RegisterToolPayload) => void;
|
|
@@ -3684,7 +3687,6 @@ interface AgentAPI$1 {
|
|
|
3684
3687
|
getContext: (payload: EmptyPayload) => AgentContextData;
|
|
3685
3688
|
getConfig: (payload: EmptyPayload) => AgentConfigData;
|
|
3686
3689
|
getPermission: (payload: EmptyPayload) => PermissionData;
|
|
3687
|
-
getPlan: (payload: EmptyPayload) => PlanData;
|
|
3688
3690
|
getUsage: (payload: EmptyPayload) => UsageStatus$1;
|
|
3689
3691
|
getTools: (payload: EmptyPayload) => readonly ToolInfo[];
|
|
3690
3692
|
getBackground: (payload: GetBackgroundPayload) => readonly BackgroundTaskInfo[];
|
|
@@ -3865,18 +3867,6 @@ declare class ByfCore implements PromisableMethods<CoreAPI> {
|
|
|
3865
3867
|
sessionId,
|
|
3866
3868
|
...payload
|
|
3867
3869
|
}: SessionAgentPayload<EmptyPayload>): string | Promise<string>;
|
|
3868
|
-
enterPlan({
|
|
3869
|
-
sessionId,
|
|
3870
|
-
...payload
|
|
3871
|
-
}: SessionAgentPayload<EmptyPayload>): void | Promise<void>;
|
|
3872
|
-
cancelPlan({
|
|
3873
|
-
sessionId,
|
|
3874
|
-
...payload
|
|
3875
|
-
}: SessionAgentPayload<CancelPlanPayload>): void | Promise<void>;
|
|
3876
|
-
clearPlan({
|
|
3877
|
-
sessionId,
|
|
3878
|
-
...payload
|
|
3879
|
-
}: SessionAgentPayload<EmptyPayload>): void | Promise<void>;
|
|
3880
3870
|
beginCompaction({
|
|
3881
3871
|
sessionId,
|
|
3882
3872
|
...payload
|
|
@@ -3929,10 +3919,6 @@ declare class ByfCore implements PromisableMethods<CoreAPI> {
|
|
|
3929
3919
|
sessionId,
|
|
3930
3920
|
...payload
|
|
3931
3921
|
}: SessionAgentPayload<EmptyPayload>): PermissionData$1 | Promise<PermissionData$1>;
|
|
3932
|
-
getPlan({
|
|
3933
|
-
sessionId,
|
|
3934
|
-
...payload
|
|
3935
|
-
}: SessionAgentPayload<EmptyPayload>): Promise<null> | null;
|
|
3936
3922
|
getUsage({
|
|
3937
3923
|
sessionId,
|
|
3938
3924
|
...payload
|
|
@@ -4162,4 +4148,5 @@ declare function resolveLoggingConfig(input: ResolveLoggingInput): LoggingConfig
|
|
|
4162
4148
|
//#region src/prompt-plan/builder.d.ts
|
|
4163
4149
|
declare function buildPromptPlan(renderedSystemPrompt: string, providerCacheCapability: ProviderCacheCapability): PromptPlan;
|
|
4164
4150
|
//#endregion
|
|
4165
|
-
export {
|
|
4151
|
+
export { CreateSessionPayload as $, TelemetryProperties as $n, mergeConfigPatch as $r, CompactionCancelledEvent as $t, QuestionAnswers as A, ServicesConfig as Ai, TurnStepStartedEvent as An, LoopToolResultEvent as Ar, SetThinkingPayload as At, SDKSessionAPI as B, validateConfig as Bi, BYF_ERROR_INFO as Bn, OAuthTokenProviderResolver as Br, WithAgentId as Bt, SDKRPCClient as C, PermissionRuleDecisionSchema as Ci, ToolUpdate as Cn, UserPromptOrigin as Cr, SessionMetadataPatch as Ct, ApprovalResponse as D, ProviderConfigSchema as Di, TurnStepCompletedEvent as Dn, LoopStepBeginEvent as Dr, SetModelPayload as Dt, ApprovalRequest as E, ProviderConfig$1 as Ei, TurnStartedEvent as En, LoopRecordedEvent as Er, SetByfConfigPayload as Et, QuestionResult as F, WebSearchConfigSchema as Fi, isByfError as Fn, BackgroundLifecycleEvent as Fr, StopBackgroundPayload as Ft, AgentAPI$1 as G, Logger as Gi, SessionSubagentHost as Gn, transformTomlData as Gr, ResumedAgentState as Gt, ToolCallRequest as H, LogEntry as Hi, ByfErrorInfo as Hn, ensureConfigFile as Hr, proxyWithExtraPayload as Ht, SDKAPI as I, WebSearchProviderConfig as Ii, makeErrorPayload as In, BackgroundTaskInfo$1 as Ir, TextPromptPart as It, ByfConfigPatch as J, SessionAttachInput as Ji, Session as Jn, parseBooleanEnv as Jr, AssistantDeltaEvent as Jt, BeginCompactionPayload as K, LoggingConfig as Ki, SubagentHandle as Kn, writeConfigFile as Kr, AgentEvent$1 as Kt, SDKAgentAPI as L, WebSearchProviderConfigSchema as Li, toByfErrorPayload as Ln, BackgroundTaskKind as Lr, UnregisterToolPayload as Lt, QuestionOption as M, ThinkingConfig as Mi, WarningEvent as Mn, ExecutableToolResult as Mr, ShellExecResult as Mt, QuestionRequest as N, ThinkingConfigSchema as Ni, ByfErrorPayload as Nn, ExecutableToolSuccessResult as Nr, SkillSummary as Nt, ApprovalScope as O, ProviderType as Oi, TurnStepInterruptedEvent as On, LoopStepEndEvent as Or, SetModelResult as Ot, QuestionResponse as P, WebSearchConfig as Pi, fromByfErrorPayload as Pn, ToolInputDisplay as Pr, SteerPayload as Pt, CoreInfo as Q, TelemetryClient as Qn, resolveConfigPath as Qr, CompactionBlockedEvent as Qt, SDKAgentRPC$1 as R, formatConfigValidationError as Ri, ByfError as Rn, BackgroundTaskStatus as Rr, Unsubscribe as Rt, RPCMethods as S, PermissionModeSchema as Si, ToolResultEvent as Sn, USER_PROMPT_ORIGIN as Sr, SessionAPI as St, ApprovalDecision as T, PermissionRuleScopeSchema as Ti, TurnEndedEvent as Tn, LoopContentPartEvent as Tr, SetActiveToolsPayload as Tt, ToolCallResponse as U, LogLevel as Ui, ErrorCodes as Un, parseConfigString as Ur, AgentReplayRecord as Ut, SDKSessionRPC$1 as V, LogContext as Vi, ByfErrorCode as Vn, configToTomlData as Vr, WithSessionId as Vt, ActivateSkillPayload$1 as W, LogPayload as Wi, RuntimeConfig as Wn, readConfigFile as Wr, ResumeSessionResult as Wt, CloseSessionPayload as X, SessionMeta$1 as Xn, ensureByfHome as Xr, BackgroundTaskTerminatedEvent as Xt, CancelPayload as Y, SessionLogHandle as Yi, SessionConfig as Yn, resolveConfigValue as Yr, BackgroundTaskStartedEvent as Yt, CoreAPI as Z, SessionSkillConfig as Zn, resolveByfHome as Zr, BackgroundTaskUpdatedEvent as Zt, ByfCoreOptions as _, ModelAliasSchema as _i, ToolCallDeltaEvent as _n, CompactionBeginData as _r, ReconnectMcpServerPayload as _t, collectFilesRecursive as a, ByfServiceConfigSchema as ai, MCP_OAUTH_AUTHORIZATION_URL_TOOL_UPDATE as an, BuiltinTool as ar, GetBackgroundOutputPathPayload as at, RPCCallOptions as b, PermissionConfig as bi, ToolListUpdatedReason as bn, ContextMessage$1 as br, RenameSessionPayload as bt, WIRE_PROTOCOL_VERSION as c, LoopControl as ci, McpServerStatusPayload as cn, UserToolRegistration as cr, JsonObject as ct, normalizeTimestampMs as d, McpServerConfigSchema as di, SessionMetaUpdatedEvent as dn, AgentRecordOf as dr, ListSessionsPayload as dt, BackgroundConfig as ei, CompactionCompletedEvent as en, flushDiagnosticLogs as er, EmptyPayload as et, scanSessionWire as f, McpServerHttpConfig as fi, SkillActivatedEvent as fn, AgentRecordPersistence as fr, McpServerInfo as ft, ByfCore as g, ModelAlias as gi, ThinkingDeltaEvent as gn, AgentConfigUpdateData$1 as gr, PromptPayload as gt, AgentType$1 as h, McpServerStdioConfigSchema as hi, SubagentSpawnedEvent as hn, PermissionMode$1 as hr, PromptPart as ht, ExtraZipEntry as i, ByfServiceConfig as ii, HookResultEvent as in, resolveGlobalLogPath as ir, ForkSessionPayload as it, QuestionItem as j, ServicesConfigSchema as ji, UsageStatus$1 as jn, ExecutableToolErrorResult as jr, ShellExecPayload as jt, QuestionAnswerMethod as k, ProviderTypeSchema as ki, TurnStepRetryingEvent as kn, LoopToolCallEvent as kr, SetPermissionPayload as kt, buildExportManifest as l, LoopControlSchema as li, ObservationMaskingAppliedEvent as ln, AgentRecord as lr, JsonPrimitive as lt, AgentConfig as m, McpServerStdioConfig as mi, SubagentFailedEvent as mn, PermissionApprovalResultRecord$1 as mr, PromptInput as mt, ResolveLoggingInput as n, ByfConfigPatchSchema as ni, ErrorEvent as nn, log as nr, ExportSessionPayload as nt, writeExportZip as o, HookDefConfig as oi, McpOAuthAuthorizationUrlUpdateData as on, ToolInfo$1 as or, GetBackgroundOutputPayload as ot, Agent as p, McpServerHttpConfigSchema as pi, SubagentCompletedEvent as pn, UsageRecordScope as pr, McpStartupMetrics as pt, ByfConfig as q, RootLogger as qi, AgentMeta as qn, ResolveConfigValueInput as qr, AgentStatusUpdatedEvent as qt, resolveLoggingConfig as r, ByfConfigSchema as ri, Event as rn, redact as rr, ExportSessionResult as rt, exportSessionDirectory as s, HookDefSchema as si, McpServerStatusEvent as sn, ToolSource as sr, GetBackgroundPayload as st, buildPromptPlan as t, BackgroundConfigSchema as ti, CompactionStartedEvent as tn, getRootLogger as tr, ExportSessionManifest as tt, SessionWireScan as u, McpServerConfig as ui, PruningAppliedEvent as un, AgentRecordEvents as ur, JsonValue as ut, CoreRPC as v, OAuthRef$1 as vi, ToolCallStartedEvent as vn, CompactionResult$1 as vr, RegisterToolPayload as vt, createRPC as w, PermissionRuleSchema as wi, TurnEndReason as wn, ToolStoreUpdate as wr, SessionSummary as wt, RPCClient as x, PermissionConfigSchema as xi, ToolProgressEvent as xn, PromptOrigin as xr, ResumeSessionPayload as xt, CoreRPCClient as y, OAuthRefSchema as yi, ToolListUpdatedEvent as yn, AgentContextData$1 as yr, RemoveByfProviderPayload as yt, SDKRPC as z, getDefaultConfig as zi, ByfErrorOptions as zn, BearerTokenProvider as zr, UpdateSessionMetadataPayload as zt };
|
|
4152
|
+
export { ActivateSkillPayload$1 as ActivateSkillPayload, AgentAPI$1 as AgentAPI, AgentEvent$1 as AgentEvent, SDKAgentRPC$1 as SDKAgentRPC, SDKSessionRPC$1 as SDKSessionRPC, UsageStatus$1 as UsageStatus, ByfConfig$1 as ByfConfig, ByfConfigPatch$1 as ByfConfigPatch, OAuthRef$1 as OAuthRef, AgentConfigData$1 as AgentConfigData, AgentConfigUpdateData$1 as AgentConfigUpdateData, AgentContextData$1 as AgentContextData, ContextMessage$1 as ContextMessage, PermissionApprovalResultRecord$1 as PermissionApprovalResultRecord, PermissionData$1 as PermissionData, PermissionMode$1 as PermissionMode, ToolInfo$1 as ToolInfo, AgentType$1 as AgentType, SessionMeta$1 as SessionMeta, BackgroundTaskInfo$1 as BackgroundTaskInfo };
|
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
|
|
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,
|
|
2
|
+
import { $ as CreateSessionPayload, $n as TelemetryProperties, $r as mergeConfigPatch, $t as CompactionCancelledEvent, A as QuestionAnswers, Ai as ServicesConfig, An as TurnStepStartedEvent, Ar as LoopToolResultEvent, At as SetThinkingPayload, B as SDKSessionAPI, Bi as validateConfig, Bn as BYF_ERROR_INFO, Br as OAuthTokenProviderResolver, Bt as WithAgentId, C as SDKRPCClient, Ci as PermissionRuleDecisionSchema, Cn as ToolUpdate, Cr as UserPromptOrigin, Ct as SessionMetadataPatch, D as ApprovalResponse, Di as ProviderConfigSchema, Dn as TurnStepCompletedEvent, Dr as LoopStepBeginEvent, Dt as SetModelPayload, E as ApprovalRequest, Ei as ProviderConfig, En as TurnStartedEvent, Er as LoopRecordedEvent, Et as SetByfConfigPayload, F as QuestionResult, Fi as WebSearchConfigSchema, Fn as isByfError, Fr as BackgroundLifecycleEvent, Ft as StopBackgroundPayload, G as AgentAPI, Gi as Logger, Gn as SessionSubagentHost, Gr as transformTomlData, Gt as ResumedAgentState, H as ToolCallRequest, Hi as LogEntry, Hn as ByfErrorInfo, Hr as ensureConfigFile, Ht as proxyWithExtraPayload, I as SDKAPI, Ii as WebSearchProviderConfig, In as makeErrorPayload, Ir as BackgroundTaskInfo, It as TextPromptPart, J as ByfConfigPatch, Ji as SessionAttachInput, Jn as Session, Jr as parseBooleanEnv, Jt as AssistantDeltaEvent, K as BeginCompactionPayload, Ki as LoggingConfig, Kn as SubagentHandle, Kr as writeConfigFile, Kt as AgentEvent, L as SDKAgentAPI, Li as WebSearchProviderConfigSchema, Ln as toByfErrorPayload, Lr as BackgroundTaskKind, Lt as UnregisterToolPayload, M as QuestionOption, Mi as ThinkingConfig, Mn as WarningEvent, Mr as ExecutableToolResult, Mt as ShellExecResult, N as QuestionRequest, Ni as ThinkingConfigSchema, Nn as ByfErrorPayload, Nr as ExecutableToolSuccessResult, Nt as SkillSummary, O as ApprovalScope, Oi as ProviderType, On as TurnStepInterruptedEvent, Or as LoopStepEndEvent, Ot as SetModelResult, P as QuestionResponse, Pi as WebSearchConfig, Pn as fromByfErrorPayload, Pr as ToolInputDisplay, Pt as SteerPayload, Q as CoreInfo, Qn as TelemetryClient, Qr as resolveConfigPath, Qt as CompactionBlockedEvent, R as SDKAgentRPC, Ri as formatConfigValidationError, Rn as ByfError, Rr as BackgroundTaskStatus, Rt as Unsubscribe, S as RPCMethods, Si as PermissionModeSchema, Sn as ToolResultEvent, Sr as USER_PROMPT_ORIGIN, St as SessionAPI, T as ApprovalDecision, Ti as PermissionRuleScopeSchema, Tn as TurnEndedEvent, Tr as LoopContentPartEvent, Tt as SetActiveToolsPayload, U as ToolCallResponse, Ui as LogLevel, Un as ErrorCodes, Ur as parseConfigString, Ut as AgentReplayRecord, V as SDKSessionRPC, Vi as LogContext, Vn as ByfErrorCode, Vr as configToTomlData, Vt as WithSessionId, W as ActivateSkillPayload, Wi as LogPayload, Wn as RuntimeConfig, Wr as readConfigFile, Wt as ResumeSessionResult, X as CloseSessionPayload, Xn as SessionMeta, Xr as ensureByfHome, Xt as BackgroundTaskTerminatedEvent, Y as CancelPayload, Yi as SessionLogHandle, Yn as SessionConfig, Yr as resolveConfigValue, Yt as BackgroundTaskStartedEvent, Z as CoreAPI, Zn as SessionSkillConfig, Zr as resolveByfHome, Zt as BackgroundTaskUpdatedEvent, _ as ByfCoreOptions, _i as ModelAliasSchema, _n as ToolCallDeltaEvent, _r as CompactionBeginData, _t as ReconnectMcpServerPayload, a as collectFilesRecursive, ai as ByfServiceConfigSchema, an as MCP_OAUTH_AUTHORIZATION_URL_TOOL_UPDATE, ar as BuiltinTool, at as GetBackgroundOutputPathPayload, b as RPCCallOptions, bi as PermissionConfig, bn as ToolListUpdatedReason, br as ContextMessage, bt as RenameSessionPayload, c as WIRE_PROTOCOL_VERSION, ci as LoopControl, cn as McpServerStatusPayload, cr as UserToolRegistration, ct as JsonObject, d as normalizeTimestampMs, di as McpServerConfigSchema, dn as SessionMetaUpdatedEvent, dr as AgentRecordOf, dt as ListSessionsPayload, ei as BackgroundConfig, en as CompactionCompletedEvent, er as flushDiagnosticLogs, et as EmptyPayload, f as scanSessionWire, fi as McpServerHttpConfig, fn as SkillActivatedEvent, fr as AgentRecordPersistence, ft as McpServerInfo, g as ByfCore, gi as ModelAlias, gn as ThinkingDeltaEvent, gr as AgentConfigUpdateData, gt as PromptPayload, h as AgentType, hi as McpServerStdioConfigSchema, hn as SubagentSpawnedEvent, hr as PermissionMode, ht as PromptPart, i as ExtraZipEntry, ii as ByfServiceConfig, in as HookResultEvent, ir as resolveGlobalLogPath, it as ForkSessionPayload, j as QuestionItem, ji as ServicesConfigSchema, jn as UsageStatus, jr as ExecutableToolErrorResult, jt as ShellExecPayload, k as QuestionAnswerMethod, ki as ProviderTypeSchema, kn as TurnStepRetryingEvent, kr as LoopToolCallEvent, kt as SetPermissionPayload, l as buildExportManifest, li as LoopControlSchema, ln as ObservationMaskingAppliedEvent, lr as AgentRecord, lt as JsonPrimitive, m as AgentConfig, mi as McpServerStdioConfig, mn as SubagentFailedEvent, mr as PermissionApprovalResultRecord, mt as PromptInput, n as ResolveLoggingInput, ni as ByfConfigPatchSchema, nn as ErrorEvent, nr as log, nt as ExportSessionPayload, o as writeExportZip, oi as HookDefConfig, on as McpOAuthAuthorizationUrlUpdateData, or as ToolInfo, ot as GetBackgroundOutputPayload, p as Agent, pi as McpServerHttpConfigSchema, pn as SubagentCompletedEvent, pr as UsageRecordScope, pt as McpStartupMetrics, q as ByfConfig, qi as RootLogger, qn as AgentMeta, qr as ResolveConfigValueInput, qt as AgentStatusUpdatedEvent, r as resolveLoggingConfig, ri as ByfConfigSchema, rn as Event, rr as redact, rt as ExportSessionResult, s as exportSessionDirectory, si as HookDefSchema, sn as McpServerStatusEvent, sr as ToolSource, st as GetBackgroundPayload, t as buildPromptPlan, ti as BackgroundConfigSchema, tn as CompactionStartedEvent, tr as getRootLogger, tt as ExportSessionManifest, u as SessionWireScan, ui as McpServerConfig, un as PruningAppliedEvent, ur as AgentRecordEvents, ut as JsonValue, v as CoreRPC, vi as OAuthRef, vn as ToolCallStartedEvent, vr as CompactionResult, vt as RegisterToolPayload, w as createRPC, wi as PermissionRuleSchema, wn as TurnEndReason, wr as ToolStoreUpdate, wt as SessionSummary, x as RPCClient, xi as PermissionConfigSchema, xn as ToolProgressEvent, xr as PromptOrigin, xt as ResumeSessionPayload, y as CoreRPCClient, yi as OAuthRefSchema, yn as ToolListUpdatedEvent, yr as AgentContextData, yt as RemoveByfProviderPayload, z as SDKRPC, zi as getDefaultConfig, zn as ByfErrorOptions, zr as BearerTokenProvider, zt as UpdateSessionMetadataPayload } from "./index-BNApCprm.mjs";
|
|
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, 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, 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, WebSearchConfig, WebSearchConfigSchema, WebSearchProviderConfig, WebSearchProviderConfigSchema, 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
|
@@ -3153,14 +3153,36 @@ function isRecord$1(value) {
|
|
|
3153
3153
|
var mcp_config_default = "---\nname: mcp-config\ndescription: Configure MCP servers and handle MCP OAuth login.\n---\n\n# Interactive MCP server configuration\n\nThe user invoked this skill through `/mcp-config` or `/skill:mcp-config`.\nEither they want to log into an MCP server that asked for OAuth, or they\nwant to edit the `mcp.json` that lists MCP servers. The work is small and\nlocal — handle it on this turn yourself, no agents or planning todos.\n\nPick the flow from the user's message and your tool list:\n\n- An `mcp__<server>__authenticate` tool is in your list, the user says\n \"log in\" / \"auth\" / \"sign in\", they invoke `/mcp-config login\n <server>`, or they quote a `needs-auth` status → **Login**.\n- Add / edit / remove / list of an `mcp.json` entry → **Config edit**.\n- Bare `/mcp-config` with no `authenticate` tool in your list →\n **Config edit**. If there were a pending login, the authenticate tool\n would be in your list.\n\n## Login\n\nEach MCP server in `needs-auth` exposes one `mcp__<server>__authenticate`\ntool. Call it for the server the user means — its own description owns\nthe OAuth UX (printing the URL, blocking on the callback, reconnecting on\nsuccess). Surface its output verbatim, including the authorization URL\nunchanged; the URL contains state and PKCE parameters that break if\nedited.\n\nIf the user named a server that has no authenticate tool, say so in one\nsentence and stop — do **not** fall into config edit. They're trying to\nlog in to a server that isn't currently waiting for login; quietly\nrewriting `mcp.json` would be the wrong fix. If multiple authenticate\ntools exist and the user didn't name one, ask which.\n\n## Config edit\n\nConfig lives in two files; on key collision the project file overrides\nthe user-global one:\n\n- User-global: `~/.byf/mcp.json` (or `$BYF_HOME/mcp.json` if\n set). Use for servers you want everywhere.\n- Project-local: `<cwd>/.byf/mcp.json`. Mention once that stdio\n entries spawn commands at session start, so this should only live in\n trusted repos.\n\nBoth files wrap their entries the same way:\n\n```json\n{ \"mcpServers\": { \"<name>\": { /* entry */ } } }\n```\n\nA minimal stdio entry needs `command` (+ optional `args`, `env`, `cwd`).\nA minimal http entry needs `url`; add `bearerTokenEnvVar: \"ENV_NAME\"` for\nservers that authenticate with a static bearer token from the\nenvironment. Servers that use OAuth take no token field — the login flow\nabove handles them. `transport` is inferred from `command` vs `url`, so\nomit it. For less common fields (`enabled`, `startupTimeoutMs`,\n`toolTimeoutMs`, `enabledTools`, `disabledTools`, `headers`) the source of\ntruth is `McpServerStdioConfigSchema` / `McpServerHttpConfigSchema` in\n`packages/agent-core/src/config/schema.ts`.\n\nIf the user only wants to **see** what's configured, read both files,\nshow a merged view, and stop — no scope prompt, no write.\n\nFor changes, the flow is:\n\n1. **Pick a scope.** Infer it from the user's words when you can\n (project / repo / this checkout / cwd → project; global / everywhere /\n all projects → user-global). When the request is genuinely scope-less,\n use one `AskUserQuestion` to ask user-global vs project-local, defaulting\n to user-global. Use plain text for every other question — `AskUserQuestion`\n is a poor fit for free-form input. If the user dismisses the scope\n question, stop; you can't safely guess where they wanted the change.\n2. **Read and announce.** Read the target file (a missing or empty file\n is fine; you'll create `{ \"mcpServers\": {} }`). If JSON parsing fails,\n surface the error verbatim and stop — silently overwriting a broken\n file could destroy work. Then show the user the target path, what's\n currently in it, and the entry you're about to write or delete. This\n is for transparency, not a confirmation gate — the Edit/Write\n permission prompt is the real gate, and your message is what gives\n the user context when that prompt appears. In yolo / afk modes there\n is no prompt, which is those modes' explicit contract.\n3. **Write and tell them how to reload MCP servers.** Preserve unrelated\n entries and the `mcpServers` wrapper. MCP servers load at session\n start, so tell the user to start a new session (for example `/new`) or\n restart BYF for the change to take effect.\n\n## Secrets\n\nDon't store secrets (tokens, keys, passwords) as literals in\n`mcp.json` — it's a plain config file on disk. http servers should use\n`bearerTokenEnvVar` to reference an env var instead; if a stdio entry\nmust inline one in `env`, warn the user before writing.\n";
|
|
3154
3154
|
//#endregion
|
|
3155
3155
|
//#region src/skill/builtin/mcp-config.ts
|
|
3156
|
-
const PSEUDO_PATH = "builtin://mcp-config";
|
|
3157
|
-
const parsed = parseSkillText({
|
|
3156
|
+
const PSEUDO_PATH$1 = "builtin://mcp-config";
|
|
3157
|
+
const parsed$1 = parseSkillText({
|
|
3158
3158
|
skillMdPath: "/builtin/skills/mcp-config.md",
|
|
3159
3159
|
skillDirName: "mcp-config",
|
|
3160
3160
|
source: "builtin",
|
|
3161
3161
|
text: mcp_config_default
|
|
3162
3162
|
});
|
|
3163
3163
|
const MCP_CONFIG_SKILL = {
|
|
3164
|
+
...parsed$1,
|
|
3165
|
+
path: PSEUDO_PATH$1,
|
|
3166
|
+
dir: PSEUDO_PATH$1,
|
|
3167
|
+
metadata: {
|
|
3168
|
+
...parsed$1.metadata,
|
|
3169
|
+
type: parsed$1.metadata.type ?? "inline",
|
|
3170
|
+
disableModelInvocation: true
|
|
3171
|
+
}
|
|
3172
|
+
};
|
|
3173
|
+
//#endregion
|
|
3174
|
+
//#region src/skill/builtin/update-config.md
|
|
3175
|
+
var update_config_default = "---\nname: update-config\ndescription: Audit and fix ~/.byf/config.toml — remove deprecated fields, migrate legacy settings, and flag semantic conflicts.\n---\n\n# Audit and fix config.toml\n\nThe user invoked this skill via `/update-config` or `/skill:update-config`.\nThe goal is to bring `~/.byf/config.toml` in line with the current BYF schema:\nremove deprecated fields, migrate legacy settings, and point out semantic\nconflicts that a deterministic linter cannot catch. The work is small and\nlocal — handle it on this turn yourself, no agents or planning todos.\n\n## Read the config\n\n1. **Resolve the path.** Default: `~/.byf/config.toml` (or\n `$BYF_HOME/config.toml` if that env var is set). If the user passed a path\n as an argument, use that instead.\n2. **Read the file.** If it does not exist, say so and stop — there is nothing\n to update. If the TOML fails to parse, surface the parse error verbatim and\n **stop** — do not overwrite a broken file, that could destroy the user's\n work.\n3. **Never echo secrets.** `config.toml` stores `api_key` secret values, and\n `oauth` references (a `{ storage, key }` handle that points at a\n file/keyring entry — not the token itself). When you describe what you\n found or plan to change, state only that a credential is present or\n absent — never quote the `api_key` value itself, not even partially.\n\n## What to check for\n\nField-level validity (which keys exist, what types and enums are allowed) is\n**not** something to reproduce here. The single source of truth is\n`ByfConfigSchema` in `packages/agent-core/src/config/schema.ts` — read it when\nyou need to confirm whether a field is recognized and what values it accepts.\n\nThe checks below fall into three groups. Report findings from all three before\nmaking any change.\n\n### 1. Deprecated, renamed, and migrated fields\n\nThese are historical fields that the schema no longer accepts or has replaced.\nDelete them, except where the table says to rename or migrate:\n\n| Field | Action |\n|---|---|\n| `default_yolo` / `defaultYolo` (top-level) | Remove. Use `yolo` instead. |\n| `services.byf_search` | Remove. (Legacy service, superseded by `[services.web_search]`.) |\n| `services.byf_fetch` | Remove. Use `[services.fetch_url]` instead. |\n| `loop_control.max_steps_per_run` | **Rename** to `max_steps_per_turn`, preserving the value. First check whether `max_steps_per_turn` is already present: if so, the old key is a stale duplicate — just delete it; if not, write `max_steps_per_turn` with the old value, then delete `max_steps_per_run`. (The runtime auto-copies the value on read, but this skill edits the file directly and skips that roundtrip — so you must perform the rename yourself to avoid losing the limit.) |\n| `default_thinking` (top-level boolean) | Migrate — see below. |\n\n**`default_thinking` migration** (matches the runtime precedence in\n`byf-tui.ts`: a `[thinking]` block wins over `default_thinking`):\n\n- If `[thinking]` already has `mode` or `effort` set, `default_thinking` was\n never effective — just remove it.\n- Otherwise migrate by value: `true` → write `[thinking]` with\n `mode = \"on\"` and `effort = \"high\"`; `false` → `[thinking]` with\n `mode = \"off\"`. Then remove `default_thinking`.\n\n> **Raw-passthrough blind spot.** Fields stripped by the schema (like\n> `byf_search`, `byf_fetch`) survive inside `config.raw` and get written back\n> on every read→write roundtrip, so they linger in the file even though they\n> have no effect. Deleting them here is the only way to clear them — that is\n> the core value of this skill.\n\n### 2. Semantic conflicts (the part a linter cannot enumerate)\n\nLook for cross-field problems that require understanding intent:\n\n- A provider with **both** `api_key` and `oauth` configured — these are\n mutually exclusive; ask which one the user meant.\n- `thinking.mode = \"off\"` **and** a non-empty `thinking.effort` — the effort\n is ignored; suggest removing it or flipping the mode.\n- `models.<alias>.capabilities` containing a value not in the valid set. The\n valid set is the single source of truth: read `CAPABILITY_DEFINITIONS` (or\n the derived `VALID_CAPABILITIES`) in\n `packages/agent-core/src/providers/runtime-provider.ts`. Comparison is\n case-insensitive at runtime, so flag only genuine mismatches.\n- A model alias, `default_provider`, or `default_model` that points at a\n provider or model that does not exist — a dangling reference. Report it; do\n **not** delete it, the user may be mid-edit.\n\n### 3. Housekeeping\n\n- Top-level keys that are not in `ByfConfigSchema` (and not a deprecated key\n above) — likely typos or leftovers from an old version. Report them; only\n remove with user confirmation. Note that legitimate unknown keys (e.g.\n `theme`, `notifications`) are preserved by design through `config.raw`, so\n do not touch keys the user clearly added on purpose.\n- **Nested keys inside containers** (`[providers.<name>]`, `[models.<alias>]`,\n `[services]`, `[background]`, `[loop_control]`, `[thinking]`,\n `[permission]`). A key that the corresponding section of `ByfConfigSchema`\n does not recognize is silently dropped by the parser and has no effect — a\n common cause is a typo (e.g. `max_context_tokns` instead of\n `max_context_size`). Cross-check each sub-key against the schema and flag\n any mismatch; fix only with user confirmation. Note that `[permission]`\n still accepts the legacy `deny`/`allow`/`ask` array shorthand, so do not\n report those as unknown.\n\n## Make changes\n\nFor each change, show the user **what is currently there → what you plan to\nwrite** before editing. Then apply edits with Write/Edit. The Edit/Write\npermission prompt is the real safety gate — your summary is what gives the\nuser context when that prompt appears. There is no automatic backup; if the\nuser wants one, suggest they copy the file first.\n\nAfter editing, tell the user to start a new session (e.g. `/new`) or restart\nBYF for the config change to take effect.\n";
|
|
3176
|
+
//#endregion
|
|
3177
|
+
//#region src/skill/builtin/update-config.ts
|
|
3178
|
+
const PSEUDO_PATH = "builtin://update-config";
|
|
3179
|
+
const parsed = parseSkillText({
|
|
3180
|
+
skillMdPath: "/builtin/skills/update-config.md",
|
|
3181
|
+
skillDirName: "update-config",
|
|
3182
|
+
source: "builtin",
|
|
3183
|
+
text: update_config_default
|
|
3184
|
+
});
|
|
3185
|
+
const UPDATE_CONFIG_SKILL = {
|
|
3164
3186
|
...parsed,
|
|
3165
3187
|
path: PSEUDO_PATH,
|
|
3166
3188
|
dir: PSEUDO_PATH,
|
|
@@ -3174,6 +3196,7 @@ const MCP_CONFIG_SKILL = {
|
|
|
3174
3196
|
//#region src/skill/builtin/index.ts
|
|
3175
3197
|
function registerBuiltinSkills(registry) {
|
|
3176
3198
|
registry.registerBuiltinSkill(MCP_CONFIG_SKILL);
|
|
3199
|
+
registry.registerBuiltinSkill(UPDATE_CONFIG_SKILL);
|
|
3177
3200
|
}
|
|
3178
3201
|
//#endregion
|
|
3179
3202
|
//#region src/skill/scanner.ts
|
|
@@ -3966,12 +3989,12 @@ function joinPath(parent, child, pathClass) {
|
|
|
3966
3989
|
}
|
|
3967
3990
|
//#endregion
|
|
3968
3991
|
//#region src/tools/builtin/file/glob.md
|
|
3969
|
-
var glob_default = "Find files (and optionally directories) by glob pattern, sorted by modification time (most recent first).\n\
|
|
3992
|
+
var glob_default = "Find files (and optionally directories) by glob pattern, sorted by modification time (most recent first).\n\nREJECTED patterns (no literal anchor — will be rejected):\n- **Pure wildcards**: `**`, `**/*`, `*/*` — no literal anchor bounds the result. Add an extension or subdirectory to give the walk a concrete target.\n- **`**/` prefix**: Anything starting with `**/` (e.g. `**/*.py`, `**/main/*.ts`). The leading `**/` has no literal anchor in front of it. Anchor it with a top-level subdirectory like `src/**/*.ts`.\n- **Brace expansion**: `*.{ts,tsx}` is not supported. Split it into separate calls: `*.ts` and `*.tsx`.\n\nGood patterns:\n- `*.ts` — files in the current directory matching an extension\n- `src/**/*.ts` — recursive with a subdirectory anchor and extension\n- `test_*.py` — files whose name starts with a literal prefix\n\nLarge-directory warning — avoid recursing into dependency/build output even with an anchor:\n- `node_modules/**/*.js`, `.venv/**/*.py`, `__pycache__/**`, `target/**` match technically but typically produce thousands of results that truncate at the match cap. Prefer specific subpaths like `node_modules/react/src/**/*.js`.\n\nWhen you need to search the entire project, first use Glob to explore the top-level directory structure, then use an anchored pattern like `src/**/*.ts` or `packages/**/*.ts` to narrow the search.\n";
|
|
3970
3993
|
//#endregion
|
|
3971
3994
|
//#region src/tools/builtin/file/glob.ts
|
|
3972
3995
|
const GlobInputSchema = z.object({
|
|
3973
|
-
pattern: z.string().describe("Glob pattern to match files/directories."),
|
|
3974
|
-
path: z.string().optional().describe("Absolute path to the directory to search in. Defaults to the current working directory."),
|
|
3996
|
+
pattern: z.string().describe("Glob pattern to match files/directories. IMPORTANT: pattern MUST contain a literal anchor like a file extension (.ts) or a subdirectory name (src/). Patterns starting with **/ (e.g. **/*.py, **/main/*.ts), pure wildcards (**, **/*, */*, *), and brace expansion (*.{ts,tsx}) are REJECTED. Example: src/**/*.ts searches all .ts files under src/."),
|
|
3997
|
+
path: z.string().optional().describe("Absolute path to the directory to search in. Defaults to the current working directory. Explicit absolute paths outside the workspace are allowed (e.g. to search a dependency installed elsewhere); relative paths are resolved against the working directory and rejected if they escape it."),
|
|
3975
3998
|
include_dirs: z.boolean().default(true).optional().describe("Whether to include directories in results. Defaults to true. Set false to return only files.")
|
|
3976
3999
|
});
|
|
3977
4000
|
const MAX_MATCHES = 1e3;
|
|
@@ -4013,7 +4036,7 @@ var GlobTool = class {
|
|
|
4013
4036
|
workspace: this.workspace,
|
|
4014
4037
|
operation: "search",
|
|
4015
4038
|
policy: {
|
|
4016
|
-
guardMode: "
|
|
4039
|
+
guardMode: "absolute-outside-allowed",
|
|
4017
4040
|
checkSensitive: false
|
|
4018
4041
|
}
|
|
4019
4042
|
});
|
|
@@ -4047,7 +4070,7 @@ var GlobTool = class {
|
|
|
4047
4070
|
}
|
|
4048
4071
|
return {
|
|
4049
4072
|
isError: true,
|
|
4050
|
-
output: `Pattern "${args.pattern}" is a pure wildcard (only \`*\`, \`?\`, \`**\`, \`/\`) and would enumerate every file under the search root — with no literal anchor to bound the result set, this typically exhausts your context on large trees. Add an extension ("${args.pattern === "**" || args.pattern === "**/*" ? "**/*.ts" : "**/*.md"}") or a subdirectory ("src/**/*.ts") to constrain the walk.\n\
|
|
4073
|
+
output: `Pattern "${args.pattern}" is a pure wildcard (only \`*\`, \`?\`, \`**\`, \`/\`) and would enumerate every file under the search root — with no literal anchor to bound the result set, this typically exhausts your context on large trees. Add an extension ("${args.pattern === "**" || args.pattern === "**/*" ? "**/*.ts" : "**/*.md"}") or a subdirectory ("src/**/*.ts") to constrain the walk.\n\nWorkspace roots:\n${rootList}\n\nTop of ${this.workspace.workspaceDir}:\n${tree}`
|
|
4051
4074
|
};
|
|
4052
4075
|
}
|
|
4053
4076
|
if (containsBraceExpansion(args.pattern)) return {
|
|
@@ -4075,6 +4098,8 @@ var GlobTool = class {
|
|
|
4075
4098
|
try {
|
|
4076
4099
|
const seen = /* @__PURE__ */ new Set();
|
|
4077
4100
|
const entries = [];
|
|
4101
|
+
const pathClass = this.kaos.pathClass();
|
|
4102
|
+
const filteredSensitive = [];
|
|
4078
4103
|
const YIELD_SAFETY_CAP = MAX_MATCHES * 2;
|
|
4079
4104
|
let yielded = 0;
|
|
4080
4105
|
let truncated = false;
|
|
@@ -4090,6 +4115,10 @@ var GlobTool = class {
|
|
|
4090
4115
|
break outer;
|
|
4091
4116
|
}
|
|
4092
4117
|
seen.add(filePath);
|
|
4118
|
+
if (isSensitiveFile(filePath, pathClass)) {
|
|
4119
|
+
filteredSensitive.push(filePath);
|
|
4120
|
+
continue;
|
|
4121
|
+
}
|
|
4093
4122
|
let mtime = 0;
|
|
4094
4123
|
let isDir = false;
|
|
4095
4124
|
try {
|
|
@@ -4105,10 +4134,10 @@ var GlobTool = class {
|
|
|
4105
4134
|
}
|
|
4106
4135
|
entries.sort((a, b) => b.mtime - a.mtime);
|
|
4107
4136
|
const paths = entries.map((e) => e.path);
|
|
4108
|
-
const pathClass = this.kaos.pathClass();
|
|
4109
4137
|
const relBase = searchRoots[0] ?? this.workspace.workspaceDir;
|
|
4110
4138
|
const displayLines = paths.map((p) => relativizeIfUnder$1(p, relBase, pathClass));
|
|
4111
|
-
|
|
4139
|
+
const filteredSome = filteredSensitive.length > 0;
|
|
4140
|
+
if (entries.length === 0 && !truncated) return { output: filteredSome ? `No non-sensitive matches found (filtered ${String(filteredSensitive.length)} sensitive file(s))` : "No matches found" };
|
|
4112
4141
|
const lines = [];
|
|
4113
4142
|
if (truncated) {
|
|
4114
4143
|
lines.push(`[Truncated at ${String(MAX_MATCHES)} matches — use a more specific pattern]`);
|
|
@@ -4116,6 +4145,10 @@ var GlobTool = class {
|
|
|
4116
4145
|
}
|
|
4117
4146
|
lines.push(...displayLines);
|
|
4118
4147
|
if (!truncated && entries.length === 1e3) lines.push(`Found ${String(entries.length)} matches`);
|
|
4148
|
+
if (filteredSome) {
|
|
4149
|
+
const displayedFiltered = filteredSensitive.map((p) => relativizeIfUnder$1(p, relBase, pathClass));
|
|
4150
|
+
lines.push(`Filtered ${String(filteredSensitive.length)} sensitive file(s): ${displayedFiltered.join(", ")}`);
|
|
4151
|
+
}
|
|
4119
4152
|
return { output: lines.join("\n") };
|
|
4120
4153
|
} catch (error) {
|
|
4121
4154
|
if (error !== null && typeof error === "object" && "code" in error) {
|
|
@@ -6312,7 +6345,7 @@ function rewriteWindowsNullRedirect$1(command) {
|
|
|
6312
6345
|
}
|
|
6313
6346
|
//#endregion
|
|
6314
6347
|
//#region src/tools/builtin/state/todo-list.md
|
|
6315
|
-
var todo_list_default = "Use this tool to maintain a structured TODO list as you work through a multi-step task.\n\nUse for multi-step tasks, tracking investigation progress, or planning a sequence of edits. Do not use for single-shot answers or trivial requests.\n\n**
|
|
6348
|
+
var todo_list_default = "Use this tool to maintain a structured TODO list as you work through a multi-step task.\n\nUse for multi-step tasks, tracking investigation progress, or planning a sequence of edits. Do not use for single-shot answers or trivial requests.\n\n**Update discipline:**\n- Update status immediately when you start or complete a subtask: mark it `in_progress` when you begin working on it, and `done` when finished.\n- Do not skip the `in_progress` state — the user should always see what you are currently working on.\n- Avoid redundant calls: do not re-call this tool when nothing meaningful has changed since the last call.\n- When unsure of the current state, call query mode first (omit `todos`) to check the list before deciding what to update.\n- If no available tool can move any task forward, tell the user where you are stuck instead of repeatedly re-ordering the same todos.\n\n**How to use:**\n- Call with `todos: [...]` to replace the full list. Statuses: pending / in_progress / done.\n- Call with no arguments to query the current list.\n- Call with `todos: []` to clear the list.\n- Keep titles short and actionable.\n- Update statuses as you make progress — mark one item in_progress at a time.\n";
|
|
6316
6349
|
//#endregion
|
|
6317
6350
|
//#region src/tools/builtin/state/todo-list.ts
|
|
6318
6351
|
/**
|
|
@@ -11039,6 +11072,7 @@ const YoloOutsideWorkspacePermissionPolicy = {
|
|
|
11039
11072
|
evaluate({ agent, mode, toolCallContext }) {
|
|
11040
11073
|
if (mode !== "yolo") return void 0;
|
|
11041
11074
|
const toolName = toolCallContext.toolCall.name;
|
|
11075
|
+
if (isDefaultAutoAllowTool(toolName)) return void 0;
|
|
11042
11076
|
const toolAccess = FILE_ACCESS_TOOLS[toolName];
|
|
11043
11077
|
if (toolAccess === void 0) return void 0;
|
|
11044
11078
|
const [operation, displayOperation] = toolAccess;
|
|
@@ -11476,8 +11510,7 @@ var AgentRecords = class {
|
|
|
11476
11510
|
tools: "tools",
|
|
11477
11511
|
usage: "usage",
|
|
11478
11512
|
background: "background",
|
|
11479
|
-
full_compaction: "fullCompaction"
|
|
11480
|
-
plan_mode: "planMode"
|
|
11513
|
+
full_compaction: "fullCompaction"
|
|
11481
11514
|
}[recordType.split(".")[0]] ?? null;
|
|
11482
11515
|
}
|
|
11483
11516
|
async replay() {
|
|
@@ -13522,8 +13555,8 @@ var ToolManager = class {
|
|
|
13522
13555
|
return (input) => withProviderRequestAuth(resolveAuth, (auth) => uploadVideo(input, { auth }));
|
|
13523
13556
|
}
|
|
13524
13557
|
get loopTools() {
|
|
13525
|
-
const builtinNames = [...this.builtinTools.keys()].filter((name) => this.enabledTools.has(name)).
|
|
13526
|
-
const userNames = [...this.userTools.keys()].filter((name) => this.enabledTools.has(name)).
|
|
13558
|
+
const builtinNames = [...this.builtinTools.keys()].filter((name) => this.enabledTools.has(name)).toSorted();
|
|
13559
|
+
const userNames = [...this.userTools.keys()].filter((name) => this.enabledTools.has(name)).toSorted();
|
|
13527
13560
|
const mcpNames = [...this.mcpTools.keys()].filter((name) => this.isMcpToolEnabled(name));
|
|
13528
13561
|
return [
|
|
13529
13562
|
...builtinNames.map((name) => this.builtinTools.get(name)),
|
|
@@ -13699,7 +13732,7 @@ function findImplicitBoundaries(prompt) {
|
|
|
13699
13732
|
const index = prompt.indexOf(header);
|
|
13700
13733
|
if (index !== -1) boundaries.push(index);
|
|
13701
13734
|
}
|
|
13702
|
-
return boundaries.
|
|
13735
|
+
return boundaries.toSorted((a, b) => a - b);
|
|
13703
13736
|
}
|
|
13704
13737
|
/**
|
|
13705
13738
|
* Split prompt by implicit boundaries into blocks.
|
|
@@ -15124,15 +15157,6 @@ var Agent = class {
|
|
|
15124
15157
|
getModel: () => {
|
|
15125
15158
|
return this.config.modelAlias ?? "";
|
|
15126
15159
|
},
|
|
15127
|
-
enterPlan: async () => {
|
|
15128
|
-
throw new ByfError(ErrorCodes.NOT_IMPLEMENTED, "Plan mode has been removed");
|
|
15129
|
-
},
|
|
15130
|
-
cancelPlan: async () => {
|
|
15131
|
-
throw new ByfError(ErrorCodes.NOT_IMPLEMENTED, "Plan mode has been removed");
|
|
15132
|
-
},
|
|
15133
|
-
clearPlan: async () => {
|
|
15134
|
-
throw new ByfError(ErrorCodes.NOT_IMPLEMENTED, "Plan mode has been removed");
|
|
15135
|
-
},
|
|
15136
15160
|
beginCompaction: (payload) => {
|
|
15137
15161
|
this.fullCompaction.begin({
|
|
15138
15162
|
source: "manual",
|
|
@@ -15167,7 +15191,6 @@ var Agent = class {
|
|
|
15167
15191
|
getContext: () => this.context.data(),
|
|
15168
15192
|
getConfig: () => this.config.data(),
|
|
15169
15193
|
getPermission: () => this.permission.data(),
|
|
15170
|
-
getPlan: async () => null,
|
|
15171
15194
|
getUsage: () => this.usage.data(),
|
|
15172
15195
|
getTools: () => this.tools.data(),
|
|
15173
15196
|
getBackground: (payload) => this.background.list(payload.activeOnly ?? false, payload.limit)
|
|
@@ -15300,6 +15323,21 @@ function proxyWithExtraPayload(methods, extraPayload) {
|
|
|
15300
15323
|
}, ...args);
|
|
15301
15324
|
} });
|
|
15302
15325
|
}
|
|
15326
|
+
/** The Zod `z.enum` literal inferred from registry keys. */
|
|
15327
|
+
const PROVIDER_TYPE_VALUES = Object.keys({
|
|
15328
|
+
exa: { defaultBaseUrl: "https://api.exa.ai/search" },
|
|
15329
|
+
brave: { defaultBaseUrl: "https://api.search.brave.com/res/v1/web/search" },
|
|
15330
|
+
firecrawl: { defaultBaseUrl: "https://api.firecrawl.dev/v2/search" }
|
|
15331
|
+
});
|
|
15332
|
+
const providerClassMap = /* @__PURE__ */ new Map();
|
|
15333
|
+
function registerProvider(type, cls) {
|
|
15334
|
+
providerClassMap.set(type, cls);
|
|
15335
|
+
}
|
|
15336
|
+
function createProvider$1(type, options) {
|
|
15337
|
+
const cls = providerClassMap.get(type);
|
|
15338
|
+
if (cls === void 0) throw new Error(`WebSearch provider type "${type}" is not registered. Did you import the provider module?`);
|
|
15339
|
+
return new cls(options);
|
|
15340
|
+
}
|
|
15303
15341
|
//#endregion
|
|
15304
15342
|
//#region src/config/schema.ts
|
|
15305
15343
|
const ProviderTypeSchema = z.enum([
|
|
@@ -15399,9 +15437,18 @@ const ByfServiceConfigSchema = z.object({
|
|
|
15399
15437
|
oauth: OAuthRefSchema.optional(),
|
|
15400
15438
|
customHeaders: StringRecordSchema.optional()
|
|
15401
15439
|
});
|
|
15440
|
+
/** Provider type enum derived from webSearchProviderRegistry keys. */
|
|
15441
|
+
const WebSearchProviderTypeSchema = z.enum(PROVIDER_TYPE_VALUES);
|
|
15442
|
+
const WebSearchProviderConfigSchema = z.object({
|
|
15443
|
+
type: WebSearchProviderTypeSchema,
|
|
15444
|
+
apiKeys: z.array(z.string().min(1)).nonempty(),
|
|
15445
|
+
baseUrl: z.string().optional(),
|
|
15446
|
+
priority: z.number().int().positive()
|
|
15447
|
+
});
|
|
15448
|
+
const WebSearchConfigSchema = z.object({ providers: z.array(WebSearchProviderConfigSchema).nonempty() });
|
|
15402
15449
|
const ServicesConfigSchema = z.object({
|
|
15403
|
-
|
|
15404
|
-
|
|
15450
|
+
webSearch: WebSearchConfigSchema.optional(),
|
|
15451
|
+
fetchUrl: ByfServiceConfigSchema.optional()
|
|
15405
15452
|
});
|
|
15406
15453
|
const McpServerCommonFields = {
|
|
15407
15454
|
enabled: z.boolean().optional(),
|
|
@@ -15467,8 +15514,8 @@ const LoopControlPatchSchema = LoopControlSchema.partial();
|
|
|
15467
15514
|
const BackgroundConfigPatchSchema = BackgroundConfigSchema.partial();
|
|
15468
15515
|
const ByfServiceConfigPatchSchema = ByfServiceConfigSchema.partial();
|
|
15469
15516
|
const ServicesConfigPatchSchema = z.object({
|
|
15470
|
-
|
|
15471
|
-
|
|
15517
|
+
webSearch: WebSearchConfigSchema.optional(),
|
|
15518
|
+
fetchUrl: ByfServiceConfigPatchSchema.optional()
|
|
15472
15519
|
});
|
|
15473
15520
|
const ByfConfigPatchSchema = z.object({
|
|
15474
15521
|
providers: z.record(z.string(), ProviderConfigPatchSchema).optional(),
|
|
@@ -15716,10 +15763,15 @@ function transformServiceData(data) {
|
|
|
15716
15763
|
const targetKey = snakeToCamel(key);
|
|
15717
15764
|
if (targetKey === "oauth") out[targetKey] = isPlainObject(value) ? transformPlainObject(value) : value;
|
|
15718
15765
|
else if (targetKey === "customHeaders") out[targetKey] = cloneObjectValue(value);
|
|
15766
|
+
else if (Array.isArray(value)) out[targetKey] = value.map((item) => isPlainObject(item) ? transformRecord(item, identity, snakeToCamel) : item);
|
|
15767
|
+
else if (isPlainObject(value)) out[targetKey] = transformPlainObject(value);
|
|
15719
15768
|
else out[targetKey] = value;
|
|
15720
15769
|
}
|
|
15721
15770
|
return out;
|
|
15722
15771
|
}
|
|
15772
|
+
function identity(v) {
|
|
15773
|
+
return v;
|
|
15774
|
+
}
|
|
15723
15775
|
function transformLoopControlData(data) {
|
|
15724
15776
|
const out = transformPlainObject(data);
|
|
15725
15777
|
if (out["maxStepsPerTurn"] === void 0 && out["maxStepsPerRun"] !== void 0) out["maxStepsPerTurn"] = out["maxStepsPerRun"];
|
|
@@ -15739,11 +15791,11 @@ function configToTomlData(config) {
|
|
|
15739
15791
|
delete out["default_yolo"];
|
|
15740
15792
|
delete out["defaultYolo"];
|
|
15741
15793
|
delete out["defaultPermissionMode"];
|
|
15794
|
+
delete out["default_thinking"];
|
|
15742
15795
|
for (const key of [
|
|
15743
15796
|
"defaultProvider",
|
|
15744
15797
|
"defaultModel",
|
|
15745
15798
|
"yolo",
|
|
15746
|
-
"defaultThinking",
|
|
15747
15799
|
"defaultPermissionMode",
|
|
15748
15800
|
"mergeAllAvailableSkills",
|
|
15749
15801
|
"extraSkillDirs"
|
|
@@ -15812,10 +15864,17 @@ function permissionRuleToToml(rule) {
|
|
|
15812
15864
|
}
|
|
15813
15865
|
function servicesToToml(services, rawServices) {
|
|
15814
15866
|
const out = cloneRecord(rawServices);
|
|
15815
|
-
if (services.
|
|
15816
|
-
|
|
15817
|
-
|
|
15818
|
-
|
|
15867
|
+
if (services.webSearch !== void 0 && services.webSearch.providers.length > 0) {
|
|
15868
|
+
const providersToml = services.webSearch.providers.map((p) => {
|
|
15869
|
+
const providerOut = {};
|
|
15870
|
+
for (const [key, value] of Object.entries(p)) setDefined(providerOut, camelToSnake(key), value);
|
|
15871
|
+
return providerOut;
|
|
15872
|
+
});
|
|
15873
|
+
out["web_search"] = out["web_search"] ?? {};
|
|
15874
|
+
out["web_search"]["providers"] = providersToml;
|
|
15875
|
+
} else delete out["web_search"];
|
|
15876
|
+
if (services.fetchUrl !== void 0) out["fetch_url"] = serviceToToml(services.fetchUrl);
|
|
15877
|
+
else delete out["fetch_url"];
|
|
15819
15878
|
return out;
|
|
15820
15879
|
}
|
|
15821
15880
|
function serviceToToml(service) {
|
|
@@ -17608,11 +17667,15 @@ function createProxiedFetch(deps) {
|
|
|
17608
17667
|
const proxyUrl = getProxyForUrl(url, envLookup, sysProxy);
|
|
17609
17668
|
const noProxyMatch = noProxy !== void 0 && isNoProxyHost(hostname, noProxy);
|
|
17610
17669
|
const controller = new AbortController();
|
|
17611
|
-
const timeoutId = setTimeout(() =>
|
|
17670
|
+
const timeoutId = setTimeout(() => {
|
|
17671
|
+
controller.abort();
|
|
17672
|
+
}, REQUEST_TIMEOUT_MS);
|
|
17612
17673
|
if (init?.signal) if (init.signal.aborted) {
|
|
17613
17674
|
clearTimeout(timeoutId);
|
|
17614
17675
|
controller.abort();
|
|
17615
|
-
} else init.signal.addEventListener("abort", () =>
|
|
17676
|
+
} else init.signal.addEventListener("abort", () => {
|
|
17677
|
+
controller.abort();
|
|
17678
|
+
}, { once: true });
|
|
17616
17679
|
const mergedInit = {
|
|
17617
17680
|
...init,
|
|
17618
17681
|
signal: controller.signal
|
|
@@ -17624,7 +17687,7 @@ function createProxiedFetch(deps) {
|
|
|
17624
17687
|
return response;
|
|
17625
17688
|
} catch (error) {
|
|
17626
17689
|
clearTimeout(timeoutId);
|
|
17627
|
-
if (isRetryableError(error) && proxyUrl && !noProxyMatch) return
|
|
17690
|
+
if (isRetryableError(error) && proxyUrl && !noProxyMatch) return retryViaProxy(input, init, proxyUrl, innerFetch);
|
|
17628
17691
|
throw error;
|
|
17629
17692
|
}
|
|
17630
17693
|
};
|
|
@@ -17632,11 +17695,15 @@ function createProxiedFetch(deps) {
|
|
|
17632
17695
|
}
|
|
17633
17696
|
async function retryViaProxy(input, init, proxyUrl, innerFetch) {
|
|
17634
17697
|
const controller = new AbortController();
|
|
17635
|
-
const timeoutId = setTimeout(() =>
|
|
17698
|
+
const timeoutId = setTimeout(() => {
|
|
17699
|
+
controller.abort();
|
|
17700
|
+
}, REQUEST_TIMEOUT_MS);
|
|
17636
17701
|
if (init?.signal) if (init.signal.aborted) {
|
|
17637
17702
|
clearTimeout(timeoutId);
|
|
17638
17703
|
controller.abort();
|
|
17639
|
-
} else init.signal.addEventListener("abort", () =>
|
|
17704
|
+
} else init.signal.addEventListener("abort", () => {
|
|
17705
|
+
controller.abort();
|
|
17706
|
+
}, { once: true });
|
|
17640
17707
|
const dispatcher = new ProxyAgent(proxyUrl);
|
|
17641
17708
|
const retryInit = {
|
|
17642
17709
|
...init,
|
|
@@ -17786,82 +17853,188 @@ var RemoteFetchURLProvider = class {
|
|
|
17786
17853
|
}
|
|
17787
17854
|
};
|
|
17788
17855
|
//#endregion
|
|
17789
|
-
//#region src/tools/providers/
|
|
17790
|
-
var
|
|
17791
|
-
|
|
17792
|
-
|
|
17856
|
+
//#region src/tools/providers/router.ts
|
|
17857
|
+
var AllProvidersFailedError = class extends Error {
|
|
17858
|
+
lastError;
|
|
17859
|
+
constructor(lastError) {
|
|
17860
|
+
super(`All search providers failed. Last error: ${lastError ?? "unknown"}`);
|
|
17861
|
+
this.lastError = lastError;
|
|
17862
|
+
this.name = "AllProvidersFailedError";
|
|
17863
|
+
}
|
|
17864
|
+
};
|
|
17865
|
+
var PriorityRouter = class {
|
|
17866
|
+
providers;
|
|
17867
|
+
constructor(providers) {
|
|
17868
|
+
this.providers = providers;
|
|
17869
|
+
}
|
|
17870
|
+
async search(query, options) {
|
|
17871
|
+
let lastError;
|
|
17872
|
+
for (const provider of this.providers) try {
|
|
17873
|
+
return await provider.search(query, options);
|
|
17874
|
+
} catch (error) {
|
|
17875
|
+
lastError = error instanceof Error ? error.message : String(error);
|
|
17876
|
+
}
|
|
17877
|
+
throw new AllProvidersFailedError(lastError);
|
|
17878
|
+
}
|
|
17879
|
+
};
|
|
17880
|
+
//#endregion
|
|
17881
|
+
//#region src/tools/providers/exa.ts
|
|
17882
|
+
var ExaWebSearchProvider = class {
|
|
17883
|
+
apiKeys;
|
|
17793
17884
|
baseUrl;
|
|
17794
|
-
defaultHeaders;
|
|
17795
|
-
customHeaders;
|
|
17796
17885
|
fetchImpl;
|
|
17797
17886
|
constructor(options) {
|
|
17798
|
-
this.
|
|
17799
|
-
this.
|
|
17800
|
-
this.baseUrl = options.baseUrl;
|
|
17801
|
-
this.defaultHeaders = options.defaultHeaders ?? {};
|
|
17802
|
-
this.customHeaders = options.customHeaders ?? {};
|
|
17887
|
+
this.apiKeys = options.apiKeys;
|
|
17888
|
+
this.baseUrl = options.baseUrl ?? "https://api.exa.ai/search";
|
|
17803
17889
|
this.fetchImpl = options.fetchImpl ?? globalThis.fetch.bind(globalThis);
|
|
17804
17890
|
}
|
|
17805
17891
|
async search(query, options) {
|
|
17806
|
-
const
|
|
17807
|
-
|
|
17808
|
-
|
|
17809
|
-
|
|
17810
|
-
|
|
17892
|
+
const limit = options?.limit ?? 5;
|
|
17893
|
+
const includeContent = options?.includeContent ?? false;
|
|
17894
|
+
const contents = {};
|
|
17895
|
+
if (includeContent) contents.text = { maxCharacters: 1e4 };
|
|
17896
|
+
else contents.highlights = {
|
|
17897
|
+
query,
|
|
17898
|
+
maxCharacters: 300
|
|
17811
17899
|
};
|
|
17812
|
-
const
|
|
17813
|
-
|
|
17814
|
-
|
|
17815
|
-
|
|
17816
|
-
throw new Error(`Remote search request failed: HTTP 401 (auth/unauthorized). ${detail}`.trim());
|
|
17817
|
-
}
|
|
17818
|
-
if (response.status !== 200) {
|
|
17819
|
-
const detail = await safeReadText(response);
|
|
17820
|
-
throw new Error(`Remote search request failed: HTTP ${String(response.status)}. ${detail}`.trim());
|
|
17821
|
-
}
|
|
17822
|
-
const json = await response.json();
|
|
17823
|
-
return (Array.isArray(json.search_results) ? json.search_results : []).map((r) => {
|
|
17824
|
-
const out = {
|
|
17825
|
-
title: r.title ?? "",
|
|
17826
|
-
url: r.url ?? "",
|
|
17827
|
-
snippet: r.snippet ?? ""
|
|
17828
|
-
};
|
|
17829
|
-
if (typeof r.date === "string" && r.date.length > 0) out.date = r.date;
|
|
17830
|
-
if (typeof r.content === "string" && r.content.length > 0) out.content = r.content;
|
|
17831
|
-
return out;
|
|
17900
|
+
const body = JSON.stringify({
|
|
17901
|
+
query,
|
|
17902
|
+
numResults: limit,
|
|
17903
|
+
contents
|
|
17832
17904
|
});
|
|
17905
|
+
let lastError;
|
|
17906
|
+
for (const apiKey of this.apiKeys) try {
|
|
17907
|
+
const response = await this.fetchImpl(this.baseUrl, {
|
|
17908
|
+
method: "POST",
|
|
17909
|
+
headers: {
|
|
17910
|
+
Authorization: `Bearer ${apiKey}`,
|
|
17911
|
+
"Content-Type": "application/json"
|
|
17912
|
+
},
|
|
17913
|
+
body
|
|
17914
|
+
});
|
|
17915
|
+
if (!response.ok) {
|
|
17916
|
+
const detail = (await response.text().catch(() => "")).slice(0, 200);
|
|
17917
|
+
throw new Error(`Exa search failed: HTTP ${response.status}${detail ? `: ${detail}` : ""}`);
|
|
17918
|
+
}
|
|
17919
|
+
const json = await response.json();
|
|
17920
|
+
return (Array.isArray(json.results) ? json.results : []).map((r) => {
|
|
17921
|
+
const out = {
|
|
17922
|
+
title: r.title ?? "",
|
|
17923
|
+
url: r.url ?? "",
|
|
17924
|
+
snippet: ""
|
|
17925
|
+
};
|
|
17926
|
+
if (includeContent && typeof r.text === "string") {
|
|
17927
|
+
out.snippet = r.text.slice(0, 300);
|
|
17928
|
+
if (r.text.length > 0) out.content = r.text;
|
|
17929
|
+
} else if (Array.isArray(r.highlights) && r.highlights.length > 0) out.snippet = r.highlights[0].slice(0, 300);
|
|
17930
|
+
if (typeof r.publishedDate === "string" && r.publishedDate.length > 0) out.date = r.publishedDate;
|
|
17931
|
+
return out;
|
|
17932
|
+
});
|
|
17933
|
+
} catch (error) {
|
|
17934
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
17935
|
+
}
|
|
17936
|
+
throw lastError ?? /* @__PURE__ */ new Error("Exa search failed: no API keys configured");
|
|
17833
17937
|
}
|
|
17834
|
-
|
|
17835
|
-
|
|
17836
|
-
|
|
17837
|
-
|
|
17838
|
-
|
|
17839
|
-
|
|
17840
|
-
|
|
17841
|
-
|
|
17842
|
-
|
|
17843
|
-
|
|
17844
|
-
|
|
17845
|
-
|
|
17938
|
+
};
|
|
17939
|
+
registerProvider("exa", ExaWebSearchProvider);
|
|
17940
|
+
//#endregion
|
|
17941
|
+
//#region src/tools/providers/brave.ts
|
|
17942
|
+
var BraveWebSearchProvider = class {
|
|
17943
|
+
apiKeys;
|
|
17944
|
+
baseUrl;
|
|
17945
|
+
fetchImpl;
|
|
17946
|
+
constructor(options) {
|
|
17947
|
+
this.apiKeys = options.apiKeys;
|
|
17948
|
+
this.baseUrl = options.baseUrl ?? "https://api.search.brave.com/res/v1/web/search";
|
|
17949
|
+
this.fetchImpl = options.fetchImpl ?? globalThis.fetch.bind(globalThis);
|
|
17846
17950
|
}
|
|
17847
|
-
async
|
|
17848
|
-
|
|
17849
|
-
|
|
17951
|
+
async search(query, options) {
|
|
17952
|
+
const limit = options?.limit ?? 5;
|
|
17953
|
+
const url = new URL(this.baseUrl);
|
|
17954
|
+
url.searchParams.set("q", query);
|
|
17955
|
+
url.searchParams.set("count", String(limit));
|
|
17956
|
+
let lastError;
|
|
17957
|
+
for (const apiKey of this.apiKeys) try {
|
|
17958
|
+
const response = await this.fetchImpl(url.toString(), {
|
|
17959
|
+
method: "GET",
|
|
17960
|
+
headers: {
|
|
17961
|
+
"Accept": "application/json",
|
|
17962
|
+
"Accept-Encoding": "gzip",
|
|
17963
|
+
"X-Subscription-Token": apiKey
|
|
17964
|
+
}
|
|
17965
|
+
});
|
|
17966
|
+
if (!response.ok) {
|
|
17967
|
+
const detail = (await response.text().catch(() => "")).slice(0, 200);
|
|
17968
|
+
throw new Error(`Brave search failed: HTTP ${response.status}${detail ? `: ${detail}` : ""}`);
|
|
17969
|
+
}
|
|
17970
|
+
const json = await response.json();
|
|
17971
|
+
return (Array.isArray(json.web?.results) ? json.web.results : []).map((r) => {
|
|
17972
|
+
const out = {
|
|
17973
|
+
title: r.title ?? "",
|
|
17974
|
+
url: r.url ?? "",
|
|
17975
|
+
snippet: r.description ?? ""
|
|
17976
|
+
};
|
|
17977
|
+
if (typeof r.age === "string" && r.age.length > 0) out.date = r.age;
|
|
17978
|
+
return out;
|
|
17979
|
+
});
|
|
17850
17980
|
} catch (error) {
|
|
17851
|
-
|
|
17852
|
-
throw error;
|
|
17981
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
17853
17982
|
}
|
|
17854
|
-
|
|
17855
|
-
throw new Error("Remote search service is not configured: missing API key or token provider.");
|
|
17983
|
+
throw lastError ?? /* @__PURE__ */ new Error("Brave search failed: no API keys configured");
|
|
17856
17984
|
}
|
|
17857
17985
|
};
|
|
17858
|
-
|
|
17859
|
-
|
|
17860
|
-
|
|
17861
|
-
|
|
17862
|
-
|
|
17986
|
+
registerProvider("brave", BraveWebSearchProvider);
|
|
17987
|
+
//#endregion
|
|
17988
|
+
//#region src/tools/providers/firecrawl.ts
|
|
17989
|
+
var FirecrawlWebSearchProvider = class {
|
|
17990
|
+
apiKeys;
|
|
17991
|
+
baseUrl;
|
|
17992
|
+
fetchImpl;
|
|
17993
|
+
constructor(options) {
|
|
17994
|
+
this.apiKeys = options.apiKeys;
|
|
17995
|
+
this.baseUrl = options.baseUrl ?? "https://api.firecrawl.dev/v2/search";
|
|
17996
|
+
this.fetchImpl = options.fetchImpl ?? globalThis.fetch.bind(globalThis);
|
|
17863
17997
|
}
|
|
17864
|
-
|
|
17998
|
+
async search(query, options) {
|
|
17999
|
+
const limit = options?.limit ?? 5;
|
|
18000
|
+
const includeContent = options?.includeContent ?? false;
|
|
18001
|
+
const requestBody = {
|
|
18002
|
+
query,
|
|
18003
|
+
limit
|
|
18004
|
+
};
|
|
18005
|
+
if (includeContent) requestBody.scrapeOptions = { formats: ["markdown"] };
|
|
18006
|
+
const body = JSON.stringify(requestBody);
|
|
18007
|
+
let lastError;
|
|
18008
|
+
for (const apiKey of this.apiKeys) try {
|
|
18009
|
+
const response = await this.fetchImpl(this.baseUrl, {
|
|
18010
|
+
method: "POST",
|
|
18011
|
+
headers: {
|
|
18012
|
+
"Authorization": `Bearer ${apiKey}`,
|
|
18013
|
+
"Content-Type": "application/json"
|
|
18014
|
+
},
|
|
18015
|
+
body
|
|
18016
|
+
});
|
|
18017
|
+
if (!response.ok) {
|
|
18018
|
+
const detail = (await response.text().catch(() => "")).slice(0, 200);
|
|
18019
|
+
throw new Error(`Firecrawl search failed: HTTP ${response.status}${detail ? `: ${detail}` : ""}`);
|
|
18020
|
+
}
|
|
18021
|
+
const json = await response.json();
|
|
18022
|
+
return (Array.isArray(json.data?.web) ? json.data.web : []).map((r) => {
|
|
18023
|
+
const out = {
|
|
18024
|
+
title: r.title ?? "",
|
|
18025
|
+
url: r.url ?? "",
|
|
18026
|
+
snippet: r.description ?? ""
|
|
18027
|
+
};
|
|
18028
|
+
if (includeContent && typeof r.markdown === "string" && r.markdown.length > 0) out.content = r.markdown;
|
|
18029
|
+
return out;
|
|
18030
|
+
});
|
|
18031
|
+
} catch (error) {
|
|
18032
|
+
lastError = error instanceof Error ? error : new Error(String(error));
|
|
18033
|
+
}
|
|
18034
|
+
throw lastError ?? /* @__PURE__ */ new Error("Firecrawl search failed: no API keys configured");
|
|
18035
|
+
}
|
|
18036
|
+
};
|
|
18037
|
+
registerProvider("firecrawl", FirecrawlWebSearchProvider);
|
|
17865
18038
|
//#endregion
|
|
17866
18039
|
//#region src/utils/environment.ts
|
|
17867
18040
|
/**
|
|
@@ -18123,15 +18296,6 @@ var SessionAPIImpl = class {
|
|
|
18123
18296
|
getModel({ agentId, ...payload }) {
|
|
18124
18297
|
return this.getAgent(agentId).getModel(payload);
|
|
18125
18298
|
}
|
|
18126
|
-
enterPlan({ agentId, ...payload }) {
|
|
18127
|
-
return this.getAgent(agentId).enterPlan(payload);
|
|
18128
|
-
}
|
|
18129
|
-
cancelPlan({ agentId, ...payload }) {
|
|
18130
|
-
return this.getAgent(agentId).cancelPlan(payload);
|
|
18131
|
-
}
|
|
18132
|
-
clearPlan({ agentId, ...payload }) {
|
|
18133
|
-
return this.getAgent(agentId).clearPlan(payload);
|
|
18134
|
-
}
|
|
18135
18299
|
beginCompaction({ agentId, ...payload }) {
|
|
18136
18300
|
return this.getAgent(agentId).beginCompaction(payload);
|
|
18137
18301
|
}
|
|
@@ -18172,9 +18336,6 @@ var SessionAPIImpl = class {
|
|
|
18172
18336
|
getPermission({ agentId, ...payload }) {
|
|
18173
18337
|
return this.getAgent(agentId).getPermission(payload);
|
|
18174
18338
|
}
|
|
18175
|
-
getPlan({ agentId, ...payload }) {
|
|
18176
|
-
return this.getAgent(agentId).getPlan(payload);
|
|
18177
|
-
}
|
|
18178
18339
|
getUsage({ agentId, ...payload }) {
|
|
18179
18340
|
return this.getAgent(agentId).getUsage(payload);
|
|
18180
18341
|
}
|
|
@@ -19381,19 +19542,59 @@ function createRuntimeProviderAuthResolver(input, resolved = resolveRuntimeProvi
|
|
|
19381
19542
|
function isAuthLoginRequired(error) {
|
|
19382
19543
|
return isByfError(error) && error.code === ErrorCodes.AUTH_LOGIN_REQUIRED;
|
|
19383
19544
|
}
|
|
19545
|
+
const CAPABILITY_DEFINITIONS = [
|
|
19546
|
+
{
|
|
19547
|
+
name: "image_in",
|
|
19548
|
+
returnKey: "image_in"
|
|
19549
|
+
},
|
|
19550
|
+
{
|
|
19551
|
+
name: "video_in",
|
|
19552
|
+
returnKey: "video_in"
|
|
19553
|
+
},
|
|
19554
|
+
{
|
|
19555
|
+
name: "audio_in",
|
|
19556
|
+
returnKey: "audio_in"
|
|
19557
|
+
},
|
|
19558
|
+
{
|
|
19559
|
+
name: "thinking",
|
|
19560
|
+
returnKey: "thinking"
|
|
19561
|
+
},
|
|
19562
|
+
{
|
|
19563
|
+
name: "always_thinking",
|
|
19564
|
+
returnKey: "thinking"
|
|
19565
|
+
},
|
|
19566
|
+
{
|
|
19567
|
+
name: "tool_use",
|
|
19568
|
+
returnKey: "tool_use"
|
|
19569
|
+
},
|
|
19570
|
+
{
|
|
19571
|
+
name: "thinking_effort",
|
|
19572
|
+
returnKey: "thinking_effort"
|
|
19573
|
+
},
|
|
19574
|
+
{
|
|
19575
|
+
name: "thinking_xhigh",
|
|
19576
|
+
returnKey: "thinking_xhigh"
|
|
19577
|
+
},
|
|
19578
|
+
{
|
|
19579
|
+
name: "thinking_max",
|
|
19580
|
+
returnKey: "thinking_max"
|
|
19581
|
+
}
|
|
19582
|
+
];
|
|
19583
|
+
CAPABILITY_DEFINITIONS.map((d) => d.name);
|
|
19384
19584
|
function resolveModelCapabilities(alias, provider) {
|
|
19385
19585
|
const capabilities = new Set((alias.capabilities ?? []).map((capability) => capability.trim().toLowerCase()));
|
|
19386
19586
|
const has = (capability) => capabilities.has(capability);
|
|
19387
19587
|
const providerCapability = createProvider(providerForCapabilityProbe(provider)).getCapability?.(provider.model) ?? UNKNOWN_CAPABILITY;
|
|
19588
|
+
const returnKeyToNames = /* @__PURE__ */ new Map();
|
|
19589
|
+
for (const def of CAPABILITY_DEFINITIONS) {
|
|
19590
|
+
const names = returnKeyToNames.get(def.returnKey) ?? [];
|
|
19591
|
+
names.push(def.name);
|
|
19592
|
+
returnKeyToNames.set(def.returnKey, names);
|
|
19593
|
+
}
|
|
19594
|
+
const resolved = {};
|
|
19595
|
+
for (const [returnKey, names] of returnKeyToNames) resolved[returnKey] = names.some((n) => has(n)) || Boolean(providerCapability[returnKey]);
|
|
19388
19596
|
return {
|
|
19389
|
-
|
|
19390
|
-
video_in: has("video_in") || providerCapability.video_in,
|
|
19391
|
-
audio_in: has("audio_in") || providerCapability.audio_in,
|
|
19392
|
-
thinking: has("thinking") || has("always_thinking") || providerCapability.thinking,
|
|
19393
|
-
tool_use: has("tool_use") || providerCapability.tool_use,
|
|
19394
|
-
thinking_effort: has("thinking_effort") || providerCapability.thinking_effort,
|
|
19395
|
-
thinking_xhigh: has("thinking_xhigh") || providerCapability.thinking_xhigh,
|
|
19396
|
-
thinking_max: has("thinking_max") || providerCapability.thinking_max,
|
|
19597
|
+
...resolved,
|
|
19397
19598
|
max_context_tokens: alias.maxContextSize
|
|
19398
19599
|
};
|
|
19399
19600
|
}
|
|
@@ -19854,15 +20055,6 @@ var ByfCore = class {
|
|
|
19854
20055
|
getModel({ sessionId, ...payload }) {
|
|
19855
20056
|
return this.sessionApi(sessionId).getModel(payload);
|
|
19856
20057
|
}
|
|
19857
|
-
enterPlan({ sessionId, ...payload }) {
|
|
19858
|
-
return this.sessionApi(sessionId).enterPlan(payload);
|
|
19859
|
-
}
|
|
19860
|
-
cancelPlan({ sessionId, ...payload }) {
|
|
19861
|
-
return this.sessionApi(sessionId).cancelPlan(payload);
|
|
19862
|
-
}
|
|
19863
|
-
clearPlan({ sessionId, ...payload }) {
|
|
19864
|
-
return this.sessionApi(sessionId).clearPlan(payload);
|
|
19865
|
-
}
|
|
19866
20058
|
beginCompaction({ sessionId, ...payload }) {
|
|
19867
20059
|
return this.sessionApi(sessionId).beginCompaction(payload);
|
|
19868
20060
|
}
|
|
@@ -19902,9 +20094,6 @@ var ByfCore = class {
|
|
|
19902
20094
|
getPermission({ sessionId, ...payload }) {
|
|
19903
20095
|
return this.sessionApi(sessionId).getPermission(payload);
|
|
19904
20096
|
}
|
|
19905
|
-
getPlan({ sessionId, ...payload }) {
|
|
19906
|
-
return this.sessionApi(sessionId).getPlan(payload);
|
|
19907
|
-
}
|
|
19908
20097
|
getUsage({ sessionId, ...payload }) {
|
|
19909
20098
|
return this.sessionApi(sessionId).getUsage(payload);
|
|
19910
20099
|
}
|
|
@@ -19992,8 +20181,8 @@ async function createRuntimeConfig(input) {
|
|
|
19992
20181
|
systemProxy: () => detectSystemProxy()
|
|
19993
20182
|
});
|
|
19994
20183
|
const localFetcher = new LocalFetchURLProvider({ fetchImpl: proxiedFetch });
|
|
19995
|
-
const
|
|
19996
|
-
const
|
|
20184
|
+
const fetchService = input.config.services?.fetchUrl;
|
|
20185
|
+
const webSearchConfig = input.config.services?.webSearch;
|
|
19997
20186
|
return {
|
|
19998
20187
|
kaos: localKaos,
|
|
19999
20188
|
osEnv: await detectEnvironmentFromNode(),
|
|
@@ -20005,12 +20194,11 @@ async function createRuntimeConfig(input) {
|
|
|
20005
20194
|
fetchImpl: proxiedFetch,
|
|
20006
20195
|
...serviceCredentials(fetchService, input.resolveOAuthTokenProvider)
|
|
20007
20196
|
}),
|
|
20008
|
-
webSearcher:
|
|
20009
|
-
|
|
20010
|
-
|
|
20011
|
-
fetchImpl: proxiedFetch
|
|
20012
|
-
|
|
20013
|
-
})
|
|
20197
|
+
webSearcher: webSearchConfig === void 0 ? void 0 : new PriorityRouter([...webSearchConfig.providers].toSorted((a, b) => a.priority - b.priority).map((p) => createProvider$1(p.type, {
|
|
20198
|
+
apiKeys: p.apiKeys,
|
|
20199
|
+
baseUrl: p.baseUrl,
|
|
20200
|
+
fetchImpl: proxiedFetch
|
|
20201
|
+
})))
|
|
20014
20202
|
};
|
|
20015
20203
|
}
|
|
20016
20204
|
function serviceCredentials(service, resolveOAuthTokenProvider) {
|
|
@@ -20045,7 +20233,6 @@ async function resumeSessionResult(summary, session, warning) {
|
|
|
20045
20233
|
context,
|
|
20046
20234
|
replay: agent.replayBuilder.buildResult(),
|
|
20047
20235
|
permission,
|
|
20048
|
-
plan: null,
|
|
20049
20236
|
usage,
|
|
20050
20237
|
tools: await api.getTools({ agentId }),
|
|
20051
20238
|
toolStore: agent.tools.storeData(),
|
|
@@ -20105,4 +20292,4 @@ function parsePositiveInt(value) {
|
|
|
20105
20292
|
return n;
|
|
20106
20293
|
}
|
|
20107
20294
|
//#endregion
|
|
20108
|
-
export { AGENT_WIRE_PROTOCOL_VERSION, Agent, BYF_ERROR_INFO, BackgroundConfigSchema, ByfConfigPatchSchema, ByfConfigSchema, ByfCore, ByfError, ByfServiceConfigSchema, ErrorCodes, HookDefSchema, LoopControlSchema, MCP_OAUTH_AUTHORIZATION_URL_TOOL_UPDATE, McpServerConfigSchema, McpServerHttpConfigSchema, McpServerStdioConfigSchema, ModelAliasSchema, OAuthRefSchema, PermissionConfigSchema, PermissionModeSchema, PermissionRuleDecisionSchema, PermissionRuleSchema, PermissionRuleScopeSchema, ProviderConfigSchema, ProviderTypeSchema, ServicesConfigSchema, Session, SessionSubagentHost, ThinkingConfigSchema, USER_PROMPT_ORIGIN, WIRE_PROTOCOL_VERSION, 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 };
|
|
20295
|
+
export { AGENT_WIRE_PROTOCOL_VERSION, Agent, BYF_ERROR_INFO, BackgroundConfigSchema, ByfConfigPatchSchema, ByfConfigSchema, ByfCore, ByfError, ByfServiceConfigSchema, ErrorCodes, HookDefSchema, LoopControlSchema, MCP_OAUTH_AUTHORIZATION_URL_TOOL_UPDATE, McpServerConfigSchema, McpServerHttpConfigSchema, McpServerStdioConfigSchema, ModelAliasSchema, OAuthRefSchema, PermissionConfigSchema, PermissionModeSchema, PermissionRuleDecisionSchema, PermissionRuleSchema, PermissionRuleScopeSchema, ProviderConfigSchema, ProviderTypeSchema, ServicesConfigSchema, Session, SessionSubagentHost, ThinkingConfigSchema, USER_PROMPT_ORIGIN, WIRE_PROTOCOL_VERSION, WebSearchConfigSchema, WebSearchProviderConfigSchema, 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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ct as JsonObject, dt as ListSessionsPayload, wt as SessionSummary } from "../../index-BNApCprm.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/session/store/session-store.d.ts
|
|
4
4
|
interface CreateSessionRecordInput {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byfriends/agent-core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Unified agent engine for BYF",
|
|
5
5
|
"license": "Proprietary",
|
|
6
6
|
"author": "ByronFinn",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"undici": "^8.4.1",
|
|
70
70
|
"yauzl": "^3.3.0",
|
|
71
71
|
"zod": "^4.3.6",
|
|
72
|
-
"@byfriends/kaos": "^0.
|
|
73
|
-
"@byfriends/kosong": "^0.2
|
|
72
|
+
"@byfriends/kaos": "^0.3.2",
|
|
73
|
+
"@byfriends/kosong": "^0.3.2"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/js-yaml": "^4.0.9",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"yazl": "^3.3.1"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|
|
88
|
-
"build": "tsdown",
|
|
88
|
+
"build": "tsdown && node scripts/rewrite-dts-subpaths.mjs",
|
|
89
89
|
"test": "vitest run",
|
|
90
90
|
"test:baseline": "vitest run",
|
|
91
91
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|