An open-source, faster Devin alternative
TypeScript
fix(flue): handle repository source limits
Igor Zalutskif6012a772ba6
diff --git a/sdks/flue/README.md b/sdks/flue/README.mdindex 88d0b319..68ef782e 100644--- a/sdks/flue/README.md+++ b/sdks/flue/README.md@@ -77,7 +77,9 @@ OpenComputer policy and GitHub App grant. `add_source` pins the selected ref toan exact commit and returns its `/workspace/sources/...` path.`github_publish_pull_request` publishes that source's inspected changes on an`oc/...` branch. The tools do not default to the deployment repository, expose-credentials, or perform fuzzy repository selection.+credentials, or perform fuzzy repository selection. A session supports up to+eight sources; reuse an existing source or start a new session after reaching+that limit.Direct text sessions, managed Slack, workflows, and optional demand-drivensandboxes continue to use ordinary Flue behavior.diff --git a/sdks/flue/src/repo.test.ts b/sdks/flue/src/repo.test.tsindex 3e59ded9..1093487f 100644--- a/sdks/flue/src/repo.test.ts+++ b/sdks/flue/src/repo.test.ts@@ -58,6 +58,9 @@ describe("ocRepoTools contract", () => {expect(list?.description).toMatch(/otherwise ask/);expect(add?.description).toMatch(/await this tool before filesystem work/);expect(add?.description).toMatch(/returned \/workspace\/sources/);+ expect(add?.description).toMatch(+ /reuse an existing source or start a new session/,+ );expect(publish?.description).toMatch(/inspect and test the diff/);expect(publish?.description).toMatch(/exact repository, base branch, and intended diff/,@@ -162,6 +165,7 @@ describe("list_working_repos HTTP fixtures", () => {["repository_not_found", 404, false],["repository_rate_limited", 429, true],["source_name_taken", 409, false],+ ["source_limit_reached", 409, false],["source_unresolved", 422, true],["source_materialization_failed", 503, true],["source_not_ready", 409, true],diff --git a/sdks/flue/src/repo.ts b/sdks/flue/src/repo.tsindex 09284b55..745e2ff7 100644--- a/sdks/flue/src/repo.ts+++ b/sdks/flue/src/repo.ts@@ -22,6 +22,7 @@ const ERROR_CODES = ["repository_not_found","repository_rate_limited","source_name_taken",+ "source_limit_reached","source_unresolved","source_materialization_failed","source_not_ready",@@ -236,6 +237,7 @@ const HTTP_BY_ERROR: Readonly<repository_not_found: [404],repository_rate_limited: [429],source_name_taken: [409],+ source_limit_reached: [409],source_unresolved: [422],source_materialization_failed: [502, 503],source_not_ready: [409],@@ -258,6 +260,7 @@ const RETRYABLE_BY_ERROR: Readonly<repository_not_found: false,repository_rate_limited: true,source_name_taken: false,+ source_limit_reached: false,source_not_ready: true,publish_in_progress: true,stale_deployment_token: false,@@ -438,7 +441,7 @@ export function ocRepoTools(const addSource = defineTool({name: "add_source",description:- "Pin and materialize one exact repository source after list_working_repos resolved it. Tell the user the exact owner/repository first, await this tool before filesystem work, then use only the returned /workspace/sources/... path. On a product error, explain its stated recovery instead of guessing another target.",+ "Pin and materialize one exact repository source after list_working_repos resolved it. Tell the user the exact owner/repository first, await this tool before filesystem work, then use only the returned /workspace/sources/... path. If the session has reached its source limit, reuse an existing source or start a new session. On any product error, explain its stated recovery instead of guessing another target.",input: AddSourceInputSchema,output: AddSourceResultSchema,async run({ input, signal }) {