11 Commits

Author SHA1 Message Date
Jack Kavanagh
5ff4186a79 feat(templating): (H1) route user-plugin response hooks through the sandbox (PR 10b) (#10286)
* feat(templating): (H1) in-sandbox response-hook API + marshaling

First increment of PR 10b (response hooks). Adds the sandbox-side machinery to
run a user plugin's response hook, without yet wiring the network adapters:

- __buildResponseApi(resp): faithful ES5 rebuild of plugins/context/response.ts
  getters (status/headers/time, case-insensitive getHeader returning
  string|string[]|null). getBody() bridges to the existing response.getBodyBuffer
  path; getBodyStream() throws (a Node Readable can't cross the sandbox); setBody()
  base64-encodes the bytes over a new response.setBody bridge path (no fs in the
  sandbox) and updates bytesContent locally.
- __invokeHook: for response hooks, attaches context.response and a READ-ONLY
  context.request (matches pluginRequest.init(..., true)), and marshals both the
  request and response back out.
- host-bridge: response.setBody mapped at baseline (models.read, grouped with the
  other response ops) — a bounded write to the host-set bodyPath, matching the
  ungated in-process behavior; not a general fs write.

Unit test drives a response hook that reads status/headers, reads the body via
the bridge, and rewrites it via setBody (asserting the base64 round-trip and the
read-only request). Host runner + adapter integration + e2e are the next increment.

* feat(templating): (H1) route user-plugin response hooks through the sandbox

Wires the response-hook sandbox core into both hook paths so a user plugin's
response hook runs in QuickJS (bundle plugins and the flag-off path unchanged).

- templating-worker-database: runResponseHookInSandbox + the
  plugin.runUserResponseHook handler; the response.setBody bridge handler
  (base64-decode -> fs.writeFileSync) guarded to the responses directory as
  defense in depth (bodyPath is host-set); pickHookResponseFields.
- network-adapter.node.ts (main/CLI): runs the response hook in the sandbox for
  user plugins, merging the returned response fields onto newResponse.
- invoke-method.ts (plugin window): reaches the same runner over the protocol.

E2E: a user plugin response hook rewrites the body via setBody; the echo
response pane shows the rewrite. Flag off it reports ranin-mainprocess (control),
flag on ranin-sandboxed. Completes H1 (request hooks in PR 10a).

* fix(templating): (H1) revive bridged Buffer in response getBody + reject empty setBody

Addresses Copilot review on #10286:
- in-sandbox-bootstrap.ts: context.response.getBody() now revives the JSON-marshaled
  Buffer shape ({ type: 'Buffer', data: [...] }) back into a (shimmed) Buffer, so hooks
  consume it exactly like the in-process response API instead of a plain object.
- templating-worker-database.ts: response.setBody rejects a missing/non-string bodyBase64
  (TypeError) instead of defaulting to '' — a write primitive must not silently truncate
  the body to zero bytes. An empty string stays a valid empty body.
- sandbox-hooks.test.ts: the getBodyBuffer stub now returns the real marshaled Buffer
  shape and the hook decodes with toString('utf8'), exercising the revive end-to-end.
2026-07-24 10:57:40 -04:00
Bingbing
8a1dc1ef62 perf: rewrite command palette search to eliminate UI freezes and stale results (#10257)
* perf: rewrite command palette search to eliminate UI freezes and stale results

Problems fixed:
- clientLoader blocked navigation on every palette open, freezing the UI during
  full sequential DB scan
- no AbortController: stale searches could overwrite newer results mid-type
- no debounce: every keystroke triggered a full DB traversal immediately
- React Aria's default contains filter re-filtered server-side fuzzy results,
  silently dropping valid matches and making fuzzy work redundant
- no warm baseline: palette started blank until the entire load completed

Changes:
- move fuzzyMatch/fuzzyMatchAll → insomnia-data/common-src/search.ts (shared,
  testable in node)
- move search logic → insomnia-data/node-src/services/helpers/command-search.ts
  - per-request AbortController cancellation via abort(requestId)
  - recursion depth guard (max 20) on request group traversal
  - safeParent() replaces non-null assertions, safe against orphaned documents
- add CommandSearchResult type in insomnia-data/src/command-search-types.ts
- add useCommandSearch hook: 250ms debounce + abort on filter change + warm
  baseline on mount
- add defaultFilter={() => true} to ComboBox, delegating all filtering to the
  service
- delete routes/commands.tsx

* fix

* fix
2026-07-17 01:07:38 +00:00
Bingbing
1a3bed2d77 refactor: update environment service methods and replace database calls with service calls (#10227) 2026-07-09 16:52:42 +08:00
James Gatz
490aa9b917 feat(Git Sync): Git projects can live anywhere on disk (#10155)
* tech_design

* tech-doc

* add directory to git repo model

* tech doc

* tech doc

* use directory picker to select an existing repo to clone from/to

* tech doc

* Open git repo

* tech doc

* Implement Git project local storage features and add e2e tests

* tech doc

* Implement folder opening as Git projects with user trust confirmation

* Add Git credential selection to project creation form and enhance repo file watcher for directory availability

* tech doc

* refactor: clean up code and remove references to GIT_LOCAL_REPOS_DESIGN.md

* fix: handle optional author name in Git credential display

* feat: enhance Git credential handling for local repositories

* feat: enhance Git project folder handling and improve test descriptions

* fix: update Git project mode button copy

Rename 'Clone from URL' to 'Clone from Remote' and 'Open existing
folder' to 'Open local folder'. Update the smoke test selector and a
stale comment accordingly.

* fix: align control heights and styling in Git clone form

Standardize the credential select, author email select, and clone
location box to match the repository/branch comboboxes: shared
--line-height-xs height, consistent label spacing, and input-sized
value text and padding.

* feat: show clone target path and remember last clone folder

Default the clone parent directory to the folder the user last cloned
into, and render the resulting target path middle-truncated with a full
path tooltip via a new MiddleTruncate component.

* fix: reorder and align Open local folder input layout

Move the helper text directly below the Folder label, and align the
folder box and Choose folder button to the shared control height with
middle-truncated path display.

* feat: warn when opening a folder already used by a project

Add a git.checkGitRepoDirectory IPC that resolves the project adopting
a folder. The Open local folder flow checks at folder-pick time and
shows a red, no-background warning below the input offering to open the
existing project, and blocks continuing while the warning is present.

* fix: top-align empty organization view and scroll the full page

Replace the vertically centered grid with a top-aligned, page-scrolling
layout so the new project form no longer jumps when switching project
types and the scrollbar spans the whole pane.

* fix: align project modal to top and match folder description color

Top-align the project modal overlay so it no longer jumps as the form
height changes, and drop the dimmer color override on the Open local
folder helper text so it matches the repository URL field description.

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fix: always use getRepoBaseDir

* fix comment

* delete duplicate code

* fix: test

* test: add Git repository relocation tests

* fix: ensure selection change handler converts key to string

---------

Co-authored-by: Pavlos Koutoglou <pkoutoglou@gmail.com>
Co-authored-by: Curry Yang <163384738+CurryYangxx@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Curry Yang <1019yanglu@gmail.com>
2026-07-08 05:16:54 +03:00
Alison Sabuwala
b43b56c38b feat: move to v3 spaces from v1 organizations call (#10185) 2026-07-06 12:01:20 -04:00
Bingbing
b58d44ddf8 refactor: migrate workspace-related database calls to services (#10200)
* refactor: migrate workspace-related database calls to services

* optimize
2026-07-03 20:20:00 +02:00
Bingbing
7b8ccd751d refactor: refactor project related database calls to services (#10104) 2026-06-30 10:14:53 +00:00
Ryan Willis
a09339b2ac feat: surface more errors in console tab (#10186) 2026-06-30 10:33:38 +08:00
Ryan Willis
a8b5cf81c4 fix: deep-link MCP handling [INS-2631] (#10142) 2026-06-23 14:01:56 -04:00
Alison Sabuwala
72ef5cf563 feat: align list and onboarding UX to unified space model (#10033) 2026-06-23 12:46:14 -04:00
Bingbing
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.
2026-06-02 09:49:10 +00:00