@byfriends/sdk 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -65,9 +65,6 @@ declare interface AgentAPI {
65
65
  setPermission: (payload: SetPermissionPayload) => void;
66
66
  setModel: (payload: SetModelPayload) => SetModelResult;
67
67
  getModel: (payload: EmptyPayload) => string;
68
- enterPlan: (payload: EmptyPayload) => void;
69
- cancelPlan: (payload: CancelPlanPayload) => void;
70
- clearPlan: (payload: EmptyPayload) => void;
71
68
  beginCompaction: (payload: BeginCompactionPayload) => void;
72
69
  cancelCompaction: (payload: EmptyPayload) => void;
73
70
  registerTool: (payload: RegisterToolPayload) => void;
@@ -81,7 +78,6 @@ declare interface AgentAPI {
81
78
  getContext: (payload: EmptyPayload) => AgentContextData;
82
79
  getConfig: (payload: EmptyPayload) => AgentConfigData;
83
80
  getPermission: (payload: EmptyPayload) => PermissionData;
84
- getPlan: (payload: EmptyPayload) => PlanData;
85
81
  getUsage: (payload: EmptyPayload) => UsageStatus;
86
82
  getTools: (payload: EmptyPayload) => readonly ToolInfo[];
87
83
  getBackground: (payload: GetBackgroundPayload) => readonly BackgroundTaskInfo[];
@@ -178,15 +174,6 @@ declare interface AgentRecordEvents {
178
174
  };
179
175
  'permission.record_approval_result': PermissionApprovalResultRecord;
180
176
  'full_compaction.begin': CompactionBeginData;
181
- 'plan_mode.enter': {
182
- id: string;
183
- };
184
- 'plan_mode.cancel': {
185
- id?: string;
186
- };
187
- 'plan_mode.exit': {
188
- id?: string;
189
- };
190
177
  'tools.register_user_tool': UserToolRegistration;
191
178
  'tools.unregister_user_tool': {
192
179
  name: string;
@@ -260,9 +247,6 @@ declare class AgentRecords {
260
247
  export declare type AgentReplayRecord = {
261
248
  type: 'message';
262
249
  message: ContextMessage;
263
- } | {
264
- type: 'plan_updated';
265
- enabled: boolean;
266
250
  } | {
267
251
  type: 'config_updated';
268
252
  config: AgentConfigUpdateData;
@@ -1149,8 +1133,8 @@ declare const ByfConfigPatchSchema: z.ZodObject<{
1149
1133
  defaultThinking: z.ZodOptional<z.ZodBoolean>;
1150
1134
  defaultPermissionMode: z.ZodOptional<z.ZodEnum<{
1151
1135
  auto: "auto";
1152
- yolo: "yolo";
1153
1136
  manual: "manual";
1137
+ yolo: "yolo";
1154
1138
  }>>;
1155
1139
  permission: z.ZodOptional<z.ZodObject<{
1156
1140
  rules: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1190,19 +1174,19 @@ declare const ByfConfigPatchSchema: z.ZodObject<{
1190
1174
  timeout: z.ZodOptional<z.ZodNumber>;
1191
1175
  }, z.core.$strict>>>;
1192
1176
  services: z.ZodOptional<z.ZodObject<{
1193
- byfSearch: z.ZodOptional<z.ZodObject<{
1194
- baseUrl: z.ZodOptional<z.ZodOptional<z.ZodString>>;
1195
- apiKey: z.ZodOptional<z.ZodOptional<z.ZodString>>;
1196
- oauth: z.ZodOptional<z.ZodOptional<z.ZodObject<{
1197
- storage: z.ZodEnum<{
1198
- file: "file";
1199
- keyring: "keyring";
1177
+ webSearch: z.ZodOptional<z.ZodObject<{
1178
+ providers: z.ZodArray<z.ZodObject<{
1179
+ type: z.ZodEnum<{
1180
+ exa: "exa";
1181
+ brave: "brave";
1182
+ firecrawl: "firecrawl";
1200
1183
  }>;
1201
- key: z.ZodString;
1202
- }, z.core.$strip>>>;
1203
- customHeaders: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
1184
+ apiKeys: z.ZodArray<z.ZodString>;
1185
+ baseUrl: z.ZodOptional<z.ZodString>;
1186
+ priority: z.ZodNumber;
1187
+ }, z.core.$strip>>;
1204
1188
  }, z.core.$strip>>;
1205
- byfFetch: z.ZodOptional<z.ZodObject<{
1189
+ fetchUrl: z.ZodOptional<z.ZodObject<{
1206
1190
  baseUrl: z.ZodOptional<z.ZodOptional<z.ZodString>>;
1207
1191
  apiKey: z.ZodOptional<z.ZodOptional<z.ZodString>>;
1208
1192
  oauth: z.ZodOptional<z.ZodOptional<z.ZodObject<{
@@ -1287,8 +1271,8 @@ declare const ByfConfigSchema: z.ZodObject<{
1287
1271
  defaultThinking: z.ZodOptional<z.ZodBoolean>;
1288
1272
  defaultPermissionMode: z.ZodOptional<z.ZodEnum<{
1289
1273
  auto: "auto";
1290
- yolo: "yolo";
1291
1274
  manual: "manual";
1275
+ yolo: "yolo";
1292
1276
  }>>;
1293
1277
  permission: z.ZodOptional<z.ZodObject<{
1294
1278
  rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1328,19 +1312,19 @@ declare const ByfConfigSchema: z.ZodObject<{
1328
1312
  timeout: z.ZodOptional<z.ZodNumber>;
1329
1313
  }, z.core.$strict>>>;
1330
1314
  services: z.ZodOptional<z.ZodObject<{
1331
- byfSearch: z.ZodOptional<z.ZodObject<{
1332
- baseUrl: z.ZodOptional<z.ZodString>;
1333
- apiKey: z.ZodOptional<z.ZodString>;
1334
- oauth: z.ZodOptional<z.ZodObject<{
1335
- storage: z.ZodEnum<{
1336
- file: "file";
1337
- keyring: "keyring";
1315
+ webSearch: z.ZodOptional<z.ZodObject<{
1316
+ providers: z.ZodArray<z.ZodObject<{
1317
+ type: z.ZodEnum<{
1318
+ exa: "exa";
1319
+ brave: "brave";
1320
+ firecrawl: "firecrawl";
1338
1321
  }>;
1339
- key: z.ZodString;
1322
+ apiKeys: z.ZodArray<z.ZodString>;
1323
+ baseUrl: z.ZodOptional<z.ZodString>;
1324
+ priority: z.ZodNumber;
1340
1325
  }, z.core.$strip>>;
1341
- customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1342
1326
  }, z.core.$strip>>;
1343
- byfFetch: z.ZodOptional<z.ZodObject<{
1327
+ fetchUrl: z.ZodOptional<z.ZodObject<{
1344
1328
  baseUrl: z.ZodOptional<z.ZodString>;
1345
1329
  apiKey: z.ZodOptional<z.ZodString>;
1346
1330
  oauth: z.ZodOptional<z.ZodObject<{
@@ -1406,9 +1390,6 @@ declare class ByfCore implements PromisableMethods<CoreAPI> {
1406
1390
  setThinking({ sessionId, ...payload }: SessionAgentPayload<SetThinkingPayload>): void | Promise<void>;
1407
1391
  setPermission({ sessionId, ...payload }: SessionAgentPayload<SetPermissionPayload>): void | Promise<void>;
1408
1392
  getModel({ sessionId, ...payload }: SessionAgentPayload<EmptyPayload>): string | Promise<string>;
1409
- enterPlan({ sessionId, ...payload }: SessionAgentPayload<EmptyPayload>): void | Promise<void>;
1410
- cancelPlan({ sessionId, ...payload }: SessionAgentPayload<CancelPlanPayload>): void | Promise<void>;
1411
- clearPlan({ sessionId, ...payload }: SessionAgentPayload<EmptyPayload>): void | Promise<void>;
1412
1393
  beginCompaction({ sessionId, ...payload }: SessionAgentPayload<BeginCompactionPayload>): void | Promise<void>;
1413
1394
  cancelCompaction({ sessionId, ...payload }: SessionAgentPayload<EmptyPayload>): void | Promise<void>;
1414
1395
  registerTool({ sessionId, ...payload }: SessionAgentPayload<RegisterToolPayload>): void | Promise<void>;
@@ -1422,7 +1403,6 @@ declare class ByfCore implements PromisableMethods<CoreAPI> {
1422
1403
  getContext({ sessionId, ...payload }: SessionAgentPayload<EmptyPayload>): AgentContextData | Promise<AgentContextData>;
1423
1404
  getConfig({ sessionId, ...payload }: SessionAgentPayload<EmptyPayload>): AgentConfigData | Promise<AgentConfigData>;
1424
1405
  getPermission({ sessionId, ...payload }: SessionAgentPayload<EmptyPayload>): PermissionData | Promise<PermissionData>;
1425
- getPlan({ sessionId, ...payload }: SessionAgentPayload<EmptyPayload>): Promise<null> | null;
1426
1406
  getUsage({ sessionId, ...payload }: SessionAgentPayload<EmptyPayload>): UsageStatus | Promise<UsageStatus>;
1427
1407
  getTools({ sessionId, ...payload }: SessionAgentPayload<EmptyPayload>): readonly ToolInfo[] | Promise<readonly ToolInfo[]>;
1428
1408
  getBackground({ sessionId, ...payload }: SessionAgentPayload<GetBackgroundPayload>): readonly BackgroundTaskInfo[] | Promise<readonly BackgroundTaskInfo[]>;
@@ -1514,7 +1494,7 @@ export declare class ByfHarness {
1514
1494
  get sessions(): ReadonlyMap<string, Session>;
1515
1495
  get interactiveAgentId(): string;
1516
1496
  set interactiveAgentId(agentId: string);
1517
- track(event: string, properties?: Record<string, unknown>): void;
1497
+ track(_event: string, _properties?: Record<string, unknown>): void;
1518
1498
  createSession(options: CreateSessionOptions): Promise<Session>;
1519
1499
  resumeSession(input: ResumeSessionInput): Promise<Session>;
1520
1500
  forkSession(input: ForkSessionInput): Promise<Session>;
@@ -1527,6 +1507,7 @@ export declare class ByfHarness {
1527
1507
  ensureConfigFile(): Promise<void>;
1528
1508
  setConfig(patch: ByfConfigPatch): Promise<ByfConfig>;
1529
1509
  removeProvider(providerId: string): Promise<ByfConfig>;
1510
+ updateConfig(input?: UpdateConfigInput): Promise<UpdateConfigResult>;
1530
1511
  shellExec(command: string, options?: {
1531
1512
  cwd?: string;
1532
1513
  timeout?: number;
@@ -1539,6 +1520,7 @@ export declare interface ByfHarnessOptions {
1539
1520
  readonly identity?: HostIdentity | undefined;
1540
1521
  readonly homeDir?: string | undefined;
1541
1522
  readonly configPath?: string | undefined;
1523
+ readonly runtime?: RuntimeConfig | undefined;
1542
1524
  readonly autoLoadConfig?: boolean | undefined;
1543
1525
  readonly uiMode?: string;
1544
1526
  readonly skillDirs?: readonly string[];
@@ -1621,10 +1603,6 @@ declare interface CancelPayload {
1621
1603
  readonly turnId?: number;
1622
1604
  }
1623
1605
 
1624
- declare interface CancelPlanPayload {
1625
- readonly id?: string;
1626
- }
1627
-
1628
1606
  /** Top-level catalog: `{ [providerId]: ProviderEntry }` (e.g. models.dev/api.json). */
1629
1607
  export declare type Catalog = Record<string, CatalogProviderEntry>;
1630
1608
 
@@ -2210,6 +2188,28 @@ export declare function fetchModelsByType(type: string, baseUrl: string, apiKey:
2210
2188
  */
2211
2189
  export declare function findCatalogModel(catalog: Catalog, modelId: string): CatalogModel | undefined;
2212
2190
 
2191
+ /**
2192
+ * Update-rules for `byf update-config`.
2193
+ *
2194
+ * Each rule corresponds to a deprecated / renamed / migrated field that
2195
+ * `analyzeConfig` can detect in `config.raw` and (where applicable) that
2196
+ * `applyFixes` can clean up.
2197
+ *
2198
+ * **Principles** (from PRD-0013 grill decisions):
2199
+ * - G2 — Whitelist approach: only fields explicitly registered here are removed.
2200
+ * - Every rule carries a `deprecatedSince` version annotation so the report
2201
+ * tells the user *when* the field became obsolete.
2202
+ */
2203
+ export declare interface Finding {
2204
+ kind: 'removed' | 'renamed' | 'migrated' | 'dangling' | 'unknown' | 'invalid-value';
2205
+ /** TOML dotted path, e.g. `'services.byf_search'`, `'loop_control.max_steps_per_run'`. */
2206
+ path: string;
2207
+ /** Human-readable description of what was found and what will happen. */
2208
+ detail: string;
2209
+ /** Version when this field was deprecated (optional — may be unknown for very old fields). */
2210
+ deprecatedSince?: string;
2211
+ }
2212
+
2213
2213
  /**
2214
2214
  * Normalized finish-reason signal indicating why a generation stopped.
2215
2215
  *
@@ -3531,15 +3531,6 @@ declare type PermissionRuleDecision = 'allow' | 'deny' | 'ask';
3531
3531
  */
3532
3532
  declare type PermissionRuleScope = 'turn-override' | 'session-runtime' | 'project' | 'user';
3533
3533
 
3534
- declare type PlanData = null;
3535
-
3536
- export declare interface PlanInfo {
3537
- readonly id: string;
3538
- readonly exists: boolean;
3539
- readonly content: string;
3540
- readonly path: string;
3541
- }
3542
-
3543
3534
  declare type PreparedSystemPromptContext = Pick<SystemPromptContext, 'cwd' | 'agentsMd'>;
3544
3535
 
3545
3536
  declare interface PrepareToolExecutionResult {
@@ -3959,7 +3950,6 @@ export declare interface ResumedAgentState {
3959
3950
  readonly context: AgentContextData;
3960
3951
  readonly replay: readonly AgentReplayRecord[];
3961
3952
  readonly permission: PermissionData;
3962
- readonly plan: PlanData;
3963
3953
  readonly usage: UsageStatus;
3964
3954
  readonly tools: readonly ToolInfo[];
3965
3955
  readonly toolStore?: Readonly<Record<string, unknown>>;
@@ -4097,8 +4087,6 @@ declare class SDKRpcClient {
4097
4087
  setModel(input: SetSessionModelRpcInput): Promise<SetSessionModelRpcResult>;
4098
4088
  setThinking(input: SetSessionThinkingRpcInput): Promise<void>;
4099
4089
  setPermission(input: SetSessionPermissionRpcInput): Promise<void>;
4100
- getPlan(input: SessionIdRpcInput): Promise<SessionPlan>;
4101
- clearPlan(input: SessionIdRpcInput): Promise<void>;
4102
4090
  compact(input: SessionIdRpcInput & CompactOptions): Promise<void>;
4103
4091
  cancelCompaction(input: SessionIdRpcInput): Promise<void>;
4104
4092
  getUsage(input: SessionIdRpcInput): Promise<SessionUsage>;
@@ -4145,6 +4133,7 @@ declare interface SDKRpcClientOptions {
4145
4133
  readonly homeDir?: string | undefined;
4146
4134
  readonly configPath?: string | undefined;
4147
4135
  readonly skillDirs?: readonly string[];
4136
+ readonly runtime?: RuntimeConfig | undefined;
4148
4137
  }
4149
4138
 
4150
4139
  declare type SDKSessionAPI = WithAgentId<SDKAgentAPI>;
@@ -4158,19 +4147,19 @@ declare interface ServicesConfig_2 {
4158
4147
  }
4159
4148
 
4160
4149
  declare const ServicesConfigSchema: z.ZodObject<{
4161
- byfSearch: z.ZodOptional<z.ZodObject<{
4162
- baseUrl: z.ZodOptional<z.ZodString>;
4163
- apiKey: z.ZodOptional<z.ZodString>;
4164
- oauth: z.ZodOptional<z.ZodObject<{
4165
- storage: z.ZodEnum<{
4166
- file: "file";
4167
- keyring: "keyring";
4150
+ webSearch: z.ZodOptional<z.ZodObject<{
4151
+ providers: z.ZodArray<z.ZodObject<{
4152
+ type: z.ZodEnum<{
4153
+ exa: "exa";
4154
+ brave: "brave";
4155
+ firecrawl: "firecrawl";
4168
4156
  }>;
4169
- key: z.ZodString;
4157
+ apiKeys: z.ZodArray<z.ZodString>;
4158
+ baseUrl: z.ZodOptional<z.ZodString>;
4159
+ priority: z.ZodNumber;
4170
4160
  }, z.core.$strip>>;
4171
- customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
4172
4161
  }, z.core.$strip>>;
4173
- byfFetch: z.ZodOptional<z.ZodObject<{
4162
+ fetchUrl: z.ZodOptional<z.ZodObject<{
4174
4163
  baseUrl: z.ZodOptional<z.ZodString>;
4175
4164
  apiKey: z.ZodOptional<z.ZodString>;
4176
4165
  oauth: z.ZodOptional<z.ZodObject<{
@@ -4208,8 +4197,6 @@ export declare class Session {
4208
4197
  setModel(model: string): Promise<void>;
4209
4198
  setThinking(level: string): Promise<void>;
4210
4199
  setPermission(mode: PermissionMode): Promise<void>;
4211
- getPlan(): Promise<SessionPlan>;
4212
- clearPlan(): Promise<void>;
4213
4200
  compact(options?: CompactOptions): Promise<void>;
4214
4201
  cancelCompaction(): Promise<void>;
4215
4202
  getUsage(): Promise<SessionUsage>;
@@ -4385,8 +4372,6 @@ declare interface SessionOptions {
4385
4372
  readonly onClose?: (() => void | Promise<void>) | undefined;
4386
4373
  }
4387
4374
 
4388
- export declare type SessionPlan = PlanInfo | null;
4389
-
4390
4375
  declare interface SessionPromptRpcInput {
4391
4376
  readonly sessionId: string;
4392
4377
  readonly input: PromptInput;
@@ -5304,6 +5289,17 @@ declare interface UnregisterToolPayload {
5304
5289
 
5305
5290
  export declare type Unsubscribe = () => void;
5306
5291
 
5292
+ export declare interface UpdateConfigInput {
5293
+ readonly fix?: boolean;
5294
+ readonly configPath?: string;
5295
+ }
5296
+
5297
+ export declare interface UpdateConfigResult {
5298
+ readonly findings: readonly Finding[];
5299
+ readonly fixed: boolean;
5300
+ readonly backupPath?: string;
5301
+ }
5302
+
5307
5303
  declare interface UpdateSessionMetadataPayload {
5308
5304
  readonly metadata: SessionMetadataPatch;
5309
5305
  }