langfx.js 0.1.0-alpha.2 → 0.1.0-alpha.3

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 CHANGED
@@ -2,10 +2,27 @@
2
2
 
3
3
  Language as functions, in TypeScript. Build agents in browsers, workers, and apps without a Python agent backend.
4
4
 
5
- **Status: alpha (`0.1.0-alpha.1`).** OpenAI, Anthropic, and Gemini support text/image inputs, client tools, and streaming tool events through fixture-tested transports. The runtime includes prompt composition, structured JSON streaming, bounded agents, invocation traces/logs/progress, retries, and local response caching. Gemini has passed the live smoke suite; live OpenAI/Anthropic behavior and provider browser CORS remain unverified. APIs may change during alpha. See [implementation status](docs/IMPLEMENTATION_STATUS.md) and the [opt-in live smoke runner](docs/LIVE_TESTING.md).
5
+ **Status: alpha (`0.1.0-alpha.3`).** OpenAI, Anthropic, and Gemini support text/image inputs, client tools, and streaming tool events through fixture-tested transports. The runtime includes prompt composition, structured JSON streaming, bounded agents, invocation traces/logs/progress, retries, and local response caching. Gemini has passed the live smoke suite; live OpenAI/Anthropic behavior and provider browser CORS remain unverified. APIs may change during alpha. See [implementation status](docs/IMPLEMENTATION_STATUS.md) and the [opt-in live smoke runner](docs/LIVE_TESTING.md).
6
6
 
7
7
  The proposal is based on [`free-solo/langfx`](https://github.com/free-solo/langfx) at commit `2a1ea4e8dcd7075bf745ad707f901ece8546f47d`, examined on September 16, 2026.
8
8
 
9
+ Try the [npm quickstart](https://github.com/free-solo/langfx.js/blob/main/examples/npm-quickstart/README.md) for a credentials-free nested-class query using the published package.
10
+
11
+ ## Agents inside your app
12
+
13
+ Declare model-generated values with `lf.typed.Class`, give action classes application-owned dependencies, and execute validated instances through `lf.Session`. Your application controls when those actions run.
14
+
15
+ | Example | What it demonstrates | Run from this repository |
16
+ | --- | --- | --- |
17
+ | [Board agent](examples/board-agent/README.md) | Typed edits, before/after preview, explicit approval, atomic apply, and undo | `npm run example:board` |
18
+ | [Search agent](examples/search-agent/README.md) | Multi-step actions, real web search over MCP, streamed answers, and cancellation | `npm run example:search` |
19
+
20
+ For React, try the [standalone React board](examples/react-board/README.md), which installs the published package with its own dependencies. See [integration findings](docs/REACT_INTEGRATION.md) for what is tested and what the app still owns.
21
+
22
+ Both use real Gemini inference and a local credential gateway. See [App actions and approval](docs/APP_ACTIONS.md) to adapt the board example to your own application. Approval and undo are implemented by the example; the core provides typed generation and action execution.
23
+
24
+ To try preview, approval, and undo without credentials, run `npm run example:approval` after `npm ci`. This terminal walkthrough uses a clearly labeled fixed test response and the same board actions; it makes no API requests.
25
+
9
26
  ## Install the alpha
10
27
 
11
28
  Install with `npm install langfx.js@alpha`. Zod users also install `zod`; the core has no runtime dependencies. See [release notes and publishing procedure](docs/RELEASING.md).
@@ -22,28 +39,28 @@ npm run example:agent
22
39
  npm run serve:example
23
40
  ```
24
41
 
25
- For a complete browser app with live web search over MCP, streamed answers, cancellation, and simulated failures, run `npm run example:app`. See [Search agent](examples/app/README.md) for setup and live-model integration.
42
+ For a complete browser app with live web search over MCP, streamed answers, cancellation, and simulated failures, run `npm run example:search`. See [Search agent](examples/search-agent/README.md) for setup and live-model integration.
26
43
 
27
44
  `npm run serve:example` serves the browser/worker example at `http://127.0.0.1:8765`. No credentials or Python runtime are needed. Fake models are imported separately from the core:
28
45
 
29
46
  ```ts
30
47
  import * as lf from 'langfx.js';
31
48
  import { Echo, StaticResponse } from 'langfx.js/testing';
32
- import { fromZod } from 'langfx.js/schema/zod';
33
- import { z } from 'zod';
49
+ const t = lf.typed;
34
50
 
35
51
  const lm = new Echo();
36
52
  console.log(await lf.query('Hello {{name}}!', { lm, vars: { name: 'Ada' } }));
37
53
 
38
- const Answer = fromZod(z.object({ answer: z.number() }));
54
+ class Answer extends t.Class({ answer: t.int }) {}
39
55
  const result = await lf.query('What is 1 + 1?', Answer, {
40
- protocol: 'json',
41
- lm: new StaticResponse('{"answer":2}'),
56
+ lm: new StaticResponse('Answer(answer=2)'),
42
57
  });
43
- console.log(result.answer);
58
+ console.log(result.answer); // 2; result is an Answer instance.
44
59
  ```
45
60
 
46
- The core has no runtime package dependencies. Zod is an optional peer used only by `langfx.js/schema/zod`; it is included in this checkout's development dependencies. Model calls remain asynchronous even for these deterministic fake models.
61
+ `t.Class` derives typed members and a constructor from the field declarations. Pass the class directly to `lf.query`; the default Python-style protocol validates constructor-shaped data and returns a class instance without executing Python. Nested fields and lists can also use classes directly. See [Classes and schemas](docs/CLASS_SCHEMAS.md).
62
+
63
+ The core has no runtime package dependencies. Zod remains optional through `langfx.js/schema/zod` with `protocol: 'json'`. Model calls remain asynchronous even for these deterministic fake models.
47
64
 
48
65
  ## Recommended scope
49
66
 
@@ -69,16 +86,17 @@ import * as lf from 'langfx.js';
69
86
  const lm = new lf.llms.Gemini({ model: modelId, transport });
70
87
  const answer = await lf.query('What is 1 + 1?', { lm });
71
88
 
72
- // ImageDescription is an explicitly declared JSON runtime schema.
89
+ const t = lf.typed;
90
+ class ImageDescription extends t.Class({ items: t.list(t.str) }) {}
73
91
  const desc = await lf.query(
74
92
  'Describe objects in {{image}}.',
75
93
  ImageDescription,
76
- { lm, protocol: 'json', vars: { image: lf.Image.fromFile(file) } },
94
+ { lm, vars: { image: lf.Image.fromFile(file) } },
77
95
  );
78
96
  console.log(desc.items); // Typed value, just like Python lf.query.
79
97
  ```
80
98
 
81
- `modelId`, `transport`, `file`, and the schema are supplied by the application. Provider classes extend `LanguageModel`; there is no required client/factory layer. Keep `Template`, `LangFunc`, message/modality classes, `Action`, and `Session`, including subclass extension points. Basic `{{name}}` templates are supported in the proposal; full Jinja is not.
99
+ `modelId`, `transport`, and `file` are supplied by the application. Provider classes extend `LanguageModel`; there is no required client/factory layer. Keep `Template`, `LangFunc`, message/modality classes, `Action`, and `Session`, including subclass extension points. Basic `{{name}}` templates are supported in the proposal; full Jinja is not.
82
100
 
83
101
  The main differences are explicit `new`/options objects, async I/O, camelCase multiword names, and runtime schema declarations. Use `lm.call(...)` for Python's callable model objects and `action.invoke(session)` for Python's action invocation wrapper. See the [API mapping](docs/API_DESIGN.md) for details.
84
102
 
@@ -90,6 +108,7 @@ Local operations such as `Template.render()`, schema validation, and message con
90
108
 
91
109
  ## Design documents
92
110
 
111
+ - [App actions and approval](docs/APP_ACTIONS.md): turn typed plans into previewed, approved application edits with local undo.
93
112
  - [Gemini and tools](docs/GEMINI.md): adapter setup, registered app tools, and current verification limits.
94
113
  - [Porting plan](docs/PORTING_PLAN.md): feature decisions, runtime boundaries, implementation order, and release gates.
95
114
  - [Source audit](docs/SOURCE_AUDIT.md): implementation findings and test cases to carry forward, with pinned source links.
package/dist/agentic.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import type { QueryOptions, QueryValue } from './query.js';
1
+ import type { QueryOptions, QueryValue, StructuredQueryStreamOptions } from './query.js';
2
+ import type { StructuredStreamEvent } from './json-stream.js';
2
3
  import type { SchemaLike, SchemaValue, CheckedSchema } from './schema.js';
3
4
  import type { Prompt } from './template.js';
4
- import type { LanguageModel, SamplingUsage } from './language-model.js';
5
+ import type { LanguageModel, SamplingUsage, StreamChunk } from './language-model.js';
5
6
  export interface RunOptions {
6
7
  readonly lm?: LanguageModel;
7
8
  readonly signal?: AbortSignal;
@@ -15,6 +16,11 @@ export interface SessionOptions extends RunOptions {
15
16
  export type SessionQueryOptions = Omit<QueryOptions, 'lm'> & {
16
17
  readonly lm?: LanguageModel;
17
18
  };
19
+ export type SessionStructuredQueryStreamOptions = Omit<StructuredQueryStreamOptions, 'lm'> & RunOptions;
20
+ export type SessionTextQueryStreamOptions = Omit<SessionQueryOptions, 'returnsMessage' | 'nativeStructuredOutput'> & RunOptions & {
21
+ readonly returnsMessage?: never;
22
+ readonly nativeStructuredOutput?: never;
23
+ };
18
24
  export type LogLevel = 'debug' | 'info' | 'warning' | 'error' | 'fatal';
19
25
  export interface LogOptions {
20
26
  readonly keep?: boolean;
@@ -109,6 +115,8 @@ export declare class Session {
109
115
  query<S extends SchemaLike<unknown>, O extends SessionQueryOptions>(prompt: Prompt, schema: S & CheckedSchema<NoInfer<S>>, options: O): Promise<QueryValue<SchemaValue<S>, O>>;
110
116
  query<S extends SchemaLike<unknown>>(prompt: Prompt, schema: S & CheckedSchema<NoInfer<S>>): Promise<SchemaValue<S>>;
111
117
  query<O extends SessionQueryOptions = {}>(prompt: Prompt, options?: O): Promise<QueryValue<string, O>>;
118
+ queryStream<S extends SchemaLike<unknown>>(prompt: Prompt, schema: S & CheckedSchema<NoInfer<S>>, options?: SessionStructuredQueryStreamOptions): AsyncIterable<StructuredStreamEvent<SchemaValue<S>>>;
119
+ queryStream(prompt: Prompt, options?: SessionTextQueryStreamOptions): AsyncIterable<StreamChunk>;
112
120
  concurrentMap<I, O>(inputs: readonly I[], fn: (input: I, branch: Session) => Promise<O>, options?: {
113
121
  readonly maxConcurrency?: number;
114
122
  }): Promise<O[]>;
package/dist/agentic.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { abortable, cancellationScope, checkCancelled } from './cancellation.js';
2
2
  import { CancelledError, SessionClosedError } from './errors.js';
3
- import { query } from './query.js';
3
+ import { query, queryStream } from './query.js';
4
4
  let serial = 0;
5
5
  function trace(kind, name, parentId) {
6
6
  return { id: `invocation-${++serial}`, parentId, kind, name, status: 'running', startedAt: Date.now(), endedAt: undefined, result: undefined, error: undefined, usage: undefined, metadata: Object.freeze({}), logs: [], progress: undefined, children: [] };
@@ -119,6 +119,185 @@ export class Session {
119
119
  return config.returnsMessage ? response : response.result;
120
120
  }, config);
121
121
  }
122
+ queryStream(prompt, schemaOrOptions = {}, options) {
123
+ const isSchema = typeof schemaOrOptions === 'function' || 'schema' in schemaOrOptions || 'parse' in schemaOrOptions;
124
+ const schema = isSchema ? schemaOrOptions : undefined;
125
+ const config = (isSchema ? options : schemaOrOptions) ?? {};
126
+ let node;
127
+ let scope;
128
+ let source;
129
+ let closing;
130
+ let completion;
131
+ let complete;
132
+ let terminal;
133
+ let failure;
134
+ let hasFailure = false;
135
+ let delivered = false;
136
+ let ended = false;
137
+ let serial = Promise.resolve();
138
+ const owner = this;
139
+ const onAbort = () => {
140
+ try {
141
+ checkCancelled(scope.signal);
142
+ }
143
+ catch (error) {
144
+ void finish('cancelled', error);
145
+ }
146
+ };
147
+ // Close independently of demand: dispose/deadlines must also close a paused stream.
148
+ const finish = (status, error, value) => {
149
+ if (closing)
150
+ return closing;
151
+ closing = Promise.resolve().then(async () => {
152
+ scope.signal.removeEventListener('abort', onAbort);
153
+ if (status !== 'completed')
154
+ scope.abort(error);
155
+ try {
156
+ await source?.return?.();
157
+ }
158
+ catch (cleanupError) {
159
+ if (status === 'completed') {
160
+ status = 'failed';
161
+ error = cleanupError;
162
+ value = undefined;
163
+ }
164
+ }
165
+ if (status === 'completed' && scope.signal.aborted) {
166
+ try {
167
+ checkCancelled(scope.signal);
168
+ }
169
+ catch (cancelled) {
170
+ status = 'cancelled';
171
+ error = cancelled;
172
+ value = undefined;
173
+ }
174
+ }
175
+ node.status = status;
176
+ if (status === 'completed') {
177
+ if (value && 'type' in value && value.type === 'generationComplete') {
178
+ node.result = value.result;
179
+ node.usage = value.usage;
180
+ }
181
+ else if (value && 'isFinal' in value) {
182
+ node.result = value.aggregated.text;
183
+ node.usage = value.usage;
184
+ }
185
+ terminal = value;
186
+ }
187
+ else {
188
+ node.error = error;
189
+ if (schema)
190
+ terminal = value && 'type' in value && 'error' in value ? value
191
+ : { type: status === 'cancelled' ? 'cancelled' : 'generationFailed', error };
192
+ else {
193
+ failure = error;
194
+ hasFailure = true;
195
+ }
196
+ }
197
+ scope.dispose();
198
+ node.endedAt = Date.now();
199
+ owner.emit('end', node);
200
+ owner.store.pending.delete(completion);
201
+ owner.operations.delete(completion);
202
+ complete();
203
+ });
204
+ return closing;
205
+ };
206
+ const start = () => {
207
+ owner.assertOpen();
208
+ if (owner.store.nodes >= owner.store.limit)
209
+ throw new RangeError('Session trace limit reached. Start a new session or increase maxTraceNodes.');
210
+ scope = cancellationScope([owner.signal, config.signal], config.maxExecutionTime);
211
+ node = trace('query', 'queryStream', owner.node.id);
212
+ owner.store.nodes++;
213
+ owner.node.children.push(node);
214
+ completion = new Promise(resolve => { complete = resolve; });
215
+ owner.store.pending.add(completion);
216
+ owner.operations.add(completion);
217
+ scope.signal.addEventListener('abort', onAbort, { once: true });
218
+ owner.emit('start', node);
219
+ };
220
+ const finalResult = () => {
221
+ if (delivered || ended)
222
+ return { done: true, value: undefined };
223
+ delivered = true;
224
+ if (hasFailure)
225
+ throw failure;
226
+ return terminal ? { done: false, value: terminal } : { done: true, value: undefined };
227
+ };
228
+ const advance = async () => {
229
+ if (ended || delivered)
230
+ return { done: true, value: undefined };
231
+ if (!node) {
232
+ start();
233
+ try {
234
+ checkCancelled(scope.signal);
235
+ const lm = config.lm ?? owner.lm;
236
+ if (!lm)
237
+ throw new TypeError('Session.queryStream requires a LanguageModel.');
238
+ const full = { ...config, lm, signal: scope.signal };
239
+ source = (schema ? queryStream(prompt, schema, full) : queryStream(prompt, full))[Symbol.asyncIterator]();
240
+ }
241
+ catch (error) {
242
+ await finish(error instanceof CancelledError ? 'cancelled' : 'failed', error);
243
+ return finalResult();
244
+ }
245
+ }
246
+ if (closing) {
247
+ await closing;
248
+ return finalResult();
249
+ }
250
+ try {
251
+ const next = await source.next();
252
+ if (closing) {
253
+ await closing;
254
+ return finalResult();
255
+ }
256
+ checkCancelled(scope.signal);
257
+ if (next.done)
258
+ throw new Error('Query stream ended without a terminal event.');
259
+ const value = next.value;
260
+ if ('type' in value) {
261
+ if (value.type === 'generationComplete')
262
+ await finish('completed', undefined, value);
263
+ else if ('error' in value)
264
+ await finish(value.type === 'cancelled' ? 'cancelled' : 'failed', value.error, value);
265
+ else
266
+ return { done: false, value };
267
+ }
268
+ else if (value.isFinal)
269
+ await finish('completed', undefined, value);
270
+ else
271
+ return { done: false, value };
272
+ }
273
+ catch (error) {
274
+ await finish(error instanceof CancelledError ? 'cancelled' : 'failed', error);
275
+ }
276
+ return finalResult();
277
+ };
278
+ // A single-use iterator, like the model stream. Serialize concurrent next() calls.
279
+ const iterator = {
280
+ [Symbol.asyncIterator]() { return this; },
281
+ next() {
282
+ const next = serial.then(advance);
283
+ serial = next.catch(() => { });
284
+ return next;
285
+ },
286
+ async return() {
287
+ ended = true;
288
+ if (node)
289
+ await finish('cancelled', new CancelledError('Stream consumer stopped early.'));
290
+ return { done: true, value: undefined };
291
+ },
292
+ async throw(error) {
293
+ ended = true;
294
+ if (node)
295
+ await finish(error instanceof CancelledError ? 'cancelled' : 'failed', error);
296
+ throw error;
297
+ },
298
+ };
299
+ return iterator;
300
+ }
122
301
  async concurrentMap(inputs, fn, options = {}) {
123
302
  const concurrency = options.maxConcurrency ?? 4;
124
303
  if (!Number.isInteger(concurrency) || concurrency < 1)
@@ -1 +1 @@
1
- {"version":3,"file":"agentic.js","sourceRoot":"","sources":["../src/agentic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAwEnC,IAAI,MAAM,GAAG,CAAC,CAAC;AACf,SAAS,KAAK,CAAC,IAAuB,EAAE,IAAY,EAAE,QAAiB;IACrE,OAAO,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAC/P,CAAC;AACD,S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CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACxC,CAAC,CAAC;YACF,IAAI,CAAC;gBAAC,KAAK,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAAC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAAC,CAAC;QAC/F,CAAC;IACH,CAAC;CACF;AACD,MAAM,OAAgB,MAAM;IAC1B,IAAI,IAAI,KAAa,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IAEpD,KAAK,CAAC,MAAM,CAAC,OAAiB,EAAE,OAAO,GAAe,EAAE;QACtD,MAAM,KAAK,GAAG,OAAO,KAAK,SAAS,CAAC;QACpC,MAAM,OAAO,GAAG,OAAO,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC;YAAC,OAAO,MAAM,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAAC,CAAC;gBAC9C,CAAC;YAAC,IAAI,KAAK;gBAAE,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QAAC,CAAC;IACjD,CAAC;CACF"}
@@ -0,0 +1,101 @@
1
+ # Let an agent edit application state
2
+
3
+ Use typed actions when a model should propose changes to your application: moving tasks, editing a document, or adjusting a configuration. The model supplies validated fields; your application supplies the objects that those actions can operate on and decides when to execute them.
4
+
5
+ The [board-agent example](../examples/board-agent/README.md) demonstrates the complete flow with real Gemini inference. Run `npm run example:board` from the repository after setting `GEMINI_API_KEY` or `GOOGLE_API_KEY`.
6
+
7
+ To try the mechanics without credentials, run `npm run example:approval` after `npm ci`. This terminal walkthrough uses an explicitly fixed test response with the same board actions. It shows the proposed changes and waits for `y` before applying them, then demonstrates undo. Any other answer discards the proposal. It makes no API requests and does not test model quality.
8
+
9
+ ## The application owns approval
10
+
11
+ ```text
12
+ Request + board snapshot → typed plan → validate and preview
13
+ ↓
14
+ user approval
15
+ ↓
16
+ invoke actions on a draft
17
+ ↓
18
+ check revision → commit once
19
+ ↓
20
+ optional local undo
21
+ ```
22
+
23
+ `lf.query` generates and validates class instances. It does not invoke their actions. `lf.Action` and `lf.Session` supply execution and tracing; preview, approval, transactions, and undo are application code in this example, not built-in framework guarantees.
24
+
25
+ ## Declare the edits the model may propose
26
+
27
+ This excerpt uses the example's `BoardDraft`, a mutable copy of board data with methods that validate task IDs and titles:
28
+
29
+ ```ts
30
+ import * as lf from 'langfx.js';
31
+ import { BoardDraft } from './board.js';
32
+ const t = lf.typed;
33
+
34
+ abstract class BoardAction extends lf.Action<void> {
35
+ constructor(private readonly draft: BoardDraft) { super(); }
36
+ abstract applyTo(draft: BoardDraft): void;
37
+ override async call(): Promise<void> { this.applyTo(this.draft); }
38
+ }
39
+
40
+ class MoveTask extends t.Class(BoardAction, {
41
+ taskId: t.str,
42
+ status: t.literal('todo', 'doing', 'done'),
43
+ }) {
44
+ static readonly schemaName = 'MoveTask';
45
+ applyTo(draft: BoardDraft): void {
46
+ draft.move(this.taskId, this.status);
47
+ }
48
+ }
49
+ ```
50
+
51
+ The generated constructor takes the fields first and forwards remaining arguments to `BoardAction`. `schemaName` keeps the model-facing name stable if the app bundle is minified. Constructors must only initialize state: schema validation can instantiate candidates, including candidates in a union.
52
+
53
+ Bind the application dependency with `t.schemaFrom`. In the example's planning function, `draft` is a fresh copy of the current board:
54
+
55
+ ```ts
56
+ const actionSchema = t.union(
57
+ t.schemaFrom(MoveTask, draft),
58
+ t.schemaFrom(RenameTask, draft),
59
+ t.schemaFrom(AddTask, draft),
60
+ );
61
+ class Plan extends t.Class({
62
+ summary: t.str,
63
+ changes: t.list(actionSchema, { minSize: 1, maxSize: 8 }),
64
+ }) {
65
+ static readonly schemaName = 'Plan';
66
+ }
67
+ ```
68
+
69
+ `RenameTask` and `AddTask` follow the same pattern in [actions.ts](../examples/board-agent/actions.ts). The model generates fields such as `taskId` and `status`; it cannot supply or replace the bound `draft`. Pass `Plan` directly to `session.query`. No explicit schema conversion is needed for a class without bound dependencies.
70
+
71
+ ## Preview the exact changes before execution
72
+
73
+ Capture a board snapshot and its revision before querying. After generation, reject a result if the request was cancelled or the board revision changed.
74
+
75
+ Apply the returned actions to a separate preview draft with `change.applyTo(preview)`. This performs domain validation without editing the live board or invoking actions. Show the resulting before/after boards, not just the model's summary: the summary is generated text and may misdescribe the edits.
76
+
77
+ Keep the parsed actions and their execution draft private to the pending proposal. Return copies of preview data to the UI. Approval must execute the same action instances that produced the preview, rather than asking the model to generate another plan.
78
+
79
+ The preview method must be deterministic and confined to the supplied draft. It must not make network calls, mutate shared state, or depend on changing external data. Both preview and execution use this method, so their results agree for the same starting state.
80
+
81
+ ## Approve, apply, or discard
82
+
83
+ The example's `Proposal.approve` creates a new execution session only after the user clicks **Approve and apply**. It checks the starting revision, invokes each action with `await action.invoke(session)`, checks cancellation, and commits the draft with the expected revision. A `finally` block disposes the session.
84
+
85
+ The final revision check is essential even if approval checked it already: another edit can occur while an action is awaited. The store publishes the complete draft in one synchronous commit, so an invalid action, cancellation, or stale revision leaves the live board unchanged. Discarding a pending proposal invokes nothing. A proposal cannot be applied twice, and failed proposals must be regenerated.
86
+
87
+ The UI disables competing controls while a request runs, but the data layer also enforces these rules independently. See [main.ts](../examples/board-agent/main.ts) for event handlers and [board.ts](../examples/board-agent/board.ts) for commit checks.
88
+
89
+ ## Undo and persistence boundaries
90
+
91
+ Before committing, the store saves the previous board, including its ID counter. Undo restores it and increments the revision, invalidating proposals made against the later state. This example retains one undo entry and keeps everything in the current browser tab; refreshing resets the board.
92
+
93
+ This transaction pattern covers local state. It does not undo a sent email, payment, or remote API write. For external effects, put authorization and concurrency checks at the service that owns the data, and define idempotency and any compensating operations there. Browser approval is an interaction pattern, not a server authorization boundary.
94
+
95
+ ## Adapt and test the pattern
96
+
97
+ For another app, replace `BoardDraft` with your domain operations, declare the allowed action classes, and supply a store that can reject commits against an outdated revision. Keep model transport credentials in the host's gateway, as the example does; task titles and requests are still sent to the inference provider.
98
+
99
+ The [regression tests](../tests/board-agent.test.mjs) use deterministic model responses to cover preview isolation, invalid plans, discard, duplicate approval, cancellation between actions, concurrent edits during planning and execution, and undo invalidation. Run them with `node --test tests/board-agent.test.mjs`.
100
+
101
+ For an agent that gathers information across repeated model turns, see the [search agent](../examples/search-agent/README.md). For field types, nested classes, unions, inheritance, and custom constructors, see [Classes and schemas](CLASS_SCHEMAS.md).
package/docs/CI.md ADDED
@@ -0,0 +1,10 @@
1
+ # Continuous integration
2
+
3
+ [Checks](../.github/workflows/check.yml) runs on pull requests, pushes to `main`, and manual dispatch. It uses read-only repository permissions and does not receive model credentials or publish packages.
4
+
5
+ - **Core (Node 22)** and **Core (Node 24)** install the root lockfile with `npm ci` and run `npm run check`: typechecking, tests, browser checks, captured Python parity fixtures, schema/streaming regression checks, and isolated packed-package checks. No Python checkout or live inference is needed.
6
+ - **Published package in React** installs only `examples/react-board` and runs its `npm run check`. This verifies the pinned npm release rather than the PR's library source, keeping release-consumer compatibility distinct from core checks.
7
+
8
+ GitHub Actions are pinned by commit. npm caches use each job's lockfile. New runs cancel superseded runs for the same ref, and jobs have time limits.
9
+
10
+ These checks report results on PRs; required-check enforcement is a separate repository branch-protection setting. Live model smoke tests remain opt-in as described in [Live testing](LIVE_TESTING.md).
@@ -294,7 +294,7 @@ Parsing `Search(query="local AI agents")` constructs `new Search({ query: 'local
294
294
 
295
295
  For an action with no generated fields, declare `static fields = {}` and accept an empty first constructor argument. For example, `schemaFrom(Finish, options, observations)` constructs `new Finish({}, options, observations)` when the model returns `Finish()`.
296
296
 
297
- Constructors must only initialize state: union validation may construct candidate instances. Put network requests and other effects in `call`, then invoke the validated action separately. See the [search-agent actions](../examples/app/actions.ts) for the complete `Search | Finish` loop.
297
+ Constructors must only initialize state: union validation may construct candidate instances. Put network requests and other effects in `call`, then invoke the validated action separately. See the [search-agent actions](../examples/search-agent/actions.ts) for the complete `Search | Finish` loop.
298
298
 
299
299
  ## Names, inheritance, and custom construction
300
300
 
@@ -0,0 +1,35 @@
1
+ # React integration findings
2
+
3
+ The [React board example](../examples/react-board/README.md) exercises `langfx.js@0.1.0-alpha.2` as an npm consumer. It has a separate package manifest and lockfile, and imports no library source files. Its browser path uses real Gemini; automated checks inject deterministic models.
4
+
5
+ ## What worked
6
+
7
+ | Capability | Evidence |
8
+ | --- | --- |
9
+ | Typed class fields and bound action dependencies | The consumer typechecks against published declarations using `t.Class` and `t.schemaFrom`. |
10
+ | Browser bundling | The production React bundle builds with esbuild, without Node shims or core library changes. |
11
+ | Explicit preview, approval, and undo | Hook and rendered-app tests validate the application-owned flow using parsed action instances. |
12
+ | Strict Mode | Rendering starts no model calls; inference begins in event handlers. Cleanup aborts active work on unmount. |
13
+ | Request races | A ref blocks duplicate starts; aborted results cannot become proposals; a later request can complete. |
14
+
15
+ ## Integration work the app still owns
16
+
17
+ React state must be updated when non-React objects mutate. The example takes a new board snapshot after each operation and stores it in `useState`. It keeps controllers and pending proposal instances in refs, avoiding a window where two clicks could start work before a state update renders.
18
+
19
+ Cancellation has two responsibilities: stop the runtime request and prevent late completions from updating the component. The hook aborts on unmount and checks the active controller's identity during cleanup. Each model query and approval creates and disposes its own session.
20
+
21
+ Minifiers can change JavaScript class names, so model-facing classes declare `schemaName`. Typed fields alone do not define domain permissions: draft methods still validate IDs and titles, and the store checks revisions before publishing changes.
22
+
23
+ The app must also supply model transport/authentication and its own approval/undo policy. The npm package does not export the board's domain classes. This standalone consumer keeps a copy of those small example modules rather than depending on a checkout of the library.
24
+
25
+ ## API decision
26
+
27
+ Keep `useBoardAgent` in the example for now. It contains board-specific behavior, and this single integration does not justify a general React package. The example now covers structured streaming as well as approval. Multiple concurrent sessions and other application domains still need evaluation before defining a reusable public hook.
28
+
29
+ This check does not establish support for SSR/hydration, React Native, persistent approvals, or arbitrary external effects. React tests use jsdom; browser/model validation should be recorded separately from these deterministic checks. The setup follows React's preference for built-in state when the application can own its render data; [external-store subscriptions](https://react.dev/reference/react/useSyncExternalStore) remain an option for hosts with an existing store.
30
+
31
+ ## Streaming and inspection
32
+
33
+ The React example consumes structured `queryStream` events. Raw output is bounded and display-only; a complete validated result and successful draft preview are both required before approval appears. Cancellation and unmount close the stream, and tests ensure a provider failure after complete-looking text cannot produce a proposal.
34
+
35
+ An inspector combines app-owned planning state with projected Session action traces. Planning tokens come from the stream terminal event, because alpha.2 does not trace streamed queries through Session. This separation exposes a possible future framework improvement without inventing trace or usage data. Unknown usage remains unknown, including for failed streams.
package/docs/RELEASING.md CHANGED
@@ -1,7 +1,30 @@
1
+ # Session streaming alpha: 0.1.0-alpha.3
2
+
3
+ Release target: `langfx.js@0.1.0-alpha.3` under the `alpha` dist-tag. Keep `latest` unchanged. Publication is pending registry verification.
4
+
5
+ ## Changes
6
+
7
+ - `Session.queryStream` supports text and structured queries with inherited models, per-call overrides/deadlines, invocation ancestry, terminal results and reported usage.
8
+ - Started streams close on session disposal, parent action completion, cancellation, deadline or early consumer return, including while the consumer is paused.
9
+ - Traces finish after provider cleanup and before terminal delivery. Partial values remain display-only; missing usage remains unknown.
10
+ - Repository CI now runs the full quality gate on Node 22 and 24 and checks a standalone React consumer of the published package.
11
+
12
+ ## Release validation
13
+
14
+ The implementation passed 240 tests and the full type/browser/parity/packed-package checks, plus an independent read-only review with no findings. One live Gemini 3.7 Flash structured stream verified the typed answer, completed query trace, and provider-reported usage. Release archive checks must also pass for the versioned source.
15
+
16
+ Use the publication procedure below with `0.1.0-alpha.3` substituted for older version examples. Verify the exact archive integrity against npm after publishing. This release does not add caching for streams, React bindings, or stronger guarantees for noncooperative providers.
17
+
18
+ ---
19
+
1
20
  # Typed classes alpha: 0.1.0-alpha.2
2
21
 
3
22
  Release target: `langfx.js@0.1.0-alpha.2` under the `alpha` dist-tag. The existing `latest` tag remains on `0.1.0-alpha.0`. Registry verification is required before declaring publication complete.
4
23
 
24
+ ## Publication status
25
+
26
+ Published and registry-verified on 2026-09-26. `alpha` points to `0.1.0-alpha.2`; `latest` remains `0.1.0-alpha.0`. Registry SHA-512 integrity matches the reviewed archive, and a clean install of the exact published version passed the nested-class query smoke test. Tag `v0.1.0-alpha.2` identifies release source commit `7dc0206`.
27
+
5
28
  ## Included
6
29
 
7
30
  Async TypeScript APIs for messages, templates, language functions, typed queries, structured streaming, tools, agents, and invocation traces. Python constructor syntax is the default structured-query protocol; JSON is explicit. Gemini, Anthropic, and OpenAI adapters support fixture-tested image inputs and local tool continuations. The package is ESM with TypeScript declarations, targets Node.js 22+ and browser/worker hosts, and has no required runtime dependencies. Zod is an optional peer. MCP support includes `langfx.js/mcp` for remote Streamable HTTP and `langfx.js/mcp/node` for local stdio servers, using an optional `@modelcontextprotocol/client` 2.x peer. It includes input/output validation, explicit agent tool selection, cancellation and subprocess cleanup. Unexpected MCP disconnects retain their failure diagnostics.
package/docs/STREAMING.md CHANGED
@@ -45,7 +45,31 @@ Strict JSON is required: no Markdown fences, comments, trailing commas, duplicat
45
45
 
46
46
  Consume the stream through a terminal event to determine the outcome. A completed iteration delivers exactly one terminal outcome. Setup errors may throw before iteration starts. Early `break` or iterator `return()` closes the provider without delivering a terminal event. Parser errors and terminal outcomes close the provider before the terminal event is yielded. Pass `signal` to cancel pending I/O; custom providers must implement cooperative cancellation and cleanup. No retries or output repair occur.
47
47
 
48
- Session-level streaming traces, streamed tool arguments, live-provider validation, and framework-specific UI bindings remain future work. Gemini integration is covered using mocked SSE responses.
48
+ Session-level streaming traces are available through `Session.queryStream` in the source version described below. Gemini integration is covered using mocked SSE responses; live-provider coverage is documented separately.
49
+
50
+ ## Session-owned streams
51
+
52
+ `Session.queryStream` accepts the same text or structured forms as `queryStream`, inherits the session's model, and accepts per-call model/signal overrides and `maxExecutionTime` in seconds. It returns an async iterable directly:
53
+
54
+ ```ts
55
+ const session = new lf.Session({ lm });
56
+ try {
57
+ for await (const event of session.queryStream('What is 6 × 7?', Answer, { maxExecutionTime: 30 })) {
58
+ if (event.type === 'generationComplete') console.log(event.result);
59
+ }
60
+ console.log(session.allQueries, session.usageSummary);
61
+ } finally {
62
+ await session.dispose();
63
+ }
64
+ ```
65
+
66
+ Here `Answer` is your structured class/schema and `lm` is your model. A query trace starts on the first pull, under the calling session or action. Partial events do not set its result. The validated result (or final text), reported terminal usage, status, and end time are recorded after provider cleanup and before the final event/chunk reaches the consumer. Usage absent from the terminal output remains unknown; failed streams may incur usage that was not reported. No stream cache hits are inferred.
67
+
68
+ Structured validation/provider failures and cancellation retain the ordinary terminal-event contract and mark the trace accordingly. Text failures throw. Session guards such as using a closed session or exceeding the trace limit reject iteration before creating a trace. Streams are single-use; concurrent `next()` calls are serialized.
69
+
70
+ Breaking or returning early cancels the query trace and closes the provider. Disposing the session, ending its owning action, or reaching a deadline also closes a started stream even while its consumer is paused. If the consumer resumes after cancellation, structured streams expose a cancelled terminal event and text streams throw. An explicit iterator return discards that event. Never-started iterables allocate no query trace. Providers must cooperate with cancellation and implement iterator cleanup; the session waits for that cleanup, so a provider that never settles cannot be made safe by abandoning its work.
71
+
72
+ Availability: `Session.queryStream` is included starting with `0.1.0-alpha.3`. Consumers pinned to alpha.2 must upgrade to use it.
49
73
 
50
74
  ## Python protocol
51
75
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langfx.js",
3
- "version": "0.1.0-alpha.2",
3
+ "version": "0.1.0-alpha.3",
4
4
  "description": "Language as functions for TypeScript applications",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -70,7 +70,9 @@
70
70
  "prepack": "npm run build",
71
71
  "prepublishOnly": "npm run check",
72
72
  "serve:mcp-browser": "node scripts/serve-mcp-browser.mjs",
73
- "example:app": "node examples/app/serve.mjs"
73
+ "example:search": "node examples/search-agent/serve.mjs",
74
+ "example:board": "node examples/board-agent/serve.mjs",
75
+ "example:approval": "node scripts/run-approval-example.mjs"
74
76
  },
75
77
  "devDependencies": {
76
78
  "@modelcontextprotocol/client": "2.0.0",