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
9 changes: 9 additions & 0 deletions .changeset/next-bootstrap-literal-env.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@agent-devtools/next': patch
---

fix(next): read the pairing-token env through literal `process.env` so the App Router client bundle inlines it

The bootstrap read the enabled flag, base URL, and pairing token through a dynamic `globalThis.process.env[key]` lookup. Bundlers can only statically replace **literal** `process.env.<KEY>` member expressions, so that indirection was never substituted — and the Next App Router client bundle has no runtime `process` object, so the lookup resolved to `undefined` and the widget silently never mounted (verified against Next 16 + Turbopack: `typeof process === 'undefined'` in the browser).

`readEnv` now reads each value as a literal `process.env.<KEY>` expression (mirroring the `process.env.NODE_ENV` literal the same module already relies on), so Next's `env`-config inlining substitutes the dev values at build time and the widget mounts. The production dev-only guard is unchanged.
37 changes: 37 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"mode": "pre",
"tag": "beta",
"initialVersions": {
"@agent-devtools/docs": "0.0.6",
"@agent-devtools/example-angular-vite": "0.0.0",
"@agent-devtools/example-html": "0.0.0",
"@agent-devtools/example-next": "0.0.0",
"@agent-devtools/example-next-pages": "0.0.0",
"@agent-devtools/example-nuxt": "0.0.0",
"@agent-devtools/example-nuxt2": "0.0.0",
"@agent-devtools/example-react-vite": "0.0.0",
"@agent-devtools/example-svelte-vite": "0.0.0",
"@agent-devtools/example-sveltekit": "0.0.0",
"@agent-devtools/example-vue-vite": "0.0.0",
"@agent-devtools/example-vue2-vite": "0.0.0",
"@agent-devtools/angular": "1.3.0",
"@agent-devtools/core": "1.3.0",
"@agent-devtools/e2e": "0.0.0",
"@agent-devtools/harness-core": "1.3.0",
"@agent-devtools/html": "1.3.0",
"@agent-devtools/next": "1.3.0",
"@agent-devtools/next-pages": "1.3.0",
"@agent-devtools/nuxt": "1.3.0",
"@agent-devtools/nuxt2": "1.3.0",
"@agent-devtools/react": "1.3.0",
"@agent-devtools/svelte": "1.3.0",
"@agent-devtools/sveltekit": "1.3.0",
"@agent-devtools/vite": "1.3.0",
"@agent-devtools/vue": "1.3.0",
"@agent-devtools/vue2": "1.3.0",
"@agent-devtools/widget-core": "1.3.0"
},
"changesets": [
"next-bootstrap-literal-env"
]
}
8 changes: 8 additions & 0 deletions packages/angular/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @agent-devtools/angular

## 1.3.1-beta.0

### Patch Changes

- Updated dependencies []:
- @agent-devtools/core@1.3.1-beta.0
- @agent-devtools/widget-core@1.3.1-beta.0

## 1.3.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agent-devtools/angular",
"version": "1.3.0",
"version": "1.3.1-beta.0",
"description": "Angular adapter for agent-devtools — Ivy component walker + DOM picker + closed Shadow DOM widget",
"keywords": [
"agent-devtools",
Expand Down
2 changes: 2 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

## 1.3.1-beta.0

## 1.3.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agent-devtools/core",
"version": "1.3.0",
"version": "1.3.1-beta.0",
"description": "Framework-agnostic core for agent-devtools — server, agent engine, widget shell",
"keywords": [
"agent-devtools",
Expand Down
2 changes: 2 additions & 0 deletions packages/harness-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Changelog

## 1.3.1-beta.0

## 1.3.0

## 1.3.0-beta.0
Expand Down
2 changes: 1 addition & 1 deletion packages/harness-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agent-devtools/harness-core",
"version": "1.3.0",
"version": "1.3.1-beta.0",
"description": "Generic agent harness — domain-agnostic loop strategies + LLM provider abstraction. Source for both @agent-devtools and external SaaS consumers.",
"license": "MIT",
"type": "module",
Expand Down
8 changes: 8 additions & 0 deletions packages/html/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @agent-devtools/html

## 1.3.1-beta.0

### Patch Changes

- Updated dependencies []:
- @agent-devtools/vite@1.3.1-beta.0
- @agent-devtools/widget-core@1.3.1-beta.0

## 1.3.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/html/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agent-devtools/html",
"version": "1.3.0",
"version": "1.3.1-beta.0",
"description": "npx runner for agent-devtools — serve a plain HTML folder with the dev-only widget injected, no framework, no config",
"keywords": [
"agent-devtools",
Expand Down
8 changes: 8 additions & 0 deletions packages/next-pages/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @agent-devtools/next-pages

## 1.3.1-beta.0

### Patch Changes

- Updated dependencies []:
- @agent-devtools/core@1.3.1-beta.0
- @agent-devtools/react@1.3.1-beta.0

## 1.3.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/next-pages/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agent-devtools/next-pages",
"version": "1.3.0",
"version": "1.3.1-beta.0",
"description": "Next.js Pages Router adapter for agent-devtools — wraps the React widget for legacy pages/_app.tsx hosts",
"keywords": [
"agent-devtools",
Expand Down
14 changes: 14 additions & 0 deletions packages/next/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @agent-devtools/next

## 1.3.1-beta.0

### Patch Changes

- [#16](https://github.com/Seungwoo321/agent-devtools/pull/16) [`007b6c3`](https://github.com/Seungwoo321/agent-devtools/commit/007b6c31b54468d64493da8f3d7f5de73d6aa048) Thanks [@Seungwoo321](https://github.com/Seungwoo321)! - fix(next): read the pairing-token env through literal `process.env` so the App Router client bundle inlines it

The bootstrap read the enabled flag, base URL, and pairing token through a dynamic `globalThis.process.env[key]` lookup. Bundlers can only statically replace **literal** `process.env.<KEY>` member expressions, so that indirection was never substituted — and the Next App Router client bundle has no runtime `process` object, so the lookup resolved to `undefined` and the widget silently never mounted (verified against Next 16 + Turbopack: `typeof process === 'undefined'` in the browser).

`readEnv` now reads each value as a literal `process.env.<KEY>` expression (mirroring the `process.env.NODE_ENV` literal the same module already relies on), so Next's `env`-config inlining substitutes the dev values at build time and the widget mounts. The production dev-only guard is unchanged.

- Updated dependencies []:
- @agent-devtools/core@1.3.1-beta.0
- @agent-devtools/react@1.3.1-beta.0

## 1.3.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agent-devtools/next",
"version": "1.3.0",
"version": "1.3.1-beta.0",
"description": "Next.js 15 adapter for agent-devtools — re-exports the React widget + adds App / Pages router dev-only injection",
"keywords": [
"agent-devtools",
Expand Down
2 changes: 2 additions & 0 deletions packages/next/src/bootstrap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';

const mountSpy = vi.fn();
const transportSpy = vi.fn((args: unknown) => ({ kind: 'transport', args }));
const commandsFetcherSpy = vi.fn((args: unknown) => ({ kind: 'commands', args }));

vi.mock('@agent-devtools/react', () => ({
mountAgentDevtools: (options: unknown) => mountSpy(options),
createDefaultTransport: (args: unknown) => transportSpy(args),
createAgentCommandsFetcher: (args: unknown) => commandsFetcherSpy(args),
}));

describe('bootstrapAgentDevtools', () => {
Expand Down
23 changes: 13 additions & 10 deletions packages/next/src/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,19 @@ export function bootstrapAgentDevtools(options: AgentDevtoolsBootstrapOptions =
}

function readEnv(): { enabled?: string; baseUrl?: string; pairingToken?: string } {
const proc =
typeof globalThis !== 'undefined'
? (globalThis as { process?: { env?: Record<string, string | undefined> } }).process
: undefined;
const env = proc?.env;
if (!env) return {};
// Read each value as a LITERAL `process.env.<KEY>` expression so the bundler
// substitutes it at compile time (Next's `env`-config inlining via webpack
// DefinePlugin / Turbopack). The App Router client bundle has no runtime
// `process` object, so a dynamic `globalThis.process.env[key]` lookup resolves
// to undefined and the widget never mounts — literal member access is the only
// form the bundler can statically replace. (Mirrors the `process.env.NODE_ENV`
// literal already relied on in bootstrapAgentDevtools above.)
const result: { enabled?: string; baseUrl?: string; pairingToken?: string } = {};
if (env.AGENT_DEVTOOLS_NEXT_ENABLED) result.enabled = env.AGENT_DEVTOOLS_NEXT_ENABLED;
if (env.AGENT_DEVTOOLS_NEXT_BASE_URL) result.baseUrl = env.AGENT_DEVTOOLS_NEXT_BASE_URL;
if (env.AGENT_DEVTOOLS_NEXT_PAIRING_TOKEN)
result.pairingToken = env.AGENT_DEVTOOLS_NEXT_PAIRING_TOKEN;
if (process.env.AGENT_DEVTOOLS_NEXT_ENABLED)
result.enabled = process.env.AGENT_DEVTOOLS_NEXT_ENABLED;
if (process.env.AGENT_DEVTOOLS_NEXT_BASE_URL)
result.baseUrl = process.env.AGENT_DEVTOOLS_NEXT_BASE_URL;
if (process.env.AGENT_DEVTOOLS_NEXT_PAIRING_TOKEN)
result.pairingToken = process.env.AGENT_DEVTOOLS_NEXT_PAIRING_TOKEN;
return result;
}
9 changes: 9 additions & 0 deletions packages/nuxt/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @agent-devtools/nuxt

## 1.3.1-beta.0

### Patch Changes

- Updated dependencies []:
- @agent-devtools/core@1.3.1-beta.0
- @agent-devtools/vue@1.3.1-beta.0
- @agent-devtools/widget-core@1.3.1-beta.0

## 1.3.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agent-devtools/nuxt",
"version": "1.3.0",
"version": "1.3.1-beta.0",
"description": "Nuxt 3 module for agent-devtools — re-exports the Vue widget + adds dev-only injection through defineNuxtModule",
"keywords": [
"agent-devtools",
Expand Down
9 changes: 9 additions & 0 deletions packages/nuxt2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @agent-devtools/nuxt2

## 1.3.1-beta.0

### Patch Changes

- Updated dependencies []:
- @agent-devtools/core@1.3.1-beta.0
- @agent-devtools/vue2@1.3.1-beta.0
- @agent-devtools/widget-core@1.3.1-beta.0

## 1.3.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agent-devtools/nuxt2",
"version": "1.3.0",
"version": "1.3.1-beta.0",
"description": "Nuxt 2 module for agent-devtools — re-exports the Vue 2 widget + adds dev-only injection through the Nuxt 2 module API",
"keywords": [
"agent-devtools",
Expand Down
8 changes: 8 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 1.3.1-beta.0

### Patch Changes

- Updated dependencies []:
- @agent-devtools/core@1.3.1-beta.0
- @agent-devtools/widget-core@1.3.1-beta.0

## 1.3.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agent-devtools/react",
"version": "1.3.0",
"version": "1.3.1-beta.0",
"description": "React 19 adapter for agent-devtools — fiber walker + DOM picker + closed Shadow DOM widget",
"keywords": [
"agent-devtools",
Expand Down
8 changes: 8 additions & 0 deletions packages/svelte/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @agent-devtools/svelte

## 1.3.1-beta.0

### Patch Changes

- Updated dependencies []:
- @agent-devtools/core@1.3.1-beta.0
- @agent-devtools/widget-core@1.3.1-beta.0

## 1.3.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agent-devtools/svelte",
"version": "1.3.0",
"version": "1.3.1-beta.0",
"description": "Svelte adapter for agent-devtools — Svelte 4/5 component walker + DOM picker + closed Shadow DOM widget",
"keywords": [
"agent-devtools",
Expand Down
8 changes: 8 additions & 0 deletions packages/sveltekit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @agent-devtools/sveltekit

## 1.3.1-beta.0

### Patch Changes

- Updated dependencies []:
- @agent-devtools/core@1.3.1-beta.0
- @agent-devtools/svelte@1.3.1-beta.0

## 1.3.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/sveltekit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agent-devtools/sveltekit",
"version": "1.3.0",
"version": "1.3.1-beta.0",
"description": "SvelteKit adapter for agent-devtools — dev-only handle hook + Svelte adapter mount",
"keywords": [
"agent-devtools",
Expand Down
8 changes: 8 additions & 0 deletions packages/vite/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @agent-devtools/vite

## 1.3.1-beta.0

### Patch Changes

- Updated dependencies []:
- @agent-devtools/core@1.3.1-beta.0
- @agent-devtools/widget-core@1.3.1-beta.0

## 1.3.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agent-devtools/vite",
"version": "1.3.0",
"version": "1.3.1-beta.0",
"description": "Vite plugin for agent-devtools — auto-spawn agent server + dev-only widget injection (Vite 5+)",
"keywords": [
"agent-devtools",
Expand Down
8 changes: 8 additions & 0 deletions packages/vue/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @agent-devtools/vue

## 1.3.1-beta.0

### Patch Changes

- Updated dependencies []:
- @agent-devtools/core@1.3.1-beta.0
- @agent-devtools/widget-core@1.3.1-beta.0

## 1.3.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agent-devtools/vue",
"version": "1.3.0",
"version": "1.3.1-beta.0",
"description": "Vue 3 adapter for agent-devtools — vnode walker + DOM picker + closed Shadow DOM widget",
"keywords": [
"agent-devtools",
Expand Down
8 changes: 8 additions & 0 deletions packages/vue2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @agent-devtools/vue2

## 1.3.1-beta.0

### Patch Changes

- Updated dependencies []:
- @agent-devtools/core@1.3.1-beta.0
- @agent-devtools/widget-core@1.3.1-beta.0

## 1.3.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/vue2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agent-devtools/vue2",
"version": "1.3.0",
"version": "1.3.1-beta.0",
"description": "Vue 2 adapter for agent-devtools — Vue 2.7 component walker + DOM picker + closed Shadow DOM widget",
"keywords": [
"agent-devtools",
Expand Down
Loading