ec27228a8e
Em dashes (—) and en dashes (–) had spread across comments, docs, tests, and a few UI strings, reading as AI-generated boilerplate rather than house style. Replaced each with punctuation matching its context: colon for explanatory clauses, comma for asides, plain hyphen for numeric/legal ranges (e.g. "21-23§"), "to"/"till" for date ranges, parentheses for paired-dash asides. messages/en.json and messages/sv.json were fixed by hand together to keep sv/en in sync. Left untouched where the dash is the functional subject rather than decorative punctuation: date-range-parser.ts's separator regex, charset-repair.ts's CP1252 byte-mapping table (and its test), the SIE encoding mojibake docs, generic-csv.ts's minus-sign normalizer, the agent system-prompt files that already instruct against em dashes, and a golden iXBRL test fixture compared byte-for-byte. Also fixes two bugs surfaced along the way: an off-by-one in ApiKeysPanel's scope-label split (a leftover from an earlier partial pass), and a charset-repair test that had lost the literal en-dash it exists to verify. Regenerated the agent atom seed migration (skills:generate) since 27 SKILL.md files changed. Added a CLAUDE.md rule against em/en dashes, with an explicit carve-out for the functional-dash cases above. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
#!/usr/bin/env npx tsx
|
|
/**
|
|
* Smoke test: send a 1-token request to Bedrock with both the Opus and
|
|
* Sonnet model ids the agent uses. Confirms AWS creds + region work and
|
|
* the models are enabled on the account before we exercise the full chat
|
|
* loop with real user data.
|
|
*
|
|
* Usage: npx tsx scripts/smoke-bedrock.ts
|
|
*/
|
|
|
|
import { config } from 'dotenv'
|
|
config({ path: '.env.local' })
|
|
|
|
import { getAnthropic, OPUS_MODEL, SONNET_MODEL } from '../lib/agent/composer/client'
|
|
|
|
async function ping(model: string): Promise<void> {
|
|
const client = getAnthropic()
|
|
const start = Date.now()
|
|
try {
|
|
const resp = await client.messages.create({
|
|
model,
|
|
max_tokens: 10,
|
|
messages: [{ role: 'user', content: 'Säg "hej" på svenska.' }],
|
|
})
|
|
const text = resp.content
|
|
.filter((b) => b.type === 'text')
|
|
.map((b) => (b as { type: 'text'; text: string }).text)
|
|
.join('')
|
|
console.log(` ✓ ${model}: ${Date.now() - start}ms: "${text.trim()}"`)
|
|
} catch (err) {
|
|
const message = err instanceof Error ? err.message : String(err)
|
|
console.error(` ✗ ${model}: ${message}`)
|
|
process.exitCode = 1
|
|
}
|
|
}
|
|
|
|
async function main() {
|
|
console.log(`Region: ${process.env.AWS_REGION || 'eu-north-1'}`)
|
|
console.log('Pinging Bedrock for both agent models…\n')
|
|
await ping(SONNET_MODEL)
|
|
await ping(OPUS_MODEL)
|
|
}
|
|
|
|
main().catch((err) => {
|
|
console.error(err)
|
|
process.exit(1)
|
|
})
|