@adhdev/daemon-standalone 0.7.44 → 0.7.45

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/dist/index.js CHANGED
@@ -19106,7 +19106,7 @@ function shSingleQuote(arg) {
19106
19106
  }
19107
19107
  return `'${arg.replace(/'/g, `'\\''`)}'`;
19108
19108
  }
19109
- function estimatePromptDisplayLines(text, cols = 100) {
19109
+ function estimatePromptDisplayLines(text, cols = 80) {
19110
19110
  const normalized = String(text || "").replace(/\r/g, "");
19111
19111
  if (!normalized) return 1;
19112
19112
  return normalized.split("\n").reduce((sum, line) => sum + Math.max(1, Math.ceil(Math.max(1, line.length) / cols)), 0);
@@ -19388,8 +19388,8 @@ var init_provider_cli_adapter = __esm2({
19388
19388
  shellArgs = allArgs;
19389
19389
  }
19390
19390
  const ptyOpts = {
19391
- cols: 100,
19392
- rows: 30,
19391
+ cols: 80,
19392
+ rows: 24,
19393
19393
  cwd: this.workingDir,
19394
19394
  env: buildCliSpawnEnv(process.env, spawnConfig.env)
19395
19395
  };
@@ -19445,7 +19445,7 @@ var init_provider_cli_adapter = __esm2({
19445
19445
  this.spawnAt = Date.now();
19446
19446
  this.startupParseGate = true;
19447
19447
  this.startupBuffer = "";
19448
- this.terminalScreen.reset(30, 100);
19448
+ this.terminalScreen.reset(24, 80);
19449
19449
  this.pendingTerminalQueryTail = "";
19450
19450
  this.currentTurnScope = null;
19451
19451
  this.ready = false;
@@ -34695,6 +34695,10 @@ var StandaloneServer = class {
34695
34695
  isTerminalCliSession(sessionId) {
34696
34696
  return this.getCliPresentationMode(sessionId) === "terminal";
34697
34697
  }
34698
+ isCliSession(sessionId) {
34699
+ const mode = this.getCliPresentationMode(sessionId);
34700
+ return mode === "chat" || mode === "terminal";
34701
+ }
34698
34702
  async start(options = {}) {
34699
34703
  const port = options.port || DEFAULT_PORT;
34700
34704
  const host = options.host || "127.0.0.1";
@@ -34706,7 +34710,7 @@ var StandaloneServer = class {
34706
34710
  getServerConn: () => null,
34707
34711
  getP2p: () => ({
34708
34712
  broadcastPtyOutput: (key, data) => {
34709
- if (this.clients.size === 0 || !this.isTerminalCliSession(key)) return;
34713
+ if (this.clients.size === 0 || !this.isCliSession(key)) return;
34710
34714
  const msg = JSON.stringify({ type: "pty_output", sessionId: key, data });
34711
34715
  for (const client of this.clients) {
34712
34716
  if (client.readyState === 1) {
@@ -34921,9 +34925,9 @@ var StandaloneServer = class {
34921
34925
  return;
34922
34926
  }
34923
34927
  if (action === "snapshot" && method === "GET") {
34924
- if (!this.isTerminalCliSession(sessionId)) {
34928
+ if (!this.isCliSession(sessionId)) {
34925
34929
  res.writeHead(409, { "Content-Type": "application/json" });
34926
- res.end(JSON.stringify({ error: "CLI session is not in terminal mode", code: "CLI_VIEW_MODE_NOT_TERMINAL" }));
34930
+ res.end(JSON.stringify({ error: "CLI session runtime unavailable", code: "CLI_RUNTIME_UNAVAILABLE" }));
34927
34931
  return;
34928
34932
  }
34929
34933
  void (async () => {
@@ -35047,9 +35051,9 @@ var StandaloneServer = class {
35047
35051
  req.on("aborted", cleanup);
35048
35052
  }
35049
35053
  async handleRuntimeEvents(req, res, sessionId) {
35050
- if (!this.isTerminalCliSession(sessionId)) {
35054
+ if (!this.isCliSession(sessionId)) {
35051
35055
  res.writeHead(409, { "Content-Type": "application/json" });
35052
- res.end(JSON.stringify({ error: "CLI session is not in terminal mode", code: "CLI_VIEW_MODE_NOT_TERMINAL" }));
35056
+ res.end(JSON.stringify({ error: "CLI session runtime unavailable", code: "CLI_RUNTIME_UNAVAILABLE" }));
35053
35057
  return;
35054
35058
  }
35055
35059
  const client = await this.createSessionHostClient();
@@ -35071,7 +35075,7 @@ var StandaloneServer = class {
35071
35075
  }
35072
35076
  const writeEvent = (event) => {
35073
35077
  if (event.sessionId !== sessionId) return;
35074
- if (!this.isTerminalCliSession(sessionId)) return;
35078
+ if (!this.isCliSession(sessionId)) return;
35075
35079
  res.write(`event: ${event.type}
35076
35080
  `);
35077
35081
  res.write(`data: ${JSON.stringify(event)}
@@ -35159,7 +35163,7 @@ var StandaloneServer = class {
35159
35163
  const states = this.components.instanceManager.collectAllStates();
35160
35164
  for (const state of states) {
35161
35165
  const sessionId = typeof state?.instanceId === "string" ? state.instanceId : "";
35162
- if (!sessionId || state?.category !== "cli" || state?.mode !== "terminal") continue;
35166
+ if (!sessionId || state?.category !== "cli") continue;
35163
35167
  const snapshot = await client.request({
35164
35168
  type: "get_snapshot",
35165
35169
  payload: { sessionId }