@nonbot/cli 0.9.1 → 0.9.2

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.
@@ -460,19 +460,17 @@ export async function runDaemonCommand(args = [], options = {}, deps = {}) {
460
460
  emitSummary();
461
461
  }
462
462
  }
463
- if (trackedPanes.size > 0) {
464
- try {
465
- await deliverAnsweredPrompts({
466
- baseUrl: auth.baseUrl,
467
- pat: auth.pat,
468
- injected: injectedPrompts,
469
- fetchImpl,
470
- spawnImpl: deps.spawnSync,
471
- log,
472
- });
473
- }
474
- catch {
475
- }
463
+ try {
464
+ await deliverAnsweredPrompts({
465
+ baseUrl: auth.baseUrl,
466
+ pat: auth.pat,
467
+ injected: injectedPrompts,
468
+ fetchImpl,
469
+ spawnImpl: deps.spawnSync,
470
+ log,
471
+ });
472
+ }
473
+ catch {
476
474
  }
477
475
  if (trackedPanes.size > 0) {
478
476
  const reported = await checkCompletions({
@@ -4,6 +4,9 @@ import { VERSION } from '../version.js';
4
4
  const QUESTION_MAX = 200;
5
5
  const LABEL_MAX = 80;
6
6
  const OPTIONS_MAX = 8;
7
+ const PANE_ID_RE = /^%\d+$/;
8
+ const ANSWERED_MAX = 16;
9
+ const ANSWER_TEXT_MAX = 4096;
7
10
  const MENU_LINE_RE = /^\s*[>❯▸▶*•]?\s*(\d{1,2})[.)]\s+(\S.*)$/;
8
11
  const GLYPH_RE = /[│┃|╭╮╯╰─━┄┈┌┐└┘├┤>❯▸▶*•]/g;
9
12
  export function parsePromptMenu(paneText, fallbackMessage = '') {
@@ -109,7 +112,7 @@ export async function pollAnsweredPrompts(args) {
109
112
  if (!data || !Array.isArray(data.prompts))
110
113
  return [];
111
114
  const out = [];
112
- for (const r of data.prompts) {
115
+ for (const r of data.prompts.slice(0, ANSWERED_MAX)) {
113
116
  if (!r || typeof r.promptId !== 'string' || typeof r.activationId !== 'string')
114
117
  continue;
115
118
  out.push({
@@ -117,7 +120,7 @@ export async function pollAnsweredPrompts(args) {
117
120
  activationId: r.activationId,
118
121
  paneId: typeof r.paneId === 'string' && r.paneId.length > 0 ? r.paneId : null,
119
122
  answerIndex: typeof r.answerIndex === 'number' ? r.answerIndex : null,
120
- answerText: typeof r.answerText === 'string' ? r.answerText : null,
123
+ answerText: typeof r.answerText === 'string' ? r.answerText.slice(0, ANSWER_TEXT_MAX) : null,
121
124
  answeredAt: typeof r.answeredAt === 'number' ? r.answeredAt : undefined,
122
125
  });
123
126
  }
@@ -147,13 +150,15 @@ export async function confirmDelivered(args) {
147
150
  }
148
151
  }
149
152
  export function injectAnswer(paneId, answerIndex, answerText, spawnImpl = nodeSpawnSync) {
150
- const keys = answerIndex !== null && Number.isFinite(answerIndex)
153
+ if (!PANE_ID_RE.test(paneId))
154
+ return false;
155
+ const keys = answerIndex !== null && Number.isFinite(answerIndex) && answerIndex >= 0
151
156
  ? String(answerIndex)
152
157
  : answerText ?? '';
153
158
  if (keys.length === 0)
154
159
  return false;
155
160
  try {
156
- spawnImpl('tmux', ['send-keys', '-l', '-t', paneId, keys], {
161
+ spawnImpl('tmux', ['send-keys', '-l', '-t', paneId, '--', keys], {
157
162
  encoding: 'utf-8',
158
163
  timeout: 2000,
159
164
  windowsHide: true,
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.9.1';
1
+ export const VERSION = '0.9.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nonbot/cli",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "type": "module",
5
5
  "description": "The local host for non.bot ▶ Run — opens a terminal on your machine and starts the work in your linked repo.",
6
6
  "license": "UNLICENSED",