@rallycry/conveyor-agent 11.0.36 → 11.0.38

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.
@@ -2265,6 +2265,26 @@ function createChatRecordMapper(rootDir) {
2265
2265
  };
2266
2266
  }
2267
2267
 
2268
+ // src/harness/pty/prompt-receipt.ts
2269
+ function isPromptReceipt(raw, text, sentAt) {
2270
+ if (!text || !raw || typeof raw !== "object") return false;
2271
+ const record = raw;
2272
+ if (record.type !== "user" || typeof record.timestamp !== "string") return false;
2273
+ if (!(Date.parse(record.timestamp) >= sentAt)) return false;
2274
+ if (!record.message || typeof record.message !== "object") return false;
2275
+ const message = record.message;
2276
+ const submitted = receiptText(message.content);
2277
+ const normalize2 = (value) => value.replace(/\r\n/g, "\n").trim();
2278
+ return message.role === "user" && typeof submitted === "string" && normalize2(text) !== "" && (normalize2(submitted) === normalize2(text) || pastedText(normalize2(submitted)) === normalize2(text));
2279
+ }
2280
+ function receiptText(content) {
2281
+ const block = Array.isArray(content) && content.length === 1 ? content[0] : void 0;
2282
+ return typeof content === "string" ? content : block?.type === "text" && typeof block.text === "string" ? block.text : void 0;
2283
+ }
2284
+ function pastedText(text) {
2285
+ return /^<pasted_content id="[A-Za-z0-9_-]+">\n([\s\S]*)\n<\/pasted_content>$/.exec(text)?.[1]?.trim();
2286
+ }
2287
+
2268
2288
  // src/harness/pty/output-coalescer.ts
2269
2289
  var DEFAULT_FLUSH_MS = 40;
2270
2290
  var DEFAULT_MAX_BUFFER_CHARS = 48 * 1024;
@@ -3215,6 +3235,8 @@ var PtySession = class {
3215
3235
  turn;
3216
3236
  codexPromptInArgv = false;
3217
3237
  codexInitialPrompt;
3238
+ awaitingPromptReceipt;
3239
+ promptReceiptSeen = false;
3218
3240
  /** A fresh CLI intentionally started without input for checkout overlap. */
3219
3241
  prewarmed = false;
3220
3242
  codexSource = null;
@@ -3386,6 +3408,8 @@ var PtySession = class {
3386
3408
  }
3387
3409
  /** Reset per-turn state shared by beginTurn/beginPassiveTurn. */
3388
3410
  resetForTurn() {
3411
+ this.promptReceiptSeen = false;
3412
+ this.awaitingPromptReceipt = void 0;
3389
3413
  this.sawResult = false;
3390
3414
  this.lastTurnCleanResult = false;
3391
3415
  this.passiveSignaled = false;
@@ -3661,11 +3685,10 @@ var PtySession = class {
3661
3685
  const transcriptPath = sessionTranscriptPath(this.options.cwd, sessionId);
3662
3686
  await mkdir3(dirname(transcriptPath), { recursive: true });
3663
3687
  const startOffset = this.resume ? await transcriptSize(transcriptPath) : 0;
3664
- const wantsRawRecords = typeof this.bridge?.sendChatEvent === "function" || typeof this.bridge?.notifyBackgroundTaskDone === "function";
3665
3688
  this.tailer = new JsonlTailer(
3666
3689
  transcriptPath,
3667
3690
  (event) => this.handleTranscriptEvent(event),
3668
- wantsRawRecords ? (raw) => this.handleRawRecord(raw) : void 0
3691
+ (raw) => this.handleRawRecord(raw)
3669
3692
  );
3670
3693
  this.tailer.start(startOffset);
3671
3694
  return { settingsPath, socketPath };
@@ -3676,6 +3699,12 @@ var PtySession = class {
3676
3699
  * backgrounded gate/subagent just finished) and the chat-proxy projection.
3677
3700
  */
3678
3701
  handleRawRecord(raw) {
3702
+ const pending = this.awaitingPromptReceipt;
3703
+ if (pending && isPromptReceipt(raw, pending.text, pending.sentAt)) {
3704
+ this.promptReceiptSeen = true;
3705
+ this.awaitingPromptReceipt = void 0;
3706
+ this.disarmSubmitNudge();
3707
+ }
3679
3708
  const completion = backgroundTaskCompletion(raw);
3680
3709
  if (completion) this.bridge?.notifyBackgroundTaskDone?.(completion.taskId);
3681
3710
  if (typeof this.bridge?.sendChatEvent === "function") this.relayChatRecord(raw);
@@ -4010,11 +4039,14 @@ var PtySession = class {
4010
4039
  }
4011
4040
  this.writeStdin(this.adapter.encodePromptBytes(text));
4012
4041
  if (this.turn.promptDelivery === "prefill") return;
4042
+ this.promptReceiptSeen = false;
4043
+ this.awaitingPromptReceipt = { text, sentAt: Date.now() };
4013
4044
  this.deliveredTexts.push(text);
4014
4045
  await sleep(resolveSubmitSettleMs());
4015
4046
  if (this._toreDown) return;
4016
4047
  this.writeStdin("\r");
4017
- if (this.adapter.capabilities.structuredEvents) this.armSubmitNudge();
4048
+ if (this.adapter.capabilities.structuredEvents && !this.promptReceiptSeen)
4049
+ this.armSubmitNudge();
4018
4050
  }
4019
4051
  async feedPrompt() {
4020
4052
  if (typeof this.turnPrompt === "string") {
package/dist/cli.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  runUsageProbe,
28
28
  sampleKeyUsage,
29
29
  usesNativeUsageReporting
30
- } from "./chunk-PLDR42JP.js";
30
+ } from "./chunk-GO7TWB7A.js";
31
31
  import "./chunk-37J5MMQT.js";
32
32
  import {
33
33
  inheritedEnv,
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SessionRunner,
3
3
  unshallowRepo
4
- } from "./chunk-PLDR42JP.js";
4
+ } from "./chunk-GO7TWB7A.js";
5
5
  import "./chunk-37J5MMQT.js";
6
6
  import "./chunk-EKTPDG3G.js";
7
7
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rallycry/conveyor-agent",
3
- "version": "11.0.36",
3
+ "version": "11.0.38",
4
4
  "description": "Conveyor Agent Runner v10 - PTY harness for the task chat (SDK harness for audit/project-chat). Agent-as-User architecture with BaseService patterns. Works locally too.",
5
5
  "keywords": [
6
6
  "agent",