mirror of
https://github.com/Kong/insomnia.git
synced 2026-08-01 02:07:12 -04:00
fix-button-alignment
5 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b09cde814d |
refactor: extract insomnia-data into workspace package (#10010)
Move insomnia-data models, services, database code, and common utilities into a dedicated workspace package. Update consumers to import from the new package entrypoints and declare workspace dependencies for the extracted package. |
||
|
|
7cd8854f24 |
feat: lift network.ts fs/path behind window.main.timeline IPC bridge (#9945)
* updated plan * feat: lift network.ts fs/path use behind window.main.timeline IPC bridge Removes `node:fs` and `node:path` from the renderer-reachable `src/network/network.ts`. Three timeline-path constructions and two `appendFile` calls are replaced with narrow `window.main.timeline.getPath` (sync IPC) and `window.main.timeline.appendToFile` (async IPC) helpers that live in main, where Node builtins belong. Path validation in `appendToTimeline` mirrors `writeResponseBodyToFile`: only paths inside the `responses/` directory ending in `.timeline` are accepted, preventing a compromised renderer from writing arbitrary files. Updates `config/renderer-node-import-baseline.json` to remove the two `src/network/network.ts` entries — the baseline shrinks as intended. Part of the nodeIntegration: false migration (PR B). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: address Aikido path-traversal feedback and mock window.main in network tests - `getTimelinePath`: use `path.resolve` + `path.relative` check instead of `path.join` to prevent path-traversal attacks (Aikido medium severity finding) - `network.test.ts`: add `vi.stubGlobal('window', ...)` mock for `window.main.timeline` so tests don't throw "window is not defined" now that `defaultSendActionRuntime` calls `window.main.timeline.appendToFile` Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: suppress echoServer stdout in playwright config Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: update insomnia-inso logger for consola v3 compatibility FancyReporter and BasicReporter were removed in consola v3; LogLevel became a type-only export and the runtime enum is now LogLevels. Replace with createConsola + a local BasicReporter shim, and import LogLevels in cli.ts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: address timeline IPC review concerns - Convert timeline.getPath from sendSync to invoke (async) to avoid blocking the renderer thread; path construction has no I/O - Extract getResponsesDir() shared helper so both getTimelinePath and appendToTimeline read the same source of truth, eliminating env-drift between the two calls - Guard mkdir with a Set so the responses directory is only created once per process rather than on every appendFile call Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: upgrade consola to v3 and fix type/import issues in insomnia-inso - Bump consola from ^2.15.3 to ^3.4.2 to match logger.ts which already used v3 API (createConsola) - Fix logType → LogType (renamed in v3) - Remove fancy option (removed in v3 ConsolaOptions) - Use ConsolaInstance instead of Consola in result-report.ts so .log() resolves correctly - Fix import sort in cli.ts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: restore Node.js-safe fallbacks in network.ts for inso CLI The timeline IPC bridge introduced window.main.timeline calls without guarding against the inso CLI context where window is not defined. The electron shim (aliased in the inso bundle) provides app.getPath as a fallback, matching the pre-bridge behaviour. - getTimelinePath: check typeof window before using IPC; fall back to the electron shim path (os.tmpdir()/insomnia-send-request/responses) - defaultSendActionRuntime.appendTimeline: fall back to fs.promises.appendFile - tryToExecutePreRequestScript catch block: skip IPC appendToFile in Node.js context Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: sort node: imports before third-party and replace if/else with ternary in network.ts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: replace static fs/path imports with inline require() to pass renderer baseline check Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: replace process.type branching in network.ts with build-time adapter modules Eliminates all runtime process.type and typeof window checks by introducing network-adapter.renderer.ts and network-adapter.node.ts. Vite and Vitest resolve the import to the renderer adapter; inso esbuild resolves to the node adapter. No branching code remains in network.ts itself. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: restore object alias format in vite.config.ts to fix rollup build Array-form alias with find:'~' was not matching prefix imports like ~/common/insomnia-fetch in the react-router production build. Object form behaves correctly in Vite 7. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: resolve merge conflicts in logger.ts and cli.ts, restore AGENTS.md indented tree - logger.ts: keep LogType (consola v3 casing), drop duplicate conflict markers - cli.ts: remove stashed duplicate LogLevels import from conflict block - AGENTS.md: restore indented hierarchy in Repository Structure and Data Model sections Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * remove cx * fix: add path traversal guard to getTimelinePath in node adapter Mirrors the same defence-in-depth check already present in the IPC handler. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix tests which use network from main * flake * refactor: replace bundler aliases with process.type runtime detection in network-adapter Instead of three separate bundler aliases (Vite, esbuild main, esbuild inso), network-adapter.ts now selects the correct adapter at runtime using process.type === 'renderer'. - Vite prod: process.type is already inlined as 'renderer' via define, so Rollup tree-shakes the node branch - esbuild main: define process.type='browser' so esbuild tree-shakes renderer branch - esbuild inso: define process.type=undefined so esbuild tree-shakes renderer branch - Vitest (insomnia): existing renderer alias kept for test environment - Vitest (inso): add renderer alias to match pre-existing test behaviour and avoid loading native node-libcurl module in tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: restore vite alias for network-adapter to fix server bundle build The react-router build produces both client and server bundles. Without the alias, the server bundle encountered a runtime require() for './network-adapter.renderer' that couldn't resolve (Vite inlines process.type='renderer' via define for the server build too, so Rollup tree-shakes to the renderer branch, but the module gets externalized in the server bundle rather than inlined, leaving a broken runtime require). Restoring the alias ensures both builds inline network-adapter.renderer directly, which is safe because the module only defines functions — window.main is never called at module init time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feedback --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|
|
9d1dcce441 |
feat: move plugin loading to dedicated hidden BrowserWindow (Phase 1) (#9889)
* chore: reduce output verbosity for local dev and AI agent workflows - Set npm loglevel=warn to suppress install/run progress noise - Switch Playwright local reporter from list to dot (less output per test, CI unchanged) - Add scripts/setup.sh for one-time local git config (compact log, short status) - Document setup script in AGENTS.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: remove loglevel=warn and alias suggestions - Revert loglevel=warn from .npmrc — too broad, suppresses CI output - Remove shell alias suggestions from setup.sh — out of scope for a repo script Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: replace setup.sh with command output guidance in AGENTS.md Removes setup.sh in favour of explicit quiet-command guidance that benefits all agents (Claude, Copilot, Codex) without requiring a one-time setup step. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: add cx semantic code navigation guidance to AGENTS.md cx gives agents a cost ladder (overview → symbols → definition → read) that reduces file reads for all agents that read AGENTS.md — complementary to CodeGraph which is Claude Code-specific. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * plan pass 2 * answer questions * add tests * theme tests * more tests * feat: move plugin loading/execution to hidden BrowserWindow (Phase 1) All plugin API calls (getThemes, getPlugins, getActivePlugins, reloadPlugins, getRequestActions, getRequestGroupActions, getWorkspaceActions, getDocumentActions) are now routed through a dedicated hidden BrowserWindow with nodeIntegration:true instead of running directly in the renderer. IPC relay: renderer → ipcMain.handle → plugin window webContents → ipcRenderer.send back to main → resolve renderer promise via pending-request map with 30s timeout. Renderer-side callers updated to use window.main.plugins.* bridge. Two new esbuild entry points added (plugin-window, plugin-window-preload). Dev build threshold updated from 3 to 6 to account for all contexts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feedback * feat: route plugin action execution through hidden BrowserWindow bridge Add executeAction IPC method so all four plugin action dropdowns (request, requestGroup, workspace, document) dispatch through the plugin window instead of running context modules directly in the renderer. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: route template tag listing and action execution through plugin bridge Bridge getTemplateTags() and runTemplateTagAction() so code-editor, one-line-editor, and tag-editor no longer import from plugins/index or plugins/context/store in the renderer. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: complete Phase 1 — all plugin execution routed through hidden BrowserWindow Bridge template tags (getTemplateTags, runTemplateTagAction), bundle plugin listing (getBundlePlugins), and elevated plugin actions (executePluginMainAction) so no renderer code calls plugin index or context modules directly for execution. Remaining renderer plugin imports are intentional: applyColorScheme/getColorScheme (DOM utilities) and createPlugin (filesystem scaffolding), neither of which is plugin execution. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * update plan * fix: initialize plugin window services and add Phase 1a E2E test - Create database.plugin-window.ts IPC proxy so the plugin window reads from the main process NeDB connection instead of opening a second one - Initialize database + services in entry.plugin-window.ts before sending plugin-window-ready, fixing the silent "Service not initialized" crash that was masked by unawaited promises - Add isMainWindow fallback to the page fixture so firstWindow() racing to return the hidden plugin window doesn't break other tests - Add plugin-bridge.test.ts: E2E test that writes a requestAction plugin, reloads via the bridge, and verifies the action appears in the request dropdown Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix lint * fix: only send plugin-window-ready after successful initialization Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix assertion * add found * better * fix: stabilize hidden window smoke flows Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * feat: bridge request and response hooks through the plugin window Moves requestHooks and responseHooks execution into the hidden plugin window via the IPC bridge. The default-headers built-in runs in the renderer (no IPC). A cached hasRequestHooks/hasResponseHooks check in the main process avoids any plugin window round-trip per request when no user plugins have hooks registered. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: handle non-renderer processes in plugin hook functions _applyRequestPluginHooks and _applyResponsePluginHooks now use window.main.plugins.* IPC only in the Electron renderer. In the main process (OAuth2 token exchange via get-token.ts) and Node.js CLI (insomnia-inso), they fall back to loading plugins directly via plugins.getRequestHooks/getResponseHooks. This fixes: - inso CLI: "window is not defined" in all run collection/test commands - Electron: OAuth2 token exchange failing with "no access token provided" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix unit test * fix: increase findMainWindow timeout and skip plugin window by title Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: defer plugin window creation until after main window loads Playwright's firstWindow() was racing with the plugin window and sometimes returning it instead of the main app window. By deferring createPluginWindow() to did-finish-load on the main window, the plugin window is guaranteed to not exist yet when firstWindow() resolves. Removes the findMainWindow polling fallback from the test fixture. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: replace any[] cast in nunjucks context menu with narrow ContextMenuTag type Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: safely stringify non-Error rejections in response hook error handler Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: bridge plugin UI calls (alert/dialog/prompt/clipboard) from plugin window to main renderer Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix test * docs * add tests and observability * docs * feat: implement invokePluginMethod for plugin communication and add tests * document switch * fix test * fix: move plugin killswitch from preload to renderer to prevent packaged app crash The preload was statically importing invokePluginMethod which pulled the entire plugin system (network stack, NeDB, plugin contexts) into the preload bundle. In production the bundle is built fresh from source, causing a module-level crash before window.main is set — breaking the critical backup smoke test with "Cannot read properties of undefined (reading 'secretStorage')". Move the INSOMNIA_ENABLE_PLUGIN_BRIDGE killswitch into a new renderer-bridge.ts module that lives in the Vite renderer bundle where those deps already exist. The preload now always uses IPC for all plugin calls. All window.main.plugins.* call sites updated to use the bridge. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: eslint autofix import ordering Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> |
||
|
|
d9851d406f |
Chore: refine e2e docs by agent for agent (#9881)
* improve agent docs * added error context note |
||
|
|
718d88f57a | chore: add AGENTS.md, CLAUDE.md (#9812) |