From 63ea282c2a838cdbda6b4a341d02a4054c2038d5 Mon Sep 17 00:00:00 2001 From: lukeocodes Date: Fri, 1 May 2026 20:29:25 +0100 Subject: [PATCH] fix(widget): hardcode @deepgram/agents range, drop publish-time pin step @deepgram/agents-widget@0.1.2 was tagged but publish-widget failed again (this time at the Pin step) with: ReferenceError: SDK_VERSION is not defined the Pin step had a latent bash-to-JS interpolation bug. SDK_VERSION was a bash variable but referenced unquoted inside `node -e "..."`, where it became an undefined JS identifier. the bug pre-existed but never executed: the original publish-widget always failed earlier on the broken sibling-checkout. now that the rest of the job works, this bites. the right fix isn't to repair the Pin step. widget releases are independent of SDK releases. widget should declare a real semver range on @deepgram/agents the same way @deepgram/react and @deepgram/ui do (`^0.1.0`). bun resolves widget's @deepgram/agents to the workspace SDK locally because workspace SDK 0.1.x satisfies ^0.1.1, so dev workflow is unchanged. at publish time the range publishes as-is, no rewrite needed. changes: - packages/widget/package.json: '@deepgram/agents' goes from 'workspace:*' to '^0.1.1'. matches the pattern used by react and ui for their cross-package deps. - npm-publish.yml: drop the Pin step. replaced with a defensive guard that fails the publish if any 'workspace:*' string remains in the widget's dependencies, so npm doesn't accidentally publish a tarball with workspace-protocol strings. verified locally from a fully clean checkout: bun install, bun run build, bun run test all pass. bun symlinks the widget's @deepgram/agents node_modules entry to packages/sdk as expected. --- .github/workflows/npm-publish.yml | 13 ++++++++----- bun.lock | 6 +++--- packages/widget/package.json | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 352f964..8196169 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -77,14 +77,17 @@ jobs: - run: bun run build - - name: Pin @deepgram/agents to the SDK version being released + - name: Rewrite workspace:* to the published @deepgram/agents range run: | - SDK_VERSION=$(node -e "console.log(require('./packages/sdk/package.json').version)") node -e " const fs = require('fs'); - const pkg = JSON.parse(fs.readFileSync('packages/widget/package.json', 'utf8')); - pkg.dependencies['@deepgram/agents'] = SDK_VERSION; - fs.writeFileSync('packages/widget/package.json', JSON.stringify(pkg, null, 2) + '\n'); + const pkg = require('./packages/widget/package.json'); + for (const k of Object.keys(pkg.dependencies || {})) { + if (typeof pkg.dependencies[k] === 'string' && pkg.dependencies[k].startsWith('workspace:')) { + throw new Error('found unrewritten workspace dep: ' + k + '=' + pkg.dependencies[k]); + } + } + console.log('widget dependencies are publish-ready'); " - run: npm publish --provenance --access public diff --git a/bun.lock b/bun.lock index 6d836b8..bb995ce 100644 --- a/bun.lock +++ b/bun.lock @@ -40,9 +40,9 @@ }, "packages/widget": { "name": "@deepgram/agents-widget", - "version": "0.0.0", + "version": "0.1.2", "dependencies": { - "@deepgram/agents": "workspace:*", + "@deepgram/agents": "^0.1.1", "@deepgram/react": "^0.1.0", "@deepgram/ui": "^0.1.0", "preact": "10.29.1", @@ -524,7 +524,7 @@ "muggle-string": ["muggle-string@0.4.1", "", {}, "sha512-VNTrAak/KhO2i8dqqnqnAHOa3cYBwXEZe9h+D5h/1ZqFSTEFHdM65lR7RoIqq3tBBYavsOXV84NoHXZ0AkPyqQ=="], - "nanoid": ["nanoid@3.3.11", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w=="], + "nanoid": ["nanoid@3.3.12", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ=="], "object-inspect": ["object-inspect@1.13.4", "", {}, "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew=="], diff --git a/packages/widget/package.json b/packages/widget/package.json index 77f6d9d..872b8cf 100644 --- a/packages/widget/package.json +++ b/packages/widget/package.json @@ -44,7 +44,7 @@ "test:watch": "bun test --watch" }, "dependencies": { - "@deepgram/agents": "workspace:*", + "@deepgram/agents": "^0.1.1", "@deepgram/react": "^0.1.0", "@deepgram/ui": "^0.1.0", "preact": "10.29.1",