Commit 48d6ef5
feat(files): scoped search, in-place edits, and ranged reads for agent memory filesystems (#7393)
* feat(files): folder operations for the File block, and folders as scope
Adds folder operations to file_v5 and the agent tool surface, and makes a folder
a scope on the file operations that already existed rather than a second set of
operations beside them.
New operations: List, Create Folder, Move Folder, Delete Folder, Restore Folder,
and Move File. List answers "what is in here" — subfolders and files together,
direct children by default, the whole subtree under Recursive, subject to Max
Depth and Search. Entries are a discriminated union on kind, and the listing is
capped with a truncated flag rather than unbounded now that it includes files.
Read, Get Content, Compress and Append gain an optional Folder above their file
picker. It narrows what the picker offers; on the three read operations it also
stands for that folder's files when none are picked, resolved when the workflow
runs so a file added later is included. Append only narrows the picker, but the
folder does travel when the advanced entry supplies a name rather than an id,
because a name is only unique inside a folder. Write gains a folder destination,
placed above File Name because it names where before it names what.
Two things are worth a reviewer's attention.
Path handling. Two spellings circulate: the stored display path, which
backslash-escapes a slash inside a folder name, and the canonical
percent-encoded path the tools take. A folder genuinely named "Q3/Q4" is one
level in both and two if either is split on "/". folderPathSegments picks the
parser by the leading slash the canonical form always carries, and
resolveFolderIdsForPaths, isFileInFolderScope and selectDirectoryEntries are
pure and tested against exactly that case. Where a folder is known, the code
resolves by id and never builds a path-shaped reference at all.
Delete Folder's recursive flag is a guard, not a scope. Without it, deleting a
non-empty folder fails, and it is user-only so a model asked to clean up a
folder cannot set it on a guess. This is deliberately the inverse of the read
family's Include Subfolders, which is a scope and defaults on.
Five file operations widen from copilot-only delegation to admit the executor,
each justified by a tool in this change: files.list and files.folders.list for
file_list, and files.folders.update / delete / restore for their tools. Principal
kinds are unchanged and copilot keeps every operation it had.
* Update apps/sim/tools/file/compress.ts
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* Update apps/sim/lib/workspace-files/application/workspace-file-folders.test.ts
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* Update apps/sim/lib/internal/file/operations.ts
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* feat(files): confine content search to a folder scope
* feat(files): edit and insert file content in place
* feat(files): ranged content reads and v2 surfaces for search and edit
* Update apps/docs/openapi-v2-files-audit.json
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* Update apps/docs/content/docs/integrations/file.mdx
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* Update apps/sim/lib/workspace-files/application/edit-workspace-file-content.test.ts
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* Update apps/docs/content/docs/cli/files.mdx
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* refactor(files): share one folder-scope module with the table branch
* test(files): cover both non-text buffer shapes, and regenerate the spec
* fix(cli): stop claiming a line limit caps a --filter match
* fix(files): connect the scoped-search, edit and ranged-read fields end to end
* test(files): give the session principal fixture its required sessionId
* fix(files): keep folder creation working under a slash-named parent
* chore(files): sort the folder-scope import
* fix(realtime): count room subscribers so one unmount cannot cut off another
* test(realtime): type the room fixture instead of casting it
* fix(files): close the round-2 review findings
* fix(files): scope the picker from either half of the folder pair
* docs(files): say that a folder constrains a canonical id too
* fix(files): keep the root scope on a named append, edit or insert
* fix(files): keep multi-folder search serializable and reclaim a stranded lock
* fix(files): normalize a slash-omitted folder path instead of discarding it
* docs(files): say what the search coverage flag actually covers
* Update apps/sim/lib/api/contracts/v2/openapi/files-audit.ts
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* refactor(files): make the folder scope one advanced field, always recursive
* chore(docs): regenerate the spec after the conflict-example wording change
* fix(files): let an exact file id win over a lookalike name
* fix(files): refuse an out-of-scope file id instead of matching a lookalike
* feat(files): bring back Include Subfolders, in the advanced fields
* Update apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/file-upload/file-upload.tsx
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
* feat(files): complete folder scoping across surfaces
* test(files): align generated API and folder scope coverage
* fix(files): close folder scope review gaps
* feat(files): add anchor-based file edits
* fix(files): harden scoped edit operations
* fix(files): preserve scoped listing semantics
* fix(files): bound expanded edit output
* fix(files): keep replacement content literal
---------
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai>1 parent f050dc0 commit 48d6ef5
137 files changed
Lines changed: 32788 additions & 657 deletions
File tree
- apps
- docs
- content/docs
- cli
- integrations
- platform/enterprise
- lib
- sim
- app
- api/v2/files
- [fileId]
- content
- text
- folders
- restore
- search
- workspace/[workspaceId]
- files/hooks
- hooks
- w
- [workflowId]/components
- panel/components/editor/components/sub-block
- components
- file-upload
- workspace-folder-selector
- hooks
- workflow-block
- components/preview/components/preview-workflow/components/block
- blocks
- blocks
- ee/workspace-forking
- components/fork-sync
- lib
- copy
- mapping
- promote
- remap
- hooks/queries
- lib
- api/contracts
- tools
- v2
- __tests__
- openapi
- copilot/tools/server/files
- folders
- internal
- file
- tool-operations
- uploads/contexts/workspace
- workflows
- comparison
- subblocks
- workspace-files
- application
- search
- tools
- file
- generated
- packages
- db
- migrations
- meta
- sim-cli/src
- contract
- generated
- http
- runtime
- scripts
- openapi
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
111 | 113 | | |
112 | 114 | | |
113 | 115 | | |
| |||
172 | 174 | | |
173 | 175 | | |
174 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
175 | 203 | | |
176 | 204 | | |
177 | 205 | | |
| |||
310 | 338 | | |
311 | 339 | | |
312 | 340 | | |
| 341 | + | |
| 342 | + | |
313 | 343 | | |
314 | 344 | | |
315 | 345 | | |
| |||
355 | 385 | | |
356 | 386 | | |
357 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
358 | 409 | | |
359 | 410 | | |
360 | 411 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
788 | 788 | | |
789 | 789 | | |
790 | 790 | | |
| 791 | + | |
| 792 | + | |
791 | 793 | | |
792 | 794 | | |
793 | 795 | | |
| |||
858 | 860 | | |
859 | 861 | | |
860 | 862 | | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
861 | 891 | | |
862 | 892 | | |
863 | 893 | | |
| |||
1006 | 1036 | | |
1007 | 1037 | | |
1008 | 1038 | | |
| 1039 | + | |
| 1040 | + | |
1009 | 1041 | | |
1010 | 1042 | | |
1011 | 1043 | | |
| |||
1055 | 1087 | | |
1056 | 1088 | | |
1057 | 1089 | | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
1058 | 1113 | | |
1059 | 1114 | | |
1060 | 1115 | | |
| |||
0 commit comments