showrunner-agent-staging 0.5.135-staging.2139 → 0.5.135-staging.2140

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.
@@ -14,7 +14,7 @@ import { isBareApprovalReply } from "./approval-replies.js";
14
14
  import { withoutDanglingDashes } from "./output-vocabulary.js";
15
15
  import { withoutHarnessMarkup } from "./harness-markup.js";
16
16
  import { isPermissionRefusal, normalizeWorkReportSpacing, replySummaryPieces, replyNotePieces, shouldCreateReplyNote } from "./reply-note.js";
17
- import { isTransientFailure } from "./handler.js";
17
+ import { isDueTask, isTransientFailure } from "./handler.js";
18
18
  import { describeStoppedWork } from "./process-ledger.js";
19
19
  import { withoutCheckoutPaths, withoutHostPaths } from "./checkout-paths.js";
20
20
  import { ActiveRunRegistry, overlapInstructions } from "./active-runs.js";
@@ -329,8 +329,10 @@ export function createAdapterProcessor(input) {
329
329
  deliveryId: correction.deliveryId,
330
330
  expectsReply,
331
331
  text: answeredCardReply === undefined
332
- ? `New message to you from ${correction.event.type === "message.created" && correction.event.message.authorTrust === "agent"
333
- ? "the agent you asked" : correction.initiatingProfile.displayName}, posted in ${whereSent(correction)} while you work:\n` +
332
+ ? (isDueTask(correction)
333
+ ? `A scheduled task of yours came due while you work, for ${correction.initiatingProfile.displayName}:\n`
334
+ : `New message to you from ${correction.event.type === "message.created" && correction.event.message.authorTrust === "agent"
335
+ ? "the agent you asked" : correction.initiatingProfile.displayName}, posted in ${whereSent(correction)} while you work:\n`) +
334
336
  withMediaFallbacks(messageText(correction), media.fallbackText) +
335
337
  (expectsReply
336
338
  ? "\nIf a reply is needed, address the person as ‘you’ and set replyToMessageId to its messageId. " +
@@ -79,6 +79,7 @@ export declare class AgentEventHandler {
79
79
  waitForIdle(): Promise<void>;
80
80
  processPending(): Promise<void>;
81
81
  }
82
+ export declare function isDueTask(event: AgentEvent): boolean;
82
83
  export declare function isTransientFailure(error: unknown): boolean;
83
84
  export declare class InvocationCancelledError extends Error {
84
85
  }
@@ -539,17 +539,17 @@ function canCorrect(active, correction) {
539
539
  return answers !== undefined && (answers === active.invocation.id ||
540
540
  (active.event.type === "message.created" && answers === active.event.answersInvocationId));
541
541
  }
542
- if (active.event.type !== "message.created" || correction.event.message.authorTrust === "system" ||
543
- correction.event.scheduledToDoId !== undefined)
542
+ if (active.event.type !== "message.created" || correction.event.message.authorTrust === "system")
544
543
  return false;
545
- // A due task runs on its own and is never folded into a live run. A person's message reaches the live
546
- // run whatever started it or whichever thread it's in, as typing into the CLI reaches it while it
547
- // works; the agent answers it in its own thread.
548
- const senderProfileId = correction.event.message.senderProfileId;
549
- return senderProfileId === correction.initiatingProfile.id &&
550
- (senderProfileId === active.initiatingProfile.id || senderProfileId === (active.installation.ownerProfileId ?? active.trust.ownerProfileId));
544
+ // A person's message or a due task reaches the live run whatever started it or whichever thread it's in,
545
+ // as typing into the CLI reaches it while it works; the agent answers it in its own thread. A due task is
546
+ // sent by whoever created the task, so only the person it runs for counts.
547
+ const initiator = correction.initiatingProfile.id;
548
+ if (correction.event.scheduledToDoId === undefined && correction.event.message.senderProfileId !== initiator)
549
+ return false;
550
+ return initiator === active.initiatingProfile.id || initiator === (active.installation.ownerProfileId ?? active.trust.ownerProfileId);
551
551
  }
552
- function isDueTask(event) {
552
+ export function isDueTask(event) {
553
553
  return event.event.type === "message.created" && event.event.scheduledToDoId !== undefined;
554
554
  }
555
555
  function abortError(signal) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "showrunner-agent-staging",
3
- "version": "0.5.135-staging.2139",
3
+ "version": "0.5.135-staging.2140",
4
4
  "description": "Provider-neutral connector SDK for Showrunner agents",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",