mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-21 22:01:49 +00:00
chore(foundry): improve sandbox impl + status pill (#252)
* Improve Daytona sandbox provisioning and frontend UI Refactor git clone script in Daytona provider to use cleaner shell logic for GitHub token authentication and branch checkout. Add support for private repository clones with token-based auth. Improve Daytona provider error handling and git configuration setup. Frontend improvements include enhanced dev panel, workspace dashboard, sidebar navigation, and UI components for better task/session management. Update interest manager and backend client to support improved session state handling. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> * Add header status pill showing task/session/sandbox state Surface aggregate status (error, provisioning, running, ready, no sandbox) as a colored pill in the transcript panel header. Integrates task runtime status, session status, and sandbox availability via the sandboxProcesses interest topic so the pill accurately reflects unreachable sandboxes. Includes mock tasks demonstrating error, provisioning, and running states, unit tests for deriveHeaderStatus, and workspace-dashboard integration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
5a1b32a271
commit
70d31f819c
82 changed files with 2625 additions and 4166 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import type { BackendClient } from "../backend-client.js";
|
||||
import type { InterestManager, TopicStatus } from "./manager.js";
|
||||
import type { DebugInterestTopic, InterestManager, TopicStatus } from "./manager.js";
|
||||
import { topicDefinitions, type TopicData, type TopicDefinition, type TopicKey, type TopicParams } from "./topics.js";
|
||||
|
||||
const GRACE_PERIOD_MS = 30_000;
|
||||
|
|
@ -19,7 +19,7 @@ export class RemoteInterestManager implements InterestManager {
|
|||
let entry = this.entries.get(cacheKey);
|
||||
|
||||
if (!entry) {
|
||||
entry = new TopicEntry(definition, this.backend, params as any);
|
||||
entry = new TopicEntry(topicKey, cacheKey, definition, this.backend, params as any);
|
||||
this.entries.set(cacheKey, entry);
|
||||
}
|
||||
|
||||
|
|
@ -53,6 +53,13 @@ export class RemoteInterestManager implements InterestManager {
|
|||
return this.entries.get((topicDefinitions[topicKey] as any).key(params))?.error ?? null;
|
||||
}
|
||||
|
||||
listDebugTopics(): DebugInterestTopic[] {
|
||||
return [...this.entries.values()]
|
||||
.filter((entry) => entry.listenerCount > 0)
|
||||
.map((entry) => entry.getDebugTopic())
|
||||
.sort((left, right) => left.cacheKey.localeCompare(right.cacheKey));
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
for (const entry of this.entries.values()) {
|
||||
entry.dispose();
|
||||
|
|
@ -66,6 +73,7 @@ class TopicEntry<TData, TParams, TEvent> {
|
|||
status: TopicStatus = "loading";
|
||||
error: Error | null = null;
|
||||
listenerCount = 0;
|
||||
lastRefreshAt: number | null = null;
|
||||
|
||||
private readonly listeners = new Set<() => void>();
|
||||
private conn: Awaited<ReturnType<TopicDefinition<TData, TParams, TEvent>["connect"]>> | null = null;
|
||||
|
|
@ -76,11 +84,23 @@ class TopicEntry<TData, TParams, TEvent> {
|
|||
private started = false;
|
||||
|
||||
constructor(
|
||||
private readonly topicKey: TopicKey,
|
||||
private readonly cacheKey: string,
|
||||
private readonly definition: TopicDefinition<TData, TParams, TEvent>,
|
||||
private readonly backend: BackendClient,
|
||||
private readonly params: TParams,
|
||||
) {}
|
||||
|
||||
getDebugTopic(): DebugInterestTopic {
|
||||
return {
|
||||
topicKey: this.topicKey,
|
||||
cacheKey: this.cacheKey,
|
||||
listenerCount: this.listenerCount,
|
||||
status: this.status,
|
||||
lastRefreshAt: this.lastRefreshAt,
|
||||
};
|
||||
}
|
||||
|
||||
addListener(listener: () => void): void {
|
||||
this.listeners.add(listener);
|
||||
this.listenerCount = this.listeners.size;
|
||||
|
|
@ -125,6 +145,7 @@ class TopicEntry<TData, TParams, TEvent> {
|
|||
this.data = undefined;
|
||||
this.status = "loading";
|
||||
this.error = null;
|
||||
this.lastRefreshAt = null;
|
||||
this.started = false;
|
||||
}
|
||||
|
||||
|
|
@ -140,6 +161,7 @@ class TopicEntry<TData, TParams, TEvent> {
|
|||
return;
|
||||
}
|
||||
this.data = this.definition.applyEvent(this.data, event);
|
||||
this.lastRefreshAt = Date.now();
|
||||
this.notify();
|
||||
});
|
||||
this.unsubscribeError = this.conn.onError((error: unknown) => {
|
||||
|
|
@ -149,6 +171,7 @@ class TopicEntry<TData, TParams, TEvent> {
|
|||
});
|
||||
this.data = await this.definition.fetchInitial(this.backend, this.params);
|
||||
this.status = "connected";
|
||||
this.lastRefreshAt = Date.now();
|
||||
this.started = true;
|
||||
this.notify();
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue