diff --git a/apps/detail-agent-pi/src/agent.mjs b/apps/detail-agent-pi/src/agent.mjs index 2cdbf7a2..a2fd2ea5 100644 --- a/apps/detail-agent-pi/src/agent.mjs +++ b/apps/detail-agent-pi/src/agent.mjs @@ -64,7 +64,7 @@ references是用户提交时冻结的本轮引用;component为pixelMask或vect 只确认已执行的修改。工具失败要说明。生图和画布操作结果未确认时,只核查原编号。`; const PRODUCTION_SYSTEM = `你是小壹的制作助手。依据本项目发布的企业 Skill、商品实拍、资料和模板制作并复核。按需读取适用 Skill 和引用。由你决定工作范围内的顺序、并行和返工。 -当前为无人值守制作,没有可询问的人,也没有人工后期。小壹原生画布完成合成和导出,交付目录已由界面指定。指引中交给人工处理或需要用户确认的事项,可依据商品资料用现有工具处理,确实无法处理的在交付回执中如实列出。 +当前为无人值守制作,没有可询问的人,也没有人工后期;用户启动制作即授权你代为决定。小壹原生画布完成合成和导出,交付目录已由界面指定。指引要求用户事先选择、确认或交人工处理的事项,由你依据商品资料和模板自行决定并继续制作,所作选择和确实无法处理的事项在交付回执中如实列出。 ${PRODUCT_VOICE} 用 plan_production 查看待交付项,open_production_output 切换可写画布,保留各成品在途工作。用 list_project_images 查询本项目可复用的候选。用户附带引用时,用其中的输出、花色、图位、候选或原生图层身份定位目标。 读实时文案并使画面与对应卖点一致。子代理读取本屏实时文案,验图回执绑定当时的文案签名。文案更新后可按新文案复核。安排图位任务时写清需呈现的内容,避免把模板原文当成当前卖点。 @@ -381,6 +381,10 @@ export class DetailPiAgent { }; const cost = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }; const retry = {enabled:true,maxRetries:3}; + // The main agent carries the run, so its waits of 3–60 s ride out a gateway outage of about + // 2.5 minutes (R5 run 8 lost a whole run to a 502 burst longer than the default 14 s window). + // Gateway errors are not billed and the count is bounded. Workers fail fast and are re-delegated. + const mainRetry = {enabled:true,maxRetries:6,baseDelayMs:3000}; const workers = new Map(); // Worker sessions are in memory, so the event log is the only place a failed tool's reason survives. const recordToolEvent = (event,activity,scope) => store.appendEvent({ @@ -542,7 +546,7 @@ export class DetailPiAgent { model: runtime.getModel('jiansun-native-98k', info.model.id), thinkingLevel: reasoning ? info.thinkingLevel ?? undefined : undefined, resourceLoader: loader, customTools, tools: photoCraftToolAllowlist(customTools, productionGoal ? ['get_goal','update_goal'] : []), - settingsManager: SettingsManager.inMemory({retry}), sessionManager: host.manager, + settingsManager: SettingsManager.inMemory({retry:mainRetry}), sessionManager: host.manager, }); const workerSettings = SettingsManager.inMemory({retry,cacheWarming:'off',compaction:{enabled:false},enableSkillCommands:false}); let workerResources; diff --git a/apps/detail-agent-pi/test/native-wire.test.mjs b/apps/detail-agent-pi/test/native-wire.test.mjs index 8989ac54..5c8a2433 100644 --- a/apps/detail-agent-pi/test/native-wire.test.mjs +++ b/apps/detail-agent-pi/test/native-wire.test.mjs @@ -507,7 +507,7 @@ test('a managed inference interruption retries without executing its partial too } finally {await x.close();} }); -test('a broken model stream stops after the three native retries', async t => { +test('a broken model stream stops after the six native retries', async t => { const x=await setup(()=>new Response(new ReadableStream({ start(controller) { controller.error(new TypeError('network error: mock stream disconnected')); }, }),{headers:{'content-type':'text/event-stream'}})); @@ -517,9 +517,9 @@ test('a broken model stream stops after the three native retries', async t => { const retry=settings.getRetrySettings(); settings.getRetrySettings=()=>({...retry,baseDelayMs:1,maxDelayMs:1}); await assert.rejects(x.host.prompt('核对进度'),/network error|network connection|connection error/i); - assert.equal(retry.maxRetries,3); - assert.equal(x.requests.length,4); - assert.equal(new Set(x.ids).size,4); + assert.equal(retry.maxRetries,6); + assert.equal(x.requests.length,7); + assert.equal(new Set(x.ids).size,7); }); test('actual native Pi wire sends function schemas, executes typed call and accepts a plain final reply', async () => { @@ -691,7 +691,7 @@ test('the Pi defaults compact from the native session threshold',async()=>{ const settings=x.host.session.settingsManager; assert.deepEqual(settings.getCompactionSettings(x.host.session.model),{enabled:true,reserveTokens:16384,keepRecentTokens:20000}); assert.deepEqual(Object.fromEntries(Object.entries(settings.getRetrySettings()).filter(([k])=>['enabled','maxRetries','baseDelayMs'].includes(k))), - {enabled:true,maxRetries:3,baseDelayMs:2000}); + {enabled:true,maxRetries:6,baseDelayMs:3000}); await x.host.prompt('继续'); assert.equal(x.calls,3); const checkpoints=x.host.manager.getEntries().filter(entry=>entry.type==='compaction'); diff --git a/apps/detail-agent-pi/test/whitelabel.test.mjs b/apps/detail-agent-pi/test/whitelabel.test.mjs index 4dfce071..15a69575 100644 --- a/apps/detail-agent-pi/test/whitelabel.test.mjs +++ b/apps/detail-agent-pi/test/whitelabel.test.mjs @@ -106,7 +106,7 @@ test('native tooling and production share the documented canvas commands', () => test('the unattended objective records the intended delivery', () => { const objective = productionObjective([{ outputId: 'detail', label: '详情图' }]); const prompt = source('agent.mjs').match(/const PRODUCTION_SYSTEM = `([\s\S]+?)`;/)?.[1]; - assert.match(prompt,/无人值守制作,没有可询问的人,也没有人工后期。小壹原生画布完成合成和导出,交付目录已由界面指定。[^\n]+依据商品资料[^\n]+交付回执中如实列出/u); + assert.match(prompt,/无人值守制作,没有可询问的人,也没有人工后期;用户启动制作即授权你代为决定。小壹原生画布完成合成和导出,交付目录已由界面指定。指引要求用户事先选择、确认或交人工处理的事项,由你依据商品资料和模板自行决定并继续制作,[^\n]+交付回执中如实列出/u); assert.doesNotMatch(source('skills/product-image-sources/SKILL.md'),technicalBrand); assert.match(objective, /按适用制作指引和模板制作并交付[^。]*详情图/); assert.doesNotMatch(objective, /useTemplateReference|read_output_screen/);