Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/index.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion docs/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/execution/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion src/providers/resolveProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
7 changes: 7 additions & 0 deletions src/utils/errorCodes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
4 changes: 2 additions & 2 deletions src/utils/errorCodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 `#<code in lowercase>`. */
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 `#<code in lowercase>`. */
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 = {
Expand Down
Loading