Publish the TypeScript SDK and integration guides (#3141)

* feat(client): publish the TypeScript SDK surface

Make the high-level client API usable for external integrations and document complete agent, workspace, provider, event, and recipe flows.

* fix(client): correlate provider snapshots by daemon cwd

Return the daemon's canonical snapshot identity so waitForReady can match updates for relative, tilde, and otherwise non-canonical paths without duplicating filesystem rules in the SDK.

* test(server): make snapshot cwd assertion portable

* fix(client): gate canonical provider snapshot waits

Older daemons do not expose the canonical snapshot identity needed to correlate workspace updates safely. Require the advertised capability and fail with an update-host message instead of guessing across workspaces.
This commit is contained in:
Mohamed Boudra
2026-08-10 13:22:20 +02:00
committed by GitHub
parent 05a0cabc07
commit 7954babca6
24 changed files with 1956 additions and 197 deletions
@@ -14,13 +14,11 @@ export async function createCodexAgent(url: string, cwd: string): Promise<string
const agent = await client.agents.create({
config: {
...client.providers.codex({
model: "gpt-5.2",
modeId: "full-auto",
}),
cwd,
provider: "codex/gpt-5.5",
modeId: "full-access",
},
initialPrompt: "Inspect this repository and summarize the next useful task.",
cwd,
prompt: "Inspect this repository and summarize the next useful task.",
});
return agent.id;
@@ -35,18 +33,18 @@ export async function chooseProviderFromSnapshot(url: string, cwd: string): Prom
try {
await client.connect();
const snapshot = await client.providers.snapshot({ cwd });
const snapshot = await client.providers.waitForReady({ cwd });
const readyProvider = snapshot.entries.find((provider) => provider.status === "ready");
const providerConfig = readyProvider
? client.providers.config(readyProvider.provider)
: client.providers.claude();
const model =
readyProvider?.models?.find((candidate) => candidate.isDefault) ?? readyProvider?.models?.[0];
if (!readyProvider || !model) throw new Error("No provider model is ready");
const agent = await client.agents.create({
config: {
...providerConfig,
cwd,
provider: `${readyProvider.provider}/${model.id}`,
},
initialPrompt: "Start with a quick repository map.",
cwd,
prompt: "Start with a quick repository map.",
});
return agent.id;
@@ -54,3 +52,16 @@ export async function chooseProviderFromSnapshot(url: string, cwd: string): Prom
await client.close();
}
}
export async function runFollowUp(url: string, agentId: string): Promise<string | null> {
const client = createClient(url);
try {
await client.connect();
const result = await client.agents.ref(agentId).run("Summarize your progress and next step.");
if (result.status !== "idle") throw new Error(result.error ?? result.status);
return result.lastMessage;
} finally {
await client.close();
}
}