Commit e3fb656
committed
feat(files): folder operations for the File block, and folders as scope
Adds folder operations to file_v5 and to 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. Its entries are a discriminated union on kind, so a consumer
narrows before reaching for the fields only one side has, and the listing is
capped with a truncated flag rather than being 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, and 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: a folder
is not something you can append to, so it shapes the options and does not
travel. Write gains a folder destination, placed above File Name because it
names where before it names what.
Every folder field is one single-select tree control paired with a manual entry.
The picker cannot hold a reference expression — `<` autocomplete comes from
TagDropdown, which scans for the last `<` before the cursor and so only exists
on a text surface — which is why the pair exists rather than being a
convenience. Root is the absence of a selection rather than a row, since a root
row would be meaningless on create and wrong on delete.
Path handling is the part most worth reviewing. 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 "/", so
folderPathSegments decodes by the leading slash the canonical form carries, and
resolveFolderIdsForPaths, isFileInFolderScope and selectDirectoryEntries are
pure and tested against exactly that case.
Delete Folder keeps its recursive flag as a guard rather than 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.1 parent ad83796 commit e3fb656
42 files changed
Lines changed: 3313 additions & 188 deletions
File tree
- apps/sim
- app
- api
- tools/file/manage
- v2/files/folders
- workspace/[workspaceId]/w/[workflowId]/components
- panel/components/editor/components/sub-block
- components
- file-upload
- sim-folder-tree-selector
- hooks
- workflow-block
- blocks
- blocks
- lib
- api/contracts/tools
- folders
- knowledge/application
- table/application
- workflows/subblocks
- workspace-files
- application
- tools
- file
- packages/workflow-types/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | | - | |
| 16 | + | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | 21 | | |
40 | 22 | | |
41 | 23 | | |
| |||
50 | 32 | | |
51 | 33 | | |
52 | 34 | | |
53 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
54 | 39 | | |
55 | 40 | | |
56 | 41 | | |
| |||
61 | 46 | | |
62 | 47 | | |
63 | 48 | | |
64 | | - | |
| 49 | + | |
65 | 50 | | |
66 | 51 | | |
67 | 52 | | |
| |||
76 | 61 | | |
77 | 62 | | |
78 | 63 | | |
79 | | - | |
| 64 | + | |
80 | 65 | | |
81 | 66 | | |
82 | 67 | | |
| |||
Lines changed: 92 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| |||
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
| |||
55 | 62 | | |
56 | 63 | | |
57 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
58 | 91 | | |
59 | 92 | | |
60 | 93 | | |
61 | 94 | | |
62 | 95 | | |
63 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
64 | 115 | | |
65 | 116 | | |
66 | 117 | | |
| |||
180 | 231 | | |
181 | 232 | | |
182 | 233 | | |
| 234 | + | |
183 | 235 | | |
184 | 236 | | |
185 | 237 | | |
| |||
274 | 326 | | |
275 | 327 | | |
276 | 328 | | |
277 | | - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
278 | 363 | | |
279 | 364 | | |
280 | 365 | | |
| |||
486 | 571 | | |
487 | 572 | | |
488 | 573 | | |
| 574 | + | |
| 575 | + | |
489 | 576 | | |
490 | 577 | | |
491 | 578 | | |
| |||
620 | 707 | | |
621 | 708 | | |
622 | 709 | | |
623 | | - | |
| 710 | + | |
624 | 711 | | |
625 | 712 | | |
626 | 713 | | |
627 | | - | |
| 714 | + | |
628 | 715 | | |
629 | 716 | | |
630 | 717 | | |
| |||
638 | 725 | | |
639 | 726 | | |
640 | 727 | | |
641 | | - | |
| 728 | + | |
642 | 729 | | |
643 | 730 | | |
644 | 731 | | |
645 | | - | |
| 732 | + | |
646 | 733 | | |
647 | 734 | | |
648 | 735 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments