@stll/chat 0.4.3 → 0.4.6
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/dist/durable-transport.js +4 -1
- package/dist/link.js +17 -7
- package/package.json +5 -5
|
@@ -176,7 +176,10 @@ const createDurableChatTransport = ({ initialMessages, initialTurn, threadId, pr
|
|
|
176
176
|
onReconnectChange(false);
|
|
177
177
|
return response;
|
|
178
178
|
});
|
|
179
|
-
if (Result.isOk(result) && result.value !== void 0)
|
|
179
|
+
if (Result.isOk(result) && result.value !== void 0) {
|
|
180
|
+
reconnectStartedAt = void 0;
|
|
181
|
+
return result.value;
|
|
182
|
+
}
|
|
180
183
|
if (Result.isError(result) && result.error.cause instanceof ChatReconnectError && result.error.cause.code !== void 0) {
|
|
181
184
|
onError(result.error.cause);
|
|
182
185
|
return new Response(null, { status: 502 });
|
package/dist/link.js
CHANGED
|
@@ -4,6 +4,7 @@ import { createContext, isValidElement, use, useId, useState } from "react";
|
|
|
4
4
|
import { GitHubLogoIcon, XLogoIcon } from "@stll/ui/brand-icons";
|
|
5
5
|
import { GlobeIcon } from "@stll/ui/icons";
|
|
6
6
|
import { Tooltip, TooltipPopup, TooltipTrigger } from "@stll/ui/tooltip";
|
|
7
|
+
import { TruncatedText } from "@stll/ui/truncated-text";
|
|
7
8
|
// src/link.tsx
|
|
8
9
|
const CHAT_LINK_ATTRIBUTES = {
|
|
9
10
|
target: "_blank",
|
|
@@ -55,6 +56,13 @@ const linkLabel = (children, hostname, urlLabel) => {
|
|
|
55
56
|
const text = linkText(children).trim();
|
|
56
57
|
return text && (urlLabel === "written" || normalizeChatLink(text) === null) ? children : hostname.replace(/^www\./u, "");
|
|
57
58
|
};
|
|
59
|
+
/** A tray chip cuts its label short; an inline link runs with the prose. A
|
|
60
|
+
* tray chip whose label is the whole point keeps it up to the row's width. */
|
|
61
|
+
const ChatLinkLabel = ({ appearance, children, fullLabel }) => appearance === "tray" ? /* @__PURE__ */ jsx(TruncatedText, {
|
|
62
|
+
className: fullLabel ? void 0 : "max-w-[20ch]",
|
|
63
|
+
render: /* @__PURE__ */ jsx("bdi", {}),
|
|
64
|
+
children
|
|
65
|
+
}) : /* @__PURE__ */ jsx("bdi", { children });
|
|
58
66
|
const ChatLinkIdContext = createContext(void 0);
|
|
59
67
|
/**
|
|
60
68
|
* Gives the link rendered inside it fixed ids, so a surface that renders the
|
|
@@ -90,7 +98,6 @@ const ChatLink = ({ appearance = "inline", children, fullLabel = false, href, ic
|
|
|
90
98
|
const triggerId = id ?? baseId;
|
|
91
99
|
const ownId = hint || id === void 0 ? {} : { id };
|
|
92
100
|
const className = appearance === "tray" ? "bg-muted/50 hover:bg-muted inline-flex max-w-full min-w-0 shrink-0 items-center gap-1 rounded-md border px-1.5 py-0.5 text-xs focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring" : CHAT_LINK_CLASS_NAME;
|
|
93
|
-
const labelClassName = appearance === "tray" ? fullLabel ? "min-w-0 truncate" : "max-w-[20ch] truncate" : void 0;
|
|
94
101
|
const target = normalizeChatLink(href);
|
|
95
102
|
if (!target) {
|
|
96
103
|
const parsed = URL.canParse(href) ? new URL(href) : null;
|
|
@@ -98,8 +105,9 @@ const ChatLink = ({ appearance = "inline", children, fullLabel = false, href, ic
|
|
|
98
105
|
const safeMail = parsed?.protocol === "mailto:";
|
|
99
106
|
if (!safeLocal && !safeMail || /[\p{Cc}\p{Cf}]/u.test(href)) return appearance === "tray" ? /* @__PURE__ */ jsx("span", {
|
|
100
107
|
className,
|
|
101
|
-
children: /* @__PURE__ */ jsx(
|
|
102
|
-
|
|
108
|
+
children: /* @__PURE__ */ jsx(ChatLinkLabel, {
|
|
109
|
+
appearance,
|
|
110
|
+
fullLabel,
|
|
103
111
|
children: children ?? href
|
|
104
112
|
})
|
|
105
113
|
}) : /* @__PURE__ */ jsx("span", { children: children ?? href });
|
|
@@ -115,8 +123,9 @@ const ChatLink = ({ appearance = "inline", children, fullLabel = false, href, ic
|
|
|
115
123
|
href,
|
|
116
124
|
target: CHAT_LINK_ATTRIBUTES.target,
|
|
117
125
|
rel: CHAT_LINK_ATTRIBUTES.rel,
|
|
118
|
-
children: /* @__PURE__ */ jsx(
|
|
119
|
-
|
|
126
|
+
children: /* @__PURE__ */ jsx(ChatLinkLabel, {
|
|
127
|
+
appearance,
|
|
128
|
+
fullLabel,
|
|
120
129
|
children: children ?? href
|
|
121
130
|
})
|
|
122
131
|
})
|
|
@@ -146,8 +155,9 @@ const ChatLink = ({ appearance = "inline", children, fullLabel = false, href, ic
|
|
|
146
155
|
"aria-hidden": "true",
|
|
147
156
|
className: appearance === "tray" ? "flex shrink-0" : "me-1 inline-block align-[-0.125em]",
|
|
148
157
|
children: icon
|
|
149
|
-
}), /* @__PURE__ */ jsx(
|
|
150
|
-
|
|
158
|
+
}), /* @__PURE__ */ jsx(ChatLinkLabel, {
|
|
159
|
+
appearance,
|
|
160
|
+
fullLabel,
|
|
151
161
|
children: label
|
|
152
162
|
})]
|
|
153
163
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stll/chat",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Typed React chat composer, message stream, model selector, and transport runtime primitives.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -83,16 +83,16 @@
|
|
|
83
83
|
"pack:dry-run": "bun pm pack --dry-run",
|
|
84
84
|
"test": "bun test src",
|
|
85
85
|
"typecheck": "bun check --no-pretty --all --project=tsconfig.json",
|
|
86
|
-
"lint": "cd ../.. && bun
|
|
87
|
-
"lint:fix": "cd ../.. && bun
|
|
86
|
+
"lint": "cd ../.. && bun scripts/lint.ts packages/chat",
|
|
87
|
+
"lint:fix": "cd ../.. && bun scripts/lint.ts --fix packages/chat",
|
|
88
88
|
"prepack": "bun run build",
|
|
89
89
|
"test:property": "bun test --preload @stll/property-testing/preload $(grep -rlE 'fc\\.assert|assertProperty' src --include='*.test.ts')"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
92
|
"@ag-ui/core": "1.0.3",
|
|
93
|
-
"@stll/ai-catalog": "^0.
|
|
93
|
+
"@stll/ai-catalog": "^0.12.0",
|
|
94
94
|
"@stll/html": "0.1.1",
|
|
95
|
-
"@stll/ui": "^0.
|
|
95
|
+
"@stll/ui": "^0.71.0",
|
|
96
96
|
"@tanstack/ai-client": "0.38.0",
|
|
97
97
|
"@types/hast": "^3.0.5",
|
|
98
98
|
"better-result": "3.0.1",
|