From 2bb7ab660811fa270ac200468fcef8d2a4e97f77 Mon Sep 17 00:00:00 2001 From: Geoffroy Lesage Date: Fri, 10 Jul 2026 10:25:10 +1000 Subject: [PATCH 1/2] Update publish-npm.yml --- .github/workflows/publish-npm.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index fc35728..a3e940b 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -39,6 +39,5 @@ jobs: - name: Install dependencies and publish if: steps.version_check.outputs.changed == 'true' run: | - npm install -g npm@latest bun install --frozen-lockfile npm publish --provenance --access public From d808241d69e669b72e9a3691fd3fe9b191f505ad Mon Sep 17 00:00:00 2001 From: Geoffroy Lesage Date: Fri, 10 Jul 2026 11:25:24 +1000 Subject: [PATCH 2/2] ci: add PR checks workflow (lint, format, build, example, tests) --- .github/workflows/pr-checks.yml | 39 +++++++++++++++++++ .../src/lib/components/PromptModal.svelte | 6 +-- package.json | 1 + src/llm-clients/bedrock-client.ts | 12 ++++-- src/llm-clients/openrouter-client.ts | 10 +++-- src/runtime/config.ts | 10 ++++- src/validation/validators.ts | 4 +- tsconfig.json | 4 +- 8 files changed, 70 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/pr-checks.yml diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml new file mode 100644 index 0000000..bee7de7 --- /dev/null +++ b/.github/workflows/pr-checks.yml @@ -0,0 +1,39 @@ +name: PR checks + +on: + pull_request: + +permissions: + contents: read + +jobs: + verify: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Lint + run: bun run lint + + - name: Format check + run: bun run format:check + + - name: Build + run: bun run build + + - name: Build example + working-directory: example + run: | + bun install --frozen-lockfile + bun test . + + - name: Test + run: bun run test diff --git a/dashboard/src/lib/components/PromptModal.svelte b/dashboard/src/lib/components/PromptModal.svelte index 4b509d8..73687e1 100644 --- a/dashboard/src/lib/components/PromptModal.svelte +++ b/dashboard/src/lib/components/PromptModal.svelte @@ -186,8 +186,7 @@ class="tall" bind:value={content} placeholder="Enter your system prompt here..." - required - > + required>
@@ -217,8 +216,7 @@ class="medium" bind:value={evaluationCriteria} placeholder="Describe how to evaluate the quality of AI outputs. The judge will return a score (0-1) and a reason." - required - > + required> Issues found will be used for scoring.
{/if} diff --git a/package.json b/package.json index 70397c5..7916f45 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "dev:backend": "bun --watch src/server.ts", "dev:dashboard": "cd dashboard && bun run dev", "format": "bun run prettier --write \"src/**/*.ts\" \"dashboard/src/**/*.{svelte,ts}\" \"*.json\"", + "format:check": "bun run prettier --check \"src/**/*.ts\" \"dashboard/src/**/*.{svelte,ts}\" \"*.json\"", "lint": "eslint src/**/*.ts", "lint:fix": "eslint src/**/*.ts --fix", "test": "NODE_ENV=test bun test src", diff --git a/src/llm-clients/bedrock-client.ts b/src/llm-clients/bedrock-client.ts index f5a8b0a..deff576 100644 --- a/src/llm-clients/bedrock-client.ts +++ b/src/llm-clients/bedrock-client.ts @@ -192,19 +192,25 @@ export class BedrockClient implements LLMClient { const errorMessage = error instanceof Error ? error.message : String(error); if (errorMessage.includes("ValidationException")) { - throw new Error( + const wrapped = new Error( `Model ${modelId} may not support the Converse API: ${errorMessage}` ); + wrapped.cause = error; + throw wrapped; } if (errorMessage.includes("AccessDeniedException")) { - throw new Error( + const wrapped = new Error( `Access denied for model ${modelId}. Ensure model access is enabled in AWS Bedrock console.` ); + wrapped.cause = error; + throw wrapped; } if (errorMessage.includes("ResourceNotFoundException")) { - throw new Error( + const wrapped = new Error( `Model ${modelId} not found. It may not be available in your region.` ); + wrapped.cause = error; + throw wrapped; } throw error; diff --git a/src/llm-clients/openrouter-client.ts b/src/llm-clients/openrouter-client.ts index e18e6d8..fede6d5 100644 --- a/src/llm-clients/openrouter-client.ts +++ b/src/llm-clients/openrouter-client.ts @@ -89,10 +89,12 @@ export class OpenRouterClient implements LLMClient { } const response = await client.chat.send({ - model: modelId, - messages, - temperature, - maxCompletionTokens: 4096, + chatRequest: { + model: modelId, + messages, + temperature, + maxCompletionTokens: 4096, + }, }); const content = response.choices[0]?.message?.content; diff --git a/src/runtime/config.ts b/src/runtime/config.ts index 41e8968..a139605 100644 --- a/src/runtime/config.ts +++ b/src/runtime/config.ts @@ -64,7 +64,11 @@ export function getCredentialsFromJsonEnv(): ProviderCredentials { parsed = JSON.parse(normalizedRaw) as Record; } catch (e) { const message = e instanceof Error ? e.message : String(e); - throw new Error(`Invalid ${RELIA_PROMPT_LLM_CONFIG_JSON}: not valid JSON. ${message}`); + const wrapped = new Error( + `Invalid ${RELIA_PROMPT_LLM_CONFIG_JSON}: not valid JSON. ${message}` + ); + wrapped.cause = e; + throw wrapped; } if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) { @@ -102,9 +106,11 @@ export function getCredentialsFromJsonEnv(): ProviderCredentials { if (str) (out as Record)[canonicalKey as LLMConfigKey] = str; } catch (e) { const message = e instanceof Error ? e.message : String(e); - throw new Error( + const wrapped = new Error( `Invalid ${RELIA_PROMPT_LLM_CONFIG_JSON}: "${providerId}.${jsonKey}" - ${message}` ); + wrapped.cause = e; + throw wrapped; } } } diff --git a/src/validation/validators.ts b/src/validation/validators.ts index 699c935..7f4d5fa 100644 --- a/src/validation/validators.ts +++ b/src/validation/validators.ts @@ -119,7 +119,9 @@ export function validateLibraryRunBody(data: unknown): LibraryRunBody { return parseModelSelection(item); } catch (err) { const msg = err instanceof Error ? err.message : String(err); - throw new Error(`testModels[${index}]: ${msg}`); + const wrapped = new Error(`testModels[${index}]: ${msg}`); + wrapped.cause = err; + throw wrapped; } }); diff --git a/tsconfig.json b/tsconfig.json index f1df569..ce6afb8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { - "target": "ES2020", + "target": "ES2022", "module": "commonjs", - "lib": ["ES2020"], + "lib": ["ES2022"], "outDir": "./dist", "rootDir": "./src", "strict": true,