-
Notifications
You must be signed in to change notification settings - Fork 50
Any-file attachments to cloud agents and remote CLI sessions #4628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
1458699
docs(mobile): generalize reviewer loop and switch orchestrator to opu…
iscekic 77ad76e
docs(mobile): make Kilobot the only awaited reviewer explicit in the …
iscekic 64f6bfd
docs(mobile): document Kilobot re-review triggers for crashed reviews
iscekic 17d1f78
docs(mobile): delegation discipline — orchestrators steer loops befor…
iscekic 3124c73
docs(mobile): make review and E2E repair loops explicit loop-until co…
iscekic e50ed1b
docs(mobile): scope the plan-gate round floor vs the escalation ladder
iscekic 08a7ba2
docs(mobile): gate defect work on a pre-plan bug reproduction
iscekic be40f95
cloud: any-file attachment policy, storage contract, binary materiali…
iscekic 472ef53
mobile: any-file attachment UX
iscekic 58faf5d
cloud: attachment download presign + CLI capability plumbing
iscekic f8c0961
mobile+sdk: send attachments to remote CLI sessions
iscekic 48f3ebc
mobile+sdk: fail-closed attachment capability on reconnect; retryable…
iscekic fb32f5a
mobile: format send-attachment test and drop unused exported type
iscekic 92fe234
address review: consistent attachment extension, deny-list defense-in…
iscekic 1bf8be0
Merge remote-tracking branch 'origin/main' into feat/any-file-attachm…
iscekic bb0e97a
test: split activeSessionSchema tests into a separate file
iscekic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
apps/mobile/src/components/agents/attachment-chip-description.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import { formatFileSize } from '@kilocode/kilo-chat'; | ||
|
|
||
| export type ChipStateInput = { | ||
| filename: string; | ||
| size: number; | ||
| status: 'pending' | 'uploading' | 'uploaded' | 'error'; | ||
| progress: number | null; | ||
| terminal?: boolean; | ||
| }; | ||
|
|
||
| type ChipDescription = { | ||
| /** Always present — the original filename. */ | ||
| filename: string; | ||
| /** Human-readable file size (e.g. "1 KB"). Always present. */ | ||
| sizeText: string; | ||
| /** | ||
| * Progress label for in-flight and uploaded states (e.g. "42%" or | ||
| * "Uploaded"). Empty string when no progress is surfaced. | ||
| */ | ||
| progressText: string; | ||
| /** | ||
| * Error message for failed states. `null` for non-error states — the | ||
| * chip renders the message in place of the size/progress secondary | ||
| * text and never both. | ||
| */ | ||
| message: string | null; | ||
| /** True ONLY for retryable error chips — drives the tap-to-retry affordance. */ | ||
| showRetry: boolean; | ||
| /** True for every rendered chip — drives the X remove affordance. */ | ||
| showRemove: boolean; | ||
| }; | ||
|
|
||
| /** | ||
| * Human-readable progress label. `progress` is `null` when the upload task | ||
| * could not determine a total (server did not advertise Content-Length); | ||
| * we surface that honestly instead of fabricating a percentage. | ||
| */ | ||
| export function progressLabel(progress: number | null): string { | ||
| if (progress === null) { | ||
| return 'Uploading…'; | ||
| } | ||
| if (progress >= 1) { | ||
| return 'Uploaded'; | ||
| } | ||
| return `${Math.round(progress * 100)}%`; | ||
| } | ||
|
|
||
| /** | ||
| * Pure projection of the document-kind attachment chip. Kept separate | ||
| * from the React component so every feature state (happy, retryable, | ||
| * terminal, indeterminate progress) can be unit-tested without a | ||
| * renderer. The image-kind chip is a thumbnail overlay and shares no | ||
| * state-dependent text; the description below covers the document chip. | ||
| */ | ||
| export function describeAttachmentChip(state: ChipStateInput): ChipDescription { | ||
| const { filename, size, status, progress, terminal } = state; | ||
| const isErrored = status === 'error'; | ||
| // Explicit `terminal === false` check: a chip is only retryable when | ||
| // the server-side flag is set to `false` (transient failure). An | ||
| // undefined `terminal` flag defaults to the conservative non-retryable | ||
| // bucket so a stray missing field cannot silently enable retry on a | ||
| // server-rejected file. | ||
| const isRetryable = isErrored && terminal === false; | ||
|
|
||
| let message: string | null = null; | ||
| if (isErrored) { | ||
| message = isRetryable ? 'Upload failed. Tap to retry.' : "This file can't be uploaded."; | ||
| } | ||
|
|
||
| let progressText = ''; | ||
| if (status === 'pending' || status === 'uploading' || status === 'uploaded') { | ||
| progressText = progressLabel(progress); | ||
| } | ||
|
|
||
| return { | ||
| filename, | ||
| sizeText: formatFileSize(size), | ||
| progressText, | ||
| message, | ||
| showRetry: isRetryable, | ||
| showRemove: true, | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.