@volter/supercode-terminal 0.2.55 → 0.2.57

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 (3) hide show
  1. package/index.d.ts +1 -1
  2. package/index.mjs +4 -19
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -252,7 +252,7 @@ export type {
252
252
  export type { TerminalInputDelivery, TmuxCommand, TmuxWindowSize };
253
253
 
254
254
  /** The bounded live composer text, or null for an unrecognized screen. */
255
- export function composerText(kind: string, screen: string | undefined, options?: { allowBusy?: boolean }): string | null;
255
+ export function composerText(kind: string, screen: string | undefined): string | null;
256
256
  export function restoreComposerInput(host: TmuxTerminalHost | PtyTerminalHost | PaneServerHost, sessionId: string, kind: string, text: string): Promise<{ restored: boolean; reason?: string; remaining?: string }>;
257
257
  /** Failed input is restored or returns an explicit cleanup obligation; never blindly resend. */
258
258
  export function deliverComposerInput(host: TmuxTerminalHost | PtyTerminalHost | PaneServerHost, sessionId: string, kind: string, text: string, options?: { deadlineMs?: number; signal?: AbortSignal }): Promise<{ delivered: boolean; reason?: string; restored?: boolean; cleanup_required?: boolean; cleanup_reason?: string; cleanup_remaining?: string; delivery?: TerminalInputDelivery }>;
package/index.mjs CHANGED
@@ -1738,11 +1738,10 @@ export function composerHoldsDraft(kind, screen) {
1738
1738
  /** Read only a bounded, live Claude/Codex composer, never a prompt in scrollback.
1739
1739
  * Unknown layouts and collapsed pastes are deliberately unconfirmed.
1740
1740
  */
1741
- export function composerText(kind, screen, { allowBusy = false } = {}) {
1741
+ export function composerText(kind, screen) {
1742
1742
  if (kind !== 'claude-code' && kind !== 'codex') return null;
1743
1743
  const lines = String(screen ?? '').split('\n').map(styledCells);
1744
1744
  const plain = lines.map((cells) => cells.map((cell) => cell.char).join(''));
1745
- if (!allowBusy && composerBusy(screen)) return null;
1746
1745
  const rule = /^\s*[─━]{4,}\s*$/u;
1747
1746
  const footer = /^\s*(?:.*\btab to queue (?:a )?message\b.*$|\? for shortcuts\b|⚠\s+\d+\s+warnings?\s+·\s+f2 to view\s*$|[^\n]+ · (?:~(?:[\\/]|(?=\s|$))|[\\/]|[A-Z]:[\\/])[^\n]*$|.*← for agents\s*$|.*\bcontext(?:\s+\d+%)?\s+left\b)/iu;
1748
1747
  const caret = kind === 'codex' ? /^\s*›(?:\s|$)/u : /^\s*[❯>](?:\s|$)/u;
@@ -1791,22 +1790,10 @@ function composerMatches(value, wanted) {
1791
1790
  return offsets.has(wanted.length);
1792
1791
  }
1793
1792
 
1794
- /** Busy evidence must come from the live UI bottom, not a fleet label or a
1795
- * quoted phrase in the transcript. */
1796
- function composerBusyEvidence(screen) {
1797
- const bottom=String(screen??'').split('\n').map(line=>styledCells(line).map(cell=>cell.char).join('')).filter(line=>line.trim()).slice(-8);
1798
- for (const row of bottom) {
1799
- const match=/\b(?:esc to (?:interrupt|cancel)|tab to queue (?:a )?message)\b/iu.exec(row);
1800
- if (match) return { indicator: match[0], row: row.trim().slice(0, 240) };
1801
- }
1802
- return null;
1803
- }
1804
- function composerBusy(screen) { return composerBusyEvidence(screen) !== null; }
1805
-
1806
1793
  /** Undo only text this input wrote, including when a turn started meanwhile.
1807
1794
  * Never Enter, Escape, or Ctrl-C: restoration must not submit or stop work. */
1808
1795
  export async function restoreComposerInput(host, sessionId, kind, text) {
1809
- const read=async()=>composerText(kind,await host.capture(sessionId,{preserveEscapes:true}),{allowBusy:true});
1796
+ const read=async()=>composerText(kind,await host.capture(sessionId,{preserveEscapes:true}));
1810
1797
  let remaining=await read();
1811
1798
  if(remaining==='')return {restored:true};
1812
1799
  if(!composerMatches(remaining,String(text).trim()))return {restored:false,reason:'composer-changed-or-unreadable'};
@@ -1833,7 +1820,7 @@ export async function restoreComposerInput(host, sessionId, kind, text) {
1833
1820
  * unreadable/concurrently changed composer returns an explicit repair obligation. */
1834
1821
  export async function deliverComposerInput(host, sessionId, kind, text, { deadlineMs = Date.now() + 10_000, signal } = {}) {
1835
1822
  const capture=()=>host.capture(sessionId,{preserveEscapes:true});
1836
- const read=async()=>composerText(kind,await capture(),{allowBusy:true});
1823
+ const read=async()=>composerText(kind,await capture());
1837
1824
  const expired=()=>signal?.aborted||Date.now()>=deadlineMs;
1838
1825
  let touched=false;
1839
1826
  const failed=async (reason, evidence={})=>{
@@ -1847,7 +1834,6 @@ export async function deliverComposerInput(host, sessionId, kind, text, { deadli
1847
1834
  if(!wanted||/[\x00-\x08\x0b-\x1f\x7f]/u.test(text))return failed('unsupported-text');
1848
1835
  for(let check=0;check<2;check++) {
1849
1836
  const screen=await capture(),before=composerText(kind,screen);
1850
- if(composerBusy(screen))return failed('busy-composer',{phase:'before-paste',busy:composerBusyEvidence(screen)});
1851
1837
  if(before!=='')return failed(before===null?'no-composer':'draft');
1852
1838
  if(check===0)await sleep(200);
1853
1839
  }
@@ -1864,14 +1850,13 @@ export async function deliverComposerInput(host, sessionId, kind, text, { deadli
1864
1850
  for(let attempt=0;attempt<3;attempt++) {
1865
1851
  if(expired())return failed('deadline');
1866
1852
  const screen=await capture();
1867
- if(composerBusy(screen))return failed('busy-composer',{phase:'before-submit',busy:composerBusyEvidence(screen)});
1868
1853
  if(!composerMatches(composerText(kind,screen),wanted))return failed('composer-changed');
1869
1854
  if(expired())return failed('deadline');
1870
1855
  await host.sendInput(sessionId,'\r',{submitMode:'single',deadlineMs});
1871
1856
  for(let poll=0;poll<10&&!expired();poll++) {
1872
1857
  await sleep(100);
1873
1858
  const current=await read();
1874
- if(current==='')return {delivered:true,delivery};
1859
+ if(current==='')return kind === 'claude-code' ? {delivered:true,delivery,path:'composer_submit'} : {delivered:false,reason:'native-transcript-confirmation-required',delivery};
1875
1860
  if(!composerMatches(current,wanted))return failed('submission-unconfirmed');
1876
1861
  }
1877
1862
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-terminal",
3
- "version": "0.2.55",
3
+ "version": "0.2.57",
4
4
  "type": "module",
5
5
  "description": "Optional leak-safe terminal and tmux host adapter for Volter Harness frontends",
6
6
  "exports": {