ulysses/static/js
Kenny Van de Maele 2be3779e6e
feat: Add workspace: confine agent tools to a folder (#1103)
* feat: Add workspace: confine agent tools to a folder

Pick a server folder as the agent's workspace so its file/shell tools work
there and don't touch files outside it. File tools are hard-confined; bash/
python run with cwd set to the folder.

Includes a slash command: `/workspace` (alias `/ws`) — show / `set <path>` /
`clear` / `pick` (open the directory browser).

- routes/workspace_routes.py: GET /api/workspace/browse (admin-only).
- src/tool_execution.py: hard path confinement for read_file/write_file;
  bash/python cwd. Threaded route → stream_agent_loop → execute_tool_block.
- src/agent_loop.py: workspace note prepended to the system prompt.
- static/: overflow menu item, input-bar pill, directory-browser modal, and
  the /workspace slash command.
- tests/test_workspace_confine.py.

* Wire workspace confinement into tools that landed after this PR

edit_file (#1239) and grep/glob/ls (#1670) merged after workspace-confine was
written, so they bypassed the workspace boundary. Thread the workspace through:
  - edit_file: _do_edit_file resolves via _resolve_tool_path_in_workspace
  - grep/glob/ls: _resolve_search_root confines to the workspace (root + paths)
  - bash/python/bg cwd: workspace or _AGENT_WORKDIR (keep the #2586 data-dir
    default when no workspace is set)
Tests cover edit_file + grep/ls confinement (inside ok, outside rejected).

* Workspace picker: editable path bar + modal style cohesion + cross-platform hardening

- Make the current-folder strip an editable address bar: type/paste a full
  path and press Enter to navigate (also reaches other Windows drives and
  hidden dirs the up-only browser cannot).
- Reuse shared modal CSS: drop bespoke .workspace-modal-content/.workspace-btn*
  in favour of base .modal-content/.modal-body and the .confirm-btn button
  family; separators/hover use var(--border). Net -31 CSS lines.
- Fix the path field overflowing the modal right edge (flex stretch + margin
  vs an overflow:auto scrollbar-feedback loop): full-bleed, no h-margin.
- Cross-platform confinement: normcase the workspace commonpath check so
  containment holds on case-insensitive filesystems (Windows/macOS).
- Make tests OS-portable: sibling temp dirs instead of /etc, python os.getcwd()
  instead of pwd. 5 pass.
2026-06-05 00:06:37 +02:00
..
calendar Ignore non-string calendar date inputs (#1649) 2026-06-03 14:16:58 +09:00
color fix: theme color parsing breaks on #rgb shorthand hex (#1213) 2026-06-03 00:30:03 +09:00
compare Isolate HTML popup openers (#2501) 2026-06-04 20:52:41 +02:00
editor fix: computeSnap throws when ctx.otherLayers is not an array (#1716) 2026-06-03 13:34:25 +09:00
emailLibrary Harden email HTML URL sanitization (#2496) 2026-06-04 20:47:47 +02:00
markdown Ignore non-string markdown table rows (#1648) 2026-06-03 14:17:02 +09:00
model fix: model cost/info matches first substring key (gpt-4o-mini billed as gpt-4o) (#1439) 2026-06-04 03:05:37 +01:00
research Whitelist research source links (#2499) 2026-06-04 20:41:35 +02:00
util fix: monthly schedule label shows 21th/22th/31th (ordinal suffix for days >20) (#1577) 2026-06-03 08:57:47 +09:00
a11y.js Improve accessibility across core flows (#86) 2026-06-01 22:04:00 +02:00
admin.js feat(provider): add GitHub Copilot provider with device-flow auth (#1480) 2026-06-04 21:13:14 +02:00
assistant.js Rename Character copy to Persona 2026-06-02 12:42:15 +09:00
calendar.js Fix calendar routing and user-local time context (#408) 2026-06-04 13:20:04 +01:00
censor.js Ignore censor preference storage errors (#1652) 2026-06-03 14:16:55 +09:00
chat.js feat: Add workspace: confine agent tools to a folder (#1103) 2026-06-05 00:06:37 +02:00
chatRenderer.js Harden chat streaming DOM sinks (#2498) 2026-06-04 20:49:37 +02:00
chatStream.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
codeRunner.js Isolate HTML popup openers (#2501) 2026-06-04 20:52:41 +02:00
colorPicker.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
cookbook-diagnosis.js Cookbook polish: auto-reconnect, ctx slider fixes, scoring, lots of UI 2026-06-03 20:25:25 +09:00
cookbook-hwfit.js Cookbook polish: auto-reconnect, ctx slider fixes, scoring, lots of UI 2026-06-03 20:25:25 +09:00
cookbook.js Cookbook polish: auto-reconnect, ctx slider fixes, scoring, lots of UI 2026-06-03 20:25:25 +09:00
cookbookDownload.js Cookbook polish: auto-reconnect, ctx slider fixes, scoring, lots of UI 2026-06-03 20:25:25 +09:00
cookbookProgressSignal.js Don't falsely declare a dependency build stale (#1568) (#1768) 2026-06-03 13:23:35 +09:00
cookbookRunning.js fix(cookbook): don't mark successful dependency installs as crashed (#1315) 2026-06-04 12:55:06 +01:00
cookbookServe.js Cookbook polish: auto-reconnect, ctx slider fixes, scoring, lots of UI 2026-06-03 20:25:25 +09:00
document.js fix(document): render Mermaid in markdown preview (#2415) 2026-06-04 14:25:15 +01:00
documentLibrary.js Whitelist research source links (#2499) 2026-06-04 20:41:35 +02:00
dragSort.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
emailInbox.js fix: reply-all Cc's the user's own other addresses (multi-account) (#672) 2026-06-02 11:42:20 +09:00
emailLibrary.js fix: guard sp.destroy() in _loadScheduled against null spinner (#1495) 2026-06-03 08:12:47 +09:00
emojiPicker.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
escMenuStack.js fix: make transient dropdown/popup menus close on Escape 2026-06-01 14:23:22 -04:00
fileHandler.js feat(ui): allow expanding consolidated file chip regardless of count (#1849) (#2086) 2026-06-04 14:02:52 +01:00
gallery.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
galleryEditor.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
group.js Harden chat streaming DOM sinks (#2498) 2026-06-04 20:49:37 +02:00
init.js fix(ui): keep minimized windows above composer (#1197) 2026-06-02 23:31:09 +09:00
keyboard-shortcuts.js Ignore AltGr keystrokes in Ctrl+Alt keyboard shortcuts (#825) 2026-06-02 11:12:54 +09:00
langIcons.js fix: langIcon throws on an explicit null opts argument (#1740) 2026-06-03 13:29:21 +09:00
markdown.js Harden markdown raw HTML sanitization (#2497) 2026-06-04 20:46:10 +02:00
memory.js feat: allow memory import without session (#493) 2026-06-01 22:32:17 +09:00
modalManager.js feat: Claude Agent integration + cookbook reconnect + UI polish 2026-06-04 08:27:26 +09:00
modalSnap.js Polish email and cookbook flows 2026-06-02 22:42:07 +09:00
modelPicker.js fix(models): stabilize proxy endpoint refresh behavior 2026-06-04 04:56:11 +01:00
models.js fix(models): stabilize proxy endpoint refresh behavior 2026-06-04 04:56:11 +01:00
modelSort.js Ignore invalid model sort inputs (#1653) 2026-06-03 14:16:52 +09:00
MODULE_SUMMARY.md docs: fix stale documentation references (#1769) 2026-06-03 13:23:21 +09:00
notes.js Guard image and QR DOM attributes (#2500) 2026-06-04 20:51:23 +02:00
package.json Fix test suite: ESM module loading and stub isolation (#844) 2026-06-02 11:29:29 +09:00
platform.js Ignore AltGr keystrokes in Ctrl+Alt keyboard shortcuts (#825) 2026-06-02 11:12:54 +09:00
presets.js Keep presets loading with bad local state (#1417) 2026-06-03 04:09:28 +09:00
providers.js Show the serving provider in the model-info card (#2185) 2026-06-04 18:22:31 +02:00
rag.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
researchSynapse.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
search-chat.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
search.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
section-management.js Fix Models section collapse dead pause and missing animation 2026-06-01 16:53:46 +02:00
sessions.js fix: live-resume chat stream on session re-entry (#2539) (#2561) 2026-06-04 17:56:15 +02:00
settings.js feat: round-limit handling — Continue affordance at the cap + configurable cap (#1999) 2026-06-04 22:36:05 +02:00
sidebar-layout.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
signature.js Guard image and QR DOM attributes (#2500) 2026-06-04 20:51:23 +02:00
skills.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
slashAutocomplete.js Cookbook: scoring fixes, UI polish, false-finished + stale-state bug fixes 2026-06-03 16:32:20 +09:00
slashCommands.js feat: Add workspace: confine agent tools to a folder (#1103) 2026-06-05 00:06:37 +02:00
spinner.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
storage.js feat: Add workspace: confine agent tools to a folder (#1103) 2026-06-05 00:06:37 +02:00
tasks.js feat: Claude Agent integration + cookbook reconnect + UI polish 2026-06-04 08:27:26 +09:00
theme.js fix: theme color parsing breaks on #rgb shorthand hex (#1213) 2026-06-03 00:30:03 +09:00
tileManager.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
tourAutoplay.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
tourHints.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
tts-ai.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
ui.js Revert "fix(ui): allow manual prompt bar resize (#1201)" 2026-06-03 23:03:58 +09:00
voiceRecorder.js Odysseus v1.0 2026-05-31 23:58:26 +09:00
windowDrag.js fix(ui): modal drag + removed startDrag func (#2430) 2026-06-04 20:34:18 +02:00
windowResize.js Make tool windows resizable by dragging edges or corners 2026-06-01 19:49:23 +02:00
workspace.js feat: Add workspace: confine agent tools to a folder (#1103) 2026-06-05 00:06:37 +02:00