Skip to content

Commit abdddac

Browse files
Add invisible-separator precedence coverage and docs example
Co-authored-by: Eric Allam <eric@trigger.dev>
1 parent 9baa514 commit abdddac

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

docs/tasks/streams.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,7 @@ Examples of ordering:
710710
- `ftp://example.com?x=1``baseURL must use http or https protocol`
711711
- `https://user:pass@example.com?x=1``baseURL must not include query parameters or hash fragments`
712712
- `ftp://user:pass@example.com/in valid?x=1``baseURL must not contain internal whitespace characters`
713+
- `ftp://user:pass@example.com/\u2060invalid?x=1#fragment``baseURL must not contain internal whitespace characters`
713714

714715
For richer TypeScript ergonomics in app code, `@trigger.dev/ai` also exports:
715716

packages/ai/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ Examples of ordering:
217217
- `ftp://example.com?x=1``baseURL must use http or https protocol`
218218
- `https://user:pass@example.com?x=1``baseURL must not include query parameters or hash fragments`
219219
- `ftp://user:pass@example.com/in valid?x=1``baseURL must not contain internal whitespace characters`
220+
- `ftp://user:pass@example.com/\u2060invalid?x=1#fragment``baseURL must not contain internal whitespace characters`
220221

221222
## `ai.tool(...)` example
222223

packages/ai/src/chatTransport.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,17 @@ describe("TriggerChatTransport", function () {
10941094
}).toThrowError("baseURL must not contain internal whitespace characters");
10951095
});
10961096

1097+
it("prioritizes invisible-separator validation over protocol/query/hash/credential validation", function () {
1098+
expect(function () {
1099+
new TriggerChatTransport({
1100+
task: "chat-task",
1101+
accessToken: "pk_trigger",
1102+
baseURL: "ftp://user:pass@example.com/\u2060invalid?query=1#fragment",
1103+
stream: "chat-stream",
1104+
});
1105+
}).toThrowError("baseURL must not contain internal whitespace characters");
1106+
});
1107+
10971108
it("prioritizes query/hash validation over credential validation", function () {
10981109
expect(function () {
10991110
new TriggerChatTransport({
@@ -3899,6 +3910,17 @@ describe("TriggerChatTransport", function () {
38993910
}).toThrowError("baseURL must not contain internal whitespace characters");
39003911
});
39013912

3913+
it("prioritizes invisible-separator validation over protocol/query/hash/credential validation in factory", function () {
3914+
expect(function () {
3915+
createTriggerChatTransport({
3916+
task: "chat-task",
3917+
accessToken: "pk_trigger",
3918+
baseURL: "ftp://user:pass@example.com/\u2060invalid?query=1#fragment",
3919+
stream: "chat-stream",
3920+
});
3921+
}).toThrowError("baseURL must not contain internal whitespace characters");
3922+
});
3923+
39023924
it("prioritizes query/hash validation over credential validation in factory", function () {
39033925
expect(function () {
39043926
createTriggerChatTransport({

0 commit comments

Comments
 (0)