29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import type { Runtime } from '../runtime.ts';
|
|
import { baseTools } from '../tools.ts';
|
|
import type { ScenarioInfo } from '../types.ts';
|
|
import { collect, evidenceRules, invoke, questionSpec, summarize } from './shared.ts';
|
|
|
|
export const blocking: ScenarioInfo = {
|
|
id: 'blocking',
|
|
task: '整理本周研发周报。先问我下周优先推进什么,再开始查本周工作。',
|
|
system: `${evidenceRules}
|
|
先调用 question 询问下周优先推进什么。原工具返回用户的答复后,再收集证据并给出两段简短摘要。`,
|
|
tools: [...baseTools(), questionSpec(false)],
|
|
};
|
|
|
|
// stage:start
|
|
export async function runBlocking(loop: Runtime) {
|
|
await invoke(loop, 'question', '现在询问下周优先推进什么。',
|
|
(call) => loop.runTool(call, async (args) => {
|
|
const { question, answer } = loop.openQuestion(
|
|
call.id, 'blocking', 'priority', args);
|
|
// 工具在这里等浏览器答复。
|
|
const value = await answer;
|
|
return { ref: question.id, result: JSON.stringify(value) };
|
|
}));
|
|
|
|
await collect(loop);
|
|
return summarize(loop, '给出本周工作摘要,按原 question 的答复写下周计划。');
|
|
}
|
|
// stage:end
|