Skip to content

Commit cf1fe02

Browse files
wip v28
1 parent 624eb2e commit cf1fe02

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

packages/pipelines/asset-pack/src/__tests__/finish-delivery.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ describe('finish pull-request delivery', () => {
8989
path: '.bitcode/asset-packs/run-123.md',
9090
});
9191
expect(exec.get('finish', 'deliveryPath')).toBe('.bitcode/asset-packs/run-123.md');
92+
expect(exec.get('tools', 'vcs_create_branch:0')).toMatchObject({
93+
tool: 'vcs_create_branch',
94+
ok: true,
95+
});
96+
expect(exec.get('tools', 'vcs_create_or_update_file:1')).toMatchObject({
97+
tool: 'vcs_create_or_update_file',
98+
ok: true,
99+
});
100+
expect(exec.get('tools', 'vcs_create_pull_request:2')).toMatchObject({
101+
tool: 'vcs_create_pull_request',
102+
ok: true,
103+
});
92104
expect(emitToolUsage).toHaveBeenCalledTimes(3);
93105
expect(emitToolUsage.mock.calls[1][3]).toMatchObject({
94106
path: '.bitcode/asset-packs/run-123.md',

packages/pipelines/asset-pack/src/agents/finish/deliver-asset-pack-to-destination-agent.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,16 +393,30 @@ async function runDeliveryTool<T>(
393393
usedTools: Array<Record<string, unknown>>,
394394
additionalInputSummary: Record<string, unknown> = {},
395395
): Promise<T> {
396+
const toolIndex = usedTools.length;
397+
const toolKey = `${toolName}:${toolIndex}`;
396398
const summarizedInput = summarizeToolInput(input, additionalInputSummary);
397399
try {
398400
const output = await run();
399401
const summarizedOutput = summarizeToolOutput(output);
400402
usedTools.push({ tool: toolName, input: summarizedInput, output: summarizedOutput });
403+
execution.store?.('tools', toolKey, {
404+
tool: toolName,
405+
ok: true,
406+
input: summarizedInput,
407+
output: summarizedOutput,
408+
});
401409
await emitToolUsage(execution, toolName, summarizedInput, summarizedOutput, null);
402410
return output;
403411
} catch (error) {
404412
const message = error instanceof Error ? error.message : String(error);
405413
usedTools.push({ tool: toolName, input: summarizedInput, error: { message } });
414+
execution.store?.('tools', toolKey, {
415+
tool: toolName,
416+
ok: false,
417+
input: summarizedInput,
418+
error: { message },
419+
});
406420
await emitToolUsage(execution, toolName, summarizedInput, null, message);
407421
throw error;
408422
}

0 commit comments

Comments
 (0)