-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Goal Reference
This issue was generated from .fleet/goals/api-sync.md. The worker agent should read this file for full context including verification commands, constraints, and structural guidance.
Objective
Update the SourceContext type in the SDK to include the new workingBranch and environmentVariablesEnabled optional fields defined in the API Discovery Document.
Code-Level Diagnosis
Code path: packages/core/src/types.ts -> interface SourceContext
Mechanism: The SDK's SourceContext interface only defines source and githubRepoContext. The API Discovery Document now includes workingBranch and environmentVariablesEnabled.
Root cause: Missing type definitions for new optional fields on SourceContext.
Current Implementation
export interface SourceContext {
/**
* The name of the source (e.g., "sources/github/owner/repo").
*/
source: string;
/**
* Context specific to GitHub repos.
*/
githubRepoContext?: {
startingBranch: string;
};
}Proposed Implementation
Files to modify:
packages/core/src/types.ts: UpdateSourceContextto includeworkingBranchandenvironmentVariablesEnabled.packages/core/src/client.ts(or whereverSourceContextis constructed fromSessionConfig): Pass throughworkingBranchandenvironmentVariablesEnabledif they are defined onSessionConfig(this requires updatingSessionConfigto support them as well).
Let's look closely at SessionConfig in packages/core/src/types.ts:
export interface SessionConfig {
prompt: string;
title?: string;
source?: SourceInput;
autoPr?: boolean;
requireApproval?: boolean;
}We can add workingBranch?: string and environmentVariablesEnabled?: boolean to SourceInput. Wait, workingBranch and environmentVariablesEnabled make sense to be part of the SourceInput or SessionConfig. Let's add them to SessionConfig or SourceInput. The API takes them inside sourceContext.
Integration (Before -> After)
packages/core/src/types.ts
@@ -155,6 +155,14 @@
*/
github: string;
baseBranch?: string;
+ /**
+ * The branch to push to for the session.
+ */
+ workingBranch?: string;
+ /**
+ * Enables environment variables in the session.
+ */
+ environmentVariablesEnabled?: boolean;
}
/**
@@ -382,6 +390,14 @@
githubRepoContext?: {
startingBranch: string;
};
+ /**
+ * The branch to push to for the session.
+ */
+ workingBranch?: string;
+ /**
+ * Enables environment variables in the session.
+ */
+ environmentVariablesEnabled?: boolean;
}packages/core/src/client.ts (Assuming this is where sourceContext is built)
@@ -628,6 +628,8 @@
startingBranch: sourceInput.baseBranch || 'main',
},
+ workingBranch: sourceInput.workingBranch,
+ environmentVariablesEnabled: sourceInput.environmentVariablesEnabled,
}Test Scenarios
- Valid Source Input with new fields: Passing
workingBranchandenvironmentVariablesEnabledinSessionConfig.sourcepropagates correctly to thesourceContextin the API request.
Target Files
packages/core/src/types.tspackages/core/src/client.ts
Boundary Rules
Restrict your modifications exclusively to the files listed in the Target Files section. Ensure your source changes are entirely backward-compatible if unowned tests outside your boundary fail. Retain all existing file names and locations outside your explicitly declared target list.
Fleet Context
- Source:
jules:session:16492960175278843187 - Link: https://jules.google.com/session/16492960175278843187