shellpuppet 0.5.0 → 0.5.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.
package/README.md CHANGED
@@ -29,7 +29,7 @@ ShellPuppet is the open-source terminal layer of **Intermeld**, the agent
29
29
  governance platform by [Red Eagle Tech](https://redeagle.tech). Everything in
30
30
  this repository runs on your machine and needs nothing we operate.
31
31
 
32
- > **Status: 0.5.0, with submit by default for known agents and dashboard
32
+ > **Status: 0.5.1, with submit by default for known agents and dashboard
33
33
  > Auto fit.** The daemon, CLI, MCP server, viewer and dashboard install from
34
34
  > npm (below). Watch the repository's Releases for what comes next, and bring questions, ideas and what you build with it to
35
35
  > [Discussions](https://github.com/intermeld/shellpuppet/discussions). 🦅
@@ -8,7 +8,7 @@ const RULE_INK = '#888888';
8
8
  */
9
9
  const CLAUDE_MODEL_LINE = /^ {2}(?:Opus|Sonnet|Haiku|Mythos|Fable) \d+(?:\.\d+)?(?: \(1M context\))?(?: (?:low|medium|high|xhigh|max))? [█░]{10} \d{1,3}%$/u;
10
10
  /** Claude Code's mode line under its status line, in its own wording. */
11
- const CLAUDE_MODE_LINE = /^ {2}(?:(?:⏵⏵ (?:auto mode on|accept edits on|bypass permissions on)|⏸ plan mode on)(?: \(shift\+tab to cycle\))?(?: · (?:\d+ shells?|esc to interrupt|↓ to manage))*|\? for shortcuts)$/u;
11
+ const CLAUDE_MODE_LINE = /^ {2}(?:(?:⏵⏵ (?:auto mode on|accept edits on|bypass permissions on)|⏸ plan mode on)(?: \(shift\+tab to cycle\))?(?: · (?:\d+ shells?|\d+ background tasks?|esc to interrupt|↓ to manage))*|\? for shortcuts)$/u;
12
12
  /** Dim placeholder recorded on an idle Claude Code composer. */
13
13
  const PLACEHOLDER = 'Try "write a test for <filepath>"';
14
14
  function placeholderInk(line) {
@@ -1 +1 @@
1
- {"version":3,"file":"nudge.js","sourceRoot":"","sources":["../../../src/agents/claude/nudge.ts"],"names":[],"mappings":"AACA,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IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC;YACzD,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAC/C,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QACvE,8EAA8E;QAC9E,QAAQ,EAAE,CAAC,WAAW,EAAE,6BAA6B,CAAC;QACtD,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;KAC1G,CAAC,CAAC;AACL,CAAC"}
@@ -6,6 +6,8 @@ export declare const AGENT_MODULES: readonly AgentModule[];
6
6
  export declare const BUILT_IN_SIGNATURES: readonly AgentSignature[];
7
7
  /** Parent-session markers from every module, excluded from every "all" launch profile. */
8
8
  export declare const SESSION_MARKERS: ReadonlySet<string>;
9
+ /** Only a known parent-session marker plus NO_COLOR identifies this inherited output setting. */
10
+ export declare function hasAgentShellNoColor(env: NodeJS.ProcessEnv, platform?: NodeJS.Platform): boolean;
9
11
  export declare function moduleFor(name: string): AgentModule | undefined;
10
12
  /** All conversation ids in marker precedence order, including inherited fallback values. */
11
13
  export declare function agentResumeIds(module: AgentModule | undefined, env: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string[];
@@ -16,6 +16,13 @@ export const AGENT_MODULES = [claude, codex, agy, grok, opencode, mimo, qoder, m
16
16
  export const BUILT_IN_SIGNATURES = AGENT_MODULES.filter(module => module !== generic).map(module => module.reading);
17
17
  /** Parent-session markers from every module, excluded from every "all" launch profile. */
18
18
  export const SESSION_MARKERS = new Set(AGENT_MODULES.flatMap(module => module.env?.sessionMarkers ?? []));
19
+ /** Only a known parent-session marker plus NO_COLOR identifies this inherited output setting. */
20
+ export function hasAgentShellNoColor(env, platform = process.platform) {
21
+ if (envValue(env, 'NO_COLOR', platform) === undefined)
22
+ return false;
23
+ return Object.keys(env).some(name => typeof env[name] === 'string' &&
24
+ SESSION_MARKERS.has(platform === 'win32' ? name.toUpperCase() : name));
25
+ }
19
26
  export function moduleFor(name) {
20
27
  return AGENT_MODULES.find(module => module.name === name);
21
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,qEAAqE;AACrE,OAAO,EAAE,iBAAiB,IAAI,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,CAAC,MAAM,aAAa,GAA2B,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,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AC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1E,OAAO,OAAO,KAAK,SAAS;QAC1B,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE;QAC/C,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AACtD,CAAC;AAED,4GAA4G;AAC5G,MAAM,CAAC,MAAM,eAAe,GAAqC,GAAG,EAAE,CACpE,CAAC,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC1E,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CACzE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -218,6 +218,8 @@ export interface SessionDeps {
218
218
  pidWaitMs?: number;
219
219
  /** Environment hygiene mode (design §4.6). Defaults to `DEFAULT_SESSION_ENV`. */
220
220
  sessionEnv?: SessionEnvMode;
221
+ /** Start-time decision to omit inherited NO_COLOR from passthrough. */
222
+ omitInheritedNoColor?: boolean;
221
223
  /** Windows tree killer override, for tests only. Defaults to `taskkillTrees`. */
222
224
  treeKiller?: TreeKiller;
223
225
  /**
@@ -272,7 +274,7 @@ export declare function credentialShapedNames(source?: NodeJS.ProcessEnv): strin
272
274
  * here rather than in one caller. The session identity names and home are also
273
275
  * removed from `passed`; the daemon assigns fresh values to each session.
274
276
  */
275
- export declare function buildSessionEnv(mode: SessionEnvMode, platform: NodeJS.Platform, source?: NodeJS.ProcessEnv, passed?: Record<string, string>, reserved?: ReadonlySet<string>): Record<string, string>;
277
+ export declare function buildSessionEnv(mode: SessionEnvMode, platform: NodeJS.Platform, source?: NodeJS.ProcessEnv, passed?: Record<string, string>, reserved?: ReadonlySet<string>, omitInheritedNoColor?: boolean): Record<string, string>;
276
278
  export declare class Session implements WaitTarget {
277
279
  readonly id: string;
278
280
  label: string;
@@ -346,9 +348,16 @@ export declare class Session implements WaitTarget {
346
348
  private inputVersion;
347
349
  /** Non-empty input from a person or nudge, excluding terminal reports. */
348
350
  private promptInputRevision;
351
+ /** Every queued PTY write, including terminal reports, preserves submit ordering. */
352
+ private writeQueueVersion;
349
353
  private inputQueueVersion;
350
354
  /** A nudge body accepted by the PTY without a confirmed submit. */
351
355
  private pendingNudgeLine;
356
+ private pendingNudgeTypedChars;
357
+ private pendingNudgeWholeBody;
358
+ private pendingNudgeInputVersion;
359
+ private pendingNudgeQueueVersion;
360
+ private pendingNudgeAuditRecorded;
352
361
  private nudgeSchedule?;
353
362
  private writingNudge;
354
363
  private pendingNudgeIds;
@@ -366,7 +375,7 @@ export declare class Session implements WaitTarget {
366
375
  /** Why the input pipe failed (Windows), once it has: input is refused from then on. */
367
376
  private inputFailure;
368
377
  private lastChange;
369
- /** When input was last written to the PTY. */
378
+ /** When typing or a nudge was last accepted, excluding terminal reports. */
370
379
  private lastInputAt;
371
380
  private recentInputUntil;
372
381
  /** Sticky: the rendered screen has shown something at least once. */
@@ -487,6 +496,12 @@ export declare class Session implements WaitTarget {
487
496
  terminalReport?: boolean;
488
497
  humanInput?: boolean;
489
498
  }): Promise<string>;
499
+ /** Queue raw terminal bytes without applying text paste or submit rules. */
500
+ writeBinary(data: Buffer, options?: {
501
+ terminalReport?: boolean;
502
+ }): Promise<void>;
503
+ /** The human-input bookkeeping a text write does, for raw bytes that are not a terminal report. */
504
+ private noteBinaryInput;
490
505
  /** Write and report what a module can establish about a typed submission. */
491
506
  writeWithResult(data: string, options?: {
492
507
  terminalReport?: boolean;
@@ -500,10 +515,19 @@ export declare class Session implements WaitTarget {
500
515
  /** Queue a daemon nudge, reporting why a typed body could not be submitted. */
501
516
  writeNudgeWithReason(data: string, ready: (screen: string, phase: 'before' | 'submit') => boolean, messageIds?: string[], failedCheck?: () => NudgeAbortReason, schedule?: string, queuedDelivery?: boolean): Promise<'sent' | 'wait' | `aborted-${NudgeAbortReason}`>;
502
517
  nudgePendingLine(): string | null;
518
+ nudgePendingBodyMeta(): {
519
+ pendingBody: boolean;
520
+ typedChars: number;
521
+ submitSent: boolean;
522
+ };
523
+ nudgePendingSafeToSubmit(): boolean;
524
+ nudgePendingAuditOnce(): boolean;
503
525
  pendingSchedule(): string | undefined;
504
526
  nudgePendingIds(): readonly string[];
505
527
  nudgePendingUntouched(): boolean;
506
528
  nudgePendingTouchRefusal(): boolean;
529
+ /** Forget a stale mailbox body without writing to or clearing the terminal. */
530
+ discardStalePendingNudge(line: string, messageIds: readonly string[]): boolean;
507
531
  /** Clear after an observed submitted turn or a whole quiet period of proven emptiness. */
508
532
  clearConsumedNudge(): Promise<boolean>;
509
533
  /** A pending body may receive its submit key only after it is visible exactly once. */
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * No stdout/stderr: logging via the injected Logger only (lint-enforced).
15
15
  */
16
- import { agentResumeIds, moduleFor, programName } from '../agents/index.js';
16
+ import { agentResumeIds, hasAgentShellNoColor, moduleFor, programName } from '../agents/index.js';
17
17
  import { nudgeVerdict, NUDGE_QUIET_MS } from './nudge.js';
18
18
  import { validateStall, possibleStall, resolveSessionAgent, signatureForSession, stallTranscriptContent, stallTurnVisible, StallScreenCache, StallTracker } from './reasoning.js';
19
19
  import { execFile } from 'node:child_process';
@@ -546,7 +546,7 @@ export function credentialShapedNames(source = process.env) {
546
546
  * here rather than in one caller. The session identity names and home are also
547
547
  * removed from `passed`; the daemon assigns fresh values to each session.
548
548
  */
549
- export function buildSessionEnv(mode, platform, source = process.env, passed = {}, reserved = RESERVED_FEATURE_CREDENTIALS) {
549
+ export function buildSessionEnv(mode, platform, source = process.env, passed = {}, reserved = RESERVED_FEATURE_CREDENTIALS, omitInheritedNoColor = hasAgentShellNoColor(source, platform)) {
550
550
  const env = {};
551
551
  // Session-owned names are reserved in every casing. Windows also reads
552
552
  // other reserved names without case; elsewhere those names are exact.
@@ -556,7 +556,8 @@ export function buildSessionEnv(mode, platform, source = process.env, passed = {
556
556
  : reserved.has(name));
557
557
  if (mode === 'passthrough') {
558
558
  for (const [key, value] of Object.entries(source)) {
559
- if (value !== undefined && !isReserved(key))
559
+ if (value !== undefined && !isReserved(key)
560
+ && !(omitInheritedNoColor && (platform === 'win32' ? key.toUpperCase() : key) === 'NO_COLOR'))
560
561
  env[key] = value;
561
562
  }
562
563
  }
@@ -649,9 +650,16 @@ export class Session {
649
650
  inputVersion = 0;
650
651
  /** Non-empty input from a person or nudge, excluding terminal reports. */
651
652
  promptInputRevision = 0;
653
+ /** Every queued PTY write, including terminal reports, preserves submit ordering. */
654
+ writeQueueVersion = 0;
652
655
  inputQueueVersion = 0;
653
656
  /** A nudge body accepted by the PTY without a confirmed submit. */
654
657
  pendingNudgeLine = null;
658
+ pendingNudgeTypedChars = 0;
659
+ pendingNudgeWholeBody = false;
660
+ pendingNudgeInputVersion = 0;
661
+ pendingNudgeQueueVersion = 0;
662
+ pendingNudgeAuditRecorded = false;
655
663
  nudgeSchedule;
656
664
  writingNudge = false;
657
665
  pendingNudgeIds = [];
@@ -669,7 +677,7 @@ export class Session {
669
677
  /** Why the input pipe failed (Windows), once it has: input is refused from then on. */
670
678
  inputFailure = null;
671
679
  lastChange = Date.now();
672
- /** When input was last written to the PTY. */
680
+ /** When typing or a nudge was last accepted, excluding terminal reports. */
673
681
  lastInputAt = 0;
674
682
  recentInputUntil = 0;
675
683
  /** Sticky: the rendered screen has shown something at least once. */
@@ -785,7 +793,7 @@ export class Session {
785
793
  // for Windows without a Windows process.
786
794
  const trackConsoleHost = this.platform === 'win32';
787
795
  const consoleHostT0 = trackConsoleHost ? Date.now() : 0;
788
- const sessionEnv = buildSessionEnv(deps.sessionEnv ?? DEFAULT_SESSION_ENV, this.platform, process.env, options.env);
796
+ const sessionEnv = buildSessionEnv(deps.sessionEnv ?? DEFAULT_SESSION_ENV, this.platform, process.env, options.env, RESERVED_FEATURE_CREDENTIALS, deps.omitInheritedNoColor);
789
797
  if (this.launchProfile) {
790
798
  if (deps.identity && this.agentModule?.resumeIdMarkers) {
791
799
  this.inheritedResumeIds = agentResumeIds(this.agentModule, sessionEnv, this.platform);
@@ -1143,9 +1151,44 @@ export class Session {
1143
1151
  write(data, options = {}) {
1144
1152
  return this.writeWithResult(data, options).then((result) => result.before);
1145
1153
  }
1154
+ /** Queue raw terminal bytes without applying text paste or submit rules. */
1155
+ writeBinary(data, options = {}) {
1156
+ const terminalReport = options.terminalReport === true;
1157
+ // Every frame keeps submit ordering; only non-report bytes count as typing.
1158
+ this.writeQueueVersion++;
1159
+ if (!terminalReport)
1160
+ this.inputQueueVersion++;
1161
+ const queued = this.writeChain.then(() => {
1162
+ this.refuseIfInputFailed();
1163
+ this.refuseIfEnded();
1164
+ if (!terminalReport && data.length > 0)
1165
+ this.noteBinaryInput();
1166
+ this.pty.write(data);
1167
+ });
1168
+ this.writeChain = queued.then(() => undefined, () => undefined);
1169
+ return queued;
1170
+ }
1171
+ /** The human-input bookkeeping a text write does, for raw bytes that are not a terminal report. */
1172
+ noteBinaryInput() {
1173
+ if (this.pendingNudgeLine !== null)
1174
+ this.pendingNudgeTouched = true;
1175
+ this.recentInputUntil = Date.now() + RECENT_INPUT_MS;
1176
+ if (this.stallTracker.reason !== 'server-lost' && this.stallState?.reason !== 'server-lost') {
1177
+ this.stallTracker.noteInput();
1178
+ this.clearStallTimer();
1179
+ this.publishStall(undefined);
1180
+ }
1181
+ const { screen, lines } = this.renderer.snapshot();
1182
+ this.lastInputAt = Date.now();
1183
+ this.inputVersion++;
1184
+ this.promptInputRevision++;
1185
+ this.stalePrompts.noteInput(screen, this.agent, this.renderer.promptStyles(lines));
1186
+ }
1146
1187
  /** Write and report what a module can establish about a typed submission. */
1147
1188
  writeWithResult(data, options = {}) {
1148
- this.inputQueueVersion++;
1189
+ this.writeQueueVersion++;
1190
+ if (options.terminalReport !== true)
1191
+ this.inputQueueVersion++;
1149
1192
  const delayedSubmit = this.delayedSubmission(data) || options.submitMode === 'on' ||
1150
1193
  (options.submitMode === 'auto' && this.autoSubmitEligible());
1151
1194
  if (delayedSubmit)
@@ -1209,6 +1252,22 @@ export class Session {
1209
1252
  return queued;
1210
1253
  }
1211
1254
  nudgePendingLine() { return this.pendingNudgeLine; }
1255
+ nudgePendingBodyMeta() {
1256
+ return { pendingBody: this.pendingNudgeLine !== null && this.pendingNudgeTypedChars > 0,
1257
+ typedChars: this.pendingNudgeTypedChars, submitSent: false };
1258
+ }
1259
+ nudgePendingSafeToSubmit() {
1260
+ return this.pendingNudgeLine !== null && this.pendingNudgeWholeBody &&
1261
+ this.pendingNudgeTypedChars === this.pendingNudgeLine.length && !this.pendingNudgeTouched &&
1262
+ this.pendingNudgeInputVersion === this.inputVersion &&
1263
+ this.pendingNudgeQueueVersion === this.inputQueueVersion;
1264
+ }
1265
+ nudgePendingAuditOnce() {
1266
+ if (this.pendingNudgeAuditRecorded)
1267
+ return false;
1268
+ this.pendingNudgeAuditRecorded = true;
1269
+ return true;
1270
+ }
1212
1271
  pendingSchedule() { return this.pendingNudgeLine === null ? undefined : this.nudgeSchedule; }
1213
1272
  nudgePendingIds() { return this.pendingNudgeIds; }
1214
1273
  nudgePendingUntouched() { return !this.pendingNudgeTouched; }
@@ -1218,6 +1277,23 @@ export class Session {
1218
1277
  this.pendingTouchRefusalAudited = true;
1219
1278
  return true;
1220
1279
  }
1280
+ /** Forget a stale mailbox body without writing to or clearing the terminal. */
1281
+ discardStalePendingNudge(line, messageIds) {
1282
+ if (this.writingNudge || this.pendingNudgeLine !== line || messageIds.length === 0 ||
1283
+ this.pendingNudgeIds.length !== messageIds.length ||
1284
+ !messageIds.every((id, index) => this.pendingNudgeIds[index] === id))
1285
+ return false;
1286
+ this.pendingNudgeLine = null;
1287
+ this.pendingNudgeIds = [];
1288
+ this.pendingNudgeTypedChars = 0;
1289
+ this.pendingNudgeWholeBody = false;
1290
+ this.pendingNudgeAuditRecorded = false;
1291
+ this.pendingNudgeTouched = false;
1292
+ this.pendingTouchRefusalAudited = false;
1293
+ this.pendingTurnSubmitted = false;
1294
+ this.pendingTurnBusy = false;
1295
+ return true;
1296
+ }
1221
1297
  /** Clear after an observed submitted turn or a whole quiet period of proven emptiness. */
1222
1298
  async clearConsumedNudge() {
1223
1299
  if (this.pendingNudgeLine === null || this.writingNudge)
@@ -1237,6 +1313,9 @@ export class Session {
1237
1313
  return false;
1238
1314
  this.pendingNudgeLine = null;
1239
1315
  this.pendingNudgeIds = [];
1316
+ this.pendingNudgeTypedChars = 0;
1317
+ this.pendingNudgeWholeBody = false;
1318
+ this.pendingNudgeAuditRecorded = false;
1240
1319
  this.pendingNudgeTouched = false;
1241
1320
  this.pendingTouchRefusalAudited = false;
1242
1321
  this.pendingTurnSubmitted = false;
@@ -1249,13 +1328,16 @@ export class Session {
1249
1328
  this.refuseIfInputFailed();
1250
1329
  await this.renderer.flush();
1251
1330
  this.refuseIfEnded();
1252
- if (this.pendingNudgeLine !== line || this.pendingNudgeTouched ||
1331
+ if (this.pendingNudgeLine !== line || !this.nudgePendingSafeToSubmit() ||
1253
1332
  !ready(this.renderer.snapshot().screen) ||
1254
1333
  !this.nudgeReadyWithLine(line))
1255
1334
  return false;
1256
1335
  this.pty.write(this.nudgeSubmit());
1257
1336
  this.pendingNudgeLine = null;
1258
1337
  this.pendingNudgeIds = [];
1338
+ this.pendingNudgeTypedChars = 0;
1339
+ this.pendingNudgeWholeBody = false;
1340
+ this.pendingNudgeAuditRecorded = false;
1259
1341
  this.pendingNudgeTouched = false;
1260
1342
  this.pendingTouchRefusalAudited = false;
1261
1343
  this.pendingTurnSubmitted = false;
@@ -1420,7 +1502,8 @@ export class Session {
1420
1502
  // Recorded BEFORE the bytes go in, when the screen still shows what this
1421
1503
  // input is answering: the waiter's stale-prompt guard needs that prompt,
1422
1504
  // and its echo guard needs the input itself.
1423
- this.lastInputData = data;
1505
+ if (!terminalReport)
1506
+ this.lastInputData = data;
1424
1507
  if (!nudge && !terminalReport && data.length > 0) {
1425
1508
  this.recentInputUntil = Date.now() + RECENT_INPUT_MS;
1426
1509
  }
@@ -1440,11 +1523,14 @@ export class Session {
1440
1523
  // waiting to paint its placeholder, so a new placeholder can only be this body's.
1441
1524
  const settledBefore = Date.now() - this.lastInputAt >= TYPED_PLACEHOLDER_SETTLE_MS &&
1442
1525
  Date.now() - this.lastChange >= TYPED_PLACEHOLDER_SETTLE_MS;
1443
- this.lastInputAt = Date.now();
1444
- this.inputVersion++;
1526
+ if (!terminalReport) {
1527
+ this.lastInputAt = Date.now();
1528
+ this.inputVersion++;
1529
+ }
1445
1530
  if (!terminalReport && data.length > 0)
1446
1531
  this.promptInputRevision++;
1447
- this.stalePrompts.noteInput(screen, this.agent, this.renderer.promptStyles(lines));
1532
+ if (!terminalReport)
1533
+ this.stalePrompts.noteInput(screen, this.agent, this.renderer.promptStyles(lines));
1448
1534
  if (nudge || this.delayedSubmission(data)) {
1449
1535
  const submit = this.agentModule?.input?.submit;
1450
1536
  const key = nudgeKey ?? submit.key;
@@ -1452,6 +1538,7 @@ export class Session {
1452
1538
  const delayMs = nudge ? Math.max(NUDGE_SUBMIT_DELAY_MS, submit?.delayMs ?? 0)
1453
1539
  : Math.max(submit.delayMs, Math.ceil(Array.from(body).length * (submit?.perCharacterMs ?? 0)));
1454
1540
  const queuedInputVersion = this.inputQueueVersion;
1541
+ const queuedWriteVersion = this.writeQueueVersion;
1455
1542
  if (!nudge && this.agentModule?.nudge !== undefined)
1456
1543
  await this.renderer.flush();
1457
1544
  // Typed text waits for proof only when the agent's own composer is on screen. Before the
@@ -1466,13 +1553,20 @@ export class Session {
1466
1553
  if (nudge) {
1467
1554
  this.pendingNudgeLine = body;
1468
1555
  this.pendingNudgeIds = [...messageIds];
1556
+ this.pendingNudgeTypedChars = 0;
1557
+ this.pendingNudgeWholeBody = false;
1558
+ this.pendingNudgeInputVersion = this.inputVersion;
1559
+ this.pendingNudgeQueueVersion = this.inputQueueVersion;
1560
+ this.pendingNudgeAuditRecorded = false;
1469
1561
  this.pendingNudgeTouched = false;
1470
1562
  this.pendingTouchRefusalAudited = false;
1471
1563
  this.pendingTurnSubmitted = false;
1472
1564
  this.pendingTurnBusy = false;
1473
1565
  this.pendingQuietSince = Date.now();
1474
1566
  }
1475
- await this.writeData(body);
1567
+ await this.writeData(body, nudge ? (accepted) => { this.pendingNudgeTypedChars += accepted.length; } : undefined);
1568
+ if (nudge)
1569
+ this.pendingNudgeWholeBody = this.pendingNudgeTypedChars === body.length;
1476
1570
  const bodyInputVersion = this.inputVersion;
1477
1571
  const bodyWrittenAt = Date.now();
1478
1572
  try {
@@ -1538,7 +1632,7 @@ export class Session {
1538
1632
  this.pty.write(key);
1539
1633
  if (!nudge) {
1540
1634
  onTypedSubmit?.(readableComposer || this.agentModule?.nudge === undefined
1541
- ? await this.checkTypedSubmission(body, key, queuedInputVersion, typedDraftSeen, beforeSubmitScreen, wasBusy, placeholdersBefore)
1635
+ ? await this.checkTypedSubmission(body, key, queuedWriteVersion, typedDraftSeen, beforeSubmitScreen, wasBusy, placeholdersBefore)
1542
1636
  : { submitRetried: false,
1543
1637
  message: "Submit key sent; the agent's composer was not on screen when the text was typed." });
1544
1638
  }
@@ -1549,6 +1643,9 @@ export class Session {
1549
1643
  if (nudge) {
1550
1644
  this.pendingNudgeLine = null;
1551
1645
  this.pendingNudgeIds = [];
1646
+ this.pendingNudgeTypedChars = 0;
1647
+ this.pendingNudgeWholeBody = false;
1648
+ this.pendingNudgeAuditRecorded = false;
1552
1649
  this.pendingNudgeTouched = false;
1553
1650
  this.pendingTouchRefusalAudited = false;
1554
1651
  this.pendingTurnSubmitted = false;
@@ -1583,7 +1680,7 @@ export class Session {
1583
1680
  const after = transcript(this.renderer.snapshot().screen);
1584
1681
  return after.includes(body) && !transcript(beforeScreen).includes(body);
1585
1682
  }
1586
- async checkTypedSubmission(body, key, queuedInputVersion, draftSeen, beforeSubmitScreen, wasBusy, placeholdersBefore) {
1683
+ async checkTypedSubmission(body, key, queuedWriteVersion, draftSeen, beforeSubmitScreen, wasBusy, placeholdersBefore) {
1587
1684
  if (this.agentModule?.nudge === undefined) {
1588
1685
  return { submitRetried: false,
1589
1686
  message: 'Submit key sent; this programme has no readable composer.' };
@@ -1591,7 +1688,7 @@ export class Session {
1591
1688
  const settleMs = this.agentModule.input?.submit?.settleMs ?? TYPED_SUBMIT_SETTLE_MS;
1592
1689
  await new Promise((resolve) => setTimeout(resolve, settleMs));
1593
1690
  await this.renderer.flush();
1594
- if (this.inputQueueVersion !== queuedInputVersion) {
1691
+ if (this.writeQueueVersion !== queuedWriteVersion) {
1595
1692
  return { submitRetried: false,
1596
1693
  message: 'Submit key sent; later input arrived before the composer check.' };
1597
1694
  }
@@ -1607,7 +1704,7 @@ export class Session {
1607
1704
  this.refuseIfInputFailed();
1608
1705
  this.refuseIfEnded();
1609
1706
  // A prompt or changed composer can appear while the first Enter settles.
1610
- if (this.inputQueueVersion !== queuedInputVersion ||
1707
+ if (this.writeQueueVersion !== queuedWriteVersion ||
1611
1708
  !this.typedDraftVisible(body, placeholdersBefore)) {
1612
1709
  return { submitRetried: false,
1613
1710
  message: 'Submit key sent; the composer changed before a retry.' };
@@ -1615,7 +1712,7 @@ export class Session {
1615
1712
  this.pty.write(key);
1616
1713
  await new Promise((resolve) => setTimeout(resolve, settleMs));
1617
1714
  await this.renderer.flush();
1618
- if (this.inputQueueVersion !== queuedInputVersion) {
1715
+ if (this.writeQueueVersion !== queuedWriteVersion) {
1619
1716
  return { submitRetried: true,
1620
1717
  message: 'Submit key retried; later input arrived before confirmation.' };
1621
1718
  }
@@ -1628,11 +1725,12 @@ export class Session {
1628
1725
  this.typedLineInTranscript(body, beforeSubmitScreen)) ? { submitted: true } : {}), submitRetried: true,
1629
1726
  message: 'Submit key retried once after the typed text remained in the composer.' };
1630
1727
  }
1631
- async writeData(data) {
1728
+ async writeData(data, onAccepted) {
1632
1729
  if (data.length <= WRITE_CHUNK_CHARS) {
1633
1730
  if (data !== '' && this.pendingNudgeLine !== null)
1634
1731
  this.pendingQuietSince = Date.now();
1635
1732
  this.pty.write(data);
1733
+ onAccepted?.(data);
1636
1734
  return;
1637
1735
  }
1638
1736
  // Bracketed paste: ONE write, no chunking, exactly as a terminal delivers a
@@ -1648,6 +1746,7 @@ export class Session {
1648
1746
  if (this.pendingNudgeLine !== null)
1649
1747
  this.pendingQuietSince = Date.now();
1650
1748
  this.pty.write(`${PASTE_START}${body}${PASTE_END}${trailer}`);
1749
+ onAccepted?.(data);
1651
1750
  return;
1652
1751
  }
1653
1752
  this.lastWriteWrapped = false;
@@ -1667,6 +1766,7 @@ export class Session {
1667
1766
  if (this.pendingNudgeLine !== null)
1668
1767
  this.pendingQuietSince = Date.now();
1669
1768
  this.pty.write(data.slice(offset, end));
1769
+ onAccepted?.(data.slice(offset, end));
1670
1770
  offset = end;
1671
1771
  if (offset < data.length) {
1672
1772
  await new Promise((resolve) => setTimeout(resolve, WRITE_CHUNK_DELAY_MS));