Skip to content

fix: add editV2 types and method to agent-bridge client#27

Open
galligan wants to merge 2 commits intoEveryInc:mainfrom
galligan:galligan/fix-editv2-bridge-types
Open

fix: add editV2 types and method to agent-bridge client#27
galligan wants to merge 2 commits intoEveryInc:mainfrom
galligan:galligan/fix-editv2-bridge-types

Conversation

@galligan
Copy link

Summary

The @proof/agent-bridge client is missing editV2 support. The issue (#22) reported mismatched field names (revision/ops vs baseRevision/operations), but the root cause is that the editV2 method and types don't exist in the bridge client at all.

This adds:

  • EditV2BlockOp — discriminated union matching all six server operation types (replace_block, insert_after, insert_before, delete_block, replace_range, find_replace_in_block)
  • EditV2Input — interface with correct field names (baseRevision, operations) matching server/agent-edit-v2.ts
  • editV2() method on the bridge client, posting to /documents/:slug/edit/v2

Test plan

  • createAgentBridgeClient(config).editV2(slug, { by, baseRevision, operations }) sends correct payload
  • Server accepts the request without "baseRevision is required" error
  • TypeScript catches wrong field names at compile time

Closes #22

🤘🏻 In-collaboration-with: Claude Code

The bridge client was missing editV2 support entirely. Adds:
- EditV2BlockOp union type matching server's operation types
- EditV2Input interface with correct field names (baseRevision,
  operations) matching server/agent-edit-v2.ts
- editV2() method on the bridge client

Closes EveryInc#22

🤘🏻 In-collaboration-with: [Claude Code](https://claude.com/claude-code)
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d8c1418cc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The server reads idempotency keys from the Idempotency-Key header,
not from the request body. Extract idempotencyKey from EditV2Input
and send it as a header so the server's idempotency flow works
correctly when IDEMPOTENCY_KEY_REQUIRED is enabled.

🤘🏻 In-collaboration-with: [Claude Code](https://claude.com/claude-code)
@galligan
Copy link
Author

Addressed in ef33f1c. The idempotencyKey is now extracted from the input and sent as an Idempotency-Key request header, which is where the server's getIdempotencyKey reads it from. The key is stripped from the JSON body so it doesn't get sent in both places.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EditV2Input type sends wrong field names — revision/ops vs server's baseRevision/operations

1 participant