Skip to content
Closed
31 changes: 31 additions & 0 deletions ACP_TRACKING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# ACP Integration Tracking

> Personal reminder for when ForgeCode ACP support lands.
Comment thread
chindris-mihai-alexandru marked this conversation as resolved.
Outdated

## Upstream References

- **Feature request**: [tailcallhq/forgecode#2968](https://github.com/tailcallhq/forgecode/issues/2968) — ACP support
- **PR (open)**: [tailcallhq/forgecode#2858](https://github.com/tailcallhq/forgecode/pull/2858) — Machine stdio transport for ACP
- **PR (draft)**: [tailcallhq/forgecode#2371](https://github.com/tailcallhq/forgecode/pull/2371) — ACP phase 1 testing
- **ACP spec**: https://zed.dev/acp

## Action Items

- [ ] Watch/subscribe to the above PRs and issue on GitHub
- [ ] When ACP PRs merge into upstream `main`:
- [ ] Fetch and merge upstream into this fork's `main`
- [ ] Rebuild local Forge binary: `cd /Volumes/990Pro2TB/OtherProjects/forgecode-fork && cargo build`
Comment thread
chindris-mihai-alexandru marked this conversation as resolved.
Outdated
- [ ] Test ACP transport: `forge --acp` or equivalent flag
- [ ] Once ForgeCode ACP is stable, test with Zed:
- [ ] Verify ForgeCode appears in Zed's agent panel
- [ ] End-to-end test: open a ForgeCode session from Zed via ACP
- [ ] Close/remove this tracking file once ACP is fully integrated and working locally

## Related

- Zed `--wait` bug (filed): [zed-industries/zed#54203](https://github.com/zed-industries/zed/issues/54203)

## Context

ACP (Agent Client Protocol) enables ForgeCode to run as an agent inside Zed and other ACP-compatible editors.
This completes the **ForgeCode + Warp + Zed** workflow by letting Zed invoke ForgeCode directly.
38 changes: 37 additions & 1 deletion crates/forge_main/src/zsh/paste.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

use std::path::Path;

const MAX_INLINE_PATH_WRAP_BYTES: usize = 512;

/// Transforms pasted text by wrapping bare file paths in `@[...]` syntax.
///
/// Called when a bracketed-paste event is received. The pasted content is
Expand Down Expand Up @@ -42,10 +44,24 @@ pub fn wrap_pasted_text(pasted: &str) -> String {
return format!("{leading}@[{resolved}]{trailing}");
}

// Scan token by token, wrapping any absolute paths that exist on disk
// Arbitrary pasted prompts often contain absolute paths inside prose,
// logs, stack traces, or code snippets. Auto-wrapping those paths turns
// plain text into attachments and can surface confusing binary-file errors
// when the referenced path happens to be an executable. Restrict token-level
// path wrapping to smaller single-line pastes that more closely resemble a
// drag-and-drop or an intentional short request.
if should_preserve_plain_paste(trimmed) {
return normalised;
}

// Scan token by token, wrapping any absolute paths that exist on disk.
wrap_tokens(&normalised)
}

fn should_preserve_plain_paste(trimmed: &str) -> bool {
trimmed.contains('\n') || trimmed.len() > MAX_INLINE_PATH_WRAP_BYTES
}

/// Strips surrounding single or double quotes that some terminals add
/// when dragging files with spaces in their names.
fn strip_surrounding_quotes(s: &str) -> &str {
Expand Down Expand Up @@ -224,6 +240,26 @@ mod tests {
assert_eq!(actual, expected);
}

#[test]
fn test_wrap_pasted_text_multiline_prompt_preserves_plain_text_paths() {
let fixture = "Please review this snippet:\n/usr/bin/env\n/tmp\nAnd explain what it does.";
let actual = wrap_pasted_text(fixture);
let expected = fixture;
assert_eq!(actual, expected);
}

#[test]
fn test_wrap_pasted_text_large_single_line_prompt_preserves_plain_text_paths() {
let fixture = format!(
"{} /usr/bin/env {}",
"context".repeat(60),
"details".repeat(30)
);
Comment thread
chindris-mihai-alexandru marked this conversation as resolved.
Outdated
let actual = wrap_pasted_text(&fixture);
let expected = fixture;
assert_eq!(actual, expected);
}

#[test]
fn test_wrap_pasted_text_existing_file() {
// /usr/bin/env exists on macOS/Linux
Expand Down
Loading