libfx 0.0.14 → 0.0.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libfx",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "Embed fx agents and terminals in JavaScript hosts",
5
5
  "type": "module",
6
6
  "repository": {
@@ -15,9 +15,12 @@ export interface World {
15
15
  list(params: unknown): unknown;
16
16
  };
17
17
  readonly streams: {
18
- write(runId: string, name: string, chunk: string): unknown;
18
+ /** A session's view is written as text; each prompt image as one chunk of bytes. */
19
+ write(runId: string, name: string, chunk: string | Uint8Array): unknown;
19
20
  writeMulti?(runId: string, name: string, chunks: string[]): unknown;
20
21
  get(runId: string, name: string, startIndex?: number): unknown;
22
+ /** Read for a session's images: a page of chunks, `{ data: { data }[] }`. */
23
+ getChunks(runId: string, name: string, options?: { limit?: number; cursor?: string }): unknown;
21
24
  getInfo(runId: string, name: string): unknown;
22
25
  };
23
26
  queue(queueName: string, message: unknown, options?: unknown): unknown;
package/types/libfx.d.cts CHANGED
@@ -60,7 +60,7 @@ export type FxModelChoice =
60
60
  ultrafast?: never;
61
61
  }
62
62
  | {
63
- /** The model ID. Defaults to fx's built-in model. */
63
+ /** The model ID. On AI Gateway it defaults to fx's built-in model; Codex, Grok, and custom providers need one. */
64
64
  model?: string | undefined;
65
65
  /** @deprecated Use `model: { id, effort }`. */
66
66
  effort?: FxEffort;
@@ -224,7 +224,7 @@ export type FxKeyedTool =
224
224
  | (Omit<FxHostTool, "name"> & { name?: string })
225
225
  | (Omit<FxProviderTool, "name"> & { name?: "web_search" });
226
226
 
227
- /** At most 64 tools: an array of descriptors, or an object keyed by tool name. */
227
+ /** Tools: an array of descriptors, or an object keyed by tool name. */
228
228
  export type FxTools = readonly FxTool[] | { readonly [name: string]: FxKeyedTool };
229
229
 
230
230
  /** A tool descriptor for `createFxAgent()`. */
@@ -235,7 +235,7 @@ export type FxAgentKeyedTool =
235
235
  | (Omit<FxAgentHostTool, "name"> & { name?: string })
236
236
  | (Omit<FxProviderTool, "name"> & { name?: "web_search" });
237
237
 
238
- /** At most 64 `createFxAgent()` tools: an array of descriptors, or an object keyed by tool name. */
238
+ /** `createFxAgent()` tools: an array of descriptors, or an object keyed by tool name. */
239
239
  export type FxAgentTools = readonly FxAgentTool[] | { readonly [name: string]: FxAgentKeyedTool };
240
240
 
241
241
  // ---------------------------------------------------------------------------
@@ -704,6 +704,8 @@ export type FxEngineOptions = FxSharedOptions<FxEngineEvent> & FxModelChoice & F
704
704
  | ((FxCodexProvider | FxGrokProvider | FxCustomProvider) & {
705
705
  /** The AI Gateway credential, unused by this provider's turns. */
706
706
  apiKey?: string | undefined;
707
+ /** The provider's own model. Required: fx's built-in model is an AI Gateway id. */
708
+ model: string | FxModelOptions;
707
709
  })
708
710
  ) & {
709
711
  /** The id for AI Gateway session affinity: 1 to 255 letters, digits, `.`, `_`, or `-`. Give a restored session the id it had before. */
@@ -863,7 +865,11 @@ export type FxStreamLine = (
863
865
  export interface FxSession {
864
866
  /** The session's id; for a new session, null until its first prompt is accepted. */
865
867
  readonly id: string | null;
866
- /** Queues `input` as the session's next turn and returns a view of that turn. */
868
+ /**
869
+ * Queues `input` as the session's next turn and returns a view of that turn. Throws a
870
+ * TypeError or RangeError for an input libfx refuses, and stores nothing. A prompt whose
871
+ * `signal` aborts before it is stored is never stored, and ends `cancelled`.
872
+ */
867
873
  prompt(input: FxSessionPromptInput, options?: FxPromptOptions): FxTurn;
868
874
  /** Continues a turn a stopped process left open; its result has the stop reason `idle` when there was none. */
869
875
  resume(): FxResumeTurn;