MCPcopy
hub / github.com/codeaashu/claude-code / teleportToRemote

Function teleportToRemote

src/utils/teleport.tsx:730–1190  ·  view source on GitHub ↗
(options: {
  initialMessage: string | null;
  branchName?: string;
  title?: string;
  /**
   * The description of the session. This is used to generate the title and
   * session branch name (unless they are explicitly provided).
   */
  description?: string;
  model?: string;
  permissionMode?: PermissionMode;
  ultraplan?: boolean;
  signal: AbortSignal;
  useDefaultEnvironment?: boolean;
  /**
   * Explicit environment_id (e.g. the code_review synthetic env). Bypasses
   * fetchEnvironments; the usual repo-detection → git source still runs so
   * the container gets the repo checked out (orchestrator reads --repo-dir
   * from pwd, it doesn't clone).
   */
  environmentId?: string;
  /**
   * Per-session env vars merged into session_context.environment_variables.
   * Write-only at the API layer (stripped from Get/List responses). When
   * environmentId is set, CLAUDE_CODE_OAUTH_TOKEN is auto-injected from the
   * caller's accessToken so the container's hook can hit inference (the
   * server only passes through what the caller sends; bughunter.go mints
   * its own, user sessions don't get one automatically).
   */
  environmentVariables?: Record<string, string>;
  /**
   * When set with environmentId, creates and uploads a git bundle of the
   * local working tree (createAndUploadGitBundle handles the stash-create
   * for uncommitted changes) and passes it as seed_bundle_file_id. Backend
   * clones from the bundle instead of GitHub — container gets the caller's
   * exact local state. Needs .git/ only, not a GitHub remote.
   */
  useBundle?: boolean;
  /**
   * Called with a user-facing message when the bundle path is attempted but
   * fails. The wrapper stderr.writes it (pre-REPL). Remote-agent callers
   * capture it to include in their throw (in-REPL, Ink-rendered).
   */
  onBundleFail?: (message: string) => void;
  /**
   * When true, disables the git-bundle fallback entirely. Use for flows like
   * autofix where CCR must push to GitHub — a bundle can't do that.
   */
  skipBundle?: boolean;
  /**
   * When set, reuses this branch as the outcome branch instead of generating
   * a new claude/ branch. Sets allow_unrestricted_git_push on the source and
   * reuse_outcome_branches on the session context so the remote pushes to the
   * caller's branch directly.
   */
  reuseOutcomeBranch?: string;
  /**
   * GitHub PR to attach to the session context. Backend uses this to
   * identify the PR associated with this session.
   */
  githubPr?: {
    owner: string;
    repo: string;
    number: number;
  };
})

Source from the content-addressed store, hash-verified

728 * Backend: anthropic#303856.
729 */
730export async function teleportToRemote(options: {
731 initialMessage: string | null;
732 branchName?: string;
733 title?: string;
734 /**
735 * The description of the session. This is used to generate the title and
736 * session branch name (unless they are explicitly provided).
737 */
738 description?: string;
739 model?: string;
740 permissionMode?: PermissionMode;
741 ultraplan?: boolean;
742 signal: AbortSignal;
743 useDefaultEnvironment?: boolean;
744 /**
745 * Explicit environment_id (e.g. the code_review synthetic env). Bypasses
746 * fetchEnvironments; the usual repo-detection → git source still runs so
747 * the container gets the repo checked out (orchestrator reads --repo-dir
748 * from pwd, it doesn't clone).
749 */
750 environmentId?: string;
751 /**
752 * Per-session env vars merged into session_context.environment_variables.
753 * Write-only at the API layer (stripped from Get/List responses). When
754 * environmentId is set, CLAUDE_CODE_OAUTH_TOKEN is auto-injected from the
755 * caller's accessToken so the container's hook can hit inference (the
756 * server only passes through what the caller sends; bughunter.go mints
757 * its own, user sessions don't get one automatically).
758 */
759 environmentVariables?: Record<string, string>;
760 /**
761 * When set with environmentId, creates and uploads a git bundle of the
762 * local working tree (createAndUploadGitBundle handles the stash-create
763 * for uncommitted changes) and passes it as seed_bundle_file_id. Backend
764 * clones from the bundle instead of GitHub — container gets the caller's
765 * exact local state. Needs .git/ only, not a GitHub remote.
766 */
767 useBundle?: boolean;
768 /**
769 * Called with a user-facing message when the bundle path is attempted but
770 * fails. The wrapper stderr.writes it (pre-REPL). Remote-agent callers
771 * capture it to include in their throw (in-REPL, Ink-rendered).
772 */
773 onBundleFail?: (message: string) => void;
774 /**
775 * When true, disables the git-bundle fallback entirely. Use for flows like
776 * autofix where CCR must push to GitHub — a bundle can't do that.
777 */
778 skipBundle?: boolean;
779 /**
780 * When set, reuses this branch as the outcome branch instead of generating
781 * a new claude/ branch. Sets allow_unrestricted_git_push on the source and
782 * reuse_outcome_branches on the session context so the remote pushes to the
783 * caller's branch directly.
784 */
785 reuseOutcomeBranch?: string;
786 /**
787 * GitHub PR to attach to the session context. Backend uses this to

Callers 4

callFunction · 0.85
launchDetachedFunction · 0.85
launchRemoteReviewFunction · 0.85

Calls 15

getOrganizationUUIDFunction · 0.85
getOauthConfigFunction · 0.85
getOAuthHeadersFunction · 0.85
createAndUploadGitBundleFunction · 0.85
getSessionIdFunction · 0.85
logEventFunction · 0.85
logForDebuggingFunction · 0.85
jsonStringifyFunction · 0.85
generateTitleAndBranchFunction · 0.85
getCwdFunction · 0.85

Tested by

no test coverage detected