@byfriends/sdk 0.2.5 → 0.3.0
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 +41 -3
- package/dist/index.mjs +540 -564
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -140,6 +140,13 @@ declare interface AgentMeta {
|
|
|
140
140
|
readonly homedir: string;
|
|
141
141
|
readonly type: AgentType;
|
|
142
142
|
readonly parentAgentId: string | null;
|
|
143
|
+
/**
|
|
144
|
+
* The parent agent's tool-call id that spawned this agent. Absent for the
|
|
145
|
+
* main agent and for sessions persisted before this field existed. The TUI
|
|
146
|
+
* uses it on resume to map a main-agent `Agent` tool-call back to its child
|
|
147
|
+
* agent's activity (the child's own replay/usage/text).
|
|
148
|
+
*/
|
|
149
|
+
readonly parentToolCallId?: string | undefined;
|
|
143
150
|
}
|
|
144
151
|
|
|
145
152
|
declare type AgentRecord = {
|
|
@@ -326,6 +333,7 @@ export declare interface ApplyCatalogProviderOptions {
|
|
|
326
333
|
|
|
327
334
|
export declare function applyProviderConfig(config: ConfigShape, options: {
|
|
328
335
|
readonly name: string;
|
|
336
|
+
readonly type?: string | undefined;
|
|
329
337
|
readonly baseUrl: string;
|
|
330
338
|
readonly apiKey: string;
|
|
331
339
|
readonly models: readonly ModelInfo[];
|
|
@@ -654,7 +662,7 @@ declare class BackgroundProcessManager {
|
|
|
654
662
|
/** Drop a persisted task from disk and ghost map. */
|
|
655
663
|
forgetTask(taskId: string): Promise<void>;
|
|
656
664
|
/**
|
|
657
|
-
* Persist the current state of a live
|
|
665
|
+
* Persist the current state of a live TaskEntry. Called from
|
|
658
666
|
* `register()` and the lifecycle finally block. No-op unless attached.
|
|
659
667
|
*/
|
|
660
668
|
private persistLive;
|
|
@@ -676,7 +684,7 @@ export declare interface BackgroundTaskInfo {
|
|
|
676
684
|
readonly command: string;
|
|
677
685
|
readonly description: string;
|
|
678
686
|
readonly status: BackgroundTaskStatus;
|
|
679
|
-
readonly pid: number;
|
|
687
|
+
readonly pid: number | null;
|
|
680
688
|
readonly exitCode: number | null;
|
|
681
689
|
readonly startedAt: number;
|
|
682
690
|
readonly endedAt: number | null;
|
|
@@ -1883,6 +1891,12 @@ declare class ContextMemory implements RecordRestoreHandler {
|
|
|
1883
1891
|
get tokenCountWithPending(): number;
|
|
1884
1892
|
get history(): readonly ContextMessage[];
|
|
1885
1893
|
get messages(): Message[];
|
|
1894
|
+
/**
|
|
1895
|
+
* Project history into provider-ready messages, optionally with
|
|
1896
|
+
* ephemeral injections (e.g. timestamp, permission mode) appended
|
|
1897
|
+
* at the `'before_user'` position.
|
|
1898
|
+
*/
|
|
1899
|
+
getMessages(ephemeral?: readonly EphemeralInjection[]): Message[];
|
|
1886
1900
|
applyObservationMasking(config?: MaskingConfig): MaskingResult;
|
|
1887
1901
|
applyPruning(config?: {
|
|
1888
1902
|
effectiveCapacityRatio?: number;
|
|
@@ -1993,6 +2007,12 @@ declare interface Environment {
|
|
|
1993
2007
|
readonly shellPath: string;
|
|
1994
2008
|
}
|
|
1995
2009
|
|
|
2010
|
+
declare interface EphemeralInjection {
|
|
2011
|
+
kind: 'memory_recall' | 'system_reminder' | 'pending_notification';
|
|
2012
|
+
content: string | Record<string, unknown>;
|
|
2013
|
+
position?: 'before_user' | 'after_system';
|
|
2014
|
+
}
|
|
2015
|
+
|
|
1996
2016
|
/**
|
|
1997
2017
|
* Error codes for Byf Core's public error protocol.
|
|
1998
2018
|
*
|
|
@@ -2174,6 +2194,16 @@ export declare function fetchCatalog(url: string, signal?: AbortSignal, fetchImp
|
|
|
2174
2194
|
|
|
2175
2195
|
export declare function fetchModels(baseUrl: string, apiKey: string, fetchImpl?: typeof fetch, signal?: AbortSignal): Promise<ModelInfo[]>;
|
|
2176
2196
|
|
|
2197
|
+
/**
|
|
2198
|
+
* Lists models from a provider using its native wire-type endpoint. Dispatches
|
|
2199
|
+
* per `type` so each protocol gets its correct auth header and response shape.
|
|
2200
|
+
* `openai-completions` and `openai_responses` share the OpenAI-compatible
|
|
2201
|
+
* `/models` endpoint; `anthropic` uses its native `x-api-key` endpoint with
|
|
2202
|
+
* pagination. Other types have dedicated native fetchers (added in
|
|
2203
|
+
* later slices).
|
|
2204
|
+
*/
|
|
2205
|
+
export declare function fetchModelsByType(type: string, baseUrl: string, apiKey: string, fetchImpl?: typeof fetch, signal?: AbortSignal): Promise<ModelInfo[]>;
|
|
2206
|
+
|
|
2177
2207
|
/**
|
|
2178
2208
|
* Searches all providers in the catalog for a model whose ID matches
|
|
2179
2209
|
* `modelId` (prefix + separator boundary). Returns the first match.
|
|
@@ -2516,6 +2546,7 @@ declare class InjectionManager {
|
|
|
2516
2546
|
private readonly injectors;
|
|
2517
2547
|
constructor(agent: Agent);
|
|
2518
2548
|
inject(): Promise<void>;
|
|
2549
|
+
getEphemeralInjections(): readonly EphemeralInjection[];
|
|
2519
2550
|
onContextClear(): void;
|
|
2520
2551
|
onContextCompacted(compactedCount: number): void;
|
|
2521
2552
|
}
|
|
@@ -3933,6 +3964,13 @@ export declare interface ResumedAgentState {
|
|
|
3933
3964
|
readonly tools: readonly ToolInfo[];
|
|
3934
3965
|
readonly toolStore?: Readonly<Record<string, unknown>>;
|
|
3935
3966
|
readonly background: readonly BackgroundTaskInfo[];
|
|
3967
|
+
/**
|
|
3968
|
+
* For sub-agents: the parent agent's tool-call id that spawned this agent.
|
|
3969
|
+
* Absent for the main agent and for sessions persisted before this field
|
|
3970
|
+
* existed. The TUI uses it to attach a resumed main-agent `Agent` tool-call
|
|
3971
|
+
* to this child's activity (replay/usage/text).
|
|
3972
|
+
*/
|
|
3973
|
+
readonly parentToolCallId?: string | undefined;
|
|
3936
3974
|
}
|
|
3937
3975
|
|
|
3938
3976
|
export declare type ResumedSessionState = Pick<ResumeSessionResult, 'sessionMetadata' | 'agents' | 'warning'>;
|
|
@@ -4246,7 +4284,7 @@ declare class Session_2 {
|
|
|
4246
4284
|
}>;
|
|
4247
4285
|
close(): Promise<void>;
|
|
4248
4286
|
private stopBackgroundTasksOnExit;
|
|
4249
|
-
createAgent(config: Partial<AgentConfig>, profile?: ResolvedAgentProfile, parentAgentId?: string | undefined): Promise<{
|
|
4287
|
+
createAgent(config: Partial<AgentConfig>, profile?: ResolvedAgentProfile, parentAgentId?: string | undefined, parentToolCallId?: string | undefined): Promise<{
|
|
4250
4288
|
readonly id: string;
|
|
4251
4289
|
readonly agent: Agent;
|
|
4252
4290
|
}>;
|