Files
buzz/desktop/src/shared/api/tauriManagedAgents.ts
thomaspblock 87f8ff82ae feat(desktop): refine repository-aware project workspaces (#6003)
## Summary
- Makes Projects repository-aware across browsing, branch and tag
selection, local and remote source management, work items, commits, and
contextual repository actions.
- Refines project details into consistent single-column reading surfaces
with a resizable, section-aware context pod, while keeping project
conversations available in the attached chat panel.
- Adds persistent sidebar project navigation, direct entity links,
repository discussion channels, contributor identity matching, and
consistent loading and activity presentation.
- Keeps branch-specific controls on code-oriented sections while Tasks,
Reviews, and Channels remain repository-scoped, reducing misleading
context and actions.

Replacement for #5981 with an identical final tree flattened into one
signed-off commit because the required DCO check suite remained stalled.

### Related issue
N/A

### Testing
- [x] Desktop pre-push checks, TypeScript typecheck, and unit tests
- [x] E2E production build with `pnpm build:e2e`
- [x] Focused Playwright smoke coverage for project workspace, task,
review, commit, sidebar, and contextual-panel behavior
- [ ] Attach final before/after screenshots after design review

---------

Signed-off-by: Thomas Petersen <thomasp@squareup.com>
Signed-off-by: Wintermute <165f0c871dd2586bb18b6aa109eeaf57bb2132ff4d27b10120f4368a0f627022@buzz.block.builderlab.xyz>
Co-authored-by: Wintermute <165f0c871dd2586bb18b6aa109eeaf57bb2132ff4d27b10120f4368a0f627022@buzz.block.builderlab.xyz>
2026-08-19 12:50:00 +01:00

125 lines
3.4 KiB
TypeScript

import {
fromRawManagedAgent,
invokeTauri,
type RawManagedAgent,
} from "@/shared/api/tauri";
import type {
ManagedAgent,
ManagedAgentRuntimeStatus,
} from "@/shared/api/types";
export async function startManagedAgent(
pubkey: string,
options?: {
/** Tenant scope captured by the caller before its first await; the
* backend fails closed before any spawn/deploy side effect when the
* active community no longer matches. */
expectedRelayUrl?: string;
/** Signer identity captured with the relay scope; the backend fails
* closed when the active workspace identity no longer matches. */
expectedSignerPubkey?: string;
},
): Promise<ManagedAgent> {
const response = await invokeTauri<RawManagedAgent>("start_managed_agent", {
pubkey,
expectedRelayUrl: options?.expectedRelayUrl ?? null,
expectedSignerPubkey: options?.expectedSignerPubkey ?? null,
});
return fromRawManagedAgent(response);
}
export async function stopManagedAgent(pubkey: string): Promise<ManagedAgent> {
const response = await invokeTauri<RawManagedAgent>("stop_managed_agent", {
pubkey,
});
return fromRawManagedAgent(response);
}
export async function setManagedAgentStartOnAppLaunch(
pubkey: string,
startOnAppLaunch: boolean,
): Promise<ManagedAgent> {
const response = await invokeTauri<RawManagedAgent>(
"set_managed_agent_start_on_app_launch",
{
pubkey,
startOnAppLaunch,
},
);
return fromRawManagedAgent(response);
}
export async function setManagedAgentAutoRestart(
pubkey: string,
autoRestartOnConfigChange: boolean,
): Promise<ManagedAgent> {
const response = await invokeTauri<RawManagedAgent>(
"set_managed_agent_auto_restart",
{
pubkey,
autoRestartOnConfigChange,
},
);
return fromRawManagedAgent(response);
}
/**
* B5: persist the canonical startup effort for a local managed agent. Applied
* as `BUZZ_ACP_EFFORT_LEVEL` at the next spawn. Pass `null` to clear (reverts
* to the adapter default). Rejects non-local agents.
*/
export async function persistAgentEffortLevel(
pubkey: string,
effortLevel: string | null,
): Promise<void> {
return invokeTauri<void>("persist_agent_effort_level", {
pubkey,
effortLevel,
});
}
export async function listManagedAgentRuntimes(): Promise<
ManagedAgentRuntimeStatus[]
> {
return invokeTauri<ManagedAgentRuntimeStatus[]>(
"list_managed_agent_runtimes",
);
}
export async function startManagedAgentRuntime(
pubkey: string,
relayUrl: string,
): Promise<ManagedAgentRuntimeStatus> {
return invokeTauri("start_managed_agent_runtime", { pubkey, relayUrl });
}
export async function stopManagedAgentRuntime(
pubkey: string,
relayUrl: string,
): Promise<ManagedAgentRuntimeStatus> {
return invokeTauri("stop_managed_agent_runtime", { pubkey, relayUrl });
}
export async function restartManagedAgentRuntime(
pubkey: string,
relayUrl: string,
): Promise<ManagedAgentRuntimeStatus> {
return invokeTauri("restart_managed_agent_runtime", { pubkey, relayUrl });
}
export async function putManagedAgentRuntimeLifecycle(
outerPubkey: string,
payload: unknown,
): Promise<ManagedAgentRuntimeStatus> {
return invokeTauri("put_managed_agent_runtime_lifecycle", {
outerPubkey,
payload,
});
}
export async function reconcileManagedAgentRuntimes(
communities: readonly { relayUrl: string }[],
): Promise<ManagedAgentRuntimeStatus[]> {
return invokeTauri("reconcile_managed_agent_runtimes", { communities });
}