diff --git a/api/index.api.md b/api/index.api.md index 755040a3..ab516a48 100644 --- a/api/index.api.md +++ b/api/index.api.md @@ -1991,7 +1991,7 @@ export const ERROR_CODES: { }; // @public -export const ERROR_DOCS_URL = "https://github.com/LinuxDevil/agent-sdk/blob/main/docs/errors.md"; +export const ERROR_DOCS_URL = "https://lousho.com/errors"; // @public export const ErrorAttr: { diff --git a/docs/errors.md b/docs/errors.md index 3a8b6286..375db980 100644 --- a/docs/errors.md +++ b/docs/errors.md @@ -18,7 +18,7 @@ error tells you what to do: ```text ConfigurationError: createAgent: no model configured. Do one of the following: (1) pass a model: ... -[LOUSHO_CONFIG_MISSING_PROVIDER] Pass a model string such as createAgent({ model: 'openai/gpt-4.1-mini' }), a provider instance, or set LOUSHO_MODEL or a provider API key. (https://github.com/LinuxDevil/agent-sdk/blob/main/docs/errors.md#lousho_config_missing_provider) +[LOUSHO_CONFIG_MISSING_PROVIDER] Pass a model string such as createAgent({ model: 'openai/gpt-4.1-mini' }), a provider instance, or set LOUSHO_MODEL or a provider API key. (https://lousho.com/errors#lousho_config_missing_provider) ``` A run that rejects (`send()`, `stream()`'s `result`, a session turn, diff --git a/llms-full.txt b/llms-full.txt index 7e134a6d..fac0e9be 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -8209,7 +8209,7 @@ error tells you what to do: ```text ConfigurationError: createAgent: no model configured. Do one of the following: (1) pass a model: ... -[LOUSHO_CONFIG_MISSING_PROVIDER] Pass a model string such as createAgent({ model: 'openai/gpt-4.1-mini' }), a provider instance, or set LOUSHO_MODEL or a provider API key. (https://github.com/LinuxDevil/agent-sdk/blob/main/docs/errors.md#lousho_config_missing_provider) +[LOUSHO_CONFIG_MISSING_PROVIDER] Pass a model string such as createAgent({ model: 'openai/gpt-4.1-mini' }), a provider instance, or set LOUSHO_MODEL or a provider API key. (https://lousho.com/errors#lousho_config_missing_provider) ``` A run that rejects (`send()`, `stream()`'s `result`, a session turn, diff --git a/src/execution/errors.test.ts b/src/execution/errors.test.ts index b7f42c49..d7d7aba4 100644 --- a/src/execution/errors.test.ts +++ b/src/execution/errors.test.ts @@ -37,9 +37,9 @@ describe('Error Classes', () => { const error = new SDKError('Boom', 'LOUSHO_CONFIG_INVALID'); const help = '[LOUSHO_CONFIG_INVALID] Fix the option named in the message. ' + - '(https://github.com/LinuxDevil/agent-sdk/blob/main/docs/errors.md#lousho_config_invalid)'; + '(https://lousho.com/errors#lousho_config_invalid)'; expect(error.hint).toBe('Fix the option named in the message.'); - expect(error.docs).toBe('https://github.com/LinuxDevil/agent-sdk/blob/main/docs/errors.md#lousho_config_invalid'); + expect(error.docs).toBe('https://lousho.com/errors#lousho_config_invalid'); expect(error.message).toBe(`Boom\n${help}`); expect(error.toString()).toBe(`SDKError: Boom\n${help}`); expect(new SDKError('x').code).toBe('LOUSHO_GENERIC_ERROR'); diff --git a/src/providers/resolveProvider.test.ts b/src/providers/resolveProvider.test.ts index c51a49fa..2bff3459 100644 --- a/src/providers/resolveProvider.test.ts +++ b/src/providers/resolveProvider.test.ts @@ -190,7 +190,7 @@ describe('resolveProvider errors', () => { "'pi/xai/grok-4' (through @earendil-works/pi-ai), or createAgent({ provider: fromAiSdk(xai('grok-4')) })" ); // The appended help line links the error code's docs section. - expect(error?.message).toMatch(/\[LOUSHO_PROVIDER_UNKNOWN\].*docs\/errors\.md#lousho_provider_unknown/); + expect(error?.message).toMatch(/\[LOUSHO_PROVIDER_UNKNOWN\].*lousho\.com\/errors#lousho_provider_unknown/); }); it('turns a dashed vendor into a valid AI SDK factory name', () => { diff --git a/src/utils/errorCodes.test.ts b/src/utils/errorCodes.test.ts index 3085c378..ba0be991 100644 --- a/src/utils/errorCodes.test.ts +++ b/src/utils/errorCodes.test.ts @@ -44,6 +44,13 @@ describe('error codes', () => { expect([...headings].sort()).toEqual([...CODES].sort()); }); + it('links to the lousho.com page, whose anchors keep the underscores of the heading', () => { + expect(ERROR_DOCS_URL).toBe('https://lousho.com/errors'); + expect(errorDocsUrl('LOUSHO_REGISTRY_UNREACHABLE')).toBe('https://lousho.com/errors#lousho_registry_unreachable'); + // Mintlify slugifies `## LOUSHO_X` to `lousho_x`, which is the code in lowercase. + for (const code of CODES) expect(DOCS).toContain(`## ${code}`); + }); + it('docs links point at the code section anchors', () => { expect(errorDocsUrl('LOUSHO_PEER_MISSING')).toBe(`${ERROR_DOCS_URL}#lousho_peer_missing`); expect(errorHelp('LOUSHO_PEER_MISSING')).toEqual({ diff --git a/src/utils/errorCodes.ts b/src/utils/errorCodes.ts index c5ccd456..c2acd508 100644 --- a/src/utils/errorCodes.ts +++ b/src/utils/errorCodes.ts @@ -6,8 +6,8 @@ * keeps this table, the codes used in src/ and docs/errors.md in sync. */ -/** Where every code is documented; each code has the anchor `#`. */ -export const ERROR_DOCS_URL = 'https://github.com/LinuxDevil/agent-sdk/blob/main/docs/errors.md'; +/** Where every code is documented; the site serves docs/errors.md as /errors; each code has the anchor `#`. */ +export const ERROR_DOCS_URL = 'https://lousho.com/errors'; /** Every stable error code, mapped to its one-sentence "how to fix" hint. */ export const ERROR_CODES = {