Skip to content

Conversation

@jsibbison-square
Copy link
Contributor

@jsibbison-square jsibbison-square commented Jul 17, 2025

Summary

Centralized deeplink recipe encoding/decoding logic in goose-server to ensure consistency and avoid incompatibility across different implementations, as discussed in PR #3446 review.

Key Changes

  • Centralized Logic:

    • All deeplink recipe encoding/decoding now uses a single implementation in the backend (goose-server).
    • Adopted base64 (URL-safe, no padding) encoding for portability and compactness.
    • Backend includes fallback logic for legacy-encoded deep URLs.
  • Refactoring:

    • Updated CLI and desktop code to use the new centralized server functions for encoding/decoding (call overhead is now <1–2ms vs. previous inline logic).
    • Cleaned up GUI code by merging the incomplete RecipeConfig struct into the more complete Recipe struct—frontend now has a single config representation.

Tested

  • From Recipe Library
  • From recipe generator
    • Open deeplink
    • Import deeplink
  • From cli
    • Open deeplink
    • Import deeplink
  • Create recipe
  • Generate recipe from session
  • Create schedule import deeplink
  • Edit recipe
  • View recipe

Notes

  • Further refactors/cleanups are possible but have been left out to keep this PR small enough.

@jsibbison-square jsibbison-square force-pushed the jsibbison-20250717-central-deeplinks branch from a9a787e to bfc7118 Compare July 17, 2025 21:28
@jsibbison-square jsibbison-square force-pushed the jsibbison-20250717-central-deeplinks branch from bfc7118 to 3451eb3 Compare July 17, 2025 21:51
Router::new()
.route("/recipe/create", post(create_recipe))
.route("/recipes/encode", post(encode_recipe))
.route("/recipes/decode", post(decode_recipe))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should move /recipe to /recipes in a future pr

Copy link
Contributor

Choose a reason for hiding this comment

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

agree

@jsibbison-square jsibbison-square marked this pull request as ready for review July 18, 2025 01:23
@jsibbison-square jsibbison-square changed the title Centralise deeplink encode and decode into server chore: Centralise deeplink encode and decode into server Jul 18, 2025
@jsibbison-square jsibbison-square changed the title chore: Centralise deeplink encode and decode into server refactor: Centralise deeplink encode and decode into server Jul 18, 2025
Copy link
Collaborator

@DOsinga DOsinga left a comment

Choose a reason for hiding this comment

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

thanks for jumping on this. my main concern is the way that we have done the API integration in the past and now follow up, sidestepping our open-api setup -

just generate-openapi

const generateLink = async () => {
setIsGeneratingLink(true);
try {
const currentConfig = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

here and elsewhere, I'm not sure why we use the word config when we meant to say recipe or recipeToEncode or some such

}

// When opening the app with a deeplink, the window is still initializing so we have to duplicate some window dependant logic here.
async function decodeRecipeMain(deeplink: string, port: number): Promise<Recipe | null> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

... and hopefully in the not so distant future we can just send the deeplink along when we initialize the backend

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah only soo much refactoring could be done at a time.

error: Option<String>,
}

#[derive(Debug, Deserialize)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like this entire recipe thing is not part of our open-api integration somehow. this should be integrated with openapi.rs and then we can autogenerate the ts code. can you check how much work it is to do this the right way? if too much, we can do in a follow up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not familiar with the open-api pieces. I can rectifying that in a future pr.

@DOsinga DOsinga self-assigned this Jul 18, 2025
…ntral-deeplinks

* origin/main: (22 commits)
  feat: deprecate jetbrains extension in favor of public one (#2589)
  feat: Add LiteLLM provider with automatic prompt caching support (#3380)
  docs: update desktop instructions for managing sessions (#3522)
  docs: update desktop instructions for session recipes (#3521)
  Replace mcp_core::content types with rmcp::model types (#3500)
  docs: update desktop instructions for tool perms (#3518)
  docs: update desktop instructions for tool router (#3519)
  Alexhancock/reapply 3491 (#3515)
  docs: update mcp install instructions for desktop (#3504)
  Docs: Access settings in new UI (#3514)
  feat: switch from mcp_core::Role to rmcp::model::Role (#3488)
  Revert "fix the output not being visible issue (#3491)" (#3511)
  fix: Load and Use recipes in new window (#3501)
  fix: working dir was not being set correctly  (#3477)
  Fix launching session in new window (#3497)
  Fix tool call allow still showing initial state in chat after navigating back (#3498)
  feat: add rmcp as a workspace dep (#3483)
  feat: consolidate subagent execution for dynamic tasks (#3444)
  fix token alert indicator/popovers hiding and showing (#3492)
  Fix llm errors not propagating to the ui and auto summarize not starting (#3490)
  ...
@jsibbison-square jsibbison-square merged commit e2e656c into main Jul 20, 2025
13 of 16 checks passed
@jsibbison-square jsibbison-square deleted the jsibbison-20250717-central-deeplinks branch July 20, 2025 08:13
zanesq added a commit that referenced this pull request Jul 20, 2025
* 'main' of github.com:block/goose:
  Catch json errors a little better (#3437)
  Rust debug (#3510)
  refactor: Centralise deeplink encode and decode into server (#3489)
use crate::recipe::Recipe;

#[derive(Error, Debug)]
pub enum DecodeError {
Copy link
Contributor

Choose a reason for hiding this comment

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

For future, it would be nice to distinguish the errors.

#[derive(Error, Debug)]
pub enum DecodeError {
    #[error("Invalid base64 encoding")]
    InvalidBase64,
    #[error("Invalid JSON format: {0}")]
    InvalidJson(String),
    #[error("Invalid recipe format: missing required fields")]
    InvalidRecipe,
    #[error("Unsupported deeplink format")]
    UnsupportedFormat,
}

Router::new()
.route("/recipe/create", post(create_recipe))
.route("/recipes/encode", post(encode_recipe))
.route("/recipes/decode", post(decode_recipe))
Copy link
Contributor

Choose a reason for hiding this comment

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

agree

michaelneale added a commit that referenced this pull request Jul 21, 2025
* main:
  Extension Library Improvements (#3541)
  fix(ui): enable selection of zero-config providers in desktop GUI (#3378)
  refactor: Renames recipe route to recipes to be consistent (#3540)
  Blog: Orchestrating 6 Subagents to Build a Collaborative API Playground (#3528)
  Catch json errors a little better (#3437)
  Rust debug (#3510)
  refactor: Centralise deeplink encode and decode into server (#3489)
  feat: deprecate jetbrains extension in favor of public one (#2589)
  feat: Add LiteLLM provider with automatic prompt caching support (#3380)
  docs: update desktop instructions for managing sessions (#3522)
  docs: update desktop instructions for session recipes (#3521)
  Replace mcp_core::content types with rmcp::model types (#3500)
  docs: update desktop instructions for tool perms (#3518)
  docs: update desktop instructions for tool router (#3519)
  Alexhancock/reapply 3491 (#3515)
  docs: update mcp install instructions for desktop (#3504)
  Docs: Access settings in new UI (#3514)
  feat: switch from mcp_core::Role to rmcp::model::Role (#3488)
  Revert "fix the output not being visible issue (#3491)" (#3511)
  fix: Load and Use recipes in new window (#3501)
lifeizhou-ap added a commit that referenced this pull request Jul 22, 2025
* main: (32 commits)
  fix: use sequential when sub recipe task is 1. (#3573)
  fix: track message id to keep like with like (#3572)
  Replace mcp_core::prompt with rmcp::model types (#3561)
  feat (ui): close recipe modals with esc key (#3568)
  feat: recipes can retry with success criteria (#3474)
  Env var to set Ollama request timeout (#3516)
  Updating docs to match new UI (#3552)
  Improve Claude Code provider error message for missing CLI (#3363)
  feat: Work around Gemini API tool call quirks (#3328)
  feat(ui): Source CashSans-Bold and improve overall text rendering (#3091)
  refactor: Use openapi for recipe endpoint types and in frontend (#3548)
  Fix Google Analytics error for local dev (#3544)
  Extension Library Improvements (#3541)
  fix(ui): enable selection of zero-config providers in desktop GUI (#3378)
  refactor: Renames recipe route to recipes to be consistent (#3540)
  Blog: Orchestrating 6 Subagents to Build a Collaborative API Playground (#3528)
  Catch json errors a little better (#3437)
  Rust debug (#3510)
  refactor: Centralise deeplink encode and decode into server (#3489)
  feat: deprecate jetbrains extension in favor of public one (#2589)
  ...
atarantino pushed a commit to atarantino/goose that referenced this pull request Aug 5, 2025
Signed-off-by: Adam Tarantino <tarantino.adam@hey.com>
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.

4 participants