From a3dbae6e3ccc1b0fb839472e36768ebd0fb43ca6 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 15 Feb 2026 07:17:23 +0000 Subject: [PATCH] Cover thin-space baseURL wrapper and internal validation Co-authored-by: Eric Allam --- docs/tasks/streams.mdx | 2 ++ packages/ai/README.md | 2 ++ packages/ai/src/chatTransport.test.ts | 44 +++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/docs/tasks/streams.mdx b/docs/tasks/streams.mdx index 1bbdc15c9..72fb57f32 100644 --- a/docs/tasks/streams.mdx +++ b/docs/tasks/streams.mdx @@ -673,6 +673,7 @@ Examples: - ✅ `\u1680https://api.trigger.dev/custom-prefix/\u1680` (ogham-space-mark wrapper trimmed) - ✅ `\u2007https://api.trigger.dev/custom-prefix/\u2007` (figure-space wrapper trimmed) - ✅ `\u200Ahttps://api.trigger.dev/custom-prefix/\u200A` (hair-space wrapper trimmed) +- ✅ `\u2009https://api.trigger.dev/custom-prefix/\u2009` (thin-space wrapper trimmed) - ✅ `\u205Fhttps://api.trigger.dev/custom-prefix/\u205F` (medium-mathematical-space wrapper trimmed) - ✅ `\u3000https://api.trigger.dev/custom-prefix/\u3000` (ideographic-space wrapper trimmed) - ✅ `\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed) @@ -707,6 +708,7 @@ Examples: - ❌ `https://api.trigger.dev/\u1680internal` - ❌ `https://api.trigger.dev/\u2007internal` - ❌ `https://api.trigger.dev/\u200Ainternal` +- ❌ `https://api.trigger.dev/\u2009internal` - ❌ `https://api.trigger.dev/\u202Finternal` - ❌ `https://api.trigger.dev/\u205Finternal` - ❌ `https://api.trigger.dev/\u180Einternal` diff --git a/packages/ai/README.md b/packages/ai/README.md index ceb22329a..09c72eda7 100644 --- a/packages/ai/README.md +++ b/packages/ai/README.md @@ -180,6 +180,7 @@ Examples: - ✅ `\u1680https://api.trigger.dev/custom-prefix/\u1680` (ogham-space-mark wrapper trimmed) - ✅ `\u2007https://api.trigger.dev/custom-prefix/\u2007` (figure-space wrapper trimmed) - ✅ `\u200Ahttps://api.trigger.dev/custom-prefix/\u200A` (hair-space wrapper trimmed) +- ✅ `\u2009https://api.trigger.dev/custom-prefix/\u2009` (thin-space wrapper trimmed) - ✅ `\u205Fhttps://api.trigger.dev/custom-prefix/\u205F` (medium-mathematical-space wrapper trimmed) - ✅ `\u3000https://api.trigger.dev/custom-prefix/\u3000` (ideographic-space wrapper trimmed) - ✅ `\uFEFFhttps://api.trigger.dev/custom-prefix/\uFEFF` (BOM wrapper trimmed) @@ -214,6 +215,7 @@ Examples: - ❌ `https://api.trigger.dev/\u1680internal` (internal ogham-space-mark characters) - ❌ `https://api.trigger.dev/\u2007internal` (internal figure-space characters) - ❌ `https://api.trigger.dev/\u200Ainternal` (internal hair-space characters) +- ❌ `https://api.trigger.dev/\u2009internal` (internal thin-space characters) - ❌ `https://api.trigger.dev/\u202Finternal` (internal narrow no-break space characters) - ❌ `https://api.trigger.dev/\u205Finternal` (internal medium-mathematical-space characters) - ❌ `https://api.trigger.dev/\u180Einternal` (internal mongolian-vowel-separator characters) diff --git a/packages/ai/src/chatTransport.test.ts b/packages/ai/src/chatTransport.test.ts index d20d0a682..725673a7c 100644 --- a/packages/ai/src/chatTransport.test.ts +++ b/packages/ai/src/chatTransport.test.ts @@ -972,6 +972,17 @@ describe("TriggerChatTransport", function () { }).toThrowError("baseURL must not contain internal whitespace characters"); }); + it("throws when baseURL contains internal thin-space characters", function () { + expect(function () { + new TriggerChatTransport({ + task: "chat-task", + accessToken: "pk_trigger", + baseURL: "https://api.trigger.dev/\u2009internal", + stream: "chat-stream", + }); + }).toThrowError("baseURL must not contain internal whitespace characters"); + }); + it("throws when baseURL contains internal mongolian-vowel-separator characters", function () { expect(function () { new TriggerChatTransport({ @@ -1500,6 +1511,17 @@ describe("TriggerChatTransport", function () { }).not.toThrow(); }); + it("accepts thin-space wrapped baseURL values", function () { + expect(function () { + new TriggerChatTransport({ + task: "chat-task", + accessToken: "pk_trigger", + baseURL: "\u2009https://api.trigger.dev/custom-prefix/\u2009", + stream: "chat-stream", + }); + }).not.toThrow(); + }); + it("accepts ideographic-space wrapped baseURL values", function () { expect(function () { new TriggerChatTransport({ @@ -4131,6 +4153,17 @@ describe("TriggerChatTransport", function () { }).toThrowError("baseURL must not contain internal whitespace characters"); }); + it("throws from factory when baseURL contains internal thin-space characters", function () { + expect(function () { + createTriggerChatTransport({ + task: "chat-task", + accessToken: "pk_trigger", + baseURL: "https://api.trigger.dev/\u2009internal", + stream: "chat-stream", + }); + }).toThrowError("baseURL must not contain internal whitespace characters"); + }); + it("throws from factory when baseURL contains internal mongolian-vowel-separator characters", function () { expect(function () { createTriggerChatTransport({ @@ -4648,6 +4681,17 @@ describe("TriggerChatTransport", function () { }).not.toThrow(); }); + it("accepts thin-space wrapped baseURL values from factory", function () { + expect(function () { + createTriggerChatTransport({ + task: "chat-task", + accessToken: "pk_trigger", + baseURL: "\u2009https://api.trigger.dev/custom-prefix/\u2009", + stream: "chat-stream", + }); + }).not.toThrow(); + }); + it("accepts ideographic-space wrapped baseURL values from factory", function () { expect(function () { createTriggerChatTransport({