mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-24 17:32:18 +00:00
fix(ai): remove bare source output references from fork text
This commit is contained in:
1 parent
447fd418c0
commit
04a98c0894
2 files changed
+13
-1
No files matched your search
@@ -282,3 +282,14 @@ test('one-pass fork eligibility matches clicked-boundary validation', () => {
|
||||
const orphan = session([msg({ role: 'tool', toolResults: [{ toolCallId: 'orphan' }] }), msg({ content: 'reply' })]);
|
||||
assert.equal(getForkableMessageIds(orphan).size, 0);
|
||||
});
|
||||
|
||||
test('fork removes bare output identifiers in transcript previews while preserving JSON', () => {
|
||||
const assistant = msg({ content: 'Read tool-output-source with tool_output_read', thinking: 'Output tool-output-source is saved', toolResults: [{ toolCallId: 'call', content: '{"handleId":"tool-output-source","preview":"Read tool-output-source"}' }] });
|
||||
const plan = planSessionFork(session([msg({ toolCalls: [{ id: 'call' }] }), assistant]), assistant.id);
|
||||
assert.ok(plan.ok);
|
||||
assert.doesNotMatch(JSON.stringify(plan.messages), /tool-output-source/);
|
||||
const parsed = JSON.parse(plan.messages[1].toolResults![0].content!);
|
||||
assert.equal(parsed.handleId, null);
|
||||
assert.match(parsed.preview, /Read/);
|
||||
assert.match(assistant.content, /tool-output-source/);
|
||||
});
|
||||
@@ -157,7 +157,8 @@ function validateToolCallResultPairing(
|
||||
function stripSourceOutputHandles(value: string): string {
|
||||
return value
|
||||
.replace(/\bhandleId=tool-output-[A-Za-z0-9-]+/g, '[saved output remains in the original chat]')
|
||||
.replace(/"handleId"\s*:\s*"tool-output-[A-Za-z0-9-]+"/g, '"handleId":null,"note":"Saved output remains in the original chat"');
|
||||
.replace(/"handleId"\s*:\s*"tool-output-[A-Za-z0-9-]+"/g, '"handleId":null,"note":"Saved output remains in the original chat"')
|
||||
.replace(/\btool-output-[A-Za-z0-9-]+/g, '[saved output remains in the original chat]');
|
||||
}
|
||||
|
||||
export function stripMessageContinuationState<M extends ForkMessageLike>(message: M): M {
|
||||
|
||||
Reference in new issue
Block a user