@assistant-ui/react-statewire 0.35.1 → 0.35.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @assistant-ui/react-statewire
|
|
2
2
|
|
|
3
|
-
Binds a statewire to an assistant-ui thread: a converter projects the replicated state into messages, and the run-dialect commands drive the composer and message actions. Part of [harness-sdk](https://github.com/assistant-ui/harness-sdk), with `harness-sdk` and
|
|
3
|
+
Binds a statewire to an assistant-ui thread: a converter projects the replicated state into messages, and the run-dialect commands drive the composer and message actions. Part of [harness-sdk](https://github.com/assistant-ui/harness-sdk), with `harness-sdk` and Pinboard.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -14,10 +14,10 @@ pnpm add @assistant-ui/react-statewire statewire @assistant-ui/core @assistant-u
|
|
|
14
14
|
import { AuiConfig, AuiProvider } from "@assistant-ui/store";
|
|
15
15
|
import { StatewireThread } from "@assistant-ui/react-statewire";
|
|
16
16
|
import { LocalStorageComposerDrafts } from "@assistant-ui/react-statewire/local-storage";
|
|
17
|
-
import {
|
|
17
|
+
import { StatewireWebsocket } from "statewire";
|
|
18
18
|
|
|
19
19
|
const thread = StatewireThread<ServerState>({
|
|
20
|
-
transport:
|
|
20
|
+
transport: StatewireWebsocket({ url }),
|
|
21
21
|
initialState: { messages: [], status: "ready", runs: [] },
|
|
22
22
|
converter,
|
|
23
23
|
capabilities: { edit: true, reload: true },
|
|
@@ -35,7 +35,7 @@ Pass a stable authenticated `principal`; remount the thread/session when the acc
|
|
|
35
35
|
|
|
36
36
|
## Docs
|
|
37
37
|
|
|
38
|
-
- Get started: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/app/statewire/docs/get-started/statewire/page.mdx
|
|
39
|
-
- Guide: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/app/statewire/docs/guides/statewire/bindings/page.mdx
|
|
40
|
-
- Reference: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/app/statewire/docs/reference/statewire-bindings/page.mdx
|
|
41
|
-
- Spec: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/app/statewire/docs/spec/statewire-protocol/envelopes/page.mdx
|
|
38
|
+
- Get started: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/src/app/statewire/docs/get-started/statewire/page.mdx
|
|
39
|
+
- Guide: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/src/app/statewire/docs/guides/statewire/bindings/page.mdx
|
|
40
|
+
- Reference: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/src/app/statewire/docs/reference/statewire-bindings/page.mdx
|
|
41
|
+
- Spec: https://github.com/assistant-ui/harness-sdk/blob/main/apps/docs/src/app/statewire/docs/spec/statewire-protocol/envelopes/page.mdx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@assistant-ui/react-statewire",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.3",
|
|
4
4
|
"description": "assistant-ui thread binding for statewire backends",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@assistant-ui/store": "^0.3.22",
|
|
40
40
|
"@assistant-ui/tap": "^0.9.24",
|
|
41
41
|
"assistant-stream": "^0.3.53",
|
|
42
|
-
"statewire": "^0.
|
|
42
|
+
"statewire": "^0.30.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@assistant-ui/core": ">=0.3.12",
|
|
@@ -7,7 +7,8 @@ import { act, render, waitFor } from "@testing-library/react";
|
|
|
7
7
|
import type { FC } from "react";
|
|
8
8
|
import { describe, expect, it } from "vitest";
|
|
9
9
|
import { AuiConfig, AuiProvider, useAui } from "@assistant-ui/store";
|
|
10
|
-
|
|
10
|
+
// The HTTP+SSE client is internal to statewire; the protocol keeps it.
|
|
11
|
+
import { StatewireHttp } from "../../http-client";
|
|
11
12
|
import { asStatewireExtras, StatewireThread } from "./StatewireThread";
|
|
12
13
|
import { useStatewireRuns } from "./hooks";
|
|
13
14
|
import { sendCommand, toThreadMessage } from "./__tests__/testHelpers";
|
|
@@ -11,7 +11,8 @@ import type { ExternalThreadMessage } from "@assistant-ui/core/store";
|
|
|
11
11
|
import { describe, expect, it } from "vitest";
|
|
12
12
|
import { AuiConfig, AuiProvider, useAui } from "@assistant-ui/store";
|
|
13
13
|
import { resource, withKey } from "@assistant-ui/tap";
|
|
14
|
-
|
|
14
|
+
// The HTTP+SSE client is internal to statewire; the protocol keeps it.
|
|
15
|
+
import { StatewireHttp } from "../../http-client";
|
|
15
16
|
import { useStatewireCommands, useStatewireState } from "statewire/host";
|
|
16
17
|
import { asStatewireExtras, StatewireThread } from "./StatewireThread";
|
|
17
18
|
import { runsMaterialize } from "./runsMaterialize";
|
package/src/localStorage.test.ts
CHANGED
|
@@ -243,10 +243,16 @@ describe("LocalStorageSession", () => {
|
|
|
243
243
|
root.unmount();
|
|
244
244
|
});
|
|
245
245
|
|
|
246
|
+
it("reads a truncated session record as absent", () => {
|
|
247
|
+
const root = mountSession({ threadId: "t1", principal: "u1" });
|
|
248
|
+
localStorage.setItem(`${SESSION_PREFIX}t1`, '{"clientId":"c-1","lan');
|
|
249
|
+
expect(root.getValue().load()).toBeNull();
|
|
250
|
+
root.unmount();
|
|
251
|
+
});
|
|
252
|
+
|
|
246
253
|
it("rejects malformed session records without deleting them", () => {
|
|
247
254
|
const root = mountSession({ threadId: "t1", principal: "u1" });
|
|
248
255
|
for (const raw of [
|
|
249
|
-
"{",
|
|
250
256
|
JSON.stringify({
|
|
251
257
|
clientId: "c-1",
|
|
252
258
|
nextSeq: 1,
|