burgee 0.12.0 → 0.12.1

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/mcp.js +20 -1
  2. package/package.json +1 -1
package/dist/mcp.js CHANGED
@@ -62,6 +62,24 @@ export function argvOf(node, root, args) {
62
62
  }
63
63
  const STDOUT_CONSOLE = ['log', 'info', 'debug', 'dir', 'dirxml', 'table', 'group', 'groupCollapsed', 'groupEnd', 'count', 'countReset', 'time', 'timeLog', 'timeEnd'];
64
64
  let framing = false;
65
+ let sessions = 0;
66
+ let release = () => undefined;
67
+ function holdStdout() {
68
+ if (sessions++ === 0) {
69
+ const stdout = host.stdout;
70
+ const write = stdout.write;
71
+ stdout.write = function (...args) {
72
+ return Reflect.apply(framing ? write : host.stderr.write, framing ? stdout : host.stderr, args);
73
+ };
74
+ release = () => void (stdout.write = write);
75
+ }
76
+ let held = true;
77
+ return () => {
78
+ if (held && --sessions === 0)
79
+ release();
80
+ held = false;
81
+ };
82
+ }
65
83
  async function printedBy(run) {
66
84
  const chunks = [];
67
85
  const decoder = new TextDecoder();
@@ -162,7 +180,8 @@ export function startMcp(manifest, opts) {
162
180
  session.invoke = invoke;
163
181
  reply({ method: 'notifications/tools/list_changed' });
164
182
  };
165
- const done = serve(session, opts.input, reply);
183
+ const unhold = holdStdout();
184
+ const done = serve(session, opts.input, reply).finally(unhold);
166
185
  return { done, swap };
167
186
  }
168
187
  export async function serveMcp(manifest, opts) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "burgee",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "An agent-native CLI framework, drop-in compatible with commander and yargs. One declaration; help, --json, --schema, --mcp and completions all projected from it.",
5
5
  "license": "MIT",
6
6
  "type": "module",