From abdddacbe84e11cf686d2fd67630ff21462fb647 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 15 Feb 2026 06:21:59 +0000 Subject: [PATCH] Add invisible-separator precedence coverage and docs example Co-authored-by: Eric Allam --- docs/tasks/streams.mdx | 1 + packages/ai/README.md | 1 + packages/ai/src/chatTransport.test.ts | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/docs/tasks/streams.mdx b/docs/tasks/streams.mdx index 5b6f83012..63dfaf7af 100644 --- a/docs/tasks/streams.mdx +++ b/docs/tasks/streams.mdx @@ -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: diff --git a/packages/ai/README.md b/packages/ai/README.md index 6d715546c..9f3374fd0 100644 --- a/packages/ai/README.md +++ b/packages/ai/README.md @@ -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 diff --git a/packages/ai/src/chatTransport.test.ts b/packages/ai/src/chatTransport.test.ts index e2e660b17..5c99471f4 100644 --- a/packages/ai/src/chatTransport.test.ts +++ b/packages/ai/src/chatTransport.test.ts @@ -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({