Skip to content

Commit db4f86c

Browse files
fix(compress): skip summary requirement in validateArgs when delegation is active
1 parent fa54773 commit db4f86c

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

lib/compress/message-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class SoftIssue extends Error {
2727
}
2828
}
2929

30-
export function validateArgs(args: CompressMessageToolArgs): void {
30+
export function validateArgs(args: CompressMessageToolArgs, delegated = false): void {
3131
if (typeof args.topic !== "string" || args.topic.trim().length === 0) {
3232
throw new Error("topic is required and must be a non-empty string")
3333
}
@@ -48,7 +48,7 @@ export function validateArgs(args: CompressMessageToolArgs): void {
4848
throw new Error(`${prefix}.topic is required and must be a non-empty string`)
4949
}
5050

51-
if (typeof entry?.summary !== "string" || entry.summary.trim().length === 0) {
51+
if (!delegated && (typeof entry?.summary !== "string" || entry.summary.trim().length === 0)) {
5252
throw new Error(`${prefix}.summary is required and must be a non-empty string`)
5353
}
5454
}

lib/compress/message.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function createCompressMessageTool(ctx: ToolContext): ReturnType<typeof t
5151
args: buildSchema(),
5252
async execute(args, toolCtx) {
5353
const input = args as CompressMessageToolArgs
54-
validateArgs(input)
54+
validateArgs(input, delegated)
5555
const callId =
5656
typeof (toolCtx as unknown as { callID?: unknown }).callID === "string"
5757
? (toolCtx as unknown as { callID: string }).callID

lib/compress/range-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type {
1111

1212
const BLOCK_PLACEHOLDER_REGEX = /\(b(\d+)\)|\{block_(\d+)\}/gi
1313

14-
export function validateArgs(args: CompressRangeToolArgs): void {
14+
export function validateArgs(args: CompressRangeToolArgs, delegated = false): void {
1515
if (typeof args.topic !== "string" || args.topic.trim().length === 0) {
1616
throw new Error("topic is required and must be a non-empty string")
1717
}
@@ -32,7 +32,7 @@ export function validateArgs(args: CompressRangeToolArgs): void {
3232
throw new Error(`${prefix}.endId is required and must be a non-empty string`)
3333
}
3434

35-
if (typeof entry?.summary !== "string" || entry.summary.trim().length === 0) {
35+
if (!delegated && (typeof entry?.summary !== "string" || entry.summary.trim().length === 0)) {
3636
throw new Error(`${prefix}.summary is required and must be a non-empty string`)
3737
}
3838
}

lib/compress/range.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function createCompressRangeTool(ctx: ToolContext): ReturnType<typeof too
6666
args: buildSchema(),
6767
async execute(args, toolCtx) {
6868
const input = args as CompressRangeToolArgs
69-
validateArgs(input)
69+
validateArgs(input, delegated)
7070
const callId =
7171
typeof (toolCtx as unknown as { callID?: unknown }).callID === "string"
7272
? (toolCtx as unknown as { callID: string }).callID

0 commit comments

Comments
 (0)