genbox 1.0.193 → 1.0.195

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.
@@ -58,17 +58,20 @@ const select_1 = __importDefault(require("@inquirer/select"));
58
58
  const prompts_1 = require("@inquirer/prompts");
59
59
  const config_store_1 = require("../config-store");
60
60
  const api_1 = require("../api");
61
+ const ssh_keys_1 = require("../utils/ssh-keys");
62
+ const native_session_manager_1 = require("../lib/native-session-manager");
61
63
  const child_process_1 = require("child_process");
62
64
  const os = __importStar(require("os"));
63
65
  const path = __importStar(require("path"));
64
66
  const fs = __importStar(require("fs"));
65
67
  // Helper functions
66
68
  function getPrivateSshKey() {
67
- const keyPath = path.join(os.homedir(), '.ssh', 'genbox_key');
68
- if (!fs.existsSync(keyPath)) {
69
+ try {
70
+ return (0, ssh_keys_1.getPrivateSshKeyPath)();
71
+ }
72
+ catch {
69
73
  return null;
70
74
  }
71
- return keyPath;
72
75
  }
73
76
  function getDtachSocketDir() {
74
77
  return path.join(os.homedir(), '.genbox', 'sockets');
@@ -147,9 +150,11 @@ async function ensureLocalDtach() {
147
150
  async function getGenboxes(includesStopped = true) {
148
151
  try {
149
152
  const response = await (0, api_1.fetchApi)('/genboxes');
150
- const genboxes = response?.genboxes || [];
153
+ // API returns array directly, not wrapped in { genboxes: [...] }
154
+ const genboxes = Array.isArray(response) ? response : response?.genboxes || [];
151
155
  if (includesStopped) {
152
156
  // Return all genboxes (running first, then stopped)
157
+ // Also include orphan genboxes (no project, workspace=default) from `gb new`
153
158
  return genboxes
154
159
  .filter(g => g.status === 'running' || g.status === 'stopped')
155
160
  .sort((a, b) => {
@@ -413,11 +418,17 @@ async function startDirectSession(provider) {
413
418
  }
414
419
  const useDtach = dtachStatus === 'available';
415
420
  ensureLocalSocketDir();
416
- const sessionName = `${provider}-${Date.now().toString(36)}`;
421
+ // Register session with NativeSessionManager for tracking
422
+ const nativeManager = (0, native_session_manager_1.getNativeSessionManager)();
423
+ const nativeSession = await nativeManager.createSession({
424
+ provider: provider,
425
+ projectPath: process.cwd(),
426
+ });
427
+ const sessionName = nativeSession.name;
417
428
  const cliCommand = provider === 'claude'
418
429
  ? 'claude --dangerously-skip-permissions'
419
430
  : provider === 'gemini'
420
- ? 'gemini'
431
+ ? 'gemini --yolo'
421
432
  : 'codex';
422
433
  console.log(chalk_1.default.dim(`\nStarting ${provider} session...`));
423
434
  if (useDtach) {
@@ -427,6 +438,8 @@ async function startDirectSession(provider) {
427
438
  console.log(chalk_1.default.dim('Note: Session will end when you exit (no persistence)\n'));
428
439
  }
429
440
  const socketPath = path.join(getDtachSocketDir(), `${sessionName}.sock`);
441
+ // Update socket name in session record
442
+ nativeSession.dtachSocketName = sessionName;
430
443
  let cmd;
431
444
  if (useDtach) {
432
445
  cmd = `dtach -A "${socketPath}" bash -c '${cliCommand}'`;
@@ -434,6 +447,8 @@ async function startDirectSession(provider) {
434
447
  else {
435
448
  cmd = cliCommand;
436
449
  }
450
+ // Mark session as running
451
+ nativeManager.markRunning(nativeSession.id);
437
452
  const proc = (0, child_process_1.spawn)('bash', ['-c', cmd], { stdio: 'inherit' });
438
453
  await new Promise((resolve) => {
439
454
  proc.on('close', () => {
@@ -443,6 +458,8 @@ async function startDirectSession(provider) {
443
458
  }
444
459
  else {
445
460
  console.log(chalk_1.default.dim('\nSession ended.'));
461
+ // Mark session as stopped if not using dtach or socket doesn't exist
462
+ nativeManager.markStopped(nativeSession.id);
446
463
  }
447
464
  resolve();
448
465
  });
@@ -43,7 +43,10 @@ async function getGenboxes(options = {}) {
43
43
  if (!options.all) {
44
44
  const projectName = getProjectContext();
45
45
  if (projectName) {
46
- genboxes = genboxes.filter(g => g.project === projectName || g.workspace === projectName);
46
+ genboxes = genboxes.filter(g => g.project === projectName ||
47
+ g.workspace === projectName ||
48
+ // Also include "orphan" genboxes (no project) - e.g., from `gb new`
49
+ (!g.project && g.workspace === 'default'));
47
50
  }
48
51
  }
49
52
  return genboxes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genbox",
3
- "version": "1.0.193",
3
+ "version": "1.0.195",
4
4
  "description": "Genbox CLI - AI-Powered Development Environments",
5
5
  "main": "dist/index.js",
6
6
  "bin": {