showrunner-agent-staging 0.5.135-staging.2136 → 0.5.135-staging.2139
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/dist/src/adapter-runner.js +18 -22
- package/dist/src/message-tools.js +3 -3
- package/package.json +1 -1
|
@@ -772,10 +772,9 @@ export class InvocationAdapterClient {
|
|
|
772
772
|
if (retainPendingApprovals) {
|
|
773
773
|
context.signal.addEventListener("abort", () => this.#pendingApprovals.clear(), { once: true });
|
|
774
774
|
}
|
|
775
|
-
|
|
776
|
-
const posted = postedRunAssets(context);
|
|
775
|
+
const personFiles = personMessageFiles(context);
|
|
777
776
|
for (const assetId of messageAssetIds(event))
|
|
778
|
-
|
|
777
|
+
personFiles.add(assetId);
|
|
779
778
|
}
|
|
780
779
|
async reportBilling(billing) {
|
|
781
780
|
await this.#client.reportBilling(this.#event.invocation.id, {
|
|
@@ -1006,18 +1005,17 @@ export class InvocationAdapterClient {
|
|
|
1006
1005
|
if (summary !== undefined)
|
|
1007
1006
|
written = [...written, summary];
|
|
1008
1007
|
}
|
|
1009
|
-
const
|
|
1010
|
-
const fresh = withoutRepostedFiles(written
|
|
1008
|
+
const fresh = withoutPersonFiles(written
|
|
1011
1009
|
.map((piece) => piece.type === "text" ? { ...piece, text: withoutHarnessMarkup(piece.text) } : piece)
|
|
1012
|
-
.filter((piece) => piece.type !== "text" || piece.text.length > 0),
|
|
1010
|
+
.filter((piece) => piece.type !== "text" || piece.text.length > 0), personMessageFiles(this.#context));
|
|
1013
1011
|
if (fresh.length === 0 || fresh.every((piece) => piece.type === "text" && piece.text.trim().length === 0))
|
|
1014
1012
|
return;
|
|
1015
1013
|
const cleaned = withoutDanglingDashes(fresh.map((piece) => piece.type === "text"
|
|
1016
1014
|
? { ...piece, text: withoutCheckoutPaths(piece.text, this.projectDirectory) } : piece));
|
|
1017
1015
|
const original = purpose === MessagePurposeType.Result ? normalizeWorkReportSpacing(cleaned) : cleaned;
|
|
1018
1016
|
let pieces = original;
|
|
1019
|
-
//
|
|
1020
|
-
if (
|
|
1017
|
+
// Only the final work report moves its detail into a note; anything else is read in the chat as written.
|
|
1018
|
+
if (purpose === MessagePurposeType.Result && shouldCreateReplyNote(original, noteTitle)) {
|
|
1021
1019
|
const notePieces = replyNotePieces(original, noteTitle);
|
|
1022
1020
|
const noteCommandId = this.#nextForContent("reply-note.create", original);
|
|
1023
1021
|
try {
|
|
@@ -1066,9 +1064,6 @@ export class InvocationAdapterClient {
|
|
|
1066
1064
|
for (const piece of pieces)
|
|
1067
1065
|
if (piece.type === "changed_files")
|
|
1068
1066
|
this.changedFiles?.markDelivered(piece);
|
|
1069
|
-
for (const piece of pieces)
|
|
1070
|
-
if (isPlainAssetReference(piece))
|
|
1071
|
-
posted.add(piece.assetId);
|
|
1072
1067
|
this.#hasPostedMessage = true;
|
|
1073
1068
|
if (purpose === MessagePurposeType.Failure && !this.#hasPostedFailure) {
|
|
1074
1069
|
this.#hasPostedFailure = true;
|
|
@@ -1453,13 +1448,13 @@ function normalizeUsage(usage) {
|
|
|
1453
1448
|
costMicros: usage.costMicros,
|
|
1454
1449
|
};
|
|
1455
1450
|
}
|
|
1456
|
-
const
|
|
1457
|
-
/**
|
|
1458
|
-
function
|
|
1459
|
-
let assets =
|
|
1451
|
+
const runPersonFiles = new WeakMap();
|
|
1452
|
+
/** The files the person's messages to one run carried, shared by the run's own client and its corrections'. */
|
|
1453
|
+
function personMessageFiles(context) {
|
|
1454
|
+
let assets = runPersonFiles.get(context);
|
|
1460
1455
|
if (assets === undefined) {
|
|
1461
1456
|
assets = new Set();
|
|
1462
|
-
|
|
1457
|
+
runPersonFiles.set(context, assets);
|
|
1463
1458
|
}
|
|
1464
1459
|
return assets;
|
|
1465
1460
|
}
|
|
@@ -1475,14 +1470,15 @@ function isPlainAssetReference(piece) {
|
|
|
1475
1470
|
return piece.type === "asset_reference" && piece.startTime == null && piece.endTime == null && piece.markup == null;
|
|
1476
1471
|
}
|
|
1477
1472
|
/**
|
|
1478
|
-
* A reply doesn't
|
|
1479
|
-
* unfinished sentence before it, and no sentence carrying on after it on the same line. A
|
|
1480
|
-
* inside a sentence ("the difference between v1 and v2") names the file in the prose and
|
|
1481
|
-
* or marked-up moment is new content and always stays.
|
|
1473
|
+
* A reply doesn't hand the person back a file their own message carried when the reference stands on
|
|
1474
|
+
* its own: no unfinished sentence before it, and no sentence carrying on after it on the same line. A
|
|
1475
|
+
* reference inside a sentence ("the difference between v1 and v2") names the file in the prose and
|
|
1476
|
+
* stays. A clip or marked-up moment is new content and always stays. The agent's own files always
|
|
1477
|
+
* post: the person may ask to see them again at any point in a long run.
|
|
1482
1478
|
*/
|
|
1483
|
-
function
|
|
1479
|
+
function withoutPersonFiles(pieces, personFiles) {
|
|
1484
1480
|
return pieces.filter((piece, index) => {
|
|
1485
|
-
if (!isPlainAssetReference(piece) || !
|
|
1481
|
+
if (!isPlainAssetReference(piece) || !personFiles.has(piece.assetId))
|
|
1486
1482
|
return true;
|
|
1487
1483
|
const before = pieces[index - 1];
|
|
1488
1484
|
const after = pieces[index + 1];
|
|
@@ -8,7 +8,7 @@ export const messageToolSchemas = {
|
|
|
8
8
|
messages: z.array(z.object({
|
|
9
9
|
messagePieces: z.array(outputMessagePieceSchema).min(1).max(100).describe("Ordered pieces for this message. Mention each result in a short phrase where it helps, such as 'Live at [link]', 'Added [file] with…', or '[task] is with @person', with its pill inline."),
|
|
10
10
|
title: z.string().trim().min(1).max(100).regex(/^[^\r\n]+$/u).optional()
|
|
11
|
-
.describe("A short 3–8 word document title if this
|
|
11
|
+
.describe("A short 3–8 word document title if this final result (purpose 1) is long enough to become an automatic note. This is only the note title; keep all reply content in messagePieces."),
|
|
12
12
|
purpose: z.enum(MessagePurposeType).optional()
|
|
13
13
|
.describe("0 optional reply while you keep working, including an answer to a mid-run message. 1 final result, 2 failure. Do not send progress-only chat messages."),
|
|
14
14
|
replyToMessageId: z.string().uuid().optional()
|
|
@@ -22,7 +22,7 @@ export function messageToolDescription(name) {
|
|
|
22
22
|
if (name === "set_quiet")
|
|
23
23
|
return "Set your quiet state in this chat when someone asks you to be quiet, mute, or stop chatter (isQuiet true), or to talk again or unmute (false). While quiet, send no optional prose or step chatter. Approvals, questions, failures and final results still come through; your live line stays visible. An @mention clears quiet. Do not send an acknowledgement after setting quiet.";
|
|
24
24
|
return name === "send_messages"
|
|
25
|
-
? `Send replies to this Showrunner chat. When answering a specific message, set replyToMessageId to its messageId so the reply lands where it was asked. Mention each result in a short phrase where it helps, such as 'Live at [link]', 'Added [file] with…', or '[task] is with @person', placing its structured pill inline. For a long
|
|
25
|
+
? `Send replies to this Showrunner chat. When answering a specific message, set replyToMessageId to its messageId so the reply lands where it was asked. Mention each result in a short phrase where it helps, such as 'Live at [link]', 'Added [file] with…', or '[task] is with @person', placing its structured pill inline. For a long final result that becomes an automatic note, set title to a short document title; never use the reply's opening sentence as the title. ${noteFormattingDescription} Delivery is sequential; inspect partial results before retrying.`
|
|
26
26
|
: "React to a message in this Showrunner chat with an emoji. A reaction to the message you were handed is a complete reply to it. A reaction to any other message answers only that message.";
|
|
27
27
|
}
|
|
28
28
|
export async function executeMessageTool(context, name, input) {
|
|
@@ -83,7 +83,7 @@ export async function executeMessageTool(context, name, input) {
|
|
|
83
83
|
context.changedFiles?.markDelivered(changedFiles);
|
|
84
84
|
if (result !== undefined)
|
|
85
85
|
context.completionRequirements?.placed(pieces);
|
|
86
|
-
delivered.push(
|
|
86
|
+
delivered.push(result === undefined ? { index, posted: false } : { index, ...result });
|
|
87
87
|
}
|
|
88
88
|
catch (error) {
|
|
89
89
|
return { success: false, text: JSON.stringify({ delivered, failedIndex: index, remainingUnsent: messages.length - index, ...deliveryError(error) }) };
|