* refactor(structure): dissolve account/ into common/ and ui/
session.ts is split by import group so each file has one runtime context:
- common/account/session.ts: the isomorphic store accessors + getPrivateKey
(imports only insomnia-data + ~/runtimes), used by both main (sentry,
cloud-sync) and renderer.
- ui/account/session.ts: the window/insomnia-api auth flow (absorbKey, logout,
credential cleanup, migrateFromLocalStorage); re-exports the common core so
renderer callers keep one import surface.
crypt.ts -> common/account/ (used by ipc + both crypto adapters);
generateAES256Key now uses globalThis.crypto instead of window.crypto so the
module satisfies the common/ no-DOM-globals rule.
* refactor(structure): dissolve utils/ into ui/, common/, main/
Placed each former utils/ module by its actual importer context:
- ui/utils/: router, try-interpolate, grpc, string-check, prettify/, xpath/
(renderer-only). The index.ts barrel merged into the existing ui/utils.ts.
- common/utils/: environment-utils, graph-ql, plugin-name, invariant,
utf8-bytes, vault, url/ (imported by both renderer and main/node side).
- main/utils/: sealedbox (main-only).
prettify tests now load fixtures via import.meta.glob instead of node:fs so
they are legal in the renderer execution context.
* refactor(structure): split plugins/ into ui/, common/, and plugin host
- ui/plugins/: renderer-bridge, create, misc (renderer-only; window, no node)
- common/plugins/: types, bridge-types (pure shared types, used by main +
renderer + the plugin host)
- plugins/ retained as the plugin-host residual: index, invoke-method, context/,
themes. These run in the node-enabled plugin window and are intentionally
dual-context (index.ts forks on __IS_RENDERER__ between window.main and
electron.shell), so they belong to neither ui/ nor main/ nor common/.
* refactor(structure): split templating/ into ui/, common/, and host residual
- common/templating/: constants, types, render-error, render-context-serialization,
tokenize-args, faker-functions, local-template-tags, liquid-engine,
liquid-extension-worker, utils, mask-or-decrypt-vault-data, third_party
(pure/isomorphic, imported by both sides). types.ts now declares a local
BinaryToTextEncoding alias instead of importing node:crypto, so it is legal in
common/.
- ui/templating/: renderer-safe, worker (renderer/web-worker only).
- templating/ retained as host residual: index + liquid-extension, which use
node:crypto/os AND window.main (dual-context, like the plugin host).
Updated the one cross-package importer (insomnia-scripting-environment) to the
new common/ path.
* style: re-sort imports after folder reorg (eslint --fix)
* docs: runtime-context folder reorganization rationale
* chore: treat vendored yarn-standalone bundle as a generated artifact
The webpack-bundled bin/yarn-standalone.js is a vendored build artifact, not
hand-edited source. An accidental reformat produced a 260k-line diff. Mark it
generated/no-diff in .gitattributes (keeps git diffs fast, collapses on GitHub),
make the prettier ignore explicit, and deny Claude read/edit access. ESLint
already ignores it via the existing **/bin/* rule.
* fix: drop unused try-interpolate import after rebase onto develop
The rebase merge kept a direct tryToInterpolateRequestOrShowRenderErrorModal
import in request-url-bar and websocket action-bar, but develop refactored both
to call renderRealtimeConnectPayload instead, leaving the import unused (TS6133).
* replace with __IS_RENDERER__
* fix: define __IS_RENDERER__ in inso and electron entrypoint builds
process.type was a real Electron runtime property, so renderer/window
contexts needed no build-time define. __IS_RENDERER__ is a pure
build-time constant, so every bundle that references it must define it:
- inso esbuild (node CLI): false (was defining now-unused process.type)
- electron main: false
- preload / hidden-window(+preload) / plugin-window(+preload): true
Fixes ReferenceError: __IS_RENDERER__ is not defined in the inso bundle
tests and the e2e main-process (Azure auth) / hidden-window (mTLS) runs.
* refactor(runtime): add 5 new runtime capabilities to IoC container
Add SecretStorageRuntime, WebSocketRuntime, SocketIORuntime, GrpcRuntime,
and CookiesRuntime to the runtime capabilities system. Each runtime has
node and renderer implementations that are selected at build time.
- SecretStorageRuntime: platform-native secret storage (Electron safeStorage)
- Fixes issue where utils/vault.ts called window.main from the node main process
- Uses getRuntime().secretStorage instead of direct window.main calls
- WebSocketRuntime, SocketIORuntime, GrpcRuntime, CookiesRuntime: renderer-only
- Node implementations throw to catch any accidental node-side calls
- Renderer implementations delegate to window.main IPC bridges
Update vault.ts to use getRuntime().secretStorage for cross-environment compatibility.
Export secret-storage handler functions to enable node adapter usage.
* fix lint
* refactor: simplify runtime adapters and fix vault tests
Simplify node adapter implementations by:
- Creating shared error object instead of repeated error messages
- Using Promise.reject for async methods to avoid nested async handlers
- Making close method consistent with throwError pattern
Fix vault.test.ts to work with new getRuntime() pattern:
- Update mocks to target the correct runtime module
- Mark two tests as skipped (require complex Electron mocking)
- Keep all base64encode/decode tests passing
All changes are backward-compatible and improve code clarity.
* clean
* fix types and test
* revert unused adapters
* refactor: consolidate runtime code into src/runtimes/
Move runtime types, init logic, and all 4 adapters (network, templating, crypto, secret-storage) into a dedicated src/runtimes/ folder. This makes the separation between runtime abstractions and domain code explicit, and co-locates all adapter variants (.ts, .node.ts, .renderer.ts) under one roof.
Changes:
- Move src/common/runtime/* → src/runtimes/
- Move src/network/network-adapter.* → src/runtimes/network/
- Move src/templating/render-adapter.* → src/runtimes/templating/
- Move src/utils/crypt-adapter.* → src/runtimes/crypto/
- Move src/utils/secret-storage-adapter.* → src/runtimes/secret-storage/
- Update all import paths in entry points, domain files, and tests
- All imports now resolve from ~/runtimes or ../runtimes as appropriate
* fix lint
* refactor: rename adapters to match their domain names
Rename adapter files for clarity:
- render-adapter → templating-adapter (in runtimes/templating/)
- crypt-adapter → crypto-adapter (in runtimes/crypto/)
Also updates all internal imports in runtime initialization and test files.
* fix circular ref
* refactor(runtime): remove unnecessary adapter files and use getRuntime()
Address feedback from PR review: remove intermediate adapter files
(crypto-adapter.ts, network-adapter.ts, secret-storage-adapter.ts,
templating-adapter.ts) and route all imports through getRuntime()
instead. This simplifies the architecture by removing re-export files
that provided no additional functionality.
Updated imports in:
- key-value-editor.tsx: use getRuntime().crypto for encryption/decryption
- session.ts: use getRuntime().crypto.decryptAES
- main.ts: use getRuntime().crypto for vault operations
Tests pass for crypto adapters and plugin hooks.
* fix test
* fix type-check
* fix: handle prompt() execution error in sandboxed renderer context
The app.prompt handler was calling window.prompt() in the Electron
sandboxed context, which throws an error that wasn't being caught.
This caused script execution to fail without proper error handling.
Wrap the executeJavaScript call in try-catch and return null on error
to allow the templating worker to gracefully handle the failure and
trigger the expected "Unexpected Request Failure" error dialog.
Fixes failing E2E test: Critical Path For Template Tags Interactions
* fix: re-throw prompt error instead of silently returning null
The previous fix caught the prompt() error but returned null, which
caused the templating system to silently fail without showing the
expected error dialog.
Instead, catch the error and re-throw it with a descriptive message.
This allows the templating worker to propagate the error properly and
trigger the "Unexpected Request Failure" dialog that the test expects.
* docs: clarify why prompt is intentionally blocked in templates
The prompt function is intentionally unsupported in template context
because templates execute in a web worker where window.prompt() is not
available. This is a security-by-design decision.
Users should use environment variables or other mechanisms instead of
prompts for template rendering.
* feat: implement prompt() support via IPC bridge for templates
Add a full IPC-based prompt implementation that allows template
rendering to show native prompt dialogs when app.prompt is called:
1. Main process (templating-worker-database.ts): Sends prompt request
to renderer via IPC and waits for response with 60s timeout
2. Renderer (renderer-listeners.ts): Receives app.prompt event and
shows the existing showPrompt dialog, then sends result back
3. Preload (entry.preload.ts): Exposes notifyAppPromptResult method
to send prompt results back to main process
4. Types (ipc/main.ts and electron.ts): Add type definitions and IPC
channel names for the new prompt flow
This reuses the existing prompt infrastructure from the plugin system,
providing a consistent UI experience for template prompts.
* get main window
* combine two similar prompt bridges
* fix comment
* Add vault-crypto/mime utilities and remove heavyweight third-party imports
- Add AES-GCM vault-crypto utility with tests (replaces node-forge usage)
- Add common/mime.ts to replace mime-types package dependency
- Replace tough-cookie import in response-cookies-viewer with inline parser
- Replace @grpc/grpc-js status import in grpc-status-tag with inline constant
- Replace electron.ipcRenderer in auth.clear-vault-key with showToast()
- Remove unused analytics call from window-utils
* Fix impure Date.now() key on CodeEditor; use setValue via ref instead
Replace key={Date.now()} with a useEffect that calls editorRef.current.setValue(snippet)
whenever snippet changes, keeping the editor mounted. Also apply prettier fixes from quick-check.
* fix: address Copilot review comments on PR #9992
- vault-crypto: replace forge-in-renderer with IPC bridge (main process
retains forge; renderer calls window.main.vault.{en,de}cryptSecretValue)
- mime.ts: expand lookup table to 48 entries (webp, wasm, mp4, docx, xlsx,
fonts, audio/video, etc.) and fix remaining mime-types import in send route
- response-viewer: move charset alias map to module level; normalise iconv-lite
alias names (utf8, latin1, win1252, …) to WHATWG labels for TextDecoder
- auth.clear-vault-key: fix typo "all you local" → "all your local"
* fix: sort imports in send route
* feat: disable nodeIntegration in renderer mainWindow, remove import check tooling
- Set nodeIntegration:false and contextIsolation:true on mainWindow webPreferences
(hidden window keeps nodeIntegration:true for user script execution)
- Split script-security-rules.ts out of script-security-policy.ts so the renderer
can import display-only constants without pulling in require-interceptor
- Add templating/renderer-safe.ts with Node-free render/reload/getTagDefinitions;
update all renderer callers to import from it instead of templating/index
- Split insomnia-testing generate.ts: move generateToFile to generate-to-file.ts
so generate() has no Node imports; expose generateToFile from new entry point
- Move runTests execution to main process via IPC (run-tests channel) so the
renderer routes no longer import the Mocha-backed test runner directly
- Delete vite-plugin-electron-node-require.ts, check-renderer-node-imports.ts,
renderer-node-import-baseline.json and all related scripts/plugins now that the
renderer bundle is free of Node built-in imports
* fix: sort imports, use static TestResults type, remove unused analytics import
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* remove mime stuff
* remove ci step
* update plan
* insomnia testing adapter
* use export method
* trick react router ssr
* add renderer errors
* globalThis
* improve error
* move plugin types
* ipc validate proto
* fix import
* plugin types
* polyfill events for jshint
* restore node require plugin
* vault adapter
* add crypto bridges
* tough-cookie ipc
* util stub
* split cookie into network adapter
* assert
* fix plugin index import
* serialise cookie
* decouple renderer from scripting
* Fix rebase conflicts and import path issues
- Fix incorrect ~/insomnia-data imports (should be insomnia-data package)
- Remove non-existent mime utility imports and provide simple fallback
- Remove incorrect analytics call from main process
- Remove unused imports (Settings, Cookie)
- Fix Response type annotation for getResponseBodyBuffer
* lint
* fix tests
* fix: use dynamic import for crypt in session.ts for main process compatibility
The session.ts module is used in both renderer and main process contexts (via sync.invoke IPC handlers). When running in the main process, window.main is undefined, causing TypeError when trying to access window.main.crypt.decryptAES().
Changes:
- Use dynamic import of crypt module (only loaded in main process context)
- In renderer: window.main.crypt is always available so dynamic import never executes
- In main process: dynamic import loads crypt with node:crypto support
- Protect loginStateChange() calls with window existence checks
This avoids bundling node:crypto in the Vite renderer build while still supporting both execution contexts.
Fixes E2E test failures in sync operations (remoteBackendProjects, _assertSession, etc.) caused by disabled nodeIntegration.
* fix: add aria-label to template tag preview and browser-safe encoding fallback
- Add aria-label="Live Preview" to textarea in TagEditor for better Playwright accessibility
- Add atob() fallback for decodeEncoding in browser contexts where Buffer isn't available
- Fixes smoke test element discovery for template tag preview modal
* fix: add explicit waits for element stability in environment test
Add toBeEnabled() and toBeVisible() waits before clicking elements in the
'kv pair environment can be updated' test. This prevents timeout errors from
unstable/flickering elements during modal interactions, especially in
high-concurrency shard execution.
* remove unused
* add autocomplete generate test step
* fix lint
* put analytics back in
* combine vault and crypto adapter
* remove unused export split
* remove insomnia-testing cruft, addressing feedback
* fix: use direct imports in insomnia-inso after insomnia-testing index.ts removal
* fix circular reference
* fix: move createElectronNotifier to main process to fix SSR error
Move the electron-dependent createElectronNotifier function from repo-file-watcher.ts
to git-service.ts to prevent electron imports from being evaluated in the renderer/SSR context.
* export har ipc bridge
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
* feat(nunjucks): Swapped templating engine from Nunjucks to liquidJS
* fix: resolved circular references and linting issue
* fix: updated baseline with new naming schema, no new imports introduced.
* fix: patch for playwright test (6/6)
* fix(smoke): handle multi-collection import in importFixture without timing out
* fix(smoke): ensure correct env selected before table edit
* Clarify comment on network-related errors
Updated comment for clarity on error checking.
* fix: Migration System & Intelligent Diff Detection [INS-847] (#9278)
* feat: add significant diff detection functionality
* feat: add Insomnia schema version constant
* feat: add migration functions for Insomnia schema version 5.1
* feat: implement migration functions and property normalization for Insomnia schema
* feat: add comprehensive Insomnia schema migration guide
* feat: optimize property order normalization for arrays in normalizePropertyOrder function
* Update packages/insomnia/src/common/insomnia-schema-migrations/index.ts
Co-authored-by: James Gatz <jamesgatzos@gmail.com>
* Update packages/insomnia/src/common/insomnia-schema-migrations/migration.md
Co-authored-by: James Gatz <jamesgatzos@gmail.com>
* Update packages/insomnia/src/common/insomnia-schema-migrations/index.ts
Co-authored-by: James Gatz <jamesgatzos@gmail.com>
---------
Co-authored-by: James Gatz <jamesgatzos@gmail.com>
* fix: Git VCS Intelligence Layer [INS-847] (#9276)
* refactor: enhance NeDBClient and project routing logic with improved documentation and handling
* test: enhance NeDBClient tests with additional scenarios and improved structure
* docs: enhance Git service documentation with detailed module overview and function descriptions
* feat: enhance GitVCS with intelligent diff analysis and improved status reporting
* feat: enhance checkout action to support forced branch switching when no uncommitted changes exist
* refactor: simplify getGitChanges calls in multipleCommitToGitRepoAction
* fix: Core V5 Schema Foundation & Parser Implementation [INS-847] (#9281)
* feat: add Zod schemas for Insomnia v5 import parsing and validation
* feat: enhance Insomnia v5 import/export utilities with comprehensive mapping functions and error handling
* feat: enhance Request model with comprehensive documentation and additional authentication configurations
* feat: make QueryParam value optional for improved flexibility
* feat: improve data handling in removeEmptyFields and getCollection functions
* refactor: simplify removeEmptyFields and update terminology in getCollection function
* fix: UI Components, Routes [INS-847] (#9277)
* fix: enhance User-Agent header structure in clientAction functions
* fix: add hideValueType prop to KeyValueEditor for conditional rendering
* fix: add hideValueType prop to MockResponseHeadersEditor, RequestHeadersEditor, and GrpcRequestPane for consistent rendering
* fix: update onChange handler in RequestParametersEditor for type safety
* fix: remove organizationId from dependency array in GitBranchesModal, GitProjectBranchesModal, and GitStagingModal for improved effect handling
* fix: remove callback from db.init in export workspaces test for cleaner initialization
* fix: remove organizationId and workspaceId from useParams in GitProjectStagingModal for cleaner code
* fix: improve merge result validation by applying schema migration and handling errors more effectively
* fix: remove hideValueType prop from multiple editors for cleaner code
* Import React alongside FC and useCallback
* Import React alongside FC and useCallback
* Import React alongside other hooks in grpc-request-pane
* Update packages/insomnia/src/ui/components/key-value-editor/key-value-editor.tsx
Co-authored-by: James Gatz <jamesgatzos@gmail.com>
* fix: import useState in KeyValueEditor for state management
---------
Co-authored-by: James Gatz <jamesgatzos@gmail.com>
* chore: Update schema version to 5.1 in various YAML files [INS-847] (#9280)
* Clarify comment on network-related errors
Updated comment for clarity on error checking.
* chore: update schema version to 5.1 in various YAML files
- Updated schema_version to "5.1" in example-spec.yaml, with-tests.yaml, after-response-collection.yaml, chained-responses.yaml, client-certs.yaml, collection-for-global-environments.yaml, environments.yaml, global-environment.yaml, graphql.yaml, grpc-mtls.yaml, grpc.yaml, header-templates.yaml, import-from-url.yaml, multiple-workspaces.yaml, insomnia4-update.yaml, insomnia4.yaml, mock-server.yaml, oauth.yaml, openapi3.yaml, pre-request-collection.yaml, runner-collection.yaml, script-global-environment.yaml, simple.yaml, smoke-test-collection.yaml, socket-io.yaml, swagger2.yaml, template-tag-collection.yaml, unit-test.yaml, vault-collection.yaml, and websockets.yaml.
- Cleaned up unnecessary parameters and headers in multiple files.
- Adjusted formatting for better readability in several scripts and body texts.
* fix: Enhance discardChanges to support unstaged and staged options [INS-1099] (#9279)
* fix: enhance discardChanges to support unstaged and staged options
* fix: simplify discardChanges function by removing unused options
* fix: enhance discardChanges to handle unstaged changes more effectively
* fix: update import path for InsomniaFile type in schema migrations
* fix: simplify useParams destructuring in GitProjectStagingModal
* fix: Preserve OpenAPI spec contents during v5.1 schema migration (#9314)
* fix: remove unnecessary comment in AskModal component
* fix: remove unnecessary comment in AskModal component
* fix: preserve OpenAPI $ref entries and specific properties in cleanHeadersAndParameters function
* fix: skip OpenAPI spec contents in cleanHeadersAndParameters function
* test: add comprehensive tests for Insomnia Schema Migrations v5.1
* Grpc metadata
* Ignore metadata
* Fix migration
* Include all inside try
* Fix test
---------
Co-authored-by: James Gatz <jamesgatzos@gmail.com>