assistant-ui 0.0.127 → 0.0.128
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/lib/cloud-remote.js +1 -1
- package/dist/lib/cloud-url.d.ts.map +1 -1
- package/dist/lib/cloud-url.js +2 -5
- package/dist/lib/cloud-url.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/cloud-auth.test.ts +7 -0
- package/src/lib/cloud-url.ts +6 -4
- package/templates/cloud-harness/components/assistant-ui/elements/tool-fallback.aui.tsx +7 -1
- package/templates/cloud-harness/package.json +1 -1
package/dist/lib/cloud-remote.js
CHANGED
|
@@ -13,7 +13,7 @@ const parseCloudCliResponse = (value) => {
|
|
|
13
13
|
if (actions !== void 0 && !(Array.isArray(actions) && actions.every((action) => !!action && typeof action === "object" && typeof action.type === "string"))) return null;
|
|
14
14
|
return body;
|
|
15
15
|
};
|
|
16
|
-
const cliVersion = "0.0.
|
|
16
|
+
const cliVersion = "0.0.128";
|
|
17
17
|
const sendCloudCommand = async (cloudUrl, args, accessToken, defaults) => {
|
|
18
18
|
const url = `${validateCloudUrl(cloudUrl)}${CLOUD_CLI_RUN_PATH}`;
|
|
19
19
|
let response;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-url.d.ts","sourceRoot":"","sources":["../../src/lib/cloud-url.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cloud-url.d.ts","sourceRoot":"","sources":["../../src/lib/cloud-url.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,KAAG,MAehD,CAAC"}
|
package/dist/lib/cloud-url.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
// src/lib/cloud-url.ts
|
|
2
|
+
const isLoopbackHostname = (hostname) => hostname === "localhost" || hostname === "[::1]" || /^127(?:\.\d{1,3}){3}$/.test(hostname);
|
|
2
3
|
const validateCloudUrl = (value) => {
|
|
3
4
|
const url = new URL(value);
|
|
4
|
-
if (url.username || url.password || url.search || url.hash || url.protocol !== "https:" && !(url.protocol === "http:" &&
|
|
5
|
-
"localhost",
|
|
6
|
-
"127.0.0.1",
|
|
7
|
-
"[::1]"
|
|
8
|
-
].includes(url.hostname))) throw new Error("Cloud, accounts and setup URLs must use HTTPS or HTTP localhost for development.");
|
|
5
|
+
if (url.username || url.password || url.search || url.hash || url.protocol !== "https:" && !(url.protocol === "http:" && isLoopbackHostname(url.hostname))) throw new Error("Cloud, accounts and setup URLs must use HTTPS or HTTP localhost for development.");
|
|
9
6
|
return value.replace(/\/+$/, "");
|
|
10
7
|
};
|
|
11
8
|
export { validateCloudUrl };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-url.js","names":[],"sources":["../../src/lib/cloud-url.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"cloud-url.js","names":[],"sources":["../../src/lib/cloud-url.ts"],"sourcesContent":["const isLoopbackHostname = (hostname: string): boolean =>\n hostname === \"localhost\" ||\n hostname === \"[::1]\" ||\n /^127(?:\\.\\d{1,3}){3}$/.test(hostname);\n\nexport const validateCloudUrl = (value: string): string => {\n const url = new URL(value);\n if (\n url.username ||\n url.password ||\n url.search ||\n url.hash ||\n (url.protocol !== \"https:\" &&\n !(url.protocol === \"http:\" && isLoopbackHostname(url.hostname)))\n ) {\n throw new Error(\n \"Cloud, accounts and setup URLs must use HTTPS or HTTP localhost for development.\",\n );\n }\n return value.replace(/\\/+$/, \"\");\n};\n"],"mappings":";AAAA,MAAM,sBAAsB,aAC1B,aAAa,eACb,aAAa,WACb,wBAAwB,KAAK,QAAQ;AAEvC,MAAa,oBAAoB,UAA0B;CACzD,MAAM,MAAM,IAAI,IAAI,KAAK;CACzB,IACE,IAAI,YACJ,IAAI,YACJ,IAAI,UACJ,IAAI,QACH,IAAI,aAAa,YAChB,EAAE,IAAI,aAAa,WAAW,mBAAmB,IAAI,QAAQ,IAE/D,MAAM,IAAI,MACR,kFACF;CAEF,OAAO,MAAM,QAAQ,QAAQ,EAAE;AACjC"}
|
package/package.json
CHANGED
|
@@ -108,7 +108,14 @@ describe("cloud login", () => {
|
|
|
108
108
|
expect(validateCloudUrl("http://localhost:3000")).toBe(
|
|
109
109
|
"http://localhost:3000",
|
|
110
110
|
);
|
|
111
|
+
expect(validateCloudUrl("http://127.1.2.3:3000")).toBe(
|
|
112
|
+
"http://127.1.2.3:3000",
|
|
113
|
+
);
|
|
114
|
+
expect(validateCloudUrl("http://[::1]:3000")).toBe("http://[::1]:3000");
|
|
111
115
|
expect(() => validateCloudUrl("http://cloud.example.com")).toThrow("HTTPS");
|
|
116
|
+
expect(() => validateCloudUrl("http://dev.localhost:3000")).toThrow();
|
|
117
|
+
expect(() => validateCloudUrl("http://localhost.:3000")).toThrow();
|
|
118
|
+
expect(() => validateCloudUrl("http://127.1.2.3.example.com")).toThrow();
|
|
112
119
|
expect(() =>
|
|
113
120
|
validateCloudUrl("https://cloud.example.com?key=secret"),
|
|
114
121
|
).toThrow();
|
package/src/lib/cloud-url.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
const isLoopbackHostname = (hostname: string): boolean =>
|
|
2
|
+
hostname === "localhost" ||
|
|
3
|
+
hostname === "[::1]" ||
|
|
4
|
+
/^127(?:\.\d{1,3}){3}$/.test(hostname);
|
|
5
|
+
|
|
1
6
|
export const validateCloudUrl = (value: string): string => {
|
|
2
7
|
const url = new URL(value);
|
|
3
8
|
if (
|
|
@@ -6,10 +11,7 @@ export const validateCloudUrl = (value: string): string => {
|
|
|
6
11
|
url.search ||
|
|
7
12
|
url.hash ||
|
|
8
13
|
(url.protocol !== "https:" &&
|
|
9
|
-
!(
|
|
10
|
-
url.protocol === "http:" &&
|
|
11
|
-
["localhost", "127.0.0.1", "[::1]"].includes(url.hostname)
|
|
12
|
-
))
|
|
14
|
+
!(url.protocol === "http:" && isLoopbackHostname(url.hostname)))
|
|
13
15
|
) {
|
|
14
16
|
throw new Error(
|
|
15
17
|
"Cloud, accounts and setup URLs must use HTTPS or HTTP localhost for development.",
|
|
@@ -141,15 +141,19 @@ function ToolFallbackDuration({
|
|
|
141
141
|
function ToolFallbackTrigger({
|
|
142
142
|
toolName,
|
|
143
143
|
status,
|
|
144
|
+
isError,
|
|
144
145
|
responseDeliveryStatus,
|
|
145
146
|
className,
|
|
146
147
|
...props
|
|
147
148
|
}: React.ComponentProps<typeof CollapsibleTrigger> & {
|
|
148
149
|
toolName: string;
|
|
149
150
|
status?: ToolCallMessagePartStatus;
|
|
151
|
+
isError?: ToolCallMessagePart["isError"];
|
|
150
152
|
responseDeliveryStatus?: ToolCallMessagePart["responseDeliveryStatus"];
|
|
151
153
|
}) {
|
|
152
|
-
const
|
|
154
|
+
const reportedType = status?.type ?? "complete";
|
|
155
|
+
const statusType =
|
|
156
|
+
reportedType === "complete" && isError ? "incomplete" : reportedType;
|
|
153
157
|
const isRunning = statusType === "running";
|
|
154
158
|
const isCancelled =
|
|
155
159
|
status?.type === "incomplete" && status.reason === "cancelled";
|
|
@@ -1198,6 +1202,7 @@ const ToolFallbackImpl: ToolCallMessagePartComponent = ({
|
|
|
1198
1202
|
toolName,
|
|
1199
1203
|
argsText,
|
|
1200
1204
|
result,
|
|
1205
|
+
isError,
|
|
1201
1206
|
status,
|
|
1202
1207
|
responseDeliveryStatus,
|
|
1203
1208
|
addResult,
|
|
@@ -1251,6 +1256,7 @@ const ToolFallbackImpl: ToolCallMessagePartComponent = ({
|
|
|
1251
1256
|
<ToolFallbackTrigger
|
|
1252
1257
|
toolName={toolName}
|
|
1253
1258
|
status={status}
|
|
1259
|
+
isError={isError}
|
|
1254
1260
|
responseDeliveryStatus={responseDeliveryStatus}
|
|
1255
1261
|
/>
|
|
1256
1262
|
<ToolFallbackContent>
|