Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

feat(antigravity): provider-aware session resume + station-walking for agy tools

Gulum950949ec8d83
diff --git a/src/main/index.ts b/src/main/index.ts
index 89e64f38..85b10dc0 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -25,7 +25,7 @@ import { listIssues, listCIRuns } from './github';
import { SlackWebhookServer } from './slack';
import { TelemetryCollector } from './telemetry';
import { ControlRegistry } from './control';
-import { inferAgentProvider, isClaudeProvider, type AgentProvider } from '../shared/agentProvider';
+import { inferAgentProvider, isClaudeProvider, providerPreset, type AgentProvider } from '../shared/agentProvider';
const isDev = !!process.env.ELECTRON_RENDERER_URL;
const ptyManager = new PtyManager();
@@ -711,14 +711,21 @@ ipcMain.handle('pty:spawn', async (_evt, opts: SpawnOptions & { hive?: AgentMeta
if (typeof cfg.maxTurns === 'number' && cfg.maxTurns > 0 && !args.includes('--max-turns')) {
args.push('--max-turns', String(cfg.maxTurns));
}
- // Idempotent resume (#6.6a): only when explicitly requested and we have a
- // prior session id for this agent.
- if (opts.resume === true) {
- const sid = hive.lastSession(opts.hive.id);
- if (sid && !args.includes('--resume')) args.push('--resume', sid);
- }
opts.args = args;
}
+ // Idempotent session resume on respawn (#6.6a) — provider-aware: Claude
+ // `--resume <sid>`, Antigravity `--conversation <id>`. The recorded session id
+ // comes from hook payloads (agy's conversationId flows through the bridge), so
+ // a restored worker continues its prior CLI session. Only when requested AND a
+ // prior id exists for this agent.
+ if (opts.hive && opts.resume === true) {
+ const rf = providerPreset(provider).resumeFlag;
+ const sid = hive.lastSession(opts.hive.id);
+ if (rf && sid) {
+ const args = opts.args ?? [];
+ if (!args.includes(rf)) { args.push(rf, sid); opts.args = args; }
+ }
+ }
// Remember which agent owns this PTY so closing the tab can archive it. A
// live terminal means active — ensureAgent above already cleared `archived`.
if (opts.hive?.id) ptyToAgent.set(opts.id, opts.hive.id);
diff --git a/src/preload/index.ts b/src/preload/index.ts
index 4b26bf48..829d6f0c 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -74,6 +74,9 @@ export interface SpawnPtyOptions {
hive?: HiveAgentMeta;
/** When true (and cwd is a git repo), spawn the agent in its own git worktree. */
isolate?: boolean;
+ /** When true, continue the agent's prior CLI session if one was recorded
+ * (provider-aware: Claude `--resume`, Antigravity `--conversation`). */
+ resume?: boolean;
}
export interface PtyExit { exitCode: number; signal?: number | undefined }
diff --git a/src/renderer/src/components/AgentStrip.tsx b/src/renderer/src/components/AgentStrip.tsx
index ad272479..3c66f0f8 100644
--- a/src/renderer/src/components/AgentStrip.tsx
+++ b/src/renderer/src/components/AgentStrip.tsx
@@ -39,6 +39,10 @@ export function AgentStrip({ config }: AgentStripProps) {
args,
cols: 100,
rows: 30,
+ // Continue the worker's prior CLI session if one was recorded — the
+ // main process picks the provider's resume flag (Claude --resume,
+ // agy --conversation). No-op when there's no recorded session id.
+ resume: true,
// Re-request isolation if the agent ran in its own worktree before —
// the old worktree was torn down on exit, so a fresh one is created.
isolate: !!a.worktreePath,
diff --git a/src/renderer/src/hooks/useHive.ts b/src/renderer/src/hooks/useHive.ts
index eaeef59b..98da4018 100644
--- a/src/renderer/src/hooks/useHive.ts
+++ b/src/renderer/src/hooks/useHive.ts
@@ -104,8 +104,17 @@ const TOOL_STATION: Record<string, { station: StationKind; carry?: ToolKind }> =
* the MCP station (previously these silently sat at the desk, #5A gap); anything
* else → the desk. */
function stationForTool(tool: string): { station: StationKind; carry?: ToolKind } {
- return TOOL_STATION[tool]
- ?? (tool.startsWith('mcp__') ? { station: 'mcp', carry: 'MCP' } : { station: 'desk' });
+ if (TOOL_STATION[tool]) return TOOL_STATION[tool];
+ if (tool.startsWith('mcp__')) return { station: 'mcp', carry: 'MCP' };
+ // Heuristic fallback for non-Claude tool names (Antigravity sends run_command,
+ // ListDir, write_file, … — its hook names differ from Claude's exact tags).
+ // Match write/edit BEFORE read so "write_file" → desk, not shelf.
+ const t = tool.toLowerCase();
+ if (/command|bash|shell|exec|terminal|run_/.test(t)) return { station: 'terminal', carry: 'Bash' };
+ if (/web|fetch|browser|http|url/.test(t)) return { station: 'web', carry: 'WebFetch' };
+ if (/write|edit|create|patch|replace|apply/.test(t)) return { station: 'desk', carry: 'Write' };
+ if (/read|list|view|dir|glob|grep|search|find|file|cat|\bls\b/.test(t)) return { station: 'shelf', carry: 'Read' };
+ return { station: 'desk' };
}
/**
diff --git a/src/shared/agentProvider.ts b/src/shared/agentProvider.ts
index 0eea3a37..7d3d63d2 100644
--- a/src/shared/agentProvider.ts
+++ b/src/shared/agentProvider.ts
@@ -39,6 +39,10 @@ export interface AgentProviderPreset {
* hive identity+protocol rides in as the first turn — the closest thing to
* Claude's `--append-system-prompt` these CLIs offer. undefined = no way in. */
initialPromptFlag?: string;
+ /** Flag to resume a prior session on respawn, given the recorded session id
+ * (Claude `--resume <sid>`, Antigravity `--conversation <id>`). undefined = no
+ * resume support, spawn fresh. */
+ resumeFlag?: string;
}
export const AGENT_PROVIDER_PRESETS: AgentProviderPreset[] = [
@@ -50,7 +54,8 @@ export const AGENT_PROVIDER_PRESETS: AgentProviderPreset[] = [
modelFlag: '--model',
autoFlag: '--permission-mode bypassPermissions',
hiveAware: true,
- canReceiveInbox: true
+ canReceiveInbox: true,
+ resumeFlag: '--resume'
},
{
id: 'antigravity',
@@ -61,7 +66,8 @@ export const AGENT_PROVIDER_PRESETS: AgentProviderPreset[] = [
autoFlag: '--dangerously-skip-permissions',
hiveAware: false,
canReceiveInbox: true, // via the agy-hook bridge (Stop→drain); verified agy honors hook decisions
- initialPromptFlag: '-i' // agy --prompt-interactive: orient the session, then continue
+ initialPromptFlag: '-i', // agy --prompt-interactive: orient the session, then continue
+ resumeFlag: '--conversation' // agy: resume a previous conversation by ID
},
{
id: 'custom',