@bivy/bivy 0.2.0-staging.28 → 0.2.0-staging.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/server.js +18 -2
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -1344,7 +1344,11 @@ async function runTerminalList() {
1344
1344
  const out = [];
1345
1345
  for (const t of runs) {
1346
1346
  let sessionRef = t.meta.sessionId;
1347
- if (!sessionRef && t.meta.autoName) {
1347
+ // Discover the on-disk session for agents that assign their id lazily (Pi,
1348
+ // Codex). Runs whenever there's no pinned id — not just for auto-named
1349
+ // terminals — so the takeover-readiness flag below is accurate even for a
1350
+ // run launched with an explicit --name.
1351
+ if (!sessionRef) {
1348
1352
  try {
1349
1353
  sessionRef = await SESSION_DISCOVERY_BY_AGENT[t.meta.agent ?? ""]?.(t.workspace, t.createdAt);
1350
1354
  }
@@ -1355,7 +1359,11 @@ async function runTerminalList() {
1355
1359
  if (t.meta.autoName && nativeName && !isEmptyUntitledTitle(nativeName))
1356
1360
  t.meta.name = nativeName;
1357
1361
  const { autoName: _autoName, ...publicMeta } = t.meta;
1358
- out.push({ termId: t.id, workspace: t.workspace, createdAt: t.createdAt, lastActivityAt: t.lastActivityAt, pid: terminals.pid(t.id), ...publicMeta });
1362
+ // "Continue as chat" can only adopt a session that exists: a pinned id, or a
1363
+ // session discovered on disk. Surface that so the client can disable the
1364
+ // affordance (with guidance) until the agent has actually started its
1365
+ // session, instead of letting the user tap it and hit a 409.
1366
+ out.push({ termId: t.id, workspace: t.workspace, createdAt: t.createdAt, lastActivityAt: t.lastActivityAt, pid: terminals.pid(t.id), ...publicMeta, takeoverReady: Boolean(sessionRef) });
1359
1367
  }
1360
1368
  return out;
1361
1369
  }
@@ -2581,6 +2589,7 @@ const RELAY_COMMANDS = {
2581
2589
  agent: meta?.runtimeId ?? s.agent,
2582
2590
  agentName: meta?.agentName ?? s.agentName,
2583
2591
  source: rec?.source ?? meta?.source,
2592
+ forkedFrom: rec?.forkedFrom ?? meta?.forkedFrom,
2584
2593
  branch: rec?.worktree?.branch ?? meta?.branch,
2585
2594
  sandbox: rec?.sandbox ?? normalizeSandboxTier(meta?.sandbox),
2586
2595
  prUrl: rec?.prUrl ?? meta?.prUrl,
@@ -5350,6 +5359,11 @@ async function standUpFork(opts) {
5350
5359
  const record = plan.kind === "resume"
5351
5360
  ? await createSession(cwd, plan.sessionFile, { runtimeId: targetRuntimeId, source: bundle.record.source, makeActive: false })
5352
5361
  : await createSession(cwd, undefined, { runtimeId: targetRuntimeId, source: bundle.record.source, makeActive: false });
5362
+ // Mark the new session as a fork of its source, so the run card can show
5363
+ // "Forked from …" and the lineage survives a reload (persisted below). Just
5364
+ // the parent's session id — an identifier, not content, so it's safe to
5365
+ // carry into metadata the same way branch/prUrl already are.
5366
+ record.forkedFrom = bundle.record.sourceSessionId;
5353
5367
  // Attach the reconstructed worktree to the record. createSession only
5354
5368
  // populates record.worktree when it provisions one itself (fresh repo session)
5355
5369
  // or restores it from stored metadata (resume) — neither happens for a fork,
@@ -5703,6 +5717,7 @@ function persistSessionMetadata(record, status = sessionStatus(record)) {
5703
5717
  name: record.session.getName(),
5704
5718
  workspace: record.workspace,
5705
5719
  source: record.source ?? "manual",
5720
+ forkedFrom: record.forkedFrom,
5706
5721
  runtimeId: record.runtimeId,
5707
5722
  sandbox: record.sandbox,
5708
5723
  agentName: getRuntime(record.runtimeId).displayName,
@@ -8421,6 +8436,7 @@ app.get("/api/sessions", async (_req, res, next) => {
8421
8436
  agent: meta?.runtimeId ?? s.agent,
8422
8437
  agentName: meta?.agentName ?? s.agentName,
8423
8438
  source: rec?.source ?? meta?.source,
8439
+ forkedFrom: rec?.forkedFrom ?? meta?.forkedFrom,
8424
8440
  branch: rec?.worktree?.branch ?? meta?.branch,
8425
8441
  prUrl: rec?.prUrl ?? meta?.prUrl,
8426
8442
  prs: rec?.prs ?? meta?.prs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bivy/bivy",
3
- "version": "0.2.0-staging.28",
3
+ "version": "0.2.0-staging.30",
4
4
  "type": "module",
5
5
  "license": "FSL-1.1-ALv2",
6
6
  "description": "Run coding agents on machines you own. Source-available, self-hostable agent workspace.",