Add invisible-separator precedence coverage and docs example

Co-authored-by: Eric Allam <eric@trigger.dev>
This commit is contained in:
Cursor Agent
2026-02-15 06:21:59 +00:00
parent 9baa514e09
commit abdddacbe8
3 changed files with 24 additions and 0 deletions
+1
View File
@@ -710,6 +710,7 @@ Examples of ordering:
- `ftp://example.com?x=1` → `baseURL must use http or https protocol`
- `https://user:pass@example.com?x=1` → `baseURL must not include query parameters or hash fragments`
- `ftp://user:pass@example.com/in valid?x=1` → `baseURL must not contain internal whitespace characters`
- `ftp://user:pass@example.com/\u2060invalid?x=1#fragment` → `baseURL must not contain internal whitespace characters`
For richer TypeScript ergonomics in app code, `@trigger.dev/ai` also exports:
+1
View File
@@ -217,6 +217,7 @@ Examples of ordering:
- `ftp://example.com?x=1``baseURL must use http or https protocol`
- `https://user:pass@example.com?x=1``baseURL must not include query parameters or hash fragments`
- `ftp://user:pass@example.com/in valid?x=1``baseURL must not contain internal whitespace characters`
- `ftp://user:pass@example.com/\u2060invalid?x=1#fragment``baseURL must not contain internal whitespace characters`
## `ai.tool(...)` example
+22
View File
@@ -1094,6 +1094,17 @@ describe("TriggerChatTransport", function () {
}).toThrowError("baseURL must not contain internal whitespace characters");
});
it("prioritizes invisible-separator validation over protocol/query/hash/credential validation", function () {
expect(function () {
new TriggerChatTransport({
task: "chat-task",
accessToken: "pk_trigger",
baseURL: "ftp://user:pass@example.com/\u2060invalid?query=1#fragment",
stream: "chat-stream",
});
}).toThrowError("baseURL must not contain internal whitespace characters");
});
it("prioritizes query/hash validation over credential validation", function () {
expect(function () {
new TriggerChatTransport({
@@ -3899,6 +3910,17 @@ describe("TriggerChatTransport", function () {
}).toThrowError("baseURL must not contain internal whitespace characters");
});
it("prioritizes invisible-separator validation over protocol/query/hash/credential validation in factory", function () {
expect(function () {
createTriggerChatTransport({
task: "chat-task",
accessToken: "pk_trigger",
baseURL: "ftp://user:pass@example.com/\u2060invalid?query=1#fragment",
stream: "chat-stream",
});
}).toThrowError("baseURL must not contain internal whitespace characters");
});
it("prioritizes query/hash validation over credential validation in factory", function () {
expect(function () {
createTriggerChatTransport({