@qorejs/qore 1.0.7 → 2.0.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/MIGRATION.md ADDED
@@ -0,0 +1,124 @@
1
+ # Qore Migration Notes
2
+
3
+ ## `1.x` -> `2.0.0`
4
+
5
+ Qore 2 narrows the default entrypoint to the stream runtime. This is a breaking
6
+ import-path change; stream accumulation and lifecycle behavior are preserved.
7
+
8
+ ```ts
9
+ // 1.x
10
+ import { stream, signal, h, mount, createOpenAI, createSSEResponse } from '@qorejs/qore';
11
+
12
+ // 2.x
13
+ import { stream } from '@qorejs/qore';
14
+ import { signal } from '@qorejs/qore/signals';
15
+ import { h, mount } from '@qorejs/qore/dom';
16
+ import { createOpenAI } from '@qorejs/qore/providers';
17
+ import { createSSEResponse } from '@qorejs/qore/server';
18
+ ```
19
+
20
+ | Previous root exports | New import |
21
+ | --- | --- |
22
+ | `signal`, `computed`, `effect`, `batch`, `untrack`, `isSignal`, `createRoot`, `onCleanup`; `Signal`, `ComputedSignal`, effect types | `@qorejs/qore/signals` |
23
+ | `h`, `text`, `fragment`, `dynamic`, `show`, `list`, `mount`, `renderResponse`, `createApp`, DOM guards and DOM types | `@qorejs/qore/dom` |
24
+ | All vendor/generic provider factories, metadata helpers and provider types | `@qorejs/qore/providers` |
25
+ | `createSSEResponse`, `CreateSSEResponseOptions`, `SSEFrame` | `@qorejs/qore/server` |
26
+ | Stream/response APIs, inspection, `ReadonlySignal`, `SubscribeOptions`, shared utilities | remain at `@qorejs/qore` |
27
+
28
+ React hooks now ship in the same package:
29
+
30
+ ```tsx
31
+ import { useQoreStream, useQoreSignalSelector } from '@qorejs/qore/react';
32
+ ```
33
+
34
+ Install React 18.2+ in React applications. React is an optional peer and is not
35
+ required when using only the core, DOM, signals, providers or server entrypoints.
36
+ The separate `@qorejs/react` package is not required. If migrating repository-local
37
+ usage of that unpublished package, replace its imports with `@qorejs/qore/react`.
38
+
39
+ Use your host framework's lifecycle to unsubscribe observers and abort streams
40
+ owned by the component. The managed React hook does this automatically. Observing
41
+ an externally owned stream with the snapshot hook does not abort it on unmount.
42
+
43
+ The internal signal engine and optional DOM behavior are retained. This release
44
+ does not remove the underlying reactive implementation, add Qore DOM SSR/hydration,
45
+ or change total history retention. `maxItems` bounds collection values only.
46
+
47
+
48
+ This document tracks the public migration surface for `@qorejs/qore`.
49
+
50
+ ## `0.7.x` -> `0.8.x`
51
+
52
+ ### Runtime and Packaging
53
+
54
+ - The package is now TypeScript-first in `src/` and publishes compiled output from `dist/src`.
55
+ - The public DOM aliases were normalized around standard DOM types while keeping legacy `Global*` aliases available.
56
+ - The release pipeline now treats package smoke, browser regression, and dist-sync checks as release gates.
57
+
58
+ ### Stream Runtime
59
+
60
+ - `QoreStream` lifecycle state is exposed through read-only signals.
61
+ - `status`, `error`, `chunks`, `startedAt`, and `finishedAt` should now be treated as immutable views.
62
+ - If user code was mutating these fields directly, it must move to runtime APIs like `abort()` or a new stream instance.
63
+
64
+ ### Scheduling
65
+
66
+ - `effect(...)` scheduling is now an explicit part of the runtime surface.
67
+ - Supported scheduler modes:
68
+ - `sync`
69
+ - `microtask`
70
+ - `raf`
71
+ - custom scheduler function
72
+
73
+ ## `0.8.x` -> `0.9.0`
74
+
75
+ ### New Stable Runtime Surface
76
+
77
+ The following public APIs were added and are intended to remain on the stable track:
78
+
79
+ - `createRoot(...)`
80
+ - `onCleanup(...)`
81
+ - `createSSEResponse(...)`
82
+ - `collectProviderMetadata(...)`
83
+ - `mergeProviderMetadata(...)`
84
+ - `extractOpenAIMetadata(...)`
85
+ - `extractAnthropicMetadata(...)`
86
+ - `extractOpenRouterMetadata(...)`
87
+ - `extractDeepSeekMetadata(...)`
88
+ - `extractOllamaMetadata(...)`
89
+
90
+ ### Stream Composition
91
+
92
+ Qore now exposes a broader orchestration layer:
93
+
94
+ - `stream.merge(...)`
95
+ - `stream.concat(...)`
96
+ - `stream.pipe(...)`
97
+ - `stream.race(...)`
98
+ - `stream.retryable(...)`
99
+ - `stream.switchMap(...)`
100
+
101
+ If earlier code implemented these patterns manually around `for await...of` loops, it can usually simplify into the built-in stream helpers.
102
+
103
+ ### Browser Boundary
104
+
105
+ The DOM layer is explicitly browser-only in the `0.9.x` line.
106
+
107
+ - `signal`, `stream`, providers, and server helpers work in Node and the browser
108
+ - `h`, `text`, `dynamic`, `list`, `mount`, and `createApp(...).mount(...)` require a browser-like `document`
109
+ - `assertCanUseDOM(...)` and `canUseDOM()` are the supported guards for branching
110
+
111
+ ### SSR and Hydration
112
+
113
+ There is no stable SSR or hydration support in `0.9.x`.
114
+
115
+ If an integration previously assumed partial SSR support, it should treat that assumption as unsupported and move DOM entrypoints behind a browser/runtime guard.
116
+
117
+ ## `1.0.0-rc`
118
+
119
+ Expected RC rules:
120
+
121
+ - no casual public API additions
122
+ - no silent semantics changes in stream lifecycle behavior
123
+ - no ambiguous SSR or hydration claims
124
+ - any public API surface change must update the frozen API snapshot and release notes intentionally
package/README.md CHANGED
@@ -20,42 +20,45 @@ npm i @qorejs/qore
20
20
  ## 30-Second Demo
21
21
 
22
22
  ```js
23
- import { createSSEResponse, h, mount, stream, text } from '@qorejs/qore';
24
-
25
- // Server: expose your provider as SSE.
26
- export function handler() {
27
- return createSSEResponse(async function* () {
28
- yield 'stream';
29
- yield ' = ';
30
- yield 'signal';
31
- }());
32
- }
23
+ import { stream } from '@qorejs/qore';
33
24
 
34
- // Browser: consume the stream as one reactive value.
35
- const answer = stream(fetch('/api/chat').then((response) => response.body));
25
+ const answer = stream(['stream', ' = ', 'signal']);
26
+ const unsubscribe = answer.subscribe((value) => console.log(value));
36
27
 
37
- mount('#app', () =>
38
- h('main', {}, text(() => answer()))
39
- );
28
+ await answer.ready;
29
+ console.log(answer(), answer.status());
30
+ unsubscribe();
40
31
  ```
41
32
 
42
- `answer` is a readonly signal and an async iterable. The UI reads `answer()`, and Qore updates only the DOM node that depends on it.
33
+ `answer` is a readonly signal and an async iterable. Use `answer()` or
34
+ `answer.peek()` to read its current value, and `answer.subscribe(...)` to observe
35
+ updates. Your UI framework owns rendering and component lifecycle.
43
36
 
44
- ## Why Qore
37
+ ## Package Entrypoints
45
38
 
46
- React/Vercel AI SDK:
39
+ Qore 2 separates the stream runtime from optional integrations. These are explicit
40
+ subpath imports within one versioned package; importing the core does not load
41
+ React, the DOM renderer, or provider adapters.
47
42
 
48
- ```text
49
- Token -> Hook state -> Component render -> Reconcile
50
- ```
43
+ | Import | Purpose |
44
+ | --- | --- |
45
+ | `@qorejs/qore` | streams, response lifecycle, readonly contracts, inspection |
46
+ | `@qorejs/qore/react` | React hooks; requires React 18.2+ |
47
+ | `@qorejs/qore/dom` | optional standalone browser renderer |
48
+ | `@qorejs/qore/signals` | optional mutable signals, effects and ownership scopes |
49
+ | `@qorejs/qore/providers` | provider protocol adapters for trusted runtimes |
50
+ | `@qorejs/qore/server` | server-side SSE response helper |
51
51
 
52
- Qore:
52
+ Upgrading from 1.x requires moving imports: see [migration notes](./MIGRATION.md).
53
+ The internal reactive engine remains shared with the optional integrations; this
54
+ release narrows the public core without rewriting stream scheduling semantics.
53
55
 
54
- ```text
55
- Token -> Stream signal -> Text node
56
- ```
56
+ ## Why Qore
57
57
 
58
- That is the core difference. Qore is not trying to be another AI SDK. It is the runtime layer that makes streamed data reactive.
58
+ Qore brings accumulation, events, cancellation, errors and backpressure into one
59
+ stream lifecycle. Existing frameworks can consume that state through their own
60
+ renderers. React subscriptions still render React components; direct text-node
61
+ updates apply specifically to the optional DOM renderer.
59
62
 
60
63
  ## Event Streams
61
64
 
@@ -104,13 +107,14 @@ const timeline = stream.ndjson(agent.events(), { maxItems: 200 });
104
107
 
105
108
  ## React Adapter
106
109
 
107
- Qore can be used inside React without replacing your UI stack. The release-ready adapter lives in [`packages/react`](./packages/react) and subscribes to Qore streams through React's external store contract, so the stream remains the source of truth while React renders the view.
108
-
109
- > Status: `@qorejs/react` is release-ready in this repository, but npm publishing is still waiting on `@qorejs/react` package access for the `@qorejs` scope. The adapter smoke test passes; the package will be announced as published only after npm accepts it.
110
+ The React adapter ships at `@qorejs/qore/react` in the core package. Install
111
+ React in your application; it is an optional peer dependency for Qore. The adapter
112
+ uses React's external store contract and owns cancellation on unmount or dependency
113
+ changes. The separate `@qorejs/react` package is not required.
110
114
 
111
115
  ```tsx
112
116
  import { stream } from '@qorejs/qore';
113
- import { useQoreStream } from '@qorejs/react';
117
+ import { useQoreStream } from '@qorejs/qore/react';
114
118
 
115
119
  function Answer({ prompt }) {
116
120
  const answer = useQoreStream(
@@ -165,14 +169,14 @@ The inspector is zero-dependency and built on the same `__QORE_DEVTOOLS__` hook
165
169
  | --- | --- | --- |
166
170
  | Node runtime | Supported | `Node >= 18` |
167
171
  | Browser runtime | Supported | DOM entrypoints require `document` |
168
- | Reactive core | Supported | `signal`, `computed`, `effect`, `batch`, `createRoot`, `onCleanup` |
172
+ | Optional signals | `@qorejs/qore/signals` | `signal`, `computed`, `effect`, `batch`, `createRoot`, `onCleanup` |
169
173
  | Stream runtime | Supported | backpressure, bounded collections, retry, orchestration, structured JSON/NDJSON, async iteration, abort, and DevTools hooks |
170
- | Provider adapters | Supported | OpenAI, Anthropic, OpenRouter, DeepSeek, Ollama, generic SSE, generic line-stream |
171
- | Browser DOM layer | Supported | `h`, `text`, `dynamic`, `list`, `mount`, `createApp(...).mount(...)` |
172
- | React adapter | Release-ready | `packages/react` bridges Qore streams through `useSyncExternalStore`; npm publishing is waiting on scope access |
174
+ | Provider adapters | `@qorejs/qore/providers` | OpenAI, Anthropic, OpenRouter, DeepSeek, Ollama, generic SSE, generic line-stream |
175
+ | Browser DOM layer | `@qorejs/qore/dom` | `h`, `text`, `dynamic`, `list`, `mount`, `createApp(...).mount(...)` |
176
+ | React adapter | `@qorejs/qore/react` | cached external-store snapshots; React owns rendering |
173
177
  | Published package maps | Supported | JavaScript source maps and declaration maps ship in `dist/src` |
174
- | SSR | Not supported | explicit browser-only DOM boundary in `1.0.x` |
175
- | Hydration | Not supported | deferred until a fully proven implementation exists |
178
+ | SSR | Host framework | React hooks supply server snapshots; the optional DOM renderer is browser-only |
179
+ | Hydration | Host framework | no Qore DOM hydration implementation |
176
180
 
177
181
  ## Provider Support Matrix
178
182
 
package/README.zh-CN.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Qore
2
2
 
3
- Qore 是一个面向 AI 原生界面的 reactive stream runtime
4
-
5
- 它的核心原语是 `stream = signal`:异步流本身也是一条只读 signal,所以 token、tool event、状态、markdown 片段和 diff 都可以直接进入 UI 状态。
3
+ Qore 是面向 AI 原生界面的 reactive stream runtime。核心原语是 `stream = signal`:
4
+ 同一条流提供当前值、订阅、异步迭代,以及完成、错误和取消状态。
6
5
 
7
6
  ## 安装
8
7
 
@@ -13,17 +12,30 @@ npm i @qorejs/qore
13
12
  ## 最小示例
14
13
 
15
14
  ```js
16
- import { h, mount, stream, text } from '@qorejs/qore';
17
-
18
- const answer = stream(model.chat('hello'));
15
+ import { stream } from '@qorejs/qore';
19
16
 
20
- mount('#app', () =>
21
- h('main', {}, text(() => answer()))
22
- );
17
+ const answer = stream(['你好', ',Qore']);
18
+ const unsubscribe = answer.subscribe(console.log);
19
+ await answer.ready;
20
+ unsubscribe();
23
21
  ```
24
22
 
25
- `answer()` 返回当前累积内容。UI 会随着 stream 更新,且只更新读取这条 signal 的节点。
23
+ ## 2.0 的边界
24
+
25
+ 默认入口只提供流运行时。应用继续使用原有框架的组件、渲染和生命周期。
26
+
27
+ | 入口 | 用途 |
28
+ | --- | --- |
29
+ | `@qorejs/qore` | 流、响应生命周期、只读状态契约、检查工具 |
30
+ | `@qorejs/qore/react` | React hooks,需应用安装 React 18.2+ |
31
+ | `@qorejs/qore/dom` | 可选的独立页面 DOM 渲染器 |
32
+ | `@qorejs/qore/signals` | 可选的 signal、computed、effect 等工具 |
33
+ | `@qorejs/qore/providers` | Provider 协议适配 |
34
+ | `@qorejs/qore/server` | 服务端 SSE 输出 |
26
35
 
27
- ## 文档
36
+ 这些是同一个 npm 包的独立子入口。只导入核心不会加载 React、DOM 层或 Provider。
37
+ 内部响应式引擎仍然保留并共享,流的行为未在这次拆分中重写。
38
+ React 适配器仍通过 React 渲染组件;直接更新文本节点是可选 DOM 层的行为。
28
39
 
29
- README 以英文为主。中文文档入口在官网 `/zh/`。
40
+ 1.x 升级需要调整导入路径,详见 [迁移说明](./MIGRATION.md)。
41
+ 完整 API 和示例见 [英文 README](./README.md) 与 [React 文档](./docs/react.md)。
@@ -6,8 +6,12 @@ export type GlobalAbortSignal = typeof globalThis extends {
6
6
  } ? T extends {
7
7
  prototype: infer P;
8
8
  } ? P : unknown : {
9
- aborted: boolean;
10
- reason?: unknown;
9
+ readonly aborted: boolean;
10
+ readonly reason?: unknown;
11
+ addEventListener(type: 'abort', listener: () => void, options?: {
12
+ once?: boolean;
13
+ }): void;
14
+ removeEventListener(type: 'abort', listener: () => void): void;
11
15
  };
12
16
  export interface ResponseSnapshot<TChunk = unknown, TValue = unknown> {
13
17
  status: ResponseStatus;
@@ -1 +1 @@
1
- {"version":3,"file":"response-types.d.ts","sourceRoot":"","sources":["../../../src/core/response-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAC7C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,SAAS,CAAC;AAClG,MAAM,MAAM,iBAAiB,GAAG,OAAO,UAAU,SAAS;IAAE,WAAW,EAAE,MAAM,CAAC,CAAA;CAAE,GAC9E,CAAC,SAAS;IAAE,SAAS,EAAE,MAAM,CAAC,CAAA;CAAE,GAC9B,CAAC,GACD,OAAO,GACT;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3C,MAAM,W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AAC;IACnB,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvG,QAAQ,IAAI,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtG,IAAI,CAAC,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/D,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;CAC5E"}
@@ -0,0 +1,6 @@
1
+ export { createApp } from './dom/app.js';
2
+ export type { AppContext, AppSetupResult, QoreApp } from './dom/app.js';
3
+ export { dynamic, fragment, h, list, mount, renderResponse, show, text } from './dom/dom.js';
4
+ export { assertCanUseDOM, canUseDOM } from './dom/scope.js';
5
+ export type { GlobalDocumentFragment, GlobalElement, GlobalNode, GlobalText, MountTarget, MountView, QoreChild, QoreComponent, QoreDocumentFragment, QoreElement, QoreNode, QoreTemplate, QoreText, ReactiveValue, ResponseRenderState, ResponseViews } from './dom/types.js';
6
+ //# sourceMappingURL=dom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/dom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC5D,YAAY,EACV,sBAAsB,EACtB,aAAa,EACb,UAAU,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,mBAAmB,EACnB,aAAa,EACd,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,5 @@
1
+ // Optional browser-only renderer. Existing frameworks should own their DOM.
2
+ export { createApp } from './dom/app.js';
3
+ export { dynamic, fragment, h, list, mount, renderResponse, show, text } from './dom/dom.js';
4
+ export { assertCanUseDOM, canUseDOM } from './dom/scope.js';
5
+ //# sourceMappingURL=dom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dom.js","sourceRoot":"","sources":["../../src/dom.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,25 +1,10 @@
1
- export { signal, computed, createRoot, effect, onCleanup, batch, untrack, isSignal } from './core/signal.js';
2
- export type { ComputedSignal, ReadonlySignal, Signal } from './core/signal.js';
3
- export type { EffectOptions, EffectScheduler, SubscribeOptions } from './core/signal-types.js';
1
+ export type { ReadonlySignal } from './core/signal.js';
2
+ export type { SubscribeOptions } from './core/signal-types.js';
4
3
  export { createStreamInspector } from './core/devtools.js';
5
4
  export type { QoreDevtoolsEvent, QoreDevtoolsHook, QoreDevtoolsStreamEvent, QoreDevtoolsStreamPhase, QoreInspectedStream, QoreStreamInspector, StreamInspectorOptions } from './core/devtools.js';
6
5
  export { stream, createStream, from, mapStream, scanStream, toAsyncIterable } from './core/stream.js';
7
6
  export type { BackpressureOptions, QoreEventStream, QoreStream, RetryBackoff, RetryableStreamOptions, StreamCollectionOptions, StreamController, StreamEventBase, StreamEventOf, StreamEventOptions, StreamEventType, StreamFactory, StreamInput, StreamOptions, StreamSelectCollectionOptions, StreamSelectOptions, StreamSetup, StructuredLineStreamOptions, StructuredStreamOptions } from './core/stream.js';
8
7
  export { createResponse, response } from './core/response.js';
9
8
  export type { CreateResponseOptions, GlobalAbortSignal, MaybePromise, ResponseConsumeContext, ResponseExecutorContext, ResponseFactory, ResponseReactiveState, ResponseRunOptions, ResponseSnapshot, ResponseSource, ResponseSourceFactory, ResponseState, ResponseStatus, SourceLike } from './core/response.js';
10
- export { createApp } from './dom/app.js';
11
- export type { AppContext, AppSetupResult, QoreApp } from './dom/app.js';
12
- export { dynamic, fragment, h, list, mount, renderResponse, show, text } from './dom/dom.js';
13
- export { assertCanUseDOM, canUseDOM } from './dom/scope.js';
14
- export { createSSEResponse } from './server/sse-response.js';
15
- export type { CreateSSEResponseOptions, SSEFrame } from './server/sse-response.js';
16
- export type { GlobalDocumentFragment, GlobalElement, GlobalNode, GlobalText, MountTarget, MountView, QoreChild, QoreComponent, QoreDocumentFragment, QoreElement, QoreNode, QoreTemplate, QoreText, ReactiveValue, ResponseRenderState, ResponseViews } from './dom/types.js';
17
- export { createAnthropic } from './providers/anthropic.js';
18
- export { createDeepSeek } from './providers/deepseek.js';
19
- export { createOllama } from './providers/ollama.js';
20
- export { createOpenAI } from './providers/openai.js';
21
- export { createOpenRouter } from './providers/openrouter.js';
22
- export { collectProviderMetadata, createLineAdapter, createSSEAdapter, extractAnthropicMetadata, extractDeepSeekMetadata, extractOllamaMetadata, extractOpenAIMetadata, extractOpenRouterMetadata, mergeProviderMetadata } from './providers/sse.js';
23
- export type { AnthropicAdapter, AnthropicChatInput, AnthropicEvent, AnthropicMessage, AnthropicOptions, AnthropicRequest, DeepSeekAdapter, DeepSeekChatInput, DeepSeekEvent, DeepSeekMessage, DeepSeekOptions, DeepSeekRequest, FetchLike, LineAdapter, LineAdapterOptions, LineEvent, LineRequestConfig, OpenAIAdapter, OpenAIChatInput, OpenAIEvent, OpenAIMessage, OpenAIOptions, OpenAIRequest, OllamaAdapter, OllamaChatInput, OllamaEvent, OllamaMessage, OllamaOptions, OllamaRequest, OpenRouterAdapter, OpenRouterChatInput, OpenRouterEvent, OpenRouterMessage, OpenRouterOptions, OpenRouterRequest, ProviderHeaders, ProviderMetadataUpdate, ProviderRetryBackoff, ProviderRetryOptions, ProviderRequestOptions, ProviderStreamMetadata, ProviderUsage, SSEAdapter, SSEAdapterOptions, SSEEvent, SSERequestConfig } from './providers/sse.js';
24
9
  export { normalizeError, sleep } from './shared/utils.js';
25
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC7G,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/E,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,uB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C;AAC5B,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACtG,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,WAAW,EACX,aAAa,EACb,6BAA6B,EAC7B,mBAAmB,EACnB,WAAW,EACX,2BAA2B,EAC3B,uBAAuB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9D,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,cAAc,EACd,UAAU,EACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/src/index.js CHANGED
@@ -1,17 +1,5 @@
1
- // Re-export the public runtime surface from a single module entrypoint.
2
- export { signal, computed, createRoot, effect, onCleanup, batch, untrack, isSignal } from './core/signal.js';
3
1
  export { createStreamInspector } from './core/devtools.js';
4
2
  export { stream, createStream, from, mapStream, scanStream, toAsyncIterable } from './core/stream.js';
5
3
  export { createResponse, response } from './core/response.js';
6
- export { createApp } from './dom/app.js';
7
- export { dynamic, fragment, h, list, mount, renderResponse, show, text } from './dom/dom.js';
8
- export { assertCanUseDOM, canUseDOM } from './dom/scope.js';
9
- export { createSSEResponse } from './server/sse-response.js';
10
- export { createAnthropic } from './providers/anthropic.js';
11
- export { createDeepSeek } from './providers/deepseek.js';
12
- export { createOllama } from './providers/ollama.js';
13
- export { createOpenAI } from './providers/openai.js';
14
- export { createOpenRouter } from './providers/openrouter.js';
15
- export { collectProviderMetadata, createLineAdapter, createSSEAdapter, extractAnthropicMetadata, extractDeepSeekMetadata, extractOllamaMetadata, extractOpenAIMetadata, extractOpenRouterMetadata, mergeProviderMetadata } from './providers/sse.js';
16
4
  export { normalizeError, sleep } from './shared/utils.js';
17
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG7G,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAU3D,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAsBtG,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAiB9D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAoB7D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAiD5B,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAU3D,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAsBtG,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAiB9D,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { createAnthropic } from './providers/anthropic.js';
2
+ export { createDeepSeek } from './providers/deepseek.js';
3
+ export { createOllama } from './providers/ollama.js';
4
+ export { createOpenAI } from './providers/openai.js';
5
+ export { createOpenRouter } from './providers/openrouter.js';
6
+ export { collectProviderMetadata, createLineAdapter, createSSEAdapter, extractAnthropicMetadata, extractDeepSeekMetadata, extractOllamaMetadata, extractOpenAIMetadata, extractOpenRouterMetadata, mergeProviderMetadata } from './providers/sse.js';
7
+ export type { AnthropicAdapter, AnthropicChatInput, AnthropicEvent, AnthropicMessage, AnthropicOptions, AnthropicRequest, DeepSeekAdapter, DeepSeekChatInput, DeepSeekEvent, DeepSeekMessage, DeepSeekOptions, DeepSeekRequest, FetchLike, LineAdapter, LineAdapterOptions, LineEvent, LineRequestConfig, OpenAIAdapter, OpenAIChatInput, OpenAIEvent, OpenAIMessage, OpenAIOptions, OpenAIRequest, OllamaAdapter, OllamaChatInput, OllamaEvent, OllamaMessage, OllamaOptions, OllamaRequest, OpenRouterAdapter, OpenRouterChatInput, OpenRouterEvent, OpenRouterMessage, OpenRouterOptions, OpenRouterRequest, ProviderHeaders, ProviderMetadataUpdate, ProviderRetryBackoff, ProviderRetryOptions, ProviderRequestOptions, ProviderStreamMetadata, ProviderUsage, SSEAdapter, SSEAdapterOptions, SSEEvent, SSERequestConfig } from './providers/sse.js';
8
+ //# sourceMappingURL=providers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/providers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,eAAe,EACf,eAAe,EACf,SAAS,EACT,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,gBAAgB,EACjB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,8 @@
1
+ // Optional provider protocol adapters for trusted runtimes.
2
+ export { createAnthropic } from './providers/anthropic.js';
3
+ export { createDeepSeek } from './providers/deepseek.js';
4
+ export { createOllama } from './providers/ollama.js';
5
+ export { createOpenAI } from './providers/openai.js';
6
+ export { createOpenRouter } from './providers/openrouter.js';
7
+ export { collectProviderMetadata, createLineAdapter, createSSEAdapter, extractAnthropicMetadata, extractDeepSeekMetadata, extractOllamaMetadata, extractOpenAIMetadata, extractOpenRouterMetadata, mergeProviderMetadata } from './providers/sse.js';
8
+ //# sourceMappingURL=providers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providers.js","sourceRoot":"","sources":["../../src/providers.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,63 @@
1
+ import type { QoreStream, ReadonlySignal, ResponseStatus, SubscribeOptions, StreamInput } from './index.js';
2
+ import type { DependencyList } from 'react';
3
+ type ReadonlySignalSource<TValue> = {
4
+ peek(): TValue;
5
+ subscribe(listener: (value: TValue) => void, options?: SubscribeOptions): () => void;
6
+ };
7
+ type QoreStreamSnapshotSource<TChunk, TValue> = ReadonlySignalSource<TValue> & AsyncIterable<TChunk> & {
8
+ status: ReadonlySignal<ResponseStatus>;
9
+ error: ReadonlySignal<Error | null>;
10
+ chunks: ReadonlySignal<TChunk[]>;
11
+ startedAt: ReadonlySignal<number | null>;
12
+ finishedAt: ReadonlySignal<number | null>;
13
+ pending: ReadonlySignal<boolean>;
14
+ streaming: ReadonlySignal<boolean>;
15
+ completed: ReadonlySignal<boolean>;
16
+ failed: ReadonlySignal<boolean>;
17
+ aborted: ReadonlySignal<boolean>;
18
+ chunkCount: ReadonlySignal<number>;
19
+ buffered: ReadonlySignal<number>;
20
+ dropped: ReadonlySignal<number>;
21
+ ready: Promise<TValue>;
22
+ abort(reason?: unknown): TValue;
23
+ };
24
+ type QoreStreamChunk<TStream> = TStream extends QoreStreamSnapshotSource<infer TChunk, infer _TValue> ? TChunk : never;
25
+ type QoreStreamValue<TStream> = TStream extends QoreStreamSnapshotSource<infer _TChunk, infer TValue> ? TValue : never;
26
+ type ReadonlySignalValue<TSignal> = TSignal extends ReadonlySignalSource<infer TValue> ? TValue : never;
27
+ export interface UseQoreSignalOptions<T> {
28
+ getServerSnapshot?: () => T;
29
+ }
30
+ export interface UseQoreSignalSelectorOptions<TSelected> {
31
+ isEqual?: (previous: TSelected, next: TSelected) => boolean;
32
+ getServerSnapshot?: () => TSelected;
33
+ }
34
+ export interface UseQoreStreamOptions<TValue> {
35
+ initialValue: TValue;
36
+ enabled?: boolean;
37
+ }
38
+ export interface QoreReactStream<TChunk, TValue> {
39
+ stream: QoreStream<TChunk, TValue> | null;
40
+ value: TValue;
41
+ status: ResponseStatus;
42
+ error: Error | null;
43
+ chunks: TChunk[];
44
+ startedAt: number | null;
45
+ finishedAt: number | null;
46
+ pending: boolean;
47
+ streaming: boolean;
48
+ completed: boolean;
49
+ failed: boolean;
50
+ aborted: boolean;
51
+ chunkCount: number;
52
+ buffered: number;
53
+ dropped: number;
54
+ abort(reason?: unknown): TValue | null;
55
+ }
56
+ export declare function useQoreSignal<TSignal extends ReadonlySignalSource<unknown>>(source: TSignal, options?: UseQoreSignalOptions<ReadonlySignalValue<TSignal>>): ReadonlySignalValue<TSignal>;
57
+ export declare function useQoreSignalSelector<TSignal extends ReadonlySignalSource<unknown>, TSelected>(source: TSignal, selector: (value: ReadonlySignalValue<TSignal>) => TSelected, options?: UseQoreSignalSelectorOptions<TSelected>): TSelected;
58
+ export declare function useQoreStreamSnapshot<TStream extends QoreStreamSnapshotSource<unknown, unknown>>(source: TStream, options: UseQoreStreamOptions<QoreStreamValue<TStream>>): QoreReactStream<QoreStreamChunk<TStream>, QoreStreamValue<TStream>>;
59
+ export declare function useQoreStreamSnapshot<TChunk, TValue>(source: QoreStream<TChunk, TValue> | null, options: UseQoreStreamOptions<TValue>): QoreReactStream<TChunk, TValue>;
60
+ export declare function useQoreStream<TChunk = unknown, TValue = string>(createStream: () => QoreStream<TChunk, TValue>, dependencies: DependencyList, options: UseQoreStreamOptions<TValue>): QoreReactStream<TChunk, TValue>;
61
+ export declare function useQoreTextStream(sourceFactory: () => StreamInput<unknown, string>, dependencies: DependencyList, initialValue?: string): QoreReactStream<unknown, string>;
62
+ export {};
63
+ //# sourceMappingURL=react.d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Aa,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,GAAG,MAAM,EAC7D,YAAY,EAAE,MAAM,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9C,YAAY,EAAE,cAAc,EAC5B,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC,GACpC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAoBjC;AAED,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,MAAM,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,EACjD,YAAY,EAAE,cAAc,EAC5B,YAAY,SAAK,GAChB,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,CAMlC"}
@@ -0,0 +1,123 @@
1
+ 'use client';
2
+ import { useCallback, useEffect, useMemo, useState, useSyncExternalStore } from 'react';
3
+ import { stream } from './index.js';
4
+ const noop = () => undefined;
5
+ const objectIs = Object.is;
6
+ // Cache emitted snapshots, including defensive array copies. React may call
7
+ // getSnapshot repeatedly without a source update; it must see the same reference.
8
+ function useSignalStore(source, fallback) {
9
+ return useMemo(() => {
10
+ let snapshot = source ? source.peek() : fallback;
11
+ return {
12
+ getSnapshot: () => snapshot,
13
+ subscribe: (onStoreChange) => source
14
+ ? source.subscribe((value) => {
15
+ snapshot = value;
16
+ onStoreChange();
17
+ }, { immediate: true })
18
+ : noop
19
+ };
20
+ }, [source, source ? undefined : fallback]);
21
+ }
22
+ export function useQoreSignal(source, options = {}) {
23
+ const store = useSignalStore(source, source.peek());
24
+ return useSyncExternalStore(store.subscribe, store.getSnapshot, options.getServerSnapshot ?? store.getSnapshot);
25
+ }
26
+ export function useQoreSignalSelector(source, selector, options = {}) {
27
+ const store = useSignalStore(source, source.peek());
28
+ const isEqual = options.isEqual ?? (objectIs);
29
+ // Keep render-specific selectors in their own closure, so an abandoned
30
+ // concurrent render cannot change the selector of the committed subscription.
31
+ const getSelectedSnapshot = useMemo(() => {
32
+ let previous;
33
+ return () => {
34
+ const sourceValue = store.getSnapshot();
35
+ if (previous && Object.is(previous.source, sourceValue))
36
+ return previous.value;
37
+ const selected = selector(sourceValue);
38
+ const value = previous && isEqual(previous.value, selected) ? previous.value : selected;
39
+ previous = { source: sourceValue, value };
40
+ return value;
41
+ };
42
+ }, [store, selector, isEqual]);
43
+ return useSyncExternalStore(store.subscribe, getSelectedSnapshot, options.getServerSnapshot ?? getSelectedSnapshot);
44
+ }
45
+ function useOptionalQoreSignal(source, fallback) {
46
+ const store = useSignalStore(source, fallback);
47
+ const getServerSnapshot = useCallback(() => fallback, [fallback]);
48
+ return useSyncExternalStore(store.subscribe, store.getSnapshot, getServerSnapshot);
49
+ }
50
+ export function useQoreStreamSnapshot(source, options) {
51
+ const emptyChunks = useMemo(() => [], []);
52
+ const value = useOptionalQoreSignal(source, options.initialValue);
53
+ const status = useOptionalQoreSignal(source?.status ?? null, 'idle');
54
+ const error = useOptionalQoreSignal(source?.error ?? null, null);
55
+ const chunks = useOptionalQoreSignal(source?.chunks ?? null, emptyChunks);
56
+ const startedAt = useOptionalQoreSignal(source?.startedAt ?? null, null);
57
+ const finishedAt = useOptionalQoreSignal(source?.finishedAt ?? null, null);
58
+ const pending = useOptionalQoreSignal(source?.pending ?? null, false);
59
+ const streaming = useOptionalQoreSignal(source?.streaming ?? null, false);
60
+ const completed = useOptionalQoreSignal(source?.completed ?? null, false);
61
+ const failed = useOptionalQoreSignal(source?.failed ?? null, false);
62
+ const aborted = useOptionalQoreSignal(source?.aborted ?? null, false);
63
+ const chunkCount = useOptionalQoreSignal(source?.chunkCount ?? null, 0);
64
+ const buffered = useOptionalQoreSignal(source?.buffered ?? null, 0);
65
+ const dropped = useOptionalQoreSignal(source?.dropped ?? null, 0);
66
+ const abort = useCallback((reason) => source?.abort(reason) ?? null, [source]);
67
+ return useMemo(() => ({
68
+ stream: source,
69
+ value,
70
+ status,
71
+ error,
72
+ chunks,
73
+ startedAt,
74
+ finishedAt,
75
+ pending,
76
+ streaming,
77
+ completed,
78
+ failed,
79
+ aborted,
80
+ chunkCount,
81
+ buffered,
82
+ dropped,
83
+ abort
84
+ }), [
85
+ source,
86
+ value,
87
+ status,
88
+ error,
89
+ chunks,
90
+ startedAt,
91
+ finishedAt,
92
+ pending,
93
+ streaming,
94
+ completed,
95
+ failed,
96
+ aborted,
97
+ chunkCount,
98
+ buffered,
99
+ dropped,
100
+ abort
101
+ ]);
102
+ }
103
+ export function useQoreStream(createStream, dependencies, options) {
104
+ const [currentStream, setCurrentStream] = useState(null);
105
+ const enabled = options.enabled ?? true;
106
+ useEffect(() => {
107
+ if (!enabled) {
108
+ setCurrentStream(null);
109
+ return noop;
110
+ }
111
+ const nextStream = createStream();
112
+ // Streams are callable: wrap them so React does not invoke them as updaters.
113
+ setCurrentStream(() => nextStream);
114
+ return () => {
115
+ nextStream.abort();
116
+ };
117
+ }, [enabled, ...dependencies]);
118
+ return useQoreStreamSnapshot(currentStream, options);
119
+ }
120
+ export function useQoreTextStream(sourceFactory, dependencies, initialValue = '') {
121
+ return useQoreStream(() => stream(sourceFactory()), dependencies, { initialValue });
122
+ }
123
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/react.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAQxF,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGpC,MAAM,IAAI,GAAG,GAAS,EAAE,CAAC,SAAS,CAAC;AACnC,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAuC,CAAC;AA8DhE,4EAA4E;AAC5E,kFAAkF;AAClF,SAAS,cAAc,CAAI,MAAsC,EAAE,QAAW;IAC5E,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,IAAI,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,QA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O,aAAa,CAClB,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,EAC7B,YAAY,EACZ,EAAE,YAAY,EAAE,CACjB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { createSSEResponse } from './server/sse-response.js';
2
+ export type { CreateSSEResponseOptions, SSEFrame } from './server/sse-response.js';
3
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Optional server-side stream transport helpers.
2
+ export { createSSEResponse } from './server/sse-response.js';
3
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,4 +1,5 @@
1
+ import type { GlobalAbortSignal } from '../core/response-types.js';
1
2
  export declare function normalizeError(error: unknown): Error;
2
3
  export declare function normalizeAbortReason(reason: unknown, fallbackMessage?: string): Error;
3
- export declare function sleep(ms: number, signal?: AbortSignal | null): Promise<void>;
4
+ export declare function sleep(ms: number, signal?: GlobalAbortSignal | null): Promise<void>;
4
5
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/shared/utils.ts"],"names":[],"mappings":"AACA,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAUpD;AAGD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,eAAe,SAAsB,GAAG,KAAK,CAMlG;AAGD,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB5E"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/shared/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAUpD;AAGD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,eAAe,SAAsB,GAAG,KAAK,CAMlG;AAGD,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBlF"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/shared/utils.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;AACzC,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,oBAAoB,CAAC,MAAe,EAAE,eAAe,GAAG,mBAAmB;IACzF,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,OAAO,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,KAAK,CAAC,EAAU,EAAE,MAA2B;IAC3D,OAAO,IAAI,OAAO,CAAC,CAAC,OAA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AC;IACpC,CAAC;IAED,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,KAAK,CAAC,EAAU,EAAE,MAAiC;IACjE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,OAAO,EAAE,CAAC;YACV,MAAM,CAAC,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC;QACpE,CAAC,CAAC;QAEF,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAChD,CAAC,CAAC;QAEF,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,OAAO;QACT,CAAC;QAED,MAAM,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { signal, computed, createRoot, effect, onCleanup, batch, untrack, isSignal } from './core/signal.js';
2
+ export type { ComputedSignal, ReadonlySignal, Signal } from './core/signal.js';
3
+ export type { EffectOptions, EffectScheduler, SubscribeOptions } from './core/signal-types.js';
4
+ //# sourceMappingURL=signals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../src/signals.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC7G,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/E,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Optional reactive primitives for standalone integrations.
2
+ export { signal, computed, createRoot, effect, onCleanup, batch, untrack, isSignal } from './core/signal.js';
3
+ //# sourceMappingURL=signals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signals.js","sourceRoot":"","sources":["../../src/signals.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC"}
package/docs/api.md CHANGED
@@ -2,10 +2,12 @@
2
2
 
3
3
  This is the short public API map. See the generated TypeScript declarations for exact signatures.
4
4
 
5
- ## Reactivity
5
+ Core imports contain stream APIs only. Optional entrypoints are listed in the [architecture](./architecture.md).
6
+
7
+ ## Optional Reactivity (`@qorejs/qore/signals`)
6
8
 
7
9
  ```js
8
- import { batch, computed, createRoot, effect, onCleanup, signal } from '@qorejs/qore';
10
+ import { batch, computed, createRoot, effect, onCleanup, signal } from '@qorejs/qore/signals';
9
11
  ```
10
12
 
11
13
  - `signal(initial)`: create writable reactive state
@@ -88,10 +90,10 @@ const rows = stream.list(source, { maxItems: 100 });
88
90
  `maxItems` limits the current signal array. It does not hide chunks from async
89
91
  iteration or lifecycle counters.
90
92
 
91
- ## DOM
93
+ ## Optional DOM
92
94
 
93
95
  ```js
94
- import { h, list, mount, text } from '@qorejs/qore';
96
+ import { h, list, mount, text } from '@qorejs/qore/dom';
95
97
  ```
96
98
 
97
99
  - `h(tag, props, ...children)`: create DOM elements
@@ -104,7 +106,7 @@ DOM APIs require a browser-like `document`.
104
106
  ## Server
105
107
 
106
108
  ```js
107
- import { createSSEResponse } from '@qorejs/qore';
109
+ import { createSSEResponse } from '@qorejs/qore/server';
108
110
  ```
109
111
 
110
112
  `createSSEResponse(...)` turns strings, events, or async iterables into a standards-compatible `text/event-stream` response.
@@ -1,6 +1,6 @@
1
1
  # Architecture
2
2
 
3
- Qore is a small runtime with four layers.
3
+ Qore owns streamed state. Host frameworks own rendering and component lifecycle.
4
4
 
5
5
  ```text
6
6
  Provider / AsyncIterable
@@ -9,49 +9,51 @@ Provider / AsyncIterable
9
9
  Qore Stream Runtime
10
10
  |
11
11
  v
12
- Readonly Signal
12
+ Readonly state + subscriptions
13
13
  |
14
- v
15
- DOM Binding
14
+ +--> React adapter --> React components
15
+ +--> Host framework integration
16
+ +--> Optional DOM renderer --> text nodes
16
17
  ```
17
18
 
18
- ## Provider / AsyncIterable
19
-
20
- Providers expose streaming data as async iterables. Qore ships adapters for OpenAI, Anthropic, OpenRouter, DeepSeek, Ollama, generic SSE, and generic line-delimited streams.
21
-
22
- Adapters should run on the server or another trusted runtime when they need API keys.
23
-
24
- ## Stream Runtime
19
+ ## Package boundaries
25
20
 
26
- The stream runtime owns:
21
+ - `@qorejs/qore`: accumulation, stream lifecycle, event projections, backpressure,
22
+ async iteration, and stream inspection.
23
+ - `@qorejs/qore/react`: React external-store hooks with cached snapshots and cleanup.
24
+ - `@qorejs/qore/dom`: optional browser-only rendering, lists, mounting and DOM properties.
25
+ - `@qorejs/qore/signals`: optional mutable signals, computed values, effects and scopes.
26
+ - `@qorejs/qore/providers`: optional vendor and generic SSE/NDJSON adapters.
27
+ - `@qorejs/qore/server`: optional SSE response serialization.
27
28
 
28
- - lifecycle: `idle`, `streaming`, `completed`, `failed`, `aborted`
29
- - abort propagation
30
- - retry and resume contracts for hosted SSE providers
31
- - backpressure buffering
32
- - async iterator bridging
33
- - reducer-based accumulation
34
- - development-time stream inspection through `globalThis.__QORE_DEVTOOLS__`
29
+ These are independently importable subpaths in one package. Core has no runtime
30
+ import of DOM, provider, server or React entrypoints. React is an optional peer,
31
+ so non-React users do not need to install it.
35
32
 
36
- ## Readonly Signal
37
-
38
- Every `QoreStream` is a readonly signal:
39
-
40
- ```js
41
- const answer = stream(model.chat('hello'));
42
- answer();
43
- ```
33
+ ## Internal state
44
34
 
45
- Users can observe stream state, but they cannot mutate runtime-owned fields such as `status`, `chunks`, or `error`.
35
+ The runtime still uses the existing reactive engine internally. Moving its public
36
+ UI primitives to `/signals` avoids requiring applications to adopt a second state
37
+ API. It does not claim that dependency tracking has been removed from the runtime.
38
+ The DOM renderer and stream core share the same engine instance.
46
39
 
47
- ## DOM Binding
40
+ Streams expose readonly values through `answer()`, `peek()` and `subscribe()`;
41
+ applications cannot write the runtime-owned lifecycle fields. Subscription cleanup
42
+ and stream cancellation are distinct: observing an externally owned stream does
43
+ not transfer ownership. The React managed hook aborts the streams it creates.
48
44
 
49
- The DOM layer is intentionally direct. `text(() => answer())` subscribes to the signal and updates a text node.
45
+ ## Integration boundaries
50
46
 
51
- There is no virtual DOM path on the hot streaming update.
47
+ Provider API keys belong on a server or trusted runtime. Browsers consume an
48
+ application endpoint. `/server` can serialize that endpoint as SSE.
52
49
 
53
- ## Server Boundary
50
+ React supplies its renderer and hydration. Managed hooks start work in client
51
+ effects; snapshot hooks provide deterministic server fallbacks. Qore's optional
52
+ DOM renderer has no SSR or hydration implementation, and adding a full framework
53
+ stack is outside the current roadmap.
54
54
 
55
- Qore includes `createSSEResponse(...)` so applications can produce server-side streams and consume them with the same client runtime.
55
+ ## Resource limits
56
56
 
57
- The DOM layer is browser-only in `1.0.x`; SSR and hydration are explicit future work.
57
+ `maxItems` bounds collection values, not full chunk history or iterator backlog.
58
+ Backpressure governs the producer buffer. Do not treat either option as a total
59
+ memory bound; retention and multicasting semantics remain separate runtime work.
@@ -1,48 +1,38 @@
1
1
  # Comparisons
2
2
 
3
- Qore's target is not "another UI framework." Its target is streamed interface state.
3
+ Qore focuses on streamed interface state and integrates with existing UI frameworks.
4
4
 
5
5
  ## React / Vercel AI SDK
6
6
 
7
- React and the Vercel AI SDK are strong tools for React applications. They still normally route streamed data through React state and render scheduling.
7
+ The Qore React adapter exposes streams through `useSyncExternalStore`. Updates
8
+ still use React rendering and reconciliation. Qore adds stream lifecycle and event
9
+ projection contracts; it does not make React render like a direct DOM renderer.
8
10
 
9
- ```text
10
- React / Vercel AI SDK:
11
- Token -> Hook state -> Component render -> Reconcile
11
+ The optional `/dom` renderer can update a dependent text node directly. That is a
12
+ separate integration path, not a property of all Qore integrations.
12
13
 
13
- Qore:
14
- Token -> Stream signal -> Text node
15
- ```
14
+ ## Solid and Vue
16
15
 
17
- Qore avoids snapshot-style transcript rewrites. That is the runtime distinction.
18
-
19
- ## Solid
20
-
21
- Solid has excellent fine-grained reactivity. Qore's difference is the native stream primitive: a stream is already a signal and an async iterable.
22
-
23
- ## Vue
24
-
25
- Vue refs are ergonomic, but provider streams still need to be adapted into state by user code. Qore makes that adaptation the default primitive.
16
+ Their reactive systems already own application state and rendering. Applications
17
+ can bridge Qore subscriptions into native signals or refs and dispose subscriptions
18
+ with their framework lifecycle. They do not need Qore's optional `/signals` or
19
+ `/dom` APIs. Qore's responsibility is stream consumption and lifecycle.
26
20
 
27
21
  ## RxJS
28
22
 
29
- RxJS is a powerful observable toolkit. Qore is smaller and UI-directed: the result of stream composition is still a readonly signal that can bind directly to a DOM node.
23
+ Stream composition overlaps with observable libraries. Qore's particular contract
24
+ combines the current accumulated value, subscriptions, async iteration and lifecycle.
25
+ Choose based on required stream semantics and integration costs.
30
26
 
31
27
  ## When Not To Use Qore
32
28
 
33
- Do not use Qore as a replacement for a full app framework if you need routing, forms, UI component catalogs, or a large ecosystem surface.
34
-
35
- Use Qore where the hard part is streamed data becoming reactive interface state.
36
-
29
+ An existing application with adequate stream handling may not need another runtime.
30
+ Qore does not provide routing, forms, an application component ecosystem, or its own
31
+ SSR/hydration stack. The standalone DOM renderer is optional.
37
32
 
38
33
  ## Benchmark Language
39
34
 
40
- Qore should not claim to be faster than React as a brand. The precise claim is narrower and more defensible:
41
-
42
- ```text
43
- Fine-grained stream updates
44
- vs
45
- snapshot transcript rewrites
46
- ```
47
-
48
- Qore optimizes the path where each token updates the stream signal and only the dependent UI surface changes. Snapshot baselines rewrite a larger transcript region. The benchmark should measure mutation count, added nodes, rewritten bytes, and update scope instead of turning framework names into a scoreboard.
35
+ The current benchmark compares fine-grained stream updates with snapshot-style
36
+ transcript rewrites. It is not an optimized React, Vue or Solid comparison and does
37
+ not establish a framework-wide performance ranking. Measure real workloads,
38
+ including parsing, rendering, interaction latency and retained memory.
package/docs/concepts.md CHANGED
@@ -10,19 +10,9 @@ A stream is how data moves. A signal is how UI reacts. Qore treats them as one r
10
10
 
11
11
  ## The Problem
12
12
 
13
- Most UI frameworks start with a snapshot model:
14
-
15
- ```text
16
- fetch -> state snapshot -> render
17
- ```
18
-
19
- AI and realtime interfaces are different. The useful data often arrives as a sequence:
20
-
21
- ```text
22
- token -> token -> tool event -> status -> token -> done
23
- ```
24
-
25
- If each chunk has to be copied into component state, reconciled, and rerendered as a transcript snapshot, the runtime path becomes wider than the problem needs.
13
+ AI and realtime interfaces receive sequences of tokens, tool events, status,
14
+ diffs and terminal events. A runtime can centralize accumulation and lifecycle
15
+ while the existing UI framework continues to manage components and rendering.
26
16
 
27
17
  ## The Qore Model
28
18
 
@@ -43,9 +33,11 @@ The same value is:
43
33
  - an async iterable
44
34
  - a lifecycle-aware stream state
45
35
 
46
- That means a UI can bind directly to streamed data:
36
+ The optional `@qorejs/qore/dom` renderer can bind directly to streamed data:
47
37
 
48
38
  ```js
39
+ import { h, text } from '@qorejs/qore/dom';
40
+
49
41
  h('article', {}, text(() => answer()));
50
42
  ```
51
43
 
package/docs/providers.md CHANGED
@@ -45,7 +45,8 @@ Supported adapters:
45
45
  ## Example
46
46
 
47
47
  ```js
48
- import { createOpenAI, stream } from '@qorejs/qore';
48
+ import { createOpenAI } from '@qorejs/qore/providers';
49
+ import { stream } from '@qorejs/qore';
49
50
 
50
51
  const openai = createOpenAI({
51
52
  apiKey: process.env.OPENAI_API_KEY,
package/docs/react.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Qore's core runtime is framework-neutral. The React adapter lets React apps consume Qore streams without treating streaming as a special rendering case.
4
4
 
5
- > Status: the adapter is release-ready in [`packages/react`](../packages/react), but the npm package is not published yet. Publishing currently fails with npm `E404` for `@qorejs/react`, which means the `@qorejs` npm scope/package access still needs to be provisioned before the install command below becomes valid.
5
+ The hooks ship with Qore 2 at `@qorejs/qore/react`. The separate
6
+ `@qorejs/react` package is an unpublished compatibility wrapper, not an installation requirement.
6
7
 
7
8
  ```bash
8
- # Available after npm package access is provisioned.
9
- npm i @qorejs/qore @qorejs/react
9
+ npm i @qorejs/qore react react-dom
10
10
  ```
11
11
 
12
12
  ## Why It Exists
@@ -30,7 +30,7 @@ Use `useQoreStream` when a component owns the stream lifecycle.
30
30
 
31
31
  ```tsx
32
32
  import { stream } from '@qorejs/qore';
33
- import { useQoreStream } from '@qorejs/react';
33
+ import { useQoreStream } from '@qorejs/qore/react';
34
34
 
35
35
  export function Answer({ prompt }: { prompt: string }) {
36
36
  const answer = useQoreStream(
@@ -57,7 +57,7 @@ Use `useQoreStreamSnapshot` when the stream is created outside React and the com
57
57
 
58
58
  ```tsx
59
59
  import type { QoreStream } from '@qorejs/qore';
60
- import { useQoreStreamSnapshot } from '@qorejs/react';
60
+ import { useQoreStreamSnapshot } from '@qorejs/qore/react';
61
61
 
62
62
  export function Transcript({ answer }: { answer: QoreStream<string, string> }) {
63
63
  const snapshot = useQoreStreamSnapshot(answer, { initialValue: '' });
@@ -74,7 +74,7 @@ Use `useQoreSignalSelector` when a React component only needs one derived slice
74
74
 
75
75
  ```tsx
76
76
  import type { QoreStream } from '@qorejs/qore';
77
- import { useQoreSignalSelector } from '@qorejs/react';
77
+ import { useQoreSignalSelector } from '@qorejs/qore/react';
78
78
 
79
79
  function TokenCounter({ answer }: { answer: QoreStream<string, string> }) {
80
80
  const tokenCount = useQoreSignalSelector(answer.chunks, (chunks) => chunks.length);
@@ -90,7 +90,7 @@ Use `useQoreSignal` for any Qore readonly signal.
90
90
 
91
91
  ```tsx
92
92
  import type { ReadonlySignal } from '@qorejs/qore';
93
- import { useQoreSignal } from '@qorejs/react';
93
+ import { useQoreSignal } from '@qorejs/qore/react';
94
94
 
95
95
  export function Counter({ count }: { count: ReadonlySignal<number> }) {
96
96
  const value = useQoreSignal(count);
@@ -103,3 +103,19 @@ export function Counter({ count }: { count: ReadonlySignal<number> }) {
103
103
  Provider adapters are still intended for server-side or trusted runtimes. In browser React apps, stream from your own SSE or NDJSON endpoint instead of exposing provider API keys.
104
104
 
105
105
  Keep dependency arrays honest. If the stream factory reads `prompt`, `model`, `conversationId`, or auth/session state, include those values in the dependency list.
106
+
107
+ ## Snapshot and rendering contract
108
+
109
+ The adapter caches emitted snapshots so repeated React reads receive the same
110
+ reference, including stream chunk arrays. Subscription setup reads the current
111
+ source through immediate delivery, covering updates between render and subscribe.
112
+ Selectors may use `isEqual` to retain an equivalent selected value.
113
+
114
+ `useQoreStreamSnapshot` uses `initialValue` and idle lifecycle fields during server
115
+ rendering and hydration. Network work for `useQoreStream` starts in an effect on the
116
+ client. For `useQoreSignal` and selectors, supply `getServerSnapshot` when the server
117
+ value differs from the client source. Keep request-specific streams out of shared
118
+ server globals. These hooks do not bypass React rendering.
119
+
120
+ `maxItems` bounds a collection's displayed value, not its retained chunk history
121
+ or iterator queue. This release does not introduce bounded total stream memory.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qorejs/qore",
3
- "version": "1.0.7",
3
+ "version": "2.0.0",
4
4
  "description": "Qore is a reactive stream runtime for AI-native interfaces.",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",
@@ -10,14 +10,35 @@
10
10
  "types": "./dist/src/index.d.ts",
11
11
  "import": "./dist/src/index.js"
12
12
  },
13
- "./package.json": "./package.json"
13
+ "./package.json": "./package.json",
14
+ "./signals": {
15
+ "types": "./dist/src/signals.d.ts",
16
+ "import": "./dist/src/signals.js"
17
+ },
18
+ "./dom": {
19
+ "types": "./dist/src/dom.d.ts",
20
+ "import": "./dist/src/dom.js"
21
+ },
22
+ "./providers": {
23
+ "types": "./dist/src/providers.d.ts",
24
+ "import": "./dist/src/providers.js"
25
+ },
26
+ "./server": {
27
+ "types": "./dist/src/server.d.ts",
28
+ "import": "./dist/src/server.js"
29
+ },
30
+ "./react": {
31
+ "types": "./dist/src/react.d.ts",
32
+ "import": "./dist/src/react.js"
33
+ }
14
34
  },
15
35
  "files": [
16
36
  "dist/src",
17
37
  "README.md",
18
38
  "README.zh-CN.md",
19
39
  "docs",
20
- "LICENSE"
40
+ "LICENSE",
41
+ "MIGRATION.md"
21
42
  ],
22
43
  "sideEffects": false,
23
44
  "scripts": {
@@ -58,7 +79,6 @@
58
79
  "anthropic",
59
80
  "deepseek",
60
81
  "ollama",
61
- "framework",
62
82
  "async-iterable"
63
83
  ],
64
84
  "homepage": "https://qorejs.dev/",
@@ -77,7 +97,18 @@
77
97
  "@playwright/test": "^1.60.0",
78
98
  "@types/node": "^25.6.0",
79
99
  "@types/react": "^19.2.17",
100
+ "@types/react-dom": "^19.2.3",
101
+ "esbuild": "^0.25.12",
80
102
  "react": "^19.2.7",
103
+ "react-dom": "^19.2.7",
81
104
  "typescript": "^6.0.3"
105
+ },
106
+ "peerDependencies": {
107
+ "react": ">=18.2.0"
108
+ },
109
+ "peerDependenciesMeta": {
110
+ "react": {
111
+ "optional": true
112
+ }
82
113
  }
83
114
  }