@flue/sdk 0.3.5 → 0.3.7
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/README.md +33 -3
- package/dist/{agent-BB4lwAd5.mjs → agent-BTB0809P.mjs} +1 -1
- package/dist/client.d.mts +3 -3
- package/dist/client.mjs +33 -12
- package/dist/cloudflare/index.d.mts +2 -2
- package/dist/cloudflare/index.mjs +5 -3
- package/dist/{command-helpers-DdAfbnom.d.mts → command-helpers-5DpOaRIB.d.mts} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +199 -92
- package/dist/internal.d.mts +265 -4
- package/dist/internal.mjs +438 -6
- package/dist/{mcp-DOgMtp8y.mjs → mcp-B13ZPduG.mjs} +4 -3
- package/dist/{mcp-BVF-sOBZ.d.mts → mcp-CKMPhMDe.d.mts} +1 -1
- package/dist/node/index.d.mts +2 -2
- package/dist/sandbox.d.mts +2 -1
- package/dist/sandbox.mjs +31 -5
- package/dist/{session-DukL3zwF.mjs → session-CNOAfV45.mjs} +14 -8
- package/dist/{types-T8pE1xIS.d.mts → types-CKcp6T-y.d.mts} +64 -16
- package/package.json +1 -1
|
@@ -67,6 +67,7 @@ interface SessionEnv {
|
|
|
67
67
|
exec(command: string, options?: {
|
|
68
68
|
cwd?: string;
|
|
69
69
|
env?: Record<string, string>;
|
|
70
|
+
timeout?: number;
|
|
70
71
|
}): Promise<ShellResult>;
|
|
71
72
|
/** Create an operation-scoped environment, usually backed by a fresh Bash runtime. */
|
|
72
73
|
scope?(options?: {
|
|
@@ -101,6 +102,25 @@ interface CompactionConfig {
|
|
|
101
102
|
/** Recent tokens to preserve (not summarized). Default: 20000 */
|
|
102
103
|
keepRecentTokens?: number;
|
|
103
104
|
}
|
|
105
|
+
interface ProviderSettings {
|
|
106
|
+
/**
|
|
107
|
+
* Provider endpoint used by built-in models. Useful for API gateways,
|
|
108
|
+
* LiteLLM-style proxies, or enterprise-managed provider endpoints.
|
|
109
|
+
*/
|
|
110
|
+
baseUrl?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Headers merged into the resolved model's provider-level headers. Values
|
|
113
|
+
* here override headers already defined by the built-in model.
|
|
114
|
+
*/
|
|
115
|
+
headers?: Record<string, string>;
|
|
116
|
+
/**
|
|
117
|
+
* API key returned to the underlying agent runtime for this provider.
|
|
118
|
+
* Useful when the gateway requires a dummy key or when credentials should
|
|
119
|
+
* come from the agent's runtime env instead of process-global env vars.
|
|
120
|
+
*/
|
|
121
|
+
apiKey?: string;
|
|
122
|
+
}
|
|
123
|
+
type ProvidersConfig = Record<string, ProviderSettings>;
|
|
104
124
|
interface AgentConfig {
|
|
105
125
|
/** Discovered at runtime from AGENTS.md + .agents/skills/ in the session's cwd. */
|
|
106
126
|
systemPrompt: string;
|
|
@@ -108,27 +128,34 @@ interface AgentConfig {
|
|
|
108
128
|
skills: Record<string, Skill>;
|
|
109
129
|
roles: Record<string, Role>;
|
|
110
130
|
/**
|
|
111
|
-
* Agent-wide default model. Undefined
|
|
112
|
-
* `init({ model:
|
|
113
|
-
*
|
|
131
|
+
* Agent-wide default model. Undefined when the user explicitly passes
|
|
132
|
+
* `init({ model: false })`, so each model-using call must resolve one from a
|
|
133
|
+
* role or call-site override.
|
|
114
134
|
*/
|
|
115
135
|
model: Model<any> | undefined;
|
|
116
136
|
/** Agent-wide default role. Per-session and per-call roles override this. */
|
|
117
137
|
role?: string;
|
|
118
|
-
/**
|
|
119
|
-
|
|
138
|
+
/** Provider runtime settings applied when resolving models. */
|
|
139
|
+
providers?: ProvidersConfig;
|
|
140
|
+
/** Resolve model config to a Model instance. Throws on invalid model strings. */
|
|
141
|
+
resolveModel: (model: ModelConfig | undefined, providers?: ProvidersConfig) => Model<any> | undefined;
|
|
120
142
|
compaction?: CompactionConfig;
|
|
121
143
|
}
|
|
122
|
-
|
|
123
|
-
|
|
144
|
+
type ModelConfig = string | false;
|
|
145
|
+
/**
|
|
146
|
+
* Request context passed to agent handler functions. Pass type parameters
|
|
147
|
+
* to type `payload` and `env` (e.g. the `Env` interface generated by
|
|
148
|
+
* `wrangler types`). Compile-time only — no runtime validation of `payload`.
|
|
149
|
+
*/
|
|
150
|
+
interface FlueContext<TPayload = any, TEnv = Record<string, any>> {
|
|
124
151
|
readonly id: string;
|
|
125
|
-
readonly payload:
|
|
152
|
+
readonly payload: TPayload;
|
|
126
153
|
/** Platform env bindings (process.env on Node, Worker env on Cloudflare). */
|
|
127
|
-
readonly env:
|
|
154
|
+
readonly env: TEnv;
|
|
128
155
|
/** Initialize an agent runtime with sandbox + persistence. */
|
|
129
|
-
init(options
|
|
156
|
+
init(options: AgentInit): Promise<FlueAgent>;
|
|
130
157
|
}
|
|
131
|
-
/**
|
|
158
|
+
/** Agent runtime options. A default model is required unless explicitly disabled with `model: false`. */
|
|
132
159
|
interface AgentInit {
|
|
133
160
|
/** Agent/sandbox scope id. Defaults to the route/context id. */
|
|
134
161
|
id?: string;
|
|
@@ -144,16 +171,37 @@ interface AgentInit {
|
|
|
144
171
|
/** Defaults to platform store (in-memory on Node, DO SQLite on Cloudflare). */
|
|
145
172
|
persist?: SessionStore;
|
|
146
173
|
/**
|
|
147
|
-
*
|
|
148
|
-
* calls unless overridden at the call site.
|
|
174
|
+
* Default model for this agent. Applies to all prompt(), skill(), and task()
|
|
175
|
+
* calls unless overridden by a role or at the call site. Pass `false` to require every
|
|
176
|
+
* model-using call to resolve a model from a role or call-site override.
|
|
149
177
|
*
|
|
150
178
|
* Format: `'provider/modelId'` (e.g. `'anthropic/claude-opus-4-20250514'`).
|
|
151
179
|
*
|
|
152
|
-
* Precedence (highest wins): per-call `model` > role `model` > agent `model
|
|
180
|
+
* Precedence (highest wins): per-call `model` > role `model` > agent `model`.
|
|
153
181
|
*/
|
|
154
|
-
model
|
|
182
|
+
model: ModelConfig;
|
|
155
183
|
/** Agent-wide default role. Overridden by session-level or per-call roles. */
|
|
156
184
|
role?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Provider runtime settings for every model used by this agent, including
|
|
187
|
+
* role-level and per-call model selections.
|
|
188
|
+
*
|
|
189
|
+
* Example:
|
|
190
|
+
*
|
|
191
|
+
* ```ts
|
|
192
|
+
* await init({
|
|
193
|
+
* model: 'anthropic/claude-sonnet-4-6',
|
|
194
|
+
* providers: {
|
|
195
|
+
* anthropic: {
|
|
196
|
+
* baseUrl: env.ANTHROPIC_BASE_URL,
|
|
197
|
+
* headers: { 'X-Custom-Auth': env.GATEWAY_KEY },
|
|
198
|
+
* apiKey: 'dummy',
|
|
199
|
+
* },
|
|
200
|
+
* },
|
|
201
|
+
* });
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
providers?: ProvidersConfig;
|
|
157
205
|
/**
|
|
158
206
|
* Agent-wide tools. Every prompt(), skill(), and task() call can use these.
|
|
159
207
|
* Per-call tools are added on top and must not reuse the same names.
|
|
@@ -458,4 +506,4 @@ interface BuildOptions {
|
|
|
458
506
|
plugin?: BuildPlugin;
|
|
459
507
|
}
|
|
460
508
|
//#endregion
|
|
461
|
-
export {
|
|
509
|
+
export { ShellResult as A, Role as C, SessionOptions as D, SessionEnv as E, ToolParameters as F, SkillOptions as M, TaskOptions as N, SessionStore as O, ToolDef as P, ProvidersConfig as S, SessionData as T, FlueSessions as _, BashLike as a, PromptResponse as b, BuildPlugin as c, FileStat as d, FlueAgent as f, FlueSession as g, FlueEventCallback as h, BashFactory as i, Skill as j, ShellOptions as k, Command as l, FlueEvent as m, AgentInfo as n, BuildContext as o, FlueContext as p, AgentInit as r, BuildOptions as s, AgentConfig as t, CommandDef as u, ModelConfig as v, SandboxFactory as w, ProviderSettings as x, PromptOptions as y };
|