@bramblex/codex-workbench 0.1.4 → 0.1.5

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.
package/README.md CHANGED
@@ -40,7 +40,7 @@ codex-workbench list
40
40
  ```sh
41
41
  codex-workbench [ui]
42
42
  codex-workbench doctor
43
- codex-workbench list [--json] [--cwd <dir>] [--all]
43
+ codex-workbench list [--json] [--compact] [--cwd <dir>] [--all]
44
44
  codex-workbench show <session>
45
45
  codex-workbench rename <session> <name>
46
46
  codex-workbench note <session> <note>
@@ -73,10 +73,13 @@ Use `list` to find sessions:
73
73
  ```sh
74
74
  codex-workbench list
75
75
  codex-workbench list --json
76
+ codex-workbench list --json --compact
76
77
  codex-workbench list --cwd /path/to/project
77
78
  codex-workbench list --all
78
79
  ```
79
80
 
81
+ Use `--compact` with `--json` when another tool only needs session summaries. It omits the full message history and keeps remote SSH listings small.
82
+
80
83
  Use `new` to start a fresh Codex session in a project directory:
81
84
 
82
85
  ```sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bramblex/codex-workbench",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Terminal workbench for browsing and managing local and SSH Codex sessions.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/cli-output.js CHANGED
@@ -10,7 +10,7 @@ function usage() {
10
10
  Usage:
11
11
  codex-workbench [ui]
12
12
  codex-workbench doctor
13
- codex-workbench list [--json] [--cwd <dir>] [--all]
13
+ codex-workbench list [--json] [--compact] [--cwd <dir>] [--all]
14
14
  codex-workbench show <session>
15
15
  codex-workbench rename <session> <name>
16
16
  codex-workbench note <session> <note>
@@ -41,7 +41,8 @@ function printList(sessions, opts = {}) {
41
41
  return true;
42
42
  });
43
43
  if (opts.json) {
44
- console.log(JSON.stringify(filtered, null, 2));
44
+ const payload = opts.compact ? filtered.map(compactSession) : filtered;
45
+ console.log(JSON.stringify(payload, null, 2));
45
46
  return;
46
47
  }
47
48
  const groups = new Map();
@@ -62,6 +63,11 @@ function printList(sessions, opts = {}) {
62
63
  if (!filtered.length) console.log('No sessions found.');
63
64
  }
64
65
 
66
+ function compactSession(session) {
67
+ const { messages, ...compact } = session;
68
+ return compact;
69
+ }
70
+
65
71
  function printShow(session) {
66
72
  console.log(`${session.name || '(unnamed)'} ${session.archived ? '[archived]' : ''}${session.hidden ? '[hidden]' : ''}`);
67
73
  console.log(`id: ${session.id}`);
@@ -73,7 +79,7 @@ function printShow(session) {
73
79
  console.log(`turns: ${session.turns}`);
74
80
  if (session.note) console.log(`note: ${session.note}`);
75
81
  console.log('\nMessages:');
76
- for (const msg of session.messages) {
82
+ for (const msg of session.messages || []) {
77
83
  if (msg.role === 'developer') continue;
78
84
  const prefix = msg.role === 'assistant' ? 'A' : msg.role === 'user' ? 'U' : msg.role.slice(0, 1).toUpperCase();
79
85
  console.log(` ${prefix}: ${truncate(msg.text, 180)}`);
@@ -102,6 +108,7 @@ function printDoctor() {
102
108
  }
103
109
 
104
110
  module.exports = {
111
+ compactSession,
105
112
  printDoctor,
106
113
  printList,
107
114
  printShow,
package/src/cli.js CHANGED
@@ -27,6 +27,7 @@ function parseFlags(args) {
27
27
  const arg = args[i];
28
28
  if (arg === '--json') out.json = true;
29
29
  else if (arg === '--all') out.all = true;
30
+ else if (arg === '--compact') out.compact = true;
30
31
  else if (arg === '--force') out.force = true;
31
32
  else if (arg === '--file') out.file = true;
32
33
  else if (arg === '--cwd') {
@@ -48,7 +48,7 @@ function loadWorkbenchSessions() {
48
48
 
49
49
  for (const source of sources.filter((candidate) => candidate.remote)) {
50
50
  try {
51
- const remoteSessions = runRemoteCwbJson(source, ['list', '--json']);
51
+ const remoteSessions = runRemoteCwbJson(source, ['list', '--json', '--compact']);
52
52
  if (!Array.isArray(remoteSessions)) throw new Error('remote list did not return an array');
53
53
  sessions.push(...remoteSessions.map((session) => attachSource(session, source)));
54
54
  } catch (err) {
@@ -21,13 +21,19 @@ function runRemoteCwb(server, argv, opts = {}) {
21
21
  return spawnSync('ssh', args, {
22
22
  encoding: opts.encoding,
23
23
  env: process.env,
24
+ maxBuffer: opts.maxBuffer || 64 * 1024 * 1024,
24
25
  stdio: opts.stdio || (opts.encoding ? ['ignore', 'pipe', 'pipe'] : 'inherit'),
25
26
  });
26
27
  }
27
28
 
28
29
  function runRemoteCwbJson(server, argv) {
29
30
  const result = runRemoteCwb(server, argv, { encoding: 'utf8' });
30
- if (result.error) throw result.error;
31
+ if (result.error) {
32
+ if (result.error.code === 'ENOBUFS') {
33
+ throw new Error('remote output exceeded buffer; update the remote codex-workbench so compact listing is available');
34
+ }
35
+ throw result.error;
36
+ }
31
37
  if (result.status !== 0) {
32
38
  const stderr = (result.stderr || '').trim();
33
39
  throw new Error(stderr || `ssh exited with code ${result.status}`);