@aiquants/chat 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +89 -0
- package/README.md +218 -26
- package/dist/{ChatAnswerHtml-3K6G6UKC.js → ChatAnswerHtml-UNWOOMYK.js} +1 -1
- package/dist/{chunk-7CEL735H.js → chunk-44WLZMPZ.js} +1 -1
- package/dist/chunk-5MWD2PSY.js +1 -0
- package/dist/chunk-GSCTWGZT.js +1 -0
- package/dist/chunk-HC7HXC2K.js +1 -0
- package/dist/{chunk-PLNRET3Z.js → chunk-KNPMHSTQ.js} +1 -1
- package/dist/{chunk-7KWWXSGA.js → chunk-NWDLT2AZ.js} +1 -1
- package/dist/client.cjs +2 -2
- package/dist/client.d.cts +5 -5
- package/dist/client.d.ts +5 -5
- package/dist/client.js +1 -1
- package/dist/{httpTransport-BAaKwioS.d.ts → httpTransport-Cgj10OUn.d.ts} +1 -1
- package/dist/{httpTransport-D_JJABMq.d.cts → httpTransport-o7MkPUuY.d.cts} +1 -1
- package/dist/{index-iHWm67aF.d.cts → index-g-wjju1F.d.cts} +9518 -1785
- package/dist/{index-iHWm67aF.d.ts → index-g-wjju1F.d.ts} +9518 -1785
- package/dist/protocol.cjs +1 -1
- package/dist/protocol.d.cts +1 -1
- package/dist/protocol.d.ts +1 -1
- package/dist/protocol.js +1 -1
- package/dist/react.cjs +2 -2
- package/dist/react.d.cts +210 -24
- package/dist/react.d.ts +210 -24
- package/dist/react.js +2 -2
- package/dist/{runStream-DLhaMZSu.d.ts → runStream-Wn5F3RKe.d.ts} +3 -1
- package/dist/{runStream-Dd5YdJoh.d.cts → runStream-jp4rlkIw.d.cts} +3 -1
- package/dist/testing.cjs +6 -6
- package/dist/testing.d.cts +55 -4
- package/dist/testing.d.ts +55 -4
- package/dist/testing.js +6 -6
- package/dist/{transport-Clvkp7mW.d.ts → transport-CYd9hh42.d.cts} +23 -1
- package/dist/{transport-5ExGY_ti.d.cts → transport-DlhniH4C.d.ts} +23 -1
- package/package.json +5 -5
- package/dist/chunk-4NR4KSV6.js +0 -1
- package/dist/chunk-TQNSD6RJ.js +0 -1
- package/dist/chunk-WGNEBS4H.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,95 @@
|
|
|
3
3
|
All notable changes to `@aiquants/chat` are documented here.
|
|
4
4
|
Headings are version numbers. Unreleased changes go under `## Unreleased`; a release renames that heading to its version and publish date (`## 0.1.0 (YYYY-MM-DD)`).
|
|
5
5
|
|
|
6
|
+
## 0.3.0 (2026-11-22)
|
|
7
|
+
|
|
8
|
+
### Breaking
|
|
9
|
+
|
|
10
|
+
- **The peer floor on `@aiquants/console-ui` rises from `^0.10.0` to `^0.11.0`** (an optional peer that only `./react` reads):
|
|
11
|
+
console-ui 0.11.0 tells an ARIA modal (role `dialog` or `alertdialog` with `aria-modal="true"`) as an open modal, routes the
|
|
12
|
+
root's announcements to the topmost modal before it checks the root's region, and widens `TopmostModal` and the
|
|
13
|
+
`foreignModalAnnouncer` argument to `HTMLElement`, which this package does not use. Migration: a host that loads
|
|
14
|
+
`./react` installs `@aiquants/console-ui` 0.11.0 or a later release within its range.
|
|
15
|
+
- **`ChatMessageList` takes `onEditMessage`, `onRegenerateMessage`, `rewrite`, `messageActionsDisplay` and `sendKey`, and its `limits` take `CHAT_USER_MESSAGE_MAX_CHARS`**: the send hook's `edit`, `regenerate` and `rewrite`, the person's `message_actions_display` and `send_key`, and the limit of a message's length; a host hands them, and a host's own list messages (`ChatListMessage`) add `sourceText`, the window's text before the marks of invisible characters, which `chatListMessage` sets
|
|
16
|
+
- **Every message's actions are one toolbar** (`<article's testId>-actions-bar`, console-ui's `Toolbar`): the Tab order stops once per article and the arrow keys, Home and End move between the branch buttons and the role's action, so a host's test that tabs from one branch button to the other presses an arrow; the reason that a switch is under way is the list's note (`<testId>-actions-note-switching`, drawn once after the scroll box) instead of `-branch-busy-reason`, and a failed switch's paragraph stays `-branch-problem`, now under the toolbar
|
|
17
|
+
- **`useChatSend` reads the window's `branchSwitch` and answers `edit`, `regenerate` and `rewrite`**, so a host's own window in its tests adds `branchSwitch` and a host's own send adds the three
|
|
18
|
+
- **`ChatMessageList` takes `onSwitchBranch` and `branchSwitch`**, the open conversation's window's `switchBranch` and `branchSwitch`, and a message it lists (`ChatListMessage`) holds its `branch` (`ChatMessageBranch`: its place and the count among its siblings in the order they were made, with the previous and the next sibling, or `null` for a message without another sibling); a host hands the window's two, and a host's own list messages add `branch`
|
|
19
|
+
- **`ChatComposer` takes `runElsewhere`**, whether the conversation's unfinished answer is on another branch than the one shown (`useChatSend`'s `runElsewhere`); a host hands the hook's
|
|
20
|
+
- **The open conversation's window (`ChatConversationWindow`) answers `switchBranch`, `branchSwitch` and `runElsewhere`, and `useChatSend` answers `runElsewhere`**, so a host's own window or send in its tests adds them; the send's phase is `running` while the conversation's unfinished run writes on another branch, since the server refuses a send meanwhile, and the stop goes to that run
|
|
21
|
+
- **`ChatComposer` takes `inputRef`**, the ref object the host is handed the text area by (or `null`), so a host can move focus into it, as after the open conversation is deleted; a host passes `null` when it does not.
|
|
22
|
+
- **The level names moved to `confidentialityLevels`** (`./react`): the labels' `newConversation.levels` is gone, and the names of the contract's confidentiality levels are the catalog's own group `confidentialityLevels`, which the new conversation's level choice and the open conversation's band read. A host that overrides the labels moves its level names there.
|
|
23
|
+
- **A search text is at most `CHAT_SEARCH_TEXT_MAX_LENGTH` (400, from the source's `search_text_max_length`) UTF-16 code units**: `chatSearchTextSchema` refuses a longer text, so the `q` of `listConversations` and `searchConversation` is bounded (the server builds a `LIKE` pattern from it). `chatSearchText` never makes a text longer, so a screen bounds what a person types to the same length.
|
|
24
|
+
The conversations' list's search box takes at most that many units (`maxLength`), and `useChatConversationList` answers a longer search empty without a request, as it answers one holding a lone surrogate.
|
|
25
|
+
- **`ChatRequestInvalidType` has two more rule tags**, `declared_level_lowered` (a change of a conversation's row that lowers its declared level) and `title_invisible` (a title that shows nothing); a host that switches over the tags or writes a catalog of its own handles them, and each catalog's `refusals.rules` has their sentences.
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- **Asking for consent to the usage policy** (`./react`): `useChatPolicy` reads the policy and sends the person's consent, and answers a transport that reads the policy again when another endpoint asks for consent; `ChatPolicyGate` draws the screen's main place once the person consented to the current version, and the consent screen until then (the text, or the line-by-line difference from the version consented to, and the button that consents); `ChatConsentConversation` is the open conversation's band meanwhile, with its stop and delete.
|
|
30
|
+
The gate and the band take the host's `headingLevel`; the gate keeps its children mounted (hidden by `Activity`) while the person is asked again, so a draft waits for the consent; and a delete from the band that lands after the band left still calls the host's `onChanged` and `onDeleted`.
|
|
31
|
+
The labels have the groups `policy` and `consentConversation`, and the layout's rules place the consent screen's text, difference and band.
|
|
32
|
+
- **Editing a message and regenerating an answer** (`./react`): every message ends its article with one toolbar named "Message actions" that holds its branch switch (while it has siblings) and the action of its role, "Edit" for a user's message and "Regenerate" for an answer, shown as the person's `message_actions_display` says (`always`; `hover`, while the article is pointed at or holds focus, only transparent otherwise; `auto`, always on a device with a coarse pointer and otherwise as `hover`), while the switch always shows.
|
|
33
|
+
"Edit" opens the edit form in the article in place of its body: one visible label names the form and its input, which holds the message's text before the marks and takes focus at its end; the list holds the text, one edit at a time; the composer's send key and its rules of a message's text hold (its length, and no broken character); "Cancel" and Escape close it with focus back on "Edit", except while the edit is sent, when "Cancel" cannot be pressed and says why and Escape tells it (the edit goes on whatever the form does).
|
|
34
|
+
The feed's Control + Home and Control + End leave the feed from the toolbar and the form's buttons too, before the toolbar's own Home and End read them; inside the form's input they stay the caret's.
|
|
35
|
+
A focused element of the toolbar comes into view from below with the article's end when the rest of the row fits, and in the last message with the content's bottom inset too, so the list reaches its tail (no jump to the latest shows, and a following list keeps following) instead of stopping short by the article's padding; an element taller than the band stays only while its own box crosses the band, not while its ring alone reaches into it.
|
|
36
|
+
"Send the edit" sends `startRun` of kind `edit` with no attachments and "Regenerate" kind `regenerate` (`useChatSend`'s `edit` and `regenerate`, with the conversation's model and reasoning level), sharing the send's ID rule, phase, stop target and numbering of failures; the content an ID stands for also holds the count of the target's siblings the window lists, so once the window lists the sibling of a request that landed unseen, pressing again rewrites anew instead of the server answering the earlier acceptance.
|
|
37
|
+
An acceptance names the new user's message for an edit and none for a regeneration, else it breaks the contract.
|
|
38
|
+
An accepted one answers its new sibling once the window's read after the acceptance has settled, and lands as a switch does: the sibling takes the message's place, focus moves to its same button, and the branch shown is announced; when that read shows no sibling while the message stays, an edit's form closes with focus back on "Edit" (also from where the reader moved it inside the form). A failed one is a paragraph in the form or under the actions, told once per occurrence; a form shows only an edit that failed after it opened, and the next send, edit or regeneration clears the last failure.
|
|
39
|
+
A button blocked for the whole list names one note the list draws after the scroll box: a switch under way, an answer not written yet (from a send until its run ends), or another message being edited.
|
|
40
|
+
- **How a message's actions show is a setting the form shows** (`./react`): `ChatSettingsForm` offers `message_actions_display` (automatic, always, or while pointed at or focused) between the announcements of answers and the default model; collapsing the actions' labels at a narrow width still waits for icons the actions can show, and keeps its value.
|
|
41
|
+
- **The leaves of the requests that carry a person's text** (`./protocol`): the source's `human_texts` names them, as a request body's shape and field with a run request's kind between (`run_request.send.text`), and `CHAT_HUMAN_TEXT_LEAVES` holds them frozen: the `text` of a conversation's and a run's send and edit, a conversation's `title`, an attachment's `alt_text` on its update and its `file_name` and `alt_text` on its upload.
|
|
42
|
+
A server checks each as a person's text, and the Python copy marks the same leaves; every other field of a request body takes a closed type, and a search's `q` is no leaf. The requests' JSON does not change.
|
|
43
|
+
- **The switch of a message's branch** (`./react`): in the message list, a message with two siblings or more ends its article with the previous branch's button, its place ("Branch 2 of 3") and the next branch's button, as one group the place names; a button at an end does not wrap around and says why it cannot be pressed.
|
|
44
|
+
A press runs the window's `switchBranch` (the parent's `setActiveChild`, or the conversation's `setActiveRoot` for a message without a parent) in the place the window's reads take, one at a time, and the path it answers lands as one read; the list keeps the message the reader was looking at where it was (the sibling takes a message the switch took away, shown from its top), focus moves without scrolling to the same button of the sibling's article, and the root's announcer says the branch shown, once.
|
|
45
|
+
While a switch runs, its pressed button is busy and every other switch cannot be pressed, each reason drawn once per group and named by its buttons; a switch that failed is a paragraph under its group (`branchSwitch.problem`, numbered by its occurrence), which the list tells once, and the window reads again.
|
|
46
|
+
Focus moves only from the pressed button or the body; a landed path whose page does not hold the sibling sends focus to the earlier-messages button (or, with no earlier page, the last article).
|
|
47
|
+
The window reads again when the row read at focus shows another chosen root, and follows by its state read, to its end, an unfinished run whose answer is not on its path (`runElsewhere`; a run whose streamed answer a switch took off the path too), starting that read again when a switch moves the run's answer onto or off the path, while the composer says that an answer on another branch has not finished and describes its stop button and its input by it.
|
|
48
|
+
- **The open conversation's heading band** (`./react`): `ChatConversationHeading` draws the title (`ChatTalkHeading`, with the title's test ID), the declared level, and the conversation's rename (a dialog whose field is checked as the contract checks a title once the reader tried, with no `maxLength`), pin (the console's switch) and delete (a confirmation dialog, WCAG 3.3.6), which `useChatConversationActions` runs one at a time.
|
|
49
|
+
A rename and a pin send `updateConversation` and are ready again as soon as it answers, then the window reads again and `onChanged` lets the host read its list again; the answered row stays the hook's `landed` until a read of the window after it lands, and the band shows its title and pin over the window's row (`chatConversationShownRow`).
|
|
50
|
+
A delete stops the conversation's running run first (`cancelRun`, sent again while the admission is busy), waits until the window's row holds no running run, then sends `deleteConversation`, calls `onChanged` and `onDeleted`, and stays deleting until the host takes the band away. Failures are numbered by occurrence, told once through the announcer, and the window reads again after one. A refusal because an answer started elsewhere (`CHAT_RUN_ACTIVE`) stays deleting until that read lands, then offers to stop and delete.
|
|
51
|
+
`useChatConversationDeletedAnnouncer` answers the function a host calls, once focus has landed in the new conversation's composer, to say through the root's announcer that the conversation was deleted. The labels have the group `conversationHeading`.
|
|
52
|
+
- **The scenario's run streams** (`./testing`): `createChatScenarioRunStreams` makes the EventSources a host hands its run streams (`reopen.createEventSource`) in a server's place, so a screen draws a run's stream (an answer being written, stopped, failed or cut) with the package's own subscription.
|
|
53
|
+
A run's script plays events of the contract (checked by the contract's reader), `resync-required`, a dropped connection and a gate the host opens (`release`) on the host's timers; events carry stream IDs of the Redis form `<idBaseMs>-<seq>`, an open stream sends the host's heartbeat (`heartbeat`) until its last event so a stream held open never goes stale, a stream with a cursor continues after it, `endOf` answers the run's end once a stream has carried it, and a stream no script plans is a breach (`breaches()`).
|
|
54
|
+
- **The body that changes a conversation's row** (`./protocol`): `chatConversationUpdateSchema` (`conversation_update`: at least one of `title`, `pinned` and `declared_level`, none of them `null`), closed, with its type.
|
|
55
|
+
A title is at most `CHAT_CONVERSATION_TITLE_MAX_LENGTH` (400, from the source's `conversation_title_max_length`) UTF-16 code units and shows something (`chatTextShows`); the model and the reasoning level are not among its fields.
|
|
56
|
+
- **A conversation's tree and the hits of a search in it** (`./protocol`): `chatConversationTreeSchema` (`conversation_tree`: the chosen root and every message of every branch as a `chatTreeNodeSchema` node, a parent before its children) and `chatSearchHitsSchema` (`search_hits`: each found message once, with whether it is on the chosen path and the parts that hold the search's text, `chatSearchHitSchema`), closed, with their types.
|
|
57
|
+
A node holds the head of its message's text within `CHAT_TREE_PREVIEW_MAX_LENGTH` (80, from `tree_preview_max_length`) UTF-16 code units, never splitting a surrogate pair, and `preview_cut` when the text is longer. The new vocabulary `search_parts` (`text`, `attachment_alt`, `reasoning`) names the parts.
|
|
58
|
+
- **The tenant's policy and a person's consent to it** (`./protocol`): `chatPolicySchema` (`policy`: the current version and the state of the person's consent, `current`, `earlier` with the version last consented to, or `none`, its shapes `chatPolicyConsentSchemas`), `chatPolicyVersionSchema` (`policy_version`), `chatPolicyTextsSchema` (`policy_texts`: a text for each of `language_codes`) and `chatPolicyConsentRequestSchema` (`policy_consent_request`), closed, with their types.
|
|
59
|
+
A version's number runs from 1 to `CHAT_POLICY_VERSION_NO_MAX` (from `policy_version_no_max`). The new vocabulary `policy_consents` names the states.
|
|
60
|
+
- **The exchanges of a conversation's change, deletion, tree and search, and of the policy and a consent** (`./protocol`) are settled in `CHAT_EXCHANGES`, so the transport sends them.
|
|
61
|
+
`updateConversation` (`PATCH /conversations/{conversation_uid}`, 200, `conversation_update` → `conversation`), `deleteConversation` (`DELETE /conversations/{conversation_uid}`, 204), `getConversationTree` (`GET /conversations/{conversation_uid}/tree`, 200, → `conversation_tree`), `searchConversation` (`GET /conversations/{conversation_uid}/search` with its query `q`, 200, → `search_hits`), `getPolicy` (`GET /policy`, 200, → `policy`) and `consentPolicy` (`POST /policy-consents`, 204, `policy_consent_request`, the first 204 that takes a body).
|
|
62
|
+
- **The bodies and the answer of a switch of the chosen path** (`./protocol`, plan §2.5.2 and §2.6.2): `chatActiveRootUpdateSchema` (`active_root_update`: the message without a parent the path starts from), `chatActiveChildUpdateSchema` (`active_child_update`: the child of a message the path goes on to) and `chatActivePathSchema` (`active_path`: the conversation's row and the latest page of the path chosen now, read in the transaction that wrote the switch), all closed, with their types.
|
|
63
|
+
The exchanges of `setActiveRoot` (`PUT /conversations/{conversation_uid}/active-root`, 200, `active_root_update` → `active_path`) and `setActiveChild` (`PUT /messages/{message_uid}/active-child`, 200, `active_child_update` → `active_path`) are settled in `CHAT_EXCHANGES`, so the transport sends them.
|
|
64
|
+
|
|
65
|
+
### Changed
|
|
66
|
+
|
|
67
|
+
- **The composer does not send a text with a broken character**: a text that holds a lone surrogate (a paste can carry one, half of a character outside the basic plane), which the contract refuses in every text, stops the send with its reason ("To send, delete the broken character in the message.", the labels' `composer.illFormedReason`) and marks the input invalid; before, the composer handed it on and `useChatSend`'s `send` refused it with a `RangeError`.
|
|
68
|
+
- **A send or a rewrite accepted while `Activity` hid the window stops waiting once the window shows again**: the hidden window answers its read after the acceptance as not landed, so `useChatSend` has the shown window read again and ends the accepted run's wait when that read lands; before, the phase stayed `running` until a stop showed the run's end.
|
|
69
|
+
- **An answer's document lets the conversation's surface show through**: the layout rule gives each answer's document root (`[data-aqmd-document]`) a transparent background and the surface's text colour, so the Markdown renderer's display style no longer paints its own background (in the dark scheme, a band darker than the conversation's surface) or text colour over the conversation. A page that draws the answers links the renderer's display stylesheets (`katex.min.css`, `message.css`, `details.css`, `github-markdown.css`; see the README).
|
|
70
|
+
- **A conversation's model and reasoning level are those of the last run accepted in it**: accepting a run writes its own to the conversation's row, so a screen starts its next send from the row; before, the row kept those the request that made the conversation named.
|
|
71
|
+
|
|
72
|
+
## 0.2.0 (2026-11-20)
|
|
73
|
+
|
|
74
|
+
### Breaking
|
|
75
|
+
|
|
76
|
+
- **`useChatConversation` takes the required `limits`** (`ChatConversationLimits`: `CHAT_RUN_POLL_INTERVAL_MS`), the interval of the window's state read below.
|
|
77
|
+
It refuses a `limits` that is not an object with a `TypeError` and an interval that is not a positive safe integer with a `RangeError`. Pass the settings' tunables (`useChatSettings`' `limits`), as the composer's attachments take them.
|
|
78
|
+
- **`ChatListMessage` has the required `contextCutBefore`**, true on the one message the latest answer's context starts at; a host that makes the list's messages itself sets it (the window's `messages` carry it).
|
|
79
|
+
- **`ChatStreamNotice` has a fourth kind, `awaiting-end`**, which the window shows while its state read waits for the end of a run whose stream cannot go on; a host that switches over the kinds handles it.
|
|
80
|
+
`ChatNoticeSlot` draws it as an `info` note without a button, and each catalog's `stream.notices` has its sentence. No status gives it, so `nextChatStreamNotice` refuses it as the previous notice with a `RangeError`.
|
|
81
|
+
|
|
82
|
+
### Added
|
|
83
|
+
|
|
84
|
+
- **The open conversation's state read** (`./react`, plan §2.5.2): the window follows, until it ends, the first answer on the path whose run is active and whose stream is no longer open, or whose stream it could not continue twice, whether or not the path still holds the answer later.
|
|
85
|
+
Every interval it reads the run; it puts the run's answer message in place when the run ended or waits for an approval in a segment it does not show yet (not when the two reads disagree), reads the conversation again once for each later segment the run writes, and reads it once more after the end.
|
|
86
|
+
A subscription the window opens to that run, from the stream's start, pauses the read: its first item that continues the stream ends the read, and a subscription that cannot continue it is closed while the read goes on at once; the window subscribes again only to a newer seed a later read gives.
|
|
87
|
+
- **The line of the latest answer's context** (`./react`, plan §2.6.2): the message list opens the article of the message the latest answer's run cut its context before (`context_cut_before`) with a line saying that the messages before it, except the conversation's first question, are not in that context, and points the article's description at it.
|
|
88
|
+
The window sets it from the latest answer whose run has been taken, so a question just sent keeps the line where it was until a read shows its run taken, and draws none when that answer cut nothing or the window does not hold the message it names.
|
|
89
|
+
|
|
90
|
+
### Changed
|
|
91
|
+
|
|
92
|
+
- **A stream that brings its run's own end reads the conversation once more**, as the state read does after the end: the row's active run and the path are older than the end, and only the answer's read carries the boundary of its context.
|
|
93
|
+
- **A text no stream can write any more grows while the read shows its run writing**: an answer whose view `resync-required` ended stays a growing text (`ChatMessageText.growing`) while the read shows the run `running`, as an answer without a view does, instead of a finished one while the window reads it again or follows it by the state read.
|
|
94
|
+
|
|
6
95
|
## 0.1.0 (2026-11-20)
|
|
7
96
|
|
|
8
97
|
The first release: the chat's wire contract, the subscription to a run's stream with the notice of its connection, the fold of the stream into a window's view, the transport of the endpoints' exchanges,
|